mirror of
https://github.com/myronblair/kino-app
synced 2026-07-28 13:33:49 -05:00
Fix wrong Content-Type for m4a/flac/ogg/wav/aac track streams
mimetypes on the backend image doesn't recognize these extensions, so every non-mp3 track streamed as audio/mpeg — wrong codec hint, breaks playback in strict browsers. Add an explicit fallback map.
This commit is contained in:
+2
-1
@@ -1534,7 +1534,8 @@ async def stream_track(
|
||||
if not file_path.is_file(): raise HTTPException(status_code=404, detail="File missing on disk")
|
||||
|
||||
file_size = file_path.stat().st_size
|
||||
content_type = mimetypes.guess_type(str(file_path))[0] or "audio/mpeg"
|
||||
_audio_mime_fallback = {".m4a": "audio/mp4", ".flac": "audio/flac", ".ogg": "audio/ogg", ".wav": "audio/wav", ".aac": "audio/aac"}
|
||||
content_type = mimetypes.guess_type(str(file_path))[0] or _audio_mime_fallback.get(file_path.suffix.lower(), "audio/mpeg")
|
||||
range_header = request.headers.get("range") or request.headers.get("Range")
|
||||
if range_header and range_header.startswith("bytes="):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user