From 68ae2d571fc59e681c83fd390328c470eadce9c6 Mon Sep 17 00:00:00 2001 From: DispatchCommit Date: Sat, 23 Jan 2021 12:28:31 -0800 Subject: [PATCH] only react to source prop updates --- ui/component/viewers/videoViewer/internal/videojs.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index 36cbe9ad6..27bf5add2 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -404,11 +404,13 @@ export default React.memo(function VideoJs(props: Props) { if (player) { player.dispose(); window.player = undefined; + + console.log(`Disposed of video.js instance (unmounted)`); } } }, []); - // Update video player settings and reload it when props change + // Update video player and reload when source URL changes useEffect(() => { // For some reason the video player is responsible for detecting content type this way fetch(source, { method: 'HEAD' }).then(response => { @@ -443,9 +445,9 @@ export default React.memo(function VideoJs(props: Props) { }); return () => { - console.log('Guess we could clean up something here if needed'); - }; - }); + console.log('Cleanup after source update.'); + } + }, [source]); return ( reload && (