Content-type works on all files except Audio files

When obfuscating filename extensions everything works except audio files. Looking at the audio code it has checks that rely on the extension rather than just the content-type received (which can be defined in the content-type header for the folder the files are within). I think this is an easy fix to pull it inline with the rest of PlayCanvas but maybe there are other reasons for this.

Hi @Four-K,

That’s interesting, I wasn’t aware audio worked like that.

Could you raise an issue in the engine repo about it?

Hmm, you may want to check where it fails in the engine as the only place I can see is here:

And I think you could patch that function in your project if need be

Hi @Leonidas - yes, just done that (see below).
Hi @yaustar - yes that seems to be the place as it checks if the URL has a filename extension is amongst:
var supportedExtensions = [‘.ogg’, ‘.mp3’, ‘.wav’, ‘.mp4a’, ‘.m4a’, ‘.mp4’, ‘.aac’, ‘.opus’];

See issue here: Content-Type Header ignored for Audio files · Issue #5309 · playcanvas/engine · GitHub

1 Like

In which case, I would go with the suggestion I made earlier about making a small engine patch in the project to remove the check.