LazarSoft / jsqrcode

Javascript QRCode scanner

Home Page:http://www.webqr.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Camera does not seems to work anymore with Firefox

heyfellows opened this issue · comments

Hi,

It seems the last version Firefox 58.0.2 (64 bits) is unable to display the video stream in the outdiv.
I can't see specific errors in console, except few CSP issues.
No problem with Chrome.

Regards.

Same problem for me.
It grabs camera, but no video visible.
Also no results shown.
FF: 58.0.2 (64 bites)

And same issue here. Firefox version 59.0.2 (64-bit)

I've notice that online demo here
https://webqr.com/
work fine with FF. Then i download main js from here
https://webqr.com/webqr.js
and put it in my project and now everything work. Need to insert my custom callback again - so if you have some customization in this file you need to do it again or maybe compare will be better option.

In fact, in newest version of Firefox (called Quantum), it uses mediaDevices.getUserMedia instead of mozGetUserMedia.
The mozGetUserMedia method doesn't exist anymore.

So here, the simplest solution is, changing the line 135 of jsqrcode/src/qrcode.js by using these codes

if (typeof v.mozSrcObject === "undefined") {
    //for firefox Quantum
    n.mediaDevices.getUserMedia({video: options, audio: false}).then(success).catch(error);
} else {
    n.mozGetUserMedia({video: options, audio: false}, success, error);
}