Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 11th, 2012  |  syntax: None  |  size: 0.43 KB  |  hits: 5  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. onYouTubePlayerReady = function( playerId ) {
  2.         ytplayer = document.getElementById( "video_container" );
  3.         ytplayer.addEventListener("onStateChange", "onytplayerStateChange");
  4.         ytplayer.addEventListener("onError", "onytplayerError");
  5.  
  6.         ytplayer.playVideo();
  7. }
  8.  
  9. function onytplayerStateChange(newState) {
  10.         if( newState == 0 ) {
  11.                 playNextVideo();
  12.         }
  13. }
  14.  
  15. // on error just go to next vid
  16. function onytplayerError(error) {
  17.         playNextVideo()
  18. }