Changing playback rate of AVPlayer produces choppy Audio

954 Views Asked by At

I am using AVPlayer in my app. My app supports the change of speed of playback of audio and video. I am initializing the player as follows.

 AVPlayerItem * playerItem= [AVPlayerItem playerItemWithURL:self.audioUrl];
     playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithmSpectral;
     self.player = [AVPlayer playerWithPlayerItem:playerItem];
        self.player.allowsExternalPlayback= YES;
[self.player.currentItem addObserver:self
                                  forKeyPath:@"status"
                                     options:0
                                     context:nil];

and when i have to change the playback rate of audio i do as follows

self.player.rate = 2.0f;

It was working fine. But recently when i change the rate property of AVPlayer it start producing choppy voice. I already have set the audioTimePitchAlgorithm to

AVAudioTimePitchAlgorithmSpectral

but still it producing choppy voice. Can anyone tell me what i am doing wrong, or what i have to do to avoid this choppy voice and to produce smooth sound.

0

There are 0 best solutions below