hey guys am having a trouble on making an audio to play itself once you open the file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

hey guys am having a trouble on making an audio to play itself once you open the file

its like when i send you an html file and when you open it the audio starts to play itself.

19th Jul 2021, 5:38 PM
Kelvin Anthony
Kelvin Anthony - avatar
5 Answers
+ 1
Try this: <audio controls autoplay> <source src="path/to/audio.mp3" type="audio/mpeg"> </audio> I believe what you're looking for is the autoplay tag. That'll cause it to play automatically.
19th Jul 2021, 7:11 PM
Jakko Jak
Jakko Jak - avatar
+ 3
Unfortunatelly it is blocked in browser why it cannot work.
19th Jul 2021, 5:43 PM
JaScript
JaScript - avatar
+ 1
jakko jak thanks for that
20th Jul 2021, 6:28 AM
Kelvin Anthony
Kelvin Anthony - avatar
+ 1
martin how many browsers does it support
20th Jul 2021, 6:30 AM
Kelvin Anthony
Kelvin Anthony - avatar
0
so how can i get it to work
19th Jul 2021, 5:45 PM
Kelvin Anthony
Kelvin Anthony - avatar