Why Audio Autoplay Attribute doesn't work? - html

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

Related

Audio source: net::ERR_CONTENT_DECODING_FAILED

I have an audio source like so:
<audio>
<source crossorigin="anonymous" src="https://c5.rbxcdn.com/978fe05256c23450b0c55c271ff9df58" type="audio/mpeg">
</audio>
But it never loads, and this is shown in the console:
GET https://c5.rbxcdn.com/978fe05256c23450b0c55c271ff9df58 net::ERR_CONTENT_DECODING_FAILED
Any idea? Doing a normal fetch() works fine with no cors errors or such.
It will work in video tag
<video controls="" autoplay="" name="media">
<source src="https://c5.rbxcdn.com/978fe05256c23450b0c55c271ff9df58" type="audio/mpeg">
</video>

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>

Can video tag be used in HTML 5 to run mp3 audio file?

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>