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