xzw 3 年之前
父节点
当前提交
307a65a961
共有 2 个文件被更改,包括 28 次插入14 次删除
  1. 4 3
      SuperTwo762/js/main_2020_show.js
  2. 24 11
      SuperTwo762/js/overlay.js

+ 4 - 3
SuperTwo762/js/main_2020_show.js

@@ -18508,11 +18508,12 @@ window.Modernizr = function(n, e, t) {
                   
                 
                 overlays && overlays.forEach((info)=>{ 
+                    //if(info.file.includes('20210312_112357584.mp4') /* || info.animateInfo */ )return;
                     new Overlay(info)  
                 })
                 
-                
-                Overlay.load()
+                setTimeout(Overlay.load, 300)
+                 
             }
             
                 
@@ -23096,7 +23097,7 @@ window.Modernizr = function(n, e, t) {
                         for(var i in this.model.hots){
                             this.model.hots[i].update(this.camera)
                         } 
-                        if(this.mode == 'panorama')this.overlayGroup.children.forEach(overlay=>{
+                        this.overlayGroup.children.forEach(overlay=>{
                             overlay.update()
                         })
                         

+ 24 - 11
SuperTwo762/js/overlay.js

@@ -60,8 +60,8 @@ var initOverlay = function(THREE) {
         if (info.media) {
             if (info.media.includes('video')) { 
                 //var id = "video"+ this.sid    id="${ id }"
-                var video = $(`<video  controls="controls" loop autoplay x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload"></video>`)[0]
-                 
+                var video = $(`<video  controls="controls" loop  x5-playsinline="" webkit-playsinline="true" playsinline="true" controlslist="nodownload"></video>`)[0]
+                 //autoplay
                 video.setAttribute("crossOrigin", 'Anonymous')
                 //要在src设置好前解决跨域
                 $(video).on('contextmenu', function() {
@@ -78,9 +78,9 @@ var initOverlay = function(THREE) {
                 }) */
                 
                 video.oncanplaythrough = function() {
-                    plane.material.map.needsUpdate = !0
+                    //plane.material.map.needsUpdate = !0
                    
-                    video.play()
+                    //video.play()
                         
                      
                 }
@@ -335,7 +335,7 @@ var initOverlay = function(THREE) {
             return true
         }
         
-        this.visible = visibility != void 0 ? visibility : !!panos.find(pano=>this.visiblePanos.includes(pano))
+        this.visible_ = this.visible = visibility != void 0 ? visibility : !!panos.find(pano=>this.visiblePanos.includes(pano))
         
         if (this.overlayType == 'video'){
             //this.switchPlay(this.visible,  this.visible ? null : 'stop' );//可见时不操作;不可见时停止
@@ -378,16 +378,22 @@ var initOverlay = function(THREE) {
         if(this.overlayType != "video")return
         var video = this.plane.material.map.image
         if(!state || state == 'stop'){
-            video.paused || video.pause()
+            if(!video.paused){
+                video.pause()
+                video.src = '';
+            } 
             if(state == 'stop'){
-                video.currentTime = 0;
-               
-            }
-             
+                video.currentTime = 0; 
+            } 
+            
             //console.log("pause")
         }else if(state){ 
-            video.paused && video.play()
+            if(video.paused){
+                video.src = this.fileSrc
+                video.play()
+            }
              
+            
             //console.log("play")
         }
     }     
@@ -421,6 +427,13 @@ var initOverlay = function(THREE) {
     }
     
     Overlay.prototype.update = function(){//实时监测播放
+    
+        if(this.visible_){
+            this.visible = this.position.distanceTo(player.position) < 8
+        }
+        
+         
+    
         if(this.overlayType == "video"){
             if(this.visible && !this.pausedByUser && this.inSight()){
                 this.videoControl(true)