Skip to main content

useParticipant Hook

useParticipant abstracts participant class. It takes participantId, events as partameters and returns participant properties and methods.

useParticipant hook

useParticipant react hook
import {
useParticipant,
} from "@videosdk.live/react-sdk";

const onStreamEnabled = (stream) => {
setStream(stream);
};

const {
displayName,
...
} = useParticipant(participantId, {
onStreamEnabled,
...
});

Parameters

  • __namedParametersrequiredobject

      Parameters
    • participantIdoptionalstring

    • triggersoptionalobject

      • onStreamEnabledoptionalcallback

      • onStreamDisabledoptionalcallback

Returns

  • __returnsrequiredobject

      Returns
    • displayNameoptionalstring

    • participantoptionalParticipant

    • webcamStreamoptionalMediaTrackStream

    • micStreamoptionalMediaTrackStream

    • screenShareStreamoptionalMediaTrackStream

    • webcamOnoptionalboolean

    • micOnoptionalboolean

    • screenShareOnoptionalboolean

    • isLocaloptionalboolean

    • isActiveSpeakeroptionalboolean

    • pinStateoptional{ cam: bool, share: bool }

    • setQuality()optionalcallback

    • enableMic()optionalcallback

    • disableMic()optionalcallback

    • enableWebcam()optionalcallback

    • disableWebcam()optionalcallback

Got a Question? Ask us on discord