HTML Basics: Video Embedding Made Easy – Essential Tips for Adding Multimedia to Your Page

Deutsch

Add a Video Player to Your Web Page

Want to add a video player to a web page without knowing how to add a media player to HTML pages? The new HTML5 video tag is used to add video content to an HTML page. This makes it easy to add a video, such as a movie clip, to your web page without having to use any Video Plug-in.

All recent web browsers, including their mobile versions, support the video command very well. There are no compatibility issues with video playback.

The HTML5 video tag adds native support to playback a video within an HTML page.

The VIDEO tag of HTML5 is a standard technique for including video into a web page. Unfortunately, browser manufacturers have yet agreed on a common standard for which video codecs should (or can or must) be used.

The HTML <video> Tag

There are three different video formats that have been established for video. These are: OGV (Ogg Theora), MP4 (H.264), and the royalty-free open-source WebM media file format for storing video content, that was created in 2010 by Google.

Due to licensing reasons, different video formats are supported depending on the browser. Each browser supports either one or the other video format.

The MP4 format is supported by all current browsers. You only need to specify the Ogg Video Format if older browsers must also be supported.

WebM is an Open Source alternative to the proprietary MPEG4 and H.264 standards. While WebM is typically smaller than MP4 which offers better cross-platform and cross-device compatibility. MP4 is also supported by the overwhelming majority of video players on the market.

For the basic functionality of the HTML5 video player, it is sufficient to specify only the video URL in the <video> tag. Add the video URL by using either the src attribute of the <video> tag or by nesting one or more <source> tags between the opening and closing video tags.

The VIDEO tag starts with <video> and has to be closed with </video>.

To embed a video player, insert the following code into your web page.

Integrate a video player in a web page using the <video> tag

<video controls>
    <source="/en/video/anime-butterfly-480p.mp4" type="video/mp4">
    Your browser does't support this audio format.
</video>
     

The controls attribute is used to display a control panel so that the user can access the Play, Pause, and Volume (loudness) controls. This attribute should always be specified.

The type attribute is required since there are different video formats which are either supported or not by a certain browser.

Additional Attributes for the Video Player