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

question - Torch, not flash #139

Open
arturikoX opened this issue Nov 19, 2020 · 7 comments
Open

question - Torch, not flash #139

arturikoX opened this issue Nov 19, 2020 · 7 comments

Comments

@arturikoX
Copy link

Hi,
I managed to make it torch rather then flash on android,
Anyone knows how to make it work on ios ?

Thanks

@Bezlepkin
Copy link

Same question.

@nampil
Copy link

nampil commented Aug 17, 2023

@arturikoX Hi,
Wonder how you managed to make it torch rather then flash on android. Can you give me a hint on that please?

@Bezlepkin
Copy link

@nampil
I can build the plugin, I have it working and put it on npm

@Bezlepkin
Copy link

Or you can put it locally in the plugins folder. I'll send you the code you need to be replaced.

@nampil
Copy link

nampil commented Sep 26, 2023

Or you can put it locally in the plugins folder. I'll send you the code you need to be replaced.

Thanks, that will be great!

@Bezlepkin
Copy link

@nampil

you need to replace the toggleFlash method in index.android.ts with:

public toggleFlash(mode?: string) {
    if (this._camera) {
        if (this._camera.getFlashMode() === fancycamera.CameraFlashMode.OFF) {
	    if (mode === 'torch') {
	        this._camera.setFlashMode(fancycamera.CameraFlashMode.TORCH);
	    } else {
	        this._camera.setFlashMode(fancycamera.CameraFlashMode.ON);
	    }
	} else {
	    this._camera.setFlashMode(fancycamera.CameraFlashMode.OFF);
	}
    }
}

and when calling the method toggleFlash pass 'torch' prop

@nampil
Copy link

nampil commented Sep 26, 2023

@nampil

you need to replace the toggleFlash method in index.android.ts with:

public toggleFlash(mode?: string) {
    if (this._camera) {
        if (this._camera.getFlashMode() === fancycamera.CameraFlashMode.OFF) {
	    if (mode === 'torch') {
	        this._camera.setFlashMode(fancycamera.CameraFlashMode.TORCH);
	    } else {
	        this._camera.setFlashMode(fancycamera.CameraFlashMode.ON);
	    }
	} else {
	    this._camera.setFlashMode(fancycamera.CameraFlashMode.OFF);
	}
    }
}

and when calling the method toggleFlash pass 'torch' prop

Thanks @Bezlepkin

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

No branches or pull requests

3 participants