Session Management

Session management covers moderator-level controls for an EnableX video session — recording, audio and video muting at the room and participant level, locking the room, managing who can enter, removing participants, extending or ending the session, managing user roles, and controlling how streams are highlighted.

Recording

Moderators can start and stop session recording on demand. When recording is active, EnableX captures all audio and video streams in the session. Because recording is a shared state, the SDK fires callbacks on every connected participant's app — so all clients can display a recording indicator in their UI simultaneously.

Recording parameters such as storage location, output format, and whether auto-recording is enabled are set when the room is created via the Video API. The SDK only controls whether recording is running within those pre-configured parameters.

Starting and Stopping Recording

Call Enx.startRecord() to begin recording. Call Enx.stopRecord() to end it. Both methods are moderator-only.

// Start recording the session
Enx.startRecord();

// Stop an active recording
Enx.stopRecord();

When either method completes, callbacks fire on all connected participants so every client can react:

Callback Who receives it When it fires
roomRecordOn All participants Recording has started.
roomRecordOff All participants Recording has stopped.

Register both callbacks in your eventHandlers object to drive your recording indicator UI:

const eventHandlers = {
  roomRecordOn: (data) => {
    // Show recording indicator to all participants
    this.setState({ isRecording: true });
  },
  roomRecordOff: (data) => {
    this.setState({ isRecording: false });
  }
};
Recording settings (auto-record, storage location, format) are configured when the room is created via the Video API — not in the SDK. The SDK only starts and stops recording within those parameters.

Playing a Recorded File

After a session ends, recordings are available via the EnableX portal or API. To play them in-app, use a video player component such as react-native-video. Recorded files on EnableX storage require HTTP Basic Authentication using your app_id and app_key — pass these as a request header when loading the video source.

import Video from 'react-native-video';

<Video
  source={{
    uri: 'https://api.enablex.io/v1/recordings/your_recording_id.mp4',
    headers: {
      Authorization: 'Basic ' + btoa(APP_ID + ':' + APP_KEY)
    }
  }}
  style={{ width: '100%', height: 300 }}
  controls={true}
/>
Recording playback credentials (app_id and app_key) must never be bundled in the app binary. Fetch the signed URL or credentials from your server at playback time.
Hard Muting

Hard muting lets moderators forcefully silence audio or disable video — either for all participants simultaneously, or for a single participant. Unlike self-muting, which a participant can undo themselves, a hard mute is applied remotely and can only be lifted by the moderator. Use it in webinars, lectures, or any scenario where you need guaranteed silence from participants.

Room-Level Mute

Room-level hard mute applies to all participants at once. Any participant who joins after the mute is applied is also muted automatically.

// Mute all audio in the room
Enx.hardMuteRoom(true);

// Unmute all audio
Enx.hardMuteRoom(false);

// Disable video for all participants
Enx.hardMuteRoomVideo(true);

// Enable video for all participants
Enx.hardMuteRoomVideo(false);

When room-level mute state changes, all participants receive the relevant callback so their apps can disable or re-enable controls appropriately:

Callback Fires when
roomAudioMuted Room-level audio mute applied. Fires on all participants.
roomAudioUnMuted Room-level audio mute lifted.
roomVideoMuted Room-level video mute applied.
roomVideoUnMuted Room-level video mute lifted.

Participant-Level Mute

To mute or unmute a specific participant, pass their clientId to the appropriate method. The affected participant receives a direct callback, and all other participants in the room also receive a broadcast so every client's UI stays in sync.

// Mute audio of a specific participant
Enx.hardMuteAudio(clientId, true);

// Unmute audio of a specific participant
Enx.hardMuteAudio(clientId, false);

// Disable video of a specific participant
Enx.hardMuteVideo(clientId, true);

// Enable video of a specific participant
Enx.hardMuteVideo(clientId, false);
Callback Fires when
participantAudioMuted A specific participant's audio was muted by the moderator.
participantAudioUnMuted A participant's audio mute was lifted.
participantVideoMuted A specific participant's video was muted.
participantVideoUnMuted A participant's video mute was lifted.
Room Lock and Unlock

Locking the room prevents any new participants from joining the session. Participants already connected remain unaffected and continue their session normally. Unlocking re-opens the room so new participants can join again. Only moderators can lock and unlock the room.

This is useful in scenarios where a meeting has already started and you do not want additional participants entering mid-session — for example, a confidential discussion or an interview that has begun.

// Lock the room — no new participants can join
Enx.lockRoom();

// Unlock the room — re-open for new participants
Enx.unlockRoom();

When room lock state changes, all participants in the room are notified:

Callback Fires when
roomLocked Room successfully locked. Fires on all participants.
roomUnlocked Room successfully unlocked.
Knock Mode — Managing Waiting Participants

When a room is configured in knock mode, participants cannot join immediately. Instead, they wait in a lobby until the moderator explicitly approves or denies their entry. This gives the moderator full control over who enters the session, making it suitable for secure meetings, interviews, and any context where vetting participants before entry matters.

The moderator receives a userAwaited callback for each participant waiting in the lobby. From there, the moderator can approve them — allowing entry — or deny them, which removes them from the lobby.

const eventHandlers = {
  userAwaited: (user) => {
    console.log('User waiting in lobby:', user.name, '| ID:', user.clientId);
    // Show approve/deny UI to the moderator
  }
};

// Approve a waiting participant — they enter the room
Enx.approveAwaitedUser(clientId);

// Deny a waiting participant — they are removed from the lobby
Enx.denyAwaitedUser(clientId);
Callback Fires when
userAwaited A new participant is waiting in the lobby. Fires on the moderator only.
awaitedUserApproved Moderator approved a waiting user — participant enters the room.
awaitedUserDenied Moderator denied a waiting user — participant is removed from lobby.
Removing Participants

Enx.dropUser(clientId) force-disconnects a participant from the session. The removed participant receives a userDisconnected event, and all other participants also receive this callback so their participant lists update immediately. This is a moderator-only action.

Use this to remove disruptive participants, or to clear users who have gone inactive and are holding a spot in the session.

// Remove a participant from the session
Enx.dropUser(clientId);
Callback Fires when
userDisconnected The targeted participant has been removed. Fires on all participants so every client's participant list stays current.
Extending the Session

Sessions have a maximum duration configured at room creation. As a session approaches its limit, EnableX will typically notify participants so they have an opportunity to extend before the room closes. Moderators can call Enx.extendConferenceDuration() to add more time to the current session without interrupting any participant's connection.

// Extend the session by an additional number of minutes
Enx.extendConferenceDuration(additionalMinutes);
Callback Fires when
sessionExtended Session duration extended successfully. Update any session timer displayed in your UI.
Ending the Session

Enx.destroy() ends the session for all participants immediately. This is different from Enx.disconnect(), which only disconnects the local user while leaving the session running for everyone else. Enx.destroy() terminates the entire room — every connected client receives a roomDestroyed callback and is forcibly disconnected. This is a moderator-only action.

When roomDestroyed fires on your participants' apps, navigate away from the video screen and release all session resources.

// End the session for everyone (moderator only)
Enx.destroy();
const eventHandlers = {
  roomDestroyed: (data) => {
    // Session has ended — navigate all clients away from the video screen
    this.props.navigation.navigate('Home');
  }
};
Callback Fires when
roomDestroyed Session ended. Fires on all participants. All clients should navigate away from the video screen and release resources.
Enx.destroy() is a destructive action. All participants lose their connection immediately. Use it only for deliberate session termination.
Switching User Roles

Enx.switchUserRole(clientId) promotes a participant to moderator or demotes a moderator to participant. This performs a full role swap — the targeted user immediately gains or loses all moderator capabilities. Use this to hand off session control without ending and restarting the session, for example when the original host needs to leave early and wants another person to take over.

When the role change completes, the SDK fires userRoleSwitched so all participants' apps can update any role-dependent UI (such as moderator controls).

// Promote a participant to moderator, or swap moderator to participant
Enx.switchUserRole(clientId);
const eventHandlers = {
  userRoleSwitched: (data) => {
    console.log('Role changed for:', data.clientId);
    console.log('New role:', data.role);
    // Update UI to show or hide moderator controls as appropriate
    updateUIForRole(data.role);
  }
};
Callback Fires when
userRoleSwitched Role change applied. The affected user's role is updated and all participants are notified.
Pinning and Spotlight

Moderators can control which participants' streams remain visible using pinning and spotlight. Both features affect the active talker list — the ordered set of streams your app renders in the main video layout.

Pinning keeps specified participants' streams in the active talker list regardless of whether they are currently speaking. Pinned users appear after active speakers. This is useful for keeping a presenter or interpreter permanently visible even during periods of silence.

Spotlight gives specific participants elevated priority — spotlighted users appear at the top of the active talker list, before active speakers. Use this to foreground a specific participant's stream for all viewers at once.

// Pin specific users — keeps them in the active talker list
Enx.pinUsers([clientId1, clientId2]);

// Remove pin from users
Enx.unpinUsers([clientId1, clientId2]);

// Add users to spotlight — elevates them to top of active talker list
Enx.addSpotlightUsers([clientId1]);

// Remove spotlight from users
Enx.removeSpotlightUsers([clientId1]);

Callbacks fire on all participants when pin or spotlight state changes, allowing every client's layout to update:

Callback Fires when
usersPinned Pin applied successfully. Active talker list updated to keep pinned users visible.
usersUnpinned Pin removed. Active talker list returns to speaker-driven ordering for those users.
spotlightAdded Spotlight added for specified users. They now appear at the top of the active talker list.
spotlightRemoved Spotlight removed. Users return to normal priority in the active talker list.
Switching Room Mode

Enx.switchRoomMode(roomMode) changes the active room mode mid-session without ending or restarting it. Room modes define how audio and video participation is structured across the session. For example, switching from group mode (all participants can publish) to lecture mode (only the moderator or a designated participant publishes) restructures who can be heard and seen.

When the mode switches, all participants receive the roomModeSwitched callback so their apps can adapt the publishing controls and layout accordingly.

// Switch to lecture mode — restricts publishing to moderator/designated participant
Enx.switchRoomMode('lecture');

// Switch back to group mode — all participants can publish
Enx.switchRoomMode('group');
const eventHandlers = {
  roomModeSwitched: (data) => {
    console.log('Room mode changed to:', data.mode);
    // Adapt UI — for example, hide publish controls in lecture mode
    adaptUIForRoomMode(data.mode);
  }
};
Callback Fires when
roomModeSwitched Room mode changed. All participants receive this event. Update publish controls and layout for the new mode.