-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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 support for flash Light #129
Comments
Anything happening with the "flashlight" branch/feature? Would love to have that feature available, and I see there is a branch that was worked on for it in 2021. |
you could try to work on it and create a PR? |
it seems to be ready for version 3 |
giving this a push! |
This is already possible with Working on this right now for
|
### Version 2.2.5 #### Added support for turning `torch` On and Off in `Html5QrcodeScanner`. On supported devices + browsers. This new feature will implement the feature request - [Issue#129](#129) and add support for torch (also called flash) on supported devices and browsers. So far I have confirmed functionality on Samsung Flip 4 Chrome and Internet (Samsung's default browser). This is only supported on `Html5QrcodeScanner` and can be enabled using the config like this. ```ts let html5QrcodeScanner = new Html5QrcodeScanner( "reader", { fps: 10, qrbox: qrboxFunction, // Important notice: this is experimental feature, use it at your // own risk. See documentation in // mebjas@/html5-qrcode/src/experimental-features.ts experimentalFeatures: { useBarCodeDetectorIfSupported: true }, rememberLastUsedCamera: true, aspectRatio: 1.7777778, showTorchButtonIfSupported: true }); ``` The `showTorchButtonIfSupported: true` part is the crucial one. It's off by default for now as I don't like the UI very much. #### Added support for `getRunningTrackSettings()`. Added a new API to get settings (type: [MediaTrackSettings](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings)) for running video streams while QR code is being scanned. ```ts /** * Returns the supported settings of the running video track. * * @returns the supported settings of the running video track. * @throws error if the scanning is not in running state. */ public getRunningTrackSettings(): MediaTrackSettings {} ``` This API can be used to check the currently applied settings on the running video stream like weather torch is on or not. #### `getRunningTrackCapabilities(..)` and `applyVideoConstraints(..)` out of beta. Both `Html5Qrcode` and `Html5QrcodeScanner` classes had support for following APIs. ```ts /** * 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}. * * @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}. * * @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) : Promise<any> {} ``` These have now been taken out of beta and publicly documented. More blog articles to be published for these.
The support is now in PR: #570 Also, latest implementation has been deployed to https://scanapp.org (in case any one want to test and share more insights). So far I have tested and verified it to work on:
Pixel 6 Pro seems to have another layout issue that I need to fix urgently, so will do that first. Next steps:
|
* Add support for torch and make beta APIs non beta. ### Version 2.2.5 #### Added support for turning `torch` On and Off in `Html5QrcodeScanner`. On supported devices + browsers. This new feature will implement the feature request - [Issue#129](#129) and add support for torch (also called flash) on supported devices and browsers. So far I have confirmed functionality on Samsung Flip 4 Chrome and Internet (Samsung's default browser). This is only supported on `Html5QrcodeScanner` and can be enabled using the config like this. ```ts let html5QrcodeScanner = new Html5QrcodeScanner( "reader", { fps: 10, qrbox: qrboxFunction, // Important notice: this is experimental feature, use it at your // own risk. See documentation in // mebjas@/html5-qrcode/src/experimental-features.ts experimentalFeatures: { useBarCodeDetectorIfSupported: true }, rememberLastUsedCamera: true, aspectRatio: 1.7777778, showTorchButtonIfSupported: true }); ``` The `showTorchButtonIfSupported: true` part is the crucial one. It's off by default for now as I don't like the UI very much. #### Added support for `getRunningTrackSettings()`. Added a new API to get settings (type: [MediaTrackSettings](https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackSettings)) for running video streams while QR code is being scanned. ```ts /** * Returns the supported settings of the running video track. * * @returns the supported settings of the running video track. * @throws error if the scanning is not in running state. */ public getRunningTrackSettings(): MediaTrackSettings {} ``` This API can be used to check the currently applied settings on the running video stream like weather torch is on or not. #### `getRunningTrackCapabilities(..)` and `applyVideoConstraints(..)` out of beta. Both `Html5Qrcode` and `Html5QrcodeScanner` classes had support for following APIs. ```ts /** * 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}. * * @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}. * * @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) : Promise<any> {} ``` These have now been taken out of beta and publicly documented. More blog articles to be published for these. * Fix stateful error in torch UI If we start() --> enable torch --> stop() And then start() again, the UI was showing `Set torch off` and clicking wouldn't do anything. This is now fixed. * Code review fixed + codacy related fixes. * Update torch-button.ts replace console.error with error callback. * Update torch-button.ts
Feature now submitted and published with You can checkout the demo on Android devices (Chrome) on https://scanapp.org or https://qrcode.minhazav.dev. This is only supported for let html5QrcodeScanner = new Html5QrcodeScanner(
"reader",
{
fps: 10,
qrbox: qrboxFunction,
// Important notice: this is experimental feature, use it at your
// own risk. See documentation in
// mebjas@/html5-qrcode/src/experimental-features.ts
experimentalFeatures: {
useBarCodeDetectorIfSupported: true
},
rememberLastUsedCamera: true,
aspectRatio: 1.7777778,
showTorchButtonIfSupported: true
}); The I'll write a blog post on how to use it for |
How can I change the language of the buttons and others library information? |
@mebjas when can we expect NPM release of 2.2.6? |
It's released.
Please check the change logs.
…On Wed, Nov 2, 2022, 6:08 PM nexorianus ***@***.***> wrote:
@mebjas <https://github.com/mebjas> when can we expect NPM release?
—
Reply to this email directly, view it on GitHub
<#129 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAW6HBNUIRFQSMWFB5Y2EMLWGI4SHANCNFSM4SWN2UNA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
here on Github, yes.
|
Interesting, thanks for reporting this.
Will publish asap.
…On Wed, Nov 2, 2022, 7:57 PM nexorianus ***@***.***> wrote:
It's released. Please check the change logs.
here on Github, yes.
but NPM still has v2.2.5 as its latest version.
✗ yarn add ***@***.***
yarn add v1.22.19
[1/5] 🔍 Validating package.json...
[2/5] 🔍 Resolving packages...
Couldn't find any versions for "html5-qrcode" that matches "2.2.6"
? Please choose a version of "html5-qrcode" from this list: (Use arrow keys)
❯ 2.2.5
2.2.4
2.2.3
...
—
Reply to this email directly, view it on GitHub
<#129 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAW6HBMOJTVDDWSRZC7ZADTWGJJLZANCNFSM4SWN2UNA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hello, in many cases we need Flash Light to reading QrCode, it's possible?
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: