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