mirror of
https://github.com/dirtydishes/dreamio.git
synced 2026-06-06 21:38:15 +00:00
bypass range cache for mkv playback
This commit is contained in:
parent
adda8b7b02
commit
46a52b533f
5 changed files with 185 additions and 0 deletions
|
|
@ -272,6 +272,9 @@ 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) {
|
||||
|
|
@ -330,6 +333,11 @@ final class HTTPRangeRemoteFetcher {
|
|||
private func header(_ name: String, in response: HTTPURLResponse) -> String? {
|
||||
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue