123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- import 'recorder-core/src/engine/pcm';
- import 'recorder-core/src/engine/wav';
- import 'recorder-core/src/extensions/waveview';
- import { WebSpeech } from './class-asr';
- import { Platform } from '@ionic/angular';
- import { Diagnostic } from '@awesome-cordova-plugins/diagnostic/ngx';
- import * as i0 from "@angular/core";
- export declare class FmodeVoiceService {
- private platform;
- private diagnostic;
- /**
- * 关闭ASR:用于测试其他功能时,可关闭ASR节省语音接口消耗
- */
- disableASR: false;
- /**
- * 讯飞TTS语音合成
- */
- /**
- * WebSpeech 语音库
- */
- webSpeech: typeof WebSpeech;
- constructor(platform: Platform, diagnostic: Diagnostic);
- onResultTextChanged: Function;
- /**()
- * 用户操作:录音按钮快捷触发操作
- */
- toggleRecord(): void;
- /**
- * 用户操作:完成录音,并处理转录结果
- */
- isUserFinish: boolean;
- finishTalk(): void;
- onBeforeFinishTalk: Function;
- onAfterFinishTalk: Function;
- onInputChange: Function;
- /**
- * 用户操作:开始讲话,实时转录语言
- */
- startTalk(evnet?: any): Promise<void>;
- onBeforeStartTalk: Function;
- onAfterStartTalk: Function;
- /**
- * 用户操作:取消讲话,且不发送结果
- */
- cancelTalk(): void;
- /**
- * 操作回调
- */
- onBeforeCancelTalk: Function;
- onAfterCancelTalk: Function;
- onAfterRecordStart: Function;
- /**
- * 程序逻辑
- */
- recordStart(): Promise<void>;
- recordStop(): Promise<unknown>;
- recordWavBlob: Blob;
- recordPcmBlob: Blob;
- recordDuration: number;
- playRecord(): void;
- pcmBlobToWavBlob(pcmBlob: any, sampleRate: any): Promise<Blob>;
- playPCM(pcmBlob: any, sampleRate: any): Promise<void>;
- buffers: Array<any>;
- playBuffers(): Promise<void>;
- BuffersToBlob(buffers: any): Blob;
- splitAudioData(audioData: any): any[];
- BufferToBlob(buffer: any): Blob;
- recordType: string;
- encodingType: string;
- createRecorder(): void;
- openWithPriviledge(): Promise<unknown>;
- connStatus: string;
- btnStatus: string;
- waveClient: any;
- recorder: any;
- iatWS: any;
- resultText: string;
- resultTextTemp: string;
- countdownInterval: any;
- durationInterval: any;
- /**
- * 获取websocket url
- * 该接口需要后端提供,这里为了方便前端处理
- */
- APPID: string;
- API_SECRET: string;
- API_KEY: string;
- getWebSocketUrl(): string;
- toBase64(buffer: any): string;
- /**
- * 倒计时:最长支持60秒实时语音转录,如果持续7-10秒无声音,服务端将自动CLOSE链接
- */
- /**
- * 计时器
- */
- onDurationStrChange: Function;
- durationStr: string;
- duration: number;
- now: Date;
- countTimer(): void;
- startCountdown(): void;
- changeBtnStatus(status: any): void;
- renderResult(resultData: any): void;
- getUserInput(): string;
- connectWebSocket(): void;
- /**
- * 断开自动重连
- * @desc
- * 停留5秒自动断开重连
- * 60秒断开后重连
- */
- reconnectWebsocket(): Promise<void>;
- /**
- * 移动端兼容方法
- */
- /**
- * 移动端上传专用方法
- * @returns
- */
- isCapacitor(): boolean;
- requestPermission(): Promise<void>;
- requestRecordAudioPermission(): Promise<void>;
- requestMicPermission(): Promise<void>;
- requestStoagePermission(): Promise<void>;
- requestCameraPermission(): Promise<void>;
- static ɵfac: i0.ɵɵFactoryDeclaration<FmodeVoiceService, never>;
- static ɵprov: i0.ɵɵInjectableDeclaration<FmodeVoiceService>;
- }
|