HTML <audio> and <video> elements
audio code example
<audio controls> <source src="file1.ogg" type="audio/ogg"> <source src="file1.mp3" type="audio/mpeg"> your browser does not support the audio element. </audio>
media type attribute MP4
video/mp4
media type attribute WebM
video/webm
text between tags
will display in browsers that do not support audio element
source tag syntax
<source src="" type"">
video code example
<video controls> <source src="file1.ogg" type="video/ogg"> <source src="file1.mp4" type="video/mp4"> your browser does not support the audio element. </video>
supported audio file formats
MP3 (all browsers) Wav (not IE) Ogg (not IE or Safari)
supported video file formats
MP4 (all browsers) WebM (not IE or Safari) Ogg (not IE or Safari)
multiple source elements
are ok, browser will use first recognized format
media type attribute MP3
audio/mpeg
media type attribute Ogg
audio/ogg video/ogg
media type attribute Wav
audio/wav
controls
controls element adds play, pause, volume
page will flicker
if you don't set the width and height
<track>
specifies next tracks for media elements (<audio> and <video>)