Process recording signaling messages

Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
This commit is contained in:
Marcel Müller 2022-11-30 13:25:45 +01:00 коммит произвёл Ivan Sein
Родитель 69de6c9813
Коммит f3d34db30d
6 изменённых файлов: 59 добавлений и 2 удалений

Просмотреть файл

@ -1473,6 +1473,11 @@ typedef NS_ENUM(NSInteger, CallState) {
});
}
- (void)callControllerDidChangeRecording:(NCCallController *)callController
{
[self adjustButtons];
}
#pragma mark - Screensharing
- (void)showScreenOfPeerId:(NSString *)peerId

Просмотреть файл

@ -51,6 +51,7 @@
- (void)callController:(NCCallController *)callController didReceiveForceMuteActionForPeerId:(NSString *)peerId;
- (void)callControllerIsReconnectingCall:(NCCallController *)callController;
- (void)callControllerWantsToHangUpCall:(NCCallController *)callController;
- (void)callControllerDidChangeRecording:(NCCallController *)callController;
@end

Просмотреть файл

@ -867,6 +867,14 @@ static NSString * const kNCVideoTrackKind = @"video";
}
break;
}
case kNCSignalingMessageTypeRecording:
{
NCRecordingMessage *recordingMessage = (NCRecordingMessage *)signalingMessage;
self->_room.callRecording = recordingMessage.enabled;
[self.delegate callControllerDidChangeRecording:self];
break;
}
case kNCSignalingMessageTypeUnknown:
NSLog(@"Received an unknown signaling message: %@", signalingMessage);
break;

Просмотреть файл

@ -489,6 +489,8 @@ static NSTimeInterval kWebSocketTimeoutInterval = 15;
NSString *messageType = [[messageDict objectForKey:@"data"] objectForKey:@"type"];
if ([messageType isEqualToString:@"chat"]) {
NSLog(@"Chat message received.");
} else if ([messageType isEqualToString:@"recording"]) {
[self.delegate externalSignalingController:self didReceivedSignalingMessage:messageDict];
} else {
NSLog(@"Unknown room message type: %@", messageDict);
}

Просмотреть файл

@ -38,7 +38,8 @@ typedef enum {
kNCSignalingMessageTypeMute,
kNCSignalingMessageTypeUnmute,
kNCSignalingMessageTypeNickChanged,
kNCSignalingMessageTypeRaiseHand
kNCSignalingMessageTypeRaiseHand,
kNCSignalingMessageTypeRecording
} NCSignalingMessageType;
@ -130,3 +131,11 @@ typedef enum {
- (instancetype)initWithValues:(NSDictionary *)values;
@end
@interface NCRecordingMessage : NCSignalingMessage
@property(nonatomic, readonly) NSInteger enabled;
- (instancetype)initWithValues:(NSDictionary *)values;
@end

Просмотреть файл

@ -48,6 +48,7 @@ static NSString * const kNCSignalingMessageActionKey = @"action";
static NSString * const kNCSignalingMessagePayloadKey = @"payload";
static NSString * const kNCSignalingMessageRoomTypeKey = @"roomType";
static NSString * const kNCSignalingMessageNickKey = @"nick";
static NSString * const kNCSignalingMessageEnabledKey = @"enabled";
static NSString * const kNCSignalingMessageTypeOfferKey = @"offer";
static NSString * const kNCSignalingMessageTypeAnswerKey = @"answer";
@ -60,6 +61,7 @@ static NSString * const kNCSignalingMessageTypeMuteKey = @"mute";
static NSString * const kNCSignalingMessageTypeUnmuteKey = @"unmute";
static NSString * const kNCSignalingMessageTypeNickChangedKey = @"nickChanged";
static NSString * const kNCSignalingMessageTypeRaiseHandKey = @"raiseHand";
static NSString * const kNCSignalingMessageTypeRecordingKey = @"recording";
static NSString * const kNCSignalingMessageSdpKey = @"sdp";
@ -149,6 +151,8 @@ NSString *const kRoomTypeScreen = @"screen";
return [[NCNickChangedMessage alloc] initWithValues:jsonDict];
} else if ([dataType isEqualToString:kNCSignalingMessageTypeRaiseHandKey]) {
return [[NCRaiseHandMessage alloc] initWithValues:jsonDict];
} else if ([dataType isEqualToString:kNCSignalingMessageTypeRecordingKey]) {
return [[NCRecordingMessage alloc] initWithValues:jsonDict];
}
NSString *dataAction = [data objectForKey:kNCSignalingMessageActionKey];
@ -290,7 +294,7 @@ NSString *const kRoomTypeScreen = @"screen";
}
_candidate = candidate;
return self;
}
@ -642,3 +646,31 @@ NSString *const kRoomTypeScreen = @"screen";
}
@end
@implementation NCRecordingMessage
@synthesize enabled = _enabled;
- (instancetype)initWithValues:(NSDictionary *)values {
NSDictionary *valuesDict = [[NSDictionary alloc] initWithDictionary:values];
NSDictionary *dataDict = [valuesDict objectForKey:kNCExternalSignalingMessageDataKey];
NSDictionary *recordingDict = [dataDict objectForKey:kNCSignalingMessageTypeRecordingKey];
self = [super initWithFrom:nil
to:nil
sid:nil
type:kNCSignalingMessageTypeRecordingKey
payload:recordingDict
roomType:nil];
if (self) {
_enabled = [[recordingDict objectForKey:kNCSignalingMessageEnabledKey] integerValue];
}
return self;
}
- (NCSignalingMessageType)messageType {
return kNCSignalingMessageTypeRecording;
}
@end