fixed random player
This commit is contained in:
@@ -884,6 +884,8 @@
|
||||
this.currentHistoricIndex = historic_index;
|
||||
}
|
||||
|
||||
// TODO: stop random player if playing from studio
|
||||
|
||||
this.emmit('audio-open-document', {caller:caller});
|
||||
|
||||
|
||||
@@ -1126,17 +1128,19 @@
|
||||
return this;
|
||||
},
|
||||
emmit(event_name, args){
|
||||
console.log('AudioPlayer emmit() event_name', event_name);
|
||||
console.log('AudioPlayer emmit() handlers', this.event_handlers[event_name]);
|
||||
console.log('AudioPlayer emmit()', event_name, args, this.event_handlers[event_name]);
|
||||
// console.log('AudioPlayer emmit() handlers', this.event_handlers[event_name]);
|
||||
var handler;
|
||||
var args = args || {};
|
||||
for (var i = this.event_handlers[event_name].length-1; i >= 0 ; i--) {
|
||||
handler = this.event_handlers[event_name][i];
|
||||
// console.log('AudioPlayer emmit() loop handler', handler);
|
||||
setTimeout(function(){
|
||||
console.log('AudioPlayer emmit() timeout handler', handler);
|
||||
handler(args);
|
||||
}, 0);
|
||||
(function(handler, args){
|
||||
setTimeout(function(){
|
||||
// console.log('AudioPlayer emmit() timeout handler', handler);
|
||||
handler(args);
|
||||
}, 0);
|
||||
}(handler, args));
|
||||
}
|
||||
return this;
|
||||
},
|
||||
@@ -1167,8 +1171,11 @@
|
||||
|
||||
// attach an event on AudioPlayer
|
||||
_audioPlayer
|
||||
.on('audio-ended', this.onAudioPlayerEnded.bind(this))
|
||||
.on('audio-play-next', this.onAudioPlayNext.bind(this))
|
||||
.on('audio-ended', this.onAudioPlayerEnded.bind(this))
|
||||
// .on('audio-ended', function(e){
|
||||
// console.log('RandomPlayer, audio-ended', e);
|
||||
// })
|
||||
.on('stop-shuffle', this.stop.bind(this));
|
||||
|
||||
|
||||
@@ -1226,12 +1233,16 @@
|
||||
_audioPlayer.openDocument(this.shuffledPlaylist.splice(0,1)[0]);
|
||||
},
|
||||
onAudioPlayNext(){
|
||||
//console.log('RandomPlayer : onAudioPlayNext()');
|
||||
this.next();
|
||||
console.log('RandomPlayer : onAudioPlayNext()');
|
||||
if(this.active){
|
||||
this.next();
|
||||
}
|
||||
},
|
||||
onAudioPlayerEnded(){
|
||||
console.log('RandomPlayer : onAudioPlayerEnded()');
|
||||
this.next();
|
||||
if(this.active){
|
||||
this.next();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1334,7 +1345,9 @@
|
||||
this.paused = false;
|
||||
_audioPlayer.play();
|
||||
}else{
|
||||
_audioPlayer.openDocument(this.playlist[this.current_index], this);
|
||||
// _audioPlayer;
|
||||
_audioPlayer.emmit('stop-shuffle').openDocument(this.playlist[this.current_index], this);
|
||||
// TODO: stop random player
|
||||
}
|
||||
this.setActiveItem().showHideControls();
|
||||
},
|
||||
@@ -1460,7 +1473,9 @@
|
||||
}
|
||||
},
|
||||
onAudioPlayerEnded(){
|
||||
this.next();
|
||||
if(this.playing){
|
||||
this.next();
|
||||
}
|
||||
},
|
||||
// onAudioPlayNext(){
|
||||
// this.next();
|
||||
|
||||
Reference in New Issue
Block a user