startLocalPreview method

Future<void> startLocalPreview(
  1. bool frontCamera,
  2. int? viewId
)

Enable the local camera to preview the screen, and turn on video push streaming only when enterRoom is called (if it has been called, video push streaming will start automatically)

When the first camera video frame starts to be rendered, you will receive the onFirstVideoFrame(null) callback in TRTCCloudListener.

Parameters:

frontCamera true: front camera; false: rear camera.

viewId viewId generated by TRTCCloudVideoView

Platform not supported´╝Ü

  • macOS

Implementation

Future<void> startLocalPreview(bool frontCamera, int? viewId) {
  if (viewId == null) {
    return _cloudChannel!
        .invokeMethod('startLocalPreview', {"isFront": frontCamera});
  } else {
    return TRTCCloudVideoViewController(viewId)
        .startLocalPreview(frontCamera, _cloudChannel!.name);
  }
}