aliyun-rtc-sdk 7.1.0-beta.1 → 7.1.0
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/aliyun-rtc-sdk.es.js +3139 -2601
- package/dist/aliyun-rtc-sdk.umd.js +14 -14
- package/dist/plugins/audioProcessPlugin.d.ts +5504 -0
- package/dist/plugins/audioProcessPlugin.js +160 -0
- package/dist/plugins/beautyPlugin.d.ts +915 -5
- package/dist/plugins/beautyPlugin.js +1 -1
- package/dist/plugins/index-BGdMdvjC.js +1 -0
- package/dist/types/index.d.ts +23 -1
- package/package.json +3 -2
|
@@ -1,8 +1,918 @@
|
|
|
1
|
-
import EventEmitter from 'eventemitter3';
|
|
2
|
-
import { LocalStream, IProfile } from 'aliyun-rts-sdk';
|
|
3
|
-
import { IVideoConstraints, IAudioConstraints } from 'media-device';
|
|
1
|
+
import EventEmitter$1 from 'eventemitter3';
|
|
4
2
|
import { QueenEngineWorker } from 'aliyun-queen-engine';
|
|
5
3
|
|
|
4
|
+
interface IProfile {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
frameRate: number;
|
|
8
|
+
maxBitrate: number;
|
|
9
|
+
}
|
|
10
|
+
interface IAudioProfile {
|
|
11
|
+
sampleRate: number;
|
|
12
|
+
channelCount: number;
|
|
13
|
+
maxBitrate: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare enum FacingMode {
|
|
17
|
+
USER = "user",
|
|
18
|
+
ENVIRONMENT = "environment"
|
|
19
|
+
}
|
|
20
|
+
interface IError {
|
|
21
|
+
code: number;
|
|
22
|
+
reason: string;
|
|
23
|
+
relatedLink: string;
|
|
24
|
+
}
|
|
25
|
+
interface IAudioConstraints extends MediaTrackConstraints {
|
|
26
|
+
}
|
|
27
|
+
interface IVideoConstraints {
|
|
28
|
+
deviceId?: string;
|
|
29
|
+
facingMode?: FacingMode;
|
|
30
|
+
aspectRatio?: ConstrainDouble;
|
|
31
|
+
width?: number;
|
|
32
|
+
height?: number;
|
|
33
|
+
frameRate?: number;
|
|
34
|
+
}
|
|
35
|
+
interface IScreenConstraints {
|
|
36
|
+
audio?: boolean | MediaTrackConstraints;
|
|
37
|
+
video?: boolean | MediaTrackConstraints;
|
|
38
|
+
preferCurrentTab?: boolean;
|
|
39
|
+
selfBrowserSurface?: string;
|
|
40
|
+
surfaceSwitching?: string;
|
|
41
|
+
systemAudio?: string;
|
|
42
|
+
}
|
|
43
|
+
interface IDeviceManager {
|
|
44
|
+
checkSupportScreenShare(): boolean;
|
|
45
|
+
getCameraList(): Promise<Array<MediaDeviceInfo>>;
|
|
46
|
+
getMicList(): Promise<Array<MediaDeviceInfo>>;
|
|
47
|
+
getSpeakerList(): Promise<Array<MediaDeviceInfo>>;
|
|
48
|
+
getAudioTrack(constraints: IAudioConstraints): Promise<MediaStreamTrack>;
|
|
49
|
+
getVideoTrack(constraints: IVideoConstraints): Promise<MediaStreamTrack>;
|
|
50
|
+
getScreenTrack(constraints: IScreenConstraints): Promise<MediaStreamTrack[]>;
|
|
51
|
+
getAudioStream(constraints: IAudioConstraints): Promise<MediaStream>;
|
|
52
|
+
getVideoStream(constraints: IVideoConstraints): Promise<MediaStream>;
|
|
53
|
+
getScreenStream(constraints: IScreenConstraints): Promise<MediaStream>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare class DeviceError implements IError {
|
|
57
|
+
code: number;
|
|
58
|
+
reason: string;
|
|
59
|
+
relatedLink: string;
|
|
60
|
+
private linkUtil;
|
|
61
|
+
constructor(errorCode: number, reason: string);
|
|
62
|
+
static isDeviceManagerError(error: unknown): error is IError;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare class BrowserDeviceManager implements IDeviceManager {
|
|
66
|
+
private systemUtil;
|
|
67
|
+
private deviceManager;
|
|
68
|
+
static isDeviceManagerError: typeof DeviceError.isDeviceManagerError;
|
|
69
|
+
constructor();
|
|
70
|
+
getCameraList(): Promise<Array<MediaDeviceInfo>>;
|
|
71
|
+
getMicList(): Promise<Array<MediaDeviceInfo>>;
|
|
72
|
+
getSpeakerList(): Promise<Array<MediaDeviceInfo>>;
|
|
73
|
+
getAudioTrack(constraints: IAudioConstraints): Promise<MediaStreamTrack>;
|
|
74
|
+
getVideoTrack(constraints: IVideoConstraints): Promise<MediaStreamTrack>;
|
|
75
|
+
getScreenTrack(constraints: IScreenConstraints): Promise<MediaStreamTrack[]>;
|
|
76
|
+
getAudioStream(constraints: IAudioConstraints): Promise<MediaStream>;
|
|
77
|
+
getVideoStream(constraints: IVideoConstraints): Promise<MediaStream>;
|
|
78
|
+
getScreenStream(constraints: IScreenConstraints): Promise<MediaStream>;
|
|
79
|
+
checkSupportScreenShare(): boolean;
|
|
80
|
+
private createDeviceManager;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare global {
|
|
84
|
+
interface Window {
|
|
85
|
+
BrowserDeviceManager: typeof BrowserDeviceManager;
|
|
86
|
+
define: any;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var parser = {};
|
|
91
|
+
|
|
92
|
+
var grammar$1 = {exports: {}};
|
|
93
|
+
|
|
94
|
+
var grammar = grammar$1.exports = {
|
|
95
|
+
v: [{
|
|
96
|
+
name: 'version',
|
|
97
|
+
reg: /^(\d*)$/
|
|
98
|
+
}],
|
|
99
|
+
o: [{
|
|
100
|
+
// o=- 20518 0 IN IP4 203.0.113.1
|
|
101
|
+
// NB: sessionId will be a String in most cases because it is huge
|
|
102
|
+
name: 'origin',
|
|
103
|
+
reg: /^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,
|
|
104
|
+
names: ['username', 'sessionId', 'sessionVersion', 'netType', 'ipVer', 'address'],
|
|
105
|
+
format: '%s %s %d %s IP%d %s'
|
|
106
|
+
}],
|
|
107
|
+
// default parsing of these only (though some of these feel outdated)
|
|
108
|
+
s: [{ name: 'name' }],
|
|
109
|
+
i: [{ name: 'description' }],
|
|
110
|
+
u: [{ name: 'uri' }],
|
|
111
|
+
e: [{ name: 'email' }],
|
|
112
|
+
p: [{ name: 'phone' }],
|
|
113
|
+
z: [{ name: 'timezones' }], // TODO: this one can actually be parsed properly...
|
|
114
|
+
r: [{ name: 'repeats' }], // TODO: this one can also be parsed properly
|
|
115
|
+
// k: [{}], // outdated thing ignored
|
|
116
|
+
t: [{
|
|
117
|
+
// t=0 0
|
|
118
|
+
name: 'timing',
|
|
119
|
+
reg: /^(\d*) (\d*)/,
|
|
120
|
+
names: ['start', 'stop'],
|
|
121
|
+
format: '%d %d'
|
|
122
|
+
}],
|
|
123
|
+
c: [{
|
|
124
|
+
// c=IN IP4 10.47.197.26
|
|
125
|
+
name: 'connection',
|
|
126
|
+
reg: /^IN IP(\d) (\S*)/,
|
|
127
|
+
names: ['version', 'ip'],
|
|
128
|
+
format: 'IN IP%d %s'
|
|
129
|
+
}],
|
|
130
|
+
b: [{
|
|
131
|
+
// b=AS:4000
|
|
132
|
+
push: 'bandwidth',
|
|
133
|
+
reg: /^(TIAS|AS|CT|RR|RS):(\d*)/,
|
|
134
|
+
names: ['type', 'limit'],
|
|
135
|
+
format: '%s:%s'
|
|
136
|
+
}],
|
|
137
|
+
m: [{
|
|
138
|
+
// m=video 51744 RTP/AVP 126 97 98 34 31
|
|
139
|
+
// NB: special - pushes to session
|
|
140
|
+
// TODO: rtp/fmtp should be filtered by the payloads found here?
|
|
141
|
+
reg: /^(\w*) (\d*) ([\w/]*)(?: (.*))?/,
|
|
142
|
+
names: ['type', 'port', 'protocol', 'payloads'],
|
|
143
|
+
format: '%s %d %s %s'
|
|
144
|
+
}],
|
|
145
|
+
a: [
|
|
146
|
+
{
|
|
147
|
+
// a=rtpmap:110 opus/48000/2
|
|
148
|
+
push: 'rtp',
|
|
149
|
+
reg: /^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,
|
|
150
|
+
names: ['payload', 'codec', 'rate', 'encoding'],
|
|
151
|
+
format: function (o) {
|
|
152
|
+
return (o.encoding)
|
|
153
|
+
? 'rtpmap:%d %s/%s/%s'
|
|
154
|
+
: o.rate
|
|
155
|
+
? 'rtpmap:%d %s/%s'
|
|
156
|
+
: 'rtpmap:%d %s';
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
// a=fmtp:108 profile-level-id=24;object=23;bitrate=64000
|
|
161
|
+
// a=fmtp:111 minptime=10; useinbandfec=1
|
|
162
|
+
push: 'fmtp',
|
|
163
|
+
reg: /^fmtp:(\d*) ([\S| ]*)/,
|
|
164
|
+
names: ['payload', 'config'],
|
|
165
|
+
format: 'fmtp:%d %s'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
// a=control:streamid=0
|
|
169
|
+
name: 'control',
|
|
170
|
+
reg: /^control:(.*)/,
|
|
171
|
+
format: 'control:%s'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
// a=rtcp:65179 IN IP4 193.84.77.194
|
|
175
|
+
name: 'rtcp',
|
|
176
|
+
reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,
|
|
177
|
+
names: ['port', 'netType', 'ipVer', 'address'],
|
|
178
|
+
format: function (o) {
|
|
179
|
+
return (o.address != null)
|
|
180
|
+
? 'rtcp:%d %s IP%d %s'
|
|
181
|
+
: 'rtcp:%d';
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
// a=rtcp-fb:98 trr-int 100
|
|
186
|
+
push: 'rtcpFbTrrInt',
|
|
187
|
+
reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/,
|
|
188
|
+
names: ['payload', 'value'],
|
|
189
|
+
format: 'rtcp-fb:%s trr-int %d'
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
// a=rtcp-fb:98 nack rpsi
|
|
193
|
+
push: 'rtcpFb',
|
|
194
|
+
reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,
|
|
195
|
+
names: ['payload', 'type', 'subtype'],
|
|
196
|
+
format: function (o) {
|
|
197
|
+
return (o.subtype != null)
|
|
198
|
+
? 'rtcp-fb:%s %s %s'
|
|
199
|
+
: 'rtcp-fb:%s %s';
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
|
|
204
|
+
// a=extmap:1/recvonly URI-gps-string
|
|
205
|
+
// a=extmap:3 urn:ietf:params:rtp-hdrext:encrypt urn:ietf:params:rtp-hdrext:smpte-tc 25@600/24
|
|
206
|
+
push: 'ext',
|
|
207
|
+
reg: /^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,
|
|
208
|
+
names: ['value', 'direction', 'encrypt-uri', 'uri', 'config'],
|
|
209
|
+
format: function (o) {
|
|
210
|
+
return (
|
|
211
|
+
'extmap:%d' +
|
|
212
|
+
(o.direction ? '/%s' : '%v') +
|
|
213
|
+
(o['encrypt-uri'] ? ' %s' : '%v') +
|
|
214
|
+
' %s' +
|
|
215
|
+
(o.config ? ' %s' : '')
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
// a=extmap-allow-mixed
|
|
221
|
+
name: 'extmapAllowMixed',
|
|
222
|
+
reg: /^(extmap-allow-mixed)/
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
// a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR|2^20|1:32
|
|
226
|
+
push: 'crypto',
|
|
227
|
+
reg: /^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,
|
|
228
|
+
names: ['id', 'suite', 'config', 'sessionConfig'],
|
|
229
|
+
format: function (o) {
|
|
230
|
+
return (o.sessionConfig != null)
|
|
231
|
+
? 'crypto:%d %s %s %s'
|
|
232
|
+
: 'crypto:%d %s %s';
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
// a=setup:actpass
|
|
237
|
+
name: 'setup',
|
|
238
|
+
reg: /^setup:(\w*)/,
|
|
239
|
+
format: 'setup:%s'
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
// a=connection:new
|
|
243
|
+
name: 'connectionType',
|
|
244
|
+
reg: /^connection:(new|existing)/,
|
|
245
|
+
format: 'connection:%s'
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
// a=mid:1
|
|
249
|
+
name: 'mid',
|
|
250
|
+
reg: /^mid:([^\s]*)/,
|
|
251
|
+
format: 'mid:%s'
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
// a=msid:0c8b064d-d807-43b4-b434-f92a889d8587 98178685-d409-46e0-8e16-7ef0db0db64a
|
|
255
|
+
name: 'msid',
|
|
256
|
+
reg: /^msid:(.*)/,
|
|
257
|
+
format: 'msid:%s'
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
// a=ptime:20
|
|
261
|
+
name: 'ptime',
|
|
262
|
+
reg: /^ptime:(\d*(?:\.\d*)*)/,
|
|
263
|
+
format: 'ptime:%d'
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
// a=maxptime:60
|
|
267
|
+
name: 'maxptime',
|
|
268
|
+
reg: /^maxptime:(\d*(?:\.\d*)*)/,
|
|
269
|
+
format: 'maxptime:%d'
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
// a=sendrecv
|
|
273
|
+
name: 'direction',
|
|
274
|
+
reg: /^(sendrecv|recvonly|sendonly|inactive)/
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
// a=ice-lite
|
|
278
|
+
name: 'icelite',
|
|
279
|
+
reg: /^(ice-lite)/
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
// a=ice-ufrag:F7gI
|
|
283
|
+
name: 'iceUfrag',
|
|
284
|
+
reg: /^ice-ufrag:(\S*)/,
|
|
285
|
+
format: 'ice-ufrag:%s'
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
// a=ice-pwd:x9cml/YzichV2+XlhiMu8g
|
|
289
|
+
name: 'icePwd',
|
|
290
|
+
reg: /^ice-pwd:(\S*)/,
|
|
291
|
+
format: 'ice-pwd:%s'
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
// a=fingerprint:SHA-1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
|
|
295
|
+
name: 'fingerprint',
|
|
296
|
+
reg: /^fingerprint:(\S*) (\S*)/,
|
|
297
|
+
names: ['type', 'hash'],
|
|
298
|
+
format: 'fingerprint:%s %s'
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
// a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host
|
|
302
|
+
// a=candidate:1162875081 1 udp 2113937151 192.168.34.75 60017 typ host generation 0 network-id 3 network-cost 10
|
|
303
|
+
// a=candidate:3289912957 2 udp 1845501695 193.84.77.194 60017 typ srflx raddr 192.168.34.75 rport 60017 generation 0 network-id 3 network-cost 10
|
|
304
|
+
// a=candidate:229815620 1 tcp 1518280447 192.168.150.19 60017 typ host tcptype active generation 0 network-id 3 network-cost 10
|
|
305
|
+
// a=candidate:3289912957 2 tcp 1845501695 193.84.77.194 60017 typ srflx raddr 192.168.34.75 rport 60017 tcptype passive generation 0 network-id 3 network-cost 10
|
|
306
|
+
push:'candidates',
|
|
307
|
+
reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,
|
|
308
|
+
names: ['foundation', 'component', 'transport', 'priority', 'ip', 'port', 'type', 'raddr', 'rport', 'tcptype', 'generation', 'network-id', 'network-cost'],
|
|
309
|
+
format: function (o) {
|
|
310
|
+
var str = 'candidate:%s %d %s %d %s %d typ %s';
|
|
311
|
+
|
|
312
|
+
str += (o.raddr != null) ? ' raddr %s rport %d' : '%v%v';
|
|
313
|
+
|
|
314
|
+
// NB: candidate has three optional chunks, so %void middles one if it's missing
|
|
315
|
+
str += (o.tcptype != null) ? ' tcptype %s' : '%v';
|
|
316
|
+
|
|
317
|
+
if (o.generation != null) {
|
|
318
|
+
str += ' generation %d';
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
str += (o['network-id'] != null) ? ' network-id %d' : '%v';
|
|
322
|
+
str += (o['network-cost'] != null) ? ' network-cost %d' : '%v';
|
|
323
|
+
return str;
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
// a=end-of-candidates (keep after the candidates line for readability)
|
|
328
|
+
name: 'endOfCandidates',
|
|
329
|
+
reg: /^(end-of-candidates)/
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
// a=remote-candidates:1 203.0.113.1 54400 2 203.0.113.1 54401 ...
|
|
333
|
+
name: 'remoteCandidates',
|
|
334
|
+
reg: /^remote-candidates:(.*)/,
|
|
335
|
+
format: 'remote-candidates:%s'
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
// a=ice-options:google-ice
|
|
339
|
+
name: 'iceOptions',
|
|
340
|
+
reg: /^ice-options:(\S*)/,
|
|
341
|
+
format: 'ice-options:%s'
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
// a=ssrc:2566107569 cname:t9YU8M1UxTF8Y1A1
|
|
345
|
+
push: 'ssrcs',
|
|
346
|
+
reg: /^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,
|
|
347
|
+
names: ['id', 'attribute', 'value'],
|
|
348
|
+
format: function (o) {
|
|
349
|
+
var str = 'ssrc:%d';
|
|
350
|
+
if (o.attribute != null) {
|
|
351
|
+
str += ' %s';
|
|
352
|
+
if (o.value != null) {
|
|
353
|
+
str += ':%s';
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return str;
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
// a=ssrc-group:FEC 1 2
|
|
361
|
+
// a=ssrc-group:FEC-FR 3004364195 1080772241
|
|
362
|
+
push: 'ssrcGroups',
|
|
363
|
+
// token-char = %x21 / %x23-27 / %x2A-2B / %x2D-2E / %x30-39 / %x41-5A / %x5E-7E
|
|
364
|
+
reg: /^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,
|
|
365
|
+
names: ['semantics', 'ssrcs'],
|
|
366
|
+
format: 'ssrc-group:%s %s'
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
// a=msid-semantic: WMS Jvlam5X3SX1OP6pn20zWogvaKJz5Hjf9OnlV
|
|
370
|
+
name: 'msidSemantic',
|
|
371
|
+
reg: /^msid-semantic:\s?(\w*) (\S*)/,
|
|
372
|
+
names: ['semantic', 'token'],
|
|
373
|
+
format: 'msid-semantic: %s %s' // space after ':' is not accidental
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
// a=group:BUNDLE audio video
|
|
377
|
+
push: 'groups',
|
|
378
|
+
reg: /^group:(\w*) (.*)/,
|
|
379
|
+
names: ['type', 'mids'],
|
|
380
|
+
format: 'group:%s %s'
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
// a=rtcp-mux
|
|
384
|
+
name: 'rtcpMux',
|
|
385
|
+
reg: /^(rtcp-mux)/
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
// a=rtcp-rsize
|
|
389
|
+
name: 'rtcpRsize',
|
|
390
|
+
reg: /^(rtcp-rsize)/
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
// a=sctpmap:5000 webrtc-datachannel 1024
|
|
394
|
+
name: 'sctpmap',
|
|
395
|
+
reg: /^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,
|
|
396
|
+
names: ['sctpmapNumber', 'app', 'maxMessageSize'],
|
|
397
|
+
format: function (o) {
|
|
398
|
+
return (o.maxMessageSize != null)
|
|
399
|
+
? 'sctpmap:%s %s %s'
|
|
400
|
+
: 'sctpmap:%s %s';
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
// a=x-google-flag:conference
|
|
405
|
+
name: 'xGoogleFlag',
|
|
406
|
+
reg: /^x-google-flag:([^\s]*)/,
|
|
407
|
+
format: 'x-google-flag:%s'
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
// a=rid:1 send max-width=1280;max-height=720;max-fps=30;depend=0
|
|
411
|
+
push: 'rids',
|
|
412
|
+
reg: /^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,
|
|
413
|
+
names: ['id', 'direction', 'params'],
|
|
414
|
+
format: function (o) {
|
|
415
|
+
return (o.params) ? 'rid:%s %s %s' : 'rid:%s %s';
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
// a=imageattr:97 send [x=800,y=640,sar=1.1,q=0.6] [x=480,y=320] recv [x=330,y=250]
|
|
420
|
+
// a=imageattr:* send [x=800,y=640] recv *
|
|
421
|
+
// a=imageattr:100 recv [x=320,y=240]
|
|
422
|
+
push: 'imageattrs',
|
|
423
|
+
reg: new RegExp(
|
|
424
|
+
// a=imageattr:97
|
|
425
|
+
'^imageattr:(\\d+|\\*)' +
|
|
426
|
+
// send [x=800,y=640,sar=1.1,q=0.6] [x=480,y=320]
|
|
427
|
+
'[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)' +
|
|
428
|
+
// recv [x=330,y=250]
|
|
429
|
+
'(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?'
|
|
430
|
+
),
|
|
431
|
+
names: ['pt', 'dir1', 'attrs1', 'dir2', 'attrs2'],
|
|
432
|
+
format: function (o) {
|
|
433
|
+
return 'imageattr:%s %s %s' + (o.dir2 ? ' %s %s' : '');
|
|
434
|
+
}
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
// a=simulcast:send 1,2,3;~4,~5 recv 6;~7,~8
|
|
438
|
+
// a=simulcast:recv 1;4,5 send 6;7
|
|
439
|
+
name: 'simulcast',
|
|
440
|
+
reg: new RegExp(
|
|
441
|
+
// a=simulcast:
|
|
442
|
+
'^simulcast:' +
|
|
443
|
+
// send 1,2,3;~4,~5
|
|
444
|
+
'(send|recv) ([a-zA-Z0-9\\-_~;,]+)' +
|
|
445
|
+
// space + recv 6;~7,~8
|
|
446
|
+
'(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?' +
|
|
447
|
+
// end
|
|
448
|
+
'$'
|
|
449
|
+
),
|
|
450
|
+
names: ['dir1', 'list1', 'dir2', 'list2'],
|
|
451
|
+
format: function (o) {
|
|
452
|
+
return 'simulcast:%s %s' + (o.dir2 ? ' %s %s' : '');
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
// old simulcast draft 03 (implemented by Firefox)
|
|
457
|
+
// https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-03
|
|
458
|
+
// a=simulcast: recv pt=97;98 send pt=97
|
|
459
|
+
// a=simulcast: send rid=5;6;7 paused=6,7
|
|
460
|
+
name: 'simulcast_03',
|
|
461
|
+
reg: /^simulcast:[\s\t]+([\S+\s\t]+)$/,
|
|
462
|
+
names: ['value'],
|
|
463
|
+
format: 'simulcast: %s'
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
// a=framerate:25
|
|
467
|
+
// a=framerate:29.97
|
|
468
|
+
name: 'framerate',
|
|
469
|
+
reg: /^framerate:(\d+(?:$|\.\d+))/,
|
|
470
|
+
format: 'framerate:%s'
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
// RFC4570
|
|
474
|
+
// a=source-filter: incl IN IP4 239.5.2.31 10.1.15.5
|
|
475
|
+
name: 'sourceFilter',
|
|
476
|
+
reg: /^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,
|
|
477
|
+
names: ['filterMode', 'netType', 'addressTypes', 'destAddress', 'srcList'],
|
|
478
|
+
format: 'source-filter: %s %s %s %s %s'
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
// a=bundle-only
|
|
482
|
+
name: 'bundleOnly',
|
|
483
|
+
reg: /^(bundle-only)/
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
// a=label:1
|
|
487
|
+
name: 'label',
|
|
488
|
+
reg: /^label:(.+)/,
|
|
489
|
+
format: 'label:%s'
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
// RFC version 26 for SCTP over DTLS
|
|
493
|
+
// https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-26#section-5
|
|
494
|
+
name: 'sctpPort',
|
|
495
|
+
reg: /^sctp-port:(\d+)$/,
|
|
496
|
+
format: 'sctp-port:%s'
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
// RFC version 26 for SCTP over DTLS
|
|
500
|
+
// https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-26#section-6
|
|
501
|
+
name: 'maxMessageSize',
|
|
502
|
+
reg: /^max-message-size:(\d+)$/,
|
|
503
|
+
format: 'max-message-size:%s'
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
// RFC7273
|
|
507
|
+
// a=ts-refclk:ptp=IEEE1588-2008:39-A7-94-FF-FE-07-CB-D0:37
|
|
508
|
+
push:'tsRefClocks',
|
|
509
|
+
reg: /^ts-refclk:([^\s=]*)(?:=(\S*))?/,
|
|
510
|
+
names: ['clksrc', 'clksrcExt'],
|
|
511
|
+
format: function (o) {
|
|
512
|
+
return 'ts-refclk:%s' + (o.clksrcExt != null ? '=%s' : '');
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
// RFC7273
|
|
517
|
+
// a=mediaclk:direct=963214424
|
|
518
|
+
name:'mediaClk',
|
|
519
|
+
reg: /^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,
|
|
520
|
+
names: ['id', 'mediaClockName', 'mediaClockValue', 'rateNumerator', 'rateDenominator'],
|
|
521
|
+
format: function (o) {
|
|
522
|
+
var str = 'mediaclk:';
|
|
523
|
+
str += (o.id != null ? 'id=%s %s' : '%v%s');
|
|
524
|
+
str += (o.mediaClockValue != null ? '=%s' : '');
|
|
525
|
+
str += (o.rateNumerator != null ? ' rate=%s' : '');
|
|
526
|
+
str += (o.rateDenominator != null ? '/%s' : '');
|
|
527
|
+
return str;
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
// a=keywds:keywords
|
|
532
|
+
name: 'keywords',
|
|
533
|
+
reg: /^keywds:(.+)$/,
|
|
534
|
+
format: 'keywds:%s'
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
// a=content:main
|
|
538
|
+
name: 'content',
|
|
539
|
+
reg: /^content:(.+)/,
|
|
540
|
+
format: 'content:%s'
|
|
541
|
+
},
|
|
542
|
+
// BFCP https://tools.ietf.org/html/rfc4583
|
|
543
|
+
{
|
|
544
|
+
// a=floorctrl:c-s
|
|
545
|
+
name: 'bfcpFloorCtrl',
|
|
546
|
+
reg: /^floorctrl:(c-only|s-only|c-s)/,
|
|
547
|
+
format: 'floorctrl:%s'
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
// a=confid:1
|
|
551
|
+
name: 'bfcpConfId',
|
|
552
|
+
reg: /^confid:(\d+)/,
|
|
553
|
+
format: 'confid:%s'
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
// a=userid:1
|
|
557
|
+
name: 'bfcpUserId',
|
|
558
|
+
reg: /^userid:(\d+)/,
|
|
559
|
+
format: 'userid:%s'
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
// a=floorid:1
|
|
563
|
+
name: 'bfcpFloorId',
|
|
564
|
+
reg: /^floorid:(.+) (?:m-stream|mstrm):(.+)/,
|
|
565
|
+
names: ['id', 'mStream'],
|
|
566
|
+
format: 'floorid:%s mstrm:%s'
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
// any a= that we don't understand is kept verbatim on media.invalid
|
|
570
|
+
push: 'invalid',
|
|
571
|
+
names: ['value']
|
|
572
|
+
}
|
|
573
|
+
]
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
// set sensible defaults to avoid polluting the grammar with boring details
|
|
577
|
+
Object.keys(grammar).forEach(function (key) {
|
|
578
|
+
var objs = grammar[key];
|
|
579
|
+
objs.forEach(function (obj) {
|
|
580
|
+
if (!obj.reg) {
|
|
581
|
+
obj.reg = /(.*)/;
|
|
582
|
+
}
|
|
583
|
+
if (!obj.format) {
|
|
584
|
+
obj.format = '%s';
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
var grammarExports = grammar$1.exports;
|
|
590
|
+
|
|
591
|
+
(function (exports) {
|
|
592
|
+
var toIntIfInt = function (v) {
|
|
593
|
+
return String(Number(v)) === v ? Number(v) : v;
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
var attachProperties = function (match, location, names, rawName) {
|
|
597
|
+
if (rawName && !names) {
|
|
598
|
+
location[rawName] = toIntIfInt(match[1]);
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
for (var i = 0; i < names.length; i += 1) {
|
|
602
|
+
if (match[i+1] != null) {
|
|
603
|
+
location[names[i]] = toIntIfInt(match[i+1]);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
var parseReg = function (obj, location, content) {
|
|
610
|
+
var needsBlank = obj.name && obj.names;
|
|
611
|
+
if (obj.push && !location[obj.push]) {
|
|
612
|
+
location[obj.push] = [];
|
|
613
|
+
}
|
|
614
|
+
else if (needsBlank && !location[obj.name]) {
|
|
615
|
+
location[obj.name] = {};
|
|
616
|
+
}
|
|
617
|
+
var keyLocation = obj.push ?
|
|
618
|
+
{} : // blank object that will be pushed
|
|
619
|
+
needsBlank ? location[obj.name] : location; // otherwise, named location or root
|
|
620
|
+
|
|
621
|
+
attachProperties(content.match(obj.reg), keyLocation, obj.names, obj.name);
|
|
622
|
+
|
|
623
|
+
if (obj.push) {
|
|
624
|
+
location[obj.push].push(keyLocation);
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
var grammar = grammarExports;
|
|
629
|
+
var validLine = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
|
|
630
|
+
|
|
631
|
+
exports.parse = function (sdp) {
|
|
632
|
+
var session = {}
|
|
633
|
+
, media = []
|
|
634
|
+
, location = session; // points at where properties go under (one of the above)
|
|
635
|
+
|
|
636
|
+
// parse lines we understand
|
|
637
|
+
sdp.split(/(\r\n|\r|\n)/).filter(validLine).forEach(function (l) {
|
|
638
|
+
var type = l[0];
|
|
639
|
+
var content = l.slice(2);
|
|
640
|
+
if (type === 'm') {
|
|
641
|
+
media.push({rtp: [], fmtp: []});
|
|
642
|
+
location = media[media.length-1]; // point at latest media line
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
for (var j = 0; j < (grammar[type] || []).length; j += 1) {
|
|
646
|
+
var obj = grammar[type][j];
|
|
647
|
+
if (obj.reg.test(content)) {
|
|
648
|
+
return parseReg(obj, location, content);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
session.media = media; // link it up
|
|
654
|
+
return session;
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
var paramReducer = function (acc, expr) {
|
|
658
|
+
var s = expr.split(/=(.+)/, 2);
|
|
659
|
+
if (s.length === 2) {
|
|
660
|
+
acc[s[0]] = toIntIfInt(s[1]);
|
|
661
|
+
} else if (s.length === 1 && expr.length > 1) {
|
|
662
|
+
acc[s[0]] = undefined;
|
|
663
|
+
}
|
|
664
|
+
return acc;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
exports.parseParams = function (str) {
|
|
668
|
+
return str.split(/;\s?/).reduce(paramReducer, {});
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
// For backward compatibility - alias will be removed in 3.0.0
|
|
672
|
+
exports.parseFmtpConfig = exports.parseParams;
|
|
673
|
+
|
|
674
|
+
exports.parsePayloads = function (str) {
|
|
675
|
+
return str.toString().split(' ').map(Number);
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
exports.parseRemoteCandidates = function (str) {
|
|
679
|
+
var candidates = [];
|
|
680
|
+
var parts = str.split(' ').map(toIntIfInt);
|
|
681
|
+
for (var i = 0; i < parts.length; i += 3) {
|
|
682
|
+
candidates.push({
|
|
683
|
+
component: parts[i],
|
|
684
|
+
ip: parts[i + 1],
|
|
685
|
+
port: parts[i + 2]
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
return candidates;
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
exports.parseImageAttributes = function (str) {
|
|
692
|
+
return str.split(' ').map(function (item) {
|
|
693
|
+
return item.substring(1, item.length-1).split(',').reduce(paramReducer, {});
|
|
694
|
+
});
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
exports.parseSimulcastStreamList = function (str) {
|
|
698
|
+
return str.split(';').map(function (stream) {
|
|
699
|
+
return stream.split(',').map(function (format) {
|
|
700
|
+
var scid, paused = false;
|
|
701
|
+
|
|
702
|
+
if (format[0] !== '~') {
|
|
703
|
+
scid = toIntIfInt(format);
|
|
704
|
+
} else {
|
|
705
|
+
scid = toIntIfInt(format.substring(1, format.length));
|
|
706
|
+
paused = true;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
return {
|
|
710
|
+
scid: scid,
|
|
711
|
+
paused: paused
|
|
712
|
+
};
|
|
713
|
+
});
|
|
714
|
+
});
|
|
715
|
+
};
|
|
716
|
+
} (parser));
|
|
717
|
+
|
|
718
|
+
interface IListenerMap {
|
|
719
|
+
[s: string]: any;
|
|
720
|
+
}
|
|
721
|
+
type MapToList<T, V extends keyof T> = {
|
|
722
|
+
[K in V]: T[K][];
|
|
723
|
+
};
|
|
724
|
+
declare class EventEmitter<T extends IListenerMap> {
|
|
725
|
+
_eventMap: MapToList<T, keyof T>;
|
|
726
|
+
listeners<K extends keyof T>(type: K): MapToList<T, keyof T>[K];
|
|
727
|
+
emit<K extends keyof T>(type: K, ...args: any[]): boolean;
|
|
728
|
+
off<K extends keyof T>(type: K, fn: T[K]): this;
|
|
729
|
+
removeAllListeners<K extends keyof T>(type?: K): this;
|
|
730
|
+
on<K extends keyof T>(type: K, fn: T[K]): this;
|
|
731
|
+
once<K extends keyof T>(type: K, fn: T[K]): this;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
declare class Stream extends EventEmitter<IMediaEvent> {
|
|
735
|
+
protected audiotrack?: MediaStreamTrack;
|
|
736
|
+
protected videotrack?: MediaStreamTrack;
|
|
737
|
+
protected element?: HTMLMediaElement;
|
|
738
|
+
protected mediastream?: MediaStream;
|
|
739
|
+
protected traceid: string;
|
|
740
|
+
protected reporter?: IReporter;
|
|
741
|
+
id: string;
|
|
742
|
+
constructor();
|
|
743
|
+
set traceId(value: string);
|
|
744
|
+
get traceId(): string;
|
|
745
|
+
get mediaElement(): HTMLMediaElement | undefined;
|
|
746
|
+
setReporter(reporter: IReporter): void;
|
|
747
|
+
play(element: HTMLMediaElement): void;
|
|
748
|
+
stop(): void;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
interface IAudioMixer {
|
|
752
|
+
trackList: MediaStreamTrack[];
|
|
753
|
+
useGainNode?: boolean;
|
|
754
|
+
}
|
|
755
|
+
declare class AudioMixer {
|
|
756
|
+
protected audioTrackArr: MediaStreamTrack[];
|
|
757
|
+
protected useGainNode: boolean;
|
|
758
|
+
protected audioContext: AudioContext;
|
|
759
|
+
protected audioDestination: MediaStreamAudioDestinationNode;
|
|
760
|
+
protected audioSource: MediaStreamAudioSourceNode[];
|
|
761
|
+
protected gainNode: GainNode | null;
|
|
762
|
+
protected audioTrack: MediaStreamTrack | null;
|
|
763
|
+
constructor(props: IAudioMixer);
|
|
764
|
+
destroy(): void;
|
|
765
|
+
updateTrackList(trackList: MediaStreamTrack[]): void;
|
|
766
|
+
getMixedAudioTrack(): MediaStreamTrack;
|
|
767
|
+
private connectNode;
|
|
768
|
+
private disconnectSourceNode;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
interface IProps {
|
|
772
|
+
video: HTMLVideoElement;
|
|
773
|
+
}
|
|
774
|
+
declare class CanvasRenderer {
|
|
775
|
+
private activeRenderer;
|
|
776
|
+
private canvas;
|
|
777
|
+
private video;
|
|
778
|
+
private ms?;
|
|
779
|
+
constructor(props: IProps);
|
|
780
|
+
get mediaStream(): MediaStream;
|
|
781
|
+
start(): void;
|
|
782
|
+
stop(): void;
|
|
783
|
+
private initCanvas;
|
|
784
|
+
private initRenderer;
|
|
785
|
+
private render;
|
|
786
|
+
resize(width: number, height: number): void;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
declare class LocalStream extends Stream {
|
|
790
|
+
protected deviceManager: BrowserDeviceManager;
|
|
791
|
+
protected mediastream: MediaStream;
|
|
792
|
+
protected videoProfile: string;
|
|
793
|
+
protected screenProfile: string;
|
|
794
|
+
protected audioProfile: string;
|
|
795
|
+
protected pc?: RTCPeerConnection;
|
|
796
|
+
protected audioMixer?: AudioMixer;
|
|
797
|
+
protected canvasRenderer?: CanvasRenderer;
|
|
798
|
+
micAudioTrack?: MediaStreamTrack;
|
|
799
|
+
screenAudioTrack?: MediaStreamTrack;
|
|
800
|
+
hasVideo: boolean;
|
|
801
|
+
hasScreen: boolean;
|
|
802
|
+
isCustomStream: boolean;
|
|
803
|
+
screenSurfaceType: string | undefined;
|
|
804
|
+
VideoProfileMap: Map<string, IProfile>;
|
|
805
|
+
ScreenProfileMap: Map<string, IProfile>;
|
|
806
|
+
AudioProfileMap: Map<string, IAudioProfile>;
|
|
807
|
+
constructor();
|
|
808
|
+
get mediaStream(): MediaStream;
|
|
809
|
+
get audioTrack(): MediaStreamTrack | undefined;
|
|
810
|
+
get videoTrack(): MediaStreamTrack | undefined;
|
|
811
|
+
get hasAudio(): boolean;
|
|
812
|
+
getVideoProfile(): string | undefined;
|
|
813
|
+
getScreenProfile(): string | undefined;
|
|
814
|
+
getAudioProfile(): string | undefined;
|
|
815
|
+
init(config: IStreamConfig): Promise<void>;
|
|
816
|
+
initWithRetry(config: IStreamConfig, res?: () => void, rej?: (reason?: any) => void): Promise<void>;
|
|
817
|
+
private initMicAudio;
|
|
818
|
+
private initCameraVideo;
|
|
819
|
+
private initScreenVideoAudio;
|
|
820
|
+
private tryMixMicAndScreenAudio;
|
|
821
|
+
private initTracks;
|
|
822
|
+
private tryToSetProfile;
|
|
823
|
+
private stopAllTracks;
|
|
824
|
+
private resetLocalStream;
|
|
825
|
+
setEncodeParam(pc: RTCPeerConnection, kind?: string): void;
|
|
826
|
+
private setVideoEncodeParams;
|
|
827
|
+
private setAudioEncodeParams;
|
|
828
|
+
play(element: HTMLVideoElement, config?: {
|
|
829
|
+
autoplay?: boolean;
|
|
830
|
+
canvasStream?: boolean;
|
|
831
|
+
}): void;
|
|
832
|
+
setVideoProfile(profile: string): Promise<unknown>;
|
|
833
|
+
setScreenProfile(profile: string): Promise<unknown>;
|
|
834
|
+
setAudioProfile(profile: string): Promise<unknown>;
|
|
835
|
+
enableAudio(): boolean;
|
|
836
|
+
disableAudio(): boolean;
|
|
837
|
+
enableVideo(): boolean;
|
|
838
|
+
disableVideo(): boolean;
|
|
839
|
+
stop(): void;
|
|
840
|
+
mergeStream(newStream: LocalStream): void;
|
|
841
|
+
deleteTracks(trackType: {
|
|
842
|
+
video?: boolean;
|
|
843
|
+
audio?: boolean;
|
|
844
|
+
}): void;
|
|
845
|
+
protected createCustomStream(stream?: MediaStream): Promise<void>;
|
|
846
|
+
protected releaseMediaStream(): void;
|
|
847
|
+
protected hasVideoTrackReady(config: IStreamConfig): boolean;
|
|
848
|
+
protected hasScreenAudioConfig(config: IStreamConfig): boolean | MediaTrackConstraints | undefined;
|
|
849
|
+
protected hasAudioTrackReady(config: IStreamConfig): boolean;
|
|
850
|
+
protected hasMicAudioAndReady(config: IStreamConfig): false | MediaStreamTrack | undefined;
|
|
851
|
+
protected hasScreenAudioAndReady(config: IStreamConfig): false | MediaStreamTrack | undefined;
|
|
852
|
+
protected addTrackListener(): void;
|
|
853
|
+
protected listenVideoEnded(): void;
|
|
854
|
+
private listenAudioEnded;
|
|
855
|
+
protected handleVideoTrackEnded(): void;
|
|
856
|
+
protected handleAudioTrackEnded(): void;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
interface IStreamConfig {
|
|
860
|
+
audio?: IAudioConstraints | boolean;
|
|
861
|
+
video?: IVideoConstraints | boolean;
|
|
862
|
+
screen?: IScreenConstraints | boolean;
|
|
863
|
+
custom?: boolean;
|
|
864
|
+
mediaStream?: MediaStream;
|
|
865
|
+
skipProfile?: boolean;
|
|
866
|
+
}
|
|
867
|
+
interface IMediaEvent {
|
|
868
|
+
onAutoPlayError: () => void;
|
|
869
|
+
onCanPlay: () => void;
|
|
870
|
+
onReplaceTrack: () => void;
|
|
871
|
+
videoTrackEnded: () => void;
|
|
872
|
+
audioTrackEnded: () => void;
|
|
873
|
+
mediaElementBinded: () => void;
|
|
874
|
+
micAudioTrackEnded: () => void;
|
|
875
|
+
screenAudioTrackEnded: () => void;
|
|
876
|
+
}
|
|
877
|
+
interface IReporter {
|
|
878
|
+
reportVideoProfile(profile: string): void;
|
|
879
|
+
reportScreenProfile(profile: string): void;
|
|
880
|
+
reportAudioProfile(profile: string): void;
|
|
881
|
+
reportEnableAudio(): void;
|
|
882
|
+
reportDisableAudio(): void;
|
|
883
|
+
reportEnableVideo(): void;
|
|
884
|
+
reportDisableVideo(): void;
|
|
885
|
+
reportStop(type: number): void;
|
|
886
|
+
reportPlay(type: string): void;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
declare global {
|
|
890
|
+
interface Window {
|
|
891
|
+
SystemUtil: any;
|
|
892
|
+
BrowserUtil: any;
|
|
893
|
+
Guid: any;
|
|
894
|
+
LocalStorage: any;
|
|
895
|
+
ApiRequest: any;
|
|
896
|
+
define: any;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
declare global {
|
|
901
|
+
interface Window {
|
|
902
|
+
AliRTS: any;
|
|
903
|
+
define: any;
|
|
904
|
+
mozRTCPeerConnection: any;
|
|
905
|
+
webkitAudioContext: any;
|
|
906
|
+
WeixinJSBridge: any;
|
|
907
|
+
}
|
|
908
|
+
interface RTCConfiguration {
|
|
909
|
+
googCpuOveruseDetection?: boolean;
|
|
910
|
+
}
|
|
911
|
+
interface RTCRtpParameters {
|
|
912
|
+
encodings: RTCRtpEncodingParameters[];
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
|
|
6
916
|
declare enum AliRtcRawDataStreamType {
|
|
7
917
|
/** 相机流 */
|
|
8
918
|
AliRtcSdkStreamTypeCapture = 0,
|
|
@@ -37,7 +947,7 @@ interface AliRtcLocalStreamListener {
|
|
|
37
947
|
videotrackended: () => void;
|
|
38
948
|
audiotrackended: () => void;
|
|
39
949
|
}
|
|
40
|
-
declare class AliRtcLocalStreamInfo extends EventEmitter<AliRtcLocalStreamListener> {
|
|
950
|
+
declare class AliRtcLocalStreamInfo extends EventEmitter$1<AliRtcLocalStreamListener> {
|
|
41
951
|
type: AliRtcRawDataStreamType;
|
|
42
952
|
originVideoTrack?: MediaStreamTrack;
|
|
43
953
|
videoSource?: VideoStreamSource;
|
|
@@ -151,7 +1061,7 @@ interface AliRtcPluginListener {
|
|
|
151
1061
|
error: (error: any) => void;
|
|
152
1062
|
unsupported: () => void;
|
|
153
1063
|
}
|
|
154
|
-
declare abstract class AliRtcPlugin extends EventEmitter<AliRtcPluginListener> {
|
|
1064
|
+
declare abstract class AliRtcPlugin extends EventEmitter$1<AliRtcPluginListener> {
|
|
155
1065
|
name: string;
|
|
156
1066
|
options: any;
|
|
157
1067
|
type: AliRtcPluginType;
|