Browse Source

feat(rn) add toggleCamera action

factor2
kerem 2 years ago
parent
commit
1ac86cf979
No account linked to committer's email address

+ 2
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastAction.java View File

77
         CLOSE_CHAT("org.jitsi.meet.CLOSE_CHAT"),
77
         CLOSE_CHAT("org.jitsi.meet.CLOSE_CHAT"),
78
         SEND_CHAT_MESSAGE("org.jitsi.meet.SEND_CHAT_MESSAGE"),
78
         SEND_CHAT_MESSAGE("org.jitsi.meet.SEND_CHAT_MESSAGE"),
79
         SET_VIDEO_MUTED("org.jitsi.meet.SET_VIDEO_MUTED"),
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
         private final String action;
83
         private final String action;
83
 
84
 

+ 4
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/BroadcastIntentHelper.java View File

60
         intent.putExtra("requestId", requestId);
60
         intent.putExtra("requestId", requestId);
61
         return intent;
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 View File

96
         constants.put("SEND_CHAT_MESSAGE", BroadcastAction.Type.SEND_CHAT_MESSAGE.getAction());
96
         constants.put("SEND_CHAT_MESSAGE", BroadcastAction.Type.SEND_CHAT_MESSAGE.getAction());
97
         constants.put("SET_VIDEO_MUTED", BroadcastAction.Type.SET_VIDEO_MUTED.getAction());
97
         constants.put("SET_VIDEO_MUTED", BroadcastAction.Type.SET_VIDEO_MUTED.getAction());
98
         constants.put("SET_CLOSED_CAPTIONS_ENABLED", BroadcastAction.Type.SET_CLOSED_CAPTIONS_ENABLED.getAction());
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
         return constants;
101
         return constants;
101
     }
102
     }

+ 1
- 0
ios/sdk/src/ExternalAPI.h View File

30
 - (void)sendChatMessage:(NSString*)message :(NSString*)to ;
30
 - (void)sendChatMessage:(NSString*)message :(NSString*)to ;
31
 - (void)sendSetVideoMuted:(BOOL)muted;
31
 - (void)sendSetVideoMuted:(BOOL)muted;
32
 - (void)sendSetClosedCaptionsEnabled:(BOOL)enabled;
32
 - (void)sendSetClosedCaptionsEnabled:(BOOL)enabled;
33
+- (void)toggleCamera;
33
 
34
 
34
 @end
35
 @end

+ 9
- 2
ios/sdk/src/ExternalAPI.m View File

27
 static NSString * const sendChatMessageAction = @"org.jitsi.meet.SEND_CHAT_MESSAGE";
27
 static NSString * const sendChatMessageAction = @"org.jitsi.meet.SEND_CHAT_MESSAGE";
28
 static NSString * const setVideoMutedAction = @"org.jitsi.meet.SET_VIDEO_MUTED";
28
 static NSString * const setVideoMutedAction = @"org.jitsi.meet.SET_VIDEO_MUTED";
29
 static NSString * const setClosedCaptionsEnabledAction = @"org.jitsi.meet.SET_CLOSED_CAPTIONS_ENABLED";
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
 @implementation ExternalAPI
32
 @implementation ExternalAPI
32
 
33
 
50
         @"CLOSE_CHAT": closeChatAction,
51
         @"CLOSE_CHAT": closeChatAction,
51
         @"SEND_CHAT_MESSAGE": sendChatMessageAction,
52
         @"SEND_CHAT_MESSAGE": sendChatMessageAction,
52
         @"SET_VIDEO_MUTED" : setVideoMutedAction,
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
               closeChatAction,
77
               closeChatAction,
76
               sendChatMessageAction,
78
               sendChatMessageAction,
77
               setVideoMutedAction,
79
               setVideoMutedAction,
78
-              setClosedCaptionsEnabledAction
80
+              setClosedCaptionsEnabledAction,
81
+              toggleCameraAction
79
     ];
82
     ];
80
 }
83
 }
81
 
84
 
173
     [self sendEventWithName:setClosedCaptionsEnabledAction body:data];
176
     [self sendEventWithName:setClosedCaptionsEnabledAction body:data];
174
 }
177
 }
175
 
178
 
179
+- (void)toggleCamera {
180
+    [self sendEventWithName:toggleCameraAction body:nil];
181
+}
182
+
176
 @end
183
 @end

+ 1
- 0
ios/sdk/src/JitsiMeetView.h View File

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

+ 5
- 0
ios/sdk/src/JitsiMeetView.m View File

138
     [externalAPI sendSetClosedCaptionsEnabled:enabled];
138
     [externalAPI sendSetClosedCaptionsEnabled:enabled];
139
 }
139
 }
140
 
140
 
141
+- (void)toggleCamera {
142
+    ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI];
143
+    [externalAPI toggleCamera];
144
+}
145
+
141
 #pragma mark Private methods
146
 #pragma mark Private methods
142
 
147
 
143
 - (void)registerObservers {
148
 - (void)registerObservers {

+ 6
- 0
react/features/mobile/external-api/middleware.ts View File

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

Loading…
Cancel
Save