meet/app/custom/page.tsx
Jonas Schell 15e58cd797
Migrate to Next app router (#297)
* Migrate Home Page to App Router

* Update themeColor from layout.tsx

* port room page to app router

* small changes

* port custom page to app router

* port token and url api routes

* port start stop routes

* Refactor error handling in GET function

* delete pages folder

* remove unused function

* remove deprecated field

from docs: @deprecated — will be enabled by default and removed in Next.js 15

* wrap useSearchParams in Suspense

* split up custom page into server and client component

* update imports

* simplify

* Refactor error handling in GET function

* refactor to use props for components

* Refactor video codec validation and handling

* Refactor LiveKitRoom component to handle null liveKitUrl

* refactor: improve video codec validation and handling

* add video codec typeguard

* fix isVideoCodec
2024-08-21 14:05:42 +02:00

29 lines
836 B
TypeScript

import { videoCodecs } from 'livekit-client';
import { VideoConferenceClientImpl } from './VideoConferenceClientImpl';
import { isVideoCodec } from '@/lib/types';
export default function CustomRoomConnection(props: {
searchParams: {
liveKitUrl?: string;
token?: string;
codec?: string;
};
}) {
const { liveKitUrl, token, codec } = props.searchParams;
if (typeof liveKitUrl !== 'string') {
return <h2>Missing LiveKit URL</h2>;
}
if (typeof token !== 'string') {
return <h2>Missing LiveKit token</h2>;
}
if (codec !== undefined && !isVideoCodec(codec)) {
return <h2>Invalid codec, if defined it has to be [{videoCodecs.join(', ')}].</h2>;
}
return (
<main data-lk-theme="default">
<VideoConferenceClientImpl liveKitUrl={liveKitUrl} token={token} codec={codec} />
</main>
);
}