Skip to content

Instantly share code, notes, and snippets.

@mebjas
Created October 30, 2022 14:19
Show Gist options
  • Save mebjas/7ee69608817ce836b71993220eba35a9 to your computer and use it in GitHub Desktop.
Save mebjas/7ee69608817ce836b71993220eba35a9 to your computer and use it in GitHub Desktop.
Snippet to enable torch on running video track in Html5Qrcode library
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