# wx.playVoice(Object object)

From base library 1.6.0 Start, this interface stops maintenance, please use wx.createInnerAudioContext replace

with Promise style call: Supported

Mini Program plugin: Support, need to Mini Program base library version no less than 1.9.6

Start playing the voice. At the same time only allows a voice file is playing, if the previous voice file has not played over, will interrupt a previous voice playback.

# parameter

# Object object

attribute type Default values Required Introductions Minimum version
filePath string yes File path of the voice file to be played (Local path)
duration number 60 no Specify the playing time, after the specified playing time will automatically stop playing, unit: seconds 1.6.0
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

# sample code

wx.startRecord({
  success (res) {
    const tempFilePath = res.tempFilePath
    wx.playVoice({
      filePath: tempFilePath,
      complete () { }
    })
  }
})