Closed EnterTheStory closed 12 years ago
I believe this error is due to a Flash security issue when running files locally.
Does it still occur when running off http://localhost
or a full domain?
Thanks for the quick reply. I will find out in the morning and get back to you.
I believe this error is due to a Flash security issue when running files locally. Does it still occur when running off
http://localhost
or a full domain?
Reply to this email directly or view it on GitHub: https://github.com/kolber/audiojs/issues/51#issuecomment-2953286
EnterTheStory.com: classic books as games
Sorry, same problem online: It breaks in IE8, Firefox and Opera.
EDIT: the demo page "test6.html" has the same message. Chrome and IE9 work fine.
Firefox 8.01 error: a.element.setVolume is not a function
Opera gives more details: version 11.52 Opera/9.80 (Windows NT 5.1; U; Edition United States Local; en) Presto/2.9.168 Version/11.52
Uncaught exception: TypeError: 'a.element.setVolume' is not a function
Error thrown at line 13, column 900 in
NOTE: the URLs refer to my sandbox page that has changed since then. The last line is just a jQuery fake click on a playlist based on the test6.html demo.
I've tried wrapping various parts in try{ } catch(err){) But it doesn't help. If music plays in one browser it freezes other browsers. I can't find any way round this, other than to start my game with a big message "only works in Chrome or IE9" :(
Whoops! Now I know what the "close" button does. :)
I believe this is caused by a javascript library conflict, but I can't debug it as it looks like you've switched out the library. Everything seems to be working okay for you now, so I'm going to close this issue.
Fair enough. Thanks for looking into it.
hello,I got same problem. After several test, I find in demo/test6.html only work for HTML5 audio tag support. Browser with flash player like IE8 or Firefox 8, it can't use setVolume function. Please give me some suggestion to deal with this problem, thanks.
I'm afraid I'm not much help. I used SoundManager for a while (it seems to work well, but I feel bad promoting a competitor on the audiojs thread). But ultimately my game suffered from animation problems (nothing to do with sound). I completely redesigned the game, and as a side effect it no longer uses sound at all.
SoundManager, that's cool. Thanks for your information! Have a nice day.
There's a bug.
setVolume() is not exposed properly when flash is used instead of native audio tag.
sample code using jQuery to obtain targeted node:
var audio = audiojs.create($('audio').get(0)); audio.setVolume(0.5);
This works fine in Safari/Chrome, fails with reported above error in audioJS code in Firefox (all are most up to date versions) According to firebug, flash is embedded properly and I'm able to play the track, however there are other side effects from this error blocking the rest of debugging.
Minor update - this is impossible to test or reproduce on http://kolber.github.com/audiojs/ just because there's no sample with volume control.
The demo at "http://demo.svnlabs.com/html5player/volume-control/" implements a volume control that works even when the flash callback is in use. I copied the source files and ran on my localhost, but fired the same above mentioned error in browsers that use the flash callback.
IE8 says: Object doesn't support property or method 'setVolume' Firefox says: TypeError: audio.element.setVolume is not a function
I dont know if the problem is just because i'm running it in localhost, and at the moment i have no way to test on a real server.
My desire is to extend the script to allow a volume control even with multiple instances of the player, and currently, my additions are working when it's running with HTML5 and localhost, but I still need to test with Flash on a real server.
Hi guys, I broke my head with a similar issue. The simple code below refused to work in Flash mode:
var audioObj=audiojs.create(elem,{css:false});
audioObj.setVolume(0.75);
audioObj.play();
The error raised by Opera was Uncaught TypeError: undefined is not a function
.
It appears that one should wait that the SWF is fully loaded before using the flash API.
I fixed it with an ugly poll:
var audioObj=audiojs.create(elem,{css:false});
function audioStart() {
if (!('swfReady' in audioObj) || ('pplay' in audioObj.element)) {
audioObj.setVolume(0.75);
audioObj.play();
} else
setTimeout(audioStart,500);
}
audioStart();
But there's surely a smarter way to do it. I'm thinking about the embed load
event, although I don't know about the browser support.
I realize that there are too many browsers and versions and settings to guarantee than any code will ALWAYS work, but I am concerned that when IE8 hits this problem my whole page stops running. Is there any way to use a 'try...catch' or similar that IE8 can then continue? Sorry if this is a beginners type question.
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Timestamp: Wed, 30 Nov 2011 00:49:27 UTC
Message: Object doesn't support this property or method Line: 13 Char: 457 Code: 0 URI: file:///C:/game/game%20engine/music/audiojs/audio.min.js