Search code examples
iphoneioscocoa-touchmpmusicplayercontrollermpmediaitemcollection

Is it possible to uniquely identify duplicate MPMediaItems within an MPMediaCollection?


I am using an MPMediaItemCollection to hold a number of user selected music tracks from the iPod music library. I want to be able to uniquely identify each MPMediaItem within the collection even if they are duplicated. Is this possible?


Solution

  • I've had the same problem as you, and Apple has just provided me the solution in iOS v5.0. There is an indexOfNowPlayingItem property in the MPMusicPlayerController class. You can use that to index into your array. This is of course if you are using MPMusicPlayerController.