调整语音播放
This commit is contained in:
@@ -26,14 +26,39 @@
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
audioContextPaused: true
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
// 播放语音消息
|
||||
onPlayMsg() {
|
||||
|
||||
console.log(this.msg.remote)
|
||||
|
||||
uni.downloadFile({
|
||||
url: this.msg.remote,
|
||||
success: res=> {
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
let innerAudioContext = uni.createInnerAudioContext()
|
||||
innerAudioContext.src = this.audioSrc
|
||||
innerAudioContext.src = ""
|
||||
if (this.audioContextPaused) {
|
||||
innerAudioContext.play()
|
||||
this.audioContextPaused = false
|
||||
|
||||
innerAudioContext.onPlay(res => {
|
||||
console.log('开始播放')
|
||||
})
|
||||
|
||||
innerAudioContext.onError(err => {
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
innerAudioContext.stop()
|
||||
|
||||
Reference in New Issue
Block a user