{"id":4794,"date":"2021-12-08T17:14:18","date_gmt":"2021-12-08T09:14:18","guid":{"rendered":"https:\/\/www.enablex.io\/developer\/?page_id=4794"},"modified":"2022-04-11T15:20:38","modified_gmt":"2022-04-11T07:20:38","slug":"screen-share","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video-api\/client-api\/cordova-toolkit\/screen-share\/","title":{"rendered":"Screen Share: Cordova\/Ionic SDK &#8211; Video API"},"content":{"rendered":"\n<p>A Client End Point can start a Screen-Share using&nbsp;<code>window.EnxRtc.addScreenShare<\/code>()&nbsp;method. The method creates a stream of Mobile Screen @ 6fps to publish to the Room.&nbsp; <code>window.EnxRtc.removeScreenShare<\/code>()&nbsp;method stops the ongoing Screen Share. Screen Share continues even when the Application goes into the background.<\/p>\n\n\n\n<p>When a user starts or stops Screen Share, all connected users of the room are notified with&nbsp;<code>onScreenSharedStarted<\/code>&nbsp;and&nbsp;<code>onScreenSharedStopped<\/code>&nbsp;listeners. As Screen-Share is also a Stream, you can play it using a Video Player. Screen Share is carried on&nbsp;<strong>Stream ID# 101<\/strong>. Client End Point must subscribe to this Stream ID to receive and play it locally.<\/p>\n\n\n\n<p><strong>Note<\/strong>: You need to enable screen share while defining a room with&nbsp;<\/p>\n\n\n\n<p><code>{ \"settings\": { \"screen_share\": true; })<\/code>&nbsp;in JSON Payload.&nbsp;<a href=\"https:\/\/www.enablex.io\/developer\/video-api\/server-api\/rooms-route\/#create-room\">Know more\u2026<\/a><\/p>\n\n\n\n<p><strong>Method:<\/strong> <code>addScreenShare( viewOptions, successCallback, errorCallback )<\/code><\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul><li><code>@param {JSON} viewOptions<\/code> &#8211; Contains display attributes as given below:<ul><li><code>height<\/code><\/li><li><code>width<\/code><\/li><li><code>margin_top<\/code><\/li><li><code>margin_left<\/code><\/li><li><code>margin_right<\/code><\/li><li><code>margin_bottom<\/code><\/li><li><code>position<\/code><\/li><\/ul><\/li><li><code>@param {SuccessCallback}<\/code><\/li><li><code>@param {ErrorCallback}<\/code><\/li><\/ul>\n\n\n\n<p><strong>Event Listener:<\/strong><\/p>\n\n\n\n<p><code>onScreenSharedStarted<\/code> &#8211; All the participants are notified that screen sharing has started. To show the shared screen in the room, call the <code>addScreenShare()<\/code> method inside this event listener. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Add event Listener to listen screen shared started in the roomwindow.EnxRtc.addEventListner(\"onScreenSharedStarted\",\nfunction (data)\n{\nconsole.log(JSON.stringify(data.data));\naddScreenShare(); \/\/ Add Screen Share\n});\n\n\/\/ To Add Screen Share\nvar options = {\nheight: 130,\nwidth: 100,\nmargin_top: 50,\nmargin_left: 0,\nmargin_right: 15,\nmargin_bottom: 10,\nposition: \"top\"\n};\nwindow.EnxRtc.addScreenShare(options, function (data) {\nconsole.log('Excelsior succuss! ' + JSON.stringify(data.data));\n}, function (err) {\nconsole.log('Uh oh\u2026 error' + JSON.stringify(err));\n});<\/pre>\n\n\n\n<p><strong>Method:<\/strong> <code>removeScreenShare( successCallback, errorCallback )<\/code><\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul><li><code>@param {CallableFunction} successCallback<\/code><\/li><li><code>@param {CallableFunction} errorCallback<\/code><\/li><\/ul>\n\n\n\n<p><strong>Event Listener:<\/strong><\/p>\n\n\n\n<p><code>onScreenSharedStopped<\/code> &#8211; All the participants are notified that screen sharing has stopped. To remove the shared screen from the room, call the <code>removeScreenShare()<\/code> method inside this event listener.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Add event Listener to listen screen shared stopped in the room\nwindow.EnxRtc.addEventListner(\"onScreenSharedStopped\",\nfunction (data)\n{\nconsole.log(JSON.stringify(data.data));\nremoveScreenShare(); \/\/ Stop Screen Share\n});\n\n\/\/ To Remove Screen Share\nwindow.EnxRtc.removeScreenShare(function (data) {console.log('Excelsior succuss! ' + JSON.stringify(data.data));\n}, function (err) {\nconsole.log('Uh oh\u2026 error' + JSON.stringify(err));\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=\"..\/annotations\/\"><\/a><a href=\"..\/annotations\/\">Annotation<\/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=\"..\/canvas-streaming\/\"><\/a><a href=\"..\/canvas-streaming\/\" target=\"_blank\" rel=\"noreferrer noopener\">Canvas Streaming<\/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>A Client End Point can start a Screen-Share using&nbsp;window.EnxRtc.addScreenShare()&nbsp;method. The method creates a stream of Mobile Screen @ 6fps to publish to the Room.&nbsp; window.EnxRtc.removeScreenShare()&nbsp;method stops the ongoing Screen Share. Screen Share continues even when the Application goes into the background. When a user starts or stops Screen Share, all connected users of the room are notified with&nbsp;onScreenSharedStarted&nbsp;and&nbsp;onScreenSharedStopped&nbsp;listeners. As Screen-Share is also a Stream, you can play it using a&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":3719,"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":"A Client End Point can start a Screen-Share using&nbsp;window.EnxRtc.addScreenShare()&nbsp;method. The method creates a stream of Mobile Screen @ 6fps to publish to the Room.&nbsp; window.EnxRtc.removeScreenShare()&nbsp;method stops the ongoing Screen Share. Screen Share continues even when the Application goes into the background. When a user starts or stops Screen Share, all connected users of the room&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4794"}],"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=4794"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/4794\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/3719"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=4794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}