Meeting Class Methods
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
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 Integrationconfig: 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.
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:
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",
};
startRecording(webhookUrl, awsDirPath, config);
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.
Parameters
- outputs: Array<{ url: String, streamKey: String }>
- config:
- layout:
- type: "GRID" | "SPOTLIGHT" | "SIDEBAR"
- priority: "SPEAKER" | "PIN"
- gridSize: Number
max 25
- theme: "DARK" | "LIGHT" | "DEFAULT"
- layout:
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",
};
startLivestream(outputs, config);
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.
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"
- layout:
Returns
void
Example
const config = {
layout: {
type: "SPOTLIGHT",
priority: "PIN",
gridSize: 9,
},
theme: "DEFAULT",
};
startHls(config);
stopHls()
- It is used to stop meeting HLS.
- All participants and localParticipant, will receive
hls-stopped
event.
Returns
void
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
connectTo()
- This method is used for establishing the connection to other meetings.
Parameters
meetingId
type :
String
meetingId of another meeting
payload
type :
String
Any arbitrary payload data for the connection
Events associated with connectTo()
:
connection-open
event of meeting class is triggered to all participants whenevermeeting.connectTo()
being called.
Returns
void
Example
//create connection to meeting B
meeting.connectTo({ meetingId: "meeting_B_ID", payload: "arbitraty text" });
// This event will be emitted to participants of both meetings, Meeting A & Meeting B
meeting.on("connection-open", (connection) => {
console.log("Connection", connection);
});
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