Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(android/ios): added SEND_CAMERA_FACING_MODE_MESSAGE external api event
Calin-Teodor53acd386f056
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.javaindex aa199a1ba6..e370153c0a 100644--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.java@@ -100,7 +100,8 @@ public class BroadcastAction {HIDE_NOTIFICATION("org.jitsi.meet.HIDE_NOTIFICATION"),START_RECORDING("org.jitsi.meet.START_RECORDING"),STOP_RECORDING("org.jitsi.meet.STOP_RECORDING"),- OVERWRITE_CONFIG("org.jitsi.meet.OVERWRITE_CONFIG");+ OVERWRITE_CONFIG("org.jitsi.meet.OVERWRITE_CONFIG"),+ SEND_CAMERA_FACING_MODE_MESSAGE("org.jitsi.meet.SEND_CAMERA_FACING_MODE_MESSAGE");private final String action;diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastIntentHelper.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastIntentHelper.javaindex 777199d76f..8331d46f7a 100644--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastIntentHelper.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastIntentHelper.java@@ -146,4 +146,12 @@ public class BroadcastIntentHelper {return intent;}++ public static Intent buildSendCameraFacingModeMessageIntent(String to, String facingMode) {+ Intent intent = new Intent(BroadcastAction.Type.SEND_CAMERA_FACING_MODE_MESSAGE.getAction());+ intent.putExtra("to", to);+ intent.putExtra("facingMode", facingMode);++ return intent;+ }}diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.javaindex 9dc77ad215..5b24140520 100644--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java@@ -102,6 +102,7 @@ class ExternalAPIModule extends ReactContextBaseJavaModule {constants.put("START_RECORDING", BroadcastAction.Type.START_RECORDING.getAction());constants.put("STOP_RECORDING", BroadcastAction.Type.STOP_RECORDING.getAction());constants.put("OVERWRITE_CONFIG", BroadcastAction.Type.OVERWRITE_CONFIG.getAction());+ constants.put("SEND_CAMERA_FACING_MODE_MESSAGE", BroadcastAction.Type.SEND_CAMERA_FACING_MODE_MESSAGE.getAction());return constants;}diff --git a/ios/sdk/src/ExternalAPI.h b/ios/sdk/src/ExternalAPI.hindex 2e76e781dd..2e29db0a8a 100644--- a/ios/sdk/src/ExternalAPI.h+++ b/ios/sdk/src/ExternalAPI.h@@ -36,5 +36,6 @@ static NSString * const sendEventNotificationName = @"org.jitsi.meet.SendEvent";- (void)startRecording:(NSString*)mode :(NSString*)dropboxToken :(BOOL)shouldShare :(NSString*)rtmpStreamKey :(NSString*)rtmpBroadcastID :(NSString*)youtubeStreamKey :(NSString*)youtubeBroadcastID :(NSDictionary*)extraMetadata :(BOOL)transcription;- (void)stopRecording:(NSString*)mode :(BOOL)transcription;- (void)overwriteConfig:(NSDictionary*)config;+- (void)sendCameraFacingModeMessage:(NSString*)to :(NSString*)facingMode;@enddiff --git a/ios/sdk/src/ExternalAPI.m b/ios/sdk/src/ExternalAPI.mindex 4ab37df409..dccd8bfedc 100644--- a/ios/sdk/src/ExternalAPI.m+++ b/ios/sdk/src/ExternalAPI.m@@ -33,6 +33,8 @@ static NSString * const hideNotificationAction = @"org.jitsi.meet.HIDE_NOTIFICATstatic NSString * const startRecordingAction = @"org.jitsi.meet.START_RECORDING";static NSString * const stopRecordingAction = @"org.jitsi.meet.STOP_RECORDING";static NSString * const overwriteConfigAction = @"org.jitsi.meet.OVERWRITE_CONFIG";+static NSString * const sendCameraFacingModeMessageAction = @"org.jitsi.meet.SEND_CAMERA_FACING_MODE_MESSAGE";+@implementation ExternalAPIstatic NSMapTable<NSString*, void (^)(NSArray* participantsInfo)> *participantInfoCompletionHandlers;@@ -61,7 +63,8 @@ RCT_EXPORT_MODULE();@"HIDE_NOTIFICATION": hideNotificationAction,@"START_RECORDING": startRecordingAction,@"STOP_RECORDING": stopRecordingAction,- @"OVERWRITE_CONFIG": overwriteConfigAction+ @"OVERWRITE_CONFIG": overwriteConfigAction,+ @"SEND_CAMERA_FACING_MODE_MESSAGE": sendCameraFacingModeMessageAction};};@@ -92,7 +95,8 @@ RCT_EXPORT_MODULE();hideNotificationAction,startRecordingAction,stopRecordingAction,- overwriteConfigAction+ overwriteConfigAction,+ sendCameraFacingModeMessageAction];}@@ -240,4 +244,13 @@ RCT_EXPORT_METHOD(sendEvent:(NSString *)name- (void)overwriteConfig:(NSDictionary*)config {[self sendEventWithName:overwriteConfigAction body:config];}++- (void)sendCameraFacingModeMessage:(NSString*)to :(NSString*)facingMode {+ NSDictionary *data = @{+ @"to": to,+ @"facingMode": facingMode+ };++ [self sendEventWithName:sendCameraFacingModeMessageAction body:data];+}@enddiff --git a/ios/sdk/src/JitsiMeetView.h b/ios/sdk/src/JitsiMeetView.hindex 83802f3b0f..82becc1fd4 100644--- a/ios/sdk/src/JitsiMeetView.h+++ b/ios/sdk/src/JitsiMeetView.h@@ -57,4 +57,5 @@ typedef NS_ENUM(NSInteger, RecordingMode) {- (void)startRecording:(RecordingMode)mode :(NSString * _Nullable)dropboxToken :(BOOL)shouldShare :(NSString * _Nullable)rtmpStreamKey :(NSString * _Nullable)rtmpBroadcastID :(NSString * _Nullable)youtubeStreamKey :(NSString * _Nullable)youtubeBroadcastID :(NSString * _Nullable)extraMetadata :(BOOL)transcription;- (void)stopRecording:(RecordingMode)mode :(BOOL)transcription;- (void)overwriteConfig:(NSDictionary * _Nonnull)config;+- (void)sendCameraFacingModeMessage:(NSString * _Nonnull)to :(NSString * _Nonnull)facingMode;@enddiff --git a/ios/sdk/src/JitsiMeetView.m b/ios/sdk/src/JitsiMeetView.mindex 2865a86c2f..302d7a8cbe 100644--- a/ios/sdk/src/JitsiMeetView.m+++ b/ios/sdk/src/JitsiMeetView.m@@ -173,6 +173,11 @@ static NSString *recordingModeToString(RecordingMode mode);[externalAPI overwriteConfig:config];}+- (void)sendCameraFacingModeMessage:(NSString *)to :(NSString *)facingMode {+ ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];+ [externalAPI sendCameraFacingModeMessage:to :facingMode];+}+#pragma mark Private methods- (void)registerObservers {diff --git a/react/features/mobile/external-api/middleware.ts b/react/features/mobile/external-api/middleware.tsindex de03d94dd7..8f788bd889 100644--- a/react/features/mobile/external-api/middleware.ts+++ b/react/features/mobile/external-api/middleware.ts@@ -49,6 +49,7 @@ import {import MiddlewareRegistry from '../../base/redux/MiddlewareRegistry';import StateListenerRegistry from '../../base/redux/StateListenerRegistry';import { toggleScreensharing } from '../../base/tracks/actions.native';+import { CAMERA_FACING_MODE_MESSAGE } from '../../base/tracks/constants';import { getLocalTracks, isLocalTrackMuted } from '../../base/tracks/functions.native';import { ITrack } from '../../base/tracks/types';import { CLOSE_CHAT, OPEN_CHAT } from '../../chat/actionTypes';@@ -632,6 +633,21 @@ function _registerForNativeEvents(store: IStore) {dispatch(overwriteConfig(config));});++ eventEmitter.addListener(ExternalAPI.SEND_CAMERA_FACING_MODE_MESSAGE, ({ to, facingMode }: any) => {+ const conference = getCurrentConference(getState());++ if (!to) {+ logger.warn('Participant id not set');++ return;+ }++ conference?.sendEndpointMessage(to, {+ name: CAMERA_FACING_MODE_MESSAGE,+ facingMode+ });+ });}/**@@ -657,6 +673,7 @@ function _unregisterForNativeEvents() {eventEmitter.removeAllListeners(ExternalAPI.START_RECORDING);eventEmitter.removeAllListeners(ExternalAPI.STOP_RECORDING);eventEmitter.removeAllListeners(ExternalAPI.OVERWRITE_CONFIG);+ eventEmitter.removeAllListeners(ExternalAPI.SEND_CAMERA_FACING_MODE_MESSAGE);}/**