aboutsummaryrefslogtreecommitdiff
path: root/src/screens/upload
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-22 15:09:39 -0400
committerIvan Chen <ivan@tagg.id>2021-07-22 15:09:39 -0400
commitbc82aaf481949d690af814b9dd4a0e9cab387011 (patch)
treeee96bc0f53c8f87f0a9819b62987438e0ea70b74 /src/screens/upload
parentd518a5e7ae053ef55ca4ede254586f77be86e768 (diff)
Rename util function, Pass video duration to caption screen
Diffstat (limited to 'src/screens/upload')
-rw-r--r--src/screens/upload/EditMedia.tsx14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/screens/upload/EditMedia.tsx b/src/screens/upload/EditMedia.tsx
index 1dc408ee..38450337 100644
--- a/src/screens/upload/EditMedia.tsx
+++ b/src/screens/upload/EditMedia.tsx
@@ -43,6 +43,7 @@ export const EditMedia: React.FC<EditMediaProps> = ({route, navigation}) => {
const vidRef = useRef<View>(null);
const [cropLoading, setCropLoading] = useState<boolean>(false);
const [hideTrimmer, setHideTrimmer] = useState<boolean>(true);
+ const [videoDuration, setVideoDuration] = useState<number | undefined>();
// Stores the coordinates of the cropped image
const [x0, setX0] = useState<number>();
@@ -139,7 +140,7 @@ export const EditMedia: React.FC<EditMediaProps> = ({route, navigation}) => {
mediaUri,
(croppedURL: string) => {
setCropLoading(false);
- // Pass the trimmed/cropped video
+ // Pass the cropped video
callback(croppedURL);
},
videoCrop,
@@ -334,8 +335,12 @@ export const EditMedia: React.FC<EditMediaProps> = ({route, navigation}) => {
height: SCREEN_WIDTH / aspectRatio,
},
]}
- handleLoad={(response: {width: number; height: number}) => {
+ handleLoad={(
+ response: {width: number; height: number},
+ duration: number,
+ ) => {
const {width, height} = response;
+ setVideoDuration(duration);
setOrigDimensions([width, height]);
setAspectRatio(width / height);
}}
@@ -383,8 +388,9 @@ export const EditMedia: React.FC<EditMediaProps> = ({route, navigation}) => {
navigation.navigate('CaptionScreen', {
screenType,
media: {
- uri: uri,
- isVideo: isVideo,
+ uri,
+ isVideo,
+ videoDuration,
},
selectedCategory,
}),