Skip to content

rcolepeterson/YouTubeMe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

JS proxy to interface with the YouTube API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published