Use selective subscriptions (#100)

This commit is contained in:
lukasIO 2023-08-17 19:01:59 +02:00 committed by GitHub
parent 4fecfe3037
commit 14e3bb3c11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@ import {
VideoConference, VideoConference,
formatChatMessageLinks, formatChatMessageLinks,
} from '@livekit/components-react'; } from '@livekit/components-react';
import { LogLevel, RoomOptions, VideoPresets } from 'livekit-client'; import { LogLevel, RoomConnectOptions, RoomOptions, VideoPresets } from 'livekit-client';
import type { NextPage } from 'next'; import type { NextPage } from 'next';
import Head from 'next/head'; import Head from 'next/head';
@ -98,6 +98,12 @@ const ActiveRoom = ({ roomName, userChoices, onLeave }: ActiveRoomProps) => {
}; };
}, [userChoices, hq]); }, [userChoices, hq]);
const connectOptions = useMemo((): RoomConnectOptions => {
return {
autoSubscribe: false,
};
}, []);
return ( return (
<> <>
{liveKitUrl && ( {liveKitUrl && (
@ -105,6 +111,7 @@ const ActiveRoom = ({ roomName, userChoices, onLeave }: ActiveRoomProps) => {
token={token} token={token}
serverUrl={liveKitUrl} serverUrl={liveKitUrl}
options={roomOptions} options={roomOptions}
connectOptions={connectOptions}
video={userChoices.videoEnabled} video={userChoices.videoEnabled}
audio={userChoices.audioEnabled} audio={userChoices.audioEnabled}
onDisconnected={onLeave} onDisconnected={onLeave}