Add hq publishing mode (#30)

* Add hq publishing mode

* remove unused vars
This commit is contained in:
lukasIO 2023-03-07 15:51:08 +01:00 committed by GitHub
parent fe24adefc7
commit 3d623b5dbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,13 +6,12 @@ import {
VideoConference,
formatChatMessageLinks,
} from '@livekit/components-react';
import { LogLevel, RoomOptions } from 'livekit-client';
import { LogLevel, RoomOptions, VideoPresets } from 'livekit-client';
import type { NextPage } from 'next';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { useMemo, useState } from 'react';
import { getLiveKitURL } from '../../lib/server-utils';
import { DebugMode } from '../../lib/Debug';
import { useServerUrl } from '../../lib/client-utils';
@ -73,7 +72,7 @@ const ActiveRoom = ({ roomName, userChoices, onLeave }: ActiveRoomProps) => {
});
const router = useRouter();
const { region } = router.query;
const { region, hq } = router.query;
const liveKitUrl = useServerUrl(region as string | undefined);
@ -81,6 +80,13 @@ const ActiveRoom = ({ roomName, userChoices, onLeave }: ActiveRoomProps) => {
return {
videoCaptureDefaults: {
deviceId: userChoices.videoDeviceId ?? undefined,
resolution: hq === 'true' ? VideoPresets.h2160 : VideoPresets.h720,
},
publishDefaults: {
videoSimulcastLayers:
hq === 'true'
? [VideoPresets.h1080, VideoPresets.h720]
: [VideoPresets.h540, VideoPresets.h216],
},
audioCaptureDefaults: {
deviceId: userChoices.audioDeviceId ?? undefined,
@ -88,7 +94,7 @@ const ActiveRoom = ({ roomName, userChoices, onLeave }: ActiveRoomProps) => {
adaptiveStream: { pixelDensity: 'screen' },
dynacast: true,
};
}, [userChoices]);
}, [userChoices, hq]);
return (
<>