quickvo-sdk-js 0.2.4 → 0.2.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 +19 -20
- package/dist/index.umd.cjs +2 -2
- package/dist/room/RoomMedias.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6852,7 +6852,7 @@ class RoomBase {
|
|
|
6852
6852
|
K(this, "usersFilter", (D) => mt(D, ["id", "isSelf", "joinTime", "tracks", "callAction", "callActionStr", "callActionMap", "network", "updateStreams", "permissions", "isPublished"]).sort((R, N) => R.id.localeCompare(N.id, "en")));
|
|
6853
6853
|
}
|
|
6854
6854
|
}
|
|
6855
|
-
var wt, vt, kt, Pt, Bt,
|
|
6855
|
+
var wt, vt, kt, Pt, Bt, Tt, Lt;
|
|
6856
6856
|
class RoomMedias extends RoomBase {
|
|
6857
6857
|
// 媒体流上下文
|
|
6858
6858
|
constructor() {
|
|
@@ -6972,7 +6972,7 @@ class RoomMedias extends RoomBase {
|
|
|
6972
6972
|
/**
|
|
6973
6973
|
* 清除所有媒体流使用
|
|
6974
6974
|
*/
|
|
6975
|
-
K(this, "clearUserStreams",
|
|
6975
|
+
K(this, "clearUserStreams", () => {
|
|
6976
6976
|
const $ = G(this, kt).values();
|
|
6977
6977
|
for (const U of $)
|
|
6978
6978
|
U.stop();
|
|
@@ -7037,7 +7037,7 @@ class RoomMedias extends RoomBase {
|
|
|
7037
7037
|
/**
|
|
7038
7038
|
* 获取媒体设备列表
|
|
7039
7039
|
*/
|
|
7040
|
-
st(this,
|
|
7040
|
+
st(this, Tt, 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(($) => {
|
|
7041
7041
|
this.mediaDevices = $;
|
|
7042
7042
|
}).catch(function($) {
|
|
7043
7043
|
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: getEnumerateDevices is err", $);
|
|
@@ -7047,8 +7047,8 @@ class RoomMedias extends RoomBase {
|
|
|
7047
7047
|
*/
|
|
7048
7048
|
st(this, Lt, () => {
|
|
7049
7049
|
navigator.mediaDevices.ondevicechange = async () => {
|
|
7050
|
-
await G(this,
|
|
7051
|
-
}, G(this,
|
|
7050
|
+
await G(this, Tt).call(this), this.cwsIns.emitNotify("onDevicechange", { code: 200, data: {}, desc: "device is change." });
|
|
7051
|
+
}, G(this, Tt).call(this);
|
|
7052
7052
|
});
|
|
7053
7053
|
/**
|
|
7054
7054
|
* 获取正在使用的媒体设备ID
|
|
@@ -7107,7 +7107,7 @@ class RoomMedias extends RoomBase {
|
|
|
7107
7107
|
* @param mediaDeviceKind 设备类型 "audioinput" | "audiooutput" | "videoinput"
|
|
7108
7108
|
* @returns MediaDeviceInfo[]
|
|
7109
7109
|
*/
|
|
7110
|
-
K(this, "getEnumerateDevices", async ($) => (await G(this,
|
|
7110
|
+
K(this, "getEnumerateDevices", async ($) => (await G(this, Tt).call(this), this.mediaDevices.filter((R) => R.kind === $)));
|
|
7111
7111
|
/**
|
|
7112
7112
|
* 获取可用音频输入设备
|
|
7113
7113
|
* @returns MediaDeviceInfo[]
|
|
@@ -7126,7 +7126,7 @@ class RoomMedias extends RoomBase {
|
|
|
7126
7126
|
G(this, Lt).call(this), G(this, Bt).call(this), G(this, Pt).call(this);
|
|
7127
7127
|
}
|
|
7128
7128
|
}
|
|
7129
|
-
wt = new WeakMap(), vt = new WeakMap(), kt = new WeakMap(), Pt = new WeakMap(), Bt = new WeakMap(),
|
|
7129
|
+
wt = new WeakMap(), vt = new WeakMap(), kt = new WeakMap(), Pt = new WeakMap(), Bt = new WeakMap(), Tt = new WeakMap(), Lt = new WeakMap();
|
|
7130
7130
|
class RoomUsers extends RoomMedias {
|
|
7131
7131
|
constructor() {
|
|
7132
7132
|
super();
|
|
@@ -7422,9 +7422,7 @@ class RoomPeer extends RoomUsers {
|
|
|
7422
7422
|
});
|
|
7423
7423
|
K(this, "connectedResolveMap", /* @__PURE__ */ new Map());
|
|
7424
7424
|
K(this, "initPeer", () => {
|
|
7425
|
-
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), this.
|
|
7426
|
-
console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->Breathe: e", $);
|
|
7427
|
-
}, G(this, Zt).call(this), G(this, Ht).call(this);
|
|
7425
|
+
this.peerIns = new RTCPeerConnection({ bundlePolicy: "max-bundle" }), G(this, Zt).call(this), G(this, Ht).call(this);
|
|
7428
7426
|
});
|
|
7429
7427
|
/**
|
|
7430
7428
|
* 初始化发射器
|
|
@@ -7524,7 +7522,7 @@ class RoomPeer extends RoomUsers {
|
|
|
7524
7522
|
st(this, Zt, async () => {
|
|
7525
7523
|
let $ = 0;
|
|
7526
7524
|
const U = () => {
|
|
7527
|
-
this.setRoomState("disconnected")
|
|
7525
|
+
this.setRoomState("disconnected");
|
|
7528
7526
|
};
|
|
7529
7527
|
this.peerIns.onconnectionstatechange = async () => {
|
|
7530
7528
|
const R = this.peerIns.connectionState;
|
|
@@ -7738,7 +7736,7 @@ class RoomPeer extends RoomUsers {
|
|
|
7738
7736
|
}
|
|
7739
7737
|
}
|
|
7740
7738
|
Zt = new WeakMap(), Ft = new WeakMap(), jt = new WeakMap(), Ht = new WeakMap();
|
|
7741
|
-
var Ot,
|
|
7739
|
+
var Ot, It, zt;
|
|
7742
7740
|
class RoomCalls extends RoomPeer {
|
|
7743
7741
|
constructor() {
|
|
7744
7742
|
super();
|
|
@@ -7805,7 +7803,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7805
7803
|
*/
|
|
7806
7804
|
K(this, "quitRoom", async () => new Promise(async ($) => {
|
|
7807
7805
|
const { roomId: U, userId: R } = this.options, N = { roomId: U, user: { id: R } };
|
|
7808
|
-
this.cwsIns.sendMessage({ event: "quitRoom", data: N }), await new Promise((e) => setTimeout(() => e(!0), 300)),
|
|
7806
|
+
this.cwsIns.sendMessage({ event: "quitRoom", data: N }), this.stopGetPeerStats(), this.asyncQueue.clear(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), await new Promise((e) => setTimeout(() => e(!0), 300)), $(!0);
|
|
7809
7807
|
}));
|
|
7810
7808
|
/**
|
|
7811
7809
|
* 同步房间信息
|
|
@@ -7857,7 +7855,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7857
7855
|
throw this.options.debug && console.error("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: publish is error. count 0", { mediaTypes: $ }), new Error(z);
|
|
7858
7856
|
}
|
|
7859
7857
|
const { remoteSdp: W } = V;
|
|
7860
|
-
await this.setRemoteDescription({ type: "answer", sdp: W }), await this.connectionICE(), await this.updateUsertracks(o.id, M, !0), await G(this,
|
|
7858
|
+
await this.setRemoteDescription({ type: "answer", sdp: W }), await this.connectionICE(), await this.updateUsertracks(o.id, M, !0), await G(this, It).call(this, L), G(this, Ot) || this.cwsIns.sendMessage({ event: "pubNotify", data: { roomId: "", user: { id: o.id, tracks: A } } });
|
|
7861
7859
|
{
|
|
7862
7860
|
await this.emitNotifyUpdateUsers();
|
|
7863
7861
|
const J = await this.getCaller();
|
|
@@ -7891,7 +7889,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7891
7889
|
await this.closeUserTracks(e.id, o, !0);
|
|
7892
7890
|
{
|
|
7893
7891
|
const M = await this.getCallAction(e.tracks);
|
|
7894
|
-
await G(this,
|
|
7892
|
+
await G(this, It).call(this, M);
|
|
7895
7893
|
}
|
|
7896
7894
|
await this.createOffer(), await this.cwsIns.sendMessage({
|
|
7897
7895
|
event: "closeTrack",
|
|
@@ -7928,6 +7926,7 @@ class RoomCalls extends RoomPeer {
|
|
|
7928
7926
|
}
|
|
7929
7927
|
}
|
|
7930
7928
|
const M = async () => {
|
|
7929
|
+
this.prohibitNotify = !1;
|
|
7931
7930
|
const Z = Array.from(A, ({ id: z }) => z), H = await this.getUsers(Z);
|
|
7932
7931
|
await this.emitNotifyUpdateUsers(), N(H);
|
|
7933
7932
|
};
|
|
@@ -8013,7 +8012,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8013
8012
|
}
|
|
8014
8013
|
}
|
|
8015
8014
|
const A = await this.getCallAction(o);
|
|
8016
|
-
await G(this,
|
|
8015
|
+
await G(this, It).call(this, A), await this.emitNotifyUpdateUsers();
|
|
8017
8016
|
};
|
|
8018
8017
|
return this.asyncQueue.add(R, { key: "inactiveTracks" });
|
|
8019
8018
|
});
|
|
@@ -8031,7 +8030,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8031
8030
|
/**
|
|
8032
8031
|
* 更新自己通话状态
|
|
8033
8032
|
*/
|
|
8034
|
-
st(this,
|
|
8033
|
+
st(this, It, async ($) => new Promise(async (U, R) => {
|
|
8035
8034
|
const { roomId: N, userId: e } = this.options, o = { roomId: N, user: { id: e, callAction: $ } };
|
|
8036
8035
|
await this.cwsIns.sendMessage({ event: "updateCall", data: o }).then(async (A) => {
|
|
8037
8036
|
const { code: M = 0 } = A;
|
|
@@ -8083,7 +8082,7 @@ class RoomCalls extends RoomPeer {
|
|
|
8083
8082
|
this.setRoomState("ready");
|
|
8084
8083
|
}
|
|
8085
8084
|
}
|
|
8086
|
-
Ot = new WeakMap(),
|
|
8085
|
+
Ot = new WeakMap(), It = new WeakMap(), zt = new WeakMap();
|
|
8087
8086
|
class Room extends RoomCalls {
|
|
8088
8087
|
constructor() {
|
|
8089
8088
|
super();
|
|
@@ -8186,7 +8185,7 @@ class QuickVO extends Room {
|
|
|
8186
8185
|
};
|
|
8187
8186
|
this.cwsIns.addNotify({ event: "onUpdatePermissions", callback: $ }, !0);
|
|
8188
8187
|
}
|
|
8189
|
-
this.cwsIns.addNotify({ event: "onTokenExpired", callback: async ($) => this.destroy() }, !0), this.cwsIns.addNotify({ event: "destroyRoom", callback: this.destroy }, !0)
|
|
8188
|
+
this.cwsIns.addNotify({ event: "onTokenExpired", callback: async ($) => this.destroy() }, !0), this.cwsIns.addNotify({ event: "destroyRoom", callback: this.destroy }, !0);
|
|
8190
8189
|
});
|
|
8191
8190
|
/**
|
|
8192
8191
|
* 重连成功
|
|
@@ -8239,7 +8238,7 @@ class QuickVO extends Room {
|
|
|
8239
8238
|
* @example quickvo.destroy()
|
|
8240
8239
|
*/
|
|
8241
8240
|
K(this, "destroy", async () => {
|
|
8242
|
-
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"), this.stopGetPeerStats(), this.asyncQueue.clear(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), await this.cwsIns.close();
|
|
8241
|
+
this.options.debug && console.log("\x1B[38;2;0;151;255m%c%s\x1B[0m", "color:#0097ff;", "------->quickvo: 销毁SDK"), this.stopGetPeerStats(), this.asyncQueue.clear(), this.clearUsers(), this.clearUserStreams(), this.cwsIns.clearEvents(), this.cwsIns.emitNotify("onDestroy", { code: 200, data: {}, desc: "sdk is destroy." }), await this.cwsIns.close();
|
|
8243
8242
|
});
|
|
8244
8243
|
this.setOptions($), this.initCwsCall(), G(this, Kt).call(this), G(this, Wt).call(this), G(this, Jt).call(this);
|
|
8245
8244
|
}
|