aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-07-23 12:30:52 -0400
committerbob <bcz@cs.brown.edu>2019-07-23 12:30:52 -0400
commit97776a0f1725de5b512b803497af0801141c7f73 (patch)
tree0a51a4814653056aabe86a37490904d10ca717fd
parentd880e4b2fcb4e7bab3ee25d63209b173efcf37c0 (diff)
switched native video to ontimeupdate instead of a timer
-rw-r--r--src/client/views/nodes/VideoBox.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx
index 5624d41a9..30ad75000 100644
--- a/src/client/views/nodes/VideoBox.tsx
+++ b/src/client/views/nodes/VideoBox.tsx
@@ -59,7 +59,7 @@ export class VideoBox extends DocComponent<FieldViewProps, VideoDocument>(VideoD
this.Playing = true;
update && this.player && this.player.play();
update && this._youtubePlayer && this._youtubePlayer.playVideo();
- !this._playTimer && (this._playTimer = setInterval(this.updateTimecode, 5));
+ this._youtubePlayer && !this._playTimer && (this._playTimer = setInterval(this.updateTimecode, 5));
this.updateTimecode();
}
@@ -72,7 +72,7 @@ export class VideoBox extends DocComponent<FieldViewProps, VideoDocument>(VideoD
this.Playing = false;
update && this.player && this.player.pause();
update && this._youtubePlayer && this._youtubePlayer.pauseVideo();
- this._playTimer && clearInterval(this._playTimer);
+ this._youtubePlayer && this._playTimer && clearInterval(this._playTimer);
this._playTimer = undefined;
this.updateTimecode();
}
@@ -114,6 +114,7 @@ export class VideoBox extends DocComponent<FieldViewProps, VideoDocument>(VideoD
setVideoRef = (vref: HTMLVideoElement | null) => {
this._videoRef = vref;
if (vref) {
+ this._videoRef!.ontimeupdate = this.updateTimecode;
vref.onfullscreenchange = action((e) => this._fullScreen = vref.webkitDisplayingFullscreen);
if (this._reactionDisposer) this._reactionDisposer();
this._reactionDisposer = reaction(() => this.props.Document.curPage, () =>