64731

Audio devices plugin and plugout event on chrome browser

Question:

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).

<ol><li>

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

</li> <li>

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)

</li> <li>

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

</li> <li>

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

</li> </ol>

Answer1:

(1) in the <a href="https://w3c.github.io/mediacapture-main/#event-summary" rel="nofollow">spec</a>, 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 <a href="https://webrtc.github.io/samples/src/content/devices/input-output/" rel="nofollow">this sample</a>

Recommend

  • How to build a list using a loop python
  • Capture image from webcam and save in folder using PHP and JavaScript
  • AS3 click sound at the start of recording
  • Issues Creating Expandable Table iOS - Objective-C
  • is it possible to mute a call while recording the sound in android
  • Can OpenLaszlo apps access AIR APIs?
  • How can i get the document title in Office 365 JavaScript API?
  • xcode 4.3.2 process hangs
  • Xamarin - is there a way to notify Xamarin.Forms from a native project?
  • Change the font color of disabled input text box?
  • Problem in Loading xml from specified url using javascript in FF & Google Chrome
  • Firefox extension testing and developing - I'm confused
  • Understanding Intl.DateTimeFormat as a JavaScript object
  • Position Fixed in Chrome
  • Visual studio 2015 keystroke with mouse button
  • Call a php script whenever an e-mail is received?
  • Cursor in wrong place in contenteditable
  • Unable to click on the next page button containing “>” sign
  • Is there a way to set up a fallback for the formAction attribute in HTML5?
  • Problems with toDataURL HTML5 other ways to get canvas data?
  • Overlapping controls in Windows XP
  • Is playing sound in Javascript performance heavy?
  • Ensure fsync did its job
  • d3 v4 drag and drop with TypeScript
  • JQuery Internet Explorer and ajaxstop
  • Chrome doesn't support silverlight anymore? How to solve this?
  • Ajax jQuery multiple calls at the same time - long wait for answer and not able to cancel
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Opengl-es onTouchEvents problem or a draw problem? [closed]
  • Window Size for Mac application
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Modifying destination and filename of gulp-svg-sprite
  • Javascript convert timezone issue
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Web-crawler for facebook in python
  • WOWZA + RTMP + HTML5 Playback?
  • GridView Sorting works once only
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Linking SubReports Without LinkChild/LinkMaster