From bc6aa7b8e7c9e43901f500d58acb0ebb6450b0a5 Mon Sep 17 00:00:00 2001
From: Michael <michael.foiani@gmail.com>
Date: Wed, 8 Jun 2022 15:38:40 -0400
Subject: got basic ordering to work for the videos that go to the server

---
 .../views/nodes/RecordingBox/RecordingView.tsx     | 25 ++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

(limited to 'src/client/views/nodes/RecordingBox/RecordingView.tsx')

diff --git a/src/client/views/nodes/RecordingBox/RecordingView.tsx b/src/client/views/nodes/RecordingBox/RecordingView.tsx
index aea7f56b5..a5c2dc85c 100644
--- a/src/client/views/nodes/RecordingBox/RecordingView.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx
@@ -34,7 +34,7 @@ export function RecordingView(props: IRecordingViewProps) {
       const [progress, setProgress] = useState(0);
 
     const [videos, setVideos] = useState<MediaSegment[]>([]);
-    // const [order, setOrder] = useState<number[]>([]);
+    const [orderVideos, setOrderVideos] = useState<boolean>(false);
       const videoRecorder = useRef<MediaRecorder | null>(null);
       const videoElementRef = useRef<HTMLVideoElement | null>(null);
 
@@ -57,13 +57,14 @@ export function RecordingView(props: IRecordingViewProps) {
 
     useEffect(() => {
           
-        console.log('in finish useEffect')
+        console.log('in videos useEffect')
 
           if (finished) {
               (async () => {
                 const inputPaths: string[] = [];
                 const videoFiles: File[] = []
-                  videos.forEach(async (vid, i) => {
+                videos.forEach(async (vid, i) => {
+                    console.log(vid)
                     const videoFile = new File(vid.videoChunks, `segvideo${i}.mkv`, { type: vid.videoChunks[0].type, lastModified: Date.now() });
                     videoFiles.push(videoFile);
                     
@@ -71,7 +72,7 @@ export function RecordingView(props: IRecordingViewProps) {
                     inputPaths.push(name)
                   })
                 
-                  console.log(videoFiles)
+                  console.log(inputPaths)
                   
                   const data = await Networking.UploadSegmentsAndConcatenate(videoFiles)
                   console.log('data', data)
@@ -158,6 +159,17 @@ export function RecordingView(props: IRecordingViewProps) {
             }
 
 
+    }, [videos])
+  
+  useEffect(() => {
+          
+        console.log('in finish useEffect')
+
+    if (finished) {
+      setOrderVideos(true);
+    }
+
+
       }, [finished])
 
       useEffect(() => {
@@ -360,8 +372,9 @@ export function RecordingView(props: IRecordingViewProps) {
                   </div>
                   
                                          <ProgressBar
-                videos={videos}
-                setVideos={setVideos}
+              videos={videos}
+              setVideos={setVideos}
+              orderVideos={orderVideos}
                               // playSegment={playSegment}
                               />
                   </div>
-- 
cgit v1.2.3-70-g09d2

