Created
October 30, 2022 14:19
-
-
Save mebjas/7ee69608817ce836b71993220eba35a9 to your computer and use it in GitHub Desktop.
Snippet to enable torch on running video track in Html5Qrcode library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let constraints: MediaTrackConstraints = { | |
"torch": true, | |
"advanced": [{ "torch": true }] | |
}; | |
await html5Qrcode.applyVideoConstraints(constraints); | |
let settings = html5Qrcode.getRunningTrackSettings(); | |
if (settings.torch === true) { | |
// Torch was indeed enabled, succeess. | |
} else { | |
// Failure. | |
// Failed to set torch, why? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment