meet/lib/getLiveKitURL.ts
2025-06-18 16:42:04 +02:00

10 lines
354 B
TypeScript

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