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

Add flashlight control #731

Open
xulihang opened this issue Nov 8, 2021 · 4 comments
Open

Add flashlight control #731

xulihang opened this issue Nov 8, 2021 · 4 comments

Comments

@xulihang
Copy link

xulihang commented Nov 8, 2021

Versions affected
Cordova version: 10.0.0
Cordova iOS version:
Plugin version (e.g 6.0.12): 8.0.0
iOS version (e.g 10.2): 14.4.2
Xcode version (e.g 11.1 - 11A1027): 12.2
WebRTC-adapter version (e.g. 7.4.0): latest
WebRTC Framework version (e.g. JSSip 3.1.2): ?

Description

Hi there,

I need to enable the flashlight (torch) while showing the camera preview in order to scan barcodes.

In Android, it is possible with the following code according to the media capture API:

const track = stream.getVideoTracks()[0];
track.applyConstraints({
        advanced: [{torch: true}]
      });

I wonder if it is possible to add such a flashlight control.

Thanks.

@hthetiot
Copy link
Contributor

hthetiot commented Nov 9, 2021

Hello,

This should be possible using example available here: https://stackoverflow.com/questions/27207278/how-to-turn-flashlight-on-and-off-in-swift/46313447

For now i don't have bandwidth to implement this feature, PR are welcome anyway.

@hthetiot
Copy link
Contributor

hthetiot commented Dec 2, 2021

There is already a cordova plugin for that:

Could be nice to make sure we play nice in term of compatibility.

@hthetiot hthetiot modified the milestones: 8.0.x, triage May 12, 2022
@streamsure
Copy link

Hey folks, I've been tracking this for a very long time outside of this repository and it looks like the torch boolean is coming to native WKWebView shortly I believe!

Will the WebKit team monkey patch iOS16 or even 15? Wishful thinking I expect but I live in hope that Apple will do what's morally right and expose a fuller constraints list to support older iPhones.

I've emailed Eric today and will drop any tentative release expectations here as and when I receive a response.
WebKit Torch Boolean Issue

@hthetiot
Copy link
Contributor

hthetiot commented Oct 4, 2023

Even if the Webview native implement it, does not mean iosrtc will have it. It will need to be exposed by iosrtc.

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

3 participants