Hi I have a locally stored 5:00 minutes mp3 files in my iPhone app.
I would like to know if it is possible to play just an interval from that file using AVAudioPlayer after it is readyToPlay, lets say from 0:25 to 1:34.
If it is possible how can I achieve that?
I know I can move the playhead cursor using setCurrentTime: but how do I let the AVAudioPlayer know how many seconds it should play from that currentTime.
Any help is highly appreciated.
您需要设置一个计时器,该计时器将在特定时间间隔后停止播放。
@Horatiu您可以使用NSTimer
在使用setCurrentTime:
方法后的特定时间间隔内安排它,并且在NSTimer
的选择器方法中,您可以使audioPlayer停止。
Fire a timer when you start playing the file. When the required time is reached pause
or stop
the player
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.