@vkontakte/calls-sdk 2.8.13-beta.6 → 2.8.13-dev.06c783b8.0
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/calls-sdk.cjs.js +7 -7
- package/calls-sdk.esm.js +920 -767
- package/classes/stat/NetworkAdaptationStats.d.ts +35 -0
- package/classes/stat/PeerConnectionStats.d.ts +22 -0
- package/classes/stat/Stat.testUtils.d.ts +10 -0
- package/classes/transport/DirectTransport.d.ts +6 -0
- package/classes/transport/PerfStatReporter.d.ts +2 -0
- package/classes/transport/ServerTransport.d.ts +1 -0
- package/default/SignalingTransport.d.ts +5 -1
- package/enums/Stat.d.ts +9 -0
- package/package.json +1 -1
- package/static/Params.d.ts +12 -0
package/calls-sdk.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @vkontakte/calls-sdk v2.8.13-
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/calls-sdk v2.8.13-dev.06c783b8.0
|
|
3
|
+
* Wed, 07 Oct 2026 16:53:48 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -121,7 +121,6 @@ var v = new class {
|
|
|
121
121
|
t.objectStore(g).clear(), t.objectStore(_).clear(), await this.txDone(t).catch((e) => console.warn("Failed to clear debug log storage", e));
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
this.close();
|
|
125
124
|
}
|
|
126
125
|
async getAllSessions() {
|
|
127
126
|
let e = await this.open();
|
|
@@ -2182,7 +2181,7 @@ var xn = bn.getInstance(), N = class e {
|
|
|
2182
2181
|
return 1.1;
|
|
2183
2182
|
}
|
|
2184
2183
|
static get sdkVersion() {
|
|
2185
|
-
return "2.8.13-
|
|
2184
|
+
return "2.8.13-dev.06c783b8.0";
|
|
2186
2185
|
}
|
|
2187
2186
|
static get debug() {
|
|
2188
2187
|
return e._params.debug;
|
|
@@ -2310,6 +2309,9 @@ var xn = bn.getInstance(), N = class e {
|
|
|
2310
2309
|
static get signalingReconnectMaxCount() {
|
|
2311
2310
|
return e._params.signalingReconnectMaxCount;
|
|
2312
2311
|
}
|
|
2312
|
+
static get signalingReconnectMaxDuration() {
|
|
2313
|
+
return e._params.signalingReconnectMaxDuration;
|
|
2314
|
+
}
|
|
2313
2315
|
static get waitConnectionDelay() {
|
|
2314
2316
|
return e._params.waitConnectionDelay;
|
|
2315
2317
|
}
|
|
@@ -2448,6 +2450,9 @@ var xn = bn.getInstance(), N = class e {
|
|
|
2448
2450
|
static get callStatReportEnabled() {
|
|
2449
2451
|
return e._params.callStatReportEnabled;
|
|
2450
2452
|
}
|
|
2453
|
+
static get iceCandidateErrorStatEnabled() {
|
|
2454
|
+
return e._params.iceCandidateErrorStatEnabled;
|
|
2455
|
+
}
|
|
2451
2456
|
static get enableLogPerfStatReport() {
|
|
2452
2457
|
return e._params.enableLogPerfStatReport;
|
|
2453
2458
|
}
|
|
@@ -2612,6 +2617,7 @@ var xn = bn.getInstance(), N = class e {
|
|
|
2612
2617
|
videoSuspend: e._params.videoSuspend,
|
|
2613
2618
|
debugLog: e._params.debugLog,
|
|
2614
2619
|
callStatReportEnabled: e._params.callStatReportEnabled,
|
|
2620
|
+
iceCandidateErrorStatEnabled: e._params.iceCandidateErrorStatEnabled,
|
|
2615
2621
|
joinFromMultipleDevices: e._params.joinFromMultipleDevices,
|
|
2616
2622
|
movieShare: e._params.movieShare,
|
|
2617
2623
|
clientType: e._params.clientType,
|
|
@@ -2654,6 +2660,7 @@ h(N, "_params", {
|
|
|
2654
2660
|
signalingReconnectDelay: 1e3,
|
|
2655
2661
|
signalingReconnectMaxDelay: 5e3,
|
|
2656
2662
|
signalingReconnectMaxCount: 10,
|
|
2663
|
+
signalingReconnectMaxDuration: 6e4,
|
|
2657
2664
|
waitConnectionDelay: 1e4,
|
|
2658
2665
|
waitResponseDelay: 1e4,
|
|
2659
2666
|
waitMessageDelay: 15e3,
|
|
@@ -2687,6 +2694,7 @@ h(N, "_params", {
|
|
|
2687
2694
|
networkStatisticsInterval: 2e4,
|
|
2688
2695
|
perfStatReportEnabled: !0,
|
|
2689
2696
|
callStatReportEnabled: !1,
|
|
2697
|
+
iceCandidateErrorStatEnabled: !1,
|
|
2690
2698
|
enableLogPerfStatReport: !1,
|
|
2691
2699
|
voiceParams: {
|
|
2692
2700
|
smoothing: .8,
|
|
@@ -3634,7 +3642,7 @@ var Bn = 0, Vn = 1, Hn = 2, Un = 3, Wn = 4, Gn = 5, Kn = 6, qn = 7, Jn = 0, Yn =
|
|
|
3634
3642
|
};
|
|
3635
3643
|
}
|
|
3636
3644
|
}, U = /* @__PURE__ */ function(e) {
|
|
3637
|
-
return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.API_CALL = "api_call", e.SDP_CREATE_OFFER = "sdp_create_offer", e.SDP_CREATE_ANSWER = "sdp_create_answer", e.SDP_SET_LOCAL_OFFER = "sdp_set_local_offer", e.SDP_SET_LOCAL_PRANSWER = "sdp_set_local_pranswer", e.SDP_SET_LOCAL_ANSWER = "sdp_set_local_answer", e.SDP_SET_LOCAL_ROLLBACK = "sdp_set_local_rollback", e.SDP_SET_REMOTE_OFFER = "sdp_set_remote_offer", e.SDP_SET_REMOTE_PRANSWER = "sdp_set_remote_pranswer", e.SDP_SET_REMOTE_ANSWER = "sdp_set_remote_answer", e.SDP_SET_REMOTE_ROLLBACK = "sdp_set_remote_rollback", e.SDP_GENERATED = "sdp_generated", e.SDP_RECEIVED = "sdp_received", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
|
|
3645
|
+
return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.API_CALL = "api_call", e.CONNECTION_STATE_CHANGED = "connection_state_changed", e.SIGNALING_STATE_CHANGED = "signaling_state_changed", e.GATHERING_STATE_CHANGED = "gathering_state_changed", e.ICE_RESTART = "ice_restart", e.ICE_CANDIDATES_CHANGED = "ice_candidates_changed", e.ICE_CANDIDATE_GATHERING_FAILED = "ice_candidate_gathering_failed", e.ICE_CANDIDATE_ADD_FAILED = "ice_candidate_add_failed", e.SDP_CREATE_OFFER = "sdp_create_offer", e.SDP_CREATE_ANSWER = "sdp_create_answer", e.SDP_SET_LOCAL_OFFER = "sdp_set_local_offer", e.SDP_SET_LOCAL_PRANSWER = "sdp_set_local_pranswer", e.SDP_SET_LOCAL_ANSWER = "sdp_set_local_answer", e.SDP_SET_LOCAL_ROLLBACK = "sdp_set_local_rollback", e.SDP_SET_REMOTE_OFFER = "sdp_set_remote_offer", e.SDP_SET_REMOTE_PRANSWER = "sdp_set_remote_pranswer", e.SDP_SET_REMOTE_ANSWER = "sdp_set_remote_answer", e.SDP_SET_REMOTE_ROLLBACK = "sdp_set_remote_rollback", e.SDP_GENERATED = "sdp_generated", e.SDP_RECEIVED = "sdp_received", e.CLIENT_REQUESTED_SERVER_TOPOLOGY = "client_requested_server_topology", e.VIDEO_ENCODER_CHANGED_BY_NETWORK_ADAPTER = "video_encoder_changed_by_network_adapter", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
|
|
3638
3646
|
}(U || {}), nr = 1e3;
|
|
3639
3647
|
function W(e, t, n = 0) {
|
|
3640
3648
|
return t in e && e[t] ? e[t] : n;
|
|
@@ -3994,14 +4002,111 @@ function Hr(e) {
|
|
|
3994
4002
|
return Br.test(e) || e.includes(":") && Vr.test(e);
|
|
3995
4003
|
}
|
|
3996
4004
|
//#endregion
|
|
3997
|
-
//#region src/classes/stat/
|
|
3998
|
-
var Ur =
|
|
3999
|
-
|
|
4005
|
+
//#region src/classes/stat/PeerConnectionStats.ts
|
|
4006
|
+
var Ur = /[?&]transport=(tcp|udp)/i, Wr = {
|
|
4007
|
+
stable: "stable",
|
|
4008
|
+
"have-local-offer": "have.local.offer",
|
|
4009
|
+
"have-local-pranswer": "have.local.answer",
|
|
4010
|
+
"have-remote-offer": "have.remote.offer",
|
|
4011
|
+
"have-remote-pranswer": "have.remote.answer",
|
|
4012
|
+
closed: "closed"
|
|
4013
|
+
}, Gr = class {
|
|
4014
|
+
constructor(e) {
|
|
4015
|
+
h(this, "_statAggregator", void 0), h(this, "_pc", null), h(this, "_lastSignalingStateChange", 0), h(this, "_lastGatheringStateChange", 0), h(this, "_lastConnectionState", null), h(this, "_handleConnectionStateChange", () => {
|
|
4016
|
+
this._pc && this._logConnectionState(this._pc.connectionState);
|
|
4017
|
+
}), h(this, "_handleSignalingStateChange", () => {
|
|
4018
|
+
let e = this._pc?.signalingState;
|
|
4019
|
+
this._log({
|
|
4020
|
+
name: U.SIGNALING_STATE_CHANGED,
|
|
4021
|
+
value: this._sinceLastChange("_lastSignalingStateChange"),
|
|
4022
|
+
string_value: e ? Wr[e] : void 0
|
|
4023
|
+
});
|
|
4024
|
+
}), h(this, "_handleGatheringStateChange", () => {
|
|
4025
|
+
let e = this._pc?.iceGatheringState, t = this._sinceLastChange("_lastGatheringStateChange");
|
|
4026
|
+
this._log({
|
|
4027
|
+
name: U.GATHERING_STATE_CHANGED,
|
|
4028
|
+
value: e === "new" ? 0 : t,
|
|
4029
|
+
string_value: e
|
|
4030
|
+
});
|
|
4031
|
+
}), h(this, "_handleIceCandidateError", (e) => {
|
|
4032
|
+
if (!N.iceCandidateErrorStatEnabled) return;
|
|
4033
|
+
let t = e;
|
|
4034
|
+
this._log({
|
|
4035
|
+
name: U.ICE_CANDIDATE_GATHERING_FAILED,
|
|
4036
|
+
value: t.errorCode,
|
|
4037
|
+
string_value: t.errorText,
|
|
4038
|
+
local_address: t.address ?? "",
|
|
4039
|
+
remote_url: t.url,
|
|
4040
|
+
transport: Ur.exec(t.url ?? "")?.[1]?.toLowerCase() ?? null
|
|
4041
|
+
});
|
|
4042
|
+
}), this._statAggregator = e;
|
|
4043
|
+
}
|
|
4044
|
+
observe(e) {
|
|
4045
|
+
this.stop(), this._pc = e, this._lastSignalingStateChange = 0, this._lastGatheringStateChange = 0, this._lastConnectionState = null, e.addEventListener("connectionstatechange", this._handleConnectionStateChange), e.addEventListener("signalingstatechange", this._handleSignalingStateChange), e.addEventListener("icegatheringstatechange", this._handleGatheringStateChange), e.addEventListener("icecandidateerror", this._handleIceCandidateError);
|
|
4046
|
+
}
|
|
4047
|
+
stop() {
|
|
4048
|
+
this._pc && (this._pc.connectionState !== "new" && this._logConnectionState(this._pc.connectionState), this._logConnectionState("closed"), this._pc.removeEventListener("connectionstatechange", this._handleConnectionStateChange), this._pc.removeEventListener("signalingstatechange", this._handleSignalingStateChange), this._pc.removeEventListener("icegatheringstatechange", this._handleGatheringStateChange), this._pc.removeEventListener("icecandidateerror", this._handleIceCandidateError), this._pc = null);
|
|
4049
|
+
}
|
|
4050
|
+
logIceRestart() {
|
|
4051
|
+
this._log({ name: U.ICE_RESTART });
|
|
4052
|
+
}
|
|
4053
|
+
logIceCandidateAddFailed(e, t) {
|
|
4054
|
+
this._log({
|
|
4055
|
+
name: U.ICE_CANDIDATE_ADD_FAILED,
|
|
4056
|
+
value: t instanceof DOMException ? t.code : 0,
|
|
4057
|
+
string_value: t instanceof Error ? `${t.name}: ${t.message}` : String(t),
|
|
4058
|
+
remote_url: e.candidate
|
|
4059
|
+
});
|
|
4060
|
+
}
|
|
4061
|
+
_sinceLastChange(e) {
|
|
4062
|
+
let t = Date.now(), n = this[e] === 0 ? 0 : t - this[e];
|
|
4063
|
+
return this[e] = t, n;
|
|
4064
|
+
}
|
|
4065
|
+
_logConnectionState(e) {
|
|
4066
|
+
e !== this._lastConnectionState && (this._lastConnectionState = e, this._log({
|
|
4067
|
+
name: U.CONNECTION_STATE_CHANGED,
|
|
4068
|
+
connection_state: e
|
|
4069
|
+
}));
|
|
4070
|
+
}
|
|
4071
|
+
_log(e) {
|
|
4072
|
+
this._statAggregator?.logEventualStat(e);
|
|
4073
|
+
}
|
|
4074
|
+
}, Kr = /* @__PURE__ */ function(e) {
|
|
4075
|
+
return e.NO_CONNECTION_TIMEOUT = "no_connection_timeout", e.CONNECTION_FAILED = "connection_failed", e.SUCCESS_CONNECTION = "success_connection", e.NO_DATA_TIMEOUT = "no_data_timeout", e.SUCCESS_AUDIO = "success_audio", e.CONNECTION_ACCEPTED_FAILED = "connection_accepted_failed", e;
|
|
4076
|
+
}({}), qr = /* @__PURE__ */ function(e) {
|
|
4077
|
+
return e.GOOD = "good", e.BAD_1 = "bad_1", e.BAD_2 = "bad_2", e;
|
|
4078
|
+
}({}), Jr = class {
|
|
4079
|
+
constructor(e) {
|
|
4080
|
+
h(this, "_statAggregator", void 0), this._statAggregator = e;
|
|
4081
|
+
}
|
|
4082
|
+
logServerTopologyRequested(e, t) {
|
|
4083
|
+
this._statAggregator?.logEventualStat({
|
|
4084
|
+
name: U.CLIENT_REQUESTED_SERVER_TOPOLOGY,
|
|
4085
|
+
value: t,
|
|
4086
|
+
string_value: e
|
|
4087
|
+
});
|
|
4088
|
+
}
|
|
4089
|
+
logVideoEncoderChanged(e) {
|
|
4090
|
+
let t = e.mimeType?.replace("video/", "") ?? "";
|
|
4091
|
+
this._statAggregator?.logEventualStat({
|
|
4092
|
+
name: U.VIDEO_ENCODER_CHANGED_BY_NETWORK_ADAPTER,
|
|
4093
|
+
string_value: JSON.stringify({
|
|
4094
|
+
rtt: Math.round(e.rtt),
|
|
4095
|
+
loss: Math.round(e.loss),
|
|
4096
|
+
network_quality: e.networkQuality,
|
|
4097
|
+
codec_old: t,
|
|
4098
|
+
codec_new: t,
|
|
4099
|
+
source: e.source
|
|
4100
|
+
})
|
|
4101
|
+
});
|
|
4102
|
+
}
|
|
4103
|
+
}, Yr = 200;
|
|
4104
|
+
function Xr(e) {
|
|
4000
4105
|
for (let t of e.values()) if (t.type === "outbound-rtp" && (t.packetsSent ?? 0) > 0) return !0;
|
|
4001
4106
|
return !1;
|
|
4002
4107
|
}
|
|
4003
|
-
var
|
|
4004
|
-
constructor(e, t, n =
|
|
4108
|
+
var Zr = class {
|
|
4109
|
+
constructor(e, t, n = Yr) {
|
|
4005
4110
|
h(this, "_peerConnection", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_pollIntervalMs", void 0), h(this, "_timer", null), h(this, "_state", "idle"), this._peerConnection = e, this._onFirstMediaSent = t, this._pollIntervalMs = n;
|
|
4006
4111
|
}
|
|
4007
4112
|
start() {
|
|
@@ -4024,7 +4129,7 @@ var Gr = class {
|
|
|
4024
4129
|
try {
|
|
4025
4130
|
let e = await this._getStatsReports();
|
|
4026
4131
|
if (this._state !== "polling") return;
|
|
4027
|
-
if (e.some(
|
|
4132
|
+
if (e.some(Xr)) {
|
|
4028
4133
|
this._state = "stopped", this._onFirstMediaSent();
|
|
4029
4134
|
return;
|
|
4030
4135
|
}
|
|
@@ -4037,7 +4142,7 @@ var Gr = class {
|
|
|
4037
4142
|
this._timer = null, this._poll();
|
|
4038
4143
|
}, this._pollIntervalMs));
|
|
4039
4144
|
}
|
|
4040
|
-
},
|
|
4145
|
+
}, Qr = class extends b {
|
|
4041
4146
|
constructor(e, t, n = null) {
|
|
4042
4147
|
super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_state", q.IDLE), h(this, "_pc", null), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbe", null), h(this, "_firstMediaSentProbeStopped", !1), this._signaling = e, this._mediaSource = t, this._onFirstMediaSent = n;
|
|
4043
4148
|
}
|
|
@@ -4048,12 +4153,12 @@ var Gr = class {
|
|
|
4048
4153
|
this._firstMediaSentProbeStopped = !0, this._disposeFirstMediaSentProbe();
|
|
4049
4154
|
}
|
|
4050
4155
|
_startFirstMediaSentProbe() {
|
|
4051
|
-
this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new
|
|
4156
|
+
this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new Zr(this._pc, this._onFirstMediaSent), this._firstMediaSentProbe.start());
|
|
4052
4157
|
}
|
|
4053
4158
|
_disposeFirstMediaSentProbe() {
|
|
4054
4159
|
this._firstMediaSentProbe?.destroy(), this._firstMediaSentProbe = null;
|
|
4055
4160
|
}
|
|
4056
|
-
},
|
|
4161
|
+
}, $r = class {
|
|
4057
4162
|
constructor(e, t = null) {
|
|
4058
4163
|
h(this, "weightUp", void 0), h(this, "weightDown", void 0), h(this, "value", NaN), this.weightUp = e, this.weightDown = t ?? e;
|
|
4059
4164
|
}
|
|
@@ -4071,7 +4176,7 @@ var Gr = class {
|
|
|
4071
4176
|
getValue() {
|
|
4072
4177
|
return this.value;
|
|
4073
4178
|
}
|
|
4074
|
-
},
|
|
4179
|
+
}, ei = .25, ti = .35, ni = 85, ri = .1, ii = 1.5, ai = .1, oi = 1, si = .6, ci = .3, li = class extends b {
|
|
4075
4180
|
constructor(e, t = z) {
|
|
4076
4181
|
super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
|
|
4077
4182
|
badNet: {
|
|
@@ -4083,8 +4188,8 @@ var Gr = class {
|
|
|
4083
4188
|
rtt: 600
|
|
4084
4189
|
}
|
|
4085
4190
|
}), h(this, "_lastStatSentTimestamp", 0), h(this, "_currentState", "good"), h(this, "_debug", void 0), this._debug = t, this._signaling = e, this._localNetworkStat = {
|
|
4086
|
-
rtt: new
|
|
4087
|
-
loss: new
|
|
4191
|
+
rtt: new $r(ei, ei),
|
|
4192
|
+
loss: new $r(ti, ti),
|
|
4088
4193
|
bitrate: 0
|
|
4089
4194
|
}, this._remoteNetworkStat = {
|
|
4090
4195
|
rtt: 0,
|
|
@@ -4099,20 +4204,20 @@ var Gr = class {
|
|
|
4099
4204
|
_calcRttRating(e) {
|
|
4100
4205
|
let t = typeof e == "number" ? e : e.getValue(), n = 1;
|
|
4101
4206
|
if (isNaN(t)) return n;
|
|
4102
|
-
let r = Math.round((t - this._networkLimits.goodNet.rtt) /
|
|
4103
|
-
for (let e = 0; e < r; e++) n *= 1 -
|
|
4207
|
+
let r = Math.round((t - this._networkLimits.goodNet.rtt) / ni);
|
|
4208
|
+
for (let e = 0; e < r; e++) n *= 1 - ri;
|
|
4104
4209
|
return n;
|
|
4105
4210
|
}
|
|
4106
4211
|
_calcLossRating(e) {
|
|
4107
4212
|
let t = typeof e == "number" ? e : e.getValue(), n = 1;
|
|
4108
4213
|
if (isNaN(t)) return n;
|
|
4109
|
-
let r = Math.round((t - this._networkLimits.goodNet.loss) /
|
|
4110
|
-
for (let e = 0; e < r; e++) n *= 1 -
|
|
4214
|
+
let r = Math.round((t - this._networkLimits.goodNet.loss) / ii);
|
|
4215
|
+
for (let e = 0; e < r; e++) n *= 1 - ai;
|
|
4111
4216
|
return n;
|
|
4112
4217
|
}
|
|
4113
4218
|
_calcBitrateRating(e, t) {
|
|
4114
4219
|
if (!e || !t) return 1;
|
|
4115
|
-
let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) *
|
|
4220
|
+
let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) * oi;
|
|
4116
4221
|
return Math.min(n, 1);
|
|
4117
4222
|
}
|
|
4118
4223
|
_calcUDPRating({ rtt: e, loss: t }) {
|
|
@@ -4122,7 +4227,7 @@ var Gr = class {
|
|
|
4122
4227
|
return n ? this._calcBitrateRating(e.bitrate, t.bitrate) : this._calcUDPRating(e) * this._calcUDPRating(t);
|
|
4123
4228
|
}
|
|
4124
4229
|
_getNetworkState(e) {
|
|
4125
|
-
return isNaN(e) || e >=
|
|
4230
|
+
return isNaN(e) || e >= si ? "good" : e >= ci ? "medium" : "bad";
|
|
4126
4231
|
}
|
|
4127
4232
|
updateSettings(e) {
|
|
4128
4233
|
Object.assign(this._networkLimits.badNet, e?.badNet || {}), Object.assign(this._networkLimits.goodNet, e?.goodNet || {});
|
|
@@ -4146,9 +4251,9 @@ var Gr = class {
|
|
|
4146
4251
|
let { rtt: t, loss: n, bitrate: r } = e || {};
|
|
4147
4252
|
this._remoteNetworkStat.rtt = t || 0, this._remoteNetworkStat.loss = n || 0, this._remoteNetworkStat.bitrate = r || 0;
|
|
4148
4253
|
}
|
|
4149
|
-
},
|
|
4254
|
+
}, ui = 30 * 1e3, di = class e extends Qr {
|
|
4150
4255
|
constructor(e, t, n, r, i, a = z, o = null, s = null, c = null, l = null) {
|
|
4151
|
-
super(n, r, l), h(this, "_participantId", void 0), h(this, "_isMaster", void 0), h(this, "_remoteSDP", {}), h(this, "_remoteCandidates", {}), h(this, "_lastRemoteSDP", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_remoteAnimojiVersion", 1), h(this, "_isOpen", !1), h(this, "_remotePeerId", null), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_failedOnCreate", null), h(this, "_remoteStream", null), h(this, "_iceRestartTimeout", null), h(this, "_reconnectionTimeout", null), h(this, "_reconnectionPrevented", !1), h(this, "_remoteHold", !1), h(this, "_lastStat", null), h(this, "_fingerprint", null), h(this, "_neverConnected", !0), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_networkLimitsForVideo", {
|
|
4256
|
+
super(n, r, l), h(this, "_participantId", void 0), h(this, "_isMaster", void 0), h(this, "_remoteSDP", {}), h(this, "_remoteCandidates", {}), h(this, "_lastRemoteSDP", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_remoteAnimojiVersion", 1), h(this, "_isOpen", !1), h(this, "_remotePeerId", null), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_failedOnCreate", null), h(this, "_remoteStream", null), h(this, "_iceRestartTimeout", null), h(this, "_reconnectionTimeout", null), h(this, "_reconnectionPrevented", !1), h(this, "_remoteHold", !1), h(this, "_lastStat", null), h(this, "_fingerprint", null), h(this, "_neverConnected", !0), h(this, "_connectionStartedAt", 0), h(this, "_connectionLostAt", 0), h(this, "_serverRequestedOnNoConnection", !1), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_networkLimitsForVideo", {
|
|
4152
4257
|
bad: {
|
|
4153
4258
|
loss: 4,
|
|
4154
4259
|
rtt: 1e3
|
|
@@ -4161,7 +4266,7 @@ var Gr = class {
|
|
|
4161
4266
|
worst: 320,
|
|
4162
4267
|
bad: 640,
|
|
4163
4268
|
good: 1280
|
|
4164
|
-
}), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new
|
|
4269
|
+
}), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_networkAdaptationStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new Na(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new li(n, this._debug), this._sdpStats = new Lr(this._statAggregator), this._peerConnectionStats = new Gr(this._statAggregator), this._networkAdaptationStats = new Jr(this._statAggregator), this.subscribe(this._signaling, xr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, qt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, qt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this));
|
|
4165
4270
|
try {
|
|
4166
4271
|
this._pc = this._createPeerConnection();
|
|
4167
4272
|
} catch (e) {
|
|
@@ -4203,7 +4308,7 @@ var Gr = class {
|
|
|
4203
4308
|
this._finishClose(this._failedOnCreate);
|
|
4204
4309
|
return;
|
|
4205
4310
|
}
|
|
4206
|
-
if (this._debug.debug("DirectTransport: Open transport", { participantId: this._participantId }), this._isOpen = !0, this._remotePeerId = e, !this._isMaster) try {
|
|
4311
|
+
if (this._debug.debug("DirectTransport: Open transport", { participantId: this._participantId }), this._isOpen = !0, this._remotePeerId = e, this._connectionStartedAt = Date.now(), !this._isMaster) try {
|
|
4207
4312
|
this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
|
|
4208
4313
|
} catch (e) {
|
|
4209
4314
|
this._logger?.log(C.ERROR, "addTrack-direct"), this._debug.error("DirectTransport: Unable to add media source tracks", e, { participantId: this._participantId }), this.close(e);
|
|
@@ -4249,7 +4354,7 @@ var Gr = class {
|
|
|
4249
4354
|
this._debug.error("Failed to recreate RTCPeerConnection:", e), this.close(e);
|
|
4250
4355
|
return;
|
|
4251
4356
|
}
|
|
4252
|
-
this._neverConnected = !0;
|
|
4357
|
+
this._neverConnected = !0, this._connectionStartedAt = Date.now(), this._serverRequestedOnNoConnection = !1;
|
|
4253
4358
|
try {
|
|
4254
4359
|
this._mediaSource.addTrackToPeerConnection(this._pc, !1, !0), this._applySettings();
|
|
4255
4360
|
} catch (e) {
|
|
@@ -4265,12 +4370,12 @@ var Gr = class {
|
|
|
4265
4370
|
iceServers: N.iceServers,
|
|
4266
4371
|
iceTransportPolicy: N.forceRelayPolicy ? "relay" : "all"
|
|
4267
4372
|
});
|
|
4268
|
-
return e.onicecandidate = this._handleIceCandidate.bind(this), e.ontrack = this._onAddTrack.bind(this), e.oniceconnectionstatechange = this._onIceConnectionStateChange.bind(this), e.onconnectionstatechange = this._onConnectionStateChange.bind(this), e.onsignalingstatechange = this._onSignalingStateChange.bind(this), this._sdpStats.observe(e), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(e, Tr.animoji, (e) => {
|
|
4373
|
+
return e.onicecandidate = this._handleIceCandidate.bind(this), e.ontrack = this._onAddTrack.bind(this), e.oniceconnectionstatechange = this._onIceConnectionStateChange.bind(this), e.onconnectionstatechange = this._onConnectionStateChange.bind(this), e.onsignalingstatechange = this._onSignalingStateChange.bind(this), this._sdpStats.observe(e), this._peerConnectionStats.observe(e), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(e, Tr.animoji, (e) => {
|
|
4269
4374
|
this._animojiDataChannel = e, this._animojiDataChannel.binaryType = "arraybuffer", this._animojiReceiver?.setDataChannel(this._animojiDataChannel), this._animojiSender?.setDataChannel(this._animojiDataChannel);
|
|
4270
4375
|
}), e;
|
|
4271
4376
|
}
|
|
4272
4377
|
_disposePeerConnection() {
|
|
4273
|
-
if (this._disposeFirstMediaSentProbe(), this._sdpStats.stop(), this._lastStat = null, this._remoteStream) {
|
|
4378
|
+
if (this._disposeFirstMediaSentProbe(), this._sdpStats.stop(), this._peerConnectionStats.stop(), this._lastStat = null, this._remoteStream) {
|
|
4274
4379
|
let e = this._remoteStream;
|
|
4275
4380
|
e.getTracks().forEach((t) => {
|
|
4276
4381
|
t.stop(), this._triggerEvent(Y.REMOTE_TRACK_REMOVED, e, t);
|
|
@@ -4319,7 +4424,7 @@ var Gr = class {
|
|
|
4319
4424
|
try {
|
|
4320
4425
|
await this._pc.addIceCandidate(new RTCIceCandidate(t));
|
|
4321
4426
|
} catch (e) {
|
|
4322
|
-
throw this._logger?.log(C.ERROR, "addIceCandidate-direct"), this._debug.error("Unable to add remote ice candidate", e, {
|
|
4427
|
+
throw this._logger?.log(C.ERROR, "addIceCandidate-direct"), this._peerConnectionStats.logIceCandidateAddFailed(t, e), this._debug.error("Unable to add remote ice candidate", e, {
|
|
4323
4428
|
participantId: this._participantId,
|
|
4324
4429
|
candidate: t
|
|
4325
4430
|
}), e;
|
|
@@ -4406,7 +4511,7 @@ var Gr = class {
|
|
|
4406
4511
|
}
|
|
4407
4512
|
}
|
|
4408
4513
|
_markConnected() {
|
|
4409
|
-
this._neverConnected = !1, this._setState(q.CONNECTED), this._stopReconnection(), this._pc && M.getPeerConnectionHostInfo(this._pc).then((e) => {
|
|
4514
|
+
this._serverRequestedOnNoConnection && (this._networkAdaptationStats.logServerTopologyRequested(Kr.SUCCESS_CONNECTION, Date.now() - this._connectionStartedAt), this._serverRequestedOnNoConnection = !1), this._neverConnected = !1, this._setState(q.CONNECTED), this._stopReconnection(), this._pc && M.getPeerConnectionHostInfo(this._pc).then((e) => {
|
|
4410
4515
|
e?.local && (this._logger?.log(C.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
|
|
4411
4516
|
}), this._startStatInterval();
|
|
4412
4517
|
}
|
|
@@ -4425,21 +4530,28 @@ var Gr = class {
|
|
|
4425
4530
|
}
|
|
4426
4531
|
}
|
|
4427
4532
|
_startReconnection() {
|
|
4428
|
-
this._reconnectionTimeout || this._iceRestartTimeout || (this._debug.log("Waiting for reconnection...", { participantId: this._participantId }), this._reconnectionTimeout = window.setTimeout(() => {
|
|
4429
|
-
this._reconnectionTimeout = null, this._neverConnected ? this._requestTopologySwitch() : this._startIceRestart();
|
|
4533
|
+
this._reconnectionTimeout || this._iceRestartTimeout || (this._debug.log("Waiting for reconnection...", { participantId: this._participantId }), this._connectionLostAt = Date.now(), this._reconnectionTimeout = window.setTimeout(() => {
|
|
4534
|
+
this._reconnectionTimeout = null, this._neverConnected ? this._requestTopologySwitch({ reason: Kr.NO_CONNECTION_TIMEOUT }) : this._startIceRestart();
|
|
4430
4535
|
}, N.transportConnectionWaitTime));
|
|
4431
4536
|
}
|
|
4432
|
-
_requestTopologySwitch(e = !1) {
|
|
4433
|
-
(this._isMaster ||
|
|
4434
|
-
|
|
4435
|
-
|
|
4537
|
+
_requestTopologySwitch({ reason: e, fromAnySide: t = !1 }) {
|
|
4538
|
+
if ((this._isMaster || t) && this._signaling.ready) {
|
|
4539
|
+
this._debug.log("Switch topology DIRECT to SERVER", { participantId: this._participantId });
|
|
4540
|
+
let t = e === Kr.CONNECTION_FAILED ? this._connectionLostAt : this._connectionStartedAt;
|
|
4541
|
+
this._networkAdaptationStats.logServerTopologyRequested(e, Date.now() - t), e === Kr.NO_CONNECTION_TIMEOUT && (this._serverRequestedOnNoConnection = !0), this._signaling.switchTopology(J.SERVER).catch((e) => {
|
|
4542
|
+
e instanceof En || this._debug.warn("Unable to switch topology DIRECT to SERVER", e);
|
|
4543
|
+
});
|
|
4544
|
+
}
|
|
4436
4545
|
}
|
|
4437
4546
|
_stopReconnection() {
|
|
4438
4547
|
this._reconnectionTimeout && (clearTimeout(this._reconnectionTimeout), this._reconnectionTimeout = null), this._iceRestartTimeout && (clearTimeout(this._iceRestartTimeout), this._iceRestartTimeout = null);
|
|
4439
4548
|
}
|
|
4440
4549
|
_startIceRestart() {
|
|
4441
|
-
this._isMaster ? (this._logger?.log(C.ICE_RESTART), this._debug.log("Ice restart", { participantId: this._participantId }), this._createOffer(!0).catch(this.close.bind(this))) : this._debug.debug("Waiting for ice restart...", { participantId: this._participantId }), this._iceRestartTimeout = window.setTimeout(() => {
|
|
4442
|
-
this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this._requestTopologySwitch(
|
|
4550
|
+
this._isMaster ? (this._peerConnectionStats.logIceRestart(), this._logger?.log(C.ICE_RESTART), this._debug.log("Ice restart", { participantId: this._participantId }), this._createOffer(!0).catch(this.close.bind(this))) : this._debug.debug("Waiting for ice restart...", { participantId: this._participantId }), this._iceRestartTimeout = window.setTimeout(() => {
|
|
4551
|
+
this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this._requestTopologySwitch({
|
|
4552
|
+
reason: Kr.CONNECTION_FAILED,
|
|
4553
|
+
fromAnySide: N.switchTopologyOnReconnectFromAnySide
|
|
4554
|
+
});
|
|
4443
4555
|
}, N.iceRestartWaitTime);
|
|
4444
4556
|
}
|
|
4445
4557
|
async _createOffer(t) {
|
|
@@ -4559,24 +4671,32 @@ var Gr = class {
|
|
|
4559
4671
|
}
|
|
4560
4672
|
async _checkPPTNetwork(e) {
|
|
4561
4673
|
if (!N.switchVideoAtBadNetwork || !e.inbound.transport.averageNetStat) return;
|
|
4562
|
-
let { averageNetStat: t } = e.inbound.transport, n = t.currentRoundTripTime <= this._networkLimitsForVideo.good.rtt && t.lostPercent <= this._networkLimitsForVideo.good.loss, r = t.currentRoundTripTime >= this._networkLimitsForVideo.bad.rtt || t.lostPercent >= this._networkLimitsForVideo.bad.loss, i = t.currentRoundTripTime < this._networkLimitsForVideo.bad.rtt, a = this._videoMaxDimensionsForNet.good, o = kr.L1T1;
|
|
4563
|
-
if (r ? (this._lastBadConnection = Date.now(), i ? (a = this._videoMaxDimensionsForNet.bad, o = kr.L1T2) : (a = this._videoMaxDimensionsForNet.worst, o = kr.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = kr.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection >
|
|
4564
|
-
let
|
|
4565
|
-
if (!
|
|
4674
|
+
let { averageNetStat: t } = e.inbound.transport, n = t.currentRoundTripTime <= this._networkLimitsForVideo.good.rtt && t.lostPercent <= this._networkLimitsForVideo.good.loss, r = t.currentRoundTripTime >= this._networkLimitsForVideo.bad.rtt || t.lostPercent >= this._networkLimitsForVideo.bad.loss, i = t.currentRoundTripTime < this._networkLimitsForVideo.bad.rtt, a = this._videoMaxDimensionsForNet.good, o = kr.L1T1, s = qr.GOOD;
|
|
4675
|
+
if (r ? (this._lastBadConnection = Date.now(), i ? (s = qr.BAD_1, a = this._videoMaxDimensionsForNet.bad, o = kr.L1T2) : (s = qr.BAD_2, a = this._videoMaxDimensionsForNet.worst, o = kr.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = kr.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection > ui) || this._lastVideoMaxDimension === a) return;
|
|
4676
|
+
let c = this._serverSettings.camera;
|
|
4677
|
+
if (!c || !await this._isSVCSupported(e, o)) return;
|
|
4566
4678
|
this._debug.debug("Switch outbound video frame size and scalabilityMode", {
|
|
4567
4679
|
scalabilityMode: o,
|
|
4568
4680
|
averageNetStat: t,
|
|
4569
4681
|
nextVideoMaxDimension: a
|
|
4682
|
+
});
|
|
4683
|
+
let l = e.outbound.rtps.find((e) => e.kind === "video");
|
|
4684
|
+
this._networkAdaptationStats.logVideoEncoderChanged({
|
|
4685
|
+
rtt: t.currentRoundTripTime,
|
|
4686
|
+
loss: t.lostPercent,
|
|
4687
|
+
networkQuality: s,
|
|
4688
|
+
mimeType: l?.mimeType,
|
|
4689
|
+
source: "camera"
|
|
4570
4690
|
}), this._lastVideoMaxDimension = a;
|
|
4571
|
-
let
|
|
4691
|
+
let u = {
|
|
4572
4692
|
...this._serverSettings,
|
|
4573
4693
|
camera: {
|
|
4574
|
-
...
|
|
4694
|
+
...c,
|
|
4575
4695
|
scalabilityMode: o,
|
|
4576
4696
|
maxDimension: this._lastVideoMaxDimension
|
|
4577
4697
|
}
|
|
4578
4698
|
};
|
|
4579
|
-
this.updateSettings(
|
|
4699
|
+
this.updateSettings(u);
|
|
4580
4700
|
}
|
|
4581
4701
|
_stopStatInterval() {
|
|
4582
4702
|
this._statInterval && (window.clearTimeout(this._statInterval), this._statInterval = null);
|
|
@@ -4625,9 +4745,9 @@ var Gr = class {
|
|
|
4625
4745
|
}, n(r)) : this._debug.error(`[${t}] data channel open failed, state [${e}]`);
|
|
4626
4746
|
};
|
|
4627
4747
|
}
|
|
4628
|
-
},
|
|
4748
|
+
}, fi = /* @__PURE__ */ function(e) {
|
|
4629
4749
|
return e.AUDIO_MIX = "audio-mix", e.PARTICIPANT_AGNOSTIC_TRACK_PREFIX = "pat", e.TRANSPARENT_AUDIO_TRACK_PREFIX = "ta", e;
|
|
4630
|
-
}({}),
|
|
4750
|
+
}({}), pi = 16, mi = class e {
|
|
4631
4751
|
constructor(e, t, n, r = z) {
|
|
4632
4752
|
h(this, "_datachannel", void 0), h(this, "_participantIdRegistry", void 0), h(this, "_asrCallback", void 0), h(this, "_textDecoder", void 0), h(this, "_debug", void 0), this._debug = r, this._debug.debug("AsrReceiver started"), this._datachannel = e, this._participantIdRegistry = t, this._asrCallback = n, this._textDecoder = new TextDecoder(), this._datachannel.onmessage = (e) => this._onDataChannelMessage(e.data);
|
|
4633
4753
|
}
|
|
@@ -4641,7 +4761,7 @@ var Gr = class {
|
|
|
4641
4761
|
ssrc: a,
|
|
4642
4762
|
timestamp: o,
|
|
4643
4763
|
duration: s,
|
|
4644
|
-
data: e.slice(
|
|
4764
|
+
data: e.slice(pi)
|
|
4645
4765
|
};
|
|
4646
4766
|
}
|
|
4647
4767
|
_onDataChannelMessage(t) {
|
|
@@ -4661,7 +4781,7 @@ var Gr = class {
|
|
|
4661
4781
|
destroy() {
|
|
4662
4782
|
this._datachannel.onmessage = null;
|
|
4663
4783
|
}
|
|
4664
|
-
},
|
|
4784
|
+
}, hi, gi = class {
|
|
4665
4785
|
constructor() {
|
|
4666
4786
|
h(this, "_value", 1);
|
|
4667
4787
|
}
|
|
@@ -4672,10 +4792,10 @@ var Gr = class {
|
|
|
4672
4792
|
this._value = e;
|
|
4673
4793
|
}
|
|
4674
4794
|
};
|
|
4675
|
-
|
|
4795
|
+
hi = gi, h(gi, "_instance", null), h(gi, "getInstance", () => (hi._instance || (hi._instance = new hi()), hi._instance));
|
|
4676
4796
|
//#endregion
|
|
4677
4797
|
//#region src/classes/ParticipantIdRegistry.ts
|
|
4678
|
-
var
|
|
4798
|
+
var _i = class {
|
|
4679
4799
|
constructor(e = z) {
|
|
4680
4800
|
h(this, "streamDescriptionByCompactId", /* @__PURE__ */ new Map()), h(this, "compactIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_debug", void 0), this._debug = e;
|
|
4681
4801
|
}
|
|
@@ -4791,7 +4911,7 @@ var di = class {
|
|
|
4791
4911
|
this._debug.error("unexpected null sequenceNumber", e, r);
|
|
4792
4912
|
continue;
|
|
4793
4913
|
}
|
|
4794
|
-
let l =
|
|
4914
|
+
let l = fi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
|
|
4795
4915
|
n.push({
|
|
4796
4916
|
participantStreamDescription: c,
|
|
4797
4917
|
streamId: l,
|
|
@@ -4807,9 +4927,9 @@ var di = class {
|
|
|
4807
4927
|
participantUpdateInfos: n
|
|
4808
4928
|
};
|
|
4809
4929
|
}
|
|
4810
|
-
},
|
|
4930
|
+
}, vi = /* @__PURE__ */ function(e) {
|
|
4811
4931
|
return e.INIT = "init", e.READY = "ready", e.FRAME = "frame", e.SET_BITRATE = "set_bitrate", e.ERROR = "error", e.DEBUG = "debug", e.LOG_ERROR = "log_error", e;
|
|
4812
|
-
}({}),
|
|
4932
|
+
}({}), yi = class {
|
|
4813
4933
|
constructor(e = z, t = null) {
|
|
4814
4934
|
h(this, "_worker", null), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = e, this._logger = t;
|
|
4815
4935
|
}
|
|
@@ -4825,7 +4945,7 @@ var di = class {
|
|
|
4825
4945
|
return;
|
|
4826
4946
|
}
|
|
4827
4947
|
t({
|
|
4828
|
-
type:
|
|
4948
|
+
type: vi.FRAME,
|
|
4829
4949
|
error: e
|
|
4830
4950
|
});
|
|
4831
4951
|
};
|
|
@@ -4835,23 +4955,23 @@ var di = class {
|
|
|
4835
4955
|
e.preventDefault?.(), m(this._formatWorkerMessageError(e));
|
|
4836
4956
|
}, f.onmessage = (e) => {
|
|
4837
4957
|
switch (e.data.type) {
|
|
4838
|
-
case
|
|
4958
|
+
case vi.READY:
|
|
4839
4959
|
s = !0, c || (c = !0, a());
|
|
4840
4960
|
break;
|
|
4841
|
-
case
|
|
4961
|
+
case vi.ERROR:
|
|
4842
4962
|
s ? m(e.data.error) : p(e.data.error);
|
|
4843
4963
|
break;
|
|
4844
|
-
case
|
|
4964
|
+
case vi.FRAME:
|
|
4845
4965
|
t(e.data);
|
|
4846
4966
|
break;
|
|
4847
|
-
case
|
|
4967
|
+
case vi.DEBUG:
|
|
4848
4968
|
this._debug.debug(e.data.message);
|
|
4849
4969
|
break;
|
|
4850
|
-
case
|
|
4970
|
+
case vi.LOG_ERROR:
|
|
4851
4971
|
this._logger?.log(C.ERROR, e.data.message);
|
|
4852
4972
|
break;
|
|
4853
4973
|
}
|
|
4854
|
-
}, this._sendToWorker(
|
|
4974
|
+
}, this._sendToWorker(vi.INIT, r, i);
|
|
4855
4975
|
});
|
|
4856
4976
|
}
|
|
4857
4977
|
_removeWorker() {
|
|
@@ -4874,7 +4994,7 @@ var di = class {
|
|
|
4874
4994
|
static isBrowserSupported() {
|
|
4875
4995
|
throw Error("Not implemented");
|
|
4876
4996
|
}
|
|
4877
|
-
},
|
|
4997
|
+
}, bi = class extends yi {
|
|
4878
4998
|
constructor(e = z, t = null) {
|
|
4879
4999
|
super(e, t);
|
|
4880
5000
|
}
|
|
@@ -4884,7 +5004,7 @@ var di = class {
|
|
|
4884
5004
|
}, [c, c.getUrl]);
|
|
4885
5005
|
}
|
|
4886
5006
|
decodeFrame(e, t, n, r) {
|
|
4887
|
-
this._sendToWorker(
|
|
5007
|
+
this._sendToWorker(vi.FRAME, {
|
|
4888
5008
|
timestamp: e,
|
|
4889
5009
|
data: t.buffer,
|
|
4890
5010
|
isVP9: n,
|
|
@@ -4898,7 +5018,7 @@ var di = class {
|
|
|
4898
5018
|
static isBrowserSupported() {
|
|
4899
5019
|
return "WebAssembly" in window && "Worker" in window;
|
|
4900
5020
|
}
|
|
4901
|
-
},
|
|
5021
|
+
}, xi = class extends yi {
|
|
4902
5022
|
constructor(e = z, t = null) {
|
|
4903
5023
|
super(e, t);
|
|
4904
5024
|
}
|
|
@@ -4908,7 +5028,7 @@ var di = class {
|
|
|
4908
5028
|
}, [!0]);
|
|
4909
5029
|
}
|
|
4910
5030
|
decodeFrame(e, t, n, r = !1) {
|
|
4911
|
-
this._sendToWorker(
|
|
5031
|
+
this._sendToWorker(vi.FRAME, {
|
|
4912
5032
|
timestamp: e,
|
|
4913
5033
|
data: t.buffer,
|
|
4914
5034
|
isVP9: n,
|
|
@@ -4921,7 +5041,7 @@ var di = class {
|
|
|
4921
5041
|
static isBrowserSupported() {
|
|
4922
5042
|
return "VideoDecoder" in window && "Worker" in window && "VideoFrame" in window && !E.isBrokenVP9Decoder() && E.browserName() !== "Firefox";
|
|
4923
5043
|
}
|
|
4924
|
-
},
|
|
5044
|
+
}, Si = class {
|
|
4925
5045
|
constructor(e = null, t = 0) {
|
|
4926
5046
|
h(this, "_counter", 0), h(this, "_interval", 0), h(this, "_lastCalculationTime", Date.now()), h(this, "_onCalculated", null), this._onCalculated = e, t && (this._interval = window.setInterval(() => this.calculate(), t));
|
|
4927
5047
|
}
|
|
@@ -4935,7 +5055,7 @@ var di = class {
|
|
|
4935
5055
|
destroy() {
|
|
4936
5056
|
window.clearInterval(this._interval), this._interval = 0;
|
|
4937
5057
|
}
|
|
4938
|
-
},
|
|
5058
|
+
}, Ci = class {
|
|
4939
5059
|
constructor(e, t) {
|
|
4940
5060
|
h(this, "_participantId", void 0), h(this, "_statAggregator", void 0), h(this, "_firstFrameReceived", !1), this._participantId = e, this._statAggregator = t;
|
|
4941
5061
|
}
|
|
@@ -4950,14 +5070,14 @@ var di = class {
|
|
|
4950
5070
|
height: t
|
|
4951
5071
|
});
|
|
4952
5072
|
}
|
|
4953
|
-
},
|
|
5073
|
+
}, wi = 65536, Ti = "MARK_SCREENSHARE_FREEZE_DURATION", Ei = class e {
|
|
4954
5074
|
constructor(e, t, n, r, i, a = z) {
|
|
4955
|
-
h(this, "_participantId", void 0), h(this, "_onStream", void 0), h(this, "_onStat", void 0), h(this, "_onKeyFrameRequested", void 0), h(this, "_statScreenShareFirstFrame", void 0), h(this, "_debug", void 0), h(this, "_chunks", []), this._participantId = e, this._onStream = t, this._onStat = n, this._onKeyFrameRequested = i, this._statScreenShareFirstFrame = new
|
|
5075
|
+
h(this, "_participantId", void 0), h(this, "_onStream", void 0), h(this, "_onStat", void 0), h(this, "_onKeyFrameRequested", void 0), h(this, "_statScreenShareFirstFrame", void 0), h(this, "_debug", void 0), h(this, "_chunks", []), this._participantId = e, this._onStream = t, this._onStat = n, this._onKeyFrameRequested = i, this._statScreenShareFirstFrame = new Ci(e, r), this._debug = a;
|
|
4956
5076
|
}
|
|
4957
5077
|
appendChunk(t) {
|
|
4958
5078
|
let n = this._chunks.length;
|
|
4959
5079
|
if (t.start) this._measureFreezeDuration(!1), this._measureFreezeDuration(!0), n && (this._debug.warn("[FrameBuilder] Cleanup buffer", Array.prototype.slice.call(this._chunks)), this._chunks = []);
|
|
4960
|
-
else if (!n || (this._chunks[n - 1].sequence + 1) %
|
|
5080
|
+
else if (!n || (this._chunks[n - 1].sequence + 1) % wi !== t.sequence) {
|
|
4961
5081
|
this._debug.warn("[FrameBuilder] Got incorrect chunk");
|
|
4962
5082
|
return;
|
|
4963
5083
|
}
|
|
@@ -4974,7 +5094,7 @@ var di = class {
|
|
|
4974
5094
|
}
|
|
4975
5095
|
}
|
|
4976
5096
|
destroy() {
|
|
4977
|
-
G.clearMark(
|
|
5097
|
+
G.clearMark(Ti), G.clearMark(G.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
|
|
4978
5098
|
}
|
|
4979
5099
|
_processFrameData() {
|
|
4980
5100
|
let e = this._chunks;
|
|
@@ -4997,13 +5117,13 @@ var di = class {
|
|
|
4997
5117
|
}
|
|
4998
5118
|
_measureFreezeDuration(e) {
|
|
4999
5119
|
if (e) {
|
|
5000
|
-
G.setMark(
|
|
5120
|
+
G.setMark(Ti);
|
|
5001
5121
|
return;
|
|
5002
5122
|
}
|
|
5003
|
-
let t = G.measureMark(
|
|
5123
|
+
let t = G.measureMark(Ti);
|
|
5004
5124
|
t !== null && t > 1e3 && this._onStat({ freeze_duration: t });
|
|
5005
5125
|
}
|
|
5006
|
-
},
|
|
5126
|
+
}, Di = class {
|
|
5007
5127
|
constructor(e) {
|
|
5008
5128
|
h(this, "_onStream", void 0), this._onStream = e;
|
|
5009
5129
|
}
|
|
@@ -5016,7 +5136,7 @@ var di = class {
|
|
|
5016
5136
|
static isBrowserSupported() {
|
|
5017
5137
|
throw Error("Method `isBrowserSupported` is not implemented");
|
|
5018
5138
|
}
|
|
5019
|
-
},
|
|
5139
|
+
}, Oi = class extends Di {
|
|
5020
5140
|
constructor(e, t = z) {
|
|
5021
5141
|
super(e), h(this, "_useImageBitmap", void 0), h(this, "_canvas", null), h(this, "_canvasContext", null), h(this, "_stream", null), h(this, "_track", null), h(this, "_debug", void 0), this._debug = t, this._debug.debug("CanvasRenderer started"), this._useImageBitmap = "ImageBitmap" in window;
|
|
5022
5142
|
}
|
|
@@ -5076,7 +5196,7 @@ var di = class {
|
|
|
5076
5196
|
static isBrowserSupported() {
|
|
5077
5197
|
return ("CanvasCaptureMediaStream" in window || "CanvasCaptureMediaStreamTrack" in window) && !(E.browserName() === "Safari" && Number(E.browserVersion()) === 15);
|
|
5078
5198
|
}
|
|
5079
|
-
},
|
|
5199
|
+
}, ki = class extends Di {
|
|
5080
5200
|
constructor(e, t = z) {
|
|
5081
5201
|
super(e), h(this, "_generator", void 0), h(this, "_writer", void 0), h(this, "_stream", void 0), h(this, "_debug", void 0), this._debug = t, this._debug.debug("TrackGeneratorRenderer started"), this._generator = new MediaStreamTrackGenerator({ kind: A.video }), this._writer = this._generator.writable.getWriter(), this._stream = new MediaStream([this._generator]), this._onStream(this._stream);
|
|
5082
5202
|
}
|
|
@@ -5087,9 +5207,9 @@ var di = class {
|
|
|
5087
5207
|
this._writer.releaseLock(), this._generator.writable.close().then(() => this._generator.stop()), this._debug.debug("TrackGeneratorRenderer destroyed");
|
|
5088
5208
|
}
|
|
5089
5209
|
static isBrowserSupported() {
|
|
5090
|
-
return "VideoFrame" in window && "MediaStreamTrackGenerator" in window &&
|
|
5210
|
+
return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && xi.isBrowserSupported();
|
|
5091
5211
|
}
|
|
5092
|
-
},
|
|
5212
|
+
}, Ai = class extends Ei {
|
|
5093
5213
|
constructor(e, t, n, r, i, a = z, o = null) {
|
|
5094
5214
|
super(e, t, n, r, i, a), h(this, "_renderer", void 0), h(this, "_decoder", void 0), h(this, "_decoderReady", !1), h(this, "_decoderBusy", !1), h(this, "_decoderQueue", []), h(this, "_webCodecsRetryAttempted", !1), h(this, "_fpsMeter", void 0), h(this, "_logger", void 0), this._logger = o, this._debug.debug(`StreamBuilder started for participant [${e}]`), this._initFpsMeter(), this._initRenderer(), this._initDecoder();
|
|
5095
5215
|
}
|
|
@@ -5097,16 +5217,16 @@ var di = class {
|
|
|
5097
5217
|
e.keyframe && (this._decoderQueue = []), this._decoderQueue.push(e), this._decodeQueue();
|
|
5098
5218
|
}
|
|
5099
5219
|
_initFpsMeter() {
|
|
5100
|
-
this._fpsMeter = new
|
|
5220
|
+
this._fpsMeter = new Si((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
|
|
5101
5221
|
}
|
|
5102
5222
|
_initRenderer(e = !1) {
|
|
5103
|
-
e || !
|
|
5223
|
+
e || !ki.isBrowserSupported() ? this._renderer = new Oi(this._onStream, this._debug) : this._renderer = new ki(this._onStream, this._debug);
|
|
5104
5224
|
}
|
|
5105
5225
|
_initDecoder(e = !1) {
|
|
5106
|
-
e || !
|
|
5226
|
+
e || !xi.isBrowserSupported() ? this._decoder = new bi(this._debug, this._logger) : this._decoder = new xi(this._debug, this._logger), this._decoder.init(async (e) => {
|
|
5107
5227
|
this._decoderBusy = !1, "VideoFrame" in window && e instanceof VideoFrame ? await this._renderer.drawFrame(e) : await this._renderer.drawImage(e), this._fpsMeter.increment(), this._decodeQueue();
|
|
5108
5228
|
}, (e) => {
|
|
5109
|
-
if (this._decoderBusy = !1, this._decoder instanceof
|
|
5229
|
+
if (this._decoderBusy = !1, this._decoder instanceof xi && typeof e == "string" && e.includes("EncodingError")) {
|
|
5110
5230
|
this._decoderQueue = [], !this._webCodecsRetryAttempted && e.includes("reset because error during decoding") ? (this._webCodecsRetryAttempted = !0, this._debug.warn("StreamBuilder retry WebCodecs with software decoder"), this._onKeyFrameRequested?.()) : this._switchToLibVPXDecoder();
|
|
5111
5231
|
return;
|
|
5112
5232
|
}
|
|
@@ -5114,7 +5234,7 @@ var di = class {
|
|
|
5114
5234
|
}, this._onKeyFrameRequested).then(() => {
|
|
5115
5235
|
this._decoderReady = !0, this._decodeQueue();
|
|
5116
5236
|
}).catch((e) => {
|
|
5117
|
-
this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof
|
|
5237
|
+
this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof xi && this._switchToLibVPXDecoder();
|
|
5118
5238
|
});
|
|
5119
5239
|
}
|
|
5120
5240
|
_switchToLibVPXDecoder() {
|
|
@@ -5129,20 +5249,20 @@ var di = class {
|
|
|
5129
5249
|
super.destroy(), this._fpsMeter.destroy(), this._decoder.destroy(), this._renderer.destroy(), this._debug.debug(`StreamBuilder destroyed for participant ${this._participantId}`);
|
|
5130
5250
|
}
|
|
5131
5251
|
static isBrowserSupported() {
|
|
5132
|
-
return
|
|
5252
|
+
return Oi.isBrowserSupported() || ki.isBrowserSupported();
|
|
5133
5253
|
}
|
|
5134
|
-
},
|
|
5135
|
-
function
|
|
5254
|
+
}, ji = 1, Mi = 1, Ni = 2, Pi = 0, Fi = 1, Ii = 2, Li = 4, Ri = 8;
|
|
5255
|
+
function zi(e, t, n, r, i, a, o) {
|
|
5136
5256
|
let s = 0;
|
|
5137
|
-
t && (s |=
|
|
5257
|
+
t && (s |= Fi), n && (s |= Ii), r && (s |= Li), o || (s |= Ri);
|
|
5138
5258
|
let c = /* @__PURE__ */ new ArrayBuffer(11), l = new DataView(c);
|
|
5139
|
-
if (l.setUint8(0,
|
|
5259
|
+
if (l.setUint8(0, ji), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, Pi), l.setUint8(10, s), !o) return c;
|
|
5140
5260
|
let u = new Uint8Array(c.byteLength + o.byteLength);
|
|
5141
5261
|
return u.set(new Uint8Array(c), 0), u.set(new Uint8Array(o), c.byteLength), u.buffer;
|
|
5142
5262
|
}
|
|
5143
|
-
function
|
|
5144
|
-
let t = new DataView(e), n = t.getUint8(0), r = t.getUint16(1), i = t.getUint32(3), a = t.getUint8(7) === 1, o = t.getUint16(8), s = t.getUint8(10), c = !!(s &
|
|
5145
|
-
if (n !==
|
|
5263
|
+
function Bi(e) {
|
|
5264
|
+
let t = new DataView(e), n = t.getUint8(0), r = t.getUint16(1), i = t.getUint32(3), a = t.getUint8(7) === 1, o = t.getUint16(8), s = t.getUint8(10), c = !!(s & Fi), l = !!(s & Ii), u = !!(s & Li), d = !!(s & Ri);
|
|
5265
|
+
if (n !== ji) throw Error(`Unexpected protocol version. Got ${n}, expected ${ji}`);
|
|
5146
5266
|
return {
|
|
5147
5267
|
timestamp: i,
|
|
5148
5268
|
start: c,
|
|
@@ -5155,26 +5275,26 @@ function Pi(e) {
|
|
|
5155
5275
|
data: e.slice(11)
|
|
5156
5276
|
};
|
|
5157
5277
|
}
|
|
5158
|
-
function
|
|
5278
|
+
function Vi(e) {
|
|
5159
5279
|
if (!e || !e.byteLength || e.byteLength !== 4) return !1;
|
|
5160
5280
|
let t = new DataView(e);
|
|
5161
|
-
return !(t.getUint8(0) !==
|
|
5281
|
+
return !(t.getUint8(0) !== ji || t.getUint8(1) !== Mi || t.getUint16(2) !== Pi);
|
|
5162
5282
|
}
|
|
5163
|
-
function
|
|
5283
|
+
function Hi(e) {
|
|
5164
5284
|
if (!e || !e.byteLength || e.byteLength !== 10) return null;
|
|
5165
5285
|
let t = new DataView(e);
|
|
5166
|
-
return t.getUint8(0) !==
|
|
5286
|
+
return t.getUint8(0) !== ji || t.getUint8(1) !== Ni || t.getUint16(2) !== Pi ? null : {
|
|
5167
5287
|
seq: t.getUint16(4),
|
|
5168
5288
|
ts2: t.getUint32(6)
|
|
5169
5289
|
};
|
|
5170
5290
|
}
|
|
5171
|
-
function
|
|
5291
|
+
function Ui(e) {
|
|
5172
5292
|
let t = /* @__PURE__ */ new ArrayBuffer(4), n = new DataView(t);
|
|
5173
|
-
return n.setUint8(0,
|
|
5293
|
+
return n.setUint8(0, ji), n.setUint8(1, Mi), n.setUint16(2, e), t;
|
|
5174
5294
|
}
|
|
5175
5295
|
//#endregion
|
|
5176
5296
|
//#region src/classes/screenshare/WebmBuilder.ts
|
|
5177
|
-
var
|
|
5297
|
+
var Wi = 2 ** 15 - 1, Gi = 1, Ki = 5, qi = 5, Ji = class e {
|
|
5178
5298
|
constructor(e, t = z) {
|
|
5179
5299
|
h(this, "_mediaSource", void 0), h(this, "_codec", void 0), h(this, "_sourceBuffer", null), h(this, "_queue", []), h(this, "_clearBufferTill", 0), h(this, "_debug", void 0), this._mediaSource = new MediaSource(), this._codec = e, this._debug = t;
|
|
5180
5300
|
let n = () => {
|
|
@@ -5217,8 +5337,8 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5217
5337
|
this._mediaSource?.readyState === "open" && this._sourceBuffer?.abort();
|
|
5218
5338
|
let e = this._sourceBuffer?.buffered, t = e?.length;
|
|
5219
5339
|
if (!t) return;
|
|
5220
|
-
let n = e.start(0), r = Math.max(0, e.end(t - 1) -
|
|
5221
|
-
r - n >
|
|
5340
|
+
let n = e.start(0), r = Math.max(0, e.end(t - 1) - Ki);
|
|
5341
|
+
r - n > qi && (this._clearBufferTill = r);
|
|
5222
5342
|
}
|
|
5223
5343
|
destroy() {
|
|
5224
5344
|
this._queue = [], this._mediaSource.readyState === "open" && (this._sourceBuffer?.abort(), this._mediaSource.endOfStream()), this._sourceBuffer = null, this._clearBufferTill = 0;
|
|
@@ -5232,7 +5352,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5232
5352
|
get buffered() {
|
|
5233
5353
|
return this._sourceBuffer?.buffered;
|
|
5234
5354
|
}
|
|
5235
|
-
},
|
|
5355
|
+
}, Yi = class e extends Ei {
|
|
5236
5356
|
constructor(e, t, n, r, i = z) {
|
|
5237
5357
|
super(e, t, n, r, void 0, i), h(this, "_mediaBuffer", null), h(this, "_video", null), h(this, "_stream", null), h(this, "_earliestTimestamp", 0), h(this, "_clusterStartTime", 0), h(this, "_lastFrameTimestamp", 0), this._debug.debug(`[WebmBuilder] started for participant [${e}]`);
|
|
5238
5358
|
}
|
|
@@ -5256,8 +5376,8 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5256
5376
|
u.element(u.ID.MuxingApp, u.string("vk-webm-builder")),
|
|
5257
5377
|
u.element(u.ID.WritingApp, u.string("vk-webm-builder"))
|
|
5258
5378
|
]), i = [u.element(u.ID.PixelWidth, u.number(e)), u.element(u.ID.PixelHeight, u.number(t))], a = u.element(u.ID.Tracks, u.element(u.ID.TrackEntry, [
|
|
5259
|
-
u.element(u.ID.TrackNumber, u.number(
|
|
5260
|
-
u.element(u.ID.TrackUID, u.number(
|
|
5379
|
+
u.element(u.ID.TrackNumber, u.number(Gi)),
|
|
5380
|
+
u.element(u.ID.TrackUID, u.number(Gi)),
|
|
5261
5381
|
u.element(u.ID.TrackType, u.number(1)),
|
|
5262
5382
|
u.element(u.ID.FlagLacing, u.number(0)),
|
|
5263
5383
|
u.element(u.ID.DefaultDuration, u.number(1e9)),
|
|
@@ -5270,7 +5390,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5270
5390
|
return u.unknownSizeElement(u.ID.Cluster, [u.element(u.ID.Timecode, u.number(Math.round(e)))]);
|
|
5271
5391
|
}
|
|
5272
5392
|
_createVideo(e) {
|
|
5273
|
-
this._mediaBuffer = new
|
|
5393
|
+
this._mediaBuffer = new Ji(e, this._debug), this._video = document.createElement("video"), this._video.autoplay = !0, this._video.controls = !1, this._video.muted = !0, this._video.style.pointerEvents = "none", this._video.style.visibility = "hidden", this._video.style.position = "absolute", this._video.style.width = "160px", this._video.style.height = "90px", this._video.style.bottom = "0", this._video.style.right = "0", this._video.style.zIndex = "5000", this._video.src = URL.createObjectURL(this._mediaBuffer.mediaSource), document.body.appendChild(this._video);
|
|
5274
5394
|
let t = () => {
|
|
5275
5395
|
if (this._video?.src) {
|
|
5276
5396
|
this._debug.warn(`[WebmBuilder] Video paused for participant [${this._participantId}], try to play again`);
|
|
@@ -5297,13 +5417,13 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5297
5417
|
this._mediaBuffer?.append(a);
|
|
5298
5418
|
}
|
|
5299
5419
|
let i = Math.round(r - this._clusterStartTime);
|
|
5300
|
-
if (i >
|
|
5420
|
+
if (i > Wi && (this._clusterStartTime = r, i = 0), i === 0) {
|
|
5301
5421
|
this._debug.debug(`[WebmBuilder] Cluster header for participant [${this._participantId}]`);
|
|
5302
5422
|
let t = e._genClusterHeader(this._clusterStartTime);
|
|
5303
5423
|
this._mediaBuffer?.append(t);
|
|
5304
5424
|
}
|
|
5305
5425
|
let a = u.element(u.ID.SimpleBlock, [
|
|
5306
|
-
u.vintEncodedNumber(
|
|
5426
|
+
u.vintEncodedNumber(Gi),
|
|
5307
5427
|
u.bytes(e._intToU16BE(i)),
|
|
5308
5428
|
u.number(!!t.keyframe << 7),
|
|
5309
5429
|
u.bytes(t.frameData)
|
|
@@ -5316,12 +5436,12 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5316
5436
|
static isBrowserSupported() {
|
|
5317
5437
|
return "captureStream" in window.HTMLVideoElement?.prototype && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp8\"") && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp9\"");
|
|
5318
5438
|
}
|
|
5319
|
-
},
|
|
5439
|
+
}, Xi = class {
|
|
5320
5440
|
constructor(e, t, n, r, i, a = null, o = z, s = null) {
|
|
5321
5441
|
h(this, "_datachannel", void 0), h(this, "_participantIdRegistry", null), h(this, "_streamBuilders", {}), h(this, "_onStream", () => {}), h(this, "_onEos", () => {}), h(this, "_onStat", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), this._debug = o, this._logger = s, this._statAggregator = a, this._debug.debug("ScreenCaptureReceiver started"), this._datachannel = e, this._participantIdRegistry = t, this._onStream = n, this._onEos = r, this._onStat = i, this._datachannel.onmessage = (e) => this._onDataChannelMessage(e.data);
|
|
5322
5442
|
}
|
|
5323
5443
|
_onDataChannelMessage(e) {
|
|
5324
|
-
let t =
|
|
5444
|
+
let t = Bi(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
|
|
5325
5445
|
if (!n) {
|
|
5326
5446
|
this._debug.warn(`Participant id for ssrc ${t.ssrc} not found in registry`);
|
|
5327
5447
|
return;
|
|
@@ -5333,7 +5453,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5333
5453
|
let r = this._streamBuilders[n];
|
|
5334
5454
|
if (!r) {
|
|
5335
5455
|
let e = (e) => this._onStream(n, e);
|
|
5336
|
-
r = N.screenShareWebmBuilder &&
|
|
5456
|
+
r = N.screenShareWebmBuilder && Yi.isBrowserSupported() ? new Yi(n, e, this._onStat, this._statAggregator, this._debug) : new Ai(n, e, this._onStat, this._statAggregator, () => {
|
|
5337
5457
|
this._requestKeyFrame(t.ssrc);
|
|
5338
5458
|
}, this._debug, this._logger), this._streamBuilders[n] = r;
|
|
5339
5459
|
}
|
|
@@ -5341,7 +5461,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5341
5461
|
}
|
|
5342
5462
|
_requestKeyFrame(e) {
|
|
5343
5463
|
if (!(!this._datachannel || this._datachannel.readyState !== "open")) try {
|
|
5344
|
-
let t =
|
|
5464
|
+
let t = Ui(e);
|
|
5345
5465
|
this._datachannel.send(t), this._debug.debug(`ScreenCaptureReceiver request for keyframe for ssrc ${e}`);
|
|
5346
5466
|
} catch (e) {
|
|
5347
5467
|
this._debug.warn("Failed to send keyframe request", e);
|
|
@@ -5354,7 +5474,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5354
5474
|
destroy() {
|
|
5355
5475
|
this._datachannel.onbufferedamountlow = null, this._datachannel.onmessage = null, this._onStream = () => {}, Object.values(this._streamBuilders).forEach((e) => e.destroy()), this._streamBuilders = {}, this._participantIdRegistry = null, this._debug.debug("ScreenCaptureReceiver destroyed");
|
|
5356
5476
|
}
|
|
5357
|
-
},
|
|
5477
|
+
}, Zi = class {
|
|
5358
5478
|
constructor(e, t, n) {
|
|
5359
5479
|
h(this, "_prev", void 0), h(this, "_next", void 0), h(this, "_data", void 0), this._next = n, n && (n.prev = this), this._prev = t, t && (t.next = this), this._data = e;
|
|
5360
5480
|
}
|
|
@@ -5373,7 +5493,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5373
5493
|
get data() {
|
|
5374
5494
|
return this._data;
|
|
5375
5495
|
}
|
|
5376
|
-
},
|
|
5496
|
+
}, Qi = class {
|
|
5377
5497
|
constructor() {
|
|
5378
5498
|
h(this, "_head", null), h(this, "_tail", null), h(this, "_length", 0);
|
|
5379
5499
|
}
|
|
@@ -5381,7 +5501,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5381
5501
|
return this._length;
|
|
5382
5502
|
}
|
|
5383
5503
|
push(...e) {
|
|
5384
|
-
for (let t of e) this._tail = new
|
|
5504
|
+
for (let t of e) this._tail = new Zi(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
|
|
5385
5505
|
}
|
|
5386
5506
|
merge(e) {
|
|
5387
5507
|
this._tail && (this._tail.next = e._head), this._head || (this._head = e._head), this._tail = e._tail, this._length += e._length, e.clear();
|
|
@@ -5411,7 +5531,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5411
5531
|
for (; t !== null;) e.push(t.data), t = t.next;
|
|
5412
5532
|
return e.length ? JSON.stringify(e, (e, t) => t instanceof Error ? String(t) : t) : "";
|
|
5413
5533
|
}
|
|
5414
|
-
},
|
|
5534
|
+
}, $i = 1e3, ea = class extends yi {
|
|
5415
5535
|
constructor(e, t, n, r, i = z, a = null) {
|
|
5416
5536
|
super(i, a), h(this, "_sourceTrack", void 0), h(this, "_onFrame", void 0), h(this, "_useCongestionControl", void 0), h(this, "_maxBitrate", void 0), h(this, "_useImageCapture", void 0), h(this, "_video", null), h(this, "_imageCapture", null), h(this, "_canvas", null), h(this, "_canvasCtx", null), h(this, "_frameReadTimeout", 0), h(this, "_lastFrame", null), this._sourceTrack = e, this._onFrame = t, this._useCongestionControl = n, this._maxBitrate = r, this._useImageCapture = "ImageCapture" in window && ImageCapture.prototype.grabFrame !== void 0 && "ImageBitmap" in window, (e.readyState !== "live" || !e.enabled || e.muted) && (this._useImageCapture = !1);
|
|
5417
5537
|
}
|
|
@@ -5480,7 +5600,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5480
5600
|
}
|
|
5481
5601
|
_encode(e, t) {
|
|
5482
5602
|
let n = e.data.buffer;
|
|
5483
|
-
this._sendToWorker(
|
|
5603
|
+
this._sendToWorker(vi.FRAME, {
|
|
5484
5604
|
width: e.width,
|
|
5485
5605
|
height: e.height,
|
|
5486
5606
|
imageData: n,
|
|
@@ -5497,7 +5617,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5497
5617
|
let t = this._drawFrameData(this._lastFrame);
|
|
5498
5618
|
this._encode(t, e);
|
|
5499
5619
|
} else this._onFrame(null);
|
|
5500
|
-
},
|
|
5620
|
+
}, $i), this._getFrameBitmap().then((t) => {
|
|
5501
5621
|
window.clearTimeout(this._frameReadTimeout), this._lastFrame?.close(), this._lastFrame = t;
|
|
5502
5622
|
let n = this._drawFrameData(t);
|
|
5503
5623
|
this._encode(n, e);
|
|
@@ -5507,7 +5627,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5507
5627
|
this._useImageCapture ? this._requestFrameBitmap(e) : this._requestFrameVideo(e);
|
|
5508
5628
|
}
|
|
5509
5629
|
setBitrate(e, t, n) {
|
|
5510
|
-
this._sendToWorker(
|
|
5630
|
+
this._sendToWorker(vi.SET_BITRATE, {
|
|
5511
5631
|
bitrate: e,
|
|
5512
5632
|
useCbr: t
|
|
5513
5633
|
});
|
|
@@ -5518,7 +5638,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5518
5638
|
destroy() {
|
|
5519
5639
|
this._removeWorker(), this._removeStream(), this._removeDom(), this._debug.debug("LibVPxEncoder destroyed");
|
|
5520
5640
|
}
|
|
5521
|
-
},
|
|
5641
|
+
}, ta = class extends yi {
|
|
5522
5642
|
constructor(e, t, n, r, i, a, o = z, s = null) {
|
|
5523
5643
|
super(o, s), h(this, "_sourceTrack", void 0), h(this, "_trackProcessor", void 0), h(this, "_onFrame", void 0), h(this, "_useCongestionControl", void 0), h(this, "_maxBitrate", void 0), h(this, "_useCbr", void 0), h(this, "_frameRate", void 0), this._sourceTrack = e, this._onFrame = t, this._useCongestionControl = n, this._maxBitrate = r, this._useCbr = i, this._frameRate = a, this._trackProcessor = new MediaStreamTrackProcessor({ track: e });
|
|
5524
5644
|
}
|
|
@@ -5546,10 +5666,10 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5546
5666
|
}, [n]);
|
|
5547
5667
|
}
|
|
5548
5668
|
requestFrame(e = !1) {
|
|
5549
|
-
this._sendToWorker(
|
|
5669
|
+
this._sendToWorker(vi.FRAME, { keyFrame: e });
|
|
5550
5670
|
}
|
|
5551
5671
|
setBitrate(e, t, n) {
|
|
5552
|
-
this._sendToWorker(
|
|
5672
|
+
this._sendToWorker(vi.SET_BITRATE, {
|
|
5553
5673
|
bitrate: e,
|
|
5554
5674
|
useCbr: t,
|
|
5555
5675
|
fps: n
|
|
@@ -5564,11 +5684,11 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5564
5684
|
static isBrowserSupported() {
|
|
5565
5685
|
return "VideoEncoder" in window && "Worker" in window && "EncodedVideoChunk" in window && "MediaStreamTrackProcessor" in window;
|
|
5566
5686
|
}
|
|
5567
|
-
},
|
|
5687
|
+
}, na = 2100, ra = 600, ia = 1.2, aa = .8, oa = 2e3, sa = 8e3, ca = 8e3, la = 16e3, ua = 4, da = 2e3, fa = /* @__PURE__ */ function(e) {
|
|
5568
5688
|
return e[e.NONE = 0] = "NONE", e[e.UP = 1] = "UP", e[e.DOWN = 2] = "DOWN", e;
|
|
5569
|
-
}(
|
|
5689
|
+
}(fa || {}), pa = class {
|
|
5570
5690
|
constructor(e, t, n, r, i, a, o, s = z) {
|
|
5571
|
-
h(this, "_onCongestion", void 0), h(this, "_ccEnabled", void 0), h(this, "_fastSharing", void 0), h(this, "_trendDelayThreshold", void 0), h(this, "_highDelayThreshold", void 0), h(this, "_targetFps", void 0), h(this, "_minBitrate", void 0), h(this, "_maxBitrate", void 0), h(this, "_targetBitrate", void 0), h(this, "_lastDown", void 0), h(this, "_lastUp", void 0), h(this, "_lastProbing", void 0), h(this, "_lastCheckDelay", void 0), h(this, "_upPenalty", 0), h(this, "_probing", void 0), h(this, "_delayAvgShort", -1), h(this, "_delayAvgLong", -1), h(this, "_minDelay", Number.MAX_VALUE), h(this, "_maxDelay", 0), h(this, "_largeDelayDuration", 0), h(this, "_lastFpsCalcMs", void 0), h(this, "_frames", 0), h(this, "_fps", 0), h(this, "_debug", void 0), this._onCongestion = e, this._ccEnabled = r, this._debug = s, this._minBitrate = t, this._maxBitrate = n, this._fastSharing = i, this._targetFps = o, a > 0 ? this._highDelayThreshold = a : this._highDelayThreshold =
|
|
5691
|
+
h(this, "_onCongestion", void 0), h(this, "_ccEnabled", void 0), h(this, "_fastSharing", void 0), h(this, "_trendDelayThreshold", void 0), h(this, "_highDelayThreshold", void 0), h(this, "_targetFps", void 0), h(this, "_minBitrate", void 0), h(this, "_maxBitrate", void 0), h(this, "_targetBitrate", void 0), h(this, "_lastDown", void 0), h(this, "_lastUp", void 0), h(this, "_lastProbing", void 0), h(this, "_lastCheckDelay", void 0), h(this, "_upPenalty", 0), h(this, "_probing", void 0), h(this, "_delayAvgShort", -1), h(this, "_delayAvgLong", -1), h(this, "_minDelay", Number.MAX_VALUE), h(this, "_maxDelay", 0), h(this, "_largeDelayDuration", 0), h(this, "_lastFpsCalcMs", void 0), h(this, "_frames", 0), h(this, "_fps", 0), h(this, "_debug", void 0), this._onCongestion = e, this._ccEnabled = r, this._debug = s, this._minBitrate = t, this._maxBitrate = n, this._fastSharing = i, this._targetFps = o, a > 0 ? this._highDelayThreshold = a : this._highDelayThreshold = na, i && (this._highDelayThreshold = ra), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
|
|
5572
5692
|
let c = Date.now();
|
|
5573
5693
|
this._lastDown = 0, this._lastUp = c, this._lastProbing = c, this._lastCheckDelay = 0, this._lastFpsCalcMs = 0;
|
|
5574
5694
|
}
|
|
@@ -5578,27 +5698,27 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5578
5698
|
let i = 0, a = this._delayAvgShort - this._delayAvgLong, o = Math.round(Math.abs(a) * 100 / this._delayAvgLong), s = a > 40 && o > 30 && this._delayAvgShort > this._trendDelayThreshold, c = this._delayAvgShort > this._highDelayThreshold;
|
|
5579
5699
|
s || c ? i = 2 : Math.abs(a) < 40 && o < 10 && !c && (i = 1);
|
|
5580
5700
|
let l = Math.round(this._targetBitrate / 1e3), u = n;
|
|
5581
|
-
e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5701
|
+
e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${fa[i]} tr=${l} br=${n}`);
|
|
5582
5702
|
let d = r - this._lastDown;
|
|
5583
|
-
if (i === 2 && d >
|
|
5584
|
-
this._probing && (this._upPenalty = Math.min(++this._upPenalty,
|
|
5585
|
-
let n =
|
|
5586
|
-
if (n >= this._targetBitrate && (n = this._targetBitrate *
|
|
5587
|
-
let r = Math.round(n / 1e3), s = Math.round(this._upPenalty *
|
|
5588
|
-
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5703
|
+
if (i === 2 && d > oa) {
|
|
5704
|
+
this._probing && (this._upPenalty = Math.min(++this._upPenalty, ua), this._probing = !1);
|
|
5705
|
+
let n = aa * u * 1e3;
|
|
5706
|
+
if (n >= this._targetBitrate && (n = this._targetBitrate * aa), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
|
|
5707
|
+
let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * ca / 1e3);
|
|
5708
|
+
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${fa[i]}`), this._debug.log(`#${e}: cc: DOWN delay=${t} bitrate=${u} target=${l} -> newBitrate=${r} penalty=${s}s`), this._setBitrate(n, !0), this._targetBitrate = n;
|
|
5589
5709
|
}
|
|
5590
5710
|
this._lastDown = r;
|
|
5591
5711
|
}
|
|
5592
|
-
let f = r - this._lastUp, p =
|
|
5712
|
+
let f = r - this._lastUp, p = sa + this._upPenalty * ca;
|
|
5593
5713
|
if (i === 1 && f > p && d > p) {
|
|
5594
|
-
let n = Math.min(this._targetBitrate *
|
|
5714
|
+
let n = Math.min(this._targetBitrate * ia, this._maxBitrate);
|
|
5595
5715
|
if (n > this._targetBitrate) {
|
|
5596
|
-
let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty *
|
|
5597
|
-
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5716
|
+
let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * ca / 1e3);
|
|
5717
|
+
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${fa[i]}`), this._debug.log(`#${e}: cc: UP bitrate=${u} target=${c} -> newBitrate=${s} penalty=${l}s`), this._setBitrate(n, !1), this._targetBitrate = n, this._probing = !0, this._lastProbing = r, this._lastUp = r;
|
|
5598
5718
|
}
|
|
5599
5719
|
}
|
|
5600
5720
|
let m = r - this._lastProbing;
|
|
5601
|
-
this._probing && m >
|
|
5721
|
+
this._probing && m > la && (this._probing = !1);
|
|
5602
5722
|
let ee = r - this._lastDown;
|
|
5603
5723
|
this._upPenalty > 0 && ee > 3 * p && (this._debug.log(`#${e}: cc: UP reset penalty: oldPenalty=${this._upPenalty}`), this._upPenalty = 0);
|
|
5604
5724
|
}
|
|
@@ -5609,7 +5729,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5609
5729
|
}
|
|
5610
5730
|
_calcDelay(e, t) {
|
|
5611
5731
|
if (!(e <= 0)) {
|
|
5612
|
-
if (this._delayAvgShort === -1 && (this._delayAvgShort = e, this._delayAvgLong = e), this._delayAvgShort = Math.round((this._delayAvgShort * 3 + e) / 4), this._delayAvgLong = Math.round((this._delayAvgLong * 23 + e) / 24), e > 0 && e < this._minDelay ? this._minDelay = e : e > this._maxDelay && (this._maxDelay = e), this._lastCheckDelay === 0 && (this._lastCheckDelay = t), e >
|
|
5732
|
+
if (this._delayAvgShort === -1 && (this._delayAvgShort = e, this._delayAvgLong = e), this._delayAvgShort = Math.round((this._delayAvgShort * 3 + e) / 4), this._delayAvgLong = Math.round((this._delayAvgLong * 23 + e) / 24), e > 0 && e < this._minDelay ? this._minDelay = e : e > this._maxDelay && (this._maxDelay = e), this._lastCheckDelay === 0 && (this._lastCheckDelay = t), e > da) {
|
|
5613
5733
|
let e = t - this._lastCheckDelay;
|
|
5614
5734
|
this._largeDelayDuration += e;
|
|
5615
5735
|
}
|
|
@@ -5638,7 +5758,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5638
5758
|
this._fps === 0 ? this._fps = Math.round(r) : this._fps = Math.round((this._fps * 3 + r) / 4), this._frames = 0, this._fps !== n && this._debug.log(`cc: fps=${this._fps}`);
|
|
5639
5759
|
}
|
|
5640
5760
|
}
|
|
5641
|
-
},
|
|
5761
|
+
}, ma = class {
|
|
5642
5762
|
constructor(e) {
|
|
5643
5763
|
h(this, "_maxSize", void 0), h(this, "_size", 0), h(this, "_buffer", void 0), h(this, "_head", 0), h(this, "_tail", 0), this._maxSize = e, this._buffer = Array(e);
|
|
5644
5764
|
}
|
|
@@ -5712,11 +5832,11 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5712
5832
|
clear() {
|
|
5713
5833
|
this._buffer.fill(void 0), this._size = 0, this._head = 0, this._tail = 0;
|
|
5714
5834
|
}
|
|
5715
|
-
},
|
|
5835
|
+
}, ha = 65536, ga = 50, _a = 400, va = 1e6, ya = 3e5, ba = 3e4, xa = 2e3, Sa = 5, Ca = 0, wa = class {
|
|
5716
5836
|
constructor(e, t, n, r, i = z, a = null) {
|
|
5717
|
-
h(this, "_encoder", void 0), h(this, "_datachannel", void 0), h(this, "_signaling", void 0), h(this, "_fastSharing", void 0), h(this, "_destroyed", !1), h(this, "_needKeyframe", !0), h(this, "DATA_SIZE", void 0), h(this, "_congestionControl", void 0), h(this, "_frameNum", 0), h(this, "_width", void 0), h(this, "_height", void 0), h(this, "_feedback", new
|
|
5837
|
+
h(this, "_encoder", void 0), h(this, "_datachannel", void 0), h(this, "_signaling", void 0), h(this, "_fastSharing", void 0), h(this, "_destroyed", !1), h(this, "_needKeyframe", !0), h(this, "DATA_SIZE", void 0), h(this, "_congestionControl", void 0), h(this, "_frameNum", 0), h(this, "_width", void 0), h(this, "_height", void 0), h(this, "_feedback", new ma(1024)), h(this, "_lastSentFrameSeq", 0), h(this, "_lastDeliveredFrameSeq", 0), h(this, "_lastFrameDelay", 0), h(this, "_lastFramerateReduced", Date.now()), h(this, "_lastSharingStat", Date.now()), h(this, "_congestionControlEnabled", void 0), h(this, "_queue", new Qi()), h(this, "_fpsMeter", void 0), h(this, "_maxFrameDelay", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = i, this._logger = a, this._debug.debug("ScreenCaptureSender started"), this.DATA_SIZE = N.consumerScreenDataChannelPacketSize - 11, this._datachannel = t, this._signaling = n, this._fastSharing = r, this._congestionControlEnabled = N.screenShareCongestionControl || this._fastSharing, this._width = e.getSettings().width, this._height = e.getSettings().height, this._maxFrameDelay = this._fastSharing ? N.screenShareCongestionControlThreshold : N.screenShareCongestionControlThreshold * 2;
|
|
5718
5838
|
let o = N.getScreenFrameRate(this._fastSharing), { minBitrate: s, maxBitrate: c } = this._calcMinMaxBitrate(this._width, this._height), l = this._onCongestionCallback.bind(this);
|
|
5719
|
-
this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${N.screenShareCongestionControlThreshold}`), this._congestionControl = new
|
|
5839
|
+
this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${N.screenShareCongestionControlThreshold}`), this._congestionControl = new pa(l, s, c, this._congestionControlEnabled, this._fastSharing, N.screenShareCongestionControlThreshold, o, this._debug);
|
|
5720
5840
|
let u = (e, t) => {
|
|
5721
5841
|
if (this._destroyed) return;
|
|
5722
5842
|
if (!e) {
|
|
@@ -5727,23 +5847,23 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5727
5847
|
let n = this._sliceFrame(e);
|
|
5728
5848
|
this._queue.merge(n), this._handleQueue(), this._sendSharingStat();
|
|
5729
5849
|
};
|
|
5730
|
-
if (
|
|
5850
|
+
if (ta.isBrowserSupported()) {
|
|
5731
5851
|
let t = this._fastSharing;
|
|
5732
|
-
this._encoder = new
|
|
5733
|
-
} else this._encoder = new
|
|
5852
|
+
this._encoder = new ta(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
|
|
5853
|
+
} else this._encoder = new ea(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
|
|
5734
5854
|
this._datachannel.onmessage = (e) => {
|
|
5735
|
-
|
|
5736
|
-
let t =
|
|
5855
|
+
Vi(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
|
|
5856
|
+
let t = Hi(e.data);
|
|
5737
5857
|
t !== null && this._checkCcFeedback(t);
|
|
5738
|
-
}, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new
|
|
5858
|
+
}, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new Si((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
|
|
5739
5859
|
}
|
|
5740
5860
|
_handleQueue() {
|
|
5741
5861
|
if (this._destroyed) return;
|
|
5742
5862
|
let e = this._queue.shift();
|
|
5743
5863
|
if (!e) {
|
|
5744
|
-
if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq +
|
|
5864
|
+
if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + ha) % ha > Sa && this._lastFrameDelay > this._maxFrameDelay) {
|
|
5745
5865
|
let e = Date.now();
|
|
5746
|
-
e - this._lastFramerateReduced >
|
|
5866
|
+
e - this._lastFramerateReduced > xa && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
|
|
5747
5867
|
} else this._requestFrame();
|
|
5748
5868
|
return;
|
|
5749
5869
|
}
|
|
@@ -5769,7 +5889,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5769
5889
|
this._destroyed || (this._encoder.requestFrame(this._needKeyframe), this._needKeyframe = !1);
|
|
5770
5890
|
}
|
|
5771
5891
|
_sliceFrame(e) {
|
|
5772
|
-
let t = e.type === "key", n = e.data.byteLength, r = new
|
|
5892
|
+
let t = e.type === "key", n = e.data.byteLength, r = new Qi();
|
|
5773
5893
|
for (let i = 0; i < n; i += this.DATA_SIZE) {
|
|
5774
5894
|
let a = e.data.slice(i, i + this.DATA_SIZE), o = i === 0, s = n <= i + a.byteLength, c = this._wrapHeader(e.timestamp, o, s, t, a);
|
|
5775
5895
|
r.push({
|
|
@@ -5785,11 +5905,11 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5785
5905
|
return r;
|
|
5786
5906
|
}
|
|
5787
5907
|
_wrapHeader(e, t, n, r, i) {
|
|
5788
|
-
let a =
|
|
5789
|
-
sequence:
|
|
5908
|
+
let a = zi(e, t, n, r, Ca, this._encoder.isVP9(), i), o = {
|
|
5909
|
+
sequence: Ca,
|
|
5790
5910
|
data: a
|
|
5791
5911
|
};
|
|
5792
|
-
return
|
|
5912
|
+
return Ca = (Ca + 1) % ha, o;
|
|
5793
5913
|
}
|
|
5794
5914
|
_stopPacket() {
|
|
5795
5915
|
return this._wrapHeader(Date.now(), !1, !1, !1, null).data;
|
|
@@ -5806,7 +5926,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5806
5926
|
this._queue.clear(), this._fpsMeter.destroy(), this._datachannel.onmessage = null, this._feedback.clear(), this._datachannel.readyState === "open" && this._datachannel.send(this._stopPacket()), this._destroyed = !0, this._encoder.destroy(), this._debug.debug("ScreenCaptureSender destroyed");
|
|
5807
5927
|
}
|
|
5808
5928
|
static isBrowserSupported() {
|
|
5809
|
-
return
|
|
5929
|
+
return ta.isBrowserSupported() || ea.isBrowserSupported();
|
|
5810
5930
|
}
|
|
5811
5931
|
_onCongestionCallback(e, t, n) {
|
|
5812
5932
|
this._encoder.setBitrate(e, t, n);
|
|
@@ -5819,8 +5939,8 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5819
5939
|
(e === void 0 || e < 640) && (e = 640), (t === void 0 || t < 360) && (t = 360);
|
|
5820
5940
|
let n = e * t / 256;
|
|
5821
5941
|
return {
|
|
5822
|
-
minBitrate: Math.max(
|
|
5823
|
-
maxBitrate: Math.round(n *
|
|
5942
|
+
minBitrate: Math.max(ya, Math.min(va, Math.round(n * ga))),
|
|
5943
|
+
maxBitrate: Math.round(n * _a)
|
|
5824
5944
|
};
|
|
5825
5945
|
}
|
|
5826
5946
|
_checkCcFeedback(e) {
|
|
@@ -5834,14 +5954,14 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5834
5954
|
}
|
|
5835
5955
|
_sendSharingStat() {
|
|
5836
5956
|
let e = Date.now();
|
|
5837
|
-
if (e - this._lastSharingStat >
|
|
5957
|
+
if (e - this._lastSharingStat > ba) {
|
|
5838
5958
|
let t = this._congestionControl.getStat();
|
|
5839
5959
|
t !== null && (this._debug.debug(`cc: send stats: ${JSON.stringify(t)}`), this._signaling.reportSharingStat(t).catch((e) => {
|
|
5840
5960
|
!(e instanceof En) && !(e instanceof Dn) && this._debug.warn("Unable to send sharing stats", e);
|
|
5841
5961
|
})), this._lastSharingStat = e;
|
|
5842
5962
|
}
|
|
5843
5963
|
}
|
|
5844
|
-
},
|
|
5964
|
+
}, Ta = class {
|
|
5845
5965
|
constructor(e, t, n, r = z, i = null) {
|
|
5846
5966
|
h(this, "_pc", null), h(this, "_transceiver", null), h(this, "_currentSimulcastInfo", null), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_getCameraSettings", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), this._signaling = e, this._mediaSource = t, this._getCameraSettings = n, this._debug = r, this._logger = i;
|
|
5847
5967
|
}
|
|
@@ -5973,9 +6093,9 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
5973
6093
|
if (!(e instanceof Dn)) throw e;
|
|
5974
6094
|
}
|
|
5975
6095
|
}
|
|
5976
|
-
},
|
|
6096
|
+
}, Ea = 90, Da = 4294967295, Oa = class e extends Qr {
|
|
5977
6097
|
constructor(e, t, n, r = z, i = null, a = null, o = null, s = null) {
|
|
5978
|
-
super(e, t, s), h(this, "_producerNotification", null), h(this, "_producerCommand", null), h(this, "_producerScreen", null), h(this, "_consumerScreen", null), h(this, "_asr", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_isOpen", !1), h(this, "_observer", !1), h(this, "_reconnectionPrevented", !1), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_monitorRtpShareInterval", null), h(this, "_statBytes", {}), h(this, "_ssrcMap", {}), h(this, "_ssrcMapUpdated", !1), h(this, "_perfStatReporter", void 0), h(this, "_producerOfferIsProcessing", !1), h(this, "_producerNextOffer", null), h(this, "_producerNextSessionId", null), h(this, "_lastStat", null), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_prevConsumerFastSharingSettings", {}), h(this, "_asrTrack", null), h(this, "_captureSender", null), h(this, "_captureReceiver", null), h(this, "_participantIdRegistry", null), h(this, "_disabledSenders", /* @__PURE__ */ new Set()), h(this, "_rtpReceiversByStreamId", {}), h(this, "_producerSessionId", ""), h(this, "_newAudioShareTrack", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_sdpStats", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_simulcast", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._sdpStats = new Lr(a), this._codecStatsAggregator = o, this._serverSettings = n, this._simulcast = new
|
|
6098
|
+
super(e, t, s), h(this, "_producerNotification", null), h(this, "_producerCommand", null), h(this, "_producerScreen", null), h(this, "_consumerScreen", null), h(this, "_asr", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_isOpen", !1), h(this, "_observer", !1), h(this, "_reconnectionPrevented", !1), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_monitorRtpShareInterval", null), h(this, "_statBytes", {}), h(this, "_ssrcMap", {}), h(this, "_ssrcMapUpdated", !1), h(this, "_perfStatReporter", void 0), h(this, "_producerOfferIsProcessing", !1), h(this, "_producerNextOffer", null), h(this, "_producerNextSessionId", null), h(this, "_lastStat", null), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_prevConsumerFastSharingSettings", {}), h(this, "_asrTrack", null), h(this, "_captureSender", null), h(this, "_captureReceiver", null), h(this, "_participantIdRegistry", null), h(this, "_disabledSenders", /* @__PURE__ */ new Set()), h(this, "_rtpReceiversByStreamId", {}), h(this, "_producerSessionId", ""), h(this, "_newAudioShareTrack", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_simulcast", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._sdpStats = new Lr(a), this._peerConnectionStats = new Gr(a), this._codecStatsAggregator = o, this._serverSettings = n, this._simulcast = new Ta(e, t, () => this._serverSettings.camera, r, i), this.subscribe(this._signaling, xr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, qt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, qt.SOURCE_CHANGED, this._onSourcesChanged.bind(this)), this.subscribe(this._mediaSource, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._createPerfStatsReporter(), this._debug.debug("ServerTransport: Created");
|
|
5979
6099
|
}
|
|
5980
6100
|
updateStatisticsInterval() {
|
|
5981
6101
|
this._stopStatInterval();
|
|
@@ -6014,10 +6134,10 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6014
6134
|
await this._simulcast.sync();
|
|
6015
6135
|
}
|
|
6016
6136
|
_createPerfStatsReporter() {
|
|
6017
|
-
this._perfStatReporter?.destroy(), this._perfStatReporter = new
|
|
6137
|
+
this._perfStatReporter?.destroy(), this._perfStatReporter = new Na(this, this._signaling, this._statAggregator, !1, this._debug);
|
|
6018
6138
|
}
|
|
6019
6139
|
_closeConnection() {
|
|
6020
|
-
this._signaling.resetProducerConnection(), this._ssrcMap = {}, this._ssrcMapUpdated = !0, this._disposeFirstMediaSentProbe(), this._stopStatInterval(), this._stopSettingsInterval(), this._stopMonitorRtpShareInterval(), this._removeAsrTrack(), this._removeCaptureSender(), this._removeCaptureReceiver(), this._simulcast.reset(), this._pc && (this._rtpReceiversByStreamId = {}, this._disabledSenders.forEach((e) => e.track?.stop()), this._disabledSenders.clear(), this._pc.ontrack = null, this._pc.onconnectionstatechange = null, this._pc.onsignalingstatechange = null, this._sdpStats.stop(), this._participantIdRegistry = null, e._closeDataChannel(this._producerNotification), e._closeDataChannel(this._producerCommand), e._closeDataChannel(this._producerScreen), e._closeDataChannel(this._consumerScreen), e._closeDataChannel(this._asr), e._closeDataChannel(this._animojiDataChannel), this._pc.close(), this._pc = null, this._producerOfferIsProcessing = !1, this._producerNextOffer = null), this._triggerEvent(Y.PEER_CONNECTION_CLOSED);
|
|
6140
|
+
this._signaling.resetProducerConnection(), this._ssrcMap = {}, this._ssrcMapUpdated = !0, this._disposeFirstMediaSentProbe(), this._stopStatInterval(), this._stopSettingsInterval(), this._stopMonitorRtpShareInterval(), this._removeAsrTrack(), this._removeCaptureSender(), this._removeCaptureReceiver(), this._simulcast.reset(), this._pc && (this._rtpReceiversByStreamId = {}, this._disabledSenders.forEach((e) => e.track?.stop()), this._disabledSenders.clear(), this._pc.ontrack = null, this._pc.onconnectionstatechange = null, this._pc.onsignalingstatechange = null, this._sdpStats.stop(), this._peerConnectionStats.stop(), this._participantIdRegistry = null, e._closeDataChannel(this._producerNotification), e._closeDataChannel(this._producerCommand), e._closeDataChannel(this._producerScreen), e._closeDataChannel(this._consumerScreen), e._closeDataChannel(this._asr), e._closeDataChannel(this._animojiDataChannel), this._pc.close(), this._pc = null, this._producerOfferIsProcessing = !1, this._producerNextOffer = null), this._triggerEvent(Y.PEER_CONNECTION_CLOSED);
|
|
6021
6141
|
}
|
|
6022
6142
|
static _closeDataChannel(e) {
|
|
6023
6143
|
e && (e.onopen = null, e.onmessage = null, e.onerror = null, e.close());
|
|
@@ -6043,14 +6163,14 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6043
6163
|
}
|
|
6044
6164
|
this._pc.ontrack = this._onAddTrack.bind(this, this._pc), this._pc.onconnectionstatechange = M.debounce((e) => {
|
|
6045
6165
|
this._pc && this._onConnectionStateChange(this._pc, e);
|
|
6046
|
-
}, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._sdpStats.observe(this._pc), this._participantIdRegistry = new
|
|
6166
|
+
}, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._sdpStats.observe(this._pc), this._peerConnectionStats.observe(this._pc), this._participantIdRegistry = new _i(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, Tr.producerNotification, (e) => {
|
|
6047
6167
|
this._producerNotification = e, this._producerNotification.binaryType = "arraybuffer", this._signaling.setProducerNotificationDataChannel(e);
|
|
6048
6168
|
}), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc, Tr.producerCommand, (e) => {
|
|
6049
6169
|
this._producerCommand = e, this._signaling.setProducerCommandDataChannel(e);
|
|
6050
6170
|
}), this._createDataChannel(this._pc, Tr.producerScreenShare, (e) => {
|
|
6051
6171
|
this._producerScreen = e, this._producerScreen.binaryType = "arraybuffer", this._createCaptureReceiver();
|
|
6052
6172
|
}), N.asrDataChannel && this._createDataChannel(this._pc, Tr.asr, (e) => {
|
|
6053
|
-
this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new
|
|
6173
|
+
this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new mi(e, this._participantIdRegistry, (e) => {
|
|
6054
6174
|
this._onAsrTranscription(e);
|
|
6055
6175
|
}, this._debug);
|
|
6056
6176
|
}), N.vmoji && this._createDataChannel(this._pc, Tr.animoji, (e) => {
|
|
@@ -6071,8 +6191,8 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6071
6191
|
_removeAsrTrack() {
|
|
6072
6192
|
this._asrTrack?.destroy(), this._asrTrack = null;
|
|
6073
6193
|
}
|
|
6074
|
-
_reconnect() {
|
|
6075
|
-
this.getState() !== q.OPENED && (this._setState(q.RECONNECTING), this._closeConnection(), this._openConnection(!0));
|
|
6194
|
+
_reconnect(e = !1) {
|
|
6195
|
+
this.getState() !== q.OPENED && (e && this._peerConnectionStats.logIceRestart(), this._setState(q.RECONNECTING), this._closeConnection(), this._openConnection(!0));
|
|
6076
6196
|
}
|
|
6077
6197
|
_signalActiveParticipants(e) {
|
|
6078
6198
|
this._triggerEvent(Y.SIGNALLED_ACTIVE_PARTICIPANTS, e);
|
|
@@ -6088,19 +6208,19 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6088
6208
|
}
|
|
6089
6209
|
_updateSSRCMap(e) {
|
|
6090
6210
|
e && (this._ssrcMap = {}, this._ssrcMapUpdated = !0, dn(e.sdp).forEach((e) => {
|
|
6091
|
-
let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${
|
|
6211
|
+
let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${fi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${fi.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
|
|
6092
6212
|
n && (this._ssrcMap[n[1]] = n[3]);
|
|
6093
6213
|
}));
|
|
6094
6214
|
}
|
|
6095
6215
|
_createCaptureSender(e) {
|
|
6096
6216
|
let t = this._mediaSource.mediaSettings;
|
|
6097
|
-
!e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new
|
|
6217
|
+
!e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new wa(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
|
|
6098
6218
|
}
|
|
6099
6219
|
_removeCaptureSender() {
|
|
6100
6220
|
this._captureSender?.destroy(), this._captureSender = null;
|
|
6101
6221
|
}
|
|
6102
6222
|
_createCaptureReceiver() {
|
|
6103
|
-
this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new
|
|
6223
|
+
this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new Xi(this._producerScreen, this._participantIdRegistry, (e, t) => {
|
|
6104
6224
|
this._triggerEvent(Y.REMOTE_STREAM_SECOND, e, t);
|
|
6105
6225
|
}, (e) => {
|
|
6106
6226
|
this._triggerEvent(Y.REMOTE_STREAM_SECOND, e, null);
|
|
@@ -6210,7 +6330,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6210
6330
|
_detectStaleTracks(e) {
|
|
6211
6331
|
let t = e.rtps.find((e) => e.type === "inbound-rtp" && e.kind === "audio" && this._ssrcMap[e.ssrc] === "mix");
|
|
6212
6332
|
if (!t) return;
|
|
6213
|
-
let n =
|
|
6333
|
+
let n = fi.AUDIO_MIX, r = this._statBytes[n], i = !1;
|
|
6214
6334
|
if (r) {
|
|
6215
6335
|
let e = t.bytesReceived - r.bytesReceived;
|
|
6216
6336
|
e >= 0 && e <= 5 && (i = !0), r.stalled !== i && this._triggerEvent(Y.AUDIO_MIX_STALL, i);
|
|
@@ -6222,7 +6342,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6222
6342
|
}
|
|
6223
6343
|
_allocateConsumer() {
|
|
6224
6344
|
if (!this._signaling.ready) return;
|
|
6225
|
-
let e =
|
|
6345
|
+
let e = za.get();
|
|
6226
6346
|
!N.videoTracksCount && !this._observer && this._debug.warn("Setting videoTracksCount to 0 is deprecated"), this._signaling.allocateConsumer(null, e).catch((e) => {
|
|
6227
6347
|
e instanceof En || this._debug.warn("ServerTransport: Unable to allocate consumer", e);
|
|
6228
6348
|
});
|
|
@@ -6355,7 +6475,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6355
6475
|
_onConnectionStateChange(e, t) {
|
|
6356
6476
|
switch (this._debug.debug("[single] connection state changed", { state: e.connectionState }, t), this._logger?.log(C.ICE_CONNECTION_STATE, e.connectionState), e.connectionState) {
|
|
6357
6477
|
case "failed":
|
|
6358
|
-
this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error("Ice connection failed")) : this._reconnect();
|
|
6478
|
+
this._reconnectionPrevented ? this.close(/* @__PURE__ */ Error("Ice connection failed")) : this._reconnect(!0);
|
|
6359
6479
|
break;
|
|
6360
6480
|
case "connecting":
|
|
6361
6481
|
let t = this.getState();
|
|
@@ -6398,11 +6518,11 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6398
6518
|
if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
|
|
6399
6519
|
let i = r[0].rtpTimestamp;
|
|
6400
6520
|
if (!Number.isInteger(i)) return this._logger?.log(C.PAT_WAITING_TIME_ERROR, "timestampNotInteger"), this._debug.error(`Cannot get stream waiting time, ${e} receiver's RTP timestamp is not an integer: ${i}`), 0;
|
|
6401
|
-
let a = t - i &
|
|
6521
|
+
let a = t - i & Da, o = Math.ceil(a / Ea);
|
|
6402
6522
|
return Math.min(100, Math.max(0, o));
|
|
6403
6523
|
}
|
|
6404
6524
|
async _monitorRtpShare() {
|
|
6405
|
-
let e =
|
|
6525
|
+
let e = gi.getInstance().value;
|
|
6406
6526
|
if (!this._mediaSource.mediaSettings.isFastScreenSharingEnabled || !N.consumerFastScreenShare || e < .6) return;
|
|
6407
6527
|
let t = this._pc?.getSenders().find((e) => e.track?.kind === A.video && e.track?.contentHint === "motion");
|
|
6408
6528
|
t && (await t.getStats()).forEach((e) => {
|
|
@@ -6433,7 +6553,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6433
6553
|
}
|
|
6434
6554
|
}, Y = /* @__PURE__ */ function(e) {
|
|
6435
6555
|
return e.REMOTE_TRACK_ADDED = "REMOTE_TRACK_ADDED", e.REMOTE_TRACK_REMOVED = "REMOTE_TRACK_REMOVED", e.REMOTE_STREAM_SECOND = "REMOTE_STREAM_SECOND", e.AUDIO_MIX_STALL = "AUDIO_MIX_STALL", e.REMOTE_DATA_STATS = "REMOTE_DATA_STATS", e.STATE_CHANGED = "STATE_CHANGED", e.LOCAL_STATE_CHANGED = "LOCAL_STATE_CHANGED", e.SIGNALLED_ACTIVE_PARTICIPANTS = "SIGNALLED_ACTIVE_PARTICIPANTS", e.SIGNALLED_SPEAKER_CHANGED = "SIGNALLED_SPEAKER_CHANGED", e.SIGNALLED_STALLED_PARTICIPANTS = "SIGNALLED_STALLED_PARTICIPANTS", e.TOPOLOGY_CHANGED = "TOPOLOGY_CHANGED", e.NETWORK_STATUS = "NETWORK_STATUS", e.PEER_CONNECTION_CLOSED = "PEER_CONNECTION_CLOSED", e.ASR_TRANSCRIPTION = "ASR_TRANSCRIPTION", e.ANIMOJI_STREAM = "ANIMOJI_STREAM", e.ANIMOJI_ERROR = "ANIMOJI_ERROR", e.SCREEN_SHARING_STAT = "SCREEN_SHARING_STAT", e;
|
|
6436
|
-
}({}),
|
|
6556
|
+
}({}), ka = class extends b {
|
|
6437
6557
|
constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null) {
|
|
6438
6558
|
super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_topology", void 0), h(this, "_allocated", []), h(this, "_opened", []), h(this, "_directTransport", null), h(this, "_serverTransport", null), h(this, "_serverSettings", void 0), h(this, "_dtListeners", []), h(this, "_stListeners", []), h(this, "_states", {}), h(this, "_localState", q.IDLE), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbeStopped", !1), h(this, "_vadController", null), h(this, "_updateVadTrack", () => {
|
|
6439
6559
|
this._vadController?.setSendTrack(this._mediaSource.getSendAudioTrack());
|
|
@@ -6554,11 +6674,11 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6554
6674
|
}
|
|
6555
6675
|
}
|
|
6556
6676
|
_createDirectTransport(e, t = !1) {
|
|
6557
|
-
let n = new
|
|
6677
|
+
let n = new di(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
|
|
6558
6678
|
return this._dtListeners.length > 0 && this._debug.warn(`The list of direct listeners for the participant [${e}] is not empty`), this._dtListeners = [], this._dtListeners.push(n.addEventListener("REMOTE_TRACK_ADDED", this._onRemoteTrackAdded.bind(this, e)), n.addEventListener("REMOTE_TRACK_REMOVED", this._onRemoteTrackRemoved.bind(this, e)), n.addEventListener("REMOTE_DATA_STATS", this._onRemoteDataStats.bind(this)), n.addEventListener("STATE_CHANGED", this._onDirectTransportChanged.bind(this)), n.addEventListener("NETWORK_STATUS", this._onTransportNetworkStatus.bind(this)), n.addEventListener("PEER_CONNECTION_CLOSED", this._onPeerConnectionClosed.bind(this, J.DIRECT))), this._animojiReceiver && this._animojiSender && n.setAnimojiTransport(this._animojiReceiver, this._animojiSender), n;
|
|
6559
6679
|
}
|
|
6560
6680
|
_createServerTransport() {
|
|
6561
|
-
let e = new
|
|
6681
|
+
let e = new Oa(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
|
|
6562
6682
|
return this._stListeners.length > 0 && this._debug.warn("The list of server transport listeners is not empty"), this._stListeners = [], this._stListeners.push(e.addEventListener("REMOTE_TRACK_ADDED", this._onRemoteTrackAdded.bind(this)), e.addEventListener("REMOTE_TRACK_REMOVED", this._onRemoteTrackRemoved.bind(this)), e.addEventListener("AUDIO_MIX_STALL", this._onServerAudioMixStall.bind(this)), e.addEventListener("REMOTE_DATA_STATS", this._onRemoteDataStats.bind(this)), e.addEventListener("STATE_CHANGED", this._onServerTransportChanged.bind(this)), e.addEventListener("SIGNALLED_ACTIVE_PARTICIPANTS", this._onTransportActiveParticipants.bind(this)), e.addEventListener("SIGNALLED_SPEAKER_CHANGED", this._onTransportSpeakerChanged.bind(this)), e.addEventListener("SIGNALLED_STALLED_PARTICIPANTS", this._onTransportStalledParticipants.bind(this)), e.addEventListener("NETWORK_STATUS", this._onTransportNetworkStatus.bind(this)), e.addEventListener("REMOTE_STREAM_SECOND", this._onRemoteStreamSecond.bind(this)), e.addEventListener("PEER_CONNECTION_CLOSED", this._onPeerConnectionClosed.bind(this, J.SERVER)), e.addEventListener("ASR_TRANSCRIPTION", this._onAsrTranscription.bind(this))), this._animojiReceiver && this._animojiSender && e.setAnimojiTransport(this._animojiReceiver, this._animojiSender), e;
|
|
6563
6683
|
}
|
|
6564
6684
|
_releaseDirectTransport() {
|
|
@@ -6650,20 +6770,20 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6650
6770
|
getStreamWaitingTimeMs(e, t) {
|
|
6651
6771
|
return this._topology === J.SERVER ? this._serverTransport ? this._serverTransport.getStreamWaitingTimeMs(e, t) : (this._logger?.log(C.PAT_WAITING_TIME_ERROR, "noTransport"), this._debug.error("Cannot get stream waiting time, server transport is not initialized"), 0) : (this._logger?.log(C.PAT_WAITING_TIME_ERROR, "wrongTopology"), this._debug.error(`Cannot get stream waiting time, incorrect topology: ${this._topology}`), 0);
|
|
6652
6772
|
}
|
|
6653
|
-
},
|
|
6773
|
+
}, Aa = "videochat-epi", ja = 5e3, Ma = 500, Na = class extends b {
|
|
6654
6774
|
constructor(e, t, n = null, r = !1, i = z) {
|
|
6655
|
-
super(), h(this, "_previousPerfStatReportTimestamp", 0), h(this, "_previousNetworkStatReportTimestamp", Date.now()), h(this, "_previousCallStatReportTimestamp", Date.now()), h(this, "_previousCallStatReport", null), h(this, "_previousRemoteInboundRtps", /* @__PURE__ */ new Map()), h(this, "_screenShareStats", []), h(this, "_signaling", void 0), h(this, "_directTopology", void 0), h(this, "_debug", void 0), h(this, "_statAggregator", void 0), h(this, "_handleScreenSharingStat", (e) => {
|
|
6775
|
+
super(), h(this, "_previousPerfStatReportTimestamp", 0), h(this, "_previousNetworkStatReportTimestamp", Date.now()), h(this, "_previousCallStatReportTimestamp", Date.now()), h(this, "_previousCallStatReport", null), h(this, "_previousRemoteInboundRtps", /* @__PURE__ */ new Map()), h(this, "_previousCandidatePair", null), h(this, "_screenShareStats", []), h(this, "_signaling", void 0), h(this, "_directTopology", void 0), h(this, "_debug", void 0), h(this, "_statAggregator", void 0), h(this, "_handleScreenSharingStat", (e) => {
|
|
6656
6776
|
this._screenShareStats.push(e);
|
|
6657
6777
|
}), h(this, "_handleTransportStateChanged", (e) => {
|
|
6658
6778
|
(this._directTopology && e === q.CONNECTED || !this._directTopology && e === q.OPENED) && (this._previousNetworkStatReportTimestamp = Date.now(), this._previousCallStatReportTimestamp = Date.now(), this._previousRemoteInboundRtps.clear());
|
|
6659
6779
|
}), this._signaling = t, this._directTopology = r, this._debug = i, this._statAggregator = n, this.subscribe(e, Y.REMOTE_DATA_STATS, this._handleStats.bind(this)), this.subscribe(e, Y.SCREEN_SHARING_STAT, this._handleScreenSharingStat.bind(this)), this.subscribe(e, Y.STATE_CHANGED, this._handleTransportStateChanged.bind(this));
|
|
6660
6780
|
}
|
|
6661
6781
|
destroy() {
|
|
6662
|
-
this._previousRemoteInboundRtps.clear(), this.unsubscribe();
|
|
6782
|
+
this._previousRemoteInboundRtps.clear(), this._previousCandidatePair = null, this.unsubscribe();
|
|
6663
6783
|
}
|
|
6664
6784
|
static getEstimatedPerformanceIndex() {
|
|
6665
6785
|
try {
|
|
6666
|
-
let e = parseInt(localStorage.getItem(
|
|
6786
|
+
let e = parseInt(localStorage.getItem(Aa) || "", 10);
|
|
6667
6787
|
return isNaN(e) ? 0 : e;
|
|
6668
6788
|
} catch {
|
|
6669
6789
|
return 0;
|
|
@@ -6672,9 +6792,9 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6672
6792
|
async _handleStats(e) {
|
|
6673
6793
|
if (!e.inbound || !e.inbound.rtps) return;
|
|
6674
6794
|
let t = Date.now();
|
|
6675
|
-
!this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp +
|
|
6795
|
+
!this._directTopology && N.perfStatReportEnabled && this._previousPerfStatReportTimestamp + ja <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
|
|
6676
6796
|
let n = e.outbound.transport.local?.protocol === "tcp";
|
|
6677
|
-
!this._directTopology && n && this._previousNetworkStatReportTimestamp +
|
|
6797
|
+
!this._directTopology && n && this._previousNetworkStatReportTimestamp + Ma <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t), this._reportCandidatePair(e.inbound.transport.local, e.inbound.transport.remote), N.callStatReportEnabled && this._previousCallStatReportTimestamp + N.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t);
|
|
6678
6798
|
}
|
|
6679
6799
|
async reportPerfStats(e) {
|
|
6680
6800
|
let t = e.inbound.rtps.reduce((e, t) => (t.kind === "video" && (e.framesDecoded += t.framesDecoded || 0, e.framesReceived += t.framesReceived || 0), e), {
|
|
@@ -6683,7 +6803,7 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6683
6803
|
});
|
|
6684
6804
|
if (t.framesDecoded) try {
|
|
6685
6805
|
let e = await this._signaling.reportPerfStat(t);
|
|
6686
|
-
localStorage.setItem(
|
|
6806
|
+
localStorage.setItem(Aa, e.estimatedPerformanceIndex);
|
|
6687
6807
|
} catch {}
|
|
6688
6808
|
}
|
|
6689
6809
|
async reportNetworkStats(e) {
|
|
@@ -6723,11 +6843,11 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6723
6843
|
rtt: Math.round(e.inbound.transport.currentRoundTripTime * 1e3),
|
|
6724
6844
|
ss_freeze_count: 0,
|
|
6725
6845
|
ss_total_freezes_duration: 0,
|
|
6726
|
-
local_address:
|
|
6846
|
+
local_address: Fa(e.inbound.transport.local),
|
|
6727
6847
|
local_connection_type: e.inbound.transport.local?.type,
|
|
6728
6848
|
network_type: e.inbound.transport.local?.networkType,
|
|
6729
6849
|
transport: e.inbound.transport.local?.protocol,
|
|
6730
|
-
remote_address:
|
|
6850
|
+
remote_address: Fa(e.inbound.transport.remote),
|
|
6731
6851
|
remote_connection_type: e.inbound.transport.remote?.type
|
|
6732
6852
|
};
|
|
6733
6853
|
this._previousCallStatReport || (this._previousCallStatReport = Object.assign({}, t));
|
|
@@ -6748,14 +6868,28 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6748
6868
|
frames_dropped: Math.max(0, t.frames_dropped - this._previousCallStatReport.frames_dropped),
|
|
6749
6869
|
rtt: Math.max(0, t.rtt)
|
|
6750
6870
|
};
|
|
6751
|
-
if (N.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !
|
|
6871
|
+
if (N.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !Ia(t.jitter_video) && (i.jitter_video = Math.round(t.jitter_video)), r && !Ia(t.jitter_audio) && (i.jitter_audio = Math.round(t.jitter_audio)), n && !Ia(t.interframe_delay_variance) && (i.interframe_delay_variance = t.interframe_delay_variance), t.freeze_count && t.total_freezes_duration && (i.freeze_count = t.freeze_count, i.total_freezes_duration = Math.round(t.total_freezes_duration * 1e3)), t.ss_freeze_count && t.ss_total_freezes_duration && (i.ss_freeze_count = t.ss_freeze_count, i.ss_total_freezes_duration = t.ss_total_freezes_duration), r && !Ia(t.total_audio_samples_received)) {
|
|
6752
6872
|
let e = Math.max(0, t.total_audio_samples_received - this._previousCallStatReport.total_audio_samples_received), n = Math.max(0, t.inserted_audio_samples_for_deceleration - this._previousCallStatReport.inserted_audio_samples_for_deceleration), r = Math.max(0, t.removed_audio_samples_for_acceleration - this._previousCallStatReport.removed_audio_samples_for_acceleration), a = Math.max(0, t.concealed_audio_samples - this._previousCallStatReport.concealed_audio_samples), o = Math.max(0, t.silent_concealed_audio_samples - this._previousCallStatReport.silent_concealed_audio_samples), s = Math.max(0, t.audio_concealment_events - this._previousCallStatReport.audio_concealment_events);
|
|
6753
|
-
i.inserted_audio_samples_for_deceleration =
|
|
6873
|
+
i.inserted_audio_samples_for_deceleration = La(n / e * 1e3), i.removed_audio_samples_for_acceleration = La(r / e * 1e3), i.concealed_audio_samples = La(a / e * 1e3), i.concealed_silent_audio_samples = La(o / e * 1e3), i.concealment_audio_avg_size = La(a / s), i.total_audio_energy = t.total_audio_energy;
|
|
6754
6874
|
}
|
|
6755
|
-
|
|
6875
|
+
Pa(t, "local_address", "local_connection_type", "network_type", "transport") && (i.local_address = t.local_address, i.local_connection_type = t.local_connection_type, i.network_type = t.network_type, i.transport = t.transport), Pa(t, "remote_address", "remote_connection_type") && (i.remote_address = t.remote_address, i.remote_connection_type = t.remote_connection_type);
|
|
6756
6876
|
let a = this._calculatePacketLoss(e.remoteInbound.rtps);
|
|
6757
6877
|
a.video !== void 0 && (i.video_loss = a.video), a.audio !== void 0 && (i.audio_loss = a.audio), this._statAggregator?.logCallStat(i), N.enableLogPerfStatReport && this._debug.log("Sent call stats", i), this._previousCallStatReport = t;
|
|
6758
6878
|
}
|
|
6879
|
+
_reportCandidatePair(e, t) {
|
|
6880
|
+
if (!e?.address || !t?.address) return;
|
|
6881
|
+
let n = JSON.stringify({
|
|
6882
|
+
local: e,
|
|
6883
|
+
remote: t
|
|
6884
|
+
});
|
|
6885
|
+
n !== this._previousCandidatePair && (this._previousCandidatePair = n, this._statAggregator?.logEventualStat({
|
|
6886
|
+
name: U.ICE_CANDIDATES_CHANGED,
|
|
6887
|
+
string_value: n,
|
|
6888
|
+
local_address: Fa(e),
|
|
6889
|
+
remote_address: Fa(t),
|
|
6890
|
+
transport: e.protocol
|
|
6891
|
+
}));
|
|
6892
|
+
}
|
|
6759
6893
|
_calculatePacketLoss(e) {
|
|
6760
6894
|
let t = /* @__PURE__ */ new Map(), n = {
|
|
6761
6895
|
audio: {
|
|
@@ -6784,26 +6918,26 @@ var Ri = 2 ** 15 - 1, zi = 1, Bi = 5, Vi = 5, Hi = class e {
|
|
|
6784
6918
|
return r;
|
|
6785
6919
|
}
|
|
6786
6920
|
};
|
|
6787
|
-
function
|
|
6921
|
+
function Pa(e, ...t) {
|
|
6788
6922
|
for (let n of t) if (!Object.hasOwn(e, n) || e[n] === void 0) return !1;
|
|
6789
6923
|
return !0;
|
|
6790
6924
|
}
|
|
6791
|
-
function
|
|
6925
|
+
function Fa(e, t = !1) {
|
|
6792
6926
|
if (e?.address) return e.address + (t ? `:${e.port}` : "");
|
|
6793
6927
|
}
|
|
6794
|
-
function
|
|
6928
|
+
function Ia(e) {
|
|
6795
6929
|
return e === void 0;
|
|
6796
6930
|
}
|
|
6797
|
-
function
|
|
6931
|
+
function La(e) {
|
|
6798
6932
|
return Number.isNaN(e) ? 0 : e;
|
|
6799
6933
|
}
|
|
6800
6934
|
//#endregion
|
|
6801
6935
|
//#region src/static/Capabilities.ts
|
|
6802
|
-
var
|
|
6936
|
+
var Ra;
|
|
6803
6937
|
(function(e) {
|
|
6804
6938
|
function t() {
|
|
6805
6939
|
return {
|
|
6806
|
-
estimatedPerformanceIndex:
|
|
6940
|
+
estimatedPerformanceIndex: Na.getEstimatedPerformanceIndex(),
|
|
6807
6941
|
audioMix: !0,
|
|
6808
6942
|
consumerUpdate: !0,
|
|
6809
6943
|
producerNotificationDataChannelVersion: 8,
|
|
@@ -6829,8 +6963,8 @@ var Ma;
|
|
|
6829
6963
|
};
|
|
6830
6964
|
}
|
|
6831
6965
|
e.get = t;
|
|
6832
|
-
})(
|
|
6833
|
-
var
|
|
6966
|
+
})(Ra || (Ra = {}));
|
|
6967
|
+
var za = Ra, Ba = {
|
|
6834
6968
|
producerScreenTrack: () => !0,
|
|
6835
6969
|
videoTracksCount: () => N.videoTracksCount > 0,
|
|
6836
6970
|
waitingHall: () => !0,
|
|
@@ -6850,28 +6984,28 @@ var Na = Ma, Pa = {
|
|
|
6850
6984
|
p2pRelay: () => !1,
|
|
6851
6985
|
waitForAdmin: () => N.waitForAdminInGroupCalls,
|
|
6852
6986
|
hold: () => N.hold
|
|
6853
|
-
},
|
|
6987
|
+
}, Va = class {
|
|
6854
6988
|
static getFlags() {
|
|
6855
|
-
let e = Object.values(
|
|
6989
|
+
let e = Object.values(Ba), t = 0;
|
|
6856
6990
|
for (let n = 0; n < e.length; n++) e[n]() && (t |= 1 << n);
|
|
6857
6991
|
return t.toString(16).toUpperCase();
|
|
6858
6992
|
}
|
|
6859
6993
|
static parseCapabilities(e) {
|
|
6860
6994
|
let t = parseInt(e || "0", 16);
|
|
6861
|
-
return Object.keys(
|
|
6995
|
+
return Object.keys(Ba).reduce((e, n, r) => (e[n] = !!(t & 1 << r), e), {});
|
|
6862
6996
|
}
|
|
6863
|
-
},
|
|
6997
|
+
}, Ha = 63n, Ua = 16383n, Wa = 1073741823, Ga = 4611686018427387903n, Ka = class {
|
|
6864
6998
|
encode(e) {
|
|
6865
6999
|
let t = typeof e == "number" ? BigInt(e) : e;
|
|
6866
|
-
if (t <=
|
|
6867
|
-
if (t <=
|
|
6868
|
-
if (t <= BigInt(
|
|
7000
|
+
if (t <= Ha) return new Uint8Array([Number(t)]);
|
|
7001
|
+
if (t <= Ua) return new Uint8Array([64 | Number(t >> 8n), Number(t & 255n)]);
|
|
7002
|
+
if (t <= BigInt(Wa)) return new Uint8Array([
|
|
6869
7003
|
128 | Number(t >> 24n),
|
|
6870
7004
|
Number(t >> 16n & 255n),
|
|
6871
7005
|
Number(t >> 8n & 255n),
|
|
6872
7006
|
Number(t & 255n)
|
|
6873
7007
|
]);
|
|
6874
|
-
if (t <=
|
|
7008
|
+
if (t <= Ga) return new Uint8Array([
|
|
6875
7009
|
192 | Number(t >> 56n),
|
|
6876
7010
|
Number(t >> 48n & 255n),
|
|
6877
7011
|
Number(t >> 40n & 255n),
|
|
@@ -6883,7 +7017,7 @@ var Na = Ma, Pa = {
|
|
|
6883
7017
|
]);
|
|
6884
7018
|
throw RangeError("Number is too large to encode using varint");
|
|
6885
7019
|
}
|
|
6886
|
-
},
|
|
7020
|
+
}, qa = class {
|
|
6887
7021
|
decode(e) {
|
|
6888
7022
|
let t = this.getNumBytesForLengthInteger(e);
|
|
6889
7023
|
if (t < 0) throw Error("Invalid length prefix");
|
|
@@ -6909,9 +7043,9 @@ var Na = Ma, Pa = {
|
|
|
6909
7043
|
let t = e[0] & 192;
|
|
6910
7044
|
return t === 0 ? 1 : t === 64 ? 2 : t === 128 ? 4 : t === 192 ? 8 : -1;
|
|
6911
7045
|
}
|
|
6912
|
-
},
|
|
7046
|
+
}, Ja = class {
|
|
6913
7047
|
constructor(e) {
|
|
6914
|
-
h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new
|
|
7048
|
+
h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new Ka(), this.compression = e ?? null;
|
|
6915
7049
|
}
|
|
6916
7050
|
encode(e) {
|
|
6917
7051
|
let t = this.encoder.encode(e);
|
|
@@ -6928,9 +7062,9 @@ var Na = Ma, Pa = {
|
|
|
6928
7062
|
default: return e;
|
|
6929
7063
|
}
|
|
6930
7064
|
}
|
|
6931
|
-
},
|
|
7065
|
+
}, Ya = class {
|
|
6932
7066
|
constructor(e) {
|
|
6933
|
-
h(this, "decoder", void 0), h(this, "compression", void 0), h(this, "lengthDecoder", void 0), h(this, "buffer", void 0), h(this, "expectedLength", void 0), h(this, "offset", void 0), h(this, "lengthPrefixLength", void 0), this.decoder = new TextDecoder(), this.lengthDecoder = new
|
|
7067
|
+
h(this, "decoder", void 0), h(this, "compression", void 0), h(this, "lengthDecoder", void 0), h(this, "buffer", void 0), h(this, "expectedLength", void 0), h(this, "offset", void 0), h(this, "lengthPrefixLength", void 0), this.decoder = new TextDecoder(), this.lengthDecoder = new qa(), this.compression = e ?? null, this.buffer = new Uint8Array(), this.expectedLength = null, this.offset = 0;
|
|
6934
7068
|
}
|
|
6935
7069
|
decode(e) {
|
|
6936
7070
|
let t = [];
|
|
@@ -6960,12 +7094,12 @@ var Na = Ma, Pa = {
|
|
|
6960
7094
|
default: return e;
|
|
6961
7095
|
}
|
|
6962
7096
|
}
|
|
6963
|
-
},
|
|
7097
|
+
}, Xa = class {
|
|
6964
7098
|
static isBrowserSupported() {
|
|
6965
7099
|
return !(!("WebTransport" in window && typeof WebTransport == "function") || E.browserName() === "Safari");
|
|
6966
7100
|
}
|
|
6967
7101
|
constructor(e, t = {}, n = z) {
|
|
6968
|
-
h(this, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), h(this, "webTransport", null), h(this, "writer", null), h(this, "url", void 0), h(this, "options", void 0), h(this, "compression", void 0), h(this, "encoder", void 0), h(this, "decoder", void 0), h(this, "_debug", void 0), this._debug = n, this.url = e, this.options = t, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new
|
|
7102
|
+
h(this, "onopen", null), h(this, "onmessage", null), h(this, "onerror", null), h(this, "onclose", null), h(this, "readyState", WebSocket.CONNECTING), h(this, "webTransport", null), h(this, "writer", null), h(this, "url", void 0), h(this, "options", void 0), h(this, "compression", void 0), h(this, "encoder", void 0), h(this, "decoder", void 0), h(this, "_debug", void 0), this._debug = n, this.url = e, this.options = t, this.compression = this.getCompressionTypeFromUrl(e), this.encoder = new Ja(this.compression), this.decoder = new Ya(this.compression), this.connect();
|
|
6969
7103
|
}
|
|
6970
7104
|
async send(e) {
|
|
6971
7105
|
if (this.readyState !== WebSocket.OPEN) {
|
|
@@ -7091,11 +7225,11 @@ var Na = Ma, Pa = {
|
|
|
7091
7225
|
compression: this.compression
|
|
7092
7226
|
}, n;
|
|
7093
7227
|
}
|
|
7094
|
-
},
|
|
7095
|
-
return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.ABORTED = "ABORTED", e;
|
|
7096
|
-
}({}),
|
|
7228
|
+
}, Za = /* @__PURE__ */ function(e) {
|
|
7229
|
+
return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.RECONNECT_TIMEOUT = "RECONNECT_TIMEOUT", e.ABORTED = "ABORTED", e;
|
|
7230
|
+
}({}), Qa = class {
|
|
7097
7231
|
constructor(e = z, t) {
|
|
7098
|
-
h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", Sr.WEBSOCKET), h(this, "_debug", void 0), this.handlers = t, this._debug = e;
|
|
7232
|
+
h(this, "handlers", void 0), h(this, "socket", null), h(this, "endpoint", ""), h(this, "wtEndpoint", null), h(this, "peerId", null), h(this, "lastStamp", 0), h(this, "connectionType", void 0), h(this, "reconnectCount", 0), h(this, "reconnectTimer", 0), h(this, "reconnectDeadlineTimer", 0), h(this, "doctorTimer", 0), h(this, "forceWebSocket", !1), h(this, "abortSignal", void 0), h(this, "manualClose", !1), h(this, "currentType", Sr.WEBSOCKET), h(this, "_debug", void 0), this.handlers = t, this._debug = e;
|
|
7099
7233
|
}
|
|
7100
7234
|
get readyState() {
|
|
7101
7235
|
return this.socket?.readyState ?? null;
|
|
@@ -7118,14 +7252,14 @@ var Na = Ma, Pa = {
|
|
|
7118
7252
|
setAbortSignal(e) {
|
|
7119
7253
|
this.abortSignal = e;
|
|
7120
7254
|
}
|
|
7121
|
-
|
|
7122
|
-
this.reconnectCount = 0;
|
|
7255
|
+
onConnectionRestored() {
|
|
7256
|
+
this.reconnectCount = 0, this._stopReconnectDeadline();
|
|
7123
7257
|
}
|
|
7124
7258
|
connect(e) {
|
|
7125
7259
|
this.socket && this.socket.readyState < WebSocket.CLOSING || (e !== br.RETRY && (this.forceWebSocket = !1, this.reconnectCount = 0), this.manualClose = !1, this.connectionType = e, this._connect());
|
|
7126
7260
|
}
|
|
7127
7261
|
close(e) {
|
|
7128
|
-
this.manualClose = !0, this._disconnect(e), window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this.lastStamp = 0;
|
|
7262
|
+
this.manualClose = !0, this._disconnect(e), window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this._stopReconnectDeadline(), this.lastStamp = 0;
|
|
7129
7263
|
}
|
|
7130
7264
|
async send(e) {
|
|
7131
7265
|
await this.socket?.send(e);
|
|
@@ -7143,7 +7277,7 @@ var Na = Ma, Pa = {
|
|
|
7143
7277
|
return;
|
|
7144
7278
|
}
|
|
7145
7279
|
let e = this._buildUrl(this.wtEndpoint, !0);
|
|
7146
|
-
this.currentType = Sr.WEBTRANSPORT, this.socket = new
|
|
7280
|
+
this.currentType = Sr.WEBTRANSPORT, this.socket = new Xa(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
|
|
7147
7281
|
}
|
|
7148
7282
|
_connectWebSocket() {
|
|
7149
7283
|
if (!this.endpoint) {
|
|
@@ -7166,10 +7300,10 @@ var Na = Ma, Pa = {
|
|
|
7166
7300
|
}
|
|
7167
7301
|
_buildUrl(e, t) {
|
|
7168
7302
|
let n = new URL(e), r = n.searchParams;
|
|
7169
|
-
return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities",
|
|
7303
|
+
return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", Va.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === br.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), N.useParticipantListChunk && (r.set("partIdx", String(N.participantListChunkInitIndex)), N.participantListChunkInitCount !== null && r.set("partCount", String(N.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
|
|
7170
7304
|
}
|
|
7171
7305
|
_canUseWebTransport() {
|
|
7172
|
-
return !this.forceWebSocket &&
|
|
7306
|
+
return !this.forceWebSocket && Xa.isBrowserSupported() && this.wtEndpoint !== null && N.webtransport;
|
|
7173
7307
|
}
|
|
7174
7308
|
_onOpen() {
|
|
7175
7309
|
this._startDoctor(), this.handlers.onOpen();
|
|
@@ -7198,20 +7332,32 @@ var Na = Ma, Pa = {
|
|
|
7198
7332
|
}
|
|
7199
7333
|
_scheduleReconnect(e = this._getReconnectDelay()) {
|
|
7200
7334
|
if (this.reconnectCount >= N.signalingReconnectMaxCount) {
|
|
7201
|
-
this.handlers.onFailed({
|
|
7335
|
+
this._stopReconnectDeadline(), this.handlers.onFailed({
|
|
7202
7336
|
failure: "NETWORK_ERROR",
|
|
7203
7337
|
message: "Unable to connect to the signaling: reconnect attempts exhausted",
|
|
7204
7338
|
source: this.currentType
|
|
7205
7339
|
});
|
|
7206
7340
|
return;
|
|
7207
7341
|
}
|
|
7208
|
-
this.reconnectCount++, this.handlers.onReconnectScheduled({
|
|
7342
|
+
this._startReconnectDeadline(), this.reconnectCount++, this.handlers.onReconnectScheduled({
|
|
7209
7343
|
count: this.reconnectCount,
|
|
7210
7344
|
delay: e
|
|
7211
7345
|
}), this.reconnectTimer = window.setTimeout(() => {
|
|
7212
7346
|
this.connectionType = br.RETRY, this._connect();
|
|
7213
7347
|
}, e);
|
|
7214
7348
|
}
|
|
7349
|
+
_startReconnectDeadline() {
|
|
7350
|
+
this.reconnectDeadlineTimer || (this.reconnectDeadlineTimer = window.setTimeout(() => {
|
|
7351
|
+
this.reconnectDeadlineTimer = 0, window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this._disconnect(4e3), this.handlers.onFailed({
|
|
7352
|
+
failure: "RECONNECT_TIMEOUT",
|
|
7353
|
+
message: "Unable to connect to the signaling: reconnect timeout",
|
|
7354
|
+
source: this.currentType
|
|
7355
|
+
});
|
|
7356
|
+
}, N.signalingReconnectMaxDuration));
|
|
7357
|
+
}
|
|
7358
|
+
_stopReconnectDeadline() {
|
|
7359
|
+
window.clearTimeout(this.reconnectDeadlineTimer), this.reconnectDeadlineTimer = 0;
|
|
7360
|
+
}
|
|
7215
7361
|
_getReconnectDelay() {
|
|
7216
7362
|
return Math.min(N.signalingReconnectMaxDelay, N.signalingReconnectDelay * 2 ** this.reconnectCount);
|
|
7217
7363
|
}
|
|
@@ -7223,31 +7369,31 @@ var Na = Ma, Pa = {
|
|
|
7223
7369
|
_stopDoctor() {
|
|
7224
7370
|
window.clearTimeout(this.doctorTimer), this.doctorTimer = 0;
|
|
7225
7371
|
}
|
|
7226
|
-
},
|
|
7372
|
+
}, $a = "open", eo = 300, to = 10, no = {
|
|
7227
7373
|
CONVERSATION_ENDED: "conversation-ended",
|
|
7228
7374
|
OBSOLETE_CLIENT: "gen.obsoleteClient",
|
|
7229
7375
|
INVALID_TOKEN: "invalid-token",
|
|
7230
7376
|
PARTICIPANT_NOT_FOUND: "participant-not-found",
|
|
7231
7377
|
ILLEGAL_PARTICIPANT_STATE: "illegal-participant-state",
|
|
7232
7378
|
SERVICE_UNAVAILABLE: "service-unavailable"
|
|
7233
|
-
},
|
|
7234
|
-
[
|
|
7235
|
-
[
|
|
7236
|
-
[
|
|
7237
|
-
[
|
|
7238
|
-
[
|
|
7239
|
-
[
|
|
7379
|
+
}, ro = {
|
|
7380
|
+
[no.CONVERSATION_ENDED]: "conversation-ended",
|
|
7381
|
+
[no.OBSOLETE_CLIENT]: "obsolete-client",
|
|
7382
|
+
[no.INVALID_TOKEN]: "invalid-token",
|
|
7383
|
+
[no.PARTICIPANT_NOT_FOUND]: "participant-not-found",
|
|
7384
|
+
[no.ILLEGAL_PARTICIPANT_STATE]: "illegal-participant-state",
|
|
7385
|
+
[no.SERVICE_UNAVAILABLE]: "service-unavailable"
|
|
7240
7386
|
};
|
|
7241
|
-
function
|
|
7387
|
+
function io(e, t) {
|
|
7242
7388
|
return e.errorMessage ?? e.message ?? e.error ?? t;
|
|
7243
7389
|
}
|
|
7244
|
-
var
|
|
7390
|
+
var ao = new Set([
|
|
7245
7391
|
O.CALLER_IS_BLOCKED,
|
|
7246
7392
|
O.ENDED,
|
|
7247
7393
|
O.NOT_FOUND,
|
|
7248
7394
|
O.PARTICIPANT_LIMIT_REACHED,
|
|
7249
7395
|
O.SERVICE_UNAVAILABLE
|
|
7250
|
-
]),
|
|
7396
|
+
]), oo = class e extends On {
|
|
7251
7397
|
static get WAIT_CONNECTION_DELAY() {
|
|
7252
7398
|
return N.waitConnectionDelay;
|
|
7253
7399
|
}
|
|
@@ -7258,7 +7404,7 @@ var $a = new Set([
|
|
|
7258
7404
|
return !this.disposed && this.transport.readyState !== null;
|
|
7259
7405
|
}
|
|
7260
7406
|
constructor(e = z, t = null, n = null, r = null, i = null) {
|
|
7261
|
-
super(), h(this, "transport", void 0), h(this, "sequence", 1), h(this, "lastStamp", 0), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "connected", !1), h(this, "listenersReady", !1), h(this, "peerId", null), h(this, "reconnectStartedAt", null), h(this, "connectionMessageWaitTimer", 0), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new tr(e), this.transport = new
|
|
7407
|
+
super(), h(this, "transport", void 0), h(this, "sequence", 1), h(this, "lastStamp", 0), h(this, "websocketCommandsQueue", []), h(this, "datachannelCommandsQueue", []), h(this, "incomingCache", []), h(this, "responseHandlers", {}), h(this, "disposed", !1), h(this, "connectionType", void 0), h(this, "conversationResolve", null), h(this, "conversationReject", null), h(this, "connected", !1), h(this, "listenersReady", !1), h(this, "peerId", null), h(this, "reconnectStartedAt", null), h(this, "connectionMessageWaitTimer", 0), h(this, "participantIdRegistry", null), h(this, "producerNotificationDataChannel", null), h(this, "producerCommandDataChannel", null), h(this, "producerCommandDataChannelEnabled", !1), h(this, "producerCommandSerializationService", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_statPings", void 0), h(this, "_statSignalingCommands", void 0), this._debug = e, this._logger = t, this._statAggregator = n, this._statPings = r, this._statSignalingCommands = i, this.producerCommandSerializationService = new tr(e), this.transport = new Qa(e, {
|
|
7262
7408
|
onConnecting: this._onTransportConnecting.bind(this),
|
|
7263
7409
|
onOpen: this._onOpen.bind(this),
|
|
7264
7410
|
onMessage: this._onMessage.bind(this),
|
|
@@ -7345,20 +7491,20 @@ var $a = new Set([
|
|
|
7345
7491
|
return this._send(V.TRANSMIT_DATA, {
|
|
7346
7492
|
participantId: e,
|
|
7347
7493
|
data: r
|
|
7348
|
-
}, !0,
|
|
7494
|
+
}, !0, to);
|
|
7349
7495
|
}
|
|
7350
7496
|
async acceptCall(e) {
|
|
7351
7497
|
return this._send(V.ACCEPT_CALL, { mediaSettings: e });
|
|
7352
7498
|
}
|
|
7353
7499
|
async changeMediaSettings(e) {
|
|
7354
|
-
return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0,
|
|
7500
|
+
return this._send(V.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, to);
|
|
7355
7501
|
}
|
|
7356
7502
|
async changeParticipantState(e, t) {
|
|
7357
7503
|
let n = { participantState: { state: e } };
|
|
7358
7504
|
return t && (n.participantId = t), this._sendRaw(V.CHANGE_PARTICIPANT_STATE, n);
|
|
7359
7505
|
}
|
|
7360
7506
|
async hold(e) {
|
|
7361
|
-
let t =
|
|
7507
|
+
let t = za.get();
|
|
7362
7508
|
return this._send(V.HOLD, {
|
|
7363
7509
|
hold: e,
|
|
7364
7510
|
capabilities: e ? void 0 : t
|
|
@@ -7590,7 +7736,7 @@ var $a = new Set([
|
|
|
7590
7736
|
if (this.disposed) throw new En(e);
|
|
7591
7737
|
switch (t.route) {
|
|
7592
7738
|
case "producer":
|
|
7593
|
-
this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState ===
|
|
7739
|
+
this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === $a && this._handleCommandsQueue(this.datachannelCommandsQueue);
|
|
7594
7740
|
break;
|
|
7595
7741
|
case "websocket":
|
|
7596
7742
|
if (this.transport.readyState === null) {
|
|
@@ -7640,7 +7786,7 @@ var $a = new Set([
|
|
|
7640
7786
|
_handleMessage(e) {
|
|
7641
7787
|
switch (e.type) {
|
|
7642
7788
|
case "notification":
|
|
7643
|
-
this._attachNotificationCallError(e), e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.
|
|
7789
|
+
this._attachNotificationCallError(e), e.notification === "connection" ? (this._debug.debug("[signaling] signaling connected", e), this.connected = !0, this.transport.onConnectionRestored(), this.transport.setEndpoint(e.endpoint), e.peerId && this.peerId !== e.peerId.id && (this.peerId = e.peerId.id, this.transport.setPeerId(e.peerId.id)), this._stopWaitConnectionMessage(), this.conversationResolve ? this.conversationResolve(e) : (this._triggerEvent(xr.RECONNECT, e), e.conversation.topology && this._triggerEvent(xr.NOTIFICATION, {
|
|
7644
7790
|
type: "notification",
|
|
7645
7791
|
notification: K.TOPOLOGY_CHANGED,
|
|
7646
7792
|
topology: e.conversation.topology
|
|
@@ -7660,9 +7806,9 @@ var $a = new Set([
|
|
|
7660
7806
|
}
|
|
7661
7807
|
_handleErrorMessage(e) {
|
|
7662
7808
|
this._logger?.log(C.SOCKET_ACTION, `error-${e.error}`);
|
|
7663
|
-
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r =
|
|
7809
|
+
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = io(e, "Unknown signaling error");
|
|
7664
7810
|
switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
|
|
7665
|
-
case
|
|
7811
|
+
case no.SERVICE_UNAVAILABLE:
|
|
7666
7812
|
let i = new k(O.SERVICE_UNAVAILABLE, {
|
|
7667
7813
|
callError: n,
|
|
7668
7814
|
message: r,
|
|
@@ -7674,7 +7820,7 @@ var $a = new Set([
|
|
|
7674
7820
|
reason: O.SERVICE_UNAVAILABLE
|
|
7675
7821
|
});
|
|
7676
7822
|
break;
|
|
7677
|
-
case
|
|
7823
|
+
case no.CONVERSATION_ENDED:
|
|
7678
7824
|
this.conversationReject ? this.conversationReject(new k(e.reason || x.SIGNALING_FAILED, {
|
|
7679
7825
|
callError: n,
|
|
7680
7826
|
message: r,
|
|
@@ -7685,22 +7831,22 @@ var $a = new Set([
|
|
|
7685
7831
|
reason: e.reason
|
|
7686
7832
|
});
|
|
7687
7833
|
break;
|
|
7688
|
-
case
|
|
7689
|
-
case
|
|
7834
|
+
case no.ILLEGAL_PARTICIPANT_STATE:
|
|
7835
|
+
case no.PARTICIPANT_NOT_FOUND:
|
|
7690
7836
|
this._throwError(new k(x.SIGNALING_FAILED, {
|
|
7691
7837
|
callError: n,
|
|
7692
7838
|
message: r,
|
|
7693
7839
|
remote: !0
|
|
7694
7840
|
}));
|
|
7695
7841
|
break;
|
|
7696
|
-
case
|
|
7842
|
+
case no.OBSOLETE_CLIENT:
|
|
7697
7843
|
this.conversationReject?.(new k(e.reason || O.OBSOLETE_CLIENT, {
|
|
7698
7844
|
callError: n,
|
|
7699
7845
|
message: r,
|
|
7700
7846
|
remote: !0
|
|
7701
7847
|
}));
|
|
7702
7848
|
break;
|
|
7703
|
-
case
|
|
7849
|
+
case no.INVALID_TOKEN:
|
|
7704
7850
|
default:
|
|
7705
7851
|
if (e.sequence || t === Sr.WEBTRANSPORT) break;
|
|
7706
7852
|
if (this.connected) this._throwError(new k(e.reason || x.SIGNALING_FAILED, {
|
|
@@ -7739,7 +7885,7 @@ var $a = new Set([
|
|
|
7739
7885
|
}
|
|
7740
7886
|
_describeErrorEvent(e) {
|
|
7741
7887
|
let t = e, n = t.error instanceof Error ? t.error : null, r = [n?.name || t.errorInfo?.name, n?.message || t.errorInfo?.message || t.message].filter(Boolean).join(": ") || "Unknown error", i = t.errorInfo?.phase;
|
|
7742
|
-
return (i ? `${i}: ${r}` : r).slice(0,
|
|
7888
|
+
return (i ? `${i}: ${r}` : r).slice(0, eo);
|
|
7743
7889
|
}
|
|
7744
7890
|
_onClose(e) {
|
|
7745
7891
|
this._logger?.log(C.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
|
|
@@ -7794,13 +7940,13 @@ var $a = new Set([
|
|
|
7794
7940
|
let r = this.responseHandlers[n.sequence];
|
|
7795
7941
|
window.clearTimeout(r.responseTimer);
|
|
7796
7942
|
let i = G.measureMark(r.statMarkName);
|
|
7797
|
-
i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-error"), r.reject(Error(
|
|
7943
|
+
i !== null && this._statSignalingCommands?.mark(r.name, i, this._getSocketType()), this._debug.debug(`[signaling] command response [${n.sequence}]`, n), t ? (delete this.responseHandlers[n.sequence], r.resolve(n)) : n.type === "error" ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-error"), r.reject(Error(io(n, `Response error [${r.name}]`)), !0)) : this.transport.readyState === WebSocket.OPEN ? (delete this.responseHandlers[n.sequence], this._logger?.log(C.SOCKET_ACTION, "response-timeout"), r.reject(Error(io(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
|
|
7798
7944
|
}
|
|
7799
7945
|
_handleCommandsQueue(e) {
|
|
7800
7946
|
for (; e.length > 0;) {
|
|
7801
7947
|
let t = e.shift();
|
|
7802
7948
|
if (this._debug.debug(`[signaling] command send [${t.sequence}]`, `'${t.name}'`, t.params), t.route === "producer") {
|
|
7803
|
-
if (this.producerCommandDataChannel?.readyState !==
|
|
7949
|
+
if (this.producerCommandDataChannel?.readyState !== $a) {
|
|
7804
7950
|
t.reject(/* @__PURE__ */ Error(`Invalid data channel state: ${this.producerCommandDataChannel?.readyState}`));
|
|
7805
7951
|
return;
|
|
7806
7952
|
}
|
|
@@ -7885,7 +8031,7 @@ var $a = new Set([
|
|
|
7885
8031
|
}
|
|
7886
8032
|
_onTransportFailed(e) {
|
|
7887
8033
|
switch (e.failure) {
|
|
7888
|
-
case
|
|
8034
|
+
case Za.EMPTY_ENDPOINT:
|
|
7889
8035
|
this.conversationReject?.(new k(x.SIGNALING_FAILED, {
|
|
7890
8036
|
callError: {
|
|
7891
8037
|
scope: "internal",
|
|
@@ -7896,7 +8042,7 @@ var $a = new Set([
|
|
|
7896
8042
|
remote: e.remote
|
|
7897
8043
|
}));
|
|
7898
8044
|
break;
|
|
7899
|
-
case
|
|
8045
|
+
case Za.NETWORK_ERROR:
|
|
7900
8046
|
this._logReconnectTimeout(), this._fail(new k(O.NETWORK_ERROR, { callError: {
|
|
7901
8047
|
scope: "network",
|
|
7902
8048
|
source: e.source,
|
|
@@ -7904,7 +8050,15 @@ var $a = new Set([
|
|
|
7904
8050
|
description: "connection-failed"
|
|
7905
8051
|
} }));
|
|
7906
8052
|
break;
|
|
7907
|
-
case
|
|
8053
|
+
case Za.RECONNECT_TIMEOUT:
|
|
8054
|
+
this._logReconnectTimeout(), this._fail(new k(O.NETWORK_ERROR, { callError: {
|
|
8055
|
+
scope: "network",
|
|
8056
|
+
source: e.source,
|
|
8057
|
+
code: "reconnect-timeout",
|
|
8058
|
+
description: "connection-failed"
|
|
8059
|
+
} }));
|
|
8060
|
+
break;
|
|
8061
|
+
case Za.ABORTED:
|
|
7908
8062
|
this._debug.debug("[signaling] aborted reconnect"), this._fail(new k(O.CANCELED));
|
|
7909
8063
|
break;
|
|
7910
8064
|
}
|
|
@@ -7919,7 +8073,7 @@ var $a = new Set([
|
|
|
7919
8073
|
this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStatSinceMark(Cr.FAILED_PINGS);
|
|
7920
8074
|
}
|
|
7921
8075
|
_attachNotificationCallError(e) {
|
|
7922
|
-
e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR ||
|
|
8076
|
+
e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR || !ao.has(e.reason) && !e.errorCode || (e.callError = {
|
|
7923
8077
|
scope: "server",
|
|
7924
8078
|
source: this._getSocketType(),
|
|
7925
8079
|
code: e.errorCode || "protocol",
|
|
@@ -7927,7 +8081,7 @@ var $a = new Set([
|
|
|
7927
8081
|
});
|
|
7928
8082
|
}
|
|
7929
8083
|
_createSignalingCallError(e, t, n) {
|
|
7930
|
-
let r =
|
|
8084
|
+
let r = ro[e];
|
|
7931
8085
|
if (r) return {
|
|
7932
8086
|
scope: "server",
|
|
7933
8087
|
source: n,
|
|
@@ -7953,39 +8107,39 @@ var $a = new Set([
|
|
|
7953
8107
|
let t = this._getSocketType(), n = wr[e][t];
|
|
7954
8108
|
this._statAggregator?.logEventualStatSinceMark({ name: n });
|
|
7955
8109
|
}
|
|
7956
|
-
},
|
|
8110
|
+
}, so = /* @__PURE__ */ function(e) {
|
|
7957
8111
|
return e.INCOMING = "INCOMING", e.OUTGOING = "OUTGOING", e.JOINING = "JOINING", e;
|
|
7958
|
-
}(
|
|
8112
|
+
}(so || {}), co = /* @__PURE__ */ function(e) {
|
|
7959
8113
|
return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
|
|
7960
|
-
}(
|
|
8114
|
+
}(co || {}), lo = /* @__PURE__ */ function(e) {
|
|
7961
8115
|
return e.ATTENDEE = "ATTENDEE", e.HAND_UP = "HAND_UP", e;
|
|
7962
|
-
}(
|
|
8116
|
+
}(lo || {}), uo = /* @__PURE__ */ function(e) {
|
|
7963
8117
|
return e.ADD_PARTICIPANT = "ADD_PARTICIPANT", e.RECORD = "RECORD", e.MOVIE_SHARE = "MOVIE_SHARE", e;
|
|
7964
|
-
}(
|
|
8118
|
+
}(uo || {}), fo = /* @__PURE__ */ function(e) {
|
|
7965
8119
|
return e.REQUIRE_AUTH_TO_JOIN = "REQUIRE_AUTH_TO_JOIN", e.AUDIENCE_MODE = "AUDIENCE_MODE", e.WAITING_HALL = "WAITING_HALL", e.WAIT_FOR_ADMIN = "WAIT_FOR_ADMIN", e.ADMIN_IS_HERE = "ADMIN_IS_HERE", e.ASR = "ASR", e.FEEDBACK = "FEEDBACK", e.RECURRING = "RECURRING", e;
|
|
7966
|
-
}(
|
|
7967
|
-
function
|
|
8120
|
+
}(fo || {});
|
|
8121
|
+
function po(e, t) {
|
|
7968
8122
|
if (e.length !== t.length) return !1;
|
|
7969
8123
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
7970
8124
|
return !0;
|
|
7971
8125
|
}
|
|
7972
|
-
function
|
|
8126
|
+
function mo(e, t) {
|
|
7973
8127
|
let n = new Set(e);
|
|
7974
8128
|
for (let [e, r] of Object.entries(t)) r ? n.add(e) : n.delete(e);
|
|
7975
8129
|
return Array.from(n);
|
|
7976
8130
|
}
|
|
7977
8131
|
//#endregion
|
|
7978
8132
|
//#region src/enums/MuteState.ts
|
|
7979
|
-
var
|
|
8133
|
+
var ho = /* @__PURE__ */ function(e) {
|
|
7980
8134
|
return e.UNMUTE = "UNMUTE", e.MUTE = "MUTE", e.MUTE_PERMANENT = "MUTE_PERMANENT", e;
|
|
7981
|
-
}(
|
|
8135
|
+
}(ho || {}), X = /* @__PURE__ */ function(e) {
|
|
7982
8136
|
return e.CALLED = "CALLED", e.ACCEPTED = "ACCEPTED", e.REJECTED = "REJECTED", e.HUNGUP = "HUNGUP", e;
|
|
7983
|
-
}(X || {}),
|
|
8137
|
+
}(X || {}), go = /* @__PURE__ */ function(e) {
|
|
7984
8138
|
return e.UPDATE = "UPDATE", e.REMOVE = "REMOVE", e.ACTIVATE = "ACTIVATE", e.TIMEOUT = "TIMEOUT", e;
|
|
7985
|
-
}(
|
|
8139
|
+
}(go || {}), _o = /* @__PURE__ */ function(e) {
|
|
7986
8140
|
return e.NO_AVAILABLE_TRACKS = "no-available-tracks", e.UNKNOWN_ERROR = "unknown-error", e;
|
|
7987
|
-
}(
|
|
7988
|
-
function
|
|
8141
|
+
}(_o || {});
|
|
8142
|
+
function vo(e) {
|
|
7989
8143
|
switch (e) {
|
|
7990
8144
|
case 1: return "no-available-tracks";
|
|
7991
8145
|
default: return "unknown-error";
|
|
@@ -7993,17 +8147,17 @@ function fo(e) {
|
|
|
7993
8147
|
}
|
|
7994
8148
|
//#endregion
|
|
7995
8149
|
//#region src/enums/UserRole.ts
|
|
7996
|
-
var
|
|
8150
|
+
var yo = /* @__PURE__ */ function(e) {
|
|
7997
8151
|
return e.CREATOR = "CREATOR", e.ADMIN = "ADMIN", e;
|
|
7998
|
-
}(
|
|
7999
|
-
function
|
|
8152
|
+
}(yo || {});
|
|
8153
|
+
function bo(e, t) {
|
|
8000
8154
|
if (e.length !== t.length) return !1;
|
|
8001
8155
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
8002
8156
|
return !0;
|
|
8003
8157
|
}
|
|
8004
8158
|
//#endregion
|
|
8005
8159
|
//#region src/static/ParticipantConnectionStatusUtils.ts
|
|
8006
|
-
var
|
|
8160
|
+
var xo;
|
|
8007
8161
|
(function(e) {
|
|
8008
8162
|
function t(e) {
|
|
8009
8163
|
let t = e?.transport ?? e?.lastEffective ?? P.WAITING, n = {
|
|
@@ -8055,8 +8209,8 @@ var ho;
|
|
|
8055
8209
|
shouldNotify: !0
|
|
8056
8210
|
});
|
|
8057
8211
|
}
|
|
8058
|
-
})(
|
|
8059
|
-
var
|
|
8212
|
+
})(xo || (xo = {}));
|
|
8213
|
+
var So = xo, Co = /* @__PURE__ */ function(e) {
|
|
8060
8214
|
return e.USER = "USER", e.ANONYM = "ANONYM", e.GROUP = "GROUP", e;
|
|
8061
8215
|
}({}), Z;
|
|
8062
8216
|
(function(e) {
|
|
@@ -8119,7 +8273,7 @@ var go = ho, _o = /* @__PURE__ */ function(e) {
|
|
|
8119
8273
|
})(Z || (Z = {}));
|
|
8120
8274
|
//#endregion
|
|
8121
8275
|
//#region src/types/WaitingHall.ts
|
|
8122
|
-
function
|
|
8276
|
+
function wo(e) {
|
|
8123
8277
|
try {
|
|
8124
8278
|
return btoa(JSON.stringify(e));
|
|
8125
8279
|
} catch (t) {
|
|
@@ -8127,7 +8281,7 @@ function vo(e) {
|
|
|
8127
8281
|
}
|
|
8128
8282
|
return null;
|
|
8129
8283
|
}
|
|
8130
|
-
function
|
|
8284
|
+
function To(e) {
|
|
8131
8285
|
try {
|
|
8132
8286
|
return JSON.parse(atob(e));
|
|
8133
8287
|
} catch (t) {
|
|
@@ -8137,12 +8291,12 @@ function yo(e) {
|
|
|
8137
8291
|
}
|
|
8138
8292
|
//#endregion
|
|
8139
8293
|
//#region src/utils/Conversation.ts
|
|
8140
|
-
var
|
|
8141
|
-
function
|
|
8294
|
+
var Eo = (e, t) => M.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
|
|
8295
|
+
function Do(e) {
|
|
8142
8296
|
if (e.conversation?.muteStates) return e.conversation.muteStates;
|
|
8143
8297
|
if (e.muteState && e.muteOptions) return e.muteOptions.reduce((t, n) => (t[n] = e.muteState, t), {});
|
|
8144
8298
|
}
|
|
8145
|
-
function
|
|
8299
|
+
function Oo(e, t) {
|
|
8146
8300
|
switch (e) {
|
|
8147
8301
|
case S.AUDIO: return !!t.isAudioEnabled;
|
|
8148
8302
|
case S.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
|
|
@@ -8151,12 +8305,12 @@ function So(e, t) {
|
|
|
8151
8305
|
default: return !1;
|
|
8152
8306
|
}
|
|
8153
8307
|
}
|
|
8154
|
-
function
|
|
8308
|
+
function ko(e, t) {
|
|
8155
8309
|
return M.objectReduce(e, (e, n, r) => {
|
|
8156
8310
|
switch (n) {
|
|
8157
|
-
case
|
|
8158
|
-
case
|
|
8159
|
-
|
|
8311
|
+
case ho.MUTE:
|
|
8312
|
+
case ho.MUTE_PERMANENT:
|
|
8313
|
+
Oo(r, t) || (e[r] = n);
|
|
8160
8314
|
break;
|
|
8161
8315
|
default:
|
|
8162
8316
|
e[r] = n;
|
|
@@ -8165,19 +8319,19 @@ function Co(e, t) {
|
|
|
8165
8319
|
return e;
|
|
8166
8320
|
}, {});
|
|
8167
8321
|
}
|
|
8168
|
-
function
|
|
8322
|
+
function Ao(e) {
|
|
8169
8323
|
let { muteStates: t = {}, mediaSettings: n } = e;
|
|
8170
|
-
return
|
|
8324
|
+
return ko(t, n);
|
|
8171
8325
|
}
|
|
8172
|
-
function
|
|
8326
|
+
function jo(e, t) {
|
|
8173
8327
|
let n = e.conversation.participants.find((t) => M.comparePeerId(t.peerId, e.peerId));
|
|
8174
8328
|
if (!n) return t;
|
|
8175
8329
|
let { mediaSettings: r } = n;
|
|
8176
|
-
return
|
|
8330
|
+
return ko(t, r);
|
|
8177
8331
|
}
|
|
8178
8332
|
//#endregion
|
|
8179
8333
|
//#region src/utils/IceServers.ts
|
|
8180
|
-
function
|
|
8334
|
+
function Mo(e) {
|
|
8181
8335
|
if (!e) return null;
|
|
8182
8336
|
let t = Array.from(new Set((e.urls ?? []).map((e) => e.trim()).filter((e) => e.length > 0)));
|
|
8183
8337
|
return t.length ? {
|
|
@@ -8185,8 +8339,8 @@ function Eo(e) {
|
|
|
8185
8339
|
urls: t
|
|
8186
8340
|
} : null;
|
|
8187
8341
|
}
|
|
8188
|
-
function
|
|
8189
|
-
let n = [], r =
|
|
8342
|
+
function No(e, t) {
|
|
8343
|
+
let n = [], r = Mo(e), i = Mo(t);
|
|
8190
8344
|
if (r && n.push(r), i) {
|
|
8191
8345
|
let e = [...i.urls];
|
|
8192
8346
|
e.push(`${e[e.length - 1]}?transport=tcp`), n.push({
|
|
@@ -8198,7 +8352,7 @@ function Do(e, t) {
|
|
|
8198
8352
|
}
|
|
8199
8353
|
//#endregion
|
|
8200
8354
|
//#region src/utils/Lz4.ts
|
|
8201
|
-
function
|
|
8355
|
+
function Po(e, t) {
|
|
8202
8356
|
let n = new Uint8Array(t), r = 0, i = 0;
|
|
8203
8357
|
for (; r < e.length && i < t;) {
|
|
8204
8358
|
let a = e[r++], o = a >> 4, s = a & 15;
|
|
@@ -8225,7 +8379,7 @@ function Oo(e, t) {
|
|
|
8225
8379
|
}
|
|
8226
8380
|
//#endregion
|
|
8227
8381
|
//#region src/utils/SerializeLatest.ts
|
|
8228
|
-
function
|
|
8382
|
+
function Fo(e) {
|
|
8229
8383
|
let t, n = !1, r, i = async () => {
|
|
8230
8384
|
let t = !1, i;
|
|
8231
8385
|
for (; n;) {
|
|
@@ -8246,7 +8400,7 @@ function ko(e) {
|
|
|
8246
8400
|
}
|
|
8247
8401
|
//#endregion
|
|
8248
8402
|
//#region src/classes/AudioFix.ts
|
|
8249
|
-
var
|
|
8403
|
+
var Io = class {
|
|
8250
8404
|
constructor(e, t = z, n = null) {
|
|
8251
8405
|
h(this, "_fixNoPacketsApplied", !1), h(this, "_fixNoPacketsChecked", !1), h(this, "_fixTooManyPacketsApplied", !1), h(this, "_fixTooManyPacketsSucceeded", !1), h(this, "_fixTooManyPacketsFailed", !1), h(this, "_fixTooManyPacketsTime", void 0), h(this, "_mediaSource", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_lastPacketsSent", void 0), h(this, "_lastPacketsSentTime", void 0), h(this, "_toggleAudioPromise", null), h(this, "_fixNoPacketsAppliedVideo", !1), this._mediaSource = e, this._debug = t, this._logger = n;
|
|
8252
8406
|
}
|
|
@@ -8284,7 +8438,7 @@ var Ao = class {
|
|
|
8284
8438
|
this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
|
|
8285
8439
|
}));
|
|
8286
8440
|
}
|
|
8287
|
-
},
|
|
8441
|
+
}, Lo = class {
|
|
8288
8442
|
constructor(e, t = !1, n = z, r = null) {
|
|
8289
8443
|
h(this, "_audioElement", null), h(this, "_debug", void 0), h(this, "_preparedAudioElement", void 0), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "_logger", void 0), this._statFirstMediaReceived = e, this._allowMultipleTracks = t, this._debug = n, this._logger = r, this._preparedAudioElement = this._prepareAudioElement();
|
|
8290
8444
|
}
|
|
@@ -8387,13 +8541,13 @@ var Ao = class {
|
|
|
8387
8541
|
};
|
|
8388
8542
|
//#endregion
|
|
8389
8543
|
//#region src/classes/conversation/ConversationResponseValidator.ts
|
|
8390
|
-
function
|
|
8391
|
-
e ||
|
|
8544
|
+
function Ro(e, t) {
|
|
8545
|
+
e || Bo(t, "response-empty"), e.id || Bo(t, "id-empty"), e.endpoint || Bo(t, "endpoint-empty"), !zo(e.stun_server) && !zo(e.turn_server) && Bo(t, "ice-servers-empty");
|
|
8392
8546
|
}
|
|
8393
|
-
function
|
|
8547
|
+
function zo(e) {
|
|
8394
8548
|
return Array.isArray(e?.urls) && e.urls.length > 0;
|
|
8395
8549
|
}
|
|
8396
|
-
function
|
|
8550
|
+
function Bo(e, t) {
|
|
8397
8551
|
let n = e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), r = e === "fastStart" || e === "fastJoin";
|
|
8398
8552
|
throw new k(r ? e === "fastStart" ? O.FAST_START_ERROR : O.FAST_JOIN_ERROR : O.UNKNOWN_ERROR, {
|
|
8399
8553
|
message: `Invalid ${e} response: ${t}`,
|
|
@@ -8412,7 +8566,7 @@ function Po(e, t) {
|
|
|
8412
8566
|
}
|
|
8413
8567
|
//#endregion
|
|
8414
8568
|
//#region src/classes/DebugInfo.ts
|
|
8415
|
-
var
|
|
8569
|
+
var Vo = 90, Ho = 3, Uo = class extends b {
|
|
8416
8570
|
constructor(e = z) {
|
|
8417
8571
|
super(), h(this, "_lastMemoryStat", {
|
|
8418
8572
|
percent: 0,
|
|
@@ -8428,9 +8582,9 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8428
8582
|
let e = window?.performance?.memory;
|
|
8429
8583
|
if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
|
|
8430
8584
|
let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
|
|
8431
|
-
t >
|
|
8585
|
+
t > Vo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= Ho) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
|
|
8432
8586
|
}
|
|
8433
|
-
},
|
|
8587
|
+
}, Wo = class {
|
|
8434
8588
|
constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i, onNonFatalError: a }) {
|
|
8435
8589
|
h(this, "_api", void 0), h(this, "_debug", void 0), h(this, "_getParticipants", void 0), h(this, "_isMe", void 0), h(this, "_updateDisplayLayout", void 0), h(this, "_onNonFatalError", void 0), h(this, "_requestedLayouts", {}), h(this, "_uncertainLayouts", {}), h(this, "_pendingRequests", null), h(this, "_pendingPromises", []), h(this, "_lastRequests", null), h(this, "_timer", null), h(this, "_inFlight", !1), h(this, "_lastFlushAt", null), h(this, "_generation", 0), h(this, "_forceNextFlush", !1), this._api = e, this._debug = t, this._getParticipants = n, this._isMe = r, this._updateDisplayLayout = i, this._onNonFatalError = a;
|
|
8436
8590
|
}
|
|
@@ -8545,7 +8699,7 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8545
8699
|
let n = e, r = t;
|
|
8546
8700
|
return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
|
|
8547
8701
|
}
|
|
8548
|
-
},
|
|
8702
|
+
}, Go = 44100, Ko = class {
|
|
8549
8703
|
constructor(e, t) {
|
|
8550
8704
|
h(this, "_analyser", null), h(this, "_gainNode", null), h(this, "_fftBins", null), h(this, "_mediaStreamSource", null), h(this, "_lastSmoothedLevel", 0), h(this, "_trackId", void 0), h(this, "_track", void 0), h(this, "_stream", void 0), this._trackId = e, this._track = t, this._stream = new MediaStream([t]);
|
|
8551
8705
|
try {
|
|
@@ -8562,7 +8716,7 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8562
8716
|
_getBins() {
|
|
8563
8717
|
if (!this._fftBins || !this._analyser) return new Uint8Array();
|
|
8564
8718
|
this._analyser.getByteFrequencyData(this._fftBins);
|
|
8565
|
-
let e =
|
|
8719
|
+
let e = Go / this._fftBins.length, t = Math.ceil(N.voiceParams.minFreq / e), n = Math.floor(N.voiceParams.maxFreq / e);
|
|
8566
8720
|
return this._fftBins.subarray(t, n);
|
|
8567
8721
|
}
|
|
8568
8722
|
getLevel() {
|
|
@@ -8575,7 +8729,7 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8575
8729
|
destroy() {
|
|
8576
8730
|
this._mediaStreamSource && (this._mediaStreamSource.disconnect(), this._mediaStreamSource = null), this._gainNode && (this._gainNode.disconnect(), this._gainNode = null), this._analyser && (this._analyser.disconnect(), this._analyser = null, this._fftBins = null, this._lastSmoothedLevel = 0), this._stream.removeTrack(this._track);
|
|
8577
8731
|
}
|
|
8578
|
-
},
|
|
8732
|
+
}, qo = class extends b {
|
|
8579
8733
|
constructor(e) {
|
|
8580
8734
|
super(), h(this, "_detector", null), h(this, "_interval", null);
|
|
8581
8735
|
let t = () => {
|
|
@@ -8591,7 +8745,7 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8591
8745
|
}), this.subscribe(e, qt.SOURCE_READY, n), n();
|
|
8592
8746
|
}
|
|
8593
8747
|
init(e) {
|
|
8594
|
-
this._stopDetector(), this._detector = new
|
|
8748
|
+
this._stopDetector(), this._detector = new Ko("local", e.clone());
|
|
8595
8749
|
}
|
|
8596
8750
|
_stopDetector() {
|
|
8597
8751
|
this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
|
|
@@ -8599,7 +8753,7 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8599
8753
|
destroy() {
|
|
8600
8754
|
this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
|
|
8601
8755
|
}
|
|
8602
|
-
},
|
|
8756
|
+
}, Jo = class {
|
|
8603
8757
|
constructor(e, t = z) {
|
|
8604
8758
|
h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
|
|
8605
8759
|
}
|
|
@@ -8619,9 +8773,9 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8619
8773
|
this.isProcessing = !1;
|
|
8620
8774
|
}
|
|
8621
8775
|
}
|
|
8622
|
-
},
|
|
8776
|
+
}, Yo = /* @__PURE__ */ function(e) {
|
|
8623
8777
|
return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
|
|
8624
|
-
}({}),
|
|
8778
|
+
}({}), Xo = class extends b {
|
|
8625
8779
|
constructor(e) {
|
|
8626
8780
|
super(), h(this, "_detectors", /* @__PURE__ */ new Map()), h(this, "_interval", null), h(this, "_activeParticipants", void 0), h(this, "_removedParticipants", void 0), h(this, "_topology", void 0), this._topology = e.getTopology(), this.subscribe(e, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(e, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(e, Y.SIGNALLED_ACTIVE_PARTICIPANTS, this._onSignalledActiveParticipants.bind(this)), this.subscribe(e, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
8627
8781
|
}
|
|
@@ -8629,7 +8783,7 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8629
8783
|
this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
|
|
8630
8784
|
}
|
|
8631
8785
|
_onRemoteTrackAdded(e, t, n) {
|
|
8632
|
-
if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new
|
|
8786
|
+
if (n.kind === A.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new Ko(e, n)), !this._interval)) {
|
|
8633
8787
|
let e = () => {
|
|
8634
8788
|
this._collectVolumes(), this._interval = window.setTimeout(e, N.voiceParams.interval);
|
|
8635
8789
|
};
|
|
@@ -8660,14 +8814,14 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8660
8814
|
this._triggerEvent("VOLUMES_DETECTED", e);
|
|
8661
8815
|
}
|
|
8662
8816
|
_getAudioTrackLevelByParticipantId(e) {
|
|
8663
|
-
let t = this._detectors.get(
|
|
8817
|
+
let t = this._detectors.get(fi.AUDIO_MIX);
|
|
8664
8818
|
return t ? t.getLevel() : this._getTransparentAudioLevelByParticipantId(e);
|
|
8665
8819
|
}
|
|
8666
8820
|
_getTransparentAudioLevelByParticipantId(e) {
|
|
8667
8821
|
if (!this._activeParticipants?.includes(e)) return null;
|
|
8668
8822
|
let t = null;
|
|
8669
8823
|
return this._detectors.forEach((e, n) => {
|
|
8670
|
-
if (!n.startsWith(`${
|
|
8824
|
+
if (!n.startsWith(`${fi.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
|
|
8671
8825
|
let r = e.getLevel();
|
|
8672
8826
|
(!t || r.real > t.real) && (t = r);
|
|
8673
8827
|
}), t;
|
|
@@ -8683,11 +8837,11 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8683
8837
|
e.destroy();
|
|
8684
8838
|
}), this._detectors.clear();
|
|
8685
8839
|
}
|
|
8686
|
-
},
|
|
8840
|
+
}, Zo = /* @__PURE__ */ function(e) {
|
|
8687
8841
|
return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
|
|
8688
|
-
}({}),
|
|
8842
|
+
}({}), Qo = class extends b {
|
|
8689
8843
|
constructor(e, t, n) {
|
|
8690
|
-
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e,
|
|
8844
|
+
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, Yo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, Y.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
8691
8845
|
}
|
|
8692
8846
|
destroy() {
|
|
8693
8847
|
this.unsubscribe();
|
|
@@ -8709,9 +8863,9 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8709
8863
|
_onTopologyChanged(e) {
|
|
8710
8864
|
this._serverSideSpeakerDetection = e === J.SERVER;
|
|
8711
8865
|
}
|
|
8712
|
-
},
|
|
8866
|
+
}, $o = 15e3, es = 15e3, ts = class extends b {
|
|
8713
8867
|
constructor(e, t, n, r = z, i = null) {
|
|
8714
|
-
super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t,
|
|
8868
|
+
super(), h(this, "_transport", void 0), h(this, "_volumes", {}), h(this, "_participants", {}), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_connectionTimeout", 0), h(this, "_connectionTimeoutSuppressed", !1), h(this, "_volumeTimeout", 0), this._transport = e, this._participants = n, this._debug = r, this._logger = i, this.subscribe(e, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, Yo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
|
|
8715
8869
|
}
|
|
8716
8870
|
destroy() {
|
|
8717
8871
|
this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
|
|
@@ -8723,10 +8877,10 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8723
8877
|
this._connectionTimeout || !this._connectionTimeoutSuppressed || this._reportConnectionTimeout();
|
|
8724
8878
|
}
|
|
8725
8879
|
_getConnectionTimeout() {
|
|
8726
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
8880
|
+
return this._transport.getTopology() === J.DIRECT ? $o : N.specListenerParams.connectionTimeout;
|
|
8727
8881
|
}
|
|
8728
8882
|
_getVolumeTimeout() {
|
|
8729
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
8883
|
+
return this._transport.getTopology() === J.DIRECT ? es : N.specListenerParams.volumeTimeout;
|
|
8730
8884
|
}
|
|
8731
8885
|
_onTransportStateChanged(e, t) {
|
|
8732
8886
|
t === q.OPENED && (this._connectionTimeout || (this._connectionTimeoutSuppressed = !1, this._connectionTimeout = window.setTimeout(this._onConnectionTimeout.bind(this), this._getConnectionTimeout()))), t === q.CONNECTED && (this._volumeTimeout || (this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout())), this._volumeTimeout && (window.clearTimeout(this._volumeTimeout), this._volumeTimeout = window.setTimeout(this._onVolumeTimeout.bind(this), this._getVolumeTimeout()))), t === q.FAILED && this._connectionTimeout && (this._debug.warn("Transport failed, send callSpecError"), this._logger?.log(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_CONNECTION_TIMEOUT`));
|
|
@@ -8759,15 +8913,15 @@ var Fo = 90, Io = 3, Lo = class extends b {
|
|
|
8759
8913
|
r && r.platform && (n = r.platform), e.indexOf(n) < 0 && (e.push(n), this._logger?.log(C.CALL_SPEC_ERROR, `${this._transport.getTopology()}_VOLUME_TIMEOUT_${n}`));
|
|
8760
8914
|
}), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
|
|
8761
8915
|
}
|
|
8762
|
-
},
|
|
8916
|
+
}, ns = /* @__PURE__ */ function(e) {
|
|
8763
8917
|
return e[e.PARAM_SESSION_EXPIRED = 102] = "PARAM_SESSION_EXPIRED", e[e.PARAM_SESSION_KEY = 103] = "PARAM_SESSION_KEY", e[e.PARAM_SIGNATURE = 104] = "PARAM_SIGNATURE", e[e.AUTH_LOGIN = 401] = "AUTH_LOGIN", e;
|
|
8764
|
-
}(
|
|
8765
|
-
function
|
|
8918
|
+
}(ns || {});
|
|
8919
|
+
function rs(e) {
|
|
8766
8920
|
return e === 102 || e === 103 || e === 104;
|
|
8767
8921
|
}
|
|
8768
8922
|
//#endregion
|
|
8769
8923
|
//#region src/classes/stat/StatQueue.ts
|
|
8770
|
-
var
|
|
8924
|
+
var is, as = "ok-calls-sdk-stats", os = 1, ss = "events", cs = 100, ls = 5e3, us = 10080 * 60 * 1e3, ds = 5e3, fs = 6e4, Q = class e {
|
|
8771
8925
|
static isSupported() {
|
|
8772
8926
|
return e._supported;
|
|
8773
8927
|
}
|
|
@@ -8780,7 +8934,7 @@ var Qo, $o = "ok-calls-sdk-stats", es = 1, ts = "events", ns = 100, rs = 5e3, is
|
|
|
8780
8934
|
n.onsuccess = () => e(n.result);
|
|
8781
8935
|
});
|
|
8782
8936
|
}).catch((e) => (z.error("[StatQueue] failed to append event", e), null));
|
|
8783
|
-
return r === null ? null : (e._appendsSinceEvictCheck += 1, e._appendsSinceEvictCheck >=
|
|
8937
|
+
return r === null ? null : (e._appendsSinceEvictCheck += 1, e._appendsSinceEvictCheck >= cs && (e._appendsSinceEvictCheck = 0, await e.evictToLimit(ls)), r);
|
|
8784
8938
|
}
|
|
8785
8939
|
static async fillDelta(t, n) {
|
|
8786
8940
|
if (t.length === 0) return;
|
|
@@ -8881,7 +9035,7 @@ var Qo, $o = "ok-calls-sdk-stats", es = 1, ts = "events", ns = 100, rs = 5e3, is
|
|
|
8881
9035
|
});
|
|
8882
9036
|
}
|
|
8883
9037
|
static async __resetForTests() {
|
|
8884
|
-
if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName ===
|
|
9038
|
+
if (e._appendsSinceEvictCheck = 0, e._lastOpenFailureAt = null, e._supported = e._checkSupport(), e._dbName === as && (e._dbName = `${as}-test-${Math.random().toString(36).slice(2)}`, e._close()), e._supported) {
|
|
8885
9039
|
let t = await e._open();
|
|
8886
9040
|
t && await e._runTransaction(t, "readwrite", (e) => {
|
|
8887
9041
|
e.clear();
|
|
@@ -8889,7 +9043,6 @@ var Qo, $o = "ok-calls-sdk-stats", es = 1, ts = "events", ns = 100, rs = 5e3, is
|
|
|
8889
9043
|
z.error("[StatQueue] failed to reset storage", e);
|
|
8890
9044
|
});
|
|
8891
9045
|
}
|
|
8892
|
-
e._close();
|
|
8893
9046
|
}
|
|
8894
9047
|
static _checkSupport() {
|
|
8895
9048
|
return typeof window < "u" && !!window.indexedDB;
|
|
@@ -8897,18 +9050,18 @@ var Qo, $o = "ok-calls-sdk-stats", es = 1, ts = "events", ns = 100, rs = 5e3, is
|
|
|
8897
9050
|
static _open() {
|
|
8898
9051
|
if (!e._checkSupport()) return e._supported = !1, Promise.resolve(null);
|
|
8899
9052
|
if (e._dbPromise) return e._dbPromise;
|
|
8900
|
-
if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt <
|
|
9053
|
+
if (e._lastOpenFailureAt !== null && Date.now() - e._lastOpenFailureAt < fs) return Promise.resolve(null);
|
|
8901
9054
|
let t = !1, n = new Promise((n) => {
|
|
8902
9055
|
let r = (r, i) => {
|
|
8903
9056
|
t || (t = !0, z.error(r, i), e._supported = !1, e._dbPromise = null, e._lastOpenFailureAt = Date.now(), n(null));
|
|
8904
9057
|
}, i;
|
|
8905
9058
|
try {
|
|
8906
|
-
i = window.indexedDB.open(e._dbName,
|
|
9059
|
+
i = window.indexedDB.open(e._dbName, os);
|
|
8907
9060
|
} catch (e) {
|
|
8908
9061
|
r("[StatQueue] storage is not accessible", e);
|
|
8909
9062
|
return;
|
|
8910
9063
|
}
|
|
8911
|
-
let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"),
|
|
9064
|
+
let a = window.setTimeout(() => r("[StatQueue] storage opening timed out"), ds);
|
|
8912
9065
|
i.onupgradeneeded = () => {
|
|
8913
9066
|
e._createSchema(i.result);
|
|
8914
9067
|
}, i.onsuccess = () => {
|
|
@@ -8929,8 +9082,8 @@ var Qo, $o = "ok-calls-sdk-stats", es = 1, ts = "events", ns = 100, rs = 5e3, is
|
|
|
8929
9082
|
e._db && (e._db.close(), e._db = null), e._dbPromise = null;
|
|
8930
9083
|
}
|
|
8931
9084
|
static _createSchema(e) {
|
|
8932
|
-
if (e.objectStoreNames.contains(
|
|
8933
|
-
let t = e.createObjectStore(
|
|
9085
|
+
if (e.objectStoreNames.contains(ss)) return;
|
|
9086
|
+
let t = e.createObjectStore(ss, {
|
|
8934
9087
|
keyPath: "id",
|
|
8935
9088
|
autoIncrement: !0
|
|
8936
9089
|
});
|
|
@@ -8938,8 +9091,8 @@ var Qo, $o = "ok-calls-sdk-stats", es = 1, ts = "events", ns = 100, rs = 5e3, is
|
|
|
8938
9091
|
}
|
|
8939
9092
|
static _runTransaction(e, t, n) {
|
|
8940
9093
|
return new Promise((r, i) => {
|
|
8941
|
-
let a = e.transaction(
|
|
8942
|
-
a.oncomplete = () => r(o), a.onerror = () => i(a.error), a.onabort = () => i(a.error), Promise.resolve(n(a.objectStore(
|
|
9094
|
+
let a = e.transaction(ss, t), o;
|
|
9095
|
+
a.oncomplete = () => r(o), a.onerror = () => i(a.error), a.onabort = () => i(a.error), Promise.resolve(n(a.objectStore(ss))).then((e) => {
|
|
8943
9096
|
o = e;
|
|
8944
9097
|
}).catch((e) => {
|
|
8945
9098
|
try {
|
|
@@ -8964,18 +9117,18 @@ var Qo, $o = "ok-calls-sdk-stats", es = 1, ts = "events", ns = 100, rs = 5e3, is
|
|
|
8964
9117
|
});
|
|
8965
9118
|
}
|
|
8966
9119
|
};
|
|
8967
|
-
|
|
9120
|
+
is = Q, h(Q, "_db", null), h(Q, "_dbPromise", null), h(Q, "_dbName", as), h(Q, "_supported", is._checkSupport()), h(Q, "_appendsSinceEvictCheck", 0), h(Q, "_lastOpenFailureAt", null);
|
|
8968
9121
|
//#endregion
|
|
8969
9122
|
//#region src/static/ApiTransport.ts
|
|
8970
|
-
var
|
|
8971
|
-
function
|
|
8972
|
-
|
|
9123
|
+
var ps = null, ms = null, hs = 64 * 1024;
|
|
9124
|
+
function gs() {
|
|
9125
|
+
ps = null, ms = null;
|
|
8973
9126
|
}
|
|
8974
|
-
function
|
|
9127
|
+
function _s(e) {
|
|
8975
9128
|
return e?.endsWith("/") ? e.slice(0, -1) : e;
|
|
8976
9129
|
}
|
|
8977
|
-
async function
|
|
8978
|
-
let n =
|
|
9130
|
+
async function vs(e = null, t) {
|
|
9131
|
+
let n = _s(e ?? N.apiBaseUrl);
|
|
8979
9132
|
if (n) return n;
|
|
8980
9133
|
if ((t ?? N.apiEnv) !== "AUTO") return N.apiEndpoint(t);
|
|
8981
9134
|
try {
|
|
@@ -8990,25 +9143,25 @@ async function fs(e = null, t) {
|
|
|
8990
9143
|
return z.warn("Failed to resolve API endpoint using DNS, default is used", e), N.apiEndpoint(t);
|
|
8991
9144
|
}
|
|
8992
9145
|
}
|
|
8993
|
-
async function
|
|
8994
|
-
return
|
|
9146
|
+
async function ys() {
|
|
9147
|
+
return ps || ms || (ms = vs(), ps = await ms, ms = null, ps);
|
|
8995
9148
|
}
|
|
8996
|
-
async function
|
|
9149
|
+
async function bs(e, t = {}, n = !1) {
|
|
8997
9150
|
if (!window.Blob || !window.navigator.sendBeacon) return;
|
|
8998
|
-
await
|
|
8999
|
-
let r =
|
|
9000
|
-
window.navigator.sendBeacon(`${
|
|
9151
|
+
await ys();
|
|
9152
|
+
let r = Es(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
|
|
9153
|
+
window.navigator.sendBeacon(`${ps}/fb.do`, i);
|
|
9001
9154
|
}
|
|
9002
|
-
async function
|
|
9003
|
-
return await
|
|
9155
|
+
async function xs(e, t = {}, n = !1, r) {
|
|
9156
|
+
return await ys(), Cs(Es(e, t, n), r);
|
|
9004
9157
|
}
|
|
9005
|
-
async function
|
|
9006
|
-
await
|
|
9007
|
-
let r =
|
|
9008
|
-
return
|
|
9158
|
+
async function Ss(e, t = {}, n = !1) {
|
|
9159
|
+
await ys();
|
|
9160
|
+
let r = Es(e, t, n);
|
|
9161
|
+
return Cs(r, void 0, new Blob([r]).size <= hs);
|
|
9009
9162
|
}
|
|
9010
|
-
async function
|
|
9011
|
-
let r = `${t ??
|
|
9163
|
+
async function Cs(e, t, n = !1) {
|
|
9164
|
+
let r = `${t ?? ps}/fb.do`, i = new AbortController(), a = new k(x.NETWORK, { callError: {
|
|
9012
9165
|
scope: "network",
|
|
9013
9166
|
source: "api",
|
|
9014
9167
|
code: "timeout",
|
|
@@ -9027,16 +9180,16 @@ async function _s(e, t, n = !1) {
|
|
|
9027
9180
|
} catch {
|
|
9028
9181
|
o = { result: a };
|
|
9029
9182
|
}
|
|
9030
|
-
if (!t.ok && !
|
|
9183
|
+
if (!t.ok && !ws(o)) throw new k(x.API, { callError: {
|
|
9031
9184
|
scope: "server",
|
|
9032
9185
|
source: "api",
|
|
9033
9186
|
code: `http-${t.status}`,
|
|
9034
9187
|
description: "http-error"
|
|
9035
9188
|
} });
|
|
9036
|
-
if (
|
|
9189
|
+
if (ws(o)) throw o;
|
|
9037
9190
|
return o;
|
|
9038
9191
|
} catch (e) {
|
|
9039
|
-
throw e instanceof k ? e : i.signal.aborted ? a :
|
|
9192
|
+
throw e instanceof k ? e : i.signal.aborted ? a : ws(e) ? e : new k(x.NETWORK, { callError: {
|
|
9040
9193
|
scope: "network",
|
|
9041
9194
|
source: "api",
|
|
9042
9195
|
code: "fetch-failed",
|
|
@@ -9046,12 +9199,12 @@ async function _s(e, t, n = !1) {
|
|
|
9046
9199
|
clearTimeout(o);
|
|
9047
9200
|
}
|
|
9048
9201
|
}
|
|
9049
|
-
function
|
|
9202
|
+
function ws(e) {
|
|
9050
9203
|
if (typeof e != "object" || !e) return !1;
|
|
9051
9204
|
let t = e;
|
|
9052
9205
|
return typeof t.error_code == "number" && typeof t.error_msg == "string";
|
|
9053
9206
|
}
|
|
9054
|
-
async function
|
|
9207
|
+
async function Ts(e, t) {
|
|
9055
9208
|
try {
|
|
9056
9209
|
let n = await fetch(e, {
|
|
9057
9210
|
method: "POST",
|
|
@@ -9064,7 +9217,7 @@ async function ys(e, t) {
|
|
|
9064
9217
|
throw z.warn("Failed to send form data", e), e;
|
|
9065
9218
|
}
|
|
9066
9219
|
}
|
|
9067
|
-
function
|
|
9220
|
+
function Es(e, t = {}, n = !1) {
|
|
9068
9221
|
t.method = e, t.format = "JSON", t.application_key || (t.application_key = N.apiKey), n || (y.sessionKey ? t.session_key = y.sessionKey : y.accessToken && (t.access_token = y.accessToken));
|
|
9069
9222
|
for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
|
|
9070
9223
|
let r = "";
|
|
@@ -9073,7 +9226,7 @@ function bs(e, t = {}, n = !1) {
|
|
|
9073
9226
|
}
|
|
9074
9227
|
//#endregion
|
|
9075
9228
|
//#region src/static/SessionStore.ts
|
|
9076
|
-
var
|
|
9229
|
+
var Ds = "sessions", Os = 5, ks = class e {
|
|
9077
9230
|
static remember(t, n) {
|
|
9078
9231
|
let r = e._read();
|
|
9079
9232
|
r[String(t)] = {
|
|
@@ -9081,7 +9234,7 @@ var xs = "sessions", Ss = 5, Cs = class e {
|
|
|
9081
9234
|
savedAt: Date.now()
|
|
9082
9235
|
};
|
|
9083
9236
|
let i = Object.keys(r);
|
|
9084
|
-
i.length >
|
|
9237
|
+
i.length > Os && i.sort((e, t) => r[e].savedAt - r[t].savedAt).slice(0, i.length - Os).forEach((e) => delete r[e]), e._write(r);
|
|
9085
9238
|
}
|
|
9086
9239
|
static get(t) {
|
|
9087
9240
|
return e._read()[String(t)] ?? null;
|
|
@@ -9097,10 +9250,10 @@ var xs = "sessions", Ss = 5, Cs = class e {
|
|
|
9097
9250
|
}), r && e._write(n);
|
|
9098
9251
|
}
|
|
9099
9252
|
static currentEndpoint() {
|
|
9100
|
-
return String(
|
|
9253
|
+
return String(_s(N.apiBaseUrl) || N.apiEndpoint());
|
|
9101
9254
|
}
|
|
9102
9255
|
static _read() {
|
|
9103
|
-
let t = w.get(
|
|
9256
|
+
let t = w.get(Ds);
|
|
9104
9257
|
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
9105
9258
|
let n = {};
|
|
9106
9259
|
return Object.entries(t).forEach(([t, r]) => {
|
|
@@ -9109,16 +9262,16 @@ var xs = "sessions", Ss = 5, Cs = class e {
|
|
|
9109
9262
|
}
|
|
9110
9263
|
static _write(e) {
|
|
9111
9264
|
if (Object.keys(e).length === 0) {
|
|
9112
|
-
w.remove(
|
|
9265
|
+
w.remove(Ds);
|
|
9113
9266
|
return;
|
|
9114
9267
|
}
|
|
9115
|
-
w.set(
|
|
9268
|
+
w.set(Ds, e);
|
|
9116
9269
|
}
|
|
9117
9270
|
static _isValid(e) {
|
|
9118
9271
|
let t = e;
|
|
9119
9272
|
return typeof t == "object" && !!t && typeof t.sessionKey == "string" && t.sessionKey.length > 0 && typeof t.endpoint == "string" && typeof t.savedAt == "number";
|
|
9120
9273
|
}
|
|
9121
|
-
},
|
|
9274
|
+
}, As = 15e3, js = class e {
|
|
9122
9275
|
static setApi(t) {
|
|
9123
9276
|
e._api = t;
|
|
9124
9277
|
}
|
|
@@ -9129,7 +9282,7 @@ var xs = "sessions", Ss = 5, Cs = class e {
|
|
|
9129
9282
|
e._delta === null && e._api && e.get();
|
|
9130
9283
|
}
|
|
9131
9284
|
static get() {
|
|
9132
|
-
return e._delta === null ? !e._api || !e._hasCredentials() || e._lastFailureAt !== null && Date.now() - e._lastFailureAt <
|
|
9285
|
+
return e._delta === null ? !e._api || !e._hasCredentials() || e._lastFailureAt !== null && Date.now() - e._lastFailureAt < As ? Promise.resolve(0) : (e._pending || (e._pending = e._measure().finally(() => {
|
|
9133
9286
|
e._pending = null;
|
|
9134
9287
|
})), e._pending) : Promise.resolve(e._delta);
|
|
9135
9288
|
}
|
|
@@ -9159,10 +9312,10 @@ var xs = "sessions", Ss = 5, Cs = class e {
|
|
|
9159
9312
|
return e._idsAwaitingDelta = [], await Q.fillDelta(n, t), t;
|
|
9160
9313
|
}
|
|
9161
9314
|
};
|
|
9162
|
-
h(
|
|
9315
|
+
h(js, "_api", null), h(js, "_delta", null), h(js, "_pending", null), h(js, "_idsAwaitingDelta", []), h(js, "_lastFailureAt", null);
|
|
9163
9316
|
//#endregion
|
|
9164
9317
|
//#region src/classes/stat/StatUnloadJournal.ts
|
|
9165
|
-
var
|
|
9318
|
+
var Ms = "okcls-stat-unload.", Ns = class e {
|
|
9166
9319
|
static beginTabSession() {
|
|
9167
9320
|
e._tabKey = null, e._entries = [];
|
|
9168
9321
|
}
|
|
@@ -9170,7 +9323,7 @@ var Es = "okcls-stat-unload.", Ds = class e {
|
|
|
9170
9323
|
let n = e._storage();
|
|
9171
9324
|
if (!n) return !1;
|
|
9172
9325
|
try {
|
|
9173
|
-
return e._tabKey || (e._tabKey =
|
|
9326
|
+
return e._tabKey || (e._tabKey = Ms + M.uuid()), e._entries.length > 0 && n.getItem(e._tabKey) === null && (e._entries = []), e._entries.push(t), n.setItem(e._tabKey, JSON.stringify(e._entries)), !0;
|
|
9174
9327
|
} catch (e) {
|
|
9175
9328
|
return z.error("[StatUnloadJournal] failed to write", e), !1;
|
|
9176
9329
|
}
|
|
@@ -9182,7 +9335,7 @@ var Es = "okcls-stat-unload.", Ds = class e {
|
|
|
9182
9335
|
try {
|
|
9183
9336
|
for (let e = 0; e < t.length; e += 1) {
|
|
9184
9337
|
let r = t.key(e);
|
|
9185
|
-
r && r.startsWith(
|
|
9338
|
+
r && r.startsWith(Ms) && n.push(r);
|
|
9186
9339
|
}
|
|
9187
9340
|
} catch (e) {
|
|
9188
9341
|
return z.error("[StatUnloadJournal] failed to scan journals", e), 0;
|
|
@@ -9225,32 +9378,32 @@ var Es = "okcls-stat-unload.", Ds = class e {
|
|
|
9225
9378
|
return typeof t == "object" && !!t && typeof t.uid == "number" && (t.vcid === null || typeof t.vcid == "string") && typeof t.ts == "number" && (t.delta === void 0 || t.delta === null || typeof t.delta == "number") && typeof t.ev == "object" && t.ev !== null;
|
|
9226
9379
|
}
|
|
9227
9380
|
};
|
|
9228
|
-
h(
|
|
9381
|
+
h(Ns, "_tabKey", null), h(Ns, "_entries", []);
|
|
9229
9382
|
//#endregion
|
|
9230
9383
|
//#region src/classes/stat/StatDrainScheduler.ts
|
|
9231
|
-
var
|
|
9384
|
+
var Ps = 500, Fs = 100, Is = 3e4, Ls = 1e3, Rs = 5e3, zs = 3e3, Bs = "okcls-stat-drain", Vs = class e {
|
|
9232
9385
|
static setApi(t) {
|
|
9233
|
-
e._api = t,
|
|
9386
|
+
e._api = t, js.setApi(t);
|
|
9234
9387
|
}
|
|
9235
9388
|
static start(t) {
|
|
9236
|
-
e.setApi(t),
|
|
9389
|
+
e.setApi(t), Ns.drainToQueue().catch((e) => z.error("[StatDrainScheduler] failed to import unload journal", e)).then(async () => (ks.prune(), await Q.evictOlderThan(us), await Q.evictToLimit(ls), e._drain())).catch((e) => z.error("[StatDrainScheduler] failed to start", e));
|
|
9237
9390
|
}
|
|
9238
9391
|
static notifyAppended() {
|
|
9239
9392
|
if (e._api) {
|
|
9240
|
-
if (e._localCount += 1, e._localCount >=
|
|
9393
|
+
if (e._localCount += 1, e._localCount >= Fs) {
|
|
9241
9394
|
e._drain();
|
|
9242
9395
|
return;
|
|
9243
9396
|
}
|
|
9244
|
-
e._state === "IDLE" && e._arm(
|
|
9397
|
+
e._state === "IDLE" && e._arm(Is);
|
|
9245
9398
|
}
|
|
9246
9399
|
}
|
|
9247
9400
|
static notifyCallFinished() {
|
|
9248
9401
|
if (e._api) {
|
|
9249
|
-
if (e._directBuffer.length > 0 && e._armDirect(
|
|
9402
|
+
if (e._directBuffer.length > 0 && e._armDirect(Ls), e._state === "DRAINING") {
|
|
9250
9403
|
e._callFinishedDuringDrain = !0;
|
|
9251
9404
|
return;
|
|
9252
9405
|
}
|
|
9253
|
-
e._arm(
|
|
9406
|
+
e._arm(Ls);
|
|
9254
9407
|
}
|
|
9255
9408
|
}
|
|
9256
9409
|
static drainOnce() {
|
|
@@ -9259,7 +9412,7 @@ var Os = 500, ks = 100, As = 3e4, js = 1e3, Ms = 5e3, Ns = 3e3, Ps = "okcls-stat
|
|
|
9259
9412
|
if (!t) return !1;
|
|
9260
9413
|
let n = e._currentUserId(), r = await Q.listUids(), i = !1, a = null;
|
|
9261
9414
|
for (let o of r) try {
|
|
9262
|
-
(o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) ===
|
|
9415
|
+
(o === n ? await e._drainCurrent(t, o) : await e._drainStored(t, o)) === Ps && (i = !0);
|
|
9263
9416
|
} catch (e) {
|
|
9264
9417
|
a === null && (a = e);
|
|
9265
9418
|
}
|
|
@@ -9273,20 +9426,20 @@ var Os = 500, ks = 100, As = 3e4, js = 1e3, Ms = 5e3, Ns = 3e3, Ps = "okcls-stat
|
|
|
9273
9426
|
z.error("[StatDrainScheduler] direct send skipped: event belongs to another user");
|
|
9274
9427
|
return;
|
|
9275
9428
|
}
|
|
9276
|
-
e._directBuffer.push(t), e._directTimer === null && e._armDirect(
|
|
9429
|
+
e._directBuffer.push(t), e._directTimer === null && e._armDirect(zs);
|
|
9277
9430
|
}
|
|
9278
9431
|
}
|
|
9279
9432
|
static __resetForTests() {
|
|
9280
|
-
|
|
9433
|
+
js.__resetForTests(), e._clearTimer(), e._clearDirectTimer(), e._directBuffer = [], e._api = null, e._state = "IDLE", e._localCount = 0, e._callFinishedDuringDrain = !1, e._blockedSession = null;
|
|
9281
9434
|
}
|
|
9282
9435
|
static _currentUserId() {
|
|
9283
9436
|
return y.userId;
|
|
9284
9437
|
}
|
|
9285
9438
|
static async _drainCurrent(t, n) {
|
|
9286
9439
|
if (e._isSessionBlocked()) return 0;
|
|
9287
|
-
let r = await Q.readOldest(n,
|
|
9440
|
+
let r = await Q.readOldest(n, Ps);
|
|
9288
9441
|
if (r.length === 0) return 0;
|
|
9289
|
-
let i = await
|
|
9442
|
+
let i = await js.get(), a = r.map((t) => e._toClientStats(t, i)), o = r.map((e) => e.id);
|
|
9290
9443
|
try {
|
|
9291
9444
|
await t.logClientStats(a);
|
|
9292
9445
|
} catch (t) {
|
|
@@ -9297,25 +9450,25 @@ var Os = 500, ks = 100, As = 3e4, js = 1e3, Ms = 5e3, Ns = 3e3, Ps = "okcls-stat
|
|
|
9297
9450
|
return await Q.remove(o), r.length;
|
|
9298
9451
|
}
|
|
9299
9452
|
static async _drainStored(t, n) {
|
|
9300
|
-
let r =
|
|
9301
|
-
if (!r || r.endpoint !==
|
|
9302
|
-
let i = await Q.readOldest(n,
|
|
9453
|
+
let r = ks.get(n);
|
|
9454
|
+
if (!r || r.endpoint !== ks.currentEndpoint()) return 0;
|
|
9455
|
+
let i = await Q.readOldest(n, Ps);
|
|
9303
9456
|
if (i.length === 0) return 0;
|
|
9304
|
-
let a = await
|
|
9457
|
+
let a = await js.get(), o = i.map((t) => e._toClientStats(t, a)), s = i.map((e) => e.id);
|
|
9305
9458
|
try {
|
|
9306
9459
|
await t.logClientStatsWith(r.sessionKey, o), z.debug("[StatDrainScheduler] delivered", i.length, "stored events of uid", n);
|
|
9307
9460
|
} catch (t) {
|
|
9308
|
-
if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n),
|
|
9461
|
+
if (e._isAuthError(t)) return z.error("[StatDrainScheduler] stored session expired, skipping uid", n), ks.forget(n), 0;
|
|
9309
9462
|
if (e._isRetryable(t)) throw t;
|
|
9310
9463
|
return z.error("[StatDrainScheduler] batch rejected, dropping", t), await Q.remove(s), i.length;
|
|
9311
9464
|
}
|
|
9312
9465
|
return await Q.remove(s), i.length;
|
|
9313
9466
|
}
|
|
9314
9467
|
static _withLock(e) {
|
|
9315
|
-
return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(
|
|
9468
|
+
return typeof navigator > "u" || !navigator.locks ? e() : navigator.locks.request(Bs, e);
|
|
9316
9469
|
}
|
|
9317
9470
|
static _isSessionError(e) {
|
|
9318
|
-
return
|
|
9471
|
+
return rs(e?.error_code);
|
|
9319
9472
|
}
|
|
9320
9473
|
static _isReauthorizeFailure(e) {
|
|
9321
9474
|
return e?.error === x.AUTH;
|
|
@@ -9328,7 +9481,7 @@ var Os = 500, ks = 100, As = 3e4, js = 1e3, Ms = 5e3, Ns = 3e3, Ps = "okcls-stat
|
|
|
9328
9481
|
}
|
|
9329
9482
|
static _isAuthError(t) {
|
|
9330
9483
|
let n = t?.error_code;
|
|
9331
|
-
return e._isSessionError(t) || n ===
|
|
9484
|
+
return e._isSessionError(t) || n === ns.AUTH_LOGIN;
|
|
9332
9485
|
}
|
|
9333
9486
|
static _isRetryable(t) {
|
|
9334
9487
|
if (e._isSessionError(t)) return !0;
|
|
@@ -9353,7 +9506,7 @@ var Os = 500, ks = 100, As = 3e4, js = 1e3, Ms = 5e3, Ns = 3e3, Ps = "okcls-stat
|
|
|
9353
9506
|
static async _flushDirect() {
|
|
9354
9507
|
let t = e._api, n = e._directBuffer;
|
|
9355
9508
|
if (e._directBuffer = [], !(!t || n.length === 0)) try {
|
|
9356
|
-
let r = await
|
|
9509
|
+
let r = await js.get();
|
|
9357
9510
|
await t.logClientStats(n.map((t) => e._toClientStats(t, r)));
|
|
9358
9511
|
} catch (e) {
|
|
9359
9512
|
z.error("[StatDrainScheduler] direct send failed, events lost", e);
|
|
@@ -9372,28 +9525,28 @@ var Os = 500, ks = 100, As = 3e4, js = 1e3, Ms = 5e3, Ns = 3e3, Ps = "okcls-stat
|
|
|
9372
9525
|
e._clearTimer(), e._state = "DRAINING", e._localCount = 0, e._callFinishedDuringDrain = !1;
|
|
9373
9526
|
try {
|
|
9374
9527
|
if (await e.drainOnce()) {
|
|
9375
|
-
e._arm(
|
|
9528
|
+
e._arm(Rs);
|
|
9376
9529
|
return;
|
|
9377
9530
|
}
|
|
9378
9531
|
if (e._callFinishedDuringDrain) {
|
|
9379
|
-
e._arm(
|
|
9532
|
+
e._arm(Ls);
|
|
9380
9533
|
return;
|
|
9381
9534
|
}
|
|
9382
9535
|
if (e._localCount > 0) {
|
|
9383
|
-
e._arm(
|
|
9536
|
+
e._arm(Is);
|
|
9384
9537
|
return;
|
|
9385
9538
|
}
|
|
9386
9539
|
e._state = "IDLE";
|
|
9387
9540
|
} catch (t) {
|
|
9388
|
-
z.error("[StatDrainScheduler] drain failed", t), e._arm(
|
|
9541
|
+
z.error("[StatDrainScheduler] drain failed", t), e._arm(Is);
|
|
9389
9542
|
}
|
|
9390
9543
|
}
|
|
9391
9544
|
}
|
|
9392
9545
|
};
|
|
9393
|
-
h(
|
|
9546
|
+
h(Vs, "_api", null), h(Vs, "_state", "IDLE"), h(Vs, "_timer", null), h(Vs, "_localCount", 0), h(Vs, "_callFinishedDuringDrain", !1), h(Vs, "_blockedSession", null), h(Vs, "_directBuffer", []), h(Vs, "_directTimer", null);
|
|
9394
9547
|
//#endregion
|
|
9395
9548
|
//#region src/classes/StatsLogger.ts
|
|
9396
|
-
var
|
|
9549
|
+
var Hs = class extends f {
|
|
9397
9550
|
constructor(e, t, n, r = () => void 0) {
|
|
9398
9551
|
super(), h(this, "_externalLogger", void 0), h(this, "_api", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_batchInterval", 3e3), h(this, "_batchedClientStats", []), h(this, "_batchTimeout", null), h(this, "_serverTimeDelta", 0), h(this, "_waitingForServerTime", !0), h(this, "_deferredClientStats", []), this._api = e, this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._calculateServerTimeDelta();
|
|
9399
9552
|
}
|
|
@@ -9473,7 +9626,7 @@ var Is = class extends f {
|
|
|
9473
9626
|
_now() {
|
|
9474
9627
|
return Date.now() - this._serverTimeDelta;
|
|
9475
9628
|
}
|
|
9476
|
-
},
|
|
9629
|
+
}, Us = class e extends f {
|
|
9477
9630
|
static __resetForTests() {
|
|
9478
9631
|
e._pending = [], e._pendingOverflow = !1;
|
|
9479
9632
|
}
|
|
@@ -9489,17 +9642,17 @@ var Is = class extends f {
|
|
|
9489
9642
|
return e._pending = [], e._pendingOverflow = !1, t;
|
|
9490
9643
|
}
|
|
9491
9644
|
constructor(e, t, n, r = () => void 0) {
|
|
9492
|
-
super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_unloadMode", !1), h(this, "_legacy", void 0), this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._legacy = N.statQueueEnabled ? null : new
|
|
9645
|
+
super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_unloadMode", !1), h(this, "_legacy", void 0), this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._legacy = N.statQueueEnabled ? null : new Hs(e, t, n, r);
|
|
9493
9646
|
}
|
|
9494
9647
|
log(e, t, n = !1) {
|
|
9495
9648
|
this._externalLogger && this._externalLogger.log(e, t, n);
|
|
9496
9649
|
}
|
|
9497
9650
|
enterUnloadMode() {
|
|
9498
|
-
this._legacy || (this._unloadMode = !0,
|
|
9651
|
+
this._legacy || (this._unloadMode = !0, Ns.beginTabSession());
|
|
9499
9652
|
}
|
|
9500
9653
|
exitUnloadMode() {
|
|
9501
|
-
this._legacy || !this._unloadMode || (this._unloadMode = !1,
|
|
9502
|
-
e > 0 &&
|
|
9654
|
+
this._legacy || !this._unloadMode || (this._unloadMode = !1, Ns.drainToQueue().then((e) => {
|
|
9655
|
+
e > 0 && Vs.notifyAppended();
|
|
9503
9656
|
}).catch((e) => z.error("[StatEventCollector] failed to import unload journal", e)));
|
|
9504
9657
|
}
|
|
9505
9658
|
logClientStats(t, n = {}) {
|
|
@@ -9518,11 +9671,11 @@ var Is = class extends f {
|
|
|
9518
9671
|
};
|
|
9519
9672
|
Object.keys(a).forEach((e) => {
|
|
9520
9673
|
a[e] === void 0 && delete a[e];
|
|
9521
|
-
}),
|
|
9674
|
+
}), js.ensure();
|
|
9522
9675
|
let o = {
|
|
9523
9676
|
vcid: r,
|
|
9524
9677
|
ts: i,
|
|
9525
|
-
delta:
|
|
9678
|
+
delta: js.delta(),
|
|
9526
9679
|
ev: a
|
|
9527
9680
|
}, s = y.userId;
|
|
9528
9681
|
if (s === null) {
|
|
@@ -9545,12 +9698,12 @@ var Is = class extends f {
|
|
|
9545
9698
|
}
|
|
9546
9699
|
}
|
|
9547
9700
|
_store(e) {
|
|
9548
|
-
this._unloadMode &&
|
|
9701
|
+
this._unloadMode && Ns.writeSync(e) || Q.append(e).then((t) => {
|
|
9549
9702
|
if (t !== null) {
|
|
9550
|
-
typeof e.delta != "number" &&
|
|
9703
|
+
typeof e.delta != "number" && js.noteAppended(t), Vs.notifyAppended();
|
|
9551
9704
|
return;
|
|
9552
9705
|
}
|
|
9553
|
-
z.error("[StatEventCollector] failed to store event, sending directly"),
|
|
9706
|
+
z.error("[StatEventCollector] failed to store event, sending directly"), Vs.sendDirect(e);
|
|
9554
9707
|
}).catch((e) => z.error("[StatEventCollector] failed to store event", e));
|
|
9555
9708
|
}
|
|
9556
9709
|
_getConversationId() {
|
|
@@ -9568,10 +9721,10 @@ var Is = class extends f {
|
|
|
9568
9721
|
}
|
|
9569
9722
|
}
|
|
9570
9723
|
};
|
|
9571
|
-
h(
|
|
9724
|
+
h(Us, "_pending", []), h(Us, "_pendingOverflow", !1);
|
|
9572
9725
|
//#endregion
|
|
9573
9726
|
//#region src/classes/stat/ApiCallStats.ts
|
|
9574
|
-
var
|
|
9727
|
+
var Ws = class {
|
|
9575
9728
|
constructor(e) {
|
|
9576
9729
|
h(this, "_statAggregator", void 0), this._statAggregator = e;
|
|
9577
9730
|
}
|
|
@@ -9583,7 +9736,7 @@ var Rs = class {
|
|
|
9583
9736
|
string_value: n
|
|
9584
9737
|
});
|
|
9585
9738
|
}
|
|
9586
|
-
},
|
|
9739
|
+
}, Gs = "invalid-error-metadata", Ks = 64, qs = new Set(Object.values(O)), Js = new Set(Object.values(x)), Ys = {
|
|
9587
9740
|
[O.CANCELED]: {
|
|
9588
9741
|
type: "semantic",
|
|
9589
9742
|
reason: "canceled"
|
|
@@ -9704,7 +9857,7 @@ var Rs = class {
|
|
|
9704
9857
|
type: "semantic",
|
|
9705
9858
|
reason: "obsolete_client"
|
|
9706
9859
|
}
|
|
9707
|
-
},
|
|
9860
|
+
}, Xs = {
|
|
9708
9861
|
[x.MIC_CAMERA_PERMISSION]: {
|
|
9709
9862
|
type: "direct-error",
|
|
9710
9863
|
error: {
|
|
@@ -9793,14 +9946,14 @@ var Rs = class {
|
|
|
9793
9946
|
}
|
|
9794
9947
|
}
|
|
9795
9948
|
};
|
|
9796
|
-
function
|
|
9797
|
-
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return
|
|
9949
|
+
function Zs(e) {
|
|
9950
|
+
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return Gs;
|
|
9798
9951
|
let t = String(e).trim();
|
|
9799
|
-
if (!t) return
|
|
9952
|
+
if (!t) return Gs;
|
|
9800
9953
|
let n = t.toLowerCase().replace(/[\s_:]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
9801
|
-
return !n || !/^[a-z0-9.-]+$/.test(n) ?
|
|
9954
|
+
return !n || !/^[a-z0-9.-]+$/.test(n) ? Gs : n.length > Ks ? `${n.slice(0, Ks - 3)}...` : n;
|
|
9802
9955
|
}
|
|
9803
|
-
function
|
|
9956
|
+
function Qs(e) {
|
|
9804
9957
|
if (!e || typeof e != "object") return !1;
|
|
9805
9958
|
let t = e;
|
|
9806
9959
|
switch (t.scope) {
|
|
@@ -9812,49 +9965,49 @@ function Ks(e) {
|
|
|
9812
9965
|
default: return !1;
|
|
9813
9966
|
}
|
|
9814
9967
|
}
|
|
9815
|
-
function
|
|
9816
|
-
let t =
|
|
9968
|
+
function $s(e) {
|
|
9969
|
+
let t = Zs(e.description);
|
|
9817
9970
|
if (e.scope === "unknown") return `unknown:${t}`;
|
|
9818
|
-
let n =
|
|
9971
|
+
let n = Zs(e.code);
|
|
9819
9972
|
return e.scope === "internal" ? `internal:${n}:${t}` : `${e.scope}:${e.source}:${n}:${t}`;
|
|
9820
9973
|
}
|
|
9821
|
-
function
|
|
9974
|
+
function ec(e, t) {
|
|
9822
9975
|
return t === null ? e.type === "direct-error" ? {
|
|
9823
9976
|
reason: "error",
|
|
9824
|
-
string_value:
|
|
9825
|
-
} : { reason: "failed" } :
|
|
9977
|
+
string_value: $s(e.error)
|
|
9978
|
+
} : { reason: "failed" } : Qs(t) ? {
|
|
9826
9979
|
reason: "error",
|
|
9827
|
-
string_value:
|
|
9980
|
+
string_value: $s(t)
|
|
9828
9981
|
} : { reason: "failed" };
|
|
9829
9982
|
}
|
|
9830
|
-
function
|
|
9983
|
+
function tc(e) {
|
|
9831
9984
|
if (e.hangup) {
|
|
9832
|
-
let t =
|
|
9985
|
+
let t = Ys[e.hangup];
|
|
9833
9986
|
return t ? t.type === "semantic" ? e.hangup === O.OBSOLETE_CLIENT && e.custom_error?.vchat_detailed_api_error.code ? {
|
|
9834
9987
|
reason: t.reason,
|
|
9835
9988
|
string_value: e.custom_error.vchat_detailed_api_error.code
|
|
9836
|
-
} : { reason: t.reason } :
|
|
9989
|
+
} : { reason: t.reason } : ec(t, e.callError) : { reason: "failed" };
|
|
9837
9990
|
}
|
|
9838
9991
|
if (e.error) {
|
|
9839
|
-
let t =
|
|
9840
|
-
return t ?
|
|
9992
|
+
let t = Xs[e.error];
|
|
9993
|
+
return t ? ec(t, e.callError) : { reason: "failed" };
|
|
9841
9994
|
}
|
|
9842
9995
|
return { reason: "failed" };
|
|
9843
9996
|
}
|
|
9844
|
-
function
|
|
9845
|
-
return e instanceof k ?
|
|
9997
|
+
function nc(e) {
|
|
9998
|
+
return e instanceof k ? tc(e) : typeof e == "string" && (qs.has(e) || Js.has(e)) ? tc(new k(e)) : { reason: "failed" };
|
|
9846
9999
|
}
|
|
9847
10000
|
//#endregion
|
|
9848
10001
|
//#region src/classes/stat/CallLifecycleStats.ts
|
|
9849
|
-
var
|
|
10002
|
+
var rc = {
|
|
9850
10003
|
wallNow: () => Date.now(),
|
|
9851
10004
|
monotonicNow: () => performance.now()
|
|
9852
10005
|
};
|
|
9853
|
-
function
|
|
10006
|
+
function ic(e) {
|
|
9854
10007
|
return e === "anonym_join" ? "join" : e;
|
|
9855
10008
|
}
|
|
9856
|
-
var
|
|
9857
|
-
constructor(e, t =
|
|
10009
|
+
var ac = class {
|
|
10010
|
+
constructor(e, t = rc) {
|
|
9858
10011
|
h(this, "_logger", void 0), h(this, "_clock", void 0), h(this, "_conversationId", null), h(this, "_callStartLabel", null), h(this, "_lifecycleStartedAtMonotonic", 0), h(this, "_pendingEvents", []), h(this, "_callStarted", !1), h(this, "_accepted", !1), h(this, "_firstMediaSent", !1), h(this, "_finished", !1), h(this, "_destroyed", !1), this._logger = e, this._clock = t;
|
|
9859
10012
|
}
|
|
9860
10013
|
get firstMediaSentReported() {
|
|
@@ -9866,7 +10019,7 @@ var $s = class {
|
|
|
9866
10019
|
markInitializationStarted({ source: e, conversationId: t }) {
|
|
9867
10020
|
if (this._destroyed || this._callStartLabel !== null) return;
|
|
9868
10021
|
let n = this._clock.wallNow();
|
|
9869
|
-
this._callStartLabel =
|
|
10022
|
+
this._callStartLabel = ic(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
|
|
9870
10023
|
name: U.CALL_INIT,
|
|
9871
10024
|
source: e
|
|
9872
10025
|
}, n);
|
|
@@ -9894,7 +10047,7 @@ var $s = class {
|
|
|
9894
10047
|
!this._canRecord() || this._firstMediaSent || (this._firstMediaSent = !0, this._record({ name: U.FIRST_MEDIA_SENT }));
|
|
9895
10048
|
}
|
|
9896
10049
|
markFinished(e) {
|
|
9897
|
-
this._finish(
|
|
10050
|
+
this._finish(nc(e));
|
|
9898
10051
|
}
|
|
9899
10052
|
markTerminated() {
|
|
9900
10053
|
this._finish({ reason: "terminated" });
|
|
@@ -9945,7 +10098,7 @@ var $s = class {
|
|
|
9945
10098
|
...n && { immediately: !0 }
|
|
9946
10099
|
});
|
|
9947
10100
|
}
|
|
9948
|
-
},
|
|
10101
|
+
}, oc = class {
|
|
9949
10102
|
constructor(e, t) {
|
|
9950
10103
|
h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
|
|
9951
10104
|
}
|
|
@@ -10008,7 +10161,7 @@ var $s = class {
|
|
|
10008
10161
|
this.report(e);
|
|
10009
10162
|
}), this._codecUsages.clear();
|
|
10010
10163
|
}
|
|
10011
|
-
},
|
|
10164
|
+
}, sc = class {
|
|
10012
10165
|
constructor(e) {
|
|
10013
10166
|
h(this, "_logger", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), h(this, "_lastCallStatContext", null), this._logger = e;
|
|
10014
10167
|
}
|
|
@@ -10051,7 +10204,7 @@ var $s = class {
|
|
|
10051
10204
|
for (let [t, r] of Object.entries(e)) r !== void 0 && (r === null ? delete n[t] : n[t] = r);
|
|
10052
10205
|
this._logger.logClientStats(n, { occurredAt: t });
|
|
10053
10206
|
}
|
|
10054
|
-
},
|
|
10207
|
+
}, cc = class {
|
|
10055
10208
|
constructor(e) {
|
|
10056
10209
|
if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
|
|
10057
10210
|
1,
|
|
@@ -10110,7 +10263,7 @@ var $s = class {
|
|
|
10110
10263
|
5
|
|
10111
10264
|
];
|
|
10112
10265
|
}
|
|
10113
|
-
},
|
|
10266
|
+
}, lc = class {
|
|
10114
10267
|
constructor() {
|
|
10115
10268
|
h(this, "n", 0), h(this, "mean", 0);
|
|
10116
10269
|
}
|
|
@@ -10122,9 +10275,9 @@ var $s = class {
|
|
|
10122
10275
|
get avg() {
|
|
10123
10276
|
return this.n ? this.mean : NaN;
|
|
10124
10277
|
}
|
|
10125
|
-
},
|
|
10278
|
+
}, uc = class {
|
|
10126
10279
|
constructor() {
|
|
10127
|
-
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new
|
|
10280
|
+
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new lc()), h(this, "p50", new cc(.5)), h(this, "p95", new cc(.95));
|
|
10128
10281
|
}
|
|
10129
10282
|
add(e) {
|
|
10130
10283
|
e < this.minVal && (this.minVal = e), e > this.maxVal && (this.maxVal = e), this.mean.add(e), this.p50.add(e), this.p95.add(e), this.count++;
|
|
@@ -10142,11 +10295,11 @@ var $s = class {
|
|
|
10142
10295
|
get hasData() {
|
|
10143
10296
|
return this.count > 0;
|
|
10144
10297
|
}
|
|
10145
|
-
},
|
|
10298
|
+
}, dc = class {
|
|
10146
10299
|
constructor(e) {
|
|
10147
10300
|
h(this, "_logger", void 0), h(this, "trackerByTransport", {
|
|
10148
|
-
ws: new
|
|
10149
|
-
wt: new
|
|
10301
|
+
ws: new uc(),
|
|
10302
|
+
wt: new uc()
|
|
10150
10303
|
}), h(this, "lastSeen", {}), this._logger = e;
|
|
10151
10304
|
}
|
|
10152
10305
|
mark(e) {
|
|
@@ -10175,17 +10328,17 @@ var $s = class {
|
|
|
10175
10328
|
}
|
|
10176
10329
|
destroy() {
|
|
10177
10330
|
this.trackerByTransport = {
|
|
10178
|
-
ws: new
|
|
10179
|
-
wt: new
|
|
10331
|
+
ws: new uc(),
|
|
10332
|
+
wt: new uc()
|
|
10180
10333
|
}, this.lastSeen = {};
|
|
10181
10334
|
}
|
|
10182
|
-
},
|
|
10335
|
+
}, fc = class {
|
|
10183
10336
|
constructor(e) {
|
|
10184
10337
|
h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
|
|
10185
10338
|
}
|
|
10186
10339
|
mark(e, t, n) {
|
|
10187
10340
|
let r = `${e}|${n}`, i;
|
|
10188
|
-
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new
|
|
10341
|
+
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new uc(), this.trackerByCommand.set(r, i)), i.add(t);
|
|
10189
10342
|
}
|
|
10190
10343
|
logMetrics() {
|
|
10191
10344
|
for (let [e, t] of this.trackerByCommand.entries()) {
|
|
@@ -10207,9 +10360,9 @@ var $s = class {
|
|
|
10207
10360
|
destroy() {
|
|
10208
10361
|
this.trackerByCommand.clear();
|
|
10209
10362
|
}
|
|
10210
|
-
},
|
|
10363
|
+
}, pc = class {
|
|
10211
10364
|
constructor(e, t, n, r) {
|
|
10212
|
-
h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "apiCalls", void 0), h(this, "_api", void 0), h(this, "_unloading", !1), this.logger = new
|
|
10365
|
+
h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "apiCalls", void 0), h(this, "_api", void 0), h(this, "_unloading", !1), this.logger = new Us(e, t, n, r), this.lifecycle = new ac(this.logger), this.statAggregator = new sc(this.logger), this.codecStatsAggregator = new oc(this.logger, r), this.pings = new dc(this.logger), this.signalingCommands = new fc(this.logger), this.apiCalls = new Ws(this.statAggregator), this._api = e, this._api.setApiCallStats(this.apiCalls);
|
|
10213
10366
|
}
|
|
10214
10367
|
prepareForUnload() {
|
|
10215
10368
|
N.statQueueEnabled && (this._unloading = !0, this.logger.enterUnloadMode(), this.pings.logMetrics(), this.signalingCommands.logMetrics());
|
|
@@ -10224,9 +10377,9 @@ var $s = class {
|
|
|
10224
10377
|
this.codecStatsAggregator.destroy(), this.pings.logMetrics(), this.pings.destroy(), this.signalingCommands.logMetrics(), this.signalingCommands.destroy();
|
|
10225
10378
|
}
|
|
10226
10379
|
destroy() {
|
|
10227
|
-
this._api.setApiCallStats(null), this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.logger.destroy(), N.statQueueEnabled && !this._unloading &&
|
|
10380
|
+
this._api.setApiCallStats(null), this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.logger.destroy(), N.statQueueEnabled && !this._unloading && Vs.notifyCallFinished();
|
|
10228
10381
|
}
|
|
10229
|
-
},
|
|
10382
|
+
}, mc = class {
|
|
10230
10383
|
constructor(e) {
|
|
10231
10384
|
h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
|
|
10232
10385
|
}
|
|
@@ -10251,8 +10404,8 @@ var $s = class {
|
|
|
10251
10404
|
call_type: this._callType
|
|
10252
10405
|
}));
|
|
10253
10406
|
}
|
|
10254
|
-
},
|
|
10255
|
-
function
|
|
10407
|
+
}, hc = 1e3, gc = 1e4;
|
|
10408
|
+
function _c(e, t, n, r) {
|
|
10256
10409
|
return new k(e, {
|
|
10257
10410
|
callError: {
|
|
10258
10411
|
scope: "external",
|
|
@@ -10263,11 +10416,11 @@ function dc(e, t, n, r) {
|
|
|
10263
10416
|
message: r
|
|
10264
10417
|
});
|
|
10265
10418
|
}
|
|
10266
|
-
var
|
|
10419
|
+
var vc = 15, $ = class e extends b {
|
|
10267
10420
|
constructor(e, t) {
|
|
10268
|
-
super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Mr()), h(this, "_serverTimeOffset", 0), h(this, "_delayedHangup", !1), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_reservedId", null), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo",
|
|
10421
|
+
super(), h(this, "_api", void 0), h(this, "_signaling", void 0), h(this, "_signalingActor", void 0), h(this, "_displayLayoutRequester", void 0), h(this, "_mediaSource", null), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Mr()), h(this, "_serverTimeOffset", 0), h(this, "_delayedHangup", !1), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_reservedId", null), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo", Fo((e) => {
|
|
10269
10422
|
if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
|
|
10270
|
-
})), h(this, "_toggleLocalAudio",
|
|
10423
|
+
})), h(this, "_toggleLocalAudio", Fo((e) => {
|
|
10271
10424
|
if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
|
|
10272
10425
|
})), h(this, "_changeMediaSettings", M.debounce(async (e) => {
|
|
10273
10426
|
if (this._signaling.ready) try {
|
|
@@ -10279,7 +10432,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10279
10432
|
captureAudio: !1
|
|
10280
10433
|
});
|
|
10281
10434
|
}
|
|
10282
|
-
}, 100)), this._stats = new
|
|
10435
|
+
}, 100)), this._stats = new pc(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology), this._api = e, this._signaling = new oo(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new Jo(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new Wo({
|
|
10283
10436
|
api: this._api,
|
|
10284
10437
|
debug: this._debug,
|
|
10285
10438
|
getParticipants: () => this._participants,
|
|
@@ -10290,13 +10443,13 @@ var fc = 15, $ = class e extends b {
|
|
|
10290
10443
|
this._stopFirstMediaSentProbe(), this._conversation && this._api && this._sendHangupApi(this._conversation.id, this._state === "IDLE" ? O.CANCELED : O.HUNGUP), this._stats.prepareForUnload(), this._stats.destroy();
|
|
10291
10444
|
}, this._onRestore = () => {
|
|
10292
10445
|
this._stats.restoreAfterUnload();
|
|
10293
|
-
}, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), this._statFirstMediaReceived = new
|
|
10446
|
+
}, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), this._statFirstMediaReceived = new mc(this._stats.statAggregator), this._audioOutput = new Lo(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), hc));
|
|
10294
10447
|
}
|
|
10295
10448
|
static current() {
|
|
10296
10449
|
return B.getActive() ?? (N.hold ? null : B.getFirst());
|
|
10297
10450
|
}
|
|
10298
10451
|
static hangupAfterInit(e) {
|
|
10299
|
-
let t =
|
|
10452
|
+
let t = yc;
|
|
10300
10453
|
if (t) {
|
|
10301
10454
|
if (typeof e == "function" && (t._onFastHangup = e), t._delayedHangup === !1 && !t._conversation) {
|
|
10302
10455
|
t._delayedHangup = !0, t._abortController?.abort(new k(O.CANCELED));
|
|
@@ -10324,7 +10477,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10324
10477
|
return this._state === "HELD";
|
|
10325
10478
|
}
|
|
10326
10479
|
get isIncomingRinging() {
|
|
10327
|
-
return this._conversation?.direction ===
|
|
10480
|
+
return this._conversation?.direction === so.INCOMING && this._state === "IDLE";
|
|
10328
10481
|
}
|
|
10329
10482
|
static debugSessionId() {
|
|
10330
10483
|
return e.current()?.debugSessionId ?? null;
|
|
@@ -10350,7 +10503,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10350
10503
|
R.onNonFatalError(Error(e), this.id);
|
|
10351
10504
|
}
|
|
10352
10505
|
getIncomingCallerExternalId() {
|
|
10353
|
-
return this._conversation?.direction ===
|
|
10506
|
+
return this._conversation?.direction === so.INCOMING ? Object.values(this._participants).find((e) => !this._isMe(e.id))?.externalId ?? null : null;
|
|
10354
10507
|
}
|
|
10355
10508
|
_buildInternalParams() {
|
|
10356
10509
|
let e = {
|
|
@@ -10360,24 +10513,24 @@ var fc = 15, $ = class e extends b {
|
|
|
10360
10513
|
platform: N.platform,
|
|
10361
10514
|
protocolVersion: N.protocolVersion,
|
|
10362
10515
|
domainId: N.domain,
|
|
10363
|
-
capabilities:
|
|
10516
|
+
capabilities: Va.getFlags()
|
|
10364
10517
|
};
|
|
10365
10518
|
return JSON.stringify(e);
|
|
10366
10519
|
}
|
|
10367
10520
|
async onStart({ opponentIds: e, opponentType: t, mediaOptions: n, payload: r = "", joiningAllowed: i = !1, requireAuthToJoin: a = !1, onlyAdminCanShareMovie: o, externalIds: s, onFastStart: c, conversationId: l }) {
|
|
10368
|
-
let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t ===
|
|
10521
|
+
let u = l ?? M.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t === co.USER && d === 1 ? N.calleeUnavailableWaitingTime : void 0;
|
|
10369
10522
|
this._stats.lifecycle.markInitializationStarted({
|
|
10370
10523
|
source: "outgoing",
|
|
10371
10524
|
conversationId: u
|
|
10372
|
-
}), this._debug.setConversationId(u),
|
|
10525
|
+
}), this._debug.setConversationId(u), yc = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
10373
10526
|
try {
|
|
10374
10527
|
this._mediaSource = this._createMediaSource(), await this._mediaSource.request(n);
|
|
10375
10528
|
let l = this._mediaSource.mediaSettings;
|
|
10376
|
-
t ===
|
|
10529
|
+
t === co.CHAT || e && e.length > 1 ? this._logWithMediaSettings(C.OUTGOING_MULTIPARTY_CALL, l) : this._logWithMediaSettings(C.OUTGOING_CALL, l);
|
|
10377
10530
|
let d = await this._startConversation({
|
|
10378
10531
|
opponentIds: e,
|
|
10379
10532
|
opponentType: t,
|
|
10380
|
-
direction:
|
|
10533
|
+
direction: so.OUTGOING,
|
|
10381
10534
|
mediaOptions: n,
|
|
10382
10535
|
payload: r,
|
|
10383
10536
|
joiningAllowed: i,
|
|
@@ -10401,18 +10554,18 @@ var fc = 15, $ = class e extends b {
|
|
|
10401
10554
|
let e = B.get(this._conversation.id);
|
|
10402
10555
|
e && e !== this && e._close(new k(O.HUNGUP, { remote: !0 }));
|
|
10403
10556
|
}
|
|
10404
|
-
return B.add(this), await B.setActive(this.id),
|
|
10557
|
+
return B.add(this), await B.setActive(this.id), yc = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
|
|
10405
10558
|
this._calleeUnavailableTimer = null, this._close(new k(O.CALLEE_UNAVAILABLE), { signalingReason: O.CANCELED });
|
|
10406
10559
|
}, f)), this._conversation;
|
|
10407
10560
|
} catch (e) {
|
|
10408
|
-
throw
|
|
10561
|
+
throw yc = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to start conversation" }), e;
|
|
10409
10562
|
}
|
|
10410
10563
|
}
|
|
10411
10564
|
async onJoin(e) {
|
|
10412
10565
|
this._stats.lifecycle.markInitializationStarted({
|
|
10413
10566
|
source: e.anonymous ? "anonym_join" : "join",
|
|
10414
10567
|
conversationId: e.conversationId
|
|
10415
|
-
}),
|
|
10568
|
+
}), yc = this, this._state = "PROCESSING", this._debug.setConversationId(e.conversationId ?? null), this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
10416
10569
|
try {
|
|
10417
10570
|
let t = !!e.observedIds?.length;
|
|
10418
10571
|
if (t && N.videoTracksCount > 0) throw this._debug.error("Observer mode: please set videoTracksCount=0"), new k(O.UNSUPPORTED, { callError: {
|
|
@@ -10429,9 +10582,9 @@ var fc = 15, $ = class e extends b {
|
|
|
10429
10582
|
code: "conversation",
|
|
10430
10583
|
description: "not-initialized-after-join"
|
|
10431
10584
|
} });
|
|
10432
|
-
return this._conversation.observer = t, R.onLocalStream(this._mediaSource.getStream(), n, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), B.add(this),
|
|
10585
|
+
return this._conversation.observer = t, R.onLocalStream(this._mediaSource.getStream(), n, this.id), this._conversation.waitForAdmin || this._conversation.waitingHall ? (this._debug.log(this._conversation.waitForAdmin ? "Wait for admin" : "In waiting hall"), B.add(this), yc = null, this._signaling.readyToSend(), R.onLocalStatus(this._conversation.waitForAdmin ? P.WAIT_FOR_ADMIN : P.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(r);
|
|
10433
10586
|
} catch (e) {
|
|
10434
|
-
throw
|
|
10587
|
+
throw yc = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
10435
10588
|
}
|
|
10436
10589
|
}
|
|
10437
10590
|
async _onJoinPart2(e, t = !0, n = !1) {
|
|
@@ -10446,7 +10599,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10446
10599
|
if (this._delayedHangup) throw new k(O.CANCELED);
|
|
10447
10600
|
this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
|
|
10448
10601
|
let r = this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
|
|
10449
|
-
R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (B.add(this), n ? await this._holdLocally() : await B.setActive(this.id),
|
|
10602
|
+
R.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), R.onLocalStatus(P.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (B.add(this), n ? await this._holdLocally() : await B.setActive(this.id), yc = null);
|
|
10450
10603
|
let i = this._extractLocalParticipantFromConnection(e);
|
|
10451
10604
|
if (i) {
|
|
10452
10605
|
let e = M.mapParticipantState(i);
|
|
@@ -10454,7 +10607,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10454
10607
|
}
|
|
10455
10608
|
return t && this._openTransport(Object.values(this._participants), !1), this._conversation;
|
|
10456
10609
|
} catch (e) {
|
|
10457
|
-
throw
|
|
10610
|
+
throw yc = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
10458
10611
|
}
|
|
10459
10612
|
}
|
|
10460
10613
|
_extractExternalRooms(e) {
|
|
@@ -10474,7 +10627,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10474
10627
|
B.reserve(e), this._reservedId = e, a && this._api.setUserId(a), this._stats.lifecycle.markInitializationStarted({
|
|
10475
10628
|
source: "incoming",
|
|
10476
10629
|
conversationId: e
|
|
10477
|
-
}), this._debug.setConversationId(e),
|
|
10630
|
+
}), this._debug.setConversationId(e), yc = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
10478
10631
|
try {
|
|
10479
10632
|
let a = await this._prepareConversation(e, t, n, r, i);
|
|
10480
10633
|
if (this._mediaSource = this._createMediaSource(), !this._conversation) throw new k(O.UNKNOWN_ERROR, { callError: {
|
|
@@ -10483,20 +10636,20 @@ var fc = 15, $ = class e extends b {
|
|
|
10483
10636
|
description: "incoming-not-initialized"
|
|
10484
10637
|
} });
|
|
10485
10638
|
if (!a.conversation.participants.find((e) => e.state === X.CALLED && e.id === this._conversation?.userId)) throw this._debug.log("Push rejected (there is an active call)"), this._stats.logger.log(C.PUSH, "rejected"), new k(O.REJECTED);
|
|
10486
|
-
if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(C.PUSH, "accepted"), B.add(this),
|
|
10639
|
+
if (await this._processConnection(a), this._extractConnectionUrlSharingInfo(a), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._processPinnedParticipants(a), this._signaling.readyToSend(), this._stats.lifecycle.markCallStarted(), this._stats.logger.log(C.PUSH, "accepted"), B.add(this), yc = null, this._delayedHangup) throw new k(O.CANCELED);
|
|
10487
10640
|
} catch (e) {
|
|
10488
|
-
throw
|
|
10641
|
+
throw yc = null, this._cleanupRegistry(), this._close(e, {
|
|
10489
10642
|
errorText: "Unable to handle inbound call push",
|
|
10490
10643
|
signalingReason: e instanceof k && e.hangup === O.BUSY ? O.BUSY : void 0
|
|
10491
10644
|
}), e;
|
|
10492
10645
|
}
|
|
10493
10646
|
}
|
|
10494
10647
|
_isInWaitingHall(e) {
|
|
10495
|
-
return !e.conversation || !e.conversation.options.includes(
|
|
10648
|
+
return !e.conversation || !e.conversation.options.includes(fo.WAITING_HALL) ? !1 : this._isRestricted(e);
|
|
10496
10649
|
}
|
|
10497
10650
|
_isWaitForAdmin(e) {
|
|
10498
10651
|
if (!e.conversation) return !1;
|
|
10499
|
-
let t = e.conversation.options.includes(
|
|
10652
|
+
let t = e.conversation.options.includes(fo.WAIT_FOR_ADMIN), n = e.conversation.options.includes(fo.ADMIN_IS_HERE);
|
|
10500
10653
|
return !t || t && n ? !1 : this._isRestricted(e);
|
|
10501
10654
|
}
|
|
10502
10655
|
_isRestricted(e) {
|
|
@@ -10504,7 +10657,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10504
10657
|
return t && t.restricted || !1;
|
|
10505
10658
|
}
|
|
10506
10659
|
_isAudienceMode(e) {
|
|
10507
|
-
return e.conversation?.options?.includes(
|
|
10660
|
+
return e.conversation?.options?.includes(fo.AUDIENCE_MODE) || !1;
|
|
10508
10661
|
}
|
|
10509
10662
|
_isAudienceModeListener() {
|
|
10510
10663
|
return this._conversation?.audienceMode && this._conversation?.restricted;
|
|
@@ -10534,7 +10687,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10534
10687
|
let i = atob(n), a = new Uint8Array(i.length);
|
|
10535
10688
|
for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
|
|
10536
10689
|
try {
|
|
10537
|
-
let e =
|
|
10690
|
+
let e = Po(a, r).reduce((e, t) => (e += String.fromCharCode(t), e), ""), { srcp: t, stne: n, tkn: i, trne: o, trnp: s, trnu: c, wse: l, wte: u } = JSON.parse(e);
|
|
10538
10691
|
return {
|
|
10539
10692
|
token: i,
|
|
10540
10693
|
endpoint: l,
|
|
@@ -10737,10 +10890,10 @@ var fc = 15, $ = class e extends b {
|
|
|
10737
10890
|
let t = await this._api.getConversationParams(e);
|
|
10738
10891
|
this._debug.debug("Api.getConversationParams", t);
|
|
10739
10892
|
let { turn_server: n, stun_server: r } = t;
|
|
10740
|
-
return N.iceServers =
|
|
10893
|
+
return N.iceServers = No(r, n), N.wssBase = t.endpoint, t.wt_endpoint && (N.wtsBase = t.wt_endpoint), N.wssToken = t.token, t.client_type && (N.clientType = t.client_type), t.external_user_type && (N.externalUserType = t.external_user_type), t;
|
|
10741
10894
|
}
|
|
10742
10895
|
_setConversationParams({ turn_server: e, stun_server: t, endpoint: n, wt_endpoint: r, token: i, client_type: a }) {
|
|
10743
|
-
N.iceServers =
|
|
10896
|
+
N.iceServers = No(t, e), N.wssBase = n, N.wssToken = i, r && (N.wtsBase = r), a && (N.clientType = a);
|
|
10744
10897
|
}
|
|
10745
10898
|
_buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
|
|
10746
10899
|
let s = new URL(e), c = s.searchParams;
|
|
@@ -10772,10 +10925,10 @@ var fc = 15, $ = class e extends b {
|
|
|
10772
10925
|
isVideo: f,
|
|
10773
10926
|
joiningAllowed: a,
|
|
10774
10927
|
requireAuthToJoin: o
|
|
10775
|
-
}, this._abortController?.signal), !e) throw
|
|
10928
|
+
}, this._abortController?.signal), !e) throw _c(O.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
|
|
10776
10929
|
if (!e.internalCallerParams) {
|
|
10777
10930
|
let t = e.rejectedParticipants[0]?.status;
|
|
10778
|
-
throw
|
|
10931
|
+
throw _c(O.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
|
|
10779
10932
|
}
|
|
10780
10933
|
} catch (e) {
|
|
10781
10934
|
throw this._delayedHangup && this._abortController?.signal.aborted ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_START_ERROR, { message: e.message }) : new k(O.FAST_START_ERROR, { message: String(e) });
|
|
@@ -10797,10 +10950,10 @@ var fc = 15, $ = class e extends b {
|
|
|
10797
10950
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
10798
10951
|
}, this._debug.debug("FastStart", p), m = "fastStart";
|
|
10799
10952
|
} catch {
|
|
10800
|
-
throw
|
|
10953
|
+
throw _c(O.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
|
|
10801
10954
|
}
|
|
10802
10955
|
} else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
|
|
10803
|
-
|
|
10956
|
+
Ro(p, m), this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
|
|
10804
10957
|
let ee = await this._connectSignaling(br.START, p);
|
|
10805
10958
|
return this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
|
|
10806
10959
|
}
|
|
@@ -10825,9 +10978,9 @@ var fc = 15, $ = class e extends b {
|
|
|
10825
10978
|
joinLink: i,
|
|
10826
10979
|
isVideo: c,
|
|
10827
10980
|
internalParams: this._buildInternalParams()
|
|
10828
|
-
}, this._abortController?.signal), !e) throw
|
|
10829
|
-
if (!e.internalCallerParams) throw
|
|
10830
|
-
if (!e.conversationId) throw
|
|
10981
|
+
}, this._abortController?.signal), !e) throw _c(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
|
|
10982
|
+
if (!e.internalCallerParams) throw _c(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
|
|
10983
|
+
if (!e.conversationId) throw _c(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
|
|
10831
10984
|
} catch (e) {
|
|
10832
10985
|
throw this._delayedHangup && this._abortController?.signal.aborted ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_JOIN_ERROR, { message: e.message }) : new k(O.FAST_JOIN_ERROR, { message: String(e) });
|
|
10833
10986
|
}
|
|
@@ -10845,7 +10998,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10845
10998
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
10846
10999
|
}, this._debug.debug("FastJoin", l), u = "fastJoin";
|
|
10847
11000
|
} catch (e) {
|
|
10848
|
-
throw e instanceof k ? e :
|
|
11001
|
+
throw e instanceof k ? e : _c(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
|
|
10849
11002
|
}
|
|
10850
11003
|
} else if (t) l = await this._api.joinConversation(t, c, r), u = "joinConversation";
|
|
10851
11004
|
else if (i) l = await this._api.joinConversationByLink(i, c, a, o), u = "joinConversationByLink";
|
|
@@ -10854,13 +11007,13 @@ var fc = 15, $ = class e extends b {
|
|
|
10854
11007
|
code: "join",
|
|
10855
11008
|
description: "target-missing"
|
|
10856
11009
|
} });
|
|
10857
|
-
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id),
|
|
11010
|
+
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), Ro(l, u), l.id) {
|
|
10858
11011
|
if (B.has(l.id)) throw new k(O.HAS_ACTIVE_CALL);
|
|
10859
11012
|
B.reserve(l.id), this._reservedId = l.id;
|
|
10860
11013
|
}
|
|
10861
11014
|
this._setConversationParams(l);
|
|
10862
11015
|
let d = await this._connectSignaling(br.JOIN, l);
|
|
10863
|
-
return this._setConversation(l, d,
|
|
11016
|
+
return this._setConversation(l, d, so.JOINING), this._stats.lifecycle.markCallStarted(), d;
|
|
10864
11017
|
}
|
|
10865
11018
|
async _prepareConversation(e, t = j.USER, n, r, i) {
|
|
10866
11019
|
G.setMark(U.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
|
|
@@ -10922,7 +11075,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10922
11075
|
}), l.wt_endpoint = c);
|
|
10923
11076
|
}
|
|
10924
11077
|
let u = await this._connectSignaling(br.ACCEPT, l);
|
|
10925
|
-
return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(C.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._setConversation(l, u,
|
|
11078
|
+
return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(C.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._setConversation(l, u, so.INCOMING, t), u);
|
|
10926
11079
|
}
|
|
10927
11080
|
_createParticipant(e, t, n = !0) {
|
|
10928
11081
|
let r = Object.assign({
|
|
@@ -10949,7 +11102,7 @@ var fc = 15, $ = class e extends b {
|
|
|
10949
11102
|
let e = this._getParticipantId(t ?? r.id);
|
|
10950
11103
|
e && (r.externalId = e);
|
|
10951
11104
|
}
|
|
10952
|
-
return n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && r.externalId && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus =
|
|
11105
|
+
return n && i && this._api.cacheExternalId(t ?? r.id, r.externalId), t && this._api.mapDecorativeId(t, r.id), r.observedIds?.length && r.externalId && (r.externalId.observer = !0), e.markers && (r.markers = this._denormalizeMarkers(r.id, e.markers)), r.connectionStatus = So.create(r.connectionStatus), r;
|
|
10953
11106
|
}
|
|
10954
11107
|
_getParticipantId(e) {
|
|
10955
11108
|
let t = this._api.userId(e);
|
|
@@ -11028,7 +11181,7 @@ var fc = 15, $ = class e extends b {
|
|
|
11028
11181
|
}
|
|
11029
11182
|
_createMediaSource() {
|
|
11030
11183
|
let e = new Yt(this._debug, this._stats.logger);
|
|
11031
|
-
return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new
|
|
11184
|
+
return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Io(e, this._debug, this._stats.logger), e;
|
|
11032
11185
|
}
|
|
11033
11186
|
async _connectSignaling(e, t) {
|
|
11034
11187
|
this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, xr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, xr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, xr.RECONNECT, this._onSignalingReconnect.bind(this));
|
|
@@ -11036,7 +11189,7 @@ var fc = 15, $ = class e extends b {
|
|
|
11036
11189
|
return this._stats.statAggregator.logEventualStatSinceMark({ name: U.SIGNALING_CONNECTED }), n;
|
|
11037
11190
|
}
|
|
11038
11191
|
async _processConnection(e) {
|
|
11039
|
-
await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(
|
|
11192
|
+
await this._registerConnectionParticipants(e), this._processRooms(e), this._processMuteStates(e), this._processRecordInfos(e), this._onOptionsChanged(e.conversation.options), e.chatRoom && e.chatRoom.totalCount && this._onChatRoomUpdated(lo.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
|
|
11040
11193
|
}
|
|
11041
11194
|
_onConversationParticipantListChunk(e) {
|
|
11042
11195
|
let t = e.participants;
|
|
@@ -11105,7 +11258,7 @@ var fc = 15, $ = class e extends b {
|
|
|
11105
11258
|
_registerParticipantLocalMuteState({ muteStates: e, unmuteOptions: t }) {
|
|
11106
11259
|
if (!e) return;
|
|
11107
11260
|
let n = async () => {
|
|
11108
|
-
let n =
|
|
11261
|
+
let n = Eo(e, ho.MUTE), r = Eo(e, ho.MUTE_PERMANENT);
|
|
11109
11262
|
for (let i of [n, r]) i.length && await this._onMuteParticipant({
|
|
11110
11263
|
muteStates: e,
|
|
11111
11264
|
unmuteOptions: t,
|
|
@@ -11119,8 +11272,8 @@ var fc = 15, $ = class e extends b {
|
|
|
11119
11272
|
if (!(!N.enableSessionStateUpdates || this._isMe(e))) return t;
|
|
11120
11273
|
}
|
|
11121
11274
|
_buildConnectionStatus(e, t, n, r = !1) {
|
|
11122
|
-
return
|
|
11123
|
-
transport: r ? P.ONHOLD :
|
|
11275
|
+
return So.create({
|
|
11276
|
+
transport: r ? P.ONHOLD : So.fromTransportState(n) ?? P.WAITING,
|
|
11124
11277
|
sessionState: this._remoteParticipantSessionState(e, t),
|
|
11125
11278
|
sessionStateApplicable: this._isParticipantSessionStateApplicable(e)
|
|
11126
11279
|
});
|
|
@@ -11129,12 +11282,12 @@ var fc = 15, $ = class e extends b {
|
|
|
11129
11282
|
return N.enableSessionStateUpdates && !this._isMe(e) && this._conversation?.topology === J.SERVER;
|
|
11130
11283
|
}
|
|
11131
11284
|
_setTransportStatus(e, t) {
|
|
11132
|
-
return
|
|
11285
|
+
return So.setTransport(e.connectionStatus, t);
|
|
11133
11286
|
}
|
|
11134
11287
|
_setSessionState(e, t) {
|
|
11135
|
-
let n =
|
|
11288
|
+
let n = So.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
11136
11289
|
this._emitParticipantTransition(e, n);
|
|
11137
|
-
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i =
|
|
11290
|
+
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === P.CONNECTED, i = So.setSessionState(e.connectionStatus, t, r);
|
|
11138
11291
|
return this._emitParticipantTransition(e, i), i;
|
|
11139
11292
|
}
|
|
11140
11293
|
_emitParticipantTransition(e, t, n = null) {
|
|
@@ -11205,11 +11358,11 @@ var fc = 15, $ = class e extends b {
|
|
|
11205
11358
|
this._onRoomSwitched(t, !0);
|
|
11206
11359
|
}
|
|
11207
11360
|
_processMuteStates(e, t = !1) {
|
|
11208
|
-
let n =
|
|
11361
|
+
let n = Do(e);
|
|
11209
11362
|
this._setMuteStatesForRoomId(n, null);
|
|
11210
11363
|
for (let t of e.rooms?.rooms ?? []) this._setMuteStatesForRoomId(t.muteStates, t.id);
|
|
11211
11364
|
let r = this._getMuteStatesForCurrentRoom();
|
|
11212
|
-
t && (r =
|
|
11365
|
+
t && (r = jo(e, r));
|
|
11213
11366
|
let i = Object.keys(r), a = this._conversation?.roomId;
|
|
11214
11367
|
i.length && this._onMuteParticipant({
|
|
11215
11368
|
muteStates: r,
|
|
@@ -11229,15 +11382,15 @@ var fc = 15, $ = class e extends b {
|
|
|
11229
11382
|
}
|
|
11230
11383
|
_allocateTransport() {
|
|
11231
11384
|
if (!this._conversation || !this._mediaSource) return;
|
|
11232
|
-
this._transport = new
|
|
11233
|
-
let e = this._conversation.direction ===
|
|
11385
|
+
this._transport = new ka(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback()), this._debugInfo = new Uo(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
|
|
11386
|
+
let e = this._conversation.direction === so.OUTGOING && !this._conversation.concurrent, t = this._participants;
|
|
11234
11387
|
for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
|
|
11235
11388
|
}
|
|
11236
11389
|
_createSpeakerDetector() {
|
|
11237
|
-
this._transport && this._conversation && (this._volumesDetector = new
|
|
11390
|
+
this._transport && this._conversation && (this._volumesDetector = new Xo(this._transport), this.subscribe(this._volumesDetector, Yo.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new Qo(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, Zo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new qo(this._mediaSource));
|
|
11238
11391
|
}
|
|
11239
11392
|
_createSpecListener() {
|
|
11240
|
-
this._transport && this._volumesDetector && (this._specListener = new
|
|
11393
|
+
this._transport && this._volumesDetector && (this._specListener = new ts(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
|
|
11241
11394
|
}
|
|
11242
11395
|
_logDevices() {
|
|
11243
11396
|
let e = E.getCameras().length, t = E.getMicrophones().length;
|
|
@@ -11336,7 +11489,7 @@ var fc = 15, $ = class e extends b {
|
|
|
11336
11489
|
_onRemoveParticipant(e) {
|
|
11337
11490
|
this._debug.debug(`Remove participant [${e}]`);
|
|
11338
11491
|
let t = [], n = this._participants;
|
|
11339
|
-
for (let r = 0; r <=
|
|
11492
|
+
for (let r = 0; r <= vc; r++) {
|
|
11340
11493
|
let i = n[M.compose(e, r)];
|
|
11341
11494
|
i && t.push(i);
|
|
11342
11495
|
}
|
|
@@ -11426,11 +11579,11 @@ var fc = 15, $ = class e extends b {
|
|
|
11426
11579
|
this._waitingHallHoldPending = !1, await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus()), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener();
|
|
11427
11580
|
return;
|
|
11428
11581
|
}
|
|
11429
|
-
let n =
|
|
11582
|
+
let n = za.get();
|
|
11430
11583
|
await this._signaling.hold(!1, n), this._restoreStateAfterHold();
|
|
11431
11584
|
let r = null;
|
|
11432
11585
|
if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(this._participants), r.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._resumeLocalMedia(t, P.WAITING), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._state === "ACTIVE") {
|
|
11433
|
-
let e = this._conversation?.direction ===
|
|
11586
|
+
let e = this._conversation?.direction === so.OUTGOING && !this._conversation.concurrent;
|
|
11434
11587
|
this._openTransport(r ?? Object.values(this._participants), e);
|
|
11435
11588
|
}
|
|
11436
11589
|
}
|
|
@@ -11553,13 +11706,13 @@ var fc = 15, $ = class e extends b {
|
|
|
11553
11706
|
let n = Fn(e), a = i[n.participantId];
|
|
11554
11707
|
if (a) {
|
|
11555
11708
|
let e;
|
|
11556
|
-
typeof t == "number" ? e =
|
|
11709
|
+
typeof t == "number" ? e = vo(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = _o.UNKNOWN_ERROR), r.push({
|
|
11557
11710
|
externalId: a.externalId,
|
|
11558
11711
|
errorReason: e
|
|
11559
11712
|
});
|
|
11560
11713
|
}
|
|
11561
11714
|
}
|
|
11562
|
-
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new
|
|
11715
|
+
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new bc("Could not allocate one or more participants", r);
|
|
11563
11716
|
}
|
|
11564
11717
|
async _cleanupCooldownQueue() {
|
|
11565
11718
|
let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
|
|
@@ -11567,7 +11720,7 @@ var fc = 15, $ = class e extends b {
|
|
|
11567
11720
|
let n = t.next();
|
|
11568
11721
|
if (n.done) break;
|
|
11569
11722
|
let r = n.value;
|
|
11570
|
-
if (r[1] +
|
|
11723
|
+
if (r[1] + gc > Date.now()) break;
|
|
11571
11724
|
let i = r[0];
|
|
11572
11725
|
await this._stopStreaming(i), e[i] = { stopStream: !0 };
|
|
11573
11726
|
} while (!0);
|
|
@@ -11771,10 +11924,10 @@ var fc = 15, $ = class e extends b {
|
|
|
11771
11924
|
throw Error("transport is not initialized");
|
|
11772
11925
|
}
|
|
11773
11926
|
_isCallAdmin() {
|
|
11774
|
-
return this._conversation ? M.includesOneOf(this._conversation.roles, [
|
|
11927
|
+
return this._conversation ? M.includesOneOf(this._conversation.roles, [yo.ADMIN, yo.CREATOR]) : !1;
|
|
11775
11928
|
}
|
|
11776
11929
|
_checkAdminRole() {
|
|
11777
|
-
if (this._conversation && !M.includesOneOf(this._conversation.roles, [
|
|
11930
|
+
if (this._conversation && !M.includesOneOf(this._conversation.roles, [yo.ADMIN, yo.CREATOR])) throw Error("You don't have the required permission");
|
|
11778
11931
|
}
|
|
11779
11932
|
_isCalledState() {
|
|
11780
11933
|
return this._participantState === X.CALLED;
|
|
@@ -11812,21 +11965,21 @@ var fc = 15, $ = class e extends b {
|
|
|
11812
11965
|
async changeOptions(e) {
|
|
11813
11966
|
if (this._signaling.ready && this._conversation) {
|
|
11814
11967
|
this._checkAdminRole(), await this._signaling.changeOptions(e);
|
|
11815
|
-
let t =
|
|
11968
|
+
let t = mo(this._conversation.options, e);
|
|
11816
11969
|
this._onOptionsChanged(t);
|
|
11817
11970
|
}
|
|
11818
11971
|
}
|
|
11819
11972
|
async getWaitingHall(e, t, n) {
|
|
11820
11973
|
if (!this._signaling) return Promise.reject();
|
|
11821
11974
|
let r = null;
|
|
11822
|
-
if (e && (r =
|
|
11975
|
+
if (e && (r = To(e), r)) {
|
|
11823
11976
|
let e = this._api.getDecorativeIdByInitialId(r.id);
|
|
11824
11977
|
r.id = e ?? r.id;
|
|
11825
11978
|
}
|
|
11826
11979
|
let i = await this._signaling.getWaitingHall(r, t, n);
|
|
11827
11980
|
if (i.error) return Promise.reject(i.message);
|
|
11828
11981
|
let a = i.participants || [], { externalIds: o } = this._resolveWaitingHallExternalIds(a, "getWaitingHall"), s = null;
|
|
11829
|
-
return a.length && i.hasMore && (s =
|
|
11982
|
+
return a.length && i.hasMore && (s = wo(a[a.length - 1].id)), {
|
|
11830
11983
|
participants: o,
|
|
11831
11984
|
pageMarker: s,
|
|
11832
11985
|
totalCount: i.totalCount || 0
|
|
@@ -11860,7 +12013,7 @@ var fc = 15, $ = class e extends b {
|
|
|
11860
12013
|
}
|
|
11861
12014
|
async promoteParticipant(e, t) {
|
|
11862
12015
|
if (this._signaling && this._conversation) try {
|
|
11863
|
-
if (!M.includesOneOf(this._conversation.options, [
|
|
12016
|
+
if (!M.includesOneOf(this._conversation.options, [fo.WAITING_HALL, fo.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
|
|
11864
12017
|
if (this._checkAdminRole(), !e && t) throw Error("participantId is required");
|
|
11865
12018
|
await this._signaling.promoteParticipant(e, t);
|
|
11866
12019
|
} catch (t) {
|
|
@@ -12032,7 +12185,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12032
12185
|
let a = this._transport?.getState();
|
|
12033
12186
|
return n.participants.forEach((e) => {
|
|
12034
12187
|
let t = M.composeId(e), n = r[t];
|
|
12035
|
-
this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n,
|
|
12188
|
+
this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, So.fromTransportState(a) ?? P.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, D(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
|
|
12036
12189
|
}), this._participantListChunkToExternalChunk(n);
|
|
12037
12190
|
}
|
|
12038
12191
|
async _getInitialParticiapntListChunk() {
|
|
@@ -12046,7 +12199,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12046
12199
|
_onLocalMediaStreamChanged(e) {
|
|
12047
12200
|
if (!this._conversation || !this._mediaSource) return;
|
|
12048
12201
|
let t = this._mediaSource.mediaSettings;
|
|
12049
|
-
this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new
|
|
12202
|
+
this._debug.debug("Local media stream changed", t), e.kind === A.audio && this._mediaSource && (this._audioFix = new Io(this._mediaSource, this._debug, this._stats.logger)), R.onLocalStreamUpdate(t, e.kind, this.id), !this._conversation?.waitingHall && !this._conversation?.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
|
|
12050
12203
|
}
|
|
12051
12204
|
_onScreenSharingStatus(e) {
|
|
12052
12205
|
let t = this.mediaSettings;
|
|
@@ -12176,9 +12329,9 @@ var fc = 15, $ = class e extends b {
|
|
|
12176
12329
|
for (let n of e.conversation.participants) {
|
|
12177
12330
|
let e = M.composeId(n), i = n.roles || [];
|
|
12178
12331
|
if (this._isMe(e)) {
|
|
12179
|
-
|
|
12332
|
+
bo(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
|
|
12180
12333
|
this._registerParticipantLocalMuteState({
|
|
12181
|
-
muteStates:
|
|
12334
|
+
muteStates: Ao(n),
|
|
12182
12335
|
unmuteOptions: n.unmuteOptions
|
|
12183
12336
|
});
|
|
12184
12337
|
};
|
|
@@ -12196,7 +12349,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12196
12349
|
let t = D(n.mediaSettings);
|
|
12197
12350
|
Wt(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
|
|
12198
12351
|
let r = M.mapParticipantState(n), o = a.participantState;
|
|
12199
|
-
M.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r),
|
|
12352
|
+
M.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), bo(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? P.ONHOLD : P.CONNECTED));
|
|
12200
12353
|
}
|
|
12201
12354
|
}
|
|
12202
12355
|
let i = this._participants;
|
|
@@ -12221,7 +12374,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12221
12374
|
this._close(new k(O.ANOTHER_DEVICE), { errorText: "Call accepted on other device" });
|
|
12222
12375
|
return;
|
|
12223
12376
|
}
|
|
12224
|
-
this._conversation?.direction ===
|
|
12377
|
+
this._conversation?.direction === so.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
|
|
12225
12378
|
let r = this._getParticipant(t);
|
|
12226
12379
|
if (!r) {
|
|
12227
12380
|
let n = this._api.getDecorativeIdByInitialId(t);
|
|
@@ -12234,7 +12387,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12234
12387
|
let t = Z.fromSignaling(e.externalId, e.deviceIdx);
|
|
12235
12388
|
r.externalId = t, this._api.cacheExternalId(r.id, t);
|
|
12236
12389
|
}
|
|
12237
|
-
r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction ===
|
|
12390
|
+
r.state = X.ACCEPTED, r.mediaSettings = D(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === so.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), this._state === "ACTIVE" && this._transport && this._transport.open([r.id], n), this._changeRemoteMediaSettings(t, r.mediaSettings), await this._changeRemoteParticipantState(t);
|
|
12238
12391
|
let i = Object.keys(r.muteStates);
|
|
12239
12392
|
if (i.length && this._onMuteParticipant({
|
|
12240
12393
|
muteStates: r.muteStates,
|
|
@@ -12246,7 +12399,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12246
12399
|
this._reportMissingExternalIds([t], "ACCEPTED_CALL");
|
|
12247
12400
|
return;
|
|
12248
12401
|
}
|
|
12249
|
-
R.onAcceptedCall(r.externalId,
|
|
12402
|
+
R.onAcceptedCall(r.externalId, Va.parseCapabilities(e.capabilities), this.id);
|
|
12250
12403
|
}
|
|
12251
12404
|
}
|
|
12252
12405
|
async _onHungup(e) {
|
|
@@ -12283,7 +12436,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12283
12436
|
return;
|
|
12284
12437
|
}
|
|
12285
12438
|
if (e.connected) {
|
|
12286
|
-
let e =
|
|
12439
|
+
let e = So.fromTransportState(this._transport?.getState());
|
|
12287
12440
|
e && this._setTransportStatus(n, e);
|
|
12288
12441
|
}
|
|
12289
12442
|
this._setSessionState(n, { connected: e.connected });
|
|
@@ -12360,7 +12513,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12360
12513
|
isOnHold: !!r.onHold
|
|
12361
12514
|
}, i), n = this._getParticipant(t);
|
|
12362
12515
|
}
|
|
12363
|
-
this._conversation && this._conversation.direction ===
|
|
12516
|
+
this._conversation && this._conversation.direction === so.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = X.ACCEPTED, n.mediaSettings = D(e.mediaSettings), n.participantState = M.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], P.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], P.CONNECTED) : this._setParticipantsStatus([n], P.WAITING), r && this._emitParticipantEffectiveStatusIfSessionOverridesTransport(n), this._state !== "IDLE" && this._transport && (this._transport.isAllocated(n.id) || this._allocateParticipantTransport(n.id, !0), this._transport.open([n.id], null, !!this._conversation?.observer)), R.onParticipantJoined(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
|
|
12364
12517
|
let i = Object.keys(n.muteStates);
|
|
12365
12518
|
i.length && this._onMuteParticipant({
|
|
12366
12519
|
muteStates: n.muteStates,
|
|
@@ -12551,15 +12704,15 @@ var fc = 15, $ = class e extends b {
|
|
|
12551
12704
|
R.onAsrTranscription(t, e.text, e.timestamp, e.duration, this.id);
|
|
12552
12705
|
}
|
|
12553
12706
|
async _onRolesChanged(e, t) {
|
|
12554
|
-
if (this._conversation && this._isMe(e) && !
|
|
12707
|
+
if (this._conversation && this._isMe(e) && !bo(this._conversation.roles, t)) {
|
|
12555
12708
|
this._debug.debug(`Local roles changed: ${t}`), this._conversation.roles = t, R.onLocalRolesChanged(t, !1, this.id), this._processMuteState({
|
|
12556
|
-
mediaOptions:
|
|
12709
|
+
mediaOptions: Eo(this._getMuteStatesForCurrentRoom(), ho.MUTE_PERMANENT),
|
|
12557
12710
|
stateUpdated: !0
|
|
12558
|
-
}), M.includesOneOf(t, [
|
|
12711
|
+
}), M.includesOneOf(t, [yo.ADMIN, yo.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
|
|
12559
12712
|
return;
|
|
12560
12713
|
}
|
|
12561
12714
|
let n = this._getParticipant(e);
|
|
12562
|
-
n && !
|
|
12715
|
+
n && !bo(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, R.onRolesChanged(n.externalId, t, !1, this.id));
|
|
12563
12716
|
}
|
|
12564
12717
|
async _onMuteParticipant(e, t = !1) {
|
|
12565
12718
|
if (!this._conversation) return;
|
|
@@ -12608,7 +12761,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12608
12761
|
let { mediaOptions: t = [], muteAll: n, unmute: r, stateUpdated: i, requestedMedia: a, roomId: o = null, unmuteOptions: s = [] } = e, c = e.adminId ? this._getExternalIdByParticipantId(e.adminId) : null, l = Object.assign({}, e.muteStates ?? this._getMuteStatesForRoomId(o)), u = this._mediaSource.mediaSettings, d = Object.entries(l);
|
|
12609
12762
|
for (let [e, i] of d) {
|
|
12610
12763
|
let a = this._isCallAdmin() && n;
|
|
12611
|
-
if (!(i !==
|
|
12764
|
+
if (!(i !== ho.MUTE && i !== ho.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === ho.MUTE_PERMANENT && !n && (l[e] = ho.MUTE), !(!t.includes(e) || r))) switch (e) {
|
|
12612
12765
|
case S.VIDEO:
|
|
12613
12766
|
u.isVideoEnabled && (R.onDeviceSwitched(S.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
|
|
12614
12767
|
break;
|
|
@@ -12645,7 +12798,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12645
12798
|
this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
|
|
12646
12799
|
}
|
|
12647
12800
|
_onOptionsChanged(e) {
|
|
12648
|
-
this._conversation && !
|
|
12801
|
+
this._conversation && !po(this._conversation.options, e) && (this._conversation.options = e, R.onOptionsChanged(e, this.id), e.includes(fo.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && R.onLocalStatus(P.WAITING_HALL, this.id) : e.includes(fo.WAIT_FOR_ADMIN) && this._conversation.restricted && R.onLocalStatus(P.WAIT_FOR_ADMIN, this.id));
|
|
12649
12802
|
}
|
|
12650
12803
|
async _onNetworkStatus(e) {
|
|
12651
12804
|
if (this._conversation) {
|
|
@@ -12655,7 +12808,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12655
12808
|
if (this._isMe(r) || r === "") e = this._conversation.networkRating;
|
|
12656
12809
|
else if (n[r]) e = n[r].networkRating;
|
|
12657
12810
|
else continue;
|
|
12658
|
-
if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i,
|
|
12811
|
+
if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, gi.getInstance().value = i, R.onLocalNetworkStatusChanged(i, this.id);
|
|
12659
12812
|
else {
|
|
12660
12813
|
let e = n[r];
|
|
12661
12814
|
e.networkRating = i, t.push({
|
|
@@ -12700,7 +12853,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12700
12853
|
}
|
|
12701
12854
|
_changeFeatureSet() {
|
|
12702
12855
|
if (this._conversation) {
|
|
12703
|
-
let e = this._state === "ACTIVE", t = this._conversation.features.includes(
|
|
12856
|
+
let e = this._state === "ACTIVE", t = this._conversation.features.includes(uo.ADD_PARTICIPANT);
|
|
12704
12857
|
R.onCallState(e, t, this._conversation, this.id);
|
|
12705
12858
|
}
|
|
12706
12859
|
}
|
|
@@ -12734,7 +12887,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12734
12887
|
let n = this._getParticipant(e);
|
|
12735
12888
|
if (n) {
|
|
12736
12889
|
if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
|
|
12737
|
-
let e =
|
|
12890
|
+
let e = So.fromTransportState(this._transport?.getState());
|
|
12738
12891
|
e && this._setTransportStatus(n, e), n.connectionStatus.sessionStateConnectedBySpeaker = !0;
|
|
12739
12892
|
let t = this._setTransportStatus(n, n.connectionStatus.transport);
|
|
12740
12893
|
this._emitParticipantTransition(n, t);
|
|
@@ -12744,7 +12897,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12744
12897
|
}
|
|
12745
12898
|
async _onTransportStateChanged(e, t) {
|
|
12746
12899
|
this._debug.debug(`Transport state has changed: ${t}`, e);
|
|
12747
|
-
let n =
|
|
12900
|
+
let n = So.fromTransportState(t);
|
|
12748
12901
|
if (!n) return;
|
|
12749
12902
|
let r = this._participants, i = [], a = e.reduce((e, n) => {
|
|
12750
12903
|
if (n in r) {
|
|
@@ -12778,9 +12931,9 @@ var fc = 15, $ = class e extends b {
|
|
|
12778
12931
|
return e.every((e) => t[e]?.isOnHold);
|
|
12779
12932
|
}
|
|
12780
12933
|
_onRemoteTrackAdded(e, t, n) {
|
|
12781
|
-
if (e.endsWith(
|
|
12782
|
-
else if (e.startsWith(
|
|
12783
|
-
else if (e.startsWith(
|
|
12934
|
+
if (e.endsWith(fi.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), R.onRemoteMixedAudioStream(t, this.id);
|
|
12935
|
+
else if (e.startsWith(fi.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
|
|
12936
|
+
else if (e.startsWith(fi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
|
|
12784
12937
|
else {
|
|
12785
12938
|
this._debug.debug(`Remote track added on the participant [${e}]`, { kind: n.kind });
|
|
12786
12939
|
let r = this._getParticipant(e);
|
|
@@ -12807,7 +12960,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12807
12960
|
}
|
|
12808
12961
|
}
|
|
12809
12962
|
async _removeAudioTrack(e, t, n) {
|
|
12810
|
-
if (e !==
|
|
12963
|
+
if (e !== fi.AUDIO_MIX) {
|
|
12811
12964
|
let n = this._getParticipant(e);
|
|
12812
12965
|
if (!n || n.remoteStream && n.remoteStream !== t) return;
|
|
12813
12966
|
}
|
|
@@ -12822,7 +12975,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12822
12975
|
if (this._statFirstMediaReceived.markTopologyChanged(e), e === J.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation) {
|
|
12823
12976
|
this._conversation.topology = e;
|
|
12824
12977
|
for (let e of Object.values(this._participants)) {
|
|
12825
|
-
let t =
|
|
12978
|
+
let t = So.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
12826
12979
|
this._emitParticipantTransition(e, t);
|
|
12827
12980
|
}
|
|
12828
12981
|
this._changeFeatureSet(), this._forceOpenTransportForAloneInCall();
|
|
@@ -12878,7 +13031,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12878
13031
|
].includes(t) ? null : this._setTransportStatus(e, t), n);
|
|
12879
13032
|
}
|
|
12880
13033
|
_setParticipantsStalled(e, t) {
|
|
12881
|
-
this._updateParticipantsStatus(e, (e) =>
|
|
13034
|
+
this._updateParticipantsStatus(e, (e) => So.setStalled(e.connectionStatus, t));
|
|
12882
13035
|
}
|
|
12883
13036
|
_updateParticipantsStatus(e, t, n = null) {
|
|
12884
13037
|
let r = e.reduce((e, n) => {
|
|
@@ -12897,7 +13050,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12897
13050
|
_onRoomsUpdated(e) {
|
|
12898
13051
|
if (this._isCalledState()) return;
|
|
12899
13052
|
let t = {}, n = [], r = [];
|
|
12900
|
-
for (let i of Object.keys(
|
|
13053
|
+
for (let i of Object.keys(go)) {
|
|
12901
13054
|
let a = e.updates[i];
|
|
12902
13055
|
a && (a?.rooms?.forEach((e) => {
|
|
12903
13056
|
let { room: t, missingParticipantIds: i } = this._convertRoomToExternal(e);
|
|
@@ -12912,7 +13065,7 @@ var fc = 15, $ = class e extends b {
|
|
|
12912
13065
|
}
|
|
12913
13066
|
_onRoomUpdated(e) {
|
|
12914
13067
|
let { room: t, missingParticipantIds: n } = this._convertRoomToExternal(e.room || null);
|
|
12915
|
-
e.events.some((e) => e ===
|
|
13068
|
+
e.events.some((e) => e === go.UPDATE) && (e.muteStates !== void 0 && this._setMuteStatesForRoomId(e.muteStates, e.roomId), e.recordInfo !== void 0 && this._conversation?.recordsInfoByRoom.set(e.roomId, e.recordInfo), e.asrInfo !== void 0 && this._conversation?.asrInfoByRoom.set(e.roomId, e.asrInfo)), this._isCalledState() || (this._reportMissingExternalIds(n, "ROOM_UPDATED"), R.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id));
|
|
12916
13069
|
}
|
|
12917
13070
|
_convertRoomToExternal(e) {
|
|
12918
13071
|
if (!e) return {
|
|
@@ -13023,7 +13176,7 @@ var fc = 15, $ = class e extends b {
|
|
|
13023
13176
|
n && r.push(n);
|
|
13024
13177
|
}
|
|
13025
13178
|
}
|
|
13026
|
-
r.length && !this._isCalledState() && R.onRoomsUpdated({ [
|
|
13179
|
+
r.length && !this._isCalledState() && R.onRoomsUpdated({ [go.UPDATE]: { rooms: r } }, this.id);
|
|
13027
13180
|
}
|
|
13028
13181
|
_onFeedback(e) {
|
|
13029
13182
|
let t = [];
|
|
@@ -13099,11 +13252,11 @@ var fc = 15, $ = class e extends b {
|
|
|
13099
13252
|
_getParticipant(e) {
|
|
13100
13253
|
return this._participants[e];
|
|
13101
13254
|
}
|
|
13102
|
-
},
|
|
13255
|
+
}, yc = null, bc = class e extends Error {
|
|
13103
13256
|
constructor(t, n) {
|
|
13104
13257
|
super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
|
|
13105
13258
|
}
|
|
13106
|
-
},
|
|
13259
|
+
}, xc = class {
|
|
13107
13260
|
constructor() {
|
|
13108
13261
|
h(this, "_abortSignal", void 0), h(this, "_apiCallStats", null);
|
|
13109
13262
|
}
|
|
@@ -13148,14 +13301,14 @@ var fc = 15, $ = class e extends b {
|
|
|
13148
13301
|
async getInbounds() {
|
|
13149
13302
|
return [];
|
|
13150
13303
|
}
|
|
13151
|
-
},
|
|
13304
|
+
}, Sc = class e {
|
|
13152
13305
|
constructor() {
|
|
13153
13306
|
h(this, "_participantIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToParticipantId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
|
|
13154
13307
|
}
|
|
13155
13308
|
static _normalizeType(e) {
|
|
13156
|
-
return e.type ===
|
|
13309
|
+
return e.type === Co.GROUP ? {
|
|
13157
13310
|
...e,
|
|
13158
|
-
type:
|
|
13311
|
+
type: Co.USER
|
|
13159
13312
|
} : e;
|
|
13160
13313
|
}
|
|
13161
13314
|
getExternalId(e) {
|
|
@@ -13183,27 +13336,27 @@ var fc = 15, $ = class e extends b {
|
|
|
13183
13336
|
clear() {
|
|
13184
13337
|
this._participantIdToExternalId.clear(), this._externalIdToParticipantId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
|
|
13185
13338
|
}
|
|
13186
|
-
},
|
|
13187
|
-
function
|
|
13339
|
+
}, Cc = "anonymLogin:", wc = 700, Tc = 3e3;
|
|
13340
|
+
function Ec(e) {
|
|
13188
13341
|
let t = e.error_code;
|
|
13189
13342
|
switch (t) {
|
|
13190
|
-
case 2: return
|
|
13191
|
-
case 4: return e.error_msg.includes("participants.limit.exceeded") ?
|
|
13192
|
-
case 300: return
|
|
13193
|
-
case 1101: return
|
|
13194
|
-
case 1102: return
|
|
13195
|
-
case 1103: return
|
|
13196
|
-
case 1104: return
|
|
13197
|
-
case 1106: return
|
|
13198
|
-
case 1113: return
|
|
13343
|
+
case 2: return Dc(O.SERVICE_UNAVAILABLE, t, "service-unavailable");
|
|
13344
|
+
case 4: return e.error_msg.includes("participants.limit.exceeded") ? Dc(O.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Dc(x.API, t, "request-error");
|
|
13345
|
+
case 300: return Dc(O.NOT_FOUND, t, "not-found");
|
|
13346
|
+
case 1101: return Dc(O.SERVICE_DISABLED, t, "vchat-service-disabled");
|
|
13347
|
+
case 1102: return Dc(O.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
|
|
13348
|
+
case 1103: return Dc(O.NOT_FRIENDS, t, "friendship-required");
|
|
13349
|
+
case 1104: return kc(t, "youla-api-error");
|
|
13350
|
+
case 1106: return kc(t, "vk-api-error");
|
|
13351
|
+
case 1113: return Dc(O.CALLER_IS_REJECTED, t, "caller-is-rejected");
|
|
13199
13352
|
case 1114: {
|
|
13200
13353
|
let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
|
|
13201
|
-
return
|
|
13354
|
+
return Dc(r ? O.OBSOLETE_CLIENT : O.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
|
|
13202
13355
|
}
|
|
13203
|
-
default: return
|
|
13356
|
+
default: return Dc(x.API, t, "api-error");
|
|
13204
13357
|
}
|
|
13205
13358
|
}
|
|
13206
|
-
function
|
|
13359
|
+
function Dc(e, t, n, r) {
|
|
13207
13360
|
return {
|
|
13208
13361
|
type: e,
|
|
13209
13362
|
callError: {
|
|
@@ -13215,10 +13368,10 @@ function xc(e, t, n, r) {
|
|
|
13215
13368
|
message: r
|
|
13216
13369
|
};
|
|
13217
13370
|
}
|
|
13218
|
-
function
|
|
13371
|
+
function Oc(e) {
|
|
13219
13372
|
return e?.error_code === void 0 ? e instanceof k && e.callError && "code" in e.callError ? String(e.callError.code) : e instanceof Error ? e.name : "network" : String(e.error_code);
|
|
13220
13373
|
}
|
|
13221
|
-
function
|
|
13374
|
+
function kc(e, t) {
|
|
13222
13375
|
return {
|
|
13223
13376
|
type: O.EXTERNAL_API_ERROR,
|
|
13224
13377
|
callError: {
|
|
@@ -13229,21 +13382,21 @@ function Cc(e, t) {
|
|
|
13229
13382
|
}
|
|
13230
13383
|
};
|
|
13231
13384
|
}
|
|
13232
|
-
var
|
|
13385
|
+
var Ac = class extends xc {
|
|
13233
13386
|
constructor(...e) {
|
|
13234
|
-
super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new
|
|
13387
|
+
super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new Sc());
|
|
13235
13388
|
}
|
|
13236
13389
|
async _callUnsafe(e, t = {}, n = !1) {
|
|
13237
13390
|
let r = async (i) => {
|
|
13238
13391
|
let a = performance.now();
|
|
13239
13392
|
try {
|
|
13240
|
-
let r = await
|
|
13393
|
+
let r = await xs(e, t, n);
|
|
13241
13394
|
return this._apiCallStats?.log(e, performance.now() - a), r;
|
|
13242
13395
|
} catch (t) {
|
|
13243
|
-
if (this._apiCallStats?.log(e, performance.now() - a,
|
|
13396
|
+
if (this._apiCallStats?.log(e, performance.now() - a, Oc(t)), !t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
|
|
13244
13397
|
i++;
|
|
13245
13398
|
let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
|
|
13246
|
-
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i *
|
|
13399
|
+
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i * wc, Tc), { signal: this._abortSignal }), r(i);
|
|
13247
13400
|
}
|
|
13248
13401
|
throw z.warn(e, "error", t), t;
|
|
13249
13402
|
}
|
|
@@ -13255,13 +13408,13 @@ var wc = class extends hc {
|
|
|
13255
13408
|
return await this._callUnsafe(e, t, n);
|
|
13256
13409
|
} catch (i) {
|
|
13257
13410
|
if (z.warn("Api call error", i), i instanceof k) throw i;
|
|
13258
|
-
if (
|
|
13411
|
+
if (rs(i?.error_code) && r) return await this._reauthorize(), this._call(e, t, n, !1);
|
|
13259
13412
|
let a = {
|
|
13260
13413
|
message: i?.error_msg,
|
|
13261
13414
|
code: i?.error_code
|
|
13262
13415
|
};
|
|
13263
|
-
if (i.custom_error && (a.custom_error = i.custom_error),
|
|
13264
|
-
let e =
|
|
13416
|
+
if (i.custom_error && (a.custom_error = i.custom_error), jc(i)) {
|
|
13417
|
+
let e = Ec(i);
|
|
13265
13418
|
throw a.callError = e.callError, a.message = e.message ?? a.message, new k(e.type, a);
|
|
13266
13419
|
}
|
|
13267
13420
|
throw new k(x.API, a);
|
|
@@ -13291,7 +13444,7 @@ var wc = class extends hc {
|
|
|
13291
13444
|
return this._anonymLogin(N.authToken).then((e) => {
|
|
13292
13445
|
this._applyAnonymLogin(e), this._setCachedAnonymLogin(e);
|
|
13293
13446
|
}).catch((e) => {
|
|
13294
|
-
throw e instanceof k ? e : (e?.error_code ===
|
|
13447
|
+
throw e instanceof k ? e : (e?.error_code === ns.AUTH_LOGIN && (this._removeCachedAnonymLogin(), R.onTokenExpired()), new k(x.AUTH, {
|
|
13295
13448
|
message: e?.error_msg,
|
|
13296
13449
|
code: e?.error_code,
|
|
13297
13450
|
callError: {
|
|
@@ -13313,17 +13466,17 @@ var wc = class extends hc {
|
|
|
13313
13466
|
return e && (t.session_data.auth_token = e, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0);
|
|
13314
13467
|
}
|
|
13315
13468
|
_getAnonymLoginCacheKey() {
|
|
13316
|
-
return N.authToken ? `${
|
|
13469
|
+
return N.authToken ? `${Cc}${N.authToken}` : null;
|
|
13317
13470
|
}
|
|
13318
13471
|
_getCachedAnonymLogin() {
|
|
13319
13472
|
let e = this._getAnonymLoginCacheKey();
|
|
13320
13473
|
if (!e) return null;
|
|
13321
13474
|
let t = w.get(e);
|
|
13322
|
-
return
|
|
13475
|
+
return Mc(t) ? t : (t && w.remove(e), null);
|
|
13323
13476
|
}
|
|
13324
13477
|
_setCachedAnonymLogin(e) {
|
|
13325
13478
|
let t = this._getAnonymLoginCacheKey();
|
|
13326
|
-
!t || !
|
|
13479
|
+
!t || !Mc(e) || w.set(t, {
|
|
13327
13480
|
session_key: e.session_key,
|
|
13328
13481
|
session_secret_key: e.session_secret_key,
|
|
13329
13482
|
uid: e.uid
|
|
@@ -13337,9 +13490,9 @@ var wc = class extends hc {
|
|
|
13337
13490
|
return this._removeCachedAnonymLogin(), y.reauthorize(() => this.authorize());
|
|
13338
13491
|
}
|
|
13339
13492
|
_applyAnonymLogin(e) {
|
|
13340
|
-
e.uid && (y.userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key, N.statQueueEnabled && e.uid &&
|
|
13493
|
+
e.uid && (y.userId = Number(e.uid)), y.sessionKey = e.session_key, y.sessionSecretKey = e.session_secret_key, N.statQueueEnabled && e.uid && ks.remember(Number(e.uid), {
|
|
13341
13494
|
sessionKey: e.session_key,
|
|
13342
|
-
endpoint:
|
|
13495
|
+
endpoint: ks.currentEndpoint()
|
|
13343
13496
|
});
|
|
13344
13497
|
}
|
|
13345
13498
|
_buildClientStatsData(e) {
|
|
@@ -13358,7 +13511,7 @@ var wc = class extends hc {
|
|
|
13358
13511
|
});
|
|
13359
13512
|
}
|
|
13360
13513
|
async _sendClientStatsWith(e, t) {
|
|
13361
|
-
let n = await
|
|
13514
|
+
let n = await xs("vchat.clientStats", {
|
|
13362
13515
|
...t,
|
|
13363
13516
|
session_key: e
|
|
13364
13517
|
}, !0);
|
|
@@ -13366,10 +13519,10 @@ var wc = class extends hc {
|
|
|
13366
13519
|
}
|
|
13367
13520
|
async _sendClientStats(e, t, n = !0) {
|
|
13368
13521
|
try {
|
|
13369
|
-
let n = t ? await
|
|
13522
|
+
let n = t ? await Ss("vchat.clientStats", e) : await xs("vchat.clientStats", e);
|
|
13370
13523
|
this._reportClientStatsItemErrors(n);
|
|
13371
13524
|
} catch (r) {
|
|
13372
|
-
if (!n || !
|
|
13525
|
+
if (!n || !rs(r?.error_code)) throw r;
|
|
13373
13526
|
await this._reauthorize(), await this._sendClientStats(e, t, !1);
|
|
13374
13527
|
}
|
|
13375
13528
|
}
|
|
@@ -13393,14 +13546,14 @@ var wc = class extends hc {
|
|
|
13393
13546
|
}, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
|
|
13394
13547
|
o.append("file", s, "log.json");
|
|
13395
13548
|
let c = new URL(a.upload_url);
|
|
13396
|
-
return c.searchParams.append("size", s.size.toString()),
|
|
13549
|
+
return c.searchParams.append("size", s.size.toString()), Ts(c.toString(), o);
|
|
13397
13550
|
}
|
|
13398
13551
|
async joinConversation(e, t = !1, n) {
|
|
13399
13552
|
let r = {
|
|
13400
13553
|
conversationId: e,
|
|
13401
13554
|
isVideo: t,
|
|
13402
13555
|
protocolVersion: N.protocolVersion,
|
|
13403
|
-
capabilities:
|
|
13556
|
+
capabilities: Va.getFlags()
|
|
13404
13557
|
};
|
|
13405
13558
|
return n && (r.chatId = n), this._call("vchat.joinConversation", r);
|
|
13406
13559
|
}
|
|
@@ -13432,13 +13585,13 @@ var wc = class extends hc {
|
|
|
13432
13585
|
externalIds: l
|
|
13433
13586
|
});
|
|
13434
13587
|
if (t && t.length) switch (n) {
|
|
13435
|
-
case
|
|
13588
|
+
case co.USER:
|
|
13436
13589
|
u.uids = t.join(",");
|
|
13437
13590
|
break;
|
|
13438
|
-
case
|
|
13591
|
+
case co.GROUP:
|
|
13439
13592
|
u.gid = t[0];
|
|
13440
13593
|
break;
|
|
13441
|
-
case
|
|
13594
|
+
case co.CHAT:
|
|
13442
13595
|
u.chatId = t[0];
|
|
13443
13596
|
break;
|
|
13444
13597
|
}
|
|
@@ -13481,7 +13634,7 @@ var wc = class extends hc {
|
|
|
13481
13634
|
joinLink: e,
|
|
13482
13635
|
isVideo: t,
|
|
13483
13636
|
protocolVersion: N.protocolVersion,
|
|
13484
|
-
capabilities:
|
|
13637
|
+
capabilities: Va.getFlags()
|
|
13485
13638
|
};
|
|
13486
13639
|
return n?.length && (i.observedIds = n.join(",")), N.anonymToken && (i.anonymToken = N.anonymToken), r && (i.payload = r), this._call("vchat.joinConversationByLink", i);
|
|
13487
13640
|
}
|
|
@@ -13511,9 +13664,9 @@ var wc = class extends hc {
|
|
|
13511
13664
|
return y.userId;
|
|
13512
13665
|
}
|
|
13513
13666
|
setUserId(e) {
|
|
13514
|
-
y.userId = e, N.statQueueEnabled && y.sessionKey &&
|
|
13667
|
+
y.userId = e, N.statQueueEnabled && y.sessionKey && ks.remember(Number(e), {
|
|
13515
13668
|
sessionKey: y.sessionKey,
|
|
13516
|
-
endpoint:
|
|
13669
|
+
endpoint: ks.currentEndpoint()
|
|
13517
13670
|
});
|
|
13518
13671
|
}
|
|
13519
13672
|
hangupConversation(e, t = O.HUNGUP, n) {
|
|
@@ -13521,7 +13674,7 @@ var wc = class extends hc {
|
|
|
13521
13674
|
conversationId: e,
|
|
13522
13675
|
reason: t
|
|
13523
13676
|
};
|
|
13524
|
-
N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId),
|
|
13677
|
+
N.anonymToken && (r.anonymToken = N.anonymToken), n?.peerId && (r.peerId = n.peerId), bs("vchat.hangupConversation", r);
|
|
13525
13678
|
}
|
|
13526
13679
|
async removeHistoryRecords(e) {
|
|
13527
13680
|
await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
|
|
@@ -13537,19 +13690,19 @@ var wc = class extends hc {
|
|
|
13537
13690
|
return Array.isArray(e?.inbounds) ? e.inbounds : [];
|
|
13538
13691
|
}
|
|
13539
13692
|
};
|
|
13540
|
-
function
|
|
13693
|
+
function jc(e) {
|
|
13541
13694
|
return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
|
|
13542
13695
|
}
|
|
13543
|
-
function
|
|
13696
|
+
function Mc(e) {
|
|
13544
13697
|
return typeof e == "object" && !!e && "session_key" in e && "session_secret_key" in e && typeof e.session_key == "string" && e.session_key.length > 0 && typeof e.session_secret_key == "string" && e.session_secret_key.length > 0;
|
|
13545
13698
|
}
|
|
13546
13699
|
//#endregion
|
|
13547
13700
|
//#region src/enums/RecordRole.ts
|
|
13548
|
-
var
|
|
13701
|
+
var Nc = /* @__PURE__ */ function(e) {
|
|
13549
13702
|
return e.KING = "KING", e.PAWN = "PAWN", e;
|
|
13550
|
-
}(
|
|
13703
|
+
}(Nc || {}), Pc = /* @__PURE__ */ function(e) {
|
|
13551
13704
|
return e.OFF = "0", e.ON = "1", e;
|
|
13552
|
-
}({}),
|
|
13705
|
+
}({}), Fc = class {
|
|
13553
13706
|
constructor(e) {
|
|
13554
13707
|
h(this, "_queue", void 0), h(this, "_readCursor", void 0), h(this, "_writeCursor", void 0), h(this, "_moveReadCursor", void 0), h(this, "_left", void 0), this._queue = Array(e).fill(null), this._readCursor = this._writeCursor = this._left = 0, this._moveReadCursor = !1;
|
|
13555
13708
|
}
|
|
@@ -13572,12 +13725,12 @@ var Dc = /* @__PURE__ */ function(e) {
|
|
|
13572
13725
|
let e = this._queue[this._readCursor];
|
|
13573
13726
|
return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
|
|
13574
13727
|
}
|
|
13575
|
-
},
|
|
13728
|
+
}, Ic = class {
|
|
13576
13729
|
constructor(e, t, n, r = null) {
|
|
13577
13730
|
h(this, "_uuid", void 0), h(this, "_apiKey", void 0), h(this, "_callToken", void 0), h(this, "_apiEnv", void 0), h(this, "_baseApiUrl", void 0), h(this, "_sessionKey", void 0), this._uuid = M.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
|
|
13578
13731
|
}
|
|
13579
13732
|
async authorize() {
|
|
13580
|
-
let e = await
|
|
13733
|
+
let e = await xs("auth.anonymLogin", {
|
|
13581
13734
|
session_data: {
|
|
13582
13735
|
device_id: this._uuid,
|
|
13583
13736
|
client_version: N.apiClientVersion,
|
|
@@ -13586,7 +13739,7 @@ var Dc = /* @__PURE__ */ function(e) {
|
|
|
13586
13739
|
version: 3
|
|
13587
13740
|
},
|
|
13588
13741
|
application_key: this._apiKey
|
|
13589
|
-
}, !0, await
|
|
13742
|
+
}, !0, await vs(this._baseApiUrl, this._apiEnv));
|
|
13590
13743
|
return M.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
|
|
13591
13744
|
}
|
|
13592
13745
|
async hangupConversation(e, t) {
|
|
@@ -13596,9 +13749,9 @@ var Dc = /* @__PURE__ */ function(e) {
|
|
|
13596
13749
|
application_key: this._apiKey,
|
|
13597
13750
|
session_key: this._sessionKey
|
|
13598
13751
|
};
|
|
13599
|
-
t?.peerId && (n.peerId = t.peerId), await
|
|
13752
|
+
t?.peerId && (n.peerId = t.peerId), await xs("vchat.hangupConversation", n, !0, await vs(this._baseApiUrl, this._apiEnv));
|
|
13600
13753
|
}
|
|
13601
|
-
},
|
|
13754
|
+
}, Lc, Rc = null, zc = !1, Bc = {
|
|
13602
13755
|
getCameras: E.getCameras,
|
|
13603
13756
|
getMicrophones: E.getMicrophones,
|
|
13604
13757
|
getOutput: E.getOutput,
|
|
@@ -13624,27 +13777,27 @@ var Dc = /* @__PURE__ */ function(e) {
|
|
|
13624
13777
|
baseChromeVersion: E.baseChromeVersion,
|
|
13625
13778
|
getAudioContext: E.getAudioContext,
|
|
13626
13779
|
isAudioShareSupported: E.isAudioShareSupported
|
|
13627
|
-
},
|
|
13628
|
-
function
|
|
13629
|
-
|
|
13780
|
+
}, Vc = { participantMarkerCompare: M.participantMarkerCompare };
|
|
13781
|
+
function Hc(e) {
|
|
13782
|
+
Rc = e;
|
|
13630
13783
|
}
|
|
13631
|
-
function
|
|
13784
|
+
function Uc(e) {
|
|
13632
13785
|
N.videoEffects = e;
|
|
13633
13786
|
}
|
|
13634
|
-
function
|
|
13787
|
+
function Wc(e) {
|
|
13635
13788
|
N.audioEffects = e;
|
|
13636
13789
|
}
|
|
13637
|
-
function
|
|
13790
|
+
function Gc(e, t = {}) {
|
|
13638
13791
|
N.vad = e, N.vadOptions = t;
|
|
13639
13792
|
}
|
|
13640
|
-
function
|
|
13793
|
+
function Kc(e, t = null, n = {}, r = 1) {
|
|
13641
13794
|
N.vmoji = e, N.vmojiOptions = {
|
|
13642
13795
|
protocolVersion: r,
|
|
13643
13796
|
renderingOptions: n
|
|
13644
13797
|
}, t && e.setSDK(t);
|
|
13645
13798
|
}
|
|
13646
|
-
async function
|
|
13647
|
-
N.set(t),
|
|
13799
|
+
async function qc(t) {
|
|
13800
|
+
N.set(t), Lc || (Lc = new Ac()), N.statQueueEnabled && (js.setApi(Lc), N.autoStartStats && el()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await E.init();
|
|
13648
13801
|
let n = E.getBrowserSupportFailure();
|
|
13649
13802
|
if (n) throw new k(x.UNSUPPORTED, { callError: {
|
|
13650
13803
|
scope: "internal",
|
|
@@ -13653,19 +13806,19 @@ async function Vc(t) {
|
|
|
13653
13806
|
} });
|
|
13654
13807
|
z.log("UserAgent:", navigator.userAgent), z.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), z.log("Permissions:", `Camera: ${E.hasCameraPermission()}, Mic: ${E.hasMicrophonePermission()}`), z.log("Simulcast:", `${t.simulcast} => ${N.simulcast}`);
|
|
13655
13808
|
}
|
|
13656
|
-
async function
|
|
13809
|
+
async function Jc(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
|
|
13657
13810
|
let c = [];
|
|
13658
|
-
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]),
|
|
13811
|
+
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), Xc([], co.USER, t, n, r, i, a, c, o, s);
|
|
13659
13812
|
}
|
|
13660
|
-
function
|
|
13813
|
+
function Yc(e, t = []) {
|
|
13661
13814
|
let n = e.getIncomingCallerExternalId();
|
|
13662
13815
|
return n ? t.length === 1 && t[0].id === n.id && t[0].type === n.type : !1;
|
|
13663
13816
|
}
|
|
13664
|
-
async function
|
|
13817
|
+
async function Xc(e, t = co.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
13665
13818
|
if (!N.hold && B.getActive()) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
13666
13819
|
let u = B.getAll().find((e) => e.isIncomingRinging);
|
|
13667
|
-
if (!N.hold && u && !
|
|
13668
|
-
return new $(new
|
|
13820
|
+
if (!N.hold && u && !Yc(u, s)) throw z.error("There is already incoming call"), new k(O.HAS_ACTIVE_CALL);
|
|
13821
|
+
return new $(new Ac(), Rc).onStart({
|
|
13669
13822
|
opponentIds: e,
|
|
13670
13823
|
opponentType: t,
|
|
13671
13824
|
mediaOptions: n,
|
|
@@ -13678,49 +13831,49 @@ async function Wc(e, t = no.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
|
13678
13831
|
conversationId: l
|
|
13679
13832
|
});
|
|
13680
13833
|
}
|
|
13681
|
-
async function
|
|
13682
|
-
return
|
|
13834
|
+
async function Zc(e, t) {
|
|
13835
|
+
return Qc(e, j.USER, void 0, t);
|
|
13683
13836
|
}
|
|
13684
|
-
async function
|
|
13837
|
+
async function Qc(e, t = j.USER, n, r, i, a) {
|
|
13685
13838
|
if (e === $.id()) throw Error("Push has already been processed");
|
|
13686
|
-
return new $(new
|
|
13839
|
+
return new $(new Ac(), Rc).onPush(e, t, n, r, i, a);
|
|
13687
13840
|
}
|
|
13688
|
-
async function
|
|
13689
|
-
return
|
|
13841
|
+
async function $c() {
|
|
13842
|
+
return Lc.getInbounds();
|
|
13690
13843
|
}
|
|
13691
|
-
function
|
|
13844
|
+
function el() {
|
|
13692
13845
|
if (N.statQueueEnabled) {
|
|
13693
|
-
if (!
|
|
13846
|
+
if (!Lc) {
|
|
13694
13847
|
z.error("[CallsSDK] startStats() called before init()");
|
|
13695
13848
|
return;
|
|
13696
13849
|
}
|
|
13697
|
-
|
|
13850
|
+
zc || (zc = !0, Vs.start(Lc));
|
|
13698
13851
|
}
|
|
13699
13852
|
}
|
|
13700
|
-
async function
|
|
13701
|
-
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t,
|
|
13853
|
+
async function tl(e, t) {
|
|
13854
|
+
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, gs()), Lc.authorize();
|
|
13702
13855
|
}
|
|
13703
|
-
async function
|
|
13704
|
-
return
|
|
13856
|
+
async function nl(e = [S.AUDIO], t) {
|
|
13857
|
+
return Du(t).accept(e);
|
|
13705
13858
|
}
|
|
13706
|
-
async function
|
|
13707
|
-
let t =
|
|
13859
|
+
async function rl(e) {
|
|
13860
|
+
let t = wu(e?.conversationId);
|
|
13708
13861
|
if (t) return t.decline(e);
|
|
13709
13862
|
}
|
|
13710
|
-
async function
|
|
13711
|
-
return
|
|
13863
|
+
async function il(e, t = [S.AUDIO]) {
|
|
13864
|
+
return al(e, t);
|
|
13712
13865
|
}
|
|
13713
|
-
async function
|
|
13866
|
+
async function al(e, t, n) {
|
|
13714
13867
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
13715
|
-
return new $(new
|
|
13868
|
+
return new $(new Ac(), Rc).onJoin({
|
|
13716
13869
|
conversationId: e,
|
|
13717
13870
|
mediaOptions: t,
|
|
13718
13871
|
chatId: n
|
|
13719
13872
|
});
|
|
13720
13873
|
}
|
|
13721
|
-
async function
|
|
13874
|
+
async function ol(e, t = [S.AUDIO], n, r, i, a) {
|
|
13722
13875
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
13723
|
-
return n && (N.anonymToken = n), new $(new
|
|
13876
|
+
return n && (N.anonymToken = n), new $(new Ac(), Rc).onJoin({
|
|
13724
13877
|
joinLink: e,
|
|
13725
13878
|
mediaOptions: t,
|
|
13726
13879
|
observedIds: r,
|
|
@@ -13729,30 +13882,30 @@ async function el(e, t = [S.AUDIO], n, r, i, a) {
|
|
|
13729
13882
|
anonymous: !!N.anonymToken
|
|
13730
13883
|
});
|
|
13731
13884
|
}
|
|
13732
|
-
function
|
|
13733
|
-
let t =
|
|
13885
|
+
function sl(e) {
|
|
13886
|
+
let t = wu(e?.conversationId);
|
|
13734
13887
|
return t ? t.hangup(e) : ($.hangupAfterInit(e?.onFastHangup), Promise.resolve());
|
|
13735
13888
|
}
|
|
13736
|
-
async function
|
|
13889
|
+
async function cl(e, t) {
|
|
13737
13890
|
let n = Array.isArray(e) ? e : [e], r = $.current();
|
|
13738
13891
|
r && await r.addParticipant(n, t);
|
|
13739
13892
|
}
|
|
13740
|
-
async function
|
|
13893
|
+
async function ll(e, t) {
|
|
13741
13894
|
let n = $.current();
|
|
13742
13895
|
if (n) {
|
|
13743
13896
|
let r = e.map((e) => M.composeUserId(e));
|
|
13744
13897
|
await n.addParticipantLegacy(r, t);
|
|
13745
13898
|
}
|
|
13746
13899
|
}
|
|
13747
|
-
async function
|
|
13748
|
-
let n =
|
|
13900
|
+
async function ul(e, t = !1) {
|
|
13901
|
+
let n = Ou(e, "removeParticipant");
|
|
13749
13902
|
if (n) try {
|
|
13750
13903
|
await n.conversation.removeParticipant(M.decomposeParticipantId(n.participantId).compositeUserId, t);
|
|
13751
13904
|
} catch (e) {
|
|
13752
13905
|
z.warn(`Failed to remove participant ${n.participantId}. Perhaps he is no longer on the call. ${e}`);
|
|
13753
13906
|
}
|
|
13754
13907
|
}
|
|
13755
|
-
async function
|
|
13908
|
+
async function dl(e, t = !1) {
|
|
13756
13909
|
let n = $.current();
|
|
13757
13910
|
if (n) try {
|
|
13758
13911
|
await n.removeParticipant(M.composeUserId(e), t);
|
|
@@ -13760,13 +13913,13 @@ async function al(e, t = !1) {
|
|
|
13760
13913
|
z.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
|
|
13761
13914
|
}
|
|
13762
13915
|
}
|
|
13763
|
-
async function
|
|
13916
|
+
async function fl(e, t) {
|
|
13764
13917
|
let n = $.current();
|
|
13765
13918
|
if (e === "videoinput" && jt.contains(t)) return N.videoFacingMode = t, n ? (E.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
|
|
13766
13919
|
if (!await E._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
|
|
13767
13920
|
if (n) return n.changeDevice(e);
|
|
13768
13921
|
}
|
|
13769
|
-
async function
|
|
13922
|
+
async function pl(e, t) {
|
|
13770
13923
|
let n = typeof e == "object" ? {
|
|
13771
13924
|
...e,
|
|
13772
13925
|
fastScreenSharing: e.captureScreen && e.fastScreenSharing,
|
|
@@ -13775,40 +13928,40 @@ async function sl(e, t) {
|
|
|
13775
13928
|
captureScreen: e,
|
|
13776
13929
|
fastScreenSharing: !1,
|
|
13777
13930
|
captureAudio: !1
|
|
13778
|
-
}, r =
|
|
13931
|
+
}, r = wu(t);
|
|
13779
13932
|
return r ? r.toggleScreenCapturing(n) : Promise.reject();
|
|
13780
13933
|
}
|
|
13781
|
-
function
|
|
13934
|
+
function ml(e) {
|
|
13782
13935
|
let t = $.current();
|
|
13783
13936
|
t && t.toggleAnimojiCapturing(e);
|
|
13784
13937
|
}
|
|
13785
|
-
async function
|
|
13938
|
+
async function hl(e, t = !1) {
|
|
13786
13939
|
let n = $.current();
|
|
13787
13940
|
n && await n.setVideoStream(e, t);
|
|
13788
13941
|
}
|
|
13789
|
-
async function
|
|
13790
|
-
let n =
|
|
13942
|
+
async function gl(e, t) {
|
|
13943
|
+
let n = wu(t);
|
|
13791
13944
|
n && await n.toggleLocalVideo(e);
|
|
13792
13945
|
}
|
|
13793
|
-
async function
|
|
13794
|
-
let n =
|
|
13946
|
+
async function _l(e, t) {
|
|
13947
|
+
let n = wu(t);
|
|
13795
13948
|
n && await n.toggleLocalAudio(e);
|
|
13796
13949
|
}
|
|
13797
|
-
async function
|
|
13950
|
+
async function vl(e) {
|
|
13798
13951
|
let t = $.current();
|
|
13799
13952
|
if (t) return t.setLocalResolution(e);
|
|
13800
13953
|
}
|
|
13801
|
-
async function
|
|
13954
|
+
async function yl(e) {
|
|
13802
13955
|
let t = $.current();
|
|
13803
13956
|
t && await t.changePriorities(e);
|
|
13804
13957
|
}
|
|
13805
|
-
async function
|
|
13958
|
+
async function bl(e, t) {
|
|
13806
13959
|
let n = $.current();
|
|
13807
13960
|
if (n) {
|
|
13808
13961
|
if (t) {
|
|
13809
13962
|
let r = n.getCachedParticipantIdByExternalId(t);
|
|
13810
13963
|
if (!r) {
|
|
13811
|
-
|
|
13964
|
+
Tu(t, "changeParticipantState", n);
|
|
13812
13965
|
return;
|
|
13813
13966
|
}
|
|
13814
13967
|
await n.changeParticipantState(e, r);
|
|
@@ -13817,161 +13970,161 @@ async function ml(e, t) {
|
|
|
13817
13970
|
await n.changeParticipantState(e);
|
|
13818
13971
|
}
|
|
13819
13972
|
}
|
|
13820
|
-
async function
|
|
13973
|
+
async function xl() {
|
|
13821
13974
|
let e = $.current();
|
|
13822
13975
|
e && await e.putHandsDown();
|
|
13823
13976
|
}
|
|
13824
|
-
async function
|
|
13977
|
+
async function Sl(e) {
|
|
13825
13978
|
let t = $.current();
|
|
13826
13979
|
t && await t.updateDisplayLayout(e);
|
|
13827
13980
|
}
|
|
13828
|
-
async function
|
|
13981
|
+
async function Cl(e) {
|
|
13829
13982
|
let t = $.current();
|
|
13830
13983
|
t && await t.requestDisplayLayout(e);
|
|
13831
13984
|
}
|
|
13832
|
-
async function
|
|
13833
|
-
let r =
|
|
13985
|
+
async function wl(e, t, n = !1) {
|
|
13986
|
+
let r = Ou(e, "grantRoles");
|
|
13834
13987
|
r && await r.conversation.grantRoles(r.participantId, t, n);
|
|
13835
13988
|
}
|
|
13836
|
-
async function
|
|
13989
|
+
async function Tl(e, t, n, r = !1) {
|
|
13837
13990
|
let i = $.current();
|
|
13838
13991
|
i && await i.grantRoles(M.composeParticipantId(e, j.USER, t), n, r);
|
|
13839
13992
|
}
|
|
13840
|
-
async function
|
|
13993
|
+
async function El({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
|
|
13841
13994
|
if (e) {
|
|
13842
|
-
let i =
|
|
13995
|
+
let i = Ou(e, "muteParticipant");
|
|
13843
13996
|
return i ? i.conversation.muteParticipant(i.participantId, t, n, r) : void 0;
|
|
13844
13997
|
}
|
|
13845
13998
|
let i = $.current();
|
|
13846
13999
|
i && await i.muteParticipant(null, t, n, r);
|
|
13847
14000
|
}
|
|
13848
|
-
async function
|
|
14001
|
+
async function Dl({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
|
|
13849
14002
|
let a = $.current();
|
|
13850
14003
|
if (a) {
|
|
13851
14004
|
let o = e ? M.composeParticipantId(e, j.USER, r) : null;
|
|
13852
14005
|
await a.muteParticipant(o, t, n, i);
|
|
13853
14006
|
}
|
|
13854
14007
|
}
|
|
13855
|
-
async function
|
|
13856
|
-
let r =
|
|
14008
|
+
async function Ol(e, t = !1, n = null) {
|
|
14009
|
+
let r = Ou(e, "pinParticipant");
|
|
13857
14010
|
r && await r.conversation.pinParticipant(r.participantId, t, n);
|
|
13858
14011
|
}
|
|
13859
|
-
async function
|
|
14012
|
+
async function kl(e, t = !1, n = 0, r = null) {
|
|
13860
14013
|
let i = $.current();
|
|
13861
14014
|
i && await i.pinParticipant(M.composeParticipantId(e, j.USER, n), t, r);
|
|
13862
14015
|
}
|
|
13863
|
-
async function
|
|
14016
|
+
async function Al(e) {
|
|
13864
14017
|
let t = $.current();
|
|
13865
14018
|
t && await t.updateMediaModifiers(e);
|
|
13866
14019
|
}
|
|
13867
|
-
async function
|
|
14020
|
+
async function jl(e) {
|
|
13868
14021
|
let t = $.current();
|
|
13869
14022
|
t && await t.enableVideoSuspend(e);
|
|
13870
14023
|
}
|
|
13871
|
-
async function
|
|
14024
|
+
async function Ml(e) {
|
|
13872
14025
|
let t = $.current();
|
|
13873
14026
|
t && await t.enableVideoSuspendSuggest(e);
|
|
13874
14027
|
}
|
|
13875
|
-
async function
|
|
14028
|
+
async function Nl(e) {
|
|
13876
14029
|
let t = $.current();
|
|
13877
14030
|
t && await t.changeOptions(e);
|
|
13878
14031
|
}
|
|
13879
|
-
async function
|
|
14032
|
+
async function Pl(e, t = null) {
|
|
13880
14033
|
if (t) {
|
|
13881
|
-
let n =
|
|
14034
|
+
let n = Ou(t, "chatMessage");
|
|
13882
14035
|
return n ? n.conversation.chatMessage(e, M.decomposeParticipantId(n.participantId).compositeUserId) : void 0;
|
|
13883
14036
|
}
|
|
13884
14037
|
let n = $.current();
|
|
13885
14038
|
n && await n.chatMessage(e, null);
|
|
13886
14039
|
}
|
|
13887
|
-
async function
|
|
14040
|
+
async function Fl(e, t = null) {
|
|
13888
14041
|
let n = $.current();
|
|
13889
14042
|
if (n) {
|
|
13890
14043
|
let r = t ? M.composeUserId(t) : null;
|
|
13891
14044
|
await n.chatMessage(e, r);
|
|
13892
14045
|
}
|
|
13893
14046
|
}
|
|
13894
|
-
async function
|
|
14047
|
+
async function Il(e = 10) {
|
|
13895
14048
|
let t = $.current();
|
|
13896
14049
|
if (t) return t.chatHistory(e);
|
|
13897
14050
|
}
|
|
13898
|
-
async function
|
|
14051
|
+
async function Ll(e, t = null) {
|
|
13899
14052
|
if (t) {
|
|
13900
|
-
let n =
|
|
14053
|
+
let n = Ou(t, "customData");
|
|
13901
14054
|
return n ? n.conversation.customData(e, n.participantId) : void 0;
|
|
13902
14055
|
}
|
|
13903
14056
|
let n = $.current();
|
|
13904
14057
|
n && await n.customData(e, null);
|
|
13905
14058
|
}
|
|
13906
|
-
async function
|
|
14059
|
+
async function Rl(e, t = null, n = 0) {
|
|
13907
14060
|
let r = $.current();
|
|
13908
14061
|
if (r) {
|
|
13909
14062
|
let i = t ? M.composeParticipantId(t, j.USER, n) : null;
|
|
13910
14063
|
await r.customData(e, i);
|
|
13911
14064
|
}
|
|
13912
14065
|
}
|
|
13913
|
-
async function
|
|
13914
|
-
return (await
|
|
14066
|
+
async function zl(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
|
|
14067
|
+
return (await Lc.createConversation(a ?? M.uuid(), e, t, {
|
|
13915
14068
|
onlyAdminCanShareMovie: n,
|
|
13916
14069
|
waitForAdmin: r,
|
|
13917
14070
|
closedConversation: i
|
|
13918
14071
|
})).join_link;
|
|
13919
14072
|
}
|
|
13920
|
-
async function
|
|
14073
|
+
async function Bl(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
|
|
13921
14074
|
let a = i.map((e) => Z.fromId(e));
|
|
13922
|
-
return (await
|
|
14075
|
+
return (await Lc.createConversation(M.uuid(), e, t, {
|
|
13923
14076
|
onlyAdminCanShareMovie: n,
|
|
13924
14077
|
audienceMode: !0,
|
|
13925
14078
|
audioOnly: r
|
|
13926
14079
|
}, a)).join_link;
|
|
13927
14080
|
}
|
|
13928
|
-
async function
|
|
14081
|
+
async function Vl() {
|
|
13929
14082
|
let e = $.current();
|
|
13930
14083
|
return e ? e.createJoinLink() : Promise.reject();
|
|
13931
14084
|
}
|
|
13932
|
-
async function
|
|
14085
|
+
async function Hl() {
|
|
13933
14086
|
let e = $.current();
|
|
13934
14087
|
return e ? e.removeJoinLink() : Promise.reject();
|
|
13935
14088
|
}
|
|
13936
|
-
async function
|
|
13937
|
-
return
|
|
14089
|
+
async function Ul(e, t) {
|
|
14090
|
+
return Lc.getAnonymTokenByLink(e, t);
|
|
13938
14091
|
}
|
|
13939
|
-
function
|
|
14092
|
+
function Wl(e) {
|
|
13940
14093
|
let t = $.current();
|
|
13941
14094
|
t && t.setVolume(e);
|
|
13942
14095
|
}
|
|
13943
|
-
function
|
|
14096
|
+
function Gl(e) {
|
|
13944
14097
|
N.forceRelayPolicy = e;
|
|
13945
14098
|
}
|
|
13946
|
-
async function
|
|
14099
|
+
async function Kl(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
|
|
13947
14100
|
let o = $.current();
|
|
13948
14101
|
return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
|
|
13949
14102
|
}
|
|
13950
|
-
async function
|
|
14103
|
+
async function ql(e = null, t) {
|
|
13951
14104
|
let n = $.current();
|
|
13952
14105
|
return n ? n.stopStream(e, t) : Promise.reject();
|
|
13953
14106
|
}
|
|
13954
|
-
async function
|
|
14107
|
+
async function Jl(e = null) {
|
|
13955
14108
|
let t = $.current();
|
|
13956
14109
|
return t ? t.publishStream(e) : Promise.reject();
|
|
13957
14110
|
}
|
|
13958
|
-
async function
|
|
14111
|
+
async function Yl() {
|
|
13959
14112
|
let e = $.current();
|
|
13960
14113
|
return e ? e.getStreamInfo() : Promise.reject();
|
|
13961
14114
|
}
|
|
13962
|
-
async function
|
|
14115
|
+
async function Xl(e) {
|
|
13963
14116
|
let t = $.current();
|
|
13964
14117
|
return t ? t.addMovie(e) : Promise.reject();
|
|
13965
14118
|
}
|
|
13966
|
-
async function
|
|
14119
|
+
async function Zl(e) {
|
|
13967
14120
|
let t = $.current();
|
|
13968
14121
|
return t ? t.updateMovie(e) : Promise.reject();
|
|
13969
14122
|
}
|
|
13970
|
-
async function
|
|
14123
|
+
async function Ql(e) {
|
|
13971
14124
|
let t = $.current();
|
|
13972
14125
|
return t ? t.removeMovie(e) : Promise.reject();
|
|
13973
14126
|
}
|
|
13974
|
-
async function
|
|
14127
|
+
async function $l(e, t) {
|
|
13975
14128
|
let n = $.current();
|
|
13976
14129
|
if (n) {
|
|
13977
14130
|
let r = [], i = [];
|
|
@@ -13993,46 +14146,46 @@ async function ql(e, t) {
|
|
|
13993
14146
|
});
|
|
13994
14147
|
}
|
|
13995
14148
|
if (i.length) {
|
|
13996
|
-
|
|
14149
|
+
Eu(i, "updateRooms", n);
|
|
13997
14150
|
return;
|
|
13998
14151
|
}
|
|
13999
14152
|
return n.updateRooms(r, t);
|
|
14000
14153
|
}
|
|
14001
14154
|
return Promise.reject();
|
|
14002
14155
|
}
|
|
14003
|
-
async function
|
|
14156
|
+
async function eu(e, t) {
|
|
14004
14157
|
let n = $.current();
|
|
14005
14158
|
return n ? n.activateRooms(e, t) : Promise.reject();
|
|
14006
14159
|
}
|
|
14007
|
-
async function
|
|
14160
|
+
async function tu(e = null, t = null) {
|
|
14008
14161
|
let n = $.current();
|
|
14009
14162
|
if (!n) return Promise.reject();
|
|
14010
14163
|
let r;
|
|
14011
14164
|
if (t && (r = n.getCachedParticipantIdByExternalId(t) ?? void 0, !r)) {
|
|
14012
|
-
|
|
14165
|
+
Tu(t, "switchRoom", n);
|
|
14013
14166
|
return;
|
|
14014
14167
|
}
|
|
14015
14168
|
return n.switchRoom(e, r);
|
|
14016
14169
|
}
|
|
14017
|
-
async function
|
|
14170
|
+
async function nu(e) {
|
|
14018
14171
|
let t = $.current();
|
|
14019
14172
|
return t ? t.removeRooms(e) : Promise.reject();
|
|
14020
14173
|
}
|
|
14021
|
-
function
|
|
14174
|
+
function ru(e) {
|
|
14022
14175
|
N.statisticsInterval = e;
|
|
14023
14176
|
let t = $.current();
|
|
14024
14177
|
if (t) return t.updateStatisticsInterval();
|
|
14025
14178
|
}
|
|
14026
|
-
function
|
|
14179
|
+
function iu(t) {
|
|
14027
14180
|
e.disableLog(!t), z.toggle(t);
|
|
14028
14181
|
}
|
|
14029
|
-
function
|
|
14182
|
+
function au(e, ...t) {
|
|
14030
14183
|
N.debugLog && ($.debugMessage(e, "[external]", ...t) || z.send(e, "[external]", ...t));
|
|
14031
14184
|
}
|
|
14032
|
-
function
|
|
14185
|
+
function ou(e, t, ...n) {
|
|
14033
14186
|
N.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || z.send(e, "[external]", ...n));
|
|
14034
14187
|
}
|
|
14035
|
-
var
|
|
14188
|
+
var su = {
|
|
14036
14189
|
list: Ne,
|
|
14037
14190
|
get: Pe,
|
|
14038
14191
|
getJson: Fe,
|
|
@@ -14040,7 +14193,7 @@ var tu = {
|
|
|
14040
14193
|
clear: Le,
|
|
14041
14194
|
stats: Re
|
|
14042
14195
|
};
|
|
14043
|
-
function
|
|
14196
|
+
function cu() {
|
|
14044
14197
|
let e = [
|
|
14045
14198
|
[`Calls SDK ${N.sdkVersion}`, N.toJSON()],
|
|
14046
14199
|
["UserAgent:", navigator.userAgent],
|
|
@@ -14058,139 +14211,139 @@ function nu() {
|
|
|
14058
14211
|
d: e
|
|
14059
14212
|
}));
|
|
14060
14213
|
}
|
|
14061
|
-
async function
|
|
14214
|
+
async function lu() {
|
|
14062
14215
|
let e = $.id(), t = $.debugSessionId();
|
|
14063
14216
|
if (!t || !e) throw z.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
|
|
14064
14217
|
let n = await Pe({ sessionId: t });
|
|
14065
14218
|
if (n.length === 0) throw z.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
|
|
14066
14219
|
let r = n[0].t, i = n[n.length - 1].t;
|
|
14067
14220
|
try {
|
|
14068
|
-
return
|
|
14221
|
+
return Lc?.uploadDebugLogs(e, r, i, JSON.stringify([...cu(), ...n]));
|
|
14069
14222
|
} catch (e) {
|
|
14070
14223
|
throw z.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
|
|
14071
14224
|
}
|
|
14072
14225
|
}
|
|
14073
|
-
async function
|
|
14226
|
+
async function uu(e) {
|
|
14074
14227
|
let t = $.current();
|
|
14075
14228
|
if (t) return t.videoEffect(e);
|
|
14076
14229
|
}
|
|
14077
|
-
async function
|
|
14230
|
+
async function du(e, t) {
|
|
14078
14231
|
let n = $.current();
|
|
14079
14232
|
if (n) return n.audioEffect(e.length > 0 ? e : null, t);
|
|
14080
14233
|
}
|
|
14081
|
-
async function
|
|
14234
|
+
async function fu(e) {
|
|
14082
14235
|
let t = $.current();
|
|
14083
14236
|
t && await t.setAudioStream(e);
|
|
14084
14237
|
}
|
|
14085
|
-
async function
|
|
14238
|
+
async function pu(e, t = null, n = null) {
|
|
14086
14239
|
let r = $.current();
|
|
14087
14240
|
if (!r) return;
|
|
14088
14241
|
let i = n ?? t?.id, a = null;
|
|
14089
14242
|
if (t && (a = r.getCachedParticipantIdByExternalId(t), !a)) {
|
|
14090
|
-
|
|
14243
|
+
Tu(t, "setVmojiSvg", r);
|
|
14091
14244
|
return;
|
|
14092
14245
|
}
|
|
14093
14246
|
r.setAnimojiSvg(e, a, i);
|
|
14094
14247
|
}
|
|
14095
|
-
function
|
|
14248
|
+
function mu(e) {
|
|
14096
14249
|
let t = $.current();
|
|
14097
14250
|
t && t.setAnimojiFill(e);
|
|
14098
14251
|
}
|
|
14099
|
-
async function
|
|
14100
|
-
return
|
|
14252
|
+
async function hu(e = null, t, n = !1) {
|
|
14253
|
+
return Du().getWaitingHall(e, t, n);
|
|
14101
14254
|
}
|
|
14102
|
-
async function
|
|
14103
|
-
return
|
|
14255
|
+
async function gu() {
|
|
14256
|
+
return Du().getAudienceModeHands();
|
|
14104
14257
|
}
|
|
14105
|
-
async function
|
|
14106
|
-
let n =
|
|
14258
|
+
async function _u(e, t = !1) {
|
|
14259
|
+
let n = Du(), r;
|
|
14107
14260
|
if (e) {
|
|
14108
14261
|
let t = n.getCachedParticipantIdByExternalId(e);
|
|
14109
14262
|
if (!t) {
|
|
14110
|
-
|
|
14263
|
+
Tu(e, "promoteParticipant", n);
|
|
14111
14264
|
return;
|
|
14112
14265
|
}
|
|
14113
14266
|
r = M.decomposeParticipantId(t).compositeUserId;
|
|
14114
14267
|
}
|
|
14115
14268
|
return n.promoteParticipant(r, t);
|
|
14116
14269
|
}
|
|
14117
|
-
async function
|
|
14118
|
-
return
|
|
14270
|
+
async function vu(e = !1) {
|
|
14271
|
+
return Du().requestPromotion(e);
|
|
14119
14272
|
}
|
|
14120
|
-
async function
|
|
14121
|
-
return
|
|
14273
|
+
async function yu(e = !1) {
|
|
14274
|
+
return Du().acceptPromotion(e);
|
|
14122
14275
|
}
|
|
14123
|
-
async function
|
|
14124
|
-
return
|
|
14276
|
+
async function bu(e) {
|
|
14277
|
+
return Du().getParticipantListChunk(e);
|
|
14125
14278
|
}
|
|
14126
|
-
async function
|
|
14127
|
-
return
|
|
14279
|
+
async function xu(e) {
|
|
14280
|
+
return Du().getParticipants(e);
|
|
14128
14281
|
}
|
|
14129
|
-
async function
|
|
14130
|
-
return
|
|
14282
|
+
async function Su(e) {
|
|
14283
|
+
return Du().feedback(e);
|
|
14131
14284
|
}
|
|
14132
|
-
async function
|
|
14133
|
-
return
|
|
14285
|
+
async function Cu(e, t, n) {
|
|
14286
|
+
return Du(n).enableFeatureForRoles(e, t);
|
|
14134
14287
|
}
|
|
14135
|
-
function
|
|
14288
|
+
function wu(e) {
|
|
14136
14289
|
return e ? B.get(e) ?? null : $.current() ?? B.getFirst();
|
|
14137
14290
|
}
|
|
14138
|
-
function
|
|
14291
|
+
function Tu(e, t, n) {
|
|
14139
14292
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external ID "${e.id}" while handling ${t}`), n.id);
|
|
14140
14293
|
}
|
|
14141
|
-
function
|
|
14294
|
+
function Eu(e, t, n) {
|
|
14142
14295
|
let r = Array.from(new Set(e));
|
|
14143
14296
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external IDs "${r.join("\", \"")}" while handling ${t}`), n.id);
|
|
14144
14297
|
}
|
|
14145
|
-
function
|
|
14146
|
-
let t =
|
|
14298
|
+
function Du(e) {
|
|
14299
|
+
let t = wu(e);
|
|
14147
14300
|
if (!t) throw Error("Conversation not found");
|
|
14148
14301
|
return t;
|
|
14149
14302
|
}
|
|
14150
|
-
function
|
|
14303
|
+
function Ou(e, t) {
|
|
14151
14304
|
let n = $.current();
|
|
14152
14305
|
if (!n) return null;
|
|
14153
14306
|
let r = n.getCachedParticipantIdByExternalId(e);
|
|
14154
14307
|
return r ? {
|
|
14155
14308
|
conversation: n,
|
|
14156
14309
|
participantId: r
|
|
14157
|
-
} : (
|
|
14310
|
+
} : (Tu(e, t, n), null);
|
|
14158
14311
|
}
|
|
14159
|
-
async function
|
|
14160
|
-
await
|
|
14312
|
+
async function ku(e) {
|
|
14313
|
+
await Lc.removeHistoryRecords(e);
|
|
14161
14314
|
}
|
|
14162
|
-
async function
|
|
14315
|
+
async function Au(e) {
|
|
14163
14316
|
let t = $.current() ?? B.getFirst();
|
|
14164
14317
|
t && await t.startAsr(e);
|
|
14165
14318
|
}
|
|
14166
|
-
async function
|
|
14319
|
+
async function ju(e) {
|
|
14167
14320
|
let t = $.current() ?? B.getFirst();
|
|
14168
14321
|
t && await t.stopAsr(e);
|
|
14169
14322
|
}
|
|
14170
|
-
async function
|
|
14323
|
+
async function Mu(e) {
|
|
14171
14324
|
let t = $.current() ?? B.getFirst();
|
|
14172
14325
|
t && await t.requestAsr(e);
|
|
14173
14326
|
}
|
|
14174
|
-
async function
|
|
14327
|
+
async function Nu(e) {
|
|
14175
14328
|
let t = $.current();
|
|
14176
14329
|
return t ? t.startUrlSharing(e) : Promise.reject();
|
|
14177
14330
|
}
|
|
14178
|
-
async function
|
|
14331
|
+
async function Pu() {
|
|
14179
14332
|
let e = $.current();
|
|
14180
14333
|
return e ? e.stopUrlSharing() : Promise.reject();
|
|
14181
14334
|
}
|
|
14182
|
-
async function
|
|
14335
|
+
async function Fu(e) {
|
|
14183
14336
|
await B.switchCall(e);
|
|
14184
14337
|
}
|
|
14185
|
-
function
|
|
14338
|
+
function Iu() {
|
|
14186
14339
|
return B.getActiveId();
|
|
14187
14340
|
}
|
|
14188
|
-
function
|
|
14341
|
+
function Lu() {
|
|
14189
14342
|
return $.getSyncedTime();
|
|
14190
14343
|
}
|
|
14191
|
-
function
|
|
14344
|
+
function Ru() {
|
|
14192
14345
|
return N.sdkVersion;
|
|
14193
14346
|
}
|
|
14194
14347
|
typeof window < "u" && (window.__CALLS_SDK = xn);
|
|
14195
14348
|
//#endregion
|
|
14196
|
-
export {
|
|
14349
|
+
export { Ac as Api, Ic as ApiExternal, Fc as ArrayDequeue, y as AuthData, f as BaseLogger, so as CallDirection, co as CallType, lo as ChatRoomEventType, uo as ConversationFeature, fo as ConversationOption, wn as DebugMessageType, Co as ExternalIdType, jt as FacingMode, x as FatalError, k as HangupReason, O as HangupType, S as MediaOption, A as MediaTrackKind, H as MediaType, ho as MuteState, X as ParticipantState, Pc as ParticipantStateDataValue, P as ParticipantStatus, Nc as RecordRole, go as RoomsEventType, oo as Signaling, V as SignalingCommandType, br as SignalingConnectionType, K as SignalingNotification, U as Stat, J as TransportTopology, yo as UserRole, j as UserType, Ko as VolumeDetector, nl as acceptCall, yu as acceptPromotion, eu as activateRooms, Xl as addMovie, cl as addParticipant, ll as addParticipantInternal, tl as authorize, Bc as browser, Xc as callInternal, Jc as callTo, pl as captureScreen, ml as captureVmoji, du as changeAudioEffect, Nl as changeConversationOptions, fl as changeDevice, bl as changeParticipantState, yl as changePriorities, uu as changeVideoEffect, Il as chatHistory, Pl as chatMessage, Fl as chatMessageInternal, Vl as createJoinLink, Ll as customData, Rl as customDataInternal, iu as debug, su as debugLogs, au as debugMessage, ou as debugMessageWithContext, rl as declineCall, Cu as enableFeatureForRoles, jl as enableVideoSuspend, Ml as enableVideoSuspendSuggest, Su as feedback, Gl as forceRelayPolicy, Iu as getActiveCallId, Ul as getAnonymTokenByLink, gu as getAudienceModeHands, $c as getInbounds, bu as getParticipantListChunk, xu as getParticipants, Yl as getStreamInfo, Lu as getSyncedTime, hu as getWaitingHall, wl as grantRoles, Tl as grantRolesInternal, sl as hangup, qc as init, il as joinCall, ol as joinCallByLink, al as joinCallInternal, El as muteParticipant, Dl as muteParticipantInternal, Ol as pinParticipant, kl as pinParticipantInternal, Zc as processPush, Qc as processPushInternal, _u as promoteParticipant, Jl as publishStream, xl as putHandsDown, ku as removeHistoryRecords, Hl as removeJoinLink, Ql as removeMovie, ul as removeParticipant, dl as removeParticipantInternal, nu as removeRooms, Mu as requestAsr, Cl as requestDisplayLayout, vu as requestPromotion, Wc as setAudioEffects, fu as setAudioStream, vl as setLocalResolution, Hc as setLogger, Al as setMediaModifiers, ru as setStatisticsInterval, Gc as setVad, Uc as setVideoEffects, hl as setVideoStream, Kc as setVmoji, mu as setVmojiFill, pu as setVmojiSvg, Wl as setVolume, Au as startAsr, Bl as startAudienceConversation, zl as startConversation, el as startStats, Kl as startStream, Nu as startUrlSharing, ju as stopAsr, ql as stopStream, Pu as stopUrlSharing, Fu as switchCall, tu as switchRoom, _l as toggleLocalAudio, gl as toggleLocalVideo, Sl as updateDisplayLayout, Zl as updateMovie, $l as updateRooms, lu as uploadDebugLogs, Vc as utils, Ru as version };
|