设置AVAudioTimePitchAlgorithmVarispeed为AVFoundationAudioSettings

根据这些文档 ,我可以更改AVAudioPlayer的某些设置,包括AVAudioTimePitchAlgorithmVarispeed设置。 我将如何设置这个值? 我是否需要inheritanceAVAudioSetting.h?

如果没有要求使用AVAudioPlayer,可以使用AVPlayer

 AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url]; playerItem.audioTimePitchAlgorithm = AVAudioTimePitchAlgorithmTimeDomain; AVPlayer *player = [AVPlayer playerWithPlayerItem:playerItem]; [player play];