HTML and CSS Reference
In-Depth Information
Figure 7-33
Parameters of the youtube player
Parameter
Default Value Description
autoplay=0|1
0
Indicates whether to play the video automatically (1) or to wait
for the user to press the play button (0)
controls=0|1
1
Removes the player controls (0) or displays them (1)
fs=0|1
0
Enables the user to play the video full screen (1) or not (0)
hd=0|1
0
Causes the high-definition version of the video to play (1) or not (0)
loop=0|1
0
Sets the video to repeat (1) or to play only once (0)
playlist= list
Plays a list of videos, where list is a comma-separated list of videos
rel=0|1
1
Indicates whether to display a list of related YouTube videos (1)
or to disable that feature (0)
start= value
Starts the video playback value seconds into the video
For example, the following URL identifies a unique YouTube video, allows users to play
the video in full-screen mode, and displays a list of related videos when the clip is finished:
http://www.youtube.com/v/iaN8M0pDOeM?fs=1&rel=1
The complete HTML code is as follows:
<object width=”640” height=”349”>
<param name=”movie”
value=” http://www.youtube.com/v/iaN8M0pDOeM?fs=1&rel=1” / >
<param name=”allowFullScreen” value=”true” />
<embed src=” http://www.youtube.com/v/iaN8M0pDOeM?fs=1&rel=1”
type=”application/x-shockwave-flash”
width=”640” height=”349”
allowFullScreen=”true” />
</object>
Notice that you also can include the allowFullScreen parameter either as a param
element or as an attribute of the embed element to turn on full-screen viewing of the video.
Starting in 2010, YouTube also began providing alternate embedding code to support
browsers using HTML5 that do not support Flash. The general syntax is
<iframe type=”text/html” width=” value ” height=” value
src=” url
frameborder=”0” parameters >
</iframe>
where once again url identifies the YouTube video and parameters controls the
appearance and actions of the YouTube player. The iframe element is used to store inline
frames, which are windows into the content of another Web page or Internet resource.
YouTube makes it very easy to generate the code required to embed its videos. You
simply can click the Share button below a video on the YouTube Web site and copy
the HTML code displayed by YouTube into the appropriate location in your HTML file.
Please note that any videos submitted to YouTube are still subject to copyright restrictions
and are removed if those restrictions are violated.
You can learn more about
the iframe element in the
appendices.
Search WWH ::




Custom Search