{"id":4113,"date":"2021-11-08T19:48:20","date_gmt":"2021-11-08T11:48:20","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4113"},"modified":"2022-04-11T18:43:37","modified_gmt":"2022-04-11T10:43:37","slug":"stream-information","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/web-toolkit\/stream-information\/","title":{"rendered":"Stream Information: Web SDK &#8211; Video API"},"content":{"rendered":"\n<p>The following methods provide <a rel=\"noreferrer noopener\" href=\"\/developer\/video-api\/client-api\/web-toolkit\/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 id=\"block-b4a4d06d-f53a-4cf9-baf9-75dd5f9a768f\"><li><a href=\"#get-id\">Get Stream ID<\/a><\/li><li><a href=\"#get-attributes\">Get Stream Attributes<\/a><\/li><li><a href=\"#configure-stream\">Configure Stream<\/a><\/li><li><a href=\"#update-stream-attributes\">Update Stream Attributes<\/a><\/li><li><a href=\"#track-availability\">Verify availability of Media Tracks in 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>EnxRtc<\/code><\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>EnxRtc.getID()<\/code><\/p>\n\n\n\n<p><strong>Returns:<\/strong> String Stream Id.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> var myStreamID = <code>localStream.getID()<\/code>;<\/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 as custom keys under <code>attributes<\/code> in the JSON Payload during the <a href=\"..\/local-stream\/#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>EnxStream.getAttributes()<\/code> &#8211; No parameter required.<\/p>\n\n\n\n<p><strong>Returns<\/strong>: Streams Attributes JSON object.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">var attrbutes = stream.getAttributes();<\/pre>\n\n\n\n<a name=\"configure-stream\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Configure Stream<\/h3>\n\n\n\n<p>The&nbsp;<code>EnxStream.updateConfiguration()<\/code>&nbsp;method is used to reconfigure a Stream by adding new or updating existing attributes of the Stream. This API is applicable to both Remote and Local Streams.<\/p>\n\n\n\n<p><strong>Method<\/strong>:  <code>EnxStream.updateConfiguration(ConfigSpecs, Callback)<\/code> <\/p>\n\n\n\n<p><strong>Parameter<\/strong>: <\/p>\n\n\n\n<p><code>ConfigSpecs<\/code> &#8211; New Stream configuration options JSON Object.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> \/\/ Define Config Specs for Local Stream\nvar ConfigSpecs = {\n     \"<code>maxVideoBW<\/code>\": 400, \n     \"<code>maxAudioBW<\/code>\": \"400\" \n }; \n\nlocalstream.updateConfiguration( ConfigSpecs, function(result) {\n});<\/pre>\n\n\n\n<a name=\"update-stream-attributes\"><\/a>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3>Update Stream Attributes<\/h3>\n\n\n\n<p>The&nbsp;<code>EnxStream.setAttributes()<\/code>&nbsp;method allows you to update your Local Stream\u2019s&nbsp;<code>attributes<\/code>&nbsp;object by adding new attributes or changing existing attributes. You can use custom-attribute names for your stream. This API is applicable only on Local Stream.<\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>EnxStream.setAttributes(attributes)<\/code>  <\/p>\n\n\n\n<p><strong>Parameter<\/strong>: <\/p>\n\n\n\n<p><code>attributes<\/code> &#8211; Stream attributes JSON Object with custom key and value. <\/p>\n\n\n\n<p><strong>Event Notification:<\/strong>  <\/p>\n\n\n\n<p><code>stream-attributes-updated<\/code> &#8211; Notification to all the Stream subscribers when the stream attributes are updated.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Define attributes\nvar Attributes = {\n     \"name\": \"Stream Name\", \n     \"age\": \"21\",\n     \"employee_id\": \"XXX\",\n     \"custom_key\": \"XXX\"\n };\n\nLocalStream.setAttributes(Attributes); \/\/ Update\n\nroom.addEventListener(\"stream-attributes-updated\", function(evt) {\n     \/\/ evt.attributes - updated attributes of stream\n }); <\/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&nbsp;<code>EnxStream<\/code>&nbsp;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>EnxStream.ifAudio() <\/code>&#8211; No Parameter required.<\/li><\/ul><\/li><li> To check if Stream has a Video Track:<ul><li><code>EnxStream.ifVideo()<\/code> &#8211; No Parameter required.<\/li><\/ul><\/li><li>To check if Stream has a Data Track:<ul><li> <code>EnxStream.ifData()<\/code> &#8211; No Parameter required.<\/li><\/ul><\/li><li>To check if Stream has Screen-share:<ul><li><code>EnxStream.ifScreen()<\/code> &#8211; No Parameter required.<\/li><\/ul><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">if (stream.ifVideo()) {\n     \/\/ The Stream has a Video Track in it\n}\n\n\/\/ Other methods are also used similar way<\/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=\"..\/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=\"..\/chat\/\">Send Message<\/a>  \u2192 <\/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 Configure Stream Update Stream Attributes Verify availability of Media Tracks in Stream Get Stream ID The EnxStream.getId() 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&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3724,"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 Configure Stream Update Stream Attributes Verify availability of Media Tracks in Stream Get Stream ID The EnxStream.getId() method provides the ID of the given Stream. The Stream ID is used to&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4113"}],"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=4113"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4113\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3724"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}