Session Management

Session Management covers the moderator controls available in an EnableX Cordova session: recording, room-wide audio muting, entry restrictions, participant role management, force-disconnect, session extension, and session termination. All methods on this page are moderator-only unless noted otherwise.

Recording

An EnableX session can be recorded as individual streams and then transcoded into a single composite video file for later playback. Recording can be configured to start automatically when the first user joins, or triggered on demand by the moderator.

Auto-Recording

To start recording automatically, create the room with settings.auto_recording: true in the Room Creation API payload. Recording begins as soon as the first participant joins — no SDK call is needed.

Start Recording

startRecord() initiates on-demand recording. The moderator receives onStartRecordingEvent as a confirmation, and all other participants receive onRoomRecordingOn so they can display a recording indicator.

There is no limit to the number of times a moderator can start recording within a session. Different segments of a session can be recorded separately.
window.EnxRtc.startRecord();

// Moderator confirmation
window.EnxRtc.addEventListner("onStartRecordingEvent", function(data) {
    console.log("Recording started:", JSON.stringify(data.data));
    showRecordingBadge();
});

// All participants are notified
window.EnxRtc.addEventListner("onRoomRecordingOn", function(data) {
    console.log("Room recording ON:", JSON.stringify(data.data));
    showRecordingIndicator();
});

Stop Recording

stopRecord() stops the current recording segment. The moderator receives onStopRecordingEvent and all participants receive onRoomRecordingOff.

window.EnxRtc.stopRecord();

// Moderator confirmation
window.EnxRtc.addEventListner("onStopRecordingEvent", function(data) {
    console.log("Recording stopped:", JSON.stringify(data.data));
    hideRecordingBadge();
});

// All participants are notified
window.EnxRtc.addEventListner("onRoomRecordingOff", function(data) {
    console.log("Room recording OFF:", JSON.stringify(data.data));
    hideRecordingIndicator();
});

Play a Recorded File

Recordings stored on the EnableX server are protected by HTTP Basic Authentication. Standard video players cannot access them with a URL alone — you must supply access credentials. The recommended approach is to add the cordova-plugin-video-player plugin:

cordova plugin add cordova-plugin-video-player
As an alternative, download recordings to your own server and serve them from there. Note that EnableX deletes recorded files 72 hours after creation, so direct playback beyond that window is not guaranteed.
Hard Mute / Unmute Room

Hard mute is a room-level audio control that forces all participants to mute their microphones. A new participant who joins a hard-muted room is automatically muted. Only the moderator can lift a hard mute — participants cannot unmute themselves while it is active.

Hard Mute a Room

EventFired ToDescription
onHardMutedModeratorConfirms the room is now hard-muted
onReceivedHardMuteAll participantsNotifies everyone that hard mute is active
window.EnxRtc.hardMute();

window.EnxRtc.addEventListner("onHardMuted", function(data) {
    console.log("Hard mute applied (moderator):", JSON.stringify(data.data));
});

window.EnxRtc.addEventListner("onReceivedHardMute", function(data) {
    console.log("Room hard muted (all):", JSON.stringify(data.data));
    disableMicrophoneButton();
});

Hard Unmute a Room

EventFired ToDescription
onHardUnMutedModeratorConfirms the room is no longer hard-muted
onReceivedHardUnMuteAll participantsNotifies everyone that hard mute is lifted
window.EnxRtc.hardUnMute();

window.EnxRtc.addEventListner("onHardUnMuted", function(data) {
    console.log("Hard mute lifted (moderator):", JSON.stringify(data.data));
});

window.EnxRtc.addEventListner("onReceivedHardUnMute", function(data) {
    console.log("Room unmuted (all):", JSON.stringify(data.data));
    enableMicrophoneButton();
});
Room Entry Restrictions

Moderators can lock a room to prevent any new participants from joining the session. The lock can be lifted at any time to allow subsequent users in.

Lock a Room

EventFired ToDescription
onAckLockRoomModeratorRoom has been locked
onLockedRoomAll participantsNotifies everyone the room is locked
window.EnxRtc.lockRoom();

window.EnxRtc.addEventListner("onAckLockRoom", function(data) {
    console.log("Room locked (moderator):", JSON.stringify(data.data));
});

window.EnxRtc.addEventListner("onLockedRoom", function(data) {
    console.log("Room is locked (all):", JSON.stringify(data.data));
    showLockedBadge();
});

Unlock a Room

EventFired ToDescription
onAckUnLockRoomModeratorRoom has been unlocked
onUnLockedRoomAll participantsNotifies everyone the room is unlocked
window.EnxRtc.unLockRoom();

window.EnxRtc.addEventListner("onAckUnLockRoom", function(data) {
    console.log("Room unlocked (moderator):", JSON.stringify(data.data));
});

window.EnxRtc.addEventListner("onUnLockedRoom", function(data) {
    console.log("Room is unlocked (all):", JSON.stringify(data.data));
    hideLockedBadge();
});
Switch Participant Roles

switchUserRole() promotes a participant to the moderator role. The promoted participant gains access to all moderator controls, and the current moderator becomes a regular participant. The new moderator can subsequently grant the role to another participant.

EventFired ToDescription
onSwitchedUserRoleModeratorConfirms the role-switch request was accepted
onUserRoleChangedAll participantsNotifies everyone of the role change; new moderator receives extra moderation data
window.EnxRtc.switchUserRole(clientId);

window.EnxRtc.addEventListner("onSwitchedUserRole", function(data) {
    console.log("Role switch acknowledged:", JSON.stringify(data.data));
});

window.EnxRtc.addEventListner("onUserRoleChanged", function(data) {
    console.log("Role changed in room:", JSON.stringify(data.data));
    refreshModeratorControls(data.data);
});
Disconnect a Participant

dropUser() allows the moderator to force-disconnect one or more participants from the session. Pass an array of client IDs to drop multiple users at once.

EventFired ToDescription
onAckDropUserModeratorConfirms the drop was processed
onRoomDisConnectedDropped usersNotifies dropped participants with the disconnection reason
// Drop one or more participants
var clientsToRemove = ["client_id_1", "client_id_2"];
window.EnxRtc.dropUser(clientsToRemove);

window.EnxRtc.addEventListner("onAckDropUser", function(data) {
    console.log("Users dropped:", JSON.stringify(data.data));
});

// Fired at the dropped users' endpoints
window.EnxRtc.addEventListner("onRoomDisConnected", function(data) {
    console.log("Disconnected from room:", JSON.stringify(data.data));
    showDisconnectionReason(data.data.reason);
});
Extend a Session

Every room has a maximum duration set at creation time, counted from when the first user joins. To accommodate over-running sessions, EnableX opens an extension window 10 minutes before closure and again at 5 minutes. Any connected participant can trigger an extension. The extension can add between 10 and 30 minutes to the session, and there is no limit on how many times a session can be extended.

EventFired ToDescription
onConferenceRemainingDurationAll participantsFires when an extension window opens; payload shows minutes remaining
onConferencessExtendedAll participantsConfirms the session has been extended
// Extension window is open — trigger an extension
window.EnxRtc.addEventListner("onConferenceRemainingDuration", function(data) {
    console.log("Session ending soon:", JSON.stringify(data.data));
    // Optionally prompt the user before extending
    window.EnxRtc.extendConferenceDuration();
});

// Extension confirmed for everyone
window.EnxRtc.addEventListner("onConferencessExtended", function(data) {
    console.log("Session extended:", JSON.stringify(data.data));
    updateSessionTimer(data.data.extendedDuration);
});
Conclude a Session

destroy() terminates the entire session for all participants. Every connected user is disconnected and the room is closed. Use this instead of disconnect() when you want to end the session for everyone, not just the local user.

EventFired ToDescription
onAckDestroyModeratorConfirms the destroy request was accepted
onRoomDisConnectedAll participantsNotifies everyone that the session has ended
window.EnxRtc.destroy();

window.EnxRtc.addEventListner("onAckDestroy", function(data) {
    console.log("Session destroyed (moderator):", JSON.stringify(data.data));
});

window.EnxRtc.addEventListner("onRoomDisConnected", function(data) {
    console.log("Session ended (all):", JSON.stringify(data.data));
    navigateToHomeScreen();
});