quickvo-sdk-js 0.7.6 → 0.7.8
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.
|
@@ -15,6 +15,7 @@ export declare const enum_eventName: {
|
|
|
15
15
|
readonly debugger: "调试";
|
|
16
16
|
readonly pubNotify: "webrtc发布状态正常";
|
|
17
17
|
readonly heartbeat: "心跳";
|
|
18
|
+
readonly shutdown: "清除缓存";
|
|
18
19
|
};
|
|
19
20
|
export type T_eventName = typeof enum_eventName;
|
|
20
21
|
export type K_eventName = keyof T_eventName;
|
|
@@ -24,4 +25,4 @@ export declare const eventName_options: {
|
|
|
24
25
|
label: any;
|
|
25
26
|
}[];
|
|
26
27
|
export declare const eventName_keys: (keyof typeof enum_eventName)[];
|
|
27
|
-
export declare const eventName_vals: ("更新网络状态" | "更新通话状态" | "同步房间" | "关闭轨道" | "协商流" | "订阅流" | "发布流" | "连接CF" | "退出房间" | "退出房间不断开连接" | "加入房间" | "加入房间(提前建连)" | "登录" | "调试" | "webrtc发布状态正常" | "心跳")[];
|
|
28
|
+
export declare const eventName_vals: ("更新网络状态" | "更新通话状态" | "同步房间" | "关闭轨道" | "协商流" | "订阅流" | "发布流" | "连接CF" | "退出房间" | "退出房间不断开连接" | "加入房间" | "加入房间(提前建连)" | "登录" | "调试" | "webrtc发布状态正常" | "心跳" | "清除缓存")[];
|
package/dist/index.js
CHANGED
|
@@ -784,7 +784,7 @@ class AudioMediaContext {
|
|
|
784
784
|
/**
|
|
785
785
|
* 获取数据流
|
|
786
786
|
*/
|
|
787
|
-
Z(this, "getStream", () => this.
|
|
787
|
+
Z(this, "getStream", () => this.sourceNode.mediaStream);
|
|
788
788
|
/**
|
|
789
789
|
* 静音
|
|
790
790
|
*/
|
|
@@ -8436,7 +8436,9 @@ class RoomPeer extends RoomUsers {
|
|
|
8436
8436
|
k.length === e.length && n();
|
|
8437
8437
|
}
|
|
8438
8438
|
};
|
|
8439
|
-
this.peerIns.addEventListener("track", O), E = setTimeout(() =>
|
|
8439
|
+
this.peerIns.addEventListener("track", O), E = setTimeout(() => {
|
|
8440
|
+
this.reportLogs("subscribe_error", `incomplete subscription. (${e.length}/${k.length})`), n();
|
|
8441
|
+
}, 5 * 1e3);
|
|
8440
8442
|
}
|
|
8441
8443
|
});
|
|
8442
8444
|
});
|
|
@@ -8532,10 +8534,6 @@ class RoomPeer extends RoomUsers {
|
|
|
8532
8534
|
}
|
|
8533
8535
|
return await this.peerIns.setRemoteDescription(a), a;
|
|
8534
8536
|
});
|
|
8535
|
-
/**
|
|
8536
|
-
* 获取peer网络情况
|
|
8537
|
-
*/
|
|
8538
|
-
Z(this, "getPeerNetwork", () => this.peerNetwork);
|
|
8539
8537
|
/**
|
|
8540
8538
|
* 设置通讯策略
|
|
8541
8539
|
* @param callStrategy "fixedPictureQuality" | "qualityPriority" | "fluencyPriority" | "balancedDowngrade"
|
|
@@ -8590,12 +8588,16 @@ class RoomPeer extends RoomUsers {
|
|
|
8590
8588
|
* 获取房间网络信息
|
|
8591
8589
|
*/
|
|
8592
8590
|
Z(this, "getRoomNetwork", () => this.peerNetwork);
|
|
8591
|
+
/**
|
|
8592
|
+
* 获取peer网络情况
|
|
8593
|
+
*/
|
|
8594
|
+
Z(this, "getPeerNetwork", () => this.peerNetwork);
|
|
8593
8595
|
/**
|
|
8594
8596
|
* 计算网络质量
|
|
8595
8597
|
*/
|
|
8596
8598
|
at(this, Vt, async () => {
|
|
8597
8599
|
try {
|
|
8598
|
-
const a = await this.peerIns.getStats(), E = ["inbound-rtp", "remote-inbound-rtp", "outbound-rtp"], k = [...a.values()].filter((nt) => E.includes(nt.type));
|
|
8600
|
+
const a = await this.peerIns.getStats(), E = ["inbound-rtp", "remote-inbound-rtp", "outbound-rtp", "transport"], k = [...a.values()].filter((nt) => E.includes(nt.type));
|
|
8599
8601
|
let e = 0, n = 0, O = 0, $ = 0, N = 0, D = 0, q = [], P = [];
|
|
8600
8602
|
for (const nt of this.reports) {
|
|
8601
8603
|
const { packetsSent: ut, packetsLost: it } = nt;
|
|
@@ -8603,11 +8605,11 @@ class RoomPeer extends RoomUsers {
|
|
|
8603
8605
|
}
|
|
8604
8606
|
this.reports = k;
|
|
8605
8607
|
for (const nt of this.reports) {
|
|
8606
|
-
const {
|
|
8607
|
-
ut && (
|
|
8608
|
+
const { bytesSent: ut, bytesReceived: it, packetsSent: lt, packetsLost: st, roundTripTime: rt, jitter: ct } = nt;
|
|
8609
|
+
ut && (n = ut), it && (e = it), lt && (N += lt), st && (D += st), rt && q.push((rt * 100).toFixed(2)), ct && P.push(ct.toFixed(2));
|
|
8608
8610
|
}
|
|
8609
8611
|
P.sort().reverse(), q.sort().reverse();
|
|
8610
|
-
const j = N - O, V = D - $, J = j === 0 ? "0.00" : (V / j).toFixed(2), [z = "0"] = q, [Y = "0"] = P, et = {
|
|
8612
|
+
const j = N - O, V = D - $, J = j === 0 ? "0.00" : (V / j).toFixed(2), [z = "0"] = q, [Y = "0"] = P, et = { outboundBytes: n, inboundBytes: e, lostRate: J, roundTripTime: z, jitter: Y };
|
|
8611
8613
|
this.peerNetwork = et;
|
|
8612
8614
|
const tt = (nt, ut, it) => {
|
|
8613
8615
|
const lt = Number(nt), st = Number(ut), rt = Number(it);
|
|
@@ -8825,7 +8827,6 @@ class RoomCalls extends RoomPeer {
|
|
|
8825
8827
|
z == null || z.replaceStream(J), V && await this.replaceSenderStream([q], !0);
|
|
8826
8828
|
}
|
|
8827
8829
|
}
|
|
8828
|
-
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: setMediaDeviceKind", { mediaType: q, isOpen: P, hadTrack: j, isActive: V });
|
|
8829
8830
|
{
|
|
8830
8831
|
const J = this.getLocalStreams(N);
|
|
8831
8832
|
this.cwsIns.emitNotify("onLocalStream", { code: 200, data: J, desc: "local stream is change." }), _(!0);
|
|
@@ -8867,7 +8868,8 @@ class RoomCalls extends RoomPeer {
|
|
|
8867
8868
|
const { roomId: O, userId: $, callType: N } = this.options;
|
|
8868
8869
|
this.cwsIns.sendMessage({
|
|
8869
8870
|
event: this.isEarly ? "joinRoomEx" : "joinRoom",
|
|
8870
|
-
data: { callType: N, roomId: O, user: { id: $, tracks: [], callAction: 0 } }
|
|
8871
|
+
data: { callType: N, roomId: O, user: { id: $, tracks: [], callAction: 0 } },
|
|
8872
|
+
version: 2
|
|
8871
8873
|
}).then(async (D) => {
|
|
8872
8874
|
const { code: q = 0, desc: P = "服务器繁忙", data: j } = D;
|
|
8873
8875
|
if (q !== 200) return _(P);
|
|
@@ -9150,6 +9152,17 @@ class RoomCalls extends RoomPeer {
|
|
|
9150
9152
|
E(_);
|
|
9151
9153
|
});
|
|
9152
9154
|
}));
|
|
9155
|
+
/**
|
|
9156
|
+
* 清除缓存
|
|
9157
|
+
*/
|
|
9158
|
+
Z(this, "shutdown", () => new Promise(async (a, E) => {
|
|
9159
|
+
await this.cwsIns.sendMessage({ event: "shutdown" }, !1).then(async (_) => {
|
|
9160
|
+
if (_.code !== 200) return E(_.desc);
|
|
9161
|
+
a(!0);
|
|
9162
|
+
}).catch((_) => {
|
|
9163
|
+
E(_);
|
|
9164
|
+
});
|
|
9165
|
+
}));
|
|
9153
9166
|
}
|
|
9154
9167
|
}
|
|
9155
9168
|
Xt = new WeakMap(), xt = new WeakMap(), qt = new WeakMap(), Dt = new WeakMap(), Ct = new WeakMap();
|