4828
Sr
stream-together / files
stream-together / components / agora-guest.tsx
806 bytes
1import { RemoteUser, useJoin, useRemoteUsers } from "agora-rtc-react"; 2import { useState } from "react"; 3 4import { appId, channel, HOST, OWNER, token } from "@/lib/config"; 5 6export default function AgoraGuest() { 7 useJoin( 8 { 9 appid: appId, 10 channel, 11 token, 12 }, 13 true, 14 ); 15 16 const remoteUsers = useRemoteUsers(); 17 const hosts = remoteUsers.filter((u) => u.uid === OWNER || u.uid === HOST); 18 19 return ( 20 <div className="flex flex-col md:flex-row gap-8 w-full justify-center items-center"> 21 {hosts.map((host) => { 22 return ( 23 <div 24 key={host.uid} 25 className="rounded-3xl overflow-hidden bg-black w-full max-w-2xl aspect-[4/3]" 26 > 27 <RemoteUser user={host} /> 28 </div> 29 ); 30 })} 31 </div> 32 ); 33}