title: How can you play music from the iPod app while still receiving remote control events in your app?
body: <p>Ok, I'm trying to let a user choose songs from their iPod library to listen to, but I still want to receive remote control notifications (headphones, lock screen osd, etc.) in my app so I can do some extra things.  So far I can get either iPod music playing, or headphone events, but not both simultaneously.</p>
  
  <p>Here's what I know so far...</p>
  
  <ol>
  <li><p>If you use the MPMusicPlayer, you can easily have programmatic access to the entire music library.  However, it, not your app, receives the remote notifications regardless if you use applicationMusicPlayer or ipodMusicPlayer.</p></li>
  <li><p>If you use AVAudioPlayer (Apple's recommended player for most sounds in your app), you can easily get remote notifications, but it doesn't natively have access to the iPod library.</p></li>
  <li><p>AVAudioPlayer can be initialized with an asset URL, and tracks in the iPod library (type MPMediaItem) do have a URL property that returns a NSURL instance which the documentation says its explicitly for use with AVAsset objects, but when you try initializing the AVAudioPlayer with that NSURL, it fails. (I used the 'now playing' track in iPod which was a MP3 and it did return a valid NSURL object but initialization failed.  Even worse, when it was an Audible.com file, the NSURL property flat-out returned nil.)</p></li>
  <li><p>If you try using an instance of the AVAudioPlayer to get remote events (say, with a blank sound file), then simultaneously use the MPMusicPlayer class to play iPod music, you have remote control access until you actually start iPod playback at which time you lose it since your audio session gets deactivated and the system audio session becomes active.</p></li>
  <li><p>If you try the same as #4 but you instead set the audio session's category to a mixable variant, your session doesn't get deactivated, but you still lose remote control capability once the iPod starts playing.</p></li>
  </ol>
  
  <p>In short, whenever MPMusicPlayer is playing, I can't seem to get remote events, and I don't know of any other way to play content from the iPod's library other than by using MPMusicPlayer.</p>
  
  <p><strong>ANY</strong> suggestions on how to get around this would be welcome.  Creative or flat-out crazy.  Don't care so long as it works.</p>
  
  <p>Anyone? Anyone? Bueller? Bueller?</p>
  
  <p>M</p>