From 205f3c605aee6e7f15178e3cf27d5a298c9e6669 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 1 Nov 2022 02:00:35 +0100 Subject: [PATCH 1/2] feat(Player): add next video button --- src/routes/Player/ControlBar/ControlBar.js | 19 +++++++++++++++++++ src/routes/Player/Player.js | 1 + 2 files changed, 20 insertions(+) diff --git a/src/routes/Player/ControlBar/ControlBar.js b/src/routes/Player/ControlBar/ControlBar.js index b63c453f4..13c0b3bc1 100644 --- a/src/routes/Player/ControlBar/ControlBar.js +++ b/src/routes/Player/ControlBar/ControlBar.js @@ -21,6 +21,7 @@ const ControlBar = ({ subtitlesTracks, audioTracks, metaItem, + nextVideo, onPlayRequested, onPauseRequested, onMuteRequested, @@ -51,6 +52,15 @@ const ControlBar = ({ } } }, [paused, onPlayRequested, onPauseRequested]); + const onNextVideoButtonClick = React.useCallback(() => { + if (nextVideo !== null && typeof nextVideo.deepLinks === 'object') { + if (nextVideo.deepLinks.player !== null) { + window.location.href = nextVideo.deepLinks.player; + } else if (nextVideo.deepLinks.metaDetailsStreams !== null) { + window.location.href = nextVideo.deepLinks.metaDetailsStreams; + } + } + }, [nextVideo]); const onMuteButtonClick = React.useCallback(() => { if (muted) { if (typeof onUnmuteRequested === 'function') { @@ -96,6 +106,14 @@ const ControlBar = ({ + { + nextVideo !== null ? + + : + null + }