client/packages/call/src/components/videoViewer.tsx
Alois a0e3e85467
All checks were successful
/ build-web (push) Successful in 1m13s
/ build-desktop (push) Successful in 11m50s
/ build-mobile (push) Successful in 16m27s
/ release (push) Successful in 24s
(fix): call being getting initialised even on the login screen
2026-05-23 21:43:11 +02:00

39 lines
966 B
TypeScript

import { VideoTrack, useParticipantTracks } from "@livekit/components-react";
import { TrackPublication } from "livekit-client";
import { getRoom } from "../store";
import { cn } from "@tensamin/ui";
import { Loader2 } from "lucide-react";
export default function VideoViewer({
className,
fill = false,
flush = false,
publication,
participantId,
}: {
className?: string;
fill?: boolean;
flush?: boolean;
publication: TrackPublication;
participantId: string;
}) {
const room = getRoom();
const tracks = useParticipantTracks([publication.source], {
participantIdentity: participantId,
room,
});
const trackRef = tracks[0];
if (!trackRef) return <Loader2 className="animate-spin" />;
return (
<VideoTrack
trackRef={trackRef}
className={cn(
fill ? "w-full h-full bg-black" : "w-full h-full aspect-video bg-black",
flush ? "rounded-none" : "rounded-md",
className,
)}
/>
);
}