Trouble getting web audio to work

I am trying to load some audio into Playcanvas from an mp3 file on Hygraph CMS. I have the URL for the file, so I have been trying a function like this:

ContentLoader.prototype.loadAudioFromURL = async function(slot) {"", 'audio', function (error, asset) {
        if (error) {
        } = asset.resource;

However, I get the following error:

Error loading audio url: hUKbpBVTvCfhWOXi3eRC: Audio format for hUKbpBVTvCfhWOXi3eRC not supported

Even though it is an mp3, I’m guessing that maybe because it doesn’t have ‘/mp3’ on the end it might be causing this issue?

So instead, I am trying to load it in using the Web Audio API, and I’m not getting errors with the following code, it’s just not actually playing so I don’t know if I’m missing something obvious here…

ContentLoader.prototype.loadAudio = async function() {
    this.context =; = this.context.createGain();
    const resp = await fetch("");
    const arrayBuffer = await resp.arrayBuffer();
    const audioBuffer = await this.context.decodeAudioData(arrayBuffer);
    const source = this.context.createBufferSource();

    source.loop = false;

    source.buffer = audioBuffer;

What am I doing wrong?

Our engine uses the extension of the filename to know if it’s supported or not

You would either need to add the extension of where you are hosting it or patch the engine to ignore

However, there is still an issue as the browser audio context can’t decode the response.

This could be related to it having no extension or how it’s being served by your server. Not sure yet.

Had a closer look at this and our HTTP loader in the engine guesses the response type based on the file extension.

Can’t think of a nice way to get around this without patch the engine more

I’ve made a patch to the engine that does this specific for URLs that come from here

Unfortunately, I don’t have a better idea in the short term besides adding the MP3 extension to the URL/file on the server