Reputation: 36703
I use a code to play background music on my website..
<embed src="1.wav" autostart="true" loop="true"
width="2" height="0">
</embed>
But this code does not play infinite looped music.. Once the sound track gets over it does no repeat.. What should i do to repeat the music again and again..
Upvotes: 5
Views: 15843
Reputation: 20137
<audio hidden="true" autoplay loop controls>
<source src="source.mp3">
</audio>
it will works fine as you want...
Upvotes: 0
Reputation: 47
This is what I have found to work the best... Just replace the 'yoursounds' with the actual file name of your chosing.
<audio autoplay loop controls>
<source src="yoursound.ogg">
<source src="yoursound.mp3">
</audio>
Upvotes: 2
Reputation: 283
Try using the audio tag instead:
<audio autoplay loop>
<source src="sound.ogg">
<source src="sound.mp3">
</audio>
You need to use both mp3 and ogg files to be able to play your sound correctly in all browsers. Firefox for instance does not support mp3 files. Also using .wav is on websites is severely frowned upon due to its size.
Upvotes: 0
Reputation: 43067
Try jPlayer. It's an html5 media player that will fallback on flash. Here's an example from one of the demos:
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
m4a:"http://www.jplayer.org/audio/m4a/TSP-01-Cro_magnon_man.m4a",
oga:"http://www.jplayer.org/audio/ogg/TSP-01-Cro_magnon_man.ogg"
});
},
swfPath: "../js",
solution: "flash, html",
supplied: "m4a, oga",
wmode: "window"
});
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
http://jplayer.org/latest/demo-01-solution-flash-html/
Upvotes: 0
Reputation: 21086
The HTML5 solution is the Audio tag http://www.w3schools.com/tags/tag_audio.asp
This is the older solution: http://drayblog.gotdns.com/index.php/2009/05/13/html-embed-an-audio-clip-and-repeat-loop-it/
<EMBED SRC="/audio/media.mp3" AUTOSTART="true" HIDDEN="True" LOOP="True"/>
<NOEMBED>
<object type="audio/mp3" data="http://www.domain.com/audio/media.mp3"><param name="src" value="http://www.domain.com/audio/media.mp3"></param><param name="autostart" value="true"></param><param name="hidden" value="True"></param><param name="loop" value="true"></param>
</object>
</NOEMBED>
Upvotes: 0
Reputation: 2419
Instead of loop='true' try with loop='infinite' as below
<embed src="1.wav" autostart="true" loop="infinite"
width="2" height="0">
</embed>
Upvotes: 0