Observe In-meeting States
Web Embed SDK exposes many variables which will let you know the different states of a meeting. All the variables which are available in Web Embed SDK are "observable".
API/Function observe allows observing the changes to the property. Provide the property that you are interested in call-back. Whenever the property value changes, you will be notified via callback.
There are several different variables you can access to get the current meeting state. The list of supported properties can be observed with the observe property:
- audioMuted
- canShareScreen
- chatMessages
- connectionState
- isSDKInitComplete
- participants
- receivingScreenShare
- remoteAudioMuted
- selfParticipant
- sharingScreen
- version
- videoMuted
- videoState
An example to use observe for observing audioMuted flag has been provided below:
Audio State
Once you join a meeting and have waited for initialization, now you will be able to query for various meeting states. For example, If you want to know the state of a user has muted or not, use BJNEmbedSDK.audioMuted to access the details. Use the following code to print whether the user is audio muted or not
console.log("User is muted: " + BJNEmbedSDK.audioMuted)
You can observe the property value change with the following command.
BJNEmbedSDK.observe('audioMuted', ()=> {
console.log("User is muted: " + BJNEmbedSDK.audioMuted)
})
Usecases
All properties of Web Embed SDK are observable. Below are the use-cases that explain the status of the user during the meeting/are being in the lobby, and the participant who uniquely joined the meeting.
Determine if the current user is live in the meeting vs. being in the lobby
To know the current state of the user in the meeting.
BJNConnectionState : Connected
videoState is a property that provides the value, whether the video is being received from other participants or not in the meeting.
- If the video is being received from other participants this value will be
Active. - If the video is not being received from other participants this value will be
INACTIVE_NO_ONE_HAS_VIDEO
BJNEmbedSDK.videoState: ACTIVE or INACTIVE_NO_ONE_HAS_VIDEO
Uniquely identify meeting participant
Participant has a unique identifier. “participantGuid” represents each participant who has joined the meeting uniquely. A sample code to check if a participant is present in a meeting when a user has landed on the meeting screens.
searchParticipant(searchedParticipant) {
return BJNEmbedSDK.participants.find(participant =>
participant.participantGuid === searchedParticipant.participantGuid)
}