在Safari中使用html5 / js音频的问题(Windows) [英] Problem using html5/js Audio with Safari (Windows)
问题描述
我正在尝试为我的html5游戏添加声音,奇怪的是在Safari中我在js控制台中收到此错误:表达式'音频'[未定义]的结果不是构造函数。
I'm trying to add sound to my html5 game, strangely in Safari i get this error in the js console: "Result of expression 'Audio' [undefined] is not a constructor".
我正在使用以下代码加载声音:
I'm using the following code to load the sounds:
var sound = new Audio();
sound.src = "audio/click" + soundext;
sound.onLoad = ResourceLoad();
感谢您解决此问题的任何帮助!
I would appreciate any help with solving this problem!
推荐答案
我知道这个问题有点陈旧,但是当我搜索问题时就出现了问题,所以为了其他搜索者的利益,我找到了答案, http://infobrink.com/safari-not-liking-the-html5- audio /
I know this question is a bit old, but it's what turned up when I searched for the problem, so for the benefit of other searchers, here's the answer I found, from http://infobrink.com/safari-not-liking-the-html5-audio/
经过多次挫折后,我发现了一条帖子,表明HTML5
音频和视频标签不会在没有QuickTime的Safari中工作。因此HTML5不需要任何插件就可以获得
。我安装QuickTime和
让我感到沮丧我现在尝试使用
来启动它时出现以下错误。
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未正确安装!
Turns our QuickTime was not correctly installed!
这篇关于在Safari中使用html5 / js音频的问题(Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!