dwa012 / html5-qrcode

A cross platform HTML5 QR code reader.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do you stop the video from scanning?

ice423cube opened this issue · comments

I am using the qrcode in div which was launched in a modal window. How do I stop the QR Code & camera after capturing code. Is there a way to stop the qrcode & camera.

It looks like there is no stop function to call here https://github.com/dwa012/html5-qrcode/blob/master/lib/jsqrcode-combined.min.js. But there is a stop function in in this code https://github.com/dwa012/html5-qrcode/blob/master/lib/html5-qrcode.min.js but this code doesn't have the qrcode reader. Please let me know what you did to stop the camera. Thanks!

Is this what you are looking for?
From the bottom of the usage section in README.md

When you're done using the camera, call $('#reader').html5_qrcode_stop() to stop scanning for QR codes, close the stream, and relinquish permissions granted by the user.
(This will result in the "camera on" light on their device turning off)

On Google Chrome, v45.0.2454.93 (64-bit), OSX

'MediaStream.stop()' is deprecated and will be removed in M47, around November 2015. Please use 'MediaStream.active' instead.

I created a pull request: #27. I'm aware of pull request #26 and explained why I created a second PR for the same issue.

$('#reader').html5_qrcode_stop(); doesn't work in chrome. It stops the video, screens turns black but the camera is still scanning.