语音合成ios、华为无法播放
使用tts,合成的音频在开发工具可以正常播放,部分安卓机也可以正常播放,但是ios和华为无法播放
使用backgroundAudioManager.onEnded无法进入到方法内部
js代码:
playButton: function () { this .playAudio(0) this .setData({ currentIndex: 0 }) }, pauseButton: function () { wx.pauseBackgroundAudio() }, playAudio: function (e) { var that = this this .createAudio( 'http://dev.hivoice.cn/TTSServlet?text=' + that.data.contentLists[e] + '&voiceName=xiaoli&voicePitch=50&voiceSpeed=50&voiceVolume=50' ) }, createAudio: function (playUrl) { let that = this const backgroundAudioManager = wx.getBackgroundAudioManager() wx.playBackgroundAudio({ dataUrl: playUrl, title: that.data.title }) wx.onBackgroundAudioStop( function () { that.next() }) // backgroundAudioManager.onEnded(()=> { // that.next() // }) }, next: function () { let that = this if (that.data.currentIndex != that.data.maxIndex) { that.setData({ currentIndex: that.data.currentIndex + 1 }) that.playAudio(that.data.currentIndex) } } |