dwa012 / html5-qrcode

A cross platform HTML5 QR code reader.
744 stars 305 forks source link

How do you stop the video from scanning? #23

Open ice423cube opened 8 years ago

ice423cube commented 8 years ago

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!

derrend commented 8 years ago

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)

acdesouza commented 8 years ago

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.

jensbroecher commented 6 years ago

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