I have music I want to play and loop on the web page startup. Here's my code:
<audio autoplay="autoplay" loop controls="controls">
<source src="music.mp3" />
</audio>
The question that is a "duplicate" does not suit my needs and does not work for me.
I found out what to do using a div with the visibility to hidden
<div style="visibility:hidden">
<audio controls autoplay loop>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
Related
I am working with HTML5 audio. I have a question. Is it possible to play more than one audio on the same page, same time using HTML5 audio player ?
yes it's possible with multiple <audio> tags for example
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
</audio>
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
</audio>
I am trying to make a looping iframe with no controls which will loop.
<iframe
src="yeet.mp4" allow="autoplay" controls="false" loop="true" style="display:visible" id="iframeVideo">
But it has controls on and is not looping. How do i fix it?
Just remove the loop="true" and leave it as an attribute without value like so
<video loop src="yeet.mp4" autoplay>
Your browser does not support HTML5 Player
</video>
The best way to go about this is via Javascript
<video width="320" height="240" autoplay loop>
<source src="movie.mp4" type="video/mp4" />
<source src="movie.ogg" type="video/ogg" />
Your browser does not support the video tag.
</video>
loop ="true" is no longer supported, as is autoplay="autoplay"
I'm new to this forum and have looked at some previous answers, but can't find any that help.
I thought html5 audio was supposed to be simple?? i can't get it to work in either IE11 or Edge:
<audio controls autoplay>
<source src="music/Aranjuez.ogg" type="audio/mpeg">
<source src="music/Aranjuez.mp3" type="audio/ogg">
Your browser does not support the audio element
</audio>
What am I doing wrong?
You mixed up the file types:
<source src="music/Aranjuez.ogg" type="audio/mpeg">
<source src="music/Aranjuez.mp3" type="audio/ogg">
should be
<source src="music/Aranjuez.ogg" type="audio/ogg">
<source src="music/Aranjuez.mp3" type="audio/mp3">
So I've written this piece of music that I would like as background music when browsing my webpage. You should be able to pause it, but I'd like it to play up instantaneously to get some good vibes!
This is my code so far:
<audio controls>
<source src="music.mp3" type="audio/ogg">
</audio>
I get it to play, but as I said - I want it to start play automatically when you load the page!
Thanks in advance!
Add the attribute autoplay
<audio controls autoplay>
<source src="music.mp3" type="audio/ogg">
</audio>
EDIT And to loop it:
<audio controls autoplay loop>
<source src="music.mp3" type="audio/ogg">
</audio>
I am using audio tag to play mp3 file in HTML 5 , rather i want to use video tag for HTML 5.
Is that possible and how can i do that?
<audio class="audio" id="c_step_1_audio" controls preload="none" style="display: none">
<source src="test.mp3" type="audio/mpeg">
</audio>
I want to do as follows
<video class="audio" id="c_step_1_audio" controls preload="none" style="display: none">
<source src="test.mp3" type="audio/mpeg">
</video>
This is neither recommended nor approved in any browser or W3C. But try it, might work some where if you are lucky.
<video width="320" height="240" controls>
<source src="test.mp3" type="audio/mpeg">
Your browser does not support audio in video tag.
</video>