VideoCanvas
Attributes of the video canvas object.
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; VideoCanvas() : uid(0), subviewUid(0), view(NULL), backgroundColor(0x00000000), renderMode(media::base::RENDER_MODE_HIDDEN), mirrorMode(VIDEO_MIRROR_MODE_AUTO), setupMode(VIDEO_VIEW_SETUP_REPLACE), sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false), position(media::base::POSITION_POST_CAPTURER) {} VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt) : uid(0), subviewUid(0), view(v), backgroundColor(0x00000000), renderMode(m), mirrorMode(mt), setupMode(VIDEO_VIEW_SETUP_REPLACE), sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false), position(media::base::POSITION_POST_CAPTURER) {} VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, uid_t u) : uid(u), subviewUid(0), view(v), backgroundColor(0x00000000), renderMode(m), mirrorMode(mt), setupMode(VIDEO_VIEW_SETUP_REPLACE), sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false), position(media::base::POSITION_POST_CAPTURER) {} VideoCanvas(view_t v, media::base::RENDER_MODE_TYPE m, VIDEO_MIRROR_MODE_TYPE mt, uid_t u, uid_t subu) : uid(u), subviewUid(subu), view(v), backgroundColor(0x00000000), renderMode(m), mirrorMode(mt), setupMode(VIDEO_VIEW_SETUP_REPLACE), sourceType(VIDEO_SOURCE_CAMERA_PRIMARY), mediaPlayerId(-ERR_NOT_READY), cropArea(0, 0, 0, 0), enableAlphaMask(false), position(media::base::POSITION_POST_CAPTURER) {} };
Attributes
- uid
- User ID that publishes the video source.
- subviewUid
- The ID of the user who publishes a specific sub-video stream within the mixed video stream.
- view
- The video image. You need to define a pointer of UImage type and pass in this parameter. The sample code is as follows:
agora::rtc::VideoCanvas videoCanvas; UImage* LocalVideo; videoCanvas.view = LocalVideo;
- sourceType
- The type of the video source. See VIDEO_SOURCE_TYPE.
- mediaPlayerId
- The ID of the media player. You can get the Device ID by calling getMediaPlayerId.
- backgroundColor
- The background color of the video canvas in RGBA format. The default value is 0x00000000, which represents completely transparent black.
- enableAlphaMask
- (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 transparent effects and extract portraits from videos. When used in combination with other methods, you can implement effects such as portrait-in-picture and watermarking.
Attention:- The receiver can render alpha channel information only when the sender enables alpha transmission.
- To enable alpha transmission, technical support.
- position
- The observation position of the video frame in the video link. See VIDEO_MODULE_POSITION.