|
There has never been a standard for showing video and audio on a web page. Most videos/audios were shown through a plugin (like flash). These tags serve the purpose of embedding video and audio in HTML code rather than using a plugin for playing them which is a onerous task as every search engine has its own set of plugins.
HTML5 specifies a standard way to include video, with the video element.
<video src="movie.ogg" controls="controls">
</video>
Example
<video src="movie.ogg" width="320" height="240" controls="controls">
Your browser does not support the video tag.
</video>
The example above uses an Ogg file, and will work in Firefox, Opera and Chrome.
To make the video work in Internet Explorer, Safari and future versions of Chrome, we must add a MPEG4 and WebM file.
HTML5 specifies a standard way to include audio, with the audio element.
<audio src="song.ogg" controls="controls">
</audio>
Example
<audio src="song.ogg" controls="controls">
Your browser does not support the audio element.
</audio>
The example above uses an Ogg file, and will work in Firefox, Opera and Chrome.
To make the audio work in Internet Explorer and Safari, add an audio file of the type MP3.
-The control attribute is for adding play, pause, and volume controls for both audio and video tags
-Insert content between the <video> and </video> tags as well as <audio> and </audio> for browsers that do not support the video and audio element
|