@cloudflare/realtimekit 1.2.0-staging.16 → 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(
@@ -27207,28 +27210,29 @@ const MS = (Eu = class {
27207
27210
  }
27208
27211
  _shareWebcam(s, t) {
27209
27212
  return u(this, null, function* () {
27213
+ var S, v;
27210
27214
  const e = t === "video/VP9" ? pe.WEBCAM : pe.WEBCAM_BACKUP, r = V(this, tt, gt).call(this, e);
27211
27215
  if (r) {
27212
- const p = yield r;
27213
- if (n(this, W).producers.has(p)) {
27214
- const g = n(this, W).producers.get(p);
27215
- if (!g.closed)
27216
- 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;
27217
27221
  yield this.disableWebcam(t);
27218
27222
  }
27219
27223
  return this._shareWebcam(s, t);
27220
27224
  }
27221
- 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;
27222
- !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(
27223
27227
  Z.TRACK_HINT
27224
27228
  ));
27225
- const d = () => {
27229
+ const p = () => {
27226
27230
  this.logger.info("Disabling video due to the producer closure"), n(this, Tt).delete(e);
27227
- }, l = n(this, W).createProducer(
27231
+ }, g = n(this, W).createProducer(
27228
27232
  a,
27229
- d
27233
+ p
27230
27234
  );
27231
- 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);
27232
27236
  });
27233
27237
  }
27234
27238
  shareWebcam(s) {
@@ -30684,7 +30688,7 @@ let ii = (em = class {
30684
30688
  video: true
30685
30689
  };
30686
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 || (() => {
30687
- })), a.setValue("cachedUserDetails", bs(e.cachedUserDetails)), a.setValue("sdkVersion", "3.2.0-staging.16"), (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;
30688
30692
  }
30689
30693
  join() {
30690
30694
  return u(this, null, function* () {