Jubaet Jeasun
Jubaet Jeasun

Reputation: 13

WAV audio format is not working on HTML5 page

I need to use a .wav format audio in my HTML code. I used the following code and test it on chrome.

<audio controls controlsList="nodownload"><source src="sample.wav" type="audio/wav"></audio>

But it's showing an empty audio file on my webpage over and over again and my chrome browser telling me to download that .wav file. How to solve that problem?

Upvotes: 0

Views: 1601

Answers (2)

pierpy
pierpy

Reputation: 1310

Your snippet works well, you can test it here (I made a copy and paste from your post) http://87.106.127.248/wav.html

Use only well known combinations of sample rate/bit depth, i.e. 44.100/16 bit with browsers

Upvotes: 1

Johannes
Johannes

Reputation: 67774

For streaming purposes on the web (like in an audio tag) you should create copies of your audio file in .mp3 and .ogg format and use these for your website.

Then a typical audio tag which could be handled by practically all modern browsers would look like this:

<audio>
  <source src="path/to/yourfile.ogg" type="audio/ogg">
  <source src="path/to/yourfile.mp3" type="audio/mpeg">
</audio> 

Upvotes: 0

Related Questions