getBackgroundAudioManager背景音频管理器播放状态返回不对
Bug: getBackgroundAudioManager().paused 播放状态返回不对
复现:IOS 设备播放背景音频后,返回到微信首页,点击上边的背景播放进入播放页面,暂停(会触 onBackgroundAudioPause 事件)后返回到首页(会触发 onBackgroundAudioStop 事件),再次进入小程序获取当前播放状态,getBackgroundAudioManager().paused 结果一直为 0
复现 Demo:
onLoad: function (options) { this .initAudioListener()
onShow(options) { console.log( "page--onShow" ) if (wx.getBackgroundAudioManager()) { console.log( "audioManager.paused" , wx.getBackgroundAudioManager().paused) this .setData({ playing: !wx.getBackgroundAudioManager().paused }) }
initAudioListener() { const that = this ; wx.onBackgroundAudioPlay(res => { console.log( "onBackgroundAudioPlay" , res) that.setData({ playing: true }) }) wx.onBackgroundAudioPause(res => { console.log( "onBackgroundAudioPause" , res) that.setData({ playing: false }) }) wx.onBackgroundAudioStop(res => { console.log( "onBackgroundAudioStop" , res) that.setData({ playing: false }) }) } |
终端类型:iPhone 6s iOS 11.2.1
Android 及 开发工具都存在一些问题,望仔细检漏