quickvo-sdk-js 0.4.4 → 0.4.6
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 +31 -31
- package/dist/index.umd.cjs +1 -1
- package/dist/room/RoomBase.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var Qt = (_) => {
|
|
|
4
4
|
};
|
|
5
5
|
var Yt = (_, q, k) => q in _ ? Vt(_, q, { enumerable: !0, configurable: !0, writable: !0, value: k }) : _[q] = k;
|
|
6
6
|
var H = (_, q, k) => Yt(_, typeof q != "symbol" ? q + "" : q, k), Gt = (_, q, k) => q.has(_) || Qt("Cannot " + k);
|
|
7
|
-
var G = (_, q, k) => (Gt(_, q, "read from private field"), k ? k.call(_) : q.get(_)), st = (_, q, k) => q.has(_) ? Qt("Cannot add the same private member more than once") : q instanceof WeakSet ? q.add(_) : q.set(_, k),
|
|
7
|
+
var G = (_, q, k) => (Gt(_, q, "read from private field"), k ? k.call(_) : q.get(_)), st = (_, q, k) => q.has(_) ? Qt("Cannot add the same private member more than once") : q instanceof WeakSet ? q.add(_) : q.set(_, k), bt = (_, q, k, D) => (Gt(_, q, "write to private field"), D ? D.call(_, k) : q.set(_, k), k);
|
|
8
8
|
const v$1 = (_, q = []) => {
|
|
9
9
|
const k = { ..._ }, D = Object.keys(k);
|
|
10
10
|
for (const $ of D)
|
|
@@ -7262,9 +7262,9 @@ class CallsWebSocket {
|
|
|
7262
7262
|
* @returns
|
|
7263
7263
|
*/
|
|
7264
7264
|
H(this, "connect", async (q = "") => new Promise(async (k) => {
|
|
7265
|
-
q &&
|
|
7265
|
+
q && bt(this, gt, q), G(this, yt) && (await G(this, yt).close(), this.state = "closed");
|
|
7266
7266
|
const D = `${G(this, lt).url}?s=${G(this, gt)}&t=${Date.now()}`;
|
|
7267
|
-
|
|
7267
|
+
bt(this, yt, new M({
|
|
7268
7268
|
...G(this, lt),
|
|
7269
7269
|
url: D,
|
|
7270
7270
|
binaryType: "arraybuffer",
|
|
@@ -7286,7 +7286,7 @@ class CallsWebSocket {
|
|
|
7286
7286
|
const { destructionTimer: $ } = G(this, ft)[D];
|
|
7287
7287
|
clearTimeout($);
|
|
7288
7288
|
}
|
|
7289
|
-
|
|
7289
|
+
bt(this, ft, {}), await ((k = G(this, yt)) == null ? void 0 : k.close()), bt(this, yt, void 0), this.state = "closed";
|
|
7290
7290
|
});
|
|
7291
7291
|
/**
|
|
7292
7292
|
* 发送消息
|
|
@@ -7338,7 +7338,7 @@ class CallsWebSocket {
|
|
|
7338
7338
|
*/
|
|
7339
7339
|
H(this, "removeNotify", (q = []) => {
|
|
7340
7340
|
if (q.length === 0)
|
|
7341
|
-
|
|
7341
|
+
bt(this, dt, {});
|
|
7342
7342
|
else {
|
|
7343
7343
|
const k = Object.keys(G(this, dt));
|
|
7344
7344
|
for (const D of k)
|
|
@@ -7346,13 +7346,13 @@ class CallsWebSocket {
|
|
|
7346
7346
|
}
|
|
7347
7347
|
G(this, lt).debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 移除广播事件", G(this, dt));
|
|
7348
7348
|
});
|
|
7349
|
-
|
|
7349
|
+
bt(this, lt, { ...G(this, lt), ...q });
|
|
7350
7350
|
}
|
|
7351
7351
|
}
|
|
7352
7352
|
yt = new WeakMap(), lt = new WeakMap(), gt = new WeakMap(), ft = new WeakMap(), dt = new WeakMap(), Et = new WeakMap(), xt = new WeakMap(), Nt = new WeakMap(), At = new WeakMap(), $t = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap();
|
|
7353
|
-
var p = Object.defineProperty,
|
|
7353
|
+
var p = Object.defineProperty, y = (_) => {
|
|
7354
7354
|
throw TypeError(_);
|
|
7355
|
-
}, g = (_, q, k) => q in _ ? p(_, q, { enumerable: !0, configurable: !0, writable: !0, value: k }) : _[q] = k, h = (_, q, k) => g(_, typeof q != "symbol" ? q + "" : q, k),
|
|
7355
|
+
}, g = (_, q, k) => q in _ ? p(_, q, { enumerable: !0, configurable: !0, writable: !0, value: k }) : _[q] = k, h = (_, q, k) => g(_, typeof q != "symbol" ? q + "" : q, k), x = (_, q, k) => q.has(_) || y("Cannot " + k), n = (_, q, k) => (x(_, q, "read from private field"), k ? k.call(_) : q.get(_)), f = (_, q, k) => q.has(_) ? y("Cannot add the same private member more than once") : q instanceof WeakSet ? q.add(_) : q.set(_, k), b = (_, q, k, D) => (x(_, q, "write to private field"), q.set(_, k), k), a, o, d;
|
|
7356
7356
|
class K {
|
|
7357
7357
|
// 任务 index
|
|
7358
7358
|
/**
|
|
@@ -7361,8 +7361,8 @@ class K {
|
|
|
7361
7361
|
* @param conditionKeys 条件keys string[]
|
|
7362
7362
|
*/
|
|
7363
7363
|
constructor(q) {
|
|
7364
|
-
|
|
7365
|
-
n(this,
|
|
7364
|
+
f(this, a, /* @__PURE__ */ new Map()), f(this, o, []), h(this, "index"), h(this, "setCondition", (k, D) => {
|
|
7365
|
+
n(this, a).set(k, D), D && n(this, d).call(this);
|
|
7366
7366
|
}), h(this, "addTask", (k, D, $ = {}) => {
|
|
7367
7367
|
const I = { key: "", strict: !1, describe: "", ...$ };
|
|
7368
7368
|
let { key: e, strict: u, describe: N } = I;
|
|
@@ -7371,7 +7371,7 @@ class K {
|
|
|
7371
7371
|
const A = { key: e, func: k, conditionKeys: D, describe: N, strict: u };
|
|
7372
7372
|
n(this, o).unshift(A);
|
|
7373
7373
|
}
|
|
7374
|
-
return n(this,
|
|
7374
|
+
return n(this, d).call(this), e;
|
|
7375
7375
|
}), h(this, "clear", (k = []) => {
|
|
7376
7376
|
if (k.length === 0) {
|
|
7377
7377
|
b(this, o, []);
|
|
@@ -7381,7 +7381,7 @@ class K {
|
|
|
7381
7381
|
const $ = n(this, o).findIndex((I) => I.key === D);
|
|
7382
7382
|
$ !== -1 && n(this, o).splice($, 1);
|
|
7383
7383
|
}
|
|
7384
|
-
}), h(this, "getConditions", () => Object.fromEntries(n(this,
|
|
7384
|
+
}), h(this, "getConditions", () => Object.fromEntries(n(this, a))), h(this, "getTasks", () => {
|
|
7385
7385
|
const k = [];
|
|
7386
7386
|
for (const D of n(this, o)) {
|
|
7387
7387
|
const { key: $, describe: I, conditionKeys: e } = D;
|
|
@@ -7391,18 +7391,18 @@ class K {
|
|
|
7391
7391
|
}), h(this, "checkConditions", (k) => {
|
|
7392
7392
|
let D = !0;
|
|
7393
7393
|
for (const $ of k)
|
|
7394
|
-
if (n(this,
|
|
7394
|
+
if (n(this, a).get($) === !1) {
|
|
7395
7395
|
D = !1;
|
|
7396
7396
|
break;
|
|
7397
7397
|
}
|
|
7398
7398
|
return D;
|
|
7399
|
-
}),
|
|
7399
|
+
}), f(this, d, async () => {
|
|
7400
7400
|
const k = n(this, o).length;
|
|
7401
7401
|
for (let D = k; D > 0; D--) {
|
|
7402
7402
|
const $ = D - 1, I = n(this, o)[$], { conditionKeys: e, func: u, strict: N } = I, A = this.checkConditions(e);
|
|
7403
7403
|
{
|
|
7404
7404
|
if (!A) return;
|
|
7405
|
-
u();
|
|
7405
|
+
await u();
|
|
7406
7406
|
}
|
|
7407
7407
|
{
|
|
7408
7408
|
if (N) return;
|
|
@@ -7411,10 +7411,10 @@ class K {
|
|
|
7411
7411
|
}
|
|
7412
7412
|
}), this.index = 0;
|
|
7413
7413
|
for (const k of q)
|
|
7414
|
-
n(this,
|
|
7414
|
+
n(this, a).set(k, !1);
|
|
7415
7415
|
}
|
|
7416
7416
|
}
|
|
7417
|
-
|
|
7417
|
+
a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap();
|
|
7418
7418
|
class RoomBase {
|
|
7419
7419
|
constructor() {
|
|
7420
7420
|
H(this, "options", {
|
|
@@ -7430,7 +7430,7 @@ class RoomBase {
|
|
|
7430
7430
|
// 是否禁止通知
|
|
7431
7431
|
H(this, "isEarly", !1);
|
|
7432
7432
|
// 是否提前建连
|
|
7433
|
-
H(this, "taskQueue", new K(["createWs", "createSession", "ice", "joinRoom", "createTrack", "subscribe", "closeTrack"
|
|
7433
|
+
H(this, "taskQueue", new K(["createWs", "createSession", "ice", "joinRoom", "createTrack", "subscribe", "closeTrack"]));
|
|
7434
7434
|
// 条件队列
|
|
7435
7435
|
H(this, "roomState", "ready");
|
|
7436
7436
|
// 房间状态
|
|
@@ -7450,7 +7450,7 @@ class RoomBase {
|
|
|
7450
7450
|
screenSharing_audio: ""
|
|
7451
7451
|
});
|
|
7452
7452
|
H(this, "initAsyncQueue", () => {
|
|
7453
|
-
this.taskQueue.clear(), this.taskQueue.setCondition("joinRoom", !0), this.taskQueue.setCondition("createTrack", !0), this.taskQueue.setCondition("closeTrack", !0), this.taskQueue.setCondition("subscribe", !0)
|
|
7453
|
+
this.taskQueue.clear(), this.taskQueue.setCondition("joinRoom", !0), this.taskQueue.setCondition("createTrack", !0), this.taskQueue.setCondition("closeTrack", !0), this.taskQueue.setCondition("subscribe", !0);
|
|
7454
7454
|
});
|
|
7455
7455
|
/**
|
|
7456
7456
|
* 获取房间信息
|
|
@@ -7577,7 +7577,7 @@ const createMutedAudioStream = () => {
|
|
|
7577
7577
|
screenSharing_audio: createMutedAudioStream()
|
|
7578
7578
|
// 假音频流
|
|
7579
7579
|
};
|
|
7580
|
-
var _t,
|
|
7580
|
+
var _t, kt, ht, Tt, Ut, Mt, Pt, St, Bt;
|
|
7581
7581
|
class RoomMedias extends RoomBase {
|
|
7582
7582
|
// 假媒体流
|
|
7583
7583
|
constructor() {
|
|
@@ -7586,7 +7586,7 @@ class RoomMedias extends RoomBase {
|
|
|
7586
7586
|
// 可用媒体设备列表
|
|
7587
7587
|
st(this, _t, /* @__PURE__ */ new Map());
|
|
7588
7588
|
// 媒体流设备管理
|
|
7589
|
-
st(this,
|
|
7589
|
+
st(this, kt, /* @__PURE__ */ new Map());
|
|
7590
7590
|
// 媒体轨道参数管理
|
|
7591
7591
|
st(this, ht, /* @__PURE__ */ new Map());
|
|
7592
7592
|
// 媒体流上下文
|
|
@@ -7602,7 +7602,7 @@ class RoomMedias extends RoomBase {
|
|
|
7602
7602
|
* 初始化媒体参数
|
|
7603
7603
|
*/
|
|
7604
7604
|
st(this, Mt, () => {
|
|
7605
|
-
G(this,
|
|
7605
|
+
G(this, kt).set("microphoneCamera_audio", {}), G(this, kt).set("microphoneCamera_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), G(this, kt).set("screenSharing_video", { width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { min: 10, ideal: 30 } }), G(this, kt).set("screenSharing_audio", {});
|
|
7606
7606
|
});
|
|
7607
7607
|
/**
|
|
7608
7608
|
* 初始化媒体设备类型
|
|
@@ -7710,13 +7710,13 @@ class RoomMedias extends RoomBase {
|
|
|
7710
7710
|
const k = G(this, ht).values();
|
|
7711
7711
|
for (const D of k)
|
|
7712
7712
|
D.stop();
|
|
7713
|
-
|
|
7713
|
+
bt(this, ht, /* @__PURE__ */ new Map());
|
|
7714
7714
|
});
|
|
7715
7715
|
/**
|
|
7716
7716
|
* 设置轨道媒体参数
|
|
7717
7717
|
*/
|
|
7718
7718
|
H(this, "setMediaTrackConstraints", async (k, D) => {
|
|
7719
|
-
G(this,
|
|
7719
|
+
G(this, kt).set(k, D);
|
|
7720
7720
|
const I = this.getUserStream(this.options.userId, k).getTracks();
|
|
7721
7721
|
if (I.length !== 0)
|
|
7722
7722
|
for (const e of I) {
|
|
@@ -7728,7 +7728,7 @@ class RoomMedias extends RoomBase {
|
|
|
7728
7728
|
* 初始化本地流
|
|
7729
7729
|
*/
|
|
7730
7730
|
H(this, "initLocalStream", async (k) => {
|
|
7731
|
-
const { userId: D } = this.options, $ = G(this,
|
|
7731
|
+
const { userId: D } = this.options, $ = G(this, kt).get(k);
|
|
7732
7732
|
switch (k) {
|
|
7733
7733
|
// 麦克风
|
|
7734
7734
|
case "microphoneCamera_audio":
|
|
@@ -7847,7 +7847,7 @@ class RoomMedias extends RoomBase {
|
|
|
7847
7847
|
G(this, Bt).call(this), G(this, Pt).call(this), G(this, Mt).call(this), G(this, Ut).call(this);
|
|
7848
7848
|
}
|
|
7849
7849
|
}
|
|
7850
|
-
_t = new WeakMap(),
|
|
7850
|
+
_t = new WeakMap(), kt = new WeakMap(), ht = new WeakMap(), Tt = new WeakMap(), Ut = new WeakMap(), Mt = new WeakMap(), Pt = new WeakMap(), St = new WeakMap(), Bt = new WeakMap();
|
|
7851
7851
|
class RoomUsers extends RoomMedias {
|
|
7852
7852
|
constructor() {
|
|
7853
7853
|
super();
|
|
@@ -8515,7 +8515,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8515
8515
|
this.clearUsers();
|
|
8516
8516
|
let I = "";
|
|
8517
8517
|
const e = async () => {
|
|
8518
|
-
|
|
8518
|
+
this.taskQueue.clear([I]), await this.emitNotifyUpdateUsers();
|
|
8519
8519
|
const N = await this.getUsers();
|
|
8520
8520
|
this.taskQueue.setCondition("joinRoom", !0), D(N);
|
|
8521
8521
|
}, u = async () => {
|
|
@@ -8592,7 +8592,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8592
8592
|
H(this, "publish", (k) => new Promise(async (D, $) => {
|
|
8593
8593
|
const I = async () => {
|
|
8594
8594
|
try {
|
|
8595
|
-
|
|
8595
|
+
k.includes("screenSharing_audio") && !k.includes("screenSharing_video") && (k = [...k, "screenSharing_video"]), await this.replaceSenderStream(k, !1);
|
|
8596
8596
|
const e = await this.getCaller();
|
|
8597
8597
|
for (const L of k)
|
|
8598
8598
|
this.getUserStream(e.id, L).getTracks().length === 0 && await this.setLocalStream(L, !0);
|
|
@@ -8605,16 +8605,16 @@ class RoomCalls extends RoomPeer {
|
|
|
8605
8605
|
{
|
|
8606
8606
|
await this.emitNotifyUpdateUsers();
|
|
8607
8607
|
const L = await this.getCaller();
|
|
8608
|
-
|
|
8608
|
+
D(L);
|
|
8609
8609
|
}
|
|
8610
8610
|
} catch (e) {
|
|
8611
8611
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: error", e);
|
|
8612
8612
|
for (const u of k)
|
|
8613
8613
|
await this.setLocalStream(u, !1);
|
|
8614
|
-
|
|
8614
|
+
$(`publish is error: ${e.message || e}`);
|
|
8615
8615
|
}
|
|
8616
8616
|
};
|
|
8617
|
-
this.taskQueue.addTask(I, ["createWs", "createSession", "ice", "createTrack", "subscribe"
|
|
8617
|
+
this.taskQueue.addTask(I, ["createWs", "createSession", "ice", "createTrack", "subscribe"], { describe: "replaceSenderStream" });
|
|
8618
8618
|
}));
|
|
8619
8619
|
/**
|
|
8620
8620
|
* 停止发布流
|