Web Video SDK

The EnableX Web SDK (EnxRtc.js) is a JavaScript library that lets your web application communicate directly with EnableX's signalling and media servers. Add it to any HTML page and you get full-duplex, real-time audio/video — with no plugins or native installs required.

Prerequisites

Before You Start

The SDK operates entirely client-side, but it needs three things prepared server-side before a session can begin:

  1. App Credentialsapp_id and app_key from the EnableX Portal. These never leave your server.
  2. A Room — Create a room via the Video API and store its room_id.
  3. A Session Token — Before each participant joins, call the Create Token API from your server to get a signed JWT for that user. Pass the JWT to your frontend and hand it to the SDK.
Never expose credentials in the browser

Token generation must happen on your application server. The app_id and app_key must never be embedded in client-side JavaScript.

Installation

Option 1 — CDN (Recommended)

Load EnxRtc.js via CDN for the fastest setup. No build tools or package managers required — just add a <script> tag. Always use a pinned version URL so your application is not broken by future releases.

<script src="https://developer.enablex.io/downloads/video/web/v3.1.10/EnxRtc.js"></script>
Always pin the version in the URL. Avoid using a latest or unversioned CDN path — an unversioned URL may serve a newer SDK that changes behaviour and breaks your application without warning.

Option 2 — Download & Self-Host

If your environment restricts outbound CDN access, or you require a specific build for compliance, download the SDK and host it on your own infrastructure.

Latest release: EnxRtc.js v3.1.10 — Released August 11, 2025

⇩  Download EnxRtc.js v3.1.10

Extract the archive to obtain EnxRtc.js, then include it from your own server:

<script src="/path/to/EnxRtc.js"></script>
Place the script tag in <head>. Load EnxRtc.js early so the EnxRtc global is available before any of your application code runs.
SDK Architecture

SDK Classes

EnxRtc.js exposes two primary classes. Everything you do in a session flows through one of these two objects.

ClassRoleKey responsibilities
EnxRtc.EnxRoom Room Handler Connect / disconnect, publish & subscribe streams, moderate participants, recording, floor control
EnxRtc.EnxStream Stream Handler Initialize local media, configure audio/video options, mute/unmute, switch devices, play remote streams

The EnxRtc base object also exposes utility methods directly — EnxRtc.getDevices(), EnxRtc.joinRoom(), EnxRtc.clientDiagnostics() — that sit outside the room/stream lifecycle.

Key Room Attributes

Once connected, the room object carries runtime state you will reference often:

AttributeTypeDescription
room.roomIDStringUnique room identifier
room.clientIDStringThis endpoint's client ID assigned by EnableX
room.remoteStreamsMapAll remote streams currently in the room
room.localStreamsArrayStreams published by this endpoint
room.statusEnum0=Disconnected, 1=Connecting, 2=Connected
room.awaitedParticipantsArrayUsers waiting for moderator approval (knock-enabled rooms)
room.raisedHandsArrayUsers requesting floor access in Lecture mode
room.approvedHandsArrayUsers currently holding floor access
Working with Methods & Events

Methods — Calling the SDK

A method is an action your application initiates. Call it when you want something to happen. For example:

Every callback receives a response with result: 0 on success or a non-zero error code on failure. Some methods also fire events — to the caller and to other participants — once the action is confirmed by the server.

Event Listeners — The Server Talks Back

After a method executes, the EnableX server notifies all connected endpoints by firing an event — to you, to other participants, or to both, depending on the event type. Your application must listen for these events to update the UI and react to what's happening in the room.

Events are added with addEventListener(), bound on either the room object or a stream object:

// Room events — bound on EnxRoom
room.addEventListener("room-connected",         function(event) { /* session ready */ });
room.addEventListener("user-connected",         function(event, user) { /* someone joined */ });
room.addEventListener("user-disconnected",      function(event, user) { /* someone left */ });
room.addEventListener("stream-added",           function(event) { /* new stream to subscribe */ });
room.addEventListener("active-talkers-updated", function(event) { /* speaker list changed */ });
room.addEventListener("room-record-on",         function(event) { /* recording started */ });

// Stream events — bound on an EnxStream instance
localStream.addEventListener("media-access-allowed", function(event) { /* camera/mic granted */ });
localStream.addEventListener("media-access-denied",  function(event) { /* camera/mic blocked */ });
Register all event listeners before calling room.connect(). Events like room-connected and stream-added fire immediately on connection. Listeners registered after connect() may miss the first events.

Why Events Matter

Consider this scenario: the moderator starts recording. They call room.startRecord() on their device. EnableX starts recording and fires room-record-on to every participant's SDK. Without listening for that event, the other participants have no way of knowing the session is being recorded — your UI stays silent when it should show a recording badge.

The same pattern applies across the entire SDK: one participant's action → server processes it → everyone gets an event → each client updates its UI. Every feature page in this guide follows this method + event structure.

Error Handling

Error Response Format

When an SDK method fails, the error is returned as a JSON object through the callback. The structure is consistent across all methods:

{
  "result": 1144,
  "error": "NotAllowedError",
  "desc": "The request is not allowed by the user agent or the platform in the current context."
}
FieldTypeDescription
resultNumber0 = success; non-zero = error code
errorStringShort error identifier
descStringOptional. Human-readable explanation of the error
Pattern: always check result === 0

In every callback, test if (response.result === 0) for success. Any other value is an error code you can look up in the relevant section's error table.

Feature Guide

What You Can Build

The Web SDK is organized into focused topic pages. Each page covers a distinct area of the SDK with full method signatures, event listeners, code examples, and error codes.

🔗
Connecting to a Session
Step-by-step guide: enumerate devices → init stream → connect room → publish → receive remote streams → disconnect. Start here.
📹
Stream Management
Local stream init & publish, mute/unmute, switch devices, subscribe to remote streams, active talkers, video quality.
💬
In-Session Communication
Chat, custom signalling, file sharing, screen share, canvas streaming, RTMP, HLS, annotation, live transcription.
🛠
Session Management
Recording, hard mute, lock/unlock room, moderated entry, drop users, switch roles, pin/spotlight, room mode.
🔀
Breakout Rooms
Create breakout rooms, invite participants, accept/reject invitations, pause/resume parent room, destroy sessions.
🎙
Floor Access Control
Lecture mode floor requests, grant/deny/release access, invite participants to floor, moderator restore after reconnect.
🔬
Developer Tools
Pre-call diagnostics, live media stats, talker notifications, logging, snapshot, audio-only mode, PSTN dial-out.
Browser Support

Supported Browsers

BrowserMinimum VersionNotes
Google Chrome72+Recommended for best experience
Mozilla Firefox65+Fully supported
Apple Safari12+Supported; some getStats limitations
Microsoft Edge79+ (Chromium)Fully supported
Opera60+Chromium-based; supported
Safari limitations

clientBitrate() and clientDiagnostics() bandwidth tests do not work on Safari due to missing getStats() implementation. All other features are supported.