我在我的应用程序中使用AVPlayer . 我的应用程序支持更改音频和视频的播放速度 . 我正在按如下方式初始化播放器 .
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];
当我必须改变音频的播放速率时,我按如下方式进行
self.player.rate = 2.0f;
它工作正常 . 但是最近当我改变AVPlayer的速率属性时,它开始产生不稳定的声音 . 我已经将 audioTimePitchAlgorithm
设置为
AVAudioTimePitchAlgorithmSpectral
但它仍然会产生波涛汹涌的声音 . 任何人都可以告诉我我做错了什么,或者我必须做些什么来避免这种不稳定的声音并产生平滑的声音 .