- BackgroundAudioManager.play无效
- 当前 Bug 的表现(可附上截图) playAudio() { au = wx.getBackgroundAudioManager(); au.title = 'bb'; au.src = this.data.audioUrl; }, playAudioTap1() { au.title = 'cc'; au.play(); }, - 预期表现 - 复现路径 - 提供一个最简复现 Demo
2019-01-23 - 微信7.0安卓版backgorund audio api问题
- 当前 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() },
2019-01-02 - 使用getBackgroundAudioManager,发现有MP3无法播放
- 当前 Bug 的表现(可附上截图) 1、音频文件在本地或其他播放器中正常。但有的在小程序中播放不了。例如: https://cms.hanzhigu.com/upload/audio/info/20190111/beb52979-2e0e-44c8-9d2e-dface3aa832b.mp3 2、在小程序中使用的组件是wx.getBackgroundAudioManager,上面这个音频放不了。 3、我把小程序官方提供的音频代码中SRC修改为这个,也播放不了,界面如下图,一动不动。也无错误打印信息。 使用背景播放器 [图片] - 预期表现 希望能正常播放所有的mp3文件或者支持的音频格式文件。而不是有的能播放,有的不能播放(都是MP3) - 复现路径 - 提供一个最简复现 Demo /*JS文件====================================================*/ const audioManager = wx.getBackgroundAudioManager(); //打开这个注释的mp3源,就可以播放 const dataUrl = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' //使用下面这个播放源就无法播放。两个音频文件在浏览器中或其他本地都能正常播放 //const dataUrl = "https://cms.hanzhigu.com//upload/audio/info/20190111/beb52979-2e0e-44c8-9d2e-dface3aa832b.mp3 Page({ onShareAppMessage() { return { title: '背景音乐', path: 'page/API/pages/background-audio/background-audio' } }, onLoad() { this._enableInterval() if (app.globalData.backgroundAudioPlaying) { this.setData({ playing: true }) } }, data: { playing: false, playTime: 0, formatedPlayTime: '00:00:00' }, play() { const that = this audioManager.title = '这是测试'; audioManager.epname = '此时此刻'; audioManager.singer = 'XXX'; audioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000', audioManager.src = dataUrl; that.setData({ playing: true }); this._enableInterval() app.globalData.backgroundAudioPlaying = true }, seek(e) { clearInterval(this.updateInterval) const that = this audioManager.seek(e.detail.value); setTimeout(function() { that._enableInterval() }, 2000) }, pause() { const that = this audioManager.pause(); that.setData({ playing: false }); app.globalData.backgroundAudioPlaying = false }, stop() { const that = this audioManager.stop(); that.setData({ playing: false }); app.globalData.backgroundAudioPlaying = false }, _enableInterval() { const that = this function update() { that.setData({ playTime: parseInt(audioManager.currentTime), formatedPlayTime: util.formatTime(audioManager.currentTime + 1) }) } update() this.updateInterval = setInterval(update, 500) }, onUnload() { clearInterval(this.updateInterval) } }) /*WXML-----------------------------------------------*/ <view class="container"> <template is="head" data="{{title: 'backgroundAudio'}}"/> <view class="page-section"> <view class="page-body-info"> <text class="time-big">{{formatedPlayTime}}</text> <slider class="slider" min="0" max="1777" step="1" value="{{playTime}}" bindchange="seek"></slider> <view class="play-time"> <text>00:00</text> <text>29:37</text> </view> </view> <view class="page-body-text tc">注意:离开当前页面后背景音乐将保持播放,但退出小程序将停止</view> <view class="page-body-buttons"> <block wx:if="{{playing === true}}"> <view class="page-body-button" bindtap="stop"> <image src="/image/stop.png"></image> </view> <view class="page-body-button" bindtap="pause"> <image src="/image/pause.png"></image> </view> </block> <block wx:if="{{playing === false}}"> <view class="page-body-button"></view> <view class="page-body-button" bindtap="play"> <image src="/image/play.png"></image> </view> </block> <view class="page-body-button"></view> </view> </view> <template is="foot" /> </view> /*wxss------------------------------------*/ image { width: 150rpx; height: 150rpx; } .page-body-wrapper { margin-top: 0; } .page-body-info { padding-bottom: 50rpx; } .time-big { font-size: 60rpx; margin: 20rpx; } .slider { width: 650rpx; } .play-time { font-size: 28rpx; width: 700rpx; padding: 20rpx 0; display: flex; justify-content: space-between; box-sizing: border-box; } .page-body-buttons { display: flex; justify-content: space-around; margin-top: 100rpx; } .page-body-button { width: 250rpx; text-align: center; }
2019-01-11 - 后台播放器在android上偶然播放失败
调用后台播放器播放音频偶然会返回 播放器错误:errCode:67 decode audio fail 重试后又可以了 请问这可能是什么原因引起的?如何解决谢谢
2018-07-31