Open arturikoX opened 3 years ago
Same question.
@arturikoX Hi, Wonder how you managed to make it torch rather then flash on android. Can you give me a hint on that please?
@nampil I can build the plugin, I have it working and put it on npm
Or you can put it locally in the plugins folder. I'll send you the code you need to be replaced.
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!
@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
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
Hi, I managed to make it torch rather then flash on android, Anyone knows how to make it work on ios ?
Thanks