有没有得到通知,每当一个耳机插孔是在WinRT中的应用程序不插电的方式?我希望能够暂停MediaElement的播放,当它发生,以防止声音从扩音器泄漏。
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.
推荐答案杰克检测的通知通过IMMNotificationClient暴露:: OnDeviceStateChanged。刚刚试了一下win8的桌面上,OnDeviceStateChanged被调用DEVICE_STATE_UNPLUGGED和DEVICE_STATE_ACTIVE时(UN)插入的设备。可悲的是WASAPI的一部分只所以我想有没有办法做到这一点在WinRT的记录为桌面。
Jack detection notification is exposed through IMMNotificationClient::OnDeviceStateChanged. Just tried it on win8 desktop, OnDeviceStateChanged gets called with DEVICE_STATE_UNPLUGGED and DEVICE_STATE_ACTIVE when (un)plugging a device. Sadly that part of wasapi is documented as desktop only so i guess there's no way to do it in WinRT.
更多推荐
如何检测在WinRT中拔出耳机插孔?
发布评论