sip-connector 28.10.9 → 28.11.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.
@@ -67,7 +67,7 @@ export declare const createAutoConnectorMachine: (deps: TAutoConnectorMachineDep
67
67
  type: "TELEPHONY.RESULT";
68
68
  outcome: "stillConnected";
69
69
  }, {
70
- [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<void, import('..').TParametersAutoConnect | undefined, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<void, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | undefined;
70
+ [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<void, import('xstate').NonReducibleUnknown, import('xstate').EventObject> | import('xstate').PromiseActorLogic<void, import('..').TParametersAutoConnect | undefined, import('xstate').EventObject>> | undefined;
71
71
  }, {
72
72
  src: "connect";
73
73
  logic: import('xstate').PromiseActorLogic<void, import('..').TParametersAutoConnect | undefined, import('xstate').EventObject>;
@@ -101,7 +101,7 @@ export declare const createCallReconnectMachine: (deps: TCallReconnectMachineDep
101
101
  } | {
102
102
  type: "CONN.DISCONNECTED";
103
103
  }, {
104
- [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<void, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<void, number, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<void, import('..').TCallRedialParameters | undefined, import('xstate').EventObject>> | undefined;
104
+ [x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<void, import('xstate').NonReducibleUnknown, import('xstate').EventObject> | import('xstate').PromiseActorLogic<void, number, import('xstate').EventObject> | import('xstate').PromiseActorLogic<void, import('..').TCallRedialParameters | undefined, import('xstate').EventObject>> | undefined;
105
105
  }, {
106
106
  src: "delayBeforeAttempt";
107
107
  logic: import('xstate').PromiseActorLogic<void, number, import('xstate').EventObject>;
@@ -91,7 +91,10 @@ declare class SipConnector extends EventEmitterProxy<TEventMap> {
91
91
  getRecvQuality: CallManager['getRecvQuality'];
92
92
  setRecvQuality: CallManager['setRecvQuality'];
93
93
  applyQuality: CallManager['applyQuality'];
94
- replaceMediaStream: CallManager['replaceMediaStream'];
94
+ replaceMediaStream: (mediaStream: Parameters<CallManager["replaceMediaStream"]>[0], options?: Parameters<CallManager["replaceMediaStream"]>[1] & {
95
+ waitForOutboundVideoPackets?: boolean;
96
+ waitForOutboundVideoPacketsTimeout?: number;
97
+ }) => Promise<void>;
95
98
  startPresentation(mediaStream: MediaStream, options?: {
96
99
  isNeedReinvite?: boolean;
97
100
  contentHint?: TContentHint;
@@ -6711,7 +6711,7 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
6711
6711
  if (t === void 0) throw Error("failed to collect statistics: peerConnection is not defined");
6712
6712
  return this.requesterAllStatistics.request(t);
6713
6713
  };
6714
- }, Ec = g("StatsManager"), Dc = class extends e {
6714
+ }, Ec = 5e3, Dc = g("StatsManager"), Oc = class extends e {
6715
6715
  statsPeerConnection;
6716
6716
  availableStats;
6717
6717
  previousAvailableStats;
@@ -6783,10 +6783,35 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
6783
6783
  let e = this.packetsReceived !== void 0 && this.packetsReceived >= 500, t = this.packetsReceived !== this.previousPacketsReceived;
6784
6784
  return e && t;
6785
6785
  }
6786
+ get outboundVideoMediaSourceTrackIdentifier() {
6787
+ return this.availableStats?.outbound.video.mediaSource?.trackIdentifier;
6788
+ }
6789
+ get outboundVideoPacketsSent() {
6790
+ return this.availableStats?.outbound.video.outboundRtp?.packetsSent;
6791
+ }
6792
+ get previousOutboundVideoPacketsSent() {
6793
+ return this.previousAvailableStats?.outbound.video.outboundRtp?.packetsSent;
6794
+ }
6795
+ async waitForOutboundVideoPackets(e, { timeout: t = Ec } = {}) {
6796
+ if (!this.isSendingOutboundVideoPacketsWithTrack(e)) return new Promise((n, r) => {
6797
+ let i, a, o = () => {
6798
+ clearTimeout(i), a();
6799
+ };
6800
+ i = setTimeout(() => {
6801
+ o(), r(/* @__PURE__ */ Error(`Timed out waiting for outbound-rtp packets with video track ${e}`));
6802
+ }, t), a = this.on("collected", () => {
6803
+ this.isSendingOutboundVideoPacketsWithTrack(e) && (o(), n());
6804
+ });
6805
+ });
6806
+ }
6786
6807
  hasAvailableIncomingBitrateChangedQuarter() {
6787
6808
  let e = this.previousAvailableIncomingBitrate, t = this.availableIncomingBitrate;
6788
6809
  return e === void 0 || t === void 0 ? !1 : e === 0 ? t > 0 : Math.abs(t - e) / e >= .25;
6789
6810
  }
6811
+ isSendingOutboundVideoPacketsWithTrack(e) {
6812
+ let t = this.outboundVideoMediaSourceTrackIdentifier === e, n = this.outboundVideoPacketsSent, r = this.previousOutboundVideoPacketsSent;
6813
+ return !t || n === void 0 || r === void 0 ? !1 : n > 0 && n !== r;
6814
+ }
6790
6815
  subscribe() {
6791
6816
  this.callManager.on("peerconnection:confirmed", this.start), this.callManager.on("recv-session-started", this.handleRecvSessionStarted), this.callManager.on("recv-session-ended", this.handleRecvSessionEnded), this.callManager.on("recv-quality-changed", this.handleRecvQualityChanged), this.callManager.on("failed", this.handleEnded), this.callManager.on("ended", this.handleEnded), this.statsPeerConnection.on("collected", this.handleStatsCollected);
6792
6817
  }
@@ -6816,37 +6841,37 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
6816
6841
  };
6817
6842
  maybeSendStats() {
6818
6843
  this.availableIncomingBitrate !== void 0 && this.hasAvailableIncomingBitrateChangedQuarter() && this.apiManager.sendStats({ availableIncomingBitrate: this.availableIncomingBitrate }).catch((e) => {
6819
- Ec("Failed to send stats", e);
6844
+ Dc("Failed to send stats", e);
6820
6845
  });
6821
6846
  }
6822
- }, Oc = g("setCodecPreferences"), kc = (e, t) => e.filter((e) => t.some((t) => t.clockRate === e.clockRate && t.mimeType === e.mimeType && t.channels === e.channels && t.sdpFmtpLine === e.sdpFmtpLine)), Ac = (e) => {
6847
+ }, kc = g("setCodecPreferences"), Ac = (e, t) => e.filter((e) => t.some((t) => t.clockRate === e.clockRate && t.mimeType === e.mimeType && t.channels === e.channels && t.sdpFmtpLine === e.sdpFmtpLine)), jc = (e) => {
6823
6848
  let t = RTCRtpSender.getCapabilities(e), n = RTCRtpReceiver.getCapabilities(e);
6824
- return kc(t === null ? [] : t.codecs, n === null ? [] : n.codecs);
6825
- }, jc = (e, t) => t === void 0 || t.length === 0 ? e : e.sort((e, n) => {
6849
+ return Ac(t === null ? [] : t.codecs, n === null ? [] : n.codecs);
6850
+ }, Mc = (e, t) => t === void 0 || t.length === 0 ? e : e.sort((e, n) => {
6826
6851
  let r = t.indexOf(e.mimeType), i = t.indexOf(n.mimeType);
6827
6852
  return (r === -1 ? Number.MAX_VALUE : r) - (i === -1 ? Number.MAX_VALUE : i);
6828
- }), Mc = (e, t) => t === void 0 || t.length === 0 ? e : e.filter((e) => !t.includes(e.mimeType)), Nc = (e, { preferredMimeTypesVideoCodecs: t, excludeMimeTypesVideoCodecs: n }) => {
6853
+ }), Nc = (e, t) => t === void 0 || t.length === 0 ? e : e.filter((e) => !t.includes(e.mimeType)), Pc = (e, { preferredMimeTypesVideoCodecs: t, excludeMimeTypesVideoCodecs: n }) => {
6829
6854
  try {
6830
6855
  if (typeof e.setCodecPreferences == "function" && e.sender.track?.kind === "video" && (t !== void 0 && t.length > 0 || n !== void 0 && n.length > 0)) {
6831
- let r = jc(Mc(Ac("video"), n), t);
6856
+ let r = Mc(Nc(jc("video"), n), t);
6832
6857
  e.setCodecPreferences(r);
6833
6858
  }
6834
6859
  } catch (e) {
6835
- Oc("setCodecPreferences error", e);
6860
+ kc("setCodecPreferences error", e);
6836
6861
  }
6837
- }, Pc = [
6862
+ }, Fc = (e) => e.getVideoTracks()[0], Ic = [
6838
6863
  "balancing-scheduled",
6839
6864
  "balancing-started",
6840
6865
  "balancing-stopped",
6841
6866
  "parameters-updated"
6842
- ], Fc = () => new n(Pc), Ic = g("VideoSendingBalancerManager"), Lc = class extends e {
6867
+ ], Lc = () => new n(Ic), Rc = g("VideoSendingBalancerManager"), zc = class extends e {
6843
6868
  isBalancingActive = !1;
6844
6869
  callManager;
6845
6870
  balancingStartDelay;
6846
6871
  videoSendingBalancer;
6847
6872
  startBalancingTimer;
6848
6873
  constructor(e, t, n = {}) {
6849
- super(Fc()), this.callManager = e, this.balancingStartDelay = n.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new Vo(t, () => e.connection, {
6874
+ super(Lc()), this.callManager = e, this.balancingStartDelay = n.balancingStartDelay ?? 1e4, this.videoSendingBalancer = new Vo(t, () => e.connection, {
6850
6875
  ...n,
6851
6876
  onSetParameters: (e) => {
6852
6877
  this.events.trigger("parameters-updated", e), n.onSetParameters?.(e);
@@ -6886,27 +6911,27 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
6886
6911
  scheduleBalancingStart() {
6887
6912
  this.clearStartTimer(), this.startBalancingTimer = setTimeout(() => {
6888
6913
  this.startBalancingTimer = void 0, this.startBalancing().catch((e) => {
6889
- Ic("startBalancing: error", e);
6914
+ Rc("startBalancing: error", e);
6890
6915
  });
6891
6916
  }, this.balancingStartDelay), this.events.trigger("balancing-scheduled", { delay: this.balancingStartDelay });
6892
6917
  }
6893
6918
  clearStartTimer() {
6894
6919
  this.startBalancingTimer &&= (clearTimeout(this.startBalancingTimer), void 0);
6895
6920
  }
6896
- }, Rc = "health-snapshot", zc = "inbound-video-problem-detected", Bc = "inbound-video-problem-resolved", Vc = "inbound-video-problem-reset", Hc = [
6897
- Rc,
6898
- zc,
6921
+ }, Bc = "health-snapshot", Vc = "inbound-video-problem-detected", Hc = "inbound-video-problem-resolved", Uc = "inbound-video-problem-reset", Wc = [
6899
6922
  Bc,
6900
- Vc
6901
- ], Uc = () => new n(Hc), Wc = 3, Gc = class t extends e {
6923
+ Vc,
6924
+ Hc,
6925
+ Uc
6926
+ ], Gc = () => new n(Wc), Kc = 3, qc = class t extends e {
6902
6927
  statsManager;
6903
6928
  callManager;
6904
6929
  minConsecutiveProblemSamplesCount;
6905
6930
  consecutiveProblemSamplesCount = 0;
6906
6931
  currentProblemReason;
6907
6932
  hasEmittedCurrentProblem = !1;
6908
- constructor(e, n, r = Wc) {
6909
- super(Uc()), this.statsManager = e, this.callManager = n, t.assertValidMinConsecutiveProblemSamplesCount(r), this.minConsecutiveProblemSamplesCount = r, this.subscribe();
6933
+ constructor(e, n, r = Kc) {
6934
+ super(Gc()), this.statsManager = e, this.callManager = n, t.assertValidMinConsecutiveProblemSamplesCount(r), this.minConsecutiveProblemSamplesCount = r, this.subscribe();
6910
6935
  }
6911
6936
  get mainVideoTrack() {
6912
6937
  return this.callManager.getMainRemoteStream()?.getVideoTracks()[0];
@@ -6945,13 +6970,13 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
6945
6970
  }
6946
6971
  handleStatsCollected = () => {
6947
6972
  let { healthSnapshot: e } = this;
6948
- this.events.trigger(Rc, e);
6973
+ this.events.trigger(Bc, e);
6949
6974
  let n = t.resolveProblemReason(e);
6950
6975
  if (n === void 0) {
6951
6976
  this.maybeEmitResolvedProblem(e), this.resetProblemDetectionState();
6952
6977
  return;
6953
6978
  }
6954
- this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(zc, {
6979
+ this.updateProblemDetectionState(n), this.consecutiveProblemSamplesCount >= this.minConsecutiveProblemSamplesCount && !this.hasEmittedCurrentProblem && (this.events.trigger(Vc, {
6955
6980
  ...e,
6956
6981
  consecutiveProblemSamplesCount: this.consecutiveProblemSamplesCount,
6957
6982
  reason: n
@@ -6968,7 +6993,7 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
6968
6993
  this.currentProblemReason = e, this.consecutiveProblemSamplesCount = 1, this.hasEmittedCurrentProblem = !1;
6969
6994
  };
6970
6995
  maybeEmitResolvedProblem = (e) => {
6971
- !this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(Bc, {
6996
+ !this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(Hc, {
6972
6997
  ...e,
6973
6998
  reason: this.currentProblemReason
6974
6999
  });
@@ -6977,7 +7002,7 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
6977
7002
  this.maybeEmitResetProblem(e), this.resetProblemDetectionState();
6978
7003
  };
6979
7004
  maybeEmitResetProblem = (e) => {
6980
- !this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(Vc, {
7005
+ !this.hasEmittedCurrentProblem || this.currentProblemReason === void 0 || this.events.trigger(Uc, {
6981
7006
  reason: this.currentProblemReason,
6982
7007
  resetCause: e
6983
7008
  });
@@ -6985,11 +7010,11 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
6985
7010
  resetProblemDetectionState = () => {
6986
7011
  this.currentProblemReason = void 0, this.consecutiveProblemSamplesCount = 0, this.hasEmittedCurrentProblem = !1;
6987
7012
  };
6988
- }, Kc = g("MainStreamRecovery"), qc = 4e3, Jc = class e {
7013
+ }, Jc = g("MainStreamRecovery"), Yc = 4e3, Xc = class e {
6989
7014
  renegotiateRequester;
6990
7015
  renegotiateThrottled;
6991
7016
  callManager;
6992
- constructor(e, t = qc) {
7017
+ constructor(e, t = Yc) {
6993
7018
  this.callManager = e, this.renegotiateRequester = new c(e.renegotiate.bind(e)), this.renegotiateThrottled = this.createRenegotiateThrottled(t), this.subscribe();
6994
7019
  }
6995
7020
  static assertValidThrottleRecoveryTimeout(e) {
@@ -6999,17 +7024,17 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
6999
7024
  e.assertValidThrottleRecoveryTimeout(t), this.renegotiateThrottled.cancel(), this.renegotiateThrottled = this.createRenegotiateThrottled(t);
7000
7025
  }
7001
7026
  recover() {
7002
- Kc("trying to recover main stream"), this.renegotiateThrottled();
7027
+ Jc("trying to recover main stream"), this.renegotiateThrottled();
7003
7028
  }
7004
7029
  requestRenegotiate = () => {
7005
- if (Kc("trying to renegotiate"), this.renegotiateRequester.requested) {
7006
- Kc("previous renegotiate is not finished yet");
7030
+ if (Jc("trying to renegotiate"), this.renegotiateRequester.requested) {
7031
+ Jc("previous renegotiate is not finished yet");
7007
7032
  return;
7008
7033
  }
7009
7034
  this.renegotiateRequester.request().then(() => {
7010
- Kc("renegotiate has successful");
7035
+ Jc("renegotiate has successful");
7011
7036
  }).catch((e) => {
7012
- Kc("failed to renegotiate main media stream", e);
7037
+ Jc("failed to renegotiate main media stream", e);
7013
7038
  });
7014
7039
  };
7015
7040
  createRenegotiateThrottled(t) {
@@ -7021,31 +7046,29 @@ var uo = g("CallManager: CallStateMachine"), fo = class extends O {
7021
7046
  });
7022
7047
  }
7023
7048
  cancel() {
7024
- Kc("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
7049
+ Jc("cancel recover main stream"), this.renegotiateThrottled.cancel(), this.renegotiateRequester.cancelRequest();
7025
7050
  }
7026
- }, Yc = /* @__PURE__ */ function(e) {
7051
+ }, Zc = /* @__PURE__ */ function(e) {
7027
7052
  return e.VP8 = "video/VP8", e.VP9 = "video/VP9", e.H264 = "video/H264", e.AV1 = "video/AV1", e.rtx = "video/rtx", e.red = "video/red", e.flexfec03 = "video/flexfec-03", e;
7028
- }({}), Xc = {
7053
+ }({}), Qc = {
7029
7054
  major: 25,
7030
7055
  minor: 8,
7031
7056
  patch: 0
7032
- }, Zc = ({ isYandexBrowser: e, hasGreaterThanBrowserVersion: t }) => {
7033
- let n = t(Xc);
7057
+ }, $c = ({ isYandexBrowser: e, hasGreaterThanBrowserVersion: t }) => {
7058
+ let n = t(Qc);
7034
7059
  return e && n;
7035
- }, Qc = () => {
7036
- if (Zc(Ki())) return [Yc.VP8];
7037
- }, $c = () => {
7060
+ }, el = () => {
7061
+ if ($c(Ki())) return [Zc.VP8];
7062
+ }, tl = () => {
7038
7063
  let { isMobileDevice: e, isSafari: t, isOpera: n, isWindows: r } = Ki();
7039
7064
  return e || t || n && r;
7040
- }, el;
7041
- $c() && (el = "h264");
7042
- var tl = { ignoreForCodec: el }, nl = Qc(), rl = 1e6, il = en.map((e) => `auto-connect:${e}`), al = Bn.map((e) => `call-reconnect:${e}`), ol = xt.map((e) => `connection:${e}`), sl = vi.map((e) => `call:${e}`), cl = Ie.map((e) => `api:${e}`), ll = Bs.map((e) => `incoming-call:${e}`), ul = xs.map((e) => `presentation:${e}`), dl = uc.map((e) => `stats:${e}`), fl = Pc.map((e) => `video-balancer:${e}`), pl = Hc.map((e) => `main-stream-health:${e}`), ml = Qs.map((e) => `session:${e}`), hl = [
7065
+ }, nl;
7066
+ tl() && (nl = "h264");
7067
+ var rl = { ignoreForCodec: nl }, il = el(), al = 1e6, ol = en.map((e) => `auto-connect:${e}`), sl = Bn.map((e) => `call-reconnect:${e}`), cl = xt.map((e) => `connection:${e}`), ll = vi.map((e) => `call:${e}`), ul = Ie.map((e) => `api:${e}`), dl = Bs.map((e) => `incoming-call:${e}`), fl = xs.map((e) => `presentation:${e}`), pl = uc.map((e) => `stats:${e}`), ml = Ic.map((e) => `video-balancer:${e}`), hl = Wc.map((e) => `main-stream-health:${e}`), gl = Qs.map((e) => `session:${e}`), _l = [
7043
7068
  "disconnected-from-out-of-call",
7044
7069
  "connected-with-configuration-from-out-of-call",
7045
7070
  "stopped-presentation-by-server-command"
7046
- ], gl = [
7047
- ...il,
7048
- ...al,
7071
+ ], vl = [
7049
7072
  ...ol,
7050
7073
  ...sl,
7051
7074
  ...cl,
@@ -7055,8 +7078,10 @@ var tl = { ignoreForCodec: el }, nl = Qc(), rl = 1e6, il = en.map((e) => `auto-c
7055
7078
  ...fl,
7056
7079
  ...pl,
7057
7080
  ...ml,
7058
- ...hl
7059
- ], _l = () => new n(gl), vl = g("SipConnector"), yl = class extends e {
7081
+ ...hl,
7082
+ ...gl,
7083
+ ..._l
7084
+ ], yl = () => new n(vl), bl = g("SipConnector"), xl = class extends e {
7060
7085
  connectionManager;
7061
7086
  connectionQueueManager;
7062
7087
  contentedStreamManager;
@@ -7076,10 +7101,10 @@ var tl = { ignoreForCodec: el }, nl = Qc(), rl = 1e6, il = en.map((e) => `auto-c
7076
7101
  preferredMimeTypesVideoCodecs;
7077
7102
  excludeMimeTypesVideoCodecs;
7078
7103
  constructor({ JsSIP: e }, { preferredMimeTypesVideoCodecs: t, excludeMimeTypesVideoCodecs: n, videoBalancerOptions: r, autoConnectorOptions: i, callReconnectOptions: a, numberOfConnectionAttempts: o, minConsecutiveProblemSamplesCount: s, throttleRecoveryTimeout: c } = {}) {
7079
- super(_l()), this.preferredMimeTypesVideoCodecs = t ?? nl, this.excludeMimeTypesVideoCodecs = n, this.apiManager = new Ue(), this.connectionManager = new Pt({ JsSIP: e }, { numberOfConnectionAttempts: o }), this.connectionQueueManager = new Ft({ connectionManager: this.connectionManager }), this.contentedStreamManager = new zs(), this.callSessionState = new Bi(), this.callManager = new vs({ contentedStreamManager: this.contentedStreamManager }, { sendOffer: this.sendOffer }, { callSessionState: this.callSessionState }), this.incomingCallManager = new Xs(this.connectionManager), this.presentationManager = new Ns({
7104
+ super(yl()), this.preferredMimeTypesVideoCodecs = t ?? il, this.excludeMimeTypesVideoCodecs = n, this.apiManager = new Ue(), this.connectionManager = new Pt({ JsSIP: e }, { numberOfConnectionAttempts: o }), this.connectionQueueManager = new Ft({ connectionManager: this.connectionManager }), this.contentedStreamManager = new zs(), this.callSessionState = new Bi(), this.callManager = new vs({ contentedStreamManager: this.contentedStreamManager }, { sendOffer: this.sendOffer }, { callSessionState: this.callSessionState }), this.incomingCallManager = new Xs(this.connectionManager), this.presentationManager = new Ns({
7080
7105
  callManager: this.callManager,
7081
- maxBitrate: rl
7082
- }), this.statsManager = new Dc({
7106
+ maxBitrate: al
7107
+ }), this.statsManager = new Oc({
7083
7108
  callManager: this.callManager,
7084
7109
  apiManager: this.apiManager
7085
7110
  }), this.autoConnectorManager = new pn({
@@ -7089,7 +7114,7 @@ var tl = { ignoreForCodec: el }, nl = Qc(), rl = 1e6, il = en.map((e) => `auto-c
7089
7114
  }, i), this.callReconnectManager = new Un({
7090
7115
  callManager: this.callManager,
7091
7116
  connectionManager: this.connectionManager
7092
- }, a), this.videoSendingBalancerManager = new Lc(this.callManager, this.apiManager, r ?? tl), this.mainStreamHealthMonitor = new Gc(this.statsManager, this.callManager, s), this.mainStreamRecovery = new Jc(this.callManager, c), this.sessionManager = new rc({
7117
+ }, a), this.videoSendingBalancerManager = new zc(this.callManager, this.apiManager, r ?? rl), this.mainStreamHealthMonitor = new qc(this.statsManager, this.callManager, s), this.mainStreamRecovery = new Xc(this.callManager, c), this.sessionManager = new rc({
7093
7118
  connectionManager: this.connectionManager,
7094
7119
  callManager: this.callManager,
7095
7120
  incomingCallManager: this.incomingCallManager,
@@ -7199,7 +7224,13 @@ var tl = { ignoreForCodec: el }, nl = Qc(), rl = 1e6, il = en.map((e) => `auto-c
7199
7224
  getRecvQuality = () => this.callManager.getRecvQuality();
7200
7225
  setRecvQuality = async (e) => this.callManager.setRecvQuality(e);
7201
7226
  applyQuality = async (e) => this.callManager.applyQuality(e);
7202
- replaceMediaStream = async (...e) => this.callManager.replaceMediaStream(...e);
7227
+ replaceMediaStream = async (e, t) => {
7228
+ let { waitForOutboundVideoPackets: n, waitForOutboundVideoPacketsTimeout: r, ...i } = t ?? {};
7229
+ if (await this.callManager.replaceMediaStream(e, i), n !== !0) return;
7230
+ let a = Fc(e);
7231
+ if (a === void 0) throw Error("waitForOutboundVideoPackets requires a video track in mediaStream");
7232
+ await this.statsManager.waitForOutboundVideoPackets(a.id, { timeout: r });
7233
+ };
7203
7234
  async startPresentation(e, t = {}) {
7204
7235
  let { callLimit: n, onAddedTransceiver: r, ...i } = t;
7205
7236
  return this.presentationManager.startPresentation(async () => {
@@ -7283,7 +7314,7 @@ var tl = { ignoreForCodec: el }, nl = Qc(), rl = 1e6, il = en.map((e) => `auto-c
7283
7314
  t.body = e instanceof Error ? e.message : String(e);
7284
7315
  let n = h.causes.INTERNAL_ERROR;
7285
7316
  this.callManager.failed(t, n).catch((e) => {
7286
- vl("Failed to end call after failed:", e);
7317
+ bl("Failed to end call after failed:", e);
7287
7318
  });
7288
7319
  });
7289
7320
  }
@@ -7300,7 +7331,7 @@ var tl = { ignoreForCodec: el }, nl = Qc(), rl = 1e6, il = en.map((e) => `auto-c
7300
7331
  });
7301
7332
  };
7302
7333
  setCodecPreferences(e) {
7303
- Nc(e, {
7334
+ Pc(e, {
7304
7335
  preferredMimeTypesVideoCodecs: this.preferredMimeTypesVideoCodecs,
7305
7336
  excludeMimeTypesVideoCodecs: this.excludeMimeTypesVideoCodecs
7306
7337
  });
@@ -7310,7 +7341,7 @@ var tl = { ignoreForCodec: el }, nl = Qc(), rl = 1e6, il = en.map((e) => `auto-c
7310
7341
  }
7311
7342
  subscribeToMainStreamHealthMonitorEvents() {
7312
7343
  this.mainStreamHealthMonitor.on("inbound-video-problem-detected", ({ reason: e }) => {
7313
- vl("detected inbound video problem", { reason: e }), this.mainStreamRecovery.recover();
7344
+ bl("detected inbound video problem", { reason: e }), this.mainStreamRecovery.recover();
7314
7345
  });
7315
7346
  }
7316
7347
  bridgeEvents = (e, t) => {
@@ -7325,4 +7356,4 @@ var tl = { ignoreForCodec: el }, nl = Qc(), rl = 1e6, il = en.map((e) => `auto-c
7325
7356
  };
7326
7357
  };
7327
7358
  //#endregion
7328
- export { Ai as A, F as B, da as C, Di as D, z as E, oi as F, A as G, St as H, Bn as I, ye as J, lt as K, Rn as L, xi as M, Ci as N, ji as O, yi as P, R, Wa as S, Ei as T, vt as U, ne as V, M as W, g as X, ve as Y, bs as _, $ as a, po as b, rc as c, Y as d, Vs as f, K as g, J as h, fc as i, Oi as j, ki as k, Ks as l, Os as m, Yc as n, cc as o, Ms as p, je as q, Tc as r, Q as s, yl as t, Z as u, W as v, Bi as w, V as x, go as y, Ut as z };
7359
+ export { Ai as A, F as B, da as C, Di as D, z as E, oi as F, A as G, St as H, Bn as I, ye as J, lt as K, Rn as L, xi as M, Ci as N, ji as O, yi as P, R, Wa as S, Ei as T, vt as U, ne as V, M as W, g as X, ve as Y, bs as _, $ as a, po as b, rc as c, Y as d, Vs as f, K as g, J as h, fc as i, Oi as j, ki as k, Ks as l, Os as m, Zc as n, cc as o, Ms as p, je as q, Tc as r, Q as s, xl as t, Z as u, W as v, Bi as w, V as x, go as y, Ut as z };