From fe94b6b81bc3a6e1cafbdc3a9c004e6681ea8482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Tue, 24 Dec 2024 13:10:40 +0100 Subject: [PATCH] fix(HLS): Do not use EXT-X-PROGRAM-DATE-TIME on vod when there is only video or audio (#7802) Fixes https://github.com/shaka-project/shaka-player/issues/7774 --- lib/hls/hls_parser.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 726b3a6d23..9a4ba731fc 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -2792,10 +2792,21 @@ shaka.hls.HlsParser = class { } } this.notifySegmentsForStreams_(streamInfos.map((s) => s.stream)); + + const activeStreamInfos = Array.from(this.uriToStreamInfosMap_.values()) + .filter((s) => s.stream.segmentIndex); + const ContentType = shaka.util.ManifestParserUtils.ContentType; + const hasAudio = + activeStreamInfos.some((s) => s.stream.type == ContentType.AUDIO); + const hasVideo = + activeStreamInfos.some((s) => s.stream.type == ContentType.VIDEO); + const liveWithNoProgramDateTime = this.isLive_() && !this.usesProgramDateTime_; + const vodWithOnlyAudioOrVideo = !this.isLive_() && + this.usesProgramDateTime_ && !(hasAudio && hasVideo); if (this.config_.hls.ignoreManifestProgramDateTime || - liveWithNoProgramDateTime) { + liveWithNoProgramDateTime || vodWithOnlyAudioOrVideo) { this.syncStreamsWithSequenceNumber_( streamInfos, liveWithNoProgramDateTime); } else {