I'm struggling to get device selection for a video room working reliably. I've gone back to basics, using the video room demo code, with the following changes:
- Added the below lines at the start of the publishOwnFeed function
var mediaobj = { audioRecv: false, videoRecv: false, audioSend: useAudio, videoSend: true };
var vdev = (getQueryStringValue("vdev") !== "" ? getQueryStringValue("vdev") : null);
var adev = (getQueryStringValue("adev") !== "" ? getQueryStringValue("adev") : null);
if(vdev != null){
console.log('Choosing Video Device: ' + vdev);
mediaobj.video = { deviceId: { exact: vdev } };
}
- Changing the media argument in createOffer a few lines down for the mediaobj object created above.
From previous experiments in this same code file, I have retrieved a list of device ID's using the Janus.listDevices method as in the demo change devices code which I have then tried providing to these two GET variables.
If I leave them unset, the default camera and mic gets selected, everything works fine. If I set the id's (one or both), whether its to the default camera and mic or other devices, the feed starts, and I can subscribe to it but after 5-10 seconds, the video on the subscriber starts to disappear intermittently and then within 30 seconds is gone altogether, leaving the 'No remote video available' message on screen.
Just wondering what I might be doing wrong here, I do get a Remote track muted message in the subscriber console, followed by a Removing remote track message. Should I be using the string name of the device rather than a number, e.g.: 'OBS Virtual Camera' rather than 84bcd5094a7cfaf334cef3efa8b163bbf5b980cda12209ec293e17e5ffacf994.
Many thanks!