DetectRTC icon indicating copy to clipboard operation
DetectRTC copied to clipboard

Firefox 57.0 (x64)

Open PatSpiegel opened this issue 7 years ago • 9 comments

Label device didnt show, but permision granted

PatSpiegel avatar Dec 01 '17 13:12 PatSpiegel

Are you using latest commit i.e. this file?

  • https://github.com/muaz-khan/DetectRTC/blob/master/DetectRTC.js

muaz-khan avatar Dec 01 '17 13:12 muaz-khan

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);
    });
}

muaz-khan avatar Dec 01 '17 14:12 muaz-khan

In demo site didnt work

PatSpiegel avatar Dec 01 '17 14:12 PatSpiegel

Please try demo site on Firefox private tab/window.

muaz-khan avatar Dec 01 '17 15:12 muaz-khan

In private and with refresh (ctrl+f5) didnt work

PatSpiegel avatar Dec 01 '17 15:12 PatSpiegel

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.

Naehs avatar Dec 01 '17 16:12 Naehs

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.

Naehs avatar Dec 01 '17 16:12 Naehs

clarify, I meant Windows 7 Firefox 57.0 x64

PatSpiegel avatar Dec 01 '17 16:12 PatSpiegel

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?

JackBilesAmmi avatar Mar 16 '19 18:03 JackBilesAmmi