Skip to content

proximitybbdo/youtube-js-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

YouTubePlayer / YouTubePlayerManager

Allows you to embed YouTube videos via Javascript. It can handle several YouTube videos per page.

Each YouTubePlayer object can have 2 hooks you can use.

This first one is on_state_change to track / log video events such as 'unstarted', 'ended', 'playing', 'paused', 'buffering', 'cued'.

The second one is on_progress_change to track down video progress (in percentage).

Usage Flash Player

var ytp_flashplayer = new YouTubePlayer('ytapiplayer', 'eQtai7HMbuQ');
var ytpm = new YouTubePlayerManager();

ytpm.add(ytp_flashplayer);

ytp_flashplayer.on_state_change = function(state) {
  console.log(state)
}

ytp_flashplayer.on_progress_change = function(perc) {
  console.log(perc)
}

ytp_flashplayer.add_player();

Usage HTML 5

var ytp_html5 = new YouTubePlayer('ytapiplayer', 'eQtai7HMbuQ', null, null, true);
var ytpm = new YouTubePlayerManager();

ytpm.add(ytp_html5);

ytp_html5.on_state_change = function(state) {
  console.log(state)
}

ytp_html5.on_progress_change = function(perc) {
  console.log(perc)
}

ytp_html5.add_player();

Dependencies

Info

Proximity BBDO

About

Javascript YouTube player used for tracking video events.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published