Joining a meet

Meet feature is essential for the modern day communication. Meet sdk allows users to make a audio/video meet with the another sdk users.

Subscribe#

caution

If Group calls feature is unavailable for your plan, then it will throw 403 exception

SDK require the User to subscribe the link before joining the meet. Use the subscribeCall method to subscribe the meet link.

SDK.subscribeCall('MEET_LINK', 'USERNAME', (success, error) => {
if(error){
console.log(error.message)
} else {
// You can proceed with the success response
}
});

Request Params#

ParamDescriptionTypeRequired
MEET_LINKMeet linkStringtrue
USERNAMEDisplay Name of the current userStringfalse
CALLBACKCallback method to handle success/errorFunctiontrue

Success/Error Object#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

Preview Screen Options#

Users can be provided with a preview screen in the UI to observe the meet events like rendering the preview video, updating the users in meet and mute the audio or video even before joining the meet.

User Track Listener#

You will receive your video/audio track in the userTrackListener callback.

function userTrackListener(response) {}
Sample Response:#
// Response Structure
{
localUser: 'BOOLEAN',
track: 'TRACK_OBJECT',
trackType: "audio|video",
userJid: "FROM_USER_JID",
usersStatus: "USERS_ARRAY_OF_OBJECT"
}
Response Property Details:#
PropertyDescription
localUserIdentify whether the track is belongs to local or remote user
true - Local user
false - Remote user.
trackTrack object
trackTypeContain audio or video to identify type of track.
userJidFrom user JID
usersStatusArray of users with details.
Sample Javascript code to play the track#
<html>
<audio id="audio" autoplay playsinline></audio>
<video id="video" autoplay playsinline></video>
<script>
//let track = TRACK_OBJECT from the callback method
//let element = ELEMENT_OBJECT in which you need to play the audio/video
let stream = new MediaStream([track]);
try {
element.srcObject = stream;
} catch (e) {
try {
element.src = URL.createObjectURL(stream);
} catch (e) {
console.error("Error attaching stream to element", e);
}
}
</script>
</html>

You need to supply the track object which was received in the callback method to the audio/video element based on the track type that you have received.

warning

You shouldn't play your own Audio track.

Users Update Listener#

After subscribe success callback, callUsersUpdateListener will be triggered that will hold the list of users on the meet. You can use this event to show the users list in the preview screen. This event callUsersUpdateListener will be triggered whenever there is a change in users list. So you can add/remove users from the preview UI. If callUsersUpdateListener triggered with empty users list, then there are no users in the meet.

function callUsersUpdateListener(response) {}
Sample Response:#
// Response Structure
{
userJid: "FROM_USER_JID",
localUser: true,
usersList: ["USER_JID", "USER_JID"]
}
Response Property Details:#
PropertyDescription
userJidUser JID of current user
localUserUser JID is current logged in user or another user
usersListList of users on the meet

Unsubscribe#

When you are in the preview screen and decided to close the UI without joining the meet, you need to clear/unsubscribe the meet data by using the unsubscribeCall method.

await SDK.unsubscribeCall();

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess MessageString

Join#

To join a meet use the joinCall method.

SDK.joinCall((success, error) => {
if(error){
console.log(error.message)
} else {
// You can proceed with the success response
}
});

Request Params#

ParamDescriptionTypeRequired
CALLBACKCallback method to handle success/errorFunctiontrue

Success/Error Object#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString

End#

After joining to the meet, if you need to end the ongoing meet you can use the endCall method.

await SDK.endCall();

Response Format#

{
statusCode: 200, // Number - status code
message: "", // String - Success/Error Message
}

Response Params#

ArgumentsDescriptionType
statusCodeStatus CodeNumber
messageSuccess/Error MessageString