I'm trying to detect whenever the default/selected microphone changes or gets disconnected in a web app using plain Javascript. The idea is to let the user know if the correct microphone is selected and working or not.
The best option I've found is MediaDevices.ondevicechange. But it seems to be behind the Experimental Web Platform features flag in Google Chrome:
It is behind the
Experimental Web Platform features
flag, and use call it withnavigator.mediaDevices.ondevicechange = ...
Another answer on this topic echoes the same thing:
Browser Support It looks like it's pretty patchy as of writing this. See this related question: Audio devices plugin and plugout event on chrome browser for further discussion, but the short story is for Chrome you'll need to enable the "Experimental Web Platform features" flag.
My question is two-fold:
- Is my understanding actually correct that I cannot use MediaDevices.ondevicechange on Chrome without the experimental features flag? (I cannot use this flag because of some other constraints).
- Is there another way for me to detect an audio device change?