Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add zoom slider if supported by the device in Html5QrcodeScanner #330

Open
2 of 7 tasks
mebjas opened this issue Oct 21, 2021 · 10 comments
Open
2 of 7 tasks

Comments

@mebjas
Copy link
Owner

mebjas commented Oct 21, 2021

For Html5QrcodeScanner - add zoom slider if capability is supported.

  • Add zoom slider under a configuration.
  • Add pinch to zoom
  • Expose video constraints API
  • Document

For Html5Qrcode

  • Add support for Zoom APIs
  • Document
  • Write article describing how to zoom with Html5Qrcode
@mebjas
Copy link
Owner Author

mebjas commented Oct 21, 2021

UX Help wanted

@mebjas
Copy link
Owner Author

mebjas commented Oct 21, 2021

A better fix for this would be:

If zoom is supported

  • A ML model that detects different kind of supported codes in the image (detects not decode).
  • The same ML model either returns landmarks or another model helps with landmarking
  • Multiple solutions from here
    • (Assuming center zoom) If it's zoomable the camera is zoomed to the landmarks
    • If it's not in center regions --> Guide user to move the camera or object
    • Internally zoom in to the canvas and decode and show result

But this would need longer term effort!

@ROBERT-MCDOWELL
Copy link

@mebjas
I found a nice project that control tilt, zoom, pan etc...
https://web.dev/camera-pan-tilt-zoom/

@mebjas
Copy link
Owner Author

mebjas commented Oct 23, 2021

#331 will help expose the following two capabilities to Html5QrcodeScanner

/**
 * Returns the capabilities of the running video track.
 * 
 * Note: Should only be called if {@code Html5QrcodeScanner#getState()}
 *   returns {@code Html5QrcodeScannerState#SCANNING} or 
 *   {@code Html5QrcodeScannerState#PAUSED}.
 *
 * @beta This is an experimental API
 * @returns the capabilities of a running video track.
 * @throws error if the scanning is not in running state.
 */
public getRunningTrackCapabilities(): MediaTrackCapabilities;

/**
 * Apply a video constraints on running video track from camera.
 *
 * Note: Should only be called if {@code Html5QrcodeScanner#getState()}
 *   returns {@code Html5QrcodeScannerState#SCANNING} or 
 *   {@code Html5QrcodeScannerState#PAUSED}.
 *
 * @beta This is an experimental API
 * @param {MediaTrackConstraints} specifies a variety of video or camera
 *  controls as defined in
 *  https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints
 * @returns a Promise which succeeds if the passed constraints are applied,
 *  fails otherwise.
 * @throws error if the scanning is not in running state.
 */
public applyVideoConstraints(videoConstaints: MediaTrackConstraints)   

Which shall enable the users to build zoom features with a zoom slider UI. It would take me some time to identify a good UI to crunch in zoom slider within current UI. It will probably need some UI rewamp as well.

@mebjas
Copy link
Owner Author

mebjas commented Oct 23, 2021

@ROBERT-MCDOWELL

I found a nice project that control tilt, zoom, pan etc...
https://web.dev/camera-pan-tilt-zoom/

I saw this before, bunch of it is useful but not very well supported across browsers. Particularly pan and tilt is for camera hardware that support pan and tilt like ones used in video conferencing.

@ROBERT-MCDOWELL
Copy link

@mebjas
maybe the zoom part code can inspire us?

@nikowuesti
Copy link

If you plan to integrate the pan/zoom functionality, these would be best controlled with finger gestures drag/pinch-zoom on a phone or click-drag/mouswheel-zoom on desktop without the need of an UI. If the developer really wants it, a slider could be exposed, but I think it should be hidden by default. No need to litter the UI :)

@fxcosta
Copy link

fxcosta commented Aug 5, 2022

about zoom control, i tested this and works perfectly: #308 (comment)

@mebjas mebjas mentioned this issue Nov 21, 2022
2 tasks
@mebjas
Copy link
Owner Author

mebjas commented Nov 21, 2022

Feature support coming for Html5QrcodeScanner in version 2.3.2.

Slider implemented, looking into pinch to zoom next.

@mebjas
Copy link
Owner Author

mebjas commented Nov 22, 2022

Zoom feature published:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants