From d8564cda5ac2da757e806e8eb4cfad870c95e7e6 Mon Sep 17 00:00:00 2001 From: DispatchCommit Date: Sat, 23 Jan 2021 12:35:43 -0800 Subject: [PATCH] hack-y solution to losing player context use a global window variable to store the reference to the current video.js instance. --- ui/component/viewers/videoViewer/internal/videojs.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index 27bf5add2..e83e417f4 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -170,7 +170,7 @@ export default React.memo(function VideoJs(props: Props) { type: sourceType, }, ], - autoplay: false, + autoplay: true, poster: poster, // thumb looks bad in app, and if autoplay, flashing poster is annoying plugins: { eventTracking: true, @@ -414,6 +414,8 @@ export default React.memo(function VideoJs(props: Props) { useEffect(() => { // For some reason the video player is responsible for detecting content type this way fetch(source, { method: 'HEAD' }).then(response => { + const player = window.player; + if (!player) { console.log(`Our player was disposed, we should disregard the fetch result.`); return;