Skip to content

Add a Video or MP3 Player using HTML5 Code | Easy Embedding

html5

Here is a sample code to add a video player into your website:

<!DOCTYPE HTML>
<html>
<body>

<video width=”320″ height=”240″ controls=”controls”>
<source src=”movie.mp4″ type=”video/mp4″ />
<source src=”movie.ogg” type=”video/ogg” />
<source src=”movie.webm” type=”video/webm” />
Your browser does not support the video tag.
</video>

</body>
</html>

Internet Explorer 9, Firefox, Opera, Chrome, and Safari support the <video> element.

Note: Internet Explorer 8 and earlier versions, do not support the <video> element.

 

To play an audio file in HTML5, this is all you need:

<audio controls=”controls”>
<source src=”horse.ogg” type=”audio/ogg” />
<source src=”horse.mp3″ type=”audio/mpeg” />
Your browser does not support the audio element.
</audio>

Audio Formats and Browser Support

Currently, there are 3 supported file formats for the <audio> element: MP3, Wav, and Ogg:

Browser MP3 Wav Ogg
Internet Explorer 9 YES NO NO
Firefox 4.0 NO YES YES
Google Chrome 6 YES YES YES
Apple Safari 5 YES YES NO
Opera 10.6 NO YES YES

Leave a Reply

Your email address will not be published. Required fields are marked *