HTML audio is not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

HTML audio is not working

So for some reason the audio box isnโ€™t even appearing when I run it. I am trying to fix it but Iโ€™m not sure what to do. It should play Lofi goodnight beats but it will not. This is my code: <audio autoplay> <source src="good-night.mp3" type="audio/mpeg"></source>

2nd Jan 2024, 9:52 PM
Illiana Enow
Illiana Enow - avatar
2 Answers
+ 4
You need to upload your audio and make it available on the web. See this post: https://www.sololearn.com/Discuss/3224904/?ref=app
2nd Jan 2024, 10:36 PM
Keith
Keith - avatar
+ 2
Hello Well, 1st of all don't forget to close the audio tag Second, you must save the audio file in the same folder as your html file. How your browser is going to know where is good-night.mp3, if you've saved it somewhere else!? So move your file to the same folder (Or you can upload your audio on a public server, so you can use the URL to upload your audio to your webpage)
2nd Jan 2024, 10:38 PM
๐Ÿ‡ฎ๐Ÿ‡ฑ Radin Masiha ๐Ÿ‡ฎ๐Ÿ‡ฑ
๐Ÿ‡ฎ๐Ÿ‡ฑ Radin Masiha ๐Ÿ‡ฎ๐Ÿ‡ฑ - avatar