@vkontakte/calls-sdk 2.8.13-dev.63c885d4.0 → 2.8.13-dev.8897f036.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/calls-sdk.cjs.js +7 -7
- package/calls-sdk.esm.js +656 -640
- package/classes/transport/DirectTransport.d.ts +6 -0
- package/package.json +1 -1
- package/static/Params.d.ts +1 -7
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.8897f036.0
|
|
3
|
+
* Thu, 17 Sep 2026 15:54:56 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -2152,10 +2152,10 @@ var yn = vn.getInstance(), M = class e {
|
|
|
2152
2152
|
return "ok.calls.sdk.js";
|
|
2153
2153
|
}
|
|
2154
2154
|
static get appVersion() {
|
|
2155
|
-
return
|
|
2155
|
+
return 1.1;
|
|
2156
2156
|
}
|
|
2157
2157
|
static get sdkVersion() {
|
|
2158
|
-
return "2.8.13-dev.
|
|
2158
|
+
return "2.8.13-dev.8897f036.0";
|
|
2159
2159
|
}
|
|
2160
2160
|
static get debug() {
|
|
2161
2161
|
return e._params.debug;
|
|
@@ -2578,7 +2578,6 @@ var yn = vn.getInstance(), M = class e {
|
|
|
2578
2578
|
movieShare: e._params.movieShare,
|
|
2579
2579
|
clientType: e._params.clientType,
|
|
2580
2580
|
clientStatsPlatform: e._params.clientStatsPlatform,
|
|
2581
|
-
appVersion: e._params.appVersion,
|
|
2582
2581
|
consumerScreenDataChannelPacketSize: e._params.consumerScreenDataChannelPacketSize,
|
|
2583
2582
|
switchVideoAtBadNetwork: e._params.switchVideoAtBadNetwork,
|
|
2584
2583
|
simulcast: e._params.simulcast,
|
|
@@ -2594,7 +2593,6 @@ var yn = vn.getInstance(), M = class e {
|
|
|
2594
2593
|
h(M, "_params", {
|
|
2595
2594
|
platform: "WEB",
|
|
2596
2595
|
clientStatsPlatform: "",
|
|
2597
|
-
appVersion: "0.0.0",
|
|
2598
2596
|
clientType: "PORTAL",
|
|
2599
2597
|
externalUserType: "",
|
|
2600
2598
|
device: "browser",
|
|
@@ -3977,7 +3975,11 @@ var Mr = class {
|
|
|
3977
3975
|
let { rtt: t, loss: n, bitrate: r } = e || {};
|
|
3978
3976
|
this._remoteNetworkStat.rtt = t || 0, this._remoteNetworkStat.loss = n || 0, this._remoteNetworkStat.bitrate = r || 0;
|
|
3979
3977
|
}
|
|
3980
|
-
}, Gr = 30 * 1e3, Kr = class
|
|
3978
|
+
}, Gr = 30 * 1e3, Kr = class extends Error {
|
|
3979
|
+
constructor() {
|
|
3980
|
+
super("Ice restart failed"), this.name = "IceRestartTimeoutError";
|
|
3981
|
+
}
|
|
3982
|
+
}, qr = class e extends Nr {
|
|
3981
3983
|
constructor(e, t, n, r, i, a = R, o = null, s = null, c = null, l = null) {
|
|
3982
3984
|
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", {
|
|
3983
3985
|
bad: {
|
|
@@ -3992,7 +3994,7 @@ var Mr = class {
|
|
|
3992
3994
|
worst: 320,
|
|
3993
3995
|
bad: 640,
|
|
3994
3996
|
good: 1280
|
|
3995
|
-
}), 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
|
|
3997
|
+
}), 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 ma(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new Wr(n, this._debug), 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));
|
|
3996
3998
|
try {
|
|
3997
3999
|
this._pc = this._createPeerConnection();
|
|
3998
4000
|
} catch (e) {
|
|
@@ -4119,10 +4121,10 @@ var Mr = class {
|
|
|
4119
4121
|
this._isOpen && this._finishClose(e);
|
|
4120
4122
|
}
|
|
4121
4123
|
_finishClose(e) {
|
|
4122
|
-
this._isOpen = !1, this._stopReconnection(), this._stopStatInterval(), this._stopSettingsInterval(), this._disposePeerConnection(), this._onNetworkStatus(1), this.unsubscribe(), e ? (this._debug.error("DirectTransport: Closed", e, { participantId: this._participantId }), this._setState(q.FAILED)) : (this._debug.debug("DirectTransport: Closed", { participantId: this._participantId }), this._setState(q.CLOSED)), this._triggerEvent(X.PEER_CONNECTION_CLOSED);
|
|
4124
|
+
this._isOpen = !1, this._stopReconnection(), this._stopStatInterval(), this._stopSettingsInterval(), this._disposePeerConnection(), this._onNetworkStatus(1), this.unsubscribe(), e ? (this._debug.error("DirectTransport: Closed", e, { participantId: this._participantId }), this._setState(q.FAILED, e)) : (this._debug.debug("DirectTransport: Closed", { participantId: this._participantId }), this._setState(q.CLOSED)), this._triggerEvent(X.PEER_CONNECTION_CLOSED);
|
|
4123
4125
|
}
|
|
4124
|
-
_setState(e) {
|
|
4125
|
-
this._state !== e && (this._debug.debug(`DirectTransport: State changed to ${e}`, { participantId: this._participantId }), this._state = e, this._triggerEvent(X.STATE_CHANGED, e));
|
|
4126
|
+
_setState(e, t) {
|
|
4127
|
+
this._state !== e && (this._debug.debug(`DirectTransport: State changed to ${e}`, { participantId: this._participantId }), this._state = e, this._triggerEvent(X.STATE_CHANGED, e, t));
|
|
4126
4128
|
}
|
|
4127
4129
|
_onSignalingNotification(e) {
|
|
4128
4130
|
switch (e.notification) {
|
|
@@ -4270,7 +4272,7 @@ var Mr = class {
|
|
|
4270
4272
|
}
|
|
4271
4273
|
_startIceRestart() {
|
|
4272
4274
|
this._isMaster ? (this._logger?.log(C.ICE_RESTART), this._debug.log("Ice restart", { participantId: this._participantId }), this._createOffer(!0).catch(this.close.bind(this))) : this._debug.debug("Waiting for ice restart...", { participantId: this._participantId }), this._iceRestartTimeout = window.setTimeout(() => {
|
|
4273
|
-
this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this.
|
|
4275
|
+
this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(C.ERROR, "iceRestart-direct"), this.close(new Kr());
|
|
4274
4276
|
}, M.iceRestartWaitTime);
|
|
4275
4277
|
}
|
|
4276
4278
|
async _createOffer(t) {
|
|
@@ -4456,9 +4458,9 @@ var Mr = class {
|
|
|
4456
4458
|
}, n(r)) : this._debug.error(`[${t}] data channel open failed, state [${e}]`);
|
|
4457
4459
|
};
|
|
4458
4460
|
}
|
|
4459
|
-
},
|
|
4461
|
+
}, Jr = /* @__PURE__ */ function(e) {
|
|
4460
4462
|
return e.AUDIO_MIX = "audio-mix", e.PARTICIPANT_AGNOSTIC_TRACK_PREFIX = "pat", e.TRANSPARENT_AUDIO_TRACK_PREFIX = "ta", e;
|
|
4461
|
-
}({}),
|
|
4463
|
+
}({}), Yr = 16, Xr = class e {
|
|
4462
4464
|
constructor(e, t, n, r = R) {
|
|
4463
4465
|
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);
|
|
4464
4466
|
}
|
|
@@ -4472,7 +4474,7 @@ var Mr = class {
|
|
|
4472
4474
|
ssrc: a,
|
|
4473
4475
|
timestamp: o,
|
|
4474
4476
|
duration: s,
|
|
4475
|
-
data: e.slice(
|
|
4477
|
+
data: e.slice(Yr)
|
|
4476
4478
|
};
|
|
4477
4479
|
}
|
|
4478
4480
|
_onDataChannelMessage(t) {
|
|
@@ -4492,7 +4494,7 @@ var Mr = class {
|
|
|
4492
4494
|
destroy() {
|
|
4493
4495
|
this._datachannel.onmessage = null;
|
|
4494
4496
|
}
|
|
4495
|
-
},
|
|
4497
|
+
}, Zr, Qr = class {
|
|
4496
4498
|
constructor() {
|
|
4497
4499
|
h(this, "_value", 1);
|
|
4498
4500
|
}
|
|
@@ -4503,10 +4505,10 @@ var Mr = class {
|
|
|
4503
4505
|
this._value = e;
|
|
4504
4506
|
}
|
|
4505
4507
|
};
|
|
4506
|
-
|
|
4508
|
+
Zr = Qr, h(Qr, "_instance", null), h(Qr, "getInstance", () => (Zr._instance || (Zr._instance = new Zr()), Zr._instance));
|
|
4507
4509
|
//#endregion
|
|
4508
4510
|
//#region src/classes/ParticipantIdRegistry.ts
|
|
4509
|
-
var
|
|
4511
|
+
var $r = class {
|
|
4510
4512
|
constructor(e = R) {
|
|
4511
4513
|
h(this, "streamDescriptionByCompactId", /* @__PURE__ */ new Map()), h(this, "compactIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_debug", void 0), this._debug = e;
|
|
4512
4514
|
}
|
|
@@ -4622,7 +4624,7 @@ var Qr = class {
|
|
|
4622
4624
|
this._debug.error("unexpected null sequenceNumber", e, r);
|
|
4623
4625
|
continue;
|
|
4624
4626
|
}
|
|
4625
|
-
let l =
|
|
4627
|
+
let l = Jr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
|
|
4626
4628
|
n.push({
|
|
4627
4629
|
participantStreamDescription: c,
|
|
4628
4630
|
streamId: l,
|
|
@@ -4640,7 +4642,7 @@ var Qr = class {
|
|
|
4640
4642
|
}
|
|
4641
4643
|
}, Y = /* @__PURE__ */ function(e) {
|
|
4642
4644
|
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;
|
|
4643
|
-
}({}),
|
|
4645
|
+
}({}), ei = class {
|
|
4644
4646
|
constructor(e = R, t = null) {
|
|
4645
4647
|
h(this, "_worker", null), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = e, this._logger = t;
|
|
4646
4648
|
}
|
|
@@ -4705,7 +4707,7 @@ var Qr = class {
|
|
|
4705
4707
|
static isBrowserSupported() {
|
|
4706
4708
|
throw Error("Not implemented");
|
|
4707
4709
|
}
|
|
4708
|
-
},
|
|
4710
|
+
}, ti = class extends ei {
|
|
4709
4711
|
constructor(e = R, t = null) {
|
|
4710
4712
|
super(e, t);
|
|
4711
4713
|
}
|
|
@@ -4729,7 +4731,7 @@ var Qr = class {
|
|
|
4729
4731
|
static isBrowserSupported() {
|
|
4730
4732
|
return "WebAssembly" in window && "Worker" in window;
|
|
4731
4733
|
}
|
|
4732
|
-
},
|
|
4734
|
+
}, ni = class extends ei {
|
|
4733
4735
|
constructor(e = R, t = null) {
|
|
4734
4736
|
super(e, t);
|
|
4735
4737
|
}
|
|
@@ -4752,7 +4754,7 @@ var Qr = class {
|
|
|
4752
4754
|
static isBrowserSupported() {
|
|
4753
4755
|
return "VideoDecoder" in window && "Worker" in window && "VideoFrame" in window && !T.isBrokenVP9Decoder() && T.browserName() !== "Firefox";
|
|
4754
4756
|
}
|
|
4755
|
-
},
|
|
4757
|
+
}, ri = class {
|
|
4756
4758
|
constructor(e = null, t = 0) {
|
|
4757
4759
|
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));
|
|
4758
4760
|
}
|
|
@@ -4766,7 +4768,7 @@ var Qr = class {
|
|
|
4766
4768
|
destroy() {
|
|
4767
4769
|
window.clearInterval(this._interval), this._interval = 0;
|
|
4768
4770
|
}
|
|
4769
|
-
},
|
|
4771
|
+
}, ii = class {
|
|
4770
4772
|
constructor(e, t) {
|
|
4771
4773
|
h(this, "_participantId", void 0), h(this, "_statAggregator", void 0), h(this, "_firstFrameReceived", !1), this._participantId = e, this._statAggregator = t;
|
|
4772
4774
|
}
|
|
@@ -4781,14 +4783,14 @@ var Qr = class {
|
|
|
4781
4783
|
height: t
|
|
4782
4784
|
});
|
|
4783
4785
|
}
|
|
4784
|
-
},
|
|
4786
|
+
}, ai = 65536, oi = "MARK_SCREENSHARE_FREEZE_DURATION", si = class e {
|
|
4785
4787
|
constructor(e, t, n, r, i, a = R) {
|
|
4786
|
-
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
|
|
4788
|
+
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 ii(e, r), this._debug = a;
|
|
4787
4789
|
}
|
|
4788
4790
|
appendChunk(t) {
|
|
4789
4791
|
let n = this._chunks.length;
|
|
4790
4792
|
if (t.start) this._measureFreezeDuration(!1), this._measureFreezeDuration(!0), n && (this._debug.warn("[FrameBuilder] Cleanup buffer", Array.prototype.slice.call(this._chunks)), this._chunks = []);
|
|
4791
|
-
else if (!n || (this._chunks[n - 1].sequence + 1) %
|
|
4793
|
+
else if (!n || (this._chunks[n - 1].sequence + 1) % ai !== t.sequence) {
|
|
4792
4794
|
this._debug.warn("[FrameBuilder] Got incorrect chunk");
|
|
4793
4795
|
return;
|
|
4794
4796
|
}
|
|
@@ -4805,7 +4807,7 @@ var Qr = class {
|
|
|
4805
4807
|
}
|
|
4806
4808
|
}
|
|
4807
4809
|
destroy() {
|
|
4808
|
-
W.clearMark(
|
|
4810
|
+
W.clearMark(oi), W.clearMark(W.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
|
|
4809
4811
|
}
|
|
4810
4812
|
_processFrameData() {
|
|
4811
4813
|
let e = this._chunks;
|
|
@@ -4828,13 +4830,13 @@ var Qr = class {
|
|
|
4828
4830
|
}
|
|
4829
4831
|
_measureFreezeDuration(e) {
|
|
4830
4832
|
if (e) {
|
|
4831
|
-
W.setMark(
|
|
4833
|
+
W.setMark(oi);
|
|
4832
4834
|
return;
|
|
4833
4835
|
}
|
|
4834
|
-
let t = W.measureMark(
|
|
4836
|
+
let t = W.measureMark(oi);
|
|
4835
4837
|
t !== null && t > 1e3 && this._onStat({ freeze_duration: t });
|
|
4836
4838
|
}
|
|
4837
|
-
},
|
|
4839
|
+
}, ci = class {
|
|
4838
4840
|
constructor(e) {
|
|
4839
4841
|
h(this, "_onStream", void 0), this._onStream = e;
|
|
4840
4842
|
}
|
|
@@ -4847,7 +4849,7 @@ var Qr = class {
|
|
|
4847
4849
|
static isBrowserSupported() {
|
|
4848
4850
|
throw Error("Method `isBrowserSupported` is not implemented");
|
|
4849
4851
|
}
|
|
4850
|
-
},
|
|
4852
|
+
}, li = class extends ci {
|
|
4851
4853
|
constructor(e, t = R) {
|
|
4852
4854
|
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;
|
|
4853
4855
|
}
|
|
@@ -4907,7 +4909,7 @@ var Qr = class {
|
|
|
4907
4909
|
static isBrowserSupported() {
|
|
4908
4910
|
return ("CanvasCaptureMediaStream" in window || "CanvasCaptureMediaStreamTrack" in window) && !(T.browserName() === "Safari" && Number(T.browserVersion()) === 15);
|
|
4909
4911
|
}
|
|
4910
|
-
},
|
|
4912
|
+
}, ui = class extends ci {
|
|
4911
4913
|
constructor(e, t = R) {
|
|
4912
4914
|
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);
|
|
4913
4915
|
}
|
|
@@ -4918,9 +4920,9 @@ var Qr = class {
|
|
|
4918
4920
|
this._writer.releaseLock(), this._generator.writable.close().then(() => this._generator.stop()), this._debug.debug("TrackGeneratorRenderer destroyed");
|
|
4919
4921
|
}
|
|
4920
4922
|
static isBrowserSupported() {
|
|
4921
|
-
return "VideoFrame" in window && "MediaStreamTrackGenerator" in window &&
|
|
4923
|
+
return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && ni.isBrowserSupported();
|
|
4922
4924
|
}
|
|
4923
|
-
},
|
|
4925
|
+
}, di = class extends si {
|
|
4924
4926
|
constructor(e, t, n, r, i, a = R, o = null) {
|
|
4925
4927
|
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();
|
|
4926
4928
|
}
|
|
@@ -4928,16 +4930,16 @@ var Qr = class {
|
|
|
4928
4930
|
e.keyframe && (this._decoderQueue = []), this._decoderQueue.push(e), this._decodeQueue();
|
|
4929
4931
|
}
|
|
4930
4932
|
_initFpsMeter() {
|
|
4931
|
-
this._fpsMeter = new
|
|
4933
|
+
this._fpsMeter = new ri((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
|
|
4932
4934
|
}
|
|
4933
4935
|
_initRenderer(e = !1) {
|
|
4934
|
-
e || !
|
|
4936
|
+
e || !ui.isBrowserSupported() ? this._renderer = new li(this._onStream, this._debug) : this._renderer = new ui(this._onStream, this._debug);
|
|
4935
4937
|
}
|
|
4936
4938
|
_initDecoder(e = !1) {
|
|
4937
|
-
e || !
|
|
4939
|
+
e || !ni.isBrowserSupported() ? this._decoder = new ti(this._debug, this._logger) : this._decoder = new ni(this._debug, this._logger), this._decoder.init(async (e) => {
|
|
4938
4940
|
this._decoderBusy = !1, "VideoFrame" in window && e instanceof VideoFrame ? await this._renderer.drawFrame(e) : await this._renderer.drawImage(e), this._fpsMeter.increment(), this._decodeQueue();
|
|
4939
4941
|
}, (e) => {
|
|
4940
|
-
if (this._decoderBusy = !1, this._decoder instanceof
|
|
4942
|
+
if (this._decoderBusy = !1, this._decoder instanceof ni && typeof e == "string" && e.includes("EncodingError")) {
|
|
4941
4943
|
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();
|
|
4942
4944
|
return;
|
|
4943
4945
|
}
|
|
@@ -4945,7 +4947,7 @@ var Qr = class {
|
|
|
4945
4947
|
}, this._onKeyFrameRequested).then(() => {
|
|
4946
4948
|
this._decoderReady = !0, this._decodeQueue();
|
|
4947
4949
|
}).catch((e) => {
|
|
4948
|
-
this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof
|
|
4950
|
+
this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof ni && this._switchToLibVPXDecoder();
|
|
4949
4951
|
});
|
|
4950
4952
|
}
|
|
4951
4953
|
_switchToLibVPXDecoder() {
|
|
@@ -4960,20 +4962,20 @@ var Qr = class {
|
|
|
4960
4962
|
super.destroy(), this._fpsMeter.destroy(), this._decoder.destroy(), this._renderer.destroy(), this._debug.debug(`StreamBuilder destroyed for participant ${this._participantId}`);
|
|
4961
4963
|
}
|
|
4962
4964
|
static isBrowserSupported() {
|
|
4963
|
-
return
|
|
4965
|
+
return li.isBrowserSupported() || ui.isBrowserSupported();
|
|
4964
4966
|
}
|
|
4965
|
-
},
|
|
4966
|
-
function
|
|
4967
|
+
}, fi = 1, pi = 1, mi = 2, hi = 0, gi = 1, _i = 2, vi = 4, yi = 8;
|
|
4968
|
+
function bi(e, t, n, r, i, a, o) {
|
|
4967
4969
|
let s = 0;
|
|
4968
|
-
t && (s |=
|
|
4970
|
+
t && (s |= gi), n && (s |= _i), r && (s |= vi), o || (s |= yi);
|
|
4969
4971
|
let c = /* @__PURE__ */ new ArrayBuffer(11), l = new DataView(c);
|
|
4970
|
-
if (l.setUint8(0,
|
|
4972
|
+
if (l.setUint8(0, fi), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, hi), l.setUint8(10, s), !o) return c;
|
|
4971
4973
|
let u = new Uint8Array(c.byteLength + o.byteLength);
|
|
4972
4974
|
return u.set(new Uint8Array(c), 0), u.set(new Uint8Array(o), c.byteLength), u.buffer;
|
|
4973
4975
|
}
|
|
4974
|
-
function
|
|
4975
|
-
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 &
|
|
4976
|
-
if (n !==
|
|
4976
|
+
function xi(e) {
|
|
4977
|
+
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 & gi), l = !!(s & _i), u = !!(s & vi), d = !!(s & yi);
|
|
4978
|
+
if (n !== fi) throw Error(`Unexpected protocol version. Got ${n}, expected ${fi}`);
|
|
4977
4979
|
return {
|
|
4978
4980
|
timestamp: i,
|
|
4979
4981
|
start: c,
|
|
@@ -4986,26 +4988,26 @@ function bi(e) {
|
|
|
4986
4988
|
data: e.slice(11)
|
|
4987
4989
|
};
|
|
4988
4990
|
}
|
|
4989
|
-
function
|
|
4991
|
+
function Si(e) {
|
|
4990
4992
|
if (!e || !e.byteLength || e.byteLength !== 4) return !1;
|
|
4991
4993
|
let t = new DataView(e);
|
|
4992
|
-
return !(t.getUint8(0) !==
|
|
4994
|
+
return !(t.getUint8(0) !== fi || t.getUint8(1) !== pi || t.getUint16(2) !== hi);
|
|
4993
4995
|
}
|
|
4994
|
-
function
|
|
4996
|
+
function Ci(e) {
|
|
4995
4997
|
if (!e || !e.byteLength || e.byteLength !== 10) return null;
|
|
4996
4998
|
let t = new DataView(e);
|
|
4997
|
-
return t.getUint8(0) !==
|
|
4999
|
+
return t.getUint8(0) !== fi || t.getUint8(1) !== mi || t.getUint16(2) !== hi ? null : {
|
|
4998
5000
|
seq: t.getUint16(4),
|
|
4999
5001
|
ts2: t.getUint32(6)
|
|
5000
5002
|
};
|
|
5001
5003
|
}
|
|
5002
|
-
function
|
|
5004
|
+
function wi(e) {
|
|
5003
5005
|
let t = /* @__PURE__ */ new ArrayBuffer(4), n = new DataView(t);
|
|
5004
|
-
return n.setUint8(0,
|
|
5006
|
+
return n.setUint8(0, fi), n.setUint8(1, pi), n.setUint16(2, e), t;
|
|
5005
5007
|
}
|
|
5006
5008
|
//#endregion
|
|
5007
5009
|
//#region src/classes/screenshare/WebmBuilder.ts
|
|
5008
|
-
var
|
|
5010
|
+
var Ti = 2 ** 15 - 1, Ei = 1, Di = 5, Oi = 5, ki = class e {
|
|
5009
5011
|
constructor(e, t = R) {
|
|
5010
5012
|
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;
|
|
5011
5013
|
let n = () => {
|
|
@@ -5048,8 +5050,8 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5048
5050
|
this._mediaSource?.readyState === "open" && this._sourceBuffer?.abort();
|
|
5049
5051
|
let e = this._sourceBuffer?.buffered, t = e?.length;
|
|
5050
5052
|
if (!t) return;
|
|
5051
|
-
let n = e.start(0), r = Math.max(0, e.end(t - 1) -
|
|
5052
|
-
r - n >
|
|
5053
|
+
let n = e.start(0), r = Math.max(0, e.end(t - 1) - Di);
|
|
5054
|
+
r - n > Oi && (this._clearBufferTill = r);
|
|
5053
5055
|
}
|
|
5054
5056
|
destroy() {
|
|
5055
5057
|
this._queue = [], this._mediaSource.readyState === "open" && (this._sourceBuffer?.abort(), this._mediaSource.endOfStream()), this._sourceBuffer = null, this._clearBufferTill = 0;
|
|
@@ -5063,7 +5065,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5063
5065
|
get buffered() {
|
|
5064
5066
|
return this._sourceBuffer?.buffered;
|
|
5065
5067
|
}
|
|
5066
|
-
},
|
|
5068
|
+
}, Ai = class e extends si {
|
|
5067
5069
|
constructor(e, t, n, r, i = R) {
|
|
5068
5070
|
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}]`);
|
|
5069
5071
|
}
|
|
@@ -5087,8 +5089,8 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5087
5089
|
u.element(u.ID.MuxingApp, u.string("vk-webm-builder")),
|
|
5088
5090
|
u.element(u.ID.WritingApp, u.string("vk-webm-builder"))
|
|
5089
5091
|
]), 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, [
|
|
5090
|
-
u.element(u.ID.TrackNumber, u.number(
|
|
5091
|
-
u.element(u.ID.TrackUID, u.number(
|
|
5092
|
+
u.element(u.ID.TrackNumber, u.number(Ei)),
|
|
5093
|
+
u.element(u.ID.TrackUID, u.number(Ei)),
|
|
5092
5094
|
u.element(u.ID.TrackType, u.number(1)),
|
|
5093
5095
|
u.element(u.ID.FlagLacing, u.number(0)),
|
|
5094
5096
|
u.element(u.ID.DefaultDuration, u.number(1e9)),
|
|
@@ -5101,7 +5103,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5101
5103
|
return u.unknownSizeElement(u.ID.Cluster, [u.element(u.ID.Timecode, u.number(Math.round(e)))]);
|
|
5102
5104
|
}
|
|
5103
5105
|
_createVideo(e) {
|
|
5104
|
-
this._mediaBuffer = new
|
|
5106
|
+
this._mediaBuffer = new ki(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);
|
|
5105
5107
|
let t = () => {
|
|
5106
5108
|
if (this._video?.src) {
|
|
5107
5109
|
this._debug.warn(`[WebmBuilder] Video paused for participant [${this._participantId}], try to play again`);
|
|
@@ -5128,13 +5130,13 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5128
5130
|
this._mediaBuffer?.append(a);
|
|
5129
5131
|
}
|
|
5130
5132
|
let i = Math.round(r - this._clusterStartTime);
|
|
5131
|
-
if (i >
|
|
5133
|
+
if (i > Ti && (this._clusterStartTime = r, i = 0), i === 0) {
|
|
5132
5134
|
this._debug.debug(`[WebmBuilder] Cluster header for participant [${this._participantId}]`);
|
|
5133
5135
|
let t = e._genClusterHeader(this._clusterStartTime);
|
|
5134
5136
|
this._mediaBuffer?.append(t);
|
|
5135
5137
|
}
|
|
5136
5138
|
let a = u.element(u.ID.SimpleBlock, [
|
|
5137
|
-
u.vintEncodedNumber(
|
|
5139
|
+
u.vintEncodedNumber(Ei),
|
|
5138
5140
|
u.bytes(e._intToU16BE(i)),
|
|
5139
5141
|
u.number(!!t.keyframe << 7),
|
|
5140
5142
|
u.bytes(t.frameData)
|
|
@@ -5147,12 +5149,12 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5147
5149
|
static isBrowserSupported() {
|
|
5148
5150
|
return "captureStream" in window.HTMLVideoElement?.prototype && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp8\"") && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp9\"");
|
|
5149
5151
|
}
|
|
5150
|
-
},
|
|
5152
|
+
}, ji = class {
|
|
5151
5153
|
constructor(e, t, n, r, i, a = null, o = R, s = null) {
|
|
5152
5154
|
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);
|
|
5153
5155
|
}
|
|
5154
5156
|
_onDataChannelMessage(e) {
|
|
5155
|
-
let t =
|
|
5157
|
+
let t = xi(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
|
|
5156
5158
|
if (!n) {
|
|
5157
5159
|
this._debug.warn(`Participant id for ssrc ${t.ssrc} not found in registry`);
|
|
5158
5160
|
return;
|
|
@@ -5164,7 +5166,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5164
5166
|
let r = this._streamBuilders[n];
|
|
5165
5167
|
if (!r) {
|
|
5166
5168
|
let e = (e) => this._onStream(n, e);
|
|
5167
|
-
r = M.screenShareWebmBuilder &&
|
|
5169
|
+
r = M.screenShareWebmBuilder && Ai.isBrowserSupported() ? new Ai(n, e, this._onStat, this._statAggregator, this._debug) : new di(n, e, this._onStat, this._statAggregator, () => {
|
|
5168
5170
|
this._requestKeyFrame(t.ssrc);
|
|
5169
5171
|
}, this._debug, this._logger), this._streamBuilders[n] = r;
|
|
5170
5172
|
}
|
|
@@ -5172,7 +5174,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5172
5174
|
}
|
|
5173
5175
|
_requestKeyFrame(e) {
|
|
5174
5176
|
if (!(!this._datachannel || this._datachannel.readyState !== "open")) try {
|
|
5175
|
-
let t =
|
|
5177
|
+
let t = wi(e);
|
|
5176
5178
|
this._datachannel.send(t), this._debug.debug(`ScreenCaptureReceiver request for keyframe for ssrc ${e}`);
|
|
5177
5179
|
} catch (e) {
|
|
5178
5180
|
this._debug.warn("Failed to send keyframe request", e);
|
|
@@ -5185,7 +5187,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5185
5187
|
destroy() {
|
|
5186
5188
|
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");
|
|
5187
5189
|
}
|
|
5188
|
-
},
|
|
5190
|
+
}, Mi = class {
|
|
5189
5191
|
constructor(e, t, n) {
|
|
5190
5192
|
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;
|
|
5191
5193
|
}
|
|
@@ -5204,7 +5206,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5204
5206
|
get data() {
|
|
5205
5207
|
return this._data;
|
|
5206
5208
|
}
|
|
5207
|
-
},
|
|
5209
|
+
}, Ni = class {
|
|
5208
5210
|
constructor() {
|
|
5209
5211
|
h(this, "_head", null), h(this, "_tail", null), h(this, "_length", 0);
|
|
5210
5212
|
}
|
|
@@ -5212,7 +5214,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5212
5214
|
return this._length;
|
|
5213
5215
|
}
|
|
5214
5216
|
push(...e) {
|
|
5215
|
-
for (let t of e) this._tail = new
|
|
5217
|
+
for (let t of e) this._tail = new Mi(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
|
|
5216
5218
|
}
|
|
5217
5219
|
merge(e) {
|
|
5218
5220
|
this._tail && (this._tail.next = e._head), this._head || (this._head = e._head), this._tail = e._tail, this._length += e._length, e.clear();
|
|
@@ -5242,7 +5244,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5242
5244
|
for (; t !== null;) e.push(t.data), t = t.next;
|
|
5243
5245
|
return e.length ? JSON.stringify(e, (e, t) => t instanceof Error ? String(t) : t) : "";
|
|
5244
5246
|
}
|
|
5245
|
-
},
|
|
5247
|
+
}, Pi = 1e3, Fi = class extends ei {
|
|
5246
5248
|
constructor(e, t, n, r, i = R, a = null) {
|
|
5247
5249
|
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);
|
|
5248
5250
|
}
|
|
@@ -5328,7 +5330,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5328
5330
|
let t = this._drawFrameData(this._lastFrame);
|
|
5329
5331
|
this._encode(t, e);
|
|
5330
5332
|
} else this._onFrame(null);
|
|
5331
|
-
},
|
|
5333
|
+
}, Pi), this._getFrameBitmap().then((t) => {
|
|
5332
5334
|
window.clearTimeout(this._frameReadTimeout), this._lastFrame?.close(), this._lastFrame = t;
|
|
5333
5335
|
let n = this._drawFrameData(t);
|
|
5334
5336
|
this._encode(n, e);
|
|
@@ -5349,7 +5351,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5349
5351
|
destroy() {
|
|
5350
5352
|
this._removeWorker(), this._removeStream(), this._removeDom(), this._debug.debug("LibVPxEncoder destroyed");
|
|
5351
5353
|
}
|
|
5352
|
-
},
|
|
5354
|
+
}, Ii = class extends ei {
|
|
5353
5355
|
constructor(e, t, n, r, i, a, o = R, s = null) {
|
|
5354
5356
|
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 });
|
|
5355
5357
|
}
|
|
@@ -5395,11 +5397,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5395
5397
|
static isBrowserSupported() {
|
|
5396
5398
|
return "VideoEncoder" in window && "Worker" in window && "EncodedVideoChunk" in window && "MediaStreamTrackProcessor" in window;
|
|
5397
5399
|
}
|
|
5398
|
-
},
|
|
5400
|
+
}, Li = 2100, Ri = 600, zi = 1.2, Bi = .8, Vi = 2e3, Hi = 8e3, Ui = 8e3, Wi = 16e3, Gi = 4, Ki = 2e3, qi = /* @__PURE__ */ function(e) {
|
|
5399
5401
|
return e[e.NONE = 0] = "NONE", e[e.UP = 1] = "UP", e[e.DOWN = 2] = "DOWN", e;
|
|
5400
|
-
}(
|
|
5402
|
+
}(qi || {}), Ji = class {
|
|
5401
5403
|
constructor(e, t, n, r, i, a, o, s = R) {
|
|
5402
|
-
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 =
|
|
5404
|
+
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 = Li, i && (this._highDelayThreshold = Ri), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
|
|
5403
5405
|
let c = Date.now();
|
|
5404
5406
|
this._lastDown = 0, this._lastUp = c, this._lastProbing = c, this._lastCheckDelay = 0, this._lastFpsCalcMs = 0;
|
|
5405
5407
|
}
|
|
@@ -5409,27 +5411,27 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5409
5411
|
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;
|
|
5410
5412
|
s || c ? i = 2 : Math.abs(a) < 40 && o < 10 && !c && (i = 1);
|
|
5411
5413
|
let l = Math.round(this._targetBitrate / 1e3), u = n;
|
|
5412
|
-
e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5414
|
+
e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${qi[i]} tr=${l} br=${n}`);
|
|
5413
5415
|
let d = r - this._lastDown;
|
|
5414
|
-
if (i === 2 && d >
|
|
5415
|
-
this._probing && (this._upPenalty = Math.min(++this._upPenalty,
|
|
5416
|
-
let n =
|
|
5417
|
-
if (n >= this._targetBitrate && (n = this._targetBitrate *
|
|
5418
|
-
let r = Math.round(n / 1e3), s = Math.round(this._upPenalty *
|
|
5419
|
-
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5416
|
+
if (i === 2 && d > Vi) {
|
|
5417
|
+
this._probing && (this._upPenalty = Math.min(++this._upPenalty, Gi), this._probing = !1);
|
|
5418
|
+
let n = Bi * u * 1e3;
|
|
5419
|
+
if (n >= this._targetBitrate && (n = this._targetBitrate * Bi), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
|
|
5420
|
+
let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * Ui / 1e3);
|
|
5421
|
+
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${qi[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;
|
|
5420
5422
|
}
|
|
5421
5423
|
this._lastDown = r;
|
|
5422
5424
|
}
|
|
5423
|
-
let f = r - this._lastUp, p =
|
|
5425
|
+
let f = r - this._lastUp, p = Hi + this._upPenalty * Ui;
|
|
5424
5426
|
if (i === 1 && f > p && d > p) {
|
|
5425
|
-
let n = Math.min(this._targetBitrate *
|
|
5427
|
+
let n = Math.min(this._targetBitrate * zi, this._maxBitrate);
|
|
5426
5428
|
if (n > this._targetBitrate) {
|
|
5427
|
-
let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty *
|
|
5428
|
-
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5429
|
+
let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * Ui / 1e3);
|
|
5430
|
+
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${qi[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;
|
|
5429
5431
|
}
|
|
5430
5432
|
}
|
|
5431
5433
|
let m = r - this._lastProbing;
|
|
5432
|
-
this._probing && m >
|
|
5434
|
+
this._probing && m > Wi && (this._probing = !1);
|
|
5433
5435
|
let ee = r - this._lastDown;
|
|
5434
5436
|
this._upPenalty > 0 && ee > 3 * p && (this._debug.log(`#${e}: cc: UP reset penalty: oldPenalty=${this._upPenalty}`), this._upPenalty = 0);
|
|
5435
5437
|
}
|
|
@@ -5440,7 +5442,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5440
5442
|
}
|
|
5441
5443
|
_calcDelay(e, t) {
|
|
5442
5444
|
if (!(e <= 0)) {
|
|
5443
|
-
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 >
|
|
5445
|
+
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 > Ki) {
|
|
5444
5446
|
let e = t - this._lastCheckDelay;
|
|
5445
5447
|
this._largeDelayDuration += e;
|
|
5446
5448
|
}
|
|
@@ -5469,7 +5471,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5469
5471
|
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}`);
|
|
5470
5472
|
}
|
|
5471
5473
|
}
|
|
5472
|
-
},
|
|
5474
|
+
}, Yi = class {
|
|
5473
5475
|
constructor(e) {
|
|
5474
5476
|
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);
|
|
5475
5477
|
}
|
|
@@ -5543,11 +5545,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5543
5545
|
clear() {
|
|
5544
5546
|
this._buffer.fill(void 0), this._size = 0, this._head = 0, this._tail = 0;
|
|
5545
5547
|
}
|
|
5546
|
-
},
|
|
5548
|
+
}, Xi = 65536, Zi = 50, Qi = 400, $i = 1e6, ea = 3e5, ta = 3e4, na = 2e3, ra = 5, ia = 0, aa = class {
|
|
5547
5549
|
constructor(e, t, n, r, i = R, a = null) {
|
|
5548
|
-
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
|
|
5550
|
+
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 Yi(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 Ni()), 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;
|
|
5549
5551
|
let o = M.getScreenFrameRate(this._fastSharing), { minBitrate: s, maxBitrate: c } = this._calcMinMaxBitrate(this._width, this._height), l = this._onCongestionCallback.bind(this);
|
|
5550
|
-
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
|
|
5552
|
+
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 Ji(l, s, c, this._congestionControlEnabled, this._fastSharing, M.screenShareCongestionControlThreshold, o, this._debug);
|
|
5551
5553
|
let u = (e, t) => {
|
|
5552
5554
|
if (this._destroyed) return;
|
|
5553
5555
|
if (!e) {
|
|
@@ -5558,23 +5560,23 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5558
5560
|
let n = this._sliceFrame(e);
|
|
5559
5561
|
this._queue.merge(n), this._handleQueue(), this._sendSharingStat();
|
|
5560
5562
|
};
|
|
5561
|
-
if (
|
|
5563
|
+
if (Ii.isBrowserSupported()) {
|
|
5562
5564
|
let t = this._fastSharing;
|
|
5563
|
-
this._encoder = new
|
|
5564
|
-
} else this._encoder = new
|
|
5565
|
+
this._encoder = new Ii(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
|
|
5566
|
+
} else this._encoder = new Fi(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
|
|
5565
5567
|
this._datachannel.onmessage = (e) => {
|
|
5566
|
-
|
|
5567
|
-
let t =
|
|
5568
|
+
Si(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
|
|
5569
|
+
let t = Ci(e.data);
|
|
5568
5570
|
t !== null && this._checkCcFeedback(t);
|
|
5569
|
-
}, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new
|
|
5571
|
+
}, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new ri((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
|
|
5570
5572
|
}
|
|
5571
5573
|
_handleQueue() {
|
|
5572
5574
|
if (this._destroyed) return;
|
|
5573
5575
|
let e = this._queue.shift();
|
|
5574
5576
|
if (!e) {
|
|
5575
|
-
if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq +
|
|
5577
|
+
if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + Xi) % Xi > ra && this._lastFrameDelay > this._maxFrameDelay) {
|
|
5576
5578
|
let e = Date.now();
|
|
5577
|
-
e - this._lastFramerateReduced >
|
|
5579
|
+
e - this._lastFramerateReduced > na && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
|
|
5578
5580
|
} else this._requestFrame();
|
|
5579
5581
|
return;
|
|
5580
5582
|
}
|
|
@@ -5600,7 +5602,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5600
5602
|
this._destroyed || (this._encoder.requestFrame(this._needKeyframe), this._needKeyframe = !1);
|
|
5601
5603
|
}
|
|
5602
5604
|
_sliceFrame(e) {
|
|
5603
|
-
let t = e.type === "key", n = e.data.byteLength, r = new
|
|
5605
|
+
let t = e.type === "key", n = e.data.byteLength, r = new Ni();
|
|
5604
5606
|
for (let i = 0; i < n; i += this.DATA_SIZE) {
|
|
5605
5607
|
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);
|
|
5606
5608
|
r.push({
|
|
@@ -5616,11 +5618,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5616
5618
|
return r;
|
|
5617
5619
|
}
|
|
5618
5620
|
_wrapHeader(e, t, n, r, i) {
|
|
5619
|
-
let a =
|
|
5620
|
-
sequence:
|
|
5621
|
+
let a = bi(e, t, n, r, ia, this._encoder.isVP9(), i), o = {
|
|
5622
|
+
sequence: ia,
|
|
5621
5623
|
data: a
|
|
5622
5624
|
};
|
|
5623
|
-
return
|
|
5625
|
+
return ia = (ia + 1) % Xi, o;
|
|
5624
5626
|
}
|
|
5625
5627
|
_stopPacket() {
|
|
5626
5628
|
return this._wrapHeader(Date.now(), !1, !1, !1, null).data;
|
|
@@ -5637,7 +5639,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5637
5639
|
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");
|
|
5638
5640
|
}
|
|
5639
5641
|
static isBrowserSupported() {
|
|
5640
|
-
return
|
|
5642
|
+
return Ii.isBrowserSupported() || Fi.isBrowserSupported();
|
|
5641
5643
|
}
|
|
5642
5644
|
_onCongestionCallback(e, t, n) {
|
|
5643
5645
|
this._encoder.setBitrate(e, t, n);
|
|
@@ -5650,8 +5652,8 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5650
5652
|
(e === void 0 || e < 640) && (e = 640), (t === void 0 || t < 360) && (t = 360);
|
|
5651
5653
|
let n = e * t / 256;
|
|
5652
5654
|
return {
|
|
5653
|
-
minBitrate: Math.max(
|
|
5654
|
-
maxBitrate: Math.round(n *
|
|
5655
|
+
minBitrate: Math.max(ea, Math.min($i, Math.round(n * Zi))),
|
|
5656
|
+
maxBitrate: Math.round(n * Qi)
|
|
5655
5657
|
};
|
|
5656
5658
|
}
|
|
5657
5659
|
_checkCcFeedback(e) {
|
|
@@ -5665,14 +5667,14 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5665
5667
|
}
|
|
5666
5668
|
_sendSharingStat() {
|
|
5667
5669
|
let e = Date.now();
|
|
5668
|
-
if (e - this._lastSharingStat >
|
|
5670
|
+
if (e - this._lastSharingStat > ta) {
|
|
5669
5671
|
let t = this._congestionControl.getStat();
|
|
5670
5672
|
t !== null && (this._debug.debug(`cc: send stats: ${JSON.stringify(t)}`), this._signaling.reportSharingStat(t).catch((e) => {
|
|
5671
5673
|
!(e instanceof wn) && !(e instanceof Tn) && this._debug.warn("Unable to send sharing stats", e);
|
|
5672
5674
|
})), this._lastSharingStat = e;
|
|
5673
5675
|
}
|
|
5674
5676
|
}
|
|
5675
|
-
},
|
|
5677
|
+
}, oa = class {
|
|
5676
5678
|
constructor(e, t, n, r = R, i = null) {
|
|
5677
5679
|
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;
|
|
5678
5680
|
}
|
|
@@ -5804,9 +5806,9 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5804
5806
|
if (!(e instanceof Tn)) throw e;
|
|
5805
5807
|
}
|
|
5806
5808
|
}
|
|
5807
|
-
},
|
|
5809
|
+
}, sa = 90, ca = 4294967295, la = class e extends Nr {
|
|
5808
5810
|
constructor(e, t, n, r = R, i = null, a = null, o = null, s = null) {
|
|
5809
|
-
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
|
|
5811
|
+
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 oa(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");
|
|
5810
5812
|
}
|
|
5811
5813
|
updateStatisticsInterval() {
|
|
5812
5814
|
this._stopStatInterval();
|
|
@@ -5845,7 +5847,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5845
5847
|
await this._simulcast.sync();
|
|
5846
5848
|
}
|
|
5847
5849
|
_createPerfStatsReporter() {
|
|
5848
|
-
this._perfStatReporter?.destroy(), this._perfStatReporter = new
|
|
5850
|
+
this._perfStatReporter?.destroy(), this._perfStatReporter = new ma(this, this._signaling, this._statAggregator, !1, this._debug);
|
|
5849
5851
|
}
|
|
5850
5852
|
_closeConnection() {
|
|
5851
5853
|
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._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);
|
|
@@ -5874,14 +5876,14 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5874
5876
|
}
|
|
5875
5877
|
this._pc.ontrack = this._onAddTrack.bind(this, this._pc), this._pc.onconnectionstatechange = j.debounce((e) => {
|
|
5876
5878
|
this._pc && this._onConnectionStateChange(this._pc, e);
|
|
5877
|
-
}, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._participantIdRegistry = new
|
|
5879
|
+
}, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._participantIdRegistry = new $r(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, Sr.producerNotification, (e) => {
|
|
5878
5880
|
this._producerNotification = e, this._producerNotification.binaryType = "arraybuffer", this._signaling.setProducerNotificationDataChannel(e);
|
|
5879
5881
|
}), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc, Sr.producerCommand, (e) => {
|
|
5880
5882
|
this._producerCommand = e, this._signaling.setProducerCommandDataChannel(e);
|
|
5881
5883
|
}), this._createDataChannel(this._pc, Sr.producerScreenShare, (e) => {
|
|
5882
5884
|
this._producerScreen = e, this._producerScreen.binaryType = "arraybuffer", this._createCaptureReceiver();
|
|
5883
5885
|
}), M.asrDataChannel && this._createDataChannel(this._pc, Sr.asr, (e) => {
|
|
5884
|
-
this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new
|
|
5886
|
+
this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new Xr(e, this._participantIdRegistry, (e) => {
|
|
5885
5887
|
this._onAsrTranscription(e);
|
|
5886
5888
|
}, this._debug);
|
|
5887
5889
|
}), M.vmoji && this._createDataChannel(this._pc, Sr.animoji, (e) => {
|
|
@@ -5919,19 +5921,19 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
5919
5921
|
}
|
|
5920
5922
|
_updateSSRCMap(e) {
|
|
5921
5923
|
e && (this._ssrcMap = {}, this._ssrcMapUpdated = !0, ln(e.sdp).forEach((e) => {
|
|
5922
|
-
let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${
|
|
5924
|
+
let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${Jr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${Jr.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
|
|
5923
5925
|
n && (this._ssrcMap[n[1]] = n[3]);
|
|
5924
5926
|
}));
|
|
5925
5927
|
}
|
|
5926
5928
|
_createCaptureSender(e) {
|
|
5927
5929
|
let t = this._mediaSource.mediaSettings;
|
|
5928
|
-
!e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new
|
|
5930
|
+
!e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new aa(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
|
|
5929
5931
|
}
|
|
5930
5932
|
_removeCaptureSender() {
|
|
5931
5933
|
this._captureSender?.destroy(), this._captureSender = null;
|
|
5932
5934
|
}
|
|
5933
5935
|
_createCaptureReceiver() {
|
|
5934
|
-
this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new
|
|
5936
|
+
this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new ji(this._producerScreen, this._participantIdRegistry, (e, t) => {
|
|
5935
5937
|
this._triggerEvent(X.REMOTE_STREAM_SECOND, e, t);
|
|
5936
5938
|
}, (e) => {
|
|
5937
5939
|
this._triggerEvent(X.REMOTE_STREAM_SECOND, e, null);
|
|
@@ -6041,7 +6043,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6041
6043
|
_detectStaleTracks(e) {
|
|
6042
6044
|
let t = e.rtps.find((e) => e.type === "inbound-rtp" && e.kind === "audio" && this._ssrcMap[e.ssrc] === "mix");
|
|
6043
6045
|
if (!t) return;
|
|
6044
|
-
let n =
|
|
6046
|
+
let n = Jr.AUDIO_MIX, r = this._statBytes[n], i = !1;
|
|
6045
6047
|
if (r) {
|
|
6046
6048
|
let e = t.bytesReceived - r.bytesReceived;
|
|
6047
6049
|
e >= 0 && e <= 5 && (i = !0), r.stalled !== i && this._triggerEvent(X.AUDIO_MIX_STALL, i);
|
|
@@ -6053,7 +6055,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6053
6055
|
}
|
|
6054
6056
|
_allocateConsumer() {
|
|
6055
6057
|
if (!this._signaling.ready) return;
|
|
6056
|
-
let e =
|
|
6058
|
+
let e = ba.get();
|
|
6057
6059
|
!M.videoTracksCount && !this._observer && this._debug.warn("Setting videoTracksCount to 0 is deprecated"), this._signaling.allocateConsumer(null, e).catch((e) => {
|
|
6058
6060
|
e instanceof wn || this._debug.warn("ServerTransport: Unable to allocate consumer", e);
|
|
6059
6061
|
});
|
|
@@ -6229,11 +6231,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6229
6231
|
if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
|
|
6230
6232
|
let i = r[0].rtpTimestamp;
|
|
6231
6233
|
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;
|
|
6232
|
-
let a = t - i &
|
|
6234
|
+
let a = t - i & ca, o = Math.ceil(a / sa);
|
|
6233
6235
|
return Math.min(100, Math.max(0, o));
|
|
6234
6236
|
}
|
|
6235
6237
|
async _monitorRtpShare() {
|
|
6236
|
-
let e =
|
|
6238
|
+
let e = Qr.getInstance().value;
|
|
6237
6239
|
if (!this._mediaSource.mediaSettings.isFastScreenSharingEnabled || !M.consumerFastScreenShare || e < .6) return;
|
|
6238
6240
|
let t = this._pc?.getSenders().find((e) => e.track?.kind === k.video && e.track?.contentHint === "motion");
|
|
6239
6241
|
t && (await t.getStats()).forEach((e) => {
|
|
@@ -6264,7 +6266,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6264
6266
|
}
|
|
6265
6267
|
}, X = /* @__PURE__ */ function(e) {
|
|
6266
6268
|
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;
|
|
6267
|
-
}({}),
|
|
6269
|
+
}({}), ua = class extends b {
|
|
6268
6270
|
constructor(e, t, n, r, i = R, a = null, o = null, s = null, c = null) {
|
|
6269
6271
|
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", () => {
|
|
6270
6272
|
this._vadController?.setSendTrack(this._mediaSource.getSendAudioTrack());
|
|
@@ -6352,8 +6354,8 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6352
6354
|
let n = e.filter((e) => this._states[e] === t ? !1 : (this._states[e] = t, !0));
|
|
6353
6355
|
n.length && this._triggerEvent("STATE_CHANGED", n, t);
|
|
6354
6356
|
}
|
|
6355
|
-
_setLocalState(e) {
|
|
6356
|
-
this._localState !== e && (this._localState = e, this._triggerEvent("LOCAL_STATE_CHANGED", e));
|
|
6357
|
+
_setLocalState(e, t) {
|
|
6358
|
+
this._localState !== e && (this._localState = e, this._triggerEvent("LOCAL_STATE_CHANGED", e, t));
|
|
6357
6359
|
}
|
|
6358
6360
|
_onSignalingNotification(e) {
|
|
6359
6361
|
if (e.notification === K.TOPOLOGY_CHANGED) return this._onTopologyChanged(e);
|
|
@@ -6385,11 +6387,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6385
6387
|
}
|
|
6386
6388
|
}
|
|
6387
6389
|
_createDirectTransport(e, t = !1) {
|
|
6388
|
-
let n = new
|
|
6390
|
+
let n = new qr(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
|
|
6389
6391
|
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;
|
|
6390
6392
|
}
|
|
6391
6393
|
_createServerTransport() {
|
|
6392
|
-
let e = new
|
|
6394
|
+
let e = new la(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
|
|
6393
6395
|
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;
|
|
6394
6396
|
}
|
|
6395
6397
|
_releaseDirectTransport() {
|
|
@@ -6402,15 +6404,15 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6402
6404
|
for (let e of this._stListeners) e.dispose();
|
|
6403
6405
|
this._stListeners = [];
|
|
6404
6406
|
}
|
|
6405
|
-
_onDirectTransportChanged(e) {
|
|
6406
|
-
let
|
|
6407
|
+
_onDirectTransportChanged(e, t) {
|
|
6408
|
+
let n = this._directTransport?.participantId;
|
|
6407
6409
|
if (e === q.CONNECTED && this._topology === J.DIRECT && this._releaseServerTransport(), (e === q.CLOSED || e === q.FAILED) && (this._releaseDirectTransport(), this._topology === J.DIRECT)) {
|
|
6408
|
-
let e = this._opened.indexOf(
|
|
6410
|
+
let e = this._opened.indexOf(n);
|
|
6409
6411
|
e >= 0 && this._opened.splice(e, 1);
|
|
6410
|
-
let
|
|
6411
|
-
|
|
6412
|
+
let t = this._allocated.indexOf(n);
|
|
6413
|
+
t >= 0 && this._allocated.splice(t, 1);
|
|
6412
6414
|
}
|
|
6413
|
-
this._topology === J.DIRECT &&
|
|
6415
|
+
this._topology === J.DIRECT && n && (this._setStates([n], e), this._setLocalState(e, t));
|
|
6414
6416
|
}
|
|
6415
6417
|
_onServerTransportChanged(e) {
|
|
6416
6418
|
let t = this._opened.slice();
|
|
@@ -6481,7 +6483,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6481
6483
|
getStreamWaitingTimeMs(e, t) {
|
|
6482
6484
|
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);
|
|
6483
6485
|
}
|
|
6484
|
-
},
|
|
6486
|
+
}, da = "videochat-epi", fa = 5e3, pa = 500, ma = class extends b {
|
|
6485
6487
|
constructor(e, t, n = null, r = !1, i = R) {
|
|
6486
6488
|
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) => {
|
|
6487
6489
|
this._screenShareStats.push(e);
|
|
@@ -6494,7 +6496,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6494
6496
|
}
|
|
6495
6497
|
static getEstimatedPerformanceIndex() {
|
|
6496
6498
|
try {
|
|
6497
|
-
let e = parseInt(localStorage.getItem(
|
|
6499
|
+
let e = parseInt(localStorage.getItem(da) || "", 10);
|
|
6498
6500
|
return isNaN(e) ? 0 : e;
|
|
6499
6501
|
} catch {
|
|
6500
6502
|
return 0;
|
|
@@ -6503,9 +6505,9 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6503
6505
|
async _handleStats(e) {
|
|
6504
6506
|
if (!e.inbound || !e.inbound.rtps) return;
|
|
6505
6507
|
let t = Date.now();
|
|
6506
|
-
!this._directTopology && M.perfStatReportEnabled && this._previousPerfStatReportTimestamp +
|
|
6508
|
+
!this._directTopology && M.perfStatReportEnabled && this._previousPerfStatReportTimestamp + fa <= t && (await this.reportPerfStats(e), this._previousPerfStatReportTimestamp = t);
|
|
6507
6509
|
let n = e.outbound.transport.local?.protocol === "tcp";
|
|
6508
|
-
!this._directTopology && n && this._previousNetworkStatReportTimestamp +
|
|
6510
|
+
!this._directTopology && n && this._previousNetworkStatReportTimestamp + pa <= t && (await this.reportNetworkStats(e), this._previousNetworkStatReportTimestamp = t), M.callStatReportEnabled && this._previousCallStatReportTimestamp + M.statisticsInterval <= t && (this._reportCallStats(e), this._previousCallStatReportTimestamp = t);
|
|
6509
6511
|
}
|
|
6510
6512
|
async reportPerfStats(e) {
|
|
6511
6513
|
let t = e.inbound.rtps.reduce((e, t) => (t.kind === "video" && (e.framesDecoded += t.framesDecoded || 0, e.framesReceived += t.framesReceived || 0), e), {
|
|
@@ -6514,7 +6516,7 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6514
6516
|
});
|
|
6515
6517
|
if (t.framesDecoded) try {
|
|
6516
6518
|
let e = await this._signaling.reportPerfStat(t);
|
|
6517
|
-
localStorage.setItem(
|
|
6519
|
+
localStorage.setItem(da, e.estimatedPerformanceIndex);
|
|
6518
6520
|
} catch {}
|
|
6519
6521
|
}
|
|
6520
6522
|
async reportNetworkStats(e) {
|
|
@@ -6554,11 +6556,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6554
6556
|
rtt: Math.round(e.inbound.transport.currentRoundTripTime * 1e3),
|
|
6555
6557
|
ss_freeze_count: 0,
|
|
6556
6558
|
ss_total_freezes_duration: 0,
|
|
6557
|
-
local_address:
|
|
6559
|
+
local_address: ga(e.inbound.transport.local),
|
|
6558
6560
|
local_connection_type: e.inbound.transport.local?.type,
|
|
6559
6561
|
network_type: e.inbound.transport.local?.networkType,
|
|
6560
6562
|
transport: e.inbound.transport.local?.protocol,
|
|
6561
|
-
remote_address:
|
|
6563
|
+
remote_address: ga(e.inbound.transport.remote),
|
|
6562
6564
|
remote_connection_type: e.inbound.transport.remote?.type
|
|
6563
6565
|
};
|
|
6564
6566
|
this._previousCallStatReport || (this._previousCallStatReport = Object.assign({}, t));
|
|
@@ -6579,11 +6581,11 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6579
6581
|
frames_dropped: Math.max(0, t.frames_dropped - this._previousCallStatReport.frames_dropped),
|
|
6580
6582
|
rtt: Math.max(0, t.rtt)
|
|
6581
6583
|
};
|
|
6582
|
-
if (M.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !
|
|
6584
|
+
if (M.simulcast && (i.is_simulcast = !0), navigator.hardwareConcurrency && (i.cpu_hardware_concurrency = navigator.hardwareConcurrency), n && !_a(t.jitter_video) && (i.jitter_video = Math.round(t.jitter_video)), r && !_a(t.jitter_audio) && (i.jitter_audio = Math.round(t.jitter_audio)), n && !_a(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 && !_a(t.total_audio_samples_received)) {
|
|
6583
6585
|
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);
|
|
6584
|
-
i.inserted_audio_samples_for_deceleration =
|
|
6586
|
+
i.inserted_audio_samples_for_deceleration = va(n / e * 1e3), i.removed_audio_samples_for_acceleration = va(r / e * 1e3), i.concealed_audio_samples = va(a / e * 1e3), i.concealed_silent_audio_samples = va(o / e * 1e3), i.concealment_audio_avg_size = va(a / s), i.total_audio_energy = t.total_audio_energy;
|
|
6585
6587
|
}
|
|
6586
|
-
|
|
6588
|
+
ha(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), ha(t, "remote_address", "remote_connection_type") && (i.remote_address = t.remote_address, i.remote_connection_type = t.remote_connection_type);
|
|
6587
6589
|
let a = this._calculatePacketLoss(e.remoteInbound.rtps);
|
|
6588
6590
|
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;
|
|
6589
6591
|
}
|
|
@@ -6615,26 +6617,26 @@ var wi = 2 ** 15 - 1, Ti = 1, Ei = 5, Di = 5, Oi = class e {
|
|
|
6615
6617
|
return r;
|
|
6616
6618
|
}
|
|
6617
6619
|
};
|
|
6618
|
-
function
|
|
6620
|
+
function ha(e, ...t) {
|
|
6619
6621
|
for (let n of t) if (!Object.hasOwn(e, n) || e[n] === void 0) return !1;
|
|
6620
6622
|
return !0;
|
|
6621
6623
|
}
|
|
6622
|
-
function
|
|
6624
|
+
function ga(e, t = !1) {
|
|
6623
6625
|
if (e?.address) return e.address + (t ? `:${e.port}` : "");
|
|
6624
6626
|
}
|
|
6625
|
-
function
|
|
6627
|
+
function _a(e) {
|
|
6626
6628
|
return e === void 0;
|
|
6627
6629
|
}
|
|
6628
|
-
function
|
|
6630
|
+
function va(e) {
|
|
6629
6631
|
return Number.isNaN(e) ? 0 : e;
|
|
6630
6632
|
}
|
|
6631
6633
|
//#endregion
|
|
6632
6634
|
//#region src/static/Capabilities.ts
|
|
6633
|
-
var
|
|
6635
|
+
var ya;
|
|
6634
6636
|
(function(e) {
|
|
6635
6637
|
function t() {
|
|
6636
6638
|
return {
|
|
6637
|
-
estimatedPerformanceIndex:
|
|
6639
|
+
estimatedPerformanceIndex: ma.getEstimatedPerformanceIndex(),
|
|
6638
6640
|
audioMix: !0,
|
|
6639
6641
|
consumerUpdate: !0,
|
|
6640
6642
|
producerNotificationDataChannelVersion: 8,
|
|
@@ -6660,8 +6662,8 @@ var va;
|
|
|
6660
6662
|
};
|
|
6661
6663
|
}
|
|
6662
6664
|
e.get = t;
|
|
6663
|
-
})(
|
|
6664
|
-
var
|
|
6665
|
+
})(ya || (ya = {}));
|
|
6666
|
+
var ba = ya, xa = {
|
|
6665
6667
|
producerScreenTrack: () => !0,
|
|
6666
6668
|
videoTracksCount: () => M.videoTracksCount > 0,
|
|
6667
6669
|
waitingHall: () => !0,
|
|
@@ -6681,28 +6683,28 @@ var ya = va, ba = {
|
|
|
6681
6683
|
p2pRelay: () => !1,
|
|
6682
6684
|
waitForAdmin: () => M.waitForAdminInGroupCalls,
|
|
6683
6685
|
hold: () => M.hold
|
|
6684
|
-
},
|
|
6686
|
+
}, Sa = class {
|
|
6685
6687
|
static getFlags() {
|
|
6686
|
-
let e = Object.values(
|
|
6688
|
+
let e = Object.values(xa), t = 0;
|
|
6687
6689
|
for (let n = 0; n < e.length; n++) e[n]() && (t |= 1 << n);
|
|
6688
6690
|
return t.toString(16).toUpperCase();
|
|
6689
6691
|
}
|
|
6690
6692
|
static parseCapabilities(e) {
|
|
6691
6693
|
let t = parseInt(e || "0", 16);
|
|
6692
|
-
return Object.keys(
|
|
6694
|
+
return Object.keys(xa).reduce((e, n, r) => (e[n] = !!(t & 1 << r), e), {});
|
|
6693
6695
|
}
|
|
6694
|
-
},
|
|
6696
|
+
}, Ca = 63n, wa = 16383n, Ta = 1073741823, Ea = 4611686018427387903n, Da = class {
|
|
6695
6697
|
encode(e) {
|
|
6696
6698
|
let t = typeof e == "number" ? BigInt(e) : e;
|
|
6697
|
-
if (t <=
|
|
6698
|
-
if (t <=
|
|
6699
|
-
if (t <= BigInt(
|
|
6699
|
+
if (t <= Ca) return new Uint8Array([Number(t)]);
|
|
6700
|
+
if (t <= wa) return new Uint8Array([64 | Number(t >> 8n), Number(t & 255n)]);
|
|
6701
|
+
if (t <= BigInt(Ta)) return new Uint8Array([
|
|
6700
6702
|
128 | Number(t >> 24n),
|
|
6701
6703
|
Number(t >> 16n & 255n),
|
|
6702
6704
|
Number(t >> 8n & 255n),
|
|
6703
6705
|
Number(t & 255n)
|
|
6704
6706
|
]);
|
|
6705
|
-
if (t <=
|
|
6707
|
+
if (t <= Ea) return new Uint8Array([
|
|
6706
6708
|
192 | Number(t >> 56n),
|
|
6707
6709
|
Number(t >> 48n & 255n),
|
|
6708
6710
|
Number(t >> 40n & 255n),
|
|
@@ -6714,7 +6716,7 @@ var ya = va, ba = {
|
|
|
6714
6716
|
]);
|
|
6715
6717
|
throw RangeError("Number is too large to encode using varint");
|
|
6716
6718
|
}
|
|
6717
|
-
},
|
|
6719
|
+
}, Oa = class {
|
|
6718
6720
|
decode(e) {
|
|
6719
6721
|
let t = this.getNumBytesForLengthInteger(e);
|
|
6720
6722
|
if (t < 0) throw Error("Invalid length prefix");
|
|
@@ -6740,9 +6742,9 @@ var ya = va, ba = {
|
|
|
6740
6742
|
let t = e[0] & 192;
|
|
6741
6743
|
return t === 0 ? 1 : t === 64 ? 2 : t === 128 ? 4 : t === 192 ? 8 : -1;
|
|
6742
6744
|
}
|
|
6743
|
-
},
|
|
6745
|
+
}, ka = class {
|
|
6744
6746
|
constructor(e) {
|
|
6745
|
-
h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new
|
|
6747
|
+
h(this, "encoder", void 0), h(this, "compression", void 0), h(this, "lengthEncoder", void 0), this.encoder = new TextEncoder(), this.lengthEncoder = new Da(), this.compression = e ?? null;
|
|
6746
6748
|
}
|
|
6747
6749
|
encode(e) {
|
|
6748
6750
|
let t = this.encoder.encode(e);
|
|
@@ -6759,9 +6761,9 @@ var ya = va, ba = {
|
|
|
6759
6761
|
default: return e;
|
|
6760
6762
|
}
|
|
6761
6763
|
}
|
|
6762
|
-
},
|
|
6764
|
+
}, Aa = class {
|
|
6763
6765
|
constructor(e) {
|
|
6764
|
-
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
|
|
6766
|
+
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 Oa(), this.compression = e ?? null, this.buffer = new Uint8Array(), this.expectedLength = null, this.offset = 0;
|
|
6765
6767
|
}
|
|
6766
6768
|
decode(e) {
|
|
6767
6769
|
let t = [];
|
|
@@ -6791,12 +6793,12 @@ var ya = va, ba = {
|
|
|
6791
6793
|
default: return e;
|
|
6792
6794
|
}
|
|
6793
6795
|
}
|
|
6794
|
-
},
|
|
6796
|
+
}, ja = class {
|
|
6795
6797
|
static isBrowserSupported() {
|
|
6796
6798
|
return !(!("WebTransport" in window && typeof WebTransport == "function") || T.browserName() === "Safari");
|
|
6797
6799
|
}
|
|
6798
6800
|
constructor(e, t = {}, n = R) {
|
|
6799
|
-
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
|
|
6801
|
+
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 ka(this.compression), this.decoder = new Aa(this.compression), this.connect();
|
|
6800
6802
|
}
|
|
6801
6803
|
async send(e) {
|
|
6802
6804
|
if (this.readyState !== WebSocket.OPEN) {
|
|
@@ -6922,9 +6924,9 @@ var ya = va, ba = {
|
|
|
6922
6924
|
compression: this.compression
|
|
6923
6925
|
}, n;
|
|
6924
6926
|
}
|
|
6925
|
-
},
|
|
6927
|
+
}, Ma = /* @__PURE__ */ function(e) {
|
|
6926
6928
|
return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.NETWORK_ERROR = "NETWORK_ERROR", e.ABORTED = "ABORTED", e;
|
|
6927
|
-
}({}),
|
|
6929
|
+
}({}), Na = class {
|
|
6928
6930
|
constructor(e = R, t) {
|
|
6929
6931
|
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;
|
|
6930
6932
|
}
|
|
@@ -6974,7 +6976,7 @@ var ya = va, ba = {
|
|
|
6974
6976
|
return;
|
|
6975
6977
|
}
|
|
6976
6978
|
let e = this._buildUrl(this.wtEndpoint, !0);
|
|
6977
|
-
this.currentType = yr.WEBTRANSPORT, this.socket = new
|
|
6979
|
+
this.currentType = yr.WEBTRANSPORT, this.socket = new ja(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
|
|
6978
6980
|
}
|
|
6979
6981
|
_connectWebSocket() {
|
|
6980
6982
|
if (!this.endpoint) {
|
|
@@ -6997,10 +6999,10 @@ var ya = va, ba = {
|
|
|
6997
6999
|
}
|
|
6998
7000
|
_buildUrl(e, t) {
|
|
6999
7001
|
let n = new URL(e), r = n.searchParams;
|
|
7000
|
-
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",
|
|
7002
|
+
return r.set("platform", M.platform), r.set("appVersion", String(M.appVersion)), r.set("version", String(M.protocolVersion)), r.set("device", M.device), r.set("capabilities", Sa.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();
|
|
7001
7003
|
}
|
|
7002
7004
|
_canUseWebTransport() {
|
|
7003
|
-
return !this.forceWebSocket &&
|
|
7005
|
+
return !this.forceWebSocket && ja.isBrowserSupported() && this.wtEndpoint !== null && M.webtransport;
|
|
7004
7006
|
}
|
|
7005
7007
|
_onOpen() {
|
|
7006
7008
|
this._startDoctor(), this.handlers.onOpen();
|
|
@@ -7054,31 +7056,31 @@ var ya = va, ba = {
|
|
|
7054
7056
|
_stopDoctor() {
|
|
7055
7057
|
window.clearTimeout(this.doctorTimer), this.doctorTimer = 0;
|
|
7056
7058
|
}
|
|
7057
|
-
},
|
|
7059
|
+
}, Pa = "open", Fa = 10, Ia = {
|
|
7058
7060
|
CONVERSATION_ENDED: "conversation-ended",
|
|
7059
7061
|
OBSOLETE_CLIENT: "gen.obsoleteClient",
|
|
7060
7062
|
INVALID_TOKEN: "invalid-token",
|
|
7061
7063
|
PARTICIPANT_NOT_FOUND: "participant-not-found",
|
|
7062
7064
|
ILLEGAL_PARTICIPANT_STATE: "illegal-participant-state",
|
|
7063
7065
|
SERVICE_UNAVAILABLE: "service-unavailable"
|
|
7064
|
-
},
|
|
7065
|
-
[
|
|
7066
|
-
[
|
|
7067
|
-
[
|
|
7068
|
-
[
|
|
7069
|
-
[
|
|
7070
|
-
[
|
|
7066
|
+
}, La = {
|
|
7067
|
+
[Ia.CONVERSATION_ENDED]: "conversation-ended",
|
|
7068
|
+
[Ia.OBSOLETE_CLIENT]: "obsolete-client",
|
|
7069
|
+
[Ia.INVALID_TOKEN]: "invalid-token",
|
|
7070
|
+
[Ia.PARTICIPANT_NOT_FOUND]: "participant-not-found",
|
|
7071
|
+
[Ia.ILLEGAL_PARTICIPANT_STATE]: "illegal-participant-state",
|
|
7072
|
+
[Ia.SERVICE_UNAVAILABLE]: "service-unavailable"
|
|
7071
7073
|
};
|
|
7072
|
-
function
|
|
7074
|
+
function Ra(e, t) {
|
|
7073
7075
|
return e.errorMessage ?? e.message ?? e.error ?? t;
|
|
7074
7076
|
}
|
|
7075
|
-
var
|
|
7077
|
+
var za = new Set([
|
|
7076
7078
|
D.CALLER_IS_BLOCKED,
|
|
7077
7079
|
D.ENDED,
|
|
7078
7080
|
D.NOT_FOUND,
|
|
7079
7081
|
D.PARTICIPANT_LIMIT_REACHED,
|
|
7080
7082
|
D.SERVICE_UNAVAILABLE
|
|
7081
|
-
]),
|
|
7083
|
+
]), Ba = class e extends En {
|
|
7082
7084
|
static get WAIT_CONNECTION_DELAY() {
|
|
7083
7085
|
return M.waitConnectionDelay;
|
|
7084
7086
|
}
|
|
@@ -7089,7 +7091,7 @@ var Ra = new Set([
|
|
|
7089
7091
|
return !this.disposed && this.transport.readyState !== null;
|
|
7090
7092
|
}
|
|
7091
7093
|
constructor(e = R, t = null, n = null, r = null, i = null) {
|
|
7092
|
-
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
|
|
7094
|
+
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 Na(e, {
|
|
7093
7095
|
onConnecting: this._onTransportConnecting.bind(this),
|
|
7094
7096
|
onOpen: this._onOpen.bind(this),
|
|
7095
7097
|
onMessage: this._onMessage.bind(this),
|
|
@@ -7176,20 +7178,20 @@ var Ra = new Set([
|
|
|
7176
7178
|
return this._send(B.TRANSMIT_DATA, {
|
|
7177
7179
|
participantId: e,
|
|
7178
7180
|
data: r
|
|
7179
|
-
}, !0,
|
|
7181
|
+
}, !0, Fa);
|
|
7180
7182
|
}
|
|
7181
7183
|
async acceptCall(e) {
|
|
7182
7184
|
return this._send(B.ACCEPT_CALL, { mediaSettings: e });
|
|
7183
7185
|
}
|
|
7184
7186
|
async changeMediaSettings(e) {
|
|
7185
|
-
return this._send(B.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0,
|
|
7187
|
+
return this._send(B.CHANGE_MEDIA_SETTINGS, { mediaSettings: e }, !0, Fa);
|
|
7186
7188
|
}
|
|
7187
7189
|
async changeParticipantState(e, t) {
|
|
7188
7190
|
let n = { participantState: { state: e } };
|
|
7189
7191
|
return t && (n.participantId = t), this._sendRaw(B.CHANGE_PARTICIPANT_STATE, n);
|
|
7190
7192
|
}
|
|
7191
7193
|
async hold(e) {
|
|
7192
|
-
let t =
|
|
7194
|
+
let t = ba.get();
|
|
7193
7195
|
return this._send(B.HOLD, {
|
|
7194
7196
|
hold: e,
|
|
7195
7197
|
capabilities: e ? void 0 : t
|
|
@@ -7421,7 +7423,7 @@ var Ra = new Set([
|
|
|
7421
7423
|
if (this.disposed) throw new wn(e);
|
|
7422
7424
|
switch (t.route) {
|
|
7423
7425
|
case "producer":
|
|
7424
|
-
this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState ===
|
|
7426
|
+
this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === Pa && this._handleCommandsQueue(this.datachannelCommandsQueue);
|
|
7425
7427
|
break;
|
|
7426
7428
|
case "websocket":
|
|
7427
7429
|
if (this.transport.readyState === null) {
|
|
@@ -7491,9 +7493,9 @@ var Ra = new Set([
|
|
|
7491
7493
|
}
|
|
7492
7494
|
_handleErrorMessage(e) {
|
|
7493
7495
|
this._logger?.log(C.SOCKET_ACTION, `error-${e.error}`);
|
|
7494
|
-
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r =
|
|
7496
|
+
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = Ra(e, "Unknown signaling error");
|
|
7495
7497
|
switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
|
|
7496
|
-
case
|
|
7498
|
+
case Ia.SERVICE_UNAVAILABLE:
|
|
7497
7499
|
let i = new O(D.SERVICE_UNAVAILABLE, {
|
|
7498
7500
|
callError: n,
|
|
7499
7501
|
message: r,
|
|
@@ -7505,7 +7507,7 @@ var Ra = new Set([
|
|
|
7505
7507
|
reason: D.SERVICE_UNAVAILABLE
|
|
7506
7508
|
});
|
|
7507
7509
|
break;
|
|
7508
|
-
case
|
|
7510
|
+
case Ia.CONVERSATION_ENDED:
|
|
7509
7511
|
this.conversationReject ? this.conversationReject(new O(e.reason || x.SIGNALING_FAILED, {
|
|
7510
7512
|
callError: n,
|
|
7511
7513
|
message: r,
|
|
@@ -7516,22 +7518,22 @@ var Ra = new Set([
|
|
|
7516
7518
|
reason: e.reason
|
|
7517
7519
|
});
|
|
7518
7520
|
break;
|
|
7519
|
-
case
|
|
7520
|
-
case
|
|
7521
|
+
case Ia.ILLEGAL_PARTICIPANT_STATE:
|
|
7522
|
+
case Ia.PARTICIPANT_NOT_FOUND:
|
|
7521
7523
|
this._throwError(new O(x.SIGNALING_FAILED, {
|
|
7522
7524
|
callError: n,
|
|
7523
7525
|
message: r,
|
|
7524
7526
|
remote: !0
|
|
7525
7527
|
}));
|
|
7526
7528
|
break;
|
|
7527
|
-
case
|
|
7529
|
+
case Ia.OBSOLETE_CLIENT:
|
|
7528
7530
|
this.conversationReject?.(new O(e.reason || D.OBSOLETE_CLIENT, {
|
|
7529
7531
|
callError: n,
|
|
7530
7532
|
message: r,
|
|
7531
7533
|
remote: !0
|
|
7532
7534
|
}));
|
|
7533
7535
|
break;
|
|
7534
|
-
case
|
|
7536
|
+
case Ia.INVALID_TOKEN:
|
|
7535
7537
|
default:
|
|
7536
7538
|
if (e.sequence || t === yr.WEBTRANSPORT) break;
|
|
7537
7539
|
if (this.connected) this._throwError(new O(e.reason || x.SIGNALING_FAILED, {
|
|
@@ -7633,13 +7635,13 @@ var Ra = new Set([
|
|
|
7633
7635
|
let r = this.responseHandlers[n.sequence];
|
|
7634
7636
|
window.clearTimeout(r.responseTimer);
|
|
7635
7637
|
let i = W.measureMark(r.statMarkName);
|
|
7636
|
-
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(
|
|
7638
|
+
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(Ra(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(Ra(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
|
|
7637
7639
|
}
|
|
7638
7640
|
_handleCommandsQueue(e) {
|
|
7639
7641
|
for (; e.length > 0;) {
|
|
7640
7642
|
let t = e.shift();
|
|
7641
7643
|
if (this._debug.debug(`[signaling] command send [${t.sequence}]`, `'${t.name}'`, t.params), t.route === "producer") {
|
|
7642
|
-
if (this.producerCommandDataChannel?.readyState !==
|
|
7644
|
+
if (this.producerCommandDataChannel?.readyState !== Pa) {
|
|
7643
7645
|
t.reject(/* @__PURE__ */ Error(`Invalid data channel state: ${this.producerCommandDataChannel?.readyState}`));
|
|
7644
7646
|
return;
|
|
7645
7647
|
}
|
|
@@ -7724,7 +7726,7 @@ var Ra = new Set([
|
|
|
7724
7726
|
}
|
|
7725
7727
|
_onTransportFailed(e) {
|
|
7726
7728
|
switch (e.failure) {
|
|
7727
|
-
case
|
|
7729
|
+
case Ma.EMPTY_ENDPOINT:
|
|
7728
7730
|
this.conversationReject?.(new O(x.SIGNALING_FAILED, {
|
|
7729
7731
|
callError: {
|
|
7730
7732
|
scope: "internal",
|
|
@@ -7735,7 +7737,7 @@ var Ra = new Set([
|
|
|
7735
7737
|
remote: e.remote
|
|
7736
7738
|
}));
|
|
7737
7739
|
break;
|
|
7738
|
-
case
|
|
7740
|
+
case Ma.NETWORK_ERROR:
|
|
7739
7741
|
this._fail(new O(D.NETWORK_ERROR, { callError: {
|
|
7740
7742
|
scope: "network",
|
|
7741
7743
|
source: e.source,
|
|
@@ -7743,7 +7745,7 @@ var Ra = new Set([
|
|
|
7743
7745
|
description: "connection-failed"
|
|
7744
7746
|
} }));
|
|
7745
7747
|
break;
|
|
7746
|
-
case
|
|
7748
|
+
case Ma.ABORTED:
|
|
7747
7749
|
this._debug.debug("[signaling] aborted reconnect"), this._fail(new O(D.CANCELED));
|
|
7748
7750
|
break;
|
|
7749
7751
|
}
|
|
@@ -7755,7 +7757,7 @@ var Ra = new Set([
|
|
|
7755
7757
|
this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStat(br.FAILED_PINGS);
|
|
7756
7758
|
}
|
|
7757
7759
|
_attachNotificationCallError(e) {
|
|
7758
|
-
e.callError || !e.reason || e.reason === D.FAILED || e.reason === D.UNKNOWN_ERROR || !
|
|
7760
|
+
e.callError || !e.reason || e.reason === D.FAILED || e.reason === D.UNKNOWN_ERROR || !za.has(e.reason) && !e.errorCode || (e.callError = {
|
|
7759
7761
|
scope: "server",
|
|
7760
7762
|
source: this._getSocketType(),
|
|
7761
7763
|
code: e.errorCode || "protocol",
|
|
@@ -7763,7 +7765,7 @@ var Ra = new Set([
|
|
|
7763
7765
|
});
|
|
7764
7766
|
}
|
|
7765
7767
|
_createSignalingCallError(e, t, n) {
|
|
7766
|
-
let r =
|
|
7768
|
+
let r = La[e];
|
|
7767
7769
|
if (r) return {
|
|
7768
7770
|
scope: "server",
|
|
7769
7771
|
source: n,
|
|
@@ -7785,39 +7787,39 @@ var Ra = new Set([
|
|
|
7785
7787
|
...t
|
|
7786
7788
|
});
|
|
7787
7789
|
}
|
|
7788
|
-
},
|
|
7790
|
+
}, Va = /* @__PURE__ */ function(e) {
|
|
7789
7791
|
return e.INCOMING = "INCOMING", e.OUTGOING = "OUTGOING", e.JOINING = "JOINING", e;
|
|
7790
|
-
}(Ba || {}), Va = /* @__PURE__ */ function(e) {
|
|
7791
|
-
return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
|
|
7792
7792
|
}(Va || {}), Ha = /* @__PURE__ */ function(e) {
|
|
7793
|
-
return e.
|
|
7793
|
+
return e.USER = "USER", e.GROUP = "GROUP", e.CHAT = "CHAT", e;
|
|
7794
7794
|
}(Ha || {}), Ua = /* @__PURE__ */ function(e) {
|
|
7795
|
-
return e.
|
|
7795
|
+
return e.ATTENDEE = "ATTENDEE", e.HAND_UP = "HAND_UP", e;
|
|
7796
7796
|
}(Ua || {}), Wa = /* @__PURE__ */ function(e) {
|
|
7797
|
+
return e.ADD_PARTICIPANT = "ADD_PARTICIPANT", e.RECORD = "RECORD", e.MOVIE_SHARE = "MOVIE_SHARE", e;
|
|
7798
|
+
}(Wa || {}), Ga = /* @__PURE__ */ function(e) {
|
|
7797
7799
|
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;
|
|
7798
|
-
}(
|
|
7799
|
-
function
|
|
7800
|
+
}(Ga || {});
|
|
7801
|
+
function Ka(e, t) {
|
|
7800
7802
|
if (e.length !== t.length) return !1;
|
|
7801
7803
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
7802
7804
|
return !0;
|
|
7803
7805
|
}
|
|
7804
|
-
function
|
|
7806
|
+
function qa(e, t) {
|
|
7805
7807
|
let n = new Set(e);
|
|
7806
7808
|
for (let [e, r] of Object.entries(t)) r ? n.add(e) : n.delete(e);
|
|
7807
7809
|
return Array.from(n);
|
|
7808
7810
|
}
|
|
7809
7811
|
//#endregion
|
|
7810
7812
|
//#region src/enums/MuteState.ts
|
|
7811
|
-
var
|
|
7813
|
+
var Ja = /* @__PURE__ */ function(e) {
|
|
7812
7814
|
return e.UNMUTE = "UNMUTE", e.MUTE = "MUTE", e.MUTE_PERMANENT = "MUTE_PERMANENT", e;
|
|
7813
|
-
}(
|
|
7815
|
+
}(Ja || {}), Z = /* @__PURE__ */ function(e) {
|
|
7814
7816
|
return e.CALLED = "CALLED", e.ACCEPTED = "ACCEPTED", e.REJECTED = "REJECTED", e.HUNGUP = "HUNGUP", e;
|
|
7815
|
-
}(Z || {}),
|
|
7817
|
+
}(Z || {}), Ya = /* @__PURE__ */ function(e) {
|
|
7816
7818
|
return e.UPDATE = "UPDATE", e.REMOVE = "REMOVE", e.ACTIVATE = "ACTIVATE", e.TIMEOUT = "TIMEOUT", e;
|
|
7817
|
-
}(
|
|
7819
|
+
}(Ya || {}), Xa = /* @__PURE__ */ function(e) {
|
|
7818
7820
|
return e.NO_AVAILABLE_TRACKS = "no-available-tracks", e.UNKNOWN_ERROR = "unknown-error", e;
|
|
7819
|
-
}(
|
|
7820
|
-
function
|
|
7821
|
+
}(Xa || {});
|
|
7822
|
+
function Za(e) {
|
|
7821
7823
|
switch (e) {
|
|
7822
7824
|
case 1: return "no-available-tracks";
|
|
7823
7825
|
default: return "unknown-error";
|
|
@@ -7825,17 +7827,17 @@ function Xa(e) {
|
|
|
7825
7827
|
}
|
|
7826
7828
|
//#endregion
|
|
7827
7829
|
//#region src/enums/UserRole.ts
|
|
7828
|
-
var
|
|
7830
|
+
var Qa = /* @__PURE__ */ function(e) {
|
|
7829
7831
|
return e.CREATOR = "CREATOR", e.ADMIN = "ADMIN", e;
|
|
7830
|
-
}(
|
|
7831
|
-
function
|
|
7832
|
+
}(Qa || {});
|
|
7833
|
+
function $a(e, t) {
|
|
7832
7834
|
if (e.length !== t.length) return !1;
|
|
7833
7835
|
for (let n of e) if (!t.includes(n)) return !1;
|
|
7834
7836
|
return !0;
|
|
7835
7837
|
}
|
|
7836
7838
|
//#endregion
|
|
7837
7839
|
//#region src/static/ParticipantConnectionStatusUtils.ts
|
|
7838
|
-
var
|
|
7840
|
+
var eo;
|
|
7839
7841
|
(function(e) {
|
|
7840
7842
|
function t(e) {
|
|
7841
7843
|
let t = e?.transport ?? e?.lastEffective ?? N.WAITING, n = {
|
|
@@ -7887,8 +7889,8 @@ var $a;
|
|
|
7887
7889
|
shouldNotify: !0
|
|
7888
7890
|
});
|
|
7889
7891
|
}
|
|
7890
|
-
})(
|
|
7891
|
-
var
|
|
7892
|
+
})(eo || (eo = {}));
|
|
7893
|
+
var to = eo, no = /* @__PURE__ */ function(e) {
|
|
7892
7894
|
return e.USER = "USER", e.ANONYM = "ANONYM", e.GROUP = "GROUP", e;
|
|
7893
7895
|
}({}), Q;
|
|
7894
7896
|
(function(e) {
|
|
@@ -7951,7 +7953,7 @@ var eo = $a, to = /* @__PURE__ */ function(e) {
|
|
|
7951
7953
|
})(Q || (Q = {}));
|
|
7952
7954
|
//#endregion
|
|
7953
7955
|
//#region src/types/WaitingHall.ts
|
|
7954
|
-
function
|
|
7956
|
+
function ro(e) {
|
|
7955
7957
|
try {
|
|
7956
7958
|
return btoa(JSON.stringify(e));
|
|
7957
7959
|
} catch (t) {
|
|
@@ -7959,7 +7961,7 @@ function no(e) {
|
|
|
7959
7961
|
}
|
|
7960
7962
|
return null;
|
|
7961
7963
|
}
|
|
7962
|
-
function
|
|
7964
|
+
function io(e) {
|
|
7963
7965
|
try {
|
|
7964
7966
|
return JSON.parse(atob(e));
|
|
7965
7967
|
} catch (t) {
|
|
@@ -7969,12 +7971,12 @@ function ro(e) {
|
|
|
7969
7971
|
}
|
|
7970
7972
|
//#endregion
|
|
7971
7973
|
//#region src/utils/Conversation.ts
|
|
7972
|
-
var
|
|
7973
|
-
function
|
|
7974
|
+
var ao = (e, t) => j.objectReduce(e, (e, n, r) => (n === t && e.push(r), e), []);
|
|
7975
|
+
function oo(e) {
|
|
7974
7976
|
if (e.conversation?.muteStates) return e.conversation.muteStates;
|
|
7975
7977
|
if (e.muteState && e.muteOptions) return e.muteOptions.reduce((t, n) => (t[n] = e.muteState, t), {});
|
|
7976
7978
|
}
|
|
7977
|
-
function
|
|
7979
|
+
function so(e, t) {
|
|
7978
7980
|
switch (e) {
|
|
7979
7981
|
case S.AUDIO: return !!t.isAudioEnabled;
|
|
7980
7982
|
case S.AUDIO_SHARING: return !!t.isAudioSharingEnabled;
|
|
@@ -7983,12 +7985,12 @@ function oo(e, t) {
|
|
|
7983
7985
|
default: return !1;
|
|
7984
7986
|
}
|
|
7985
7987
|
}
|
|
7986
|
-
function
|
|
7988
|
+
function co(e, t) {
|
|
7987
7989
|
return j.objectReduce(e, (e, n, r) => {
|
|
7988
7990
|
switch (n) {
|
|
7989
|
-
case
|
|
7990
|
-
case
|
|
7991
|
-
|
|
7991
|
+
case Ja.MUTE:
|
|
7992
|
+
case Ja.MUTE_PERMANENT:
|
|
7993
|
+
so(r, t) || (e[r] = n);
|
|
7992
7994
|
break;
|
|
7993
7995
|
default:
|
|
7994
7996
|
e[r] = n;
|
|
@@ -7997,19 +7999,19 @@ function so(e, t) {
|
|
|
7997
7999
|
return e;
|
|
7998
8000
|
}, {});
|
|
7999
8001
|
}
|
|
8000
|
-
function
|
|
8002
|
+
function lo(e) {
|
|
8001
8003
|
let { muteStates: t = {}, mediaSettings: n } = e;
|
|
8002
|
-
return
|
|
8004
|
+
return co(t, n);
|
|
8003
8005
|
}
|
|
8004
|
-
function
|
|
8006
|
+
function uo(e, t) {
|
|
8005
8007
|
let n = e.conversation.participants.find((t) => j.comparePeerId(t.peerId, e.peerId));
|
|
8006
8008
|
if (!n) return t;
|
|
8007
8009
|
let { mediaSettings: r } = n;
|
|
8008
|
-
return
|
|
8010
|
+
return co(t, r);
|
|
8009
8011
|
}
|
|
8010
8012
|
//#endregion
|
|
8011
8013
|
//#region src/utils/IceServers.ts
|
|
8012
|
-
function
|
|
8014
|
+
function fo(e) {
|
|
8013
8015
|
if (!e) return null;
|
|
8014
8016
|
let t = Array.from(new Set((e.urls ?? []).map((e) => e.trim()).filter((e) => e.length > 0)));
|
|
8015
8017
|
return t.length ? {
|
|
@@ -8017,8 +8019,8 @@ function uo(e) {
|
|
|
8017
8019
|
urls: t
|
|
8018
8020
|
} : null;
|
|
8019
8021
|
}
|
|
8020
|
-
function
|
|
8021
|
-
let n = [], r =
|
|
8022
|
+
function po(e, t) {
|
|
8023
|
+
let n = [], r = fo(e), i = fo(t);
|
|
8022
8024
|
if (r && n.push(r), i) {
|
|
8023
8025
|
let e = [...i.urls];
|
|
8024
8026
|
e.push(`${e[e.length - 1]}?transport=tcp`), n.push({
|
|
@@ -8030,7 +8032,7 @@ function fo(e, t) {
|
|
|
8030
8032
|
}
|
|
8031
8033
|
//#endregion
|
|
8032
8034
|
//#region src/utils/Lz4.ts
|
|
8033
|
-
function
|
|
8035
|
+
function mo(e, t) {
|
|
8034
8036
|
let n = new Uint8Array(t), r = 0, i = 0;
|
|
8035
8037
|
for (; r < e.length && i < t;) {
|
|
8036
8038
|
let a = e[r++], o = a >> 4, s = a & 15;
|
|
@@ -8057,7 +8059,7 @@ function po(e, t) {
|
|
|
8057
8059
|
}
|
|
8058
8060
|
//#endregion
|
|
8059
8061
|
//#region src/utils/SerializeLatest.ts
|
|
8060
|
-
function
|
|
8062
|
+
function ho(e) {
|
|
8061
8063
|
let t, n = !1, r, i = async () => {
|
|
8062
8064
|
let t = !1, i;
|
|
8063
8065
|
for (; n;) {
|
|
@@ -8078,7 +8080,7 @@ function mo(e) {
|
|
|
8078
8080
|
}
|
|
8079
8081
|
//#endregion
|
|
8080
8082
|
//#region src/classes/AudioFix.ts
|
|
8081
|
-
var
|
|
8083
|
+
var go = class {
|
|
8082
8084
|
constructor(e, t = R, n = null) {
|
|
8083
8085
|
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;
|
|
8084
8086
|
}
|
|
@@ -8116,7 +8118,7 @@ var ho = class {
|
|
|
8116
8118
|
this._debug.warn("[AudioFix] Failed to fix RV (no packets): video restart", e);
|
|
8117
8119
|
}));
|
|
8118
8120
|
}
|
|
8119
|
-
},
|
|
8121
|
+
}, _o = class {
|
|
8120
8122
|
constructor(e, t = !1, n = R, r = null) {
|
|
8121
8123
|
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();
|
|
8122
8124
|
}
|
|
@@ -8217,13 +8219,13 @@ var ho = class {
|
|
|
8217
8219
|
};
|
|
8218
8220
|
//#endregion
|
|
8219
8221
|
//#region src/classes/conversation/ConversationResponseValidator.ts
|
|
8220
|
-
function
|
|
8221
|
-
e ||
|
|
8222
|
+
function vo(e, t) {
|
|
8223
|
+
e || bo(t, "response-empty"), e.id || bo(t, "id-empty"), e.endpoint || bo(t, "endpoint-empty"), !yo(e.stun_server) && !yo(e.turn_server) && bo(t, "ice-servers-empty");
|
|
8222
8224
|
}
|
|
8223
|
-
function
|
|
8225
|
+
function yo(e) {
|
|
8224
8226
|
return Array.isArray(e?.urls) && e.urls.length > 0;
|
|
8225
8227
|
}
|
|
8226
|
-
function
|
|
8228
|
+
function bo(e, t) {
|
|
8227
8229
|
let n = e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), r = e === "fastStart" || e === "fastJoin";
|
|
8228
8230
|
throw new O(r ? e === "fastStart" ? D.FAST_START_ERROR : D.FAST_JOIN_ERROR : D.UNKNOWN_ERROR, {
|
|
8229
8231
|
message: `Invalid ${e} response: ${t}`,
|
|
@@ -8242,7 +8244,7 @@ function yo(e, t) {
|
|
|
8242
8244
|
}
|
|
8243
8245
|
//#endregion
|
|
8244
8246
|
//#region src/classes/DebugInfo.ts
|
|
8245
|
-
var
|
|
8247
|
+
var xo = 90, So = 3, Co = class extends b {
|
|
8246
8248
|
constructor(e = R) {
|
|
8247
8249
|
super(), h(this, "_lastMemoryStat", {
|
|
8248
8250
|
percent: 0,
|
|
@@ -8258,9 +8260,9 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8258
8260
|
let e = window?.performance?.memory;
|
|
8259
8261
|
if (!e || !e.usedJSHeapSize || !e.jsHeapSizeLimit) return;
|
|
8260
8262
|
let t = Number((100 * e.usedJSHeapSize / e.jsHeapSizeLimit).toFixed(2)), n = Number((e.usedJSHeapSize / 1024 / 1024).toFixed(1));
|
|
8261
|
-
t >
|
|
8263
|
+
t > xo ? this._debug.warn(`High memory usage: ${t}% (${n} MiB)`) : (!this._lastMemoryStat.percent || Math.abs(t - this._lastMemoryStat.percent) >= So) && (this._debug.debug(`Memory usage: ${t}% (${n} MiB)`), this._lastMemoryStat.percent = t, this._lastMemoryStat.bytes = e.usedJSHeapSize);
|
|
8262
8264
|
}
|
|
8263
|
-
},
|
|
8265
|
+
}, wo = class {
|
|
8264
8266
|
constructor({ api: e, debug: t, getParticipants: n, isMe: r, updateDisplayLayout: i, onNonFatalError: a }) {
|
|
8265
8267
|
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;
|
|
8266
8268
|
}
|
|
@@ -8375,7 +8377,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8375
8377
|
let n = e, r = t;
|
|
8376
8378
|
return n.width !== r.width || n.height !== r.height || n.fit !== r.fit || n.priority !== r.priority;
|
|
8377
8379
|
}
|
|
8378
|
-
},
|
|
8380
|
+
}, To = 44100, Eo = class {
|
|
8379
8381
|
constructor(e, t) {
|
|
8380
8382
|
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]);
|
|
8381
8383
|
try {
|
|
@@ -8392,7 +8394,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8392
8394
|
_getBins() {
|
|
8393
8395
|
if (!this._fftBins || !this._analyser) return new Uint8Array();
|
|
8394
8396
|
this._analyser.getByteFrequencyData(this._fftBins);
|
|
8395
|
-
let e =
|
|
8397
|
+
let e = To / this._fftBins.length, t = Math.ceil(M.voiceParams.minFreq / e), n = Math.floor(M.voiceParams.maxFreq / e);
|
|
8396
8398
|
return this._fftBins.subarray(t, n);
|
|
8397
8399
|
}
|
|
8398
8400
|
getLevel() {
|
|
@@ -8405,7 +8407,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8405
8407
|
destroy() {
|
|
8406
8408
|
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);
|
|
8407
8409
|
}
|
|
8408
|
-
},
|
|
8410
|
+
}, Do = class extends b {
|
|
8409
8411
|
constructor(e) {
|
|
8410
8412
|
super(), h(this, "_detector", null), h(this, "_interval", null);
|
|
8411
8413
|
let t = () => {
|
|
@@ -8421,7 +8423,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8421
8423
|
}), this.subscribe(e, qt.SOURCE_READY, n), n();
|
|
8422
8424
|
}
|
|
8423
8425
|
init(e) {
|
|
8424
|
-
this._stopDetector(), this._detector = new
|
|
8426
|
+
this._stopDetector(), this._detector = new Eo("local", e.clone());
|
|
8425
8427
|
}
|
|
8426
8428
|
_stopDetector() {
|
|
8427
8429
|
this._detector && (this._detector.track.stop(), this._detector.destroy(), this._detector = null);
|
|
@@ -8429,7 +8431,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8429
8431
|
destroy() {
|
|
8430
8432
|
this.unsubscribe(), this._interval && (window.clearTimeout(this._interval), this._interval = null), this._stopDetector();
|
|
8431
8433
|
}
|
|
8432
|
-
},
|
|
8434
|
+
}, Oo = class {
|
|
8433
8435
|
constructor(e, t = R) {
|
|
8434
8436
|
h(this, "processor", void 0), h(this, "queue", []), h(this, "isProcessing", !1), h(this, "_debug", void 0), this.processor = e, this._debug = t;
|
|
8435
8437
|
}
|
|
@@ -8449,9 +8451,9 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8449
8451
|
this.isProcessing = !1;
|
|
8450
8452
|
}
|
|
8451
8453
|
}
|
|
8452
|
-
},
|
|
8454
|
+
}, ko = /* @__PURE__ */ function(e) {
|
|
8453
8455
|
return e.VOLUMES_DETECTED = "VOLUMES_DETECTED", e;
|
|
8454
|
-
}({}),
|
|
8456
|
+
}({}), Ao = class extends b {
|
|
8455
8457
|
constructor(e) {
|
|
8456
8458
|
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));
|
|
8457
8459
|
}
|
|
@@ -8459,7 +8461,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8459
8461
|
this._interval && (window.clearTimeout(this._interval), this._interval = null), this.unsubscribe(), this._destroyDetectors();
|
|
8460
8462
|
}
|
|
8461
8463
|
_onRemoteTrackAdded(e, t, n) {
|
|
8462
|
-
if (n.kind === k.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new
|
|
8464
|
+
if (n.kind === k.audio && (this._detectors.get(e)?.destroy(), this._detectors.set(e, new Eo(e, n)), !this._interval)) {
|
|
8463
8465
|
let e = () => {
|
|
8464
8466
|
this._collectVolumes(), this._interval = window.setTimeout(e, M.voiceParams.interval);
|
|
8465
8467
|
};
|
|
@@ -8491,14 +8493,14 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8491
8493
|
}
|
|
8492
8494
|
_getAudioTrackLevelByParticipantId(e) {
|
|
8493
8495
|
if (this._isTransparentAudioMode()) return this._getTransparentAudioLevelByParticipantId(e);
|
|
8494
|
-
let t = this._detectors.get(
|
|
8496
|
+
let t = this._detectors.get(Jr.AUDIO_MIX);
|
|
8495
8497
|
return t ? t.getLevel() : null;
|
|
8496
8498
|
}
|
|
8497
8499
|
_getTransparentAudioLevelByParticipantId(e) {
|
|
8498
8500
|
if (!this._activeParticipants?.includes(e)) return null;
|
|
8499
8501
|
let t = null;
|
|
8500
8502
|
return this._detectors.forEach((e, n) => {
|
|
8501
|
-
if (!n.startsWith(`${
|
|
8503
|
+
if (!n.startsWith(`${Jr.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
|
|
8502
8504
|
let r = e.getLevel();
|
|
8503
8505
|
(!t || r.real > t.real) && (t = r);
|
|
8504
8506
|
}), t;
|
|
@@ -8517,11 +8519,11 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8517
8519
|
e.destroy();
|
|
8518
8520
|
}), this._detectors.clear();
|
|
8519
8521
|
}
|
|
8520
|
-
},
|
|
8522
|
+
}, jo = /* @__PURE__ */ function(e) {
|
|
8521
8523
|
return e.SPEAKER_CHANGED = "SPEAKER_CHANGED", e;
|
|
8522
|
-
}({}),
|
|
8524
|
+
}({}), Mo = class extends b {
|
|
8523
8525
|
constructor(e, t, n) {
|
|
8524
|
-
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e,
|
|
8526
|
+
super(), h(this, "_speakerId", null), h(this, "_serverSideSpeakerDetection", !1), this._serverSideSpeakerDetection = n === J.SERVER, this.subscribe(e, ko.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));
|
|
8525
8527
|
}
|
|
8526
8528
|
destroy() {
|
|
8527
8529
|
this.unsubscribe();
|
|
@@ -8543,9 +8545,9 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8543
8545
|
_onTopologyChanged(e) {
|
|
8544
8546
|
this._serverSideSpeakerDetection = e === J.SERVER;
|
|
8545
8547
|
}
|
|
8546
|
-
},
|
|
8548
|
+
}, No = 15e3, Po = 15e3, Fo = class extends b {
|
|
8547
8549
|
constructor(e, t, n, r = R, i = null) {
|
|
8548
|
-
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,
|
|
8550
|
+
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, ko.VOLUMES_DETECTED, this._onVolumesDetected.bind(this));
|
|
8549
8551
|
}
|
|
8550
8552
|
destroy() {
|
|
8551
8553
|
this.unsubscribe(), this._connectionTimeout && window.clearTimeout(this._connectionTimeout), this._volumeTimeout && window.clearTimeout(this._volumeTimeout);
|
|
@@ -8557,10 +8559,10 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8557
8559
|
this._connectionTimeout || !this._connectionTimeoutSuppressed || this._reportConnectionTimeout();
|
|
8558
8560
|
}
|
|
8559
8561
|
_getConnectionTimeout() {
|
|
8560
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
8562
|
+
return this._transport.getTopology() === J.DIRECT ? No : M.specListenerParams.connectionTimeout;
|
|
8561
8563
|
}
|
|
8562
8564
|
_getVolumeTimeout() {
|
|
8563
|
-
return this._transport.getTopology() === J.DIRECT ?
|
|
8565
|
+
return this._transport.getTopology() === J.DIRECT ? Po : M.specListenerParams.volumeTimeout;
|
|
8564
8566
|
}
|
|
8565
8567
|
_onTransportStateChanged(e, t) {
|
|
8566
8568
|
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`));
|
|
@@ -8593,7 +8595,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8593
8595
|
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}`));
|
|
8594
8596
|
}), e.length && this._debug.warn("There is silent participant, send callSpecError"), this._volumeTimeout = 0;
|
|
8595
8597
|
}
|
|
8596
|
-
},
|
|
8598
|
+
}, Io = class extends f {
|
|
8597
8599
|
constructor(e, t, n, r = () => void 0) {
|
|
8598
8600
|
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();
|
|
8599
8601
|
}
|
|
@@ -8673,7 +8675,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8673
8675
|
_now() {
|
|
8674
8676
|
return Date.now() - this._serverTimeDelta;
|
|
8675
8677
|
}
|
|
8676
|
-
},
|
|
8678
|
+
}, Lo = "invalid-error-metadata", Ro = 64, zo = new Set(Object.values(D)), Bo = new Set(Object.values(x)), Vo = {
|
|
8677
8679
|
[D.CANCELED]: {
|
|
8678
8680
|
type: "semantic",
|
|
8679
8681
|
reason: "canceled"
|
|
@@ -8794,7 +8796,7 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8794
8796
|
type: "semantic",
|
|
8795
8797
|
reason: "obsolete_client"
|
|
8796
8798
|
}
|
|
8797
|
-
},
|
|
8799
|
+
}, Ho = {
|
|
8798
8800
|
[x.MIC_CAMERA_PERMISSION]: {
|
|
8799
8801
|
type: "direct-error",
|
|
8800
8802
|
error: {
|
|
@@ -8883,14 +8885,14 @@ var bo = 90, xo = 3, So = class extends b {
|
|
|
8883
8885
|
}
|
|
8884
8886
|
}
|
|
8885
8887
|
};
|
|
8886
|
-
function
|
|
8887
|
-
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return
|
|
8888
|
+
function Uo(e) {
|
|
8889
|
+
if (typeof e != "string" && typeof e != "number" || typeof e == "number" && !Number.isFinite(e)) return Lo;
|
|
8888
8890
|
let t = String(e).trim();
|
|
8889
|
-
if (!t) return
|
|
8891
|
+
if (!t) return Lo;
|
|
8890
8892
|
let n = t.toLowerCase().replace(/[\s_:]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
8891
|
-
return !n || !/^[a-z0-9.-]+$/.test(n) ?
|
|
8893
|
+
return !n || !/^[a-z0-9.-]+$/.test(n) ? Lo : n.length > Ro ? `${n.slice(0, Ro - 3)}...` : n;
|
|
8892
8894
|
}
|
|
8893
|
-
function
|
|
8895
|
+
function Wo(e) {
|
|
8894
8896
|
if (!e || typeof e != "object") return !1;
|
|
8895
8897
|
let t = e;
|
|
8896
8898
|
switch (t.scope) {
|
|
@@ -8902,49 +8904,49 @@ function Uo(e) {
|
|
|
8902
8904
|
default: return !1;
|
|
8903
8905
|
}
|
|
8904
8906
|
}
|
|
8905
|
-
function
|
|
8906
|
-
let t =
|
|
8907
|
+
function Go(e) {
|
|
8908
|
+
let t = Uo(e.description);
|
|
8907
8909
|
if (e.scope === "unknown") return `unknown:${t}`;
|
|
8908
|
-
let n =
|
|
8910
|
+
let n = Uo(e.code);
|
|
8909
8911
|
return e.scope === "internal" ? `internal:${n}:${t}` : `${e.scope}:${e.source}:${n}:${t}`;
|
|
8910
8912
|
}
|
|
8911
|
-
function
|
|
8913
|
+
function Ko(e, t) {
|
|
8912
8914
|
return t === null ? e.type === "direct-error" ? {
|
|
8913
8915
|
reason: "error",
|
|
8914
|
-
string_value:
|
|
8915
|
-
} : { reason: "failed" } :
|
|
8916
|
+
string_value: Go(e.error)
|
|
8917
|
+
} : { reason: "failed" } : Wo(t) ? {
|
|
8916
8918
|
reason: "error",
|
|
8917
|
-
string_value:
|
|
8919
|
+
string_value: Go(t)
|
|
8918
8920
|
} : { reason: "failed" };
|
|
8919
8921
|
}
|
|
8920
|
-
function
|
|
8922
|
+
function qo(e) {
|
|
8921
8923
|
if (e.hangup) {
|
|
8922
|
-
let t =
|
|
8924
|
+
let t = Vo[e.hangup];
|
|
8923
8925
|
return t ? t.type === "semantic" ? e.hangup === D.OBSOLETE_CLIENT && e.custom_error?.vchat_detailed_api_error.code ? {
|
|
8924
8926
|
reason: t.reason,
|
|
8925
8927
|
string_value: e.custom_error.vchat_detailed_api_error.code
|
|
8926
|
-
} : { reason: t.reason } :
|
|
8928
|
+
} : { reason: t.reason } : Ko(t, e.callError) : { reason: "failed" };
|
|
8927
8929
|
}
|
|
8928
8930
|
if (e.error) {
|
|
8929
|
-
let t =
|
|
8930
|
-
return t ?
|
|
8931
|
+
let t = Ho[e.error];
|
|
8932
|
+
return t ? Ko(t, e.callError) : { reason: "failed" };
|
|
8931
8933
|
}
|
|
8932
8934
|
return { reason: "failed" };
|
|
8933
8935
|
}
|
|
8934
|
-
function
|
|
8935
|
-
return e instanceof O ?
|
|
8936
|
+
function Jo(e) {
|
|
8937
|
+
return e instanceof O ? qo(e) : typeof e == "string" && (zo.has(e) || Bo.has(e)) ? qo(new O(e)) : { reason: "failed" };
|
|
8936
8938
|
}
|
|
8937
8939
|
//#endregion
|
|
8938
8940
|
//#region src/classes/stat/CallLifecycleStats.ts
|
|
8939
|
-
var
|
|
8941
|
+
var Yo = {
|
|
8940
8942
|
wallNow: () => Date.now(),
|
|
8941
8943
|
monotonicNow: () => performance.now()
|
|
8942
8944
|
};
|
|
8943
|
-
function
|
|
8945
|
+
function Xo(e) {
|
|
8944
8946
|
return e === "anonym_join" ? "join" : e;
|
|
8945
8947
|
}
|
|
8946
|
-
var
|
|
8947
|
-
constructor(e, t =
|
|
8948
|
+
var Zo = class {
|
|
8949
|
+
constructor(e, t = Yo) {
|
|
8948
8950
|
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;
|
|
8949
8951
|
}
|
|
8950
8952
|
get firstMediaSentReported() {
|
|
@@ -8956,7 +8958,7 @@ var Xo = class {
|
|
|
8956
8958
|
markInitializationStarted({ source: e, conversationId: t }) {
|
|
8957
8959
|
if (this._destroyed || this._callStartLabel !== null) return;
|
|
8958
8960
|
let n = this._clock.wallNow();
|
|
8959
|
-
this._callStartLabel =
|
|
8961
|
+
this._callStartLabel = Xo(e), this._lifecycleStartedAtMonotonic = this._clock.monotonicNow(), t && (this._conversationId = t), this._record({
|
|
8960
8962
|
name: H.CALL_INIT,
|
|
8961
8963
|
source: e
|
|
8962
8964
|
}, n);
|
|
@@ -8984,7 +8986,7 @@ var Xo = class {
|
|
|
8984
8986
|
!this._canRecord() || this._firstMediaSent || (this._firstMediaSent = !0, this._record({ name: H.FIRST_MEDIA_SENT }));
|
|
8985
8987
|
}
|
|
8986
8988
|
markFinished(e) {
|
|
8987
|
-
this._finish(
|
|
8989
|
+
this._finish(Jo(e));
|
|
8988
8990
|
}
|
|
8989
8991
|
markTerminated() {
|
|
8990
8992
|
this._finish({ reason: "terminated" });
|
|
@@ -9035,7 +9037,7 @@ var Xo = class {
|
|
|
9035
9037
|
...n && { immediately: !0 }
|
|
9036
9038
|
});
|
|
9037
9039
|
}
|
|
9038
|
-
},
|
|
9040
|
+
}, Qo = class {
|
|
9039
9041
|
constructor(e, t) {
|
|
9040
9042
|
h(this, "_logger", void 0), h(this, "_codecUsages", /* @__PURE__ */ new Map()), h(this, "getCurrentTransportTopology", void 0), this._logger = e, this.getCurrentTransportTopology = t;
|
|
9041
9043
|
}
|
|
@@ -9098,7 +9100,7 @@ var Xo = class {
|
|
|
9098
9100
|
this.report(e);
|
|
9099
9101
|
}), this._codecUsages.clear();
|
|
9100
9102
|
}
|
|
9101
|
-
},
|
|
9103
|
+
}, $o = class {
|
|
9102
9104
|
constructor(e) {
|
|
9103
9105
|
h(this, "_logger", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), h(this, "_lastCallStatContext", null), this._logger = e;
|
|
9104
9106
|
}
|
|
@@ -9136,7 +9138,7 @@ var Xo = class {
|
|
|
9136
9138
|
...this._lastCallStatContext ?? {}
|
|
9137
9139
|
}, { occurredAt: t });
|
|
9138
9140
|
}
|
|
9139
|
-
},
|
|
9141
|
+
}, es = class {
|
|
9140
9142
|
constructor(e) {
|
|
9141
9143
|
if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
|
|
9142
9144
|
1,
|
|
@@ -9195,7 +9197,7 @@ var Xo = class {
|
|
|
9195
9197
|
5
|
|
9196
9198
|
];
|
|
9197
9199
|
}
|
|
9198
|
-
},
|
|
9200
|
+
}, ts = class {
|
|
9199
9201
|
constructor() {
|
|
9200
9202
|
h(this, "n", 0), h(this, "mean", 0);
|
|
9201
9203
|
}
|
|
@@ -9207,9 +9209,9 @@ var Xo = class {
|
|
|
9207
9209
|
get avg() {
|
|
9208
9210
|
return this.n ? this.mean : NaN;
|
|
9209
9211
|
}
|
|
9210
|
-
},
|
|
9212
|
+
}, ns = class {
|
|
9211
9213
|
constructor() {
|
|
9212
|
-
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new
|
|
9214
|
+
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new ts()), h(this, "p50", new es(.5)), h(this, "p95", new es(.95));
|
|
9213
9215
|
}
|
|
9214
9216
|
add(e) {
|
|
9215
9217
|
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++;
|
|
@@ -9227,11 +9229,11 @@ var Xo = class {
|
|
|
9227
9229
|
get hasData() {
|
|
9228
9230
|
return this.count > 0;
|
|
9229
9231
|
}
|
|
9230
|
-
},
|
|
9232
|
+
}, rs = class {
|
|
9231
9233
|
constructor(e) {
|
|
9232
9234
|
h(this, "_logger", void 0), h(this, "trackerByTransport", {
|
|
9233
|
-
ws: new
|
|
9234
|
-
wt: new
|
|
9235
|
+
ws: new ns(),
|
|
9236
|
+
wt: new ns()
|
|
9235
9237
|
}), h(this, "lastSeen", {}), this._logger = e;
|
|
9236
9238
|
}
|
|
9237
9239
|
mark(e) {
|
|
@@ -9260,17 +9262,17 @@ var Xo = class {
|
|
|
9260
9262
|
}
|
|
9261
9263
|
destroy() {
|
|
9262
9264
|
this.trackerByTransport = {
|
|
9263
|
-
ws: new
|
|
9264
|
-
wt: new
|
|
9265
|
+
ws: new ns(),
|
|
9266
|
+
wt: new ns()
|
|
9265
9267
|
}, this.lastSeen = {};
|
|
9266
9268
|
}
|
|
9267
|
-
},
|
|
9269
|
+
}, is = class {
|
|
9268
9270
|
constructor(e) {
|
|
9269
9271
|
h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
|
|
9270
9272
|
}
|
|
9271
9273
|
mark(e, t, n) {
|
|
9272
9274
|
let r = `${e}|${n}`, i;
|
|
9273
|
-
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new
|
|
9275
|
+
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new ns(), this.trackerByCommand.set(r, i)), i.add(t);
|
|
9274
9276
|
}
|
|
9275
9277
|
logMetrics() {
|
|
9276
9278
|
for (let [e, t] of this.trackerByCommand.entries()) {
|
|
@@ -9292,9 +9294,9 @@ var Xo = class {
|
|
|
9292
9294
|
destroy() {
|
|
9293
9295
|
this.trackerByCommand.clear();
|
|
9294
9296
|
}
|
|
9295
|
-
},
|
|
9297
|
+
}, as = class {
|
|
9296
9298
|
constructor(e, t, n, r) {
|
|
9297
|
-
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
|
|
9299
|
+
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 Io(e, t, n, r), this.lifecycle = new Zo(this.logger), this.statAggregator = new $o(this.logger), this.codecStatsAggregator = new Qo(this.logger, r), this.pings = new rs(this.logger), this.signalingCommands = new is(this.logger);
|
|
9298
9300
|
}
|
|
9299
9301
|
logHangup(e) {
|
|
9300
9302
|
this.lifecycle.markFinished(e);
|
|
@@ -9305,7 +9307,7 @@ var Xo = class {
|
|
|
9305
9307
|
destroy() {
|
|
9306
9308
|
this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.logger.destroy();
|
|
9307
9309
|
}
|
|
9308
|
-
},
|
|
9310
|
+
}, os = class {
|
|
9309
9311
|
constructor(e) {
|
|
9310
9312
|
h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
|
|
9311
9313
|
}
|
|
@@ -9330,8 +9332,8 @@ var Xo = class {
|
|
|
9330
9332
|
call_type: this._callType
|
|
9331
9333
|
}));
|
|
9332
9334
|
}
|
|
9333
|
-
},
|
|
9334
|
-
function
|
|
9335
|
+
}, ss = 1e3, cs = 1e4;
|
|
9336
|
+
function ls(e, t, n, r) {
|
|
9335
9337
|
return new O(e, {
|
|
9336
9338
|
callError: {
|
|
9337
9339
|
scope: "external",
|
|
@@ -9342,11 +9344,11 @@ function cs(e, t, n, r) {
|
|
|
9342
9344
|
message: r
|
|
9343
9345
|
});
|
|
9344
9346
|
}
|
|
9345
|
-
var
|
|
9347
|
+
var us = 15, $ = class e extends b {
|
|
9346
9348
|
constructor(e, t) {
|
|
9347
|
-
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",
|
|
9349
|
+
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", ho((e) => {
|
|
9348
9350
|
if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
|
|
9349
|
-
})), h(this, "_toggleLocalAudio",
|
|
9351
|
+
})), h(this, "_toggleLocalAudio", ho((e) => {
|
|
9350
9352
|
if (this._mediaSource) return this._stats.logger.log(C.MEDIA_STATUS, e ? "audio_1" : "audio_0"), this._mediaSource.toggleAudio(e);
|
|
9351
9353
|
})), h(this, "_changeMediaSettings", j.debounce(async (e) => {
|
|
9352
9354
|
if (this._signaling.ready) try {
|
|
@@ -9358,7 +9360,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9358
9360
|
captureAudio: !1
|
|
9359
9361
|
});
|
|
9360
9362
|
}
|
|
9361
|
-
}, 100)), this._stats = new
|
|
9363
|
+
}, 100)), this._stats = new as(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology), this._api = e, this._signaling = new Ba(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new Oo(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new wo({
|
|
9362
9364
|
api: this._api,
|
|
9363
9365
|
debug: this._debug,
|
|
9364
9366
|
getParticipants: () => this._participants,
|
|
@@ -9367,13 +9369,13 @@ var ls = 15, $ = class e extends b {
|
|
|
9367
9369
|
onNonFatalError: (e) => this._onNonFatalError(e)
|
|
9368
9370
|
}), this._onUnload = () => {
|
|
9369
9371
|
this._stopFirstMediaSentProbe(), this._conversation && this._api && this._sendHangupApi(this._conversation.id, this._state === "IDLE" ? D.CANCELED : D.HUNGUP), this._stats.destroy();
|
|
9370
|
-
}, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new
|
|
9372
|
+
}, window.addEventListener("pagehide", this._onUnload), this._statFirstMediaReceived = new os(this._stats.statAggregator), this._audioOutput = new _o(this._statFirstMediaReceived, M.transparentAudio, this._debug, this._stats.logger), M.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), ss));
|
|
9371
9373
|
}
|
|
9372
9374
|
static current() {
|
|
9373
9375
|
return z.getActive() ?? (M.hold ? null : z.getFirst());
|
|
9374
9376
|
}
|
|
9375
9377
|
static hangupAfterInit(e) {
|
|
9376
|
-
let t =
|
|
9378
|
+
let t = ds;
|
|
9377
9379
|
if (t) {
|
|
9378
9380
|
if (typeof e == "function" && (t._onFastHangup = e), t._delayedHangup === !1 && !t._conversation) {
|
|
9379
9381
|
t._delayedHangup = !0, t._abortController?.abort(new O(D.CANCELED));
|
|
@@ -9401,7 +9403,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9401
9403
|
return this._state === "HELD";
|
|
9402
9404
|
}
|
|
9403
9405
|
get isIncomingRinging() {
|
|
9404
|
-
return this._conversation?.direction ===
|
|
9406
|
+
return this._conversation?.direction === Va.INCOMING && this._state === "IDLE";
|
|
9405
9407
|
}
|
|
9406
9408
|
static debugSessionId() {
|
|
9407
9409
|
return e.current()?.debugSessionId ?? null;
|
|
@@ -9427,7 +9429,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9427
9429
|
L.onNonFatalError(Error(e), this.id);
|
|
9428
9430
|
}
|
|
9429
9431
|
getIncomingCallerExternalId() {
|
|
9430
|
-
return this._conversation?.direction ===
|
|
9432
|
+
return this._conversation?.direction === Va.INCOMING ? Object.values(this._participants).find((e) => !this._isMe(e.id))?.externalId ?? null : null;
|
|
9431
9433
|
}
|
|
9432
9434
|
_buildInternalParams() {
|
|
9433
9435
|
let e = {
|
|
@@ -9437,24 +9439,24 @@ var ls = 15, $ = class e extends b {
|
|
|
9437
9439
|
platform: M.platform,
|
|
9438
9440
|
protocolVersion: M.protocolVersion,
|
|
9439
9441
|
domainId: M.domain,
|
|
9440
|
-
capabilities:
|
|
9442
|
+
capabilities: Sa.getFlags()
|
|
9441
9443
|
};
|
|
9442
9444
|
return JSON.stringify(e);
|
|
9443
9445
|
}
|
|
9444
9446
|
async onStart({ opponentIds: e, opponentType: t, mediaOptions: n, payload: r = "", joiningAllowed: i = !1, requireAuthToJoin: a = !1, onlyAdminCanShareMovie: o, externalIds: s, onFastStart: c, conversationId: l }) {
|
|
9445
|
-
let u = l ?? j.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t ===
|
|
9447
|
+
let u = l ?? j.uuid(), d = (e?.length ?? 0) + (s?.length ?? 0), f = t === Ha.USER && d === 1 ? M.calleeUnavailableWaitingTime : void 0;
|
|
9446
9448
|
this._stats.lifecycle.markInitializationStarted({
|
|
9447
9449
|
source: "outgoing",
|
|
9448
9450
|
conversationId: u
|
|
9449
|
-
}), this._debug.setConversationId(u),
|
|
9451
|
+
}), this._debug.setConversationId(u), ds = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal);
|
|
9450
9452
|
try {
|
|
9451
9453
|
this._mediaSource = this._createMediaSource(), await this._mediaSource.request(n);
|
|
9452
9454
|
let l = this._mediaSource.mediaSettings;
|
|
9453
|
-
t ===
|
|
9455
|
+
t === Ha.CHAT || e && e.length > 1 ? this._logWithMediaSettings(C.OUTGOING_MULTIPARTY_CALL, l) : this._logWithMediaSettings(C.OUTGOING_CALL, l);
|
|
9454
9456
|
let d = await this._startConversation({
|
|
9455
9457
|
opponentIds: e,
|
|
9456
9458
|
opponentType: t,
|
|
9457
|
-
direction:
|
|
9459
|
+
direction: Va.OUTGOING,
|
|
9458
9460
|
mediaOptions: n,
|
|
9459
9461
|
payload: r,
|
|
9460
9462
|
joiningAllowed: i,
|
|
@@ -9478,18 +9480,18 @@ var ls = 15, $ = class e extends b {
|
|
|
9478
9480
|
let e = z.get(this._conversation.id);
|
|
9479
9481
|
e && e !== this && e._close(new O(D.HUNGUP, { remote: !0 }));
|
|
9480
9482
|
}
|
|
9481
|
-
return z.add(this), await z.setActive(this.id),
|
|
9483
|
+
return z.add(this), await z.setActive(this.id), ds = null, this._conversation.concurrent && await this._acceptConcurrent(), f && !this._registeredPeerReceived && this._state !== "CLOSE" && (this._calleeUnavailableTimer = window.setTimeout(() => {
|
|
9482
9484
|
this._calleeUnavailableTimer = null, this._close(new O(D.CALLEE_UNAVAILABLE), { signalingReason: D.CANCELED });
|
|
9483
9485
|
}, f)), this._conversation;
|
|
9484
9486
|
} catch (e) {
|
|
9485
|
-
throw
|
|
9487
|
+
throw ds = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to start conversation" }), e;
|
|
9486
9488
|
}
|
|
9487
9489
|
}
|
|
9488
9490
|
async onJoin(e) {
|
|
9489
9491
|
this._stats.lifecycle.markInitializationStarted({
|
|
9490
9492
|
source: e.anonymous ? "anonym_join" : "join",
|
|
9491
9493
|
conversationId: e.conversationId
|
|
9492
|
-
}),
|
|
9494
|
+
}), ds = 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);
|
|
9493
9495
|
try {
|
|
9494
9496
|
let t = !!e.observedIds?.length;
|
|
9495
9497
|
if (t && M.videoTracksCount > 0) throw this._debug.error("Observer mode: please set videoTracksCount=0"), new O(D.UNSUPPORTED, { callError: {
|
|
@@ -9506,9 +9508,9 @@ var ls = 15, $ = class e extends b {
|
|
|
9506
9508
|
code: "conversation",
|
|
9507
9509
|
description: "not-initialized-after-join"
|
|
9508
9510
|
} });
|
|
9509
|
-
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),
|
|
9511
|
+
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), ds = null, this._signaling.readyToSend(), L.onLocalStatus(this._conversation.waitForAdmin ? N.WAIT_FOR_ADMIN : N.WAITING_HALL, this.id), this._conversation) : this._onJoinPart2(r);
|
|
9510
9512
|
} catch (e) {
|
|
9511
|
-
throw
|
|
9513
|
+
throw ds = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
9512
9514
|
}
|
|
9513
9515
|
}
|
|
9514
9516
|
async _onJoinPart2(e, t = !0, n = !1) {
|
|
@@ -9523,7 +9525,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9523
9525
|
if (this._delayedHangup) throw new O(D.CANCELED);
|
|
9524
9526
|
this._processConnectionSharedMovieInfo(e), this._processConversationUrlSharingInfo(e), this._processConnectionAsrInfo(e);
|
|
9525
9527
|
let r = this._extractExternalRoomsData(e.rooms?.rooms, e.rooms?.roomId);
|
|
9526
|
-
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),
|
|
9528
|
+
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), ds = null);
|
|
9527
9529
|
let i = this._extractLocalParticipantFromConnection(e);
|
|
9528
9530
|
if (i) {
|
|
9529
9531
|
let e = j.mapParticipantState(i);
|
|
@@ -9531,7 +9533,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9531
9533
|
}
|
|
9532
9534
|
return t && this._openTransport(Object.values(this._participants), !1), this._conversation;
|
|
9533
9535
|
} catch (e) {
|
|
9534
|
-
throw
|
|
9536
|
+
throw ds = null, this._cleanupRegistry(), this._close(e, { errorText: "Unable to join conversation" }), e;
|
|
9535
9537
|
}
|
|
9536
9538
|
}
|
|
9537
9539
|
_extractExternalRooms(e) {
|
|
@@ -9551,7 +9553,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9551
9553
|
z.reserve(e), this._reservedId = e, this._stats.lifecycle.markInitializationStarted({
|
|
9552
9554
|
source: "incoming",
|
|
9553
9555
|
conversationId: e
|
|
9554
|
-
}), this._debug.setConversationId(e),
|
|
9556
|
+
}), this._debug.setConversationId(e), ds = this, this._abortController = new AbortController(), this._api.setAbortSignal(this._abortController?.signal), this._signaling.setAbortSignal(this._abortController?.signal), a && this._api.setUserId(a);
|
|
9555
9557
|
try {
|
|
9556
9558
|
let a = await this._prepareConversation(e, t, n, r, i);
|
|
9557
9559
|
if (this._mediaSource = this._createMediaSource(), !this._conversation) throw new O(D.UNKNOWN_ERROR, { callError: {
|
|
@@ -9560,20 +9562,20 @@ var ls = 15, $ = class e extends b {
|
|
|
9560
9562
|
description: "incoming-not-initialized"
|
|
9561
9563
|
} });
|
|
9562
9564
|
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);
|
|
9563
|
-
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),
|
|
9565
|
+
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), ds = null, this._delayedHangup) throw new O(D.CANCELED);
|
|
9564
9566
|
} catch (e) {
|
|
9565
|
-
throw
|
|
9567
|
+
throw ds = null, this._cleanupRegistry(), this._close(e, {
|
|
9566
9568
|
errorText: "Unable to handle inbound call push",
|
|
9567
9569
|
signalingReason: e instanceof O && e.hangup === D.BUSY ? D.BUSY : void 0
|
|
9568
9570
|
}), e;
|
|
9569
9571
|
}
|
|
9570
9572
|
}
|
|
9571
9573
|
_isInWaitingHall(e) {
|
|
9572
|
-
return !e.conversation || !e.conversation.options.includes(
|
|
9574
|
+
return !e.conversation || !e.conversation.options.includes(Ga.WAITING_HALL) ? !1 : this._isRestricted(e);
|
|
9573
9575
|
}
|
|
9574
9576
|
_isWaitForAdmin(e) {
|
|
9575
9577
|
if (!e.conversation) return !1;
|
|
9576
|
-
let t = e.conversation.options.includes(
|
|
9578
|
+
let t = e.conversation.options.includes(Ga.WAIT_FOR_ADMIN), n = e.conversation.options.includes(Ga.ADMIN_IS_HERE);
|
|
9577
9579
|
return !t || t && n ? !1 : this._isRestricted(e);
|
|
9578
9580
|
}
|
|
9579
9581
|
_isRestricted(e) {
|
|
@@ -9581,7 +9583,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9581
9583
|
return t && t.restricted || !1;
|
|
9582
9584
|
}
|
|
9583
9585
|
_isAudienceMode(e) {
|
|
9584
|
-
return e.conversation?.options?.includes(
|
|
9586
|
+
return e.conversation?.options?.includes(Ga.AUDIENCE_MODE) || !1;
|
|
9585
9587
|
}
|
|
9586
9588
|
_isAudienceModeListener() {
|
|
9587
9589
|
return this._conversation?.audienceMode && this._conversation?.restricted;
|
|
@@ -9611,7 +9613,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9611
9613
|
let i = atob(n), a = new Uint8Array(i.length);
|
|
9612
9614
|
for (let e = 0; e < i.length; e++) a[e] = i.charCodeAt(e);
|
|
9613
9615
|
try {
|
|
9614
|
-
let e =
|
|
9616
|
+
let e = mo(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);
|
|
9615
9617
|
return {
|
|
9616
9618
|
token: i,
|
|
9617
9619
|
endpoint: l,
|
|
@@ -9814,10 +9816,10 @@ var ls = 15, $ = class e extends b {
|
|
|
9814
9816
|
let t = await this._api.getConversationParams(e);
|
|
9815
9817
|
this._debug.debug("Api.getConversationParams", t);
|
|
9816
9818
|
let { turn_server: n, stun_server: r } = t;
|
|
9817
|
-
return M.iceServers =
|
|
9819
|
+
return M.iceServers = po(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;
|
|
9818
9820
|
}
|
|
9819
9821
|
_setConversationParams({ turn_server: e, stun_server: t, endpoint: n, wt_endpoint: r, token: i, client_type: a }) {
|
|
9820
|
-
M.iceServers =
|
|
9822
|
+
M.iceServers = po(t, e), M.wssBase = n, M.wssToken = i, r && (M.wtsBase = r), a && (M.clientType = a);
|
|
9821
9823
|
}
|
|
9822
9824
|
_buildSignalingEndpoint({ baseEndpoint: e, userId: t, type: n, deviceIdx: r, conversationId: i, token: a, conversationParams: o }) {
|
|
9823
9825
|
let s = new URL(e), c = s.searchParams;
|
|
@@ -9849,10 +9851,10 @@ var ls = 15, $ = class e extends b {
|
|
|
9849
9851
|
isVideo: f,
|
|
9850
9852
|
joiningAllowed: a,
|
|
9851
9853
|
requireAuthToJoin: o
|
|
9852
|
-
}, this._abortController?.signal), !e) throw
|
|
9854
|
+
}, this._abortController?.signal), !e) throw ls(D.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
|
|
9853
9855
|
if (!e.internalCallerParams) {
|
|
9854
9856
|
let t = e.rejectedParticipants[0]?.status;
|
|
9855
|
-
throw
|
|
9857
|
+
throw ls(D.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
|
|
9856
9858
|
}
|
|
9857
9859
|
} catch (e) {
|
|
9858
9860
|
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) });
|
|
@@ -9874,10 +9876,10 @@ var ls = 15, $ = class e extends b {
|
|
|
9874
9876
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
9875
9877
|
}, this._debug.debug("FastStart", p), m = "fastStart";
|
|
9876
9878
|
} catch {
|
|
9877
|
-
throw
|
|
9879
|
+
throw ls(D.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
|
|
9878
9880
|
}
|
|
9879
9881
|
} else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
|
|
9880
|
-
|
|
9882
|
+
vo(p, m), this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
|
|
9881
9883
|
let ee = await this._connectSignaling(vr.START, p);
|
|
9882
9884
|
return this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
|
|
9883
9885
|
}
|
|
@@ -9902,9 +9904,9 @@ var ls = 15, $ = class e extends b {
|
|
|
9902
9904
|
joinLink: i,
|
|
9903
9905
|
isVideo: c,
|
|
9904
9906
|
internalParams: this._buildInternalParams()
|
|
9905
|
-
}, this._abortController?.signal), !e) throw
|
|
9906
|
-
if (!e.internalCallerParams) throw
|
|
9907
|
-
if (!e.conversationId) throw
|
|
9907
|
+
}, this._abortController?.signal), !e) throw ls(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
|
|
9908
|
+
if (!e.internalCallerParams) throw ls(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
|
|
9909
|
+
if (!e.conversationId) throw ls(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
|
|
9908
9910
|
} catch (e) {
|
|
9909
9911
|
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) });
|
|
9910
9912
|
}
|
|
@@ -9922,7 +9924,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9922
9924
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
9923
9925
|
}, this._debug.debug("FastJoin", l), u = "fastJoin";
|
|
9924
9926
|
} catch (e) {
|
|
9925
|
-
throw e instanceof O ? e :
|
|
9927
|
+
throw e instanceof O ? e : ls(D.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
|
|
9926
9928
|
}
|
|
9927
9929
|
} else if (t) l = await this._api.joinConversation(t, c, r), u = "joinConversation";
|
|
9928
9930
|
else if (i) l = await this._api.joinConversationByLink(i, c, a, o), u = "joinConversationByLink";
|
|
@@ -9931,13 +9933,13 @@ var ls = 15, $ = class e extends b {
|
|
|
9931
9933
|
code: "join",
|
|
9932
9934
|
description: "target-missing"
|
|
9933
9935
|
} });
|
|
9934
|
-
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id),
|
|
9936
|
+
if (this._debug.debug("Api.joinConversation", l), l.id && this._stats.lifecycle.bindConversationId(l.id), vo(l, u), l.id) {
|
|
9935
9937
|
if (z.has(l.id)) throw new O(D.HAS_ACTIVE_CALL);
|
|
9936
9938
|
z.reserve(l.id), this._reservedId = l.id;
|
|
9937
9939
|
}
|
|
9938
9940
|
this._setConversationParams(l);
|
|
9939
9941
|
let d = await this._connectSignaling(vr.JOIN, l);
|
|
9940
|
-
return this._setConversation(l, d,
|
|
9942
|
+
return this._setConversation(l, d, Va.JOINING), this._stats.lifecycle.markCallStarted(), d;
|
|
9941
9943
|
}
|
|
9942
9944
|
async _prepareConversation(e, t = A.USER, n, r, i) {
|
|
9943
9945
|
W.setMark(H.SIGNALING_CONNECTED), this._debug.debug("Conversation: push", {
|
|
@@ -9999,7 +10001,7 @@ var ls = 15, $ = class e extends b {
|
|
|
9999
10001
|
}), l.wt_endpoint = c);
|
|
10000
10002
|
}
|
|
10001
10003
|
let u = await this._connectSignaling(vr.ACCEPT, l);
|
|
10002
|
-
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,
|
|
10004
|
+
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, Va.INCOMING, t), u);
|
|
10003
10005
|
}
|
|
10004
10006
|
_createParticipant(e, t, n = !0) {
|
|
10005
10007
|
let r = Object.assign({
|
|
@@ -10026,7 +10028,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10026
10028
|
let e = this._getParticipantId(t ?? r.id);
|
|
10027
10029
|
e && (r.externalId = e);
|
|
10028
10030
|
}
|
|
10029
|
-
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 =
|
|
10031
|
+
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 = to.create(r.connectionStatus), r;
|
|
10030
10032
|
}
|
|
10031
10033
|
_getParticipantId(e) {
|
|
10032
10034
|
let t = this._api.userId(e);
|
|
@@ -10105,7 +10107,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10105
10107
|
}
|
|
10106
10108
|
_createMediaSource() {
|
|
10107
10109
|
let e = new Yt(this._debug, this._stats.logger);
|
|
10108
|
-
return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new
|
|
10110
|
+
return this.subscribe(e, qt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, qt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new go(e, this._debug, this._stats.logger), e;
|
|
10109
10111
|
}
|
|
10110
10112
|
async _connectSignaling(e, t) {
|
|
10111
10113
|
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));
|
|
@@ -10113,7 +10115,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10113
10115
|
return this._stats.statAggregator.logEventualStat({ name: H.SIGNALING_CONNECTED }), n;
|
|
10114
10116
|
}
|
|
10115
10117
|
async _processConnection(e) {
|
|
10116
|
-
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(
|
|
10118
|
+
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(Ua.ATTENDEE, e.chatRoom.totalCount, e.chatRoom.firstParticipants, null, null);
|
|
10117
10119
|
}
|
|
10118
10120
|
_onConversationParticipantListChunk(e) {
|
|
10119
10121
|
let t = e.participants;
|
|
@@ -10182,7 +10184,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10182
10184
|
_registerParticipantLocalMuteState({ muteStates: e, unmuteOptions: t }) {
|
|
10183
10185
|
if (!e) return;
|
|
10184
10186
|
let n = async () => {
|
|
10185
|
-
let n =
|
|
10187
|
+
let n = ao(e, Ja.MUTE), r = ao(e, Ja.MUTE_PERMANENT);
|
|
10186
10188
|
for (let i of [n, r]) i.length && await this._onMuteParticipant({
|
|
10187
10189
|
muteStates: e,
|
|
10188
10190
|
unmuteOptions: t,
|
|
@@ -10196,8 +10198,8 @@ var ls = 15, $ = class e extends b {
|
|
|
10196
10198
|
if (!(!M.enableSessionStateUpdates || this._isMe(e))) return t;
|
|
10197
10199
|
}
|
|
10198
10200
|
_buildConnectionStatus(e, t, n, r = !1) {
|
|
10199
|
-
return
|
|
10200
|
-
transport: r ? N.ONHOLD :
|
|
10201
|
+
return to.create({
|
|
10202
|
+
transport: r ? N.ONHOLD : to.fromTransportState(n) ?? N.WAITING,
|
|
10201
10203
|
sessionState: this._remoteParticipantSessionState(e, t),
|
|
10202
10204
|
sessionStateApplicable: this._isParticipantSessionStateApplicable(e)
|
|
10203
10205
|
});
|
|
@@ -10206,12 +10208,12 @@ var ls = 15, $ = class e extends b {
|
|
|
10206
10208
|
return M.enableSessionStateUpdates && !this._isMe(e) && this._conversation?.topology === J.SERVER;
|
|
10207
10209
|
}
|
|
10208
10210
|
_setTransportStatus(e, t) {
|
|
10209
|
-
return
|
|
10211
|
+
return to.setTransport(e.connectionStatus, t);
|
|
10210
10212
|
}
|
|
10211
10213
|
_setSessionState(e, t) {
|
|
10212
|
-
let n =
|
|
10214
|
+
let n = to.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
10213
10215
|
this._emitParticipantTransition(e, n);
|
|
10214
|
-
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === N.CONNECTED, i =
|
|
10216
|
+
let r = e.connectionStatus.sessionStateApplicable && e.id === this._activeSpeakerId && e.connectionStatus.transport === N.CONNECTED, i = to.setSessionState(e.connectionStatus, t, r);
|
|
10215
10217
|
return this._emitParticipantTransition(e, i), i;
|
|
10216
10218
|
}
|
|
10217
10219
|
_emitParticipantTransition(e, t, n = null) {
|
|
@@ -10282,11 +10284,11 @@ var ls = 15, $ = class e extends b {
|
|
|
10282
10284
|
this._onRoomSwitched(t, !0);
|
|
10283
10285
|
}
|
|
10284
10286
|
_processMuteStates(e, t = !1) {
|
|
10285
|
-
let n =
|
|
10287
|
+
let n = oo(e);
|
|
10286
10288
|
this._setMuteStatesForRoomId(n, null);
|
|
10287
10289
|
for (let t of e.rooms?.rooms ?? []) this._setMuteStatesForRoomId(t.muteStates, t.id);
|
|
10288
10290
|
let r = this._getMuteStatesForCurrentRoom();
|
|
10289
|
-
t && (r =
|
|
10291
|
+
t && (r = uo(e, r));
|
|
10290
10292
|
let i = Object.keys(r), a = this._conversation?.roomId;
|
|
10291
10293
|
i.length && this._onMuteParticipant({
|
|
10292
10294
|
muteStates: r,
|
|
@@ -10306,15 +10308,15 @@ var ls = 15, $ = class e extends b {
|
|
|
10306
10308
|
}
|
|
10307
10309
|
_allocateTransport() {
|
|
10308
10310
|
if (!this._conversation || !this._mediaSource) return;
|
|
10309
|
-
this._transport = new
|
|
10310
|
-
let e = this._conversation.direction ===
|
|
10311
|
+
this._transport = new ua(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 Co(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));
|
|
10312
|
+
let e = this._conversation.direction === Va.OUTGOING && !this._conversation.concurrent, t = this._participants;
|
|
10311
10313
|
for (let n of Object.values(t)) (n.state === Z.ACCEPTED || n.state === Z.CALLED) && this._allocateParticipantTransport(n.id, e);
|
|
10312
10314
|
}
|
|
10313
10315
|
_createSpeakerDetector() {
|
|
10314
|
-
this._transport && this._conversation && (this._volumesDetector = new
|
|
10316
|
+
this._transport && this._conversation && (this._volumesDetector = new Ao(this._transport), this.subscribe(this._volumesDetector, ko.VOLUMES_DETECTED, this._onVolumesDetected.bind(this)), this._speakerDetector = new Mo(this._volumesDetector, this._transport, this._conversation.topology), this.subscribe(this._speakerDetector, jo.SPEAKER_CHANGED, this._onSpeakerChanged.bind(this)), this._localVolumeDetector = new Do(this._mediaSource));
|
|
10315
10317
|
}
|
|
10316
10318
|
_createSpecListener() {
|
|
10317
|
-
this._transport && this._volumesDetector && (this._specListener = new
|
|
10319
|
+
this._transport && this._volumesDetector && (this._specListener = new Fo(this._transport, this._volumesDetector, this._participants, this._debug, this._stats.logger));
|
|
10318
10320
|
}
|
|
10319
10321
|
_logDevices() {
|
|
10320
10322
|
let e = T.getCameras().length, t = T.getMicrophones().length;
|
|
@@ -10413,7 +10415,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10413
10415
|
_onRemoveParticipant(e) {
|
|
10414
10416
|
this._debug.debug(`Remove participant [${e}]`);
|
|
10415
10417
|
let t = [], n = this._participants;
|
|
10416
|
-
for (let r = 0; r <=
|
|
10418
|
+
for (let r = 0; r <= us; r++) {
|
|
10417
10419
|
let i = n[j.compose(e, r)];
|
|
10418
10420
|
i && t.push(i);
|
|
10419
10421
|
}
|
|
@@ -10503,11 +10505,11 @@ var ls = 15, $ = class e extends b {
|
|
|
10503
10505
|
this._waitingHallHoldPending = !1, await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus()), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener();
|
|
10504
10506
|
return;
|
|
10505
10507
|
}
|
|
10506
|
-
let n =
|
|
10508
|
+
let n = ba.get();
|
|
10507
10509
|
await this._signaling.hold(!1, n), this._restoreStateAfterHold();
|
|
10508
10510
|
let r = null;
|
|
10509
10511
|
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") {
|
|
10510
|
-
let e = this._conversation?.direction ===
|
|
10512
|
+
let e = this._conversation?.direction === Va.OUTGOING && !this._conversation.concurrent;
|
|
10511
10513
|
this._openTransport(r ?? Object.values(this._participants), e);
|
|
10512
10514
|
}
|
|
10513
10515
|
}
|
|
@@ -10630,13 +10632,13 @@ var ls = 15, $ = class e extends b {
|
|
|
10630
10632
|
let n = Nn(e), a = i[n.participantId];
|
|
10631
10633
|
if (a) {
|
|
10632
10634
|
let e;
|
|
10633
|
-
typeof t == "number" ? e =
|
|
10635
|
+
typeof t == "number" ? e = Za(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Xa.UNKNOWN_ERROR), r.push({
|
|
10634
10636
|
externalId: a.externalId,
|
|
10635
10637
|
errorReason: e
|
|
10636
10638
|
});
|
|
10637
10639
|
}
|
|
10638
10640
|
}
|
|
10639
|
-
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new
|
|
10641
|
+
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new fs("Could not allocate one or more participants", r);
|
|
10640
10642
|
}
|
|
10641
10643
|
async _cleanupCooldownQueue() {
|
|
10642
10644
|
let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
|
|
@@ -10644,7 +10646,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10644
10646
|
let n = t.next();
|
|
10645
10647
|
if (n.done) break;
|
|
10646
10648
|
let r = n.value;
|
|
10647
|
-
if (r[1] +
|
|
10649
|
+
if (r[1] + cs > Date.now()) break;
|
|
10648
10650
|
let i = r[0];
|
|
10649
10651
|
await this._stopStreaming(i), e[i] = { stopStream: !0 };
|
|
10650
10652
|
} while (!0);
|
|
@@ -10848,10 +10850,10 @@ var ls = 15, $ = class e extends b {
|
|
|
10848
10850
|
throw Error("transport is not initialized");
|
|
10849
10851
|
}
|
|
10850
10852
|
_isCallAdmin() {
|
|
10851
|
-
return this._conversation ? j.includesOneOf(this._conversation.roles, [
|
|
10853
|
+
return this._conversation ? j.includesOneOf(this._conversation.roles, [Qa.ADMIN, Qa.CREATOR]) : !1;
|
|
10852
10854
|
}
|
|
10853
10855
|
_checkAdminRole() {
|
|
10854
|
-
if (this._conversation && !j.includesOneOf(this._conversation.roles, [
|
|
10856
|
+
if (this._conversation && !j.includesOneOf(this._conversation.roles, [Qa.ADMIN, Qa.CREATOR])) throw Error("You don't have the required permission");
|
|
10855
10857
|
}
|
|
10856
10858
|
_isCalledState() {
|
|
10857
10859
|
return this._participantState === Z.CALLED;
|
|
@@ -10889,21 +10891,21 @@ var ls = 15, $ = class e extends b {
|
|
|
10889
10891
|
async changeOptions(e) {
|
|
10890
10892
|
if (this._signaling.ready && this._conversation) {
|
|
10891
10893
|
this._checkAdminRole(), await this._signaling.changeOptions(e);
|
|
10892
|
-
let t =
|
|
10894
|
+
let t = qa(this._conversation.options, e);
|
|
10893
10895
|
this._onOptionsChanged(t);
|
|
10894
10896
|
}
|
|
10895
10897
|
}
|
|
10896
10898
|
async getWaitingHall(e, t, n) {
|
|
10897
10899
|
if (!this._signaling) return Promise.reject();
|
|
10898
10900
|
let r = null;
|
|
10899
|
-
if (e && (r =
|
|
10901
|
+
if (e && (r = io(e), r)) {
|
|
10900
10902
|
let e = this._api.getDecorativeIdByInitialId(r.id);
|
|
10901
10903
|
r.id = e ?? r.id;
|
|
10902
10904
|
}
|
|
10903
10905
|
let i = await this._signaling.getWaitingHall(r, t, n);
|
|
10904
10906
|
if (i.error) return Promise.reject(i.message);
|
|
10905
10907
|
let a = i.participants || [], { externalIds: o } = this._resolveWaitingHallExternalIds(a, "getWaitingHall"), s = null;
|
|
10906
|
-
return a.length && i.hasMore && (s =
|
|
10908
|
+
return a.length && i.hasMore && (s = ro(a[a.length - 1].id)), {
|
|
10907
10909
|
participants: o,
|
|
10908
10910
|
pageMarker: s,
|
|
10909
10911
|
totalCount: i.totalCount || 0
|
|
@@ -10937,7 +10939,7 @@ var ls = 15, $ = class e extends b {
|
|
|
10937
10939
|
}
|
|
10938
10940
|
async promoteParticipant(e, t) {
|
|
10939
10941
|
if (this._signaling && this._conversation) try {
|
|
10940
|
-
if (!j.includesOneOf(this._conversation.options, [
|
|
10942
|
+
if (!j.includesOneOf(this._conversation.options, [Ga.WAITING_HALL, Ga.AUDIENCE_MODE])) throw Error("Unable to promote a participant in the conversation with current options");
|
|
10941
10943
|
if (this._checkAdminRole(), !e && t) throw Error("participantId is required");
|
|
10942
10944
|
await this._signaling.promoteParticipant(e, t);
|
|
10943
10945
|
} catch (t) {
|
|
@@ -11109,7 +11111,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11109
11111
|
let a = this._transport?.getState();
|
|
11110
11112
|
return n.participants.forEach((e) => {
|
|
11111
11113
|
let t = j.composeId(e), n = r[t];
|
|
11112
|
-
this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n,
|
|
11114
|
+
this._updateParticipantExternalId(n, e), this._setSessionState(n, this._remoteParticipantSessionState(t, e.sessionState)), n.isOnHold || this._setTransportStatus(n, to.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);
|
|
11113
11115
|
}), this._participantListChunkToExternalChunk(n);
|
|
11114
11116
|
}
|
|
11115
11117
|
async _getInitialParticiapntListChunk() {
|
|
@@ -11123,7 +11125,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11123
11125
|
_onLocalMediaStreamChanged(e) {
|
|
11124
11126
|
if (!this._conversation || !this._mediaSource) return;
|
|
11125
11127
|
let t = this._mediaSource.mediaSettings;
|
|
11126
|
-
this._debug.debug("Local media stream changed", t), e.kind === k.audio && this._mediaSource && (this._audioFix = new
|
|
11128
|
+
this._debug.debug("Local media stream changed", t), e.kind === k.audio && this._mediaSource && (this._audioFix = new go(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);
|
|
11127
11129
|
}
|
|
11128
11130
|
_onScreenSharingStatus(e) {
|
|
11129
11131
|
let t = this.mediaSettings;
|
|
@@ -11253,9 +11255,9 @@ var ls = 15, $ = class e extends b {
|
|
|
11253
11255
|
for (let n of e.conversation.participants) {
|
|
11254
11256
|
let e = j.composeId(n), i = n.roles || [];
|
|
11255
11257
|
if (this._isMe(e)) {
|
|
11256
|
-
|
|
11258
|
+
$a(this._conversation.roles, i) || this._onRolesChanged(e, i), t = () => {
|
|
11257
11259
|
this._registerParticipantLocalMuteState({
|
|
11258
|
-
muteStates:
|
|
11260
|
+
muteStates: lo(n),
|
|
11259
11261
|
unmuteOptions: n.unmuteOptions
|
|
11260
11262
|
});
|
|
11261
11263
|
};
|
|
@@ -11273,7 +11275,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11273
11275
|
let t = E(n.mediaSettings);
|
|
11274
11276
|
Wt(t, a.mediaSettings) || this._changeRemoteMediaSettings(e, t);
|
|
11275
11277
|
let r = j.mapParticipantState(n), o = a.participantState;
|
|
11276
|
-
j.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r),
|
|
11278
|
+
j.isEqualParticipantState(r, o) || await this._changeRemoteParticipantState(e, r), $a(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));
|
|
11277
11279
|
}
|
|
11278
11280
|
}
|
|
11279
11281
|
let i = this._participants;
|
|
@@ -11298,7 +11300,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11298
11300
|
this._close(new O(D.MISSED), { errorText: "Call accepted on other device" });
|
|
11299
11301
|
return;
|
|
11300
11302
|
}
|
|
11301
|
-
this._conversation?.direction ===
|
|
11303
|
+
this._conversation?.direction === Va.OUTGOING && !this._conversation.concurrent && this._stats.lifecycle.markOutgoingAccepted();
|
|
11302
11304
|
let r = this._getParticipant(t);
|
|
11303
11305
|
if (!r) {
|
|
11304
11306
|
let n = this._api.getDecorativeIdByInitialId(t);
|
|
@@ -11311,7 +11313,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11311
11313
|
let t = Q.fromSignaling(e.externalId, e.deviceIdx);
|
|
11312
11314
|
r.externalId = t, this._api.cacheExternalId(r.id, t);
|
|
11313
11315
|
}
|
|
11314
|
-
r.state = Z.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction ===
|
|
11316
|
+
r.state = Z.ACCEPTED, r.mediaSettings = E(e.mediaSettings), this._logWithMediaSettings(C.ACCEPTED_OUTGOING, r.mediaSettings), this._conversation && this._conversation.direction === Va.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);
|
|
11315
11317
|
let i = Object.keys(r.muteStates);
|
|
11316
11318
|
if (i.length && this._onMuteParticipant({
|
|
11317
11319
|
muteStates: r.muteStates,
|
|
@@ -11323,7 +11325,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11323
11325
|
this._reportMissingExternalIds([t], "ACCEPTED_CALL");
|
|
11324
11326
|
return;
|
|
11325
11327
|
}
|
|
11326
|
-
L.onAcceptedCall(r.externalId,
|
|
11328
|
+
L.onAcceptedCall(r.externalId, Sa.parseCapabilities(e.capabilities), this.id);
|
|
11327
11329
|
}
|
|
11328
11330
|
}
|
|
11329
11331
|
async _onHungup(e) {
|
|
@@ -11360,7 +11362,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11360
11362
|
return;
|
|
11361
11363
|
}
|
|
11362
11364
|
if (e.connected) {
|
|
11363
|
-
let e =
|
|
11365
|
+
let e = to.fromTransportState(this._transport?.getState());
|
|
11364
11366
|
e && this._setTransportStatus(n, e);
|
|
11365
11367
|
}
|
|
11366
11368
|
this._setSessionState(n, { connected: e.connected });
|
|
@@ -11437,7 +11439,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11437
11439
|
isOnHold: !!r.onHold
|
|
11438
11440
|
}, i), n = this._getParticipant(t);
|
|
11439
11441
|
}
|
|
11440
|
-
this._conversation && this._conversation.direction ===
|
|
11442
|
+
this._conversation && this._conversation.direction === Va.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);
|
|
11441
11443
|
let i = Object.keys(n.muteStates);
|
|
11442
11444
|
i.length && this._onMuteParticipant({
|
|
11443
11445
|
muteStates: n.muteStates,
|
|
@@ -11628,15 +11630,15 @@ var ls = 15, $ = class e extends b {
|
|
|
11628
11630
|
L.onAsrTranscription(t, e.text, e.timestamp, e.duration, this.id);
|
|
11629
11631
|
}
|
|
11630
11632
|
async _onRolesChanged(e, t) {
|
|
11631
|
-
if (this._conversation && this._isMe(e) &&
|
|
11633
|
+
if (this._conversation && this._isMe(e) && !$a(this._conversation.roles, t)) {
|
|
11632
11634
|
this._debug.debug(`Local roles changed: ${t}`), this._conversation.roles = t, L.onLocalRolesChanged(t, !1, this.id), this._processMuteState({
|
|
11633
|
-
mediaOptions:
|
|
11635
|
+
mediaOptions: ao(this._getMuteStatesForCurrentRoom(), Ja.MUTE_PERMANENT),
|
|
11634
11636
|
stateUpdated: !0
|
|
11635
|
-
}), j.includesOneOf(t, [
|
|
11637
|
+
}), j.includesOneOf(t, [Qa.ADMIN, Qa.CREATOR]) ? this._refreshRooms(!0) : t.length || this._onRoomSwitched(null);
|
|
11636
11638
|
return;
|
|
11637
11639
|
}
|
|
11638
11640
|
let n = this._getParticipant(e);
|
|
11639
|
-
n &&
|
|
11641
|
+
n && !$a(n.roles, t) && (this._debug.debug(`Roles for participant [${e}] changed: ${t}`), n.roles = t, L.onRolesChanged(n.externalId, t, !1, this.id));
|
|
11640
11642
|
}
|
|
11641
11643
|
async _onMuteParticipant(e, t = !1) {
|
|
11642
11644
|
if (!this._conversation) return;
|
|
@@ -11685,7 +11687,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11685
11687
|
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);
|
|
11686
11688
|
for (let [e, i] of d) {
|
|
11687
11689
|
let a = this._isCallAdmin() && n;
|
|
11688
|
-
if (!(i !==
|
|
11690
|
+
if (!(i !== Ja.MUTE && i !== Ja.MUTE_PERMANENT || a) && (this._isCallAdmin() && i === Ja.MUTE_PERMANENT && !n && (l[e] = Ja.MUTE), !(!t.includes(e) || r))) switch (e) {
|
|
11689
11691
|
case S.VIDEO:
|
|
11690
11692
|
u.isVideoEnabled && (L.onDeviceSwitched(S.VIDEO, !1, this.id), await this.toggleLocalVideo(!1));
|
|
11691
11693
|
break;
|
|
@@ -11722,7 +11724,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11722
11724
|
this._conversation.pinnedParticipantIdByRoom.set(r, t ? null : e);
|
|
11723
11725
|
}
|
|
11724
11726
|
_onOptionsChanged(e) {
|
|
11725
|
-
this._conversation && !
|
|
11727
|
+
this._conversation && !Ka(this._conversation.options, e) && (this._conversation.options = e, L.onOptionsChanged(e, this.id), e.includes(Ga.ADMIN_IS_HERE) ? this._conversation.restricted && this._conversation.waitingHall && L.onLocalStatus(N.WAITING_HALL, this.id) : e.includes(Ga.WAIT_FOR_ADMIN) && this._conversation.restricted && L.onLocalStatus(N.WAIT_FOR_ADMIN, this.id));
|
|
11726
11728
|
}
|
|
11727
11729
|
async _onNetworkStatus(e) {
|
|
11728
11730
|
if (this._conversation) {
|
|
@@ -11732,7 +11734,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11732
11734
|
if (this._isMe(r) || r === "") e = this._conversation.networkRating;
|
|
11733
11735
|
else if (n[r]) e = n[r].networkRating;
|
|
11734
11736
|
else continue;
|
|
11735
|
-
if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i,
|
|
11737
|
+
if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, Qr.getInstance().value = i, L.onLocalNetworkStatusChanged(i, this.id);
|
|
11736
11738
|
else {
|
|
11737
11739
|
let e = n[r];
|
|
11738
11740
|
e.networkRating = i, t.push({
|
|
@@ -11777,7 +11779,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11777
11779
|
}
|
|
11778
11780
|
_changeFeatureSet() {
|
|
11779
11781
|
if (this._conversation) {
|
|
11780
|
-
let e = this._state === "ACTIVE", t = this._conversation.features.includes(
|
|
11782
|
+
let e = this._state === "ACTIVE", t = this._conversation.features.includes(Wa.ADD_PARTICIPANT);
|
|
11781
11783
|
L.onCallState(e, t, this._conversation, this.id);
|
|
11782
11784
|
}
|
|
11783
11785
|
}
|
|
@@ -11811,7 +11813,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11811
11813
|
let n = this._getParticipant(e);
|
|
11812
11814
|
if (n) {
|
|
11813
11815
|
if (n.connectionStatus.sessionStateApplicable && n.connectionStatus.sessionState?.connected === !1) {
|
|
11814
|
-
let e =
|
|
11816
|
+
let e = to.fromTransportState(this._transport?.getState());
|
|
11815
11817
|
e && this._setTransportStatus(n, e), n.connectionStatus.sessionStateConnectedBySpeaker = !0;
|
|
11816
11818
|
let t = this._setTransportStatus(n, n.connectionStatus.transport);
|
|
11817
11819
|
this._emitParticipantTransition(n, t);
|
|
@@ -11821,7 +11823,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11821
11823
|
}
|
|
11822
11824
|
async _onTransportStateChanged(e, t) {
|
|
11823
11825
|
this._debug.debug(`Transport state has changed: ${t}`, e);
|
|
11824
|
-
let n =
|
|
11826
|
+
let n = to.fromTransportState(t);
|
|
11825
11827
|
if (!n) return;
|
|
11826
11828
|
let r = this._participants, i = [], a = e.reduce((e, n) => {
|
|
11827
11829
|
if (n in r) {
|
|
@@ -11832,20 +11834,34 @@ var ls = 15, $ = class e extends b {
|
|
|
11832
11834
|
}, []);
|
|
11833
11835
|
a.length && (this._updateDisplayLayoutFromCache(i), this._setParticipantsStatus(a, n));
|
|
11834
11836
|
}
|
|
11835
|
-
async _onTransportLocalStateChanged(e) {
|
|
11837
|
+
async _onTransportLocalStateChanged(e, t) {
|
|
11836
11838
|
if (this._debug.debug(`Local transport state has changed: ${e}`), e === q.CONNECTED && (T.releaseFirefoxMicrophonePermissionWarmup(), L.onLocalStatus(N.CONNECTED, this.id), this._transport?.getTopology() === J.SERVER)) {
|
|
11837
11839
|
let e = Object.values(this._myLastRequestedLayouts);
|
|
11838
11840
|
await this.updateDisplayLayout(e), this._displayLayoutRequester.resend();
|
|
11839
11841
|
}
|
|
11840
|
-
this._state !== "HELD" && ((e === q.CONNECTING || e === q.RECONNECTING) && this._areTransportParticipantsOnHold()
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11842
|
+
if (this._state !== "HELD" && !((e === q.CONNECTING || e === q.RECONNECTING) && this._areTransportParticipantsOnHold()) && (e === q.CONNECTING && L.onLocalStatus(N.CONNECTING, this.id), e === q.RECONNECTING && L.onLocalStatus(N.RECONNECT, this.id), e === q.FAILED && this._transport && this._transport.allocated().length === 0)) {
|
|
11843
|
+
if (t instanceof Kr) {
|
|
11844
|
+
this._close(new O(D.TIMEOUT, { callError: {
|
|
11845
|
+
scope: "network",
|
|
11846
|
+
source: "rtc",
|
|
11847
|
+
code: "reconnect-timeout",
|
|
11848
|
+
description: "peer-connection-timeout"
|
|
11849
|
+
} }), {
|
|
11850
|
+
errorText: "Peer connection reconnect timeout",
|
|
11851
|
+
signalingReason: D.TIMEOUT
|
|
11852
|
+
});
|
|
11853
|
+
return;
|
|
11854
|
+
}
|
|
11855
|
+
this._close(new O(D.FAILED, { callError: {
|
|
11856
|
+
scope: "network",
|
|
11857
|
+
source: "rtc",
|
|
11858
|
+
code: "connection-failed",
|
|
11859
|
+
description: "transport-failed"
|
|
11860
|
+
} }), {
|
|
11861
|
+
errorText: "Transport failed",
|
|
11862
|
+
signalingReason: D.FAILED
|
|
11863
|
+
});
|
|
11864
|
+
}
|
|
11849
11865
|
}
|
|
11850
11866
|
_areTransportParticipantsOnHold() {
|
|
11851
11867
|
if (!M.hold || !this._transport) return !1;
|
|
@@ -11855,9 +11871,9 @@ var ls = 15, $ = class e extends b {
|
|
|
11855
11871
|
return e.every((e) => t[e]?.isOnHold);
|
|
11856
11872
|
}
|
|
11857
11873
|
_onRemoteTrackAdded(e, t, n) {
|
|
11858
|
-
if (e.endsWith(
|
|
11859
|
-
else if (e.startsWith(
|
|
11860
|
-
else if (e.startsWith(
|
|
11874
|
+
if (e.endsWith(Jr.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), L.onRemoteMixedAudioStream(t, this.id);
|
|
11875
|
+
else if (e.startsWith(Jr.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
|
|
11876
|
+
else if (e.startsWith(Jr.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
|
|
11861
11877
|
else {
|
|
11862
11878
|
this._debug.debug(`Remote track added on the participant [${e}]`, { kind: n.kind });
|
|
11863
11879
|
let r = this._getParticipant(e);
|
|
@@ -11884,7 +11900,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11884
11900
|
}
|
|
11885
11901
|
}
|
|
11886
11902
|
async _removeAudioTrack(e, t, n) {
|
|
11887
|
-
if (e !==
|
|
11903
|
+
if (e !== Jr.AUDIO_MIX) {
|
|
11888
11904
|
let n = this._getParticipant(e);
|
|
11889
11905
|
if (!n || n.remoteStream && n.remoteStream !== t) return;
|
|
11890
11906
|
}
|
|
@@ -11899,7 +11915,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11899
11915
|
if (this._statFirstMediaReceived.markTopologyChanged(e), e === J.DIRECT && (this._onRemoteSignalledStall([]), this._onAudioMixStall(!1)), this._conversation) {
|
|
11900
11916
|
this._conversation.topology = e;
|
|
11901
11917
|
for (let e of Object.values(this._participants)) {
|
|
11902
|
-
let t =
|
|
11918
|
+
let t = to.setSessionStateApplicable(e.connectionStatus, this._isParticipantSessionStateApplicable(e.id));
|
|
11903
11919
|
this._emitParticipantTransition(e, t);
|
|
11904
11920
|
}
|
|
11905
11921
|
this._changeFeatureSet(), this._forceOpenTransportForAloneInCall();
|
|
@@ -11955,7 +11971,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11955
11971
|
].includes(t) ? null : this._setTransportStatus(e, t), n);
|
|
11956
11972
|
}
|
|
11957
11973
|
_setParticipantsStalled(e, t) {
|
|
11958
|
-
this._updateParticipantsStatus(e, (e) =>
|
|
11974
|
+
this._updateParticipantsStatus(e, (e) => to.setStalled(e.connectionStatus, t));
|
|
11959
11975
|
}
|
|
11960
11976
|
_updateParticipantsStatus(e, t, n = null) {
|
|
11961
11977
|
let r = e.reduce((e, n) => {
|
|
@@ -11974,7 +11990,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11974
11990
|
_onRoomsUpdated(e) {
|
|
11975
11991
|
if (this._isCalledState()) return;
|
|
11976
11992
|
let t = {}, n = [], r = [];
|
|
11977
|
-
for (let i of Object.keys(
|
|
11993
|
+
for (let i of Object.keys(Ya)) {
|
|
11978
11994
|
let a = e.updates[i];
|
|
11979
11995
|
a && (a?.rooms?.forEach((e) => {
|
|
11980
11996
|
let { room: t, missingParticipantIds: i } = this._convertRoomToExternal(e);
|
|
@@ -11989,7 +12005,7 @@ var ls = 15, $ = class e extends b {
|
|
|
11989
12005
|
}
|
|
11990
12006
|
_onRoomUpdated(e) {
|
|
11991
12007
|
let { room: t, missingParticipantIds: n } = this._convertRoomToExternal(e.room || null);
|
|
11992
|
-
e.events.some((e) => e ===
|
|
12008
|
+
e.events.some((e) => e === Ya.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));
|
|
11993
12009
|
}
|
|
11994
12010
|
_convertRoomToExternal(e) {
|
|
11995
12011
|
if (!e) return {
|
|
@@ -12100,7 +12116,7 @@ var ls = 15, $ = class e extends b {
|
|
|
12100
12116
|
n && r.push(n);
|
|
12101
12117
|
}
|
|
12102
12118
|
}
|
|
12103
|
-
r.length && !this._isCalledState() && L.onRoomsUpdated({ [
|
|
12119
|
+
r.length && !this._isCalledState() && L.onRoomsUpdated({ [Ya.UPDATE]: { rooms: r } }, this.id);
|
|
12104
12120
|
}
|
|
12105
12121
|
_onFeedback(e) {
|
|
12106
12122
|
let t = [];
|
|
@@ -12176,19 +12192,19 @@ var ls = 15, $ = class e extends b {
|
|
|
12176
12192
|
_getParticipant(e) {
|
|
12177
12193
|
return this._participants[e];
|
|
12178
12194
|
}
|
|
12179
|
-
},
|
|
12195
|
+
}, ds = null, fs = class e extends Error {
|
|
12180
12196
|
constructor(t, n) {
|
|
12181
12197
|
super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
|
|
12182
12198
|
}
|
|
12183
|
-
},
|
|
12184
|
-
function
|
|
12185
|
-
|
|
12199
|
+
}, ps = null, ms = null, hs = 64 * 1024;
|
|
12200
|
+
function gs() {
|
|
12201
|
+
ps = null, ms = null;
|
|
12186
12202
|
}
|
|
12187
|
-
function
|
|
12203
|
+
function _s(e) {
|
|
12188
12204
|
return e?.endsWith("/") ? e.slice(0, -1) : e;
|
|
12189
12205
|
}
|
|
12190
|
-
async function
|
|
12191
|
-
let n =
|
|
12206
|
+
async function vs(e = null, t) {
|
|
12207
|
+
let n = _s(e ?? M.apiBaseUrl);
|
|
12192
12208
|
if (n) return n;
|
|
12193
12209
|
if ((t ?? M.apiEnv) !== "AUTO") return M.apiEndpoint(t);
|
|
12194
12210
|
try {
|
|
@@ -12203,25 +12219,25 @@ async function _s(e = null, t) {
|
|
|
12203
12219
|
return R.warn("Failed to resolve API endpoint using DNS, default is used", e), M.apiEndpoint(t);
|
|
12204
12220
|
}
|
|
12205
12221
|
}
|
|
12206
|
-
async function
|
|
12207
|
-
return
|
|
12222
|
+
async function ys() {
|
|
12223
|
+
return ps || ms || (ms = vs(), ps = await ms, ms = null, ps);
|
|
12208
12224
|
}
|
|
12209
|
-
async function
|
|
12225
|
+
async function bs(e, t = {}, n = !1) {
|
|
12210
12226
|
if (!window.Blob || !window.navigator.sendBeacon) return;
|
|
12211
|
-
await
|
|
12212
|
-
let r =
|
|
12213
|
-
window.navigator.sendBeacon(`${
|
|
12227
|
+
await ys();
|
|
12228
|
+
let r = Es(e, t, n), i = new window.Blob([r], { type: "application/x-www-form-urlencoded" });
|
|
12229
|
+
window.navigator.sendBeacon(`${ps}/fb.do`, i);
|
|
12214
12230
|
}
|
|
12215
|
-
async function
|
|
12216
|
-
return await
|
|
12231
|
+
async function xs(e, t = {}, n = !1, r) {
|
|
12232
|
+
return await ys(), Cs(Es(e, t, n), r);
|
|
12217
12233
|
}
|
|
12218
|
-
async function
|
|
12219
|
-
await
|
|
12220
|
-
let r =
|
|
12221
|
-
return
|
|
12234
|
+
async function Ss(e, t = {}, n = !1) {
|
|
12235
|
+
await ys();
|
|
12236
|
+
let r = Es(e, t, n);
|
|
12237
|
+
return Cs(r, void 0, new Blob([r]).size <= hs);
|
|
12222
12238
|
}
|
|
12223
|
-
async function
|
|
12224
|
-
let r = `${t ??
|
|
12239
|
+
async function Cs(e, t, n = !1) {
|
|
12240
|
+
let r = `${t ?? ps}/fb.do`, i = new AbortController(), a = new O(x.NETWORK, { callError: {
|
|
12225
12241
|
scope: "network",
|
|
12226
12242
|
source: "api",
|
|
12227
12243
|
code: "timeout",
|
|
@@ -12240,16 +12256,16 @@ async function Ss(e, t, n = !1) {
|
|
|
12240
12256
|
} catch {
|
|
12241
12257
|
o = { result: a };
|
|
12242
12258
|
}
|
|
12243
|
-
if (!t.ok && !
|
|
12259
|
+
if (!t.ok && !ws(o)) throw new O(x.API, { callError: {
|
|
12244
12260
|
scope: "server",
|
|
12245
12261
|
source: "api",
|
|
12246
12262
|
code: `http-${t.status}`,
|
|
12247
12263
|
description: "http-error"
|
|
12248
12264
|
} });
|
|
12249
|
-
if (
|
|
12265
|
+
if (ws(o)) throw o;
|
|
12250
12266
|
return o;
|
|
12251
12267
|
} catch (e) {
|
|
12252
|
-
throw e instanceof O ? e : i.signal.aborted ? a :
|
|
12268
|
+
throw e instanceof O ? e : i.signal.aborted ? a : ws(e) ? e : new O(x.NETWORK, { callError: {
|
|
12253
12269
|
scope: "network",
|
|
12254
12270
|
source: "api",
|
|
12255
12271
|
code: "fetch-failed",
|
|
@@ -12259,12 +12275,12 @@ async function Ss(e, t, n = !1) {
|
|
|
12259
12275
|
clearTimeout(o);
|
|
12260
12276
|
}
|
|
12261
12277
|
}
|
|
12262
|
-
function
|
|
12278
|
+
function ws(e) {
|
|
12263
12279
|
if (typeof e != "object" || !e) return !1;
|
|
12264
12280
|
let t = e;
|
|
12265
12281
|
return typeof t.error_code == "number" && typeof t.error_msg == "string";
|
|
12266
12282
|
}
|
|
12267
|
-
async function
|
|
12283
|
+
async function Ts(e, t) {
|
|
12268
12284
|
try {
|
|
12269
12285
|
let n = await fetch(e, {
|
|
12270
12286
|
method: "POST",
|
|
@@ -12277,7 +12293,7 @@ async function ws(e, t) {
|
|
|
12277
12293
|
throw R.warn("Failed to send form data", e), e;
|
|
12278
12294
|
}
|
|
12279
12295
|
}
|
|
12280
|
-
function
|
|
12296
|
+
function Es(e, t = {}, n = !1) {
|
|
12281
12297
|
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));
|
|
12282
12298
|
for (let [e, n] of Object.entries(t)) typeof n == "object" && (t[e] = JSON.stringify(n));
|
|
12283
12299
|
let r = "";
|
|
@@ -12286,7 +12302,7 @@ function Ts(e, t = {}, n = !1) {
|
|
|
12286
12302
|
}
|
|
12287
12303
|
//#endregion
|
|
12288
12304
|
//#region src/abstract/BaseApi.ts
|
|
12289
|
-
var
|
|
12305
|
+
var Ds = class {
|
|
12290
12306
|
constructor() {
|
|
12291
12307
|
h(this, "_abortSignal", void 0);
|
|
12292
12308
|
}
|
|
@@ -12323,14 +12339,14 @@ var Es = class {
|
|
|
12323
12339
|
async getInbounds() {
|
|
12324
12340
|
return [];
|
|
12325
12341
|
}
|
|
12326
|
-
},
|
|
12342
|
+
}, Os = class e {
|
|
12327
12343
|
constructor() {
|
|
12328
12344
|
h(this, "_participantIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToParticipantId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
|
|
12329
12345
|
}
|
|
12330
12346
|
static _normalizeType(e) {
|
|
12331
|
-
return e.type ===
|
|
12347
|
+
return e.type === no.GROUP ? {
|
|
12332
12348
|
...e,
|
|
12333
|
-
type:
|
|
12349
|
+
type: no.USER
|
|
12334
12350
|
} : e;
|
|
12335
12351
|
}
|
|
12336
12352
|
getExternalId(e) {
|
|
@@ -12358,27 +12374,27 @@ var Es = class {
|
|
|
12358
12374
|
clear() {
|
|
12359
12375
|
this._participantIdToExternalId.clear(), this._externalIdToParticipantId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
|
|
12360
12376
|
}
|
|
12361
|
-
},
|
|
12362
|
-
function
|
|
12377
|
+
}, ks = "anonymLogin:", As = 700, js = 3e3;
|
|
12378
|
+
function Ms(e) {
|
|
12363
12379
|
let t = e.error_code;
|
|
12364
12380
|
switch (t) {
|
|
12365
|
-
case 2: return
|
|
12366
|
-
case 4: return e.error_msg.includes("participants.limit.exceeded") ?
|
|
12367
|
-
case 300: return
|
|
12368
|
-
case 1101: return
|
|
12369
|
-
case 1102: return
|
|
12370
|
-
case 1103: return
|
|
12371
|
-
case 1104: return
|
|
12372
|
-
case 1106: return
|
|
12373
|
-
case 1113: return
|
|
12381
|
+
case 2: return Ns(D.SERVICE_UNAVAILABLE, t, "service-unavailable");
|
|
12382
|
+
case 4: return e.error_msg.includes("participants.limit.exceeded") ? Ns(D.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Ns(x.API, t, "request-error");
|
|
12383
|
+
case 300: return Ns(D.NOT_FOUND, t, "not-found");
|
|
12384
|
+
case 1101: return Ns(D.SERVICE_DISABLED, t, "vchat-service-disabled");
|
|
12385
|
+
case 1102: return Ns(D.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
|
|
12386
|
+
case 1103: return Ns(D.NOT_FRIENDS, t, "friendship-required");
|
|
12387
|
+
case 1104: return Ps(t, "youla-api-error");
|
|
12388
|
+
case 1106: return Ps(t, "vk-api-error");
|
|
12389
|
+
case 1113: return Ns(D.CALLER_IS_REJECTED, t, "caller-is-rejected");
|
|
12374
12390
|
case 1114: {
|
|
12375
12391
|
let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
|
|
12376
|
-
return
|
|
12392
|
+
return Ns(r ? D.OBSOLETE_CLIENT : D.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
|
|
12377
12393
|
}
|
|
12378
|
-
default: return
|
|
12394
|
+
default: return Ns(x.API, t, "api-error");
|
|
12379
12395
|
}
|
|
12380
12396
|
}
|
|
12381
|
-
function
|
|
12397
|
+
function Ns(e, t, n, r) {
|
|
12382
12398
|
return {
|
|
12383
12399
|
type: e,
|
|
12384
12400
|
callError: {
|
|
@@ -12390,7 +12406,7 @@ function Ms(e, t, n, r) {
|
|
|
12390
12406
|
message: r
|
|
12391
12407
|
};
|
|
12392
12408
|
}
|
|
12393
|
-
function
|
|
12409
|
+
function Ps(e, t) {
|
|
12394
12410
|
return {
|
|
12395
12411
|
type: D.EXTERNAL_API_ERROR,
|
|
12396
12412
|
callError: {
|
|
@@ -12401,19 +12417,19 @@ function Ns(e, t) {
|
|
|
12401
12417
|
}
|
|
12402
12418
|
};
|
|
12403
12419
|
}
|
|
12404
|
-
var
|
|
12420
|
+
var Fs = class extends Ds {
|
|
12405
12421
|
constructor(...e) {
|
|
12406
|
-
super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new
|
|
12422
|
+
super(...e), h(this, "_uuid", void 0), h(this, "_idCache", new Os());
|
|
12407
12423
|
}
|
|
12408
12424
|
async _callUnsafe(e, t = {}, n = !1) {
|
|
12409
12425
|
let r = async (i) => {
|
|
12410
12426
|
try {
|
|
12411
|
-
return await
|
|
12427
|
+
return await xs(e, t, n);
|
|
12412
12428
|
} catch (t) {
|
|
12413
12429
|
if (!t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
|
|
12414
12430
|
i++;
|
|
12415
12431
|
let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
|
|
12416
|
-
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 *
|
|
12432
|
+
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 * As, js), { signal: this._abortSignal }), r(i);
|
|
12417
12433
|
}
|
|
12418
12434
|
throw R.warn(e, "error", t), t;
|
|
12419
12435
|
}
|
|
@@ -12436,8 +12452,8 @@ var Ps = class extends Es {
|
|
|
12436
12452
|
message: i?.error_msg,
|
|
12437
12453
|
code: i?.error_code
|
|
12438
12454
|
};
|
|
12439
|
-
if (i.custom_error && (a.custom_error = i.custom_error),
|
|
12440
|
-
let e =
|
|
12455
|
+
if (i.custom_error && (a.custom_error = i.custom_error), Is(i)) {
|
|
12456
|
+
let e = Ms(i);
|
|
12441
12457
|
throw a.callError = e.callError, a.message = e.message ?? a.message, new O(e.type, a);
|
|
12442
12458
|
}
|
|
12443
12459
|
throw new O(x.API, a);
|
|
@@ -12486,17 +12502,17 @@ var Ps = class extends Es {
|
|
|
12486
12502
|
});
|
|
12487
12503
|
}
|
|
12488
12504
|
_getAnonymLoginCacheKey() {
|
|
12489
|
-
return M.authToken ? `${
|
|
12505
|
+
return M.authToken ? `${ks}${M.authToken}` : null;
|
|
12490
12506
|
}
|
|
12491
12507
|
_getCachedAnonymLogin() {
|
|
12492
12508
|
let e = this._getAnonymLoginCacheKey();
|
|
12493
12509
|
if (!e) return null;
|
|
12494
12510
|
let t = at.get(e);
|
|
12495
|
-
return
|
|
12511
|
+
return Ls(t) ? t : (t && at.remove(e), null);
|
|
12496
12512
|
}
|
|
12497
12513
|
_setCachedAnonymLogin(e) {
|
|
12498
12514
|
let t = this._getAnonymLoginCacheKey();
|
|
12499
|
-
!t || !
|
|
12515
|
+
!t || !Ls(e) || at.set(t, {
|
|
12500
12516
|
session_key: e.session_key,
|
|
12501
12517
|
session_secret_key: e.session_secret_key,
|
|
12502
12518
|
uid: e.uid
|
|
@@ -12514,7 +12530,7 @@ var Ps = class extends Es {
|
|
|
12514
12530
|
}
|
|
12515
12531
|
async _sendClientStats(e, t = !0) {
|
|
12516
12532
|
try {
|
|
12517
|
-
(await
|
|
12533
|
+
(await Ss("vchat.clientStats", e))?.items_responses?.forEach((e) => {
|
|
12518
12534
|
e.errors && R.error("[vchat.clientStats]", e);
|
|
12519
12535
|
});
|
|
12520
12536
|
} catch (n) {
|
|
@@ -12525,7 +12541,7 @@ var Ps = class extends Es {
|
|
|
12525
12541
|
}
|
|
12526
12542
|
logClientStats(e) {
|
|
12527
12543
|
let t = {
|
|
12528
|
-
app_version: M.appVersion,
|
|
12544
|
+
app_version: String(M.appVersion),
|
|
12529
12545
|
sdk_type: "WEB",
|
|
12530
12546
|
sdk_version: M.sdkVersion,
|
|
12531
12547
|
version: 1,
|
|
@@ -12544,14 +12560,14 @@ var Ps = class extends Es {
|
|
|
12544
12560
|
}, a = await this._callUnsafe("vchat.getLogUploadUrl", i), o = new FormData(), s = new Blob([r], { type: "application/json" });
|
|
12545
12561
|
o.append("file", s, "log.json");
|
|
12546
12562
|
let c = new URL(a.upload_url);
|
|
12547
|
-
return c.searchParams.append("size", s.size.toString()),
|
|
12563
|
+
return c.searchParams.append("size", s.size.toString()), Ts(c.toString(), o);
|
|
12548
12564
|
}
|
|
12549
12565
|
async joinConversation(e, t = !1, n) {
|
|
12550
12566
|
let r = {
|
|
12551
12567
|
conversationId: e,
|
|
12552
12568
|
isVideo: t,
|
|
12553
12569
|
protocolVersion: M.protocolVersion,
|
|
12554
|
-
capabilities:
|
|
12570
|
+
capabilities: Sa.getFlags()
|
|
12555
12571
|
};
|
|
12556
12572
|
return n && (r.chatId = n), this._call("vchat.joinConversation", r);
|
|
12557
12573
|
}
|
|
@@ -12583,13 +12599,13 @@ var Ps = class extends Es {
|
|
|
12583
12599
|
externalIds: l
|
|
12584
12600
|
});
|
|
12585
12601
|
if (t && t.length) switch (n) {
|
|
12586
|
-
case
|
|
12602
|
+
case Ha.USER:
|
|
12587
12603
|
u.uids = t.join(",");
|
|
12588
12604
|
break;
|
|
12589
|
-
case
|
|
12605
|
+
case Ha.GROUP:
|
|
12590
12606
|
u.gid = t[0];
|
|
12591
12607
|
break;
|
|
12592
|
-
case
|
|
12608
|
+
case Ha.CHAT:
|
|
12593
12609
|
u.chatId = t[0];
|
|
12594
12610
|
break;
|
|
12595
12611
|
}
|
|
@@ -12632,7 +12648,7 @@ var Ps = class extends Es {
|
|
|
12632
12648
|
joinLink: e,
|
|
12633
12649
|
isVideo: t,
|
|
12634
12650
|
protocolVersion: M.protocolVersion,
|
|
12635
|
-
capabilities:
|
|
12651
|
+
capabilities: Sa.getFlags()
|
|
12636
12652
|
};
|
|
12637
12653
|
return n?.length && (i.observedIds = n.join(",")), M.anonymToken && (i.anonymToken = M.anonymToken), r && (i.payload = r), this._call("vchat.joinConversationByLink", i);
|
|
12638
12654
|
}
|
|
@@ -12669,7 +12685,7 @@ var Ps = class extends Es {
|
|
|
12669
12685
|
conversationId: e,
|
|
12670
12686
|
reason: t
|
|
12671
12687
|
};
|
|
12672
|
-
M.anonymToken && (r.anonymToken = M.anonymToken), n?.peerId && (r.peerId = n.peerId),
|
|
12688
|
+
M.anonymToken && (r.anonymToken = M.anonymToken), n?.peerId && (r.peerId = n.peerId), bs("vchat.hangupConversation", r);
|
|
12673
12689
|
}
|
|
12674
12690
|
async removeHistoryRecords(e) {
|
|
12675
12691
|
await this._call("vchat.removeHistoryRecords", { recordIds: e.join(",") });
|
|
@@ -12685,19 +12701,19 @@ var Ps = class extends Es {
|
|
|
12685
12701
|
return Array.isArray(e?.inbounds) ? e.inbounds : [];
|
|
12686
12702
|
}
|
|
12687
12703
|
};
|
|
12688
|
-
function
|
|
12704
|
+
function Is(e) {
|
|
12689
12705
|
return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
|
|
12690
12706
|
}
|
|
12691
|
-
function
|
|
12707
|
+
function Ls(e) {
|
|
12692
12708
|
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;
|
|
12693
12709
|
}
|
|
12694
12710
|
//#endregion
|
|
12695
12711
|
//#region src/enums/RecordRole.ts
|
|
12696
|
-
var
|
|
12712
|
+
var Rs = /* @__PURE__ */ function(e) {
|
|
12697
12713
|
return e.KING = "KING", e.PAWN = "PAWN", e;
|
|
12698
|
-
}(
|
|
12714
|
+
}(Rs || {}), zs = /* @__PURE__ */ function(e) {
|
|
12699
12715
|
return e.OFF = "0", e.ON = "1", e;
|
|
12700
|
-
}({}),
|
|
12716
|
+
}({}), Bs = class {
|
|
12701
12717
|
constructor(e) {
|
|
12702
12718
|
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;
|
|
12703
12719
|
}
|
|
@@ -12720,12 +12736,12 @@ var Ls = /* @__PURE__ */ function(e) {
|
|
|
12720
12736
|
let e = this._queue[this._readCursor];
|
|
12721
12737
|
return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
|
|
12722
12738
|
}
|
|
12723
|
-
},
|
|
12739
|
+
}, Vs = class {
|
|
12724
12740
|
constructor(e, t, n, r = null) {
|
|
12725
12741
|
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;
|
|
12726
12742
|
}
|
|
12727
12743
|
async authorize() {
|
|
12728
|
-
let e = await
|
|
12744
|
+
let e = await xs("auth.anonymLogin", {
|
|
12729
12745
|
session_data: {
|
|
12730
12746
|
device_id: this._uuid,
|
|
12731
12747
|
client_version: M.appVersion,
|
|
@@ -12734,7 +12750,7 @@ var Ls = /* @__PURE__ */ function(e) {
|
|
|
12734
12750
|
version: 3
|
|
12735
12751
|
},
|
|
12736
12752
|
application_key: this._apiKey
|
|
12737
|
-
}, !0, await
|
|
12753
|
+
}, !0, await vs(this._baseApiUrl, this._apiEnv));
|
|
12738
12754
|
return j.isObject(e) && !("error_msg" in e) ? (this._sessionKey = e.session_key, !0) : !1;
|
|
12739
12755
|
}
|
|
12740
12756
|
async hangupConversation(e, t) {
|
|
@@ -12744,9 +12760,9 @@ var Ls = /* @__PURE__ */ function(e) {
|
|
|
12744
12760
|
application_key: this._apiKey,
|
|
12745
12761
|
session_key: this._sessionKey
|
|
12746
12762
|
};
|
|
12747
|
-
t?.peerId && (n.peerId = t.peerId), await
|
|
12763
|
+
t?.peerId && (n.peerId = t.peerId), await xs("vchat.hangupConversation", n, !0, await vs(this._baseApiUrl, this._apiEnv));
|
|
12748
12764
|
}
|
|
12749
|
-
},
|
|
12765
|
+
}, Hs, Us = null, Ws = {
|
|
12750
12766
|
getCameras: T.getCameras,
|
|
12751
12767
|
getMicrophones: T.getMicrophones,
|
|
12752
12768
|
getOutput: T.getOutput,
|
|
@@ -12772,27 +12788,27 @@ var Ls = /* @__PURE__ */ function(e) {
|
|
|
12772
12788
|
baseChromeVersion: T.baseChromeVersion,
|
|
12773
12789
|
getAudioContext: T.getAudioContext,
|
|
12774
12790
|
isAudioShareSupported: T.isAudioShareSupported
|
|
12775
|
-
},
|
|
12776
|
-
function Gs(e) {
|
|
12777
|
-
Hs = e;
|
|
12778
|
-
}
|
|
12791
|
+
}, Gs = { participantMarkerCompare: j.participantMarkerCompare };
|
|
12779
12792
|
function Ks(e) {
|
|
12780
|
-
|
|
12793
|
+
Us = e;
|
|
12781
12794
|
}
|
|
12782
12795
|
function qs(e) {
|
|
12796
|
+
M.videoEffects = e;
|
|
12797
|
+
}
|
|
12798
|
+
function Js(e) {
|
|
12783
12799
|
M.audioEffects = e;
|
|
12784
12800
|
}
|
|
12785
|
-
function
|
|
12801
|
+
function Ys(e, t = {}) {
|
|
12786
12802
|
M.vad = e, M.vadOptions = t;
|
|
12787
12803
|
}
|
|
12788
|
-
function
|
|
12804
|
+
function Xs(e, t = null, n = {}, r = 1) {
|
|
12789
12805
|
M.vmoji = e, M.vmojiOptions = {
|
|
12790
12806
|
protocolVersion: r,
|
|
12791
12807
|
renderingOptions: n
|
|
12792
12808
|
}, t && e.setSDK(t);
|
|
12793
12809
|
}
|
|
12794
|
-
async function
|
|
12795
|
-
M.set(t),
|
|
12810
|
+
async function Zs(t) {
|
|
12811
|
+
M.set(t), Hs || (Hs = new Fs()), e.disableLog(!M.debug), R.toggle(M.debug), R.log(`Calls SDK ${M.sdkVersion}`, t), await T.init();
|
|
12796
12812
|
let n = T.getBrowserSupportFailure();
|
|
12797
12813
|
if (n) throw new O(x.UNSUPPORTED, { callError: {
|
|
12798
12814
|
scope: "internal",
|
|
@@ -12801,19 +12817,19 @@ async function Xs(t) {
|
|
|
12801
12817
|
} });
|
|
12802
12818
|
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}`);
|
|
12803
12819
|
}
|
|
12804
|
-
async function
|
|
12820
|
+
async function Qs(e, t = [S.AUDIO], n = "", r = !1, i = !1, a, o, s) {
|
|
12805
12821
|
let c = [];
|
|
12806
|
-
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]),
|
|
12822
|
+
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), ec([], Ha.USER, t, n, r, i, a, c, o, s);
|
|
12807
12823
|
}
|
|
12808
|
-
function
|
|
12824
|
+
function $s(e, t = []) {
|
|
12809
12825
|
let n = e.getIncomingCallerExternalId();
|
|
12810
12826
|
return n ? t.length === 1 && t[0].id === n.id && t[0].type === n.type : !1;
|
|
12811
12827
|
}
|
|
12812
|
-
async function
|
|
12828
|
+
async function ec(e, t = Ha.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
12813
12829
|
if (!M.hold && z.getActive()) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
|
|
12814
12830
|
let u = z.getAll().find((e) => e.isIncomingRinging);
|
|
12815
|
-
if (!M.hold && u &&
|
|
12816
|
-
return new $(new
|
|
12831
|
+
if (!M.hold && u && !$s(u, s)) throw R.error("There is already incoming call"), new O(D.HAS_ACTIVE_CALL);
|
|
12832
|
+
return new $(new Fs(), Us).onStart({
|
|
12817
12833
|
opponentIds: e,
|
|
12818
12834
|
opponentType: t,
|
|
12819
12835
|
mediaOptions: n,
|
|
@@ -12826,40 +12842,40 @@ async function $s(e, t = Va.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
|
12826
12842
|
conversationId: l
|
|
12827
12843
|
});
|
|
12828
12844
|
}
|
|
12829
|
-
async function
|
|
12830
|
-
return
|
|
12845
|
+
async function tc(e, t) {
|
|
12846
|
+
return nc(e, A.USER, void 0, t);
|
|
12831
12847
|
}
|
|
12832
|
-
async function
|
|
12848
|
+
async function nc(e, t = A.USER, n, r, i, a) {
|
|
12833
12849
|
if (e === $.id()) throw Error("Push has already been processed");
|
|
12834
|
-
return new $(new
|
|
12850
|
+
return new $(new Fs(), Us).onPush(e, t, n, r, i, a);
|
|
12835
12851
|
}
|
|
12836
|
-
async function
|
|
12837
|
-
return
|
|
12852
|
+
async function rc() {
|
|
12853
|
+
return Hs.getInbounds();
|
|
12838
12854
|
}
|
|
12839
|
-
async function
|
|
12840
|
-
return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t,
|
|
12855
|
+
async function ic(e, t) {
|
|
12856
|
+
return e && (M.authToken = e), t !== void 0 && M.apiBaseUrl !== t && (M.apiBaseUrl = t, gs()), Hs.authorize();
|
|
12841
12857
|
}
|
|
12842
|
-
async function
|
|
12843
|
-
return
|
|
12858
|
+
async function ac(e = [S.AUDIO], t) {
|
|
12859
|
+
return Al(t).accept(e);
|
|
12844
12860
|
}
|
|
12845
|
-
async function
|
|
12846
|
-
let t =
|
|
12861
|
+
async function oc(e) {
|
|
12862
|
+
let t = Dl(e?.conversationId);
|
|
12847
12863
|
if (t) return t.decline(e);
|
|
12848
12864
|
}
|
|
12849
|
-
async function
|
|
12850
|
-
return
|
|
12865
|
+
async function sc(e, t = [S.AUDIO]) {
|
|
12866
|
+
return cc(e, t);
|
|
12851
12867
|
}
|
|
12852
|
-
async function
|
|
12868
|
+
async function cc(e, t, n) {
|
|
12853
12869
|
if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
|
|
12854
|
-
return new $(new
|
|
12870
|
+
return new $(new Fs(), Us).onJoin({
|
|
12855
12871
|
conversationId: e,
|
|
12856
12872
|
mediaOptions: t,
|
|
12857
12873
|
chatId: n
|
|
12858
12874
|
});
|
|
12859
12875
|
}
|
|
12860
|
-
async function
|
|
12876
|
+
async function lc(e, t = [S.AUDIO], n, r, i, a) {
|
|
12861
12877
|
if (!M.hold && z.callsLength > 0) throw R.error("There is already active call"), new O(D.HAS_ACTIVE_CALL);
|
|
12862
|
-
return n && (M.anonymToken = n), new $(new
|
|
12878
|
+
return n && (M.anonymToken = n), new $(new Fs(), Us).onJoin({
|
|
12863
12879
|
joinLink: e,
|
|
12864
12880
|
mediaOptions: t,
|
|
12865
12881
|
observedIds: r,
|
|
@@ -12868,30 +12884,30 @@ async function cc(e, t = [S.AUDIO], n, r, i, a) {
|
|
|
12868
12884
|
anonymous: !!M.anonymToken
|
|
12869
12885
|
});
|
|
12870
12886
|
}
|
|
12871
|
-
function
|
|
12872
|
-
let t =
|
|
12887
|
+
function uc(e) {
|
|
12888
|
+
let t = Dl(e?.conversationId);
|
|
12873
12889
|
return t ? t.hangup(e) : ($.hangupAfterInit(e?.onFastHangup), Promise.resolve());
|
|
12874
12890
|
}
|
|
12875
|
-
async function
|
|
12891
|
+
async function dc(e, t) {
|
|
12876
12892
|
let n = Array.isArray(e) ? e : [e], r = $.current();
|
|
12877
12893
|
r && await r.addParticipant(n, t);
|
|
12878
12894
|
}
|
|
12879
|
-
async function
|
|
12895
|
+
async function fc(e, t) {
|
|
12880
12896
|
let n = $.current();
|
|
12881
12897
|
if (n) {
|
|
12882
12898
|
let r = e.map((e) => j.composeUserId(e));
|
|
12883
12899
|
await n.addParticipantLegacy(r, t);
|
|
12884
12900
|
}
|
|
12885
12901
|
}
|
|
12886
|
-
async function
|
|
12887
|
-
let n =
|
|
12902
|
+
async function pc(e, t = !1) {
|
|
12903
|
+
let n = jl(e, "removeParticipant");
|
|
12888
12904
|
if (n) try {
|
|
12889
12905
|
await n.conversation.removeParticipant(j.decomposeParticipantId(n.participantId).compositeUserId, t);
|
|
12890
12906
|
} catch (e) {
|
|
12891
12907
|
R.warn(`Failed to remove participant ${n.participantId}. Perhaps he is no longer on the call. ${e}`);
|
|
12892
12908
|
}
|
|
12893
12909
|
}
|
|
12894
|
-
async function
|
|
12910
|
+
async function mc(e, t = !1) {
|
|
12895
12911
|
let n = $.current();
|
|
12896
12912
|
if (n) try {
|
|
12897
12913
|
await n.removeParticipant(j.composeUserId(e), t);
|
|
@@ -12899,13 +12915,13 @@ async function pc(e, t = !1) {
|
|
|
12899
12915
|
R.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
|
|
12900
12916
|
}
|
|
12901
12917
|
}
|
|
12902
|
-
async function
|
|
12918
|
+
async function hc(e, t) {
|
|
12903
12919
|
let n = $.current();
|
|
12904
12920
|
if (e === "videoinput" && jt.contains(t)) return M.videoFacingMode = t, n ? (T.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
|
|
12905
12921
|
if (!await T._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
|
|
12906
12922
|
if (n) return n.changeDevice(e);
|
|
12907
12923
|
}
|
|
12908
|
-
async function
|
|
12924
|
+
async function gc(e, t) {
|
|
12909
12925
|
let n = typeof e == "object" ? {
|
|
12910
12926
|
...e,
|
|
12911
12927
|
fastScreenSharing: e.captureScreen && e.fastScreenSharing,
|
|
@@ -12914,40 +12930,40 @@ async function hc(e, t) {
|
|
|
12914
12930
|
captureScreen: e,
|
|
12915
12931
|
fastScreenSharing: !1,
|
|
12916
12932
|
captureAudio: !1
|
|
12917
|
-
}, r =
|
|
12933
|
+
}, r = Dl(t);
|
|
12918
12934
|
return r ? r.toggleScreenCapturing(n) : Promise.reject();
|
|
12919
12935
|
}
|
|
12920
|
-
function
|
|
12936
|
+
function _c(e) {
|
|
12921
12937
|
let t = $.current();
|
|
12922
12938
|
t && t.toggleAnimojiCapturing(e);
|
|
12923
12939
|
}
|
|
12924
|
-
async function
|
|
12940
|
+
async function vc(e, t = !1) {
|
|
12925
12941
|
let n = $.current();
|
|
12926
12942
|
n && await n.setVideoStream(e, t);
|
|
12927
12943
|
}
|
|
12928
|
-
async function
|
|
12929
|
-
let n =
|
|
12944
|
+
async function yc(e, t) {
|
|
12945
|
+
let n = Dl(t);
|
|
12930
12946
|
n && await n.toggleLocalVideo(e);
|
|
12931
12947
|
}
|
|
12932
|
-
async function
|
|
12933
|
-
let n =
|
|
12948
|
+
async function bc(e, t) {
|
|
12949
|
+
let n = Dl(t);
|
|
12934
12950
|
n && await n.toggleLocalAudio(e);
|
|
12935
12951
|
}
|
|
12936
|
-
async function
|
|
12952
|
+
async function xc(e) {
|
|
12937
12953
|
let t = $.current();
|
|
12938
12954
|
if (t) return t.setLocalResolution(e);
|
|
12939
12955
|
}
|
|
12940
|
-
async function
|
|
12956
|
+
async function Sc(e) {
|
|
12941
12957
|
let t = $.current();
|
|
12942
12958
|
t && await t.changePriorities(e);
|
|
12943
12959
|
}
|
|
12944
|
-
async function
|
|
12960
|
+
async function Cc(e, t) {
|
|
12945
12961
|
let n = $.current();
|
|
12946
12962
|
if (n) {
|
|
12947
12963
|
if (t) {
|
|
12948
12964
|
let r = n.getCachedParticipantIdByExternalId(t);
|
|
12949
12965
|
if (!r) {
|
|
12950
|
-
|
|
12966
|
+
Ol(t, "changeParticipantState", n);
|
|
12951
12967
|
return;
|
|
12952
12968
|
}
|
|
12953
12969
|
await n.changeParticipantState(e, r);
|
|
@@ -12956,161 +12972,161 @@ async function Sc(e, t) {
|
|
|
12956
12972
|
await n.changeParticipantState(e);
|
|
12957
12973
|
}
|
|
12958
12974
|
}
|
|
12959
|
-
async function
|
|
12975
|
+
async function wc() {
|
|
12960
12976
|
let e = $.current();
|
|
12961
12977
|
e && await e.putHandsDown();
|
|
12962
12978
|
}
|
|
12963
|
-
async function
|
|
12979
|
+
async function Tc(e) {
|
|
12964
12980
|
let t = $.current();
|
|
12965
12981
|
t && await t.updateDisplayLayout(e);
|
|
12966
12982
|
}
|
|
12967
|
-
async function
|
|
12983
|
+
async function Ec(e) {
|
|
12968
12984
|
let t = $.current();
|
|
12969
12985
|
t && await t.requestDisplayLayout(e);
|
|
12970
12986
|
}
|
|
12971
|
-
async function
|
|
12972
|
-
let r =
|
|
12987
|
+
async function Dc(e, t, n = !1) {
|
|
12988
|
+
let r = jl(e, "grantRoles");
|
|
12973
12989
|
r && await r.conversation.grantRoles(r.participantId, t, n);
|
|
12974
12990
|
}
|
|
12975
|
-
async function
|
|
12991
|
+
async function Oc(e, t, n, r = !1) {
|
|
12976
12992
|
let i = $.current();
|
|
12977
12993
|
i && await i.grantRoles(j.composeParticipantId(e, A.USER, t), n, r);
|
|
12978
12994
|
}
|
|
12979
|
-
async function
|
|
12995
|
+
async function kc({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
|
|
12980
12996
|
if (e) {
|
|
12981
|
-
let i =
|
|
12997
|
+
let i = jl(e, "muteParticipant");
|
|
12982
12998
|
return i ? i.conversation.muteParticipant(i.participantId, t, n, r) : void 0;
|
|
12983
12999
|
}
|
|
12984
13000
|
let i = $.current();
|
|
12985
13001
|
i && await i.muteParticipant(null, t, n, r);
|
|
12986
13002
|
}
|
|
12987
|
-
async function
|
|
13003
|
+
async function Ac({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
|
|
12988
13004
|
let a = $.current();
|
|
12989
13005
|
if (a) {
|
|
12990
13006
|
let o = e ? j.composeParticipantId(e, A.USER, r) : null;
|
|
12991
13007
|
await a.muteParticipant(o, t, n, i);
|
|
12992
13008
|
}
|
|
12993
13009
|
}
|
|
12994
|
-
async function
|
|
12995
|
-
let r =
|
|
13010
|
+
async function jc(e, t = !1, n = null) {
|
|
13011
|
+
let r = jl(e, "pinParticipant");
|
|
12996
13012
|
r && await r.conversation.pinParticipant(r.participantId, t, n);
|
|
12997
13013
|
}
|
|
12998
|
-
async function
|
|
13014
|
+
async function Mc(e, t = !1, n = 0, r = null) {
|
|
12999
13015
|
let i = $.current();
|
|
13000
13016
|
i && await i.pinParticipant(j.composeParticipantId(e, A.USER, n), t, r);
|
|
13001
13017
|
}
|
|
13002
|
-
async function
|
|
13018
|
+
async function Nc(e) {
|
|
13003
13019
|
let t = $.current();
|
|
13004
13020
|
t && await t.updateMediaModifiers(e);
|
|
13005
13021
|
}
|
|
13006
|
-
async function
|
|
13022
|
+
async function Pc(e) {
|
|
13007
13023
|
let t = $.current();
|
|
13008
13024
|
t && await t.enableVideoSuspend(e);
|
|
13009
13025
|
}
|
|
13010
|
-
async function
|
|
13026
|
+
async function Fc(e) {
|
|
13011
13027
|
let t = $.current();
|
|
13012
13028
|
t && await t.enableVideoSuspendSuggest(e);
|
|
13013
13029
|
}
|
|
13014
|
-
async function
|
|
13030
|
+
async function Ic(e) {
|
|
13015
13031
|
let t = $.current();
|
|
13016
13032
|
t && await t.changeOptions(e);
|
|
13017
13033
|
}
|
|
13018
|
-
async function
|
|
13034
|
+
async function Lc(e, t = null) {
|
|
13019
13035
|
if (t) {
|
|
13020
|
-
let n =
|
|
13036
|
+
let n = jl(t, "chatMessage");
|
|
13021
13037
|
return n ? n.conversation.chatMessage(e, j.decomposeParticipantId(n.participantId).compositeUserId) : void 0;
|
|
13022
13038
|
}
|
|
13023
13039
|
let n = $.current();
|
|
13024
13040
|
n && await n.chatMessage(e, null);
|
|
13025
13041
|
}
|
|
13026
|
-
async function
|
|
13042
|
+
async function Rc(e, t = null) {
|
|
13027
13043
|
let n = $.current();
|
|
13028
13044
|
if (n) {
|
|
13029
13045
|
let r = t ? j.composeUserId(t) : null;
|
|
13030
13046
|
await n.chatMessage(e, r);
|
|
13031
13047
|
}
|
|
13032
13048
|
}
|
|
13033
|
-
async function
|
|
13049
|
+
async function zc(e = 10) {
|
|
13034
13050
|
let t = $.current();
|
|
13035
13051
|
if (t) return t.chatHistory(e);
|
|
13036
13052
|
}
|
|
13037
|
-
async function
|
|
13053
|
+
async function Bc(e, t = null) {
|
|
13038
13054
|
if (t) {
|
|
13039
|
-
let n =
|
|
13055
|
+
let n = jl(t, "customData");
|
|
13040
13056
|
return n ? n.conversation.customData(e, n.participantId) : void 0;
|
|
13041
13057
|
}
|
|
13042
13058
|
let n = $.current();
|
|
13043
13059
|
n && await n.customData(e, null);
|
|
13044
13060
|
}
|
|
13045
|
-
async function
|
|
13061
|
+
async function Vc(e, t = null, n = 0) {
|
|
13046
13062
|
let r = $.current();
|
|
13047
13063
|
if (r) {
|
|
13048
13064
|
let i = t ? j.composeParticipantId(t, A.USER, n) : null;
|
|
13049
13065
|
await r.customData(e, i);
|
|
13050
13066
|
}
|
|
13051
13067
|
}
|
|
13052
|
-
async function
|
|
13053
|
-
return (await
|
|
13068
|
+
async function Hc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
|
|
13069
|
+
return (await Hs.createConversation(a ?? j.uuid(), e, t, {
|
|
13054
13070
|
onlyAdminCanShareMovie: n,
|
|
13055
13071
|
waitForAdmin: r,
|
|
13056
13072
|
closedConversation: i
|
|
13057
13073
|
})).join_link;
|
|
13058
13074
|
}
|
|
13059
|
-
async function
|
|
13075
|
+
async function Uc(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
|
|
13060
13076
|
let a = i.map((e) => Q.fromId(e));
|
|
13061
|
-
return (await
|
|
13077
|
+
return (await Hs.createConversation(j.uuid(), e, t, {
|
|
13062
13078
|
onlyAdminCanShareMovie: n,
|
|
13063
13079
|
audienceMode: !0,
|
|
13064
13080
|
audioOnly: r
|
|
13065
13081
|
}, a)).join_link;
|
|
13066
13082
|
}
|
|
13067
|
-
async function
|
|
13083
|
+
async function Wc() {
|
|
13068
13084
|
let e = $.current();
|
|
13069
13085
|
return e ? e.createJoinLink() : Promise.reject();
|
|
13070
13086
|
}
|
|
13071
|
-
async function
|
|
13087
|
+
async function Gc() {
|
|
13072
13088
|
let e = $.current();
|
|
13073
13089
|
return e ? e.removeJoinLink() : Promise.reject();
|
|
13074
13090
|
}
|
|
13075
|
-
async function
|
|
13076
|
-
return
|
|
13091
|
+
async function Kc(e, t) {
|
|
13092
|
+
return Hs.getAnonymTokenByLink(e, t);
|
|
13077
13093
|
}
|
|
13078
|
-
function
|
|
13094
|
+
function qc(e) {
|
|
13079
13095
|
let t = $.current();
|
|
13080
13096
|
t && t.setVolume(e);
|
|
13081
13097
|
}
|
|
13082
|
-
function
|
|
13098
|
+
function Jc(e) {
|
|
13083
13099
|
M.forceRelayPolicy = e;
|
|
13084
13100
|
}
|
|
13085
|
-
async function
|
|
13101
|
+
async function Yc(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
|
|
13086
13102
|
let o = $.current();
|
|
13087
13103
|
return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
|
|
13088
13104
|
}
|
|
13089
|
-
async function
|
|
13105
|
+
async function Xc(e = null, t) {
|
|
13090
13106
|
let n = $.current();
|
|
13091
13107
|
return n ? n.stopStream(e, t) : Promise.reject();
|
|
13092
13108
|
}
|
|
13093
|
-
async function
|
|
13109
|
+
async function Zc(e = null) {
|
|
13094
13110
|
let t = $.current();
|
|
13095
13111
|
return t ? t.publishStream(e) : Promise.reject();
|
|
13096
13112
|
}
|
|
13097
|
-
async function
|
|
13113
|
+
async function Qc() {
|
|
13098
13114
|
let e = $.current();
|
|
13099
13115
|
return e ? e.getStreamInfo() : Promise.reject();
|
|
13100
13116
|
}
|
|
13101
|
-
async function
|
|
13117
|
+
async function $c(e) {
|
|
13102
13118
|
let t = $.current();
|
|
13103
13119
|
return t ? t.addMovie(e) : Promise.reject();
|
|
13104
13120
|
}
|
|
13105
|
-
async function
|
|
13121
|
+
async function el(e) {
|
|
13106
13122
|
let t = $.current();
|
|
13107
13123
|
return t ? t.updateMovie(e) : Promise.reject();
|
|
13108
13124
|
}
|
|
13109
|
-
async function
|
|
13125
|
+
async function tl(e) {
|
|
13110
13126
|
let t = $.current();
|
|
13111
13127
|
return t ? t.removeMovie(e) : Promise.reject();
|
|
13112
13128
|
}
|
|
13113
|
-
async function
|
|
13129
|
+
async function nl(e, t) {
|
|
13114
13130
|
let n = $.current();
|
|
13115
13131
|
if (n) {
|
|
13116
13132
|
let r = [], i = [];
|
|
@@ -13132,46 +13148,46 @@ async function tl(e, t) {
|
|
|
13132
13148
|
});
|
|
13133
13149
|
}
|
|
13134
13150
|
if (i.length) {
|
|
13135
|
-
|
|
13151
|
+
kl(i, "updateRooms", n);
|
|
13136
13152
|
return;
|
|
13137
13153
|
}
|
|
13138
13154
|
return n.updateRooms(r, t);
|
|
13139
13155
|
}
|
|
13140
13156
|
return Promise.reject();
|
|
13141
13157
|
}
|
|
13142
|
-
async function
|
|
13158
|
+
async function rl(e, t) {
|
|
13143
13159
|
let n = $.current();
|
|
13144
13160
|
return n ? n.activateRooms(e, t) : Promise.reject();
|
|
13145
13161
|
}
|
|
13146
|
-
async function
|
|
13162
|
+
async function il(e = null, t = null) {
|
|
13147
13163
|
let n = $.current();
|
|
13148
13164
|
if (!n) return Promise.reject();
|
|
13149
13165
|
let r;
|
|
13150
13166
|
if (t && (r = n.getCachedParticipantIdByExternalId(t) ?? void 0, !r)) {
|
|
13151
|
-
|
|
13167
|
+
Ol(t, "switchRoom", n);
|
|
13152
13168
|
return;
|
|
13153
13169
|
}
|
|
13154
13170
|
return n.switchRoom(e, r);
|
|
13155
13171
|
}
|
|
13156
|
-
async function
|
|
13172
|
+
async function al(e) {
|
|
13157
13173
|
let t = $.current();
|
|
13158
13174
|
return t ? t.removeRooms(e) : Promise.reject();
|
|
13159
13175
|
}
|
|
13160
|
-
function
|
|
13176
|
+
function ol(e) {
|
|
13161
13177
|
M.statisticsInterval = e;
|
|
13162
13178
|
let t = $.current();
|
|
13163
13179
|
if (t) return t.updateStatisticsInterval();
|
|
13164
13180
|
}
|
|
13165
|
-
function
|
|
13181
|
+
function sl(t) {
|
|
13166
13182
|
e.disableLog(!t), R.toggle(t);
|
|
13167
13183
|
}
|
|
13168
|
-
function
|
|
13184
|
+
function cl(e, ...t) {
|
|
13169
13185
|
M.debugLog && ($.debugMessage(e, "[external]", ...t) || R.send(e, "[external]", ...t));
|
|
13170
13186
|
}
|
|
13171
|
-
function
|
|
13187
|
+
function ll(e, t, ...n) {
|
|
13172
13188
|
M.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || R.send(e, "[external]", ...n));
|
|
13173
13189
|
}
|
|
13174
|
-
var
|
|
13190
|
+
var ul = {
|
|
13175
13191
|
list: Ne,
|
|
13176
13192
|
get: Pe,
|
|
13177
13193
|
getJson: Fe,
|
|
@@ -13179,7 +13195,7 @@ var ll = {
|
|
|
13179
13195
|
clear: Le,
|
|
13180
13196
|
stats: Re
|
|
13181
13197
|
};
|
|
13182
|
-
function
|
|
13198
|
+
function dl() {
|
|
13183
13199
|
let e = [
|
|
13184
13200
|
[`Calls SDK ${M.sdkVersion}`, M.toJSON()],
|
|
13185
13201
|
["UserAgent:", navigator.userAgent],
|
|
@@ -13196,139 +13212,139 @@ function ul() {
|
|
|
13196
13212
|
d: e
|
|
13197
13213
|
}));
|
|
13198
13214
|
}
|
|
13199
|
-
async function
|
|
13215
|
+
async function fl() {
|
|
13200
13216
|
let e = $.id(), t = $.debugSessionId();
|
|
13201
13217
|
if (!t || !e) throw R.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
|
|
13202
13218
|
let n = await Pe({ sessionId: t });
|
|
13203
13219
|
if (n.length === 0) throw R.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
|
|
13204
13220
|
let r = n[0].t, i = n[n.length - 1].t;
|
|
13205
13221
|
try {
|
|
13206
|
-
return
|
|
13222
|
+
return Hs?.uploadDebugLogs(e, r, i, JSON.stringify([...dl(), ...n]));
|
|
13207
13223
|
} catch (e) {
|
|
13208
13224
|
throw R.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
|
|
13209
13225
|
}
|
|
13210
13226
|
}
|
|
13211
|
-
async function
|
|
13227
|
+
async function pl(e) {
|
|
13212
13228
|
let t = $.current();
|
|
13213
13229
|
if (t) return t.videoEffect(e);
|
|
13214
13230
|
}
|
|
13215
|
-
async function
|
|
13231
|
+
async function ml(e, t) {
|
|
13216
13232
|
let n = $.current();
|
|
13217
13233
|
if (n) return n.audioEffect(e.length > 0 ? e : null, t);
|
|
13218
13234
|
}
|
|
13219
|
-
async function
|
|
13235
|
+
async function hl(e) {
|
|
13220
13236
|
let t = $.current();
|
|
13221
13237
|
t && await t.setAudioStream(e);
|
|
13222
13238
|
}
|
|
13223
|
-
async function
|
|
13239
|
+
async function gl(e, t = null, n = null) {
|
|
13224
13240
|
let r = $.current();
|
|
13225
13241
|
if (!r) return;
|
|
13226
13242
|
let i = n ?? t?.id, a = null;
|
|
13227
13243
|
if (t && (a = r.getCachedParticipantIdByExternalId(t), !a)) {
|
|
13228
|
-
|
|
13244
|
+
Ol(t, "setVmojiSvg", r);
|
|
13229
13245
|
return;
|
|
13230
13246
|
}
|
|
13231
13247
|
r.setAnimojiSvg(e, a, i);
|
|
13232
13248
|
}
|
|
13233
|
-
function
|
|
13249
|
+
function _l(e) {
|
|
13234
13250
|
let t = $.current();
|
|
13235
13251
|
t && t.setAnimojiFill(e);
|
|
13236
13252
|
}
|
|
13237
|
-
async function
|
|
13238
|
-
return
|
|
13253
|
+
async function vl(e = null, t, n = !1) {
|
|
13254
|
+
return Al().getWaitingHall(e, t, n);
|
|
13239
13255
|
}
|
|
13240
|
-
async function
|
|
13241
|
-
return
|
|
13256
|
+
async function yl() {
|
|
13257
|
+
return Al().getAudienceModeHands();
|
|
13242
13258
|
}
|
|
13243
|
-
async function
|
|
13244
|
-
let n =
|
|
13259
|
+
async function bl(e, t = !1) {
|
|
13260
|
+
let n = Al(), r;
|
|
13245
13261
|
if (e) {
|
|
13246
13262
|
let t = n.getCachedParticipantIdByExternalId(e);
|
|
13247
13263
|
if (!t) {
|
|
13248
|
-
|
|
13264
|
+
Ol(e, "promoteParticipant", n);
|
|
13249
13265
|
return;
|
|
13250
13266
|
}
|
|
13251
13267
|
r = j.decomposeParticipantId(t).compositeUserId;
|
|
13252
13268
|
}
|
|
13253
13269
|
return n.promoteParticipant(r, t);
|
|
13254
13270
|
}
|
|
13255
|
-
async function bl(e = !1) {
|
|
13256
|
-
return kl().requestPromotion(e);
|
|
13257
|
-
}
|
|
13258
13271
|
async function xl(e = !1) {
|
|
13259
|
-
return
|
|
13272
|
+
return Al().requestPromotion(e);
|
|
13260
13273
|
}
|
|
13261
|
-
async function Sl(e) {
|
|
13262
|
-
return
|
|
13274
|
+
async function Sl(e = !1) {
|
|
13275
|
+
return Al().acceptPromotion(e);
|
|
13263
13276
|
}
|
|
13264
13277
|
async function Cl(e) {
|
|
13265
|
-
return
|
|
13278
|
+
return Al().getParticipantListChunk(e);
|
|
13266
13279
|
}
|
|
13267
13280
|
async function wl(e) {
|
|
13268
|
-
return
|
|
13281
|
+
return Al().getParticipants(e);
|
|
13269
13282
|
}
|
|
13270
|
-
async function Tl(e
|
|
13271
|
-
return
|
|
13283
|
+
async function Tl(e) {
|
|
13284
|
+
return Al().feedback(e);
|
|
13272
13285
|
}
|
|
13273
|
-
function El(e) {
|
|
13286
|
+
async function El(e, t, n) {
|
|
13287
|
+
return Al(n).enableFeatureForRoles(e, t);
|
|
13288
|
+
}
|
|
13289
|
+
function Dl(e) {
|
|
13274
13290
|
return e ? z.get(e) ?? null : $.current() ?? z.getFirst();
|
|
13275
13291
|
}
|
|
13276
|
-
function
|
|
13292
|
+
function Ol(e, t, n) {
|
|
13277
13293
|
L.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external ID "${e.id}" while handling ${t}`), n.id);
|
|
13278
13294
|
}
|
|
13279
|
-
function
|
|
13295
|
+
function kl(e, t, n) {
|
|
13280
13296
|
let r = Array.from(new Set(e));
|
|
13281
13297
|
L.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external IDs "${r.join("\", \"")}" while handling ${t}`), n.id);
|
|
13282
13298
|
}
|
|
13283
|
-
function
|
|
13284
|
-
let t =
|
|
13299
|
+
function Al(e) {
|
|
13300
|
+
let t = Dl(e);
|
|
13285
13301
|
if (!t) throw Error("Conversation not found");
|
|
13286
13302
|
return t;
|
|
13287
13303
|
}
|
|
13288
|
-
function
|
|
13304
|
+
function jl(e, t) {
|
|
13289
13305
|
let n = $.current();
|
|
13290
13306
|
if (!n) return null;
|
|
13291
13307
|
let r = n.getCachedParticipantIdByExternalId(e);
|
|
13292
13308
|
return r ? {
|
|
13293
13309
|
conversation: n,
|
|
13294
13310
|
participantId: r
|
|
13295
|
-
} : (
|
|
13296
|
-
}
|
|
13297
|
-
async function jl(e) {
|
|
13298
|
-
await Vs.removeHistoryRecords(e);
|
|
13311
|
+
} : (Ol(e, t, n), null);
|
|
13299
13312
|
}
|
|
13300
13313
|
async function Ml(e) {
|
|
13314
|
+
await Hs.removeHistoryRecords(e);
|
|
13315
|
+
}
|
|
13316
|
+
async function Nl(e) {
|
|
13301
13317
|
let t = $.current() ?? z.getFirst();
|
|
13302
13318
|
t && await t.startAsr(e);
|
|
13303
13319
|
}
|
|
13304
|
-
async function
|
|
13320
|
+
async function Pl(e) {
|
|
13305
13321
|
let t = $.current() ?? z.getFirst();
|
|
13306
13322
|
t && await t.stopAsr(e);
|
|
13307
13323
|
}
|
|
13308
|
-
async function
|
|
13324
|
+
async function Fl(e) {
|
|
13309
13325
|
let t = $.current() ?? z.getFirst();
|
|
13310
13326
|
t && await t.requestAsr(e);
|
|
13311
13327
|
}
|
|
13312
|
-
async function
|
|
13328
|
+
async function Il(e) {
|
|
13313
13329
|
let t = $.current();
|
|
13314
13330
|
return t ? t.startUrlSharing(e) : Promise.reject();
|
|
13315
13331
|
}
|
|
13316
|
-
async function
|
|
13332
|
+
async function Ll() {
|
|
13317
13333
|
let e = $.current();
|
|
13318
13334
|
return e ? e.stopUrlSharing() : Promise.reject();
|
|
13319
13335
|
}
|
|
13320
|
-
async function
|
|
13336
|
+
async function Rl(e) {
|
|
13321
13337
|
await z.switchCall(e);
|
|
13322
13338
|
}
|
|
13323
|
-
function
|
|
13339
|
+
function zl() {
|
|
13324
13340
|
return z.getActiveId();
|
|
13325
13341
|
}
|
|
13326
|
-
function
|
|
13342
|
+
function Bl() {
|
|
13327
13343
|
return $.getSyncedTime();
|
|
13328
13344
|
}
|
|
13329
|
-
function
|
|
13345
|
+
function Vl() {
|
|
13330
13346
|
return M.sdkVersion;
|
|
13331
13347
|
}
|
|
13332
13348
|
typeof window < "u" && (window.__CALLS_SDK = yn);
|
|
13333
13349
|
//#endregion
|
|
13334
|
-
export {
|
|
13350
|
+
export { Fs as Api, Vs as ApiExternal, Bs as ArrayDequeue, y as AuthData, f as BaseLogger, Va as CallDirection, Ha as CallType, Ua as ChatRoomEventType, Wa as ConversationFeature, Ga as ConversationOption, Sn as DebugMessageType, no as ExternalIdType, jt as FacingMode, x as FatalError, O as HangupReason, D as HangupType, S as MediaOption, k as MediaTrackKind, V as MediaType, Ja as MuteState, Z as ParticipantState, zs as ParticipantStateDataValue, N as ParticipantStatus, Rs as RecordRole, Ya as RoomsEventType, Ba as Signaling, B as SignalingCommandType, vr as SignalingConnectionType, K as SignalingNotification, J as TransportTopology, Qa as UserRole, A as UserType, Eo as VolumeDetector, ac as acceptCall, Sl as acceptPromotion, rl as activateRooms, $c as addMovie, dc as addParticipant, fc as addParticipantInternal, ic as authorize, Ws as browser, ec as callInternal, Qs as callTo, gc as captureScreen, _c as captureVmoji, ml as changeAudioEffect, Ic as changeConversationOptions, hc as changeDevice, Cc as changeParticipantState, Sc as changePriorities, pl as changeVideoEffect, zc as chatHistory, Lc as chatMessage, Rc as chatMessageInternal, Wc as createJoinLink, Bc as customData, Vc as customDataInternal, sl as debug, ul as debugLogs, cl as debugMessage, ll as debugMessageWithContext, oc as declineCall, El as enableFeatureForRoles, Pc as enableVideoSuspend, Fc as enableVideoSuspendSuggest, Tl as feedback, Jc as forceRelayPolicy, zl as getActiveCallId, Kc as getAnonymTokenByLink, yl as getAudienceModeHands, rc as getInbounds, Cl as getParticipantListChunk, wl as getParticipants, Qc as getStreamInfo, Bl as getSyncedTime, vl as getWaitingHall, Dc as grantRoles, Oc as grantRolesInternal, uc as hangup, Zs as init, sc as joinCall, lc as joinCallByLink, cc as joinCallInternal, kc as muteParticipant, Ac as muteParticipantInternal, jc as pinParticipant, Mc as pinParticipantInternal, tc as processPush, nc as processPushInternal, bl as promoteParticipant, Zc as publishStream, wc as putHandsDown, Ml as removeHistoryRecords, Gc as removeJoinLink, tl as removeMovie, pc as removeParticipant, mc as removeParticipantInternal, al as removeRooms, Fl as requestAsr, Ec as requestDisplayLayout, xl as requestPromotion, Js as setAudioEffects, hl as setAudioStream, xc as setLocalResolution, Ks as setLogger, Nc as setMediaModifiers, ol as setStatisticsInterval, Ys as setVad, qs as setVideoEffects, vc as setVideoStream, Xs as setVmoji, _l as setVmojiFill, gl as setVmojiSvg, qc as setVolume, Nl as startAsr, Uc as startAudienceConversation, Hc as startConversation, Yc as startStream, Il as startUrlSharing, Pl as stopAsr, Xc as stopStream, Ll as stopUrlSharing, Rl as switchCall, il as switchRoom, bc as toggleLocalAudio, yc as toggleLocalVideo, Tc as updateDisplayLayout, el as updateMovie, nl as updateRooms, fl as uploadDebugLogs, Gs as utils, Vl as version };
|