blob: b613ec976fe0d49cb5888a5917f495d3d1f094c6 [file] [log] [blame]
Donald E Curtisa8736442015-08-05 15:48:13 -07001/*
2 * Copyright 2014 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#import <Foundation/Foundation.h>
tkchin9eeb6242016-04-27 01:54:20 -070012
sakalc522e752017-04-05 12:17:48 -070013#import "WebRTC/RTCCameraVideoCapturer.h"
tkchin9eeb6242016-04-27 01:54:20 -070014#import "WebRTC/RTCPeerConnection.h"
15#import "WebRTC/RTCVideoTrack.h"
Donald E Curtisa8736442015-08-05 15:48:13 -070016
17typedef NS_ENUM(NSInteger, ARDAppClientState) {
18 // Disconnected from servers.
19 kARDAppClientStateDisconnected,
20 // Connecting to servers.
21 kARDAppClientStateConnecting,
22 // Connected to servers.
23 kARDAppClientStateConnected,
24};
25
26@class ARDAppClient;
sakalc4adacf2017-03-28 01:22:48 -070027@class ARDSettingsModel;
denicijad17d5362016-11-02 02:56:09 -070028@class RTCMediaConstraints;
29
Donald E Curtisa8736442015-08-05 15:48:13 -070030// The delegate is informed of pertinent events and will be called on the
31// main queue.
32@protocol ARDAppClientDelegate <NSObject>
33
34- (void)appClient:(ARDAppClient *)client
35 didChangeState:(ARDAppClientState)state;
36
37- (void)appClient:(ARDAppClient *)client
hjon79858f82016-03-13 22:08:26 -070038 didChangeConnectionState:(RTCIceConnectionState)state;
Donald E Curtisa8736442015-08-05 15:48:13 -070039
40- (void)appClient:(ARDAppClient *)client
sakalc522e752017-04-05 12:17:48 -070041 didCreateLocalCapturer:(RTCCameraVideoCapturer *)localCapturer;
42
43- (void)appClient:(ARDAppClient *)client
Donald E Curtisa8736442015-08-05 15:48:13 -070044 didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack;
45
46- (void)appClient:(ARDAppClient *)client
47 didReceiveRemoteVideoTrack:(RTCVideoTrack *)remoteVideoTrack;
48
49- (void)appClient:(ARDAppClient *)client
50 didError:(NSError *)error;
51
Zeke Chind3325802015-08-14 11:00:02 -070052- (void)appClient:(ARDAppClient *)client
53 didGetStats:(NSArray *)stats;
54
Donald E Curtisa8736442015-08-05 15:48:13 -070055@end
56
57// Handles connections to the AppRTC server for a given room. Methods on this
58// class should only be called from the main queue.
59@interface ARDAppClient : NSObject
60
Zeke Chind3325802015-08-14 11:00:02 -070061// If |shouldGetStats| is true, stats will be reported in 1s intervals through
62// the delegate.
63@property(nonatomic, assign) BOOL shouldGetStats;
Donald E Curtisa8736442015-08-05 15:48:13 -070064@property(nonatomic, readonly) ARDAppClientState state;
65@property(nonatomic, weak) id<ARDAppClientDelegate> delegate;
Donald E Curtisa8736442015-08-05 15:48:13 -070066// Convenience constructor since all expected use cases will need a delegate
67// in order to receive remote tracks.
sakalc4adacf2017-03-28 01:22:48 -070068- (instancetype)initWithDelegate:(id<ARDAppClientDelegate>)delegate;
denicija8c375de2016-11-08 06:28:17 -080069
Donald E Curtisa8736442015-08-05 15:48:13 -070070// Establishes a connection with the AppRTC servers for the given room id.
sakalc4adacf2017-03-28 01:22:48 -070071// |settings| is an object containing settings such as video codec for the call.
haysc913e6452015-10-02 11:44:03 -070072// If |isLoopback| is true, the call will connect to itself.
73// If |isAudioOnly| is true, video will be disabled for the call.
peah5085b0c2016-08-25 22:15:14 -070074// If |shouldMakeAecDump| is true, an aecdump will be created for the call.
tkchinab1293a2016-08-30 12:35:05 -070075// If |shouldUseLevelControl| is true, the level controller will be used
76// in the call.
Donald E Curtisa8736442015-08-05 15:48:13 -070077- (void)connectToRoomWithId:(NSString *)roomId
sakalc4adacf2017-03-28 01:22:48 -070078 settings:(ARDSettingsModel *)settings
haysc913e6452015-10-02 11:44:03 -070079 isLoopback:(BOOL)isLoopback
peah5085b0c2016-08-25 22:15:14 -070080 isAudioOnly:(BOOL)isAudioOnly
tkchinab1293a2016-08-30 12:35:05 -070081 shouldMakeAecDump:(BOOL)shouldMakeAecDump
82 shouldUseLevelControl:(BOOL)shouldUseLevelControl;
Donald E Curtisa8736442015-08-05 15:48:13 -070083
84// Disconnects from the AppRTC servers and any connected clients.
85- (void)disconnect;
86
87@end