Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wp7 mediaelement stops when unplugging the headset

I am using a mediaelement and when the headset is unplugged I get a mediafailed event with NullReferenceException. Since the media element stream is not working anymore, I want to be able to distinguish this case and to handle it properly.

like image 406
petrumo Avatar asked Nov 13 '22 21:11

petrumo


1 Answers

It is in the windows phone 7 design that when you unplug a headset or your headphones that the music player or other apps using the mediaelement should pause.

You can have a look at the CurrentStateChanged event to see if the state of the MediaElement is changed.

docs: http://msdn.microsoft.com/en-us/library/system.windows.controls.mediaelement.currentstatechanged%28VS.95%29.aspx

like image 83
GeertvdC Avatar answered Dec 24 '22 12:12

GeertvdC