import "@styles/Viewer.scss";
import useTSRemoteApp, { IClient } from "react-teamspeak-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.2.0",
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 ? (
{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 ? (
) : client.properties.inputHardware == false ? (
) : client.properties.outputMuted ? (
) : client.properties.inputMuted ? (
) : client.talkStatus == 1 ? (
) : (
)}
{client.properties.nickname}
);
} else {
return
;
}
})}
{currentChannel == null ? (
<>
Overlay couldn't connect to the client:
1. Make sure to accept the overlay in your TS5-Client via the notifications
2. Enable remote apps inside the the TS5-Settings
3. Make sure to match the configuration port with the port in the TS5 remote app settings
4. Refresh this page/BrowserSource (Select BrowserSource & click "Refresh" in OBS)
If non of this worked refer to the GitHub and write an issue with your problem
>
) : (
""
)}
);
}