1***@qq.com
1***@qq.com
  • 发布:2022-05-06 22:54
  • 更新:2022-07-05 17:39
  • 阅读:446

uni.getBackgroundAudioManager() 设置src不播放

分类:uni-app

uni.getBackgroundAudioManager() 设置完src在微信小程序不播放

         mounted() {  
                //初始化音频实例  
                this.audioApply = uni.getBackgroundAudioManager()  
                    setTimeout(() => {  
                      this.initAudioUrl()  
                    }, 400);   
        },  
     methods:{  
         // 初始化音频url  
            initAudioUrl(){  
                console.log('初始化')  
                this.audioApply.src = this.article_detail.a_bg_music  
                console.log('初始化',this.audioApply.src)  
                this.playing = true  
                if(!this.is_ios) {  
                    console.log('调用播放')  
                    this.audioApply.play()  
                }  
            },  
     }

设置完src还是没有反应,打印对象发现对象的src还是undefined

2022-05-06 22:54 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com (作者) - web前端

打印结果如下

1***@qq.com

1***@qq.com

记得给title什么的,不然无法触发播放条件可以试试给个死的title

要回复问题请先登录注册