OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 static CGFloat const kLocalVideoViewPadding = 8; | 23 static CGFloat const kLocalVideoViewPadding = 8; |
24 static CGFloat const kStatusBarHeight = 20; | 24 static CGFloat const kStatusBarHeight = 20; |
25 | 25 |
26 @interface ARDVideoCallView () <RTCEAGLVideoViewDelegate> | 26 @interface ARDVideoCallView () <RTCEAGLVideoViewDelegate> |
27 @end | 27 @end |
28 | 28 |
29 @implementation ARDVideoCallView { | 29 @implementation ARDVideoCallView { |
30 UIButton *_routeChangeButton; | 30 UIButton *_routeChangeButton; |
31 UIButton *_cameraSwitchButton; | 31 UIButton *_cameraSwitchButton; |
32 UIButton *_hangupButton; | 32 UIButton *_hangupButton; |
| 33 UIButton *_debugButton; |
33 CGSize _remoteVideoSize; | 34 CGSize _remoteVideoSize; |
34 } | 35 } |
35 | 36 |
36 @synthesize statusLabel = _statusLabel; | 37 @synthesize statusLabel = _statusLabel; |
37 @synthesize localVideoView = _localVideoView; | 38 @synthesize localVideoView = _localVideoView; |
38 @synthesize remoteVideoView = _remoteVideoView; | 39 @synthesize remoteVideoView = _remoteVideoView; |
39 @synthesize statsView = _statsView; | 40 @synthesize statsView = _statsView; |
40 @synthesize delegate = _delegate; | 41 @synthesize delegate = _delegate; |
41 | 42 |
42 - (instancetype)initWithFrame:(CGRect)frame { | 43 - (instancetype)initWithFrame:(CGRect)frame { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 _hangupButton.layer.cornerRadius = kButtonSize / 2; | 88 _hangupButton.layer.cornerRadius = kButtonSize / 2; |
88 _hangupButton.layer.masksToBounds = YES; | 89 _hangupButton.layer.masksToBounds = YES; |
89 image = [UIImage imageForName:@"ic_call_end_black_24dp.png" | 90 image = [UIImage imageForName:@"ic_call_end_black_24dp.png" |
90 color:[UIColor whiteColor]]; | 91 color:[UIColor whiteColor]]; |
91 [_hangupButton setImage:image forState:UIControlStateNormal]; | 92 [_hangupButton setImage:image forState:UIControlStateNormal]; |
92 [_hangupButton addTarget:self | 93 [_hangupButton addTarget:self |
93 action:@selector(onHangup:) | 94 action:@selector(onHangup:) |
94 forControlEvents:UIControlEventTouchUpInside]; | 95 forControlEvents:UIControlEventTouchUpInside]; |
95 [self addSubview:_hangupButton]; | 96 [self addSubview:_hangupButton]; |
96 | 97 |
| 98 _debugButton = [UIButton buttonWithType:UIButtonTypeSystem]; |
| 99 _debugButton.backgroundColor = [UIColor whiteColor]; |
| 100 _debugButton.layer.cornerRadius = kButtonSize / 2; |
| 101 _debugButton.layer.masksToBounds = YES; |
| 102 [_debugButton setTitle:@"Debug" forState:UIControlStateNormal]; |
| 103 [_debugButton addTarget:self |
| 104 action:@selector(onDebug:) |
| 105 forControlEvents:UIControlEventTouchUpInside]; |
| 106 [self addSubview:_debugButton]; |
| 107 |
97 _statusLabel = [[UILabel alloc] initWithFrame:CGRectZero]; | 108 _statusLabel = [[UILabel alloc] initWithFrame:CGRectZero]; |
98 _statusLabel.font = [UIFont fontWithName:@"Roboto" size:16]; | 109 _statusLabel.font = [UIFont fontWithName:@"Roboto" size:16]; |
99 _statusLabel.textColor = [UIColor whiteColor]; | 110 _statusLabel.textColor = [UIColor whiteColor]; |
100 [self addSubview:_statusLabel]; | 111 [self addSubview:_statusLabel]; |
101 | 112 |
102 UITapGestureRecognizer *tapRecognizer = | 113 UITapGestureRecognizer *tapRecognizer = |
103 [[UITapGestureRecognizer alloc] | 114 [[UITapGestureRecognizer alloc] |
104 initWithTarget:self | 115 initWithTarget:self |
105 action:@selector(didTripleTap:)]; | 116 action:@selector(didTripleTap:)]; |
106 tapRecognizer.numberOfTapsRequired = 3; | 117 tapRecognizer.numberOfTapsRequired = 3; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 cameraSwitchFrame.origin.x = | 172 cameraSwitchFrame.origin.x = |
162 CGRectGetMaxX(cameraSwitchFrame) + kButtonPadding; | 173 CGRectGetMaxX(cameraSwitchFrame) + kButtonPadding; |
163 _cameraSwitchButton.frame = cameraSwitchFrame; | 174 _cameraSwitchButton.frame = cameraSwitchFrame; |
164 | 175 |
165 // Place route button to the right of camera button. | 176 // Place route button to the right of camera button. |
166 CGRect routeChangeFrame = _cameraSwitchButton.frame; | 177 CGRect routeChangeFrame = _cameraSwitchButton.frame; |
167 routeChangeFrame.origin.x = | 178 routeChangeFrame.origin.x = |
168 CGRectGetMaxX(routeChangeFrame) + kButtonPadding; | 179 CGRectGetMaxX(routeChangeFrame) + kButtonPadding; |
169 _routeChangeButton.frame = routeChangeFrame; | 180 _routeChangeButton.frame = routeChangeFrame; |
170 | 181 |
| 182 // Place debug button above hangup button. |
| 183 CGRect debugButtonFrame = _hangupButton.frame; |
| 184 debugButtonFrame.origin.y = |
| 185 CGRectGetMinY(debugButtonFrame) - CGRectGetHeight(_hangupButton.frame) - k
ButtonPadding; |
| 186 _debugButton.frame = debugButtonFrame; |
| 187 |
171 [_statusLabel sizeToFit]; | 188 [_statusLabel sizeToFit]; |
172 _statusLabel.center = | 189 _statusLabel.center = |
173 CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); | 190 CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); |
174 } | 191 } |
175 | 192 |
176 #pragma mark - RTCEAGLVideoViewDelegate | 193 #pragma mark - RTCEAGLVideoViewDelegate |
177 | 194 |
178 - (void)videoView:(RTCEAGLVideoView*)videoView didChangeVideoSize:(CGSize)size { | 195 - (void)videoView:(RTCEAGLVideoView*)videoView didChangeVideoSize:(CGSize)size { |
179 if (videoView == _remoteVideoView) { | 196 if (videoView == _remoteVideoView) { |
180 _remoteVideoSize = size; | 197 _remoteVideoSize = size; |
181 } | 198 } |
182 [self setNeedsLayout]; | 199 [self setNeedsLayout]; |
183 } | 200 } |
184 | 201 |
185 #pragma mark - Private | 202 #pragma mark - Private |
186 | 203 |
187 - (void)onCameraSwitch:(id)sender { | 204 - (void)onCameraSwitch:(id)sender { |
188 [_delegate videoCallViewDidSwitchCamera:self]; | 205 [_delegate videoCallViewDidSwitchCamera:self]; |
189 } | 206 } |
190 | 207 |
191 - (void)onRouteChange:(id)sender { | 208 - (void)onRouteChange:(id)sender { |
192 [_delegate videoCallViewDidChangeRoute:self]; | 209 [_delegate videoCallViewDidChangeRoute:self]; |
193 } | 210 } |
194 | 211 |
195 - (void)onHangup:(id)sender { | 212 - (void)onHangup:(id)sender { |
196 [_delegate videoCallViewDidHangup:self]; | 213 [_delegate videoCallViewDidHangup:self]; |
197 } | 214 } |
198 | 215 |
| 216 - (void)onDebug:(id)sender { |
| 217 [_delegate videoCallViewDidDebug:self]; |
| 218 } |
| 219 |
199 - (void)didTripleTap:(UITapGestureRecognizer *)recognizer { | 220 - (void)didTripleTap:(UITapGestureRecognizer *)recognizer { |
200 [_delegate videoCallViewDidEnableStats:self]; | 221 [_delegate videoCallViewDidEnableStats:self]; |
201 } | 222 } |
202 | 223 |
203 @end | 224 @end |
OLD | NEW |