{"id":6646,"date":"2022-05-31T15:39:59","date_gmt":"2022-05-31T07:39:59","guid":{"rendered":"https:\/\/doc.smartflomeet.ttns.in\/developer\/?page_id=6646"},"modified":"2025-04-04T20:31:00","modified_gmt":"2025-04-04T12:31:00","slug":"virtual-background-android-sdk","status":"publish","type":"page","link":"https:\/\/doc.smartflomeet.ttns.in\/developer\/video\/solutions\/virtual-background\/virtual-background-android-sdk\/","title":{"rendered":"Virtual Background Android SDK v1.0"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\"><p>The Virtual Background feature allows users to blur own Video Background or to use a image from Library as as Video Background. This feature works best with a physical green screen at your backdrop or with uniform lighting on a plain backdrop. In other cases, user may experience patchy edges.<\/p><\/blockquote>\n\n\n\n<div class=\"wp-block-button aligncenter\"><a class=\"wp-block-button__link has-very-light-gray-color has-text-color no-border-radius\" href=\"\/developer\/wp-content\/uploads\/virtual-bg-sdk\/android\/EnxVirtualBackground-release_1.0.0.zip\">Download Android SDK v1.0<\/a><\/div>\n\n\n\n<p class=\"has-text-align-center\">Released: June 1, 2024<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>How to use Virtual Background SDK?<\/h2>\n\n\n\n<p>Follow these steps:<\/p>\n\n\n\n<ul><li>You get the .aar file after downloading the Virtual Background SDK.<\/li><li>You get the .aar file after downloading the Android SDK.<\/li><li>Add the downloaded .aar files under lib folder.<\/li><li>Go to your application\u2019s <code>build.gradle<\/code> file and add the following code in the dependencies section:<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">implementation 'com.google.mlkit:segmentation-selfie:16.0.0-beta4'\nimplementation 'io.github.zncmn.libyuv:core:0.0.7'\nimplementation fileTree(dir: 'libs', include: ['.aar', '.jar'], exclude: [])<\/pre>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2>SDK Method &amp; Callbacks<\/h2>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>The&nbsp;<code>EnxVirtualBackground.enableVirtualBackground()<\/code>&nbsp;method is used to add Virtual Background to Local Stream. To use this method, you need create an instance of Class <code>EnxVirtualBackground<\/code> and pass it&#8217;s reference to the  <code>enableVirtualBackground()<\/code>  method.<\/p>\n\n\n\n<p><strong>Class:<\/strong>&nbsp;EnxVirtualBackground<\/p>\n\n\n\n<p><strong>Observer<\/strong>:&nbsp;<code>public void EnxVirtualBackgroundStateObserver(EnxVirtualBackgroundStateObserver<\/code>&#8211;<code>-Object)<\/code><\/p>\n\n\n\n<p><strong>Method:<\/strong>&nbsp;<code>public void  <code>enableVirtualBackground<\/code> ( <code>this<\/code><\/code>,  enxRoom<code>)<\/code><\/p>\n\n\n\n<p><strong>Parameters:<\/strong><\/p>\n\n\n\n<ul><li><code>this<\/code>&#8211; This is the self instance reference.<\/li><li>enxRoom &#8211; This is the reference of EnxRoom Object.<\/li><\/ul>\n\n\n\n<p><strong>Callbacks:<\/strong><\/p>\n\n\n\n<ul><li><code>onAttachVirtualBackground<\/code>\u2013 Callback when Virtual Background is attached to the Local Stream.<\/li><li><code>onDetachVirtualBackground <\/code>&#8211; Callback when Virtual Background is detached from the Local Stream.<\/li><li><code>onVirtualBackgroundFailure<\/code> &#8211; Callback when Virtual Background fails to attach with Local Stream.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ Initiate Object of EnxVirtualBackground\nEnxVirtualBackground virtualBackground = new EnxVirtualBackground(); \n\n\/\/ Enable Virtual Background\nvirtualBackground.enableVirtualBackground(this, enxRoom);\n\n\/\/ Set Observer\nvirtualBackground.SetEnxVirtualBackgroundStateObserver(this);\n\n\n\/\/ Callback when Virtual Background is attached to the Local Stream.\n@Override \npublic void onAttachVirtualBackground(JSONObject jsonObject) { \n\n} \n \n\/\/ Callback when Virtual Background is detached from the Local Stream.\n@Override \npublic void onDetachVirtualBackground(JSONObject jsonObject) { \n\n} \n \n\/\/ Callback when Virtual Background fails to attach with Local Stream.\n@Override \npublic void onVirtualBackgroundFailure(JSONObject jsonObject) { \n\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The Virtual Background feature allows users to blur own Video Background or to use a image from Library as as Video Background. This feature works best with a physical green screen at your backdrop or with uniform lighting on a plain backdrop. In other cases, user may experience patchy edges. Download Android SDK v1.0 Released: June 1, 2024 How to use Virtual Background SDK? Follow these steps: You get the&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":6642,"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 Virtual Background feature allows users to blur own Video Background or to use a image from Library as as Video Background. This feature works best with a physical green screen at your backdrop or with uniform lighting on a plain backdrop. In other cases, user may experience patchy edges. Download Android SDK v1.0 Released:&hellip;","_links":{"self":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/6646"}],"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=6646"}],"version-history":[{"count":0,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/6646\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/pages\/6642"}],"wp:attachment":[{"href":"https:\/\/doc.smartflomeet.ttns.in\/developer\/wp-json\/wp\/v2\/media?parent=6646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}