【发布时间】:2020-08-05 14:11:19
【问题描述】:
我在我的项目中使用 phaser@3.24.0,但在 Safari 13.1 上玩游戏时遇到问题。
在我的预加载方法中,我有带有声音数据的 loadConfig 对象:
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);
辅助函数:
function loadData(data, game) {
data.loadObjects.forEach((element) => {
game.load.audio(element.name, config.mediaURL + element.file);
}
}
在我的创建方法中:
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
add — phaser.min.js
create — culture.js
create — phaser.min.js
在其他浏览器上一切正常,我对此没有问题。
**: this.sound.add("ok")
这不起作用,我在游戏场景条目/数据中有我所有的文件路径等。但似乎没有在 create 方法中添加 - 仅在 safari 中。
【问题讨论】:
标签: javascript safari phaser-framework audiocontext