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