AppRTCDemo(iOS): remote-video reliability fixes

Previously GAE Channel callbacks would be handled by JS string-encoding the
payload into a URL.  Unfortunately this is limited to the (undocumented,
silently problematic) maximum URL length UIWebView supports.  Replaced this
scheme by a notification from JS to ObjC and a getter from ObjC to JS (which
happens out-of-line to avoid worrying about UIWebView's re-entrancy, or lack
thereof).  Part of this change also moved from a combination of: JSON,
URL-escaping, and ad-hoc :-separated values to simply JSON.

Also incidentally:
- Removed outdated TODO about onRenegotiationNeeded, which is unneeded
- Move handling of PeerConnection callbacks to the main queue to avoid having
  to think about concurrency too hard.
- Replaced a bunch of NSOrderedSame with isEqualToString for clearer code and
  not having to worry about the fact that [nil compare:@"foo"]==NSOrderedSame
  is always true (yay ObjC!).
- Auto-scroll messages view.

BUG=3117
R=noahric@google.com

Review URL: https://webrtc-codereview.appspot.com/10899006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5814 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
fischman@webrtc.org
2014-03-31 20:16:49 +00:00
parent 30cd5b5278
commit 61e78fca6c
7 changed files with 168 additions and 143 deletions

View File

@@ -41,8 +41,8 @@
[super viewDidLoad];
self.statusBarOrientation =
[UIApplication sharedApplication].statusBarOrientation;
self.textField.delegate = self;
[self.textField becomeFirstResponder];
self.roomInput.delegate = self;
[self.roomInput becomeFirstResponder];
}
- (void)viewDidLayoutSubviews {
@@ -59,18 +59,20 @@
- (void)displayText:(NSString*)text {
dispatch_async(dispatch_get_main_queue(), ^(void) {
NSString* output =
[NSString stringWithFormat:@"%@\n%@", self.textOutput.text, text];
self.textOutput.text = output;
[NSString stringWithFormat:@"%@\n%@", self.logView.text, text];
self.logView.text = output;
[self.logView
scrollRangeToVisible:NSMakeRange([self.logView.text length], 0)];
});
}
- (void)resetUI {
[self.textField resignFirstResponder];
self.textField.text = nil;
self.textField.hidden = NO;
self.textInstructions.hidden = NO;
self.textOutput.hidden = YES;
self.textOutput.text = nil;
[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;
[_remoteVideoView renderVideoTrackInterface:nil];
@@ -145,8 +147,8 @@ enum {
return;
}
textField.hidden = YES;
self.textInstructions.hidden = YES;
self.textOutput.hidden = NO;
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