楼主解决了吗,我遇到相同的问题。安卓不能循环播放,以及大概率不能播放(进去响了一声就停止了),ios正常,也能循环播放,代码如下: const backgroundAudioManager = wx.getBackgroundAudioManager() backgroundAudioManager.title = 'Hope'; backgroundAudioManager.epname = 'Hope'; backgroundAudioManager.singer = 'Luke Barker/Anders Baldwin/Brady Hoffman/Ruby Terry'; backgroundAudioManager.coverImg = 'cloud://lac-fgwl5.6c61-lac-fgwl5-1301744280/Hope.jpg'; // 设置了 src 之后会自动播放 backgroundAudioManager.src = 'cloud://lac-fgwl5.6c61-lac-fgwl5-1301744280/Hope.mp3'; backgroundAudioManager.play(); backgroundAudioManager.onError(function(res) { console.log('backgroundAudioManager.onError', res); backgroundAudioManager.stop(); backgroundAudioManager.title = 'Hope'; backgroundAudioManager.epname = 'Hope'; backgroundAudioManager.singer = 'Luke Barker/Anders Baldwin/Brady Hoffman/Ruby Terry'; backgroundAudioManager.coverImg = 'cloud://lac-fgwl5.6c61-lac-fgwl5-1301744280/Hope.jpg'; // 设置了 src 之后会自动播放 backgroundAudioManager.src = 'cloud://lac-fgwl5.6c61-lac-fgwl5-1301744280/Hope.mp3'; backgroundAudioManager.play(); }); backgroundAudioManager.onPlay(() => { console.log("音乐播放开始"); }) backgroundAudioManager.onEnded(() => { //backgroundAudioManager.stop(); backgroundAudioManager.src = 'cloud://lac-fgwl5.6c61-lac-fgwl5-1301744280/Hope.mp3'; backgroundAudioManager.play(); console.log("音乐播放结束"); }) backgroundAudioManager.onStop(() => { //backgroundAudioManager.stop(); backgroundAudioManager.src = 'cloud://lac-fgwl5.6c61-lac-fgwl5-1301744280/Hope.mp3'; backgroundAudioManager.play(); console.log("音乐播放结束"); })
getBackgroundAudioManager 在安卓上播放 异常播放10几秒后 onTimeUpdate 时长和 当前时间 为0[图片]
2020-04-03