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

Side by Side Diff: webrtc/examples/objc/AppRTCDemo/ios/ARDVideoCallViewController.m

Issue 1690313002: Update iOS AppRTCDemo to use the updated Objective-C API. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Update Mac demo and other changes after updating against master Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 "ARDVideoCallViewController.h" 11 #import "ARDVideoCallViewController.h"
12 12
13 #import "RTCAVFoundationVideoSource.h" 13 #import "webrtc/api/objc/RTCAVFoundationVideoSource.h"
14 #import "RTCLogging.h" 14 #import "webrtc/base/objc/RTCLogging.h"
15 15
16 #import "ARDAppClient.h" 16 #import "ARDAppClient.h"
17 #import "ARDVideoCallView.h" 17 #import "ARDVideoCallView.h"
18 18
19 @interface ARDVideoCallViewController () <ARDAppClientDelegate, 19 @interface ARDVideoCallViewController () <ARDAppClientDelegate,
20 ARDVideoCallViewDelegate> 20 ARDVideoCallViewDelegate>
21 @property(nonatomic, strong) RTCVideoTrack *localVideoTrack; 21 @property(nonatomic, strong) RTCVideoTrack *localVideoTrack;
22 @property(nonatomic, strong) RTCVideoTrack *remoteVideoTrack; 22 @property(nonatomic, strong) RTCVideoTrack *remoteVideoTrack;
23 @property(nonatomic, readonly) ARDVideoCallView *videoCallView; 23 @property(nonatomic, readonly) ARDVideoCallView *videoCallView;
24 @end 24 @end
(...skipping 15 matching lines...) Expand all
40 isLoopback:isLoopback 40 isLoopback:isLoopback
41 isAudioOnly:isAudioOnly]; 41 isAudioOnly:isAudioOnly];
42 } 42 }
43 return self; 43 return self;
44 } 44 }
45 45
46 - (void)loadView { 46 - (void)loadView {
47 _videoCallView = [[ARDVideoCallView alloc] initWithFrame:CGRectZero]; 47 _videoCallView = [[ARDVideoCallView alloc] initWithFrame:CGRectZero];
48 _videoCallView.delegate = self; 48 _videoCallView.delegate = self;
49 _videoCallView.statusLabel.text = 49 _videoCallView.statusLabel.text =
50 [self statusTextForState:RTCICEConnectionNew]; 50 [self statusTextForState:RTCIceConnectionStateNew];
51 self.view = _videoCallView; 51 self.view = _videoCallView;
52 } 52 }
53 53
54 #pragma mark - ARDAppClientDelegate 54 #pragma mark - ARDAppClientDelegate
55 55
56 - (void)appClient:(ARDAppClient *)client 56 - (void)appClient:(ARDAppClient *)client
57 didChangeState:(ARDAppClientState)state { 57 didChangeState:(ARDAppClientState)state {
58 switch (state) { 58 switch (state) {
59 case kARDAppClientStateConnected: 59 case kARDAppClientStateConnected:
60 RTCLog(@"Client connected."); 60 RTCLog(@"Client connected.");
61 break; 61 break;
62 case kARDAppClientStateConnecting: 62 case kARDAppClientStateConnecting:
63 RTCLog(@"Client connecting."); 63 RTCLog(@"Client connecting.");
64 break; 64 break;
65 case kARDAppClientStateDisconnected: 65 case kARDAppClientStateDisconnected:
66 RTCLog(@"Client disconnected."); 66 RTCLog(@"Client disconnected.");
67 [self hangup]; 67 [self hangup];
68 break; 68 break;
69 } 69 }
70 } 70 }
71 71
72 - (void)appClient:(ARDAppClient *)client 72 - (void)appClient:(ARDAppClient *)client
73 didChangeConnectionState:(RTCICEConnectionState)state { 73 didChangeConnectionState:(RTCIceConnectionState)state {
74 RTCLog(@"ICE state changed: %d", state); 74 RTCLog(@"ICE state changed: %d", state);
75 __weak ARDVideoCallViewController *weakSelf = self; 75 __weak ARDVideoCallViewController *weakSelf = self;
76 dispatch_async(dispatch_get_main_queue(), ^{ 76 dispatch_async(dispatch_get_main_queue(), ^{
77 ARDVideoCallViewController *strongSelf = weakSelf; 77 ARDVideoCallViewController *strongSelf = weakSelf;
78 strongSelf.videoCallView.statusLabel.text = 78 strongSelf.videoCallView.statusLabel.text =
79 [strongSelf statusTextForState:state]; 79 [strongSelf statusTextForState:state];
80 }); 80 });
81 } 81 }
82 82
83 - (void)appClient:(ARDAppClient *)client 83 - (void)appClient:(ARDAppClient *)client
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 - (void)switchCamera { 162 - (void)switchCamera {
163 RTCVideoSource* source = self.localVideoTrack.source; 163 RTCVideoSource* source = self.localVideoTrack.source;
164 if ([source isKindOfClass:[RTCAVFoundationVideoSource class]]) { 164 if ([source isKindOfClass:[RTCAVFoundationVideoSource class]]) {
165 RTCAVFoundationVideoSource* avSource = (RTCAVFoundationVideoSource*)source; 165 RTCAVFoundationVideoSource* avSource = (RTCAVFoundationVideoSource*)source;
166 avSource.useBackCamera = !avSource.useBackCamera; 166 avSource.useBackCamera = !avSource.useBackCamera;
167 _videoCallView.localVideoView.transform = avSource.useBackCamera ? 167 _videoCallView.localVideoView.transform = avSource.useBackCamera ?
168 CGAffineTransformIdentity : CGAffineTransformMakeScale(-1, 1); 168 CGAffineTransformIdentity : CGAffineTransformMakeScale(-1, 1);
169 } 169 }
170 } 170 }
171 171
172 - (NSString *)statusTextForState:(RTCICEConnectionState)state { 172 - (NSString *)statusTextForState:(RTCIceConnectionState)state {
173 switch (state) { 173 switch (state) {
174 case RTCICEConnectionNew: 174 case RTCIceConnectionStateNew:
175 case RTCICEConnectionChecking: 175 case RTCIceConnectionStateChecking:
176 return @"Connecting..."; 176 return @"Connecting...";
177 case RTCICEConnectionConnected: 177 case RTCIceConnectionStateConnected:
178 case RTCICEConnectionCompleted: 178 case RTCIceConnectionStateCompleted:
179 case RTCICEConnectionFailed: 179 case RTCIceConnectionStateFailed:
180 case RTCICEConnectionDisconnected: 180 case RTCIceConnectionStateDisconnected:
181 case RTCICEConnectionClosed: 181 case RTCIceConnectionStateClosed:
182 case RTCICEConnectionMax: 182 case RTCIceConnectionStateMax:
tkchin_webrtc 2016/03/08 19:51:22 nit: any chance we can rename this to RTCIceConnec
hjon_webrtc 2016/03/10 03:32:43 Seems fine to me. Separate CL or as part of this o
183 return nil; 183 return nil;
184 } 184 }
185 } 185 }
186 186
187 - (void)showAlertWithMessage:(NSString*)message { 187 - (void)showAlertWithMessage:(NSString*)message {
188 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil 188 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil
189 message:message 189 message:message
190 delegate:nil 190 delegate:nil
191 cancelButtonTitle:@"OK" 191 cancelButtonTitle:@"OK"
192 otherButtonTitles:nil]; 192 otherButtonTitles:nil];
193 [alertView show]; 193 [alertView show];
194 } 194 }
195 195
196 @end 196 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698