wx.createInnerAudioContext();这个为啥调用不了第二次?
发布于 6 年前 作者 chao24 7262 次浏览 来自 问答

function inner(status) {

if (status == true) {

console.log('开始播放')

debugger

innerAudioContext.loop = true;

innerAudioContext.autoplay = true

innerAudioContext.src = 'https://images.XXXXX.XXX/upload/music/bgmusic.mp3'

innerAudioContext.onPlay(() => {

console.log('开始播放')

})

innerAudioContext.onStop(() => {

console.log('停止')

})

innerAudioContext.onError((res) => {

console.log(res.errMsg)

console.log(res.errCode)

})

} else {

console.log('停止播放或卸载')

innerAudioContext.destroy()

}

}


back() {

inner(false)

wx.closeSocket()

if (wx.getStorageSync('webscoket') == true) {

wx.setStorageSync('webscoket', false)

}

wx.navigateBack({

delta: 1

})

clearInterval(this.data.setTimer)

},

onload(){

inner(true)

}

第一次进入的情况下可以进行播放和卸载.但是第二次进入继续播放着没有了声音

1 回复

你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

回到顶部