Technot
Technot

Reputation: 60

HTML audio tag issues

<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

Answers (3)

Greenreader9
Greenreader9

Reputation: 531

Here are a few things to check and fix.

  1. Ensure that your browser accepts .mp3, and if not, change the audio encoding (extension)

  2. There should be no spaces around the “=” sign in the src attribute.

  3. 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

Guy
Guy

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

jessica_1993
jessica_1993

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

Related Questions