Virtual Agent
The Virtual Agent is a silent, headless web application that joins a video session as a non-publishing participant and renders the session view that is consumed by output services — HLS Streaming, RTMP Streaming, and Live Recording.
Rather than compositing video on the server directly from raw streams, EnableX loads a web-based view into a managed browser context. That rendered view becomes the single source of truth for what the audience sees in a live stream or what gets recorded. This gives you precise, pixel-level control over the output layout without any server-side rendering pipeline to configure.
The Virtual Agent operates as a shared resource across all output services running in the same session. Its lifecycle is tied to the services that depend on it:
- Started by the first service — whichever output service activates first (HLS, RTMP, or Live Recording) causes the Virtual Agent to be instantiated and to join the session.
- Shared concurrently — if multiple output services are active at the same time (for example, an RTMP stream to YouTube and a simultaneous live recording), they all consume the same agent view. There is only ever one agent per session, regardless of how many services are running.
- Terminated by the last service — the agent remains active until every output service that depends on it has stopped. Only when the last service ends does the agent leave the session.
Default View
EnableX provides a built-in streaming view that works without any configuration. When you start HLS streaming, RTMP streaming, or a live recording without specifying a custom view URL, the default view is used automatically.
The default view renders participants in a standard multi-tile grid layout. It is suitable for most conferencing scenarios but offers limited visual customisation.
Custom View
For full control over the streaming and recording output — custom branding, specific participant arrangements, lower-third overlays, or any bespoke layout — you can build your own streaming view and pass its hosted URL to the relevant service.
The custom view is a standard web application. It joins the video session using an EnableX token exactly as a participant would, except it does not publish any audio or video stream. It only subscribes to the room and renders the view.
Requirements
- Built as a web application (HTML, CSS, JavaScript).
- Hosted on a publicly accessible HTTPS URL.
- Must be able to join an EnableX video session using a token passed via the URL (as a query string parameter).
- Must join the session without publishing any audio or video stream — subscribe only.
- Must handle the session rendering entirely in the browser (the agent runs in a managed headless browser context).
- Optimise the UI for a 720p (1280×720) viewport. The Virtual Agent joins using Headless Chrome at a fixed 1280×720 resolution. Your layout must be designed and tested at this viewport — elements that overflow or do not scale correctly at 720p will appear clipped or misaligned in the stream and recording output.
URL Scheme
Design your application to accept the EnableX token as a query string parameter. A typical URL scheme looks like this:
https://your-domain/streaming-view/?token=ENABLEX_TOKEN
When you pass this URL to a streaming or recording method, pass it without the token value — EnableX appends the generated token at runtime:
https://your-domain/streaming-view/?token=
?token=). EnableX fills in the value when it instantiates the agent.
Joining the Session in Your View
Your streaming view application must read the token from the URL and use it to connect to the EnableX room using the Web SDK — in receive-only mode, without publishing streams:
// Read the token from the URL query string
const params = new URLSearchParams(window.location.search);
const token = params.get('token');
// Connect to the room — subscribe only, no publishing
const room = EnxRtc.joinRoom(token, {
audio: false,
video: false
}, function(response) {
if (response.result === 0) {
// Room joined — subscribe to remote streams and render your layout
}
});
Passing the View URL to a Service
Once your view is hosted, pass its URL to the relevant output service. The parameter name differs by service:
| Service | Where to pass the URL |
|---|---|
| HLS Streaming | hls_view_url in the room creation payload (Video API) |
| RTMP Streaming | urlDetails.url in the startStreaming() config object (Video SDK) |
| Live Recording | Custom recording view URL in the recording configuration (Video API / SDK) |
- Design for 1280×720 (720p). The Virtual Agent always renders in Headless Chrome at a fixed 1280×720 viewport. Build and test your layout at this exact resolution — do not design for larger viewports and scale down.
- Handle stream subscription gracefully. Remote streams may arrive one by one as participants join. Your view should update the layout dynamically as streams are added or removed.
- Avoid user interaction dependencies. The agent runs headlessly — there is no user to click buttons or interact with the UI. All behaviour must be driven by SDK events and JavaScript logic.
- Keep the HTTPS requirement in mind. The host server for your view must serve over HTTPS. Mixed content or self-signed certificates will prevent the agent from loading your view.
- Test with all output services you plan to use simultaneously. Since the same view is shared between RTMP, HLS, and recording when all three are active, verify your layout renders correctly for each output format.