简体   繁体   中英

Webrtc based video chat , video stream not generated in firefox

I have implemented webrtc based video chat using peerjs.It works fine in chrome but I am not able to generate the stream in firefox. navigator.getUserMedia has been used to generate audio-video stream as follows:

navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
navigator.getUserMedia({
            audio : true,
            video : true
        }, function(stream) {       
            window.localStream = stream;
        }, function(error) {
                console.log(error);
});

When i use above promise in firefox, neither it goes into successcallback nor in errorcallback.

A few things: navigator.*GetUserMedia() is deprecated; you want navigator.mediaDevices.getUserMedia()

peerjs is (IIRC) unmaintained and incompatible with a number of aspects of current spec. It has been forked by NTT/Skyway and that version should be usable.

The above code does not seem to be a Promise... (navigator.mediaDevices.getUserMedia() does return a Promise).

For examples that work with Firefox, see our rough test page at https://mozilla.github.io/webrtc-landing , especially https://mozilla.github.io/webrtc-landing/gum_test.html . For a very-compatible shim layer, see adapter.js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM