+ 2
Audio in html
In my audio html tag I add autoplay and it’s not working when i put controls only it works <audio autoplay=“autoplay”> <source src=“random.mp3” type=“audio/mpeg”> <source src=“random.ogg” type=“audio/ogg”> </audio> What’s wrong,not working in any browser
2 Respostas
+ 2
Hi Slavisa,
To get your issue fixed you need to get rid of autoplay="autoplay"
Therefore the autoplay attribute wil work when u just insert 'autoplay' without a value:
<audio id="your_id" controls autoplay \>
ADDITIONAL:
Since you did not implement JS to your audio tag which the controls attribute interact with, Here is a source that will help you to get this working with JS: https://www.w3schools.com/jsref/prop_audio_autoplay.asp
Only HTML for the audio tag will be very limited to use.
Hope this will fix your issue👍
https://code.sololearn.com/WcA28BVWTfq4/?ref=app
+ 1
I don't know if this will work but try including the "autoplay" attribute alone without this part '="autoplay"'.
If you can provide a link to your code I might be able to help you more.