aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Foiani <sotech117@Michaels-MacBook-Pro-5.local>2022-06-10 12:40:44 -0400
committerMichael Foiani <sotech117@Michaels-MacBook-Pro-5.local>2022-06-10 12:40:44 -0400
commit0f70c97be61235f57272b8b074b0c2c7399c0d4d (patch)
treef258f1e9d98f77e75f93d912cd4cceb34a2d10f9 /src
parent23f6651153333a9979b37fe725c54080babe0133 (diff)
small cleanup - remove imports, more descriptive logs/comments, etc.
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/RecordingBox/RecordingView.tsx36
1 files changed, 9 insertions, 27 deletions
diff --git a/src/client/views/nodes/RecordingBox/RecordingView.tsx b/src/client/views/nodes/RecordingBox/RecordingView.tsx
index a8cc82ec0..138e72274 100644
--- a/src/client/views/nodes/RecordingBox/RecordingView.tsx
+++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx
@@ -1,15 +1,14 @@
import * as React from 'react';
import "./RecordingView.scss";
-import { ReactElement, useCallback, useEffect, useRef, useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { ProgressBar } from "./ProgressBar"
import { MdBackspace } from 'react-icons/md';
import { FaCheckCircle } from 'react-icons/fa';
import { IconContext } from "react-icons";
import { Networking } from '../../../Network';
import { Upload } from '../../../../server/SharedMediaTypes';
-import { emptyFunction, returnFalse, returnTrue, setupMoveUpEvents } from '../../../../Utils';
+import { returnFalse, returnTrue, setupMoveUpEvents } from '../../../../Utils';
import { RecordingApi } from '../../../util/RecordingApi';
-import { DashUploadUtils } from '../../../../server/DashUploadUtils';
export interface MediaSegment {
videoChunks: any[],
@@ -63,28 +62,17 @@ export function RecordingView(props: IRecordingViewProps) {
useEffect(() => {
if (finished) {
+ // this async function uses the server to create the concatted video and then sets the result to it's accessPaths
(async () => {
- const inputPaths: string[] = [];
- const videoFiles: File[] = []
- videos.forEach(async (vid, i) => {
- const videoFile = new File(vid.videoChunks, `segvideo${i}.mkv`, { type: vid.videoChunks[0].type, lastModified: Date.now() });
- videoFiles.push(videoFile);
-
- const { name } = videoFile;
- inputPaths.push(name)
- })
+ const videoFiles = videos.map((vid, i) => new File(vid.videoChunks, `segvideo${i}.mkv`, { type: vid.videoChunks[0].type, lastModified: Date.now() }));
// upload the segments to the server and get their server access paths
const serverPaths: string[] = (await Networking.UploadFilesToServer(videoFiles))
.map(res => (res.result instanceof Error) ? '' : res.result.accessPaths.agnostic.server)
// concat the segments together using post call
- const result: Upload.AccessPathInfo | Error = await Networking.PostToServer('/concatVideos', serverPaths)
- if (!(result instanceof Error)) {
- props.setResult(result, trackScreen)
- } else {
- alert("video conversion failed");
- }
+ const result: Upload.AccessPathInfo | Error = await Networking.PostToServer('/concatVideos', serverPaths);
+ !(result instanceof Error) ? props.setResult(result, trackScreen) : console.error("video conversion failed");
})();
}
}, [videos])
@@ -94,12 +82,8 @@ export function RecordingView(props: IRecordingViewProps) {
finished && setOrderVideos(true);
}, [finished])
- useEffect(() => {
- // check if the browser supports media devices on first load
- if (!navigator.mediaDevices) {
- console.warn('This browser does not support getUserMedia.')
- }
- }, [])
+ // check if the browser supports media devices on first load
+ useEffect(() => { if (!navigator.mediaDevices) alert('This browser does not support getUserMedia.'); }, [])
useEffect(() => {
let interval: any = null;
@@ -141,9 +125,7 @@ export function RecordingView(props: IRecordingViewProps) {
let videoChunks: any = []
videoRecorder.current.ondataavailable = (event: any) => {
- if (event.data.size > 0) {
- videoChunks.push(event.data)
- }
+ if (event.data.size > 0) videoChunks.push(event.data)
}
videoRecorder.current.onstart = (event: any) => {