OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2015 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 "webrtc/api/objc/RTCPeerConnection.h" | |
tkchin_webrtc
2016/02/05 16:15:16
? :)
hjon_webrtc
2016/02/09 00:59:53
Oops. Fixed. :-)
| |
14 | |
15 @class RTCConfiguration; | |
16 @class RTCDataChannel; | |
17 @class RTCDataChannelConfiguration; | |
18 @class RTCIceCandidate; | |
19 @class RTCMediaConstraints; | |
20 @class RTCMediaStream; | |
21 @class RTCMediaStreamTrack; | |
22 @class RTCPeerConnectionFactory; | |
23 @class RTCSessionDescription; | |
24 @class RTCStatsReport; | |
25 | |
26 extern NSString * _Nonnull const kRTCPeerConnectionErrorDomain; | |
tkchin_webrtc
2016/02/05 16:15:16
don't need _Nonnull here?
hjon_webrtc
2016/02/09 00:59:54
I didn't expect so, but I got this error without i
tkchin_webrtc
2016/02/10 18:54:40
Yeah just move the NONNULL_BEGIN up
hjon_webrtc
2016/02/11 00:25:07
Done.
| |
27 extern int const kRTCSessionDescriptionErrorCode; | |
28 | |
29 /** Represents the signaling state of the peer connection. */ | |
30 typedef NS_ENUM(NSInteger, RTCSignalingState) { | |
31 RTCSignalingStateStable, | |
32 RTCSignalingStateHaveLocalOffer, | |
33 RTCSignalingStateHaveLocalPrAnswer, | |
34 RTCSignalingStateHaveRemoteOffer, | |
35 RTCSignalingStateHaveRemotePrAnswer, | |
36 RTCSignalingStateClosed, | |
37 }; | |
38 | |
39 /** Represents the ice connection state of the peer connection. */ | |
40 typedef NS_ENUM(NSInteger, RTCIceConnectionState) { | |
41 RTCIceConnectionStateNew, | |
42 RTCIceConnectionStateChecking, | |
43 RTCIceConnectionStateConnected, | |
44 RTCIceConnectionStateCompleted, | |
45 RTCIceConnectionStateFailed, | |
46 RTCIceConnectionStateDisconnected, | |
47 RTCIceConnectionStateClosed, | |
48 RTCIceConnectionStateMax, | |
49 }; | |
50 | |
51 /** Represents the ice gathering state of the peer connection. */ | |
52 typedef NS_ENUM(NSInteger, RTCIceGatheringState) { | |
53 RTCIceGatheringStateNew, | |
54 RTCIceGatheringStateGathering, | |
55 RTCIceGatheringStateComplete, | |
56 }; | |
57 | |
58 /** Represents the stats output level. */ | |
59 typedef NS_ENUM(NSInteger, RTCStatsOutputLevel) { | |
60 RTCStatsOutputLevelStandard, | |
61 RTCStatsOutputLevelDebug, | |
62 }; | |
63 | |
64 NS_ASSUME_NONNULL_BEGIN | |
65 | |
66 @class RTCPeerConnection; | |
67 | |
68 @protocol RTCPeerConnectionDelegate <NSObject> | |
69 | |
70 /** Called when the SignalingState changed. */ | |
71 - (void)peerConnection:(RTCPeerConnection *)peerConnection | |
72 signalingStateChanged:(RTCSignalingState)stateChanged; | |
tkchin_webrtc
2016/02/05 16:15:16
didChangeSignalingState
hjon_webrtc
2016/02/09 00:59:53
Done.
| |
73 | |
74 /** Triggered when media is received on a new stream from remote peer. */ | |
tkchin_webrtc
2016/02/05 16:15:15
ditto nit triggered
hjon_webrtc
2016/02/09 00:59:54
Done.
| |
75 - (void)peerConnection:(RTCPeerConnection *)peerConnection | |
76 addedStream:(RTCMediaStream *)stream; | |
77 | |
78 /** Triggered when a remote peer closes a stream. */ | |
79 - (void)peerConnection:(RTCPeerConnection *)peerConnection | |
80 removedStream:(RTCMediaStream *)stream; | |
81 | |
82 /** Triggered when renegotiation is needed, for example ICE has restarted. */ | |
83 - (void)peerConnectionNeedsRenegotiation:(RTCPeerConnection *)peerConnection; | |
tkchin_webrtc
2016/02/05 16:15:15
peerConnectionShouldNegotiate
I don't think it's
hjon_webrtc
2016/02/09 00:59:53
You're right; the spec says negotiation, not reneg
| |
84 | |
85 /** Called any time the IceConnectionState changes. */ | |
86 - (void)peerConnection:(RTCPeerConnection *)peerConnection | |
87 iceConnectionStateChanged:(RTCIceConnectionState)newState; | |
tkchin_webrtc
2016/02/05 16:15:16
didChangeIceConnectionState
hjon_webrtc
2016/02/09 00:59:53
Done.
| |
88 | |
89 /** Called any time the IceGatheringState changes. */ | |
90 - (void)peerConnection:(RTCPeerConnection *)peerConnection | |
91 iceGatheringStateChanged:(RTCIceGatheringState)newState; | |
tkchin_webrtc
2016/02/05 16:15:15
didChangeIceGatheringState
hjon_webrtc
2016/02/09 00:59:54
Done.
| |
92 | |
93 /** New ice candidate has been found. */ | |
94 - (void)peerConnection:(RTCPeerConnection *)peerConnection | |
95 receivedIceCandidate:(RTCIceCandidate *)candidate; | |
tkchin_webrtc
2016/02/05 16:15:16
didGenerateIceCandidate
hjon_webrtc
2016/02/09 00:59:54
Done.
| |
96 | |
97 /** New data channel has been opened. */ | |
98 - (void)peerConnection:(RTCPeerConnection *)peerConnection | |
99 didOpenDataChannel:(RTCDataChannel *)dataChannel; | |
100 | |
101 @end | |
102 | |
103 | |
104 @interface RTCPeerConnection : NSObject | |
105 | |
106 /** | |
107 * The object that will be notifed about events such as state changes and | |
108 * streams being added or removed. | |
109 */ | |
110 @property(nonatomic, weak) id<RTCPeerConnectionDelegate> delegate; | |
111 | |
112 /** The pending or current remote description. */ | |
113 @property(nonatomic, readonly) NSArray *localStreams; | |
114 | |
115 /** The pending or current local description. */ | |
tkchin_webrtc
2016/02/05 16:15:16
? Not pending I think.
hjon_webrtc
2016/02/09 00:59:54
The spec mentions pending, but I'm not seeing an o
| |
116 @property(nonatomic, readonly, nullable) | |
117 RTCSessionDescription *localDescription; | |
118 | |
119 /** The pending or current remote description. */ | |
120 @property(nonatomic, readonly, nullable) | |
121 RTCSessionDescription *remoteDescription; | |
122 | |
123 /** The signaling state of this RTCPeerConnection instance. */ | |
124 @property(nonatomic, readonly) RTCSignalingState signalingState; | |
125 | |
126 /** The ICE connection state of this RTCPeerConnection instance. */ | |
127 @property(nonatomic, readonly) RTCIceConnectionState iceConnectionState; | |
128 | |
129 /** The ICE gathering state of this RTCPeerConnection instance. */ | |
130 @property(nonatomic, readonly) RTCIceGatheringState iceGatheringState; | |
131 | |
132 - (instancetype)init NS_UNAVAILABLE; | |
133 | |
134 /** | |
135 * Initialize an RTCPeerConnection with a configuration, constraints, and | |
136 * delegate. | |
137 */ | |
138 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory | |
139 configuration:(RTCConfiguration *)configuration | |
140 constraints:(RTCMediaConstraints *)constraints | |
141 delegate:(id<RTCPeerConnectionDelegate>)delegate | |
142 NS_DESIGNATED_INITIALIZER; | |
143 | |
144 /** Terminate all media and close the transport. */ | |
145 - (void)close; | |
146 | |
147 /** Provide a remote candidate to the ICE Agent. */ | |
148 - (void)addIceCandidate:(RTCIceCandidate *)candidate; | |
149 | |
150 /** Add a new media stream to be sent on this peer connection. */ | |
151 - (void)addStream:(RTCMediaStream *)stream; | |
152 | |
153 /** Remove the given media stream from this peer connection. */ | |
154 - (void)removeStream:(RTCMediaStream *)stream; | |
155 | |
156 /** Create a new data channel with the given label and configuration. */ | |
157 - (RTCDataChannel *)dataChannelWithLabel:(NSString *)label | |
tkchin_webrtc
2016/02/05 16:15:15
If possible, move this to a category below. Corres
hjon_webrtc
2016/02/09 00:59:53
Done.
| |
158 configuration:(RTCDataChannelConfiguration *)configuration; | |
159 | |
160 /** Generate an SDP offer. */ | |
161 - (void)offerWithConstraints:(RTCMediaConstraints *)constraints | |
tkchin_webrtc
2016/02/05 16:15:16
nit: offerForConstraints / answerForConstraints
hjon_webrtc
2016/02/09 00:59:54
Done.
| |
162 completionHandler:(void (^) | |
163 (RTCSessionDescription *sessionDescription, NSError *error))completionHandler; | |
164 | |
165 /** Generate an SDP answer. */ | |
166 - (void)answerWithConstraints:(RTCMediaConstraints *)constraints | |
167 completionHandler:(void (^) | |
168 (RTCSessionDescription *sessionDescription, NSError *error))completionHandler; | |
169 | |
170 /** Apply the supplied RTCSessionDescription as the local description. */ | |
171 - (void)setLocalDescription:(RTCSessionDescription *)sdp | |
172 completionHandler:(void (^)(NSError *error))completionHandler; | |
173 | |
174 /** Apply the supplied RTCSessionDescription as the remote description. */ | |
175 - (void)setRemoteDescription:(RTCSessionDescription *)sdp | |
176 completionHandler:(void (^)(NSError *error))completionHandler; | |
177 | |
178 /** | |
179 * Gather stats for the given RTCMediaStreamTrack. If |mediaStreamTrack| is nil | |
180 * statistics are gathered for all tracks. | |
181 */ | |
182 - (void)statsForMediaStreamTrack: | |
183 (nullable RTCMediaStreamTrack *)mediaStreamTrack | |
184 statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel | |
185 completionHandler: | |
186 (void (^)(NSArray<RTCStatsReport *> *stats))completionHandler; | |
187 | |
188 @end | |
189 | |
190 NS_ASSUME_NONNULL_END | |
OLD | NEW |