xzw 3 лет назад
Родитель
Сommit
0a841d453d
3 измененных файлов с 26 добавлено и 9 удалено
  1. 19 4
      SuperTwo762/js/main_2020_show.js
  2. 6 4
      SuperTwo762/js/manage.js
  3. 1 1
      SuperTwo762/js/overlay.js

+ 19 - 4
SuperTwo762/js/main_2020_show.js

@@ -529,7 +529,7 @@ var addSoundBtn = function(video){
     
 } 
 var SoundOnVideo;
-var switchSoundBtn = function(video){
+var switchSoundBtn = function(video, belong){
     if(video.btn.material == soundOffMat){ //开启
         if(SoundOnVideo){
             SoundOnVideo.btn.material = soundOffMat,
@@ -549,6 +549,16 @@ var switchSoundBtn = function(video){
         if(g_tourAudio)g_tourAudio.pause()
         SoundOnVideo = video
         video.pauseByHot = video.pauseByTour = false
+        
+        if(belong instanceof Overlay){
+            belong.switchPlay(true)
+        }else{
+            video.play()
+        }           
+        
+        
+        
+        
     }else{//关闭
         video.btn.material = soundOffMat
         video.volume = 0
@@ -557,6 +567,9 @@ var switchSoundBtn = function(video){
         if(g_bgAudio && g_bgAudio.pauseByVideo && !video.pauseByHot && !video.pauseByTour){
             manage.switchBgmState(true)
         }
+        
+        
+        
     }
     
     
@@ -565,7 +578,7 @@ var switchSoundBtn = function(video){
 
 var checkSoundBtnClick = function(intersect){
     if(intersect && intersect.object.name == "soundBtn"){
-        switchSoundBtn(intersect.object.video);
+        switchSoundBtn(intersect.object.video, intersect.object.parent);
         return true
     } 
 }
@@ -23433,8 +23446,10 @@ window.Modernizr = function(n, e, t) {
                  
                 
                 if(overlay.overlayType == "video"){
-                    if(plane.material.map.image.paused) plane.material.map.image.play()
-                    else plane.material.map.image.pause()
+                    /* if(plane.material.map.image.paused) plane.material.map.image.play()
+                    else plane.material.map.image.pause() */
+                
+                    overlay.switchPlay(!!overlay.pausedByUser)
                 }
                 
                /*  if(window.EditOverlay &&EditOverlay.editing){

+ 6 - 4
SuperTwo762/js/manage.js

@@ -115,9 +115,10 @@ Manage.prototype.loadAudio = function() { //相关:g_tourAudio \  g_playAudio
     g_bgAudio.load();	// iOS 9   还需要额外的 load 一下, 否则直接 play 无效
     var play = function(){
         //if(window.tourAudioSta) return;
+        if(this.bgmShouldPlay){
+            this.switchBgmState(true)
+        }            
          
-        this.switchBgmState(true)
-        
         document.removeEventListener("touchstart",play);
         document.removeEventListener("click",play);
         $('#player')[0].removeEventListener("touchstart", play);
@@ -156,8 +157,9 @@ Manage.prototype.loadAudio = function() { //相关:g_tourAudio \  g_playAudio
 }   
 Manage.prototype.switchBgmState = function(state,fun){
     if(!g_bgAudio || !g_bgAudio.src) return;
+    this.bgmShouldPlay = state
     
-    var played = function(){
+    var played = function(){ 
         console.log('begin play bgm '+ g_bgAudio.src);
         g_play = 1; 
         g_playAudio = g_bgAudio;
@@ -173,7 +175,7 @@ Manage.prototype.switchBgmState = function(state,fun){
         $("#volume").attr("title", "打开声音");
     }
     
-    if(state ){
+    if(state ){ 
         g_bgAudio.play(); 
         if(g_bgAudio.paused){
             paused()

+ 1 - 1
SuperTwo762/js/overlay.js

@@ -98,7 +98,7 @@ var initOverlay = function(THREE) {
                 var offsetX = 0.11, offsetY = 0.11; //到右下角的距离,单位m 
                 this.soundBtn.position.set(settings.overlay.width*(0.5-1/info.width*offsetX), -settings.overlay.height*(0.5-1/info.height*offsetY),0.01)
                 
-                
+                plane.material.opacity = 1;
                 
             } else if (info.media.includes('photo')) {
                 /* var img = new Image();