Class VideoCanvas

java.lang.Object
io.agora.rtc2.video.VideoCanvas

public class VideoCanvas extends Object
The VideoCanvas class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    A RGBA value indicates background color of the render view.
    boolean
    default false.
    int
    The media player id of AgoraMediaPlayer.
    int
    The video mirror mode: - `VIDEO_MIRROR_MODE_AUTO(0)`: (Default) The mirror mode determined by the SDK.
    The video frame position in pipeline.
    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.
    static final int
    3: This mode is deprecated and Agora does not recommend using it.
    static final int
    2: Uniformly scale the video until one of its dimension fits the boundary (zoomed to fit).
    static final int
    1: Uniformly scale the video until it fills the visible boundaries (cropped).
    int
    The video render mode: - `RENDER_MODE_HIDDEN(1)`: (Default)Uniformly scale the video until it fills the visible boundaries (cropped).
    int
    The mode of setting up video view.
    int
    The video source type.
    int
    The user id of video stream composing the video stream from transcoder which will be drawn on this video canvas.
    SurfaceTexture
    Set surfaceTexture makes Agora SDK as a video content provider, like Camera.
    int
    The user id of local video.
    View
    Video display window.
    static final int
     
    static final int
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    VideoCanvas(View view)
     
    VideoCanvas(View view, int renderMode, int uid)
     
    VideoCanvas(View view, int renderMode, int uid, int subviewUid)
     
  • Method Summary

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • uid

      public int uid
      The user id of local video.
    • subviewUid

      public int subviewUid
      The user id of video stream composing the video stream from transcoder which will be drawn on this video canvas.
    • RENDER_MODE_HIDDEN

      public static final int RENDER_MODE_HIDDEN
      1: Uniformly scale the video until it fills the visible boundaries (cropped). One dimension of the video may have clipped contents.
      See Also:
    • RENDER_MODE_FIT

      public static final int 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.
      See Also:
    • RENDER_MODE_ADAPTIVE

      public static final int RENDER_MODE_ADAPTIVE
      3: This mode is deprecated and Agora does not recommend using it.
      See Also:
    • VIEW_SETUP_MODE_REPLACE

      public static final int VIEW_SETUP_MODE_REPLACE
      See Also:
    • VIEW_SETUP_MODE_ADD

      public static final int VIEW_SETUP_MODE_ADD
      See Also:
    • VIEW_SETUP_MODE_REMOVE

      public static final int VIEW_SETUP_MODE_REMOVE
      See Also:
    • view

      public View view
      Video display window. Must be SurfaceView or TextureView.
    • surfaceTexture

      public SurfaceTexture 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

      public int 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

      public int 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

      public int setupMode
      The mode of setting up video view. The default value is VIEW_SETUP_MODE_REPLAC.
    • sourceType

      public int sourceType
      The video source type. The default value is VIDEO_SOURCE_CAMERA_PRIMARY.
    • mediaPlayerId

      public int 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 \ref getMediaPlayerId().
    • rect

      public Rect 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

      public boolean enableAlphaMask
      default false. if set to true, the video will apply alpha mask if exist.(Mac only)
    • backgroundColor

      public int backgroundColor
      A RGBA value indicates background color of the render view. Defaults to 0x00000000.
    • position

      The video frame position in pipeline. See \ref VIDEO_MODULE_POSITION "VIDEO_MODULE_POSITION". The default value is POSITION_POST_CAPTURER.
  • Constructor Details

    • VideoCanvas

      public VideoCanvas(View view)
    • VideoCanvas

      public VideoCanvas(View view, int renderMode, int uid)
    • VideoCanvas

      public VideoCanvas(View view, int renderMode, int uid, int subviewUid)