ccs.YoutubeVideo=function(playerId){var self;var playerId;var ytplayer;var played;function constructorFn(playerId){self=this;this.playerId=playerId;ytplayer=null;played=false;window['onytplayerReady_'+playerId]=function(playerId){self.onReady();} window['onytplayerStateChange_'+playerId]=function(state){self.onStateChange(state);} var oldOnReady=window.onYouTubePlayerReady;window.onYouTubePlayerReady=function(playerId){if(window['onytplayerReady_'+playerId]){window['onytplayerReady_'+playerId](playerId);} if(oldOnReady){oldOnReady(playerId);}}} constructorFn.prototype.onReady=function(){ytplayer=document.getElementById(playerId);ytplayer.addEventListener("onStateChange","onytplayerStateChange_"+playerId);} constructorFn.prototype.onStateChange=function(newState){if(newState==1){if(!played){played=true;self.onFirstPlay();}}} constructorFn.prototype.onFirstPlay=function(){} return new constructorFn(playerId);}