aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/VideoBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-05-08 21:03:08 -0400
committerbobzel <zzzman@gmail.com>2024-05-08 21:03:08 -0400
commitb858bd3cad81da41e63b9f8e807e41421ca4aa34 (patch)
tree99355f0595194e136494d50c527c859209935191 /src/client/views/nodes/VideoBox.tsx
parentb8907e69160d97d919fcd83eb86d60e3634205ca (diff)
lots of api cleanup and cycle removal
Diffstat (limited to 'src/client/views/nodes/VideoBox.tsx')
-rw-r--r--src/client/views/nodes/VideoBox.tsx31
1 files changed, 9 insertions, 22 deletions
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx
index 3b1815f8a..fe7600fa3 100644
--- a/src/client/views/nodes/VideoBox.tsx
+++ b/src/client/views/nodes/VideoBox.tsx
@@ -17,7 +17,6 @@ import { Docs } from '../../documents/Documents';
import { DocumentType } from '../../documents/DocumentTypes';
import { DocUtils, FollowLinkScript } from '../../documents/DocUtils';
import { dropActionType } from '../../util/DropActionTypes';
-import { ReplayMovements } from '../../util/ReplayMovements';
import { undoBatch } from '../../util/UndoManager';
import { CollectionFreeFormView } from '../collections/collectionFreeForm/CollectionFreeFormView';
import { CollectionStackedTimeline, TrimScope } from '../collections/CollectionStackedTimeline';
@@ -32,7 +31,6 @@ import { StyleProp } from '../StyleProp';
import { DocumentView } from './DocumentView';
import { FieldView, FieldViewProps } from './FieldView';
import { FocusViewOptions } from './FocusViewOptions';
-import { RecordingBox } from './RecordingBox';
import './VideoBox.scss';
/**
@@ -101,18 +99,13 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
return field?.url.href ?? vfield?.url.href ?? '';
}
- // returns the presentation data if it exists, null otherwise
- @computed get presentation() {
- const data = this.dataDoc[this.fieldKey + '_presentation'];
- return data ? JSON.parse(StrCast(data)) : null;
- }
-
@computed private get timeline() {
return this._stackedTimeline;
}
private get transition() {
return this._clicking ? 'left 0.5s, width 0.5s, height 0.5s' : '';
} // css transition for hiding/showing timeline
+
public get player(): HTMLVideoElement | null {
return this._videoRef;
}
@@ -122,10 +115,6 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
this._props.setContentViewBox?.(this); // this tells the DocumentView that this VideoBox is the "content" of the document. this allows the DocumentView to indirectly call getAnchor() on the VideoBox when making a link.
this.player && this.setPlayheadTime(this.timeline?.clipStart || 0);
document.addEventListener('keydown', this.keyEvents, true);
-
- if (this.presentation) {
- ReplayMovements.Instance.setVideoBox(this);
- }
}
componentWillUnmount() {
@@ -134,12 +123,14 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
this.Pause();
Object.keys(this._disposers).forEach(d => this._disposers[d]?.());
document.removeEventListener('keydown', this.keyEvents, true);
-
- if (this.presentation) {
- ReplayMovements.Instance.removeVideoBox();
- }
}
+ override PlayerTime = () => this.player?.currentTime;
+ override Pause = (update: boolean = true) => {
+ this.pause(update);
+ !this._keepCurrentlyPlaying && this.removeCurrentlyPlaying();
+ };
+
// handles key events, when timeline scrubs fade controls
@action
keyEvents = (e: KeyboardEvent) => {
@@ -230,10 +221,6 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
}
this._playRegionTimer = undefined;
};
- @action Pause = (update: boolean = true) => {
- this.pause(update);
- !this._keepCurrentlyPlaying && this.removeCurrentlyPlaying();
- };
// toggles video full screen
@action public FullScreen = () => {
@@ -518,11 +505,11 @@ export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
icon: 'expand-arrows-alt',
});
// if the videobox was turned from a recording box
- if (this.dataDoc[this.fieldKey + '_recorded'] === true) {
+ if (this.dataDoc[this.fieldKey + '_recorded']) {
subitems.push({
description: 'Recreate recording',
event: () => {
- this.dataDoc.layout = RecordingBox.LayoutString(this.fieldKey);
+ this.dataDoc.layout = StrCast(this.dataDoc[this.fieldKey + '_recorded']); // restore the saed recording layout
// delete assoicated video data
this.dataDoc[this._props.fieldKey] = '';
this.dataDoc[this.fieldKey + '_duration'] = '';