In HTML5 audio player play more than one audio - html5-audio

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>

Related

Why Audio Autoplay Attribute doesn't work?

<audio controls autoplay loop >
<source src="media/Will.Smith-ft-Ludacris-Party.Starter.mp3" type="audio/mpeg">
<source src="media/Will.Smith-ft-Ludacris-Party.Starter.aac" type="audio/aac">
<source src="media/Will.Smith-ft-Ludacris-Party.Starter.oga" type="audio/ogg">
Youre Browser Dose Not Support Audio Tag
</audio>
I'm trying with IE, Chrome, Firefox but doesn't work.
what is wrong?

how to remove black background of audio player in html

I embedded an audio on my web page with <embed> but there is a black background behind the player.
Why does this happen and how should I remove it? Or is there any other better way to embed the audio?
[<embed src="../audio/introduction.mp3" autostart="true" loop="true" bgcolor="" >]
This is how the audio player looks like:
https://i.stack.imgur.com/Ktr1P.png
If you are using HTML5 then <audio> tag is the best choice for you:
https://www.w3schools.com/tags/tag_audio.asp
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
We can use HTML5 Audio tag for this purpose instead of embed
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>

html5 audio tag not working in IE11 and Edge

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">

Automatically play audio in HTML 5

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>

Background music HTML - How do I make it play instantaneously when page is loaded?

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>