connect method
- 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 onReceivedDataStream()?,
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
を渡すことでユーザーを識別します。
videoProfile
やorientation
を渡すことで画面サイズやビットレート等の設定を行います。
cameraDirection
を利用することで最初に撮影するカメラを指定することができます。
enableVideo
、enableAudio
を指定して、明示的に映像や音声を有効・無効にすることができます。
enableRecordingOnConnect
やenableScreenCaptureOnConnect
で接続が完了したときに録画やスクリーンショットの撮影を指定することができます。
指定されない場合は、AgoraMasamuneAdapter.enableRecordingByDefaultやAgoraMasamuneAdapter.enableScreenCaptureByDefaultの設定に従います。
channelProfile
やclientRole
を指定して、通信のタイプを指定することができます。
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,
);
}