{"id":4177,"date":"2021-11-10T16:40:20","date_gmt":"2021-11-10T08:40:20","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4177"},"modified":"2022-04-08T15:40:59","modified_gmt":"2022-04-08T07:40:59","slug":"live-media-statistics","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/web-toolkit\/live-media-statistics\/","title":{"rendered":"Live Media Statistics: Web SDK &#8211; Video API"},"content":{"rendered":"\n<p><strong>Note<\/strong>: <code>EnxRoom.subscribeStreamStatsForClient(Stream, EnableDisable)<\/code> &#8211; Following documentation covers a new method with greater flexibility on UI and Data. <\/p>\n\n\n\n<p>The <code>EnxRoom.subscribeMediaStats()<\/code> method allows you to subscribe to live media statistics of Local, Remote, Canvas, and Screen-Share for debugging purposes or UI display at an endpoint. The following information for each stream is displayed using an Overlay over the respective player:<\/p>\n\n\n\n<ul><li>For Local Streams<ul><li><em>Transmission Bandwidth<\/em><\/li><li><em>Video Resolution<\/em> <\/li><\/ul><\/li><li>For Subscribed Streams<ul><li><em>Receiving Bandwidth<\/em><\/li><li><em>Video Resolution<\/em><\/li><li><em>Available Bandwidth for Remote User<\/em><\/li><li><em>Packet Loss<\/em><\/li><\/ul><\/li><\/ul>\n\n\n\n<p><strong>Class:<\/strong> <code>EnxRoom<\/code><\/p>\n\n\n\n<p><strong>Method<\/strong>: <code>EnxRoom.subscribeMediaStats(reqType, callback)<\/code><\/p>\n\n\n\n<p><strong>Parameters: <\/strong><\/p>\n\n\n\n<ul><li><code>reqType<\/code> &#8211; Type of request on media statistics to configure how the media stats are delivered and stopped. Configurable options are given below:<ul><li><code>display<\/code> &#8211; Media Statistics are shown as overlay on each video player. <\/li><li><code>notify<\/code> &#8211; Media Statistics are dispatched in JSON format along with an event <code>media-stats<\/code> to be handled in the code.<\/li><li><code>notify-display<\/code> &#8211; Media Statistics are shown as overlay on each Video Player as well as data is  dispatched in JSON format along with an event <code>media-stats<\/code>.  <\/li><li><code>disable<\/code> &#8211; This disables Media Statistics subscription. Subsequently overlays are removed from Video Player and <code>media-stats<\/code> event dispatch is stopped. <\/li><\/ul><\/li><li><code>callback<\/code> &#8211; Callback returns with response information on Media Statistics subscription. <\/li><\/ul>\n\n\n\n<p><strong>Event Listener:<\/strong> <\/p>\n\n\n\n<p><code>media-stats<\/code> &#8211; This event with Media Statistics in JSON format is dispatched only when Media Statistics is subscribed with <code>reqType: notify<\/code> or <code>reqType: notify-display.<\/code><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">room.subscribeMediaStats('notify', function(resp) {\n\t\/\/ response is a JSON, e.g.\n\t\/*\n\t{\u202f\t\"result\": 0,\u202f \n\t\t\"msg\": \"Success\"\u202f \n\t}\n\t*\/\u202f \n}); \n\nroom.addEventListener(\"media-stats \", function(evt) {\n\t\/\/ evnt is JSON with Media Stats, e.g. \n\t\/*\n\t{\ttype: 'media-stats', \n\t\ttalkers: [{ }], \n\t\tpublisher:  {},\n\t\tshare: {}, \n\t\tcanvas: {}\n\t}\n\t*\/\n});<\/pre>\n\n\n\n<p><strong>Media Stats JSON Payload:<\/strong><\/p>\n\n\n\n<ul><li><code>talkers<\/code> &#8211; Array of Objects containing Media Statistics of each User&#8217;s Stream available on Active Talker List. For Each Talker&#8217;s Endpoint, it shows both Subscription and Publishing Connection&#8217;s Statistics.<\/li><li><code>publisher<\/code> &#8211; Object containing Media Statistics of published stream connection. <\/li><li><code>share<\/code> &#8211; Object containing Media Statistics of Screen Share connection.<\/li><li><code>canvas<\/code> &#8211; Object containing Media Statistics of Canvas Stream connection.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">{\n  \"type\": \"media-stats\",\n  \"talkers\": [\n    null,\n    null,\n    {\n      \"id\": 2,\n      \"subscriber\": {\n        \"video\": [\n          {\n            \"displayString\": \"&lt;div&gt; &lt;strong style=\\\"color:black;\\\" &gt; 640X480p10@188Kbps&lt;\/strong&gt;:&lt;\/div&gt;&lt;div&gt; &lt;strong style=\\\"color:black;\\\" &gt; AvailBw:500Kbps, loss:1&lt;\/strong&gt;:&lt;\/div&gt;\",\n            \"resHeight\": 480,\n            \"resWidth\": 640,\n            \"packetsLost\": 1,\n            \"bandwidth\": 500,\n            \"frameRate\": 10,\n            \"bitrate\": 188\n          }\n        ],\n        \"total-bitrate-kbps\": 238\n      },\n      \"publisher\": {\n        \"video\": [\n          {\n            \"displayString\": \"&lt;div&gt; &lt;strong style=\\\"color:black;\\\" &gt; 640X480p10@186Kbps&lt;\/strong&gt;:&lt;\/div&gt;\",\n            \"resHeight\": 480,\n            \"resWidth\": 640,\n            \"packetsLost\": 0,\n            \"bandwidth\": 0,\n            \"frameRate\": 10,\n            \"bitrate\": 186\n          }\n        ],\n        \"total-bitrate-kbps\": 227\n      }\n    }\n  ],\n  \"publisher\": {\n    \"total-bitrate-kbps\": 354,\n    \"video\": [\n      {\n        \"displayString\": \"&lt;div&gt; &lt;strong style=\\\"color:black;\\\" &gt; 640X480p9@312Kbps&lt;\/strong&gt;:&lt;\/div&gt;\",\n        \"resHeight\": 480,\n        \"resWidth\": 640,\n        \"packetsLost\": 0,\n        \"bandwidth\": 0,\n        \"frameRate\": 9,\n        \"bitrate\": 312\n      }\n    ]\n  },\n  \"share\": {},\n  \"canvas\": {}\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=\"..\/floor-access-control\/\">Lecture Mode<\/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=\"..\/talker-noise-notification\/\"><\/a><a href=\"..\/talker-noise-notification\/\">Get Talker Notification<\/a> \u2192 <\/p>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Note: EnxRoom.subscribeStreamStatsForClient(Stream, EnableDisable) &#8211; Following documentation covers a new method with greater flexibility on UI and Data. The EnxRoom.subscribeMediaStats() method allows you to subscribe to live media statistics of Local, Remote, Canvas, and Screen-Share for debugging purposes or UI display at an endpoint. The following information for each stream is displayed using an Overlay over the respective player: For Local Streams Transmission Bandwidth Video Resolution For Subscribed Streams Receiving Bandwidth&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":"Note: EnxRoom.subscribeStreamStatsForClient(Stream, EnableDisable) &#8211; Following documentation covers a new method with greater flexibility on UI and Data. The EnxRoom.subscribeMediaStats() method allows you to subscribe to live media statistics of Local, Remote, Canvas, and Screen-Share for debugging purposes or UI display at an endpoint. The following information for each stream is displayed using an Overlay over&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4177"}],"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=4177"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4177\/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=4177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}