Reputation: 551
I would like to include an audio/possible video player on my website with the following attributes:
<div>
;I have been herded to SoundManager2 which appears to fit the bill, but I seem to be having real trouble just making a clickable image to begin playing my mp3. I have zero JS skills so am going from silly basic and building up slowly. I suppose I have two questions:
I can't create a Fiddle with what I have so far, but this is the very simple HTML - what is going wrong?:
<html>
<head>
<script src="script/soundmanager2.js"></script>
<script>
// Path to Flash Files
soundManager.url = 'swf/';
soundManager.onload(function(){
// SM2 is ready to Play Audio
// Create "mySound"
soundManager.createSound({
id:"mySound",
url:"audiofiles/my.mp3",
onfinish:function(){window.location.href='index.html}});
};
// Play File
//soundManager.play('mySound','my.mp3');});
</script>
</head>
<body>
<img src="image.jpg" alt="Previous" border="0" width="400" height="400" onclick="soundManager.play('mySound',{volume:100})";>
</body>
</html>
I had copied this code from another website, but I have a sneaking suspicion that the code was incomplete, so any help would be...err...helpful.
Upvotes: 2
Views: 1725
Reputation: 4588
I operate the website you say you took the code from. I updated it and it should work. Make sure you do both sections in the tutorial. The second section assumes that you are using the same file structure as the first. This should work completley fine now:
http://en.wikiaudio.org/SoundManager2:How_to_play_and_trigger_sound
Upvotes: 1