Jeanluca Scaljeri
Jeanluca Scaljeri

Reputation: 29097

FF can play mp3, but not using the javascript Audio API

I have this javascript audio player which plays mp3 files. On FF v23.0.1 (Mac) it doesn't work (the reason for this is explained everywhere and here) What I don't understand is, if I point the URL directly to the mp3 file FF shows its own player and the song plays just fine. But when using the javascript Audio API

var audio = new Audio('/my-song.mp3') ; // --> HTTP “Content-Type” van “audio/mpeg” not supported
audio.autoplay = true ;

it doesn't work. Can someone explain to me why this is ?

Thnx

Upvotes: 1

Views: 768

Answers (1)

nmaier
nmaier

Reputation: 33162

The error is (note that I've translated it to english): HTTP “Content-Type” of “audio/mpeg” is not supported.

Your Firefox build does not seem to support MP3 yet.

The player that is shown when directly browsing the .mp3 might be just some plugin handling the Content-Type, such as QuickTime, VLC, etc... That won't fly when using that file in an <audio> element, though.

See the "Media formats supported..." article for information on what codecs are supported by what version of Firefox on what platform.

Upvotes: 2

Related Questions