@videosdk.live/js-sdk
Version:
<h1 align="center"> <img src="https://cdn.videosdk.live/docs/images/javascript/api_ref/js_api_ref.png"/><br/> </h1>
1,552 lines (1,499 loc) • 82.3 kB
TypeScript
export class Meeting {
/**
* This represents the unique ID of the meeting that the participant has joined.
*/
id: string;
/**
* This indicates the participant ID of the user who is currently speaking. If no participant is actively speaking, the value is `null`.
*/
activeSpeakerId: 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`.
*/
activePresenterId: string;
/**
* This represents the participant ID of the main participant in the meeting.
*/
mainParticipantId: string;
/**
* This represents the local participant (you) who joined the meeting.
*/
localParticipant: 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.
*/
participants: Map<string, Participant>;
/**
* This represents the current state of the livestream.
*/
livestreamState:
| "LIVESTREAM_STOPPED"
| "LIVESTREAM_STARTING"
| "LIVESTREAM_STARTED"
| "LIVESTREAM_STOPPING";
/**
* This represents the current state of the meeting recording.
*/
recordingState:
| "RECORDING_STOPPED"
| "RECORDING_STARTING"
| "RECORDING_STARTED"
| "RECORDING_STOPPING";
/**
* This represents the current state of the HLS stream.
*/
hlsState: "HLS_STOPPED" | "HLS_STARTING" | "HLS_STARTED" | "HLS_STOPPING";
/**
* This represents the URLs associated with the ongoing HLS stream.
*
* - **playbackHlsUrl** – URL used for playback.
* - **livestreamUrl** – URL used for live streaming.
* - ~~**downstreamUrl**~~ – **Deprecated**. Use `playbackHlsUrl` or `livestreamUrl` instead.
*
* > **Note**
* >
* > `downstreamUrl` is deprecated and should no longer be used.
*/
hlsUrls: {
downstreamUrl?: string;
playbackHlsUrl?: string;
livestreamUrl?: string;
};
/**
* This represents the current state of real-time transcription.
*/
transcriptionState:
| "TRANSCRIPTION_STARTING"
| "TRANSCRIPTION_STARTED"
| "TRANSCRIPTION_STOPPING"
| "TRANSCRIPTION_STOPPED";
/**
* This represents whether End-to-End Encryption (E2EE) is enabled for the meeting.
*/
isE2EEEnabled: 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.
*/
pinnedParticipants: Map<
string,
{
cam: boolean;
share: boolean;
}
>;
/**
* This represents the currently selected camera device used during the meeting,returned as a {@link CameraDeviceInfo} object containing details about the active camera.
*/
selectedCameraDevice: CameraDeviceInfo;
/**
* This represents the currently selected microphone device used during the meeting,returned as a {@link MicrophoneDeviceInfo} object containing details about the active microphone.
*/
selectedMicrophoneDevice: MicrophoneDeviceInfo;
/**
* It allows access to the {@link pubSub} functionality.
*/
pubSub: pubSub;
/**
* It allows access to the {@link realtimeStore} functionality.
*/
realtimeStore: realtimeStore;
/**
* - 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 {@link MeetingEvent.meeting-joined | meeting-joined} event once the meeting is successfully joined.
* - Remote participants receive a {@link MeetingEvent.participant-joined | participant-joined} event containing the newly joined participant.
*
* @throws
* - {@link Errors.ERROR_OPERATION_IN_PROGRESS} — join is already in progress
* - {@link Errors.ERROR_ALREADY_IN_REQUESTED_STATE} — already joined
* - {@link Errors.ERROR_UNABLE_TO_JOIN_MEETING} — server/network failure (invalid token, unauthorized meetingId, media connection failed, etc.)
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.join();
* } catch (err) {
* console.log("Error in join", err);
* }
* ```
*/
join(): Promise<void>;
/**
* - This method can be used to leave the currently joined meeting.
*
* **Events associated with `leave()`:**
*
* - The local participant receives a {@link MeetingEvent.meeting-left | meeting-left} event.
* - All remote participants receive a {@link MeetingEvent.participant-left | participant-left} event containing the participant ID of the user who left.
*
* @throws
* - {@link Errors.ERROR_ALREADY_IN_REQUESTED_STATE} — already left (double leave, host closed, disconnected)
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — never joined
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.leave();
* } catch (err) {
* console.log("Error in leave", err);
* }
* ```
*/
leave(): Promise<void>;
/**
* - This method can be used to change the local participant's mode.
* - You can switch between the following modes: {@link 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()`:**
*
* - The participant receives a {@link MeetingEvent.participant-mode-changed | participant-mode-changed} event when the mode is successfully updated.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_ALREADY_IN_REQUESTED_STATE} — already in that mode
* - {@link Errors.CHANGE_MODE_FAILED} — server rejected the change-mode request
* @example
* ```ts
* 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);
* }
* ```
*/
changeMode(
mode: "SEND_AND_RECV" | "SIGNALLING_ONLY" | "RECV_ONLY"
): Promise<void>;
/**
* - This method can be used to end the current meeting session for all participants.
* - Calling `end()` removes all participants, including the local participant, and permanently terminates the meeting.
*
* **Events associated with `end()`:**
*
* - All participants receive the {@link MeetingEvent.meeting-left | meeting-left} event.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ERROR_END_MEETING_FAILED} — server rejected the end request (reason bubbled up)
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.end();
* } catch (err) {
* console.log("Error in end", err);
* }
* ```
*/
end(): Promise<void>;
/**
* - 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 {@link MeetingEvent.entry-requested | entry-requested} event.
*
* @param participantId
* The ID of the participant whose entry request is being responded to.
*
* @param decision
* The final decision for the entry request.
*
* **Possible values:**
* - `"allowed"` – Allow the participant to join.
* - `"denied"` – Deny the participant’s entry request.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.RESPOND_ENTRY_FAILED} — server rejected the entry-response
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.respondEntry("participant-id", "allowed");
* } catch (err) {
* console.log("Error in respondEntry", err);
* }
* ```
*/
respondEntry(
participantId: string,
decision: "allowed" | "denied"
): Promise<void>;
/**
* - This method can be used to disable the local participant’s microphone.
*
* **Events associated with `muteMic()`:**
*
* - A {@link ParticipantEvent.stream-disabled | stream-disabled} event is emitted with the corresponding {@link Stream} object.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ERROR_ACTION_NOT_SUPPORTED_IN_MODE} — not allowed in viewer/RECV_ONLY mode
* - {@link Errors.ERROR_OPERATION_IN_PROGRESS} — change-mode / mic-enable / mic-disable already in flight
* - {@link Errors.ERROR_ALREADY_IN_REQUESTED_STATE} — mic is already disabled
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.muteMic();
* } catch (err) {
* console.log("Error in muteMic", err);
* }
* ```
*/
muteMic(): Promise<void>;
/**
* - This method can be used to enable the local participant’s microphone.
*
* **Events associated with `unmuteMic()`:**
*
* - A {@link ParticipantEvent.stream-enabled | stream-enabled} event is emitted with the corresponding {@link Stream} object.
*
* @param customAudioTrack
* An optional custom audio track to be used instead of the default one.
*
* To learn more, checkout this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/render-media/optimize-audio-track)
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ERROR_ACTION_NOT_SUPPORTED_IN_MODE} — not allowed in viewer/RECV_ONLY mode
* - {@link Errors.ERROR_OPERATION_IN_PROGRESS} — change-mode / mic-enable / mic-disable already in flight
* - {@link Errors.ERROR_ALREADY_IN_REQUESTED_STATE} — mic is already enabled
* - {@link Errors.ERROR_MEDIA_DEVICE_NOT_LOADED} — media device not loaded
* - {@link Errors.ERROR_MICROPHONE_ACCESS_UNAVAILABLE} — microphone access unavailable
* - {@link Errors.ERROR_MEDIA_DEVICE_NOT_INITIALIZED} — media device not initialized
* - {@link Errors.ERROR_NO_MICROPHONE_DEVICE_FOUND} — no microphone device found
* - {@link Errors.ERROR_MEDIA_NOT_READY} — transport not ready
* - {@link Errors.ERROR_MICROPHONE_PRODUCE_FAILED} — microphone track could not be published
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.unmuteMic();
* } catch (err) {
* console.log("Error in unmuteMic", err);
* }
* ```
*/
unmuteMic(customAudioTrack?: MediaStream): Promise<void>;
/**
* - This method can be used to disable the local participant’s webcam.
*
* **Events associated with `disableWebcam()`:**
*
* - A {@link ParticipantEvent.stream-disabled | stream-disabled} event is emitted with the corresponding {@link Stream} object.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ERROR_ACTION_NOT_SUPPORTED_IN_MODE} — not allowed in viewer/RECV_ONLY mode
* - {@link Errors.ERROR_OPERATION_IN_PROGRESS} — change-mode / webcam-enable / webcam-disable already in flight
* - {@link Errors.ERROR_ALREADY_IN_REQUESTED_STATE} — webcam is already disabled
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.disableWebcam();
* } catch (err) {
* console.log("Error in disableWebcam", err);
* }
* ```
*/
disableWebcam(): Promise<void>;
/**
* - This method can be used to enable the local participant’s webcam.
*
* **Events associated with `enableWebcam()`:**
*
* - A {@link ParticipantEvent.stream-enabled | stream-enabled} event is emitted with the corresponding {@link Stream} object.
*
* @param customVideoTrack
* An optional custom video track to be used instead of the default one.
*
* To learn more, checkout this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/render-media/optimize-video-track)
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ERROR_ACTION_NOT_SUPPORTED_IN_MODE} — not allowed in viewer/RECV_ONLY mode
* - {@link Errors.ERROR_OPERATION_IN_PROGRESS} — change-mode / webcam-enable / webcam-disable already in flight
* - {@link Errors.ERROR_ALREADY_IN_REQUESTED_STATE} — webcam is already enabled
* - {@link Errors.ERROR_MEDIA_DEVICE_NOT_LOADED} — media device not loaded
* - {@link Errors.ERROR_CAMERA_ACCESS_UNAVAILABLE} — camera access unavailable
* - {@link Errors.ERROR_MEDIA_DEVICE_NOT_INITIALIZED} — media device not initialized
* - {@link Errors.ERROR_NO_WEBCAM_DEVICE_FOUND} — no webcam device found
* - {@link Errors.ERROR_NO_SUPPORTED_VIDEO_CODEC} — no supported video codec available
* - {@link Errors.ERROR_MEDIA_NOT_READY} — transport not ready
* - {@link Errors.ERROR_WEBCAM_PRODUCE_FAILED} — webcam track could not be published
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.enableWebcam();
* } catch (err) {
* console.log("Error in enableWebcam", err);
* }
* ```
*/
enableWebcam(customVideoTrack?: MediaStream): Promise<void>;
/**
* - This method can be used to disable screen sharing for the local participant.
*
* **Events associated with `disableScreenShare()`:**
*
* - A {@link ParticipantEvent.stream-disabled | stream-disabled} event is emitted with the corresponding {@link Stream} object.
* - A {@link MeetingEvent.presenter-changed | presenter-changed} event is emitted with `null` as the presenter.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ERROR_ACTION_NOT_SUPPORTED_IN_MODE} — not allowed in viewer/RECV_ONLY mode
* - {@link Errors.ERROR_OPERATION_IN_PROGRESS} — share-enable is in flight or share is already disabling
* - {@link Errors.ERROR_ALREADY_IN_REQUESTED_STATE} — screen share is already disabled
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.disableScreenShare();
* } catch (err) {
* console.log("Error in disableScreenShare", err);
* }
* ```
*/
disableScreenShare(): Promise<void>;
/**
* - This method can be used to enable screen sharing for the local participant.
*
* **Events associated with `enableScreenShare()`:**
*
* - A {@link ParticipantEvent.stream-enabled | stream-enabled} event is emitted with the corresponding {@link Stream} object.
* - A {@link MeetingEvent.presenter-changed | presenter-changed} event is emitted with the `presenterId`.
*
* @param customScreenSharingTrack An optional custom screen share track to be used instead of the default one.
*
* To learn more checkout this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/render-media/optimize-video-track#custom-screen-share-track)
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ERROR_ACTION_NOT_SUPPORTED_IN_MODE} — not allowed in viewer/RECV_ONLY mode
* - {@link Errors.ERROR_OPERATION_IN_PROGRESS} — share-disable is in flight
* - {@link Errors.ERROR_MEDIA_DEVICE_NOT_INITIALIZED} — media device not initialized
* - {@link Errors.ERROR_MEDIA_DEVICE_NOT_LOADED} — media device not loaded
* - {@link Errors.ERROR_GET_DISPLAY_MEDIA} — browser cannot getDisplayMedia
* - {@link Errors.ERROR_MEDIA_NOT_READY} — transport not ready
* - {@link Errors.ERROR_SCREENSHARE_PRODUCE_FAILED} — screen-share track could not be published
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.enableScreenShare();
* } catch (err) {
* console.log("Error in enableScreenShare", err);
* }
* ```
*/
enableScreenShare(customScreenSharingTrack?: MediaStream): Promise<void>;
/**
* - This method can be used to send a message to all participants in the meeting using the data channel.
*
* @param payload
* The data to be sent.
*
* - Supported types: `string`, `Blob`, `ArrayBuffer`, `ArrayBufferView`
* - Maximum allowed size: **15 KiB**
*
* @param options
* @param options.reliability
* Determines how the message is delivered:
*
* - {@link reliabilityMode.RELIABLE} — Guarantees delivery and preserves order (may introduce latency).
* - {@link reliabilityMode.UNRELIABLE} — Faster delivery but messages may be dropped under poor network conditions.
*
* @throws
* - {@link Errors.ERROR_ACTION_NOT_SUPPORTED} — invalid or too-large payload
* - {@link Errors.ERROR_MEDIA_NOT_READY} — transport not ready
* - {@link Errors.ERROR_ACTION_NOT_SUPPORTED_IN_MODE} — not allowed in viewer/RECV_ONLY mode
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ERROR_SEND_FAILED} — data-producer / send failed
* @example
* ```ts
* 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);
* }
* ```
* @returns
*/
send(
payload: string | Blob | ArrayBuffer | ArrayBufferView,
options?: {
reliability?: "RELIABLE" | "UNRELIABLE";
}
): Promise<boolean>;
/**
* - This method can be used to start real-time transcription for the meeting.
*
* - All participants, including the local participant, will receive the {@link transcriptionEvents.TRANSCRIPTION_STARTING | TRANSCRIPTION_STARTING} state in the {@link MeetingEvent.transcription-state-changed | transcription-state-changed} event.
*
* @param options
* @param options.webhookUrl
* A webhook URL that will be called whenever the transcription state changes.
*
* @param options.modelConfig
* Optional model configuration used during transcription.
*
* @param options.summary
* Configuration for real-time transcription summary generation.
*
* @param options.summary.enabled
* Enables or disables summary generation.
*
* @param options.summary.prompt
* Custom instructions used to guide summary generation.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.START_TRANSCRIPTION_FAILED} — server rejected the request
*
* @example
* ```ts
* 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);
* }
* ```
* @returns
*/
startTranscription(options?: {
webhookUrl?: string;
modelConfig?: object;
summary?: {
enabled: boolean;
prompt?: string;
};
}): Promise<void>;
/**
* - This method can be used to stop the ongoing real-time transcription.
*
* - All participants, including the local participant, will receive the {@link transcriptionEvents.TRANSCRIPTION_STOPPING | TRANSCRIPTION_STOPPING} state in the {@link MeetingEvent.transcription-state-changed | transcription-state-changed} event.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.STOP_TRANSCRIPTION_FAILED} — server rejected the request
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.stopTranscription();
* } catch (err) {
* console.log("Error in stopTranscription", err);
* }
* ```
*/
stopTranscription(): Promise<void>;
/**
* - This method can be used to start recording the meeting.
*
* - All participants, including the local participant, will receive the {@link recordingEvents.RECORDING_STARTING | RECORDING_STARTING} event state in the {@link MeetingEvent.recording-state-changed | recording-state-changed} event.
*
*
* @param config Recording configuration options.
*
* @param config.layout
* Defines how participants are arranged in the recording.
*
* @param config.layout.type
* Layout type for the recording.
*
* @param config.layout.priority
* Determines participant prioritization.
*
* @param config.layout.gridSize
* Maximum number of participants displayed simultaneously.
*
* @param config.theme
* Visual theme applied to the recording.
*
* @param config.mode
* Defines whether the recording includes video or audio only.
*
* @param config.quality
* Controls the output quality of the recording.
*
* @param webhookUrl
* Webhook URL triggered when the recording state changes.
*
* @param awsDirPath
* Path to the directory in your S3 bucket where recordings are stored.
*
* @param transcription
* Configuration for post-recording transcription and summary generation.
*
* @param transcription.enabled
* Enables or disables transcription.
*
* @param transcription.summary.enabled
* Enables or disables summary generation.
*
* @param transcription.summary.prompt
* Custom prompt used for generating transcription summaries.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.START_RECORDING_FAILED} — server rejected the request
* @example
* ```ts
* 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);
* }
* ```
*/
startRecording(
webhookUrl?: string,
awsDirPath?: string,
config?: {
layout?: {
type?: "GRID" | "SPOTLIGHT" | "SIDEBAR";
priority?: "SPEAKER" | "PIN";
gridSize?: number;
};
theme?: "DARK" | "LIGHT" | "DEFAULT";
mode?: "video-and-audio" | "audio";
quality?: "low" | "med" | "high";
},
transcription?: {
enabled: boolean;
summary?: {
enabled: boolean;
prompt?: string;
};
}
): Promise<void>;
/**
* - This method can be used to stop the ongoing meeting recording.
*
* - All participants, including the local participant, will receive the {@link recordingEvents.RECORDING_STOPPING | RECORDING_STOPPING} event state in the {@link MeetingEvent.recording-state-changed | recording-state-changed} event.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.STOP_RECORDING_FAILED} — server rejected the request
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.stopRecording();
* } catch (err) {
* console.log("Error in stopRecording", err);
* }
* ```
*/
stopRecording(): Promise<void>;
/**
* - 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 {@link livestreamEvents.LIVESTREAM_STARTING | LIVESTREAM_STARTING} state in the {@link MeetingEvent.livestream-state-changed | livestream-state-changed} event.
*
* @param outputs
* An array of RTMP output destinations where the livestream will be broadcast.
*
* @param config
* Configuration options for the RTMP livestream.
*
* @param config.layout.type
* Defines the layout used for the livestream.
*
* @param config.layout.priority
* Determines participant priority when composing the livestream layout.
*
* @param config.layout.gridSize
* Specifies the maximum number of participants displayed in the grid.
*
* @param config.theme
* Defines the color theme of the livestream.
*
* @param config.recording
* This can be used to enable or disable recording.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.START_LIVESTREAM_FAILED} — server rejected the request
* @example
* ```ts
* 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);
* }
* ```
*/
startLivestream(
outputs: Array<{
url: string;
streamKey: string;
}>,
config?: {
layout?: {
type?: "GRID" | "SPOTLIGHT" | "SIDEBAR";
priority?: "SPEAKER" | "PIN";
gridSize?: number;
};
theme?: "DARK" | "LIGHT" | "DEFAULT";
recording?: {
enabled: boolean;
};
}
): Promise<void>;
/**
* - This method can be used to stop the ongoing livestream.
* - All participants, including the local participant, will receive the {@link livestreamEvents.LIVESTREAM_STOPPING | LIVESTREAM_STOPPING} state in the {@link MeetingEvent.livestream-state-changed | livestream-state-changed} event.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.STOP_LIVESTREAM_FAILED} — server rejected the request
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.stopLivestream();
* } catch (err) {
* console.log("Error in stopLivestream", err);
* }
* ```
*/
stopLivestream(): Promise<void>;
/**
* - 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 {@link hlsEvents.HLS_STARTING | HLS_STARTING} event state in the {@link MeetingEvent.hls-state-changed | hls-state-changed} event.
*
* @param config Configuration used to control the HLS stream.
*
* @param config.layout.type
* Defines the layout used in the HLS stream.
*
* @param config.layout.priority
* Determines participant priority when composing the layout.
*
* @param config.layout.gridSize
* Specifies the maximum number of participants shown in the grid.
*
* @param config.theme
* Defines the visual theme of the HLS stream.
*
* @param config.mode
* Determines whether the stream includes video and audio or audio only.
*
* @param config.quality
* Defines the output video quality of the HLS stream.
*
* @param config.recording
* This can be used to enable or disable recording.
*
* @param transcription
* Configuration for post-meeting transcription and summary generation.
*
* @param transcription.enabled
* Enables or disables transcription.
*
* @param transcription.summary.enabled
* Enables or disables summary generation.
*
* @param transcription.summary.prompt
* Custom prompt used for generating the summary.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.START_HLS_FAILED} — server rejected the request
* @example
* ```ts
* 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);
* }
* ```
*/
startHls(
config?: {
layout?: {
type?: "GRID" | "SPOTLIGHT" | "SIDEBAR";
priority?: "SPEAKER" | "PIN";
gridSize?: number;
};
theme?: "DARK" | "LIGHT" | "DEFAULT";
mode?: "video-and-audio" | "audio";
quality?: "low" | "med" | "high";
recording?: {
enabled: boolean;
};
},
transcription?: {
enabled: boolean;
summary?: {
enabled: boolean;
prompt?: string;
};
}
): Promise<void>;
/**
* - This method can be used to stop the active HLS stream.
* - All participants, including the local participant, will receive the {@link hlsEvents.HLS_STOPPING | HLS_STOPPING} event state in the {@link MeetingEvent.hls-state-changed | hls-state-changed} event.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.STOP_HLS_FAILED} — server rejected the request
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.stopHls();
* } catch (err) {
* console.log("Error in stopHls", err);
* }
* ```
*/
stopHls(): Promise<void>;
/**
* - This method can be used to retrieve all available microphone devices connected to the system.
*
* @returns
*
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* const mics = await meeting?.getMics();
* console.log(mics);
* } catch (err) {
* console.log("Error in getMics", err);
* }
* ```
*/
getMics(): Promise<
Array<{
deviceId: string;
label: string;
}>
>;
/**
* - This method can be used to retrieve all available camera devices connected to the system.
*
* @returns
*
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* const webcams = await meeting?.getWebcams();
* console.log(webcams);
* } catch (err) {
* console.log("Error in getWebcams", err);
* }
* ```
*/
getWebcams(): Promise<
Array<{
deviceId: string;
label: string;
facingMode: "front" | "environment";
}>
>;
/**
* - This method can be used to enable Adaptive Subscription.
* - Adaptive Subscription dynamically adjusts which video streams are subscribed to, based on participant visibility and current network conditions.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ADAPTIVE_SUBSCRIPTION_ENABLE_FAILED} — adaptive subscription is already enabled
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.enableAdaptiveSubscription();
* } catch (err) {
* console.log("Error in enableAdaptiveSubscription", err);
* }
* ```
*/
enableAdaptiveSubscription(): Promise<void>;
/**
* - This method can be used to disable Adaptive Subscription.
* - When disabled, all video streams remain subscribed regardless of visibility or network conditions.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ADAPTIVE_SUBSCRIPTION_DISABLE_FAILED} — adaptive subscription is already disabled
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.disableAdaptiveSubscription();
* } catch (err) {
* console.log("Error in disableAdaptiveSubscription", err);
* }
* ```
*/
disableAdaptiveSubscription(): Promise<void>;
/**
* - 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.
*
* @param options Configuration for switching meetings.
*
* @param options.meetingId
* The ID of the meeting to switch to.
*
* @param options.token
* Authentication token for the destination meeting.
*
* @throws
* - {@link Errors.ERROR_INVALID_PARAMETER} — invalid meetingId
* - {@link Errors.SWITCH_MEETING_FAILED} — server rejected the switch-meeting request
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* @example
* ```ts
* 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);
* }
* ```
*/
switchTo(options: { meetingId: string; token?: string }): Promise<void>;
/**
* - 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 {@link MeetingEvent.media-relay-started | media-relay-started} event.
*
* @param options Configuration for media relay.
*
* @param options.destinationMeetingId
* The ID of the destination meeting where media will be relayed.
*
* @param options.token
* Authentication token for the destination meeting.
*
* @param options.kinds
* Specifies which media tracks should be relayed.
*
* @returns
* A promise that resolves once the relay request is successfully processed.
*
* @throws
* - {@link Errors.ERROR_INVALID_PARAMETER} — missing destinationMeetingId
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.REQUEST_MEDIA_RELAY_FAILED} — server rejected the request
* @example
* ```ts
* 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);
* }
* ```
*/
requestMediaRelay(options: {
destinationMeetingId: string;
token?: string;
kinds?: Array<"audio" | "video" | "share">;
}): Promise<void>;
/**
* - This method can be used to stop the ongoing media relay to a destination meeting.
* - Once stopped, the local participant will receive the {@link MeetingEvent.media-relay-stopped | media-relay-stopped} event.
*
* @param destinationMeetingId
* The ID of the destination meeting where media relay should be stopped.
*
* @throws
* - {@link Errors.ERROR_INVALID_PARAMETER} — missing destinationMeetingId
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.STOP_MEDIA_RELAY_FAILED} — server rejected the request
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.stopMediaRelay("destination-meeting-id");
* } catch (err) {
* console.log("Error in stopMediaRelay", err);
* }
* ```
*/
stopMediaRelay(destinationMeetingId: string): Promise<void>;
/**
* - This method can be used to pause active media streams in the meeting.
* - The local participant will receive the {@link MeetingEvent.paused-all-streams | paused-all-streams} event.
*
* @param kind
* Specifies which type of media stream should be paused. If not provided, **all media streams** (audio, video, and screen share) will be paused.
*
* @throws
* - {@link Errors.PAUSE_ALL_STREAMS_FAILED} — server rejected the request
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.pauseAllStreams("video");
* } catch (err) {
* console.log("Error in pauseAllStreams", err);
* }
* ```
*/
pauseAllStreams(
kind?: "audio" | "video" | "shareAudio" | "share" | "all"
): Promise<void>;
/**
* - This method can be used to resume media streams that were previously paused.
* - The local participant will receive the {@link MeetingEvent.resumed-all-streams | resumed-all-streams} event.
*
* @param kind
* Specifies which type of media stream should be resumed.If not provided, **all media streams** (audio, video, and screen share) will be resumed.
*
* @throws
* - {@link Errors.RESUME_ALL_STREAMS_FAILED} — server rejected the request
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.resumeAllStreams("video");
* } catch (err) {
* console.log("Error in resumeAllStreams", err);
* }
* ```
*/
resumeAllStreams(
kind?: "audio" | "video" | "shareAudio" | "share" | "all"
): Promise<void>;
/**
* - 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.
*
* @param object
* Either:
* - A `deviceId` string of the microphone to switch to, or
* - A `MediaStream` to be used as the audio input source.
*
* @throws
* - Everything {@link Meeting.muteMic | muteMic} and {@link Meeting.unmuteMic | unmuteMic} can throw
* - {@link Errors.ERROR_NO_MICROPHONE_DEVICE_FOUND} — no microphone device found for the given id
* @example
* ```ts
* 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);
* }
* ```
*/
changeMic(object: string | MediaStream): Promise<void>;
/**
* - 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.
*
* @param object
* Either:
* - A `deviceId` of the webcam to switch to, or
* - A `MediaStream` to be used as the video source.
*
* @throws
* - Everything {@link Meeting.disableWebcam | disableWebcam} and {@link Meeting.enableWebcam | enableWebcam} can throw
* - {@link Errors.ERROR_NO_WEBCAM_DEVICE_FOUND} — no webcam device found for the given id
* - {@link Errors.ERROR_OPERATION_IN_PROGRESS} — a webcam change/enable is already in flight
* @example
* ```ts
* 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);
* }
* ```
*/
changeWebcam(object: string | MediaStream): Promise<void>;
/**
* - 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).
*
* @param stream
* The new `MediaStream` to publish as the webcam.
*
* @throws
* - Everything {@link Meeting.enableWebcam | enableWebcam} can throw (publish failure is re-thrown)
* - {@link Errors.ERROR_WEBCAM_PRODUCE_FAILED} — new webcam track could not be published
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.replaceWebcamStream(newStream);
* } catch (err) {
* console.log("Error in replaceWebcamStream", err);
* }
* ```
*/
replaceWebcamStream(stream: MediaStream): Promise<void>;
/**
* - 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.
*
* @param quality
* Specifies the desired webcam quality.
*
* **Allowed values:**
* - `"low"` – Low video quality
* - `"med"` – Medium video quality
* - `"high"` – High video quality
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.ERROR_WEBCAM_NOT_ENABLED} — the webcam is not enabled
* - {@link Errors.ERROR_ALREADY_IN_REQUESTED_STATE} — already at that quality
* - {@link Errors.ERROR_SET_WEBCAM_QUALITY_FAILED} — invalid quality or layer switch failed
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.setWebcamQuality("high");
* } catch (err) {
* console.log("Error in setWebcamQuality", err);
* }
* ```
*/
setWebcamQuality(quality: "low" | "med" | "high"): Promise<void>;
/**
* - This method can be used to start the whiteboard session.
* - All participants, including the local participant, will receive the {@link MeetingEvent.whiteboard-started | whiteboard-started} event.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.START_WHITEBOARD_FAILED} — server rejected the request
* - {@link Errors.WHITEBOARD_OPERATION_IN_PROGRESS} — a whiteboard operation is already in progress
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.startWhiteboard();
* } catch (err) {
* console.log("Error in startWhiteboard", err);
* }
* ```
*/
startWhiteboard(): Promise<void>;
/**
* - This method can be used to stop the ongoing whiteboard session.
* - All participants, including the local participant, will receive the {@link MeetingEvent.whiteboard-stopped | whiteboard-stopped} event.
*
* @throws
* - {@link Errors.ERROR_ACTION_PERFORMED_BEFORE_MEETING_JOINED} — called before meeting is joined
* - {@link Errors.ERROR_MEETING_RECONNECTING} — meeting is reconnecting
* - {@link Errors.STOP_WHITEBOARD_FAILED} — server rejected the request
* - {@link Errors.WHITEBOARD_OPERATION_IN_PROGRESS} — a whiteboard operation is already in progress
* @example
* ```ts
* let meeting;
*
* // Initialize Meeting
* meeting = VideoSDK.initMeeting({
* // ...
* });
*
* try {
* await meeting?.stopWhiteboard();
* } catch (err) {
* console.log("Error in stopWhiteboard", err);
* }
* ```
*/
stopWhiteboard(): Promise<void>;
/**
* - 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.
*
* @param options
*
* @param options.base64Data
* Base64-encoded representation of the file.
*
* @param options.token
* VideoSDK authentication token. Learn more about tokens [here](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/authentication-and-token).
*
* @param options.fileName
* Name of the file including its extension.
*
* @throws
* - {@link Errors.ERROR_INVALID_PARAMETER} — missing or invalid options (base64Data / token / fileName)
* - {@link Errors.ERROR_FILE_UPLOAD_FAILED} — server rejected the upload request
* @example
* ```ts
* 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);
* }
* ```
*/
uploadBase64File(options: {
base64Data: string;
token: string;
fileName: string;
}): Promise<string | null>;
/**
* - This method can be used to retrieve a previously uploaded file from VideoSDK's temporary storage.
* - The returned value is a Base64-encoded string.
*
* @param options
*
* @param options.url
* The file URL returned by {@link uploadBase64File | uploadBase64File()}.
*
* @param options.token
* VideoSDK authentication token.
*
* @returns A Base64-encoded string of the requested file.
*
* @throws
* - {@link Errors.ERROR_INVALID_PARAMETER} — missing or invalid options (url / token)
* - {@link Errors.ERROR_FILE_FETCH_