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