Chrome浏览器上的音频设备插件和插件事件 [英] Audio devices plugin and plugout event on chrome browser

查看:1188
本文介绍了Chrome浏览器上的音频设备插件和插件事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用WebRTC构建一个音频聊天Web应用程序。所以我试图建立,如果任何外部音频设备插入系统我的应用程序会自动开始使用该麦克风,当外部设备插入应用程序开始使用系统默认麦克风(作为环聊做)。


  1. 是否有任何事件通知我有关插入设备的插入信息?(对于Chrome浏览器)


  2. 是否有任何方法可以知道我们从浏览器获得的所有列出的设备中使用哪个设备,以便我们实际获得音频? (例如,在桌面系统中,有两个麦克风插孔,一个在背面,另一个在背面,所以当将媒体设备放入浏览器时,我们将同时获得两个插孔作为设备,但是如何在这个特定插孔中选择两个插孔麦克风插入)


  3. 系统如何选择默认设备。浏览器提供的默认和通讯设备有什么区别?

  4. $ b是否总是使用默认设备? $ b


解决方案

(1)在 spec 时,会在navigator.mediaDevices对象上触发devicechange事件。这尚未在Chrome中实施。您可以轮询navigator.mediaDevices.enumerateDevices,它会对性能产生影响。

(2)枚举设备并查看其标签?请参阅此示例


I'm building an audio chat web application using WebRTC. So I trying to build that if any external audio device get plugged-in to the system my application automatically start using that microphone and when that external device plugged out application start using system default microphone (as Hangout do).

  1. Is there any event that notify me about device plugged-in plugged-out information?(For chrome browser)

  2. Is there any way to know which device to use in all the listed device that we get from browser so that we actually get an audio? (For example as in desktop systems there are two microphone jacks one in front-side another in back-side so when get Media Devices in browser we will get both jacks as device, but how to choose between both jacks that in this particular jack a microphone is plugged-in)

  3. How system choose default device. Is it good to use always default device?

  4. What is the difference between default and communication devices that browser provides?

解决方案

(1) in the spec, a devicechange event is fired on the navigator.mediaDevices object. That is not yet implemented in Chrome. You can poll navigator.mediaDevices.enumerateDevices which has a performance impact however.

(2) enumerate the devices and look at their labels? See this sample

这篇关于Chrome浏览器上的音频设备插件和插件事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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