Firefox-ios: Why Firefox in IOS Mobile is not supporting the webRTC and MediaDevices.getUserMedia()

Created on 25 May 2018  ·  3Comments  ·  Source: mozilla-mobile/firefox-ios

Hi, I am Trying to create browser based QR code reader, it works in Android but in IOS 11 or any version of IOS its not working, as you I can't debug it in IOS for Firefox.

below is my code

                 // Older browsers might not implement mediaDevices at all, so we set an empty object first
                    if (navigator.mediaDevices === undefined) {
                      navigator.mediaDevices = {};
                    }

                    // Some browsers partially implement mediaDevices. We can't just assign an object
                    // with getUserMedia as it would overwrite existing properties.
                    // Here, we will just add the getUserMedia property if it's missing.
                    if (navigator.mediaDevices.getUserMedia === undefined) {
                      navigator.mediaDevices.getUserMedia = function(constraints) {

                        // First get ahold of the legacy getUserMedia, if present
                        var getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

                        // Some browsers just don't implement it - return a rejected promise with an error
                        // to keep a consistent interface
                        if (!getUserMedia) {
                          return Promise.reject(new Error('getUserMedia is not implemented in this browser'));
                        }

                        // Otherwise, wrap the call to the old navigator.getUserMedia with a Promise
                        return new Promise(function(resolve, reject) {
                          getUserMedia.call(navigator, constraints, resolve, reject);
                        });
                      }
                    }

                    navigator.mediaDevices.getUserMedia({ video: { facingMode: { exact: "environment" } } })
                    .then(function(stream) {

                      // Older browsers may not have srcObject
                      if ("srcObject" in video) {
                        video.srcObject = stream;
                      } else {
                        // Avoid using this in new browsers, as it is going away.
                        video.src = window.URL.createObjectURL(stream);
                      }

                      video.onloadedmetadata = function(e) {
                        video.play();
                        video.setAttribute("playsinline", true); // required to tell iOS safari we don't want fullscreen
                      };
                      requestAnimationFrame(tick);
                      localStream = stream;
                    })
                    .catch(function(err) {
                      console.log(err.name + ": " + err.message);
                    });

Is Mozilla does not support the webRTC and MediaDevices.getUserMedia() in IOS mobile?
If Yes, when it will be supported?

All 3 comments

When it will be supported?

Whenever the overlords at Apple decide to make that feature available to 3rd party browsers.

Also, HTML5test reports WebRTC 1.0 as supported on Firefox 12.0 for iOS 11.4.

Closing due to inactivity. Please reopen if you feel it is still is relevant

webRTC error is still an issue with Firefox on ios13

Was this page helpful?
0 / 5 - 0 ratings