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