let mkv streams use the range cache

This commit is contained in:
dirtydishes 2026-05-26 08:10:39 -04:00
parent b16857a9fa
commit 4d0e675aa3
5 changed files with 266 additions and 16 deletions

View file

@ -272,10 +272,6 @@ final class HTTPRangeRemoteFetcher {
guard !url.path.lowercased().hasSuffix(".m3u8") else {
return HTTPRangeProbeResult(isCacheable: false, contentLength: nil, fallbackReason: "hls-playlist")
}
guard !Self.shouldBypassCache(for: url) else {
return HTTPRangeProbeResult(isCacheable: false, contentLength: nil, fallbackReason: "tail-index-container")
}
if let head = try? await response(for: request(method: "HEAD")),
(200..<400).contains(head.statusCode) {
let acceptsRanges = header("Accept-Ranges", in: head)?.lowercased().contains("bytes") == true
@ -334,10 +330,6 @@ final class HTTPRangeRemoteFetcher {
response.value(forHTTPHeaderField: name)
}
private static func shouldBypassCache(for url: URL) -> Bool {
let extensionName = url.pathExtension.lowercased()
return ["mkv", "mk3d", "mka", "mks", "webm"].contains(extensionName)
}
}
enum HTTPRangeCacheError: Error {