diff --git a/src/js/player.js b/src/js/player.js index 0ff14e3b9..79bdcc5c0 100644 --- a/src/js/player.js +++ b/src/js/player.js @@ -48,20 +48,12 @@ vjs.Player = function(tag, options, ready){ this.on('ended', this.onEnded); this.on('play', this.onPlay); + this.on('firstplay', this.onFirstPlay); this.on('pause', this.onPause); this.on('progress', this.onProgress); this.on('durationchange', this.onDurationChange); this.on('error', this.onError); - //If the first starttime attribute is specified - //then we will start at the given offset in seconds - - this.on('firstplay',function(){ - if(this.options_['starttime']){ - this.currentTime(this.options_['starttime']); - } - }); - // Make player easily findable by ID vjs.players[this.id_] = this; }; @@ -359,6 +351,14 @@ vjs.Player.prototype.onPlay = function(){ vjs.addClass(this.el_, 'vjs-playing'); }; +vjs.Player.prototype.onFirstPlay = function(){ + //If the first starttime attribute is specified + //then we will start at the given offset in seconds + if(this.options_['starttime']){ + this.currentTime(this.options_['starttime']); + } +}; + vjs.Player.prototype.onPause = function(){ vjs.removeClass(this.el_, 'vjs-playing'); vjs.addClass(this.el_, 'vjs-paused');