Skip to content

Latest commit

 

History

History
58 lines (44 loc) · 1.26 KB

README.md

File metadata and controls

58 lines (44 loc) · 1.26 KB

YouTubeMe

JS proxy to interface with the YouTube API.

npm install

npm start

Usage example.
<div id="playerDiv"></div>

var ytubeMe = new possible.YouTubeMe({
    videoId: 'tXL7tA5070k',
    container: 'playerDiv'
  });
Add listeners
<div id="playerDiv"></div>
var ytubeMe = new possible.YouTubeMe({
	videoId: 'tXL7tA5070k',
	width: 500,
	height: 300,
	container: 'playerDiv',
	onReady: onReady,
	onStateChange: onStateChange
});

//YouTube event listeners.
var onReady = function(event) {
    // onPlayerReady event has fired.
};

var onStateChange = function(event) {
    if (event.data == YT.PlayerState.PLAYING)
        // onPlayerStateChange: PLAYING event has fired.

    if (event.data == YT.PlayerState.PAUSED)
        // onPlayerStateChange: PAUSED event has fired.
};
Pass in player variables
var ytubeMe2 = new possible.YouTubeMe({
    videoId: 'T2dSE6_utcE',
    container: 'playerDiv',
    playerVars : {
        autoplay: 0,
        controls: 0,
        modestbranding: 1,
        rel: 1,
        showInfo: 1
    }
});

DEMO