@vkontakte/calls-sdk 2.8.13-dev.7452edd3.0 → 2.8.13-dev.7b443474.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/CallsSDK.d.ts +1 -1
- package/calls-sdk.cjs.js +6 -6
- package/calls-sdk.esm.js +972 -901
- package/classes/MediaSource.d.ts +5 -0
- package/classes/SignalingErrors.d.ts +6 -0
- package/classes/conversation/Conversation.d.ts +3 -3
- package/classes/screenshare/ScreenCaptureSender.d.ts +2 -2
- package/classes/stat/CallLifecycleStats.d.ts +0 -2
- package/classes/stat/CallStatTail.d.ts +0 -11
- package/classes/stat/ConversationStats.d.ts +6 -8
- package/classes/stat/MlStats.d.ts +37 -0
- package/classes/stat/StatEventCollector.d.ts +1 -13
- package/classes/stat/StatQueue.d.ts +1 -2
- package/classes/transport/BaseTransport.d.ts +3 -3
- package/classes/transport/DirectStatReporter.d.ts +2 -2
- package/classes/transport/DirectTransport.d.ts +2 -2
- package/classes/transport/PerfStatReporter.d.ts +2 -2
- package/classes/transport/ServerTransport.d.ts +2 -2
- package/classes/transport/SimulcastSender.d.ts +2 -2
- package/classes/transport/Transport.d.ts +6 -4
- package/classes/transport/VadGate.d.ts +39 -0
- package/default/Signaling.d.ts +9 -16
- package/default/SignalingSession.d.ts +92 -0
- package/enums/Stat.d.ts +2 -0
- package/package.json +3 -3
- package/static/Params.d.ts +30 -9
- package/types/AddParticipantParams.d.ts +18 -0
- package/types/SignalingMessage.d.ts +2 -0
- package/utils/ErrorText.d.ts +2 -0
- package/abstract/BaseSignaling.d.ts +0 -143
- package/default/SignalingTransport.d.ts +0 -80
package/calls-sdk.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @vkontakte/calls-sdk v2.8.13-dev.
|
|
3
|
-
* Tue,
|
|
2
|
+
* @vkontakte/calls-sdk v2.8.13-dev.7b443474.0
|
|
3
|
+
* Tue, 10 Nov 2026 14:47:47 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -1649,17 +1649,21 @@ var O = /* @__PURE__ */ function(e) {
|
|
|
1649
1649
|
let t = this._audioEffectParams;
|
|
1650
1650
|
this._audioEffectParams = e;
|
|
1651
1651
|
try {
|
|
1652
|
-
let e = this._micAudioTrack
|
|
1652
|
+
let e = this._cloneMicAudioTrack(this._micAudioTrack), t = new MediaStream([e]);
|
|
1653
1653
|
await this._changeAudioInput(t);
|
|
1654
1654
|
} catch (e) {
|
|
1655
1655
|
if (this._destroyed) throw e;
|
|
1656
1656
|
this._audioEffectParams = t;
|
|
1657
|
-
let n = this._micAudioTrack
|
|
1657
|
+
let n = this._cloneMicAudioTrack(this._micAudioTrack), r = new MediaStream([n]);
|
|
1658
1658
|
throw await this._changeAudioInput(r), e;
|
|
1659
1659
|
}
|
|
1660
1660
|
}
|
|
1661
1661
|
}
|
|
1662
1662
|
}
|
|
1663
|
+
_cloneMicAudioTrack(e) {
|
|
1664
|
+
let t = e.clone();
|
|
1665
|
+
return t.enabled = !0, t;
|
|
1666
|
+
}
|
|
1663
1667
|
getAudioShareTrack() {
|
|
1664
1668
|
return this._audioShareTrack;
|
|
1665
1669
|
}
|
|
@@ -2302,7 +2306,7 @@ var wn = Cn.getInstance(), N = class e {
|
|
|
2302
2306
|
return 1.1;
|
|
2303
2307
|
}
|
|
2304
2308
|
static get sdkVersion() {
|
|
2305
|
-
return "2.8.13-dev.
|
|
2309
|
+
return "2.8.13-dev.7b443474.0";
|
|
2306
2310
|
}
|
|
2307
2311
|
static get debug() {
|
|
2308
2312
|
return e._params.debug;
|
|
@@ -2427,9 +2431,6 @@ var wn = Cn.getInstance(), N = class e {
|
|
|
2427
2431
|
static get signalingReconnectMaxDelay() {
|
|
2428
2432
|
return e._params.signalingReconnectMaxDelay;
|
|
2429
2433
|
}
|
|
2430
|
-
static get signalingReconnectMaxCount() {
|
|
2431
|
-
return e._params.signalingReconnectMaxCount;
|
|
2432
|
-
}
|
|
2433
2434
|
static get signalingReconnectMaxDuration() {
|
|
2434
2435
|
return e._params.signalingReconnectMaxDuration;
|
|
2435
2436
|
}
|
|
@@ -2780,7 +2781,6 @@ h(N, "_params", {
|
|
|
2780
2781
|
wssToken: "",
|
|
2781
2782
|
signalingReconnectDelay: 1e3,
|
|
2782
2783
|
signalingReconnectMaxDelay: 5e3,
|
|
2783
|
-
signalingReconnectMaxCount: 10,
|
|
2784
2784
|
signalingReconnectMaxDuration: 6e4,
|
|
2785
2785
|
waitConnectionDelay: 1e4,
|
|
2786
2786
|
waitResponseDelay: 1e4,
|
|
@@ -3523,37 +3523,18 @@ var z = On, B = new class {
|
|
|
3523
3523
|
constructor(e) {
|
|
3524
3524
|
super(e ? `Producer connection closed. Command ${e}` : "Producer connection closed"), this.name = "ProducerConnectionClosedError";
|
|
3525
3525
|
}
|
|
3526
|
-
}, jn = class extends Ye {
|
|
3527
|
-
constructor(...e) {
|
|
3528
|
-
super(...e), h(this, "_abortSignal", void 0);
|
|
3529
|
-
}
|
|
3530
|
-
setAbortSignal(e) {
|
|
3531
|
-
this._abortSignal = e;
|
|
3532
|
-
}
|
|
3533
|
-
get ready() {
|
|
3534
|
-
return !0;
|
|
3535
|
-
}
|
|
3536
|
-
setParticipantIdRegistry(e) {}
|
|
3537
|
-
requestRealloc() {}
|
|
3538
|
-
setEndpoint(e) {}
|
|
3539
|
-
setWebTransportEndpoint(e) {}
|
|
3540
|
-
readyToSend(e = !0) {}
|
|
3541
|
-
async requestTestMode(e, t) {}
|
|
3542
|
-
getNextCommandSequenceNumber() {
|
|
3543
|
-
return 0;
|
|
3544
|
-
}
|
|
3545
3526
|
}, V = /* @__PURE__ */ function(e) {
|
|
3546
3527
|
return e.RECOVER = "recover", e.ACCEPT_CALL = "accept-call", e.ADD_PARTICIPANT = "add-participant", e.REMOVE_PARTICIPANT = "remove-participant", e.HANGUP = "hangup", e.TRANSMIT_DATA = "transmit-data", e.ACCEPT_PRODUCER = "accept-producer", e.ALLOCATE_CONSUMER = "allocate-consumer", e.CHANGE_MEDIA_SETTINGS = "change-media-settings", e.CHANGE_PARTICIPANT_STATE = "change-participant-state", e.CHANGE_STREAM_PRIORITIES = "change-streams-priorities", e.UPDATE_DISPLAY_LAYOUT = "update-display-layout", e.REPORT_PERF_STAT = "report-perf-stat", e.REPORT_SHARING_STAT = "report-sharing-stat", e.REPORT_NETWORK_STAT = "report-network-stat", e.RECORD_START = "record-start", e.RECORD_STOP = "record-stop", e.RECORD_PUBLISH = "record-publish", e.RECORD_SET_CONF = "record-set-conf", e.RECORD_GET_STATUS = "record-get-status", e.SWITCH_MICRO = "switch-micro", e.SWITCH_TOPOLOGY = "switch-topology", e.REQUEST_REALLOC = "request-realloc", e.CHAT_MESSAGE = "chat-message", e.CHAT_HISTORY = "chat-history", e.CUSTOM_DATA = "custom-data", e.GRANT_ROLES = "grant-roles", e.MUTE_PARTICIPANT = "mute-participant", e.ENABLE_FEATURE_FOR_ROLES = "enable-feature-for-roles", e.PIN_PARTICIPANT = "pin-participant", e.UPDATE_MEDIA_MODIFIERS = "update-media-modifiers", e.CHANGE_OPTIONS = "change-options", e.GET_WAITING_HALL = "get-waiting-hall", e.GET_PARTICIPANT_LIST_CHUNK = "get-participant-list-chunk", e.GET_PARTICIPANTS = "get-participants", e.PROMOTE_PARTICIPANT = "promote-participant", e.REQUEST_TEST_MODE = "request-test-mode", e.ADD_MOVIE = "add-movie", e.UPDATE_MOVIE = "update-movie", e.REMOVE_MOVIE = "remove-movie", e.START_URL_SHARING = "start-url-sharing", e.STOP_URL_SHARING = "stop-url-sharing", e.GET_ROOMS = "get-rooms", e.UPDATE_ROOMS = "update-rooms", e.ACTIVATE_ROOMS = "activate-rooms", e.REMOVE_ROOMS = "remove-rooms", e.SWITCH_ROOM = "switch-room", e.FEEDBACK = "feedback", e.ASR_START = "asr-start", e.ASR_STOP = "asr-stop", e.REQUEST_ASR = "request-asr", e.REQUEST_PROMOTION = "request-promotion", e.ACCEPT_PROMOTION = "accept-promotion", e.GET_HAND_QUEUE = "get-hand-queue", e.ENABLE_VIDEO_SUSPEND = "enable-video-suspend", e.ENABLE_VIDEO_SUSPEND_SUGGEST = "enable-video-suspend-suggest", e.HOLD = "hold", e.PUT_HANDS_DOWN = "put-hands-down", e.CHANGE_SIMULCAST = "change-simulcast", e;
|
|
3547
3528
|
}(V || {});
|
|
3548
|
-
function
|
|
3529
|
+
function jn(e) {
|
|
3549
3530
|
return e.stopStream;
|
|
3550
3531
|
}
|
|
3551
|
-
function
|
|
3532
|
+
function Mn(e) {
|
|
3552
3533
|
return e.keyFrameRequested;
|
|
3553
3534
|
}
|
|
3554
|
-
function
|
|
3555
|
-
if (
|
|
3556
|
-
if (
|
|
3535
|
+
function Nn(e) {
|
|
3536
|
+
if (jn(e)) return "ss";
|
|
3537
|
+
if (Mn(e)) return "kf";
|
|
3557
3538
|
let t = "";
|
|
3558
3539
|
return e.priority !== void 0 && (t += "p=" + e.priority), e.width !== void 0 && e.height !== void 0 && (t !== "" && (t += ":"), t += "sz=" + Math.round(e.width) + "x" + Math.round(e.height)), e.fit !== void 0 && (t !== "" && (t += ":"), t += "fit=" + e.fit), t;
|
|
3559
3540
|
}
|
|
@@ -3561,19 +3542,19 @@ function Pn(e) {
|
|
|
3561
3542
|
//#region src/types/ParticipantStreamDescription.ts
|
|
3562
3543
|
var H = /* @__PURE__ */ function(e) {
|
|
3563
3544
|
return e.CAMERA = "CAMERA", e.SCREEN = "SCREEN", e.STREAM = "STREAM", e.MOVIE = "MOVIE", e.ANIMOJI = "ANIMOJI", e.SHARED_URL = "SHARED_URL", e;
|
|
3564
|
-
}({}),
|
|
3565
|
-
function
|
|
3566
|
-
return e.participantId + (e.mediaType ? ":" +
|
|
3545
|
+
}({}), Pn = "s", Fn = "m";
|
|
3546
|
+
function In(e) {
|
|
3547
|
+
return e.participantId + (e.mediaType ? ":" + Pn + e.mediaType : "") + (e.streamName ? ":" + Fn + e.streamName : "");
|
|
3567
3548
|
}
|
|
3568
|
-
function
|
|
3549
|
+
function Ln(e) {
|
|
3569
3550
|
let t = e.split(":"), n = t.shift();
|
|
3570
3551
|
if (!n) throw Error("Illegal stream description: " + e);
|
|
3571
3552
|
let r = null, i, a = 0;
|
|
3572
3553
|
for (let n of t) switch (n.charAt(0)) {
|
|
3573
|
-
case
|
|
3574
|
-
r =
|
|
3554
|
+
case Pn:
|
|
3555
|
+
r = Rn(n.slice(1));
|
|
3575
3556
|
break;
|
|
3576
|
-
case
|
|
3557
|
+
case Fn:
|
|
3577
3558
|
i = n.slice(1);
|
|
3578
3559
|
break;
|
|
3579
3560
|
case "d":
|
|
@@ -3587,13 +3568,13 @@ function Rn(e) {
|
|
|
3587
3568
|
streamName: i
|
|
3588
3569
|
};
|
|
3589
3570
|
}
|
|
3590
|
-
function
|
|
3571
|
+
function Rn(e) {
|
|
3591
3572
|
for (let t of Object.keys(H)) if (t === e) return H[t];
|
|
3592
3573
|
return null;
|
|
3593
3574
|
}
|
|
3594
3575
|
//#endregion
|
|
3595
3576
|
//#region src/utils/MsgPackerBufferUtils.ts
|
|
3596
|
-
function
|
|
3577
|
+
function zn() {
|
|
3597
3578
|
let e = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(64)), t = 0;
|
|
3598
3579
|
function n(n) {
|
|
3599
3580
|
if (t + n > e.byteLength) {
|
|
@@ -3603,7 +3584,7 @@ function Bn() {
|
|
|
3603
3584
|
}
|
|
3604
3585
|
return {
|
|
3605
3586
|
put(r) {
|
|
3606
|
-
if (n(r.byteLength),
|
|
3587
|
+
if (n(r.byteLength), Bn(r)) {
|
|
3607
3588
|
let n = r.buffer;
|
|
3608
3589
|
new Uint8Array(e.buffer).set(new Uint8Array(n), t);
|
|
3609
3590
|
} else new Uint8Array(e.buffer).set(new Uint8Array(r), t);
|
|
@@ -3645,10 +3626,10 @@ function Bn() {
|
|
|
3645
3626
|
}
|
|
3646
3627
|
};
|
|
3647
3628
|
}
|
|
3648
|
-
function
|
|
3629
|
+
function Bn(e) {
|
|
3649
3630
|
return e.buffer !== void 0;
|
|
3650
3631
|
}
|
|
3651
|
-
function
|
|
3632
|
+
function Vn(e) {
|
|
3652
3633
|
let t = ArrayBuffer.isView(e) ? new DataView(e.buffer, e.byteOffset, e.byteLength) : new DataView(e), n = 0;
|
|
3653
3634
|
return {
|
|
3654
3635
|
peek() {
|
|
@@ -3697,7 +3678,7 @@ function Hn(e) {
|
|
|
3697
3678
|
}
|
|
3698
3679
|
//#endregion
|
|
3699
3680
|
//#region src/classes/ProducerCommandSerializationService.ts
|
|
3700
|
-
var
|
|
3681
|
+
var Hn = 0, Un = 1, Wn = 2, Gn = 3, Kn = 4, qn = 5, Jn = 6, Yn = 7, Xn = 0, Zn = 1, Qn = 2, $n = 0, er = 0, tr = 0, nr = 1, rr = class {
|
|
3701
3682
|
constructor(e = z) {
|
|
3702
3683
|
h(this, "participantIdRegistry", null), h(this, "_debug", void 0), this._debug = e;
|
|
3703
3684
|
}
|
|
@@ -3705,22 +3686,22 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
|
|
|
3705
3686
|
this.participantIdRegistry = e;
|
|
3706
3687
|
}
|
|
3707
3688
|
serializeUpdateDisplayLayout(e, t) {
|
|
3708
|
-
let r =
|
|
3709
|
-
i.enc(r,
|
|
3689
|
+
let r = zn();
|
|
3690
|
+
i.enc(r, Hn), i.enc(r, $n), i.enc(r, e), a.enc(r, null);
|
|
3710
3691
|
let o = [];
|
|
3711
3692
|
for (let e in t) Object.hasOwn(t, e) && this.writeLayout(t, e, o);
|
|
3712
3693
|
return n.enc(r, o), a.enc(r, null), r.ui8array().buffer;
|
|
3713
3694
|
}
|
|
3714
3695
|
writeLayout(e, t, n) {
|
|
3715
|
-
let r = e[t], o =
|
|
3716
|
-
if (this.writeStreamDesc(t, o),
|
|
3717
|
-
else if (
|
|
3718
|
-
else if (i.enc(o,
|
|
3696
|
+
let r = e[t], o = zn();
|
|
3697
|
+
if (this.writeStreamDesc(t, o), jn(r)) i.enc(o, Zn);
|
|
3698
|
+
else if (Mn(r)) i.enc(o, Qn);
|
|
3699
|
+
else if (i.enc(o, Xn), r.priority === void 0 ? a.enc(o, null) : i.enc(o, r.priority), r.width !== void 0 && r.height !== void 0 ? (i.enc(o, Math.round(r.width)), i.enc(o, Math.round(r.height))) : (a.enc(o, null), a.enc(o, null)), r.fit !== void 0) switch (r.fit) {
|
|
3719
3700
|
case "cv":
|
|
3720
|
-
i.enc(o,
|
|
3701
|
+
i.enc(o, tr);
|
|
3721
3702
|
break;
|
|
3722
3703
|
case "cn":
|
|
3723
|
-
i.enc(o,
|
|
3704
|
+
i.enc(o, nr);
|
|
3724
3705
|
break;
|
|
3725
3706
|
default: a.enc(o, null);
|
|
3726
3707
|
}
|
|
@@ -3738,32 +3719,32 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
|
|
|
3738
3719
|
o.enc(t, e);
|
|
3739
3720
|
}
|
|
3740
3721
|
serializePerfStatReport(e, t) {
|
|
3741
|
-
let n =
|
|
3742
|
-
return i.enc(n,
|
|
3722
|
+
let n = zn();
|
|
3723
|
+
return i.enc(n, Un), i.enc(n, $n), i.enc(n, e), i.enc(n, t.framesDecoded), i.enc(n, t.framesReceived), n.ui8array().buffer;
|
|
3743
3724
|
}
|
|
3744
3725
|
serializeSharingStatReport(e, t) {
|
|
3745
|
-
let n =
|
|
3746
|
-
return i.enc(n,
|
|
3726
|
+
let n = zn();
|
|
3727
|
+
return i.enc(n, Wn), i.enc(n, $n), i.enc(n, e), i.enc(n, t.minDelay), i.enc(n, t.maxDelay), i.enc(n, t.avgDelay), i.enc(n, t.largeDelayDuration), n.ui8array().buffer;
|
|
3747
3728
|
}
|
|
3748
3729
|
serializeRequestAsr(e, t) {
|
|
3749
|
-
let n =
|
|
3750
|
-
return i.enc(n,
|
|
3730
|
+
let n = zn();
|
|
3731
|
+
return i.enc(n, Gn), i.enc(n, $n), i.enc(n, e), r.enc(n, t.request), n.ui8array().buffer;
|
|
3751
3732
|
}
|
|
3752
3733
|
serializeNetworkStatReport(e, t) {
|
|
3753
|
-
let n =
|
|
3754
|
-
return i.enc(n,
|
|
3734
|
+
let n = zn();
|
|
3735
|
+
return i.enc(n, Kn), i.enc(n, $n), i.enc(n, e), i.enc(n, t.timestamp), i.enc(n, t.sendBitrate), n.ui8array().buffer;
|
|
3755
3736
|
}
|
|
3756
3737
|
serializeEnableVideoSuspend(e, t) {
|
|
3757
|
-
let n =
|
|
3758
|
-
return i.enc(n,
|
|
3738
|
+
let n = zn();
|
|
3739
|
+
return i.enc(n, qn), i.enc(n, $n), i.enc(n, e), r.enc(n, t.enabled), n.ui8array().buffer;
|
|
3759
3740
|
}
|
|
3760
3741
|
serializeEnableVideoSuspendSuggest(e, t) {
|
|
3761
|
-
let n =
|
|
3762
|
-
return i.enc(n,
|
|
3742
|
+
let n = zn();
|
|
3743
|
+
return i.enc(n, Jn), i.enc(n, $n), i.enc(n, e), r.enc(n, t.enabled), n.ui8array().buffer;
|
|
3763
3744
|
}
|
|
3764
3745
|
serializeChangeSimulcast(e, t) {
|
|
3765
|
-
let n =
|
|
3766
|
-
i.enc(n,
|
|
3746
|
+
let n = zn();
|
|
3747
|
+
i.enc(n, Yn), i.enc(n, $n), i.enc(n, e);
|
|
3767
3748
|
let r = t.simulcastInfo.streams.length;
|
|
3768
3749
|
i.enc(n, t.mediaSource), i.enc(n, r);
|
|
3769
3750
|
for (let e of t.simulcastInfo.streams) o.enc(n, e.rid), i.enc(n, e.width), i.enc(n, e.height), i.enc(n, e.fps), i.enc(n, e.bitrate / 1e3);
|
|
@@ -3771,19 +3752,19 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
|
|
|
3771
3752
|
}
|
|
3772
3753
|
async deserializeCommandResponse(e) {
|
|
3773
3754
|
let t;
|
|
3774
|
-
t = e instanceof Blob ?
|
|
3755
|
+
t = e instanceof Blob ? Vn("arrayBuffer" in Blob.prototype ? await e.arrayBuffer() : await fn(e)) : Vn(e);
|
|
3775
3756
|
let n = i.dec(t), r = i.dec(t);
|
|
3776
|
-
if (r !==
|
|
3757
|
+
if (r !== $n) {
|
|
3777
3758
|
this._debug.warn("Unsupported version for command type: " + n + ", version " + r);
|
|
3778
3759
|
return;
|
|
3779
3760
|
}
|
|
3780
|
-
if (i.dec(t) !==
|
|
3761
|
+
if (i.dec(t) !== er) {
|
|
3781
3762
|
this._debug.warn("Error code: " + n + "received for command type: " + n + ", version " + r);
|
|
3782
3763
|
return;
|
|
3783
3764
|
}
|
|
3784
3765
|
switch (n) {
|
|
3785
|
-
case
|
|
3786
|
-
case
|
|
3766
|
+
case Hn: return this.deserializeUpdateDisplayLayoutResponse(t);
|
|
3767
|
+
case Un: return this.deserializeReportPerfStatResponse(t);
|
|
3787
3768
|
default:
|
|
3788
3769
|
this._debug.warn("unsupported command response commandType: " + n);
|
|
3789
3770
|
return;
|
|
@@ -3792,10 +3773,10 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
|
|
|
3792
3773
|
deserializeUpdateDisplayLayoutResponse(e) {
|
|
3793
3774
|
let r = i.dec(e), a = n.dec(e), o = {};
|
|
3794
3775
|
return a.forEach((e) => {
|
|
3795
|
-
let n =
|
|
3776
|
+
let n = Vn(e), r = t.dec(n);
|
|
3796
3777
|
if (typeof r == "string") o[r] = i.dec(n);
|
|
3797
3778
|
else {
|
|
3798
|
-
let e = r, t =
|
|
3779
|
+
let e = r, t = In(this.participantIdRegistry?.getStreamDescription(e));
|
|
3799
3780
|
o[t] = i.dec(n);
|
|
3800
3781
|
}
|
|
3801
3782
|
}), {
|
|
@@ -3815,45 +3796,45 @@ var Un = 0, Wn = 1, Gn = 2, Kn = 3, qn = 4, Jn = 5, Yn = 6, Xn = 7, Zn = 0, Qn =
|
|
|
3815
3796
|
};
|
|
3816
3797
|
}
|
|
3817
3798
|
}, U = /* @__PURE__ */ function(e) {
|
|
3818
|
-
return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.API_CALL = "api_call", e.CONNECTION_STATE_CHANGED = "connection_state_changed", e.SIGNALING_STATE_CHANGED = "signaling_state_changed", e.GATHERING_STATE_CHANGED = "gathering_state_changed", e.ICE_RESTART = "ice_restart", e.ICE_CANDIDATES_CHANGED = "ice_candidates_changed", e.ICE_CANDIDATE_GATHERING_FAILED = "ice_candidate_gathering_failed", e.ICE_CANDIDATE_ADD_FAILED = "ice_candidate_add_failed", e.SDP_CREATE_OFFER = "sdp_create_offer", e.SDP_CREATE_ANSWER = "sdp_create_answer", e.SDP_SET_LOCAL_OFFER = "sdp_set_local_offer", e.SDP_SET_LOCAL_PRANSWER = "sdp_set_local_pranswer", e.SDP_SET_LOCAL_ANSWER = "sdp_set_local_answer", e.SDP_SET_LOCAL_ROLLBACK = "sdp_set_local_rollback", e.SDP_SET_REMOTE_OFFER = "sdp_set_remote_offer", e.SDP_SET_REMOTE_PRANSWER = "sdp_set_remote_pranswer", e.SDP_SET_REMOTE_ANSWER = "sdp_set_remote_answer", e.SDP_SET_REMOTE_ROLLBACK = "sdp_set_remote_rollback", e.SDP_GENERATED = "sdp_generated", e.SDP_RECEIVED = "sdp_received", e.CLIENT_REQUESTED_SERVER_TOPOLOGY = "client_requested_server_topology", e.VIDEO_ENCODER_CHANGED_BY_NETWORK_ADAPTER = "video_encoder_changed_by_network_adapter", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
|
|
3819
|
-
}(U || {}),
|
|
3799
|
+
return e.CALL_INIT = "call_init", e.CALL_START = "call_start", e.CALL_ACCEPTED_OUTGOING = "call_accepted_outgoing", e.CALL_ACCEPTED_INCOMING = "call_accepted_incoming", e.FIRST_MEDIA_SENT = "first_media_sent", e.CALL_FINISH = "call_finish", e.CODEC_USAGE = "codec_usage", e.SIGNALING_CONNECTED = "signaling_connected", e.SCREENSHARE_FIRST_FRAME = "screen_share_first_frame", e.FIRST_MEDIA_RECEIVED = "first_media_received", e.CALL_DECLINED_OR_HANGED_LOCALLY = "CallDeclinedOrHangedLocally", e.USER_FEEDBACK_RECEIVED = "UserFeedbackReceived", e.SIGNALING_PING_SUMMARY = "signaling_ping_summary", e.SIGNALING_COMMAND_SUMMARY = "signaling_command_summary", e.API_CALL = "api_call", e.CONNECTION_STATE_CHANGED = "connection_state_changed", e.SIGNALING_STATE_CHANGED = "signaling_state_changed", e.GATHERING_STATE_CHANGED = "gathering_state_changed", e.ICE_RESTART = "ice_restart", e.ICE_CANDIDATES_CHANGED = "ice_candidates_changed", e.ICE_CANDIDATE_GATHERING_FAILED = "ice_candidate_gathering_failed", e.ICE_CANDIDATE_ADD_FAILED = "ice_candidate_add_failed", e.SDP_CREATE_OFFER = "sdp_create_offer", e.SDP_CREATE_ANSWER = "sdp_create_answer", e.SDP_SET_LOCAL_OFFER = "sdp_set_local_offer", e.SDP_SET_LOCAL_PRANSWER = "sdp_set_local_pranswer", e.SDP_SET_LOCAL_ANSWER = "sdp_set_local_answer", e.SDP_SET_LOCAL_ROLLBACK = "sdp_set_local_rollback", e.SDP_SET_REMOTE_OFFER = "sdp_set_remote_offer", e.SDP_SET_REMOTE_PRANSWER = "sdp_set_remote_pranswer", e.SDP_SET_REMOTE_ANSWER = "sdp_set_remote_answer", e.SDP_SET_REMOTE_ROLLBACK = "sdp_set_remote_rollback", e.SDP_GENERATED = "sdp_generated", e.SDP_RECEIVED = "sdp_received", e.CLIENT_REQUESTED_SERVER_TOPOLOGY = "client_requested_server_topology", e.VIDEO_ENCODER_CHANGED_BY_NETWORK_ADAPTER = "video_encoder_changed_by_network_adapter", e.ML_READY_TO_USE = "ml_ready_to_use", e.ML_ERROR = "ml_error", e.WEBSOCKET_CONNECTED = "websocket_connected", e.WEBSOCKET_RECONNECTED = "websocket_reconnected", e.WEBSOCKET_FAILED_PINGS = "websocket_failed_pings", e.WEBSOCKET_FAILED_EXCEPTION = "websocket_failed_exception", e.WEBSOCKET_TIMEOUT = "websocket_timeout", e.WEBSOCKET_RESTART = "websocket_restart", e.WEBTRANSPORT_CONNECTED = "webtransport_connected", e.WEBTRANSPORT_RECONNECTED = "webtransport_reconnected", e.WEBTRANSPORT_FAILED_PINGS = "webtransport_failed_pings", e.WEBTRANSPORT_FAILED_EXCEPTION = "webtransport_failed_exception", e.WEBTRANSPORT_TIMEOUT = "webtransport_timeout", e.WEBTRANSPORT_RESTART = "webtransport_restart", e;
|
|
3800
|
+
}(U || {}), ir = 1e3;
|
|
3820
3801
|
function W(e, t, n = 0) {
|
|
3821
3802
|
return t in e && e[t] ? e[t] : n;
|
|
3822
3803
|
}
|
|
3823
|
-
function
|
|
3804
|
+
function ar(...e) {
|
|
3824
3805
|
return (t) => {
|
|
3825
3806
|
for (let n of e) if (n(t)) return !0;
|
|
3826
3807
|
return !1;
|
|
3827
3808
|
};
|
|
3828
3809
|
}
|
|
3829
|
-
function
|
|
3810
|
+
function or(e, t) {
|
|
3830
3811
|
return (n) => n[e] === t;
|
|
3831
3812
|
}
|
|
3832
|
-
function
|
|
3813
|
+
function sr(e) {
|
|
3833
3814
|
return (t, n) => n[e] - t[e];
|
|
3834
3815
|
}
|
|
3835
|
-
function
|
|
3816
|
+
function cr(e, t) {
|
|
3836
3817
|
return t.reduce((t, n) => (t[n[e]] = n, t), {});
|
|
3837
3818
|
}
|
|
3838
|
-
function
|
|
3819
|
+
function lr(e) {
|
|
3839
3820
|
let t = {}, n = [];
|
|
3840
3821
|
for (let r of e) t[r.id] || (t[r.id] = !0, n.push(r));
|
|
3841
3822
|
return n;
|
|
3842
3823
|
}
|
|
3843
|
-
function
|
|
3844
|
-
return Object.keys(e).filter((t) => e[t] !== void 0).map((t) => [t, e[t]]).reduce((e, t) => (e[t[0]] = M.isObject(t[1]) ?
|
|
3824
|
+
function ur(e) {
|
|
3825
|
+
return Object.keys(e).filter((t) => e[t] !== void 0).map((t) => [t, e[t]]).reduce((e, t) => (e[t[0]] = M.isObject(t[1]) ? ur(t[1]) : t[1], e), {});
|
|
3845
3826
|
}
|
|
3846
|
-
function
|
|
3827
|
+
function dr(e) {
|
|
3847
3828
|
let t = [];
|
|
3848
3829
|
for (let n of e) n.forEach((e) => t.push(e));
|
|
3849
3830
|
return t;
|
|
3850
3831
|
}
|
|
3851
|
-
async function
|
|
3832
|
+
async function fr(e) {
|
|
3852
3833
|
let t = [];
|
|
3853
|
-
return RTCRtpReceiver.prototype.getStats ? (t.push(...e.getReceivers().map((e) => e.getStats())), t.push(...e.getSenders().map((e) => e.getStats()))) : t.push(e.getStats()), Promise.all(t).then(
|
|
3834
|
+
return RTCRtpReceiver.prototype.getStats ? (t.push(...e.getReceivers().map((e) => e.getStats())), t.push(...e.getSenders().map((e) => e.getStats()))) : t.push(e.getStats()), Promise.all(t).then(dr).then(lr);
|
|
3854
3835
|
}
|
|
3855
|
-
function
|
|
3856
|
-
let t = e.filter(
|
|
3836
|
+
function pr(e) {
|
|
3837
|
+
let t = e.filter(or("type", "candidate-pair")).sort(sr("priority")).find(ar(or("nominated", !0), or("selected", !0)));
|
|
3857
3838
|
if (!t) return {
|
|
3858
3839
|
timestamp: 0,
|
|
3859
3840
|
availableOutgoingBitrate: 0,
|
|
@@ -3869,14 +3850,14 @@ function mr(e) {
|
|
|
3869
3850
|
currentRoundTripTime: t.currentRoundTripTime || 0,
|
|
3870
3851
|
bytesSent: t.bytesSent || 0,
|
|
3871
3852
|
bytesReceived: t.bytesReceived || 0
|
|
3872
|
-
}, r = e.find(
|
|
3853
|
+
}, r = e.find(or("id", t.remoteCandidateId));
|
|
3873
3854
|
r && Object.assign(n, { remote: {
|
|
3874
3855
|
type: r.candidateType,
|
|
3875
3856
|
address: r.ip || r.address,
|
|
3876
3857
|
port: r.port,
|
|
3877
3858
|
protocol: r.protocol
|
|
3878
3859
|
} });
|
|
3879
|
-
let i = e.find(
|
|
3860
|
+
let i = e.find(or("id", t.localCandidateId));
|
|
3880
3861
|
return i && Object.assign(n, { local: {
|
|
3881
3862
|
type: i.candidateType,
|
|
3882
3863
|
address: i.ip || i.address,
|
|
@@ -3884,11 +3865,11 @@ function mr(e) {
|
|
|
3884
3865
|
protocol: i.protocol,
|
|
3885
3866
|
relayProtocol: i.relayProtocol,
|
|
3886
3867
|
networkType: i.networkType
|
|
3887
|
-
} }),
|
|
3868
|
+
} }), ur(n);
|
|
3888
3869
|
}
|
|
3889
|
-
function
|
|
3890
|
-
let r =
|
|
3891
|
-
return (n ? e.filter(or(
|
|
3870
|
+
function mr(e, t, n = !1) {
|
|
3871
|
+
let r = cr("id", e);
|
|
3872
|
+
return (n ? e.filter(ar(or("type", "remote-inbound-rtp"))) : e.filter(ar(or("type", "inbound-rtp"), or("type", "outbound-rtp")))).map((e) => {
|
|
3892
3873
|
let n = Number(e.ssrc), i = e.mediaType || e.kind, a = e.type, o = e.codecId;
|
|
3893
3874
|
if (!a || !n || !i) return null;
|
|
3894
3875
|
let s = {
|
|
@@ -3928,14 +3909,14 @@ function hr(e, t, n = !1) {
|
|
|
3928
3909
|
let e = r[o];
|
|
3929
3910
|
s.clockRate = e.clockRate, s.mimeType = e.mimeType, i === "audio" && e.sdpFmtpLine && (s.sdpFmtpLine = e.sdpFmtpLine);
|
|
3930
3911
|
}
|
|
3931
|
-
return
|
|
3912
|
+
return ur(s);
|
|
3932
3913
|
}).filter((e) => !!e);
|
|
3933
3914
|
}
|
|
3934
|
-
function
|
|
3915
|
+
function hr(e, t, n = !1) {
|
|
3935
3916
|
if (!t || !t.rtps.length || !e.rtps.length) return e;
|
|
3936
3917
|
let r, i;
|
|
3937
|
-
n && (r =
|
|
3938
|
-
let a =
|
|
3918
|
+
n && (r = cr("ssrc", e?.remoteRtps || []), i = cr("ssrc", t?.remoteRtps || []));
|
|
3919
|
+
let a = cr("ssrc", e.rtps), o = cr("ssrc", t.rtps), s = (e.timestamp - t.timestamp) / 1e3;
|
|
3939
3920
|
return !a || !o || Object.keys(a).forEach((c) => {
|
|
3940
3921
|
let l = a[c], u = o[c];
|
|
3941
3922
|
if (!(!l || !u)) {
|
|
@@ -3953,54 +3934,54 @@ function gr(e, t, n = !1) {
|
|
|
3953
3934
|
}
|
|
3954
3935
|
}), e;
|
|
3955
3936
|
}
|
|
3956
|
-
async function
|
|
3957
|
-
let i = await
|
|
3937
|
+
async function gr(e, t, n = {}, r = !1) {
|
|
3938
|
+
let i = await fr(e), a = {
|
|
3958
3939
|
timestamp: Date.now(),
|
|
3959
|
-
transport:
|
|
3960
|
-
rtps:
|
|
3940
|
+
transport: pr(i),
|
|
3941
|
+
rtps: mr(i, n)
|
|
3961
3942
|
};
|
|
3962
|
-
return r && (a.remoteRtps =
|
|
3943
|
+
return r && (a.remoteRtps = mr(i, n, !0)), t ? hr(a, t, r) : (await M.delay(ir), gr(e, a, n, r));
|
|
3963
3944
|
}
|
|
3964
|
-
function
|
|
3945
|
+
function _r(e) {
|
|
3965
3946
|
performance.clearMarks(e), performance.mark(e);
|
|
3966
3947
|
}
|
|
3967
|
-
function
|
|
3948
|
+
function vr(e) {
|
|
3968
3949
|
performance.clearMarks(e);
|
|
3969
3950
|
}
|
|
3970
|
-
function
|
|
3951
|
+
function yr(e) {
|
|
3971
3952
|
let t = performance.getEntriesByName(e)[0];
|
|
3972
3953
|
if (t === void 0) return null;
|
|
3973
3954
|
let n = Math.round(performance.now() - t.startTime);
|
|
3974
3955
|
return performance.clearMarks(e), !Number.isSafeInteger(n) || n < 0 ? null : n;
|
|
3975
3956
|
}
|
|
3976
|
-
function
|
|
3977
|
-
return `${U.SCREENSHARE_FIRST_FRAME}_${
|
|
3957
|
+
function br(e) {
|
|
3958
|
+
return `${U.SCREENSHARE_FIRST_FRAME}_${xr(e)}`;
|
|
3978
3959
|
}
|
|
3979
|
-
function
|
|
3960
|
+
function xr(e) {
|
|
3980
3961
|
return typeof e == "string" ? e : JSON.stringify(e);
|
|
3981
3962
|
}
|
|
3982
3963
|
var G = {
|
|
3983
|
-
distinctById:
|
|
3984
|
-
rtcStatsToArray:
|
|
3985
|
-
extractTransport:
|
|
3986
|
-
extractRtps:
|
|
3987
|
-
delta:
|
|
3988
|
-
collectStats:
|
|
3989
|
-
setMark:
|
|
3990
|
-
clearMark:
|
|
3991
|
-
measureMark:
|
|
3992
|
-
getMarkNameScreenshareFirstFrame:
|
|
3993
|
-
},
|
|
3964
|
+
distinctById: lr,
|
|
3965
|
+
rtcStatsToArray: dr,
|
|
3966
|
+
extractTransport: pr,
|
|
3967
|
+
extractRtps: mr,
|
|
3968
|
+
delta: hr,
|
|
3969
|
+
collectStats: gr,
|
|
3970
|
+
setMark: _r,
|
|
3971
|
+
clearMark: vr,
|
|
3972
|
+
measureMark: yr,
|
|
3973
|
+
getMarkNameScreenshareFirstFrame: br
|
|
3974
|
+
}, Sr = /* @__PURE__ */ function(e) {
|
|
3994
3975
|
return e.START = "start", e.ACCEPT = "accept", e.JOIN = "join", e.RETRY = "retry", e;
|
|
3995
|
-
}(
|
|
3976
|
+
}(Sr || {}), Cr = /* @__PURE__ */ function(e) {
|
|
3996
3977
|
return e.NOTIFICATION = "NOTIFICATION", e.FAILED = "FAILED", e.RECONNECT = "RECONNECT", e;
|
|
3997
|
-
}(
|
|
3978
|
+
}(Cr || {}), K = /* @__PURE__ */ function(e) {
|
|
3998
3979
|
return e.TRANSMITTED_DATA = "transmitted-data", e.ACCEPTED_CALL = "accepted-call", e.HUNGUP = "hungup", e.PARTICIPANT_ADDED = "participant-added", e.PARTICIPANT_JOINED = "participant-joined", e.CLOSED_CONVERSATION = "closed-conversation", e.MEDIA_SETTINGS_CHANGED = "media-settings-changed", e.PARTICIPANT_STATE_CHANGED = "participant-state-changed", e.PARTICIPANTS_STATE_CHANGED = "participants-state-changed", e.RATE_CALL_DATA = "rate-call-data", e.FEATURE_SET_CHANGED = "feature-set-changed", e.TOPOLOGY_CHANGED = "topology-changed", e.PRODUCER_UPDATED = "producer-updated", e.CONSUMER_ANSWERED = "consumer-answered", e.MULTIPARTY_CHAT_CREATED = "multiparty-chat-created", e.FORCE_MEDIA_SETTINGS_CHANGE = "force-media-settings-change", e.SETTINGS_UPDATE = "settings-update", e.VIDEO_QUALITY_UPDATE = "video-quality-update", e.REGISTERED_PEER = "registered-peer", e.SWITCH_MICRO = "switch-micro", e.RECORD_STARTED = "record-started", e.RECORD_STOPPED = "record-stopped", e.REALLOC_CON = "realloc-con", e.AUDIO_ACTIVITY = "audio-activity", e.SPEAKER_CHANGED = "speaker-changed", e.SESSION_STATE = "session-state", e.STALLED_ACTIVITY = "stalled-activity", e.CHAT_MESSAGE = "chat-message", e.CUSTOM_DATA = "custom-data", e.ROLES_CHANGED = "roles-changed", e.MUTE_PARTICIPANT = "mute-participant", e.PIN_PARTICIPANT = "pin-participant", e.OPTIONS_CHANGED = "options-changed", e.NETWORK_STATUS = "network-status", e.PARTICIPANT_SOURCES_UPDATE = "participant-sources-update", e.PROMOTE_PARTICIPANT = "promote-participant", e.CHAT_ROOM_UPDATED = "chat-room-updated", e.PROMOTION_APPROVED = "promotion-approved", e.JOIN_LINK_CHANGED = "join-link-changed", e.FEEDBACK = "feedback", e.MOVIE_UPDATE_NOTIFICATION = "movie-update-notification", e.MOVIE_SHARE_STARTED = "movie-share-started", e.MOVIE_SHARE_STOPPED = "movie-share-stopped", e.URL_SHARING_INFO_UPDATED = "url-sharing-info-updated", e.ROOM_UPDATED = "room-updated", e.ROOMS_UPDATED = "rooms-updated", e.ROOM_PARTICIPANTS_UPDATED = "room-participants-updated", e.FEATURES_PER_ROLE_CHANGED = "features-per-role-changed", e.PARTICIPANT_ANIMOJI_CHANGED = "participant-animoji-changed", e.ASR_STARTED = "asr-started", e.ASR_STOPPED = "asr-stopped", e.DECORATIVE_PARTICIPANT_ID_CHANGED = "decorative-participant-id-changed", e.VIDEO_SUSPEND_SUGGEST = "video-suspend-suggest", e.HOLD = "hold", e;
|
|
3999
|
-
}(K || {}),
|
|
3980
|
+
}(K || {}), wr = /* @__PURE__ */ function(e) {
|
|
4000
3981
|
return e.WEBSOCKET = "ws", e.WEBTRANSPORT = "wt", e;
|
|
4001
|
-
}({}),
|
|
3982
|
+
}({}), Tr = /* @__PURE__ */ function(e) {
|
|
4002
3983
|
return e.CONNECTED = "connected", e.RECONNECTED = "reconnected", e.FAILED_PINGS = "failed_pings", e.FAILED_EXCEPTIONS = "failed_exception", e.TIMEOUT = "timeout", e.RESTART = "restart", e;
|
|
4003
|
-
}({}),
|
|
3984
|
+
}({}), Er = {
|
|
4004
3985
|
connected: {
|
|
4005
3986
|
wt: U.WEBTRANSPORT_CONNECTED,
|
|
4006
3987
|
ws: U.WEBSOCKET_CONNECTED
|
|
@@ -4027,24 +4008,24 @@ var G = {
|
|
|
4027
4008
|
}
|
|
4028
4009
|
}, q = /* @__PURE__ */ function(e) {
|
|
4029
4010
|
return e.IDLE = "IDLE", e.OPENED = "OPENED", e.CONNECTING = "CONNECTING", e.RECONNECTING = "RECONNECTING", e.CONNECTED = "CONNECTED", e.CLOSED = "CLOSED", e.FAILED = "FAILED", e;
|
|
4030
|
-
}(q || {}),
|
|
4011
|
+
}(q || {}), Dr = {
|
|
4031
4012
|
offer: U.SDP_CREATE_OFFER,
|
|
4032
4013
|
answer: U.SDP_CREATE_ANSWER
|
|
4033
|
-
},
|
|
4014
|
+
}, Or = {
|
|
4034
4015
|
offer: U.SDP_SET_LOCAL_OFFER,
|
|
4035
4016
|
pranswer: U.SDP_SET_LOCAL_PRANSWER,
|
|
4036
4017
|
answer: U.SDP_SET_LOCAL_ANSWER,
|
|
4037
4018
|
rollback: U.SDP_SET_LOCAL_ROLLBACK
|
|
4038
|
-
},
|
|
4019
|
+
}, kr = {
|
|
4039
4020
|
offer: U.SDP_SET_REMOTE_OFFER,
|
|
4040
4021
|
pranswer: U.SDP_SET_REMOTE_PRANSWER,
|
|
4041
4022
|
answer: U.SDP_SET_REMOTE_ANSWER,
|
|
4042
4023
|
rollback: U.SDP_SET_REMOTE_ROLLBACK
|
|
4043
|
-
},
|
|
4024
|
+
}, Ar = {
|
|
4044
4025
|
local_address: null,
|
|
4045
4026
|
remote_address: null,
|
|
4046
4027
|
transport: null
|
|
4047
|
-
},
|
|
4028
|
+
}, jr = class {
|
|
4048
4029
|
constructor(e) {
|
|
4049
4030
|
h(this, "_statAggregator", void 0), h(this, "_pc", null), h(this, "_gatheringStartedAt", 0), h(this, "_remoteSdpReceivedAt", 0), h(this, "_handleGatheringStateChange", () => {
|
|
4050
4031
|
this._pc?.iceGatheringState === "gathering" && (this._gatheringStartedAt = Date.now());
|
|
@@ -4061,11 +4042,11 @@ var G = {
|
|
|
4061
4042
|
name: U.SDP_GENERATED,
|
|
4062
4043
|
value: 0,
|
|
4063
4044
|
string_value: e,
|
|
4064
|
-
...
|
|
4045
|
+
...Ar
|
|
4065
4046
|
});
|
|
4066
4047
|
}
|
|
4067
4048
|
logCandidateGenerated(e) {
|
|
4068
|
-
let t =
|
|
4049
|
+
let t = Nr(e.candidate);
|
|
4069
4050
|
t && this._log({
|
|
4070
4051
|
name: U.SDP_GENERATED,
|
|
4071
4052
|
value: Math.max(0, Date.now() - this._gatheringStartedAt),
|
|
@@ -4080,11 +4061,11 @@ var G = {
|
|
|
4080
4061
|
name: U.SDP_RECEIVED,
|
|
4081
4062
|
value: 0,
|
|
4082
4063
|
string_value: e,
|
|
4083
|
-
...
|
|
4064
|
+
...Ar
|
|
4084
4065
|
});
|
|
4085
4066
|
}
|
|
4086
4067
|
logCandidateReceived(e) {
|
|
4087
|
-
let t =
|
|
4068
|
+
let t = Nr(e.candidate);
|
|
4088
4069
|
t && this._log({
|
|
4089
4070
|
name: U.SDP_RECEIVED,
|
|
4090
4071
|
value: this._remoteSdpReceivedAt > 0 ? Math.max(0, Date.now() - this._remoteSdpReceivedAt) : 0,
|
|
@@ -4095,17 +4076,17 @@ var G = {
|
|
|
4095
4076
|
});
|
|
4096
4077
|
}
|
|
4097
4078
|
logCreateFailed(e, t) {
|
|
4098
|
-
let n =
|
|
4079
|
+
let n = Dr[e];
|
|
4099
4080
|
n && this._logFailure(n, t, { remote: e === "answer" ? this._pc?.remoteDescription : void 0 });
|
|
4100
4081
|
}
|
|
4101
4082
|
logSetLocalFailed(e, t) {
|
|
4102
|
-
this._logFailure(
|
|
4083
|
+
this._logFailure(Or[e.type], t, {
|
|
4103
4084
|
local: e,
|
|
4104
4085
|
remote: this._pc?.remoteDescription
|
|
4105
4086
|
});
|
|
4106
4087
|
}
|
|
4107
4088
|
logSetRemoteFailed(e, t) {
|
|
4108
|
-
this._logFailure(
|
|
4089
|
+
this._logFailure(kr[e.type], t, {
|
|
4109
4090
|
local: this._pc?.localDescription,
|
|
4110
4091
|
remote: e
|
|
4111
4092
|
});
|
|
@@ -4118,60 +4099,60 @@ var G = {
|
|
|
4118
4099
|
name: e,
|
|
4119
4100
|
string_value: JSON.stringify({
|
|
4120
4101
|
error: t instanceof Error ? t.message : String(t),
|
|
4121
|
-
local:
|
|
4122
|
-
remote:
|
|
4102
|
+
local: Mr(n.local),
|
|
4103
|
+
remote: Mr(n.remote)
|
|
4123
4104
|
}),
|
|
4124
|
-
...
|
|
4105
|
+
...Ar
|
|
4125
4106
|
});
|
|
4126
4107
|
}
|
|
4127
4108
|
_log(e) {
|
|
4128
4109
|
this._statAggregator?.logEventualStat(e);
|
|
4129
4110
|
}
|
|
4130
4111
|
};
|
|
4131
|
-
function
|
|
4112
|
+
function Mr(e) {
|
|
4132
4113
|
return e ? {
|
|
4133
4114
|
type: e.type,
|
|
4134
4115
|
sdp: e.sdp
|
|
4135
4116
|
} : void 0;
|
|
4136
4117
|
}
|
|
4137
|
-
function
|
|
4118
|
+
function Nr(e) {
|
|
4138
4119
|
let t = e?.split(" ") ?? [], n = t.indexOf("typ"), r = t[2]?.toLowerCase(), i = t[4], a = n === -1 ? void 0 : t[n + 1];
|
|
4139
|
-
return r === void 0 || i === void 0 || a === void 0 || !
|
|
4120
|
+
return r === void 0 || i === void 0 || a === void 0 || !Ir(i) ? null : {
|
|
4140
4121
|
protocol: r,
|
|
4141
4122
|
address: i,
|
|
4142
4123
|
type: a
|
|
4143
4124
|
};
|
|
4144
4125
|
}
|
|
4145
|
-
var
|
|
4146
|
-
function
|
|
4147
|
-
return
|
|
4126
|
+
var Pr = /^\d{1,3}(\.\d{1,3}){3}$/, Fr = /^[0-9a-f:]+$/i;
|
|
4127
|
+
function Ir(e) {
|
|
4128
|
+
return Pr.test(e) || e.includes(":") && Fr.test(e);
|
|
4148
4129
|
}
|
|
4149
4130
|
//#endregion
|
|
4150
4131
|
//#region src/enums/TransportTopology.ts
|
|
4151
4132
|
var J = /* @__PURE__ */ function(e) {
|
|
4152
4133
|
return e.DIRECT = "DIRECT", e.SERVER = "SERVER", e;
|
|
4153
|
-
}(J || {}),
|
|
4134
|
+
}(J || {}), Lr = /* @__PURE__ */ function(e) {
|
|
4154
4135
|
return e.producerNotification = "producerNotification", e.producerCommand = "producerCommand", e.consumerScreenShare = "consumerScreenShare", e.producerScreenShare = "producerScreenShare", e.asr = "asr", e.animoji = "animoji", e;
|
|
4155
|
-
}(
|
|
4156
|
-
function
|
|
4157
|
-
return e === null || t === null ? e === null && t === null : e.maxDimension !== t.maxDimension || e.maxBitrateK !== t.maxBitrateK || e.maxFramerate !== t.maxFramerate || e.degradationPreference !== t.degradationPreference || e.scalabilityMode !== t.scalabilityMode ||
|
|
4136
|
+
}(Lr || {}), { isObject: Rr, isObjectsEquals: zr } = M;
|
|
4137
|
+
function Br(e, t) {
|
|
4138
|
+
return e === null || t === null ? e === null && t === null : e.maxDimension !== t.maxDimension || e.maxBitrateK !== t.maxBitrateK || e.maxFramerate !== t.maxFramerate || e.degradationPreference !== t.degradationPreference || e.scalabilityMode !== t.scalabilityMode || Rr(e.bitrates) && Rr(t.bitrates) && !zr(e.bitrates, t.bitrates, !0) ? !1 : e.bitrates === t.bitrates;
|
|
4158
4139
|
}
|
|
4159
|
-
var
|
|
4140
|
+
var Vr = /* @__PURE__ */ function(e) {
|
|
4160
4141
|
return e.L1T1 = "L1T1", e.L1T2 = "L1T2", e.L1T3 = "L1T3", e;
|
|
4161
4142
|
}({});
|
|
4162
4143
|
//#endregion
|
|
4163
4144
|
//#region src/types/ServerSettings.ts
|
|
4164
|
-
function
|
|
4165
|
-
return !(!
|
|
4145
|
+
function Hr(e, t) {
|
|
4146
|
+
return !(!Br(e.camera, t.camera) || !Br(e.screenSharing, t.screenSharing) || !Br(e.fastScreenSharing, t.fastScreenSharing));
|
|
4166
4147
|
}
|
|
4167
|
-
function
|
|
4148
|
+
function Ur(e, t) {
|
|
4168
4149
|
return {
|
|
4169
4150
|
camera: Object.assign({}, e.camera, t.camera),
|
|
4170
4151
|
screenSharing: Object.assign({}, e.screenSharing, t.screenSharing),
|
|
4171
4152
|
fastScreenSharing: Object.assign({}, e.fastScreenSharing, t.fastScreenSharing)
|
|
4172
4153
|
};
|
|
4173
4154
|
}
|
|
4174
|
-
function
|
|
4155
|
+
function Wr() {
|
|
4175
4156
|
return {
|
|
4176
4157
|
camera: null,
|
|
4177
4158
|
screenSharing: null,
|
|
@@ -4180,14 +4161,14 @@ function Gr() {
|
|
|
4180
4161
|
}
|
|
4181
4162
|
//#endregion
|
|
4182
4163
|
//#region src/classes/stat/PeerConnectionStats.ts
|
|
4183
|
-
var
|
|
4164
|
+
var Gr = /[?&]transport=(tcp|udp)/i, Kr = {
|
|
4184
4165
|
stable: "stable",
|
|
4185
4166
|
"have-local-offer": "have.local.offer",
|
|
4186
4167
|
"have-local-pranswer": "have.local.answer",
|
|
4187
4168
|
"have-remote-offer": "have.remote.offer",
|
|
4188
4169
|
"have-remote-pranswer": "have.remote.answer",
|
|
4189
4170
|
closed: "closed"
|
|
4190
|
-
},
|
|
4171
|
+
}, qr = class {
|
|
4191
4172
|
constructor(e) {
|
|
4192
4173
|
h(this, "_statAggregator", void 0), h(this, "_pc", null), h(this, "_lastSignalingStateChange", 0), h(this, "_lastGatheringStateChange", 0), h(this, "_lastConnectionState", null), h(this, "_handleConnectionStateChange", () => {
|
|
4193
4174
|
this._pc && this._logConnectionState(this._pc.connectionState);
|
|
@@ -4196,7 +4177,7 @@ var Kr = /[?&]transport=(tcp|udp)/i, qr = {
|
|
|
4196
4177
|
this._log({
|
|
4197
4178
|
name: U.SIGNALING_STATE_CHANGED,
|
|
4198
4179
|
value: this._sinceLastChange("_lastSignalingStateChange"),
|
|
4199
|
-
string_value: e ?
|
|
4180
|
+
string_value: e ? Kr[e] : void 0
|
|
4200
4181
|
});
|
|
4201
4182
|
}), h(this, "_handleGatheringStateChange", () => {
|
|
4202
4183
|
let e = this._pc?.iceGatheringState, t = this._sinceLastChange("_lastGatheringStateChange");
|
|
@@ -4214,7 +4195,7 @@ var Kr = /[?&]transport=(tcp|udp)/i, qr = {
|
|
|
4214
4195
|
string_value: t.errorText,
|
|
4215
4196
|
local_address: t.address ?? "",
|
|
4216
4197
|
remote_url: t.url,
|
|
4217
|
-
transport:
|
|
4198
|
+
transport: Gr.exec(t.url ?? "")?.[1]?.toLowerCase() ?? null
|
|
4218
4199
|
});
|
|
4219
4200
|
}), this._statAggregator = e;
|
|
4220
4201
|
}
|
|
@@ -4248,11 +4229,11 @@ var Kr = /[?&]transport=(tcp|udp)/i, qr = {
|
|
|
4248
4229
|
_log(e) {
|
|
4249
4230
|
this._statAggregator?.logEventualStat(e);
|
|
4250
4231
|
}
|
|
4251
|
-
},
|
|
4232
|
+
}, Jr = /* @__PURE__ */ function(e) {
|
|
4252
4233
|
return e.NO_CONNECTION_TIMEOUT = "no_connection_timeout", e.CONNECTION_FAILED = "connection_failed", e.SUCCESS_CONNECTION = "success_connection", e.NO_DATA_TIMEOUT = "no_data_timeout", e.SUCCESS_AUDIO = "success_audio", e.CONNECTION_ACCEPTED_FAILED = "connection_accepted_failed", e;
|
|
4253
|
-
}({}),
|
|
4234
|
+
}({}), Yr = /* @__PURE__ */ function(e) {
|
|
4254
4235
|
return e.GOOD = "good", e.BAD_1 = "bad_1", e.BAD_2 = "bad_2", e;
|
|
4255
|
-
}({}),
|
|
4236
|
+
}({}), Xr = class {
|
|
4256
4237
|
constructor(e) {
|
|
4257
4238
|
h(this, "_statAggregator", void 0), this._statAggregator = e;
|
|
4258
4239
|
}
|
|
@@ -4277,13 +4258,13 @@ var Kr = /[?&]transport=(tcp|udp)/i, qr = {
|
|
|
4277
4258
|
})
|
|
4278
4259
|
});
|
|
4279
4260
|
}
|
|
4280
|
-
},
|
|
4281
|
-
function
|
|
4261
|
+
}, Zr = 200;
|
|
4262
|
+
function Qr(e) {
|
|
4282
4263
|
for (let t of e.values()) if (t.type === "outbound-rtp" && (t.packetsSent ?? 0) > 0) return !0;
|
|
4283
4264
|
return !1;
|
|
4284
4265
|
}
|
|
4285
|
-
var
|
|
4286
|
-
constructor(e, t, n =
|
|
4266
|
+
var $r = class {
|
|
4267
|
+
constructor(e, t, n = Zr) {
|
|
4287
4268
|
h(this, "_peerConnection", void 0), h(this, "_onFirstMediaSent", void 0), h(this, "_pollIntervalMs", void 0), h(this, "_timer", null), h(this, "_state", "idle"), this._peerConnection = e, this._onFirstMediaSent = t, this._pollIntervalMs = n;
|
|
4288
4269
|
}
|
|
4289
4270
|
start() {
|
|
@@ -4306,7 +4287,7 @@ var ei = class {
|
|
|
4306
4287
|
try {
|
|
4307
4288
|
let e = await this._getStatsReports();
|
|
4308
4289
|
if (this._state !== "polling") return;
|
|
4309
|
-
if (e.some(
|
|
4290
|
+
if (e.some(Qr)) {
|
|
4310
4291
|
this._state = "stopped", this._onFirstMediaSent();
|
|
4311
4292
|
return;
|
|
4312
4293
|
}
|
|
@@ -4319,7 +4300,7 @@ var ei = class {
|
|
|
4319
4300
|
this._timer = null, this._poll();
|
|
4320
4301
|
}, this._pollIntervalMs));
|
|
4321
4302
|
}
|
|
4322
|
-
},
|
|
4303
|
+
}, ei = class extends Ye {
|
|
4323
4304
|
constructor(e, t, n = null) {
|
|
4324
4305
|
super(), h(this, "_signaling", void 0), h(this, "_mediaSource", void 0), h(this, "_state", q.IDLE), h(this, "_pc", null), h(this, "_onFirstMediaSent", void 0), h(this, "_firstMediaSentProbe", null), h(this, "_firstMediaSentProbeStopped", !1), this._signaling = e, this._mediaSource = t, this._onFirstMediaSent = n;
|
|
4325
4306
|
}
|
|
@@ -4330,12 +4311,12 @@ var ei = class {
|
|
|
4330
4311
|
this._firstMediaSentProbeStopped = !0, this._disposeFirstMediaSentProbe();
|
|
4331
4312
|
}
|
|
4332
4313
|
_startFirstMediaSentProbe() {
|
|
4333
|
-
this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new
|
|
4314
|
+
this._disposeFirstMediaSentProbe(), !(!this._pc || !this._onFirstMediaSent || this._firstMediaSentProbeStopped) && (this._firstMediaSentProbe = new $r(this._pc, this._onFirstMediaSent), this._firstMediaSentProbe.start());
|
|
4334
4315
|
}
|
|
4335
4316
|
_disposeFirstMediaSentProbe() {
|
|
4336
4317
|
this._firstMediaSentProbe?.destroy(), this._firstMediaSentProbe = null;
|
|
4337
4318
|
}
|
|
4338
|
-
},
|
|
4319
|
+
}, ti = class {
|
|
4339
4320
|
constructor(e, t = null) {
|
|
4340
4321
|
h(this, "weightUp", void 0), h(this, "weightDown", void 0), h(this, "value", NaN), this.weightUp = e, this.weightDown = t ?? e;
|
|
4341
4322
|
}
|
|
@@ -4353,7 +4334,7 @@ var ei = class {
|
|
|
4353
4334
|
getValue() {
|
|
4354
4335
|
return this.value;
|
|
4355
4336
|
}
|
|
4356
|
-
},
|
|
4337
|
+
}, ni = .25, ri = .35, ii = 85, ai = .1, oi = 1.5, si = .1, ci = 1, li = .6, ui = .3, di = class extends Ye {
|
|
4357
4338
|
constructor(e, t = z) {
|
|
4358
4339
|
super(), h(this, "_signaling", void 0), h(this, "_localNetworkStat", void 0), h(this, "_remoteNetworkStat", void 0), h(this, "_lastNetworkStat", void 0), h(this, "_networkLimits", {
|
|
4359
4340
|
badNet: {
|
|
@@ -4365,8 +4346,8 @@ var ei = class {
|
|
|
4365
4346
|
rtt: 600
|
|
4366
4347
|
}
|
|
4367
4348
|
}), h(this, "_lastStatSentTimestamp", 0), h(this, "_currentState", "good"), h(this, "_debug", void 0), this._debug = t, this._signaling = e, this._localNetworkStat = {
|
|
4368
|
-
rtt: new ni
|
|
4369
|
-
loss: new
|
|
4349
|
+
rtt: new ti(ni, ni),
|
|
4350
|
+
loss: new ti(ri, ri),
|
|
4370
4351
|
bitrate: 0
|
|
4371
4352
|
}, this._remoteNetworkStat = {
|
|
4372
4353
|
rtt: 0,
|
|
@@ -4381,20 +4362,20 @@ var ei = class {
|
|
|
4381
4362
|
_calcRttRating(e) {
|
|
4382
4363
|
let t = typeof e == "number" ? e : e.getValue(), n = 1;
|
|
4383
4364
|
if (isNaN(t)) return n;
|
|
4384
|
-
let r = Math.round((t - this._networkLimits.goodNet.rtt) /
|
|
4385
|
-
for (let e = 0; e < r; e++) n *= 1 -
|
|
4365
|
+
let r = Math.round((t - this._networkLimits.goodNet.rtt) / ii);
|
|
4366
|
+
for (let e = 0; e < r; e++) n *= 1 - ai;
|
|
4386
4367
|
return n;
|
|
4387
4368
|
}
|
|
4388
4369
|
_calcLossRating(e) {
|
|
4389
4370
|
let t = typeof e == "number" ? e : e.getValue(), n = 1;
|
|
4390
4371
|
if (isNaN(t)) return n;
|
|
4391
|
-
let r = Math.round((t - this._networkLimits.goodNet.loss) /
|
|
4392
|
-
for (let e = 0; e < r; e++) n *= 1 -
|
|
4372
|
+
let r = Math.round((t - this._networkLimits.goodNet.loss) / oi);
|
|
4373
|
+
for (let e = 0; e < r; e++) n *= 1 - si;
|
|
4393
4374
|
return n;
|
|
4394
4375
|
}
|
|
4395
4376
|
_calcBitrateRating(e, t) {
|
|
4396
4377
|
if (!e || !t) return 1;
|
|
4397
|
-
let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) *
|
|
4378
|
+
let n = 1 - (1 - Math.min(e, t) / Math.max(e, t)) * ci;
|
|
4398
4379
|
return Math.min(n, 1);
|
|
4399
4380
|
}
|
|
4400
4381
|
_calcUDPRating({ rtt: e, loss: t }) {
|
|
@@ -4404,7 +4385,7 @@ var ei = class {
|
|
|
4404
4385
|
return n ? this._calcBitrateRating(e.bitrate, t.bitrate) : this._calcUDPRating(e) * this._calcUDPRating(t);
|
|
4405
4386
|
}
|
|
4406
4387
|
_getNetworkState(e) {
|
|
4407
|
-
return isNaN(e) || e >=
|
|
4388
|
+
return isNaN(e) || e >= li ? "good" : e >= ui ? "medium" : "bad";
|
|
4408
4389
|
}
|
|
4409
4390
|
updateSettings(e) {
|
|
4410
4391
|
Object.assign(this._networkLimits.badNet, e?.badNet || {}), Object.assign(this._networkLimits.goodNet, e?.goodNet || {});
|
|
@@ -4428,7 +4409,7 @@ var ei = class {
|
|
|
4428
4409
|
let { rtt: t, loss: n, bitrate: r } = e || {};
|
|
4429
4410
|
this._remoteNetworkStat.rtt = t || 0, this._remoteNetworkStat.loss = n || 0, this._remoteNetworkStat.bitrate = r || 0;
|
|
4430
4411
|
}
|
|
4431
|
-
},
|
|
4412
|
+
}, fi = 30 * 1e3, pi = class e extends ei {
|
|
4432
4413
|
constructor(e, t, n, r, i, a = z, o = null, s = null, c = null, l = null) {
|
|
4433
4414
|
super(n, r, l), h(this, "_participantId", void 0), h(this, "_isMaster", void 0), h(this, "_remoteSDP", {}), h(this, "_remoteCandidates", {}), h(this, "_lastRemoteSDP", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_remoteAnimojiVersion", 1), h(this, "_isOpen", !1), h(this, "_remotePeerId", null), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_failedOnCreate", null), h(this, "_remoteStream", null), h(this, "_iceRestartTimeout", null), h(this, "_reconnectionTimeout", null), h(this, "_reconnectionPrevented", !1), h(this, "_remoteHold", !1), h(this, "_lastStat", null), h(this, "_fingerprint", null), h(this, "_neverConnected", !0), h(this, "_connectionStartedAt", 0), h(this, "_connectionLostAt", 0), h(this, "_serverRequestedOnNoConnection", !1), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_networkLimitsForVideo", {
|
|
4434
4415
|
bad: {
|
|
@@ -4443,7 +4424,7 @@ var ei = class {
|
|
|
4443
4424
|
worst: 320,
|
|
4444
4425
|
bad: 640,
|
|
4445
4426
|
good: 1280
|
|
4446
|
-
}), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_networkAdaptationStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new Ha(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new
|
|
4427
|
+
}), h(this, "_lastVideoMaxDimension", this._videoMaxDimensionsForNet.good), h(this, "_lastBadConnection", 0), h(this, "_perfStatReporter", void 0), h(this, "_directStatReporter", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_networkAdaptationStats", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_codecStatsAggregator", void 0), this._participantId = e, this._isMaster = t, this._serverSettings = i, this._debug = a, this._logger = o, this._statAggregator = s, this._codecStatsAggregator = c, this._perfStatReporter = new Ha(this, n, this._statAggregator, !0, this._debug), this._directStatReporter = new di(n, this._debug), this._sdpStats = new jr(this._statAggregator), this._peerConnectionStats = new qr(this._statAggregator), this._networkAdaptationStats = new Xr(this._statAggregator), this.subscribe(this._signaling, Cr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._applySettings.bind(this)), this.subscribe(this._directStatReporter, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this));
|
|
4447
4428
|
try {
|
|
4448
4429
|
this._pc = this._createPeerConnection();
|
|
4449
4430
|
} catch (e) {
|
|
@@ -4506,7 +4487,7 @@ var ei = class {
|
|
|
4506
4487
|
this._remoteSDP = {}, this._remoteCandidates = {};
|
|
4507
4488
|
}
|
|
4508
4489
|
updateSettings(e) {
|
|
4509
|
-
|
|
4490
|
+
Hr(e, this._serverSettings) || (this._serverSettings = e, this._applySettings());
|
|
4510
4491
|
}
|
|
4511
4492
|
preventRestart() {
|
|
4512
4493
|
this._reconnectionPrevented = !0;
|
|
@@ -4547,7 +4528,7 @@ var ei = class {
|
|
|
4547
4528
|
iceServers: N.iceServers,
|
|
4548
4529
|
iceTransportPolicy: N.forceRelayPolicy ? "relay" : "all"
|
|
4549
4530
|
});
|
|
4550
|
-
return e.onicecandidate = this._handleIceCandidate.bind(this), e.ontrack = this._onAddTrack.bind(this), e.oniceconnectionstatechange = this._onIceConnectionStateChange.bind(this), e.onconnectionstatechange = this._onConnectionStateChange.bind(this), e.onsignalingstatechange = this._onSignalingStateChange.bind(this), this._sdpStats.observe(e), this._peerConnectionStats.observe(e), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(e,
|
|
4531
|
+
return e.onicecandidate = this._handleIceCandidate.bind(this), e.ontrack = this._onAddTrack.bind(this), e.oniceconnectionstatechange = this._onIceConnectionStateChange.bind(this), e.onconnectionstatechange = this._onConnectionStateChange.bind(this), e.onsignalingstatechange = this._onSignalingStateChange.bind(this), this._sdpStats.observe(e), this._peerConnectionStats.observe(e), this._prevConsumerSettings = {}, N.vmoji && this._createDataChannel(e, Lr.animoji, (e) => {
|
|
4551
4532
|
this._animojiDataChannel = e, this._animojiDataChannel.binaryType = "arraybuffer", this._animojiReceiver?.setDataChannel(this._animojiDataChannel), this._animojiSender?.setDataChannel(this._animojiDataChannel);
|
|
4552
4533
|
}), e;
|
|
4553
4534
|
}
|
|
@@ -4688,7 +4669,7 @@ var ei = class {
|
|
|
4688
4669
|
}
|
|
4689
4670
|
}
|
|
4690
4671
|
_markConnected() {
|
|
4691
|
-
this._serverRequestedOnNoConnection && (this._networkAdaptationStats.logServerTopologyRequested(
|
|
4672
|
+
this._serverRequestedOnNoConnection && (this._networkAdaptationStats.logServerTopologyRequested(Jr.SUCCESS_CONNECTION, Date.now() - this._connectionStartedAt), this._serverRequestedOnNoConnection = !1), this._neverConnected = !1, this._setState(q.CONNECTED), this._stopReconnection(), this._pc && M.getPeerConnectionHostInfo(this._pc).then((e) => {
|
|
4692
4673
|
e?.local && (this._logger?.log(x.ICE_CONNECTION_TYPE, e.local.type), this._debug.debug("Selected ICE candidates", e));
|
|
4693
4674
|
}), this._startStatInterval();
|
|
4694
4675
|
}
|
|
@@ -4708,14 +4689,14 @@ var ei = class {
|
|
|
4708
4689
|
}
|
|
4709
4690
|
_startReconnection() {
|
|
4710
4691
|
this._reconnectionTimeout || this._iceRestartTimeout || (this._debug.log("Waiting for reconnection...", { participantId: this._participantId }), this._connectionLostAt = Date.now(), this._reconnectionTimeout = window.setTimeout(() => {
|
|
4711
|
-
this._reconnectionTimeout = null, this._neverConnected ? this._requestTopologySwitch({ reason:
|
|
4692
|
+
this._reconnectionTimeout = null, this._neverConnected ? this._requestTopologySwitch({ reason: Jr.NO_CONNECTION_TIMEOUT }) : this._startIceRestart();
|
|
4712
4693
|
}, N.transportConnectionWaitTime));
|
|
4713
4694
|
}
|
|
4714
4695
|
_requestTopologySwitch({ reason: e, fromAnySide: t = !1 }) {
|
|
4715
4696
|
if ((this._isMaster || t) && this._signaling.ready) {
|
|
4716
4697
|
this._debug.log("Switch topology DIRECT to SERVER", { participantId: this._participantId });
|
|
4717
|
-
let t = e ===
|
|
4718
|
-
this._networkAdaptationStats.logServerTopologyRequested(e, Date.now() - t), e ===
|
|
4698
|
+
let t = e === Jr.CONNECTION_FAILED ? this._connectionLostAt : this._connectionStartedAt;
|
|
4699
|
+
this._networkAdaptationStats.logServerTopologyRequested(e, Date.now() - t), e === Jr.NO_CONNECTION_TIMEOUT && (this._serverRequestedOnNoConnection = !0), this._signaling.switchTopology(J.SERVER).catch((e) => {
|
|
4719
4700
|
e instanceof kn || this._debug.warn("Unable to switch topology DIRECT to SERVER", e);
|
|
4720
4701
|
});
|
|
4721
4702
|
}
|
|
@@ -4726,7 +4707,7 @@ var ei = class {
|
|
|
4726
4707
|
_startIceRestart() {
|
|
4727
4708
|
this._isMaster ? (this._peerConnectionStats.logIceRestart(), this._logger?.log(x.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(() => {
|
|
4728
4709
|
this._iceRestartTimeout = null, this._debug.error("Ice restart failed", { participantId: this._participantId }), this._logger?.log(x.ERROR, "iceRestart-direct"), this._requestTopologySwitch({
|
|
4729
|
-
reason:
|
|
4710
|
+
reason: Jr.CONNECTION_FAILED,
|
|
4730
4711
|
fromAnySide: N.switchTopologyOnReconnectFromAnySide
|
|
4731
4712
|
});
|
|
4732
4713
|
}, N.iceRestartWaitTime);
|
|
@@ -4848,8 +4829,8 @@ var ei = class {
|
|
|
4848
4829
|
}
|
|
4849
4830
|
async _checkPPTNetwork(e) {
|
|
4850
4831
|
if (!N.switchVideoAtBadNetwork || !e.inbound.transport.averageNetStat) return;
|
|
4851
|
-
let { averageNetStat: t } = e.inbound.transport, n = t.currentRoundTripTime <= this._networkLimitsForVideo.good.rtt && t.lostPercent <= this._networkLimitsForVideo.good.loss, r = t.currentRoundTripTime >= this._networkLimitsForVideo.bad.rtt || t.lostPercent >= this._networkLimitsForVideo.bad.loss, i = t.currentRoundTripTime < this._networkLimitsForVideo.bad.rtt, a = this._videoMaxDimensionsForNet.good, o =
|
|
4852
|
-
if (r ? (this._lastBadConnection = Date.now(), i ? (s =
|
|
4832
|
+
let { averageNetStat: t } = e.inbound.transport, n = t.currentRoundTripTime <= this._networkLimitsForVideo.good.rtt && t.lostPercent <= this._networkLimitsForVideo.good.loss, r = t.currentRoundTripTime >= this._networkLimitsForVideo.bad.rtt || t.lostPercent >= this._networkLimitsForVideo.bad.loss, i = t.currentRoundTripTime < this._networkLimitsForVideo.bad.rtt, a = this._videoMaxDimensionsForNet.good, o = Vr.L1T1, s = Yr.GOOD;
|
|
4833
|
+
if (r ? (this._lastBadConnection = Date.now(), i ? (s = Yr.BAD_1, a = this._videoMaxDimensionsForNet.bad, o = Vr.L1T2) : (s = Yr.BAD_2, a = this._videoMaxDimensionsForNet.worst, o = Vr.L1T3)) : n && (a = this._videoMaxDimensionsForNet.good, o = Vr.L1T1), !(a < this._lastVideoMaxDimension || Date.now() - this._lastBadConnection > fi) || this._lastVideoMaxDimension === a) return;
|
|
4853
4834
|
let c = this._serverSettings.camera;
|
|
4854
4835
|
if (!c || !await this._isSVCSupported(e, o)) return;
|
|
4855
4836
|
this._debug.debug("Switch outbound video frame size and scalabilityMode", {
|
|
@@ -4922,9 +4903,9 @@ var ei = class {
|
|
|
4922
4903
|
}, n(r)) : this._debug.error(`[${t}] data channel open failed, state [${e}]`);
|
|
4923
4904
|
};
|
|
4924
4905
|
}
|
|
4925
|
-
},
|
|
4906
|
+
}, mi = /* @__PURE__ */ function(e) {
|
|
4926
4907
|
return e.AUDIO_MIX = "audio-mix", e.PARTICIPANT_AGNOSTIC_TRACK_PREFIX = "pat", e.TRANSPARENT_AUDIO_TRACK_PREFIX = "ta", e;
|
|
4927
|
-
}({}),
|
|
4908
|
+
}({}), hi = 16, gi = class e {
|
|
4928
4909
|
constructor(e, t, n, r = z) {
|
|
4929
4910
|
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);
|
|
4930
4911
|
}
|
|
@@ -4938,7 +4919,7 @@ var ei = class {
|
|
|
4938
4919
|
ssrc: a,
|
|
4939
4920
|
timestamp: o,
|
|
4940
4921
|
duration: s,
|
|
4941
|
-
data: e.slice(
|
|
4922
|
+
data: e.slice(hi)
|
|
4942
4923
|
};
|
|
4943
4924
|
}
|
|
4944
4925
|
_onDataChannelMessage(t) {
|
|
@@ -4958,7 +4939,7 @@ var ei = class {
|
|
|
4958
4939
|
destroy() {
|
|
4959
4940
|
this._datachannel.onmessage = null;
|
|
4960
4941
|
}
|
|
4961
|
-
},
|
|
4942
|
+
}, _i, vi = class {
|
|
4962
4943
|
constructor() {
|
|
4963
4944
|
h(this, "_value", 1);
|
|
4964
4945
|
}
|
|
@@ -4969,10 +4950,10 @@ var ei = class {
|
|
|
4969
4950
|
this._value = e;
|
|
4970
4951
|
}
|
|
4971
4952
|
};
|
|
4972
|
-
|
|
4953
|
+
_i = vi, h(vi, "_instance", null), h(vi, "getInstance", () => (_i._instance || (_i._instance = new _i()), _i._instance));
|
|
4973
4954
|
//#endregion
|
|
4974
4955
|
//#region src/classes/ParticipantIdRegistry.ts
|
|
4975
|
-
var
|
|
4956
|
+
var yi = class {
|
|
4976
4957
|
constructor(e = z) {
|
|
4977
4958
|
h(this, "streamDescriptionByCompactId", /* @__PURE__ */ new Map()), h(this, "compactIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_debug", void 0), this._debug = e;
|
|
4978
4959
|
}
|
|
@@ -4988,7 +4969,7 @@ var bi = class {
|
|
|
4988
4969
|
case 1:
|
|
4989
4970
|
let e = s(r);
|
|
4990
4971
|
return Object.entries(e).forEach(([e, t]) => {
|
|
4991
|
-
let n =
|
|
4972
|
+
let n = Ln(e);
|
|
4992
4973
|
this.streamDescriptionByCompactId.set(t, n), this.compactIdByStreamDescription.set(e, t);
|
|
4993
4974
|
}), null;
|
|
4994
4975
|
case 2:
|
|
@@ -5088,7 +5069,7 @@ var bi = class {
|
|
|
5088
5069
|
this._debug.error("unexpected null sequenceNumber", e, r);
|
|
5089
5070
|
continue;
|
|
5090
5071
|
}
|
|
5091
|
-
let l =
|
|
5072
|
+
let l = mi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX + "-" + e, u = i ? i >>> 0 : null;
|
|
5092
5073
|
n.push({
|
|
5093
5074
|
participantStreamDescription: c,
|
|
5094
5075
|
streamId: l,
|
|
@@ -5104,9 +5085,9 @@ var bi = class {
|
|
|
5104
5085
|
participantUpdateInfos: n
|
|
5105
5086
|
};
|
|
5106
5087
|
}
|
|
5107
|
-
},
|
|
5088
|
+
}, bi = /* @__PURE__ */ function(e) {
|
|
5108
5089
|
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;
|
|
5109
|
-
}({}),
|
|
5090
|
+
}({}), xi = class {
|
|
5110
5091
|
constructor(e = z, t = null) {
|
|
5111
5092
|
h(this, "_worker", null), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = e, this._logger = t;
|
|
5112
5093
|
}
|
|
@@ -5122,7 +5103,7 @@ var bi = class {
|
|
|
5122
5103
|
return;
|
|
5123
5104
|
}
|
|
5124
5105
|
t({
|
|
5125
|
-
type:
|
|
5106
|
+
type: bi.FRAME,
|
|
5126
5107
|
error: e
|
|
5127
5108
|
});
|
|
5128
5109
|
};
|
|
@@ -5132,23 +5113,23 @@ var bi = class {
|
|
|
5132
5113
|
e.preventDefault?.(), m(this._formatWorkerMessageError(e));
|
|
5133
5114
|
}, f.onmessage = (e) => {
|
|
5134
5115
|
switch (e.data.type) {
|
|
5135
|
-
case
|
|
5116
|
+
case bi.READY:
|
|
5136
5117
|
s = !0, c || (c = !0, a());
|
|
5137
5118
|
break;
|
|
5138
|
-
case
|
|
5119
|
+
case bi.ERROR:
|
|
5139
5120
|
s ? m(e.data.error) : p(e.data.error);
|
|
5140
5121
|
break;
|
|
5141
|
-
case
|
|
5122
|
+
case bi.FRAME:
|
|
5142
5123
|
t(e.data);
|
|
5143
5124
|
break;
|
|
5144
|
-
case
|
|
5125
|
+
case bi.DEBUG:
|
|
5145
5126
|
this._debug.debug(e.data.message);
|
|
5146
5127
|
break;
|
|
5147
|
-
case
|
|
5128
|
+
case bi.LOG_ERROR:
|
|
5148
5129
|
this._logger?.log(x.ERROR, e.data.message);
|
|
5149
5130
|
break;
|
|
5150
5131
|
}
|
|
5151
|
-
}, this._sendToWorker(
|
|
5132
|
+
}, this._sendToWorker(bi.INIT, r, i);
|
|
5152
5133
|
});
|
|
5153
5134
|
}
|
|
5154
5135
|
_removeWorker() {
|
|
@@ -5171,7 +5152,7 @@ var bi = class {
|
|
|
5171
5152
|
static isBrowserSupported() {
|
|
5172
5153
|
throw Error("Not implemented");
|
|
5173
5154
|
}
|
|
5174
|
-
},
|
|
5155
|
+
}, Si = class extends xi {
|
|
5175
5156
|
constructor(e = z, t = null) {
|
|
5176
5157
|
super(e, t);
|
|
5177
5158
|
}
|
|
@@ -5181,7 +5162,7 @@ var bi = class {
|
|
|
5181
5162
|
}, [c, c.getUrl]);
|
|
5182
5163
|
}
|
|
5183
5164
|
decodeFrame(e, t, n, r) {
|
|
5184
|
-
this._sendToWorker(
|
|
5165
|
+
this._sendToWorker(bi.FRAME, {
|
|
5185
5166
|
timestamp: e,
|
|
5186
5167
|
data: t.buffer,
|
|
5187
5168
|
isVP9: n,
|
|
@@ -5195,7 +5176,7 @@ var bi = class {
|
|
|
5195
5176
|
static isBrowserSupported() {
|
|
5196
5177
|
return "WebAssembly" in window && "Worker" in window;
|
|
5197
5178
|
}
|
|
5198
|
-
},
|
|
5179
|
+
}, Ci = class extends xi {
|
|
5199
5180
|
constructor(e = z, t = null) {
|
|
5200
5181
|
super(e, t);
|
|
5201
5182
|
}
|
|
@@ -5205,7 +5186,7 @@ var bi = class {
|
|
|
5205
5186
|
}, [!0]);
|
|
5206
5187
|
}
|
|
5207
5188
|
decodeFrame(e, t, n, r = !1) {
|
|
5208
|
-
this._sendToWorker(
|
|
5189
|
+
this._sendToWorker(bi.FRAME, {
|
|
5209
5190
|
timestamp: e,
|
|
5210
5191
|
data: t.buffer,
|
|
5211
5192
|
isVP9: n,
|
|
@@ -5218,7 +5199,7 @@ var bi = class {
|
|
|
5218
5199
|
static isBrowserSupported() {
|
|
5219
5200
|
return "VideoDecoder" in window && "Worker" in window && "VideoFrame" in window && !C.isBrokenVP9Decoder() && C.browserName() !== "Firefox";
|
|
5220
5201
|
}
|
|
5221
|
-
},
|
|
5202
|
+
}, wi = class {
|
|
5222
5203
|
constructor(e = null, t = 0) {
|
|
5223
5204
|
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));
|
|
5224
5205
|
}
|
|
@@ -5232,7 +5213,7 @@ var bi = class {
|
|
|
5232
5213
|
destroy() {
|
|
5233
5214
|
window.clearInterval(this._interval), this._interval = 0;
|
|
5234
5215
|
}
|
|
5235
|
-
},
|
|
5216
|
+
}, Ti = class {
|
|
5236
5217
|
constructor(e, t) {
|
|
5237
5218
|
h(this, "_participantId", void 0), h(this, "_statAggregator", void 0), h(this, "_firstFrameReceived", !1), this._participantId = e, this._statAggregator = t;
|
|
5238
5219
|
}
|
|
@@ -5247,14 +5228,14 @@ var bi = class {
|
|
|
5247
5228
|
height: t
|
|
5248
5229
|
});
|
|
5249
5230
|
}
|
|
5250
|
-
},
|
|
5231
|
+
}, Ei = 65536, Di = "MARK_SCREENSHARE_FREEZE_DURATION", Oi = class e {
|
|
5251
5232
|
constructor(e, t, n, r, i, a = z) {
|
|
5252
|
-
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
|
|
5233
|
+
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 Ti(e, r), this._debug = a;
|
|
5253
5234
|
}
|
|
5254
5235
|
appendChunk(t) {
|
|
5255
5236
|
let n = this._chunks.length;
|
|
5256
5237
|
if (t.start) this._measureFreezeDuration(!1), this._measureFreezeDuration(!0), n && (this._debug.warn("[FrameBuilder] Cleanup buffer", Array.prototype.slice.call(this._chunks)), this._chunks = []);
|
|
5257
|
-
else if (!n || (this._chunks[n - 1].sequence + 1) %
|
|
5238
|
+
else if (!n || (this._chunks[n - 1].sequence + 1) % Ei !== t.sequence) {
|
|
5258
5239
|
this._debug.warn("[FrameBuilder] Got incorrect chunk");
|
|
5259
5240
|
return;
|
|
5260
5241
|
}
|
|
@@ -5271,7 +5252,7 @@ var bi = class {
|
|
|
5271
5252
|
}
|
|
5272
5253
|
}
|
|
5273
5254
|
destroy() {
|
|
5274
|
-
G.clearMark(
|
|
5255
|
+
G.clearMark(Di), G.clearMark(G.getMarkNameScreenshareFirstFrame(this._participantId)), this._chunks = [];
|
|
5275
5256
|
}
|
|
5276
5257
|
_processFrameData() {
|
|
5277
5258
|
let e = this._chunks;
|
|
@@ -5294,13 +5275,13 @@ var bi = class {
|
|
|
5294
5275
|
}
|
|
5295
5276
|
_measureFreezeDuration(e) {
|
|
5296
5277
|
if (e) {
|
|
5297
|
-
G.setMark(
|
|
5278
|
+
G.setMark(Di);
|
|
5298
5279
|
return;
|
|
5299
5280
|
}
|
|
5300
|
-
let t = G.measureMark(
|
|
5281
|
+
let t = G.measureMark(Di);
|
|
5301
5282
|
t !== null && t > 1e3 && this._onStat({ freeze_duration: t });
|
|
5302
5283
|
}
|
|
5303
|
-
},
|
|
5284
|
+
}, ki = class {
|
|
5304
5285
|
constructor(e) {
|
|
5305
5286
|
h(this, "_onStream", void 0), this._onStream = e;
|
|
5306
5287
|
}
|
|
@@ -5313,7 +5294,7 @@ var bi = class {
|
|
|
5313
5294
|
static isBrowserSupported() {
|
|
5314
5295
|
throw Error("Method `isBrowserSupported` is not implemented");
|
|
5315
5296
|
}
|
|
5316
|
-
},
|
|
5297
|
+
}, Ai = class extends ki {
|
|
5317
5298
|
constructor(e, t = z) {
|
|
5318
5299
|
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;
|
|
5319
5300
|
}
|
|
@@ -5373,7 +5354,7 @@ var bi = class {
|
|
|
5373
5354
|
static isBrowserSupported() {
|
|
5374
5355
|
return ("CanvasCaptureMediaStream" in window || "CanvasCaptureMediaStreamTrack" in window) && !(C.browserName() === "Safari" && Number(C.browserVersion()) === 15);
|
|
5375
5356
|
}
|
|
5376
|
-
},
|
|
5357
|
+
}, ji = class extends ki {
|
|
5377
5358
|
constructor(e, t = z) {
|
|
5378
5359
|
super(e), h(this, "_generator", void 0), h(this, "_writer", void 0), h(this, "_stream", void 0), h(this, "_debug", void 0), this._debug = t, this._debug.debug("TrackGeneratorRenderer started"), this._generator = new MediaStreamTrackGenerator({ kind: A.video }), this._writer = this._generator.writable.getWriter(), this._stream = new MediaStream([this._generator]), this._onStream(this._stream);
|
|
5379
5360
|
}
|
|
@@ -5384,9 +5365,9 @@ var bi = class {
|
|
|
5384
5365
|
this._writer.releaseLock(), this._generator.writable.close().then(() => this._generator.stop()), this._debug.debug("TrackGeneratorRenderer destroyed");
|
|
5385
5366
|
}
|
|
5386
5367
|
static isBrowserSupported() {
|
|
5387
|
-
return "VideoFrame" in window && "MediaStreamTrackGenerator" in window &&
|
|
5368
|
+
return "VideoFrame" in window && "MediaStreamTrackGenerator" in window && Ci.isBrowserSupported();
|
|
5388
5369
|
}
|
|
5389
|
-
},
|
|
5370
|
+
}, Mi = class extends Oi {
|
|
5390
5371
|
constructor(e, t, n, r, i, a = z, o = null) {
|
|
5391
5372
|
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();
|
|
5392
5373
|
}
|
|
@@ -5394,16 +5375,16 @@ var bi = class {
|
|
|
5394
5375
|
e.keyframe && (this._decoderQueue = []), this._decoderQueue.push(e), this._decodeQueue();
|
|
5395
5376
|
}
|
|
5396
5377
|
_initFpsMeter() {
|
|
5397
|
-
this._fpsMeter = new
|
|
5378
|
+
this._fpsMeter = new wi((e) => this._debug.log(`[StreamBuilder][${this._participantId}] fps: ${e}`), 2e4);
|
|
5398
5379
|
}
|
|
5399
5380
|
_initRenderer(e = !1) {
|
|
5400
|
-
e || !
|
|
5381
|
+
e || !ji.isBrowserSupported() ? this._renderer = new Ai(this._onStream, this._debug) : this._renderer = new ji(this._onStream, this._debug);
|
|
5401
5382
|
}
|
|
5402
5383
|
_initDecoder(e = !1) {
|
|
5403
|
-
e || !
|
|
5384
|
+
e || !Ci.isBrowserSupported() ? this._decoder = new Si(this._debug, this._logger) : this._decoder = new Ci(this._debug, this._logger), this._decoder.init(async (e) => {
|
|
5404
5385
|
this._decoderBusy = !1, "VideoFrame" in window && e instanceof VideoFrame ? await this._renderer.drawFrame(e) : await this._renderer.drawImage(e), this._fpsMeter.increment(), this._decodeQueue();
|
|
5405
5386
|
}, (e) => {
|
|
5406
|
-
if (this._decoderBusy = !1, this._decoder instanceof
|
|
5387
|
+
if (this._decoderBusy = !1, this._decoder instanceof Ci && typeof e == "string" && e.includes("EncodingError")) {
|
|
5407
5388
|
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();
|
|
5408
5389
|
return;
|
|
5409
5390
|
}
|
|
@@ -5411,7 +5392,7 @@ var bi = class {
|
|
|
5411
5392
|
}, this._onKeyFrameRequested).then(() => {
|
|
5412
5393
|
this._decoderReady = !0, this._decodeQueue();
|
|
5413
5394
|
}).catch((e) => {
|
|
5414
|
-
this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof
|
|
5395
|
+
this._debug.warn("StreamBuilder decoder init failed", e), this._decoder instanceof Ci && this._switchToLibVPXDecoder();
|
|
5415
5396
|
});
|
|
5416
5397
|
}
|
|
5417
5398
|
_switchToLibVPXDecoder() {
|
|
@@ -5426,20 +5407,20 @@ var bi = class {
|
|
|
5426
5407
|
super.destroy(), this._fpsMeter.destroy(), this._decoder.destroy(), this._renderer.destroy(), this._debug.debug(`StreamBuilder destroyed for participant ${this._participantId}`);
|
|
5427
5408
|
}
|
|
5428
5409
|
static isBrowserSupported() {
|
|
5429
|
-
return
|
|
5410
|
+
return Ai.isBrowserSupported() || ji.isBrowserSupported();
|
|
5430
5411
|
}
|
|
5431
|
-
},
|
|
5432
|
-
function
|
|
5412
|
+
}, Ni = 1, Pi = 1, Fi = 2, Ii = 0, Li = 1, Ri = 2, zi = 4, Bi = 8;
|
|
5413
|
+
function Vi(e, t, n, r, i, a, o) {
|
|
5433
5414
|
let s = 0;
|
|
5434
|
-
t && (s |=
|
|
5415
|
+
t && (s |= Li), n && (s |= Ri), r && (s |= zi), o || (s |= Bi);
|
|
5435
5416
|
let c = /* @__PURE__ */ new ArrayBuffer(11), l = new DataView(c);
|
|
5436
|
-
if (l.setUint8(0,
|
|
5417
|
+
if (l.setUint8(0, Ni), l.setUint16(1, i), l.setUint32(3, e), l.setUint8(7, +!!a), l.setUint16(8, Ii), l.setUint8(10, s), !o) return c;
|
|
5437
5418
|
let u = new Uint8Array(c.byteLength + o.byteLength);
|
|
5438
5419
|
return u.set(new Uint8Array(c), 0), u.set(new Uint8Array(o), c.byteLength), u.buffer;
|
|
5439
5420
|
}
|
|
5440
|
-
function
|
|
5441
|
-
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 &
|
|
5442
|
-
if (n !==
|
|
5421
|
+
function Hi(e) {
|
|
5422
|
+
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 & Li), l = !!(s & Ri), u = !!(s & zi), d = !!(s & Bi);
|
|
5423
|
+
if (n !== Ni) throw Error(`Unexpected protocol version. Got ${n}, expected ${Ni}`);
|
|
5443
5424
|
return {
|
|
5444
5425
|
timestamp: i,
|
|
5445
5426
|
start: c,
|
|
@@ -5452,26 +5433,26 @@ function Ui(e) {
|
|
|
5452
5433
|
data: e.slice(11)
|
|
5453
5434
|
};
|
|
5454
5435
|
}
|
|
5455
|
-
function
|
|
5436
|
+
function Ui(e) {
|
|
5456
5437
|
if (!e || !e.byteLength || e.byteLength !== 4) return !1;
|
|
5457
5438
|
let t = new DataView(e);
|
|
5458
|
-
return !(t.getUint8(0) !==
|
|
5439
|
+
return !(t.getUint8(0) !== Ni || t.getUint8(1) !== Pi || t.getUint16(2) !== Ii);
|
|
5459
5440
|
}
|
|
5460
|
-
function
|
|
5441
|
+
function Wi(e) {
|
|
5461
5442
|
if (!e || !e.byteLength || e.byteLength !== 10) return null;
|
|
5462
5443
|
let t = new DataView(e);
|
|
5463
|
-
return t.getUint8(0) !==
|
|
5444
|
+
return t.getUint8(0) !== Ni || t.getUint8(1) !== Fi || t.getUint16(2) !== Ii ? null : {
|
|
5464
5445
|
seq: t.getUint16(4),
|
|
5465
5446
|
ts2: t.getUint32(6)
|
|
5466
5447
|
};
|
|
5467
5448
|
}
|
|
5468
|
-
function
|
|
5449
|
+
function Gi(e) {
|
|
5469
5450
|
let t = /* @__PURE__ */ new ArrayBuffer(4), n = new DataView(t);
|
|
5470
|
-
return n.setUint8(0,
|
|
5451
|
+
return n.setUint8(0, Ni), n.setUint8(1, Pi), n.setUint16(2, e), t;
|
|
5471
5452
|
}
|
|
5472
5453
|
//#endregion
|
|
5473
5454
|
//#region src/classes/screenshare/WebmBuilder.ts
|
|
5474
|
-
var
|
|
5455
|
+
var Ki = 2 ** 15 - 1, qi = 1, Ji = 5, Yi = 5, Xi = class e {
|
|
5475
5456
|
constructor(e, t = z) {
|
|
5476
5457
|
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;
|
|
5477
5458
|
let n = () => {
|
|
@@ -5514,8 +5495,8 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5514
5495
|
this._mediaSource?.readyState === "open" && this._sourceBuffer?.abort();
|
|
5515
5496
|
let e = this._sourceBuffer?.buffered, t = e?.length;
|
|
5516
5497
|
if (!t) return;
|
|
5517
|
-
let n = e.start(0), r = Math.max(0, e.end(t - 1) -
|
|
5518
|
-
r - n >
|
|
5498
|
+
let n = e.start(0), r = Math.max(0, e.end(t - 1) - Ji);
|
|
5499
|
+
r - n > Yi && (this._clearBufferTill = r);
|
|
5519
5500
|
}
|
|
5520
5501
|
destroy() {
|
|
5521
5502
|
this._queue = [], this._mediaSource.readyState === "open" && (this._sourceBuffer?.abort(), this._mediaSource.endOfStream()), this._sourceBuffer = null, this._clearBufferTill = 0;
|
|
@@ -5529,7 +5510,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5529
5510
|
get buffered() {
|
|
5530
5511
|
return this._sourceBuffer?.buffered;
|
|
5531
5512
|
}
|
|
5532
|
-
},
|
|
5513
|
+
}, Zi = class e extends Oi {
|
|
5533
5514
|
constructor(e, t, n, r, i = z) {
|
|
5534
5515
|
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}]`);
|
|
5535
5516
|
}
|
|
@@ -5553,8 +5534,8 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5553
5534
|
u.element(u.ID.MuxingApp, u.string("vk-webm-builder")),
|
|
5554
5535
|
u.element(u.ID.WritingApp, u.string("vk-webm-builder"))
|
|
5555
5536
|
]), 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, [
|
|
5556
|
-
u.element(u.ID.TrackNumber, u.number(
|
|
5557
|
-
u.element(u.ID.TrackUID, u.number(
|
|
5537
|
+
u.element(u.ID.TrackNumber, u.number(qi)),
|
|
5538
|
+
u.element(u.ID.TrackUID, u.number(qi)),
|
|
5558
5539
|
u.element(u.ID.TrackType, u.number(1)),
|
|
5559
5540
|
u.element(u.ID.FlagLacing, u.number(0)),
|
|
5560
5541
|
u.element(u.ID.DefaultDuration, u.number(1e9)),
|
|
@@ -5567,7 +5548,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5567
5548
|
return u.unknownSizeElement(u.ID.Cluster, [u.element(u.ID.Timecode, u.number(Math.round(e)))]);
|
|
5568
5549
|
}
|
|
5569
5550
|
_createVideo(e) {
|
|
5570
|
-
this._mediaBuffer = new
|
|
5551
|
+
this._mediaBuffer = new Xi(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);
|
|
5571
5552
|
let t = () => {
|
|
5572
5553
|
if (this._video?.src) {
|
|
5573
5554
|
this._debug.warn(`[WebmBuilder] Video paused for participant [${this._participantId}], try to play again`);
|
|
@@ -5594,13 +5575,13 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5594
5575
|
this._mediaBuffer?.append(a);
|
|
5595
5576
|
}
|
|
5596
5577
|
let i = Math.round(r - this._clusterStartTime);
|
|
5597
|
-
if (i >
|
|
5578
|
+
if (i > Ki && (this._clusterStartTime = r, i = 0), i === 0) {
|
|
5598
5579
|
this._debug.debug(`[WebmBuilder] Cluster header for participant [${this._participantId}]`);
|
|
5599
5580
|
let t = e._genClusterHeader(this._clusterStartTime);
|
|
5600
5581
|
this._mediaBuffer?.append(t);
|
|
5601
5582
|
}
|
|
5602
5583
|
let a = u.element(u.ID.SimpleBlock, [
|
|
5603
|
-
u.vintEncodedNumber(
|
|
5584
|
+
u.vintEncodedNumber(qi),
|
|
5604
5585
|
u.bytes(e._intToU16BE(i)),
|
|
5605
5586
|
u.number(!!t.keyframe << 7),
|
|
5606
5587
|
u.bytes(t.frameData)
|
|
@@ -5613,12 +5594,12 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5613
5594
|
static isBrowserSupported() {
|
|
5614
5595
|
return "captureStream" in window.HTMLVideoElement?.prototype && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp8\"") && window.MediaSource?.isTypeSupported("video/webm; codecs=\"vp9\"");
|
|
5615
5596
|
}
|
|
5616
|
-
},
|
|
5597
|
+
}, Qi = class {
|
|
5617
5598
|
constructor(e, t, n, r, i, a = null, o = z, s = null) {
|
|
5618
5599
|
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);
|
|
5619
5600
|
}
|
|
5620
5601
|
_onDataChannelMessage(e) {
|
|
5621
|
-
let t =
|
|
5602
|
+
let t = Hi(e), n = this._participantIdRegistry?.getStreamDescription(t.ssrc)?.participantId;
|
|
5622
5603
|
if (!n) {
|
|
5623
5604
|
this._debug.warn(`Participant id for ssrc ${t.ssrc} not found in registry`);
|
|
5624
5605
|
return;
|
|
@@ -5630,7 +5611,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5630
5611
|
let r = this._streamBuilders[n];
|
|
5631
5612
|
if (!r) {
|
|
5632
5613
|
let e = (e) => this._onStream(n, e);
|
|
5633
|
-
r = N.screenShareWebmBuilder &&
|
|
5614
|
+
r = N.screenShareWebmBuilder && Zi.isBrowserSupported() ? new Zi(n, e, this._onStat, this._statAggregator, this._debug) : new Mi(n, e, this._onStat, this._statAggregator, () => {
|
|
5634
5615
|
this._requestKeyFrame(t.ssrc);
|
|
5635
5616
|
}, this._debug, this._logger), this._streamBuilders[n] = r;
|
|
5636
5617
|
}
|
|
@@ -5638,7 +5619,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5638
5619
|
}
|
|
5639
5620
|
_requestKeyFrame(e) {
|
|
5640
5621
|
if (!(!this._datachannel || this._datachannel.readyState !== "open")) try {
|
|
5641
|
-
let t =
|
|
5622
|
+
let t = Gi(e);
|
|
5642
5623
|
this._datachannel.send(t), this._debug.debug(`ScreenCaptureReceiver request for keyframe for ssrc ${e}`);
|
|
5643
5624
|
} catch (e) {
|
|
5644
5625
|
this._debug.warn("Failed to send keyframe request", e);
|
|
@@ -5651,7 +5632,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5651
5632
|
destroy() {
|
|
5652
5633
|
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");
|
|
5653
5634
|
}
|
|
5654
|
-
},
|
|
5635
|
+
}, $i = class {
|
|
5655
5636
|
constructor(e, t, n) {
|
|
5656
5637
|
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;
|
|
5657
5638
|
}
|
|
@@ -5670,7 +5651,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5670
5651
|
get data() {
|
|
5671
5652
|
return this._data;
|
|
5672
5653
|
}
|
|
5673
|
-
},
|
|
5654
|
+
}, ea = class {
|
|
5674
5655
|
constructor() {
|
|
5675
5656
|
h(this, "_head", null), h(this, "_tail", null), h(this, "_length", 0);
|
|
5676
5657
|
}
|
|
@@ -5678,7 +5659,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5678
5659
|
return this._length;
|
|
5679
5660
|
}
|
|
5680
5661
|
push(...e) {
|
|
5681
|
-
for (let t of e) this._tail = new
|
|
5662
|
+
for (let t of e) this._tail = new $i(t, this._tail, null), this._head || (this._head = this._tail), this._length++;
|
|
5682
5663
|
}
|
|
5683
5664
|
merge(e) {
|
|
5684
5665
|
this._tail && (this._tail.next = e._head), this._head || (this._head = e._head), this._tail = e._tail, this._length += e._length, e.clear();
|
|
@@ -5708,7 +5689,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5708
5689
|
for (; t !== null;) e.push(t.data), t = t.next;
|
|
5709
5690
|
return e.length ? JSON.stringify(e, (e, t) => t instanceof Error ? String(t) : t) : "";
|
|
5710
5691
|
}
|
|
5711
|
-
},
|
|
5692
|
+
}, ta = 1e3, na = class extends xi {
|
|
5712
5693
|
constructor(e, t, n, r, i = z, a = null) {
|
|
5713
5694
|
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);
|
|
5714
5695
|
}
|
|
@@ -5777,7 +5758,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5777
5758
|
}
|
|
5778
5759
|
_encode(e, t) {
|
|
5779
5760
|
let n = e.data.buffer;
|
|
5780
|
-
this._sendToWorker(
|
|
5761
|
+
this._sendToWorker(bi.FRAME, {
|
|
5781
5762
|
width: e.width,
|
|
5782
5763
|
height: e.height,
|
|
5783
5764
|
imageData: n,
|
|
@@ -5794,7 +5775,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5794
5775
|
let t = this._drawFrameData(this._lastFrame);
|
|
5795
5776
|
this._encode(t, e);
|
|
5796
5777
|
} else this._onFrame(null);
|
|
5797
|
-
},
|
|
5778
|
+
}, ta), this._getFrameBitmap().then((t) => {
|
|
5798
5779
|
window.clearTimeout(this._frameReadTimeout), this._lastFrame?.close(), this._lastFrame = t;
|
|
5799
5780
|
let n = this._drawFrameData(t);
|
|
5800
5781
|
this._encode(n, e);
|
|
@@ -5804,7 +5785,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5804
5785
|
this._useImageCapture ? this._requestFrameBitmap(e) : this._requestFrameVideo(e);
|
|
5805
5786
|
}
|
|
5806
5787
|
setBitrate(e, t, n) {
|
|
5807
|
-
this._sendToWorker(
|
|
5788
|
+
this._sendToWorker(bi.SET_BITRATE, {
|
|
5808
5789
|
bitrate: e,
|
|
5809
5790
|
useCbr: t
|
|
5810
5791
|
});
|
|
@@ -5815,7 +5796,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5815
5796
|
destroy() {
|
|
5816
5797
|
this._removeWorker(), this._removeStream(), this._removeDom(), this._debug.debug("LibVPxEncoder destroyed");
|
|
5817
5798
|
}
|
|
5818
|
-
},
|
|
5799
|
+
}, ra = class extends xi {
|
|
5819
5800
|
constructor(e, t, n, r, i, a, o = z, s = null) {
|
|
5820
5801
|
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 });
|
|
5821
5802
|
}
|
|
@@ -5843,10 +5824,10 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5843
5824
|
}, [n]);
|
|
5844
5825
|
}
|
|
5845
5826
|
requestFrame(e = !1) {
|
|
5846
|
-
this._sendToWorker(
|
|
5827
|
+
this._sendToWorker(bi.FRAME, { keyFrame: e });
|
|
5847
5828
|
}
|
|
5848
5829
|
setBitrate(e, t, n) {
|
|
5849
|
-
this._sendToWorker(
|
|
5830
|
+
this._sendToWorker(bi.SET_BITRATE, {
|
|
5850
5831
|
bitrate: e,
|
|
5851
5832
|
useCbr: t,
|
|
5852
5833
|
fps: n
|
|
@@ -5861,11 +5842,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5861
5842
|
static isBrowserSupported() {
|
|
5862
5843
|
return "VideoEncoder" in window && "Worker" in window && "EncodedVideoChunk" in window && "MediaStreamTrackProcessor" in window;
|
|
5863
5844
|
}
|
|
5864
|
-
},
|
|
5845
|
+
}, ia = 2100, aa = 600, oa = 1.2, sa = .8, ca = 2e3, la = 8e3, ua = 8e3, da = 16e3, fa = 4, pa = 2e3, ma = /* @__PURE__ */ function(e) {
|
|
5865
5846
|
return e[e.NONE = 0] = "NONE", e[e.UP = 1] = "UP", e[e.DOWN = 2] = "DOWN", e;
|
|
5866
|
-
}(
|
|
5847
|
+
}(ma || {}), ha = class {
|
|
5867
5848
|
constructor(e, t, n, r, i, a, o, s = z) {
|
|
5868
|
-
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 =
|
|
5849
|
+
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 = ia, i && (this._highDelayThreshold = aa), this._trendDelayThreshold = Math.round(this._highDelayThreshold / 3), this._targetBitrate = this._maxBitrate, this._probing = !1;
|
|
5869
5850
|
let c = Date.now();
|
|
5870
5851
|
this._lastDown = 0, this._lastUp = c, this._lastProbing = c, this._lastCheckDelay = 0, this._lastFpsCalcMs = 0;
|
|
5871
5852
|
}
|
|
@@ -5875,27 +5856,27 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5875
5856
|
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;
|
|
5876
5857
|
s || c ? i = 2 : Math.abs(a) < 40 && o < 10 && !c && (i = 1);
|
|
5877
5858
|
let l = Math.round(this._targetBitrate / 1e3), u = n;
|
|
5878
|
-
e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5859
|
+
e % 20 == 0 && this._debug.debug(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ma[i]} tr=${l} br=${n}`);
|
|
5879
5860
|
let d = r - this._lastDown;
|
|
5880
|
-
if (i === 2 && d >
|
|
5881
|
-
this._probing && (this._upPenalty = Math.min(++this._upPenalty,
|
|
5882
|
-
let n =
|
|
5883
|
-
if (n >= this._targetBitrate && (n = this._targetBitrate *
|
|
5884
|
-
let r = Math.round(n / 1e3), s = Math.round(this._upPenalty *
|
|
5885
|
-
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5861
|
+
if (i === 2 && d > ca) {
|
|
5862
|
+
this._probing && (this._upPenalty = Math.min(++this._upPenalty, fa), this._probing = !1);
|
|
5863
|
+
let n = sa * u * 1e3;
|
|
5864
|
+
if (n >= this._targetBitrate && (n = this._targetBitrate * sa), n = Math.max(n, this._minBitrate), n < this._targetBitrate) {
|
|
5865
|
+
let r = Math.round(n / 1e3), s = Math.round(this._upPenalty * ua / 1e3);
|
|
5866
|
+
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ma[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;
|
|
5886
5867
|
}
|
|
5887
5868
|
this._lastDown = r;
|
|
5888
5869
|
}
|
|
5889
|
-
let f = r - this._lastUp, p =
|
|
5870
|
+
let f = r - this._lastUp, p = la + this._upPenalty * ua;
|
|
5890
5871
|
if (i === 1 && f > p && d > p) {
|
|
5891
|
-
let n = Math.min(this._targetBitrate *
|
|
5872
|
+
let n = Math.min(this._targetBitrate * oa, this._maxBitrate);
|
|
5892
5873
|
if (n > this._targetBitrate) {
|
|
5893
|
-
let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty *
|
|
5894
|
-
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${
|
|
5874
|
+
let s = Math.round(n / 1e3), c = Math.round(this._targetBitrate / 1e3), l = Math.round(this._upPenalty * ua / 1e3);
|
|
5875
|
+
this._debug.log(`#${e}: cc: delay=${t} short=${this._delayAvgShort} long=${this._delayAvgLong} delta=${a} percent=${o} -> ${ma[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;
|
|
5895
5876
|
}
|
|
5896
5877
|
}
|
|
5897
5878
|
let m = r - this._lastProbing;
|
|
5898
|
-
this._probing && m >
|
|
5879
|
+
this._probing && m > da && (this._probing = !1);
|
|
5899
5880
|
let ee = r - this._lastDown;
|
|
5900
5881
|
this._upPenalty > 0 && ee > 3 * p && (this._debug.log(`#${e}: cc: UP reset penalty: oldPenalty=${this._upPenalty}`), this._upPenalty = 0);
|
|
5901
5882
|
}
|
|
@@ -5906,7 +5887,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5906
5887
|
}
|
|
5907
5888
|
_calcDelay(e, t) {
|
|
5908
5889
|
if (!(e <= 0)) {
|
|
5909
|
-
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 >
|
|
5890
|
+
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 > pa) {
|
|
5910
5891
|
let e = t - this._lastCheckDelay;
|
|
5911
5892
|
this._largeDelayDuration += e;
|
|
5912
5893
|
}
|
|
@@ -5935,7 +5916,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
5935
5916
|
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}`);
|
|
5936
5917
|
}
|
|
5937
5918
|
}
|
|
5938
|
-
},
|
|
5919
|
+
}, ga = class {
|
|
5939
5920
|
constructor(e) {
|
|
5940
5921
|
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);
|
|
5941
5922
|
}
|
|
@@ -6009,11 +5990,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6009
5990
|
clear() {
|
|
6010
5991
|
this._buffer.fill(void 0), this._size = 0, this._head = 0, this._tail = 0;
|
|
6011
5992
|
}
|
|
6012
|
-
},
|
|
5993
|
+
}, _a = 65536, va = 50, ya = 400, ba = 1e6, xa = 3e5, Sa = 3e4, Ca = 2e3, wa = 5, Ta = 0, Ea = class {
|
|
6013
5994
|
constructor(e, t, n, r, i = z, a = null) {
|
|
6014
|
-
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
|
|
5995
|
+
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 ga(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 ea()), h(this, "_fpsMeter", void 0), h(this, "_maxFrameDelay", void 0), h(this, "_debug", void 0), h(this, "_logger", void 0), this._debug = i, this._logger = a, this._debug.debug("ScreenCaptureSender started"), this.DATA_SIZE = N.consumerScreenDataChannelPacketSize - 11, this._datachannel = t, this._signaling = n, this._fastSharing = r, this._congestionControlEnabled = N.screenShareCongestionControl || this._fastSharing, this._width = e.getSettings().width, this._height = e.getSettings().height, this._maxFrameDelay = this._fastSharing ? N.screenShareCongestionControlThreshold : N.screenShareCongestionControlThreshold * 2;
|
|
6015
5996
|
let o = N.getScreenFrameRate(this._fastSharing), { minBitrate: s, maxBitrate: c } = this._calcMinMaxBitrate(this._width, this._height), l = this._onCongestionCallback.bind(this);
|
|
6016
|
-
this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${N.screenShareCongestionControlThreshold}`), this._congestionControl = new
|
|
5997
|
+
this._debug.log(`ScreenCaptureSender: CongestionControl: enabled=${this._congestionControlEnabled} minBitrate=${Math.round(s / 1e3)}k maxBitrate=${Math.round(c / 1e3)}k delayThreshold=${N.screenShareCongestionControlThreshold}`), this._congestionControl = new ha(l, s, c, this._congestionControlEnabled, this._fastSharing, N.screenShareCongestionControlThreshold, o, this._debug);
|
|
6017
5998
|
let u = (e, t) => {
|
|
6018
5999
|
if (this._destroyed) return;
|
|
6019
6000
|
if (!e) {
|
|
@@ -6024,23 +6005,23 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6024
6005
|
let n = this._sliceFrame(e);
|
|
6025
6006
|
this._queue.merge(n), this._handleQueue(), this._sendSharingStat();
|
|
6026
6007
|
};
|
|
6027
|
-
if (
|
|
6008
|
+
if (ra.isBrowserSupported()) {
|
|
6028
6009
|
let t = this._fastSharing;
|
|
6029
|
-
this._encoder = new
|
|
6030
|
-
} else this._encoder = new
|
|
6010
|
+
this._encoder = new ra(e, u, this._congestionControlEnabled, c, t, o, this._debug, this._logger);
|
|
6011
|
+
} else this._encoder = new na(e, u, this._congestionControlEnabled, c, this._debug, this._logger);
|
|
6031
6012
|
this._datachannel.onmessage = (e) => {
|
|
6032
|
-
|
|
6033
|
-
let t =
|
|
6013
|
+
Ui(e.data) && (this._debug.debug(`[${this._datachannel.label}] Requested keyframe`), this._needKeyframe = !0);
|
|
6014
|
+
let t = Wi(e.data);
|
|
6034
6015
|
t !== null && this._checkCcFeedback(t);
|
|
6035
|
-
}, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new
|
|
6016
|
+
}, this._encoder.init().then(() => this._handleQueue()).catch((e) => this._debug.warn("ScreenCaptureSender init failed", e)), this._fpsMeter = new wi((e) => this._debug.log(`[ScreenCaptureSender] fps: ${e}`), 5e3);
|
|
6036
6017
|
}
|
|
6037
6018
|
_handleQueue() {
|
|
6038
6019
|
if (this._destroyed) return;
|
|
6039
6020
|
let e = this._queue.shift();
|
|
6040
6021
|
if (!e) {
|
|
6041
|
-
if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq +
|
|
6022
|
+
if ((this._lastSentFrameSeq - this._lastDeliveredFrameSeq + _a) % _a > wa && this._lastFrameDelay > this._maxFrameDelay) {
|
|
6042
6023
|
let e = Date.now();
|
|
6043
|
-
e - this._lastFramerateReduced >
|
|
6024
|
+
e - this._lastFramerateReduced > Ca && (this._lastFramerateReduced = e, this._debug.debug(`[ScreenCaptureSender] reduce framerate: delay=${this._lastFrameDelay} maxDelay=${this._maxFrameDelay}`));
|
|
6044
6025
|
} else this._requestFrame();
|
|
6045
6026
|
return;
|
|
6046
6027
|
}
|
|
@@ -6066,7 +6047,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6066
6047
|
this._destroyed || (this._encoder.requestFrame(this._needKeyframe), this._needKeyframe = !1);
|
|
6067
6048
|
}
|
|
6068
6049
|
_sliceFrame(e) {
|
|
6069
|
-
let t = e.type === "key", n = e.data.byteLength, r = new
|
|
6050
|
+
let t = e.type === "key", n = e.data.byteLength, r = new ea();
|
|
6070
6051
|
for (let i = 0; i < n; i += this.DATA_SIZE) {
|
|
6071
6052
|
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);
|
|
6072
6053
|
r.push({
|
|
@@ -6082,11 +6063,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6082
6063
|
return r;
|
|
6083
6064
|
}
|
|
6084
6065
|
_wrapHeader(e, t, n, r, i) {
|
|
6085
|
-
let a =
|
|
6086
|
-
sequence:
|
|
6066
|
+
let a = Vi(e, t, n, r, Ta, this._encoder.isVP9(), i), o = {
|
|
6067
|
+
sequence: Ta,
|
|
6087
6068
|
data: a
|
|
6088
6069
|
};
|
|
6089
|
-
return
|
|
6070
|
+
return Ta = (Ta + 1) % _a, o;
|
|
6090
6071
|
}
|
|
6091
6072
|
_stopPacket() {
|
|
6092
6073
|
return this._wrapHeader(Date.now(), !1, !1, !1, null).data;
|
|
@@ -6103,7 +6084,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6103
6084
|
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");
|
|
6104
6085
|
}
|
|
6105
6086
|
static isBrowserSupported() {
|
|
6106
|
-
return
|
|
6087
|
+
return ra.isBrowserSupported() || na.isBrowserSupported();
|
|
6107
6088
|
}
|
|
6108
6089
|
_onCongestionCallback(e, t, n) {
|
|
6109
6090
|
this._encoder.setBitrate(e, t, n);
|
|
@@ -6116,8 +6097,8 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6116
6097
|
(e === void 0 || e < 640) && (e = 640), (t === void 0 || t < 360) && (t = 360);
|
|
6117
6098
|
let n = e * t / 256;
|
|
6118
6099
|
return {
|
|
6119
|
-
minBitrate: Math.max(
|
|
6120
|
-
maxBitrate: Math.round(n *
|
|
6100
|
+
minBitrate: Math.max(xa, Math.min(ba, Math.round(n * va))),
|
|
6101
|
+
maxBitrate: Math.round(n * ya)
|
|
6121
6102
|
};
|
|
6122
6103
|
}
|
|
6123
6104
|
_checkCcFeedback(e) {
|
|
@@ -6131,14 +6112,14 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6131
6112
|
}
|
|
6132
6113
|
_sendSharingStat() {
|
|
6133
6114
|
let e = Date.now();
|
|
6134
|
-
if (e - this._lastSharingStat >
|
|
6115
|
+
if (e - this._lastSharingStat > Sa) {
|
|
6135
6116
|
let t = this._congestionControl.getStat();
|
|
6136
6117
|
t !== null && (this._debug.debug(`cc: send stats: ${JSON.stringify(t)}`), this._signaling.reportSharingStat(t).catch((e) => {
|
|
6137
6118
|
!(e instanceof kn) && !(e instanceof An) && this._debug.warn("Unable to send sharing stats", e);
|
|
6138
6119
|
})), this._lastSharingStat = e;
|
|
6139
6120
|
}
|
|
6140
6121
|
}
|
|
6141
|
-
},
|
|
6122
|
+
}, Da = class {
|
|
6142
6123
|
constructor(e, t, n, r = z, i = null) {
|
|
6143
6124
|
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;
|
|
6144
6125
|
}
|
|
@@ -6270,9 +6251,9 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6270
6251
|
if (!(e instanceof An)) throw e;
|
|
6271
6252
|
}
|
|
6272
6253
|
}
|
|
6273
|
-
},
|
|
6254
|
+
}, Oa = 90, ka = 4294967295, Aa = class e extends ei {
|
|
6274
6255
|
constructor(e, t, n, r = z, i = null, a = null, o = null, s = null) {
|
|
6275
|
-
super(e, t, s), h(this, "_producerNotification", null), h(this, "_producerCommand", null), h(this, "_producerScreen", null), h(this, "_consumerScreen", null), h(this, "_asr", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_isOpen", !1), h(this, "_observer", !1), h(this, "_reconnectionPrevented", !1), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_monitorRtpShareInterval", null), h(this, "_statBytes", {}), h(this, "_ssrcMap", {}), h(this, "_ssrcMapUpdated", !1), h(this, "_perfStatReporter", void 0), h(this, "_producerOfferIsProcessing", !1), h(this, "_producerNextOffer", null), h(this, "_producerNextSessionId", null), h(this, "_lastStat", null), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_prevConsumerFastSharingSettings", {}), h(this, "_asrTrack", null), h(this, "_captureSender", null), h(this, "_captureReceiver", null), h(this, "_participantIdRegistry", null), h(this, "_disabledSenders", /* @__PURE__ */ new Set()), h(this, "_rtpReceiversByStreamId", {}), h(this, "_producerSessionId", ""), h(this, "_newAudioShareTrack", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_simulcast", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._sdpStats = new
|
|
6256
|
+
super(e, t, s), h(this, "_producerNotification", null), h(this, "_producerCommand", null), h(this, "_producerScreen", null), h(this, "_consumerScreen", null), h(this, "_asr", null), h(this, "_animojiDataChannel", null), h(this, "_animojiReceiver", null), h(this, "_animojiSender", null), h(this, "_isOpen", !1), h(this, "_observer", !1), h(this, "_reconnectionPrevented", !1), h(this, "_statInterval", null), h(this, "_settingsInterval", null), h(this, "_monitorRtpShareInterval", null), h(this, "_statBytes", {}), h(this, "_ssrcMap", {}), h(this, "_ssrcMapUpdated", !1), h(this, "_perfStatReporter", void 0), h(this, "_producerOfferIsProcessing", !1), h(this, "_producerNextOffer", null), h(this, "_producerNextSessionId", null), h(this, "_lastStat", null), h(this, "_serverSettings", void 0), h(this, "_prevConsumerSettings", {}), h(this, "_prevConsumerFastSharingSettings", {}), h(this, "_asrTrack", null), h(this, "_captureSender", null), h(this, "_captureReceiver", null), h(this, "_participantIdRegistry", null), h(this, "_disabledSenders", /* @__PURE__ */ new Set()), h(this, "_rtpReceiversByStreamId", {}), h(this, "_producerSessionId", ""), h(this, "_newAudioShareTrack", null), h(this, "_debug", void 0), h(this, "_logger", void 0), h(this, "_statAggregator", void 0), h(this, "_sdpStats", void 0), h(this, "_peerConnectionStats", void 0), h(this, "_codecStatsAggregator", void 0), h(this, "_simulcast", void 0), this._debug = r, this._logger = i, this._statAggregator = a, this._sdpStats = new jr(a), this._peerConnectionStats = new qr(a), this._codecStatsAggregator = o, this._serverSettings = n, this._simulcast = new Da(e, t, () => this._serverSettings.camera, r, i), this.subscribe(this._signaling, Cr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.TRACK_REPLACED, this._onReplacedTrack.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._onSourcesChanged.bind(this)), this.subscribe(this._mediaSource, Xt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._createPerfStatsReporter(), this._debug.debug("ServerTransport: Created");
|
|
6276
6257
|
}
|
|
6277
6258
|
updateStatisticsInterval() {
|
|
6278
6259
|
this._stopStatInterval();
|
|
@@ -6299,7 +6280,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6299
6280
|
this._reconnectionPrevented = !1;
|
|
6300
6281
|
}
|
|
6301
6282
|
updateSettings(e) {
|
|
6302
|
-
|
|
6283
|
+
Hr(e, this._serverSettings) || (this._serverSettings = e, this._applyConsumerSettings());
|
|
6303
6284
|
}
|
|
6304
6285
|
setAnimojiTransport(e, t) {
|
|
6305
6286
|
if (N.vmoji && (this._animojiReceiver = e, this._animojiSender = t, this._participantIdRegistry && e.setParticipantIdRegistry(this._participantIdRegistry), this._animojiDataChannel)) {
|
|
@@ -6340,17 +6321,17 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6340
6321
|
}
|
|
6341
6322
|
this._pc.ontrack = this._onAddTrack.bind(this, this._pc), this._pc.onconnectionstatechange = M.debounce((e) => {
|
|
6342
6323
|
this._pc && this._onConnectionStateChange(this._pc, e);
|
|
6343
|
-
}, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._sdpStats.observe(this._pc), this._peerConnectionStats.observe(this._pc), this._participantIdRegistry = new
|
|
6324
|
+
}, 500), this._pc.onsignalingstatechange = this._onSignalingStateChange.bind(this, this._pc), this._sdpStats.observe(this._pc), this._peerConnectionStats.observe(this._pc), this._participantIdRegistry = new yi(this._debug), this._signaling.setParticipantIdRegistry(this._participantIdRegistry), this._createDataChannel(this._pc, Lr.producerNotification, (e) => {
|
|
6344
6325
|
this._producerNotification = e, this._producerNotification.binaryType = "arraybuffer", this._signaling.setProducerNotificationDataChannel(e);
|
|
6345
|
-
}), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc,
|
|
6326
|
+
}), this._signaling.useCommandDataChannel(!0), this._createDataChannel(this._pc, Lr.producerCommand, (e) => {
|
|
6346
6327
|
this._producerCommand = e, this._signaling.setProducerCommandDataChannel(e);
|
|
6347
|
-
}), this._createDataChannel(this._pc,
|
|
6328
|
+
}), this._createDataChannel(this._pc, Lr.producerScreenShare, (e) => {
|
|
6348
6329
|
this._producerScreen = e, this._producerScreen.binaryType = "arraybuffer", this._createCaptureReceiver();
|
|
6349
|
-
}), N.asrDataChannel && this._createDataChannel(this._pc,
|
|
6350
|
-
this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new
|
|
6330
|
+
}), N.asrDataChannel && this._createDataChannel(this._pc, Lr.asr, (e) => {
|
|
6331
|
+
this._asr = e, this._asr.binaryType = "arraybuffer", this._removeAsrTrack(), this._asrTrack = new gi(e, this._participantIdRegistry, (e) => {
|
|
6351
6332
|
this._onAsrTranscription(e);
|
|
6352
6333
|
}, this._debug);
|
|
6353
|
-
}), N.vmoji && this._createDataChannel(this._pc,
|
|
6334
|
+
}), N.vmoji && this._createDataChannel(this._pc, Lr.animoji, (e) => {
|
|
6354
6335
|
this._animojiDataChannel = e, this._animojiDataChannel.binaryType = "arraybuffer", this._animojiReceiver?.setDataChannel(e), this._animojiReceiver?.setParticipantIdRegistry(this._participantIdRegistry), this._animojiSender?.setDataChannel(e), this._animojiSender?.setProtocolVersion(N.vmojiOptions.protocolVersion || 1);
|
|
6355
6336
|
}), this._newAudioShareTrack = this._mediaSource.getAudioShareTrack();
|
|
6356
6337
|
try {
|
|
@@ -6359,7 +6340,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6359
6340
|
this._debug.error("ServerTransport: Unable to add media source tracks", e), this._logger?.log(x.ERROR, "addTrack-single"), this.close(e);
|
|
6360
6341
|
return;
|
|
6361
6342
|
}
|
|
6362
|
-
this._startFirstMediaSentProbe(), this._createDataChannel(this._pc,
|
|
6343
|
+
this._startFirstMediaSentProbe(), this._createDataChannel(this._pc, Lr.consumerScreenShare, (e) => {
|
|
6363
6344
|
this._consumerScreen = e, this._consumerScreen.binaryType = "arraybuffer";
|
|
6364
6345
|
let t = this._mediaSource.getScreenTrack();
|
|
6365
6346
|
t && (!N.consumerFastScreenShare || !this._mediaSource.mediaSettings.isFastScreenSharingEnabled) && this._createCaptureSender(t);
|
|
@@ -6385,19 +6366,19 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6385
6366
|
}
|
|
6386
6367
|
_updateSSRCMap(e) {
|
|
6387
6368
|
e && (this._ssrcMap = {}, this._ssrcMapUpdated = !0, mn(e.sdp).forEach((e) => {
|
|
6388
|
-
let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${
|
|
6369
|
+
let t = `a=ssrc:([0-9]+) label:(audio|video)-((?:[ug]?[\\d]+)|(?:mix)|(?:${mi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX}-[0-9]+)|(?:${mi.TRANSPARENT_AUDIO_TRACK_PREFIX}-[0-9]+))`, n = new RegExp(t).exec(e);
|
|
6389
6370
|
n && (this._ssrcMap[n[1]] = n[3]);
|
|
6390
6371
|
}));
|
|
6391
6372
|
}
|
|
6392
6373
|
_createCaptureSender(e) {
|
|
6393
6374
|
let t = this._mediaSource.mediaSettings;
|
|
6394
|
-
!e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new
|
|
6375
|
+
!e || !this._consumerScreen || !t.isScreenSharingEnabled || (this._captureSender && this._removeCaptureSender(), this._captureSender = new Ea(e, this._consumerScreen, this._signaling, t.isFastScreenSharingEnabled, this._debug, this._logger));
|
|
6395
6376
|
}
|
|
6396
6377
|
_removeCaptureSender() {
|
|
6397
6378
|
this._captureSender?.destroy(), this._captureSender = null;
|
|
6398
6379
|
}
|
|
6399
6380
|
_createCaptureReceiver() {
|
|
6400
|
-
this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new
|
|
6381
|
+
this._producerScreen && (this._captureReceiver && this._removeCaptureReceiver(), this._captureReceiver = new Qi(this._producerScreen, this._participantIdRegistry, (e, t) => {
|
|
6401
6382
|
this._triggerEvent(Y.REMOTE_STREAM_SECOND, e, t);
|
|
6402
6383
|
}, (e) => {
|
|
6403
6384
|
this._triggerEvent(Y.REMOTE_STREAM_SECOND, e, null);
|
|
@@ -6514,7 +6495,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6514
6495
|
_detectStaleTracks(e) {
|
|
6515
6496
|
let t = e.rtps.find((e) => e.type === "inbound-rtp" && e.kind === "audio" && this._ssrcMap[e.ssrc] === "mix");
|
|
6516
6497
|
if (!t) return;
|
|
6517
|
-
let n =
|
|
6498
|
+
let n = mi.AUDIO_MIX, r = this._statBytes[n], i = !1;
|
|
6518
6499
|
if (r) {
|
|
6519
6500
|
let e = t.bytesReceived - r.bytesReceived;
|
|
6520
6501
|
e >= 0 && e <= 5 && (i = !0), r.stalled !== i && this._triggerEvent(Y.AUDIO_MIX_STALL, i);
|
|
@@ -6702,11 +6683,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6702
6683
|
if (!r || !r.length) return this._debug.log(`Cannot get stream waiting time, ${e} receiver has no synchronization sources`), 0;
|
|
6703
6684
|
let i = r[0].rtpTimestamp;
|
|
6704
6685
|
if (!Number.isInteger(i)) return this._logger?.log(x.PAT_WAITING_TIME_ERROR, "timestampNotInteger"), this._debug.error(`Cannot get stream waiting time, ${e} receiver's RTP timestamp is not an integer: ${i}`), 0;
|
|
6705
|
-
let a = t - i &
|
|
6686
|
+
let a = t - i & ka, o = Math.ceil(a / Oa);
|
|
6706
6687
|
return Math.min(100, Math.max(0, o));
|
|
6707
6688
|
}
|
|
6708
6689
|
async _monitorRtpShare() {
|
|
6709
|
-
let e =
|
|
6690
|
+
let e = vi.getInstance().value;
|
|
6710
6691
|
if (!this._mediaSource.mediaSettings.isFastScreenSharingEnabled || !N.consumerFastScreenShare || e < .6) return;
|
|
6711
6692
|
let t = this._pc?.getSenders().find((e) => e.track?.kind === A.video && e.track?.contentHint === "motion");
|
|
6712
6693
|
t && (await t.getStats()).forEach((e) => {
|
|
@@ -6735,13 +6716,71 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6735
6716
|
_stopMonitorRtpShareInterval() {
|
|
6736
6717
|
this._monitorRtpShareInterval && (window.clearTimeout(this._monitorRtpShareInterval), this._monitorRtpShareInterval = null);
|
|
6737
6718
|
}
|
|
6719
|
+
}, ja = class {
|
|
6720
|
+
constructor(e, t = z, n = null) {
|
|
6721
|
+
h(this, "_topology", void 0), h(this, "_participantsCount", 0), h(this, "_taTrackIds", /* @__PURE__ */ new Set()), h(this, "_sendTrack", null), h(this, "_controller", null), h(this, "_enabled", !1), h(this, "_updateTimer", null), h(this, "_initFailed", !1), h(this, "_destroyed", !1), h(this, "_debug", void 0), h(this, "_mlStats", void 0), this._topology = e, this._debug = t, this._mlStats = n;
|
|
6722
|
+
}
|
|
6723
|
+
setTopology(e) {
|
|
6724
|
+
this._topology = e, this._update();
|
|
6725
|
+
}
|
|
6726
|
+
setParticipantsCount(e) {
|
|
6727
|
+
this._participantsCount = e, this._update();
|
|
6728
|
+
}
|
|
6729
|
+
addRemoteTrack(e) {
|
|
6730
|
+
if (e.endsWith(mi.AUDIO_MIX)) this._taTrackIds.clear();
|
|
6731
|
+
else if (e.startsWith(`${mi.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) this._taTrackIds.add(e);
|
|
6732
|
+
else return;
|
|
6733
|
+
this._update();
|
|
6734
|
+
}
|
|
6735
|
+
removeRemoteTrack(e) {
|
|
6736
|
+
this._taTrackIds.delete(e) && this._update();
|
|
6737
|
+
}
|
|
6738
|
+
resetRemoteTracks() {
|
|
6739
|
+
this._taTrackIds.size !== 0 && (this._taTrackIds.clear(), this._update());
|
|
6740
|
+
}
|
|
6741
|
+
setSendTrack(e) {
|
|
6742
|
+
this._sendTrack = e, this._enabled && this._controller?.setSendTrack(e);
|
|
6743
|
+
}
|
|
6744
|
+
destroy() {
|
|
6745
|
+
this._destroyed = !0, this._enabled = !1, this._updateTimer !== null && (window.clearTimeout(this._updateTimer), this._updateTimer = null), this._controller?.destroy(), this._controller = null;
|
|
6746
|
+
}
|
|
6747
|
+
_isAllowed() {
|
|
6748
|
+
let e = this._taTrackIds.size;
|
|
6749
|
+
return this._topology !== J.DIRECT && e > 0 && this._participantsCount > e;
|
|
6750
|
+
}
|
|
6751
|
+
_update() {
|
|
6752
|
+
this._destroyed || this._updateTimer !== null || (this._updateTimer = window.setTimeout(() => {
|
|
6753
|
+
this._updateTimer = null, this._applyConditions();
|
|
6754
|
+
}, 0));
|
|
6755
|
+
}
|
|
6756
|
+
_applyConditions() {
|
|
6757
|
+
let e = this._isAllowed();
|
|
6758
|
+
e !== this._enabled && (this._enabled = e, this._debug.log(`[VadGate] VAD ${e ? "enabled" : "disabled"}`, {
|
|
6759
|
+
topology: this._topology,
|
|
6760
|
+
taTracks: this._taTrackIds.size,
|
|
6761
|
+
participants: this._participantsCount
|
|
6762
|
+
}), e && !this._controller ? this._createController() : this._applyState());
|
|
6763
|
+
}
|
|
6764
|
+
_createController() {
|
|
6765
|
+
if (!N.vad || this._initFailed) return;
|
|
6766
|
+
let e = new N.vad.VadController(this._sendTrack, N.vadOptions);
|
|
6767
|
+
e.setLogger((e, ...t) => z.send(e, ...t), "VAD"), e.onModelReady = (e, t) => this._mlStats?.logModelReady(e, t), e.onModelError = (e, t) => this._mlStats?.logModelError(e, t), e.onInference = (e) => this._mlStats?.addVadInference(e), this._controller = e, e.init().then(() => {
|
|
6768
|
+
this._controller === e && this._applyState();
|
|
6769
|
+
}, (t) => {
|
|
6770
|
+
this._debug.warn("[VadGate] VAD init failed, continuing without VAD", t), this._initFailed = !0, e.destroy(), this._controller === e && (this._controller = null);
|
|
6771
|
+
});
|
|
6772
|
+
}
|
|
6773
|
+
_applyState() {
|
|
6774
|
+
let e = this._controller;
|
|
6775
|
+
e && (this._enabled ? (e.resume(), e.setSendTrack(this._sendTrack)) : (e.setSendTrack(null), e.pause()));
|
|
6776
|
+
}
|
|
6738
6777
|
}, Y = /* @__PURE__ */ function(e) {
|
|
6739
6778
|
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;
|
|
6740
6779
|
}({}), Ma = class extends Ye {
|
|
6741
|
-
constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null) {
|
|
6742
|
-
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, "
|
|
6743
|
-
this.
|
|
6744
|
-
}), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this._onFirstMediaSent = c, this.subscribe(this._signaling,
|
|
6780
|
+
constructor(e, t, n, r, i = z, a = null, o = null, s = null, c = null, l = () => !0, u = null) {
|
|
6781
|
+
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, "_isParticipantAccepted", void 0), h(this, "_vadGate", void 0), h(this, "_updateVadTrack", () => {
|
|
6782
|
+
this._vadGate.setSendTrack(this._mediaSource.getSendAudioTrack());
|
|
6783
|
+
}), this._signaling = t, this._mediaSource = n, this._topology = e, this._serverSettings = r, this._debug = i, this._logger = a, this._statAggregator = o, this._codecStatsAggregator = s, this._onFirstMediaSent = c, this._isParticipantAccepted = l, this._vadGate = new ja(e, i, u), this._vadGate.setSendTrack(this._mediaSource.getSendAudioTrack()), this.subscribe(this._signaling, Cr.NOTIFICATION, this._onSignalingNotification.bind(this)), this.subscribe(this._mediaSource, Xt.ANIMOJI_STATUS, this._onAnimojiStatus.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_CHANGED, this._onSourceChanged.bind(this)), this.subscribe(this._mediaSource, Xt.SOURCE_READY, this._updateVadTrack), this._createAnimojiTransport(), e === J.SERVER && (this._serverTransport = this._createServerTransport());
|
|
6745
6784
|
}
|
|
6746
6785
|
updateSettings(e) {
|
|
6747
6786
|
this._debug.log("Update transport settings", e), this._serverSettings = e, this._directTransport && this._directTransport.updateSettings(e), this._serverTransport && this._serverTransport.updateSettings(e);
|
|
@@ -6770,17 +6809,17 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6770
6809
|
}
|
|
6771
6810
|
this._opened.push(t), i = !0;
|
|
6772
6811
|
}
|
|
6773
|
-
i && (this._topology === J.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === J.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
|
|
6812
|
+
this._updateVadParticipants(), i && (this._topology === J.DIRECT && this._directTransport && this._directTransport.open(t), this._topology === J.SERVER && this._serverTransport && (this._serverTransport.open(n), this._setStates(e, this._serverTransport.getState()), this._setLocalState(this._serverTransport.getState())), this._debug.debug("The transport has been opened", e));
|
|
6774
6813
|
}
|
|
6775
6814
|
close(e) {
|
|
6776
6815
|
let t = this._allocated.indexOf(e), n = this._opened.indexOf(e);
|
|
6777
|
-
t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === J.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === J.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], q.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e];
|
|
6816
|
+
t < 0 && this._debug.warn(`The participant [${e}] transport has already deallocated`), this._topology === J.DIRECT && this._directTransport && n >= 0 && this._releaseDirectTransport(), this._topology === J.SERVER && (this._serverTransport?.removeParticipant(e), this._setStates([e], q.CLOSED)), n >= 0 && this._opened.splice(n, 1), t >= 0 && this._allocated.splice(t, 1), delete this._states[e], this._updateVadParticipants();
|
|
6778
6817
|
}
|
|
6779
6818
|
destroy() {
|
|
6780
6819
|
this.stopFirstMediaSentProbe(), this.unsubscribe();
|
|
6781
6820
|
for (let e of this._dtListeners) e.dispose();
|
|
6782
6821
|
for (let e of this._stListeners) e.dispose();
|
|
6783
|
-
this._removeAnimojiTransport(), N.audioEffects?.destroy(), this.
|
|
6822
|
+
this._removeAnimojiTransport(), N.audioEffects?.destroy(), this._vadGate.destroy(), this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
|
|
6784
6823
|
}
|
|
6785
6824
|
stopFirstMediaSentProbe() {
|
|
6786
6825
|
this._firstMediaSentProbeStopped || (this._firstMediaSentProbeStopped = !0, this._directTransport?.stopFirstMediaSentProbe(), this._serverTransport?.stopFirstMediaSentProbe());
|
|
@@ -6789,7 +6828,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6789
6828
|
this.unsubscribe();
|
|
6790
6829
|
for (let e of this._dtListeners) e.dispose();
|
|
6791
6830
|
for (let e of this._stListeners) e.dispose();
|
|
6792
|
-
this.
|
|
6831
|
+
this._vadGate.destroy(), this._directTransport?.close(), this._directTransport = null, this._serverTransport?.close(), this._serverTransport = null, this._allocated = [], this._opened = [];
|
|
6793
6832
|
}
|
|
6794
6833
|
setRemoteHold(e) {
|
|
6795
6834
|
this._directTransport?.setRemoteHold(e);
|
|
@@ -6839,7 +6878,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6839
6878
|
}
|
|
6840
6879
|
_onTopologyChanged(e) {
|
|
6841
6880
|
if (e.topology !== this._topology) {
|
|
6842
|
-
if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(x.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
|
|
6881
|
+
if (this._debug.log(`Topology changed ${this._topology} -> ${e.topology}`), this._logger?.log(x.TOPOLOGY_CHANGE_REQUESTED, e.topology), this._topology = e.topology, this._vadGate.setTopology(this._topology), this._topology === J.SERVER && (this._serverTransport ? this._serverTransport.allowRestart() : (this._serverTransport = this._createServerTransport(), this._opened.length > 0 && (this._directTransport?.preventRestart(), this._serverTransport.open()))), this._topology === J.DIRECT) {
|
|
6843
6882
|
let t = e.offerTo || [], n = e.offerToTypes || [], r = e.offerToDeviceIdxs || [], i = t.length && n.length ? M.composeParticipantId(t[0], n[0], r[0]) : null;
|
|
6844
6883
|
if (this._serverTransport && this._serverTransport.preventRestart(), !this._allocated || this._allocated.length === 0) {
|
|
6845
6884
|
this._debug.error("Topology changed to DIRECT, but the list of allocated participants is empty");
|
|
@@ -6858,11 +6897,11 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6858
6897
|
}
|
|
6859
6898
|
}
|
|
6860
6899
|
_createDirectTransport(e, t = !1) {
|
|
6861
|
-
let n = new
|
|
6900
|
+
let n = new pi(e, t, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
|
|
6862
6901
|
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;
|
|
6863
6902
|
}
|
|
6864
6903
|
_createServerTransport() {
|
|
6865
|
-
let e = new
|
|
6904
|
+
let e = new Aa(this._signaling, this._mediaSource, this._serverSettings, this._debug, this._logger, this._statAggregator, this._codecStatsAggregator, this._getFirstMediaSentCallback());
|
|
6866
6905
|
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;
|
|
6867
6906
|
}
|
|
6868
6907
|
_releaseDirectTransport() {
|
|
@@ -6871,7 +6910,7 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6871
6910
|
this._dtListeners = [];
|
|
6872
6911
|
}
|
|
6873
6912
|
_releaseServerTransport() {
|
|
6874
|
-
this._serverTransport?.close(), this._serverTransport = null;
|
|
6913
|
+
this._serverTransport?.close(), this._serverTransport = null, this._vadGate.resetRemoteTracks();
|
|
6875
6914
|
for (let e of this._stListeners) e.dispose();
|
|
6876
6915
|
this._stListeners = [];
|
|
6877
6916
|
}
|
|
@@ -6881,13 +6920,13 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6881
6920
|
let e = this._opened.indexOf(t);
|
|
6882
6921
|
e >= 0 && this._opened.splice(e, 1);
|
|
6883
6922
|
let n = this._allocated.indexOf(t);
|
|
6884
|
-
n >= 0 && this._allocated.splice(n, 1);
|
|
6923
|
+
n >= 0 && this._allocated.splice(n, 1), this._updateVadParticipants();
|
|
6885
6924
|
}
|
|
6886
6925
|
this._topology === J.DIRECT && t && (this._setStates([t], e), this._setLocalState(e));
|
|
6887
6926
|
}
|
|
6888
6927
|
_onServerTransportChanged(e) {
|
|
6889
6928
|
let t = this._opened.slice();
|
|
6890
|
-
e === q.CONNECTED && this._topology === J.SERVER && this._releaseDirectTransport(), (e === q.CLOSED || e === q.FAILED) && (this._releaseServerTransport(), this._topology === J.SERVER && (this._allocated = [], this._opened = [])), this._topology === J.SERVER && (this._setStates(t, e), this._setLocalState(e));
|
|
6929
|
+
e === q.CONNECTED && this._topology === J.SERVER && this._releaseDirectTransport(), (e === q.CLOSED || e === q.FAILED) && (this._releaseServerTransport(), this._topology === J.SERVER && (this._allocated = [], this._opened = [], this._updateVadParticipants())), this._topology === J.SERVER && (this._setStates(t, e), this._setLocalState(e));
|
|
6891
6930
|
}
|
|
6892
6931
|
_onTransportActiveParticipants(e) {
|
|
6893
6932
|
this._topology === J.SERVER && this._triggerEvent("SIGNALLED_ACTIVE_PARTICIPANTS", e);
|
|
@@ -6914,10 +6953,10 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6914
6953
|
this._triggerEvent("REMOTE_DATA_STATS", e);
|
|
6915
6954
|
}
|
|
6916
6955
|
_onRemoteTrackAdded(e, t, n) {
|
|
6917
|
-
this._triggerEvent("REMOTE_TRACK_ADDED", e, t, n);
|
|
6956
|
+
this._vadGate.addRemoteTrack(e), this._triggerEvent("REMOTE_TRACK_ADDED", e, t, n);
|
|
6918
6957
|
}
|
|
6919
6958
|
_onRemoteTrackRemoved(e, t, n) {
|
|
6920
|
-
this._triggerEvent("REMOTE_TRACK_REMOVED", e, t, n);
|
|
6959
|
+
this._vadGate.removeRemoteTrack(e), this._triggerEvent("REMOTE_TRACK_REMOVED", e, t, n);
|
|
6921
6960
|
}
|
|
6922
6961
|
_onAsrTranscription(e) {
|
|
6923
6962
|
this._triggerEvent("ASR_TRANSCRIPTION", e);
|
|
@@ -6932,10 +6971,8 @@ var qi = 2 ** 15 - 1, Ji = 1, Yi = 5, Xi = 5, Zi = class e {
|
|
|
6932
6971
|
_onAnimojiStatus(e) {
|
|
6933
6972
|
e ? this._animojiSender?.resume() : this._animojiSender?.pause(), this._mediaSource.onAnimojiSender(e);
|
|
6934
6973
|
}
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
z.warn("[Transport] VAD init failed, continuing without VAD", e), this._vadController?.destroy(), this._vadController = null;
|
|
6938
|
-
}));
|
|
6974
|
+
_updateVadParticipants() {
|
|
6975
|
+
this._vadGate.setParticipantsCount(this._opened.filter(this._isParticipantAccepted).length);
|
|
6939
6976
|
}
|
|
6940
6977
|
_createAnimojiTransport() {
|
|
6941
6978
|
if (!N.vmoji) return;
|
|
@@ -7177,7 +7214,7 @@ function Ua(e, ...t) {
|
|
|
7177
7214
|
return !0;
|
|
7178
7215
|
}
|
|
7179
7216
|
function Wa(e, t = !1) {
|
|
7180
|
-
if (!(!e?.address || !
|
|
7217
|
+
if (!(!e?.address || !Ir(e.address))) return e.address + (t ? `:${e.port}` : "");
|
|
7181
7218
|
}
|
|
7182
7219
|
function Ga(e) {
|
|
7183
7220
|
return e === void 0;
|
|
@@ -7356,21 +7393,15 @@ var Ja = qa, Ya = {
|
|
|
7356
7393
|
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 ro(this.compression), this.decoder = new io(this.compression), this.connect();
|
|
7357
7394
|
}
|
|
7358
7395
|
async send(e) {
|
|
7359
|
-
if (this.readyState !== WebSocket.OPEN)
|
|
7360
|
-
this._debug.warn("[WebTransport] Attempt to send data before webtransport is open");
|
|
7361
|
-
return;
|
|
7362
|
-
}
|
|
7396
|
+
if (this.readyState !== WebSocket.OPEN) throw this._debug.warn("[WebTransport] Attempt to send data before webtransport is open"), Error("WebTransport is not open");
|
|
7363
7397
|
let t = this.writer;
|
|
7364
|
-
if (!t)
|
|
7365
|
-
this._debug.warn("[WebTransport] Attempt to send data before stream is ready");
|
|
7366
|
-
return;
|
|
7367
|
-
}
|
|
7398
|
+
if (!t) throw this._debug.warn("[WebTransport] Attempt to send data before stream is ready"), Error("WebTransport stream is not ready");
|
|
7368
7399
|
try {
|
|
7369
7400
|
await t.ready;
|
|
7370
7401
|
let n = this.encoder.encode(e);
|
|
7371
7402
|
await t.write(n);
|
|
7372
7403
|
} catch (e) {
|
|
7373
|
-
this.handleStreamError("send", e);
|
|
7404
|
+
throw this.handleStreamError("send", e), e;
|
|
7374
7405
|
}
|
|
7375
7406
|
}
|
|
7376
7407
|
close(e = 1e3, t = "") {
|
|
@@ -7480,148 +7511,172 @@ var Ja = qa, Ya = {
|
|
|
7480
7511
|
}, n;
|
|
7481
7512
|
}
|
|
7482
7513
|
}, oo = /* @__PURE__ */ function(e) {
|
|
7483
|
-
return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.
|
|
7514
|
+
return e.EMPTY_ENDPOINT = "EMPTY_ENDPOINT", e.CONNECTION_TIMEOUT = "CONNECTION_TIMEOUT", e.RECONNECT_TIMEOUT = "RECONNECT_TIMEOUT", e.ABORTED = "ABORTED", e;
|
|
7484
7515
|
}({}), so = class {
|
|
7485
7516
|
constructor(e = z, t) {
|
|
7486
|
-
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, "
|
|
7487
|
-
}
|
|
7488
|
-
get readyState() {
|
|
7489
|
-
return this.socket?.readyState ?? null;
|
|
7517
|
+
h(this, "_debug", void 0), h(this, "handlers", void 0), h(this, "socket", null), h(this, "state", "terminal"), 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, "retryTimer", 0), h(this, "connectionDeadlineTimer", 0), h(this, "attemptTimer", 0), h(this, "pingTimer", 0), h(this, "pingTimeoutMs", N.waitMessageDelay), h(this, "reconnectTimeoutMs", N.signalingReconnectMaxDuration), h(this, "forceWebSocket", !1), h(this, "hasEstablished", !1), h(this, "abortSignal", void 0), h(this, "currentType", wr.WEBSOCKET), h(this, "onAbort", this._onAbort.bind(this)), this._debug = e, this.handlers = t;
|
|
7490
7518
|
}
|
|
7491
|
-
get
|
|
7492
|
-
return this.
|
|
7519
|
+
get active() {
|
|
7520
|
+
return this.state !== "terminal";
|
|
7493
7521
|
}
|
|
7494
|
-
|
|
7495
|
-
this.
|
|
7522
|
+
get established() {
|
|
7523
|
+
return this.state === "established";
|
|
7496
7524
|
}
|
|
7497
|
-
|
|
7498
|
-
this.
|
|
7525
|
+
get canSend() {
|
|
7526
|
+
return this.active && this.socket?.readyState === WebSocket.OPEN;
|
|
7499
7527
|
}
|
|
7500
|
-
|
|
7501
|
-
this.
|
|
7528
|
+
get type() {
|
|
7529
|
+
return this.currentType;
|
|
7502
7530
|
}
|
|
7503
|
-
|
|
7504
|
-
this.
|
|
7531
|
+
getPeerId() {
|
|
7532
|
+
return this.peerId;
|
|
7505
7533
|
}
|
|
7506
7534
|
setAbortSignal(e) {
|
|
7507
|
-
this.abortSignal = e;
|
|
7535
|
+
this.abortSignal?.removeEventListener("abort", this.onAbort), this.abortSignal = e, e?.addEventListener("abort", this.onAbort), e?.aborted && this.onAbort();
|
|
7508
7536
|
}
|
|
7509
|
-
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7537
|
+
connect(e, t) {
|
|
7538
|
+
if (!this.active) {
|
|
7539
|
+
if (this.endpoint = t.endpoint, this.wtEndpoint = t.webTransportEndpoint || null, this.state = "connecting", this.connectionType = e, this.forceWebSocket = !1, this.reconnectCount = 0, this.hasEstablished = !1, this._updateTimeouts(), this.abortSignal?.aborted) {
|
|
7540
|
+
this.onAbort();
|
|
7541
|
+
return;
|
|
7542
|
+
}
|
|
7543
|
+
this._startConnectionDeadlineTimer(), this._connect();
|
|
7544
|
+
}
|
|
7514
7545
|
}
|
|
7515
7546
|
close(e) {
|
|
7516
|
-
this.
|
|
7547
|
+
this.state = "terminal", this._stopRetryTimer(), this._stopConnectionDeadlineTimer(), this._disconnect(e), this.setAbortSignal(void 0), this.lastStamp = 0;
|
|
7517
7548
|
}
|
|
7518
7549
|
async send(e) {
|
|
7519
|
-
|
|
7550
|
+
let t = this.socket;
|
|
7551
|
+
if (!this.canSend || !t) throw Error("Signaling socket is not open");
|
|
7552
|
+
await t.send(e);
|
|
7520
7553
|
}
|
|
7521
7554
|
_connect() {
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
_connectWebTransport() {
|
|
7529
|
-
if (!this.wtEndpoint) {
|
|
7530
|
-
this._connectWebSocket();
|
|
7531
|
-
return;
|
|
7532
|
-
}
|
|
7533
|
-
let e = this._buildUrl(this.wtEndpoint, !0);
|
|
7534
|
-
this.currentType = Tr.WEBTRANSPORT, this.socket = new ao(e, { congestionControl: "low-latency" }, this._debug), this._setSocketHandlers();
|
|
7535
|
-
}
|
|
7536
|
-
_connectWebSocket() {
|
|
7537
|
-
if (!this.endpoint) {
|
|
7538
|
-
this.handlers.onFailed({
|
|
7539
|
-
failure: "EMPTY_ENDPOINT",
|
|
7540
|
-
message: "Unable to connect to the signaling: endpoint is not set",
|
|
7541
|
-
source: Tr.WEBSOCKET,
|
|
7542
|
-
remote: !0
|
|
7543
|
-
});
|
|
7555
|
+
this.state = "connecting";
|
|
7556
|
+
let e = !this.forceWebSocket && ao.isBrowserSupported() && this.wtEndpoint !== null && N.webtransport;
|
|
7557
|
+
this.currentType = e ? wr.WEBTRANSPORT : wr.WEBSOCKET;
|
|
7558
|
+
let t = e ? this.wtEndpoint : this.endpoint;
|
|
7559
|
+
if (!t) {
|
|
7560
|
+
this._fail("EMPTY_ENDPOINT", "Unable to connect to the signaling: endpoint is not set", !0);
|
|
7544
7561
|
return;
|
|
7545
7562
|
}
|
|
7546
|
-
|
|
7547
|
-
this.currentType = Tr.WEBSOCKET, this.socket = new WebSocket(e), this._setSocketHandlers();
|
|
7548
|
-
}
|
|
7549
|
-
_setSocketHandlers() {
|
|
7550
|
-
this.socket && (this.handlers.onConnecting({
|
|
7563
|
+
if (this.handlers.onConnecting({
|
|
7551
7564
|
connectionType: this.connectionType,
|
|
7552
7565
|
source: this.currentType
|
|
7553
|
-
}), this.
|
|
7566
|
+
}), !this.active) return;
|
|
7567
|
+
let n;
|
|
7568
|
+
try {
|
|
7569
|
+
let r = this._buildUrl(t, e);
|
|
7570
|
+
n = e ? new ao(r, { congestionControl: "low-latency" }, this._debug) : new WebSocket(r);
|
|
7571
|
+
} catch (e) {
|
|
7572
|
+
let t = Object.assign(new Event("error"), { error: e });
|
|
7573
|
+
this.handlers.onError(t), this.active && this._retry();
|
|
7574
|
+
return;
|
|
7575
|
+
}
|
|
7576
|
+
this.socket = n, n.onopen = () => {
|
|
7577
|
+
this.socket !== n || this.state !== "connecting" || (this.state = "awaiting-connection", this._startAttemptTimer(n, N.waitConnectionDelay), this.handlers.onOpen());
|
|
7578
|
+
}, n.onmessage = (e) => {
|
|
7579
|
+
this.socket === n && this.active && this._onMessage(e, n);
|
|
7580
|
+
}, n.onerror = (e) => {
|
|
7581
|
+
this.socket === n && this.active && this.handlers.onError(e);
|
|
7582
|
+
}, n.onclose = (e) => {
|
|
7583
|
+
this.socket === n && this.active && this._retry(e);
|
|
7584
|
+
}, this._startAttemptTimer(n, N.waitMessageDelay);
|
|
7554
7585
|
}
|
|
7555
7586
|
_buildUrl(e, t) {
|
|
7556
7587
|
let n = new URL(e), r = n.searchParams;
|
|
7557
|
-
return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", Xa.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType ===
|
|
7588
|
+
return r.set("platform", N.platform), r.set("appVersion", N.appVersion), r.set("version", String(N.protocolVersion)), r.set("device", N.device), r.set("capabilities", Xa.getFlags()), r.set("clientType", N.clientType), this.connectionType && r.set("tgt", this.connectionType), this.connectionType === Sr.RETRY && this.lastStamp && r.set("recoverTs", String(this.lastStamp)), N.useParticipantListChunk && (r.set("partIdx", String(N.participantListChunkInitIndex)), N.participantListChunkInitCount !== null && r.set("partCount", String(N.participantListChunkInitCount))), t && (r.set("compression", "deflate-raw"), r.set("ua", navigator.userAgent)), this.peerId !== null && r.set("peerId", String(this.peerId)), n.toString();
|
|
7558
7589
|
}
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7590
|
+
_onMessage(e, t) {
|
|
7591
|
+
if (e.data === "ping") {
|
|
7592
|
+
this.established && this._startPingTimer(), this.handlers.onMessage("ping"), this.canSend && this.send("pong").catch((e) => {
|
|
7593
|
+
this.socket === t && this.active && (this._debug.warn("[signaling] unable to send pong", e), this._retry());
|
|
7594
|
+
});
|
|
7595
|
+
return;
|
|
7596
|
+
}
|
|
7597
|
+
let n;
|
|
7598
|
+
try {
|
|
7599
|
+
if (n = JSON.parse(e.data), typeof n != "object" || !n || Array.isArray(n)) throw Error("Signaling message must be an object");
|
|
7600
|
+
} catch (t) {
|
|
7601
|
+
this.handlers.onParseError(t, e.data);
|
|
7602
|
+
return;
|
|
7603
|
+
}
|
|
7604
|
+
n?.type === "notification" && n.notification === "connection" && (this._updateTimeouts(n.conversationParams?.activityTimeout), this._stopAttemptTimer(), this.state = "established", this.hasEstablished = !0, this.reconnectCount = 0, this.endpoint = n.endpoint, n.peerId && (this.peerId = n.peerId.id), this._stopConnectionDeadlineTimer(), this._startPingTimer());
|
|
7605
|
+
try {
|
|
7606
|
+
this.handlers.onMessage(n);
|
|
7607
|
+
} finally {
|
|
7608
|
+
this.socket === t && this._updateRecoveryStamp(n);
|
|
7609
|
+
}
|
|
7564
7610
|
}
|
|
7565
|
-
|
|
7566
|
-
|
|
7611
|
+
_updateRecoveryStamp(e) {
|
|
7612
|
+
if (e?.type === "notification" && e.notification === "connection") for (let t of e.recoverMessages ?? []) t.notification === K.ACCEPTED_CALL && t.peerId.id === this.peerId && t.peerId.type === "WEB_TRANSPORT" || this._updateRecoveryStamp(t);
|
|
7613
|
+
e?.stamp && (this.lastStamp = e.stamp);
|
|
7567
7614
|
}
|
|
7568
|
-
|
|
7569
|
-
this.
|
|
7615
|
+
_onAbort() {
|
|
7616
|
+
this.active && this._fail("ABORTED", "Signaling connection aborted");
|
|
7570
7617
|
}
|
|
7571
|
-
|
|
7572
|
-
if (this.
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
failure: "ABORTED",
|
|
7576
|
-
message: "Signaling connection aborted",
|
|
7577
|
-
source: this.currentType
|
|
7578
|
-
});
|
|
7579
|
-
return;
|
|
7580
|
-
}
|
|
7581
|
-
this.forceWebSocket = !0, this._scheduleReconnect(this.currentType === Tr.WEBTRANSPORT ? 0 : void 0);
|
|
7582
|
-
}
|
|
7583
|
-
}
|
|
7584
|
-
_disconnect(e) {
|
|
7585
|
-
this.socket && this.socket.readyState < WebSocket.CLOSING && (this.socket.onopen = null, this.socket.onmessage = null, this.socket.onerror = null, this.socket.onclose = null, this.socket.close(e)), this.socket = null, this._stopDoctor();
|
|
7586
|
-
}
|
|
7587
|
-
_scheduleReconnect(e = this._getReconnectDelay()) {
|
|
7588
|
-
if (this.reconnectCount >= N.signalingReconnectMaxCount) {
|
|
7589
|
-
this._stopReconnectDeadline(), this.handlers.onFailed({
|
|
7590
|
-
failure: "NETWORK_ERROR",
|
|
7591
|
-
message: "Unable to connect to the signaling: reconnect attempts exhausted",
|
|
7592
|
-
source: this.currentType
|
|
7593
|
-
});
|
|
7618
|
+
_retry(e = new CloseEvent("close", { code: 4e3 }), t = !1) {
|
|
7619
|
+
if (!this.active || (this.state = "waiting-to-retry", this._startConnectionDeadlineTimer(), this._disconnect(4e3), t && this.handlers.onInactive(), this.handlers.onClose(e), !this.active)) return;
|
|
7620
|
+
if (this.abortSignal?.aborted) {
|
|
7621
|
+
this.onAbort();
|
|
7594
7622
|
return;
|
|
7595
7623
|
}
|
|
7596
|
-
this.
|
|
7624
|
+
let n = t || this.currentType === wr.WEBTRANSPORT ? 0 : Math.min(N.signalingReconnectMaxDelay, N.signalingReconnectDelay * 2 ** this.reconnectCount);
|
|
7625
|
+
this.forceWebSocket = !0, this.reconnectCount++, this._startRetryTimer(n), this.handlers.onReconnectScheduled({
|
|
7597
7626
|
count: this.reconnectCount,
|
|
7598
|
-
delay:
|
|
7599
|
-
})
|
|
7600
|
-
|
|
7627
|
+
delay: n
|
|
7628
|
+
});
|
|
7629
|
+
}
|
|
7630
|
+
_disconnect(e) {
|
|
7631
|
+
this._stopAttemptTimer(), this._stopPingTimer();
|
|
7632
|
+
let t = this.socket;
|
|
7633
|
+
this.socket = null, t && (t.onopen = null, t.onmessage = null, t.onerror = null, t.onclose = null, t.readyState < WebSocket.CLOSING && t.close(e));
|
|
7634
|
+
}
|
|
7635
|
+
_startRetryTimer(e) {
|
|
7636
|
+
this._stopRetryTimer(), this.retryTimer = window.setTimeout(() => {
|
|
7637
|
+
this.retryTimer = 0, this.connectionType = Sr.RETRY, this._connect();
|
|
7601
7638
|
}, e);
|
|
7602
7639
|
}
|
|
7603
|
-
|
|
7604
|
-
this.
|
|
7605
|
-
this.reconnectDeadlineTimer = 0, window.clearTimeout(this.reconnectTimer), this.reconnectTimer = 0, this._disconnect(4e3), this.handlers.onFailed({
|
|
7606
|
-
failure: "RECONNECT_TIMEOUT",
|
|
7607
|
-
message: "Unable to connect to the signaling: reconnect timeout",
|
|
7608
|
-
source: this.currentType
|
|
7609
|
-
});
|
|
7610
|
-
}, N.signalingReconnectMaxDuration));
|
|
7640
|
+
_stopRetryTimer() {
|
|
7641
|
+
window.clearTimeout(this.retryTimer), this.retryTimer = 0;
|
|
7611
7642
|
}
|
|
7612
|
-
|
|
7613
|
-
|
|
7643
|
+
_startConnectionDeadlineTimer() {
|
|
7644
|
+
this.connectionDeadlineTimer || (this.connectionDeadlineTimer = window.setTimeout(() => {
|
|
7645
|
+
this._fail(this.hasEstablished ? "RECONNECT_TIMEOUT" : "CONNECTION_TIMEOUT", "Unable to connect to the signaling: connection timeout");
|
|
7646
|
+
}, this.hasEstablished ? this.reconnectTimeoutMs : N.signalingReconnectMaxDuration));
|
|
7614
7647
|
}
|
|
7615
|
-
|
|
7616
|
-
|
|
7648
|
+
_stopConnectionDeadlineTimer() {
|
|
7649
|
+
window.clearTimeout(this.connectionDeadlineTimer), this.connectionDeadlineTimer = 0;
|
|
7617
7650
|
}
|
|
7618
|
-
|
|
7619
|
-
this.
|
|
7620
|
-
this.
|
|
7621
|
-
},
|
|
7651
|
+
_startAttemptTimer(e, t) {
|
|
7652
|
+
this._stopAttemptTimer(), this.attemptTimer = window.setTimeout(() => {
|
|
7653
|
+
this.socket === e && this.active && this._retry();
|
|
7654
|
+
}, t);
|
|
7622
7655
|
}
|
|
7623
|
-
|
|
7624
|
-
window.clearTimeout(this.
|
|
7656
|
+
_stopAttemptTimer() {
|
|
7657
|
+
window.clearTimeout(this.attemptTimer), this.attemptTimer = 0;
|
|
7658
|
+
}
|
|
7659
|
+
_updateTimeouts(e) {
|
|
7660
|
+
typeof e == "number" && Number.isFinite(e) && e > 0 ? (this.pingTimeoutMs = Math.max(Math.min(e / 4, 61e3), 11e3), this.reconnectTimeoutMs = Math.max(e / 2, e - 6e4, 3e4)) : (this.pingTimeoutMs = N.waitMessageDelay, this.reconnectTimeoutMs = N.signalingReconnectMaxDuration);
|
|
7661
|
+
}
|
|
7662
|
+
_startPingTimer() {
|
|
7663
|
+
this._stopPingTimer();
|
|
7664
|
+
let e = this.socket;
|
|
7665
|
+
this.pingTimer = window.setTimeout(() => {
|
|
7666
|
+
this.socket === e && this.established && this._retry(void 0, !0);
|
|
7667
|
+
}, this.pingTimeoutMs);
|
|
7668
|
+
}
|
|
7669
|
+
_stopPingTimer() {
|
|
7670
|
+
window.clearTimeout(this.pingTimer), this.pingTimer = 0;
|
|
7671
|
+
}
|
|
7672
|
+
_fail(e, t, n) {
|
|
7673
|
+
let r = this.currentType;
|
|
7674
|
+
this.close(4e3), this.handlers.onFailed({
|
|
7675
|
+
failure: e,
|
|
7676
|
+
message: t,
|
|
7677
|
+
source: r,
|
|
7678
|
+
...n === void 0 ? {} : { remote: n }
|
|
7679
|
+
});
|
|
7625
7680
|
}
|
|
7626
7681
|
}, co = "open", lo = 300, uo = 10, fo = {
|
|
7627
7682
|
CONVERSATION_ENDED: "conversation-ended",
|
|
@@ -7647,36 +7702,30 @@ var ho = new Set([
|
|
|
7647
7702
|
O.NOT_FOUND,
|
|
7648
7703
|
O.PARTICIPANT_LIMIT_REACHED,
|
|
7649
7704
|
O.SERVICE_UNAVAILABLE
|
|
7650
|
-
]), go = class e extends
|
|
7651
|
-
static get WAIT_CONNECTION_DELAY() {
|
|
7652
|
-
return N.waitConnectionDelay;
|
|
7653
|
-
}
|
|
7705
|
+
]), go = class e extends Ye {
|
|
7654
7706
|
static get WAIT_RESPONSE_DELAY() {
|
|
7655
7707
|
return N.waitResponseDelay;
|
|
7656
7708
|
}
|
|
7657
7709
|
get ready() {
|
|
7658
|
-
return !this.disposed && this.
|
|
7710
|
+
return !this.disposed && this.session.active;
|
|
7659
7711
|
}
|
|
7660
7712
|
constructor(e = z, t = null, n = null, r = null, i = null) {
|
|
7661
|
-
super(), h(this, "
|
|
7713
|
+
super(), h(this, "session", void 0), h(this, "sequence", 1), 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, "listenersReady", !1), h(this, "reconnectStartedAt", null), 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 rr(e), this.session = new so(e, {
|
|
7662
7714
|
onConnecting: this._onTransportConnecting.bind(this),
|
|
7663
7715
|
onOpen: this._onOpen.bind(this),
|
|
7664
7716
|
onMessage: this._onMessage.bind(this),
|
|
7717
|
+
onParseError: (e, t) => {
|
|
7718
|
+
this._logger?.log(x.SOCKET_ACTION, "parse_error"), this._debug.error("[signaling] unable to parse message", e, t);
|
|
7719
|
+
},
|
|
7665
7720
|
onError: this._onError.bind(this),
|
|
7666
7721
|
onClose: this._onClose.bind(this),
|
|
7667
|
-
onFailed: this.
|
|
7668
|
-
onReconnectScheduled: this.
|
|
7669
|
-
|
|
7722
|
+
onFailed: this._onSessionFailed.bind(this),
|
|
7723
|
+
onReconnectScheduled: this._onSessionReconnectScheduled.bind(this),
|
|
7724
|
+
onInactive: this._onSessionInactive.bind(this)
|
|
7670
7725
|
});
|
|
7671
7726
|
}
|
|
7672
7727
|
setAbortSignal(e) {
|
|
7673
|
-
|
|
7674
|
-
}
|
|
7675
|
-
setEndpoint(e) {
|
|
7676
|
-
this.transport.setEndpoint(e);
|
|
7677
|
-
}
|
|
7678
|
-
setWebTransportEndpoint(e) {
|
|
7679
|
-
this.transport.setWebTransportEndpoint(e);
|
|
7728
|
+
this.session.setAbortSignal(e);
|
|
7680
7729
|
}
|
|
7681
7730
|
setParticipantIdRegistry(e) {
|
|
7682
7731
|
this.participantIdRegistry = e, this.producerCommandSerializationService.setParticipantIdRegistry(e);
|
|
@@ -7709,17 +7758,24 @@ var ho = new Set([
|
|
|
7709
7758
|
window.clearTimeout(t.responseTimer), t.reject(e instanceof An ? new An(t.name) : e, !0);
|
|
7710
7759
|
});
|
|
7711
7760
|
}
|
|
7712
|
-
async connect(e) {
|
|
7713
|
-
return new Promise((
|
|
7714
|
-
if (this.
|
|
7715
|
-
this._logger?.log(x.SOCKET_ACTION, "already_opened"),
|
|
7761
|
+
async connect(e, t) {
|
|
7762
|
+
return new Promise((n, r) => {
|
|
7763
|
+
if (this.session.active) {
|
|
7764
|
+
this._logger?.log(x.SOCKET_ACTION, "already_opened"), r(Error("Socket already opened"));
|
|
7765
|
+
return;
|
|
7766
|
+
}
|
|
7767
|
+
if (this.disposed) {
|
|
7768
|
+
r(new kn());
|
|
7716
7769
|
return;
|
|
7717
7770
|
}
|
|
7718
7771
|
this.conversationResolve = (e) => {
|
|
7719
|
-
t(e), this.conversationResolve = null, this.conversationReject = null;
|
|
7720
|
-
}, this.conversationReject = (e) => {
|
|
7721
7772
|
n(e), this.conversationResolve = null, this.conversationReject = null;
|
|
7722
|
-
}, this.
|
|
7773
|
+
}, this.conversationReject = (e) => {
|
|
7774
|
+
r(e), this.conversationResolve = null, this.conversationReject = null;
|
|
7775
|
+
}, this.connectionType = e, this.reconnectStartedAt = performance.now(), this.session.connect(e, {
|
|
7776
|
+
endpoint: t.endpoint,
|
|
7777
|
+
webTransportEndpoint: t.wt_endpoint ?? null
|
|
7778
|
+
});
|
|
7723
7779
|
});
|
|
7724
7780
|
}
|
|
7725
7781
|
getNextCommandSequenceNumber() {
|
|
@@ -7964,7 +8020,7 @@ var ho = new Set([
|
|
|
7964
8020
|
return this._send(V.GET_PARTICIPANTS, { externalIds: e });
|
|
7965
8021
|
}
|
|
7966
8022
|
getPeerId() {
|
|
7967
|
-
return this.
|
|
8023
|
+
return this.session.getPeerId();
|
|
7968
8024
|
}
|
|
7969
8025
|
async startAsr(e) {
|
|
7970
8026
|
return this._send(V.ASR_START, e);
|
|
@@ -7993,11 +8049,11 @@ var ho = new Set([
|
|
|
7993
8049
|
this.datachannelCommandsQueue.push(t), this.producerCommandDataChannel?.readyState === co && this._handleCommandsQueue(this.datachannelCommandsQueue);
|
|
7994
8050
|
break;
|
|
7995
8051
|
case "websocket":
|
|
7996
|
-
if (this.
|
|
8052
|
+
if (!this.session.active) {
|
|
7997
8053
|
this._logger?.log(x.SOCKET_ACTION, "not_opened"), this._debug.warn("[signaling] socket is not opened"), t.reject(/* @__PURE__ */ Error(`Socket not opened [${e}]`), !0);
|
|
7998
8054
|
return;
|
|
7999
8055
|
}
|
|
8000
|
-
this.
|
|
8056
|
+
this.websocketCommandsQueue.push(t), this.session.canSend && this._handleCommandsQueue(this.websocketCommandsQueue);
|
|
8001
8057
|
}
|
|
8002
8058
|
};
|
|
8003
8059
|
return new Promise((a, o) => {
|
|
@@ -8023,30 +8079,34 @@ var ho = new Set([
|
|
|
8023
8079
|
return this.producerCommandDataChannelEnabled ? e === V.UPDATE_DISPLAY_LAYOUT || e === V.REPORT_PERF_STAT || e === V.REPORT_SHARING_STAT || e === V.REQUEST_ASR || e === V.ENABLE_VIDEO_SUSPEND || e === V.ENABLE_VIDEO_SUSPEND_SUGGEST || e === V.REPORT_NETWORK_STAT || e === V.CHANGE_SIMULCAST : !1;
|
|
8024
8080
|
}
|
|
8025
8081
|
_onOpen() {
|
|
8026
|
-
this._debug.debug("[signaling] socket opened"), this._logger?.log(x.SOCKET_ACTION, "opened"), this.
|
|
8082
|
+
this._debug.debug("[signaling] socket opened"), this._logger?.log(x.SOCKET_ACTION, "opened"), this._logTransportStatSinceMark(this.connectionType === Sr.RETRY ? Tr.RECONNECTED : Tr.CONNECTED);
|
|
8027
8083
|
}
|
|
8028
8084
|
_onMessage(e) {
|
|
8029
|
-
if (e.data === "ping") {
|
|
8030
|
-
this._statPings?.mark(this._getSocketType()), this._markTransportStat(Er.FAILED_PINGS), R.onSignalingMessage(e.data), this.transport.readyState === WebSocket.OPEN && this.transport.send("pong").catch((e) => this._debug.warn("[signaling] unable to send pong", e));
|
|
8031
|
-
return;
|
|
8032
|
-
}
|
|
8033
8085
|
try {
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8086
|
+
R.onSignalingMessage(e);
|
|
8087
|
+
} catch (e) {
|
|
8088
|
+
this._debug.error("[signaling] external message hook failed", e);
|
|
8089
|
+
}
|
|
8090
|
+
if (e === "ping") {
|
|
8091
|
+
this._statPings?.mark(this._getSocketType()), this._markTransportStat(Tr.FAILED_PINGS);
|
|
8092
|
+
return;
|
|
8038
8093
|
}
|
|
8094
|
+
this._handleMessage(e);
|
|
8039
8095
|
}
|
|
8040
8096
|
_handleMessage(e) {
|
|
8041
8097
|
switch (e.type) {
|
|
8042
8098
|
case "notification":
|
|
8043
|
-
this._attachNotificationCallError(e), e.notification === "connection"
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8099
|
+
if (this._attachNotificationCallError(e), e.notification === "connection") {
|
|
8100
|
+
this._debug.debug("[signaling] signaling connected", e);
|
|
8101
|
+
let t = !this.conversationResolve;
|
|
8102
|
+
this.reconnectStartedAt = null, this.conversationResolve ? this.conversationResolve(e) : (this._triggerEvent(Cr.RECONNECT, e), e.conversation.topology && this._triggerEvent(Cr.NOTIFICATION, {
|
|
8103
|
+
type: "notification",
|
|
8104
|
+
notification: K.TOPOLOGY_CHANGED,
|
|
8105
|
+
topology: e.conversation.topology
|
|
8106
|
+
}), this._resolvePendingRecordCommands(e)), t && this._handleCachedMessages(), e.recoverMessages?.forEach((e) => {
|
|
8107
|
+
e.notification === K.ACCEPTED_CALL && e.peerId.id === this.session.getPeerId() && e.peerId.type === "WEB_TRANSPORT" || this._handleMessage(e);
|
|
8108
|
+
}), this._handleCommandsQueue(this.websocketCommandsQueue);
|
|
8109
|
+
} else !this.session.established || !this.listenersReady ? this.incomingCache.push(e) : this._triggerEvent(Cr.NOTIFICATION, e);
|
|
8050
8110
|
break;
|
|
8051
8111
|
case "response":
|
|
8052
8112
|
this._handleCommandResponse(!0, e);
|
|
@@ -8056,30 +8116,29 @@ var ho = new Set([
|
|
|
8056
8116
|
break;
|
|
8057
8117
|
default: this._logger?.log(x.SOCKET_ACTION, "unknown_message"), this._debug.warn("[signaling] unhandled message", e);
|
|
8058
8118
|
}
|
|
8059
|
-
e.stamp && (this.lastStamp = e.stamp, this.transport.setLastStamp(e.stamp));
|
|
8060
8119
|
}
|
|
8061
8120
|
_handleErrorMessage(e) {
|
|
8062
8121
|
this._logger?.log(x.SOCKET_ACTION, `error-${e.error}`);
|
|
8063
8122
|
let t = this._getSocketType(), n = e.error ? this._createSignalingCallError(e.error, e.errorCode, t) : void 0, r = mo(e, "Unknown signaling error");
|
|
8064
8123
|
switch (this._debug.debug(`[signaling] error message [${e.sequence}]`, e), e.sequence && this.responseHandlers[e.sequence] && this._handleCommandResponse(!1, e), e.error) {
|
|
8065
8124
|
case fo.SERVICE_UNAVAILABLE:
|
|
8066
|
-
let
|
|
8125
|
+
let t = new k(O.SERVICE_UNAVAILABLE, {
|
|
8067
8126
|
callError: n,
|
|
8068
8127
|
message: r,
|
|
8069
8128
|
remote: !0
|
|
8070
8129
|
});
|
|
8071
|
-
this.conversationReject ? this.
|
|
8130
|
+
this.conversationReject ? this.dispose(t) : this._triggerEvent(Cr.NOTIFICATION, {
|
|
8072
8131
|
notification: K.CLOSED_CONVERSATION,
|
|
8073
8132
|
callError: n,
|
|
8074
8133
|
reason: O.SERVICE_UNAVAILABLE
|
|
8075
8134
|
});
|
|
8076
8135
|
break;
|
|
8077
8136
|
case fo.CONVERSATION_ENDED:
|
|
8078
|
-
this.conversationReject ? this.
|
|
8137
|
+
this.conversationReject ? this.dispose(new k(e.reason || y.SIGNALING_FAILED, {
|
|
8079
8138
|
callError: n,
|
|
8080
8139
|
message: r,
|
|
8081
8140
|
remote: !0
|
|
8082
|
-
})) : this._triggerEvent(
|
|
8141
|
+
})) : this._triggerEvent(Cr.NOTIFICATION, {
|
|
8083
8142
|
notification: K.CLOSED_CONVERSATION,
|
|
8084
8143
|
callError: n,
|
|
8085
8144
|
reason: e.reason
|
|
@@ -8094,7 +8153,8 @@ var ho = new Set([
|
|
|
8094
8153
|
}));
|
|
8095
8154
|
break;
|
|
8096
8155
|
case fo.OBSOLETE_CLIENT:
|
|
8097
|
-
this.conversationReject
|
|
8156
|
+
if (!this.conversationReject) break;
|
|
8157
|
+
this.dispose(new k(e.reason || O.OBSOLETE_CLIENT, {
|
|
8098
8158
|
callError: n,
|
|
8099
8159
|
message: r,
|
|
8100
8160
|
remote: !0
|
|
@@ -8102,26 +8162,16 @@ var ho = new Set([
|
|
|
8102
8162
|
break;
|
|
8103
8163
|
case fo.INVALID_TOKEN:
|
|
8104
8164
|
default:
|
|
8105
|
-
if (e.sequence
|
|
8106
|
-
|
|
8165
|
+
if (e.sequence) break;
|
|
8166
|
+
let i = new k(e.reason || y.SIGNALING_FAILED, {
|
|
8107
8167
|
callError: n ?? {
|
|
8108
8168
|
scope: "unknown",
|
|
8109
8169
|
description: "signaling-unrecognized-error"
|
|
8110
8170
|
},
|
|
8111
8171
|
message: r,
|
|
8112
8172
|
remote: !0
|
|
8113
|
-
})
|
|
8114
|
-
|
|
8115
|
-
let t = new k(e.reason || y.SIGNALING_FAILED, {
|
|
8116
|
-
callError: n ?? {
|
|
8117
|
-
scope: "unknown",
|
|
8118
|
-
description: "signaling-unrecognized-error"
|
|
8119
|
-
},
|
|
8120
|
-
message: r,
|
|
8121
|
-
remote: !0
|
|
8122
|
-
});
|
|
8123
|
-
this.conversationReject?.(t), this.dispose(t);
|
|
8124
|
-
}
|
|
8173
|
+
});
|
|
8174
|
+
this.conversationReject ? this.dispose(i) : this._fail(i);
|
|
8125
8175
|
}
|
|
8126
8176
|
}
|
|
8127
8177
|
_handleCachedMessages() {
|
|
@@ -8132,10 +8182,10 @@ var ho = new Set([
|
|
|
8132
8182
|
}
|
|
8133
8183
|
}
|
|
8134
8184
|
_throwError(e) {
|
|
8135
|
-
this._triggerEvent(
|
|
8185
|
+
this._triggerEvent(Cr.FAILED, e);
|
|
8136
8186
|
}
|
|
8137
8187
|
_onError(e) {
|
|
8138
|
-
this._logger?.log(x.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(
|
|
8188
|
+
this._logger?.log(x.SOCKET_ACTION, "error"), this._debug.error("[signaling] signaling error", e), this._logTransportStat(Tr.FAILED_EXCEPTIONS, { string_value: this._describeErrorEvent(e) });
|
|
8139
8189
|
}
|
|
8140
8190
|
_describeErrorEvent(e) {
|
|
8141
8191
|
let t = e, n = t.error instanceof Error ? t.error : null, r = [n?.name || t.errorInfo?.name, n?.message || t.errorInfo?.message || t.message].filter(Boolean).join(": ") || "Unknown error", i = t.errorInfo?.phase;
|
|
@@ -8145,17 +8195,17 @@ var ho = new Set([
|
|
|
8145
8195
|
this._logger?.log(x.SOCKET_ACTION, "closed"), this._debug.debug("[signaling] connection closed", {
|
|
8146
8196
|
code: e.code,
|
|
8147
8197
|
reason: e.reason
|
|
8148
|
-
})
|
|
8198
|
+
});
|
|
8149
8199
|
}
|
|
8150
8200
|
_terminate(e) {
|
|
8151
8201
|
if (this.disposed) return !1;
|
|
8152
|
-
this.disposed = !0, this.
|
|
8202
|
+
this.disposed = !0, this.session.close();
|
|
8153
8203
|
let t = [
|
|
8154
8204
|
...this.websocketCommandsQueue,
|
|
8155
8205
|
...this.datachannelCommandsQueue,
|
|
8156
8206
|
...Object.values(this.responseHandlers)
|
|
8157
8207
|
], n = this.conversationReject;
|
|
8158
|
-
return this.websocketCommandsQueue = [], this.datachannelCommandsQueue = [], this.responseHandlers = {}, this.incomingCache = [], this.conversationResolve = null, this.conversationReject = null, this.
|
|
8208
|
+
return this.websocketCommandsQueue = [], this.datachannelCommandsQueue = [], this.responseHandlers = {}, this.incomingCache = [], this.conversationResolve = null, this.conversationReject = null, this.listenersReady = !1, this.producerCommandDataChannelEnabled = !1, this.producerNotificationDataChannel && (this.producerNotificationDataChannel.onmessage = null, this.producerNotificationDataChannel = null), this.producerCommandDataChannel && (this.producerCommandDataChannel.onmessage = null, this.producerCommandDataChannel = null), t.forEach((t) => {
|
|
8159
8209
|
window.clearTimeout(t.responseTimer), t.reject(e instanceof kn ? new kn(t.name) : e, !0);
|
|
8160
8210
|
}), n?.(e), !0;
|
|
8161
8211
|
}
|
|
@@ -8183,7 +8233,7 @@ var ho = new Set([
|
|
|
8183
8233
|
}
|
|
8184
8234
|
_handleCommandResponse(t, n) {
|
|
8185
8235
|
if (!Object.hasOwn(this.responseHandlers, n.sequence)) {
|
|
8186
|
-
if (n.participants) for (let e of n.participants) this._triggerEvent(
|
|
8236
|
+
if (n.participants) for (let e of n.participants) this._triggerEvent(Cr.NOTIFICATION, {
|
|
8187
8237
|
...n,
|
|
8188
8238
|
notification: K.PARTICIPANT_ADDED,
|
|
8189
8239
|
type: "notification",
|
|
@@ -8194,7 +8244,7 @@ var ho = new Set([
|
|
|
8194
8244
|
let r = this.responseHandlers[n.sequence];
|
|
8195
8245
|
window.clearTimeout(r.responseTimer);
|
|
8196
8246
|
let i = G.measureMark(r.statMarkName);
|
|
8197
|
-
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(x.SOCKET_ACTION, "response-error"), r.reject(Error(mo(n, `Response error [${r.name}]`)), !0)) : this.
|
|
8247
|
+
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(x.SOCKET_ACTION, "response-error"), r.reject(Error(mo(n, `Response error [${r.name}]`)), !0)) : (r.route === "producer" ? this.session.canSend : this.session.established) ? (delete this.responseHandlers[n.sequence], this._logger?.log(x.SOCKET_ACTION, "response-timeout"), r.reject(Error(mo(n, `Response timeout [${r.name}]`)))) : r.responseTimer = window.setTimeout(() => this._handleCommandResponse(t, n), e.WAIT_RESPONSE_DELAY);
|
|
8198
8248
|
}
|
|
8199
8249
|
_handleCommandsQueue(e) {
|
|
8200
8250
|
for (; e.length > 0;) {
|
|
@@ -8208,11 +8258,11 @@ var ho = new Set([
|
|
|
8208
8258
|
let e = this._serializeBinary(t);
|
|
8209
8259
|
e !== null && this.producerCommandDataChannel.send(e);
|
|
8210
8260
|
} else {
|
|
8211
|
-
if (this.
|
|
8261
|
+
if (!this.session.canSend) {
|
|
8212
8262
|
t.reject(/* @__PURE__ */ Error("Invalid state or socket already closed"));
|
|
8213
8263
|
continue;
|
|
8214
8264
|
}
|
|
8215
|
-
t.needResponse && this._startResponseTimer(t), this.
|
|
8265
|
+
t.needResponse && this._startResponseTimer(t), this.session.send(this._serializeJson(t)).then(() => {
|
|
8216
8266
|
t.needResponse || this._resolveCommandWithoutResponse(t);
|
|
8217
8267
|
}, (e) => {
|
|
8218
8268
|
window.clearTimeout(t.responseTimer), delete this.responseHandlers[t.sequence], t.reject(e, !0);
|
|
@@ -8258,35 +8308,17 @@ var ho = new Set([
|
|
|
8258
8308
|
}
|
|
8259
8309
|
_convertDisplayLayout(e) {
|
|
8260
8310
|
let t = e, n = {};
|
|
8261
|
-
for (let e in t) Object.hasOwn(t, e) && (n[e] =
|
|
8311
|
+
for (let e in t) Object.hasOwn(t, e) && (n[e] = Nn(t[e]));
|
|
8262
8312
|
return { layouts: n };
|
|
8263
8313
|
}
|
|
8264
|
-
_waitConnectionMessage() {
|
|
8265
|
-
let t = this._getSocketType();
|
|
8266
|
-
this.connectionMessageWaitTimer = window.setTimeout(() => {
|
|
8267
|
-
this.conversationReject && this.conversationReject(new k(y.SIGNALING_FAILED, {
|
|
8268
|
-
callError: {
|
|
8269
|
-
scope: "network",
|
|
8270
|
-
source: t,
|
|
8271
|
-
code: "timeout",
|
|
8272
|
-
description: "connection-timeout"
|
|
8273
|
-
},
|
|
8274
|
-
message: "Unable to connect to the signaling: connection timeout",
|
|
8275
|
-
remote: !0
|
|
8276
|
-
}));
|
|
8277
|
-
}, e.WAIT_CONNECTION_DELAY);
|
|
8278
|
-
}
|
|
8279
|
-
_stopWaitConnectionMessage() {
|
|
8280
|
-
window.clearTimeout(this.connectionMessageWaitTimer), this.connectionMessageWaitTimer = 0;
|
|
8281
|
-
}
|
|
8282
8314
|
_onTransportConnecting(e) {
|
|
8283
|
-
let t = e.connectionType ===
|
|
8315
|
+
let t = e.connectionType === Sr.RETRY ? Tr.RECONNECTED : Tr.CONNECTED;
|
|
8284
8316
|
this._markTransportStat(t, e.source);
|
|
8285
8317
|
}
|
|
8286
|
-
|
|
8318
|
+
_onSessionFailed(e) {
|
|
8287
8319
|
switch (e.failure) {
|
|
8288
8320
|
case oo.EMPTY_ENDPOINT:
|
|
8289
|
-
this.
|
|
8321
|
+
this.dispose(new k(y.SIGNALING_FAILED, {
|
|
8290
8322
|
callError: {
|
|
8291
8323
|
scope: "internal",
|
|
8292
8324
|
code: "configuration",
|
|
@@ -8296,13 +8328,17 @@ var ho = new Set([
|
|
|
8296
8328
|
remote: e.remote
|
|
8297
8329
|
}));
|
|
8298
8330
|
break;
|
|
8299
|
-
case oo.
|
|
8300
|
-
this._logReconnectTimeout(), this._fail(new k(
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8331
|
+
case oo.CONNECTION_TIMEOUT:
|
|
8332
|
+
this._logReconnectTimeout(), this._fail(new k(y.SIGNALING_FAILED, {
|
|
8333
|
+
callError: {
|
|
8334
|
+
scope: "network",
|
|
8335
|
+
source: e.source,
|
|
8336
|
+
code: "timeout",
|
|
8337
|
+
description: "connection-timeout"
|
|
8338
|
+
},
|
|
8339
|
+
message: e.message,
|
|
8340
|
+
remote: !0
|
|
8341
|
+
}));
|
|
8306
8342
|
break;
|
|
8307
8343
|
case oo.RECONNECT_TIMEOUT:
|
|
8308
8344
|
this._logReconnectTimeout(), this._fail(new k(O.NETWORK_ERROR, { callError: {
|
|
@@ -8312,19 +8348,22 @@ var ho = new Set([
|
|
|
8312
8348
|
description: "connection-failed"
|
|
8313
8349
|
} }));
|
|
8314
8350
|
break;
|
|
8315
|
-
case oo.ABORTED:
|
|
8316
|
-
this._debug.debug("[signaling] aborted reconnect")
|
|
8351
|
+
case oo.ABORTED: {
|
|
8352
|
+
this._debug.debug("[signaling] aborted reconnect");
|
|
8353
|
+
let e = new k(O.CANCELED);
|
|
8354
|
+
this.conversationReject ? this.dispose(e) : this._fail(e);
|
|
8317
8355
|
break;
|
|
8356
|
+
}
|
|
8318
8357
|
}
|
|
8319
8358
|
}
|
|
8320
|
-
|
|
8321
|
-
this.connectionType =
|
|
8359
|
+
_onSessionReconnectScheduled(e) {
|
|
8360
|
+
this.connectionType = Sr.RETRY, this._debug.log(`[signaling] reconnect signaling after ${e.delay}ms (${e.count})`), this._logger?.log(x.SOCKET_ACTION, "reconnect"), e.count === 1 && this.reconnectStartedAt === null && (this.reconnectStartedAt = performance.now());
|
|
8322
8361
|
}
|
|
8323
8362
|
_logReconnectTimeout() {
|
|
8324
|
-
this.reconnectStartedAt !== null && (this._logTransportStat(
|
|
8363
|
+
this.reconnectStartedAt !== null && (this._logTransportStat(Tr.TIMEOUT, { value: Math.round(performance.now() - this.reconnectStartedAt) }), this.reconnectStartedAt = null);
|
|
8325
8364
|
}
|
|
8326
|
-
|
|
8327
|
-
this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStatSinceMark(
|
|
8365
|
+
_onSessionInactive() {
|
|
8366
|
+
this._debug.warn("[signaling] socket is dead, trying to reconnect"), this._logTransportStatSinceMark(Tr.FAILED_PINGS);
|
|
8328
8367
|
}
|
|
8329
8368
|
_attachNotificationCallError(e) {
|
|
8330
8369
|
e.callError || !e.reason || e.reason === O.FAILED || e.reason === O.UNKNOWN_ERROR || !ho.has(e.reason) && !e.errorCode || (e.callError = {
|
|
@@ -8344,21 +8383,21 @@ var ho = new Set([
|
|
|
8344
8383
|
};
|
|
8345
8384
|
}
|
|
8346
8385
|
_getSocketType() {
|
|
8347
|
-
return this.
|
|
8386
|
+
return this.session.type;
|
|
8348
8387
|
}
|
|
8349
8388
|
_markTransportStat(e, t = this._getSocketType()) {
|
|
8350
|
-
let n =
|
|
8389
|
+
let n = Er[e][t];
|
|
8351
8390
|
G.setMark(n);
|
|
8352
8391
|
}
|
|
8353
8392
|
_logTransportStat(e, t) {
|
|
8354
|
-
let n = this._getSocketType(), r =
|
|
8393
|
+
let n = this._getSocketType(), r = Er[e][n];
|
|
8355
8394
|
this._statAggregator?.logEventualStat({
|
|
8356
8395
|
name: r,
|
|
8357
8396
|
...t
|
|
8358
8397
|
});
|
|
8359
8398
|
}
|
|
8360
8399
|
_logTransportStatSinceMark(e) {
|
|
8361
|
-
let t = this._getSocketType(), n =
|
|
8400
|
+
let t = this._getSocketType(), n = Er[e][t];
|
|
8362
8401
|
this._statAggregator?.logEventualStatSinceMark({ name: n });
|
|
8363
8402
|
}
|
|
8364
8403
|
}, _o = /* @__PURE__ */ function(e) {
|
|
@@ -8874,8 +8913,8 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
|
|
|
8874
8913
|
this._lastRequests && (this._pendingRequests = this._lastRequests.slice(), this._forceNextFlush = !0, this._schedule());
|
|
8875
8914
|
}
|
|
8876
8915
|
cleanupParticipant(e) {
|
|
8877
|
-
for (let t of Object.keys(this._requestedLayouts))
|
|
8878
|
-
for (let t of Object.keys(this._uncertainLayouts))
|
|
8916
|
+
for (let t of Object.keys(this._requestedLayouts)) Ln(t).participantId === e && delete this._requestedLayouts[t];
|
|
8917
|
+
for (let t of Object.keys(this._uncertainLayouts)) Ln(t).participantId === e && delete this._uncertainLayouts[t];
|
|
8879
8918
|
}
|
|
8880
8919
|
clear() {
|
|
8881
8920
|
this._generation++, this._timer !== null && (window.clearTimeout(this._timer), this._timer = null), this._pendingPromises.forEach(({ resolve: e }) => e()), this._requestedLayouts = {}, this._uncertainLayouts = {}, this._pendingRequests = null, this._pendingPromises = [], this._lastRequests = null, this._inFlight = !1, this._lastFlushAt = null, this._forceNextFlush = !1;
|
|
@@ -8922,7 +8961,7 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
|
|
|
8922
8961
|
continue;
|
|
8923
8962
|
}
|
|
8924
8963
|
if (!r[a] && !this._isMe(a)) continue;
|
|
8925
|
-
let o =
|
|
8964
|
+
let o = In({
|
|
8926
8965
|
participantId: a,
|
|
8927
8966
|
mediaType: i.mediaType,
|
|
8928
8967
|
streamName: i.streamName
|
|
@@ -9089,14 +9128,14 @@ var Xo = 90, Zo = 3, Qo = class extends Ye {
|
|
|
9089
9128
|
this._triggerEvent("VOLUMES_DETECTED", e);
|
|
9090
9129
|
}
|
|
9091
9130
|
_getAudioTrackLevelByParticipantId(e) {
|
|
9092
|
-
let t = this._detectors.get(
|
|
9131
|
+
let t = this._detectors.get(mi.AUDIO_MIX);
|
|
9093
9132
|
return t ? t.getLevel() : this._getTransparentAudioLevelByParticipantId(e);
|
|
9094
9133
|
}
|
|
9095
9134
|
_getTransparentAudioLevelByParticipantId(e) {
|
|
9096
9135
|
if (!this._activeParticipants?.includes(e)) return null;
|
|
9097
9136
|
let t = null;
|
|
9098
9137
|
return this._detectors.forEach((e, n) => {
|
|
9099
|
-
if (!n.startsWith(`${
|
|
9138
|
+
if (!n.startsWith(`${mi.TRANSPARENT_AUDIO_TRACK_PREFIX}-`)) return;
|
|
9100
9139
|
let r = e.getLevel();
|
|
9101
9140
|
(!t || r.real > t.real) && (t = r);
|
|
9102
9141
|
}), t;
|
|
@@ -9612,18 +9651,6 @@ var Ls = "sessions", Rs = 5, zs = class e {
|
|
|
9612
9651
|
this._release(), t !== "missing" && e();
|
|
9613
9652
|
});
|
|
9614
9653
|
}
|
|
9615
|
-
stop() {
|
|
9616
|
-
if (this._status !== "active" && this._status !== "starting") return;
|
|
9617
|
-
let e = this._creation === null ? null : this._key;
|
|
9618
|
-
if (this._finish(), e === null) {
|
|
9619
|
-
this._release();
|
|
9620
|
-
return;
|
|
9621
|
-
}
|
|
9622
|
-
Q.removeTail(e).then(() => this._release());
|
|
9623
|
-
}
|
|
9624
|
-
abandon() {
|
|
9625
|
-
this._status !== "active" && this._status !== "starting" || (this._clearTimer(), this._status = "abandoned", this._release());
|
|
9626
|
-
}
|
|
9627
9654
|
_requestLock() {
|
|
9628
9655
|
let t = this._key, n = !1;
|
|
9629
9656
|
if (t !== null) try {
|
|
@@ -10067,17 +10094,11 @@ var nc = class extends f {
|
|
|
10067
10094
|
return e._pending = [], e._pendingOverflow = !1, t;
|
|
10068
10095
|
}
|
|
10069
10096
|
constructor(e, t, n, r = () => void 0) {
|
|
10070
|
-
super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "
|
|
10097
|
+
super(), h(this, "_externalLogger", void 0), h(this, "_conversationIdProvider", void 0), h(this, "_topologyProvider", void 0), h(this, "_legacy", void 0), this._externalLogger = t, this._conversationIdProvider = n, this._topologyProvider = r, this._legacy = N.statQueueEnabled ? null : new nc(e, t, n, r);
|
|
10071
10098
|
}
|
|
10072
10099
|
log(e, t, n = !1) {
|
|
10073
10100
|
this._externalLogger && this._externalLogger.log(e, t, n);
|
|
10074
10101
|
}
|
|
10075
|
-
enterUnloadMode() {
|
|
10076
|
-
this._legacy || (this._unloadMode = !0);
|
|
10077
|
-
}
|
|
10078
|
-
exitUnloadMode() {
|
|
10079
|
-
this._unloadMode = !1;
|
|
10080
|
-
}
|
|
10081
10102
|
logClientStats(t, n = {}) {
|
|
10082
10103
|
let r = this._makeEntry(t, n);
|
|
10083
10104
|
if (R.onClientStats({
|
|
@@ -10088,7 +10109,6 @@ var nc = class extends f {
|
|
|
10088
10109
|
this._legacy.logClientStats(t, n);
|
|
10089
10110
|
return;
|
|
10090
10111
|
}
|
|
10091
|
-
if (this._unloadMode) return;
|
|
10092
10112
|
Ks.ensure();
|
|
10093
10113
|
let i = v.userId;
|
|
10094
10114
|
if (i === null) {
|
|
@@ -10523,7 +10543,7 @@ var xc = class {
|
|
|
10523
10543
|
this._finish({ reason: "terminated" });
|
|
10524
10544
|
}
|
|
10525
10545
|
destroy() {
|
|
10526
|
-
this._destroyed || (this.
|
|
10546
|
+
this._destroyed || (this._destroyed = !0, this._pendingEvents = []);
|
|
10527
10547
|
}
|
|
10528
10548
|
_canRecord() {
|
|
10529
10549
|
return this._callStartLabel !== null && !this._finished && !this._destroyed;
|
|
@@ -10681,54 +10701,19 @@ var xc = class {
|
|
|
10681
10701
|
this.report(e);
|
|
10682
10702
|
}), this._codecUsages.clear();
|
|
10683
10703
|
}
|
|
10684
|
-
}, Tc =
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10688
|
-
|
|
10689
|
-
let t =
|
|
10690
|
-
|
|
10691
|
-
...this._resources?.takeReport() ?? {}
|
|
10692
|
-
};
|
|
10693
|
-
this._lastCallStatContext = this._getCallStatContext(t), this._flushEventualStats(), this._logger.logClientStats(t);
|
|
10694
|
-
}
|
|
10695
|
-
logEventualStat(e) {
|
|
10696
|
-
this._eventualLogs.add({
|
|
10697
|
-
data: e,
|
|
10698
|
-
occurredAt: Date.now()
|
|
10699
|
-
});
|
|
10704
|
+
}, Tc = "unknown";
|
|
10705
|
+
function Ec(e) {
|
|
10706
|
+
if (typeof e == "string") return e || Tc;
|
|
10707
|
+
if (typeof e == "number") return String(e);
|
|
10708
|
+
if (typeof e == "object" && e) {
|
|
10709
|
+
let { name: t, message: n } = e, r = typeof t == "string" ? t : "", i = typeof n == "string" ? n : "";
|
|
10710
|
+
return r && i ? `${r}: ${i}` : r || i || Tc;
|
|
10700
10711
|
}
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
});
|
|
10707
|
-
}
|
|
10708
|
-
destroy() {
|
|
10709
|
-
this._flushEventualStats();
|
|
10710
|
-
}
|
|
10711
|
-
_getCallStatContext(e) {
|
|
10712
|
-
return {
|
|
10713
|
-
call_topology: e.call_topology,
|
|
10714
|
-
local_address: e.local_address,
|
|
10715
|
-
local_connection_type: e.local_connection_type,
|
|
10716
|
-
network_type: e.network_type,
|
|
10717
|
-
remote_address: e.remote_address,
|
|
10718
|
-
remote_connection_type: e.remote_connection_type,
|
|
10719
|
-
transport: e.transport
|
|
10720
|
-
};
|
|
10721
|
-
}
|
|
10722
|
-
_flushEventualStats() {
|
|
10723
|
-
let e = [...this._eventualLogs];
|
|
10724
|
-
for (let t of e) this._logEventualStat(t), this._eventualLogs.delete(t);
|
|
10725
|
-
}
|
|
10726
|
-
_logEventualStat({ data: e, occurredAt: t }) {
|
|
10727
|
-
let n = { ...this._lastCallStatContext ?? {} };
|
|
10728
|
-
for (let [t, r] of Object.entries(e)) r !== void 0 && (r === null ? delete n[t] : n[t] = r);
|
|
10729
|
-
this._logger.logClientStats(n, { occurredAt: t });
|
|
10730
|
-
}
|
|
10731
|
-
}, Ec = class {
|
|
10712
|
+
return Tc;
|
|
10713
|
+
}
|
|
10714
|
+
//#endregion
|
|
10715
|
+
//#region src/utils/P2Quantile.ts
|
|
10716
|
+
var Dc = class {
|
|
10732
10717
|
constructor(e) {
|
|
10733
10718
|
if (h(this, "q", void 0), h(this, "inits", []), h(this, "n", [
|
|
10734
10719
|
1,
|
|
@@ -10787,7 +10772,7 @@ var xc = class {
|
|
|
10787
10772
|
5
|
|
10788
10773
|
];
|
|
10789
10774
|
}
|
|
10790
|
-
},
|
|
10775
|
+
}, Oc = class {
|
|
10791
10776
|
constructor() {
|
|
10792
10777
|
h(this, "n", 0), h(this, "mean", 0);
|
|
10793
10778
|
}
|
|
@@ -10799,9 +10784,9 @@ var xc = class {
|
|
|
10799
10784
|
get avg() {
|
|
10800
10785
|
return this.n ? this.mean : NaN;
|
|
10801
10786
|
}
|
|
10802
|
-
},
|
|
10787
|
+
}, kc = class {
|
|
10803
10788
|
constructor() {
|
|
10804
|
-
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new
|
|
10789
|
+
h(this, "count", 0), h(this, "minVal", Infinity), h(this, "maxVal", -Infinity), h(this, "mean", new Oc()), h(this, "p50", new Dc(.5)), h(this, "p95", new Dc(.95));
|
|
10805
10790
|
}
|
|
10806
10791
|
add(e) {
|
|
10807
10792
|
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++;
|
|
@@ -10819,18 +10804,107 @@ var xc = class {
|
|
|
10819
10804
|
get hasData() {
|
|
10820
10805
|
return this.count > 0;
|
|
10821
10806
|
}
|
|
10822
|
-
},
|
|
10807
|
+
}, Ac = "tmp.ml.vad", jc = class {
|
|
10808
|
+
constructor(e, t = null) {
|
|
10809
|
+
h(this, "_statAggregator", void 0), h(this, "_logger", void 0), h(this, "_vadInference", new kc()), h(this, "_readyModels", /* @__PURE__ */ new Set()), h(this, "_sentErrors", /* @__PURE__ */ new Set()), this._statAggregator = e, this._logger = t;
|
|
10810
|
+
}
|
|
10811
|
+
logModelReady(e, t) {
|
|
10812
|
+
!Number.isFinite(t) || this._readyModels.has(e) || (this._readyModels.add(e), this._statAggregator?.logEventualStat({
|
|
10813
|
+
name: U.ML_READY_TO_USE,
|
|
10814
|
+
value: Math.max(0, Math.round(t)),
|
|
10815
|
+
source: e
|
|
10816
|
+
}));
|
|
10817
|
+
}
|
|
10818
|
+
logModelError(e, t) {
|
|
10819
|
+
let n = Ec(t), r = `${e}:${n}`;
|
|
10820
|
+
this._sentErrors.has(r) || (this._sentErrors.add(r), this._statAggregator?.logEventualStat({
|
|
10821
|
+
name: U.ML_ERROR,
|
|
10822
|
+
source: e,
|
|
10823
|
+
string_value: n
|
|
10824
|
+
}));
|
|
10825
|
+
}
|
|
10826
|
+
addVadInference(e) {
|
|
10827
|
+
Number.isFinite(e) && e >= 0 && this._vadInference.add(Math.round(e * 1e3));
|
|
10828
|
+
}
|
|
10829
|
+
logSummaries() {
|
|
10830
|
+
this.summaries().forEach((e) => this._logger?.logClientStats(e));
|
|
10831
|
+
}
|
|
10832
|
+
summaries() {
|
|
10833
|
+
if (!this._vadInference.hasData) return [];
|
|
10834
|
+
let e = this._vadInference.snapshot();
|
|
10835
|
+
return [{
|
|
10836
|
+
name: U.SIGNALING_COMMAND_SUMMARY,
|
|
10837
|
+
api_method: Ac,
|
|
10838
|
+
min_value: e.min,
|
|
10839
|
+
max_value: e.max,
|
|
10840
|
+
avg_value: e.avg,
|
|
10841
|
+
median_value: e.median,
|
|
10842
|
+
p95_value: e.p95,
|
|
10843
|
+
values_count: e.count
|
|
10844
|
+
}];
|
|
10845
|
+
}
|
|
10846
|
+
destroy() {
|
|
10847
|
+
this._vadInference = new kc();
|
|
10848
|
+
}
|
|
10849
|
+
}, Mc = class {
|
|
10850
|
+
constructor(e, t = null) {
|
|
10851
|
+
h(this, "_logger", void 0), h(this, "_resources", void 0), h(this, "_eventualLogs", /* @__PURE__ */ new Set()), h(this, "_lastCallStatContext", null), this._logger = e, this._resources = t;
|
|
10852
|
+
}
|
|
10853
|
+
logCallStat(e) {
|
|
10854
|
+
let t = {
|
|
10855
|
+
...e,
|
|
10856
|
+
...this._resources?.takeReport() ?? {}
|
|
10857
|
+
};
|
|
10858
|
+
this._lastCallStatContext = this._getCallStatContext(t), this._flushEventualStats(), this._logger.logClientStats(t);
|
|
10859
|
+
}
|
|
10860
|
+
logEventualStat(e) {
|
|
10861
|
+
this._eventualLogs.add({
|
|
10862
|
+
data: e,
|
|
10863
|
+
occurredAt: Date.now()
|
|
10864
|
+
});
|
|
10865
|
+
}
|
|
10866
|
+
logEventualStatSinceMark(e) {
|
|
10867
|
+
let t = G.measureMark(e.name);
|
|
10868
|
+
t !== null && this.logEventualStat({
|
|
10869
|
+
...e,
|
|
10870
|
+
value: t
|
|
10871
|
+
});
|
|
10872
|
+
}
|
|
10873
|
+
destroy() {
|
|
10874
|
+
this._flushEventualStats();
|
|
10875
|
+
}
|
|
10876
|
+
_getCallStatContext(e) {
|
|
10877
|
+
return {
|
|
10878
|
+
call_topology: e.call_topology,
|
|
10879
|
+
local_address: e.local_address,
|
|
10880
|
+
local_connection_type: e.local_connection_type,
|
|
10881
|
+
network_type: e.network_type,
|
|
10882
|
+
remote_address: e.remote_address,
|
|
10883
|
+
remote_connection_type: e.remote_connection_type,
|
|
10884
|
+
transport: e.transport
|
|
10885
|
+
};
|
|
10886
|
+
}
|
|
10887
|
+
_flushEventualStats() {
|
|
10888
|
+
let e = [...this._eventualLogs];
|
|
10889
|
+
for (let t of e) this._logEventualStat(t), this._eventualLogs.delete(t);
|
|
10890
|
+
}
|
|
10891
|
+
_logEventualStat({ data: e, occurredAt: t }) {
|
|
10892
|
+
let n = { ...this._lastCallStatContext ?? {} };
|
|
10893
|
+
for (let [t, r] of Object.entries(e)) r !== void 0 && (r === null ? delete n[t] : n[t] = r);
|
|
10894
|
+
this._logger.logClientStats(n, { occurredAt: t });
|
|
10895
|
+
}
|
|
10896
|
+
}, Nc = 120 * 1e3, Pc = class {
|
|
10823
10897
|
constructor(e) {
|
|
10824
10898
|
h(this, "_logger", void 0), h(this, "trackerByTransport", {
|
|
10825
|
-
ws: new
|
|
10826
|
-
wt: new
|
|
10899
|
+
ws: new kc(),
|
|
10900
|
+
wt: new kc()
|
|
10827
10901
|
}), h(this, "lastSeen", {}), this._logger = e;
|
|
10828
10902
|
}
|
|
10829
10903
|
mark(e) {
|
|
10830
10904
|
let t = Date.now(), n = this.lastSeen[e];
|
|
10831
10905
|
if (typeof n == "number") {
|
|
10832
10906
|
let r = t - n;
|
|
10833
|
-
r >= 0 && r <=
|
|
10907
|
+
r >= 0 && r <= Nc && this.trackerByTransport[e].add(r);
|
|
10834
10908
|
}
|
|
10835
10909
|
this.lastSeen[e] = t;
|
|
10836
10910
|
}
|
|
@@ -10839,7 +10913,7 @@ var xc = class {
|
|
|
10839
10913
|
}
|
|
10840
10914
|
summaries() {
|
|
10841
10915
|
let e = [];
|
|
10842
|
-
return [
|
|
10916
|
+
return [wr.WEBSOCKET, wr.WEBTRANSPORT].forEach((t) => {
|
|
10843
10917
|
if (!this.trackerByTransport[t].hasData) return;
|
|
10844
10918
|
let n = this.trackerByTransport[t].snapshot();
|
|
10845
10919
|
e.push({
|
|
@@ -10859,17 +10933,17 @@ var xc = class {
|
|
|
10859
10933
|
}
|
|
10860
10934
|
destroy() {
|
|
10861
10935
|
this.trackerByTransport = {
|
|
10862
|
-
ws: new
|
|
10863
|
-
wt: new
|
|
10936
|
+
ws: new kc(),
|
|
10937
|
+
wt: new kc()
|
|
10864
10938
|
}, this.lastSeen = {};
|
|
10865
10939
|
}
|
|
10866
|
-
},
|
|
10940
|
+
}, Fc = class {
|
|
10867
10941
|
constructor(e) {
|
|
10868
10942
|
h(this, "_logger", void 0), h(this, "trackerByCommand", /* @__PURE__ */ new Map()), this._logger = e;
|
|
10869
10943
|
}
|
|
10870
10944
|
mark(e, t, n) {
|
|
10871
10945
|
let r = `${e}|${n}`, i;
|
|
10872
|
-
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new
|
|
10946
|
+
this.trackerByCommand.has(r) ? i = this.trackerByCommand.get(r) : (i = new kc(), this.trackerByCommand.set(r, i)), i.add(t);
|
|
10873
10947
|
}
|
|
10874
10948
|
logMetrics() {
|
|
10875
10949
|
this.summaries().forEach((e) => this._logger.logClientStats(e));
|
|
@@ -10896,15 +10970,12 @@ var xc = class {
|
|
|
10896
10970
|
destroy() {
|
|
10897
10971
|
this.trackerByCommand.clear();
|
|
10898
10972
|
}
|
|
10899
|
-
},
|
|
10973
|
+
}, Ic = class {
|
|
10900
10974
|
constructor(e, t, n, r, i) {
|
|
10901
|
-
h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "apiCalls", void 0), h(this, "resources", void 0), h(this, "battery", void 0), h(this, "
|
|
10902
|
-
}
|
|
10903
|
-
prepareForUnload() {
|
|
10904
|
-
N.statQueueEnabled && (this._unloading = !0, this._tail?.abandon(), this.logger.enterUnloadMode(), this.pings.logMetrics(), this.signalingCommands.logMetrics());
|
|
10975
|
+
h(this, "logger", void 0), h(this, "lifecycle", void 0), h(this, "statAggregator", void 0), h(this, "codecStatsAggregator", void 0), h(this, "pings", void 0), h(this, "signalingCommands", void 0), h(this, "apiCalls", void 0), h(this, "resources", void 0), h(this, "battery", void 0), h(this, "ml", void 0), h(this, "_api", void 0), h(this, "_tail", void 0), this.logger = new rc(e, t, n, r), this._tail = N.statQueueEnabled && Ws.isSupported() ? new Ws(this.logger, () => this._callSummaries()) : null, this.lifecycle = new xc(this.logger, void 0, this._tail), this.resources = new Cc(i), this.statAggregator = new Mc(this.logger, this.resources), this.codecStatsAggregator = new wc(this.logger, r), this.pings = new Pc(this.logger), this.signalingCommands = new Fc(this.logger), this.apiCalls = new ic(this.statAggregator), this.ml = new jc(this.statAggregator, this.logger), this._api = e, this._api.setApiCallStats(this.apiCalls), this.battery = new oc(this.logger);
|
|
10905
10976
|
}
|
|
10906
|
-
|
|
10907
|
-
N.statQueueEnabled
|
|
10977
|
+
onPageHide() {
|
|
10978
|
+
N.statQueueEnabled || this.destroy();
|
|
10908
10979
|
}
|
|
10909
10980
|
resetPingBaseline() {
|
|
10910
10981
|
this.pings.resetBaseline();
|
|
@@ -10913,19 +10984,20 @@ var xc = class {
|
|
|
10913
10984
|
this.lifecycle.markFinished(e);
|
|
10914
10985
|
}
|
|
10915
10986
|
flushCallMetrics() {
|
|
10916
|
-
this.codecStatsAggregator.destroy(), this.pings.logMetrics(), this.pings.destroy(), this.signalingCommands.logMetrics(), this.signalingCommands.destroy();
|
|
10987
|
+
this.codecStatsAggregator.destroy(), this.pings.logMetrics(), this.pings.destroy(), this.signalingCommands.logMetrics(), this.signalingCommands.destroy(), this.ml.logSummaries(), this.ml.destroy();
|
|
10917
10988
|
}
|
|
10918
10989
|
destroy() {
|
|
10919
|
-
this._api.setApiCallStats(null), this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.resources.destroy(), this.battery.destroy(), this.logger.destroy(), N.statQueueEnabled &&
|
|
10990
|
+
this._api.setApiCallStats(null), this.lifecycle.markTerminated(), this.lifecycle.destroy(), this.statAggregator.destroy(), this.codecStatsAggregator.destroy(), this.pings.destroy(), this.signalingCommands.destroy(), this.ml.destroy(), this.resources.destroy(), this.battery.destroy(), this.logger.destroy(), N.statQueueEnabled && tc.notifyCallFinished();
|
|
10920
10991
|
}
|
|
10921
10992
|
_callSummaries() {
|
|
10922
10993
|
return [
|
|
10923
10994
|
...this.codecStatsAggregator.usageReports(),
|
|
10924
10995
|
...this.pings.summaries(),
|
|
10925
|
-
...this.signalingCommands.summaries()
|
|
10996
|
+
...this.signalingCommands.summaries(),
|
|
10997
|
+
...this.ml.summaries()
|
|
10926
10998
|
];
|
|
10927
10999
|
}
|
|
10928
|
-
},
|
|
11000
|
+
}, Lc = class {
|
|
10929
11001
|
constructor(e) {
|
|
10930
11002
|
h(this, "_statAggregator", void 0), h(this, "_isCallMarked", !1), h(this, "_isFinished", !1), h(this, "_callType", null), this._statAggregator = e;
|
|
10931
11003
|
}
|
|
@@ -10950,8 +11022,8 @@ var xc = class {
|
|
|
10950
11022
|
call_type: this._callType
|
|
10951
11023
|
}));
|
|
10952
11024
|
}
|
|
10953
|
-
},
|
|
10954
|
-
function
|
|
11025
|
+
}, Rc = 1e3, zc = 1e4;
|
|
11026
|
+
function Bc(e, t, n, r) {
|
|
10955
11027
|
return new k(e, {
|
|
10956
11028
|
callError: {
|
|
10957
11029
|
scope: "external",
|
|
@@ -10962,9 +11034,9 @@ function Ic(e, t, n, r) {
|
|
|
10962
11034
|
message: r
|
|
10963
11035
|
});
|
|
10964
11036
|
}
|
|
10965
|
-
var
|
|
11037
|
+
var Vc = 15, $ = class e extends Ye {
|
|
10966
11038
|
constructor(e, t) {
|
|
10967
|
-
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, "_requestingLocalMedia", !1), h(this, "_requestedLocalAudio", void 0), h(this, "_requestedLocalVideo", void 0), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings",
|
|
11039
|
+
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, "_requestingLocalMedia", !1), h(this, "_requestedLocalAudio", void 0), h(this, "_requestedLocalVideo", void 0), h(this, "_conversation", null), h(this, "_myLastRequestedLayouts", {}), h(this, "_state", "IDLE"), h(this, "_previousState", null), h(this, "_waitingHallHoldPending", !1), h(this, "_participantState", X.CALLED), h(this, "_participants", {}), h(this, "_directTransportIsMaster", void 0), h(this, "_transport", null), h(this, "_debugInfo", null), h(this, "_debug", z.createSessionLogger()), h(this, "_volumesDetector", null), h(this, "_speakerDetector", null), h(this, "_localVolumeDetector", null), h(this, "_specListener", null), h(this, "_activeSpeakerId", null), h(this, "_lastSignalledActiveSpeakerId", null), h(this, "_isRealTimeAsrRequested", !1), h(this, "_serverSettings", Wr()), h(this, "_serverTimeOffset", 0), h(this, "_serverConversationId", null), h(this, "_onFastHangup", void 0), h(this, "_hangupEmitted", !1), h(this, "_hangupPromise", null), h(this, "_hangupReason", null), h(this, "_abortController", null), h(this, "_registeredPeerReceived", !1), h(this, "_calleeUnavailableTimer", null), h(this, "_pendingId", null), h(this, "_resolveSignalingInitialization", void 0), h(this, "_signalingInitialization", new Promise((e) => {
|
|
10968
11040
|
this._resolveSignalingInitialization = e;
|
|
10969
11041
|
})), h(this, "_onUnload", void 0), h(this, "_onRestore", void 0), h(this, "_onVisibilityChange", void 0), h(this, "_audioOutput", void 0), h(this, "_stats", void 0), h(this, "_lastStalled", {}), h(this, "_audioMixStalled", !1), h(this, "_audioFix", null), h(this, "_streamByStreamId", /* @__PURE__ */ new Map()), h(this, "_streamIdByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_streamWaitTimerByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_sequenceNumberByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownTimestampByStreamDescription", /* @__PURE__ */ new Map()), h(this, "_cooldownQueueCleanupTimer", null), h(this, "_statFirstMediaReceived", void 0), h(this, "_toggleLocalVideo", Wo((e) => {
|
|
10970
11042
|
if (this._mediaSource) return this._stats.logger.log(x.MEDIA_STATUS, e ? "video_1" : "video_0"), this._mediaSource.toggleVideo(e);
|
|
@@ -10980,7 +11052,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
10980
11052
|
captureAudio: !1
|
|
10981
11053
|
});
|
|
10982
11054
|
}
|
|
10983
|
-
}, 100)), this._stats = new
|
|
11055
|
+
}, 100)), this._stats = new Ic(e, t, () => this._conversation?.id || null, () => this._transport?.getTopology() ?? this._conversation?.topology, {
|
|
10984
11056
|
getActiveFeatures: () => this._mediaSource?.activeFeatures ?? [],
|
|
10985
11057
|
getParticipantsCount: () => this._getParticipantsCount()
|
|
10986
11058
|
}), this._api = e, this._signaling = new go(this._debug, this._stats.logger, this._stats.statAggregator, this._stats.pings, this._stats.signalingCommands), this._signalingActor = new rs(this._onSignalingNotification.bind(this), this._debug), this._displayLayoutRequester = new $o({
|
|
@@ -10991,12 +11063,12 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
10991
11063
|
updateDisplayLayout: (e) => this.updateDisplayLayout(e),
|
|
10992
11064
|
onNonFatalError: (e) => this._onNonFatalError(e)
|
|
10993
11065
|
}), this._onUnload = () => {
|
|
10994
|
-
this._stopFirstMediaSentProbe(), this._stats.resetPingBaseline(), this._conversation && this._api && this._sendHangupApi(this._conversation.id, this._state === "IDLE" ? O.CANCELED : O.HUNGUP), this._stats.
|
|
11066
|
+
this._stopFirstMediaSentProbe(), this._stats.resetPingBaseline(), this._conversation && this._api && this._sendHangupApi(this._conversation.id, this._state === "IDLE" ? O.CANCELED : O.HUNGUP), this._stats.onPageHide();
|
|
10995
11067
|
}, this._onRestore = () => {
|
|
10996
|
-
this._stats.resetPingBaseline()
|
|
11068
|
+
this._stats.resetPingBaseline();
|
|
10997
11069
|
}, this._onVisibilityChange = () => {
|
|
10998
11070
|
document.visibilityState === "hidden" && this._stats.resetPingBaseline();
|
|
10999
|
-
}, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), document.addEventListener("visibilitychange", this._onVisibilityChange), this._statFirstMediaReceived = new
|
|
11071
|
+
}, window.addEventListener("pagehide", this._onUnload), window.addEventListener("pageshow", this._onRestore), document.addEventListener("visibilitychange", this._onVisibilityChange), this._statFirstMediaReceived = new Lc(this._stats.statAggregator), this._audioOutput = new Ko(this._statFirstMediaReceived, N.transparentAudio, this._debug, this._stats.logger), N.videoTracksCount > 0 && (this._cooldownQueueCleanupTimer = window.setInterval(this._cleanupCooldownQueue.bind(this), Rc));
|
|
11000
11072
|
}
|
|
11001
11073
|
static current() {
|
|
11002
11074
|
return B.getActive() ?? (N.hold ? null : B.getFirst());
|
|
@@ -11315,7 +11387,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
11315
11387
|
if (n?.status === "rejected") throw n.reason;
|
|
11316
11388
|
}).finally(() => {
|
|
11317
11389
|
o.abort(), this._signaling.dispose(), B.removeHangup(this._hangupPromise);
|
|
11318
|
-
}), B.trackHangup(this, this._hangupPromise), this._hangupReason = n, this._state = "CLOSE", this._participantState = X.HUNGUP, this._resolveSignalingInitialization(!1), this._abortController?.abort(n), this._emitHangupOnce(n, r || null), this._stats.logger.log(x.HANGUP, t), this._finishLifecycle(n), this._stats.flushCallMetrics(), this._cleanupTransport(), this._destroy(void 0, !0), this._hangupPromise;
|
|
11390
|
+
}), B.trackHangup(this, this._hangupPromise), this._hangupReason = n, this._state = "CLOSE", this._participantState = X.HUNGUP, this._resolveSignalingInitialization(!1), a && this._signaling.setAbortSignal(void 0), this._abortController?.abort(n), this._emitHangupOnce(n, r || null), this._stats.logger.log(x.HANGUP, t), this._finishLifecycle(n), this._stats.flushCallMetrics(), this._cleanupTransport(), this._destroy(void 0, !0), this._hangupPromise;
|
|
11319
11391
|
}
|
|
11320
11392
|
async _waitForHangup(e, t) {
|
|
11321
11393
|
let n;
|
|
@@ -11505,10 +11577,10 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
11505
11577
|
isVideo: f,
|
|
11506
11578
|
joiningAllowed: a,
|
|
11507
11579
|
requireAuthToJoin: o
|
|
11508
|
-
}, this._abortController?.signal), !e) throw
|
|
11580
|
+
}, this._abortController?.signal), !e) throw Bc(O.FAST_START_ERROR, "invalid-response", "fast-start-response-empty");
|
|
11509
11581
|
if (!e.internalCallerParams) {
|
|
11510
11582
|
let t = e.rejectedParticipants[0]?.status;
|
|
11511
|
-
throw
|
|
11583
|
+
throw Bc(O.FAST_START_ERROR, t ? "fast-start" : "invalid-response", t ?? "fast-start-internal-caller-params-empty", JSON.stringify(e));
|
|
11512
11584
|
}
|
|
11513
11585
|
} catch (e) {
|
|
11514
11586
|
throw this._state === "CLOSE" ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_START_ERROR, { message: e.message }) : new k(O.FAST_START_ERROR, { message: String(e) });
|
|
@@ -11530,11 +11602,11 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
11530
11602
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
11531
11603
|
}, this._debug.debug("FastStart", p), m = "fastStart";
|
|
11532
11604
|
} catch {
|
|
11533
|
-
throw
|
|
11605
|
+
throw Bc(O.FAST_START_ERROR, "invalid-response", "fast-start-internal-caller-params-invalid");
|
|
11534
11606
|
}
|
|
11535
11607
|
} else p = await this._api.startConversation(d, e, t, f, i, a, o, { onlyAdminCanShareMovie: s }, c), this._debug.debug("Api.startConversation", p), m = "startConversation";
|
|
11536
11608
|
qo(p, m), this._applyServerConversation(p.id), this._pendingId = p.id, this._setConversationParams(p), this._stats.lifecycle.bindConversationId(p.id);
|
|
11537
|
-
let ee = await this._connectSignaling(
|
|
11609
|
+
let ee = await this._connectSignaling(Sr.START, p);
|
|
11538
11610
|
return this._throwIfClosed(), this._setConversation(p, ee, n), this._stats.lifecycle.markCallStarted(), ee;
|
|
11539
11611
|
}
|
|
11540
11612
|
async _joinConversation(e) {
|
|
@@ -11558,9 +11630,9 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
11558
11630
|
joinLink: i,
|
|
11559
11631
|
isVideo: c,
|
|
11560
11632
|
internalParams: this._buildInternalParams()
|
|
11561
|
-
}, this._abortController?.signal), !e) throw
|
|
11562
|
-
if (!e.internalCallerParams) throw
|
|
11563
|
-
if (!e.conversationId) throw
|
|
11633
|
+
}, this._abortController?.signal), !e) throw Bc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-response-empty");
|
|
11634
|
+
if (!e.internalCallerParams) throw Bc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-empty", JSON.stringify(e));
|
|
11635
|
+
if (!e.conversationId) throw Bc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-conversation-id-empty", JSON.stringify(e));
|
|
11564
11636
|
} catch (e) {
|
|
11565
11637
|
throw this._state === "CLOSE" ? new k(O.CANCELED) : e instanceof k ? e : e instanceof Error ? new k(O.FAST_JOIN_ERROR, { message: e.message }) : new k(O.FAST_JOIN_ERROR, { message: String(e) });
|
|
11566
11638
|
}
|
|
@@ -11578,7 +11650,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
11578
11650
|
token: new URL(t.endpoint).searchParams.get("token") ?? ""
|
|
11579
11651
|
}, this._debug.debug("FastJoin", l), u = "fastJoin";
|
|
11580
11652
|
} catch (e) {
|
|
11581
|
-
throw e instanceof k ? e :
|
|
11653
|
+
throw e instanceof k ? e : Bc(O.FAST_JOIN_ERROR, "invalid-response", "fast-join-internal-caller-params-invalid");
|
|
11582
11654
|
}
|
|
11583
11655
|
} else if (t) l = await this._api.joinConversation(t, c, r), u = "joinConversation";
|
|
11584
11656
|
else if (i) l = await this._api.joinConversationByLink(i, c, a, o), u = "joinConversationByLink";
|
|
@@ -11592,7 +11664,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
11592
11664
|
this._pendingId = l.id;
|
|
11593
11665
|
}
|
|
11594
11666
|
this._setConversationParams(l);
|
|
11595
|
-
let d = await this._connectSignaling(
|
|
11667
|
+
let d = await this._connectSignaling(Sr.JOIN, l);
|
|
11596
11668
|
return this._throwIfClosed(), this._setConversation(l, d, _o.JOINING), this._stats.lifecycle.markCallStarted(), d;
|
|
11597
11669
|
}
|
|
11598
11670
|
async _prepareConversation(e, t = j.USER, n, r, i) {
|
|
@@ -11654,7 +11726,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
11654
11726
|
conversationParams: n
|
|
11655
11727
|
}), l.wt_endpoint = c);
|
|
11656
11728
|
}
|
|
11657
|
-
let u = await this._connectSignaling(
|
|
11729
|
+
let u = await this._connectSignaling(Sr.ACCEPT, l);
|
|
11658
11730
|
return B.callsLength >= N.maxParallelCalls || !N.hold && B.callsLength > 0 ? (this._debug.log("Push rejected (busy)"), this._stats.logger.log(x.PUSH, "busy"), Promise.reject(new k(O.BUSY))) : (this._throwIfClosed(), this._setConversation(l, u, _o.INCOMING, t), u);
|
|
11659
11731
|
}
|
|
11660
11732
|
_createParticipant(e, t, n = !0) {
|
|
@@ -11802,7 +11874,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
11802
11874
|
return this.subscribe(e, Xt.SOURCE_CHANGED, this._onLocalMediaStreamChanged.bind(this)), this.subscribe(e, Xt.SCREEN_STATUS, this._onScreenSharingStatus.bind(this)), this._audioFix = new Go(e, this._debug, this._stats.logger), e;
|
|
11803
11875
|
}
|
|
11804
11876
|
async _connectSignaling(e, t) {
|
|
11805
|
-
this._throwIfClosed(), this.
|
|
11877
|
+
this._throwIfClosed(), this.subscribe(this._signaling, Cr.NOTIFICATION, (e) => this._signalingActor.add(e)), this.subscribe(this._signaling, Cr.FAILED, this._onSignalingFailed.bind(this)), this.subscribe(this._signaling, Cr.RECONNECT, this._onSignalingReconnect.bind(this));
|
|
11806
11878
|
let n = await this._signaling.connect(e, t);
|
|
11807
11879
|
return this._throwIfClosed(), this._stats.statAggregator.logEventualStatSinceMark({ name: U.SIGNALING_CONNECTED }), n;
|
|
11808
11880
|
}
|
|
@@ -12024,7 +12096,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12024
12096
|
}
|
|
12025
12097
|
_allocateTransport() {
|
|
12026
12098
|
if (!this._conversation || !this._mediaSource || this.isCallHeld || this._transport) return;
|
|
12027
|
-
this._transport = new Ma(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 Qo(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
|
|
12099
|
+
this._transport = new Ma(this._conversation.topology, this._signaling, this._mediaSource, this._serverSettings, this._debug, this._stats.logger, this._stats.statAggregator, this._stats.codecStatsAggregator, this._getFirstMediaSentCallback(), (e) => this._participants[e]?.state === X.ACCEPTED, this._stats.ml), this._debugInfo = new Qo(this._debug), this.subscribe(this._transport, Y.STATE_CHANGED, this._onTransportStateChanged.bind(this)), this.subscribe(this._transport, Y.LOCAL_STATE_CHANGED, this._onTransportLocalStateChanged.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_ADDED, this._onRemoteTrackAdded.bind(this)), this.subscribe(this._transport, Y.REMOTE_TRACK_REMOVED, this._onRemoteTrackRemoved.bind(this)), this.subscribe(this._transport, Y.AUDIO_MIX_STALL, this._onAudioMixStall.bind(this)), this.subscribe(this._transport, Y.REMOTE_DATA_STATS, this._onRemoteDataStats.bind(this)), this.subscribe(this._transport, Y.SIGNALLED_STALLED_PARTICIPANTS, this._onRemoteSignalledStall.bind(this)), this.subscribe(this._transport, Y.TOPOLOGY_CHANGED, this._onTopologyChanged.bind(this)), this.subscribe(this._transport, Y.NETWORK_STATUS, this._onNetworkStatus.bind(this)), this.subscribe(this._transport, Y.REMOTE_STREAM_SECOND, this._onRemoteStreamSecond.bind(this)), this.subscribe(this._transport, Y.PEER_CONNECTION_CLOSED, this._onPeerConnectionClosed.bind(this)), this.subscribe(this._transport, Y.ASR_TRANSCRIPTION, this._onAsrTranscription.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_STREAM, this._onAnimojiStream.bind(this)), this.subscribe(this._transport, Y.ANIMOJI_ERROR, this._onAnimojiError.bind(this));
|
|
12028
12100
|
let e = this._conversation.direction === _o.OUTGOING && !this._conversation.concurrent, t = this._participants;
|
|
12029
12101
|
for (let n of Object.values(t)) (n.state === X.ACCEPTED || n.state === X.CALLED) && this._allocateParticipantTransport(n.id, e);
|
|
12030
12102
|
}
|
|
@@ -12131,7 +12203,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12131
12203
|
_onRemoveParticipant(e) {
|
|
12132
12204
|
this._debug.debug(`Remove participant [${e}]`);
|
|
12133
12205
|
let t = [], n = this._participants;
|
|
12134
|
-
for (let r = 0; r <=
|
|
12206
|
+
for (let r = 0; r <= Vc; r++) {
|
|
12135
12207
|
let i = n[M.compose(e, r)];
|
|
12136
12208
|
i && t.push(i);
|
|
12137
12209
|
}
|
|
@@ -12225,12 +12297,11 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12225
12297
|
this._waitingHallHoldPending = !1, await this._resumeLocalMedia(t, this._getWaitingForPromotionStatus()), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener();
|
|
12226
12298
|
return;
|
|
12227
12299
|
}
|
|
12228
|
-
|
|
12229
|
-
|
|
12230
|
-
|
|
12231
|
-
if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (r = Object.values(this._participants), r.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._resumeLocalMedia(t, P.WAITING), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._state === "ACTIVE") {
|
|
12300
|
+
await this._signaling.hold(!1), this._throwIfClosed(), this._restoreStateAfterHold();
|
|
12301
|
+
let n = null;
|
|
12302
|
+
if (this._state === "IDLE" && this._participantState === X.ACCEPTED && (n = Object.values(this._participants), n.some((e) => e.state === X.ACCEPTED) && (this._state = "ACTIVE", this._changeFeatureSet())), await this._resumeLocalMedia(t, P.WAITING), this._allocateTransport(), this._createSpeakerDetector(), this._createSpecListener(), this._state === "ACTIVE") {
|
|
12232
12303
|
let e = this._conversation?.direction === _o.OUTGOING && !this._conversation.concurrent;
|
|
12233
|
-
this._openTransport(
|
|
12304
|
+
this._openTransport(n ?? Object.values(this._participants), e);
|
|
12234
12305
|
}
|
|
12235
12306
|
}
|
|
12236
12307
|
async _holdLocally() {
|
|
@@ -12255,7 +12326,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12255
12326
|
}
|
|
12256
12327
|
async requestKeyFrame(e) {
|
|
12257
12328
|
let t = {};
|
|
12258
|
-
return t[
|
|
12329
|
+
return t[In(e)] = { keyFrameRequested: !0 }, this._signaling.updateDisplayLayout(t);
|
|
12259
12330
|
}
|
|
12260
12331
|
async requestTestMode(e, t) {
|
|
12261
12332
|
return this._signaling.requestTestMode(e, t);
|
|
@@ -12271,7 +12342,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12271
12342
|
this._debug.log(`Unknown participant external ID ${t}`), r.push(e.id);
|
|
12272
12343
|
continue;
|
|
12273
12344
|
}
|
|
12274
|
-
let s =
|
|
12345
|
+
let s = In({
|
|
12275
12346
|
participantId: o,
|
|
12276
12347
|
mediaType: a.mediaType,
|
|
12277
12348
|
streamName: a.streamName
|
|
@@ -12280,9 +12351,9 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12280
12351
|
c.lastRequestedLayouts[s] = a;
|
|
12281
12352
|
}) : this._isMe(o) && n.push(() => {
|
|
12282
12353
|
this._myLastRequestedLayouts[s] = a;
|
|
12283
|
-
}),
|
|
12354
|
+
}), jn(a) ? (this._isMe(o) && n.push(() => {
|
|
12284
12355
|
delete this._myLastRequestedLayouts[s];
|
|
12285
|
-
}), this._streamIdByStreamDescription.has(s) && !this._cooldownTimestampByStreamDescription.has(s) && this._cooldownTimestampByStreamDescription.set(s, Date.now())) : (this._cooldownTimestampByStreamDescription.delete(s), !this._streamIdByStreamDescription.has(s) && N.videoTracksCount > 0 && this._streamIdByStreamDescription.set(s, null), t[s] = a), a.mediaType === H.SCREEN && !
|
|
12356
|
+
}), this._streamIdByStreamDescription.has(s) && !this._cooldownTimestampByStreamDescription.has(s) && this._cooldownTimestampByStreamDescription.set(s, Date.now())) : (this._cooldownTimestampByStreamDescription.delete(s), !this._streamIdByStreamDescription.has(s) && N.videoTracksCount > 0 && this._streamIdByStreamDescription.set(s, null), t[s] = a), a.mediaType === H.SCREEN && !jn(a) && G.setMark(G.getMarkNameScreenshareFirstFrame(o));
|
|
12286
12357
|
}
|
|
12287
12358
|
if (r.length) {
|
|
12288
12359
|
this._reportMissingExternalIdsById(r, "updateDisplayLayout");
|
|
@@ -12311,7 +12382,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12311
12382
|
}
|
|
12312
12383
|
_stopStreaming(e) {
|
|
12313
12384
|
if (this._cooldownTimestampByStreamDescription.delete(e), this._sequenceNumberByStreamDescription.set(e, this._signaling.getNextCommandSequenceNumber()), this._streamWaitTimerByStreamDescription.has(e) && (this._debug.log("Client asked to stop streaming before stream became available", e), window.clearTimeout(this._streamWaitTimerByStreamDescription.get(e)), this._streamWaitTimerByStreamDescription.delete(e)), this._streamIdByStreamDescription.get(e)) {
|
|
12314
|
-
let t = this._participants, n =
|
|
12385
|
+
let t = this._participants, n = Ln(e), r = t[n.participantId], i = this._conversation?.externalId, a = this._isMe(n.participantId);
|
|
12315
12386
|
if (r || a) {
|
|
12316
12387
|
switch (n.mediaType) {
|
|
12317
12388
|
case H.STREAM:
|
|
@@ -12349,7 +12420,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12349
12420
|
}
|
|
12350
12421
|
let r = [], i = this._participants;
|
|
12351
12422
|
for (let [e, t] of Object.entries(n.errorCodeByParticipantId || {})) {
|
|
12352
|
-
let n =
|
|
12423
|
+
let n = Ln(e), a = i[n.participantId];
|
|
12353
12424
|
if (a) {
|
|
12354
12425
|
let e;
|
|
12355
12426
|
typeof t == "number" ? e = Do(t) : (this._debug.warn(`Unexpected error code ${t} received for participant ${n.participantId}`), e = Eo.UNKNOWN_ERROR), r.push({
|
|
@@ -12358,7 +12429,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12358
12429
|
});
|
|
12359
12430
|
}
|
|
12360
12431
|
}
|
|
12361
|
-
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new
|
|
12432
|
+
if (r && r.length && (this._debug.warn("Could not allocate one or more participants", r), t)) throw new Hc("Could not allocate one or more participants", r);
|
|
12362
12433
|
}
|
|
12363
12434
|
async _cleanupCooldownQueue() {
|
|
12364
12435
|
let e = {}, t = this._cooldownTimestampByStreamDescription.entries();
|
|
@@ -12366,7 +12437,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12366
12437
|
let n = t.next();
|
|
12367
12438
|
if (n.done) break;
|
|
12368
12439
|
let r = n.value;
|
|
12369
|
-
if (r[1] +
|
|
12440
|
+
if (r[1] + zc > Date.now()) break;
|
|
12370
12441
|
let i = r[0];
|
|
12371
12442
|
await this._stopStreaming(i), e[i] = { stopStream: !0 };
|
|
12372
12443
|
} while (!0);
|
|
@@ -12486,7 +12557,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12486
12557
|
if (e.fastScreenShare && !e.participantStreamDescription) {
|
|
12487
12558
|
let t = this._getStreamDescriptionById(e.streamId);
|
|
12488
12559
|
if (t) {
|
|
12489
|
-
let e =
|
|
12560
|
+
let e = Ln(t), n = this._getParticipant(e.participantId);
|
|
12490
12561
|
R.onRemoteScreenStream(n.externalId, null, this.id);
|
|
12491
12562
|
return;
|
|
12492
12563
|
}
|
|
@@ -12500,7 +12571,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12500
12571
|
this._debug.log("skipping participant-sources-update notification since screenshare will be received over datachannel");
|
|
12501
12572
|
return;
|
|
12502
12573
|
}
|
|
12503
|
-
let a =
|
|
12574
|
+
let a = In(t), o = this._sequenceNumberByStreamDescription.get(a);
|
|
12504
12575
|
if (o && o > e.sequenceNumber) {
|
|
12505
12576
|
this._debug.warn(`Participant ${r} received outdated PAT response: sequence number ${e.sequenceNumber}; last sent sequence number for given participant is ${o}`), this._stats.logger.log(x.PAT_OUTDATED_RESPONSE);
|
|
12506
12577
|
return;
|
|
@@ -12543,25 +12614,25 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
12543
12614
|
}
|
|
12544
12615
|
_matchStreamDescription(e) {
|
|
12545
12616
|
if (!e) return null;
|
|
12546
|
-
if (this._streamIdByStreamDescription.has(
|
|
12617
|
+
if (this._streamIdByStreamDescription.has(In(e))) return e;
|
|
12547
12618
|
let t = e.participantId;
|
|
12548
12619
|
if (e.mediaType) {
|
|
12549
12620
|
let e = {
|
|
12550
12621
|
participantId: t,
|
|
12551
12622
|
mediaType: null
|
|
12552
12623
|
};
|
|
12553
|
-
if (this._streamIdByStreamDescription.has(
|
|
12624
|
+
if (this._streamIdByStreamDescription.has(In(e))) return e;
|
|
12554
12625
|
} else {
|
|
12555
12626
|
let e = {
|
|
12556
12627
|
participantId: t,
|
|
12557
12628
|
mediaType: H.CAMERA
|
|
12558
12629
|
};
|
|
12559
|
-
if (this._streamIdByStreamDescription.has(
|
|
12630
|
+
if (this._streamIdByStreamDescription.has(In(e))) return e;
|
|
12560
12631
|
let n = {
|
|
12561
12632
|
participantId: t,
|
|
12562
12633
|
mediaType: H.SCREEN
|
|
12563
12634
|
};
|
|
12564
|
-
if (this._streamIdByStreamDescription.has(
|
|
12635
|
+
if (this._streamIdByStreamDescription.has(In(n))) return n;
|
|
12565
12636
|
}
|
|
12566
12637
|
return this._debug.error("Received unrequested allocation", e), null;
|
|
12567
12638
|
}
|
|
@@ -13200,7 +13271,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
13200
13271
|
screenSharing: e.screenSharing,
|
|
13201
13272
|
fastScreenSharing: e.fastScreenSharing
|
|
13202
13273
|
};
|
|
13203
|
-
this._serverSettings =
|
|
13274
|
+
this._serverSettings = Ur(this._serverSettings, t), this._transport && this._transport.updateSettings(this._serverSettings);
|
|
13204
13275
|
}
|
|
13205
13276
|
_onVideoQualityUpdate(e) {
|
|
13206
13277
|
this._debug.debug("Got video quality update notification", e);
|
|
@@ -13216,7 +13287,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
13216
13287
|
camera: Object.assign({}, this._serverSettings.camera, t),
|
|
13217
13288
|
screenSharing: null,
|
|
13218
13289
|
fastScreenSharing: null
|
|
13219
|
-
}, this._serverSettings =
|
|
13290
|
+
}, this._serverSettings = Ur(this._serverSettings, n), this._transport && this._transport.updateSettings(this._serverSettings);
|
|
13220
13291
|
}
|
|
13221
13292
|
async _onPeerRegistered(e) {
|
|
13222
13293
|
this._registeredPeerReceived = !0, this._clearCalleeUnavailableWatchdog();
|
|
@@ -13435,7 +13506,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
13435
13506
|
if (this._isMe(r) || r === "") e = this._conversation.networkRating;
|
|
13436
13507
|
else if (n[r]) e = n[r].networkRating;
|
|
13437
13508
|
else continue;
|
|
13438
|
-
if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i,
|
|
13509
|
+
if (e !== i) if (this._isMe(r) || r === "") this._conversation.networkRating = i, vi.getInstance().value = i, R.onLocalNetworkStatusChanged(i, this.id);
|
|
13439
13510
|
else {
|
|
13440
13511
|
let e = n[r];
|
|
13441
13512
|
e.networkRating = i, t.push({
|
|
@@ -13558,9 +13629,9 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
13558
13629
|
return e.every((e) => t[e]?.isOnHold);
|
|
13559
13630
|
}
|
|
13560
13631
|
_onRemoteTrackAdded(e, t, n) {
|
|
13561
|
-
if (e.endsWith(
|
|
13562
|
-
else if (e.startsWith(
|
|
13563
|
-
else if (e.startsWith(
|
|
13632
|
+
if (e.endsWith(mi.AUDIO_MIX)) this._debug.debug("Remote audio mix track added"), this._audioOutput.add(e, n), R.onRemoteMixedAudioStream(t, this.id);
|
|
13633
|
+
else if (e.startsWith(mi.TRANSPARENT_AUDIO_TRACK_PREFIX)) this._debug.debug(`Remote transparent audio track added: ${e}`), this._audioOutput.add(e, n);
|
|
13634
|
+
else if (e.startsWith(mi.PARTICIPANT_AGNOSTIC_TRACK_PREFIX)) this._debug.debug(`Participant-agnostic track added: ${e}`), this._streamByStreamId.set(e, t);
|
|
13564
13635
|
else {
|
|
13565
13636
|
this._debug.debug(`Remote track added on the participant [${e}]`, { kind: n.kind });
|
|
13566
13637
|
let r = this._getParticipant(e);
|
|
@@ -13587,7 +13658,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
13587
13658
|
}
|
|
13588
13659
|
}
|
|
13589
13660
|
async _removeAudioTrack(e, t, n) {
|
|
13590
|
-
if (e !==
|
|
13661
|
+
if (e !== mi.AUDIO_MIX) {
|
|
13591
13662
|
let n = this._getParticipant(e);
|
|
13592
13663
|
if (!n || n.remoteStream && n.remoteStream !== t) return;
|
|
13593
13664
|
}
|
|
@@ -13882,11 +13953,11 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
13882
13953
|
_getParticipant(e) {
|
|
13883
13954
|
return this._participants[e];
|
|
13884
13955
|
}
|
|
13885
|
-
},
|
|
13956
|
+
}, Hc = class e extends Error {
|
|
13886
13957
|
constructor(t, n) {
|
|
13887
13958
|
super(t), h(this, "participantErrors", void 0), Object.setPrototypeOf(this, e.prototype), this.participantErrors = n;
|
|
13888
13959
|
}
|
|
13889
|
-
},
|
|
13960
|
+
}, Uc = class {
|
|
13890
13961
|
constructor() {
|
|
13891
13962
|
h(this, "_abortSignal", void 0), h(this, "_apiCallStats", null);
|
|
13892
13963
|
}
|
|
@@ -13931,7 +14002,7 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
13931
14002
|
async getInbounds() {
|
|
13932
14003
|
return [];
|
|
13933
14004
|
}
|
|
13934
|
-
},
|
|
14005
|
+
}, Wc = class e {
|
|
13935
14006
|
constructor() {
|
|
13936
14007
|
h(this, "_participantIdToExternalId", /* @__PURE__ */ new Map()), h(this, "_externalIdToParticipantId", /* @__PURE__ */ new Map()), h(this, "_decorativeIdToInitialId", /* @__PURE__ */ new Map()), h(this, "_initialIdToDecorativeId", /* @__PURE__ */ new Map());
|
|
13937
14008
|
}
|
|
@@ -13966,27 +14037,27 @@ var Lc = 15, $ = class e extends Ye {
|
|
|
13966
14037
|
clear() {
|
|
13967
14038
|
this._participantIdToExternalId.clear(), this._externalIdToParticipantId.clear(), this._decorativeIdToInitialId.clear(), this._initialIdToDecorativeId.clear();
|
|
13968
14039
|
}
|
|
13969
|
-
},
|
|
13970
|
-
function
|
|
14040
|
+
}, Gc = "anonymLogin:", Kc = 700, qc = 3e3;
|
|
14041
|
+
function Jc(e) {
|
|
13971
14042
|
let t = e.error_code;
|
|
13972
14043
|
switch (t) {
|
|
13973
|
-
case 2: return
|
|
13974
|
-
case 4: return e.error_msg.includes("participants.limit.exceeded") ?
|
|
13975
|
-
case 300: return
|
|
13976
|
-
case 1101: return
|
|
13977
|
-
case 1102: return
|
|
13978
|
-
case 1103: return
|
|
13979
|
-
case 1104: return
|
|
13980
|
-
case 1106: return
|
|
13981
|
-
case 1113: return
|
|
14044
|
+
case 2: return Yc(O.SERVICE_UNAVAILABLE, t, "service-unavailable");
|
|
14045
|
+
case 4: return e.error_msg.includes("participants.limit.exceeded") ? Yc(O.PARTICIPANT_LIMIT_REACHED, t, "participants-limit-exceeded") : Yc(y.API, t, "request-error");
|
|
14046
|
+
case 300: return Yc(O.NOT_FOUND, t, "not-found");
|
|
14047
|
+
case 1101: return Yc(O.SERVICE_DISABLED, t, "vchat-service-disabled");
|
|
14048
|
+
case 1102: return Yc(O.CALLEE_IS_OFFLINE, t, "target-user-unavailable");
|
|
14049
|
+
case 1103: return Yc(O.NOT_FRIENDS, t, "friendship-required");
|
|
14050
|
+
case 1104: return Zc(t, "youla-api-error");
|
|
14051
|
+
case 1106: return Zc(t, "vk-api-error");
|
|
14052
|
+
case 1113: return Yc(O.CALLER_IS_REJECTED, t, "caller-is-rejected");
|
|
13982
14053
|
case 1114: {
|
|
13983
14054
|
let n = e.custom_error?.vchat_detailed_api_error?.code, r = n?.startsWith("obsolete_client");
|
|
13984
|
-
return
|
|
14055
|
+
return Yc(r ? O.OBSOLETE_CLIENT : O.VCHAT_DETAILED_ERROR, t, n ?? "detailed-error", r ? n : void 0);
|
|
13985
14056
|
}
|
|
13986
|
-
default: return
|
|
14057
|
+
default: return Yc(y.API, t, "api-error");
|
|
13987
14058
|
}
|
|
13988
14059
|
}
|
|
13989
|
-
function
|
|
14060
|
+
function Yc(e, t, n, r) {
|
|
13990
14061
|
return {
|
|
13991
14062
|
type: e,
|
|
13992
14063
|
callError: {
|
|
@@ -13998,10 +14069,10 @@ function Gc(e, t, n, r) {
|
|
|
13998
14069
|
message: r
|
|
13999
14070
|
};
|
|
14000
14071
|
}
|
|
14001
|
-
function
|
|
14072
|
+
function Xc(e) {
|
|
14002
14073
|
return e?.error_code === void 0 ? e instanceof k && e.callError && "code" in e.callError ? String(e.callError.code) : e instanceof Error ? e.name : "network" : String(e.error_code);
|
|
14003
14074
|
}
|
|
14004
|
-
function
|
|
14075
|
+
function Zc(e, t) {
|
|
14005
14076
|
return {
|
|
14006
14077
|
type: O.EXTERNAL_API_ERROR,
|
|
14007
14078
|
callError: {
|
|
@@ -14012,9 +14083,9 @@ function qc(e, t) {
|
|
|
14012
14083
|
}
|
|
14013
14084
|
};
|
|
14014
14085
|
}
|
|
14015
|
-
var
|
|
14086
|
+
var Qc = class extends Uc {
|
|
14016
14087
|
constructor() {
|
|
14017
|
-
super(), h(this, "_uuid", void 0), h(this, "_idCache", new
|
|
14088
|
+
super(), h(this, "_uuid", void 0), h(this, "_idCache", new Wc()), this._cacheSelfExternalId();
|
|
14018
14089
|
}
|
|
14019
14090
|
async _callUnsafe(e, t = {}, n = !1) {
|
|
14020
14091
|
let r = async (i) => {
|
|
@@ -14023,10 +14094,10 @@ var Jc = class extends zc {
|
|
|
14023
14094
|
let r = await js(e, t, n);
|
|
14024
14095
|
return this._apiCallStats?.log(e, performance.now() - a), r;
|
|
14025
14096
|
} catch (t) {
|
|
14026
|
-
if (this._apiCallStats?.log(e, performance.now() - a,
|
|
14097
|
+
if (this._apiCallStats?.log(e, performance.now() - a, Xc(t)), !t || typeof t != "object" || !Object.hasOwn(t, "error_msg")) {
|
|
14027
14098
|
i++;
|
|
14028
14099
|
let n = t && (typeof t == "object" || typeof t == "function") ? Object.getOwnPropertyNames(t).map((e) => `${e}: ${JSON.stringify(t[e])}`) : [String(t)];
|
|
14029
|
-
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i *
|
|
14100
|
+
if (z.debug(`${e} network error, attempt ${i}: ${n.join("\n ")}`), this._abortSignal?.aborted && (z.debug(`${e} aborted`), this._abortSignal.throwIfAborted()), i < N.apiMaxAttempt) return await M.delay(Math.min(i * Kc, qc), { signal: this._abortSignal }), r(i);
|
|
14030
14101
|
}
|
|
14031
14102
|
throw z.warn(e, "error", t), t;
|
|
14032
14103
|
}
|
|
@@ -14043,8 +14114,8 @@ var Jc = class extends zc {
|
|
|
14043
14114
|
message: i?.error_msg,
|
|
14044
14115
|
code: i?.error_code
|
|
14045
14116
|
};
|
|
14046
|
-
if (i.custom_error && (a.custom_error = i.custom_error),
|
|
14047
|
-
let e =
|
|
14117
|
+
if (i.custom_error && (a.custom_error = i.custom_error), $c(i)) {
|
|
14118
|
+
let e = Jc(i);
|
|
14048
14119
|
throw a.callError = e.callError, a.message = e.message ?? a.message, new k(e.type, a);
|
|
14049
14120
|
}
|
|
14050
14121
|
throw new k(y.API, a);
|
|
@@ -14096,22 +14167,22 @@ var Jc = class extends zc {
|
|
|
14096
14167
|
return e && (t.session_data.auth_token = e, t.session_data.version = 3), this._callUnsafe("auth.anonymLogin", t, !0);
|
|
14097
14168
|
}
|
|
14098
14169
|
_getAnonymLoginCacheKey() {
|
|
14099
|
-
return N.authToken ? `${
|
|
14170
|
+
return N.authToken ? `${Gc}${N.authToken}` : null;
|
|
14100
14171
|
}
|
|
14101
14172
|
_getCachedAnonymLogin() {
|
|
14102
14173
|
let e = this._getAnonymLoginCacheKey();
|
|
14103
14174
|
if (!e) return null;
|
|
14104
14175
|
let t = ht.get(e);
|
|
14105
|
-
return
|
|
14176
|
+
return nl(t) ? t : (t && ht.remove(e), null);
|
|
14106
14177
|
}
|
|
14107
14178
|
_setCachedAnonymLogin(e) {
|
|
14108
14179
|
let t = this._getAnonymLoginCacheKey();
|
|
14109
|
-
if (!t || !
|
|
14180
|
+
if (!t || !el(e)) return;
|
|
14110
14181
|
let n = {
|
|
14111
14182
|
session_key: e.session_key,
|
|
14112
14183
|
session_secret_key: e.session_secret_key,
|
|
14113
14184
|
uid: e.uid,
|
|
14114
|
-
external_user_id:
|
|
14185
|
+
external_user_id: tl(e)
|
|
14115
14186
|
};
|
|
14116
14187
|
ht.set(t, n);
|
|
14117
14188
|
}
|
|
@@ -14124,7 +14195,7 @@ var Jc = class extends zc {
|
|
|
14124
14195
|
}
|
|
14125
14196
|
_applyAnonymLogin(e) {
|
|
14126
14197
|
e.uid && (v.userId = Number(e.uid)), v.sessionKey = e.session_key, v.sessionSecretKey = e.session_secret_key;
|
|
14127
|
-
let t =
|
|
14198
|
+
let t = tl(e);
|
|
14128
14199
|
v.selfExternalId = e.uid && t !== null ? {
|
|
14129
14200
|
participantId: M.composeParticipantId(Number(e.uid), j.USER, 0),
|
|
14130
14201
|
externalId: Z.fromId(t, Mo.USER, 0)
|
|
@@ -14332,26 +14403,26 @@ var Jc = class extends zc {
|
|
|
14332
14403
|
return Array.isArray(e?.inbounds) ? e.inbounds : [];
|
|
14333
14404
|
}
|
|
14334
14405
|
};
|
|
14335
|
-
function
|
|
14406
|
+
function $c(e) {
|
|
14336
14407
|
return typeof e == "object" && !!e && "error_code" in e && "error_msg" in e;
|
|
14337
14408
|
}
|
|
14338
|
-
function
|
|
14409
|
+
function el(e) {
|
|
14339
14410
|
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;
|
|
14340
14411
|
}
|
|
14341
|
-
function
|
|
14412
|
+
function tl(e) {
|
|
14342
14413
|
let t = e?.external_user_id;
|
|
14343
14414
|
return typeof t == "string" && t.length > 0 ? t : null;
|
|
14344
14415
|
}
|
|
14345
|
-
function
|
|
14346
|
-
return
|
|
14416
|
+
function nl(e) {
|
|
14417
|
+
return el(e) && "external_user_id" in e && (typeof e.external_user_id == "string" || e.external_user_id === null);
|
|
14347
14418
|
}
|
|
14348
14419
|
//#endregion
|
|
14349
14420
|
//#region src/enums/RecordRole.ts
|
|
14350
|
-
var
|
|
14421
|
+
var rl = /* @__PURE__ */ function(e) {
|
|
14351
14422
|
return e.KING = "KING", e.PAWN = "PAWN", e;
|
|
14352
|
-
}(
|
|
14423
|
+
}(rl || {}), il = /* @__PURE__ */ function(e) {
|
|
14353
14424
|
return e.OFF = "0", e.ON = "1", e;
|
|
14354
|
-
}({}),
|
|
14425
|
+
}({}), al = class {
|
|
14355
14426
|
constructor(e) {
|
|
14356
14427
|
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;
|
|
14357
14428
|
}
|
|
@@ -14374,7 +14445,7 @@ var $c = /* @__PURE__ */ function(e) {
|
|
|
14374
14445
|
let e = this._queue[this._readCursor];
|
|
14375
14446
|
return e && (this._moveReadCursor = !1, this._queue[this._readCursor] = null, this._readCursor = this.nextCursor(this._readCursor), --this._left), e;
|
|
14376
14447
|
}
|
|
14377
|
-
},
|
|
14448
|
+
}, ol = class {
|
|
14378
14449
|
constructor(e, t, n, r = null) {
|
|
14379
14450
|
h(this, "_uuid", void 0), h(this, "_apiKey", void 0), h(this, "_callToken", void 0), h(this, "_apiEnv", void 0), h(this, "_baseApiUrl", void 0), h(this, "_sessionKey", void 0), this._uuid = M.uuid(), this._apiKey = t, this._callToken = n, this._apiEnv = e, this._baseApiUrl = r;
|
|
14380
14451
|
}
|
|
@@ -14400,7 +14471,7 @@ var $c = /* @__PURE__ */ function(e) {
|
|
|
14400
14471
|
};
|
|
14401
14472
|
t?.peerId && (n.peerId = t.peerId), await js("vchat.hangupConversation", n, !0, await Os(this._baseApiUrl, this._apiEnv));
|
|
14402
14473
|
}
|
|
14403
|
-
},
|
|
14474
|
+
}, sl, cl = null, ll = !1, ul = {
|
|
14404
14475
|
getCameras: E.getCameras,
|
|
14405
14476
|
getMicrophones: E.getMicrophones,
|
|
14406
14477
|
getOutput: E.getOutput,
|
|
@@ -14428,27 +14499,27 @@ var $c = /* @__PURE__ */ function(e) {
|
|
|
14428
14499
|
baseChromeVersion: C.baseChromeVersion,
|
|
14429
14500
|
getAudioContext: E.getAudioContext,
|
|
14430
14501
|
isAudioShareSupported: C.isAudioShareSupported
|
|
14431
|
-
},
|
|
14432
|
-
function
|
|
14433
|
-
|
|
14502
|
+
}, dl = { participantMarkerCompare: M.participantMarkerCompare };
|
|
14503
|
+
function fl(e) {
|
|
14504
|
+
cl = e;
|
|
14434
14505
|
}
|
|
14435
|
-
function
|
|
14506
|
+
function pl(e) {
|
|
14436
14507
|
N.videoEffects = e;
|
|
14437
14508
|
}
|
|
14438
|
-
function
|
|
14509
|
+
function ml(e) {
|
|
14439
14510
|
N.audioEffects = e;
|
|
14440
14511
|
}
|
|
14441
|
-
function
|
|
14512
|
+
function hl(e, t = {}) {
|
|
14442
14513
|
N.vad = e, N.vadOptions = t;
|
|
14443
14514
|
}
|
|
14444
|
-
function
|
|
14515
|
+
function gl(e, t = null, n = {}, r = 1) {
|
|
14445
14516
|
N.vmoji = e, N.vmojiOptions = {
|
|
14446
14517
|
protocolVersion: r,
|
|
14447
14518
|
renderingOptions: n
|
|
14448
14519
|
}, t && e.setSDK(t);
|
|
14449
14520
|
}
|
|
14450
|
-
async function
|
|
14451
|
-
N.set(t),
|
|
14521
|
+
async function _l(t) {
|
|
14522
|
+
N.set(t), sl || (sl = new Qc()), N.statQueueEnabled && (Ks.setApi(sl), N.autoStartStats && wl()), e.disableLog(!N.debug), z.toggle(N.debug), z.log(`Calls SDK ${N.sdkVersion}`, t), await E.init();
|
|
14452
14523
|
let n = C.getBrowserSupportFailure();
|
|
14453
14524
|
if (n) throw new k(y.UNSUPPORTED, { callError: {
|
|
14454
14525
|
scope: "internal",
|
|
@@ -14457,19 +14528,19 @@ async function pl(t) {
|
|
|
14457
14528
|
} });
|
|
14458
14529
|
z.log("UserAgent:", navigator.userAgent), z.log("Screen resolution:", `${window.screen.width}x${window.screen.height}`), z.log("Permissions:", `Camera: ${E.hasCameraPermission()}, Mic: ${E.hasMicrophonePermission()}`), z.log("Simulcast:", `${t.simulcast} => ${N.simulcast}`);
|
|
14459
14530
|
}
|
|
14460
|
-
async function
|
|
14531
|
+
async function vl(e, t = [b.AUDIO], n = "", r = !1, i = !1, a, o, s) {
|
|
14461
14532
|
let c = [];
|
|
14462
|
-
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]),
|
|
14533
|
+
return Array.isArray(e) ? c = e.length ? e : [] : e && (c = [e]), bl([], vo.USER, t, n, r, i, a, c, o, s);
|
|
14463
14534
|
}
|
|
14464
|
-
function
|
|
14535
|
+
function yl(e, t = []) {
|
|
14465
14536
|
let n = e.getIncomingCallerExternalId();
|
|
14466
14537
|
return n ? t.length === 1 && t[0].id === n.id && t[0].type === n.type : !1;
|
|
14467
14538
|
}
|
|
14468
|
-
async function
|
|
14539
|
+
async function bl(e, t = vo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
14469
14540
|
if (!N.hold && B.getActive()) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
14470
14541
|
let u = B.getAll().find((e) => e.isIncomingRinging);
|
|
14471
|
-
if (!N.hold && u && !
|
|
14472
|
-
return new $(new
|
|
14542
|
+
if (!N.hold && u && !yl(u, s)) throw z.error("There is already incoming call"), new k(O.HAS_ACTIVE_CALL);
|
|
14543
|
+
return new $(new Qc(), cl).onStart({
|
|
14473
14544
|
opponentIds: e,
|
|
14474
14545
|
opponentType: t,
|
|
14475
14546
|
mediaOptions: n,
|
|
@@ -14482,49 +14553,49 @@ async function gl(e, t = vo.USER, n, r = "", i = !1, a = !1, o, s, c, l) {
|
|
|
14482
14553
|
conversationId: l
|
|
14483
14554
|
});
|
|
14484
14555
|
}
|
|
14485
|
-
async function
|
|
14486
|
-
return
|
|
14556
|
+
async function xl(e, t) {
|
|
14557
|
+
return Sl(e, j.USER, void 0, t);
|
|
14487
14558
|
}
|
|
14488
|
-
async function
|
|
14559
|
+
async function Sl(e, t = j.USER, n, r, i, a) {
|
|
14489
14560
|
if (e === $.id()) throw Error("Push has already been processed");
|
|
14490
|
-
return new $(new
|
|
14561
|
+
return new $(new Qc(), cl).onPush(e, t, n, r, i, a);
|
|
14491
14562
|
}
|
|
14492
|
-
async function
|
|
14493
|
-
return
|
|
14563
|
+
async function Cl() {
|
|
14564
|
+
return sl.getInbounds();
|
|
14494
14565
|
}
|
|
14495
|
-
function
|
|
14566
|
+
function wl() {
|
|
14496
14567
|
if (N.statQueueEnabled) {
|
|
14497
|
-
if (!
|
|
14568
|
+
if (!sl) {
|
|
14498
14569
|
z.error("[CallsSDK] startStats() called before init()");
|
|
14499
14570
|
return;
|
|
14500
14571
|
}
|
|
14501
|
-
|
|
14572
|
+
ll || (ll = !0, tc.start(sl));
|
|
14502
14573
|
}
|
|
14503
14574
|
}
|
|
14504
|
-
async function
|
|
14505
|
-
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Es()),
|
|
14575
|
+
async function Tl(e, t) {
|
|
14576
|
+
return e && (N.authToken = e), t !== void 0 && N.apiBaseUrl !== t && (N.apiBaseUrl = t, Es()), sl.authorize();
|
|
14506
14577
|
}
|
|
14507
|
-
async function
|
|
14508
|
-
return
|
|
14578
|
+
async function El(e = [b.AUDIO], t) {
|
|
14579
|
+
return Zu(t).accept(e);
|
|
14509
14580
|
}
|
|
14510
|
-
async function
|
|
14511
|
-
let t =
|
|
14581
|
+
async function Dl(e) {
|
|
14582
|
+
let t = Ju(e?.conversationId);
|
|
14512
14583
|
if (t) return t.decline(e);
|
|
14513
14584
|
}
|
|
14514
|
-
async function
|
|
14515
|
-
return
|
|
14585
|
+
async function Ol(e, t = [b.AUDIO]) {
|
|
14586
|
+
return kl(e, t);
|
|
14516
14587
|
}
|
|
14517
|
-
async function
|
|
14588
|
+
async function kl(e, t, n) {
|
|
14518
14589
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
14519
|
-
return new $(new
|
|
14590
|
+
return new $(new Qc(), cl).onJoin({
|
|
14520
14591
|
conversationId: e,
|
|
14521
14592
|
mediaOptions: t,
|
|
14522
14593
|
chatId: n
|
|
14523
14594
|
});
|
|
14524
14595
|
}
|
|
14525
|
-
async function
|
|
14596
|
+
async function Al(e, t = [b.AUDIO], n, r, i, a) {
|
|
14526
14597
|
if (!N.hold && B.callsLength > 0) throw z.error("There is already active call"), new k(O.HAS_ACTIVE_CALL);
|
|
14527
|
-
return n && (N.anonymToken = n), new $(new
|
|
14598
|
+
return n && (N.anonymToken = n), new $(new Qc(), cl).onJoin({
|
|
14528
14599
|
joinLink: e,
|
|
14529
14600
|
mediaOptions: t,
|
|
14530
14601
|
observedIds: r,
|
|
@@ -14533,30 +14604,30 @@ async function El(e, t = [b.AUDIO], n, r, i, a) {
|
|
|
14533
14604
|
anonymous: !!N.anonymToken
|
|
14534
14605
|
});
|
|
14535
14606
|
}
|
|
14536
|
-
function
|
|
14607
|
+
function jl(e) {
|
|
14537
14608
|
let t = B.getLocal(e?.conversationId);
|
|
14538
14609
|
return t ? t.hangup(e) : B.getHangup(e?.conversationId) ?? Promise.resolve();
|
|
14539
14610
|
}
|
|
14540
|
-
async function
|
|
14611
|
+
async function Ml(e, t) {
|
|
14541
14612
|
let n = Array.isArray(e) ? e : [e], r = $.current();
|
|
14542
14613
|
if (r) return r.addParticipant(n, t);
|
|
14543
14614
|
}
|
|
14544
|
-
async function
|
|
14615
|
+
async function Nl(e, t) {
|
|
14545
14616
|
let n = $.current();
|
|
14546
14617
|
if (n) {
|
|
14547
14618
|
let r = e.map((e) => M.composeUserId(e));
|
|
14548
14619
|
await n.addParticipantLegacy(r, t);
|
|
14549
14620
|
}
|
|
14550
14621
|
}
|
|
14551
|
-
async function
|
|
14552
|
-
let n =
|
|
14622
|
+
async function Pl(e, t = !1) {
|
|
14623
|
+
let n = Qu(e, "removeParticipant");
|
|
14553
14624
|
if (n) try {
|
|
14554
14625
|
await n.conversation.removeParticipant(M.decomposeParticipantId(n.participantId).compositeUserId, t);
|
|
14555
14626
|
} catch (e) {
|
|
14556
14627
|
z.warn(`Failed to remove participant ${n.participantId}. Perhaps he is no longer on the call. ${e}`);
|
|
14557
14628
|
}
|
|
14558
14629
|
}
|
|
14559
|
-
async function
|
|
14630
|
+
async function Fl(e, t = !1) {
|
|
14560
14631
|
let n = $.current();
|
|
14561
14632
|
if (n) try {
|
|
14562
14633
|
await n.removeParticipant(M.composeUserId(e), t);
|
|
@@ -14564,13 +14635,13 @@ async function jl(e, t = !1) {
|
|
|
14564
14635
|
z.warn(`Failed to remove participant ${e}. Perhaps he is no longer on the call. ${t}`);
|
|
14565
14636
|
}
|
|
14566
14637
|
}
|
|
14567
|
-
async function
|
|
14638
|
+
async function Il(e, t) {
|
|
14568
14639
|
let n = $.current();
|
|
14569
14640
|
if (e === "videoinput" && It.contains(t)) return N.videoFacingMode = t, n ? (C.isMobile() && n.stopVideoTrack(), n.changeDevice(e)) : void 0;
|
|
14570
14641
|
if (!await E._saveDeviceId(e, t)) throw Error(`Device not found: ${t}`);
|
|
14571
14642
|
if (n) return n.changeDevice(e);
|
|
14572
14643
|
}
|
|
14573
|
-
async function
|
|
14644
|
+
async function Ll(e, t) {
|
|
14574
14645
|
let n = typeof e == "object" ? {
|
|
14575
14646
|
...e,
|
|
14576
14647
|
fastScreenSharing: e.captureScreen && e.fastScreenSharing,
|
|
@@ -14582,37 +14653,37 @@ async function Nl(e, t) {
|
|
|
14582
14653
|
}, r = B.getLocal(t);
|
|
14583
14654
|
return r ? r.toggleScreenCapturing(n) : Promise.reject();
|
|
14584
14655
|
}
|
|
14585
|
-
function
|
|
14656
|
+
function Rl(e) {
|
|
14586
14657
|
let t = $.current();
|
|
14587
14658
|
t && t.toggleAnimojiCapturing(e);
|
|
14588
14659
|
}
|
|
14589
|
-
async function
|
|
14660
|
+
async function zl(e, t = !1) {
|
|
14590
14661
|
let n = $.current();
|
|
14591
14662
|
n && await n.setVideoStream(e, t);
|
|
14592
14663
|
}
|
|
14593
|
-
async function
|
|
14664
|
+
async function Bl(e, t) {
|
|
14594
14665
|
let n = B.getLocal(t);
|
|
14595
14666
|
n && await n.toggleLocalVideo(e);
|
|
14596
14667
|
}
|
|
14597
|
-
async function
|
|
14668
|
+
async function Vl(e, t) {
|
|
14598
14669
|
let n = B.getLocal(t);
|
|
14599
14670
|
n && await n.toggleLocalAudio(e);
|
|
14600
14671
|
}
|
|
14601
|
-
async function
|
|
14672
|
+
async function Hl(e) {
|
|
14602
14673
|
let t = $.current();
|
|
14603
14674
|
if (t) return t.setLocalResolution(e);
|
|
14604
14675
|
}
|
|
14605
|
-
async function
|
|
14676
|
+
async function Ul(e) {
|
|
14606
14677
|
let t = $.current();
|
|
14607
14678
|
t && await t.changePriorities(e);
|
|
14608
14679
|
}
|
|
14609
|
-
async function
|
|
14680
|
+
async function Wl(e, t) {
|
|
14610
14681
|
let n = $.current();
|
|
14611
14682
|
if (n) {
|
|
14612
14683
|
if (t) {
|
|
14613
14684
|
let r = n.getCachedParticipantIdByExternalId(t);
|
|
14614
14685
|
if (!r) {
|
|
14615
|
-
|
|
14686
|
+
Yu(t, "changeParticipantState", n);
|
|
14616
14687
|
return;
|
|
14617
14688
|
}
|
|
14618
14689
|
await n.changeParticipantState(e, r);
|
|
@@ -14621,161 +14692,161 @@ async function Bl(e, t) {
|
|
|
14621
14692
|
await n.changeParticipantState(e);
|
|
14622
14693
|
}
|
|
14623
14694
|
}
|
|
14624
|
-
async function
|
|
14695
|
+
async function Gl() {
|
|
14625
14696
|
let e = $.current();
|
|
14626
14697
|
e && await e.putHandsDown();
|
|
14627
14698
|
}
|
|
14628
|
-
async function
|
|
14699
|
+
async function Kl(e) {
|
|
14629
14700
|
let t = $.current();
|
|
14630
14701
|
t && await t.updateDisplayLayout(e);
|
|
14631
14702
|
}
|
|
14632
|
-
async function
|
|
14703
|
+
async function ql(e) {
|
|
14633
14704
|
let t = $.current();
|
|
14634
14705
|
t && await t.requestDisplayLayout(e);
|
|
14635
14706
|
}
|
|
14636
|
-
async function
|
|
14637
|
-
let r =
|
|
14707
|
+
async function Jl(e, t, n = !1) {
|
|
14708
|
+
let r = Qu(e, "grantRoles");
|
|
14638
14709
|
r && await r.conversation.grantRoles(r.participantId, t, n);
|
|
14639
14710
|
}
|
|
14640
|
-
async function
|
|
14711
|
+
async function Yl(e, t, n, r = !1) {
|
|
14641
14712
|
let i = $.current();
|
|
14642
14713
|
i && await i.grantRoles(M.composeParticipantId(e, j.USER, t), n, r);
|
|
14643
14714
|
}
|
|
14644
|
-
async function
|
|
14715
|
+
async function Xl({ externalId: e = null, muteStates: t, requestedMedia: n = [], roomId: r = null }) {
|
|
14645
14716
|
if (e) {
|
|
14646
|
-
let i =
|
|
14717
|
+
let i = Qu(e, "muteParticipant");
|
|
14647
14718
|
return i ? i.conversation.muteParticipant(i.participantId, t, n, r) : void 0;
|
|
14648
14719
|
}
|
|
14649
14720
|
let i = $.current();
|
|
14650
14721
|
i && await i.muteParticipant(null, t, n, r);
|
|
14651
14722
|
}
|
|
14652
|
-
async function
|
|
14723
|
+
async function Zl({ uid: e = null, muteStates: t, requestedMedia: n = [], deviceIdx: r = 0, roomId: i = null }) {
|
|
14653
14724
|
let a = $.current();
|
|
14654
14725
|
if (a) {
|
|
14655
14726
|
let o = e ? M.composeParticipantId(e, j.USER, r) : null;
|
|
14656
14727
|
await a.muteParticipant(o, t, n, i);
|
|
14657
14728
|
}
|
|
14658
14729
|
}
|
|
14659
|
-
async function
|
|
14660
|
-
let r =
|
|
14730
|
+
async function Ql(e, t = !1, n = null) {
|
|
14731
|
+
let r = Qu(e, "pinParticipant");
|
|
14661
14732
|
r && await r.conversation.pinParticipant(r.participantId, t, n);
|
|
14662
14733
|
}
|
|
14663
|
-
async function
|
|
14734
|
+
async function $l(e, t = !1, n = 0, r = null) {
|
|
14664
14735
|
let i = $.current();
|
|
14665
14736
|
i && await i.pinParticipant(M.composeParticipantId(e, j.USER, n), t, r);
|
|
14666
14737
|
}
|
|
14667
|
-
async function
|
|
14738
|
+
async function eu(e) {
|
|
14668
14739
|
let t = $.current();
|
|
14669
14740
|
t && await t.updateMediaModifiers(e);
|
|
14670
14741
|
}
|
|
14671
|
-
async function
|
|
14742
|
+
async function tu(e) {
|
|
14672
14743
|
let t = $.current();
|
|
14673
14744
|
t && await t.enableVideoSuspend(e);
|
|
14674
14745
|
}
|
|
14675
|
-
async function
|
|
14746
|
+
async function nu(e) {
|
|
14676
14747
|
let t = $.current();
|
|
14677
14748
|
t && await t.enableVideoSuspendSuggest(e);
|
|
14678
14749
|
}
|
|
14679
|
-
async function
|
|
14750
|
+
async function ru(e) {
|
|
14680
14751
|
let t = $.current();
|
|
14681
14752
|
t && await t.changeOptions(e);
|
|
14682
14753
|
}
|
|
14683
|
-
async function
|
|
14754
|
+
async function iu(e, t = null) {
|
|
14684
14755
|
if (t) {
|
|
14685
|
-
let n =
|
|
14756
|
+
let n = Qu(t, "chatMessage");
|
|
14686
14757
|
return n ? n.conversation.chatMessage(e, M.decomposeParticipantId(n.participantId).compositeUserId) : void 0;
|
|
14687
14758
|
}
|
|
14688
14759
|
let n = $.current();
|
|
14689
14760
|
n && await n.chatMessage(e, null);
|
|
14690
14761
|
}
|
|
14691
|
-
async function
|
|
14762
|
+
async function au(e, t = null) {
|
|
14692
14763
|
let n = $.current();
|
|
14693
14764
|
if (n) {
|
|
14694
14765
|
let r = t ? M.composeUserId(t) : null;
|
|
14695
14766
|
await n.chatMessage(e, r);
|
|
14696
14767
|
}
|
|
14697
14768
|
}
|
|
14698
|
-
async function
|
|
14769
|
+
async function ou(e = 10) {
|
|
14699
14770
|
let t = $.current();
|
|
14700
14771
|
if (t) return t.chatHistory(e);
|
|
14701
14772
|
}
|
|
14702
|
-
async function
|
|
14773
|
+
async function su(e, t = null) {
|
|
14703
14774
|
if (t) {
|
|
14704
|
-
let n =
|
|
14775
|
+
let n = Qu(t, "customData");
|
|
14705
14776
|
return n ? n.conversation.customData(e, n.participantId) : void 0;
|
|
14706
14777
|
}
|
|
14707
14778
|
let n = $.current();
|
|
14708
14779
|
n && await n.customData(e, null);
|
|
14709
14780
|
}
|
|
14710
|
-
async function
|
|
14781
|
+
async function cu(e, t = null, n = 0) {
|
|
14711
14782
|
let r = $.current();
|
|
14712
14783
|
if (r) {
|
|
14713
14784
|
let i = t ? M.composeParticipantId(t, j.USER, n) : null;
|
|
14714
14785
|
await r.customData(e, i);
|
|
14715
14786
|
}
|
|
14716
14787
|
}
|
|
14717
|
-
async function
|
|
14718
|
-
return (await
|
|
14788
|
+
async function lu(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, waitForAdmin: r = !1, closedConversation: i = !1 } = {}, a) {
|
|
14789
|
+
return (await sl.createConversation(a ?? M.uuid(), e, t, {
|
|
14719
14790
|
onlyAdminCanShareMovie: n,
|
|
14720
14791
|
waitForAdmin: r,
|
|
14721
14792
|
closedConversation: i
|
|
14722
14793
|
})).join_link;
|
|
14723
14794
|
}
|
|
14724
|
-
async function
|
|
14795
|
+
async function uu(e = "", t = !1, { onlyAdminCanShareMovie: n = !1, audioOnly: r = !1 } = {}, i) {
|
|
14725
14796
|
let a = i.map((e) => Z.fromId(e));
|
|
14726
|
-
return (await
|
|
14797
|
+
return (await sl.createConversation(M.uuid(), e, t, {
|
|
14727
14798
|
onlyAdminCanShareMovie: n,
|
|
14728
14799
|
audienceMode: !0,
|
|
14729
14800
|
audioOnly: r
|
|
14730
14801
|
}, a)).join_link;
|
|
14731
14802
|
}
|
|
14732
|
-
async function
|
|
14803
|
+
async function du() {
|
|
14733
14804
|
let e = $.current();
|
|
14734
14805
|
return e ? e.createJoinLink() : Promise.reject();
|
|
14735
14806
|
}
|
|
14736
|
-
async function
|
|
14807
|
+
async function fu() {
|
|
14737
14808
|
let e = $.current();
|
|
14738
14809
|
return e ? e.removeJoinLink() : Promise.reject();
|
|
14739
14810
|
}
|
|
14740
|
-
async function
|
|
14741
|
-
return
|
|
14811
|
+
async function pu(e, t) {
|
|
14812
|
+
return sl.getAnonymTokenByLink(e, t);
|
|
14742
14813
|
}
|
|
14743
|
-
function
|
|
14814
|
+
function mu(e) {
|
|
14744
14815
|
let t = $.current();
|
|
14745
14816
|
t && t.setVolume(e);
|
|
14746
14817
|
}
|
|
14747
|
-
function
|
|
14818
|
+
function hu(e) {
|
|
14748
14819
|
N.forceRelayPolicy = e;
|
|
14749
14820
|
}
|
|
14750
|
-
async function
|
|
14821
|
+
async function gu(e = !1, t = null, n = null, r = "DIRECT_LINK", i = null, a = null) {
|
|
14751
14822
|
let o = $.current();
|
|
14752
14823
|
return o ? o.startStream(e, t, n, r, i, a) : Promise.reject();
|
|
14753
14824
|
}
|
|
14754
|
-
async function
|
|
14825
|
+
async function _u(e = null, t) {
|
|
14755
14826
|
let n = $.current();
|
|
14756
14827
|
return n ? n.stopStream(e, t) : Promise.reject();
|
|
14757
14828
|
}
|
|
14758
|
-
async function
|
|
14829
|
+
async function vu(e = null) {
|
|
14759
14830
|
let t = $.current();
|
|
14760
14831
|
return t ? t.publishStream(e) : Promise.reject();
|
|
14761
14832
|
}
|
|
14762
|
-
async function
|
|
14833
|
+
async function yu() {
|
|
14763
14834
|
let e = $.current();
|
|
14764
14835
|
return e ? e.getStreamInfo() : Promise.reject();
|
|
14765
14836
|
}
|
|
14766
|
-
async function
|
|
14837
|
+
async function bu(e) {
|
|
14767
14838
|
let t = $.current();
|
|
14768
14839
|
return t ? t.addMovie(e) : Promise.reject();
|
|
14769
14840
|
}
|
|
14770
|
-
async function
|
|
14841
|
+
async function xu(e) {
|
|
14771
14842
|
let t = $.current();
|
|
14772
14843
|
return t ? t.updateMovie(e) : Promise.reject();
|
|
14773
14844
|
}
|
|
14774
|
-
async function
|
|
14845
|
+
async function Su(e) {
|
|
14775
14846
|
let t = $.current();
|
|
14776
14847
|
return t ? t.removeMovie(e) : Promise.reject();
|
|
14777
14848
|
}
|
|
14778
|
-
async function
|
|
14849
|
+
async function Cu(e, t) {
|
|
14779
14850
|
let n = $.current();
|
|
14780
14851
|
if (n) {
|
|
14781
14852
|
let r = [], i = [];
|
|
@@ -14797,46 +14868,46 @@ async function yu(e, t) {
|
|
|
14797
14868
|
});
|
|
14798
14869
|
}
|
|
14799
14870
|
if (i.length) {
|
|
14800
|
-
|
|
14871
|
+
Xu(i, "updateRooms", n);
|
|
14801
14872
|
return;
|
|
14802
14873
|
}
|
|
14803
14874
|
return n.updateRooms(r, t);
|
|
14804
14875
|
}
|
|
14805
14876
|
return Promise.reject();
|
|
14806
14877
|
}
|
|
14807
|
-
async function
|
|
14878
|
+
async function wu(e, t) {
|
|
14808
14879
|
let n = $.current();
|
|
14809
14880
|
return n ? n.activateRooms(e, t) : Promise.reject();
|
|
14810
14881
|
}
|
|
14811
|
-
async function
|
|
14882
|
+
async function Tu(e = null, t = null) {
|
|
14812
14883
|
let n = $.current();
|
|
14813
14884
|
if (!n) return Promise.reject();
|
|
14814
14885
|
let r;
|
|
14815
14886
|
if (t && (r = n.getCachedParticipantIdByExternalId(t) ?? void 0, !r)) {
|
|
14816
|
-
|
|
14887
|
+
Yu(t, "switchRoom", n);
|
|
14817
14888
|
return;
|
|
14818
14889
|
}
|
|
14819
14890
|
return n.switchRoom(e, r);
|
|
14820
14891
|
}
|
|
14821
|
-
async function
|
|
14892
|
+
async function Eu(e) {
|
|
14822
14893
|
let t = $.current();
|
|
14823
14894
|
return t ? t.removeRooms(e) : Promise.reject();
|
|
14824
14895
|
}
|
|
14825
|
-
function
|
|
14896
|
+
function Du(e) {
|
|
14826
14897
|
N.statisticsInterval = e;
|
|
14827
14898
|
let t = $.current();
|
|
14828
14899
|
if (t) return t.updateStatisticsInterval();
|
|
14829
14900
|
}
|
|
14830
|
-
function
|
|
14901
|
+
function Ou(t) {
|
|
14831
14902
|
e.disableLog(!t), z.toggle(t);
|
|
14832
14903
|
}
|
|
14833
|
-
function
|
|
14904
|
+
function ku(e, ...t) {
|
|
14834
14905
|
N.debugLog && ($.debugMessage(e, "[external]", ...t) || z.send(e, "[external]", ...t));
|
|
14835
14906
|
}
|
|
14836
|
-
function
|
|
14907
|
+
function Au(e, t, ...n) {
|
|
14837
14908
|
N.debugLog && ($.debugMessageWithContext(e, t, "[external]", ...n) || z.send(e, "[external]", ...n));
|
|
14838
14909
|
}
|
|
14839
|
-
var
|
|
14910
|
+
var ju = {
|
|
14840
14911
|
list: Pe,
|
|
14841
14912
|
get: Fe,
|
|
14842
14913
|
getJson: Ie,
|
|
@@ -14844,7 +14915,7 @@ var Du = {
|
|
|
14844
14915
|
clear: Re,
|
|
14845
14916
|
stats: ze
|
|
14846
14917
|
};
|
|
14847
|
-
function
|
|
14918
|
+
function Mu() {
|
|
14848
14919
|
let e = [
|
|
14849
14920
|
[`Calls SDK ${N.sdkVersion}`, N.toJSON()],
|
|
14850
14921
|
["UserAgent:", navigator.userAgent],
|
|
@@ -14862,139 +14933,139 @@ function Ou() {
|
|
|
14862
14933
|
d: e
|
|
14863
14934
|
}));
|
|
14864
14935
|
}
|
|
14865
|
-
async function
|
|
14936
|
+
async function Nu() {
|
|
14866
14937
|
let e = $.id(), t = $.debugSessionId();
|
|
14867
14938
|
if (!t || !e) throw z.error("[uploadDebugLogs]", "No conversation id found"), Error("No conversation id found");
|
|
14868
14939
|
let n = await Fe({ sessionId: t });
|
|
14869
14940
|
if (n.length === 0) throw z.error("[uploadDebugLogs]", "No logs found"), Error("No logs found");
|
|
14870
14941
|
let r = n[0].t, i = n[n.length - 1].t;
|
|
14871
14942
|
try {
|
|
14872
|
-
return
|
|
14943
|
+
return sl?.uploadDebugLogs(e, r, i, JSON.stringify([...Mu(), ...n]));
|
|
14873
14944
|
} catch (e) {
|
|
14874
14945
|
throw z.error("[uploadDebugLogs]", "Error while uploading logs", e), Error("Error while uploading logs", { cause: e });
|
|
14875
14946
|
}
|
|
14876
14947
|
}
|
|
14877
|
-
async function
|
|
14948
|
+
async function Pu(e) {
|
|
14878
14949
|
let t = $.current();
|
|
14879
14950
|
if (t) return t.videoEffect(e);
|
|
14880
14951
|
}
|
|
14881
|
-
async function
|
|
14952
|
+
async function Fu(e, t) {
|
|
14882
14953
|
let n = $.current();
|
|
14883
14954
|
if (n) return n.audioEffect(e.length > 0 ? e : null, t);
|
|
14884
14955
|
}
|
|
14885
|
-
async function
|
|
14956
|
+
async function Iu(e) {
|
|
14886
14957
|
let t = $.current();
|
|
14887
14958
|
t && await t.setAudioStream(e);
|
|
14888
14959
|
}
|
|
14889
|
-
async function
|
|
14960
|
+
async function Lu(e, t = null, n = null) {
|
|
14890
14961
|
let r = $.current();
|
|
14891
14962
|
if (!r) return;
|
|
14892
14963
|
let i = n ?? t?.id, a = null;
|
|
14893
14964
|
if (t && (a = r.getCachedParticipantIdByExternalId(t), !a)) {
|
|
14894
|
-
|
|
14965
|
+
Yu(t, "setVmojiSvg", r);
|
|
14895
14966
|
return;
|
|
14896
14967
|
}
|
|
14897
14968
|
r.setAnimojiSvg(e, a, i);
|
|
14898
14969
|
}
|
|
14899
|
-
function
|
|
14970
|
+
function Ru(e) {
|
|
14900
14971
|
let t = $.current();
|
|
14901
14972
|
t && t.setAnimojiFill(e);
|
|
14902
14973
|
}
|
|
14903
|
-
async function
|
|
14904
|
-
return
|
|
14974
|
+
async function zu(e = null, t, n = !1) {
|
|
14975
|
+
return Zu().getWaitingHall(e, t, n);
|
|
14905
14976
|
}
|
|
14906
|
-
async function
|
|
14907
|
-
return
|
|
14977
|
+
async function Bu() {
|
|
14978
|
+
return Zu().getAudienceModeHands();
|
|
14908
14979
|
}
|
|
14909
|
-
async function
|
|
14910
|
-
let n =
|
|
14980
|
+
async function Vu(e, t = !1) {
|
|
14981
|
+
let n = Zu(), r;
|
|
14911
14982
|
if (e) {
|
|
14912
14983
|
let t = n.getCachedParticipantIdByExternalId(e);
|
|
14913
14984
|
if (!t) {
|
|
14914
|
-
|
|
14985
|
+
Yu(e, "promoteParticipant", n);
|
|
14915
14986
|
return;
|
|
14916
14987
|
}
|
|
14917
14988
|
r = M.decomposeParticipantId(t).compositeUserId;
|
|
14918
14989
|
}
|
|
14919
14990
|
return n.promoteParticipant(r, t);
|
|
14920
14991
|
}
|
|
14921
|
-
async function
|
|
14922
|
-
return
|
|
14992
|
+
async function Hu(e = !1) {
|
|
14993
|
+
return Zu().requestPromotion(e);
|
|
14923
14994
|
}
|
|
14924
|
-
async function
|
|
14925
|
-
return
|
|
14995
|
+
async function Uu(e = !1) {
|
|
14996
|
+
return Zu().acceptPromotion(e);
|
|
14926
14997
|
}
|
|
14927
|
-
async function
|
|
14928
|
-
return
|
|
14998
|
+
async function Wu(e) {
|
|
14999
|
+
return Zu().getParticipantListChunk(e);
|
|
14929
15000
|
}
|
|
14930
|
-
async function
|
|
14931
|
-
return
|
|
15001
|
+
async function Gu(e) {
|
|
15002
|
+
return Zu().getParticipants(e);
|
|
14932
15003
|
}
|
|
14933
|
-
async function
|
|
14934
|
-
return
|
|
15004
|
+
async function Ku(e) {
|
|
15005
|
+
return Zu().feedback(e);
|
|
14935
15006
|
}
|
|
14936
|
-
async function
|
|
14937
|
-
return
|
|
15007
|
+
async function qu(e, t, n) {
|
|
15008
|
+
return Zu(n).enableFeatureForRoles(e, t);
|
|
14938
15009
|
}
|
|
14939
|
-
function
|
|
15010
|
+
function Ju(e) {
|
|
14940
15011
|
return e ? B.get(e) ?? null : $.current() ?? B.getFirst();
|
|
14941
15012
|
}
|
|
14942
|
-
function
|
|
15013
|
+
function Yu(e, t, n) {
|
|
14943
15014
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external ID "${e.id}" while handling ${t}`), n.id);
|
|
14944
15015
|
}
|
|
14945
|
-
function
|
|
15016
|
+
function Xu(e, t, n) {
|
|
14946
15017
|
let r = Array.from(new Set(e));
|
|
14947
15018
|
R.onNonFatalError(/* @__PURE__ */ Error(`Participant ID mapping not found for external IDs "${r.join("\", \"")}" while handling ${t}`), n.id);
|
|
14948
15019
|
}
|
|
14949
|
-
function
|
|
14950
|
-
let t =
|
|
15020
|
+
function Zu(e) {
|
|
15021
|
+
let t = Ju(e);
|
|
14951
15022
|
if (!t) throw Error("Conversation not found");
|
|
14952
15023
|
return t;
|
|
14953
15024
|
}
|
|
14954
|
-
function
|
|
15025
|
+
function Qu(e, t) {
|
|
14955
15026
|
let n = $.current();
|
|
14956
15027
|
if (!n) return null;
|
|
14957
15028
|
let r = n.getCachedParticipantIdByExternalId(e);
|
|
14958
15029
|
return r ? {
|
|
14959
15030
|
conversation: n,
|
|
14960
15031
|
participantId: r
|
|
14961
|
-
} : (
|
|
15032
|
+
} : (Yu(e, t, n), null);
|
|
14962
15033
|
}
|
|
14963
|
-
async function
|
|
14964
|
-
await
|
|
15034
|
+
async function $u(e) {
|
|
15035
|
+
await sl.removeHistoryRecords(e);
|
|
14965
15036
|
}
|
|
14966
|
-
async function
|
|
15037
|
+
async function ed(e) {
|
|
14967
15038
|
let t = $.current() ?? B.getFirst();
|
|
14968
15039
|
t && await t.startAsr(e);
|
|
14969
15040
|
}
|
|
14970
|
-
async function
|
|
15041
|
+
async function td(e) {
|
|
14971
15042
|
let t = $.current() ?? B.getFirst();
|
|
14972
15043
|
t && await t.stopAsr(e);
|
|
14973
15044
|
}
|
|
14974
|
-
async function
|
|
15045
|
+
async function nd(e) {
|
|
14975
15046
|
let t = $.current() ?? B.getFirst();
|
|
14976
15047
|
t && await t.requestAsr(e);
|
|
14977
15048
|
}
|
|
14978
|
-
async function
|
|
15049
|
+
async function rd(e) {
|
|
14979
15050
|
let t = $.current();
|
|
14980
15051
|
return t ? t.startUrlSharing(e) : Promise.reject();
|
|
14981
15052
|
}
|
|
14982
|
-
async function
|
|
15053
|
+
async function id() {
|
|
14983
15054
|
let e = $.current();
|
|
14984
15055
|
return e ? e.stopUrlSharing() : Promise.reject();
|
|
14985
15056
|
}
|
|
14986
|
-
async function
|
|
15057
|
+
async function ad(e) {
|
|
14987
15058
|
await B.switchCall(e);
|
|
14988
15059
|
}
|
|
14989
|
-
function
|
|
15060
|
+
function od() {
|
|
14990
15061
|
return B.getActiveId();
|
|
14991
15062
|
}
|
|
14992
|
-
function
|
|
15063
|
+
function sd() {
|
|
14993
15064
|
return $.getSyncedTime();
|
|
14994
15065
|
}
|
|
14995
|
-
function
|
|
15066
|
+
function cd() {
|
|
14996
15067
|
return N.sdkVersion;
|
|
14997
15068
|
}
|
|
14998
15069
|
typeof window < "u" && (window.__CALLS_SDK = wn);
|
|
14999
15070
|
//#endregion
|
|
15000
|
-
export {
|
|
15071
|
+
export { Qc as Api, ol as ApiExternal, al as ArrayDequeue, v as AuthData, f as BaseLogger, _o as CallDirection, vo as CallType, yo as ChatRoomEventType, bo as ConversationFeature, xo as ConversationOption, Dn as DebugMessageType, Mo as ExternalIdType, It as FacingMode, y as FatalError, k as HangupReason, O as HangupType, b as MediaOption, A as MediaTrackKind, H as MediaType, wo as MuteState, X as ParticipantState, il as ParticipantStateDataValue, P as ParticipantStatus, rl as RecordRole, To as RoomsEventType, go as Signaling, V as SignalingCommandType, Sr as SignalingConnectionType, K as SignalingNotification, U as Stat, J as TransportTopology, Oo as UserRole, j as UserType, ts as VolumeDetector, El as acceptCall, Uu as acceptPromotion, wu as activateRooms, bu as addMovie, Ml as addParticipant, Nl as addParticipantInternal, Tl as authorize, ul as browser, bl as callInternal, vl as callTo, Ll as captureScreen, Rl as captureVmoji, Fu as changeAudioEffect, ru as changeConversationOptions, Il as changeDevice, Wl as changeParticipantState, Ul as changePriorities, Pu as changeVideoEffect, ou as chatHistory, iu as chatMessage, au as chatMessageInternal, du as createJoinLink, su as customData, cu as customDataInternal, Ou as debug, ju as debugLogs, ku as debugMessage, Au as debugMessageWithContext, Dl as declineCall, qu as enableFeatureForRoles, tu as enableVideoSuspend, nu as enableVideoSuspendSuggest, Ku as feedback, hu as forceRelayPolicy, od as getActiveCallId, pu as getAnonymTokenByLink, Bu as getAudienceModeHands, Cl as getInbounds, Wu as getParticipantListChunk, Gu as getParticipants, yu as getStreamInfo, sd as getSyncedTime, zu as getWaitingHall, Jl as grantRoles, Yl as grantRolesInternal, jl as hangup, _l as init, Ol as joinCall, Al as joinCallByLink, kl as joinCallInternal, Xl as muteParticipant, Zl as muteParticipantInternal, Ql as pinParticipant, $l as pinParticipantInternal, xl as processPush, Sl as processPushInternal, Vu as promoteParticipant, vu as publishStream, Gl as putHandsDown, $u as removeHistoryRecords, fu as removeJoinLink, Su as removeMovie, Pl as removeParticipant, Fl as removeParticipantInternal, Eu as removeRooms, nd as requestAsr, ql as requestDisplayLayout, Hu as requestPromotion, ml as setAudioEffects, Iu as setAudioStream, Hl as setLocalResolution, fl as setLogger, eu as setMediaModifiers, Du as setStatisticsInterval, hl as setVad, pl as setVideoEffects, zl as setVideoStream, gl as setVmoji, Ru as setVmojiFill, Lu as setVmojiSvg, mu as setVolume, ed as startAsr, uu as startAudienceConversation, lu as startConversation, wl as startStats, gu as startStream, rd as startUrlSharing, td as stopAsr, _u as stopStream, id as stopUrlSharing, ad as switchCall, Tu as switchRoom, Vl as toggleLocalAudio, Bl as toggleLocalVideo, Kl as updateDisplayLayout, xu as updateMovie, Cu as updateRooms, Nu as uploadDebugLogs, dl as utils, cd as version };
|