diff options
author | henrike@webrtc.org <henrike@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-06-03 22:46:23 +0000 |
---|---|---|
committer | henrike@webrtc.org <henrike@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-06-03 22:46:23 +0000 |
commit | 27abd577db99205e98c9d7449f849db7b37b06b4 (patch) | |
tree | 0fa5b16c3cb580c98fe2b995db0e2ac93ed11c04 /examples | |
parent | 8c1588b3a81b9074fcb98589dccee721cb63f98e (diff) | |
download | talk-27abd577db99205e98c9d7449f849db7b37b06b4.tar.gz |
talk/ios: Fixes source after corrupt sync in r6305 (which corrupted r6291).
BUG=N/A
R=tkchin@webrtc.org
TBR=tkchin@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/21589004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@6318 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'examples')
17 files changed, 0 insertions, 2400 deletions
diff --git a/examples/ios/AppRTCDemo/APPRTCAppClient.h b/examples/ios/AppRTCDemo/APPRTCAppClient.h deleted file mode 100755 index 41a795e..0000000 --- a/examples/ios/AppRTCDemo/APPRTCAppClient.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <Foundation/Foundation.h> - -#import "GAEChannelClient.h" - -// Called when there are RTCICEServers. -@protocol ICEServerDelegate<NSObject> - -- (void)onICEServers:(NSArray*)servers; - -@end - -@class RTCMediaConstraints; - -// Negotiates signaling for chatting with apprtc.appspot.com "rooms". -// Uses the client<->server specifics of the apprtc AppEngine webapp. -// -// To use: create an instance of this object (registering a message handler) and -// call connectToRoom(). apprtc.appspot.com will signal that is successful via -// onOpen through the browser channel. Then you should call sendData() and wait -// for the registered handler to be called with received messages. -@interface APPRTCAppClient : NSObject<NSURLConnectionDataDelegate> - -@property(nonatomic, weak, readonly) id<ICEServerDelegate> ICEServerDelegate; -@property(nonatomic, weak, readonly) id<GAEMessageHandler> messageHandler; -@property(nonatomic, assign) BOOL initiator; -@property(nonatomic, copy, readonly) RTCMediaConstraints* videoConstraints; - -- (id)initWithICEServerDelegate:(id<ICEServerDelegate>)delegate - messageHandler:(id<GAEMessageHandler>)handler; -- (void)connectToRoom:(NSURL*)room; -- (void)sendData:(NSData*)data; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Disallow init and don't add to documentation -- (id)init __attribute__(( - unavailable("init is not a supported initializer for this class."))); -#endif /* DOXYGEN_SHOULD_SKIP_THIS */ - -@end diff --git a/examples/ios/AppRTCDemo/APPRTCAppClient.m b/examples/ios/AppRTCDemo/APPRTCAppClient.m deleted file mode 100755 index 9ef0a7a..0000000 --- a/examples/ios/AppRTCDemo/APPRTCAppClient.m +++ /dev/null @@ -1,348 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "APPRTCAppClient.h" - -#import <dispatch/dispatch.h> - -#import "GAEChannelClient.h" -#import "RTCICEServer.h" -#import "APPRTCAppDelegate.h" -#import "RTCMediaConstraints.h" - -@interface APPRTCAppClient () - -@property(nonatomic, strong) dispatch_queue_t backgroundQueue; -@property(nonatomic, copy) NSString* baseURL; -@property(nonatomic, strong) GAEChannelClient* gaeChannel; -@property(nonatomic, copy) NSString* postMessageUrl; -@property(nonatomic, copy) NSString* pcConfig; -@property(nonatomic, strong) NSMutableString* roomHtml; -@property(atomic, strong) NSMutableArray* sendQueue; -@property(nonatomic, copy) NSString* token; - -@property(nonatomic, assign) BOOL verboseLogging; - -@end - -@implementation APPRTCAppClient - -- (id)initWithICEServerDelegate:(id<ICEServerDelegate>)delegate - messageHandler:(id<GAEMessageHandler>)handler { - if (self = [super init]) { - _ICEServerDelegate = delegate; - _messageHandler = handler; - _backgroundQueue = dispatch_queue_create("RTCBackgroundQueue", - DISPATCH_QUEUE_SERIAL); - _sendQueue = [NSMutableArray array]; - // Uncomment to see Request/Response logging. - // _verboseLogging = YES; - } - return self; -} - -#pragma mark - Public methods - -- (void)connectToRoom:(NSURL*)url { - NSURLRequest* request = [self getRequestFromUrl:url]; - [NSURLConnection connectionWithRequest:request delegate:self]; -} - -- (void)sendData:(NSData*)data { - [self maybeLogMessage:@"Send message"]; - - dispatch_async(self.backgroundQueue, ^{ - [self.sendQueue addObject:[data copy]]; - - if ([self.postMessageUrl length] < 1) { - return; - } - for (NSData* data in self.sendQueue) { - NSString* url = - [NSString stringWithFormat:@"%@/%@", - self.baseURL, self.postMessageUrl]; - [self sendData:data withUrl:url]; - } - [self.sendQueue removeAllObjects]; - }); -} - -#pragma mark - Internal methods - -- (NSString*)findVar:(NSString*)name strippingQuotes:(BOOL)strippingQuotes { - NSError* error; - NSString* pattern = - [NSString stringWithFormat:@".*\n *var %@ = ([^\n]*);\n.*", name]; - NSRegularExpression* regexp = - [NSRegularExpression regularExpressionWithPattern:pattern - options:0 - error:&error]; - NSAssert(!error, - @"Unexpected error compiling regex: ", - error.localizedDescription); - - NSRange fullRange = NSMakeRange(0, [self.roomHtml length]); - NSArray* matches = - [regexp matchesInString:self.roomHtml options:0 range:fullRange]; - if ([matches count] != 1) { - [self showMessage:[NSString stringWithFormat:@"%d matches for %@ in %@", - [matches count], - name, - self.roomHtml]]; - return nil; - } - NSRange matchRange = [matches[0] rangeAtIndex:1]; - NSString* value = [self.roomHtml substringWithRange:matchRange]; - if (strippingQuotes) { - NSAssert([value length] > 2, - @"Can't strip quotes from short string: [%@]", - value); - NSAssert(([value characterAtIndex:0] == '\'' && - [value characterAtIndex:[value length] - 1] == '\''), - @"Can't strip quotes from unquoted string: [%@]", - value); - value = [value substringWithRange:NSMakeRange(1, [value length] - 2)]; - } - return value; -} - -- (NSURLRequest*)getRequestFromUrl:(NSURL*)url { - self.roomHtml = [NSMutableString stringWithCapacity:20000]; - NSString* path = - [NSString stringWithFormat:@"https:%@", [url resourceSpecifier]]; - NSURLRequest* request = - [NSURLRequest requestWithURL:[NSURL URLWithString:path]]; - return request; -} - -- (void)maybeLogMessage:(NSString*)message { - if (self.verboseLogging) { - NSLog(@"%@", message); - } -} - -- (void)sendData:(NSData*)data withUrl:(NSString*)url { - NSMutableURLRequest* request = - [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; - request.HTTPMethod = @"POST"; - [request setHTTPBody:data]; - NSURLResponse* response; - NSError* error; - NSData* responseData = [NSURLConnection sendSynchronousRequest:request - returningResponse:&response - error:&error]; - NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response; - int status = [httpResponse statusCode]; - NSAssert(status == 200, - @"Bad response [%d] to message: %@\n\n%@", - status, - [NSString stringWithUTF8String:[data bytes]], - [NSString stringWithUTF8String:[responseData bytes]]); -} - -- (void)showMessage:(NSString*)message { - NSLog(@"%@", message); - UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Unable to join" - message:message - delegate:nil - cancelButtonTitle:@"OK" - otherButtonTitles:nil]; - [alertView show]; -} - -- (void)updateICEServers:(NSMutableArray*)ICEServers - withTurnServer:(NSString*)turnServerUrl { - if ([turnServerUrl length] < 1) { - [self.ICEServerDelegate onICEServers:ICEServers]; - return; - } - dispatch_async(self.backgroundQueue, ^(void) { - NSMutableURLRequest* request = [NSMutableURLRequest - requestWithURL:[NSURL URLWithString:turnServerUrl]]; - [request addValue:@"Mozilla/5.0" forHTTPHeaderField:@"user-agent"]; - [request addValue:@"https://apprtc.appspot.com" - forHTTPHeaderField:@"origin"]; - NSURLResponse* response; - NSError* error; - NSData* responseData = [NSURLConnection sendSynchronousRequest:request - returningResponse:&response - error:&error]; - if (!error) { - NSDictionary* json = - [NSJSONSerialization JSONObjectWithData:responseData - options:0 - error:&error]; - NSAssert(!error, @"Unable to parse. %@", error.localizedDescription); - NSString* username = json[@"username"]; - NSString* password = json[@"password"]; - NSArray* uris = json[@"uris"]; - for (int i = 0; i < [uris count]; ++i) { - NSString* turnServer = [uris objectAtIndex:i]; - RTCICEServer* ICEServer = - [[RTCICEServer alloc] initWithURI:[NSURL URLWithString:turnServer] - username:username - password:password]; - NSLog(@"Added ICE Server: %@", ICEServer); - [ICEServers addObject:ICEServer]; - } - } else { - NSLog(@"Unable to get TURN server. Error: %@", error.description); - } - - dispatch_async(dispatch_get_main_queue(), ^(void) { - [self.ICEServerDelegate onICEServers:ICEServers]; - }); - }); -} - -#pragma mark - NSURLConnectionDataDelegate methods - -- (void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)data { - NSString* roomHtml = [NSString stringWithUTF8String:[data bytes]]; - [self maybeLogMessage:[NSString stringWithFormat:@"Received %d chars", - [roomHtml length]]]; - [self.roomHtml appendString:roomHtml]; -} - -- (void)connection:(NSURLConnection*)connection - didReceiveResponse:(NSURLResponse*)response { - NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response; - int statusCode = [httpResponse statusCode]; - [self - maybeLogMessage: - [NSString stringWithFormat: - @"Response received\nURL\n%@\nStatus [%d]\nHeaders\n%@", - [httpResponse URL], - statusCode, - [httpResponse allHeaderFields]]]; - NSAssert(statusCode == 200, @"Invalid response of %d received.", statusCode); -} - -- (void)connectionDidFinishLoading:(NSURLConnection*)connection { - [self maybeLogMessage:[NSString stringWithFormat:@"finished loading %d chars", - [self.roomHtml length]]]; - NSRegularExpression* fullRegex = - [NSRegularExpression regularExpressionWithPattern:@"room is full" - options:0 - error:nil]; - if ([fullRegex - numberOfMatchesInString:self.roomHtml - options:0 - range:NSMakeRange(0, [self.roomHtml length])]) { - [self showMessage:@"Room full"]; - APPRTCAppDelegate* ad = - (APPRTCAppDelegate*)[[UIApplication sharedApplication] delegate]; - [ad closeVideoUI]; - return; - } - - NSString* fullUrl = [[[connection originalRequest] URL] absoluteString]; - NSRange queryRange = [fullUrl rangeOfString:@"?"]; - self.baseURL = [fullUrl substringToIndex:queryRange.location]; - [self maybeLogMessage:[NSString - stringWithFormat:@"Base URL: %@", self.baseURL]]; - - self.initiator = [[self findVar:@"initiator" strippingQuotes:NO] boolValue]; - self.token = [self findVar:@"channelToken" strippingQuotes:YES]; - if (!self.token) - return; - [self maybeLogMessage:[NSString stringWithFormat:@"Token: %@", self.token]]; - - NSString* roomKey = [self findVar:@"roomKey" strippingQuotes:YES]; - NSString* me = [self findVar:@"me" strippingQuotes:YES]; - if (!roomKey || !me) - return; - self.postMessageUrl = - [NSString stringWithFormat:@"/message?r=%@&u=%@", roomKey, me]; - [self maybeLogMessage:[NSString stringWithFormat:@"POST message URL: %@", - self.postMessageUrl]]; - - NSString* pcConfig = [self findVar:@"pcConfig" strippingQuotes:NO]; - if (!pcConfig) - return; - [self maybeLogMessage:[NSString - stringWithFormat:@"PC Config JSON: %@", pcConfig]]; - - NSString* turnServerUrl = [self findVar:@"turnUrl" strippingQuotes:YES]; - if (turnServerUrl) { - [self maybeLogMessage:[NSString - stringWithFormat:@"TURN server request URL: %@", - turnServerUrl]]; - } - - NSError* error; - NSData* pcData = [pcConfig dataUsingEncoding:NSUTF8StringEncoding]; - NSDictionary* json = - [NSJSONSerialization JSONObjectWithData:pcData options:0 error:&error]; - NSAssert(!error, @"Unable to parse. %@", error.localizedDescription); - NSArray* servers = [json objectForKey:@"iceServers"]; - NSMutableArray* ICEServers = [NSMutableArray array]; - for (NSDictionary* server in servers) { - NSString* url = [server objectForKey:@"urls"]; - NSString* username = json[@"username"]; - NSString* credential = [server objectForKey:@"credential"]; - if (!username) { - username = @""; - } - if (!credential) { - credential = @""; - } - [self maybeLogMessage:[NSString - stringWithFormat:@"url [%@] - credential [%@]", - url, - credential]]; - RTCICEServer* ICEServer = - [[RTCICEServer alloc] initWithURI:[NSURL URLWithString:url] - username:username - password:credential]; - NSLog(@"Added ICE Server: %@", ICEServer); - [ICEServers addObject:ICEServer]; - } - [self updateICEServers:ICEServers withTurnServer:turnServerUrl]; - - NSString* mc = [self findVar:@"mediaConstraints" strippingQuotes:NO]; - if (mc) { - error = nil; - NSData* mcData = [mc dataUsingEncoding:NSUTF8StringEncoding]; - json = - [NSJSONSerialization JSONObjectWithData:mcData options:0 error:&error]; - NSAssert(!error, @"Unable to parse. %@", error.localizedDescription); - if ([[json objectForKey:@"video"] boolValue]) { - _videoConstraints = [[RTCMediaConstraints alloc] init]; - } - } - - [self - maybeLogMessage:[NSString - stringWithFormat:@"About to open GAE with token: %@", - self.token]]; - self.gaeChannel = - [[GAEChannelClient alloc] initWithToken:self.token - delegate:self.messageHandler]; -} - -@end diff --git a/examples/ios/AppRTCDemo/APPRTCAppDelegate.h b/examples/ios/AppRTCDemo/APPRTCAppDelegate.h deleted file mode 100755 index dd810f7..0000000 --- a/examples/ios/AppRTCDemo/APPRTCAppDelegate.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <UIKit/UIKit.h> - -#import "GAEChannelClient.h" -#import "APPRTCAppClient.h" -#import "RTCSessionDescriptionDelegate.h" -#import "RTCVideoSource.h" -// Used to send a message to an apprtc.appspot.com "room". -@protocol APPRTCSendMessage<NSObject> - -- (void)sendData:(NSData*)data; -// Logging helper. -- (void)displayLogMessage:(NSString*)message; -@end - -@class APPRTCViewController; -@class RTCVideoTrack; - -// The main application class of the AppRTCDemo iOS app demonstrating -// interoperability between the Objective C implementation of PeerConnection -// and the apprtc.appspot.com demo webapp. -@interface APPRTCAppDelegate : UIResponder<ICEServerDelegate, - GAEMessageHandler, - APPRTCSendMessage, - RTCSessionDescriptionDelegate, - UIApplicationDelegate> - -@property(strong, nonatomic) UIWindow* window; -@property(strong, nonatomic) APPRTCViewController* viewController; -@property (strong, nonatomic) RTCVideoSource* videoSource; - -- (void)closeVideoUI; - -@end diff --git a/examples/ios/AppRTCDemo/APPRTCAppDelegate.m b/examples/ios/AppRTCDemo/APPRTCAppDelegate.m deleted file mode 100755 index 87d1f53..0000000 --- a/examples/ios/AppRTCDemo/APPRTCAppDelegate.m +++ /dev/null @@ -1,575 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <AVFoundation/AVFoundation.h> - -#import "APPRTCAppDelegate.h" - -#import "APPRTCViewController.h" -#import "RTCEAGLVideoView.h" -#import "RTCICECandidate.h" -#import "RTCICEServer.h" -#import "RTCMediaConstraints.h" -#import "RTCMediaStream.h" -#import "RTCPair.h" -#import "RTCPeerConnection.h" -#import "RTCPeerConnectionDelegate.h" -#import "RTCPeerConnectionFactory.h" -#import "RTCSessionDescription.h" -#import "RTCStatsDelegate.h" -#import "RTCVideoRenderer.h" -#import "RTCVideoCapturer.h" -#import "RTCVideoTrack.h" - -@interface PCObserver : NSObject<RTCPeerConnectionDelegate> - -- (id)initWithDelegate:(id<APPRTCSendMessage>)delegate; - -@property(nonatomic, strong) RTCEAGLVideoView* videoView; - -@end - -@implementation PCObserver { - id<APPRTCSendMessage> _delegate; -} - -- (id)initWithDelegate:(id<APPRTCSendMessage>)delegate { - if (self = [super init]) { - _delegate = delegate; - } - return self; -} - -#pragma mark - RTCPeerConnectionDelegate - -- (void)peerConnectionOnError:(RTCPeerConnection*)peerConnection { - dispatch_async(dispatch_get_main_queue(), ^(void) { - NSLog(@"PCO onError."); - NSAssert(NO, @"PeerConnection failed."); - }); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - signalingStateChanged:(RTCSignalingState)stateChanged { - dispatch_async(dispatch_get_main_queue(), ^(void) { - NSLog(@"PCO onSignalingStateChange: %d", stateChanged); - }); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - addedStream:(RTCMediaStream*)stream { - dispatch_async(dispatch_get_main_queue(), ^(void) { - NSLog(@"PCO onAddStream."); - NSAssert([stream.audioTracks count] <= 1, - @"Expected at most 1 audio stream"); - NSAssert([stream.videoTracks count] <= 1, - @"Expected at most 1 video stream"); - if ([stream.videoTracks count] != 0) { - self.videoView.videoTrack = stream.videoTracks[0]; - } - }); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - removedStream:(RTCMediaStream*)stream { - dispatch_async(dispatch_get_main_queue(), - ^(void) { NSLog(@"PCO onRemoveStream."); }); -} - -- (void)peerConnectionOnRenegotiationNeeded:(RTCPeerConnection*)peerConnection { - dispatch_async(dispatch_get_main_queue(), ^(void) { - NSLog(@"PCO onRenegotiationNeeded - ignoring because AppRTC has a " - "predefined negotiation strategy"); - }); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - gotICECandidate:(RTCICECandidate*)candidate { - dispatch_async(dispatch_get_main_queue(), ^(void) { - NSLog(@"PCO onICECandidate.\n Mid[%@] Index[%d] Sdp[%@]", - candidate.sdpMid, - candidate.sdpMLineIndex, - candidate.sdp); - NSDictionary* json = @{ - @"type" : @"candidate", - @"label" : [NSNumber numberWithInt:candidate.sdpMLineIndex], - @"id" : candidate.sdpMid, - @"candidate" : candidate.sdp - }; - NSError* error; - NSData* data = - [NSJSONSerialization dataWithJSONObject:json options:0 error:&error]; - if (!error) { - [_delegate sendData:data]; - } else { - NSAssert(NO, - @"Unable to serialize JSON object with error: %@", - error.localizedDescription); - } - }); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - iceGatheringChanged:(RTCICEGatheringState)newState { - dispatch_async(dispatch_get_main_queue(), - ^(void) { NSLog(@"PCO onIceGatheringChange. %d", newState); }); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - iceConnectionChanged:(RTCICEConnectionState)newState { - dispatch_async(dispatch_get_main_queue(), ^(void) { - NSLog(@"PCO onIceConnectionChange. %d", newState); - if (newState == RTCICEConnectionConnected) - [self displayLogMessage:@"ICE Connection Connected."]; - NSAssert(newState != RTCICEConnectionFailed, @"ICE Connection failed!"); - }); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - didOpenDataChannel:(RTCDataChannel*)dataChannel { - NSAssert(NO, @"AppRTC doesn't use DataChannels"); -} - -#pragma mark - Private - -- (void)displayLogMessage:(NSString*)message { - [_delegate displayLogMessage:message]; -} - -@end - -@interface APPRTCAppDelegate () <RTCStatsDelegate> - -@property(nonatomic, strong) APPRTCAppClient* client; -@property(nonatomic, strong) PCObserver* pcObserver; -@property(nonatomic, strong) RTCPeerConnection* peerConnection; -@property(nonatomic, strong) RTCPeerConnectionFactory* peerConnectionFactory; -@property(nonatomic, strong) NSMutableArray* queuedRemoteCandidates; - -@end - -@implementation APPRTCAppDelegate { - NSTimer* _statsTimer; -} - -#pragma mark - UIApplicationDelegate methods - -- (BOOL)application:(UIApplication*)application - didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { - [RTCPeerConnectionFactory initializeSSL]; - self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - self.viewController = - [[APPRTCViewController alloc] initWithNibName:@"APPRTCViewController" - bundle:nil]; - self.window.rootViewController = self.viewController; - _statsTimer = - [NSTimer scheduledTimerWithTimeInterval:10 - target:self - selector:@selector(didFireStatsTimer:) - userInfo:nil - repeats:YES]; - [self.window makeKeyAndVisible]; - return YES; -} - -- (void)applicationWillResignActive:(UIApplication*)application { - [self displayLogMessage:@"Application lost focus, connection broken."]; - [self closeVideoUI]; -} - -- (void)applicationDidEnterBackground:(UIApplication*)application { -} - -- (void)applicationWillEnterForeground:(UIApplication*)application { -} - -- (void)applicationDidBecomeActive:(UIApplication*)application { -} - -- (void)applicationWillTerminate:(UIApplication*)application { -} - -- (BOOL)application:(UIApplication*)application - openURL:(NSURL*)url - sourceApplication:(NSString*)sourceApplication - annotation:(id)annotation { - if (self.client) { - return NO; - } - self.client = [[APPRTCAppClient alloc] initWithICEServerDelegate:self - messageHandler:self]; - [self.client connectToRoom:url]; - return YES; -} - -- (void)displayLogMessage:(NSString*)message { - NSAssert([NSThread isMainThread], @"Called off main thread!"); - NSLog(@"%@", message); - [self.viewController displayText:message]; -} - -#pragma mark - RTCSendMessage method - -- (void)sendData:(NSData*)data { - [self.client sendData:data]; -} - -#pragma mark - ICEServerDelegate method - -- (void)onICEServers:(NSArray*)servers { - self.queuedRemoteCandidates = [NSMutableArray array]; - self.peerConnectionFactory = [[RTCPeerConnectionFactory alloc] init]; - RTCMediaConstraints* constraints = [[RTCMediaConstraints alloc] - initWithMandatoryConstraints: - @[ - [[RTCPair alloc] initWithKey:@"OfferToReceiveAudio" value:@"true"], - [[RTCPair alloc] initWithKey:@"OfferToReceiveVideo" value:@"true"] - ] - optionalConstraints: - @[ - [[RTCPair alloc] initWithKey:@"internalSctpDataChannels" - value:@"true"], - [[RTCPair alloc] initWithKey:@"DtlsSrtpKeyAgreement" - value:@"true"] - ]]; - self.pcObserver = [[PCObserver alloc] initWithDelegate:self]; - self.peerConnection = - [self.peerConnectionFactory peerConnectionWithICEServers:servers - constraints:constraints - delegate:self.pcObserver]; - RTCMediaStream* lms = - [self.peerConnectionFactory mediaStreamWithLabel:@"ARDAMS"]; - - // The iOS simulator doesn't provide any sort of camera capture - // support or emulation (http://goo.gl/rHAnC1) so don't bother - // trying to open a local stream. - RTCVideoTrack* localVideoTrack; -#if !TARGET_IPHONE_SIMULATOR - NSString* cameraID = nil; - for (AVCaptureDevice* captureDevice in - [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]) { - if (captureDevice.position == AVCaptureDevicePositionFront) { - cameraID = [captureDevice localizedName]; - break; - } - } - NSAssert(cameraID, @"Unable to get the front camera id"); - - RTCVideoCapturer* capturer = - [RTCVideoCapturer capturerWithDeviceName:cameraID]; - self.videoSource = [self.peerConnectionFactory - videoSourceWithCapturer:capturer - constraints:self.client.videoConstraints]; - localVideoTrack = - [self.peerConnectionFactory videoTrackWithID:@"ARDAMSv0" - source:self.videoSource]; - if (localVideoTrack) { - [lms addVideoTrack:localVideoTrack]; - } - self.viewController.localVideoView.videoTrack = localVideoTrack; -#else - self.viewController.localVideoView.hidden = YES; -#endif - - self.pcObserver.videoView = self.viewController.remoteVideoView; - [lms addAudioTrack:[self.peerConnectionFactory audioTrackWithID:@"ARDAMSa0"]]; - [self.peerConnection addStream:lms constraints:constraints]; - [self displayLogMessage:@"onICEServers - added local stream."]; -} - -#pragma mark - GAEMessageHandler methods - -- (void)onOpen { - if (!self.client.initiator) { - [self displayLogMessage:@"Callee; waiting for remote offer"]; - return; - } - [self displayLogMessage:@"GAE onOpen - create offer."]; - RTCPair* audio = - [[RTCPair alloc] initWithKey:@"OfferToReceiveAudio" value:@"true"]; - RTCPair* video = - [[RTCPair alloc] initWithKey:@"OfferToReceiveVideo" value:@"true"]; - NSArray* mandatory = @[ audio, video ]; - RTCMediaConstraints* constraints = - [[RTCMediaConstraints alloc] initWithMandatoryConstraints:mandatory - optionalConstraints:nil]; - [self.peerConnection createOfferWithDelegate:self constraints:constraints]; - [self displayLogMessage:@"PC - createOffer."]; -} - -- (void)onMessage:(NSDictionary*)messageData { - NSString* type = messageData[@"type"]; - NSAssert(type, @"Missing type: %@", messageData); - [self displayLogMessage:[NSString stringWithFormat:@"GAE onMessage type - %@", - type]]; - if ([type isEqualToString:@"candidate"]) { - NSString* mid = messageData[@"id"]; - NSNumber* sdpLineIndex = messageData[@"label"]; - NSString* sdp = messageData[@"candidate"]; - RTCICECandidate* candidate = - [[RTCICECandidate alloc] initWithMid:mid - index:sdpLineIndex.intValue - sdp:sdp]; - if (self.queuedRemoteCandidates) { - [self.queuedRemoteCandidates addObject:candidate]; - } else { - [self.peerConnection addICECandidate:candidate]; - } - } else if ([type isEqualToString:@"offer"] || - [type isEqualToString:@"answer"]) { - NSString* sdpString = messageData[@"sdp"]; - RTCSessionDescription* sdp = [[RTCSessionDescription alloc] - initWithType:type - sdp:[APPRTCAppDelegate preferISAC:sdpString]]; - [self.peerConnection setRemoteDescriptionWithDelegate:self - sessionDescription:sdp]; - [self displayLogMessage:@"PC - setRemoteDescription."]; - } else if ([type isEqualToString:@"bye"]) { - [self closeVideoUI]; - UIAlertView* alertView = - [[UIAlertView alloc] initWithTitle:@"Remote end hung up" - message:@"dropping PeerConnection" - delegate:nil - cancelButtonTitle:@"OK" - otherButtonTitles:nil]; - [alertView show]; - } else { - NSAssert(NO, @"Invalid message: %@", messageData); - } -} - -- (void)onClose { - [self displayLogMessage:@"GAE onClose."]; - [self closeVideoUI]; -} - -- (void)onError:(int)code withDescription:(NSString*)description { - [self displayLogMessage:[NSString stringWithFormat:@"GAE onError: %d, %@", - code, description]]; - [self closeVideoUI]; -} - -#pragma mark - RTCSessionDescriptionDelegate methods - -// Match |pattern| to |string| and return the first group of the first -// match, or nil if no match was found. -+ (NSString*)firstMatch:(NSRegularExpression*)pattern - withString:(NSString*)string { - NSTextCheckingResult* result = - [pattern firstMatchInString:string - options:0 - range:NSMakeRange(0, [string length])]; - if (!result) - return nil; - return [string substringWithRange:[result rangeAtIndex:1]]; -} - -// Mangle |origSDP| to prefer the ISAC/16k audio codec. -+ (NSString*)preferISAC:(NSString*)origSDP { - int mLineIndex = -1; - NSString* isac16kRtpMap = nil; - NSArray* lines = [origSDP componentsSeparatedByString:@"\n"]; - NSRegularExpression* isac16kRegex = [NSRegularExpression - regularExpressionWithPattern:@"^a=rtpmap:(\\d+) ISAC/16000[\r]?$" - options:0 - error:nil]; - for (int i = 0; - (i < [lines count]) && (mLineIndex == -1 || isac16kRtpMap == nil); - ++i) { - NSString* line = [lines objectAtIndex:i]; - if ([line hasPrefix:@"m=audio "]) { - mLineIndex = i; - continue; - } - isac16kRtpMap = [self firstMatch:isac16kRegex withString:line]; - } - if (mLineIndex == -1) { - NSLog(@"No m=audio line, so can't prefer iSAC"); - return origSDP; - } - if (isac16kRtpMap == nil) { - NSLog(@"No ISAC/16000 line, so can't prefer iSAC"); - return origSDP; - } - NSArray* origMLineParts = - [[lines objectAtIndex:mLineIndex] componentsSeparatedByString:@" "]; - NSMutableArray* newMLine = - [NSMutableArray arrayWithCapacity:[origMLineParts count]]; - int origPartIndex = 0; - // Format is: m=<media> <port> <proto> <fmt> ... - [newMLine addObject:[origMLineParts objectAtIndex:origPartIndex++]]; - [newMLine addObject:[origMLineParts objectAtIndex:origPartIndex++]]; - [newMLine addObject:[origMLineParts objectAtIndex:origPartIndex++]]; - [newMLine addObject:isac16kRtpMap]; - for (; origPartIndex < [origMLineParts count]; ++origPartIndex) { - if (![isac16kRtpMap - isEqualToString:[origMLineParts objectAtIndex:origPartIndex]]) { - [newMLine addObject:[origMLineParts objectAtIndex:origPartIndex]]; - } - } - NSMutableArray* newLines = [NSMutableArray arrayWithCapacity:[lines count]]; - [newLines addObjectsFromArray:lines]; - [newLines replaceObjectAtIndex:mLineIndex - withObject:[newMLine componentsJoinedByString:@" "]]; - return [newLines componentsJoinedByString:@"\n"]; -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - didCreateSessionDescription:(RTCSessionDescription*)origSdp - error:(NSError*)error { - dispatch_async(dispatch_get_main_queue(), ^(void) { - if (error) { - [self displayLogMessage:@"SDP onFailure."]; - NSAssert(NO, error.description); - return; - } - [self displayLogMessage:@"SDP onSuccess(SDP) - set local description."]; - RTCSessionDescription* sdp = [[RTCSessionDescription alloc] - initWithType:origSdp.type - sdp:[APPRTCAppDelegate preferISAC:origSdp.description]]; - [self.peerConnection setLocalDescriptionWithDelegate:self - sessionDescription:sdp]; - - [self displayLogMessage:@"PC setLocalDescription."]; - NSDictionary* json = @{@"type" : sdp.type, @"sdp" : sdp.description}; - NSError* error; - NSData* data = - [NSJSONSerialization dataWithJSONObject:json options:0 error:&error]; - NSAssert(!error, - @"%@", - [NSString stringWithFormat:@"Error: %@", error.description]); - [self sendData:data]; - }); -} - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - didSetSessionDescriptionWithError:(NSError*)error { - dispatch_async(dispatch_get_main_queue(), ^(void) { - if (error) { - [self displayLogMessage:@"SDP onFailure."]; - NSAssert(NO, error.description); - return; - } - - [self displayLogMessage:@"SDP onSuccess() - possibly drain candidates"]; - if (!self.client.initiator) { - if (self.peerConnection.remoteDescription && - !self.peerConnection.localDescription) { - [self displayLogMessage:@"Callee, setRemoteDescription succeeded"]; - RTCPair* audio = [[RTCPair alloc] initWithKey:@"OfferToReceiveAudio" - value:@"true"]; - RTCPair* video = [[RTCPair alloc] initWithKey:@"OfferToReceiveVideo" - value:@"true"]; - NSArray* mandatory = @[ audio, video ]; - RTCMediaConstraints* constraints = [[RTCMediaConstraints alloc] - initWithMandatoryConstraints:mandatory - optionalConstraints:nil]; - [self.peerConnection createAnswerWithDelegate:self - constraints:constraints]; - [self displayLogMessage:@"PC - createAnswer."]; - } else { - [self displayLogMessage:@"SDP onSuccess - drain candidates"]; - [self drainRemoteCandidates]; - } - } else { - if (self.peerConnection.remoteDescription) { - [self displayLogMessage:@"SDP onSuccess - drain candidates"]; - [self drainRemoteCandidates]; - } - } - }); -} - -#pragma mark - RTCStatsDelegate methods - -- (void)peerConnection:(RTCPeerConnection*)peerConnection - didGetStats:(NSArray*)stats { - dispatch_async(dispatch_get_main_queue(), ^{ - NSString* message = [NSString stringWithFormat:@"Stats:\n %@", stats]; - [self displayLogMessage:message]; - }); -} - -#pragma mark - internal methods - -- (void)disconnect { - [self.client - sendData:[@"{\"type\": \"bye\"}" dataUsingEncoding:NSUTF8StringEncoding]]; - [self.peerConnection close]; - self.peerConnection = nil; - self.pcObserver = nil; - self.client = nil; - self.videoSource = nil; - self.peerConnectionFactory = nil; - [RTCPeerConnectionFactory deinitializeSSL]; -} - -- (void)drainRemoteCandidates { - for (RTCICECandidate* candidate in self.queuedRemoteCandidates) { - [self.peerConnection addICECandidate:candidate]; - } - self.queuedRemoteCandidates = nil; -} - -- (NSString*)unHTMLifyString:(NSString*)base { - // TODO(hughv): Investigate why percent escapes are being added. Removing - // them isn't necessary on Android. - // convert HTML escaped characters to UTF8. - NSString* removePercent = - [base stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - // remove leading and trailing ". - NSRange range; - range.length = [removePercent length] - 2; - range.location = 1; - NSString* removeQuotes = [removePercent substringWithRange:range]; - // convert \" to ". - NSString* removeEscapedQuotes = - [removeQuotes stringByReplacingOccurrencesOfString:@"\\\"" - withString:@"\""]; - // convert \\ to \. - NSString* removeBackslash = - [removeEscapedQuotes stringByReplacingOccurrencesOfString:@"\\\\" - withString:@"\\"]; - return removeBackslash; -} - -- (void)didFireStatsTimer:(NSTimer *)timer { - if (self.peerConnection) { - [self.peerConnection getStatsWithDelegate:self - mediaStreamTrack:nil - statsOutputLevel:RTCStatsOutputLevelDebug]; - } -} - -#pragma mark - public methods - -- (void)closeVideoUI { - [self.viewController resetUI]; - [self disconnect]; -} - -@end diff --git a/examples/ios/AppRTCDemo/APPRTCViewController.h b/examples/ios/AppRTCDemo/APPRTCViewController.h deleted file mode 100755 index 1737a13..0000000 --- a/examples/ios/AppRTCDemo/APPRTCViewController.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <UIKit/UIKit.h> - -@class RTCEAGLVideoView; - -// The view controller that is displayed when AppRTCDemo is loaded. -@interface APPRTCViewController : UIViewController<UITextFieldDelegate> - -@property(weak, nonatomic) IBOutlet UITextField* roomInput; -@property(weak, nonatomic) IBOutlet UITextView* instructionsView; -@property(weak, nonatomic) IBOutlet UITextView* logView; -@property(weak, nonatomic) IBOutlet UIView* blackView; - -@property(nonatomic, strong) RTCEAGLVideoView* localVideoView; -@property(nonatomic, strong) RTCEAGLVideoView* remoteVideoView; - -- (void)displayText:(NSString*)text; -- (void)resetUI; - -@end diff --git a/examples/ios/AppRTCDemo/APPRTCViewController.m b/examples/ios/AppRTCDemo/APPRTCViewController.m deleted file mode 100755 index bdd8b50..0000000 --- a/examples/ios/AppRTCDemo/APPRTCViewController.m +++ /dev/null @@ -1,150 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "APPRTCViewController.h" - -#import <AVFoundation/AVFoundation.h> -#import "RTCEAGLVideoView.h" - -@interface APPRTCViewController () -@property(nonatomic, assign) UIInterfaceOrientation statusBarOrientation; -@end - -@implementation APPRTCViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - self.statusBarOrientation = - [UIApplication sharedApplication].statusBarOrientation; - self.roomInput.delegate = self; - [self.roomInput becomeFirstResponder]; -} - -- (void)viewDidLayoutSubviews { - if (self.statusBarOrientation != - [UIApplication sharedApplication].statusBarOrientation) { - self.statusBarOrientation = - [UIApplication sharedApplication].statusBarOrientation; - [[NSNotificationCenter defaultCenter] - postNotificationName:@"StatusBarOrientationDidChange" - object:nil]; - } -} - -- (void)displayText:(NSString*)text { - dispatch_async(dispatch_get_main_queue(), ^(void) { - NSString* output = - [NSString stringWithFormat:@"%@\n%@", self.logView.text, text]; - self.logView.text = output; - [self.logView - scrollRangeToVisible:NSMakeRange([self.logView.text length], 0)]; - }); -} - -- (void)resetUI { - [self.roomInput resignFirstResponder]; - self.roomInput.text = nil; - self.roomInput.hidden = NO; - self.instructionsView.hidden = NO; - self.logView.hidden = YES; - self.logView.text = nil; - self.blackView.hidden = YES; - - [self.remoteVideoView removeFromSuperview]; - self.remoteVideoView = nil; - - [self.localVideoView removeFromSuperview]; - self.localVideoView = nil; -} - -// TODO(fischman): Use video dimensions from the incoming video stream -// and resize the Video View accordingly w.r.t. aspect ratio. -enum { - // Remote video view dimensions. - kRemoteVideoWidth = 640, - kRemoteVideoHeight = 480, - // Padding space for local video view with its parent. - kLocalViewPadding = 20 -}; - -- (void)setupCaptureSession { - self.blackView.hidden = NO; - - CGSize videoSize = - CGSizeMake(kRemoteVideoWidth, kRemoteVideoHeight); - CGRect remoteVideoFrame = - AVMakeRectWithAspectRatioInsideRect(videoSize, - self.blackView.bounds); - CGRect localVideoFrame = remoteVideoFrame; - // TODO(tkchin): use video dimensions from incoming video stream - // and handle rotation. - localVideoFrame.size.width = remoteVideoFrame.size.height / 4; - localVideoFrame.size.height = remoteVideoFrame.size.width / 4; - localVideoFrame.origin.x = CGRectGetMaxX(remoteVideoFrame) - - localVideoFrame.size.width - kLocalViewPadding; - localVideoFrame.origin.y = CGRectGetMaxY(remoteVideoFrame) - - localVideoFrame.size.height - kLocalViewPadding; - - self.remoteVideoView = - [[RTCEAGLVideoView alloc] initWithFrame:remoteVideoFrame]; - [self.blackView addSubview:self.remoteVideoView]; - self.remoteVideoView.transform = CGAffineTransformMakeScale(-1, 1); - - self.localVideoView = - [[RTCEAGLVideoView alloc] initWithFrame:localVideoFrame]; - [self.blackView addSubview:self.localVideoView]; -} - -#pragma mark - UITextFieldDelegate - -- (void)textFieldDidEndEditing:(UITextField*)textField { - NSString* room = textField.text; - if ([room length] == 0) { - return; - } - textField.hidden = YES; - self.instructionsView.hidden = YES; - self.logView.hidden = NO; - // TODO(hughv): Instead of launching a URL with apprtc scheme, change to - // prepopulating the textField with a valid URL missing the room. This allows - // the user to have the simplicity of just entering the room or the ability to - // override to a custom appspot instance. Remove apprtc:// when this is done. - NSString* url = - [NSString stringWithFormat:@"apprtc://apprtc.appspot.com/?r=%@", room]; - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; - - dispatch_async(dispatch_get_main_queue(), ^{ [self setupCaptureSession]; }); -} - -- (BOOL)textFieldShouldReturn:(UITextField*)textField { - // There is no other control that can take focus, so manually resign focus - // when return (Join) is pressed to trigger |textFieldDidEndEditing|. - [textField resignFirstResponder]; - return YES; -} - -@end diff --git a/examples/ios/AppRTCDemo/AppRTCDemo-Prefix.pch b/examples/ios/AppRTCDemo/AppRTCDemo-Prefix.pch deleted file mode 100755 index 3ac2c3b..0000000 --- a/examples/ios/AppRTCDemo/AppRTCDemo-Prefix.pch +++ /dev/null @@ -1,40 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// -// Prefix header for all source files of the 'AppRTCDemo' target in the -// 'AppRTCDemo' project -// - -#import <Availability.h> - -#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0 -#warning "This project uses features only available in iOS SDK 6.0 and later." -#endif - -#import <UIKit/UIKit.h> -#import <Foundation/Foundation.h> diff --git a/examples/ios/AppRTCDemo/GAEChannelClient.h b/examples/ios/AppRTCDemo/GAEChannelClient.h deleted file mode 100755 index 8c7d5d3..0000000 --- a/examples/ios/AppRTCDemo/GAEChannelClient.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <UIKit/UIKit.h> - -// These methods will be called by the AppEngine chanel. The documentation -// for these methods is found here. (Yes, it is a JS API.) -// https://developers.google.com/appengine/docs/java/channel/javascript -@protocol GAEMessageHandler<NSObject> - -- (void)onOpen; -- (void)onMessage:(NSDictionary*)data; -- (void)onClose; -- (void)onError:(int)code withDescription:(NSString *)description; - -@end - -// Initialize with a token for an AppRTC data channel. This will load -// ios_channel.html and use the token to establish a data channel between the -// application and AppEngine. -@interface GAEChannelClient : NSObject<UIWebViewDelegate> - -- (id)initWithToken:(NSString *)token delegate:(id<GAEMessageHandler>)delegate; - -@end diff --git a/examples/ios/AppRTCDemo/GAEChannelClient.m b/examples/ios/AppRTCDemo/GAEChannelClient.m deleted file mode 100755 index fcd0787..0000000 --- a/examples/ios/AppRTCDemo/GAEChannelClient.m +++ /dev/null @@ -1,116 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "GAEChannelClient.h" - -#import "RTCPeerConnectionFactory.h" - -@interface GAEChannelClient () - -@property(nonatomic, assign) id<GAEMessageHandler> delegate; -@property(nonatomic, strong) UIWebView* webView; - -@end - -@implementation GAEChannelClient - -- (id)initWithToken:(NSString*)token delegate:(id<GAEMessageHandler>)delegate { - self = [super init]; - if (self) { - _webView = [[UIWebView alloc] init]; - _webView.delegate = self; - _delegate = delegate; - NSString* htmlPath = - [[NSBundle mainBundle] pathForResource:@"ios_channel" ofType:@"html"]; - NSURL* htmlUrl = [NSURL fileURLWithPath:htmlPath]; - NSString* path = [NSString - stringWithFormat:@"%@?token=%@", [htmlUrl absoluteString], token]; - - [_webView - loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:path]]]; - } - return self; -} - -- (void)dealloc { - _webView.delegate = nil; - [_webView stopLoading]; -} - -#pragma mark - UIWebViewDelegate method - -+ (NSDictionary*)jsonStringToDictionary:(NSString*)str { - NSData* data = [str dataUsingEncoding:NSUTF8StringEncoding]; - NSError* error; - NSDictionary* dict = - [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; - NSAssert(!error, @"Invalid JSON? %@", str); - return dict; -} - -- (BOOL)webView:(UIWebView*)webView - shouldStartLoadWithRequest:(NSURLRequest*)request - navigationType:(UIWebViewNavigationType)navigationType { - NSString* scheme = [request.URL scheme]; - NSAssert(scheme, @"scheme is nil: %@", request); - if (![scheme isEqualToString:@"js-frame"]) { - return YES; - } - - dispatch_async(dispatch_get_main_queue(), ^(void) { - NSString* queuedMessage = [webView - stringByEvaluatingJavaScriptFromString:@"popQueuedMessage();"]; - NSAssert([queuedMessage length], @"Empty queued message from JS"); - - NSDictionary* queuedMessageDict = - [GAEChannelClient jsonStringToDictionary:queuedMessage]; - NSString* method = queuedMessageDict[@"type"]; - NSAssert(method, @"Missing method: %@", queuedMessageDict); - NSDictionary* payload = queuedMessageDict[@"payload"]; // May be nil. - - if ([method isEqualToString:@"onopen"]) { - [self.delegate onOpen]; - } else if ([method isEqualToString:@"onmessage"]) { - NSDictionary* payloadData = - [GAEChannelClient jsonStringToDictionary:payload[@"data"]]; - [self.delegate onMessage:payloadData]; - } else if ([method isEqualToString:@"onclose"]) { - [self.delegate onClose]; - } else if ([method isEqualToString:@"onerror"]) { - NSNumber* codeNumber = payload[@"code"]; - int code = [codeNumber intValue]; - NSAssert([codeNumber isEqualToNumber:[NSNumber numberWithInt:code]], - @"Unexpected non-integral code: %@", payload); - [self.delegate onError:code withDescription:payload[@"description"]]; - } else { - NSAssert(NO, @"Invalid message sent from UIWebView: %@", queuedMessage); - } - }); - return NO; -} - -@end diff --git a/examples/ios/AppRTCDemo/Info.plist b/examples/ios/AppRTCDemo/Info.plist deleted file mode 100755 index a32be86..0000000 --- a/examples/ios/AppRTCDemo/Info.plist +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>BuildMachineOSBuild</key> - <string>12E55</string> - <key>CFBundleDevelopmentRegion</key> - <string>en</string> - <key>CFBundleDisplayName</key> - <string>AppRTCDemo</string> - <key>CFBundleExecutable</key> - <string>AppRTCDemo</string> - <key>CFBundleIcons</key> - <dict> - <key>CFBundlePrimaryIcon</key> - <dict> - <key>CFBundleIconFiles</key> - <array> - <string>Icon.png</string> - </array> - </dict> - </dict> - <key>CFBundleIdentifier</key> - <string>com.google.AppRTCDemo</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>AppRTCDemo</string> - <key>CFBundlePackageType</key> - <string>APPL</string> - <key>CFBundleResourceSpecification</key> - <string>ResourceRules.plist</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleSupportedPlatforms</key> - <array> - <string>iPhoneOS</string> - </array> - <key>CFBundleURLTypes</key> - <array> - <dict> - <key>CFBundleTypeRole</key> - <string>Editor</string> - <key>CFBundleURLName</key> - <string>com.google.apprtcdemo</string> - <key>CFBundleURLSchemes</key> - <array> - <string>apprtc</string> - </array> - </dict> - </array> - <key>CFBundleVersion</key> - <string>1.0</string> - <key>UIRequiredDeviceCapabilities</key> - <array> - <string>armv7</string> - </array> - <key>UIStatusBarTintParameters</key> - <dict> - <key>UINavigationBar</key> - <dict> - <key>Style</key> - <string>UIBarStyleDefault</string> - <key>Translucent</key> - <false/> - </dict> - </dict> - <key>UISupportedInterfaceOrientations</key> - <array> - <string>UIInterfaceOrientationPortrait</string> - </array> -</dict> -</plist> diff --git a/examples/ios/AppRTCDemo/ResourceRules.plist b/examples/ios/AppRTCDemo/ResourceRules.plist deleted file mode 100755 index e7ec329..0000000 --- a/examples/ios/AppRTCDemo/ResourceRules.plist +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>rules</key> - <dict> - <key>.*</key> - <true/> - <key>Info.plist</key> - <dict> - <key>omit</key> - <true/> - <key>weight</key> - <real>10</real> - </dict> - <key>ResourceRules.plist</key> - <dict> - <key>omit</key> - <true/> - <key>weight</key> - <real>100</real> - </dict> - </dict> -</dict> -</plist> diff --git a/examples/ios/AppRTCDemo/en.lproj/APPRTCViewController.xib b/examples/ios/AppRTCDemo/en.lproj/APPRTCViewController.xib deleted file mode 100755 index 62807fe..0000000 --- a/examples/ios/AppRTCDemo/en.lproj/APPRTCViewController.xib +++ /dev/null @@ -1,716 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00"> - <data> - <int key="IBDocument.SystemTarget">1536</int> - <string key="IBDocument.SystemVersion">13B42</string> - <string key="IBDocument.InterfaceBuilderVersion">4514</string> - <string key="IBDocument.AppKitVersion">1265</string> - <string key="IBDocument.HIToolboxVersion">696.00</string> - <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> - <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="NS.object.0">3747</string> - </object> - <array key="IBDocument.IntegratedClassDependencies"> - <string>IBNSLayoutConstraint</string> - <string>IBProxyObject</string> - <string>IBUITextField</string> - <string>IBUITextView</string> - <string>IBUIView</string> - </array> - <array key="IBDocument.PluginDependencies"> - <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - </array> - <object class="NSMutableDictionary" key="IBDocument.Metadata"> - <string key="NS.key.0">PluginDependencyRecalculationVersion</string> - <integer value="1" key="NS.object.0"/> - </object> - <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> - <object class="IBProxyObject" id="372490531"> - <string key="IBProxiedObjectIdentifier">IBFilesOwner</string> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - <object class="IBProxyObject" id="843779117"> - <string key="IBProxiedObjectIdentifier">IBFirstResponder</string> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - <object class="IBUIView" id="774585933"> - <reference key="NSNextResponder"/> - <int key="NSvFlags">274</int> - <array class="NSMutableArray" key="NSSubviews"> - <object class="IBUITextView" id="176994284"> - <reference key="NSNextResponder" ref="774585933"/> - <int key="NSvFlags">292</int> - <string key="NSFrame">{{20, 20}, {280, 141}}</string> - <reference key="NSSuperview" ref="774585933"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="634862110"/> - <string key="NSReuseIdentifierKey">_NS:9</string> - <object class="NSColor" key="IBUIBackgroundColor" id="621995359"> - <int key="NSColorSpace">1</int> - <bytes key="NSRGB">MSAxIDEAA</bytes> - </object> - <bool key="IBUIClipsSubviews">YES</bool> - <bool key="IBUIUserInteractionEnabled">NO</bool> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - <string key="IBUIText">Use Safari and open a URL with a scheme of apprtc to load the test app and connect. i.e. apprtc://apprtc.appspot.com/?r=12345678 Or just enter the room below to connect to apprtc.</string> - <object class="IBUITextInputTraits" key="IBUITextInputTraits"> - <int key="IBUIAutocapitalizationType">2</int> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - <object class="IBUIFontDescription" key="IBUIFontDescription" id="166497611"> - <int key="type">1</int> - <double key="pointSize">14</double> - </object> - <object class="NSFont" key="IBUIFont" id="144501234"> - <string key="NSName">HelveticaNeue</string> - <double key="NSSize">14</double> - <int key="NSfFlags">16</int> - </object> - </object> - <object class="IBUITextField" id="546385578"> - <reference key="NSNextResponder" ref="774585933"/> - <int key="NSvFlags">292</int> - <string key="NSFrame">{{20, 180}, {280, 30}}</string> - <reference key="NSSuperview" ref="774585933"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="261050959"/> - <string key="NSReuseIdentifierKey">_NS:9</string> - <bool key="IBUIOpaque">NO</bool> - <bool key="IBUIClipsSubviews">YES</bool> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - <int key="IBUIContentVerticalAlignment">0</int> - <string key="IBUIText"/> - <int key="IBUIBorderStyle">3</int> - <string key="IBUIPlaceholder">apprtc room</string> - <object class="NSColor" key="IBUITextColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MAA</bytes> - <object class="NSColorSpace" key="NSCustomColorSpace" id="14071810"> - <int key="NSID">2</int> - </object> - </object> - <bool key="IBUIAdjustsFontSizeToFit">YES</bool> - <float key="IBUIMinimumFontSize">17</float> - <object class="IBUITextInputTraits" key="IBUITextInputTraits"> - <int key="IBUIKeyboardType">2</int> - <int key="IBUIReturnKeyType">3</int> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - <reference key="IBUIFontDescription" ref="166497611"/> - <reference key="IBUIFont" ref="144501234"/> - </object> - <object class="IBUITextView" id="634862110"> - <reference key="NSNextResponder" ref="774585933"/> - <int key="NSvFlags">-2147483356</int> - <string key="NSFrame">{{20, 20}, {280, 190}}</string> - <reference key="NSSuperview" ref="774585933"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="546385578"/> - <string key="NSReuseIdentifierKey">_NS:9</string> - <reference key="IBUIBackgroundColor" ref="621995359"/> - <bool key="IBUIClipsSubviews">YES</bool> - <bool key="IBUIMultipleTouchEnabled">YES</bool> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - <bool key="IBUIEditable">NO</bool> - <string key="IBUIText"/> - <object class="IBUITextInputTraits" key="IBUITextInputTraits"> - <int key="IBUIAutocapitalizationType">2</int> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - <reference key="IBUIFontDescription" ref="166497611"/> - <reference key="IBUIFont" ref="144501234"/> - </object> - <object class="IBUIView" id="261050959"> - <reference key="NSNextResponder" ref="774585933"/> - <int key="NSvFlags">-2147483356</int> - <string key="NSFrame">{{20, 228}, {280, 300}}</string> - <reference key="NSSuperview" ref="774585933"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView"/> - <string key="NSReuseIdentifierKey">_NS:9</string> - <object class="NSColor" key="IBUIBackgroundColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MAA</bytes> - </object> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - </array> - <string key="NSFrame">{{0, 20}, {320, 548}}</string> - <reference key="NSSuperview"/> - <reference key="NSWindow"/> - <reference key="NSNextKeyView" ref="176994284"/> - <object class="NSColor" key="IBUIBackgroundColor"> - <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC43NQA</bytes> - <reference key="NSCustomColorSpace" ref="14071810"/> - </object> - <bool key="IBUIClearsContextBeforeDrawing">NO</bool> - <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/> - <object class="IBUIScreenMetrics" key="IBUISimulatedDestinationMetrics"> - <string key="IBUISimulatedSizeMetricsClass">IBUIScreenMetrics</string> - <object class="NSMutableDictionary" key="IBUINormalizedOrientationToSizeMap"> - <bool key="EncodedWithXMLCoder">YES</bool> - <array key="dict.sortedKeys"> - <integer value="1"/> - <integer value="3"/> - </array> - <array key="dict.values"> - <string>{320, 568}</string> - <string>{568, 320}</string> - </array> - </object> - <string key="IBUITargetRuntime">IBCocoaTouchFramework</string> - <string key="IBUIDisplayName">Retina 4-inch Full Screen</string> - <int key="IBUIType">2</int> - </object> - <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string> - </object> - </array> - <object class="IBObjectContainer" key="IBDocument.Objects"> - <array class="NSMutableArray" key="connectionRecords"> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">view</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="774585933"/> - </object> - <int key="connectionID">7</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">roomInput</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="546385578"/> - </object> - <int key="connectionID">108</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">instructionsView</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="176994284"/> - </object> - <int key="connectionID">127</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">logView</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="634862110"/> - </object> - <int key="connectionID">138</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBCocoaTouchOutletConnection" key="connection"> - <string key="label">blackView</string> - <reference key="source" ref="372490531"/> - <reference key="destination" ref="261050959"/> - </object> - <int key="connectionID">151</int> - </object> - </array> - <object class="IBMutableOrderedSet" key="objectRecords"> - <array key="orderedObjects"> - <object class="IBObjectRecord"> - <int key="objectID">0</int> - <array key="object" id="0"/> - <reference key="children" ref="1000"/> - <nil key="parent"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-1</int> - <reference key="object" ref="372490531"/> - <reference key="parent" ref="0"/> - <string key="objectName">File's Owner</string> - </object> - <object class="IBObjectRecord"> - <int key="objectID">-2</int> - <reference key="object" ref="843779117"/> - <reference key="parent" ref="0"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">6</int> - <reference key="object" ref="774585933"/> - <array class="NSMutableArray" key="children"> - <object class="IBNSLayoutConstraint" id="933872207"> - <reference key="firstItem" ref="774585933"/> - <int key="firstAttribute">4</int> - <int key="relation">0</int> - <reference key="secondItem" ref="261050959"/> - <int key="secondAttribute">4</int> - <float key="multiplier">1</float> - <object class="IBNSLayoutSymbolicConstant" key="constant"> - <double key="value">20</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">8</int> - <float key="scoringTypeFloat">23</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="863471211"> - <reference key="firstItem" ref="261050959"/> - <int key="firstAttribute">3</int> - <int key="relation">0</int> - <reference key="secondItem" ref="774585933"/> - <int key="secondAttribute">3</int> - <float key="multiplier">1</float> - <object class="IBLayoutConstant" key="constant"> - <double key="value">228</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">3</int> - <float key="scoringTypeFloat">9</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="590654550"> - <reference key="firstItem" ref="546385578"/> - <int key="firstAttribute">5</int> - <int key="relation">0</int> - <reference key="secondItem" ref="261050959"/> - <int key="secondAttribute">5</int> - <float key="multiplier">1</float> - <object class="IBLayoutConstant" key="constant"> - <double key="value">0.0</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">6</int> - <float key="scoringTypeFloat">24</float> - <int key="contentType">2</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="734153049"> - <reference key="firstItem" ref="546385578"/> - <int key="firstAttribute">6</int> - <int key="relation">0</int> - <reference key="secondItem" ref="261050959"/> - <int key="secondAttribute">6</int> - <float key="multiplier">1</float> - <object class="IBLayoutConstant" key="constant"> - <double key="value">0.0</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">6</int> - <float key="scoringTypeFloat">24</float> - <int key="contentType">2</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="117610664"> - <reference key="firstItem" ref="774585933"/> - <int key="firstAttribute">6</int> - <int key="relation">0</int> - <reference key="secondItem" ref="546385578"/> - <int key="secondAttribute">6</int> - <float key="multiplier">1</float> - <object class="IBNSLayoutSymbolicConstant" key="constant"> - <double key="value">20</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">0</int> - <float key="scoringTypeFloat">29</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="860801955"> - <reference key="firstItem" ref="546385578"/> - <int key="firstAttribute">5</int> - <int key="relation">0</int> - <reference key="secondItem" ref="774585933"/> - <int key="secondAttribute">5</int> - <float key="multiplier">1</float> - <object class="IBNSLayoutSymbolicConstant" key="constant"> - <double key="value">20</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">0</int> - <float key="scoringTypeFloat">29</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="544488581"> - <reference key="firstItem" ref="634862110"/> - <int key="firstAttribute">4</int> - <int key="relation">0</int> - <reference key="secondItem" ref="546385578"/> - <int key="secondAttribute">4</int> - <float key="multiplier">1</float> - <object class="IBLayoutConstant" key="constant"> - <double key="value">0.0</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">6</int> - <float key="scoringTypeFloat">24</float> - <int key="contentType">2</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="19985792"> - <reference key="firstItem" ref="634862110"/> - <int key="firstAttribute">3</int> - <int key="relation">0</int> - <reference key="secondItem" ref="774585933"/> - <int key="secondAttribute">3</int> - <float key="multiplier">1</float> - <object class="IBNSLayoutSymbolicConstant" key="constant"> - <double key="value">20</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">0</int> - <float key="scoringTypeFloat">29</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="1001701893"> - <reference key="firstItem" ref="774585933"/> - <int key="firstAttribute">6</int> - <int key="relation">0</int> - <reference key="secondItem" ref="634862110"/> - <int key="secondAttribute">6</int> - <float key="multiplier">1</float> - <object class="IBNSLayoutSymbolicConstant" key="constant"> - <double key="value">20</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">0</int> - <float key="scoringTypeFloat">29</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="858545289"> - <reference key="firstItem" ref="634862110"/> - <int key="firstAttribute">5</int> - <int key="relation">0</int> - <reference key="secondItem" ref="774585933"/> - <int key="secondAttribute">5</int> - <float key="multiplier">1</float> - <object class="IBNSLayoutSymbolicConstant" key="constant"> - <double key="value">20</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">0</int> - <float key="scoringTypeFloat">29</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="1039342825"> - <reference key="firstItem" ref="774585933"/> - <int key="firstAttribute">6</int> - <int key="relation">0</int> - <reference key="secondItem" ref="176994284"/> - <int key="secondAttribute">6</int> - <float key="multiplier">1</float> - <object class="IBNSLayoutSymbolicConstant" key="constant"> - <double key="value">20</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">0</int> - <float key="scoringTypeFloat">29</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="663764352"> - <reference key="firstItem" ref="176994284"/> - <int key="firstAttribute">3</int> - <int key="relation">0</int> - <reference key="secondItem" ref="774585933"/> - <int key="secondAttribute">3</int> - <float key="multiplier">1</float> - <object class="IBNSLayoutSymbolicConstant" key="constant"> - <double key="value">20</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">0</int> - <float key="scoringTypeFloat">29</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <object class="IBNSLayoutConstraint" id="46028745"> - <reference key="firstItem" ref="176994284"/> - <int key="firstAttribute">5</int> - <int key="relation">0</int> - <reference key="secondItem" ref="774585933"/> - <int key="secondAttribute">5</int> - <float key="multiplier">1</float> - <object class="IBNSLayoutSymbolicConstant" key="constant"> - <double key="value">20</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="774585933"/> - <int key="scoringType">0</int> - <float key="scoringTypeFloat">29</float> - <int key="contentType">3</int> - <bool key="placeholder">NO</bool> - </object> - <reference ref="176994284"/> - <reference ref="546385578"/> - <reference ref="634862110"/> - <reference ref="261050959"/> - </array> - <reference key="parent" ref="0"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">57</int> - <reference key="object" ref="176994284"/> - <array class="NSMutableArray" key="children"> - <object class="IBNSLayoutConstraint" id="234302232"> - <reference key="firstItem" ref="176994284"/> - <int key="firstAttribute">8</int> - <int key="relation">0</int> - <nil key="secondItem"/> - <int key="secondAttribute">0</int> - <float key="multiplier">1</float> - <object class="IBLayoutConstant" key="constant"> - <double key="value">141</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="176994284"/> - <int key="scoringType">3</int> - <float key="scoringTypeFloat">9</float> - <int key="contentType">1</int> - <bool key="placeholder">NO</bool> - </object> - </array> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">62</int> - <reference key="object" ref="46028745"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">63</int> - <reference key="object" ref="663764352"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">66</int> - <reference key="object" ref="1039342825"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">104</int> - <reference key="object" ref="546385578"/> - <array class="NSMutableArray" key="children"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">107</int> - <reference key="object" ref="860801955"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">123</int> - <reference key="object" ref="234302232"/> - <reference key="parent" ref="176994284"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">126</int> - <reference key="object" ref="117610664"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">128</int> - <reference key="object" ref="634862110"/> - <array class="NSMutableArray" key="children"> - <object class="IBNSLayoutConstraint" id="988159807"> - <reference key="firstItem" ref="634862110"/> - <int key="firstAttribute">8</int> - <int key="relation">0</int> - <nil key="secondItem"/> - <int key="secondAttribute">0</int> - <float key="multiplier">1</float> - <object class="IBLayoutConstant" key="constant"> - <double key="value">190</double> - </object> - <float key="priority">1000</float> - <reference key="containingView" ref="634862110"/> - <int key="scoringType">3</int> - <float key="scoringTypeFloat">9</float> - <int key="contentType">1</int> - <bool key="placeholder">NO</bool> - </object> - </array> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">133</int> - <reference key="object" ref="858545289"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">137</int> - <reference key="object" ref="1001701893"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">139</int> - <reference key="object" ref="19985792"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">141</int> - <reference key="object" ref="988159807"/> - <reference key="parent" ref="634862110"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">142</int> - <reference key="object" ref="261050959"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">148</int> - <reference key="object" ref="734153049"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">149</int> - <reference key="object" ref="590654550"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">153</int> - <reference key="object" ref="863471211"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">154</int> - <reference key="object" ref="933872207"/> - <reference key="parent" ref="774585933"/> - </object> - <object class="IBObjectRecord"> - <int key="objectID">155</int> - <reference key="object" ref="544488581"/> - <reference key="parent" ref="774585933"/> - </object> - </array> - </object> - <dictionary class="NSMutableDictionary" key="flattenedProperties"> - <string key="-1.CustomClassName">APPRTCViewController</string> - <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="-2.CustomClassName">UIResponder</string> - <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="104.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <boolean value="NO" key="104.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> - <string key="107.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="123.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="126.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="128.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <array key="128.IBViewMetadataConstraints"> - <reference ref="988159807"/> - </array> - <boolean value="NO" key="128.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> - <string key="133.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="137.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="139.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="141.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="142.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <boolean value="NO" key="142.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> - <string key="148.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="149.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="153.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="154.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="155.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="57.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <array class="NSMutableArray" key="57.IBViewMetadataConstraints"> - <reference ref="234302232"/> - </array> - <boolean value="NO" key="57.IBViewMetadataTranslatesAutoresizingMaskIntoConstraints"/> - <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <array class="NSMutableArray" key="6.IBViewMetadataConstraints"> - <reference ref="46028745"/> - <reference ref="663764352"/> - <reference ref="1039342825"/> - <reference ref="858545289"/> - <reference ref="1001701893"/> - <reference ref="19985792"/> - <reference ref="544488581"/> - <reference ref="860801955"/> - <reference ref="117610664"/> - <reference ref="734153049"/> - <reference ref="590654550"/> - <reference ref="863471211"/> - <reference ref="933872207"/> - </array> - <string key="62.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="63.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="66.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/> - <nil key="activeLocalization"/> - <dictionary class="NSMutableDictionary" key="localizations"/> - <nil key="sourceID"/> - <int key="maxID">155</int> - </object> - <object class="IBClassDescriber" key="IBDocument.Classes"> - <array class="NSMutableArray" key="referencedPartialClassDescriptions"> - <object class="IBPartialClassDescription"> - <string key="className">APPRTCViewController</string> - <string key="superclassName">UIViewController</string> - <dictionary class="NSMutableDictionary" key="outlets"> - <string key="blackView">UIView</string> - <string key="roomInput">UITextField</string> - <string key="instructionsView">UITextView</string> - <string key="logView">UITextView</string> - </dictionary> - <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> - <object class="IBToOneOutletInfo" key="blackView"> - <string key="name">blackView</string> - <string key="candidateClassName">UIView</string> - </object> - <object class="IBToOneOutletInfo" key="roomInput"> - <string key="name">roomInput</string> - <string key="candidateClassName">UITextField</string> - </object> - <object class="IBToOneOutletInfo" key="instructionsView"> - <string key="name">instructionsView</string> - <string key="candidateClassName">UITextView</string> - </object> - <object class="IBToOneOutletInfo" key="logView"> - <string key="name">logView</string> - <string key="candidateClassName">UITextView</string> - </object> - </dictionary> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/APPRTCViewController.h</string> - </object> - </object> - <object class="IBPartialClassDescription"> - <string key="className">NSLayoutConstraint</string> - <string key="superclassName">NSObject</string> - <object class="IBClassDescriptionSource" key="sourceIdentifier"> - <string key="majorKey">IBProjectSource</string> - <string key="minorKey">./Classes/NSLayoutConstraint.h</string> - </object> - </object> - </array> - </object> - <int key="IBDocument.localizationMode">0</int> - <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string> - <bool key="IBDocument.previouslyAttemptedUpgradeToXcode5">YES</bool> - <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string> - <real value="1536" key="NS.object.0"/> - </object> - <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> - <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string> - <integer value="4600" key="NS.object.0"/> - </object> - <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool> - <int key="IBDocument.defaultPropertyAccessControl">3</int> - <bool key="IBDocument.UseAutolayout">YES</bool> - <string key="IBCocoaTouchPluginVersion">3747</string> - </data> -</archive> diff --git a/examples/ios/AppRTCDemo/ios_channel.html b/examples/ios/AppRTCDemo/ios_channel.html deleted file mode 100755 index 86846dd..0000000 --- a/examples/ios/AppRTCDemo/ios_channel.html +++ /dev/null @@ -1,94 +0,0 @@ -<html> - <head> - <script src="http://apprtc.appspot.com/_ah/channel/jsapi"></script> - </head> - <!-- - Helper HTML that redirects Google AppEngine's Channel API to Objective C. - This is done by hosting this page in an iOS application. The hosting - class creates a UIWebView control and implements the UIWebViewDelegate - protocol. Then when there is a channel message it is queued in JS, - and an IFRAME is added to the DOM, triggering a navigation event - |shouldStartLoadWithRequest| in Objective C which can then fetch the - message using |popQueuedMessage|. This queuing is necessary to avoid URL - length limits in UIWebView (which are undocumented). - --> - <body onbeforeunload="closeSocket()" onload="openSocket()"> - <script type="text/javascript"> - // QueryString is copy/pasta from - // chromium's chrome/test/data/media/html/utils.js. - var QueryString = function () { - // Allows access to query parameters on the URL; e.g., given a URL like: - // http://<url>/my.html?test=123&bob=123 - // parameters can now be accessed via QueryString.test or - // QueryString.bob. - var params = {}; - - // RegEx to split out values by &. - var r = /([^&=]+)=?([^&]*)/g; - - // Lambda function for decoding extracted match values. Replaces '+' - // with space so decodeURIComponent functions properly. - function d(s) { return decodeURIComponent(s.replace(/\+/g, ' ')); } - - var match; - while (match = r.exec(window.location.search.substring(1))) - params[d(match[1])] = d(match[2]); - - return params; - } (); - - var channel = null; - var socket = null; - // In-order queue of messages to be delivered to ObjectiveC. - // Each is a JSON.stringify()'d dictionary containing a 'type' - // field and optionally a 'payload'. - var messageQueue = []; - - function openSocket() { - if (!QueryString.token || !QueryString.token.match(/^[A-z0-9_-]+$/)) { - // Send error back to ObjC. This will assert in GAEChannelClient.m. - sendMessageToObjC("JSError:Missing/malformed token parameter " + - QueryString.token); - throw "Missing/malformed token parameter: " + QueryString.token; - } - channel = new goog.appengine.Channel(QueryString.token); - socket = channel.open({ - 'onopen': function() { - sendMessageToObjC("onopen"); - }, - 'onmessage': function(msg) { - sendMessageToObjC("onmessage", msg); - }, - 'onclose': function() { - sendMessageToObjC("onclose"); - }, - 'onerror': function(err) { - sendMessageToObjC("onerror", err); - } - }); - } - - function closeSocket() { - socket.close(); - } - - // Add an IFRAME to the DOM to trigger a navigation event. Then remove - // it as it is no longer needed. Only one event is generated. - function sendMessageToObjC(type, payload) { - messageQueue.push(JSON.stringify({'type': type, 'payload': payload})); - var iframe = document.createElement("IFRAME"); - iframe.setAttribute("src", "js-frame:"); - // For some reason we need to set a non-empty size for the iOS6 - // simulator... - iframe.setAttribute("height", "1px"); - iframe.setAttribute("width", "1px"); - document.documentElement.appendChild(iframe); - iframe.parentNode.removeChild(iframe); - } - - function popQueuedMessage() { - return messageQueue.shift(); - } - </script> - </body> -</html> diff --git a/examples/ios/AppRTCDemo/main.m b/examples/ios/AppRTCDemo/main.m deleted file mode 100755 index e9a1f63..0000000 --- a/examples/ios/AppRTCDemo/main.m +++ /dev/null @@ -1,37 +0,0 @@ -/* - * libjingle - * Copyright 2013, Google Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import <UIKit/UIKit.h> - -#import "APPRTCAppDelegate.h" - -int main(int argc, char* argv[]) { - @autoreleasepool { - return UIApplicationMain( - argc, argv, nil, NSStringFromClass([APPRTCAppDelegate class])); - } -} diff --git a/examples/ios/README b/examples/ios/README deleted file mode 100755 index 9c0d134..0000000 --- a/examples/ios/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains an example iOS client for http://apprtc.appspot.com - -See ../../app/webrtc/objc/README for information on how to use it. diff --git a/examples/ios/AppRTCDemo/Default.png b/examples/objc/AppRTCDemo/ios/Default.png Binary files differindex 4c8ca6f..4c8ca6f 100755..100644 --- a/examples/ios/AppRTCDemo/Default.png +++ b/examples/objc/AppRTCDemo/ios/Default.png diff --git a/examples/ios/Icon.png b/examples/objc/Icon.png Binary files differindex 55773ca..55773ca 100755..100644 --- a/examples/ios/Icon.png +++ b/examples/objc/Icon.png |