mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-20 13:38:10 +02:00
feat: enhance reels with default overlay, more voices, and tts preview
This commit is contained in:
1 parent
8295916915
commit
9ff1c4aa18
5 files changed
+189
-31
No files matched your search
@@ -263,6 +263,46 @@ export class FFmpegService {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
async previewTTS(
|
||||
text: string,
|
||||
voice: string
|
||||
): Promise<{ success: boolean; audioBase64?: string; error?: string }> {
|
||||
const config = this.ensureConfigured();
|
||||
|
||||
try {
|
||||
const response = await fetch(`${config.apiUrl}/preview-tts`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-API-Key': config.apiKey,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
text,
|
||||
tts_voice: voice
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
return { success: false, error: `FFmpeg API error: ${response.status} - ${errorText}` };
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.success) {
|
||||
return { success: false, error: data.detail };
|
||||
}
|
||||
|
||||
return { success: true, audioBase64: data.audio_base64 };
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ TTS Preview error:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Unknown error',
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const ffmpegService = new FFmpegService();
|
||||
Reference in new issue
Block a user