Index: webrtc/examples/objc/AppRTCMobile/RTCIceServer+JSON.m |
diff --git a/webrtc/examples/objc/AppRTCMobile/RTCIceServer+JSON.m b/webrtc/examples/objc/AppRTCMobile/RTCIceServer+JSON.m |
index 0bc31bb875923804fea96de1280d116498f161f3..912b521c48bf2aa09496919a7d77c37b48ade3e7 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 |