May 18, 2021 WeChat Mini Program Development Document
Starting with base library 1.6.0, this interface is no 10th stop maintenance, please use wx.createInnerAudioContext instead
Pause the voice you're playing. W hen you call wx.playVoice again to play the same file, playback starts at the pause. If you want to play from scratch, you need to call wx.stopVoice first.
Property | Type | The default | Required | Description |
---|---|---|---|---|
success | function | Whether | The interface calls a successful callback function | |
fail | function | Whether | The interface calls the failed callback function | |
complete | function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
wx.startRecord({
success (res) {
const tempFilePath = res.tempFilePath
wx.playVoice({
filePath: tempFilePath
})
setTimeout(() => { wx.pauseVoice() }, 5000)
}
})