xfyun-sdk
Version:
科大讯飞语音识别 SDK,支持浏览器中实时语音听写功能
47 lines (46 loc) • 1.21 kB
TypeScript
/**
* 语音合成 React 组件
*
* 基于 xfyun-sdk 的语音合成 UI 组件
* 使用共享模块减少代码重复
*/
import React from 'react';
import type { TTSAudioFormat, TTSVoiceName } from '../types';
export interface SpeechSynthesizerProps {
/** 讯飞应用 ID */
appId: string;
/** 讯飞 API Key */
apiKey: string;
/** 讯飞 API Secret */
apiSecret: string;
/** 声音名称 */
voiceName?: TTSVoiceName;
/** 语速 */
speed?: number;
/** 音调 */
pitch?: number;
/** 音量 */
volume?: number;
/** 音频格式 */
audioFormat?: TTSAudioFormat;
/** 采样率 */
sampleRate?: number;
/** 开始回调 */
onStart?: () => void;
/** 停止回调 */
onStop?: () => void;
/** 错误回调 */
onError?: (error: unknown) => void;
/** 组件类名 */
className?: string;
/** 按钮类名 */
buttonClassName?: string;
/** 输入框类名 */
inputClassName?: string;
/** 是否显示进度 */
showProgress?: boolean;
/** 是否显示状态 */
showStatus?: boolean;
}
declare const SpeechSynthesizer: React.FC<SpeechSynthesizerProps>;
export default SpeechSynthesizer;