Agora Java API Reference for Android

Public Member Functions | Public Attributes | Static Public Attributes | List of all members
io.agora.rtc2.video.VideoCanvas Class Reference

## Public Member Functions
| VideoCanvas (View view)
| VideoCanvas (View view, int renderMode, int uid)
| VideoCanvas (View view, int renderMode, int uid, int subviewUid)

## Public Attributes
int | uid
int | subviewUid
View | view
SurfaceTexture | surfaceTexture
int | renderMode
int | mirrorMode
int | setupMode = VIEW_SETUP_MODE_REPLACE
int | sourceType
int | mediaPlayerId
Rect | rect
boolean | enableAlphaMask
int | backgroundColor
Constants.VideoModulePosition | position

## Static Public Attributes
static final int | RENDER_MODE_HIDDEN = 1
static final int | RENDER_MODE_FIT = 2
static final int | RENDER_MODE_ADAPTIVE = 3
static final int | VIEW_SETUP_MODE_REPLACE = 0
static final int | VIEW_SETUP_MODE_ADD = 1
static final int | VIEW_SETUP_MODE_REMOVE = 2

## Detailed Description

The VideoCanvas class.

## Member Data Documentation

## ◆ uid

int io.agora.rtc2.video.VideoCanvas.uid

The user id of local video.

## ◆ subviewUid

int io.agora.rtc2.video.VideoCanvas.subviewUid

The user id of video stream composing the video stream from transcoder which will be drawn on this video canvas.

## ◆ RENDER_MODE_HIDDEN

final int io.agora.rtc2.video.VideoCanvas.RENDER_MODE_HIDDEN = 1
| static

1: Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents.

## ◆ RENDER_MODE_FIT

final int io.agora.rtc2.video.VideoCanvas.RENDER_MODE_FIT = 2
| static

2: Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio are filled with black.

## ◆ RENDER_MODE_ADAPTIVE

final int io.agora.rtc2.video.VideoCanvas.RENDER_MODE_ADAPTIVE = 3
| static

3: This mode is deprecated and Agora does not recommend using it.

## ◆ view

View io.agora.rtc2.video.VideoCanvas.view

Video display window. Must be SurfaceView or TextureView.

## ◆ surfaceTexture

SurfaceTexture io.agora.rtc2.video.VideoCanvas.surfaceTexture

Set surfaceTexture makes Agora SDK as a video content provider, like Camera. While set view Agora SDK consumes video content using view. You need draw texture on OpenGL context youself. You may set view or surfaceTexture, BUT DO NOT BOTH in one VideoCanvas, otherwise only view is used.

## ◆ renderMode

int io.agora.rtc2.video.VideoCanvas.renderMode

The video render mode:

- `RENDER_MODE_HIDDEN(1)`: (Default)Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents.
- `RENDER_MODE_FIT(2)`: Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit). Areas that are not filled due to the disparity in the aspect ratio are filled with black.
- `RENDER_MODE_ADAPTIVE(3)`: This mode is deprecated and Agora does not recommend using it.

## ◆ mirrorMode

int io.agora.rtc2.video.VideoCanvas.mirrorMode

The video mirror mode:

- `VIDEO_MIRROR_MODE_AUTO(0)`: (Default) The mirror mode determined by the SDK. If you use the front camera, the SDK enables the mirror mode; if you use the rear camera, the SDK disables the mirror mode.
- `VIDEO_MIRROR_MODE_ENABLED(1)`: Enable the mirror mode.
- `VIDEO_MIRROR_MODE_DISABLED(2)`: Disable the mirror mode.

## ◆ setupMode

int io.agora.rtc2.video.VideoCanvas.setupMode = VIEW_SETUP_MODE_REPLACE

The mode of setting up video view. The default value is VIEW_SETUP_MODE_REPLAC.

## ◆ sourceType

int io.agora.rtc2.video.VideoCanvas.sourceType

The video source type. The default value is VIDEO_SOURCE_CAMERA_PRIMARY.

## ◆ mediaPlayerId

int io.agora.rtc2.video.VideoCanvas.mediaPlayerId

The media player id of AgoraMediaPlayer. It should set this parameter when the sourceType is VIDEO_SOURCE_MEDIA_PLAYER to show the video that AgoraMediaPlayer is playing. You can get this value by calling the method getMediaPlayerId().

## ◆ rect

Rect io.agora.rtc2.video.VideoCanvas.rect

If you want to display a certain part of a video frame, you can set this value to crop the video frame to show. The default value is empty(that is, if it has zero width or height), which means no cropping.

## ◆ enableAlphaMask

boolean io.agora.rtc2.video.VideoCanvas.enableAlphaMask

default false. if set to true, the video will apply alpha mask if exist.(Mac only)

## ◆ backgroundColor

int io.agora.rtc2.video.VideoCanvas.backgroundColor

A RGBA value indicates background color of the render view. Defaults to 0x00000000.

## ◆ position

Constants.VideoModulePosition io.agora.rtc2.video.VideoCanvas.position

Initial value:
=
Constants.VideoModulePosition.VIDEO_MODULE_POSITION_POST_CAPTURER

The video frame position in pipeline. See VIDEO_MODULE_POSITION. The default value is POSITION_POST_CAPTURER.