aboutsummaryrefslogtreecommitdiff
path: root/src/utils/camera.ts
diff options
context:
space:
mode:
authorMichael <michael.foiani@gmail.com>2021-07-14 16:35:57 -0400
committerMichael <michael.foiani@gmail.com>2021-07-14 16:35:57 -0400
commit346d53a55a9d880dad706859350712bac2fedc5b (patch)
tree91d96bbb753da6f39f0e36ce1a1a84c25d578ff2 /src/utils/camera.ts
parent18eca660a7220e4bb67b7ddc267cfde7e8905c0d (diff)
parent4b6ada10d14e569c897fa289f57886e1daa2478d (diff)
Merged with newer master containing the cropper.
Diffstat (limited to 'src/utils/camera.ts')
-rw-r--r--src/utils/camera.ts37
1 files changed, 37 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);
+ });
+};