diff options
| author | Michael <michael.foiani@gmail.com> | 2021-07-14 16:35:57 -0400 |
|---|---|---|
| committer | Michael <michael.foiani@gmail.com> | 2021-07-14 16:35:57 -0400 |
| commit | 346d53a55a9d880dad706859350712bac2fedc5b (patch) | |
| tree | 91d96bbb753da6f39f0e36ce1a1a84c25d578ff2 /src/utils | |
| parent | 18eca660a7220e4bb67b7ddc267cfde7e8905c0d (diff) | |
| parent | 4b6ada10d14e569c897fa289f57886e1daa2478d (diff) | |
Merged with newer master containing the cropper.
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/camera.ts | 37 | ||||
| -rw-r--r-- | src/utils/index.ts | 1 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/utils/camera.ts b/src/utils/camera.ts index 4f933b0c..4a72f5f4 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -116,3 +116,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'; |
