Playing audio that is retrieved from url
I am getting a list of songs and its corresponding images from a url.The url is a json url.开发者_如何学Python When i click the list a corresponding song is played. I have used AVFoundation Framework to play the song. Now the issue is that i need to play the next song after the playing of first song is completed. The corresponding images also must load. If i click the next or previous button the corresponding songs must be played. What is the best possible mechanism to attain it???
I have read about the Audio Queues and Audio Units but not sure how to use them. I'll be really helpful if i am provided with some sample code of how to do it.
The easiest thing is to just place an If
statement in audioPlayerDidFinishPlaying
which is what is called after each sound is played (if playing them with an AVAudioPlayer
).
You can also use that to update whatever images you need to as well based on the name.
精彩评论