Live Statistics
The iOS SDK provides the following methods for obtaining live statistics of local, remote, canvas streaming, and screen sharing during a session:
- enableStats(): To get live statistics of each stream.
- enablePlayerStats(): To receive statistics of streams individually.
- subscribeForTalkerNotification(): To receive notification about the talkers in a room.
Live Media Statistics
The EnxRoom.enableStats()
method allows you to receive statistics of all the streams received in a room. These statistics help you analyze the quality of these streams. For each stream, the following information is received:
- Publishing Resolution
- Publisher Bandwidth
- Receiver's Resolution
- Receiver's Bandwidth Consumed
- Receiver's Available Bandwidth
Class: EnxRoom
Method: (void)enableStats:(BOOL)isEnabled
Parameter: isEnabled
: Boolean. Set it to true to receive statistics. Otherwise, set it to false.
Callbacks
Callback | Description |
---|---|
-didAcknowledgeStats: | Acknowledgement to users when receiving of stream statistics is enabled or disabled. |
-didReceiveStats: | Notification to users when statistics of all the streams is received. |
Sample Code
// To enable stats at Room Level[enxRoom enableStats:true];// To get to know stats has been enabled or disabled-(void)didAcknowledgeStats: ( NSArray * _Nonnull)subUnSubResponse{}//Delegate to receive room level stats-(void)didReceiveStats: ( NSArray * _Nonnull)statsData{}
Receive Stream Statistics for Individual Streams
The EnxPlayerView.enablePlayerStats()
method allows you to receive the statistics of streams being played on the player individually. Please note that to receive individual stream stats, you must enable stats at room level using the EnxRoom.enableStats()
method.
Class: EnxPlayerView
Method: -(void)enablePlayerStats:(BOOL)isEnabled
Parameter isEnabled
: Boolean. Set it to true to receive statistics. Otherwise, set it to false.
Callbacks: -didPlayerStats
: Notification to the user when player's stream stats is received.
Sample Code
// To enable player's stream stats[enxPlayer enablePlayerStats:true];//Delegate to receive player's stream stats-(void)didPlayerStats: ( NSArray * _Nonnull)statsData{}
Error Codes and Exceptions
Code | Description |
---|---|
5075 | Repeated stream stats subscription request as a previous request is in process. |
5076 | Repeated stream stats unsubscription request as a previous request is in process. |
5077 | Repeated stream stats request while stream stats is already subscribed. |
5078 | Unsubscribing stream stats is not permitted without subscribing to it. |
5079 | Unable to unsubscribe to stream stats while subscription request is in process. |
5080 | Stream stats unsubscription request is in process. |
Talker and Noise Notification
This functionality is available from the iOS SDK version 1.9.5 and later.
The subscribeForTalkerNotification()
method allows you to receive notifications for the talkers in the room or the participants acting as a noise source. You can utilize this method for UI display or debugging.
Note that the list of talkers received could be longer than the Active Talkers list because the Active Talkers list received with the onActiveTalkersUpdated
event is limited to the max_active_talkers
setting of the room.
Method: (void)subscribeForTalkerNotification:(BOOL)enabled
Parameter: enabled
: Boolean. Set it to true to subscribe to the talker notification. Otherwise, set it to false.
Callbacks
Callback | Description |
---|---|
\- room:didAckSubscribeTalkerNotification: | Acknowledgment to the subscriber when the talker notification subscribed successfully. |
\- room:didAckUnsubscribeTalkerNotification: | Acknowledgment to the subscriber when the talker notification unsubscribed successfully. |
\- room:didTalkerNotification: | Notification received by the subscriber along with the JSON object containing the details of users from whom speech or sound is detected. |
Sample Code
[room subscribeForTalkerNotification:true]; // To subscribe[room subscribeForTalkerNotification:false]; // To unsubscribe// Acknowledgement on Talker Subscription-(void)room:(EnxRoom *_Nullable)room didAckSubscribeTalkerNotification:(NSArray *_Nullable)data;/*data example:({ "result": {"result": 0,"msg": "Success"},"id": "talker-notification"})*/// Acknowledgement on Talker Unsubscription-(void)room:(EnxRoom *_Nullable)room didAckUnsubscribeTalkerNotification:(NSArray *_Nullable)data;/*data example:({ "result": {"result": 0,"msg": "Success"},"id": "talker-notification"})*/// Receive Talker Notification on Subscription-(void)room:(EnxRoom *_Nullable)room didTalkerNotification:(NSArray *_Nullable)data;
JSON Payload of Response: - room:didTalkerNotification
Object | Key | Data Type | Description |
---|---|---|---|
data |
data.speech |
Object | It contains an array of users who are talking along with their clientIds and speechType (Intensity) as low, mediim, or high. |
data.noise |
Object | An array of clientIds producing noise. |
Sample Code
{"type": "talker-notification","data": [{"speech": true,"users": [{"speechType": "high""clientId": "xxxxx"},{"speechType": "medium""clientId": "yyyyy"},{"speechType": "low""clientId": "zzz"}]},{"noise": true,"users": [{"clientId": "sssss"},{"clientId": "uuuuu"}]}]}
Error Codes and Exceptions
Code | Description |
---|---|
5128 | Repeated subscription request is called while a previous request is in process. |
5129 | Repeated unsubscription request is called while a previous request is in process. |
5130 | Talker notification is already subscribed. |
5131 | Illegible attempt to unsubscribe talker notification without subscribing first. |