Audio in html | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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

26th Aug 2018, 11:57 PM
Slavisa
Slavisa - avatar
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
27th Aug 2018, 1:38 AM
šŸŒ“Vincent BergeršŸŒ“
šŸŒ“Vincent BergeršŸŒ“ - avatar
+ 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.
27th Aug 2018, 1:38 AM
Ryan
Ryan - avatar