diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/camera.ts | 39 | ||||
| -rw-r--r-- | src/utils/index.ts | 1 |
2 files changed, 39 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); + }); +}; diff --git a/src/utils/index.ts b/src/utils/index.ts index 4ff9afac..dc00c049 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -5,3 +5,4 @@ export * from './users'; export * from './friends'; export * from './search'; export * from './messages'; +export * from './camera'; |
