feat: route LiveKit token requests to correct instance for cross-instance voice

This commit is contained in:
Jannis Braun
2026-03-03 00:37:20 +01:00
parent 758c6a7b5b
commit e37f9ea24c
+3 -2
View File
@@ -12,7 +12,7 @@ import {
LocalAudioTrack, LocalAudioTrack,
LocalTrackPublication, LocalTrackPublication,
} from 'livekit-client'; } from 'livekit-client';
import { api } from '../api/client'; import { getApiForOrigin, getChannelOrigin } from '../stores/serverStore';
import { useVoiceStore } from '../stores/voiceStore'; import { useVoiceStore } from '../stores/voiceStore';
import { AudioManager } from '../audio/AudioManager'; import { AudioManager } from '../audio/AudioManager';
import { SpeakingDetector } from '../audio/SpeakingDetector'; import { SpeakingDetector } from '../audio/SpeakingDetector';
@@ -340,7 +340,8 @@ export function useLiveKit() {
} }
try { try {
const { token, url } = isDm ? await api.livekit.dmToken(channelId) : await api.livekit.token(channelId); const client = isDm ? getApiForOrigin('') : getApiForOrigin(getChannelOrigin(channelId));
const { token, url } = isDm ? await client.livekit.dmToken(channelId) : await client.livekit.token(channelId);
if (gen !== _connectGeneration) return; if (gen !== _connectGeneration) return;
const newRoom = new Room({ adaptiveStream: true, dynacast: true, publishDefaults: { videoCodec: 'h264', simulcast: true } }); const newRoom = new Room({ adaptiveStream: true, dynacast: true, publishDefaults: { videoCodec: 'h264', simulcast: true } });
roomRef.current = newRoom; roomRef.current = newRoom;