connect method

Future<void> connect({
  1. required String userName,
  2. AgoraVideoProfile videoProfile = AgoraVideoProfile.size640x360Rate15,
  3. CameraDirection cameraDirection = CameraDirection.cameraRear,
  4. bool enableAudio = true,
  5. bool enableVideo = true,
  6. bool? enableRecordingOnConnect,
  7. bool? enableScreenCaptureOnConnect,
  8. ChannelProfileType channelProfile = ChannelProfileType.channelProfileLiveBroadcasting,
  9. ClientRoleType clientRole = ClientRoleType.clientRoleBroadcaster,
  10. AgoraVideoOrientation orientation = AgoraVideoOrientation.landscape,
  11. bool enableCustomVideoSource = false,
  12. void onReceivedDataStream(
    1. int streamId,
    2. AgoraUser from,
    3. Uint8List data
    )?,
})

Connect to a new channel.

Identify the user by passing userName.

Passing videoProfile and orientation will set the screen size, bit rate, etc.

The cameraDirection allows you to specify the camera to shoot first.

You can explicitly enable or disable video and audio by specifying enableVideo and enableAudio.

You can specify that a recording or screenshot be taken when the connection is established with enableRecordingOnConnect or enableScreenCaptureOnConnect. If not specified, the settings of AgoraMasamuneAdapter.enableRecordingByDefault and AgoraMasamuneAdapter.enableScreenCaptureByDefault are followed.

You can specify the type of communication by specifying channelProfile or clientRole.

新規にチャンネルに接続します。

userNameを渡すことでユーザーを識別します。

videoProfileorientationを渡すことで画面サイズやビットレート等の設定を行います。

cameraDirectionを利用することで最初に撮影するカメラを指定することができます。

enableVideoenableAudioを指定して、明示的に映像や音声を有効・無効にすることができます。

enableRecordingOnConnectenableScreenCaptureOnConnectで接続が完了したときに録画やスクリーンショットの撮影を指定することができます。 指定されない場合は、AgoraMasamuneAdapter.enableRecordingByDefaultAgoraMasamuneAdapter.enableScreenCaptureByDefaultの設定に従います。

channelProfileclientRoleを指定して、通信のタイプを指定することができます。

Implementation

Future<void> connect({
  required String userName,
  AgoraVideoProfile videoProfile = AgoraVideoProfile.size640x360Rate15,
  CameraDirection cameraDirection = CameraDirection.cameraRear,
  bool enableAudio = true,
  bool enableVideo = true,
  bool? enableRecordingOnConnect,
  bool? enableScreenCaptureOnConnect,
  ChannelProfileType channelProfile =
      ChannelProfileType.channelProfileLiveBroadcasting,
  ClientRoleType clientRole = ClientRoleType.clientRoleBroadcaster,
  AgoraVideoOrientation orientation = AgoraVideoOrientation.landscape,
  bool enableCustomVideoSource = false,
  void Function(int streamId, AgoraUser from, Uint8List data)?
      onReceivedDataStream,
}) async {
  _videoProfile = videoProfile;
  _orientation = orientation;
  _enableAudio = enableAudio;
  _enableVideo = enableVideo;
  _channelProfile = channelProfile;
  _clientRole = clientRole;
  _cameraDirection = cameraDirection;
  _enableCustomVideoSource = enableCustomVideoSource;
  _onReceivedDataStream = onReceivedDataStream;
  await _joinRoom(
    userName: userName,
    enableRecordingOnConnect: enableRecordingOnConnect,
    enableScreenCaptureOnConnect: enableScreenCaptureOnConnect,
  );
}