Use audio/flac as Content-Type for FLAC files
Steps to reproduce
- Use Firefox
- Open the Developer Tools/Web Console
- Try streaming a FLAC (.flac) file
- Note the URI (something like
$YOURINSTANCE/api/v1/listen/$ID/?jwt=$MOREID
) in the error message ending withError Code: NS_ERROR_DOM_MEDIA_METADATA_ERR (0x806e0006)
- Open the Developer Tools/Network Monitor
- Open the URI from step 3 directly
- Note the Content-Type of the answer's header (
application/octet-stream
)
What happens?
Well, once you've noted the Content-Type application/octet-stream
instead of audio/flac
you have a clue why the browser is asking you to download the file instead of playing it.
What is expected?
When using the Content-Type audio/flac
Firefox from v51.0 onward should directly play the file, just like mp3 files.
Context
- Platform: Linux, Kernel 4.18.12-1 x86_64
- Browser: Firefox v62.0.3 64-bit
- Instance configuration: v0.17.0/Docker/nginx
- Library type: in-place
-
"Full" error message from the Web Console (sorry, german language):
Medien-Ressource https://<$MYINSTANCE>/api/v1/listen/<$SOMEID>/?jwt=<$MOREID> konnte nicht dekodiert werden, Fehler: Error Code: NS_ERROR_DOM_MEDIA_METADATA_ERR (0x806e0006)
On a side note: If the Content-Type is set by one of the nginx processes, it seems the /etc/nginx/mime.types
is not having an entry for flac by default.