Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m

Issue 1289623005: Add stats overlay to iOS AppRTCDemo. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: CR comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m
diff --git a/webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m b/webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m
index 45a69cf344165eabc52172f712b9678ae833e931..4048b84bb2bf3a874fa941109bfab231df0a1b86 100644
--- a/webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m
+++ b/webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallView.m
@@ -17,6 +17,7 @@ static CGFloat const kButtonPadding = 16;
static CGFloat const kButtonSize = 48;
static CGFloat const kLocalVideoViewSize = 120;
static CGFloat const kLocalVideoViewPadding = 8;
+static CGFloat const kStatusBarHeight = 20;
@interface ARDVideoCallView () <RTCEAGLVideoViewDelegate>
@end
@@ -32,6 +33,7 @@ static CGFloat const kLocalVideoViewPadding = 8;
@synthesize statusLabel = _statusLabel;
@synthesize localVideoView = _localVideoView;
@synthesize remoteVideoView = _remoteVideoView;
+@synthesize statsView = _statsView;
@synthesize delegate = _delegate;
- (instancetype)initWithFrame:(CGRect)frame {
@@ -46,6 +48,10 @@ static CGFloat const kLocalVideoViewPadding = 8;
_localVideoView.delegate = self;
[self addSubview:_localVideoView];
+ _statsView = [[ARDStatsView alloc] initWithFrame:CGRectZero];
+ _statsView.hidden = YES;
+ [self addSubview:_statsView];
+
// TODO(tkchin): don't display this if we can't actually do camera switch.
_cameraSwitchButton = [UIButton buttonWithType:UIButtonTypeCustom];
_cameraSwitchButton.backgroundColor = [UIColor whiteColor];
@@ -74,6 +80,13 @@ static CGFloat const kLocalVideoViewPadding = 8;
_statusLabel.font = [UIFont fontWithName:@"Roboto" size:16];
_statusLabel.textColor = [UIColor whiteColor];
[self addSubview:_statusLabel];
+
+ UITapGestureRecognizer *tapRecognizer =
+ [[UITapGestureRecognizer alloc]
+ initWithTarget:self
+ action:@selector(didTripleTap:)];
+ tapRecognizer.numberOfTapsRequired = 3;
+ [self addGestureRecognizer:tapRecognizer];
}
return self;
}
@@ -118,6 +131,12 @@ static CGFloat const kLocalVideoViewPadding = 8;
_localVideoView.frame = bounds;
}
+ // Place stats at the top.
+ CGSize statsSize = [_statsView sizeThatFits:bounds.size];
+ _statsView.frame = CGRectMake(CGRectGetMinX(bounds),
+ CGRectGetMinY(bounds) + kStatusBarHeight,
+ statsSize.width, statsSize.height);
+
// Place hangup button in the bottom left.
_hangupButton.frame =
CGRectMake(CGRectGetMinX(bounds) + kButtonPadding,
@@ -159,4 +178,8 @@ static CGFloat const kLocalVideoViewPadding = 8;
[_delegate videoCallViewDidHangup:self];
}
+- (void)didTripleTap:(UITapGestureRecognizer *)recognizer {
+ [_delegate videoCallViewDidEnableStats:self];
+}
+
@end

Powered by Google App Engine
This is Rietveld 408576698