Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(rn-sdk): add onParticipantLeft event listener

Abbas Al-Mansoori60b5225ffd09
diff --git a/react-native-sdk/index.tsx b/react-native-sdk/index.tsx
index f7de9aa429..6b0434186e 100644
--- a/react-native-sdk/index.tsx
+++ b/react-native-sdk/index.tsx
@@ -28,6 +28,7 @@ interface IEventListeners {
onConferenceWillJoin?: Function;
onEnterPictureInPicture?: Function;
onParticipantJoined?: Function;
+ onParticipantLeft?: ({ id }: { id: string }) => void;
onReadyToClose?: Function;
}
@@ -118,6 +119,7 @@ export const JitsiMeeting = forwardRef((props: IAppProps, ref) => {
onConferenceLeft: eventListeners?.onConferenceLeft,
onEnterPictureInPicture: eventListeners?.onEnterPictureInPicture,
onParticipantJoined: eventListeners?.onParticipantJoined,
+ onParticipantLeft: eventListeners?.onParticipantLeft,
onReadyToClose: eventListeners?.onReadyToClose
},
'url': urlProps,
diff --git a/react/features/mobile/react-native-sdk/middleware.js b/react/features/mobile/react-native-sdk/middleware.js
index a27185986c..21b2f34d10 100644
--- a/react/features/mobile/react-native-sdk/middleware.js
+++ b/react/features/mobile/react-native-sdk/middleware.js
@@ -9,7 +9,7 @@ import {
CONFERENCE_WILL_JOIN
} from '../../base/conference/actionTypes';
import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../../base/media/actionTypes';
-import { PARTICIPANT_JOINED } from '../../base/participants/actionTypes';
+import { PARTICIPANT_JOINED, PARTICIPANT_LEFT } from '../../base/participants/actionTypes';
import MiddlewareRegistry from '../../base/redux/MiddlewareRegistry';
import StateListenerRegistry from '../../base/redux/StateListenerRegistry';
import { READY_TO_CLOSE } from '../external-api/actionTypes';
@@ -63,6 +63,14 @@ const { JMOngoingConference } = NativeModules;
rnSdkHandlers?.onParticipantJoined && rnSdkHandlers?.onParticipantJoined(participantInfo);
break;
}
+ case PARTICIPANT_LEFT: {
+ const { participant } = action;
+
+ const { id } = participant ?? {};
+
+ rnSdkHandlers?.onParticipantLeft && rnSdkHandlers?.onParticipantLeft({ id });
+ break;
+ }
case READY_TO_CLOSE:
rnSdkHandlers?.onReadyToClose && rnSdkHandlers?.onReadyToClose();
break;