I'm currently developing a prototype that logs video chat information from third party services like Hangouts, Zoom, etc.
So far I'm unable to get a simple event to log to the console with navigator.mediaDevices.ondevicechange
. Using the latest version of Chrome.
https://codepen.io/anon/pen/dqbNKR
I'm using this pen, and all I want to do is just log to the console when my video camera turns on/off. Is ondevicechange
the right event?
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/ondevicechange
A devicechange event is sent to a MediaDevices instance whenever a media device such as a camera, microphone, or speaker is connected to or removed from the system. It's a generic Event with no added properties.
I know I can also look at streams of specific elements, but since it's 3rd party services I don't necessarily know which elements to look at.
So how can I detect when my webcam turns on/off in a third party app in the browser?
As I was typing this I came across this, but need to test it.
How to check with JavaScript that webcam is being used in Chrome