{"id":4275,"date":"2021-11-15T17:25:38","date_gmt":"2021-11-15T09:25:38","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4275"},"modified":"2022-04-08T18:29:45","modified_gmt":"2022-04-08T10:29:45","slug":"publishing-local-stream","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/android-toolkit\/publishing-local-stream\/","title":{"rendered":"Publishing Local Stream: Android SDK &#8211; Video API"},"content":{"rendered":"\n<p>After initializing the stream, you&nbsp;need to&nbsp;publish it in the room&nbsp;so that the other users&nbsp;in the room&nbsp;can see and hear the user.&nbsp; The methods to publish, unpublish, and close a local stream are explained in this section.<\/p>\n\n\n\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li> <a href=\"#publish-stream\">Publish Stream<\/a><\/li><li><a href=\"#unpublish-stream\">Unpublish Stream<\/a><\/li><\/ul>\n\n\n\n<a name=\"publish-stream\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Publish Local Stream<\/h3>\n\n\n\n<p>The<code> EnxRoom.publish()&nbsp;<\/code>method&nbsp;publishes&nbsp;a local stream&nbsp;in&nbsp;the connected room.&nbsp;<\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxRoom <\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>public void publish(EnxStream localStream)<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>: <\/p>\n\n\n\n<ul><li><code>localStream <\/code>&#8211;  Initiated Stream Object<\/li><\/ul>\n\n\n\n<p><strong>Observers:<\/strong><\/p>\n\n\n\n<ul><li><code>onPublishedStream <\/code>&#8211; Acknowledgment to the Stream publisher when the stream gets published. <\/li><li><code>onStreamAdded <\/code>&#8211; Notification to everyone in the Room when a new stream is published in the Room.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">room.publish(localStream);  \/\/ To publish initialized Local Stream\n\npublic void onPublishedStream(EnxStream stream) {\n     \/\/ Your Stream is published\n}\n\npublic void onStreamAdded(EnxStream stream) {\n     \/\/ Announcement of a new Stream in the Room\n     \/\/ You may subscribe 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>5013<\/td><td>Failed to publish Stream.<\/td><\/tr><tr><td>5015<\/td><td>Unable to publish a Stream without audio, video, and data.<\/td><\/tr><tr><td>5016<\/td><td>Unable to publish a Stream with illegible attributes.<\/td><\/tr><tr><td>5022<\/td><td>Failed to publish Stream because Floor Access not received in <code>lecture<\/code> mode room.<\/td><\/tr><tr><td>5023<\/td><td>The Stream has already been published.<\/td><\/tr><tr><td>5024<\/td><td>Repeated <code>publish()<\/code> call while Stream Publishing is in process. <\/td><\/tr><tr><td>5025<\/td><td>Failed to publish stream because <code>publish()<\/code> call is made on a Remote Stream.<\/td><\/tr><tr><td>1170<\/td><td>The current subscription doesn&#8217;t support the publishing of Stream.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<a name=\"unpublish-stream\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Unpublish Local Stream<\/h3>\n\n\n\n<p>The <code>EnxRoom.unpublish()<\/code>&nbsp;method&nbsp;disconnects the local stream from the room.&nbsp;Unpublishing a stream does not release the device access&nbsp;so that subsequent republishing does not require device-access-permission.&nbsp;&nbsp;<\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>public void unpublish() <\/code>&#8211; No Parameter required.<\/p>\n\n\n\n<p><strong>Observers:<\/strong>  <code>onRemoveStream&nbsp;-<\/code> Notification to everyone in the Room when a Stream is removed from the Room.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">room.unpublish();  \/\/ To unpublish all Local Streams\n\npublic void onRemoveStream(EnxStream stream) {\n     \/\/ To announce in the room that a stream has been removed from the Room.\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>5029<\/td><td>Repeated unpublish() call made while previous unpublish request is in process. <\/td><\/tr><tr><td>5030<\/td><td>Non-Contextual use of method when the user tries to unpublish a stream before publishing it.<\/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=\"..\/video-quality-adaption\/\">Quality Adaption with Bandwidth<\/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=\"..\/switch-camera-mic-speaker\/\">Switch Camera, Mic, Speaker<\/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>After initializing the stream, you&nbsp;need to&nbsp;publish it in the room&nbsp;so that the other users&nbsp;in the room&nbsp;can see and hear the user.&nbsp; The methods to publish, unpublish, and close a local stream are explained in this section. Table of Contents Publish Stream Unpublish Stream Publish Local Stream The EnxRoom.publish()&nbsp;method&nbsp;publishes&nbsp;a local stream&nbsp;in&nbsp;the connected room.&nbsp; Class: EnxRoom Method: public void publish(EnxStream localStream) Parameters: localStream &#8211; Initiated Stream Object Observers: onPublishedStream &#8211; Acknowledgment to&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":"After initializing the stream, you&nbsp;need to&nbsp;publish it in the room&nbsp;so that the other users&nbsp;in the room&nbsp;can see and hear the user.&nbsp; The methods to publish, unpublish, and close a local stream are explained in this section. Table of Contents Publish Stream Unpublish Stream Publish Local Stream The EnxRoom.publish()&nbsp;method&nbsp;publishes&nbsp;a local stream&nbsp;in&nbsp;the connected room.&nbsp; Class: EnxRoom Method:&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4275"}],"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=4275"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4275\/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=4275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}