Basic Functions of iOS SDK describes the necessary tasks to achieve basic Audio/Video communication between participants connected from their End-Point Applications to an EnableX hosted Room. For more advanced use cases, please refer Advance Features & Moderator Controls.

Table of Contents

Get list of Audio Devices

You can initiate a Stream using either the browser’s default Audio Device or by specifying the ID of the Audio Device connected to the device running the client application which requires you to get the Device IDs of all the connected devices.  

The EnxRoom.getDevices() method provides a list of all the Microphones connected to your Device. You can also use this method to build UI Element allowing users to choose an Audio Device from the list.

Class: EnxRoom

Method: -(NSArray*)getDevices;

Returns: Device list

NSArray *devicesList = [room getDevices];

// Returns [Speaker, EARPIECE, Headphones, Bluetooth] 
// Note: One or many of these devices in array as applicable

Get selected Audio Device by User

The EnxRoom.getSelectedDevice() method provides the currently selected/in-use Audio Device for the Stream.

Class: EnxRoom

Method: -(NSString*)getSelectedDevice;

String selectedDevice =  [room getSelectedDevice]; 
// Returns one of these - Speaker, EARPIECE, Headphones, Bluetooth

Initiate a Room

An RTC session takes place in a Virtual Room hosted at EnableX and the iOS SDK allows the Client endpoint application to connect to it. The process starts with initializing a Room Object using the EnxRoom Class.

Class: EnxRoom

Method: -(instancetype)init;

EnxRoom *room = [[EnxRoom alloc] init];

Connect to Room

The EnxRoom.connect() method connects the client application to the virtual Room hosted on the EnableX server where the RTC session takes place. After initializing the room, the client endpoint must connect to the room to establish a bi-directional communication channel over a Web Socket.  

As the communication takes place over the Web Sockets using Socket Events, any network issue leading to the disconnection of the Web Sockets would cause the communication to fail. In such cases, EnableX offers the option to Auto-Reconnect.

Note that Auto-Reconnect is not applicable under the following circumstances:

  • The last participant disconnected from Adhoc Room.
  • The participant is dropped from the Room by the Moderator.
  • The user disconnects explicitly.

Class: EnxRoom

Method: - (void)connect:(NSString *)token roomInfo:(NSDictionary *)roomInfo advanceOptions:(NSArray *)advanceOption;

Parameters:

  • token: String. A JWT Token to connect to the Room as received using Server API Call via Application Server.
  • roomInfo – Optional. JSON Object with Reconnection Options. JSON keys are explained below:
    • allow_reconnectBoolean. Default: true. Set to true to enable Auto-Reconnect feature. When set to false, the Client endpoint does not try to reconnect to EnableX.
    • number_of_attemptsNumeric. Min Value: 1. Max Value: Not specified, use any number. Default: 3. A maximum number of attempts made by the Client endpoint to reconnect to EnableX.
    • timeout_intervalNumeric. Timeout Interval in Millisecond required by the Client endpoint to wait before attempting to reconnect.
    • activeviews: Enum. Values: list or view. Set to view to get a predefined view of all the video Streams in a session. Set to list to get individual streams to create your own view with the video streams.
    • forceTurn: Boolean. Default: false. Set to true to force Video Streams through a TURN Server.
    • chat_only: Boolean. Default: false. Set to true to enable only text-chat and disable audio-video communications.
    • playerConfiguration: JSON Object with Video Player Configurations.
      • audiomute: Boolean. Default: true. Set to true to show and false to hide the Audio Mute/Unmute button.
      • videomute: Boolean. Default: true. Set to true to show and false to hide the Video Mute/Unmute button.
      • bandwidth: Boolean. Default: true. Set to true to show and false hide the Low-Bandwidth notification button.
      • screenshot: Boolean. Default: true. Set to true to show and false to hide the Screenshot button.
      • avatar: Boolean. Default: true. Set true to show and false to hide Avatar for No-Video Stream.
      • iconColor: String. Default #FFFFFF. HEX color code for icons.
      • iconHeight: Number. Default 30. Icon height in pixel.
      • iconWidth: Number. Default 30. Icon width in pixel.
      • avatarHeight: Number. Default 200. Avatar height in pixel.
      • avatarWidth: Number. Default 200. Avatar width in pixel.
      • pinned: Boolean. Default: false. Set to true to show pinned user icon.
  • advanceOptions – Optional. Array of Advanced Options. Each element of the array consists of a key-value pair as given below:
    • battery_updatesBoolean. Set to true to enable Auto-Battery Updates feature.
    • notify-video-resolution-changeBoolean. Set to true to enable Video Resolution Change Notification feature.

Delegate Methods:

  • - room:didConnect:  – Acknowledgment to the Client endpoint when it gets connected to the Room.
  • - room:didError:– Acknowledgment to the Client endpoint when it fails to connect to the Room.
  • - room:userDidJoined: – Notification to everyone in the Room when a new user is connected to the Room.
  • room:didRoomAwaited– Notification to the Client endpoint when it awaits the Moderator’s permission to enter a Knock-enabled Room or awaits the Moderator to enter the Room first in a Wait-for-Moderator enabled Room. The event’s JSON structure provides information on whether the Room is Knock-enabled { "event_type": "knock" } or Wait-for-Moderator enabled { "event_type": "wait_for_moderator" }.
NSString *token = "XXX";
NSDictionary *roomInfo = { // Re-Connect Options
 @"allow_reconnect": true,
 @"number_of_attempts": 3,
 @"timeout_interval": 10000,
 @"audio_only": false
}; 

NSDictionary *advanceDict= @{
 @"id":@"battery_updates",
 @"enable":@YES
};

NSMutableArray *advanceOptionArray = [[NSMutableArray alloc] init];

[advanceOptionArray addObject:advanceDict];

advanceDict= @{
 @"id":@"notify-video-resolution-change",
 @"enable":@YES
};

[advanceOptionArray addObject:advanceDict]; 

// Initiates Room 
EnxRoom *room = [[EnxRoom alloc] init];

// Connects with Re-Connection & Advance Options
[room connect:token roomInfo:roomInfo advanceOptions:advanveOptionArray ];
 

//Delegate methods
-(void)room:(EnxRoom *)room didConnect:(NSDictionary *)roomMetadata{
      // Connected. Delegate receives room instance and Room Meta JSON.
}

-(void)room:(EnxRoom *)room didError:(NSString *)reason{
 // Connection failed. Find error
}

-(void)room:(EnxRoom *)room userDidJoined:(NSArray *)Data{
 // A new user connected. user JSON has user information
}

-(void)room:(EnxRoom *)room didActiveTalkerList:(NSArray *)Data{
      // List of talkers in the Room
      // Received after room connected.
}

Error Codes / Exceptions:

Code Description
5086Unable to Connect to Room.

Initiate Local Stream

The EnxRoom.getLocalStream() method is used to initialize a local stream at the Client endpoint before it can be published to the Room. The initialization process comprises specifying media tracks, adding custom attributes, etc. in the form of a JSON object passed as a parameter to the method.

ClassEnxRoom

Method: –(EnxStream *)getlocalStream:(NSDictionary *)publishStreamInfo;

ParameterspublishStreamInfo – A JSON object with Local Stream Options as given below:

{
     "audio": true,          // Whether to add Audio to stream
     "video": true,          // Whether to add Video to stream
     "data": true,           // Whether to add Data to stream
     "videoSize":  {         // Video Frame Size
           "minWidth": number, 
           "minHeight": number,  
           "maxWidth": number,
           "maxHeight": number
       ), 
     "audioMuted": true,     // Audio muted on entry to room  
     "videoMuted": true,     // Video muted on entry to room  
     "attributes": {         // Object to carry custom data  
         "custom1": ""
      },
      "maxVideoBW": number,  // Max Bandwidth 
      "minVideoBW": number   // Min Bandwidth  
 } 

Error Codes / Exceptions:

CodeDescription
5015Failed to initialize a Stream without Audio, Video, and Data track.
5016Failed to initialize the Stream due to incorrect values of JSON Keys in publishStreamInfo.
5017Unable to create Stream due to failure to access Camera and Microphone.
5018Unable to create Video Stream due to failure to access Camera. Only Audio Stream created.
5019Unable to create Stream due to failure to access Microphone.
5084Invalid Video Layer. Max allowed Video Layers: 3.
5088Invalid Frame Rate. Max allowed Frame Rate: 30.

Join a Room with Stream

A typical process to connect to a room is as follows: 

  1. Initiate a room and connect to it. 
  2. Initiate streaming after connecting which requires you to check media accessibility.
  3. Publish local stream.
  4. Check if the stream is successfully published. 

To successfully join a Room, you need to ensure the success of each step before proceeding to the next thus making it a complex process.

The EnxRtc.joinRoom() method allows you to quickly join a room and get started without having to follow the above procedure step by step.

Class: EnxRtc

Method: -(EnxStream *)joinRoom:(NSString *)token delegate:(id)delegate PublishStreamInfo: (NSDictionary *)publishStreamInfo;

Parameters:

  • token – String. A JWT Token to connect to the Room as received using Server API Call via Application Server.
  • delegate: EnxRoomDelegate object is the delegate for the EnxRoom object.
  • publishStreamInfo– Optional. Stream Initialization Meta Info.

Returns: EnxStream – Published Local Stream JSON Object.

NSDictionary* publishStreamInfo = {
         video: true,
         audio: true,
         data: true,
         attributes: { name: "XX" }
}

NSString* token = "XXX";

EnxRtc *enxRtc = [[EnxRtc alloc] init];
EnxStream *localStream = [enxRtc joinRoom:token delegate:self publishStreamInfo:publishStreamInfo];

//Delegate methods
-(void)room:(EnxRoom *)room didConnect:(NSDictionary *)roomMetadata{
	// Connected. Delegate receives room instance and Room Meta JSON.
}

-(void)room:(EnxRoom *)room didError:(NSString *)reason{
	// Connection failed. Find error
}

Disconnect from a Room

The EnxRoom.disconnect() method is used to close the session and disconnect the client endpoint from the Room. The media and signaling sockets are also released in this process.  

Class: EnxRoom

Method: - (void)disconnect;

Delegate Methods:

  • –room:didRoomDisconnect: – Acknowledgment to the user when disconnected. The Callback allows you to update the UI of the user post disconnect.
  • –room:userDidDisconnected: – Notification to everyone in the Room when a user gets disconnected. The Callback allows you to update the UI of other connected users.
[room disconnect];

- (void)room:(EnxRoom *)room didRoomDisconnect:(NSArray * _Nullable)response {
    // You are disconnected
}
-(void)room:(EnxRoom *)room userDidDisconnected:(NSArray *)Data{
     // A user is disconnected
     // Data - User Information of disconnected user
}

Error Codes / Exceptions

CodeDescription
5031Repeated disconnect() call made while previous disconnection request is in process.
5032When the user tries to disconnect after getting disconnected from the Room.

Publish / Unpublish Local Stream

After initializing the stream, you need to publish it in the room so that the other users in the room can see and hear the user.  The methods to publish, unpublish, and close a local stream are explained in this section.

Publish Local Stream

The EnxRoom.publish() method publishes a local stream in the connected room. 

Class: EnxRoom

Method: - (void)publish:(EnxStream *)stream;

Parameters:

  • stream– Initiated Stream Object

Delegate Methods:

  • - room:didPublishStream: – Acknowledgment to the Stream publisher when the stream gets published.
  • - room:didAddedStream: – Notification to everyone in the Room when a new stream is published in the Room.
[room publish:localStream];

- (void)room:(EnxRoom *)room didPublishStream:(EnxStream *)stream{
	// Your stream is published
}

-(void)room:(EnxRoom *)room didAddedStream:(EnxStream *)stream{
	// Announcement of a new Stream in the Room
	// You may subscribe to the Stream
}

Error Codes / Exceptions

CodeDescription
5013Failed to publish Stream.
5015Unable to publish a Stream without audio, video, and data.
5016Unable to publish a Stream with illegible attributes.
5022Failed to publish Stream because Floor Access not received in lecture mode room.
5023The Stream has already been published.
5024Repeated publish() call while Stream Publishing is in process.
5025Failed to publish stream because publish() call is made on a Remote Stream.
1170The current subscription doesn’t support the publishing of Stream.

Unpublish Local Stream

The EnxRoom.unpublish() method disconnects the local stream from the room. Unpublishing a stream does not release the device access so that subsequent republishing does not require device-access-permission. 

Class: EnxRoom

Method: - (void)unpublish;

Delegate Method: – room:didRemovedStream: – Notification to everyone in the Room when a Stream is removed from the Room.

[room unpublish]; // To unpublish all Local Streams

-(void)room:(EnxRoom *)room didRemovedStream:(EnxStream *)stream{
     // To announce in the room that a stream has been removed from the Room.
}

Error Codes / Exceptions

CodeDescription
5029Repeated unpublish call made while the previous request is in process.
5030Non-Contextual use of method when the user tries to unpublish a stream before publishing it.

Subscribe Remote Streams

The EnxRoom.subscribe() method is used to receive the media stream of other users connected to the Room. You must call this method for each participant’s media stream individually to receive it. 

You don’t need to subscribe to your Local Stream as EnableX facilitates the publisher to receive their own Screen Sharing and Canvas Streaming without explicitly subscribing to it. In short, a user must only subscribe to the Remote Streams in the Room. 

Refer to Handle Active Talkers section below for more details.

Class: EnxRoom

Method: -(void)subscribe:(EnxStream *)stream;

Parameters: stream – The Stream object that needs to be subscribed.

Delegate Method:

room:didSubscribeStream:  – Acknowledgment to the subscriber when they have subscribed to the Stream successfully.

// There is a new stream you may subscribe
-(void)room:(EnxRoom *)room didAddedStream:(EnxStream *)stream{
	[room subscribe:stream]; // Subscribe to it.
}

- (void)room:(EnxRoom *)room didSubscribeStream:(EnxStream *)stream {
	// You subscribed to stream.
}

Error Codes / Exceptions

CodeDescription
5014Failed to subscribe to the Stream.
5026Stream has already been subscribed.
5027Repeated subscribe() call made while a previous subscription request is in process.
5028Failed to subscribe because subscribe() call is made on the Local Stream.

Handle Active Talkers

To avoid excessive consumption of the server and client resources, EnableX sends a maximum of 12 actively talking users in the Room to the client endpoint. Additionally, it sends Screen Sharing (StreamID# 101) and Canvas Stream (StreamID# 102) if the client application supports these features. The decision on which of the participant’s streams would be played depends upon the Active Talker List. 

After getting connected to the Room, your Client endpoint will also receive onStreamAdded() callback for all the Streams (as per the max_active_talkers configured during Room Creation) available in the Room. You need to subscribe to each of these Streams along with two extra Streams for Screen-Share and Canvas.

After you connect to the room and subscribe to the available Streams, the active-talkers-updated event is triggered, which creates a new entry in the Active Talker List. This list keeps getting updated depending upon the latest talker in the Room. Hence the Active Talker List contains a list of talkers in ascending order at any point in time which means that the latest talker would be moved up in the list. Therefore, you may expect to receive the event too frequently in a noisy room. The list of Active Talkers is available in JSON format and sent through Callback onActiveTalkerList() to each connected endpoint whenever there is a change in the Active Talker List if activeviews : list during joinRoom(). If activeviews: view then onActiveTalkerList() is called only once after joining the Room and subscribing to the Active Talker List.

Apart from the activity level, EnableX also allows pinning of user streams in the Active Talker List regardless of their activity level in the Room. So, the Active Talkers List consists of the inactive pinned users and active talkers in ascending order.  stream.pinned returns true if the stream is pinned.

It must also be noted that the Active Talkers List contains Remote Streams only and hence the Active Talkers List varies for each participant in the Room. 

Active Talkers List JSON

[ EnxStream1, EnxStream2, ....., EnxStreamN ] 

Note: In case of error, <null> is received at 1st Index, and Error Info at 2nd Index

This Active Talkers JSON is used for managing the UI and to play Remote Stream’s Audio/Video. To play a specific stream, you need the  Remote Stream object using room.streamsByStreamId[StreamId]. You must subscribe to all “dummy” Streams received through delegate method - room:didAddedStream: before you can play a Stream out of Active Talker List.

Class: EnxRooom

Delegate Method:

  • - room:didActiveTalkerList: When activeviews is set to "list” in the roomInfo parameter in connect() method.
  • - room:didActiveTalkerView: When activeviews is set to "view” in the roomInfo parameter in connect() method.
// To get Active Talker List
-(void)room:(EnxRoom *)room didActiveTalkerList:(NSArray *)Data{
 for (EnxStream *stream in Data) {
 if(stream.enxPlayerView != nil) {
 EnxPlayerView *playerView = (EnxPlayerView *)stream.enxPlayerView;
 playerView.frame = CGRect;
 playerView.delefate = self;
 [self.view addSubview: playerView];
 }
 }
}

// To get Acive Talker View
-(void)room:(EnxRoom *_Nullable)room didActiveTalkerView:(UIView *_Nullable)view {
     [self.view addSubview: view]; 
}

Get maximum permissible Talker Count

The EnxRoom.getMaxTalkers() method provides the maximum active talkers allowed for the Room as per max_active_talkers configuration during Room Creation. This count could be of interest to the user if they choose to receive less active talkers in the Room. By default, the max_active_talkers is restricted to 12. 

Class: EnxRoom

Method: - (void)getMaxTalkers;

Delegate Method: - (void)room:(EnxRoom *)room didGetMaxTalkers:(NSArray *)Data

[room getMaxTalkers];

-(void)room:(EnxRoom *)room didGetMaxTalkers:(NSArray *)Data {
     // Talker info in success response jsonobject:
     // [{"result": 0, "maxTalkers": 4}] 
}

Get Talker Count

The EnxRoom.getTalkerCount() method provides you the number of active talkers to be received through onActiveTalkerList() callback. The method returns the number of currently active streams in the Room restricted either by the maximum permissible talker count or by the set talker count API when invoked by the application or the user through UI.  

Class: EnxRoom

Method: -(void) getTalkerCount;

Delegate Method: - (void)room:(EnxRoom *)room didGetTalkerCount:(NSArray *)Data

[room getTalkerCount]; 

-(void)room:(EnxRoom *)room didGetTalkerCount:(NSArray *)Data{
    // Data: [{ "result": 0, "numTalkers": 4 }] 
}

Set Talker Count

The EnxRoom.setTalkerCount() method is used to set the number of active talkers in the Active Talkers List to a particular value not exceeding the maximum permissible talker count. This could either be ingrained at the application level or be implemented as a UI feature where the end-user has the flexibility to control the number of remote streams they want to receive.  This method allows you to control how many Streams you would like to receive. 

Class: EnxRoom

Method: - (void) setTalkerCount:(NSInteger)numTalkers;

ParametersnumTalkers – The Number of Talker Streams you want to receive. Range limited by max_active_talkers, typically 0-12.

  • If you set numTalkers to any value from 1 to 12, you receive those many talkers in the Active Talker List.
  • If you set numTalkers to 0 (zero), then the list doesn’t become empty, it carries 3 audio streams and no video Streams.

Delegate Method : -(void)room:(EnxRoom *)room didSetTalkerCount:(NSArray *)Data;

[room setTalkerCount:3];


-(void)room:(EnxRoom *)room didSetTalkerCount:(NSArray *)Data{
 // Data: [{ "result": 0, "numTalkers": 3 }]
}

Error Codes / Exceptions

CodeDescription
5055Repeated setTalkerCount () call made while a previous request is in process.

Handle Disconnection & Reconnection

A Client endpoint is connected with EnableX over Secured Web Socket, which is susceptible to network failures. The Client endpoint is notified of the failure through the following Callbacks:

Delegate Methods:

  • - room:didConnectionLost: – Notification to the Client endpoint when the endpoint loses network connection.
  • - room:didConnectionInterrupted: – Notification to the Client endpoint when the connection is interrupted e.g Switch from WiFi to 4G and vice versa.
- (void)room:(EnxRoom*)room didConnectionLost:(NSArray*)data {
	// Disconnected. Handle UI 
} 

- (void)room:(EnxRoom*)room didConnectionInterrupted:(NSArray*)data{
	// Interrupted. Handle UI 
}

For disconnected endpoints, EnableX provides Auto-Reconnection functionality to ensure a better user experience. To use the Auto-Reconnection feature, you must Connect to Room with Reconnection options. Note that Auto-Reconnect is not applicable under the following circumstances:

  1. The last participant disconnected from Adhoc Room.
  2. The participant is dropped from the Room by the Moderator.
  3. The user disconnects explicitly.

Delegate Methods:

  • - room:didUserReconnectSuccess:– Notification to the user when the Client endpoint successfully gets reconnected with EnableX.
  • - room:didReconnect: – Notification to the user when the Client endpoint attempts to reconnect within the given time period.
NSDictionary *roomInfo = { // Re-Connect Options
	@"allow_reconnect": true,
	@"number_of_attempts": 3,
	@"timeout_interval": 10000,
	@"audio_only": false
}; 

NSDictionary *advanceDict= @{
	@"id":@"battery_updates",
	@"enable":@YES
};

NSMutableArray *advanceOptionArray = [[NSMutableArray alloc] init];

[advanceOptionArray addObject:advanceDict];

advanceDict= @{
	@"id":@"notify-video-resolution-change",
	@"enable":@YES
};

[advanceOptionArray addObject:advanceDict]; 


[room connect:@"token" roomInfo:roomInfo advanceOptions:advanveOptionArray ];

-(void)room:(EnxRoom*)room didUserReconnectSuccess:(NSDictionary*)data{
	// Got reconnected
}

- (void)room:(EnxRoom *)room didReconnect:(NSString *)reason{
	// Reconnecting 
}

Error Codes / Exceptions:

CodeDescription
5073Connection is switched to the current network.
5074Network disconnected. Reconnection attempt timed-out
5086When any method is called while the Room is not connected.
5087Reconnection failed

Play Stream

You can play a local stream and all subscribed remote streams including screen-share, canvas streams within EnxPlayerView Object. Therefore, you need to create an Object of EnxPlayerView Class and then attach the Stream to Player View using EnxStream.attachRenderer() method.

To stop playing a Stream, detach the Stream from PlayerView using EnxStream.detachRenderer().

Class:

  • EnxPlayerView – To initiate a Player View object.
  • EnxStream – To attach the Stream to the Player View

Method: To play Stream

- (void)attachRenderer :(EnxPlayerView*)ObjEnxPlayerView;

Parameter: ObjEnxPlayerView – A Player View Object

Method: To stop playing Stream

- (void)detachRenderer;

// To Initialize Local Stream Player View Object 
EnxPlayerView *playerView = [[EnxPlayerView alloc] initLocalView:(CGRect)];

// To Initialize Remote Stream Player View Object 
// EnxPlayerView *playerView  = [[EnxPlayerView alloc] initRemoteView:(CGRect)];
 
[stream attachRenderer:PlayerView]; // Attach stream to playerview to play
[yourCustomView addSubview:PlayerView]; // Add playerView to your view

[stream detachRenderer]; // Detach Renderer to stop playing

Adjust Layout

You can choose to play the Remote Streams in the Active Talker List with a custom-defined view by selecting activeviews : view during connect(). In this case, you don’t have to handle the UI as the pre-defined Video Grid plays all the Streams received at the Client endpoint.

When choosing this option, you can use adjustLayout() method to adjust the Video player layout to fit within its parent view. This method helps when the user rotates the screen or when the view needs to be adjusted to fit properly.

Class: EnxRoom

Method:

  • public void adjustLayout(int frameWidth, int frameHeight) 

Parameters:

  • frameWidth: Width of Framed View.
  • frameHeight: Height of Framed View.
enxRoom.adjustLayout(width,height)

Know Stream Information

The following methods provide Stream-related information such as the Stream type, media tracks, state, etc.

Get Stream ID

The Stream ID of a given Stream can be obtained from its property streamId. The Stream ID is used to identify every Stream, be it a local or a remote stream, a canvas stream, or a screen-share stream.

ClassEnxStream

PropertystreamId

Verify availability of Media Tracks in Stream

EnxStream class provides the following methods to check the presence of a particular media track in the Stream.

Class: EnxStream

Methods:

  • To check if Stream has an Audio Track:
    • - (BOOL)hasAudio – No Parameter required.
  • To check if Stream has a Video Track:
    • - (BOOL)hasVideo – No Parameter required.
  • To check if Stream has a Data Track:
    • - (BOOL)hasData – No Parameter required.

Returns: Boolean

if ([stream hasVideo] ) {
     // The Stream has a Video Track in it
}

// Other methods are also used in the similar manner.

Know if Stream is Local or Remote

The Stream’s property isLocal is used to know if the given Stream is a Local or a Remote Stream.

Class: EnxStream

Property: isLocal – BOOL

if (stream.isLocal) {
     // It's a Local Stream
 }
 else {
     // It's a  Remote Stream
 }

Know Room Information

The EnxRoom Class provides the following methods to access various room-related information.

Get Room ID

The roomID property provides the ID of the Room you are connected to. The Room ID is assigned to each Room during Room Creation.

Class: EnxRoom

Property: roomId

NSString* roomID= room.roomId; 

Get Room Meta Information

The roomMetadata property provides the Meta Information of the Room to which you are connected. The Room Meta information JSON payload contains the complete Room definition along with many run-time parameters with their current values and room-stats of connected users and streams. All the endpoints receive this information through - room:didConnect: delegate method after getting connected to the Room. Some of the run-time parameters are updated internally by the SDK on various events.

Class: EnxRoom

property: roomMetadata

NSDictionary* roomMeta = room.roomMetadata;

Get Client ID of the connected User

The clientId property provides the Client ID of the connected endpoint. The Client ID is unique for each user connected to the Room for the session.

Class: EnxRoom

Method: clientId

NSString* ClientId = room.clientId; 

Get Name of the connected User

The clientName property provides the name of the user connected through the Client endpoint.

Class: EnxRoom

Method: clientName

NSString* ClientName = room.clientName; 

Get Role of the connected User

The userRole property provides the role of the user connected to the Room for the session, either Moderator or Participant.

Class: EnxRoom

Method: userRole

NSString* role = room.userRole;

Get Information of the connected User

The EnxRoom.whoami() method provides the complete User Meta Information of the connected user.

Class: EnxRoom

Method: - (NSDictionary)Whoami;

Returns: User Meta Information JSON object.

NSDictionary* myinfo = [room Whoami]; 

Get list of connected Users

The userList property provides a list of users connected to the Room.

Class: EnxRoom

Property: NSArray userList

(NSArray)Users = room.getUserList()

// Return JSON Users
/*
[
      {
          "clientId": "",             // Unique Client ID assigned by EnableX
          "name": "",                 // User's name
          "user_ref": "",             // User's Reference
          "role": "participant",      // Enum: moderator, participant
          "permissions": {            // In-Session Permission of User
          "publish": Boolean,         // Whether user can pubish local stream
          "subscribe": Boolean,       // Whether user can subscribe remote streams
          "record": Boolean,          // Whether user can initiate recording
          "stats": Boolean,           // Whether user can view stream status
          "controlhandlers": Boolean  
          }
      }
  ] 
*/

Get Local Stream ID

The publishStreamId property provides the ID of your Local Stream published in the Room.

Class: EnxRoom

Property: NSString publishStreamId

NSString* publishStreamID = room.publishStreamId; 

Get Stream by Stream ID

The streamsByStreamId property provides the Stream information for the given Stream ID.

Class: EnxRoom

Property: NSDictionary streamsByStreamId

NSDictionary* streamsDict = room.streamsByStreamId; // Get Dictionary

EnxStream* stream =  streamsDict[@"StreamID"];  // Get specific Stream Object

Get list of Remote Streams

The remoteStreams property provides the list of Remote Streams available in the Room.

Class: EnxRoom

Property: NSArray remoteStreams

NSArray* remoteStreams = room.remoteStreams;

Explore iOS SDK