diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 9554e29b64..80690a86a6 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -4127,9 +4127,14 @@ shaka.hls.HlsParser = class { 'Playlist should have segments!'); const middleSegmentIdx = Math.trunc((playlist.segments.length - 1) / 2); + const middleSegment = playlist.segments[middleSegmentIdx]; + if (shaka.hls.Utils.getFirstTagWithName(middleSegment.tags, 'EXT-X-GAP')) { + return this.guessMimeTypeFallback_(contentType); + } + const middleSegmentUris = shaka.hls.Utils.constructSegmentUris( getUris(), - playlist.segments[middleSegmentIdx].verbatimSegmentUri, + middleSegment.verbatimSegmentUri, variables); const parsedUri = new goog.Uri(middleSegmentUris[0]);