@zoom/rtms
    Preparing search index...

    Class Client

    RTMS Client: Core interface for connecting to Zoom real-time media streams

    The Client class provides the main interface for connecting to and processing Zoom RTMS streams. Use this approach when you need to:

    • Connect to multiple meetings simultaneously
    • Process different media types (audio, video, transcript)
    • Handle session and user events
    import rtms from "@zoom/rtms";

    const client = new rtms.Client();

    // Set up event handlers
    client.onJoinConfirm((reason) => {
    console.log(`Join confirmed with reason: ${reason}`);
    });

    client.onAudioData((buffer, size, timestamp, metadata) => {
    console.log(`Received ${size} bytes of audio from ${metadata.userName}`);
    // Process audio data...
    });

    // Join the meeting
    client.join({
    meeting_uuid: "abc123-meeting-uuid",
    rtms_stream_id: "xyz789-stream-id",
    server_urls: "wss://rtms.zoom.us",
    pollInterval: 10 // milliseconds
    });

    // Later, leave the meeting
    client.leave();
    Index

    Constructors

    • Creates a new RTMS Client instance

      Each Client instance represents a connection to a single Zoom meeting. You can create multiple Client instances to connect to different meetings.

      Returns Client

    Methods

    • Joins a Zoom RTMS session with parameters object

      This method establishes a connection to a Zoom RTMS stream. After joining, callback methods will be invoked as events occur.

      Parameters

      • options: JoinParams

        An object containing join parameters

      Returns boolean

      true if the join operation succeeds

      client.join({
      meeting_uuid: "abc123-meeting-uuid",
      rtms_stream_id: "xyz789-stream-id",
      server_urls: "wss://rtms.zoom.us",
      pollInterval: 10
      });
    • Joins a Zoom RTMS session with individual parameters

      This method establishes a connection to a Zoom RTMS stream. After joining, callback methods will be invoked as events occur.

      Parameters

      • meetingUuid: string

        The UUID of the Zoom meeting

      • rtmsStreamId: string

        The RTMS stream ID for this connection

      • signature: string

        The authentication signature

      • serverUrls: string

        The server URL(s) to connect to

      • Optionaltimeout: number

        The timeout for the join operation in milliseconds

      Returns boolean

      true if the join operation succeeds

      // Generate signature
      const signature = rtms.generateSignature({
      client: "client_id",
      secret: "client_secret",
      uuid: "abc123-meeting-uuid",
      streamId: "xyz789-stream-id"
      });

      // Join with explicit parameters
      client.join(
      "abc123-meeting-uuid",
      "xyz789-stream-id",
      signature,
      "wss://rtms.zoom.us"
      );
    • Leaves the current session and releases resources

      This method disconnects from the Zoom RTMS stream, stops background polling, and releases resources.

      Returns boolean

      true if the leave operation succeeds

      // Leave the meeting when done
      client.leave();
    • Sets a callback for receiving audio data

      This callback is triggered when audio data is received from the meeting. It provides the raw audio data buffer and metadata about the sender.

      Parameters

      Returns boolean

      true if the callback was set successfully

      client.onAudioData((buffer, size, timestamp, metadata) => {
      console.log(`Received ${size} bytes of audio from ${metadata.userName}`);

      // Process the audio data
      // buffer - Raw audio data (Buffer)
      // size - Size of the audio data in bytes
      // timestamp - Timestamp of the audio data
      // metadata - Information about the sender
      });
    • Sets a callback for receiving deskshare data

      This callback is triggered when data is received from the meeting. It provides the raw audio data buffer and metadata about the sender.

      Parameters

      • callback: DeskshareDataCallback

        The callback function to invoke

      Returns boolean

      true if the callback was set successfully

      client.onDsData((buffer, size, timestamp, metadata) => {
      console.log(`Received ${size} bytes of deskshare data from ${metadata.userName}`);

      // Process the data
      // buffer - Raw deskshare data (Buffer)
      // size - Size of the deskshare data in bytes
      // timestamp - Timestamp of the deskshare data
      // metadata - Information about the sender
      });
    • Sets a callback for join confirmation events

      This callback is triggered when the join operation is confirmed by the server.

      Parameters

      Returns boolean

      true if the callback was set successfully

      client.onJoinConfirm((reason) => {
      console.log(`Join confirmed with reason code: ${reason}`);
      // 0 = success, other values indicate specific error conditions
      });
    • Sets a callback for leave events

      This callback is triggered when the client leaves the meeting, either voluntarily or due to an error.

      Parameters

      Returns boolean

      true if the callback was set successfully

      client.onLeave((reason) => {
      console.log(`Left meeting with reason code: ${reason}`);
      // Clean up resources or reconnect based on the reason code
      });
    • Sets a callback for session update events

      This callback is triggered when session information is updated. It provides details about session status changes (add, stop, pause, resume).

      Parameters

      Returns boolean

      true if the callback was set successfully

      client.onSessionUpdate((op, sessionInfo) => {
      // op = SESSION_EVENT_ADD, SESSION_EVENT_STOP, etc.
      console.log(`Session ${sessionInfo.sessionId} updated: ${op}`);
      console.log(`Status: ${sessionInfo.isActive ? 'active' : 'inactive'}`);
      });
    • Sets a callback for receiving transcript data

      This callback is triggered when transcript data is received from the meeting. It provides the raw transcript data buffer and metadata about the sender.

      Parameters

      Returns boolean

      true if the callback was set successfully

      client.onTranscriptData((buffer, size, timestamp, metadata) => {
      // Convert buffer to string (assuming UTF-8 encoding)
      const text = buffer.toString('utf8');
      console.log(`Transcript from ${metadata.userName}: ${text}`);
      });
    • Sets a callback for user update events

      This callback is triggered when users join or leave the meeting. It provides information about the participant who joined or left.

      Parameters

      Returns boolean

      true if the callback was set successfully

      client.onUserUpdate((op, participantInfo) => {
      // op = USER_EVENT_JOIN or USER_EVENT_LEAVE
      if (op === rtms.USER_EVENT_JOIN) {
      console.log(`User joined: ${participantInfo.name} (ID: ${participantInfo.id})`);
      } else {
      console.log(`User left: ${participantInfo.name} (ID: ${participantInfo.id})`);
      }
      });
    • Sets a callback for receiving video data

      This callback is triggered when video data is received from the meeting. It provides the raw video data buffer, track ID, and metadata about the sender.

      Parameters

      Returns boolean

      true if the callback was set successfully

      client.onVideoData((buffer, size, timestamp, trackId, metadata) => {
      console.log(`Received ${size} bytes of video from ${metadata.userName}`);
      console.log(`Track ID: ${trackId}`);

      // Process the video data
      // buffer - Raw video data (Buffer)
      // size - Size of the video data in bytes
      // timestamp - Timestamp of the video data
      // trackId - ID of the video track
      // metadata - Information about the sender
      });
    • Manually polls for events from the RTMS server

      This method is automatically called by the SDK's internal polling mechanism. You typically don't need to call this manually.

      Returns boolean

      true if the poll operation succeeds

    • Releases client resources

      This method disconnects from the server and releases resources. It's automatically called by the leave method.

      Returns boolean

      true if the release operation succeeds

    • Sets audio parameters for the client

      This method configures audio processing parameters.

      Parameters

      Returns boolean

      true if the operation succeeds

    • Sets deskshare parameters for the client

      This method configures deskshare video processing parameters.

      Parameters

      Returns boolean

      true if the operation succeeds

    • Sets video parameters for the client

      This method configures video processing parameters.

      Parameters

      Returns boolean

      true if the operation succeeds

    • Gets the stream ID of the current connection

      Returns string

      The RTMS stream ID

    • Gets the UUID of the current meeting

      Returns string

      The meeting UUID

    • Initializes the RTMS SDK with the specified CA certificate path

      This static method must be called before creating any Client instances. It's automatically called by the join method if not already initialized.

      Parameters

      • OptionalcaPath: string

        Path to the CA certificate file (defaults to system CA)

      Returns boolean

      true if initialization succeeds

    • Uninitializes the RTMS SDK and releases resources

      This static method should be called when you're done using the SDK. It releases all system resources allocated by the SDK.

      Returns boolean

      true if uninitialization succeeds