HTML and CSS Reference
In-Depth Information
<video src="/hello.mp4">
<p>Your browser does not support the video element.</p>
</video>
Similarly, you can optionally incorporate some markup in the body of the <video> element to be
used in case the browser can't deal with video successfully.
Using the <video> element
Table 2-3 presents the list of attributes you can use to customize the aspect and behavior of the
<video> element in HTML5-compliant browsers.
TABLE 2-3 Attributes of the <video> element
Attribute
Description
Indicates that the video will start playing as soon as the content is available to the
browser.
autoplay
Instructs the browser to display video controls such as the play and pause
buttons.
controls
Indicates the desired height of the video player in the HTML document.
height
Indicates that the video will automatically restart after it is finished.
loop
Indicates that the video sound should be muted off.
muted
Instructs the browser to display a specified image while the video content is
downloading, or until the user chooses to play the video.
poster
preload
Note that the preload attribute is
ignored if the autoplay attribute
is also present.
Instructs the browser on how to load the video content when the page loads.
Allowed values are none , meaning that no content should be preloaded; auto ,
meaning that the entire content should be downloaded when the page loads;
and metadata , meaning that only content metadata should be preloaded on
page display.
Indicates the URL of the video file to play, whether local or remote.
src
Indicates the desired width of the video player in the HTML document.
width
It is highly recommended that you always set both width and height in a <video> element. This
helps the browser to reserve enough space while rendering the page. In addition, you should always
set width and height to the real size of the video clip you plan to incorporate. If you downsize the
video player, you force the browser to do even more work. Keep in mind that downsizing a video
won't save the user any download time. If you have a video that is too large for the page, you should
resize it with an ad hoc program first, and then link it using its new size.
Figure 2-11 shows how Internet Explorer 10 renders a video element.
 
Search WWH ::




Custom Search