{"id":4298,"date":"2021-11-15T20:23:59","date_gmt":"2021-11-15T12:23:59","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4298"},"modified":"2022-04-08T19:59:39","modified_gmt":"2022-04-08T11:59:39","slug":"local-stream","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/android-toolkit\/local-stream\/","title":{"rendered":"Local Stream: Android SDK &#8211; Video API"},"content":{"rendered":"\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li><a href=\"#init-stream\">Initiate Local Stream<\/a><\/li><li><a href=\"#init-stream-multi-video-layers\">Initiate Local Stream with Multiple Video Layers<\/a><\/li><\/ul>\n\n\n\n<a name=\"init-stream\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>Initiate Local Stream<\/h2>\n\n\n\n<p>The <code>EnxRoom.getLocalStream() <\/code>method is used to initialize a local stream at the Client endpoint before it can be published to the Room. The initialization process comprises specifying media tracks, adding custom attributes, etc. in the form of a JSON object passed as a parameter to the method.<\/p>\n\n\n\n<p><strong>Class<\/strong>:&nbsp;<code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>:&nbsp;<code>public EnxStream getLocalStream( JSONObject publishStreamInfo )<\/code><\/p>\n\n\n\n<p><strong>Parameters<\/strong>:&nbsp; <code>publishStreamInfo -<\/code> A JSON object with <a href=\"https:\/\/www.enablex.io\/developer\/video-api\/client-api\/appendix\/#stream-options\" target=\"_blank\" rel=\"noreferrer noopener\">Local Stream Options<\/a> as given below:<\/p>\n\n\n\n<a name=\"publishStreamInfo\"><\/a>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n     \"audio\": true,          \/\/ Whether to add Audio to stream\n     \"video\": true,          \/\/ Whether to add Video to stream\n     \"data\": true,           \/\/ Whether to add Data to stream\n     \"videoSize\":  {         \/\/ Video Frame Size - Deprecated in Android SDK v2.0.1+\n           \"minWidth\": number, \n           \"minHeight\": number,  \n           \"maxWidth\": number,\n           \"maxHeight\": number\n       ), \n     \"audioMuted\": true,     \/\/ Audio muted on entry to room  \n     \"videoMuted\": true,     \/\/ Video muted on entry to room  \n     \"attributes\": {         \/\/ Object to carry custom data  \n         \"custom1\": \"\"\n      },\n      \"maxVideoBW\": number,  \/\/ Max Bandwidth - Deprecated in Android SDK v2.0.1+\n      \"minVideoBW\": number   \/\/ Min Bandwidth - Deprecated in Android SDK v2.0.1+\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>5015<\/td><td>Failed to initialize the Stream without Audio, Video, and Data track.<\/td><\/tr><tr><td>5016<\/td><td>Failed to initialize the Stream due to incorrect values of JSON Keys in <code>publishStreamInfo<\/code>.<\/td><\/tr><tr><td>5017<\/td><td>Unable to create Stream due to failure to access Camera and Microphone. <\/td><\/tr><tr><td>5018<\/td><td>Unable to create Video Stream due to failure to access Camera. Only Audio Stream created.<\/td><\/tr><tr><td>5019<\/td><td>Unable to create Stream due to failure to access Microphone.<\/td><\/tr><tr><td>5084<\/td><td>Invalid Video Layer. Max allowed Video Layers: 3<\/td><\/tr><tr><td>5088<\/td><td>Invalid Frame Rate. Max allowed Frame Rate: 30<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<a name=\"init-stream-multi-video-layers\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Initiate Stream with Multiple Video Layers<\/h3>\n\n\n\n<p>To help stream subscribers receive the best video quality subject to the available bandwidth, stream publishers must ensure that their streams carry&nbsp;multiple video layers&nbsp;of different quality.&nbsp;The&nbsp;<strong>Auto Bandwidth Detection&nbsp;<\/strong>feature detects the subscriber\u2019s bandwidth and switches to the respective video layer for a smooth video experience.  <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">JSONObject streamOpt = {\n       audio: true, \n       video: true, \n       maxVideoLayers: 3 \/\/ Carry 3 layers, viz HD 720p, SD 480p &amp; LD 240p\/180p \n };\n\n\/\/ Enumerated Values for  maxVideoLayers: 1, 2, 3                               \n\/\/ 1=HD 720p layer only                               \n\/\/ 2=HD 720p &amp; SD 480p layers only                               \n\/\/ 3=HD 720p, SD 480p &amp; LD 240p\/180p layers \n\nEnxStream localStream = room.getLocalStream(streamOpt); <\/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>5084<\/td><td>Illegible Value for <code>maxVideoLayers<\/code>. Max 3 Video Layers supported.<\/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=\"..\/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=\"..\/get-devices\/\"><\/a><a href=\"..\/room-connection\/\">Handle Room Connection<\/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 Initiate Local Stream Initiate Local Stream with Multiple Video Layers Initiate Local Stream The EnxRoom.getLocalStream() method is used to initialize a local stream at the Client endpoint before it can be published to the Room. The initialization process comprises specifying media tracks, adding custom attributes, etc. in the form of a JSON object passed as a parameter to the method. Class:&nbsp;EnxRoom Method:&nbsp;public EnxStream getLocalStream( JSONObject publishStreamInfo )&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":"Table of Contents Initiate Local Stream Initiate Local Stream with Multiple Video Layers Initiate Local Stream The EnxRoom.getLocalStream() method is used to initialize a local stream at the Client endpoint before it can be published to the Room. The initialization process comprises specifying media tracks, adding custom attributes, etc. in the form of a JSON&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4298"}],"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=4298"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4298\/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=4298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}