Arreglado fallo en VideoSlider (no salta el evento al terminar la reproducción)

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@70 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-08-07 17:22:35 +00:00
parent a05cdd20b5
commit 0ce9f663ab
4 changed files with 56 additions and 58 deletions

View File

@ -16,7 +16,7 @@
this._lastPlayedFromPlaylistClick;//last played on click.
this._lastRandomCounter;//last played random media in random playlist.
this._randomPaused = false;//when random is playing and we interrupt it by click on the playlist.
this._traceCounter = false;
this._traceCounter = true;
this._randomArr = [];
this._playlistSelect = false;//prevent geting counter from randomArr on playlist click (get 'normal' counter instead)
@ -138,7 +138,6 @@
//reset
var self = $(this);
this._lastInOrder = false;
if(this._loopingOn){
if(this._randomPlay){
@ -166,25 +165,23 @@
self.trigger('ap_PlaylistManager.COUNTER_READY');
}else{//looping off
if(this._counter > this._playlistItems - 1){
this._counter = this._playlistItems - 1;
this._lastInOrder = true;//last item
//trace("last item");
}else if(this._counter < 0){
this._counter = 0;
this._lastInOrder = true;//first item
//trace("first item");
}
if(this._lastInOrder){
self.trigger('ap_PlaylistManager.COUNTER_READY');
if(this._counter > this._playlistItems - 1){
this._counter = 0;
this._lastInOrder = true;//last item
}else if( this._counter < 0){
this._counter = this._playlistItems - 1;
this._lastInOrder = false;
}
if(this._lastInOrder){
self.trigger('ap_PlaylistManager.PLAYLIST_END');
}else{
self.trigger('ap_PlaylistManager.PLAYLIST_END');
self.trigger('ap_PlaylistManager.COUNTER_READY');
}
}
if(this._traceCounter) console.log("counter = " + this.getCounter());
//if(this._traceCounter) console.log("counter = " + this.getCounter());
},
//make random set of numbers
_makeRandomList:function() {

View File

@ -1 +1 @@
(function(e){function g(b){this._loopingOn=b.loopingOn;this._randomPlay=b.randomPlay;this._playlistItems;this._lastInOrder=!1;this._counter=-1;this._lastPlayedFromPlaylistClick;this._lastRandomCounter;this._traceCounter=this._randomPaused=!1;this._randomArr=[];this._playlistSelect=!1}e.playlistManager=function(b){return new g(b)};g.prototype={setCounter:function(b,c){"undefined"==typeof c&&(c=!0);this._counter=c?this._counter+parseInt(b,10):parseInt(b,10);this._checkCounter()},getCounter:function(){return this._randomPlay? this._playlistSelect?this._counter:this._randomArr[this._counter]:this._counter},advanceHandler:function(b){this._playlistSelect=!1;this._randomPaused?this._handleRandomPaused(b):this.setCounter(b)},processPlaylistRequest:function(b){this._playlistSelect=!1;this._randomPlay&&(this._playlistSelect=!0,this._lastPlayedFromPlaylistClick=b,this._randomPaused||(this._lastRandomCounter=this._counter,this._randomPaused=!0));this.setCounter(b,!1)},getLastInOrder:function(){return this._lastInOrder},getRandomPaused:function(){return this._randomPaused}, setPlaylistItems:function(b){this._counter=-1;this._playlistItems=b;this._randomPlay&&this._makeRandomList()},reSetCounter:function(){this._counter=-1},setRandom:function(b){(this._randomPlay=b)&&this._makeRandomList();this._randomChange()},setLooping:function(b){this._loopingOn=b},setTraceCounter:function(b){this._traceCounter=b},_handleRandomPaused:function(){var b=e(this);this._randomPaused=!1;this._lastRandomCounter+a>this._playlistItems-1?(this._counter=this._playlistItems-1,b.trigger("ap_PlaylistManager.COUNTER_READY")): 0>this._lastRandomCounter+a?(this._counter=0,b.trigger("ap_PlaylistManager.COUNTER_READY")):this.setCounter(this._lastRandomCounter+a,!1)},_randomChange:function(){this._randomPlay?(this._activeIndexFirst(),this._counter=0):this._randomPaused?(this._counter=this._lastPlayedFromPlaylistClick,this._randomPaused=!1):this._counter=this._randomArr[this._counter]},_checkCounter:function(){var b=e(this);this._lastInOrder=!1;this._loopingOn?(this._randomPlay?this._counter>this._playlistItems-1?(this._counter= this._randomArr[this._playlistItems-1],this._makeRandomList(),this._firstIndexCheck(),this._counter=0):0>this._counter&&(this._counter=this._randomArr[0],this._makeRandomList(),this._lastIndexCheck(),this._counter=this._playlistItems-1):this._counter>this._playlistItems-1?this._counter=0:0>this._counter&&(this._counter=this._playlistItems-1),b.trigger("ap_PlaylistManager.COUNTER_READY")):(this._counter>this._playlistItems-1?(this._counter=this._playlistItems-1,this._lastInOrder=!0):0>this._counter&& (this._counter=0,this._lastInOrder=!0),this._lastInOrder?b.trigger("ap_PlaylistManager.COUNTER_READY"):b.trigger("ap_PlaylistManager.PLAYLIST_END"));this._traceCounter&&console.log("counter = "+this.getCounter())},_makeRandomList:function(){3>this._playlistItems||(this._randomArr=this._randomiseIndex(this._playlistItems))},_firstIndexCheck:function(){this._randomArr[0]==this._counter&&this._randomArr.push(this._randomArr.splice(0,1))},_lastIndexCheck:function(){this._randomArr[this._playlistItems- 1]==this._counter&&this._randomArr.unshift(this._randomArr.splice(this._playlistItems-1,1))},_activeIndexFirst:function(){var b=0,c=this._randomArr.length;for(b;b<c;b++)if(this._randomArr[b]==this._counter){if(0==b)break;this._randomArr.unshift(this._randomArr.splice(b,1));break}},_randomiseIndex:function(b){var c=[],e=[],d=0;for(d;d<b;d++)c[d]=d;var d=0,f;for(d;d<b;d++)f=Math.round(Math.random()*(c.length-1)),e[d]=c[f],c.splice(f,1);return e}}})(jQuery);
(function(c){c.playlistManager=function(e){var d=new b(e);return d};function b(d){this._loopingOn=d.loopingOn;this._randomPlay=d.randomPlay;this._playlistItems;this._lastInOrder=false;this._counter=-1;this._lastPlayedFromPlaylistClick;this._lastRandomCounter;this._randomPaused=false;this._traceCounter=true;this._randomArr=[];this._playlistSelect=false}b.prototype={setCounter:function(d,e){if(typeof e=="undefined"){e=true}if(e){this._counter+=parseInt(d,10)}else{this._counter=parseInt(d,10)}this._checkCounter()},getCounter:function(){var d;if(this._randomPlay){if(!this._playlistSelect){d=this._randomArr[this._counter]}else{d=this._counter}}else{d=this._counter}return d},advanceHandler:function(d){this._playlistSelect=false;if(this._randomPaused){this._handleRandomPaused(d)}else{this.setCounter(d)}},processPlaylistRequest:function(d){this._playlistSelect=false;if(this._randomPlay){this._playlistSelect=true;this._lastPlayedFromPlaylistClick=d;if(!this._randomPaused){this._lastRandomCounter=this._counter;this._randomPaused=true}}this.setCounter(d,false)},getLastInOrder:function(){return this._lastInOrder},getRandomPaused:function(){return this._randomPaused},setPlaylistItems:function(d){this._counter=-1;this._playlistItems=d;if(this._randomPlay){this._makeRandomList()}},reSetCounter:function(){this._counter=-1},setRandom:function(d){this._randomPlay=d;if(this._randomPlay){this._makeRandomList()}this._randomChange()},setLooping:function(d){this._loopingOn=d},setTraceCounter:function(d){this._traceCounter=d},_handleRandomPaused:function(){var d=c(this);this._randomPaused=false;if(this._lastRandomCounter+a>this._playlistItems-1){this._counter=this._playlistItems-1;d.trigger("ap_PlaylistManager.COUNTER_READY");return}else{if(this._lastRandomCounter+a<0){this._counter=0;d.trigger("ap_PlaylistManager.COUNTER_READY");return}}this.setCounter(this._lastRandomCounter+a,false)},_randomChange:function(){if(this._randomPlay){this._activeIndexFirst();this._counter=0}else{if(this._randomPaused){this._counter=this._lastPlayedFromPlaylistClick;this._randomPaused=false}else{this._counter=this._randomArr[this._counter]}}},_checkCounter:function(){var d=c(this);this._lastInOrder=false;if(this._loopingOn){if(this._randomPlay){if(this._counter>this._playlistItems-1){this._counter=this._randomArr[this._playlistItems-1];this._makeRandomList();this._firstIndexCheck();this._counter=0}else{if(this._counter<0){this._counter=this._randomArr[0];this._makeRandomList();this._lastIndexCheck();this._counter=this._playlistItems-1}}}else{if(this._counter>this._playlistItems-1){this._counter=0}else{if(this._counter<0){this._counter=this._playlistItems-1}}}d.trigger("ap_PlaylistManager.COUNTER_READY")}else{if(this._counter>this._playlistItems-1){this._counter=0;this._lastInOrder=true}else{if(this._counter<0){this._counter=this._playlistItems-1;this._lastInOrder=false}}if(this._lastInOrder){d.trigger("ap_PlaylistManager.PLAYLIST_END")}else{d.trigger("ap_PlaylistManager.COUNTER_READY")}}},_makeRandomList:function(){if(this._playlistItems<3){return}this._randomArr=this._randomiseIndex(this._playlistItems)},_firstIndexCheck:function(){if(this._randomArr[0]==this._counter){var d=this._randomArr.splice(0,1);this._randomArr.push(d)}},_lastIndexCheck:function(){if(this._randomArr[this._playlistItems-1]==this._counter){var d=this._randomArr.splice(this._playlistItems-1,1);this._randomArr.unshift(d)}},_activeIndexFirst:function(){var f=0;var d=this._randomArr.length;for(f;f<d;f++){if(this._randomArr[f]==this._counter){if(f==0){break}var e=this._randomArr.splice(f,1);this._randomArr.unshift(e);break}}},_randomiseIndex:function(g){var e=[];var k=[];var h=0;for(h;h<g;h++){e[h]=h}var f=0,d;for(f;f<g;f++){d=Math.round(Math.random()*(e.length-1));k[f]=e[d];e.splice(d,1)}return k}}})(jQuery);

View File

@ -257,7 +257,7 @@
if(!this._componentFixedSize) this._window.bind('resize', function(){
if(!self._componentInited) return false;
if(self._windowResizeIntervalID) clearInterval(self._windowResizeIntervalID);
self._windowResizeIntervalID = setTimeout(function() { self._doneResizing(); }, self._windowResizeInterval);
self._windowResizeIntervalID = setTimeout(function() {self._doneResizing();}, self._windowResizeInterval);
return false;
});
@ -269,6 +269,7 @@
});
$(this._playlistManager).bind('ap_PlaylistManager.PLAYLIST_END', function(){
self._disableActiveItem();
self.settings.videoGalleryPlaylistEnd.call(self);
});
if(this._playlistOutside) this._setComponents();
@ -277,7 +278,7 @@
this.thumbBackward.bind('mousedown touchstart MozTouchDown', function(){
if(self._playlistTransitionOn) return;
if(self._thumbScrollIntervalID) clearInterval(self._thumbScrollIntervalID);
self._thumbScrollIntervalID = setInterval(function() { self._scrollThumbsBack(); }, 100);
self._thumbScrollIntervalID = setInterval(function() {self._scrollThumbsBack();}, 100);
return false;
});
this.thumbBackward.bind('mouseup touchend MozTouchUp', function(){
@ -287,7 +288,7 @@
this.thumbForward.bind('mousedown touchstart MozTouchDown', function(){
if(self._playlistTransitionOn) return;
if(self._thumbScrollIntervalID) clearInterval(self._thumbScrollIntervalID);
self._thumbScrollIntervalID = setInterval(function() { self._scrollThumbsForward(); }, 100);
self._thumbScrollIntervalID = setInterval(function() {self._scrollThumbsForward();}, 100);
return false;
});
this.thumbForward.bind('mouseup touchend MozTouchUp', function(){
@ -298,7 +299,7 @@
this.thumbBackward.bind('mouseenter', function(){
if(self._playlistTransitionOn) return;
if(self._thumbScrollIntervalID) clearInterval(self._thumbScrollIntervalID);
self._thumbScrollIntervalID = setInterval(function() { self._scrollThumbsBack(); }, 100);
self._thumbScrollIntervalID = setInterval(function() {self._scrollThumbsBack();}, 100);
return false;
});
this.thumbBackward.bind('mouseleave', function(){
@ -308,7 +309,7 @@
this.thumbForward.bind('mouseenter', function(){
if(self._playlistTransitionOn) return;
if(self._thumbScrollIntervalID) clearInterval(self._thumbScrollIntervalID);
self._thumbScrollIntervalID = setInterval(function() { self._scrollThumbsForward(); }, 100);
self._thumbScrollIntervalID = setInterval(function() {self._scrollThumbsForward();}, 100);
return false;
});
this.thumbForward.bind('mouseleave', function(){
@ -905,7 +906,7 @@
if(titleDiv){
//console.log(currentTarget.height(), titleDiv.height());
var value=currentTarget.height()-titleDiv.height()-parseInt(titleDiv.css('paddingBottom'),10)-parseInt(titleDiv.css('paddingTop'),10);
titleDiv.stop().animate({ 'top': value+'px'}, {duration: 300, easing: 'easeOutQuart'});
titleDiv.stop().animate({'top': value+'px'}, {duration: 300, easing: 'easeOutQuart'});
}
return false;
});
@ -924,7 +925,7 @@
var titleDiv = currentTarget.find("div[data-title='titleDiv']");
if(titleDiv){
titleDiv.stop().animate({ 'top': currentTarget.height()+'px'}, {duration: 300, easing: 'easeOutQuart'});
titleDiv.stop().animate({'top': currentTarget.height()+'px'}, {duration: 300, easing: 'easeOutQuart'});
}
return false;
});
@ -993,7 +994,7 @@
div.append(titleDiv);
this.thumbInnerContainer.append(div);
div.stop().animate({ 'opacity': 1}, {duration: 500, easing: 'easeOutSine'});
div.stop().animate({'opacity': 1}, {duration: 500, easing: 'easeOutSine'});
if(this._thumbOrientation == 'horizontal'){
this._thumbInnerContainerSize+=this._thumbWidth+this._thumbSpacing;
@ -1030,7 +1031,7 @@
//fade in controls
this.slideshow_controls.css('opacity', 0);
this.slideshow_controls.css('display', 'block');
this.slideshow_controls.stop().animate({ 'opacity': 1}, {duration: 500, easing: 'easeOutSine'});
this.slideshow_controls.stop().animate({'opacity': 1}, {duration: 500, easing: 'easeOutSine'});
this.settings.videoGallerySetupDone.call(this);
}
@ -1089,7 +1090,7 @@
if(titleDiv){
//console.log(currentTarget.height(), titleDiv.height());
var value=currentTarget.height()-titleDiv.height()-parseInt(titleDiv.css('paddingBottom'),10)-parseInt(titleDiv.css('paddingTop'),10);
titleDiv.stop().animate({ 'top': value+'px'}, {duration: 300, easing: 'easeOutQuart'});
titleDiv.stop().animate({'top': value+'px'}, {duration: 300, easing: 'easeOutQuart'});
}
return false;
@ -1109,7 +1110,7 @@
var titleDiv = currentTarget.find("div[data-title='titleDiv']");
if(titleDiv){
titleDiv.stop().animate({ 'top': currentTarget.height()+'px'}, {duration: 300, easing: 'easeOutQuart'});
titleDiv.stop().animate({'top': currentTarget.height()+'px'}, {duration: 300, easing: 'easeOutQuart'});
}
return false;
@ -1142,7 +1143,7 @@
var _item = $(this._thumbHolderArr[this._playlistManager.getCounter()]);
_item.css('cursor', 'pointer');
var titleDiv = _item.find("div[data-title='titleDiv']");
if(titleDiv) titleDiv.stop().animate({ 'top': _item.height()+'px'}, {duration: 500, easing: 'easeOutQuart'});
if(titleDiv) titleDiv.stop().animate({'top': _item.height()+'px'}, {duration: 500, easing: 'easeOutQuart'});
}
},
_disableActiveItem:function () {
@ -1151,7 +1152,7 @@
_item.css('cursor', 'default');
var titleDiv = _item.find("div[data-title='titleDiv']");
var value=_item.height()-titleDiv.height()-parseInt(titleDiv.css('paddingBottom'),10)-parseInt(titleDiv.css('paddingTop'),10);
if(titleDiv) titleDiv.stop().animate({ 'top': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
if(titleDiv) titleDiv.stop().animate({'top': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
},
_clickControls:function (e) {
if(!this._componentInited) return;
@ -1250,24 +1251,24 @@
if(this._thumbOrientation == 'horizontal'){
value=this._thumbInnerContainerStartBuffer + this._finalThumbHeight + this._thumbInnerContainerStartBuffer;
if(on){
this.thumbHolder.stop().animate({ 'height': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbBackward.stop().animate({ 'height': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbForward.stop().animate({ 'height': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbHolder.stop().animate({'height': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbBackward.stop().animate({'height': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbForward.stop().animate({'height': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
}else{
this.thumbHolder.stop().animate({ 'height': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbBackward.stop().animate({ 'height': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbForward.stop().animate({ 'height': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbHolder.stop().animate({'height': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbBackward.stop().animate({'height': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbForward.stop().animate({'height': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
}
}else{
value=this._thumbInnerContainerStartBuffer + this._thumbWidth + this._thumbInnerContainerStartBuffer;
if(on){
this.thumbHolder.stop().animate({ 'width': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbBackward.stop().animate({ 'width': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbForward.stop().animate({ 'width': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbHolder.stop().animate({'width': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbBackward.stop().animate({'width': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbForward.stop().animate({'width': value+'px'}, {duration: 500, easing: 'easeOutQuart'});
}else{
this.thumbHolder.stop().animate({ 'width': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbBackward.stop().animate({ 'width': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbForward.stop().animate({ 'width': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbHolder.stop().animate({'width': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbBackward.stop().animate({'width': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.thumbForward.stop().animate({'width': 0+'px'}, {duration: 500, easing: 'easeOutQuart'});
}
}
},
@ -1282,13 +1283,13 @@
}
if(this._animateVideoSizeOnPlaylistClose){
if(this._thumbOrientation=='horizontal'){
this.mediaWrapper.stop().animate({ 'height': this._getComponentSize('h')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.youtubeHolder.stop().animate({ 'height': this._getComponentSize('h')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.vimeoHolder.stop().animate({ 'height': this._getComponentSize('h')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.mediaWrapper.stop().animate({'height': this._getComponentSize('h')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.youtubeHolder.stop().animate({'height': this._getComponentSize('h')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.vimeoHolder.stop().animate({'height': this._getComponentSize('h')+'px'}, {duration: 500, easing: 'easeOutQuart'});
}else{
this.mediaWrapper.stop().animate({ 'width': this._getComponentSize('w')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.youtubeHolder.stop().animate({ 'width': this._getComponentSize('w')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.vimeoHolder.stop().animate({ 'width': this._getComponentSize('w')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.mediaWrapper.stop().animate({'width': this._getComponentSize('w')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.youtubeHolder.stop().animate({'width': this._getComponentSize('w')+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.vimeoHolder.stop().animate({'width': this._getComponentSize('w')+'px'}, {duration: 500, easing: 'easeOutQuart'});
}
}
} else{
@ -1307,18 +1308,18 @@
}else{
pval = this._getComponentSize('h') - this._finalThumbHeight - 2 * parseInt(this.thumbInnerContainer.css('top'),10);
}
this.mediaWrapper.stop().animate({ 'height': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.youtubeHolder.stop().animate({ 'height': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.vimeoHolder.stop().animate({ 'height': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.mediaWrapper.stop().animate({'height': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.youtubeHolder.stop().animate({'height': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.vimeoHolder.stop().animate({'height': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
}else{
if(this._playlistOutside){
pval = this._getComponentSize('w') - this.settings.playlistOutside.playlistSize;
}else{
pval = this._getComponentSize('w') - this._thumbWidth - 2 * parseInt(this.thumbInnerContainer.css('left'),10);
}
this.mediaWrapper.stop().animate({ 'width': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.youtubeHolder.stop().animate({ 'width': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.vimeoHolder.stop().animate({ 'width': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.mediaWrapper.stop().animate({'width': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.youtubeHolder.stop().animate({'width': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
this.vimeoHolder.stop().animate({'width': pval+'px'}, {duration: 500, easing: 'easeOutQuart'});
}
}
}
@ -1479,7 +1480,7 @@
'user-select':'none'
})
.each(function() {
this.onselectstart = function() { return false; };
this.onselectstart = function() {return false;};
});
});
},
@ -1648,7 +1649,7 @@
/*this.autoPlay: true/false (video autoplay) */
autoPlay:true,
/* this.loopingOn: loop playlist on end, true/false */
loopingOn:true,
loopingOn:false,
/* this.randomPlay: random play in playlist, true/false */
randomPlay:false,
/*autoAdvanceToNextVideo: true/false */

File diff suppressed because one or more lines are too long