Is there a way to detect when a user pluggs or unpluggs the headphones on wp7?
The problem is that when a song is playing on a background AudioPlayerAgent and the user plugs on unplugs the phones, the protected override void OnUserAction method of the AudioPlayerAgent receives a pause UserAction and pauses the music.
I need to detect the plug/unplug on the UI thread so I can update the GUI to reflect a paused state.
You need to subscribe to the PlayStateChanged event of the BackgroundAudioPlayer within your page: