diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/camera.ts | 34 | ||||
-rw-r--r-- | src/utils/users.ts | 1 |
2 files changed, 18 insertions, 17 deletions
diff --git a/src/utils/camera.ts b/src/utils/camera.ts index 9e37d62e..5485b1ca 100644 --- a/src/utils/camera.ts +++ b/src/utils/camera.ts @@ -9,7 +9,7 @@ import { TakePictureResponse, } from 'react-native-camera'; import {ProcessingManager} from 'react-native-video-processing'; -import ImagePicker, {ImageOrVideo, Video} from 'react-native-image-crop-picker'; +import ImagePicker, {ImageOrVideo} from 'react-native-image-crop-picker'; import {ERROR_UPLOAD} from '../constants/strings'; /* @@ -66,6 +66,7 @@ export const navigateToImagePicker = ( 'UserLibrary', ], mediaType: 'any', + compressVideoPreset: 'Passthrough', }) .then((media) => { callback(media); @@ -77,22 +78,6 @@ export const navigateToImagePicker = ( }); }; -export const navigateToVideoPicker = (callback: (vid: Video) => void) => { - ImagePicker.openPicker({ - mediaType: 'video', - }) - .then(async (vid) => { - if (vid.path) { - callback(vid); - } - }) - .catch((err) => { - if (err.code && err.code !== 'E_PICKER_CANCELLED') { - Alert.alert(ERROR_UPLOAD); - } - }); -}; - export const showGIFFailureAlert = (onSuccess: () => void) => Alert.alert( 'Warning', @@ -118,6 +103,21 @@ export const showGIFFailureAlert = (onSuccess: () => void) => }, ); +export const trimVideo = ( + sourceUri: string, + handleData: (data: any) => any, + ends: { + start: number; + end: number; + }, +) => { + ProcessingManager.trim(sourceUri, { + startTime: ends.start / 2, //needed divide by 2 for bug in module + endTime: ends.end, + quality: 'passthrough', + }).then((data: any) => handleData(data)); +}; + export const cropVideo = ( sourceUri: string, handleData: (data: any) => any, diff --git a/src/utils/users.ts b/src/utils/users.ts index c1c3b8bc..992d7721 100644 --- a/src/utils/users.ts +++ b/src/utils/users.ts @@ -280,6 +280,7 @@ export const patchProfile = async ( screenTitle = ''; requestTitle = ''; fileName = ''; + imageSettings = {}; } return await ImagePicker.openPicker(imageSettings) |