updateParams(params: Object)

版本要求:
WearKit≥1.3.0@ray-js/ray≥1.7.82
支持平台:
iOSAndroid
import { wear } from '@ray-js/ray';

const { updateParams } = wear;

// Promise 调用
try {
  const res = await updateParams({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

描述

更新录音中的参数,支持模式切换与语言动态切换

参数

属性类型必填说明
deviceIdstring是设备id
是配置
complete() => void否接口调用结束的回调函数(调用成功、失败都会执行)
success() => void否接口调用成功的回调函数
fail(params: Object) => void否接口调用失败的回调函数
fail 回调参数
属性类型说明
errorMsgstring错误信息
errorCodestring | number错误码
错误扩展

返回值

无

错误码

错误码错误信息
10001内部错误
10041操作错误
10048设备未在录音中

示例代码

基础用法

import { wear } from '@ray-js/ray'

wear.updateParams({
  deviceId: 'dev',
  config: {
    businessType: 0,
    audioSource: 0,
    audioSourceList: [0],
    recordType: 0,
    f2fChannel: 0,
    needAsr: true,
    needTranslate: false,
    needTts: false,
    needAmplitude: true,
    needAutoRecognize: false,
    originalLanguage: 'zh',
    targetLanguage: 'en',
    startLivingStatus: 0,
    needRealtimeSummary: true,
    needEchoCancel: false,
  },
  success: () => {
    console.log('updateParams success');
  },
  fail: error => {
    console.error(error);
  },
});