sip-connector 14.1.0-alpha.9 → 14.1.1
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/SipConnector-DRjfFGAZ.js +1339 -0
- package/dist/SipConnector-EXAO9Z-2.cjs +1 -0
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +162 -267
- package/dist/index.cjs +1 -1
- package/dist/index.js +526 -577
- package/dist/src/SipConnector.d.ts +235 -0
- package/dist/{SipConnectorFacade → src/SipConnectorFacade}/SipConnectorFacade.d.ts +16 -7
- package/dist/{__fixtures__ → src/__fixtures__}/BaseSession.mock.d.ts +5 -5
- package/dist/{__fixtures__ → src/__fixtures__}/RTCSessionMock.d.ts +4 -9
- package/dist/{__fixtures__ → src/__fixtures__}/UA.mock.d.ts +14 -12
- package/dist/{__fixtures__ → src/__fixtures__}/index.d.ts +4 -4
- package/dist/{__fixtures__ → src/__fixtures__}/jssip.mock.d.ts +3 -3
- package/dist/src/causes.d.ts +23 -0
- package/dist/{doMock.d.ts → src/doMock.d.ts} +1 -2
- package/dist/{__fixtures__ → src}/eventNames.d.ts +1 -1
- package/dist/src/headers.d.ts +37 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/{tools → src/tools}/__fixtures__/connectToServer.d.ts +2 -2
- package/dist/{tools → src/tools}/__fixtures__/processRequest.d.ts +1 -1
- package/dist/{tools → src/tools}/error/getLinkError.d.ts +1 -1
- package/dist/{tools → src/tools}/error/getTypeFromError.d.ts +1 -1
- package/dist/{tools → src/tools}/error/getValuesFromError.d.ts +1 -1
- package/dist/{tools → src/tools}/index.d.ts +1 -1
- package/dist/{tools → src/tools}/prepareMediaStream.d.ts +1 -1
- package/dist/{tools → src/tools}/setVideoTrackContentHints.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/index.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMainCam.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/resolveOnStartMic.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMainCam.d.ts +1 -1
- package/dist/{tools → src/tools}/syncMediaState/resolveOnStopMic.d.ts +1 -1
- package/dist/src/types.d.ts +69 -0
- package/dist/{videoSendingBalancer → src/videoSendingBalancer}/balance.d.ts +1 -1
- package/dist/{videoSendingBalancer → src/videoSendingBalancer}/index.d.ts +1 -1
- package/dist/{videoSendingBalancer → src/videoSendingBalancer}/processSender.d.ts +1 -1
- package/dist/src/videoSendingBalancer/scaleBitrate.d.ts +2 -0
- package/package.json +32 -26
- package/dist/@SipConnector-BOHJ000Z.cjs +0 -1
- package/dist/@SipConnector-BxitfweK.js +0 -2267
- package/dist/ApiManager/@ApiManager.d.ts +0 -58
- package/dist/ApiManager/constants.d.ts +0 -71
- package/dist/ApiManager/eventNames.d.ts +0 -33
- package/dist/ApiManager/index.d.ts +0 -3
- package/dist/ApiManager/types.d.ts +0 -99
- package/dist/CallManager/@CallManager.d.ts +0 -26
- package/dist/CallManager/AbstractCallStrategy.d.ts +0 -47
- package/dist/CallManager/MCUCallStrategy.d.ts +0 -30
- package/dist/CallManager/RemoteStreamsManager.d.ts +0 -8
- package/dist/CallManager/causes.d.ts +0 -13
- package/dist/CallManager/eventNames.d.ts +0 -45
- package/dist/CallManager/hasCanceledCallError.d.ts +0 -2
- package/dist/CallManager/index.d.ts +0 -7
- package/dist/CallManager/types.d.ts +0 -59
- package/dist/ConnectionManager/@ConnectionManager.d.ts +0 -48
- package/dist/ConnectionManager/ConfigurationManager.d.ts +0 -60
- package/dist/ConnectionManager/ConnectionFlow.d.ts +0 -84
- package/dist/ConnectionManager/ConnectionStateMachine.d.ts +0 -61
- package/dist/ConnectionManager/RegistrationManager.d.ts +0 -17
- package/dist/ConnectionManager/SipOperations.d.ts +0 -32
- package/dist/ConnectionManager/UAFactory.d.ts +0 -50
- package/dist/ConnectionManager/eventNames.d.ts +0 -16
- package/dist/ConnectionManager/index.d.ts +0 -3
- package/dist/IncomingCallManager/@IncomingCallManager.d.ts +0 -37
- package/dist/IncomingCallManager/eventNames.d.ts +0 -13
- package/dist/IncomingCallManager/index.d.ts +0 -2
- package/dist/PresentationManager/@PresentationManager.d.ts +0 -47
- package/dist/PresentationManager/constants.d.ts +0 -1
- package/dist/PresentationManager/eventNames.d.ts +0 -11
- package/dist/PresentationManager/index.d.ts +0 -2
- package/dist/PresentationManager/types.d.ts +0 -2
- package/dist/SipConnector/@SipConnector.d.ts +0 -96
- package/dist/SipConnector/eventNames.d.ts +0 -4
- package/dist/SipConnector/index.d.ts +0 -2
- package/dist/index.d.ts +0 -14
- package/dist/types.d.ts +0 -23
- package/dist/videoSendingBalancer/scaleBitrate.d.ts +0 -2
- /package/dist/{SipConnectorFacade → src/SipConnectorFacade}/index.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/RTCPeerConnectionMock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/RTCRtpSenderMock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/Registrator.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/Request.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/WebSocketInterface.mock.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/accountNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/channels.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/channelsNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/conferenceParticipantTokenIssuedNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/delayPromise.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/enterRoom.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/mediaState.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/participantMoveRequests.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/participantNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/remoteCallerData.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/utils.d.ts +0 -0
- /package/dist/{__fixtures__ → src/__fixtures__}/webcastNotify.d.ts +0 -0
- /package/dist/{__fixtures__ → src}/constants.d.ts +0 -0
- /package/dist/{ConnectionManager → src}/getExtraHeadersRemoteAddress.d.ts +0 -0
- /package/dist/{logger.d.ts → src/logger.d.ts} +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureDegradationPreference.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureEmptyEncodings.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureEncodings.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureMaxBitrate.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/configureScaleResolutionDownBy.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/hasChangedRTCRtpSendParameters.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/index.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/resolveHasNeedToUpdateItemEncoding.d.ts +0 -0
- /package/dist/{setParametersToSender → src/setParametersToSender}/setParametersToSender.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/call.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/hasValidUri.d.ts +0 -0
- /package/dist/{tools → src/tools}/__fixtures__/permissions.d.ts +0 -0
- /package/dist/{tools → src/tools}/__tests-utils__/parseObject.d.ts +0 -0
- /package/dist/{tools → src/tools}/__tests-utils__/resolveParseArray.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/index.d.ts +0 -0
- /package/dist/{tools → src/tools}/error/stringifyMessage.d.ts +0 -0
- /package/dist/{tools → src/tools}/generateSimulcastEncodings.d.ts +0 -0
- /package/dist/{tools → src/tools}/getExtraHeaders.d.ts +0 -0
- /package/dist/{tools → src/tools}/getUserAgent.d.ts +0 -0
- /package/dist/{tools → src/tools}/hasPurgatory.d.ts +0 -0
- /package/dist/{tools → src/tools}/resolveUpdateTransceiver.d.ts +0 -0
- /package/dist/{tools/sendDtmfFAccumulated.d.ts → src/tools/sendDTMFAccumulated.d.ts} +0 -0
- /package/dist/{utils → src/utils}/errors.d.ts +0 -0
- /package/dist/{utils → src/utils}/findSenderByStream.d.ts +0 -0
- /package/dist/{utils → src/utils}/findVideoSender.d.ts +0 -0
- /package/dist/{utils → src/utils}/findVideoTrack.d.ts +0 -0
- /package/dist/{utils → src/utils}/getCodecFromSender.d.ts +0 -0
- /package/dist/{utils → src/utils}/replaceForbiddenSymbolsWithUnderscore.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidth.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/getMaxBitrateByWidthAndCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasAv1Codec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/hasIncludesString.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleBitrateByCodec.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/scaleResolutionAndBitrate.d.ts +0 -0
- /package/dist/{videoSendingBalancer → src/videoSendingBalancer}/setEncodingsToSender.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,138 +1,358 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { hasCanceledError as ae } from "repeated-calls";
|
|
6
|
-
import { debounce as ue } from "ts-debounce";
|
|
1
|
+
import { B as K, N as Y, l as i, E as w, s as oe, a as re, P as ie, b as ce } from "./SipConnector-DRjfFGAZ.js";
|
|
2
|
+
import { j as fn, k as mn, n as hn, m as pn, S as Rn, c as gn, d as yn, f as Tn, g as En, e as Mn, h as bn, i as vn } from "./SipConnector-DRjfFGAZ.js";
|
|
3
|
+
import { sequentPromises as ae } from "sequent-promises";
|
|
4
|
+
import { createStackPromises as ue } from "stack-promises";
|
|
7
5
|
import I from "debug";
|
|
8
|
-
import { default as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
e
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
import { default as An } from "debug";
|
|
7
|
+
import { isCanceledError as de } from "@krivega/cancelable-promise";
|
|
8
|
+
import { hasCanceledError as le } from "repeated-calls";
|
|
9
|
+
import { debounce as Ce } from "ts-debounce";
|
|
10
|
+
const U = (n) => {
|
|
11
|
+
const { url: e, cause: t } = n;
|
|
12
|
+
let s = e;
|
|
13
|
+
return (t === K || t === Y) && (s = `${n.message.to.uri.user}@${n.message.to.uri.host}`), s;
|
|
14
|
+
};
|
|
15
|
+
var q = /* @__PURE__ */ ((n) => (n.CONNECT_SERVER_FAILED = "CONNECT_SERVER_FAILED", n.WRONG_USER_OR_PASSWORD = "WRONG_USER_OR_PASSWORD", n.BAD_MEDIA_ERROR = "BAD_MEDIA_ERROR", n.NOT_FOUND_ERROR = "NOT_FOUND_ERROR", n.WS_CONNECTION_FAILED = "WS_CONNECTION_FAILED", n.CONNECT_SERVER_FAILED_BY_LINK = "CONNECT_SERVER_FAILED_BY_LINK", n))(q || {});
|
|
16
|
+
const Se = new Error("Unknown error"), fe = (n = Se) => {
|
|
17
|
+
const { cause: e, socket: t } = n;
|
|
18
|
+
let s = "CONNECT_SERVER_FAILED";
|
|
19
|
+
switch (e) {
|
|
20
|
+
case "Forbidden": {
|
|
21
|
+
s = "WRONG_USER_OR_PASSWORD";
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case K: {
|
|
25
|
+
s = "BAD_MEDIA_ERROR";
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
case Y: {
|
|
29
|
+
s = "NOT_FOUND_ERROR";
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
default:
|
|
33
|
+
t !== void 0 && t._ws?.readyState === 3 ? s = "WS_CONNECTION_FAILED" : U(n) !== void 0 && U(n) !== "" && (s = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
34
|
+
}
|
|
35
|
+
return s;
|
|
36
|
+
}, me = (n) => {
|
|
37
|
+
let e = "";
|
|
38
|
+
try {
|
|
39
|
+
e = JSON.stringify(n);
|
|
40
|
+
} catch (t) {
|
|
41
|
+
i("failed to stringify message", t);
|
|
42
|
+
}
|
|
22
43
|
return e;
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
|
|
44
|
+
}, he = new Error("Unknown error"), pe = (n = he) => {
|
|
45
|
+
const { code: e, cause: t, message: s } = n, o = U(n), r = { code: "", cause: "", message: "" };
|
|
46
|
+
return typeof s == "object" && s !== null ? r.message = me(s) : s && (r.message = String(s)), o !== void 0 && o !== "" && (r.link = o), e !== void 0 && e !== "" && (r.code = e), t !== void 0 && t !== "" && (r.cause = t), r;
|
|
47
|
+
}, Re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
48
|
+
__proto__: null,
|
|
49
|
+
EErrorTypes: q,
|
|
50
|
+
getLinkError: U,
|
|
51
|
+
getTypeFromError: fe,
|
|
52
|
+
getValuesFromError: pe
|
|
53
|
+
}, Symbol.toStringTag, { value: "Module" })), ge = ({
|
|
54
|
+
sessionId: n,
|
|
55
|
+
remoteAddress: e,
|
|
56
|
+
isMutedAudio: t,
|
|
57
|
+
isMutedVideo: s,
|
|
58
|
+
isRegistered: o,
|
|
59
|
+
isPresentationCall: r
|
|
60
|
+
}) => {
|
|
61
|
+
const c = [], a = t ? "0" : "1", u = s ? "0" : "1";
|
|
62
|
+
return c.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${u}`), (o === !1 || o === void 0) && c.push("X-Vinteo-Purgatory-Call: yes"), n !== void 0 && n !== "" && c.push(`X-Vinteo-Session: ${n}`), r === !0 && c.push("X-Vinteo-Presentation-Call: yes"), e !== void 0 && e !== "" && c.push(`X-Vinteo-Remote: ${e}`), c;
|
|
63
|
+
}, ye = "[@*!|]", Te = "_", Ee = (n) => {
|
|
64
|
+
let e = n;
|
|
65
|
+
return e = e.replaceAll(new RegExp(ye, "g"), Te), e;
|
|
66
|
+
}, Me = ({
|
|
67
|
+
appName: n,
|
|
68
|
+
appVersion: e,
|
|
69
|
+
browserName: t,
|
|
70
|
+
browserVersion: s
|
|
71
|
+
}) => {
|
|
72
|
+
const r = `${Ee(n)} ${e}`;
|
|
73
|
+
return `ChromeNew - ${t === void 0 ? r : `${t} ${s}, ${r}`}`;
|
|
74
|
+
}, be = ({
|
|
75
|
+
isUnifiedSdpSemantic: n,
|
|
76
|
+
appVersion: e,
|
|
77
|
+
browserName: t,
|
|
78
|
+
browserVersion: s,
|
|
79
|
+
appName: o
|
|
80
|
+
}) => n ? Me({ appVersion: e, browserName: t, browserVersion: s, appName: o }) : "Chrome", z = "purgatory", D = (n) => n === z, ve = (n) => (e) => [...e].map((s) => async () => n(s)), _e = async ({
|
|
81
|
+
accumulatedKeys: n,
|
|
82
|
+
sendKey: e,
|
|
83
|
+
canRunTask: t
|
|
84
|
+
}) => {
|
|
85
|
+
const o = ve(e)(n);
|
|
86
|
+
return ae(o, t);
|
|
87
|
+
}, Ae = (n) => (t) => (i("onStartMainCam"), n.onSession("admin-start-main-cam", t)), Oe = (n) => (t) => (i("onStartMic"), n.onSession("admin-start-mic", t)), Ne = (n) => (t) => (i("onStopMainCam"), n.onSession("admin-stop-main-cam", t)), we = (n) => (t) => (i("onStopMic"), n.onSession("admin-stop-mic", t)), Be = ({ sipConnector: n }) => {
|
|
88
|
+
const e = (f, R) => ({ isSyncForced: m = !1 }) => {
|
|
89
|
+
if (m) {
|
|
90
|
+
f();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
R();
|
|
94
|
+
}, t = Ae(n), s = Ne(n), o = Oe(n), r = we(n);
|
|
95
|
+
let c = () => {
|
|
96
|
+
}, a = () => {
|
|
97
|
+
}, u = () => {
|
|
98
|
+
}, l = () => {
|
|
99
|
+
};
|
|
100
|
+
const S = ({
|
|
101
|
+
onStartMainCamForced: f,
|
|
102
|
+
onStartMainCamNotForced: R,
|
|
103
|
+
onStopMainCamForced: m,
|
|
104
|
+
onStopMainCamNotForced: h,
|
|
105
|
+
onStartMicForced: g,
|
|
106
|
+
onStartMicNotForced: y,
|
|
107
|
+
onStopMicForced: T,
|
|
108
|
+
onStopMicNotForced: E
|
|
109
|
+
}) => {
|
|
110
|
+
const v = e(
|
|
111
|
+
f,
|
|
112
|
+
R
|
|
113
|
+
);
|
|
114
|
+
c = t(v);
|
|
115
|
+
const _ = e(
|
|
116
|
+
m,
|
|
117
|
+
h
|
|
118
|
+
);
|
|
119
|
+
a = s(_);
|
|
120
|
+
const A = e(g, y);
|
|
121
|
+
u = o(A);
|
|
122
|
+
const O = e(T, E);
|
|
123
|
+
l = r(O);
|
|
124
|
+
}, C = () => {
|
|
125
|
+
c(), a(), u(), l();
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
start: (f) => {
|
|
129
|
+
S(f);
|
|
130
|
+
},
|
|
131
|
+
stop: () => {
|
|
132
|
+
C();
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}, un = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
136
|
+
__proto__: null,
|
|
137
|
+
PURGATORY_CONFERENCE_NUMBER: z,
|
|
138
|
+
createSyncMediaState: Be,
|
|
139
|
+
error: Re,
|
|
140
|
+
getExtraHeaders: ge,
|
|
141
|
+
getUserAgent: be,
|
|
142
|
+
hasPurgatory: D,
|
|
143
|
+
sendDtmfAccumulated: _e
|
|
144
|
+
}, Symbol.toStringTag, { value: "Module" })), Pe = (n) => [...n.keys()].map((e) => n.get(e)), Ie = (n, e) => Pe(n).find((t) => t?.type === e), De = async (n) => n.getStats().then((e) => Ie(e, "codec")?.mimeType), ke = (n) => n.find((e) => e.track?.kind === "video"), Q = (n, e) => n !== void 0 && e !== void 0 && n.toLowerCase().includes(e.toLowerCase()), Fe = 1e6, p = (n) => n * Fe, J = p(0.06), Ve = p(4), Ue = (n) => n <= 64 ? J : n <= 128 ? p(0.12) : n <= 256 ? p(0.25) : n <= 384 ? p(0.32) : n <= 426 ? p(0.38) : n <= 640 ? p(0.5) : n <= 848 ? p(0.7) : n <= 1280 ? p(1) : n <= 1920 ? p(2) : Ve, xe = "av1", Le = (n) => Q(n, xe), $e = 0.6, Z = (n, e) => Le(e) ? n * $e : n, He = (n) => Z(J, n), ee = (n, e) => {
|
|
145
|
+
const t = Ue(n);
|
|
146
|
+
return Z(t, e);
|
|
147
|
+
}, H = 1, ne = ({
|
|
148
|
+
videoTrack: n,
|
|
149
|
+
targetSize: e,
|
|
80
150
|
codec: t
|
|
81
151
|
}) => {
|
|
82
|
-
const
|
|
152
|
+
const s = n.getSettings(), o = s.width, r = s.height, c = o === void 0 ? H : o / e.width, a = r === void 0 ? H : r / e.height, u = Math.max(c, a, H), l = ee(e.width, t);
|
|
83
153
|
return { scaleResolutionDownBy: u, maxBitrate: l };
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
|
|
154
|
+
}, te = ue(), Xe = async () => te().catch((n) => {
|
|
155
|
+
i("videoSendingBalancer: error", n);
|
|
156
|
+
}), je = async (n) => (te.add(n), Xe()), j = async ({
|
|
157
|
+
sender: n,
|
|
158
|
+
scaleResolutionDownBy: e,
|
|
159
|
+
maxBitrate: t,
|
|
160
|
+
onSetParameters: s
|
|
161
|
+
}) => je(async () => oe(n, { scaleResolutionDownBy: e, maxBitrate: t }, s)), We = async ({ sender: n, codec: e }, t) => {
|
|
162
|
+
const o = He(e);
|
|
163
|
+
return j({
|
|
164
|
+
sender: n,
|
|
165
|
+
maxBitrate: o,
|
|
166
|
+
onSetParameters: t,
|
|
167
|
+
scaleResolutionDownBy: 200
|
|
168
|
+
});
|
|
169
|
+
}, V = async ({
|
|
170
|
+
sender: n,
|
|
171
|
+
videoTrack: e,
|
|
172
|
+
codec: t
|
|
173
|
+
}, s) => {
|
|
174
|
+
const c = e.getSettings().width, a = ee(c ?? 0, t);
|
|
175
|
+
return j({
|
|
176
|
+
sender: n,
|
|
177
|
+
maxBitrate: a,
|
|
178
|
+
onSetParameters: s,
|
|
179
|
+
scaleResolutionDownBy: 1
|
|
180
|
+
});
|
|
181
|
+
}, Ge = async ({
|
|
182
|
+
sender: n,
|
|
183
|
+
videoTrack: e,
|
|
184
|
+
resolution: t,
|
|
185
|
+
codec: s
|
|
186
|
+
}, o) => {
|
|
187
|
+
const [r, c] = t.split("x"), { maxBitrate: a, scaleResolutionDownBy: u } = ne({
|
|
188
|
+
videoTrack: e,
|
|
189
|
+
codec: s,
|
|
190
|
+
targetSize: {
|
|
191
|
+
width: Number(r),
|
|
192
|
+
height: Number(c)
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return j({
|
|
196
|
+
sender: n,
|
|
197
|
+
maxBitrate: a,
|
|
198
|
+
onSetParameters: o,
|
|
199
|
+
scaleResolutionDownBy: u
|
|
200
|
+
});
|
|
201
|
+
}, Ke = async ({
|
|
202
|
+
mainCam: n,
|
|
203
|
+
resolutionMainCam: e,
|
|
204
|
+
sender: t,
|
|
205
|
+
videoTrack: s,
|
|
206
|
+
codec: o
|
|
207
|
+
}, r) => {
|
|
208
|
+
switch (n) {
|
|
209
|
+
case w.PAUSE_MAIN_CAM:
|
|
210
|
+
return We({ sender: t, codec: o }, r);
|
|
211
|
+
case w.RESUME_MAIN_CAM:
|
|
212
|
+
return V({ sender: t, videoTrack: s, codec: o }, r);
|
|
213
|
+
case w.MAX_MAIN_CAM_RESOLUTION:
|
|
214
|
+
return e !== void 0 ? Ge(
|
|
215
|
+
{ sender: t, videoTrack: s, codec: o, resolution: e },
|
|
216
|
+
r
|
|
217
|
+
) : V({ sender: t, videoTrack: s, codec: o }, r);
|
|
218
|
+
case w.ADMIN_STOP_MAIN_CAM:
|
|
219
|
+
case w.ADMIN_START_MAIN_CAM:
|
|
220
|
+
case void 0:
|
|
221
|
+
return V({ sender: t, videoTrack: s, codec: o }, r);
|
|
222
|
+
default:
|
|
223
|
+
return V({ sender: t, videoTrack: s, codec: o }, r);
|
|
224
|
+
}
|
|
225
|
+
}, W = {
|
|
226
|
+
isChanged: !1,
|
|
227
|
+
parameters: {
|
|
228
|
+
encodings: [{}],
|
|
229
|
+
transactionId: "0",
|
|
230
|
+
codecs: [],
|
|
231
|
+
headerExtensions: [],
|
|
232
|
+
rtcp: {}
|
|
233
|
+
}
|
|
234
|
+
}, G = async ({
|
|
235
|
+
mainCam: n,
|
|
236
|
+
resolutionMainCam: e,
|
|
237
|
+
connection: t,
|
|
238
|
+
onSetParameters: s,
|
|
239
|
+
ignoreForCodec: o
|
|
240
|
+
}) => {
|
|
241
|
+
const r = t.getSenders(), c = ke(r);
|
|
242
|
+
if (!c?.track)
|
|
243
|
+
return W;
|
|
244
|
+
const a = await De(c);
|
|
245
|
+
return Q(a, o) ? W : Ke(
|
|
246
|
+
{
|
|
247
|
+
mainCam: n,
|
|
248
|
+
resolutionMainCam: e,
|
|
249
|
+
sender: c,
|
|
250
|
+
codec: a,
|
|
251
|
+
videoTrack: c.track
|
|
252
|
+
},
|
|
253
|
+
s
|
|
254
|
+
);
|
|
255
|
+
}, dn = (n, {
|
|
256
|
+
ignoreForCodec: e,
|
|
257
|
+
onSetParameters: t
|
|
258
|
+
} = {}) => {
|
|
259
|
+
const s = async () => {
|
|
260
|
+
const { connection: u } = n;
|
|
261
|
+
if (!u)
|
|
262
|
+
throw new Error("connection is not exist");
|
|
263
|
+
return G({
|
|
264
|
+
connection: u,
|
|
265
|
+
onSetParameters: t,
|
|
266
|
+
ignoreForCodec: e
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
let o = s;
|
|
270
|
+
const r = (u) => {
|
|
271
|
+
o = async () => {
|
|
272
|
+
const { mainCam: l, resolutionMainCam: S } = u, { connection: C } = n;
|
|
273
|
+
if (!C)
|
|
274
|
+
throw new Error("connection is not exist");
|
|
275
|
+
return G({
|
|
276
|
+
mainCam: l,
|
|
277
|
+
resolutionMainCam: S,
|
|
278
|
+
connection: C,
|
|
279
|
+
onSetParameters: t,
|
|
280
|
+
ignoreForCodec: e
|
|
281
|
+
});
|
|
282
|
+
}, o().catch(I);
|
|
283
|
+
};
|
|
284
|
+
return {
|
|
285
|
+
subscribe: () => {
|
|
286
|
+
n.onSession("main-cam-control", r);
|
|
287
|
+
},
|
|
288
|
+
unsubscribe: () => {
|
|
289
|
+
n.offSession("main-cam-control", r);
|
|
290
|
+
},
|
|
291
|
+
balanceByTrack: s,
|
|
292
|
+
resetMainCamControl() {
|
|
293
|
+
o = s;
|
|
294
|
+
},
|
|
295
|
+
async reBalance() {
|
|
296
|
+
return o();
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
}, Ye = (n) => n.getVideoTracks()[0], B = ({
|
|
300
|
+
mediaStream: n,
|
|
301
|
+
simulcastEncodings: e,
|
|
87
302
|
sendEncodings: t
|
|
88
303
|
}) => {
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
304
|
+
if (e && e.length > 0) {
|
|
305
|
+
const s = t ?? [], o = Ye(n);
|
|
306
|
+
if (o === void 0)
|
|
92
307
|
throw new Error("No video track");
|
|
93
|
-
return
|
|
94
|
-
const a =
|
|
308
|
+
return e.forEach((r, c) => {
|
|
309
|
+
const a = s[c] ?? {};
|
|
95
310
|
a.active = !0, r.rid !== void 0 && (a.rid = r.rid), r.scalabilityMode !== void 0 && (a.scalabilityMode = r.scalabilityMode);
|
|
96
|
-
const { maxBitrate: u, scaleResolutionDownBy: l } =
|
|
97
|
-
videoTrack:
|
|
311
|
+
const { maxBitrate: u, scaleResolutionDownBy: l } = ne({
|
|
312
|
+
videoTrack: o,
|
|
98
313
|
targetSize: {
|
|
99
314
|
width: r.width,
|
|
100
315
|
height: r.height
|
|
101
316
|
}
|
|
102
317
|
});
|
|
103
|
-
a.maxBitrate = u, a.scaleResolutionDownBy = l,
|
|
104
|
-
}),
|
|
318
|
+
a.maxBitrate = u, a.scaleResolutionDownBy = l, s[c] = a;
|
|
319
|
+
}), s;
|
|
105
320
|
}
|
|
106
321
|
return t;
|
|
107
|
-
},
|
|
108
|
-
const
|
|
109
|
-
return
|
|
110
|
-
},
|
|
111
|
-
const
|
|
112
|
-
return
|
|
113
|
-
}),
|
|
114
|
-
preferredMimeTypesVideoCodecs:
|
|
322
|
+
}, qe = (n, e) => n.filter((s) => e.some((o) => o.clockRate === s.clockRate && o.mimeType === s.mimeType && o.channels === s.channels && o.sdpFmtpLine === s.sdpFmtpLine)), ze = (n) => {
|
|
323
|
+
const e = RTCRtpSender.getCapabilities(n), t = RTCRtpReceiver.getCapabilities(n), s = e === null ? [] : e.codecs, o = t === null ? [] : t.codecs;
|
|
324
|
+
return qe(s, o);
|
|
325
|
+
}, Qe = (n, e) => e === void 0 || e.length === 0 ? n : n.sort((t, s) => {
|
|
326
|
+
const o = e.indexOf(t.mimeType), r = e.indexOf(s.mimeType), c = o === -1 ? Number.MAX_VALUE : o, a = r === -1 ? Number.MAX_VALUE : r;
|
|
327
|
+
return c - a;
|
|
328
|
+
}), Je = (n, e) => e === void 0 || e.length === 0 ? n : n.filter((t) => !e.includes(t.mimeType)), P = (n, {
|
|
329
|
+
preferredMimeTypesVideoCodecs: e,
|
|
115
330
|
excludeMimeTypesVideoCodecs: t
|
|
116
|
-
}) => async (
|
|
331
|
+
}) => async (s) => {
|
|
117
332
|
try {
|
|
118
|
-
if (typeof
|
|
119
|
-
const
|
|
120
|
-
|
|
333
|
+
if (typeof s.setCodecPreferences == "function" && s.sender.track?.kind === "video" && (e !== void 0 && e.length > 0 || t !== void 0 && t.length > 0)) {
|
|
334
|
+
const o = ze("video"), r = Je(o, t), c = Qe(r, e);
|
|
335
|
+
s.setCodecPreferences(c);
|
|
121
336
|
}
|
|
122
|
-
Object.keys(
|
|
123
|
-
} catch (
|
|
124
|
-
|
|
337
|
+
Object.keys(n).length > 0 && await re(s.sender, n);
|
|
338
|
+
} catch (o) {
|
|
339
|
+
i("updateTransceiver error", o);
|
|
125
340
|
}
|
|
126
|
-
}, X = (
|
|
127
|
-
if (!
|
|
128
|
-
throw
|
|
341
|
+
}, X = (n) => {
|
|
342
|
+
if (!de(n) && !le(n))
|
|
343
|
+
throw n;
|
|
129
344
|
return { isSuccessful: !1 };
|
|
130
|
-
},
|
|
345
|
+
}, Ze = ({ kind: n, readyState: e }) => n === "video" && e === "live", en = /* @__PURE__ */ new Set([
|
|
131
346
|
"on",
|
|
132
347
|
"once",
|
|
133
348
|
"onceRace",
|
|
134
349
|
"wait",
|
|
135
350
|
"off",
|
|
351
|
+
"onSession",
|
|
352
|
+
"onceSession",
|
|
353
|
+
"onceRaceSession",
|
|
354
|
+
"waitSession",
|
|
355
|
+
"offSession",
|
|
136
356
|
"sendDTMF",
|
|
137
357
|
"hangUp",
|
|
138
358
|
"declineToIncomingCall",
|
|
@@ -144,7 +364,7 @@ const fe = (e) => e instanceof Object && ("originator" in e || "cause" in e), Tn
|
|
|
144
364
|
"isConfigured",
|
|
145
365
|
"isRegistered"
|
|
146
366
|
]);
|
|
147
|
-
class
|
|
367
|
+
class ln {
|
|
148
368
|
// @ts-expect-error: proxy method
|
|
149
369
|
on;
|
|
150
370
|
// @ts-expect-error: proxy method
|
|
@@ -156,6 +376,16 @@ class vn {
|
|
|
156
376
|
// @ts-expect-error: proxy method
|
|
157
377
|
off;
|
|
158
378
|
// @ts-expect-error: proxy method
|
|
379
|
+
onSession;
|
|
380
|
+
// @ts-expect-error: proxy method
|
|
381
|
+
onceSession;
|
|
382
|
+
// @ts-expect-error: proxy method
|
|
383
|
+
onceRaceSession;
|
|
384
|
+
// @ts-expect-error: proxy method
|
|
385
|
+
waitSession;
|
|
386
|
+
// @ts-expect-error: proxy method
|
|
387
|
+
offSession;
|
|
388
|
+
// @ts-expect-error: proxy method
|
|
159
389
|
sendDTMF;
|
|
160
390
|
// @ts-expect-error: proxy method
|
|
161
391
|
hangUp;
|
|
@@ -178,73 +408,73 @@ class vn {
|
|
|
178
408
|
sipConnector;
|
|
179
409
|
preferredMimeTypesVideoCodecs;
|
|
180
410
|
excludeMimeTypesVideoCodecs;
|
|
181
|
-
constructor(
|
|
411
|
+
constructor(e, {
|
|
182
412
|
preferredMimeTypesVideoCodecs: t,
|
|
183
|
-
excludeMimeTypesVideoCodecs:
|
|
413
|
+
excludeMimeTypesVideoCodecs: s
|
|
184
414
|
} = {}) {
|
|
185
|
-
return this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs =
|
|
186
|
-
get: (
|
|
187
|
-
if (typeof r == "string" &&
|
|
415
|
+
return this.preferredMimeTypesVideoCodecs = t, this.excludeMimeTypesVideoCodecs = s, this.sipConnector = e, new Proxy(this, {
|
|
416
|
+
get: (o, r, c) => {
|
|
417
|
+
if (typeof r == "string" && en.has(r) && r in this.sipConnector) {
|
|
188
418
|
const u = Reflect.get(this.sipConnector, r, this.sipConnector);
|
|
189
419
|
return typeof u == "function" ? u.bind(this.sipConnector) : u;
|
|
190
420
|
}
|
|
191
|
-
const a = Reflect.get(
|
|
192
|
-
return typeof a == "function" ? a.bind(
|
|
421
|
+
const a = Reflect.get(o, r, c);
|
|
422
|
+
return typeof a == "function" ? a.bind(o) : a;
|
|
193
423
|
}
|
|
194
424
|
});
|
|
195
425
|
}
|
|
196
|
-
connectToServer = async (
|
|
426
|
+
connectToServer = async (e) => {
|
|
197
427
|
const {
|
|
198
428
|
userAgent: t,
|
|
199
|
-
sipWebSocketServerURL:
|
|
200
|
-
sipServerUrl:
|
|
429
|
+
sipWebSocketServerURL: s,
|
|
430
|
+
sipServerUrl: o,
|
|
201
431
|
remoteAddress: r,
|
|
202
|
-
displayName:
|
|
432
|
+
displayName: c,
|
|
203
433
|
name: a,
|
|
204
434
|
password: u,
|
|
205
435
|
isRegisteredUser: l,
|
|
206
|
-
isDisconnectOnFail:
|
|
207
|
-
} =
|
|
208
|
-
return
|
|
436
|
+
isDisconnectOnFail: S
|
|
437
|
+
} = e;
|
|
438
|
+
return i("connectToServer", e), this.sipConnector.connect({
|
|
209
439
|
userAgent: t,
|
|
210
|
-
sipWebSocketServerURL:
|
|
211
|
-
sipServerUrl:
|
|
440
|
+
sipWebSocketServerURL: s,
|
|
441
|
+
sipServerUrl: o,
|
|
212
442
|
remoteAddress: r,
|
|
213
|
-
displayName:
|
|
443
|
+
displayName: c,
|
|
214
444
|
password: u,
|
|
215
445
|
user: a,
|
|
216
446
|
register: l
|
|
217
|
-
}).then((
|
|
447
|
+
}).then((C) => (i("connectToServer then"), { ua: C, isSuccessful: !0 })).catch(async (C) => (i("connectToServer catch: error", C), S === !0 ? this.sipConnector.disconnect().then(() => X(C)).catch(() => X(C)) : X(C)));
|
|
218
448
|
};
|
|
219
|
-
callToServer = async (
|
|
449
|
+
callToServer = async (e) => {
|
|
220
450
|
const {
|
|
221
451
|
conference: t,
|
|
222
|
-
mediaStream:
|
|
223
|
-
extraHeaders:
|
|
452
|
+
mediaStream: s,
|
|
453
|
+
extraHeaders: o,
|
|
224
454
|
iceServers: r,
|
|
225
|
-
contentHint:
|
|
455
|
+
contentHint: c,
|
|
226
456
|
simulcastEncodings: a,
|
|
227
457
|
degradationPreference: u,
|
|
228
458
|
sendEncodings: l,
|
|
229
|
-
offerToReceiveAudio:
|
|
230
|
-
offerToReceiveVideo:
|
|
231
|
-
directionVideo:
|
|
232
|
-
directionAudio:
|
|
233
|
-
setRemoteStreams:
|
|
459
|
+
offerToReceiveAudio: S,
|
|
460
|
+
offerToReceiveVideo: C,
|
|
461
|
+
directionVideo: k,
|
|
462
|
+
directionAudio: F,
|
|
463
|
+
setRemoteStreams: f,
|
|
234
464
|
onBeforeProgressCall: R,
|
|
235
|
-
onSuccessProgressCall:
|
|
236
|
-
onEnterPurgatory:
|
|
237
|
-
onEnterConference:
|
|
238
|
-
onFailProgressCall:
|
|
465
|
+
onSuccessProgressCall: m,
|
|
466
|
+
onEnterPurgatory: h,
|
|
467
|
+
onEnterConference: g,
|
|
468
|
+
onFailProgressCall: y,
|
|
239
469
|
onFinishProgressCall: T,
|
|
240
|
-
onEndedCall:
|
|
241
|
-
} =
|
|
242
|
-
onReadyRemoteStreams:
|
|
243
|
-
}),
|
|
470
|
+
onEndedCall: E
|
|
471
|
+
} = e, v = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
472
|
+
onReadyRemoteStreams: f
|
|
473
|
+
}), _ = this.resolveHandleReadyRemoteStreams({
|
|
244
474
|
onReadyRemoteStreams: () => {
|
|
245
|
-
|
|
475
|
+
v().catch(I);
|
|
246
476
|
}
|
|
247
|
-
}),
|
|
477
|
+
}), A = P(
|
|
248
478
|
{
|
|
249
479
|
degradationPreference: u
|
|
250
480
|
},
|
|
@@ -253,67 +483,67 @@ class vn {
|
|
|
253
483
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
254
484
|
}
|
|
255
485
|
);
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
mediaStream:
|
|
259
|
-
extraHeaders:
|
|
486
|
+
i("callToServer", e);
|
|
487
|
+
const O = async () => (i("startCall"), this.sipConnector.call({
|
|
488
|
+
mediaStream: s,
|
|
489
|
+
extraHeaders: o,
|
|
260
490
|
iceServers: r,
|
|
261
|
-
contentHint:
|
|
262
|
-
offerToReceiveAudio:
|
|
263
|
-
offerToReceiveVideo:
|
|
264
|
-
directionVideo:
|
|
265
|
-
directionAudio:
|
|
266
|
-
sendEncodings:
|
|
267
|
-
mediaStream:
|
|
491
|
+
contentHint: c,
|
|
492
|
+
offerToReceiveAudio: S,
|
|
493
|
+
offerToReceiveVideo: C,
|
|
494
|
+
directionVideo: k,
|
|
495
|
+
directionAudio: F,
|
|
496
|
+
sendEncodings: B({
|
|
497
|
+
mediaStream: s,
|
|
268
498
|
simulcastEncodings: a,
|
|
269
499
|
sendEncodings: l
|
|
270
500
|
}),
|
|
271
501
|
number: t,
|
|
272
|
-
onAddedTransceiver:
|
|
273
|
-
ontrack:
|
|
502
|
+
onAddedTransceiver: A,
|
|
503
|
+
ontrack: _
|
|
274
504
|
}));
|
|
275
505
|
let M = !1, b;
|
|
276
|
-
const
|
|
277
|
-
|
|
506
|
+
const N = (i("subscribeEnterConference: onEnterConference", g), h ?? g ? this.sipConnector.onSession("enterRoom", ({ room: d }) => {
|
|
507
|
+
i("enterRoom", { _room: d, isSuccessProgressCall: M }), b = d, D(b) ? h && h() : g && g({ isSuccessProgressCall: M });
|
|
278
508
|
}) : () => {
|
|
279
|
-
}),
|
|
280
|
-
|
|
281
|
-
}), d),
|
|
282
|
-
throw
|
|
509
|
+
}), x = (d) => (i("onSuccess"), M = !0, v().catch(I), m && m({ isPurgatory: D(b) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
510
|
+
N(), E && E();
|
|
511
|
+
}), d), L = (d) => {
|
|
512
|
+
throw i("onFail"), y && y(), N(), d;
|
|
283
513
|
}, $ = () => {
|
|
284
|
-
|
|
514
|
+
i("onFinish"), T && T();
|
|
285
515
|
};
|
|
286
|
-
return
|
|
516
|
+
return i("onBeforeProgressCall"), R && R(t), O().then(x).catch((d) => L(d)).finally($);
|
|
287
517
|
};
|
|
288
|
-
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (
|
|
289
|
-
|
|
518
|
+
disconnectFromServer = async () => this.sipConnector.disconnect().then(() => (i("disconnectFromServer: then"), { isSuccessful: !0 })).catch((e) => (i("disconnectFromServer: catch", e), { isSuccessful: !1 }));
|
|
519
|
+
answerIncomingCall = async (e) => {
|
|
290
520
|
const {
|
|
291
521
|
mediaStream: t,
|
|
292
|
-
extraHeaders:
|
|
293
|
-
iceServers:
|
|
522
|
+
extraHeaders: s,
|
|
523
|
+
iceServers: o,
|
|
294
524
|
contentHint: r,
|
|
295
|
-
simulcastEncodings:
|
|
525
|
+
simulcastEncodings: c,
|
|
296
526
|
degradationPreference: a,
|
|
297
527
|
sendEncodings: u,
|
|
298
528
|
offerToReceiveAudio: l,
|
|
299
|
-
offerToReceiveVideo:
|
|
300
|
-
directionVideo:
|
|
301
|
-
directionAudio:
|
|
302
|
-
setRemoteStreams:
|
|
303
|
-
onBeforeProgressCall:
|
|
529
|
+
offerToReceiveVideo: S,
|
|
530
|
+
directionVideo: C,
|
|
531
|
+
directionAudio: k,
|
|
532
|
+
setRemoteStreams: F,
|
|
533
|
+
onBeforeProgressCall: f,
|
|
304
534
|
onSuccessProgressCall: R,
|
|
305
|
-
onEnterPurgatory:
|
|
306
|
-
onEnterConference:
|
|
307
|
-
onFailProgressCall:
|
|
308
|
-
onFinishProgressCall:
|
|
535
|
+
onEnterPurgatory: m,
|
|
536
|
+
onEnterConference: h,
|
|
537
|
+
onFailProgressCall: g,
|
|
538
|
+
onFinishProgressCall: y,
|
|
309
539
|
onEndedCall: T
|
|
310
|
-
} =
|
|
311
|
-
onReadyRemoteStreams:
|
|
312
|
-
}),
|
|
540
|
+
} = e, E = this.resolveHandleReadyRemoteStreamsDebounced({
|
|
541
|
+
onReadyRemoteStreams: F
|
|
542
|
+
}), v = this.resolveHandleReadyRemoteStreams({
|
|
313
543
|
onReadyRemoteStreams: () => {
|
|
314
|
-
|
|
544
|
+
E().catch(I);
|
|
315
545
|
}
|
|
316
|
-
}),
|
|
546
|
+
}), _ = P(
|
|
317
547
|
{
|
|
318
548
|
degradationPreference: a
|
|
319
549
|
},
|
|
@@ -322,137 +552,139 @@ class vn {
|
|
|
322
552
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
323
553
|
}
|
|
324
554
|
);
|
|
325
|
-
|
|
326
|
-
const
|
|
555
|
+
i("answerIncomingCall", e);
|
|
556
|
+
const A = async () => this.sipConnector.answerToIncomingCall({
|
|
327
557
|
mediaStream: t,
|
|
328
|
-
extraHeaders:
|
|
329
|
-
iceServers:
|
|
558
|
+
extraHeaders: s,
|
|
559
|
+
iceServers: o,
|
|
330
560
|
contentHint: r,
|
|
331
561
|
offerToReceiveAudio: l,
|
|
332
|
-
offerToReceiveVideo:
|
|
333
|
-
directionVideo:
|
|
334
|
-
directionAudio:
|
|
335
|
-
sendEncodings:
|
|
562
|
+
offerToReceiveVideo: S,
|
|
563
|
+
directionVideo: C,
|
|
564
|
+
directionAudio: k,
|
|
565
|
+
sendEncodings: B({
|
|
336
566
|
mediaStream: t,
|
|
337
|
-
simulcastEncodings:
|
|
567
|
+
simulcastEncodings: c,
|
|
338
568
|
sendEncodings: u
|
|
339
569
|
}),
|
|
340
|
-
onAddedTransceiver:
|
|
341
|
-
ontrack:
|
|
342
|
-
}),
|
|
570
|
+
onAddedTransceiver: _,
|
|
571
|
+
ontrack: v
|
|
572
|
+
}), O = () => {
|
|
343
573
|
const { remoteCallerData: d } = this.sipConnector;
|
|
344
574
|
return d.incomingNumber;
|
|
345
575
|
};
|
|
346
576
|
let M = !1, b;
|
|
347
|
-
const
|
|
348
|
-
|
|
577
|
+
const N = (i("subscribeEnterConference: onEnterConference", h), m ?? h ? this.sipConnector.onSession("enterRoom", (d) => {
|
|
578
|
+
i("enterRoom", { _room: d, isSuccessProgressCall: M }), b = d, D(b) ? m && m() : h && h({ isSuccessProgressCall: M });
|
|
349
579
|
}) : () => {
|
|
350
|
-
}),
|
|
351
|
-
|
|
352
|
-
}), d),
|
|
353
|
-
throw
|
|
580
|
+
}), x = (d) => (i("onSuccess"), M = !0, E().catch(I), R && R({ isPurgatory: D(b) }), this.sipConnector.onceRaceSession(["ended", "failed"], () => {
|
|
581
|
+
N(), T && T();
|
|
582
|
+
}), d), L = (d) => {
|
|
583
|
+
throw i("onFail"), g && g(), N(), d;
|
|
354
584
|
}, $ = () => {
|
|
355
|
-
|
|
585
|
+
i("onFinish"), y && y();
|
|
356
586
|
};
|
|
357
|
-
if (
|
|
358
|
-
const d =
|
|
359
|
-
|
|
587
|
+
if (i("onBeforeProgressCall"), f) {
|
|
588
|
+
const d = O();
|
|
589
|
+
f(d);
|
|
360
590
|
}
|
|
361
|
-
return
|
|
591
|
+
return A().then(x).catch((d) => L(d)).finally($);
|
|
362
592
|
};
|
|
363
593
|
updatePresentation = async ({
|
|
364
|
-
mediaStream:
|
|
594
|
+
mediaStream: e,
|
|
365
595
|
isP2P: t,
|
|
366
|
-
maxBitrate:
|
|
367
|
-
contentHint:
|
|
596
|
+
maxBitrate: s,
|
|
597
|
+
contentHint: o,
|
|
368
598
|
simulcastEncodings: r,
|
|
369
|
-
degradationPreference:
|
|
599
|
+
degradationPreference: c,
|
|
370
600
|
sendEncodings: a,
|
|
371
601
|
preferredMimeTypesVideoCodecs: u,
|
|
372
602
|
excludeMimeTypesVideoCodecs: l
|
|
373
603
|
}) => {
|
|
374
|
-
const
|
|
604
|
+
const S = P(
|
|
375
605
|
{
|
|
376
|
-
degradationPreference:
|
|
606
|
+
degradationPreference: c
|
|
377
607
|
},
|
|
378
608
|
{
|
|
379
609
|
preferredMimeTypesVideoCodecs: u,
|
|
380
610
|
excludeMimeTypesVideoCodecs: l
|
|
381
611
|
}
|
|
382
612
|
);
|
|
383
|
-
return
|
|
613
|
+
return i("updatePresentation"), this.sipConnector.updatePresentation(e, {
|
|
384
614
|
isP2P: t,
|
|
385
|
-
maxBitrate:
|
|
386
|
-
contentHint:
|
|
387
|
-
sendEncodings:
|
|
388
|
-
mediaStream:
|
|
615
|
+
maxBitrate: s,
|
|
616
|
+
contentHint: o,
|
|
617
|
+
sendEncodings: B({
|
|
618
|
+
mediaStream: e,
|
|
389
619
|
simulcastEncodings: r,
|
|
390
620
|
sendEncodings: a
|
|
391
621
|
}),
|
|
392
|
-
onAddedTransceiver:
|
|
622
|
+
onAddedTransceiver: S
|
|
393
623
|
});
|
|
394
624
|
};
|
|
395
625
|
startPresentation = async ({
|
|
396
|
-
mediaStream:
|
|
626
|
+
mediaStream: e,
|
|
397
627
|
isP2P: t,
|
|
398
|
-
maxBitrate:
|
|
399
|
-
contentHint:
|
|
628
|
+
maxBitrate: s,
|
|
629
|
+
contentHint: o,
|
|
400
630
|
simulcastEncodings: r,
|
|
401
|
-
degradationPreference:
|
|
631
|
+
degradationPreference: c,
|
|
402
632
|
sendEncodings: a,
|
|
403
633
|
preferredMimeTypesVideoCodecs: u,
|
|
404
|
-
excludeMimeTypesVideoCodecs: l
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
const f = P(
|
|
634
|
+
excludeMimeTypesVideoCodecs: l
|
|
635
|
+
}, S) => {
|
|
636
|
+
const C = P(
|
|
408
637
|
{
|
|
409
|
-
degradationPreference:
|
|
638
|
+
degradationPreference: c
|
|
410
639
|
},
|
|
411
640
|
{
|
|
412
641
|
preferredMimeTypesVideoCodecs: u,
|
|
413
642
|
excludeMimeTypesVideoCodecs: l
|
|
414
643
|
}
|
|
415
644
|
);
|
|
416
|
-
return
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
645
|
+
return i("startPresentation"), this.sipConnector.startPresentation(
|
|
646
|
+
e,
|
|
647
|
+
{
|
|
648
|
+
isP2P: t,
|
|
649
|
+
maxBitrate: s,
|
|
650
|
+
contentHint: o,
|
|
651
|
+
sendEncodings: B({
|
|
652
|
+
mediaStream: e,
|
|
653
|
+
simulcastEncodings: r,
|
|
654
|
+
sendEncodings: a
|
|
655
|
+
}),
|
|
656
|
+
onAddedTransceiver: C
|
|
657
|
+
},
|
|
658
|
+
S
|
|
659
|
+
);
|
|
428
660
|
};
|
|
429
|
-
stopShareSipConnector = async ({ isP2P:
|
|
430
|
-
isP2P:
|
|
661
|
+
stopShareSipConnector = async ({ isP2P: e = !1 } = {}) => (i("stopShareSipConnector"), this.sipConnector.stopPresentation({
|
|
662
|
+
isP2P: e
|
|
431
663
|
}).catch((t) => {
|
|
432
|
-
|
|
664
|
+
i(t);
|
|
433
665
|
}));
|
|
434
666
|
sendRefusalToTurnOnMic = async () => {
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
});
|
|
667
|
+
this.sipConnector.isCallActive && (i("sendRefusalToTurnOnMic"), await this.sipConnector.sendRefusalToTurnOnMic().catch((e) => {
|
|
668
|
+
i("sendRefusalToTurnOnMic: error", e);
|
|
669
|
+
}));
|
|
438
670
|
};
|
|
439
671
|
sendRefusalToTurnOnCam = async () => {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
});
|
|
672
|
+
this.sipConnector.isCallActive && (i("sendRefusalToTurnOnCam"), await this.sipConnector.sendRefusalToTurnOnCam().catch((e) => {
|
|
673
|
+
i("sendRefusalToTurnOnCam: error", e);
|
|
674
|
+
}));
|
|
443
675
|
};
|
|
444
676
|
sendMediaState = async ({
|
|
445
|
-
isEnabledCam:
|
|
677
|
+
isEnabledCam: e,
|
|
446
678
|
isEnabledMic: t
|
|
447
679
|
}) => {
|
|
448
|
-
|
|
680
|
+
this.sipConnector.isCallActive && (i("sendMediaState"), await this.sipConnector.sendMediaState({ cam: e, mic: t }));
|
|
449
681
|
};
|
|
450
|
-
replaceMediaStream = async (
|
|
682
|
+
replaceMediaStream = async (e, {
|
|
451
683
|
deleteExisting: t,
|
|
452
|
-
addMissing:
|
|
453
|
-
forceRenegotiation:
|
|
684
|
+
addMissing: s,
|
|
685
|
+
forceRenegotiation: o,
|
|
454
686
|
contentHint: r,
|
|
455
|
-
simulcastEncodings:
|
|
687
|
+
simulcastEncodings: c,
|
|
456
688
|
degradationPreference: a,
|
|
457
689
|
sendEncodings: u
|
|
458
690
|
} = {}) => {
|
|
@@ -465,341 +697,58 @@ class vn {
|
|
|
465
697
|
excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
|
|
466
698
|
}
|
|
467
699
|
);
|
|
468
|
-
return
|
|
700
|
+
return i("replaceMediaStream"), this.sipConnector.replaceMediaStream(e, {
|
|
469
701
|
deleteExisting: t,
|
|
470
|
-
addMissing:
|
|
471
|
-
forceRenegotiation:
|
|
702
|
+
addMissing: s,
|
|
703
|
+
forceRenegotiation: o,
|
|
472
704
|
contentHint: r,
|
|
473
|
-
sendEncodings:
|
|
474
|
-
mediaStream:
|
|
475
|
-
simulcastEncodings:
|
|
705
|
+
sendEncodings: B({
|
|
706
|
+
mediaStream: e,
|
|
707
|
+
simulcastEncodings: c,
|
|
476
708
|
sendEncodings: u
|
|
477
709
|
}),
|
|
478
710
|
onAddedTransceiver: l
|
|
479
711
|
});
|
|
480
712
|
};
|
|
481
713
|
askPermissionToEnableCam = async () => {
|
|
482
|
-
|
|
714
|
+
this.sipConnector.isCallActive && (i("askPermissionToEnableCam"), await this.sipConnector.askPermissionToEnableCam());
|
|
483
715
|
};
|
|
484
716
|
resolveHandleReadyRemoteStreamsDebounced = ({
|
|
485
|
-
onReadyRemoteStreams:
|
|
486
|
-
}) =>
|
|
717
|
+
onReadyRemoteStreams: e
|
|
718
|
+
}) => Ce(() => {
|
|
487
719
|
const t = this.sipConnector.getRemoteStreams();
|
|
488
|
-
|
|
720
|
+
i("remoteStreams", t), t && e(t);
|
|
489
721
|
}, 200);
|
|
490
722
|
// eslint-disable-next-line class-methods-use-this
|
|
491
723
|
resolveHandleReadyRemoteStreams = ({
|
|
492
|
-
onReadyRemoteStreams:
|
|
724
|
+
onReadyRemoteStreams: e
|
|
493
725
|
}) => ({ track: t }) => {
|
|
494
|
-
|
|
726
|
+
Ze(t) && e();
|
|
495
727
|
};
|
|
496
|
-
getRemoteStreams = () => (
|
|
497
|
-
onUseLicense = (
|
|
498
|
-
onMustStopPresentation = (
|
|
499
|
-
onMoveToSpectators = (
|
|
500
|
-
onMoveToParticipants = (
|
|
728
|
+
getRemoteStreams = () => (i("getRemoteStreams"), this.sipConnector.getRemoteStreams());
|
|
729
|
+
onUseLicense = (e) => (i("onUseLicense"), this.sipConnector.onSession("useLicense", e));
|
|
730
|
+
onMustStopPresentation = (e) => (i("onMustStopPresentation"), this.sipConnector.onSession("mustStopPresentation", e));
|
|
731
|
+
onMoveToSpectators = (e) => (i("onMoveToSpectators"), this.sipConnector.onSession(ie, e));
|
|
732
|
+
onMoveToParticipants = (e) => (i("onMoveToParticipants"), this.sipConnector.onSession(ce, e));
|
|
501
733
|
}
|
|
502
|
-
const V = (e) => {
|
|
503
|
-
const { url: n, cause: t } = e;
|
|
504
|
-
let o = n;
|
|
505
|
-
return (t === y.BAD_MEDIA_DESCRIPTION || t === y.NOT_FOUND) && (o = `${e.message.to.uri.user}@${e.message.to.uri.host}`), o;
|
|
506
|
-
};
|
|
507
|
-
var se = /* @__PURE__ */ ((e) => (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))(se || {});
|
|
508
|
-
const ke = new Error("Unknown error"), Ue = (e = ke) => {
|
|
509
|
-
const { cause: n, socket: t } = e;
|
|
510
|
-
let o = "CONNECT_SERVER_FAILED";
|
|
511
|
-
switch (n) {
|
|
512
|
-
case "Forbidden": {
|
|
513
|
-
o = "WRONG_USER_OR_PASSWORD";
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
516
|
-
case y.BAD_MEDIA_DESCRIPTION: {
|
|
517
|
-
o = "BAD_MEDIA_ERROR";
|
|
518
|
-
break;
|
|
519
|
-
}
|
|
520
|
-
case y.NOT_FOUND: {
|
|
521
|
-
o = "NOT_FOUND_ERROR";
|
|
522
|
-
break;
|
|
523
|
-
}
|
|
524
|
-
default:
|
|
525
|
-
t !== void 0 && t._ws?.readyState === 3 ? o = "WS_CONNECTION_FAILED" : V(e) !== void 0 && V(e) !== "" && (o = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
526
|
-
}
|
|
527
|
-
return o;
|
|
528
|
-
}, Ve = (e) => {
|
|
529
|
-
let n = "";
|
|
530
|
-
try {
|
|
531
|
-
n = JSON.stringify(e);
|
|
532
|
-
} catch (t) {
|
|
533
|
-
c("failed to stringify message", t);
|
|
534
|
-
}
|
|
535
|
-
return n;
|
|
536
|
-
}, Le = new Error("Unknown error"), He = (e = Le) => {
|
|
537
|
-
const { code: n, cause: t, message: o } = e, s = V(e), r = { code: "", cause: "", message: "" };
|
|
538
|
-
return typeof o == "object" && o !== null ? r.message = Ve(o) : o && (r.message = String(o)), s !== void 0 && s !== "" && (r.link = s), n !== void 0 && n !== "" && (r.code = n), t !== void 0 && t !== "" && (r.cause = t), r;
|
|
539
|
-
}, $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
540
|
-
__proto__: null,
|
|
541
|
-
EErrorTypes: se,
|
|
542
|
-
getLinkError: V,
|
|
543
|
-
getTypeFromError: Ue,
|
|
544
|
-
getValuesFromError: He
|
|
545
|
-
}, Symbol.toStringTag, { value: "Module" })), Je = ({
|
|
546
|
-
sessionId: e,
|
|
547
|
-
remoteAddress: n,
|
|
548
|
-
isMutedAudio: t,
|
|
549
|
-
isMutedVideo: o,
|
|
550
|
-
isRegistered: s,
|
|
551
|
-
isPresentationCall: r
|
|
552
|
-
}) => {
|
|
553
|
-
const i = [], a = t ? "0" : "1", u = o ? "0" : "1";
|
|
554
|
-
return i.push(`X-Vinteo-Mic-State: ${a}`, `X-Vinteo-MainCam-State: ${u}`), (s === !1 || s === void 0) && i.push("X-Vinteo-Purgatory-Call: yes"), e !== void 0 && e !== "" && i.push(`X-Vinteo-Session: ${e}`), r === !0 && i.push("X-Vinteo-Presentation-Call: yes"), n !== void 0 && n !== "" && i.push(`X-Vinteo-Remote: ${n}`), i;
|
|
555
|
-
}, Xe = "[@*!|]", We = "_", je = (e) => {
|
|
556
|
-
let n = e;
|
|
557
|
-
return n = n.replaceAll(new RegExp(Xe, "g"), We), n;
|
|
558
|
-
}, Ge = ({
|
|
559
|
-
appName: e,
|
|
560
|
-
appVersion: n,
|
|
561
|
-
browserName: t,
|
|
562
|
-
browserVersion: o
|
|
563
|
-
}) => {
|
|
564
|
-
const r = `${je(e)} ${n}`;
|
|
565
|
-
return `ChromeNew - ${t === void 0 ? r : `${t} ${o}, ${r}`}`;
|
|
566
|
-
}, Ke = ({
|
|
567
|
-
isUnifiedSdpSemantic: e,
|
|
568
|
-
appVersion: n,
|
|
569
|
-
browserName: t,
|
|
570
|
-
browserVersion: o,
|
|
571
|
-
appName: s
|
|
572
|
-
}) => e ? Ge({ appVersion: n, browserName: t, browserVersion: o, appName: s }) : "Chrome", Ye = (e) => (n) => [...n].map((o) => async () => e(o)), qe = async ({
|
|
573
|
-
accumulatedKeys: e,
|
|
574
|
-
sendKey: n,
|
|
575
|
-
canRunTask: t
|
|
576
|
-
}) => {
|
|
577
|
-
const s = Ye(n)(e);
|
|
578
|
-
return de(s, t);
|
|
579
|
-
}, ze = (e) => (t) => (c("onStartMainCam"), e.on("api:admin-start-main-cam", t)), Qe = (e) => (t) => (c("onStartMic"), e.on("api:admin-start-mic", t)), Ze = (e) => (t) => (c("onStopMainCam"), e.on("api:admin-stop-main-cam", t)), en = (e) => (t) => (c("onStopMic"), e.on("api:admin-stop-mic", t)), nn = ({ sipConnector: e }) => {
|
|
580
|
-
const n = (g, R) => ({ isSyncForced: C }) => {
|
|
581
|
-
if (C === !0) {
|
|
582
|
-
g();
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
R();
|
|
586
|
-
}, t = ze(e), o = Ze(e), s = Qe(e), r = en(e);
|
|
587
|
-
let i, a, u, l;
|
|
588
|
-
const h = ({
|
|
589
|
-
onStartMainCamForced: g,
|
|
590
|
-
onStartMainCamNotForced: R,
|
|
591
|
-
onStopMainCamForced: C,
|
|
592
|
-
onStopMainCamNotForced: S,
|
|
593
|
-
onStartMicForced: p,
|
|
594
|
-
onStartMicNotForced: E,
|
|
595
|
-
onStopMicForced: T,
|
|
596
|
-
onStopMicNotForced: v
|
|
597
|
-
}) => {
|
|
598
|
-
const _ = n(
|
|
599
|
-
g,
|
|
600
|
-
R
|
|
601
|
-
);
|
|
602
|
-
i = t(_);
|
|
603
|
-
const A = n(
|
|
604
|
-
C,
|
|
605
|
-
S
|
|
606
|
-
);
|
|
607
|
-
a = o(A);
|
|
608
|
-
const O = n(p, E);
|
|
609
|
-
u = s(O);
|
|
610
|
-
const N = n(T, v);
|
|
611
|
-
l = r(N);
|
|
612
|
-
}, f = () => {
|
|
613
|
-
i?.(), a?.(), u?.(), l?.();
|
|
614
|
-
};
|
|
615
|
-
return {
|
|
616
|
-
start: (g) => {
|
|
617
|
-
h(g);
|
|
618
|
-
},
|
|
619
|
-
stop: () => {
|
|
620
|
-
f();
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
}, Mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
624
|
-
__proto__: null,
|
|
625
|
-
PURGATORY_CONFERENCE_NUMBER: oe,
|
|
626
|
-
createSyncMediaState: nn,
|
|
627
|
-
error: $e,
|
|
628
|
-
getExtraHeaders: Je,
|
|
629
|
-
getUserAgent: Ke,
|
|
630
|
-
hasPurgatory: x,
|
|
631
|
-
sendDtmfAccumulated: qe
|
|
632
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
633
|
-
var tn = /* @__PURE__ */ ((e) => (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))(tn || {});
|
|
634
|
-
const on = (e) => [...e.keys()].map((n) => e.get(n)), sn = (e, n) => on(e).find((t) => t?.type === n), rn = async (e) => e.getStats().then((n) => sn(n, "codec")?.mimeType), cn = (e) => e.find((n) => n.track?.kind === "video"), an = async (e, n, t) => {
|
|
635
|
-
const { isChanged: o, parameters: s } = await z(e, {
|
|
636
|
-
encodings: [
|
|
637
|
-
{
|
|
638
|
-
scaleResolutionDownBy: n.scaleResolutionDownBy,
|
|
639
|
-
maxBitrate: n.maxBitrate
|
|
640
|
-
}
|
|
641
|
-
]
|
|
642
|
-
});
|
|
643
|
-
return o && t && t(s), { isChanged: o, parameters: s };
|
|
644
|
-
}, re = le(), un = async () => re().catch((e) => {
|
|
645
|
-
c("videoSendingBalancer: error", e);
|
|
646
|
-
}), dn = async (e) => (re.add(e), un()), W = async ({
|
|
647
|
-
sender: e,
|
|
648
|
-
scaleResolutionDownBy: n,
|
|
649
|
-
maxBitrate: t,
|
|
650
|
-
onSetParameters: o
|
|
651
|
-
}) => dn(async () => an(e, { scaleResolutionDownBy: n, maxBitrate: t }, o)), ln = async ({ sender: e, codec: n }, t) => {
|
|
652
|
-
const s = Be(n);
|
|
653
|
-
return W({
|
|
654
|
-
sender: e,
|
|
655
|
-
maxBitrate: s,
|
|
656
|
-
onSetParameters: t,
|
|
657
|
-
scaleResolutionDownBy: 200
|
|
658
|
-
});
|
|
659
|
-
}, U = async ({
|
|
660
|
-
sender: e,
|
|
661
|
-
videoTrack: n,
|
|
662
|
-
codec: t
|
|
663
|
-
}, o) => {
|
|
664
|
-
const i = n.getSettings().width, a = ne(i ?? 0, t);
|
|
665
|
-
return W({
|
|
666
|
-
sender: e,
|
|
667
|
-
maxBitrate: a,
|
|
668
|
-
onSetParameters: o,
|
|
669
|
-
scaleResolutionDownBy: 1
|
|
670
|
-
});
|
|
671
|
-
}, fn = async ({
|
|
672
|
-
sender: e,
|
|
673
|
-
videoTrack: n,
|
|
674
|
-
resolution: t,
|
|
675
|
-
codec: o
|
|
676
|
-
}, s) => {
|
|
677
|
-
const [r, i] = t.split("x"), { maxBitrate: a, scaleResolutionDownBy: u } = te({
|
|
678
|
-
videoTrack: n,
|
|
679
|
-
codec: o,
|
|
680
|
-
targetSize: {
|
|
681
|
-
width: Number(r),
|
|
682
|
-
height: Number(i)
|
|
683
|
-
}
|
|
684
|
-
});
|
|
685
|
-
return W({
|
|
686
|
-
sender: e,
|
|
687
|
-
maxBitrate: a,
|
|
688
|
-
onSetParameters: s,
|
|
689
|
-
scaleResolutionDownBy: u
|
|
690
|
-
});
|
|
691
|
-
}, hn = async ({
|
|
692
|
-
mainCam: e,
|
|
693
|
-
resolutionMainCam: n,
|
|
694
|
-
sender: t,
|
|
695
|
-
videoTrack: o,
|
|
696
|
-
codec: s
|
|
697
|
-
}, r) => {
|
|
698
|
-
switch (e) {
|
|
699
|
-
case w.PAUSE_MAIN_CAM:
|
|
700
|
-
return ln({ sender: t, codec: s }, r);
|
|
701
|
-
case w.RESUME_MAIN_CAM:
|
|
702
|
-
return U({ sender: t, videoTrack: o, codec: s }, r);
|
|
703
|
-
case w.MAX_MAIN_CAM_RESOLUTION:
|
|
704
|
-
return n !== void 0 ? fn(
|
|
705
|
-
{ sender: t, videoTrack: o, codec: s, resolution: n },
|
|
706
|
-
r
|
|
707
|
-
) : U({ sender: t, videoTrack: o, codec: s }, r);
|
|
708
|
-
case w.ADMIN_STOP_MAIN_CAM:
|
|
709
|
-
case w.ADMIN_START_MAIN_CAM:
|
|
710
|
-
case void 0:
|
|
711
|
-
return U({ sender: t, videoTrack: o, codec: s }, r);
|
|
712
|
-
default:
|
|
713
|
-
return U({ sender: t, videoTrack: o, codec: s }, r);
|
|
714
|
-
}
|
|
715
|
-
}, j = {
|
|
716
|
-
isChanged: !1,
|
|
717
|
-
parameters: {
|
|
718
|
-
encodings: [{}],
|
|
719
|
-
transactionId: "0",
|
|
720
|
-
codecs: [],
|
|
721
|
-
headerExtensions: [],
|
|
722
|
-
rtcp: {}
|
|
723
|
-
}
|
|
724
|
-
}, G = async ({
|
|
725
|
-
mainCam: e,
|
|
726
|
-
resolutionMainCam: n,
|
|
727
|
-
connection: t,
|
|
728
|
-
onSetParameters: o,
|
|
729
|
-
ignoreForCodec: s
|
|
730
|
-
}) => {
|
|
731
|
-
const r = t.getSenders(), i = cn(r);
|
|
732
|
-
if (!i?.track)
|
|
733
|
-
return j;
|
|
734
|
-
const a = await rn(i);
|
|
735
|
-
return Z(a, s) ? j : hn(
|
|
736
|
-
{
|
|
737
|
-
mainCam: e,
|
|
738
|
-
resolutionMainCam: n,
|
|
739
|
-
sender: i,
|
|
740
|
-
codec: a,
|
|
741
|
-
videoTrack: i.track
|
|
742
|
-
},
|
|
743
|
-
o
|
|
744
|
-
);
|
|
745
|
-
}, bn = (e, {
|
|
746
|
-
ignoreForCodec: n,
|
|
747
|
-
onSetParameters: t
|
|
748
|
-
} = {}) => {
|
|
749
|
-
const o = async () => {
|
|
750
|
-
const { connection: u } = e;
|
|
751
|
-
if (!u)
|
|
752
|
-
throw new Error("connection is not exist");
|
|
753
|
-
return G({
|
|
754
|
-
connection: u,
|
|
755
|
-
onSetParameters: t,
|
|
756
|
-
ignoreForCodec: n
|
|
757
|
-
});
|
|
758
|
-
};
|
|
759
|
-
let s = o;
|
|
760
|
-
const r = (u) => {
|
|
761
|
-
s = async () => {
|
|
762
|
-
const { mainCam: l, resolutionMainCam: h } = u, { connection: f } = e;
|
|
763
|
-
if (!f)
|
|
764
|
-
throw new Error("connection is not exist");
|
|
765
|
-
return G({
|
|
766
|
-
mainCam: l,
|
|
767
|
-
resolutionMainCam: h,
|
|
768
|
-
connection: f,
|
|
769
|
-
onSetParameters: t,
|
|
770
|
-
ignoreForCodec: n
|
|
771
|
-
});
|
|
772
|
-
}, s().catch(I);
|
|
773
|
-
};
|
|
774
|
-
return {
|
|
775
|
-
subscribe: () => {
|
|
776
|
-
e.on("api:main-cam-control", r);
|
|
777
|
-
},
|
|
778
|
-
unsubscribe: () => {
|
|
779
|
-
e.off("api:main-cam-control", r);
|
|
780
|
-
},
|
|
781
|
-
balanceByTrack: o,
|
|
782
|
-
resetMainCamControl() {
|
|
783
|
-
s = o;
|
|
784
|
-
},
|
|
785
|
-
async reBalance() {
|
|
786
|
-
return s();
|
|
787
|
-
}
|
|
788
|
-
};
|
|
789
|
-
};
|
|
790
734
|
export {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
735
|
+
w as EEventsMainCAM,
|
|
736
|
+
fn as EEventsMic,
|
|
737
|
+
mn as EEventsSyncMediaState,
|
|
738
|
+
hn as EMimeTypesVideoCodecs,
|
|
739
|
+
pn as EUseLicense,
|
|
740
|
+
Rn as SipConnector,
|
|
741
|
+
ln as SipConnectorFacade,
|
|
742
|
+
gn as causes,
|
|
743
|
+
yn as constants,
|
|
744
|
+
An as debug,
|
|
745
|
+
Tn as disableDebug,
|
|
746
|
+
En as enableDebug,
|
|
747
|
+
Mn as eventNames,
|
|
748
|
+
De as getCodecFromSender,
|
|
749
|
+
bn as hasCanceledCallError,
|
|
750
|
+
vn as hasCanceledStartPresentationError,
|
|
751
|
+
dn as resolveVideoSendingBalancer,
|
|
752
|
+
re as setParametersToSender,
|
|
753
|
+
un as tools
|
|
805
754
|
};
|