유투브 api... cc_load_policy...펌
Contents
Overview
This document defines the parameters that are available in the YouTube embedded player. By appending these parameters to the SWF or IFrame URL, you can customize the playback experience in your application. For example, you can automatically play videos using the autoplay
parameter or cause a video to play repeatedly using the loop
parameter. You can also enable the JavaScript API for the player using the enablejsapi
parameter.
This page currently defines all parameters supported in any YouTube embedded player. You can change the parameters listed by selecting a specific player from the pulldown menu next to the first paragraph in the Parameters section or by selecting Show all
in that menu to view all parameters.
Parameters
All of the following parameters are optional. The list shows parameters supported in any YouTube embedded player. You can customize the list using the pulldown menu below (or in the Overview section). Note that these parameters are only officially supported by the embedded player, but a subset of them may work with other players such as the playlist player or the custom player. Note: IFrame embeds can load either the HTML5 player or the AS3 player. Though some parameters are not supported in both players, an IFrame embed that loads the AS3 player will support all parameters that work with that player and ignore all other parameters. Similarly, an IFrame embed that loads the HTML5 player will support all parameters that work with that player while ignoring all other parameters. For example, the HTML5 player does not currently support the cc_load_policy parameter, but you can still specify that parameter when creating an IFrame embed. If the embed loads the AS3 player, the player will support the parameter, and if the embed loads the HTML5 player, the player will ignore it. |
Select parameters to display: |
All YouTube player parameters
autohide
- Values:
0
,1
, and2
(default). This parameter indicates whether the video controls will automatically hide after a video begins playing. The default behavior is for the video progress bar to fade out while the player controls (play button, volume control, etc.) remain visible.
- If this parameter is set to
0
, the video progress bar and the video player controls will be visible throughout the video. - If this parameter is set to
1
, then the video progress bar and the player controls will slide out of view a couple of seconds after the video starts playing. They will only reappear if the user moves her mouse over the video player or presses a key on her keyboard.
- If this parameter is set to
autoplay
- Values:
0
or1
. Default is0
. Sets whether or not the initial video will autoplay when the player loads. border
- Values:
0
or1
. Default is0
. Setting to1
enables a border around the entire video player. The border's primary color can be set via thecolor1
parameter, and a secondary color can be set by thecolor2
parameter. cc_load_policy
- Values:
1
. Default is based on user preference. Setting to1
will cause closed captions to be shown by default, even if the user has turned captions off. color
- This parameter specifies the color that will be used in the player's video progress bar to highlight the amount of the video that the viewer has already seen. Valid parameter values are
red
andwhite
, and, by default, the player will use the color red in the video progress bar. See the YouTube API blog for more information about color options.
Note: This parameter is supported in the AS3 embedded player and in IFrame embeds that load the AS3 player. (IFrame embeds could also load the HTML5 player.) However, using thecolor
parameter will disable themodestbranding
option in the embedded player. color1, color2
- Values: Any RGB value in hexadecimal format.
color1
is the primary border color, andcolor2
is the video control bar background color and secondary border color. controls
- Values:
0
or1
. Default is1
. This parameter indicates whether the video player controls will display. If this parameter is set to0
, then the player controls will not display, causing the player to look like the chromeless player. disablekb
- Values:
0
or1
. Default is0
. Setting to1
will disable the player keyboard controls. Keyboard controls are as follows:
Spacebar: Play / Pause
Arrow Left: Jump back 10% in the current video
Arrow Right: Jump ahead 10% in the current video
Arrow Up: Volume up
Arrow Down: Volume Down egm
- Values:
0
or1
. Default is0
. Setting to1
enables the "Enhanced Genie Menu". This behavior causes the genie menu (if present) to appear when the user's mouse enters the video display area, as opposed to only appearing when the menu button is pressed.
Note: This parameter is not supported in the AS3 embedded player. enablejsapi
- Values:
0
or1
. Default is0
. Setting this to1
will enable the Javascript API. For more information on the Javascript API and how to use it, see the JavaScript API documentation. fs
- Values:
0
or1
. Default is0
. Setting to1
enables the fullscreen button in the embedded player and does not affect the chromeless player. The fullscreen option will not work if you load the YouTube player into another SWF. Note that you must include some extra arguments to your embed code for this to work. The bold text in the following example is required to enable fullscreen functionality:<object width="560" height="315"> <param name="movie" value="https://www.youtube.com/v/u1zgFlCw8Aw?fs=1"</param> <param name="allowFullScreen" value="true"></param> <param name="x-x-allowscriptaccess" value="always"></param> <embed src="https://www.youtube.com/v/u1zgFlCw8Aw?fs=1" type="application/x-shockwave-flash" allowfullscreen="true" x-x-allowscriptaccess="always" width="560" height="315"> </embed> </object>
hd
- Values:
0
or1
. Default is0
. Setting to1
enables HD playback by default. This has no effect on the Chromeless Player. This also has no effect if an HD version of the video is not available. If you enable this option, keep in mind that users with a slower connection may have an sub-optimal experience unless they turn off HD. You should ensure your player is large enough to display the video in its native resolution.
Note: The AS3 player will automatically play the version of the video that is appropriate for your player's size. If an HD version of a video is available in the AS3 player and that is the appropriate version for your player, then that is the version that will play. iv_load_policy
- Values:
1
or3
. Default is1
. Setting to1
will cause video annotations to be shown by default, whereas setting to3
will cause video annotation to not be shown by default. loop
- Values:
0
or1
. Default is0
. In the case of a single video player, a setting of1
will cause the player to play the initial video again and again. In the case of a playlist player (or custom player), the player will play the entire playlist and then start again at the first video.
Note: This parameter has limited support in the AS3 player and in IFrame embeds, which could load either the AS3 or HTML5 player. Currently, theloop
parameter only works in the AS3 player when used in conjunction with theplaylist
parameter. To loop a single video, set theloop
parameter value to1
and set theplaylist
parameter value to the same video ID already specified in the Player API URL:http://www.youtube.com/v/VIDEO_ID?version=3&loop=1&playlist=VIDEO_ID
modestbranding
- This parameter lets you use a YouTube player that does not show a YouTube logo. Set the parameter value to
1
to prevent the YouTube logo from displaying in the control bar. Note that a smallYouTube
text label will still display in the upper-right corner of a paused video when the user's mouse pointer hovers over the player.
Note: This parameter is supported in the AS3 embedded player and in IFrame embeds that load the AS3 player. (IFrame embeds could also load the HTML5 player.) origin
- This parameter provides an extra security measure for the IFrame API and is only supported for IFrame embeds. If you are using the IFrame API, which means you are setting the
enablejsapi
parameter value to1
, you should always specify your domain as theorigin
parameter value. playerapiid
- Value can be any alphanumeric string. This setting is used in conjunction with the JavaScript API. See the JavaScript API documentation for details.
playlist
- Value is a comma-separated list of video IDs to play. If you specify a value, the first video that plays will be the
VIDEO_ID
specified in the URL path, and the videos specified in theplaylist
parameter will play thereafter. rel
- Values:
0
or1
. Default is1
. Sets whether the player should load related videos once playback of the initial video starts. Related videos are displayed in the "genie menu" when the menu button is pressed. The player search functionality will be disabled ifrel
is set to0
. showinfo
- Values:
0
or1
. Default is1
. Setting to0
causes the player to not display information like the video title and uploader before the video starts playing. showsearch
- Values:
0
or1
. Default is1
. Setting to0
disables the search box from displaying when the video is minimized. Note that if therel
parameter is set to0
then the search box will also be disabled, regardless of the value ofshowsearch
. start
- Values: A positive integer. This parameter causes the player to begin playing the video at the given number of seconds from the start of the video. Note that similar to the
seekTo
function, the player will look for the closest keyframe to the time you specify. This means sometimes the play head may seek to just before the requested time, usually no more than ~2 seconds. theme
- This parameter indicates whether the embedded player will display player controls (like a 'play' button or volume control) within a dark or light control bar. Valid parameter values are
dark
andlight
, and, by default, the player will display player controls using thedark
theme. See the YouTube API blog for more information about the dark and light themes.
Example Usage
The following instructions explain how to use the parameters above:
-
AS3 and AS2 players ? Append the parameters to the end of the YouTube video SWF URL for the AS2 or AS3 players. The SWF URL has one of the following formats:
- Embedded AS3 player:
http://www.youtube.com/v/VIDEO_ID?version=3
- Chromeless AS3 player:
http://www.youtube.com/apiplayer?video_id=VIDEO_ID&version=3
- Embedded AS2 player:
http://www.youtube.com/v/VIDEO_ID
- Chromeless AS2 player:
http://www.youtube.com/apiplayer?video_id=VIDEO_ID
Note: The AS2 Player API has been deprecated.
- Embedded AS3 player:
-
HTML5 player (IFrame embeds) ? Select one of the following options. Both are explained in more detail in the Loading a video player section of the IFrame Player API documentation.
-
The second parameter in the constructor for the video player is an object that specifies player options. The parameter's
playerVars
property is an object that identifies player parameters. -
If you create the
<iframe>
element for your video player yourself (rather than having the JavaScript code create it), you can append player parameters directly to the end of the URL. The URL has the following format:http://www.youtube.com/embed/JW5meKfy3fY
-
If you are using the YouTube Data API, you can programmatically construct these URLs by retrieving the <yt:videoid>
tag value in an API entry and replacing the VIDEO_ID
text in the URLs above with that value. You should also confirm that the feed entry for the video contains a <media:content>
tag for which the value of the yt:format
attribute is 5
. The absence of that tag indicates that the video owner had disabled embedding for the video.
<entry> ... <media:group> <media:content url="http://www.youtube.com/v/VIDEO_ID" type="application/x-shockwave-flash" medium="video" isDefault="true" expression="full" duration="100" yt:format="5"/> ... <yt:videoid>VIDEO_ID</yt:videoid> </media:group> ... <entry>
The following example uses the autohide
and showinfo
parameters to prevent video information from displaying at the top of the player before the video starts playing and to automatically hide the player controls after the video starts playing:
<object width="560" height="315"> <param name="movie" value="https://www.youtube.com/v/u1zgFlCw8Aw?version=3&autohide=1&showinfo=0"></param> <param name="x-x-allowscriptaccess" value="always"></param> <embed src="https://www.youtube.com/v/u1zgFlCw8Aw?version=3&autohide=1&showinfo=0" type="application/x-shockwave-flash" x-x-allowscriptaccess="always" width="560" height="315"></embed> </object>
The player below uses the sample code shown above:
Revision history
August 11, 2011
This update contains the following changes:
-
The new
theme
andcolor
parameters let you customize the appearance of the embedded player's player controls. See the YouTube API blog for more information.
June 8, 2011
This update contains the following changes:
-
The new
modestbranding
parameter lets you use a YouTube player that does not show a YouTube logo. The parameter is supported for the AS3 embedded player and for IFrame embeds that load the AS3 player. (Note that IFrame embeds may also load the HTML5 player, which does not support this parameter.)
February 14, 2011
This update contains the following changes:
-
The documentation has been updated to note that the AS2 Player API has been deprecated. The deprecation of the AS2 Player API was actually announced on October 14, 2009.
February 3, 2011
This update contains the following changes:
-
The documentation has been updated to identify parameters supported in the HTML5 (IFrame) embedded player.
-
The document now displays all of the parameters supported in any of YouTube's embedded players (AS2, AS3, HTML5). However, if you linked to this document from a particular version of the Player API documentation, then, by default, the page will display parameters supported in that version of the API. For example, if you link to this document from the IFrame API documentation, then the page will only display the parameters supported by the HTML5 player (IFrame embeds), but if you link from the Flash (AS3) API documentation, then this page will only display parameters that YouTube's Flash (AS3) player supports.
You can use the pulldown menu in the Overview section to update the list to only show parameters that a particular player supports (or to display all parameters).
-
As the customized lists show, the following parameters are supported in the AS2 player but have been deprecated for the newer AS3 and HTML5 players:
border
,color1
,color2
,egm
,hd
, andshowsearch
.In addition, the
loop
parameter has limited support in the AS3 player and in IFrame embeds, which could load either an AS3 or HTML player. Currently, theloop
parameter only works in the AS3 player when used in conjunction with theplaylist
parameter. To loop a single video, set theloop
parameter to1
and set theplaylist
parameter value to the same video ID already specified in the Player API URL:http://www.youtube.com/v/VIDEO_ID?version=3&loop=1&playlist=VIDEO_ID
Similarly, the
controls
andplaylist
parameters are supported in the AS3 and HTML5 players but are not and will not be supported in the AS2 player.As noted above, IFrame embeds, an experimental feature, can load either an AS3 or HTML5 player. Though some parameters are not supported in both players, an IFrame embed that loads the AS3 player will support all parameters that work with that player and ignore all other parameters. Similarly, an IFrame embed that loads the HTML player will support all parameters that work with that player while ignoring all other parameters.
-
The parameter list has been updated to include the
autohide
parameter, which indicates whether the player's video controls will automatically hide after a video begins playing. -
The parameter list has been updated to include the
controls
parameter, which indicates whether the player's video controls will display at all. (Player controls do display by default.) -
The parameter list has been updated to include the
playlist
parameter, which specifies a comma-separated list of video IDs to play. -
The definition of the
fs
has been updated to note that the fullscreen option will not work if you load the YouTube player into another SWF. -
The example at the end of the document has been updated to use the embedded AS3 player instead of the embedded AS2 player. The parameters used in the example have also been updated to only include parameters that the AS3 player supports.
In addition, the instructions for constructing the URLs that contain player parameters have been updated to reflect the URL formats used by the AS3 and AS2 embedded and chromeless players as well as by the HTML5 player.