jitsi / jitsi-meet-sdk-samples

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

React native jitsi meet sdk hang up #244

Open McCrayCircle opened 1 month ago

McCrayCircle commented 1 month ago

Screenshot_20240808_080834 Screenshot_20240808_075748 Hello team how are you? Could you please help me to solve react native sdk problem? I'm using import { JitsiMeeting } from '@jitsi/react-native-sdk';. If any side who click hangup on jitsi meeting page of app before both of them enter meeting room, app will crash. then I should re-install the app. I attached my screens. `

export default function CustomMeeting() {
  const { t } = useTranslation();
  const { chatId, workspaceId } = useParams();
  const { roomName, isVideoDisabled, enableMic, setOpenCalling } = useMeeting();
  const { userdata, user } = useUser();
  const navigation = useNavigation();
  const jitsiMeeting = useRef(null);
  const [endCall, setEndCall] = useState(false);
  const route = useRoute();

  const endConference = async () => {
    try {
      const { directId } = await postData('/directs', {
        workspaceId,
        userId: user?.uid,
      });
      setOpenCalling(false);
      navigation.navigate('Home')
      // if (chatId) {
      //   navigation.navigate('Chat', {
      //     objectId: directId
      //   });
      // } else {
      // }
    } catch (err) {
      console.error(err)
    }
  }
  const handleHangup = useCallback(async () => {
    try {
      if (!endCall) {
        setEndCall(true);
        await endConference();
      }
    } catch (err) {
      console.error(err);
    }
  }, [endCall, endConference]);

  useEffect(() => {
    const unsubscribe = navigation.addListener('beforeRemove', handleHangup);
    return unsubscribe;
  }, [navigation, handleHangup]);

  const onReadyToClose = useCallback(async () => {
    try {
      setOpenCalling(false);
      navigation.navigate('Home')
    } catch (err) {
      console.error('close', err)
    }
  }, [navigation]);

  const onParticipantLeft = useCallback(async () => {
    try {
      if (!endCall) {
        setEndCall(true);
        await endConference();
      }
    } catch (err) {
      console.error(err)
    }
  }, [navigation]);

  const eventListeners = {
    onReadyToClose,
    onParticipantLeft
  };

  return (
    <JitsiMeeting
      style={{ flex: 1 }}
      room={route.params?.roomName}
      serverURL={env.MEETING_URL}
      userInfo={{
        avatarURL: '',
        displayName: '',
        email: ''
      }}
      config={{
        prejoinPageEnabled: false,
        startAudioOnly: route.params?.audioOnly,
        subject: t("Video Call"),
      }}
      ref={jitsiMeeting}
      eventListeners={eventListeners}
    />

  );
};

`

Looking forward to hearing from you. Thank you

saghul commented 1 month ago

Please provide logs that show the crash.

McCrayCircle commented 1 month ago

What kind of log I should show you?

McCrayCircle commented 1 month ago

Let me show you some logs that may help you. image image image image image

McCrayCircle commented 1 month ago

image image image

McCrayCircle commented 1 month ago

@saghul Please let me know if these logs can help to solve my problem. Thank you

saghul commented 1 month ago

They don't, sorry. The only error there seems related to GMS and happens in another process, not the app.

What RN SDK version are you using? Do you get a red screen?

McCrayCircle commented 1 month ago
"@jitsi/react-native-sdk": "^2.2.1",
"react-native": "0.68.2",

I don't see red screen

McCrayCircle commented 1 month ago

Thank you for your answer. When I click hangup button before enter another side, app still loading(mentioned mobile image).

McCrayCircle commented 1 month ago

When integrating Jitsi SDK in a React Native app, if the app crashes when you click hangup after inviting someone to a call and before they join the meeting, there could be several reasons:

Inconsistent State: When you invite someone to a meeting, the Jitsi SDK enters a state of waiting for the other person to join. If you hang up before they join, it might lead to an inconsistent state, causing a crash.

Event Listeners Not Cleaned Up: If you click the hangup button, and the event listeners related to the meeting are not properly cleaned up or removed, it might lead to memory leaks or crashes.

Internal SDK Error: There might be unhandled errors or bugs within the Jitsi SDK that do not handle the hangup operation correctly in this specific situation.

Concurrency Issues: Handling multiple operations simultaneously (like inviting a user and hanging up) without proper synchronization mechanisms might cause concurrency issues, leading to crashes.

I saw this, but didn't find solution.

Calinteodor commented 1 month ago
"@jitsi/react-native-sdk": "^2.2.1",
"react-native": "0.68.2",

I don't see red screen

You are way behind with @jitsi/react-native-sdk. Please try updating to latest, which is 10.0.0. Also, please consider following this guide so you don't miss important updates. https://jitsi.github.io/handbook/docs/dev-guide/dev-guide-react-native-sdk