jitsi / jitsi-meet-sdk-samples

Jitsi Meet mobile SDK examples (Android, iOS and React Native)
Apache License 2.0
283 stars 240 forks source link

Jitsi SDK not closing calls on IOS #254

Closed AmandaApolinario closed 2 weeks ago

AmandaApolinario commented 1 month ago

I created the .xcframework sdk manually, and added it to my project, but when I enter a meeting and try to close it, or leave the meeting, the buttons have no action, and call no delegate functions. But the button to End Meeting for All calls conferenceTerminated, so the delegate is working.

This is the code I'm trying

class MeetingViewController: UIViewController {

  var jitsiMeetView = JitsiMeetView()

  override func viewDidLoad() {
    super.viewDidLoad()

    jitsiMeetView.delegate = self
    jitsiMeetView.frame = self.view.bounds
    view.addSubview(jitsiMeetView)
  }

  func joinMeeting(with url: URL) {
    let options = JitsiMeetConferenceOptions.fromBuilder { (builder) in
      builder.setFeatureFlag("invite.enabled", withBoolean: false)
      builder.setFeatureFlag("call-integration.enabled", withBoolean: false)
      builder.setFeatureFlag("calendar.enabled", withBoolean: false)
      builder.setFeatureFlag("add-people.enabled", withBoolean: false)
      builder.setFeatureFlag("meeting-password.enabled", withBoolean: false)
      builder.setFeatureFlag("pip.enabled", withBoolean: false)
      builder.setFeatureFlag("raise-hand.enabled", withBoolean: false)
      builder.setFeatureFlag("close-captions.enabled", withBoolean: false)
      builder.setFeatureFlag("live-streaming.enabled", withBoolean: false)
      builder.setFeatureFlag("tile-view.enabled", withBoolean: false)
      builder.room = url.absoluteString
    }
    jitsiMeetView.join(options)
  }

  override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
  }
}

extension MeetingViewController: JitsiMeetViewDelegate {
  func conferenceTerminated(_ data: [AnyHashable: Any]?) {
    jitsiMeetView.hangUp()
  }
}
saghul commented 1 month ago

When you use end meeting for all there is a dialog the user needs to confirm.

More importantly, the iOS SDK doesn't dismiss the view, you have to do that yourself.

AmandaApolinario commented 1 month ago

but how can I dismiss the view if the conferenceTerminated or any other delegate methods are not called when I try to close it?

mubashiralisiddiqui commented 3 weeks ago

When you use end meeting for all there is a dialog the user needs to confirm.

More importantly, the iOS SDK doesn't dismiss the view, you have to do that yourself.

@saghul when you said you have to do do yourself can you please give example how to do that? because after we join the meeting user entered into the room and and then we dont have any UI control or anything . we only rely on eventlistners which is not triggered, by press any button or when user left the meeting

saghul commented 3 weeks ago

Look at the examples here: https://github.com/jitsi/jitsi-meet-sdk-samples/tree/master/ios

The most important delegate method is readyToClose, that's when you can dismiss the controller, like the sample apps do.

mubashiralisiddiqui commented 3 weeks ago

Look at the examples here: https://github.com/jitsi/jitsi-meet-sdk-samples/tree/master/ios

The most important delegate method is readyToClose, that's when you can dismiss the controller, like the sample apps do.

I am using the sample repo code of React-native

const Meeting = ({route}) => {
  const jitsiMeeting = useRef(null);
  const navigation = useNavigation();

  const {room} = route.params;

  const onReadyToClose = useCallback(() => {
    console.log('close working');
    // @ts-ignore
    // navigation.navigate('Home');
    Alert.alert();
    navigation.pop();
    // @ts-ignore
    jitsiMeeting.current.close();
  }, [navigation]);

  const onEndpointMessageReceived = useCallback(() => {
    console.log('You got a message!');
  }, []);

  const eventListeners = {
    onReadyToClose,
    onEndpointMessageReceived,
    onParticipantLeft: () => {
      Alert.alert('afdssdf');
    },
    onConferenceLeft: () => {
      Alert.alert('afdssdf');
    },
  };
  const jitsiUrl = route?.params?.jitsiUrl;
  const jwt = jitsiUrl?.split('?jwt=')[1];
  const pathArray = jitsiUrl.split('/');
  const roomName = pathArray[pathArray.length - 1].split('?')[0];
  return (
    // @ts-ignore
    <JitsiMeeting
      config={{
        hideConferenceTimer: true,
        customToolbarButtons: [
          {
            icon: 'https://w7.pngwing.com/pngs/987/537/png-transparent-download-downloading-save-basic-user-interface-icon-thumbnail.png',
            id: 'btn1',
            text: 'Button one',
          },
          {
            icon: 'https://w7.pngwing.com/pngs/987/537/png-transparent-download-downloading-save-basic-user-interface-icon-thumbnail.png',
            id: 'btn2',
            text: 'Button two',
          },
        ],
        whiteboard: {
          enabled: true,
          collabServerBaseUrl: 'https://meet.jit.si/',
        },
      }}
      onEnd={() => {
        Alert.alert('hurray');
      }}
      eventListeners={eventListeners}
      flags={{
        'audioMute.enabled': true,
        'ios.screensharing.enabled': true,
        'fullscreen.enabled': false,
        'audioOnly.enabled': false,
        'android.screensharing.enabled': true,
        'pip.enabled': true,
        'pip-while-screen-sharing.enabled': true,
        'conference-timer.enabled': true,
        'close-captions.enabled': false,
        'toolbox.enabled': true,
      }}
      ref={jitsiMeeting}
      style={{flex: 1}}
      room={roomName}
      serverURL={jitsiUrl || 'https://meet.jit.si/'}
      token={jwt || ''}
    />
  );
};

you can see in above example this is the same code of the repo which you shared but problem is no listner triggered neither onReadyToClose or any other I tried to put consoles and Alert but nothing worked

saghul commented 3 weeks ago

Can you share some logs please? Does the unmodified version work?

mubashiralisiddiqui commented 3 weeks ago

https://github.com/user-attachments/assets/9f3131ee-e7ad-45c7-be65-c51e8ab6123b

this is the screen recording of example repo app downloaded from this link https://github.com/jitsi/jitsi-meet-sdk-samples/tree/master

I have just changed the jitsi server URL and Add the token props and you can see nothing happened on press leave confrence

I observed one thing if I didnt pass the token and use the same server url which is in the example "https://meet.jit.si/" then after i join the room and try to leave in this case onReadyToClose triggered but not when you pass the token and your server url @saghul

and here are some logs whic i see in meteor debug terminal cept>: JingleSessionPC[session=JVB,initiator=false,sid=386o18qp38cak] Sending session-accept LOG 2024-10-31T10:43:29.874Z [modules/xmpp/JingleSessionPC.js] (TIME) ICE checking JVB: 12517672.847666 INFO 2024-10-31T10:43:30.169Z [modules/xmpp/JingleSessionPC.js] : JingleSessionPC[session=JVB,initiator=false,sid=386o18qp38cak] setVideoCodecs: codecList=vp8,vp9,h264,av1, screenshareCodec=undefined INFO 2024-10-31T10:43:30.183Z [modules/xmpp/JingleSessionPC.js] : JingleSessionPC[session=JVB,initiator=false,sid=386o18qp38cak] setSenderVideoConstraint: 2160, sourceName: f77289f0-v0 INFO 2024-10-31T10:43:30.188Z [modules/RTC/TraceablePeerConnection.js] TPC[id=1,type=JVB] setting max height=2160,encodings=[{"active":true,"maxBitrate":200000,"scaleResolutionDownBy":4},{"active":true,"maxBitrate":500000,"scaleResolutionDownBy":2},{"active":true,"maxBitrate":0,"scaleResolutionDownBy":1}] LOG 2024-10-31T10:43:30.560Z [modules/xmpp/JingleSessionPC.js] (TIME) ICE connected JVB: 12518358.782666 INFO 2024-10-31T10:43:30.771Z [modules/RTC/BridgeChannel.js] datachannel channel opened LOG 2024-10-31T10:43:30.774Z [JitsiConferenceEventManager.js] (TIME) data.channel.opened: 12518572.612875 INFO 2024-10-31T10:43:30.774Z [modules/RTC/BridgeChannel.js] : Sending SourceVideoTypeMessage with video type f77289f0-v0: camera LOG 2024-10-31T10:43:30.775Z [modules/RTC/BridgeChannel.js] : Sending ReceiverVideoConstraints with {"constraints":{"be357904-v0":{"maxHeight":2160}},"defaultConstraints":{"maxHeight":0},"lastN":-1,"onStageSources":["be357904-v0"],"selectedSources":[]} INFO 2024-10-31T10:43:30.923Z [modules/RTC/BridgeChannel.js] SenderSourceConstraints: f77289f0-v0 - 180 INFO 2024-10-31T10:43:30.924Z [modules/xmpp/JingleSessionPC.js] : JingleSessionPC[session=JVB,initiator=false,sid=386o18qp38cak] setSenderVideoConstraint: 180, sourceName: f77289f0-v0 INFO 2024-10-31T10:43:30.927Z [modules/RTC/BridgeChannel.js] New forwarded sources: INFO 2024-10-31T10:43:36.223Z [features/app] appNavigate to undefined LOG rn-webrtc:pc:DEBUG 0 getStats +8s INFO 2024-10-31T10:43:42.293Z [modules/RTC/BridgeChannel.js] Endpoint connection status changed: be357904 active=false LOG rn-webrtc:pc:DEBUG 0 getStats +10s LOG rn-webrtc:pc:DEBUG 0 getStats +10s INFO 2024-10-31T10:43:59.425Z [modules/RTC/BridgeChannel.js] SenderSourceConstraints: f77289f0-v0 - 0 INFO 2024-10-31T10:43:59.429Z [modules/xmpp/JingleSessionPC.js] : JingleSessionPC[session=JVB,initiator=false,sid=386o18qp38cak] setSenderVideoConstraint: 0, sourceName: f77289f0-v0 INFO 2024-10-31T10:43:59.432Z [modules/RTC/TraceablePeerConnection.js] TPC[id=1,type=JVB] setting max height=0,encodings=[{"active":false,"maxBitrate":200000,"scaleResolutionDownBy":4},{"active":false,"maxBitrate":500000,"scaleResolutionDownBy":2},{"active":false,"maxBitrate":0,"scaleResolutionDownBy":1}] INFO 2024-10-31T10:43:59.458Z [modules/xmpp/JingleSessionPC.js] : JingleSessionPC[session=JVB,initiator=false,sid=386o18qp38cak] setVideoCodecs: codecList=vp8,vp9,h264,av1, screenshareCodec=undefined INFO 2024-10-31T10:43:59.964Z [features/app] appNavigate to undefined WARN 2024-10-31T10:43:59.968Z [features/app] Joining same conference using URL: https://video.digitaltolk.se/ROOM-3707406?3707406?jwt="myjwt"thumbnail.png%22%2C%22id%22%3A%22btn2%22%2C%22text%22%3A%22Button%20two%22%7D%5D&config.whiteboard=%7B%22enabled%22%3Atrue%2C%22collabServerBaseUrl%22%3A%22https%3A%2F%2Fmeet.jit.si%2F%22%7D LOG rn-webrtc:pc:DEBUG 0 getStats +10s INFO 2024-10-31T10:44:11.050Z [features/app] appNavigate to undefined WARN 2024-10-31T10:44:11.056Z [features/app] Joining same conference using URL: https://video.digitaltolk.se/ROOM-3707406?jwt="myjwt" LOG rn-webrtc:pc:DEBUG 0 getStats +10s LOG 2024-10-31T10:44:19.327Z [modules/xmpp/strophe.jingle.js] : terminating... 386o18qp38cak

saghul commented 3 weeks ago

@Calinteodor PTAL.

mubashiralisiddiqui commented 2 weeks ago

@saghul its working fine now I was using the url like this https://mybaseURL/ROOMName?token then I replace the url to just the base url https://mybaseURL and the events started working Thanks