@reactor-team/js-sdk 2.12.2 → 2.12.3

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.mts CHANGED
@@ -194,6 +194,9 @@ interface ConnectOptions {
194
194
  * to keep recvonly tracks paused on connect and resume them individually via
195
195
  * `resumeTrack()` (e.g. multi-connection apps that only subscribe to a
196
196
  * subset of peers).
197
+ *
198
+ * A track that arrives after that is resumed on its own, so one track
199
+ * appearing never disturbs another the caller has paused.
197
200
  */
198
201
  autoResumeTracks?: boolean;
199
202
  /**
@@ -822,6 +825,8 @@ declare class Reactor {
822
825
  unpublishTrack(name: string): Promise<void>;
823
826
  pauseTrack(name: string): void;
824
827
  resumeTrack(name: string): void;
828
+ /** Whether `name` is a track this client receives rather than sends. */
829
+ private isRecvonly;
825
830
  /**
826
831
  * Reconnects to an existing session with a fresh transport.
827
832
  */
package/dist/index.d.ts CHANGED
@@ -194,6 +194,9 @@ interface ConnectOptions {
194
194
  * to keep recvonly tracks paused on connect and resume them individually via
195
195
  * `resumeTrack()` (e.g. multi-connection apps that only subscribe to a
196
196
  * subset of peers).
197
+ *
198
+ * A track that arrives after that is resumed on its own, so one track
199
+ * appearing never disturbs another the caller has paused.
197
200
  */
198
201
  autoResumeTracks?: boolean;
199
202
  /**
@@ -822,6 +825,8 @@ declare class Reactor {
822
825
  unpublishTrack(name: string): Promise<void>;
823
826
  pauseTrack(name: string): void;
824
827
  resumeTrack(name: string): void;
828
+ /** Whether `name` is a track this client receives rather than sends. */
829
+ private isRecvonly;
825
830
  /**
826
831
  * Reconnects to an existing session with a fresh transport.
827
832
  */
package/dist/index.js CHANGED
@@ -162,7 +162,7 @@ var import_zod = require("zod");
162
162
  // package.json
163
163
  var package_default = {
164
164
  name: "@reactor-team/js-sdk",
165
- version: "2.12.2",
165
+ version: "2.12.3",
166
166
  description: "Reactor JavaScript frontend SDK \u2014 connect React and TypeScript apps to real-time AI video models on Reactor.",
167
167
  license: "Apache-2.0",
168
168
  repository: {
@@ -3316,6 +3316,12 @@ var Reactor = class {
3316
3316
  var _a;
3317
3317
  (_a = this.transportClient) == null ? void 0 : _a.resumeTrack(name);
3318
3318
  }
3319
+ /** Whether `name` is a track this client receives rather than sends. */
3320
+ isRecvonly(name) {
3321
+ return this.tracks.some(
3322
+ (track) => track.name === name && track.direction === "recvonly"
3323
+ );
3324
+ }
3319
3325
  /**
3320
3326
  * Reconnects to an existing session with a fresh transport.
3321
3327
  */
@@ -3547,12 +3553,8 @@ var Reactor = class {
3547
3553
  (name, track, stream) => {
3548
3554
  if (this.transportClient !== client) return;
3549
3555
  this.emit("trackReceived", name, track, stream);
3550
- if (this.autoResumeTracks) {
3551
- for (const track2 of this.tracks) {
3552
- if (track2.direction === "recvonly") {
3553
- this.resumeTrack(track2.name);
3554
- }
3555
- }
3556
+ if (this.autoResumeTracks && this.isRecvonly(name)) {
3557
+ this.resumeTrack(name);
3556
3558
  }
3557
3559
  }
3558
3560
  );