# 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 with green screens - are supported. ```swift if let meetingService = MobileRTC.shared().getMeetingService(), meetingService.isSupportVirtualBG() { // Virtual background is supported // Check if smart virtual background is supported meetingService.isDeviceSupportSmartVirtualBG() } ``` ```objectivec MobileRTCMeetingService *meetingService = [[MobileRTC sharedRTC] getMeetingService]; if (meetingService != nil && [meetingService isSupportVirtualBG]) { [meetingService isDeviceSupportSmartVirtualBG]; } ``` 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:[MobileRTCVirtualBGImageInfo] = meetingService.getBGImageList() { // This list will contained a NONE, BLUR or Item (self added) virtual background type. // The MobileRTCVirtualBGImageInfo has a isSelect property to indicate if the current virtual background is selected. } // To add virtual background to list, first check if have permission to add if meetingService.isAllowToAddNewVBItem() { let error = meetingService.addBGImage(UIImage) } /* To remove a specific virtual background from the list. Note: You cannot remove NONE and BLUR type. */ meetingService.removeBGImage(MobileRTCVirtualBGImageInfo) // To set a specific virtual background meetingService.useBGImage(MobileRTCVirtualBGImageInfo) ``` ```objectivec // To list available virtual background NSArray *listOfVirtualBG = [meetingService getBGImageList]; if (listOfVirtualBG != nil) { // This list will contained a NONE, BLUR or Item (self added) virtual background type. // The MobileRTCVirtualBGImageInfo has a isSelect property to indicate if the current virtual background is selected. } // To add virtual background to list, first check if have permission to add if ([meetingService isAllowToAddNewVBItem]) { [meetingService addBGImage:UIImage]; } /* To remove a specific virtual background from the list. Note: You cannot remove NONE and BLUR type. */ [meetingService removeBGImage:MobileRTCVirtualBGImageInfo]; // To set a specific virtual background [meetingService useBGImage:MobileRTCVirtualBGImageInfo]; ``` Users can preview the virtual background. ```swift if let previewView: UIView = meetingService.previewView { // Preview view is available, add previewView to your UIView // Start Preview meetingService.startPreview(withFrame: CGRect) // Stop Preview meetingService.stopPreview() } ``` ```objectivec UIView *previewView = meetingService.previewView; if (previewView != nil) { // Preview view is available, add previewView to your UIView // Start Preview [meetingService startPreviewWithFrame:CGRect]; // Stop Preview [meetingService stopPreview]; } ``` Users can also have green screen support for virtual backgrounds, but this functionality is only available for iPads. ```swift /* For green background, there are these 3 methods available Note: Only iPad support virtual background green screen, iPhone does not support this feature. */ meetingService.isUsingGreenVB() meetingService.enableGreenVB(Bool) meetingService.selectGreenVBPoint(CGPoint) ``` ```objectivec /* For green background, there are these 3 methods available Note: Only iPad support virtual background green screen, iPhone does not support this feature. */ [meetingService isUsingGreenVB]; [meetingService enableGreenVB:BOOL]; [meetingService selectGreenVBPoint:CGPoint]; ``` ---