Update ice server provider response format in iOS AppRTCMobile
BUG=webrtc:5963
Review-Url: https://codereview.webrtc.org/2627523004
Cr-Commit-Position: refs/heads/master@{#16050}
diff --git a/webrtc/examples/objc/AppRTCMobile/RTCIceServer+JSON.m b/webrtc/examples/objc/AppRTCMobile/RTCIceServer+JSON.m
index 0bc31bb..912b521 100644
--- a/webrtc/examples/objc/AppRTCMobile/RTCIceServer+JSON.m
+++ b/webrtc/examples/objc/AppRTCMobile/RTCIceServer+JSON.m
@@ -10,34 +10,15 @@
#import "RTCIceServer+JSON.h"
-static NSString const *kRTCICEServerUsernameKey = @"username";
-static NSString const *kRTCICEServerPasswordKey = @"password";
-static NSString const *kRTCICEServerUrisKey = @"uris";
-static NSString const *kRTCICEServerUrlKey = @"urls";
-static NSString const *kRTCICEServerCredentialKey = @"credential";
-
@implementation RTCIceServer (JSON)
+ (RTCIceServer *)serverFromJSONDictionary:(NSDictionary *)dictionary {
- NSString *url = dictionary[kRTCICEServerUrlKey];
- NSString *username = dictionary[kRTCICEServerUsernameKey];
- NSString *credential = dictionary[kRTCICEServerCredentialKey];
- username = username ? username : @"";
- credential = credential ? credential : @"";
- return [[RTCIceServer alloc] initWithURLStrings:@[url]
+ NSArray *turnUrls = dictionary[@"urls"];
+ NSString *username = dictionary[@"username"] ?: @"";
+ NSString *credential = dictionary[@"credential"] ?: @"";
+ return [[RTCIceServer alloc] initWithURLStrings:turnUrls
username:username
credential:credential];
}
-+ (RTCIceServer *)serverFromCEODJSONDictionary:(NSDictionary *)dictionary {
- NSString *username = dictionary[kRTCICEServerUsernameKey];
- NSString *password = dictionary[kRTCICEServerPasswordKey];
- NSArray *uris = dictionary[kRTCICEServerUrisKey];
- RTCIceServer *server =
- [[RTCIceServer alloc] initWithURLStrings:uris
- username:username
- credential:password];
- return server;
-}
-
@end