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