From 3d623b5dbcbd080facea4e2f366312d42a64e848 Mon Sep 17 00:00:00 2001 From: lukasIO Date: Tue, 7 Mar 2023 15:51:08 +0100 Subject: [PATCH] Add hq publishing mode (#30) * Add hq publishing mode * remove unused vars --- pages/rooms/[name].tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pages/rooms/[name].tsx b/pages/rooms/[name].tsx index 932ee92..0a3ab50 100644 --- a/pages/rooms/[name].tsx +++ b/pages/rooms/[name].tsx @@ -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 ( <>