this.videoEl = this.wrapper.find('.player-placeholder');
this.currwidth = this.wrapper.width();
this.currheight = parseInt(458* (this.currwidth/816));
+ this.close = $('#stop-youtube');
var self = this;
this.player = new YT.Player(this.videoEl[0], {
height: self.currheight,
width: self.currwidth,
playerVars: { 'modestbranding':1},
- videoId: options.youtube_id,
- suggestedQuality: 'hd1080',
+ videoId: options.youtube_id,
events: {
'onStateChange': function(event) {
if ( event.data == YT.PlayerState.ENDED ) {
self.wrapper.animate({
height: self.currheight
},1000, function(){
+ self.close.css('visibility','visible');
self.link.hide();
- self.player.setPlaybackQuality('hd1080');
+ self.player.setPlaybackQuality('hd720');
self.player.playVideo();
})
});
- $('.stop-youtube').click(function(e){
+ this.close.click(function(e){
e.preventDefault();
self.endEvents();
})
YouTube.prototype.endEvents = function() {
var self = this;
-
+ self.close.css('visibility','hidden');
self.image.fadeIn({duration:1500,easing:'easeOutCirc'});
- $(self.player.a).show().fadeIn({duration:1500,easing:'easeOutCirc'});
- self.wrapper.animate({
- height:'282'
- },1000, function(){
- self.link.show();
+ $(self.player.a).show().fadeIn({duration:1500,easing:'easeOutCirc'});
+ self.wrapper.animate({
+ height:'282'
+ },1000, function(){
+ self.link.show();
})
}