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:
parent
34617a21c3
commit
b673a7a7fc
@ -33,6 +33,10 @@ export default class QrScanner extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
this.codeReader.reset()
|
||||||
|
}
|
||||||
|
|
||||||
initCamera () {
|
initCamera () {
|
||||||
console.log('[QR-SCANNER]: initCamera')
|
console.log('[QR-SCANNER]: initCamera')
|
||||||
this.codeReader = new BrowserQRCodeReader()
|
this.codeReader = new BrowserQRCodeReader()
|
||||||
@ -50,7 +54,6 @@ export default class QrScanner extends Component {
|
|||||||
this.codeReader.decodeFromInputVideoDevice(videoInputDevices[0].deviceId, 'video')
|
this.codeReader.decodeFromInputVideoDevice(videoInputDevices[0].deviceId, 'video')
|
||||||
.then(content => {
|
.then(content => {
|
||||||
console.log('[QR-SCANNER]: initCamera::decodeFromInputVideoDevice callback', content)
|
console.log('[QR-SCANNER]: initCamera::decodeFromInputVideoDevice callback', content)
|
||||||
this.codeReader.reset()
|
|
||||||
const result = this.parseContent(content.text)
|
const result = this.parseContent(content.text)
|
||||||
if (result.type !== 'unknown') {
|
if (result.type !== 'unknown') {
|
||||||
this.props.qrCodeDetected(result)
|
this.props.qrCodeDetected(result)
|
||||||
|
Loading…
Reference in New Issue
Block a user