diff options
author | Brian Kim <brian@tagg.id> | 2021-07-13 16:01:11 -0400 |
---|---|---|
committer | Brian Kim <brian@tagg.id> | 2021-07-13 16:01:11 -0400 |
commit | b7cba594635f4a6de3582ba4845bfc9757632ba1 (patch) | |
tree | 6336696356d8773bd505fe9c085cbb778f7e7b59 /src/utils/camera.ts | |
parent | f12996bfd3bcdd9ae0589e4fd4ca740705ad6d29 (diff) |
Extremely rough working
Diffstat (limited to 'src/utils/camera.ts')
-rw-r--r-- | src/utils/camera.ts | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/utils/camera.ts b/src/utils/camera.ts index ccdd42b0..2f189a1d 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -109,7 +109,7 @@ const options = { width: 1080, height: 1920, bitrateMultiplier: 3, - saveToCameraRoll: true, // default is false, iOS only + // saveToCameraRoll: true, // default is false, iOS only saveWithCurrentDate: true, // default is false, iOS only minimumBitrate: 300000, // removeAudio: true, // default is false @@ -140,3 +140,40 @@ export const showGIFFailureAlert = (onSuccess: () => void) => ), }, ); + +export const cropVideo = ( + sourceUri: string, + handleData: (data: any) => any, + videoCropValues?: { + cropWidth?: number; + cropHeight?: number; + cropOffsetX?: number; + cropOffsetY?: number; + }, +) => { + ProcessingManager.crop(sourceUri, { + cropWidth: videoCropValues + ? videoCropValues.cropWidth + ? Math.round(videoCropValues.cropWidth) + : 100 + : 100, + cropHeight: videoCropValues + ? videoCropValues.cropHeight + ? Math.round(videoCropValues.cropHeight) + : 100 + : 100, + cropOffsetX: videoCropValues + ? videoCropValues.cropOffsetX + ? Math.round(videoCropValues.cropOffsetX) + : 0 + : 0, + cropOffsetY: videoCropValues + ? videoCropValues.cropOffsetY + ? Math.round(videoCropValues.cropOffsetY) + : 0 + : 0, + quality: 'highest', + }).then((data: any) => { + handleData(data); + }); +}; |