React Api Reference
    Preparing search index...

    Class MeetingConsumer

    • A React component that subscribes to context changes and stays updated with the meeting instance, participants, and streams.

    • It requires a function as child, which receives the current context value and returns a React node.

    <MeetingConsumer
    {...{
    onParticipantJoined: (participant) => {
    setParticipant(participant);
    },
    //All Event Callbacks can be specified here
    }}
    >
    {({}) => {
    return <MeetingView />;
    }}
    </MeetingConsumer>
    Index

    Constructors

    Events

      • Triggered whenever a message is received over the DataStream.

      Parameters

      • data: {
            from: string;
            payload: string | Uint8Array;
            reliability: string;
            timestamp: string;
        }
        • from: string

          ID of the participant who sent the message.

        • payload: string | Uint8Array

          The received message payload.

          • string for text messages
          • Uint8Array for binary data
        • reliability: string

          Indicates whether the message delivery was reliable or unreliable.

        • timestamp: string

          Timestamp (in milliseconds since epoch) when the message was sent.

      Returns void

      • Triggered when a participant requests to join the meeting and their token includes the ask_join permission.
      • This event is emitted only to participants whose token includes the allow_join permission.

      Parameters

      • option: { allow: () => void; deny: () => void; name: string; participantId: string }
        • allow: () => void

          Call this function to allow the participant to join the meeting.

        • deny: () => void

          Call this function to deny the participant’s request.

        • name: string

          Display name of the participant requesting to join.

        • participantId: string

          Unique ID of the participant requesting to join the meeting.

      Returns void

      • Triggered when a participant’s join() request is responded to with an allow or deny decision.

      This event is emitted to:

      • All participants whose token includes the allow_join permission.
      • The participant who requested to join the meeting.

      Parameters

      • participantId: string

        ID of the participant who requested to join the meeting.

      • decision: string

        The final decision for the join request.

        Possible values:

        • "allowed" – The participant was allowed to join.
        • "denied" – The participant was denied entry.

      Returns void

      • Triggered when an error occurs during the meeting lifecycle.
      • The event provides an error code and a descriptive message. Refer to Errors for a complete list of supported error codes.

      Parameters

      • option: { code: number; message: string }
        • code: number

          Numeric error code representing the type of error.

        • message: string

          Human-readable description of the error.

      Returns void

      • Triggered when the HLS (HTTP Live Streaming) state changes.

      Parameters

      • option: {
            livestreamUrl: string;
            playbackHlsUrl: string;
            status:
                | "HLS_STARTING"
                | "HLS_STARTED"
                | "HLS_PLAYABLE"
                | "HLS_STOPPING"
                | "HLS_STOPPED";
        }
        • livestreamUrl: string

          Live HLS without playback support

        • playbackHlsUrl: string

          Live HLS with playback support

        • status: "HLS_STARTING" | "HLS_STARTED" | "HLS_PLAYABLE" | "HLS_STOPPING" | "HLS_STOPPED"

          Possible values:

          • HLS_STARTING - Hls is in starting phase and hasn't started yet.
          • HLS_STARTED- Hls has started successfully will return playbackHlsUrl and livestreamUrl.
          • HLS_PLAYABLE - Hls has started and the playbackHlsUrl and livestreamUrl is now playable.
          • HLS_STOPPING - Hls is in stopping phase and hasn't stopped yet.
          • HLS_STOPPED- Hls has stopped successfully.

      Returns void

      • Triggered when the meeting’s livestream state changes.

      Parameters

      • option: {
            status:
                | "LIVESTREAM_STARTING"
                | "LIVESTREAM_STARTED"
                | "LIVESTREAM_STOPPING"
                | "LIVESTREAM_STOPPED";
        }
        • status:
              | "LIVESTREAM_STARTING"
              | "LIVESTREAM_STARTED"
              | "LIVESTREAM_STOPPING"
              | "LIVESTREAM_STOPPED"

          Possible values:

          • LIVESTREAM_STARTING - Livestream is in starting phase and hasn't started yet.
          • LIVESTREAM_STARTED - Livestream has started successfully.
          • LIVESTREAM_STOPPING - Livestream is in stopping phase and hasn't stopped yet.
          • LIVESTREAM_STOPPED - Livestream has stopped successfully.

      Returns void

      • Triggered when the main participant in the meeting changes.

      Parameters

      • participant: Participant

        The Participant instance who is now the main participant.

      Returns void

      • Triggered when an error occurs during media relay.

      Parameters

      • option: { error: string; meetingId: string }
        • error: string

          Description of the error.

        • meetingId: string

          ID of the meeting where the error occurred.

      Returns void

      • Triggered when a media relay request is received in the destination meeting.

      Parameters

      • option: {
            accept: () => void;
            displayName: string;
            meetingId: string;
            participantId: string;
            reject: () => void;
        }
        • accept: () => void

          Call this function to accept the media relay request.

        • displayName: string

          Display name of the participant requesting the media relay.

        • meetingId: string

          ID of the meeting from which the media relay request originated.

        • participantId: string

          ID of the participant who initiated the media relay request.

        • reject: () => void

          Call this function to reject the media relay request.

      Returns void

      • Triggered when a response is received for a media relay request in the source meeting.

      Parameters

      • option: { decidedBy: string; decision: "accepted" | "declined"; participantId: string }
        • decidedBy: string

          ID of the participant who decided the decision.

        • decision: "accepted" | "declined"

          Decision taken for the request.

        • participantId: string

          ID of the participant who responded to the media relay request.

      Returns void

      • Triggered when media relay successfully starts for a destination meeting.

      Parameters

      • option: { meetingId: string }
        • meetingId: string

          ID of the meeting where the media relay has started.

      Returns void

      • Triggered when media relay stops for a destination meeting.

      Parameters

      • option: { meetingId: string; reason: string }
        • meetingId: string

          ID of the meeting where the media relay stopped.

        • reason: string

          Reason why the media relay stopped.

      Returns void

      • Triggered when the local participant successfully joins the meeting.

      Returns void

      • Triggered when the local participant leaves the meeting.
      • When this event is emitted, a reason object is also provided that explains why the participant left the meeting.

      The table below lists the possible reason codes:

      Reason Code Description
      WEBSOCKET_DISCONNECTED 1001 Socket disconnected
      REMOVE_PEER 1002 Participant was removed from the meeting
      REMOVE_PEER_VIEWER_MODE_CHANGED 1003 Participant removed due to viewer mode change
      REMOVE_PEER_MEDIA_RELAY_STOP 1004 Participant removed because media relay was stopped
      SWITCH_ROOM 1005 Participant switched to another room
      ROOM_CLOSE 1006 The meeting was closed
      UNKNOWN 1007 Participant disconnected due to an unknown reason
      REMOVE_ALL 1008 All participants were removed
      MEETING_END_API 1009 Meeting ended programmatically
      REMOVE_PEER_API 1010 Participant removed via API
      DUPLICATE_PARTICIPANT 1011 Participant joined from another device
      MANUAL_LEAVE_CALLED 1101 Participant manually left the meeting
      WEBSOCKET_CONNECTION_ATTEMPTS_EXHAUSTED 1102 WebSocket connection retries exhausted
      JOIN_ROOM_FAILED 1103 Failed to join the meeting
      SWITCH_ROOM_FAILED 1104 Failed to switch rooms

      Parameters

      • reason: { code: number; message: string }

        Object containing the reason and corresponding code.

      Returns void

      • Triggered whenever the meeting state changes.

      Parameters

      • option: { state: string }
        • state: string

          The current meeting state. Possible values:

          • CONNECTING
          • CONNECTED
          • RECONNECTING
          • DISCONNECTED
          • FAILED

      Returns void

      • This event will be emitted to the participant B when any other participant A requests to enable mic of participant B.
      • On accepting the request, mic of participant B will be enabled.

      Parameters

      • option: { accept: () => void; participantId: string; reject: () => void }
        • accept: () => void

          Call this function to accept the request and enable your microphone.

        • participantId: string

          ID of the participant who requested to enable your microphone.

        • reject: () => void

          Call this function to reject the request.

      Returns void

      • Triggered when a new participant joins the meeting.

      Parameters

      • participant: Participant

        The Participant instance representing the newly joined participant.

      Returns void

      • Triggered when a participant leaves the meeting.
      • When this event is emitted, a reason object is provided that describes why the participant left.

      Possible reason codes:

      Reason Code Description
      WEBSOCKET_DISCONNECTED 1001 Socket disconnected
      REMOVE_PEER 1002 Participant was removed from the meeting
      REMOVE_PEER_VIEWER_MODE_CHANGED 1003 Participant removed because viewer mode was changed
      REMOVE_PEER_MEDIA_RELAY_STOP 1004 Participant removed because media relay was stopped
      SWITCH_ROOM 1005 Participant switched to a different room
      ROOM_CLOSE 1006 The meeting has been closed
      UNKNOWN 1007 Participant disconnected due to an unknown reason
      REMOVE_ALL 1008 Remove All from the meeting
      MEETING_END_API 1009 Meeting Ended.
      REMOVE_PEER_API 1010 Participant removed from the meeting
      DUPLICATE_PARTICIPANT 1011 Leaving meeting, since this participantId joined from another device.
      MANUAL_LEAVE_CALLED 1101 Participant manually called the leave() method to exit the meeting
      WEBSOCKET_CONNECTION_ATTEMPTS_EXHAUSTED 1102 Meeting left after multiple failed websocket connection attempts.
      JOIN_ROOM_FAILED 1103 Meeting left due to an error while joining the room.
      SWITCH_ROOM_FAILED 1104 Meeting left due to an error while switching rooms.

      Parameters

      • participant: Participant

        The Participant instance who left the meeting.

      • reason: { code: number; message: string }

        An object describing the reason and corresponding code.

      Returns void

      • Triggered when a participant’s mode changes.

      Parameters

      • options: {
            mode: "SEND_AND_RECV" | "SIGNALLING_ONLY" | "RECV_ONLY";
            participantId: string;
        }
        • mode: "SEND_AND_RECV" | "SIGNALLING_ONLY" | "RECV_ONLY"

          The new mode of the participant. Possible values are defined in modes.

        • participantId: string

          ID of the participant whose mode has changed.

      Returns void

      • Triggered when all or specific media streams are paused.

      Parameters

      • option: { kind: "audio" | "video" | "share" | "shareAudio" | "all" }
        • kind: "audio" | "video" | "share" | "shareAudio" | "all"

          Indicates which media type was paused:

          • "audio" – Audio streams
          • "video" – Video streams
          • "share" – Screen-share video streams
          • "shareAudio" – Screen-share audio streams

      Returns void

      • Triggered when the pin state of a participant changes.
      • This event is emitted for all participants whenever a participant is pinned or unpinned.

      Parameters

      • option: { peerId: string; pinnedBy: string; state: { cam: boolean; share: boolean } }
        • peerId: string

          ID of the participant whose pin state changed.

        • pinnedBy: string

          ID of the participant who performed the pin or unpin action.

        • state: { cam: boolean; share: boolean }

          Current pin state (true if pinned, false if unpinned).

      Returns void

      • Triggered when a participant starts or stops screen sharing.
      • If screen sharing stops, the callback receives null.

      Parameters

      • presenterId: string

        ID of the participant currently presenting, or null if no one is presenting.

      Returns void

      • This callback is triggered when a quality limitation is detected or resolved during the meeting.

      • Triggered when a quality limitation is detected or resolved during the meeting.

      Parameters

      • option: {
            state: "detected" | "resolved";
            timestamp: number;
            type: "congestion" | "bandwidth" | "cpu";
        }
        • state: "detected" | "resolved"

          Indicates whether the limitation is currently active or resolved.

        • timestamp: number

          Time (in milliseconds since epoch) when the event occurred.

        • type: "congestion" | "bandwidth" | "cpu"

          Specifies the type of limitation.

      Returns void

      • Triggered when the meeting’s recording state changes.

      Parameters

      • option: {
            status:
                | "RECORDING_STARTING"
                | "RECORDING_STARTED"
                | "RECORDING_STOPPING"
                | "RECORDING_STOPPED";
        }
        • status:
              | "RECORDING_STARTING"
              | "RECORDING_STARTED"
              | "RECORDING_STOPPING"
              | "RECORDING_STOPPED"

          The current recording state:

          • RECORDING_STARTING - Recording is in starting phase and hasn't started yet.
          • RECORDING_STARTED - Recording has started successfully.
          • RECORDING_STOPPING - Recording is in stopping phase and hasn't stopped yet.
          • RECORDING_STOPPED - Recording has stopped successfully.

      Returns void

      • Triggered when paused media streams are resumed.

      Parameters

      • option: { kind: "audio" | "video" | "share" | "shareAudio" | "all" }
        • kind: "audio" | "video" | "share" | "shareAudio" | "all"

          Indicates which media type was resumed:

          • "audio" – Audio streams
          • "video" – Video streams
          • "share" – Screen-share video streams
          • "shareAudio" – Screen-share audio streams

      Returns void

      • Triggered when the active speaker changes.
      • If no participant is actively speaking, null is returned.

      Parameters

      • activeSpeakerId: string

        ID of the currently active speaker, or null if no one is speaking.

      Returns void

      • This event will be emitted to the participant B when any other participant A requests to enable webcam of participant B.
      • On accepting the request, webcam of participant B will be enabled.

      Parameters

      • option: { accept: () => void; participantId: string; reject: () => void }
        • accept: () => void

          Call this function to accept the request and enable your webcam.

        • participantId: string

          ID of the participant who requested to enable your webcam.

        • reject: () => void

          Call this function to reject the request.

      Returns void