{"id":4724,"date":"2021-12-06T13:39:24","date_gmt":"2021-12-06T05:39:24","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4724"},"modified":"2022-04-08T18:26:57","modified_gmt":"2022-04-08T10:26:57","slug":"publishing-local-stream","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/flutter-toolkit\/publishing-local-stream\/","title":{"rendered":"Publishing Local Stream: Flutter SDK &#8211; Video API"},"content":{"rendered":"\n<p>The local stream with audio\/video needs to be started and published to the Room for other participants to see and hear you. Please use the API methods below to publish, unpublish and close local stream.<\/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><code>publish()&nbsp;<\/code>method is used to publish a local stream to the connected Room. After the local stream is published to the Room, all participants are notified with an eent listener &nbsp;<code>onPublishedStream<\/code>.<\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>static Future&lt;void&gt; publish()<\/code><\/p>\n\n\n\n<p><strong>Event Listener::<\/strong><\/p>\n\n\n\n<ul><li><code>onPublishedStream <\/code>&#8211; To the publisher that stream has been published.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">EnxRtc.onRoomConnected = (Map&lt;dynamic, dynamic&gt; map) { \n\t\/\/Method calling   \n\tEnxRtc.publish();\n};\n\nEnxRtc.onPublishedStream = (Map&lt;dynamic, dynamic&gt; map) {\n};<\/pre>\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>To receive media streams of other participants connected to a Room, you must subscribe to the streams individually. Unless you subscribe a stream, you will not receive anything.<\/p>\n\n\n\n<p>To unpublish, use&nbsp;<code>unpublish()<\/code>&nbsp;method. Please use the callback to handle if stream is unpublished successfully. All users connected to the room will be notified that a Published Stream is unpublished or removed from the Room using the callback named&nbsp;<code>onSubscribeStream<\/code>.<\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>static Future&lt;void&gt; subscribe(String streamId)<\/code><\/p>\n\n\n\n<p><strong>Parameters: <\/strong><\/p>\n\n\n\n<ul><li><code>@param String streamId<\/code> &#8211; Stream id to subscribe.<\/li><\/ul>\n\n\n\n<p><strong>Event Listener::<\/strong>  <code>onSubscribeStream-<\/code> to all participants that a Stream is taken off the Room.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">EnxRtc.onStreamAdded = (Map&lt;dynamic, dynamic&gt; map) {\n\tString streamId;\n\tsetState(() {\n\t\tstreamId = map['streamId'];\n\t});\n\tEnxRtc.subscribe(streamId);\n};\n\nEnxRtc.onSubscribedStream= (Map&lt;dynamic, dynamic&gt; map) {    \n};<\/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=\"..\/how-to-use\/\"> <\/a><a href=\"..\/video-quality-adaption\/\">Video Quality Adaption based on Bandwidth<\/a><a href=\"..\/how-to-use\/\"> <\/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>The local stream with audio\/video needs to be started and published to the Room for other participants to see and hear you. Please use the API methods below to publish, unpublish and close local stream. Table of Contents Publish Stream Unpublish Stream Publish Local Stream publish()&nbsp;method is used to publish a local stream to the connected Room. After the local stream is published to the Room, all participants are notified&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3755,"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 local stream with audio\/video needs to be started and published to the Room for other participants to see and hear you. Please use the API methods below to publish, unpublish and close local stream. Table of Contents Publish Stream Unpublish Stream Publish Local Stream publish()&nbsp;method is used to publish a local stream to the&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4724"}],"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=4724"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4724\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3755"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}