Reputation: 51
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.
Upvotes: 0
Views: 214
Reputation: 6984
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
Upvotes: 1