HTML5 University

Multimedia

Multimedia brings interactivity to your webpage and allows you to show users your content rather than tell


Video

The following adds a video to a webpage (notice how the browser has a selection of video files to choose from and can choose the most optimal format):



<video width="280" height="160" controls="controls">
<source src="samplevideo.mp4" type="video/mp4">
<source src="samplevideo.ogv" type="video/ogv">
<source src="samplevideo.webm" type="video/webm">
Your browser does not support the video tag.
</video>

which would result in:


Audio

The following adds an audio file to a webpage (notice how the browser has a selection of audio files to choose from and can choose the most optimal format):



<audio controls="controls">
<source src="audio/sampleaudio.mp3" type="audio/mp3">
<source src="audio/sampleaudio.wav" type="audio/wav">
<source src="audio/sampleaudio.ogg" type="audio/ogg">
<source src="audio/sampleaudio.wma" type="audio/wma">
<source src="audio/sampleaudio.mid" type="audio/mid">
<source src="audio/sampleaudio.aac" type="audio/aac">
Your browser does not support the audio tag.
</audio>

which would result in: