Agora Java API Reference for Android

Public Member Functions | Protected Member Functions | List of all members
io.agora.rte.Canvas Class Reference

## Public Member Functions
| Canvas (Rte rte, CanvasInitialConfig config)
long | getNativeHandle ()
void | addView (View view, ViewConfig viewConfig) throws RteException
void | removeView (View view, ViewConfig viewConfig) throws RteException
void | getConfigs (CanvasConfig config) throws RteException
void | setConfigs (CanvasConfig config) throws RteException

## Protected Member Functions
void | finalize ()

## Detailed Description

Canvas interface, used to set the video rendering view.

Since
  v4.4.0

## Constructor & Destructor Documentation

## ◆ Canvas()

io.agora.rte.Canvas.Canvas | ( | Rte | rte,
|  | CanvasInitialConfig | config
| ) |  |

Construct a Canvas object.

Since
  v4.4.0

Parameters

  rte | Rte object.
  config | CanvasInitialConfig initialization configuration object. Currently, a null pointer can be passed.

## Member Function Documentation

## ◆ addView()

void io.agora.rte.Canvas.addView | ( | View | view,
|  | ViewConfig | viewConfig
| ) |  | throws RteException

Add a rendering view. Currently, only one view is supported.

Since
  v4.4.0

Parameters

  view | Pointer to the View object. On the Android platform, you can assign an SurfaceView object to a View type variable and pass it to the interface.
  config | View-related configuration. Currently, nullptr can be passed.

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_OPERATION: The corresponding internal Canvas object has been destroyed or is invalid. ErrorCode.INVALID_ARGUMENT: The passed view is null.

Returns
  void

## ◆ removeView()

void io.agora.rte.Canvas.removeView | ( | View | view,
|  | ViewConfig | viewConfig
| ) |  | throws RteException

Remove a rendering view.

Since
  v4.4.0

Parameters

  view | Pointer to the View object.
  config | View-related configuration. Currently, nullptr can be passed.

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_OPERATION: The corresponding internal Canvas object has been destroyed or is invalid. ErrorCode.INVALID_ARGUMENT: The passed view is null.

Returns
  void

## ◆ getConfigs()

void io.agora.rte.Canvas.getConfigs | ( | CanvasConfig | config | ) | throws RteException

Get the configuration of Canvas object.

Since
  v4.4.0

Parameters

  config | CanvasConfig object

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_OPERATION: The corresponding internal Canvas object has been destroyed or is invalid. ErrorCode.INVALID_ARGUMENT: The passed config object is null.

Returns
  void

## ◆ setConfigs()

void io.agora.rte.Canvas.setConfigs | ( | CanvasConfig | config | ) | throws RteException

Configure the Canvas object.

Since
  v4.4.0

Parameters

  config | CanvasConfig object

Exceptions

  RteException | RteException.errorCode() may return the following ErrorCode: ErrorCode.INVALID_OPERATION: The corresponding internal Canvas object has been destroyed or is invalid. ErrorCode.INVALID_ARGUMENT: The passed config object is null.

Returns
  void