From 613c8f7a1043360ba2ca28a57ca35044ac451027 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 3 Dec 2019 13:09:08 -0500 Subject: [PATCH] improve autoplay on chrome --- ui/component/viewers/videoViewer/view.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ui/component/viewers/videoViewer/view.jsx b/ui/component/viewers/videoViewer/view.jsx index 829f3ecc2..4dad230b2 100644 --- a/ui/component/viewers/videoViewer/view.jsx +++ b/ui/component/viewers/videoViewer/view.jsx @@ -21,7 +21,6 @@ const SEEK_BACKWARD_KEYCODE = ARROW_LEFT_KEYCODE; const SEEK_STEP = 10; // time to seek in seconds const VIDEO_JS_OPTIONS: { poster?: string } = { - autoplay: true, controls: true, preload: 'auto', playbackRates: [0.25, 0.5, 0.75, 1, 1.1, 1.25, 1.5, 2], @@ -112,9 +111,14 @@ function VideoViewer(props: Props) { if (!requireRedraw) { player = videojs(videoNode, videoJsOptions, function() { - const self = this; - self.volume(volume); - self.muted(muted); + player.volume(volume); + player.muted(muted); + player.ready(() => { + // In the future this should be replaced with something that checks if the + // video is actually playing after calling play() + // If it's not, fall back to the play button + player.play(); + }); }); }