1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

kill camera stream when unmouting

This commit is contained in:
brunobar79 2018-07-30 18:40:00 -04:00
parent 34617a21c3
commit b673a7a7fc

View File

@ -33,6 +33,10 @@ export default class QrScanner extends Component {
}
}
componentWillUnmount () {
this.codeReader.reset()
}
initCamera () {
console.log('[QR-SCANNER]: initCamera')
this.codeReader = new BrowserQRCodeReader()
@ -50,7 +54,6 @@ export default class QrScanner extends Component {
this.codeReader.decodeFromInputVideoDevice(videoInputDevices[0].deviceId, 'video')
.then(content => {
console.log('[QR-SCANNER]: initCamera::decodeFromInputVideoDevice callback', content)
this.codeReader.reset()
const result = this.parseContent(content.text)
if (result.type !== 'unknown') {
this.props.qrCodeDetected(result)