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.
Before You Start
The SDK operates entirely client-side, but it needs three things prepared server-side before a session can begin:
- App Credentials —
app_idandapp_keyfrom the EnableX Portal. These never leave your server. - A Room — Create a room via the Video API and store its
room_id. - 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.
Token generation must happen on your application server. The app_id and app_key must never be embedded in client-side JavaScript.
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>
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
Extract the archive to obtain EnxRtc.js, then include it from your own server:
<script src="/path/to/EnxRtc.js"></script>
<head>. Load EnxRtc.js early so the EnxRtc global is available before any of your application code runs.
SDK Classes
EnxRtc.js exposes two primary classes. Everything you do in a session flows through one of these two objects.
| Class | Role | Key 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:
| Attribute | Type | Description |
|---|---|---|
room.roomID | String | Unique room identifier |
room.clientID | String | This endpoint's client ID assigned by EnableX |
room.remoteStreams | Map | All remote streams currently in the room |
room.localStreams | Array | Streams published by this endpoint |
room.status | Enum | 0=Disconnected, 1=Connecting, 2=Connected |
room.awaitedParticipants | Array | Users waiting for moderator approval (knock-enabled rooms) |
room.raisedHands | Array | Users requesting floor access in Lecture mode |
room.approvedHands | Array | Users currently holding floor access |
Methods — Calling the SDK
A method is an action your application initiates. Call it when you want something to happen. For example:
- Enumerate devices →
EnxRtc.getDevices(callback) - Connect to a room →
room.connect(options) - Publish your stream →
room.publish(localStream, options, callback) - Mute your mic →
localStream.muteAudio(callback) - Start recording →
room.startRecord(callback)
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 */ });
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 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."
}
| Field | Type | Description |
|---|---|---|
result | Number | 0 = success; non-zero = error code |
error | String | Short error identifier |
desc | String | Optional. Human-readable explanation of the error |
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.
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.
Supported Browsers
| Browser | Minimum Version | Notes |
|---|---|---|
| Google Chrome | 72+ | Recommended for best experience |
| Mozilla Firefox | 65+ | Fully supported |
| Apple Safari | 12+ | Supported; some getStats limitations |
| Microsoft Edge | 79+ (Chromium) | Fully supported |
| Opera | 60+ | Chromium-based; supported |
clientBitrate() and clientDiagnostics() bandwidth tests do not work on Safari due to missing getStats() implementation. All other features are supported.