Skip to content

Commit 3a436ff

Browse files
authored
add option to disable single peer connection mode (#519)
1 parent 8464ee0 commit 3a436ff

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

app/rooms/[roomName]/PageClientImpl.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export function PageClientImpl(props: {
3939
region?: string;
4040
hq: boolean;
4141
codec: VideoCodec;
42+
singlePeerConnection: boolean;
4243
}) {
4344
const [preJoinChoices, setPreJoinChoices] = React.useState<LocalUserChoices | undefined>(
4445
undefined,
@@ -82,7 +83,11 @@ export function PageClientImpl(props: {
8283
<VideoConferenceComponent
8384
connectionDetails={connectionDetails}
8485
userChoices={preJoinChoices}
85-
options={{ codec: props.codec, hq: props.hq }}
86+
options={{
87+
codec: props.codec,
88+
hq: props.hq,
89+
singlePeerConnection: props.singlePeerConnection,
90+
}}
8691
/>
8792
)}
8893
</main>
@@ -95,6 +100,7 @@ function VideoConferenceComponent(props: {
95100
options: {
96101
hq: boolean;
97102
codec: VideoCodec;
103+
singlePeerConnection: boolean;
98104
};
99105
}) {
100106
const keyProvider = new ExternalE2EEKeyProvider();
@@ -129,7 +135,7 @@ function VideoConferenceComponent(props: {
129135
adaptiveStream: true,
130136
dynacast: true,
131137
e2ee: keyProvider && worker && e2eeEnabled ? { keyProvider, worker } : undefined,
132-
singlePeerConnection: true,
138+
singlePeerConnection: props.options.singlePeerConnection,
133139
};
134140
}, [props.userChoices, props.options.hq, props.options.codec]);
135141

app/rooms/[roomName]/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default async function Page({
1212
region?: string;
1313
hq?: string;
1414
codec?: string;
15+
singlePC?: string;
1516
}>;
1617
}) {
1718
const _params = await params;
@@ -21,13 +22,15 @@ export default async function Page({
2122
? _searchParams.codec
2223
: 'vp9';
2324
const hq = _searchParams.hq === 'true' ? true : false;
25+
const singlePC = _searchParams.singlePC !== 'false';
2426

2527
return (
2628
<PageClientImpl
2729
roomName={_params.roomName}
2830
region={_searchParams.region}
2931
hq={hq}
3032
codec={codec}
33+
singlePeerConnection={singlePC}
3134
/>
3235
);
3336
}

0 commit comments

Comments
 (0)