VideoCanvas

Used to configure the properties of the video canvas.

struct VideoCanvas {
  uid_t uid;
  uid_t subviewUid;
  view_t view;
  uint32_t backgroundColor;
  media::base::RENDER_MODE_TYPE renderMode;
  VIDEO_MIRROR_MODE_TYPE mirrorMode;
  VIDEO_VIEW_SETUP_MODE setupMode;
  VIDEO_SOURCE_TYPE sourceType;
  int mediaPlayerId;
  Rectangle cropArea;
  bool enableAlphaMask;
  media::base::VIDEO_MODULE_POSITION position;
};

Properties

uid
User ID of the published video source.
subviewUid
User ID of the specific sub-video stream published in video mixing.
view
Video display window.
Note: Only one of view or surfaceTexture can be set in a VideoCanvas. If both are set, only view takes effect.
backgroundColor
Background color of the video canvas in RGBA format. Default is 0x00000000 (black).
renderMode
Video rendering mode. See RENDER_MODE_TYPE.
mirrorMode
Mirror mode of the view. See VIDEO_MIRROR_MODE_TYPE.
Note:
  • Mirror mode for local video view: when using the front camera, the SDK enables mirror mode by default; when using the rear camera, the SDK disables mirror mode by default.
  • Mirror mode is disabled by default for remote users.
setupMode
View setup mode. See VIDEO_VIEW_SETUP_MODE.
sourceType
Type of video source. See VIDEO_SOURCE_TYPE.
mediaPlayerId
ID of the media player. You can get the device ID by calling getMediaPlayerId.
cropArea
Display area of the video frame. width and height indicate the pixel width and height of the area. Default is NULL (i.e., width or height is 0), which means the actual resolution of the video frame is displayed. See Rectangle.
enableAlphaMask
Note:
  • The receiver can render alpha channel information only if the sender enables alpha channel transmission.
  • To enable alpha channel transmission, contact technical support.
Whether to enable alpha mask rendering:
  • true: Enable alpha mask rendering.
  • false: (default) Disable alpha mask rendering.
Alpha mask rendering can create transparent images and extract portraits from video. When used with other methods, it can achieve effects such as picture-in-picture and portrait watermark.
position
Observation position of the video frame in the video pipeline. See VIDEO_MODULE_POSITION.