startPreview abstract method

Future<void> startPreview({
  1. VideoSourceType sourceType = VideoSourceType.videoSourceCameraPrimary,
})

Enables the local video preview and specifies the video source for the preview.

You can call this method to enable local video preview. Call this method after the following: Call setupLocalVideo to initialize the local preview. Call enableVideo to enable the video module. The local preview enables the mirror mode by default. After the local video preview is enabled, if you call leaveChannel to exit the channel, the local preview remains until you call stopPreview to disable it. The video source type set in this method needs to be consistent with the video source type of VideoCanvas you set in setupLocalVideo.

  • sourceType The type of the video source. See VideoSourceType.

Returns When the method call succeeds, there is no return value; when fails, the AgoraRtcException exception is thrown. You need to catch the exception and handle it accordingly.

Implementation

Future<void> startPreview(
    {VideoSourceType sourceType = VideoSourceType.videoSourceCameraPrimary});