# Virtual backgrounds The Video SDK for Android lets you replace a user's camera background with a virtual background. Enable it through `ZoomVideoSDKVirtualBackgroundHelper`. First determine whether the device supports it using `isSupportVirtualBackground`. If the device supports it, use the helper methods to add, get, set, and remove virtual backgrounds. ## Typical flow To add a virtual background and apply it to your video: 1. Use `addVirtualBackgroundItem` to add a virtual background item. 2. Use `getVirtualBackgroundItemList` to get a list of available virtual background items. 3. Choose a virtual background item from the list and use `setVirtualBackgroundItem` to set the virtual background. Use `removeVirtualBackgroundItem` to remove the virtual background or set the virtual background to None. Use `getSelectedVirtualBackgroundItem` to get the currently selected background. ## Example This example checks for device support, adds a background from a `Bitmap`, sets it as the active background, then reads back the current selection and the full list of items. ```kotlin val vbHelper = ZoomVideoSDK.getInstance().virtualBackgroundHelper if (vbHelper.isSupportVirtualBackground) { // Add a background from a Bitmap (for example, decoded from your assets folder) val newItem = vbHelper.addVirtualBackgroundItem(bitmap) // Set the new background as the active one vbHelper.setVirtualBackgroundItem(newItem) // Later, read or replace the current selection val selected = vbHelper.selectedVirtualBackgroundItem val allItems = vbHelper.virtualBackgroundItemList } ``` ```java ZoomVideoSDKVirtualBackgroundHelper vbHelper = ZoomVideoSDK.getInstance().getVirtualBackgroundHelper(); if (vbHelper.isSupportVirtualBackground()) { // Add a background from a Bitmap (for example, decoded from your assets folder) ZoomVideoSDKVirtualBackgroundItem newItem = vbHelper.addVirtualBackgroundItem(bitmap); // Set the new background as the active one vbHelper.setVirtualBackgroundItem(newItem); // Later, read or replace the current selection ZoomVideoSDKVirtualBackgroundItem selected = vbHelper.getSelectedVirtualBackgroundItem(); List allItems = vbHelper.getVirtualBackgroundItemList(); } ``` ## Method reference The full set of `ZoomVideoSDKVirtualBackgroundHelper` methods for adding, listing, setting, and removing virtual backgrounds. ```kotlin // Check if virtual background is supported fun isSupportVirtualBackground(): Boolean // Add virtual background item fun addVirtualBackgroundItem(image: Bitmap): ZoomVideoSDKVirtualBackgroundItem // Remove virtual background item fun removeVirtualBackgroundItem(imageItem: ZoomVideoSDKVirtualBackgroundItem): Int // Get virtual background item list fun getVirtualBackgroundItemList(): List // Set virtual background item fun setVirtualBackgroundItem(imageItem: ZoomVideoSDKVirtualBackgroundItem): Int // Get selected virtual background fun getSelectedVirtualBackgroundItem(): ZoomVideoSDKVirtualBackgroundItem ``` ```java // Check if virtual background is supported boolean isSupportVirtualBackground() // Add virtual background item ZoomVideoSDKVirtualBackgroundItem addVirtualBackgroundItem(android.graphics.Bitmap image) // Remove virtual background item int removeVirtualBackgroundItem(ZoomVideoSDKVirtualBackgroundItem imageItem) // Get virtual background item list List getVirtualBackgroundItemList() // Set virtual background item int setVirtualBackgroundItem(ZoomVideoSDKVirtualBackgroundItem imageItem) // Get selected virtual background ZoomVideoSDKVirtualBackgroundItem getSelectedVirtualBackgroundItem() ```