Virtual backgrounds
The Video SDK for macOS lets you replace a user's camera background with a virtual background. Use the virtual background methods on ZMVideoSDKVideoHelper.
Typical flow
To add a virtual background and apply it to your video:
- Use
addVirtualBackgroundItemto add a virtual background item. - Use
getVirtualBackgroundItemListto get a list of available virtual background items. - Choose a virtual background item from the list and use
setVirtualBackgroundItemto 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.
Method reference
// Add virtual background item
func addVirtualBackgroundItem(_ imagePath: String?, imageItem: ZMVideoSDKVirtualBackgroundItem?) -> ZMVideoSDKErrors {
}
// Remove virtual background item
func removeVirtualBackgroundItem(_ imageItem: ZMVideoSDKVirtualBackgroundItem?) -> ZMVideoSDKErrors {
}
// Get virtual background item list
func getVirtualBackgroundItemList() -> [ZMVideoSDKVirtualBackgroundItem]? {
}
// Set virtual background item
func setVirtualBackgroundItem(_ imageItem: ZMVideoSDKVirtualBackgroundItem?) -> ZMVideoSDKErrors {
}
// Get selected virtual background
func getSelectedVirtualBackgroundItem() -> ZMVideoSDKVirtualBackgroundItem? {
}
// Add virtual background item
- (ZMVideoSDKErrors) addVirtualBackgroundItem: (NSString *) imagePath
imageItem: (ZMVideoSDKVirtualBackgroundItem *_Nullable *_Nonnull) imageItem
// Remove virtual background item
- (ZMVideoSDKErrors) removeVirtualBackgroundItem: (ZMVideoSDKVirtualBackgroundItem *) imageItem
// Get virtual background item list
- (NSArray< ZMVideoSDKVirtualBackgroundItem * > *) getVirtualBackgroundItemList
// Set virtual background item
- (ZMVideoSDKErrors) setVirtualBackgroundItem: (ZMVideoSDKVirtualBackgroundItem *) imageItem
// Get selected virtual background
- (ZMVideoSDKVirtualBackgroundItem *) getSelectedVirtualBackgroundItem
For details, see the ZMVideoSDKVideoHelper class reference.