@cloudflare/realtimekit 1.2.0-staging.15 → 1.2.0-staging.17

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.d.ts CHANGED
@@ -5848,8 +5848,12 @@ declare class API {
5848
5848
 
5849
5849
  interface Overrides {
5850
5850
  disableSimulcast?: boolean;
5851
+ simulcastConfig?: {
5852
+ disable?: boolean;
5853
+ encodings?: RTCRtpEncodingParameters[];
5854
+ };
5851
5855
  forceRelay?: boolean;
5852
- [key: string]: boolean | string | number;
5856
+ [key: string]: boolean | string | number | Record<string, any>;
5853
5857
  }
5854
5858
  interface RealtimeKitClientOptions {
5855
5859
  authToken: string;
package/dist/index.es.js CHANGED
@@ -19573,17 +19573,20 @@ const Tg = {
19573
19573
  }
19574
19574
  ]]
19575
19575
  ], eD = (s, t) => {
19576
- var c;
19577
- const e = "getSettings" in t && t.getSettings().width || "getConstraints" in t && t.getConstraints().width || "originalSettings" in t && ((c = t.originalSettings) == null ? void 0 : c.width);
19578
- let r = Z0;
19579
- s.getValue("flagsmith").hasFeature(Z.OVERRIDE_HIVE_SIMULCAST_DYNAMIC) && (r = JSON.parse(s.getValue("flagsmith").getValue(
19576
+ var d, l, p;
19577
+ const e = (d = s == null ? void 0 : s.getValue("overrides")) == null ? void 0 : d.simulcastConfig;
19578
+ if ((l = e == null ? void 0 : e.encodings) != null && l.length)
19579
+ return e.encodings;
19580
+ const r = "getSettings" in t && t.getSettings().width || "getConstraints" in t && t.getConstraints().width || "originalSettings" in t && ((p = t.originalSettings) == null ? void 0 : p.width);
19581
+ let i = Z0;
19582
+ s.getValue("flagsmith").hasFeature(Z.OVERRIDE_HIVE_SIMULCAST_DYNAMIC) && (i = JSON.parse(s.getValue("flagsmith").getValue(
19580
19583
  Z.OVERRIDE_HIVE_SIMULCAST_DYNAMIC
19581
19584
  )));
19582
- const i = r.map(([d]) => d).sort((d, l) => d - l);
19583
- let a = Number.MAX_VALUE, o = 0;
19584
- return i.forEach((d, l) => {
19585
- Math.abs(d - e) < a && (a = Math.abs(d - e), o = l);
19586
- }), r[o][1];
19585
+ const a = i.map(([g]) => g).sort((g, S) => g - S);
19586
+ let o = Number.MAX_VALUE, c = 0;
19587
+ return a.forEach((g, S) => {
19588
+ Math.abs(g - r) < o && (o = Math.abs(g - r), c = S);
19589
+ }), i[c][1];
19587
19590
  };
19588
19591
  var pe = /* @__PURE__ */ ((s) => (s.WEBCAM = "webcam", s.WEBCAM_BACKUP = "webcam_backup", s.MIC = "mic", s.SCREENSHARE_VIDEO = "screenshare_video", s.SCREENSHARE_AUDIO = "screenshare_audio", s))(pe || {});
19589
19592
  const tD = _P(), Tn = bs(
@@ -26328,7 +26331,9 @@ class aO {
26328
26331
  consumers: e
26329
26332
  }
26330
26333
  }, i = yield this.recvTransport.sendDataChannelMessage("events", r), { failedConsumers: a } = i;
26331
- return { failedConsumers: a };
26334
+ return t.forEach((o) => {
26335
+ a != null && a.includes(o.id) || o.close(void 0, false);
26336
+ }), { failedConsumers: a };
26332
26337
  });
26333
26338
  }
26334
26339
  switchConsumersToLayer(t, e) {
@@ -27205,28 +27210,29 @@ const MS = (Eu = class {
27205
27210
  }
27206
27211
  _shareWebcam(s, t) {
27207
27212
  return u(this, null, function* () {
27213
+ var S, v;
27208
27214
  const e = t === "video/VP9" ? pe.WEBCAM : pe.WEBCAM_BACKUP, r = V(this, tt, gt).call(this, e);
27209
27215
  if (r) {
27210
- const p = yield r;
27211
- if (n(this, W).producers.has(p)) {
27212
- const g = n(this, W).producers.get(p);
27213
- if (!g.closed)
27214
- return yield g.replaceTrack({ track: s }), yield this.resumeWebcam(e), s;
27216
+ const _ = yield r;
27217
+ if (n(this, W).producers.has(_)) {
27218
+ const P = n(this, W).producers.get(_);
27219
+ if (!P.closed)
27220
+ return yield P.replaceTrack({ track: s }), yield this.resumeWebcam(e), s;
27215
27221
  yield this.disableWebcam(t);
27216
27222
  }
27217
27223
  return this._shareWebcam(s, t);
27218
27224
  }
27219
- const i = [t].concat(Nt.filter((p) => p !== t)), a = V(this, Dl, HS).call(this, s, i), o = Ha(this.context, "disableSimulcast"), c = n(this, Hs) === be.CF ? Z.ENABLE_CF_SIMULCAST : Z.ENABLE_HIVE_SIMULCAST;
27220
- !o && this.context.getValue("flagsmith").hasFeature(c) ? (this.logger.info(`Simulcast enabled for SFU: ${n(this, Hs)}`), a.encodings = eD(this.context, s)) : this.logger.info(`Simulcast disabled for webcam producer, SFU: ${n(this, Hs)}`), this.context.getValue("flagsmith").hasFeature(Z.TRACK_HINT) && (a.track.contentHint = this.context.getValue("flagsmith").getValue(
27225
+ const i = [t].concat(Nt.filter((_) => _ !== t)), a = V(this, Dl, HS).call(this, s, i), o = Ha(this.context, "disableSimulcast"), c = (v = (S = this.context) == null ? void 0 : S.getValue("overrides")) == null ? void 0 : v.simulcastConfig, d = o || c && c.disable, l = n(this, Hs) === be.CF ? Z.ENABLE_CF_SIMULCAST : Z.ENABLE_HIVE_SIMULCAST;
27226
+ !d && this.context.getValue("flagsmith").hasFeature(l) ? (this.logger.info(`Simulcast enabled for SFU: ${n(this, Hs)}`), a.encodings = eD(this.context, s)) : this.logger.info(`Simulcast disabled for webcam producer, SFU: ${n(this, Hs)}`), this.context.getValue("flagsmith").hasFeature(Z.TRACK_HINT) && (a.track.contentHint = this.context.getValue("flagsmith").getValue(
27221
27227
  Z.TRACK_HINT
27222
27228
  ));
27223
- const d = () => {
27229
+ const p = () => {
27224
27230
  this.logger.info("Disabling video due to the producer closure"), n(this, Tt).delete(e);
27225
- }, l = n(this, W).createProducer(
27231
+ }, g = n(this, W).createProducer(
27226
27232
  a,
27227
- d
27233
+ p
27228
27234
  );
27229
- return V(this, en, Eo).call(this, e, l.then((p) => p.id)), l.then((p) => p.track);
27235
+ return V(this, en, Eo).call(this, e, g.then((_) => _.id)), g.then((_) => _.track);
27230
27236
  });
27231
27237
  }
27232
27238
  shareWebcam(s) {
@@ -30682,7 +30688,7 @@ let ii = (em = class {
30682
30688
  video: true
30683
30689
  };
30684
30690
  return a.setValue("options", e), a.setValue("peerId", t), a.setValue("modules", o), a.setValue("sdkName", "web-core"), a.setValue("meetingId", r), a.setValue("apiBase", i.apiBase), a.setValue("baseURI", i.baseURI), a.setValue("userId", i.participantId), a.setValue("organizationId", i.orgId), a.setValue("authToken", e.authToken), a.setValue("overrides", (d = e.overrides) != null ? d : {}), a.setValue("env", TR({ baseURI: i.baseURI })), a.setValue("defaults", c), a.setValue("onError", e.onError || (() => {
30685
- })), a.setValue("cachedUserDetails", bs(e.cachedUserDetails)), a.setValue("sdkVersion", "3.2.0-staging.15"), (l = e.modules) != null && l.experimentalAudioPlayback && a.setValue("audioPlayback", new i1()), a;
30691
+ })), a.setValue("cachedUserDetails", bs(e.cachedUserDetails)), a.setValue("sdkVersion", "3.2.0-staging.17"), (l = e.modules) != null && l.experimentalAudioPlayback && a.setValue("audioPlayback", new i1()), a;
30686
30692
  }
30687
30693
  join() {
30688
30694
  return u(this, null, function* () {