Skip to content

Commit

Permalink
review remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Calinteodor committed Feb 13, 2025
1 parent c620eee commit b334a0a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,34 @@ public static Intent buildHideNotificationIntent(String uid) {
return intent;
}

public enum RecordingMode {
FILE("file"),
STREAM("stream"),

private final String mode;

RecordingMode(String mode) {
this.mode = mode;
}

public String getMode() {
return mode;
}
}

public static Intent buildStartRecordingIntent(
String mode,
RecordingMode mode,
String dropboxToken,
boolean onlySelf,
boolean shouldShare,
String rtmpStreamKey,
String rtmpBroadcastID,
String youtubeStreamKey,
String youtubeBroadcastID,
String extraMetadata,
Bundle extraMetadata,
boolean transcription) {
Intent intent = new Intent(BroadcastAction.Type.START_RECORDING.getAction());
intent.putExtra("mode", mode);
intent.putExtra("dropboxToken", dropboxToken);
intent.putExtra("onlySelf", onlySelf);
intent.putExtra("shouldShare", shouldShare);
intent.putExtra("rtmpStreamKey", rtmpStreamKey);
intent.putExtra("rtmpBroadcastID", rtmpBroadcastID);
Expand All @@ -123,7 +136,7 @@ public static Intent buildStartRecordingIntent(
return intent;
}

public static Intent buildStopRecordingIntent(String mode, boolean transcription) {
public static Intent buildStopRecordingIntent(RecordingMode mode, boolean transcription) {
Intent intent = new Intent(BroadcastAction.Type.STOP_RECORDING.getAction());
intent.putExtra("mode", mode);
intent.putExtra("transcription", transcription);
Expand Down
9 changes: 7 additions & 2 deletions ios/sdk/src/ExternalAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ static NSString * const sendEventNotificationName = @"org.jitsi.meet.SendEvent";

@interface ExternalAPI : RCTEventEmitter<RCTBridgeModule>

typedef NS_ENUM(NSInteger, RecordingMode) {
FILE,
STREAM
};

- (void)sendHangUp;
- (void)sendSetAudioMuted:(BOOL)muted;
- (void)sendEndpointTextMessage:(NSString*)message :(NSString*)to;
Expand All @@ -33,7 +38,7 @@ static NSString * const sendEventNotificationName = @"org.jitsi.meet.SendEvent";
- (void)toggleCamera;
- (void)showNotification:(NSString*)appearance :(NSString*)description :(NSString*)timeout :(NSString*)title :(NSString*)uid;
- (void)hideNotification:(NSString*)uid;
- (void)startRecording: (NSString*)mode : (NSString*)dropboxToken : (BOOL)onlySelf : (BOOL)shouldShare : (NSString*)rtmpStreamKey : (NSString*)rtmpBroadcastID : (NSString*)youtubeStreamKey : (NSString*)youtubeBroadcastID : (NSString*)extraMetadata : (BOOL)transcription;
- (void)stopRecording: (NSString*)mode : (BOOL)transcription;
- (void)startRecording:(RecordingMode)mode :(NSString*)dropboxToken :(BOOL)shouldShare :(NSString*)rtmpStreamKey :(NSString*)rtmpBroadcastID :(NSString*)youtubeStreamKey :(NSString*)youtubeBroadcastID :(NSDictionary*)extraMetadata :(BOOL)transcription;
- (void)stopRecording:(RecordingMode)mode :(BOOL)transcription;

@end
55 changes: 37 additions & 18 deletions ios/sdk/src/ExternalAPI.m
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ - (void)toggleCamera {
[self sendEventWithName:toggleCameraAction body:nil];
}

- (void)showNotification:(NSString *)appearance :(NSString *)description :(NSString *)timeout :(NSString *)title :(NSString *)uid {
- (void)showNotification:(NSString*)appearance :(NSString*)description :(NSString*)timeout :(NSString*)title :(NSString*)uid {
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
data[@"appearance"] = appearance;
data[@"description"] = description;
Expand All @@ -203,33 +203,52 @@ - (void)showNotification:(NSString *)appearance :(NSString *)description :(NSStr
[self sendEventWithName:showNotificationAction body:data];
}

- (void)hideNotification:(NSString *)uid {
- (void)hideNotification:(NSString*)uid {
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
data[@"uid"] = uid;

[self sendEventWithName:hideNotificationAction body:data];
}

- (void)startRecording: (NSString*)mode : (NSString*)dropboxToken : (BOOL)onlySelf : (BOOL)shouldShare : (NSString*)rtmpStreamKey : (NSString*)rtmpBroadcastID : (NSString*)youtubeStreamKey : (NSString*)youtubeBroadcastID : (NSString*)extraMetadata : (BOOL)transcription {
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
data[@"mode"] = mode;
data[@"dropboxToken"] = dropboxToken;
data[@"onlySelf"] = [NSNumber numberWithBool:onlySelf];
data[@"shouldShare"] = [NSNumber numberWithBool:shouldShare];
data[@"rtmpStreamKey"] = rtmpStreamKey;
data[@"rtmpBroadcastID"] = rtmpBroadcastID;
data[@"youtubeStreamKey"] = youtubeStreamKey;
data[@"youtubeBroadcastID"] = youtubeBroadcastID;
data[@"extraMetadata"] = extraMetadata;
data[@"transcription"] = [NSNumber numberWithBool:transcription];
typedef NS_ENUM(NSInteger, RecordingMode) {
FILE,
STREAM
}

static inline NSString *RecordingModeToString(RecordingMode mode) {
switch (mode) {
case FILE:
return @"file";
case STREAM:
return @"stream";
default:
return nil;
}
}

- (void)startRecording: (RecordingMode)mode :(NSString*)dropboxToken :(BOOL)shouldShare :(NSString*)rtmpStreamKey :(NSString*)rtmpBroadcastID :(NSString*)youtubeStreamKey :(NSString*)youtubeBroadcastID :(NSDictionary*)extraMetadata :(BOOL)transcription {
NSString *modeString = RecordingModeToString(mode);
NSMutableDictionary *data = @{
@"mode": modeString,
@"dropboxToken": dropboxToken,
@"shouldShare": @(shouldShare),
@"rtmpStreamKey": rtmpStreamKey,
@"rtmpBroadcastID": rtmpBroadcastID,
@"youtubeStreamKey": youtubeStreamKey,
@"youtubeBroadcastID": youtubeBroadcastID,
@"extraMetadata": extraMetadata,
@"transcription": @(transcription)
};

[self sendEventWithName:startRecordingAction body:data];
}

- (void)stopRecording: (NSString*)mode : (BOOL)transcription {
NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
data[@"mode"] = mode;
data[@"transcription"] = [NSNumber numberWithBool:transcription];
- (void)stopRecording: (RecordingMode)mode :(BOOL)transcription {
NSString *modeString = RecordingModeToString(mode);
NSMutableDictionary *data = @{
@"mode": modeString,
@"transcription": @(transcription)
};

[self sendEventWithName:stopRecordingAction body:data];
}
Expand Down
22 changes: 1 addition & 21 deletions react/features/mobile/external-api/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ import { closeChat, openChat, sendMessage, setPrivateMessageRecipient } from '..
import { isEnabled as isDropboxEnabled } from '../../dropbox/functions.native';
import { hideNotification, showNotification } from '../../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE, NOTIFICATION_TYPE } from '../../notifications/constants';
import { startLocalVideoRecording, stopLocalVideoRecording } from '../../recording/actions.native';
import { RECORDING_METADATA_ID, RECORDING_TYPES } from '../../recording/constants';
import { getActiveSession, supportsLocalRecording } from '../../recording/functions';
import { getActiveSession } from '../../recording/functions';
import { toggleScreenshotCaptureSummary } from '../../screenshot-capture/actions';
import { isScreenshotCaptureEnabled } from '../../screenshot-capture/functions';
import { setRequestingSubtitles } from '../../subtitles/actions.any';
Expand Down Expand Up @@ -460,7 +459,6 @@ function _registerForNativeEvents(store: IStore) {
{
mode,
dropboxToken,
onlySelf,
shouldShare,
rtmpStreamKey,
rtmpBroadcastID,
Expand Down Expand Up @@ -490,18 +488,6 @@ function _registerForNativeEvents(store: IStore) {
return;
}

if (mode === 'local') {
const { localRecording } = state['features/base/config'];

if (!localRecording?.disable && supportsLocalRecording()) {
store.dispatch(startLocalVideoRecording(onlySelf));
} else {
logger.error('Failed starting recording: local recording is either disabled or not supported');
}

return;
}

let recordingConfig;

if (mode === JitsiRecordingConstants.mode.FILE) {
Expand Down Expand Up @@ -579,12 +565,6 @@ function _registerForNativeEvents(store: IStore) {
});
}

if (mode === 'local') {
store.dispatch(stopLocalVideoRecording());

return;
}

if (![ JitsiRecordingConstants.mode.FILE, JitsiRecordingConstants.mode.STREAM ].includes(mode)) {
logger.error('Invalid recording mode provided!');

Expand Down

0 comments on commit b334a0a

Please sign in to comment.