startAudioRecording(params: Object)

Requires:
WearKit≥1.3.0@ray-js/ray≥1.7.82
Platforms:
iOSAndroid
import { wear } from '@ray-js/ray';

const { startAudioRecording } = wear;

// Promise usage
try {
  const res = await startAudioRecording({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Start recording with transcription (new), supports input source and business mode parameters.

Parameters

PropertyTypeRequiredDescription
deviceIdstringYesDevice ID
YesConfiguration
complete() => voidNoCompletion callback (executed on both success and failure)
success(params: Object) => voidNoCallback on successful API call
fail(params: Object) => voidNoFailure callback
success callback parameters
PropertyTypeDescriptionWearKit Since
Recording task informationv3.0.0
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Error Code

Error CodeError Message
10001Internal error
10002Device PID is not associated with an Agent
10021Timeout
10041Operation error
10042Already in started state
10046Request already in progress
10047Device is already recording
10061Device error
10062Device does not support the recording control dpCode
10063DP value error
10064Device not fully connected
10071Audio format error
10073Audio engine initialization failed
10081Payment required
10082Bluetooth connection error
10083Device offline

Examples

Basic usage

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

wear.startAudioRecording({
  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('startAudioRecording success');
  },
  fail: error => {
    console.error(error);
  },
});