@voicefeedback/sdk
Version:
Modern voice feedback SDK with beautiful UI components and AI-powered analysis
51 lines (49 loc) • 1.36 kB
TypeScript
interface VoiceFeedbackConfig {
apiKey: string;
apiUrl?: string;
webhookUrl?: string;
language?: string;
maxDuration?: number;
onStart?: () => void;
onStop?: () => void;
onComplete?: (result: VoiceFeedbackResult) => void;
onError?: (error: Error) => void;
debug?: boolean;
}
interface VoiceFeedbackResult {
id: string;
transcript: string;
sentiment: 'positive' | 'negative' | 'neutral';
sentimentScore: number;
topics: string[];
emotions?: string[];
duration: number;
language: string;
processingTime: number;
}
declare class VoiceFeedback {
private config;
private mediaRecorder;
private stream;
private chunks;
private isRecording;
private startTime;
constructor(config: VoiceFeedbackConfig);
private log;
startRecording(): Promise<void>;
stopRecording(): void;
private getSupportedMimeType;
private processRecording;
static quickStart(apiKey: string, options?: Partial<VoiceFeedbackConfig>): Promise<VoiceFeedback>;
getStatus(): {
isRecording: boolean;
duration: number;
};
static isSupported(): boolean;
testApiKey(): Promise<{
valid: boolean;
message: string;
}>;
}
export { VoiceFeedback, VoiceFeedback as default };
export type { VoiceFeedbackConfig, VoiceFeedbackResult };