Reputation: 200
Is it possible to check if camera and microphone are in use by another PC application (like Skype)?
The problem is, I'm able to get the stream object and initiate the connection between two computers, but there's no video nor sound, because the devices are in use by Skype. What I need is a way to detect if the devices are busy in order to tell the user to close the applications that are using the camera and microphone
I know it's possible to check if there are any devices present on the PC with MediaStreamTrack.getSources(), however it does not provide any information about devices status.
Upvotes: 3
Views: 4510
Reputation: 10329
The testrtc project has a test that detects silence from a microphone here that could be useful in determining if the audio track returned is silent, and a similar video test that detects frozen or black frames.
Upvotes: 2
Reputation: 17265
There is no direct way, but getUserMedia should throw errors and/or return less audio/video tracks than you would expect if checking whether a device exists.
Devices can be detected either from MediaStreamTrack.getSources or (preferably) the spec-compliant navigator.mediaDevices.enumerateDevices.
Upvotes: 1