diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 9c8eddaa24..28a288f150 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -2763,12 +2763,23 @@ shaka.hls.HlsParser = class { } } this.notifySegmentsForStreams_(streamInfos.map((s) => s.stream)); - const liveWithNoProgramaDateTime = + + 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 || - liveWithNoProgramaDateTime) { + liveWithNoProgramDateTime || vodWithOnlyAudioOrVideo) { this.syncStreamsWithSequenceNumber_( - streamInfos, liveWithNoProgramaDateTime); + streamInfos, liveWithNoProgramDateTime); } else { this.syncStreamsWithProgramDateTime_(streamInfos); if (this.config_.hls.ignoreManifestProgramDateTimeForTypes.length > 0) {