Logo Questions Linux Laravel Mysql Ubuntu Git Menu

How to detect unplugged headphone jack in WinRT?

Is there a way to get notified whenever a headphone jack is unplugged in a WinRT app? I want to be able to pause MediaElement playback when it happens to prevent the sound from leaking out through loudspeakers.

like image 444
Ronny Gunawan Avatar asked Mar 24 '23 23:03

Ronny Gunawan

1 Answers

Try the following:


This works on WinRT.

See MSDN for more detail on the method: http://msdn.microsoft.com/en-us/library/ie/windows.devices.enumeration.deviceinformation.createwatcher

like image 75
Guillaume LaHaye Avatar answered Apr 25 '23 18:04

Guillaume LaHaye