|
@@ -814,15 +814,26 @@
|
|
|
if($link.is('.audio-link')){
|
|
|
// check if caller is lastdocs block
|
|
|
caller = $link.parents('.lastdocs, .lastdocs-home').length ? 'lastdocs' : null;
|
|
|
+ // check if caller is studio composition
|
|
|
+ if(!caller){
|
|
|
+ caller = $link.parents('#studio-ui').length ? 'studio-compo' : null;
|
|
|
+ }
|
|
|
// open audio player
|
|
|
- _audioPlayer
|
|
|
- .emmit('stop-shuffle')
|
|
|
- .openDocument({
|
|
|
- nid:$link.attr('nid'),
|
|
|
- audio_url:$link.attr('audio_url'),
|
|
|
- title:$link.find('.field--name-title').html()
|
|
|
- },
|
|
|
- caller);
|
|
|
+ if(caller == 'studio-compo'){
|
|
|
+ var index = $link.parents('.field__item').index();
|
|
|
+ console.log('audio link caller', caller, index);
|
|
|
+ // _compoPlayer.setIndex(index);
|
|
|
+ _compoPlayer.start(index);
|
|
|
+ }else{
|
|
|
+ _audioPlayer
|
|
|
+ .emmit('stop-shuffle')
|
|
|
+ .openDocument({
|
|
|
+ nid:$link.attr('nid'),
|
|
|
+ audio_url:$link.attr('audio_url'),
|
|
|
+ title:$link.find('.field--name-title').html()
|
|
|
+ },
|
|
|
+ caller);
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -1065,6 +1076,7 @@
|
|
|
|
|
|
// if we don't come from history popstate
|
|
|
if(typeof caller == 'undefined' || caller != 'popstate'){
|
|
|
+ console.log('');
|
|
|
this.historic.push(node);
|
|
|
this.currentHistoricIndex = this.historic.length-1;
|
|
|
// this.shuffle_mode = shuffle_mode || false;
|
|
@@ -1567,7 +1579,7 @@
|
|
|
// this.newCompo();
|
|
|
},
|
|
|
newCompo(){
|
|
|
- //console.log('CompoPlayer newCompo()');
|
|
|
+ console.log('CompoPlayer newCompo()');
|
|
|
// this.$compo = $('.composition_ui .composer .composition');
|
|
|
this.initControls();
|
|
|
},
|
|
@@ -1589,11 +1601,11 @@
|
|
|
|
|
|
this.$controls.addClass('ready');
|
|
|
|
|
|
- this.refresh();
|
|
|
|
|
|
this.active = true;
|
|
|
// this.newCompo();
|
|
|
}
|
|
|
+ this.refresh();
|
|
|
},
|
|
|
refresh(){
|
|
|
// console.log('CompoPlayer refresh(), this', this);
|
|
@@ -1624,21 +1636,23 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- start(){
|
|
|
+ start(i){
|
|
|
//console.log('start');
|
|
|
// console.log('CompoPlayer start()');
|
|
|
+ this.current_index = i || 0;
|
|
|
this.playing = true;
|
|
|
this.play();
|
|
|
},
|
|
|
play(){
|
|
|
- // console.log('play');
|
|
|
+ console.log('CompoPlayer play()', this.playlist[this.current_index]);
|
|
|
if(this.paused){
|
|
|
this.paused = false;
|
|
|
_audioPlayer.play();
|
|
|
}else{
|
|
|
+ console.log('CompoPlayer opendoc with audio player');
|
|
|
// _audioPlayer;
|
|
|
_audioPlayer.emmit('stop-shuffle').openDocument(this.playlist[this.current_index], this);
|
|
|
- // TODO: stop random player
|
|
|
+
|
|
|
}
|
|
|
this.setActiveItem().showHideControls();
|
|
|
},
|
|
@@ -1649,7 +1663,7 @@
|
|
|
_audioPlayer.stop();
|
|
|
},
|
|
|
next(){
|
|
|
- // console.log('CompoPlayer next()');
|
|
|
+ console.log('CompoPlayer next()',this.playing);
|
|
|
if(this.playing){
|
|
|
this.current_index += 1;
|
|
|
if(this.current_index < this.playlist.length){
|
|
@@ -1743,6 +1757,7 @@
|
|
|
},
|
|
|
// _audioPlayer events
|
|
|
onAudioOpenDocument(args){
|
|
|
+ console.log('Compo player onAudioOpenDocument', args);
|
|
|
if(args.caller !== this){
|
|
|
// console.log('CompoPlayer onAudioOpenDocument() called by other');
|
|
|
this.reset();
|
|
@@ -1764,7 +1779,10 @@
|
|
|
}
|
|
|
},
|
|
|
onAudioPlayerEnded(){
|
|
|
+ console.log('onAudioPlayerEnded');
|
|
|
if(this.playing){
|
|
|
+ // this paused shoudn't be true but i'm lazzy to find why it is ...
|
|
|
+ this.paused = false;
|
|
|
this.next();
|
|
|
}
|
|
|
},
|