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/index.js CHANGED
@@ -1,137 +1,141 @@
1
- import { l as o, B as V, N as x, E as B, s as q, S as Je } from "./SipConnector-DagL4rCl.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-DagL4rCl.js";
3
- import { debounce as z } from "ts-debounce";
4
- import { isCanceledError as J } from "@krivega/cancelable-promise";
5
- import { hasCanceledError as Q } from "repeated-calls";
6
- import { sequentPromises as Z } from "sequent-promises";
7
- import { createStackPromises as ee } from "stack-promises";
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 $ = "purgatory", A = (e) => e === $, w = (e) => () => (o("getRemoteStreams"), e.getRemoteStreams()), ne = ({ kind: e, readyState: t }) => e === "video" && t === "live", X = (e) => ({ track: t }) => {
10
- ne(t) && e();
11
- }, D = ({
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
- }) => z(() => {
14
+ }) => J(() => {
15
15
  const n = e();
16
16
  o("remoteStreams", n), n && t(n);
17
- }, 200), te = (e) => async (n) => {
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
- setRemoteStreams: u,
24
- onBeforeProgressCall: l,
25
- onSuccessProgressCall: d,
26
- onEnterPurgatory: f,
23
+ contentHint: i,
24
+ setRemoteStreams: l,
25
+ onBeforeProgressCall: d,
26
+ onSuccessProgressCall: f,
27
+ onEnterPurgatory: m,
27
28
  onEnterConference: S,
28
- onFailProgressCall: m,
29
- onFinishProgressCall: T,
30
- onEndedCall: C
31
- } = n, R = D({
32
- setRemoteStreams: u,
33
- getRemoteStreams: w(e)
34
- }), y = X(R);
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 b = async () => e.answerToIncomingCall({
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: y
42
- }), _ = () => {
43
- const { remoteCallerData: i } = e;
44
- return i.incomingNumber;
43
+ ontrack: b
44
+ }), p = () => {
45
+ const { remoteCallerData: u } = e;
46
+ return u.incomingNumber;
45
47
  };
46
- let E = !1, M;
47
- const h = (o("subscribeEnterConference: onEnterConference", S), f ?? S ? e.onSession("enterRoom", (i) => {
48
- o("enterRoom", { _room: i, isSuccessProgressCall: E }), M = i, A(M) ? f && f() : S && S({ isSuccessProgressCall: E });
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
- }), p = (i) => (o("onSuccess"), E = !0, R(), d && d({ isPurgatory: A(M) }), e.onceRaceSession(["ended", "failed"], () => {
51
- h(), C && C();
52
- }), i), O = (i) => {
53
- throw o("onFail"), m && m(), h(), i;
54
- }, v = () => {
55
- o("onFinish"), T && T();
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"), l) {
58
- const i = _();
59
- l(i);
59
+ if (o("onBeforeProgressCall"), d) {
60
+ const u = p();
61
+ d(u);
60
62
  }
61
- return b().then(p).catch((i) => O(i)).finally(v);
62
- }, re = (e) => async (n) => {
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: u,
69
- setRemoteStreams: l,
70
- onBeforeProgressCall: d,
71
- onSuccessProgressCall: f,
70
+ degradationPreference: i,
71
+ contentHint: l,
72
+ setRemoteStreams: d,
73
+ onBeforeProgressCall: f,
74
+ onSuccessProgressCall: m,
72
75
  onEnterPurgatory: S,
73
- onEnterConference: m,
74
- onFailProgressCall: T,
75
- onFinishProgressCall: C,
76
- onEndedCall: R
77
- } = n, y = D({
78
- setRemoteStreams: l,
79
- getRemoteStreams: w(e)
80
- }), b = X(y);
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 _ = async () => (o("startCall"), e.call({
85
+ const p = async () => (o("startCall"), e.call({
83
86
  mediaStream: s,
84
87
  extraHeaders: a,
85
88
  iceServers: c,
86
- degradationPreference: u,
89
+ degradationPreference: i,
90
+ contentHint: l,
87
91
  number: r,
88
- ontrack: b
92
+ ontrack: _
89
93
  }));
90
- let E = !1, M;
91
- const h = (o("subscribeEnterConference: onEnterConference", m), S ?? m ? e.onSession("enterRoom", ({ room: i }) => {
92
- o("enterRoom", { _room: i, isSuccessProgressCall: E }), M = i, A(M) ? S && S() : m && m({ isSuccessProgressCall: E });
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
- }), p = (i) => (o("onSuccess"), E = !0, y(), f && f({ isPurgatory: A(M) }), e.onceRaceSession(["ended", "failed"], () => {
95
- h(), R && R();
96
- }), i), O = (i) => {
97
- throw o("onFail"), T && T(), h(), i;
98
- }, v = () => {
99
- o("onFinish"), C && C();
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"), d && d(r), _().then(p).catch((i) => O(i)).finally(v);
102
- }, P = (e) => {
103
- if (!J(e) && !Q(e))
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
- }, se = (e) => async (n) => {
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: u,
116
+ displayName: i,
113
117
  name: l,
114
118
  password: d,
115
119
  isRegisteredUser: f,
116
- isDisconnectOnFail: S
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: u,
127
+ displayName: i,
124
128
  password: d,
125
129
  user: l,
126
130
  register: f
127
- }).then((m) => (o("connectToServer then"), { ua: m, isSuccessful: !0 })).catch(async (m) => (o("connectToServer catch: error", m), S === !0 ? e.disconnect().then(() => P(m)).catch(() => P(m)) : P(m)));
128
- }, oe = (e) => async () => (o("disconnectFromServer"), e.disconnect().then(() => (o("disconnectFromServer: then"), { isSuccessful: !0 })).catch((t) => (o("disconnectFromServer: catch", t), { isSuccessful: !1 }))), F = (e) => {
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 === V || n === x) && (r = `${e.message.to.uri.user}@${e.message.to.uri.host}`), r;
135
+ return (n === x || n === $) && (r = `${e.message.to.uri.user}@${e.message.to.uri.host}`), r;
132
136
  };
133
- var G = /* @__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))(G || {});
134
- const ae = (e = new Error()) => {
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 V: {
147
+ case x: {
144
148
  r = "BAD_MEDIA_ERROR";
145
149
  break;
146
150
  }
147
- case x: {
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" : F(e) && (r = "CONNECT_SERVER_FAILED_BY_LINK");
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
- }, ce = (e) => {
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
- }, ie = (e = new Error()) => {
164
- const { code: t, cause: n, message: r } = e, s = F(e), a = { code: "", cause: "", message: "" };
165
- return typeof r == "object" && r !== null ? a.message = ce(r) : r && (a.message = String(r)), s && (a.link = s), t && (a.code = t), n && (a.cause = n), a;
166
- }, ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
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: G,
169
- getLinkError: F,
170
- getTypeFromError: ae,
171
- getValuesFromError: ie
172
- }, Symbol.toStringTag, { value: "Module" })), le = ({
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 = [], u = n ? "0" : "1", l = r ? "0" : "1";
181
- return c.push(`X-Vinteo-Mic-State: ${u}`, `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;
182
- }, Se = "[@*!|]", me = "_", de = (e) => {
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(Se, "g"), me), t;
185
- }, fe = ({
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 = `${de(e)} ${t}`;
195
+ const a = `${fe(e)} ${t}`;
192
196
  return `ChromeNew - ${n ? `${n} ${r}, ${a}` : a}`;
193
- }, Ce = ({
197
+ }, ge = ({
194
198
  isUnifiedSdpSemantic: e,
195
199
  appVersion: t,
196
200
  browserName: n,
197
201
  browserVersion: r,
198
202
  appName: s
199
- }) => e ? fe({ appVersion: t, browserName: n, browserVersion: r, appName: s }) : "Chrome", ge = (e) => async () => {
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
- }, Re = (e) => (n) => (o("onMustStopPresentation"), e.onSession("mustStopPresentation", n)), Ee = (e) => (n) => (o("onMoveToSpectators"), e.onSession("participant:move-request-to-spectators", n)), Me = (e) => (n) => (o("onUseLicense"), e.onSession("useLicense", n)), Te = (e) => async ({
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
- }, ye = (e) => async () => {
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
- }, he = (e) => async () => {
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
- }, be = ({
219
- sipConnector: e,
220
- maxBitrate: t,
221
- degradationPreference: n
222
- }) => async ({
223
- mediaStream: s,
224
- isP2P: a
225
- }, c) => (o("startPresentation"), e.startPresentation(
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: a,
229
- maxBitrate: t,
230
- degradationPreference: n
231
+ isP2P: r,
232
+ maxBitrate: s,
233
+ degradationPreference: a,
234
+ contentHint: c
231
235
  },
232
- c
233
- )), _e = ({ sipConnector: e }) => async ({ isP2P: n = !1 } = {}) => (o("stopShareSipConnector"), e.stopPresentation({
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
- })), pe = 1e6, Oe = ({
238
- sipConnector: e,
239
- maxBitrate: t = pe
240
- }) => async ({
241
- mediaStream: r,
242
- isP2P: s = !1
243
- }) => (o("updatePresentation"), e.updatePresentation(r, {
244
- isP2P: s,
245
- maxBitrate: t
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 Z(s, n);
253
- }, Ne = (e) => (n) => (o("onStartMainCam"), e.onSession("admin-start-main-cam", n)), Be = (e) => (n) => (o("onStartMic"), e.onSession("admin-start-mic", n)), Pe = (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 }) => {
254
- const t = (C, R) => ({ isSyncForced: y = !1 }) => {
255
- if (y) {
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
- R();
260
- }, n = Ne(e), r = Pe(e), s = Be(e), a = Ie(e);
265
+ E();
266
+ }, n = Ne(e), r = Be(e), s = Pe(e), a = Ie(e);
261
267
  let c = () => {
262
- }, u = () => {
268
+ }, i = () => {
263
269
  }, l = () => {
264
270
  }, d = () => {
265
271
  };
266
272
  const f = ({
267
273
  onStartMainCamForced: C,
268
- onStartMainCamNotForced: R,
269
- onStopMainCamForced: y,
274
+ onStartMainCamNotForced: E,
275
+ onStopMainCamForced: M,
270
276
  onStopMainCamNotForced: b,
271
277
  onStartMicForced: _,
272
- onStartMicNotForced: E,
273
- onStopMicForced: M,
274
- onStopMicNotForced: N
278
+ onStartMicNotForced: p,
279
+ onStopMicForced: T,
280
+ onStopMicNotForced: y
275
281
  }) => {
276
- const h = t(
282
+ const N = t(
277
283
  C,
278
- R
284
+ E
279
285
  );
280
- c = n(h);
281
- const p = t(
282
- y,
286
+ c = n(N);
287
+ const h = t(
288
+ M,
283
289
  b
284
290
  );
285
- u = r(p);
286
- const O = t(_, E);
291
+ i = r(h);
292
+ const O = t(_, p);
287
293
  l = s(O);
288
- const v = t(M, N);
294
+ const v = t(T, y);
289
295
  d = a(v);
290
- }, S = () => {
291
- c(), u(), l(), d();
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
- S();
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: ue,
306
- getExtraHeaders: le,
307
- getUserAgent: Ce,
311
+ error: le,
312
+ getExtraHeaders: Se,
313
+ getUserAgent: ge,
308
314
  hasPurgatory: A,
309
- resolveAnswerIncomingCall: te,
310
- resolveAskPermissionToEnableCam: ge,
311
- resolveCallToServer: re,
312
- resolveConnectToServer: se,
313
- resolveDisconnectFromServer: oe,
314
- resolveGetRemoteStreams: w,
315
- resolveOnMoveToSpectators: Ee,
316
- resolveOnMustStopPresentation: Re,
317
- resolveOnUseLicense: Me,
318
- resolveSendMediaState: Te,
319
- resolveSendRefusalToTurnOnCam: ye,
320
- resolveSendRefusalToTurnOnMic: he,
321
- resolveStartPresentation: be,
322
- resolveStopShareSipConnector: _e,
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: D,
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
- }), W = (e, t) => e !== void 0 && t !== void 0 && e.toLowerCase().includes(t.toLowerCase()), Le = 1e6, g = (e) => e * Le, K = g(0.06), Ve = g(4), xe = (e) => e <= 64 ? K : e <= 128 ? g(0.12) : e <= 256 ? g(0.25) : e <= 384 ? g(0.32) : e <= 426 ? g(0.38) : e <= 640 ? g(0.5) : e <= 848 ? g(0.7) : e <= 1280 ? g(1) : e <= 1920 ? g(2) : Ve, $e = "av1", Xe = (e) => W(e, $e), Ge = 0.6, j = (e, t) => Xe(t) ? e * Ge : e, We = (e) => j(K, e), H = (e, t) => {
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
- }, Y = ee(), Ke = async () => Y().catch((e) => {
341
+ }, q = ne(), Ge = async () => q().catch((e) => {
336
342
  o("videoSendingBalancer: error", e);
337
- }), je = async (e) => (Y.add(e), Ke()), k = async ({
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
- }) => je(async () => q(e, { scaleResolutionDownBy: t, maxBitrate: n }, r)), He = async ({ sender: e, codec: t }, n) => {
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 k({
350
+ return U({
345
351
  sender: e,
346
352
  maxBitrate: s,
347
353
  onSetParameters: n,
348
354
  scaleResolutionDownBy: 200
349
355
  });
350
- }, I = async ({ sender: e, track: t, codec: n }, r) => {
351
- const c = t.getSettings().width, u = H(c, n);
352
- return k({
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: u,
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, u = a.height, [l, d] = n.split("x"), f = c / Number(l), S = u / Number(d), T = Math.max(f, S, 1), C = H(Number(l), r);
365
- return k({
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: T
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 He({ sender: n, codec: s }, a);
386
+ return je({ sender: n, codec: s }, a);
381
387
  case B.RESUME_MAIN_CAM:
382
- return I({ sender: n, track: r, codec: s }, a);
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
- ) : I({ sender: n, track: r, codec: s }, a);
393
+ ) : w({ sender: n, track: r, codec: s }, a);
388
394
  default:
389
- return I({ sender: n, track: r, codec: s }, a);
395
+ return w({ sender: n, track: r, codec: s }, a);
390
396
  }
391
- }, U = {
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
- }, L = async ({
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 U;
410
- const u = await ke(c);
411
- return W(u, s) ? U : qe(
412
- { mainCam: e, resolutionMainCam: t, sender: c, codec: u, track: c.track },
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 L({
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: S } = e;
432
- if (!S)
437
+ const { mainCam: d, resolutionMainCam: f } = l, { connection: m } = e;
438
+ if (!m)
433
439
  throw new Error("connection is not exist");
434
- return L({
440
+ return V({
435
441
  mainCam: d,
436
442
  resolutionMainCam: f,
437
- connection: S,
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_: {