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

Possible Features to Adjust Camera Expossure #399

Closed mich1342 closed 2 months ago

mich1342 commented 6 months ago

Hi,

Could we adjust the expossure of the camera? It would be great to scan QR Code shown in a display like OLED screen

gruhn commented 6 months ago

Looks like there the API offers something related to exposure:

https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#exposuremode

Haven‘t tested but I suspect browser support is bad (especially Safari). Anyway, adding a prop for this shouldn’t be too hard.

Sec-ant commented 6 months ago

Just add a comment here: There's a write-up on how to properly apply this constraint and check for its support: https://webrtchacks.com/bad-lighting-fix-with-javascript-webcam-exposure/#post-3807-_ttmtkt8og756

And here is a playground to tweak with the constraints: https://live.mdnplay.dev/en-US/docs/Web/API/Media_Capture_and_Streams_API/Constraints/_sample_.Example_Constraint_exerciser.html

I'm able to control the exposure time of the camera video in this playground with the following constraints object:

{
  "advanced": [
    {
      "exposureMode": "manual",
      "exposureTime": 200
    }
  ]
}
gruhn commented 6 months ago

Ok so this probably just boils down to adding two props here. Maybe exposure-mode and exposure-time. Adding the values to the cameraSettings object here. That should automatically trigger the watcher that requests a camera. The cameraSettings object is passed to this function which then calls runStartTask here. And in runStartTask we can somehow implement the logic mentioned in this article:

Just add a comment here: There's a write-up on how to properly apply this constraint and check for its support: https://webrtchacks.com/bad-lighting-fix-with-javascript-webcam-exposure/#post-3807-_ttmtkt8og756

github-actions[bot] commented 4 months ago

This issue has been marked as stale. If there is no further activity it will be closed.

Sec-ant commented 4 months ago

I can look into this after vacation (~2.18).

github-actions[bot] commented 2 months ago

This issue has been marked as stale. If there is no further activity it will be closed.