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

@ -269,6 +269,7 @@
}); });
$(this._playlistManager).bind('ap_PlaylistManager.PLAYLIST_END', function(){ $(this._playlistManager).bind('ap_PlaylistManager.PLAYLIST_END', function(){
self._disableActiveItem(); self._disableActiveItem();
self.settings.videoGalleryPlaylistEnd.call(self);
}); });
if(this._playlistOutside) this._setComponents(); if(this._playlistOutside) this._setComponents();
@ -1648,7 +1649,7 @@
/*this.autoPlay: true/false (video autoplay) */ /*this.autoPlay: true/false (video autoplay) */
autoPlay:true, autoPlay:true,
/* this.loopingOn: loop playlist on end, true/false */ /* this.loopingOn: loop playlist on end, true/false */
loopingOn:true, loopingOn:false,
/* this.randomPlay: random play in playlist, true/false */ /* this.randomPlay: random play in playlist, true/false */
randomPlay:false, randomPlay:false,
/*autoAdvanceToNextVideo: true/false */ /*autoAdvanceToNextVideo: true/false */

File diff suppressed because one or more lines are too long