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 "ARDMainViewController.h" | 11 #import "ARDMainViewController.h" |
12 | 12 |
13 #import <AVFoundation/AVFoundation.h> | 13 #import <AVFoundation/AVFoundation.h> |
14 | 14 |
15 #import "WebRTC/RTCDispatcher.h" | 15 #import "WebRTC/RTCDispatcher.h" |
16 #import "WebRTC/RTCLogging.h" | 16 #import "WebRTC/RTCLogging.h" |
17 #import "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h" | 17 #import "webrtc/modules/audio_device/ios/objc/RTCAudioSession.h" |
18 #import "webrtc/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.h" | 18 #import "webrtc/modules/audio_device/ios/objc/RTCAudioSessionConfiguration.h" |
19 | 19 |
20 #import "ARDAppClient.h" | 20 #import "ARDAppClient.h" |
21 #import "ARDMainView.h" | 21 #import "ARDMainView.h" |
| 22 #import "ARDMediaConstraintsModel.h" |
| 23 #import "ARDSettingsViewController.h" |
22 #import "ARDVideoCallViewController.h" | 24 #import "ARDVideoCallViewController.h" |
23 | 25 |
24 static NSString *barButtonImageString = @"ic_settings_black_24dp.png"; | 26 static NSString *const barButtonImageString = @"ic_settings_black_24dp.png"; |
25 | 27 |
26 @interface ARDMainViewController () < | 28 @interface ARDMainViewController () < |
27 ARDMainViewDelegate, | 29 ARDMainViewDelegate, |
28 ARDVideoCallViewControllerDelegate, | 30 ARDVideoCallViewControllerDelegate, |
29 RTCAudioSessionDelegate> | 31 RTCAudioSessionDelegate> |
30 @end | 32 @end |
31 | 33 |
32 @implementation ARDMainViewController { | 34 @implementation ARDMainViewController { |
33 ARDMainView *_mainView; | 35 ARDMainView *_mainView; |
34 AVAudioPlayer *_audioPlayer; | 36 AVAudioPlayer *_audioPlayer; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // WebRTC is done with the audio session. Restart playback. | 164 // WebRTC is done with the audio session. Restart playback. |
163 [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeMain | 165 [RTCDispatcher dispatchAsyncOnType:RTCDispatcherTypeMain |
164 block:^{ | 166 block:^{ |
165 RTCLog(@"audioSessionDidStopPlayOrRecord"); | 167 RTCLog(@"audioSessionDidStopPlayOrRecord"); |
166 [self restartAudioPlayerIfNeeded]; | 168 [self restartAudioPlayerIfNeeded]; |
167 }]; | 169 }]; |
168 } | 170 } |
169 | 171 |
170 #pragma mark - Private | 172 #pragma mark - Private |
171 - (void)showSettings:(id)sender { | 173 - (void)showSettings:(id)sender { |
| 174 ARDSettingsViewController *settingsController = |
| 175 [[ARDSettingsViewController alloc] initWithStyle:UITableViewStylePlain |
| 176 mediaConstraintsModel:[[ARDMediaConstraintsMode
l alloc] init]]; |
| 177 UINavigationController *navigationController = |
| 178 [[UINavigationController alloc] initWithRootViewController:settingsControl
ler]; |
| 179 [self presentViewControllerAsModal:navigationController]; |
| 180 } |
| 181 |
| 182 - (void)presentViewControllerAsModal:(UIViewController *)viewController { |
| 183 [self presentViewController:viewController animated:YES completion:nil]; |
172 } | 184 } |
173 | 185 |
174 - (void)configureAudioSession { | 186 - (void)configureAudioSession { |
175 RTCAudioSessionConfiguration *configuration = | 187 RTCAudioSessionConfiguration *configuration = |
176 [[RTCAudioSessionConfiguration alloc] init]; | 188 [[RTCAudioSessionConfiguration alloc] init]; |
177 configuration.category = AVAudioSessionCategoryAmbient; | 189 configuration.category = AVAudioSessionCategoryAmbient; |
178 configuration.categoryOptions = AVAudioSessionCategoryOptionDuckOthers; | 190 configuration.categoryOptions = AVAudioSessionCategoryOptionDuckOthers; |
179 configuration.mode = AVAudioSessionModeDefault; | 191 configuration.mode = AVAudioSessionModeDefault; |
180 | 192 |
181 RTCAudioSession *session = [RTCAudioSession sharedInstance]; | 193 RTCAudioSession *session = [RTCAudioSession sharedInstance]; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 - (void)showAlertWithMessage:(NSString*)message { | 229 - (void)showAlertWithMessage:(NSString*)message { |
218 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil | 230 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil |
219 message:message | 231 message:message |
220 delegate:nil | 232 delegate:nil |
221 cancelButtonTitle:@"OK" | 233 cancelButtonTitle:@"OK" |
222 otherButtonTitles:nil]; | 234 otherButtonTitles:nil]; |
223 [alertView show]; | 235 [alertView show]; |
224 } | 236 } |
225 | 237 |
226 @end | 238 @end |
OLD | NEW |