Base Class: EnxRtc

This is the base class of the Web Toolkit. Additionally it has set of methods using which one can easily deploy a generic of conference application. The following tables covers all Methods of EnxRtc Class.


Parameters Description
getDevices() To receive list of all Media Devices. Camera and Microphones attached to the System
joinRoom() To connect Client End Point Application to the Room and join with Stream.
switchMediaDevice() To change media device of local stream while being within a connected session.

Get Devices

Method: EnxRtc.getDevices()

This API is designed to return a JSON Structure containing all the Camera and Microphones attached to the System. Using the return value developers can create a list of available devices from which a user can select and allow a Camera and a Microphone to use to get connected to a RTC Session.

API: EnxRtc.getDevices(callback)

EnxRtc.getDevices(function(response){ if(response.result === 0) { // success /* You get Complete Device List in the response.devices */ var camList =; var micList = response.devices.mic; console.log(response.devices); /* It would print the following */ /* { "cam":[ { "deviceId": "", "groupId": "", "label": "" , "kind" : "" } ], "mic": [ { "deviceId": "", "groupId": "", "label": "" , "kind" : "" } ] } */ } // if response.result is not 0, then it will correspond to a getUserMedia error, // which you can handle as shown in example below: else if(response.result === 1144){ // error case console.log(response); /* { "result":1144, "error":"Permission denied", "desc":"NotAllowedError: The request is not allowed by the user agent or the platform in the current context" } */ } });

Join Room

This API helps a client endpoint to get connected to room (for video chat or multiparty conversation) hosted on EnableX Server. Client Endpoint joins the room to carry out Real Time Communication Session. The API allows developers to use the right set of parameters to qualify users’ audio/video ensuring optimum communication quality. The API returns “room handle” of the connected room.

API : EnxRtc.joinRoom(Token, Stream-options, Callback)

Parameters Description
Token The token value generated from server API .Refer Appendix: JSON token details
Stream-Options JSON. Refer Appendix: Stream-Options JSON details
Callback To handle the success or failure of the action, you can pass a function name here to which you look to receive call back.
The call back with receive a JSON Message as:
On Success: { "success": { "streams": Array, "room":Room-Handle, "roomData":"", "publishId":"" } } On Error: { error: { "result": "A Response Code Number", "error": "Short reason", "desc": "Descriptive information about the error / warning" } } Return Type:

Switch Device

Method : EnxRtc.switchMediaDevice()

This API is designed to change media device for local stream while being within the connected session. The Callback returns the updated Stream Handle of updated stream using the newly selected device.

API: EnxRtc.switchMediaDevice(stream-Handle,audioDevice-Id,videoDevice-Id,callback)

Parameters :

Parameters Description
stream-Handle Requested Stream Handle
audioDevice-Id Audio Device Id
videoDevice-Id Video Device Id
Callback To get updated stream handle with new device feed, you can pass a function to receive call back.
EnxRtc.switchMediaDevice(stream-Handle,audioDevice-Id,videoDevice-Id,function(stream){ /* You get updated stream handle with new device feed*/ console.log(stream); });