mediasoup-client 3.6.88 → 3.6.90
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/lib/index.d.ts +1435 -14
- package/lib/index.js +11884 -43
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +11860 -0
- package/lib/index.mjs.map +1 -0
- package/npm-scripts.mjs +17 -11
- package/package.json +12 -8
- package/lib/Consumer.d.ts +0 -115
- package/lib/Consumer.d.ts.map +0 -1
- package/lib/Consumer.js +0 -190
- package/lib/DataConsumer.d.ts +0 -93
- package/lib/DataConsumer.d.ts.map +0 -1
- package/lib/DataConsumer.js +0 -162
- package/lib/DataProducer.d.ts +0 -97
- package/lib/DataProducer.d.ts.map +0 -1
- package/lib/DataProducer.js +0 -180
- package/lib/Device.d.ts +0 -92
- package/lib/Device.d.ts.map +0 -1
- package/lib/Device.js +0 -464
- package/lib/EnhancedEventEmitter.d.ts +0 -24
- package/lib/EnhancedEventEmitter.d.ts.map +0 -1
- package/lib/EnhancedEventEmitter.js +0 -70
- package/lib/Logger.d.ts +0 -11
- package/lib/Logger.d.ts.map +0 -1
- package/lib/Logger.js +0 -37
- package/lib/Producer.d.ts +0 -169
- package/lib/Producer.d.ts.map +0 -1
- package/lib/Producer.js +0 -287
- package/lib/RtpParameters.d.ts +0 -306
- package/lib/RtpParameters.d.ts.map +0 -1
- package/lib/RtpParameters.js +0 -6
- package/lib/SctpParameters.d.ts +0 -68
- package/lib/SctpParameters.d.ts.map +0 -1
- package/lib/SctpParameters.js +0 -2
- package/lib/Transport.d.ts +0 -243
- package/lib/Transport.d.ts.map +0 -1
- package/lib/Transport.js +0 -824
- package/lib/errors.d.ts +0 -13
- package/lib/errors.d.ts.map +0 -1
- package/lib/errors.js +0 -39
- package/lib/handlers/Chrome111.d.ts +0 -49
- package/lib/handlers/Chrome111.d.ts.map +0 -1
- package/lib/handlers/Chrome111.js +0 -658
- package/lib/handlers/Chrome55.d.ts +0 -51
- package/lib/handlers/Chrome55.d.ts.map +0 -1
- package/lib/handlers/Chrome55.js +0 -542
- package/lib/handlers/Chrome67.d.ts +0 -51
- package/lib/handlers/Chrome67.d.ts.map +0 -1
- package/lib/handlers/Chrome67.js +0 -598
- package/lib/handlers/Chrome70.d.ts +0 -49
- package/lib/handlers/Chrome70.d.ts.map +0 -1
- package/lib/handlers/Chrome70.js +0 -627
- package/lib/handlers/Chrome74.d.ts +0 -49
- package/lib/handlers/Chrome74.d.ts.map +0 -1
- package/lib/handlers/Chrome74.js +0 -675
- package/lib/handlers/Edge11.d.ts +0 -55
- package/lib/handlers/Edge11.d.ts.map +0 -1
- package/lib/handlers/Edge11.js +0 -447
- package/lib/handlers/FakeHandler.d.ts +0 -49
- package/lib/handlers/FakeHandler.d.ts.map +0 -1
- package/lib/handlers/FakeHandler.js +0 -276
- package/lib/handlers/Firefox60.d.ts +0 -48
- package/lib/handlers/Firefox60.d.ts.map +0 -1
- package/lib/handlers/Firefox60.js +0 -681
- package/lib/handlers/HandlerInterface.d.ts +0 -97
- package/lib/handlers/HandlerInterface.d.ts.map +0 -1
- package/lib/handlers/HandlerInterface.js +0 -10
- package/lib/handlers/ReactNative.d.ts +0 -51
- package/lib/handlers/ReactNative.d.ts.map +0 -1
- package/lib/handlers/ReactNative.js +0 -558
- package/lib/handlers/ReactNativeUnifiedPlan.d.ts +0 -49
- package/lib/handlers/ReactNativeUnifiedPlan.d.ts.map +0 -1
- package/lib/handlers/ReactNativeUnifiedPlan.js +0 -686
- package/lib/handlers/Safari11.d.ts +0 -51
- package/lib/handlers/Safari11.d.ts.map +0 -1
- package/lib/handlers/Safari11.js +0 -592
- package/lib/handlers/Safari12.d.ts +0 -49
- package/lib/handlers/Safari12.d.ts.map +0 -1
- package/lib/handlers/Safari12.js +0 -648
- package/lib/handlers/ortc/edgeUtils.d.ts +0 -11
- package/lib/handlers/ortc/edgeUtils.d.ts.map +0 -1
- package/lib/handlers/ortc/edgeUtils.js +0 -86
- package/lib/handlers/ortc/utils.d.ts +0 -6
- package/lib/handlers/ortc/utils.d.ts.map +0 -1
- package/lib/handlers/ortc/utils.js +0 -20
- package/lib/handlers/sdp/MediaSection.d.ts +0 -68
- package/lib/handlers/sdp/MediaSection.d.ts.map +0 -1
- package/lib/handlers/sdp/MediaSection.js +0 -589
- package/lib/handlers/sdp/RemoteSdp.d.ts +0 -75
- package/lib/handlers/sdp/RemoteSdp.d.ts.map +0 -1
- package/lib/handlers/sdp/RemoteSdp.js +0 -303
- package/lib/handlers/sdp/commonUtils.d.ts +0 -24
- package/lib/handlers/sdp/commonUtils.d.ts.map +0 -1
- package/lib/handlers/sdp/commonUtils.js +0 -224
- package/lib/handlers/sdp/plainRtpUtils.d.ts +0 -14
- package/lib/handlers/sdp/plainRtpUtils.d.ts.map +0 -1
- package/lib/handlers/sdp/plainRtpUtils.js +0 -33
- package/lib/handlers/sdp/planBUtils.d.ts +0 -14
- package/lib/handlers/sdp/planBUtils.d.ts.map +0 -1
- package/lib/handlers/sdp/planBUtils.js +0 -155
- package/lib/handlers/sdp/unifiedPlanUtils.d.ts +0 -12
- package/lib/handlers/sdp/unifiedPlanUtils.d.ts.map +0 -1
- package/lib/handlers/sdp/unifiedPlanUtils.js +0 -131
- package/lib/index.d.ts.map +0 -1
- package/lib/ortc.d.ts +0 -123
- package/lib/ortc.d.ts.map +0 -1
- package/lib/ortc.js +0 -943
- package/lib/scalabilityModes.d.ts +0 -6
- package/lib/scalabilityModes.d.ts.map +0 -1
- package/lib/scalabilityModes.js +0 -20
- package/lib/tests/fakeParameters.d.ts +0 -20
- package/lib/tests/fakeParameters.d.ts.map +0 -1
- package/lib/tests/fakeParameters.js +0 -659
- package/lib/tests/test.d.ts +0 -6
- package/lib/tests/test.d.ts.map +0 -1
- package/lib/tests/test.js +0 -1297
- package/lib/tests/uaTestCases.d.ts +0 -9
- package/lib/tests/uaTestCases.d.ts.map +0 -1
- package/lib/tests/uaTestCases.js +0 -85
- package/lib/types.d.ts +0 -15
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js +0 -26
- package/lib/utils.d.ts +0 -9
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js +0 -20
package/lib/index.d.ts
CHANGED
|
@@ -1,24 +1,1445 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
export { default as debug } from 'debug';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
|
|
4
|
+
type Events = Record<string, any[]>;
|
|
5
|
+
declare class EnhancedEventEmitter<E extends Events = Events> extends EventEmitter {
|
|
6
|
+
constructor();
|
|
7
|
+
emit<K extends keyof E & string>(eventName: K, ...args: E[K]): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Special addition to the EventEmitter API.
|
|
10
|
+
*/
|
|
11
|
+
safeEmit<K extends keyof E & string>(eventName: K, ...args: E[K]): boolean;
|
|
12
|
+
on<K extends keyof E & string>(eventName: K, listener: (...args: E[K]) => void): this;
|
|
13
|
+
off<K extends keyof E & string>(eventName: K, listener: (...args: E[K]) => void): this;
|
|
14
|
+
addListener<K extends keyof E & string>(eventName: K, listener: (...args: E[K]) => void): this;
|
|
15
|
+
prependListener<K extends keyof E & string>(eventName: K, listener: (...args: E[K]) => void): this;
|
|
16
|
+
once<K extends keyof E & string>(eventName: K, listener: (...args: E[K]) => void): this;
|
|
17
|
+
prependOnceListener<K extends keyof E & string>(eventName: K, listener: (...args: E[K]) => void): this;
|
|
18
|
+
removeListener<K extends keyof E & string>(eventName: K, listener: (...args: E[K]) => void): this;
|
|
19
|
+
removeAllListeners<K extends keyof E & string>(eventName?: K): this;
|
|
20
|
+
listenerCount<K extends keyof E & string>(eventName: K): number;
|
|
21
|
+
listeners<K extends keyof E & string>(eventName: K): Function[];
|
|
22
|
+
rawListeners<K extends keyof E & string>(eventName: K): Function[];
|
|
23
|
+
}
|
|
24
|
+
|
|
4
25
|
/**
|
|
5
|
-
*
|
|
26
|
+
* The RTP capabilities define what mediasoup or an endpoint can receive at
|
|
27
|
+
* media level.
|
|
6
28
|
*/
|
|
7
|
-
|
|
29
|
+
type RtpCapabilities = {
|
|
30
|
+
/**
|
|
31
|
+
* Supported media and RTX codecs.
|
|
32
|
+
*/
|
|
33
|
+
codecs?: RtpCodecCapability[];
|
|
34
|
+
/**
|
|
35
|
+
* Supported RTP header extensions.
|
|
36
|
+
*/
|
|
37
|
+
headerExtensions?: RtpHeaderExtension[];
|
|
38
|
+
};
|
|
8
39
|
/**
|
|
9
|
-
*
|
|
40
|
+
* Media kind ('audio' or 'video').
|
|
41
|
+
*/
|
|
42
|
+
type MediaKind = 'audio' | 'video';
|
|
43
|
+
/**
|
|
44
|
+
* Provides information on the capabilities of a codec within the RTP
|
|
45
|
+
* capabilities. The list of media codecs supported by mediasoup and their
|
|
46
|
+
* settings is defined in the supportedRtpCapabilities.ts file.
|
|
47
|
+
*
|
|
48
|
+
* Exactly one RtpCodecCapability will be present for each supported combination
|
|
49
|
+
* of parameters that requires a distinct value of preferredPayloadType. For
|
|
50
|
+
* example:
|
|
51
|
+
*
|
|
52
|
+
* - Multiple H264 codecs, each with their own distinct 'packetization-mode' and
|
|
53
|
+
* 'profile-level-id' values.
|
|
54
|
+
* - Multiple VP9 codecs, each with their own distinct 'profile-id' value.
|
|
55
|
+
*
|
|
56
|
+
* RtpCodecCapability entries in the mediaCodecs array of RouterOptions do not
|
|
57
|
+
* require preferredPayloadType field (if unset, mediasoup will choose a random
|
|
58
|
+
* one). If given, make sure it's in the 96-127 range.
|
|
59
|
+
*/
|
|
60
|
+
type RtpCodecCapability = {
|
|
61
|
+
/**
|
|
62
|
+
* Media kind.
|
|
63
|
+
*/
|
|
64
|
+
kind: MediaKind;
|
|
65
|
+
/**
|
|
66
|
+
* The codec MIME media type/subtype (e.g. 'audio/opus', 'video/VP8').
|
|
67
|
+
*/
|
|
68
|
+
mimeType: string;
|
|
69
|
+
/**
|
|
70
|
+
* The preferred RTP payload type.
|
|
71
|
+
*/
|
|
72
|
+
preferredPayloadType?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Codec clock rate expressed in Hertz.
|
|
75
|
+
*/
|
|
76
|
+
clockRate: number;
|
|
77
|
+
/**
|
|
78
|
+
* The number of channels supported (e.g. two for stereo). Just for audio.
|
|
79
|
+
* Default 1.
|
|
80
|
+
*/
|
|
81
|
+
channels?: number;
|
|
82
|
+
/**
|
|
83
|
+
* Codec specific parameters. Some parameters (such as 'packetization-mode'
|
|
84
|
+
* and 'profile-level-id' in H264 or 'profile-id' in VP9) are critical for
|
|
85
|
+
* codec matching.
|
|
86
|
+
*/
|
|
87
|
+
parameters?: any;
|
|
88
|
+
/**
|
|
89
|
+
* Transport layer and codec-specific feedback messages for this codec.
|
|
90
|
+
*/
|
|
91
|
+
rtcpFeedback?: RtcpFeedback[];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Direction of RTP header extension.
|
|
95
|
+
*/
|
|
96
|
+
type RtpHeaderExtensionDirection = 'sendrecv' | 'sendonly' | 'recvonly' | 'inactive';
|
|
97
|
+
/**
|
|
98
|
+
* Provides information relating to supported header extensions. The list of
|
|
99
|
+
* RTP header extensions supported by mediasoup is defined in the
|
|
100
|
+
* supportedRtpCapabilities.ts file.
|
|
101
|
+
*
|
|
102
|
+
* mediasoup does not currently support encrypted RTP header extensions. The
|
|
103
|
+
* direction field is just present in mediasoup RTP capabilities (retrieved via
|
|
104
|
+
* router.rtpCapabilities or mediasoup.getSupportedRtpCapabilities()). It's
|
|
105
|
+
* ignored if present in endpoints' RTP capabilities.
|
|
106
|
+
*/
|
|
107
|
+
type RtpHeaderExtension = {
|
|
108
|
+
/**
|
|
109
|
+
* Media kind.
|
|
110
|
+
*/
|
|
111
|
+
kind: MediaKind;
|
|
112
|
+
uri: string;
|
|
113
|
+
/**
|
|
114
|
+
* The preferred numeric identifier that goes in the RTP packet. Must be
|
|
115
|
+
* unique.
|
|
116
|
+
*/
|
|
117
|
+
preferredId: number;
|
|
118
|
+
/**
|
|
119
|
+
* If true, it is preferred that the value in the header be encrypted as per
|
|
120
|
+
* RFC 6904. Default false.
|
|
121
|
+
*/
|
|
122
|
+
preferredEncrypt?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* If 'sendrecv', mediasoup supports sending and receiving this RTP extension.
|
|
125
|
+
* 'sendonly' means that mediasoup can send (but not receive) it. 'recvonly'
|
|
126
|
+
* means that mediasoup can receive (but not send) it.
|
|
127
|
+
*/
|
|
128
|
+
direction?: RtpHeaderExtensionDirection;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* The RTP send parameters describe a media stream received by mediasoup from
|
|
132
|
+
* an endpoint through its corresponding mediasoup Producer. These parameters
|
|
133
|
+
* may include a mid value that the mediasoup transport will use to match
|
|
134
|
+
* received RTP packets based on their MID RTP extension value.
|
|
135
|
+
*
|
|
136
|
+
* mediasoup allows RTP send parameters with a single encoding and with multiple
|
|
137
|
+
* encodings (simulcast). In the latter case, each entry in the encodings array
|
|
138
|
+
* must include a ssrc field or a rid field (the RID RTP extension value). Check
|
|
139
|
+
* the Simulcast and SVC sections for more information.
|
|
140
|
+
*
|
|
141
|
+
* The RTP receive parameters describe a media stream as sent by mediasoup to
|
|
142
|
+
* an endpoint through its corresponding mediasoup Consumer. The mid value is
|
|
143
|
+
* unset (mediasoup does not include the MID RTP extension into RTP packets
|
|
144
|
+
* being sent to endpoints).
|
|
145
|
+
*
|
|
146
|
+
* There is a single entry in the encodings array (even if the corresponding
|
|
147
|
+
* producer uses simulcast). The consumer sends a single and continuous RTP
|
|
148
|
+
* stream to the endpoint and spatial/temporal layer selection is possible via
|
|
149
|
+
* consumer.setPreferredLayers().
|
|
150
|
+
*
|
|
151
|
+
* As an exception, previous bullet is not true when consuming a stream over a
|
|
152
|
+
* PipeTransport, in which all RTP streams from the associated producer are
|
|
153
|
+
* forwarded verbatim through the consumer.
|
|
154
|
+
*
|
|
155
|
+
* The RTP receive parameters will always have their ssrc values randomly
|
|
156
|
+
* generated for all of its encodings (and optional rtx: { ssrc: XXXX } if the
|
|
157
|
+
* endpoint supports RTX), regardless of the original RTP send parameters in
|
|
158
|
+
* the associated producer. This applies even if the producer's encodings have
|
|
159
|
+
* rid set.
|
|
160
|
+
*/
|
|
161
|
+
type RtpParameters = {
|
|
162
|
+
/**
|
|
163
|
+
* The MID RTP extension value as defined in the BUNDLE specification.
|
|
164
|
+
*/
|
|
165
|
+
mid?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Media and RTX codecs in use.
|
|
168
|
+
*/
|
|
169
|
+
codecs: RtpCodecParameters[];
|
|
170
|
+
/**
|
|
171
|
+
* RTP header extensions in use.
|
|
172
|
+
*/
|
|
173
|
+
headerExtensions?: RtpHeaderExtensionParameters[];
|
|
174
|
+
/**
|
|
175
|
+
* Transmitted RTP streams and their settings.
|
|
176
|
+
*/
|
|
177
|
+
encodings?: RtpEncodingParameters[];
|
|
178
|
+
/**
|
|
179
|
+
* Parameters used for RTCP.
|
|
180
|
+
*/
|
|
181
|
+
rtcp?: RtcpParameters;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Provides information on codec settings within the RTP parameters. The list
|
|
185
|
+
* of media codecs supported by mediasoup and their settings is defined in the
|
|
186
|
+
* supportedRtpCapabilities.ts file.
|
|
187
|
+
*/
|
|
188
|
+
type RtpCodecParameters = {
|
|
189
|
+
/**
|
|
190
|
+
* The codec MIME media type/subtype (e.g. 'audio/opus', 'video/VP8').
|
|
191
|
+
*/
|
|
192
|
+
mimeType: string;
|
|
193
|
+
/**
|
|
194
|
+
* The value that goes in the RTP Payload Type Field. Must be unique.
|
|
195
|
+
*/
|
|
196
|
+
payloadType: number;
|
|
197
|
+
/**
|
|
198
|
+
* Codec clock rate expressed in Hertz.
|
|
199
|
+
*/
|
|
200
|
+
clockRate: number;
|
|
201
|
+
/**
|
|
202
|
+
* The number of channels supported (e.g. two for stereo). Just for audio.
|
|
203
|
+
* Default 1.
|
|
204
|
+
*/
|
|
205
|
+
channels?: number;
|
|
206
|
+
/**
|
|
207
|
+
* Codec-specific parameters available for signaling. Some parameters (such
|
|
208
|
+
* as 'packetization-mode' and 'profile-level-id' in H264 or 'profile-id' in
|
|
209
|
+
* VP9) are critical for codec matching.
|
|
210
|
+
*/
|
|
211
|
+
parameters?: any;
|
|
212
|
+
/**
|
|
213
|
+
* Transport layer and codec-specific feedback messages for this codec.
|
|
214
|
+
*/
|
|
215
|
+
rtcpFeedback?: RtcpFeedback[];
|
|
216
|
+
};
|
|
217
|
+
/**
|
|
218
|
+
* Provides information on RTCP feedback messages for a specific codec. Those
|
|
219
|
+
* messages can be transport layer feedback messages or codec-specific feedback
|
|
220
|
+
* messages. The list of RTCP feedbacks supported by mediasoup is defined in the
|
|
221
|
+
* supportedRtpCapabilities.ts file.
|
|
222
|
+
*/
|
|
223
|
+
type RtcpFeedback = {
|
|
224
|
+
/**
|
|
225
|
+
* RTCP feedback type.
|
|
226
|
+
*/
|
|
227
|
+
type: string;
|
|
228
|
+
/**
|
|
229
|
+
* RTCP feedback parameter.
|
|
230
|
+
*/
|
|
231
|
+
parameter?: string;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Provides information relating to an encoding, which represents a media RTP
|
|
235
|
+
* stream and its associated RTX stream (if any).
|
|
236
|
+
*/
|
|
237
|
+
type RtpEncodingParameters = {
|
|
238
|
+
/**
|
|
239
|
+
* The media SSRC.
|
|
240
|
+
*/
|
|
241
|
+
ssrc?: number;
|
|
242
|
+
/**
|
|
243
|
+
* The RID RTP extension value. Must be unique.
|
|
244
|
+
*/
|
|
245
|
+
rid?: string;
|
|
246
|
+
/**
|
|
247
|
+
* Codec payload type this encoding affects. If unset, first media codec is
|
|
248
|
+
* chosen.
|
|
249
|
+
*/
|
|
250
|
+
codecPayloadType?: number;
|
|
251
|
+
/**
|
|
252
|
+
* RTX stream information. It must contain a numeric ssrc field indicating
|
|
253
|
+
* the RTX SSRC.
|
|
254
|
+
*/
|
|
255
|
+
rtx?: {
|
|
256
|
+
ssrc: number;
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* It indicates whether discontinuous RTP transmission will be used. Useful
|
|
260
|
+
* for audio (if the codec supports it) and for video screen sharing (when
|
|
261
|
+
* static content is being transmitted, this option disables the RTP
|
|
262
|
+
* inactivity checks in mediasoup). Default false.
|
|
263
|
+
*/
|
|
264
|
+
dtx?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Number of spatial and temporal layers in the RTP stream (e.g. 'L1T3').
|
|
267
|
+
* See webrtc-svc.
|
|
268
|
+
*/
|
|
269
|
+
scalabilityMode?: string;
|
|
270
|
+
/**
|
|
271
|
+
* Others.
|
|
272
|
+
*/
|
|
273
|
+
scaleResolutionDownBy?: number;
|
|
274
|
+
maxBitrate?: number;
|
|
275
|
+
maxFramerate?: number;
|
|
276
|
+
adaptivePtime?: boolean;
|
|
277
|
+
priority?: 'very-low' | 'low' | 'medium' | 'high';
|
|
278
|
+
networkPriority?: 'very-low' | 'low' | 'medium' | 'high';
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Defines a RTP header extension within the RTP parameters. The list of RTP
|
|
282
|
+
* header extensions supported by mediasoup is defined in the
|
|
283
|
+
* supportedRtpCapabilities.ts file.
|
|
284
|
+
*
|
|
285
|
+
* mediasoup does not currently support encrypted RTP header extensions and no
|
|
286
|
+
* parameters are currently considered.
|
|
287
|
+
*/
|
|
288
|
+
type RtpHeaderExtensionParameters = {
|
|
289
|
+
/**
|
|
290
|
+
* The URI of the RTP header extension, as defined in RFC 5285.
|
|
291
|
+
*/
|
|
292
|
+
uri: string;
|
|
293
|
+
/**
|
|
294
|
+
* The numeric identifier that goes in the RTP packet. Must be unique.
|
|
295
|
+
*/
|
|
296
|
+
id: number;
|
|
297
|
+
/**
|
|
298
|
+
* If true, the value in the header is encrypted as per RFC 6904. Default false.
|
|
299
|
+
*/
|
|
300
|
+
encrypt?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Configuration parameters for the header extension.
|
|
303
|
+
*/
|
|
304
|
+
parameters?: any;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* Provides information on RTCP settings within the RTP parameters.
|
|
308
|
+
*
|
|
309
|
+
* If no cname is given in a producer's RTP parameters, the mediasoup transport
|
|
310
|
+
* will choose a random one that will be used into RTCP SDES messages sent to
|
|
311
|
+
* all its associated consumers.
|
|
312
|
+
*
|
|
313
|
+
* mediasoup assumes reducedSize to always be true.
|
|
314
|
+
*/
|
|
315
|
+
type RtcpParameters = {
|
|
316
|
+
/**
|
|
317
|
+
* The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages).
|
|
318
|
+
*/
|
|
319
|
+
cname?: string;
|
|
320
|
+
/**
|
|
321
|
+
* Whether reduced size RTCP RFC 5506 is configured (if true) or compound RTCP
|
|
322
|
+
* as specified in RFC 3550 (if false). Default true.
|
|
323
|
+
*/
|
|
324
|
+
reducedSize?: boolean;
|
|
325
|
+
/**
|
|
326
|
+
* Whether RTCP-mux is used. Default true.
|
|
327
|
+
*/
|
|
328
|
+
mux?: boolean;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
type ConsumerOptions<ConsumerAppData extends AppData = AppData> = {
|
|
332
|
+
id?: string;
|
|
333
|
+
producerId?: string;
|
|
334
|
+
kind?: 'audio' | 'video';
|
|
335
|
+
rtpParameters: RtpParameters;
|
|
336
|
+
streamId?: string;
|
|
337
|
+
appData?: ConsumerAppData;
|
|
338
|
+
};
|
|
339
|
+
type ConsumerEvents = {
|
|
340
|
+
transportclose: [];
|
|
341
|
+
trackended: [];
|
|
342
|
+
'@getstats': [(stats: RTCStatsReport) => void, (error: Error) => void];
|
|
343
|
+
'@close': [];
|
|
344
|
+
'@pause': [];
|
|
345
|
+
'@resume': [];
|
|
346
|
+
};
|
|
347
|
+
type ConsumerObserverEvents = {
|
|
348
|
+
close: [];
|
|
349
|
+
pause: [];
|
|
350
|
+
resume: [];
|
|
351
|
+
trackended: [];
|
|
352
|
+
};
|
|
353
|
+
declare class Consumer<ConsumerAppData extends AppData = AppData> extends EnhancedEventEmitter<ConsumerEvents> {
|
|
354
|
+
private readonly _id;
|
|
355
|
+
private readonly _localId;
|
|
356
|
+
private readonly _producerId;
|
|
357
|
+
private _closed;
|
|
358
|
+
private readonly _rtpReceiver?;
|
|
359
|
+
private readonly _track;
|
|
360
|
+
private readonly _rtpParameters;
|
|
361
|
+
private _paused;
|
|
362
|
+
private _appData;
|
|
363
|
+
protected readonly _observer: EnhancedEventEmitter<ConsumerObserverEvents>;
|
|
364
|
+
constructor({ id, localId, producerId, rtpReceiver, track, rtpParameters, appData }: {
|
|
365
|
+
id: string;
|
|
366
|
+
localId: string;
|
|
367
|
+
producerId: string;
|
|
368
|
+
rtpReceiver?: RTCRtpReceiver;
|
|
369
|
+
track: MediaStreamTrack;
|
|
370
|
+
rtpParameters: RtpParameters;
|
|
371
|
+
appData?: ConsumerAppData;
|
|
372
|
+
});
|
|
373
|
+
/**
|
|
374
|
+
* Consumer id.
|
|
375
|
+
*/
|
|
376
|
+
get id(): string;
|
|
377
|
+
/**
|
|
378
|
+
* Local id.
|
|
379
|
+
*/
|
|
380
|
+
get localId(): string;
|
|
381
|
+
/**
|
|
382
|
+
* Associated Producer id.
|
|
383
|
+
*/
|
|
384
|
+
get producerId(): string;
|
|
385
|
+
/**
|
|
386
|
+
* Whether the Consumer is closed.
|
|
387
|
+
*/
|
|
388
|
+
get closed(): boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Media kind.
|
|
391
|
+
*/
|
|
392
|
+
get kind(): MediaKind;
|
|
393
|
+
/**
|
|
394
|
+
* Associated RTCRtpReceiver.
|
|
395
|
+
*/
|
|
396
|
+
get rtpReceiver(): RTCRtpReceiver | undefined;
|
|
397
|
+
/**
|
|
398
|
+
* The associated track.
|
|
399
|
+
*/
|
|
400
|
+
get track(): MediaStreamTrack;
|
|
401
|
+
/**
|
|
402
|
+
* RTP parameters.
|
|
403
|
+
*/
|
|
404
|
+
get rtpParameters(): RtpParameters;
|
|
405
|
+
/**
|
|
406
|
+
* Whether the Consumer is paused.
|
|
407
|
+
*/
|
|
408
|
+
get paused(): boolean;
|
|
409
|
+
/**
|
|
410
|
+
* App custom data.
|
|
411
|
+
*/
|
|
412
|
+
get appData(): ConsumerAppData;
|
|
413
|
+
/**
|
|
414
|
+
* App custom data setter.
|
|
415
|
+
*/
|
|
416
|
+
set appData(appData: ConsumerAppData);
|
|
417
|
+
get observer(): EnhancedEventEmitter;
|
|
418
|
+
/**
|
|
419
|
+
* Closes the Consumer.
|
|
420
|
+
*/
|
|
421
|
+
close(): void;
|
|
422
|
+
/**
|
|
423
|
+
* Transport was closed.
|
|
424
|
+
*/
|
|
425
|
+
transportClosed(): void;
|
|
426
|
+
/**
|
|
427
|
+
* Get associated RTCRtpReceiver stats.
|
|
428
|
+
*/
|
|
429
|
+
getStats(): Promise<RTCStatsReport>;
|
|
430
|
+
/**
|
|
431
|
+
* Pauses receiving media.
|
|
432
|
+
*/
|
|
433
|
+
pause(): void;
|
|
434
|
+
/**
|
|
435
|
+
* Resumes receiving media.
|
|
436
|
+
*/
|
|
437
|
+
resume(): void;
|
|
438
|
+
private onTrackEnded;
|
|
439
|
+
private handleTrack;
|
|
440
|
+
private destroyTrack;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
type SctpCapabilities = {
|
|
444
|
+
numStreams: NumSctpStreams;
|
|
445
|
+
};
|
|
446
|
+
type NumSctpStreams = {
|
|
447
|
+
/**
|
|
448
|
+
* Initially requested number of outgoing SCTP streams.
|
|
449
|
+
*/
|
|
450
|
+
OS: number;
|
|
451
|
+
/**
|
|
452
|
+
* Maximum number of incoming SCTP streams.
|
|
453
|
+
*/
|
|
454
|
+
MIS: number;
|
|
455
|
+
};
|
|
456
|
+
type SctpParameters = {
|
|
457
|
+
/**
|
|
458
|
+
* Must always equal 5000.
|
|
459
|
+
*/
|
|
460
|
+
port: number;
|
|
461
|
+
/**
|
|
462
|
+
* Initially requested number of outgoing SCTP streams.
|
|
463
|
+
*/
|
|
464
|
+
OS: number;
|
|
465
|
+
/**
|
|
466
|
+
* Maximum number of incoming SCTP streams.
|
|
467
|
+
*/
|
|
468
|
+
MIS: number;
|
|
469
|
+
/**
|
|
470
|
+
* Maximum allowed size for SCTP messages.
|
|
471
|
+
*/
|
|
472
|
+
maxMessageSize: number;
|
|
473
|
+
};
|
|
474
|
+
/**
|
|
475
|
+
* SCTP stream parameters describe the reliability of a certain SCTP stream.
|
|
476
|
+
* If ordered is true then maxPacketLifeTime and maxRetransmits must be
|
|
477
|
+
* false.
|
|
478
|
+
* If ordered if false, only one of maxPacketLifeTime or maxRetransmits
|
|
479
|
+
* can be true.
|
|
10
480
|
*/
|
|
11
|
-
|
|
481
|
+
type SctpStreamParameters = {
|
|
482
|
+
/**
|
|
483
|
+
* SCTP stream id.
|
|
484
|
+
*/
|
|
485
|
+
streamId?: number;
|
|
486
|
+
/**
|
|
487
|
+
* Whether data messages must be received in order. if true the messages will
|
|
488
|
+
* be sent reliably. Default true.
|
|
489
|
+
*/
|
|
490
|
+
ordered?: boolean;
|
|
491
|
+
/**
|
|
492
|
+
* When ordered is false indicates the time (in milliseconds) after which a
|
|
493
|
+
* SCTP packet will stop being retransmitted.
|
|
494
|
+
*/
|
|
495
|
+
maxPacketLifeTime?: number;
|
|
496
|
+
/**
|
|
497
|
+
* When ordered is false indicates the maximum number of times a packet will
|
|
498
|
+
* be retransmitted.
|
|
499
|
+
*/
|
|
500
|
+
maxRetransmits?: number;
|
|
501
|
+
/**
|
|
502
|
+
* A label which can be used to distinguish this DataChannel from others.
|
|
503
|
+
*/
|
|
504
|
+
label?: string;
|
|
505
|
+
/**
|
|
506
|
+
* Name of the sub-protocol used by this DataChannel.
|
|
507
|
+
*/
|
|
508
|
+
protocol?: string;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
type DataProducerOptions<DataProducerAppData extends AppData = AppData> = {
|
|
512
|
+
ordered?: boolean;
|
|
513
|
+
maxPacketLifeTime?: number;
|
|
514
|
+
maxRetransmits?: number;
|
|
515
|
+
label?: string;
|
|
516
|
+
protocol?: string;
|
|
517
|
+
appData?: DataProducerAppData;
|
|
518
|
+
};
|
|
519
|
+
type DataProducerEvents = {
|
|
520
|
+
transportclose: [];
|
|
521
|
+
open: [];
|
|
522
|
+
error: [Error];
|
|
523
|
+
close: [];
|
|
524
|
+
bufferedamountlow: [];
|
|
525
|
+
'@close': [];
|
|
526
|
+
};
|
|
527
|
+
type DataProducerObserverEvents = {
|
|
528
|
+
close: [];
|
|
529
|
+
};
|
|
530
|
+
declare class DataProducer<DataProducerAppData extends AppData = AppData> extends EnhancedEventEmitter<DataProducerEvents> {
|
|
531
|
+
private readonly _id;
|
|
532
|
+
private readonly _dataChannel;
|
|
533
|
+
private _closed;
|
|
534
|
+
private readonly _sctpStreamParameters;
|
|
535
|
+
private _appData;
|
|
536
|
+
protected readonly _observer: EnhancedEventEmitter<DataProducerObserverEvents>;
|
|
537
|
+
constructor({ id, dataChannel, sctpStreamParameters, appData }: {
|
|
538
|
+
id: string;
|
|
539
|
+
dataChannel: RTCDataChannel;
|
|
540
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
541
|
+
appData?: DataProducerAppData;
|
|
542
|
+
});
|
|
543
|
+
/**
|
|
544
|
+
* DataProducer id.
|
|
545
|
+
*/
|
|
546
|
+
get id(): string;
|
|
547
|
+
/**
|
|
548
|
+
* Whether the DataProducer is closed.
|
|
549
|
+
*/
|
|
550
|
+
get closed(): boolean;
|
|
551
|
+
/**
|
|
552
|
+
* SCTP stream parameters.
|
|
553
|
+
*/
|
|
554
|
+
get sctpStreamParameters(): SctpStreamParameters;
|
|
555
|
+
/**
|
|
556
|
+
* DataChannel readyState.
|
|
557
|
+
*/
|
|
558
|
+
get readyState(): RTCDataChannelState;
|
|
559
|
+
/**
|
|
560
|
+
* DataChannel label.
|
|
561
|
+
*/
|
|
562
|
+
get label(): string;
|
|
563
|
+
/**
|
|
564
|
+
* DataChannel protocol.
|
|
565
|
+
*/
|
|
566
|
+
get protocol(): string;
|
|
567
|
+
/**
|
|
568
|
+
* DataChannel bufferedAmount.
|
|
569
|
+
*/
|
|
570
|
+
get bufferedAmount(): number;
|
|
571
|
+
/**
|
|
572
|
+
* DataChannel bufferedAmountLowThreshold.
|
|
573
|
+
*/
|
|
574
|
+
get bufferedAmountLowThreshold(): number;
|
|
575
|
+
/**
|
|
576
|
+
* Set DataChannel bufferedAmountLowThreshold.
|
|
577
|
+
*/
|
|
578
|
+
set bufferedAmountLowThreshold(bufferedAmountLowThreshold: number);
|
|
579
|
+
/**
|
|
580
|
+
* App custom data.
|
|
581
|
+
*/
|
|
582
|
+
get appData(): DataProducerAppData;
|
|
583
|
+
/**
|
|
584
|
+
* App custom data setter.
|
|
585
|
+
*/
|
|
586
|
+
set appData(appData: DataProducerAppData);
|
|
587
|
+
get observer(): EnhancedEventEmitter;
|
|
588
|
+
/**
|
|
589
|
+
* Closes the DataProducer.
|
|
590
|
+
*/
|
|
591
|
+
close(): void;
|
|
592
|
+
/**
|
|
593
|
+
* Transport was closed.
|
|
594
|
+
*/
|
|
595
|
+
transportClosed(): void;
|
|
596
|
+
/**
|
|
597
|
+
* Send a message.
|
|
598
|
+
*
|
|
599
|
+
* @param {String|Blob|ArrayBuffer|ArrayBufferView} data.
|
|
600
|
+
*/
|
|
601
|
+
send(data: any): void;
|
|
602
|
+
private handleDataChannel;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
type DataConsumerOptions<DataConsumerAppData extends AppData = AppData> = {
|
|
606
|
+
id?: string;
|
|
607
|
+
dataProducerId?: string;
|
|
608
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
609
|
+
label?: string;
|
|
610
|
+
protocol?: string;
|
|
611
|
+
appData?: DataConsumerAppData;
|
|
612
|
+
};
|
|
613
|
+
type DataConsumerEvents = {
|
|
614
|
+
transportclose: [];
|
|
615
|
+
open: [];
|
|
616
|
+
error: [Error];
|
|
617
|
+
close: [];
|
|
618
|
+
message: [any];
|
|
619
|
+
'@close': [];
|
|
620
|
+
};
|
|
621
|
+
type DataConsumerObserverEvents = {
|
|
622
|
+
close: [];
|
|
623
|
+
};
|
|
624
|
+
declare class DataConsumer<DataConsumerAppData extends AppData = AppData> extends EnhancedEventEmitter<DataConsumerEvents> {
|
|
625
|
+
private readonly _id;
|
|
626
|
+
private readonly _dataProducerId;
|
|
627
|
+
private readonly _dataChannel;
|
|
628
|
+
private _closed;
|
|
629
|
+
private readonly _sctpStreamParameters;
|
|
630
|
+
private _appData;
|
|
631
|
+
protected readonly _observer: EnhancedEventEmitter<DataConsumerObserverEvents>;
|
|
632
|
+
constructor({ id, dataProducerId, dataChannel, sctpStreamParameters, appData }: {
|
|
633
|
+
id: string;
|
|
634
|
+
dataProducerId: string;
|
|
635
|
+
dataChannel: RTCDataChannel;
|
|
636
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
637
|
+
appData?: DataConsumerAppData;
|
|
638
|
+
});
|
|
639
|
+
/**
|
|
640
|
+
* DataConsumer id.
|
|
641
|
+
*/
|
|
642
|
+
get id(): string;
|
|
643
|
+
/**
|
|
644
|
+
* Associated DataProducer id.
|
|
645
|
+
*/
|
|
646
|
+
get dataProducerId(): string;
|
|
647
|
+
/**
|
|
648
|
+
* Whether the DataConsumer is closed.
|
|
649
|
+
*/
|
|
650
|
+
get closed(): boolean;
|
|
651
|
+
/**
|
|
652
|
+
* SCTP stream parameters.
|
|
653
|
+
*/
|
|
654
|
+
get sctpStreamParameters(): SctpStreamParameters;
|
|
655
|
+
/**
|
|
656
|
+
* DataChannel readyState.
|
|
657
|
+
*/
|
|
658
|
+
get readyState(): RTCDataChannelState;
|
|
659
|
+
/**
|
|
660
|
+
* DataChannel label.
|
|
661
|
+
*/
|
|
662
|
+
get label(): string;
|
|
663
|
+
/**
|
|
664
|
+
* DataChannel protocol.
|
|
665
|
+
*/
|
|
666
|
+
get protocol(): string;
|
|
667
|
+
/**
|
|
668
|
+
* DataChannel binaryType.
|
|
669
|
+
*/
|
|
670
|
+
get binaryType(): BinaryType;
|
|
671
|
+
/**
|
|
672
|
+
* Set DataChannel binaryType.
|
|
673
|
+
*/
|
|
674
|
+
set binaryType(binaryType: BinaryType);
|
|
675
|
+
/**
|
|
676
|
+
* App custom data.
|
|
677
|
+
*/
|
|
678
|
+
get appData(): DataConsumerAppData;
|
|
679
|
+
/**
|
|
680
|
+
* App custom data setter.
|
|
681
|
+
*/
|
|
682
|
+
set appData(appData: DataConsumerAppData);
|
|
683
|
+
get observer(): EnhancedEventEmitter;
|
|
684
|
+
/**
|
|
685
|
+
* Closes the DataConsumer.
|
|
686
|
+
*/
|
|
687
|
+
close(): void;
|
|
688
|
+
/**
|
|
689
|
+
* Transport was closed.
|
|
690
|
+
*/
|
|
691
|
+
transportClosed(): void;
|
|
692
|
+
private handleDataChannel;
|
|
693
|
+
}
|
|
694
|
+
|
|
12
695
|
/**
|
|
13
|
-
*
|
|
696
|
+
* Error indicating not support for something.
|
|
14
697
|
*/
|
|
15
|
-
|
|
698
|
+
declare class UnsupportedError extends Error {
|
|
699
|
+
constructor(message: string);
|
|
700
|
+
}
|
|
16
701
|
/**
|
|
17
|
-
*
|
|
702
|
+
* Error produced when calling a method in an invalid state.
|
|
18
703
|
*/
|
|
19
|
-
|
|
704
|
+
declare class InvalidStateError extends Error {
|
|
705
|
+
constructor(message: string);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
type ScalabilityMode = {
|
|
709
|
+
spatialLayers: number;
|
|
710
|
+
temporalLayers: number;
|
|
711
|
+
};
|
|
712
|
+
declare function parse(scalabilityMode?: string): ScalabilityMode;
|
|
713
|
+
|
|
714
|
+
type AppData = {
|
|
715
|
+
[key: string]: unknown;
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
type types_AppData = AppData;
|
|
719
|
+
type types_BuiltinHandlerName = BuiltinHandlerName;
|
|
720
|
+
type types_CanProduceByKind = CanProduceByKind;
|
|
721
|
+
type types_ConnectionState = ConnectionState;
|
|
722
|
+
type types_Consumer<ConsumerAppData extends AppData = AppData> = Consumer<ConsumerAppData>;
|
|
723
|
+
declare const types_Consumer: typeof Consumer;
|
|
724
|
+
type types_ConsumerEvents = ConsumerEvents;
|
|
725
|
+
type types_ConsumerObserverEvents = ConsumerObserverEvents;
|
|
726
|
+
type types_ConsumerOptions<ConsumerAppData extends AppData = AppData> = ConsumerOptions<ConsumerAppData>;
|
|
727
|
+
type types_DataConsumer<DataConsumerAppData extends AppData = AppData> = DataConsumer<DataConsumerAppData>;
|
|
728
|
+
declare const types_DataConsumer: typeof DataConsumer;
|
|
729
|
+
type types_DataConsumerEvents = DataConsumerEvents;
|
|
730
|
+
type types_DataConsumerObserverEvents = DataConsumerObserverEvents;
|
|
731
|
+
type types_DataConsumerOptions<DataConsumerAppData extends AppData = AppData> = DataConsumerOptions<DataConsumerAppData>;
|
|
732
|
+
type types_DataProducer<DataProducerAppData extends AppData = AppData> = DataProducer<DataProducerAppData>;
|
|
733
|
+
declare const types_DataProducer: typeof DataProducer;
|
|
734
|
+
type types_DataProducerEvents = DataProducerEvents;
|
|
735
|
+
type types_DataProducerObserverEvents = DataProducerObserverEvents;
|
|
736
|
+
type types_DataProducerOptions<DataProducerAppData extends AppData = AppData> = DataProducerOptions<DataProducerAppData>;
|
|
737
|
+
type types_Device = Device;
|
|
738
|
+
declare const types_Device: typeof Device;
|
|
739
|
+
type types_DeviceObserverEvents = DeviceObserverEvents;
|
|
740
|
+
type types_DeviceOptions = DeviceOptions;
|
|
741
|
+
type types_DtlsFingerprint = DtlsFingerprint;
|
|
742
|
+
type types_DtlsParameters = DtlsParameters;
|
|
743
|
+
type types_DtlsRole = DtlsRole;
|
|
744
|
+
type types_HandlerEvents = HandlerEvents;
|
|
745
|
+
type types_HandlerFactory = HandlerFactory;
|
|
746
|
+
type types_HandlerInterface = HandlerInterface;
|
|
747
|
+
declare const types_HandlerInterface: typeof HandlerInterface;
|
|
748
|
+
type types_HandlerReceiveDataChannelOptions = HandlerReceiveDataChannelOptions;
|
|
749
|
+
type types_HandlerReceiveDataChannelResult = HandlerReceiveDataChannelResult;
|
|
750
|
+
type types_HandlerReceiveOptions = HandlerReceiveOptions;
|
|
751
|
+
type types_HandlerReceiveResult = HandlerReceiveResult;
|
|
752
|
+
type types_HandlerRunOptions = HandlerRunOptions;
|
|
753
|
+
type types_HandlerSendDataChannelOptions = HandlerSendDataChannelOptions;
|
|
754
|
+
type types_HandlerSendDataChannelResult = HandlerSendDataChannelResult;
|
|
755
|
+
type types_HandlerSendOptions = HandlerSendOptions;
|
|
756
|
+
type types_HandlerSendResult = HandlerSendResult;
|
|
757
|
+
type types_IceCandidate = IceCandidate;
|
|
758
|
+
type types_IceParameters = IceParameters;
|
|
759
|
+
type types_InvalidStateError = InvalidStateError;
|
|
760
|
+
declare const types_InvalidStateError: typeof InvalidStateError;
|
|
761
|
+
type types_MediaKind = MediaKind;
|
|
762
|
+
type types_NumSctpStreams = NumSctpStreams;
|
|
763
|
+
type types_PlainRtpParameters = PlainRtpParameters;
|
|
764
|
+
type types_Producer<ProducerAppData extends AppData = AppData> = Producer<ProducerAppData>;
|
|
765
|
+
declare const types_Producer: typeof Producer;
|
|
766
|
+
type types_ProducerCodecOptions = ProducerCodecOptions;
|
|
767
|
+
type types_ProducerEvents = ProducerEvents;
|
|
768
|
+
type types_ProducerObserverEvents = ProducerObserverEvents;
|
|
769
|
+
type types_ProducerOptions<ProducerAppData extends AppData = AppData> = ProducerOptions<ProducerAppData>;
|
|
770
|
+
type types_RtcpFeedback = RtcpFeedback;
|
|
771
|
+
type types_RtcpParameters = RtcpParameters;
|
|
772
|
+
type types_RtpCapabilities = RtpCapabilities;
|
|
773
|
+
type types_RtpCodecCapability = RtpCodecCapability;
|
|
774
|
+
type types_RtpCodecParameters = RtpCodecParameters;
|
|
775
|
+
type types_RtpEncodingParameters = RtpEncodingParameters;
|
|
776
|
+
type types_RtpHeaderExtension = RtpHeaderExtension;
|
|
777
|
+
type types_RtpHeaderExtensionDirection = RtpHeaderExtensionDirection;
|
|
778
|
+
type types_RtpHeaderExtensionParameters = RtpHeaderExtensionParameters;
|
|
779
|
+
type types_RtpParameters = RtpParameters;
|
|
780
|
+
type types_ScalabilityMode = ScalabilityMode;
|
|
781
|
+
type types_SctpCapabilities = SctpCapabilities;
|
|
782
|
+
type types_SctpParameters = SctpParameters;
|
|
783
|
+
type types_SctpStreamParameters = SctpStreamParameters;
|
|
784
|
+
type types_Transport<TransportAppData extends AppData = AppData> = Transport<TransportAppData>;
|
|
785
|
+
declare const types_Transport: typeof Transport;
|
|
786
|
+
type types_TransportEvents = TransportEvents;
|
|
787
|
+
type types_TransportObserverEvents = TransportObserverEvents;
|
|
788
|
+
type types_TransportOptions<TransportAppData extends AppData = AppData> = TransportOptions<TransportAppData>;
|
|
789
|
+
type types_UnsupportedError = UnsupportedError;
|
|
790
|
+
declare const types_UnsupportedError: typeof UnsupportedError;
|
|
791
|
+
declare const types_detectDevice: typeof detectDevice;
|
|
792
|
+
declare namespace types {
|
|
793
|
+
export {
|
|
794
|
+
types_AppData as AppData,
|
|
795
|
+
types_BuiltinHandlerName as BuiltinHandlerName,
|
|
796
|
+
types_CanProduceByKind as CanProduceByKind,
|
|
797
|
+
types_ConnectionState as ConnectionState,
|
|
798
|
+
types_Consumer as Consumer,
|
|
799
|
+
types_ConsumerEvents as ConsumerEvents,
|
|
800
|
+
types_ConsumerObserverEvents as ConsumerObserverEvents,
|
|
801
|
+
types_ConsumerOptions as ConsumerOptions,
|
|
802
|
+
types_DataConsumer as DataConsumer,
|
|
803
|
+
types_DataConsumerEvents as DataConsumerEvents,
|
|
804
|
+
types_DataConsumerObserverEvents as DataConsumerObserverEvents,
|
|
805
|
+
types_DataConsumerOptions as DataConsumerOptions,
|
|
806
|
+
types_DataProducer as DataProducer,
|
|
807
|
+
types_DataProducerEvents as DataProducerEvents,
|
|
808
|
+
types_DataProducerObserverEvents as DataProducerObserverEvents,
|
|
809
|
+
types_DataProducerOptions as DataProducerOptions,
|
|
810
|
+
types_Device as Device,
|
|
811
|
+
types_DeviceObserverEvents as DeviceObserverEvents,
|
|
812
|
+
types_DeviceOptions as DeviceOptions,
|
|
813
|
+
types_DtlsFingerprint as DtlsFingerprint,
|
|
814
|
+
types_DtlsParameters as DtlsParameters,
|
|
815
|
+
types_DtlsRole as DtlsRole,
|
|
816
|
+
types_HandlerEvents as HandlerEvents,
|
|
817
|
+
types_HandlerFactory as HandlerFactory,
|
|
818
|
+
types_HandlerInterface as HandlerInterface,
|
|
819
|
+
types_HandlerReceiveDataChannelOptions as HandlerReceiveDataChannelOptions,
|
|
820
|
+
types_HandlerReceiveDataChannelResult as HandlerReceiveDataChannelResult,
|
|
821
|
+
types_HandlerReceiveOptions as HandlerReceiveOptions,
|
|
822
|
+
types_HandlerReceiveResult as HandlerReceiveResult,
|
|
823
|
+
types_HandlerRunOptions as HandlerRunOptions,
|
|
824
|
+
types_HandlerSendDataChannelOptions as HandlerSendDataChannelOptions,
|
|
825
|
+
types_HandlerSendDataChannelResult as HandlerSendDataChannelResult,
|
|
826
|
+
types_HandlerSendOptions as HandlerSendOptions,
|
|
827
|
+
types_HandlerSendResult as HandlerSendResult,
|
|
828
|
+
types_IceCandidate as IceCandidate,
|
|
829
|
+
types_IceParameters as IceParameters,
|
|
830
|
+
types_InvalidStateError as InvalidStateError,
|
|
831
|
+
types_MediaKind as MediaKind,
|
|
832
|
+
types_NumSctpStreams as NumSctpStreams,
|
|
833
|
+
types_PlainRtpParameters as PlainRtpParameters,
|
|
834
|
+
types_Producer as Producer,
|
|
835
|
+
types_ProducerCodecOptions as ProducerCodecOptions,
|
|
836
|
+
types_ProducerEvents as ProducerEvents,
|
|
837
|
+
types_ProducerObserverEvents as ProducerObserverEvents,
|
|
838
|
+
types_ProducerOptions as ProducerOptions,
|
|
839
|
+
types_RtcpFeedback as RtcpFeedback,
|
|
840
|
+
types_RtcpParameters as RtcpParameters,
|
|
841
|
+
types_RtpCapabilities as RtpCapabilities,
|
|
842
|
+
types_RtpCodecCapability as RtpCodecCapability,
|
|
843
|
+
types_RtpCodecParameters as RtpCodecParameters,
|
|
844
|
+
types_RtpEncodingParameters as RtpEncodingParameters,
|
|
845
|
+
types_RtpHeaderExtension as RtpHeaderExtension,
|
|
846
|
+
types_RtpHeaderExtensionDirection as RtpHeaderExtensionDirection,
|
|
847
|
+
types_RtpHeaderExtensionParameters as RtpHeaderExtensionParameters,
|
|
848
|
+
types_RtpParameters as RtpParameters,
|
|
849
|
+
types_ScalabilityMode as ScalabilityMode,
|
|
850
|
+
types_SctpCapabilities as SctpCapabilities,
|
|
851
|
+
types_SctpParameters as SctpParameters,
|
|
852
|
+
types_SctpStreamParameters as SctpStreamParameters,
|
|
853
|
+
types_Transport as Transport,
|
|
854
|
+
types_TransportEvents as TransportEvents,
|
|
855
|
+
types_TransportObserverEvents as TransportObserverEvents,
|
|
856
|
+
types_TransportOptions as TransportOptions,
|
|
857
|
+
types_UnsupportedError as UnsupportedError,
|
|
858
|
+
types_detectDevice as detectDevice,
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
type ProducerOptions<ProducerAppData extends AppData = AppData> = {
|
|
863
|
+
track?: MediaStreamTrack;
|
|
864
|
+
encodings?: RtpEncodingParameters[];
|
|
865
|
+
codecOptions?: ProducerCodecOptions;
|
|
866
|
+
codec?: RtpCodecCapability;
|
|
867
|
+
stopTracks?: boolean;
|
|
868
|
+
disableTrackOnPause?: boolean;
|
|
869
|
+
zeroRtpOnPause?: boolean;
|
|
870
|
+
appData?: ProducerAppData;
|
|
871
|
+
};
|
|
872
|
+
type ProducerCodecOptions = {
|
|
873
|
+
opusStereo?: boolean;
|
|
874
|
+
opusFec?: boolean;
|
|
875
|
+
opusDtx?: boolean;
|
|
876
|
+
opusMaxPlaybackRate?: number;
|
|
877
|
+
opusMaxAverageBitrate?: number;
|
|
878
|
+
opusPtime?: number;
|
|
879
|
+
opusNack?: boolean;
|
|
880
|
+
videoGoogleStartBitrate?: number;
|
|
881
|
+
videoGoogleMaxBitrate?: number;
|
|
882
|
+
videoGoogleMinBitrate?: number;
|
|
883
|
+
};
|
|
884
|
+
type ProducerEvents = {
|
|
885
|
+
transportclose: [];
|
|
886
|
+
trackended: [];
|
|
887
|
+
'@pause': [
|
|
888
|
+
() => void,
|
|
889
|
+
(error: Error) => void
|
|
890
|
+
];
|
|
891
|
+
'@resume': [
|
|
892
|
+
() => void,
|
|
893
|
+
(error: Error) => void
|
|
894
|
+
];
|
|
895
|
+
'@replacetrack': [
|
|
896
|
+
MediaStreamTrack | null,
|
|
897
|
+
() => void,
|
|
898
|
+
(error: Error) => void
|
|
899
|
+
];
|
|
900
|
+
'@setmaxspatiallayer': [
|
|
901
|
+
number,
|
|
902
|
+
() => void,
|
|
903
|
+
(error: Error) => void
|
|
904
|
+
];
|
|
905
|
+
'@setrtpencodingparameters': [
|
|
906
|
+
RTCRtpEncodingParameters,
|
|
907
|
+
() => void,
|
|
908
|
+
(error: Error) => void
|
|
909
|
+
];
|
|
910
|
+
'@getstats': [(stats: RTCStatsReport) => void, (error: Error) => void];
|
|
911
|
+
'@close': [];
|
|
912
|
+
};
|
|
913
|
+
type ProducerObserverEvents = {
|
|
914
|
+
close: [];
|
|
915
|
+
pause: [];
|
|
916
|
+
resume: [];
|
|
917
|
+
trackended: [];
|
|
918
|
+
};
|
|
919
|
+
declare class Producer<ProducerAppData extends AppData = AppData> extends EnhancedEventEmitter<ProducerEvents> {
|
|
920
|
+
private readonly _id;
|
|
921
|
+
private readonly _localId;
|
|
922
|
+
private _closed;
|
|
923
|
+
private readonly _rtpSender?;
|
|
924
|
+
private _track;
|
|
925
|
+
private readonly _kind;
|
|
926
|
+
private readonly _rtpParameters;
|
|
927
|
+
private _paused;
|
|
928
|
+
private _maxSpatialLayer;
|
|
929
|
+
private _stopTracks;
|
|
930
|
+
private _disableTrackOnPause;
|
|
931
|
+
private _zeroRtpOnPause;
|
|
932
|
+
private _appData;
|
|
933
|
+
protected readonly _observer: EnhancedEventEmitter<ProducerObserverEvents>;
|
|
934
|
+
constructor({ id, localId, rtpSender, track, rtpParameters, stopTracks, disableTrackOnPause, zeroRtpOnPause, appData }: {
|
|
935
|
+
id: string;
|
|
936
|
+
localId: string;
|
|
937
|
+
rtpSender?: RTCRtpSender;
|
|
938
|
+
track: MediaStreamTrack;
|
|
939
|
+
rtpParameters: RtpParameters;
|
|
940
|
+
stopTracks: boolean;
|
|
941
|
+
disableTrackOnPause: boolean;
|
|
942
|
+
zeroRtpOnPause: boolean;
|
|
943
|
+
appData?: ProducerAppData;
|
|
944
|
+
});
|
|
945
|
+
/**
|
|
946
|
+
* Producer id.
|
|
947
|
+
*/
|
|
948
|
+
get id(): string;
|
|
949
|
+
/**
|
|
950
|
+
* Local id.
|
|
951
|
+
*/
|
|
952
|
+
get localId(): string;
|
|
953
|
+
/**
|
|
954
|
+
* Whether the Producer is closed.
|
|
955
|
+
*/
|
|
956
|
+
get closed(): boolean;
|
|
957
|
+
/**
|
|
958
|
+
* Media kind.
|
|
959
|
+
*/
|
|
960
|
+
get kind(): MediaKind;
|
|
961
|
+
/**
|
|
962
|
+
* Associated RTCRtpSender.
|
|
963
|
+
*/
|
|
964
|
+
get rtpSender(): RTCRtpSender | undefined;
|
|
965
|
+
/**
|
|
966
|
+
* The associated track.
|
|
967
|
+
*/
|
|
968
|
+
get track(): MediaStreamTrack | null;
|
|
969
|
+
/**
|
|
970
|
+
* RTP parameters.
|
|
971
|
+
*/
|
|
972
|
+
get rtpParameters(): RtpParameters;
|
|
973
|
+
/**
|
|
974
|
+
* Whether the Producer is paused.
|
|
975
|
+
*/
|
|
976
|
+
get paused(): boolean;
|
|
977
|
+
/**
|
|
978
|
+
* Max spatial layer.
|
|
979
|
+
*
|
|
980
|
+
* @type {Number | undefined}
|
|
981
|
+
*/
|
|
982
|
+
get maxSpatialLayer(): number | undefined;
|
|
983
|
+
/**
|
|
984
|
+
* App custom data.
|
|
985
|
+
*/
|
|
986
|
+
get appData(): ProducerAppData;
|
|
987
|
+
/**
|
|
988
|
+
* App custom data setter.
|
|
989
|
+
*/
|
|
990
|
+
set appData(appData: ProducerAppData);
|
|
991
|
+
get observer(): EnhancedEventEmitter;
|
|
992
|
+
/**
|
|
993
|
+
* Closes the Producer.
|
|
994
|
+
*/
|
|
995
|
+
close(): void;
|
|
996
|
+
/**
|
|
997
|
+
* Transport was closed.
|
|
998
|
+
*/
|
|
999
|
+
transportClosed(): void;
|
|
1000
|
+
/**
|
|
1001
|
+
* Get associated RTCRtpSender stats.
|
|
1002
|
+
*/
|
|
1003
|
+
getStats(): Promise<RTCStatsReport>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Pauses sending media.
|
|
1006
|
+
*/
|
|
1007
|
+
pause(): void;
|
|
1008
|
+
/**
|
|
1009
|
+
* Resumes sending media.
|
|
1010
|
+
*/
|
|
1011
|
+
resume(): void;
|
|
1012
|
+
/**
|
|
1013
|
+
* Replaces the current track with a new one or null.
|
|
1014
|
+
*/
|
|
1015
|
+
replaceTrack({ track }: {
|
|
1016
|
+
track: MediaStreamTrack | null;
|
|
1017
|
+
}): Promise<void>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Sets the video max spatial layer to be sent.
|
|
1020
|
+
*/
|
|
1021
|
+
setMaxSpatialLayer(spatialLayer: number): Promise<void>;
|
|
1022
|
+
setRtpEncodingParameters(params: RTCRtpEncodingParameters): Promise<void>;
|
|
1023
|
+
private onTrackEnded;
|
|
1024
|
+
private handleTrack;
|
|
1025
|
+
private destroyTrack;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
type HandlerFactory = () => HandlerInterface;
|
|
1029
|
+
type HandlerRunOptions = {
|
|
1030
|
+
direction: 'send' | 'recv';
|
|
1031
|
+
iceParameters: IceParameters;
|
|
1032
|
+
iceCandidates: IceCandidate[];
|
|
1033
|
+
dtlsParameters: DtlsParameters;
|
|
1034
|
+
sctpParameters?: SctpParameters;
|
|
1035
|
+
iceServers?: RTCIceServer[];
|
|
1036
|
+
iceTransportPolicy?: RTCIceTransportPolicy;
|
|
1037
|
+
additionalSettings?: any;
|
|
1038
|
+
proprietaryConstraints?: any;
|
|
1039
|
+
extendedRtpCapabilities: any;
|
|
1040
|
+
};
|
|
1041
|
+
type HandlerSendOptions = {
|
|
1042
|
+
track: MediaStreamTrack;
|
|
1043
|
+
encodings?: RtpEncodingParameters[];
|
|
1044
|
+
codecOptions?: ProducerCodecOptions;
|
|
1045
|
+
codec?: RtpCodecCapability;
|
|
1046
|
+
};
|
|
1047
|
+
type HandlerSendResult = {
|
|
1048
|
+
localId: string;
|
|
1049
|
+
rtpParameters: RtpParameters;
|
|
1050
|
+
rtpSender?: RTCRtpSender;
|
|
1051
|
+
};
|
|
1052
|
+
type HandlerReceiveOptions = {
|
|
1053
|
+
trackId: string;
|
|
1054
|
+
kind: 'audio' | 'video';
|
|
1055
|
+
rtpParameters: RtpParameters;
|
|
1056
|
+
/**
|
|
1057
|
+
* Stream id. WebRTC based devices try to synchronize inbound streams with
|
|
1058
|
+
* same streamId. If not given, the consuming device will be told to
|
|
1059
|
+
* synchronize all streams produced by the same endpoint. However libwebrtc
|
|
1060
|
+
* can just synchronize up to one audio stream with one video stream.
|
|
1061
|
+
*/
|
|
1062
|
+
streamId?: string;
|
|
1063
|
+
};
|
|
1064
|
+
type HandlerReceiveResult = {
|
|
1065
|
+
localId: string;
|
|
1066
|
+
track: MediaStreamTrack;
|
|
1067
|
+
rtpReceiver?: RTCRtpReceiver;
|
|
1068
|
+
};
|
|
1069
|
+
type HandlerSendDataChannelOptions = SctpStreamParameters;
|
|
1070
|
+
type HandlerSendDataChannelResult = {
|
|
1071
|
+
dataChannel: RTCDataChannel;
|
|
1072
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
1073
|
+
};
|
|
1074
|
+
type HandlerReceiveDataChannelOptions = {
|
|
1075
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
1076
|
+
label?: string;
|
|
1077
|
+
protocol?: string;
|
|
1078
|
+
};
|
|
1079
|
+
type HandlerReceiveDataChannelResult = {
|
|
1080
|
+
dataChannel: RTCDataChannel;
|
|
1081
|
+
};
|
|
1082
|
+
type HandlerEvents = {
|
|
1083
|
+
'@close': [];
|
|
1084
|
+
'@connect': [
|
|
1085
|
+
{
|
|
1086
|
+
dtlsParameters: DtlsParameters;
|
|
1087
|
+
},
|
|
1088
|
+
() => void,
|
|
1089
|
+
(error: Error) => void
|
|
1090
|
+
];
|
|
1091
|
+
'@connectionstatechange': [ConnectionState];
|
|
1092
|
+
};
|
|
1093
|
+
declare abstract class HandlerInterface extends EnhancedEventEmitter<HandlerEvents> {
|
|
1094
|
+
constructor();
|
|
1095
|
+
abstract get name(): string;
|
|
1096
|
+
abstract close(): void;
|
|
1097
|
+
abstract getNativeRtpCapabilities(): Promise<RtpCapabilities>;
|
|
1098
|
+
abstract getNativeSctpCapabilities(): Promise<SctpCapabilities>;
|
|
1099
|
+
abstract run(options: HandlerRunOptions): void;
|
|
1100
|
+
abstract updateIceServers(iceServers: RTCIceServer[]): Promise<void>;
|
|
1101
|
+
abstract restartIce(iceParameters: IceParameters): Promise<void>;
|
|
1102
|
+
abstract getTransportStats(): Promise<RTCStatsReport>;
|
|
1103
|
+
abstract send(options: HandlerSendOptions): Promise<HandlerSendResult>;
|
|
1104
|
+
abstract stopSending(localId: string): Promise<void>;
|
|
1105
|
+
abstract pauseSending(localId: string): Promise<void>;
|
|
1106
|
+
abstract resumeSending(localId: string): Promise<void>;
|
|
1107
|
+
abstract replaceTrack(localId: string, track: MediaStreamTrack | null): Promise<void>;
|
|
1108
|
+
abstract setMaxSpatialLayer(localId: string, spatialLayer: number): Promise<void>;
|
|
1109
|
+
abstract setRtpEncodingParameters(localId: string, params: any): Promise<void>;
|
|
1110
|
+
abstract getSenderStats(localId: string): Promise<RTCStatsReport>;
|
|
1111
|
+
abstract sendDataChannel(options: HandlerSendDataChannelOptions): Promise<HandlerSendDataChannelResult>;
|
|
1112
|
+
abstract receive(optionsList: HandlerReceiveOptions[]): Promise<HandlerReceiveResult[]>;
|
|
1113
|
+
abstract stopReceiving(localIds: string[]): Promise<void>;
|
|
1114
|
+
abstract pauseReceiving(localIds: string[]): Promise<void>;
|
|
1115
|
+
abstract resumeReceiving(localIds: string[]): Promise<void>;
|
|
1116
|
+
abstract getReceiverStats(localId: string): Promise<RTCStatsReport>;
|
|
1117
|
+
abstract receiveDataChannel(options: HandlerReceiveDataChannelOptions): Promise<HandlerReceiveDataChannelResult>;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
type TransportOptions<TransportAppData extends AppData = AppData> = {
|
|
1121
|
+
id: string;
|
|
1122
|
+
iceParameters: IceParameters;
|
|
1123
|
+
iceCandidates: IceCandidate[];
|
|
1124
|
+
dtlsParameters: DtlsParameters;
|
|
1125
|
+
sctpParameters?: SctpParameters;
|
|
1126
|
+
iceServers?: RTCIceServer[];
|
|
1127
|
+
iceTransportPolicy?: RTCIceTransportPolicy;
|
|
1128
|
+
additionalSettings?: any;
|
|
1129
|
+
proprietaryConstraints?: any;
|
|
1130
|
+
appData?: TransportAppData;
|
|
1131
|
+
};
|
|
1132
|
+
type CanProduceByKind = {
|
|
1133
|
+
audio: boolean;
|
|
1134
|
+
video: boolean;
|
|
1135
|
+
[key: string]: boolean;
|
|
1136
|
+
};
|
|
1137
|
+
type IceParameters = {
|
|
1138
|
+
/**
|
|
1139
|
+
* ICE username fragment.
|
|
1140
|
+
* */
|
|
1141
|
+
usernameFragment: string;
|
|
1142
|
+
/**
|
|
1143
|
+
* ICE password.
|
|
1144
|
+
*/
|
|
1145
|
+
password: string;
|
|
1146
|
+
/**
|
|
1147
|
+
* ICE Lite.
|
|
1148
|
+
*/
|
|
1149
|
+
iceLite?: boolean;
|
|
1150
|
+
};
|
|
1151
|
+
type IceCandidate = {
|
|
1152
|
+
/**
|
|
1153
|
+
* Unique identifier that allows ICE to correlate candidates that appear on
|
|
1154
|
+
* multiple transports.
|
|
1155
|
+
*/
|
|
1156
|
+
foundation: string;
|
|
1157
|
+
/**
|
|
1158
|
+
* The assigned priority of the candidate.
|
|
1159
|
+
*/
|
|
1160
|
+
priority: number;
|
|
1161
|
+
/**
|
|
1162
|
+
* The IP address of the candidate.
|
|
1163
|
+
*/
|
|
1164
|
+
ip: string;
|
|
1165
|
+
/**
|
|
1166
|
+
* The protocol of the candidate.
|
|
1167
|
+
*/
|
|
1168
|
+
protocol: 'udp' | 'tcp';
|
|
1169
|
+
/**
|
|
1170
|
+
* The port for the candidate.
|
|
1171
|
+
*/
|
|
1172
|
+
port: number;
|
|
1173
|
+
/**
|
|
1174
|
+
* The type of candidate.
|
|
1175
|
+
*/
|
|
1176
|
+
type: 'host' | 'srflx' | 'prflx' | 'relay';
|
|
1177
|
+
/**
|
|
1178
|
+
* The type of TCP candidate.
|
|
1179
|
+
*/
|
|
1180
|
+
tcpType?: 'active' | 'passive' | 'so';
|
|
1181
|
+
};
|
|
1182
|
+
type DtlsParameters = {
|
|
1183
|
+
/**
|
|
1184
|
+
* Server DTLS role. Default 'auto'.
|
|
1185
|
+
*/
|
|
1186
|
+
role?: DtlsRole;
|
|
1187
|
+
/**
|
|
1188
|
+
* Server DTLS fingerprints.
|
|
1189
|
+
*/
|
|
1190
|
+
fingerprints: DtlsFingerprint[];
|
|
1191
|
+
};
|
|
20
1192
|
/**
|
|
21
|
-
*
|
|
1193
|
+
* The hash function algorithm (as defined in the "Hash function Textual Names"
|
|
1194
|
+
* registry initially specified in RFC 4572 Section 8) and its corresponding
|
|
1195
|
+
* certificate fingerprint value (in lowercase hex string as expressed utilizing
|
|
1196
|
+
* the syntax of "fingerprint" in RFC 4572 Section 5).
|
|
1197
|
+
*/
|
|
1198
|
+
type DtlsFingerprint = {
|
|
1199
|
+
algorithm: string;
|
|
1200
|
+
value: string;
|
|
1201
|
+
};
|
|
1202
|
+
type DtlsRole = 'auto' | 'client' | 'server';
|
|
1203
|
+
type ConnectionState = 'new' | 'connecting' | 'connected' | 'failed' | 'disconnected' | 'closed';
|
|
1204
|
+
type PlainRtpParameters = {
|
|
1205
|
+
ip: string;
|
|
1206
|
+
ipVersion: 4 | 6;
|
|
1207
|
+
port: number;
|
|
1208
|
+
};
|
|
1209
|
+
type TransportEvents = {
|
|
1210
|
+
connect: [{
|
|
1211
|
+
dtlsParameters: DtlsParameters;
|
|
1212
|
+
}, () => void, (error: Error) => void];
|
|
1213
|
+
connectionstatechange: [ConnectionState];
|
|
1214
|
+
produce: [
|
|
1215
|
+
{
|
|
1216
|
+
kind: MediaKind;
|
|
1217
|
+
rtpParameters: RtpParameters;
|
|
1218
|
+
appData: AppData;
|
|
1219
|
+
},
|
|
1220
|
+
({ id }: {
|
|
1221
|
+
id: string;
|
|
1222
|
+
}) => void,
|
|
1223
|
+
(error: Error) => void
|
|
1224
|
+
];
|
|
1225
|
+
producedata: [
|
|
1226
|
+
{
|
|
1227
|
+
sctpStreamParameters: SctpStreamParameters;
|
|
1228
|
+
label?: string;
|
|
1229
|
+
protocol?: string;
|
|
1230
|
+
appData: AppData;
|
|
1231
|
+
},
|
|
1232
|
+
({ id }: {
|
|
1233
|
+
id: string;
|
|
1234
|
+
}) => void,
|
|
1235
|
+
(error: Error) => void
|
|
1236
|
+
];
|
|
1237
|
+
};
|
|
1238
|
+
type TransportObserverEvents = {
|
|
1239
|
+
close: [];
|
|
1240
|
+
newproducer: [Producer];
|
|
1241
|
+
newconsumer: [Consumer];
|
|
1242
|
+
newdataproducer: [DataProducer];
|
|
1243
|
+
newdataconsumer: [DataConsumer];
|
|
1244
|
+
};
|
|
1245
|
+
declare class Transport<TransportAppData extends AppData = AppData> extends EnhancedEventEmitter<TransportEvents> {
|
|
1246
|
+
private readonly _id;
|
|
1247
|
+
private _closed;
|
|
1248
|
+
private readonly _direction;
|
|
1249
|
+
private readonly _extendedRtpCapabilities;
|
|
1250
|
+
private readonly _canProduceByKind;
|
|
1251
|
+
private readonly _maxSctpMessageSize?;
|
|
1252
|
+
private readonly _handler;
|
|
1253
|
+
private _connectionState;
|
|
1254
|
+
private _appData;
|
|
1255
|
+
private readonly _producers;
|
|
1256
|
+
private readonly _consumers;
|
|
1257
|
+
private readonly _dataProducers;
|
|
1258
|
+
private readonly _dataConsumers;
|
|
1259
|
+
private _probatorConsumerCreated;
|
|
1260
|
+
private readonly _awaitQueue;
|
|
1261
|
+
private _pendingConsumerTasks;
|
|
1262
|
+
private _consumerCreationInProgress;
|
|
1263
|
+
private _pendingPauseConsumers;
|
|
1264
|
+
private _consumerPauseInProgress;
|
|
1265
|
+
private _pendingResumeConsumers;
|
|
1266
|
+
private _consumerResumeInProgress;
|
|
1267
|
+
private _pendingCloseConsumers;
|
|
1268
|
+
private _consumerCloseInProgress;
|
|
1269
|
+
protected readonly _observer: EnhancedEventEmitter<TransportObserverEvents>;
|
|
1270
|
+
constructor({ direction, id, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, appData, handlerFactory, extendedRtpCapabilities, canProduceByKind }: {
|
|
1271
|
+
direction: 'send' | 'recv';
|
|
1272
|
+
handlerFactory: HandlerFactory;
|
|
1273
|
+
extendedRtpCapabilities: any;
|
|
1274
|
+
canProduceByKind: CanProduceByKind;
|
|
1275
|
+
} & TransportOptions<TransportAppData>);
|
|
1276
|
+
/**
|
|
1277
|
+
* Transport id.
|
|
1278
|
+
*/
|
|
1279
|
+
get id(): string;
|
|
1280
|
+
/**
|
|
1281
|
+
* Whether the Transport is closed.
|
|
1282
|
+
*/
|
|
1283
|
+
get closed(): boolean;
|
|
1284
|
+
/**
|
|
1285
|
+
* Transport direction.
|
|
1286
|
+
*/
|
|
1287
|
+
get direction(): 'send' | 'recv';
|
|
1288
|
+
/**
|
|
1289
|
+
* RTC handler instance.
|
|
1290
|
+
*/
|
|
1291
|
+
get handler(): HandlerInterface;
|
|
1292
|
+
/**
|
|
1293
|
+
* Connection state.
|
|
1294
|
+
*/
|
|
1295
|
+
get connectionState(): ConnectionState;
|
|
1296
|
+
/**
|
|
1297
|
+
* App custom data.
|
|
1298
|
+
*/
|
|
1299
|
+
get appData(): TransportAppData;
|
|
1300
|
+
/**
|
|
1301
|
+
* App custom data setter.
|
|
1302
|
+
*/
|
|
1303
|
+
set appData(appData: TransportAppData);
|
|
1304
|
+
get observer(): EnhancedEventEmitter;
|
|
1305
|
+
/**
|
|
1306
|
+
* Close the Transport.
|
|
1307
|
+
*/
|
|
1308
|
+
close(): void;
|
|
1309
|
+
/**
|
|
1310
|
+
* Get associated Transport (RTCPeerConnection) stats.
|
|
1311
|
+
*
|
|
1312
|
+
* @returns {RTCStatsReport}
|
|
1313
|
+
*/
|
|
1314
|
+
getStats(): Promise<RTCStatsReport>;
|
|
1315
|
+
/**
|
|
1316
|
+
* Restart ICE connection.
|
|
1317
|
+
*/
|
|
1318
|
+
restartIce({ iceParameters }: {
|
|
1319
|
+
iceParameters: IceParameters;
|
|
1320
|
+
}): Promise<void>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Update ICE servers.
|
|
1323
|
+
*/
|
|
1324
|
+
updateIceServers({ iceServers }?: {
|
|
1325
|
+
iceServers?: RTCIceServer[];
|
|
1326
|
+
}): Promise<void>;
|
|
1327
|
+
/**
|
|
1328
|
+
* Create a Producer.
|
|
1329
|
+
*/
|
|
1330
|
+
produce<ProducerAppData extends AppData = AppData>({ track, encodings, codecOptions, codec, stopTracks, disableTrackOnPause, zeroRtpOnPause, appData }?: ProducerOptions<ProducerAppData>): Promise<Producer<ProducerAppData>>;
|
|
1331
|
+
/**
|
|
1332
|
+
* Create a Consumer to consume a remote Producer.
|
|
1333
|
+
*/
|
|
1334
|
+
consume<ConsumerAppData extends AppData = AppData>({ id, producerId, kind, rtpParameters, streamId, appData }: ConsumerOptions<ConsumerAppData>): Promise<Consumer<ConsumerAppData>>;
|
|
1335
|
+
/**
|
|
1336
|
+
* Create a DataProducer
|
|
1337
|
+
*/
|
|
1338
|
+
produceData<DataProducerAppData extends AppData = AppData>({ ordered, maxPacketLifeTime, maxRetransmits, label, protocol, appData }?: DataProducerOptions<DataProducerAppData>): Promise<DataProducer<DataProducerAppData>>;
|
|
1339
|
+
/**
|
|
1340
|
+
* Create a DataConsumer
|
|
1341
|
+
*/
|
|
1342
|
+
consumeData<ConsumerAppData extends AppData = AppData>({ id, dataProducerId, sctpStreamParameters, label, protocol, appData }: DataConsumerOptions<ConsumerAppData>): Promise<DataConsumer<ConsumerAppData>>;
|
|
1343
|
+
private createPendingConsumers;
|
|
1344
|
+
private pausePendingConsumers;
|
|
1345
|
+
private resumePendingConsumers;
|
|
1346
|
+
private closePendingConsumers;
|
|
1347
|
+
private handleHandler;
|
|
1348
|
+
private handleProducer;
|
|
1349
|
+
private handleConsumer;
|
|
1350
|
+
private handleDataProducer;
|
|
1351
|
+
private handleDataConsumer;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
type BuiltinHandlerName = 'Chrome111' | 'Chrome74' | 'Chrome70' | 'Chrome67' | 'Chrome55' | 'Firefox60' | 'Safari12' | 'Safari11' | 'Edge11' | 'ReactNativeUnifiedPlan' | 'ReactNative';
|
|
1355
|
+
type DeviceOptions = {
|
|
1356
|
+
/**
|
|
1357
|
+
* The name of one of the builtin handlers.
|
|
1358
|
+
*/
|
|
1359
|
+
handlerName?: BuiltinHandlerName;
|
|
1360
|
+
/**
|
|
1361
|
+
* Custom handler factory.
|
|
1362
|
+
*/
|
|
1363
|
+
handlerFactory?: HandlerFactory;
|
|
1364
|
+
/**
|
|
1365
|
+
* DEPRECATED!
|
|
1366
|
+
* The name of one of the builtin handlers.
|
|
1367
|
+
*/
|
|
1368
|
+
Handler?: string;
|
|
1369
|
+
};
|
|
1370
|
+
declare function detectDevice(): BuiltinHandlerName | undefined;
|
|
1371
|
+
type DeviceObserverEvents = {
|
|
1372
|
+
newtransport: [Transport];
|
|
1373
|
+
};
|
|
1374
|
+
declare class Device {
|
|
1375
|
+
private readonly _handlerFactory;
|
|
1376
|
+
private readonly _handlerName;
|
|
1377
|
+
private _loaded;
|
|
1378
|
+
private _extendedRtpCapabilities?;
|
|
1379
|
+
private _recvRtpCapabilities?;
|
|
1380
|
+
private readonly _canProduceByKind;
|
|
1381
|
+
private _sctpCapabilities?;
|
|
1382
|
+
protected readonly _observer: EnhancedEventEmitter<DeviceObserverEvents>;
|
|
1383
|
+
/**
|
|
1384
|
+
* Create a new Device to connect to mediasoup server.
|
|
1385
|
+
*
|
|
1386
|
+
* @throws {UnsupportedError} if device is not supported.
|
|
1387
|
+
*/
|
|
1388
|
+
constructor({ handlerName, handlerFactory, Handler }?: DeviceOptions);
|
|
1389
|
+
/**
|
|
1390
|
+
* The RTC handler name.
|
|
1391
|
+
*/
|
|
1392
|
+
get handlerName(): string;
|
|
1393
|
+
/**
|
|
1394
|
+
* Whether the Device is loaded.
|
|
1395
|
+
*/
|
|
1396
|
+
get loaded(): boolean;
|
|
1397
|
+
/**
|
|
1398
|
+
* RTP capabilities of the Device for receiving media.
|
|
1399
|
+
*
|
|
1400
|
+
* @throws {InvalidStateError} if not loaded.
|
|
1401
|
+
*/
|
|
1402
|
+
get rtpCapabilities(): RtpCapabilities;
|
|
1403
|
+
/**
|
|
1404
|
+
* SCTP capabilities of the Device.
|
|
1405
|
+
*
|
|
1406
|
+
* @throws {InvalidStateError} if not loaded.
|
|
1407
|
+
*/
|
|
1408
|
+
get sctpCapabilities(): SctpCapabilities;
|
|
1409
|
+
get observer(): EnhancedEventEmitter;
|
|
1410
|
+
/**
|
|
1411
|
+
* Initialize the Device.
|
|
1412
|
+
*/
|
|
1413
|
+
load({ routerRtpCapabilities }: {
|
|
1414
|
+
routerRtpCapabilities: RtpCapabilities;
|
|
1415
|
+
}): Promise<void>;
|
|
1416
|
+
/**
|
|
1417
|
+
* Whether we can produce audio/video.
|
|
1418
|
+
*
|
|
1419
|
+
* @throws {InvalidStateError} if not loaded.
|
|
1420
|
+
* @throws {TypeError} if wrong arguments.
|
|
1421
|
+
*/
|
|
1422
|
+
canProduce(kind: MediaKind): boolean;
|
|
1423
|
+
/**
|
|
1424
|
+
* Creates a Transport for sending media.
|
|
1425
|
+
*
|
|
1426
|
+
* @throws {InvalidStateError} if not loaded.
|
|
1427
|
+
* @throws {TypeError} if wrong arguments.
|
|
1428
|
+
*/
|
|
1429
|
+
createSendTransport<TransportAppData extends AppData = AppData>({ id, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, appData }: TransportOptions<TransportAppData>): Transport<TransportAppData>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Creates a Transport for receiving media.
|
|
1432
|
+
*
|
|
1433
|
+
* @throws {InvalidStateError} if not loaded.
|
|
1434
|
+
* @throws {TypeError} if wrong arguments.
|
|
1435
|
+
*/
|
|
1436
|
+
createRecvTransport<TransportAppData extends AppData = AppData>({ id, iceParameters, iceCandidates, dtlsParameters, sctpParameters, iceServers, iceTransportPolicy, additionalSettings, proprietaryConstraints, appData }: TransportOptions<TransportAppData>): Transport<TransportAppData>;
|
|
1437
|
+
private createTransport;
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* Expose mediasoup-client version.
|
|
22
1442
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
1443
|
+
declare const version = "3.6.90";
|
|
1444
|
+
|
|
1445
|
+
export { Device, detectDevice, parse as parseScalabilityMode, types, version };
|