quickvo-sdk-js 0.1.2 → 0.1.3
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/index.js +1453 -1459
- package/dist/index.umd.cjs +2 -2
- package/dist/room/RoomUsers.d.ts +4 -4
- package/dist/types.d.ts +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Ft = Object.defineProperty;
|
|
2
|
+
var Lt = (s) => {
|
|
3
3
|
throw TypeError(s);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var G = (s, $, u) => (
|
|
5
|
+
var Ht = (s, $, u) => $ in s ? Ft(s, $, { enumerable: !0, configurable: !0, writable: !0, value: u }) : s[$] = u;
|
|
6
|
+
var W = (s, $, u) => Ht(s, typeof $ != "symbol" ? $ + "" : $, u), Bt = (s, $, u) => $.has(s) || Lt("Cannot " + u);
|
|
7
|
+
var G = (s, $, u) => (Bt(s, $, "read from private field"), u ? u.call(s) : $.get(s)), ct = (s, $, u) => $.has(s) ? Lt("Cannot add the same private member more than once") : $ instanceof WeakSet ? $.add(s) : $.set(s, u), dt = (s, $, u, A) => (Bt(s, $, "write to private field"), A ? A.call(s, u) : $.set(s, u), u);
|
|
8
8
|
const E = (s, $ = []) => {
|
|
9
9
|
const u = { ...s }, A = Object.keys(u);
|
|
10
10
|
for (const h of A)
|
|
@@ -108,952 +108,355 @@ const E = (s, $ = []) => {
|
|
|
108
108
|
D.includes("W") && (L = P[L.slice(0, 2)]), $ = $.replace(D, L);
|
|
109
109
|
}
|
|
110
110
|
return $;
|
|
111
|
+
}, enum_mediaType = {
|
|
112
|
+
microphoneCamera_audio: "麦克风-默认轨道",
|
|
113
|
+
microphoneCamera_video: "摄像头-默认轨道",
|
|
114
|
+
screenSharing_video: "屏幕共享-视频轨道",
|
|
115
|
+
screenSharing_audio: "屏幕共享-音频轨道"
|
|
111
116
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
u: [{ name: "uri" }],
|
|
133
|
-
e: [{ name: "email" }],
|
|
134
|
-
p: [{ name: "phone" }],
|
|
135
|
-
z: [{ name: "timezones" }],
|
|
136
|
-
// TODO: this one can actually be parsed properly...
|
|
137
|
-
r: [{ name: "repeats" }],
|
|
138
|
-
// TODO: this one can also be parsed properly
|
|
139
|
-
// k: [{}], // outdated thing ignored
|
|
140
|
-
t: [{
|
|
141
|
-
// t=0 0
|
|
142
|
-
name: "timing",
|
|
143
|
-
reg: /^(\d*) (\d*)/,
|
|
144
|
-
names: ["start", "stop"],
|
|
145
|
-
format: "%d %d"
|
|
146
|
-
}],
|
|
147
|
-
c: [{
|
|
148
|
-
// c=IN IP4 10.47.197.26
|
|
149
|
-
name: "connection",
|
|
150
|
-
reg: /^IN IP(\d) (\S*)/,
|
|
151
|
-
names: ["version", "ip"],
|
|
152
|
-
format: "IN IP%d %s"
|
|
153
|
-
}],
|
|
154
|
-
b: [{
|
|
155
|
-
// b=AS:4000
|
|
156
|
-
push: "bandwidth",
|
|
157
|
-
reg: /^(TIAS|AS|CT|RR|RS):(\d*)/,
|
|
158
|
-
names: ["type", "limit"],
|
|
159
|
-
format: "%s:%s"
|
|
160
|
-
}],
|
|
161
|
-
m: [{
|
|
162
|
-
// m=video 51744 RTP/AVP 126 97 98 34 31
|
|
163
|
-
// NB: special - pushes to session
|
|
164
|
-
// TODO: rtp/fmtp should be filtered by the payloads found here?
|
|
165
|
-
reg: /^(\w*) (\d*) ([\w/]*)(?: (.*))?/,
|
|
166
|
-
names: ["type", "port", "protocol", "payloads"],
|
|
167
|
-
format: "%s %d %s %s"
|
|
168
|
-
}],
|
|
169
|
-
a: [
|
|
170
|
-
{
|
|
171
|
-
// a=rtpmap:110 opus/48000/2
|
|
172
|
-
push: "rtp",
|
|
173
|
-
reg: /^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,
|
|
174
|
-
names: ["payload", "codec", "rate", "encoding"],
|
|
175
|
-
format: function($) {
|
|
176
|
-
return $.encoding ? "rtpmap:%d %s/%s/%s" : $.rate ? "rtpmap:%d %s/%s" : "rtpmap:%d %s";
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
// a=fmtp:108 profile-level-id=24;object=23;bitrate=64000
|
|
181
|
-
// a=fmtp:111 minptime=10; useinbandfec=1
|
|
182
|
-
push: "fmtp",
|
|
183
|
-
reg: /^fmtp:(\d*) ([\S| ]*)/,
|
|
184
|
-
names: ["payload", "config"],
|
|
185
|
-
format: "fmtp:%d %s"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
// a=control:streamid=0
|
|
189
|
-
name: "control",
|
|
190
|
-
reg: /^control:(.*)/,
|
|
191
|
-
format: "control:%s"
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
// a=rtcp:65179 IN IP4 193.84.77.194
|
|
195
|
-
name: "rtcp",
|
|
196
|
-
reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,
|
|
197
|
-
names: ["port", "netType", "ipVer", "address"],
|
|
198
|
-
format: function($) {
|
|
199
|
-
return $.address != null ? "rtcp:%d %s IP%d %s" : "rtcp:%d";
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
// a=rtcp-fb:98 trr-int 100
|
|
204
|
-
push: "rtcpFbTrrInt",
|
|
205
|
-
reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/,
|
|
206
|
-
names: ["payload", "value"],
|
|
207
|
-
format: "rtcp-fb:%s trr-int %d"
|
|
117
|
+
at(enum_mediaType);
|
|
118
|
+
const mediaType_keys = Object.keys(enum_mediaType);
|
|
119
|
+
var S = Object.defineProperty, C = (s) => {
|
|
120
|
+
throw TypeError(s);
|
|
121
|
+
}, M = (s, $, u) => $ in s ? S(s, $, { enumerable: !0, configurable: !0, writable: !0, value: u }) : s[$] = u, p = (s, $, u) => M(s, typeof $ != "symbol" ? $ + "" : $, u), I = (s, $, u) => $.has(s) || C("Cannot " + u), e = (s, $, u) => (I(s, $, "read from private field"), u ? u.call(s) : $.get(s)), i = (s, $, u) => $.has(s) ? C("Cannot add the same private member more than once") : $ instanceof WeakSet ? $.add(s) : $.set(s, u), r = (s, $, u, A) => (I(s, $, "write to private field"), $.set(s, u), u), n, c, a, l, m, d, f, x, w, b, B, y, T, R, g;
|
|
122
|
+
class _ {
|
|
123
|
+
// 初始化成功的回调
|
|
124
|
+
constructor($) {
|
|
125
|
+
i(this, n, {
|
|
126
|
+
url: "",
|
|
127
|
+
binaryType: "blob",
|
|
128
|
+
timeout: 6 * 1e3,
|
|
129
|
+
debug: !1,
|
|
130
|
+
sendBeforAutoConnect: !1,
|
|
131
|
+
reconnectCount: -1,
|
|
132
|
+
reconnectTime: 60 * 1e3,
|
|
133
|
+
reconnectIntervalTime: 5e3,
|
|
134
|
+
heartbeatIntervalTime: 1e4,
|
|
135
|
+
checkReconnect: (u) => !0,
|
|
136
|
+
onReconnectSuccess: async (u) => {
|
|
208
137
|
},
|
|
209
|
-
{
|
|
210
|
-
// a=rtcp-fb:98 nack rpsi
|
|
211
|
-
push: "rtcpFb",
|
|
212
|
-
reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,
|
|
213
|
-
names: ["payload", "type", "subtype"],
|
|
214
|
-
format: function($) {
|
|
215
|
-
return $.subtype != null ? "rtcp-fb:%s %s %s" : "rtcp-fb:%s %s";
|
|
216
|
-
}
|
|
138
|
+
onReconnectStop: async (u) => {
|
|
217
139
|
},
|
|
218
|
-
{
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
140
|
+
getHeartbeatMsg: () => JSON.stringify({ event: "heartbeat" }),
|
|
141
|
+
onMessage: (u) => {
|
|
142
|
+
}
|
|
143
|
+
}), i(this, c), i(this, a, -1), i(this, l, -1), i(this, m, 0), i(this, d, 0), i(this, f, !1), i(this, x, (u) => {
|
|
144
|
+
}), p(this, "close", async (u = 1e3, A = "correctly close.") => {
|
|
145
|
+
var h;
|
|
146
|
+
e(this, c) && (r(this, f, !0), e(this, g).call(this), (h = e(this, c)) == null || h.close(u, A));
|
|
147
|
+
}), p(this, "connect", () => new Promise(async (u) => {
|
|
148
|
+
r(this, x, u), r(this, c, new WebSocket(e(this, n).url)), e(this, c).binaryType = e(this, n).binaryType, e(this, c).onopen = e(this, B), e(this, c).onmessage = e(this, b), e(this, c).onerror = e(this, y), e(this, c).onclose = e(this, T);
|
|
149
|
+
})), p(this, "reconnect", async (u) => new Promise((A, h) => {
|
|
150
|
+
e(this, n).debug && console.info("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", "------->pr-ws: await reconnect.");
|
|
151
|
+
const k = (t) => (e(this, n).debug && console.info("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", `------->pr-ws: ${t}`), e(this, n).onReconnectStop({ msg: t }), h(t));
|
|
152
|
+
if (e(this, w).call(this) === !1) return k("stop reconnect. exceed maxReconnectionTime.");
|
|
153
|
+
if (e(this, a) !== -1 && e(this, a) === 0) return k("stop reconnect. surplusReconnectCount is 0.");
|
|
154
|
+
if (!e(this, n).checkReconnect(u)) return k("stop reconnect. checkReconnect is false.");
|
|
155
|
+
e(this, n).debug && console.info("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", `------->pr-ws: await ${e(this, n).reconnectIntervalTime}ms run reconnect. surplusReconnectCount is ${e(this, a)}`, u), r(this, m, setTimeout(async () => {
|
|
156
|
+
r(this, a, Math.max(-1, e(this, a) - 1)), await this.connect();
|
|
157
|
+
try {
|
|
158
|
+
await e(this, n).onReconnectSuccess(e(this, c));
|
|
159
|
+
} catch (t) {
|
|
160
|
+
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->pr-ws: onReconnectSuccess is error", t);
|
|
227
161
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
162
|
+
A(!0);
|
|
163
|
+
}, e(this, n).reconnectIntervalTime));
|
|
164
|
+
})), p(this, "sendMessage", async (u) => {
|
|
165
|
+
var A;
|
|
166
|
+
e(this, c) || (e(this, n).debug && console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", "------->pr-ws: ws is not ready."), e(this, n).sendBeforAutoConnect && (e(this, n).debug && console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", "------->pr-ws: await ws connect."), await this.connect())), (A = e(this, c)) == null || A.send(u);
|
|
167
|
+
}), i(this, w, () => {
|
|
168
|
+
const u = Date.now();
|
|
169
|
+
return e(this, l) === -1 && r(this, l, u + e(this, n).reconnectTime), !(u > e(this, l));
|
|
170
|
+
}), i(this, b, (u) => {
|
|
171
|
+
const { data: A } = u;
|
|
172
|
+
e(this, n).onMessage(A);
|
|
173
|
+
}), i(this, B, () => {
|
|
174
|
+
e(this, n).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", "------->pr-ws: connect is success.", e(this, c)), r(this, a, e(this, n).reconnectCount), r(this, l, -1), e(this, R).call(this), e(this, x).call(this, e(this, c));
|
|
175
|
+
}), i(this, y, (u) => {
|
|
176
|
+
e(this, n).debug && console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", "------->pr-ws: connect is error.", u);
|
|
177
|
+
}), i(this, T, (u) => {
|
|
178
|
+
if (e(this, n).debug && console.info("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", `------->pr-ws: connect is close. code: ${u.code}, permanentClosed is ${e(this, f)}.`, u), e(this, g).call(this), !e(this, f) && u.code !== 1e3)
|
|
179
|
+
return this.reconnect(u);
|
|
180
|
+
r(this, c, void 0);
|
|
181
|
+
}), i(this, R, () => {
|
|
182
|
+
r(this, d, setInterval(() => {
|
|
183
|
+
const u = e(this, n).getHeartbeatMsg();
|
|
184
|
+
u && this.sendMessage(u);
|
|
185
|
+
}, e(this, n).heartbeatIntervalTime));
|
|
186
|
+
}), i(this, g, () => {
|
|
187
|
+
clearInterval(e(this, m)), clearInterval(e(this, d));
|
|
188
|
+
}), r(this, n, { ...e(this, n), ...$ }), r(this, a, e(this, n).reconnectCount);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
n = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap();
|
|
192
|
+
var commonjsGlobal = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, indexMinimal = {}, minimal$1 = {}, aspromise, hasRequiredAspromise;
|
|
193
|
+
function requireAspromise() {
|
|
194
|
+
if (hasRequiredAspromise) return aspromise;
|
|
195
|
+
hasRequiredAspromise = 1, aspromise = s;
|
|
196
|
+
function s($, u) {
|
|
197
|
+
for (var A = new Array(arguments.length - 1), h = 0, k = 2, t = !0; k < arguments.length; )
|
|
198
|
+
A[h++] = arguments[k++];
|
|
199
|
+
return new Promise(function(v, N) {
|
|
200
|
+
A[h] = function(U) {
|
|
201
|
+
if (t)
|
|
202
|
+
if (t = !1, U)
|
|
203
|
+
N(U);
|
|
204
|
+
else {
|
|
205
|
+
for (var D = new Array(arguments.length - 1), L = 0; L < D.length; )
|
|
206
|
+
D[L++] = arguments[L];
|
|
207
|
+
v.apply(null, D);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
try {
|
|
211
|
+
$.apply(u || null, A);
|
|
212
|
+
} catch (q) {
|
|
213
|
+
t && (t = !1, N(q));
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
return aspromise;
|
|
218
|
+
}
|
|
219
|
+
var base64 = {}, hasRequiredBase64;
|
|
220
|
+
function requireBase64() {
|
|
221
|
+
return hasRequiredBase64 || (hasRequiredBase64 = 1, function(s) {
|
|
222
|
+
var $ = s;
|
|
223
|
+
$.length = function(o) {
|
|
224
|
+
var v = o.length;
|
|
225
|
+
if (!v)
|
|
226
|
+
return 0;
|
|
227
|
+
for (var N = 0; --v % 4 > 1 && o.charAt(v) === "="; )
|
|
228
|
+
++N;
|
|
229
|
+
return Math.ceil(o.length * 3) / 4 - N;
|
|
230
|
+
};
|
|
231
|
+
for (var u = new Array(64), A = new Array(123), h = 0; h < 64; )
|
|
232
|
+
A[u[h] = h < 26 ? h + 65 : h < 52 ? h + 71 : h < 62 ? h - 4 : h - 59 | 43] = h++;
|
|
233
|
+
$.encode = function(o, v, N) {
|
|
234
|
+
for (var q = null, U = [], D = 0, L = 0, Z; v < N; ) {
|
|
235
|
+
var K = o[v++];
|
|
236
|
+
switch (L) {
|
|
237
|
+
case 0:
|
|
238
|
+
U[D++] = u[K >> 2], Z = (K & 3) << 4, L = 1;
|
|
239
|
+
break;
|
|
240
|
+
case 1:
|
|
241
|
+
U[D++] = u[Z | K >> 4], Z = (K & 15) << 2, L = 2;
|
|
242
|
+
break;
|
|
243
|
+
case 2:
|
|
244
|
+
U[D++] = u[Z | K >> 6], U[D++] = u[K & 63], L = 0;
|
|
245
|
+
break;
|
|
241
246
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
{
|
|
268
|
-
// a=ptime:20
|
|
269
|
-
name: "ptime",
|
|
270
|
-
reg: /^ptime:(\d*(?:\.\d*)*)/,
|
|
271
|
-
format: "ptime:%d"
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
// a=maxptime:60
|
|
275
|
-
name: "maxptime",
|
|
276
|
-
reg: /^maxptime:(\d*(?:\.\d*)*)/,
|
|
277
|
-
format: "maxptime:%d"
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
// a=sendrecv
|
|
281
|
-
name: "direction",
|
|
282
|
-
reg: /^(sendrecv|recvonly|sendonly|inactive)/
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
// a=ice-lite
|
|
286
|
-
name: "icelite",
|
|
287
|
-
reg: /^(ice-lite)/
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
// a=ice-ufrag:F7gI
|
|
291
|
-
name: "iceUfrag",
|
|
292
|
-
reg: /^ice-ufrag:(\S*)/,
|
|
293
|
-
format: "ice-ufrag:%s"
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
// a=ice-pwd:x9cml/YzichV2+XlhiMu8g
|
|
297
|
-
name: "icePwd",
|
|
298
|
-
reg: /^ice-pwd:(\S*)/,
|
|
299
|
-
format: "ice-pwd:%s"
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
// a=fingerprint:SHA-1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
|
|
303
|
-
name: "fingerprint",
|
|
304
|
-
reg: /^fingerprint:(\S*) (\S*)/,
|
|
305
|
-
names: ["type", "hash"],
|
|
306
|
-
format: "fingerprint:%s %s"
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
// a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host
|
|
310
|
-
// a=candidate:1162875081 1 udp 2113937151 192.168.34.75 60017 typ host generation 0 network-id 3 network-cost 10
|
|
311
|
-
// 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
|
|
312
|
-
// a=candidate:229815620 1 tcp 1518280447 192.168.150.19 60017 typ host tcptype active generation 0 network-id 3 network-cost 10
|
|
313
|
-
// 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
|
|
314
|
-
push: "candidates",
|
|
315
|
-
reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,
|
|
316
|
-
names: ["foundation", "component", "transport", "priority", "ip", "port", "type", "raddr", "rport", "tcptype", "generation", "network-id", "network-cost"],
|
|
317
|
-
format: function($) {
|
|
318
|
-
var u = "candidate:%s %d %s %d %s %d typ %s";
|
|
319
|
-
return u += $.raddr != null ? " raddr %s rport %d" : "%v%v", u += $.tcptype != null ? " tcptype %s" : "%v", $.generation != null && (u += " generation %d"), u += $["network-id"] != null ? " network-id %d" : "%v", u += $["network-cost"] != null ? " network-cost %d" : "%v", u;
|
|
320
|
-
}
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
// a=end-of-candidates (keep after the candidates line for readability)
|
|
324
|
-
name: "endOfCandidates",
|
|
325
|
-
reg: /^(end-of-candidates)/
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
// a=remote-candidates:1 203.0.113.1 54400 2 203.0.113.1 54401 ...
|
|
329
|
-
name: "remoteCandidates",
|
|
330
|
-
reg: /^remote-candidates:(.*)/,
|
|
331
|
-
format: "remote-candidates:%s"
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
// a=ice-options:google-ice
|
|
335
|
-
name: "iceOptions",
|
|
336
|
-
reg: /^ice-options:(\S*)/,
|
|
337
|
-
format: "ice-options:%s"
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
// a=ssrc:2566107569 cname:t9YU8M1UxTF8Y1A1
|
|
341
|
-
push: "ssrcs",
|
|
342
|
-
reg: /^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,
|
|
343
|
-
names: ["id", "attribute", "value"],
|
|
344
|
-
format: function($) {
|
|
345
|
-
var u = "ssrc:%d";
|
|
346
|
-
return $.attribute != null && (u += " %s", $.value != null && (u += ":%s")), u;
|
|
247
|
+
D > 8191 && ((q || (q = [])).push(String.fromCharCode.apply(String, U)), D = 0);
|
|
248
|
+
}
|
|
249
|
+
return L && (U[D++] = u[Z], U[D++] = 61, L === 1 && (U[D++] = 61)), q ? (D && q.push(String.fromCharCode.apply(String, U.slice(0, D))), q.join("")) : String.fromCharCode.apply(String, U.slice(0, D));
|
|
250
|
+
};
|
|
251
|
+
var k = "invalid encoding";
|
|
252
|
+
$.decode = function(o, v, N) {
|
|
253
|
+
for (var q = N, U = 0, D, L = 0; L < o.length; ) {
|
|
254
|
+
var Z = o.charCodeAt(L++);
|
|
255
|
+
if (Z === 61 && U > 1)
|
|
256
|
+
break;
|
|
257
|
+
if ((Z = A[Z]) === void 0)
|
|
258
|
+
throw Error(k);
|
|
259
|
+
switch (U) {
|
|
260
|
+
case 0:
|
|
261
|
+
D = Z, U = 1;
|
|
262
|
+
break;
|
|
263
|
+
case 1:
|
|
264
|
+
v[N++] = D << 2 | (Z & 48) >> 4, D = Z, U = 2;
|
|
265
|
+
break;
|
|
266
|
+
case 2:
|
|
267
|
+
v[N++] = (D & 15) << 4 | (Z & 60) >> 2, D = Z, U = 3;
|
|
268
|
+
break;
|
|
269
|
+
case 3:
|
|
270
|
+
v[N++] = (D & 3) << 6 | Z, U = 0;
|
|
271
|
+
break;
|
|
347
272
|
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
273
|
+
}
|
|
274
|
+
if (U === 1)
|
|
275
|
+
throw Error(k);
|
|
276
|
+
return N - q;
|
|
277
|
+
}, $.test = function(o) {
|
|
278
|
+
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o);
|
|
279
|
+
};
|
|
280
|
+
}(base64)), base64;
|
|
281
|
+
}
|
|
282
|
+
var eventemitter, hasRequiredEventemitter;
|
|
283
|
+
function requireEventemitter() {
|
|
284
|
+
if (hasRequiredEventemitter) return eventemitter;
|
|
285
|
+
hasRequiredEventemitter = 1, eventemitter = s;
|
|
286
|
+
function s() {
|
|
287
|
+
this._listeners = {};
|
|
288
|
+
}
|
|
289
|
+
return s.prototype.on = function(u, A, h) {
|
|
290
|
+
return (this._listeners[u] || (this._listeners[u] = [])).push({
|
|
291
|
+
fn: A,
|
|
292
|
+
ctx: h || this
|
|
293
|
+
}), this;
|
|
294
|
+
}, s.prototype.off = function(u, A) {
|
|
295
|
+
if (u === void 0)
|
|
296
|
+
this._listeners = {};
|
|
297
|
+
else if (A === void 0)
|
|
298
|
+
this._listeners[u] = [];
|
|
299
|
+
else
|
|
300
|
+
for (var h = this._listeners[u], k = 0; k < h.length; )
|
|
301
|
+
h[k].fn === A ? h.splice(k, 1) : ++k;
|
|
302
|
+
return this;
|
|
303
|
+
}, s.prototype.emit = function(u) {
|
|
304
|
+
var A = this._listeners[u];
|
|
305
|
+
if (A) {
|
|
306
|
+
for (var h = [], k = 1; k < arguments.length; )
|
|
307
|
+
h.push(arguments[k++]);
|
|
308
|
+
for (k = 0; k < A.length; )
|
|
309
|
+
A[k].fn.apply(A[k++].ctx, h);
|
|
310
|
+
}
|
|
311
|
+
return this;
|
|
312
|
+
}, eventemitter;
|
|
313
|
+
}
|
|
314
|
+
var float, hasRequiredFloat;
|
|
315
|
+
function requireFloat() {
|
|
316
|
+
if (hasRequiredFloat) return float;
|
|
317
|
+
hasRequiredFloat = 1, float = s(s);
|
|
318
|
+
function s(k) {
|
|
319
|
+
return typeof Float32Array < "u" ? function() {
|
|
320
|
+
var t = new Float32Array([-0]), o = new Uint8Array(t.buffer), v = o[3] === 128;
|
|
321
|
+
function N(L, Z, K) {
|
|
322
|
+
t[0] = L, Z[K] = o[0], Z[K + 1] = o[1], Z[K + 2] = o[2], Z[K + 3] = o[3];
|
|
323
|
+
}
|
|
324
|
+
function q(L, Z, K) {
|
|
325
|
+
t[0] = L, Z[K] = o[3], Z[K + 1] = o[2], Z[K + 2] = o[1], Z[K + 3] = o[0];
|
|
326
|
+
}
|
|
327
|
+
k.writeFloatLE = v ? N : q, k.writeFloatBE = v ? q : N;
|
|
328
|
+
function U(L, Z) {
|
|
329
|
+
return o[0] = L[Z], o[1] = L[Z + 1], o[2] = L[Z + 2], o[3] = L[Z + 3], t[0];
|
|
330
|
+
}
|
|
331
|
+
function D(L, Z) {
|
|
332
|
+
return o[3] = L[Z], o[2] = L[Z + 1], o[1] = L[Z + 2], o[0] = L[Z + 3], t[0];
|
|
333
|
+
}
|
|
334
|
+
k.readFloatLE = v ? U : D, k.readFloatBE = v ? D : U;
|
|
335
|
+
}() : function() {
|
|
336
|
+
function t(v, N, q, U) {
|
|
337
|
+
var D = N < 0 ? 1 : 0;
|
|
338
|
+
if (D && (N = -N), N === 0)
|
|
339
|
+
v(1 / N > 0 ? (
|
|
340
|
+
/* positive */
|
|
341
|
+
0
|
|
342
|
+
) : (
|
|
343
|
+
/* negative 0 */
|
|
344
|
+
2147483648
|
|
345
|
+
), q, U);
|
|
346
|
+
else if (isNaN(N))
|
|
347
|
+
v(2143289344, q, U);
|
|
348
|
+
else if (N > 34028234663852886e22)
|
|
349
|
+
v((D << 31 | 2139095040) >>> 0, q, U);
|
|
350
|
+
else if (N < 11754943508222875e-54)
|
|
351
|
+
v((D << 31 | Math.round(N / 1401298464324817e-60)) >>> 0, q, U);
|
|
352
|
+
else {
|
|
353
|
+
var L = Math.floor(Math.log(N) / Math.LN2), Z = Math.round(N * Math.pow(2, -L) * 8388608) & 8388607;
|
|
354
|
+
v((D << 31 | L + 127 << 23 | Z) >>> 0, q, U);
|
|
390
355
|
}
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
// a=x-google-flag:conference
|
|
394
|
-
name: "xGoogleFlag",
|
|
395
|
-
reg: /^x-google-flag:([^\s]*)/,
|
|
396
|
-
format: "x-google-flag:%s"
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
// a=rid:1 send max-width=1280;max-height=720;max-fps=30;depend=0
|
|
400
|
-
push: "rids",
|
|
401
|
-
reg: /^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,
|
|
402
|
-
names: ["id", "direction", "params"],
|
|
403
|
-
format: function($) {
|
|
404
|
-
return $.params ? "rid:%s %s %s" : "rid:%s %s";
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
{
|
|
408
|
-
// a=imageattr:97 send [x=800,y=640,sar=1.1,q=0.6] [x=480,y=320] recv [x=330,y=250]
|
|
409
|
-
// a=imageattr:* send [x=800,y=640] recv *
|
|
410
|
-
// a=imageattr:100 recv [x=320,y=240]
|
|
411
|
-
push: "imageattrs",
|
|
412
|
-
reg: new RegExp(
|
|
413
|
-
// a=imageattr:97
|
|
414
|
-
"^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"
|
|
415
|
-
),
|
|
416
|
-
names: ["pt", "dir1", "attrs1", "dir2", "attrs2"],
|
|
417
|
-
format: function($) {
|
|
418
|
-
return "imageattr:%s %s %s" + ($.dir2 ? " %s %s" : "");
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
// a=simulcast:send 1,2,3;~4,~5 recv 6;~7,~8
|
|
423
|
-
// a=simulcast:recv 1;4,5 send 6;7
|
|
424
|
-
name: "simulcast",
|
|
425
|
-
reg: new RegExp(
|
|
426
|
-
// a=simulcast:
|
|
427
|
-
"^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"
|
|
428
|
-
),
|
|
429
|
-
names: ["dir1", "list1", "dir2", "list2"],
|
|
430
|
-
format: function($) {
|
|
431
|
-
return "simulcast:%s %s" + ($.dir2 ? " %s %s" : "");
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
// old simulcast draft 03 (implemented by Firefox)
|
|
436
|
-
// https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-03
|
|
437
|
-
// a=simulcast: recv pt=97;98 send pt=97
|
|
438
|
-
// a=simulcast: send rid=5;6;7 paused=6,7
|
|
439
|
-
name: "simulcast_03",
|
|
440
|
-
reg: /^simulcast:[\s\t]+([\S+\s\t]+)$/,
|
|
441
|
-
names: ["value"],
|
|
442
|
-
format: "simulcast: %s"
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
// a=framerate:25
|
|
446
|
-
// a=framerate:29.97
|
|
447
|
-
name: "framerate",
|
|
448
|
-
reg: /^framerate:(\d+(?:$|\.\d+))/,
|
|
449
|
-
format: "framerate:%s"
|
|
450
|
-
},
|
|
451
|
-
{
|
|
452
|
-
// RFC4570
|
|
453
|
-
// a=source-filter: incl IN IP4 239.5.2.31 10.1.15.5
|
|
454
|
-
name: "sourceFilter",
|
|
455
|
-
reg: /^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,
|
|
456
|
-
names: ["filterMode", "netType", "addressTypes", "destAddress", "srcList"],
|
|
457
|
-
format: "source-filter: %s %s %s %s %s"
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
// a=bundle-only
|
|
461
|
-
name: "bundleOnly",
|
|
462
|
-
reg: /^(bundle-only)/
|
|
463
|
-
},
|
|
464
|
-
{
|
|
465
|
-
// a=label:1
|
|
466
|
-
name: "label",
|
|
467
|
-
reg: /^label:(.+)/,
|
|
468
|
-
format: "label:%s"
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
// RFC version 26 for SCTP over DTLS
|
|
472
|
-
// https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-26#section-5
|
|
473
|
-
name: "sctpPort",
|
|
474
|
-
reg: /^sctp-port:(\d+)$/,
|
|
475
|
-
format: "sctp-port:%s"
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
// RFC version 26 for SCTP over DTLS
|
|
479
|
-
// https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-26#section-6
|
|
480
|
-
name: "maxMessageSize",
|
|
481
|
-
reg: /^max-message-size:(\d+)$/,
|
|
482
|
-
format: "max-message-size:%s"
|
|
483
|
-
},
|
|
484
|
-
{
|
|
485
|
-
// RFC7273
|
|
486
|
-
// a=ts-refclk:ptp=IEEE1588-2008:39-A7-94-FF-FE-07-CB-D0:37
|
|
487
|
-
push: "tsRefClocks",
|
|
488
|
-
reg: /^ts-refclk:([^\s=]*)(?:=(\S*))?/,
|
|
489
|
-
names: ["clksrc", "clksrcExt"],
|
|
490
|
-
format: function($) {
|
|
491
|
-
return "ts-refclk:%s" + ($.clksrcExt != null ? "=%s" : "");
|
|
492
|
-
}
|
|
493
|
-
},
|
|
494
|
-
{
|
|
495
|
-
// RFC7273
|
|
496
|
-
// a=mediaclk:direct=963214424
|
|
497
|
-
name: "mediaClk",
|
|
498
|
-
reg: /^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,
|
|
499
|
-
names: ["id", "mediaClockName", "mediaClockValue", "rateNumerator", "rateDenominator"],
|
|
500
|
-
format: function($) {
|
|
501
|
-
var u = "mediaclk:";
|
|
502
|
-
return u += $.id != null ? "id=%s %s" : "%v%s", u += $.mediaClockValue != null ? "=%s" : "", u += $.rateNumerator != null ? " rate=%s" : "", u += $.rateDenominator != null ? "/%s" : "", u;
|
|
503
|
-
}
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
// a=keywds:keywords
|
|
507
|
-
name: "keywords",
|
|
508
|
-
reg: /^keywds:(.+)$/,
|
|
509
|
-
format: "keywds:%s"
|
|
510
|
-
},
|
|
511
|
-
{
|
|
512
|
-
// a=content:main
|
|
513
|
-
name: "content",
|
|
514
|
-
reg: /^content:(.+)/,
|
|
515
|
-
format: "content:%s"
|
|
516
|
-
},
|
|
517
|
-
// BFCP https://tools.ietf.org/html/rfc4583
|
|
518
|
-
{
|
|
519
|
-
// a=floorctrl:c-s
|
|
520
|
-
name: "bfcpFloorCtrl",
|
|
521
|
-
reg: /^floorctrl:(c-only|s-only|c-s)/,
|
|
522
|
-
format: "floorctrl:%s"
|
|
523
|
-
},
|
|
524
|
-
{
|
|
525
|
-
// a=confid:1
|
|
526
|
-
name: "bfcpConfId",
|
|
527
|
-
reg: /^confid:(\d+)/,
|
|
528
|
-
format: "confid:%s"
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
// a=userid:1
|
|
532
|
-
name: "bfcpUserId",
|
|
533
|
-
reg: /^userid:(\d+)/,
|
|
534
|
-
format: "userid:%s"
|
|
535
|
-
},
|
|
536
|
-
{
|
|
537
|
-
// a=floorid:1
|
|
538
|
-
name: "bfcpFloorId",
|
|
539
|
-
reg: /^floorid:(.+) (?:m-stream|mstrm):(.+)/,
|
|
540
|
-
names: ["id", "mStream"],
|
|
541
|
-
format: "floorid:%s mstrm:%s"
|
|
542
|
-
},
|
|
543
|
-
{
|
|
544
|
-
// any a= that we don't understand is kept verbatim on media.invalid
|
|
545
|
-
push: "invalid",
|
|
546
|
-
names: ["value"]
|
|
547
356
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
u.forEach(function(A) {
|
|
553
|
-
A.reg || (A.reg = /(.*)/), A.format || (A.format = "%s");
|
|
554
|
-
});
|
|
555
|
-
}), grammar.exports;
|
|
556
|
-
}
|
|
557
|
-
var hasRequiredParser;
|
|
558
|
-
function requireParser() {
|
|
559
|
-
return hasRequiredParser || (hasRequiredParser = 1, function(s) {
|
|
560
|
-
var $ = function(o) {
|
|
561
|
-
return String(Number(o)) === o ? Number(o) : o;
|
|
562
|
-
}, u = function(o, v, N, q) {
|
|
563
|
-
if (q && !N)
|
|
564
|
-
v[q] = $(o[1]);
|
|
565
|
-
else
|
|
566
|
-
for (var U = 0; U < N.length; U += 1)
|
|
567
|
-
o[U + 1] != null && (v[N[U]] = $(o[U + 1]));
|
|
568
|
-
}, A = function(o, v, N) {
|
|
569
|
-
var q = o.name && o.names;
|
|
570
|
-
o.push && !v[o.push] ? v[o.push] = [] : q && !v[o.name] && (v[o.name] = {});
|
|
571
|
-
var U = o.push ? {} : (
|
|
572
|
-
// blank object that will be pushed
|
|
573
|
-
q ? v[o.name] : v
|
|
574
|
-
);
|
|
575
|
-
u(N.match(o.reg), U, o.names, o.name), o.push && v[o.push].push(U);
|
|
576
|
-
}, h = requireGrammar(), k = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
|
|
577
|
-
s.parse = function(o) {
|
|
578
|
-
var v = {}, N = [], q = v;
|
|
579
|
-
return o.split(/(\r\n|\r|\n)/).filter(k).forEach(function(U) {
|
|
580
|
-
var D = U[0], L = U.slice(2);
|
|
581
|
-
D === "m" && (N.push({ rtp: [], fmtp: [] }), q = N[N.length - 1]);
|
|
582
|
-
for (var Z = 0; Z < (h[D] || []).length; Z += 1) {
|
|
583
|
-
var W = h[D][Z];
|
|
584
|
-
if (W.reg.test(L))
|
|
585
|
-
return A(W, q, L);
|
|
586
|
-
}
|
|
587
|
-
}), v.media = N, v;
|
|
588
|
-
};
|
|
589
|
-
var t = function(o, v) {
|
|
590
|
-
var N = v.split(/=(.+)/, 2);
|
|
591
|
-
return N.length === 2 ? o[N[0]] = $(N[1]) : N.length === 1 && v.length > 1 && (o[N[0]] = void 0), o;
|
|
592
|
-
};
|
|
593
|
-
s.parseParams = function(o) {
|
|
594
|
-
return o.split(/;\s?/).reduce(t, {});
|
|
595
|
-
}, s.parseFmtpConfig = s.parseParams, s.parsePayloads = function(o) {
|
|
596
|
-
return o.toString().split(" ").map(Number);
|
|
597
|
-
}, s.parseRemoteCandidates = function(o) {
|
|
598
|
-
for (var v = [], N = o.split(" ").map($), q = 0; q < N.length; q += 3)
|
|
599
|
-
v.push({
|
|
600
|
-
component: N[q],
|
|
601
|
-
ip: N[q + 1],
|
|
602
|
-
port: N[q + 2]
|
|
603
|
-
});
|
|
604
|
-
return v;
|
|
605
|
-
}, s.parseImageAttributes = function(o) {
|
|
606
|
-
return o.split(" ").map(function(v) {
|
|
607
|
-
return v.substring(1, v.length - 1).split(",").reduce(t, {});
|
|
608
|
-
});
|
|
609
|
-
}, s.parseSimulcastStreamList = function(o) {
|
|
610
|
-
return o.split(";").map(function(v) {
|
|
611
|
-
return v.split(",").map(function(N) {
|
|
612
|
-
var q, U = !1;
|
|
613
|
-
return N[0] !== "~" ? q = $(N) : (q = $(N.substring(1, N.length)), U = !0), {
|
|
614
|
-
scid: q,
|
|
615
|
-
paused: U
|
|
616
|
-
};
|
|
617
|
-
});
|
|
618
|
-
});
|
|
619
|
-
};
|
|
620
|
-
}(parser)), parser;
|
|
621
|
-
}
|
|
622
|
-
var writer$1, hasRequiredWriter$1;
|
|
623
|
-
function requireWriter$1() {
|
|
624
|
-
if (hasRequiredWriter$1) return writer$1;
|
|
625
|
-
hasRequiredWriter$1 = 1;
|
|
626
|
-
var s = requireGrammar(), $ = /%[sdv%]/g, u = function(t) {
|
|
627
|
-
var o = 1, v = arguments, N = v.length;
|
|
628
|
-
return t.replace($, function(q) {
|
|
629
|
-
if (o >= N)
|
|
630
|
-
return q;
|
|
631
|
-
var U = v[o];
|
|
632
|
-
switch (o += 1, q) {
|
|
633
|
-
case "%%":
|
|
634
|
-
return "%";
|
|
635
|
-
case "%s":
|
|
636
|
-
return String(U);
|
|
637
|
-
case "%d":
|
|
638
|
-
return Number(U);
|
|
639
|
-
case "%v":
|
|
640
|
-
return "";
|
|
357
|
+
k.writeFloatLE = t.bind(null, $), k.writeFloatBE = t.bind(null, u);
|
|
358
|
+
function o(v, N, q) {
|
|
359
|
+
var U = v(N, q), D = (U >> 31) * 2 + 1, L = U >>> 23 & 255, Z = U & 8388607;
|
|
360
|
+
return L === 255 ? Z ? NaN : D * (1 / 0) : L === 0 ? D * 1401298464324817e-60 * Z : D * Math.pow(2, L - 150) * (Z + 8388608);
|
|
641
361
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
var D = o.names[U];
|
|
648
|
-
o.name ? q.push(v[o.name][D]) : q.push(v[o.names[U]]);
|
|
362
|
+
k.readFloatLE = o.bind(null, A), k.readFloatBE = o.bind(null, h);
|
|
363
|
+
}(), typeof Float64Array < "u" ? function() {
|
|
364
|
+
var t = new Float64Array([-0]), o = new Uint8Array(t.buffer), v = o[7] === 128;
|
|
365
|
+
function N(L, Z, K) {
|
|
366
|
+
t[0] = L, Z[K] = o[0], Z[K + 1] = o[1], Z[K + 2] = o[2], Z[K + 3] = o[3], Z[K + 4] = o[4], Z[K + 5] = o[5], Z[K + 6] = o[6], Z[K + 7] = o[7];
|
|
649
367
|
}
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
return u.apply(null, q);
|
|
653
|
-
}, h = [
|
|
654
|
-
"v",
|
|
655
|
-
"o",
|
|
656
|
-
"s",
|
|
657
|
-
"i",
|
|
658
|
-
"u",
|
|
659
|
-
"e",
|
|
660
|
-
"p",
|
|
661
|
-
"c",
|
|
662
|
-
"b",
|
|
663
|
-
"t",
|
|
664
|
-
"r",
|
|
665
|
-
"z",
|
|
666
|
-
"a"
|
|
667
|
-
], k = ["i", "c", "b", "a"];
|
|
668
|
-
return writer$1 = function(t, o) {
|
|
669
|
-
o = o || {}, t.version == null && (t.version = 0), t.name == null && (t.name = " "), t.media.forEach(function(U) {
|
|
670
|
-
U.payloads == null && (U.payloads = "");
|
|
671
|
-
});
|
|
672
|
-
var v = o.outerOrder || h, N = o.innerOrder || k, q = [];
|
|
673
|
-
return v.forEach(function(U) {
|
|
674
|
-
s[U].forEach(function(D) {
|
|
675
|
-
D.name in t && t[D.name] != null ? q.push(A(U, D, t)) : D.push in t && t[D.push] != null && t[D.push].forEach(function(L) {
|
|
676
|
-
q.push(A(U, D, L));
|
|
677
|
-
});
|
|
678
|
-
});
|
|
679
|
-
}), t.media.forEach(function(U) {
|
|
680
|
-
q.push(A("m", s.m[0], U)), N.forEach(function(D) {
|
|
681
|
-
s[D].forEach(function(L) {
|
|
682
|
-
L.name in U && U[L.name] != null ? q.push(A(D, L, U)) : L.push in U && U[L.push] != null && U[L.push].forEach(function(Z) {
|
|
683
|
-
q.push(A(D, L, Z));
|
|
684
|
-
});
|
|
685
|
-
});
|
|
686
|
-
});
|
|
687
|
-
}), q.join(`\r
|
|
688
|
-
`) + `\r
|
|
689
|
-
`;
|
|
690
|
-
}, writer$1;
|
|
691
|
-
}
|
|
692
|
-
var hasRequiredLib;
|
|
693
|
-
function requireLib() {
|
|
694
|
-
if (hasRequiredLib) return lib;
|
|
695
|
-
hasRequiredLib = 1;
|
|
696
|
-
var s = requireParser(), $ = requireWriter$1(), u = requireGrammar();
|
|
697
|
-
return lib.grammar = u, lib.write = $, lib.parse = s.parse, lib.parseParams = s.parseParams, lib.parseFmtpConfig = s.parseFmtpConfig, lib.parsePayloads = s.parsePayloads, lib.parseRemoteCandidates = s.parseRemoteCandidates, lib.parseImageAttributes = s.parseImageAttributes, lib.parseSimulcastStreamList = s.parseSimulcastStreamList, lib;
|
|
698
|
-
}
|
|
699
|
-
var libExports = requireLib();
|
|
700
|
-
const enum_mediaType = {
|
|
701
|
-
microphoneCamera_audio: "麦克风-默认轨道",
|
|
702
|
-
microphoneCamera_video: "摄像头-默认轨道",
|
|
703
|
-
screenSharing_video: "屏幕共享-视频轨道",
|
|
704
|
-
screenSharing_audio: "屏幕共享-音频轨道"
|
|
705
|
-
};
|
|
706
|
-
at(enum_mediaType);
|
|
707
|
-
const mediaType_keys = Object.keys(enum_mediaType), enum_roomState = {
|
|
708
|
-
ready: "已就绪",
|
|
709
|
-
checkAuth: "正在鉴权",
|
|
710
|
-
connect: "连接中",
|
|
711
|
-
connected: "已连接",
|
|
712
|
-
reconnect: "正在重新连接",
|
|
713
|
-
disconnected: "已断开"
|
|
714
|
-
};
|
|
715
|
-
at(enum_roomState);
|
|
716
|
-
var S = Object.defineProperty, C = (s) => {
|
|
717
|
-
throw TypeError(s);
|
|
718
|
-
}, M = (s, $, u) => $ in s ? S(s, $, { enumerable: !0, configurable: !0, writable: !0, value: u }) : s[$] = u, p = (s, $, u) => M(s, typeof $ != "symbol" ? $ + "" : $, u), I = (s, $, u) => $.has(s) || C("Cannot " + u), e = (s, $, u) => (I(s, $, "read from private field"), u ? u.call(s) : $.get(s)), i = (s, $, u) => $.has(s) ? C("Cannot add the same private member more than once") : $ instanceof WeakSet ? $.add(s) : $.set(s, u), r = (s, $, u, A) => (I(s, $, "write to private field"), $.set(s, u), u), n, c, a, l, m, d, f, x, w, b, B, y, T, R, g;
|
|
719
|
-
class _ {
|
|
720
|
-
// 初始化成功的回调
|
|
721
|
-
constructor($) {
|
|
722
|
-
i(this, n, {
|
|
723
|
-
url: "",
|
|
724
|
-
binaryType: "blob",
|
|
725
|
-
timeout: 6 * 1e3,
|
|
726
|
-
debug: !1,
|
|
727
|
-
sendBeforAutoConnect: !1,
|
|
728
|
-
reconnectCount: -1,
|
|
729
|
-
reconnectTime: 60 * 1e3,
|
|
730
|
-
reconnectIntervalTime: 5e3,
|
|
731
|
-
heartbeatIntervalTime: 1e4,
|
|
732
|
-
checkReconnect: (u) => !0,
|
|
733
|
-
onReconnectSuccess: async (u) => {
|
|
734
|
-
},
|
|
735
|
-
onReconnectStop: async (u) => {
|
|
736
|
-
},
|
|
737
|
-
getHeartbeatMsg: () => JSON.stringify({ event: "heartbeat" }),
|
|
738
|
-
onMessage: (u) => {
|
|
368
|
+
function q(L, Z, K) {
|
|
369
|
+
t[0] = L, Z[K] = o[7], Z[K + 1] = o[6], Z[K + 2] = o[5], Z[K + 3] = o[4], Z[K + 4] = o[3], Z[K + 5] = o[2], Z[K + 6] = o[1], Z[K + 7] = o[0];
|
|
739
370
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}), i(this, b, (u) => {
|
|
768
|
-
const { data: A } = u;
|
|
769
|
-
e(this, n).onMessage(A);
|
|
770
|
-
}), i(this, B, () => {
|
|
771
|
-
e(this, n).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", "------->pr-ws: connect is success.", e(this, c)), r(this, a, e(this, n).reconnectCount), r(this, l, -1), e(this, R).call(this), e(this, x).call(this, e(this, c));
|
|
772
|
-
}), i(this, y, (u) => {
|
|
773
|
-
e(this, n).debug && console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", "------->pr-ws: connect is error.", u);
|
|
774
|
-
}), i(this, T, (u) => {
|
|
775
|
-
if (e(this, n).debug && console.info("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;padding:16px 0;", `------->pr-ws: connect is close. code: ${u.code}, permanentClosed is ${e(this, f)}.`, u), e(this, g).call(this), !e(this, f) && u.code !== 1e3)
|
|
776
|
-
return this.reconnect(u);
|
|
777
|
-
r(this, c, void 0);
|
|
778
|
-
}), i(this, R, () => {
|
|
779
|
-
r(this, d, setInterval(() => {
|
|
780
|
-
const u = e(this, n).getHeartbeatMsg();
|
|
781
|
-
u && this.sendMessage(u);
|
|
782
|
-
}, e(this, n).heartbeatIntervalTime));
|
|
783
|
-
}), i(this, g, () => {
|
|
784
|
-
clearInterval(e(this, m)), clearInterval(e(this, d));
|
|
785
|
-
}), r(this, n, { ...e(this, n), ...$ }), r(this, a, e(this, n).reconnectCount);
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
n = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap();
|
|
789
|
-
var indexMinimal = {}, minimal$1 = {}, aspromise, hasRequiredAspromise;
|
|
790
|
-
function requireAspromise() {
|
|
791
|
-
if (hasRequiredAspromise) return aspromise;
|
|
792
|
-
hasRequiredAspromise = 1, aspromise = s;
|
|
793
|
-
function s($, u) {
|
|
794
|
-
for (var A = new Array(arguments.length - 1), h = 0, k = 2, t = !0; k < arguments.length; )
|
|
795
|
-
A[h++] = arguments[k++];
|
|
796
|
-
return new Promise(function(v, N) {
|
|
797
|
-
A[h] = function(U) {
|
|
798
|
-
if (t)
|
|
799
|
-
if (t = !1, U)
|
|
800
|
-
N(U);
|
|
371
|
+
k.writeDoubleLE = v ? N : q, k.writeDoubleBE = v ? q : N;
|
|
372
|
+
function U(L, Z) {
|
|
373
|
+
return o[0] = L[Z], o[1] = L[Z + 1], o[2] = L[Z + 2], o[3] = L[Z + 3], o[4] = L[Z + 4], o[5] = L[Z + 5], o[6] = L[Z + 6], o[7] = L[Z + 7], t[0];
|
|
374
|
+
}
|
|
375
|
+
function D(L, Z) {
|
|
376
|
+
return o[7] = L[Z], o[6] = L[Z + 1], o[5] = L[Z + 2], o[4] = L[Z + 3], o[3] = L[Z + 4], o[2] = L[Z + 5], o[1] = L[Z + 6], o[0] = L[Z + 7], t[0];
|
|
377
|
+
}
|
|
378
|
+
k.readDoubleLE = v ? U : D, k.readDoubleBE = v ? D : U;
|
|
379
|
+
}() : function() {
|
|
380
|
+
function t(v, N, q, U, D, L) {
|
|
381
|
+
var Z = U < 0 ? 1 : 0;
|
|
382
|
+
if (Z && (U = -U), U === 0)
|
|
383
|
+
v(0, D, L + N), v(1 / U > 0 ? (
|
|
384
|
+
/* positive */
|
|
385
|
+
0
|
|
386
|
+
) : (
|
|
387
|
+
/* negative 0 */
|
|
388
|
+
2147483648
|
|
389
|
+
), D, L + q);
|
|
390
|
+
else if (isNaN(U))
|
|
391
|
+
v(0, D, L + N), v(2146959360, D, L + q);
|
|
392
|
+
else if (U > 17976931348623157e292)
|
|
393
|
+
v(0, D, L + N), v((Z << 31 | 2146435072) >>> 0, D, L + q);
|
|
394
|
+
else {
|
|
395
|
+
var K;
|
|
396
|
+
if (U < 22250738585072014e-324)
|
|
397
|
+
K = U / 5e-324, v(K >>> 0, D, L + N), v((Z << 31 | K / 4294967296) >>> 0, D, L + q);
|
|
801
398
|
else {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
v.apply(null, D);
|
|
399
|
+
var H = Math.floor(Math.log(U) / Math.LN2);
|
|
400
|
+
H === 1024 && (H = 1023), K = U * Math.pow(2, -H), v(K * 4503599627370496 >>> 0, D, L + N), v((Z << 31 | H + 1023 << 20 | K * 1048576 & 1048575) >>> 0, D, L + q);
|
|
805
401
|
}
|
|
806
|
-
|
|
807
|
-
try {
|
|
808
|
-
$.apply(u || null, A);
|
|
809
|
-
} catch (q) {
|
|
810
|
-
t && (t = !1, N(q));
|
|
402
|
+
}
|
|
811
403
|
}
|
|
812
|
-
|
|
404
|
+
k.writeDoubleLE = t.bind(null, $, 0, 4), k.writeDoubleBE = t.bind(null, u, 4, 0);
|
|
405
|
+
function o(v, N, q, U, D) {
|
|
406
|
+
var L = v(U, D + N), Z = v(U, D + q), K = (Z >> 31) * 2 + 1, H = Z >>> 20 & 2047, F = 4294967296 * (Z & 1048575) + L;
|
|
407
|
+
return H === 2047 ? F ? NaN : K * (1 / 0) : H === 0 ? K * 5e-324 * F : K * Math.pow(2, H - 1075) * (F + 4503599627370496);
|
|
408
|
+
}
|
|
409
|
+
k.readDoubleLE = o.bind(null, A, 0, 4), k.readDoubleBE = o.bind(null, h, 4, 0);
|
|
410
|
+
}(), k;
|
|
813
411
|
}
|
|
814
|
-
|
|
412
|
+
function $(k, t, o) {
|
|
413
|
+
t[o] = k & 255, t[o + 1] = k >>> 8 & 255, t[o + 2] = k >>> 16 & 255, t[o + 3] = k >>> 24;
|
|
414
|
+
}
|
|
415
|
+
function u(k, t, o) {
|
|
416
|
+
t[o] = k >>> 24, t[o + 1] = k >>> 16 & 255, t[o + 2] = k >>> 8 & 255, t[o + 3] = k & 255;
|
|
417
|
+
}
|
|
418
|
+
function A(k, t) {
|
|
419
|
+
return (k[t] | k[t + 1] << 8 | k[t + 2] << 16 | k[t + 3] << 24) >>> 0;
|
|
420
|
+
}
|
|
421
|
+
function h(k, t) {
|
|
422
|
+
return (k[t] << 24 | k[t + 1] << 16 | k[t + 2] << 8 | k[t + 3]) >>> 0;
|
|
423
|
+
}
|
|
424
|
+
return float;
|
|
815
425
|
}
|
|
816
|
-
var
|
|
817
|
-
function
|
|
818
|
-
|
|
426
|
+
var inquire_1, hasRequiredInquire;
|
|
427
|
+
function requireInquire() {
|
|
428
|
+
if (hasRequiredInquire) return inquire_1;
|
|
429
|
+
hasRequiredInquire = 1, inquire_1 = inquire;
|
|
430
|
+
function inquire(moduleName) {
|
|
431
|
+
try {
|
|
432
|
+
var mod = eval("quire".replace(/^/, "re"))(moduleName);
|
|
433
|
+
if (mod && (mod.length || Object.keys(mod).length))
|
|
434
|
+
return mod;
|
|
435
|
+
} catch (s) {
|
|
436
|
+
}
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
return inquire_1;
|
|
440
|
+
}
|
|
441
|
+
var utf8 = {}, hasRequiredUtf8;
|
|
442
|
+
function requireUtf8() {
|
|
443
|
+
return hasRequiredUtf8 || (hasRequiredUtf8 = 1, function(s) {
|
|
819
444
|
var $ = s;
|
|
820
|
-
$.length = function(
|
|
821
|
-
var
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
U[D++] = u[W >> 2], Z = (W & 3) << 4, L = 1;
|
|
836
|
-
break;
|
|
837
|
-
case 1:
|
|
838
|
-
U[D++] = u[Z | W >> 4], Z = (W & 15) << 2, L = 2;
|
|
839
|
-
break;
|
|
840
|
-
case 2:
|
|
841
|
-
U[D++] = u[Z | W >> 6], U[D++] = u[W & 63], L = 0;
|
|
842
|
-
break;
|
|
843
|
-
}
|
|
844
|
-
D > 8191 && ((q || (q = [])).push(String.fromCharCode.apply(String, U)), D = 0);
|
|
845
|
-
}
|
|
846
|
-
return L && (U[D++] = u[Z], U[D++] = 61, L === 1 && (U[D++] = 61)), q ? (D && q.push(String.fromCharCode.apply(String, U.slice(0, D))), q.join("")) : String.fromCharCode.apply(String, U.slice(0, D));
|
|
847
|
-
};
|
|
848
|
-
var k = "invalid encoding";
|
|
849
|
-
$.decode = function(o, v, N) {
|
|
850
|
-
for (var q = N, U = 0, D, L = 0; L < o.length; ) {
|
|
851
|
-
var Z = o.charCodeAt(L++);
|
|
852
|
-
if (Z === 61 && U > 1)
|
|
853
|
-
break;
|
|
854
|
-
if ((Z = A[Z]) === void 0)
|
|
855
|
-
throw Error(k);
|
|
856
|
-
switch (U) {
|
|
857
|
-
case 0:
|
|
858
|
-
D = Z, U = 1;
|
|
859
|
-
break;
|
|
860
|
-
case 1:
|
|
861
|
-
v[N++] = D << 2 | (Z & 48) >> 4, D = Z, U = 2;
|
|
862
|
-
break;
|
|
863
|
-
case 2:
|
|
864
|
-
v[N++] = (D & 15) << 4 | (Z & 60) >> 2, D = Z, U = 3;
|
|
865
|
-
break;
|
|
866
|
-
case 3:
|
|
867
|
-
v[N++] = (D & 3) << 6 | Z, U = 0;
|
|
868
|
-
break;
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
if (U === 1)
|
|
872
|
-
throw Error(k);
|
|
873
|
-
return N - q;
|
|
874
|
-
}, $.test = function(o) {
|
|
875
|
-
return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(o);
|
|
876
|
-
};
|
|
877
|
-
}(base64)), base64;
|
|
878
|
-
}
|
|
879
|
-
var eventemitter, hasRequiredEventemitter;
|
|
880
|
-
function requireEventemitter() {
|
|
881
|
-
if (hasRequiredEventemitter) return eventemitter;
|
|
882
|
-
hasRequiredEventemitter = 1, eventemitter = s;
|
|
883
|
-
function s() {
|
|
884
|
-
this._listeners = {};
|
|
885
|
-
}
|
|
886
|
-
return s.prototype.on = function(u, A, h) {
|
|
887
|
-
return (this._listeners[u] || (this._listeners[u] = [])).push({
|
|
888
|
-
fn: A,
|
|
889
|
-
ctx: h || this
|
|
890
|
-
}), this;
|
|
891
|
-
}, s.prototype.off = function(u, A) {
|
|
892
|
-
if (u === void 0)
|
|
893
|
-
this._listeners = {};
|
|
894
|
-
else if (A === void 0)
|
|
895
|
-
this._listeners[u] = [];
|
|
896
|
-
else
|
|
897
|
-
for (var h = this._listeners[u], k = 0; k < h.length; )
|
|
898
|
-
h[k].fn === A ? h.splice(k, 1) : ++k;
|
|
899
|
-
return this;
|
|
900
|
-
}, s.prototype.emit = function(u) {
|
|
901
|
-
var A = this._listeners[u];
|
|
902
|
-
if (A) {
|
|
903
|
-
for (var h = [], k = 1; k < arguments.length; )
|
|
904
|
-
h.push(arguments[k++]);
|
|
905
|
-
for (k = 0; k < A.length; )
|
|
906
|
-
A[k].fn.apply(A[k++].ctx, h);
|
|
907
|
-
}
|
|
908
|
-
return this;
|
|
909
|
-
}, eventemitter;
|
|
910
|
-
}
|
|
911
|
-
var float, hasRequiredFloat;
|
|
912
|
-
function requireFloat() {
|
|
913
|
-
if (hasRequiredFloat) return float;
|
|
914
|
-
hasRequiredFloat = 1, float = s(s);
|
|
915
|
-
function s(k) {
|
|
916
|
-
return typeof Float32Array < "u" ? function() {
|
|
917
|
-
var t = new Float32Array([-0]), o = new Uint8Array(t.buffer), v = o[3] === 128;
|
|
918
|
-
function N(L, Z, W) {
|
|
919
|
-
t[0] = L, Z[W] = o[0], Z[W + 1] = o[1], Z[W + 2] = o[2], Z[W + 3] = o[3];
|
|
920
|
-
}
|
|
921
|
-
function q(L, Z, W) {
|
|
922
|
-
t[0] = L, Z[W] = o[3], Z[W + 1] = o[2], Z[W + 2] = o[1], Z[W + 3] = o[0];
|
|
923
|
-
}
|
|
924
|
-
k.writeFloatLE = v ? N : q, k.writeFloatBE = v ? q : N;
|
|
925
|
-
function U(L, Z) {
|
|
926
|
-
return o[0] = L[Z], o[1] = L[Z + 1], o[2] = L[Z + 2], o[3] = L[Z + 3], t[0];
|
|
927
|
-
}
|
|
928
|
-
function D(L, Z) {
|
|
929
|
-
return o[3] = L[Z], o[2] = L[Z + 1], o[1] = L[Z + 2], o[0] = L[Z + 3], t[0];
|
|
930
|
-
}
|
|
931
|
-
k.readFloatLE = v ? U : D, k.readFloatBE = v ? D : U;
|
|
932
|
-
}() : function() {
|
|
933
|
-
function t(v, N, q, U) {
|
|
934
|
-
var D = N < 0 ? 1 : 0;
|
|
935
|
-
if (D && (N = -N), N === 0)
|
|
936
|
-
v(1 / N > 0 ? (
|
|
937
|
-
/* positive */
|
|
938
|
-
0
|
|
939
|
-
) : (
|
|
940
|
-
/* negative 0 */
|
|
941
|
-
2147483648
|
|
942
|
-
), q, U);
|
|
943
|
-
else if (isNaN(N))
|
|
944
|
-
v(2143289344, q, U);
|
|
945
|
-
else if (N > 34028234663852886e22)
|
|
946
|
-
v((D << 31 | 2139095040) >>> 0, q, U);
|
|
947
|
-
else if (N < 11754943508222875e-54)
|
|
948
|
-
v((D << 31 | Math.round(N / 1401298464324817e-60)) >>> 0, q, U);
|
|
949
|
-
else {
|
|
950
|
-
var L = Math.floor(Math.log(N) / Math.LN2), Z = Math.round(N * Math.pow(2, -L) * 8388608) & 8388607;
|
|
951
|
-
v((D << 31 | L + 127 << 23 | Z) >>> 0, q, U);
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
k.writeFloatLE = t.bind(null, $), k.writeFloatBE = t.bind(null, u);
|
|
955
|
-
function o(v, N, q) {
|
|
956
|
-
var U = v(N, q), D = (U >> 31) * 2 + 1, L = U >>> 23 & 255, Z = U & 8388607;
|
|
957
|
-
return L === 255 ? Z ? NaN : D * (1 / 0) : L === 0 ? D * 1401298464324817e-60 * Z : D * Math.pow(2, L - 150) * (Z + 8388608);
|
|
958
|
-
}
|
|
959
|
-
k.readFloatLE = o.bind(null, A), k.readFloatBE = o.bind(null, h);
|
|
960
|
-
}(), typeof Float64Array < "u" ? function() {
|
|
961
|
-
var t = new Float64Array([-0]), o = new Uint8Array(t.buffer), v = o[7] === 128;
|
|
962
|
-
function N(L, Z, W) {
|
|
963
|
-
t[0] = L, Z[W] = o[0], Z[W + 1] = o[1], Z[W + 2] = o[2], Z[W + 3] = o[3], Z[W + 4] = o[4], Z[W + 5] = o[5], Z[W + 6] = o[6], Z[W + 7] = o[7];
|
|
964
|
-
}
|
|
965
|
-
function q(L, Z, W) {
|
|
966
|
-
t[0] = L, Z[W] = o[7], Z[W + 1] = o[6], Z[W + 2] = o[5], Z[W + 3] = o[4], Z[W + 4] = o[3], Z[W + 5] = o[2], Z[W + 6] = o[1], Z[W + 7] = o[0];
|
|
967
|
-
}
|
|
968
|
-
k.writeDoubleLE = v ? N : q, k.writeDoubleBE = v ? q : N;
|
|
969
|
-
function U(L, Z) {
|
|
970
|
-
return o[0] = L[Z], o[1] = L[Z + 1], o[2] = L[Z + 2], o[3] = L[Z + 3], o[4] = L[Z + 4], o[5] = L[Z + 5], o[6] = L[Z + 6], o[7] = L[Z + 7], t[0];
|
|
971
|
-
}
|
|
972
|
-
function D(L, Z) {
|
|
973
|
-
return o[7] = L[Z], o[6] = L[Z + 1], o[5] = L[Z + 2], o[4] = L[Z + 3], o[3] = L[Z + 4], o[2] = L[Z + 5], o[1] = L[Z + 6], o[0] = L[Z + 7], t[0];
|
|
974
|
-
}
|
|
975
|
-
k.readDoubleLE = v ? U : D, k.readDoubleBE = v ? D : U;
|
|
976
|
-
}() : function() {
|
|
977
|
-
function t(v, N, q, U, D, L) {
|
|
978
|
-
var Z = U < 0 ? 1 : 0;
|
|
979
|
-
if (Z && (U = -U), U === 0)
|
|
980
|
-
v(0, D, L + N), v(1 / U > 0 ? (
|
|
981
|
-
/* positive */
|
|
982
|
-
0
|
|
983
|
-
) : (
|
|
984
|
-
/* negative 0 */
|
|
985
|
-
2147483648
|
|
986
|
-
), D, L + q);
|
|
987
|
-
else if (isNaN(U))
|
|
988
|
-
v(0, D, L + N), v(2146959360, D, L + q);
|
|
989
|
-
else if (U > 17976931348623157e292)
|
|
990
|
-
v(0, D, L + N), v((Z << 31 | 2146435072) >>> 0, D, L + q);
|
|
991
|
-
else {
|
|
992
|
-
var W;
|
|
993
|
-
if (U < 22250738585072014e-324)
|
|
994
|
-
W = U / 5e-324, v(W >>> 0, D, L + N), v((Z << 31 | W / 4294967296) >>> 0, D, L + q);
|
|
995
|
-
else {
|
|
996
|
-
var H = Math.floor(Math.log(U) / Math.LN2);
|
|
997
|
-
H === 1024 && (H = 1023), W = U * Math.pow(2, -H), v(W * 4503599627370496 >>> 0, D, L + N), v((Z << 31 | H + 1023 << 20 | W * 1048576 & 1048575) >>> 0, D, L + q);
|
|
998
|
-
}
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
k.writeDoubleLE = t.bind(null, $, 0, 4), k.writeDoubleBE = t.bind(null, u, 4, 0);
|
|
1002
|
-
function o(v, N, q, U, D) {
|
|
1003
|
-
var L = v(U, D + N), Z = v(U, D + q), W = (Z >> 31) * 2 + 1, H = Z >>> 20 & 2047, F = 4294967296 * (Z & 1048575) + L;
|
|
1004
|
-
return H === 2047 ? F ? NaN : W * (1 / 0) : H === 0 ? W * 5e-324 * F : W * Math.pow(2, H - 1075) * (F + 4503599627370496);
|
|
1005
|
-
}
|
|
1006
|
-
k.readDoubleLE = o.bind(null, A, 0, 4), k.readDoubleBE = o.bind(null, h, 4, 0);
|
|
1007
|
-
}(), k;
|
|
1008
|
-
}
|
|
1009
|
-
function $(k, t, o) {
|
|
1010
|
-
t[o] = k & 255, t[o + 1] = k >>> 8 & 255, t[o + 2] = k >>> 16 & 255, t[o + 3] = k >>> 24;
|
|
1011
|
-
}
|
|
1012
|
-
function u(k, t, o) {
|
|
1013
|
-
t[o] = k >>> 24, t[o + 1] = k >>> 16 & 255, t[o + 2] = k >>> 8 & 255, t[o + 3] = k & 255;
|
|
1014
|
-
}
|
|
1015
|
-
function A(k, t) {
|
|
1016
|
-
return (k[t] | k[t + 1] << 8 | k[t + 2] << 16 | k[t + 3] << 24) >>> 0;
|
|
1017
|
-
}
|
|
1018
|
-
function h(k, t) {
|
|
1019
|
-
return (k[t] << 24 | k[t + 1] << 16 | k[t + 2] << 8 | k[t + 3]) >>> 0;
|
|
1020
|
-
}
|
|
1021
|
-
return float;
|
|
1022
|
-
}
|
|
1023
|
-
var inquire_1, hasRequiredInquire;
|
|
1024
|
-
function requireInquire() {
|
|
1025
|
-
if (hasRequiredInquire) return inquire_1;
|
|
1026
|
-
hasRequiredInquire = 1, inquire_1 = inquire;
|
|
1027
|
-
function inquire(moduleName) {
|
|
1028
|
-
try {
|
|
1029
|
-
var mod = eval("quire".replace(/^/, "re"))(moduleName);
|
|
1030
|
-
if (mod && (mod.length || Object.keys(mod).length))
|
|
1031
|
-
return mod;
|
|
1032
|
-
} catch (s) {
|
|
1033
|
-
}
|
|
1034
|
-
return null;
|
|
1035
|
-
}
|
|
1036
|
-
return inquire_1;
|
|
1037
|
-
}
|
|
1038
|
-
var utf8 = {}, hasRequiredUtf8;
|
|
1039
|
-
function requireUtf8() {
|
|
1040
|
-
return hasRequiredUtf8 || (hasRequiredUtf8 = 1, function(s) {
|
|
1041
|
-
var $ = s;
|
|
1042
|
-
$.length = function(A) {
|
|
1043
|
-
for (var h = 0, k = 0, t = 0; t < A.length; ++t)
|
|
1044
|
-
k = A.charCodeAt(t), k < 128 ? h += 1 : k < 2048 ? h += 2 : (k & 64512) === 55296 && (A.charCodeAt(t + 1) & 64512) === 56320 ? (++t, h += 4) : h += 3;
|
|
1045
|
-
return h;
|
|
1046
|
-
}, $.read = function(A, h, k) {
|
|
1047
|
-
var t = k - h;
|
|
1048
|
-
if (t < 1)
|
|
1049
|
-
return "";
|
|
1050
|
-
for (var o = null, v = [], N = 0, q; h < k; )
|
|
1051
|
-
q = A[h++], q < 128 ? v[N++] = q : q > 191 && q < 224 ? v[N++] = (q & 31) << 6 | A[h++] & 63 : q > 239 && q < 365 ? (q = ((q & 7) << 18 | (A[h++] & 63) << 12 | (A[h++] & 63) << 6 | A[h++] & 63) - 65536, v[N++] = 55296 + (q >> 10), v[N++] = 56320 + (q & 1023)) : v[N++] = (q & 15) << 12 | (A[h++] & 63) << 6 | A[h++] & 63, N > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, v)), N = 0);
|
|
1052
|
-
return o ? (N && o.push(String.fromCharCode.apply(String, v.slice(0, N))), o.join("")) : String.fromCharCode.apply(String, v.slice(0, N));
|
|
1053
|
-
}, $.write = function(A, h, k) {
|
|
1054
|
-
for (var t = k, o, v, N = 0; N < A.length; ++N)
|
|
1055
|
-
o = A.charCodeAt(N), o < 128 ? h[k++] = o : o < 2048 ? (h[k++] = o >> 6 | 192, h[k++] = o & 63 | 128) : (o & 64512) === 55296 && ((v = A.charCodeAt(N + 1)) & 64512) === 56320 ? (o = 65536 + ((o & 1023) << 10) + (v & 1023), ++N, h[k++] = o >> 18 | 240, h[k++] = o >> 12 & 63 | 128, h[k++] = o >> 6 & 63 | 128, h[k++] = o & 63 | 128) : (h[k++] = o >> 12 | 224, h[k++] = o >> 6 & 63 | 128, h[k++] = o & 63 | 128);
|
|
1056
|
-
return k - t;
|
|
445
|
+
$.length = function(A) {
|
|
446
|
+
for (var h = 0, k = 0, t = 0; t < A.length; ++t)
|
|
447
|
+
k = A.charCodeAt(t), k < 128 ? h += 1 : k < 2048 ? h += 2 : (k & 64512) === 55296 && (A.charCodeAt(t + 1) & 64512) === 56320 ? (++t, h += 4) : h += 3;
|
|
448
|
+
return h;
|
|
449
|
+
}, $.read = function(A, h, k) {
|
|
450
|
+
var t = k - h;
|
|
451
|
+
if (t < 1)
|
|
452
|
+
return "";
|
|
453
|
+
for (var o = null, v = [], N = 0, q; h < k; )
|
|
454
|
+
q = A[h++], q < 128 ? v[N++] = q : q > 191 && q < 224 ? v[N++] = (q & 31) << 6 | A[h++] & 63 : q > 239 && q < 365 ? (q = ((q & 7) << 18 | (A[h++] & 63) << 12 | (A[h++] & 63) << 6 | A[h++] & 63) - 65536, v[N++] = 55296 + (q >> 10), v[N++] = 56320 + (q & 1023)) : v[N++] = (q & 15) << 12 | (A[h++] & 63) << 6 | A[h++] & 63, N > 8191 && ((o || (o = [])).push(String.fromCharCode.apply(String, v)), N = 0);
|
|
455
|
+
return o ? (N && o.push(String.fromCharCode.apply(String, v.slice(0, N))), o.join("")) : String.fromCharCode.apply(String, v.slice(0, N));
|
|
456
|
+
}, $.write = function(A, h, k) {
|
|
457
|
+
for (var t = k, o, v, N = 0; N < A.length; ++N)
|
|
458
|
+
o = A.charCodeAt(N), o < 128 ? h[k++] = o : o < 2048 ? (h[k++] = o >> 6 | 192, h[k++] = o & 63 | 128) : (o & 64512) === 55296 && ((v = A.charCodeAt(N + 1)) & 64512) === 56320 ? (o = 65536 + ((o & 1023) << 10) + (v & 1023), ++N, h[k++] = o >> 18 | 240, h[k++] = o >> 12 & 63 | 128, h[k++] = o >> 6 & 63 | 128, h[k++] = o & 63 | 128) : (h[k++] = o >> 12 | 224, h[k++] = o >> 6 & 63 | 128, h[k++] = o & 63 | 128);
|
|
459
|
+
return k - t;
|
|
1057
460
|
};
|
|
1058
461
|
}(utf8)), utf8;
|
|
1059
462
|
}
|
|
@@ -1269,10 +672,10 @@ function requireMinimal$1() {
|
|
|
1269
672
|
};
|
|
1270
673
|
}(minimal$1)), minimal$1;
|
|
1271
674
|
}
|
|
1272
|
-
var writer, hasRequiredWriter;
|
|
1273
|
-
function requireWriter() {
|
|
1274
|
-
if (hasRequiredWriter) return writer;
|
|
1275
|
-
hasRequiredWriter = 1, writer = v;
|
|
675
|
+
var writer$1, hasRequiredWriter$1;
|
|
676
|
+
function requireWriter$1() {
|
|
677
|
+
if (hasRequiredWriter$1) return writer$1;
|
|
678
|
+
hasRequiredWriter$1 = 1, writer$1 = v;
|
|
1276
679
|
var s = requireMinimal$1(), $, u = s.LongBits, A = s.base64, h = s.utf8;
|
|
1277
680
|
function k(H, F, z) {
|
|
1278
681
|
this.fn = H, this.len = F, this.next = void 0, this.val = z;
|
|
@@ -1349,7 +752,7 @@ function requireWriter() {
|
|
|
1349
752
|
}, v.prototype.double = function(F) {
|
|
1350
753
|
return this._push(s.float.writeDoubleLE, 8, F);
|
|
1351
754
|
};
|
|
1352
|
-
var
|
|
755
|
+
var K = s.Array.prototype.set ? function(F, z, V) {
|
|
1353
756
|
z.set(F, V);
|
|
1354
757
|
} : function(F, z, V) {
|
|
1355
758
|
for (var J = 0; J < F.length; ++J)
|
|
@@ -1363,7 +766,7 @@ function requireWriter() {
|
|
|
1363
766
|
var V = v.alloc(z = A.length(F));
|
|
1364
767
|
A.decode(F, V, 0), F = V;
|
|
1365
768
|
}
|
|
1366
|
-
return this.uint32(z)._push(
|
|
769
|
+
return this.uint32(z)._push(K, z, F);
|
|
1367
770
|
}, v.prototype.string = function(F) {
|
|
1368
771
|
var z = h.length(F);
|
|
1369
772
|
return z ? this.uint32(z)._push(h.write, z, F) : this._push(q, 1, 0);
|
|
@@ -1380,13 +783,13 @@ function requireWriter() {
|
|
|
1380
783
|
return z;
|
|
1381
784
|
}, v._configure = function(H) {
|
|
1382
785
|
$ = H, v.create = N(), $._configure();
|
|
1383
|
-
}, writer;
|
|
786
|
+
}, writer$1;
|
|
1384
787
|
}
|
|
1385
788
|
var writer_buffer, hasRequiredWriter_buffer;
|
|
1386
789
|
function requireWriter_buffer() {
|
|
1387
790
|
if (hasRequiredWriter_buffer) return writer_buffer;
|
|
1388
791
|
hasRequiredWriter_buffer = 1, writer_buffer = u;
|
|
1389
|
-
var s = requireWriter();
|
|
792
|
+
var s = requireWriter$1();
|
|
1390
793
|
(u.prototype = Object.create(s.prototype)).constructor = u;
|
|
1391
794
|
var $ = requireMinimal$1();
|
|
1392
795
|
function u() {
|
|
@@ -1435,8 +838,8 @@ function requireReader() {
|
|
|
1435
838
|
throw Error("illegal buffer");
|
|
1436
839
|
}, o = function() {
|
|
1437
840
|
return s.Buffer ? function(L) {
|
|
1438
|
-
return (k.create = function(
|
|
1439
|
-
return s.Buffer.isBuffer(
|
|
841
|
+
return (k.create = function(K) {
|
|
842
|
+
return s.Buffer.isBuffer(K) ? new $(K) : t(K);
|
|
1440
843
|
})(L);
|
|
1441
844
|
} : t;
|
|
1442
845
|
};
|
|
@@ -1523,8 +926,8 @@ function requireReader() {
|
|
|
1523
926
|
if (this.pos += D, Array.isArray(this.buf))
|
|
1524
927
|
return this.buf.slice(L, Z);
|
|
1525
928
|
if (L === Z) {
|
|
1526
|
-
var
|
|
1527
|
-
return
|
|
929
|
+
var K = s.Buffer;
|
|
930
|
+
return K ? K.alloc(0) : new this.buf.constructor(0);
|
|
1528
931
|
}
|
|
1529
932
|
return this._slice.call(this.buf, L, Z);
|
|
1530
933
|
}, k.prototype.string = function() {
|
|
@@ -1677,7 +1080,7 @@ var hasRequiredIndexMinimal;
|
|
|
1677
1080
|
function requireIndexMinimal() {
|
|
1678
1081
|
return hasRequiredIndexMinimal || (hasRequiredIndexMinimal = 1, function(s) {
|
|
1679
1082
|
var $ = s;
|
|
1680
|
-
$.build = "minimal", $.Writer = requireWriter(), $.BufferWriter = requireWriter_buffer(), $.Reader = requireReader(), $.BufferReader = requireReader_buffer(), $.util = requireMinimal$1(), $.rpc = requireRpc(), $.roots = requireRoots(), $.configure = u;
|
|
1083
|
+
$.build = "minimal", $.Writer = requireWriter$1(), $.BufferWriter = requireWriter_buffer(), $.Reader = requireReader(), $.BufferReader = requireReader_buffer(), $.util = requireMinimal$1(), $.rpc = requireRpc(), $.roots = requireRoots(), $.configure = u;
|
|
1681
1084
|
function u() {
|
|
1682
1085
|
$.util._configure(), $.Writer._configure($.BufferWriter), $.Reader._configure($.BufferReader);
|
|
1683
1086
|
}
|
|
@@ -4488,17 +3891,17 @@ const d_code = (s) => s < 256 ? _dist_code[s] : _dist_code[256 + (s >>> 7)], put
|
|
|
4488
3891
|
s.bi_valid === 16 ? (put_short(s, s.bi_buf), s.bi_buf = 0, s.bi_valid = 0) : s.bi_valid >= 8 && (s.pending_buf[s.pending++] = s.bi_buf & 255, s.bi_buf >>= 8, s.bi_valid -= 8);
|
|
4489
3892
|
}, gen_bitlen = (s, $) => {
|
|
4490
3893
|
const u = $.dyn_tree, A = $.max_code, h = $.stat_desc.static_tree, k = $.stat_desc.has_stree, t = $.stat_desc.extra_bits, o = $.stat_desc.extra_base, v = $.stat_desc.max_length;
|
|
4491
|
-
let N, q, U, D, L, Z,
|
|
3894
|
+
let N, q, U, D, L, Z, K = 0;
|
|
4492
3895
|
for (D = 0; D <= MAX_BITS$1; D++)
|
|
4493
3896
|
s.bl_count[D] = 0;
|
|
4494
3897
|
for (u[s.heap[s.heap_max] * 2 + 1] = 0, N = s.heap_max + 1; N < HEAP_SIZE$1; N++)
|
|
4495
|
-
q = s.heap[N], D = u[u[q * 2 + 1] * 2 + 1] + 1, D > v && (D = v,
|
|
4496
|
-
if (
|
|
3898
|
+
q = s.heap[N], D = u[u[q * 2 + 1] * 2 + 1] + 1, D > v && (D = v, K++), u[q * 2 + 1] = D, !(q > A) && (s.bl_count[D]++, L = 0, q >= o && (L = t[q - o]), Z = u[q * 2], s.opt_len += Z * (D + L), k && (s.static_len += Z * (h[q * 2 + 1] + L)));
|
|
3899
|
+
if (K !== 0) {
|
|
4497
3900
|
do {
|
|
4498
3901
|
for (D = v - 1; s.bl_count[D] === 0; )
|
|
4499
3902
|
D--;
|
|
4500
|
-
s.bl_count[D]--, s.bl_count[D + 1] += 2, s.bl_count[v]--,
|
|
4501
|
-
} while (
|
|
3903
|
+
s.bl_count[D]--, s.bl_count[D + 1] += 2, s.bl_count[v]--, K -= 2;
|
|
3904
|
+
} while (K > 0);
|
|
4502
3905
|
for (D = v; D !== 0; D--)
|
|
4503
3906
|
for (q = s.bl_count[D]; q !== 0; )
|
|
4504
3907
|
U = s.heap[--N], !(U > A) && (u[U * 2 + 1] !== D && (s.opt_len += (D - u[U * 2 + 1]) * u[U * 2], u[U * 2 + 1] = D), q--);
|
|
@@ -5284,12 +4687,12 @@ var Deflate_1$1 = Deflate$1, deflate_2 = deflate$1, deflateRaw_1$1 = deflateRaw$
|
|
|
5284
4687
|
};
|
|
5285
4688
|
const BAD$1 = 16209, TYPE$1 = 16191;
|
|
5286
4689
|
var inffast = function s($, u) {
|
|
5287
|
-
let A, h, k, t, o, v, N, q, U, D, L, Z,
|
|
5288
|
-
const
|
|
5289
|
-
A = $.next_in, tt = $.input, h = A + ($.avail_in - 5), k = $.next_out, Q = $.output, t = k - (u - $.avail_out), o = k + ($.avail_out - 257), v =
|
|
4690
|
+
let A, h, k, t, o, v, N, q, U, D, L, Z, K, H, F, z, V, J, X, rt, Y, et, tt, Q;
|
|
4691
|
+
const nt = $.state;
|
|
4692
|
+
A = $.next_in, tt = $.input, h = A + ($.avail_in - 5), k = $.next_out, Q = $.output, t = k - (u - $.avail_out), o = k + ($.avail_out - 257), v = nt.dmax, N = nt.wsize, q = nt.whave, U = nt.wnext, D = nt.window, L = nt.hold, Z = nt.bits, K = nt.lencode, H = nt.distcode, F = (1 << nt.lenbits) - 1, z = (1 << nt.distbits) - 1;
|
|
5290
4693
|
t:
|
|
5291
4694
|
do {
|
|
5292
|
-
Z < 15 && (L += tt[A++] << Z, Z += 8, L += tt[A++] << Z, Z += 8), V =
|
|
4695
|
+
Z < 15 && (L += tt[A++] << Z, Z += 8, L += tt[A++] << Z, Z += 8), V = K[L & F];
|
|
5293
4696
|
e:
|
|
5294
4697
|
for (; ; ) {
|
|
5295
4698
|
if (J = V >>> 24, L >>>= J, Z -= J, J = V >>> 16 & 255, J === 0)
|
|
@@ -5299,22 +4702,22 @@ var inffast = function s($, u) {
|
|
|
5299
4702
|
i:
|
|
5300
4703
|
for (; ; ) {
|
|
5301
4704
|
if (J = V >>> 24, L >>>= J, Z -= J, J = V >>> 16 & 255, J & 16) {
|
|
5302
|
-
if (
|
|
5303
|
-
$.msg = "invalid distance too far back",
|
|
4705
|
+
if (rt = V & 65535, J &= 15, Z < J && (L += tt[A++] << Z, Z += 8, Z < J && (L += tt[A++] << Z, Z += 8)), rt += L & (1 << J) - 1, rt > v) {
|
|
4706
|
+
$.msg = "invalid distance too far back", nt.mode = BAD$1;
|
|
5304
4707
|
break t;
|
|
5305
4708
|
}
|
|
5306
|
-
if (L >>>= J, Z -= J, J = k - t,
|
|
5307
|
-
if (J =
|
|
5308
|
-
$.msg = "invalid distance too far back",
|
|
4709
|
+
if (L >>>= J, Z -= J, J = k - t, rt > J) {
|
|
4710
|
+
if (J = rt - J, J > q && nt.sane) {
|
|
4711
|
+
$.msg = "invalid distance too far back", nt.mode = BAD$1;
|
|
5309
4712
|
break t;
|
|
5310
4713
|
}
|
|
5311
|
-
if (Y = 0,
|
|
4714
|
+
if (Y = 0, et = D, U === 0) {
|
|
5312
4715
|
if (Y += N - J, J < X) {
|
|
5313
4716
|
X -= J;
|
|
5314
4717
|
do
|
|
5315
4718
|
Q[k++] = D[Y++];
|
|
5316
4719
|
while (--J);
|
|
5317
|
-
Y = k -
|
|
4720
|
+
Y = k - rt, et = Q;
|
|
5318
4721
|
}
|
|
5319
4722
|
} else if (U < J) {
|
|
5320
4723
|
if (Y += N + U - J, J -= U, J < X) {
|
|
@@ -5327,7 +4730,7 @@ var inffast = function s($, u) {
|
|
|
5327
4730
|
do
|
|
5328
4731
|
Q[k++] = D[Y++];
|
|
5329
4732
|
while (--J);
|
|
5330
|
-
Y = k -
|
|
4733
|
+
Y = k - rt, et = Q;
|
|
5331
4734
|
}
|
|
5332
4735
|
}
|
|
5333
4736
|
} else if (Y += U - J, J < X) {
|
|
@@ -5335,20 +4738,20 @@ var inffast = function s($, u) {
|
|
|
5335
4738
|
do
|
|
5336
4739
|
Q[k++] = D[Y++];
|
|
5337
4740
|
while (--J);
|
|
5338
|
-
Y = k -
|
|
4741
|
+
Y = k - rt, et = Q;
|
|
5339
4742
|
}
|
|
5340
4743
|
for (; X > 2; )
|
|
5341
|
-
Q[k++] =
|
|
5342
|
-
X && (Q[k++] =
|
|
4744
|
+
Q[k++] = et[Y++], Q[k++] = et[Y++], Q[k++] = et[Y++], X -= 3;
|
|
4745
|
+
X && (Q[k++] = et[Y++], X > 1 && (Q[k++] = et[Y++]));
|
|
5343
4746
|
} else {
|
|
5344
|
-
Y = k -
|
|
4747
|
+
Y = k - rt;
|
|
5345
4748
|
do
|
|
5346
4749
|
Q[k++] = Q[Y++], Q[k++] = Q[Y++], Q[k++] = Q[Y++], X -= 3;
|
|
5347
4750
|
while (X > 2);
|
|
5348
4751
|
X && (Q[k++] = Q[Y++], X > 1 && (Q[k++] = Q[Y++]));
|
|
5349
4752
|
}
|
|
5350
4753
|
} else if (J & 64) {
|
|
5351
|
-
$.msg = "invalid distance code",
|
|
4754
|
+
$.msg = "invalid distance code", nt.mode = BAD$1;
|
|
5352
4755
|
break t;
|
|
5353
4756
|
} else {
|
|
5354
4757
|
V = H[(V & 65535) + (L & (1 << J) - 1)];
|
|
@@ -5358,20 +4761,20 @@ var inffast = function s($, u) {
|
|
|
5358
4761
|
}
|
|
5359
4762
|
} else if (J & 64)
|
|
5360
4763
|
if (J & 32) {
|
|
5361
|
-
|
|
4764
|
+
nt.mode = TYPE$1;
|
|
5362
4765
|
break t;
|
|
5363
4766
|
} else {
|
|
5364
|
-
$.msg = "invalid literal/length code",
|
|
4767
|
+
$.msg = "invalid literal/length code", nt.mode = BAD$1;
|
|
5365
4768
|
break t;
|
|
5366
4769
|
}
|
|
5367
4770
|
else {
|
|
5368
|
-
V =
|
|
4771
|
+
V = K[(V & 65535) + (L & (1 << J) - 1)];
|
|
5369
4772
|
continue e;
|
|
5370
4773
|
}
|
|
5371
4774
|
break;
|
|
5372
4775
|
}
|
|
5373
4776
|
} while (A < h && k < o);
|
|
5374
|
-
X = Z >> 3, A -= X, Z -= X << 3, L &= (1 << Z) - 1, $.next_in = A, $.next_out = k, $.avail_in = A < h ? 5 + (h - A) : 5 - (A - h), $.avail_out = k < o ? 257 + (o - k) : 257 - (k - o),
|
|
4777
|
+
X = Z >> 3, A -= X, Z -= X << 3, L &= (1 << Z) - 1, $.next_in = A, $.next_out = k, $.avail_in = A < h ? 5 + (h - A) : 5 - (A - h), $.avail_out = k < o ? 257 + (o - k) : 257 - (k - o), nt.hold = L, nt.bits = Z;
|
|
5375
4778
|
};
|
|
5376
4779
|
const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS$1 = 1, DISTS$1 = 2, lbase = new Uint16Array([
|
|
5377
4780
|
/* Length codes 257..285 base */
|
|
@@ -5509,9 +4912,9 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
5509
4912
|
64
|
|
5510
4913
|
]), inflate_table = (s, $, u, A, h, k, t, o) => {
|
|
5511
4914
|
const v = o.bits;
|
|
5512
|
-
let N = 0, q = 0, U = 0, D = 0, L = 0, Z = 0,
|
|
5513
|
-
const Q = new Uint16Array(MAXBITS + 1),
|
|
5514
|
-
let _t = null, vt,
|
|
4915
|
+
let N = 0, q = 0, U = 0, D = 0, L = 0, Z = 0, K = 0, H = 0, F = 0, z = 0, V, J, X, rt, Y, et = null, tt;
|
|
4916
|
+
const Q = new Uint16Array(MAXBITS + 1), nt = new Uint16Array(MAXBITS + 1);
|
|
4917
|
+
let _t = null, vt, mt, yt;
|
|
5515
4918
|
for (N = 0; N <= MAXBITS; N++)
|
|
5516
4919
|
Q[N] = 0;
|
|
5517
4920
|
for (q = 0; q < A; q++)
|
|
@@ -5527,16 +4930,16 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
5527
4930
|
return -1;
|
|
5528
4931
|
if (H > 0 && (s === CODES$1 || D !== 1))
|
|
5529
4932
|
return -1;
|
|
5530
|
-
for (
|
|
5531
|
-
|
|
4933
|
+
for (nt[1] = 0, N = 1; N < MAXBITS; N++)
|
|
4934
|
+
nt[N + 1] = nt[N] + Q[N];
|
|
5532
4935
|
for (q = 0; q < A; q++)
|
|
5533
|
-
$[u + q] !== 0 && (t[
|
|
5534
|
-
if (s === CODES$1 ? (
|
|
4936
|
+
$[u + q] !== 0 && (t[nt[$[u + q]]++] = q);
|
|
4937
|
+
if (s === CODES$1 ? (et = _t = t, tt = 20) : s === LENS$1 ? (et = lbase, _t = lext, tt = 257) : (et = dbase, _t = dext, tt = 0), z = 0, q = 0, N = U, Y = k, Z = L, K = 0, X = -1, F = 1 << L, rt = F - 1, s === LENS$1 && F > ENOUGH_LENS$1 || s === DISTS$1 && F > ENOUGH_DISTS$1)
|
|
5535
4938
|
return 1;
|
|
5536
4939
|
for (; ; ) {
|
|
5537
|
-
vt = N -
|
|
4940
|
+
vt = N - K, t[q] + 1 < tt ? (mt = 0, yt = t[q]) : t[q] >= tt ? (mt = _t[t[q] - tt], yt = et[t[q] - tt]) : (mt = 96, yt = 0), V = 1 << N - K, J = 1 << Z, U = J;
|
|
5538
4941
|
do
|
|
5539
|
-
J -= V, h[Y + (z >>
|
|
4942
|
+
J -= V, h[Y + (z >> K) + J] = vt << 24 | mt << 16 | yt | 0;
|
|
5540
4943
|
while (J !== 0);
|
|
5541
4944
|
for (V = 1 << N - 1; z & V; )
|
|
5542
4945
|
V >>= 1;
|
|
@@ -5545,15 +4948,15 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
5545
4948
|
break;
|
|
5546
4949
|
N = $[u + t[q]];
|
|
5547
4950
|
}
|
|
5548
|
-
if (N > L && (z &
|
|
5549
|
-
for (
|
|
4951
|
+
if (N > L && (z & rt) !== X) {
|
|
4952
|
+
for (K === 0 && (K = L), Y += U, Z = N - K, H = 1 << Z; Z + K < D && (H -= Q[Z + K], !(H <= 0)); )
|
|
5550
4953
|
Z++, H <<= 1;
|
|
5551
4954
|
if (F += 1 << Z, s === LENS$1 && F > ENOUGH_LENS$1 || s === DISTS$1 && F > ENOUGH_DISTS$1)
|
|
5552
4955
|
return 1;
|
|
5553
|
-
X = z &
|
|
4956
|
+
X = z & rt, h[X] = L << 24 | Z << 16 | Y - k | 0;
|
|
5554
4957
|
}
|
|
5555
4958
|
}
|
|
5556
|
-
return z !== 0 && (h[Y + z] = N -
|
|
4959
|
+
return z !== 0 && (h[Y + z] = N - K << 24 | 64 << 16 | 0), o.bits = L, 0;
|
|
5557
4960
|
};
|
|
5558
4961
|
var inftrees = inflate_table;
|
|
5559
4962
|
const CODES = 0, LENS = 1, DISTS = 2, {
|
|
@@ -5624,16 +5027,16 @@ const fixedtables = (s) => {
|
|
|
5624
5027
|
const k = s.state;
|
|
5625
5028
|
return k.window === null && (k.wsize = 1 << k.wbits, k.wnext = 0, k.whave = 0, k.window = new Uint8Array(k.wsize)), A >= k.wsize ? (k.window.set($.subarray(u - k.wsize, u), 0), k.wnext = 0, k.whave = k.wsize) : (h = k.wsize - k.wnext, h > A && (h = A), k.window.set($.subarray(u - A, u - A + h), k.wnext), A -= h, A ? (k.window.set($.subarray(u - A, u), 0), k.wnext = A, k.whave = k.wsize) : (k.wnext += h, k.wnext === k.wsize && (k.wnext = 0), k.whave < k.wsize && (k.whave += h))), 0;
|
|
5626
5029
|
}, inflate$2 = (s, $) => {
|
|
5627
|
-
let u, A, h, k, t, o, v, N, q, U, D, L, Z,
|
|
5030
|
+
let u, A, h, k, t, o, v, N, q, U, D, L, Z, K, H = 0, F, z, V, J, X, rt, Y, et;
|
|
5628
5031
|
const tt = new Uint8Array(4);
|
|
5629
|
-
let Q,
|
|
5032
|
+
let Q, nt;
|
|
5630
5033
|
const _t = (
|
|
5631
5034
|
/* permutation of code lengths */
|
|
5632
5035
|
new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
|
|
5633
5036
|
);
|
|
5634
5037
|
if (inflateStateCheck(s) || !s.output || !s.input && s.avail_in !== 0)
|
|
5635
5038
|
return Z_STREAM_ERROR$1;
|
|
5636
|
-
u = s.state, u.mode === TYPE && (u.mode = TYPEDO), t = s.next_out, h = s.output, v = s.avail_out, k = s.next_in, A = s.input, o = s.avail_in, N = u.hold, q = u.bits, U = o, D = v,
|
|
5039
|
+
u = s.state, u.mode === TYPE && (u.mode = TYPEDO), t = s.next_out, h = s.output, v = s.avail_out, k = s.next_in, A = s.input, o = s.avail_in, N = u.hold, q = u.bits, U = o, D = v, et = Z_OK$1;
|
|
5637
5040
|
t:
|
|
5638
5041
|
for (; ; )
|
|
5639
5042
|
switch (u.mode) {
|
|
@@ -5857,7 +5260,7 @@ const fixedtables = (s) => {
|
|
|
5857
5260
|
}
|
|
5858
5261
|
for (; u.have < 19; )
|
|
5859
5262
|
u.lens[_t[u.have++]] = 0;
|
|
5860
|
-
if (u.lencode = u.lendyn, u.lenbits = 7, Q = { bits: u.lenbits },
|
|
5263
|
+
if (u.lencode = u.lendyn, u.lenbits = 7, Q = { bits: u.lenbits }, et = inftrees(CODES, u.lens, 0, 19, u.lencode, 0, u.work, Q), u.lenbits = Q.bits, et) {
|
|
5861
5264
|
s.msg = "invalid code lengths set", u.mode = BAD;
|
|
5862
5265
|
break;
|
|
5863
5266
|
}
|
|
@@ -5874,7 +5277,7 @@ const fixedtables = (s) => {
|
|
|
5874
5277
|
N >>>= F, q -= F, u.lens[u.have++] = V;
|
|
5875
5278
|
else {
|
|
5876
5279
|
if (V === 16) {
|
|
5877
|
-
for (
|
|
5280
|
+
for (nt = F + 2; q < nt; ) {
|
|
5878
5281
|
if (o === 0)
|
|
5879
5282
|
break t;
|
|
5880
5283
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -5885,14 +5288,14 @@ const fixedtables = (s) => {
|
|
|
5885
5288
|
}
|
|
5886
5289
|
Y = u.lens[u.have - 1], L = 3 + (N & 3), N >>>= 2, q -= 2;
|
|
5887
5290
|
} else if (V === 17) {
|
|
5888
|
-
for (
|
|
5291
|
+
for (nt = F + 3; q < nt; ) {
|
|
5889
5292
|
if (o === 0)
|
|
5890
5293
|
break t;
|
|
5891
5294
|
o--, N += A[k++] << q, q += 8;
|
|
5892
5295
|
}
|
|
5893
5296
|
N >>>= F, q -= F, Y = 0, L = 3 + (N & 7), N >>>= 3, q -= 3;
|
|
5894
5297
|
} else {
|
|
5895
|
-
for (
|
|
5298
|
+
for (nt = F + 7; q < nt; ) {
|
|
5896
5299
|
if (o === 0)
|
|
5897
5300
|
break t;
|
|
5898
5301
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -5913,11 +5316,11 @@ const fixedtables = (s) => {
|
|
|
5913
5316
|
s.msg = "invalid code -- missing end-of-block", u.mode = BAD;
|
|
5914
5317
|
break;
|
|
5915
5318
|
}
|
|
5916
|
-
if (u.lenbits = 9, Q = { bits: u.lenbits },
|
|
5319
|
+
if (u.lenbits = 9, Q = { bits: u.lenbits }, et = inftrees(LENS, u.lens, 0, u.nlen, u.lencode, 0, u.work, Q), u.lenbits = Q.bits, et) {
|
|
5917
5320
|
s.msg = "invalid literal/lengths set", u.mode = BAD;
|
|
5918
5321
|
break;
|
|
5919
5322
|
}
|
|
5920
|
-
if (u.distbits = 6, u.distcode = u.distdyn, Q = { bits: u.distbits },
|
|
5323
|
+
if (u.distbits = 6, u.distcode = u.distdyn, Q = { bits: u.distbits }, et = inftrees(DISTS, u.lens, u.nlen, u.ndist, u.distcode, 0, u.work, Q), u.distbits = Q.bits, et) {
|
|
5921
5324
|
s.msg = "invalid distances set", u.mode = BAD;
|
|
5922
5325
|
break;
|
|
5923
5326
|
}
|
|
@@ -5938,7 +5341,7 @@ const fixedtables = (s) => {
|
|
|
5938
5341
|
o--, N += A[k++] << q, q += 8;
|
|
5939
5342
|
}
|
|
5940
5343
|
if (z && !(z & 240)) {
|
|
5941
|
-
for (J = F, X = z,
|
|
5344
|
+
for (J = F, X = z, rt = V; H = u.lencode[rt + ((N & (1 << J + X) - 1) >> J)], F = H >>> 24, z = H >>> 16 & 255, V = H & 65535, !(J + F <= q); ) {
|
|
5942
5345
|
if (o === 0)
|
|
5943
5346
|
break t;
|
|
5944
5347
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -5961,7 +5364,7 @@ const fixedtables = (s) => {
|
|
|
5961
5364
|
/* falls through */
|
|
5962
5365
|
case LENEXT:
|
|
5963
5366
|
if (u.extra) {
|
|
5964
|
-
for (
|
|
5367
|
+
for (nt = u.extra; q < nt; ) {
|
|
5965
5368
|
if (o === 0)
|
|
5966
5369
|
break t;
|
|
5967
5370
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -5977,7 +5380,7 @@ const fixedtables = (s) => {
|
|
|
5977
5380
|
o--, N += A[k++] << q, q += 8;
|
|
5978
5381
|
}
|
|
5979
5382
|
if (!(z & 240)) {
|
|
5980
|
-
for (J = F, X = z,
|
|
5383
|
+
for (J = F, X = z, rt = V; H = u.distcode[rt + ((N & (1 << J + X) - 1) >> J)], F = H >>> 24, z = H >>> 16 & 255, V = H & 65535, !(J + F <= q); ) {
|
|
5981
5384
|
if (o === 0)
|
|
5982
5385
|
break t;
|
|
5983
5386
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -5992,7 +5395,7 @@ const fixedtables = (s) => {
|
|
|
5992
5395
|
/* falls through */
|
|
5993
5396
|
case DISTEXT:
|
|
5994
5397
|
if (u.extra) {
|
|
5995
|
-
for (
|
|
5398
|
+
for (nt = u.extra; q < nt; ) {
|
|
5996
5399
|
if (o === 0)
|
|
5997
5400
|
break t;
|
|
5998
5401
|
o--, N += A[k++] << q, q += 8;
|
|
@@ -6013,12 +5416,12 @@ const fixedtables = (s) => {
|
|
|
6013
5416
|
s.msg = "invalid distance too far back", u.mode = BAD;
|
|
6014
5417
|
break;
|
|
6015
5418
|
}
|
|
6016
|
-
L > u.wnext ? (L -= u.wnext, Z = u.wsize - L) : Z = u.wnext - L, L > u.length && (L = u.length),
|
|
5419
|
+
L > u.wnext ? (L -= u.wnext, Z = u.wsize - L) : Z = u.wnext - L, L > u.length && (L = u.length), K = u.window;
|
|
6017
5420
|
} else
|
|
6018
|
-
|
|
5421
|
+
K = h, Z = t - u.offset, L = u.length;
|
|
6019
5422
|
L > v && (L = v), v -= L, u.length -= L;
|
|
6020
5423
|
do
|
|
6021
|
-
h[t++] =
|
|
5424
|
+
h[t++] = K[Z++];
|
|
6022
5425
|
while (--L);
|
|
6023
5426
|
u.length === 0 && (u.mode = LEN);
|
|
6024
5427
|
break;
|
|
@@ -6059,10 +5462,10 @@ const fixedtables = (s) => {
|
|
|
6059
5462
|
u.mode = DONE;
|
|
6060
5463
|
/* falls through */
|
|
6061
5464
|
case DONE:
|
|
6062
|
-
|
|
5465
|
+
et = Z_STREAM_END$1;
|
|
6063
5466
|
break t;
|
|
6064
5467
|
case BAD:
|
|
6065
|
-
|
|
5468
|
+
et = Z_DATA_ERROR$1;
|
|
6066
5469
|
break t;
|
|
6067
5470
|
case MEM:
|
|
6068
5471
|
return Z_MEM_ERROR$1;
|
|
@@ -6072,7 +5475,7 @@ const fixedtables = (s) => {
|
|
|
6072
5475
|
return Z_STREAM_ERROR$1;
|
|
6073
5476
|
}
|
|
6074
5477
|
return s.next_out = t, s.avail_out = v, s.next_in = k, s.avail_in = o, u.hold = N, u.bits = q, (u.wsize || D !== s.avail_out && u.mode < BAD && (u.mode < CHECK || $ !== Z_FINISH$1)) && updatewindow(s, s.output, s.next_out, D - s.avail_out), U -= s.avail_in, D -= s.avail_out, s.total_in += U, s.total_out += D, u.total += D, u.wrap & 4 && D && (s.adler = u.check = /*UPDATE_CHECK(state.check, strm.next_out - _out, _out);*/
|
|
6075
|
-
u.flags ? crc32_1(u.check, h, D, s.next_out - D) : adler32_1(u.check, h, D, s.next_out - D)), s.data_type = u.bits + (u.last ? 64 : 0) + (u.mode === TYPE ? 128 : 0) + (u.mode === LEN_ || u.mode === COPY_ ? 256 : 0), (U === 0 && D === 0 || $ === Z_FINISH$1) &&
|
|
5478
|
+
u.flags ? crc32_1(u.check, h, D, s.next_out - D) : adler32_1(u.check, h, D, s.next_out - D)), s.data_type = u.bits + (u.last ? 64 : 0) + (u.mode === TYPE ? 128 : 0) + (u.mode === LEN_ || u.mode === COPY_ ? 256 : 0), (U === 0 && D === 0 || $ === Z_FINISH$1) && et === Z_OK$1 && (et = Z_BUF_ERROR), et;
|
|
6076
5479
|
}, inflateEnd = (s) => {
|
|
6077
5480
|
if (inflateStateCheck(s))
|
|
6078
5481
|
return Z_STREAM_ERROR$1;
|
|
@@ -6293,7 +5696,7 @@ const compressArrayBuffer = (s) => {
|
|
|
6293
5696
|
}
|
|
6294
5697
|
return s;
|
|
6295
5698
|
}, checkReconnect = (s) => !0;
|
|
6296
|
-
var ft, lt, St,
|
|
5699
|
+
var ft, lt, St, wt, ht, pt, ut, Tt, Ot, gt, $t, It, Rt, Et;
|
|
6297
5700
|
class CallsWebSocket {
|
|
6298
5701
|
// 重连停止的回调
|
|
6299
5702
|
constructor($) {
|
|
@@ -6309,19 +5712,19 @@ class CallsWebSocket {
|
|
|
6309
5712
|
});
|
|
6310
5713
|
ct(this, St, "");
|
|
6311
5714
|
// 缓存登录凭证
|
|
6312
|
-
ct(this,
|
|
5715
|
+
ct(this, wt, !1);
|
|
6313
5716
|
// 是否在房间内
|
|
6314
5717
|
ct(this, ht, 0);
|
|
6315
5718
|
// 活性时间戳 根据服务端的响应来更新当前连接活性 活性为0 说明连接已经存在异常进行重连
|
|
6316
5719
|
ct(this, pt, {});
|
|
6317
5720
|
ct(this, ut, {});
|
|
6318
|
-
|
|
5721
|
+
W(this, "onReconnectSuccess", async ($) => {
|
|
6319
5722
|
});
|
|
6320
5723
|
// 重连成功的回调
|
|
6321
|
-
|
|
5724
|
+
W(this, "onReconnectStop", async ($) => {
|
|
6322
5725
|
});
|
|
6323
5726
|
// 自定义心跳规则
|
|
6324
|
-
ct(this, Tt, () => G(this,
|
|
5727
|
+
ct(this, Tt, () => G(this, wt) ? com.quick.voice.proto.CommonReq.encode({ event: "heartbeat", sn: +`${I$1(1e5, 999999)}` }).finish() : "");
|
|
6325
5728
|
// 更新日志
|
|
6326
5729
|
ct(this, Ot, ($, u = {}) => {
|
|
6327
5730
|
try {
|
|
@@ -6342,149 +5745,746 @@ class CallsWebSocket {
|
|
|
6342
5745
|
D = "req ↑", q = U(t);
|
|
6343
5746
|
break;
|
|
6344
5747
|
}
|
|
6345
|
-
let L = "#quickvo.logs";
|
|
6346
|
-
ignoreEvent.includes(h) && (L = "#quickvo.ignoreEvents");
|
|
6347
|
-
const Z = { "#action": D, timeStr: N, event: h, data: q, time: A, ...v },
|
|
6348
|
-
localStorage.setItem(L, JSON.stringify(F));
|
|
6349
|
-
} catch (A) {
|
|
6350
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: updataLogs is error", A);
|
|
6351
|
-
}
|
|
6352
|
-
});
|
|
6353
|
-
// 活性检查器 每次发送消息前 、 接收消息后 都会调用进行检查
|
|
6354
|
-
ct(this, gt, ($) => new Promise(async (u) => {
|
|
6355
|
-
const { event: A } = $, h = Date.now();
|
|
6356
|
-
A === "healthCheck" && (dt(this, ht, h), G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 刷新活性", { activetimeStamp: G(this, ht), activetimeStampStr: O(G(this, ht)) }));
|
|
6357
|
-
const k = 30 * 1e3 + G(this, lt).timeout;
|
|
6358
|
-
h - G(this, ht) >= k && G(this, ft) && (G(this, lt).debug && console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 活性超时, 尝试重新建立连接", G(this, ft)), await this.connect()), u(G(this, ft));
|
|
6359
|
-
}));
|
|
6360
|
-
// 创建事件
|
|
6361
|
-
ct(this, $t, ($, { resolve: u, reject: A }) => {
|
|
6362
|
-
const { sn: h } = $, k = () => {
|
|
6363
|
-
const o = G(this, pt)[h];
|
|
6364
|
-
clearTimeout(o.destructionTimer), delete G(this, pt)[h];
|
|
6365
|
-
}, t = setTimeout(() => {
|
|
6366
|
-
const o = G(this, pt)[h];
|
|
6367
|
-
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo:event is timeout", o.message), k(), A("event is timeout");
|
|
6368
|
-
}, G(this, lt).timeout);
|
|
6369
|
-
G(this, pt)[h] = { message: $, resolve: u, reject: A, destruction: k, destructionTimer: t };
|
|
6370
|
-
});
|
|
6371
|
-
// 获取事件
|
|
6372
|
-
ct(this, It, ($) => G(this, pt)[$]);
|
|
6373
|
-
// 接收消息
|
|
6374
|
-
ct(this, Rt, async ($) => {
|
|
6375
|
-
const u = new Uint8Array($), A = com.quick.voice.proto.CommonRsp.decode(u), { sn: h, event: k } = A, t = onMessageFormat(A);
|
|
6376
|
-
if (G(this, lt).debug && (G(this, Ot).call(this, "res", t), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff0097;padding:16px 0;", "------->quickvo: 响应消息↓", t)), await G(this, gt).call(this, t), k === "joinRoom" && dt(this,
|
|
6377
|
-
if (notifyName_keys.includes(k))
|
|
6378
|
-
return this.emitNotify(k, E(t, ["code", "data", "desc"]));
|
|
6379
|
-
const v = G(this, It).call(this, h);
|
|
6380
|
-
if (v) {
|
|
6381
|
-
const { resolve: N = (U) => {
|
|
6382
|
-
}, destruction: q = () => {
|
|
6383
|
-
} } = v;
|
|
6384
|
-
N(E(t, ["code", "data", "desc"])), q();
|
|
6385
|
-
}
|
|
6386
|
-
});
|
|
6387
|
-
// 重连成功
|
|
6388
|
-
ct(this, Et, async ($) => {
|
|
6389
|
-
const u = Date.now();
|
|
6390
|
-
dt(this, ht, u), G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 重置活性", { activetimeStamp: G(this, ht), activetimeStampStr: O(G(this, ht)) }), await this.onReconnectSuccess($);
|
|
6391
|
-
});
|
|
6392
|
-
/**
|
|
6393
|
-
* 连接
|
|
6394
|
-
* @param session
|
|
6395
|
-
* @returns
|
|
6396
|
-
*/
|
|
6397
|
-
|
|
6398
|
-
$ && dt(this, St, $), G(this, ft) && await G(this, ft).close();
|
|
6399
|
-
const u = `${G(this, lt).url}?s=${G(this, St)}&t=${Date.now()}`;
|
|
6400
|
-
return dt(this, ft, new _({
|
|
6401
|
-
...G(this, lt),
|
|
6402
|
-
url: u,
|
|
6403
|
-
binaryType: "arraybuffer",
|
|
6404
|
-
onMessage: G(this, Rt),
|
|
6405
|
-
checkReconnect,
|
|
6406
|
-
getHeartbeatMsg: G(this, Tt),
|
|
6407
|
-
onReconnectSuccess: G(this, Et),
|
|
6408
|
-
onReconnectStop: (A) => this.onReconnectStop(A)
|
|
6409
|
-
})), await G(this, ft).connect(), dt(this, ht, Date.now()), G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 当前广播事件", G(this, ut)), G(this, ft);
|
|
6410
|
-
});
|
|
6411
|
-
/**
|
|
6412
|
-
* 关闭
|
|
6413
|
-
*/
|
|
6414
|
-
|
|
6415
|
-
var u;
|
|
6416
|
-
G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: cws is close.");
|
|
6417
|
-
const $ = Object.keys(G(this, pt));
|
|
6418
|
-
for (const A of $) {
|
|
6419
|
-
const { destructionTimer: h } = G(this, pt)[A];
|
|
6420
|
-
clearTimeout(h);
|
|
5748
|
+
let L = "#quickvo.logs";
|
|
5749
|
+
ignoreEvent.includes(h) && (L = "#quickvo.ignoreEvents");
|
|
5750
|
+
const Z = { "#action": D, timeStr: N, event: h, data: q, time: A, ...v }, K = localStorage.getItem(L) || JSON.stringify([]), H = JSON.parse(K), F = [Z, ...H].slice(0, 500);
|
|
5751
|
+
localStorage.setItem(L, JSON.stringify(F));
|
|
5752
|
+
} catch (A) {
|
|
5753
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: updataLogs is error", A);
|
|
5754
|
+
}
|
|
5755
|
+
});
|
|
5756
|
+
// 活性检查器 每次发送消息前 、 接收消息后 都会调用进行检查
|
|
5757
|
+
ct(this, gt, ($) => new Promise(async (u) => {
|
|
5758
|
+
const { event: A } = $, h = Date.now();
|
|
5759
|
+
A === "healthCheck" && (dt(this, ht, h), G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 刷新活性", { activetimeStamp: G(this, ht), activetimeStampStr: O(G(this, ht)) }));
|
|
5760
|
+
const k = 30 * 1e3 + G(this, lt).timeout;
|
|
5761
|
+
h - G(this, ht) >= k && G(this, ft) && (G(this, lt).debug && console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 活性超时, 尝试重新建立连接", G(this, ft)), await this.connect()), u(G(this, ft));
|
|
5762
|
+
}));
|
|
5763
|
+
// 创建事件
|
|
5764
|
+
ct(this, $t, ($, { resolve: u, reject: A }) => {
|
|
5765
|
+
const { sn: h } = $, k = () => {
|
|
5766
|
+
const o = G(this, pt)[h];
|
|
5767
|
+
clearTimeout(o.destructionTimer), delete G(this, pt)[h];
|
|
5768
|
+
}, t = setTimeout(() => {
|
|
5769
|
+
const o = G(this, pt)[h];
|
|
5770
|
+
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo:event is timeout", o.message), k(), A("event is timeout");
|
|
5771
|
+
}, G(this, lt).timeout);
|
|
5772
|
+
G(this, pt)[h] = { message: $, resolve: u, reject: A, destruction: k, destructionTimer: t };
|
|
5773
|
+
});
|
|
5774
|
+
// 获取事件
|
|
5775
|
+
ct(this, It, ($) => G(this, pt)[$]);
|
|
5776
|
+
// 接收消息
|
|
5777
|
+
ct(this, Rt, async ($) => {
|
|
5778
|
+
const u = new Uint8Array($), A = com.quick.voice.proto.CommonRsp.decode(u), { sn: h, event: k } = A, t = onMessageFormat(A);
|
|
5779
|
+
if (G(this, lt).debug && (G(this, Ot).call(this, "res", t), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff0097;padding:16px 0;", "------->quickvo: 响应消息↓", t)), await G(this, gt).call(this, t), k === "joinRoom" && dt(this, wt, !0), ignoreEvent.includes(k)) return;
|
|
5780
|
+
if (notifyName_keys.includes(k))
|
|
5781
|
+
return this.emitNotify(k, E(t, ["code", "data", "desc"]));
|
|
5782
|
+
const v = G(this, It).call(this, h);
|
|
5783
|
+
if (v) {
|
|
5784
|
+
const { resolve: N = (U) => {
|
|
5785
|
+
}, destruction: q = () => {
|
|
5786
|
+
} } = v;
|
|
5787
|
+
N(E(t, ["code", "data", "desc"])), q();
|
|
5788
|
+
}
|
|
5789
|
+
});
|
|
5790
|
+
// 重连成功
|
|
5791
|
+
ct(this, Et, async ($) => {
|
|
5792
|
+
const u = Date.now();
|
|
5793
|
+
dt(this, ht, u), G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 重置活性", { activetimeStamp: G(this, ht), activetimeStampStr: O(G(this, ht)) }), await this.onReconnectSuccess($);
|
|
5794
|
+
});
|
|
5795
|
+
/**
|
|
5796
|
+
* 连接
|
|
5797
|
+
* @param session
|
|
5798
|
+
* @returns
|
|
5799
|
+
*/
|
|
5800
|
+
W(this, "connect", async ($ = "") => {
|
|
5801
|
+
$ && dt(this, St, $), G(this, ft) && await G(this, ft).close();
|
|
5802
|
+
const u = `${G(this, lt).url}?s=${G(this, St)}&t=${Date.now()}`;
|
|
5803
|
+
return dt(this, ft, new _({
|
|
5804
|
+
...G(this, lt),
|
|
5805
|
+
url: u,
|
|
5806
|
+
binaryType: "arraybuffer",
|
|
5807
|
+
onMessage: G(this, Rt),
|
|
5808
|
+
checkReconnect,
|
|
5809
|
+
getHeartbeatMsg: G(this, Tt),
|
|
5810
|
+
onReconnectSuccess: G(this, Et),
|
|
5811
|
+
onReconnectStop: (A) => this.onReconnectStop(A)
|
|
5812
|
+
})), await G(this, ft).connect(), dt(this, ht, Date.now()), G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 当前广播事件", G(this, ut)), G(this, ft);
|
|
5813
|
+
});
|
|
5814
|
+
/**
|
|
5815
|
+
* 关闭
|
|
5816
|
+
*/
|
|
5817
|
+
W(this, "close", async () => {
|
|
5818
|
+
var u;
|
|
5819
|
+
G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: cws is close.");
|
|
5820
|
+
const $ = Object.keys(G(this, pt));
|
|
5821
|
+
for (const A of $) {
|
|
5822
|
+
const { destructionTimer: h } = G(this, pt)[A];
|
|
5823
|
+
clearTimeout(h);
|
|
5824
|
+
}
|
|
5825
|
+
dt(this, pt, {}), dt(this, ut, {}), await ((u = G(this, ft)) == null ? void 0 : u.close());
|
|
5826
|
+
});
|
|
5827
|
+
/**
|
|
5828
|
+
* 发送消息
|
|
5829
|
+
* @param message Message
|
|
5830
|
+
*/
|
|
5831
|
+
W(this, "sendMessage", ($, u = !0) => new Promise(async (A, h) => {
|
|
5832
|
+
var q;
|
|
5833
|
+
const { event: k, ...t } = $, o = Date.now(), v = sendMessageFormat({
|
|
5834
|
+
event: k,
|
|
5835
|
+
sn: +`${o}${I$1(1e3, 9999)}`,
|
|
5836
|
+
time: o,
|
|
5837
|
+
valid: G(this, lt).timeout,
|
|
5838
|
+
version: 1,
|
|
5839
|
+
compress: !1,
|
|
5840
|
+
...t
|
|
5841
|
+
});
|
|
5842
|
+
G(this, lt).debug && (G(this, Ot).call(this, "req", v), console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff9700;padding:16px 0;", "------->quickvo: 发送消息↑", v)), await G(this, gt).call(this, v), k === "joinRoom" && dt(this, wt, !1), u && G(this, $t).call(this, v, { resolve: A, reject: h });
|
|
5843
|
+
const N = com.quick.voice.proto.CommonReq.encode(v).finish();
|
|
5844
|
+
(q = G(this, ft)) == null || q.sendMessage(N);
|
|
5845
|
+
}));
|
|
5846
|
+
/**
|
|
5847
|
+
* 触发广播事件
|
|
5848
|
+
* @param event 事件名称
|
|
5849
|
+
* @param data 事件响应值
|
|
5850
|
+
*/
|
|
5851
|
+
W(this, "emitNotify", async ($, u) => {
|
|
5852
|
+
const A = G(this, ut)[$] || [];
|
|
5853
|
+
for (const h of A) {
|
|
5854
|
+
const { callback: k = async () => {
|
|
5855
|
+
} } = h;
|
|
5856
|
+
await k(u);
|
|
5857
|
+
}
|
|
5858
|
+
});
|
|
5859
|
+
/**
|
|
5860
|
+
* 添加广播
|
|
5861
|
+
* @param notify
|
|
5862
|
+
* @param _private
|
|
5863
|
+
* @returns sn
|
|
5864
|
+
*/
|
|
5865
|
+
W(this, "addNotify", ($, u = !1) => {
|
|
5866
|
+
const { event: A } = $;
|
|
5867
|
+
G(this, ut)[A] || (G(this, ut)[A] = []);
|
|
5868
|
+
const h = { sn: it(32), ...$ };
|
|
5869
|
+
return u ? G(this, ut)[A].unshift(h) : G(this, ut)[A].push(h), h.sn;
|
|
5870
|
+
});
|
|
5871
|
+
/**
|
|
5872
|
+
* 移除广播
|
|
5873
|
+
*/
|
|
5874
|
+
W(this, "removeNotify", ($ = []) => {
|
|
5875
|
+
if ($.length === 0)
|
|
5876
|
+
dt(this, ut, {});
|
|
5877
|
+
else {
|
|
5878
|
+
const u = Object.keys(G(this, ut));
|
|
5879
|
+
for (const A of u)
|
|
5880
|
+
G(this, ut)[A] = G(this, ut)[A].filter((h) => !$.includes(h.sn || ""));
|
|
5881
|
+
}
|
|
5882
|
+
G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 移除广播事件", G(this, ut));
|
|
5883
|
+
});
|
|
5884
|
+
dt(this, lt, { ...G(this, lt), ...$ });
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
ft = new WeakMap(), lt = new WeakMap(), St = new WeakMap(), wt = new WeakMap(), ht = new WeakMap(), pt = new WeakMap(), ut = new WeakMap(), Tt = new WeakMap(), Ot = new WeakMap(), gt = new WeakMap(), $t = new WeakMap(), It = new WeakMap(), Rt = new WeakMap(), Et = new WeakMap();
|
|
5888
|
+
var lib = {}, parser = {}, grammar = { exports: {} }, hasRequiredGrammar;
|
|
5889
|
+
function requireGrammar() {
|
|
5890
|
+
if (hasRequiredGrammar) return grammar.exports;
|
|
5891
|
+
hasRequiredGrammar = 1;
|
|
5892
|
+
var s = grammar.exports = {
|
|
5893
|
+
v: [{
|
|
5894
|
+
name: "version",
|
|
5895
|
+
reg: /^(\d*)$/
|
|
5896
|
+
}],
|
|
5897
|
+
o: [{
|
|
5898
|
+
// o=- 20518 0 IN IP4 203.0.113.1
|
|
5899
|
+
// NB: sessionId will be a String in most cases because it is huge
|
|
5900
|
+
name: "origin",
|
|
5901
|
+
reg: /^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,
|
|
5902
|
+
names: ["username", "sessionId", "sessionVersion", "netType", "ipVer", "address"],
|
|
5903
|
+
format: "%s %s %d %s IP%d %s"
|
|
5904
|
+
}],
|
|
5905
|
+
// default parsing of these only (though some of these feel outdated)
|
|
5906
|
+
s: [{ name: "name" }],
|
|
5907
|
+
i: [{ name: "description" }],
|
|
5908
|
+
u: [{ name: "uri" }],
|
|
5909
|
+
e: [{ name: "email" }],
|
|
5910
|
+
p: [{ name: "phone" }],
|
|
5911
|
+
z: [{ name: "timezones" }],
|
|
5912
|
+
// TODO: this one can actually be parsed properly...
|
|
5913
|
+
r: [{ name: "repeats" }],
|
|
5914
|
+
// TODO: this one can also be parsed properly
|
|
5915
|
+
// k: [{}], // outdated thing ignored
|
|
5916
|
+
t: [{
|
|
5917
|
+
// t=0 0
|
|
5918
|
+
name: "timing",
|
|
5919
|
+
reg: /^(\d*) (\d*)/,
|
|
5920
|
+
names: ["start", "stop"],
|
|
5921
|
+
format: "%d %d"
|
|
5922
|
+
}],
|
|
5923
|
+
c: [{
|
|
5924
|
+
// c=IN IP4 10.47.197.26
|
|
5925
|
+
name: "connection",
|
|
5926
|
+
reg: /^IN IP(\d) (\S*)/,
|
|
5927
|
+
names: ["version", "ip"],
|
|
5928
|
+
format: "IN IP%d %s"
|
|
5929
|
+
}],
|
|
5930
|
+
b: [{
|
|
5931
|
+
// b=AS:4000
|
|
5932
|
+
push: "bandwidth",
|
|
5933
|
+
reg: /^(TIAS|AS|CT|RR|RS):(\d*)/,
|
|
5934
|
+
names: ["type", "limit"],
|
|
5935
|
+
format: "%s:%s"
|
|
5936
|
+
}],
|
|
5937
|
+
m: [{
|
|
5938
|
+
// m=video 51744 RTP/AVP 126 97 98 34 31
|
|
5939
|
+
// NB: special - pushes to session
|
|
5940
|
+
// TODO: rtp/fmtp should be filtered by the payloads found here?
|
|
5941
|
+
reg: /^(\w*) (\d*) ([\w/]*)(?: (.*))?/,
|
|
5942
|
+
names: ["type", "port", "protocol", "payloads"],
|
|
5943
|
+
format: "%s %d %s %s"
|
|
5944
|
+
}],
|
|
5945
|
+
a: [
|
|
5946
|
+
{
|
|
5947
|
+
// a=rtpmap:110 opus/48000/2
|
|
5948
|
+
push: "rtp",
|
|
5949
|
+
reg: /^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,
|
|
5950
|
+
names: ["payload", "codec", "rate", "encoding"],
|
|
5951
|
+
format: function($) {
|
|
5952
|
+
return $.encoding ? "rtpmap:%d %s/%s/%s" : $.rate ? "rtpmap:%d %s/%s" : "rtpmap:%d %s";
|
|
5953
|
+
}
|
|
5954
|
+
},
|
|
5955
|
+
{
|
|
5956
|
+
// a=fmtp:108 profile-level-id=24;object=23;bitrate=64000
|
|
5957
|
+
// a=fmtp:111 minptime=10; useinbandfec=1
|
|
5958
|
+
push: "fmtp",
|
|
5959
|
+
reg: /^fmtp:(\d*) ([\S| ]*)/,
|
|
5960
|
+
names: ["payload", "config"],
|
|
5961
|
+
format: "fmtp:%d %s"
|
|
5962
|
+
},
|
|
5963
|
+
{
|
|
5964
|
+
// a=control:streamid=0
|
|
5965
|
+
name: "control",
|
|
5966
|
+
reg: /^control:(.*)/,
|
|
5967
|
+
format: "control:%s"
|
|
5968
|
+
},
|
|
5969
|
+
{
|
|
5970
|
+
// a=rtcp:65179 IN IP4 193.84.77.194
|
|
5971
|
+
name: "rtcp",
|
|
5972
|
+
reg: /^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,
|
|
5973
|
+
names: ["port", "netType", "ipVer", "address"],
|
|
5974
|
+
format: function($) {
|
|
5975
|
+
return $.address != null ? "rtcp:%d %s IP%d %s" : "rtcp:%d";
|
|
5976
|
+
}
|
|
5977
|
+
},
|
|
5978
|
+
{
|
|
5979
|
+
// a=rtcp-fb:98 trr-int 100
|
|
5980
|
+
push: "rtcpFbTrrInt",
|
|
5981
|
+
reg: /^rtcp-fb:(\*|\d*) trr-int (\d*)/,
|
|
5982
|
+
names: ["payload", "value"],
|
|
5983
|
+
format: "rtcp-fb:%s trr-int %d"
|
|
5984
|
+
},
|
|
5985
|
+
{
|
|
5986
|
+
// a=rtcp-fb:98 nack rpsi
|
|
5987
|
+
push: "rtcpFb",
|
|
5988
|
+
reg: /^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,
|
|
5989
|
+
names: ["payload", "type", "subtype"],
|
|
5990
|
+
format: function($) {
|
|
5991
|
+
return $.subtype != null ? "rtcp-fb:%s %s %s" : "rtcp-fb:%s %s";
|
|
5992
|
+
}
|
|
5993
|
+
},
|
|
5994
|
+
{
|
|
5995
|
+
// a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
|
|
5996
|
+
// a=extmap:1/recvonly URI-gps-string
|
|
5997
|
+
// a=extmap:3 urn:ietf:params:rtp-hdrext:encrypt urn:ietf:params:rtp-hdrext:smpte-tc 25@600/24
|
|
5998
|
+
push: "ext",
|
|
5999
|
+
reg: /^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,
|
|
6000
|
+
names: ["value", "direction", "encrypt-uri", "uri", "config"],
|
|
6001
|
+
format: function($) {
|
|
6002
|
+
return "extmap:%d" + ($.direction ? "/%s" : "%v") + ($["encrypt-uri"] ? " %s" : "%v") + " %s" + ($.config ? " %s" : "");
|
|
6003
|
+
}
|
|
6004
|
+
},
|
|
6005
|
+
{
|
|
6006
|
+
// a=extmap-allow-mixed
|
|
6007
|
+
name: "extmapAllowMixed",
|
|
6008
|
+
reg: /^(extmap-allow-mixed)/
|
|
6009
|
+
},
|
|
6010
|
+
{
|
|
6011
|
+
// a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR|2^20|1:32
|
|
6012
|
+
push: "crypto",
|
|
6013
|
+
reg: /^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,
|
|
6014
|
+
names: ["id", "suite", "config", "sessionConfig"],
|
|
6015
|
+
format: function($) {
|
|
6016
|
+
return $.sessionConfig != null ? "crypto:%d %s %s %s" : "crypto:%d %s %s";
|
|
6017
|
+
}
|
|
6018
|
+
},
|
|
6019
|
+
{
|
|
6020
|
+
// a=setup:actpass
|
|
6021
|
+
name: "setup",
|
|
6022
|
+
reg: /^setup:(\w*)/,
|
|
6023
|
+
format: "setup:%s"
|
|
6024
|
+
},
|
|
6025
|
+
{
|
|
6026
|
+
// a=connection:new
|
|
6027
|
+
name: "connectionType",
|
|
6028
|
+
reg: /^connection:(new|existing)/,
|
|
6029
|
+
format: "connection:%s"
|
|
6030
|
+
},
|
|
6031
|
+
{
|
|
6032
|
+
// a=mid:1
|
|
6033
|
+
name: "mid",
|
|
6034
|
+
reg: /^mid:([^\s]*)/,
|
|
6035
|
+
format: "mid:%s"
|
|
6036
|
+
},
|
|
6037
|
+
{
|
|
6038
|
+
// a=msid:0c8b064d-d807-43b4-b434-f92a889d8587 98178685-d409-46e0-8e16-7ef0db0db64a
|
|
6039
|
+
name: "msid",
|
|
6040
|
+
reg: /^msid:(.*)/,
|
|
6041
|
+
format: "msid:%s"
|
|
6042
|
+
},
|
|
6043
|
+
{
|
|
6044
|
+
// a=ptime:20
|
|
6045
|
+
name: "ptime",
|
|
6046
|
+
reg: /^ptime:(\d*(?:\.\d*)*)/,
|
|
6047
|
+
format: "ptime:%d"
|
|
6048
|
+
},
|
|
6049
|
+
{
|
|
6050
|
+
// a=maxptime:60
|
|
6051
|
+
name: "maxptime",
|
|
6052
|
+
reg: /^maxptime:(\d*(?:\.\d*)*)/,
|
|
6053
|
+
format: "maxptime:%d"
|
|
6054
|
+
},
|
|
6055
|
+
{
|
|
6056
|
+
// a=sendrecv
|
|
6057
|
+
name: "direction",
|
|
6058
|
+
reg: /^(sendrecv|recvonly|sendonly|inactive)/
|
|
6059
|
+
},
|
|
6060
|
+
{
|
|
6061
|
+
// a=ice-lite
|
|
6062
|
+
name: "icelite",
|
|
6063
|
+
reg: /^(ice-lite)/
|
|
6064
|
+
},
|
|
6065
|
+
{
|
|
6066
|
+
// a=ice-ufrag:F7gI
|
|
6067
|
+
name: "iceUfrag",
|
|
6068
|
+
reg: /^ice-ufrag:(\S*)/,
|
|
6069
|
+
format: "ice-ufrag:%s"
|
|
6070
|
+
},
|
|
6071
|
+
{
|
|
6072
|
+
// a=ice-pwd:x9cml/YzichV2+XlhiMu8g
|
|
6073
|
+
name: "icePwd",
|
|
6074
|
+
reg: /^ice-pwd:(\S*)/,
|
|
6075
|
+
format: "ice-pwd:%s"
|
|
6076
|
+
},
|
|
6077
|
+
{
|
|
6078
|
+
// a=fingerprint:SHA-1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:00:11:22:33
|
|
6079
|
+
name: "fingerprint",
|
|
6080
|
+
reg: /^fingerprint:(\S*) (\S*)/,
|
|
6081
|
+
names: ["type", "hash"],
|
|
6082
|
+
format: "fingerprint:%s %s"
|
|
6083
|
+
},
|
|
6084
|
+
{
|
|
6085
|
+
// a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host
|
|
6086
|
+
// a=candidate:1162875081 1 udp 2113937151 192.168.34.75 60017 typ host generation 0 network-id 3 network-cost 10
|
|
6087
|
+
// 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
|
|
6088
|
+
// a=candidate:229815620 1 tcp 1518280447 192.168.150.19 60017 typ host tcptype active generation 0 network-id 3 network-cost 10
|
|
6089
|
+
// 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
|
|
6090
|
+
push: "candidates",
|
|
6091
|
+
reg: /^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,
|
|
6092
|
+
names: ["foundation", "component", "transport", "priority", "ip", "port", "type", "raddr", "rport", "tcptype", "generation", "network-id", "network-cost"],
|
|
6093
|
+
format: function($) {
|
|
6094
|
+
var u = "candidate:%s %d %s %d %s %d typ %s";
|
|
6095
|
+
return u += $.raddr != null ? " raddr %s rport %d" : "%v%v", u += $.tcptype != null ? " tcptype %s" : "%v", $.generation != null && (u += " generation %d"), u += $["network-id"] != null ? " network-id %d" : "%v", u += $["network-cost"] != null ? " network-cost %d" : "%v", u;
|
|
6096
|
+
}
|
|
6097
|
+
},
|
|
6098
|
+
{
|
|
6099
|
+
// a=end-of-candidates (keep after the candidates line for readability)
|
|
6100
|
+
name: "endOfCandidates",
|
|
6101
|
+
reg: /^(end-of-candidates)/
|
|
6102
|
+
},
|
|
6103
|
+
{
|
|
6104
|
+
// a=remote-candidates:1 203.0.113.1 54400 2 203.0.113.1 54401 ...
|
|
6105
|
+
name: "remoteCandidates",
|
|
6106
|
+
reg: /^remote-candidates:(.*)/,
|
|
6107
|
+
format: "remote-candidates:%s"
|
|
6108
|
+
},
|
|
6109
|
+
{
|
|
6110
|
+
// a=ice-options:google-ice
|
|
6111
|
+
name: "iceOptions",
|
|
6112
|
+
reg: /^ice-options:(\S*)/,
|
|
6113
|
+
format: "ice-options:%s"
|
|
6114
|
+
},
|
|
6115
|
+
{
|
|
6116
|
+
// a=ssrc:2566107569 cname:t9YU8M1UxTF8Y1A1
|
|
6117
|
+
push: "ssrcs",
|
|
6118
|
+
reg: /^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,
|
|
6119
|
+
names: ["id", "attribute", "value"],
|
|
6120
|
+
format: function($) {
|
|
6121
|
+
var u = "ssrc:%d";
|
|
6122
|
+
return $.attribute != null && (u += " %s", $.value != null && (u += ":%s")), u;
|
|
6123
|
+
}
|
|
6124
|
+
},
|
|
6125
|
+
{
|
|
6126
|
+
// a=ssrc-group:FEC 1 2
|
|
6127
|
+
// a=ssrc-group:FEC-FR 3004364195 1080772241
|
|
6128
|
+
push: "ssrcGroups",
|
|
6129
|
+
// token-char = %x21 / %x23-27 / %x2A-2B / %x2D-2E / %x30-39 / %x41-5A / %x5E-7E
|
|
6130
|
+
reg: /^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,
|
|
6131
|
+
names: ["semantics", "ssrcs"],
|
|
6132
|
+
format: "ssrc-group:%s %s"
|
|
6133
|
+
},
|
|
6134
|
+
{
|
|
6135
|
+
// a=msid-semantic: WMS Jvlam5X3SX1OP6pn20zWogvaKJz5Hjf9OnlV
|
|
6136
|
+
name: "msidSemantic",
|
|
6137
|
+
reg: /^msid-semantic:\s?(\w*) (\S*)/,
|
|
6138
|
+
names: ["semantic", "token"],
|
|
6139
|
+
format: "msid-semantic: %s %s"
|
|
6140
|
+
// space after ':' is not accidental
|
|
6141
|
+
},
|
|
6142
|
+
{
|
|
6143
|
+
// a=group:BUNDLE audio video
|
|
6144
|
+
push: "groups",
|
|
6145
|
+
reg: /^group:(\w*) (.*)/,
|
|
6146
|
+
names: ["type", "mids"],
|
|
6147
|
+
format: "group:%s %s"
|
|
6148
|
+
},
|
|
6149
|
+
{
|
|
6150
|
+
// a=rtcp-mux
|
|
6151
|
+
name: "rtcpMux",
|
|
6152
|
+
reg: /^(rtcp-mux)/
|
|
6153
|
+
},
|
|
6154
|
+
{
|
|
6155
|
+
// a=rtcp-rsize
|
|
6156
|
+
name: "rtcpRsize",
|
|
6157
|
+
reg: /^(rtcp-rsize)/
|
|
6158
|
+
},
|
|
6159
|
+
{
|
|
6160
|
+
// a=sctpmap:5000 webrtc-datachannel 1024
|
|
6161
|
+
name: "sctpmap",
|
|
6162
|
+
reg: /^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,
|
|
6163
|
+
names: ["sctpmapNumber", "app", "maxMessageSize"],
|
|
6164
|
+
format: function($) {
|
|
6165
|
+
return $.maxMessageSize != null ? "sctpmap:%s %s %s" : "sctpmap:%s %s";
|
|
6166
|
+
}
|
|
6167
|
+
},
|
|
6168
|
+
{
|
|
6169
|
+
// a=x-google-flag:conference
|
|
6170
|
+
name: "xGoogleFlag",
|
|
6171
|
+
reg: /^x-google-flag:([^\s]*)/,
|
|
6172
|
+
format: "x-google-flag:%s"
|
|
6173
|
+
},
|
|
6174
|
+
{
|
|
6175
|
+
// a=rid:1 send max-width=1280;max-height=720;max-fps=30;depend=0
|
|
6176
|
+
push: "rids",
|
|
6177
|
+
reg: /^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,
|
|
6178
|
+
names: ["id", "direction", "params"],
|
|
6179
|
+
format: function($) {
|
|
6180
|
+
return $.params ? "rid:%s %s %s" : "rid:%s %s";
|
|
6181
|
+
}
|
|
6182
|
+
},
|
|
6183
|
+
{
|
|
6184
|
+
// a=imageattr:97 send [x=800,y=640,sar=1.1,q=0.6] [x=480,y=320] recv [x=330,y=250]
|
|
6185
|
+
// a=imageattr:* send [x=800,y=640] recv *
|
|
6186
|
+
// a=imageattr:100 recv [x=320,y=240]
|
|
6187
|
+
push: "imageattrs",
|
|
6188
|
+
reg: new RegExp(
|
|
6189
|
+
// a=imageattr:97
|
|
6190
|
+
"^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"
|
|
6191
|
+
),
|
|
6192
|
+
names: ["pt", "dir1", "attrs1", "dir2", "attrs2"],
|
|
6193
|
+
format: function($) {
|
|
6194
|
+
return "imageattr:%s %s %s" + ($.dir2 ? " %s %s" : "");
|
|
6195
|
+
}
|
|
6196
|
+
},
|
|
6197
|
+
{
|
|
6198
|
+
// a=simulcast:send 1,2,3;~4,~5 recv 6;~7,~8
|
|
6199
|
+
// a=simulcast:recv 1;4,5 send 6;7
|
|
6200
|
+
name: "simulcast",
|
|
6201
|
+
reg: new RegExp(
|
|
6202
|
+
// a=simulcast:
|
|
6203
|
+
"^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"
|
|
6204
|
+
),
|
|
6205
|
+
names: ["dir1", "list1", "dir2", "list2"],
|
|
6206
|
+
format: function($) {
|
|
6207
|
+
return "simulcast:%s %s" + ($.dir2 ? " %s %s" : "");
|
|
6208
|
+
}
|
|
6209
|
+
},
|
|
6210
|
+
{
|
|
6211
|
+
// old simulcast draft 03 (implemented by Firefox)
|
|
6212
|
+
// https://tools.ietf.org/html/draft-ietf-mmusic-sdp-simulcast-03
|
|
6213
|
+
// a=simulcast: recv pt=97;98 send pt=97
|
|
6214
|
+
// a=simulcast: send rid=5;6;7 paused=6,7
|
|
6215
|
+
name: "simulcast_03",
|
|
6216
|
+
reg: /^simulcast:[\s\t]+([\S+\s\t]+)$/,
|
|
6217
|
+
names: ["value"],
|
|
6218
|
+
format: "simulcast: %s"
|
|
6219
|
+
},
|
|
6220
|
+
{
|
|
6221
|
+
// a=framerate:25
|
|
6222
|
+
// a=framerate:29.97
|
|
6223
|
+
name: "framerate",
|
|
6224
|
+
reg: /^framerate:(\d+(?:$|\.\d+))/,
|
|
6225
|
+
format: "framerate:%s"
|
|
6226
|
+
},
|
|
6227
|
+
{
|
|
6228
|
+
// RFC4570
|
|
6229
|
+
// a=source-filter: incl IN IP4 239.5.2.31 10.1.15.5
|
|
6230
|
+
name: "sourceFilter",
|
|
6231
|
+
reg: /^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,
|
|
6232
|
+
names: ["filterMode", "netType", "addressTypes", "destAddress", "srcList"],
|
|
6233
|
+
format: "source-filter: %s %s %s %s %s"
|
|
6234
|
+
},
|
|
6235
|
+
{
|
|
6236
|
+
// a=bundle-only
|
|
6237
|
+
name: "bundleOnly",
|
|
6238
|
+
reg: /^(bundle-only)/
|
|
6239
|
+
},
|
|
6240
|
+
{
|
|
6241
|
+
// a=label:1
|
|
6242
|
+
name: "label",
|
|
6243
|
+
reg: /^label:(.+)/,
|
|
6244
|
+
format: "label:%s"
|
|
6245
|
+
},
|
|
6246
|
+
{
|
|
6247
|
+
// RFC version 26 for SCTP over DTLS
|
|
6248
|
+
// https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-26#section-5
|
|
6249
|
+
name: "sctpPort",
|
|
6250
|
+
reg: /^sctp-port:(\d+)$/,
|
|
6251
|
+
format: "sctp-port:%s"
|
|
6252
|
+
},
|
|
6253
|
+
{
|
|
6254
|
+
// RFC version 26 for SCTP over DTLS
|
|
6255
|
+
// https://tools.ietf.org/html/draft-ietf-mmusic-sctp-sdp-26#section-6
|
|
6256
|
+
name: "maxMessageSize",
|
|
6257
|
+
reg: /^max-message-size:(\d+)$/,
|
|
6258
|
+
format: "max-message-size:%s"
|
|
6259
|
+
},
|
|
6260
|
+
{
|
|
6261
|
+
// RFC7273
|
|
6262
|
+
// a=ts-refclk:ptp=IEEE1588-2008:39-A7-94-FF-FE-07-CB-D0:37
|
|
6263
|
+
push: "tsRefClocks",
|
|
6264
|
+
reg: /^ts-refclk:([^\s=]*)(?:=(\S*))?/,
|
|
6265
|
+
names: ["clksrc", "clksrcExt"],
|
|
6266
|
+
format: function($) {
|
|
6267
|
+
return "ts-refclk:%s" + ($.clksrcExt != null ? "=%s" : "");
|
|
6268
|
+
}
|
|
6269
|
+
},
|
|
6270
|
+
{
|
|
6271
|
+
// RFC7273
|
|
6272
|
+
// a=mediaclk:direct=963214424
|
|
6273
|
+
name: "mediaClk",
|
|
6274
|
+
reg: /^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,
|
|
6275
|
+
names: ["id", "mediaClockName", "mediaClockValue", "rateNumerator", "rateDenominator"],
|
|
6276
|
+
format: function($) {
|
|
6277
|
+
var u = "mediaclk:";
|
|
6278
|
+
return u += $.id != null ? "id=%s %s" : "%v%s", u += $.mediaClockValue != null ? "=%s" : "", u += $.rateNumerator != null ? " rate=%s" : "", u += $.rateDenominator != null ? "/%s" : "", u;
|
|
6279
|
+
}
|
|
6280
|
+
},
|
|
6281
|
+
{
|
|
6282
|
+
// a=keywds:keywords
|
|
6283
|
+
name: "keywords",
|
|
6284
|
+
reg: /^keywds:(.+)$/,
|
|
6285
|
+
format: "keywds:%s"
|
|
6286
|
+
},
|
|
6287
|
+
{
|
|
6288
|
+
// a=content:main
|
|
6289
|
+
name: "content",
|
|
6290
|
+
reg: /^content:(.+)/,
|
|
6291
|
+
format: "content:%s"
|
|
6292
|
+
},
|
|
6293
|
+
// BFCP https://tools.ietf.org/html/rfc4583
|
|
6294
|
+
{
|
|
6295
|
+
// a=floorctrl:c-s
|
|
6296
|
+
name: "bfcpFloorCtrl",
|
|
6297
|
+
reg: /^floorctrl:(c-only|s-only|c-s)/,
|
|
6298
|
+
format: "floorctrl:%s"
|
|
6299
|
+
},
|
|
6300
|
+
{
|
|
6301
|
+
// a=confid:1
|
|
6302
|
+
name: "bfcpConfId",
|
|
6303
|
+
reg: /^confid:(\d+)/,
|
|
6304
|
+
format: "confid:%s"
|
|
6305
|
+
},
|
|
6306
|
+
{
|
|
6307
|
+
// a=userid:1
|
|
6308
|
+
name: "bfcpUserId",
|
|
6309
|
+
reg: /^userid:(\d+)/,
|
|
6310
|
+
format: "userid:%s"
|
|
6311
|
+
},
|
|
6312
|
+
{
|
|
6313
|
+
// a=floorid:1
|
|
6314
|
+
name: "bfcpFloorId",
|
|
6315
|
+
reg: /^floorid:(.+) (?:m-stream|mstrm):(.+)/,
|
|
6316
|
+
names: ["id", "mStream"],
|
|
6317
|
+
format: "floorid:%s mstrm:%s"
|
|
6318
|
+
},
|
|
6319
|
+
{
|
|
6320
|
+
// any a= that we don't understand is kept verbatim on media.invalid
|
|
6321
|
+
push: "invalid",
|
|
6322
|
+
names: ["value"]
|
|
6421
6323
|
}
|
|
6422
|
-
|
|
6324
|
+
]
|
|
6325
|
+
};
|
|
6326
|
+
return Object.keys(s).forEach(function($) {
|
|
6327
|
+
var u = s[$];
|
|
6328
|
+
u.forEach(function(A) {
|
|
6329
|
+
A.reg || (A.reg = /(.*)/), A.format || (A.format = "%s");
|
|
6423
6330
|
});
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6331
|
+
}), grammar.exports;
|
|
6332
|
+
}
|
|
6333
|
+
var hasRequiredParser;
|
|
6334
|
+
function requireParser() {
|
|
6335
|
+
return hasRequiredParser || (hasRequiredParser = 1, function(s) {
|
|
6336
|
+
var $ = function(o) {
|
|
6337
|
+
return String(Number(o)) === o ? Number(o) : o;
|
|
6338
|
+
}, u = function(o, v, N, q) {
|
|
6339
|
+
if (q && !N)
|
|
6340
|
+
v[q] = $(o[1]);
|
|
6341
|
+
else
|
|
6342
|
+
for (var U = 0; U < N.length; U += 1)
|
|
6343
|
+
o[U + 1] != null && (v[N[U]] = $(o[U + 1]));
|
|
6344
|
+
}, A = function(o, v, N) {
|
|
6345
|
+
var q = o.name && o.names;
|
|
6346
|
+
o.push && !v[o.push] ? v[o.push] = [] : q && !v[o.name] && (v[o.name] = {});
|
|
6347
|
+
var U = o.push ? {} : (
|
|
6348
|
+
// blank object that will be pushed
|
|
6349
|
+
q ? v[o.name] : v
|
|
6350
|
+
);
|
|
6351
|
+
u(N.match(o.reg), U, o.names, o.name), o.push && v[o.push].push(U);
|
|
6352
|
+
}, h = requireGrammar(), k = RegExp.prototype.test.bind(/^([a-z])=(.*)/);
|
|
6353
|
+
s.parse = function(o) {
|
|
6354
|
+
var v = {}, N = [], q = v;
|
|
6355
|
+
return o.split(/(\r\n|\r|\n)/).filter(k).forEach(function(U) {
|
|
6356
|
+
var D = U[0], L = U.slice(2);
|
|
6357
|
+
D === "m" && (N.push({ rtp: [], fmtp: [] }), q = N[N.length - 1]);
|
|
6358
|
+
for (var Z = 0; Z < (h[D] || []).length; Z += 1) {
|
|
6359
|
+
var K = h[D][Z];
|
|
6360
|
+
if (K.reg.test(L))
|
|
6361
|
+
return A(K, q, L);
|
|
6362
|
+
}
|
|
6363
|
+
}), v.media = N, v;
|
|
6364
|
+
};
|
|
6365
|
+
var t = function(o, v) {
|
|
6366
|
+
var N = v.split(/=(.+)/, 2);
|
|
6367
|
+
return N.length === 2 ? o[N[0]] = $(N[1]) : N.length === 1 && v.length > 1 && (o[N[0]] = void 0), o;
|
|
6368
|
+
};
|
|
6369
|
+
s.parseParams = function(o) {
|
|
6370
|
+
return o.split(/;\s?/).reduce(t, {});
|
|
6371
|
+
}, s.parseFmtpConfig = s.parseParams, s.parsePayloads = function(o) {
|
|
6372
|
+
return o.toString().split(" ").map(Number);
|
|
6373
|
+
}, s.parseRemoteCandidates = function(o) {
|
|
6374
|
+
for (var v = [], N = o.split(" ").map($), q = 0; q < N.length; q += 3)
|
|
6375
|
+
v.push({
|
|
6376
|
+
component: N[q],
|
|
6377
|
+
ip: N[q + 1],
|
|
6378
|
+
port: N[q + 2]
|
|
6379
|
+
});
|
|
6380
|
+
return v;
|
|
6381
|
+
}, s.parseImageAttributes = function(o) {
|
|
6382
|
+
return o.split(" ").map(function(v) {
|
|
6383
|
+
return v.substring(1, v.length - 1).split(",").reduce(t, {});
|
|
6438
6384
|
});
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6385
|
+
}, s.parseSimulcastStreamList = function(o) {
|
|
6386
|
+
return o.split(";").map(function(v) {
|
|
6387
|
+
return v.split(",").map(function(N) {
|
|
6388
|
+
var q, U = !1;
|
|
6389
|
+
return N[0] !== "~" ? q = $(N) : (q = $(N.substring(1, N.length)), U = !0), {
|
|
6390
|
+
scid: q,
|
|
6391
|
+
paused: U
|
|
6392
|
+
};
|
|
6393
|
+
});
|
|
6394
|
+
});
|
|
6395
|
+
};
|
|
6396
|
+
}(parser)), parser;
|
|
6397
|
+
}
|
|
6398
|
+
var writer, hasRequiredWriter;
|
|
6399
|
+
function requireWriter() {
|
|
6400
|
+
if (hasRequiredWriter) return writer;
|
|
6401
|
+
hasRequiredWriter = 1;
|
|
6402
|
+
var s = requireGrammar(), $ = /%[sdv%]/g, u = function(t) {
|
|
6403
|
+
var o = 1, v = arguments, N = v.length;
|
|
6404
|
+
return t.replace($, function(q) {
|
|
6405
|
+
if (o >= N)
|
|
6406
|
+
return q;
|
|
6407
|
+
var U = v[o];
|
|
6408
|
+
switch (o += 1, q) {
|
|
6409
|
+
case "%%":
|
|
6410
|
+
return "%";
|
|
6411
|
+
case "%s":
|
|
6412
|
+
return String(U);
|
|
6413
|
+
case "%d":
|
|
6414
|
+
return Number(U);
|
|
6415
|
+
case "%v":
|
|
6416
|
+
return "";
|
|
6417
|
+
}
|
|
6467
6418
|
});
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
else {
|
|
6475
|
-
const u = Object.keys(G(this, ut));
|
|
6476
|
-
for (const A of u)
|
|
6477
|
-
G(this, ut)[A] = G(this, ut)[A].filter((h) => !$.includes(h.sn || ""));
|
|
6419
|
+
}, A = function(t, o, v) {
|
|
6420
|
+
var N = o.format instanceof Function ? o.format(o.push ? v : v[o.name]) : o.format, q = [t + "=" + N];
|
|
6421
|
+
if (o.names)
|
|
6422
|
+
for (var U = 0; U < o.names.length; U += 1) {
|
|
6423
|
+
var D = o.names[U];
|
|
6424
|
+
o.name ? q.push(v[o.name][D]) : q.push(v[o.names[U]]);
|
|
6478
6425
|
}
|
|
6479
|
-
|
|
6426
|
+
else
|
|
6427
|
+
q.push(v[o.name]);
|
|
6428
|
+
return u.apply(null, q);
|
|
6429
|
+
}, h = [
|
|
6430
|
+
"v",
|
|
6431
|
+
"o",
|
|
6432
|
+
"s",
|
|
6433
|
+
"i",
|
|
6434
|
+
"u",
|
|
6435
|
+
"e",
|
|
6436
|
+
"p",
|
|
6437
|
+
"c",
|
|
6438
|
+
"b",
|
|
6439
|
+
"t",
|
|
6440
|
+
"r",
|
|
6441
|
+
"z",
|
|
6442
|
+
"a"
|
|
6443
|
+
], k = ["i", "c", "b", "a"];
|
|
6444
|
+
return writer = function(t, o) {
|
|
6445
|
+
o = o || {}, t.version == null && (t.version = 0), t.name == null && (t.name = " "), t.media.forEach(function(U) {
|
|
6446
|
+
U.payloads == null && (U.payloads = "");
|
|
6480
6447
|
});
|
|
6481
|
-
|
|
6482
|
-
|
|
6448
|
+
var v = o.outerOrder || h, N = o.innerOrder || k, q = [];
|
|
6449
|
+
return v.forEach(function(U) {
|
|
6450
|
+
s[U].forEach(function(D) {
|
|
6451
|
+
D.name in t && t[D.name] != null ? q.push(A(U, D, t)) : D.push in t && t[D.push] != null && t[D.push].forEach(function(L) {
|
|
6452
|
+
q.push(A(U, D, L));
|
|
6453
|
+
});
|
|
6454
|
+
});
|
|
6455
|
+
}), t.media.forEach(function(U) {
|
|
6456
|
+
q.push(A("m", s.m[0], U)), N.forEach(function(D) {
|
|
6457
|
+
s[D].forEach(function(L) {
|
|
6458
|
+
L.name in U && U[L.name] != null ? q.push(A(D, L, U)) : L.push in U && U[L.push] != null && U[L.push].forEach(function(Z) {
|
|
6459
|
+
q.push(A(D, L, Z));
|
|
6460
|
+
});
|
|
6461
|
+
});
|
|
6462
|
+
});
|
|
6463
|
+
}), q.join(`\r
|
|
6464
|
+
`) + `\r
|
|
6465
|
+
`;
|
|
6466
|
+
}, writer;
|
|
6467
|
+
}
|
|
6468
|
+
var hasRequiredLib;
|
|
6469
|
+
function requireLib() {
|
|
6470
|
+
if (hasRequiredLib) return lib;
|
|
6471
|
+
hasRequiredLib = 1;
|
|
6472
|
+
var s = requireParser(), $ = requireWriter(), u = requireGrammar();
|
|
6473
|
+
return lib.grammar = u, lib.write = $, lib.parse = s.parse, lib.parseParams = s.parseParams, lib.parseFmtpConfig = s.parseFmtpConfig, lib.parsePayloads = s.parsePayloads, lib.parseRemoteCandidates = s.parseRemoteCandidates, lib.parseImageAttributes = s.parseImageAttributes, lib.parseSimulcastStreamList = s.parseSimulcastStreamList, lib;
|
|
6483
6474
|
}
|
|
6484
|
-
|
|
6475
|
+
var libExports = requireLib();
|
|
6476
|
+
const enum_roomState = {
|
|
6477
|
+
ready: "已就绪",
|
|
6478
|
+
checkAuth: "正在鉴权",
|
|
6479
|
+
connect: "连接中",
|
|
6480
|
+
connected: "已连接",
|
|
6481
|
+
reconnect: "正在重新连接",
|
|
6482
|
+
disconnected: "已断开"
|
|
6483
|
+
};
|
|
6484
|
+
at(enum_roomState);
|
|
6485
6485
|
class AudioMediaStreamContext {
|
|
6486
6486
|
constructor($) {
|
|
6487
|
-
|
|
6487
|
+
W(this, "options", {
|
|
6488
6488
|
autoGainControl: !1,
|
|
6489
6489
|
// 自动增益
|
|
6490
6490
|
noiseSuppression: !1,
|
|
@@ -6492,28 +6492,28 @@ class AudioMediaStreamContext {
|
|
|
6492
6492
|
echoCancellation: !1
|
|
6493
6493
|
// 回声消除
|
|
6494
6494
|
});
|
|
6495
|
-
|
|
6496
|
-
|
|
6495
|
+
W(this, "stream");
|
|
6496
|
+
W(this, "audio", new Audio());
|
|
6497
6497
|
// @ts-ignore 音频上下文
|
|
6498
|
-
|
|
6498
|
+
W(this, "audioContext", new (window.AudioContext || window.webkitAudioContext)());
|
|
6499
6499
|
// 媒体流音频源节点
|
|
6500
|
-
|
|
6500
|
+
W(this, "mediaStreamAudioSourceNode");
|
|
6501
6501
|
// 增益节点 (自动增益)
|
|
6502
|
-
|
|
6502
|
+
W(this, "autoGainNode");
|
|
6503
6503
|
// 滤波器节点 (噪声抑制)
|
|
6504
|
-
|
|
6504
|
+
W(this, "biquadFilterNode");
|
|
6505
6505
|
// 延迟节点 (回声消除)
|
|
6506
|
-
|
|
6506
|
+
W(this, "delayNode");
|
|
6507
6507
|
// 增益节点 (音量控制)
|
|
6508
|
-
|
|
6508
|
+
W(this, "gainNode");
|
|
6509
6509
|
// 音频分析节点
|
|
6510
|
-
|
|
6510
|
+
W(this, "analyserNode");
|
|
6511
6511
|
// 缓冲区 存储分析节点的时域数据
|
|
6512
|
-
|
|
6512
|
+
W(this, "analyserArrayData");
|
|
6513
6513
|
/**
|
|
6514
6514
|
* 停止
|
|
6515
6515
|
*/
|
|
6516
|
-
|
|
6516
|
+
W(this, "stop", () => {
|
|
6517
6517
|
const $ = this.stream.getTracks();
|
|
6518
6518
|
for (const u of $)
|
|
6519
6519
|
u.enabled = !1, u.stop(), this.stream.removeTrack(u);
|
|
@@ -6521,23 +6521,23 @@ class AudioMediaStreamContext {
|
|
|
6521
6521
|
/**
|
|
6522
6522
|
* 获取数据流
|
|
6523
6523
|
*/
|
|
6524
|
-
|
|
6524
|
+
W(this, "getStream", async () => this.mediaStreamAudioSourceNode.mediaStream);
|
|
6525
6525
|
/**
|
|
6526
6526
|
* 静音
|
|
6527
6527
|
*/
|
|
6528
|
-
|
|
6528
|
+
W(this, "setMute", ($ = !0) => {
|
|
6529
6529
|
$ ? this.analyserNode.disconnect(this.audioContext.destination) : this.analyserNode.connect(this.audioContext.destination);
|
|
6530
6530
|
});
|
|
6531
6531
|
/**
|
|
6532
6532
|
* 设置音量
|
|
6533
6533
|
*/
|
|
6534
|
-
|
|
6534
|
+
W(this, "setVolumeGain", ($) => {
|
|
6535
6535
|
this.gainNode.gain.setValueAtTime($, this.audioContext.currentTime);
|
|
6536
6536
|
});
|
|
6537
6537
|
/**
|
|
6538
6538
|
* 获取音量
|
|
6539
6539
|
*/
|
|
6540
|
-
|
|
6540
|
+
W(this, "getVolume", () => {
|
|
6541
6541
|
const { analyserNode: $, analyserArrayData: u } = this;
|
|
6542
6542
|
$.getByteFrequencyData(u);
|
|
6543
6543
|
let A = 0;
|
|
@@ -6548,7 +6548,7 @@ class AudioMediaStreamContext {
|
|
|
6548
6548
|
/**
|
|
6549
6549
|
* 设置音频过滤
|
|
6550
6550
|
*/
|
|
6551
|
-
|
|
6551
|
+
W(this, "setFilter", async ($ = {}) => {
|
|
6552
6552
|
this.options = { ...this.options, ...$ };
|
|
6553
6553
|
const { autoGainControl: u, noiseSuppression: A, echoCancellation: h } = this.options, { mediaStreamAudioSourceNode: k, autoGainNode: t, biquadFilterNode: o, delayNode: v, gainNode: N } = this, q = k;
|
|
6554
6554
|
return u && q.connect(t), A && q.connect(o), h && q.connect(v), q.connect(N), $;
|
|
@@ -6560,11 +6560,11 @@ class AudioMediaStreamContext {
|
|
|
6560
6560
|
}
|
|
6561
6561
|
class VideoMediaStreamContext {
|
|
6562
6562
|
constructor($) {
|
|
6563
|
-
|
|
6563
|
+
W(this, "stream");
|
|
6564
6564
|
/**
|
|
6565
6565
|
* 停止
|
|
6566
6566
|
*/
|
|
6567
|
-
|
|
6567
|
+
W(this, "stop", () => {
|
|
6568
6568
|
const $ = this.stream.getTracks();
|
|
6569
6569
|
for (const u of $)
|
|
6570
6570
|
u.enabled = !1, u.stop(), this.stream.removeTrack(u);
|
|
@@ -6572,24 +6572,24 @@ class VideoMediaStreamContext {
|
|
|
6572
6572
|
/**
|
|
6573
6573
|
* 获取数据流
|
|
6574
6574
|
*/
|
|
6575
|
-
|
|
6575
|
+
W(this, "getStream", async () => this.stream);
|
|
6576
6576
|
this.stream = $;
|
|
6577
6577
|
}
|
|
6578
6578
|
}
|
|
6579
6579
|
class MediaStreams {
|
|
6580
6580
|
// 视频媒体流上下文
|
|
6581
6581
|
constructor() {
|
|
6582
|
-
|
|
6582
|
+
W(this, "audioMediaStreamContextMap", /* @__PURE__ */ new Map());
|
|
6583
6583
|
// 音频媒体流上下文
|
|
6584
|
-
|
|
6584
|
+
W(this, "videoMediaStreamContextMap", /* @__PURE__ */ new Map());
|
|
6585
6585
|
/**
|
|
6586
6586
|
* 获取key
|
|
6587
6587
|
*/
|
|
6588
|
-
|
|
6588
|
+
W(this, "getUserMediaKey", ($, u) => `${$}-${u}`);
|
|
6589
6589
|
/**
|
|
6590
6590
|
* 判断用户媒体类型
|
|
6591
6591
|
*/
|
|
6592
|
-
|
|
6592
|
+
W(this, "getUserMediaKind", ($) => {
|
|
6593
6593
|
let u = "";
|
|
6594
6594
|
switch ($) {
|
|
6595
6595
|
// 音频媒体处理
|
|
@@ -6608,24 +6608,27 @@ class MediaStreams {
|
|
|
6608
6608
|
/**
|
|
6609
6609
|
* 设置媒体参数
|
|
6610
6610
|
*/
|
|
6611
|
-
|
|
6612
|
-
const
|
|
6613
|
-
|
|
6614
|
-
const
|
|
6615
|
-
|
|
6611
|
+
W(this, "setConstraints", async ($, u, A) => {
|
|
6612
|
+
const h = await this.getUserStream($, u), k = h.getTracks();
|
|
6613
|
+
if (k.length !== 0) {
|
|
6614
|
+
for (const t of k) {
|
|
6615
|
+
const v = { ...t.getConstraints(), ...A };
|
|
6616
|
+
await t.applyConstraints(v);
|
|
6617
|
+
}
|
|
6618
|
+
await this.initUserMediaStreamContext($, u, h);
|
|
6616
6619
|
}
|
|
6617
6620
|
});
|
|
6618
6621
|
/**
|
|
6619
6622
|
* 删除用户处理上下文
|
|
6620
6623
|
*/
|
|
6621
|
-
|
|
6624
|
+
W(this, "removeUserMediaStreamContext", ($, u) => {
|
|
6622
6625
|
const A = this.getUserMediaKey($, u);
|
|
6623
6626
|
this.audioMediaStreamContextMap.delete(A), this.videoMediaStreamContextMap.delete(A);
|
|
6624
6627
|
});
|
|
6625
6628
|
/**
|
|
6626
6629
|
* 初始化用户媒体上下文
|
|
6627
6630
|
*/
|
|
6628
|
-
|
|
6631
|
+
W(this, "initUserMediaStreamContext", async ($, u, A) => {
|
|
6629
6632
|
const h = this.getUserMediaKey($, u);
|
|
6630
6633
|
if (A.getTracks().length === 0) {
|
|
6631
6634
|
console.warn("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: tracks.length is 0.", { userId: $, mediaType: u, stream: A });
|
|
@@ -6651,7 +6654,7 @@ class MediaStreams {
|
|
|
6651
6654
|
/**
|
|
6652
6655
|
* 获取某个用户的某个数据流
|
|
6653
6656
|
*/
|
|
6654
|
-
|
|
6657
|
+
W(this, "getUserStream", async ($, u) => {
|
|
6655
6658
|
const A = this.getUserMediaKey($, u), h = this.getUserMediaKind(u);
|
|
6656
6659
|
let k;
|
|
6657
6660
|
switch (h) {
|
|
@@ -6675,7 +6678,7 @@ class MediaStreams {
|
|
|
6675
6678
|
/**
|
|
6676
6679
|
* 获取某个用户的全部数据流
|
|
6677
6680
|
*/
|
|
6678
|
-
|
|
6681
|
+
W(this, "getUserStreams", async ($) => {
|
|
6679
6682
|
const u = {};
|
|
6680
6683
|
for (const A of mediaType_keys) {
|
|
6681
6684
|
const h = await this.getUserStream($, A);
|
|
@@ -6686,7 +6689,7 @@ class MediaStreams {
|
|
|
6686
6689
|
/**
|
|
6687
6690
|
* 删除某个用户的某个数据流
|
|
6688
6691
|
*/
|
|
6689
|
-
|
|
6692
|
+
W(this, "removeUserStreams", async ($, u = []) => {
|
|
6690
6693
|
u.length === 0 && (u = mediaType_keys);
|
|
6691
6694
|
for (const A of u) {
|
|
6692
6695
|
const h = await this.getUserStream($, A);
|
|
@@ -6696,7 +6699,7 @@ class MediaStreams {
|
|
|
6696
6699
|
/**
|
|
6697
6700
|
* 清除所有媒体流使用
|
|
6698
6701
|
*/
|
|
6699
|
-
|
|
6702
|
+
W(this, "clearUserStreams", async () => {
|
|
6700
6703
|
{
|
|
6701
6704
|
const $ = this.audioMediaStreamContextMap.values();
|
|
6702
6705
|
for (const u of $)
|
|
@@ -6711,7 +6714,7 @@ class MediaStreams {
|
|
|
6711
6714
|
/**
|
|
6712
6715
|
* 停止媒体流
|
|
6713
6716
|
*/
|
|
6714
|
-
|
|
6717
|
+
W(this, "stopStream", async ($) => {
|
|
6715
6718
|
const u = $.getTracks();
|
|
6716
6719
|
for (const A of u)
|
|
6717
6720
|
A.enabled = !1, A.stop(), $.removeTrack(A);
|
|
@@ -6756,7 +6759,7 @@ const getTrackNamesFormTracks = (s, $ = [], u = "trackName") => {
|
|
|
6756
6759
|
class RoomBase extends MediaStreams {
|
|
6757
6760
|
constructor() {
|
|
6758
6761
|
super();
|
|
6759
|
-
|
|
6762
|
+
W(this, "options", {
|
|
6760
6763
|
appid: "",
|
|
6761
6764
|
sdkToken: "",
|
|
6762
6765
|
roomId: "",
|
|
@@ -6764,17 +6767,17 @@ class RoomBase extends MediaStreams {
|
|
|
6764
6767
|
callType: 0,
|
|
6765
6768
|
autoSubscribe: !0
|
|
6766
6769
|
});
|
|
6767
|
-
|
|
6768
|
-
|
|
6770
|
+
W(this, "tools", tools);
|
|
6771
|
+
W(this, "state", "ready");
|
|
6769
6772
|
// 房间状态
|
|
6770
|
-
|
|
6773
|
+
W(this, "createAt", Date.now());
|
|
6771
6774
|
// 创建时间
|
|
6772
|
-
|
|
6773
|
-
// SDK通讯实例
|
|
6774
|
-
|
|
6775
|
+
W(this, "cwsIns", new CallsWebSocket());
|
|
6776
|
+
// SDK通讯实例 // SDK通讯实例
|
|
6777
|
+
W(this, "loading", !1);
|
|
6775
6778
|
// 是否加载中 加载中不允许广播网络
|
|
6776
6779
|
// 设备错误信息
|
|
6777
|
-
|
|
6780
|
+
W(this, "mediaDevicesErrInfo", {
|
|
6778
6781
|
microphoneCamera_audio: "",
|
|
6779
6782
|
microphoneCamera_video: "",
|
|
6780
6783
|
screenSharing_video: "",
|
|
@@ -6783,14 +6786,14 @@ class RoomBase extends MediaStreams {
|
|
|
6783
6786
|
/**
|
|
6784
6787
|
* 获取房间信息
|
|
6785
6788
|
*/
|
|
6786
|
-
|
|
6789
|
+
W(this, "getRoomInfo", () => {
|
|
6787
6790
|
const { options: u, state: A, createAt: h } = this;
|
|
6788
6791
|
return { ...u, state: A, createAt: h };
|
|
6789
6792
|
});
|
|
6790
6793
|
/**
|
|
6791
6794
|
* 设置房间状态
|
|
6792
6795
|
*/
|
|
6793
|
-
|
|
6796
|
+
W(this, "setRoomState", (u) => {
|
|
6794
6797
|
this.state = u;
|
|
6795
6798
|
const A = enum_roomState[u], h = { state: u, stateStr: A };
|
|
6796
6799
|
this.cwsIns.emitNotify("onRoomState", { code: 200, data: h });
|
|
@@ -6798,60 +6801,56 @@ class RoomBase extends MediaStreams {
|
|
|
6798
6801
|
/**
|
|
6799
6802
|
* 设置属性
|
|
6800
6803
|
*/
|
|
6801
|
-
|
|
6804
|
+
W(this, "setOptions", (u) => {
|
|
6802
6805
|
const A = { ...this.options, ...u };
|
|
6803
6806
|
this.options = A;
|
|
6804
6807
|
});
|
|
6805
6808
|
/**
|
|
6806
6809
|
* 设置房间loading状态
|
|
6807
6810
|
*/
|
|
6808
|
-
|
|
6811
|
+
W(this, "setLoading", (u) => {
|
|
6809
6812
|
this.loading = u;
|
|
6810
6813
|
});
|
|
6811
6814
|
/**
|
|
6812
6815
|
* 获取媒体设备错误信息
|
|
6813
6816
|
*/
|
|
6814
|
-
|
|
6815
|
-
try {
|
|
6816
|
-
await navigator.mediaDevices.getUserMedia({ audio: !0 }).then((u) => this.stopStream(u));
|
|
6817
|
-
} catch (u) {
|
|
6818
|
-
this.mediaDevicesErrInfo.microphoneCamera_audio = u.message;
|
|
6819
|
-
}
|
|
6817
|
+
W(this, "getMediaDevicesErrInfo", async () => {
|
|
6820
6818
|
try {
|
|
6821
|
-
await navigator.mediaDevices.
|
|
6819
|
+
const u = await navigator.mediaDevices.enumerateDevices();
|
|
6820
|
+
u.find((h) => h.kind === "audioinput") || (this.mediaDevicesErrInfo.microphoneCamera_audio = "audioinput is not available."), u.find((h) => h.kind === "videoinput") || (this.mediaDevicesErrInfo.microphoneCamera_video = "videoinput is not available.");
|
|
6822
6821
|
} catch (u) {
|
|
6823
|
-
|
|
6822
|
+
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe:error", u);
|
|
6824
6823
|
}
|
|
6825
6824
|
return this.mediaDevicesErrInfo;
|
|
6826
6825
|
});
|
|
6827
|
-
this.cwsIns = new CallsWebSocket({ ...this.options, debug: !0 });
|
|
6828
6826
|
}
|
|
6829
6827
|
}
|
|
6830
6828
|
class RoomUsers extends RoomBase {
|
|
6831
6829
|
// 用户
|
|
6832
6830
|
constructor() {
|
|
6833
6831
|
super();
|
|
6834
|
-
|
|
6832
|
+
W(this, "userMap", /* @__PURE__ */ new Map());
|
|
6835
6833
|
/**
|
|
6836
6834
|
* 清除房间所有用户
|
|
6837
6835
|
*/
|
|
6838
|
-
|
|
6836
|
+
W(this, "clearUsers", () => {
|
|
6839
6837
|
this.userMap = /* @__PURE__ */ new Map();
|
|
6840
6838
|
});
|
|
6841
6839
|
/**
|
|
6842
6840
|
* 删除用户
|
|
6843
6841
|
*/
|
|
6844
|
-
|
|
6842
|
+
W(this, "removeUsers", async (u) => {
|
|
6845
6843
|
for (const A of u)
|
|
6846
6844
|
this.userMap.delete(A);
|
|
6847
6845
|
});
|
|
6848
6846
|
/**
|
|
6849
6847
|
* 创建一个用户
|
|
6850
6848
|
*/
|
|
6851
|
-
|
|
6849
|
+
W(this, "createUser", async (u) => {
|
|
6852
6850
|
const A = Date.now(), h = {
|
|
6853
6851
|
id: u,
|
|
6854
6852
|
callAction: 0,
|
|
6853
|
+
permissions: 0,
|
|
6855
6854
|
callActionMap: {
|
|
6856
6855
|
microphoneCamera_audio: !1,
|
|
6857
6856
|
microphoneCamera_video: !1,
|
|
@@ -6859,7 +6858,6 @@ class RoomUsers extends RoomBase {
|
|
|
6859
6858
|
screenSharing_audio: !1
|
|
6860
6859
|
},
|
|
6861
6860
|
callState: 0,
|
|
6862
|
-
loading: !1,
|
|
6863
6861
|
isSelf: u === this.options.userId,
|
|
6864
6862
|
joinTime: A,
|
|
6865
6863
|
updateAt: A,
|
|
@@ -6877,11 +6875,11 @@ class RoomUsers extends RoomBase {
|
|
|
6877
6875
|
/**
|
|
6878
6876
|
* 获取某个用户
|
|
6879
6877
|
*/
|
|
6880
|
-
|
|
6878
|
+
W(this, "getUser", async (u) => (this.userMap.has(u) || await this.createUser(u), this.userMap.get(u)));
|
|
6881
6879
|
/**
|
|
6882
6880
|
* 获取某些用户
|
|
6883
6881
|
*/
|
|
6884
|
-
|
|
6882
|
+
W(this, "getUsers", async (u = []) => {
|
|
6885
6883
|
u.length === 0 && (u = [...this.userMap.keys()]);
|
|
6886
6884
|
const A = [];
|
|
6887
6885
|
for (const h of u) {
|
|
@@ -6893,26 +6891,17 @@ class RoomUsers extends RoomBase {
|
|
|
6893
6891
|
/**
|
|
6894
6892
|
* 获取房间全部用户id
|
|
6895
6893
|
*/
|
|
6896
|
-
|
|
6894
|
+
W(this, "getUsersId", async () => [...this.userMap.keys()]);
|
|
6897
6895
|
/**
|
|
6898
6896
|
* 获取房间的访问者
|
|
6899
6897
|
*/
|
|
6900
|
-
|
|
6901
|
-
/**
|
|
6902
|
-
* 设置用户加载状态
|
|
6903
|
-
*/
|
|
6904
|
-
K(this, "setUsersLoading", async (u, A = !0) => {
|
|
6905
|
-
for (const h of u) {
|
|
6906
|
-
const k = await this.getUser(h);
|
|
6907
|
-
k.loading = A;
|
|
6908
|
-
}
|
|
6909
|
-
});
|
|
6898
|
+
W(this, "getCaller", async () => await this.getUser(this.options.userId));
|
|
6910
6899
|
/**
|
|
6911
6900
|
* 更新用户轨道
|
|
6912
6901
|
*/
|
|
6913
|
-
|
|
6902
|
+
W(this, "updateUsertracks", async (u, A = [], h = !0) => {
|
|
6914
6903
|
const k = await this.getUser(u);
|
|
6915
|
-
h && (A = [...k.tracks, ...A]), A = st(A, ["type"]), A = A.filter(({ mid: v = "" }) => v !== "");
|
|
6904
|
+
h && (A = [...k.tracks, ...A]), A = A.sort((v) => v.msid ? 1 : -1), A = st(A, ["type"]), A = A.filter(({ mid: v = "" }) => v !== "");
|
|
6916
6905
|
for (const v of A)
|
|
6917
6906
|
v.userId = u, v.mediaType = mediaType_keys[v.type], v.enabled === void 0 && (v.enabled = !0);
|
|
6918
6907
|
k.updateStreams = {
|
|
@@ -6943,39 +6932,46 @@ class RoomUsers extends RoomBase {
|
|
|
6943
6932
|
/**
|
|
6944
6933
|
* 更新用户会话状态
|
|
6945
6934
|
*/
|
|
6946
|
-
|
|
6935
|
+
W(this, "updateUserCallAction", async (u, A = 0) => {
|
|
6947
6936
|
const h = await this.getUser(u);
|
|
6948
6937
|
h.callAction = A, h.callActionMap = this.tools.getCallActionMap(A);
|
|
6949
6938
|
});
|
|
6950
6939
|
/**
|
|
6951
6940
|
* 更新用户网络信息
|
|
6952
6941
|
*/
|
|
6953
|
-
|
|
6942
|
+
W(this, "updateUserNetwork", async (u, A = { egress: 5, ingress: 5 }) => {
|
|
6954
6943
|
const h = await this.getUser(u);
|
|
6955
6944
|
h.network = A;
|
|
6956
6945
|
});
|
|
6946
|
+
/**
|
|
6947
|
+
* 更新用户权限
|
|
6948
|
+
*/
|
|
6949
|
+
W(this, "updateUserPermissions", async (u, A) => {
|
|
6950
|
+
const h = await this.getUser(u);
|
|
6951
|
+
h.permissions = A;
|
|
6952
|
+
});
|
|
6957
6953
|
/**
|
|
6958
6954
|
* 更新用户基本信息
|
|
6959
6955
|
*/
|
|
6960
|
-
|
|
6956
|
+
W(this, "updateUserBase", async (u) => {
|
|
6961
6957
|
const A = await this.getUser(u);
|
|
6962
6958
|
A.isSelf = u === this.options.userId, A.updateAt = Date.now();
|
|
6963
6959
|
});
|
|
6964
6960
|
/**
|
|
6965
6961
|
* 更新多个用户信息
|
|
6966
6962
|
*/
|
|
6967
|
-
|
|
6963
|
+
W(this, "updateUsers", async (u) => {
|
|
6968
6964
|
for (const A of u) {
|
|
6969
|
-
const { id: h, tracks: k, callAction: t } = A;
|
|
6970
|
-
await this.updateUserBase(h), await this.updateUsertracks(h, k), await this.updateUserCallAction(h, t), await this.updateUserNetwork(h);
|
|
6965
|
+
const { id: h, tracks: k, callAction: t, permissions: o } = A;
|
|
6966
|
+
await this.updateUserBase(h), await this.updateUserPermissions(h, o), await this.updateUsertracks(h, k), await this.updateUserCallAction(h, t), await this.updateUserNetwork(h);
|
|
6971
6967
|
}
|
|
6972
6968
|
});
|
|
6973
6969
|
/**
|
|
6974
6970
|
* 广播用户变化
|
|
6975
6971
|
*/
|
|
6976
|
-
|
|
6972
|
+
W(this, "emitNotifyUpdateUsers", async () => {
|
|
6977
6973
|
if (this.loading) return;
|
|
6978
|
-
const u = await this.getUsers(), A = ot(u, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionMap", "network", "updateStreams", "
|
|
6974
|
+
const u = await this.getUsers(), A = ot(u, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionMap", "network", "updateStreams", "permissions"]);
|
|
6979
6975
|
this.cwsIns.emitNotify("onRoomUsers", { code: 200, data: A });
|
|
6980
6976
|
});
|
|
6981
6977
|
}
|
|
@@ -6986,14 +6982,14 @@ class RoomAudio extends RoomUsers {
|
|
|
6986
6982
|
/**
|
|
6987
6983
|
* 获取用户音频处理上下文
|
|
6988
6984
|
*/
|
|
6989
|
-
|
|
6985
|
+
W(this, "getUserAudioMediaStreamContext", (u, A) => {
|
|
6990
6986
|
const h = this.getUserMediaKey(u, A);
|
|
6991
6987
|
return this.audioMediaStreamContextMap.get(h);
|
|
6992
6988
|
});
|
|
6993
6989
|
/**
|
|
6994
6990
|
* 获取最大音量用户
|
|
6995
6991
|
*/
|
|
6996
|
-
|
|
6992
|
+
W(this, "getMaxVolumeUser", () => {
|
|
6997
6993
|
const u = Array.from(this.userMap.values(), ({ id: h }) => h);
|
|
6998
6994
|
if (u.length === 0) return;
|
|
6999
6995
|
let A = [];
|
|
@@ -7008,7 +7004,7 @@ class RoomAudio extends RoomUsers {
|
|
|
7008
7004
|
/**
|
|
7009
7005
|
* 设置音频过滤
|
|
7010
7006
|
*/
|
|
7011
|
-
|
|
7007
|
+
W(this, "setAudioFilter", async (u = {}) => {
|
|
7012
7008
|
const A = await this.getUsersId();
|
|
7013
7009
|
for (const h of A) {
|
|
7014
7010
|
{
|
|
@@ -7026,7 +7022,7 @@ class RoomAudio extends RoomUsers {
|
|
|
7026
7022
|
* @param userId
|
|
7027
7023
|
* @param mediaType
|
|
7028
7024
|
*/
|
|
7029
|
-
|
|
7025
|
+
W(this, "setVolume", (u, A, h) => {
|
|
7030
7026
|
const k = this.getUserAudioMediaStreamContext(u, A);
|
|
7031
7027
|
k == null || k.setVolumeGain(h);
|
|
7032
7028
|
});
|
|
@@ -7036,7 +7032,7 @@ class RoomAudio extends RoomUsers {
|
|
|
7036
7032
|
* @param mediaType
|
|
7037
7033
|
* @returns volume
|
|
7038
7034
|
*/
|
|
7039
|
-
|
|
7035
|
+
W(this, "getVolume", (u, A) => {
|
|
7040
7036
|
const h = this.getUserAudioMediaStreamContext(u, A);
|
|
7041
7037
|
return (h == null ? void 0 : h.getVolume()) || 0;
|
|
7042
7038
|
});
|
|
@@ -7046,12 +7042,12 @@ var xt, Nt;
|
|
|
7046
7042
|
class RoomPeer extends RoomAudio {
|
|
7047
7043
|
constructor() {
|
|
7048
7044
|
super();
|
|
7049
|
-
|
|
7050
|
-
|
|
7045
|
+
W(this, "peerIns", new RTCPeerConnection({ bundlePolicy: "max-bundle" }));
|
|
7046
|
+
W(this, "getPeerStatsTimer", 0);
|
|
7051
7047
|
// 获取报告的定时器
|
|
7052
|
-
|
|
7048
|
+
W(this, "reports", []);
|
|
7053
7049
|
// 通信网络质量
|
|
7054
|
-
|
|
7050
|
+
W(this, "peerNetwork", {
|
|
7055
7051
|
lostRate: "0",
|
|
7056
7052
|
// 丢包率
|
|
7057
7053
|
roundTripTime: "0",
|
|
@@ -7062,7 +7058,7 @@ class RoomPeer extends RoomAudio {
|
|
|
7062
7058
|
/**
|
|
7063
7059
|
* 创建 offter
|
|
7064
7060
|
*/
|
|
7065
|
-
|
|
7061
|
+
W(this, "createOffer", async () => {
|
|
7066
7062
|
var A;
|
|
7067
7063
|
const u = await this.peerIns.createOffer();
|
|
7068
7064
|
return u.sdp = (A = u.sdp) == null ? void 0 : A.replace("useinbandfec=1", "usedtx=1;useinbandfec=1"), u;
|
|
@@ -7070,21 +7066,21 @@ class RoomPeer extends RoomAudio {
|
|
|
7070
7066
|
/**
|
|
7071
7067
|
* 设置本地描述协议
|
|
7072
7068
|
*/
|
|
7073
|
-
|
|
7069
|
+
W(this, "setLocalDescription", async (u) => {
|
|
7074
7070
|
const A = new RTCSessionDescription(u);
|
|
7075
7071
|
return await this.peerIns.setLocalDescription(A), A;
|
|
7076
7072
|
});
|
|
7077
7073
|
/**
|
|
7078
7074
|
* 设置远程描述协议
|
|
7079
7075
|
*/
|
|
7080
|
-
|
|
7076
|
+
W(this, "setRemoteDescription", async (u) => {
|
|
7081
7077
|
const A = new RTCSessionDescription(u);
|
|
7082
7078
|
return await this.peerIns.setRemoteDescription(A), A;
|
|
7083
7079
|
});
|
|
7084
7080
|
/**
|
|
7085
7081
|
* 关闭某个用户的某些轨道
|
|
7086
7082
|
*/
|
|
7087
|
-
|
|
7083
|
+
W(this, "closeUserTracks", async (u, A = [], h = !1) => {
|
|
7088
7084
|
const k = this.tools.getTrackNamesFormTracks(A), t = (N) => k.includes(N), o = await this.getUser(u);
|
|
7089
7085
|
for (const N of o.tracks) {
|
|
7090
7086
|
const { userId: q, trackName: U, mediaType: D, msid: L } = N;
|
|
@@ -7109,14 +7105,14 @@ class RoomPeer extends RoomAudio {
|
|
|
7109
7105
|
/**
|
|
7110
7106
|
* 获取peer网络情况
|
|
7111
7107
|
*/
|
|
7112
|
-
|
|
7108
|
+
W(this, "getPeerNetwork", () => this.peerNetwork);
|
|
7113
7109
|
/**
|
|
7114
7110
|
* 设置通讯策略
|
|
7115
7111
|
* @param callStrategy "fixedPictureQuality" | "qualityPriority" | "fluencyPriority" | "balancedDowngrade"
|
|
7116
7112
|
* @param mediaTypes mediaType[] "microphoneCamera_audio" | "microphoneCamera_video" | "screenSharing_video" | "screenSharing_audio"
|
|
7117
7113
|
* @example quickvo.setCallStrategy('fixedPictureQuality')
|
|
7118
7114
|
*/
|
|
7119
|
-
|
|
7115
|
+
W(this, "setCallStrategy", async (u, A = []) => {
|
|
7120
7116
|
A.length === 0 && (A = mediaType_keys);
|
|
7121
7117
|
let h = "balanced";
|
|
7122
7118
|
switch (u) {
|
|
@@ -7145,11 +7141,15 @@ class RoomPeer extends RoomAudio {
|
|
|
7145
7141
|
* 设置 RTCRtpSender 参数
|
|
7146
7142
|
* @param parameters RTCRtpSendParameters
|
|
7147
7143
|
*/
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
const
|
|
7152
|
-
|
|
7144
|
+
W(this, "setRTCRtpSenderParameters", (u) => {
|
|
7145
|
+
try {
|
|
7146
|
+
const A = this.peerIns.getSenders();
|
|
7147
|
+
for (const h of A) {
|
|
7148
|
+
const k = h.getParameters();
|
|
7149
|
+
h.setParameters({ ...k, ...u });
|
|
7150
|
+
}
|
|
7151
|
+
} catch (A) {
|
|
7152
|
+
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setRTCRtpSenderParameters is error.", A);
|
|
7153
7153
|
}
|
|
7154
7154
|
});
|
|
7155
7155
|
/**
|
|
@@ -7172,16 +7172,16 @@ class RoomPeer extends RoomAudio {
|
|
|
7172
7172
|
const U = (q / N).toFixed(2), [D = "0"] = o, [L = "0"] = v, Z = { lostRate: U, roundTripTime: D, jitter: L };
|
|
7173
7173
|
JSON.stringify(Z) !== JSON.stringify(this.peerNetwork) && this.cwsIns.emitNotify("onRoomNetwork", { code: 200, data: Z }), this.peerNetwork = Z;
|
|
7174
7174
|
const H = (F, z, V) => {
|
|
7175
|
-
const J = Number(F), X = Number(z),
|
|
7175
|
+
const J = Number(F), X = Number(z), rt = Number(V);
|
|
7176
7176
|
let Y = "0";
|
|
7177
|
-
return J < 0.03 && X < 100 &&
|
|
7177
|
+
return J < 0.03 && X < 100 && rt < 0.05 ? Y = "5" : J < 0.06 && X < 160 && rt < 0.1 ? Y = "4" : J < 0.1 && X < 250 && rt < 0.15 ? Y = "3" : J < 0.15 && X < 400 && rt < 0.2 ? Y = "2" : Y = "1", Number(Y);
|
|
7178
7178
|
};
|
|
7179
7179
|
{
|
|
7180
7180
|
const F = H(U, D, L), z = await this.getCaller(), { network: V } = z, J = { egress: F, ingress: F }, X = JSON.stringify(V) !== JSON.stringify(J);
|
|
7181
7181
|
if (await this.updateUserNetwork(this.options.userId, J), X) {
|
|
7182
7182
|
this.emitNotifyUpdateUsers();
|
|
7183
|
-
const { userId:
|
|
7184
|
-
this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...J, userId:
|
|
7183
|
+
const { userId: rt, roomId: Y } = this.options;
|
|
7184
|
+
this.cwsIns.sendMessage({ event: "networkQualityChange", data: { ...J, userId: rt, roomId: Y } }, !1);
|
|
7185
7185
|
}
|
|
7186
7186
|
}
|
|
7187
7187
|
} catch (A) {
|
|
@@ -7201,6 +7201,7 @@ class RoomPeer extends RoomAudio {
|
|
|
7201
7201
|
});
|
|
7202
7202
|
});
|
|
7203
7203
|
}, A = async () => {
|
|
7204
|
+
if (this.peerIns.connectionState !== "connected") return;
|
|
7204
7205
|
const h = await this.getCaller(), { id: k, tracks: t } = h;
|
|
7205
7206
|
let o = [];
|
|
7206
7207
|
for (const v of t) {
|
|
@@ -7219,7 +7220,7 @@ class RoomPeer extends RoomAudio {
|
|
|
7219
7220
|
}
|
|
7220
7221
|
}
|
|
7221
7222
|
xt = new WeakMap(), Nt = new WeakMap();
|
|
7222
|
-
var
|
|
7223
|
+
var kt, At, qt, Dt, Ct, Ut;
|
|
7223
7224
|
class RoomCalls extends RoomPeer {
|
|
7224
7225
|
constructor() {
|
|
7225
7226
|
super();
|
|
@@ -7227,7 +7228,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7227
7228
|
* 销毁
|
|
7228
7229
|
* @example quickvo.destroy()
|
|
7229
7230
|
*/
|
|
7230
|
-
|
|
7231
|
+
W(this, "destroy", async () => {
|
|
7231
7232
|
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"), clearInterval(this.getPeerStatsTimer), this.clearUserStreams(), this.clearUsers(), await this.cwsIns.close();
|
|
7232
7233
|
});
|
|
7233
7234
|
/**
|
|
@@ -7235,7 +7236,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7235
7236
|
* @param notify Notify
|
|
7236
7237
|
* @returns sn
|
|
7237
7238
|
*/
|
|
7238
|
-
|
|
7239
|
+
W(this, "addNotify", (u) => this.cwsIns.addNotify(u));
|
|
7239
7240
|
/**
|
|
7240
7241
|
* 设置本地流
|
|
7241
7242
|
* @param mediaType MediaType
|
|
@@ -7243,7 +7244,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7243
7244
|
* @example quickvo.setLocalStream('microphoneCamera_audio', false)
|
|
7244
7245
|
* @returns Promise<Streams>
|
|
7245
7246
|
*/
|
|
7246
|
-
|
|
7247
|
+
W(this, "setLocalStream", (u, A) => new Promise(async (h, k) => {
|
|
7247
7248
|
try {
|
|
7248
7249
|
const { userId: t } = this.options, o = {
|
|
7249
7250
|
autoGainControl: !1,
|
|
@@ -7298,27 +7299,21 @@ class RoomCalls extends RoomPeer {
|
|
|
7298
7299
|
* @example quickvo.joinRoom({ userId: '', roomId: '', sdkToken: '', callType: '1', autoSubscribe: true })
|
|
7299
7300
|
* @returns Promise<boolean>
|
|
7300
7301
|
*/
|
|
7301
|
-
|
|
7302
|
+
W(this, "joinRoom", async (u) => new Promise(async (A, h) => {
|
|
7302
7303
|
try {
|
|
7303
|
-
this.setLoading(!0), this.setOptions(u), await G(this,
|
|
7304
|
-
const k
|
|
7305
|
-
|
|
7306
|
-
const q =
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
if (Z !== t) return h("加入的房间不匹配");
|
|
7317
|
-
if (await G(this, Dt).call(this), await this.syncRoomInfo(), G(this, kt).call(this, 0), k(), N)
|
|
7318
|
-
try {
|
|
7319
|
-
this.subscribe();
|
|
7320
|
-
} catch {
|
|
7321
|
-
}
|
|
7304
|
+
this.setLoading(!0), this.setOptions(u), await G(this, Dt).call(this), this.setRoomState("connect");
|
|
7305
|
+
const { roomId: k, userId: t, callType: o, autoSubscribe: v } = this.options;
|
|
7306
|
+
await this.cwsIns.sendMessage({ event: "joinRoom", data: { roomId: k, user: { id: t }, callType: o } }).then(async (N) => {
|
|
7307
|
+
const { code: q = 0, desc: U = "服务器繁忙", data: D } = N;
|
|
7308
|
+
if (q !== 200) return h(U);
|
|
7309
|
+
const { roomId: L = "" } = D;
|
|
7310
|
+
if (L !== k) return h("加入的房间不匹配");
|
|
7311
|
+
await G(this, qt).call(this), await this.syncRoomInfo(), G(this, kt).call(this, 0), v && await this.subscribe();
|
|
7312
|
+
{
|
|
7313
|
+
this.setLoading(!1), await this.emitNotifyUpdateUsers(), this.setRoomState("connected");
|
|
7314
|
+
const Z = await this.getUsers();
|
|
7315
|
+
A(Z);
|
|
7316
|
+
}
|
|
7322
7317
|
});
|
|
7323
7318
|
} catch (k) {
|
|
7324
7319
|
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe:error", k), h(`加入房间失败: ${k.message || k || "服务器繁忙"}`);
|
|
@@ -7329,7 +7324,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7329
7324
|
* @example quickvo.quitRoom()
|
|
7330
7325
|
* @returns Promise<boolean>
|
|
7331
7326
|
*/
|
|
7332
|
-
|
|
7327
|
+
W(this, "quitRoom", async () => new Promise(async (u, A) => {
|
|
7333
7328
|
try {
|
|
7334
7329
|
const { roomId: h, userId: k } = this.options, t = { roomId: h, user: { id: k } };
|
|
7335
7330
|
await this.stopPublish(), this.cwsIns.sendMessage({ event: "quitRoom", data: t }), await new Promise((o) => setTimeout(() => o(!0), 500)), this.cwsIns.emitNotify("onDestroy", { code: 200, data: {} }), u(!0);
|
|
@@ -7341,12 +7336,9 @@ class RoomCalls extends RoomPeer {
|
|
|
7341
7336
|
* 同步房间信息
|
|
7342
7337
|
* @example quickvo.syncRoomInfo()
|
|
7343
7338
|
*/
|
|
7344
|
-
|
|
7339
|
+
W(this, "syncRoomInfo", async () => new Promise(async (u, A) => {
|
|
7345
7340
|
const { userId: h } = this.options, { id: k = h, callAction: t = 0 } = await this.getUser(h);
|
|
7346
|
-
await this.cwsIns.sendMessage({
|
|
7347
|
-
event: "syncRoomInfo",
|
|
7348
|
-
data: { user: { id: k, callAction: t } }
|
|
7349
|
-
}).then(async (o) => {
|
|
7341
|
+
await this.cwsIns.sendMessage({ event: "syncRoomInfo", data: { user: { id: k, callAction: t } } }).then(async (o) => {
|
|
7350
7342
|
if (o.code !== 200) return A(o.desc);
|
|
7351
7343
|
const v = o.data.users, N = await this.getUsersId();
|
|
7352
7344
|
for (const q of N)
|
|
@@ -7365,24 +7357,19 @@ class RoomCalls extends RoomPeer {
|
|
|
7365
7357
|
* @example quickvo.publish(['microphoneCamera_audio', 'microphoneCamera_video'], 3)
|
|
7366
7358
|
* @returns Promise<RoomUser>
|
|
7367
7359
|
*/
|
|
7368
|
-
|
|
7360
|
+
W(this, "publish", (u, A = 3) => new Promise(async (h, k) => {
|
|
7369
7361
|
try {
|
|
7370
7362
|
const t = await this.getCaller();
|
|
7371
|
-
|
|
7363
|
+
this.setLoading(!0);
|
|
7372
7364
|
const o = [], v = [], N = async (H) => {
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
if (z.length === 0) throw new Error("tracks length is 0.");
|
|
7378
|
-
for (const V of z) {
|
|
7379
|
-
const { id: J, enabled: X } = V, et = mediaType_keys.findIndex((Y) => Y === H);
|
|
7380
|
-
o.push({ type: et, enabled: X, trackName: J, location: "local", mid: "" }), v.push(V);
|
|
7381
|
-
}
|
|
7365
|
+
const z = (await this.getUserStream(t.id, H)).getTracks();
|
|
7366
|
+
for (const V of z) {
|
|
7367
|
+
const { id: J, enabled: X } = V, rt = mediaType_keys.findIndex((Y) => Y === H);
|
|
7368
|
+
o.push({ type: rt, enabled: X, trackName: J, location: "local", mid: "" }), v.push(V);
|
|
7382
7369
|
}
|
|
7383
7370
|
};
|
|
7384
7371
|
for (const H of u)
|
|
7385
|
-
await N(H), H === "screenSharing_audio" && !u.includes("screenSharing_video") && await N("screenSharing_video");
|
|
7372
|
+
(await this.getUserStream(t.id, H)).getTracks().length === 0 && await this.setLocalStream(H, !0), await N(H), H === "screenSharing_audio" && !u.includes("screenSharing_video") && await N("screenSharing_video");
|
|
7386
7373
|
for (const H of v)
|
|
7387
7374
|
this.peerIns.addTransceiver(H, { direction: "sendonly" });
|
|
7388
7375
|
const q = await this.setLocalDescription(await this.createOffer()), U = this.peerIns.getTransceivers();
|
|
@@ -7398,13 +7385,13 @@ class RoomCalls extends RoomPeer {
|
|
|
7398
7385
|
}
|
|
7399
7386
|
const D = [...t.tracks, ...o], L = await this.tools.getCallAction(D), Z = async () => {
|
|
7400
7387
|
const H = await this.getCaller();
|
|
7401
|
-
this.setLoading(!1), await this.
|
|
7402
|
-
},
|
|
7388
|
+
this.setLoading(!1), await this.emitNotifyUpdateUsers(), h(H);
|
|
7389
|
+
}, K = async () => {
|
|
7403
7390
|
await this.cwsIns.sendMessage({ event: "publish", data: { sdp: q.sdp, tracks: o, callAction: L } }).then(async (H) => {
|
|
7404
7391
|
const { code: F = 0, desc: z, data: V } = H;
|
|
7405
7392
|
if (F !== 200) {
|
|
7406
7393
|
if (A > 0)
|
|
7407
|
-
return await new Promise((X) => setTimeout(() => X(!0), 300)), A = A - 1,
|
|
7394
|
+
return await new Promise((X) => setTimeout(() => X(!0), 300)), A = A - 1, K();
|
|
7408
7395
|
throw this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: publish is error. count 0", { mediaTypes: u }), new Error(z);
|
|
7409
7396
|
}
|
|
7410
7397
|
const { remoteSdp: J } = V;
|
|
@@ -7412,7 +7399,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7412
7399
|
await this.updateUsertracks(t.id, D), await G(this, kt).call(this, L), Z();
|
|
7413
7400
|
});
|
|
7414
7401
|
};
|
|
7415
|
-
await
|
|
7402
|
+
await K();
|
|
7416
7403
|
} catch (t) {
|
|
7417
7404
|
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe:error", t), k(`发布本地流失败: ${t.message}`);
|
|
7418
7405
|
}
|
|
@@ -7423,13 +7410,13 @@ class RoomCalls extends RoomPeer {
|
|
|
7423
7410
|
* @example quickvo.stopPublish(['microphoneCamera_audio'])
|
|
7424
7411
|
* @returns Promise<RoomUser>
|
|
7425
7412
|
*/
|
|
7426
|
-
|
|
7413
|
+
W(this, "stopPublish", async (u = []) => new Promise(async (A, h) => {
|
|
7427
7414
|
try {
|
|
7428
7415
|
const k = await this.getCaller();
|
|
7429
|
-
|
|
7416
|
+
u.length === 0 && (u = mediaType_keys);
|
|
7430
7417
|
const t = k.tracks.filter(({ mediaType: v }) => v && u.includes(v)), o = async () => {
|
|
7431
7418
|
const v = await this.getCaller();
|
|
7432
|
-
await this.
|
|
7419
|
+
await this.emitNotifyUpdateUsers(), A(v);
|
|
7433
7420
|
};
|
|
7434
7421
|
if (t.length === 0) return o();
|
|
7435
7422
|
await this.closeUserTracks(k.id, t, !0);
|
|
@@ -7453,48 +7440,47 @@ class RoomCalls extends RoomPeer {
|
|
|
7453
7440
|
* @example quickvo.subscribe(['trackName1','trackName2'])
|
|
7454
7441
|
* @returns Promise<RoomUser[]>
|
|
7455
7442
|
*/
|
|
7456
|
-
|
|
7443
|
+
W(this, "subscribe", async (u = [], A = 3) => new Promise(async (h, k) => {
|
|
7457
7444
|
try {
|
|
7445
|
+
this.setLoading(!0);
|
|
7458
7446
|
const t = await this.getUsers();
|
|
7459
|
-
let o = [];
|
|
7447
|
+
let o = [], v = 0;
|
|
7460
7448
|
for (const Z of t) {
|
|
7461
|
-
const { isSelf:
|
|
7462
|
-
if (!
|
|
7449
|
+
const { isSelf: K, tracks: H = [] } = Z;
|
|
7450
|
+
if (!K) {
|
|
7463
7451
|
const F = H.filter(({ trackName: z, mid: V = "" }) => V !== "" && (u.includes(z) || u.length === 0));
|
|
7464
|
-
F.length !== 0 && o.push({ ...Z, tracks: F });
|
|
7452
|
+
F.length !== 0 && (v += F.length, o.push({ ...Z, tracks: F }));
|
|
7465
7453
|
}
|
|
7466
7454
|
}
|
|
7467
|
-
const v = Array.from(o, ({ id: Z }) => Z);
|
|
7468
|
-
await this.setUsersLoading(v, !0);
|
|
7469
7455
|
const N = async () => {
|
|
7470
|
-
|
|
7471
|
-
|
|
7456
|
+
this.setLoading(!1);
|
|
7457
|
+
const Z = Array.from(o, ({ id: H }) => H), K = await this.getUsers(Z);
|
|
7458
|
+
await this.emitNotifyUpdateUsers(), h(K);
|
|
7472
7459
|
};
|
|
7473
7460
|
if (o.length === 0) return N();
|
|
7474
|
-
await this.emitNotifyUpdateUsers();
|
|
7475
7461
|
let q = 0;
|
|
7476
7462
|
const U = [];
|
|
7477
7463
|
for (const Z of o) {
|
|
7478
|
-
const { id:
|
|
7464
|
+
const { id: K, tracks: H } = Z, F = ot(H, ["type", "trackName"]), z = { id: K, tracks: F };
|
|
7479
7465
|
U.push(z);
|
|
7480
7466
|
}
|
|
7481
|
-
const D = async (Z,
|
|
7467
|
+
const D = async (Z, K) => {
|
|
7482
7468
|
for (const H of Z) {
|
|
7483
7469
|
const { id: F, tracks: z = [] } = H;
|
|
7484
|
-
for (const X of
|
|
7485
|
-
const { id:
|
|
7486
|
-
if (!
|
|
7470
|
+
for (const X of K) {
|
|
7471
|
+
const { id: rt } = X, { type: Y } = z.find(({ msid: Q = "" }) => Q === rt) || {}, et = mediaType_keys[Y];
|
|
7472
|
+
if (!et) continue;
|
|
7487
7473
|
const tt = new MediaStream();
|
|
7488
|
-
if (tt.addTrack(X), await this.initUserMediaStreamContext(F,
|
|
7489
|
-
const Q = this.getUserAudioMediaStreamContext(F,
|
|
7474
|
+
if (tt.addTrack(X), await this.initUserMediaStreamContext(F, et, tt), ["microphoneCamera_audio", "screenSharing_audio"].includes(et)) {
|
|
7475
|
+
const Q = this.getUserAudioMediaStreamContext(F, et);
|
|
7490
7476
|
Q == null || Q.setMute(!1);
|
|
7491
7477
|
}
|
|
7492
7478
|
}
|
|
7493
7479
|
const V = await this.getUser(F), J = [];
|
|
7494
7480
|
for (const X of V.tracks) {
|
|
7495
|
-
const { trackName:
|
|
7496
|
-
if (
|
|
7497
|
-
const tt = { ...X, msid:
|
|
7481
|
+
const { trackName: rt } = X, Y = z.find((tt) => `${tt.trackName}` === rt) || {}, { msid: et } = Y;
|
|
7482
|
+
if (et) {
|
|
7483
|
+
const tt = { ...X, msid: et };
|
|
7498
7484
|
J.push(tt);
|
|
7499
7485
|
}
|
|
7500
7486
|
}
|
|
@@ -7503,35 +7489,35 @@ class RoomCalls extends RoomPeer {
|
|
|
7503
7489
|
N();
|
|
7504
7490
|
}, L = async () => {
|
|
7505
7491
|
clearTimeout(q), await this.cwsIns.sendMessage({ event: "subscribe", data: { users: U } }).then(async (Z) => {
|
|
7506
|
-
const { code:
|
|
7507
|
-
if (
|
|
7508
|
-
return A > 0 ? (await new Promise((
|
|
7509
|
-
const { remoteSdp:
|
|
7510
|
-
for (const
|
|
7511
|
-
const { id:
|
|
7512
|
-
for (const
|
|
7513
|
-
const { type:
|
|
7514
|
-
if (!
|
|
7515
|
-
const
|
|
7516
|
-
if (
|
|
7517
|
-
const mt = o.find((
|
|
7492
|
+
const { code: K = 0, data: H } = Z;
|
|
7493
|
+
if (K !== 200)
|
|
7494
|
+
return A > 0 ? (await new Promise((X) => setTimeout(() => X(!0), 300)), A = A - 1, L()) : (this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: subscribe is error. count 0", { trackNames: u }), N());
|
|
7495
|
+
const { remoteSdp: F, users: z = [] } = H, V = libExports.parse(F), J = ot(V.media, ["mid", "msid"]).filter(({ msid: X = "" }) => X !== "");
|
|
7496
|
+
for (const X of z) {
|
|
7497
|
+
const { id: rt, tracks: Y = [] } = X;
|
|
7498
|
+
for (const et of Y) {
|
|
7499
|
+
const { type: tt, mid: Q, trackName: nt } = et, { msid: _t = "" } = J.find((mt) => `${mt.mid}` === Q) || {};
|
|
7500
|
+
if (!_t) continue;
|
|
7501
|
+
const vt = _t.split(" ");
|
|
7502
|
+
if (et.msid = vt[vt.length - 1], tt === null) {
|
|
7503
|
+
const mt = o.find((yt) => yt.id === rt);
|
|
7518
7504
|
if (mt) {
|
|
7519
|
-
const { tracks:
|
|
7520
|
-
|
|
7505
|
+
const { tracks: yt = [] } = mt, { type: Pt = -1 } = yt.find((Zt) => Zt.trackName === nt) || {};
|
|
7506
|
+
et.type = Pt;
|
|
7521
7507
|
}
|
|
7522
7508
|
}
|
|
7523
7509
|
}
|
|
7524
7510
|
}
|
|
7525
7511
|
{
|
|
7526
|
-
const
|
|
7512
|
+
const X = [];
|
|
7527
7513
|
q = setTimeout(async () => {
|
|
7528
|
-
await D(
|
|
7529
|
-
}, 1e4), this.peerIns.ontrack = async (
|
|
7530
|
-
const { track:
|
|
7531
|
-
|
|
7514
|
+
await D(z, X);
|
|
7515
|
+
}, 1e4), this.peerIns.ontrack = async (rt) => {
|
|
7516
|
+
const { track: Y } = rt;
|
|
7517
|
+
X.push(Y), this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: ontrack", `${X.length}/${v}`), X.length === v && (clearTimeout(q), await D(z, X));
|
|
7532
7518
|
};
|
|
7533
7519
|
}
|
|
7534
|
-
await this.setRemoteDescription({ type: "offer", sdp:
|
|
7520
|
+
await this.setRemoteDescription({ type: "offer", sdp: F }), await G(this, At).call(this);
|
|
7535
7521
|
});
|
|
7536
7522
|
};
|
|
7537
7523
|
await L();
|
|
@@ -7544,20 +7530,19 @@ class RoomCalls extends RoomPeer {
|
|
|
7544
7530
|
* @param trackNames string[] = []
|
|
7545
7531
|
* @example quickvo.subscribe(['trackName1'])
|
|
7546
7532
|
*/
|
|
7547
|
-
|
|
7533
|
+
W(this, "stopSubscribe", async (u = []) => new Promise(async (A, h) => {
|
|
7548
7534
|
try {
|
|
7549
|
-
const k = await this.getUsers(), t = []
|
|
7550
|
-
for (const
|
|
7551
|
-
const {
|
|
7552
|
-
for (const
|
|
7553
|
-
const { trackName:
|
|
7554
|
-
|
|
7535
|
+
const k = await this.getUsers(), t = [];
|
|
7536
|
+
for (const v of k) {
|
|
7537
|
+
const { tracks: N = [] } = v;
|
|
7538
|
+
for (const q of N) {
|
|
7539
|
+
const { trackName: U, mediaType: D } = q;
|
|
7540
|
+
D && (u.length === 0 || u.includes(U)) && (t.push(q), await this.closeUserTracks(v.id, [q]));
|
|
7555
7541
|
}
|
|
7556
7542
|
}
|
|
7557
7543
|
if (t.length === 0) return A(!0);
|
|
7558
|
-
await this.
|
|
7559
|
-
|
|
7560
|
-
this.cwsIns.sendMessage({ event: "closeTrack", data: { sdp: v.sdp, tracks: t } }), await this.setUsersLoading(o, !1), await this.emitNotifyUpdateUsers(), A(!0);
|
|
7544
|
+
const o = await this.setLocalDescription(await this.createOffer());
|
|
7545
|
+
this.cwsIns.sendMessage({ event: "closeTrack", data: { sdp: o.sdp, tracks: t } }), await this.emitNotifyUpdateUsers(), A(!0);
|
|
7561
7546
|
} catch (k) {
|
|
7562
7547
|
h(`停止订阅流: ${k.message}`);
|
|
7563
7548
|
}
|
|
@@ -7569,7 +7554,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7569
7554
|
* @param userId 用户id
|
|
7570
7555
|
* @example quickvo.inactiveTracks(['microphoneCamera_audio'], false)
|
|
7571
7556
|
*/
|
|
7572
|
-
|
|
7557
|
+
W(this, "inactiveTracks", async (u, A, h = this.options.userId) => {
|
|
7573
7558
|
const k = await this.getUser(h), { tracks: t = [] } = k, o = [...t];
|
|
7574
7559
|
for (let N of o) {
|
|
7575
7560
|
const { mediaType: q } = N;
|
|
@@ -7586,7 +7571,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7586
7571
|
/**
|
|
7587
7572
|
* 远端调试
|
|
7588
7573
|
*/
|
|
7589
|
-
|
|
7574
|
+
W(this, "debugger", () => new Promise(async (u, A) => {
|
|
7590
7575
|
await this.cwsIns.sendMessage({ event: "debugger" }, !1).then(async (h) => {
|
|
7591
7576
|
if (h.code !== 200) return A(h.desc);
|
|
7592
7577
|
u(!0);
|
|
@@ -7594,82 +7579,6 @@ class RoomCalls extends RoomPeer {
|
|
|
7594
7579
|
A(h);
|
|
7595
7580
|
});
|
|
7596
7581
|
}));
|
|
7597
|
-
/**
|
|
7598
|
-
* 添加内部监听事件
|
|
7599
|
-
*/
|
|
7600
|
-
ct(this, At, () => {
|
|
7601
|
-
{
|
|
7602
|
-
const u = async (A) => {
|
|
7603
|
-
const { qualities: h } = A.data;
|
|
7604
|
-
for (const k of h) {
|
|
7605
|
-
const { userId: t, egress: o, ingress: v } = k;
|
|
7606
|
-
await this.updateUserNetwork(t, { egress: o, ingress: v });
|
|
7607
|
-
}
|
|
7608
|
-
await this.emitNotifyUpdateUsers();
|
|
7609
|
-
};
|
|
7610
|
-
this.cwsIns.addNotify({ event: "onNetQuality", callback: u }, !0);
|
|
7611
|
-
}
|
|
7612
|
-
{
|
|
7613
|
-
const u = async (A) => {
|
|
7614
|
-
await this.updateUsers([{ ...A.data.user }]), await this.emitNotifyUpdateUsers();
|
|
7615
|
-
};
|
|
7616
|
-
this.cwsIns.addNotify({ event: "onJoinRoom", callback: u }, !0);
|
|
7617
|
-
}
|
|
7618
|
-
{
|
|
7619
|
-
const u = async (A) => {
|
|
7620
|
-
this.removeUsers([A.data.user.id]), await this.emitNotifyUpdateUsers();
|
|
7621
|
-
};
|
|
7622
|
-
this.cwsIns.addNotify({ event: "onQuitRoom", callback: u }, !0);
|
|
7623
|
-
}
|
|
7624
|
-
{
|
|
7625
|
-
const u = async (A) => {
|
|
7626
|
-
await this.updateUsers([A.data.user]);
|
|
7627
|
-
const { autoSubscribe: h } = this.options;
|
|
7628
|
-
h ? await this.subscribe() : await this.emitNotifyUpdateUsers();
|
|
7629
|
-
};
|
|
7630
|
-
this.cwsIns.addNotify({ event: "onPublish", callback: u }, !0);
|
|
7631
|
-
}
|
|
7632
|
-
{
|
|
7633
|
-
const u = async (A) => {
|
|
7634
|
-
const { id: h, tracks: k } = A.data.user;
|
|
7635
|
-
await this.closeUserTracks(h, k, !0);
|
|
7636
|
-
};
|
|
7637
|
-
this.cwsIns.addNotify({ event: "onCloseTrack", callback: u }, !0);
|
|
7638
|
-
}
|
|
7639
|
-
{
|
|
7640
|
-
const u = async (A) => {
|
|
7641
|
-
const { id: h, callAction: k } = A.data.user, t = await this.getUser(h), { tracks: o = [] } = t, v = await this.getUserStreams(h), N = this.tools.getCallActionMap(k), q = [];
|
|
7642
|
-
for (const U of o) {
|
|
7643
|
-
const { type: D } = U, L = mediaType_keys[D], Z = N[L];
|
|
7644
|
-
if (D === 0) {
|
|
7645
|
-
const { microphoneCamera_audio: H } = v, F = H.getTracks();
|
|
7646
|
-
for (const z of F)
|
|
7647
|
-
z.enabled = Z;
|
|
7648
|
-
}
|
|
7649
|
-
if (D === 1) {
|
|
7650
|
-
const { microphoneCamera_video: H } = v, F = H.getTracks();
|
|
7651
|
-
for (const z of F)
|
|
7652
|
-
z.enabled = Z;
|
|
7653
|
-
}
|
|
7654
|
-
if (D === 2) {
|
|
7655
|
-
const { screenSharing_video: H } = v, F = H.getTracks();
|
|
7656
|
-
for (const z of F)
|
|
7657
|
-
z.enabled = Z;
|
|
7658
|
-
}
|
|
7659
|
-
if (D === 3) {
|
|
7660
|
-
const { screenSharing_audio: H } = v, F = H.getTracks();
|
|
7661
|
-
for (const z of F)
|
|
7662
|
-
z.enabled = Z;
|
|
7663
|
-
}
|
|
7664
|
-
const W = { ...U, enabled: Z };
|
|
7665
|
-
q.push(W);
|
|
7666
|
-
}
|
|
7667
|
-
await this.updateUsertracks(h, q), await this.updateUserCallAction(h, k), this.emitNotifyUpdateUsers();
|
|
7668
|
-
};
|
|
7669
|
-
this.cwsIns.addNotify({ event: "onUpdateCall", callback: u }, !0);
|
|
7670
|
-
}
|
|
7671
|
-
this.cwsIns.addNotify({ event: "onTokenExpired", callback: async (u) => this.destroy() }, !0), this.cwsIns.addNotify({ event: "onDestroy", callback: this.destroy }, !0), this.cwsIns.addNotify({ event: "destroyRoom", callback: this.destroy }, !0);
|
|
7672
|
-
});
|
|
7673
7582
|
/**
|
|
7674
7583
|
* 更新自己通话状态
|
|
7675
7584
|
*/
|
|
@@ -7684,7 +7593,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7684
7593
|
/**
|
|
7685
7594
|
* 协商流
|
|
7686
7595
|
*/
|
|
7687
|
-
ct(this,
|
|
7596
|
+
ct(this, At, async () => new Promise(async (u, A) => {
|
|
7688
7597
|
const h = await this.peerIns.createAnswer();
|
|
7689
7598
|
await this.peerIns.setLocalDescription(h), await this.cwsIns.sendMessage({ event: "renegotiate", data: { sdp: h.sdp } }).then(async (k) => {
|
|
7690
7599
|
if (k.code !== 200) return A("协商流错误");
|
|
@@ -7696,37 +7605,42 @@ class RoomCalls extends RoomPeer {
|
|
|
7696
7605
|
/**
|
|
7697
7606
|
* 建立CF通讯连接
|
|
7698
7607
|
*/
|
|
7699
|
-
ct(this,
|
|
7608
|
+
ct(this, qt, async () => new Promise(async (u, A) => {
|
|
7700
7609
|
this.peerIns.addTransceiver("audio", { direction: "inactive" });
|
|
7701
7610
|
const h = await this.setLocalDescription(await this.createOffer());
|
|
7702
|
-
let k = 0;
|
|
7703
|
-
const
|
|
7704
|
-
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: iceconnectionstatechange", this.peerIns.iceConnectionState)
|
|
7705
|
-
|
|
7706
|
-
|
|
7611
|
+
let k = 0, t = 0;
|
|
7612
|
+
const o = async () => {
|
|
7613
|
+
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: iceconnectionstatechange", this.peerIns.iceConnectionState);
|
|
7614
|
+
const v = () => {
|
|
7615
|
+
this.setRoomState("disconnected"), this.cwsIns.emitNotify("onDestroy", { code: 200, data: {} }), this.peerIns.removeEventListener("iceconnectionstatechange", o);
|
|
7616
|
+
};
|
|
7617
|
+
this.peerIns.iceConnectionState === "disconnected" && (t = setTimeout(() => {
|
|
7618
|
+
v();
|
|
7619
|
+
}, 10 * 1e3)), this.peerIns.iceConnectionState === "failed" && v(), this.peerIns.iceConnectionState === "connected" && (clearTimeout(k), clearTimeout(t), u(!0));
|
|
7707
7620
|
};
|
|
7708
|
-
this.peerIns.addEventListener("iceconnectionstatechange",
|
|
7621
|
+
this.peerIns.addEventListener("iceconnectionstatechange", o), k = setTimeout(() => {
|
|
7709
7622
|
A("Cloudflare 连接超时");
|
|
7710
7623
|
}, 10 * 1e3), await this.cwsIns.sendMessage({
|
|
7711
7624
|
event: "connectCF",
|
|
7712
7625
|
data: { sdp: h.sdp }
|
|
7713
|
-
}).then(async (
|
|
7714
|
-
const { code:
|
|
7715
|
-
if (
|
|
7716
|
-
const { remoteSdp:
|
|
7717
|
-
await this.setRemoteDescription({ type: "answer", sdp:
|
|
7626
|
+
}).then(async (v) => {
|
|
7627
|
+
const { code: N = 0, desc: q, data: U } = v;
|
|
7628
|
+
if (N !== 200) return A(q);
|
|
7629
|
+
const { remoteSdp: D } = U;
|
|
7630
|
+
await this.setRemoteDescription({ type: "answer", sdp: D });
|
|
7718
7631
|
});
|
|
7719
7632
|
}));
|
|
7720
7633
|
/**
|
|
7721
7634
|
* 登录
|
|
7722
7635
|
*/
|
|
7723
|
-
ct(this,
|
|
7636
|
+
ct(this, Dt, async () => new Promise(async (u, A) => {
|
|
7724
7637
|
try {
|
|
7725
7638
|
this.setRoomState("checkAuth");
|
|
7726
7639
|
const { appid: h } = this.options, { userId: k, sdkToken: t } = this.options, v = btoa(encodeURI(JSON.stringify({
|
|
7727
7640
|
b: k,
|
|
7728
7641
|
c: h,
|
|
7729
|
-
a: t
|
|
7642
|
+
a: t,
|
|
7643
|
+
v: "1.0.0"
|
|
7730
7644
|
})));
|
|
7731
7645
|
await this.cwsIns.connect(v), u(!0);
|
|
7732
7646
|
} catch (h) {
|
|
@@ -7736,19 +7650,19 @@ class RoomCalls extends RoomPeer {
|
|
|
7736
7650
|
/**
|
|
7737
7651
|
* 重连成功
|
|
7738
7652
|
*/
|
|
7739
|
-
ct(this,
|
|
7653
|
+
ct(this, Ct, async () => {
|
|
7740
7654
|
this.syncRoomInfo();
|
|
7741
7655
|
});
|
|
7742
7656
|
/**
|
|
7743
7657
|
* 重连停止
|
|
7744
7658
|
*/
|
|
7745
|
-
ct(this,
|
|
7659
|
+
ct(this, Ut, async () => {
|
|
7746
7660
|
this.destroy();
|
|
7747
7661
|
});
|
|
7748
|
-
|
|
7662
|
+
this.setRoomState("ready"), this.cwsIns.onReconnectSuccess = G(this, Ct), this.cwsIns.onReconnectStop = G(this, Ut);
|
|
7749
7663
|
}
|
|
7750
7664
|
}
|
|
7751
|
-
|
|
7665
|
+
kt = new WeakMap(), At = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap(), Ut = new WeakMap();
|
|
7752
7666
|
class Room extends RoomCalls {
|
|
7753
7667
|
constructor() {
|
|
7754
7668
|
super();
|
|
@@ -7759,7 +7673,7 @@ class Room extends RoomCalls {
|
|
|
7759
7673
|
* @param keyName
|
|
7760
7674
|
* @returns string[]
|
|
7761
7675
|
*/
|
|
7762
|
-
|
|
7676
|
+
W(this, "getTrackNamesFormTracks", (u, A = [], h = "trackName") => {
|
|
7763
7677
|
const k = [];
|
|
7764
7678
|
for (const t of u) {
|
|
7765
7679
|
const { type: o } = t;
|
|
@@ -7772,43 +7686,123 @@ class Room extends RoomCalls {
|
|
|
7772
7686
|
});
|
|
7773
7687
|
}
|
|
7774
7688
|
}
|
|
7775
|
-
var
|
|
7689
|
+
var bt, Mt;
|
|
7776
7690
|
class QuickVO extends Room {
|
|
7777
7691
|
constructor(u) {
|
|
7778
7692
|
super();
|
|
7779
|
-
ct(this,
|
|
7693
|
+
ct(this, bt, /* @__PURE__ */ new Map());
|
|
7694
|
+
/**
|
|
7695
|
+
* 添加内部监听事件
|
|
7696
|
+
*/
|
|
7697
|
+
ct(this, Mt, () => {
|
|
7698
|
+
{
|
|
7699
|
+
const u = async (A) => {
|
|
7700
|
+
const { qualities: h } = A.data;
|
|
7701
|
+
for (const k of h) {
|
|
7702
|
+
const { userId: t, egress: o, ingress: v } = k;
|
|
7703
|
+
await this.updateUserNetwork(t, { egress: o, ingress: v });
|
|
7704
|
+
}
|
|
7705
|
+
await this.emitNotifyUpdateUsers();
|
|
7706
|
+
};
|
|
7707
|
+
this.cwsIns.addNotify({ event: "onNetQuality", callback: u }, !0);
|
|
7708
|
+
}
|
|
7709
|
+
{
|
|
7710
|
+
const u = async (A) => {
|
|
7711
|
+
await this.updateUsers([{ ...A.data.user }]), await this.emitNotifyUpdateUsers();
|
|
7712
|
+
};
|
|
7713
|
+
this.cwsIns.addNotify({ event: "onJoinRoom", callback: u }, !0);
|
|
7714
|
+
}
|
|
7715
|
+
{
|
|
7716
|
+
const u = async (A) => {
|
|
7717
|
+
this.removeUsers([A.data.user.id]), await this.emitNotifyUpdateUsers();
|
|
7718
|
+
};
|
|
7719
|
+
this.cwsIns.addNotify({ event: "onQuitRoom", callback: u }, !0);
|
|
7720
|
+
}
|
|
7721
|
+
{
|
|
7722
|
+
const u = async (A) => {
|
|
7723
|
+
await this.updateUsers([A.data.user]);
|
|
7724
|
+
const { autoSubscribe: h } = this.options;
|
|
7725
|
+
if (h) {
|
|
7726
|
+
const k = this.tools.getTrackNamesFormTracks(A.data.user.tracks);
|
|
7727
|
+
await this.subscribe(k);
|
|
7728
|
+
} else
|
|
7729
|
+
await this.emitNotifyUpdateUsers();
|
|
7730
|
+
};
|
|
7731
|
+
this.cwsIns.addNotify({ event: "onPublish", callback: u }, !0);
|
|
7732
|
+
}
|
|
7733
|
+
{
|
|
7734
|
+
const u = async (A) => {
|
|
7735
|
+
const { id: h, tracks: k } = A.data.user;
|
|
7736
|
+
await this.closeUserTracks(h, k, !0), await this.emitNotifyUpdateUsers();
|
|
7737
|
+
};
|
|
7738
|
+
this.cwsIns.addNotify({ event: "onCloseTrack", callback: u }, !0);
|
|
7739
|
+
}
|
|
7740
|
+
{
|
|
7741
|
+
const u = async (A) => {
|
|
7742
|
+
const { id: h, callAction: k } = A.data.user, t = await this.getUser(h), { tracks: o = [] } = t, v = await this.getUserStreams(h), N = this.tools.getCallActionMap(k), q = [];
|
|
7743
|
+
for (const U of o) {
|
|
7744
|
+
const { type: D } = U, L = mediaType_keys[D], Z = N[L];
|
|
7745
|
+
if (D === 0) {
|
|
7746
|
+
const { microphoneCamera_audio: H } = v, F = H.getTracks();
|
|
7747
|
+
for (const z of F)
|
|
7748
|
+
z.enabled = Z;
|
|
7749
|
+
}
|
|
7750
|
+
if (D === 1) {
|
|
7751
|
+
const { microphoneCamera_video: H } = v, F = H.getTracks();
|
|
7752
|
+
for (const z of F)
|
|
7753
|
+
z.enabled = Z;
|
|
7754
|
+
}
|
|
7755
|
+
if (D === 2) {
|
|
7756
|
+
const { screenSharing_video: H } = v, F = H.getTracks();
|
|
7757
|
+
for (const z of F)
|
|
7758
|
+
z.enabled = Z;
|
|
7759
|
+
}
|
|
7760
|
+
if (D === 3) {
|
|
7761
|
+
const { screenSharing_audio: H } = v, F = H.getTracks();
|
|
7762
|
+
for (const z of F)
|
|
7763
|
+
z.enabled = Z;
|
|
7764
|
+
}
|
|
7765
|
+
const K = { ...U, enabled: Z };
|
|
7766
|
+
q.push(K);
|
|
7767
|
+
}
|
|
7768
|
+
await this.updateUsertracks(h, q), await this.updateUserCallAction(h, k), this.emitNotifyUpdateUsers();
|
|
7769
|
+
};
|
|
7770
|
+
this.cwsIns.addNotify({ event: "onUpdateCall", callback: u }, !0);
|
|
7771
|
+
}
|
|
7772
|
+
this.cwsIns.addNotify({ event: "onTokenExpired", callback: async (u) => this.destroy() }, !0), this.cwsIns.addNotify({ event: "onDestroy", callback: this.destroy }, !0), this.cwsIns.addNotify({ event: "destroyRoom", callback: this.destroy }, !0);
|
|
7773
|
+
});
|
|
7780
7774
|
/**
|
|
7781
7775
|
* 添加 FrameRequestCallback
|
|
7782
7776
|
* @param key string
|
|
7783
7777
|
* @param func FrameRequestCallback
|
|
7784
7778
|
*/
|
|
7785
|
-
|
|
7779
|
+
W(this, "addRequestAnimationFrame", async (u, A) => {
|
|
7786
7780
|
{
|
|
7787
|
-
const h = G(this,
|
|
7781
|
+
const h = G(this, bt).get(u);
|
|
7788
7782
|
h && cancelAnimationFrame(h);
|
|
7789
7783
|
}
|
|
7790
7784
|
{
|
|
7791
7785
|
const h = requestAnimationFrame(A);
|
|
7792
|
-
G(this,
|
|
7786
|
+
G(this, bt).set(u, h);
|
|
7793
7787
|
}
|
|
7794
7788
|
});
|
|
7795
7789
|
/**
|
|
7796
7790
|
* 清理 FrameRequestCallback
|
|
7797
7791
|
* @param keys string[] = []
|
|
7798
7792
|
*/
|
|
7799
|
-
|
|
7800
|
-
u.length === 0 && (u = [...G(this,
|
|
7793
|
+
W(this, "clearRequestAnimationFrame", async (u = []) => {
|
|
7794
|
+
u.length === 0 && (u = [...G(this, bt).keys()]);
|
|
7801
7795
|
const A = [];
|
|
7802
7796
|
for (const h of u) {
|
|
7803
|
-
const k = G(this,
|
|
7797
|
+
const k = G(this, bt).get(h);
|
|
7804
7798
|
k && (cancelAnimationFrame(k), A.push(k));
|
|
7805
7799
|
}
|
|
7806
7800
|
return A;
|
|
7807
7801
|
});
|
|
7808
|
-
this.setOptions(u);
|
|
7802
|
+
this.setOptions(u), this.cwsIns = new CallsWebSocket({ ...this.options, debug: !0 }), G(this, Mt).call(this);
|
|
7809
7803
|
}
|
|
7810
7804
|
}
|
|
7811
|
-
|
|
7805
|
+
bt = new WeakMap(), Mt = new WeakMap();
|
|
7812
7806
|
export {
|
|
7813
7807
|
QuickVO,
|
|
7814
7808
|
getAverageVolume,
|