sip-connector 6.22.1 → 6.22.3
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/doMock.cjs +1 -1
- package/dist/doMock.js +326 -289
- package/dist/index.cjs +1 -1
- package/dist/index.js +333 -237
- package/package.json +5 -8
package/dist/index.js
CHANGED
|
@@ -1,132 +1,131 @@
|
|
|
1
|
-
import { l as
|
|
2
|
-
import { f as
|
|
3
|
-
import { debounce as
|
|
4
|
-
import { isCanceledError as
|
|
5
|
-
import
|
|
6
|
-
import { default as fn } from "debug";
|
|
1
|
+
import { l as c, B as V, N as $, E as P, s as q, S as nn } from "./SipConnector-Hg44qtgr.js";
|
|
2
|
+
import { f as ln, g as Sn, i as dn, c as mn, a as fn, d as Cn, b as En, e as gn, h as Rn } from "./SipConnector-Hg44qtgr.js";
|
|
3
|
+
import { debounce as J } from "ts-debounce";
|
|
4
|
+
import { isCanceledError as Q } from "@krivega/cancelable-promise";
|
|
5
|
+
import { default as yn } from "debug";
|
|
7
6
|
import "events-constructor";
|
|
8
|
-
const
|
|
7
|
+
const G = "purgatory", A = (e) => e === G, k = (e) => () => (c("getRemoteStreams"), e.getRemoteStreams()), Z = ({ kind: e, readyState: n }) => e === "video" && n === "live", j = (e) => ({ track: n }) => {
|
|
9
8
|
Z(n) && e();
|
|
10
9
|
}, D = ({
|
|
11
10
|
getRemoteStreams: e,
|
|
12
11
|
setRemoteStreams: n
|
|
13
|
-
}) =>
|
|
12
|
+
}) => J(() => {
|
|
14
13
|
const t = e();
|
|
15
|
-
|
|
14
|
+
c("remoteStreams", t), t && n(t);
|
|
16
15
|
}, 200), ee = (e) => async (t) => {
|
|
17
16
|
const {
|
|
18
17
|
mediaStream: s,
|
|
19
18
|
extraHeaders: r,
|
|
20
|
-
iceServers:
|
|
21
|
-
degradationPreference:
|
|
22
|
-
setRemoteStreams:
|
|
23
|
-
onBeforeProgressCall:
|
|
24
|
-
onSuccessProgressCall:
|
|
25
|
-
onEnterPurgatory:
|
|
26
|
-
onEnterConference:
|
|
27
|
-
onFailProgressCall:
|
|
28
|
-
onFinishProgressCall:
|
|
29
|
-
onEndedCall:
|
|
19
|
+
iceServers: o,
|
|
20
|
+
degradationPreference: a,
|
|
21
|
+
setRemoteStreams: u,
|
|
22
|
+
onBeforeProgressCall: m,
|
|
23
|
+
onSuccessProgressCall: E,
|
|
24
|
+
onEnterPurgatory: C,
|
|
25
|
+
onEnterConference: f,
|
|
26
|
+
onFailProgressCall: T,
|
|
27
|
+
onFinishProgressCall: h,
|
|
28
|
+
onEndedCall: y
|
|
30
29
|
} = t, g = D({
|
|
31
|
-
setRemoteStreams:
|
|
32
|
-
getRemoteStreams:
|
|
33
|
-
}),
|
|
34
|
-
|
|
35
|
-
const
|
|
30
|
+
setRemoteStreams: u,
|
|
31
|
+
getRemoteStreams: k(e)
|
|
32
|
+
}), M = j(g);
|
|
33
|
+
c("answerIncomingCall", t);
|
|
34
|
+
const v = async () => e.answerToIncomingCall({
|
|
36
35
|
mediaStream: s,
|
|
37
36
|
extraHeaders: r,
|
|
38
|
-
iceServers:
|
|
39
|
-
degradationPreference:
|
|
40
|
-
ontrack:
|
|
41
|
-
}),
|
|
42
|
-
const { remoteCallerData:
|
|
43
|
-
return
|
|
37
|
+
iceServers: o,
|
|
38
|
+
degradationPreference: a,
|
|
39
|
+
ontrack: M
|
|
40
|
+
}), p = () => {
|
|
41
|
+
const { remoteCallerData: d } = e;
|
|
42
|
+
return d.incomingNumber;
|
|
44
43
|
};
|
|
45
|
-
let
|
|
46
|
-
const
|
|
47
|
-
|
|
44
|
+
let _ = !1, i;
|
|
45
|
+
const l = (c("subscribeEnterConference: onEnterConference", f), C ?? f ? e.onSession("enterRoom", (d) => {
|
|
46
|
+
c("enterRoom", { _room: d, isSuccessProgressCall: _ }), i = d, A(i) ? C && C() : f && f({ isSuccessProgressCall: _ });
|
|
48
47
|
}) : () => {
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
}),
|
|
52
|
-
throw
|
|
53
|
-
},
|
|
54
|
-
|
|
48
|
+
}), R = (d) => (c("onSuccess"), _ = !0, g(), E && E({ isPurgatory: A(i) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
49
|
+
l(), y && y();
|
|
50
|
+
}), d), b = (d) => {
|
|
51
|
+
throw c("onFail"), T && T(), l(), d;
|
|
52
|
+
}, O = () => {
|
|
53
|
+
c("onFinish"), h && h();
|
|
55
54
|
};
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
|
|
55
|
+
if (c("onBeforeProgressCall"), m) {
|
|
56
|
+
const d = p();
|
|
57
|
+
m(d);
|
|
59
58
|
}
|
|
60
|
-
return
|
|
59
|
+
return v().then(R).catch(b).finally(O);
|
|
61
60
|
}, ne = (e) => async (t) => {
|
|
62
61
|
const {
|
|
63
62
|
conference: s,
|
|
64
63
|
mediaStream: r,
|
|
65
|
-
extraHeaders:
|
|
66
|
-
iceServers:
|
|
67
|
-
degradationPreference:
|
|
68
|
-
setRemoteStreams:
|
|
69
|
-
onBeforeProgressCall:
|
|
70
|
-
onSuccessProgressCall:
|
|
71
|
-
onEnterPurgatory:
|
|
72
|
-
onEnterConference:
|
|
73
|
-
onFailProgressCall:
|
|
74
|
-
onFinishProgressCall:
|
|
64
|
+
extraHeaders: o,
|
|
65
|
+
iceServers: a,
|
|
66
|
+
degradationPreference: u,
|
|
67
|
+
setRemoteStreams: m,
|
|
68
|
+
onBeforeProgressCall: E,
|
|
69
|
+
onSuccessProgressCall: C,
|
|
70
|
+
onEnterPurgatory: f,
|
|
71
|
+
onEnterConference: T,
|
|
72
|
+
onFailProgressCall: h,
|
|
73
|
+
onFinishProgressCall: y,
|
|
75
74
|
onEndedCall: g
|
|
76
|
-
} = t,
|
|
77
|
-
setRemoteStreams:
|
|
78
|
-
getRemoteStreams:
|
|
79
|
-
}),
|
|
80
|
-
|
|
81
|
-
const
|
|
75
|
+
} = t, M = D({
|
|
76
|
+
setRemoteStreams: m,
|
|
77
|
+
getRemoteStreams: k(e)
|
|
78
|
+
}), v = j(M);
|
|
79
|
+
c("callToServer", t);
|
|
80
|
+
const p = async () => (c("startCall"), e.call({
|
|
82
81
|
mediaStream: r,
|
|
83
|
-
extraHeaders:
|
|
84
|
-
iceServers:
|
|
85
|
-
degradationPreference:
|
|
82
|
+
extraHeaders: o,
|
|
83
|
+
iceServers: a,
|
|
84
|
+
degradationPreference: u,
|
|
86
85
|
number: s,
|
|
87
|
-
ontrack:
|
|
86
|
+
ontrack: v
|
|
88
87
|
}));
|
|
89
|
-
let
|
|
90
|
-
const
|
|
91
|
-
|
|
88
|
+
let _ = !1, i;
|
|
89
|
+
const l = (c("subscribeEnterConference: onEnterConference", T), f ?? T ? e.onSession("enterRoom", (d) => {
|
|
90
|
+
c("enterRoom", { _room: d, isSuccessProgressCall: _ }), i = d, A(i) ? f && f() : T && T({ isSuccessProgressCall: _ });
|
|
92
91
|
}) : () => {
|
|
93
|
-
}),
|
|
94
|
-
|
|
95
|
-
}),
|
|
96
|
-
throw
|
|
97
|
-
},
|
|
98
|
-
|
|
92
|
+
}), R = (d) => (c("onSuccess"), _ = !0, M(), C && C({ isPurgatory: A(i) }), e.onceRaceSession(["ended", "failed"], () => {
|
|
93
|
+
l(), g && g();
|
|
94
|
+
}), d), b = (d) => {
|
|
95
|
+
throw c("onFail"), h && h(), l(), d;
|
|
96
|
+
}, O = () => {
|
|
97
|
+
c("onFinish"), y && y();
|
|
99
98
|
};
|
|
100
|
-
return
|
|
101
|
-
},
|
|
102
|
-
if (!
|
|
99
|
+
return c("onBeforeProgressCall"), E && E(s), p().then(R).catch(b).finally(O);
|
|
100
|
+
}, w = (e) => {
|
|
101
|
+
if (!Q(e))
|
|
103
102
|
throw e;
|
|
104
103
|
return !1;
|
|
105
104
|
}, te = (e) => async (t) => {
|
|
106
105
|
const {
|
|
107
106
|
userAgent: s,
|
|
108
107
|
sipWebSocketServerURL: r,
|
|
109
|
-
sipServerUrl:
|
|
110
|
-
remoteAddress:
|
|
111
|
-
displayName:
|
|
112
|
-
name:
|
|
113
|
-
password:
|
|
114
|
-
isRegisteredUser:
|
|
115
|
-
sdpSemantics:
|
|
116
|
-
isDisconnectOnFail:
|
|
108
|
+
sipServerUrl: o,
|
|
109
|
+
remoteAddress: a,
|
|
110
|
+
displayName: u,
|
|
111
|
+
name: m,
|
|
112
|
+
password: E,
|
|
113
|
+
isRegisteredUser: C,
|
|
114
|
+
sdpSemantics: f,
|
|
115
|
+
isDisconnectOnFail: T
|
|
117
116
|
} = t;
|
|
118
|
-
return
|
|
117
|
+
return c("connectToServer", t), e.connect({
|
|
119
118
|
userAgent: s,
|
|
120
|
-
sdpSemantics:
|
|
119
|
+
sdpSemantics: f,
|
|
121
120
|
sipWebSocketServerURL: r,
|
|
122
|
-
sipServerUrl:
|
|
123
|
-
remoteAddress:
|
|
124
|
-
displayName:
|
|
125
|
-
password:
|
|
126
|
-
user:
|
|
127
|
-
register:
|
|
128
|
-
}).then(() => (
|
|
129
|
-
}, se = (e) => async () => (
|
|
121
|
+
sipServerUrl: o,
|
|
122
|
+
remoteAddress: a,
|
|
123
|
+
displayName: u,
|
|
124
|
+
password: E,
|
|
125
|
+
user: m,
|
|
126
|
+
register: C
|
|
127
|
+
}).then(() => (c("connectToServer then"), !0)).catch(async (h) => (c("connectToServer catch: error", h), T === !0 ? e.disconnect().then(() => w(h)).catch(() => w(h)) : w(h)));
|
|
128
|
+
}, se = (e) => async () => (c("disconnectFromServer"), e.disconnect().then(() => (c("disconnectFromServer: then"), !1)).catch((n) => (c("disconnectFromServer: catch", n), !1))), F = (e) => {
|
|
130
129
|
const { url: n, cause: t } = e;
|
|
131
130
|
let s = n;
|
|
132
131
|
return (t === V || t === $) && (s = `${e.message.to.uri.user}@${e.message.to.uri.host}`), s;
|
|
@@ -154,24 +153,24 @@ const re = (e = new Error()) => {
|
|
|
154
153
|
}
|
|
155
154
|
return s;
|
|
156
155
|
}, oe = (e = new Error()) => {
|
|
157
|
-
const { code: n, cause: t, message: s } = e, r = F(e),
|
|
158
|
-
return s && (
|
|
159
|
-
},
|
|
156
|
+
const { code: n, cause: t, message: s } = e, r = F(e), o = {};
|
|
157
|
+
return s && (o.message = s), r && (o.link = r), n && (o.code = n), t && (o.cause = t), o;
|
|
158
|
+
}, ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
160
159
|
__proto__: null,
|
|
161
160
|
EErrorTypes: X,
|
|
162
161
|
getLinkError: F,
|
|
163
162
|
getTypeFromError: re,
|
|
164
163
|
getValuesFromError: oe
|
|
165
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
164
|
+
}, Symbol.toStringTag, { value: "Module" })), ae = ({
|
|
166
165
|
sessionId: e,
|
|
167
166
|
remoteAddress: n,
|
|
168
167
|
isMutedAudio: t,
|
|
169
168
|
isMutedVideo: s,
|
|
170
169
|
isRegistered: r,
|
|
171
|
-
isPresentationCall:
|
|
170
|
+
isPresentationCall: o
|
|
172
171
|
}) => {
|
|
173
|
-
const
|
|
174
|
-
return
|
|
172
|
+
const a = [], u = t ? "0" : "1", m = s ? "0" : "1";
|
|
173
|
+
return a.push(`X-Vinteo-Mic-State: ${u}`, `X-Vinteo-MainCam-State: ${m}`), r || a.push("X-Vinteo-Purgatory-Call: yes"), e && a.push(`X-Vinteo-Session: ${e}`), o && a.push("X-Vinteo-Presentation-Call: yes"), n && a.push(`X-Vinteo-Remote: ${n}`), a;
|
|
175
174
|
}, ie = ({
|
|
176
175
|
appName: e,
|
|
177
176
|
appVersion: n,
|
|
@@ -188,57 +187,57 @@ const re = (e = new Error()) => {
|
|
|
188
187
|
appName: r
|
|
189
188
|
}) => e ? ie({ appVersion: n, browserName: t, browserVersion: s, appName: r }) : "Chrome", le = (e) => async () => {
|
|
190
189
|
if (e.isCallActive)
|
|
191
|
-
return
|
|
192
|
-
}, Se = (e) => (t) => (
|
|
190
|
+
return c("askPermissionToEnableCam"), e.askPermissionToEnableCam();
|
|
191
|
+
}, Se = (e) => (t) => (c("onMustStopPresentation"), e.onSession("mustStopPresentation", t)), de = (e) => (t) => (c("onUseLicense"), e.onSession("useLicense", t)), me = (e) => async ({
|
|
193
192
|
isEnabledCam: t,
|
|
194
193
|
isEnabledMic: s
|
|
195
194
|
}) => {
|
|
196
195
|
if (e.isCallActive)
|
|
197
|
-
return
|
|
196
|
+
return c("sendMediaState"), e.sendMediaState({ cam: t, mic: s });
|
|
198
197
|
}, fe = (e) => async () => {
|
|
199
198
|
if (e.isCallActive)
|
|
200
|
-
return
|
|
201
|
-
|
|
199
|
+
return c("sendRefusalToTurnOnCam"), e.sendRefusalToTurnOnCam().catch((t) => {
|
|
200
|
+
c("sendRefusalToTurnOnCam: error", t);
|
|
202
201
|
});
|
|
203
202
|
}, Ce = (e) => async () => {
|
|
204
203
|
if (e.isCallActive)
|
|
205
|
-
return
|
|
206
|
-
|
|
204
|
+
return c("sendRefusalToTurnOnMic"), e.sendRefusalToTurnOnMic().catch((t) => {
|
|
205
|
+
c("sendRefusalToTurnOnMic: error", t);
|
|
207
206
|
});
|
|
208
|
-
},
|
|
209
|
-
maxBitrate: e =
|
|
207
|
+
}, Ee = 1e6, ge = ({
|
|
208
|
+
maxBitrate: e = Ee,
|
|
210
209
|
sipConnector: n
|
|
211
210
|
}) => async ({
|
|
212
211
|
mediaStream: s,
|
|
213
212
|
isP2P: r = !1
|
|
214
|
-
}) => (
|
|
213
|
+
}) => (c("startPresentation"), n.startPresentation(s, {
|
|
215
214
|
isP2P: r,
|
|
216
215
|
maxBitrate: e
|
|
217
|
-
})),
|
|
216
|
+
})), Re = ({ sipConnector: e }) => async ({ isP2P: t = !1 } = {}) => (c("stopShareSipConnector"), e.stopPresentation({
|
|
218
217
|
isP2P: t
|
|
219
|
-
}).catch(
|
|
218
|
+
}).catch(c)), he = 1e6, ye = ({
|
|
220
219
|
sipConnector: e,
|
|
221
|
-
maxBitrate: n =
|
|
220
|
+
maxBitrate: n = he
|
|
222
221
|
}) => async ({
|
|
223
222
|
mediaStream: s,
|
|
224
223
|
isP2P: r = !1
|
|
225
|
-
}) => (
|
|
224
|
+
}) => (c("updatePresentation"), e.updatePresentation(s, {
|
|
226
225
|
isP2P: r,
|
|
227
226
|
maxBitrate: n
|
|
228
|
-
})),
|
|
227
|
+
})), Te = "ERROR_NOT_RUNNING", Me = (e) => {
|
|
229
228
|
const n = new Error("Promise was not running");
|
|
230
|
-
return n.basePromise = e, n.id =
|
|
231
|
-
},
|
|
232
|
-
async (t, s) => t.then(async ({ success: r, errors:
|
|
233
|
-
errors:
|
|
234
|
-
success: [...r,
|
|
235
|
-
results: [...
|
|
229
|
+
return n.basePromise = e, n.id = Te, n.name = "Not running", n;
|
|
230
|
+
}, _e = async (e, n) => e.reduce(
|
|
231
|
+
async (t, s) => t.then(async ({ success: r, errors: o, results: a }) => (!n || n(s) ? s() : Promise.reject(Me(s))).then((u) => ({
|
|
232
|
+
errors: o,
|
|
233
|
+
success: [...r, u],
|
|
234
|
+
results: [...a, u],
|
|
236
235
|
isSuccessful: !0,
|
|
237
236
|
isError: !1
|
|
238
|
-
})).catch((
|
|
237
|
+
})).catch((u) => ({
|
|
239
238
|
success: r,
|
|
240
|
-
errors: [...
|
|
241
|
-
results: [...
|
|
239
|
+
errors: [...o, u],
|
|
240
|
+
results: [...a, u],
|
|
242
241
|
isSuccessful: !1,
|
|
243
242
|
isError: !0
|
|
244
243
|
}))),
|
|
@@ -249,67 +248,67 @@ const re = (e = new Error()) => {
|
|
|
249
248
|
isSuccessful: !1,
|
|
250
249
|
isError: !1
|
|
251
250
|
})
|
|
252
|
-
), be = (e) => (n) => [...n].map((s) => async () => e(s)),
|
|
251
|
+
), be = (e) => (n) => [...n].map((s) => async () => e(s)), Ne = async ({
|
|
253
252
|
accumulatedKeys: e,
|
|
254
253
|
sendKey: n,
|
|
255
254
|
canRunTask: t
|
|
256
255
|
}) => {
|
|
257
256
|
const r = be(n)(e);
|
|
258
|
-
return
|
|
259
|
-
},
|
|
260
|
-
const n = (
|
|
261
|
-
if (
|
|
262
|
-
|
|
257
|
+
return _e(r, t);
|
|
258
|
+
}, Oe = (e) => (t) => (c("onStartMainCam"), e.onSession("admin-start-main-cam", t)), ve = (e) => (t) => (c("onStartMic"), e.onSession("admin-start-mic", t)), pe = (e) => (t) => (c("onStopMainCam"), e.onSession("admin-stop-main-cam", t)), Ae = (e) => (t) => (c("onStopMic"), e.onSession("admin-stop-mic", t)), Pe = ({ sipConnector: e }) => {
|
|
259
|
+
const n = (y, g) => ({ isSyncForced: M = !1 }) => {
|
|
260
|
+
if (M) {
|
|
261
|
+
y();
|
|
263
262
|
return;
|
|
264
263
|
}
|
|
265
264
|
g();
|
|
266
|
-
}, t =
|
|
267
|
-
let
|
|
268
|
-
}, i = () => {
|
|
265
|
+
}, t = Oe(e), s = pe(e), r = ve(e), o = Ae(e);
|
|
266
|
+
let a = () => {
|
|
269
267
|
}, u = () => {
|
|
270
268
|
}, m = () => {
|
|
269
|
+
}, E = () => {
|
|
271
270
|
};
|
|
272
|
-
const
|
|
273
|
-
onStartMainCamForced:
|
|
271
|
+
const C = ({
|
|
272
|
+
onStartMainCamForced: y,
|
|
274
273
|
onStartMainCamNotForced: g,
|
|
275
|
-
onStopMainCamForced:
|
|
276
|
-
onStopMainCamNotForced:
|
|
277
|
-
onStartMicForced:
|
|
278
|
-
onStartMicNotForced:
|
|
279
|
-
onStopMicForced:
|
|
280
|
-
onStopMicNotForced:
|
|
274
|
+
onStopMainCamForced: M,
|
|
275
|
+
onStopMainCamNotForced: v,
|
|
276
|
+
onStartMicForced: p,
|
|
277
|
+
onStartMicNotForced: _,
|
|
278
|
+
onStopMicForced: i,
|
|
279
|
+
onStopMicNotForced: S
|
|
281
280
|
}) => {
|
|
282
|
-
const
|
|
283
|
-
|
|
281
|
+
const l = n(
|
|
282
|
+
y,
|
|
284
283
|
g
|
|
285
284
|
);
|
|
286
|
-
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
285
|
+
a = t(l);
|
|
286
|
+
const R = n(
|
|
287
|
+
M,
|
|
288
|
+
v
|
|
290
289
|
);
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
},
|
|
297
|
-
|
|
290
|
+
u = s(R);
|
|
291
|
+
const b = n(p, _);
|
|
292
|
+
m = r(b);
|
|
293
|
+
const O = n(i, S);
|
|
294
|
+
E = o(O);
|
|
295
|
+
}, f = () => {
|
|
296
|
+
a(), u(), m(), E();
|
|
298
297
|
};
|
|
299
298
|
return {
|
|
300
|
-
start: (
|
|
301
|
-
|
|
299
|
+
start: (y) => {
|
|
300
|
+
C(y);
|
|
302
301
|
},
|
|
303
302
|
stop: () => {
|
|
304
|
-
|
|
303
|
+
f();
|
|
305
304
|
}
|
|
306
305
|
};
|
|
307
|
-
},
|
|
306
|
+
}, on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
308
307
|
__proto__: null,
|
|
309
|
-
PURGATORY_CONFERENCE_NUMBER:
|
|
310
|
-
createSyncMediaState:
|
|
311
|
-
error:
|
|
312
|
-
getExtraHeaders:
|
|
308
|
+
PURGATORY_CONFERENCE_NUMBER: G,
|
|
309
|
+
createSyncMediaState: Pe,
|
|
310
|
+
error: ce,
|
|
311
|
+
getExtraHeaders: ae,
|
|
313
312
|
getUserAgent: ue,
|
|
314
313
|
hasPurgatory: A,
|
|
315
314
|
resolveAnswerIncomingCall: ee,
|
|
@@ -317,83 +316,180 @@ const re = (e = new Error()) => {
|
|
|
317
316
|
resolveCallToServer: ne,
|
|
318
317
|
resolveConnectToServer: te,
|
|
319
318
|
resolveDisconnectFromServer: se,
|
|
320
|
-
resolveGetRemoteStreams:
|
|
319
|
+
resolveGetRemoteStreams: k,
|
|
321
320
|
resolveOnMustStopPresentation: Se,
|
|
322
|
-
resolveOnUseLicense:
|
|
323
|
-
resolveSendMediaState:
|
|
321
|
+
resolveOnUseLicense: de,
|
|
322
|
+
resolveSendMediaState: me,
|
|
324
323
|
resolveSendRefusalToTurnOnCam: fe,
|
|
325
324
|
resolveSendRefusalToTurnOnMic: Ce,
|
|
326
|
-
resolveStartPresentation:
|
|
327
|
-
resolveStopShareSipConnector:
|
|
328
|
-
resolveUpdatePresentation:
|
|
325
|
+
resolveStartPresentation: ge,
|
|
326
|
+
resolveStopShareSipConnector: Re,
|
|
327
|
+
resolveUpdatePresentation: ye,
|
|
329
328
|
resolveUpdateRemoteStreams: D,
|
|
330
|
-
sendDTMFAccumulated:
|
|
331
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
329
|
+
sendDTMFAccumulated: Ne
|
|
330
|
+
}, Symbol.toStringTag, { value: "Module" })), we = (e) => [...e.keys()].map((n) => e.get(n)), Ie = (e, n) => we(e).find((t) => t.type === n), Be = async (e) => e.getStats().then((n) => {
|
|
332
331
|
const t = Ie(n, "codec");
|
|
333
332
|
return t == null ? void 0 : t.mimeType;
|
|
334
|
-
}),
|
|
333
|
+
}), ke = (e) => e.find((n) => {
|
|
335
334
|
var t;
|
|
336
335
|
return ((t = n == null ? void 0 : n.track) == null ? void 0 : t.kind) === "video";
|
|
337
|
-
}), K = (e, n) => e !== void 0 && n !== void 0 && e.toLowerCase().includes(n.toLowerCase()),
|
|
338
|
-
const
|
|
339
|
-
return
|
|
340
|
-
},
|
|
341
|
-
|
|
342
|
-
|
|
336
|
+
}), K = (e, n) => e !== void 0 && n !== void 0 && e.toLowerCase().includes(n.toLowerCase()), De = "ERROR_NOT_RUNNING", Fe = (e) => {
|
|
337
|
+
const n = new Error("Promise was not running");
|
|
338
|
+
return n.basePromise = e, n.id = De, n.name = "Not running", n;
|
|
339
|
+
}, Ue = async (e, n) => e.reduce(
|
|
340
|
+
async (t, s) => t.then(async ({ success: r, errors: o, results: a }) => (!n || n(s) ? s() : Promise.reject(Fe(s))).then((u) => ({
|
|
341
|
+
errors: o,
|
|
342
|
+
success: [...r, u],
|
|
343
|
+
results: [...a, u],
|
|
344
|
+
isSuccessful: !0,
|
|
345
|
+
isError: !1
|
|
346
|
+
})).catch((u) => ({
|
|
347
|
+
success: r,
|
|
348
|
+
errors: [...o, u],
|
|
349
|
+
results: [...a, u],
|
|
350
|
+
isSuccessful: !1,
|
|
351
|
+
isError: !0
|
|
352
|
+
}))),
|
|
353
|
+
Promise.resolve({
|
|
354
|
+
success: [],
|
|
355
|
+
errors: [],
|
|
356
|
+
results: [],
|
|
357
|
+
isSuccessful: !1,
|
|
358
|
+
isError: !1
|
|
359
|
+
})
|
|
360
|
+
), Le = new Error("Stack is empty"), I = (e) => e[e.length - 1], xe = new Error("Promise is not actual"), Ve = new Error(
|
|
361
|
+
"stackPromises only works with functions that returns a Promise"
|
|
362
|
+
), $e = ({
|
|
363
|
+
noRejectIsNotActual: e = !1,
|
|
364
|
+
noRunIsNotActual: n = !1
|
|
365
|
+
} = {}) => {
|
|
366
|
+
const t = [], s = [], r = ({ task: i, index: S }) => {
|
|
367
|
+
s.push({ task: i, index: S });
|
|
368
|
+
}, o = (i, { task: S, index: l }) => {
|
|
369
|
+
const R = s.find(({ task: b, index: O }) => S === b && l === O);
|
|
370
|
+
if (!R)
|
|
371
|
+
throw new Error("Task not found");
|
|
372
|
+
if (R.promise)
|
|
373
|
+
throw new Error("Task is already running");
|
|
374
|
+
R.promise = i;
|
|
375
|
+
}, a = ({
|
|
376
|
+
task: i,
|
|
377
|
+
index: S
|
|
378
|
+
}) => {
|
|
379
|
+
const l = s.find(({ task: R, index: b }) => i === R && S === b);
|
|
380
|
+
if (l)
|
|
381
|
+
return l.promise;
|
|
382
|
+
}, u = ({ task: i }) => {
|
|
383
|
+
const S = I(s);
|
|
384
|
+
return (S == null ? void 0 : S.task) === i;
|
|
385
|
+
}, m = ({ task: i, index: S }) => (r({ task: i, index: S }), async () => {
|
|
386
|
+
let l = a({ task: i, index: S });
|
|
387
|
+
const R = u({ task: i });
|
|
388
|
+
return !l && n && !R ? Promise.resolve() : (l || (l = i({ isActual: R }), o(l, { task: i, index: S })), l);
|
|
389
|
+
}), E = ({
|
|
390
|
+
resolve: i,
|
|
391
|
+
reject: S
|
|
392
|
+
}) => ({ results: l, isSuccessful: R }) => {
|
|
393
|
+
const b = l.length, O = t.length;
|
|
394
|
+
if (b === O) {
|
|
395
|
+
const d = I(l);
|
|
396
|
+
if (R) {
|
|
397
|
+
i(d);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
S(d);
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
if (e) {
|
|
404
|
+
const d = I(l);
|
|
405
|
+
i(d);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
S(xe);
|
|
409
|
+
};
|
|
410
|
+
let C = !1;
|
|
411
|
+
const f = () => {
|
|
412
|
+
C = !0;
|
|
413
|
+
}, T = () => {
|
|
414
|
+
C = !1;
|
|
415
|
+
}, h = () => C, y = async () => (f(), Ue(t, h)), g = async () => {
|
|
416
|
+
if (t.length === 0)
|
|
417
|
+
throw Le;
|
|
418
|
+
return new Promise((i, S) => {
|
|
419
|
+
const l = E({ resolve: i, reject: S });
|
|
420
|
+
y().then(l).catch(l);
|
|
421
|
+
});
|
|
422
|
+
}, M = (i) => {
|
|
423
|
+
if (typeof i != "function")
|
|
424
|
+
throw Ve;
|
|
425
|
+
const S = t.length;
|
|
426
|
+
return t.push(m({ task: i, index: S })), g;
|
|
427
|
+
}, v = async (i) => (M(i), g()), p = () => {
|
|
428
|
+
t.length = 0, s.length = 0;
|
|
429
|
+
}, _ = () => {
|
|
430
|
+
T(), p();
|
|
431
|
+
};
|
|
432
|
+
return g.add = M, g.run = v, g.stop = _, g;
|
|
433
|
+
}, Ge = 1e6, N = (e) => e * Ge, W = N(0.06), je = N(4), Xe = (e) => e <= 64 ? W : e <= 128 ? N(0.12) : e <= 256 ? N(0.25) : e <= 384 ? N(0.32) : e <= 426 ? N(0.38) : e <= 640 ? N(0.5) : e <= 848 ? N(0.7) : e <= 1280 ? N(1) : e <= 1920 ? N(2) : je, Ke = "av1", We = (e) => K(e, Ke), He = 0.6, H = (e, n) => We(n) ? e * He : e, Ye = (e) => H(W, e), Y = (e, n) => {
|
|
434
|
+
const t = Xe(e);
|
|
435
|
+
return H(t, n);
|
|
436
|
+
}, z = $e(), ze = async () => z().catch((e) => {
|
|
437
|
+
c("videoSendingBalancer: error", e);
|
|
438
|
+
}), qe = async (e) => (z.add(e), ze()), U = async ({
|
|
343
439
|
sender: e,
|
|
344
440
|
scaleResolutionDownBy: n,
|
|
345
441
|
maxBitrate: t,
|
|
346
442
|
onSetParameters: s
|
|
347
|
-
}) =>
|
|
348
|
-
const r =
|
|
349
|
-
return
|
|
443
|
+
}) => qe(async () => q(e, { scaleResolutionDownBy: n, maxBitrate: t }, s)), Je = async ({ sender: e, codec: n }, t) => {
|
|
444
|
+
const r = Ye(n);
|
|
445
|
+
return U({
|
|
350
446
|
sender: e,
|
|
351
447
|
maxBitrate: r,
|
|
352
448
|
onSetParameters: t,
|
|
353
449
|
scaleResolutionDownBy: 200
|
|
354
450
|
});
|
|
355
|
-
},
|
|
356
|
-
const
|
|
357
|
-
return
|
|
451
|
+
}, B = async ({ sender: e, track: n, codec: t }, s) => {
|
|
452
|
+
const a = n.getSettings().width, u = Y(a, t);
|
|
453
|
+
return U({
|
|
358
454
|
sender: e,
|
|
359
|
-
maxBitrate:
|
|
455
|
+
maxBitrate: u,
|
|
360
456
|
onSetParameters: s,
|
|
361
457
|
scaleResolutionDownBy: 1
|
|
362
458
|
});
|
|
363
|
-
},
|
|
459
|
+
}, Qe = async ({
|
|
364
460
|
sender: e,
|
|
365
461
|
track: n,
|
|
366
462
|
resolution: t,
|
|
367
463
|
codec: s
|
|
368
464
|
}, r) => {
|
|
369
|
-
const
|
|
370
|
-
return
|
|
465
|
+
const o = n.getSettings(), a = o.width, u = o.height, [m, E] = t.split("x"), C = a / Number(m), f = u / Number(E), h = Math.max(C, f, 1), y = Y(Number(m), s);
|
|
466
|
+
return U({
|
|
371
467
|
sender: e,
|
|
372
|
-
maxBitrate:
|
|
468
|
+
maxBitrate: y,
|
|
373
469
|
onSetParameters: r,
|
|
374
|
-
scaleResolutionDownBy:
|
|
470
|
+
scaleResolutionDownBy: h
|
|
375
471
|
});
|
|
376
|
-
},
|
|
472
|
+
}, Ze = async ({
|
|
377
473
|
mainCam: e,
|
|
378
474
|
resolutionMainCam: n,
|
|
379
475
|
sender: t,
|
|
380
476
|
track: s,
|
|
381
477
|
codec: r
|
|
382
|
-
},
|
|
478
|
+
}, o) => {
|
|
383
479
|
switch (e) {
|
|
384
|
-
case
|
|
385
|
-
return
|
|
386
|
-
case
|
|
387
|
-
return
|
|
388
|
-
case
|
|
389
|
-
return n !== void 0 ?
|
|
480
|
+
case P.PAUSE_MAIN_CAM:
|
|
481
|
+
return Je({ sender: t, codec: r }, o);
|
|
482
|
+
case P.RESUME_MAIN_CAM:
|
|
483
|
+
return B({ sender: t, track: s, codec: r }, o);
|
|
484
|
+
case P.MAX_MAIN_CAM_RESOLUTION:
|
|
485
|
+
return n !== void 0 ? Qe(
|
|
390
486
|
{ sender: t, track: s, codec: r, resolution: n },
|
|
391
|
-
|
|
392
|
-
) :
|
|
487
|
+
o
|
|
488
|
+
) : B({ sender: t, track: s, codec: r }, o);
|
|
393
489
|
default:
|
|
394
|
-
return
|
|
490
|
+
return B({ sender: t, track: s, codec: r }, o);
|
|
395
491
|
}
|
|
396
|
-
},
|
|
492
|
+
}, L = {
|
|
397
493
|
isChanged: !1,
|
|
398
494
|
parameters: {
|
|
399
495
|
encodings: [{}],
|
|
@@ -402,54 +498,54 @@ const re = (e = new Error()) => {
|
|
|
402
498
|
headerExtensions: [],
|
|
403
499
|
rtcp: {}
|
|
404
500
|
}
|
|
405
|
-
},
|
|
501
|
+
}, x = async ({
|
|
406
502
|
mainCam: e,
|
|
407
503
|
resolutionMainCam: n,
|
|
408
504
|
connection: t,
|
|
409
505
|
onSetParameters: s,
|
|
410
506
|
ignoreForCodec: r
|
|
411
507
|
}) => {
|
|
412
|
-
const
|
|
413
|
-
if (!(
|
|
414
|
-
return
|
|
415
|
-
const
|
|
416
|
-
return K(
|
|
417
|
-
{ mainCam: e, resolutionMainCam: n, sender:
|
|
508
|
+
const o = t.getSenders(), a = ke(o);
|
|
509
|
+
if (!(a != null && a.track))
|
|
510
|
+
return L;
|
|
511
|
+
const u = await Be(a);
|
|
512
|
+
return K(u, r) ? L : Ze(
|
|
513
|
+
{ mainCam: e, resolutionMainCam: n, sender: a, codec: u, track: a.track },
|
|
418
514
|
s
|
|
419
515
|
);
|
|
420
|
-
},
|
|
516
|
+
}, cn = (e, {
|
|
421
517
|
ignoreForCodec: n,
|
|
422
518
|
onSetParameters: t
|
|
423
519
|
} = {}) => {
|
|
424
520
|
const s = async () => {
|
|
425
|
-
const { connection:
|
|
426
|
-
if (!
|
|
521
|
+
const { connection: m } = e;
|
|
522
|
+
if (!m)
|
|
427
523
|
throw new Error("connection is not exist");
|
|
428
|
-
return
|
|
429
|
-
connection:
|
|
524
|
+
return x({
|
|
525
|
+
connection: m,
|
|
430
526
|
onSetParameters: t,
|
|
431
527
|
ignoreForCodec: n
|
|
432
528
|
});
|
|
433
529
|
};
|
|
434
530
|
let r = s;
|
|
435
|
-
const
|
|
436
|
-
const { mainCam:
|
|
437
|
-
if (!
|
|
531
|
+
const o = async (m) => (r = async () => {
|
|
532
|
+
const { mainCam: E, resolutionMainCam: C } = m, { connection: f } = e;
|
|
533
|
+
if (!f)
|
|
438
534
|
throw new Error("connection is not exist");
|
|
439
|
-
return
|
|
440
|
-
mainCam:
|
|
441
|
-
resolutionMainCam:
|
|
442
|
-
connection:
|
|
535
|
+
return x({
|
|
536
|
+
mainCam: E,
|
|
537
|
+
resolutionMainCam: C,
|
|
538
|
+
connection: f,
|
|
443
539
|
onSetParameters: t,
|
|
444
540
|
ignoreForCodec: n
|
|
445
541
|
});
|
|
446
542
|
}, r());
|
|
447
543
|
return {
|
|
448
544
|
subscribe: () => {
|
|
449
|
-
e.onSession("main-cam-control",
|
|
545
|
+
e.onSession("main-cam-control", o);
|
|
450
546
|
},
|
|
451
547
|
unsubscribe: () => {
|
|
452
|
-
e.offSession("main-cam-control",
|
|
548
|
+
e.offSession("main-cam-control", o);
|
|
453
549
|
},
|
|
454
550
|
balanceByTrack: s,
|
|
455
551
|
resetMainCamControl() {
|
|
@@ -461,19 +557,19 @@ const re = (e = new Error()) => {
|
|
|
461
557
|
};
|
|
462
558
|
};
|
|
463
559
|
export {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
560
|
+
P as EEventsMainCAM,
|
|
561
|
+
ln as EEventsMic,
|
|
562
|
+
Sn as EEventsSyncMediaState,
|
|
563
|
+
dn as EUseLicense,
|
|
564
|
+
mn as causes,
|
|
565
|
+
fn as constants,
|
|
566
|
+
yn as debug,
|
|
567
|
+
nn as default,
|
|
568
|
+
Cn as disableDebug,
|
|
569
|
+
En as enableDebug,
|
|
570
|
+
gn as eventNames,
|
|
571
|
+
Be as getCodecFromSender,
|
|
572
|
+
Rn as hasCanceledCallError,
|
|
573
|
+
cn as resolveVideoSendingBalancer,
|
|
574
|
+
on as tools
|
|
479
575
|
};
|