From f7c8c526af448b5113b2548418362dc429ba73d9 Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Fri, 30 Sep 2022 16:31:12 +0200 Subject: [PATCH] For VoD content limit the seek to the duration of the content (#4057) * For VoD content limit the seek to the duration of the content * Move logic for VoD seek limitation to MediaPlayer.js --- src/streaming/MediaPlayer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/streaming/MediaPlayer.js b/src/streaming/MediaPlayer.js index 414954402d..e8aca70a93 100644 --- a/src/streaming/MediaPlayer.js +++ b/src/streaming/MediaPlayer.js @@ -594,6 +594,13 @@ function MediaPlayer() { } let s = playbackController.getIsDynamic() ? getDVRSeekOffset(value) : value; + + // For VoD limit the seek to the duration of the content + const videoElement = getVideoElement(); + if (!playbackController.getIsDynamic() && videoElement.duration) { + s = Math.min(videoElement.duration, s); + } + playbackController.seek(s, false, false, true); } @@ -1996,7 +2003,7 @@ function MediaPlayer() { * @return {object} */ function getCurrentSteeringResponseData() { - if(contentSteeringController) { + if (contentSteeringController) { return contentSteeringController.getCurrentSteeringResponseData(); } }