瀏覽代碼

fix: bg播放按钮问题

xzw 2 年之前
父節點
當前提交
4e774d7864
共有 2 個文件被更改,包括 8 次插入7 次删除
  1. 1 1
      js/Hot.js
  2. 7 6
      js/manage.js

+ 1 - 1
js/Hot.js

@@ -1133,7 +1133,7 @@ window.initHot = function(model){
                 
                 (pano)=>{ // add
                     // 周恩光改 解决visiblePanos为undefined时的bug
-                    return this.info.visiblePanos && this.info.visiblePanos.includes(pano.id)
+                    return !this.info.visiblePanos || this.info.visiblePanos.includes(pano.id)
                 }    
             )
             n.push(

+ 7 - 6
js/manage.js

@@ -886,9 +886,7 @@ Manage.prototype.dealURL = function(src, type){
         if(index>-1){
             var wholeOldPrefix = src.slice(0, index+oldPrefix.length);
             return src.replace(wholeOldPrefix, settings.localPrefix)
-        }
-        
-        console.error("没有找到合适的本地链接") 
+        }else console.error("没有找到合适的本地链接") 
         return src
     }else{
         //add https://
@@ -1648,7 +1646,7 @@ var SoundManager = {//暂不支持同时播放
             if(object.audio && object.src){
                 object.audio.load();	// iOS 9   还需要额外的 load 一下, 否则直接 play 无效 *///https://www.cnblogs.com/interdrp/p/4211883.html   部分资料
                 object.audio.play();
-                object.callback && object.callback(true)
+                object.audio.paused || object.callback && object.callback(true)
                 Log(name + '  播放 '  )
             }
             
@@ -1733,8 +1731,11 @@ var SoundManager = {//暂不支持同时播放
      
     
         let play = function(){  
-            if(this.currentAudio && this.currentAudio.audio && this.currentAudio.src){
-                this.currentAudio.audio.play() 
+            if (this.currentAudio && this.currentAudio.audio && this.currentAudio.src && this.currentAudio.audio.paused ) {
+                this.currentAudio.audio.play() //一般触屏了都会播放成功,就不识别paused了
+                 
+                this.currentAudio.callback && this.currentAudio.callback(true)
+                
                 Log(`${this.currentAudio.name} 自动播放成功`) //即使设置src在这之后好像也能成功播放
             }else{