Skip to content

创建录音器

说明

SDK内置录音器,可通过构造器自由创建和使用,构造器支持设置采样率、录音源等相关参数

方法名

createAudioRecorder

用法

  • 用法如下:
    js
    module.createAudioRecorder({
      params: {
        },
      complete: (res) => {
        // console.log(res)
      }
    })
    js
    module.createAvatarParams({
      params: {
        },
      complete: (res : LevenResult) => {
        console.log(res)
      }
    } as LevenOptions)
  • 参数说明
    参数名参数类型是否必填默认值参数描述
    paramsObject接口请求参数
    params.isFullDuplexBoolean是否为全双工交互,为true时采用MediaRecorder.AudioSource.VOICE_COMMUNICATION,false时采用MediaRecorder.AudioSource.MIC
    params.sampleRateInteger16000采样率
    params.volumeInteger音量
    params.videoWidthInteger视频宽度
    params.videoHeightInteger视频高度
    params.receivedAudioBoolean官方文档未做说明
    params.selfRenderBoolean官方文档未做说明
    params.reuseRenderViewBoolean官方文档未做说明
    params.renderTimeoutInteger录音超时时长,单位:毫秒
    params.audioRaiseFloat官方文档未做说明
    params.playOptimizeBoolean官方文档未做说明
    params.probeSizeInteger官方文档未做说明
    params.openMediaCodeBoolean官方文档未做说明
    params.centerInParentBoolean官方文档未做说明
    params.bgAlphaBoolean官方文档未做说明
    params.alphaRenderModeString官方文档未做说明,可选值:V1 V2 V3
    successFunction执行成功的函数
    failFunction执行失败的函数
    completeFunction执行完成的函数,不管成功还是失败都会执行

回调

  • 示例
    json
    {
      "data": {},
      "message": "",
      "code": 0
    }
  • 回调说明:
    参数名参数类型参数描述
    messageString消息提示
    dataObject数据对象
    codeInteger返回类型,0.成功,其他:失败