React Native Api Reference - v2.0.0
    Preparing search index...

    Class Participant

    Participant is one person in the room — the object useRoom's participants map holds, and the one its onParticipantJoined and onParticipantLeft events hand you.

    Prefer useParticipant in a component. It exposes the same state as tracked React state that re-renders on change, and the same 20 methods, so a component never has to reach into this object. This class documents what the raw object carries for the cases a hook cannot cover — reading a participant inside an event handler, say.

    An agent participant is a different shape: useParticipant throws for one, and AgentParticipant documents it instead.

    Index
    displayName: string
    • Display name the participant joined with.
    id: string
    • Unique id of the participant in this room.
    isAgent: boolean
    • false for a person, true for an AI agent. Branch on this before treating a participant as either.
    isLocal: boolean
    • true for the local participant.
    metaData: object
    • Custom metadata attached to this participant when they joined, as passed to metaData on the RoomProvider config.
    micOn: boolean
    • The participant's current microphone status.
    mode: "SEND_AND_RECV" | "SIGNALLING_ONLY" | "RECV_ONLY"
    • How this participant's media behaves. There are 3 types of Mode.
    screenShareAudioOn: boolean
    • The participant's current screen-share-audio status.
    screenShareOn: boolean
    • The participant's current screen-share status.
    streams: Map<string, RTCStream>
    • Every RTCStream this participant is currently producing, keyed by stream id.
    webcamOn: boolean
    • The participant's current webcam status.
      • Removes a listener added with on.

      Parameters

      • eventType:
            | "stream-enabled"
            | "stream-disabled"
            | "media-status-changed"
            | "stream-paused"
            | "stream-resumed"

        The event to unsubscribe from.

      • listener: (data: any) => void

        The same function that was passed to on.

      Returns void

      • Subscribes to this participant's own events.

      • These are the same events useParticipant surfaces as onStreamEnabled, onStreamDisabled, onMediaStatusChanged, onStreamPaused and onStreamResumed.

      Parameters

      • eventType:
            | "stream-enabled"
            | "stream-disabled"
            | "media-status-changed"
            | "stream-paused"
            | "stream-resumed"

        The event to subscribe to.

      • listener: (data: any) => void

        Called when the event fires.

      Returns void