sip-connector 9.2.0 → 10.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/SipConnector-93CcnqPF.cjs +1 -0
- package/dist/{SipConnector-xflR79mb.js → SipConnector-P-kMtUcq.js} +457 -414
- package/dist/SipConnector.d.ts +9 -9
- package/dist/__fixtures__/RTCPeerConnectionMock.d.ts +2 -1
- package/dist/__fixtures__/RTCRtpSenderMock.d.ts +4 -1
- package/dist/doMock.cjs +1 -1
- package/dist/doMock.js +87 -51
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +178 -175
- package/dist/setParametersToSender/configureDegradationPreference.d.ts +3 -0
- package/dist/setParametersToSender/configureEmptyEncodings.d.ts +2 -0
- package/dist/setParametersToSender/configureEncodings.d.ts +10 -0
- package/dist/setParametersToSender/configureMaxBitrate.d.ts +2 -0
- package/dist/setParametersToSender/configureScaleResolutionDownBy.d.ts +2 -0
- package/dist/setParametersToSender/hasChangedRTCRtpSendParameters.d.ts +2 -0
- package/dist/setParametersToSender/index.d.ts +1 -0
- package/dist/setParametersToSender/resolveHasNeedToUpdateItemEncoding.d.ts +2 -0
- package/dist/setParametersToSender/setParametersToSender.d.ts +7 -0
- package/dist/tools/answerIncomingCall.d.ts +2 -3
- package/dist/tools/callToServer.d.ts +2 -3
- package/dist/tools/resolveHandleAddedSender.d.ts +3 -0
- package/dist/tools/resolveStartPresentation.d.ts +3 -3
- package/dist/tools/resolveUpdatePresentation.d.ts +3 -3
- package/dist/types.d.ts +2 -1
- package/package.json +13 -13
- package/dist/SipConnector-lgvJyyG7.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,113 +1,115 @@
|
|
|
1
|
-
import { l as o,
|
|
2
|
-
import {
|
|
3
|
-
import { debounce as
|
|
4
|
-
import { isCanceledError as
|
|
5
|
-
import { hasCanceledError as
|
|
6
|
-
import { sequentPromises as
|
|
7
|
-
import { createStackPromises as
|
|
8
|
-
import { default as
|
|
9
|
-
const X = "purgatory", A = (e) => e === X,
|
|
10
|
-
|
|
11
|
-
},
|
|
1
|
+
import { l as o, s as J, B as $, N as H, E as I, a as Q, S as Ze } from "./SipConnector-P-kMtUcq.js";
|
|
2
|
+
import { g as ln, i as Sn, j as dn, c as mn, b as fn, d as Cn, f as gn, e as Rn, h as En } from "./SipConnector-P-kMtUcq.js";
|
|
3
|
+
import { debounce as Z } from "ts-debounce";
|
|
4
|
+
import { isCanceledError as ee } from "@krivega/cancelable-promise";
|
|
5
|
+
import { hasCanceledError as ne } from "repeated-calls";
|
|
6
|
+
import { sequentPromises as te } from "sequent-promises";
|
|
7
|
+
import { createStackPromises as re } from "stack-promises";
|
|
8
|
+
import { default as Tn } from "debug";
|
|
9
|
+
const X = "purgatory", A = (e) => e === X, F = (e) => () => (o("getRemoteStreams"), e.getRemoteStreams()), N = (e) => async (t, n) => {
|
|
10
|
+
n.kind === "video" && e !== void 0 && await J(t, e);
|
|
11
|
+
}, se = ({ kind: e, readyState: t }) => e === "video" && t === "live", W = (e) => ({ track: t }) => {
|
|
12
|
+
se(t) && e();
|
|
13
|
+
}, k = ({
|
|
12
14
|
getRemoteStreams: e,
|
|
13
15
|
setRemoteStreams: t
|
|
14
|
-
}) =>
|
|
16
|
+
}) => Z(() => {
|
|
15
17
|
const n = e();
|
|
16
18
|
o("remoteStreams", n), n && t(n);
|
|
17
|
-
}, 200),
|
|
19
|
+
}, 200), oe = (e) => async (n) => {
|
|
18
20
|
const {
|
|
19
21
|
mediaStream: r,
|
|
20
22
|
extraHeaders: s,
|
|
21
23
|
iceServers: a,
|
|
22
|
-
|
|
24
|
+
rtpSendParameters: c,
|
|
23
25
|
contentHint: i,
|
|
24
26
|
setRemoteStreams: l,
|
|
25
|
-
onBeforeProgressCall:
|
|
27
|
+
onBeforeProgressCall: m,
|
|
26
28
|
onSuccessProgressCall: f,
|
|
27
|
-
onEnterPurgatory:
|
|
29
|
+
onEnterPurgatory: d,
|
|
28
30
|
onEnterConference: S,
|
|
29
31
|
onFailProgressCall: g,
|
|
30
32
|
onFinishProgressCall: C,
|
|
31
33
|
onEndedCall: E
|
|
32
|
-
} = n, M =
|
|
34
|
+
} = n, M = k({
|
|
33
35
|
setRemoteStreams: l,
|
|
34
|
-
getRemoteStreams:
|
|
35
|
-
}), b =
|
|
36
|
+
getRemoteStreams: F(e)
|
|
37
|
+
}), b = W(M);
|
|
36
38
|
o("answerIncomingCall", n);
|
|
37
39
|
const _ = async () => e.answerToIncomingCall({
|
|
38
40
|
mediaStream: r,
|
|
39
41
|
extraHeaders: s,
|
|
40
42
|
iceServers: a,
|
|
41
43
|
contentHint: i,
|
|
42
|
-
|
|
44
|
+
onAddedSender: N(c),
|
|
43
45
|
ontrack: b
|
|
44
46
|
}), p = () => {
|
|
45
47
|
const { remoteCallerData: u } = e;
|
|
46
48
|
return u.incomingNumber;
|
|
47
49
|
};
|
|
48
50
|
let T = !1, y;
|
|
49
|
-
const h = (o("subscribeEnterConference: onEnterConference", S),
|
|
50
|
-
o("enterRoom", { _room: u, isSuccessProgressCall: T }), y = u, A(y) ?
|
|
51
|
+
const h = (o("subscribeEnterConference: onEnterConference", S), d ?? S ? e.onSession("enterRoom", (u) => {
|
|
52
|
+
o("enterRoom", { _room: u, isSuccessProgressCall: T }), y = u, A(y) ? d && d() : S && S({ isSuccessProgressCall: T });
|
|
51
53
|
}) : () => {
|
|
52
|
-
}),
|
|
54
|
+
}), v = (u) => (o("onSuccess"), T = !0, M(), f && f({ isPurgatory: A(y) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
53
55
|
h(), E && E();
|
|
54
|
-
}), u),
|
|
56
|
+
}), u), O = (u) => {
|
|
55
57
|
throw o("onFail"), g && g(), h(), u;
|
|
56
|
-
},
|
|
58
|
+
}, B = () => {
|
|
57
59
|
o("onFinish"), C && C();
|
|
58
60
|
};
|
|
59
|
-
if (o("onBeforeProgressCall"),
|
|
61
|
+
if (o("onBeforeProgressCall"), m) {
|
|
60
62
|
const u = p();
|
|
61
|
-
|
|
63
|
+
m(u);
|
|
62
64
|
}
|
|
63
|
-
return _().then(
|
|
64
|
-
},
|
|
65
|
+
return _().then(v).catch((u) => O(u)).finally(B);
|
|
66
|
+
}, ae = (e) => async (n) => {
|
|
65
67
|
const {
|
|
66
68
|
conference: r,
|
|
67
69
|
mediaStream: s,
|
|
68
70
|
extraHeaders: a,
|
|
69
71
|
iceServers: c,
|
|
70
|
-
|
|
72
|
+
rtpSendParameters: i,
|
|
71
73
|
contentHint: l,
|
|
72
|
-
setRemoteStreams:
|
|
74
|
+
setRemoteStreams: m,
|
|
73
75
|
onBeforeProgressCall: f,
|
|
74
|
-
onSuccessProgressCall:
|
|
76
|
+
onSuccessProgressCall: d,
|
|
75
77
|
onEnterPurgatory: S,
|
|
76
78
|
onEnterConference: g,
|
|
77
79
|
onFailProgressCall: C,
|
|
78
80
|
onFinishProgressCall: E,
|
|
79
81
|
onEndedCall: M
|
|
80
|
-
} = n, b =
|
|
81
|
-
setRemoteStreams:
|
|
82
|
-
getRemoteStreams:
|
|
83
|
-
}), _ =
|
|
82
|
+
} = n, b = k({
|
|
83
|
+
setRemoteStreams: m,
|
|
84
|
+
getRemoteStreams: F(e)
|
|
85
|
+
}), _ = W(b);
|
|
84
86
|
o("callToServer", n);
|
|
85
87
|
const p = async () => (o("startCall"), e.call({
|
|
86
88
|
mediaStream: s,
|
|
87
89
|
extraHeaders: a,
|
|
88
90
|
iceServers: c,
|
|
89
|
-
degradationPreference: i,
|
|
90
91
|
contentHint: l,
|
|
91
92
|
number: r,
|
|
92
|
-
ontrack: _
|
|
93
|
+
ontrack: _,
|
|
94
|
+
onAddedSender: N(i)
|
|
93
95
|
}));
|
|
94
96
|
let T = !1, y;
|
|
95
97
|
const h = (o("subscribeEnterConference: onEnterConference", g), S ?? g ? e.onSession("enterRoom", ({ room: u }) => {
|
|
96
98
|
o("enterRoom", { _room: u, isSuccessProgressCall: T }), y = u, A(y) ? S && S() : g && g({ isSuccessProgressCall: T });
|
|
97
99
|
}) : () => {
|
|
98
|
-
}),
|
|
100
|
+
}), v = (u) => (o("onSuccess"), T = !0, b(), d && d({ isPurgatory: A(y) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
99
101
|
h(), M && M();
|
|
100
|
-
}), u),
|
|
102
|
+
}), u), O = (u) => {
|
|
101
103
|
throw o("onFail"), C && C(), h(), u;
|
|
102
|
-
},
|
|
104
|
+
}, B = () => {
|
|
103
105
|
o("onFinish"), E && E();
|
|
104
106
|
};
|
|
105
|
-
return o("onBeforeProgressCall"), f && f(r), p().then(
|
|
106
|
-
},
|
|
107
|
-
if (!
|
|
107
|
+
return o("onBeforeProgressCall"), f && f(r), p().then(v).catch((u) => O(u)).finally(B);
|
|
108
|
+
}, w = (e) => {
|
|
109
|
+
if (!ee(e) && !ne(e))
|
|
108
110
|
throw e;
|
|
109
111
|
return { isSuccessful: !1 };
|
|
110
|
-
},
|
|
112
|
+
}, ce = (e) => async (n) => {
|
|
111
113
|
const {
|
|
112
114
|
userAgent: r,
|
|
113
115
|
sipWebSocketServerURL: s,
|
|
@@ -115,9 +117,9 @@ const X = "purgatory", A = (e) => e === X, D = (e) => () => (o("getRemoteStreams
|
|
|
115
117
|
remoteAddress: c,
|
|
116
118
|
displayName: i,
|
|
117
119
|
name: l,
|
|
118
|
-
password:
|
|
120
|
+
password: m,
|
|
119
121
|
isRegisteredUser: f,
|
|
120
|
-
isDisconnectOnFail:
|
|
122
|
+
isDisconnectOnFail: d
|
|
121
123
|
} = n;
|
|
122
124
|
return o("connectToServer", n), e.connect({
|
|
123
125
|
userAgent: r,
|
|
@@ -125,17 +127,17 @@ const X = "purgatory", A = (e) => e === X, D = (e) => () => (o("getRemoteStreams
|
|
|
125
127
|
sipServerUrl: a,
|
|
126
128
|
remoteAddress: c,
|
|
127
129
|
displayName: i,
|
|
128
|
-
password:
|
|
130
|
+
password: m,
|
|
129
131
|
user: l,
|
|
130
132
|
register: f
|
|
131
|
-
}).then((S) => (o("connectToServer then"), { ua: S, isSuccessful: !0 })).catch(async (S) => (o("connectToServer catch: error", S),
|
|
132
|
-
},
|
|
133
|
+
}).then((S) => (o("connectToServer then"), { ua: S, isSuccessful: !0 })).catch(async (S) => (o("connectToServer catch: error", S), d === !0 ? e.disconnect().then(() => w(S)).catch(() => w(S)) : w(S)));
|
|
134
|
+
}, ie = (e) => async () => (o("disconnectFromServer"), e.disconnect().then(() => (o("disconnectFromServer: then"), { isSuccessful: !0 })).catch((t) => (o("disconnectFromServer: catch", t), { isSuccessful: !1 }))), U = (e) => {
|
|
133
135
|
const { url: t, cause: n } = e;
|
|
134
136
|
let r = t;
|
|
135
|
-
return (n ===
|
|
137
|
+
return (n === $ || n === H) && (r = `${e.message.to.uri.user}@${e.message.to.uri.host}`), r;
|
|
136
138
|
};
|
|
137
|
-
var
|
|
138
|
-
const
|
|
139
|
+
var j = /* @__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))(j || {});
|
|
140
|
+
const ue = (e = new Error()) => {
|
|
139
141
|
var s;
|
|
140
142
|
const { cause: t, socket: n } = e;
|
|
141
143
|
let r = "CONNECT_SERVER_FAILED";
|
|
@@ -144,19 +146,19 @@ const ce = (e = new Error()) => {
|
|
|
144
146
|
r = "WRONG_USER_OR_PASSWORD";
|
|
145
147
|
break;
|
|
146
148
|
}
|
|
147
|
-
case
|
|
149
|
+
case $: {
|
|
148
150
|
r = "BAD_MEDIA_ERROR";
|
|
149
151
|
break;
|
|
150
152
|
}
|
|
151
|
-
case
|
|
153
|
+
case H: {
|
|
152
154
|
r = "NOT_FOUND_ERROR";
|
|
153
155
|
break;
|
|
154
156
|
}
|
|
155
157
|
default:
|
|
156
|
-
n && ((s = n == null ? void 0 : n._ws) == null ? void 0 : s.readyState) === 3 ? r = "WS_CONNECTION_FAILED" :
|
|
158
|
+
n && ((s = n == null ? void 0 : n._ws) == null ? void 0 : s.readyState) === 3 ? r = "WS_CONNECTION_FAILED" : U(e) && (r = "CONNECT_SERVER_FAILED_BY_LINK");
|
|
157
159
|
}
|
|
158
160
|
return r;
|
|
159
|
-
},
|
|
161
|
+
}, le = (e) => {
|
|
160
162
|
let t = "";
|
|
161
163
|
try {
|
|
162
164
|
t = JSON.stringify(e);
|
|
@@ -164,16 +166,16 @@ const ce = (e = new Error()) => {
|
|
|
164
166
|
o("failed to stringify message", n);
|
|
165
167
|
}
|
|
166
168
|
return t;
|
|
167
|
-
},
|
|
168
|
-
const { code: t, cause: n, message: r } = e, s =
|
|
169
|
-
return typeof r == "object" && r !== null ? a.message =
|
|
170
|
-
},
|
|
169
|
+
}, Se = (e = new Error()) => {
|
|
170
|
+
const { code: t, cause: n, message: r } = e, s = U(e), a = { code: "", cause: "", message: "" };
|
|
171
|
+
return typeof r == "object" && r !== null ? a.message = le(r) : r && (a.message = String(r)), s && (a.link = s), t && (a.code = t), n && (a.cause = n), a;
|
|
172
|
+
}, de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
171
173
|
__proto__: null,
|
|
172
|
-
EErrorTypes:
|
|
173
|
-
getLinkError:
|
|
174
|
-
getTypeFromError:
|
|
175
|
-
getValuesFromError:
|
|
176
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
174
|
+
EErrorTypes: j,
|
|
175
|
+
getLinkError: U,
|
|
176
|
+
getTypeFromError: ue,
|
|
177
|
+
getValuesFromError: Se
|
|
178
|
+
}, Symbol.toStringTag, { value: "Module" })), me = ({
|
|
177
179
|
sessionId: e,
|
|
178
180
|
remoteAddress: t,
|
|
179
181
|
isMutedAudio: n,
|
|
@@ -183,91 +185,91 @@ const ce = (e = new Error()) => {
|
|
|
183
185
|
}) => {
|
|
184
186
|
const c = [], i = n ? "0" : "1", l = r ? "0" : "1";
|
|
185
187
|
return c.push(`X-Vinteo-Mic-State: ${i}`, `X-Vinteo-MainCam-State: ${l}`), s || c.push("X-Vinteo-Purgatory-Call: yes"), e && c.push(`X-Vinteo-Session: ${e}`), a && c.push("X-Vinteo-Presentation-Call: yes"), t && c.push(`X-Vinteo-Remote: ${t}`), c;
|
|
186
|
-
},
|
|
188
|
+
}, fe = "[@*!|]", Ce = "_", ge = (e) => {
|
|
187
189
|
let t = e;
|
|
188
|
-
return t = t.replaceAll(new RegExp(
|
|
189
|
-
},
|
|
190
|
+
return t = t.replaceAll(new RegExp(fe, "g"), Ce), t;
|
|
191
|
+
}, Re = ({
|
|
190
192
|
appName: e,
|
|
191
193
|
appVersion: t,
|
|
192
194
|
browserName: n,
|
|
193
195
|
browserVersion: r
|
|
194
196
|
}) => {
|
|
195
|
-
const a = `${
|
|
197
|
+
const a = `${ge(e)} ${t}`;
|
|
196
198
|
return `ChromeNew - ${n ? `${n} ${r}, ${a}` : a}`;
|
|
197
|
-
},
|
|
199
|
+
}, Ee = ({
|
|
198
200
|
isUnifiedSdpSemantic: e,
|
|
199
201
|
appVersion: t,
|
|
200
202
|
browserName: n,
|
|
201
203
|
browserVersion: r,
|
|
202
204
|
appName: s
|
|
203
|
-
}) => e ?
|
|
205
|
+
}) => e ? Re({ appVersion: t, browserName: n, browserVersion: r, appName: s }) : "Chrome", Me = (e) => async () => {
|
|
204
206
|
if (e.isCallActive)
|
|
205
207
|
return o("askPermissionToEnableCam"), e.askPermissionToEnableCam();
|
|
206
|
-
},
|
|
208
|
+
}, Te = (e) => (n) => (o("onMustStopPresentation"), e.onSession("mustStopPresentation", n)), ye = (e) => (n) => (o("onMoveToSpectators"), e.onSession("participant:move-request-to-spectators", n)), he = (e) => (n) => (o("onUseLicense"), e.onSession("useLicense", n)), be = (e) => async ({
|
|
207
209
|
isEnabledCam: n,
|
|
208
210
|
isEnabledMic: r
|
|
209
211
|
}) => {
|
|
210
212
|
if (e.isCallActive)
|
|
211
213
|
return o("sendMediaState"), e.sendMediaState({ cam: n, mic: r });
|
|
212
|
-
},
|
|
214
|
+
}, _e = (e) => async () => {
|
|
213
215
|
if (e.isCallActive)
|
|
214
216
|
return o("sendRefusalToTurnOnCam"), e.sendRefusalToTurnOnCam().catch((n) => {
|
|
215
217
|
o("sendRefusalToTurnOnCam: error", n);
|
|
216
218
|
});
|
|
217
|
-
},
|
|
219
|
+
}, pe = (e) => async () => {
|
|
218
220
|
if (e.isCallActive)
|
|
219
221
|
return o("sendRefusalToTurnOnMic"), e.sendRefusalToTurnOnMic().catch((n) => {
|
|
220
222
|
o("sendRefusalToTurnOnMic: error", n);
|
|
221
223
|
});
|
|
222
|
-
},
|
|
224
|
+
}, ve = (e) => async ({
|
|
223
225
|
mediaStream: n,
|
|
224
226
|
isP2P: r,
|
|
225
227
|
maxBitrate: s,
|
|
226
|
-
|
|
228
|
+
rtpSendParameters: a,
|
|
227
229
|
contentHint: c
|
|
228
230
|
}, i) => (o("startPresentation"), e.startPresentation(
|
|
229
231
|
n,
|
|
230
232
|
{
|
|
231
233
|
isP2P: r,
|
|
232
234
|
maxBitrate: s,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
contentHint: c,
|
|
236
|
+
onAddedSender: N(a)
|
|
235
237
|
},
|
|
236
238
|
i
|
|
237
|
-
)),
|
|
239
|
+
)), Oe = (e) => async ({ isP2P: n = !1 } = {}) => (o("stopShareSipConnector"), e.stopPresentation({
|
|
238
240
|
isP2P: n
|
|
239
241
|
}).catch((r) => {
|
|
240
242
|
o(r);
|
|
241
|
-
})),
|
|
243
|
+
})), Ae = (e) => async ({
|
|
242
244
|
mediaStream: n,
|
|
243
245
|
isP2P: r,
|
|
244
246
|
maxBitrate: s,
|
|
245
|
-
|
|
247
|
+
rtpSendParameters: a,
|
|
246
248
|
contentHint: c
|
|
247
249
|
}) => (o("updatePresentation"), e.updatePresentation(n, {
|
|
248
250
|
isP2P: r,
|
|
249
251
|
maxBitrate: s,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
})),
|
|
252
|
+
contentHint: c,
|
|
253
|
+
onAddedSender: N(a)
|
|
254
|
+
})), Ne = (e) => (t) => [...t].map((r) => async () => e(r)), Pe = async ({
|
|
253
255
|
accumulatedKeys: e,
|
|
254
256
|
sendKey: t,
|
|
255
257
|
canRunTask: n
|
|
256
258
|
}) => {
|
|
257
|
-
const s =
|
|
258
|
-
return
|
|
259
|
-
},
|
|
259
|
+
const s = Ne(t)(e);
|
|
260
|
+
return te(s, n);
|
|
261
|
+
}, Be = (e) => (n) => (o("onStartMainCam"), e.onSession("admin-start-main-cam", n)), Ie = (e) => (n) => (o("onStartMic"), e.onSession("admin-start-mic", n)), we = (e) => (n) => (o("onStopMainCam"), e.onSession("admin-stop-main-cam", n)), De = (e) => (n) => (o("onStopMic"), e.onSession("admin-stop-mic", n)), Fe = ({ sipConnector: e }) => {
|
|
260
262
|
const t = (C, E) => ({ isSyncForced: M = !1 }) => {
|
|
261
263
|
if (M) {
|
|
262
264
|
C();
|
|
263
265
|
return;
|
|
264
266
|
}
|
|
265
267
|
E();
|
|
266
|
-
}, n =
|
|
268
|
+
}, n = Be(e), r = we(e), s = Ie(e), a = De(e);
|
|
267
269
|
let c = () => {
|
|
268
270
|
}, i = () => {
|
|
269
271
|
}, l = () => {
|
|
270
|
-
},
|
|
272
|
+
}, m = () => {
|
|
271
273
|
};
|
|
272
274
|
const f = ({
|
|
273
275
|
onStartMainCamForced: C,
|
|
@@ -279,102 +281,102 @@ const ce = (e = new Error()) => {
|
|
|
279
281
|
onStopMicForced: T,
|
|
280
282
|
onStopMicNotForced: y
|
|
281
283
|
}) => {
|
|
282
|
-
const
|
|
284
|
+
const P = t(
|
|
283
285
|
C,
|
|
284
286
|
E
|
|
285
287
|
);
|
|
286
|
-
c = n(
|
|
288
|
+
c = n(P);
|
|
287
289
|
const h = t(
|
|
288
290
|
M,
|
|
289
291
|
b
|
|
290
292
|
);
|
|
291
293
|
i = r(h);
|
|
292
|
-
const
|
|
293
|
-
l = s(
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
},
|
|
297
|
-
c(), i(), l(),
|
|
294
|
+
const v = t(_, p);
|
|
295
|
+
l = s(v);
|
|
296
|
+
const O = t(T, y);
|
|
297
|
+
m = a(O);
|
|
298
|
+
}, d = () => {
|
|
299
|
+
c(), i(), l(), m();
|
|
298
300
|
};
|
|
299
301
|
return {
|
|
300
302
|
start: (C) => {
|
|
301
303
|
f(C);
|
|
302
304
|
},
|
|
303
305
|
stop: () => {
|
|
304
|
-
|
|
306
|
+
d();
|
|
305
307
|
}
|
|
306
308
|
};
|
|
307
|
-
},
|
|
309
|
+
}, on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
308
310
|
__proto__: null,
|
|
309
311
|
PURGATORY_CONFERENCE_NUMBER: X,
|
|
310
|
-
createSyncMediaState:
|
|
311
|
-
error:
|
|
312
|
-
getExtraHeaders:
|
|
313
|
-
getUserAgent:
|
|
312
|
+
createSyncMediaState: Fe,
|
|
313
|
+
error: de,
|
|
314
|
+
getExtraHeaders: me,
|
|
315
|
+
getUserAgent: Ee,
|
|
314
316
|
hasPurgatory: A,
|
|
315
|
-
resolveAnswerIncomingCall:
|
|
316
|
-
resolveAskPermissionToEnableCam:
|
|
317
|
-
resolveCallToServer:
|
|
318
|
-
resolveConnectToServer:
|
|
319
|
-
resolveDisconnectFromServer:
|
|
320
|
-
resolveGetRemoteStreams:
|
|
321
|
-
resolveOnMoveToSpectators:
|
|
322
|
-
resolveOnMustStopPresentation:
|
|
323
|
-
resolveOnUseLicense:
|
|
324
|
-
resolveSendMediaState:
|
|
325
|
-
resolveSendRefusalToTurnOnCam:
|
|
326
|
-
resolveSendRefusalToTurnOnMic:
|
|
327
|
-
resolveStartPresentation:
|
|
328
|
-
resolveStopShareSipConnector:
|
|
329
|
-
resolveUpdatePresentation:
|
|
330
|
-
resolveUpdateRemoteStreams:
|
|
331
|
-
sendDTMFAccumulated:
|
|
332
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
333
|
-
const n =
|
|
317
|
+
resolveAnswerIncomingCall: oe,
|
|
318
|
+
resolveAskPermissionToEnableCam: Me,
|
|
319
|
+
resolveCallToServer: ae,
|
|
320
|
+
resolveConnectToServer: ce,
|
|
321
|
+
resolveDisconnectFromServer: ie,
|
|
322
|
+
resolveGetRemoteStreams: F,
|
|
323
|
+
resolveOnMoveToSpectators: ye,
|
|
324
|
+
resolveOnMustStopPresentation: Te,
|
|
325
|
+
resolveOnUseLicense: he,
|
|
326
|
+
resolveSendMediaState: be,
|
|
327
|
+
resolveSendRefusalToTurnOnCam: _e,
|
|
328
|
+
resolveSendRefusalToTurnOnMic: pe,
|
|
329
|
+
resolveStartPresentation: ve,
|
|
330
|
+
resolveStopShareSipConnector: Oe,
|
|
331
|
+
resolveUpdatePresentation: Ae,
|
|
332
|
+
resolveUpdateRemoteStreams: k,
|
|
333
|
+
sendDTMFAccumulated: Pe
|
|
334
|
+
}, Symbol.toStringTag, { value: "Module" })), ke = (e) => [...e.keys()].map((t) => e.get(t)), Ue = (e, t) => ke(e).find((n) => n.type === t), Le = async (e) => e.getStats().then((t) => {
|
|
335
|
+
const n = Ue(t, "codec");
|
|
334
336
|
return n == null ? void 0 : n.mimeType;
|
|
335
|
-
}),
|
|
337
|
+
}), Ve = (e) => e.find((t) => {
|
|
336
338
|
var n;
|
|
337
339
|
return ((n = t == null ? void 0 : t.track) == null ? void 0 : n.kind) === "video";
|
|
338
|
-
}), G = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()),
|
|
339
|
-
const n =
|
|
340
|
-
return
|
|
341
|
-
},
|
|
340
|
+
}), G = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), xe = 1e6, R = (e) => e * xe, K = R(0.06), $e = R(4), He = (e) => e <= 64 ? K : e <= 128 ? R(0.12) : e <= 256 ? R(0.25) : e <= 384 ? R(0.32) : e <= 426 ? R(0.38) : e <= 640 ? R(0.5) : e <= 848 ? R(0.7) : e <= 1280 ? R(1) : e <= 1920 ? R(2) : $e, Xe = "av1", We = (e) => G(e, Xe), je = 0.6, Y = (e, t) => We(t) ? e * je : e, Ge = (e) => Y(K, e), q = (e, t) => {
|
|
341
|
+
const n = He(e);
|
|
342
|
+
return Y(n, t);
|
|
343
|
+
}, z = re(), Ke = async () => z().catch((e) => {
|
|
342
344
|
o("videoSendingBalancer: error", e);
|
|
343
|
-
}),
|
|
345
|
+
}), Ye = async (e) => (z.add(e), Ke()), L = async ({
|
|
344
346
|
sender: e,
|
|
345
347
|
scaleResolutionDownBy: t,
|
|
346
348
|
maxBitrate: n,
|
|
347
349
|
onSetParameters: r
|
|
348
|
-
}) =>
|
|
349
|
-
const s =
|
|
350
|
-
return
|
|
350
|
+
}) => Ye(async () => Q(e, { scaleResolutionDownBy: t, maxBitrate: n }, r)), qe = async ({ sender: e, codec: t }, n) => {
|
|
351
|
+
const s = Ge(t);
|
|
352
|
+
return L({
|
|
351
353
|
sender: e,
|
|
352
354
|
maxBitrate: s,
|
|
353
355
|
onSetParameters: n,
|
|
354
356
|
scaleResolutionDownBy: 200
|
|
355
357
|
});
|
|
356
|
-
},
|
|
357
|
-
const c = t.getSettings().width, i =
|
|
358
|
-
return
|
|
358
|
+
}, D = async ({ sender: e, track: t, codec: n }, r) => {
|
|
359
|
+
const c = t.getSettings().width, i = q(c, n);
|
|
360
|
+
return L({
|
|
359
361
|
sender: e,
|
|
360
362
|
maxBitrate: i,
|
|
361
363
|
onSetParameters: r,
|
|
362
364
|
scaleResolutionDownBy: 1
|
|
363
365
|
});
|
|
364
|
-
},
|
|
366
|
+
}, ze = async ({
|
|
365
367
|
sender: e,
|
|
366
368
|
track: t,
|
|
367
369
|
resolution: n,
|
|
368
370
|
codec: r
|
|
369
371
|
}, s) => {
|
|
370
|
-
const a = t.getSettings(), c = a.width, i = a.height, [l,
|
|
371
|
-
return
|
|
372
|
+
const a = t.getSettings(), c = a.width, i = a.height, [l, m] = n.split("x"), f = c / Number(l), d = i / Number(m), g = Math.max(f, d, 1), C = q(Number(l), r);
|
|
373
|
+
return L({
|
|
372
374
|
sender: e,
|
|
373
375
|
maxBitrate: C,
|
|
374
376
|
onSetParameters: s,
|
|
375
377
|
scaleResolutionDownBy: g
|
|
376
378
|
});
|
|
377
|
-
},
|
|
379
|
+
}, Je = async ({
|
|
378
380
|
mainCam: e,
|
|
379
381
|
resolutionMainCam: t,
|
|
380
382
|
sender: n,
|
|
@@ -382,19 +384,19 @@ const ce = (e = new Error()) => {
|
|
|
382
384
|
codec: s
|
|
383
385
|
}, a) => {
|
|
384
386
|
switch (e) {
|
|
385
|
-
case
|
|
386
|
-
return
|
|
387
|
-
case
|
|
388
|
-
return
|
|
389
|
-
case
|
|
390
|
-
return t !== void 0 ?
|
|
387
|
+
case I.PAUSE_MAIN_CAM:
|
|
388
|
+
return qe({ sender: n, codec: s }, a);
|
|
389
|
+
case I.RESUME_MAIN_CAM:
|
|
390
|
+
return D({ sender: n, track: r, codec: s }, a);
|
|
391
|
+
case I.MAX_MAIN_CAM_RESOLUTION:
|
|
392
|
+
return t !== void 0 ? ze(
|
|
391
393
|
{ sender: n, track: r, codec: s, resolution: t },
|
|
392
394
|
a
|
|
393
|
-
) :
|
|
395
|
+
) : D({ sender: n, track: r, codec: s }, a);
|
|
394
396
|
default:
|
|
395
|
-
return
|
|
397
|
+
return D({ sender: n, track: r, codec: s }, a);
|
|
396
398
|
}
|
|
397
|
-
},
|
|
399
|
+
}, V = {
|
|
398
400
|
isChanged: !1,
|
|
399
401
|
parameters: {
|
|
400
402
|
encodings: [{}],
|
|
@@ -403,22 +405,22 @@ const ce = (e = new Error()) => {
|
|
|
403
405
|
headerExtensions: [],
|
|
404
406
|
rtcp: {}
|
|
405
407
|
}
|
|
406
|
-
},
|
|
408
|
+
}, x = async ({
|
|
407
409
|
mainCam: e,
|
|
408
410
|
resolutionMainCam: t,
|
|
409
411
|
connection: n,
|
|
410
412
|
onSetParameters: r,
|
|
411
413
|
ignoreForCodec: s
|
|
412
414
|
}) => {
|
|
413
|
-
const a = n.getSenders(), c =
|
|
415
|
+
const a = n.getSenders(), c = Ve(a);
|
|
414
416
|
if (!(c != null && c.track))
|
|
415
|
-
return
|
|
416
|
-
const i = await
|
|
417
|
-
return G(i, s) ?
|
|
417
|
+
return V;
|
|
418
|
+
const i = await Le(c);
|
|
419
|
+
return G(i, s) ? V : Je(
|
|
418
420
|
{ mainCam: e, resolutionMainCam: t, sender: c, codec: i, track: c.track },
|
|
419
421
|
r
|
|
420
422
|
);
|
|
421
|
-
},
|
|
423
|
+
}, an = (e, {
|
|
422
424
|
ignoreForCodec: t,
|
|
423
425
|
onSetParameters: n
|
|
424
426
|
} = {}) => {
|
|
@@ -426,7 +428,7 @@ const ce = (e = new Error()) => {
|
|
|
426
428
|
const { connection: l } = e;
|
|
427
429
|
if (!l)
|
|
428
430
|
throw new Error("connection is not exist");
|
|
429
|
-
return
|
|
431
|
+
return x({
|
|
430
432
|
connection: l,
|
|
431
433
|
onSetParameters: n,
|
|
432
434
|
ignoreForCodec: t
|
|
@@ -434,13 +436,13 @@ const ce = (e = new Error()) => {
|
|
|
434
436
|
};
|
|
435
437
|
let s = r;
|
|
436
438
|
const a = async (l) => (s = async () => {
|
|
437
|
-
const { mainCam:
|
|
438
|
-
if (!
|
|
439
|
+
const { mainCam: m, resolutionMainCam: f } = l, { connection: d } = e;
|
|
440
|
+
if (!d)
|
|
439
441
|
throw new Error("connection is not exist");
|
|
440
|
-
return
|
|
441
|
-
mainCam:
|
|
442
|
+
return x({
|
|
443
|
+
mainCam: m,
|
|
442
444
|
resolutionMainCam: f,
|
|
443
|
-
connection:
|
|
445
|
+
connection: d,
|
|
444
446
|
onSetParameters: n,
|
|
445
447
|
ignoreForCodec: t
|
|
446
448
|
});
|
|
@@ -462,19 +464,20 @@ const ce = (e = new Error()) => {
|
|
|
462
464
|
};
|
|
463
465
|
};
|
|
464
466
|
export {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
467
|
+
I as EEventsMainCAM,
|
|
468
|
+
ln as EEventsMic,
|
|
469
|
+
Sn as EEventsSyncMediaState,
|
|
470
|
+
dn as EUseLicense,
|
|
471
|
+
mn as causes,
|
|
472
|
+
fn as constants,
|
|
473
|
+
Tn as debug,
|
|
474
|
+
Ze as default,
|
|
475
|
+
Cn as disableDebug,
|
|
476
|
+
gn as enableDebug,
|
|
477
|
+
Rn as eventNames,
|
|
478
|
+
Le as getCodecFromSender,
|
|
479
|
+
En as hasCanceledCallError,
|
|
480
|
+
an as resolveVideoSendingBalancer,
|
|
481
|
+
J as setParametersToSender,
|
|
482
|
+
on as tools
|
|
480
483
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TRtpSendParameters } from '../types';
|
|
2
|
+
declare const configureEncodings: (parametersCurrent: RTCRtpSendParameters, parametersTarget: TRtpSendParameters) => {
|
|
3
|
+
encodings: RTCRtpEncodingParameters[];
|
|
4
|
+
degradationPreference?: RTCDegradationPreference;
|
|
5
|
+
transactionId: string;
|
|
6
|
+
codecs: RTCRtpCodecParameters[];
|
|
7
|
+
headerExtensions: RTCRtpHeaderExtensionParameters[];
|
|
8
|
+
rtcp: RTCRtcpParameters;
|
|
9
|
+
};
|
|
10
|
+
export default configureEncodings;
|