The YouTube JavaScript Player API allows users to control the YouTube chromeless or embedded video players via JavaScript.
The JavaScript Player API allows users to control the YouTube chromeless or embedded video players via JavaScript. Calls can be made to play, pause, seek to a certain time in a video, set the volume, mute the player, and other useful functions.
The JavaScript Player API for
<iframe>
embeds is an experimental method for embedding and controlling YouTube videos in frames via JavaScript.
Q&A: Undocumented features:
- Chrome Extension: Adobe Flash Player has stopped a potentially unsafe operation
The cross-origin policy makes it impossible to control flash players through the ordinary JavaScript API. The player must be embedded in an<iframe>
, to get the API to work. - For simple methods, such as
play
, the full JavaScript<iframe>
API is not necessary:- YouTube iframe API: how do I control a iframe player that's already in the HTML?
(includes an easy method to play, pause, mute framed videos without loading the full API). - Hide/show in JavaScript - stop playing YouTube iframe video
(contains a one-liner for playing/pausing videos).
- YouTube iframe API: how do I control a iframe player that's already in the HTML?