import "@styles/Viewer.scss"; import useTSRemoteApp, { IClient } from "react-ts5-remote-app-api"; export default function Viewer({ remoteAppPort = 5899, showChannelName = false, hideNonTalking = false, clientLimit = 0, }: { remoteAppPort?: number; showChannelName?: boolean; hideNonTalking?: boolean; clientLimit?: number; }) { const { clients, activeConnectionId, currentChannel } = useTSRemoteApp({ remoteAppPort: remoteAppPort, auth: { identifier: "de.tealfire.obs", version: "2.0.3", name: "TS5 OBS Overlay", description: "A OBS overlay for TS5 by DerTyp7", }, logging: true, }); const currentClients = clients.map((client) => { if (client.channel?.id === currentChannel?.id && client.channel.connection.id === activeConnectionId) { return client; } }) as IClient[]; return (
{showChannelName ? (

{currentChannel?.properties.name}

) : null} {currentClients?.map((client, i) => { //* Client limit if (clientLimit != 0 && i >= clientLimit) { return null; } if (client) { //* Non-talking client if (hideNonTalking && (client.properties.inputMuted || client.properties.outputMuted || client.talkStatus == 0)) { return null; } //* Normal client return (
{client.properties.outputHardware == false ? ( muted_hardware_output ) : client.properties.inputHardware == false ? ( muted_hardware_input ) : client.properties.outputMuted ? ( muted_output ) : client.properties.inputMuted ? ( muted_input ) : client.talkStatus == 1 ? ( player_on_v2 ) : ( player_off_v2 )}

{client.properties.nickname}

); } else { return
; } })}
); }