From 606d693900a653fcc84dac64abeb7dda974101ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Thu, 16 Nov 2023 08:08:18 +0100 Subject: [PATCH] fix: Allow get seekRange on manifestparsed event in some cases (#5892) Fixes https://github.com/shaka-project/shaka-player/issues/5115 --- lib/player.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/player.js b/lib/player.js index cf237edbb..ab22ffefa 100644 --- a/lib/player.js +++ b/lib/player.js @@ -3317,17 +3317,22 @@ shaka.Player = class extends shaka.util.FakeEventTarget { /** * Get the range of time (in seconds) that seeking is allowed. If the player - * has not loaded content, this will return a range from 0 to 0. + * has not loaded content and the manifest is HLS, this will return a range + * from 0 to 0. * * @return {{start: number, end: number}} * @export */ seekRange() { - if (!this.fullyLoaded_) { - return {'start': 0, 'end': 0}; - } - if (this.manifest_) { + // With HLS lazy-loading, there were some situations where the manifest + // had partially loaded, enough to move onto further load stages, but no + // segments had been loaded, so the timeline is still unknown. + // See: https://github.com/shaka-project/shaka-player/pull/4590 + if (!this.fullyLoaded_ && + this.manifest_.type == shaka.media.ManifestParser.HLS) { + return {'start': 0, 'end': 0}; + } const timeline = this.manifest_.presentationTimeline; return {