diff options
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); + }); +}; |