@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.mjs CHANGED
@@ -99,7 +99,7 @@ import { z } from "zod";
99
99
  // package.json
100
100
  var package_default = {
101
101
  name: "@reactor-team/js-sdk",
102
- version: "2.12.2",
102
+ version: "2.12.3",
103
103
  description: "Reactor JavaScript frontend SDK \u2014 connect React and TypeScript apps to real-time AI video models on Reactor.",
104
104
  license: "Apache-2.0",
105
105
  repository: {
@@ -3253,6 +3253,12 @@ var Reactor = class {
3253
3253
  var _a;
3254
3254
  (_a = this.transportClient) == null ? void 0 : _a.resumeTrack(name);
3255
3255
  }
3256
+ /** Whether `name` is a track this client receives rather than sends. */
3257
+ isRecvonly(name) {
3258
+ return this.tracks.some(
3259
+ (track) => track.name === name && track.direction === "recvonly"
3260
+ );
3261
+ }
3256
3262
  /**
3257
3263
  * Reconnects to an existing session with a fresh transport.
3258
3264
  */
@@ -3484,12 +3490,8 @@ var Reactor = class {
3484
3490
  (name, track, stream) => {
3485
3491
  if (this.transportClient !== client) return;
3486
3492
  this.emit("trackReceived", name, track, stream);
3487
- if (this.autoResumeTracks) {
3488
- for (const track2 of this.tracks) {
3489
- if (track2.direction === "recvonly") {
3490
- this.resumeTrack(track2.name);
3491
- }
3492
- }
3493
+ if (this.autoResumeTracks && this.isRecvonly(name)) {
3494
+ this.resumeTrack(name);
3493
3495
  }
3494
3496
  }
3495
3497
  );