LazarSoft / jsqrcode

Javascript QRCode scanner
http://www.webqr.com
Apache License 2.0
3.96k stars 1.16k forks source link

Not working in Safari 11 #75

Open jacdec opened 6 years ago

jacdec commented 6 years ago

Actually Safari 11 supports WebRTC: https://developer.apple.com/library/content/releasenotes/General/WhatsNewInSafari/Safari_11_0/Safari_11_0.html

Unfortunately this script is currently not working... Is anybody having the same problem? It's known, that Safari requires some special tags (https://github.com/webrtc/samples/issues/929) - but I couldn't figure out the error in the js.

Lucassifoni commented 6 years ago

Hi, do you have some logs ? I can probably help with that !

jacdec commented 6 years ago

I found a solution. The latest rtc-adapter was missing linked in the html. Furthermore the "playsinline"-tag has to be added to the video element. If both changes are applied it's working like a charm!

liviuk2 commented 6 years ago

Hi, @jacdec could you please give me more detailed informations about the modifications that you made to get it work on safari? I have the same problem...

Orifiael commented 5 years ago

What he said: in webqr.js change: var vidhtml = '<video id="v" autoplay></video>'; to var vidhtml = '<video id="v" autoplay playsinline></video>';

in index.html: add: <script type="text/javascript" src="https://webrtc.github.io/adapter/adapter-latest.js"></script>

For it to work on your iPhone (Safari) -

P.s. When you activate the camera on the phone, it will be facing you. You can rectify that by pressing the video icon again, however it acts as a selector, it actually starts being 'pressed'. to overide you'd need to click the camera icon and then the video icon.