package com.doublesymmetry.trackplayer /** * Whether [uri] points at an HLS playlist, decided purely from its file * extension (`.m3u8` / `.m3u`) after stripping any query string or fragment. * * Used by the preloader to choose between warming the media SEGMENTS via * `HlsDownloader` (which parses the playlist and writes every segment, key and * init map into the cache) and the shallow manifest-only `CacheWriter`. * * Detection is extension-only, matching the iOS proxy's path-extension check — * so an extensionless or redirecting manifest URL falls back to the * manifest-only path. (Unlike the iOS proxy, this offline path does not also * sniff the response body for `#EXTM3U`.) */ internal fun isHlsUri(uri: String): Boolean { val path = uri.substringBefore('#').substringBefore('?') val lower = path.lowercase() return lower.endsWith(".m3u8") || lower.endsWith(".m3u") }