startRecordAudio 开启麦克风录音

startRecordAudio ^4.4.0

开启麦克风录音,可以保存录音文件或者把声音转换成文字

#请求参数

Prop Type Required Default Description
param Object Y {} 属性: max:{ Type: Number, Default: 10, Description: 最长录音时间,默认 10 秒 } 属性: isSave:{ Type: Boolean, Default: true/false, Description: true/false(是否保存语音录音文件) } isTransform:{ Type: Boolean, Default: true/false, Description: true/false(是否需要转换语音成文字) } 请求参数

#接口调用示例

this.$bridge
    .startRecordAudio(params)
    .then(res => {    
    this.$alert(res)
    })
    .catch(err => {
    this.$toast(err)
    })
  • 注:当最大录音时间到达后,APP 通过globalEventreceiveMessageFromApp)通知 weex 页面
    返回结果:见附表2

附表2:监听receiveMessageFromApp

Prop Type Default Description
messageType String N/A H5用来判断消息类型,然后做相对应的处理
messageBody Object N/A 录音返回的结果 同stopRecordAudio接口返回

#返回参数

  • 成功时返回
Prop Type Description
status Number 0 开始录音成功
  • 失败时返回
Prop Type Description
errorCode Number -1 麦克风权限失败
posted on 2024-12-17 09:28  AtlasLapetos  阅读(22)  评论(0)    收藏  举报