From b47ff4a335d15a259a6db436e8f2a1beb3180f6d Mon Sep 17 00:00:00 2001 From: Jenny Yu Date: Thu, 12 May 2022 01:13:34 -0400 Subject: feat: option to recreate recording --- .../views/nodes/RecordingBox/RecordingBox.tsx | 5 +- src/client/views/nodes/VideoBox.tsx | 1686 ++++++++++---------- 2 files changed, 853 insertions(+), 838 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/RecordingBox/RecordingBox.tsx b/src/client/views/nodes/RecordingBox/RecordingBox.tsx index a7524df37..807624394 100644 --- a/src/client/views/nodes/RecordingBox/RecordingBox.tsx +++ b/src/client/views/nodes/RecordingBox/RecordingBox.tsx @@ -24,6 +24,7 @@ export class RecordingBox extends ViewBoxBaseComponent() { } componentDidMount() { + console.log("set native width and height") Doc.SetNativeWidth(this.dataDoc, 1280); Doc.SetNativeHeight(this.dataDoc, 720); } @@ -45,11 +46,9 @@ export class RecordingBox extends ViewBoxBaseComponent() { // console.log(this.videoDuration) this.dataDoc[this.fieldKey + "-duration"] = this.videoDuration; - // this.layoutDoc.layout = VideoBox.LayoutString(this.fieldKey); this.dataDoc.layout = VideoBox.LayoutString(this.fieldKey); - // this.dataDoc.nativeWidth = this.dataDoc.nativeHeight = undefined; - // this.layoutDoc._fitWidth = undefined; this.dataDoc[this.props.fieldKey] = new VideoField(this.result.accessPaths.agnostic.client); + this.dataDoc[this.fieldKey + "-recorded"] = true; // stringify the presenation and store it this.dataDoc[this.fieldKey + "-presentation"] = JSON.stringify(RecordingApi.Instance.clear()); } diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index f449ae429..58e9f390c 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -7,7 +7,7 @@ import * as rp from 'request-promise'; import { Doc, DocListCast, HeightSym, WidthSym } from "../../../fields/Doc"; import { InkTool } from "../../../fields/InkField"; import { Cast, NumCast, StrCast } from "../../../fields/Types"; -import { AudioField, ImageField, VideoField } from "../../../fields/URLField"; +import { AudioField, ImageField, RecordingField, VideoField } from "../../../fields/URLField"; import { emptyFunction, formatTime, OmitKeys, returnFalse, returnOne, setupMoveUpEvents, Utils } from "../../../Utils"; import { Docs, DocUtils } from "../../documents/Documents"; import { DocumentType } from "../../documents/DocumentTypes"; @@ -29,6 +29,8 @@ import { StyleProp } from "../StyleProvider"; import { FieldView, FieldViewProps } from './FieldView'; import "./VideoBox.scss"; import { RecordingApi } from "../../util/RecordingApi"; +import { List } from "../../../fields/List"; +import { RecordingBox } from "./RecordingBox"; const path = require('path'); @@ -46,857 +48,871 @@ const path = require('path'); @observer export class VideoBox extends ViewBoxAnnotatableComponent() { - public static LayoutString(fieldKey: string) { return FieldView.LayoutString(VideoBox, fieldKey); } - /** - * Uploads an image buffer to the server and stores with specified filename. by default the image - * is stored at multiple resolutions each retrieved by using the filename appended with _o, _s, _m, _l (indicating original, small, medium, or large) - * @param imageUri the bytes of the image - * @param returnedFilename the base filename to store the image on the server - * @param nosuffix optionally suppress creating multiple resolution images - */ - public static async convertDataUri(imageUri: string, returnedFilename: string, nosuffix = false, replaceRootFilename?: string) { - try { - const posting = Utils.prepend("/uploadURI"); - const returnedUri = await rp.post(posting, { - body: { - uri: imageUri, - name: returnedFilename, - nosuffix, - replaceRootFilename - }, - json: true, - }); - return returnedUri; - - } catch (e) { - console.log("VideoBox :" + e); - } - } - - static _youtubeIframeCounter: number = 0; - static heightPercent = 80; // height of video relative to videoBox when timeline is open - private _disposers: { [name: string]: IReactionDisposer } = {}; - private _youtubePlayer: YT.Player | undefined = undefined; - private _videoRef: HTMLVideoElement | null = null; //