# Use virtual backgrounds > The code on this page only works with the **custom UI**. Use `isSupportVirtualBG` in `MobileRTCMeetingService` to determine whether the device supports virtual backgrounds, then use `MobileRTCMeetingService` to enable them. You can also check to see if the smart virtual background - virtual backgrounds without the need for a green screen - are supported. Both images and video are supported for virtual background. ```swift if let vbSetting = ZoomSDK.shared().getSettingService()?.getVirtualBGSetting() { /* Normal virtual background: virtual background used with a green screen. Smart virtual Background: virtual backgrounds without the need for a green screen, but it has certain system performance requirements based on https://support.zoom.com/hc/en/article?id=zm_kb&sysparm_article=KB0060007 */ if vbSetting.isSupportVirtualBG() { // Normal virtual background image is supported } if vbSetting.isDeviceSupportSmartVirtualBG() { // Smart virtual background image is supported } if vbSetting.isDeviceSupportGreenVirtualBackgroundVideo() { // Normal virtual background video is supported } if vbSetting.isDeviceSupportSmartVirtualBackgroundVideo() { // Smart virtual background video is supported } } ``` ```objectivec ZoomSDKVirtualBackgroundSetting *vbSetting = [[[ZoomSDK sharedSDK] getSettingService] getVirtualBGSetting]; if (vbSetting) { /* Normal virtual background: virtual background used with a green screen. Smart virtual Background: virtual backgrounds without the need for a green screen, but it has certain system performance requirements based on https://support.zoom.com/hc/en/article?id=zm_kb&sysparm_article=KB0060007 */ if (vbSetting.isSupportVirtualBG) { // Normal virtual background image is supported } if (vbSetting.isDeviceSupportSmartVirtualBG) { // Smart virtual background image is supported } if (vbSetting.isDeviceSupportGreenVirtualBackgroundVideo) { // Normal virtual background video is supported } if (vbSetting.isDeviceSupportSmartVirtualBackgroundVideo) { // Smart virtual background video is supported } } ``` If the device supports virtual backgrounds, use `meetingService` to list, add, remove, and set virtual backgrounds. ```swift // To list available virtual background if let listOfVirtualBG = vbSetting.getBGItemList() as? [ZoomSDKVirtualBGImageInfo] { // This list will contained a NONE, BLUR or other image/video (self added). for vb in listOfVirtualBG { vb.isAllowDelete() vb.getImageFilePath() vb.getImageName() vb.isSelected() vb.isVideo() } } // To add virtual background to list, first check for permission. if vbSetting.isAllowAddNewVBItem() { let error = vbSetting.addBGImage(<#T##filePath: String##String#>) } /* To remove a specific virtual background from the list, first check for permission. Note: You cannot remove NONE and BLUR type. */ if vbSetting.isAllowRemoveVBItem() { let error = vbSetting.removeBGItem(<#T##virtualBGImageInfo: ZoomSDKVirtualBGImageInfo##ZoomSDKVirtualBGImageInfo#>) } // To set a specific virtual background vbSetting.useBGItem(<#T##item: ZoomSDKVirtualBGImageInfo##ZoomSDKVirtualBGImageInfo#>) ``` ```objectivec // To list available virtual background NSArray *listOfVirtualBG = [vbSetting getBGItemList]; if (listOfVirtualBG) { // This list contains NONE, BLUR, and user-added image/video backgrounds for (ZoomSDKVirtualBGImageInfo *vb in listOfVirtualBG) { [vb isAllowDelete]; [vb getImageFilePath]; [vb getImageName]; [vb isSelected]; [vb isVideo]; } } // To add virtual background to list, first check for permission. if ([vbSetting isAllowAddNewVBItem]) { ZoomSDKError error = [vbSetting addBGImage:filePath]; } /* To remove a specific virtual background from the list, first check for permission. Note: You cannot remove NONE and BLUR type. */ if ([vbSetting isAllowRemoveVBItem]) { ZoomSDKError error = [vbSetting removeBGItem:ZoomSDKVirtualBGImageInfo]; } // To set a specific virtual background [vbSetting useBGItem:ZoomSDKVirtualBGImageInfo]; ``` Users can preview their virtual background. ```swift let yourPreviewView:NSView = NSView() // Get your NSView let previewVideoItem = ZoomSDKPreViewVideoElement(frame: yourPreviewView.frame) var videoElement: ZoomSDKVideoElement? = previewVideoItem let videoContainer = ZoomSDK.shared().getMeetingService()?.getVideoContainer() videoContainer?.createVideoElement(&videoElement) yourPreviewView.addSubview(previewVideoItem.getVideoView()) previewVideoItem.startPreview(true) ``` ```objectivec NSView *yourPreviewView = [NSView alloc]; // Get your NSView ZoomSDKPreViewVideoElement *previewVideoItem = [[ZoomSDKPreViewVideoElement alloc] initWithFrame:yourPreviewView.frame]; ZoomSDKVideoContainer* videoContainer = [[[ZoomSDK sharedSDK] getMeetingService] getVideoContainer]; [videoContainer createVideoElement:&previewVideoItem]; [yourPreviewView addSubview:[previewVideoItem getVideoView]]; [previewVideoItem startPreview:YES]; ``` Users can also have green screen support for virtual backgrounds. When green screen is not being used, this means that the smart virtual background are turned on. In order for smart virtual background to be turned on, the macOS system must fulfill certain requirement that can be found in this link. ```swift vbSetting.isUsingGreenScreenOn() vbSetting.setUsingGreenScreen(true) // or false ``` ```objectivec vbSetting.isUsingGreenScreenOn; [vbSetting setUsingGreenScreen:YES]; // Or NO ``` ---