{"id":4291,"date":"2021-11-15T19:37:34","date_gmt":"2021-11-15T11:37:34","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4291"},"modified":"2022-04-12T18:17:00","modified_gmt":"2022-04-12T10:17:00","slug":"stream-information","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/android-toolkit\/stream-information\/","title":{"rendered":"Stream Information: Android SDK &#8211; Video API"},"content":{"rendered":"\n<p>The following methods provide <a rel=\"noreferrer noopener\" href=\"..\/enxstream\/\" target=\"_blank\">Stream-related information<\/a> such as the Stream type, media tracks, state, etc.  <\/p>\n\n\n\n<h4>Table of Contents<\/h4>\n\n\n\n<ul><li><a href=\"#get-id\">Get Stream ID<\/a><\/li><li><a href=\"#get-attributes\">Get Stream Attributes<\/a><\/li><li><a href=\"#track-availability\">Verify availability of Media Tracks in Stream<\/a><\/li><li><a href=\"#active-audio-video\">Check Audio Video Track Status in Stream<\/a><\/li><li><a href=\"#know-local-remote-stream\">Know if Stream is Local or Remote<\/a><\/li><li><a href=\"#stream-state\">Know current state of Stream<\/a><\/li><li><a href=\"#get-media\">Get Media of a Stream<\/a><\/li><\/ul>\n\n\n\n<a name=\"get-id\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Get Stream ID<\/h3>\n\n\n\n<p>The <code>EnxStream.getId()<\/code> method provides the ID of the given Stream. The Stream ID is used to identify every Stream, be it a local or a remote stream, a canvas stream, or a screen-share stream. <\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxStream<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>public String getID()<\/code><\/p>\n\n\n\n<p><strong>Returns<\/strong>: String <code>stream Id <\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> String streamID = stream.getId();<\/pre>\n\n\n\n<a name=\"get-attributes\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Get Stream Attributes<\/h3>\n\n\n\n<p>The <code>EnxStream.getAttributes() <\/code>method provides the Stream attributes that are defined in the JSON Payload during the <a href=\"#init-stream\" target=\"_blank\" rel=\"noreferrer noopener\">Stream Initialization<\/a> process.  <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var StreamOpt = {\n    \"attributes\": {\n        \"name\": \"Stream Name\",\n        \"custom_key\": \"String\",\n        \"custom_key2\": Number\n     }\n}<\/pre>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxStream<\/code> <\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>public JSONObject getAttributes()<\/code> &#8211; No Parameter required.<\/p>\n\n\n\n<p><strong>Returns<\/strong>: Stream attributes JSON object.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">JSONObject attributes = stream.getAttributes();<\/pre>\n\n\n\n<a name=\"track-availability\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Verify availability of Media Tracks in Stream<\/h3>\n\n\n\n<p>The <code>EnxStream<\/code> class provides the following methods to check the presence of a particular media track in the Stream. <\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxStream<\/code><\/p>\n\n\n\n<p><strong>Methods<\/strong>:<\/p>\n\n\n\n<ul><li> To check if Stream has an Audio Track:<ul><li><code>public boolean hasAudio() <\/code>&#8211; No Parameter required.<\/li><\/ul><\/li><li>To check if Stream has a Video Track:<ul><li><code>public boolean hasVideo()<\/code> &#8211; No Parameter required.<\/li><\/ul><\/li><li>To check if Stream has a Data Track:<ul><li><code>public boolean hasData()<\/code> &#8211; No Parameter required. <\/li><\/ul><\/li><li>To check if Stream has Screen-share:<ul><li><code>public boolean hasScreen()<\/code> &#8211; No Parameter required.<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><strong>Returns<\/strong>: Boolean<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">if (stream.hasVideo()) {\n     \/\/ If the Stream has a Video Track in it.\n}\n\n\/\/ Other methods are also used in the similar manner.<\/pre>\n\n\n\n<a name=\"active-audio-video\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Check Audio\/Video Track Status in Stream<\/h3>\n\n\n\n<p>The <code>EnxStream<\/code> class provides the following methods to verify if the current status of Audio or Video Track in a Stream is active. <\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxStream<\/code><\/p>\n\n\n\n<p><strong>Methods<\/strong>:<\/p>\n\n\n\n<ul><li>To know if Audio Track is currently active:<ul><li><code>public boolean isAudioActive() <\/code>&#8211; No Parameter required.<\/li><\/ul><\/li><li>To know if Video Track is currently active: <ul><li><code>public boolean isVideoActive() <\/code>&#8211; No parameter required.<\/li><\/ul><\/li><\/ul>\n\n\n\n<p><strong>Returns<\/strong>: Boolean<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">if (stream.isAudioActive()) {\n      \/\/ If the Audio track is active in the Stream\n}\n\nif (stream.isVideoActive()) {\n      \/\/ If the Video track is active in the Stream\n}<\/pre>\n\n\n\n<a name=\"know-local-remote-stream\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Know if Stream is Local or Remote<\/h3>\n\n\n\n<p>The <code>EnxStream.ifLocal()<\/code> method is used to know if the given Stream is a Local or a Remote Stream. It returns <em>true<\/em> for a Local Stream and <em>false<\/em> for a Remote Stream. <\/p>\n\n\n\n<p><strong>Class<\/strong>: EnxStream<\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>public boolean ifLocal() <\/code>&#8211; No parameter required.<\/p>\n\n\n\n<p><strong>Returns<\/strong>: Boolean<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">if (stream.ifLocal()) {\n     \/\/ It's a Local Stream\n }\n else {\n     \/\/ It's a  Remote Stream\n }<\/pre>\n\n\n\n<a name=\"stream-state\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>Know current state of Stream<\/h2>\n\n\n\n<p>The <code>EnxStream.getState() <\/code>method is used to know the current state of the given Stream. It returns String Constants as listed below.<\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxStream<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>public String getState() <\/code>&#8211; No parameter required.<\/p>\n\n\n\n<p><strong>Returns<\/strong>: One of the following String Constants:<\/p>\n\n\n\n<ul><li>UNKNOWN<\/li><li>OPENING<\/li><li>ACTIVE<\/li><li>CLOSING<\/li><li>DESTROYED<\/li><li>LOCAL<\/li><li>BLOCKED<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">String currentState = stream.getState();<\/pre>\n\n\n\n<a name=\"get-media\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Get Media of a Stream<\/h3>\n\n\n\n<p>The <code>EnxStream.getMedia()<\/code> method provides the Media Stream Object present in the given Stream.<\/p>\n\n\n\n<p><strong>Class<\/strong>: <code>EnxStream<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>public MediaStream getMedia()<\/code> &#8211; No Parameter required.<\/p>\n\n\n\n<p><strong>Returns<\/strong>: Media Stream object<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">MediaStream mStream = stream.getMedia(); <\/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=\"\/developer\/video-api\/client-api\/android-toolkit\/play-stream\/\">Play Stream<\/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=\"..\/room-information\/\"><\/a><a href=\"..\/room-information\/\">Know Your Room<\/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 following methods provide Stream-related information such as the Stream type, media tracks, state, etc. Table of Contents Get Stream ID Get Stream Attributes Verify availability of Media Tracks in Stream Check Audio Video Track Status in Stream Know if Stream is Local or Remote Know current state of Stream Get Media of a Stream Get Stream ID The EnxStream.getId() method provides the ID of the given Stream. The Stream&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":"The following methods provide Stream-related information such as the Stream type, media tracks, state, etc. Table of Contents Get Stream ID Get Stream Attributes Verify availability of Media Tracks in Stream Check Audio Video Track Status in Stream Know if Stream is Local or Remote Know current state of Stream Get Media of a Stream&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4291"}],"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=4291"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4291\/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=4291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}