我正在尝试向我的 html5 游戏添加声音,奇怪的是,在 Safari 中,我在 js 控制台中收到此错误:“表达式‘音频’[未定义] 的结果不是构造函数”。
我正在使用以下代码加载声音:
var sound = new Audio();
sound.src = "audio/click" + soundext;
sound.onLoad = ResourceLoad();
对于解决此问题的任何帮助,我将不胜感激!
最佳答案
我知道这个问题有点老了,但这是我搜索问题时出现的问题,所以为了其他搜索者的利益,这是我从 http://infobrink.com/safari-not-liking-the-html5-audio/ 中找到的答案。
After much frustration I came across a post which indicated that HTML5 audio and video tags will not work in Safari without QuickTime. So much for HTML5 not requiring any plug-ins. I installed QuickTime and to my dismay Safari was now giving me the following error when I tried to start it up.
原来我们的 QuickTime 没有正确安装!
关于javascript - 在 Safari (Windows) 中使用 html5/js 音频时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6572478/