initRoomConnect static method

Future<void> initRoomConnect(
  1. String token,
  2. Room currentRoom,
  3. LocalAudioTrack? autoTrack,
  4. LocalVideoTrack? videoTrack, {
  5. dynamic onError(
    1. dynamic
    )?,
})

Implementation

static Future<void> initRoomConnect(String token, Room currentRoom, LocalAudioTrack? autoTrack, LocalVideoTrack? videoTrack, {Function(dynamic)? onError}) async {
  try {
    showLogI("[TOKEN]======> $token");
    await currentRoom.prepareConnection(ApiConstant.urlConnectLivekit, token);
    await currentRoom.connect(
      ApiConstant.urlConnectLivekit,
      token,
      fastConnectOptions: FastConnectOptions(
        microphone: TrackOption(enabled: true, track: autoTrack),
        camera: TrackOption(enabled: videoTrack != null, track: videoTrack),
      ),
    );
  } catch (e) {
    if (onError != null) onError(e);
  }
}