The E3DS Frontend SDK provides a set of callbacks and control functions that allow you to monitor session lifecycle events, handle errors gracefully, and extend user experience with custom UI or application logic.
GitHub Source File
https://github.com/e3ds/pixelstreaming-sdk/blob/main/scripts/scripts_demo.js
1. Error Handling & Session Control
Prevent Error Redirect
If enabled, the SDK will not redirect users to an error page on streaming failure.
Developers can instead show their own UI message.
let preventErrorRedirect = true;
onError
Triggered when any streaming or connection error occurs.
e3ds_controller.callbacks.onError = function(errorMsg){
console.error("onError:", errorMsg);
};
Use Case Examples:
-
Show custom “Connection Failed” UI
-
Log errors for analytics
-
Retry connection logic
onSessionExpired
Called when the authentication session token expires.
e3ds_controller.callbacks.onSessionExpired = function(){
self.location = "assets/pages/session-expired.htm";
};
Recommended Actions:
-
Redirect to your own session expired page
-
Regenerate token
-
Auto-reconnect flow
2. Connection & Data Channel Events
onConfigAcquire
Called when streaming configuration has successfully been retrieved.
e3ds_controller.callbacks.onConfigAcquire = function(){
console.log("onConfigAcquire");
};
Use this to:
-
Confirm configuration readiness
-
Trigger UI state updates
onDataChannelOpen
Fires when the WebRTC data channel with Unreal Engine is successfully opened.
e3ds_controller.callbacks.onDataChannelOpen = function(){
console.log("onDataChannelOpen");
};
onDataChannelClose
Triggered when the data channel closes.
e3ds_controller.callbacks.onDataChannelClose = function(){
console.log("onDataChannelClose");
};
Use these to:
-
Enable/disable UI controls
-
Detect unexpected session drops
3. Unreal Communication
onResponseFromUnreal
Receives messages sent back from Unreal.
e3ds_controller.callbacks.onResponseFromUnreal = function(descriptor){
console.log("UnrealResponse:", descriptor);
};
Typical Uses:
-
Receive gameplay state updates
-
Handle UX responses
-
Debug Unreal messaging
4. Streaming Progress Events
These callbacks provide real-time progress updates while the app is initializing.
App Acquisition Progress
e3ds_controller.callbacks.onReceivingAppAcquiringProgress = function(percent){
console.log("App Acquiring:", percent);
};
App Preparation Progress
e3ds_controller.callbacks.onReceivingAppPreparationProgress = function(percent){
console.log("App Preparing:", percent);
};
App Starting Progress
e3ds_controller.callbacks.onReceivingAppStartingProgress = function(percent){
console.log("App Starting:", percent);
};
Ideal for:
-
Custom loading screens
-
Progress bars
-
User feedback during startup
5. HTML Binding Event
onHtmlBind
Triggered once HTML and streaming UI are fully bound.
e3ds_controller.callbacks.onHtmlBind = function(){
console.log("onHtmlBind");
};
Useful when:
-
Initializing UI overlays
-
Binding custom buttons
-
Performing final setup
6. Stream Control Functions
The SDK also exposes several helpful runtime control utilities.
Terminate Stream
Stops the current streaming session.
e3ds_controller.terminate();
Use when:
-
User exits experience
-
Navigating away from page
-
Handling shutdown logic
Control Video Quality
Allows manual control of quality bitrate.
e3ds_controller.setQualityPoint(value);
// Acceptable values: 1 - 51
Note:
-
Lower value → higher quality
-
Higher value → lower quality
Quality Values
|
Quality |
Value |
|---|---|
|
Low |
51 |
|
Medium |
34 |
|
High |
17 |
|
Ultra |
1 |
Recommendations
|
Scenario |
Recommended Quality |
|---|---|
|
Public internet users |
Medium or High |
|
Enterprise / client demos |
High |
|
Internal / LAN usage |
Ultra |
|
Detected network instability |
Medium or Low |
Good for:
-
Low bandwidth users
-
Performance optimization
Set Stream Volume
e3ds_controller.setVolume(value);
// 0 to 1
Capture Screenshot
e3ds_controller.captureScreenShot();
Toggle Fullscreen
e3ds_controller.toggleFullscreen();
Send Message to Unreal
Allows sending structured messages to Unreal Engine.
e3ds_controller.sendToUnreal(descriptor);
Typical usage:
-
Game commands
-
UI interactions
-
Custom remote controls
Need help?
If you need any assistance, feel free to reach out through any of the following channels:
🛠️ Support Portal: Contact Our Support Team
💬 Discord Community (Faster Support): Join Our Discord Community
📧 Email Support: support@eagle3dstreaming.com
Follow us on: