6

I have following code base

 Audiosource.onloadeddata = function () {
            $("#txtAudioDuration").val(Math.round(Audiosource.duration));
          };

When I use .mp3,.mp4,.ogg,.wav audio duration is populated correctly, but when I use mpg or mpeg audio file, the duration is not being loaded.

I have tried with converted mpg and mpeg audio file, I don't have original mpg or mpeg audio files. Is there any link to download these files.

Any suggestion would be highly appreciated.

Thanks

Md. Parvez Alam
  • 4,326
  • 5
  • 48
  • 108

2 Answers2

5

First thought was you need to set server content-type headers audio/mpeg instead of video/mpeg. I tried to configure my nginx properly, but audio tag still doesn't work.

You can't do that, browsers don't support mpeg type.

Firefox supports Ogg Vorbis and WAV

Opera supports Ogg Vorbis and WAV

Safari supports MP3, AAC, and MP4

Chrome supports Ogg Vorbis, MP3, WAV, AAC, and MP4

Internet Explorer 9+ supports MP3, AAC, and MP4

iOS supports MP3, AAC, and MP4

Android supports AAC and MP3

Actually, it can be an old doc, so look here. But even wiki says, that mpeg is not supported by any browser.

Community
  • 1
  • 1
shukshin.ivan
  • 11,075
  • 4
  • 53
  • 69
0

I agree with shukshin.ivan mpg or mpeg format cannot be embedded in audiosource. Also, here are few links that might be helpful for you in coding and with different formats.

https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats

https://developer.mozilla.org/de/docs/Web/HTML/Using_HTML5_audio_and_video

and I found a reference to your question on stackoverflow which is related to importing mpeg files in HTML5 audio tag you can find more detailed explaination:

Is there a way to play mpeg videos in HTML5?

I hope this helps.

Community
  • 1
  • 1
Priyanka Thombre
  • 232
  • 1
  • 4
  • 12