joinMeeting method

  1. @override
Future<JitsiMeetingResponse> joinMeeting(
  1. JitsiMeetingOptions options, {
  2. JitsiMeetingListener? listener,
  3. Map<RoomNameConstraintType, RoomNameConstraint>? roomNameConstraints,
})
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,
    Map<RoomNameConstraintType, RoomNameConstraint>?
        roomNameConstraints}) async {
  // encode `options` Map to Json to avoid error
  // in interoperability conversions
  String webOptions = jsonEncode(options.webOptions);
  String serverURL = options.serverURL ?? "meet.jit.si";
  serverURL = serverURL.replaceAll(cleanDomain, "");
  api = jitsi.JitsiMeetAPI(serverURL, webOptions);

  // setup listeners
  if (listener != null) {
    api?.on("videoConferenceJoined", allowInterop((dynamic _message) {
      // Mapping object according with jitsi external api source code
      Map<String, dynamic> message = {
        "displayName": _message.displayName,
        "roomName": _message.roomName
      };
      listener.onConferenceJoined?.call(message);
    }));
    api?.on("videoConferenceLeft", allowInterop((dynamic _message) {
      // Mapping object according with jitsi external api source code
      Map<String, dynamic> message = {"roomName": _message.roomName};
      listener.onConferenceTerminated?.call(message);
    }));
    api?.on("feedbackSubmitted", allowInterop((dynamic message) {
      debugPrint("feedbackSubmitted message: $message");
      listener.onError?.call(message);
    }));

    // NOTE: `onConferenceWillJoin` is not supported or nof found event in web

    // add geeric listener
    _addGenericListeners(listener);

    // force to dispose view when close meeting
    // this is needed to allow create another room in
    // the same view without reload it
    api?.on("readyToClose", allowInterop((dynamic message) {
      api?.dispose();
    }));
  }

  return JitsiMeetingResponse(isSuccess: true);
}