Understand the Video SDK Basics
Video SDKs are used to develop video applications for client endpoints. These SDKs also facilitate video communication between the EnableX server and video applications of client endpoints. A wide range of SDKs are available for developing web browser-based applications and mobile applications. The Video SDK provides functions that use underline APIs over web sockets to communicate with EnableX servers for effective RTC sessions. The Video SDK updates or notifies the status of actions and status of a session by propagating events to each endpoint or designated endpoints connected to the session.
Type of SDKs
EnableX provides different types of SDKs for video application development on different platforms and application frameworks, such as:
Web SDK
- A Lightweight JavaScript Library for browser-based video application development.
Native SDK
- Android SDK: SDK for native app development on Android devices.
- iOS SDK: SDK for native app development on iOS devices.
Hybrid SDK
- React Native SDK: SDK for hybrid application development on React Native framework.
- Flutter SDK: SDK for hybrid application development on Flutter framework.
- Cordova SDK: SDK for hybrid applicatin development on Cordova platform.
To download the SDKs, click here.
How do SDKs Work
As part of a client endpoint application, the video SDK helps connect to the video session and negotiates any network fluctuations to stay connected. It handles media transmission and reception to-and-from the EnableX server to maintain an effective session until disconnection.
The SDK achieves this through:
Socket Connection
Web sockets connect the client endpoint to the EnableX server. All messaging and communication between the client and EnableX services is channeled through the web socket. If the web socket connection breaks, the communication stops.
The SDK also helps to automatically reconnect with the EnableX Sever to restore the session.
Methods
SDK methods are called by the client endpoint application to perform their respective actions. These method calls work asynchronously.
-
An action request is sent to the EnableX server through the web socket.
-
An immediate response is received to notify whether the method has been received for onward execution.
Example of (Web SDK) to start the recording: The moderator of a session starts recording the session by using the startReccord() method call.
Sample Code
// To start recordingroom.startRecord( function( result, error ) { // Method call & Callbackif (result == 0) {// Recording started}});
Event Notifications
Various event notifications are sent out by the EnableX server through the web socket to all or designated client endpoint applications connected to the video sessions. These notifications are generated as:
- an action/method call from your endpoint.
- a result of an action triggered by others from their endpoint.
A client endpoint application must listen to these events and take necessary actions.
Example of (Web SDK) when the recording is started: All client endpoints are notified when a video session is being recorded.
Sample Code
// Notification recording started to allroom.addEventListener( "room-record-on", function(event) {// Recording started, Update UI// event.message.moderatorId = Moderator who stated recording.});
Media Stream Handling
The video SDK handles the flow of the media stream between the client endpoint and the EnableX media server. It helps select the right candidate to route the media to the EnableX media server. For example, in some corporate networks, if the primary UDP ports are restricted, the SDK routes media through the EnableX's TURN server over a standard HTTP port to ensure communication.
Note: EnableX uses UDP ports 30000 to 35000 for media streaming. Ensure that these ports are not restricted in your network for optimum video communication.
SDK Entities
SDKs handle four major entities:
Room
Represents the client-side session and is used to handle all room or session-related events.
- It handles the connection, local stream publication, and remote stream subscriptions.
- It creates the room object by passing the token previously received by users from your service.
Note: This user access token must be retrieved using the Server API.
Stream
Represents the user (audio, video, and/or data) stream. It identifies the stream and where the stream should be drawn.
Events
Represents events related to client-side entities:
- Room Events: These represent events related to room connection.
- Stream Events: These represent events related to streams within a room.
Player
Represents the customisable UI element used to render the stream in the DOM handler in the browser and in the View handler in mobile SDKs.