Reputation: 6217
In using the Zxing library, the goal is to allow the page to fully load, then send a click event to the library so that the camera stream starts auto-magiacally.
The implementation is identical to this codePen, with an <a class="button" id="startButton">Start</a>
tag that then launches the script snippet.
document.getElementById('startButton').addEventListener('click', () => {
codeReader.decodeFromVideoDevice(selectedDeviceId, 'video', (result, err) => {
Haw can on write a brief script that executes once the page is fully loaded?
Upvotes: 0
Views: 29