Jimmy Pelton
Jimmy Pelton

Reputation: 11

IE11 HTML5 Won't Play MP3 File

I have a simple sound clip that I would like to play. I am using the code:

var snd = new Audio("https://mobile-text-alerts.com/3.0/system/nexmo/messages/1404764969.mp3");
snd.play();

It works fine in Chrome, Firefox, Safari, but I cannot get it to work in Internet Explorer (11 in particular). I originally was trying to get a .wav to play, but I later came to find out IE11 doesn't support playing wav files. But now I have made it an mp3, and it still can't play it.

I tried messing with my .htaccess file by adding AddType audio/mpeg .mp3, I also tried AddType audio/mp3 .mp3 and anything else I could think of, but nothing seems to work. Any ideas?

Upvotes: 0

Views: 2532

Answers (1)

Alexander O'Mara
Alexander O'Mara

Reputation: 60527

The problem is that your file is not an MP3 file, but a WAV file with the MP3 file extension. Here is the output from the *nix file command to confirm this.

1404764969.mp3: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz

This is the reason you are getting the MEDIA_ERR_SRC_NOT_SUPPORTED error. You will need to properly transcode your file to MP3. Just changing the file extension will not work.

Upvotes: 3

Related Questions