diff options
author | Ivan Chen <ivan@tagg.id> | 2021-08-06 19:23:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-06 19:23:05 -0400 |
commit | 60bb58a2661fd21be9bcb1fa41a6f8141ec61a49 (patch) | |
tree | 0d09b6782c103da9f72ec7cb41620ab308bb69e5 /src/utils/camera.ts | |
parent | a304be1adfdf9ae191549477ac4b66ee03dfa15e (diff) | |
parent | fbbeb7b7e602c9f5911298667f04c9e9302a562a (diff) |
Merge pull request #548 from brian-tagg/tma033-video-button
[TMA-1033] Video Button
Diffstat (limited to 'src/utils/camera.ts')
-rw-r--r-- | src/utils/camera.ts | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/utils/camera.ts b/src/utils/camera.ts index ec2615de..6edc2b4f 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -24,15 +24,20 @@ export const takePicture = ( callback: (pic: TakePictureResponse) => void, ) => { if (cameraRef !== null) { + cameraRef.current?.pausePreview(); const options: TakePictureOptions = { forceUpOrientation: true, orientation: 'portrait', writeExif: false, - pauseAfterCapture: true, }; - cameraRef.current?.takePictureAsync(options).then((pic) => { - callback(pic); - }); + cameraRef.current + ?.takePictureAsync(options) + .then((pic) => { + callback(pic); + }) + .catch((error) => { + console.log(error); + }); } }; @@ -46,9 +51,14 @@ export const takeVideo = ( maxDuration: MAX_VIDEO_RECORDING_DURATION, quality: '1080p', }; - cameraRef.current?.recordAsync(options).then((vid) => { - callback(vid); - }); + cameraRef.current + ?.recordAsync(options) + .then((vid) => { + callback(vid); + }) + .catch((error) => { + console.log(error); + }); } }; |