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>
|
2020-10-19 16:12:43 +02:00
|
|
|
|
|
|
|
|
#import "sdk/objc/api/peerconnection/RTCPeerConnection.h"
|
|
|
|
|
#import "sdk/objc/api/peerconnection/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;
|
2020-05-04 16:14:32 +02:00
|
|
|
@class RTC_OBJC_TYPE(RTCMediaConstraints);
|
|
|
|
|
@class RTC_OBJC_TYPE(RTCCameraVideoCapturer);
|
|
|
|
|
@class RTC_OBJC_TYPE(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
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
- (void)appClient:(ARDAppClient *)client didChangeState:(ARDAppClientState)state;
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2016-03-13 22:08:26 -07: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
|
2020-05-04 16:14:32 +02:00
|
|
|
didCreateLocalCapturer:(RTC_OBJC_TYPE(RTCCameraVideoCapturer) *)localCapturer;
|
2017-04-05 12:17:48 -07:00
|
|
|
|
2020-05-04 16:14:32 +02:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
|
|
|
|
didReceiveLocalVideoTrack:(RTC_OBJC_TYPE(RTCVideoTrack) *)localVideoTrack;
|
2014-05-30 22:26:06 +00:00
|
|
|
|
2014-12-09 19:32:35 +00:00
|
|
|
- (void)appClient:(ARDAppClient *)client
|
2020-05-04 16:14:32 +02:00
|
|
|
didReceiveRemoteVideoTrack:(RTC_OBJC_TYPE(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
|
|
|
|
2021-05-20 15:04:02 +09:00
|
|
|
- (void)appClient:(ARDAppClient *)client didGetStats:(RTC_OBJC_TYPE(RTCStatisticsReport) *)stats;
|
2015-08-14 11:00:02 -07:00
|
|
|
|
2017-11-15 13:15:24 +01:00
|
|
|
@optional
|
|
|
|
|
- (void)appClient:(ARDAppClient *)client
|
2020-05-04 16:14:32 +02:00
|
|
|
didCreateLocalFileCapturer:(RTC_OBJC_TYPE(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
|
|
|
|
|
|
2021-07-26 13:21:35 +02:00
|
|
|
// If `shouldGetStats` is true, stats will be reported in 1s intervals through
|
2015-08-14 11:00:02 -07:00
|
|
|
// 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.
|
2021-07-26 13:21:35 +02:00
|
|
|
// `settings` is an object containing settings such as video codec for the call.
|
|
|
|
|
// 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
|