开发者

Problem using html5/js Audio with Safari (Windows)

开发者 https://www.devze.com 2023-03-16 23:45 出处:网络
I\'m trying to add sound to my html5 game, strangely in Safari i 开发者_C百科get this error in the js console: \"Result of expression \'Audio\' [undefined] is not a constructor\".

I'm trying to add sound to my html5 game, strangely in Safari i 开发者_C百科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!


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/

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.

Turns our QuickTime was not correctly installed!

0

精彩评论

暂无评论...
验证码 换一张
取 消