interface.uts 1.4 KB
export type PcmFrameResult = {
	base64 : string
	byteLength : number
	seq : number
	timestamp : number
	sampleRate : number
	channels : number
	bitDepth : number
}

export type StartPcmCaptureSuccess = {
	errMsg : string
}

export type StopPcmCaptureSuccess = {
	errMsg : string
}

export type PcmCaptureErrorCode = 1400001 | 1400002 | 1400003

export interface PcmCaptureFail extends IUniError {
	errCode : PcmCaptureErrorCode
}

export type PcmCaptureFailCallback = (err : PcmCaptureFail) => void
export type StartPcmCaptureSuccessCallback = (res : StartPcmCaptureSuccess) => void
export type StopPcmCaptureSuccessCallback = (res : StopPcmCaptureSuccess) => void
export type PcmCaptureCompleteCallback = (res : any) => void
export type PcmFrameCallback = (res : PcmFrameResult) => void

export type StartPcmCaptureOptions = {
	sampleRate ?: number
	frameSize ?: number
	success ?: StartPcmCaptureSuccessCallback | null
	fail ?: PcmCaptureFailCallback | null
	complete ?: PcmCaptureCompleteCallback | null
}

export type StopPcmCaptureOptions = {
	success ?: StopPcmCaptureSuccessCallback | null
	fail ?: PcmCaptureFailCallback | null
	complete ?: PcmCaptureCompleteCallback | null
}

export type StartPcmCapture = (options : StartPcmCaptureOptions) => void
export type StopPcmCapture = (options ?: StopPcmCaptureOptions) => void
export type OnPcmFrame = (callback : PcmFrameCallback) => void
export type OffPcmFrame = () => void