1

I've had a few complaints about my app, InstanTunes, when people are adding the same song twice to the queue, which is queued in the iPod app.

[[MPMusicPlayerController iPodMusicPlayer] setQueueWithItemCollection:collection];

Basically, the problem is that when the user leaves my app and continues to listen to their queue via the iPod app, InstanTunes loses all control and understanding of what is going on. On return to InstanTunes, I'm faced with the problem of the now playing song, given by [musicPlayer nowPlayingItem]; is in my NSMutableArray of MPMediaItems twice but I have no idea what instance of it is the now playing song. Here's a simple diagram to illustrate: diagram

Is song A at index 0 playing? Or song A at index 2 playing?

Can anyone think of a way for me to be able to tell which instance of 'Song A' is playing when the user returns to my app? As far as I know, I can't tag the MPMediaItems to be played in the iPod app.

This is really annoying, since I don't want to remove the ability to add the same song twice, but it is causing countless problems.

Any help, insight or suggestions would be greatly appreciated.

Craig
  • 863
  • 7
  • 7

1 Answers1

0

You can get the index of the nowPlayingItem

Hackmodford
  • 3,901
  • 4
  • 35
  • 78