如何检测在WinRT中拔出耳机插孔?

编程入门 行业动态 更新时间:2024-10-24 20:12:15
本文介绍了如何检测在WinRT中拔出耳机插孔?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有得到通知,每当一个耳机插孔是在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中拔出耳机插孔?

本文发布于:2023-11-05 04:07:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559854.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插孔   耳机   WinRT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!