Check if external signaling server has a MCU.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2018-09-21 11:37:49 +02:00
Родитель ed09521b75
Коммит 6249fd6868
3 изменённых файлов: 17 добавлений и 4 удалений

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

@ -98,7 +98,9 @@ static NSString * const kNCVideoTrackKind = @"video";
[self startMonitoringMicrophoneAudioLevel];
if ([[NCExternalSignalingController sharedInstance] isEnabled]) {
_userSessionId = [[NCExternalSignalingController sharedInstance] sessionId];
if ([[NCExternalSignalingController sharedInstance] hasMCU]) {
[self createOwnPublishPeerConnection];
}
} else {
[_signalingController startPullingSignalingMessages];
}
@ -336,7 +338,7 @@ static NSString * const kNCVideoTrackKind = @"video";
peerConnectionWrapper = [[NCPeerConnection alloc] initWithSessionId:sessionId andICEServers:iceServers forAudioOnlyCall:_isAudioOnly];
peerConnectionWrapper.delegate = self;
// TODO: Try to get display name here
if (![[NCExternalSignalingController sharedInstance] isEnabled]) {
if (![[NCExternalSignalingController sharedInstance] hasMCU]) {
[peerConnectionWrapper.peerConnection addStream:_localStream];
}
@ -469,7 +471,7 @@ static NSString * const kNCVideoTrackKind = @"video";
for (NSString *sessionId in newSessions) {
if (![_connectionsDict objectForKey:sessionId]) {
if ([[NCExternalSignalingController sharedInstance] isEnabled]) {
if ([[NCExternalSignalingController sharedInstance] hasMCU]) {
NSLog(@"Requesting offer to the MCU");
[[NCExternalSignalingController sharedInstance] requestOfferForSessionId:sessionId andRoomType:@"video"];
} else {

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

@ -17,6 +17,7 @@ extern NSString * const NCESReceivedParticipantListMessageNotification;
+ (instancetype)sharedInstance;
- (BOOL)isEnabled;
- (BOOL)hasMCU;
- (NSString *)sessionId;
- (void)setServer:(NSString *)serverUrl andTicket:(NSString *)ticket;
- (void)joinRoom:(NSString *)roomId withSessionId:(NSString *)sessionId;

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

@ -50,6 +50,11 @@ NSString * const NCESReceivedParticipantListMessageNotification = @"NCESReceived
return (_serverUrl) ? YES : NO;
}
- (BOOL)hasMCU
{
return _mcuSupport;
}
- (NSString *)sessionId
{
return _sessionId;
@ -173,7 +178,12 @@ NSString * const NCESReceivedParticipantListMessageNotification = @"NCESReceived
- (void)helloResponseReceived:(NSDictionary *)helloDict
{
_resumeId = [helloDict objectForKey:@"resumeid"];
// Get server features
NSArray *serverFeatures = [[helloDict objectForKey:@"server"] objectForKey:@"features"];
for (NSString *feature in serverFeatures) {
if ([feature isEqualToString:@"mcu"]) {
_mcuSupport = YES;
}
}
}
- (void)errorResponseReceived:(NSDictionary *)errorDict