2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2015-08-05 15:48:13 -07:00
|
|
|
* Copyright 2014 The WebRTC Project Authors. All rights reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2015-08-05 15:48:13 -07:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2014-05-30 22:26:06 +00:00
|
|
|
#import <Foundation/Foundation.h>
|
2016-04-27 01:54:20 -07:00
|
|
|
|
|
|
|
|
#import "WebRTC/RTCPeerConnection.h"
|
|
|
|
|
#import "WebRTC/RTCVideoTrack.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
typedef NS_ENUM(NSInteger, ARDAppClientState) {
|
|
|
|
|
// Disconnected from servers.
|
|
|
|
|
kARDAppClientStateDisconnected,
|
|
|
|
|
// Connecting to servers.
|
|
|
|
|
kARDAppClientStateConnecting,
|
|
|
|
|
// Connected to servers.
|
|
|
|
|
kARDAppClientStateConnected,
|
|
|
|
|
};
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
@class ARDAppClient;
|
2015-03-18 23:38:04 +00:00
|
|
|
// The delegate is informed of pertinent events and will be called on the
|
|
|
|
|
// main queue.
|
2014-12-09 19:32:35 +00:00
|
|
|
@protocol ARDAppClientDelegate <NSObject>
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
|
|
|
|
didChangeState:(ARDAppClientState)state;
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2015-01-06 07:21:34 +00:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
2016-03-13 22:08:26 -07:00
|
|
|
didChangeConnectionState:(RTCIceConnectionState)state;
|
2015-01-06 07:21:34 +00:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
|
|
|
|
didReceiveLocalVideoTrack:(RTCVideoTrack *)localVideoTrack;
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
|
|
|
|
didReceiveRemoteVideoTrack:(RTCVideoTrack *)remoteVideoTrack;
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
|
|
|
|
didError:(NSError *)error;
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2015-08-14 11:00:02 -07:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
|
|
|
|
didGetStats:(NSArray *)stats;
|
|
|
|
|
|
2014-05-30 22:26:06 +00:00
|
|
|
@end
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-03-18 23:38:04 +00:00
|
|
|
// Handles connections to the AppRTC server for a given room. Methods on this
|
|
|
|
|
// class should only be called from the main queue.
|
2014-12-09 19:32:35 +00:00
|
|
|
@interface ARDAppClient : NSObject
|
|
|
|
|
|
2015-08-14 11:00:02 -07:00
|
|
|
// If |shouldGetStats| is true, stats will be reported in 1s intervals through
|
|
|
|
|
// the delegate.
|
|
|
|
|
@property(nonatomic, assign) BOOL shouldGetStats;
|
2014-12-09 19:32:35 +00:00
|
|
|
@property(nonatomic, readonly) ARDAppClientState state;
|
|
|
|
|
@property(nonatomic, weak) id<ARDAppClientDelegate> delegate;
|
|
|
|
|
|
2015-03-18 23:38:04 +00:00
|
|
|
// Convenience constructor since all expected use cases will need a delegate
|
|
|
|
|
// in order to receive remote tracks.
|
2014-12-09 19:32:35 +00:00
|
|
|
- (instancetype)initWithDelegate:(id<ARDAppClientDelegate>)delegate;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
// Establishes a connection with the AppRTC servers for the given room id.
|
2015-10-02 11:44:03 -07:00
|
|
|
// If |isLoopback| is true, the call will connect to itself.
|
|
|
|
|
// If |isAudioOnly| is true, video will be disabled for the call.
|
2016-08-25 22:15:14 -07:00
|
|
|
// If |shouldMakeAecDump| is true, an aecdump will be created for the call.
|
2016-08-30 12:35:05 -07:00
|
|
|
// If |shouldUseLevelControl| is true, the level controller will be used
|
|
|
|
|
// in the call.
|
2014-12-09 19:32:35 +00:00
|
|
|
- (void)connectToRoomWithId:(NSString *)roomId
|
2015-10-02 11:44:03 -07:00
|
|
|
isLoopback:(BOOL)isLoopback
|
2016-08-25 22:15:14 -07:00
|
|
|
isAudioOnly:(BOOL)isAudioOnly
|
2016-08-30 12:35:05 -07:00
|
|
|
shouldMakeAecDump:(BOOL)shouldMakeAecDump
|
|
|
|
|
shouldUseLevelControl:(BOOL)shouldUseLevelControl;
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
// Disconnects from the AppRTC servers and any connected clients.
|
2014-05-30 22:26:06 +00:00
|
|
|
- (void)disconnect;
|
2014-03-10 20:41:22 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
@end
|