This page demonstrates the YouTube Player API's functions. To allow room for critical player functionality, players must be at least 200px by 200px.

Content: Controls: The controls in this section let you play, pause or stop a video. You can also seek to a specific point in the video by entering a number in the Seek to field, which specifies the time offset from the beginning of the video when playback should begin. Size: This section lets you modify the size of the player, using the setSize(width, height) function. Typically, this function would only be useful in an ActionScript application. In a JavaScript application, the resized player will still be inserted in the object that contains the video player, even if that object is smaller or larger than the resized player.

Note that on this page, the maximum dimensions for the player are 640 pixels wide and 360 pixels high – 640x360 in widescreen (16:9) format or 480x360 in standard (4:3) format.
  |     |   Height: 360
Statistics: The information in this section describes the status of the video player and the video being played (or the last video to play). The following list shows the API function associated with each field in this section:
  • Duration: getDuration()
  • Current time: getCurrentTime()
  • Player state: getPlayerState()
  • Percentage of video loaded: getVideoLoadedFraction()
  • Start bytes: getVideoStartBytes()
  • Quality level: getPlaybackQuality()
  • Available levels: getAvailableQualityLevels()
  • Volume (on/off): isMuted()
  • Number of videos in playlist: count(getPlaylist())
  • Position of current video: getPlaylistIndex()
  • Videos in playlist: getPlaylist()
  • Bytes loaded: getVideoBytesLoaded() (deprecated)
  • Total bytes: getVideoBytesTotal() (deprecated)
Duration: --:--, Current time: --:--, Player state: --
Start bytes: --,
Percentage of video loaded: --

Quality level: --, Available levels: , Volume (on/off):
Playback rate: --, Available rates:
Deprecated: Bytes loaded: --, Total bytes: --
History This page calls the getVideoUrl() and getEmbedCode() functions when the player is ready to play a video. These functions are called again if you load or cue a video.

If you call getVideoUrl() after a video has played for at least 10 seconds, the URL will include a parameter that specifies the time offset at which the player should begin playing the video.
None yet.

Events and Function Calls
None yet.

Embed code

IFrame embed
Object embed
Player parameters
  • checked box = parameter value of 1
  • unchecked box = parameter value of 0
  • Supported players are listed for each parameter.

Parameter Value
autohide [no value] (default) – In the AS3 and AS2 players, which support this parameter, the default behavior is for the player controls (play button, volume control, etc. to fade out while the video progress bar remains visible. In the HTML5 player, which does not support it, the default behavior is for the player controls to and video progress bar to be visible throughout the video.

1 – Automatically slide the video progress bar and the player controls 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 keyboard key.

0 (default) – The video progress bar and player controls will be visible throughout the video.

(AS3, AS2)
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. The default value is red.
(AS3, AS2)
iv_load_policy 1 (default) – Show video annotations. 3 – Do not show video annotations.
(AS3, AS2)
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. The default theme is dark
(AS3, AS2, HTML5)