fix(audio): align AudioContext to 48kHz up front for Opus streams

Opus resolved its 48kHz context lazily on the first chunk, close()ing and rebuilding the live graph mid-decode. Move the recreate into initializeStreaming so it runs before any bytes flow; the lazy call early-returns. WAV path unchanged.
This commit is contained in:
daniel-c-harvey
2026-06-24 23:26:42 -04:00
parent 8a6acd5f5f
commit 0800167511
3 changed files with 24 additions and 5 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ const DeepDrftAudio = {
}
},
initializeStreaming: (playerId: string, totalStreamLength: number, contentType: string): AudioResult => {
initializeStreaming: async (playerId: string, totalStreamLength: number, contentType: string): Promise<AudioResult> => {
const player = audioPlayers.get(playerId);
if (!player) return { success: false, error: 'Player not found' };
return player.initializeStreaming(totalStreamLength, contentType);