소스 검색

compo player improvement, fix #178

Bachir Soussi Chiadmi 4 년 전
부모
커밋
8b4d7ea685

+ 0 - 1
web/modules/custom/edlp_studio/assets/scripts/edlp_studio.js

@@ -95,7 +95,6 @@
       .on('click', onClickDeleteCompoLink)
       .addClass('ajax-enabled');
   };
-
   function initUsedChutierInCompo(){
     console.log('initUsedChutierInCompo');
     $('.chutier-link.on-compo', '#studio-ui .chutier_ui').removeClass('on-compo');

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
web/themes/custom/edlptheme/assets/dist/scripts/main.min.js


+ 32 - 14
web/themes/custom/edlptheme/assets/scripts/main.js

@@ -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();
         }
       },

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.