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