VideoCanvas
Used to set the display, rendering, and layout properties of the video canvas.
public class VideoCanvas {
public int uid;
public int subviewUid;
public static final int RENDER_MODE_HIDDEN = 1;
public static final int RENDER_MODE_FIT = 2;
public static final int RENDER_MODE_ADAPTIVE = 3;
public static final int VIEW_SETUP_MODE_REPLACE = 0;
public static final int VIEW_SETUP_MODE_ADD = 1;
public static final int VIEW_SETUP_MODE_REMOVE = 2;
public View view;
public SurfaceTexture surfaceTexture;
public int renderMode;
public int mirrorMode;
public int setupMode = VIEW_SETUP_MODE_REPLACE;
public int sourceType;
public int mediaPlayerId;
public Rect rect;
public boolean enableAlphaMask;
public int backgroundColor;
public Constants.VideoModulePosition position = Constants.VideoModulePosition.VIDEO_MODULE_POSITION_POST_CAPTURER;
}
Properties
- uid
- User ID of the published video source.
- subviewUid
- User ID of the specific sub-video stream in a composite video stream.
- RENDER_MODE_HIDDEN
- Hidden mode: Scales the video proportionally until the view is filled (some parts of the video may be cropped).
- RENDER_MODE_FIT
- Fit mode: Scales the video proportionally until one dimension fits the view boundary, with black padding for the remaining area.
- RENDER_MODE_ADAPTIVE
- Adaptive mode. This mode is deprecated and not recommended by Agora.
- VIEW_SETUP_MODE_REPLACE
- Sets the view mode to replace mode, which is the default value.
- VIEW_SETUP_MODE_ADD
- Sets the view mode to add a new view.
- VIEW_SETUP_MODE_REMOVE
- Sets the view mode to remove a view.
- view
- The view window used to display the video. Must be of type
SurfaceVieworTextureView.Note: Only one ofvieworsurfaceTexturecan be set in a VideoCanvas. If both are set, onlyviewtakes effect. - surfaceTexture
- The container that provides the video image.
Note: Only one of
vieworsurfaceTexturecan be set in a VideoCanvas. If both are set, onlyviewtakes effect. - renderMode
- Rendering mode:
RENDER_MODE_HIDDEN(1): Hidden mode.RENDER_MODE_FIT(2): Fit mode.RENDER_MODE_ADAPTIVE(3): Adaptive mode (deprecated and not recommended by Agora).
- mirrorMode
-
Note:Mirror mode:
- Local video view mirror mode: enabled by default when using the front camera, disabled by default when using the rear camera.
- Mirror mode is disabled by default for remote users.
VIDEO_MIRROR_MODE_AUTO(0): SDK automatically determines whether to enable mirror mode.VIDEO_MIRROR_MODE_ENABLED(1): Enables mirror mode for local view.VIDEO_MIRROR_MODE_DISABLED(2): Disables mirror mode for local view.
- setupMode
-
Note: It is recommended to setView setup mode:
setupModetoVIEW_SETUP_MODE_REMOVEwhen the view is no longer used to prevent rendering resource leaks.VIEW_SETUP_MODE_REPLACE(0): Replace view, default value.VIEW_SETUP_MODE_ADD(1): Add view.VIEW_SETUP_MODE_REMOVE(2): Remove view.
- sourceType
- Type of video source. See VideoSourceType.
- mediaPlayerId
- ID of the media player.
- rect
- Display area of the video frame.
widthandheightindicate the pixel dimensions of the video in this area. Default isnull(width or height is 0), which means the actual resolution of the video frame is displayed. SeeRect. - enableAlphaMask
- Whether to enable alpha mask rendering:
- true: Enable.
- false: Disable.
- backgroundColor
- Background color of the video canvas in RGBA format. Default is 0x00000000, which indicates black.
Note:
- If you are developing with Kotlin and encounter a compilation error when setting it to
0xFFFFFFFF, use(0xFFFFFFFF).toInt()orandroid.graphics.Color.parseColor("#FFFFFFFF"). - Alpha channel is not supported when using RGBA format.
- If you are developing with Kotlin and encounter a compilation error when setting it to
- position
- Observation position of the video frame in the video pipeline. See VideoModulePosition.