FVideoCanvas
Attributes of the video canvas object.
USTRUCT(BlueprintType) struct FVideoCanvas { GENERATED_BODY() public: UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") int64 uid = 0; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") int64 subviewUid = 0; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") UImage* view = nullptr; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") int64 backgroundColor = 0; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") ERENDER_MODE_TYPE renderMode = ERENDER_MODE_TYPE::RENDER_MODE_HIDDEN; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") EVIDEO_MIRROR_MODE_TYPE mirrorMode = EVIDEO_MIRROR_MODE_TYPE::VIDEO_MIRROR_MODE_AUTO; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") EVIDEO_VIEW_SETUP_MODE setupMode = EVIDEO_VIEW_SETUP_MODE::VIDEO_VIEW_SETUP_REPLACE; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") EVIDEO_SOURCE_TYPE sourceType = EVIDEO_SOURCE_TYPE::VIDEO_SOURCE_CAMERA_PRIMARY; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") int mediaPlayerId = 0; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") FRectangle cropArea; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") bool enableAlphaMask = false; UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Agora|VideoCanvas") EVIDEO_MODULE_POSITION position = EVIDEO_MODULE_POSITION::POSITION_POST_CAPTURER; FVideoCanvas(){} FVideoCanvas(const agora::rtc::VideoCanvas & AgoraData){ view = nullptr; uid = AgoraData.uid; subviewUid = AgoraData.subviewUid; backgroundColor = AgoraData.backgroundColor; renderMode = static_cast<ERENDER_MODE_TYPE>(AgoraData.renderMode); mirrorMode = static_cast<EVIDEO_MIRROR_MODE_TYPE>(AgoraData.mirrorMode); setupMode = static_cast<EVIDEO_VIEW_SETUP_MODE>(AgoraData.setupMode); sourceType = static_cast<EVIDEO_SOURCE_TYPE>(AgoraData.sourceType); mediaPlayerId = AgoraData.mediaPlayerId; cropArea = FRectangle(AgoraData.cropArea); enableAlphaMask = AgoraData.enableAlphaMask; position = static_cast<EVIDEO_MODULE_POSITION>(AgoraData.position); } agora::rtc::VideoCanvas CreateAgoraData() const { agora::rtc::VideoCanvas AgoraData; AgoraData.view = (agora::view_t) view; AgoraData.uid = uid; AgoraData.subviewUid = subviewUid; AgoraData.backgroundColor = backgroundColor; AgoraData.renderMode = static_cast<agora::media::base::RENDER_MODE_TYPE>(renderMode); AgoraData.mirrorMode = static_cast<agora::rtc::VIDEO_MIRROR_MODE_TYPE>(mirrorMode); AgoraData.setupMode = static_cast<agora::rtc::VIDEO_VIEW_SETUP_MODE>(setupMode); AgoraData.sourceType = static_cast<agora::rtc::VIDEO_SOURCE_TYPE>(sourceType); AgoraData.mediaPlayerId = AgoraData.mediaPlayerId; AgoraData.cropArea = cropArea.CreateAgoraData(); AgoraData.enableAlphaMask = enableAlphaMask; AgoraData.position = static_cast<agora::media::base::VIDEO_MODULE_POSITION>(position); return AgoraData; } void FreeAgoraData(agora::rtc::VideoCanvas& AgoraData) const { cropArea.FreeAgoraData(AgoraData.cropArea); } };
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;
- renderMode
- The rendering mode of the video. See ERENDER_MODE_TYPE.
- mirrorMode
-
The mirror mode of the view. See EUABT_VIDEO_MIRROR_MODE_TYPE.
Attention: This parameter does not take effect. To achieve a mirror display effect, configure the mirror settings in Unreal Engine.Attention:- For the mirror mode of the local video view: If you use a front camera, the SDK enables the mirror mode by default; if you use a rear camera, the SDK disables the mirror mode by default.
- For the remote user: The mirror mode is disabled by default.
- sourceType
- The type of the video source. See EUABT_VIDEO_SOURCE_TYPE.
- setupMode
- Setting mode of the view. See EVIDEO_VIEW_SETUP_MODE.
- cropArea
- (Optional) Display area of the video frame, see FRectangle. width and height represent the video pixel width and height of the area. The default value is null (width or height is 0), which means that the actual resolution of the video frame is displayed.
- 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 EUABT_VIDEO_MODULE_POSITION.