From 36e9e00930cac75c5890a2f8dc688874425def57 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Thu, 5 Oct 2023 16:40:15 +0200 Subject: [PATCH] docs: Add **Flash** documentation --- docs/docs/guides/RECORDING_VIDEOS.mdx | 13 +++++++++++++ docs/docs/guides/TAKING_PHOTOS.mdx | 12 ++++++++++++ package/src/VideoFile.ts | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/docs/guides/RECORDING_VIDEOS.mdx b/docs/docs/guides/RECORDING_VIDEOS.mdx index 853fdf5..b97a6ec 100644 --- a/docs/docs/guides/RECORDING_VIDEOS.mdx +++ b/docs/docs/guides/RECORDING_VIDEOS.mdx @@ -76,6 +76,19 @@ await camera.current.pauseRecording() await camera.current.resumeRecording() ``` +### Flash + +The [`startRecording(...)`](/docs/api/classes/Camera#startrecording) function can be configured to enable the [flash](/docs/api/interfaces/RecordVideoOptions#flash) while recording, which natively just enables the [`torch`](/docs/api/interfaces/CameraProps#torch) under the hood: + +```ts +camera.current.startRecording({ + flash: 'on', + ... +}) +``` + +Note that flash is only available on camera devices where [`hasTorch`](/docs/api/interfaces/CameraDevice#hastorch) is `true`; for example most front cameras don't have a torch. + ### Video Codec By default, videos are recorded in the H.264 video codec which is a widely adopted video codec. diff --git a/docs/docs/guides/TAKING_PHOTOS.mdx b/docs/docs/guides/TAKING_PHOTOS.mdx index c267c7a..d5d0462 100644 --- a/docs/docs/guides/TAKING_PHOTOS.mdx +++ b/docs/docs/guides/TAKING_PHOTOS.mdx @@ -54,6 +54,18 @@ You can customize capture options such as [automatic red-eye reduction](/docs/ap This function returns a [`PhotoFile`](/docs/api/interfaces/PhotoFile) which is stored in a temporary directory and can either be displayed using `` or ``, uploaded to a backend, or saved to the Camera Roll using [react-native-cameraroll](https://github.com/react-native-cameraroll/react-native-cameraroll). +### Flash + +The [`takePhoto(...)`](/docs/api/classes/Camera#takephoto) function can be configured to enable the [flash](/docs/api/interfaces/TakePhotoOptions#flash) automatically (when the scene is dark), always or never, which will only be used for this specific capture request: + +```ts +const photo = await camera.current.takePhoto({ + flash: 'on' // 'auto' | 'off' +}) +``` + +Note that flash is only available on camera devices where [`hasFlash`](/docs/api/interfaces/CameraDevice#hasflash) is `true`; for example most front cameras don't have a flash. + ### Fast Capture The [`takePhoto(...)`](/docs/api/classes/Camera#takephoto) function can be configured for faster capture at the cost of lower quality: diff --git a/package/src/VideoFile.ts b/package/src/VideoFile.ts index abffc18..b00e98d 100644 --- a/package/src/VideoFile.ts +++ b/package/src/VideoFile.ts @@ -5,7 +5,7 @@ export interface RecordVideoOptions { /** * Set the video flash mode. Natively, this just enables the torch while recording. */ - flash?: 'on' | 'off' | 'auto' + flash?: 'on' | 'off' /** * Specifies the output file type to record videos into. */