@livedigital/client 2.37.0 → 2.37.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node_modules/mediasoup-client/src/Consumer.d.ts +114 -0
- package/dist/node_modules/mediasoup-client/src/DataConsumer.d.ts +93 -0
- package/dist/node_modules/mediasoup-client/src/DataProducer.d.ts +97 -0
- package/dist/node_modules/mediasoup-client/src/EnhancedEventEmitter.d.ts +7 -0
- package/dist/node_modules/mediasoup-client/src/Logger.d.ts +10 -0
- package/dist/node_modules/mediasoup-client/src/Producer.d.ts +151 -0
- package/dist/node_modules/mediasoup-client/src/RtpParameters.d.ts +305 -0
- package/dist/node_modules/mediasoup-client/src/SctpParameters.d.ts +67 -0
- package/dist/node_modules/mediasoup-client/src/Transport.d.ts +212 -0
- package/dist/node_modules/mediasoup-client/src/errors.d.ts +12 -0
- package/dist/node_modules/mediasoup-client/src/handlers/HandlerInterface.d.ts +84 -0
- package/dist/node_modules/mediasoup-client/src/ortc.d.ts +122 -0
- package/dist/node_modules/mediasoup-client/src/utils.d.ts +8 -0
- package/dist/{EnhancedEventEmitter.d.ts → src/EnhancedEventEmitter.d.ts} +0 -0
- package/dist/{constants → src/constants}/common.d.ts +0 -0
- package/dist/{constants → src/constants}/events.d.ts +0 -0
- package/dist/{constants → src/constants}/simulcastEncodings.d.ts +0 -0
- package/dist/{constants → src/constants}/videoConstrains.d.ts +0 -0
- package/dist/{engine → src/engine}/DefaultEngineDependenciesFactory.d.ts +0 -0
- package/dist/{engine → src/engine}/Logger.d.ts +0 -0
- package/dist/{engine → src/engine}/Peer.d.ts +0 -0
- package/dist/{engine → src/engine}/PeerConsumer.d.ts +0 -0
- package/dist/{engine → src/engine}/PeerProducer.d.ts +0 -0
- package/dist/{engine → src/engine}/handlers/ChannelEventHandler.d.ts +0 -0
- package/dist/{engine → src/engine}/handlers/MediaSoupEventHandler.d.ts +0 -0
- package/dist/{engine → src/engine}/index.d.ts +0 -0
- package/dist/{engine → src/engine}/media/index.d.ts +0 -0
- package/dist/{engine → src/engine}/media/tracks/AudioTrack.d.ts +0 -0
- package/dist/{engine → src/engine}/media/tracks/BaseTrack.d.ts +0 -0
- package/dist/{engine → src/engine}/media/tracks/MediaStreamTrackManager.d.ts +0 -0
- package/dist/{engine → src/engine}/media/tracks/PeerTrack.d.ts +0 -0
- package/dist/{engine → src/engine}/media/tracks/TrackWithCodecOptions.d.ts +0 -0
- package/dist/{engine → src/engine}/media/tracks/TrackWithEncodings.d.ts +0 -0
- package/dist/{engine → src/engine}/media/tracks/VideoTrack.d.ts +0 -0
- package/dist/{engine → src/engine}/network/LoadBalancerClient.d.ts +0 -0
- package/dist/{engine → src/engine}/network/Socket.d.ts +0 -0
- package/dist/{engine → src/engine}/network/index.d.ts +0 -0
- package/dist/{engine → src/engine}/system/index.d.ts +0 -0
- package/dist/{errors → src/errors}/LivedigitalSDKError.d.ts +0 -0
- package/dist/{errors → src/errors}/UnsupportedError.d.ts +0 -0
- package/dist/{helpers → src/helpers}/appDataValidator.d.ts +0 -0
- package/dist/{helpers → src/helpers}/datetime.d.ts +0 -0
- package/dist/{helpers → src/helpers}/filterStatsCodecs.d.ts +0 -0
- package/dist/{helpers → src/helpers}/retry.d.ts +0 -0
- package/dist/{index.d.ts → src/index.d.ts} +0 -0
- package/dist/{types → src/types}/common.d.ts +3 -0
- package/dist/{types → src/types}/engine.d.ts +0 -0
- package/dist/{types → src/types}/network.d.ts +0 -0
- package/package.json +3 -3
- package/src/engine/media/tracks/BaseTrack.ts +2 -1
- package/src/engine/media/tracks/PeerTrack.ts +1 -1
- package/src/types/common.ts +3 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The RTP capabilities define what mediasoup or an endpoint can receive at
|
|
3
|
+
* media level.
|
|
4
|
+
*/
|
|
5
|
+
export declare type RtpCapabilities = {
|
|
6
|
+
/**
|
|
7
|
+
* Supported media and RTX codecs.
|
|
8
|
+
*/
|
|
9
|
+
codecs?: RtpCodecCapability[];
|
|
10
|
+
/**
|
|
11
|
+
* Supported RTP header extensions.
|
|
12
|
+
*/
|
|
13
|
+
headerExtensions?: RtpHeaderExtension[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Media kind ('audio' or 'video').
|
|
17
|
+
*/
|
|
18
|
+
export declare type MediaKind = 'audio' | 'video';
|
|
19
|
+
/**
|
|
20
|
+
* Provides information on the capabilities of a codec within the RTP
|
|
21
|
+
* capabilities. The list of media codecs supported by mediasoup and their
|
|
22
|
+
* settings is defined in the supportedRtpCapabilities.ts file.
|
|
23
|
+
*
|
|
24
|
+
* Exactly one RtpCodecCapability will be present for each supported combination
|
|
25
|
+
* of parameters that requires a distinct value of preferredPayloadType. For
|
|
26
|
+
* example:
|
|
27
|
+
*
|
|
28
|
+
* - Multiple H264 codecs, each with their own distinct 'packetization-mode' and
|
|
29
|
+
* 'profile-level-id' values.
|
|
30
|
+
* - Multiple VP9 codecs, each with their own distinct 'profile-id' value.
|
|
31
|
+
*
|
|
32
|
+
* RtpCodecCapability entries in the mediaCodecs array of RouterOptions do not
|
|
33
|
+
* require preferredPayloadType field (if unset, mediasoup will choose a random
|
|
34
|
+
* one). If given, make sure it's in the 96-127 range.
|
|
35
|
+
*/
|
|
36
|
+
export declare type RtpCodecCapability = {
|
|
37
|
+
/**
|
|
38
|
+
* Media kind.
|
|
39
|
+
*/
|
|
40
|
+
kind: MediaKind;
|
|
41
|
+
/**
|
|
42
|
+
* The codec MIME media type/subtype (e.g. 'audio/opus', 'video/VP8').
|
|
43
|
+
*/
|
|
44
|
+
mimeType: string;
|
|
45
|
+
/**
|
|
46
|
+
* The preferred RTP payload type.
|
|
47
|
+
*/
|
|
48
|
+
preferredPayloadType?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Codec clock rate expressed in Hertz.
|
|
51
|
+
*/
|
|
52
|
+
clockRate: number;
|
|
53
|
+
/**
|
|
54
|
+
* The number of channels supported (e.g. two for stereo). Just for audio.
|
|
55
|
+
* Default 1.
|
|
56
|
+
*/
|
|
57
|
+
channels?: number;
|
|
58
|
+
/**
|
|
59
|
+
* Codec specific parameters. Some parameters (such as 'packetization-mode'
|
|
60
|
+
* and 'profile-level-id' in H264 or 'profile-id' in VP9) are critical for
|
|
61
|
+
* codec matching.
|
|
62
|
+
*/
|
|
63
|
+
parameters?: any;
|
|
64
|
+
/**
|
|
65
|
+
* Transport layer and codec-specific feedback messages for this codec.
|
|
66
|
+
*/
|
|
67
|
+
rtcpFeedback?: RtcpFeedback[];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Direction of RTP header extension.
|
|
71
|
+
*/
|
|
72
|
+
export declare type RtpHeaderExtensionDirection = 'sendrecv' | 'sendonly' | 'recvonly' | 'inactive';
|
|
73
|
+
/**
|
|
74
|
+
* Provides information relating to supported header extensions. The list of
|
|
75
|
+
* RTP header extensions supported by mediasoup is defined in the
|
|
76
|
+
* supportedRtpCapabilities.ts file.
|
|
77
|
+
*
|
|
78
|
+
* mediasoup does not currently support encrypted RTP header extensions. The
|
|
79
|
+
* direction field is just present in mediasoup RTP capabilities (retrieved via
|
|
80
|
+
* router.rtpCapabilities or mediasoup.getSupportedRtpCapabilities()). It's
|
|
81
|
+
* ignored if present in endpoints' RTP capabilities.
|
|
82
|
+
*/
|
|
83
|
+
export declare type RtpHeaderExtension = {
|
|
84
|
+
/**
|
|
85
|
+
* Media kind.
|
|
86
|
+
*/
|
|
87
|
+
kind: MediaKind;
|
|
88
|
+
uri: string;
|
|
89
|
+
/**
|
|
90
|
+
* The preferred numeric identifier that goes in the RTP packet. Must be
|
|
91
|
+
* unique.
|
|
92
|
+
*/
|
|
93
|
+
preferredId: number;
|
|
94
|
+
/**
|
|
95
|
+
* If true, it is preferred that the value in the header be encrypted as per
|
|
96
|
+
* RFC 6904. Default false.
|
|
97
|
+
*/
|
|
98
|
+
preferredEncrypt?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* If 'sendrecv', mediasoup supports sending and receiving this RTP extension.
|
|
101
|
+
* 'sendonly' means that mediasoup can send (but not receive) it. 'recvonly'
|
|
102
|
+
* means that mediasoup can receive (but not send) it.
|
|
103
|
+
*/
|
|
104
|
+
direction?: RtpHeaderExtensionDirection;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The RTP send parameters describe a media stream received by mediasoup from
|
|
108
|
+
* an endpoint through its corresponding mediasoup Producer. These parameters
|
|
109
|
+
* may include a mid value that the mediasoup transport will use to match
|
|
110
|
+
* received RTP packets based on their MID RTP extension value.
|
|
111
|
+
*
|
|
112
|
+
* mediasoup allows RTP send parameters with a single encoding and with multiple
|
|
113
|
+
* encodings (simulcast). In the latter case, each entry in the encodings array
|
|
114
|
+
* must include a ssrc field or a rid field (the RID RTP extension value). Check
|
|
115
|
+
* the Simulcast and SVC sections for more information.
|
|
116
|
+
*
|
|
117
|
+
* The RTP receive parameters describe a media stream as sent by mediasoup to
|
|
118
|
+
* an endpoint through its corresponding mediasoup Consumer. The mid value is
|
|
119
|
+
* unset (mediasoup does not include the MID RTP extension into RTP packets
|
|
120
|
+
* being sent to endpoints).
|
|
121
|
+
*
|
|
122
|
+
* There is a single entry in the encodings array (even if the corresponding
|
|
123
|
+
* producer uses simulcast). The consumer sends a single and continuous RTP
|
|
124
|
+
* stream to the endpoint and spatial/temporal layer selection is possible via
|
|
125
|
+
* consumer.setPreferredLayers().
|
|
126
|
+
*
|
|
127
|
+
* As an exception, previous bullet is not true when consuming a stream over a
|
|
128
|
+
* PipeTransport, in which all RTP streams from the associated producer are
|
|
129
|
+
* forwarded verbatim through the consumer.
|
|
130
|
+
*
|
|
131
|
+
* The RTP receive parameters will always have their ssrc values randomly
|
|
132
|
+
* generated for all of its encodings (and optional rtx: { ssrc: XXXX } if the
|
|
133
|
+
* endpoint supports RTX), regardless of the original RTP send parameters in
|
|
134
|
+
* the associated producer. This applies even if the producer's encodings have
|
|
135
|
+
* rid set.
|
|
136
|
+
*/
|
|
137
|
+
export declare type RtpParameters = {
|
|
138
|
+
/**
|
|
139
|
+
* The MID RTP extension value as defined in the BUNDLE specification.
|
|
140
|
+
*/
|
|
141
|
+
mid?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Media and RTX codecs in use.
|
|
144
|
+
*/
|
|
145
|
+
codecs: RtpCodecParameters[];
|
|
146
|
+
/**
|
|
147
|
+
* RTP header extensions in use.
|
|
148
|
+
*/
|
|
149
|
+
headerExtensions?: RtpHeaderExtensionParameters[];
|
|
150
|
+
/**
|
|
151
|
+
* Transmitted RTP streams and their settings.
|
|
152
|
+
*/
|
|
153
|
+
encodings?: RtpEncodingParameters[];
|
|
154
|
+
/**
|
|
155
|
+
* Parameters used for RTCP.
|
|
156
|
+
*/
|
|
157
|
+
rtcp?: RtcpParameters;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Provides information on codec settings within the RTP parameters. The list
|
|
161
|
+
* of media codecs supported by mediasoup and their settings is defined in the
|
|
162
|
+
* supportedRtpCapabilities.ts file.
|
|
163
|
+
*/
|
|
164
|
+
export declare type RtpCodecParameters = {
|
|
165
|
+
/**
|
|
166
|
+
* The codec MIME media type/subtype (e.g. 'audio/opus', 'video/VP8').
|
|
167
|
+
*/
|
|
168
|
+
mimeType: string;
|
|
169
|
+
/**
|
|
170
|
+
* The value that goes in the RTP Payload Type Field. Must be unique.
|
|
171
|
+
*/
|
|
172
|
+
payloadType: number;
|
|
173
|
+
/**
|
|
174
|
+
* Codec clock rate expressed in Hertz.
|
|
175
|
+
*/
|
|
176
|
+
clockRate: number;
|
|
177
|
+
/**
|
|
178
|
+
* The number of channels supported (e.g. two for stereo). Just for audio.
|
|
179
|
+
* Default 1.
|
|
180
|
+
*/
|
|
181
|
+
channels?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Codec-specific parameters available for signaling. Some parameters (such
|
|
184
|
+
* as 'packetization-mode' and 'profile-level-id' in H264 or 'profile-id' in
|
|
185
|
+
* VP9) are critical for codec matching.
|
|
186
|
+
*/
|
|
187
|
+
parameters?: any;
|
|
188
|
+
/**
|
|
189
|
+
* Transport layer and codec-specific feedback messages for this codec.
|
|
190
|
+
*/
|
|
191
|
+
rtcpFeedback?: RtcpFeedback[];
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Provides information on RTCP feedback messages for a specific codec. Those
|
|
195
|
+
* messages can be transport layer feedback messages or codec-specific feedback
|
|
196
|
+
* messages. The list of RTCP feedbacks supported by mediasoup is defined in the
|
|
197
|
+
* supportedRtpCapabilities.ts file.
|
|
198
|
+
*/
|
|
199
|
+
export declare type RtcpFeedback = {
|
|
200
|
+
/**
|
|
201
|
+
* RTCP feedback type.
|
|
202
|
+
*/
|
|
203
|
+
type: string;
|
|
204
|
+
/**
|
|
205
|
+
* RTCP feedback parameter.
|
|
206
|
+
*/
|
|
207
|
+
parameter?: string;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Provides information relating to an encoding, which represents a media RTP
|
|
211
|
+
* stream and its associated RTX stream (if any).
|
|
212
|
+
*/
|
|
213
|
+
export declare type RtpEncodingParameters = {
|
|
214
|
+
/**
|
|
215
|
+
* The media SSRC.
|
|
216
|
+
*/
|
|
217
|
+
ssrc?: number;
|
|
218
|
+
/**
|
|
219
|
+
* The RID RTP extension value. Must be unique.
|
|
220
|
+
*/
|
|
221
|
+
rid?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Codec payload type this encoding affects. If unset, first media codec is
|
|
224
|
+
* chosen.
|
|
225
|
+
*/
|
|
226
|
+
codecPayloadType?: number;
|
|
227
|
+
/**
|
|
228
|
+
* RTX stream information. It must contain a numeric ssrc field indicating
|
|
229
|
+
* the RTX SSRC.
|
|
230
|
+
*/
|
|
231
|
+
rtx?: {
|
|
232
|
+
ssrc: number;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* It indicates whether discontinuous RTP transmission will be used. Useful
|
|
236
|
+
* for audio (if the codec supports it) and for video screen sharing (when
|
|
237
|
+
* static content is being transmitted, this option disables the RTP
|
|
238
|
+
* inactivity checks in mediasoup). Default false.
|
|
239
|
+
*/
|
|
240
|
+
dtx?: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Number of spatial and temporal layers in the RTP stream (e.g. 'L1T3').
|
|
243
|
+
* See webrtc-svc.
|
|
244
|
+
*/
|
|
245
|
+
scalabilityMode?: string;
|
|
246
|
+
/**
|
|
247
|
+
* Others.
|
|
248
|
+
*/
|
|
249
|
+
scaleResolutionDownBy?: number;
|
|
250
|
+
maxBitrate?: number;
|
|
251
|
+
maxFramerate?: number;
|
|
252
|
+
adaptivePtime?: boolean;
|
|
253
|
+
priority?: 'very-low' | 'low' | 'medium' | 'high';
|
|
254
|
+
networkPriority?: 'very-low' | 'low' | 'medium' | 'high';
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Defines a RTP header extension within the RTP parameters. The list of RTP
|
|
258
|
+
* header extensions supported by mediasoup is defined in the
|
|
259
|
+
* supportedRtpCapabilities.ts file.
|
|
260
|
+
*
|
|
261
|
+
* mediasoup does not currently support encrypted RTP header extensions and no
|
|
262
|
+
* parameters are currently considered.
|
|
263
|
+
*/
|
|
264
|
+
export declare type RtpHeaderExtensionParameters = {
|
|
265
|
+
/**
|
|
266
|
+
* The URI of the RTP header extension, as defined in RFC 5285.
|
|
267
|
+
*/
|
|
268
|
+
uri: string;
|
|
269
|
+
/**
|
|
270
|
+
* The numeric identifier that goes in the RTP packet. Must be unique.
|
|
271
|
+
*/
|
|
272
|
+
id: number;
|
|
273
|
+
/**
|
|
274
|
+
* If true, the value in the header is encrypted as per RFC 6904. Default false.
|
|
275
|
+
*/
|
|
276
|
+
encrypt?: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Configuration parameters for the header extension.
|
|
279
|
+
*/
|
|
280
|
+
parameters?: any;
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Provides information on RTCP settings within the RTP parameters.
|
|
284
|
+
*
|
|
285
|
+
* If no cname is given in a producer's RTP parameters, the mediasoup transport
|
|
286
|
+
* will choose a random one that will be used into RTCP SDES messages sent to
|
|
287
|
+
* all its associated consumers.
|
|
288
|
+
*
|
|
289
|
+
* mediasoup assumes reducedSize to always be true.
|
|
290
|
+
*/
|
|
291
|
+
export declare type RtcpParameters = {
|
|
292
|
+
/**
|
|
293
|
+
* The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages).
|
|
294
|
+
*/
|
|
295
|
+
cname?: string;
|
|
296
|
+
/**
|
|
297
|
+
* Whether reduced size RTCP RFC 5506 is configured (if true) or compound RTCP
|
|
298
|
+
* as specified in RFC 3550 (if false). Default true.
|
|
299
|
+
*/
|
|
300
|
+
reducedSize?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Whether RTCP-mux is used. Default true.
|
|
303
|
+
*/
|
|
304
|
+
mux?: boolean;
|
|
305
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare type SctpCapabilities = {
|
|
2
|
+
numStreams: NumSctpStreams;
|
|
3
|
+
};
|
|
4
|
+
export declare type NumSctpStreams = {
|
|
5
|
+
/**
|
|
6
|
+
* Initially requested number of outgoing SCTP streams.
|
|
7
|
+
*/
|
|
8
|
+
OS: number;
|
|
9
|
+
/**
|
|
10
|
+
* Maximum number of incoming SCTP streams.
|
|
11
|
+
*/
|
|
12
|
+
MIS: number;
|
|
13
|
+
};
|
|
14
|
+
export declare type SctpParameters = {
|
|
15
|
+
/**
|
|
16
|
+
* Must always equal 5000.
|
|
17
|
+
*/
|
|
18
|
+
port: number;
|
|
19
|
+
/**
|
|
20
|
+
* Initially requested number of outgoing SCTP streams.
|
|
21
|
+
*/
|
|
22
|
+
OS: number;
|
|
23
|
+
/**
|
|
24
|
+
* Maximum number of incoming SCTP streams.
|
|
25
|
+
*/
|
|
26
|
+
MIS: number;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum allowed size for SCTP messages.
|
|
29
|
+
*/
|
|
30
|
+
maxMessageSize: number;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* SCTP stream parameters describe the reliability of a certain SCTP stream.
|
|
34
|
+
* If ordered is true then maxPacketLifeTime and maxRetransmits must be
|
|
35
|
+
* false.
|
|
36
|
+
* If ordered if false, only one of maxPacketLifeTime or maxRetransmits
|
|
37
|
+
* can be true.
|
|
38
|
+
*/
|
|
39
|
+
export declare type SctpStreamParameters = {
|
|
40
|
+
/**
|
|
41
|
+
* SCTP stream id.
|
|
42
|
+
*/
|
|
43
|
+
streamId?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Whether data messages must be received in order. if true the messages will
|
|
46
|
+
* be sent reliably. Default true.
|
|
47
|
+
*/
|
|
48
|
+
ordered?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* When ordered is false indicates the time (in milliseconds) after which a
|
|
51
|
+
* SCTP packet will stop being retransmitted.
|
|
52
|
+
*/
|
|
53
|
+
maxPacketLifeTime?: number;
|
|
54
|
+
/**
|
|
55
|
+
* When ordered is false indicates the maximum number of times a packet will
|
|
56
|
+
* be retransmitted.
|
|
57
|
+
*/
|
|
58
|
+
maxRetransmits?: number;
|
|
59
|
+
/**
|
|
60
|
+
* A label which can be used to distinguish this DataChannel from others.
|
|
61
|
+
*/
|
|
62
|
+
label?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Name of the sub-protocol used by this DataChannel.
|
|
65
|
+
*/
|
|
66
|
+
protocol?: string;
|
|
67
|
+
};
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { EnhancedEventEmitter } from './EnhancedEventEmitter';
|
|
2
|
+
import { HandlerFactory, HandlerInterface } from './handlers/HandlerInterface';
|
|
3
|
+
import { Producer, ProducerOptions } from './Producer';
|
|
4
|
+
import { Consumer, ConsumerOptions } from './Consumer';
|
|
5
|
+
import { DataProducer, DataProducerOptions } from './DataProducer';
|
|
6
|
+
import { DataConsumer, DataConsumerOptions } from './DataConsumer';
|
|
7
|
+
import { SctpParameters } from './SctpParameters';
|
|
8
|
+
interface InternalTransportOptions extends TransportOptions {
|
|
9
|
+
direction: 'send' | 'recv';
|
|
10
|
+
handlerFactory: HandlerFactory;
|
|
11
|
+
extendedRtpCapabilities: any;
|
|
12
|
+
canProduceByKind: CanProduceByKind;
|
|
13
|
+
}
|
|
14
|
+
export declare type TransportOptions = {
|
|
15
|
+
id: string;
|
|
16
|
+
iceParameters: IceParameters;
|
|
17
|
+
iceCandidates: IceCandidate[];
|
|
18
|
+
dtlsParameters: DtlsParameters;
|
|
19
|
+
sctpParameters?: SctpParameters;
|
|
20
|
+
iceServers?: RTCIceServer[];
|
|
21
|
+
iceTransportPolicy?: RTCIceTransportPolicy;
|
|
22
|
+
additionalSettings?: any;
|
|
23
|
+
proprietaryConstraints?: any;
|
|
24
|
+
appData?: any;
|
|
25
|
+
};
|
|
26
|
+
export declare type CanProduceByKind = {
|
|
27
|
+
audio: boolean;
|
|
28
|
+
video: boolean;
|
|
29
|
+
[key: string]: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare type IceParameters = {
|
|
32
|
+
/**
|
|
33
|
+
* ICE username fragment.
|
|
34
|
+
* */
|
|
35
|
+
usernameFragment: string;
|
|
36
|
+
/**
|
|
37
|
+
* ICE password.
|
|
38
|
+
*/
|
|
39
|
+
password: string;
|
|
40
|
+
/**
|
|
41
|
+
* ICE Lite.
|
|
42
|
+
*/
|
|
43
|
+
iceLite?: boolean;
|
|
44
|
+
};
|
|
45
|
+
export declare type IceCandidate = {
|
|
46
|
+
/**
|
|
47
|
+
* Unique identifier that allows ICE to correlate candidates that appear on
|
|
48
|
+
* multiple transports.
|
|
49
|
+
*/
|
|
50
|
+
foundation: string;
|
|
51
|
+
/**
|
|
52
|
+
* The assigned priority of the candidate.
|
|
53
|
+
*/
|
|
54
|
+
priority: number;
|
|
55
|
+
/**
|
|
56
|
+
* The IP address of the candidate.
|
|
57
|
+
*/
|
|
58
|
+
ip: string;
|
|
59
|
+
/**
|
|
60
|
+
* The protocol of the candidate.
|
|
61
|
+
*/
|
|
62
|
+
protocol: 'udp' | 'tcp';
|
|
63
|
+
/**
|
|
64
|
+
* The port for the candidate.
|
|
65
|
+
*/
|
|
66
|
+
port: number;
|
|
67
|
+
/**
|
|
68
|
+
* The type of candidate.
|
|
69
|
+
*/
|
|
70
|
+
type: 'host' | 'srflx' | 'prflx' | 'relay';
|
|
71
|
+
/**
|
|
72
|
+
* The type of TCP candidate.
|
|
73
|
+
*/
|
|
74
|
+
tcpType: 'active' | 'passive' | 'so';
|
|
75
|
+
};
|
|
76
|
+
export declare type DtlsParameters = {
|
|
77
|
+
/**
|
|
78
|
+
* Server DTLS role. Default 'auto'.
|
|
79
|
+
*/
|
|
80
|
+
role?: DtlsRole;
|
|
81
|
+
/**
|
|
82
|
+
* Server DTLS fingerprints.
|
|
83
|
+
*/
|
|
84
|
+
fingerprints: DtlsFingerprint[];
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* The hash function algorithm (as defined in the "Hash function Textual Names"
|
|
88
|
+
* registry initially specified in RFC 4572 Section 8) and its corresponding
|
|
89
|
+
* certificate fingerprint value (in lowercase hex string as expressed utilizing
|
|
90
|
+
* the syntax of "fingerprint" in RFC 4572 Section 5).
|
|
91
|
+
*/
|
|
92
|
+
export declare type DtlsFingerprint = {
|
|
93
|
+
algorithm: string;
|
|
94
|
+
value: string;
|
|
95
|
+
};
|
|
96
|
+
export declare type DtlsRole = 'auto' | 'client' | 'server';
|
|
97
|
+
export declare type ConnectionState = 'new' | 'connecting' | 'connected' | 'failed' | 'disconnected' | 'closed';
|
|
98
|
+
export declare type PlainRtpParameters = {
|
|
99
|
+
ip: string;
|
|
100
|
+
ipVersion: 4 | 6;
|
|
101
|
+
port: number;
|
|
102
|
+
};
|
|
103
|
+
export declare class Transport extends EnhancedEventEmitter {
|
|
104
|
+
private readonly _id;
|
|
105
|
+
private _closed;
|
|
106
|
+
private readonly _direction;
|
|
107
|
+
private readonly _extendedRtpCapabilities;
|
|
108
|
+
private readonly _canProduceByKind;
|
|
109
|
+
private readonly _maxSctpMessageSize?;
|
|
110
|
+
private readonly _handler;
|
|
111
|
+
private _connectionState;
|
|
112
|
+
private readonly _appData;
|
|
113
|
+
private readonly _producers;
|
|
114
|
+
private readonly _consumers;
|
|
115
|
+
private readonly _dataProducers;
|
|
116
|
+
private readonly _dataConsumers;
|
|
117
|
+
private _probatorConsumerCreated;
|
|
118
|
+
private readonly _awaitQueue;
|
|
119
|
+
private _pendingConsumerTasks;
|
|
120
|
+
private _consumerCreationInProgress;
|
|
121
|
+
protected readonly _observer: EnhancedEventEmitter;
|
|
122
|
+
/**
|
|
123
|
+
* @emits connect - (transportLocalParameters: any, callback: Function, errback: Function)
|
|
124
|
+
* @emits connectionstatechange - (connectionState: ConnectionState)
|
|
125
|
+
* @emits produce - (producerLocalParameters: any, callback: Function, errback: Function)
|
|
126
|
+
* @emits producedata - (dataProducerLocalParameters: any, callback: Function, errback: Function)
|
|
127
|
+
*/
|
|
128
|
+
constructor({ direction, id, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, appData, handlerFactory, extendedRtpCapabilities, canProduceByKind }: InternalTransportOptions);
|
|
129
|
+
/**
|
|
130
|
+
* Transport id.
|
|
131
|
+
*/
|
|
132
|
+
get id(): string;
|
|
133
|
+
/**
|
|
134
|
+
* Whether the Transport is closed.
|
|
135
|
+
*/
|
|
136
|
+
get closed(): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Transport direction.
|
|
139
|
+
*/
|
|
140
|
+
get direction(): 'send' | 'recv';
|
|
141
|
+
/**
|
|
142
|
+
* RTC handler instance.
|
|
143
|
+
*/
|
|
144
|
+
get handler(): HandlerInterface;
|
|
145
|
+
/**
|
|
146
|
+
* Connection state.
|
|
147
|
+
*/
|
|
148
|
+
get connectionState(): ConnectionState;
|
|
149
|
+
/**
|
|
150
|
+
* App custom data.
|
|
151
|
+
*/
|
|
152
|
+
get appData(): any;
|
|
153
|
+
/**
|
|
154
|
+
* Invalid setter.
|
|
155
|
+
*/
|
|
156
|
+
set appData(appData: any);
|
|
157
|
+
/**
|
|
158
|
+
* Observer.
|
|
159
|
+
*
|
|
160
|
+
* @emits close
|
|
161
|
+
* @emits newproducer - (producer: Producer)
|
|
162
|
+
* @emits newconsumer - (producer: Producer)
|
|
163
|
+
* @emits newdataproducer - (dataProducer: DataProducer)
|
|
164
|
+
* @emits newdataconsumer - (dataProducer: DataProducer)
|
|
165
|
+
*/
|
|
166
|
+
get observer(): EnhancedEventEmitter;
|
|
167
|
+
/**
|
|
168
|
+
* Close the Transport.
|
|
169
|
+
*/
|
|
170
|
+
close(): void;
|
|
171
|
+
/**
|
|
172
|
+
* Get associated Transport (RTCPeerConnection) stats.
|
|
173
|
+
*
|
|
174
|
+
* @returns {RTCStatsReport}
|
|
175
|
+
*/
|
|
176
|
+
getStats(): Promise<RTCStatsReport>;
|
|
177
|
+
/**
|
|
178
|
+
* Restart ICE connection.
|
|
179
|
+
*/
|
|
180
|
+
restartIce({ iceParameters }: {
|
|
181
|
+
iceParameters: IceParameters;
|
|
182
|
+
}): Promise<void>;
|
|
183
|
+
/**
|
|
184
|
+
* Update ICE servers.
|
|
185
|
+
*/
|
|
186
|
+
updateIceServers({ iceServers }?: {
|
|
187
|
+
iceServers?: RTCIceServer[];
|
|
188
|
+
}): Promise<void>;
|
|
189
|
+
/**
|
|
190
|
+
* Create a Producer.
|
|
191
|
+
*/
|
|
192
|
+
produce({ track, encodings, codecOptions, codec, stopTracks, disableTrackOnPause, zeroRtpOnPause, appData }?: ProducerOptions): Promise<Producer>;
|
|
193
|
+
/**
|
|
194
|
+
* Create a Consumer to consume a remote Producer.
|
|
195
|
+
*/
|
|
196
|
+
consume({ id, producerId, kind, rtpParameters, appData }: ConsumerOptions): Promise<Consumer>;
|
|
197
|
+
/**
|
|
198
|
+
* Create a DataProducer
|
|
199
|
+
*/
|
|
200
|
+
produceData({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, appData }?: DataProducerOptions): Promise<DataProducer>;
|
|
201
|
+
/**
|
|
202
|
+
* Create a DataConsumer
|
|
203
|
+
*/
|
|
204
|
+
consumeData({ id, dataProducerId, sctpStreamParameters, label, protocol, appData }: DataConsumerOptions): Promise<DataConsumer>;
|
|
205
|
+
_createPendingConsumers(): Promise<void>;
|
|
206
|
+
_handleHandler(): void;
|
|
207
|
+
_handleProducer(producer: Producer): void;
|
|
208
|
+
_handleConsumer(consumer: Consumer): void;
|
|
209
|
+
_handleDataProducer(dataProducer: DataProducer): void;
|
|
210
|
+
_handleDataConsumer(dataConsumer: DataConsumer): void;
|
|
211
|
+
}
|
|
212
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error indicating not support for something.
|
|
3
|
+
*/
|
|
4
|
+
export declare class UnsupportedError extends Error {
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Error produced when calling a method in an invalid state.
|
|
9
|
+
*/
|
|
10
|
+
export declare class InvalidStateError extends Error {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { EnhancedEventEmitter } from '../EnhancedEventEmitter';
|
|
2
|
+
import { ProducerCodecOptions } from '../Producer';
|
|
3
|
+
import { IceParameters, IceCandidate, DtlsParameters } from '../Transport';
|
|
4
|
+
import { RtpCapabilities, RtpCodecCapability, RtpParameters, RtpEncodingParameters } from '../RtpParameters';
|
|
5
|
+
import { SctpCapabilities, SctpParameters, SctpStreamParameters } from '../SctpParameters';
|
|
6
|
+
export declare type HandlerFactory = () => HandlerInterface;
|
|
7
|
+
export declare type HandlerRunOptions = {
|
|
8
|
+
direction: 'send' | 'recv';
|
|
9
|
+
iceParameters: IceParameters;
|
|
10
|
+
iceCandidates: IceCandidate[];
|
|
11
|
+
dtlsParameters: DtlsParameters;
|
|
12
|
+
sctpParameters?: SctpParameters;
|
|
13
|
+
iceServers?: RTCIceServer[];
|
|
14
|
+
iceTransportPolicy?: RTCIceTransportPolicy;
|
|
15
|
+
additionalSettings?: any;
|
|
16
|
+
proprietaryConstraints?: any;
|
|
17
|
+
extendedRtpCapabilities: any;
|
|
18
|
+
};
|
|
19
|
+
export declare type HandlerSendOptions = {
|
|
20
|
+
track: MediaStreamTrack;
|
|
21
|
+
encodings?: RtpEncodingParameters[];
|
|
22
|
+
codecOptions?: ProducerCodecOptions;
|
|
23
|
+
codec?: RtpCodecCapability;
|
|
24
|
+
};
|
|
25
|
+
export declare type HandlerSendResult = {
|
|
26
|
+
localId: string;
|
|
27
|
+
rtpParameters: RtpParameters;
|
|
28
|
+
rtpSender?: RTCRtpSender;
|
|
29
|
+
};
|
|
30
|
+
export declare type HandlerReceiveOptions = {
|
|
31
|
+
trackId: string;
|
|
32
|
+
kind: 'audio' | 'video';
|
|
33
|
+
rtpParameters: RtpParameters;
|
|
34
|
+
};
|
|
35
|
+
export declare type HandlerReceiveResult = {
|
|
36
|
+
localId: string;
|
|
37
|
+
track: MediaStreamTrack;
|
|
38
|
+
rtpReceiver?: RTCRtpReceiver;
|
|
39
|
+
};
|
|
40
|
+
export declare type HandlerSendDataChannelOptions = SctpStreamParameters;
|
|
41
|
+
export declare type HandlerSendDataChannelResult = {
|
|
42
|
+
dataChannel: RTCDataChannel;
|
|
43
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
44
|
+
};
|
|
45
|
+
export declare type HandlerReceiveDataChannelOptions = {
|
|
46
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
47
|
+
label?: string;
|
|
48
|
+
protocol?: string;
|
|
49
|
+
};
|
|
50
|
+
export declare type HandlerReceiveDataChannelResult = {
|
|
51
|
+
dataChannel: RTCDataChannel;
|
|
52
|
+
};
|
|
53
|
+
export declare abstract class HandlerInterface extends EnhancedEventEmitter {
|
|
54
|
+
/**
|
|
55
|
+
* @emits @connect - (
|
|
56
|
+
* { dtlsParameters: DtlsParameters },
|
|
57
|
+
* callback: Function,
|
|
58
|
+
* errback: Function
|
|
59
|
+
* )
|
|
60
|
+
* @emits @connectionstatechange - (connectionState: ConnectionState)
|
|
61
|
+
*/
|
|
62
|
+
constructor();
|
|
63
|
+
abstract get name(): string;
|
|
64
|
+
abstract close(): void;
|
|
65
|
+
abstract getNativeRtpCapabilities(): Promise<RtpCapabilities>;
|
|
66
|
+
abstract getNativeSctpCapabilities(): Promise<SctpCapabilities>;
|
|
67
|
+
abstract run(options: HandlerRunOptions): void;
|
|
68
|
+
abstract updateIceServers(iceServers: RTCIceServer[]): Promise<void>;
|
|
69
|
+
abstract restartIce(iceParameters: IceParameters): Promise<void>;
|
|
70
|
+
abstract getTransportStats(): Promise<RTCStatsReport>;
|
|
71
|
+
abstract send(options: HandlerSendOptions): Promise<HandlerSendResult>;
|
|
72
|
+
abstract stopSending(localId: string): Promise<void>;
|
|
73
|
+
abstract replaceTrack(localId: string, track: MediaStreamTrack | null): Promise<void>;
|
|
74
|
+
abstract setMaxSpatialLayer(localId: string, spatialLayer: number): Promise<void>;
|
|
75
|
+
abstract setRtpEncodingParameters(localId: string, params: any): Promise<void>;
|
|
76
|
+
abstract getSenderStats(localId: string): Promise<RTCStatsReport>;
|
|
77
|
+
abstract sendDataChannel(options: HandlerSendDataChannelOptions): Promise<HandlerSendDataChannelResult>;
|
|
78
|
+
abstract receive(optionsList: HandlerReceiveOptions[]): Promise<HandlerReceiveResult[]>;
|
|
79
|
+
abstract stopReceiving(localId: string): Promise<void>;
|
|
80
|
+
abstract pauseReceiving(localId: string): Promise<void>;
|
|
81
|
+
abstract resumeReceiving(localId: string): Promise<void>;
|
|
82
|
+
abstract getReceiverStats(localId: string): Promise<RTCStatsReport>;
|
|
83
|
+
abstract receiveDataChannel(options: HandlerReceiveDataChannelOptions): Promise<HandlerReceiveDataChannelResult>;
|
|
84
|
+
}
|