Streams to twitch given a correct streaming key. Needs to fic the fact that the screen isn't the full width of the monitor

This commit is contained in:
Tyler Marques 2025-03-17 14:54:21 -04:00
parent ee75a2a4ba
commit 33298eff3c
No known key found for this signature in database
GPG key ID: 7672EFD79378341C
9 changed files with 177 additions and 100 deletions

View file

@ -1,5 +1,4 @@
import { isSpeaking } from "./gameState";
import { gameState } from "./gameState";
// --- ElevenLabs Text-to-Speech configuration ---
const ELEVENLABS_API_KEY = import.meta.env.VITE_ELEVENLABS_API_KEY || "";
@ -20,7 +19,7 @@ export async function speakSummary(summaryText: string): Promise<void> {
}
// Set the speaking flag to block other animations/transitions
isSpeaking = true;
gameState.isSpeaking = true;
try {
// Truncate text to first 100 characters for ElevenLabs
@ -59,13 +58,13 @@ export async function speakSummary(summaryText: string): Promise<void> {
audio.play().then(() => {
audio.onended = () => {
// Clear the speaking flag when audio finishes
isSpeaking = false;
gameState.isSpeaking = false;
resolve();
};
}).catch(err => {
console.error("Audio playback error", err);
// Make sure to clear the flag even if there's an error
isSpeaking = false;
gameState.isSpeaking = false;
reject(err);
});
});
@ -73,6 +72,6 @@ export async function speakSummary(summaryText: string): Promise<void> {
} catch (err) {
console.error("Failed to generate TTS from ElevenLabs:", err);
// Make sure to clear the flag if there's any exception
isSpeaking = false;
gameState.isSpeaking = false;
}
}