Reputation: 46318
I am using the jQuery Sound Plugin to create some sound effects on my site yet I cannot get it to play. I recieve this message:
settings.events.error(null, {msg: "You have not yet bound the sound player to
this element"});
What am I doing wrong? Here is my code:
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(".sound1").sound({swf: url});
$j(".sound1").load(url);
$j(".sound1").play();
$j(".sound1").pause();
$j(".sound1").stop();
$j(".sound1").volume(0-100);
$j('.sound1').mouseover(function() {
$j(".sound1").play('/messages4u/2011/images/october/sound1.mp3');
});
</script>
I am not sure if everything is needed in the code yet I am not that good at JS and need some help! Do I need to specify the URLs? If so to what?
Upvotes: 2
Views: 2027
Reputation: 10830
I don't know JS-with-FLASH APIs at all but as a very basic observation, if the page has an SWF component to load, it looks like this JS is firing before it has loaded. You will need to delegate the event or use a callback if there's one available.
Or even more basic: is there the flash component included on the page? That project seems abandoned (no official homepage when I went looking for the API); did they include it with the download you used?
Since the error message says "on this element", is it possible that the Flash component isn't listening for an element with the class "sound1"? Is there in fact an element with that class on the page?
I have to admit, I probably shouldn't have tried answering with so many unknowns. The plugin is rather old and unmaintained, so there's no demo page that I could find, and I'm loathe to install the whole thing. Do you have a live link?
Upvotes: 2