I note with frustration that the marked answer does in fact not answer the specifically asked question at all although yes, it's very helpful for the OP in answering a different question from the one they asked, which helps them move forward and that's great.
The marked answer does tell you how to unobviously fudge the awkwardly different API classes into a player queue, but ignores all of the entirely valid issues that the OP brings up on detecting end-of-track - an elementary and obvious thing to need and available in every other player API I've ever used. It's just extraordinary that the API could be so obtuse - the playback status is nonsensical (paused), indistinguishable from other events (speaker disconnect), the now-playing items don't make sense (sometimes nil, sometimes not) and the current position is meaningless. Indeed, when it's not zero, often the current position when the event arrives will be returned as either slightly before the song's stated duration, or even slightly after the end of the track! How on earth it's possible to be this completely wrong is a mystery - we've had other remarkably robust APIs for streaming music since dialup in the 1990s.
The next question the OP will have is why their queue of music keeps just randomly skipping tracks - and indeed in the worst case, with looping turned on, can even get stuck in a tight loop skipping every single track endlessly - because of the years-old "failed to prepare to play" bug. And that's before we even get to all the new bugs added with lossless, wherein, of course, nothing else actually got fixed - I mean, heaven forbid we improve product quality rather than just jamming in even more buggy features, right?
The MediaPlayer API is a very poorly designed interface but on top of that, it's by far the most buggy API I've ever worked with in over 25 years of professional development plus my spare time hobby projects. Apple - hang your head in shame; it's atrocious. I'd be so, so happy to hear that you're going to do some serious engineering to fix it up, but I'm sadly very confident that you just don't care at all.
Topic:
Media Technologies
SubTopic:
General
Tags: