Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 AVAudioPlayer 出现问题,如果它被暂停,我无法让它再次播放。暂停后调用 [audioPlayer play] 返回 NO 而不是通常的 YES。知道是什么原因造成的吗?
其他人也有同样的问题:
http://www.iphonedevforums.com/forum/sdk-coding-help/750-avaudioplayer-doesnt-start-back-up-after-interruption.html
currentTime在调用 play 方法之前设置时我遇到了同样的问题。currentTime在调用 play 方法后将的属性集移动到允许AVAudioPlayer返回YES而不是NO. 我不确定这是为什么,希望它有所帮助。
currentTime
AVAudioPlayer
YES
NO
编辑:在进一步咨询此问题后,调用 stop then play 似乎更一致,因此允许currentTime在播放方法之前进行设置。您可能想prepareToPlay在停止后立即打电话,但在您准备好恢复时再次排队播放。
prepareToPlay