diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 17a62ca9caf..33cd272c33d 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -308,7 +308,13 @@ shaka.hls.HlsParser = class { const PresentationType = shaka.hls.HlsParser.PresentationType_; this.setPresentationType_(PresentationType.VOD); - const maxTimestamps = streamInfos.map((s) => s.maxTimestamp); + // Only check active stream: + // 1. Not loaded stream maxTimestamp initialized to 0 + // which the following setDuration does not allowed + // 2. Inactive stream maxTimestamp always smaller + // when the user changed the resolution, + // the maxTimestamp value fell out of sync. + const maxTimestamps = activeStreamInfos.map((s) => s.maxTimestamp); // The duration is the minimum of the end times of all streams. this.presentationTimeline_.setDuration(Math.min(...maxTimestamps)); this.playerInterface_.updateDuration();