Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox won't play .WAV files using the HTML5 <audio> tag?

I'm building a page that will allow a user to upload an MP3 file. That MP3 file is converted in the back end to a .WAV file using LAME.

The lame execution script is here:

LAME --resample 44.1 -decode myDirectoryPath/Master.mp3 myDirectoryPath/Master.wav

However, when I use the HTML5 audio tag to create a player for that audio file in Firefox, it doesn't work.

<!DOCTYPE HTML>
<html>

<head>
    <meta charset="UTF-8">
    <title>Test</title>
</head>

<body>
    <audio controls>
        <source src="myDirectoryPath/Master.mp3">
        <source src="myDirectoryPath/Master.wav">
    </audio>
</body>
</html>

Everything I've read says that Firefox supports .wav files... and I can't find a simple .mp3 to .ogg command line tool to use that will convert the master.mp3 to .ogg format. Can someone offer some suggestions on what to try next?

I've posted code that works in Safari and Chrome here: http://www.wgbh.org/byers/Audio/index.html

For whatever reason, FF doesn't like it.

UPDATE (With accompanying facepalm) The issue lies with my LAME decode. The correct syntax is --decode with two dashes instead of one. The system was actually encoding it from mp3 to mp3, naming it wav and Safari / Chrome on the Mac was assuming the file type.

like image 857
David Byers Avatar asked May 01 '12 20:05

David Byers


People also ask

Can Firefox play WAV files?

Hope this helps. The only browser that does not support WAV is Internet Explorer. All other browsers (including Firefox) do.

Does HTML audio support WAV?

The browser will choose the first source it supports. The text between the <audio> and </audio> tags will only be displayed in browsers that do not support the <audio> element. There are three supported audio formats in HTML: MP3, WAV, and OGG.

Which audio format is not supported by HTML5 audio?

aLaw audio format is not supported by HTML5 audio tag.

Is WAV audio will only play in the Internet Explorer Web browser?

Explanation: Opera, firefox, chrome and internet explorer are different kinds of browsers. Out of which audio file format named wav is not supported by internet explorer.


2 Answers

What's the bit depth on your WAV files? Firefox supports 8-bit and 16-bit PCM, but not other bit depths (12, 20, 24, 32).

like image 183
Boris Zbarsky Avatar answered Sep 18 '22 16:09

Boris Zbarsky


Firefox expects one of the following codecs to be returned as the MIME type:

  • audio/wave (preferred)
  • audio/wav
  • audio/x-wav
  • audio/x-pn-wav

Make sure your server returns one of those MIME types for wav files.

like image 34
Brian Hadaway Avatar answered Sep 20 '22 16:09

Brian Hadaway