Javascript API Reference
    Preparing search index...

    Class Meeting

    Index
    activePresenterId: string

    This indicates the participant ID of the user who is currently sharing their screen in the meeting. If no one is presenting, the value is null.

    activeSpeakerId: string

    This indicates the participant ID of the user who is currently speaking. If no participant is actively speaking, the value is null.

    hlsState: "HLS_STOPPED" | "HLS_STARTING" | "HLS_STARTED" | "HLS_STOPPING"

    This represents the current state of the HLS stream.

    hlsUrls: {
        downstreamUrl?: string;
        livestreamUrl?: string;
        playbackHlsUrl?: string;
    }

    This represents the URLs associated with the ongoing HLS stream.

    • playbackHlsUrl – URL used for playback.
    • livestreamUrl – URL used for live streaming.
    • downstreamUrlDeprecated. Use playbackHlsUrl or livestreamUrl instead.

    Note

    downstreamUrl is deprecated and should no longer be used.

    id: string

    This represents the unique ID of the meeting that the participant has joined.

    isE2EEEnabled: boolean

    This represents whether End-to-End Encryption (E2EE) is enabled for the meeting.

    livestreamState:
        | "LIVESTREAM_STOPPED"
        | "LIVESTREAM_STARTING"
        | "LIVESTREAM_STARTED"
        | "LIVESTREAM_STOPPING"

    This represents the current state of the livestream.

    localParticipant: Participant

    This represents the local participant (you) who joined the meeting.

    mainParticipantId: string

    This represents the participant ID of the main participant in the meeting.

    participants: Map<string, Participant>

    This represents a map of all remote participants currently in the meeting.

    • The key represents the participant ID.
    • The value represents the corresponding Participant instance.

    This map does not include the local participant.

    pinnedParticipants: Map<string, { cam: boolean; share: boolean }>

    This represents a map of all participants currently pinned in the meeting.

    • The key represents the participant ID.
    • The value represents the pin state, indicating whether the participant’s camera (cam) and/or screen share (share) is pinned.
    pubSub: pubSub

    It allows access to the pubSub functionality.

    realtimeStore: realtimeStore

    It allows access to the realtimeStore functionality.

    recordingState:
        | "RECORDING_STOPPED"
        | "RECORDING_STARTING"
        | "RECORDING_STARTED"
        | "RECORDING_STOPPING"

    This represents the current state of the meeting recording.

    selectedCameraDevice: CameraDeviceInfo

    This represents the currently selected camera device used during the meeting,returned as a CameraDeviceInfo object containing details about the active camera.

    selectedMicrophoneDevice: MicrophoneDeviceInfo

    This represents the currently selected microphone device used during the meeting,returned as a MicrophoneDeviceInfo object containing details about the active microphone.

    transcriptionState:
        | "TRANSCRIPTION_STARTING"
        | "TRANSCRIPTION_STARTED"
        | "TRANSCRIPTION_STOPPING"
        | "TRANSCRIPTION_STOPPED"

    This represents the current state of real-time transcription.

      • This method can be used to change the active microphone device.
      • If multiple microphones are available, this method allows switching between them dynamically during the meeting.

      Parameters

      • object: string | MediaStream

        Either:

        • A deviceId string of the microphone to switch to, or
        • A MediaStream to be used as the audio input source.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      const mics = await meeting?.getMics();

      const { deviceId, label } = mics[0];

      await meeting?.changeMic(deviceId);
      } catch (err) {
      console.log("Error in changeMic", err);
      }
      • This method can be used to change the local participant's mode.
      • You can switch between the following modes: modes.

      Info

      Important changes introduced in JavaScript SDK v0.1.4:

      • CONFERENCE has been replaced with SEND_AND_RECV
      • VIEWER has been replaced with SIGNALLING_ONLY

      Events associated with changeMode():

      Parameters

      • mode: "SEND_AND_RECV" | "SIGNALLING_ONLY" | "RECV_ONLY"

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.changeMode(VideoSDK.Constants.modes.SEND_AND_RECV);
      } catch (err) {
      console.log("Error in changeMode", err);
      }
      • This method can be used to change the active webcam device.
      • If multiple cameras are connected, this method allows switching between them dynamically during the meeting.

      Parameters

      • object: string | MediaStream

        Either:

        • A deviceId of the webcam to switch to, or
        • A MediaStream to be used as the video source.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      const webcams = await meeting?.getWebcams();

      const { deviceId, label } = webcams[0];

      await meeting?.changeWebcam(deviceId);
      } catch (err) {
      console.log("Error in changeWebcam", err);
      }
      • This method can be used to retrieve a previously uploaded file from VideoSDK's temporary storage.
      • The returned value is a Base64-encoded string.

      Parameters

      • options: { token: string; url: string }
        • token: string

          VideoSDK authentication token.

        • url: string

          The file URL returned by uploadBase64File().

      Returns Promise<string>

      A Base64-encoded string of the requested file.

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      const base64 = await meeting.fetchBase64File({
      url: "<FILE_URL>", // Provide fileUrl which is returned by uploadBase64File(),
      token: "<VIDEOSDK_TOKEN>",
      });

      console.log("Base64:", base64);
      } catch (err) {
      console.log("Error in fetchBase64File", err);
      }
      • This method can be used to retrieve all available microphone devices connected to the system.

      Returns Promise<{ deviceId: string; label: string }[]>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      const mics = await meeting?.getMics();
      console.log(mics);
      } catch (err) {
      console.log("Error in getMics", err);
      }
      • This method can be used to retrieve all available camera devices connected to the system.

      Returns Promise<
          { deviceId: string; facingMode: "environment"
          | "front"; label: string }[],
      >

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      const webcams = await meeting?.getWebcams();
      console.log(webcams);
      } catch (err) {
      console.log("Error in getWebcams", err);
      }
      • This method can be used to join the meeting.
      • After initializing a meeting using initMeeting(), calling join() is required to enter the meeting.

      Events associated with join():

      • The local participant receives a meeting-joined event once the meeting is successfully joined.
      • Remote participants receive a participant-joined event containing the newly joined participant.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.join();
      } catch (err) {
      console.log("Error in join", err);
      }
      • This method can be used to leave the currently joined meeting.

      Events associated with leave():

      • The local participant receives a meeting-left event.
      • All remote participants receive a participant-left event containing the participant ID of the user who left.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.leave();
      } catch (err) {
      console.log("Error in leave", err);
      }
    • Removes an event listener that was previously registered.

      Parameters

      • eventType:
            | "participant-joined"
            | "participant-left"
            | "participant-mode-changed"
            | "speaker-changed"
            | "presenter-changed"
            | "main-participant-changed"
            | "entry-requested"
            | "entry-responded"
            | "recording-state-changed"
            | "livestream-state-changed"
            | "hls-state-changed"
            | "whiteboard-started"
            | "whiteboard-stopped"
            | "meeting-joined"
            | "meeting-left"
            | "mic-requested"
            | "webcam-requested"
            | "pin-state-changed"
            | "meeting-state-changed"
            | "error"
            | "transcription-state-changed"
            | "transcription-text"
            | "paused-all-streams"
            | "resumed-all-streams"
            | "media-relay-started"
            | "media-relay-stopped"
            | "media-relay-error"
            | "media-relay-request-response"
            | "media-relay-request-received"
            | "quality-limitation"
            | "audio-input-silence"
            | "data"
            | "codec-changed"

        Event name to which you want to unsubscribe.

      • listener: (data: any) => void

        Callback function which was passed while subscribing to the event

        To view the complete list of available events and their details, refer to MeetingEvent.

      Returns void

    • Registers an event listener.

      Parameters

      • eventType:
            | "participant-joined"
            | "participant-left"
            | "participant-mode-changed"
            | "speaker-changed"
            | "presenter-changed"
            | "main-participant-changed"
            | "entry-requested"
            | "entry-responded"
            | "recording-state-changed"
            | "livestream-state-changed"
            | "hls-state-changed"
            | "whiteboard-started"
            | "whiteboard-stopped"
            | "meeting-joined"
            | "meeting-left"
            | "mic-requested"
            | "webcam-requested"
            | "pin-state-changed"
            | "meeting-state-changed"
            | "error"
            | "transcription-state-changed"
            | "transcription-text"
            | "paused-all-streams"
            | "resumed-all-streams"
            | "media-relay-started"
            | "media-relay-stopped"
            | "media-relay-error"
            | "media-relay-request-response"
            | "media-relay-request-received"
            | "quality-limitation"
            | "audio-input-silence"
            | "data"
            | "codec-changed"

        Event name to which you want to subscribe.

      • listener: (data: any) => void

        Callback function which will be triggered when the event happens

        To view the complete list of available events and their details, refer to MeetingEvent.

      Returns void

      • This method can be used to pause active media streams in the meeting.
      • The local participant will receive the paused-all-streams event.

      Parameters

      • Optionalkind: "audio" | "video" | "share" | "shareAudio" | "all"

        Specifies which type of media stream should be paused. If not provided, all media streams (audio, video, and screen share) will be paused.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.pauseAllStreams("video");
      } catch (err) {
      console.log("Error in pauseAllStreams", err);
      }
      • This method can be used to replace the currently published webcam stream with a new MediaStream.
      • Useful when swapping the outgoing video track (for example, when applying a virtual background).

      Parameters

      • stream: MediaStream

        The new MediaStream to publish as the webcam.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.replaceWebcamStream(newStream);
      } catch (err) {
      console.log("Error in replaceWebcamStream", err);
      }
      • This method can be used to start relaying selected media streams from the current meeting to another destination meeting.
      • Once the relay is successfully initiated, the local participant receives the media-relay-started event.

      Parameters

      • options: {
            destinationMeetingId: string;
            kinds?: ("audio" | "video" | "share")[];
            token?: string;
        }

        Configuration for media relay.

        • destinationMeetingId: string

          The ID of the destination meeting where media will be relayed.

        • Optionalkinds?: ("audio" | "video" | "share")[]

          Specifies which media tracks should be relayed.

        • Optionaltoken?: string

          Authentication token for the destination meeting.

      Returns Promise<void>

      A promise that resolves once the relay request is successfully processed.

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.requestMediaRelay({
      destinationMeetingId: "destination-meeting-id",
      token: "auth-token",
      kinds: ["audio", "video"],
      });
      } catch (err) {
      console.log("Error in requestMediaRelay", err);
      }
      • This method can be used to respond to a participant’s request to enter the meeting.
      • Call this from a host / co-host to allow or deny an entry request received via the entry-requested event.

      Parameters

      • participantId: string

        The ID of the participant whose entry request is being responded to.

      • decision: "allowed" | "denied"

        The final decision for the entry request.

        Possible values:

        • "allowed" – Allow the participant to join.
        • "denied" – Deny the participant’s entry request.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.respondEntry("participant-id", "allowed");
      } catch (err) {
      console.log("Error in respondEntry", err);
      }
      • This method can be used to resume media streams that were previously paused.
      • The local participant will receive the resumed-all-streams event.

      Parameters

      • Optionalkind: "audio" | "video" | "share" | "shareAudio" | "all"

        Specifies which type of media stream should be resumed.If not provided, all media streams (audio, video, and screen share) will be resumed.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.resumeAllStreams("video");
      } catch (err) {
      console.log("Error in resumeAllStreams", err);
      }
      • This method can be used to send a message to all participants in the meeting using the data channel.

      Parameters

      • payload: string | Blob | ArrayBuffer | ArrayBufferView<ArrayBufferLike>

        The data to be sent.

        • Supported types: string, Blob, ArrayBuffer, ArrayBufferView
        • Maximum allowed size: 15 KiB
      • Optionaloptions: { reliability?: "RELIABLE" | "UNRELIABLE" }
        • Optionalreliability?: "RELIABLE" | "UNRELIABLE"

          Determines how the message is delivered:

      Returns Promise<boolean>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.send("Hello everyone!", {
      reliability: VideoSDK.Constants.reliabilityMode.UNRELIABLE,
      });
      } catch (err) {
      console.log("Error in send", err);
      }
      • This method can be used to set the webcam video quality for the local participant.
      • This method allows you to dynamically adjust the outgoing webcam video quality during the meeting.

      Parameters

      • quality: "low" | "med" | "high"

        Specifies the desired webcam quality.

        Allowed values:

        • "low" – Low video quality
        • "med" – Medium video quality
        • "high" – High video quality

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.setWebcamQuality("high");
      } catch (err) {
      console.log("Error in setWebcamQuality", err);
      }
      • This method can be used to start HLS streaming for the meeting.
      • This allows participants and viewers to watch the meeting via HLS playback.
      • All participants, including the local participant, will receive the HLS_STARTING event state in the hls-state-changed event.

      Parameters

      • Optionalconfig: {
            layout?: {
                gridSize?: number;
                priority?: "SPEAKER" | "PIN";
                type?: "GRID" | "SPOTLIGHT" | "SIDEBAR";
            };
            mode?: "video-and-audio"
            | "audio";
            quality?: "low" | "med" | "high";
            recording?: { enabled: boolean };
            theme?: "DARK" | "LIGHT" | "DEFAULT";
        }

        Configuration used to control the HLS stream.

        • Optionallayout?: {
              gridSize?: number;
              priority?: "SPEAKER" | "PIN";
              type?: "GRID" | "SPOTLIGHT" | "SIDEBAR";
          }
          • OptionalgridSize?: number

            Specifies the maximum number of participants shown in the grid.

          • Optionalpriority?: "SPEAKER" | "PIN"

            Determines participant priority when composing the layout.

          • Optionaltype?: "GRID" | "SPOTLIGHT" | "SIDEBAR"

            Defines the layout used in the HLS stream.

        • Optionalmode?: "video-and-audio" | "audio"

          Determines whether the stream includes video and audio or audio only.

        • Optionalquality?: "low" | "med" | "high"

          Defines the output video quality of the HLS stream.

        • Optionalrecording?: { enabled: boolean }

          This can be used to enable or disable recording.

        • Optionaltheme?: "DARK" | "LIGHT" | "DEFAULT"

          Defines the visual theme of the HLS stream.

      • Optionaltranscription: { enabled: boolean; summary?: { enabled: boolean; prompt?: string } }

        Configuration for post-meeting transcription and summary generation.

        • enabled: boolean

          Enables or disables transcription.

        • Optionalsummary?: { enabled: boolean; prompt?: string }
          • enabled: boolean

            Enables or disables summary generation.

          • Optionalprompt?: string

            Custom prompt used for generating the summary.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const config = {
      layout: {
      type: "SPOTLIGHT",
      priority: "PIN",
      gridSize: 9,
      },
      theme: "DEFAULT",
      recording : {
      enabled: true,
      };
      };

      const transcription = {
      enabled: true,
      summary: {
      enabled: true,
      },
      };

      try {
      await meeting?.startHls(config, transcription);
      } catch (err) {
      console.log("Error in startHls", err);
      }
      • This method can be used to start live streaming the meeting.
      • This allows you to stream the meeting to external platforms such as YouTube, Facebook, or any service that supports RTMP.
      • All participants, including the local participant, will receive the LIVESTREAM_STARTING state in the livestream-state-changed event.

      Parameters

      • outputs: { streamKey: string; url: string }[]

        An array of RTMP output destinations where the livestream will be broadcast.

      • Optionalconfig: {
            layout?: {
                gridSize?: number;
                priority?: "SPEAKER" | "PIN";
                type?: "GRID" | "SPOTLIGHT" | "SIDEBAR";
            };
            recording?: { enabled: boolean };
            theme?: "DARK" | "LIGHT" | "DEFAULT";
        }

        Configuration options for the RTMP livestream.

        • Optionallayout?: {
              gridSize?: number;
              priority?: "SPEAKER" | "PIN";
              type?: "GRID" | "SPOTLIGHT" | "SIDEBAR";
          }
          • OptionalgridSize?: number

            Specifies the maximum number of participants displayed in the grid.

          • Optionalpriority?: "SPEAKER" | "PIN"

            Determines participant priority when composing the livestream layout.

          • Optionaltype?: "GRID" | "SPOTLIGHT" | "SIDEBAR"

            Defines the layout used for the livestream.

        • Optionalrecording?: { enabled: boolean }

          This can be used to enable or disable recording.

        • Optionaltheme?: "DARK" | "LIGHT" | "DEFAULT"

          Defines the color theme of the livestream.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const outputs = [
      {
      url: "rtmp://a.rtmp.youtube.com/live2",
      streamKey: "<STREAM_KEY>",
      },
      {
      url: "rtmps://",
      streamKey: "<STREAM_KEY>",
      },
      ];

      const config = {
      layout: {
      type: "SPOTLIGHT",
      priority: "PIN",
      gridSize: 9,
      },
      theme: "DEFAULT",
      recording: {
      enabled: true,
      },
      };

      try {
      await meeting?.startLivestream(outputs, config);
      } catch (err) {
      console.log("Error in startLivestream", err);
      }
    • Parameters

      • OptionalwebhookUrl: string

        Webhook URL triggered when the recording state changes.

      • OptionalawsDirPath: string

        Path to the directory in your S3 bucket where recordings are stored.

      • Optionalconfig: {
            layout?: {
                gridSize?: number;
                priority?: "SPEAKER" | "PIN";
                type?: "GRID" | "SPOTLIGHT" | "SIDEBAR";
            };
            mode?: "video-and-audio"
            | "audio";
            quality?: "low" | "med" | "high";
            theme?: "DARK" | "LIGHT" | "DEFAULT";
        }

        Recording configuration options.

        • Optionallayout?: {
              gridSize?: number;
              priority?: "SPEAKER" | "PIN";
              type?: "GRID" | "SPOTLIGHT" | "SIDEBAR";
          }

          Defines how participants are arranged in the recording.

          • OptionalgridSize?: number

            Maximum number of participants displayed simultaneously.

          • Optionalpriority?: "SPEAKER" | "PIN"

            Determines participant prioritization.

          • Optionaltype?: "GRID" | "SPOTLIGHT" | "SIDEBAR"

            Layout type for the recording.

        • Optionalmode?: "video-and-audio" | "audio"

          Defines whether the recording includes video or audio only.

        • Optionalquality?: "low" | "med" | "high"

          Controls the output quality of the recording.

        • Optionaltheme?: "DARK" | "LIGHT" | "DEFAULT"

          Visual theme applied to the recording.

      • Optionaltranscription: { enabled: boolean; summary?: { enabled: boolean; prompt?: string } }

        Configuration for post-recording transcription and summary generation.

        • enabled: boolean

          Enables or disables transcription.

        • Optionalsummary?: { enabled: boolean; prompt?: string }
          • enabled: boolean

            Enables or disables summary generation.

          • Optionalprompt?: string

            Custom prompt used for generating transcription summaries.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const webhookUrl = "https://webhook.your-api-server.com";

      const awsDirPath = "/meeting-recordings/";

      const config = {
      layout: {
      type: "SPOTLIGHT",
      priority: "PIN",
      gridSize: 9,
      },
      theme: "DEFAULT",
      };

      const transcription = {
      enabled: true,
      summary: {
      enabled: true,
      },
      };

      try {
      await meeting?.startRecording(webhookUrl, awsDirPath, config, transcription);
      } catch (err) {
      console.log("Error in startRecording", err);
      }
    • Parameters

      • Optionaloptions: {
            modelConfig?: object;
            summary?: { enabled: boolean; prompt?: string };
            webhookUrl?: string;
        }
        • OptionalmodelConfig?: object

          Optional model configuration used during transcription.

        • Optionalsummary?: { enabled: boolean; prompt?: string }

          Configuration for real-time transcription summary generation.

          • enabled: boolean

            Enables or disables summary generation.

          • Optionalprompt?: string

            Custom instructions used to guide summary generation.

        • OptionalwebhookUrl?: string

          A webhook URL that will be called whenever the transcription state changes.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      const config = {
      webhookUrl: "https://webhook.your-api-server.com",
      summary: {
      enabled: true,
      prompt: "Write summary in sections like Title, Agenda, Speakers, Action Items, and Notes",
      },
      };

      try {
      await meeting?.startTranscription(config);
      } catch (err) {
      console.log("Error in startTranscription", err);
      }
      • This method can be used to switch the current session to another meeting without disconnecting.
      • This allows a seamless transition between meetings while preserving the active session context.

      Parameters

      • options: { meetingId: string; token?: string }

        Configuration for switching meetings.

        • meetingId: string

          The ID of the meeting to switch to.

        • Optionaltoken?: string

          Authentication token for the destination meeting.

      Returns Promise<void>

      let meeting;

      // Initialize Meeting
      meeting = VideoSDK.initMeeting({
      // ...
      });

      try {
      await meeting?.switchTo({
      meetingId: "new-meeting-id",
      token: "optional-auth-token",
      });
      } catch (err) {
      console.log("Error in switchTo", err);
      }
      • This method can be used to upload a file to VideoSDK's temporary storage.
      • This method returns a fileUrl, which can later be used to retrieve the uploaded file.

      Parameters

      • options: { base64Data: string; fileName: string; token: string }
        • base64Data: string

          Base64-encoded representation of the file.

        • fileName: string

          Name of the file including its extension.

        • token: string

          VideoSDK authentication token. Learn more about tokens here.

      Returns Promise<string>

      try {
      const fileUrl = await meeting.uploadBase64File({
      base64Data: "<BASE64_DATA>", // Convert your file to base64 and pass here
      token: "<VIDEOSDK_TOKEN>",
      fileName: "image.jpeg", // Provide name with extension here,
      });

      console.log("File URL:", fileUrl);
      } catch (err) {
      console.log("Error in uploadBase64File", err);
      }