joinMeeting method

  1. @override
Future<MeetHourMeetingResponse> joinMeeting(
  1. MeetHourMeetingOptions options, {
  2. MeetHourMeetingListener? listener,
})
override

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

Implementation

@override
Future<MeetHourMeetingResponse> joinMeeting(
  MeetHourMeetingOptions options, {
  MeetHourMeetingListener? listener,
}) async {
  // Attach a listener if it exists. The key is based on the serverURL + room
  if (listener != null) {
    String serverURL = options.serverURL ?? "https://meethour.io";
    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) =>
          MeetHourMeetingResponse(isSuccess: true, message: message))
      .catchError(
    (error) {
      return MeetHourMeetingResponse(
          isSuccess: true, message: error.toString(), error: error);
    },
  );
}