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 在我的 iPhone 应用程序中向用户播放 mp3 文件。这一切都很好,花花公子。我什至会根据播放器的状态更新播放/暂停按钮。但是很高兴知道这首歌会播放多长时间。
那么如何显示剩余时间呢?
您可以设置 NSTimer 并audioPlayer.duration - audioPlayer.currentTime在播放时进行计算。
audioPlayer.duration - audioPlayer.currentTime