- getBackgroundAudioManager在调用stop后重新播放无效
[代码]voice: [代码][代码]function[代码] [代码](event){[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]clearInterval(that.data.times)[代码][代码] [代码][代码]var[代码] [代码]arr = [[代码][代码]'../../image/voice_001.png'[代码][代码], [代码][代码]'../../image/voice_011.png'[代码][代码],[代码][代码]'../../image/voice_01.png'[代码][代码]][代码][代码] [代码] [代码] [代码][代码]const backgroundAudioManager = wx.getBackgroundAudioManager()[代码][代码] [代码][代码]backgroundAudioManager.stop()[代码][代码] [代码][代码]backgroundAudioManager.onStop([代码][代码]function[代码][代码](){[代码][代码] [代码][代码]clearInterval(that.data.times)[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]bigPic: arr[2][代码][代码] [代码][代码]})[代码][代码] [代码][代码]console.log([代码][代码]"播放停止"[代码][代码]);[代码][代码] [代码][代码]})[代码][代码] [代码][代码]backgroundAudioManager.src = event.target.dataset.url [代码][代码]// 设置了 src 之后会自动播放[代码][代码] [代码][代码]backgroundAudioManager.onPlay([代码][代码]function[代码][代码](){[代码][代码] [代码][代码]console.log([代码][代码]"开始播放"[代码][代码])[代码][代码] [代码][代码]util.play(arr, [代码][代码]"bigPic"[代码][代码], [代码][代码]function[代码] [代码](i, time) {[代码] [代码] [代码][代码]that.setData({[代码][代码] [代码][代码]bigPic: arr[i],[代码][代码] [代码][代码]times: time[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]backgroundAudioManager.onEnded([代码][代码]function[代码][代码](){[代码][代码] [代码][代码]clearInterval(that.data.times)[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]bigPic: arr[2][代码][代码] [代码][代码]}) [代码][代码] [代码][代码]console.log([代码][代码]"播放完成"[代码][代码]);[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码]现在是需要做一个点击把之前的播放停止然后重新播放的功能,现在点击之后停止了,但是重新播放无法生效,想知道有什么办法可以让重新播放生效
2018-02-22 - 很多api不支持base64
现在希望能够有某些api,比如downloadFile,saveImageToPhotosAlbum,previewImage能够支持base64,这样可以避免很多因为带宽导致图片传输缓慢,和用户体验不好的问题
2018-01-10