An object containing the YouTube API functionality.
// <div id="player"></div>
const YT = embedYoutubePlayer();
new YT.Player('player', {
height: '360',
width: '640',
videoId: 'dQw4w9WgXcQ',
events: {
'onReady': onPlayerReady,
'onStateChange': null,
'onTimeChange': onTimeChange,
}
});
function onPlayerReady(event) {
event.target.playVideo();
}
function onTimeChange(time) {
console.log(time)
}
Creates video player wrapping YouTube IFrame Player API in a div element with the specified ID.