{"id":4283,"date":"2021-11-15T18:30:48","date_gmt":"2021-11-15T10:30:48","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4283"},"modified":"2025-02-23T13:41:43","modified_gmt":"2025-02-23T05:41:43","slug":"subscribing-remote-streams","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/android-toolkit\/subscribing-remote-streams\/","title":{"rendered":"Subscribing Remote Streams: Android SDK &#8211; Video API"},"content":{"rendered":"\n<p>The <code>EnxRoom.subscribe()<\/code>&nbsp;method is used to receive the media stream of other users connected to the Room.&nbsp;You must call this method for each participant\u2019s media stream individually to&nbsp;receive it.&nbsp;<\/p>\n\n\n\n<p><\/p>\n\n\n\n<blockquote class=\"wp-block-quote\"><p>You don&#8217;t need to subscribe to your Local Stream as the Portal facilitates the\u00a0publisher to receive their own Screen Sharing and Canvas Streaming\u00a0without explicitly subscribing to it. In short,\u00a0a user must only\u00a0subscribe\u00a0to the Remote Streams in the Room.\u00a0<\/p><p>Refer to <a rel=\"noreferrer noopener\" href=\"..\/active-talkers\/#active-talkers\" target=\"_blank\">Handle Active Talkers<\/a> section for more details.<\/p><\/blockquote>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>public void subscribe(EnxStream remoteStream)<\/code><\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul><li><code>remoteStream<\/code> &#8211; The Stream object that needs to be subscribed.<\/li><\/ul>\n\n\n\n<p><strong>Observer:<\/strong><\/p>\n\n\n\n<ul><li><code>onStreamAdded <\/code>&#8211; Notification to everyone in the Room when a new Stream is added in the Room thus informing everyone to subscribe to it to receive it.<\/li><li><code>onSubscribedStream<\/code>  &#8211; Acknowledgment to the subscriber when they have subscribed to the Stream successfully.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">public void onStreamAdded(EnxStream remoteStream) { \/\/ There is a new Stream\n\troom.subscribe(remoteStream); \/\/ Subscribe to it.\n}\n\npublic void onSubscribedStream(EnxStream stream) {\n\t\/\/ You have subscribed to the Stream.\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>5014<\/td><td>Failed to subscribe to the Stream.<\/td><\/tr><tr><td>5026<\/td><td>Stream has already been subscribed.<\/td><\/tr><tr><td>5027<\/td><td>Repeated subscribe() call made while a previous subscription request is in process.<\/td><\/tr><tr><td>5028<\/td><td>Failed to subscribe because subscribe() call is made on the Local Stream.<\/td><\/tr><\/tbody><\/table><\/figure>\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=\"\/developer\/video-api\/client-api\/web-toolkit\/mute-audio-video-stream\/\">Mute Unmute Audio Video<\/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=\"..\/active-talkers\/\"><\/a><a href=\"..\/#active-talkers\">Handle Active Talkers<\/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>The EnxRoom.subscribe()&nbsp;method is used to receive the media stream of other users connected to the Room.&nbsp;You must call this method for each participant\u2019s media stream individually to&nbsp;receive it.&nbsp; You don&#8217;t need to subscribe to your Local Stream as the Portal facilitates the\u00a0publisher to receive their own Screen Sharing and Canvas Streaming\u00a0without explicitly subscribing to it. In short,\u00a0a user must only\u00a0subscribe\u00a0to the Remote Streams in the Room.\u00a0 Refer to Handle Active&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3740,"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":"The EnxRoom.subscribe()&nbsp;method is used to receive the media stream of other users connected to the Room.&nbsp;You must call this method for each participant\u2019s media stream individually to&nbsp;receive it.&nbsp; You don&#8217;t need to subscribe to your Local Stream as the Portal facilitates the\u00a0publisher to receive their own Screen Sharing and Canvas Streaming\u00a0without explicitly subscribing to it.&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4283"}],"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=4283"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4283\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3740"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}