VideoCanvas

Attributes of video canvas object.

public class VideoCanvas {
    public static final int RENDER_MODE_HIDDEN = 1;
    public static final int RENDER_MODE_FIT = 2;
    public static final int RENDER_MODE_ADAPTIVE = 3;

  public static final int VIEW_SETUP_MODE_REPLACE = 0;

  public static final int VIEW_SETUP_MODE_ADD = 1;

  public static final int VIEW_SETUP_MODE_REMOVE = 2;
    public View view;
    public int uid;
    public int renderMode;
    public int mirrorMode;
    public int setupMode = VIEW_SETUP_MODE_REPLACE;
    public int sourceType;
    public int mediaPlayerId;
    public Rect rect;

  public VideoCanvas(View view) {
    this.view = view;
    this.renderMode = RENDER_MODE_HIDDEN;
  }

  public VideoCanvas(View view, int renderMode) {
    this.view = view;
    this.renderMode = renderMode;
    this.uid = 0;
  }

  public VideoCanvas(View view, int renderMode, int uid) {
    this.view = view;
    this.renderMode = renderMode;
    this.uid = uid;
  }

  public VideoCanvas(View view, int renderMode, int mirrorMode, int uid) {
    this.view = view;
    this.renderMode = renderMode;
    this.mirrorMode = mirrorMode;
    this.uid = uid;
  }

  public VideoCanvas(View view, int renderMode, int mirrorMode, int sourceType, int uid) {
    this.view = view;
    this.renderMode = renderMode;
    this.mirrorMode = mirrorMode;
    this.sourceType = sourceType;
    this.uid = uid;
  }

  public VideoCanvas(
      View view, int renderMode, int mirrorMode, int sourceType, int mediaPlayerId, int uid) {
    this.view = view;
    this.renderMode = renderMode;
    this.mirrorMode = mirrorMode;
    this.sourceType = sourceType;
    this.mediaPlayerId = mediaPlayerId;
    this.uid = uid;
  }

  public VideoCanvas(View view, int renderMode, int mirrorMode, int sourceType, int mediaPlayerId,
      int uid, Rect rect, int setupMode) {
    this.view = view;
    this.renderMode = renderMode;
    this.mirrorMode = mirrorMode;
    this.sourceType = sourceType;
    this.mediaPlayerId = mediaPlayerId;
    this.uid = uid;
    this.rect = rect;
    this.setupMode = setupMode;
  }
}

Attributes

view
Video display window.
renderMode
  • RENDER_MODE_HIDDEN(1): Hidden mode. Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents.
  • RENDER_MODE_FIT(2): Fit mode. 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.
mirrorMode
  • VIDEO_MIRROR_MODE_AUTO(0): (Default) The mirror mode determined by the SDK. 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.
  • VIDEO_MIRROR_MODE_ENABLED(1): Enable the mirror mode.
  • VIDEO_MIRROR_MODE_DISABLED(2): Disable the mirror mode.
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.
uid
The user ID.
sourceType
The type of the video frame, see VideoSourceType.
sourceId
The ID of the video source.
setupMode
Setting mode of the view.
  • VIEW_SETUP_MODE_REPLACE(0): (Default) Replaces a view.
  • VIEW_SETUP_MODE_ADD(1): Adds a view.
  • VIEW_SETUP_MODE_REMOVE(2): Delete a view.
mediaPlayerId
The ID of the media player. You can get the media player ID by calling getMediaPlayerId.
This parameter is required when sourceType is VIDEO_SOURCE_MEDIA_PLAYER.
cropArea
(Optional) The display area for the video frame. See Rectangle. 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.