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