Meeting Class Methods - Javascript
join()
- It is used to join a meeting.
- After meeting initialization by
initMeeting()
it returns a new instance of Meeting. However, by default, it will not automatically join the meeting. Hence, to join the meeting you should calljoin()
.
Events associated with join()
:
- Local Participant will receive a
meeting-joined
event when successfully joined. - Remote Participant will receive a
participant-joined
event with the newly joinedParticipant
object from the event callback.
Participant having ask_join
permission inside token
-
If a token contains the permission
ask_join
, then the participant will not join the meeting directly after callingjoin()
, but an event will be emitted to the participant having the permissionallow_join
calledentry-requested
. -
After the decision from the remote participant, an event will be emitted to the participant called
entry-responded
. This event will contain the decision made by the remote participant.
Participant having allow_join
permission inside token
- If a token containing the permission
allow_join
, then the participant will join the meeting derectly after callingjoin()
.
Returns
void
leave()
- It is used to leave the current meeting.
Events associated with leave()
:
- Local participant will receive a
meeting-left
event. - All remote participants will receive a
participant-left
event withparticipantId
.
Returns
void
end()
- It is used to end the current running session.
- By calling
end()
, all joined participants including localParticipant of that session will leave the meeting.
Events associated with end()
:
- All participants and localParticipant, will be emitted
meeting-left
event.
Returns
void
enableWebcam()
- It is used to enable self camera.
stream-enabled
event will be emitted withstream
object from the event callback, inside that participant object.
Returns
void
disableWebcam()
- It is used to disable self camera.
stream-disabled
event will be emitted withstream
object from the event callback, inside that participant object.
Returns
void
unmuteMic()
- It is used to enable self microphone.
stream-enabled
event will be emitted withstream
object from the event callback, inside that participant object.
Returns
void
muteMic()
- It is used to disable self microphone.
stream-disabled
event will be emitted withstream
object from the event callback, inside that participant object.
Returns
void
enableScreenShare()
-
it is used to enable screen-sharing.
-
stream-enabled
event will be emitted withstream
object from the event callback, inside that participant object. -
presenter-changed
will also receive a callback with thepresenterId
.
Returns
void
disableScreenShare()
-
It is used to disable screen-sharing.
-
stream-disabled
event will be emitted withstream
object from the event callback, inside that participant object. -
presenter-changed
will also receive a callback with thenull
.
Returns
void
uploadBase64File()
-
It is used to upload your file to Videosdk's Temporary storage
-
base64Data
convert your file to base64 and pass here. -
token
pass your videosdk token. Read more about token here -
fileName
provide your fileName with extension -
The method will return the corresponding fileUrl, which will use to retrieve the file from the VideoSDK's storage system.
Parameters
- base64Data: String
- token: String
- fileName: String
Returns
fileUrl
- It will use to retrieve the file from the VideoSDK's storage system.
Example
const fileUrl = await meeting.uploadBase64File({
base64Data: "<Your File's base64>", // Convert your file to base64 and pass here
token: "<VIDEOSDK_TOKEN>",
fileName: "myImage.jpeg", // Provide name with extension here,
});
console.log("fileUrl", fileUrl);
fetchBase64File()
-
It is used to retrieve your file from the Videosdk's Temporary storage
-
url
pass fileUrl which is returned by uploadBase64File() -
token
pass your videosdk token. Read more about token here -
The method will return image in form of base64 string.
Parameters
- url: String
- token: String
Returns
base64
- image in form of base64 string.
Example
let base64 = await meeting.fetchBase64File({
url: "<Your FileUrl>"; // Provide fileUrl which is returned by uploadBase64File(),
token :"<VIDEOSDK_TOKEN>",
});
console.log("base64", base64);
startRecording()
-
It is used to start meeting recording.
-
All participants and localParticipant, will receive
recording-started
event. -
webhookUrl
will be triggered when the recording is completed and stored in the server. Read more about webhooks here. -
awsDirPath
will be the path for your S3 bucket to which you want to store recordings. To allow us to store the recording in your S3 bucket, you will need to fill out this form by providing the required values. VideoSDK AWS S3 Integration -
config: mode
is used to either record video-and-audio both or only audio. And by default it will be video-and-audio. -
config: quality
is only applicable to video-and-audio. -
transcription: enabled
indicates whether post transcription is enabled. -
transcription: summary: enabled
Indicates whether post transcription summary generation is enabled. Only applicable when post transcription is enabled. -
transcription: summary: prompt
provides guidelines or instructions for generating a custom summary based on the post transcription content.
Parameters
- webhookUrl: String
- awsDirPath: String
- config:
- layout:
- type: "GRID" | "SPOTLIGHT" | "SIDEBAR"
- priority: "SPEAKER" | "PIN"
- gridSize: Number
max 4
- theme: "DARK" | "LIGHT" | "DEFAULT"
- mode: "video-and-audio" | "audio"
- quality: "low" | "med" | "high"
- orientation: "landscape" | "portrait"
- layout:
- transcription:
- enabled: Boolean
- summary:
- enabled: Boolean
- prompt: String
Returns
void
Example
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,
},
};
startRecording(webhookUrl, awsDirPath, config, transcription);
stopRecording()
- It is used to stop meeting recording.
- All participants and localParticipant, will receive
recording-stopped
event.
Returns
void
startLivestream()
-
It is used to start meeting live streaming.
-
You will be able to start live stream meetings to other platforms such as Youtube, Facebook, etc. that support
RTMP
streaming. -
All participants and localParticipant will receive the
livestream-started
event. -
transcription: enabled
indicates whether post transcription is enabled. -
transcription: summary: enabled
Indicates whether post transcription summary generation is enabled. Only applicable when post transcription is enabled. -
transcription: summary: prompt
provides guidelines or instructions for generating a custom summary based on the post transcription content.
Parameters
- outputs: Array<{ url: String, streamKey: String }>
- config:
- layout:
- type: "GRID" | "SPOTLIGHT" | "SIDEBAR"
- priority: "SPEAKER" | "PIN"
- gridSize: Number
max 25
- theme: "DARK" | "LIGHT" | "DEFAULT"
- recording:
- enabled: Boolean
- layout:
- transcription:
- enabled: Boolean
- summary:
- enabled: Boolean
- prompt: String
Returns
void
Example
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,
};
};
const transcription = {
enabled: true,
summary: {
enabled: true,
},
};
startLivestream(outputs, config, transcription);
stopLivestream()
- It is used to stop meeting livestreaming.
- All participants and localParticipant, will receive
livestream-stopped
event.
Returns
void
startHls()
-
It is used to start meeting HLS.
-
You will be able to start HLS and watch the live stream of meeting over HLS.
-
All participants and localParticipant, will receive the
hls-started
event. -
mode
is used to either start hls streaming of video-and-audio both or only audio. And by default it will be video-and-audio. -
quality
is only applicable to video-and-audio. -
transcription: enabled
indicates whether post transcription is enabled. -
transcription: summary: enabled
Indicates whether post transcription summary generation is enabled. Only applicable when post transcription is enabled. -
transcription: summary: prompt
provides guidelines or instructions for generating a custom summary based on the post transcription content.
Parameters
- config:
- layout:
- type: "GRID" | "SPOTLIGHT" | "SIDEBAR"
- priority: "SPEAKER" | "PIN"
- gridSize: Number
max 25
- theme: "DARK" | "LIGHT" | "DEFAULT"
- mode: "video-and-audio" | "audio"
- quality: "low" | "med" | "high"
- recording:
- enabled: Boolean
- layout:
- transcription:
- enabled: Boolean
- summary:
- enabled: Boolean
- prompt: String
Returns
void
Example
const config = {
layout: {
type: "SPOTLIGHT",
priority: "PIN",
gridSize: 9,
},
theme: "DEFAULT",
recording = {
enabled: true,
};
};
const transcription = {
enabled: true,
summary: {
enabled: true,
},
};
startHls(config, transcription);
stopHls()
- It is used to stop meeting HLS.
- All participants and localParticipant, will receive
hls-stopped
event.
Returns
void
startTranscription()
-
It is used to start realtime transcription.
-
All participants and localParticipant, will receive
TRANSCRIPTION_STARTING
event state andtranscription-text
event. -
config: webhookUrl
will be triggered when the state of realtime transcription is changed. Read more about webhooks here. -
config: summary: enabled
Indicates whether realtime transcription summary generation is enabled. Summary will be available after realtime transcription stopped. -
config: summary: prompt
provides guidelines or instructions for generating a custom summary based on the realtime transcription content.
Parameters
- config:
- webhookUrl: String
- summary:
- enabled: Boolean
- prompt: String
Returns
void
Example
const config = {
webhookUrl: "https://webhook.your-api-server.com",
summary: {
enabled: true,
prompt:
"Write summary in sections like Title, Agenda, Speakers, Action Items, Outlines, Notes and Summary",
},
};
startTranscription(config);
stopTranscription()
- It is used to stop realtime transcription.
- All participants and localParticipant, will receive
TRANSCRIPTION_STOPPING
event state.
Returns
void
Example
stopTranscription();
startWhiteboard()
-
It is used to start whiteboard.
-
All participants and localParticipant, will receive
WHITEBOARD_STARTED
event.
Returns
url
Example
startWhiteboard();
stopWhiteboard()
-
It is used to stop ongoing whiteboard.
-
All participants and localParticipant, will receive
WHITEBOARD_STOPPED
event.
Returns
void
Example
stopWhiteboard();
getWebcams()
- It will return all camera devices connected.
Returns
- Promise<{ deviceId: string; lable: string }[]>
Example
const handleGetWebcams = async () => {
const webcams = await getWebcams();
console.log(webcams);
};
handleGetWebcams();
changeWebcam()
- It is used to change the webcam device.
- If multiple webcam devices are connected, by using
changeWebcam()
one can change the camera device.
Parameters
- deviceId: String
Returns
void
setWebcamQuality()
- It is used to set the webcam quality.
- By using
setWebcamQuality()
, uploading of the webcam stream quality of localParticipant can be changed fromlow
tohigh
or vice versa.
Parameters
- quality: "low" | "med" | "high"
Returns
void
getMics()
- It will return all mic devices connected.
Returns
- Promise<{ deviceId: string; lable: string }[]>
Example
const handleGetMics = async () => {
const mics = await getMics();
console.log(mics);
};
handleGetMics();
changeMic()
- It is used to change the mic device.
- If multiple mic devices are connected, by using
changeMic()
one can change the mic device.
Parameters
- deviceId: String
Returns
void
on()
Parameters
- eventType :
event of meeting class
- listener :
function
Returns
void
Example
//for meeting-any-event
meeting.on("meeting-any-event", listener);
off()
Parameters
- eventType :
event of meeting class
- listener :
function
Returns
void
Example
//for meeting-any-event
meeting.off("meeting-any-event", listener);
changeMode()
- It is used to change the mode.
- You can toggle between the
CONFERENCE
andVIEWER
mode .CONFERENCE
: Both audio and video streams will be produced and consumed in this mode.VIEWER
: Audio and video streams will not be produced or consumed in this mode.
Parameters
- mode: String
Returns
void
Got a Question? Ask us on discord