From f8bfda0b0139db5f8bf1de602ce211a091d5d9ef Mon Sep 17 00:00:00 2001
From: Michael Foiani <sotech117@michaels-mbp-5.devices.brown.edu>
Date: Mon, 13 Jun 2022 14:56:03 -0400
Subject: revert to previous stable commit. lmao get ratioed by a mouse

---
 src/client/views/nodes/RecordingBox/RecordingView.tsx | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 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 d4d19f3d8..ba9479f41 100644
--- a/src/client/views/nodes/RecordingBox/RecordingView.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx
@@ -141,6 +141,7 @@ export function RecordingView(props: IRecordingViewProps) {
     }
 
     videoRecorder.current.onstop = () => {
+      // RecordingApi.Instance.stop();
       // if we have a last portion
       if (videoChunks.length > 1) {
         // append the current portion to the video pieces
@@ -149,10 +150,9 @@ export function RecordingView(props: IRecordingViewProps) {
           endTime: recordingTimerRef.current,
           startTime: videos?.lastElement()?.endTime || 0
         };
-
         // depending on if a presenation exists, add it to the video
-        const presentation = RecordingApi.Instance.yieldPresentation();
-        setVideos(videos => [...videos, (presentation != null && trackScreen) ? { ...nextVideo, presentation } : nextVideo]);
+        const { done: presError, value: presentation } = RecordingApi.Instance.yieldPresentation().next();
+        setVideos(videos => [...videos, (!presError && trackScreen) ? { ...nextVideo, presentation } : nextVideo]);
       }
 
       // reset the temporary chunks
@@ -175,8 +175,8 @@ export function RecordingView(props: IRecordingViewProps) {
     const stream = videoElementRef.current!.srcObject;
     stream instanceof MediaStream && stream.getTracks().forEach(track => track.stop());
 
-    // finish/clear the recoringApi
-    RecordingApi.Instance.finish();
+    // clear the recoringApi
+    RecordingApi.Instance.clear();
 
     // this will call upon progessbar to update videos to be in the correct order
     setFinished(true);
@@ -189,10 +189,12 @@ export function RecordingView(props: IRecordingViewProps) {
   }
 
   const start = (e: React.PointerEvent) => {
+    // the code to start or resume does not get triggered if we start dragging the button
     setupMoveUpEvents({}, e, returnTrue, returnFalse, e => {
-      // start recording if not already recording
-      if (!videoRecorder.current || videoRecorder.current.state === "inactive") record();
-
+      if (!videoRecorder.current || videoRecorder.current.state === "inactive") {
+        record();
+        // trackScreen &&
+      }
       return true; // cancels propagation to documentView to avoid selecting it.
     }, false, false);
   }
-- 
cgit v1.2.3-70-g09d2

