sip-connector 29.2.0 → 30.0.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/dist/CallManager/events.d.ts +2 -7
- package/dist/CallManager/types.d.ts +1 -1
- package/dist/PresentationManager/@PresentationManager.d.ts +14 -8
- package/dist/PresentationManager/PresentationSenders.d.ts +9 -0
- package/dist/PresentationManager/PresentationStateMachine/PresentationStateMachine.d.ts +8 -6
- package/dist/PresentationManager/PresentationStateMachine/constants.d.ts +5 -5
- package/dist/PresentationManager/PresentationStateMachine/createPresentationMachine.d.ts +5 -5
- package/dist/PresentationManager/events.d.ts +6 -6
- package/dist/PresentationManager/index.d.ts +1 -1
- package/dist/PresentationManager/presentationSession.d.ts +11 -0
- package/dist/PresentationManager/resolveSendEncodings.d.ts +2 -2
- package/dist/PresentationManager/types.d.ts +1 -1
- package/dist/SipConnector/@SipConnector.d.ts +5 -5
- package/dist/SipConnector/events.d.ts +2 -2
- package/dist/{SipConnector-BkHJMvEE.js → SipConnector-CfalmMr_.js} +621 -515
- package/dist/SipConnector-DZCNPWr4.cjs +1 -0
- package/dist/SipConnectorFacade/@SipConnectorFacade.d.ts +7 -7
- package/dist/__fixtures__/BaseSession.mock.d.ts +1 -3
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +2 -1
- package/dist/__fixtures__/RTCSessionMock.d.ts +4 -16
- package/dist/__fixtures__/constants.d.ts +0 -5
- package/dist/__fixtures__/eventNames.d.ts +2 -2
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +61 -61
- package/dist/tools/createUaParser/compareBrowserVersion/hasLessOrEqual.d.ts +6 -0
- package/dist/tools/createUaParser/compareBrowserVersion/index.d.ts +1 -0
- package/dist/tools/createUaParser/compareBrowserVersion/resolveHasLessOrEqual.d.ts +11 -0
- package/dist/tools/createUaParser/createUaParser.d.ts +2 -0
- package/package.json +3 -3
- package/dist/SipConnector-B22u1blB.cjs +0 -1
|
@@ -3124,7 +3124,7 @@ target: L.IDLE } } },
|
|
|
3124
3124
|
}), this.stateMachine.send({ type: "CLEANUP_COMPLETE" }), this.resolveClosed(e);
|
|
3125
3125
|
}), this.finalizePromise) : this.finalizePromise;
|
|
3126
3126
|
}
|
|
3127
|
-
}, Xn = "incomingCall", Zn = "declinedIncomingCall", Qn = "failedIncomingCall", $n = "terminatedIncomingCall", er = "connecting", tr = "connected", nr = "disconnected", rr = "newRTCSession", ir = "registered", ar = "unregistered", or = "registrationFailed", sr = "newMessage", cr = "sipEvent", lr = "availableSecondRemoteStream", ur = "notAvailableSecondRemoteStream", dr = "mustStopPresentation", fr = "enterRoom", pr = "useLicense", mr = "peerconnection:confirmed", hr = "peerconnection:ontrack", gr = "channels", _r = "channels:notify", vr = "ended:fromserver", yr = "main-cam-control", br = "admin:stop-main-cam", xr = "admin:start-main-cam", Sr = "admin:stop-mic", Cr = "admin:start-mic", wr = "admin:force-sync-media-state", Tr = "participant:added-to-list-moderators", Er = "participant:removed-from-list-moderators", Dr = "participant:move-request-to-stream", Or = "participant:move-request-to-spectators", kr = "participant:move-request-to-participants", Ar = "participation:accepting-word-request", jr = "participation:cancelling-word-request", Mr = "webcast:started", Nr = "webcast:stopped", Pr = "account:changed", Fr = "account:deleted", Ir = "conference:participant-token-issued", Lr = "ended", Rr = "sending", zr = "reinvite", Br = "replaces", Vr = "refer", Hr = "progress", Ur = "accepted", Wr = "confirmed", Gr = "peerconnection", Kr = "failed", qr = "muted", Jr = "unmuted", Yr = "newDTMF", Xr = "newInfo", Zr = "hold", Qr = "unhold", $r = "update", ei = "icecandidate", ti = "getusermediafailed", ni = "peerconnection:createofferfailed", ri = "peerconnection:createanswerfailed", ii = "peerconnection:setlocaldescriptionfailed", ai = "peerconnection:setremotedescriptionfailed", oi =
|
|
3127
|
+
}, Xn = "incomingCall", Zn = "declinedIncomingCall", Qn = "failedIncomingCall", $n = "terminatedIncomingCall", er = "connecting", tr = "connected", nr = "disconnected", rr = "newRTCSession", ir = "registered", ar = "unregistered", or = "registrationFailed", sr = "newMessage", cr = "sipEvent", lr = "availableSecondRemoteStream", ur = "notAvailableSecondRemoteStream", dr = "mustStopPresentation", fr = "enterRoom", pr = "useLicense", mr = "peerconnection:confirmed", hr = "peerconnection:ontrack", gr = "channels", _r = "channels:notify", vr = "ended:fromserver", yr = "main-cam-control", br = "admin:stop-main-cam", xr = "admin:start-main-cam", Sr = "admin:stop-mic", Cr = "admin:start-mic", wr = "admin:force-sync-media-state", Tr = "participant:added-to-list-moderators", Er = "participant:removed-from-list-moderators", Dr = "participant:move-request-to-stream", Or = "participant:move-request-to-spectators", kr = "participant:move-request-to-participants", Ar = "participation:accepting-word-request", jr = "participation:cancelling-word-request", Mr = "webcast:started", Nr = "webcast:stopped", Pr = "account:changed", Fr = "account:deleted", Ir = "conference:participant-token-issued", Lr = "ended", Rr = "sending", zr = "reinvite", Br = "replaces", Vr = "refer", Hr = "progress", Ur = "accepted", Wr = "confirmed", Gr = "peerconnection", Kr = "failed", qr = "muted", Jr = "unmuted", Yr = "newDTMF", Xr = "newInfo", Zr = "hold", Qr = "unhold", $r = "update", ei = "icecandidate", ti = "getusermediafailed", ni = "peerconnection:createofferfailed", ri = "peerconnection:createanswerfailed", ii = "peerconnection:setlocaldescriptionfailed", ai = "peerconnection:setremotedescriptionfailed", oi = [
|
|
3128
3128
|
Xn,
|
|
3129
3129
|
Zn,
|
|
3130
3130
|
$n,
|
|
@@ -3140,7 +3140,7 @@ target: L.IDLE } } },
|
|
|
3140
3140
|
Nr,
|
|
3141
3141
|
Tr,
|
|
3142
3142
|
Er
|
|
3143
|
-
],
|
|
3143
|
+
], si = [
|
|
3144
3144
|
er,
|
|
3145
3145
|
tr,
|
|
3146
3146
|
nr,
|
|
@@ -3150,7 +3150,7 @@ target: L.IDLE } } },
|
|
|
3150
3150
|
or,
|
|
3151
3151
|
sr,
|
|
3152
3152
|
cr
|
|
3153
|
-
],
|
|
3153
|
+
], ci = [
|
|
3154
3154
|
lr,
|
|
3155
3155
|
ur,
|
|
3156
3156
|
dr,
|
|
@@ -3168,7 +3168,7 @@ target: L.IDLE } } },
|
|
|
3168
3168
|
wr,
|
|
3169
3169
|
Or,
|
|
3170
3170
|
kr
|
|
3171
|
-
],
|
|
3171
|
+
], li = [
|
|
3172
3172
|
Lr,
|
|
3173
3173
|
er,
|
|
3174
3174
|
Rr,
|
|
@@ -3193,17 +3193,12 @@ target: L.IDLE } } },
|
|
|
3193
3193
|
ni,
|
|
3194
3194
|
ri,
|
|
3195
3195
|
ii,
|
|
3196
|
-
ai
|
|
3197
|
-
oi,
|
|
3198
|
-
si,
|
|
3199
|
-
ci,
|
|
3200
|
-
li,
|
|
3201
|
-
ui
|
|
3196
|
+
ai
|
|
3202
3197
|
];
|
|
3203
|
-
[...
|
|
3198
|
+
[...si, ...oi], [...li, ...ci];
|
|
3204
3199
|
//#endregion
|
|
3205
3200
|
//#region src/__fixtures__/BaseSession.mock.ts
|
|
3206
|
-
var
|
|
3201
|
+
var ui = g("BaseSession.mock"), di = class {
|
|
3207
3202
|
originator;
|
|
3208
3203
|
connection;
|
|
3209
3204
|
events;
|
|
@@ -3214,7 +3209,7 @@ var hi = g("BaseSession.mock"), gi = class {
|
|
|
3214
3209
|
};
|
|
3215
3210
|
addTransceiver = jest.fn(async (e, t, n) => ({}));
|
|
3216
3211
|
constructor({ originator: e = "local", eventHandlers: n, remoteIdentity: r }) {
|
|
3217
|
-
this.originator = e, this.events = new t(
|
|
3212
|
+
this.originator = e, this.events = new t(li), this.initEvents(n), this.remote_identity = r;
|
|
3218
3213
|
}
|
|
3219
3214
|
get contact() {
|
|
3220
3215
|
throw Error("Method not implemented.");
|
|
@@ -3310,7 +3305,7 @@ var hi = g("BaseSession.mock"), gi = class {
|
|
|
3310
3305
|
return this.events.off(e, t), this;
|
|
3311
3306
|
}
|
|
3312
3307
|
removeAllListeners(e) {
|
|
3313
|
-
return
|
|
3308
|
+
return ui("Method not implemented. Event:", e), this;
|
|
3314
3309
|
}
|
|
3315
3310
|
setMaxListeners(e) {
|
|
3316
3311
|
throw Error("Method not implemented.");
|
|
@@ -3344,23 +3339,17 @@ var hi = g("BaseSession.mock"), gi = class {
|
|
|
3344
3339
|
this.on(e, t);
|
|
3345
3340
|
});
|
|
3346
3341
|
}
|
|
3347
|
-
on = (e, t) => (
|
|
3342
|
+
on = (e, t) => (li.includes(e) && this.events.on(e, t), this);
|
|
3348
3343
|
trigger(e, t) {
|
|
3349
3344
|
this.events.trigger(e, t);
|
|
3350
3345
|
}
|
|
3351
3346
|
sendDTMF() {
|
|
3352
3347
|
this.trigger("newDTMF", { originator: this.originator });
|
|
3353
3348
|
}
|
|
3354
|
-
async startPresentation(e) {
|
|
3355
|
-
return this.trigger("presentation:start", e), this.trigger("presentation:started", e), e;
|
|
3356
|
-
}
|
|
3357
|
-
async stopPresentation(e) {
|
|
3358
|
-
return this.trigger("presentation:end", e), this.trigger("presentation:ended", e), e;
|
|
3359
|
-
}
|
|
3360
3349
|
isEstablished() {
|
|
3361
3350
|
return !0;
|
|
3362
3351
|
}
|
|
3363
|
-
},
|
|
3352
|
+
}, fi = class {
|
|
3364
3353
|
stats = (/* @__PURE__ */ new Map()).set("codec", { mimeType: "video/h264" });
|
|
3365
3354
|
dtmf = null;
|
|
3366
3355
|
track = null;
|
|
@@ -3398,7 +3387,7 @@ var hi = g("BaseSession.mock"), gi = class {
|
|
|
3398
3387
|
setStreams() {
|
|
3399
3388
|
throw Error("Method not implemented.");
|
|
3400
3389
|
}
|
|
3401
|
-
},
|
|
3390
|
+
}, pi = class {
|
|
3402
3391
|
currentDirection = "sendrecv";
|
|
3403
3392
|
direction = "sendrecv";
|
|
3404
3393
|
mid = null;
|
|
@@ -3410,8 +3399,9 @@ var hi = g("BaseSession.mock"), gi = class {
|
|
|
3410
3399
|
}
|
|
3411
3400
|
setCodecPreferences(e) {}
|
|
3412
3401
|
stop() {}
|
|
3413
|
-
},
|
|
3402
|
+
}, mi = class extends EventTarget {
|
|
3414
3403
|
senders = [];
|
|
3404
|
+
transceivers = [];
|
|
3415
3405
|
receivers = [];
|
|
3416
3406
|
canTrickleIceCandidates;
|
|
3417
3407
|
connectionState = "new";
|
|
@@ -3444,7 +3434,10 @@ var hi = g("BaseSession.mock"), gi = class {
|
|
|
3444
3434
|
setRemoteDescription = jest.fn(async (e) => {
|
|
3445
3435
|
this.signalingState = "stable", this.connectionState = "connected", this.dispatchEvent(new Event("signalingstatechange")), this.dispatchEvent(new Event("connectionstatechange"));
|
|
3446
3436
|
});
|
|
3447
|
-
addTransceiver = jest.fn((e, t) =>
|
|
3437
|
+
addTransceiver = jest.fn((e, t) => {
|
|
3438
|
+
let n = typeof e == "string" ? new se(e) : e, r = new fi({ track: n }), i = new pi(r);
|
|
3439
|
+
return i.mid = n.kind === "audio" ? "0" : "1", t?.direction && (Object.defineProperty(i, "direction", { value: t.direction }), Object.defineProperty(i, "currentDirection", { value: t.direction })), this.senders.push(r), this.transceivers.push(i), i;
|
|
3440
|
+
});
|
|
3448
3441
|
createOffer = jest.fn(async (e, t, n) => ({
|
|
3449
3442
|
type: "offer",
|
|
3450
3443
|
sdp: "offer-sdp"
|
|
@@ -3477,7 +3470,7 @@ var hi = g("BaseSession.mock"), gi = class {
|
|
|
3477
3470
|
throw Error("Method not implemented.");
|
|
3478
3471
|
}
|
|
3479
3472
|
getTransceivers() {
|
|
3480
|
-
|
|
3473
|
+
return this.transceivers;
|
|
3481
3474
|
}
|
|
3482
3475
|
removeTrack(e) {
|
|
3483
3476
|
throw Error("Method not implemented.");
|
|
@@ -3488,12 +3481,12 @@ var hi = g("BaseSession.mock"), gi = class {
|
|
|
3488
3481
|
getReceivers = () => this.receivers;
|
|
3489
3482
|
getSenders = () => this.senders;
|
|
3490
3483
|
addTrack = (e, ...t) => {
|
|
3491
|
-
let n = new
|
|
3492
|
-
return r.mid = e.kind === "audio" ? "0" : "1", this.senders.push(n), this.dispatchTrackInternal(e, ...t), n;
|
|
3484
|
+
let n = new fi({ track: e }), r = new pi(n);
|
|
3485
|
+
return r.mid = e.kind === "audio" ? "0" : "1", this.senders.push(n), this.transceivers.push(r), this.dispatchTrackInternal(e, ...t), n;
|
|
3493
3486
|
};
|
|
3494
3487
|
addTrackWithMid = (e, t) => {
|
|
3495
|
-
let n = new
|
|
3496
|
-
return t === void 0 ? r.mid = e.kind === "audio" ? "0" : "1" : r.mid = t, this.senders.push(n), this.dispatchTrackInternal(e), n;
|
|
3488
|
+
let n = new fi({ track: e }), r = new pi(n);
|
|
3489
|
+
return t === void 0 ? r.mid = e.kind === "audio" ? "0" : "1" : r.mid = t, this.senders.push(n), this.transceivers.push(r), this.dispatchTrackInternal(e), n;
|
|
3497
3490
|
};
|
|
3498
3491
|
dispatchTrack(e) {
|
|
3499
3492
|
this.dispatchTrackInternal(new se(e));
|
|
@@ -3505,16 +3498,42 @@ var hi = g("BaseSession.mock"), gi = class {
|
|
|
3505
3498
|
};
|
|
3506
3499
|
//#endregion
|
|
3507
3500
|
//#region src/__fixtures__/utils.ts
|
|
3508
|
-
function
|
|
3501
|
+
function hi(e) {
|
|
3509
3502
|
let t = e.match(/(purgatory)|[\d.]+/g);
|
|
3510
3503
|
if (!t) throw Error("wrong sip url");
|
|
3511
3504
|
return t[0];
|
|
3512
3505
|
}
|
|
3513
3506
|
//#endregion
|
|
3514
3507
|
//#region src/CallManager/events.ts
|
|
3515
|
-
var
|
|
3508
|
+
var gi = /* @__PURE__ */ function(e) {
|
|
3516
3509
|
return e.LOCAL = "local", e.REMOTE = "remote", e.SYSTEM = "system", e;
|
|
3517
|
-
}({}),
|
|
3510
|
+
}({}), _i = [
|
|
3511
|
+
"peerconnection",
|
|
3512
|
+
"connecting",
|
|
3513
|
+
"sending",
|
|
3514
|
+
"progress",
|
|
3515
|
+
"accepted",
|
|
3516
|
+
"confirmed",
|
|
3517
|
+
"ended",
|
|
3518
|
+
"failed",
|
|
3519
|
+
"hold",
|
|
3520
|
+
"unhold",
|
|
3521
|
+
"muted",
|
|
3522
|
+
"unmuted",
|
|
3523
|
+
"newInfo",
|
|
3524
|
+
"newDTMF",
|
|
3525
|
+
"reinvite",
|
|
3526
|
+
"update",
|
|
3527
|
+
"refer",
|
|
3528
|
+
"replaces",
|
|
3529
|
+
"sdp",
|
|
3530
|
+
"icecandidate",
|
|
3531
|
+
"getusermediafailed",
|
|
3532
|
+
"peerconnection:createofferfailed",
|
|
3533
|
+
"peerconnection:createanswerfailed",
|
|
3534
|
+
"peerconnection:setlocaldescriptionfailed",
|
|
3535
|
+
"peerconnection:setremotedescriptionfailed"
|
|
3536
|
+
], vi = [
|
|
3518
3537
|
"start-call",
|
|
3519
3538
|
"end-call",
|
|
3520
3539
|
"peerconnection:confirmed",
|
|
@@ -3526,11 +3545,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3526
3545
|
"recv-session-started",
|
|
3527
3546
|
"recv-session-ended",
|
|
3528
3547
|
"recv-quality-changed"
|
|
3529
|
-
],
|
|
3530
|
-
static presentationError;
|
|
3531
|
-
static startPresentationError;
|
|
3532
|
-
static countStartPresentationError = Infinity;
|
|
3533
|
-
static countStartsPresentation = 0;
|
|
3548
|
+
], yi = [..._i, ...vi], bi = () => new n(yi), xi = 400, Si = "777", Ci = (e) => e.getVideoTracks().length > 0, wi = class extends di {
|
|
3534
3549
|
url;
|
|
3535
3550
|
status_code;
|
|
3536
3551
|
renegotiate = jest.fn(async () => !0);
|
|
@@ -3542,57 +3557,27 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3542
3557
|
}, 100), setTimeout(() => {
|
|
3543
3558
|
this.trigger("confirmed");
|
|
3544
3559
|
}, 200);
|
|
3545
|
-
},
|
|
3560
|
+
}, xi);
|
|
3546
3561
|
});
|
|
3547
3562
|
replaceMediaStream = jest.fn(async (e) => {});
|
|
3548
3563
|
_isReadyToReOffer = jest.fn(() => !0);
|
|
3549
3564
|
restartIce = jest.fn(async (e) => !0);
|
|
3550
3565
|
isEndedInner = !1;
|
|
3551
|
-
delayStartPresentation = 0;
|
|
3552
3566
|
timeoutStartPresentation;
|
|
3553
3567
|
timeoutConnect;
|
|
3554
3568
|
timeoutNewInfo;
|
|
3555
3569
|
timeoutAccepted;
|
|
3556
3570
|
timeoutConfirmed;
|
|
3557
|
-
constructor({ eventHandlers: e, originator: t, remoteIdentity: n = new ie(new oe("sip", "caller1", "test1.com", 5060), "Test Caller 1")
|
|
3571
|
+
constructor({ eventHandlers: e, originator: t, remoteIdentity: n = new ie(new oe("sip", "caller1", "test1.com", 5060), "Test Caller 1") }) {
|
|
3558
3572
|
super({
|
|
3559
3573
|
originator: t,
|
|
3560
3574
|
eventHandlers: e,
|
|
3561
3575
|
remoteIdentity: n
|
|
3562
|
-
})
|
|
3576
|
+
});
|
|
3563
3577
|
}
|
|
3564
3578
|
static get C() {
|
|
3565
3579
|
return ae;
|
|
3566
3580
|
}
|
|
3567
|
-
static setPresentationError(e) {
|
|
3568
|
-
this.presentationError = e;
|
|
3569
|
-
}
|
|
3570
|
-
static resetPresentationError() {
|
|
3571
|
-
this.presentationError = void 0;
|
|
3572
|
-
}
|
|
3573
|
-
static setStartPresentationError(e, { count: t = Infinity } = {}) {
|
|
3574
|
-
this.startPresentationError = e, this.countStartPresentationError = t;
|
|
3575
|
-
}
|
|
3576
|
-
static resetStartPresentationError() {
|
|
3577
|
-
this.startPresentationError = void 0, this.countStartPresentationError = Infinity, this.countStartsPresentation = 0;
|
|
3578
|
-
}
|
|
3579
|
-
startPresentation = async (t) => (e.countStartsPresentation += 1, new Promise((n, r) => {
|
|
3580
|
-
this.timeoutStartPresentation = setTimeout(() => {
|
|
3581
|
-
if (e.presentationError) {
|
|
3582
|
-
this.trigger("presentation:start", t), this.trigger("presentation:failed", t), r(e.presentationError);
|
|
3583
|
-
return;
|
|
3584
|
-
}
|
|
3585
|
-
if (e.startPresentationError && e.countStartsPresentation < e.countStartPresentationError) {
|
|
3586
|
-
this.trigger("presentation:start", t), this.trigger("presentation:failed", t), r(e.startPresentationError);
|
|
3587
|
-
return;
|
|
3588
|
-
}
|
|
3589
|
-
n(super.startPresentation(t));
|
|
3590
|
-
}, this.delayStartPresentation);
|
|
3591
|
-
}));
|
|
3592
|
-
stopPresentation = async (t) => {
|
|
3593
|
-
if (e.presentationError) throw this.trigger("presentation:end", t), this.trigger("presentation:failed", t), e.presentationError;
|
|
3594
|
-
return super.stopPresentation(t);
|
|
3595
|
-
};
|
|
3596
3581
|
initPeerconnection(e) {
|
|
3597
3582
|
return e ? (this.createPeerconnection(e), !0) : !1;
|
|
3598
3583
|
}
|
|
@@ -3600,14 +3585,14 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3600
3585
|
let t = ce();
|
|
3601
3586
|
t.id = "mainaudio1";
|
|
3602
3587
|
let n = [t];
|
|
3603
|
-
if (
|
|
3588
|
+
if (Ci(e)) {
|
|
3604
3589
|
let e = le();
|
|
3605
3590
|
e.id = "mainvideo1", n.push(e);
|
|
3606
3591
|
}
|
|
3607
|
-
this.connection = new
|
|
3592
|
+
this.connection = new mi(void 0, n), this.trigger("peerconnection", { peerconnection: this.connection }), this.addStream(e);
|
|
3608
3593
|
}
|
|
3609
3594
|
connect(e, { mediaStream: t } = {}) {
|
|
3610
|
-
let n =
|
|
3595
|
+
let n = hi(e);
|
|
3611
3596
|
return this.initPeerconnection(t), this.timeoutConnect = setTimeout(() => {
|
|
3612
3597
|
e.includes("777") ? this.trigger("failed", {
|
|
3613
3598
|
originator: "remote",
|
|
@@ -3615,7 +3600,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3615
3600
|
cause: "Rejected"
|
|
3616
3601
|
}) : (this.trigger("connecting"), this.timeoutNewInfo = setTimeout(() => {
|
|
3617
3602
|
this.newInfo({
|
|
3618
|
-
originator:
|
|
3603
|
+
originator: gi.REMOTE,
|
|
3619
3604
|
request: { getHeader: (e) => e === "content-type" ? "application/vinteo.webrtc.roomname" : e === "x-webrtc-enter-room" ? n : e === "x-webrtc-participant-name" ? "Test Caller 1" : "" }
|
|
3620
3605
|
});
|
|
3621
3606
|
}, 100), this.timeoutAccepted = setTimeout(() => {
|
|
@@ -3623,7 +3608,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3623
3608
|
}, 200), this.timeoutConfirmed = setTimeout(() => {
|
|
3624
3609
|
this.trigger("confirmed");
|
|
3625
3610
|
}, 300));
|
|
3626
|
-
},
|
|
3611
|
+
}, xi), this.connection;
|
|
3627
3612
|
}
|
|
3628
3613
|
terminate({ status_code: e, cause: t } = {}) {
|
|
3629
3614
|
return this.status_code = e, this.trigger("ended", {
|
|
@@ -3684,20 +3669,26 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3684
3669
|
newInfo(e) {
|
|
3685
3670
|
this.trigger("newInfo", e);
|
|
3686
3671
|
}
|
|
3672
|
+
async startPresentation(e) {
|
|
3673
|
+
return e;
|
|
3674
|
+
}
|
|
3675
|
+
async stopPresentation(e) {
|
|
3676
|
+
return e;
|
|
3677
|
+
}
|
|
3687
3678
|
clear() {
|
|
3688
3679
|
clearTimeout(this.timeoutStartPresentation), clearTimeout(this.timeoutConnect), clearTimeout(this.timeoutNewInfo), clearTimeout(this.timeoutAccepted), clearTimeout(this.timeoutConfirmed);
|
|
3689
3680
|
}
|
|
3690
|
-
},
|
|
3691
|
-
let n = z(e) ||
|
|
3681
|
+
}, Ti = ["snapshot-changed"], Ei = () => new n(Ti), Di = (e) => e.type === "participant", Oi = (e) => e.type === "spectator_synthetic", z = (e) => e.type === "spectator", ki = (e, t) => z(e) && !z(t), Ai = (e, t) => z(t), ji = (e, t) => {
|
|
3682
|
+
let n = z(e) || Oi(e), r = z(t) || Oi(t);
|
|
3692
3683
|
return n && !r;
|
|
3693
|
-
},
|
|
3694
|
-
let n = z(e) ||
|
|
3684
|
+
}, Mi = (e, t) => {
|
|
3685
|
+
let n = z(e) || Oi(e), r = z(t) || Oi(t);
|
|
3695
3686
|
return !n && r;
|
|
3696
|
-
},
|
|
3687
|
+
}, Ni = { type: "participant" }, Pi = { type: "spectator_synthetic" }, Fi = (e) => ({
|
|
3697
3688
|
type: "spectator",
|
|
3698
3689
|
recvParams: e
|
|
3699
|
-
}),
|
|
3700
|
-
role =
|
|
3690
|
+
}), Ii = class {
|
|
3691
|
+
role = Ni;
|
|
3701
3692
|
isAvailableSendingMedia = !0;
|
|
3702
3693
|
onRoleChanged;
|
|
3703
3694
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -3711,13 +3702,13 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3711
3702
|
return this.isAvailableSendingMedia;
|
|
3712
3703
|
}
|
|
3713
3704
|
setCallRoleParticipant() {
|
|
3714
|
-
this.isAvailableSendingMedia = !0, this.changeRole(
|
|
3705
|
+
this.isAvailableSendingMedia = !0, this.changeRole(Ni);
|
|
3715
3706
|
}
|
|
3716
3707
|
setCallRoleSpectatorSynthetic(e = !0) {
|
|
3717
|
-
this.isAvailableSendingMedia = e, this.changeRole(
|
|
3708
|
+
this.isAvailableSendingMedia = e, this.changeRole(Pi);
|
|
3718
3709
|
}
|
|
3719
3710
|
setCallRoleSpectator(e, t = !0) {
|
|
3720
|
-
this.isAvailableSendingMedia = t, this.changeRole(
|
|
3711
|
+
this.isAvailableSendingMedia = t, this.changeRole(Fi(e));
|
|
3721
3712
|
}
|
|
3722
3713
|
changeRole(e) {
|
|
3723
3714
|
let t = this.role;
|
|
@@ -3728,13 +3719,13 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3728
3719
|
z(e) && z(t) && t.recvParams.audioId !== e.recvParams.audioId && this.setRole(e);
|
|
3729
3720
|
}
|
|
3730
3721
|
reset() {
|
|
3731
|
-
this.role =
|
|
3722
|
+
this.role = Ni, this.isAvailableSendingMedia = !0;
|
|
3732
3723
|
}
|
|
3733
3724
|
hasParticipant() {
|
|
3734
|
-
return
|
|
3725
|
+
return Di(this.role);
|
|
3735
3726
|
}
|
|
3736
3727
|
hasSpectatorSynthetic() {
|
|
3737
|
-
return
|
|
3728
|
+
return Oi(this.role);
|
|
3738
3729
|
}
|
|
3739
3730
|
hasSpectator() {
|
|
3740
3731
|
return z(this.role);
|
|
@@ -3756,7 +3747,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3756
3747
|
});
|
|
3757
3748
|
});
|
|
3758
3749
|
}
|
|
3759
|
-
},
|
|
3750
|
+
}, Li = (e, t) => e.type === t.type ? e.type !== "spectator" || t.type === "spectator" && e.recvParams.audioId === t.recvParams.audioId : !1, Ri = (e, t) => e.license === t.license && e.isDuplexSendingMediaMode === t.isDuplexSendingMediaMode && Li(e.role, t.role) && e.derived.isAvailableSendingMedia === t.derived.isAvailableSendingMedia, zi = (e, t, n) => {
|
|
3760
3751
|
let r = e.getRole();
|
|
3761
3752
|
return {
|
|
3762
3753
|
license: n,
|
|
@@ -3768,15 +3759,15 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3768
3759
|
isAvailableSendingMedia: e.getIsAvailableSendingMedia()
|
|
3769
3760
|
}
|
|
3770
3761
|
};
|
|
3771
|
-
},
|
|
3772
|
-
roleManager = new
|
|
3773
|
-
license =
|
|
3762
|
+
}, Bi = je.VIDEO, Vi = class extends e {
|
|
3763
|
+
roleManager = new Ii();
|
|
3764
|
+
license = Bi;
|
|
3774
3765
|
isDuplexSendingMediaMode = !1;
|
|
3775
3766
|
currentSnapshot;
|
|
3776
3767
|
subscriptions = [];
|
|
3777
3768
|
dedupedTotal = 0;
|
|
3778
3769
|
constructor() {
|
|
3779
|
-
super(
|
|
3770
|
+
super(Ei()), this.currentSnapshot = zi(this.roleManager, this.isDuplexSendingMediaMode, this.license);
|
|
3780
3771
|
let e = this.roleManager.subscribe(this.notifySubscribers);
|
|
3781
3772
|
this.subscriptions.push({ unsubscribe: e });
|
|
3782
3773
|
}
|
|
@@ -3804,7 +3795,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3804
3795
|
this.roleManager.setCallRoleSpectator(e, t);
|
|
3805
3796
|
}
|
|
3806
3797
|
reset() {
|
|
3807
|
-
this.roleManager.reset(), this.license =
|
|
3798
|
+
this.roleManager.reset(), this.license = Bi, this.isDuplexSendingMediaMode = !1, this.notifySubscribers();
|
|
3808
3799
|
}
|
|
3809
3800
|
subscribeToApiEvents(e) {
|
|
3810
3801
|
let t = e.on("use-license", this.handleUseLicense), n = e.on("admin:force-sync-media-state", this.handleSyncMediaState), r = e.on("admin:stop-main-cam", this.handleSyncMediaState), i = e.on("admin:stop-mic", this.handleSyncMediaState), a = e.on("admin:start-mic", this.handleSyncMediaState);
|
|
@@ -3824,7 +3815,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3824
3815
|
}
|
|
3825
3816
|
notifySubscribers = () => {
|
|
3826
3817
|
let { previousSnapshot: e, currentSnapshot: t } = this.updateCurrentSnapshot();
|
|
3827
|
-
if (
|
|
3818
|
+
if (Ri(e, t)) {
|
|
3828
3819
|
this.dedupedTotal += 1;
|
|
3829
3820
|
return;
|
|
3830
3821
|
}
|
|
@@ -3835,7 +3826,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3835
3826
|
};
|
|
3836
3827
|
updateCurrentSnapshot() {
|
|
3837
3828
|
let e = this.currentSnapshot;
|
|
3838
|
-
return this.currentSnapshot =
|
|
3829
|
+
return this.currentSnapshot = zi(this.roleManager, this.isDuplexSendingMediaMode, this.license), {
|
|
3839
3830
|
previousSnapshot: e,
|
|
3840
3831
|
currentSnapshot: this.currentSnapshot
|
|
3841
3832
|
};
|
|
@@ -3846,10 +3837,19 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3846
3837
|
handleSyncMediaState = ({ isSyncForced: e }) => {
|
|
3847
3838
|
this.isDuplexSendingMediaMode = e, this.notifySubscribers();
|
|
3848
3839
|
};
|
|
3849
|
-
},
|
|
3840
|
+
}, Hi = (e, t) => {
|
|
3850
3841
|
let n = t.major === e.major, r = t.minor === e.minor, i = t.major > e.major, a = n && t.minor > e.minor, o = n && r && t.patch > e.patch;
|
|
3851
3842
|
return i || a || o;
|
|
3852
|
-
},
|
|
3843
|
+
}, Ui = (e) => e.major !== void 0 && e.minor !== void 0 && e.patch !== void 0, Wi = (e) => (t) => Ui(e) && Hi(e, t), Gi = (e, t) => e.major === t.major ? e.minor === t.minor ? e.patch <= t.patch : e.minor < t.minor : e.major < t.major, Ki = (e) => {
|
|
3844
|
+
if (e.major !== void 0) return {
|
|
3845
|
+
major: e.major,
|
|
3846
|
+
minor: e.minor ?? 0,
|
|
3847
|
+
patch: e.patch ?? 0
|
|
3848
|
+
};
|
|
3849
|
+
}, qi = (e) => {
|
|
3850
|
+
let t = Ki(e);
|
|
3851
|
+
return (e) => t !== void 0 && Gi(t, e);
|
|
3852
|
+
}, Ji = (e = "") => {
|
|
3853
3853
|
let t = e.split(".");
|
|
3854
3854
|
if (t.length <= 1) return {
|
|
3855
3855
|
major: void 0,
|
|
@@ -3862,23 +3862,25 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3862
3862
|
minor: r,
|
|
3863
3863
|
patch: i
|
|
3864
3864
|
};
|
|
3865
|
-
},
|
|
3866
|
-
let e = new ue(), { name: t, version: n } = e.getBrowser(), { name: r } = e.getOS(), { type: i } = e.getDevice(), a =
|
|
3865
|
+
}, Yi = () => globalThis.process?.versions?.electron !== void 0, Xi = () => {
|
|
3866
|
+
let e = new ue(), { name: t, version: n } = e.getBrowser(), { name: r } = e.getOS(), { type: i } = e.getDevice(), a = Yi(), o = i === "mobile", s = Ji(n);
|
|
3867
3867
|
return {
|
|
3868
|
-
hasGreaterThanBrowserVersion:
|
|
3868
|
+
hasGreaterThanBrowserVersion: Wi(s),
|
|
3869
|
+
hasLessOrEqualBrowserVersion: qi(s),
|
|
3869
3870
|
isMobileDevice: o,
|
|
3870
3871
|
isChrome: t === "Chrome" || a,
|
|
3872
|
+
isFirefox: t === "Firefox",
|
|
3871
3873
|
isYandexBrowser: t === "Yandex",
|
|
3872
3874
|
isSafari: t === "Safari",
|
|
3873
3875
|
isOpera: t === "Opera",
|
|
3874
3876
|
isWindows: r === "Windows"
|
|
3875
3877
|
};
|
|
3876
|
-
},
|
|
3878
|
+
}, Zi = (e) => `${e.message.to.uri.user}@${e.message.to.uri.host}`, Qi = (e) => {
|
|
3877
3879
|
let { url: t, cause: n } = e;
|
|
3878
|
-
return n === W.BAD_MEDIA_DESCRIPTION || n === W.NOT_FOUND ?
|
|
3879
|
-
},
|
|
3880
|
+
return n === W.BAD_MEDIA_DESCRIPTION || n === W.NOT_FOUND ? Zi(e) : t;
|
|
3881
|
+
}, $i = /* @__PURE__ */ function(e) {
|
|
3880
3882
|
return e.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", e.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", e.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", e.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", e.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", e.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", e;
|
|
3881
|
-
}({}),
|
|
3883
|
+
}({}), ea = /* @__PURE__ */ Error("Unknown error"), ta = (e = ea) => {
|
|
3882
3884
|
let { cause: t, socket: n } = e, r = "CONNECT_SERVER_FAILED";
|
|
3883
3885
|
switch (t) {
|
|
3884
3886
|
case "Forbidden":
|
|
@@ -3890,53 +3892,53 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3890
3892
|
case W.NOT_FOUND:
|
|
3891
3893
|
r = "NOT_FOUND_ERROR";
|
|
3892
3894
|
break;
|
|
3893
|
-
default: n !== void 0 && n._ws?.readyState === 3 ? r = "WS_CONNECTION_FAILED" :
|
|
3895
|
+
default: n !== void 0 && n._ws?.readyState === 3 ? r = "WS_CONNECTION_FAILED" : Qi(e) !== void 0 && Qi(e) !== "" && (r = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
3894
3896
|
}
|
|
3895
3897
|
return r;
|
|
3896
|
-
},
|
|
3898
|
+
}, na = g("stringifyMessage"), ra = (e) => {
|
|
3897
3899
|
let t = "";
|
|
3898
3900
|
try {
|
|
3899
3901
|
t = JSON.stringify(e);
|
|
3900
3902
|
} catch (e) {
|
|
3901
|
-
|
|
3903
|
+
na("failed to stringify message", e);
|
|
3902
3904
|
}
|
|
3903
3905
|
return t;
|
|
3904
|
-
},
|
|
3905
|
-
let { code: t, cause: n, message: r } = e, i =
|
|
3906
|
+
}, ia = /* @__PURE__ */ Error("Unknown error"), aa = (e = ia) => {
|
|
3907
|
+
let { code: t, cause: n, message: r } = e, i = Qi(e), a = {
|
|
3906
3908
|
code: "",
|
|
3907
3909
|
cause: "",
|
|
3908
3910
|
message: ""
|
|
3909
3911
|
};
|
|
3910
|
-
return typeof r == "object" && r ? a.message =
|
|
3911
|
-
},
|
|
3912
|
-
EErrorTypes: () =>
|
|
3913
|
-
getLinkError: () =>
|
|
3914
|
-
getTypeFromError: () =>
|
|
3915
|
-
getValuesFromError: () =>
|
|
3916
|
-
}),
|
|
3912
|
+
return typeof r == "object" && r ? a.message = ra(r) : r && (a.message = String(r)), i !== void 0 && i !== "" && (a.link = i), t !== void 0 && t !== "" && (a.code = t), n !== void 0 && n !== "" && (a.cause = n), a;
|
|
3913
|
+
}, oa = /* @__PURE__ */ he({
|
|
3914
|
+
EErrorTypes: () => $i,
|
|
3915
|
+
getLinkError: () => Qi,
|
|
3916
|
+
getTypeFromError: () => ta,
|
|
3917
|
+
getValuesFromError: () => aa
|
|
3918
|
+
}), sa = ({ sessionId: e, remoteAddress: t, isMutedAudio: n, isMutedVideo: r, isRegistered: i, isPresentationCall: a }) => {
|
|
3917
3919
|
let o = [], s = n ? "0" : "1", c = r ? "0" : "1";
|
|
3918
3920
|
return o.push(`X-Vinteo-Mic-State: ${s}`, `X-Vinteo-MainCam-State: ${c}`), (i === !1 || i === void 0) && o.push("X-Vinteo-Purgatory-Call: yes"), e !== void 0 && e !== "" && o.push(`X-Vinteo-Session: ${e}`), a === !0 && o.push("X-Vinteo-Presentation-Call: yes"), t !== void 0 && t !== "" && o.push(`X-Vinteo-Remote: ${t}`), o;
|
|
3919
|
-
},
|
|
3921
|
+
}, ca = "[@*!|]", la = "_", ua = (e) => {
|
|
3920
3922
|
let t = e;
|
|
3921
|
-
return t = t.replaceAll(new RegExp(
|
|
3922
|
-
},
|
|
3923
|
-
let i = `${
|
|
3923
|
+
return t = t.replaceAll(new RegExp(ca, "g"), la), t;
|
|
3924
|
+
}, da = ({ appName: e, appVersion: t, browserName: n, browserVersion: r }) => {
|
|
3925
|
+
let i = `${ua(e)} ${t}`;
|
|
3924
3926
|
return `ChromeNew - ${n === void 0 ? i : `${n} ${r}, ${i}`}`;
|
|
3925
|
-
},
|
|
3927
|
+
}, fa = ({ isUnifiedSdpSemantic: e, appVersion: t, browserName: n, browserVersion: r, appName: i }) => e ? da({
|
|
3926
3928
|
appVersion: t,
|
|
3927
3929
|
browserName: n,
|
|
3928
3930
|
browserVersion: r,
|
|
3929
3931
|
appName: i
|
|
3930
|
-
}) : "Chrome",
|
|
3932
|
+
}) : "Chrome", pa = /^p2p.+to.+$/i, ma = (e) => e !== void 0 && e.length > 0 && pa.test(e), ha = "purgatory", ga = (e) => e === ha, _a = (e, t) => {
|
|
3931
3933
|
e.getVideoTracks().forEach((e) => {
|
|
3932
3934
|
"contentHint" in e && e.contentHint !== t && (e.contentHint = t);
|
|
3933
3935
|
});
|
|
3934
|
-
},
|
|
3936
|
+
}, va = (e, { directionVideo: t, directionAudio: n, contentHint: r } = {}) => {
|
|
3935
3937
|
if (!e || t === "recvonly" && n === "recvonly") return;
|
|
3936
3938
|
let i = n === "recvonly" ? [] : e.getAudioTracks(), a = t === "recvonly" ? [] : e.getVideoTracks(), o = [...i, ...a], s = new MediaStream(o);
|
|
3937
|
-
return s.getTracks = () => [...s.getAudioTracks(), ...s.getVideoTracks()], r && r !== "none" &&
|
|
3938
|
-
},
|
|
3939
|
-
let o = new URL(`https://${e.replace(/\/$/, "")}/${
|
|
3939
|
+
return s.getTracks = () => [...s.getAudioTracks(), ...s.getVideoTracks()], r && r !== "none" && _a(s, r), s;
|
|
3940
|
+
}, ya = (e) => (t) => [...t].map((t) => async () => e(t)), ba = async ({ accumulatedKeys: e, sendKey: t, canRunTask: n }) => de(ya(t)(e), n), xa = "api/v2/rtp2webrtc/offer", Sa = async ({ serverUrl: e, conferenceNumber: t, quality: n, audio: r, offer: i, token: a }) => {
|
|
3941
|
+
let o = new URL(`https://${e.replace(/\/$/, "")}/${xa}/${encodeURIComponent(t)}`);
|
|
3940
3942
|
o.searchParams.set("quality", n), o.searchParams.set("audio", String(r));
|
|
3941
3943
|
let s = {
|
|
3942
3944
|
"Content-Type": "application/json",
|
|
@@ -3956,25 +3958,25 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3956
3958
|
return l;
|
|
3957
3959
|
}
|
|
3958
3960
|
};
|
|
3959
|
-
},
|
|
3961
|
+
}, Ca = (e, t) => (e.degradationPreference = t.degradationPreference, e), wa = (e, t) => {
|
|
3960
3962
|
e.encodings ??= [];
|
|
3961
3963
|
for (let n = e.encodings.length; n < t; n += 1) e.encodings.push({});
|
|
3962
3964
|
return e;
|
|
3963
|
-
},
|
|
3964
|
-
if (
|
|
3965
|
-
},
|
|
3966
|
-
let r = e.maxBitrate, i =
|
|
3965
|
+
}, Ta = (e) => (t, n) => n !== void 0 && t !== n || n === void 0 && t !== e, Ea = Ta(), Da = (e, t) => {
|
|
3966
|
+
if (Ea(e, t)) return e;
|
|
3967
|
+
}, Oa = (e, t, { isResetAllowed: n = !1 } = {}) => {
|
|
3968
|
+
let r = e.maxBitrate, i = Da(t, r);
|
|
3967
3969
|
return (i !== void 0 || n) && (e.maxBitrate = i ?? t), e;
|
|
3968
|
-
},
|
|
3969
|
-
let n = e === void 0 ? void 0 : Math.max(e,
|
|
3970
|
-
if (n !== void 0 &&
|
|
3971
|
-
},
|
|
3972
|
-
let n = e.scaleResolutionDownBy, r =
|
|
3970
|
+
}, ka = 1, Aa = Ta(ka), ja = (e, t) => {
|
|
3971
|
+
let n = e === void 0 ? void 0 : Math.max(e, ka);
|
|
3972
|
+
if (n !== void 0 && Aa(n, t)) return n;
|
|
3973
|
+
}, Ma = (e, t) => {
|
|
3974
|
+
let n = e.scaleResolutionDownBy, r = ja(t, n);
|
|
3973
3975
|
return r !== void 0 && (e.scaleResolutionDownBy = r), e;
|
|
3974
|
-
},
|
|
3976
|
+
}, Na = (e, t, { isResetAllowed: n } = {}) => (wa(e, t.encodings?.length ?? 0), e.encodings.forEach((e, r) => {
|
|
3975
3977
|
let i = (t?.encodings ?? [])[r], a = i?.maxBitrate, o = i?.scaleResolutionDownBy;
|
|
3976
|
-
|
|
3977
|
-
}), e),
|
|
3978
|
+
Oa(e, a, { isResetAllowed: n }), Ma(e, o);
|
|
3979
|
+
}), e), Pa = (e, t) => {
|
|
3978
3980
|
if (e.codecs?.length !== t.codecs?.length) return !0;
|
|
3979
3981
|
for (let n = 0; n < (e.codecs?.length ?? 0); n++) if (JSON.stringify(e.codecs[n]) !== JSON.stringify(t.codecs[n])) return !0;
|
|
3980
3982
|
if (e.headerExtensions?.length !== t.headerExtensions?.length) return !0;
|
|
@@ -3982,16 +3984,16 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3982
3984
|
if (e.encodings?.length !== t.encodings?.length) return !0;
|
|
3983
3985
|
for (let n = 0; n < (e.encodings?.length ?? 0); n++) if (JSON.stringify(e.encodings[n]) !== JSON.stringify(t.encodings[n])) return !0;
|
|
3984
3986
|
return e.rtcp?.cname !== t.rtcp?.cname || e.rtcp?.reducedSize !== t.rtcp?.reducedSize || e.degradationPreference !== t.degradationPreference;
|
|
3985
|
-
},
|
|
3987
|
+
}, Fa = async (e, t, { isResetAllowed: n } = {}) => {
|
|
3986
3988
|
let r = e.getParameters(), i = JSON.parse(JSON.stringify(r));
|
|
3987
|
-
|
|
3988
|
-
let a =
|
|
3989
|
+
Na(r, t, { isResetAllowed: n }), Ca(r, t);
|
|
3990
|
+
let a = Pa(i, r);
|
|
3989
3991
|
return a && await e.setParameters(r), {
|
|
3990
3992
|
parameters: r,
|
|
3991
3993
|
isChanged: a
|
|
3992
3994
|
};
|
|
3993
|
-
},
|
|
3994
|
-
let { isChanged: r, parameters: i } = await
|
|
3995
|
+
}, Ia = async (e, t, n) => {
|
|
3996
|
+
let { isChanged: r, parameters: i } = await Fa(e, { encodings: [{
|
|
3995
3997
|
scaleResolutionDownBy: t.scaleResolutionDownBy,
|
|
3996
3998
|
maxBitrate: t.maxBitrate
|
|
3997
3999
|
}] });
|
|
@@ -3999,17 +4001,14 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
3999
4001
|
isChanged: r,
|
|
4000
4002
|
parameters: i
|
|
4001
4003
|
};
|
|
4002
|
-
},
|
|
4003
|
-
let r = za(e, t);
|
|
4004
|
-
if (r) return Ra(r, { maxBitrate: n });
|
|
4005
|
-
}, Va = g("resolveOnStartMainCam"), Ha = (e) => (t) => (Va("onStartMainCam"), e.on("api:admin:start-main-cam", t)), Ua = g("resolveOnStartMic"), Wa = (e) => (t) => (Ua("onStartMic"), e.on("api:admin:start-mic", t)), Ga = g("resolveOnStopMainCam"), Ka = (e) => (t) => (Ga("onStopMainCam"), e.on("api:admin:stop-main-cam", t)), qa = g("resolveOnStopMic"), Ja = (e) => (t) => (qa("onStopMic"), e.on("api:admin:stop-mic", t)), Ya = ({ sipConnector: e }) => {
|
|
4004
|
+
}, La = g("resolveOnStartMainCam"), Ra = (e) => (t) => (La("onStartMainCam"), e.on("api:admin:start-main-cam", t)), za = g("resolveOnStartMic"), Ba = (e) => (t) => (za("onStartMic"), e.on("api:admin:start-mic", t)), Va = g("resolveOnStopMainCam"), Ha = (e) => (t) => (Va("onStopMainCam"), e.on("api:admin:stop-main-cam", t)), Ua = g("resolveOnStopMic"), Wa = (e) => (t) => (Ua("onStopMic"), e.on("api:admin:stop-mic", t)), Ga = ({ sipConnector: e }) => {
|
|
4006
4005
|
let t = (e, t) => ({ isSyncForced: n }) => {
|
|
4007
4006
|
if (n === !0) {
|
|
4008
4007
|
e();
|
|
4009
4008
|
return;
|
|
4010
4009
|
}
|
|
4011
4010
|
t();
|
|
4012
|
-
}, n =
|
|
4011
|
+
}, n = Ra(e), r = Ha(e), i = Ba(e), a = Wa(e), o, s, c, l, u = ({ onStartMainCamForced: e, onStartMainCamNotForced: u, onStopMainCamForced: d, onStopMainCamNotForced: f, onStartMicForced: p, onStartMicNotForced: ee, onStopMicForced: m, onStopMicNotForced: te }) => {
|
|
4013
4012
|
let ne = t(e, u);
|
|
4014
4013
|
o = n(ne);
|
|
4015
4014
|
let h = t(d, f);
|
|
@@ -4029,7 +4028,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
4029
4028
|
d();
|
|
4030
4029
|
}
|
|
4031
4030
|
};
|
|
4032
|
-
},
|
|
4031
|
+
}, Ka = class {
|
|
4033
4032
|
command = void 0;
|
|
4034
4033
|
unsubscribe;
|
|
4035
4034
|
options;
|
|
@@ -4044,27 +4043,27 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
4044
4043
|
cancel() {
|
|
4045
4044
|
this.unsubscribe?.(), this.unsubscribe = void 0, this.command = void 0;
|
|
4046
4045
|
}
|
|
4047
|
-
},
|
|
4048
|
-
DeferredCommandRunner: () =>
|
|
4049
|
-
PURGATORY_CONFERENCE_NUMBER: () =>
|
|
4050
|
-
createSyncMediaState: () =>
|
|
4051
|
-
createUaParser: () =>
|
|
4052
|
-
error: () =>
|
|
4053
|
-
getExtraHeaders: () =>
|
|
4054
|
-
getUserAgent: () =>
|
|
4055
|
-
hasPeerToPeer: () =>
|
|
4056
|
-
hasPurgatory: () =>
|
|
4057
|
-
prepareMediaStream: () =>
|
|
4058
|
-
sendDtmfAccumulated: () =>
|
|
4059
|
-
sendOffer: () =>
|
|
4060
|
-
setEncodingsToSender: () =>
|
|
4061
|
-
setParametersToSender: () =>
|
|
4046
|
+
}, qa = /* @__PURE__ */ he({
|
|
4047
|
+
DeferredCommandRunner: () => Ka,
|
|
4048
|
+
PURGATORY_CONFERENCE_NUMBER: () => ha,
|
|
4049
|
+
createSyncMediaState: () => Ga,
|
|
4050
|
+
createUaParser: () => Xi,
|
|
4051
|
+
error: () => oa,
|
|
4052
|
+
getExtraHeaders: () => sa,
|
|
4053
|
+
getUserAgent: () => fa,
|
|
4054
|
+
hasPeerToPeer: () => ma,
|
|
4055
|
+
hasPurgatory: () => ga,
|
|
4056
|
+
prepareMediaStream: () => va,
|
|
4057
|
+
sendDtmfAccumulated: () => ba,
|
|
4058
|
+
sendOffer: () => Sa,
|
|
4059
|
+
setEncodingsToSender: () => Ia,
|
|
4060
|
+
setParametersToSender: () => Fa
|
|
4062
4061
|
}), B = "evaluate", V = /* @__PURE__ */ function(e) {
|
|
4063
4062
|
return e.IDLE = "call:idle", e.CONNECTING = "call:connecting", e.PRESENTATION_CALL = "call:presentationCall", e.ROOM_PENDING_AUTH = "call:roomPendingAuth", e.PURGATORY = "call:purgatory", e.P2P_ROOM = "call:p2pRoom", e.DIRECT_P2P_ROOM = "call:directP2pRoom", e.IN_ROOM = "call:inRoom", e.DISCONNECTING = "call:disconnecting", e;
|
|
4064
|
-
}({}),
|
|
4063
|
+
}({}), Ja = {
|
|
4065
4064
|
raw: {},
|
|
4066
4065
|
state: {}
|
|
4067
|
-
},
|
|
4066
|
+
}, Ya = (e) => "number" in e && x(e.number) && Pe(e.answer), Xa = (e) => "room" in e && x(e.room) && x(e.participantName) && Me(e.startedTimestamp), Za = (e) => "token" in e && x(e.token), Qa = (e) => Za(e) && "conferenceForToken" in e && x(e.conferenceForToken), $a = (e) => Ya(e) && Xa(e), eo = (e) => !Qa(e) || !Xa(e) ? !1 : e.conferenceForToken === e.room, to = ({ isDirectPeerToPeer: e }) => e === !0, no = (e) => "isDirectPeerToPeer" in e && to(e), ro = "x-vinteo-presentation-call: yes", io = (e) => Fe(e) && e.some((e) => e.trim().toLowerCase() === ro), ao = (e) => "extraHeaders" in e && io(e.extraHeaders) && "isConfirmed" in e && e.isConfirmed === !0, oo = (e) => $a(e) && !ga(e.room) && Qa(e) && eo(e), so = (e) => {
|
|
4068
4067
|
let t = e;
|
|
4069
4068
|
return {
|
|
4070
4069
|
number: t.number,
|
|
@@ -4079,7 +4078,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
4079
4078
|
buildContext: () => ({})
|
|
4080
4079
|
},
|
|
4081
4080
|
[V.CONNECTING]: {
|
|
4082
|
-
guard:
|
|
4081
|
+
guard: Ya,
|
|
4083
4082
|
buildContext: (e) => {
|
|
4084
4083
|
let { number: t, answer: n, extraHeaders: r } = e;
|
|
4085
4084
|
return {
|
|
@@ -4090,7 +4089,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
4090
4089
|
}
|
|
4091
4090
|
},
|
|
4092
4091
|
[V.PRESENTATION_CALL]: {
|
|
4093
|
-
guard:
|
|
4092
|
+
guard: ao,
|
|
4094
4093
|
buildContext: (e) => {
|
|
4095
4094
|
let { number: t, answer: n, startedTimestamp: r } = e;
|
|
4096
4095
|
return {
|
|
@@ -4101,30 +4100,30 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
4101
4100
|
}
|
|
4102
4101
|
},
|
|
4103
4102
|
[V.ROOM_PENDING_AUTH]: {
|
|
4104
|
-
guard: (e) =>
|
|
4105
|
-
buildContext:
|
|
4103
|
+
guard: (e) => $a(e) && !ga(e.room) && !ma(e.room) && !no(e) && !eo(e),
|
|
4104
|
+
buildContext: so
|
|
4106
4105
|
},
|
|
4107
4106
|
[V.PURGATORY]: {
|
|
4108
|
-
guard: (e) =>
|
|
4109
|
-
buildContext:
|
|
4107
|
+
guard: (e) => $a(e) && ga(e.room) && !oo(e),
|
|
4108
|
+
buildContext: so
|
|
4110
4109
|
},
|
|
4111
4110
|
[V.P2P_ROOM]: {
|
|
4112
|
-
guard: (e) =>
|
|
4113
|
-
buildContext:
|
|
4111
|
+
guard: (e) => $a(e) && ma(e.room) && !no(e) && !oo(e),
|
|
4112
|
+
buildContext: so
|
|
4114
4113
|
},
|
|
4115
4114
|
[V.DIRECT_P2P_ROOM]: {
|
|
4116
|
-
guard: (e) =>
|
|
4115
|
+
guard: (e) => $a(e) && no(e) && !oo(e),
|
|
4117
4116
|
buildContext: (e) => ({
|
|
4118
|
-
...
|
|
4117
|
+
...so(e),
|
|
4119
4118
|
isDirectPeerToPeer: !0
|
|
4120
4119
|
})
|
|
4121
4120
|
},
|
|
4122
4121
|
[V.IN_ROOM]: {
|
|
4123
|
-
guard:
|
|
4122
|
+
guard: oo,
|
|
4124
4123
|
buildContext: (e) => {
|
|
4125
4124
|
let { token: t, conferenceForToken: n } = e;
|
|
4126
4125
|
return {
|
|
4127
|
-
...
|
|
4126
|
+
...so(e),
|
|
4128
4127
|
token: t,
|
|
4129
4128
|
conferenceForToken: n
|
|
4130
4129
|
};
|
|
@@ -4134,14 +4133,14 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
4134
4133
|
guard: (e) => e.pendingDisconnect === !0,
|
|
4135
4134
|
buildContext: () => ({})
|
|
4136
4135
|
}
|
|
4137
|
-
},
|
|
4136
|
+
}, co = (e) => ga(e.room) || ma(e.room) || to(e), lo = () => ({}), uo = () => p({
|
|
4138
4137
|
types: {
|
|
4139
|
-
context:
|
|
4138
|
+
context: Ja,
|
|
4140
4139
|
events: {}
|
|
4141
4140
|
},
|
|
4142
4141
|
actions: {
|
|
4143
4142
|
setConnecting: u(({ event: e, context: t }) => e.type === "CALL.CONNECTING" ? { raw: {
|
|
4144
|
-
...
|
|
4143
|
+
...lo(),
|
|
4145
4144
|
number: e.number,
|
|
4146
4145
|
answer: e.answer,
|
|
4147
4146
|
extraHeaders: e.extraHeaders
|
|
@@ -4152,7 +4151,7 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
4152
4151
|
room: e.room,
|
|
4153
4152
|
participantName: e.participantName
|
|
4154
4153
|
};
|
|
4155
|
-
x(e.token) ? (n.token = e.token, n.conferenceForToken = e.room) :
|
|
4154
|
+
x(e.token) ? (n.token = e.token, n.conferenceForToken = e.room) : co(e) && (n.token = void 0, n.conferenceForToken = void 0), Pe(e.isDirectPeerToPeer) && (n.isDirectPeerToPeer = e.isDirectPeerToPeer);
|
|
4156
4155
|
let r = t.raw.startedTimestamp, i = Me(r) ? r : Date.now();
|
|
4157
4156
|
return { raw: {
|
|
4158
4157
|
...t.raw,
|
|
@@ -4175,16 +4174,16 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
4175
4174
|
startedTimestamp: r
|
|
4176
4175
|
} };
|
|
4177
4176
|
}),
|
|
4178
|
-
reset: u(() => ({ raw:
|
|
4177
|
+
reset: u(() => ({ raw: lo() })),
|
|
4179
4178
|
prepareDisconnect: u(() => ({ raw: {
|
|
4180
|
-
...
|
|
4179
|
+
...lo(),
|
|
4181
4180
|
pendingDisconnect: !0
|
|
4182
4181
|
} }))
|
|
4183
4182
|
}
|
|
4184
|
-
}),
|
|
4183
|
+
}), fo = () => uo().createMachine({
|
|
4185
4184
|
id: "call",
|
|
4186
4185
|
initial: V.IDLE,
|
|
4187
|
-
context:
|
|
4186
|
+
context: Ja,
|
|
4188
4187
|
states: {
|
|
4189
4188
|
[V.IDLE]: {
|
|
4190
4189
|
entry: u(() => ({ state: H[V.IDLE].buildContext() })),
|
|
@@ -4382,12 +4381,12 @@ var xi = /* @__PURE__ */ function(e) {
|
|
|
4382
4381
|
});
|
|
4383
4382
|
//#endregion
|
|
4384
4383
|
//#region src/CallManager/CallStateMachine/inRoomCredentialsPreviousReset.ts
|
|
4385
|
-
function
|
|
4384
|
+
function po(e) {
|
|
4386
4385
|
return e !== B;
|
|
4387
4386
|
}
|
|
4388
4387
|
//#endregion
|
|
4389
4388
|
//#region src/CallManager/CallStateMachine/CallStateMachine.ts
|
|
4390
|
-
var
|
|
4389
|
+
var mo = g("CallManager: CallStateMachine"), ho = class extends D {
|
|
4391
4390
|
constructor(e, t) {
|
|
4392
4391
|
super(e), this.subscribeToEvents(t);
|
|
4393
4392
|
}
|
|
@@ -4481,7 +4480,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4481
4480
|
(a !== i.token || o !== i.conferenceForToken) && (t = i, e(i));
|
|
4482
4481
|
return;
|
|
4483
4482
|
}
|
|
4484
|
-
|
|
4483
|
+
po(n.value) && (t = void 0);
|
|
4485
4484
|
});
|
|
4486
4485
|
return () => {
|
|
4487
4486
|
n.unsubscribe();
|
|
@@ -4494,7 +4493,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4494
4493
|
t !== r && (t = r, e({ conferenceForToken: r }));
|
|
4495
4494
|
return;
|
|
4496
4495
|
}
|
|
4497
|
-
|
|
4496
|
+
po(n.value) && (t = void 0);
|
|
4498
4497
|
});
|
|
4499
4498
|
return () => {
|
|
4500
4499
|
n.unsubscribe();
|
|
@@ -4505,7 +4504,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4505
4504
|
}
|
|
4506
4505
|
send(e) {
|
|
4507
4506
|
if (!this.actor.getSnapshot().can(e)) {
|
|
4508
|
-
|
|
4507
|
+
mo(`[CallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`);
|
|
4509
4508
|
return;
|
|
4510
4509
|
}
|
|
4511
4510
|
super.send(e);
|
|
@@ -4546,11 +4545,11 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4546
4545
|
this.send({ type: "CALL.RESET" });
|
|
4547
4546
|
}));
|
|
4548
4547
|
}
|
|
4549
|
-
},
|
|
4548
|
+
}, go = (e) => new ho(fo(), e), _o = (e) => [...e.keys()].map((t) => e.get(t)), vo = (e, t) => _o(e).find((e) => e?.type === t), yo = async (e) => e.getStats().then((e) => vo(e, "codec")?.mimeType), bo = class {
|
|
4550
4549
|
async getCodecFromSender(e) {
|
|
4551
|
-
return await
|
|
4550
|
+
return await yo(e) ?? "";
|
|
4552
4551
|
}
|
|
4553
|
-
},
|
|
4552
|
+
}, xo = g("TaskQueue"), So = class {
|
|
4554
4553
|
stackPromises = te({ noRunIsNotActual: !0 });
|
|
4555
4554
|
async add(e) {
|
|
4556
4555
|
return this.stackPromises.add(e), this.run();
|
|
@@ -4560,25 +4559,25 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4560
4559
|
}
|
|
4561
4560
|
async run() {
|
|
4562
4561
|
return this.stackPromises().catch((e) => {
|
|
4563
|
-
|
|
4562
|
+
xo("TaskQueue: error", e);
|
|
4564
4563
|
});
|
|
4565
4564
|
}
|
|
4566
|
-
},
|
|
4565
|
+
}, Co = class {
|
|
4567
4566
|
taskQueue;
|
|
4568
4567
|
onSetParameters;
|
|
4569
4568
|
constructor(e) {
|
|
4570
|
-
this.onSetParameters = e, this.taskQueue = new
|
|
4569
|
+
this.onSetParameters = e, this.taskQueue = new So();
|
|
4571
4570
|
}
|
|
4572
4571
|
async setEncodingsToSender(e, t) {
|
|
4573
|
-
return this.taskQueue.add(async () =>
|
|
4572
|
+
return this.taskQueue.add(async () => Ia(e, t, this.onSetParameters));
|
|
4574
4573
|
}
|
|
4575
4574
|
stop() {
|
|
4576
4575
|
this.taskQueue.stop();
|
|
4577
4576
|
}
|
|
4578
|
-
},
|
|
4579
|
-
let n = e.getSettings(), r = n.width, i = n.height, a = r === void 0 ?
|
|
4580
|
-
return Math.max(a, o,
|
|
4581
|
-
},
|
|
4577
|
+
}, wo = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), To = 1e6, U = (e) => e * To, Eo = U(.06), Do = U(4), Oo = (e) => e <= 64 ? Eo : e <= 128 ? U(.12) : e <= 256 ? U(.25) : e <= 384 ? U(.32) : e <= 426 ? U(.38) : e <= 640 ? U(.5) : e <= 848 ? U(.7) : e <= 1280 ? U(1) : e <= 1920 ? U(2) : Do, ko = "av1", Ao = (e) => wo(e, ko), jo = .6, Mo = (e, t) => Ao(t) ? e * jo : e, No = (e) => Mo(Eo, e), Po = (e) => Mo(Do, e), Fo = (e, t) => Mo(Oo(e), t), Io = 1, Lo = ({ videoTrack: e, targetSize: t }) => {
|
|
4578
|
+
let n = e.getSettings(), r = n.width, i = n.height, a = r === void 0 ? Io : r / t.width, o = i === void 0 ? Io : i / t.height;
|
|
4579
|
+
return Math.max(a, o, Io);
|
|
4580
|
+
}, Ro = class {
|
|
4582
4581
|
ignoreForCodec;
|
|
4583
4582
|
senderFinder;
|
|
4584
4583
|
codecProvider;
|
|
@@ -4603,7 +4602,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4603
4602
|
sender: r
|
|
4604
4603
|
};
|
|
4605
4604
|
let i = await this.codecProvider.getCodecFromSender(r);
|
|
4606
|
-
if (
|
|
4605
|
+
if (wo(i, this.ignoreForCodec)) return {
|
|
4607
4606
|
...this.resultNoChanged,
|
|
4608
4607
|
sender: r
|
|
4609
4608
|
};
|
|
@@ -4627,7 +4626,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4627
4626
|
sender: n
|
|
4628
4627
|
};
|
|
4629
4628
|
let r = await this.codecProvider.getCodecFromSender(n);
|
|
4630
|
-
if (
|
|
4629
|
+
if (wo(r, this.ignoreForCodec)) return {
|
|
4631
4630
|
...this.resultNoChanged,
|
|
4632
4631
|
sender: n
|
|
4633
4632
|
};
|
|
@@ -4656,12 +4655,12 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4656
4655
|
async downgradeResolutionSender(e) {
|
|
4657
4656
|
let { sender: t, codec: n } = e, r = {
|
|
4658
4657
|
scaleResolutionDownBy: 200,
|
|
4659
|
-
maxBitrate:
|
|
4658
|
+
maxBitrate: No(n)
|
|
4660
4659
|
};
|
|
4661
4660
|
return this.parametersSetter.setEncodingsToSender(t, r);
|
|
4662
4661
|
}
|
|
4663
4662
|
async setBitrateByTrackResolution(e) {
|
|
4664
|
-
let { sender: t, videoTrack: n, codec: r } = e, i = n.getSettings().width, a = i === void 0 ?
|
|
4663
|
+
let { sender: t, videoTrack: n, codec: r } = e, i = n.getSettings().width, a = i === void 0 ? Po(r) : Fo(i, r);
|
|
4665
4664
|
return this.parametersSetter.setEncodingsToSender(t, {
|
|
4666
4665
|
scaleResolutionDownBy: 1,
|
|
4667
4666
|
maxBitrate: a
|
|
@@ -4672,19 +4671,19 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4672
4671
|
width: Number(n),
|
|
4673
4672
|
height: Number(r)
|
|
4674
4673
|
}, c = {
|
|
4675
|
-
scaleResolutionDownBy:
|
|
4674
|
+
scaleResolutionDownBy: Lo({
|
|
4676
4675
|
videoTrack: a,
|
|
4677
4676
|
targetSize: s
|
|
4678
4677
|
}),
|
|
4679
|
-
maxBitrate:
|
|
4678
|
+
maxBitrate: Fo(s.width, o)
|
|
4680
4679
|
};
|
|
4681
4680
|
return this.parametersSetter.setEncodingsToSender(i, c);
|
|
4682
4681
|
}
|
|
4683
|
-
},
|
|
4682
|
+
}, zo = (e) => e.find((e) => e.track?.kind === "video"), Bo = class {
|
|
4684
4683
|
findVideoSender(e) {
|
|
4685
|
-
return
|
|
4684
|
+
return zo(e);
|
|
4686
4685
|
}
|
|
4687
|
-
},
|
|
4686
|
+
}, Vo = class {
|
|
4688
4687
|
currentSender;
|
|
4689
4688
|
originalReplaceTrack;
|
|
4690
4689
|
lastWidth;
|
|
@@ -4731,7 +4730,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4731
4730
|
detachTrack() {
|
|
4732
4731
|
this.setTimeoutRequest.cancelRequest(), this.lastWidth = void 0, this.lastHeight = void 0;
|
|
4733
4732
|
}
|
|
4734
|
-
},
|
|
4733
|
+
}, Ho = class {
|
|
4735
4734
|
apiManager;
|
|
4736
4735
|
currentHandler;
|
|
4737
4736
|
constructor(e) {
|
|
@@ -4743,7 +4742,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4743
4742
|
unsubscribe() {
|
|
4744
4743
|
this.currentHandler &&= (this.apiManager.off("main-cam-control", this.currentHandler), void 0);
|
|
4745
4744
|
}
|
|
4746
|
-
},
|
|
4745
|
+
}, Uo = g("VideoSendingBalancer"), Wo = class {
|
|
4747
4746
|
eventHandler;
|
|
4748
4747
|
senderBalancer;
|
|
4749
4748
|
parametersSetterWithQueue;
|
|
@@ -4751,11 +4750,11 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4751
4750
|
serverHeaders;
|
|
4752
4751
|
trackMonitor;
|
|
4753
4752
|
constructor(e, t, { ignoreForCodec: n, onSetParameters: r, pollIntervalMs: i } = {}) {
|
|
4754
|
-
this.getConnection = t, this.eventHandler = new
|
|
4755
|
-
senderFinder: new
|
|
4756
|
-
codecProvider: new
|
|
4753
|
+
this.getConnection = t, this.eventHandler = new Ho(e), this.parametersSetterWithQueue = new Co(r), this.senderBalancer = new Ro({
|
|
4754
|
+
senderFinder: new Bo(),
|
|
4755
|
+
codecProvider: new bo(),
|
|
4757
4756
|
parametersSetter: this.parametersSetterWithQueue
|
|
4758
|
-
}, { ignoreForCodec: n }), this.trackMonitor = new
|
|
4757
|
+
}, { ignoreForCodec: n }), this.trackMonitor = new Vo({ pollIntervalMs: i });
|
|
4759
4758
|
}
|
|
4760
4759
|
subscribe() {
|
|
4761
4760
|
this.eventHandler.subscribe(this.handleMainCamControl);
|
|
@@ -4767,7 +4766,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4767
4766
|
this.clearState();
|
|
4768
4767
|
let e = this.getConnection();
|
|
4769
4768
|
e ? this.senderBalancer.reset(e).catch((e) => {
|
|
4770
|
-
|
|
4769
|
+
Uo("reset sender encodings: error", e);
|
|
4771
4770
|
}).finally(() => {
|
|
4772
4771
|
this.parametersSetterWithQueue.stop();
|
|
4773
4772
|
}) : this.parametersSetterWithQueue.stop();
|
|
@@ -4778,7 +4777,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4778
4777
|
let t = await this.senderBalancer.balance(e, this.serverHeaders);
|
|
4779
4778
|
return this.trackMonitor.subscribe(t.sender, () => {
|
|
4780
4779
|
this.balance().catch((e) => {
|
|
4781
|
-
|
|
4780
|
+
Uo("balance on track change: error", e);
|
|
4782
4781
|
});
|
|
4783
4782
|
}), t;
|
|
4784
4783
|
}
|
|
@@ -4787,22 +4786,22 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4787
4786
|
}
|
|
4788
4787
|
handleMainCamControl = (e) => {
|
|
4789
4788
|
this.serverHeaders = e, this.balance().catch((e) => {
|
|
4790
|
-
|
|
4789
|
+
Uo("handleMainCamControl: error", e);
|
|
4791
4790
|
});
|
|
4792
4791
|
};
|
|
4793
|
-
},
|
|
4792
|
+
}, Go = 6e3, Ko = 52e4, qo = (e, t) => e.getSenders().filter((e) => e.track?.kind === t), Jo = (e, t) => e === "audio" ? Go : No(t), Yo = (e) => e.track !== null, Xo = class {
|
|
4794
4793
|
previousBitrates = /* @__PURE__ */ new Map();
|
|
4795
4794
|
async setMinBitrateForSenders(e, t = "all") {
|
|
4796
4795
|
let n = [];
|
|
4797
4796
|
if (!e) return;
|
|
4798
|
-
(t === "audio" || t === "all") && n.push(...
|
|
4799
|
-
let r = n.filter(
|
|
4797
|
+
(t === "audio" || t === "all") && n.push(...qo(e, "audio")), (t === "video" || t === "all") && n.push(...qo(e, "video"));
|
|
4798
|
+
let r = n.filter(Yo).map(async (e) => {
|
|
4800
4799
|
let t = e.getParameters();
|
|
4801
|
-
this.saveCurrentBitrate(e, t), await
|
|
4800
|
+
this.saveCurrentBitrate(e, t), await Fa(e, {
|
|
4802
4801
|
...t,
|
|
4803
4802
|
encodings: t.encodings.map((t) => ({
|
|
4804
4803
|
...t,
|
|
4805
|
-
maxBitrate:
|
|
4804
|
+
maxBitrate: Jo(e.track.kind)
|
|
4806
4805
|
}))
|
|
4807
4806
|
});
|
|
4808
4807
|
});
|
|
@@ -4811,15 +4810,15 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4811
4810
|
async restoreBitrateForSenders(e, t = "all") {
|
|
4812
4811
|
let n = [];
|
|
4813
4812
|
if (!e) return;
|
|
4814
|
-
(t === "audio" || t === "all") && n.push(...
|
|
4813
|
+
(t === "audio" || t === "all") && n.push(...qo(e, "audio")), (t === "video" || t === "all") && n.push(...qo(e, "video"));
|
|
4815
4814
|
let r = n.map(async (e) => {
|
|
4816
4815
|
let t = this.getSavedBitrate(e);
|
|
4817
4816
|
if (t) {
|
|
4818
|
-
let n = e.getParameters(), r = e.track?.kind === "video", i = r ? await
|
|
4819
|
-
await
|
|
4817
|
+
let n = e.getParameters(), r = e.track?.kind === "video", i = r ? await yo(e) : void 0;
|
|
4818
|
+
await Fa(e, {
|
|
4820
4819
|
...n,
|
|
4821
4820
|
encodings: t.map((e) => {
|
|
4822
|
-
let t = r ?
|
|
4821
|
+
let t = r ? Po(i) : Ko;
|
|
4823
4822
|
return {
|
|
4824
4823
|
...e,
|
|
4825
4824
|
maxBitrate: e.maxBitrate ?? t
|
|
@@ -4851,12 +4850,12 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4851
4850
|
}
|
|
4852
4851
|
}, W = /* @__PURE__ */ function(e) {
|
|
4853
4852
|
return e.BYE = "Terminated", e.WEBRTC_ERROR = "WebRTC Error", e.CANCELED = "Canceled", e.REQUEST_TIMEOUT = "Request Timeout", e.REJECTED = "Rejected", e.REDIRECTED = "Redirected", e.UNAVAILABLE = "Unavailable", e.NOT_FOUND = "Not Found", e.ADDRESS_INCOMPLETE = "Address Incomplete", e.INCOMPATIBLE_SDP = "Incompatible SDP", e.BAD_MEDIA_DESCRIPTION = "Bad Media Description", e;
|
|
4854
|
-
}({}),
|
|
4853
|
+
}({}), Zo = g("CallManager: MCUSession"), Qo = class {
|
|
4855
4854
|
events;
|
|
4856
4855
|
rtcSession;
|
|
4857
4856
|
disposers = /* @__PURE__ */ new Set();
|
|
4858
4857
|
pcConfig;
|
|
4859
|
-
bitrateStateManager = new
|
|
4858
|
+
bitrateStateManager = new Xo();
|
|
4860
4859
|
constructor(e) {
|
|
4861
4860
|
this.events = e, e.on("failed", this.handleEnded), e.on("ended", this.handleEnded);
|
|
4862
4861
|
}
|
|
@@ -4878,7 +4877,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4878
4877
|
this.handleCall().then(ee).catch((e) => {
|
|
4879
4878
|
m(e);
|
|
4880
4879
|
}), this.pcConfig = { iceServers: a }, this.rtcSession = e.call(t(n), {
|
|
4881
|
-
mediaStream:
|
|
4880
|
+
mediaStream: va(r, {
|
|
4882
4881
|
directionVideo: o,
|
|
4883
4882
|
directionAudio: s,
|
|
4884
4883
|
contentHint: c
|
|
@@ -4911,7 +4910,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4911
4910
|
offerToReceiveAudio: o,
|
|
4912
4911
|
offerToReceiveVideo: s
|
|
4913
4912
|
},
|
|
4914
|
-
mediaStream:
|
|
4913
|
+
mediaStream: va(t, {
|
|
4915
4914
|
directionVideo: i,
|
|
4916
4915
|
directionAudio: a,
|
|
4917
4916
|
contentHint: c
|
|
@@ -4929,7 +4928,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4929
4928
|
});
|
|
4930
4929
|
async replaceMediaStream(e, t) {
|
|
4931
4930
|
if (!this.rtcSession) throw Error("No rtcSession established");
|
|
4932
|
-
let { contentHint: n } = t ?? {}, r =
|
|
4931
|
+
let { contentHint: n } = t ?? {}, r = va(e, { contentHint: n });
|
|
4933
4932
|
if (r === void 0) throw Error("No preparedMediaStream");
|
|
4934
4933
|
return this.rtcSession.replaceMediaStream(r, t);
|
|
4935
4934
|
}
|
|
@@ -4939,12 +4938,12 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4939
4938
|
}
|
|
4940
4939
|
setMinBitrateForSenders(e = "all") {
|
|
4941
4940
|
this.bitrateStateManager.setMinBitrateForSenders(this.connection, e).catch((e) => {
|
|
4942
|
-
|
|
4941
|
+
Zo("setMinBitrateForSenders", e);
|
|
4943
4942
|
});
|
|
4944
4943
|
}
|
|
4945
4944
|
restoreBitrateForSenders(e = "all") {
|
|
4946
4945
|
this.bitrateStateManager.restoreBitrateForSenders(this.connection, e).catch((e) => {
|
|
4947
|
-
|
|
4946
|
+
Zo("restoreBitrateForSenders", e);
|
|
4948
4947
|
});
|
|
4949
4948
|
}
|
|
4950
4949
|
reset = () => {
|
|
@@ -4976,7 +4975,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4976
4975
|
});
|
|
4977
4976
|
subscribeToSessionEvents(e) {
|
|
4978
4977
|
this.events.eachTriggers((t, n) => {
|
|
4979
|
-
let r =
|
|
4978
|
+
let r = _i.find((e) => e === n);
|
|
4980
4979
|
r && (e.on(r, t), this.disposers.add(() => {
|
|
4981
4980
|
e.off(r, t);
|
|
4982
4981
|
}));
|
|
@@ -4991,7 +4990,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
4991
4990
|
let { originator: t } = e;
|
|
4992
4991
|
t === "remote" && this.events.trigger("ended:fromserver", e);
|
|
4993
4992
|
};
|
|
4994
|
-
},
|
|
4993
|
+
}, $o = (e) => e === "auto" ? "high" : e, es = 10, ts = 500, ns = 5e3, rs = class {
|
|
4995
4994
|
cancelableSendOfferWithRepeatedCalls;
|
|
4996
4995
|
currentRenegotiation;
|
|
4997
4996
|
config;
|
|
@@ -5003,7 +5002,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5003
5002
|
this.config = {
|
|
5004
5003
|
...e,
|
|
5005
5004
|
quality: n,
|
|
5006
|
-
effectiveQuality:
|
|
5005
|
+
effectiveQuality: $o(n)
|
|
5007
5006
|
}, this.tools = t, this.connection = new RTCPeerConnection(e.pcConfig), this.addTransceivers();
|
|
5008
5007
|
}
|
|
5009
5008
|
get settings() {
|
|
@@ -5023,7 +5022,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5023
5022
|
}
|
|
5024
5023
|
async setQuality(e) {
|
|
5025
5024
|
if (!this.lastCallParams) return !1;
|
|
5026
|
-
let t = this.config.effectiveQuality, n = this.config.quality, r =
|
|
5025
|
+
let t = this.config.effectiveQuality, n = this.config.quality, r = $o(e);
|
|
5027
5026
|
return e === n && r === t ? !1 : (this.config.quality = e, this.config.effectiveQuality = r, r !== t && await this.renegotiate(this.lastCallParams), !0);
|
|
5028
5027
|
}
|
|
5029
5028
|
async applyQuality(e) {
|
|
@@ -5071,8 +5070,8 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5071
5070
|
this.cancelableSendOfferWithRepeatedCalls = m({
|
|
5072
5071
|
targetFunction: r,
|
|
5073
5072
|
isComplete: i,
|
|
5074
|
-
callLimit:
|
|
5075
|
-
delay:
|
|
5073
|
+
callLimit: es,
|
|
5074
|
+
delay: ts,
|
|
5076
5075
|
isRejectAsValid: !0,
|
|
5077
5076
|
isCheckBeforeCall: !1
|
|
5078
5077
|
});
|
|
@@ -5128,7 +5127,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5128
5127
|
}
|
|
5129
5128
|
i = setTimeout(() => {
|
|
5130
5129
|
s(/* @__PURE__ */ Error("Timed out waiting for stable signaling state and ready connection state"));
|
|
5131
|
-
},
|
|
5130
|
+
}, ns), this.connection.addEventListener("signalingstatechange", c), this.connection.addEventListener("connectionstatechange", c), c();
|
|
5132
5131
|
});
|
|
5133
5132
|
}
|
|
5134
5133
|
async waitForTracks() {
|
|
@@ -5149,15 +5148,15 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5149
5148
|
cancelSendOfferWithRepeatedCalls() {
|
|
5150
5149
|
this.cancelableSendOfferWithRepeatedCalls?.cancel();
|
|
5151
5150
|
}
|
|
5152
|
-
},
|
|
5153
|
-
let n =
|
|
5151
|
+
}, is = (e) => e.getSettings(), as = (e, t) => {
|
|
5152
|
+
let n = is(e), r = t;
|
|
5154
5153
|
r ??= e.label;
|
|
5155
5154
|
let i = n?.msid;
|
|
5156
5155
|
return i ??= r, i ??= e.id, i;
|
|
5157
|
-
},
|
|
5158
|
-
let n =
|
|
5156
|
+
}, os = (e, t) => {
|
|
5157
|
+
let n = is(e), r = t;
|
|
5159
5158
|
return r ??= n?.msid, r ??= e.label, (r && r.length > 0 ? r : void 0) ?? e.id;
|
|
5160
|
-
},
|
|
5159
|
+
}, ss = class {
|
|
5161
5160
|
participantGroups = /* @__PURE__ */ new Map();
|
|
5162
5161
|
trackToGroup = /* @__PURE__ */ new Map();
|
|
5163
5162
|
trackDisposers = /* @__PURE__ */ new Map();
|
|
@@ -5171,7 +5170,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5171
5170
|
}), this.trackDisposers.clear();
|
|
5172
5171
|
}
|
|
5173
5172
|
addTrack(e, { onRemoved: t, streamHint: n } = {}) {
|
|
5174
|
-
let r =
|
|
5173
|
+
let r = os(e, n), i = as(e, n);
|
|
5175
5174
|
if (this.trackToGroup.has(e.id)) return {
|
|
5176
5175
|
isAddedTrack: !1,
|
|
5177
5176
|
isAddedStream: !1
|
|
@@ -5251,14 +5250,14 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5251
5250
|
let n = /* @__PURE__ */ new Map();
|
|
5252
5251
|
return this.participantGroups.set(e, n), n;
|
|
5253
5252
|
}
|
|
5254
|
-
},
|
|
5253
|
+
}, cs = (e, t) => {
|
|
5255
5254
|
if (!e || !t) return e === t;
|
|
5256
5255
|
let n = e.mainStream?.id, r = t.mainStream?.id, i = e.contentedStream?.id, a = t.contentedStream?.id;
|
|
5257
5256
|
return n === r && i === a;
|
|
5258
|
-
},
|
|
5257
|
+
}, ls = class {
|
|
5259
5258
|
lastEmittedStreams;
|
|
5260
5259
|
hasChanged(e) {
|
|
5261
|
-
return !
|
|
5260
|
+
return !cs(this.lastEmittedStreams, e);
|
|
5262
5261
|
}
|
|
5263
5262
|
updateLastEmittedStreams(e) {
|
|
5264
5263
|
this.lastEmittedStreams = e;
|
|
@@ -5269,7 +5268,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5269
5268
|
reset() {
|
|
5270
5269
|
this.lastEmittedStreams = void 0;
|
|
5271
5270
|
}
|
|
5272
|
-
},
|
|
5271
|
+
}, us = "default", ds = "dual", fs = "content_", ps = (e) => `${fs}${e.toLowerCase()}`, ms = (e) => [...e.getTracks()].some((e) => e.label.includes(ds)), hs = class {
|
|
5273
5272
|
mainRemoteStreamsManager;
|
|
5274
5273
|
recvRemoteStreamsManager;
|
|
5275
5274
|
constructor(e, t) {
|
|
@@ -5283,7 +5282,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5283
5282
|
return {
|
|
5284
5283
|
manager: t,
|
|
5285
5284
|
getRemoteStreams: () => {
|
|
5286
|
-
let n = t.getStreams(), r = n.find((e) => !
|
|
5285
|
+
let n = t.getStreams(), r = n.find((e) => !ms(e));
|
|
5287
5286
|
return {
|
|
5288
5287
|
mainStream: r,
|
|
5289
5288
|
contentedStream: e.isAvailable ? n.find((e) => e !== r) : void 0
|
|
@@ -5296,26 +5295,26 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5296
5295
|
return {
|
|
5297
5296
|
manager: t,
|
|
5298
5297
|
getRemoteStreams: () => ({
|
|
5299
|
-
mainStream: t.getStreams(
|
|
5298
|
+
mainStream: t.getStreams(us)[0],
|
|
5300
5299
|
contentedStream: this.getRecvRemoteContentedStream({ stateInfo: e })
|
|
5301
5300
|
})
|
|
5302
5301
|
};
|
|
5303
5302
|
}
|
|
5304
5303
|
getRecvRemoteContentedStream({ stateInfo: e }) {
|
|
5305
5304
|
if (!e.isAvailable || e.codec === void 0) return;
|
|
5306
|
-
let t =
|
|
5305
|
+
let t = ps(e.codec);
|
|
5307
5306
|
return this.recvRemoteStreamsManager.getStreams(t)[0];
|
|
5308
5307
|
}
|
|
5309
|
-
},
|
|
5310
|
-
let t =
|
|
5308
|
+
}, gs = "udp", G = g("CallManager"), _s = (e) => e.transport?.iceTransport ? e.transport.iceTransport.getLocalCandidates() : [], vs = (e) => e.getReceivers().flatMap(_s), ys = (e) => {
|
|
5309
|
+
let t = vs(e).filter(({ protocol: e, port: t }) => t !== null && gs === e).map(({ port: e }) => e);
|
|
5311
5310
|
return [...new Set(t)];
|
|
5312
|
-
},
|
|
5311
|
+
}, bs = (e) => e.streams[0]?.id, xs = class extends e {
|
|
5313
5312
|
stateMachine;
|
|
5314
5313
|
sessionState;
|
|
5315
5314
|
isPendingCall = !1;
|
|
5316
5315
|
isPendingAnswer = !1;
|
|
5317
|
-
mainRemoteStreamsManager = new
|
|
5318
|
-
recvRemoteStreamsManager = new
|
|
5316
|
+
mainRemoteStreamsManager = new ss();
|
|
5317
|
+
recvRemoteStreamsManager = new ss();
|
|
5319
5318
|
streamsManagerProvider;
|
|
5320
5319
|
contentedStreamManager;
|
|
5321
5320
|
tools;
|
|
@@ -5330,9 +5329,9 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5330
5329
|
disposeRecvSessionTrackListener;
|
|
5331
5330
|
disposeInRoomCredentialsListener;
|
|
5332
5331
|
deferredStartRecvSessionRunner;
|
|
5333
|
-
streamsChangeTracker = new
|
|
5332
|
+
streamsChangeTracker = new ls();
|
|
5334
5333
|
constructor({ contentedStreamManager: e }, t, { callSessionState: n }) {
|
|
5335
|
-
super(
|
|
5334
|
+
super(bi()), this.contentedStreamManager = e, this.tools = t, this.mcuSession = new Qo(this.events), this.stateMachine = go(this.events), this.sessionState = n, this.sessionState.subscribeRoleChanges(this.onRoleChanged), this.streamsManagerProvider = new hs(this.mainRemoteStreamsManager, this.recvRemoteStreamsManager), this.deferredStartRecvSessionRunner = new Ka({
|
|
5336
5335
|
subscribe: (e) => this.stateMachine.onStateChange(e),
|
|
5337
5336
|
isReady: (e) => e === V.IN_ROOM,
|
|
5338
5337
|
isCancelled: (e) => e === V.IDLE,
|
|
@@ -5367,7 +5366,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5367
5366
|
}
|
|
5368
5367
|
get localPorts() {
|
|
5369
5368
|
let e = this.getActivePeerConnection();
|
|
5370
|
-
return e ?
|
|
5369
|
+
return e ? ys(e) : [];
|
|
5371
5370
|
}
|
|
5372
5371
|
getStreamsManagerProvider() {
|
|
5373
5372
|
return this.streamsManagerProvider;
|
|
@@ -5447,7 +5446,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5447
5446
|
G("setRecvQuality", e);
|
|
5448
5447
|
let { recvSession: t } = this;
|
|
5449
5448
|
if (!this.hasSpectator() || !t) return !1;
|
|
5450
|
-
let n = t.getQuality(), r = t.getEffectiveQuality(), i = t.getAudioChannel(), a =
|
|
5449
|
+
let n = t.getQuality(), r = t.getEffectiveQuality(), i = t.getAudioChannel(), a = $o(e);
|
|
5451
5450
|
if (e === n && a === r) return !1;
|
|
5452
5451
|
if (a === r) return await t.setQuality(e), this.events.trigger("recv-quality-changed", {
|
|
5453
5452
|
previousQuality: n,
|
|
@@ -5515,7 +5514,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5515
5514
|
}
|
|
5516
5515
|
subscribeMcuRemoteTrackEvents() {
|
|
5517
5516
|
this.on("peerconnection:ontrack", (e) => {
|
|
5518
|
-
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track,
|
|
5517
|
+
this.addRemoteTrack(this.mainRemoteStreamsManager, e.track, bs(e));
|
|
5519
5518
|
});
|
|
5520
5519
|
}
|
|
5521
5520
|
addRemoteTrack(e, t, n) {
|
|
@@ -5568,7 +5567,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5568
5567
|
}
|
|
5569
5568
|
attachRecvSessionTracks(e) {
|
|
5570
5569
|
let { peerConnection: t } = e, n = (e) => {
|
|
5571
|
-
this.addRemoteTrack(this.recvRemoteStreamsManager, e.track,
|
|
5570
|
+
this.addRemoteTrack(this.recvRemoteStreamsManager, e.track, bs(e));
|
|
5572
5571
|
};
|
|
5573
5572
|
t.addEventListener("track", n), this.disposeRecvSessionTrackListener = () => {
|
|
5574
5573
|
t.removeEventListener("track", n);
|
|
@@ -5597,7 +5596,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5597
5596
|
callResult: !1
|
|
5598
5597
|
};
|
|
5599
5598
|
this.stopRecvSession({ silent: n });
|
|
5600
|
-
let i = new
|
|
5599
|
+
let i = new rs({
|
|
5601
5600
|
audioChannel: e,
|
|
5602
5601
|
quality: t,
|
|
5603
5602
|
pcConfig: this.mcuSession.getPcConfig()
|
|
@@ -5627,11 +5626,11 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5627
5626
|
if (G("onRoleChanged", {
|
|
5628
5627
|
previous: e,
|
|
5629
5628
|
next: t
|
|
5630
|
-
}),
|
|
5629
|
+
}), ki(e, t) && (this.stopRecvSession(), this.deferredStartRecvSessionRunner.cancel(), this.emitEventChangedRemoteStreamsConnected()), Ai(e, t)) {
|
|
5631
5630
|
let e = t.recvParams;
|
|
5632
5631
|
this.stateMachine.getInRoomCredentials() === void 0 ? this.deferredStartRecvSessionRunner.set({ audioId: e.audioId }) : this.startRecvSession({ audioChannel: e.audioId }).catch(() => {});
|
|
5633
5632
|
}
|
|
5634
|
-
|
|
5633
|
+
ji(e, t) && this.mcuSession.restoreBitrateForSenders(), Mi(e, t) && this.mcuSession.setMinBitrateForSenders();
|
|
5635
5634
|
};
|
|
5636
5635
|
subscribeContentedStreamEvents() {
|
|
5637
5636
|
this.contentedStreamManager.on("available", this.emitEventChangedRemoteStreamsConnected), this.contentedStreamManager.on("not-available", this.emitEventChangedRemoteStreamsConnected);
|
|
@@ -5646,42 +5645,122 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5646
5645
|
async renegotiateMcuSession() {
|
|
5647
5646
|
return G("renegotiateMcuSession"), this.mcuSession.renegotiate();
|
|
5648
5647
|
}
|
|
5649
|
-
},
|
|
5648
|
+
}, Ss = (e) => e instanceof Object && ("originator" in e || "cause" in e), Cs = (e) => {
|
|
5650
5649
|
if (l(e)) return !0;
|
|
5651
|
-
if (!
|
|
5650
|
+
if (!Ss(e)) return !1;
|
|
5652
5651
|
let { originator: t, cause: n } = e;
|
|
5653
5652
|
return typeof n == "string" ? n === W.REQUEST_TIMEOUT || n === W.REJECTED || t === "local" && (n === W.CANCELED || n === W.BYE) : !1;
|
|
5654
|
-
},
|
|
5655
|
-
"
|
|
5656
|
-
"
|
|
5657
|
-
"
|
|
5658
|
-
"
|
|
5659
|
-
"
|
|
5660
|
-
],
|
|
5661
|
-
|
|
5653
|
+
}, ws = [
|
|
5654
|
+
"start",
|
|
5655
|
+
"started",
|
|
5656
|
+
"end",
|
|
5657
|
+
"ended",
|
|
5658
|
+
"failed"
|
|
5659
|
+
], Ts = () => new n(ws), Es = class {
|
|
5660
|
+
senders = /* @__PURE__ */ new Set();
|
|
5661
|
+
has(e) {
|
|
5662
|
+
return this.senders.has(e);
|
|
5663
|
+
}
|
|
5664
|
+
clear() {
|
|
5665
|
+
this.senders.clear();
|
|
5666
|
+
}
|
|
5667
|
+
getFromConnection(e) {
|
|
5668
|
+
return e.getSenders().filter((e) => this.has(e));
|
|
5669
|
+
}
|
|
5670
|
+
markTrack(e, t) {
|
|
5671
|
+
let n = e.getSenders().find((e) => e.track === t);
|
|
5672
|
+
n !== void 0 && this.senders.add(n);
|
|
5673
|
+
}
|
|
5674
|
+
stopTracks(e) {
|
|
5675
|
+
e.getSenders().forEach((e) => {
|
|
5676
|
+
e.track !== null && this.has(e) && e.track.stop();
|
|
5677
|
+
});
|
|
5678
|
+
}
|
|
5679
|
+
}, Ds = 109, Os = (e) => {
|
|
5680
|
+
let { isFirefox: t, hasLessOrEqualBrowserVersion: n } = Xi();
|
|
5681
|
+
return t && n({
|
|
5682
|
+
major: e,
|
|
5683
|
+
minor: 0,
|
|
5684
|
+
patch: 0
|
|
5685
|
+
});
|
|
5686
|
+
}, ks = async ({ sender: e, sendEncodings: t, degradationPreference: n }) => {
|
|
5687
|
+
t === void 0 && n === void 0 || await Fa(e, {
|
|
5688
|
+
encodings: t,
|
|
5689
|
+
degradationPreference: n
|
|
5690
|
+
});
|
|
5691
|
+
}, As = (e, t) => {
|
|
5692
|
+
if (typeof e.setDirection == "function") {
|
|
5693
|
+
e.setDirection(t);
|
|
5694
|
+
return;
|
|
5695
|
+
}
|
|
5696
|
+
e.direction = t;
|
|
5697
|
+
}, js = async (e, t, { directionVideo: n = "sendrecv", sendEncodings: r, degradationPreference: i }) => {
|
|
5698
|
+
let a = n, o = Os(Ds) ? (e.addTrack(t), e.getTransceivers().find((e) => e.sender.track === t)) : e.addTransceiver(t, {
|
|
5699
|
+
direction: a,
|
|
5700
|
+
sendEncodings: r
|
|
5701
|
+
});
|
|
5702
|
+
return a !== "recvonly" && o !== void 0 && await ks({
|
|
5703
|
+
sender: o.sender,
|
|
5704
|
+
sendEncodings: r,
|
|
5705
|
+
degradationPreference: i
|
|
5706
|
+
}), o;
|
|
5707
|
+
}, Ms = async (e, t, n) => {
|
|
5708
|
+
let r = await js(e, t, n);
|
|
5709
|
+
n.onAddedTransceiver !== void 0 && r !== void 0 && await n.onAddedTransceiver(r, t);
|
|
5710
|
+
}, Ns = async (e, t, n) => {
|
|
5711
|
+
let r = n.directionVideo, i = e.addTrack(t), a = e.getTransceivers().find((e) => e.sender === i);
|
|
5712
|
+
a !== void 0 && r !== void 0 && r !== a.direction && As(a, r), await ks({
|
|
5713
|
+
sender: i,
|
|
5714
|
+
sendEncodings: n.sendEncodings,
|
|
5715
|
+
degradationPreference: n.degradationPreference
|
|
5716
|
+
}), n.onAddedTransceiver !== void 0 && a !== void 0 && await n.onAddedTransceiver(a, t);
|
|
5717
|
+
}, Ps = async (e, t, n, { direction: r, directionVideo: i, sendEncodings: a, degradationPreference: o, onAddedTransceiver: s } = {}) => {
|
|
5718
|
+
let c = t.getFromConnection(e);
|
|
5719
|
+
if (c.length > 0) {
|
|
5720
|
+
let [e] = c;
|
|
5721
|
+
await e.replaceTrack(n), await ks({
|
|
5722
|
+
sender: e,
|
|
5723
|
+
sendEncodings: a,
|
|
5724
|
+
degradationPreference: o
|
|
5725
|
+
});
|
|
5726
|
+
return;
|
|
5727
|
+
}
|
|
5728
|
+
let l = e.getTransceivers().some((e) => e.currentDirection === "recvonly"), u = {
|
|
5729
|
+
directionVideo: r ?? i,
|
|
5730
|
+
sendEncodings: a,
|
|
5731
|
+
degradationPreference: o,
|
|
5732
|
+
onAddedTransceiver: s
|
|
5733
|
+
};
|
|
5734
|
+
if (l) {
|
|
5735
|
+
await Ns(e, n, u);
|
|
5736
|
+
return;
|
|
5737
|
+
}
|
|
5738
|
+
await Ms(e, n, u);
|
|
5739
|
+
}, K = /* @__PURE__ */ function(e) {
|
|
5740
|
+
return e.IDLE = "idle", e.STARTING = "starting", e.ACTIVE = "active", e.STOPPING = "stopping", e.FAILED = "failed", e;
|
|
5662
5741
|
}({}), q = /* @__PURE__ */ function(e) {
|
|
5663
5742
|
return e.LOG_TRANSITION = "logTransition", e.LOG_STATE_CHANGE = "logStateChange", e.SET_ERROR = "setError", e.CLEAR_ERROR = "clearError", e;
|
|
5664
5743
|
}({}), J = /* @__PURE__ */ function(e) {
|
|
5665
5744
|
return e.SCREEN_STARTING = "SCREEN.STARTING", e.SCREEN_STARTED = "SCREEN.STARTED", e.SCREEN_ENDING = "SCREEN.ENDING", e.SCREEN_ENDED = "SCREEN.ENDED", e.SCREEN_FAILED = "SCREEN.FAILED", e.CALL_ENDED = "CALL.ENDED", e.CALL_FAILED = "CALL.FAILED", e.PRESENTATION_RESET = "PRESENTATION.RESET", e;
|
|
5666
|
-
}({}),
|
|
5745
|
+
}({}), Fs = { lastError: void 0 }, Is = g("PresentationStateMachine"), Ls = (e) => e instanceof Error ? e : Error(JSON.stringify(e)), Rs = p({
|
|
5667
5746
|
types: {
|
|
5668
|
-
context:
|
|
5747
|
+
context: Fs,
|
|
5669
5748
|
events: {}
|
|
5670
5749
|
},
|
|
5671
5750
|
actions: {
|
|
5672
5751
|
[q.LOG_TRANSITION]: (e, t) => {
|
|
5673
|
-
|
|
5752
|
+
Is(`State transition: ${t.from} -> ${t.to} (${t.event})`);
|
|
5674
5753
|
},
|
|
5675
5754
|
[q.LOG_STATE_CHANGE]: (e, t) => {
|
|
5676
|
-
|
|
5755
|
+
Is("PresentationStateMachine state changed", t.state);
|
|
5677
5756
|
},
|
|
5678
|
-
[q.SET_ERROR]: u(({ event: e }) => "error" in e && e.error !== void 0 ? { lastError:
|
|
5757
|
+
[q.SET_ERROR]: u(({ event: e }) => "error" in e && e.error !== void 0 ? { lastError: Ls(e.error) } : { lastError: void 0 }),
|
|
5679
5758
|
[q.CLEAR_ERROR]: u(() => ({ lastError: void 0 }))
|
|
5680
5759
|
}
|
|
5681
5760
|
}).createMachine({
|
|
5682
5761
|
id: "presentation",
|
|
5683
5762
|
initial: K.IDLE,
|
|
5684
|
-
context:
|
|
5763
|
+
context: Fs,
|
|
5685
5764
|
states: {
|
|
5686
5765
|
[K.IDLE]: {
|
|
5687
5766
|
entry: {
|
|
@@ -5920,9 +5999,9 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5920
5999
|
}
|
|
5921
6000
|
}
|
|
5922
6001
|
}
|
|
5923
|
-
}),
|
|
5924
|
-
constructor(e) {
|
|
5925
|
-
super(
|
|
6002
|
+
}), zs = g("PresentationStateMachine"), Bs = class extends D {
|
|
6003
|
+
constructor(e, t) {
|
|
6004
|
+
super(Rs), this.subscribePresentationEvents(e), this.subscribeCallEvents(t);
|
|
5926
6005
|
}
|
|
5927
6006
|
get isIdle() {
|
|
5928
6007
|
return this.hasState(K.IDLE);
|
|
@@ -5959,26 +6038,29 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5959
6038
|
}
|
|
5960
6039
|
sendEvent(e) {
|
|
5961
6040
|
if (!this.actor.getSnapshot().can(e)) {
|
|
5962
|
-
|
|
6041
|
+
zs(`[PresentationStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`);
|
|
5963
6042
|
return;
|
|
5964
6043
|
}
|
|
5965
6044
|
super.send(e);
|
|
5966
6045
|
}
|
|
5967
|
-
|
|
5968
|
-
this.addSubscription(e.on("
|
|
6046
|
+
subscribePresentationEvents(e) {
|
|
6047
|
+
this.addSubscription(e.on("start", () => {
|
|
5969
6048
|
this.sendEvent({ type: J.SCREEN_STARTING });
|
|
5970
|
-
})), this.addSubscription(e.on("
|
|
6049
|
+
})), this.addSubscription(e.on("started", () => {
|
|
5971
6050
|
this.sendEvent({ type: J.SCREEN_STARTED });
|
|
5972
|
-
})), this.addSubscription(e.on("
|
|
6051
|
+
})), this.addSubscription(e.on("end", () => {
|
|
5973
6052
|
this.sendEvent({ type: J.SCREEN_ENDING });
|
|
5974
|
-
})), this.addSubscription(e.on("
|
|
6053
|
+
})), this.addSubscription(e.on("ended", () => {
|
|
5975
6054
|
this.sendEvent({ type: J.SCREEN_ENDED });
|
|
5976
|
-
})), this.addSubscription(e.on("
|
|
6055
|
+
})), this.addSubscription(e.on("failed", (e) => {
|
|
5977
6056
|
this.sendEvent({
|
|
5978
6057
|
type: J.SCREEN_FAILED,
|
|
5979
6058
|
error: e
|
|
5980
6059
|
});
|
|
5981
|
-
}))
|
|
6060
|
+
}));
|
|
6061
|
+
}
|
|
6062
|
+
subscribeCallEvents(e) {
|
|
6063
|
+
this.addSubscription(e.on("ended", () => {
|
|
5982
6064
|
this.sendEvent({ type: J.CALL_ENDED });
|
|
5983
6065
|
})), this.addSubscription(e.on("failed", (e) => {
|
|
5984
6066
|
this.sendEvent({
|
|
@@ -5987,47 +6069,43 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
5987
6069
|
});
|
|
5988
6070
|
}));
|
|
5989
6071
|
}
|
|
5990
|
-
},
|
|
6072
|
+
}, Vs = 1, Hs = (e, t) => t <= Vs ? {
|
|
5991
6073
|
...e,
|
|
5992
|
-
scaleResolutionDownBy:
|
|
5993
|
-
}
|
|
6074
|
+
scaleResolutionDownBy: Vs
|
|
6075
|
+
} : {
|
|
6076
|
+
...e,
|
|
6077
|
+
scaleResolutionDownBy: Math.max(e.scaleResolutionDownBy ?? Vs, t)
|
|
6078
|
+
}, Us = ({ videoTrack: e, sendEncodings: t, maxResolution: n }) => {
|
|
5994
6079
|
if (n === void 0) return t;
|
|
5995
|
-
let r =
|
|
5996
|
-
|
|
5997
|
-
let i = Vo({
|
|
5998
|
-
videoTrack: r,
|
|
6080
|
+
let r = Lo({
|
|
6081
|
+
videoTrack: e,
|
|
5999
6082
|
targetSize: n
|
|
6000
6083
|
});
|
|
6001
|
-
return
|
|
6002
|
-
},
|
|
6003
|
-
"
|
|
6004
|
-
|
|
6005
|
-
"presentation:end",
|
|
6006
|
-
"presentation:ended",
|
|
6007
|
-
"presentation:failed"
|
|
6008
|
-
], Hs = (e) => e instanceof Error ? e : Error(String(e)), Us = (e) => ee(e), Ws = class extends e {
|
|
6084
|
+
return t === void 0 || t.length === 0 ? [{ scaleResolutionDownBy: r }] : t.map((e) => Hs(e, r));
|
|
6085
|
+
}, Ws = 1, Gs = (e) => e instanceof Error ? e : Error(String(e)), Ks = (e, t) => {
|
|
6086
|
+
t !== "none" && "contentHint" in e && e.contentHint !== t && (e.contentHint = t);
|
|
6087
|
+
}, qs = (e) => ee(e), Js = class extends e {
|
|
6009
6088
|
stateMachine;
|
|
6010
6089
|
promisePendingStartPresentation;
|
|
6011
6090
|
promisePendingStopPresentation;
|
|
6012
|
-
|
|
6091
|
+
videoTrackPresentationCurrent;
|
|
6013
6092
|
maxBitrate;
|
|
6093
|
+
presentationSenders = new Es();
|
|
6014
6094
|
cancelableSendPresentationWithRepeatedCalls;
|
|
6015
6095
|
callManager;
|
|
6016
6096
|
constructor({ callManager: e, maxBitrate: t }) {
|
|
6017
|
-
super(
|
|
6097
|
+
super(Ts()), this.callManager = e, this.maxBitrate = t, this.stateMachine = new Bs(this.events, this.callManager.events), this.subscribe();
|
|
6018
6098
|
}
|
|
6019
6099
|
get isPendingPresentation() {
|
|
6020
6100
|
return !!this.promisePendingStartPresentation || !!this.promisePendingStopPresentation;
|
|
6021
6101
|
}
|
|
6022
6102
|
get isPresentationInProcess() {
|
|
6023
|
-
return !!this.
|
|
6103
|
+
return !!this.videoTrackPresentationCurrent || this.isPendingPresentation;
|
|
6024
6104
|
}
|
|
6025
6105
|
async startPresentation(e, t, { isNeedReinvite: n, contentHint: r, sendEncodings: i, maxResolution: a, onAddedTransceiver: o } = {}, s) {
|
|
6026
|
-
|
|
6027
|
-
if (this.streamPresentationCurrent) throw Error("Presentation is already started");
|
|
6106
|
+
if (this.getRtcSessionProtected(), this.videoTrackPresentationCurrent) throw Error("Presentation is already started");
|
|
6028
6107
|
return this.sendPresentationWithDuplicatedCalls(e, {
|
|
6029
|
-
|
|
6030
|
-
stream: t,
|
|
6108
|
+
videoTrack: t,
|
|
6031
6109
|
presentationOptions: {
|
|
6032
6110
|
isNeedReinvite: n,
|
|
6033
6111
|
contentHint: r,
|
|
@@ -6040,19 +6118,16 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6040
6118
|
}
|
|
6041
6119
|
async stopPresentation(e) {
|
|
6042
6120
|
this.cancelSendPresentationWithRepeatedCalls();
|
|
6043
|
-
let t = this.
|
|
6044
|
-
this.promisePendingStartPresentation && await this.promisePendingStartPresentation.catch(() => {})
|
|
6045
|
-
let r = this.callManager.getEstablishedRTCSession();
|
|
6046
|
-
return r && t ? n = e().then(async () => r.stopPresentation(t)).catch((e) => {
|
|
6121
|
+
let t = this.videoTrackPresentationCurrent, n = this.promisePendingStartPresentation ?? Promise.resolve(void 0);
|
|
6122
|
+
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation.catch(() => {}), this.callManager.getEstablishedRTCSession() && t ? n = e().then(async () => this.executeStopPresentation(t)).catch((e) => {
|
|
6047
6123
|
throw this.notifyPresentationFailed(e), e;
|
|
6048
|
-
}) : t && this.
|
|
6049
|
-
this.
|
|
6124
|
+
}) : t && this.emitPresentationEvent("ended", t), this.promisePendingStopPresentation = n, n.finally(() => {
|
|
6125
|
+
this.resetPresentationState();
|
|
6050
6126
|
});
|
|
6051
6127
|
}
|
|
6052
6128
|
async updatePresentation(e, t, { contentHint: n, sendEncodings: r, maxResolution: i, onAddedTransceiver: a } = {}) {
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this.sendPresentation(e, o, t, {
|
|
6129
|
+
if (this.getRtcSessionProtected(), !this.videoTrackPresentationCurrent) throw Error("Presentation has not started yet");
|
|
6130
|
+
return this.promisePendingStartPresentation && await this.promisePendingStartPresentation, this.sendPresentation(e, t, {
|
|
6056
6131
|
contentHint: n,
|
|
6057
6132
|
sendEncodings: r,
|
|
6058
6133
|
maxResolution: i,
|
|
@@ -6064,65 +6139,96 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6064
6139
|
this.cancelableSendPresentationWithRepeatedCalls?.stopRepeatedCalls();
|
|
6065
6140
|
}
|
|
6066
6141
|
subscribe() {
|
|
6067
|
-
|
|
6068
|
-
this.callManager.on(e, (t) => {
|
|
6069
|
-
this.events.trigger(e, t);
|
|
6070
|
-
});
|
|
6071
|
-
}), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
|
|
6142
|
+
this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded);
|
|
6072
6143
|
}
|
|
6073
|
-
async sendPresentationWithDuplicatedCalls(e, {
|
|
6074
|
-
let
|
|
6144
|
+
async sendPresentationWithDuplicatedCalls(e, { videoTrack: t, presentationOptions: n, options: r = { callLimit: Ws } }) {
|
|
6145
|
+
let i = async () => this.sendPresentation(e, t, n), a = () => !!this.videoTrackPresentationCurrent;
|
|
6075
6146
|
return this.cancelableSendPresentationWithRepeatedCalls = m({
|
|
6076
|
-
targetFunction:
|
|
6077
|
-
isComplete:
|
|
6147
|
+
targetFunction: i,
|
|
6148
|
+
isComplete: a,
|
|
6078
6149
|
isRejectAsValid: !0,
|
|
6079
|
-
...
|
|
6150
|
+
...r
|
|
6080
6151
|
}), this.cancelableSendPresentationWithRepeatedCalls.then((e) => e);
|
|
6081
6152
|
}
|
|
6082
|
-
async sendPresentation(e, t,
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
})).then(this.setMaxBitrate).then(() => n).catch((e) => {
|
|
6095
|
-
throw this.removeStreamPresentationCurrent(), this.notifyPresentationFailed(e), e;
|
|
6153
|
+
async sendPresentation(e, t, { isNeedReinvite: n = !0, contentHint: r = "detail", degradationPreference: i, sendEncodings: a, maxResolution: o, onAddedTransceiver: s }) {
|
|
6154
|
+
Ks(t, r), this.videoTrackPresentationCurrent = t;
|
|
6155
|
+
let c = Us({
|
|
6156
|
+
videoTrack: t,
|
|
6157
|
+
sendEncodings: a,
|
|
6158
|
+
maxResolution: o
|
|
6159
|
+
}), l = e().then(async () => this.executeStartPresentation(t, n, {
|
|
6160
|
+
degradationPreference: i,
|
|
6161
|
+
onAddedTransceiver: s,
|
|
6162
|
+
sendEncodings: c
|
|
6163
|
+
})).then(this.setMaxBitrate).then(() => t).catch((e) => {
|
|
6164
|
+
throw this.removeVideoTrackPresentationCurrent(), this.notifyPresentationFailed(e), e;
|
|
6096
6165
|
});
|
|
6097
|
-
return this.promisePendingStartPresentation =
|
|
6166
|
+
return this.promisePendingStartPresentation = l, l.finally(() => {
|
|
6098
6167
|
this.promisePendingStartPresentation = void 0;
|
|
6099
6168
|
});
|
|
6100
6169
|
}
|
|
6170
|
+
async executeStartPresentation(e, t, { degradationPreference: n, onAddedTransceiver: r, sendEncodings: i }) {
|
|
6171
|
+
let a = this.getConnectionProtected();
|
|
6172
|
+
this.emitPresentationEvent("start", e);
|
|
6173
|
+
try {
|
|
6174
|
+
if (await Ps(a, this.presentationSenders, e, {
|
|
6175
|
+
degradationPreference: n,
|
|
6176
|
+
onAddedTransceiver: r,
|
|
6177
|
+
sendEncodings: i
|
|
6178
|
+
}), this.presentationSenders.markTrack(a, e), t) try {
|
|
6179
|
+
await this.callManager.renegotiate();
|
|
6180
|
+
} catch {
|
|
6181
|
+
throw this.presentationSenders.stopTracks(a), Error("Fail reInvite");
|
|
6182
|
+
}
|
|
6183
|
+
return this.emitPresentationEvent("started", e), e;
|
|
6184
|
+
} catch (e) {
|
|
6185
|
+
throw e instanceof Error && e.message === "Fail reInvite" ? e : Error("Wrong videoTrack");
|
|
6186
|
+
}
|
|
6187
|
+
}
|
|
6188
|
+
async executeStopPresentation(e) {
|
|
6189
|
+
this.emitPresentationEvent("end", e);
|
|
6190
|
+
let { connection: t } = this.callManager;
|
|
6191
|
+
return t && this.presentationSenders.stopTracks(t), this.emitPresentationEvent("ended", e), e;
|
|
6192
|
+
}
|
|
6101
6193
|
setMaxBitrate = async () => {
|
|
6102
|
-
let { connection: e } = this.callManager, {
|
|
6103
|
-
!e || !t || n === void 0
|
|
6194
|
+
let { connection: e } = this.callManager, { videoTrackPresentationCurrent: t } = this, { maxBitrate: n } = this;
|
|
6195
|
+
if (!e || !t || n === void 0) return;
|
|
6196
|
+
let r = e.getSenders().find((e) => e.track === t);
|
|
6197
|
+
r && await Ia(r, { maxBitrate: n });
|
|
6104
6198
|
};
|
|
6105
6199
|
getRtcSessionProtected = () => {
|
|
6106
6200
|
let e = this.callManager.getEstablishedRTCSession();
|
|
6107
6201
|
if (!e) throw Error("No rtcSession established");
|
|
6108
6202
|
return e;
|
|
6109
6203
|
};
|
|
6204
|
+
getConnectionProtected = () => {
|
|
6205
|
+
let { connection: e } = this.callManager;
|
|
6206
|
+
if (!e) throw Error("No connection established");
|
|
6207
|
+
return e;
|
|
6208
|
+
};
|
|
6110
6209
|
handleEnded = () => {
|
|
6111
6210
|
this.reset();
|
|
6112
6211
|
};
|
|
6113
6212
|
reset() {
|
|
6114
6213
|
this.cancelSendPresentationWithRepeatedCalls(), this.resetPresentation();
|
|
6115
6214
|
}
|
|
6215
|
+
resetPresentationState() {
|
|
6216
|
+
this.removeVideoTrackPresentationCurrent(), this.promisePendingStartPresentation = void 0, this.promisePendingStopPresentation = void 0;
|
|
6217
|
+
}
|
|
6116
6218
|
resetPresentation() {
|
|
6117
|
-
this.
|
|
6219
|
+
this.resetPresentationState(), this.presentationSenders.clear();
|
|
6220
|
+
}
|
|
6221
|
+
removeVideoTrackPresentationCurrent() {
|
|
6222
|
+
delete this.videoTrackPresentationCurrent;
|
|
6118
6223
|
}
|
|
6119
|
-
|
|
6120
|
-
|
|
6224
|
+
emitPresentationEvent(e, t) {
|
|
6225
|
+
this.events.trigger(e, t);
|
|
6121
6226
|
}
|
|
6122
6227
|
notifyPresentationFailed(e) {
|
|
6123
|
-
|
|
6228
|
+
let t = Gs(e);
|
|
6229
|
+
this.emitPresentationEvent("failed", t);
|
|
6124
6230
|
}
|
|
6125
|
-
},
|
|
6231
|
+
}, Ys = g("ContentedStreamStateMachine"), Xs = p({
|
|
6126
6232
|
types: {
|
|
6127
6233
|
context: {},
|
|
6128
6234
|
events: {}
|
|
@@ -6156,9 +6262,9 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6156
6262
|
}
|
|
6157
6263
|
} }
|
|
6158
6264
|
}
|
|
6159
|
-
}),
|
|
6265
|
+
}), Zs = class extends D {
|
|
6160
6266
|
constructor() {
|
|
6161
|
-
super(
|
|
6267
|
+
super(Xs);
|
|
6162
6268
|
}
|
|
6163
6269
|
get isAvailable() {
|
|
6164
6270
|
return this.state === "contented-stream:available";
|
|
@@ -6180,7 +6286,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6180
6286
|
}
|
|
6181
6287
|
send(e) {
|
|
6182
6288
|
if (!this.actor.getSnapshot().can(e)) {
|
|
6183
|
-
|
|
6289
|
+
Ys(`[ContentedStreamStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`);
|
|
6184
6290
|
return;
|
|
6185
6291
|
}
|
|
6186
6292
|
super.send(e);
|
|
@@ -6195,10 +6301,10 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6195
6301
|
this.send({ type: "CONTENTED_STREAM.NOT_AVAILABLE" });
|
|
6196
6302
|
}));
|
|
6197
6303
|
}
|
|
6198
|
-
},
|
|
6304
|
+
}, Qs = ["available", "not-available"], $s = () => new n(Qs), ec = class extends e {
|
|
6199
6305
|
stateMachine;
|
|
6200
6306
|
constructor() {
|
|
6201
|
-
super(
|
|
6307
|
+
super($s()), this.stateMachine = new Zs(), this.proxyEvents();
|
|
6202
6308
|
}
|
|
6203
6309
|
get isAvailable() {
|
|
6204
6310
|
return this.stateMachine.isAvailable;
|
|
@@ -6221,31 +6327,31 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6221
6327
|
e.isAvailable ? this.events.trigger("available", { codec: e.codec }) : this.events.trigger("not-available", {});
|
|
6222
6328
|
});
|
|
6223
6329
|
}
|
|
6224
|
-
},
|
|
6330
|
+
}, tc = [
|
|
6225
6331
|
"ringing",
|
|
6226
6332
|
"declinedIncomingCall",
|
|
6227
6333
|
"terminatedIncomingCall",
|
|
6228
6334
|
"failedIncomingCall"
|
|
6229
|
-
],
|
|
6335
|
+
], nc = () => new n(tc), Y = /* @__PURE__ */ function(e) {
|
|
6230
6336
|
return e.IDLE = "incoming:idle", e.RINGING = "incoming:ringing", e.CONSUMED = "incoming:consumed", e.DECLINED = "incoming:declined", e.TERMINATED = "incoming:terminated", e.FAILED = "incoming:failed", e;
|
|
6231
6337
|
}({}), X = /* @__PURE__ */ function(e) {
|
|
6232
6338
|
return e.LOG_TRANSITION = "logTransition", e.LOG_STATE_CHANGE = "logStateChange", e.REMEMBER_INCOMING = "rememberIncoming", e.REMEMBER_REASON = "rememberReason", e.CLEAR_INCOMING = "clearIncoming", e;
|
|
6233
6339
|
}({}), Z = /* @__PURE__ */ function(e) {
|
|
6234
6340
|
return e.RINGING = "INCOMING.RINGING", e.CONSUMED = "INCOMING.CONSUMED", e.DECLINED = "INCOMING.DECLINED", e.TERMINATED = "INCOMING.TERMINATED", e.FAILED = "INCOMING.FAILED", e.CLEAR = "INCOMING.CLEAR", e;
|
|
6235
|
-
}({}),
|
|
6341
|
+
}({}), rc = {
|
|
6236
6342
|
remoteCallerData: void 0,
|
|
6237
6343
|
lastReason: void 0
|
|
6238
|
-
},
|
|
6344
|
+
}, ic = g("IncomingCallManager: createIncomingCallMachineSetup"), ac = p({
|
|
6239
6345
|
types: {
|
|
6240
|
-
context:
|
|
6346
|
+
context: rc,
|
|
6241
6347
|
events: {}
|
|
6242
6348
|
},
|
|
6243
6349
|
actions: {
|
|
6244
6350
|
[X.LOG_TRANSITION]: (e, t) => {
|
|
6245
|
-
|
|
6351
|
+
ic(`State transition: ${t.from} -> ${t.to} (${t.event})`);
|
|
6246
6352
|
},
|
|
6247
6353
|
[X.LOG_STATE_CHANGE]: (e, t) => {
|
|
6248
|
-
|
|
6354
|
+
ic("IncomingCallStateMachine state changed", t.state);
|
|
6249
6355
|
},
|
|
6250
6356
|
[X.REMEMBER_INCOMING]: u(({ event: e }) => ({
|
|
6251
6357
|
remoteCallerData: e.data,
|
|
@@ -6272,7 +6378,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6272
6378
|
}).createMachine({
|
|
6273
6379
|
id: "incoming",
|
|
6274
6380
|
initial: Y.IDLE,
|
|
6275
|
-
context:
|
|
6381
|
+
context: rc,
|
|
6276
6382
|
states: {
|
|
6277
6383
|
[Y.IDLE]: {
|
|
6278
6384
|
entry: {
|
|
@@ -6499,9 +6605,9 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6499
6605
|
}
|
|
6500
6606
|
}
|
|
6501
6607
|
}
|
|
6502
|
-
}),
|
|
6608
|
+
}), oc = g("IncomingCallStateMachine"), sc = class extends D {
|
|
6503
6609
|
constructor({ incomingEvents: e, connectionEvents: t }) {
|
|
6504
|
-
super(
|
|
6610
|
+
super(ac), this.subscribeIncomingEvents(e), this.subscribeConnectionEvents(t);
|
|
6505
6611
|
}
|
|
6506
6612
|
get isIdle() {
|
|
6507
6613
|
return this.hasState(Y.IDLE);
|
|
@@ -6547,7 +6653,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6547
6653
|
}
|
|
6548
6654
|
sendEvent(e) {
|
|
6549
6655
|
if (!this.actor.getSnapshot().can(e)) {
|
|
6550
|
-
|
|
6656
|
+
oc(`[IncomingCallStateMachine] Invalid transition: ${e.type} from ${this.state}. Event cannot be processed in current state.`);
|
|
6551
6657
|
return;
|
|
6552
6658
|
}
|
|
6553
6659
|
super.send(e);
|
|
@@ -6603,23 +6709,23 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6603
6709
|
toClearIncoming = () => {
|
|
6604
6710
|
this.sendEvent({ type: Z.CLEAR });
|
|
6605
6711
|
};
|
|
6606
|
-
},
|
|
6712
|
+
}, cc = 486, lc = 487, uc = (e) => ({
|
|
6607
6713
|
displayName: e.remote_identity.display_name,
|
|
6608
6714
|
host: e.remote_identity.uri.host,
|
|
6609
6715
|
incomingNumber: e.remote_identity.uri.user,
|
|
6610
6716
|
rtcSession: e
|
|
6611
|
-
}),
|
|
6717
|
+
}), dc = class extends e {
|
|
6612
6718
|
stateMachine;
|
|
6613
6719
|
incomingRTCSession;
|
|
6614
6720
|
connectionManager;
|
|
6615
6721
|
constructor(e) {
|
|
6616
|
-
super(
|
|
6722
|
+
super(nc()), this.connectionManager = e, this.stateMachine = new sc({
|
|
6617
6723
|
incomingEvents: this.events,
|
|
6618
6724
|
connectionEvents: this.connectionManager.events
|
|
6619
6725
|
}), this.start();
|
|
6620
6726
|
}
|
|
6621
6727
|
get remoteCallerData() {
|
|
6622
|
-
if (this.incomingRTCSession) return
|
|
6728
|
+
if (this.incomingRTCSession) return uc(this.incomingRTCSession);
|
|
6623
6729
|
}
|
|
6624
6730
|
get isAvailableIncomingCall() {
|
|
6625
6731
|
return !!this.incomingRTCSession;
|
|
@@ -6639,10 +6745,10 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6639
6745
|
let e = this.getIncomingRTCSession();
|
|
6640
6746
|
return this.stateMachine.toConsumed(), this.removeIncomingSession(), e;
|
|
6641
6747
|
};
|
|
6642
|
-
async declineToIncomingCall({ statusCode: e =
|
|
6748
|
+
async declineToIncomingCall({ statusCode: e = lc } = {}) {
|
|
6643
6749
|
return new Promise((t, n) => {
|
|
6644
6750
|
try {
|
|
6645
|
-
let n = this.getIncomingRTCSession(), r =
|
|
6751
|
+
let n = this.getIncomingRTCSession(), r = uc(n);
|
|
6646
6752
|
this.removeIncomingSession(), this.events.trigger("declinedIncomingCall", r), n.terminate({ status_code: e }), t();
|
|
6647
6753
|
} catch (e) {
|
|
6648
6754
|
n(e);
|
|
@@ -6650,7 +6756,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6650
6756
|
});
|
|
6651
6757
|
}
|
|
6652
6758
|
async busyIncomingCall() {
|
|
6653
|
-
return this.declineToIncomingCall({ statusCode:
|
|
6759
|
+
return this.declineToIncomingCall({ statusCode: cc });
|
|
6654
6760
|
}
|
|
6655
6761
|
subscribe() {
|
|
6656
6762
|
this.connectionManager.on("newRTCSession", this.handleNewRTCSession);
|
|
@@ -6663,7 +6769,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6663
6769
|
};
|
|
6664
6770
|
setIncomingSession(e) {
|
|
6665
6771
|
this.incomingRTCSession = e;
|
|
6666
|
-
let t =
|
|
6772
|
+
let t = uc(e);
|
|
6667
6773
|
e.on("failed", (e) => {
|
|
6668
6774
|
this.removeIncomingSession(), e.originator === "local" ? this.events.trigger("terminatedIncomingCall", t) : this.events.trigger("failedIncomingCall", t);
|
|
6669
6775
|
}), this.events.trigger("ringing", t);
|
|
@@ -6671,7 +6777,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6671
6777
|
removeIncomingSession() {
|
|
6672
6778
|
delete this.incomingRTCSession;
|
|
6673
6779
|
}
|
|
6674
|
-
},
|
|
6780
|
+
}, fc = class {
|
|
6675
6781
|
apiManager;
|
|
6676
6782
|
connectionManager;
|
|
6677
6783
|
callManager;
|
|
@@ -6700,7 +6806,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6700
6806
|
];
|
|
6701
6807
|
n.sendEnterRoom(r);
|
|
6702
6808
|
};
|
|
6703
|
-
},
|
|
6809
|
+
}, pc = ["snapshot-changed"], mc = () => new n(pc), hc = (e, t) => Object.is(e, t), gc = (e, t) => e.connection.value === t.connection.value && pe(e.call, t.call) && e.incoming.value === t.incoming.value && e.presentation.value === t.presentation.value && e.autoConnector.value === t.autoConnector.value && pe(e.callReconnect, t.callReconnect) && pe(e.callSessionState, t.callSessionState), _c = (e, t) => ({
|
|
6704
6810
|
connection: e.connection.getSnapshot(),
|
|
6705
6811
|
call: e.call.getSnapshot(),
|
|
6706
6812
|
incoming: e.incoming.getSnapshot(),
|
|
@@ -6708,21 +6814,21 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6708
6814
|
autoConnector: e.autoConnector.getSnapshot(),
|
|
6709
6815
|
callReconnect: e.callReconnect.getSnapshot(),
|
|
6710
6816
|
callSessionState: t.getSnapshot()
|
|
6711
|
-
}),
|
|
6817
|
+
}), vc = class extends e {
|
|
6712
6818
|
machines;
|
|
6713
6819
|
callSessionState;
|
|
6714
6820
|
currentSnapshot;
|
|
6715
6821
|
subscribers = /* @__PURE__ */ new Set();
|
|
6716
6822
|
actorSubscriptions = [];
|
|
6717
6823
|
constructor(e) {
|
|
6718
|
-
super(
|
|
6824
|
+
super(mc()), this.machines = {
|
|
6719
6825
|
connection: e.connectionManager.stateMachine,
|
|
6720
6826
|
call: e.callManager.stateMachine,
|
|
6721
6827
|
incoming: e.incomingCallManager.stateMachine,
|
|
6722
6828
|
presentation: e.presentationManager.stateMachine,
|
|
6723
6829
|
autoConnector: e.autoConnectorManager.stateMachine,
|
|
6724
6830
|
callReconnect: e.callReconnectManager.stateMachine
|
|
6725
|
-
}, this.callSessionState = e.callSessionState, this.currentSnapshot =
|
|
6831
|
+
}, this.callSessionState = e.callSessionState, this.currentSnapshot = _c(this.machines, this.callSessionState), this.actorSubscriptions.push(this.machines.connection.subscribe(this.notifySubscribers), this.machines.call.subscribe(this.notifySubscribers), this.machines.incoming.subscribe(this.notifySubscribers), this.machines.presentation.subscribe(this.notifySubscribers), this.machines.autoConnector.subscribe(this.notifySubscribers), this.machines.callReconnect.subscribe(this.notifySubscribers), { unsubscribe: this.callSessionState.subscribe(this.notifySubscribers) });
|
|
6726
6832
|
}
|
|
6727
6833
|
getSnapshot() {
|
|
6728
6834
|
return this.currentSnapshot;
|
|
@@ -6731,7 +6837,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6731
6837
|
let r = typeof t == "function", i = r ? e : (e) => e, a = {
|
|
6732
6838
|
selector: i,
|
|
6733
6839
|
listener: r ? t : e,
|
|
6734
|
-
equals: r ? n ??
|
|
6840
|
+
equals: r ? n ?? hc : gc,
|
|
6735
6841
|
current: i(this.currentSnapshot)
|
|
6736
6842
|
};
|
|
6737
6843
|
return this.subscribers.add(a), () => {
|
|
@@ -6745,8 +6851,8 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6745
6851
|
}
|
|
6746
6852
|
notifySubscribers = () => {
|
|
6747
6853
|
let e = this.currentSnapshot;
|
|
6748
|
-
this.currentSnapshot =
|
|
6749
|
-
let t =
|
|
6854
|
+
this.currentSnapshot = _c(this.machines, this.callSessionState);
|
|
6855
|
+
let t = gc(e, this.currentSnapshot);
|
|
6750
6856
|
for (let e of this.subscribers) {
|
|
6751
6857
|
let t = e.selector(this.currentSnapshot);
|
|
6752
6858
|
e.equals(e.current, t) || (e.current = t, e.listener(t));
|
|
@@ -6758,26 +6864,26 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6758
6864
|
};
|
|
6759
6865
|
}, Q = /* @__PURE__ */ function(e) {
|
|
6760
6866
|
return e.DISCONNECTED = "system:disconnected", e.DISCONNECTING = "system:disconnecting", e.CONNECTING = "system:connecting", e.READY_TO_CALL = "system:readyToCall", e.CALL_CONNECTING = "system:callConnecting", e.CALL_RECONNECTING = "system:callReconnecting", e.CALL_DISCONNECTING = "system:callDisconnecting", e.CALL_ACTIVE = "system:callActive", e;
|
|
6761
|
-
}({}),
|
|
6762
|
-
let t =
|
|
6867
|
+
}({}), yc = (e) => e.connection.value, bc = (e) => e.autoConnector.value, xc = (e) => e.call, Sc = (e) => e.call.value, Cc = (e) => e.incoming.value, wc = (e) => e.presentation.value, Tc = (e) => {
|
|
6868
|
+
let t = Sc(e);
|
|
6763
6869
|
return t === V.IN_ROOM || t === V.ROOM_PENDING_AUTH || t === V.PURGATORY || t === V.P2P_ROOM || t === V.DIRECT_P2P_ROOM || t === V.PRESENTATION_CALL;
|
|
6764
|
-
},
|
|
6870
|
+
}, Ec = (e) => {
|
|
6765
6871
|
let t = e.callReconnect.value;
|
|
6766
6872
|
return t === L.EVALUATING || t === L.BACKOFF || t === L.WAITING_SIGNALING || t === L.ATTEMPTING;
|
|
6767
|
-
},
|
|
6768
|
-
selectConnectionStatus:
|
|
6769
|
-
selectAutoConnectorStatus:
|
|
6770
|
-
selectCallState:
|
|
6771
|
-
selectCallStatus:
|
|
6772
|
-
selectIncomingStatus:
|
|
6773
|
-
selectPresentationStatus:
|
|
6774
|
-
selectIsInCall:
|
|
6775
|
-
selectIsCallReconnecting:
|
|
6873
|
+
}, Dc = {
|
|
6874
|
+
selectConnectionStatus: yc,
|
|
6875
|
+
selectAutoConnectorStatus: bc,
|
|
6876
|
+
selectCallState: xc,
|
|
6877
|
+
selectCallStatus: Sc,
|
|
6878
|
+
selectIncomingStatus: Cc,
|
|
6879
|
+
selectPresentationStatus: wc,
|
|
6880
|
+
selectIsInCall: Tc,
|
|
6881
|
+
selectIsCallReconnecting: Ec,
|
|
6776
6882
|
selectSystemStatus: (e) => {
|
|
6777
|
-
let t =
|
|
6883
|
+
let t = Sc(e);
|
|
6778
6884
|
if (t === V.IN_ROOM || t === V.ROOM_PENDING_AUTH || t === V.PURGATORY || t === V.P2P_ROOM || t === V.DIRECT_P2P_ROOM || t === V.PRESENTATION_CALL) return Q.CALL_ACTIVE;
|
|
6779
|
-
if (
|
|
6780
|
-
let n =
|
|
6885
|
+
if (Ec(e)) return Q.CALL_RECONNECTING;
|
|
6886
|
+
let n = yc(e), r = bc(e);
|
|
6781
6887
|
if (n === k.DISCONNECTING || r === P.DISCONNECTING) return Q.DISCONNECTING;
|
|
6782
6888
|
if (r === P.ATTEMPTING_CONNECT || r === P.ATTEMPTING_GATE || r === P.WAITING_BEFORE_RETRY || r === P.CONNECTED_MONITORING && n !== k.ESTABLISHED) return Q.CONNECTING;
|
|
6783
6889
|
if (n === k.IDLE || n === k.DISCONNECTED) return Q.DISCONNECTED;
|
|
@@ -6789,69 +6895,69 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6789
6895
|
default: return Q.READY_TO_CALL;
|
|
6790
6896
|
}
|
|
6791
6897
|
}
|
|
6792
|
-
},
|
|
6898
|
+
}, Oc = 1e3, $ = /* @__PURE__ */ function(e) {
|
|
6793
6899
|
return e.INBOUND_RTP = "inbound-rtp", e.REMOTE_OUTBOUND_RTP = "remote-outbound-rtp", e.MEDIA_SOURCE = "media-source", e.OUTBOUND_RTP = "outbound-rtp", e.REMOTE_INBOUND_RTP = "remote-inbound-rtp", e.CODEC = "codec", e.CANDIDATE_PAIR = "candidate-pair", e.CERTIFICATE = "certificate", e.TRANSPORT = "transport", e.LOCAL_CANDIDATE = "local-candidate", e.REMOTE_CANDIDATE = "remote-candidate", e;
|
|
6794
|
-
}({}),
|
|
6900
|
+
}({}), kc = ["collected", "stopped"], Ac = () => new n(kc), jc = () => Xi().isChrome, Mc = () => "performance" in window ? performance.now() : Date.now(), Nc = (e) => [...e.keys()].reduce((t, n) => {
|
|
6795
6901
|
let r = e.get(n);
|
|
6796
6902
|
return r === void 0 ? t : {
|
|
6797
6903
|
...t,
|
|
6798
6904
|
[r.type]: r
|
|
6799
6905
|
};
|
|
6800
|
-
}, {}),
|
|
6906
|
+
}, {}), Pc = (e) => {
|
|
6801
6907
|
if (!e) return {
|
|
6802
6908
|
outboundRtp: void 0,
|
|
6803
6909
|
codec: void 0,
|
|
6804
6910
|
mediaSource: void 0,
|
|
6805
6911
|
remoteInboundRtp: void 0
|
|
6806
6912
|
};
|
|
6807
|
-
let t =
|
|
6913
|
+
let t = Nc(e);
|
|
6808
6914
|
return {
|
|
6809
6915
|
outboundRtp: t[$.OUTBOUND_RTP],
|
|
6810
6916
|
codec: t[$.CODEC],
|
|
6811
6917
|
mediaSource: t[$.MEDIA_SOURCE],
|
|
6812
6918
|
remoteInboundRtp: t[$.REMOTE_INBOUND_RTP]
|
|
6813
6919
|
};
|
|
6814
|
-
},
|
|
6920
|
+
}, Fc = (e) => {
|
|
6815
6921
|
if (!e) return {
|
|
6816
6922
|
outboundRtp: void 0,
|
|
6817
6923
|
codec: void 0,
|
|
6818
6924
|
mediaSource: void 0,
|
|
6819
6925
|
remoteInboundRtp: void 0
|
|
6820
6926
|
};
|
|
6821
|
-
let t =
|
|
6927
|
+
let t = Nc(e);
|
|
6822
6928
|
return {
|
|
6823
6929
|
outboundRtp: t[$.OUTBOUND_RTP],
|
|
6824
6930
|
codec: t[$.CODEC],
|
|
6825
6931
|
mediaSource: t[$.MEDIA_SOURCE],
|
|
6826
6932
|
remoteInboundRtp: t[$.REMOTE_INBOUND_RTP]
|
|
6827
6933
|
};
|
|
6828
|
-
},
|
|
6934
|
+
}, Ic = ({ videoReceiversStats: e, synchronizationSourcesVideo: t }) => {
|
|
6829
6935
|
if (!e) return {
|
|
6830
6936
|
inboundRtp: void 0,
|
|
6831
6937
|
codec: void 0,
|
|
6832
6938
|
synchronizationSources: t
|
|
6833
6939
|
};
|
|
6834
|
-
let n =
|
|
6940
|
+
let n = Nc(e);
|
|
6835
6941
|
return {
|
|
6836
6942
|
inboundRtp: n[$.INBOUND_RTP],
|
|
6837
6943
|
codec: n[$.CODEC],
|
|
6838
6944
|
synchronizationSources: t
|
|
6839
6945
|
};
|
|
6840
|
-
},
|
|
6946
|
+
}, Lc = ({ audioReceiverStats: e, synchronizationSourcesAudio: t }) => {
|
|
6841
6947
|
if (!e) return {
|
|
6842
6948
|
inboundRtp: void 0,
|
|
6843
6949
|
codec: void 0,
|
|
6844
6950
|
remoteOutboundRtp: void 0,
|
|
6845
6951
|
synchronizationSources: t
|
|
6846
6952
|
};
|
|
6847
|
-
let n =
|
|
6953
|
+
let n = Nc(e);
|
|
6848
6954
|
return {
|
|
6849
6955
|
inboundRtp: n[$.INBOUND_RTP],
|
|
6850
6956
|
codec: n[$.CODEC],
|
|
6851
6957
|
remoteOutboundRtp: n[$.REMOTE_OUTBOUND_RTP],
|
|
6852
6958
|
synchronizationSources: t
|
|
6853
6959
|
};
|
|
6854
|
-
},
|
|
6960
|
+
}, Rc = (e) => {
|
|
6855
6961
|
if (!e) return {
|
|
6856
6962
|
candidatePair: void 0,
|
|
6857
6963
|
certificate: void 0,
|
|
@@ -6859,7 +6965,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6859
6965
|
remoteCandidate: void 0,
|
|
6860
6966
|
transport: void 0
|
|
6861
6967
|
};
|
|
6862
|
-
let t =
|
|
6968
|
+
let t = Nc(e);
|
|
6863
6969
|
return {
|
|
6864
6970
|
candidatePair: t[$.CANDIDATE_PAIR],
|
|
6865
6971
|
certificate: t[$.CERTIFICATE],
|
|
@@ -6867,38 +6973,38 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6867
6973
|
remoteCandidate: t[$.REMOTE_CANDIDATE],
|
|
6868
6974
|
transport: t[$.TRANSPORT]
|
|
6869
6975
|
};
|
|
6870
|
-
},
|
|
6871
|
-
video:
|
|
6872
|
-
secondVideo:
|
|
6873
|
-
audio:
|
|
6874
|
-
additional:
|
|
6875
|
-
}),
|
|
6876
|
-
video:
|
|
6976
|
+
}, zc = ({ audioSenderStats: e, videoSenderFirstStats: t, videoSenderSecondStats: n }) => ({
|
|
6977
|
+
video: Fc(t),
|
|
6978
|
+
secondVideo: Fc(n),
|
|
6979
|
+
audio: Pc(e),
|
|
6980
|
+
additional: Rc(e ?? t ?? n)
|
|
6981
|
+
}), Bc = ({ audioReceiverStats: e, videoReceiverFirstStats: t, videoReceiverSecondStats: n, synchronizationSources: r }) => ({
|
|
6982
|
+
video: Ic({
|
|
6877
6983
|
videoReceiversStats: t,
|
|
6878
6984
|
synchronizationSourcesVideo: r.video
|
|
6879
6985
|
}),
|
|
6880
|
-
secondVideo:
|
|
6986
|
+
secondVideo: Ic({
|
|
6881
6987
|
videoReceiversStats: n,
|
|
6882
6988
|
synchronizationSourcesVideo: r.secondVideo ?? r.video
|
|
6883
6989
|
}),
|
|
6884
|
-
audio:
|
|
6990
|
+
audio: Lc({
|
|
6885
6991
|
audioReceiverStats: e,
|
|
6886
6992
|
synchronizationSourcesAudio: r.audio
|
|
6887
6993
|
}),
|
|
6888
|
-
additional:
|
|
6889
|
-
}),
|
|
6890
|
-
outbound:
|
|
6994
|
+
additional: Rc(e ?? t ?? n)
|
|
6995
|
+
}), Vc = ({ audioSenderStats: e, videoSenderFirstStats: t, videoSenderSecondStats: n, audioReceiverStats: r, videoReceiverFirstStats: i, videoReceiverSecondStats: a, synchronizationSources: o }) => ({
|
|
6996
|
+
outbound: zc({
|
|
6891
6997
|
audioSenderStats: e,
|
|
6892
6998
|
videoSenderFirstStats: t,
|
|
6893
6999
|
videoSenderSecondStats: n
|
|
6894
7000
|
}),
|
|
6895
|
-
inbound:
|
|
7001
|
+
inbound: Bc({
|
|
6896
7002
|
audioReceiverStats: r,
|
|
6897
7003
|
videoReceiverFirstStats: i,
|
|
6898
7004
|
videoReceiverSecondStats: a,
|
|
6899
7005
|
synchronizationSources: o
|
|
6900
7006
|
})
|
|
6901
|
-
}),
|
|
7007
|
+
}), Hc = async (e) => {
|
|
6902
7008
|
let t = "audio", n = "video", r = e.getSenders(), i = r.find((e) => e.track?.kind === t), a = r.filter((e) => e.track?.kind === n), o = e.getReceivers(), s = o.find((e) => e.track.kind === t), c = o.filter((e) => e.track.kind === n), l = {
|
|
6903
7009
|
audio: {
|
|
6904
7010
|
trackIdentifier: s?.track.id,
|
|
@@ -6932,16 +7038,16 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6932
7038
|
videoReceiverSecondStats: o
|
|
6933
7039
|
};
|
|
6934
7040
|
});
|
|
6935
|
-
},
|
|
7041
|
+
}, Uc = g("StatsPeerConnection"), Wc = class extends e {
|
|
6936
7042
|
setTimeoutRequest;
|
|
6937
|
-
requesterAllStatistics = new c(
|
|
7043
|
+
requesterAllStatistics = new c(Hc);
|
|
6938
7044
|
constructor() {
|
|
6939
|
-
super(
|
|
7045
|
+
super(Ac()), this.setTimeoutRequest = new a();
|
|
6940
7046
|
}
|
|
6941
7047
|
get requested() {
|
|
6942
7048
|
return this.setTimeoutRequest.requested;
|
|
6943
7049
|
}
|
|
6944
|
-
start(e, { interval: t =
|
|
7050
|
+
start(e, { interval: t = Oc, onError: n = Uc } = {}) {
|
|
6945
7051
|
this.setTimeoutRequest.request(() => {
|
|
6946
7052
|
this.collectStatistics(e, {
|
|
6947
7053
|
onError: n,
|
|
@@ -6958,11 +7064,11 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6958
7064
|
this.setTimeoutRequest.cancelRequest(), this.requesterAllStatistics.cancelRequest(), this.events.trigger("stopped", { reason: e });
|
|
6959
7065
|
}
|
|
6960
7066
|
collectStatistics = (e, { onError: t, onSuccess: n }) => {
|
|
6961
|
-
let r =
|
|
7067
|
+
let r = Mc();
|
|
6962
7068
|
this.requestAllStatistics(e).then((e) => {
|
|
6963
|
-
this.events.trigger("collected",
|
|
6964
|
-
let t =
|
|
6965
|
-
t > 48 ? i =
|
|
7069
|
+
this.events.trigger("collected", Vc(e));
|
|
7070
|
+
let t = Mc() - r, i = Oc;
|
|
7071
|
+
t > 48 ? i = Oc * 4 : t > 32 ? i = Oc * 3 : t > 16 && (i = Oc * 2), n({ interval: i });
|
|
6966
7072
|
}).catch((e) => {
|
|
6967
7073
|
t && t(e);
|
|
6968
7074
|
});
|
|
@@ -6972,7 +7078,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6972
7078
|
if (t === void 0) throw Error("failed to collect statistics: peerConnection is not defined");
|
|
6973
7079
|
return this.requesterAllStatistics.request(t);
|
|
6974
7080
|
};
|
|
6975
|
-
},
|
|
7081
|
+
}, Gc = 5e3, Kc = {
|
|
6976
7082
|
fast: {
|
|
6977
7083
|
minPacketsSentDelta: 1,
|
|
6978
7084
|
minBytesSentDelta: 0,
|
|
@@ -6991,14 +7097,14 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
6991
7097
|
minFramesDelta: 5,
|
|
6992
7098
|
requiredConsecutivePositiveSamples: 2
|
|
6993
7099
|
}
|
|
6994
|
-
},
|
|
7100
|
+
}, qc = g("StatsManager"), Jc = class t extends e {
|
|
6995
7101
|
statsPeerConnection;
|
|
6996
7102
|
availableStats;
|
|
6997
7103
|
previousAvailableStats;
|
|
6998
7104
|
callManager;
|
|
6999
7105
|
apiManager;
|
|
7000
7106
|
constructor({ callManager: e, apiManager: t }) {
|
|
7001
|
-
let n = new
|
|
7107
|
+
let n = new Wc();
|
|
7002
7108
|
super(n.events), this.statsPeerConnection = n, this.callManager = e, this.apiManager = t, this.subscribe();
|
|
7003
7109
|
}
|
|
7004
7110
|
get availableIncomingBitrate() {
|
|
@@ -7098,7 +7204,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7098
7204
|
mediaSourceFrames: e.outbound.video.mediaSource?.frames
|
|
7099
7205
|
};
|
|
7100
7206
|
}
|
|
7101
|
-
async waitForOutboundVideoPackets(e, { timeout: t =
|
|
7207
|
+
async waitForOutboundVideoPackets(e, { timeout: t = Gc, strictness: n = "normal" } = {}) {
|
|
7102
7208
|
let r = this.captureOutboundVideoWaitBaseline(), i = { consecutivePositiveSamples: 0 };
|
|
7103
7209
|
if (!this.isSendingOutboundVideoPacketsWithTrack(e, {
|
|
7104
7210
|
baseline: r,
|
|
@@ -7130,7 +7236,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7130
7236
|
return e === void 0 ? {} : t.extractOutboundVideoStatsSnapshot(e);
|
|
7131
7237
|
}
|
|
7132
7238
|
meetsOutboundVideoThresholds(e, n, r) {
|
|
7133
|
-
let i = this.getOutboundVideoStatsSnapshot(), a =
|
|
7239
|
+
let i = this.getOutboundVideoStatsSnapshot(), a = Kc[r];
|
|
7134
7240
|
if (i.trackIdentifier !== e) return !1;
|
|
7135
7241
|
let o = t.resolveDelta(i.packetsSent, n.packetsSent), s = t.resolveDelta(i.bytesSent, n.bytesSent), c = t.resolveFramesDelta(i, n);
|
|
7136
7242
|
return !(o === void 0 || o < a.minPacketsSentDelta || (s ?? 0) < a.minBytesSentDelta || r !== "fast" && (c === void 0 || c < a.minFramesDelta));
|
|
@@ -7140,7 +7246,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7140
7246
|
return e !== void 0 && t !== void 0 && e > t || n !== void 0 && r !== void 0 && n > r || i !== void 0 && a !== void 0 && i > a;
|
|
7141
7247
|
}
|
|
7142
7248
|
isSendingOutboundVideoPacketsWithTrack(e, t, n) {
|
|
7143
|
-
let { baseline: r, strictness: i } = t, a =
|
|
7249
|
+
let { baseline: r, strictness: i } = t, a = Kc[i];
|
|
7144
7250
|
if (!this.meetsOutboundVideoThresholds(e, r, i) || i === "strict" && !this.hasPositiveOutboundVideoIntervalDelta()) return {
|
|
7145
7251
|
isSending: !1,
|
|
7146
7252
|
newVerificationState: 0
|
|
@@ -7180,37 +7286,37 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7180
7286
|
};
|
|
7181
7287
|
maybeSendStats() {
|
|
7182
7288
|
this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
|
|
7183
|
-
|
|
7289
|
+
qc("Failed to send stats", e);
|
|
7184
7290
|
});
|
|
7185
7291
|
}
|
|
7186
|
-
},
|
|
7292
|
+
}, Yc = g("setCodecPreferences"), Xc = (e, t) => e.filter((e) => t.some((t) => t.clockRate === e.clockRate && t.mimeType === e.mimeType && t.channels === e.channels && t.sdpFmtpLine === e.sdpFmtpLine)), Zc = (e) => {
|
|
7187
7293
|
let t = RTCRtpSender.getCapabilities(e), n = RTCRtpReceiver.getCapabilities(e);
|
|
7188
|
-
return
|
|
7189
|
-
},
|
|
7294
|
+
return Xc(t === null ? [] : t.codecs, n === null ? [] : n.codecs);
|
|
7295
|
+
}, Qc = (e, t) => t === void 0 || t.length === 0 ? e : e.sort((e, n) => {
|
|
7190
7296
|
let r = t.indexOf(e.mimeType), i = t.indexOf(n.mimeType);
|
|
7191
7297
|
return (r === -1 ? Number.MAX_VALUE : r) - (i === -1 ? Number.MAX_VALUE : i);
|
|
7192
|
-
}),
|
|
7298
|
+
}), $c = (e, t) => t === void 0 || t.length === 0 ? e : e.filter((e) => !t.includes(e.mimeType)), el = (e, { preferredMimeTypesVideoCodecs: t, excludeMimeTypesVideoCodecs: n }) => {
|
|
7193
7299
|
try {
|
|
7194
7300
|
if (typeof e.setCodecPreferences == "function" && e.sender.track?.kind === "video" && (t !== void 0 && t.length > 0 || n !== void 0 && n.length > 0)) {
|
|
7195
|
-
let r =
|
|
7301
|
+
let r = Qc($c(Zc("video"), n), t);
|
|
7196
7302
|
e.setCodecPreferences(r);
|
|
7197
7303
|
}
|
|
7198
7304
|
} catch (e) {
|
|
7199
|
-
|
|
7305
|
+
Yc("setCodecPreferences error", e);
|
|
7200
7306
|
}
|
|
7201
|
-
},
|
|
7307
|
+
}, tl = (e) => e.getVideoTracks()[0], nl = [
|
|
7202
7308
|
"balancing-scheduled",
|
|
7203
7309
|
"balancing-started",
|
|
7204
7310
|
"balancing-stopped",
|
|
7205
7311
|
"parameters-updated"
|
|
7206
|
-
],
|
|
7312
|
+
], rl = () => new n(nl), il = g("VideoSendingBalancerManager"), al = class extends e {
|
|
7207
7313
|
isBalancingActive = !1;
|
|
7208
7314
|
callManager;
|
|
7209
7315
|
balancingStartDelay;
|
|
7210
7316
|
videoSendingBalancer;
|
|
7211
7317
|
startBalancingTimer;
|
|
7212
7318
|
constructor(e, t, n = {}) {
|
|
7213
|
-
super(
|
|
7319
|
+
super(rl()), this.callManager = e, this.balancingStartDelay = n.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new Wo(t, () => e.connection, {
|
|
7214
7320
|
...n,
|
|
7215
7321
|
onSetParameters: (e) => {
|
|
7216
7322
|
this.events.trigger("parameters-updated", e), n.onSetParameters?.(e);
|
|
@@ -7250,27 +7356,27 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7250
7356
|
scheduleBalancingStart() {
|
|
7251
7357
|
this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
|
|
7252
7358
|
this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
|
|
7253
|
-
|
|
7359
|
+
il("startBalancing: error", e);
|
|
7254
7360
|
});
|
|
7255
7361
|
}, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
|
|
7256
7362
|
}
|
|
7257
7363
|
clearStartTimer() {
|
|
7258
7364
|
this.startBalancingTimer &&= (clearTimeout(this.startBalancingTimer), void 0);
|
|
7259
7365
|
}
|
|
7260
|
-
},
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
],
|
|
7366
|
+
}, ol = "health-snapshot", sl = "inbound-video-problem-detected", cl = "inbound-video-problem-resolved", ll = "inbound-video-problem-reset", ul = [
|
|
7367
|
+
ol,
|
|
7368
|
+
sl,
|
|
7369
|
+
cl,
|
|
7370
|
+
ll
|
|
7371
|
+
], dl = () => new n(ul), fl = 3, pl = class t extends e {
|
|
7266
7372
|
statsManager;
|
|
7267
7373
|
callManager;
|
|
7268
7374
|
minConsecutiveProblemSamplesCount;
|
|
7269
7375
|
consecutiveProblemSamplesCount = 0;
|
|
7270
7376
|
currentProblemReason;
|
|
7271
7377
|
hasEmittedCurrentProblem = !1;
|
|
7272
|
-
constructor(e, n, r =
|
|
7273
|
-
super(
|
|
7378
|
+
constructor(e, n, r = fl) {
|
|
7379
|
+
super(dl()), this.statsManager = e, this.callManager = n, t.assertValidMinConsecutiveProblemSamplesCount(r), this.minConsecutiveProblemSamplesCount = r, this.subscribe();
|
|
7274
7380
|
}
|
|
7275
7381
|
get mainVideoTrack() {
|
|
7276
7382
|
return this.callManager.getMainRemoteStream()?.getVideoTracks()[0];
|
|
@@ -7309,13 +7415,13 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7309
7415
|
}
|
|
7310
7416
|
handleStatsCollected = () => {
|
|
7311
7417
|
let { healthSnapshot: e } = this;
|
|
7312
|
-
this.events.trigger(
|
|
7418
|
+
this.events.trigger(ol, e);
|
|
7313
7419
|
let n = t.resolveProblemReason(e);
|
|
7314
7420
|
if (n === void 0) {
|
|
7315
7421
|
this.maybeEmitResolvedProblem(e), this.resetProblemDetectionState();
|
|
7316
7422
|
return;
|
|
7317
7423
|
}
|
|
7318
|
-
this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(
|
|
7424
|
+
this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(sl, {
|
|
7319
7425
|
...e,
|
|
7320
7426
|
consecutiveProblemSamplesCount: this.consecutiveProblemSamplesCount,
|
|
7321
7427
|
reason: n
|
|
@@ -7332,7 +7438,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7332
7438
|
this.currentProblemReason = e, this.consecutiveProblemSamplesCount = 1, this.hasEmittedCurrentProblem = !1;
|
|
7333
7439
|
};
|
|
7334
7440
|
maybeEmitResolvedProblem = (e) => {
|
|
7335
|
-
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(
|
|
7441
|
+
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(cl, {
|
|
7336
7442
|
...e,
|
|
7337
7443
|
reason: this.currentProblemReason
|
|
7338
7444
|
});
|
|
@@ -7341,7 +7447,7 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7341
7447
|
this.maybeEmitResetProblem(e), this.resetProblemDetectionState();
|
|
7342
7448
|
};
|
|
7343
7449
|
maybeEmitResetProblem = (e) => {
|
|
7344
|
-
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(
|
|
7450
|
+
!this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(ll, {
|
|
7345
7451
|
reason: this.currentProblemReason,
|
|
7346
7452
|
resetCause: e
|
|
7347
7453
|
});
|
|
@@ -7349,11 +7455,11 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7349
7455
|
resetProblemDetectionState = () => {
|
|
7350
7456
|
this.currentProblemReason = void 0, this.consecutiveProblemSamplesCount = 0, this.hasEmittedCurrentProblem = !1;
|
|
7351
7457
|
};
|
|
7352
|
-
},
|
|
7458
|
+
}, ml = g("MainStreamRecovery"), hl = 4e3, gl = class e {
|
|
7353
7459
|
renegotiateRequester;
|
|
7354
7460
|
renegotiateThrottled;
|
|
7355
7461
|
callManager;
|
|
7356
|
-
constructor(e, t =
|
|
7462
|
+
constructor(e, t = hl) {
|
|
7357
7463
|
this.callManager = e, this.renegotiateRequester = new c(e.renegotiate.bind(e)), this.renegotiateThrottled = this.createRenegotiateThrottled(t), this.subscribe();
|
|
7358
7464
|
}
|
|
7359
7465
|
static assertValidThrottleRecoveryTimeout(e) {
|
|
@@ -7363,17 +7469,17 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7363
7469
|
e.assertValidThrottleRecoveryTimeout(t), this.renegotiateThrottled.cancel(), this.renegotiateThrottled = this.createRenegotiateThrottled(t);
|
|
7364
7470
|
}
|
|
7365
7471
|
recover() {
|
|
7366
|
-
|
|
7472
|
+
ml("trying to recover main stream"), this.renegotiateThrottled();
|
|
7367
7473
|
}
|
|
7368
7474
|
requestRenegotiate = () => {
|
|
7369
|
-
if (
|
|
7370
|
-
|
|
7475
|
+
if (ml("trying to renegotiate"), this.renegotiateRequester.requested) {
|
|
7476
|
+
ml("previous renegotiate is not finished yet");
|
|
7371
7477
|
return;
|
|
7372
7478
|
}
|
|
7373
7479
|
this.renegotiateRequester.request().then(() => {
|
|
7374
|
-
|
|
7480
|
+
ml("renegotiate has successful");
|
|
7375
7481
|
}).catch((e) => {
|
|
7376
|
-
|
|
7482
|
+
ml("failed to renegotiate main media stream", e);
|
|
7377
7483
|
});
|
|
7378
7484
|
};
|
|
7379
7485
|
createRenegotiateThrottled(t) {
|
|
@@ -7385,42 +7491,42 @@ var vo = g("CallManager: CallStateMachine"), yo = class extends D {
|
|
|
7385
7491
|
});
|
|
7386
7492
|
}
|
|
7387
7493
|
cancel() {
|
|
7388
|
-
|
|
7494
|
+
ml("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
|
|
7389
7495
|
}
|
|
7390
|
-
},
|
|
7496
|
+
}, _l = /* @__PURE__ */ function(e) {
|
|
7391
7497
|
return e.VP8 = "video/VP8", e.VP9 = "video/VP9", e.H264 = "video/H264", e.AV1 = "video/AV1", e.rtx = "video/rtx", e.red = "video/red", e.flexfec03 = "video/flexfec-03", e;
|
|
7392
|
-
}({}),
|
|
7498
|
+
}({}), vl = {
|
|
7393
7499
|
major: 25,
|
|
7394
7500
|
minor: 8,
|
|
7395
7501
|
patch: 0
|
|
7396
|
-
},
|
|
7397
|
-
let n = t(
|
|
7502
|
+
}, yl = ({ isYandexBrowser: e, hasGreaterThanBrowserVersion: t }) => {
|
|
7503
|
+
let n = t(vl);
|
|
7398
7504
|
return e && n;
|
|
7399
|
-
},
|
|
7400
|
-
if (
|
|
7401
|
-
},
|
|
7402
|
-
let { isMobileDevice: e, isSafari: t, isOpera: n, isWindows: r } =
|
|
7505
|
+
}, bl = () => {
|
|
7506
|
+
if (yl(Xi())) return [_l.VP8];
|
|
7507
|
+
}, xl = () => {
|
|
7508
|
+
let { isMobileDevice: e, isSafari: t, isOpera: n, isWindows: r } = Xi();
|
|
7403
7509
|
return e || t || n && r;
|
|
7404
|
-
},
|
|
7405
|
-
|
|
7406
|
-
var
|
|
7510
|
+
}, Sl;
|
|
7511
|
+
xl() && (Sl = "h264");
|
|
7512
|
+
var Cl = { ignoreForCodec: Sl }, wl = bl(), Tl = 1e6, El = tn.map((e) => `auto-connect:${e}`), Dl = Vn.map((e) => `call-reconnect:${e}`), Ol = St.map((e) => `connection:${e}`), kl = yi.map((e) => `call:${e}`), Al = Ie.map((e) => `api:${e}`), jl = tc.map((e) => `incoming-call:${e}`), Ml = ws.map((e) => `presentation:${e}`), Nl = kc.map((e) => `stats:${e}`), Pl = nl.map((e) => `video-balancer:${e}`), Fl = ul.map((e) => `main-stream-health:${e}`), Il = pc.map((e) => `session:${e}`), Ll = [
|
|
7407
7513
|
"disconnected-from-out-of-call",
|
|
7408
7514
|
"connected-with-configuration-from-out-of-call",
|
|
7409
7515
|
"stopped-presentation-by-server-command"
|
|
7410
|
-
],
|
|
7411
|
-
...xl,
|
|
7412
|
-
...Sl,
|
|
7413
|
-
...Cl,
|
|
7414
|
-
...wl,
|
|
7415
|
-
...Tl,
|
|
7516
|
+
], Rl = [
|
|
7416
7517
|
...El,
|
|
7417
7518
|
...Dl,
|
|
7418
7519
|
...Ol,
|
|
7419
7520
|
...kl,
|
|
7420
7521
|
...Al,
|
|
7421
7522
|
...jl,
|
|
7422
|
-
...Ml
|
|
7423
|
-
|
|
7523
|
+
...Ml,
|
|
7524
|
+
...Nl,
|
|
7525
|
+
...Pl,
|
|
7526
|
+
...Fl,
|
|
7527
|
+
...Il,
|
|
7528
|
+
...Ll
|
|
7529
|
+
], zl = () => new n(Rl), Bl = g("SipConnector"), Vl = class extends e {
|
|
7424
7530
|
connectionManager;
|
|
7425
7531
|
connectionQueueManager;
|
|
7426
7532
|
contentedStreamManager;
|
|
@@ -7441,10 +7547,10 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7441
7547
|
excludeMimeTypesVideoCodecs;
|
|
7442
7548
|
activeConnectAndCallSession;
|
|
7443
7549
|
constructor({ JsSIP: e }, { preferredMimeTypesVideoCodecs: t, excludeMimeTypesVideoCodecs: n, videoBalancerOptions: r, autoConnectorOptions: i, callReconnectOptions: a, numberOfConnectionAttempts: o, minConsecutiveProblemSamplesCount: s, throttleRecoveryTimeout: c } = {}) {
|
|
7444
|
-
super(
|
|
7550
|
+
super(zl()), this.preferredMimeTypesVideoCodecs = t ?? wl, this.excludeMimeTypesVideoCodecs = n, this.apiManager = new Ue(), this.connectionManager = new Ft({ JsSIP: e }, { numberOfConnectionAttempts: o }), this.connectionQueueManager = new It({ connectionManager: this.connectionManager }), this.contentedStreamManager = new ec(), this.callSessionState = new Vi(), this.callManager = new xs({ contentedStreamManager: this.contentedStreamManager }, { sendOffer: this.sendOffer }, { callSessionState: this.callSessionState }), this.incomingCallManager = new dc(this.connectionManager), this.presentationManager = new Js({
|
|
7445
7551
|
callManager: this.callManager,
|
|
7446
|
-
maxBitrate:
|
|
7447
|
-
}), this.statsManager = new
|
|
7552
|
+
maxBitrate: Tl
|
|
7553
|
+
}), this.statsManager = new Jc({
|
|
7448
7554
|
callManager: this.callManager,
|
|
7449
7555
|
apiManager: this.apiManager
|
|
7450
7556
|
}), this.autoConnectorManager = new mn({
|
|
@@ -7454,7 +7560,7 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7454
7560
|
}, i), this.callReconnectManager = new Wn({
|
|
7455
7561
|
callManager: this.callManager,
|
|
7456
7562
|
connectionManager: this.connectionManager
|
|
7457
|
-
}, a), this.videoSendingBalancerManager = new
|
|
7563
|
+
}, a), this.videoSendingBalancerManager = new al(this.callManager, this.apiManager, r ?? Cl), this.mainStreamHealthMonitor = new pl(this.statsManager, this.callManager, s), this.mainStreamRecovery = new gl(this.callManager, c), this.sessionManager = new vc({
|
|
7458
7564
|
connectionManager: this.connectionManager,
|
|
7459
7565
|
callManager: this.callManager,
|
|
7460
7566
|
incomingCallManager: this.incomingCallManager,
|
|
@@ -7465,7 +7571,7 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7465
7571
|
}), this.callManager.subscribeToApiEvents(this.apiManager), this.contentedStreamManager.subscribeToApiEvents(this.apiManager), this.apiManager.subscribe({
|
|
7466
7572
|
connectionManager: this.connectionManager,
|
|
7467
7573
|
callManager: this.callManager
|
|
7468
|
-
}), this.peerToPeerManager = new
|
|
7574
|
+
}), this.peerToPeerManager = new fc(), this.peerToPeerManager.subscribe({
|
|
7469
7575
|
connectionManager: this.connectionManager,
|
|
7470
7576
|
callManager: this.callManager,
|
|
7471
7577
|
apiManager: this.apiManager
|
|
@@ -7531,7 +7637,7 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7531
7637
|
return;
|
|
7532
7638
|
}
|
|
7533
7639
|
return this.callReconnectManager.disarm("manual"), this.callReconnectManager.cancelCurrentAttempt(), this.isCallActive && await this.endCallWithoutSessionRouting().catch((e) => {
|
|
7534
|
-
|
|
7640
|
+
Bl("disconnect: failed to end active call", e);
|
|
7535
7641
|
}), this.connectionQueueManager.disconnect();
|
|
7536
7642
|
};
|
|
7537
7643
|
register = async () => this.connectionManager.register();
|
|
@@ -7623,7 +7729,7 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7623
7729
|
replaceMediaStream = async (e, t) => {
|
|
7624
7730
|
let { waitForOutboundVideoPackets: n, waitForOutboundVideoPacketsTimeout: r, waitForOutboundVideoPacketsStrictness: i, ...a } = t ?? {};
|
|
7625
7731
|
if (await this.callManager.replaceMediaStream(e, a), n !== !0) return;
|
|
7626
|
-
let o =
|
|
7732
|
+
let o = tl(e);
|
|
7627
7733
|
if (o === void 0) throw Error("waitForOutboundVideoPackets requires a video track in mediaStream");
|
|
7628
7734
|
await this.statsManager.waitForOutboundVideoPackets(o.id, {
|
|
7629
7735
|
timeout: r,
|
|
@@ -7696,7 +7802,7 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7696
7802
|
e.waitUntilClosed().then(() => {
|
|
7697
7803
|
this.clearActiveConnectAndCallSession(e);
|
|
7698
7804
|
}).catch((e) => {
|
|
7699
|
-
|
|
7805
|
+
Bl("failed to release connect and call session", e);
|
|
7700
7806
|
});
|
|
7701
7807
|
}
|
|
7702
7808
|
subscribeDisconnectedFromOutOfCall() {
|
|
@@ -7726,14 +7832,14 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7726
7832
|
t.body = e instanceof Error ? e.message : String(e);
|
|
7727
7833
|
let n = h.causes.INTERNAL_ERROR;
|
|
7728
7834
|
this.callManager.failed(t, n).catch((e) => {
|
|
7729
|
-
|
|
7835
|
+
Bl("Failed to end call after failed:", e);
|
|
7730
7836
|
});
|
|
7731
7837
|
});
|
|
7732
7838
|
}
|
|
7733
7839
|
sendOffer = async (e, t) => {
|
|
7734
7840
|
let n = this.connectionManager.getConnectionConfiguration()?.sipServerUrl;
|
|
7735
7841
|
if (n === void 0) throw Error("No sipServerUrl for sendOffer");
|
|
7736
|
-
return
|
|
7842
|
+
return Sa({
|
|
7737
7843
|
serverUrl: n,
|
|
7738
7844
|
offer: t,
|
|
7739
7845
|
token: e.token,
|
|
@@ -7743,7 +7849,7 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7743
7849
|
});
|
|
7744
7850
|
};
|
|
7745
7851
|
setCodecPreferences(e) {
|
|
7746
|
-
|
|
7852
|
+
el(e, {
|
|
7747
7853
|
preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
|
|
7748
7854
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
7749
7855
|
});
|
|
@@ -7753,7 +7859,7 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7753
7859
|
}
|
|
7754
7860
|
subscribeToMainStreamHealthMonitorEvents() {
|
|
7755
7861
|
this.mainStreamHealthMonitor.on("inbound-video-problem-detected", ({ reason: e }) => {
|
|
7756
|
-
|
|
7862
|
+
Bl("detected inbound video problem", { reason: e }), this.mainStreamRecovery.recover();
|
|
7757
7863
|
});
|
|
7758
7864
|
}
|
|
7759
7865
|
bridgeEvents = (e, t) => {
|
|
@@ -7763,9 +7869,9 @@ var vl = { ignoreForCodec: _l }, yl = hl(), bl = 1e6, xl = tn.map((e) => `auto-c
|
|
|
7763
7869
|
});
|
|
7764
7870
|
});
|
|
7765
7871
|
};
|
|
7766
|
-
resolveHandleAddTransceiver = (e) => async (t, n
|
|
7767
|
-
this.setCodecPreferences(t), await e?.(t, n
|
|
7872
|
+
resolveHandleAddTransceiver = (e) => async (t, n) => {
|
|
7873
|
+
this.setCodecPreferences(t), await e?.(t, n);
|
|
7768
7874
|
};
|
|
7769
7875
|
};
|
|
7770
7876
|
//#endregion
|
|
7771
|
-
export {
|
|
7877
|
+
export { ye as $, Ai as A, R as B, qa as C, z as D, Di as E, bi as F, P as G, zn as H, si as I, yt as J, ne as K, Yn as L, ki as M, Si as N, Oi as O, wi as P, je as Q, Kn as R, V as S, Vi as T, L as U, Vn as V, Wt as W, k as X, j as Y, ut as Z, Ts as _, $ as a, yo as b, vc as c, Y as d, ve as et, nc as f, K as g, J as h, jc as i, ji as j, Mi as k, sc as l, Bs as m, _l as n, Dc as o, qs as p, Ct as q, Wc as r, Q as s, Vl as t, g as tt, Z as u, Cs as v, ga as w, go as x, W as y, Gn as z };
|