Bläddra i källkod

feat(rn) add toggleCamera action

factor2
kerem 1 år sedan
förälder
incheckning
1ac86cf979
Inget konto är kopplat till bidragsgivarens mejladress

+ 2
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.java Visa fil

@@ -77,7 +77,8 @@ public class BroadcastAction {
77 77
         CLOSE_CHAT("org.jitsi.meet.CLOSE_CHAT"),
78 78
         SEND_CHAT_MESSAGE("org.jitsi.meet.SEND_CHAT_MESSAGE"),
79 79
         SET_VIDEO_MUTED("org.jitsi.meet.SET_VIDEO_MUTED"),
80
-        SET_CLOSED_CAPTIONS_ENABLED("org.jitsi.meet.SET_CLOSED_CAPTIONS_ENABLED");
80
+        SET_CLOSED_CAPTIONS_ENABLED("org.jitsi.meet.SET_CLOSED_CAPTIONS_ENABLED"),
81
+        TOGGLE_CAMERA("org.jitsi.meet.TOGGLE_CAMERA");
81 82
 
82 83
         private final String action;
83 84
 

+ 4
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastIntentHelper.java Visa fil

@@ -60,4 +60,8 @@ public class BroadcastIntentHelper {
60 60
         intent.putExtra("requestId", requestId);
61 61
         return intent;
62 62
     }
63
+
64
+    public static Intent buildToggleCameraIntent() {
65
+        return new Intent(BroadcastAction.Type.TOGGLE_CAMERA.getAction());
66
+    }
63 67
 }

+ 1
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java Visa fil

@@ -96,6 +96,7 @@ class ExternalAPIModule extends ReactContextBaseJavaModule {
96 96
         constants.put("SEND_CHAT_MESSAGE", BroadcastAction.Type.SEND_CHAT_MESSAGE.getAction());
97 97
         constants.put("SET_VIDEO_MUTED", BroadcastAction.Type.SET_VIDEO_MUTED.getAction());
98 98
         constants.put("SET_CLOSED_CAPTIONS_ENABLED", BroadcastAction.Type.SET_CLOSED_CAPTIONS_ENABLED.getAction());
99
+        constants.put("TOGGLE_CAMERA", BroadcastAction.Type.TOGGLE_CAMERA.getAction());
99 100
 
100 101
         return constants;
101 102
     }

+ 1
- 0
ios/sdk/src/ExternalAPI.h Visa fil

@@ -30,5 +30,6 @@ static NSString * const sendEventNotificationName = @"org.jitsi.meet.SendEvent";
30 30
 - (void)sendChatMessage:(NSString*)message :(NSString*)to ;
31 31
 - (void)sendSetVideoMuted:(BOOL)muted;
32 32
 - (void)sendSetClosedCaptionsEnabled:(BOOL)enabled;
33
+- (void)toggleCamera;
33 34
 
34 35
 @end

+ 9
- 2
ios/sdk/src/ExternalAPI.m Visa fil

@@ -27,6 +27,7 @@ static NSString * const closeChatAction = @"org.jitsi.meet.CLOSE_CHAT";
27 27
 static NSString * const sendChatMessageAction = @"org.jitsi.meet.SEND_CHAT_MESSAGE";
28 28
 static NSString * const setVideoMutedAction = @"org.jitsi.meet.SET_VIDEO_MUTED";
29 29
 static NSString * const setClosedCaptionsEnabledAction = @"org.jitsi.meet.SET_CLOSED_CAPTIONS_ENABLED";
30
+static NSString * const toggleCameraAction = @"org.jitsi.meet.TOGGLE_CAMERA";
30 31
 
31 32
 @implementation ExternalAPI
32 33
 
@@ -50,7 +51,8 @@ RCT_EXPORT_MODULE();
50 51
         @"CLOSE_CHAT": closeChatAction,
51 52
         @"SEND_CHAT_MESSAGE": sendChatMessageAction,
52 53
         @"SET_VIDEO_MUTED" : setVideoMutedAction,
53
-        @"SET_CLOSED_CAPTIONS_ENABLED": setClosedCaptionsEnabledAction
54
+        @"SET_CLOSED_CAPTIONS_ENABLED": setClosedCaptionsEnabledAction,
55
+        @"TOGGLE_CAMERA": toggleCameraAction
54 56
     };
55 57
 };
56 58
 
@@ -75,7 +77,8 @@ RCT_EXPORT_MODULE();
75 77
               closeChatAction,
76 78
               sendChatMessageAction,
77 79
               setVideoMutedAction,
78
-              setClosedCaptionsEnabledAction
80
+              setClosedCaptionsEnabledAction,
81
+              toggleCameraAction
79 82
     ];
80 83
 }
81 84
 
@@ -173,4 +176,8 @@ RCT_EXPORT_METHOD(sendEvent:(NSString *)name
173 176
     [self sendEventWithName:setClosedCaptionsEnabledAction body:data];
174 177
 }
175 178
 
179
+- (void)toggleCamera {
180
+    [self sendEventWithName:toggleCameraAction body:nil];
181
+}
182
+
176 183
 @end

+ 1
- 0
ios/sdk/src/JitsiMeetView.h Visa fil

@@ -46,5 +46,6 @@
46 46
 - (void)sendChatMessage:(NSString * _Nonnull)message :(NSString * _Nullable)to;
47 47
 - (void)setVideoMuted:(BOOL)muted;
48 48
 - (void)setClosedCaptionsEnabled:(BOOL)enabled;
49
+- (void)toggleCamera;
49 50
 
50 51
 @end

+ 5
- 0
ios/sdk/src/JitsiMeetView.m Visa fil

@@ -138,6 +138,11 @@ static NSString *const PiPEnabledFeatureFlag = @"pip.enabled";
138 138
     [externalAPI sendSetClosedCaptionsEnabled:enabled];
139 139
 }
140 140
 
141
+- (void)toggleCamera {
142
+    ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
143
+    [externalAPI toggleCamera];
144
+}
145
+
141 146
 #pragma mark Private methods
142 147
 
143 148
 - (void)registerObservers {

+ 6
- 0
react/features/mobile/external-api/middleware.ts Visa fil

@@ -34,6 +34,7 @@ import { getURLWithoutParams } from '../../base/connection/utils';
34 34
 import {
35 35
     JitsiConferenceEvents } from '../../base/lib-jitsi-meet';
36 36
 import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../../base/media/actionTypes';
37
+import { toggleCameraFacingMode } from '../../base/media/actions';
37 38
 import { MEDIA_TYPE, VIDEO_TYPE } from '../../base/media/constants';
38 39
 import { PARTICIPANT_JOINED, PARTICIPANT_LEFT } from '../../base/participants/actionTypes';
39 40
 import {
@@ -381,6 +382,10 @@ function _registerForNativeEvents(store: IStore) {
381 382
     eventEmitter.addListener(ExternalAPI.SET_CLOSED_CAPTIONS_ENABLED, ({ enabled }: any) => {
382 383
         dispatch(setRequestingSubtitles(enabled));
383 384
     });
385
+
386
+    eventEmitter.addListener(ExternalAPI.TOGGLE_CAMERA, () => {
387
+        dispatch(toggleCameraFacingMode());
388
+    });
384 389
 }
385 390
 
386 391
 /**
@@ -400,6 +405,7 @@ function _unregisterForNativeEvents() {
400 405
     eventEmitter.removeAllListeners(ExternalAPI.CLOSE_CHAT);
401 406
     eventEmitter.removeAllListeners(ExternalAPI.SEND_CHAT_MESSAGE);
402 407
     eventEmitter.removeAllListeners(ExternalAPI.SET_CLOSED_CAPTIONS_ENABLED);
408
+    eventEmitter.removeAllListeners(ExternalAPI.TOGGLE_CAMERA);
403 409
 }
404 410
 
405 411
 /**

Laddar…
Avbryt
Spara