From 0a84982e2ea59d737f394bc79fa7f26a4bf29a80 Mon Sep 17 00:00:00 2001
From: Jenny Yu <jennyyu212@outlook.com>
Date: Thu, 28 Apr 2022 16:01:49 -0400
Subject: feat: uploading works

---
 .../views/nodes/RecordingBox/RecordingView.tsx     | 23 ++++++++--------------
 1 file changed, 8 insertions(+), 15 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 16f750e14..6aed07c60 100644
--- a/src/client/views/nodes/RecordingBox/RecordingView.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx
@@ -22,6 +22,7 @@ interface MediaSegment {
 
 interface IRecordingViewProps {
       setResult: (info: Upload.FileInformation) => void
+      setDuration: (seconds: number) => void
 }
 
 const MAXTIME = 1000;
@@ -47,12 +48,12 @@ export function RecordingView(props: IRecordingViewProps) {
 
 
       const DEFAULT_MEDIA_CONSTRAINTS = {
-            video: true,
+            // video: true,
             // audio: true
-            // video: {
-            //       width: 1280,
-            //       height: 720,
-            // },
+            video: {
+                  width: 1280,
+                  height: 720,
+            },
             // audio: true,
             // audio: {
             //       echoCancellation: true,
@@ -64,6 +65,7 @@ export function RecordingView(props: IRecordingViewProps) {
       useEffect(() => {
 
             if (finished) {
+                  props.setDuration(recordingTimer * 100)
                   let allVideoChunks: any = []
                   console.log(videos)
                   videos.forEach((vid) => {
@@ -72,16 +74,7 @@ export function RecordingView(props: IRecordingViewProps) {
                   })
 
                   console.log(allVideoChunks)
-
-                  const blob = new Blob(allVideoChunks, {
-                        type: 'video/webm'
-                  })
-                  const blobUrl = URL.createObjectURL(blob)
-                  const videoFile = new File(allVideoChunks, "video", { type: allVideoChunks[0].type, lastModified: Date.now() });
-
-                  videoElementRef.current!.srcObject = null
-                  videoElementRef.current!.src = blobUrl
-                  videoElementRef.current!.muted = false
+                  const videoFile = new File(allVideoChunks, "video.mkv", { type: allVideoChunks[0].type, lastModified: Date.now() });
 
                   // const uploadVideo = async () => {
                   //       const [{ result }] = await Networking.UploadFilesToServer(videoFile);
-- 
cgit v1.2.3-70-g09d2

