blob: 04993e49b26968e8a1b4636f7f02be31cb240c58 [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>
12
13#import "RTCVideoTrack.h"
14
15typedef NS_ENUM(NSInteger, ARDAppClientState) {
16 // Disconnected from servers.
17 kARDAppClientStateDisconnected,
18 // Connecting to servers.
19 kARDAppClientStateConnecting,
20 // Connected to servers.
21 kARDAppClientStateConnected,
22};
23
24@class ARDAppClient;
25// The delegate is informed of pertinent events and will be called on the
26// main queue.
27@protocol ARDAppClientDelegate <NSObject>
28
29- (void)appClient:(ARDAppClient *)client
30 didChangeState:(ARDAppClientState)state;
31
32- (void)appClient:(ARDAppClient *)client
33 didChangeConnectionState:(RTCICEConnectionState)state;
34
35- (void)appClient:(ARDAppClient *)client
36 didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack;
37
38- (void)appClient:(ARDAppClient *)client
39 didReceiveRemoteVideoTrack:(RTCVideoTrack *)remoteVideoTrack;
40
41- (void)appClient:(ARDAppClient *)client
42 didError:(NSError *)error;
43
44@end
45
46// Handles connections to the AppRTC server for a given room. Methods on this
47// class should only be called from the main queue.
48@interface ARDAppClient : NSObject
49
50@property(nonatomic, readonly) ARDAppClientState state;
51@property(nonatomic, weak) id<ARDAppClientDelegate> delegate;
52
53// Convenience constructor since all expected use cases will need a delegate
54// in order to receive remote tracks.
55- (instancetype)initWithDelegate:(id<ARDAppClientDelegate>)delegate;
56
57// Establishes a connection with the AppRTC servers for the given room id.
58// TODO(tkchin): provide available keys/values for options. This will be used
59// for call configurations such as overriding server choice, specifying codecs
60// and so on.
61- (void)connectToRoomWithId:(NSString *)roomId
62 options:(NSDictionary *)options;
63
64// Disconnects from the AppRTC servers and any connected clients.
65- (void)disconnect;
66
67@end