aboutsummaryrefslogtreecommitdiff
path: root/src/components/moments
diff options
context:
space:
mode:
authorMichael <michael.foiani@gmail.com>2021-07-14 17:48:55 -0400
committerMichael <michael.foiani@gmail.com>2021-07-14 17:48:55 -0400
commitf1873c074f3e9d8807b5e812f7ee37ba495a6c0a (patch)
tree277de3f67d98155de7b4f1e5537352fe38244c06 /src/components/moments
parent346d53a55a9d880dad706859350712bac2fedc5b (diff)
Incorportated the trimmer component on the zoom inn croppper page. Trimmer is hidden. Will incorporate trimmer soon.
Diffstat (limited to 'src/components/moments')
-rw-r--r--src/components/moments/trimmer.tsx22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/components/moments/trimmer.tsx b/src/components/moments/trimmer.tsx
index f011d222..2bd3eb41 100644
--- a/src/components/moments/trimmer.tsx
+++ b/src/components/moments/trimmer.tsx
@@ -1,13 +1,14 @@
import React, {useEffect, useState} from 'react';
import Video from 'react-native-video';
-import {Trimmer, ProcessingManager} from 'react-native-video-processing';
+import {Trimmer} from 'react-native-video-processing';
import {useRef} from 'react';
export const TrimmerPlayer: React.FC<{
source: string;
- styles: Object;
+ videoStyles: Object;
hideTrimmer: boolean;
-}> = ({source, styles, hideTrimmer}) => {
+ handleLoad: Function;
+}> = ({source, videoStyles, hideTrimmer, handleLoad}) => {
const playerRef = useRef<Video>();
const [seekTime, setSeekTime] = useState<number>(0);
@@ -35,16 +36,6 @@ export const TrimmerPlayer: React.FC<{
setTrackerTime(end - 0.1);
}, [end]);
- const trim = () => {
- ProcessingManager.trim(source, {
- startTime: start / 2, //need to divide by two for bug in module
- endTime: end,
- // saveToCameraRoll: true, // default is false // iOS only
- saveWithCurrentDate: true, // default is false // iOS only
- quality: 'highest',
- }).then((data: any) => console.log('trim', data));
- };
-
return (
<>
<Video
@@ -56,11 +47,12 @@ export const TrimmerPlayer: React.FC<{
volume={1.0} // 0 is muted, 1 is normal.
muted={false} // Mutes the audio entirely.
paused={paused} // Pauses playback entirely.
- //resizeMode="cover" // Fill the whole screen at aspect ratio.
+ resizeMode={'contain'}
repeat={true} // Repeat forever.
onLoad={(payload) => {
console.log(payload, source);
setEnd(payload.duration);
+ handleLoad(payload.naturalSize);
}}
onProgress={(e) => {
if (!paused) {
@@ -69,7 +61,7 @@ export const TrimmerPlayer: React.FC<{
}} // Callback every ~250ms with currentTime
//onEnd={() => console.log('end')} // Callback when playback finishes
//onError={this.videoError} // Callback when video cannot be loaded
- style={styles}
+ style={videoStyles}
onTouchEnd={() => {
setPaused((state) => !state);
}}