VideoCanvas

Properties of the video canvas object.

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class VideoCanvas {
  const VideoCanvas(
      {this.uid,
      this.subviewUid,
      this.view,
      this.backgroundColor,
      this.renderMode,
      this.mirrorMode,
      this.setupMode,
      this.sourceType,
      this.mediaPlayerId,
      this.cropArea,
      this.enableAlphaMask,
      this.position});

  @JsonKey(name: 'uid')
  final int? uid;

  @JsonKey(name: 'subviewUid')
  final int? subviewUid;

  @JsonKey(name: 'view')
  final int? view;

  @JsonKey(name: 'backgroundColor')
  final int? backgroundColor;

  @JsonKey(name: 'renderMode')
  final RenderModeType? renderMode;

  @JsonKey(name: 'mirrorMode')
  final VideoMirrorModeType? mirrorMode;

  @JsonKey(name: 'setupMode')
  final VideoViewSetupMode? setupMode;

  @JsonKey(name: 'sourceType')
  final VideoSourceType? sourceType;

  @JsonKey(name: 'mediaPlayerId')
  final int? mediaPlayerId;

  @JsonKey(name: 'cropArea')
  final Rectangle? cropArea;

  @JsonKey(name: 'enableAlphaMask')
  final bool? enableAlphaMask;

  @JsonKey(name: 'position')
  final VideoModulePosition? position;

  factory VideoCanvas.fromJson(Map<String, dynamic> json) =>
      _$VideoCanvasFromJson(json);

  Map<String, dynamic> toJson() => _$VideoCanvasToJson(this);
}

Properties

uid
For Android and iOS platforms, when the video source is a composite video stream (videoSourceTranscoded), this parameter indicates the user ID that publishes the composite video stream.
subviewUid
User ID that publishes a specific composite sub-video stream.
view
Video display window.
Note: In a VideoCanvas, you can only set either view or surfaceTexture. If both are set, only the configuration in view takes effect.
renderMode
Video rendering mode. See RenderModeType.
mirrorMode
View mirroring mode. See VideoMirrorModeType.
Note:
  • Local view mirroring mode: If you use the front camera, local view mirroring is enabled by default; if you use the rear camera, it is disabled by default.
  • Remote user view mirroring mode: Disabled by default.
sourceType
Type of video source. See VideoSourceType.
setupMode
View setup mode. See VideoViewSetupMode.
mediaPlayerId
Media player ID. You can get it through getMediaPlayerId.
cropArea
(Optional) Display area of the video frame. See Rectangle. width and height represent the pixel width and height of the video in this area. The default is null (width or height is 0), which means the actual resolution of the video frame is displayed.
backgroundColor
Background color of the video canvas in RGBA format. The default is 0x00000000, which represents black.
enableAlphaMask
Note:
  • The receiver can only render alpha channel information when the sender enables the alpha transmission feature.
  • To enable alpha transmission, please contact technical support.
(Optional) Whether to enable alpha mask rendering:
  • true: Enable alpha mask rendering.
  • false: (Default) Disable alpha mask rendering.
Alpha mask rendering can create images with transparency effects and extract portraits from videos. When used with other methods, it can achieve effects such as portrait picture-in-picture or watermark overlays.
position
Position of the video frame in the video pipeline. See VideoModulePosition.