AVAUdioPlayer - changing current URL

前端 未结 2 1315
无人共我
无人共我 2020-12-17 05:06

In my audio player app, if I hit the fast forward button - the player must find the next song in the playlist and play it. What I do is I get the URL from the next song, and

2条回答
  •  醉梦人生
    2020-12-17 05:47

    Have checked 4 Apple samples, they are using AVAudioPlayer to play one song only. However, your result looks very interesting and impressive! Please let us know, are you stopping the playback before reinitializing object with the same address, are you starting the new audio session ?

    As for me, I'd not put the playback and app stability in a risk doing something not mentioned in the documentation but , but to be on the bright side would use the AVAudioPlayer class as it seems the most right, which gives us:

    • use the error variable to track the possible errors
    • stop the playing AVAudioPlayer instance, initialize a new instance of AVAudioPlayer and set it to the property letting an old-one to be deallocated automatically.

    And you probably know yourself, that

    self.background = [self.background initWithContentsOfURL::
    

    will remove the warning for you.

提交回复
热议问题