RecorderManager.start

Requires:
BaseKit≥2.3.2
Platforms:
iOSAndroid

Method signature
RecorderManager.start(params: )
Minimum SDK versions
iOSThingSmartBaseKitBizBundle
≥ 5.2.1
Androidcom.thingclips.smart:thingsmart-bizbundle-basekit
≥ 5.2.0

Description

Start recording

Parameters

PropertyTypeRequiredDefaultDescriptionMinimum SDK versions
durationnumberNo60000Recording duration in ms, max 600000 (10 minutes)—
sampleRate8000 | 11025 | 12000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000No8000Sample rate—
numberOfChannels1 | 2No2Number of channels—
encodeBitRatenumberNo48000Encoding bitrate, in bps. Default: 48000—
format"mp3" | "aac" | "wav" | "PCM"No'aac'Audio format—
frameSizenumberYes-Specify frame size in KB. When frameSize is set, after each chunk of the specified size is recorded, a callback returns the recorded file content; if not set, no callbacks are triggered. Currently supports mp3 and pcm only.—
audioSourcestringNo"auto"Specify the audio input source for recording—
complete() => voidNo-Completion callback (executed on both success and failure)—
success(params: Object) => voidNo-Callback on successful API call—
fail(params: Object) => voidNo-Failure callback—
success callback parameters
PropertyTypeDescriptionSinceMinimum SDK versions
tempFilePathstringTemporary path of the recording file (local path)v3.2.6—
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Valid Values

sampleRate
ValueDescriptionSince
8000--
11025--
12000--
16000--
22050--
24000--
32000--
44100--
48000--
numberOfChannels
ValueDescriptionSince
1--
2--
format
ValueDescriptionSince
mp3--
aac--
wav--
PCM--

Examples

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

const manager = await getRecorderManager();

manager.start({
  duration: 60000,
  sampleRate: 8000,
  numberOfChannels: 2,
  encodeBitRate: 48000,
  format: "aac",
  frameSize: 1,
  audioSource: "auto",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});