From 847663145390f5fc0a9378c3a663ae0dbf7b506b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Tue, 9 Jan 2024 09:42:26 +0100 Subject: [PATCH] fix(HLS): Live recovery after disconnects (#6048) Fixes https://github.com/shaka-project/shaka-player/issues/6019 --- lib/hls/hls_parser.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 65782477b6..5413037e0d 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -3471,6 +3471,13 @@ shaka.hls.HlsParser = class { if (this.isLive_() && mediaSequenceToStartTime.has(position)) { firstStartTime = mediaSequenceToStartTime.get(position); } + // This is for recovering from disconnects. + if (firstStartTime === 0 && + this.presentationType_ == shaka.hls.HlsParser.PresentationType_.LIVE && + mediaSequenceToStartTime.size > 0 && + !mediaSequenceToStartTime.has(position)) { + firstStartTime = this.presentationTimeline_.getSegmentAvailabilityStart(); + } /** @type {!Array.} */ const references = [];