EnxRoom Js

EnxRoom class exposes the room level features and controls. To start the session one has to initialize the room instance.

Example:- Enx.initRoom();

Pass token and local stream info to EnxRoom

<EnxRoom token={this.props.token} eventHandlers {this.roomEventHandlers} localInfo={this.state.localStreamInfo} >

EnxRoom Components

Prop Type Required Description
token String Yes The token value generated from server API. To create token visit here.
eventHandlers Object Function No Event handlers responsible to get all event call back for room instance.
localInfo JSON Object NO Publisher stream info as describe below

Props need to create local Stream info as below :-

localStreanInfo: {audio: true/false,video: true/false,data: false/true,maxVideoBW: "400",minVideoBW: "300",audioMuted: true/false,videoMuted: true/false,name: "React Native",minWidth: "720",minHeight: "480",maxWidth: "1280",maxHeight: "720"}

EnxRoom Methods

Methods Name Descriptions
connect(token): To connect client endpoint application to designated room.
publish: To publish local stream into the room
subscribeToStream: To subscribe Remote stream.
disconnect: To disconnected from the connected room.
startRoomRecording: To start recording of a session in a room. Only moderator can start the recording.
stopRoomRecording: To stop recording of a session in a room. Only moderator can stop the recording.
postClientLogs: To post client endpoint console logs to server for analysis / trouble shooting.
setTalkerCount: To set viewable participant in the room.
getTalkerCount: To get total current viewable participant in the room.
getMaxTalker: To get maximum number of viewable participant allowed in the room.
changeToAudioOnly: Pass true to change audio video room to audio only.and false to move back to audio video.
switchMediaDevice: Client endpoint can also overlap with any other connected media device while calling method.
getSelectedDevice: Client endpoint can also check the current selected Audio media While calling method.
getDevices: This feature will give flexibility for user to switch to any connected Audio media at on going call. Client endpoint can get all list of connected Media while calling method.
Chair Controles Methods
requestFloor: To Facilitate Participant to request floor access when the room is in Lecture Mode.
grantFloor: To Facilitate Moderator to grant floor access to a Participant in Lecture Mode.
denyFloor: To Facilitate Moderator to deny floor access to a Participant in Lecture Mode.
releaseFloor: To Facilitate Moderator to release floor access from a granted Participant in Lecture Mode.
HardMute Methods
muteAllUser() Mute all participants in a room. Available to the only moderator.
unMuteAllUser() Unmute all participants in a room. Available to the only moderator.

Room Callback

Name Descriptions
roomConnected: This CallBack method will called, when the client endpoint successfully connected to the room.
roomDisconnected: This callback method will call when a user is disconnected from a room.
roomError: This callback method will called, when the client endpoint failed to connect to the room.
eventError: This callback method will called, when the client endpoint failed to perform any event, for instance, publish the stream.
streamPublished: This callback method will called, when local stream will get published.
streamAdded: This Callback method will called, when remote publishing stream added to the room. Client endpoint should subscribe to this stream.
streamRemoved: This Callback methods will called, when remote stream removed from the room.
streamSubscribed: This callback method will call to receive subscribed stream.
recordStarted: When recording is started in the room, (either implicitly or explicitly), all connected users are notified that room is being recorded...
recordStopped: When the recording is turned off (either implicitly or explicitly), all connected users are notified that recording has been stopped in the room
startRecordingEvent: This callback methods will called, when recording starts. Available to Moderator only
stopRecordingEvent: This callback methods will called, When recording stops. Available to Moderator only
userJoined This callback methods will called, when a user is connected to a room, all other connected users are notified about the new user.
userDisconnected: When a user is disconnected from a room, all other connected users are notified about the users exit.
activeTalkerList: This callback methods will call every time when active talker list gets updated and the user will get the new active list.
screenShareStarted: Client endpoint will be notified about a screen share started.
sceenShareStopped: Client endpoint will be notified about a screen share stop.
logsUploaded: This callback methods will called, when the log is uploaded successfully to the server.
setTalkerCount: Client endpoint receives when the user set number of active talker.
getTalkerCount: Client endpoint receives when the user request to get opted active talker streams set by them.
getMaxTalkers: Client endpoint will get the maximum number of allowed Active Talkers in the connected room.
canvasStarted: A Participant listens to this callback to know about a Canvas started by a user.
canvasStopped: A Participant listens to this callback to know about that Canvas has stopped by user.
Callback Methods for Chair controller
floorRequested: Participant receives on the success of requestFloor. This is for participant only.
denyFloorRequested: Participant receives when the moderator performs action denyFloor.
releaseFloorRequested: Participant receives when the moderator performs action releaseFloor.
processFloorRequested: Moderator receives acknowledgement on performing actions like grantFloor, denyFloor, releaseFloor..
floorRequestReceived: Moderator receives any Floor Request raised by the participant. This is for Moderator only.
grantFloorRequested: Participant receives when the moderator performs action grantFloor.



Connect

The room initialization process would require a valid “Token” to be passed. The token needs to be acquired through a Server API Call. For connecting the client endpoint to the Signaling server, explicitly call the below method of EnxRoom Class as follows:

Enx.connect(token);
Prop Type Required Description
token String Yes The token value generated from server API



On Success Connected with room: This method will provide room metadata

roomConnected:event =>{ },

Where event is

{ result: 0, streams: [{ id: 1, audio: true, video: true, data: true, screen: false, attributes: {} }], id: '', clientId: '', user: { name: 'mod', user_ref: 'mod', role: 'moderator', permissions: { publish: true, subscribe: true, record: true, stats: true, controlhandlers: true }, clientId: '' }, room: { name: test!, owner_ref: 'xx@vcloudx.com', settings: { description: 'test!'', scheduled: false, adhoc: false, participants: 9, auto_recording: false, active_talker: true, quality: 'HD', mode: 'group', moderators: 1 }, sip: { enabled: false, uri: '', name: '', auth: '', secret: '', proxy: '', aor: [] }, created: YYYY-MM-ddTHH:mm:ss.000Z, _id: '' }, userList: [ /* user-meta */ ], raisedHands: [], approvedHands: [], awaitedParticipants: [], defaultVideoBW: 4096, maxVideoBW: 4096 }


On Error:- On connection Error with room

roomError: event => { },

Where event is

{ msg:'', result:0 }


Publish Stream:

This method publishes a locally initiated stream into the connected room. As the stream is added to the Room, all other connected users are notified with a callback “streamAdded”, so that they may subscribe the stream

To publish a stream with given options use the method below:

Enx.publish();


CallBack

streamPublished: event => { },

Where event is:

{ result:0, msg:'success', streamId:1 }


Add Stream

Callback to receives when remote publishing stream added to the room. A developer should subscribe to this stream.

streamAdded:event=>{ },

Where event is

{ hasData: true, hasScreen: false, streamId: '1' }


Subscribe Stream

To subscribe a remote stream in a room use the method below:

Enx.subscribeToStream(streamID);
Prop Type Required Description
streamId String Yes Id for stream which is going to subscribe.




CallBack

streamSubscribed: event => { },

Where event is:

{ hasData: true, hasScreen: false, streamId: '1' }


Remove Stream

Callback to receives when any remote stream leaves from the room or gets disconnected.

streamRemoved:event = >{ },

Where event is

{ hasData: true, hasScreen: false, streamId: '1' }


Event Error

Callback to receives when client endpoint failed to perform any event. For example: Publish and Subscribe.

EventError:event=>{ }

Where event is

{ msg:'message', errorCode:0 }


Active Talker List

Receive every time when the active talker list gets updated and client endpoint gets the new active list.

activeTalkerList:event=>{ },

Where event is

[ { mediatype: 'audiovideo', clientId: '8079c41b-04db-4586-a52b-eeb0a50415e2', streamId: 1, name: 'browser' } ]


Disconnect

This API is used to disconnect a Client endpoint application from the connected room.

Enx.disconnect();

CallBack:




roomDisconnected: event => { },

Where event is

{ msg: 'Room Disconnected', result: '0' }


Room Recording start

This APIs help to start recording during the session. And available for users with Moderator rights

Enx.startRecording();


Moderator Callback:

startRecordingEvent: event => { },

Where event is:

{ result:0, msg:'Success' }


Participant Callback:

recordStarted: event => { },

Where event is:

{ msg:'Room Recording On', result:0 }


Room Recording stop

Room Recording stop:- These APIs use to stop recording during the session. Using these APIs. These API calls are only available for users with Moderator rights

Enx.stopRecording();


Moderator Callback:

stopRecordingEvent: event => { },

Where event is:

{ result:0, msg:'Success' }


Participant Callback:

recordStopped: event => { },

Where event is:

{ msg:'Room Recording Off', result:0 }


Post Enablex SDK logs

To enable logs call the below method:

Enx.enableLogs(true/false)
Prop Type Required Description
true/false boolean Yes True for enable the logs and false for disable the logs

To post Enablex client SDK logs to server use the below method.

Enx.postClientLogs()
CallBack



logsUploaded: event => { },

Where event is

{ msg:'success', result:0 }


Set Talker Count

The setTalkerCount method is used to opt total number of streams to receive at a Client endpoint in Active Talkers.

Enx.settalkerCount(number);
Prop Type Required Description
number int Yes Number contain total number of Active talker to set in room for that user



CallBack

setTalkerCount: event => { },

Where event is

{ numTalkers : 2, result : 0 }



GetTalkerCount

The getTalkerCount method is used to know opted streams in Active Talker.

Enx.getTalkerCount();


CallBack

getTalkerCount:event =>{ },

Where event is

{ numTalkers : 2, result : 0 }


GetMaxTalker

This method is available for all users during Active Talker Mode. Using this method, you can get maximum number of allowed Active Talkers in the Callback.

Enx.getMaxTalker();


CallBack

getMaxTalkers:event =>{ },

Where event is

{ maxTalkers : 2, result : 0 }


Change To Audio Only

Use this method to set all the streams to audio which are present in the room at client side. Or vice versa

Enx.changeToAudioOnly(true/false);
Prop Type Required Description
true/false boolean Yes True for set audiovideo call to audio only and false for audiovideo



Switch to others connected media device

Used this method to change media device

Enx.switchMediaDevice("name");
Prop Type Required Description
name String Yes here name has any connected media to overlap Exm:- “speaker”.



Get current connected media device name

Used this method to get current connected media device name

Enx.getSelectedDevice();


Get list of connected media device list

Used this method to get list of connected media devices

Enx.getDevices();



Chair Control Feature

Raise Hand Control

This API is only available during Lecture Mode of a Session. Each Participant Raise hand Control can individually be asked to Join the floor using this API Call. This API calls are only available to users with role “Participant”.

Enx.requestFloor();


Participant CallBack

floorRequested:event=>{ },

Where event is

{ result:1701, msg:'Floor Request Received' }


Moderator CallBack

floorRequestReceived:event=>{ },

Where event is

{ clientId : 1234, name : 'android' }


Grant Floor Control

This API is only available during Lecture Mode. Each Participant requested Floor Control can individually be granted access to the Floor using this API Call. These API calls are only available to users with role “Moderator”.

Enx.grantFloor(“clientId”);
Prop Type Required Description
clientId String Yes here client id is for that participant which request has approved.



Moderator CallBack

processFloorRequeted:event=>{ },

Where event is

{ result:1708, msg:'Floor Granted' }


Participant CallBack

grantedFloorRequest:event=>{ },

Where event is

{ result:1708, msg:'Floor Granted', clientId:c371cd94-4ad4-4d5c-b674-5e8dd6d81d65 }


Deny Floor Request

This API is only available during Lecture Mode of a Session. Each Participant requested Floor Control can individually be denied access to the Floor using this API Call. This API calls are only available to users with role “Moderator”.

Enx.denyFloor(“clientId”);
Prop Type Required Description
clientId String Yes here client id is for that participant which request has deny.



Moderator CallBack

processFloorRequeted:event=>{ },

Where event is

{ msg: 'Floor Denied', result: 1709 }


Participant CallBack

deniedFloorRequest:event=>{ },

Where event is

{ result:4117, msg:'Floor Request Denied', clientId:5222fa14-58ab-4e3e-95ca-47fbf31ad15c }


Release Floor Request

This API is only available during Lecture Mode of a Session. Each Participant granted Floor Control can individually be asked to release the floor Control using this API Call. This API calls are only available to users with role “Moderator”.

Enx.releaseFloor(“clientId”);
Prop Type Required Description
clientId String Yes here client id is for that participant which request has released.



Moderator CallBack

processFloorRequeted:event=>{ },

Where event is

{ msg: 'Floor Released', result: "1712" }


Participant CallBack

floorReleased:event=>{ },

Where event is

{ result:1712, msg:'Floor Released', clientId:5222fa14-58ab-4e3e-95ca-47fbf31ad15c }

Hard Mute Room

These APIs help hard-mute Room at runtime. These API calls are only available to users with role "Moderator". On Room being put on hard-mute, all participants audio stream is stopped automatically. When the Room is put on hard-mute, then last known mute-state of all connected users is reset.

To mute room use below method:
Enx.muteAllUser();


Moderator Callback:

Moderator receive when hard muted room by moderator. mutedAllUser:event =>{ },

Where event: { result : 0, msg : 'room muted' }

Participant Callback:


Participant receive when hard muted room by moderator. hardMutedAll:event =>{ },

Where jsonObject is: { msg:'Room is muted', status:true }


Hard Unmute Room

These APIs help hard-unmute Room at runtime. These API calls are only available to users with role "Moderator". On Room being put off hard-mute, all participants audio stream starts automatically. When the Room is put off hard-mute, then last known mute-state of all connected users is reset.

To mute room use below method:
Enx.unMuteAllUser

Moderator Callback: unmutedAllUser:event =>{ },

Where jsonObject is: { result : 0, msg : 'room-unmuted' }

Participant Callback:
Participant receive when hard unmute used by moderator.


hardUnmuteAllUser:event =>{ },

Where jsonObject is: { msg:'Room is un-muted', status:false }



Canvas Started

Client endpoint will be notified about a canvas Started.

canvasStarted:event=>{ },

Where event is

{ result:0, name:'Shashank', clientId:4b9f85c1-ec1c-4955-97bd-bdbe188b976a, streamId:21 }


Canvas Stopped

Client endpoint will be notified about a canvas Stoped.

canvasStopped:event=>{ },

Where event is

{ result:0, name:'Shashank', clientId:4b9f85c1-ec1c-4955-97bd-bdbe188b976a, streamId:21 }

List of Participants:

This API is designed to return a JSON Structure containing information about user connected to the Room during a call. Some users may be publishing audio/video, some may be subscribed to others whereas some may neither be publishing nor subscribed to others.


Callback Receive when any user join to the room.




userJoined:event =>{ },

Where event is

{ clientId: f1a0f629-4505-4867-ab40-feb0c0e5759d, name: 'Android', permissions: { controlhandlers: true, publish: true, record: false, stats: true, subscribe: true }, role: 'participant', user_ref: 2236 }


Callback receive when user leave the room.

userDisconnected:event = > { },

Where event is

{ clientId: f1a0f629-4505-4867-ab40-feb0c0e5759d, name: 'Android', permissions: { controlhandlers: true, publish: true, record: false, stats: true, subscribe: true }, role: 'participant', user_ref: 2236 }

Screen Share Start

Participant receive when a screen shared started by a user.





Callback

screenShareStarted:event = >{ },

Where event is

{ clientId : d334a039-90af-4c5d-93ad-6f71ea20a36e, name : 'Android', result : 0, streamId : 11 }

Screen Share Stop

Participant receives when the screen shared by a user has stopped.





SceenShareStopped:event = >{ },

Where event is

{ clientId : d334a039-90af-4c5d-93ad-6f71ea20a36e, name : 'Android', result : 0, streamId : 11 }