@signalwire/js 4.0.0-dev-20260429174756 → 4.0.0-dev-20260503235343

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.
@@ -15260,6 +15260,8 @@ var LocalStreamController = class extends Destroyable {
15260
15260
  logger$18.debug("[LocalStreamController] User media obtained:", stream);
15261
15261
  }
15262
15262
  this._localStream$.next(stream);
15263
+ this._localAudioTracks$.next(stream.getAudioTracks());
15264
+ this._localVideoTracks$.next(stream.getVideoTracks());
15263
15265
  return stream;
15264
15266
  }
15265
15267
  /**
@@ -15427,6 +15429,12 @@ var TransceiverController = class extends Destroyable {
15427
15429
  scaleResolutionDownBy: Number(rid) * 6 || 1
15428
15430
  }));
15429
15431
  }
15432
+ /**
15433
+ * Resolve the current MediaTrackConstraints for an input kind, normalising
15434
+ * boolean shorthand to an empty object. Public so the surrounding
15435
+ * RTCPeerConnectionController can drive its own pipeline-aware getUserMedia
15436
+ * call with the same effective constraints the transceiver would have used.
15437
+ */
15430
15438
  getConstraintsFor(kind) {
15431
15439
  const constraints = kind === "audio" ? this.inputAudioDeviceConstraints : this.inputVideoDeviceConstraints;
15432
15440
  return typeof constraints === "boolean" ? {} : constraints;
@@ -15753,7 +15761,19 @@ var RTCPeerConnectionController = class extends Destroyable {
15753
15761
  return this._memberId;
15754
15762
  }
15755
15763
  stopTrackSender(kind, options = { updateTransceiverDirection: false }) {
15756
- this.transceiverController?.stopTrackSender(kind, options);
15764
+ const audioCovered = kind === "audio" || kind === "both";
15765
+ if (audioCovered && this._localAudioPipeline) this.stopRawAudioInputForPipeline();
15766
+ if (!audioCovered) this.transceiverController?.stopTrackSender(kind, options);
15767
+ else if (kind === "both") this.transceiverController?.stopTrackSender("video", options);
15768
+ else if (!this._localAudioPipeline) this.transceiverController?.stopTrackSender(kind, options);
15769
+ }
15770
+ stopRawAudioInputForPipeline() {
15771
+ const rawTracks = this.localStreamController.localAudioTracks;
15772
+ for (const track of rawTracks) if (track.readyState === "live") {
15773
+ track.stop();
15774
+ this.localStreamController.removeTrack(track.id);
15775
+ }
15776
+ this._localAudioPipeline?.setInputTrack(null);
15757
15777
  }
15758
15778
  get isNegotiating$() {
15759
15779
  return this._isNegotiating$.asObservable();
@@ -16258,8 +16278,27 @@ var RTCPeerConnectionController = class extends Destroyable {
16258
16278
  await this.transceiverController?.setupRemoteTransceivers(this.type);
16259
16279
  }
16260
16280
  async restoreTrackSender(kind) {
16261
- await this.transceiverController?.restoreTrackSender(kind);
16262
- if (kind !== "video" && this._localAudioPipeline) await this.applyLocalAudioPipelineToSender();
16281
+ const audioCovered = kind === "audio" || kind === "both";
16282
+ if (audioCovered && this._localAudioPipeline) await this.restoreRawAudioInputForPipeline();
16283
+ if (!audioCovered) await this.transceiverController?.restoreTrackSender(kind);
16284
+ else if (kind === "both") await this.transceiverController?.restoreTrackSender("video");
16285
+ else if (!this._localAudioPipeline) await this.transceiverController?.restoreTrackSender(kind);
16286
+ }
16287
+ async restoreRawAudioInputForPipeline() {
16288
+ if (!this._localAudioPipeline) return;
16289
+ const constraints = this.transceiverController?.getConstraintsFor("audio") ?? {};
16290
+ let stream;
16291
+ try {
16292
+ stream = await this.getUserMedia({ audio: constraints });
16293
+ } catch (error) {
16294
+ logger$16.error("[RTCPeerConnectionController] Failed to re-acquire mic for pipeline restore:", error);
16295
+ this._errors$.next(toError(error));
16296
+ return;
16297
+ }
16298
+ const newTrack = stream.getAudioTracks().at(0);
16299
+ if (!newTrack) return;
16300
+ this.localStreamController.addTrack(newTrack);
16301
+ this._localAudioPipeline.setInputTrack(newTrack);
16263
16302
  }
16264
16303
  /**
16265
16304
  * Return the lazily-created {@link LocalAudioPipeline}, constructing it on