- 当前 Bug 的表现
在锁屏或退到后台后,当背景音频播放结束后,微信7.0安卓版不会触发BackgroundAudioManager的onEnded事件,而在旧版本和iOS中均无此问题
- 预期表现
在锁屏或退到后台后,当背景音频播放结束后,微信7.0安卓版也能触发BackgroundAudioManager的onEnded事件,并能进行音频切换操作
- 复现路径
锁屏或者按home后,onEnded事件在音频结束后不触发(仅在7.0.0安卓版微信中发生)
- 提供一个最简复现 Demo
test page
onReady: function () {
this.bindMusicEvent()
this.rePlay()
},
bindMusicEvent() {
const audioManager = wx.getBackgroundAudioManager()
audioManager.onEnded(() => {
console.log(‘music onEnded’)
this.rePlay()
})
},
rePlay() {
const audioManager = wx.getBackgroundAudioManager()
audioManager.stop()
audioManager.src = ‘https://res.psy-1.com/cosleep/miniapp/breath/start3s.m4a’
audioManager.title = ‘测试’
audioManager.epname = ‘测试’
audioManager.singer = ‘’
audioManager.coverImgUrl = ‘https://res.psy-1.com/miniapp/xiaoshuimian_logo_screen.png’
audioManager.seek(0)
audioManager.play()
},