@fishjam-cloud/react-client
Version:
React client library for Fishjam
22 lines • 884 B
TypeScript
import type { PeerId } from "../types/public";
/**
* Voice activity detection. Use this hook to check if voice is detected in audio track for given peer(s).
*
* Example usage:
* ```tsx
* function WhoIsTalkingComponent({ peerIds }: { peerIds: PeerId[] }) {
* const peersInfo = useVAD({peerIds});
* const activePeers = (Object.keys(peersInfo) as PeerId[]).filter((peerId) => peersInfo[peerId]);
*
* return `Now talking: ${activePeers.join(", ")}`;
* }
* ```
* @param peerIds List of ids of peers to subscribe to for voice activity detection notifications.
* @category Connection
* @group Hooks
* @returns Each key is a peerId and the boolean value indicates if voice activity is currently detected for that peer.
*/
export declare const useVAD: ({ peerIds }: {
peerIds: ReadonlyArray<PeerId>;
}) => Record<PeerId, boolean>;
//# sourceMappingURL=useVAD.d.ts.map