Manage Roles - Javascript
Roles with VideoSDK
When engaging in interactive live streaming, managing user roles is crucial. VideoSDK supports two participant modes to facilitate role management:
1. SEND_AND_RECV When a participant joins with the mode set to SEND_AND_RECV, they have the capability to both publish and consume the media of other participants. Additionally, they can interact with others using features like chat and polls.
2. SIGNALLING_ONLY When a participant joins with the mode set to SIGNALLING_ONLY, they are restricted from both publishing and consuming any media from other participants. However, they can still interact with other participants using features like chat and polls.
Important Changes Javascript SDK in Version v0.1.4
- The following modes have been deprecated:
CONFERENCEhas been replaced bySEND_AND_RECVVIEWERhas been replaced bySIGNALLING_ONLY
Please update your implementation to use the new modes.
⚠️ Compatibility Notice:
To ensure a seamless meeting experience, all participants must use the same SDK version.
Do not mix version v0.1.4 + with older versions, as it may cause significant conflicts.

When to use the Roles?
1. Simple Adaptive Streaming
-
Simple Adaptive Streaming (SAS) is a type of livestreaming designed for events where minimal interaction between the host and viewers is preferred.
-
Ideal for scenarios with a large audience that does not actively engage with the host, SAS operates with each speaker participating in a VideoSDK meeting in
SEND_AND_RECVmode. -
In SAS, each speaker attends a VideoSDK meeting in
SEND_AND_RECVmode, while viewers can simply watch the livestream using theplaybackHlsUrlorlivestreamUrl. Unlike the speakers, viewers do not need to join the meeting inSEND_AND_RECVorSIGNALLING_ONLYmode. This allows for a seamless streaming experience without any unnecessary interruptions or distractions.playbackHlsUrl- Live HLS with playback supportlivestreamUrl- Live HLS without playback support
downstreamUrl is now depecated. Use playbackHlsUrl or livestreamUrl in place of downstreamUrl
2. Adaptive Streaming with increased engagement
-
If you aim to enhance engagement with your audience during a live streaming event, Adaptive Streaming technology is the way to go. This approach allows you to integrate interactive features like polls and conversations, empowering viewers to join and leave the livestream at the host's discretion.
-
To implement this, ensure that all speakers join as
SEND_AND_RECVmode participants, while the audience joins asSIGNALLING_ONLYmode participants. This setup enables everyone to actively participate in the interactive elements of the live stream, creating a more dynamic and engaging experience for all involved.
Using roles
The mode of the participants is configured during the meeting initialization using initMeeting.
VideoSDK.config(token);
const meeting = VideoSDK.initMeeting({
meetingId: "<Id-of-meeting>",
name: "<Name-of-participant>",
micEnabled: true,
webcamEnabled: true,
mode: "SEND_AND_RECV", // allowed: SEND_AND_RECV | SIGNALLING_ONLY
});
Getting Participant Mode
The role of the participant is identified using the mode property of the participant object.
const participants = meeting.participants;
const participant = participants.get("<participant-id>");
const participantMode = participant.mode;
Changing Participant's Mode
Suppose you are hosting a livestream and wish to have one of your viewers join the livestream with you. In this scenario, you can modify the mode of the participant using the changeMode() method of the meeting object.
let meeting;
// Initialize Meeting
meeting = VideoSDK.initMeeting({
// ...
});
// For SEND_AND_RECV mode
meeting?.changeMode(Constants.modes.SEND_AND_RECV);
// For SIGNALLING_ONLY mode
meeting?.changeMode(Constants.modes.SIGNALLING_ONLY);
API Reference
The API references for all the methods utilized in this guide are provided below.
Got a Question? Ask us on discord

