@vkontakte/calls-sdk 2.8.13-dev.c9243c68.0 → 2.8.13-dev.f163e503.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/abstract/BaseApi.d.ts +8 -10
- package/calls-sdk.cjs.js +6 -6
- package/calls-sdk.esm.js +1073 -901
- package/classes/ExternalIdCache.d.ts +9 -13
- package/classes/conversation/Conversation.d.ts +6 -4
- package/classes/conversation/Conversation.testUtils.d.ts +2 -0
- package/classes/conversation/DisplayLayoutRequester.d.ts +3 -1
- package/classes/stat/SdpStats.d.ts +38 -0
- package/classes/transport/DirectTransport.d.ts +1 -0
- package/classes/transport/ServerTransport.d.ts +1 -0
- package/default/Api.d.ts +8 -10
- package/enums/Stat.d.ts +12 -0
- package/package.json +1 -1
- package/static/External.d.ts +10 -0
- package/static/Params.d.ts +20 -1
package/calls-sdk.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @vkontakte/calls-sdk v2.8.13-dev.
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/calls-sdk v2.8.13-dev.f163e503.0
|
|
3
|
+
* Thu, 17 Sep 2026 13:03:47 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -1029,7 +1029,7 @@ var w;
|
|
|
1029
1029
|
function g() {
|
|
1030
1030
|
if (!yt || yt.readyState === "ended") {
|
|
1031
1031
|
let e = w.getAudioContext(), t = e.createMediaStreamDestination(), n = e.createGain();
|
|
1032
|
-
n.gain.value = 1e-5, n.connect(t), n.connect(e.destination);
|
|
1032
|
+
n.gain.value = 1e-5, n.connect(t), w.browserName() === "Safari" && n.connect(e.destination);
|
|
1033
1033
|
let r = e.createOscillator();
|
|
1034
1034
|
r.type = "sine", r.frequency.value = 0, r.connect(n), r.start(), yt = t.stream.getAudioTracks()[0];
|
|
1035
1035
|
}
|
|
@@ -2152,10 +2152,13 @@ var yn = vn.getInstance(), M = class e {
|
|
|
2152
2152
|
return "ok.calls.sdk.js";
|
|
2153
2153
|
}
|
|
2154
2154
|
static get appVersion() {
|
|
2155
|
+
return e._params.appVersion;
|
|
2156
|
+
}
|
|
2157
|
+
static get apiClientVersion() {
|
|
2155
2158
|
return 1.1;
|
|
2156
2159
|
}
|
|
2157
2160
|
static get sdkVersion() {
|
|
2158
|
-
return "2.8.13-dev.
|
|
2161
|
+
return "2.8.13-dev.f163e503.0";
|
|
2159
2162
|
}
|
|
2160
2163
|
static get debug() {
|
|
2161
2164
|
return e._params.debug;
|
|
@@ -2578,6 +2581,7 @@ var yn = vn.getInstance(), M = class e {
|
|
|
2578
2581
|
movieShare: e._params.movieShare,
|
|
2579
2582
|
clientType: e._params.clientType,
|
|
2580
2583
|
clientStatsPlatform: e._params.clientStatsPlatform,
|
|
2584
|
+
appVersion: e._params.appVersion,
|
|
2581
2585
|
consumerScreenDataChannelPacketSize: e._params.consumerScreenDataChannelPacketSize,
|
|
2582
2586
|
switchVideoAtBadNetwork: e._params.switchVideoAtBadNetwork,
|
|
2583
2587
|
simulcast: e._params.simulcast,
|
|
@@ -2593,6 +2597,7 @@ var yn = vn.getInstance(), M = class e {
|
|
|
2593
2597
|
h(M, "_params", {
|
|
2594
2598
|
platform: "WEB",
|
|
2595
2599
|
clientStatsPlatform: "",
|
|
2600
|
+
appVersion: "0.0.0",
|
|
2596
2601
|
clientType: "PORTAL",
|
|
2597
2602
|
externalUserType: "",
|
|
2598
2603
|
device: "browser",
|
|
@@ -3065,6 +3070,10 @@ var xn;
|
|
|
3065
3070
|
P("onPeerRegistered", e, t);
|
|
3066
3071
|
}
|
|
3067
3072
|
e.onPeerRegistered = ot;
|
|
3073
|
+
function st(e, t) {
|
|
3074
|
+
P("onNonFatalError", e, t);
|
|
3075
|
+
}
|
|
3076
|
+
e.onNonFatalError = st;
|
|
3068
3077
|
})(xn || (xn = {}));
|
|
3069
3078
|
var L = xn, Sn = /* @__PURE__ */ function(e) {
|
|
3070
3079
|
return e.DEBUG = "DEBUG", e.LOG = "LOG", e.WARN = "WARN", e.ERROR = "ERROR", e;
|
|
@@ -3581,7 +3590,7 @@ var Rn = 0, zn = 1, Bn = 2, Vn = 3, Hn = 4, Un = 5, Wn = 6, Gn = 7, Kn = 0, qn =
|
|
|
3581
3590
|
};
|
|
3582
3591
|
}
|
|
3583
3592
|
}, H = /* @__PURE__ */ function(e) {
|
|
3584
|
-
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.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;
|
|
3593
|
+
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.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;
|
|
3585
3594
|
}(H || {}), er = 1e3;
|
|
3586
3595
|
function U(e, t, n = 0) {
|
|
3587
3596
|
return t in e && e[t] ? e[t] : n;
|
|
@@ -3819,14 +3828,136 @@ function kr() {
|
|
|
3819
3828
|
};
|
|
3820
3829
|
}
|
|
3821
3830
|
//#endregion
|
|
3831
|
+
//#region src/classes/stat/SdpStats.ts
|
|
3832
|
+
var Ar = {
|
|
3833
|
+
offer: H.SDP_CREATE_OFFER,
|
|
3834
|
+
answer: H.SDP_CREATE_ANSWER
|
|
3835
|
+
}, jr = {
|
|
3836
|
+
offer: H.SDP_SET_LOCAL_OFFER,
|
|
3837
|
+
pranswer: H.SDP_SET_LOCAL_PRANSWER,
|
|
3838
|
+
answer: H.SDP_SET_LOCAL_ANSWER,
|
|
3839
|
+
rollback: H.SDP_SET_LOCAL_ROLLBACK
|
|
3840
|
+
}, Mr = {
|
|
3841
|
+
offer: H.SDP_SET_REMOTE_OFFER,
|
|
3842
|
+
pranswer: H.SDP_SET_REMOTE_PRANSWER,
|
|
3843
|
+
answer: H.SDP_SET_REMOTE_ANSWER,
|
|
3844
|
+
rollback: H.SDP_SET_REMOTE_ROLLBACK
|
|
3845
|
+
}, Nr = {
|
|
3846
|
+
local_address: null,
|
|
3847
|
+
remote_address: null,
|
|
3848
|
+
transport: null
|
|
3849
|
+
}, Pr = class {
|
|
3850
|
+
constructor(e) {
|
|
3851
|
+
h(this, "_statAggregator", void 0), h(this, "_pc", null), h(this, "_gatheringStartedAt", 0), h(this, "_remoteSdpReceivedAt", 0), h(this, "_handleGatheringStateChange", () => {
|
|
3852
|
+
this._pc?.iceGatheringState === "gathering" && (this._gatheringStartedAt = Date.now());
|
|
3853
|
+
}), this._statAggregator = e;
|
|
3854
|
+
}
|
|
3855
|
+
observe(e) {
|
|
3856
|
+
this.stop(), this._pc = e, this._gatheringStartedAt = Date.now(), this._remoteSdpReceivedAt = 0, e.addEventListener("icegatheringstatechange", this._handleGatheringStateChange);
|
|
3857
|
+
}
|
|
3858
|
+
stop() {
|
|
3859
|
+
this._pc?.removeEventListener("icegatheringstatechange", this._handleGatheringStateChange), this._pc = null;
|
|
3860
|
+
}
|
|
3861
|
+
logSdpGenerated(e) {
|
|
3862
|
+
this._log({
|
|
3863
|
+
name: H.SDP_GENERATED,
|
|
3864
|
+
value: 0,
|
|
3865
|
+
string_value: e,
|
|
3866
|
+
...Nr
|
|
3867
|
+
});
|
|
3868
|
+
}
|
|
3869
|
+
logCandidateGenerated(e) {
|
|
3870
|
+
let t = Ir(e.candidate);
|
|
3871
|
+
t && this._log({
|
|
3872
|
+
name: H.SDP_GENERATED,
|
|
3873
|
+
value: Math.max(0, Date.now() - this._gatheringStartedAt),
|
|
3874
|
+
string_value: t.type,
|
|
3875
|
+
local_address: t.address,
|
|
3876
|
+
remote_address: null,
|
|
3877
|
+
transport: t.protocol
|
|
3878
|
+
});
|
|
3879
|
+
}
|
|
3880
|
+
logSdpReceived(e) {
|
|
3881
|
+
this._remoteSdpReceivedAt = Date.now(), this._log({
|
|
3882
|
+
name: H.SDP_RECEIVED,
|
|
3883
|
+
value: 0,
|
|
3884
|
+
string_value: e,
|
|
3885
|
+
...Nr
|
|
3886
|
+
});
|
|
3887
|
+
}
|
|
3888
|
+
logCandidateReceived(e) {
|
|
3889
|
+
let t = Ir(e.candidate);
|
|
3890
|
+
t && this._log({
|
|
3891
|
+
name: H.SDP_RECEIVED,
|
|
3892
|
+
value: this._remoteSdpReceivedAt > 0 ? Math.max(0, Date.now() - this._remoteSdpReceivedAt) : 0,
|
|
3893
|
+
string_value: t.type,
|
|
3894
|
+
local_address: null,
|
|
3895
|
+
remote_address: t.address,
|
|
3896
|
+
transport: t.protocol
|
|
3897
|
+
});
|
|
3898
|
+
}
|
|
3899
|
+
logCreateFailed(e, t) {
|
|
3900
|
+
let n = Ar[e];
|
|
3901
|
+
n && this._logFailure(n, t, { remote: e === "answer" ? this._pc?.remoteDescription : void 0 });
|
|
3902
|
+
}
|
|
3903
|
+
logSetLocalFailed(e, t) {
|
|
3904
|
+
this._logFailure(jr[e.type], t, {
|
|
3905
|
+
local: e,
|
|
3906
|
+
remote: this._pc?.remoteDescription
|
|
3907
|
+
});
|
|
3908
|
+
}
|
|
3909
|
+
logSetRemoteFailed(e, t) {
|
|
3910
|
+
this._logFailure(Mr[e.type], t, {
|
|
3911
|
+
local: this._pc?.localDescription,
|
|
3912
|
+
remote: e
|
|
3913
|
+
});
|
|
3914
|
+
}
|
|
3915
|
+
destroy() {
|
|
3916
|
+
this.stop();
|
|
3917
|
+
}
|
|
3918
|
+
_logFailure(e, t, n) {
|
|
3919
|
+
this._log({
|
|
3920
|
+
name: e,
|
|
3921
|
+
value: 0,
|
|
3922
|
+
string_value: JSON.stringify({
|
|
3923
|
+
error: t instanceof Error ? t.message : String(t),
|
|
3924
|
+
local: Fr(n.local),
|
|
3925
|
+
remote: Fr(n.remote)
|
|
3926
|
+
}),
|
|
3927
|
+
...Nr
|
|
3928
|
+
});
|
|
3929
|
+
}
|
|
3930
|
+
_log(e) {
|
|
3931
|
+
this._statAggregator?.logEventualStat(e);
|
|
3932
|
+
}
|
|
3933
|
+
};
|
|
3934
|
+
function Fr(e) {
|
|
3935
|
+
return e ? {
|
|
3936
|
+
type: e.type,
|
|
3937
|
+
sdp: e.sdp
|
|
3938
|
+
} : void 0;
|
|
3939
|
+
}
|
|
3940
|
+
function Ir(e) {
|
|
3941
|
+
let t = e?.split(" ") ?? [], n = t.indexOf("typ"), r = t[2]?.toLowerCase(), i = t[4], a = n === -1 ? void 0 : t[n + 1];
|
|
3942
|
+
return r === void 0 || i === void 0 || a === void 0 || !zr(i) ? null : {
|
|
3943
|
+
protocol: r,
|
|
3944
|
+
address: i,
|
|
3945
|
+
type: a
|
|
3946
|
+
};
|
|
3947
|
+
}
|
|
3948
|
+
var Lr = /^\d{1,3}(\.\d{1,3}){3}$/, Rr = /^[0-9a-f:]+$/i;
|
|
3949
|
+
function zr(e) {
|
|
3950
|
+
return Lr.test(e) || e.includes(":") && Rr.test(e);
|
|
3951
|
+
}
|
|
3952
|
+
//#endregion
|
|
3822
3953
|
//#region src/classes/stat/FirstMediaSentProbe.ts
|
|
3823
|
-
var
|
|
3824
|
-
function
|
|
3954
|
+
var Br = 200;
|
|
3955
|
+
function Vr(e) {
|
|
3825
3956
|
for (let t of e.values()) if (t.type === "outbound-rtp" && (t.packetsSent ?? 0) > 0) return !0;
|
|
3826
3957
|
return !1;
|
|
3827
3958
|
}
|
|
3828
|
-
var
|
|
3829
|
-
constructor(e, t, n =
|
|
3959
|
+
var Hr = class {
|
|
3960
|
+
constructor(e, t, n = Br) {
|
|
3830
3961
|
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;
|
|
3831
3962
|
}
|
|
3832
3963
|
start() {
|
|
@@ -3849,7 +3980,7 @@ var Mr = class {
|
|
|
3849
3980
|
try {
|
|
3850
3981
|
let e = await this._getStatsReports();
|
|
3851
3982
|
if (this._state !== "polling") return;
|
|
3852
|
-
if (e.some(
|
|
3983
|
+
if (e.some(Vr)) {
|
|
3853
3984
|
this._state = "stopped", this._onFirstMediaSent();
|
|
3854
3985
|
return;
|
|
3855
3986
|
}
|
|
@@ -3862,7 +3993,7 @@ var Mr = class {
|
|
|
3862
3993
|
this._timer = null, this._poll();
|
|
3863
3994
|
}, this._pollIntervalMs));
|
|
3864
3995
|
}
|
|
3865
|
-
},
|
|
3996
|
+
}, Ur = class extends b {
|
|
3866
3997
|
constructor(e, t, n = null) {
|
|
3867
3998
|
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;
|
|
3868
3999
|
}
|
|
@@ -3873,12 +4004,12 @@ var Mr = class {
|
|
|
3873
4004
|
this._firstMediaSentProbeStopped = !0, this._disposeFirstMediaSentProbe();
|
|
3874
4005
|
}
|
|
3875
4006
|
_startFirstMediaSentProbe() {
|
|
3876
|
-
this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new
|
|
4007
|
+
this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new Hr(this._pc, this._onFirstMediaSent), this._firstMediaSentProbe.start());
|
|
3877
4008
|
}
|
|
3878
4009
|
_disposeFirstMediaSentProbe() {
|
|
3879
4010
|
this._firstMediaSentProbe?.destroy(), this._firstMediaSentProbe = null;
|
|
3880
4011
|
}
|
|
3881
|
-
},
|
|
4012
|
+
}, Wr = class {
|
|
3882
4013
|
constructor(e, t = null) {
|
|
3883
4014
|
h(this, "weightUp", void 0), h(this, "weightDown", void 0), h(this, "value", NaN), this.weightUp = e, this.weightDown = t ?? e;
|
|
3884
4015
|
}
|
|
@@ -3896,7 +4027,7 @@ var Mr = class {
|
|
|
3896
4027
|
getValue() {
|
|
3897
4028
|
return this.value;
|
|
3898
4029
|
}
|
|
3899
|
-
},
|
|
4030
|
+
}, Gr = .25, Kr = .35, qr = 85, Jr = .1, Yr = 1.5, Xr = .1, Zr = 1, Qr = .6, $r = .3, ei = class extends b {
|
|
3900
4031
|
constructor(e, t = R) {
|
|
3901
4032
|
super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
|
|
3902
4033
|
badNet: {
|
|
@@ -3908,8 +4039,8 @@ var Mr = class {
|
|
|
3908
4039
|
rtt: 600
|
|
3909
4040
|
}
|
|
3910
4041
|
}), h(this, "_lastStatSentTimestamp", 0), h(this, "_currentState", "good"), h(this, "_debug", void 0), this._debug = t, this._signaling = e, this._localNetworkStat = {
|
|
3911
|
-
rtt: new
|
|
3912
|
-
loss: new
|
|
4042
|
+
rtt: new Wr(Gr, Gr),
|
|
4043
|
+
loss: new Wr(Kr, Kr),
|
|
3913
4044
|
bitrate: 0
|
|
3914
4045
|
}, this._remoteNetworkStat = {
|
|
3915
4046
|
rtt: 0,
|
|
@@ -3924,20 +4055,20 @@ var Mr = class {
|
|
|
3924
4055
|
_calcRttRating(e) {
|
|
3925
4056
|
let t = typeof e == "number" ? e : e.getValue(), n = 1;
|
|
3926
4057
|
if (isNaN(t)) return n;
|
|
3927
|
-
let r = Math.round((t - this._networkLimits.goodNet.rtt) /
|
|
3928
|
-
for (let e = 0; e < r; e++) n *= 1 -
|
|
4058
|
+
let r = Math.round((t - this._networkLimits.goodNet.rtt) / qr);
|
|
4059
|
+
for (let e = 0; e < r; e++) n *= 1 - Jr;
|
|
3929
4060
|
return n;
|
|
3930
4061
|
}
|
|
3931
4062
|
_calcLossRating(e) {
|
|
3932
4063
|
let t = typeof e == "number" ? e : e.getValue(), n = 1;
|
|
3933
4064
|
if (isNaN(t)) return n;
|
|
3934
|
-
let r = Math.round((t - this._networkLimits.goodNet.loss) /
|
|
3935
|
-
for (let e = 0; e < r; e++) n *= 1 -
|
|
4065
|
+
let r = Math.round((t - this._networkLimits.goodNet.loss) / Yr);
|
|
4066
|
+
for (let e = 0; e < r; e++) n *= 1 - Xr;
|
|
3936
4067
|
return n;
|
|
3937
4068
|
}
|
|
3938
4069
|
_calcBitrateRating(e, t) {
|
|
3939
4070
|
if (!e || !t) return 1;
|
|
3940
|
-
let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) *
|
|
4071
|
+
let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) * Zr;
|
|
3941
4072
|
return Math.min(n, 1);
|
|
3942
4073
|
}
|
|
3943
4074
|
_calcUDPRating({ rtt: e, loss: t }) {
|
|
@@ -3947,7 +4078,7 @@ var Mr = class {
|
|
|
3947
4078
|
return n ? this._calcBitrateRating(e.bitrate, t.bitrate) : this._calcUDPRating(e) * this._calcUDPRating(t);
|
|
3948
4079
|
}
|
|
3949
4080
|
_getNetworkState(e) {
|
|
3950
|
-
return isNaN(e) || e >=
|
|
4081
|
+
return isNaN(e) || e >= Qr ? "good" : e >= $r ? "medium" : "bad";
|
|
3951
4082
|
}
|
|
3952
4083
|
updateSettings(e) {
|
|
3953
4084
|
Object.assign(this._networkLimits.badNet, e?.badNet || {}), Object.assign(this._networkLimits.goodNet, e?.goodNet || {});
|
|
@@ -3971,7 +4102,7 @@ var Mr = class {
|
|
|
3971
4102
|
let { rtt: t, loss: n, bitrate: r } = e || {};
|
|
3972
4103
|
this._remoteNetworkStat.rtt = t || 0, this._remoteNetworkStat.loss = n || 0, this._remoteNetworkStat.bitrate = r || 0;
|
|
3973
4104
|
}
|
|
3974
|
-
},
|
|
4105
|
+
}, ti = 30 * 1e3, ni = class e extends Ur {
|
|
3975
4106
|
constructor(e, t, n, r, i, a = R, o = null, s = null, c = null, l = null) {
|
|
3976
4107
|
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", {
|
|
3977
4108
|
bad: {
|
|
@@ -3986,7 +4117,7 @@ var Mr = class {
|
|
|
3986
4117
|
worst: 320,
|
|
3987
4118
|
bad: 640,
|
|
3988
4119
|
good: 1280
|
|
3989
|
-
}), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", 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
|
|
4120
|
+
}), 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 Ca(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new ei(n, this._debug), this._sdpStats = new Pr(this._statAggregator), this.subscribe(this._signaling, G.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, X.NETWORK_STATUS, this._onNetworkStatus.bind(this));
|
|
3990
4121
|
try {
|
|
3991
4122
|
this._pc = this._createPeerConnection();
|
|
3992
4123
|
} catch (e) {
|
|
@@ -4090,12 +4221,12 @@ var Mr = class {
|
|
|
4090
4221
|
iceServers: M.iceServers,
|
|
4091
4222
|
iceTransportPolicy: M.forceRelayPolicy ? "relay" : "all"
|
|
4092
4223
|
});
|
|
4093
|
-
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._prevConsumerSettings = {}, M.vmoji && this._createDataChannel(e, Sr.animoji, (e) => {
|
|
4224
|
+
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 = {}, M.vmoji && this._createDataChannel(e, Sr.animoji, (e) => {
|
|
4094
4225
|
this._animojiDataChannel = e, this._animojiDataChannel.binaryType = "arraybuffer", this._animojiReceiver?.setDataChannel(this._animojiDataChannel), this._animojiSender?.setDataChannel(this._animojiDataChannel);
|
|
4095
4226
|
}), e;
|
|
4096
4227
|
}
|
|
4097
4228
|
_disposePeerConnection() {
|
|
4098
|
-
if (this._disposeFirstMediaSentProbe(), this._lastStat = null, this._remoteStream) {
|
|
4229
|
+
if (this._disposeFirstMediaSentProbe(), this._sdpStats.stop(), this._lastStat = null, this._remoteStream) {
|
|
4099
4230
|
let e = this._remoteStream;
|
|
4100
4231
|
e.getTracks().forEach((t) => {
|
|
4101
4232
|
t.stop(), this._triggerEvent(X.REMOTE_TRACK_REMOVED, e, t);
|
|
@@ -4133,7 +4264,7 @@ var Mr = class {
|
|
|
4133
4264
|
}
|
|
4134
4265
|
_handleTransmittedData(e) {
|
|
4135
4266
|
let t = e.data, n = j.getPeerIdString(e.peerId);
|
|
4136
|
-
j.composeMessageId(e) === this._participantId && (t.candidate && t.candidate.candidate ? this._addIceCandidate(n, t.candidate).catch(this.close.bind(this)) : t.sdp && (this._remoteAnimojiVersion = t.animojiVersion || 1, this._setRemoteDescription(n, t.sdp).catch(this.close.bind(this))));
|
|
4267
|
+
j.composeMessageId(e) === this._participantId && (t.candidate && t.candidate.candidate ? (this._sdpStats.logCandidateReceived(t.candidate), this._addIceCandidate(n, t.candidate).catch(this.close.bind(this))) : t.sdp && (this._sdpStats.logSdpReceived(t.sdp.type), this._remoteAnimojiVersion = t.animojiVersion || 1, this._setRemoteDescription(n, t.sdp).catch(this.close.bind(this))));
|
|
4137
4268
|
}
|
|
4138
4269
|
async _addIceCandidate(e, t) {
|
|
4139
4270
|
if (this._isOpen && (!this._remotePeerId || this._remotePeerId === e) && this._pc && this._pc.remoteDescription) {
|
|
@@ -4175,7 +4306,7 @@ var Mr = class {
|
|
|
4175
4306
|
try {
|
|
4176
4307
|
await this._pc.setRemoteDescription(n), await this._setRemoteCandidates(t), this._processAnimojiProtocolVersion(this._remoteAnimojiVersion);
|
|
4177
4308
|
} catch (e) {
|
|
4178
|
-
throw this._logger?.log(C.ERROR, "setRemoteDescription-direct"), this._debug.error("Unable to set remote description", e, {
|
|
4309
|
+
throw this._logger?.log(C.ERROR, "setRemoteDescription-direct"), this._sdpStats.logSetRemoteFailed(n, e), this._debug.error("Unable to set remote description", e, {
|
|
4179
4310
|
participantId: this._participantId,
|
|
4180
4311
|
sdp: n
|
|
4181
4312
|
}), e;
|
|
@@ -4198,7 +4329,7 @@ var Mr = class {
|
|
|
4198
4329
|
this._signaling.ready && (e.candidate ? (this._debug.debug("Local ice candidate", {
|
|
4199
4330
|
participantId: this._participantId,
|
|
4200
4331
|
candidate: e.candidate
|
|
4201
|
-
}), await this._signaling.sendCandidate(this._participantId, e.candidate)) : M.forwardEmptyIceCandidate && (this._debug.debug("ICE gathering complete, forwarding empty candidate", { participantId: this._participantId }), await this._signaling.sendCandidate(this._participantId, { candidate: "" })));
|
|
4332
|
+
}), this._sdpStats.logCandidateGenerated(e.candidate), await this._signaling.sendCandidate(this._participantId, e.candidate)) : M.forwardEmptyIceCandidate && (this._debug.debug("ICE gathering complete, forwarding empty candidate", { participantId: this._participantId }), await this._signaling.sendCandidate(this._participantId, { candidate: "" })));
|
|
4202
4333
|
}
|
|
4203
4334
|
_onSignalingStateChange() {
|
|
4204
4335
|
this._debug.debug(`DirectTransport: Signaling state changed to ${this._pc?.signalingState}`, { participantId: this._participantId });
|
|
@@ -4282,9 +4413,9 @@ var Mr = class {
|
|
|
4282
4413
|
r = await this._pc?.createOffer(n), this._debug.debug("Created offer", {
|
|
4283
4414
|
participantId: this._participantId,
|
|
4284
4415
|
offer: r
|
|
4285
|
-
}), r = e._patchLocalDescription(r);
|
|
4416
|
+
}), this._sdpStats.logSdpGenerated("offer"), r = e._patchLocalDescription(r);
|
|
4286
4417
|
} catch (e) {
|
|
4287
|
-
throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createOffer-direct"), e;
|
|
4418
|
+
throw this._debug.error("Unable to create offer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createOffer-direct"), this._sdpStats.logCreateFailed("offer", e), e;
|
|
4288
4419
|
}
|
|
4289
4420
|
try {
|
|
4290
4421
|
return this._debug.debug("Set local description", {
|
|
@@ -4292,7 +4423,7 @@ var Mr = class {
|
|
|
4292
4423
|
offer: r
|
|
4293
4424
|
}), this._calcFingerprint(r.sdp), await this._pc?.setLocalDescription(r), r;
|
|
4294
4425
|
} catch (e) {
|
|
4295
|
-
throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
|
|
4426
|
+
throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), this._sdpStats.logSetLocalFailed(r, e), e;
|
|
4296
4427
|
}
|
|
4297
4428
|
}
|
|
4298
4429
|
async _createAnswer() {
|
|
@@ -4302,9 +4433,9 @@ var Mr = class {
|
|
|
4302
4433
|
t = await this._pc?.createAnswer(), this._debug.debug("Created answer", {
|
|
4303
4434
|
participantId: this._participantId,
|
|
4304
4435
|
answer: t
|
|
4305
|
-
}), t = e._patchLocalDescription(t);
|
|
4436
|
+
}), this._sdpStats.logSdpGenerated("answer"), t = e._patchLocalDescription(t);
|
|
4306
4437
|
} catch (e) {
|
|
4307
|
-
throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createAnswer-direct"), e;
|
|
4438
|
+
throw this._debug.error("Unable to create answer", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "createAnswer-direct"), this._sdpStats.logCreateFailed("answer", e), e;
|
|
4308
4439
|
}
|
|
4309
4440
|
try {
|
|
4310
4441
|
return this._debug.debug("Set local description", {
|
|
@@ -4312,7 +4443,7 @@ var Mr = class {
|
|
|
4312
4443
|
answer: t
|
|
4313
4444
|
}), this._calcFingerprint(t.sdp), await this._pc?.setLocalDescription(t), t;
|
|
4314
4445
|
} catch (e) {
|
|
4315
|
-
throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), e;
|
|
4446
|
+
throw this._debug.error("Unable to set local description", e, { participantId: this._participantId }), this._logger?.log(C.ERROR, "setLocalDescription-direct"), this._sdpStats.logSetLocalFailed(t, e), e;
|
|
4316
4447
|
}
|
|
4317
4448
|
}
|
|
4318
4449
|
static _patchLocalDescription(e) {
|
|
@@ -4385,7 +4516,7 @@ var Mr = class {
|
|
|
4385
4516
|
async _checkPPTNetwork(e) {
|
|
4386
4517
|
if (!M.switchVideoAtBadNetwork || !e.inbound.transport.averageNetStat) return;
|
|
4387
4518
|
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 = Er.L1T1;
|
|
4388
|
-
if (r ? (this._lastBadConnection = Date.now(), i ? (a = this._videoMaxDimensionsForNet.bad, o = Er.L1T2) : (a = this._videoMaxDimensionsForNet.worst, o = Er.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = Er.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection >
|
|
4519
|
+
if (r ? (this._lastBadConnection = Date.now(), i ? (a = this._videoMaxDimensionsForNet.bad, o = Er.L1T2) : (a = this._videoMaxDimensionsForNet.worst, o = Er.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = Er.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection > ti) || this._lastVideoMaxDimension === a) return;
|
|
4389
4520
|
let s = this._serverSettings.camera;
|
|
4390
4521
|
if (!s || !await this._isSVCSupported(e, o)) return;
|
|
4391
4522
|
this._debug.debug("Switch outbound video frame size and scalabilityMode", {
|
|
@@ -4450,9 +4581,9 @@ var Mr = class {
|
|
|
4450
4581
|
}, n(r)) : this._debug.error(`[${t}] data channel open failed, state [${e}]`);
|
|
4451
4582
|
};
|
|
4452
4583
|
}
|
|
4453
|
-
},
|
|
4584
|
+
}, ri = /* @__PURE__ */ function(e) {
|
|
4454
4585
|
return e.AUDIO_MIX = "audio-mix", e.PARTICIPANT_AGNOSTIC_TRACK_PREFIX = "pat", e.TRANSPARENT_AUDIO_TRACK_PREFIX = "ta", e;
|
|
4455
|
-
}({}),
|
|
4586
|
+
}({}), ii = 16, ai = class e {
|
|
4456
4587
|
constructor(e, t, n, r = R) {
|
|
4457
4588
|
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);
|
|
4458
4589
|
}
|
|
@@ -4466,7 +4597,7 @@ var Mr = class {
|
|
|
4466
4597
|
ssrc: a,
|
|
4467
4598
|
timestamp: o,
|
|
4468
4599
|
duration: s,
|
|
4469
|
-
data: e.slice(
|
|
4600
|
+
data: e.slice(ii)
|
|
4470
4601
|
};
|
|
4471
4602
|
}
|
|
4472
4603
|
_onDataChannelMessage(t) {
|
|
@@ -4486,7 +4617,7 @@ var Mr = class {
|
|
|
4486
4617
|
destroy() {
|
|
4487
4618
|
this._datachannel.onmessage = null;
|
|
4488
4619
|
}
|
|
4489
|
-
},
|
|
4620
|
+
}, oi, si = class {
|
|
4490
4621
|
constructor() {
|
|
4491
4622
|
h(this, "_value", 1);
|
|
4492
4623
|
}
|
|
@@ -4497,10 +4628,10 @@ var Mr = class {
|
|
|
4497
4628
|
this._value = e;
|
|
4498
4629
|
}
|
|
4499
4630
|
};
|
|
4500
|
-
|
|
4631
|
+
oi = si, h(si, "_instance", null), h(si, "getInstance", () => (oi._instance || (oi._instance = new oi()), oi._instance));
|
|
4501
4632
|
//#endregion
|
|
4502
4633
|
//#region src/classes/ParticipantIdRegistry.ts
|
|
4503
|
-
var
|
|
4634
|
+
var ci = class {
|
|
4504
4635
|
constructor(e = R) {
|
|
4505
4636
|
h(this, "streamDescriptionByCompactId", /* @__PURE__ */ new Map()), h(this, "compactIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_debug", void 0), this._debug = e;
|
|
4506
4637
|
}
|
|
@@ -4616,7 +4747,7 @@ var Qr = class {
|
|
|
4616
4747
|
this._debug.error("unexpected null sequenceNumber", e, r);
|
|
4617
4748
|
continue;
|
|
4618
4749
|
}
|
|
4619
|
-
let l =
|
|
4750
|
+
let l = ri.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
|
|
4620
4751
|
n.push({
|
|
4621
4752
|
participantStreamDescription: c,
|
|
4622
4753
|
streamId: l,
|
|
@@ -4634,7 +4765,7 @@ var Qr = class {
|
|
|
4634
4765
|
}
|
|
4635
4766
|
}, Y = /* @__PURE__ */ function(e) {
|
|
4636
4767
|
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;
|
|
4637
|
-
}({}),
|
|
4768
|
+
}({}), li = class {
|
|
4638
4769
|
constructor(e = R, t = null) {
|
|
4639
4770
|
h(this, "_worker", null), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = e, this._logger = t;
|
|
4640
4771
|
}
|
|
@@ -4699,7 +4830,7 @@ var Qr = class {
|
|
|
4699
4830
|
static isBrowserSupported() {
|
|
4700
4831
|
throw Error("Not implemented");
|
|
4701
4832
|
}
|
|
4702
|
-
},
|
|
4833
|
+
}, ui = class extends li {
|
|
4703
4834
|
constructor(e = R, t = null) {
|
|
4704
4835
|
super(e, t);
|
|
4705
4836
|
}
|
|
@@ -4723,7 +4854,7 @@ var Qr = class {
|
|
|
4723
4854
|
static isBrowserSupported() {
|
|
4724
4855
|
return "WebAssembly" in window && "Worker" in window;
|
|
4725
4856
|
}
|
|
4726
|
-
},
|
|
4857
|
+
}, di = class extends li {
|
|
4727
4858
|
constructor(e = R, t = null) {
|
|
4728
4859
|
super(e, t);
|
|
4729
4860
|
}
|
|
@@ -4746,7 +4877,7 @@ var Qr = class {
|
|
|
4746
4877
|
static isBrowserSupported() {
|
|
4747
4878
|
return "VideoDecoder" in window && "Worker" in window && "VideoFrame" in window && !T.isBrokenVP9Decoder() && T.browserName() !== "Firefox";
|
|
4748
4879
|
}
|
|
4749
|
-
},
|
|
4880
|
+
}, fi = class {
|
|
4750
4881
|
constructor(e = null, t = 0) {
|
|
4751
4882
|
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));
|
|
4752
4883
|
}
|
|
@@ -4760,7 +4891,7 @@ var Qr = class {
|
|
|
4760
4891
|
destroy() {
|
|
4761
4892
|
window.clearInterval(this._interval), this._interval = 0;
|
|
4762
4893
|
}
|
|
4763
|
-
},
|
|
4894
|
+
}, pi = class {
|
|
4764
4895
|
constructor(e, t) {
|
|
4765
4896
|
h(this, "_participantId", void 0), h(this, "_statAggregator", void 0), h(this, "_firstFrameReceived", !1), this._participantId = e, this._statAggregator = t;
|
|
4766
4897
|
}
|
|
@@ -4775,14 +4906,14 @@ var Qr = class {
|
|
|
4775
4906
|
height: t
|
|
4776
4907
|
});
|
|
4777
4908
|
}
|
|
4778
|
-
},
|
|
4909
|
+
}, mi = 65536, hi = "MARK_SCREENSHARE_FREEZE_DURATION", gi = class e {
|
|
4779
4910
|
constructor(e, t, n, r, i, a = R) {
|
|
4780
|
-
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
|
|
4911
|
+
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 pi(e, r), this._debug = a;
|
|
4781
4912
|
}
|
|
4782
4913
|
appendChunk(t) {
|
|
4783
4914
|
let n = this._chunks.length;
|
|
4784
4915
|
if (t.start) this._measureFreezeDuration(!1), this._measureFreezeDuration(!0), n && (this._debug.warn("[FrameBuilder] Cleanup buffer", Array.prototype.slice.call(this._chunks)), this._chunks = []);
|
|
4785
|
-
else if (!n || (this._chunks[n - 1].sequence + 1) %
|
|
4916
|
+
else if (!n || (this._chunks[n - 1].sequence + 1) % mi !== t.sequence) {
|
|
4786
4917
|
this._debug.warn("[FrameBuilder] Got incorrect chunk");
|
|
4787
4918
|
return;
|
|
4788
4919
|
}
|
|
@@ -4799,7 +4930,7 @@ var Qr = class {
|
|
|
4799
4930
|
}
|
|
4800
4931
|
}
|
|
4801
4932
|
destroy() {
|
|
4802
|
-
W.clearMark(
|
|
4933
|
+
W.clearMark(hi), W.clearMark(W.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
|
|
4803
4934
|
}
|
|
4804
4935
|
_processFrameData() {
|
|
4805
4936
|
let e = this._chunks;
|
|
@@ -4822,13 +4953,13 @@ var Qr = class {
|
|
|
4822
4953
|
}
|
|
4823
4954
|
_measureFreezeDuration(e) {
|
|
4824
4955
|
if (e) {
|
|
4825
|
-
W.setMark(
|
|
4956
|
+
W.setMark(hi);
|
|
4826
4957
|
return;
|
|
4827
4958
|
}
|
|
4828
|
-
let t = W.measureMark(
|
|
4959
|
+
let t = W.measureMark(hi);
|
|
4829
4960
|
t !== null && t > 1e3 && this._onStat({ freeze_duration: t });
|
|
4830
4961
|
}
|
|
4831
|
-
},
|
|
4962
|
+
}, _i = class {
|
|
4832
4963
|
constructor(e) {
|
|
4833
4964
|
h(this, "_onStream", void 0), this._onStream = e;
|
|
4834
4965
|
}
|
|
@@ -4841,7 +4972,7 @@ var Qr = class {
|
|
|
4841
4972
|
static isBrowserSupported() {
|
|
4842
4973
|
throw Error("Method `isBrowserSupported` is not implemented");
|
|
4843
4974
|
}
|
|
4844
|
-
},
|
|
4975
|
+
}, vi = class extends _i {
|
|
4845
4976
|
constructor(e, t = R) {
|
|
4846
4977
|
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;
|
|
4847
4978
|
}
|
|
@@ -4901,7 +5032,7 @@ var Qr = class {
|
|
|
4901
5032
|
static isBrowserSupported() {
|
|
4902
5033
|
return ("CanvasCaptureMediaStream" in window || "CanvasCaptureMediaStreamTrack" in window) && !(T.browserName() === "Safari" && Number(T.browserVersion()) === 15);
|
|
4903
5034
|
}
|
|
4904
|
-
},
|
|
5035
|
+
}, yi = class extends _i {
|
|
4905
5036
|
constructor(e, t = R) {
|
|
4906
5037
|
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: k.video }), this._writer = this._generator.writable.getWriter(), this._stream = new MediaStream([this._generator]), this._onStream(this._stream);
|
|
4907
5038
|
}
|
|
@@ -4912,9 +5043,9 @@ var Qr = class {
|
|
|
4912
5043
|
this._writer.releaseLock(), this._generator.writable.close().then(() => this._generator.stop()), this._debug.debug("TrackGeneratorRenderer destroyed");
|
|
4913
5044
|
}
|
|
4914
5045
|
static isBrowserSupported() {
|
|
4915
|
-
return "VideoFrame" in window && "MediaStreamTrackGenerator" in window &&
|
|
5046
|
+
return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && di.isBrowserSupported();
|
|
4916
5047
|
}
|
|
4917
|
-
},
|
|
5048
|
+
}, bi = class extends gi {
|
|
4918
5049
|
constructor(e, t, n, r, i, a = R, o = null) {
|
|
4919
5050
|
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();
|
|
4920
5051
|
}
|
|
@@ -4922,16 +5053,16 @@ var Qr = class {
|
|
|
4922
5053
|
e.keyframe && (this._decoderQueue = []), this._decoderQueue.push(e), this._decodeQueue();
|
|
4923
5054
|
}
|
|
4924
5055
|
_initFpsMeter() {
|
|
4925
|
-
this._fpsMeter = new
|
|
5056
|
+
this._fpsMeter = new fi((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
|
|
4926
5057
|
}
|
|
4927
5058
|
_initRenderer(e = !1) {
|
|
4928
|
-
e || !
|
|
5059
|
+
e || !yi.isBrowserSupported() ? this._renderer = new vi(this._onStream, this._debug) : this._renderer = new yi(this._onStream, this._debug);
|
|
4929
5060
|
}
|
|
4930
5061
|
_initDecoder(e = !1) {
|
|
4931
|
-
e || !
|
|
5062
|
+
e || !di.isBrowserSupported() ? this._decoder = new ui(this._debug, this._logger) : this._decoder = new di(this._debug, this._logger), this._decoder.init(async (e) => {
|
|
4932
5063
|
this._decoderBusy = !1, "VideoFrame" in window && e instanceof VideoFrame ? await this._renderer.drawFrame(e) : await this._renderer.drawImage(e), this._fpsMeter.increment(), this._decodeQueue();
|
|
4933
5064
|
}, (e) => {
|
|
4934
|
-
if (this._decoderBusy = !1, this._decoder instanceof
|
|
5065
|
+
if (this._decoderBusy = !1, this._decoder instanceof di && typeof e == "string" && e.includes("EncodingError")) {
|
|
4935
5066
|
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();
|
|
4936
5067
|
return;
|
|
4937
5068
|
}
|
|
@@ -4939,7 +5070,7 @@ var Qr = class {
|
|
|
4939
5070
|
}, this._onKeyFrameRequested).then(() => {
|
|
4940
5071
|
this._decoderReady = !0, this._decodeQueue();
|
|
4941
5072
|
}).catch((e) => {
|
|
4942
|
-
this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof
|
|
5073
|
+
this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof di && this._switchToLibVPXDecoder();
|
|
4943
5074
|
});
|
|
4944
5075
|
}
|
|
4945
5076
|
_switchToLibVPXDecoder() {
|
|
@@ -4954,20 +5085,20 @@ var Qr = class {
|
|
|
4954
5085
|
super.destroy(), this._fpsMeter.destroy(), this._decoder.destroy(), this._renderer.destroy(), this._debug.debug(`StreamBuilder destroyed for participant ${this._participantId}`);
|
|
4955
5086
|
}
|
|
4956
5087
|
static isBrowserSupported() {
|
|
4957
|
-
return
|
|
5088
|
+
return vi.isBrowserSupported() || yi.isBrowserSupported();
|
|
4958
5089
|
}
|
|
4959
|
-
},
|
|
4960
|
-
function
|
|
5090
|
+
}, xi = 1, Si = 1, Ci = 2, wi = 0, Ti = 1, Ei = 2, Di = 4, Oi = 8;
|
|
5091
|
+
function ki(e, t, n, r, i, a, o) {
|
|
4961
5092
|
let s = 0;
|
|
4962
|
-
t && (s |=
|
|
5093
|
+
t && (s |= Ti), n && (s |= Ei), r && (s |= Di), o || (s |= Oi);
|
|
4963
5094
|
let c = /* @__PURE__ */ new ArrayBuffer(11), l = new DataView(c);
|
|
4964
|
-
if (l.setUint8(0,
|
|
5095
|
+
if (l.setUint8(0, xi), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, wi), l.setUint8(10, s), !o) return c;
|
|
4965
5096
|
let u = new Uint8Array(c.byteLength + o.byteLength);
|
|
4966
5097
|
return u.set(new Uint8Array(c), 0), u.set(new Uint8Array(o), c.byteLength), u.buffer;
|
|
4967
5098
|
}
|
|
4968
|
-
function
|
|
4969
|
-
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 &
|
|
4970
|
-
if (n !==
|
|
5099
|
+
function Ai(e) {
|
|
5100
|
+
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 & Ti), l = !!(s & Ei), u = !!(s & Di), d = !!(s & Oi);
|
|
5101
|
+
if (n !== xi) throw Error(`Unexpected protocol version. Got ${n}, expected ${xi}`);
|
|
4971
5102
|
return {
|
|
4972
5103
|
timestamp: i,
|
|
4973
5104
|
start: c,
|
|
@@ -4980,26 +5111,26 @@ function bi(e) {
|
|
|
4980
5111
|
data: e.slice(11)
|
|
4981
5112
|
};
|
|
4982
5113
|
}
|
|
4983
|
-
function
|
|
5114
|
+
function ji(e) {
|
|
4984
5115
|
if (!e || !e.byteLength || e.byteLength !== 4) return !1;
|
|
4985
5116
|
let t = new DataView(e);
|
|
4986
|
-
return !(t.getUint8(0) !==
|
|
5117
|
+
return !(t.getUint8(0) !== xi || t.getUint8(1) !== Si || t.getUint16(2) !== wi);
|
|
4987
5118
|
}
|
|
4988
|
-
function
|
|
5119
|
+
function Mi(e) {
|
|
4989
5120
|
if (!e || !e.byteLength || e.byteLength !== 10) return null;
|
|
4990
5121
|
let t = new DataView(e);
|
|
4991
|
-
return t.getUint8(0) !==
|
|
5122
|
+
return t.getUint8(0) !== xi || t.getUint8(1) !== Ci || t.getUint16(2) !== wi ? null : {
|
|
4992
5123
|
seq: t.getUint16(4),
|
|
4993
5124
|
ts2: t.getUint32(6)
|
|
4994
5125
|
};
|
|
4995
5126
|
}
|
|
4996
|
-
function
|
|
5127
|
+
function Ni(e) {
|
|
4997
5128
|
let t = /* @__PURE__ */ new ArrayBuffer(4), n = new DataView(t);
|
|
4998
|
-
return n.setUint8(0,
|
|
5129
|
+
return n.setUint8(0, xi), n.setUint8(1, Si), n.setUint16(2, e), t;
|
|
4999
5130
|
}
|
|
5000
5131
|
//#endregion
|
|
5001
5132
|
//#region src/classes/screenshare/WebmBuilder.ts
|
|
5002
|
-
var
|
|
5133
|
+
var Pi = 2 ** 15 - 1, Fi = 1, Ii = 5, Li = 5, Ri = class e {
|
|
5003
5134
|
constructor(e, t = R) {
|
|
5004
5135
|
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;
|
|
5005
5136
|
let n = () => {
|
|
@@ -5042,8 +5173,8 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5042
5173
|
this._mediaSource?.readyState === "open" && this._sourceBuffer?.abort();
|
|
5043
5174
|
let e = this._sourceBuffer?.buffered, t = e?.length;
|
|
5044
5175
|
if (!t) return;
|
|
5045
|
-
let n = e.start(0), r = Math.max(0, e.end(t - 1) -
|
|
5046
|
-
r - n >
|
|
5176
|
+
let n = e.start(0), r = Math.max(0, e.end(t - 1) - Ii);
|
|
5177
|
+
r - n > Li && (this._clearBufferTill = r);
|
|
5047
5178
|
}
|
|
5048
5179
|
destroy() {
|
|
5049
5180
|
this._queue = [], this._mediaSource.readyState === "open" && (this._sourceBuffer?.abort(), this._mediaSource.endOfStream()), this._sourceBuffer = null, this._clearBufferTill = 0;
|
|
@@ -5057,7 +5188,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5057
5188
|
get buffered() {
|
|
5058
5189
|
return this._sourceBuffer?.buffered;
|
|
5059
5190
|
}
|
|
5060
|
-
},
|
|
5191
|
+
}, zi = class e extends gi {
|
|
5061
5192
|
constructor(e, t, n, r, i = R) {
|
|
5062
5193
|
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}]`);
|
|
5063
5194
|
}
|
|
@@ -5081,8 +5212,8 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5081
5212
|
u.element(u.ID.MuxingApp, u.string("vk-webm-builder")),
|
|
5082
5213
|
u.element(u.ID.WritingApp, u.string("vk-webm-builder"))
|
|
5083
5214
|
]), 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, [
|
|
5084
|
-
u.element(u.ID.TrackNumber, u.number(
|
|
5085
|
-
u.element(u.ID.TrackUID, u.number(
|
|
5215
|
+
u.element(u.ID.TrackNumber, u.number(Fi)),
|
|
5216
|
+
u.element(u.ID.TrackUID, u.number(Fi)),
|
|
5086
5217
|
u.element(u.ID.TrackType, u.number(1)),
|
|
5087
5218
|
u.element(u.ID.FlagLacing, u.number(0)),
|
|
5088
5219
|
u.element(u.ID.DefaultDuration, u.number(1e9)),
|
|
@@ -5095,7 +5226,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5095
5226
|
return u.unknownSizeElement(u.ID.Cluster, [u.element(u.ID.Timecode, u.number(Math.round(e)))]);
|
|
5096
5227
|
}
|
|
5097
5228
|
_createVideo(e) {
|
|
5098
|
-
this._mediaBuffer = new
|
|
5229
|
+
this._mediaBuffer = new Ri(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);
|
|
5099
5230
|
let t = () => {
|
|
5100
5231
|
if (this._video?.src) {
|
|
5101
5232
|
this._debug.warn(`[WebmBuilder] Video paused for participant [${this._participantId}], try to play again`);
|
|
@@ -5122,13 +5253,13 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5122
5253
|
this._mediaBuffer?.append(a);
|
|
5123
5254
|
}
|
|
5124
5255
|
let i = Math.round(r - this._clusterStartTime);
|
|
5125
|
-
if (i >
|
|
5256
|
+
if (i > Pi && (this._clusterStartTime = r, i = 0), i === 0) {
|
|
5126
5257
|
this._debug.debug(`[WebmBuilder] Cluster header for participant [${this._participantId}]`);
|
|
5127
5258
|
let t = e._genClusterHeader(this._clusterStartTime);
|
|
5128
5259
|
this._mediaBuffer?.append(t);
|
|
5129
5260
|
}
|
|
5130
5261
|
let a = u.element(u.ID.SimpleBlock, [
|
|
5131
|
-
u.vintEncodedNumber(
|
|
5262
|
+
u.vintEncodedNumber(Fi),
|
|
5132
5263
|
u.bytes(e._intToU16BE(i)),
|
|
5133
5264
|
u.number(!!t.keyframe << 7),
|
|
5134
5265
|
u.bytes(t.frameData)
|
|
@@ -5141,12 +5272,12 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5141
5272
|
static isBrowserSupported() {
|
|
5142
5273
|
return "captureStream" in window.HTMLVideoElement?.prototype && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp8\"") && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp9\"");
|
|
5143
5274
|
}
|
|
5144
|
-
},
|
|
5275
|
+
}, Bi = class {
|
|
5145
5276
|
constructor(e, t, n, r, i, a = null, o = R, s = null) {
|
|
5146
5277
|
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);
|
|
5147
5278
|
}
|
|
5148
5279
|
_onDataChannelMessage(e) {
|
|
5149
|
-
let t =
|
|
5280
|
+
let t = Ai(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
|
|
5150
5281
|
if (!n) {
|
|
5151
5282
|
this._debug.warn(`Participant id for ssrc ${t.ssrc} not found in registry`);
|
|
5152
5283
|
return;
|
|
@@ -5158,7 +5289,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5158
5289
|
let r = this._streamBuilders[n];
|
|
5159
5290
|
if (!r) {
|
|
5160
5291
|
let e = (e) => this._onStream(n, e);
|
|
5161
|
-
r = M.screenShareWebmBuilder &&
|
|
5292
|
+
r = M.screenShareWebmBuilder && zi.isBrowserSupported() ? new zi(n, e, this._onStat, this._statAggregator, this._debug) : new bi(n, e, this._onStat, this._statAggregator, () => {
|
|
5162
5293
|
this._requestKeyFrame(t.ssrc);
|
|
5163
5294
|
}, this._debug, this._logger), this._streamBuilders[n] = r;
|
|
5164
5295
|
}
|
|
@@ -5166,7 +5297,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5166
5297
|
}
|
|
5167
5298
|
_requestKeyFrame(e) {
|
|
5168
5299
|
if (!(!this._datachannel || this._datachannel.readyState !== "open")) try {
|
|
5169
|
-
let t =
|
|
5300
|
+
let t = Ni(e);
|
|
5170
5301
|
this._datachannel.send(t), this._debug.debug(`ScreenCaptureReceiver request for keyframe for ssrc ${e}`);
|
|
5171
5302
|
} catch (e) {
|
|
5172
5303
|
this._debug.warn("Failed to send keyframe request", e);
|
|
@@ -5179,7 +5310,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5179
5310
|
destroy() {
|
|
5180
5311
|
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");
|
|
5181
5312
|
}
|
|
5182
|
-
},
|
|
5313
|
+
}, Vi = class {
|
|
5183
5314
|
constructor(e, t, n) {
|
|
5184
5315
|
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;
|
|
5185
5316
|
}
|
|
@@ -5198,7 +5329,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5198
5329
|
get data() {
|
|
5199
5330
|
return this._data;
|
|
5200
5331
|
}
|
|
5201
|
-
},
|
|
5332
|
+
}, Hi = class {
|
|
5202
5333
|
constructor() {
|
|
5203
5334
|
h(this, "_head", null), h(this, "_tail", null), h(this, "_length", 0);
|
|
5204
5335
|
}
|
|
@@ -5206,7 +5337,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5206
5337
|
return this._length;
|
|
5207
5338
|
}
|
|
5208
5339
|
push(...e) {
|
|
5209
|
-
for (let t of e) this._tail = new
|
|
5340
|
+
for (let t of e) this._tail = new Vi(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
|
|
5210
5341
|
}
|
|
5211
5342
|
merge(e) {
|
|
5212
5343
|
this._tail && (this._tail.next = e._head), this._head || (this._head = e._head), this._tail = e._tail, this._length += e._length, e.clear();
|
|
@@ -5236,7 +5367,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5236
5367
|
for (; t !== null;) e.push(t.data), t = t.next;
|
|
5237
5368
|
return e.length ? JSON.stringify(e, (e, t) => t instanceof Error ? String(t) : t) : "";
|
|
5238
5369
|
}
|
|
5239
|
-
},
|
|
5370
|
+
}, Ui = 1e3, Wi = class extends li {
|
|
5240
5371
|
constructor(e, t, n, r, i = R, a = null) {
|
|
5241
5372
|
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);
|
|
5242
5373
|
}
|
|
@@ -5322,7 +5453,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5322
5453
|
let t = this._drawFrameData(this._lastFrame);
|
|
5323
5454
|
this._encode(t, e);
|
|
5324
5455
|
} else this._onFrame(null);
|
|
5325
|
-
},
|
|
5456
|
+
}, Ui), this._getFrameBitmap().then((t) => {
|
|
5326
5457
|
window.clearTimeout(this._frameReadTimeout), this._lastFrame?.close(), this._lastFrame = t;
|
|
5327
5458
|
let n = this._drawFrameData(t);
|
|
5328
5459
|
this._encode(n, e);
|
|
@@ -5343,7 +5474,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5343
5474
|
destroy() {
|
|
5344
5475
|
this._removeWorker(), this._removeStream(), this._removeDom(), this._debug.debug("LibVPxEncoder destroyed");
|
|
5345
5476
|
}
|
|
5346
|
-
},
|
|
5477
|
+
}, Gi = class extends li {
|
|
5347
5478
|
constructor(e, t, n, r, i, a, o = R, s = null) {
|
|
5348
5479
|
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 });
|
|
5349
5480
|
}
|
|
@@ -5389,11 +5520,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5389
5520
|
static isBrowserSupported() {
|
|
5390
5521
|
return "VideoEncoder" in window && "Worker" in window && "EncodedVideoChunk" in window && "MediaStreamTrackProcessor" in window;
|
|
5391
5522
|
}
|
|
5392
|
-
},
|
|
5523
|
+
}, Ki = 2100, qi = 600, Ji = 1.2, Yi = .8, Xi = 2e3, Zi = 8e3, Qi = 8e3, $i = 16e3, ea = 4, ta = 2e3, na = /* @__PURE__ */ function(e) {
|
|
5393
5524
|
return e[e.NONE = 0] = "NONE", e[e.UP = 1] = "UP", e[e.DOWN = 2] = "DOWN", e;
|
|
5394
|
-
}(
|
|
5525
|
+
}(na || {}), ra = class {
|
|
5395
5526
|
constructor(e, t, n, r, i, a, o, s = R) {
|
|
5396
|
-
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 =
|
|
5527
|
+
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 = Ki, i && (this._highDelayThreshold = qi), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
|
|
5397
5528
|
let c = Date.now();
|
|
5398
5529
|
this._lastDown = 0, this._lastUp = c, this._lastProbing = c, this._lastCheckDelay = 0, this._lastFpsCalcMs = 0;
|
|
5399
5530
|
}
|
|
@@ -5403,27 +5534,27 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5403
5534
|
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;
|
|
5404
5535
|
s || c ? i = 2 : Math.abs(a) < 40 && o < 10 && !c && (i = 1);
|
|
5405
5536
|
let l = Math.round(this._targetBitrate / 1e3), u = n;
|
|
5406
|
-
e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5537
|
+
e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${na[i]} tr=${l} br=${n}`);
|
|
5407
5538
|
let d = r - this._lastDown;
|
|
5408
|
-
if (i === 2 && d >
|
|
5409
|
-
this._probing && (this._upPenalty = Math.min(++this._upPenalty,
|
|
5410
|
-
let n =
|
|
5411
|
-
if (n >= this._targetBitrate && (n = this._targetBitrate *
|
|
5412
|
-
let r = Math.round(n / 1e3), s = Math.round(this._upPenalty *
|
|
5413
|
-
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5539
|
+
if (i === 2 && d > Xi) {
|
|
5540
|
+
this._probing && (this._upPenalty = Math.min(++this._upPenalty, ea), this._probing = !1);
|
|
5541
|
+
let n = Yi * u * 1e3;
|
|
5542
|
+
if (n >= this._targetBitrate && (n = this._targetBitrate * Yi), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
|
|
5543
|
+
let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * Qi / 1e3);
|
|
5544
|
+
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${na[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;
|
|
5414
5545
|
}
|
|
5415
5546
|
this._lastDown = r;
|
|
5416
5547
|
}
|
|
5417
|
-
let f = r - this._lastUp, p =
|
|
5548
|
+
let f = r - this._lastUp, p = Zi + this._upPenalty * Qi;
|
|
5418
5549
|
if (i === 1 && f > p && d > p) {
|
|
5419
|
-
let n = Math.min(this._targetBitrate *
|
|
5550
|
+
let n = Math.min(this._targetBitrate * Ji, this._maxBitrate);
|
|
5420
5551
|
if (n > this._targetBitrate) {
|
|
5421
|
-
let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty *
|
|
5422
|
-
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5552
|
+
let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * Qi / 1e3);
|
|
5553
|
+
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${na[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;
|
|
5423
5554
|
}
|
|
5424
5555
|
}
|
|
5425
5556
|
let m = r - this._lastProbing;
|
|
5426
|
-
this._probing && m >
|
|
5557
|
+
this._probing && m > $i && (this._probing = !1);
|
|
5427
5558
|
let ee = r - this._lastDown;
|
|
5428
5559
|
this._upPenalty > 0 && ee > 3 * p && (this._debug.log(`#${e}: cc: UP reset penalty: oldPenalty=${this._upPenalty}`), this._upPenalty = 0);
|
|
5429
5560
|
}
|
|
@@ -5434,7 +5565,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5434
5565
|
}
|
|
5435
5566
|
_calcDelay(e, t) {
|
|
5436
5567
|
if (!(e <= 0)) {
|
|
5437
|
-
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 >
|
|
5568
|
+
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 > ta) {
|
|
5438
5569
|
let e = t - this._lastCheckDelay;
|
|
5439
5570
|
this._largeDelayDuration += e;
|
|
5440
5571
|
}
|
|
@@ -5463,7 +5594,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5463
5594
|
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}`);
|
|
5464
5595
|
}
|
|
5465
5596
|
}
|
|
5466
|
-
},
|
|
5597
|
+
}, ia = class {
|
|
5467
5598
|
constructor(e) {
|
|
5468
5599
|
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);
|
|
5469
5600
|
}
|
|
@@ -5537,11 +5668,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5537
5668
|
clear() {
|
|
5538
5669
|
this._buffer.fill(void 0), this._size = 0, this._head = 0, this._tail = 0;
|
|
5539
5670
|
}
|
|
5540
|
-
},
|
|
5671
|
+
}, aa = 65536, oa = 50, sa = 400, ca = 1e6, la = 3e5, ua = 3e4, da = 2e3, fa = 5, pa = 0, ma = class {
|
|
5541
5672
|
constructor(e, t, n, r, i = R, a = null) {
|
|
5542
|
-
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
|
|
5673
|
+
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 ia(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 Hi()), 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 = M.consumerScreenDataChannelPacketSize - 11, this._datachannel = t, this._signaling = n, this._fastSharing = r, this._congestionControlEnabled = M.screenShareCongestionControl || this._fastSharing, this._width = e.getSettings().width, this._height = e.getSettings().height, this._maxFrameDelay = this._fastSharing ? M.screenShareCongestionControlThreshold : M.screenShareCongestionControlThreshold * 2;
|
|
5543
5674
|
let o = M.getScreenFrameRate(this._fastSharing), { minBitrate: s, maxBitrate: c } = this._calcMinMaxBitrate(this._width, this._height), l = this._onCongestionCallback.bind(this);
|
|
5544
|
-
this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${M.screenShareCongestionControlThreshold}`), this._congestionControl = new
|
|
5675
|
+
this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${M.screenShareCongestionControlThreshold}`), this._congestionControl = new ra(l, s, c, this._congestionControlEnabled, this._fastSharing, M.screenShareCongestionControlThreshold, o, this._debug);
|
|
5545
5676
|
let u = (e, t) => {
|
|
5546
5677
|
if (this._destroyed) return;
|
|
5547
5678
|
if (!e) {
|
|
@@ -5552,23 +5683,23 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5552
5683
|
let n = this._sliceFrame(e);
|
|
5553
5684
|
this._queue.merge(n), this._handleQueue(), this._sendSharingStat();
|
|
5554
5685
|
};
|
|
5555
|
-
if (
|
|
5686
|
+
if (Gi.isBrowserSupported()) {
|
|
5556
5687
|
let t = this._fastSharing;
|
|
5557
|
-
this._encoder = new
|
|
5558
|
-
} else this._encoder = new
|
|
5688
|
+
this._encoder = new Gi(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
|
|
5689
|
+
} else this._encoder = new Wi(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
|
|
5559
5690
|
this._datachannel.onmessage = (e) => {
|
|
5560
|
-
|
|
5561
|
-
let t =
|
|
5691
|
+
ji(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
|
|
5692
|
+
let t = Mi(e.data);
|
|
5562
5693
|
t !== null && this._checkCcFeedback(t);
|
|
5563
|
-
}, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new
|
|
5694
|
+
}, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new fi((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
|
|
5564
5695
|
}
|
|
5565
5696
|
_handleQueue() {
|
|
5566
5697
|
if (this._destroyed) return;
|
|
5567
5698
|
let e = this._queue.shift();
|
|
5568
5699
|
if (!e) {
|
|
5569
|
-
if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq +
|
|
5700
|
+
if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + aa) % aa > fa && this._lastFrameDelay > this._maxFrameDelay) {
|
|
5570
5701
|
let e = Date.now();
|
|
5571
|
-
e - this._lastFramerateReduced >
|
|
5702
|
+
e - this._lastFramerateReduced > da && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
|
|
5572
5703
|
} else this._requestFrame();
|
|
5573
5704
|
return;
|
|
5574
5705
|
}
|
|
@@ -5594,7 +5725,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5594
5725
|
this._destroyed || (this._encoder.requestFrame(this._needKeyframe), this._needKeyframe = !1);
|
|
5595
5726
|
}
|
|
5596
5727
|
_sliceFrame(e) {
|
|
5597
|
-
let t = e.type === "key", n = e.data.byteLength, r = new
|
|
5728
|
+
let t = e.type === "key", n = e.data.byteLength, r = new Hi();
|
|
5598
5729
|
for (let i = 0; i < n; i += this.DATA_SIZE) {
|
|
5599
5730
|
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);
|
|
5600
5731
|
r.push({
|
|
@@ -5610,11 +5741,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5610
5741
|
return r;
|
|
5611
5742
|
}
|
|
5612
5743
|
_wrapHeader(e, t, n, r, i) {
|
|
5613
|
-
let a =
|
|
5614
|
-
sequence:
|
|
5744
|
+
let a = ki(e, t, n, r, pa, this._encoder.isVP9(), i), o = {
|
|
5745
|
+
sequence: pa,
|
|
5615
5746
|
data: a
|
|
5616
5747
|
};
|
|
5617
|
-
return
|
|
5748
|
+
return pa = (pa + 1) % aa, o;
|
|
5618
5749
|
}
|
|
5619
5750
|
_stopPacket() {
|
|
5620
5751
|
return this._wrapHeader(Date.now(), !1, !1, !1, null).data;
|
|
@@ -5631,7 +5762,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5631
5762
|
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");
|
|
5632
5763
|
}
|
|
5633
5764
|
static isBrowserSupported() {
|
|
5634
|
-
return
|
|
5765
|
+
return Gi.isBrowserSupported() || Wi.isBrowserSupported();
|
|
5635
5766
|
}
|
|
5636
5767
|
_onCongestionCallback(e, t, n) {
|
|
5637
5768
|
this._encoder.setBitrate(e, t, n);
|
|
@@ -5644,8 +5775,8 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5644
5775
|
(e === void 0 || e < 640) && (e = 640), (t === void 0 || t < 360) && (t = 360);
|
|
5645
5776
|
let n = e * t / 256;
|
|
5646
5777
|
return {
|
|
5647
|
-
minBitrate: Math.max(
|
|
5648
|
-
maxBitrate: Math.round(n *
|
|
5778
|
+
minBitrate: Math.max(la, Math.min(ca, Math.round(n * oa))),
|
|
5779
|
+
maxBitrate: Math.round(n * sa)
|
|
5649
5780
|
};
|
|
5650
5781
|
}
|
|
5651
5782
|
_checkCcFeedback(e) {
|
|
@@ -5659,14 +5790,14 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5659
5790
|
}
|
|
5660
5791
|
_sendSharingStat() {
|
|
5661
5792
|
let e = Date.now();
|
|
5662
|
-
if (e - this._lastSharingStat >
|
|
5793
|
+
if (e - this._lastSharingStat > ua) {
|
|
5663
5794
|
let t = this._congestionControl.getStat();
|
|
5664
5795
|
t !== null && (this._debug.debug(`cc: send stats: ${JSON.stringify(t)}`), this._signaling.reportSharingStat(t).catch((e) => {
|
|
5665
5796
|
!(e instanceof wn) && !(e instanceof Tn) && this._debug.warn("Unable to send sharing stats", e);
|
|
5666
5797
|
})), this._lastSharingStat = e;
|
|
5667
5798
|
}
|
|
5668
5799
|
}
|
|
5669
|
-
},
|
|
5800
|
+
}, ha = class {
|
|
5670
5801
|
constructor(e, t, n, r = R, i = null) {
|
|
5671
5802
|
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;
|
|
5672
5803
|
}
|
|
@@ -5798,9 +5929,9 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5798
5929
|
if (!(e instanceof Tn)) throw e;
|
|
5799
5930
|
}
|
|
5800
5931
|
}
|
|
5801
|
-
},
|
|
5932
|
+
}, ga = 90, _a = 4294967295, va = class e extends Ur {
|
|
5802
5933
|
constructor(e, t, n, r = R, i = null, a = null, o = null, s = null) {
|
|
5803
|
-
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, "_codecStatsAggregator", void 0), h(this, "_simulcast", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._codecStatsAggregator = o, this._serverSettings = n, this._simulcast = new
|
|
5934
|
+
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 Pr(a), this._codecStatsAggregator = o, this._serverSettings = n, this._simulcast = new ha(e, t, () => this._serverSettings.camera, r, i), this.subscribe(this._signaling, G.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");
|
|
5804
5935
|
}
|
|
5805
5936
|
updateStatisticsInterval() {
|
|
5806
5937
|
this._stopStatInterval();
|
|
@@ -5839,10 +5970,10 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5839
5970
|
await this._simulcast.sync();
|
|
5840
5971
|
}
|
|
5841
5972
|
_createPerfStatsReporter() {
|
|
5842
|
-
this._perfStatReporter?.destroy(), this._perfStatReporter = new
|
|
5973
|
+
this._perfStatReporter?.destroy(), this._perfStatReporter = new Ca(this, this._signaling, this._statAggregator, !1, this._debug);
|
|
5843
5974
|
}
|
|
5844
5975
|
_closeConnection() {
|
|
5845
|
-
this._signaling.resetProducerConnection(), 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._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(X.PEER_CONNECTION_CLOSED);
|
|
5976
|
+
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(X.PEER_CONNECTION_CLOSED);
|
|
5846
5977
|
}
|
|
5847
5978
|
static _closeDataChannel(e) {
|
|
5848
5979
|
e && (e.onopen = null, e.onmessage = null, e.onerror = null, e.close());
|
|
@@ -5868,14 +5999,14 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5868
5999
|
}
|
|
5869
6000
|
this._pc.ontrack = this._onAddTrack.bind(this, this._pc), this._pc.onconnectionstatechange = j.debounce((e) => {
|
|
5870
6001
|
this._pc && this._onConnectionStateChange(this._pc, e);
|
|
5871
|
-
}, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._participantIdRegistry = new
|
|
6002
|
+
}, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._sdpStats.observe(this._pc), this._participantIdRegistry = new ci(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, Sr.producerNotification, (e) => {
|
|
5872
6003
|
this._producerNotification = e, this._producerNotification.binaryType = "arraybuffer", this._signaling.setProducerNotificationDataChannel(e);
|
|
5873
6004
|
}), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc, Sr.producerCommand, (e) => {
|
|
5874
6005
|
this._producerCommand = e, this._signaling.setProducerCommandDataChannel(e);
|
|
5875
6006
|
}), this._createDataChannel(this._pc, Sr.producerScreenShare, (e) => {
|
|
5876
6007
|
this._producerScreen = e, this._producerScreen.binaryType = "arraybuffer", this._createCaptureReceiver();
|
|
5877
6008
|
}), M.asrDataChannel && this._createDataChannel(this._pc, Sr.asr, (e) => {
|
|
5878
|
-
this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new
|
|
6009
|
+
this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new ai(e, this._participantIdRegistry, (e) => {
|
|
5879
6010
|
this._onAsrTranscription(e);
|
|
5880
6011
|
}, this._debug);
|
|
5881
6012
|
}), M.vmoji && this._createDataChannel(this._pc, Sr.animoji, (e) => {
|
|
@@ -5912,20 +6043,20 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5912
6043
|
this._triggerEvent(X.NETWORK_STATUS, e);
|
|
5913
6044
|
}
|
|
5914
6045
|
_updateSSRCMap(e) {
|
|
5915
|
-
e && ln(e.sdp).forEach((e) => {
|
|
5916
|
-
let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${
|
|
5917
|
-
n && (this._ssrcMap[n[1]] = n[3]
|
|
5918
|
-
});
|
|
6046
|
+
e && (this._ssrcMap = {}, this._ssrcMapUpdated = !0, ln(e.sdp).forEach((e) => {
|
|
6047
|
+
let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${ri.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${ri.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
|
|
6048
|
+
n && (this._ssrcMap[n[1]] = n[3]);
|
|
6049
|
+
}));
|
|
5919
6050
|
}
|
|
5920
6051
|
_createCaptureSender(e) {
|
|
5921
6052
|
let t = this._mediaSource.mediaSettings;
|
|
5922
|
-
!e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new
|
|
6053
|
+
!e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new ma(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
|
|
5923
6054
|
}
|
|
5924
6055
|
_removeCaptureSender() {
|
|
5925
6056
|
this._captureSender?.destroy(), this._captureSender = null;
|
|
5926
6057
|
}
|
|
5927
6058
|
_createCaptureReceiver() {
|
|
5928
|
-
this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new
|
|
6059
|
+
this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new Bi(this._producerScreen, this._participantIdRegistry, (e, t) => {
|
|
5929
6060
|
this._triggerEvent(X.REMOTE_STREAM_SECOND, e, t);
|
|
5930
6061
|
}, (e) => {
|
|
5931
6062
|
this._triggerEvent(X.REMOTE_STREAM_SECOND, e, null);
|
|
@@ -6035,7 +6166,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6035
6166
|
_detectStaleTracks(e) {
|
|
6036
6167
|
let t = e.rtps.find((e) => e.type === "inbound-rtp" && e.kind === "audio" && this._ssrcMap[e.ssrc] === "mix");
|
|
6037
6168
|
if (!t) return;
|
|
6038
|
-
let n =
|
|
6169
|
+
let n = ri.AUDIO_MIX, r = this._statBytes[n], i = !1;
|
|
6039
6170
|
if (r) {
|
|
6040
6171
|
let e = t.bytesReceived - r.bytesReceived;
|
|
6041
6172
|
e >= 0 && e <= 5 && (i = !0), r.stalled !== i && this._triggerEvent(X.AUDIO_MIX_STALL, i);
|
|
@@ -6047,31 +6178,31 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6047
6178
|
}
|
|
6048
6179
|
_allocateConsumer() {
|
|
6049
6180
|
if (!this._signaling.ready) return;
|
|
6050
|
-
let e =
|
|
6181
|
+
let e = ka.get();
|
|
6051
6182
|
!M.videoTracksCount && !this._observer && this._debug.warn("Setting videoTracksCount to 0 is deprecated"), this._signaling.allocateConsumer(null, e).catch((e) => {
|
|
6052
6183
|
e instanceof wn || this._debug.warn("ServerTransport: Unable to allocate consumer", e);
|
|
6053
6184
|
});
|
|
6054
6185
|
}
|
|
6055
6186
|
async _processOffer(e, t) {
|
|
6056
6187
|
if (!this._pc) throw Error("Interrupt allocation");
|
|
6188
|
+
this._sdpStats.logSdpReceived(e.type);
|
|
6057
6189
|
try {
|
|
6058
6190
|
await this._pc.setRemoteDescription(e);
|
|
6059
|
-
} catch (
|
|
6060
|
-
throw this._debug.error("[single] unable to set remote offer",
|
|
6191
|
+
} catch (t) {
|
|
6192
|
+
throw this._debug.error("[single] unable to set remote offer", t), this._logger?.log(C.ERROR, "setRemoteDescription-single"), this._sdpStats.logSetRemoteFailed(e, t), t;
|
|
6061
6193
|
}
|
|
6062
|
-
await this._simulcast.configureFromRemoteOffer(this._pc);
|
|
6194
|
+
if (await this._simulcast.configureFromRemoteOffer(this._pc), await this._handleTracks(), this._debug.debug("[single] create local answer"), !this._pc) throw Error("Interrupt allocation");
|
|
6063
6195
|
let n;
|
|
6064
6196
|
try {
|
|
6065
|
-
|
|
6066
|
-
n = await this._pc.createAnswer();
|
|
6197
|
+
n = await this._pc.createAnswer(), this._sdpStats.logSdpGenerated("answer");
|
|
6067
6198
|
} catch (e) {
|
|
6068
|
-
throw this._debug.error("[single] unable to create answer", e), this._logger?.log(C.ERROR, "createAnswer-single"), e;
|
|
6199
|
+
throw this._debug.error("[single] unable to create answer", e), this._logger?.log(C.ERROR, "createAnswer-single"), this._sdpStats.logCreateFailed("answer", e), e;
|
|
6069
6200
|
}
|
|
6070
6201
|
try {
|
|
6071
6202
|
if (!this._pc) throw Error("Interrupt allocation");
|
|
6072
6203
|
n.sdp = j.patchLocalSDP(n.sdp, !1, T.isBrokenH264Decoder(), !1), this._debug.debug("[single] set local answer", { answer: n }), await this._pc.setLocalDescription(n);
|
|
6073
6204
|
} catch (e) {
|
|
6074
|
-
throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(C.ERROR, "setLocalDescription-single"), e;
|
|
6205
|
+
throw this._debug.error("[single] unable to set local answer", e), this._logger?.log(C.ERROR, "setLocalDescription-single"), this._sdpStats.logSetLocalFailed(n, e), e;
|
|
6075
6206
|
}
|
|
6076
6207
|
n.sdp = this._simulcast.finalizeAnswer(n.sdp);
|
|
6077
6208
|
try {
|
|
@@ -6223,11 +6354,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6223
6354
|
if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
|
|
6224
6355
|
let i = r[0].rtpTimestamp;
|
|
6225
6356
|
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;
|
|
6226
|
-
let a = t - i &
|
|
6357
|
+
let a = t - i & _a, o = Math.ceil(a / ga);
|
|
6227
6358
|
return Math.min(100, Math.max(0, o));
|
|
6228
6359
|
}
|
|
6229
6360
|
async _monitorRtpShare() {
|
|
6230
|
-
let e =
|
|
6361
|
+
let e = si.getInstance().value;
|
|
6231
6362
|
if (!this._mediaSource.mediaSettings.isFastScreenSharingEnabled || !M.consumerFastScreenShare || e < .6) return;
|
|
6232
6363
|
let t = this._pc?.getSenders().find((e) => e.track?.kind === k.video && e.track?.contentHint === "motion");
|
|
6233
6364
|
t && (await t.getStats()).forEach((e) => {
|
|
@@ -6258,7 +6389,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6258
6389
|
}
|
|
6259
6390
|
}, X = /* @__PURE__ */ function(e) {
|
|
6260
6391
|
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;
|
|
6261
|
-
}({}),
|
|
6392
|
+
}({}), ya = class extends b {
|
|
6262
6393
|
constructor(e, t, n, r, i = R, a = null, o = null, s = null, c = null) {
|
|
6263
6394
|
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", () => {
|
|
6264
6395
|
this._vadController?.setSendTrack(this._mediaSource.getSendAudioTrack());
|
|
@@ -6379,11 +6510,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6379
6510
|
}
|
|
6380
6511
|
}
|
|
6381
6512
|
_createDirectTransport(e, t = !1) {
|
|
6382
|
-
let n = new
|
|
6513
|
+
let n = new ni(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
|
|
6383
6514
|
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;
|
|
6384
6515
|
}
|
|
6385
6516
|
_createServerTransport() {
|
|
6386
|
-
let e = new
|
|
6517
|
+
let e = new va(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
|
|
6387
6518
|
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;
|
|
6388
6519
|
}
|
|
6389
6520
|
_releaseDirectTransport() {
|
|
@@ -6475,7 +6606,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6475
6606
|
getStreamWaitingTimeMs(e, t) {
|
|
6476
6607
|
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);
|
|
6477
6608
|
}
|
|
6478
|
-
},
|
|
6609
|
+
}, ba = "videochat-epi", xa = 5e3, Sa = 500, Ca = class extends b {
|
|
6479
6610
|
constructor(e, t, n = null, r = !1, i = R) {
|
|
6480
6611
|
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) => {
|
|
6481
6612
|
this._screenShareStats.push(e);
|
|
@@ -6488,7 +6619,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6488
6619
|
}
|
|
6489
6620
|
static getEstimatedPerformanceIndex() {
|
|
6490
6621
|
try {
|
|
6491
|
-
let e = parseInt(localStorage.getItem(
|
|
6622
|
+
let e = parseInt(localStorage.getItem(ba) || "", 10);
|
|
6492
6623
|
return isNaN(e) ? 0 : e;
|
|
6493
6624
|
} catch {
|
|
6494
6625
|
return 0;
|
|
@@ -6497,9 +6628,9 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6497
6628
|
async _handleStats(e) {
|
|
6498
6629
|
if (!e.inbound || !e.inbound.rtps) return;
|
|
6499
6630
|
let t = Date.now();
|
|
6500
|
-
!this._directTopology && M.perfStatReportEnabled && this._previousPerfStatReportTimestamp +
|
|
6631
|
+
!this._directTopology && M.perfStatReportEnabled && this._previousPerfStatReportTimestamp + xa <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
|
|
6501
6632
|
let n = e.outbound.transport.local?.protocol === "tcp";
|
|
6502
|
-
!this._directTopology && n && this._previousNetworkStatReportTimestamp +
|
|
6633
|
+
!this._directTopology && n && this._previousNetworkStatReportTimestamp + Sa <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t), M.callStatReportEnabled && this._previousCallStatReportTimestamp + M.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t);
|
|
6503
6634
|
}
|
|
6504
6635
|
async reportPerfStats(e) {
|
|
6505
6636
|
let t = e.inbound.rtps.reduce((e, t) => (t.kind === "video" && (e.framesDecoded += t.framesDecoded || 0, e.framesReceived += t.framesReceived || 0), e), {
|
|
@@ -6508,7 +6639,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6508
6639
|
});
|
|
6509
6640
|
if (t.framesDecoded) try {
|
|
6510
6641
|
let e = await this._signaling.reportPerfStat(t);
|
|
6511
|
-
localStorage.setItem(
|
|
6642
|
+
localStorage.setItem(ba, e.estimatedPerformanceIndex);
|
|
6512
6643
|
} catch {}
|
|
6513
6644
|
}
|
|
6514
6645
|
async reportNetworkStats(e) {
|
|
@@ -6548,11 +6679,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6548
6679
|
rtt: Math.round(e.inbound.transport.currentRoundTripTime * 1e3),
|
|
6549
6680
|
ss_freeze_count: 0,
|
|
6550
6681
|
ss_total_freezes_duration: 0,
|
|
6551
|
-
local_address:
|
|
6682
|
+
local_address: Ta(e.inbound.transport.local),
|
|
6552
6683
|
local_connection_type: e.inbound.transport.local?.type,
|
|
6553
6684
|
network_type: e.inbound.transport.local?.networkType,
|
|
6554
6685
|
transport: e.inbound.transport.local?.protocol,
|
|
6555
|
-
remote_address:
|
|
6686
|
+
remote_address: Ta(e.inbound.transport.remote),
|
|
6556
6687
|
remote_connection_type: e.inbound.transport.remote?.type
|
|
6557
6688
|
};
|
|
6558
6689
|
this._previousCallStatReport || (this._previousCallStatReport = Object.assign({}, t));
|
|
@@ -6573,11 +6704,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6573
6704
|
frames_dropped: Math.max(0, t.frames_dropped - this._previousCallStatReport.frames_dropped),
|
|
6574
6705
|
rtt: Math.max(0, t.rtt)
|
|
6575
6706
|
};
|
|
6576
|
-
if (M.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !
|
|
6707
|
+
if (M.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !Ea(t.jitter_video) && (i.jitter_video = Math.round(t.jitter_video)), r && !Ea(t.jitter_audio) && (i.jitter_audio = Math.round(t.jitter_audio)), n && !Ea(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 && !Ea(t.total_audio_samples_received)) {
|
|
6577
6708
|
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);
|
|
6578
|
-
i.inserted_audio_samples_for_deceleration =
|
|
6709
|
+
i.inserted_audio_samples_for_deceleration = Da(n / e * 1e3), i.removed_audio_samples_for_acceleration = Da(r / e * 1e3), i.concealed_audio_samples = Da(a / e * 1e3), i.concealed_silent_audio_samples = Da(o / e * 1e3), i.concealment_audio_avg_size = Da(a / s), i.total_audio_energy = t.total_audio_energy;
|
|
6579
6710
|
}
|
|
6580
|
-
|
|
6711
|
+
wa(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), wa(t, "remote_address", "remote_connection_type") && (i.remote_address = t.remote_address, i.remote_connection_type = t.remote_connection_type);
|
|
6581
6712
|
let a = this._calculatePacketLoss(e.remoteInbound.rtps);
|
|
6582
6713
|
a.video !== void 0 && (i.video_loss = a.video), a.audio !== void 0 && (i.audio_loss = a.audio), this._statAggregator?.logCallStat(i), M.enableLogPerfStatReport && this._debug.log("Sent call stats", i), this._previousCallStatReport = t;
|
|
6583
6714
|
}
|
|
@@ -6609,26 +6740,26 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6609
6740
|
return r;
|
|
6610
6741
|
}
|
|
6611
6742
|
};
|
|
6612
|
-
function
|
|
6743
|
+
function wa(e, ...t) {
|
|
6613
6744
|
for (let n of t) if (!Object.hasOwn(e, n) || e[n] === void 0) return !1;
|
|
6614
6745
|
return !0;
|
|
6615
6746
|
}
|
|
6616
|
-
function
|
|
6747
|
+
function Ta(e, t = !1) {
|
|
6617
6748
|
if (e?.address) return e.address + (t ? `:${e.port}` : "");
|
|
6618
6749
|
}
|
|
6619
|
-
function
|
|
6750
|
+
function Ea(e) {
|
|
6620
6751
|
return e === void 0;
|
|
6621
6752
|
}
|
|
6622
|
-
function
|
|
6753
|
+
function Da(e) {
|
|
6623
6754
|
return Number.isNaN(e) ? 0 : e;
|
|
6624
6755
|
}
|
|
6625
6756
|
//#endregion
|
|
6626
6757
|
//#region src/static/Capabilities.ts
|
|
6627
|
-
var
|
|
6758
|
+
var Oa;
|
|
6628
6759
|
(function(e) {
|
|
6629
6760
|
function t() {
|
|
6630
6761
|
return {
|
|
6631
|
-
estimatedPerformanceIndex:
|
|
6762
|
+
estimatedPerformanceIndex: Ca.getEstimatedPerformanceIndex(),
|
|
6632
6763
|
audioMix: !0,
|
|
6633
6764
|
consumerUpdate: !0,
|
|
6634
6765
|
producerNotificationDataChannelVersion: 8,
|
|
@@ -6654,8 +6785,8 @@ var va;
|
|
|
6654
6785
|
};
|
|
6655
6786
|
}
|
|
6656
6787
|
e.get = t;
|
|
6657
|
-
})(
|
|
6658
|
-
var
|
|
6788
|
+
})(Oa || (Oa = {}));
|
|
6789
|
+
var ka = Oa, Aa = {
|
|
6659
6790
|
producerScreenTrack: () => !0,
|
|
6660
6791
|
videoTracksCount: () => M.videoTracksCount > 0,
|
|
6661
6792
|
waitingHall: () => !0,
|
|
@@ -6675,28 +6806,28 @@ var ya = va, ba = {
|
|
|
6675
6806
|
p2pRelay: () => !1,
|
|
6676
6807
|
waitForAdmin: () => M.waitForAdminInGroupCalls,
|
|
6677
6808
|
hold: () => M.hold
|
|
6678
|
-
},
|
|
6809
|
+
}, ja = class {
|
|
6679
6810
|
static getFlags() {
|
|
6680
|
-
let e = Object.values(
|
|
6811
|
+
let e = Object.values(Aa), t = 0;
|
|
6681
6812
|
for (let n = 0; n < e.length; n++) e[n]() && (t |= 1 << n);
|
|
6682
6813
|
return t.toString(16).toUpperCase();
|
|
6683
6814
|
}
|
|
6684
6815
|
static parseCapabilities(e) {
|
|
6685
6816
|
let t = parseInt(e || "0", 16);
|
|
6686
|
-
return Object.keys(
|
|
6817
|
+
return Object.keys(Aa).reduce((e, n, r) => (e[n] = !!(t & 1 << r), e), {});
|
|
6687
6818
|
}
|
|
6688
|
-
},
|
|
6819
|
+
}, Ma = 63n, Na = 16383n, Pa = 1073741823, Fa = 4611686018427387903n, Ia = class {
|
|
6689
6820
|
encode(e) {
|
|
6690
6821
|
let t = typeof e == "number" ? BigInt(e) : e;
|
|
6691
|
-
if (t <=
|
|
6692
|
-
if (t <=
|
|
6693
|
-
if (t <= BigInt(
|
|
6822
|
+
if (t <= Ma) return new Uint8Array([Number(t)]);
|
|
6823
|
+
if (t <= Na) return new Uint8Array([64 | Number(t >> 8n), Number(t & 255n)]);
|
|
6824
|
+
if (t <= BigInt(Pa)) return new Uint8Array([
|
|
6694
6825
|
128 | Number(t >> 24n),
|
|
6695
6826
|
Number(t >> 16n & 255n),
|
|
6696
6827
|
Number(t >> 8n & 255n),
|
|
6697
6828
|
Number(t & 255n)
|
|
6698
6829
|
]);
|
|
6699
|
-
if (t <=
|
|
6830
|
+
if (t <= Fa) return new Uint8Array([
|
|
6700
6831
|
192 | Number(t >> 56n),
|
|
6701
6832
|
Number(t >> 48n & 255n),
|
|
6702
6833
|
Number(t >> 40n & 255n),
|
|
@@ -6708,7 +6839,7 @@ var ya = va, ba = {
|
|
|
6708
6839
|
]);
|
|
6709
6840
|
throw RangeError("Number is too large to encode using varint");
|
|
6710
6841
|
}
|
|
6711
|
-
},
|
|
6842
|
+
}, La = class {
|
|
6712
6843
|
decode(e) {
|
|
6713
6844
|
let t = this.getNumBytesForLengthInteger(e);
|
|
6714
6845
|
if (t < 0) throw Error("Invalid length prefix");
|
|
@@ -6734,9 +6865,9 @@ var ya = va, ba = {
|
|
|
6734
6865
|
let t = e[0] & 192;
|
|
6735
6866
|
return t === 0 ? 1 : t === 64 ? 2 : t === 128 ? 4 : t === 192 ? 8 : -1;
|
|
6736
6867
|
}
|
|
6737
|
-
},
|
|
6868
|
+
}, Ra = class {
|
|
6738
6869
|
constructor(e) {
|
|
6739
|
-
h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new
|
|
6870
|
+
h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new Ia(), this.compression = e ?? null;
|
|
6740
6871
|
}
|
|
6741
6872
|
encode(e) {
|
|
6742
6873
|
let t = this.encoder.encode(e);
|
|
@@ -6753,9 +6884,9 @@ var ya = va, ba = {
|
|
|
6753
6884
|
default: return e;
|
|
6754
6885
|
}
|
|
6755
6886
|
}
|
|
6756
|
-
},
|
|
6887
|
+
}, za = class {
|
|
6757
6888
|
constructor(e) {
|
|
6758
|
-
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
|
|
6889
|
+
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 La(), this.compression = e ?? null, this.buffer = new Uint8Array(), this.expectedLength = null, this.offset = 0;
|
|
6759
6890
|
}
|
|
6760
6891
|
decode(e) {
|
|
6761
6892
|
let t = [];
|
|
@@ -6785,12 +6916,12 @@ var ya = va, ba = {
|
|
|
6785
6916
|
default: return e;
|
|
6786
6917
|
}
|
|
6787
6918
|
}
|
|
6788
|
-
},
|
|
6919
|
+
}, Ba = class {
|
|
6789
6920
|
static isBrowserSupported() {
|
|
6790
6921
|
return !(!("WebTransport" in window && typeof WebTransport == "function") || T.browserName() === "Safari");
|
|
6791
6922
|
}
|
|
6792
6923
|
constructor(e, t = {}, n = R) {
|
|
6793
|
-
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
|
|
6924
|
+
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 Ra(this.compression), this.decoder = new za(this.compression), this.connect();
|
|
6794
6925
|
}
|
|
6795
6926
|
async send(e) {
|
|
6796
6927
|
if (this.readyState !== WebSocket.OPEN) {
|
|
@@ -6916,9 +7047,9 @@ var ya = va, ba = {
|
|
|
6916
7047
|
compression: this.compression
|
|
6917
7048
|
}, n;
|
|
6918
7049
|
}
|
|
6919
|
-
},
|
|
7050
|
+
}, Va = /* @__PURE__ */ function(e) {
|
|
6920
7051
|
return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.ABORTED = "ABORTED", e;
|
|
6921
|
-
}({}),
|
|
7052
|
+
}({}), Ha = class {
|
|
6922
7053
|
constructor(e = R, t) {
|
|
6923
7054
|
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", yr.WEBSOCKET), h(this, "_debug", void 0), this.handlers = t, this._debug = e;
|
|
6924
7055
|
}
|
|
@@ -6968,7 +7099,7 @@ var ya = va, ba = {
|
|
|
6968
7099
|
return;
|
|
6969
7100
|
}
|
|
6970
7101
|
let e = this._buildUrl(this.wtEndpoint, !0);
|
|
6971
|
-
this.currentType = yr.WEBTRANSPORT, this.socket = new
|
|
7102
|
+
this.currentType = yr.WEBTRANSPORT, this.socket = new Ba(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
|
|
6972
7103
|
}
|
|
6973
7104
|
_connectWebSocket() {
|
|
6974
7105
|
if (!this.endpoint) {
|
|
@@ -6991,10 +7122,10 @@ var ya = va, ba = {
|
|
|
6991
7122
|
}
|
|
6992
7123
|
_buildUrl(e, t) {
|
|
6993
7124
|
let n = new URL(e), r = n.searchParams;
|
|
6994
|
-
return r.set("platform", M.platform), r.set("appVersion",
|
|
7125
|
+
return r.set("platform", M.platform), r.set("appVersion", M.appVersion), r.set("version", String(M.protocolVersion)), r.set("device", M.device), r.set("capabilities", ja.getFlags()), r.set("clientType", M.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === vr.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), M.useParticipantListChunk && (r.set("partIdx", String(M.participantListChunkInitIndex)), M.participantListChunkInitCount !== null && r.set("partCount", String(M.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
|
|
6995
7126
|
}
|
|
6996
7127
|
_canUseWebTransport() {
|
|
6997
|
-
return !this.forceWebSocket &&
|
|
7128
|
+
return !this.forceWebSocket && Ba.isBrowserSupported() && this.wtEndpoint !== null && M.webtransport;
|
|
6998
7129
|
}
|
|
6999
7130
|
_onOpen() {
|
|
7000
7131
|
this._startDoctor(), this.handlers.onOpen();
|
|
@@ -7048,31 +7179,31 @@ var ya = va, ba = {
|
|
|
7048
7179
|
_stopDoctor() {
|
|
7049
7180
|
window.clearTimeout(this.doctorTimer), this.doctorTimer = 0;
|
|
7050
7181
|
}
|
|
7051
|
-
},
|
|
7182
|
+
}, Ua = "open", Wa = 10, Ga = {
|
|
7052
7183
|
CONVERSATION_ENDED: "conversation-ended",
|
|
7053
7184
|
OBSOLETE_CLIENT: "gen.obsoleteClient",
|
|
7054
7185
|
INVALID_TOKEN: "invalid-token",
|
|
7055
7186
|
PARTICIPANT_NOT_FOUND: "participant-not-found",
|
|
7056
7187
|
ILLEGAL_PARTICIPANT_STATE: "illegal-participant-state",
|
|
7057
7188
|
SERVICE_UNAVAILABLE: "service-unavailable"
|
|
7058
|
-
},
|
|
7059
|
-
[
|
|
7060
|
-
[
|
|
7061
|
-
[
|
|
7062
|
-
[
|
|
7063
|
-
[
|
|
7064
|
-
[
|
|
7189
|
+
}, Ka = {
|
|
7190
|
+
[Ga.CONVERSATION_ENDED]: "conversation-ended",
|
|
7191
|
+
[Ga.OBSOLETE_CLIENT]: "obsolete-client",
|
|
7192
|
+
[Ga.INVALID_TOKEN]: "invalid-token",
|
|
7193
|
+
[Ga.PARTICIPANT_NOT_FOUND]: "participant-not-found",
|
|
7194
|
+
[Ga.ILLEGAL_PARTICIPANT_STATE]: "illegal-participant-state",
|
|
7195
|
+
[Ga.SERVICE_UNAVAILABLE]: "service-unavailable"
|
|
7065
7196
|
};
|
|
7066
|
-
function
|
|
7197
|
+
function qa(e, t) {
|
|
7067
7198
|
return e.errorMessage ?? e.message ?? e.error ?? t;
|
|
7068
7199
|
}
|
|
7069
|
-
var
|
|
7200
|
+
var Ja = new Set([
|
|
7070
7201
|
D.CALLER_IS_BLOCKED,
|
|
7071
7202
|
D.ENDED,
|
|
7072
7203
|
D.NOT_FOUND,
|
|
7073
7204
|
D.PARTICIPANT_LIMIT_REACHED,
|
|
7074
7205
|
D.SERVICE_UNAVAILABLE
|
|
7075
|
-
]),
|
|
7206
|
+
]), Ya = class e extends En {
|
|
7076
7207
|
static get WAIT_CONNECTION_DELAY() {
|
|
7077
7208
|
return M.waitConnectionDelay;
|
|
7078
7209
|
}
|
|
@@ -7083,7 +7214,7 @@ var Ra = new Set([
|
|
|
7083
7214
|
return !this.disposed && this.transport.readyState !== null;
|
|
7084
7215
|
}
|
|
7085
7216
|
constructor(e = R, t = null, n = null, r = null, i = null) {
|
|
7086
|
-
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, "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 $n(e), this.transport = new
|
|
7217
|
+
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, "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 $n(e), this.transport = new Ha(e, {
|
|
7087
7218
|
onConnecting: this._onTransportConnecting.bind(this),
|
|
7088
7219
|
onOpen: this._onOpen.bind(this),
|
|
7089
7220
|
onMessage: this._onMessage.bind(this),
|
|
@@ -7170,20 +7301,20 @@ var Ra = new Set([
|
|
|
7170
7301
|
return this._send(B.TRANSMIT_DATA, {
|
|
7171
7302
|
participantId: e,
|
|
7172
7303
|
data: r
|
|
7173
|
-
}, !0,
|
|
7304
|
+
}, !0, Wa);
|
|
7174
7305
|
}
|
|
7175
7306
|
async acceptCall(e) {
|
|
7176
7307
|
return this._send(B.ACCEPT_CALL, { mediaSettings: e });
|
|
7177
7308
|
}
|
|
7178
7309
|
async changeMediaSettings(e) {
|
|
7179
|
-
return this._send(B.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0,
|
|
7310
|
+
return this._send(B.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, Wa);
|
|
7180
7311
|
}
|
|
7181
7312
|
async changeParticipantState(e, t) {
|
|
7182
7313
|
let n = { participantState: { state: e } };
|
|
7183
7314
|
return t && (n.participantId = t), this._sendRaw(B.CHANGE_PARTICIPANT_STATE, n);
|
|
7184
7315
|
}
|
|
7185
7316
|
async hold(e) {
|
|
7186
|
-
let t =
|
|
7317
|
+
let t = ka.get();
|
|
7187
7318
|
return this._send(B.HOLD, {
|
|
7188
7319
|
hold: e,
|
|
7189
7320
|
capabilities: e ? void 0 : t
|
|
@@ -7415,7 +7546,7 @@ var Ra = new Set([
|
|
|
7415
7546
|
if (this.disposed) throw new wn(e);
|
|
7416
7547
|
switch (t.route) {
|
|
7417
7548
|
case "producer":
|
|
7418
|
-
this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState ===
|
|
7549
|
+
this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === Ua && this._handleCommandsQueue(this.datachannelCommandsQueue);
|
|
7419
7550
|
break;
|
|
7420
7551
|
case "websocket":
|
|
7421
7552
|
if (this.transport.readyState === null) {
|
|
@@ -7485,9 +7616,9 @@ var Ra = new Set([
|
|
|
7485
7616
|
}
|
|
7486
7617
|
_handleErrorMessage(e) {
|
|
7487
7618
|
this._logger?.log(C.SOCKET_ACTION, `error-${e.error}`);
|
|
7488
|
-
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r =
|
|
7619
|
+
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = qa(e, "Unknown signaling error");
|
|
7489
7620
|
switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
|
|
7490
|
-
case
|
|
7621
|
+
case Ga.SERVICE_UNAVAILABLE:
|
|
7491
7622
|
let i = new O(D.SERVICE_UNAVAILABLE, {
|
|
7492
7623
|
callError: n,
|
|
7493
7624
|
message: r,
|
|
@@ -7499,7 +7630,7 @@ var Ra = new Set([
|
|
|
7499
7630
|
reason: D.SERVICE_UNAVAILABLE
|
|
7500
7631
|
});
|
|
7501
7632
|
break;
|
|
7502
|
-
case
|
|
7633
|
+
case Ga.CONVERSATION_ENDED:
|
|
7503
7634
|
this.conversationReject ? this.conversationReject(new O(e.reason || x.SIGNALING_FAILED, {
|
|
7504
7635
|
callError: n,
|
|
7505
7636
|
message: r,
|
|
@@ -7510,22 +7641,22 @@ var Ra = new Set([
|
|
|
7510
7641
|
reason: e.reason
|
|
7511
7642
|
});
|
|
7512
7643
|
break;
|
|
7513
|
-
case
|
|
7514
|
-
case
|
|
7644
|
+
case Ga.ILLEGAL_PARTICIPANT_STATE:
|
|
7645
|
+
case Ga.PARTICIPANT_NOT_FOUND:
|
|
7515
7646
|
this._throwError(new O(x.SIGNALING_FAILED, {
|
|
7516
7647
|
callError: n,
|
|
7517
7648
|
message: r,
|
|
7518
7649
|
remote: !0
|
|
7519
7650
|
}));
|
|
7520
7651
|
break;
|
|
7521
|
-
case
|
|
7652
|
+
case Ga.OBSOLETE_CLIENT:
|
|
7522
7653
|
this.conversationReject?.(new O(e.reason || D.OBSOLETE_CLIENT, {
|
|
7523
7654
|
callError: n,
|
|
7524
7655
|
message: r,
|
|
7525
7656
|
remote: !0
|
|
7526
7657
|
}));
|
|
7527
7658
|
break;
|
|
7528
|
-
case
|
|
7659
|
+
case Ga.INVALID_TOKEN:
|
|
7529
7660
|
default:
|
|
7530
7661
|
if (e.sequence || t === yr.WEBTRANSPORT) break;
|
|
7531
7662
|
if (this.connected) this._throwError(new O(e.reason || x.SIGNALING_FAILED, {
|
|
@@ -7627,13 +7758,13 @@ var Ra = new Set([
|
|
|
7627
7758
|
let r = this.responseHandlers[n.sequence];
|
|
7628
7759
|
window.clearTimeout(r.responseTimer);
|
|
7629
7760
|
let i = W.measureMark(r.statMarkName);
|
|
7630
|
-
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(
|
|
7761
|
+
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(qa(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(qa(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
|
|
7631
7762
|
}
|
|
7632
7763
|
_handleCommandsQueue(e) {
|
|
7633
7764
|
for (; e.length > 0;) {
|
|
7634
7765
|
let t = e.shift();
|
|
7635
7766
|
if (this._debug.debug(`[signaling] command send [${t.sequence}]`, `'${t.name}'`, t.params), t.route === "producer") {
|
|
7636
|
-
if (this.producerCommandDataChannel?.readyState !==
|
|
7767
|
+
if (this.producerCommandDataChannel?.readyState !== Ua) {
|
|
7637
7768
|
t.reject(/* @__PURE__ */ Error(`Invalid data channel state: ${this.producerCommandDataChannel?.readyState}`));
|
|
7638
7769
|
return;
|
|
7639
7770
|
}
|
|
@@ -7718,7 +7849,7 @@ var Ra = new Set([
|
|
|
7718
7849
|
}
|
|
7719
7850
|
_onTransportFailed(e) {
|
|
7720
7851
|
switch (e.failure) {
|
|
7721
|
-
case
|
|
7852
|
+
case Va.EMPTY_ENDPOINT:
|
|
7722
7853
|
this.conversationReject?.(new O(x.SIGNALING_FAILED, {
|
|
7723
7854
|
callError: {
|
|
7724
7855
|
scope: "internal",
|
|
@@ -7729,7 +7860,7 @@ var Ra = new Set([
|
|
|
7729
7860
|
remote: e.remote
|
|
7730
7861
|
}));
|
|
7731
7862
|
break;
|
|
7732
|
-
case
|
|
7863
|
+
case Va.NETWORK_ERROR:
|
|
7733
7864
|
this._fail(new O(D.NETWORK_ERROR, { callError: {
|
|
7734
7865
|
scope: "network",
|
|
7735
7866
|
source: e.source,
|
|
@@ -7737,7 +7868,7 @@ var Ra = new Set([
|
|
|
7737
7868
|
description: "connection-failed"
|
|
7738
7869
|
} }));
|
|
7739
7870
|
break;
|
|
7740
|
-
case
|
|
7871
|
+
case Va.ABORTED:
|
|
7741
7872
|
this._debug.debug("[signaling] aborted reconnect"), this._fail(new O(D.CANCELED));
|
|
7742
7873
|
break;
|
|
7743
7874
|
}
|
|
@@ -7749,7 +7880,7 @@ var Ra = new Set([
|
|
|
7749
7880
|
this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStat(br.FAILED_PINGS);
|
|
7750
7881
|
}
|
|
7751
7882
|
_attachNotificationCallError(e) {
|
|
7752
|
-
e.callError || !e.reason || e.reason === D.FAILED || e.reason === D.UNKNOWN_ERROR || !
|
|
7883
|
+
e.callError || !e.reason || e.reason === D.FAILED || e.reason === D.UNKNOWN_ERROR || !Ja.has(e.reason) && !e.errorCode || (e.callError = {
|
|
7753
7884
|
scope: "server",
|
|
7754
7885
|
source: this._getSocketType(),
|
|
7755
7886
|
code: e.errorCode || "protocol",
|
|
@@ -7757,7 +7888,7 @@ var Ra = new Set([
|
|
|
7757
7888
|
});
|
|
7758
7889
|
}
|
|
7759
7890
|
_createSignalingCallError(e, t, n) {
|
|
7760
|
-
let r =
|
|
7891
|
+
let r = Ka[e];
|
|
7761
7892
|
if (r) return {
|
|
7762
7893
|
scope: "server",
|
|
7763
7894
|
source: n,
|
|
@@ -7779,39 +7910,39 @@ var Ra = new Set([
|
|
|
7779
7910
|
...t
|
|
7780
7911
|
});
|
|
7781
7912
|
}
|
|
7782
|
-
},
|
|
7913
|
+
}, Xa = /* @__PURE__ */ function(e) {
|
|
7783
7914
|
return e.INCOMING = "INCOMING", e.OUTGOING = "OUTGOING", e.JOINING = "JOINING", e;
|
|
7784
|
-
}(
|
|
7915
|
+
}(Xa || {}), Za = /* @__PURE__ */ function(e) {
|
|
7785
7916
|
return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
|
|
7786
|
-
}(
|
|
7917
|
+
}(Za || {}), Qa = /* @__PURE__ */ function(e) {
|
|
7787
7918
|
return e.ATTENDEE = "ATTENDEE", e.HAND_UP = "HAND_UP", e;
|
|
7788
|
-
}(
|
|
7919
|
+
}(Qa || {}), $a = /* @__PURE__ */ function(e) {
|
|
7789
7920
|
return e.ADD_PARTICIPANT = "ADD_PARTICIPANT", e.RECORD = "RECORD", e.MOVIE_SHARE = "MOVIE_SHARE", e;
|
|
7790
|
-
}(
|
|
7921
|
+
}($a || {}), eo = /* @__PURE__ */ function(e) {
|
|
7791
7922
|
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;
|
|
7792
|
-
}(
|
|
7793
|
-
function
|
|
7923
|
+
}(eo || {});
|
|
7924
|
+
function to(e, t) {
|
|
7794
7925
|
if (e.length !== t.length) return !1;
|
|
7795
7926
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
7796
7927
|
return !0;
|
|
7797
7928
|
}
|
|
7798
|
-
function
|
|
7929
|
+
function no(e, t) {
|
|
7799
7930
|
let n = new Set(e);
|
|
7800
7931
|
for (let [e, r] of Object.entries(t)) r ? n.add(e) : n.delete(e);
|
|
7801
7932
|
return Array.from(n);
|
|
7802
7933
|
}
|
|
7803
7934
|
//#endregion
|
|
7804
7935
|
//#region src/enums/MuteState.ts
|
|
7805
|
-
var
|
|
7936
|
+
var ro = /* @__PURE__ */ function(e) {
|
|
7806
7937
|
return e.UNMUTE = "UNMUTE", e.MUTE = "MUTE", e.MUTE_PERMANENT = "MUTE_PERMANENT", e;
|
|
7807
|
-
}(
|
|
7938
|
+
}(ro || {}), Z = /* @__PURE__ */ function(e) {
|
|
7808
7939
|
return e.CALLED = "CALLED", e.ACCEPTED = "ACCEPTED", e.REJECTED = "REJECTED", e.HUNGUP = "HUNGUP", e;
|
|
7809
|
-
}(Z || {}),
|
|
7940
|
+
}(Z || {}), io = /* @__PURE__ */ function(e) {
|
|
7810
7941
|
return e.UPDATE = "UPDATE", e.REMOVE = "REMOVE", e.ACTIVATE = "ACTIVATE", e.TIMEOUT = "TIMEOUT", e;
|
|
7811
|
-
}(
|
|
7942
|
+
}(io || {}), ao = /* @__PURE__ */ function(e) {
|
|
7812
7943
|
return e.NO_AVAILABLE_TRACKS = "no-available-tracks", e.UNKNOWN_ERROR = "unknown-error", e;
|
|
7813
|
-
}(
|
|
7814
|
-
function
|
|
7944
|
+
}(ao || {});
|
|
7945
|
+
function oo(e) {
|
|
7815
7946
|
switch (e) {
|
|
7816
7947
|
case 1: return "no-available-tracks";
|
|
7817
7948
|
default: return "unknown-error";
|
|
@@ -7819,17 +7950,17 @@ function Xa(e) {
|
|
|
7819
7950
|
}
|
|
7820
7951
|
//#endregion
|
|
7821
7952
|
//#region src/enums/UserRole.ts
|
|
7822
|
-
var
|
|
7953
|
+
var so = /* @__PURE__ */ function(e) {
|
|
7823
7954
|
return e.CREATOR = "CREATOR", e.ADMIN = "ADMIN", e;
|
|
7824
|
-
}(
|
|
7825
|
-
function
|
|
7955
|
+
}(so || {});
|
|
7956
|
+
function co(e, t) {
|
|
7826
7957
|
if (e.length !== t.length) return !1;
|
|
7827
7958
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
7828
7959
|
return !0;
|
|
7829
7960
|
}
|
|
7830
7961
|
//#endregion
|
|
7831
7962
|
//#region src/static/ParticipantConnectionStatusUtils.ts
|
|
7832
|
-
var
|
|
7963
|
+
var lo;
|
|
7833
7964
|
(function(e) {
|
|
7834
7965
|
function t(e) {
|
|
7835
7966
|
let t = e?.transport ?? e?.lastEffective ?? N.WAITING, n = {
|
|
@@ -7881,8 +8012,8 @@ var $a;
|
|
|
7881
8012
|
shouldNotify: !0
|
|
7882
8013
|
});
|
|
7883
8014
|
}
|
|
7884
|
-
})(
|
|
7885
|
-
var
|
|
8015
|
+
})(lo || (lo = {}));
|
|
8016
|
+
var uo = lo, fo = /* @__PURE__ */ function(e) {
|
|
7886
8017
|
return e.USER = "USER", e.ANONYM = "ANONYM", e.GROUP = "GROUP", e;
|
|
7887
8018
|
}({}), Q;
|
|
7888
8019
|
(function(e) {
|
|
@@ -7945,7 +8076,7 @@ var eo = $a, to = /* @__PURE__ */ function(e) {
|
|
|
7945
8076
|
})(Q || (Q = {}));
|
|
7946
8077
|
//#endregion
|
|
7947
8078
|
//#region src/types/WaitingHall.ts
|
|
7948
|
-
function
|
|
8079
|
+
function po(e) {
|
|
7949
8080
|
try {
|
|
7950
8081
|
return btoa(JSON.stringify(e));
|
|
7951
8082
|
} catch (t) {
|
|
@@ -7953,7 +8084,7 @@ function no(e) {
|
|
|
7953
8084
|
}
|
|
7954
8085
|
return null;
|
|
7955
8086
|
}
|
|
7956
|
-
function
|
|
8087
|
+
function mo(e) {
|
|
7957
8088
|
try {
|
|
7958
8089
|
return JSON.parse(atob(e));
|
|
7959
8090
|
} catch (t) {
|
|
@@ -7963,12 +8094,12 @@ function ro(e) {
|
|
|
7963
8094
|
}
|
|
7964
8095
|
//#endregion
|
|
7965
8096
|
//#region src/utils/Conversation.ts
|
|
7966
|
-
var
|
|
7967
|
-
function
|
|
8097
|
+
var ho = (e, t) => j.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
|
|
8098
|
+
function go(e) {
|
|
7968
8099
|
if (e.conversation?.muteStates) return e.conversation.muteStates;
|
|
7969
8100
|
if (e.muteState && e.muteOptions) return e.muteOptions.reduce((t, n) => (t[n] = e.muteState, t), {});
|
|
7970
8101
|
}
|
|
7971
|
-
function
|
|
8102
|
+
function _o(e, t) {
|
|
7972
8103
|
switch (e) {
|
|
7973
8104
|
case S.AUDIO: return !!t.isAudioEnabled;
|
|
7974
8105
|
case S.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
|
|
@@ -7977,12 +8108,12 @@ function oo(e, t) {
|
|
|
7977
8108
|
default: return !1;
|
|
7978
8109
|
}
|
|
7979
8110
|
}
|
|
7980
|
-
function
|
|
8111
|
+
function vo(e, t) {
|
|
7981
8112
|
return j.objectReduce(e, (e, n, r) => {
|
|
7982
8113
|
switch (n) {
|
|
7983
|
-
case
|
|
7984
|
-
case
|
|
7985
|
-
|
|
8114
|
+
case ro.MUTE:
|
|
8115
|
+
case ro.MUTE_PERMANENT:
|
|
8116
|
+
_o(r, t) || (e[r] = n);
|
|
7986
8117
|
break;
|
|
7987
8118
|
default:
|
|
7988
8119
|
e[r] = n;
|
|
@@ -7991,19 +8122,19 @@ function so(e, t) {
|
|
|
7991
8122
|
return e;
|
|
7992
8123
|
}, {});
|
|
7993
8124
|
}
|
|
7994
|
-
function
|
|
8125
|
+
function yo(e) {
|
|
7995
8126
|
let { muteStates: t = {}, mediaSettings: n } = e;
|
|
7996
|
-
return
|
|
8127
|
+
return vo(t, n);
|
|
7997
8128
|
}
|
|
7998
|
-
function
|
|
8129
|
+
function bo(e, t) {
|
|
7999
8130
|
let n = e.conversation.participants.find((t) => j.comparePeerId(t.peerId, e.peerId));
|
|
8000
8131
|
if (!n) return t;
|
|
8001
8132
|
let { mediaSettings: r } = n;
|
|
8002
|
-
return
|
|
8133
|
+
return vo(t, r);
|
|
8003
8134
|
}
|
|
8004
8135
|
//#endregion
|
|
8005
8136
|
//#region src/utils/IceServers.ts
|
|
8006
|
-
function
|
|
8137
|
+
function xo(e) {
|
|
8007
8138
|
if (!e) return null;
|
|
8008
8139
|
let t = Array.from(new Set((e.urls ?? []).map((e) => e.trim()).filter((e) => e.length > 0)));
|
|
8009
8140
|
return t.length ? {
|
|
@@ -8011,8 +8142,8 @@ function uo(e) {
|
|
|
8011
8142
|
urls: t
|
|
8012
8143
|
} : null;
|
|
8013
8144
|
}
|
|
8014
|
-
function
|
|
8015
|
-
let n = [], r =
|
|
8145
|
+
function So(e, t) {
|
|
8146
|
+
let n = [], r = xo(e), i = xo(t);
|
|
8016
8147
|
if (r && n.push(r), i) {
|
|
8017
8148
|
let e = [...i.urls];
|
|
8018
8149
|
e.push(`${e[e.length - 1]}?transport=tcp`), n.push({
|
|
@@ -8024,7 +8155,7 @@ function fo(e, t) {
|
|
|
8024
8155
|
}
|
|
8025
8156
|
//#endregion
|
|
8026
8157
|
//#region src/utils/Lz4.ts
|
|
8027
|
-
function
|
|
8158
|
+
function Co(e, t) {
|
|
8028
8159
|
let n = new Uint8Array(t), r = 0, i = 0;
|
|
8029
8160
|
for (; r < e.length && i < t;) {
|
|
8030
8161
|
let a = e[r++], o = a >> 4, s = a & 15;
|
|
@@ -8051,7 +8182,7 @@ function po(e, t) {
|
|
|
8051
8182
|
}
|
|
8052
8183
|
//#endregion
|
|
8053
8184
|
//#region src/utils/SerializeLatest.ts
|
|
8054
|
-
function
|
|
8185
|
+
function wo(e) {
|
|
8055
8186
|
let t, n = !1, r, i = async () => {
|
|
8056
8187
|
let t = !1, i;
|
|
8057
8188
|
for (; n;) {
|
|
@@ -8072,7 +8203,7 @@ function mo(e) {
|
|
|
8072
8203
|
}
|
|
8073
8204
|
//#endregion
|
|
8074
8205
|
//#region src/classes/AudioFix.ts
|
|
8075
|
-
var
|
|
8206
|
+
var To = class {
|
|
8076
8207
|
constructor(e, t = R, n = null) {
|
|
8077
8208
|
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;
|
|
8078
8209
|
}
|
|
@@ -8110,7 +8241,7 @@ var ho = class {
|
|
|
8110
8241
|
this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
|
|
8111
8242
|
}));
|
|
8112
8243
|
}
|
|
8113
|
-
},
|
|
8244
|
+
}, Eo = class {
|
|
8114
8245
|
constructor(e, t = !1, n = R, r = null) {
|
|
8115
8246
|
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();
|
|
8116
8247
|
}
|
|
@@ -8211,13 +8342,13 @@ var ho = class {
|
|
|
8211
8342
|
};
|
|
8212
8343
|
//#endregion
|
|
8213
8344
|
//#region src/classes/conversation/ConversationResponseValidator.ts
|
|
8214
|
-
function
|
|
8215
|
-
e ||
|
|
8345
|
+
function Do(e, t) {
|
|
8346
|
+
e || ko(t, "response-empty"), e.id || ko(t, "id-empty"), e.endpoint || ko(t, "endpoint-empty"), !Oo(e.stun_server) && !Oo(e.turn_server) && ko(t, "ice-servers-empty");
|
|
8216
8347
|
}
|
|
8217
|
-
function
|
|
8348
|
+
function Oo(e) {
|
|
8218
8349
|
return Array.isArray(e?.urls) && e.urls.length > 0;
|
|
8219
8350
|
}
|
|
8220
|
-
function
|
|
8351
|
+
function ko(e, t) {
|
|
8221
8352
|
let n = e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), r = e === "fastStart" || e === "fastJoin";
|
|
8222
8353
|
throw new O(r ? e === "fastStart" ? D.FAST_START_ERROR : D.FAST_JOIN_ERROR : D.UNKNOWN_ERROR, {
|
|
8223
8354
|
message: `Invalid ${e} response: ${t}`,
|
|
@@ -8236,7 +8367,7 @@ function yo(e, t) {
|
|
|
8236
8367
|
}
|
|
8237
8368
|
//#endregion
|
|
8238
8369
|
//#region src/classes/DebugInfo.ts
|
|
8239
|
-
var
|
|
8370
|
+
var Ao = 90, jo = 3, Mo = class extends b {
|
|
8240
8371
|
constructor(e = R) {
|
|
8241
8372
|
super(), h(this, "_lastMemoryStat", {
|
|
8242
8373
|
percent: 0,
|
|
@@ -8252,11 +8383,11 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8252
8383
|
let e = window?.performance?.memory;
|
|
8253
8384
|
if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
|
|
8254
8385
|
let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
|
|
8255
|
-
t >
|
|
8386
|
+
t > Ao ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= jo) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
|
|
8256
8387
|
}
|
|
8257
|
-
},
|
|
8258
|
-
constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i }) {
|
|
8259
|
-
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, "_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;
|
|
8388
|
+
}, No = class {
|
|
8389
|
+
constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i, onNonFatalError: a }) {
|
|
8390
|
+
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;
|
|
8260
8391
|
}
|
|
8261
8392
|
request(e) {
|
|
8262
8393
|
this._pendingRequests = e.slice(), this._lastRequests = e.slice();
|
|
@@ -8292,11 +8423,16 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8292
8423
|
this._pendingRequests = null, this._pendingPromises = [];
|
|
8293
8424
|
let r = {};
|
|
8294
8425
|
try {
|
|
8295
|
-
|
|
8296
|
-
|
|
8426
|
+
let i = this._getRequestLayouts(t);
|
|
8427
|
+
if (!i) {
|
|
8428
|
+
n.forEach(({ resolve: e }) => e());
|
|
8429
|
+
return;
|
|
8430
|
+
}
|
|
8431
|
+
r = i;
|
|
8432
|
+
let a = this._forceNextFlush || Object.keys(this._uncertainLayouts).length > 0;
|
|
8297
8433
|
this._forceNextFlush = !1;
|
|
8298
|
-
let
|
|
8299
|
-
|
|
8434
|
+
let o = this._getDiff(r, a);
|
|
8435
|
+
o.length && await this._updateDisplayLayout(o), e === this._generation && (this._requestedLayouts = r, this._uncertainLayouts = {}), n.forEach(({ resolve: e }) => e());
|
|
8300
8436
|
} catch (t) {
|
|
8301
8437
|
e === this._generation ? (this._uncertainLayouts = {
|
|
8302
8438
|
...this._uncertainLayouts,
|
|
@@ -8307,30 +8443,30 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8307
8443
|
}
|
|
8308
8444
|
}
|
|
8309
8445
|
_getRequestLayouts(e) {
|
|
8310
|
-
let t = {}, n = this._getParticipants();
|
|
8311
|
-
for (let
|
|
8312
|
-
let e = typeof
|
|
8313
|
-
if (!
|
|
8314
|
-
this._debug.log(`Unknown participant external ID ${typeof
|
|
8446
|
+
let t = {}, n = [], r = this._getParticipants();
|
|
8447
|
+
for (let i of e) {
|
|
8448
|
+
let e = typeof i.uid == "object" ? i.uid : Q.fromId(i.uid), a = this._api.getCachedParticipantIdByExternalId(e);
|
|
8449
|
+
if (!a) {
|
|
8450
|
+
this._debug.log(`Unknown participant external ID ${typeof i.uid == "object" ? Q.toString(i.uid) : i.uid}`), n.push(e.id);
|
|
8315
8451
|
continue;
|
|
8316
8452
|
}
|
|
8317
|
-
if (!
|
|
8318
|
-
let
|
|
8319
|
-
participantId:
|
|
8320
|
-
mediaType:
|
|
8321
|
-
streamName:
|
|
8453
|
+
if (!r[a] && !this._isMe(a)) continue;
|
|
8454
|
+
let o = Mn({
|
|
8455
|
+
participantId: a,
|
|
8456
|
+
mediaType: i.mediaType,
|
|
8457
|
+
streamName: i.streamName
|
|
8322
8458
|
});
|
|
8323
|
-
t[
|
|
8324
|
-
uid:
|
|
8325
|
-
mediaType:
|
|
8326
|
-
width:
|
|
8327
|
-
height:
|
|
8328
|
-
fit:
|
|
8329
|
-
...
|
|
8330
|
-
...
|
|
8459
|
+
t[o] = {
|
|
8460
|
+
uid: i.uid,
|
|
8461
|
+
mediaType: i.mediaType,
|
|
8462
|
+
width: i.width,
|
|
8463
|
+
height: i.height,
|
|
8464
|
+
fit: i.cover ? "cv" : "cn",
|
|
8465
|
+
...i.priority === void 0 ? {} : { priority: i.priority },
|
|
8466
|
+
...i.streamName === void 0 ? {} : { streamName: i.streamName }
|
|
8331
8467
|
};
|
|
8332
8468
|
}
|
|
8333
|
-
return t;
|
|
8469
|
+
return n.length ? (this._onNonFatalError(`Participant ID mapping not found for external IDs "${Array.from(new Set(n)).join("\", \"")}" while handling requestDisplayLayout`), null) : t;
|
|
8334
8470
|
}
|
|
8335
8471
|
_getDiff(e, t = !1) {
|
|
8336
8472
|
let n = [];
|
|
@@ -8364,12 +8500,12 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8364
8500
|
let n = e, r = t;
|
|
8365
8501
|
return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
|
|
8366
8502
|
}
|
|
8367
|
-
},
|
|
8503
|
+
}, Po = 44100, Fo = class {
|
|
8368
8504
|
constructor(e, t) {
|
|
8369
8505
|
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]);
|
|
8370
8506
|
try {
|
|
8371
8507
|
let e = T.getAudioContext();
|
|
8372
|
-
this.
|
|
8508
|
+
this._analyser = e.createAnalyser(), this._analyser.fftSize = 1024, this._analyser.smoothingTimeConstant = 0, T.browserName() === "Safari" && (this._gainNode = e.createGain(), this._gainNode.gain.value = 1e-5, this._gainNode.connect(e.destination), this._analyser.connect(this._gainNode)), this._fftBins = new Uint8Array(this._analyser.frequencyBinCount), this._mediaStreamSource = e.createMediaStreamSource(this._stream), this._mediaStreamSource.connect(this._analyser);
|
|
8373
8509
|
} catch {}
|
|
8374
8510
|
}
|
|
8375
8511
|
get track() {
|
|
@@ -8381,7 +8517,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8381
8517
|
_getBins() {
|
|
8382
8518
|
if (!this._fftBins || !this._analyser) return new Uint8Array();
|
|
8383
8519
|
this._analyser.getByteFrequencyData(this._fftBins);
|
|
8384
|
-
let e =
|
|
8520
|
+
let e = Po / this._fftBins.length, t = Math.ceil(M.voiceParams.minFreq / e), n = Math.floor(M.voiceParams.maxFreq / e);
|
|
8385
8521
|
return this._fftBins.subarray(t, n);
|
|
8386
8522
|
}
|
|
8387
8523
|
getLevel() {
|
|
@@ -8394,7 +8530,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8394
8530
|
destroy() {
|
|
8395
8531
|
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);
|
|
8396
8532
|
}
|
|
8397
|
-
},
|
|
8533
|
+
}, Io = class extends b {
|
|
8398
8534
|
constructor(e) {
|
|
8399
8535
|
super(), h(this, "_detector", null), h(this, "_interval", null);
|
|
8400
8536
|
let t = () => {
|
|
@@ -8410,7 +8546,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8410
8546
|
}), this.subscribe(e, qt.SOURCE_READY, n), n();
|
|
8411
8547
|
}
|
|
8412
8548
|
init(e) {
|
|
8413
|
-
this._stopDetector(), this._detector = new
|
|
8549
|
+
this._stopDetector(), this._detector = new Fo("local", e.clone());
|
|
8414
8550
|
}
|
|
8415
8551
|
_stopDetector() {
|
|
8416
8552
|
this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
|
|
@@ -8418,7 +8554,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8418
8554
|
destroy() {
|
|
8419
8555
|
this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
|
|
8420
8556
|
}
|
|
8421
|
-
},
|
|
8557
|
+
}, Lo = class {
|
|
8422
8558
|
constructor(e, t = R) {
|
|
8423
8559
|
h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
|
|
8424
8560
|
}
|
|
@@ -8438,9 +8574,9 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8438
8574
|
this.isProcessing = !1;
|
|
8439
8575
|
}
|
|
8440
8576
|
}
|
|
8441
|
-
},
|
|
8577
|
+
}, Ro = /* @__PURE__ */ function(e) {
|
|
8442
8578
|
return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
|
|
8443
|
-
}({}),
|
|
8579
|
+
}({}), zo = class extends b {
|
|
8444
8580
|
constructor(e) {
|
|
8445
8581
|
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, X.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(e, X.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(e, X.SIGNALLED_ACTIVE_PARTICIPANTS, this._onSignalledActiveParticipants.bind(this)), this.subscribe(e, X.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
8446
8582
|
}
|
|
@@ -8448,7 +8584,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8448
8584
|
this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
|
|
8449
8585
|
}
|
|
8450
8586
|
_onRemoteTrackAdded(e, t, n) {
|
|
8451
|
-
if (n.kind === k.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new
|
|
8587
|
+
if (n.kind === k.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new Fo(e, n)), !this._interval)) {
|
|
8452
8588
|
let e = () => {
|
|
8453
8589
|
this._collectVolumes(), this._interval = window.setTimeout(e, M.voiceParams.interval);
|
|
8454
8590
|
};
|
|
@@ -8480,14 +8616,14 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8480
8616
|
}
|
|
8481
8617
|
_getAudioTrackLevelByParticipantId(e) {
|
|
8482
8618
|
if (this._isTransparentAudioMode()) return this._getTransparentAudioLevelByParticipantId(e);
|
|
8483
|
-
let t = this._detectors.get(
|
|
8619
|
+
let t = this._detectors.get(ri.AUDIO_MIX);
|
|
8484
8620
|
return t ? t.getLevel() : null;
|
|
8485
8621
|
}
|
|
8486
8622
|
_getTransparentAudioLevelByParticipantId(e) {
|
|
8487
8623
|
if (!this._activeParticipants?.includes(e)) return null;
|
|
8488
8624
|
let t = null;
|
|
8489
8625
|
return this._detectors.forEach((e, n) => {
|
|
8490
|
-
if (!n.startsWith(`${
|
|
8626
|
+
if (!n.startsWith(`${ri.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
|
|
8491
8627
|
let r = e.getLevel();
|
|
8492
8628
|
(!t || r.real > t.real) && (t = r);
|
|
8493
8629
|
}), t;
|
|
@@ -8506,11 +8642,11 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8506
8642
|
e.destroy();
|
|
8507
8643
|
}), this._detectors.clear();
|
|
8508
8644
|
}
|
|
8509
|
-
},
|
|
8645
|
+
}, Bo = /* @__PURE__ */ function(e) {
|
|
8510
8646
|
return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
|
|
8511
|
-
}({}),
|
|
8647
|
+
}({}), Vo = class extends b {
|
|
8512
8648
|
constructor(e, t, n) {
|
|
8513
|
-
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e,
|
|
8649
|
+
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, Ro.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this.subscribe(t, X.SIGNALLED_SPEAKER_CHANGED, this._onServerSpeakerChanged.bind(this)), this.subscribe(t, X.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this));
|
|
8514
8650
|
}
|
|
8515
8651
|
destroy() {
|
|
8516
8652
|
this.unsubscribe();
|
|
@@ -8532,9 +8668,9 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8532
8668
|
_onTopologyChanged(e) {
|
|
8533
8669
|
this._serverSideSpeakerDetection = e === J.SERVER;
|
|
8534
8670
|
}
|
|
8535
|
-
},
|
|
8671
|
+
}, Ho = 15e3, Uo = 15e3, Wo = class extends b {
|
|
8536
8672
|
constructor(e, t, n, r = R, i = null) {
|
|
8537
|
-
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, X.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t,
|
|
8673
|
+
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, X.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(t, Ro.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
|
|
8538
8674
|
}
|
|
8539
8675
|
destroy() {
|
|
8540
8676
|
this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
|
|
@@ -8546,10 +8682,10 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8546
8682
|
this._connectionTimeout || !this._connectionTimeoutSuppressed || this._reportConnectionTimeout();
|
|
8547
8683
|
}
|
|
8548
8684
|
_getConnectionTimeout() {
|
|
8549
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
8685
|
+
return this._transport.getTopology() === J.DIRECT ? Ho : M.specListenerParams.connectionTimeout;
|
|
8550
8686
|
}
|
|
8551
8687
|
_getVolumeTimeout() {
|
|
8552
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
8688
|
+
return this._transport.getTopology() === J.DIRECT ? Uo : M.specListenerParams.volumeTimeout;
|
|
8553
8689
|
}
|
|
8554
8690
|
_onTransportStateChanged(e, t) {
|
|
8555
8691
|
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`));
|
|
@@ -8582,7 +8718,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8582
8718
|
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}`));
|
|
8583
8719
|
}), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
|
|
8584
8720
|
}
|
|
8585
|
-
},
|
|
8721
|
+
}, Go = class extends f {
|
|
8586
8722
|
constructor(e, t, n, r = () => void 0) {
|
|
8587
8723
|
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();
|
|
8588
8724
|
}
|
|
@@ -8662,7 +8798,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8662
8798
|
_now() {
|
|
8663
8799
|
return Date.now() - this._serverTimeDelta;
|
|
8664
8800
|
}
|
|
8665
|
-
},
|
|
8801
|
+
}, Ko = "invalid-error-metadata", qo = 64, Jo = new Set(Object.values(D)), Yo = new Set(Object.values(x)), Xo = {
|
|
8666
8802
|
[D.CANCELED]: {
|
|
8667
8803
|
type: "semantic",
|
|
8668
8804
|
reason: "canceled"
|
|
@@ -8783,7 +8919,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8783
8919
|
type: "semantic",
|
|
8784
8920
|
reason: "obsolete_client"
|
|
8785
8921
|
}
|
|
8786
|
-
},
|
|
8922
|
+
}, Zo = {
|
|
8787
8923
|
[x.MIC_CAMERA_PERMISSION]: {
|
|
8788
8924
|
type: "direct-error",
|
|
8789
8925
|
error: {
|
|
@@ -8872,14 +9008,14 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8872
9008
|
}
|
|
8873
9009
|
}
|
|
8874
9010
|
};
|
|
8875
|
-
function
|
|
8876
|
-
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return
|
|
9011
|
+
function Qo(e) {
|
|
9012
|
+
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return Ko;
|
|
8877
9013
|
let t = String(e).trim();
|
|
8878
|
-
if (!t) return
|
|
9014
|
+
if (!t) return Ko;
|
|
8879
9015
|
let n = t.toLowerCase().replace(/[\s_:]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
8880
|
-
return !n || !/^[a-z0-9.-]+$/.test(n) ?
|
|
9016
|
+
return !n || !/^[a-z0-9.-]+$/.test(n) ? Ko : n.length > qo ? `${n.slice(0, qo - 3)}...` : n;
|
|
8881
9017
|
}
|
|
8882
|
-
function
|
|
9018
|
+
function $o(e) {
|
|
8883
9019
|
if (!e || typeof e != "object") return !1;
|
|
8884
9020
|
let t = e;
|
|
8885
9021
|
switch (t.scope) {
|
|
@@ -8891,49 +9027,49 @@ function Uo(e) {
|
|
|
8891
9027
|
default: return !1;
|
|
8892
9028
|
}
|
|
8893
9029
|
}
|
|
8894
|
-
function
|
|
8895
|
-
let t =
|
|
9030
|
+
function es(e) {
|
|
9031
|
+
let t = Qo(e.description);
|
|
8896
9032
|
if (e.scope === "unknown") return `unknown:${t}`;
|
|
8897
|
-
let n =
|
|
9033
|
+
let n = Qo(e.code);
|
|
8898
9034
|
return e.scope === "internal" ? `internal:${n}:${t}` : `${e.scope}:${e.source}:${n}:${t}`;
|
|
8899
9035
|
}
|
|
8900
|
-
function
|
|
9036
|
+
function ts(e, t) {
|
|
8901
9037
|
return t === null ? e.type === "direct-error" ? {
|
|
8902
9038
|
reason: "error",
|
|
8903
|
-
string_value:
|
|
8904
|
-
} : { reason: "failed" } :
|
|
9039
|
+
string_value: es(e.error)
|
|
9040
|
+
} : { reason: "failed" } : $o(t) ? {
|
|
8905
9041
|
reason: "error",
|
|
8906
|
-
string_value:
|
|
9042
|
+
string_value: es(t)
|
|
8907
9043
|
} : { reason: "failed" };
|
|
8908
9044
|
}
|
|
8909
|
-
function
|
|
9045
|
+
function ns(e) {
|
|
8910
9046
|
if (e.hangup) {
|
|
8911
|
-
let t =
|
|
9047
|
+
let t = Xo[e.hangup];
|
|
8912
9048
|
return t ? t.type === "semantic" ? e.hangup === D.OBSOLETE_CLIENT && e.custom_error?.vchat_detailed_api_error.code ? {
|
|
8913
9049
|
reason: t.reason,
|
|
8914
9050
|
string_value: e.custom_error.vchat_detailed_api_error.code
|
|
8915
|
-
} : { reason: t.reason } :
|
|
9051
|
+
} : { reason: t.reason } : ts(t, e.callError) : { reason: "failed" };
|
|
8916
9052
|
}
|
|
8917
9053
|
if (e.error) {
|
|
8918
|
-
let t =
|
|
8919
|
-
return t ?
|
|
9054
|
+
let t = Zo[e.error];
|
|
9055
|
+
return t ? ts(t, e.callError) : { reason: "failed" };
|
|
8920
9056
|
}
|
|
8921
9057
|
return { reason: "failed" };
|
|
8922
9058
|
}
|
|
8923
|
-
function
|
|
8924
|
-
return e instanceof O ?
|
|
9059
|
+
function rs(e) {
|
|
9060
|
+
return e instanceof O ? ns(e) : typeof e == "string" && (Jo.has(e) || Yo.has(e)) ? ns(new O(e)) : { reason: "failed" };
|
|
8925
9061
|
}
|
|
8926
9062
|
//#endregion
|
|
8927
9063
|
//#region src/classes/stat/CallLifecycleStats.ts
|
|
8928
|
-
var
|
|
9064
|
+
var is = {
|
|
8929
9065
|
wallNow: () => Date.now(),
|
|
8930
9066
|
monotonicNow: () => performance.now()
|
|
8931
9067
|
};
|
|
8932
|
-
function
|
|
9068
|
+
function as(e) {
|
|
8933
9069
|
return e === "anonym_join" ? "join" : e;
|
|
8934
9070
|
}
|
|
8935
|
-
var
|
|
8936
|
-
constructor(e, t =
|
|
9071
|
+
var os = class {
|
|
9072
|
+
constructor(e, t = is) {
|
|
8937
9073
|
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;
|
|
8938
9074
|
}
|
|
8939
9075
|
get firstMediaSentReported() {
|
|
@@ -8945,7 +9081,7 @@ var Xo = class {
|
|
|
8945
9081
|
markInitializationStarted({ source: e, conversationId: t }) {
|
|
8946
9082
|
if (this._destroyed || this._callStartLabel !== null) return;
|
|
8947
9083
|
let n = this._clock.wallNow();
|
|
8948
|
-
this._callStartLabel =
|
|
9084
|
+
this._callStartLabel = as(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
|
|
8949
9085
|
name: H.CALL_INIT,
|
|
8950
9086
|
source: e
|
|
8951
9087
|
}, n);
|
|
@@ -8973,7 +9109,7 @@ var Xo = class {
|
|
|
8973
9109
|
!this._canRecord() || this._firstMediaSent || (this._firstMediaSent = !0, this._record({ name: H.FIRST_MEDIA_SENT }));
|
|
8974
9110
|
}
|
|
8975
9111
|
markFinished(e) {
|
|
8976
|
-
this._finish(
|
|
9112
|
+
this._finish(rs(e));
|
|
8977
9113
|
}
|
|
8978
9114
|
markTerminated() {
|
|
8979
9115
|
this._finish({ reason: "terminated" });
|
|
@@ -9024,7 +9160,7 @@ var Xo = class {
|
|
|
9024
9160
|
...n && { immediately: !0 }
|
|
9025
9161
|
});
|
|
9026
9162
|
}
|
|
9027
|
-
},
|
|
9163
|
+
}, ss = class {
|
|
9028
9164
|
constructor(e, t) {
|
|
9029
9165
|
h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
|
|
9030
9166
|
}
|
|
@@ -9087,7 +9223,7 @@ var Xo = class {
|
|
|
9087
9223
|
this.report(e);
|
|
9088
9224
|
}), this._codecUsages.clear();
|
|
9089
9225
|
}
|
|
9090
|
-
},
|
|
9226
|
+
}, cs = class {
|
|
9091
9227
|
constructor(e) {
|
|
9092
9228
|
h(this, "_logger", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), h(this, "_lastCallStatContext", null), this._logger = e;
|
|
9093
9229
|
}
|
|
@@ -9120,12 +9256,11 @@ var Xo = class {
|
|
|
9120
9256
|
for (let t of e) this._logEventualStat(t), this._eventualLogs.delete(t);
|
|
9121
9257
|
}
|
|
9122
9258
|
_logEventualStat({ data: e, occurredAt: t }) {
|
|
9123
|
-
this.
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
}, { occurredAt: t });
|
|
9259
|
+
let n = { ...this._lastCallStatContext ?? {} };
|
|
9260
|
+
for (let [t, r] of Object.entries(e)) r !== void 0 && (r === null ? delete n[t] : n[t] = r);
|
|
9261
|
+
this._logger.logClientStats(n, { occurredAt: t });
|
|
9127
9262
|
}
|
|
9128
|
-
},
|
|
9263
|
+
}, ls = class {
|
|
9129
9264
|
constructor(e) {
|
|
9130
9265
|
if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
|
|
9131
9266
|
1,
|
|
@@ -9184,7 +9319,7 @@ var Xo = class {
|
|
|
9184
9319
|
5
|
|
9185
9320
|
];
|
|
9186
9321
|
}
|
|
9187
|
-
},
|
|
9322
|
+
}, us = class {
|
|
9188
9323
|
constructor() {
|
|
9189
9324
|
h(this, "n", 0), h(this, "mean", 0);
|
|
9190
9325
|
}
|
|
@@ -9196,9 +9331,9 @@ var Xo = class {
|
|
|
9196
9331
|
get avg() {
|
|
9197
9332
|
return this.n ? this.mean : NaN;
|
|
9198
9333
|
}
|
|
9199
|
-
},
|
|
9334
|
+
}, ds = class {
|
|
9200
9335
|
constructor() {
|
|
9201
|
-
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new
|
|
9336
|
+
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new us()), h(this, "p50", new ls(.5)), h(this, "p95", new ls(.95));
|
|
9202
9337
|
}
|
|
9203
9338
|
add(e) {
|
|
9204
9339
|
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++;
|
|
@@ -9216,11 +9351,11 @@ var Xo = class {
|
|
|
9216
9351
|
get hasData() {
|
|
9217
9352
|
return this.count > 0;
|
|
9218
9353
|
}
|
|
9219
|
-
},
|
|
9354
|
+
}, fs = class {
|
|
9220
9355
|
constructor(e) {
|
|
9221
9356
|
h(this, "_logger", void 0), h(this, "trackerByTransport", {
|
|
9222
|
-
ws: new
|
|
9223
|
-
wt: new
|
|
9357
|
+
ws: new ds(),
|
|
9358
|
+
wt: new ds()
|
|
9224
9359
|
}), h(this, "lastSeen", {}), this._logger = e;
|
|
9225
9360
|
}
|
|
9226
9361
|
mark(e) {
|
|
@@ -9249,17 +9384,17 @@ var Xo = class {
|
|
|
9249
9384
|
}
|
|
9250
9385
|
destroy() {
|
|
9251
9386
|
this.trackerByTransport = {
|
|
9252
|
-
ws: new
|
|
9253
|
-
wt: new
|
|
9387
|
+
ws: new ds(),
|
|
9388
|
+
wt: new ds()
|
|
9254
9389
|
}, this.lastSeen = {};
|
|
9255
9390
|
}
|
|
9256
|
-
},
|
|
9391
|
+
}, ps = class {
|
|
9257
9392
|
constructor(e) {
|
|
9258
9393
|
h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
|
|
9259
9394
|
}
|
|
9260
9395
|
mark(e, t, n) {
|
|
9261
9396
|
let r = `${e}|${n}`, i;
|
|
9262
|
-
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new
|
|
9397
|
+
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new ds(), this.trackerByCommand.set(r, i)), i.add(t);
|
|
9263
9398
|
}
|
|
9264
9399
|
logMetrics() {
|
|
9265
9400
|
for (let [e, t] of this.trackerByCommand.entries()) {
|
|
@@ -9281,9 +9416,9 @@ var Xo = class {
|
|
|
9281
9416
|
destroy() {
|
|
9282
9417
|
this.trackerByCommand.clear();
|
|
9283
9418
|
}
|
|
9284
|
-
},
|
|
9419
|
+
}, ms = class {
|
|
9285
9420
|
constructor(e, t, n, r) {
|
|
9286
|
-
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), this.logger = new
|
|
9421
|
+
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), this.logger = new Go(e, t, n, r), this.lifecycle = new os(this.logger), this.statAggregator = new cs(this.logger), this.codecStatsAggregator = new ss(this.logger, r), this.pings = new fs(this.logger), this.signalingCommands = new ps(this.logger);
|
|
9287
9422
|
}
|
|
9288
9423
|
logHangup(e) {
|
|
9289
9424
|
this.lifecycle.markFinished(e);
|
|
@@ -9294,7 +9429,7 @@ var Xo = class {
|
|
|
9294
9429
|
destroy() {
|
|
9295
9430
|
this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.logger.destroy();
|
|
9296
9431
|
}
|
|
9297
|
-
},
|
|
9432
|
+
}, hs = class {
|
|
9298
9433
|
constructor(e) {
|
|
9299
9434
|
h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
|
|
9300
9435
|
}
|
|
@@ -9319,8 +9454,8 @@ var Xo = class {
|
|
|
9319
9454
|
call_type: this._callType
|
|
9320
9455
|
}));
|
|
9321
9456
|
}
|
|
9322
|
-
},
|
|
9323
|
-
function
|
|
9457
|
+
}, gs = 1e3, _s = 1e4;
|
|
9458
|
+
function vs(e, t, n, r) {
|
|
9324
9459
|
return new O(e, {
|
|
9325
9460
|
callError: {
|
|
9326
9461
|
scope: "external",
|
|
@@ -9331,11 +9466,11 @@ function cs(e, t, n, r) {
|
|
|
9331
9466
|
message: r
|
|
9332
9467
|
});
|
|
9333
9468
|
}
|
|
9334
|
-
var
|
|
9469
|
+
var ys = 15, $ = class e extends b {
|
|
9335
9470
|
constructor(e, t) {
|
|
9336
|
-
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", Z.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", R.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", kr()), 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, "_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",
|
|
9471
|
+
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", Z.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", R.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", kr()), 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, "_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", wo((e) => {
|
|
9337
9472
|
if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
|
|
9338
|
-
})), h(this, "_toggleLocalAudio",
|
|
9473
|
+
})), h(this, "_toggleLocalAudio", wo((e) => {
|
|
9339
9474
|
if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
|
|
9340
9475
|
})), h(this, "_changeMediaSettings", j.debounce(async (e) => {
|
|
9341
9476
|
if (this._signaling.ready) try {
|
|
@@ -9347,21 +9482,22 @@ var ls = 15, $ = class e extends b {
|
|
|
9347
9482
|
captureAudio: !1
|
|
9348
9483
|
});
|
|
9349
9484
|
}
|
|
9350
|
-
}, 100)), this._stats = new
|
|
9485
|
+
}, 100)), this._stats = new ms(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology), this._api = e, this._signaling = new Ya(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new Lo(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new No({
|
|
9351
9486
|
api: this._api,
|
|
9352
9487
|
debug: this._debug,
|
|
9353
9488
|
getParticipants: () => this._participants,
|
|
9354
9489
|
isMe: (e) => this._isMe(e),
|
|
9355
|
-
updateDisplayLayout: (e) => this.updateDisplayLayout(e)
|
|
9490
|
+
updateDisplayLayout: (e) => this.updateDisplayLayout(e),
|
|
9491
|
+
onNonFatalError: (e) => this._onNonFatalError(e)
|
|
9356
9492
|
}), this._onUnload = () => {
|
|
9357
9493
|
this._stopFirstMediaSentProbe(), this._conversation && this._api && this._sendHangupApi(this._conversation.id, this._state === "IDLE" ? D.CANCELED : D.HUNGUP), this._stats.destroy();
|
|
9358
|
-
}, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new
|
|
9494
|
+
}, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new hs(this._stats.statAggregator), this._audioOutput = new Eo(this._statFirstMediaReceived, M.transparentAudio, this._debug, this._stats.logger), M.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), gs));
|
|
9359
9495
|
}
|
|
9360
9496
|
static current() {
|
|
9361
9497
|
return z.getActive() ?? (M.hold ? null : z.getFirst());
|
|
9362
9498
|
}
|
|
9363
9499
|
static hangupAfterInit(e) {
|
|
9364
|
-
let t =
|
|
9500
|
+
let t = bs;
|
|
9365
9501
|
if (t) {
|
|
9366
9502
|
if (typeof e == "function" && (t._onFastHangup = e), t._delayedHangup === !1 && !t._conversation) {
|
|
9367
9503
|
t._delayedHangup = !0, t._abortController?.abort(new O(D.CANCELED));
|
|
@@ -9389,7 +9525,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9389
9525
|
return this._state === "HELD";
|
|
9390
9526
|
}
|
|
9391
9527
|
get isIncomingRinging() {
|
|
9392
|
-
return this._conversation?.direction ===
|
|
9528
|
+
return this._conversation?.direction === Xa.INCOMING && this._state === "IDLE";
|
|
9393
9529
|
}
|
|
9394
9530
|
static debugSessionId() {
|
|
9395
9531
|
return e.current()?.debugSessionId ?? null;
|
|
@@ -9408,11 +9544,14 @@ var ls = 15, $ = class e extends b {
|
|
|
9408
9544
|
get debugSessionId() {
|
|
9409
9545
|
return this._debug.sessionId;
|
|
9410
9546
|
}
|
|
9411
|
-
|
|
9412
|
-
return this._api.
|
|
9547
|
+
getCachedParticipantIdByExternalId(e) {
|
|
9548
|
+
return this._api.getCachedParticipantIdByExternalId(e);
|
|
9549
|
+
}
|
|
9550
|
+
_onNonFatalError(e) {
|
|
9551
|
+
L.onNonFatalError(Error(e), this.id);
|
|
9413
9552
|
}
|
|
9414
9553
|
getIncomingCallerExternalId() {
|
|
9415
|
-
return this._conversation?.direction ===
|
|
9554
|
+
return this._conversation?.direction === Xa.INCOMING ? Object.values(this._participants).find((e) => !this._isMe(e.id))?.externalId ?? null : null;
|
|
9416
9555
|
}
|
|
9417
9556
|
_buildInternalParams() {
|
|
9418
9557
|
let e = {
|
|
@@ -9422,24 +9561,24 @@ var ls = 15, $ = class e extends b {
|
|
|
9422
9561
|
platform: M.platform,
|
|
9423
9562
|
protocolVersion: M.protocolVersion,
|
|
9424
9563
|
domainId: M.domain,
|
|
9425
|
-
capabilities:
|
|
9564
|
+
capabilities: ja.getFlags()
|
|
9426
9565
|
};
|
|
9427
9566
|
return JSON.stringify(e);
|
|
9428
9567
|
}
|
|
9429
9568
|
async onStart({ opponentIds: e, opponentType: t, mediaOptions: n, payload: r = "", joiningAllowed: i = !1, requireAuthToJoin: a = !1, onlyAdminCanShareMovie: o, externalIds: s, onFastStart: c, conversationId: l }) {
|
|
9430
|
-
let u = l ?? j.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t ===
|
|
9569
|
+
let u = l ?? j.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t === Za.USER && d === 1 ? M.calleeUnavailableWaitingTime : void 0;
|
|
9431
9570
|
this._stats.lifecycle.markInitializationStarted({
|
|
9432
9571
|
source: "outgoing",
|
|
9433
9572
|
conversationId: u
|
|
9434
|
-
}), this._debug.setConversationId(u),
|
|
9573
|
+
}), this._debug.setConversationId(u), bs = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
9435
9574
|
try {
|
|
9436
9575
|
this._mediaSource = this._createMediaSource(), await this._mediaSource.request(n);
|
|
9437
9576
|
let l = this._mediaSource.mediaSettings;
|
|
9438
|
-
t ===
|
|
9577
|
+
t === Za.CHAT || e && e.length > 1 ? this._logWithMediaSettings(C.OUTGOING_MULTIPARTY_CALL, l) : this._logWithMediaSettings(C.OUTGOING_CALL, l);
|
|
9439
9578
|
let d = await this._startConversation({
|
|
9440
9579
|
opponentIds: e,
|
|
9441
9580
|
opponentType: t,
|
|
9442
|
-
direction:
|
|
9581
|
+
direction: Xa.OUTGOING,
|
|
9443
9582
|
mediaOptions: n,
|
|
9444
9583
|
payload: r,
|
|
9445
9584
|
joiningAllowed: i,
|
|
@@ -9463,18 +9602,18 @@ var ls = 15, $ = class e extends b {
|
|
|
9463
9602
|
let e = z.get(this._conversation.id);
|
|
9464
9603
|
e && e !== this && e._close(new O(D.HUNGUP, { remote: !0 }));
|
|
9465
9604
|
}
|
|
9466
|
-
return z.add(this), await z.setActive(this.id),
|
|
9605
|
+
return z.add(this), await z.setActive(this.id), bs = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
|
|
9467
9606
|
this._calleeUnavailableTimer = null, this._close(new O(D.CALLEE_UNAVAILABLE), { signalingReason: D.CANCELED });
|
|
9468
9607
|
}, f)), this._conversation;
|
|
9469
9608
|
} catch (e) {
|
|
9470
|
-
throw
|
|
9609
|
+
throw bs = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to start conversation" }), e;
|
|
9471
9610
|
}
|
|
9472
9611
|
}
|
|
9473
9612
|
async onJoin(e) {
|
|
9474
9613
|
this._stats.lifecycle.markInitializationStarted({
|
|
9475
9614
|
source: e.anonymous ? "anonym_join" : "join",
|
|
9476
9615
|
conversationId: e.conversationId
|
|
9477
|
-
}),
|
|
9616
|
+
}), bs = 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);
|
|
9478
9617
|
try {
|
|
9479
9618
|
let t = !!e.observedIds?.length;
|
|
9480
9619
|
if (t && M.videoTracksCount > 0) throw this._debug.error("Observer mode: please set videoTracksCount=0"), new O(D.UNSUPPORTED, { callError: {
|
|
@@ -9491,9 +9630,9 @@ var ls = 15, $ = class e extends b {
|
|
|
9491
9630
|
code: "conversation",
|
|
9492
9631
|
description: "not-initialized-after-join"
|
|
9493
9632
|
} });
|
|
9494
|
-
return this._conversation.observer = t, L.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"), z.add(this),
|
|
9633
|
+
return this._conversation.observer = t, L.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"), z.add(this), bs = null, this._signaling.readyToSend(), L.onLocalStatus(this._conversation.waitForAdmin ? N.WAIT_FOR_ADMIN : N.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(r);
|
|
9495
9634
|
} catch (e) {
|
|
9496
|
-
throw
|
|
9635
|
+
throw bs = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
9497
9636
|
}
|
|
9498
9637
|
}
|
|
9499
9638
|
async _onJoinPart2(e, t = !0, n = !1) {
|
|
@@ -9508,7 +9647,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9508
9647
|
if (this._delayedHangup) throw new O(D.CANCELED);
|
|
9509
9648
|
this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
|
|
9510
9649
|
let r = this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
|
|
9511
|
-
L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (z.add(this), n ? await this._holdLocally() : await z.setActive(this.id),
|
|
9650
|
+
L.onConversation(this._conversation.externalId, this._conversation.mediaModifiers, this._getMuteStatesForCurrentRoom(), this._getMainRoomParticipants(), r, this.id), this._onConversationParticipantListChunk(e), this._processPinnedParticipants(e), L.onLocalStatus(N.WAITING, this.id), this._toggleJoinAvailability(), this._changeNeedRate(), t && (this._state = "ACTIVE"), this._changeFeatureSet(), t && (z.add(this), n ? await this._holdLocally() : await z.setActive(this.id), bs = null);
|
|
9512
9651
|
let i = this._extractLocalParticipantFromConnection(e);
|
|
9513
9652
|
if (i) {
|
|
9514
9653
|
let e = j.mapParticipantState(i);
|
|
@@ -9516,11 +9655,15 @@ var ls = 15, $ = class e extends b {
|
|
|
9516
9655
|
}
|
|
9517
9656
|
return t && this._openTransport(Object.values(this._participants), !1), this._conversation;
|
|
9518
9657
|
} catch (e) {
|
|
9519
|
-
throw
|
|
9658
|
+
throw bs = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
9520
9659
|
}
|
|
9521
9660
|
}
|
|
9522
9661
|
_extractExternalRooms(e) {
|
|
9523
|
-
|
|
9662
|
+
let t = [], n = [];
|
|
9663
|
+
return e.forEach((e) => {
|
|
9664
|
+
let { room: r, missingParticipantIds: i } = this._convertRoomToExternal(e);
|
|
9665
|
+
r && n.push(r), t.push(...i);
|
|
9666
|
+
}), this._reportMissingExternalIds(t, "EXTRACT_EXTERNAL_ROOMS"), n.filter((e) => !!e);
|
|
9524
9667
|
}
|
|
9525
9668
|
_extractExternalRoomsData(e, t) {
|
|
9526
9669
|
if (!e || !e.length) return;
|
|
@@ -9532,7 +9675,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9532
9675
|
z.reserve(e), this._reservedId = e, this._stats.lifecycle.markInitializationStarted({
|
|
9533
9676
|
source: "incoming",
|
|
9534
9677
|
conversationId: e
|
|
9535
|
-
}), this._debug.setConversationId(e),
|
|
9678
|
+
}), this._debug.setConversationId(e), bs = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal), a && this._api.setUserId(a);
|
|
9536
9679
|
try {
|
|
9537
9680
|
let a = await this._prepareConversation(e, t, n, r, i);
|
|
9538
9681
|
if (this._mediaSource = this._createMediaSource(), !this._conversation) throw new O(D.UNKNOWN_ERROR, { callError: {
|
|
@@ -9541,20 +9684,20 @@ var ls = 15, $ = class e extends b {
|
|
|
9541
9684
|
description: "incoming-not-initialized"
|
|
9542
9685
|
} });
|
|
9543
9686
|
if (!a.conversation.participants.find((e) => e.state === Z.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 O(D.REJECTED);
|
|
9544
|
-
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"), z.add(this),
|
|
9687
|
+
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"), z.add(this), bs = null, this._delayedHangup) throw new O(D.CANCELED);
|
|
9545
9688
|
} catch (e) {
|
|
9546
|
-
throw
|
|
9689
|
+
throw bs = null, this._cleanupRegistry(), this._close(e, {
|
|
9547
9690
|
errorText: "Unable to handle inbound call push",
|
|
9548
9691
|
signalingReason: e instanceof O && e.hangup === D.BUSY ? D.BUSY : void 0
|
|
9549
9692
|
}), e;
|
|
9550
9693
|
}
|
|
9551
9694
|
}
|
|
9552
9695
|
_isInWaitingHall(e) {
|
|
9553
|
-
return !e.conversation || !e.conversation.options.includes(
|
|
9696
|
+
return !e.conversation || !e.conversation.options.includes(eo.WAITING_HALL) ? !1 : this._isRestricted(e);
|
|
9554
9697
|
}
|
|
9555
9698
|
_isWaitForAdmin(e) {
|
|
9556
9699
|
if (!e.conversation) return !1;
|
|
9557
|
-
let t = e.conversation.options.includes(
|
|
9700
|
+
let t = e.conversation.options.includes(eo.WAIT_FOR_ADMIN), n = e.conversation.options.includes(eo.ADMIN_IS_HERE);
|
|
9558
9701
|
return !t || t && n ? !1 : this._isRestricted(e);
|
|
9559
9702
|
}
|
|
9560
9703
|
_isRestricted(e) {
|
|
@@ -9562,7 +9705,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9562
9705
|
return t && t.restricted || !1;
|
|
9563
9706
|
}
|
|
9564
9707
|
_isAudienceMode(e) {
|
|
9565
|
-
return e.conversation?.options?.includes(
|
|
9708
|
+
return e.conversation?.options?.includes(eo.AUDIENCE_MODE) || !1;
|
|
9566
9709
|
}
|
|
9567
9710
|
_isAudienceModeListener() {
|
|
9568
9711
|
return this._conversation?.audienceMode && this._conversation?.restricted;
|
|
@@ -9592,7 +9735,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9592
9735
|
let i = atob(n), a = new Uint8Array(i.length);
|
|
9593
9736
|
for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
|
|
9594
9737
|
try {
|
|
9595
|
-
let e =
|
|
9738
|
+
let e = Co(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);
|
|
9596
9739
|
return {
|
|
9597
9740
|
token: i,
|
|
9598
9741
|
endpoint: l,
|
|
@@ -9795,10 +9938,10 @@ var ls = 15, $ = class e extends b {
|
|
|
9795
9938
|
let t = await this._api.getConversationParams(e);
|
|
9796
9939
|
this._debug.debug("Api.getConversationParams", t);
|
|
9797
9940
|
let { turn_server: n, stun_server: r } = t;
|
|
9798
|
-
return M.iceServers =
|
|
9941
|
+
return M.iceServers = So(r, n), M.wssBase = t.endpoint, t.wt_endpoint && (M.wtsBase = t.wt_endpoint), M.wssToken = t.token, t.client_type && (M.clientType = t.client_type), t.external_user_type && (M.externalUserType = t.external_user_type), t;
|
|
9799
9942
|
}
|
|
9800
9943
|
_setConversationParams({ turn_server: e, stun_server: t, endpoint: n, wt_endpoint: r, token: i, client_type: a }) {
|
|
9801
|
-
M.iceServers =
|
|
9944
|
+
M.iceServers = So(t, e), M.wssBase = n, M.wssToken = i, r && (M.wtsBase = r), a && (M.clientType = a);
|
|
9802
9945
|
}
|
|
9803
9946
|
_buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
|
|
9804
9947
|
let s = new URL(e), c = s.searchParams;
|
|
@@ -9830,10 +9973,10 @@ var ls = 15, $ = class e extends b {
|
|
|
9830
9973
|
isVideo: f,
|
|
9831
9974
|
joiningAllowed: a,
|
|
9832
9975
|
requireAuthToJoin: o
|
|
9833
|
-
}, this._abortController?.signal), !e) throw
|
|
9976
|
+
}, this._abortController?.signal), !e) throw vs(D.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
|
|
9834
9977
|
if (!e.internalCallerParams) {
|
|
9835
9978
|
let t = e.rejectedParticipants[0]?.status;
|
|
9836
|
-
throw
|
|
9979
|
+
throw vs(D.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
|
|
9837
9980
|
}
|
|
9838
9981
|
} catch (e) {
|
|
9839
9982
|
throw this._delayedHangup && this._abortController?.signal.aborted ? new O(D.CANCELED) : e instanceof O ? e : e instanceof Error ? new O(D.FAST_START_ERROR, { message: e.message }) : new O(D.FAST_START_ERROR, { message: String(e) });
|
|
@@ -9855,10 +9998,10 @@ var ls = 15, $ = class e extends b {
|
|
|
9855
9998
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
9856
9999
|
}, this._debug.debug("FastStart", p), m = "fastStart";
|
|
9857
10000
|
} catch {
|
|
9858
|
-
throw
|
|
10001
|
+
throw vs(D.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
|
|
9859
10002
|
}
|
|
9860
10003
|
} else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
|
|
9861
|
-
|
|
10004
|
+
Do(p, m), this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
|
|
9862
10005
|
let ee = await this._connectSignaling(vr.START, p);
|
|
9863
10006
|
return this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
|
|
9864
10007
|
}
|
|
@@ -9883,9 +10026,9 @@ var ls = 15, $ = class e extends b {
|
|
|
9883
10026
|
joinLink: i,
|
|
9884
10027
|
isVideo: c,
|
|
9885
10028
|
internalParams: this._buildInternalParams()
|
|
9886
|
-
}, this._abortController?.signal), !e) throw
|
|
9887
|
-
if (!e.internalCallerParams) throw
|
|
9888
|
-
if (!e.conversationId) throw
|
|
10029
|
+
}, this._abortController?.signal), !e) throw vs(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
|
|
10030
|
+
if (!e.internalCallerParams) throw vs(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
|
|
10031
|
+
if (!e.conversationId) throw vs(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
|
|
9889
10032
|
} catch (e) {
|
|
9890
10033
|
throw this._delayedHangup && this._abortController?.signal.aborted ? new O(D.CANCELED) : e instanceof O ? e : e instanceof Error ? new O(D.FAST_JOIN_ERROR, { message: e.message }) : new O(D.FAST_JOIN_ERROR, { message: String(e) });
|
|
9891
10034
|
}
|
|
@@ -9903,7 +10046,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9903
10046
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
9904
10047
|
}, this._debug.debug("FastJoin", l), u = "fastJoin";
|
|
9905
10048
|
} catch (e) {
|
|
9906
|
-
throw e instanceof O ? e :
|
|
10049
|
+
throw e instanceof O ? e : vs(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
|
|
9907
10050
|
}
|
|
9908
10051
|
} else if (t) l = await this._api.joinConversation(t, c, r), u = "joinConversation";
|
|
9909
10052
|
else if (i) l = await this._api.joinConversationByLink(i, c, a, o), u = "joinConversationByLink";
|
|
@@ -9912,13 +10055,13 @@ var ls = 15, $ = class e extends b {
|
|
|
9912
10055
|
code: "join",
|
|
9913
10056
|
description: "target-missing"
|
|
9914
10057
|
} });
|
|
9915
|
-
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id),
|
|
10058
|
+
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), Do(l, u), l.id) {
|
|
9916
10059
|
if (z.has(l.id)) throw new O(D.HAS_ACTIVE_CALL);
|
|
9917
10060
|
z.reserve(l.id), this._reservedId = l.id;
|
|
9918
10061
|
}
|
|
9919
10062
|
this._setConversationParams(l);
|
|
9920
10063
|
let d = await this._connectSignaling(vr.JOIN, l);
|
|
9921
|
-
return this._setConversation(l, d,
|
|
10064
|
+
return this._setConversation(l, d, Xa.JOINING), this._stats.lifecycle.markCallStarted(), d;
|
|
9922
10065
|
}
|
|
9923
10066
|
async _prepareConversation(e, t = A.USER, n, r, i) {
|
|
9924
10067
|
W.setMark(H.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
|
|
@@ -9980,7 +10123,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9980
10123
|
}), l.wt_endpoint = c);
|
|
9981
10124
|
}
|
|
9982
10125
|
let u = await this._connectSignaling(vr.ACCEPT, l);
|
|
9983
|
-
return z.callsLength >= M.maxParallelCalls || !M.hold && z.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(C.PUSH, "busy"), Promise.reject(new O(D.BUSY))) : (this._setConversation(l, u,
|
|
10126
|
+
return z.callsLength >= M.maxParallelCalls || !M.hold && z.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(C.PUSH, "busy"), Promise.reject(new O(D.BUSY))) : (this._setConversation(l, u, Xa.INCOMING, t), u);
|
|
9984
10127
|
}
|
|
9985
10128
|
_createParticipant(e, t, n = !0) {
|
|
9986
10129
|
let r = Object.assign({
|
|
@@ -10003,19 +10146,17 @@ var ls = 15, $ = class e extends b {
|
|
|
10003
10146
|
isInRoom: !1,
|
|
10004
10147
|
markers: null
|
|
10005
10148
|
}, e), i = !!r.externalId;
|
|
10006
|
-
|
|
10149
|
+
if (!i) {
|
|
10150
|
+
let e = this._getParticipantId(t ?? r.id);
|
|
10151
|
+
e && (r.externalId = e);
|
|
10152
|
+
}
|
|
10153
|
+
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 = uo.create(r.connectionStatus), r;
|
|
10007
10154
|
}
|
|
10008
10155
|
_getParticipantId(e) {
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
}
|
|
10012
|
-
|
|
10013
|
-
scope: "network",
|
|
10014
|
-
source: "api",
|
|
10015
|
-
code: "fetch-failed",
|
|
10016
|
-
description: "request-failed"
|
|
10017
|
-
} }), { errorText: e }), e;
|
|
10018
|
-
}
|
|
10156
|
+
let t = this._api.userId(e);
|
|
10157
|
+
if (t) return t;
|
|
10158
|
+
let { compositeUserId: n, deviceIdx: r } = j.decomposeParticipantId(e), { id: i, type: a } = j.decomposeId(n);
|
|
10159
|
+
return a === A.GROUP ? Q.fromId(String(i), void 0, r) : null;
|
|
10019
10160
|
}
|
|
10020
10161
|
_cacheParticipantExternalIds(e) {
|
|
10021
10162
|
e.forEach((e) => {
|
|
@@ -10023,7 +10164,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10023
10164
|
if (n) {
|
|
10024
10165
|
this._api.cacheExternalId(t, n);
|
|
10025
10166
|
let r = j.composeDecorativeId(e), i = Q.fromSignalingParticipant(e);
|
|
10026
|
-
r && i && (this._api.cacheExternalId(r, i), this._api.mapDecorativeId(
|
|
10167
|
+
r && i && (this._api.cacheExternalId(r, i), this._api.mapDecorativeId(r, t));
|
|
10027
10168
|
}
|
|
10028
10169
|
});
|
|
10029
10170
|
}
|
|
@@ -10088,7 +10229,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10088
10229
|
}
|
|
10089
10230
|
_createMediaSource() {
|
|
10090
10231
|
let e = new Yt(this._debug, this._stats.logger);
|
|
10091
|
-
return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new
|
|
10232
|
+
return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new To(e, this._debug, this._stats.logger), e;
|
|
10092
10233
|
}
|
|
10093
10234
|
async _connectSignaling(e, t) {
|
|
10094
10235
|
this._signaling.setEndpoint(t.endpoint), this._signaling.setWebTransportEndpoint(t.wt_endpoint ? t.wt_endpoint : null), this.subscribe(this._signaling, G.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, G.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, G.RECONNECT, this._onSignalingReconnect.bind(this));
|
|
@@ -10096,7 +10237,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10096
10237
|
return this._stats.statAggregator.logEventualStat({ name: H.SIGNALING_CONNECTED }), n;
|
|
10097
10238
|
}
|
|
10098
10239
|
async _processConnection(e) {
|
|
10099
|
-
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(
|
|
10240
|
+
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(Qa.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
|
|
10100
10241
|
}
|
|
10101
10242
|
_onConversationParticipantListChunk(e) {
|
|
10102
10243
|
let t = e.participants;
|
|
@@ -10165,7 +10306,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10165
10306
|
_registerParticipantLocalMuteState({ muteStates: e, unmuteOptions: t }) {
|
|
10166
10307
|
if (!e) return;
|
|
10167
10308
|
let n = async () => {
|
|
10168
|
-
let n =
|
|
10309
|
+
let n = ho(e, ro.MUTE), r = ho(e, ro.MUTE_PERMANENT);
|
|
10169
10310
|
for (let i of [n, r]) i.length && await this._onMuteParticipant({
|
|
10170
10311
|
muteStates: e,
|
|
10171
10312
|
unmuteOptions: t,
|
|
@@ -10179,8 +10320,8 @@ var ls = 15, $ = class e extends b {
|
|
|
10179
10320
|
if (!(!M.enableSessionStateUpdates || this._isMe(e))) return t;
|
|
10180
10321
|
}
|
|
10181
10322
|
_buildConnectionStatus(e, t, n, r = !1) {
|
|
10182
|
-
return
|
|
10183
|
-
transport: r ? N.ONHOLD :
|
|
10323
|
+
return uo.create({
|
|
10324
|
+
transport: r ? N.ONHOLD : uo.fromTransportState(n) ?? N.WAITING,
|
|
10184
10325
|
sessionState: this._remoteParticipantSessionState(e, t),
|
|
10185
10326
|
sessionStateApplicable: this._isParticipantSessionStateApplicable(e)
|
|
10186
10327
|
});
|
|
@@ -10189,12 +10330,12 @@ var ls = 15, $ = class e extends b {
|
|
|
10189
10330
|
return M.enableSessionStateUpdates && !this._isMe(e) && this._conversation?.topology === J.SERVER;
|
|
10190
10331
|
}
|
|
10191
10332
|
_setTransportStatus(e, t) {
|
|
10192
|
-
return
|
|
10333
|
+
return uo.setTransport(e.connectionStatus, t);
|
|
10193
10334
|
}
|
|
10194
10335
|
_setSessionState(e, t) {
|
|
10195
|
-
let n =
|
|
10336
|
+
let n = uo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
10196
10337
|
this._emitParticipantTransition(e, n);
|
|
10197
|
-
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === N.CONNECTED, i =
|
|
10338
|
+
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === N.CONNECTED, i = uo.setSessionState(e.connectionStatus, t, r);
|
|
10198
10339
|
return this._emitParticipantTransition(e, i), i;
|
|
10199
10340
|
}
|
|
10200
10341
|
_emitParticipantTransition(e, t, n = null) {
|
|
@@ -10206,33 +10347,40 @@ var ls = 15, $ = class e extends b {
|
|
|
10206
10347
|
_getExistedParticipantByIdOrCreate(e) {
|
|
10207
10348
|
let t = this._participants[e];
|
|
10208
10349
|
if (t) return t;
|
|
10209
|
-
let n = this._api.getDecorativeIdByInitialId(
|
|
10350
|
+
let n = this._api.getDecorativeIdByInitialId(e), r = this._getParticipantId(e), { deviceIdx: i } = j.decomposeParticipantId(e);
|
|
10210
10351
|
return this._createParticipant({
|
|
10211
10352
|
id: e,
|
|
10212
|
-
externalId: {
|
|
10213
|
-
...
|
|
10214
|
-
deviceIdx:
|
|
10215
|
-
}
|
|
10216
|
-
},
|
|
10353
|
+
externalId: r ? {
|
|
10354
|
+
...r,
|
|
10355
|
+
deviceIdx: i
|
|
10356
|
+
} : void 0
|
|
10357
|
+
}, n, !1);
|
|
10217
10358
|
}
|
|
10218
10359
|
_getExternalIdByParticipantId(e) {
|
|
10219
|
-
if (this._isMe(e)) return this._conversation?.externalId;
|
|
10360
|
+
if (this._isMe(e)) return this._conversation?.externalId ?? null;
|
|
10220
10361
|
if (M.useParticipantListChunk) return this._getExistedParticipantByIdOrCreate(e).externalId;
|
|
10221
10362
|
let t = this._participants;
|
|
10222
10363
|
if (t[e]?.externalId) return t[e].externalId;
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10364
|
+
let n = this._api.getCachedExternalIdByParticipantId(e);
|
|
10365
|
+
if (n) return n;
|
|
10366
|
+
let r = this._getParticipantId(e);
|
|
10367
|
+
return r && this._api.cacheExternalId(e, r), r;
|
|
10227
10368
|
}
|
|
10228
|
-
|
|
10229
|
-
|
|
10369
|
+
_getExternalIdsByParticipantIds(e) {
|
|
10370
|
+
let t = [], n = [];
|
|
10371
|
+
return e.forEach((e) => {
|
|
10372
|
+
let r = this._getExternalIdByParticipantId(e);
|
|
10373
|
+
r ? t.push(r) : n.push(e);
|
|
10374
|
+
}), {
|
|
10375
|
+
externalIds: t,
|
|
10376
|
+
missingIds: n
|
|
10377
|
+
};
|
|
10230
10378
|
}
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
10379
|
+
_reportMissingExternalIds(e, t) {
|
|
10380
|
+
e.length && this._onNonFatalError(`External ID mapping not found for participants "${Array.from(new Set(e)).join("\", \"")}" while handling ${t}`);
|
|
10381
|
+
}
|
|
10382
|
+
_reportMissingExternalIdsById(e, t) {
|
|
10383
|
+
e.length && this._onNonFatalError(`Participant ID mapping not found for external IDs "${Array.from(new Set(e)).join("\", \"")}" while handling ${t}`);
|
|
10236
10384
|
}
|
|
10237
10385
|
_registerParticipantAndSetMarkersIfChunkEnabled(e, t) {
|
|
10238
10386
|
if (M.useParticipantListChunk) {
|
|
@@ -10258,11 +10406,11 @@ var ls = 15, $ = class e extends b {
|
|
|
10258
10406
|
this._onRoomSwitched(t, !0);
|
|
10259
10407
|
}
|
|
10260
10408
|
_processMuteStates(e, t = !1) {
|
|
10261
|
-
let n =
|
|
10409
|
+
let n = go(e);
|
|
10262
10410
|
this._setMuteStatesForRoomId(n, null);
|
|
10263
10411
|
for (let t of e.rooms?.rooms ?? []) this._setMuteStatesForRoomId(t.muteStates, t.id);
|
|
10264
10412
|
let r = this._getMuteStatesForCurrentRoom();
|
|
10265
|
-
t && (r =
|
|
10413
|
+
t && (r = bo(e, r));
|
|
10266
10414
|
let i = Object.keys(r), a = this._conversation?.roomId;
|
|
10267
10415
|
i.length && this._onMuteParticipant({
|
|
10268
10416
|
muteStates: r,
|
|
@@ -10282,15 +10430,15 @@ var ls = 15, $ = class e extends b {
|
|
|
10282
10430
|
}
|
|
10283
10431
|
_allocateTransport() {
|
|
10284
10432
|
if (!this._conversation || !this._mediaSource) return;
|
|
10285
|
-
this._transport = new
|
|
10286
|
-
let e = this._conversation.direction ===
|
|
10433
|
+
this._transport = new ya(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 Mo(this._debug), this.subscribe(this._transport, X.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, X.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, X.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, X.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, X.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, X.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, X.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, X.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, X.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, X.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, X.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, X.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, X.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, X.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
|
|
10434
|
+
let e = this._conversation.direction === Xa.OUTGOING && !this._conversation.concurrent, t = this._participants;
|
|
10287
10435
|
for (let n of Object.values(t)) (n.state === Z.ACCEPTED || n.state === Z.CALLED) && this._allocateParticipantTransport(n.id, e);
|
|
10288
10436
|
}
|
|
10289
10437
|
_createSpeakerDetector() {
|
|
10290
|
-
this._transport && this._conversation && (this._volumesDetector = new
|
|
10438
|
+
this._transport && this._conversation && (this._volumesDetector = new zo(this._transport), this.subscribe(this._volumesDetector, Ro.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new Vo(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, Bo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new Io(this._mediaSource));
|
|
10291
10439
|
}
|
|
10292
10440
|
_createSpecListener() {
|
|
10293
|
-
this._transport && this._volumesDetector && (this._specListener = new
|
|
10441
|
+
this._transport && this._volumesDetector && (this._specListener = new Wo(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
|
|
10294
10442
|
}
|
|
10295
10443
|
_logDevices() {
|
|
10296
10444
|
let e = T.getCameras().length, t = T.getMicrophones().length;
|
|
@@ -10389,7 +10537,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10389
10537
|
_onRemoveParticipant(e) {
|
|
10390
10538
|
this._debug.debug(`Remove participant [${e}]`);
|
|
10391
10539
|
let t = [], n = this._participants;
|
|
10392
|
-
for (let r = 0; r <=
|
|
10540
|
+
for (let r = 0; r <= ys; r++) {
|
|
10393
10541
|
let i = n[j.compose(e, r)];
|
|
10394
10542
|
i && t.push(i);
|
|
10395
10543
|
}
|
|
@@ -10479,11 +10627,11 @@ var ls = 15, $ = class e extends b {
|
|
|
10479
10627
|
this._waitingHallHoldPending = !1, await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus()), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener();
|
|
10480
10628
|
return;
|
|
10481
10629
|
}
|
|
10482
|
-
let n =
|
|
10630
|
+
let n = ka.get();
|
|
10483
10631
|
await this._signaling.hold(!1, n), this._restoreStateAfterHold();
|
|
10484
10632
|
let r = null;
|
|
10485
10633
|
if (this._state === "IDLE" && this._participantState === Z.ACCEPTED && (r = Object.values(this._participants), r.some((e) => e.state === Z.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._resumeLocalMedia(t, N.WAITING), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._state === "ACTIVE") {
|
|
10486
|
-
let e = this._conversation?.direction ===
|
|
10634
|
+
let e = this._conversation?.direction === Xa.OUTGOING && !this._conversation.concurrent;
|
|
10487
10635
|
this._openTransport(r ?? Object.values(this._participants), e);
|
|
10488
10636
|
}
|
|
10489
10637
|
}
|
|
@@ -10517,30 +10665,34 @@ var ls = 15, $ = class e extends b {
|
|
|
10517
10665
|
async updateDisplayLayout(e) {
|
|
10518
10666
|
if (e.length < 1 || !this._signaling.ready) return;
|
|
10519
10667
|
this._debug.log(`Update display layout request [${this._signaling.getNextCommandSequenceNumber()}]`, e);
|
|
10520
|
-
let t = {}, n = [], r = this._participants;
|
|
10521
|
-
for (let
|
|
10522
|
-
let e = typeof
|
|
10523
|
-
if (!
|
|
10668
|
+
let t = {}, n = [], r = [], i = this._participants;
|
|
10669
|
+
for (let a of e) {
|
|
10670
|
+
let e = typeof a.uid == "object" ? a.uid : Q.fromId(a.uid), o = this._api.getCachedParticipantIdByExternalId(e);
|
|
10671
|
+
if (!o) {
|
|
10524
10672
|
let t = Q.toString(e);
|
|
10525
|
-
this._debug.log(`Unknown participant external ID ${t}`);
|
|
10673
|
+
this._debug.log(`Unknown participant external ID ${t}`), r.push(e.id);
|
|
10526
10674
|
continue;
|
|
10527
10675
|
}
|
|
10528
|
-
let
|
|
10529
|
-
participantId:
|
|
10530
|
-
mediaType:
|
|
10531
|
-
streamName:
|
|
10532
|
-
}),
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
}) : this._isMe(
|
|
10536
|
-
this._myLastRequestedLayouts[
|
|
10537
|
-
}), Dn(
|
|
10538
|
-
delete this._myLastRequestedLayouts[
|
|
10539
|
-
}), this._streamIdByStreamDescription.has(
|
|
10540
|
-
}
|
|
10541
|
-
|
|
10676
|
+
let s = Mn({
|
|
10677
|
+
participantId: o,
|
|
10678
|
+
mediaType: a.mediaType,
|
|
10679
|
+
streamName: a.streamName
|
|
10680
|
+
}), c = i[o];
|
|
10681
|
+
c ? n.push(() => {
|
|
10682
|
+
c.lastRequestedLayouts[s] = a;
|
|
10683
|
+
}) : this._isMe(o) && n.push(() => {
|
|
10684
|
+
this._myLastRequestedLayouts[s] = a;
|
|
10685
|
+
}), Dn(a) ? (this._isMe(o) && n.push(() => {
|
|
10686
|
+
delete this._myLastRequestedLayouts[s];
|
|
10687
|
+
}), this._streamIdByStreamDescription.has(s) && !this._cooldownTimestampByStreamDescription.has(s) && this._cooldownTimestampByStreamDescription.set(s, Date.now())) : (this._cooldownTimestampByStreamDescription.delete(s), !this._streamIdByStreamDescription.has(s) && M.videoTracksCount > 0 && this._streamIdByStreamDescription.set(s, null), t[s] = a), a.mediaType === V.SCREEN && !Dn(a) && W.setMark(W.getMarkNameScreenshareFirstFrame(o));
|
|
10688
|
+
}
|
|
10689
|
+
if (r.length) {
|
|
10690
|
+
this._reportMissingExternalIdsById(r, "updateDisplayLayout");
|
|
10691
|
+
return;
|
|
10692
|
+
}
|
|
10693
|
+
let a = this._cooldownTimestampByStreamDescription.keys();
|
|
10542
10694
|
for (; this._streamIdByStreamDescription.size > M.videoTracksCount;) {
|
|
10543
|
-
let e =
|
|
10695
|
+
let e = a.next();
|
|
10544
10696
|
if (e.done) {
|
|
10545
10697
|
this._debug.error("Cannot accommodate all streaming requests: tracks available " + M.videoTracksCount + "; requested streams: " + Array.from(this._streamIdByStreamDescription.keys()));
|
|
10546
10698
|
break;
|
|
@@ -10602,13 +10754,13 @@ var ls = 15, $ = class e extends b {
|
|
|
10602
10754
|
let n = Nn(e), a = i[n.participantId];
|
|
10603
10755
|
if (a) {
|
|
10604
10756
|
let e;
|
|
10605
|
-
typeof t == "number" ? e =
|
|
10757
|
+
typeof t == "number" ? e = oo(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = ao.UNKNOWN_ERROR), r.push({
|
|
10606
10758
|
externalId: a.externalId,
|
|
10607
10759
|
errorReason: e
|
|
10608
10760
|
});
|
|
10609
10761
|
}
|
|
10610
10762
|
}
|
|
10611
|
-
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new
|
|
10763
|
+
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new xs("Could not allocate one or more participants", r);
|
|
10612
10764
|
}
|
|
10613
10765
|
async _cleanupCooldownQueue() {
|
|
10614
10766
|
let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
|
|
@@ -10616,7 +10768,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10616
10768
|
let n = t.next();
|
|
10617
10769
|
if (n.done) break;
|
|
10618
10770
|
let r = n.value;
|
|
10619
|
-
if (r[1] +
|
|
10771
|
+
if (r[1] + _s > Date.now()) break;
|
|
10620
10772
|
let i = r[0];
|
|
10621
10773
|
await this._stopStreaming(i), e[i] = { stopStream: !0 };
|
|
10622
10774
|
} while (!0);
|
|
@@ -10632,17 +10784,22 @@ var ls = 15, $ = class e extends b {
|
|
|
10632
10784
|
async _onParticipantPromoted(e) {
|
|
10633
10785
|
this._conversation && this._conversation.audienceMode ? (this._debug.log("Promoted in audience mode", !e.demote), this._conversation.restricted = e.demote, this._processRecordInfos(e), !e.demote && this._mediaSource && this._changeMediaSettings(this._mediaSource.mediaSettings)) : (this._debug.log("Promoted in waiting hall", !e.demote), e.demote ? (this._debug.log("Kicked from waiting hall"), this._close(new O(D.REMOVED))) : (this._updateConversation(e), this._waitingHallHoldPending ? (await this._signaling.hold(!0), await this._onJoinPart2(e, !1), this._waitingHallHoldPending = !1) : z.getActive() && M.hold ? (await this._signaling.hold(!0), await this._onJoinPart2(e, !0, !0), this._waitingHallHoldPending = !1) : await this._onJoinPart2(e))), L.onPromoted(e.demote, this.id);
|
|
10634
10786
|
}
|
|
10635
|
-
|
|
10787
|
+
_onChatRoomUpdated(e, t = 0, n = [], r, i) {
|
|
10636
10788
|
this._debug.log(`Chat room updated: ${e}`);
|
|
10637
|
-
let a = [];
|
|
10789
|
+
let a = [], o = [];
|
|
10638
10790
|
n.length && n.forEach((e) => {
|
|
10639
10791
|
if (e.externalId) {
|
|
10640
10792
|
let t = Q.fromSignaling(e.externalId);
|
|
10641
10793
|
a.push(t), this._api.cacheExternalId(e.id.id, t);
|
|
10642
|
-
} else
|
|
10794
|
+
} else {
|
|
10795
|
+
let t = this._getExternalIdByParticipantId(e.id.id);
|
|
10796
|
+
t ? a.push(t) : o.push(e.id.id);
|
|
10797
|
+
}
|
|
10643
10798
|
});
|
|
10644
|
-
let
|
|
10645
|
-
|
|
10799
|
+
let { externalIds: s, missingIds: c } = this._getExternalIdsByParticipantIds(r ?? []);
|
|
10800
|
+
o.push(...c);
|
|
10801
|
+
let { externalIds: l, missingIds: u } = this._getExternalIdsByParticipantIds(i ?? []);
|
|
10802
|
+
o.push(...u), this._reportMissingExternalIds(o, "CHAT_ROOM_UPDATED"), L.onChatRoomUpdated(e, t, a, s, l, this.id);
|
|
10646
10803
|
}
|
|
10647
10804
|
_onSharedMovieUpdate(e) {
|
|
10648
10805
|
let t = this._conversation?.externalId;
|
|
@@ -10815,10 +10972,10 @@ var ls = 15, $ = class e extends b {
|
|
|
10815
10972
|
throw Error("transport is not initialized");
|
|
10816
10973
|
}
|
|
10817
10974
|
_isCallAdmin() {
|
|
10818
|
-
return this._conversation ? j.includesOneOf(this._conversation.roles, [
|
|
10975
|
+
return this._conversation ? j.includesOneOf(this._conversation.roles, [so.ADMIN, so.CREATOR]) : !1;
|
|
10819
10976
|
}
|
|
10820
10977
|
_checkAdminRole() {
|
|
10821
|
-
if (this._conversation && !j.includesOneOf(this._conversation.roles, [
|
|
10978
|
+
if (this._conversation && !j.includesOneOf(this._conversation.roles, [so.ADMIN, so.CREATOR])) throw Error("You don't have the required permission");
|
|
10822
10979
|
}
|
|
10823
10980
|
_isCalledState() {
|
|
10824
10981
|
return this._participantState === Z.CALLED;
|
|
@@ -10856,43 +11013,46 @@ var ls = 15, $ = class e extends b {
|
|
|
10856
11013
|
async changeOptions(e) {
|
|
10857
11014
|
if (this._signaling.ready && this._conversation) {
|
|
10858
11015
|
this._checkAdminRole(), await this._signaling.changeOptions(e);
|
|
10859
|
-
let t =
|
|
11016
|
+
let t = no(this._conversation.options, e);
|
|
10860
11017
|
this._onOptionsChanged(t);
|
|
10861
11018
|
}
|
|
10862
11019
|
}
|
|
10863
11020
|
async getWaitingHall(e, t, n) {
|
|
10864
11021
|
if (!this._signaling) return Promise.reject();
|
|
10865
11022
|
let r = null;
|
|
10866
|
-
if (e && (r =
|
|
11023
|
+
if (e && (r = mo(e), r)) {
|
|
10867
11024
|
let e = this._api.getDecorativeIdByInitialId(r.id);
|
|
10868
|
-
r.id = e
|
|
11025
|
+
r.id = e ?? r.id;
|
|
10869
11026
|
}
|
|
10870
11027
|
let i = await this._signaling.getWaitingHall(r, t, n);
|
|
10871
11028
|
if (i.error) return Promise.reject(i.message);
|
|
10872
|
-
let a = i.participants || [], { externalIds: o } =
|
|
10873
|
-
return a.length && i.hasMore && (s =
|
|
11029
|
+
let a = i.participants || [], { externalIds: o } = this._resolveWaitingHallExternalIds(a, "getWaitingHall"), s = null;
|
|
11030
|
+
return a.length && i.hasMore && (s = po(a[a.length - 1].id)), {
|
|
10874
11031
|
participants: o,
|
|
10875
11032
|
pageMarker: s,
|
|
10876
11033
|
totalCount: i.totalCount || 0
|
|
10877
11034
|
};
|
|
10878
11035
|
}
|
|
10879
|
-
|
|
10880
|
-
let
|
|
11036
|
+
_resolveWaitingHallExternalIds(e, t) {
|
|
11037
|
+
let n = [], r = [], i = [];
|
|
10881
11038
|
return e.length && e.forEach((e) => {
|
|
10882
11039
|
if (e.externalId) {
|
|
10883
|
-
let
|
|
10884
|
-
|
|
10885
|
-
} else
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
11040
|
+
let t = Q.fromSignaling(e.externalId);
|
|
11041
|
+
n.push(e.id.addedTs), r.push(t), this._api.cacheExternalId(e.id.id, t);
|
|
11042
|
+
} else {
|
|
11043
|
+
let t = this._getExternalIdByParticipantId(e.id.id);
|
|
11044
|
+
t ? (r.push(t), n.push(e.id.addedTs)) : i.push(e.id.id);
|
|
11045
|
+
}
|
|
11046
|
+
}), this._reportMissingExternalIds(i, t), {
|
|
11047
|
+
externalIds: r,
|
|
11048
|
+
timestamps: n
|
|
10889
11049
|
};
|
|
10890
11050
|
}
|
|
10891
11051
|
async getAudienceModeHands() {
|
|
10892
11052
|
if (!this._signaling.ready) throw Error("Signaling is not ready");
|
|
10893
11053
|
let e = await this._signaling.getHandQueue();
|
|
10894
11054
|
if (e.error) return Promise.reject(e.message);
|
|
10895
|
-
let t = e.participants || [], { externalIds: n, timestamps: r } =
|
|
11055
|
+
let t = e.participants || [], { externalIds: n, timestamps: r } = this._resolveWaitingHallExternalIds(t, "getAudienceModeHands");
|
|
10896
11056
|
return {
|
|
10897
11057
|
timestamps: r,
|
|
10898
11058
|
participants: n,
|
|
@@ -10901,7 +11061,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10901
11061
|
}
|
|
10902
11062
|
async promoteParticipant(e, t) {
|
|
10903
11063
|
if (this._signaling && this._conversation) try {
|
|
10904
|
-
if (!j.includesOneOf(this._conversation.options, [
|
|
11064
|
+
if (!j.includesOneOf(this._conversation.options, [eo.WAITING_HALL, eo.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
|
|
10905
11065
|
if (this._checkAdminRole(), !e && t) throw Error("participantId is required");
|
|
10906
11066
|
await this._signaling.promoteParticipant(e, t);
|
|
10907
11067
|
} catch (t) {
|
|
@@ -11061,7 +11221,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11061
11221
|
unmuteOptions: e.unmuteOptions || [],
|
|
11062
11222
|
observedIds: e.observedIds || [],
|
|
11063
11223
|
markers: this._denormalizeMarkers(t, e.markers)
|
|
11064
|
-
}, e
|
|
11224
|
+
}, j.composeDecorativeId(e));
|
|
11065
11225
|
}));
|
|
11066
11226
|
}
|
|
11067
11227
|
async getParticipantListChunk(e) {
|
|
@@ -11073,7 +11233,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11073
11233
|
let a = this._transport?.getState();
|
|
11074
11234
|
return n.participants.forEach((e) => {
|
|
11075
11235
|
let t = j.composeId(e), n = r[t];
|
|
11076
|
-
this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n,
|
|
11236
|
+
this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, uo.fromTransportState(a) ?? N.WAITING), n.movieShareInfos = e.movieShareInfos, Object.assign(n.mediaSettings, E(e.mediaSettings)), Object.assign(n.muteStates, e.muteStates), n.unmuteOptions = e.unmuteOptions ?? n.unmuteOptions, this._openTransport([n], !0);
|
|
11077
11237
|
}), this._participantListChunkToExternalChunk(n);
|
|
11078
11238
|
}
|
|
11079
11239
|
async _getInitialParticiapntListChunk() {
|
|
@@ -11087,7 +11247,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11087
11247
|
_onLocalMediaStreamChanged(e) {
|
|
11088
11248
|
if (!this._conversation || !this._mediaSource) return;
|
|
11089
11249
|
let t = this._mediaSource.mediaSettings;
|
|
11090
|
-
this._debug.debug("Local media stream changed", t), e.kind === k.audio && this._mediaSource && (this._audioFix = new
|
|
11250
|
+
this._debug.debug("Local media stream changed", t), e.kind === k.audio && this._mediaSource && (this._audioFix = new To(this._mediaSource, this._debug, this._stats.logger)), L.onLocalStreamUpdate(t, e.kind, this.id), !this._conversation?.waitingHall && !this._conversation?.observer && !this._isAudienceModeListener() && this._changeMediaSettings(t);
|
|
11091
11251
|
}
|
|
11092
11252
|
_onScreenSharingStatus(e) {
|
|
11093
11253
|
let t = this.mediaSettings;
|
|
@@ -11107,7 +11267,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11107
11267
|
this._warnParticipantNotInConversation(e);
|
|
11108
11268
|
return;
|
|
11109
11269
|
}
|
|
11110
|
-
r.mediaSettings = t, ["ACTIVE", "HELD"].includes(this._state) && L.onRemoteMediaSettings(r.externalId, t, r.markers, this.id), this._specListener && this._specListener.onChangeRemoteMediaSettings(e, t);
|
|
11270
|
+
r.mediaSettings = t, ["ACTIVE", "HELD"].includes(this._state) && (r.externalId ? L.onRemoteMediaSettings(r.externalId, t, r.markers, this.id) : this._reportMissingExternalIds([e], "REMOTE_MEDIA_SETTINGS")), this._specListener && this._specListener.onChangeRemoteMediaSettings(e, t);
|
|
11111
11271
|
}
|
|
11112
11272
|
_extractLocalParticipantFromConnection(e) {
|
|
11113
11273
|
let t = this._api.getUserId();
|
|
@@ -11123,7 +11283,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11123
11283
|
this._warnParticipantNotInConversation(e);
|
|
11124
11284
|
return;
|
|
11125
11285
|
}
|
|
11126
|
-
n.participantState = t || {}, ["ACTIVE", "HELD"].includes(this._state) && L.onRemoteParticipantState(n.externalId, n.participantState, n.markers, this.id);
|
|
11286
|
+
n.participantState = t || {}, ["ACTIVE", "HELD"].includes(this._state) && (n.externalId ? L.onRemoteParticipantState(n.externalId, n.participantState, n.markers, this.id) : this._reportMissingExternalIds([e], "REMOTE_PARTICIPANT_STATE"));
|
|
11127
11287
|
}
|
|
11128
11288
|
_changeMultipleParticipantState(e, t) {
|
|
11129
11289
|
this._debug.debug("Multiple participants state changed", e);
|
|
@@ -11217,9 +11377,9 @@ var ls = 15, $ = class e extends b {
|
|
|
11217
11377
|
for (let n of e.conversation.participants) {
|
|
11218
11378
|
let e = j.composeId(n), i = n.roles || [];
|
|
11219
11379
|
if (this._isMe(e)) {
|
|
11220
|
-
|
|
11380
|
+
co(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
|
|
11221
11381
|
this._registerParticipantLocalMuteState({
|
|
11222
|
-
muteStates:
|
|
11382
|
+
muteStates: yo(n),
|
|
11223
11383
|
unmuteOptions: n.unmuteOptions
|
|
11224
11384
|
});
|
|
11225
11385
|
};
|
|
@@ -11237,7 +11397,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11237
11397
|
let t = E(n.mediaSettings);
|
|
11238
11398
|
Wt(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
|
|
11239
11399
|
let r = j.mapParticipantState(n), o = a.participantState;
|
|
11240
|
-
j.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r),
|
|
11400
|
+
j.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), co(i, a.roles) || this._onRolesChanged(a.id, i), !!n.onHold != !!a.isOnHold && (a.isOnHold = !!n.onHold, this._setParticipantsStatus([a], n.onHold ? N.ONHOLD : N.CONNECTED));
|
|
11241
11401
|
}
|
|
11242
11402
|
}
|
|
11243
11403
|
let i = this._participants;
|
|
@@ -11262,27 +11422,33 @@ var ls = 15, $ = class e extends b {
|
|
|
11262
11422
|
this._close(new O(D.MISSED), { errorText: "Call accepted on other device" });
|
|
11263
11423
|
return;
|
|
11264
11424
|
}
|
|
11265
|
-
this._conversation?.direction ===
|
|
11425
|
+
this._conversation?.direction === Xa.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
|
|
11266
11426
|
let r = this._getParticipant(t);
|
|
11267
11427
|
if (!r) {
|
|
11268
|
-
let n = this._api.getDecorativeIdByInitialId(t)
|
|
11428
|
+
let n = this._api.getDecorativeIdByInitialId(t);
|
|
11269
11429
|
r = this._registerParticipantInCache(this._createParticipant({
|
|
11270
11430
|
id: t,
|
|
11271
11431
|
externalId: e.externalId ? Q.fromSignaling(e.externalId, e.deviceIdx) : void 0,
|
|
11272
11432
|
mediaSettings: E(e.mediaSettings)
|
|
11273
|
-
},
|
|
11433
|
+
}, n));
|
|
11274
11434
|
} else if (e.externalId) {
|
|
11275
11435
|
let t = Q.fromSignaling(e.externalId, e.deviceIdx);
|
|
11276
11436
|
r.externalId = t, this._api.cacheExternalId(r.id, t);
|
|
11277
11437
|
}
|
|
11278
|
-
r.state = Z.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction ===
|
|
11438
|
+
r.state = Z.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Xa.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);
|
|
11279
11439
|
let i = Object.keys(r.muteStates);
|
|
11280
|
-
i.length && this._onMuteParticipant({
|
|
11440
|
+
if (i.length && this._onMuteParticipant({
|
|
11281
11441
|
muteStates: r.muteStates,
|
|
11282
11442
|
mediaOptions: i,
|
|
11283
11443
|
stateUpdated: !0,
|
|
11284
11444
|
participantId: t
|
|
11285
|
-
}), ["ACTIVE", "HELD"].includes(this._state)
|
|
11445
|
+
}), ["ACTIVE", "HELD"].includes(this._state)) {
|
|
11446
|
+
if (!r.externalId) {
|
|
11447
|
+
this._reportMissingExternalIds([t], "ACCEPTED_CALL");
|
|
11448
|
+
return;
|
|
11449
|
+
}
|
|
11450
|
+
L.onAcceptedCall(r.externalId, ja.parseCapabilities(e.capabilities), this.id);
|
|
11451
|
+
}
|
|
11286
11452
|
}
|
|
11287
11453
|
async _onHungup(e) {
|
|
11288
11454
|
this._debug.debug(`Participant hungup [${e.participantId}]`, { reason: e.reason });
|
|
@@ -11318,7 +11484,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11318
11484
|
return;
|
|
11319
11485
|
}
|
|
11320
11486
|
if (e.connected) {
|
|
11321
|
-
let e =
|
|
11487
|
+
let e = uo.fromTransportState(this._transport?.getState());
|
|
11322
11488
|
e && this._setTransportStatus(n, e);
|
|
11323
11489
|
}
|
|
11324
11490
|
this._setSessionState(n, { connected: e.connected });
|
|
@@ -11351,7 +11517,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11351
11517
|
return;
|
|
11352
11518
|
}
|
|
11353
11519
|
if (!n) {
|
|
11354
|
-
let { participant: r } = e, i = r
|
|
11520
|
+
let { participant: r } = e, i = j.composeDecorativeId(r);
|
|
11355
11521
|
this._registerParticipant({
|
|
11356
11522
|
id: t,
|
|
11357
11523
|
externalId: Q.fromSignalingParticipant(r, !0, !0),
|
|
@@ -11378,7 +11544,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11378
11544
|
return;
|
|
11379
11545
|
}
|
|
11380
11546
|
if (!n) {
|
|
11381
|
-
let { participant: r } = e, i = r
|
|
11547
|
+
let { participant: r } = e, i = j.composeDecorativeId(r);
|
|
11382
11548
|
this._registerParticipant({
|
|
11383
11549
|
id: t,
|
|
11384
11550
|
externalId: Q.fromSignalingParticipant(r, !0, !0),
|
|
@@ -11395,7 +11561,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11395
11561
|
isOnHold: !!r.onHold
|
|
11396
11562
|
}, i), n = this._getParticipant(t);
|
|
11397
11563
|
}
|
|
11398
|
-
this._conversation && this._conversation.direction ===
|
|
11564
|
+
this._conversation && this._conversation.direction === Xa.OUTGOING && (this._state === "IDLE" || this._state === "PROCESSING") && (this._state = "ACTIVE", this._changeFeatureSet()), n.state = Z.ACCEPTED, n.mediaSettings = E(e.mediaSettings), n.participantState = j.mapParticipantState(e.participant), n.roles = e.participant.roles || [], this._updateParticipantSessionState(n, t, e.participant.sessionState), e.participant.onHold ? (n.isOnHold = !0, this._setParticipantsStatus([n], N.ONHOLD)) : this._transport?.isAllocated(n.id) ? this._setParticipantsStatus([n], N.CONNECTED) : this._setParticipantsStatus([n], N.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)), L.onParticipantJoined(n.externalId, n.markers, this.id), this._changeRemoteMediaSettings(t, n.mediaSettings), await this._changeRemoteParticipantState(t, n.participantState), this._invokeRolesChangedCallbackIfNeeded(n);
|
|
11399
11565
|
let i = Object.keys(n.muteStates);
|
|
11400
11566
|
i.length && this._onMuteParticipant({
|
|
11401
11567
|
muteStates: n.muteStates,
|
|
@@ -11421,7 +11587,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11421
11587
|
_onParticipantsStateChanged(e) {
|
|
11422
11588
|
let { participants: t, roomId: n } = e;
|
|
11423
11589
|
t.map(({ id: e, markers: t }) => this._registerParticipantAndSetMarkersIfChunkEnabled(e, t));
|
|
11424
|
-
let r = /* @__PURE__ */ new Map(), i = t.map(({ id: e, participantState: t }) => [e, this._getExternalIdByParticipantId(e)
|
|
11590
|
+
let r = /* @__PURE__ */ new Map(), i = t.map(({ id: e, participantState: t }) => [e, this._getExternalIdByParticipantId(e) ? j.mapParticipantState({ participantState: t }) : void 0]);
|
|
11425
11591
|
try {
|
|
11426
11592
|
i.forEach(([e, t]) => {
|
|
11427
11593
|
t && r.set(e, t);
|
|
@@ -11586,15 +11752,15 @@ var ls = 15, $ = class e extends b {
|
|
|
11586
11752
|
L.onAsrTranscription(t, e.text, e.timestamp, e.duration, this.id);
|
|
11587
11753
|
}
|
|
11588
11754
|
async _onRolesChanged(e, t) {
|
|
11589
|
-
if (this._conversation && this._isMe(e) && !
|
|
11755
|
+
if (this._conversation && this._isMe(e) && !co(this._conversation.roles, t)) {
|
|
11590
11756
|
this._debug.debug(`Local roles changed: ${t}`), this._conversation.roles = t, L.onLocalRolesChanged(t, !1, this.id), this._processMuteState({
|
|
11591
|
-
mediaOptions:
|
|
11757
|
+
mediaOptions: ho(this._getMuteStatesForCurrentRoom(), ro.MUTE_PERMANENT),
|
|
11592
11758
|
stateUpdated: !0
|
|
11593
|
-
}), j.includesOneOf(t, [
|
|
11759
|
+
}), j.includesOneOf(t, [so.ADMIN, so.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
|
|
11594
11760
|
return;
|
|
11595
11761
|
}
|
|
11596
11762
|
let n = this._getParticipant(e);
|
|
11597
|
-
n && !
|
|
11763
|
+
n && !co(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, L.onRolesChanged(n.externalId, t, !1, this.id));
|
|
11598
11764
|
}
|
|
11599
11765
|
async _onMuteParticipant(e, t = !1) {
|
|
11600
11766
|
if (!this._conversation) return;
|
|
@@ -11643,7 +11809,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11643
11809
|
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);
|
|
11644
11810
|
for (let [e, i] of d) {
|
|
11645
11811
|
let a = this._isCallAdmin() && n;
|
|
11646
|
-
if (!(i !==
|
|
11812
|
+
if (!(i !== ro.MUTE && i !== ro.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === ro.MUTE_PERMANENT && !n && (l[e] = ro.MUTE), !(!t.includes(e) || r))) switch (e) {
|
|
11647
11813
|
case S.VIDEO:
|
|
11648
11814
|
u.isVideoEnabled && (L.onDeviceSwitched(S.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
|
|
11649
11815
|
break;
|
|
@@ -11680,7 +11846,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11680
11846
|
this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
|
|
11681
11847
|
}
|
|
11682
11848
|
_onOptionsChanged(e) {
|
|
11683
|
-
this._conversation && !
|
|
11849
|
+
this._conversation && !to(this._conversation.options, e) && (this._conversation.options = e, L.onOptionsChanged(e, this.id), e.includes(eo.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && L.onLocalStatus(N.WAITING_HALL, this.id) : e.includes(eo.WAIT_FOR_ADMIN) && this._conversation.restricted && L.onLocalStatus(N.WAIT_FOR_ADMIN, this.id));
|
|
11684
11850
|
}
|
|
11685
11851
|
async _onNetworkStatus(e) {
|
|
11686
11852
|
if (this._conversation) {
|
|
@@ -11690,7 +11856,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11690
11856
|
if (this._isMe(r) || r === "") e = this._conversation.networkRating;
|
|
11691
11857
|
else if (n[r]) e = n[r].networkRating;
|
|
11692
11858
|
else continue;
|
|
11693
|
-
if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i,
|
|
11859
|
+
if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, si.getInstance().value = i, L.onLocalNetworkStatusChanged(i, this.id);
|
|
11694
11860
|
else {
|
|
11695
11861
|
let e = n[r];
|
|
11696
11862
|
e.networkRating = i, t.push({
|
|
@@ -11735,7 +11901,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11735
11901
|
}
|
|
11736
11902
|
_changeFeatureSet() {
|
|
11737
11903
|
if (this._conversation) {
|
|
11738
|
-
let e = this._state === "ACTIVE", t = this._conversation.features.includes(
|
|
11904
|
+
let e = this._state === "ACTIVE", t = this._conversation.features.includes($a.ADD_PARTICIPANT);
|
|
11739
11905
|
L.onCallState(e, t, this._conversation, this.id);
|
|
11740
11906
|
}
|
|
11741
11907
|
}
|
|
@@ -11769,7 +11935,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11769
11935
|
let n = this._getParticipant(e);
|
|
11770
11936
|
if (n) {
|
|
11771
11937
|
if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
|
|
11772
|
-
let e =
|
|
11938
|
+
let e = uo.fromTransportState(this._transport?.getState());
|
|
11773
11939
|
e && this._setTransportStatus(n, e), n.connectionStatus.sessionStateConnectedBySpeaker = !0;
|
|
11774
11940
|
let t = this._setTransportStatus(n, n.connectionStatus.transport);
|
|
11775
11941
|
this._emitParticipantTransition(n, t);
|
|
@@ -11779,7 +11945,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11779
11945
|
}
|
|
11780
11946
|
async _onTransportStateChanged(e, t) {
|
|
11781
11947
|
this._debug.debug(`Transport state has changed: ${t}`, e);
|
|
11782
|
-
let n =
|
|
11948
|
+
let n = uo.fromTransportState(t);
|
|
11783
11949
|
if (!n) return;
|
|
11784
11950
|
let r = this._participants, i = [], a = e.reduce((e, n) => {
|
|
11785
11951
|
if (n in r) {
|
|
@@ -11813,15 +11979,15 @@ var ls = 15, $ = class e extends b {
|
|
|
11813
11979
|
return e.every((e) => t[e]?.isOnHold);
|
|
11814
11980
|
}
|
|
11815
11981
|
_onRemoteTrackAdded(e, t, n) {
|
|
11816
|
-
if (e.endsWith(
|
|
11817
|
-
else if (e.startsWith(
|
|
11818
|
-
else if (e.startsWith(
|
|
11982
|
+
if (e.endsWith(ri.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), L.onRemoteMixedAudioStream(t, this.id);
|
|
11983
|
+
else if (e.startsWith(ri.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
|
|
11984
|
+
else if (e.startsWith(ri.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
|
|
11819
11985
|
else {
|
|
11820
11986
|
this._debug.debug(`Remote track added on the participant [${e}]`, { kind: n.kind });
|
|
11821
11987
|
let r = this._getParticipant(e);
|
|
11822
11988
|
if (!r) {
|
|
11823
|
-
let t = this._api.getDecorativeIdByInitialId(e)
|
|
11824
|
-
this._debug.warn(`Conversation: track added before participant [id: ${e}, decorativeId: ${
|
|
11989
|
+
let t = this._api.getDecorativeIdByInitialId(e);
|
|
11990
|
+
this._debug.warn(`Conversation: track added before participant [id: ${e}, decorativeId: ${t}]`), this._registerParticipant({ id: e }, t), r = this._getParticipant(e), this._setParticipantsStatus([r], N.WAITING), this._activeSpeakerId === e && this._lastSignalledActiveSpeakerId !== e && (L.onSpeakerChanged(r.externalId, this.id), this._lastSignalledActiveSpeakerId = e);
|
|
11825
11991
|
}
|
|
11826
11992
|
if (this._transport && !this._transport.isAllocated(r.id) && this._allocateParticipantTransport(r.id, !1), n.kind === k.audio && (this._audioOutput.add(e, n), M.preserveAudioTracks || (r.remoteAudioTrack = n, t.removeTrack(n))), r.remoteStream !== t && t.getTracks().length) {
|
|
11827
11993
|
if (r.remoteStream = t, r.secondStream) return;
|
|
@@ -11842,7 +12008,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11842
12008
|
}
|
|
11843
12009
|
}
|
|
11844
12010
|
async _removeAudioTrack(e, t, n) {
|
|
11845
|
-
if (e !==
|
|
12011
|
+
if (e !== ri.AUDIO_MIX) {
|
|
11846
12012
|
let n = this._getParticipant(e);
|
|
11847
12013
|
if (!n || n.remoteStream && n.remoteStream !== t) return;
|
|
11848
12014
|
}
|
|
@@ -11857,7 +12023,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11857
12023
|
if (this._statFirstMediaReceived.markTopologyChanged(e), e === J.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation) {
|
|
11858
12024
|
this._conversation.topology = e;
|
|
11859
12025
|
for (let e of Object.values(this._participants)) {
|
|
11860
|
-
let t =
|
|
12026
|
+
let t = uo.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
11861
12027
|
this._emitParticipantTransition(e, t);
|
|
11862
12028
|
}
|
|
11863
12029
|
this._changeFeatureSet(), this._forceOpenTransportForAloneInCall();
|
|
@@ -11913,7 +12079,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11913
12079
|
].includes(t) ? null : this._setTransportStatus(e, t), n);
|
|
11914
12080
|
}
|
|
11915
12081
|
_setParticipantsStalled(e, t) {
|
|
11916
|
-
this._updateParticipantsStatus(e, (e) =>
|
|
12082
|
+
this._updateParticipantsStatus(e, (e) => uo.setStalled(e.connectionStatus, t));
|
|
11917
12083
|
}
|
|
11918
12084
|
_updateParticipantsStatus(e, t, n = null) {
|
|
11919
12085
|
let r = e.reduce((e, n) => {
|
|
@@ -11931,46 +12097,63 @@ var ls = 15, $ = class e extends b {
|
|
|
11931
12097
|
}
|
|
11932
12098
|
_onRoomsUpdated(e) {
|
|
11933
12099
|
if (this._isCalledState()) return;
|
|
11934
|
-
let t = {};
|
|
11935
|
-
for (let
|
|
11936
|
-
let
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
12100
|
+
let t = {}, n = [], r = [];
|
|
12101
|
+
for (let i of Object.keys(io)) {
|
|
12102
|
+
let a = e.updates[i];
|
|
12103
|
+
a && (a?.rooms?.forEach((e) => {
|
|
12104
|
+
let { room: t, missingParticipantIds: i } = this._convertRoomToExternal(e);
|
|
12105
|
+
t && n.push(t), r.push(...i);
|
|
12106
|
+
}), t[i] = {
|
|
12107
|
+
rooms: n,
|
|
12108
|
+
roomIds: a?.roomIds,
|
|
12109
|
+
deactivated: a?.deactivated
|
|
11941
12110
|
});
|
|
11942
12111
|
}
|
|
11943
|
-
L.onRoomsUpdated(t, this.id);
|
|
12112
|
+
this._reportMissingExternalIds(r, "ROOMS_UPDATED"), L.onRoomsUpdated(t, this.id);
|
|
11944
12113
|
}
|
|
11945
12114
|
_onRoomUpdated(e) {
|
|
11946
|
-
let t = this._convertRoomToExternal(e.room || null);
|
|
11947
|
-
e.events.some((e) => e ===
|
|
12115
|
+
let { room: t, missingParticipantIds: n } = this._convertRoomToExternal(e.room || null);
|
|
12116
|
+
e.events.some((e) => e === io.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"), L.onRoomUpdated(e.events, e.roomId, t, e.deactivate || null, this.id));
|
|
11948
12117
|
}
|
|
11949
12118
|
_convertRoomToExternal(e) {
|
|
11950
|
-
if (!e) return
|
|
11951
|
-
|
|
12119
|
+
if (!e) return {
|
|
12120
|
+
room: null,
|
|
12121
|
+
missingParticipantIds: []
|
|
12122
|
+
};
|
|
12123
|
+
let t = [], { externalIds: n, missingIds: r } = this._getExternalIdsByParticipantIds(e.participantIds ?? []), { externalIds: i, missingIds: a } = this._getExternalIdsByParticipantIds(e.addParticipantIds ?? []), { externalIds: o, missingIds: s } = this._getExternalIdsByParticipantIds(e.removeParticipantIds ?? []);
|
|
12124
|
+
t.push(...r, ...a, ...s);
|
|
12125
|
+
let c;
|
|
12126
|
+
if (e.pinnedParticipantId) {
|
|
12127
|
+
let n = this._getExternalIdByParticipantId(e.pinnedParticipantId);
|
|
12128
|
+
n ? c = n : t.push(e.pinnedParticipantId);
|
|
12129
|
+
}
|
|
11952
12130
|
return {
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
12131
|
+
room: {
|
|
12132
|
+
id: e.id,
|
|
12133
|
+
name: e.name,
|
|
12134
|
+
participantCount: e.participantCount,
|
|
12135
|
+
participantIds: n,
|
|
12136
|
+
addParticipantIds: i,
|
|
12137
|
+
removeParticipantIds: o,
|
|
12138
|
+
participants: e.participants?.participants ? this._participantListChunkToExternalChunk(e.participants) : void 0,
|
|
12139
|
+
active: e.active,
|
|
12140
|
+
muteStates: e.muteStates,
|
|
12141
|
+
pinnedParticipantId: c,
|
|
12142
|
+
countdownSec: e.countdownSec,
|
|
12143
|
+
timeoutMs: e.timeoutMs
|
|
12144
|
+
},
|
|
12145
|
+
missingParticipantIds: t
|
|
11965
12146
|
};
|
|
11966
12147
|
}
|
|
11967
12148
|
async _onRoomParticipantsUpdated(e) {
|
|
11968
|
-
let t = this._transport?.getState(), n = e.roomId ?? null, r =
|
|
11969
|
-
|
|
12149
|
+
let t = this._transport?.getState(), n = e.roomId ?? null, r = [], { externalIds: i, missingIds: a } = this._getExternalIdsByParticipantIds(e.addedParticipantIds ?? []);
|
|
12150
|
+
r.push(...a);
|
|
12151
|
+
let o = e.addedParticipants;
|
|
12152
|
+
if (i.length && o?.length !== i.length && !this._isCalledState()) {
|
|
11970
12153
|
let e = this._convertExternalIdsToServerExternalIds(i);
|
|
11971
|
-
|
|
12154
|
+
o = (await this._signaling.getParticipants(e)).participants;
|
|
11972
12155
|
}
|
|
11973
|
-
let
|
|
12156
|
+
let s = o?.map((e) => {
|
|
11974
12157
|
let r = j.composeId(e);
|
|
11975
12158
|
return this._createParticipant({
|
|
11976
12159
|
id: r,
|
|
@@ -11986,38 +12169,38 @@ var ls = 15, $ = class e extends b {
|
|
|
11986
12169
|
observedIds: e.observedIds || [],
|
|
11987
12170
|
markers: this._denormalizeMarkers(r, e.markers),
|
|
11988
12171
|
isInRoom: n !== null
|
|
11989
|
-
}, e
|
|
11990
|
-
}) || [],
|
|
11991
|
-
for (let e of
|
|
11992
|
-
this._transport?.getState() === q.IDLE && !this._isCalledState() && this._openTransport(
|
|
11993
|
-
let
|
|
12172
|
+
}, j.composeDecorativeId(e));
|
|
12173
|
+
}) || [], c = !1;
|
|
12174
|
+
for (let e of s) e.id === this._conversation?.compositeUserId && (c = !0), this._registerParticipantInCache(e);
|
|
12175
|
+
this._transport?.getState() === q.IDLE && !this._isCalledState() && this._openTransport(s, !0);
|
|
12176
|
+
let l = [];
|
|
11994
12177
|
if (e?.removedParticipantMarkers) {
|
|
11995
12178
|
for (let t of e.removedParticipantMarkers) if (t.GRID?.id) {
|
|
11996
12179
|
let e = this._getExternalIdByParticipantId(t.GRID.id);
|
|
11997
|
-
|
|
12180
|
+
e ? l.push(e) : r.push(t.GRID.id);
|
|
11998
12181
|
}
|
|
11999
12182
|
}
|
|
12000
|
-
if (
|
|
12183
|
+
if (this._reportMissingExternalIds(r, "ROOM_PARTICIPANTS_UPDATED"), c && await this._onRoomSwitched(n), l) {
|
|
12001
12184
|
let e = this._conversation?.pinnedParticipantIdByRoom.get(n);
|
|
12002
12185
|
if (e) {
|
|
12003
12186
|
let t = this._getExternalIdByParticipantId(e);
|
|
12004
12187
|
if (t) {
|
|
12005
|
-
for (let e of
|
|
12188
|
+
for (let e of l) if (Q.compare(t, e)) {
|
|
12006
12189
|
this._conversation?.pinnedParticipantIdByRoom.delete(n);
|
|
12007
12190
|
break;
|
|
12008
12191
|
}
|
|
12009
12192
|
}
|
|
12010
12193
|
}
|
|
12011
12194
|
}
|
|
12012
|
-
let
|
|
12195
|
+
let u = {
|
|
12013
12196
|
roomId: n,
|
|
12014
12197
|
participantCount: e.participantCount,
|
|
12015
12198
|
addedParticipantIds: i,
|
|
12016
|
-
addedParticipants: j.mapSharedParticipants(
|
|
12199
|
+
addedParticipants: j.mapSharedParticipants(s),
|
|
12017
12200
|
removedParticipantMarkers: e?.removedParticipantMarkers,
|
|
12018
|
-
removedParticipantIds:
|
|
12201
|
+
removedParticipantIds: l
|
|
12019
12202
|
};
|
|
12020
|
-
this._isCalledState() || L.onRoomParticipantsUpdated(
|
|
12203
|
+
this._isCalledState() || L.onRoomParticipantsUpdated(u, this.id);
|
|
12021
12204
|
}
|
|
12022
12205
|
async _onRoomSwitched(e, t = !1) {
|
|
12023
12206
|
if (!this._conversation || this._conversation.roomId === e) return;
|
|
@@ -12037,11 +12220,11 @@ var ls = 15, $ = class e extends b {
|
|
|
12037
12220
|
if (this._setMuteStatesForRoomId(t.muteStates, n), this._conversation?.recordsInfoByRoom.set(n, t.recordInfo ?? null), this._conversation?.pinnedParticipantIdByRoom.set(n, t.pinnedParticipantId ?? null), t.asrInfo && this._conversation?.asrInfoByRoom.set(n, t.asrInfo), t.urlSharingInfo ? this._conversation?.urlSharingInfoByRoom.set(n, t.urlSharingInfo) : this._conversation?.urlSharingInfoByRoom.delete(n), e) {
|
|
12038
12221
|
let e = this._participants;
|
|
12039
12222
|
await this._registerParticipants(t?.participants?.participants?.filter((t) => !e[j.composeId(t)]) || [], !0);
|
|
12040
|
-
let n = this._convertRoomToExternal(t);
|
|
12223
|
+
let { room: n } = this._convertRoomToExternal(t);
|
|
12041
12224
|
n && r.push(n);
|
|
12042
12225
|
}
|
|
12043
12226
|
}
|
|
12044
|
-
r.length && !this._isCalledState() && L.onRoomsUpdated({ [
|
|
12227
|
+
r.length && !this._isCalledState() && L.onRoomsUpdated({ [io.UPDATE]: { rooms: r } }, this.id);
|
|
12045
12228
|
}
|
|
12046
12229
|
_onFeedback(e) {
|
|
12047
12230
|
let t = [];
|
|
@@ -12071,7 +12254,9 @@ var ls = 15, $ = class e extends b {
|
|
|
12071
12254
|
return;
|
|
12072
12255
|
}
|
|
12073
12256
|
let o = Q.fromSignaling(r, a.deviceIdx);
|
|
12074
|
-
|
|
12257
|
+
L.onParticipantIdChanged(a, o, this.id);
|
|
12258
|
+
let s = j.compose(n, a.deviceIdx), c = j.compose(t, a.deviceIdx);
|
|
12259
|
+
if (this._api.cacheExternalId(s, o), this._api.mapDecorativeId(s, c), i) this._conversation.externalId = o;
|
|
12075
12260
|
else {
|
|
12076
12261
|
let e = this._participants;
|
|
12077
12262
|
e[t].externalId = o;
|
|
@@ -12115,19 +12300,19 @@ var ls = 15, $ = class e extends b {
|
|
|
12115
12300
|
_getParticipant(e) {
|
|
12116
12301
|
return this._participants[e];
|
|
12117
12302
|
}
|
|
12118
|
-
},
|
|
12303
|
+
}, bs = null, xs = class e extends Error {
|
|
12119
12304
|
constructor(t, n) {
|
|
12120
12305
|
super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
|
|
12121
12306
|
}
|
|
12122
|
-
},
|
|
12123
|
-
function
|
|
12124
|
-
|
|
12307
|
+
}, Ss = null, Cs = null, ws = 64 * 1024;
|
|
12308
|
+
function Ts() {
|
|
12309
|
+
Ss = null, Cs = null;
|
|
12125
12310
|
}
|
|
12126
|
-
function
|
|
12311
|
+
function Es(e) {
|
|
12127
12312
|
return e?.endsWith("/") ? e.slice(0, -1) : e;
|
|
12128
12313
|
}
|
|
12129
|
-
async function
|
|
12130
|
-
let n =
|
|
12314
|
+
async function Ds(e = null, t) {
|
|
12315
|
+
let n = Es(e ?? M.apiBaseUrl);
|
|
12131
12316
|
if (n) return n;
|
|
12132
12317
|
if ((t ?? M.apiEnv) !== "AUTO") return M.apiEndpoint(t);
|
|
12133
12318
|
try {
|
|
@@ -12142,25 +12327,25 @@ async function _s(e = null, t) {
|
|
|
12142
12327
|
return R.warn("Failed to resolve API endpoint using DNS, default is used", e), M.apiEndpoint(t);
|
|
12143
12328
|
}
|
|
12144
12329
|
}
|
|
12145
|
-
async function
|
|
12146
|
-
return
|
|
12330
|
+
async function Os() {
|
|
12331
|
+
return Ss || Cs || (Cs = Ds(), Ss = await Cs, Cs = null, Ss);
|
|
12147
12332
|
}
|
|
12148
|
-
async function
|
|
12333
|
+
async function ks(e, t = {}, n = !1) {
|
|
12149
12334
|
if (!window.Blob || !window.navigator.sendBeacon) return;
|
|
12150
|
-
await
|
|
12151
|
-
let r =
|
|
12152
|
-
window.navigator.sendBeacon(`${
|
|
12335
|
+
await Os();
|
|
12336
|
+
let r = Fs(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
|
|
12337
|
+
window.navigator.sendBeacon(`${Ss}/fb.do`, i);
|
|
12153
12338
|
}
|
|
12154
|
-
async function
|
|
12155
|
-
return await
|
|
12339
|
+
async function As(e, t = {}, n = !1, r) {
|
|
12340
|
+
return await Os(), Ms(Fs(e, t, n), r);
|
|
12156
12341
|
}
|
|
12157
|
-
async function
|
|
12158
|
-
await
|
|
12159
|
-
let r =
|
|
12160
|
-
return
|
|
12342
|
+
async function js(e, t = {}, n = !1) {
|
|
12343
|
+
await Os();
|
|
12344
|
+
let r = Fs(e, t, n);
|
|
12345
|
+
return Ms(r, void 0, new Blob([r]).size <= ws);
|
|
12161
12346
|
}
|
|
12162
|
-
async function
|
|
12163
|
-
let r = `${t ??
|
|
12347
|
+
async function Ms(e, t, n = !1) {
|
|
12348
|
+
let r = `${t ?? Ss}/fb.do`, i = new AbortController(), a = new O(x.NETWORK, { callError: {
|
|
12164
12349
|
scope: "network",
|
|
12165
12350
|
source: "api",
|
|
12166
12351
|
code: "timeout",
|
|
@@ -12179,16 +12364,16 @@ async function Ss(e, t, n = !1) {
|
|
|
12179
12364
|
} catch {
|
|
12180
12365
|
o = { result: a };
|
|
12181
12366
|
}
|
|
12182
|
-
if (!t.ok && !
|
|
12367
|
+
if (!t.ok && !Ns(o)) throw new O(x.API, { callError: {
|
|
12183
12368
|
scope: "server",
|
|
12184
12369
|
source: "api",
|
|
12185
12370
|
code: `http-${t.status}`,
|
|
12186
12371
|
description: "http-error"
|
|
12187
12372
|
} });
|
|
12188
|
-
if (
|
|
12373
|
+
if (Ns(o)) throw o;
|
|
12189
12374
|
return o;
|
|
12190
12375
|
} catch (e) {
|
|
12191
|
-
throw e instanceof O ? e : i.signal.aborted ? a :
|
|
12376
|
+
throw e instanceof O ? e : i.signal.aborted ? a : Ns(e) ? e : new O(x.NETWORK, { callError: {
|
|
12192
12377
|
scope: "network",
|
|
12193
12378
|
source: "api",
|
|
12194
12379
|
code: "fetch-failed",
|
|
@@ -12198,12 +12383,12 @@ async function Ss(e, t, n = !1) {
|
|
|
12198
12383
|
clearTimeout(o);
|
|
12199
12384
|
}
|
|
12200
12385
|
}
|
|
12201
|
-
function
|
|
12386
|
+
function Ns(e) {
|
|
12202
12387
|
if (typeof e != "object" || !e) return !1;
|
|
12203
12388
|
let t = e;
|
|
12204
12389
|
return typeof t.error_code == "number" && typeof t.error_msg == "string";
|
|
12205
12390
|
}
|
|
12206
|
-
async function
|
|
12391
|
+
async function Ps(e, t) {
|
|
12207
12392
|
try {
|
|
12208
12393
|
let n = await fetch(e, {
|
|
12209
12394
|
method: "POST",
|
|
@@ -12216,7 +12401,7 @@ async function ws(e, t) {
|
|
|
12216
12401
|
throw R.warn("Failed to send form data", e), e;
|
|
12217
12402
|
}
|
|
12218
12403
|
}
|
|
12219
|
-
function
|
|
12404
|
+
function Fs(e, t = {}, n = !1) {
|
|
12220
12405
|
t.method = e, t.format = "JSON", t.application_key || (t.application_key = M.apiKey), n || (y.sessionKey ? t.session_key = y.sessionKey : y.accessToken && (t.access_token = y.accessToken));
|
|
12221
12406
|
for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
|
|
12222
12407
|
let r = "";
|
|
@@ -12225,7 +12410,7 @@ function Ts(e, t = {}, n = !1) {
|
|
|
12225
12410
|
}
|
|
12226
12411
|
//#endregion
|
|
12227
12412
|
//#region src/abstract/BaseApi.ts
|
|
12228
|
-
var
|
|
12413
|
+
var Is = class {
|
|
12229
12414
|
constructor() {
|
|
12230
12415
|
h(this, "_abortSignal", void 0);
|
|
12231
12416
|
}
|
|
@@ -12243,22 +12428,16 @@ var Es = class {
|
|
|
12243
12428
|
}
|
|
12244
12429
|
log(e) {}
|
|
12245
12430
|
logClientStats(e) {}
|
|
12246
|
-
|
|
12431
|
+
getCachedParticipantIdByExternalId(e) {
|
|
12247
12432
|
return null;
|
|
12248
12433
|
}
|
|
12249
|
-
|
|
12250
|
-
return null;
|
|
12251
|
-
}
|
|
12252
|
-
getCachedExternalIdByOkId(e) {
|
|
12434
|
+
getCachedExternalIdByParticipantId(e) {
|
|
12253
12435
|
return null;
|
|
12254
12436
|
}
|
|
12255
12437
|
cacheExternalId(e, t) {}
|
|
12256
12438
|
mapDecorativeId(e, t) {}
|
|
12257
12439
|
unmapDecorativeId(e) {}
|
|
12258
12440
|
getDecorativeIdByInitialId(e) {}
|
|
12259
|
-
replaceByInitialIdIdIfExists(e) {
|
|
12260
|
-
return typeof e == "string" ? parseInt(e, 10) : e;
|
|
12261
|
-
}
|
|
12262
12441
|
hangupConversation(e, t = D.HUNGUP, n) {}
|
|
12263
12442
|
async removeHistoryRecords(e) {}
|
|
12264
12443
|
async getServerTime() {
|
|
@@ -12268,78 +12447,62 @@ var Es = class {
|
|
|
12268
12447
|
async getInbounds() {
|
|
12269
12448
|
return [];
|
|
12270
12449
|
}
|
|
12271
|
-
},
|
|
12450
|
+
}, Ls = class e {
|
|
12272
12451
|
constructor() {
|
|
12273
|
-
h(this, "
|
|
12452
|
+
h(this, "_participantIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToParticipantId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
|
|
12274
12453
|
}
|
|
12275
12454
|
static _normalizeType(e) {
|
|
12276
|
-
return e.type ===
|
|
12455
|
+
return e.type === fo.GROUP ? {
|
|
12277
12456
|
...e,
|
|
12278
|
-
type:
|
|
12457
|
+
type: fo.USER
|
|
12279
12458
|
} : e;
|
|
12280
12459
|
}
|
|
12281
|
-
getOkId(t) {
|
|
12282
|
-
let n = Q.toString(e._normalizeType(t)), r = this._externalIdToOkId.get(n);
|
|
12283
|
-
return r == null ? null : this.replaceByInitialIdIdIfExists(r);
|
|
12284
|
-
}
|
|
12285
12460
|
getExternalId(e) {
|
|
12286
|
-
let t = this.
|
|
12461
|
+
let t = this._initialIdToDecorativeId.get(e) ?? e, n = this._participantIdToExternalId.get(t);
|
|
12287
12462
|
return n == null ? null : Q.fromString(n);
|
|
12288
12463
|
}
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
hasByOkId(e) {
|
|
12293
|
-
return this._okIdToExternalId.has(e);
|
|
12464
|
+
getParticipantId(t) {
|
|
12465
|
+
let n = Q.toString(e._normalizeType(t)), r = this._externalIdToParticipantId.get(n);
|
|
12466
|
+
return r == null ? null : this._decorativeIdToInitialId.get(r) ?? r;
|
|
12294
12467
|
}
|
|
12295
12468
|
cache(t, n) {
|
|
12296
|
-
let r =
|
|
12297
|
-
this.
|
|
12469
|
+
let r = e._normalizeType(n), i = Q.toString(r);
|
|
12470
|
+
this._participantIdToExternalId.set(t, i), this._externalIdToParticipantId.set(i, t);
|
|
12298
12471
|
}
|
|
12299
12472
|
mapDecorativeId(e, t) {
|
|
12300
|
-
|
|
12301
|
-
this._decorativeIdToInitialId.set(n, r), this._initialIdToDecorativeId.set(r, n);
|
|
12473
|
+
this._decorativeIdToInitialId.set(e, t), this._initialIdToDecorativeId.set(t, e);
|
|
12302
12474
|
}
|
|
12303
12475
|
unmapDecorativeId(e) {
|
|
12304
|
-
let t =
|
|
12305
|
-
|
|
12476
|
+
let t = this._initialIdToDecorativeId.get(e);
|
|
12477
|
+
t && this._decorativeIdToInitialId.delete(t), this._initialIdToDecorativeId.delete(e);
|
|
12306
12478
|
}
|
|
12307
12479
|
getDecorativeIdByInitialId(e) {
|
|
12308
|
-
|
|
12309
|
-
return this._initialIdToDecorativeId.get(t);
|
|
12310
|
-
}
|
|
12311
|
-
replaceByInitialIdIdIfExists(e) {
|
|
12312
|
-
let t = j.extractOkId(e);
|
|
12313
|
-
return this._decorativeIdToInitialId.get(t) ?? t;
|
|
12314
|
-
}
|
|
12315
|
-
getParticipantIdByExternalId(e) {
|
|
12316
|
-
let t = this.getOkId(e);
|
|
12317
|
-
return t == null ? null : j.composeParticipantId(t, A.USER, e.deviceIdx ?? 0);
|
|
12480
|
+
return this._initialIdToDecorativeId.get(e);
|
|
12318
12481
|
}
|
|
12319
12482
|
clear() {
|
|
12320
|
-
this.
|
|
12483
|
+
this._participantIdToExternalId.clear(), this._externalIdToParticipantId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
|
|
12321
12484
|
}
|
|
12322
|
-
},
|
|
12323
|
-
function
|
|
12485
|
+
}, Rs = "anonymLogin:", zs = 700, Bs = 3e3;
|
|
12486
|
+
function Vs(e) {
|
|
12324
12487
|
let t = e.error_code;
|
|
12325
12488
|
switch (t) {
|
|
12326
|
-
case 2: return
|
|
12327
|
-
case 4: return e.error_msg.includes("participants.limit.exceeded") ?
|
|
12328
|
-
case 300: return
|
|
12329
|
-
case 1101: return
|
|
12330
|
-
case 1102: return
|
|
12331
|
-
case 1103: return
|
|
12332
|
-
case 1104: return
|
|
12333
|
-
case 1106: return
|
|
12334
|
-
case 1113: return
|
|
12489
|
+
case 2: return Hs(D.SERVICE_UNAVAILABLE, t, "service-unavailable");
|
|
12490
|
+
case 4: return e.error_msg.includes("participants.limit.exceeded") ? Hs(D.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Hs(x.API, t, "request-error");
|
|
12491
|
+
case 300: return Hs(D.NOT_FOUND, t, "not-found");
|
|
12492
|
+
case 1101: return Hs(D.SERVICE_DISABLED, t, "vchat-service-disabled");
|
|
12493
|
+
case 1102: return Hs(D.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
|
|
12494
|
+
case 1103: return Hs(D.NOT_FRIENDS, t, "friendship-required");
|
|
12495
|
+
case 1104: return Us(t, "youla-api-error");
|
|
12496
|
+
case 1106: return Us(t, "vk-api-error");
|
|
12497
|
+
case 1113: return Hs(D.CALLER_IS_REJECTED, t, "caller-is-rejected");
|
|
12335
12498
|
case 1114: {
|
|
12336
12499
|
let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
|
|
12337
|
-
return
|
|
12500
|
+
return Hs(r ? D.OBSOLETE_CLIENT : D.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
|
|
12338
12501
|
}
|
|
12339
|
-
default: return
|
|
12502
|
+
default: return Hs(x.API, t, "api-error");
|
|
12340
12503
|
}
|
|
12341
12504
|
}
|
|
12342
|
-
function
|
|
12505
|
+
function Hs(e, t, n, r) {
|
|
12343
12506
|
return {
|
|
12344
12507
|
type: e,
|
|
12345
12508
|
callError: {
|
|
@@ -12351,7 +12514,7 @@ function Ms(e, t, n, r) {
|
|
|
12351
12514
|
message: r
|
|
12352
12515
|
};
|
|
12353
12516
|
}
|
|
12354
|
-
function
|
|
12517
|
+
function Us(e, t) {
|
|
12355
12518
|
return {
|
|
12356
12519
|
type: D.EXTERNAL_API_ERROR,
|
|
12357
12520
|
callError: {
|
|
@@ -12362,19 +12525,19 @@ function Ns(e, t) {
|
|
|
12362
12525
|
}
|
|
12363
12526
|
};
|
|
12364
12527
|
}
|
|
12365
|
-
var
|
|
12528
|
+
var Ws = class extends Is {
|
|
12366
12529
|
constructor(...e) {
|
|
12367
|
-
super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new
|
|
12530
|
+
super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new Ls());
|
|
12368
12531
|
}
|
|
12369
12532
|
async _callUnsafe(e, t = {}, n = !1) {
|
|
12370
12533
|
let r = async (i) => {
|
|
12371
12534
|
try {
|
|
12372
|
-
return await
|
|
12535
|
+
return await As(e, t, n);
|
|
12373
12536
|
} catch (t) {
|
|
12374
12537
|
if (!t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
|
|
12375
12538
|
i++;
|
|
12376
12539
|
let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
|
|
12377
|
-
if (R.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (R.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < M.apiMaxAttempt) return await j.delay(Math.min(i *
|
|
12540
|
+
if (R.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (R.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < M.apiMaxAttempt) return await j.delay(Math.min(i * zs, Bs), { signal: this._abortSignal }), r(i);
|
|
12378
12541
|
}
|
|
12379
12542
|
throw R.warn(e, "error", t), t;
|
|
12380
12543
|
}
|
|
@@ -12397,16 +12560,19 @@ var Ps = class extends Es {
|
|
|
12397
12560
|
message: i?.error_msg,
|
|
12398
12561
|
code: i?.error_code
|
|
12399
12562
|
};
|
|
12400
|
-
if (i.custom_error && (a.custom_error = i.custom_error),
|
|
12401
|
-
let e =
|
|
12563
|
+
if (i.custom_error && (a.custom_error = i.custom_error), Gs(i)) {
|
|
12564
|
+
let e = Vs(i);
|
|
12402
12565
|
throw a.callError = e.callError, a.message = e.message ?? a.message, new O(e.type, a);
|
|
12403
12566
|
}
|
|
12404
12567
|
throw new O(x.API, a);
|
|
12405
12568
|
}
|
|
12406
12569
|
}
|
|
12407
12570
|
userId(e) {
|
|
12408
|
-
|
|
12409
|
-
|
|
12571
|
+
if (y.isEmpty()) {
|
|
12572
|
+
let { compositeUserId: t } = j.decomposeParticipantId(e), { id: n } = j.decomposeId(t);
|
|
12573
|
+
return Q.fromId(String(n));
|
|
12574
|
+
}
|
|
12575
|
+
return this._idCache.getExternalId(e);
|
|
12410
12576
|
}
|
|
12411
12577
|
async authorize() {
|
|
12412
12578
|
if (this._ensureUuid(), !M.apiKey) throw new O(x.API, {
|
|
@@ -12425,7 +12591,7 @@ var Ps = class extends Es {
|
|
|
12425
12591
|
let t = { session_data: {
|
|
12426
12592
|
version: 2,
|
|
12427
12593
|
device_id: this._uuid,
|
|
12428
|
-
client_version: M.
|
|
12594
|
+
client_version: M.apiClientVersion,
|
|
12429
12595
|
client_type: "SDK_JS"
|
|
12430
12596
|
} };
|
|
12431
12597
|
return M.authToken && (t.session_data.auth_token = M.authToken, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0).then((e) => {
|
|
@@ -12444,17 +12610,17 @@ var Ps = class extends Es {
|
|
|
12444
12610
|
});
|
|
12445
12611
|
}
|
|
12446
12612
|
_getAnonymLoginCacheKey() {
|
|
12447
|
-
return M.authToken ? `${
|
|
12613
|
+
return M.authToken ? `${Rs}${M.authToken}` : null;
|
|
12448
12614
|
}
|
|
12449
12615
|
_getCachedAnonymLogin() {
|
|
12450
12616
|
let e = this._getAnonymLoginCacheKey();
|
|
12451
12617
|
if (!e) return null;
|
|
12452
12618
|
let t = at.get(e);
|
|
12453
|
-
return
|
|
12619
|
+
return Ks(t) ? t : (t && at.remove(e), null);
|
|
12454
12620
|
}
|
|
12455
12621
|
_setCachedAnonymLogin(e) {
|
|
12456
12622
|
let t = this._getAnonymLoginCacheKey();
|
|
12457
|
-
!t || !
|
|
12623
|
+
!t || !Ks(e) || at.set(t, {
|
|
12458
12624
|
session_key: e.session_key,
|
|
12459
12625
|
session_secret_key: e.session_secret_key,
|
|
12460
12626
|
uid: e.uid
|
|
@@ -12472,7 +12638,7 @@ var Ps = class extends Es {
|
|
|
12472
12638
|
}
|
|
12473
12639
|
async _sendClientStats(e, t = !0) {
|
|
12474
12640
|
try {
|
|
12475
|
-
(await
|
|
12641
|
+
(await js("vchat.clientStats", e))?.items_responses?.forEach((e) => {
|
|
12476
12642
|
e.errors && R.error("[vchat.clientStats]", e);
|
|
12477
12643
|
});
|
|
12478
12644
|
} catch (n) {
|
|
@@ -12483,7 +12649,7 @@ var Ps = class extends Es {
|
|
|
12483
12649
|
}
|
|
12484
12650
|
logClientStats(e) {
|
|
12485
12651
|
let t = {
|
|
12486
|
-
app_version:
|
|
12652
|
+
app_version: M.appVersion,
|
|
12487
12653
|
sdk_type: "WEB",
|
|
12488
12654
|
sdk_version: M.sdkVersion,
|
|
12489
12655
|
version: 1,
|
|
@@ -12502,14 +12668,14 @@ var Ps = class extends Es {
|
|
|
12502
12668
|
}, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
|
|
12503
12669
|
o.append("file", s, "log.json");
|
|
12504
12670
|
let c = new URL(a.upload_url);
|
|
12505
|
-
return c.searchParams.append("size", s.size.toString()),
|
|
12671
|
+
return c.searchParams.append("size", s.size.toString()), Ps(c.toString(), o);
|
|
12506
12672
|
}
|
|
12507
12673
|
async joinConversation(e, t = !1, n) {
|
|
12508
12674
|
let r = {
|
|
12509
12675
|
conversationId: e,
|
|
12510
12676
|
isVideo: t,
|
|
12511
12677
|
protocolVersion: M.protocolVersion,
|
|
12512
|
-
capabilities:
|
|
12678
|
+
capabilities: ja.getFlags()
|
|
12513
12679
|
};
|
|
12514
12680
|
return n && (r.chatId = n), this._call("vchat.joinConversation", r);
|
|
12515
12681
|
}
|
|
@@ -12541,13 +12707,13 @@ var Ps = class extends Es {
|
|
|
12541
12707
|
externalIds: l
|
|
12542
12708
|
});
|
|
12543
12709
|
if (t && t.length) switch (n) {
|
|
12544
|
-
case
|
|
12710
|
+
case Za.USER:
|
|
12545
12711
|
u.uids = t.join(",");
|
|
12546
12712
|
break;
|
|
12547
|
-
case
|
|
12713
|
+
case Za.GROUP:
|
|
12548
12714
|
u.gid = t[0];
|
|
12549
12715
|
break;
|
|
12550
|
-
case
|
|
12716
|
+
case Za.CHAT:
|
|
12551
12717
|
u.chatId = t[0];
|
|
12552
12718
|
break;
|
|
12553
12719
|
}
|
|
@@ -12590,17 +12756,14 @@ var Ps = class extends Es {
|
|
|
12590
12756
|
joinLink: e,
|
|
12591
12757
|
isVideo: t,
|
|
12592
12758
|
protocolVersion: M.protocolVersion,
|
|
12593
|
-
capabilities:
|
|
12759
|
+
capabilities: ja.getFlags()
|
|
12594
12760
|
};
|
|
12595
12761
|
return n?.length && (i.observedIds = n.join(",")), M.anonymToken && (i.anonymToken = M.anonymToken), r && (i.payload = r), this._call("vchat.joinConversationByLink", i);
|
|
12596
12762
|
}
|
|
12597
|
-
|
|
12598
|
-
return this._idCache.
|
|
12599
|
-
}
|
|
12600
|
-
getCachedRawOkIdByExternalId(e) {
|
|
12601
|
-
return this._idCache.getOkId(e);
|
|
12763
|
+
getCachedParticipantIdByExternalId(e) {
|
|
12764
|
+
return this._idCache.getParticipantId(e);
|
|
12602
12765
|
}
|
|
12603
|
-
|
|
12766
|
+
getCachedExternalIdByParticipantId(e) {
|
|
12604
12767
|
return this._idCache.getExternalId(e);
|
|
12605
12768
|
}
|
|
12606
12769
|
cacheExternalId(e, t) {
|
|
@@ -12615,9 +12778,6 @@ var Ps = class extends Es {
|
|
|
12615
12778
|
getDecorativeIdByInitialId(e) {
|
|
12616
12779
|
return this._idCache.getDecorativeIdByInitialId(e);
|
|
12617
12780
|
}
|
|
12618
|
-
replaceByInitialIdIdIfExists(e) {
|
|
12619
|
-
return this._idCache.replaceByInitialIdIdIfExists(e);
|
|
12620
|
-
}
|
|
12621
12781
|
async getConversationParams(e) {
|
|
12622
12782
|
let t = {};
|
|
12623
12783
|
return M.anonymToken && (t.anonymToken = M.anonymToken), e && (t.conversationId = e), this._call("vchat.getConversationParams", t);
|
|
@@ -12633,7 +12793,7 @@ var Ps = class extends Es {
|
|
|
12633
12793
|
conversationId: e,
|
|
12634
12794
|
reason: t
|
|
12635
12795
|
};
|
|
12636
|
-
M.anonymToken && (r.anonymToken = M.anonymToken), n?.peerId && (r.peerId = n.peerId),
|
|
12796
|
+
M.anonymToken && (r.anonymToken = M.anonymToken), n?.peerId && (r.peerId = n.peerId), ks("vchat.hangupConversation", r);
|
|
12637
12797
|
}
|
|
12638
12798
|
async removeHistoryRecords(e) {
|
|
12639
12799
|
await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
|
|
@@ -12649,19 +12809,19 @@ var Ps = class extends Es {
|
|
|
12649
12809
|
return Array.isArray(e?.inbounds) ? e.inbounds : [];
|
|
12650
12810
|
}
|
|
12651
12811
|
};
|
|
12652
|
-
function
|
|
12812
|
+
function Gs(e) {
|
|
12653
12813
|
return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
|
|
12654
12814
|
}
|
|
12655
|
-
function
|
|
12815
|
+
function Ks(e) {
|
|
12656
12816
|
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;
|
|
12657
12817
|
}
|
|
12658
12818
|
//#endregion
|
|
12659
12819
|
//#region src/enums/RecordRole.ts
|
|
12660
|
-
var
|
|
12820
|
+
var qs = /* @__PURE__ */ function(e) {
|
|
12661
12821
|
return e.KING = "KING", e.PAWN = "PAWN", e;
|
|
12662
|
-
}(
|
|
12822
|
+
}(qs || {}), Js = /* @__PURE__ */ function(e) {
|
|
12663
12823
|
return e.OFF = "0", e.ON = "1", e;
|
|
12664
|
-
}({}),
|
|
12824
|
+
}({}), Ys = class {
|
|
12665
12825
|
constructor(e) {
|
|
12666
12826
|
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;
|
|
12667
12827
|
}
|
|
@@ -12684,21 +12844,21 @@ var Ls = /* @__PURE__ */ function(e) {
|
|
|
12684
12844
|
let e = this._queue[this._readCursor];
|
|
12685
12845
|
return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
|
|
12686
12846
|
}
|
|
12687
|
-
},
|
|
12847
|
+
}, Xs = class {
|
|
12688
12848
|
constructor(e, t, n, r = null) {
|
|
12689
12849
|
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 = j.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
|
|
12690
12850
|
}
|
|
12691
12851
|
async authorize() {
|
|
12692
|
-
let e = await
|
|
12852
|
+
let e = await As("auth.anonymLogin", {
|
|
12693
12853
|
session_data: {
|
|
12694
12854
|
device_id: this._uuid,
|
|
12695
|
-
client_version: M.
|
|
12855
|
+
client_version: M.apiClientVersion,
|
|
12696
12856
|
client_type: "SDK_JS",
|
|
12697
12857
|
auth_token: this._callToken,
|
|
12698
12858
|
version: 3
|
|
12699
12859
|
},
|
|
12700
12860
|
application_key: this._apiKey
|
|
12701
|
-
}, !0, await
|
|
12861
|
+
}, !0, await Ds(this._baseApiUrl, this._apiEnv));
|
|
12702
12862
|
return j.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
|
|
12703
12863
|
}
|
|
12704
12864
|
async hangupConversation(e, t) {
|
|
@@ -12708,9 +12868,9 @@ var Ls = /* @__PURE__ */ function(e) {
|
|
|
12708
12868
|
application_key: this._apiKey,
|
|
12709
12869
|
session_key: this._sessionKey
|
|
12710
12870
|
};
|
|
12711
|
-
t?.peerId && (n.peerId = t.peerId), await
|
|
12871
|
+
t?.peerId && (n.peerId = t.peerId), await As("vchat.hangupConversation", n, !0, await Ds(this._baseApiUrl, this._apiEnv));
|
|
12712
12872
|
}
|
|
12713
|
-
},
|
|
12873
|
+
}, Zs, Qs = null, $s = {
|
|
12714
12874
|
getCameras: T.getCameras,
|
|
12715
12875
|
getMicrophones: T.getMicrophones,
|
|
12716
12876
|
getOutput: T.getOutput,
|
|
@@ -12736,27 +12896,27 @@ var Ls = /* @__PURE__ */ function(e) {
|
|
|
12736
12896
|
baseChromeVersion: T.baseChromeVersion,
|
|
12737
12897
|
getAudioContext: T.getAudioContext,
|
|
12738
12898
|
isAudioShareSupported: T.isAudioShareSupported
|
|
12739
|
-
},
|
|
12740
|
-
function
|
|
12741
|
-
|
|
12899
|
+
}, ec = { participantMarkerCompare: j.participantMarkerCompare };
|
|
12900
|
+
function tc(e) {
|
|
12901
|
+
Qs = e;
|
|
12742
12902
|
}
|
|
12743
|
-
function
|
|
12903
|
+
function nc(e) {
|
|
12744
12904
|
M.videoEffects = e;
|
|
12745
12905
|
}
|
|
12746
|
-
function
|
|
12906
|
+
function rc(e) {
|
|
12747
12907
|
M.audioEffects = e;
|
|
12748
12908
|
}
|
|
12749
|
-
function
|
|
12909
|
+
function ic(e, t = {}) {
|
|
12750
12910
|
M.vad = e, M.vadOptions = t;
|
|
12751
12911
|
}
|
|
12752
|
-
function
|
|
12912
|
+
function ac(e, t = null, n = {}, r = 1) {
|
|
12753
12913
|
M.vmoji = e, M.vmojiOptions = {
|
|
12754
12914
|
protocolVersion: r,
|
|
12755
12915
|
renderingOptions: n
|
|
12756
12916
|
}, t && e.setSDK(t);
|
|
12757
12917
|
}
|
|
12758
|
-
async function
|
|
12759
|
-
M.set(t),
|
|
12918
|
+
async function oc(t) {
|
|
12919
|
+
M.set(t), Zs || (Zs = new Ws()), e.disableLog(!M.debug), R.toggle(M.debug), R.log(`Calls SDK ${M.sdkVersion}`, t), await T.init();
|
|
12760
12920
|
let n = T.getBrowserSupportFailure();
|
|
12761
12921
|
if (n) throw new O(x.UNSUPPORTED, { callError: {
|
|
12762
12922
|
scope: "internal",
|
|
@@ -12765,19 +12925,19 @@ async function Xs(t) {
|
|
|
12765
12925
|
} });
|
|
12766
12926
|
R.log("UserAgent:", navigator.userAgent), R.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), R.log("Permissions:", `Camera: ${T.hasCameraPermission()}, Mic: ${T.hasMicrophonePermission()}`), R.log("Simulcast:", `${t.simulcast} => ${M.simulcast}`);
|
|
12767
12927
|
}
|
|
12768
|
-
async function
|
|
12928
|
+
async function sc(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
|
|
12769
12929
|
let c = [];
|
|
12770
|
-
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]),
|
|
12930
|
+
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), lc([], Za.USER, t, n, r, i, a, c, o, s);
|
|
12771
12931
|
}
|
|
12772
|
-
function
|
|
12932
|
+
function cc(e, t = []) {
|
|
12773
12933
|
let n = e.getIncomingCallerExternalId();
|
|
12774
12934
|
return n ? t.length === 1 && t[0].id === n.id && t[0].type === n.type : !1;
|
|
12775
12935
|
}
|
|
12776
|
-
async function
|
|
12936
|
+
async function lc(e, t = Za.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
12777
12937
|
if (!M.hold && z.getActive()) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
|
|
12778
12938
|
let u = z.getAll().find((e) => e.isIncomingRinging);
|
|
12779
|
-
if (!M.hold && u && !
|
|
12780
|
-
return new $(new
|
|
12939
|
+
if (!M.hold && u && !cc(u, s)) throw R.error("There is already incoming call"), new O(D.HAS_ACTIVE_CALL);
|
|
12940
|
+
return new $(new Ws(), Qs).onStart({
|
|
12781
12941
|
opponentIds: e,
|
|
12782
12942
|
opponentType: t,
|
|
12783
12943
|
mediaOptions: n,
|
|
@@ -12790,40 +12950,40 @@ async function $s(e, t = Va.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
|
12790
12950
|
conversationId: l
|
|
12791
12951
|
});
|
|
12792
12952
|
}
|
|
12793
|
-
async function
|
|
12794
|
-
return
|
|
12953
|
+
async function uc(e, t) {
|
|
12954
|
+
return dc(e, A.USER, void 0, t);
|
|
12795
12955
|
}
|
|
12796
|
-
async function
|
|
12956
|
+
async function dc(e, t = A.USER, n, r, i, a) {
|
|
12797
12957
|
if (e === $.id()) throw Error("Push has already been processed");
|
|
12798
|
-
return new $(new
|
|
12958
|
+
return new $(new Ws(), Qs).onPush(e, t, n, r, i, a);
|
|
12799
12959
|
}
|
|
12800
|
-
async function
|
|
12801
|
-
return
|
|
12960
|
+
async function fc() {
|
|
12961
|
+
return Zs.getInbounds();
|
|
12802
12962
|
}
|
|
12803
|
-
async function
|
|
12804
|
-
return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t,
|
|
12963
|
+
async function pc(e, t) {
|
|
12964
|
+
return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t, Ts()), Zs.authorize();
|
|
12805
12965
|
}
|
|
12806
|
-
async function
|
|
12807
|
-
return
|
|
12966
|
+
async function mc(e = [S.AUDIO], t) {
|
|
12967
|
+
return zl(t).accept(e);
|
|
12808
12968
|
}
|
|
12809
|
-
async function
|
|
12810
|
-
let t =
|
|
12969
|
+
async function hc(e) {
|
|
12970
|
+
let t = Il(e?.conversationId);
|
|
12811
12971
|
if (t) return t.decline(e);
|
|
12812
12972
|
}
|
|
12813
|
-
async function
|
|
12814
|
-
return
|
|
12973
|
+
async function gc(e, t = [S.AUDIO]) {
|
|
12974
|
+
return _c(e, t);
|
|
12815
12975
|
}
|
|
12816
|
-
async function
|
|
12976
|
+
async function _c(e, t, n) {
|
|
12817
12977
|
if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
|
|
12818
|
-
return new $(new
|
|
12978
|
+
return new $(new Ws(), Qs).onJoin({
|
|
12819
12979
|
conversationId: e,
|
|
12820
12980
|
mediaOptions: t,
|
|
12821
12981
|
chatId: n
|
|
12822
12982
|
});
|
|
12823
12983
|
}
|
|
12824
|
-
async function
|
|
12984
|
+
async function vc(e, t = [S.AUDIO], n, r, i, a) {
|
|
12825
12985
|
if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
|
|
12826
|
-
return n && (M.anonymToken = n), new $(new
|
|
12986
|
+
return n && (M.anonymToken = n), new $(new Ws(), Qs).onJoin({
|
|
12827
12987
|
joinLink: e,
|
|
12828
12988
|
mediaOptions: t,
|
|
12829
12989
|
observedIds: r,
|
|
@@ -12832,30 +12992,30 @@ async function cc(e, t = [S.AUDIO], n, r, i, a) {
|
|
|
12832
12992
|
anonymous: !!M.anonymToken
|
|
12833
12993
|
});
|
|
12834
12994
|
}
|
|
12835
|
-
function
|
|
12836
|
-
let t =
|
|
12995
|
+
function yc(e) {
|
|
12996
|
+
let t = Il(e?.conversationId);
|
|
12837
12997
|
return t ? t.hangup(e) : ($.hangupAfterInit(e?.onFastHangup), Promise.resolve());
|
|
12838
12998
|
}
|
|
12839
|
-
async function
|
|
12999
|
+
async function bc(e, t) {
|
|
12840
13000
|
let n = Array.isArray(e) ? e : [e], r = $.current();
|
|
12841
13001
|
r && await r.addParticipant(n, t);
|
|
12842
13002
|
}
|
|
12843
|
-
async function
|
|
13003
|
+
async function xc(e, t) {
|
|
12844
13004
|
let n = $.current();
|
|
12845
13005
|
if (n) {
|
|
12846
13006
|
let r = e.map((e) => j.composeUserId(e));
|
|
12847
13007
|
await n.addParticipantLegacy(r, t);
|
|
12848
13008
|
}
|
|
12849
13009
|
}
|
|
12850
|
-
async function
|
|
12851
|
-
let n =
|
|
12852
|
-
if (
|
|
12853
|
-
|
|
12854
|
-
|
|
13010
|
+
async function Sc(e, t = !1) {
|
|
13011
|
+
let n = Bl(e, "removeParticipant");
|
|
13012
|
+
if (n) try {
|
|
13013
|
+
await n.conversation.removeParticipant(j.decomposeParticipantId(n.participantId).compositeUserId, t);
|
|
13014
|
+
} catch (e) {
|
|
13015
|
+
R.warn(`Failed to remove participant ${n.participantId}. Perhaps he is no longer on the call. ${e}`);
|
|
12855
13016
|
}
|
|
12856
|
-
return pc(n, t);
|
|
12857
13017
|
}
|
|
12858
|
-
async function
|
|
13018
|
+
async function Cc(e, t = !1) {
|
|
12859
13019
|
let n = $.current();
|
|
12860
13020
|
if (n) try {
|
|
12861
13021
|
await n.removeParticipant(j.composeUserId(e), t);
|
|
@@ -12863,13 +13023,13 @@ async function pc(e, t = !1) {
|
|
|
12863
13023
|
R.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
|
|
12864
13024
|
}
|
|
12865
13025
|
}
|
|
12866
|
-
async function
|
|
13026
|
+
async function wc(e, t) {
|
|
12867
13027
|
let n = $.current();
|
|
12868
13028
|
if (e === "videoinput" && jt.contains(t)) return M.videoFacingMode = t, n ? (T.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
|
|
12869
13029
|
if (!await T._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
|
|
12870
13030
|
if (n) return n.changeDevice(e);
|
|
12871
13031
|
}
|
|
12872
|
-
async function
|
|
13032
|
+
async function Tc(e, t) {
|
|
12873
13033
|
let n = typeof e == "object" ? {
|
|
12874
13034
|
...e,
|
|
12875
13035
|
fastScreenSharing: e.captureScreen && e.fastScreenSharing,
|
|
@@ -12878,267 +13038,264 @@ async function hc(e, t) {
|
|
|
12878
13038
|
captureScreen: e,
|
|
12879
13039
|
fastScreenSharing: !1,
|
|
12880
13040
|
captureAudio: !1
|
|
12881
|
-
}, r =
|
|
13041
|
+
}, r = Il(t);
|
|
12882
13042
|
return r ? r.toggleScreenCapturing(n) : Promise.reject();
|
|
12883
13043
|
}
|
|
12884
|
-
function
|
|
13044
|
+
function Ec(e) {
|
|
12885
13045
|
let t = $.current();
|
|
12886
13046
|
t && t.toggleAnimojiCapturing(e);
|
|
12887
13047
|
}
|
|
12888
|
-
async function
|
|
13048
|
+
async function Dc(e, t = !1) {
|
|
12889
13049
|
let n = $.current();
|
|
12890
13050
|
n && await n.setVideoStream(e, t);
|
|
12891
13051
|
}
|
|
12892
|
-
async function
|
|
12893
|
-
let n =
|
|
13052
|
+
async function Oc(e, t) {
|
|
13053
|
+
let n = Il(t);
|
|
12894
13054
|
n && await n.toggleLocalVideo(e);
|
|
12895
13055
|
}
|
|
12896
|
-
async function
|
|
12897
|
-
let n =
|
|
13056
|
+
async function kc(e, t) {
|
|
13057
|
+
let n = Il(t);
|
|
12898
13058
|
n && await n.toggleLocalAudio(e);
|
|
12899
13059
|
}
|
|
12900
|
-
async function
|
|
13060
|
+
async function Ac(e) {
|
|
12901
13061
|
let t = $.current();
|
|
12902
13062
|
if (t) return t.setLocalResolution(e);
|
|
12903
13063
|
}
|
|
12904
|
-
async function
|
|
13064
|
+
async function jc(e) {
|
|
12905
13065
|
let t = $.current();
|
|
12906
13066
|
t && await t.changePriorities(e);
|
|
12907
13067
|
}
|
|
12908
|
-
async function
|
|
13068
|
+
async function Mc(e, t) {
|
|
12909
13069
|
let n = $.current();
|
|
12910
13070
|
if (n) {
|
|
12911
|
-
let r;
|
|
12912
13071
|
if (t) {
|
|
12913
|
-
let
|
|
12914
|
-
if (!
|
|
12915
|
-
|
|
13072
|
+
let r = n.getCachedParticipantIdByExternalId(t);
|
|
13073
|
+
if (!r) {
|
|
13074
|
+
Ll(t, "changeParticipantState", n);
|
|
12916
13075
|
return;
|
|
12917
13076
|
}
|
|
12918
|
-
|
|
13077
|
+
await n.changeParticipantState(e, r);
|
|
13078
|
+
return;
|
|
12919
13079
|
}
|
|
12920
|
-
await n.changeParticipantState(e
|
|
13080
|
+
await n.changeParticipantState(e);
|
|
12921
13081
|
}
|
|
12922
13082
|
}
|
|
12923
|
-
async function
|
|
13083
|
+
async function Nc() {
|
|
12924
13084
|
let e = $.current();
|
|
12925
13085
|
e && await e.putHandsDown();
|
|
12926
13086
|
}
|
|
12927
|
-
async function
|
|
13087
|
+
async function Pc(e) {
|
|
12928
13088
|
let t = $.current();
|
|
12929
13089
|
t && await t.updateDisplayLayout(e);
|
|
12930
13090
|
}
|
|
12931
|
-
async function
|
|
13091
|
+
async function Fc(e) {
|
|
12932
13092
|
let t = $.current();
|
|
12933
13093
|
t && await t.requestDisplayLayout(e);
|
|
12934
13094
|
}
|
|
12935
|
-
async function
|
|
12936
|
-
let r =
|
|
12937
|
-
|
|
12938
|
-
R.warn("grantRoles: externalId not found in cache", e);
|
|
12939
|
-
return;
|
|
12940
|
-
}
|
|
12941
|
-
return Dc(r, Q.getDeviceIdx(e), t, n);
|
|
13095
|
+
async function Ic(e, t, n = !1) {
|
|
13096
|
+
let r = Bl(e, "grantRoles");
|
|
13097
|
+
r && await r.conversation.grantRoles(r.participantId, t, n);
|
|
12942
13098
|
}
|
|
12943
|
-
async function
|
|
13099
|
+
async function Lc(e, t, n, r = !1) {
|
|
12944
13100
|
let i = $.current();
|
|
12945
13101
|
i && await i.grantRoles(j.composeParticipantId(e, A.USER, t), n, r);
|
|
12946
13102
|
}
|
|
12947
|
-
async function
|
|
12948
|
-
|
|
12949
|
-
|
|
12950
|
-
|
|
12951
|
-
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
roomId: r
|
|
12955
|
-
});
|
|
13103
|
+
async function Rc({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
|
|
13104
|
+
if (e) {
|
|
13105
|
+
let i = Bl(e, "muteParticipant");
|
|
13106
|
+
return i ? i.conversation.muteParticipant(i.participantId, t, n, r) : void 0;
|
|
13107
|
+
}
|
|
13108
|
+
let i = $.current();
|
|
13109
|
+
i && await i.muteParticipant(null, t, n, r);
|
|
12956
13110
|
}
|
|
12957
|
-
async function
|
|
13111
|
+
async function zc({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
|
|
12958
13112
|
let a = $.current();
|
|
12959
13113
|
if (a) {
|
|
12960
13114
|
let o = e ? j.composeParticipantId(e, A.USER, r) : null;
|
|
12961
13115
|
await a.muteParticipant(o, t, n, i);
|
|
12962
13116
|
}
|
|
12963
13117
|
}
|
|
12964
|
-
async function
|
|
12965
|
-
let r =
|
|
12966
|
-
|
|
12967
|
-
R.warn("pinParticipant: externalId not found in cache", e);
|
|
12968
|
-
return;
|
|
12969
|
-
}
|
|
12970
|
-
return jc(r, t, Q.getDeviceIdx(e), n);
|
|
13118
|
+
async function Bc(e, t = !1, n = null) {
|
|
13119
|
+
let r = Bl(e, "pinParticipant");
|
|
13120
|
+
r && await r.conversation.pinParticipant(r.participantId, t, n);
|
|
12971
13121
|
}
|
|
12972
|
-
async function
|
|
13122
|
+
async function Vc(e, t = !1, n = 0, r = null) {
|
|
12973
13123
|
let i = $.current();
|
|
12974
13124
|
i && await i.pinParticipant(j.composeParticipantId(e, A.USER, n), t, r);
|
|
12975
13125
|
}
|
|
12976
|
-
async function
|
|
13126
|
+
async function Hc(e) {
|
|
12977
13127
|
let t = $.current();
|
|
12978
13128
|
t && await t.updateMediaModifiers(e);
|
|
12979
13129
|
}
|
|
12980
|
-
async function
|
|
13130
|
+
async function Uc(e) {
|
|
12981
13131
|
let t = $.current();
|
|
12982
13132
|
t && await t.enableVideoSuspend(e);
|
|
12983
13133
|
}
|
|
12984
|
-
async function
|
|
13134
|
+
async function Wc(e) {
|
|
12985
13135
|
let t = $.current();
|
|
12986
13136
|
t && await t.enableVideoSuspendSuggest(e);
|
|
12987
13137
|
}
|
|
12988
|
-
async function
|
|
13138
|
+
async function Gc(e) {
|
|
12989
13139
|
let t = $.current();
|
|
12990
13140
|
t && await t.changeOptions(e);
|
|
12991
13141
|
}
|
|
12992
|
-
async function
|
|
12993
|
-
|
|
12994
|
-
|
|
13142
|
+
async function Kc(e, t = null) {
|
|
13143
|
+
if (t) {
|
|
13144
|
+
let n = Bl(t, "chatMessage");
|
|
13145
|
+
return n ? n.conversation.chatMessage(e, j.decomposeParticipantId(n.participantId).compositeUserId) : void 0;
|
|
13146
|
+
}
|
|
13147
|
+
let n = $.current();
|
|
13148
|
+
n && await n.chatMessage(e, null);
|
|
12995
13149
|
}
|
|
12996
|
-
async function
|
|
13150
|
+
async function qc(e, t = null) {
|
|
12997
13151
|
let n = $.current();
|
|
12998
13152
|
if (n) {
|
|
12999
13153
|
let r = t ? j.composeUserId(t) : null;
|
|
13000
13154
|
await n.chatMessage(e, r);
|
|
13001
13155
|
}
|
|
13002
13156
|
}
|
|
13003
|
-
async function
|
|
13157
|
+
async function Jc(e = 10) {
|
|
13004
13158
|
let t = $.current();
|
|
13005
13159
|
if (t) return t.chatHistory(e);
|
|
13006
13160
|
}
|
|
13007
|
-
async function
|
|
13008
|
-
|
|
13009
|
-
|
|
13161
|
+
async function Yc(e, t = null) {
|
|
13162
|
+
if (t) {
|
|
13163
|
+
let n = Bl(t, "customData");
|
|
13164
|
+
return n ? n.conversation.customData(e, n.participantId) : void 0;
|
|
13165
|
+
}
|
|
13166
|
+
let n = $.current();
|
|
13167
|
+
n && await n.customData(e, null);
|
|
13010
13168
|
}
|
|
13011
|
-
async function
|
|
13169
|
+
async function Xc(e, t = null, n = 0) {
|
|
13012
13170
|
let r = $.current();
|
|
13013
13171
|
if (r) {
|
|
13014
13172
|
let i = t ? j.composeParticipantId(t, A.USER, n) : null;
|
|
13015
13173
|
await r.customData(e, i);
|
|
13016
13174
|
}
|
|
13017
13175
|
}
|
|
13018
|
-
async function
|
|
13019
|
-
return (await
|
|
13176
|
+
async function Zc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
|
|
13177
|
+
return (await Zs.createConversation(a ?? j.uuid(), e, t, {
|
|
13020
13178
|
onlyAdminCanShareMovie: n,
|
|
13021
13179
|
waitForAdmin: r,
|
|
13022
13180
|
closedConversation: i
|
|
13023
13181
|
})).join_link;
|
|
13024
13182
|
}
|
|
13025
|
-
async function
|
|
13183
|
+
async function Qc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
|
|
13026
13184
|
let a = i.map((e) => Q.fromId(e));
|
|
13027
|
-
return (await
|
|
13185
|
+
return (await Zs.createConversation(j.uuid(), e, t, {
|
|
13028
13186
|
onlyAdminCanShareMovie: n,
|
|
13029
13187
|
audienceMode: !0,
|
|
13030
13188
|
audioOnly: r
|
|
13031
13189
|
}, a)).join_link;
|
|
13032
13190
|
}
|
|
13033
|
-
async function
|
|
13191
|
+
async function $c() {
|
|
13034
13192
|
let e = $.current();
|
|
13035
13193
|
return e ? e.createJoinLink() : Promise.reject();
|
|
13036
13194
|
}
|
|
13037
|
-
async function
|
|
13195
|
+
async function el() {
|
|
13038
13196
|
let e = $.current();
|
|
13039
13197
|
return e ? e.removeJoinLink() : Promise.reject();
|
|
13040
13198
|
}
|
|
13041
|
-
async function
|
|
13042
|
-
return
|
|
13199
|
+
async function tl(e, t) {
|
|
13200
|
+
return Zs.getAnonymTokenByLink(e, t);
|
|
13043
13201
|
}
|
|
13044
|
-
function
|
|
13202
|
+
function nl(e) {
|
|
13045
13203
|
let t = $.current();
|
|
13046
13204
|
t && t.setVolume(e);
|
|
13047
13205
|
}
|
|
13048
|
-
function
|
|
13206
|
+
function rl(e) {
|
|
13049
13207
|
M.forceRelayPolicy = e;
|
|
13050
13208
|
}
|
|
13051
|
-
async function
|
|
13209
|
+
async function il(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
|
|
13052
13210
|
let o = $.current();
|
|
13053
13211
|
return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
|
|
13054
13212
|
}
|
|
13055
|
-
async function
|
|
13213
|
+
async function al(e = null, t) {
|
|
13056
13214
|
let n = $.current();
|
|
13057
13215
|
return n ? n.stopStream(e, t) : Promise.reject();
|
|
13058
13216
|
}
|
|
13059
|
-
async function
|
|
13217
|
+
async function ol(e = null) {
|
|
13060
13218
|
let t = $.current();
|
|
13061
13219
|
return t ? t.publishStream(e) : Promise.reject();
|
|
13062
13220
|
}
|
|
13063
|
-
async function
|
|
13221
|
+
async function sl() {
|
|
13064
13222
|
let e = $.current();
|
|
13065
13223
|
return e ? e.getStreamInfo() : Promise.reject();
|
|
13066
13224
|
}
|
|
13067
|
-
async function
|
|
13225
|
+
async function cl(e) {
|
|
13068
13226
|
let t = $.current();
|
|
13069
13227
|
return t ? t.addMovie(e) : Promise.reject();
|
|
13070
13228
|
}
|
|
13071
|
-
async function
|
|
13229
|
+
async function ll(e) {
|
|
13072
13230
|
let t = $.current();
|
|
13073
13231
|
return t ? t.updateMovie(e) : Promise.reject();
|
|
13074
13232
|
}
|
|
13075
|
-
async function
|
|
13233
|
+
async function ul(e) {
|
|
13076
13234
|
let t = $.current();
|
|
13077
13235
|
return t ? t.removeMovie(e) : Promise.reject();
|
|
13078
13236
|
}
|
|
13079
|
-
async function
|
|
13237
|
+
async function dl(e, t) {
|
|
13080
13238
|
let n = $.current();
|
|
13081
13239
|
if (n) {
|
|
13082
|
-
let r = [];
|
|
13240
|
+
let r = [], i = [];
|
|
13083
13241
|
for (let t of e) {
|
|
13084
|
-
let e,
|
|
13242
|
+
let e, a;
|
|
13085
13243
|
t.addParticipantIds && (e = [], t.addParticipantIds.forEach((t) => {
|
|
13086
|
-
let r = n.
|
|
13087
|
-
r ? e.push(j.
|
|
13088
|
-
})), t.removeParticipantIds && (
|
|
13089
|
-
let t = n.
|
|
13090
|
-
t ?
|
|
13244
|
+
let r = n.getCachedParticipantIdByExternalId(t);
|
|
13245
|
+
r ? e.push(j.decomposeParticipantId(r).compositeUserId) : i.push(t.id);
|
|
13246
|
+
})), t.removeParticipantIds && (a = [], t.removeParticipantIds.forEach((e) => {
|
|
13247
|
+
let t = n.getCachedParticipantIdByExternalId(e);
|
|
13248
|
+
t ? a.push(j.decomposeParticipantId(t).compositeUserId) : i.push(e.id);
|
|
13091
13249
|
})), r.push({
|
|
13092
13250
|
id: t.id,
|
|
13093
13251
|
name: t.name,
|
|
13094
13252
|
participantCount: t.participantCount,
|
|
13095
13253
|
addParticipantIds: e,
|
|
13096
|
-
removeParticipantIds:
|
|
13254
|
+
removeParticipantIds: a,
|
|
13097
13255
|
countdownSec: t.countdownSec
|
|
13098
13256
|
});
|
|
13099
13257
|
}
|
|
13258
|
+
if (i.length) {
|
|
13259
|
+
Rl(i, "updateRooms", n);
|
|
13260
|
+
return;
|
|
13261
|
+
}
|
|
13100
13262
|
return n.updateRooms(r, t);
|
|
13101
13263
|
}
|
|
13102
13264
|
return Promise.reject();
|
|
13103
13265
|
}
|
|
13104
|
-
async function
|
|
13266
|
+
async function fl(e, t) {
|
|
13105
13267
|
let n = $.current();
|
|
13106
13268
|
return n ? n.activateRooms(e, t) : Promise.reject();
|
|
13107
13269
|
}
|
|
13108
|
-
async function
|
|
13270
|
+
async function pl(e = null, t = null) {
|
|
13109
13271
|
let n = $.current();
|
|
13110
13272
|
if (!n) return Promise.reject();
|
|
13111
13273
|
let r;
|
|
13112
|
-
if (t) {
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
R.warn("switchRoom: externalId not found in cache", t);
|
|
13116
|
-
return;
|
|
13117
|
-
}
|
|
13118
|
-
let i = Q.getDeviceIdx(t);
|
|
13119
|
-
r = j.composeParticipantId(e, A.USER, i);
|
|
13274
|
+
if (t && (r = n.getCachedParticipantIdByExternalId(t) ?? void 0, !r)) {
|
|
13275
|
+
Ll(t, "switchRoom", n);
|
|
13276
|
+
return;
|
|
13120
13277
|
}
|
|
13121
13278
|
return n.switchRoom(e, r);
|
|
13122
13279
|
}
|
|
13123
|
-
async function
|
|
13280
|
+
async function ml(e) {
|
|
13124
13281
|
let t = $.current();
|
|
13125
13282
|
return t ? t.removeRooms(e) : Promise.reject();
|
|
13126
13283
|
}
|
|
13127
|
-
function
|
|
13284
|
+
function hl(e) {
|
|
13128
13285
|
M.statisticsInterval = e;
|
|
13129
13286
|
let t = $.current();
|
|
13130
13287
|
if (t) return t.updateStatisticsInterval();
|
|
13131
13288
|
}
|
|
13132
|
-
function
|
|
13289
|
+
function gl(t) {
|
|
13133
13290
|
e.disableLog(!t), R.toggle(t);
|
|
13134
13291
|
}
|
|
13135
|
-
function
|
|
13292
|
+
function _l(e, ...t) {
|
|
13136
13293
|
M.debugLog && ($.debugMessage(e, "[external]", ...t) || R.send(e, "[external]", ...t));
|
|
13137
13294
|
}
|
|
13138
|
-
function
|
|
13295
|
+
function vl(e, t, ...n) {
|
|
13139
13296
|
M.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || R.send(e, "[external]", ...n));
|
|
13140
13297
|
}
|
|
13141
|
-
var
|
|
13298
|
+
var yl = {
|
|
13142
13299
|
list: Ne,
|
|
13143
13300
|
get: Pe,
|
|
13144
13301
|
getJson: Fe,
|
|
@@ -13146,7 +13303,7 @@ var ll = {
|
|
|
13146
13303
|
clear: Le,
|
|
13147
13304
|
stats: Re
|
|
13148
13305
|
};
|
|
13149
|
-
function
|
|
13306
|
+
function bl() {
|
|
13150
13307
|
let e = [
|
|
13151
13308
|
[`Calls SDK ${M.sdkVersion}`, M.toJSON()],
|
|
13152
13309
|
["UserAgent:", navigator.userAgent],
|
|
@@ -13163,124 +13320,139 @@ function ul() {
|
|
|
13163
13320
|
d: e
|
|
13164
13321
|
}));
|
|
13165
13322
|
}
|
|
13166
|
-
async function
|
|
13323
|
+
async function xl() {
|
|
13167
13324
|
let e = $.id(), t = $.debugSessionId();
|
|
13168
13325
|
if (!t || !e) throw R.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
|
|
13169
13326
|
let n = await Pe({ sessionId: t });
|
|
13170
13327
|
if (n.length === 0) throw R.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
|
|
13171
13328
|
let r = n[0].t, i = n[n.length - 1].t;
|
|
13172
13329
|
try {
|
|
13173
|
-
return
|
|
13330
|
+
return Zs?.uploadDebugLogs(e, r, i, JSON.stringify([...bl(), ...n]));
|
|
13174
13331
|
} catch (e) {
|
|
13175
13332
|
throw R.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
|
|
13176
13333
|
}
|
|
13177
13334
|
}
|
|
13178
|
-
async function
|
|
13335
|
+
async function Sl(e) {
|
|
13179
13336
|
let t = $.current();
|
|
13180
13337
|
if (t) return t.videoEffect(e);
|
|
13181
13338
|
}
|
|
13182
|
-
async function
|
|
13339
|
+
async function Cl(e, t) {
|
|
13183
13340
|
let n = $.current();
|
|
13184
13341
|
if (n) return n.audioEffect(e.length > 0 ? e : null, t);
|
|
13185
13342
|
}
|
|
13186
|
-
async function
|
|
13343
|
+
async function wl(e) {
|
|
13187
13344
|
let t = $.current();
|
|
13188
13345
|
t && await t.setAudioStream(e);
|
|
13189
13346
|
}
|
|
13190
|
-
async function
|
|
13347
|
+
async function Tl(e, t = null, n = null) {
|
|
13191
13348
|
let r = $.current();
|
|
13192
13349
|
if (!r) return;
|
|
13193
13350
|
let i = n ?? t?.id, a = null;
|
|
13194
|
-
if (t) {
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
a = j.composeParticipantId(e, A.USER, Q.getDeviceIdx(t));
|
|
13351
|
+
if (t && (a = r.getCachedParticipantIdByExternalId(t), !a)) {
|
|
13352
|
+
Ll(t, "setVmojiSvg", r);
|
|
13353
|
+
return;
|
|
13198
13354
|
}
|
|
13199
13355
|
r.setAnimojiSvg(e, a, i);
|
|
13200
13356
|
}
|
|
13201
|
-
function
|
|
13357
|
+
function El(e) {
|
|
13202
13358
|
let t = $.current();
|
|
13203
13359
|
t && t.setAnimojiFill(e);
|
|
13204
13360
|
}
|
|
13205
|
-
async function
|
|
13206
|
-
return
|
|
13361
|
+
async function Dl(e = null, t, n = !1) {
|
|
13362
|
+
return zl().getWaitingHall(e, t, n);
|
|
13207
13363
|
}
|
|
13208
|
-
async function
|
|
13209
|
-
return
|
|
13364
|
+
async function Ol() {
|
|
13365
|
+
return zl().getAudienceModeHands();
|
|
13210
13366
|
}
|
|
13211
|
-
async function
|
|
13212
|
-
let n =
|
|
13367
|
+
async function kl(e, t = !1) {
|
|
13368
|
+
let n = zl(), r;
|
|
13213
13369
|
if (e) {
|
|
13214
|
-
let t = n.
|
|
13370
|
+
let t = n.getCachedParticipantIdByExternalId(e);
|
|
13215
13371
|
if (!t) {
|
|
13216
|
-
|
|
13372
|
+
Ll(e, "promoteParticipant", n);
|
|
13217
13373
|
return;
|
|
13218
13374
|
}
|
|
13219
|
-
r = j.
|
|
13375
|
+
r = j.decomposeParticipantId(t).compositeUserId;
|
|
13220
13376
|
}
|
|
13221
13377
|
return n.promoteParticipant(r, t);
|
|
13222
13378
|
}
|
|
13223
|
-
async function
|
|
13224
|
-
return
|
|
13379
|
+
async function Al(e = !1) {
|
|
13380
|
+
return zl().requestPromotion(e);
|
|
13225
13381
|
}
|
|
13226
|
-
async function
|
|
13227
|
-
return
|
|
13382
|
+
async function jl(e = !1) {
|
|
13383
|
+
return zl().acceptPromotion(e);
|
|
13228
13384
|
}
|
|
13229
|
-
async function
|
|
13230
|
-
return
|
|
13385
|
+
async function Ml(e) {
|
|
13386
|
+
return zl().getParticipantListChunk(e);
|
|
13231
13387
|
}
|
|
13232
|
-
async function
|
|
13233
|
-
return
|
|
13388
|
+
async function Nl(e) {
|
|
13389
|
+
return zl().getParticipants(e);
|
|
13234
13390
|
}
|
|
13235
|
-
async function
|
|
13236
|
-
return
|
|
13391
|
+
async function Pl(e) {
|
|
13392
|
+
return zl().feedback(e);
|
|
13237
13393
|
}
|
|
13238
|
-
async function
|
|
13239
|
-
return
|
|
13394
|
+
async function Fl(e, t, n) {
|
|
13395
|
+
return zl(n).enableFeatureForRoles(e, t);
|
|
13240
13396
|
}
|
|
13241
|
-
function
|
|
13397
|
+
function Il(e) {
|
|
13242
13398
|
return e ? z.get(e) ?? null : $.current() ?? z.getFirst();
|
|
13243
13399
|
}
|
|
13244
|
-
function
|
|
13245
|
-
|
|
13400
|
+
function Ll(e, t, n) {
|
|
13401
|
+
L.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external ID "${e.id}" while handling ${t}`), n.id);
|
|
13402
|
+
}
|
|
13403
|
+
function Rl(e, t, n) {
|
|
13404
|
+
let r = Array.from(new Set(e));
|
|
13405
|
+
L.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external IDs "${r.join("\", \"")}" while handling ${t}`), n.id);
|
|
13406
|
+
}
|
|
13407
|
+
function zl(e) {
|
|
13408
|
+
let t = Il(e);
|
|
13246
13409
|
if (!t) throw Error("Conversation not found");
|
|
13247
13410
|
return t;
|
|
13248
13411
|
}
|
|
13249
|
-
|
|
13250
|
-
|
|
13412
|
+
function Bl(e, t) {
|
|
13413
|
+
let n = $.current();
|
|
13414
|
+
if (!n) return null;
|
|
13415
|
+
let r = n.getCachedParticipantIdByExternalId(e);
|
|
13416
|
+
return r ? {
|
|
13417
|
+
conversation: n,
|
|
13418
|
+
participantId: r
|
|
13419
|
+
} : (Ll(e, t, n), null);
|
|
13420
|
+
}
|
|
13421
|
+
async function Vl(e) {
|
|
13422
|
+
await Zs.removeHistoryRecords(e);
|
|
13251
13423
|
}
|
|
13252
|
-
async function
|
|
13424
|
+
async function Hl(e) {
|
|
13253
13425
|
let t = $.current() ?? z.getFirst();
|
|
13254
13426
|
t && await t.startAsr(e);
|
|
13255
13427
|
}
|
|
13256
|
-
async function
|
|
13428
|
+
async function Ul(e) {
|
|
13257
13429
|
let t = $.current() ?? z.getFirst();
|
|
13258
13430
|
t && await t.stopAsr(e);
|
|
13259
13431
|
}
|
|
13260
|
-
async function
|
|
13432
|
+
async function Wl(e) {
|
|
13261
13433
|
let t = $.current() ?? z.getFirst();
|
|
13262
13434
|
t && await t.requestAsr(e);
|
|
13263
13435
|
}
|
|
13264
|
-
async function
|
|
13436
|
+
async function Gl(e) {
|
|
13265
13437
|
let t = $.current();
|
|
13266
13438
|
return t ? t.startUrlSharing(e) : Promise.reject();
|
|
13267
13439
|
}
|
|
13268
|
-
async function
|
|
13440
|
+
async function Kl() {
|
|
13269
13441
|
let e = $.current();
|
|
13270
13442
|
return e ? e.stopUrlSharing() : Promise.reject();
|
|
13271
13443
|
}
|
|
13272
|
-
async function
|
|
13444
|
+
async function ql(e) {
|
|
13273
13445
|
await z.switchCall(e);
|
|
13274
13446
|
}
|
|
13275
|
-
function
|
|
13447
|
+
function Jl() {
|
|
13276
13448
|
return z.getActiveId();
|
|
13277
13449
|
}
|
|
13278
|
-
function
|
|
13450
|
+
function Yl() {
|
|
13279
13451
|
return $.getSyncedTime();
|
|
13280
13452
|
}
|
|
13281
|
-
function
|
|
13453
|
+
function Xl() {
|
|
13282
13454
|
return M.sdkVersion;
|
|
13283
13455
|
}
|
|
13284
13456
|
typeof window < "u" && (window.__CALLS_SDK = yn);
|
|
13285
13457
|
//#endregion
|
|
13286
|
-
export {
|
|
13458
|
+
export { Ws as Api, Xs as ApiExternal, Ys as ArrayDequeue, y as AuthData, f as BaseLogger, Xa as CallDirection, Za as CallType, Qa as ChatRoomEventType, $a as ConversationFeature, eo as ConversationOption, Sn as DebugMessageType, fo as ExternalIdType, jt as FacingMode, x as FatalError, O as HangupReason, D as HangupType, S as MediaOption, k as MediaTrackKind, V as MediaType, ro as MuteState, Z as ParticipantState, Js as ParticipantStateDataValue, N as ParticipantStatus, qs as RecordRole, io as RoomsEventType, Ya as Signaling, B as SignalingCommandType, vr as SignalingConnectionType, K as SignalingNotification, J as TransportTopology, so as UserRole, A as UserType, Fo as VolumeDetector, mc as acceptCall, jl as acceptPromotion, fl as activateRooms, cl as addMovie, bc as addParticipant, xc as addParticipantInternal, pc as authorize, $s as browser, lc as callInternal, sc as callTo, Tc as captureScreen, Ec as captureVmoji, Cl as changeAudioEffect, Gc as changeConversationOptions, wc as changeDevice, Mc as changeParticipantState, jc as changePriorities, Sl as changeVideoEffect, Jc as chatHistory, Kc as chatMessage, qc as chatMessageInternal, $c as createJoinLink, Yc as customData, Xc as customDataInternal, gl as debug, yl as debugLogs, _l as debugMessage, vl as debugMessageWithContext, hc as declineCall, Fl as enableFeatureForRoles, Uc as enableVideoSuspend, Wc as enableVideoSuspendSuggest, Pl as feedback, rl as forceRelayPolicy, Jl as getActiveCallId, tl as getAnonymTokenByLink, Ol as getAudienceModeHands, fc as getInbounds, Ml as getParticipantListChunk, Nl as getParticipants, sl as getStreamInfo, Yl as getSyncedTime, Dl as getWaitingHall, Ic as grantRoles, Lc as grantRolesInternal, yc as hangup, oc as init, gc as joinCall, vc as joinCallByLink, _c as joinCallInternal, Rc as muteParticipant, zc as muteParticipantInternal, Bc as pinParticipant, Vc as pinParticipantInternal, uc as processPush, dc as processPushInternal, kl as promoteParticipant, ol as publishStream, Nc as putHandsDown, Vl as removeHistoryRecords, el as removeJoinLink, ul as removeMovie, Sc as removeParticipant, Cc as removeParticipantInternal, ml as removeRooms, Wl as requestAsr, Fc as requestDisplayLayout, Al as requestPromotion, rc as setAudioEffects, wl as setAudioStream, Ac as setLocalResolution, tc as setLogger, Hc as setMediaModifiers, hl as setStatisticsInterval, ic as setVad, nc as setVideoEffects, Dc as setVideoStream, ac as setVmoji, El as setVmojiFill, Tl as setVmojiSvg, nl as setVolume, Hl as startAsr, Qc as startAudienceConversation, Zc as startConversation, il as startStream, Gl as startUrlSharing, Ul as stopAsr, al as stopStream, Kl as stopUrlSharing, ql as switchCall, pl as switchRoom, kc as toggleLocalAudio, Oc as toggleLocalVideo, Pc as updateDisplayLayout, ll as updateMovie, dl as updateRooms, xl as uploadDebugLogs, ec as utils, Xl as version };
|