{"id":4719,"date":"2021-12-03T21:04:06","date_gmt":"2021-12-03T13:04:06","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4719"},"modified":"2025-02-21T19:26:04","modified_gmt":"2025-02-21T11:26:04","slug":"room-connection","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/flutter-toolkit\/room-connection\/","title":{"rendered":"Room Connection: Flutter SDK &#8211; Video API"},"content":{"rendered":"\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li><a href=\"#join-room\">Join a Room with Stream<\/a><\/li><li><a href=\"#disconnect-room\">Disconnect from a Room<\/a><\/li><\/ul>\n\n\n\n<a name=\"join-room\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>Join a Room with Stream <\/h2>\n\n\n\n<p>Connecting and joining a Room is a complex chain of events. You will need to ensure success status of previous event to proceed to the next event. The following basic steps are required to join room successfully<\/p>\n\n\n\n<ul><li>Initiate Room &amp; Connect<\/li><li>If connected, initiate Stream. <\/li><li>Publish Stream<\/li><\/ul>\n\n\n\n<p><code>joinRoom()<\/code> method comes as a handy tool for developer. It handles all complexities of connecting and joining the room.<\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>static Future&lt;void&gt; joinRoom(String token, Map&lt;String, dynamic&gt; localInfo, Map&lt;String, dynamic&gt; roomInfo, List&lt;dynamic&gt; advanceOptions)<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>: <\/p>\n\n\n\n<ul><li><code>@param String token <\/code>&#8211; JWT Token received through Video API Call<\/li><li><code>@param Map&lt;String,dynamic> locfo<\/code> &#8211; <a href=\"..\/..\/appendix\/#stream-options\">Stream Initialization Meta Info<\/a>. Optional.<\/li><li><code>@param Map&lt;String,dynamic> roomInfo<\/code> &#8211; Room info for joining room<\/li><\/ul>\n\n\n\n<p><strong>Event Listeners: <\/strong><\/p>\n\n\n\n<ul><li><code>onRoomConnected <\/code>\u2013 When Client End Point is connected to the room successfully<\/li><li><code>onRoomDisConnected <\/code>\u2013 Client End Point got disconnected to the room<\/li><li><code>onRoomError <\/code>\u2013 Client End Point\u2019s attempt to connect to room has failed<\/li><li><code>onUserConnected <\/code>\u2013 Everyone is notified that a new user is connected to the Room<\/li><li><code>onUserDisConnected <\/code>\u2013 Everyone is notified that a connected user is disconnected from the Room<\/li><li><code>onConnectionLost <\/code>\u2013 When End Point looses network connection<\/li><li><code>onConnectionInterrupted <\/code>\u2013 When connection is interrupted e.g Switch from WiFi to 4G and vice versa<\/li><li><code>onUserReconnectSuccess <\/code>\u2013 When End-Point successfully gets reconnected with the portal<\/li><li><code>onReconnect <\/code>\u2013 When End-Point trying to reconnect within given time period<\/li><li><code>onPublishedStream <\/code>\u2013 Publisher is notified that its Stream has been published into the Room<\/li><li><code>onUnPublishedStream <\/code>\u2013 Publisher is notified that its Stream is unpublished\/removed from the Room<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/Map&lt;String, dynamic&gt;: where localInfo is like below:\n\nMap&lt;String, dynamic&gt; localInfo= {\n\t'audio': true,\n\t'video': true,\n\t'data': true,\n\t'audioMuted': false,\n\t'videoMuted': false,\n\t'name': 'flutter',\n};\n\n\/\/Map&lt;String, dynamic&gt;: where roomInfo is like below:\nMap&lt;String, dynamic&gt; roomInfo = {\n\t'allow_reconnect': true,\n\t'number_of_attempts': 3,\n\t'timeout_interval': 20,\n\t'audio_only': false,\n\t'forceTurn': false\n};\n\n\/\/Method calling\nawait EnxRtc.joinRoom(token, localInfo, roomInfo, advanceOptions);\n\n\/\/Callbacks\nEnxRtc.onRoomConnected = (Map&lt;dynamic, dynamic&gt; map) {\n\t\/\/Connection success\n};\n\nEnxRtc.onRoomError = (Map&lt;dynamic, dynamic&gt; map) {\n\t\/\/ Connection Failed or any error in room\n};\n\nEnxRtc.onRoomDisConnected = (Map&lt;dynamic, dynamic&gt; map) {\n\t\/\/ Called when room is disconnected success\n};\n\nEnxRtc.onConnectionLost = (Map&lt;dynamic, dynamic&gt; map) {\n\t\/\/ In case connection lost due to internet lose\n};\n\nEnxRtc.onConnectionInterrupted = (Map&lt;dynamic, dynamic&gt; map) {\n\t\/\/ In case any interruption in connection\n};\n\nEnxRtc.onUserReconnectSuccess = (Map&lt;dynamic, dynamic&gt; map) {\n\t\/\/ When reconnect done successfully\n};\n\nEnxRtc.onReconnect = (Map&lt;dynamic, dynamic&gt; map) {\n};<\/pre>\n\n\n\n<a name=\"disconnect-room\"><\/a>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>Disconnect from a Room<\/h2>\n\n\n\n<p> A Client End Point can disconnect itself from the room to close its session. A disconnected End-Point will loose media and signaling socket immediately. <\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>static Flutter&lt;void&gt; disconnect()<\/code> &#8211; Without any parameter<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">EnxRtc.disconnect();<\/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=\"..\/get-devices\/\"> <\/a><a href=\"..\/get-devices\/\">Get Media Devices<\/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=\"..\/video-quality-adaption\/\"><\/a><a href=\"\/developer\/video-api\/client-api\/flutter-toolkit\/video-quality-adaption\/\">Quality Adjustment based on Available Bandwidth<\/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 Join a Room with Stream Disconnect from a Room Join a Room with Stream Connecting and joining a Room is a complex chain of events. You will need to ensure success status of previous event to proceed to the next event. The following basic steps are required to join room successfully Initiate Room &amp; Connect If connected, initiate Stream. Publish Stream joinRoom() method comes as a handy&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":"Table of Contents Join a Room with Stream Disconnect from a Room Join a Room with Stream Connecting and joining a Room is a complex chain of events. You will need to ensure success status of previous event to proceed to the next event. The following basic steps are required to join room successfully Initiate&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4719"}],"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=4719"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4719\/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=4719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}