Join Live Stream - JavaScript
Once, the live stream is configured, the next step is to join it. With our JS SDK, you can call the join() method. If you have not initialized the live stream yet, you can follow the guide here.
join()
- To join the live stream you can call the
join()method wmethod on the createdliveStreamobject. - This method can be invoked after the ive stream is initialized using the
initMeetingmethod.
Events associated with the join() method
Following events are received when a participant successfully joins the livestream.
- The Local Participant will receive the
meeting-joinedevent, when the live stream is successfully joined. - All the Remote Participants—including all the hosts and audience members—will receive the
participant-joinedevent with the newly joinedParticipantobject from the event callback.
let liveStream;
// Initialize Meeting
liveStream = VideoSDK.initMeeting({
// ...
});
const joinBtn = document.getElementById("joinBtn");
joinBtn.addEventListener("click", () => {
// Joining Meeting
liveStream?.join();
});
liveStream.on("meeting-joined", () => {
console.log("liveStream Joined Successfully");
});
liveStream.on("participant-joined", (participant) => {
console.log("New Participant Joined: ", participant.id);
});
leave()
- To leave the live stream you can call the
leave()method on the createdliveStreamobject.
note
This method can be called only after the live stream is joined successfully.
Events associated with the leave() method
Following callbacks are received when a participant leaves the live stream.
- The Local Participant will receive the
meeting-leftevent, once they have successfully left the livestream. - All the Remote Participants—including all the hosts and audience members—will receive the
participant-leftevent with theParticipantobject of the user who left the livestream.
let liveStream;
// Initialize Meeting
liveStream = VideoSDK.initMeeting({
// ...
});
const leaveBtn = document.getElementById("leaveBtn");
leaveBtn.addEventListener("click", () => {
liveStream?.leave();
});
liveStream.on("meeting-left", () => {
console.log("liveStream left Successfully");
});
liveStream.on("participant-left", (participant) => {
console.log("Participant left: ", participant.id);
});
API Reference
The API references for all the methods and events utilized in this guide are provided below.
Got a Question? Ask us on discord

