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

Side by Side Diff: webrtc/examples/objc/AppRTCMobile/mac/APPRTCViewController.m

Issue 2396333002: Add loopback option and improve UX of AppRTCMobile for Mac. (Closed)
Patch Set: Fix formatting Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2014 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 "APPRTCViewController.h" 11 #import "APPRTCViewController.h"
12 12
13 #import <AVFoundation/AVFoundation.h> 13 #import <AVFoundation/AVFoundation.h>
14 14
15 #import "WebRTC/RTCNSGLVideoView.h" 15 #import "WebRTC/RTCNSGLVideoView.h"
16 #import "WebRTC/RTCVideoTrack.h" 16 #import "WebRTC/RTCVideoTrack.h"
17 17
18 #import "ARDAppClient.h" 18 #import "ARDAppClient.h"
19 19
20 static NSUInteger const kContentWidth = 1280; 20 static NSUInteger const kContentWidth = 900;
21 static NSUInteger const kContentHeight = 720; 21 static NSUInteger const kRoomFieldWidth = 200;
22 static NSUInteger const kRoomFieldWidth = 80; 22 static NSUInteger const kActionItemHeight = 30;
23 static NSUInteger const kLogViewHeight = 280; 23 static NSUInteger const kBottomViewHeight = 200;
24 static NSUInteger const kPreviewWidth = 490;
25 24
26 @class APPRTCMainView; 25 @class APPRTCMainView;
27 @protocol APPRTCMainViewDelegate 26 @protocol APPRTCMainViewDelegate
28 27
29 - (void)appRTCMainView:(APPRTCMainView*)mainView 28 - (void)appRTCMainView:(APPRTCMainView*)mainView
30 didEnterRoomId:(NSString*)roomId; 29 didEnterRoomId:(NSString*)roomId
30 loopback:(BOOL)isLoopback;
31 31
32 @end 32 @end
33 33
34 @interface APPRTCMainView : NSView 34 @interface APPRTCMainView : NSView
35 35
36 @property(nonatomic, weak) id<APPRTCMainViewDelegate> delegate; 36 @property(nonatomic, weak) id<APPRTCMainViewDelegate> delegate;
37 @property(nonatomic, readonly) RTCNSGLVideoView* localVideoView; 37 @property(nonatomic, readonly) RTCNSGLVideoView* localVideoView;
38 @property(nonatomic, readonly) RTCNSGLVideoView* remoteVideoView; 38 @property(nonatomic, readonly) RTCNSGLVideoView* remoteVideoView;
39 39
40 - (void)displayLogMessage:(NSString*)message; 40 - (void)displayLogMessage:(NSString*)message;
41 41
42 @end 42 @end
43 43
44 @interface APPRTCMainView () <NSTextFieldDelegate, RTCNSGLVideoViewDelegate> 44 @interface APPRTCMainView () <NSTextFieldDelegate, RTCNSGLVideoViewDelegate>
45 @end 45 @end
46 @implementation APPRTCMainView { 46 @implementation APPRTCMainView {
47 NSScrollView* _scrollView; 47 NSScrollView* _scrollView;
48 NSTextField* _roomLabel; 48 NSView* _actionItemsView;
49 NSButton* _connectButton;
50 NSButton* _loopbackButton;
49 NSTextField* _roomField; 51 NSTextField* _roomField;
50 NSTextView* _logView; 52 NSTextView* _logView;
51 CGSize _localVideoSize; 53 CGSize _localVideoSize;
52 CGSize _remoteVideoSize; 54 CGSize _remoteVideoSize;
53 } 55 }
54 56
55 @synthesize delegate = _delegate; 57 @synthesize delegate = _delegate;
56 @synthesize localVideoView = _localVideoView; 58 @synthesize localVideoView = _localVideoView;
57 @synthesize remoteVideoView = _remoteVideoView; 59 @synthesize remoteVideoView = _remoteVideoView;
58 60
59 + (BOOL)requiresConstraintBasedLayout { 61
60 return YES; 62 - (void)displayLogMessage:(NSString *)message {
63 _logView.string =
64 [NSString stringWithFormat:@"%@%@\n", _logView.string, message];
65 NSRange range = NSMakeRange(_logView.string.length, 0);
66 [_logView scrollRangeToVisible:range];
61 } 67 }
62 68
69 #pragma mark - Private
70
63 - (instancetype)initWithFrame:(NSRect)frame { 71 - (instancetype)initWithFrame:(NSRect)frame {
64 if (self = [super initWithFrame:frame]) { 72 if (self = [super initWithFrame:frame]) {
65 [self setupViews]; 73 [self setupViews];
66 } 74 }
67 return self; 75 return self;
68 } 76 }
69 77
78 + (BOOL)requiresConstraintBasedLayout {
79 return YES;
80 }
81
70 - (void)updateConstraints { 82 - (void)updateConstraints {
71 NSParameterAssert( 83 NSParameterAssert(
72 _roomField != nil && _scrollView != nil && _remoteVideoView != nil); 84 _roomField != nil &&
85 _scrollView != nil &&
86 _remoteVideoView != nil &&
87 _localVideoView != nil &&
88 _actionItemsView!= nil &&
89 _connectButton != nil &&
90 _loopbackButton != nil);
91
73 [self removeConstraints:[self constraints]]; 92 [self removeConstraints:[self constraints]];
74 NSDictionary* viewsDictionary = 93 NSDictionary* viewsDictionary =
75 NSDictionaryOfVariableBindings(_roomLabel, 94 NSDictionaryOfVariableBindings(_roomField,
76 _roomField,
77 _scrollView, 95 _scrollView,
78 _remoteVideoView, 96 _remoteVideoView,
79 _localVideoView); 97 _localVideoView,
98 _actionItemsView,
99 _connectButton,
100 _loopbackButton);
80 101
81 NSSize remoteViewSize = [self remoteVideoViewSize]; 102 NSSize remoteViewSize = [self remoteVideoViewSize];
82 NSDictionary* metrics = @{ 103 NSDictionary* metrics = @{
83 @"kLogViewHeight" : @(kLogViewHeight),
84 @"kPreviewWidth" : @(kPreviewWidth),
85 @"kRoomFieldWidth" : @(kRoomFieldWidth),
86 @"remoteViewWidth" : @(remoteViewSize.width), 104 @"remoteViewWidth" : @(remoteViewSize.width),
87 @"remoteViewHeight" : @(remoteViewSize.height), 105 @"remoteViewHeight" : @(remoteViewSize.height),
88 @"localViewHeight" : @(remoteViewSize.height), 106 @"kBottomViewHeight" : @(kBottomViewHeight),
89 @"scrollViewWidth" : @(kContentWidth - kPreviewWidth), 107 @"localViewHeight" : @(remoteViewSize.height / 3),
108 @"localViewWidth" : @(remoteViewSize.width / 3),
109 @"kRoomFieldWidth" : @(kRoomFieldWidth),
110 @"kActionItemHeight" : @(kActionItemHeight)
90 }; 111 };
91 // Declare this separately to avoid compiler warning about splitting string 112 // Declare this separately to avoid compiler warning about splitting string
92 // within an NSArray expression. 113 // within an NSArray expression.
93 NSString* verticalConstraint = 114 NSString* verticalConstraintLeft =
94 @"V:|-[_roomLabel]-[_roomField]-[_scrollView(kLogViewHeight)]" 115 @"V:|-[_remoteVideoView(remoteViewHeight)]-[_scrollView(kBottomViewHeight) ]-|";
95 "-[_remoteVideoView(remoteViewHeight)]-|"; 116 NSString* verticalConstraintRight =
117 @"V:|-[_remoteVideoView(remoteViewHeight)]-[_actionItemsView(kBottomViewHe ight)]-|";
96 NSArray* constraintFormats = @[ 118 NSArray* constraintFormats = @[
97 verticalConstraint, 119 verticalConstraintLeft,
98 @"V:[_localVideoView]-[_remoteVideoView]", 120 verticalConstraintRight,
99 @"V:[_localVideoView(kLogViewHeight)]", 121 @"H:|-[_remoteVideoView(remoteViewWidth)]-|",
100 @"|-[_roomLabel]", 122 @"V:|-[_localVideoView(localViewHeight)]",
101 @"|-[_roomField(kRoomFieldWidth)]", 123 @"H:|-[_localVideoView(localViewWidth)]",
102 @"|-[_scrollView(scrollViewWidth)]", 124 @"H:|-[_scrollView(==_actionItemsView)]-[_actionItemsView]-|"
103 @"[_scrollView]-[_localVideoView]",
104 @"|-[_remoteVideoView(remoteViewWidth)]-|",
105 @"[_localVideoView(kPreviewWidth)]-|",
106 ]; 125 ];
107 for (NSString* constraintFormat in constraintFormats) { 126
108 NSArray* constraints = 127 NSArray* actionItemsConstraints = @[
109 [NSLayoutConstraint constraintsWithVisualFormat:constraintFormat 128 @"H:|-[_roomField(kRoomFieldWidth)]-[_loopbackButton(kRoomFieldWidth)]",
110 options:0 129 @"H:|-[_connectButton(kRoomFieldWidth)]",
111 metrics:metrics 130 @"V:|-[_roomField(kActionItemHeight)]-[_connectButton(kActionItemHeight)]" ,
112 views:viewsDictionary]; 131 @"V:|-[_loopbackButton(kActionItemHeight)]",
113 for (NSLayoutConstraint* constraint in constraints) { 132 ];
114 [self addConstraint:constraint]; 133
115 } 134 [APPRTCMainView addConstraints:constraintFormats
116 } 135 toView:self
136 viewsDictionary:viewsDictionary
137 metrics:metrics];
138 [APPRTCMainView addConstraints:actionItemsConstraints
139 toView:_actionItemsView
140 viewsDictionary:viewsDictionary
141 metrics:metrics];
117 [super updateConstraints]; 142 [super updateConstraints];
118 } 143 }
119 144
120 - (void)displayLogMessage:(NSString*)message { 145 #pragma mark - Constraints helper
121 _logView.string =
122 [NSString stringWithFormat:@"%@%@\n", _logView.string, message];
123 NSRange range = NSMakeRange([_logView.string length], 0);
124 [_logView scrollRangeToVisible:range];
125 }
126 146
127 #pragma mark - NSControl delegate 147 + (void)addConstraints:(NSArray*)constraints toView:(NSView*)view
128 148 viewsDictionary:(NSDictionary*)viewsDictionary
129 - (void)controlTextDidEndEditing:(NSNotification*)notification { 149 metrics:(NSDictionary*)metrics {
130 NSDictionary* userInfo = [notification userInfo]; 150 for (NSString* constraintFormat in constraints) {
131 NSInteger textMovement = [userInfo[@"NSTextMovement"] intValue]; 151 NSArray* constraints =
132 if (textMovement == NSReturnTextMovement) { 152 [NSLayoutConstraint constraintsWithVisualFormat:constraintFormat
133 [self.delegate appRTCMainView:self didEnterRoomId:_roomField.stringValue]; 153 options:0
154 metrics:metrics
155 views:viewsDictionary];
156 for (NSLayoutConstraint* constraint in constraints) {
157 [view addConstraint:constraint];
158 }
134 } 159 }
135 } 160 }
136 161
162 #pragma mark - Control actions
163
164 - (void)startCall:(id)sender {
165 NSString* roomString = _roomField.stringValue;
166 // Generate room id for loopback options.
167 if (_loopbackButton.intValue && [roomString isEqualToString:@""]) {
168 roomString = [NSUUID UUID].UUIDString;
169 roomString = [roomString stringByReplacingOccurrencesOfString:@"-" withStrin g:@""];
170 }
171
172 [self.delegate appRTCMainView:self
173 didEnterRoomId:roomString
174 loopback:_loopbackButton.intValue];
175 }
176
137 #pragma mark - RTCNSGLVideoViewDelegate 177 #pragma mark - RTCNSGLVideoViewDelegate
138 178
139 - (void)videoView:(RTCNSGLVideoView*)videoView 179 - (void)videoView:(RTCNSGLVideoView*)videoView
140 didChangeVideoSize:(NSSize)size { 180 didChangeVideoSize:(NSSize)size {
141 if (videoView == _remoteVideoView) { 181 if (videoView == _remoteVideoView) {
142 _remoteVideoSize = size; 182 _remoteVideoSize = size;
143 } else if (videoView == _localVideoView) { 183 } else if (videoView == _localVideoView) {
144 _localVideoSize = size; 184 _localVideoSize = size;
145 } else { 185 } else {
146 return; 186 return;
147 } 187 }
188
148 [self setNeedsUpdateConstraints:YES]; 189 [self setNeedsUpdateConstraints:YES];
149 } 190 }
150 191
151 #pragma mark - Private 192 #pragma mark - Private
152 193
153 - (void)setupViews { 194 - (void)setupViews {
154 NSParameterAssert([[self subviews] count] == 0); 195 NSParameterAssert([[self subviews] count] == 0);
155 196
156 _roomLabel = [[NSTextField alloc] initWithFrame:NSZeroRect];
157 [_roomLabel setTranslatesAutoresizingMaskIntoConstraints:NO];
158 [_roomLabel setBezeled:NO];
159 [_roomLabel setDrawsBackground:NO];
160 [_roomLabel setEditable:NO];
161 [_roomLabel setStringValue:@"Enter AppRTC room id:"];
162 [self addSubview:_roomLabel];
163
164 _roomField = [[NSTextField alloc] initWithFrame:NSZeroRect];
165 [_roomField setTranslatesAutoresizingMaskIntoConstraints:NO];
166 [self addSubview:_roomField];
167 [_roomField setEditable:YES];
168 [_roomField setDelegate:self];
169
170 _logView = [[NSTextView alloc] initWithFrame:NSZeroRect]; 197 _logView = [[NSTextView alloc] initWithFrame:NSZeroRect];
171 [_logView setMinSize:NSMakeSize(0, kLogViewHeight)]; 198 [_logView setMinSize:NSMakeSize(0, kBottomViewHeight)];
172 [_logView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)]; 199 [_logView setMaxSize:NSMakeSize(FLT_MAX, FLT_MAX)];
173 [_logView setVerticallyResizable:YES]; 200 [_logView setVerticallyResizable:YES];
174 [_logView setAutoresizingMask:NSViewWidthSizable]; 201 [_logView setAutoresizingMask:NSViewWidthSizable];
175 NSTextContainer* textContainer = [_logView textContainer]; 202 NSTextContainer* textContainer = [_logView textContainer];
176 NSSize containerSize = NSMakeSize(kContentWidth, FLT_MAX); 203 NSSize containerSize = NSMakeSize(kContentWidth, FLT_MAX);
177 [textContainer setContainerSize:containerSize]; 204 [textContainer setContainerSize:containerSize];
178 [textContainer setWidthTracksTextView:YES]; 205 [textContainer setWidthTracksTextView:YES];
179 [_logView setEditable:NO]; 206 [_logView setEditable:NO];
180 207
208 [self setupActionItemsView];
209
181 _scrollView = [[NSScrollView alloc] initWithFrame:NSZeroRect]; 210 _scrollView = [[NSScrollView alloc] initWithFrame:NSZeroRect];
182 [_scrollView setTranslatesAutoresizingMaskIntoConstraints:NO]; 211 [_scrollView setTranslatesAutoresizingMaskIntoConstraints:NO];
183 [_scrollView setHasVerticalScroller:YES]; 212 [_scrollView setHasVerticalScroller:YES];
184 [_scrollView setDocumentView:_logView]; 213 [_scrollView setDocumentView:_logView];
185 [self addSubview:_scrollView]; 214 [self addSubview:_scrollView];
186 215
187 NSOpenGLPixelFormatAttribute attributes[] = { 216 NSOpenGLPixelFormatAttribute attributes[] = {
188 NSOpenGLPFADoubleBuffer, 217 NSOpenGLPFADoubleBuffer,
189 NSOpenGLPFADepthSize, 24, 218 NSOpenGLPFADepthSize, 24,
190 NSOpenGLPFAOpenGLProfile, 219 NSOpenGLPFAOpenGLProfile,
191 NSOpenGLProfileVersion3_2Core, 220 NSOpenGLProfileVersion3_2Core,
192 0 221 0
193 }; 222 };
194 NSOpenGLPixelFormat* pixelFormat = 223 NSOpenGLPixelFormat* pixelFormat =
195 [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; 224 [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
196 _remoteVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect 225 _remoteVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect
197 pixelFormat:pixelFormat]; 226 pixelFormat:pixelFormat];
198 [_remoteVideoView setTranslatesAutoresizingMaskIntoConstraints:NO]; 227 [_remoteVideoView setTranslatesAutoresizingMaskIntoConstraints:NO];
199 _remoteVideoView.delegate = self; 228 _remoteVideoView.delegate = self;
200 [self addSubview:_remoteVideoView]; 229 [self addSubview:_remoteVideoView];
201 230
202 _localVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect 231 _localVideoView = [[RTCNSGLVideoView alloc] initWithFrame:NSZeroRect
203 pixelFormat:pixelFormat]; 232 pixelFormat:pixelFormat];
204 [_localVideoView setTranslatesAutoresizingMaskIntoConstraints:NO]; 233 [_localVideoView setTranslatesAutoresizingMaskIntoConstraints:NO];
205 _localVideoView.delegate = self; 234 _localVideoView.delegate = self;
206 [self addSubview:_localVideoView]; 235 [self addSubview:_localVideoView];
207 } 236 }
208 237
238 - (void)setupActionItemsView {
239 _actionItemsView = [[NSView alloc] initWithFrame:NSZeroRect];
240 [_actionItemsView setTranslatesAutoresizingMaskIntoConstraints:NO];
241 [self addSubview:_actionItemsView];
242
243 _roomField = [[NSTextField alloc] initWithFrame:NSZeroRect];
244 [_roomField setTranslatesAutoresizingMaskIntoConstraints:NO];
245 _roomField.placeholderString = @"Enter AppRTC room id";
246 [_actionItemsView addSubview:_roomField];
247 [_roomField setEditable:YES];
248
249 _connectButton = [[NSButton alloc] initWithFrame:NSZeroRect];
250 [_connectButton setTranslatesAutoresizingMaskIntoConstraints:NO];
251 _connectButton.title = @"Start call";
252 _connectButton.bezelStyle = NSRoundedBezelStyle;
253 _connectButton.target = self;
254 _connectButton.action = @selector(startCall:);
255 [_actionItemsView addSubview:_connectButton];
256
257 _loopbackButton = [[NSButton alloc] initWithFrame:NSZeroRect];
258 [_loopbackButton setTranslatesAutoresizingMaskIntoConstraints:NO];
259 _loopbackButton.title = @"Loopback";
260 [_loopbackButton setButtonType:NSSwitchButton];
261 [_actionItemsView addSubview:_loopbackButton];
262 }
263
209 - (NSSize)remoteVideoViewSize { 264 - (NSSize)remoteVideoViewSize {
210 NSInteger width = MAX(_remoteVideoSize.width, kContentWidth); 265 if (!_remoteVideoView.bounds.size.width) {
266 return NSMakeSize(kContentWidth, 0);
267 }
268 NSInteger width = MAX(_remoteVideoView.bounds.size.width, kContentWidth);
211 NSInteger height = (width/16) * 9; 269 NSInteger height = (width/16) * 9;
212 return NSMakeSize(width, height); 270 return NSMakeSize(width, height);
213 } 271 }
214 272
215 @end 273 @end
216 274
217 @interface APPRTCViewController () 275 @interface APPRTCViewController ()
218 <ARDAppClientDelegate, APPRTCMainViewDelegate> 276 <ARDAppClientDelegate, APPRTCMainViewDelegate>
219 @property(nonatomic, readonly) APPRTCMainView* mainView; 277 @property(nonatomic, readonly) APPRTCMainView* mainView;
220 @end 278 @end
221 279
222 @implementation APPRTCViewController { 280 @implementation APPRTCViewController {
223 ARDAppClient* _client; 281 ARDAppClient* _client;
224 RTCVideoTrack* _localVideoTrack; 282 RTCVideoTrack* _localVideoTrack;
225 RTCVideoTrack* _remoteVideoTrack; 283 RTCVideoTrack* _remoteVideoTrack;
226 } 284 }
227 285
228 - (void)dealloc { 286 - (void)dealloc {
229 [self disconnect]; 287 [self disconnect];
230 } 288 }
231 289
290 - (void)viewDidAppear {
291 [super viewDidAppear];
292 [self displayUsageInstructions];
293 }
294
232 - (void)loadView { 295 - (void)loadView {
233 APPRTCMainView* view = [[APPRTCMainView alloc] initWithFrame:NSZeroRect]; 296 APPRTCMainView* view = [[APPRTCMainView alloc] initWithFrame:NSZeroRect];
234 [view setTranslatesAutoresizingMaskIntoConstraints:NO]; 297 [view setTranslatesAutoresizingMaskIntoConstraints:NO];
235 view.delegate = self; 298 view.delegate = self;
236 self.view = view; 299 self.view = view;
237 } 300 }
238 301
239 - (void)windowWillClose:(NSNotification*)notification { 302 - (void)windowWillClose:(NSNotification*)notification {
240 [self disconnect]; 303 [self disconnect];
241 } 304 }
242 305
306 #pragma mark - Usage
307
308 - (void)displayUsageInstructions {
309 [self.mainView displayLogMessage:
310 @"To start call:\n"
311 @"• Enter AppRTC room id (not neccessary for loopback)\n"
312 @"• Start call"];
313 }
314
243 #pragma mark - ARDAppClientDelegate 315 #pragma mark - ARDAppClientDelegate
244 316
245 - (void)appClient:(ARDAppClient *)client 317 - (void)appClient:(ARDAppClient *)client
246 didChangeState:(ARDAppClientState)state { 318 didChangeState:(ARDAppClientState)state {
247 switch (state) { 319 switch (state) {
248 case kARDAppClientStateConnected: 320 case kARDAppClientStateConnected:
249 NSLog(@"Client connected."); 321 [self.mainView displayLogMessage:@"Client connected."];
250 break; 322 break;
251 case kARDAppClientStateConnecting: 323 case kARDAppClientStateConnecting:
252 NSLog(@"Client connecting."); 324 [self.mainView displayLogMessage:@"Client connecting."];
253 break; 325 break;
254 case kARDAppClientStateDisconnected: 326 case kARDAppClientStateDisconnected:
255 NSLog(@"Client disconnected."); 327 [self.mainView displayLogMessage:@"Client disconnected."];
256 [self resetUI]; 328 [self resetUI];
257 _client = nil; 329 _client = nil;
258 break; 330 break;
259 } 331 }
260 } 332 }
261 333
262 - (void)appClient:(ARDAppClient *)client 334 - (void)appClient:(ARDAppClient *)client
263 didChangeConnectionState:(RTCIceConnectionState)state { 335 didChangeConnectionState:(RTCIceConnectionState)state {
264 } 336 }
265 337
(...skipping 15 matching lines...) Expand all
281 [self disconnect]; 353 [self disconnect];
282 } 354 }
283 355
284 - (void)appClient:(ARDAppClient *)client 356 - (void)appClient:(ARDAppClient *)client
285 didGetStats:(NSArray *)stats { 357 didGetStats:(NSArray *)stats {
286 } 358 }
287 359
288 #pragma mark - APPRTCMainViewDelegate 360 #pragma mark - APPRTCMainViewDelegate
289 361
290 - (void)appRTCMainView:(APPRTCMainView*)mainView 362 - (void)appRTCMainView:(APPRTCMainView*)mainView
291 didEnterRoomId:(NSString*)roomId { 363 didEnterRoomId:(NSString*)roomId
364 loopback:(BOOL)isLoopback {
365
366 if ([roomId isEqualToString:@""]) {
367 [self.mainView displayLogMessage:@"Missing room id"];
368 return;
369 }
370
292 [_client disconnect]; 371 [_client disconnect];
293 ARDAppClient *client = [[ARDAppClient alloc] initWithDelegate:self]; 372 ARDAppClient *client = [[ARDAppClient alloc] initWithDelegate:self];
294 [client connectToRoomWithId:roomId 373 [client connectToRoomWithId:roomId
295 isLoopback:NO 374 isLoopback:isLoopback
296 isAudioOnly:NO 375 isAudioOnly:NO
297 shouldMakeAecDump:NO 376 shouldMakeAecDump:NO
298 shouldUseLevelControl:NO]; 377 shouldUseLevelControl:NO];
299 _client = client; 378 _client = client;
300 } 379 }
301 380
302 #pragma mark - Private 381 #pragma mark - Private
303 382
304 - (APPRTCMainView*)mainView { 383 - (APPRTCMainView*)mainView {
305 return (APPRTCMainView*)self.view; 384 return (APPRTCMainView*)self.view;
(...skipping 13 matching lines...) Expand all
319 [self.mainView.remoteVideoView renderFrame:nil]; 398 [self.mainView.remoteVideoView renderFrame:nil];
320 [self.mainView.localVideoView renderFrame:nil]; 399 [self.mainView.localVideoView renderFrame:nil];
321 } 400 }
322 401
323 - (void)disconnect { 402 - (void)disconnect {
324 [self resetUI]; 403 [self resetUI];
325 [_client disconnect]; 404 [_client disconnect];
326 } 405 }
327 406
328 @end 407 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698