Use selective subscriptions (#100)
This commit is contained in:
parent
4fecfe3037
commit
14e3bb3c11
1 changed files with 8 additions and 1 deletions
|
@ -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}
|
||||||
|
|
Loading…
Reference in a new issue