How I can create a crossfader between two sound track with AVAudioplayer?
I must use AVAudiomix? But... how I should use?
How I can create a crossfader between two sound track with AVAudioplayer?
I must use AVAudiomix? But... how I should use?
AVAudioPlayer does not support using an AVAudioMix. You could try to fade out the playing yourself by directly setting the playback volume but getting the timing right between two AVAudioPlayers will be difficult as AVAudioPlayer is known to have very high and unpredictable latency when starting to play.
One way to accomplish this is to use AVPlayer and AVPlayerItem and AVComposition. You can setup the composition to overlay the two audio files by your desired amount and setup the AVAudioMix fade out the first and fade in the second. This method will let you have precise control over when the audio files play relative to one another.