使用BackgroundAudioPlayer的PlayStateChanged事件来检测耳机。 [英] Issue using BackgroundAudioPlayer's PlayStateChanged event to detect headphone.

查看:92
本文介绍了使用BackgroundAudioPlayer的PlayStateChanged事件来检测耳机。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,如果我在插入耳机时开始播放音频,然后移除耳机,PlayStateChanged事件永远不会升起,音频继续播放但移动到扬声器。如果我在耳机中插入
时正在播放音频,那么当我将其移除并暂停音频时,它会引发该事件。有人可以解释这种差异吗?如何在移除耳机时始终如一地收到PlayStateChanged事件?谢谢!

I've got an issue where if I begin playing audio while the headphones are plugged in, and then remove the headphones, the PlayStateChanged event never gets raised and audio continues to play but moves to the speaker. If the audio is playing when I plug in headphones, it will then raise the event when I remove them and pause the audio. Can someone explain the discrepancy and how can I consistently receive the PlayStateChanged event when the headphones are removed? Thanks!

推荐答案

当播放状态发生变化时会引发此事件,因此如果您拔下耳机并且音频仍在播放,那么您将不会得到这个方法。 您需要与设备制造商联系以解决此问题,因为您无法控制
此硬件事件。
This event is raised when the play state changes, so if when you unplug the headphones and the audio is still playing then you will not get this method.  You would need to engage the manufacturer of your device to resolve this since you have no control over this hardware event.


这篇关于使用BackgroundAudioPlayer的PlayStateChanged事件来检测耳机。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆