# VideoCanvas (/zh-CN/api-reference/rtc/flutter/class-videocanvas)
> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).
```dart
@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 json) =>
_$VideoCanvasFromJson(json);
Map toJson() => _$VideoCanvasToJson(this);
}
```
## 属性 [#属性]
对于 Android 和 iOS 平台,当视频源为合图视频流 (`videoSourceTranscoded`) 时,该参数表示发布合图视频流的用户 ID。
发布某一路合图子视频流的用户 ID。
视频显示窗口。
:::note
注: 在一个 [VideoCanvas](/zh-CN/api-reference/rtc/flutter/class-videocanvas) 中,你只能选择 `view` 或 `surfaceTexture` 其中一个进行设置,如果同时设置,只有 `view` 中的设置会生效。
:::
视频渲染模式,详见 [RenderModeType](/zh-CN/api-reference/rtc/flutter/enum-rendermodetype)。
视图镜像模式,详见 [VideoMirrorModeType](/zh-CN/api-reference/rtc/flutter/enum-videomirrormodetype)。
:::note
注:
- 本地视图镜像模式:如果你使用前置摄像头,默认启动本地视图镜像模式;如果你使用后置摄像头,默认关闭本地视图镜像模式。
- 远端用户视图镜像模式:默认关闭远端用户的镜像模式。
:::
视频源的类型,详见 [VideoSourceType](/zh-CN/api-reference/rtc/flutter/enum-videosourcetype)。
视图设置模式。详见 [VideoViewSetupMode](/zh-CN/api-reference/rtc/flutter/enum-videoviewsetupmode)。
媒体播放器 ID。可通过 [getMediaPlayerId](/zh-CN/api-reference/rtc/flutter/play/mediaplayer/mediaplayer-info#api_imediaplayer_getmediaplayerid) 获取。
(可选)视频帧的展示区域,详见 [Rectangle](/zh-CN/api-reference/rtc/flutter/class-rectangle)。其中,`width` 和 `height` 表示该区域的视频像素宽度和高度。默认值为空值 (宽或高为 0),表示展示实际分辨率的视频帧。
视频画布的背景颜色,格式为 RGBA。默认值为 0x00000000,代表黑色。
:::note
注:
- 仅当发送端开启 Alpha 传输功能时,接收端才能渲染 Alpha 通道的信息。
- 如需开启 Alpha 传输功能,请[联系技术支持](https://ticket.shengwang.cn/)。
:::
(可选)是否开启 Alpha 遮罩渲染:
- true:开启 Alpha 遮罩渲染。
- false:(默认)关闭 Alpha 遮罩渲染。
Alpha 遮罩渲染可以创建具有透明效果的图像,还可以提取视频中的人像。与其他方法结合使用时,可以实现人像画中画、添加水印等效果。
视频帧在视频链路中的位置。详见 [VideoModulePosition](/zh-CN/api-reference/rtc/flutter/enum-videomoduleposition)。