{"id":4463,"date":"2021-11-23T19:09:00","date_gmt":"2021-11-23T11:09:00","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4463"},"modified":"2025-04-11T21:10:45","modified_gmt":"2025-04-11T13:10:45","slug":"active-talkers","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/ios-toolkit\/active-talkers\/","title":{"rendered":"Active Talkers: iOS SDK &#8211; Video API"},"content":{"rendered":"\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li><a href=\"#active-talkers\">Handle Active Talkers<\/a> <ul><li><a href=\"#get-max-talkers\">Get maximum permissible Talker Count<\/a><\/li><li><a href=\"#get-talker-count\">Get Talker Count<\/a><\/li><li><a href=\"#set-talker-count\">Set Talker Count<\/a><\/li><li><a href=\"#switch-active-talker\">Switch Active Talker View<\/a><\/li><li><a href=\"#playerview\">EnxPlayer View<\/a><ul><li><a href=\"#switch-to-playerview\">Switch to Player View<\/a><\/li><li><a href=\"#highlight-playerview-border\">Highlight EnxPlayer Border<\/a><\/li><li><a href=\"#change-playerview-background\">Change EnxPlayer Background <\/a><\/li><li><a href=\"#force-active-talker-view\">Force Reload Active Talker View<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul>\n\n\n\n<a name=\"active-talkers\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>Handle Active Talkers<\/h2>\n\n\n\n<p>To avoid excessive consumption of the server and client resources,&nbsp;The platform sends a maximum of 12 actively talking users in the Room&nbsp;to the client endpoint. Additionally, it sends Screen Sharing (StreamID# 101) and Canvas Stream (StreamID# 102)&nbsp;if the client application supports these features.&nbsp;The decision on which of the participant\u2019s streams would be played depends upon the&nbsp;Active Talker List.&nbsp;<\/p>\n\n\n\n<p>After getting connected to the Room, your Client endpoint will also receive <code>didStreamAdded() <\/code>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. <\/p>\n\n\n\n<p>After you connect to the room and subscribe to the available Streams, the&nbsp;<code>active-talkers-updated<\/code>&nbsp;event is triggered,&nbsp;which creates a&nbsp;new&nbsp;entry in the Active Talker List. This list keeps getting updated depending upon the&nbsp;latest talker in the Room. Hence the Active Talker List&nbsp;contains a list of talkers in ascending order at any point&nbsp;in time which means that the latest talker would be&nbsp;moved up in the list.&nbsp;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&nbsp;<code>didActiveTalkerList()<\/code> to each connected endpoint whenever there is a change in the Active Talker List if <code>activeviews : list<\/code> during<a href=\"..\/room-connection\/#join-room\" target=\"_blank\" rel=\"noreferrer noopener\"> <code>joinRoom()<\/code><\/a>. If <code>activeviews: view <\/code>then <code>didActiveTalkerList()<\/code> is called only once after joining the Room and subscribing to the Active Talker List.<\/p>\n\n\n\n<p>Apart from the activity level,&nbsp;Platform also allows&nbsp;pinning of user streams in the Active Talker List regardless of their activity level in the Room. So, the Active Talkers List consists&nbsp;of the&nbsp;inactive&nbsp;pinned users&nbsp;and active talkers in ascending order.&nbsp;&nbsp;<code>stream.pinned<\/code>&nbsp;returns true if the stream is pinned.<\/p>\n\n\n\n<p>It must also be noted that the Active Talkers List contains Remote Streams only and hence the Active Talkers List varies for each participant&nbsp;in the Room.&nbsp;<\/p>\n\n\n\n<p><strong>Active Talkers List JSON<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ EnxStream1, EnxStream2, ....., EnxStreamN ] <\/pre>\n\n\n\n<p><strong>Note: <\/strong>In case of error,  &lt;null&gt; is received at 1st Index, and Error Info at 2nd Index<\/p>\n\n\n\n<p>This Active Talkers JSON is used for managing the UI and to play Remote Stream&#8217;s Audio\/Video. To play a specific stream, you need the &nbsp;Remote Stream object using  <code>room.streamsByStreamId[StreamId]<\/code>. You must subscribe to all \u201cdummy\u201d Streams received through delegate method <code>- room:didAddedStream:<\/code> before you can play a Stream out of Active Talker List.<\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxRooom<\/code><\/p>\n\n\n\n<p><strong>Delegate Method:<\/strong><\/p>\n\n\n\n<ul><li><code>- room:didActiveTalkerList: <\/code>When <code>activeviews <\/code>is set to<code> \"list<\/code>&#8221; in the <code>roomInfo<\/code> parameter in <a href=\"..\/room-connection\/#connect-room\" target=\"_blank\" rel=\"noreferrer noopener\"><code>connect()<\/code><\/a><code> <\/code>method.<\/li><li><code>- room:didActiveTalkerView:<\/code> When <code>activeviews <\/code>is set to<code> \"view<\/code>&#8221; in the <code>roomInfo<\/code> parameter in <a href=\"..\/room-connection\/#connect-room\" target=\"_blank\" rel=\"noreferrer noopener\"><code>connect()<\/code><\/a><code> <\/code>method.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ To get Active Talker List\n-(void)room:(EnxRoom *)room didActiveTalkerList:(NSArray *)Data{\n for (EnxStream *stream in Data) {\n if(stream.enxPlayerView != nil) {\n EnxPlayerView *playerView = (EnxPlayerView *)stream.enxPlayerView;\n playerView.frame = CGRect;\n playerView.delefate = self;\n [self.view addSubview: playerView];\n }\n }\n}\n\n\/\/ To get Acive Talker View\n-(void)room:(EnxRoom *_Nullable)room didActiveTalkerView:(UIView *_Nullable)view {\n     [self.view addSubview: view]; \n}<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<a name=\"get-max-talkers\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Get maximum permissible Talker Count<\/h3>\n\n\n\n<p>The <code>EnxRoom.getMaxTalkers()<\/code> method provides the maximum active talkers allowed for the Room as per max_active_talkers\u00a0configuration during\u00a0<a href=\"\/developer\/video-api\/server-api\/rooms-route\/#create-room\" target=\"_blank\" rel=\"noreferrer noopener\">Room\u00a0Creation<\/a>.\u00a0This count could be of interest to the user if they choose to receive\u00a0less\u00a0active talkers in the Room.\u00a0By\u00a0default,\u00a0the\u00a0max_active_talkers\u00a0is\u00a0restricted to 12.\u00a0<\/p>\n\n\n\n<p><strong>Class<\/strong>:  <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>:  <code>- (void)getMaxTalkers; <\/code> <\/p>\n\n\n\n<p><strong>Delegate Method<\/strong>:   <code>- (void)room:(EnxRoom *)room didGetMaxTalkers:(NSArray *)Data<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[room getMaxTalkers];\n\n-(void)room:(EnxRoom *)room didGetMaxTalkers:(NSArray *)Data {\n     \/\/ Talker info in success response jsonobject:\n     \/\/ [{\"result\": 0, \"maxTalkers\": 4}] \n}<\/pre>\n\n\n\n<a name=\"get-talker-count\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Get Talker Count<\/h3>\n\n\n\n<p>The <code>EnxRoom<\/code>.<code>getTalkerCount()<\/code> method provides you the number of active talkers to be received through <code>didActiveTalkerList()<\/code>&nbsp;callback. The method returns the number of currently active streams in the Room restricted either by the <a rel=\"noreferrer noopener\" href=\"#get-max-talkers\" data-type=\"internal\" data-id=\"#get-max-talkers\" target=\"_blank\">maximum permissible talker count<\/a> or by the <a rel=\"noreferrer noopener\" href=\"#set-talker-count\" data-type=\"internal\" data-id=\"#set-talker-count\" target=\"_blank\">set talker count API<\/a> when invoked by the application or the user through UI. &nbsp;<\/p>\n\n\n\n<p><strong>Class<\/strong>:  <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>:  <code>-(void)getTalkerCount;<\/code><\/p>\n\n\n\n<p> <strong>Delegate Method<\/strong>:   <code> - (void)room:(EnxRoom *)room didGetTalkerCount:(NSArray *)Data <\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[room getTalkerCount]; \n\n-(void)room:(EnxRoom *)room didGetTalkerCount:(NSArray *)Data{\n    \/\/ Data: [{ \"result\": 0, \"numTalkers\": 4 }] \n}<\/pre>\n\n\n\n<a name=\"set-talker-count\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Set Talker Count<\/h3>\n\n\n\n<p>The <code>EnxRoom.setTalkerCount()<\/code> method is used to set the number of active talkers in the Active Talkers List to a&nbsp;particular value not exceeding the <a href=\"#get-max-talkers\" data-type=\"internal\" data-id=\"#get-max-talkers\" target=\"_blank\" rel=\"noreferrer noopener\">maximum permissible talker count<\/a>. This could either be ingrained&nbsp;at the application level or be&nbsp;implemented as a UI feature where the end-user has the flexibility to control the number of remote streams they want to receive.&nbsp; This method allows you to control how many Streams you would like to receive.&nbsp;<\/p>\n\n\n\n<p><strong>Class<\/strong>:   <code>EnxRoom<\/code>  <\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>- (void)setTalkerCount:(NSInteger)numTalkers;<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:&nbsp;<code>numTalkers&nbsp;<\/code>\u2013 The Number of Talker Streams you want to receive. Range limited by <a href=\"\/developer\/video-api\/server-api\/rooms-route\/#create-room\" data-type=\"internal\" target=\"_blank\" rel=\"noreferrer noopener\">max_active_talkers<\/a>, typically 0-12.<\/p>\n\n\n\n<ul><li>If you set&nbsp;<code>numTalkers&nbsp;<\/code>to any value from 1 to 12, you receive those many talkers in the Active Talker List.<\/li><li>If you set&nbsp;<code>numTalkers&nbsp;<\/code>to 0 (zero), then the list doesn\u2019t become empty, it carries 3 audio streams and no video Streams.<\/li><\/ul>\n\n\n\n<p> <strong>Delegate Method<\/strong> :  <code>-(void)room:(EnxRoom *)room didSetTalkerCount:(NSArray *)Data; <\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[room setTalkerCount:3];\n\n\n-(void)room:(EnxRoom *)room didSetTalkerCount:(NSArray *)Data{\n \/\/ Data: [{ \"result\": 0, \"numTalkers\": 3 }]\n}<\/pre>\n\n\n\n<p><strong>Error Codes \/ Exceptions<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Code<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>5055<\/td><td>Repeated setTalkerCount () call made while a previous request is in process.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<a name=\"switch-active-talker\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Switch Active Talker View <\/h3>\n\n\n\n<p><strong>Availability:<\/strong> iOS SDK 2.1.2+<\/p>\n\n\n\n<p>The <code>EnxRoom.switchATView()<\/code> method provides the option to switch their talker view from leader\/gallery or vice versa. By default, the SDK gives a gallery view layout. <\/p>\n\n\n\n<p><strong>Class<\/strong>:  <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>:  <code>-(void)switchATView:(NSString * _Nonnull)viewString;<\/code> <\/p>\n\n\n\n<p><strong>Parameters<\/strong>:&nbsp;<code>ViewString<\/code> \u2013 where ViewString is leader\/gallery view.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[EnxRoom switchATView:\"leader\"];  <\/pre>\n\n\n\n<a name=\"playerview\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>PlayerView <\/h3>\n\n\n\n<p><strong>Availability:<\/strong> iOS SDK 2.1.3+<\/p>\n\n\n\n<p>The PlayerView methods provide option to custom the active talker view. With the help of these methods, you get a particular Player View, and further highlight the selected player border and change the background colour of the Player View. <\/p>\n\n\n\n<a name=\"switch-to-playerview\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Switch to Player View <\/h3>\n\n\n\n<p>The <code>getPlayer()<\/code> method provides the option to get a particular Player View.<\/p>\n\n\n\n<p><strong>Class<\/strong>:  <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>:  <code>-(EnxPlayerView *_Nullable)getPlayer:(NSString*_Nonnull)clientID;<\/code><\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<p><code>clientId&nbsp;<\/code>\u2013 The user that requires a particular Player View<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Initiate EnxPlayerView\nEnxPlayerView *player = [enxRoom getPlayer:clientId];<\/pre>\n\n\n\n<a name=\"highlight-playerview-border\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Highlight the EnxPlayer Border <\/h3>\n\n\n\n<p>The <code>highlightBorderForClient()<\/code> method provides the choice to highlight the Player border colour using the custom ActiveTalker View option. You can highlight  the player border by passing the list of clientids.<\/p>\n\n\n\n<p><strong>Class<\/strong>:  <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>:  <code>-(void)highlightBorderForClient:(NSArray*_Nonnull)clientIDs;<\/code><\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul><li><code>@param {Array} clientID -<\/code>&nbsp;An array of Client Ids to be highlighted.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Highlight EnxPlayer border\n[enxRoom highlightBorderForClient:[clientid1, clientid2,\u2026...clientIdn];<\/pre>\n\n\n\n<a name=\"change-playerview-background\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Change EnxPlayerView Background Colour<\/h3>\n\n\n\n<p>The <code>changeBgColorForClients()<\/code> method provides the choice to change the background colour for the Player View using the custom ActiveTalker View option. To change the background colour of a Player, you need to pass the clientID of that EnxPlayer.<\/p>\n\n\n\n<p><strong>Class<\/strong>:  <code>EnxRoom<\/code><\/p>\n\n\n\n<p><code>-(void)changeBgColorForClients:(NSArray*_Nonnull)clientIDs withColor:(UIColor *_Nonnull)color;<\/code><\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul><li><code>@param {Array} clientID -<\/code>&nbsp;An array of Client Ids for the background color to be changed.<\/li><li><code>Color&nbsp;<\/code>\u2013 String. Color code of the background color.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Change EnxPlayer background colour\n[enxRoom changeBgColorForClients:[clientId1,clientid2....clientidn] withColor[UIcolor redcolor];<\/pre>\n\n\n\n<a name=\"force-active-talker-view\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Force Reload Active Talker View<\/h3>\n\n\n\n<p>The <code>forceUpdateATList()<\/code> method provides the option to force reload the active talker view after any manipulation in the view as the case may be. <\/p>\n\n\n\n<p><strong>Class<\/strong>:  <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>:  <code><code>-(void)forceUpdateATList;<\/code><\/code> <\/p>\n\n\n\n<p><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Force reload Active Talker view\n[enxRoom forceUpdateATList];<\/pre>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<div class=\"wp-block-columns\">\n<div class=\"wp-block-column\">\n<p>\u2190 <a href=\"..\/subscribing-remote-streams\/\">Subscribe Remote Streams<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-center\"><a href=\"..\/\">Index<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column\">\n<p class=\"has-text-align-right\"><a href=\"..\/receiving-video-quality\/\">Set Desired Video Quality<\/a> \u2192<a href=\"\/developer\/how-to-use\/\"><\/a><\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Table of Contents Handle Active Talkers Get maximum permissible Talker Count Get Talker Count Set Talker Count Switch Active Talker View EnxPlayer View Switch to Player View Highlight EnxPlayer Border Change EnxPlayer Background Force Reload Active Talker View Handle Active Talkers To avoid excessive consumption of the server and client resources,&nbsp;The platform sends a maximum of 12 actively talking users in the Room&nbsp;to the client endpoint. Additionally, it sends Screen&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3732,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ub_ctt_via":""},"featured_image_src":null,"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"featured":false,"featured-large":false},"uagb_author_info":{"display_name":"vcxdevwpadmin","author_link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/author\/vcxdevwpadmin\/"},"uagb_comment_info":0,"uagb_excerpt":"Table of Contents Handle Active Talkers Get maximum permissible Talker Count Get Talker Count Set Talker Count Switch Active Talker View EnxPlayer View Switch to Player View Highlight EnxPlayer Border Change EnxPlayer Background Force Reload Active Talker View Handle Active Talkers To avoid excessive consumption of the server and client resources,&nbsp;The platform sends a maximum&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4463"}],"collection":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/comments?post=4463"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4463\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3732"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}