@cloudflare/realtimekit 1.5.2-staging.8 → 1.5.2-staging.9

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.es.js CHANGED
@@ -23425,12 +23425,29 @@ class aD extends iD {
23425
23425
  * sending close messages would fail since the SFU doesn't know
23426
23426
  * about these producers anymore.
23427
23427
  *
23428
- * Fire-and-forget is safe: Producer.close(REASON_TRANSPORT_CLOSED)
23429
- * skips the async SDP renegotiation path (stopSending + safeEmitAsPromise)
23430
- * and only performs synchronous local cleanup.
23428
+ * Also deactivates the underlying RTCRtpTransceivers as a
23429
+ * best-effort cleanup to stop unnecessary RTP from flowing
23430
+ * to the SFU on the still-alive send transport.
23431
23431
  */
23432
23432
  closeAllProducersLocally() {
23433
- Array.from(a(this, Ir).values()).forEach((e) => e.close(mo));
23433
+ return u(this, null, function* () {
23434
+ var r;
23435
+ const e = (r = this.sendTransport) == null ? void 0 : r.handler;
23436
+ yield Promise.all(Array.from(a(this, Ir).values()).map((i) => u(this, null, function* () {
23437
+ try {
23438
+ if (e) {
23439
+ const n = e.midTransceiverMap.get(i.localId);
23440
+ n && (yield n.sender.replaceTrack(null), n.direction = "inactive");
23441
+ }
23442
+ } catch (n) {
23443
+ this.logger.warn("closeAllProducersLocally: failed to deactivate transceiver", {
23444
+ producer: { id: i.id, kind: i.kind, appData: i.appData },
23445
+ error: n
23446
+ });
23447
+ }
23448
+ yield i.close(mo);
23449
+ })));
23450
+ });
23434
23451
  }
23435
23452
  createConsumer(e) {
23436
23453
  return this.createConsumers([e]);
@@ -24466,7 +24483,7 @@ lc = new WeakMap(), uc = new WeakMap(), et = new WeakMap(), G = new WeakMap(), t
24466
24483
  let n = !1;
24467
24484
  if (r) {
24468
24485
  const { recv: c, send: d } = (o = a(this, Js, Xr).mediaState) != null ? o : {};
24469
- (d == null ? void 0 : d.state) === Hr.CONNECTED && (c == null ? void 0 : c.state) === Hr.CONNECTED ? (this.logger.info("MediaNodeClient.joinRoom: transports healthy — partial reset (producers only)"), a(this, G).closeAllProducersLocally(), a(this, tt).clear(), a(this, _s).clear(), S(this, At, null), n = !0) : (this.logger.info("MediaNodeClient.joinRoom: transports unhealthy — full reset"), this.reset({ resetTransportQueue: !1 }));
24486
+ (d == null ? void 0 : d.state) === Hr.CONNECTED && (c == null ? void 0 : c.state) === Hr.CONNECTED ? (this.logger.info("MediaNodeClient.joinRoom: transports healthy — partial reset (producers only)"), yield a(this, G).closeAllProducersLocally(), a(this, tt).clear(), a(this, _s).clear(), S(this, At, null), n = !0) : (this.logger.info("MediaNodeClient.joinRoom: transports unhealthy — full reset"), this.reset({ resetTransportQueue: !1 }));
24470
24487
  }
24471
24488
  try {
24472
24489
  a(this, At) ? yield a(this, At) : yield V(this, pc, Lu).call(this, t, e, r, i, n), V(this, il, eS).call(this, e);
@@ -27516,7 +27533,7 @@ let Fr = (Pg = class {
27516
27533
  video: !0
27517
27534
  };
27518
27535
  return n.setValue("options", e), n.setValue("peerId", t), n.setValue("modules", o), n.setValue("sdkName", "web-core"), n.setValue("meetingId", r), n.setValue("apiBase", i.apiBase), n.setValue("baseURI", i.baseURI), n.setValue("userId", i.participantId), n.setValue("organizationId", i.orgId), n.setValue("authToken", e.authToken), n.setValue("overrides", (d = e.overrides) != null ? d : {}), n.setValue("env", yC({ baseURI: i.baseURI })), n.setValue("defaults", c), n.setValue("onError", e.onError || (() => {
27519
- })), n.setValue("cachedUserDetails", Cs(e.cachedUserDetails)), n.setValue("sdkVersion", "1.5.2-staging.8"), (l = e.modules) != null && l.experimentalAudioPlayback && n.setValue("audioPlayback", new ZD()), n;
27536
+ })), n.setValue("cachedUserDetails", Cs(e.cachedUserDetails)), n.setValue("sdkVersion", "1.5.2-staging.9"), (l = e.modules) != null && l.experimentalAudioPlayback && n.setValue("audioPlayback", new ZD()), n;
27520
27537
  }
27521
27538
  join() {
27522
27539
  return u(this, null, function* () {
package/dist/index.es5.js CHANGED
@@ -24393,15 +24393,63 @@ var Ml = /* @__PURE__ */ E("context"), Gr = /* @__PURE__ */ E("logger"), b_ = /*
24393
24393
  * sending close messages would fail since the SFU doesn't know
24394
24394
  * about these producers anymore.
24395
24395
  *
24396
- * Fire-and-forget is safe: Producer.close(REASON_TRANSPORT_CLOSED)
24397
- * skips the async SDP renegotiation path (stopSending + safeEmitAsPromise)
24398
- * and only performs synchronous local cleanup.
24396
+ * Also deactivates the underlying RTCRtpTransceivers as a
24397
+ * best-effort cleanup to stop unnecessary RTP from flowing
24398
+ * to the SFU on the still-alive send transport.
24399
24399
  */
24400
24400
  }, { key: "closeAllProducersLocally", value: function() {
24401
- Array.from(c(this, gn)[gn].values()).forEach(function(r) {
24402
- return r.close(Lu);
24403
- });
24404
- } }, { key: "createConsumer", value: function(r) {
24401
+ var e = m(/* @__PURE__ */ h().mark(function n() {
24402
+ var i, a = this, o;
24403
+ return h().wrap(function(l) {
24404
+ for (; ; )
24405
+ switch (l.prev = l.next) {
24406
+ case 0:
24407
+ return o = (i = this.sendTransport) === null || i === void 0 ? void 0 : i.handler, l.next = 3, Promise.all(Array.from(c(this, gn)[gn].values()).map(/* @__PURE__ */ function() {
24408
+ var d = m(/* @__PURE__ */ h().mark(function p(v) {
24409
+ var f;
24410
+ return h().wrap(function(k) {
24411
+ for (; ; )
24412
+ switch (k.prev = k.next) {
24413
+ case 0:
24414
+ if (k.prev = 0, !o) {
24415
+ k.next = 7;
24416
+ break;
24417
+ }
24418
+ if (f = o.midTransceiverMap.get(v.localId), !f) {
24419
+ k.next = 7;
24420
+ break;
24421
+ }
24422
+ return k.next = 6, f.sender.replaceTrack(null);
24423
+ case 6:
24424
+ f.direction = "inactive";
24425
+ case 7:
24426
+ k.next = 12;
24427
+ break;
24428
+ case 9:
24429
+ k.prev = 9, k.t0 = k.catch(0), a.logger.warn("closeAllProducersLocally: failed to deactivate transceiver", { producer: { id: v.id, kind: v.kind, appData: v.appData }, error: k.t0 });
24430
+ case 12:
24431
+ return k.next = 14, v.close(Lu);
24432
+ case 14:
24433
+ case "end":
24434
+ return k.stop();
24435
+ }
24436
+ }, p, null, [[0, 9]]);
24437
+ }));
24438
+ return function(p) {
24439
+ return d.apply(this, arguments);
24440
+ };
24441
+ }()));
24442
+ case 3:
24443
+ case "end":
24444
+ return l.stop();
24445
+ }
24446
+ }, n, this);
24447
+ }));
24448
+ function r() {
24449
+ return e.apply(this, arguments);
24450
+ }
24451
+ return r;
24452
+ }() }, { key: "createConsumer", value: function(r) {
24405
24453
  return this.createConsumers([r]);
24406
24454
  } }, { key: "createConsumers", value: function() {
24407
24455
  var e = m(/* @__PURE__ */ h().mark(function n(i) {
@@ -25765,29 +25813,44 @@ function jd() {
25765
25813
  for (; ; )
25766
25814
  switch (k.prev = k.next) {
25767
25815
  case 0:
25768
- if (c(this, ku)[ku] = t, i = !1, r && (o = (a = c(this, Nt)[Nt].mediaState) !== null && a !== void 0 ? a : {}, u = o.recv, l = o.send, d = (l == null ? void 0 : l.state) === ha.CONNECTED && (u == null ? void 0 : u.state) === ha.CONNECTED, d ? (this.logger.info("MediaNodeClient.joinRoom: transports healthy — partial reset (producers only)"), c(this, W)[W].closeAllProducersLocally(), c(this, tr)[tr].clear(), c(this, ut)[ut].clear(), c(this, Lr)[Lr] = null, i = !0) : (this.logger.info("MediaNodeClient.joinRoom: transports unhealthy — full reset"), this.reset({ resetTransportQueue: !1 }))), k.prev = 3, !c(this, Lr)[Lr]) {
25769
- k.next = 9;
25816
+ if (c(this, ku)[ku] = t, i = !1, !r) {
25817
+ k.next = 17;
25770
25818
  break;
25771
25819
  }
25772
- return k.next = 7, c(this, Lr)[Lr];
25773
- case 7:
25774
- k.next = 11;
25775
- break;
25820
+ if (o = (a = c(this, Nt)[Nt].mediaState) !== null && a !== void 0 ? a : {}, u = o.recv, l = o.send, d = (l == null ? void 0 : l.state) === ha.CONNECTED && (u == null ? void 0 : u.state) === ha.CONNECTED, !d) {
25821
+ k.next = 15;
25822
+ break;
25823
+ }
25824
+ return this.logger.info("MediaNodeClient.joinRoom: transports healthy — partial reset (producers only)"), k.next = 9, c(this, W)[W].closeAllProducersLocally();
25776
25825
  case 9:
25777
- return k.next = 11, c(this, bu)[bu](t, e, r, n, i);
25778
- case 11:
25779
- return c(this, Nd)[Nd](e), k.next = 14, c(this, Ld)[Ld]();
25780
- case 14:
25826
+ c(this, tr)[tr].clear(), c(this, ut)[ut].clear(), c(this, Lr)[Lr] = null, i = !0, k.next = 17;
25827
+ break;
25828
+ case 15:
25829
+ this.logger.info("MediaNodeClient.joinRoom: transports unhealthy — full reset"), this.reset({ resetTransportQueue: !1 });
25830
+ case 17:
25831
+ if (k.prev = 17, !c(this, Lr)[Lr]) {
25832
+ k.next = 23;
25833
+ break;
25834
+ }
25835
+ return k.next = 21, c(this, Lr)[Lr];
25836
+ case 21:
25837
+ k.next = 25;
25838
+ break;
25839
+ case 23:
25840
+ return k.next = 25, c(this, bu)[bu](t, e, r, n, i);
25841
+ case 25:
25842
+ return c(this, Nd)[Nd](e), k.next = 28, c(this, Ld)[Ld]();
25843
+ case 28:
25781
25844
  return p = k.sent, v = p.joined, f = p.error, k.abrupt("return", { roomJoined: v, error: f });
25782
- case 20:
25783
- return k.prev = 20, k.t0 = k.catch(3), this.logger.error("Failed to complete room join", { error: k.t0 }), k.abrupt("return", { roomJoined: !1, error: k.t0 });
25784
- case 24:
25785
- return k.prev = 24, c(this, Lr)[Lr] = null, k.finish(24);
25786
- case 27:
25845
+ case 34:
25846
+ return k.prev = 34, k.t0 = k.catch(17), this.logger.error("Failed to complete room join", { error: k.t0 }), k.abrupt("return", { roomJoined: !1, error: k.t0 });
25847
+ case 38:
25848
+ return k.prev = 38, c(this, Lr)[Lr] = null, k.finish(38);
25849
+ case 41:
25787
25850
  case "end":
25788
25851
  return k.stop();
25789
25852
  }
25790
- }, s, this, [[3, 20, 24, 27]]);
25853
+ }, s, this, [[17, 34, 38, 41]]);
25791
25854
  })), jd.apply(this, arguments);
25792
25855
  }
25793
25856
  function q_() {