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;
|
2017-03-28 01:22:48 -07:00
|
|
|
@class ARDSettingsModel;
|
2018-06-04 10:24:37 +02:00
|
|
|
@class ARDExternalSampleCapturer;
|
2016-11-02 02:56:09 -07:00
|
|
|
@class RTCMediaConstraints;
|
2017-11-15 13:15:24 +01:00
|
|
|
@class RTCCameraVideoCapturer;
|
|
|
|
|
@class RTCFileVideoCapturer;
|
2016-11-02 02:56:09 -07:00
|
|
|
|
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
|
|
|
|
2018-06-19 15:03:05 +02:00
|
|
|
- (void)appClient:(ARDAppClient *)client didChangeState:(ARDAppClientState)state;
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2018-06-19 15:03:05 +02:00
|
|
|
- (void)appClient:(ARDAppClient *)client didChangeConnectionState:(RTCIceConnectionState)state;
|
2015-01-06 07:21:34 +00:00
|
|
|
|
2017-04-05 12:17:48 -07:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
|
|
|
|
didCreateLocalCapturer:(RTCCameraVideoCapturer *)localCapturer;
|
|
|
|
|
|
2018-06-19 15:03:05 +02: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
|
|
|
|
2018-06-19 15:03:05 +02:00
|
|
|
- (void)appClient:(ARDAppClient *)client didError:(NSError *)error;
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2018-06-19 15:03:05 +02:00
|
|
|
- (void)appClient:(ARDAppClient *)client didGetStats:(NSArray *)stats;
|
2015-08-14 11:00:02 -07:00
|
|
|
|
2017-11-15 13:15:24 +01:00
|
|
|
@optional
|
|
|
|
|
- (void)appClient:(ARDAppClient *)client
|
2018-06-19 15:03:05 +02:00
|
|
|
didCreateLocalFileCapturer:(RTCFileVideoCapturer *)fileCapturer;
|
2017-11-15 13:15:24 +01:00
|
|
|
|
2018-06-04 10:24:37 +02:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
|
|
|
|
didCreateLocalExternalSampleCapturer:(ARDExternalSampleCapturer *)externalSampleCapturer;
|
|
|
|
|
|
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;
|
2018-06-04 10:24:37 +02:00
|
|
|
@property(nonatomic, assign, getter=isBroadcast) BOOL broadcast;
|
|
|
|
|
|
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.
|
2017-03-28 01:22:48 -07:00
|
|
|
- (instancetype)initWithDelegate:(id<ARDAppClientDelegate>)delegate;
|
2016-11-08 06:28:17 -08:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
// Establishes a connection with the AppRTC servers for the given room id.
|
2017-03-28 01:22:48 -07:00
|
|
|
// |settings| is an object containing settings such as video codec for the call.
|
2015-10-02 11:44:03 -07:00
|
|
|
// If |isLoopback| is true, the call will connect to itself.
|
2014-12-09 19:32:35 +00:00
|
|
|
- (void)connectToRoomWithId:(NSString *)roomId
|
2017-03-28 01:22:48 -07:00
|
|
|
settings:(ARDSettingsModel *)settings
|
2017-06-15 16:05:13 +02:00
|
|
|
isLoopback:(BOOL)isLoopback;
|
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
|