simple huddle implementation with streams
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import '@livekit/components-styles';
|
||||
|
||||
import { LiveKitRoom, VideoConference } from '@livekit/components-react';
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
export function HuddleApp() {
|
||||
const [connection, setConnection] = useState<{ token: string; serverUrl: string } | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
return window.electronHuddle.onConnect((data) => {
|
||||
setConnection(data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleDisconnected = () => {
|
||||
window.electronWindow.closeHuddle();
|
||||
};
|
||||
|
||||
if (!connection) {
|
||||
return (
|
||||
<div className="flex h-screen items-center justify-center bg-background text-foreground">
|
||||
<p className="text-muted-foreground text-sm">Connecting to huddle...</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<LiveKitRoom
|
||||
token={connection.token}
|
||||
serverUrl={connection.serverUrl}
|
||||
connect={true}
|
||||
onDisconnected={handleDisconnected}
|
||||
data-lk-theme="default"
|
||||
style={{ height: '100vh' }}
|
||||
>
|
||||
<VideoConference />
|
||||
</LiveKitRoom>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user