meet/lib/getLiveKitURL.ts
2025-06-18 16:49:21 +02:00

10 lines
367 B
TypeScript

export function getLiveKitURL(projectUrl: string, region: string | null): string {
const url = new URL(projectUrl);
if (region && url.hostname.includes('livekit.cloud')) {
const [projectId, ...hostParts] = url.hostname.split('.');
const regionURL = [projectId, region, ...hostParts].join('.');
url.hostname = regionURL;
}
return url.toString();
}