VirtualBackgroundSource

Used to set the custom background type.

public class VirtualBackgroundSource {
  public static final int BACKGROUND_NONE = 0;
  public static final int BACKGROUND_COLOR = 1;
  public static final int BACKGROUND_IMG = 2;
  public static final int BACKGROUND_BLUR = 3;
  public static final int BACKGROUND_VIDEO = 4;
  public static final int BLUR_DEGREE_LOW = 1;
  public static final int BLUR_DEGREE_MEDIUM = 2;
  public static final int BLUR_DEGREE_HIGH = 3;
  public int backgroundSourceType;
  public int color;
  public String source = null;
  public int blurDegree;
}

Properties

backgroundSourceType
Custom background type.
  • BACKGROUND_NONE (0): Only performs background and foreground segmentation without replacing the background image. After setting this value, you can call startLocalVideoTranscoder to achieve picture-in-picture effect.
  • BACKGROUND_COLOR (1): (Default) Background is a solid color image.
  • BACKGROUND_IMG (2): Background is an image in PNG or JPG format.
  • BACKGROUND_BLUR (3): Background is a blurred version of the original background image.
  • BACKGROUND_VIDEO (4): Background is a local video file in MP4, AVI, MKV, FLV, or other supported formats.
color
Color of the custom background image. Defined as a hexadecimal integer in RGB format without #, e.g., light pink is 0xFFB6C1. Default is 0xFFFFFF (white). Value range: [0x000000, 0xFFFFFF]. If the value is invalid, the SDK replaces the original background image with a white background.
Note: This parameter only applies to the following custom background types:
  • BACKGROUND_COLOR: Background is a solid color image of the specified color.
  • BACKGROUND_IMG: If the image in source has a transparent background, the transparent area will be filled with the color specified by this parameter.
source
Absolute local path of the custom background image. Supported formats include PNG, JPG, MP4, AVI, MKV, and FLV. If the path is invalid, the SDK uses the original background image or the solid color image specified by color.
Note: This parameter is only effective when the custom background type is BACKGROUND_IMG or BACKGROUND_VIDEO.
blurDegree
Note: This parameter is only effective when the background type is BACKGROUND_BLUR.
Blur level of the custom background image.
  • BLUR_DEGREE_LOW (1): Low blur, background is mostly visible.
  • BLUR_DEGREE_MEDIUM (2): Medium blur, background details are hard to recognize.
  • BLUR_DEGREE_HIGH (3): High blur, background is unrecognizable.