views:

105

answers:

2

I'm using html5 audio tag and can't seem to find what to specify for the codec for both mp3 and wav.

I know ogg is:

<audio>
<source type='audio/ogg; codec="vorbis"' />
</audio>

Anyone know what I would write for mp3 and wav?

A: 

For WAV, use <source type="audio/wave">; for MP3 you want audio/mpeg. You don't need to say exactly which codec you are using, the browser will figure it out.

Zack
If you don't specify a codec then the browser opens the file a little bit to see if it can play it. That is the benefit of adding the codec values. I would like to try and figure this out.
keith
A: 

what browser are you using for playing the mp3 file? not all browsers support playing of mp3 trough the audio tag yet. see: http://dev.opera.com/articles/view/html5-audio-radio-player/ I suggest making a script that chooses the audio type according to the browser type. That way the user always has playing music.

OhBugger
That's the point of providing multiple sources and telling the browser which codec they are. The browser picks for itself the one it supports. You don't need to do that for it.
TRiG