Sound entries missing on Safari

Hello,
I’m using in my project phaser@3.24.0 and I have a problem with games on Safari 13.1.

In my preload method I have my loadConfig object with sound data:

  var data = {
  mediaURL: "../../../static/sound/",
  dataObjects: [
    { type: "sound", name: "ok", file: "ok.ogg" },
    { type: "sound", name: "wrong", file: "wrong.ogg" },
    { type: "sound", name: "missing", file: "missing.png" },
  ],
};

loadData(data, this);

Helper function:

    function loadData(data, game) {
        data.loadObjects.forEach((element) => {
        game.load.audio(element.name, config.mediaURL + element.file);
       }
    }

In my create method:

this.sound.add("ok")

When I load the scene I get:
Error: There is no audio asset with key “ok” in the audio cache
initialize — phaser.min.js:1:412657
add — phaser.min.js:1:409872
create — culture.js:53
create — phaser.min.js:1:391150

On other browsers everything works fine, I don’t have problems with this.

**:

this.sound.add("ok")

Is not working, I have all my paths to the file etc in the gamescene entries/data. But it seems no to be added in a create method - only in safari. And it fails in initialize() function.

Phaser doesn’t load OGG files for Safari (it can’t play them). You can add MP3 alternatives.

2 Likes

Thanks! This is the answer :slight_smile: