{"id":4439,"date":"2021-11-22T20:18:44","date_gmt":"2021-11-22T12:18:44","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4439"},"modified":"2022-04-08T18:03:48","modified_gmt":"2022-04-08T10:03:48","slug":"publishing-local-stream","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/ios-toolkit\/publishing-local-stream\/","title":{"rendered":"Publishing Local Stream: iOS 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<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\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>- (void)publish:(EnxStream *)stream;<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>: <\/p>\n\n\n\n<ul><li><code>stream<\/code>&#8211;  Initiated Stream Object<\/li><\/ul>\n\n\n\n<p><strong>Delegate Methods:<\/strong><\/p>\n\n\n\n<ul><li> <code>- room:didPublishStream: <\/code>&#8211; Acknowledgment to the Stream publisher when the stream gets published. <\/li><li> <code>- room:didAddedStream:<\/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];\n\n- (void)room:(EnxRoom *)room didPublishStream:(EnxStream *)stream{\n\t\/\/ Your stream is published\n}\n\n-(void)room:(EnxRoom *)room didAddedStream:(EnxStream *)stream{\n\t\/\/ Announcement of a new Stream in the Room\n\t\/\/ 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;<\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>- (void)unpublish;<\/code><\/p>\n\n\n\n<p><strong>Delegate Method:<\/strong>   <code>\u2013 room:didRemovedStream:<\/code> &#8211;  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\n-(void)room:(EnxRoom *)room didRemovedStream:(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 <code>unpublish<\/code> call made while the previous 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\/\"><\/a><a href=\"\/developer\/video-api\/client-api\/ios-toolkit\/video-quality-adaption\/\"><\/a><a href=\"..\/video-quality-adaption\/\">Quality Adjustment based on available 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: &#8211; (void)publish:(EnxStream *)stream; Parameters: stream&#8211; Initiated Stream Object Delegate Methods: &#8211; room:didPublishStream: &#8211; Acknowledgment to&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":"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\/4439"}],"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=4439"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4439\/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=4439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}