Revision 9c910f81 cloudcms/static/cloudcms/js/youtube.js
b/cloudcms/static/cloudcms/js/youtube.js | ||
---|---|---|
6 | 6 |
this.videoEl = this.wrapper.find('.player-placeholder'); |
7 | 7 |
this.currwidth = this.wrapper.width(); |
8 | 8 |
this.currheight = parseInt(458* (this.currwidth/816)); |
9 |
this.close = $('#stop-youtube'); |
|
9 | 10 |
var self = this; |
10 | 11 |
|
11 | 12 |
this.player = new YT.Player(this.videoEl[0], { |
12 | 13 |
height: self.currheight, |
13 | 14 |
width: self.currwidth, |
14 | 15 |
playerVars: { 'modestbranding':1}, |
15 |
videoId: options.youtube_id, |
|
16 |
suggestedQuality: 'hd1080', |
|
16 |
videoId: options.youtube_id, |
|
17 | 17 |
events: { |
18 | 18 |
'onStateChange': function(event) { |
19 | 19 |
if ( event.data == YT.PlayerState.ENDED ) { |
... | ... | |
39 | 39 |
self.wrapper.animate({ |
40 | 40 |
height: self.currheight |
41 | 41 |
},1000, function(){ |
42 |
self.close.css('visibility','visible'); |
|
42 | 43 |
self.link.hide(); |
43 |
self.player.setPlaybackQuality('hd1080');
|
|
44 |
self.player.setPlaybackQuality('hd720');
|
|
44 | 45 |
self.player.playVideo(); |
45 | 46 |
}) |
46 | 47 |
}); |
47 |
$('.stop-youtube').click(function(e){
|
|
48 |
this.close.click(function(e){
|
|
48 | 49 |
e.preventDefault(); |
49 | 50 |
self.endEvents(); |
50 | 51 |
}) |
... | ... | |
52 | 53 |
|
53 | 54 |
YouTube.prototype.endEvents = function() { |
54 | 55 |
var self = this; |
55 |
|
|
56 |
self.close.css('visibility','hidden'); |
|
56 | 57 |
self.image.fadeIn({duration:1500,easing:'easeOutCirc'}); |
57 |
$(self.player.a).show().fadeIn({duration:1500,easing:'easeOutCirc'});
|
|
58 |
self.wrapper.animate({
|
|
59 |
height:'282'
|
|
60 |
},1000, function(){
|
|
61 |
self.link.show();
|
|
58 |
$(self.player.a).show().fadeIn({duration:1500,easing:'easeOutCirc'}); |
|
59 |
self.wrapper.animate({ |
|
60 |
height:'282' |
|
61 |
},1000, function(){ |
|
62 |
self.link.show(); |
|
62 | 63 |
}) |
63 | 64 |
} |
Also available in: Unified diff