Fix sync-info route to use ttsEngine and ttsVoice

- ttsSyncService.calculateSyncTiming now accepts ttsEngine parameter
- sync-info route extracts ttsVoice/ttsEngine from req.body instead of voice
- Previously it always fell back to Edge TTS even when Gemini was selected
  (because server stored 'fr-FR-Standard-B' but route only used 'voice')
This commit is contained in:
Michael committed 2026-05-19 14:12:08 +02:00
1 parent 6ff8f6b283
commit a9cda4ffd4
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -15,11 +15,11 @@ export class TtsSyncService {
* Calcule le word_duration optimal pour synchroniser l'affichage du texte
* avec la durée réelle de la voix TTS générée.
*/
async calculateSyncTiming(text: string, voice: string): Promise<SyncTiming> {
async calculateSyncTiming(text: string, voice: string, ttsEngine?: string): Promise<SyncTiming> {
const cleanText = this.cleanText(text);
// 1. Générer le TTS preview et mesurer sa durée exacte
const ttsResult = await ffmpegService.previewTTS(cleanText, voice);
const ttsResult = await ffmpegService.previewTTS(cleanText, voice, ttsEngine);
if (!ttsResult.success || !ttsResult.audioBase64) {
throw new Error('TTS preview failed: ' + (ttsResult.error || 'unknown'));
}