Function: useVAD()
useVAD(
peerIds
):Record
<PeerId
,boolean
>
Defined in: packages/react-client/src/hooks/useVAD.ts:25
Voice activity detection. Use this hook to check if voice is detected in audio track for given peer(s).
Example usage:
import {
useVAD , typePeerId } from "@fishjam-cloud/react-client"; functionWhoIsTalkingComponent ({peerIds }: {peerIds :PeerId [] }) { constpeersInfo =useVAD ({peerIds }); constactivePeers = (Object .keys (peersInfo ) asPeerId []).filter ((peerId ) =>peersInfo [peerId ]); return `Now talking: ${activePeers .join (", ")}`; }
Parameters
Parameter | Type | Description |
---|---|---|
peerIds | { peerIds : readonly PeerId []; } | List of ids of peers to subscribe to for voice activity detection notifications. |
peerIds.peerIds | readonly PeerId [] | - |
Returns
Record
<PeerId
, boolean
>
Each key is a peerId and the boolean value indicates if voice activity is currently detected for that peer.