Reputation: 60
<html>
<audio controls>
<source src = "wrongbuzzer.mp3" type="audio/mpeg">
</audio>
</html>
I have the file "wrongbuzzer.mp3" on my device, but this just isn't working. [if you don't know what I mean, the play button is grayed out and I can't play the audio using the audio tag]
Someone, please help!
Upvotes: 0
Views: 3660
Reputation: 531
Here are a few things to check and fix.
Ensure that your browser accepts .mp3, and if not, change the audio encoding (extension)
There should be no spaces around the “=” sign in the src attribute.
Ensure that the audio file is saved in the same folder as the HTML file that is calling it (So the audio file should be in the same folder as the HTML file)
It would look something like this:
Note: You also forgot the body tag
<html>
<body>
<audio controls>
<source src="wrongbuzzer.mp3" type="audio/mpeg
</audio>
</body>
</html>
Let me know if this works!
Upvotes: 0
Reputation: 50
Is your wrongbuzzer.mp3 file saved in the same directory as your HTML file? If so, try running it on a different browser and if that still does not work, change the type to "audio/mp3".
Upvotes: 1
Reputation: 18
First, you need to delete the extra space between src and =
Is the audio file located in the root of your site / project where you also have this html file? If not you need to add the correct path inside the src="".
Upvotes: 0