DetectRTC
DetectRTC copied to clipboard
Firefox 57.0 (x64)
Label device didnt show, but permision granted
Are you using latest commit i.e. this file?
- https://github.com/muaz-khan/DetectRTC/blob/master/DetectRTC.js
Latest CDN/DetectRTC updates removed following labels:
Please invoke getUserMedia once.
If your code is comparing above labels, then please update your code as following:
if (DetectRTC.MediaDevices[0] && DetectRTC.MediaDevices[0].isCustomLabel) {
// it seems that we did not make getUserMedia request yet
navigator.mediaDevices.getUserMedia({
audio: true,
video: true
}).then(function(stream) {
var video;
try {
video = document.createElement('video');
video.muted = true;
video.src = URL.createObjectURL(stream);
video.style.display = 'none';
(document.body || document.documentElement).appendChild(vide);
} catch (e) {}
DetectRTC.load(function() {
DetectRTC.videoInputDevices.forEach(function(device, idx) {
// ------------------------------
// now you get valid label here
console.log(device.label);
// ------------------------------
});
// release camera
stream.getTracks().forEach(function(track) {
track.stop();
});
if (video && video.parentNode) {
video.parentNode.removeChild(video);
}
});
});
} else {
DetectRTC.videoInputDevices.forEach(function(device, idx) {
console.log(device.label);
});
}
In demo site didnt work
Please try demo site on Firefox private tab/window.
In private and with refresh (ctrl+f5) didnt work
I confirm that now it's working, but i seems toi have some trouble on devices increments.
I mean that i have 3 microphone devices, the list je showed like :
- Microphone 3
- Microphone 3
- Microphone 3
Well after refreshing it's Ok. You should verify the increments case.
Regards, Loïc.
I found the issue.
In Android Chrome, restore the grants for microphone and camera. Refresh the page, before accepts the permissions you will see the increments trouble.
Loïc.
clarify, I meant Windows 7 Firefox 57.0 x64
Latest CDN/DetectRTC updates removed following labels:
Please invoke getUserMedia once.
If your code is comparing above labels, then please update your code as following:
if (DetectRTC.MediaDevices[0] && DetectRTC.MediaDevices[0].isCustomLabel) { // it seems that we did not make getUserMedia request yet navigator.mediaDevices.getUserMedia({ audio: true, video: true }).then(function(stream) { var video; try { video = document.createElement('video'); video.muted = true; video.src = URL.createObjectURL(stream); video.style.display = 'none'; (document.body || document.documentElement).appendChild(vide); } catch (e) {} DetectRTC.load(function() { DetectRTC.videoInputDevices.forEach(function(device, idx) { // ------------------------------ // now you get valid label here console.log(device.label); // ------------------------------ }); // release camera stream.getTracks().forEach(function(track) { track.stop(); }); if (video && video.parentNode) { video.parentNode.removeChild(video); } }); }); } else { DetectRTC.videoInputDevices.forEach(function(device, idx) { console.log(device.label); }); }
is (vide)
a typo or intended?