This video will be available soon la gi
Show
The IFrame player API lets you embed a YouTube video player on your website and control the player using JavaScript. Using the API's JavaScript functions, you can queue videos for playback; play, pause, or stop those videos; adjust the player volume; or retrieve information about the video being played. You can also add event listeners that will execute in response to certain player events, such as a player state change. This guide explains how to use the IFrame API. It identifies the different types of events that the API can send and explains how to write event listeners to respond to those events. It also details the different JavaScript functions that you can call to control the video player as well as the player parameters you can use to further customize the player. RequirementsThe user's browser must support the HTML5 postMessage feature. Most modern browsers support postMessage. Embedded players must have a viewport that is at least 200px by 200px. If the player displays controls, it must be large enough to fully display the controls without shrinking the viewport below the minimum size. We recommend 16:9 players be at least 480 pixels wide and 270 pixels tall. Any web page that uses the IFrame API must also implement the following JavaScript function:
Getting startedThe sample HTML page below creates an embedded player that will load a video, play it for six seconds, and then stop the playback. The numbered comments in the HTML are explained in the list below the example.
Revision historyApril 27, 2021The Getting Started and Loading a Video Player sections have been updated to include examples of using a playerVars object to customize the player. October 13, 2020Note: This is a deprecation announcement for the embedded player functionality that lets you configure the player to load search results. This announcement affects the IFrame Player API's queueing functions for lists, cuePlaylist and loadPlaylist. This change will become effective on or after 15 November 2020. After that time, calls to the cuePlaylist or loadPlaylist functions that set the listType property to search will generate a 4xx response code, such as 404 (Not Found) or 410 (Gone). This change also affects the list property for those functions as that property no longer supports the ability to specify a search query. As an alternative, you can use the YouTube Data API's search.list method to retrieve search results and then load selected videos in the player. October 24, 2019The documentation has been updated to reflect the fact that the API no longer supports functions for setting or retrieving playback quality. As explained in this YouTube Help Center article, to give you the best viewing experience, YouTube adjusts the quality of your video stream based on your viewing conditions. The changes explained below have been in effect for more than one year. This update merely aligns the documentation with current functionality:
May 16, 2018The API now supports features that allow users (or embedders) to control the viewing perspective for 360° videos:
This example demonstrates and lets you test these new features. June 19, 2017This update contains the following changes:
August 11, 2016This update contains the following changes:
June 29, 2016This update contains the following changes:
June 24, 2016The Examples section has been updated to include an example that demonstrates how to use the API with an existing January 6, 2016The clearVideo function has been deprecated and removed from the documentation. The function no longer has any effect in the YouTube player. December 18, 2015European Union (EU) laws require that certain disclosures must be given to and consents obtained from end users in the EU. Therefore, for end users in the European Union, you must comply with the EU User Consent Policy. We have added a notice of this requirement in our YouTube API Terms of Service. April 28, 2014This update contains the following changes:
March 25, 2014This update contains the following changes:
July 23, 2013This update contains the following changes:
October 31, 2012This update contains the following changes:
August 22, 2012This update contains the following changes:
August 6, 2012This update contains the following changes:
July 19, 2012This update contains the following changes:
July 16, 2012This update contains the following changes:
June 6, 2012This update contains the following changes:
March 30, 2012This update contains the following changes:
March 26, 2012This update contains the following changes:
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Last updated 2021-04-27 UTC. [{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }] |