dwa012 / html5-qrcode

A cross platform HTML5 QR code reader.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

still not work on android and ios

Alphonse99 opened this issue · comments

how can i fix it

I also have the problem that the code is working fine on desktop chrome 52 for example.
But on Android 6 with Chrome 52 the camera feed is displayed but freezes after one second.
The feed continues if the html element containing the video source is touched and moved permanently. As long as there is movement the video feed is updated. Without interaction the video stops.

Is there a solution to this problem?

@sthag about that problem, I fixed it by adding the 'autoplay' attribute to the video element here: https://github.com/dwa012/html5-qrcode/blob/e9f06a7/src/html5-qrcode.js#L18

By the way, it might be useful to look at the source code of the upstream library's demo webpage:

https://webqr.com/

Thanks @danieleds for pointing out the autoplay issue.
Maybe I have the time for a pull request in the future.

The autoplay element didn't help on Android 7 (Nexus 6P) .. video only refreshes when i scroll the page up/down a little.

Curious too, https://webqr.com/ doesn't work for me in Chrome (windows 7)

All camera demos I checked online don't seem to work on mobile. All the qr code demos instead don't work either on mobile nor on desktop with Chrome 53.

I'm using this library for a mobile webapp but the camera freezes unless I constantly move the page around with my finger. How can I make sure that the camera feed is constantly being updated so I don't have to constantly move the page around?

@Alexstraza You can add the autoplay attribute to the video element within the source code like danieleds mentioned before #46 (comment) This worked for me.

@sthag Thanks! It worked!

For people still struggling, just add

video.setAttribute('autoplay',''); under line 25, which would be under
var video = vidElem[0]; var canvas = canvasElem[0]; var context = canvas.getContext('2d'); var localMediaStream;.

only works on MAC (even with the fix mentioned above)

Tried on an iphone 9.3 (safari & firefox) and also on my laptop (windows 7) on firefox and chrome and both are not working (for laptop : nothing show on your example page or on my fiddle and for iphone, it show a play button but nothing happens when i click)

https://jsfiddle.net/5yrj1zz2/3/

@PierreTrp I don't think it will work on an iPhone period because it doesn't allow the browser to access the camera