Skip to content

Instantly share code, notes, and snippets.

@markupboy
Created November 11, 2011 23:04
Show Gist options
  • Select an option

  • Save markupboy/1359597 to your computer and use it in GitHub Desktop.

Select an option

Save markupboy/1359597 to your computer and use it in GitHub Desktop.
PA Player
var PA = PA || {};
PA.homevideo = {
init: function() {
this.getDom();
this.setupPlayer();
this.bindControls();
this.bindReady();
},
bindControls: function() {
this.controls.bind('click', $.proxy(this.gotoAndPlay, this));
},
bindReady: function() {
this.player.addEvent('ready', $.proxy(this.setupPlayer, this));
},
getDom: function() {
this.controls = $('.play-video');
this.shade = $('.panel-wrapper, .panel-nav');
this.player = $f(document.querySelectorAll('iframe')[0]);
},
gotoAndPlay: function() {
this.shade.fadeOut('fast');
this.play();
},
hideShade: function(callback) {
this.shade.fadeOut(500, $.proxy(callback, this));
},
pause: function() {
this.player.api('pause');
},
play: function() {
this.player.api('play');
},
resetPlayer: function() {
this.player.api('seekTo', 0);
this.showShade();
},
setupPlayer: function() {
// this.player.addEvent('play', $.proxy(this.onPlay, this));
this.player.addEvent('pause', $.proxy(this.resetPlayer, this));
this.player.addEvent('finish', $.proxy(this.resetPlayer, this));
},
showShade: function(callback) {
this.shade.fadeIn(500, $.proxy(callback, this));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment