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,
formatChatMessageLinks,
} 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 Head from 'next/head';
@ -98,6 +98,12 @@ const ActiveRoom = ({ roomName, userChoices, onLeave }: ActiveRoomProps) => {
};
}, [userChoices, hq]);
const connectOptions = useMemo((): RoomConnectOptions => {
return {
autoSubscribe: false,
};
}, []);
return (
<>
{liveKitUrl && (
@ -105,6 +111,7 @@ const ActiveRoom = ({ roomName, userChoices, onLeave }: ActiveRoomProps) => {
token={token}
serverUrl={liveKitUrl}
options={roomOptions}
connectOptions={connectOptions}
video={userChoices.videoEnabled}
audio={userChoices.audioEnabled}
onDisconnected={onLeave}