@cloudflare/realtimekit-react 0.5.0-staging.115 → 0.5.0-staging.117

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
@@ -5478,7 +5478,7 @@ class Am extends lt {
5478
5478
  }) || e[e.length - 1];
5479
5479
  }
5480
5480
  parseRTCReport(e, r = [], i = false, n = void 0, o = void 0) {
5481
- var b, R, L, H, B, F, q, ie, pe, Ye, Ss, es, cr;
5481
+ var b, R, L, H, F, B, q, ie, pe, Ye, Ss, es, cr;
5482
5482
  const c = e, d = new Im(), h = r.length ? new Set(r) : void 0, m = [], g = [], T = [], _ = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map();
5483
5483
  for (const M of c.values()) {
5484
5484
  if (h) {
@@ -5712,8 +5712,8 @@ class Am extends lt {
5712
5712
  frameHeight: k.frameHeight || 0,
5713
5713
  framesPerSecond: k.framesPerSecond || 0,
5714
5714
  packetsLostPercentage: Wc({
5715
- packetsLost: (k.packetsLost || 0) - (((B = this.videoConsumerToStatsMap.get(C)) == null ? void 0 : B.packetsLost) || 0),
5716
- packetsReceived: (k.packetsReceived || 0) - (((F = this.videoConsumerToStatsMap.get(C)) == null ? void 0 : F.packetsReceived) || 0)
5715
+ packetsLost: (k.packetsLost || 0) - (((F = this.videoConsumerToStatsMap.get(C)) == null ? void 0 : F.packetsLost) || 0),
5716
+ packetsReceived: (k.packetsReceived || 0) - (((B = this.videoConsumerToStatsMap.get(C)) == null ? void 0 : B.packetsReceived) || 0)
5717
5717
  }),
5718
5718
  jitter: k.jitter || 0,
5719
5719
  isScreenShare: this.screenShareConsumers.has(C),
@@ -6111,7 +6111,7 @@ class Mm extends Am {
6111
6111
  };
6112
6112
  }
6113
6113
  parseRTCReport(e, r = [], i = false, n = void 0, o = void 0) {
6114
- var b, R, L, H, B, F, q, ie, pe, Ye, Ss, es, cr;
6114
+ var b, R, L, H, F, B, q, ie, pe, Ye, Ss, es, cr;
6115
6115
  const c = e, d = new Im(), h = r.length ? new Set(r) : void 0, m = [], g = [], T = [], _ = /* @__PURE__ */ new Map(), P = /* @__PURE__ */ new Map();
6116
6116
  for (const M of c.values()) {
6117
6117
  if (h) {
@@ -6345,8 +6345,8 @@ class Mm extends Am {
6345
6345
  frameHeight: k.frameHeight || 0,
6346
6346
  framesPerSecond: k.framesPerSecond || 0,
6347
6347
  packetsLostPercentage: Wc({
6348
- packetsLost: (k.packetsLost || 0) - (((B = this.videoConsumerToStatsMap.get(C)) == null ? void 0 : B.packetsLost) || 0),
6349
- packetsReceived: (k.packetsReceived || 0) - (((F = this.videoConsumerToStatsMap.get(C)) == null ? void 0 : F.packetsReceived) || 0)
6348
+ packetsLost: (k.packetsLost || 0) - (((F = this.videoConsumerToStatsMap.get(C)) == null ? void 0 : F.packetsLost) || 0),
6349
+ packetsReceived: (k.packetsReceived || 0) - (((B = this.videoConsumerToStatsMap.get(C)) == null ? void 0 : B.packetsReceived) || 0)
6350
6350
  }),
6351
6351
  jitter: k.jitter || 0,
6352
6352
  isScreenShare: this.screenShareConsumers.has(C),
@@ -8362,8 +8362,8 @@ var OE = (s, t, e) => {
8362
8362
  for (const R of t) {
8363
8363
  let L;
8364
8364
  R < 0 ? L = m + R * b * e : R > 0 ? L = m + R * P * e : L = m;
8365
- const [H, B, F] = OE(c, d, L / 100);
8366
- r.push(LE(H, B, F));
8365
+ const [H, F, B] = OE(c, d, L / 100);
8366
+ r.push(LE(H, F, B));
8367
8367
  }
8368
8368
  return r;
8369
8369
  }, Jh = {
@@ -8927,16 +8927,16 @@ function H_(s, t, e, r, i, n) {
8927
8927
  T = c[g];
8928
8928
  var L = s[T], H = t[T];
8929
8929
  if (r)
8930
- var B = o ? r(H, L, T, t, s, n) : r(L, H, T, s, t, n);
8931
- if (!(B === void 0 ? L === H || i(L, H, e, r, n) : B)) {
8930
+ var F = o ? r(H, L, T, t, s, n) : r(L, H, T, s, t, n);
8931
+ if (!(F === void 0 ? L === H || i(L, H, e, r, n) : F)) {
8932
8932
  b = false;
8933
8933
  break;
8934
8934
  }
8935
8935
  R || (R = T == "constructor");
8936
8936
  }
8937
8937
  if (b && !R) {
8938
- var F = s.constructor, q = t.constructor;
8939
- F != q && "constructor" in s && "constructor" in t && !(typeof F == "function" && F instanceof F && typeof q == "function" && q instanceof q) && (b = false);
8938
+ var B = s.constructor, q = t.constructor;
8939
+ B != q && "constructor" in s && "constructor" in t && !(typeof B == "function" && B instanceof B && typeof q == "function" && q instanceof q) && (b = false);
8940
8940
  }
8941
8941
  return n.delete(s), n.delete(t), b;
8942
8942
  }
@@ -9010,10 +9010,10 @@ function Xc(s, t, e) {
9010
9010
  function H(ie) {
9011
9011
  return c = void 0, T && r ? _(ie) : (r = i = void 0, o);
9012
9012
  }
9013
- function B() {
9013
+ function F() {
9014
9014
  c !== void 0 && clearTimeout(c), h = 0, r = d = i = c = void 0;
9015
9015
  }
9016
- function F() {
9016
+ function B() {
9017
9017
  return c === void 0 ? o : H(Al());
9018
9018
  }
9019
9019
  function q() {
@@ -9026,7 +9026,7 @@ function Xc(s, t, e) {
9026
9026
  }
9027
9027
  return c === void 0 && (c = setTimeout(L, t)), o;
9028
9028
  }
9029
- return q.cancel = B, q.flush = F, q;
9029
+ return q.cancel = F, q.flush = B, q;
9030
9030
  }
9031
9031
  function Jl(s, t, e) {
9032
9032
  (e !== void 0 && !dc(s[t], e) || e === void 0 && !(t in s)) && Bu(s, t, e);
@@ -10349,14 +10349,14 @@ const fh = class extends Vt {
10349
10349
  R + g,
10350
10350
  h
10351
10351
  ), o.arcTo(b, R + g, b, R + g - h, h), o.arcTo(b, R, b + h, R, h), o.closePath(), o.fill(), o.stroke();
10352
- const B = m / 6, F = m / 2 + b, q = g / 2 + R;
10353
- o.save(), (L || H) && (o.beginPath(), o.arc(F, q, B, 0, Math.PI * 2), o.fillStyle = a(this, is).brand, o.fill(), H ? (o.clip(), o.drawImage(
10352
+ const F = m / 6, B = m / 2 + b, q = g / 2 + R;
10353
+ o.save(), (L || H) && (o.beginPath(), o.arc(B, q, F, 0, Math.PI * 2), o.fillStyle = a(this, is).brand, o.fill(), H ? (o.clip(), o.drawImage(
10354
10354
  H,
10355
- F - B,
10356
- q - B,
10357
- B * 2,
10358
- B * 2
10359
- ), o.restore()) : L && (o.fillStyle = a(this, is).textOnBrand, o.font = `${B / 2}px sans-serif`, o.textAlign = "center", o.textBaseline = "middle", o.fillText(L, F, q)), this.drawIcons(n, b, R, Math.max(m, g)));
10355
+ B - F,
10356
+ q - F,
10357
+ F * 2,
10358
+ F * 2
10359
+ ), o.restore()) : L && (o.fillStyle = a(this, is).textOnBrand, o.font = `${F / 2}px sans-serif`, o.textAlign = "center", o.textBaseline = "middle", o.fillText(L, B, q)), this.drawIcons(n, b, R, Math.max(m, g)));
10360
10360
  }
10361
10361
  drawIcons(e, r, i, n) {
10362
10362
  const o = Math.min(Math.max(n * 0.15, 100), 200), c = o * 0.2, d = o * 0.2;
@@ -10389,7 +10389,7 @@ const fh = class extends Vt {
10389
10389
  let g = 0;
10390
10390
  for (; g < a(this, Ae).width - 5 && d < i; ) {
10391
10391
  if ((h = o[d]) != null && h.enabled) {
10392
- const T = o[d].element, [_, P, b, R, L, H, B, F] = MP(
10392
+ const T = o[d].element, [_, P, b, R, L, H, F, B] = MP(
10393
10393
  g,
10394
10394
  c,
10395
10395
  e,
@@ -10397,7 +10397,7 @@ const fh = class extends Vt {
10397
10397
  T.videoWidth,
10398
10398
  T.videoHeight
10399
10399
  );
10400
- ((m = T == null ? void 0 : T.classList) == null ? void 0 : m.contains("mirror")) ? (n.save(), n.scale(-1, 1), n.drawImage(T, _, P, b, R, -1 * L, H, -1 * B, F), n.restore()) : n.drawImage(T, _, P, b, R, L, H, B, F), this.drawIcons(o[d], L, H, Math.max(B, F));
10400
+ ((m = T == null ? void 0 : T.classList) == null ? void 0 : m.contains("mirror")) ? (n.save(), n.scale(-1, 1), n.drawImage(T, _, P, b, R, -1 * L, H, -1 * F, B), n.restore()) : n.drawImage(T, _, P, b, R, L, H, F, B), this.drawIcons(o[d], L, H, Math.max(F, B));
10401
10401
  } else
10402
10402
  this.drawEmptyTile(d, e, r, o[d]);
10403
10403
  d += 1, g += e;
@@ -15578,8 +15578,8 @@ class kp {
15578
15578
  const R = P.headers.get("content-type");
15579
15579
  R && R.includes("application/json") ? b = yield P.json() : b = yield P.text();
15580
15580
  const L = {};
15581
- P.headers.forEach((B, F) => {
15582
- L[F] = B;
15581
+ P.headers.forEach((F, B) => {
15582
+ L[B] = F;
15583
15583
  });
15584
15584
  const H = {
15585
15585
  data: b,
@@ -16198,7 +16198,7 @@ let Ke = (jp = class extends Vt {
16198
16198
  }
16199
16199
  sendCustomMessage(t, e) {
16200
16200
  return u(this, null, function* () {
16201
- var n, o, c, d, h, m, g, T, _, P, b, R, L, H, B;
16201
+ var n, o, c, d, h, m, g, T, _, P, b, R, L, H, F;
16202
16202
  if (e && e.length > 0) {
16203
16203
  if (!((n = a(this, re).permissions) != null && n.chatPrivate.canSend) || !((o = a(this, re).permissions) != null && o.chatPrivate.files) || !((c = a(this, re).permissions) != null && c.chatPrivate.text)) {
16204
16204
  l.error("sendCustomMessage::private_chat_permission_denied");
@@ -16208,32 +16208,32 @@ let Ke = (jp = class extends Vt {
16208
16208
  l.error("sendCustomMessage::permission_denied");
16209
16209
  return;
16210
16210
  }
16211
- const r = (F) => u(this, null, function* () {
16211
+ const r = (B) => u(this, null, function* () {
16212
16212
  try {
16213
- if (typeof F == "string")
16214
- return { link: F };
16213
+ if (typeof B == "string")
16214
+ return { link: B };
16215
16215
  const q = tt(), { getLocation: ie, putLocation: pe } = yield q.getPresignedUrls(
16216
- F.name,
16216
+ B.name,
16217
16217
  a(this, re).config.viewType
16218
16218
  );
16219
- return yield q.uploadFile(F, pe), {
16219
+ return yield q.uploadFile(B, pe), {
16220
16220
  link: ie,
16221
- type: F.type,
16222
- name: F.name,
16223
- size: F.size
16221
+ type: B.type,
16222
+ name: B.name,
16223
+ size: B.size
16224
16224
  };
16225
16225
  } catch (q) {
16226
16226
  throw new w("Error sending image message.", "0500");
16227
16227
  }
16228
16228
  }), i = j(O({}, t), {
16229
- files: yield Promise.all((b = (P = t.files) != null ? P : []) == null ? void 0 : b.map((F) => u(this, null, function* () {
16230
- return r(F);
16229
+ files: yield Promise.all((b = (P = t.files) != null ? P : []) == null ? void 0 : b.map((B) => u(this, null, function* () {
16230
+ return r(B);
16231
16231
  }))),
16232
- images: yield Promise.all((L = (R = t.images) != null ? R : []) == null ? void 0 : L.map((F) => u(this, null, function* () {
16233
- return r(F);
16232
+ images: yield Promise.all((L = (R = t.images) != null ? R : []) == null ? void 0 : L.map((B) => u(this, null, function* () {
16233
+ return r(B);
16234
16234
  }))),
16235
- videos: yield Promise.all((B = (H = t.videos) != null ? H : []) == null ? void 0 : B.map((F) => u(this, null, function* () {
16236
- return r(F);
16235
+ videos: yield Promise.all((F = (H = t.videos) != null ? H : []) == null ? void 0 : F.map((B) => u(this, null, function* () {
16236
+ return r(B);
16237
16237
  })))
16238
16238
  });
16239
16239
  a(this, Fe).sendMessage(
@@ -17557,7 +17557,7 @@ let Sa = (Yp = class extends _a {
17557
17557
  tags: T,
17558
17558
  type: _,
17559
17559
  updatedAt: P
17560
- }, b, R, L, H, B) {
17560
+ }, b, R, L, H, F) {
17561
17561
  super();
17562
17562
  f(this, it, void 0);
17563
17563
  p(this, "baseURL");
@@ -17584,7 +17584,7 @@ let Sa = (Yp = class extends _a {
17584
17584
  p(this, "enabledBy");
17585
17585
  f(this, li, void 0);
17586
17586
  f(this, bn, void 0);
17587
- v(this, li, t), this.baseURL = e, this.createdAt = new Date(r), this.description = i, this.id = n, this.name = o, v(this, Dt, R), this.organizationId = c, this.picture = d, this.private = h, this.published = m, this.staggered = g, this.tags = T, this.type = _, this.updatedAt = new Date(P), this.active = false, this.iframes = /* @__PURE__ */ new Map(), v(this, it, b), v(this, Cn, L), v(this, Rn, H), this.enabledBy = "", v(this, bn, B);
17587
+ v(this, li, t), this.baseURL = e, this.createdAt = new Date(r), this.description = i, this.id = n, this.name = o, v(this, Dt, R), this.organizationId = c, this.picture = d, this.private = h, this.published = m, this.staggered = g, this.tags = T, this.type = _, this.updatedAt = new Date(P), this.active = false, this.iframes = /* @__PURE__ */ new Map(), v(this, it, b), v(this, Cn, L), v(this, Rn, H), this.enabledBy = "", v(this, bn, F);
17588
17588
  }
17589
17589
  sendIframeEvent(t) {
17590
17590
  this.iframes.size && this.iframes.forEach((e) => {
@@ -19092,7 +19092,7 @@ class ZA {
19092
19092
  f(this, pi, void 0);
19093
19093
  f(this, Sd, void 0);
19094
19094
  p(this, "getScreenShareConstraints", () => {
19095
- var h, m, g, T, _, P, b, R, L, H, B;
19095
+ var h, m, g, T, _, P, b, R, L, H, F;
19096
19096
  const t2 = (h = a(this, pi)) == null ? void 0 : h.screenshare, e2 = (g = (m = t2 == null ? void 0 : t2.width) == null ? void 0 : m.max) != null ? g : 1920, r = (_ = (T = t2 == null ? void 0 : t2.height) == null ? void 0 : T.max) != null ? _ : 1080, i = (b = (P = t2 == null ? void 0 : t2.frameRate) == null ? void 0 : P.max) != null ? b : 5;
19097
19097
  let n = (L = (R = t2 == null ? void 0 : t2.frameRate) == null ? void 0 : R.ideal) != null ? L : 5;
19098
19098
  const o = t2 == null ? void 0 : t2.displaySurface, c = t2 == null ? void 0 : t2.selfBrowserSurface;
@@ -19109,10 +19109,10 @@ class ZA {
19109
19109
  }
19110
19110
  };
19111
19111
  if (Y.hasFeature(se.SCREENSHARE_CONSTRAINTS)) {
19112
- const F = (B = Y.getValue(
19112
+ const B = (F = Y.getValue(
19113
19113
  se.SCREENSHARE_CONSTRAINTS
19114
- )) == null ? void 0 : B.toString();
19115
- d = JSON.parse(F);
19114
+ )) == null ? void 0 : F.toString();
19115
+ d = JSON.parse(B);
19116
19116
  }
19117
19117
  return o !== void 0 && ["monitor", "browser", "window"].includes(o) && (d = j(O({}, d), { displaySurface: o })), c !== void 0 && (d = j(O({}, d), { selfBrowserSurface: c })), {
19118
19118
  audio: true,
@@ -19657,7 +19657,7 @@ let rd = class extends _a {
19657
19657
  ));
19658
19658
  p(this, "getUserPreferredDevice", () => no.getItem(this.userPreferredDeviceKey));
19659
19659
  p(this, "isCustomTrack", false);
19660
- this.mediaInterface = t, e && (this._mediaTrack = e), this.userSelectedDevice = (i = this.getUserPreferredDevice()) != null ? i : void 0, this.isNonPreferredDevice = r, this.onTrackEnded = this.onTrackEnded.bind(this), this.onTrackMuted = this.onTrackMuted.bind(this);
19660
+ this.mediaInterface = t, e && this.setMediaTrack(e), this.userSelectedDevice = (i = this.getUserPreferredDevice()) != null ? i : void 0, this.isNonPreferredDevice = r, this.onTrackEnded = this.onTrackEnded.bind(this), this.onTrackMuted = this.onTrackMuted.bind(this);
19661
19661
  }
19662
19662
  disableTrack() {
19663
19663
  var t, e;
@@ -20283,7 +20283,7 @@ const rn = class {
20283
20283
  return a(this, mi).configDiff;
20284
20284
  }
20285
20285
  get mediaConstraints() {
20286
- var t, e, r, i, n, o, c, d, h, m, g, T, _, P, b, R, L, H, B, F, q, ie, pe, Ye;
20286
+ var t, e, r, i, n, o, c, d, h, m, g, T, _, P, b, R, L, H, F, B, q, ie, pe, Ye;
20287
20287
  return {
20288
20288
  audio: {
20289
20289
  enableStereo: (i = (r = (e = (t = a(this, Pt)) == null ? void 0 : t.media) == null ? void 0 : e.audio) == null ? void 0 : r.enableStereo) != null ? i : zi.audio.enableStereo,
@@ -20294,7 +20294,7 @@ const rn = class {
20294
20294
  frameRate: (R = (b = (P = (_ = a(this, Pt)) == null ? void 0 : _.media) == null ? void 0 : P.video) == null ? void 0 : b.frameRate) != null ? R : zi.video.frameRate
20295
20295
  },
20296
20296
  screenshare: {
20297
- quality: (F = (B = (H = (L = a(this, Pt)) == null ? void 0 : L.media) == null ? void 0 : H.screenshare) == null ? void 0 : B.quality) != null ? F : zi.screenshare.quality,
20297
+ quality: (B = (F = (H = (L = a(this, Pt)) == null ? void 0 : L.media) == null ? void 0 : H.screenshare) == null ? void 0 : F.quality) != null ? B : zi.screenshare.quality,
20298
20298
  frameRate: (Ye = (pe = (ie = (q = a(this, Pt)) == null ? void 0 : q.media) == null ? void 0 : ie.screenshare) == null ? void 0 : pe.frameRate) != null ? Ye : zi.screenshare.frameRate
20299
20299
  }
20300
20300
  };
@@ -20767,13 +20767,13 @@ let nr = (em = class extends Vt {
20767
20767
  audioTrack: R,
20768
20768
  videoEnabled: L = false,
20769
20769
  videoTrack: H,
20770
- producers: B,
20771
- metadata: F
20770
+ producers: F,
20771
+ metadata: B
20772
20772
  } = e;
20773
20773
  this.id = n, this.userId = o, this.name = c, this.device = d, this.picture = h, this.isHost = m, this.flags = g, this.manualProducerConfig = TP, v(this, $n, _ != null ? _ : "ON_STAGE"), this.customParticipantId = P != null ? P : T, this.audioEnabled = !b, this.audioTrack = R, this.videoEnabled = L, this.videoTrack = H, this.screenShareTracks = {
20774
20774
  audio: void 0,
20775
20775
  video: void 0
20776
- }, this.producers = B != null ? B : [], this.presetName = F == null ? void 0 : F.preset_name, v(this, Un, false), v(this, qs, r), v(this, Mo, i), this.setupEvents(), this.updateVideo = this.updateVideo.bind(this), $(this, Do, vu).call(this);
20776
+ }, this.producers = F != null ? F : [], this.presetName = B == null ? void 0 : B.preset_name, v(this, Un, false), v(this, qs, r), v(this, Mo, i), this.setupEvents(), this.updateVideo = this.updateVideo.bind(this), $(this, Do, vu).call(this);
20777
20777
  }
20778
20778
  get clientSpecificId() {
20779
20779
  return this.customParticipantId;
@@ -24572,9 +24572,9 @@ class ad extends oh {
24572
24572
  T.encodings = r, yield d.sender.setParameters(T);
24573
24573
  }
24574
24574
  const h = (T, _) => {
24575
- var F;
24576
- const P = parse(T), b = P.media[P.media.length - 1], R = b.rtp.filter((q) => _.some((ie) => ie.name === q.codec)), L = b.fmtp.filter((q) => R.some((ie) => ie.payload === q.payload)), H = (F = b.rtcpFb) == null ? void 0 : F.filter((q) => R.some((ie) => ie.payload === q.payload)), B = R.map((q) => q.payload);
24577
- return P.media[P.media.length - 1].rtp = R, P.media[P.media.length - 1].fmtp = L, P.media[P.media.length - 1].rtcpFb = H, P.media[P.media.length - 1].payloads = B.join(" "), write(P);
24575
+ var B;
24576
+ const P = parse(T), b = P.media[P.media.length - 1], R = b.rtp.filter((q) => _.some((ie) => ie.name === q.codec)), L = b.fmtp.filter((q) => R.some((ie) => ie.payload === q.payload)), H = (B = b.rtcpFb) == null ? void 0 : B.filter((q) => R.some((ie) => ie.payload === q.payload)), F = R.map((q) => q.payload);
24577
+ return P.media[P.media.length - 1].rtp = R, P.media[P.media.length - 1].fmtp = L, P.media[P.media.length - 1].rtcpFb = H, P.media[P.media.length - 1].payloads = F.join(" "), write(P);
24578
24578
  }, m = yield this.pc.createOffer();
24579
24579
  if (m.sdp = h(m.sdp, i), l.debug(`send() | calling pc.setLocalDescription() [offer:${JSON.stringify(m)}]`), yield this.pc.setLocalDescription(m), e === "audio" || e.kind === "audio") {
24580
24580
  const { enableDtx: T, enableStereo: _ } = this, P = this.enableHighBitrate ? _ ? 128e3 : 64e3 : _ ? 64e3 : 32e3;
@@ -25166,25 +25166,25 @@ const on = class extends fl {
25166
25166
  return;
25167
25167
  }
25168
25168
  try {
25169
- const B = JSON.parse(L);
25169
+ const F = JSON.parse(L);
25170
25170
  l.debug("datachannel message chunk recieved", {
25171
25171
  dataChannelMessageChunk: {
25172
- id: B.id,
25173
- count: B.count,
25174
- chunkIndex: B.chunkIndex,
25175
- chunk: B.chunk,
25172
+ id: F.id,
25173
+ count: F.count,
25174
+ chunkIndex: F.chunkIndex,
25175
+ chunk: F.chunk,
25176
25176
  transprtId: this.serverId
25177
25177
  }
25178
25178
  });
25179
- const F = H.processMessage(B);
25180
- if (!F)
25179
+ const B = H.processMessage(F);
25180
+ if (!B)
25181
25181
  return;
25182
25182
  l.debug(
25183
- `datachannel message with id:${B.id} on transport:${this.serverId}complete - ${JSON.stringify(F)}`
25184
- ), this.emit(`datachannel:${R.label}`, H.label, F);
25185
- } catch (B) {
25183
+ `datachannel message with id:${F.id} on transport:${this.serverId}complete - ${JSON.stringify(B)}`
25184
+ ), this.emit(`datachannel:${R.label}`, H.label, B);
25185
+ } catch (F) {
25186
25186
  l.error("error parsing message", {
25187
- error: B
25187
+ error: F
25188
25188
  });
25189
25189
  }
25190
25190
  });
@@ -25285,7 +25285,7 @@ const on = class extends fl {
25285
25285
  encodings: o,
25286
25286
  codecOptions: c,
25287
25287
  screenShare: g == null ? void 0 : g.screenShare
25288
- }), { answer: B, producerId: F } = yield r(
25288
+ }), { answer: F, producerId: B } = yield r(
25289
25289
  {
25290
25290
  offer: b,
25291
25291
  kind: n.kind,
@@ -25294,8 +25294,8 @@ const on = class extends fl {
25294
25294
  codecOptions: c,
25295
25295
  producingTransportId: this.serverId
25296
25296
  }
25297
- ), q = yield R(B);
25298
- return { producerId: F, localId: q, rtpSender: L };
25297
+ ), q = yield R(F);
25298
+ return { producerId: B, localId: q, rtpSender: L };
25299
25299
  }), "Transport.produce");
25300
25300
  return this.createProducerObject({
25301
25301
  id: T,
@@ -25451,7 +25451,7 @@ const on = class extends fl {
25451
25451
  }
25452
25452
  _ontrack(e) {
25453
25453
  const { track: r, transceiver: i, streams: n } = e;
25454
- l.info(`track event received [trackId: ${r.id}]`);
25454
+ l.info(`track event received [trackId: ${r.id}] [mid: ${i.mid}]`);
25455
25455
  let o;
25456
25456
  a(this, Qn) === Je.HIVE ? o = `${n[0].id}:${r.kind}` : o = `${i.mid}:${r.kind}`, r.addEventListener("ended", () => {
25457
25457
  l.info(`rtc consumer track ended [trackId: ${r.id}]`), this.unknownTracksMap.delete(o);
@@ -25494,13 +25494,13 @@ const on = class extends fl {
25494
25494
  });
25495
25495
  return new Promise((b, R) => u(this, null, function* () {
25496
25496
  const L = setTimeout(() => {
25497
- this.consumerTrackEvents.delete(_), P.isTimedout = true, R(P);
25498
- }, 5e3), H = (F, q) => {
25497
+ l.warn(`Timed out waiting for track event ${_} producingPeerId: ${n}`), this.consumerTrackEvents.delete(_), P.isTimedout = true, R(P);
25498
+ }, 5e3), H = (B, q) => {
25499
25499
  try {
25500
- if (F.readyState === "ended")
25500
+ if (B.readyState === "ended")
25501
25501
  clearTimeout(L), R(P);
25502
25502
  else {
25503
- const ie = F;
25503
+ const ie = B;
25504
25504
  ie.enabled = true, this.handler.midTransceiverMap.set(q.mid, q);
25505
25505
  const pe = new s0({
25506
25506
  id: r,
@@ -25533,8 +25533,8 @@ const on = class extends fl {
25533
25533
  } catch (ie) {
25534
25534
  l.warn("error while creating consumer:", ie), clearTimeout(L), R(P);
25535
25535
  }
25536
- }, B = this.unknownTracksMap.get(_);
25537
- B ? (this.unknownTracksMap.delete(_), H(B.track, B.transceiver)) : this.consumerTrackEvents.set(_, H);
25536
+ }, F = this.unknownTracksMap.get(_);
25537
+ F ? (l.info(`track event already received [trackId: ${F.track.id}] [mid: ${F.transceiver.mid}]`), this.unknownTracksMap.delete(_), H(F.track, F.transceiver)) : (l.info(`Registering onTrack handler for key ${_} [producingPeerId: ${n}]`), this.consumerTrackEvents.set(_, H));
25538
25538
  }));
25539
25539
  });
25540
25540
  }
@@ -29166,7 +29166,7 @@ const sn = class {
29166
29166
  }
29167
29167
  static init(s) {
29168
29168
  return u(this, null, function* () {
29169
- var B, F;
29169
+ var F, B;
29170
29170
  const {
29171
29171
  peerId: t,
29172
29172
  apiBase: e,
@@ -29216,16 +29216,16 @@ const sn = class {
29216
29216
  b,
29217
29217
  R
29218
29218
  );
29219
- wA(R) && ((B = sn.createRoomNodeClient(s, h).partialJoinRoom(
29219
+ wA(R) && ((F = sn.createRoomNodeClient(s, h).partialJoinRoom(
29220
29220
  P.participant.name,
29221
29221
  i,
29222
29222
  void 0
29223
- )) == null || B.catch((ie) => {
29223
+ )) == null || F.catch((ie) => {
29224
29224
  l.error(
29225
29225
  "[Controller]: Failed to queue partial media room promise:",
29226
29226
  { error: ie }
29227
29227
  );
29228
- })), y.location.country = (F = c.ipInfo) == null ? void 0 : F.country;
29228
+ })), y.location.country = (B = c.ipInfo) == null ? void 0 : B.country;
29229
29229
  const { controllers: H } = yield L;
29230
29230
  return IP(), new sn(e, H);
29231
29231
  });
@@ -29287,7 +29287,7 @@ const sn = class {
29287
29287
  c.permissions
29288
29288
  );
29289
29289
  t.setValue("maxPreferredStreams", Pe.isMobile() ? n.maxVideoStreams.mobile : n.maxVideoStreams.desktop);
29290
- let P, b, R, L, H, B, F, q;
29290
+ let P, b, R, L, H, F, B, q;
29291
29291
  const ie = new _0(s);
29292
29292
  _e.socketService = s;
29293
29293
  const pe = new vl(s), Ye = new Xt(s), Ss = new R0(s), es = id.create(s, t), cr = new w0(s), M = new E0(s), E = new $i(s), C = yield zr.init(
@@ -29314,7 +29314,7 @@ const sn = class {
29314
29314
  E,
29315
29315
  C.self,
29316
29316
  q.participants
29317
- )), o.internals && (H = yield sh.init()), o.livestream && n.viewType === St.Livestream && Y.hasFeature(se.LIVESTREAM) && (F = new Qg(
29317
+ )), o.internals && (H = yield sh.init()), o.livestream && n.viewType === St.Livestream && Y.hasFeature(se.LIVESTREAM) && (B = new Qg(
29318
29318
  C.self,
29319
29319
  M
29320
29320
  )), n.viewType !== St.Chat) {
@@ -29322,7 +29322,7 @@ const sn = class {
29322
29322
  t,
29323
29323
  C.self,
29324
29324
  pe
29325
- )), o.recording && (B = new Wg(
29325
+ )), o.recording && (F = new Wg(
29326
29326
  t,
29327
29327
  C.self,
29328
29328
  es
@@ -29363,9 +29363,9 @@ const sn = class {
29363
29363
  chatController: b,
29364
29364
  stageController: R,
29365
29365
  pluginController: L,
29366
- recordingController: B,
29366
+ recordingController: F,
29367
29367
  internalsController: H,
29368
- livestreamController: F,
29368
+ livestreamController: B,
29369
29369
  participantController: q
29370
29370
  };
29371
29371
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudflare/realtimekit-react",
3
- "version": "0.5.0-staging.115",
3
+ "version": "0.5.0-staging.117",
4
4
  "description": "A real-time video and audio SDK for building custom, collaborative communication experiences.",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.es.js",
@@ -17,7 +17,7 @@
17
17
  },
18
18
  "private": false,
19
19
  "dependencies": {
20
- "@cloudflare/realtimekit": "0.5.0-staging.115"
20
+ "@cloudflare/realtimekit": "0.5.0-staging.117"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=16.8.6"