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