HTML and CSS Reference
In-Depth Information
media . The src attribute is where the video file is specified, just like in video . The
type attribute is used to supply a video MIME type that gives the web browser a hint as
to what video format it is dealing with. Since the video format is a container format, the
MIME type is more complicated than with other file types. To address this, the MIME
type defines an additional codecs parameter to help narrow down the exact type of
video/audio format (container format and codecs used). This looks almost like an ad-
ditional attribute on source , but it is contained inside the type attribute if you look
closely at the nested quotes: 9
<video width="320" height="240">
<source src="trailer.webm" type='video/webm; co-
decs="vp8, vorbis"' />
This example shows the source video container format (WebM) as well as the video
and audio codec used (VP8 and Vorbis). The actual value supplied in the codecs para-
meter will vary depending on the options set when the video was encoded. Not only is a
video a container format that can use a variety of codecs for video and audio, but these
codecs also can have their own variations. H.264 in particular has a number of “pro-
files” that can be chosen for the purposes of using the video in different environments
(mobile versus a desktop computer, for instance). Table 5-3 shows common values for
the type attribute; the H.264 codecs shown are a profile for mobile devices (baseline),
standard-definition digital video broadcasting (main), and high-definition video broad-
casting (high).
The type attribute is not required, but if you do included it (and it is recommended
that you do), it will allow the web browser to determine whether it can play a particular
video file before it downloads part or all of the file, which will save bandwidth and time
from the user's perspective.
Search WWH ::

Custom Search