| 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 |
| 11 #import "ARDVideoCallView.h" | 11 #import "ARDVideoCallView.h" |
| 12 | 12 |
| 13 #import <AVFoundation/AVFoundation.h> | 13 #import <AVFoundation/AVFoundation.h> |
| 14 | |
| 15 #import <WebRTC/RTCEAGLVideoView.h> | |
| 16 #import <WebRTC/RTCMTLVideoView.h> | |
| 17 | |
| 18 #import "UIImage+ARDUtilities.h" | 14 #import "UIImage+ARDUtilities.h" |
| 19 | 15 |
| 20 static CGFloat const kButtonPadding = 16; | 16 static CGFloat const kButtonPadding = 16; |
| 21 static CGFloat const kButtonSize = 48; | 17 static CGFloat const kButtonSize = 48; |
| 22 static CGFloat const kLocalVideoViewSize = 120; | 18 static CGFloat const kLocalVideoViewSize = 120; |
| 23 static CGFloat const kLocalVideoViewPadding = 8; | 19 static CGFloat const kLocalVideoViewPadding = 8; |
| 24 static CGFloat const kStatusBarHeight = 20; | 20 static CGFloat const kStatusBarHeight = 20; |
| 25 | 21 |
| 26 @interface ARDVideoCallView () <RTCEAGLVideoViewDelegate> | 22 @interface ARDVideoCallView () <RTCEAGLVideoViewDelegate> |
| 27 @end | 23 @end |
| 28 | 24 |
| 29 @implementation ARDVideoCallView { | 25 @implementation ARDVideoCallView { |
| 30 UIButton *_routeChangeButton; | 26 UIButton *_routeChangeButton; |
| 31 UIButton *_cameraSwitchButton; | 27 UIButton *_cameraSwitchButton; |
| 32 UIButton *_hangupButton; | 28 UIButton *_hangupButton; |
| 33 CGSize _remoteVideoSize; | 29 CGSize _remoteVideoSize; |
| 34 BOOL _useRearCamera; | 30 BOOL _useRearCamera; |
| 35 } | 31 } |
| 36 | 32 |
| 37 @synthesize statusLabel = _statusLabel; | 33 @synthesize statusLabel = _statusLabel; |
| 38 @synthesize localVideoView = _localVideoView; | 34 @synthesize localVideoView = _localVideoView; |
| 39 @synthesize remoteVideoView = _remoteVideoView; | 35 @synthesize remoteVideoView = _remoteVideoView; |
| 40 @synthesize statsView = _statsView; | 36 @synthesize statsView = _statsView; |
| 41 @synthesize delegate = _delegate; | 37 @synthesize delegate = _delegate; |
| 42 | 38 |
| 43 - (instancetype)initWithFrame:(CGRect)frame { | 39 - (instancetype)initWithFrame:(CGRect)frame { |
| 44 if (self = [super initWithFrame:frame]) { | 40 if (self = [super initWithFrame:frame]) { |
| 45 | 41 _remoteVideoView = [[RTCEAGLVideoView alloc] initWithFrame:CGRectZero]; |
| 46 #if defined(RTC_SUPPORTS_METAL) | 42 _remoteVideoView.delegate = self; |
| 47 _remoteVideoView = [[RTCMTLVideoView alloc] initWithFrame:CGRectZero]; | |
| 48 #else | |
| 49 RTCEAGLVideoView *remoteView = [[RTCEAGLVideoView alloc] initWithFrame:CGRec
tZero]; | |
| 50 remoteView.delegate = self; | |
| 51 _remoteVideoView = remoteView; | |
| 52 #endif | |
| 53 | |
| 54 [self addSubview:_remoteVideoView]; | 43 [self addSubview:_remoteVideoView]; |
| 55 | 44 |
| 56 _localVideoView = [[RTCCameraPreviewView alloc] initWithFrame:CGRectZero]; | 45 _localVideoView = [[RTCCameraPreviewView alloc] initWithFrame:CGRectZero]; |
| 57 [self addSubview:_localVideoView]; | 46 [self addSubview:_localVideoView]; |
| 58 | 47 |
| 59 _statsView = [[ARDStatsView alloc] initWithFrame:CGRectZero]; | 48 _statsView = [[ARDStatsView alloc] initWithFrame:CGRectZero]; |
| 60 _statsView.hidden = YES; | 49 _statsView.hidden = YES; |
| 61 [self addSubview:_statsView]; | 50 [self addSubview:_statsView]; |
| 62 | 51 |
| 63 _routeChangeButton = [UIButton buttonWithType:UIButtonTypeCustom]; | 52 _routeChangeButton = [UIButton buttonWithType:UIButtonTypeCustom]; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 184 |
| 196 - (void)onHangup:(id)sender { | 185 - (void)onHangup:(id)sender { |
| 197 [_delegate videoCallViewDidHangup:self]; | 186 [_delegate videoCallViewDidHangup:self]; |
| 198 } | 187 } |
| 199 | 188 |
| 200 - (void)didTripleTap:(UITapGestureRecognizer *)recognizer { | 189 - (void)didTripleTap:(UITapGestureRecognizer *)recognizer { |
| 201 [_delegate videoCallViewDidEnableStats:self]; | 190 [_delegate videoCallViewDidEnableStats:self]; |
| 202 } | 191 } |
| 203 | 192 |
| 204 @end | 193 @end |
| OLD | NEW |