gruhn / vue-qrcode-reader

A set of Vue.js components for detecting and decoding QR codes.
https://gruhn.github.io/vue-qrcode-reader
MIT License
2.03k stars 330 forks source link

refactor(camera.ts): task queue #387

Closed Sec-ant closed 8 months ago

Sec-ant commented 8 months ago

Implement a task queue to keep camera start and stop tasks in order and mitigate potential race conditions.

Users will notice some delay when they open and close the camera frequently (e.g. switching cameras quickly, turning on and off the torch quickly, etc.) because each start and stop action is saved in the task queue and dequeues in order, with no abortion.

Abortion can be added if this is a matter of concern.

netlify[bot] commented 8 months ago

Deploy Preview for vue-qrcode-reader ready!

Name Link
Latest commit 6d2744f66cbbb3d8a7af94b4c8591326716ba12d
Latest deploy log https://app.netlify.com/sites/vue-qrcode-reader/deploys/6524c8cf6c50e600086e3fce
Deploy Preview https://deploy-preview-387--vue-qrcode-reader.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Sec-ant commented 8 months ago

One thing I noticed on my phone is that the camera will stop and start twice when I switch the camera in the Torch demo.

It seems the first flash is because of switching and the second flash is because of detecting the torch capability. Should be fixed in the demo, though?

gruhn commented 8 months ago

Ok, those tests are a bit more effort than I expected, but I definitely managed to reproduce the issue you mentioned and also others I think. Let's just merge your approach. Good job :muscle:

Sec-ant commented 8 months ago

One thing I noticed on my phone is that the camera will stop and start twice when I switch the camera in the Torch demo.

Thanks 👻, but any idea on how to fix this 👆?

gruhn commented 8 months ago

ah no :P I you meant that this is also fixed by your PR. I'll try to look into it.

github-actions[bot] commented 8 months ago

:tada: This PR is included in version 5.3.9 :tada:

The release is available on:

Your semantic-release bot :package::rocket: