OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 12 matching lines...) Expand all Loading... |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | 23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | 24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #import "ARDVideoCallViewController.h" | 28 #import "ARDVideoCallViewController.h" |
29 | 29 |
30 #import "RTCAVFoundationVideoSource.h" | 30 #import "RTCAVFoundationVideoSource.h" |
31 | 31 |
32 #import "ARDAppClient.h" | 32 #import "ARDAppClient.h" |
| 33 #import "ARDLogging.h" |
33 #import "ARDVideoCallView.h" | 34 #import "ARDVideoCallView.h" |
34 | 35 |
35 @interface ARDVideoCallViewController () <ARDAppClientDelegate, | 36 @interface ARDVideoCallViewController () <ARDAppClientDelegate, |
36 ARDVideoCallViewDelegate> | 37 ARDVideoCallViewDelegate> |
37 @property(nonatomic, strong) RTCVideoTrack *localVideoTrack; | 38 @property(nonatomic, strong) RTCVideoTrack *localVideoTrack; |
38 @property(nonatomic, strong) RTCVideoTrack *remoteVideoTrack; | 39 @property(nonatomic, strong) RTCVideoTrack *remoteVideoTrack; |
39 @property(nonatomic, readonly) ARDVideoCallView *videoCallView; | 40 @property(nonatomic, readonly) ARDVideoCallView *videoCallView; |
40 @end | 41 @end |
41 | 42 |
42 @implementation ARDVideoCallViewController { | 43 @implementation ARDVideoCallViewController { |
(...skipping 19 matching lines...) Expand all Loading... |
62 [self statusTextForState:RTCICEConnectionNew]; | 63 [self statusTextForState:RTCICEConnectionNew]; |
63 self.view = _videoCallView; | 64 self.view = _videoCallView; |
64 } | 65 } |
65 | 66 |
66 #pragma mark - ARDAppClientDelegate | 67 #pragma mark - ARDAppClientDelegate |
67 | 68 |
68 - (void)appClient:(ARDAppClient *)client | 69 - (void)appClient:(ARDAppClient *)client |
69 didChangeState:(ARDAppClientState)state { | 70 didChangeState:(ARDAppClientState)state { |
70 switch (state) { | 71 switch (state) { |
71 case kARDAppClientStateConnected: | 72 case kARDAppClientStateConnected: |
72 NSLog(@"Client connected."); | 73 ARDLog(@"Client connected."); |
73 break; | 74 break; |
74 case kARDAppClientStateConnecting: | 75 case kARDAppClientStateConnecting: |
75 NSLog(@"Client connecting."); | 76 ARDLog(@"Client connecting."); |
76 break; | 77 break; |
77 case kARDAppClientStateDisconnected: | 78 case kARDAppClientStateDisconnected: |
78 NSLog(@"Client disconnected."); | 79 ARDLog(@"Client disconnected."); |
79 [self hangup]; | 80 [self hangup]; |
80 break; | 81 break; |
81 } | 82 } |
82 } | 83 } |
83 | 84 |
84 - (void)appClient:(ARDAppClient *)client | 85 - (void)appClient:(ARDAppClient *)client |
85 didChangeConnectionState:(RTCICEConnectionState)state { | 86 didChangeConnectionState:(RTCICEConnectionState)state { |
86 NSLog(@"ICE state changed: %d", state); | 87 ARDLog(@"ICE state changed: %d", state); |
87 __weak ARDVideoCallViewController *weakSelf = self; | 88 __weak ARDVideoCallViewController *weakSelf = self; |
88 dispatch_async(dispatch_get_main_queue(), ^{ | 89 dispatch_async(dispatch_get_main_queue(), ^{ |
89 ARDVideoCallViewController *strongSelf = weakSelf; | 90 ARDVideoCallViewController *strongSelf = weakSelf; |
90 strongSelf.videoCallView.statusLabel.text = | 91 strongSelf.videoCallView.statusLabel.text = |
91 [strongSelf statusTextForState:state]; | 92 [strongSelf statusTextForState:state]; |
92 }); | 93 }); |
93 } | 94 } |
94 | 95 |
95 - (void)appClient:(ARDAppClient *)client | 96 - (void)appClient:(ARDAppClient *)client |
96 didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack { | 97 didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 - (void)showAlertWithMessage:(NSString*)message { | 185 - (void)showAlertWithMessage:(NSString*)message { |
185 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil | 186 UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil |
186 message:message | 187 message:message |
187 delegate:nil | 188 delegate:nil |
188 cancelButtonTitle:@"OK" | 189 cancelButtonTitle:@"OK" |
189 otherButtonTitles:nil]; | 190 otherButtonTitles:nil]; |
190 [alertView show]; | 191 [alertView show]; |
191 } | 192 } |
192 | 193 |
193 @end | 194 @end |
OLD | NEW |