Reputation: 5177
I'm trying to play multiple mp3's with AVPlayer
. I fetch URLs of the mp3's and then let AVPlayer
plays them one by one.
My first attempt is letting a single AVPlayer
plays all the mp3's with replaceCurrentItemWithPlayerItem
method. But there is no sound except for the first song.
When I try to generate AVPlayer
for every single item, and let each AVPlayer
plays its item, the app works as I wished.
My question is, is AVPlayer
designed to play a single item? If I don't want to allocate a new AVPlayer
for each item, I have to use AVQueuePlayer
to play multiple items, right? Which method is preferred?
Upvotes: 4
Views: 2187
Reputation: 5177
AVQueuePlayer
works perfectly for this case. It'll remove played items automatically.
Upvotes: 3