From 05383701afb766adba01d08aa4a717bdae3dc57c Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Tue, 2 Mar 2021 10:01:05 +0800 Subject: [PATCH] Restore video loading circle ## Issue 5554: Video: loading circle sometimes does not appear until 2nd click ## What's happening videojs behavior: (a) A `src` change makes the Play button re-appear. (b) An `onPlay` (or `play()`) makes the button go away. Due to the `m3u8` header async fetch (i.e. return is potentially delayed), the initial `onPlay` (which cleared the button) that happened after user clicked Play gets negated by a potentially-delayed `src` change. # Changes - Manually hide the play button that is induced by the change in `src`. In the fetch-delay scenario mentioned above, the player continues to be in a 'playing' state anyway. - But don't hide the button if paused externally (e.g. browser-level) Restore video loading circle --- ui/component/viewers/videoViewer/internal/videojs.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/component/viewers/videoViewer/internal/videojs.jsx b/ui/component/viewers/videoViewer/internal/videojs.jsx index 796b241ec..2b2f42c5e 100644 --- a/ui/component/viewers/videoViewer/internal/videojs.jsx +++ b/ui/component/viewers/videoViewer/internal/videojs.jsx @@ -453,6 +453,11 @@ export default React.memo(function VideoJs(props: Props) { src: source, type: type, }); + + // PR #5570: Temp workaround to avoid double Play button until the next re-architecture. + if (!player.paused()) { + player.bigPlayButton.hide(); + } }); }, [source, reload]);