quickvo-sdk-js 0.4.9 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +100 -76
- package/dist/index.umd.cjs +2 -2
- package/dist/room/RoomMedias.d.ts +1 -5
- package/dist/room/RoomPeer.d.ts +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6359,7 +6359,7 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
6359
6359
|
const O = n.bits;
|
|
6360
6360
|
let $ = 0, N = 0, D = 0, q = 0, P = 0, j = 0, Q = 0, J = 0, z = 0, Y = 0, et, tt, nt, lt, it, st = null, ct;
|
|
6361
6361
|
const ot = new Uint16Array(MAXBITS + 1), rt = new Uint16Array(MAXBITS + 1);
|
|
6362
|
-
let
|
|
6362
|
+
let Ot = null, Qt, Et, xt;
|
|
6363
6363
|
for ($ = 0; $ <= MAXBITS; $++)
|
|
6364
6364
|
ot[$] = 0;
|
|
6365
6365
|
for (N = 0; N < E; N++)
|
|
@@ -6379,10 +6379,10 @@ const MAXBITS = 15, ENOUGH_LENS$1 = 852, ENOUGH_DISTS$1 = 592, CODES$1 = 0, LENS
|
|
|
6379
6379
|
rt[$ + 1] = rt[$] + ot[$];
|
|
6380
6380
|
for (N = 0; N < E; N++)
|
|
6381
6381
|
I[u + N] !== 0 && (e[rt[I[u + N]]++] = N);
|
|
6382
|
-
if (a === CODES$1 ? (st =
|
|
6382
|
+
if (a === CODES$1 ? (st = Ot = e, ct = 20) : a === LENS$1 ? (st = lbase, Ot = lext, ct = 257) : (st = dbase, Ot = dext, ct = 0), Y = 0, N = 0, $ = D, it = k, j = P, Q = 0, nt = -1, z = 1 << P, lt = z - 1, a === LENS$1 && z > ENOUGH_LENS$1 || a === DISTS$1 && z > ENOUGH_DISTS$1)
|
|
6383
6383
|
return 1;
|
|
6384
6384
|
for (; ; ) {
|
|
6385
|
-
Qt = $ - Q, e[N] + 1 < ct ? (Et = 0, xt = e[N]) : e[N] >= ct ? (Et =
|
|
6385
|
+
Qt = $ - Q, e[N] + 1 < ct ? (Et = 0, xt = e[N]) : e[N] >= ct ? (Et = Ot[e[N] - ct], xt = st[e[N] - ct]) : (Et = 96, xt = 0), et = 1 << $ - Q, tt = 1 << j, D = tt;
|
|
6386
6386
|
do
|
|
6387
6387
|
tt -= et, _[it + (Y >> Q) + tt] = Qt << 24 | Et << 16 | xt | 0;
|
|
6388
6388
|
while (tt !== 0);
|
|
@@ -6475,7 +6475,7 @@ const fixedtables = (a) => {
|
|
|
6475
6475
|
let u, E, _, k, e, n, O, $, N, D, q, P, j, Q, J = 0, z, Y, et, tt, nt, lt, it, st;
|
|
6476
6476
|
const ct = new Uint8Array(4);
|
|
6477
6477
|
let ot, rt;
|
|
6478
|
-
const
|
|
6478
|
+
const Ot = (
|
|
6479
6479
|
/* permutation of code lengths */
|
|
6480
6480
|
new Uint8Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15])
|
|
6481
6481
|
);
|
|
@@ -6701,10 +6701,10 @@ const fixedtables = (a) => {
|
|
|
6701
6701
|
break t;
|
|
6702
6702
|
n--, $ += E[k++] << N, N += 8;
|
|
6703
6703
|
}
|
|
6704
|
-
u.lens[
|
|
6704
|
+
u.lens[Ot[u.have++]] = $ & 7, $ >>>= 3, N -= 3;
|
|
6705
6705
|
}
|
|
6706
6706
|
for (; u.have < 19; )
|
|
6707
|
-
u.lens[
|
|
6707
|
+
u.lens[Ot[u.have++]] = 0;
|
|
6708
6708
|
if (u.lencode = u.lendyn, u.lenbits = 7, ot = { bits: u.lenbits }, st = inftrees(CODES, u.lens, 0, 19, u.lencode, 0, u.work, ot), u.lenbits = ot.bits, st) {
|
|
6709
6709
|
a.msg = "invalid code lengths set", u.mode = BAD;
|
|
6710
6710
|
break;
|
|
@@ -7154,7 +7154,7 @@ const noLogEvents = ["heartbeat", "onNetQuality", "networkQualityChange"], compr
|
|
|
7154
7154
|
}
|
|
7155
7155
|
return a;
|
|
7156
7156
|
};
|
|
7157
|
-
var kt, ut,
|
|
7157
|
+
var kt, ut, It, dt, yt, Nt, At, qt, Dt, Rt, Ct, Ut, Mt;
|
|
7158
7158
|
class CallsWebSocket {
|
|
7159
7159
|
// 状态
|
|
7160
7160
|
constructor(I) {
|
|
@@ -7168,7 +7168,7 @@ class CallsWebSocket {
|
|
|
7168
7168
|
// 最大重连次数
|
|
7169
7169
|
timeout: 30 * 1e3
|
|
7170
7170
|
});
|
|
7171
|
-
at(this,
|
|
7171
|
+
at(this, It, "");
|
|
7172
7172
|
// 缓存登录凭证
|
|
7173
7173
|
at(this, dt, {});
|
|
7174
7174
|
at(this, yt, {});
|
|
@@ -7202,7 +7202,7 @@ class CallsWebSocket {
|
|
|
7202
7202
|
return com.quick.voice.proto.CommonReq.encode(I).finish();
|
|
7203
7203
|
});
|
|
7204
7204
|
// 更新日志
|
|
7205
|
-
at(this,
|
|
7205
|
+
at(this, Rt, (I, u = {}) => {
|
|
7206
7206
|
try {
|
|
7207
7207
|
const { time: E, event: _, data: k = {}, data_original: e = {}, data_remote: n, ...O } = u, $ = U(E, "YYYY-MM-DD hh:mm:ss", { offset: 480 });
|
|
7208
7208
|
let N = {};
|
|
@@ -7245,7 +7245,7 @@ class CallsWebSocket {
|
|
|
7245
7245
|
// 接收消息
|
|
7246
7246
|
at(this, Mt, async (I) => {
|
|
7247
7247
|
const u = new Uint8Array(I), E = com.quick.voice.proto.CommonRsp.decode(u), { sn: _, event: k } = E, e = onMessageFormat(E);
|
|
7248
|
-
if (V(this, ut).debug && (noLogEvents.includes(k) || console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff0097;padding:16px 0;", "------->quickvo: 响应消息↓", e), ignoreEvent.includes(k) || V(this,
|
|
7248
|
+
if (V(this, ut).debug && (noLogEvents.includes(k) || console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff0097;padding:16px 0;", "------->quickvo: 响应消息↓", e), ignoreEvent.includes(k) || V(this, Rt).call(this, "res", e)), notifyName_keys.includes(k))
|
|
7249
7249
|
return this.emitNotify(k, L(e, ["code", "data", "desc"]));
|
|
7250
7250
|
const O = V(this, Ut).call(this, _);
|
|
7251
7251
|
if (O) {
|
|
@@ -7271,8 +7271,8 @@ class CallsWebSocket {
|
|
|
7271
7271
|
* @returns
|
|
7272
7272
|
*/
|
|
7273
7273
|
Z(this, "connect", async (I = "") => new Promise(async (u) => {
|
|
7274
|
-
I && wt(this,
|
|
7275
|
-
const E = `${V(this, ut).url}?s=${V(this,
|
|
7274
|
+
I && wt(this, It, I), V(this, kt) && (await V(this, kt).close(), this.state = "closed");
|
|
7275
|
+
const E = `${V(this, ut).url}?s=${V(this, It)}&t=${Date.now()}`;
|
|
7276
7276
|
wt(this, kt, new M({
|
|
7277
7277
|
...V(this, ut),
|
|
7278
7278
|
url: E,
|
|
@@ -7313,7 +7313,7 @@ class CallsWebSocket {
|
|
|
7313
7313
|
compress: !1,
|
|
7314
7314
|
...e
|
|
7315
7315
|
});
|
|
7316
|
-
V(this, ut).debug && (noLogEvents.includes(k) || console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff9700;padding:16px 0;", "------->quickvo: 发送消息↑", O), ignoreEvent.includes(k) || V(this,
|
|
7316
|
+
V(this, ut).debug && (noLogEvents.includes(k) || console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#ff9700;padding:16px 0;", "------->quickvo: 发送消息↑", O), ignoreEvent.includes(k) || V(this, Rt).call(this, "req", O)), u && V(this, Ct).call(this, O, { resolve: E, reject: _ });
|
|
7317
7317
|
const $ = com.quick.voice.proto.CommonReq.encode(O).finish();
|
|
7318
7318
|
(N = V(this, kt)) == null || N.sendMessage($);
|
|
7319
7319
|
}));
|
|
@@ -7358,7 +7358,7 @@ class CallsWebSocket {
|
|
|
7358
7358
|
wt(this, ut, { ...V(this, ut), ...I });
|
|
7359
7359
|
}
|
|
7360
7360
|
}
|
|
7361
|
-
kt = new WeakMap(), ut = new WeakMap(),
|
|
7361
|
+
kt = new WeakMap(), ut = new WeakMap(), It = new WeakMap(), dt = new WeakMap(), yt = new WeakMap(), Nt = new WeakMap(), At = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Rt = new WeakMap(), Ct = new WeakMap(), Ut = new WeakMap(), Mt = new WeakMap();
|
|
7362
7362
|
var y = Object.defineProperty, x = (a) => {
|
|
7363
7363
|
throw TypeError(a);
|
|
7364
7364
|
}, g = (a, I, u) => I in a ? y(a, I, { enumerable: !0, configurable: !0, writable: !0, value: u }) : a[I] = u, h = (a, I, u) => g(a, typeof I != "symbol" ? I + "" : I, u), b = (a, I, u) => I.has(a) || x("Cannot " + u), o = (a, I, u) => (b(a, I, "read from private field"), u ? u.call(a) : I.get(a)), f = (a, I, u) => I.has(a) ? x("Cannot add the same private member more than once") : I instanceof WeakSet ? I.add(a) : I.set(a, u), p = (a, I, u, E) => (b(a, I, "write to private field"), I.set(a, u), u), d, c, l;
|
|
@@ -7566,17 +7566,8 @@ const createMutedAudioStream = () => {
|
|
|
7566
7566
|
const O = _.createLinearGradient(0, 0, E.width, E.height);
|
|
7567
7567
|
O.addColorStop(0, `hsla(${k}, 100%, 50%, 0)`), O.addColorStop(1, `hsla(${k + 120}, 100%, 50%, 0)`), _.fillStyle = O, _.fillRect(0, 0, E.width, E.height), k = (k + 1) % 360;
|
|
7568
7568
|
}, 100), E.captureStream(u);
|
|
7569
|
-
}, phoneyStreams = {
|
|
7570
|
-
microphoneCamera_audio: createMutedAudioStream(),
|
|
7571
|
-
// 假音频流
|
|
7572
|
-
microphoneCamera_video: createFakeVideoStream(),
|
|
7573
|
-
// 假视频流
|
|
7574
|
-
screenSharing_video: createFakeVideoStream(),
|
|
7575
|
-
// 假视频流
|
|
7576
|
-
screenSharing_audio: createMutedAudioStream()
|
|
7577
|
-
// 假音频流
|
|
7578
7569
|
};
|
|
7579
|
-
var bt, vt, _t,
|
|
7570
|
+
var bt, vt, _t, St, Pt, Bt, Lt, $t, jt;
|
|
7580
7571
|
class RoomMedias extends RoomBase {
|
|
7581
7572
|
// 假媒体流
|
|
7582
7573
|
constructor() {
|
|
@@ -7589,14 +7580,27 @@ class RoomMedias extends RoomBase {
|
|
|
7589
7580
|
// 媒体轨道参数管理
|
|
7590
7581
|
at(this, _t, /* @__PURE__ */ new Map());
|
|
7591
7582
|
// 媒体流上下文
|
|
7592
|
-
at(this,
|
|
7583
|
+
at(this, St, /* @__PURE__ */ new Map());
|
|
7593
7584
|
// 初始化假数据流
|
|
7594
7585
|
at(this, Pt, () => {
|
|
7595
7586
|
for (const u of mediaType_keys)
|
|
7596
|
-
|
|
7587
|
+
switch (u) {
|
|
7588
|
+
case "microphoneCamera_audio":
|
|
7589
|
+
V(this, St).set("microphoneCamera_audio", createMutedAudioStream());
|
|
7590
|
+
break;
|
|
7591
|
+
case "microphoneCamera_video":
|
|
7592
|
+
V(this, St).set("microphoneCamera_video", createFakeVideoStream());
|
|
7593
|
+
break;
|
|
7594
|
+
case "screenSharing_audio":
|
|
7595
|
+
V(this, St).set("screenSharing_audio", createMutedAudioStream());
|
|
7596
|
+
break;
|
|
7597
|
+
case "screenSharing_video":
|
|
7598
|
+
V(this, St).set("screenSharing_video", createFakeVideoStream());
|
|
7599
|
+
break;
|
|
7600
|
+
}
|
|
7597
7601
|
});
|
|
7598
7602
|
// 获取假数据流
|
|
7599
|
-
Z(this, "getPhoneyStreams", (u) => V(this,
|
|
7603
|
+
Z(this, "getPhoneyStreams", (u) => V(this, St).get(u));
|
|
7600
7604
|
/**
|
|
7601
7605
|
* 初始化媒体参数
|
|
7602
7606
|
*/
|
|
@@ -7728,7 +7732,7 @@ class RoomMedias extends RoomBase {
|
|
|
7728
7732
|
*/
|
|
7729
7733
|
Z(this, "initLocalStream", async (u) => {
|
|
7730
7734
|
const { userId: E } = this.options, _ = V(this, vt).get(u);
|
|
7731
|
-
switch (u) {
|
|
7735
|
+
switch (this.removeUserMediaStreamContext(E, u), u) {
|
|
7732
7736
|
// 麦克风
|
|
7733
7737
|
case "microphoneCamera_audio":
|
|
7734
7738
|
{
|
|
@@ -7761,12 +7765,16 @@ class RoomMedias extends RoomBase {
|
|
|
7761
7765
|
}
|
|
7762
7766
|
break;
|
|
7763
7767
|
}
|
|
7764
|
-
|
|
7768
|
+
{
|
|
7769
|
+
this.emitNotifyUpdateUsersStreams([{ userId: E, updateStreams: { [u]: !0 } }]);
|
|
7770
|
+
const k = this.getUserStreams(E);
|
|
7771
|
+
this.cwsIns.emitNotify("onLocalStream", { code: 200, data: k, desc: "local stream is change." });
|
|
7772
|
+
}
|
|
7765
7773
|
});
|
|
7766
7774
|
/**
|
|
7767
7775
|
* 获取媒体设备列表
|
|
7768
7776
|
*/
|
|
7769
|
-
at(this,
|
|
7777
|
+
at(this, $t, async () => !navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices ? (console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 不支持 enumerateDevices"), []) : (await navigator.mediaDevices.enumerateDevices().then((u) => {
|
|
7770
7778
|
this.mediaDevices = u;
|
|
7771
7779
|
}).catch(function(u) {
|
|
7772
7780
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getEnumerateDevices is err", u);
|
|
@@ -7776,8 +7784,8 @@ class RoomMedias extends RoomBase {
|
|
|
7776
7784
|
*/
|
|
7777
7785
|
at(this, jt, () => {
|
|
7778
7786
|
navigator.mediaDevices && (navigator.mediaDevices.ondevicechange = async () => {
|
|
7779
|
-
await V(this,
|
|
7780
|
-
}), V(this,
|
|
7787
|
+
await V(this, $t).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
|
|
7788
|
+
}), V(this, $t).call(this);
|
|
7781
7789
|
});
|
|
7782
7790
|
/**
|
|
7783
7791
|
* 获取正在使用的媒体设备ID
|
|
@@ -7785,35 +7793,16 @@ class RoomMedias extends RoomBase {
|
|
|
7785
7793
|
* @returns deviceId 设备ID
|
|
7786
7794
|
*/
|
|
7787
7795
|
Z(this, "getMediaDeviceKind", (u) => V(this, bt).get(u));
|
|
7788
|
-
/**
|
|
7789
|
-
* 替换发射器媒体流
|
|
7790
|
-
*/
|
|
7791
|
-
Z(this, "replaceSenderStream", async (u = [], E) => {
|
|
7792
|
-
const { userId: _ } = this.options;
|
|
7793
|
-
u.length === 0 && (u = mediaType_keys);
|
|
7794
|
-
for (const k of u) {
|
|
7795
|
-
const e = this.transceiverMap.get(k);
|
|
7796
|
-
let n;
|
|
7797
|
-
if (e) {
|
|
7798
|
-
const { sender: O } = e;
|
|
7799
|
-
E ? n = this.getUserStream(_, k) : n = this.getPhoneyStreams(k);
|
|
7800
|
-
const [$] = n.getTracks();
|
|
7801
|
-
O.replaceTrack($);
|
|
7802
|
-
}
|
|
7803
|
-
}
|
|
7804
|
-
});
|
|
7805
7796
|
/**
|
|
7806
7797
|
* 设置正在使用的媒体设备
|
|
7807
7798
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7808
7799
|
* @param deviceId 设备ID
|
|
7809
7800
|
*/
|
|
7810
|
-
Z(this, "
|
|
7811
|
-
V(this, bt).set(u, E)
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
for (const e of k)
|
|
7816
|
-
e.kind === "audio" && "setSinkId" in HTMLMediaElement.prototype && e.audioContext.setSinkId(E);
|
|
7801
|
+
Z(this, "setDeviceKind", async (u, E) => {
|
|
7802
|
+
if (V(this, bt).set(u, E), u === "audiooutput") {
|
|
7803
|
+
const _ = V(this, _t).values();
|
|
7804
|
+
for (const k of _)
|
|
7805
|
+
k.kind === "audio" && "setSinkId" in HTMLMediaElement.prototype && k.audioContext.setSinkId(E);
|
|
7817
7806
|
}
|
|
7818
7807
|
});
|
|
7819
7808
|
/**
|
|
@@ -7821,13 +7810,13 @@ class RoomMedias extends RoomBase {
|
|
|
7821
7810
|
* @param deviceId 设备ID
|
|
7822
7811
|
* @returns
|
|
7823
7812
|
*/
|
|
7824
|
-
Z(this, "setAudioOutputDevice", (u) => this.
|
|
7813
|
+
Z(this, "setAudioOutputDevice", (u) => this.setDeviceKind("audiooutput", u));
|
|
7825
7814
|
/**
|
|
7826
7815
|
* 获取可用设备
|
|
7827
7816
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7828
7817
|
* @returns MediaDeviceInfo[]
|
|
7829
7818
|
*/
|
|
7830
|
-
Z(this, "getEnumerateDevices", async (u) => (await V(this,
|
|
7819
|
+
Z(this, "getEnumerateDevices", async (u) => (await V(this, $t).call(this), this.mediaDevices.filter((_) => _.kind === u)));
|
|
7831
7820
|
/**
|
|
7832
7821
|
* 获取可用音频输入设备
|
|
7833
7822
|
* @returns MediaDeviceInfo[]
|
|
@@ -7846,7 +7835,7 @@ class RoomMedias extends RoomBase {
|
|
|
7846
7835
|
V(this, jt).call(this), V(this, Lt).call(this), V(this, Bt).call(this), V(this, Pt).call(this);
|
|
7847
7836
|
}
|
|
7848
7837
|
}
|
|
7849
|
-
bt = new WeakMap(), vt = new WeakMap(), _t = new WeakMap(),
|
|
7838
|
+
bt = new WeakMap(), vt = new WeakMap(), _t = new WeakMap(), St = new WeakMap(), Pt = new WeakMap(), Bt = new WeakMap(), Lt = new WeakMap(), $t = new WeakMap(), jt = new WeakMap();
|
|
7850
7839
|
class RoomUsers extends RoomMedias {
|
|
7851
7840
|
constructor() {
|
|
7852
7841
|
super();
|
|
@@ -8157,6 +8146,40 @@ class RoomPeer extends RoomUsers {
|
|
|
8157
8146
|
Z(this, "initPeer", () => {
|
|
8158
8147
|
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.transceiverMap = /* @__PURE__ */ new Map(), V(this, Zt).call(this), V(this, Ht).call(this);
|
|
8159
8148
|
});
|
|
8149
|
+
/**
|
|
8150
|
+
* 设置正在使用的媒体设备
|
|
8151
|
+
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
8152
|
+
* @param deviceId 设备ID
|
|
8153
|
+
*/
|
|
8154
|
+
Z(this, "setMediaDeviceKind", async (u, E) => {
|
|
8155
|
+
await this.setDeviceKind(u, E);
|
|
8156
|
+
const _ = await this.getCaller(), { id: k, tracks: e = [] } = _;
|
|
8157
|
+
switch (u) {
|
|
8158
|
+
case "audioinput":
|
|
8159
|
+
this.getUserMediaStreamContext(k, "microphoneCamera_audio") && await this.initLocalStream("microphoneCamera_audio"), e.find(($) => $.mediaType === "microphoneCamera_audio") && await this.replaceSenderStream(["microphoneCamera_audio"], !0);
|
|
8160
|
+
break;
|
|
8161
|
+
case "videoinput":
|
|
8162
|
+
this.getUserMediaStreamContext(k, "microphoneCamera_video") && await this.initLocalStream("microphoneCamera_video"), e.find(($) => $.mediaType === "microphoneCamera_video") && await this.replaceSenderStream(["microphoneCamera_video"], !0);
|
|
8163
|
+
break;
|
|
8164
|
+
}
|
|
8165
|
+
});
|
|
8166
|
+
/**
|
|
8167
|
+
* 替换发射器媒体流
|
|
8168
|
+
*/
|
|
8169
|
+
Z(this, "replaceSenderStream", async (u = [], E) => {
|
|
8170
|
+
const { userId: _ } = this.options;
|
|
8171
|
+
u.length === 0 && (u = mediaType_keys);
|
|
8172
|
+
for (const k of u) {
|
|
8173
|
+
const e = this.transceiverMap.get(k);
|
|
8174
|
+
let n;
|
|
8175
|
+
if (e) {
|
|
8176
|
+
const { sender: O } = e;
|
|
8177
|
+
E ? n = this.getUserStream(_, k) : n = this.getPhoneyStreams(k);
|
|
8178
|
+
const [$] = n.getTracks();
|
|
8179
|
+
O.replaceTrack($);
|
|
8180
|
+
}
|
|
8181
|
+
}
|
|
8182
|
+
});
|
|
8160
8183
|
/**
|
|
8161
8184
|
* 获取发射器轨道信息
|
|
8162
8185
|
*/
|
|
@@ -8463,7 +8486,7 @@ class RoomPeer extends RoomUsers {
|
|
|
8463
8486
|
}
|
|
8464
8487
|
}
|
|
8465
8488
|
Zt = new WeakMap(), Ft = new WeakMap(), Ht = new WeakMap();
|
|
8466
|
-
var zt,
|
|
8489
|
+
var zt, Tt;
|
|
8467
8490
|
class RoomCalls extends RoomPeer {
|
|
8468
8491
|
constructor() {
|
|
8469
8492
|
super();
|
|
@@ -8611,7 +8634,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8611
8634
|
this.getUserStream(e.id, D).getTracks().length !== 0 && n.push(D);
|
|
8612
8635
|
await this.createTrack(n), await this.replaceSenderStream(n, !0);
|
|
8613
8636
|
const O = this.getSenderTracks(u), $ = [...e.tracks, ...O], N = await this.getCallAction($);
|
|
8614
|
-
await this.updateUsertracks(e.id, $, !0), V(this, zt).call(this, u), await V(this,
|
|
8637
|
+
await this.updateUsertracks(e.id, $, !0), V(this, zt).call(this, u), await V(this, Tt).call(this, N);
|
|
8615
8638
|
{
|
|
8616
8639
|
await this.emitNotifyUpdateUsers();
|
|
8617
8640
|
const D = await this.getCaller();
|
|
@@ -8647,7 +8670,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8647
8670
|
await this.replaceSenderStream(u, !0), await this.removeSenders(u), await this.closeUserTracks(e.id, n, !0);
|
|
8648
8671
|
{
|
|
8649
8672
|
const $ = await this.getCallAction(e.tracks);
|
|
8650
|
-
await V(this,
|
|
8673
|
+
await V(this, Tt).call(this, $);
|
|
8651
8674
|
}
|
|
8652
8675
|
await this.createOffer(), await this.cwsIns.sendMessage({
|
|
8653
8676
|
event: "closeTrack",
|
|
@@ -8774,7 +8797,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8774
8797
|
}
|
|
8775
8798
|
}
|
|
8776
8799
|
const O = await this.getCallAction(n);
|
|
8777
|
-
await V(this,
|
|
8800
|
+
await V(this, Tt).call(this, O), await this.emitNotifyUpdateUsers(), _(!0);
|
|
8778
8801
|
}));
|
|
8779
8802
|
/**
|
|
8780
8803
|
* 远端调试
|
|
@@ -8790,7 +8813,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8790
8813
|
/**
|
|
8791
8814
|
* 更新自己通话状态
|
|
8792
8815
|
*/
|
|
8793
|
-
at(this,
|
|
8816
|
+
at(this, Tt, async (u) => new Promise(async (E, _) => {
|
|
8794
8817
|
const { roomId: k, userId: e } = this.options, n = { roomId: k, user: { id: e, callAction: u } };
|
|
8795
8818
|
await this.cwsIns.sendMessage({ event: "updateCall", data: n }).then(async (O) => {
|
|
8796
8819
|
const { code: $ = 0 } = O;
|
|
@@ -8817,7 +8840,8 @@ class RoomCalls extends RoomPeer {
|
|
|
8817
8840
|
if (["connecting", "connected"].includes(this.cwsIns.state)) return u(!0);
|
|
8818
8841
|
this.taskQueue.setCondition("createWs", !1), this.cwsIns.clearEvents(), this.initPeer();
|
|
8819
8842
|
const { appid: _ } = this.options, { userId: k, sdkToken: e, roomId: n } = this.options;
|
|
8820
|
-
if (!
|
|
8843
|
+
if (!_) return E("quickvo: createWs is error. You must first use QuickVO.setOptions to set the appid.");
|
|
8844
|
+
if (!k) return E("quickvo: createWs is error. You must first use QuickVO.setOptions to set the userId.");
|
|
8821
8845
|
const O = {
|
|
8822
8846
|
a: e,
|
|
8823
8847
|
b: k,
|
|
@@ -8825,11 +8849,11 @@ class RoomCalls extends RoomPeer {
|
|
|
8825
8849
|
r: n,
|
|
8826
8850
|
v: this.sdk_service_version
|
|
8827
8851
|
};
|
|
8828
|
-
this.isEarly && (O.i = ht()), this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->
|
|
8852
|
+
this.isEarly && (O.i = ht()), this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: createWs", O);
|
|
8829
8853
|
const $ = btoa(encodeURI(JSON.stringify(O)));
|
|
8830
8854
|
await this.cwsIns.connect($), this.taskQueue.setCondition("createWs", !0), u(!0);
|
|
8831
8855
|
} catch (_) {
|
|
8832
|
-
console.
|
|
8856
|
+
console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: createWs is error.", _), E(_);
|
|
8833
8857
|
}
|
|
8834
8858
|
}));
|
|
8835
8859
|
/**
|
|
@@ -8862,7 +8886,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8862
8886
|
Z(this, "createTrack", async (u) => new Promise((E) => {
|
|
8863
8887
|
const _ = async () => {
|
|
8864
8888
|
try {
|
|
8865
|
-
|
|
8889
|
+
this.taskQueue.setCondition("createTrack", !1);
|
|
8866
8890
|
const k = await this.addSenders(u), e = this.getSenderTracks(k);
|
|
8867
8891
|
if (e.length === 0)
|
|
8868
8892
|
return this.taskQueue.setCondition("createTrack", !0), E(!0);
|
|
@@ -8891,17 +8915,17 @@ class RoomCalls extends RoomPeer {
|
|
|
8891
8915
|
this.setRoomState("ready");
|
|
8892
8916
|
}
|
|
8893
8917
|
}
|
|
8894
|
-
zt = new WeakMap(),
|
|
8918
|
+
zt = new WeakMap(), Tt = new WeakMap();
|
|
8895
8919
|
class Room extends RoomCalls {
|
|
8896
8920
|
constructor() {
|
|
8897
8921
|
super();
|
|
8898
8922
|
}
|
|
8899
8923
|
}
|
|
8900
|
-
var
|
|
8924
|
+
var gt, Jt, Wt, Kt, Gt;
|
|
8901
8925
|
class QuickVO extends Room {
|
|
8902
8926
|
constructor(u) {
|
|
8903
8927
|
super();
|
|
8904
|
-
at(this,
|
|
8928
|
+
at(this, gt, /* @__PURE__ */ new Map());
|
|
8905
8929
|
/**
|
|
8906
8930
|
* 添加内部监听事件
|
|
8907
8931
|
*/
|
|
@@ -9004,13 +9028,13 @@ class QuickVO extends Room {
|
|
|
9004
9028
|
*/
|
|
9005
9029
|
Z(this, "addRequestAnimationFrame", async (u, E) => {
|
|
9006
9030
|
{
|
|
9007
|
-
const k = V(this,
|
|
9031
|
+
const k = V(this, gt).get(u);
|
|
9008
9032
|
k && cancelAnimationFrame(k);
|
|
9009
9033
|
}
|
|
9010
9034
|
const _ = (k = Date.now()) => {
|
|
9011
9035
|
E(k);
|
|
9012
9036
|
const e = requestAnimationFrame(_);
|
|
9013
|
-
V(this,
|
|
9037
|
+
V(this, gt).set(u, e);
|
|
9014
9038
|
};
|
|
9015
9039
|
_();
|
|
9016
9040
|
});
|
|
@@ -9019,10 +9043,10 @@ class QuickVO extends Room {
|
|
|
9019
9043
|
* @param keys string[] = []
|
|
9020
9044
|
*/
|
|
9021
9045
|
Z(this, "clearRequestAnimationFrame", async (u = []) => {
|
|
9022
|
-
u.length === 0 && (u = [...V(this,
|
|
9046
|
+
u.length === 0 && (u = [...V(this, gt).keys()]);
|
|
9023
9047
|
const E = [];
|
|
9024
9048
|
for (const _ of u) {
|
|
9025
|
-
const k = V(this,
|
|
9049
|
+
const k = V(this, gt).get(_);
|
|
9026
9050
|
k && (cancelAnimationFrame(k), E.push(k));
|
|
9027
9051
|
}
|
|
9028
9052
|
return E;
|
|
@@ -9037,7 +9061,7 @@ class QuickVO extends Room {
|
|
|
9037
9061
|
this.setOptions(u), this.initCwsCall(), V(this, Wt).call(this), V(this, Kt).call(this), V(this, Gt).call(this), V(this, Jt).call(this);
|
|
9038
9062
|
}
|
|
9039
9063
|
}
|
|
9040
|
-
|
|
9064
|
+
gt = new WeakMap(), Jt = new WeakMap(), Wt = new WeakMap(), Kt = new WeakMap(), Gt = new WeakMap();
|
|
9041
9065
|
export {
|
|
9042
9066
|
QuickVO,
|
|
9043
9067
|
ignoreEvent
|