2017-10-12 15:37:36 +03:00
|
|
|
//
|
|
|
|
// NCPeerConnection.h
|
|
|
|
// VideoCalls
|
|
|
|
//
|
|
|
|
// Created by Ivan Sein on 29.09.17.
|
|
|
|
// Copyright © 2017 struktur AG. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
#import <WebRTC/RTCPeerConnection.h>
|
|
|
|
#import <WebRTC/RTCDataChannel.h>
|
|
|
|
|
|
|
|
@class NCPeerConnection;
|
|
|
|
|
|
|
|
@protocol NCPeerConnectionDelegate <NSObject>
|
|
|
|
|
|
|
|
/** Called when media is received on a new stream from remote peer. */
|
|
|
|
- (void)peerConnection:(NCPeerConnection *)peerConnection didAddStream:(RTCMediaStream *)stream;
|
|
|
|
|
|
|
|
/** Called when a remote peer closes a stream. */
|
|
|
|
- (void)peerConnection:(NCPeerConnection *)peerConnection didRemoveStream:(RTCMediaStream *)stream;
|
|
|
|
|
|
|
|
/** Called any time the IceConnectionState changes. */
|
|
|
|
- (void)peerConnection:(NCPeerConnection *)peerConnection didChangeIceConnectionState:(RTCIceConnectionState)newState;
|
|
|
|
|
2017-10-15 13:28:33 +03:00
|
|
|
/** Status data channel has been opened. */
|
2017-10-12 15:37:36 +03:00
|
|
|
- (void)peerConnectionDidOpenStatusDataChannel:(NCPeerConnection *)peerConnection;
|
|
|
|
|
2017-10-15 13:28:33 +03:00
|
|
|
/** Message received from status data channel has been opened. */
|
|
|
|
- (void)peerConnection:(NCPeerConnection *)peerConnection didReceiveStatusDataChannelMessage:(NSString *)type;
|
|
|
|
|
|
|
|
/** Peer's nick received from status data channel has been opened. */
|
|
|
|
- (void)peerConnection:(NCPeerConnection *)peerConnection didReceivePeerNick:(NSString *)nick;
|
|
|
|
|
2017-10-12 15:37:36 +03:00
|
|
|
/** New ice candidate has been found. */
|
|
|
|
- (void)peerConnection:(NCPeerConnection *)peerConnection didGenerateIceCandidate:(RTCIceCandidate *)candidate;
|
|
|
|
|
|
|
|
/** Called when a peer connection creates session description */
|
|
|
|
- (void)peerConnection:(NCPeerConnection *)peerConnection needsToSendSessionDescription:(RTCSessionDescription *)sessionDescription;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NCPeerConnection : NSObject
|
|
|
|
|
|
|
|
@property (nonatomic, weak) id<NCPeerConnectionDelegate> delegate;
|
|
|
|
|
|
|
|
@property (nonatomic, copy) NSString *peerId;
|
|
|
|
@property (nonatomic, copy) NSString *peerName;
|
2019-01-04 17:05:18 +03:00
|
|
|
@property (nonatomic, copy) NSString *roomType;
|
2018-03-20 13:46:50 +03:00
|
|
|
@property (nonatomic, assign) BOOL isAudioOnly;
|
2018-09-25 18:22:09 +03:00
|
|
|
@property (nonatomic, assign) BOOL isMCUPublisherPeer;
|
2017-10-12 15:37:36 +03:00
|
|
|
@property (nonatomic, strong) RTCPeerConnection *peerConnection;
|
|
|
|
@property (nonatomic, strong) RTCDataChannel *localDataChannel;
|
|
|
|
@property (nonatomic, strong) RTCDataChannel *remoteDataChannel;
|
2017-10-15 13:28:33 +03:00
|
|
|
@property (nonatomic, assign) BOOL isRemoteAudioDisabled;
|
|
|
|
@property (nonatomic, assign) BOOL isRemoteVideoDisabled;
|
2020-05-08 16:30:44 +03:00
|
|
|
@property (nonatomic, assign) BOOL isPeerSpeaking;
|
2017-10-12 15:37:36 +03:00
|
|
|
@property (nonatomic, strong, readonly) NSMutableArray *queuedRemoteCandidates;
|
|
|
|
@property (nonatomic, strong) RTCMediaStream *remoteStream;
|
|
|
|
|
2018-03-20 13:46:50 +03:00
|
|
|
- (instancetype)initWithSessionId:(NSString *)sessionId andICEServers:(NSArray *)iceServers forAudioOnlyCall:(BOOL)audioOnly;
|
2018-09-20 17:31:01 +03:00
|
|
|
- (instancetype)initForMCUWithSessionId:(NSString *)sessionId andICEServers:(NSArray *)iceServers forAudioOnlyCall:(BOOL)audioOnly;
|
2017-10-12 15:37:36 +03:00
|
|
|
- (void)addICECandidate:(RTCIceCandidate *)candidate;
|
|
|
|
- (void)setRemoteDescription:(RTCSessionDescription *)sessionDescription;
|
2018-09-20 17:31:01 +03:00
|
|
|
- (void)sendPublishOfferToMCU;
|
2017-10-12 15:37:36 +03:00
|
|
|
- (void)sendOffer;
|
2018-09-25 17:50:35 +03:00
|
|
|
- (void)sendDataChannelMessageOfType:(NSString *)type withPayload:(id)payload;
|
2017-10-12 15:37:36 +03:00
|
|
|
- (void)drainRemoteCandidates;
|
|
|
|
- (void)removeRemoteCandidates;
|
|
|
|
- (void)close;
|
|
|
|
|
|
|
|
@end
|