joinMeeting method

  1. @override
Future<JitsiMeetingResponse> joinMeeting(
  1. JitsiMeetingOptions options, {
  2. JitsiMeetingListener? listener,
})
override

Joins a meeting based on the JitsiMeetingOptions passed in. A JitsiMeetingListener can be attached to this meeting that will automatically be removed when the meeting has ended

Implementation

@override
Future<JitsiMeetingResponse> joinMeeting(
  JitsiMeetingOptions options, {
  JitsiMeetingListener? listener,
}) async {
  // Attach a listener if it exists. The key is based on the serverURL + room
  if (listener != null) {
    String serverURL = options.serverURL ?? "https://meet.jit.si";
    String key;
    if (serverURL.endsWith("/")) {
      key = serverURL + options.room;
    } else {
      key = serverURL + "/" + options.room;
    }

    _perMeetingListeners.update(key, (oldListener) => listener,
        ifAbsent: () => listener);
    initialize();
  }
  Map<String, dynamic> _options = {
    'room': options.room.trim(),
    'serverURL': options.serverURL?.trim(),
    'subject': options.subject,
    'token': options.token,
    'audioMuted': options.audioMuted,
    'audioOnly': options.audioOnly,
    'videoMuted': options.videoMuted,
    'featureFlags': options.getFeatureFlags(),
    'userDisplayName': options.userDisplayName,
    'userEmail': options.userEmail,
    'iosAppBarRGBAColor': options.iosAppBarRGBAColor,
  };

  return await _channel
      .invokeMethod<String>('joinMeeting', _options)
      .then((message) =>
          JitsiMeetingResponse(isSuccess: true, message: message))
      .catchError(
    (error) {
      return JitsiMeetingResponse(
          isSuccess: true, message: error.toString(), error: error);
    },
  );
}