@signalwire/js 4.0.0-dev-20260914201232 → 4.0.0-dev-20260915135732

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
@@ -3719,22 +3719,31 @@ var SelfParticipant = class extends Participant {
3719
3719
  this.deviceController.selectAudioInputDevice(device);
3720
3720
  if (options.savePreference) PreferencesContainer.instance.preferredAudioInput = device;
3721
3721
  }
3722
- /** Updates the audio input track constraints for the active call. */
3722
+ /**
3723
+ * Updates the audio input track constraints for the active call.
3724
+ * @returns whether the constraints reached the media the call is sending.
3725
+ */
3723
3726
  async setAudioInputDeviceConstraints(constraints) {
3724
- await this.vertoManager.updateMediaConstraints({ audio: constraints });
3727
+ return this.vertoManager.updateMediaConstraints({ audio: constraints });
3725
3728
  }
3726
- /** Updates both audio and video input track constraints for the active call. */
3729
+ /**
3730
+ * Updates both audio and video input track constraints for the active call.
3731
+ * @returns whether both kinds took the constraints.
3732
+ */
3727
3733
  async setInputDevicesConstraints(constraints) {
3728
- await this.vertoManager.updateMediaConstraints(constraints);
3734
+ return this.vertoManager.updateMediaConstraints(constraints);
3729
3735
  }
3730
3736
  /** Selects the video input device for future calls. Optionally saves as a preference. */
3731
3737
  selectVideoInputDevice(device, options = {}) {
3732
3738
  this.deviceController.selectVideoInputDevice(device);
3733
3739
  if (options.savePreference) PreferencesContainer.instance.preferredVideoInput = device;
3734
3740
  }
3735
- /** Updates the video input track constraints for the active call. */
3741
+ /**
3742
+ * Updates the video input track constraints for the active call.
3743
+ * @returns whether the constraints reached the media the call is sending.
3744
+ */
3736
3745
  async setVideoInputDeviceConstraints(constraints) {
3737
- await this.vertoManager.updateMediaConstraints({ video: constraints });
3746
+ return this.vertoManager.updateMediaConstraints({ video: constraints });
3738
3747
  }
3739
3748
  /** Selects the audio output device. Optionally saves as a preference. */
3740
3749
  selectAudioOutputDevice(device, options = {}) {
@@ -5414,10 +5423,7 @@ var RTCPeerConnectionController = class extends Destroyable {
5414
5423
  }
5415
5424
  stopRawAudioInputForPipeline() {
5416
5425
  const rawTracks = this.localStreamController.localAudioTracks;
5417
- for (const track of rawTracks) if (track.readyState === "live") {
5418
- track.stop();
5419
- this.localStreamController.removeTrack(track.id);
5420
- }
5426
+ for (const track of rawTracks) if (track.readyState === "live") this.localStreamController.removeTrack(track.id);
5421
5427
  this._localAudioPipeline?.setInputTrack(null);
5422
5428
  }
5423
5429
  get isNegotiating$() {
@@ -6187,7 +6193,13 @@ var RTCPeerConnectionController = class extends Destroyable {
6187
6193
  * carries.
6188
6194
  */
6189
6195
  async updateSendersConstraints(kind, constraints) {
6190
- if (kind === "audio" && constraints && this._localAudioPipeline) return this.applyPipelineSourceConstraints(constraints);
6196
+ if (kind === "audio" && this._localAudioPipeline) {
6197
+ if (!constraints) {
6198
+ this.stopTrackSender("audio");
6199
+ return false;
6200
+ }
6201
+ return this.applyPipelineSourceConstraints(constraints);
6202
+ }
6191
6203
  return await this.transceiverController?.updateSendersConstraints(kind, constraints) ?? false;
6192
6204
  }
6193
6205
  /**
@@ -6634,16 +6646,25 @@ var WebRTCVertoManager = class extends VertoManager {
6634
6646
  this.onError?.(new VertoPongError(error));
6635
6647
  }
6636
6648
  }
6649
+ /**
6650
+ * @returns whether the constraints reached the media the call is sending.
6651
+ * `false` is an outcome, not a failure: the leg may have no live sender of
6652
+ * the kind, or carry media the SDK did not capture and may not replace.
6653
+ * A failure behind it still reaches the call's `errors$`, so a caller that
6654
+ * ignores this value learns of it there.
6655
+ */
6637
6656
  async updateMediaConstraints(options = {}) {
6638
6657
  const { audio, video } = options;
6658
+ let applied = true;
6639
6659
  try {
6640
- if (audio) await this.mainPeerConnection.updateSendersConstraints("audio", audio);
6641
- if (video) await this.mainPeerConnection.updateSendersConstraints("video", video);
6660
+ if (audio) applied = await this.mainPeerConnection.updateSendersConstraints("audio", audio) && applied;
6661
+ if (video) applied = await this.mainPeerConnection.updateSendersConstraints("video", video) && applied;
6642
6662
  } catch (error) {
6643
6663
  logger$16.warn("[WebRTCManager] Error updating media constraints:", error);
6644
6664
  this.reportLegError(toError(error), this.mainPeerConnection);
6645
6665
  throw error;
6646
6666
  }
6667
+ return applied;
6647
6668
  }
6648
6669
  get selfId() {
6649
6670
  return this._selfId$.value;
@@ -9204,17 +9225,28 @@ var WebRTCCall = class extends Destroyable {
9204
9225
  * (notably iOS Safari) fall back to re-acquiring the track with the new
9205
9226
  * constraint set and plumbing the replacement through the local audio
9206
9227
  * pipeline if one is active.
9228
+ *
9229
+ * @returns whether the constraint reached the microphone. `false` is an
9230
+ * outcome rather than an error — a leg sending media the SDK did not capture
9231
+ * is left alone — so a UI that reflects the toggle must read it. Any failure
9232
+ * behind a `false` is also reported on {@link errors$}.
9207
9233
  */
9208
9234
  async setEchoCancellation(enabled) {
9209
- await this.vertoManager.updateMediaConstraints({ audio: { echoCancellation: enabled } });
9235
+ return this.vertoManager.updateMediaConstraints({ audio: { echoCancellation: enabled } });
9210
9236
  }
9211
- /** Toggle browser noise suppression on the local mic at runtime. */
9237
+ /**
9238
+ * Toggle browser noise suppression on the local mic at runtime.
9239
+ * @returns whether the constraint reached the microphone.
9240
+ */
9212
9241
  async setNoiseSuppression(enabled) {
9213
- await this.vertoManager.updateMediaConstraints({ audio: { noiseSuppression: enabled } });
9242
+ return this.vertoManager.updateMediaConstraints({ audio: { noiseSuppression: enabled } });
9214
9243
  }
9215
- /** Toggle browser automatic gain control on the local mic at runtime. */
9244
+ /**
9245
+ * Toggle browser automatic gain control on the local mic at runtime.
9246
+ * @returns whether the constraint reached the microphone.
9247
+ */
9216
9248
  async setAutoGainControl(enabled) {
9217
- await this.vertoManager.updateMediaConstraints({ audio: { autoGainControl: enabled } });
9249
+ return this.vertoManager.updateMediaConstraints({ audio: { autoGainControl: enabled } });
9218
9250
  }
9219
9251
  /**
9220
9252
  * Observable of the aggregate remote audio level, 0..1 RMS. The server
@@ -12326,7 +12358,7 @@ var SignalWire = class extends Destroyable {
12326
12358
  logger$1.warn("[SignalWire] Failed to initialize VisibilityController:", error);
12327
12359
  }
12328
12360
  try {
12329
- this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-dev-20260914201232" });
12361
+ this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-dev-20260915135732" });
12330
12362
  } catch (error) {
12331
12363
  logger$1.warn("[SignalWire] Failed to initialize DiagnosticsCollector:", error);
12332
12364
  }
@@ -12880,7 +12912,7 @@ var StaticCredentialProvider = class {
12880
12912
  /**
12881
12913
  * Library version from package.json, injected at build time.
12882
12914
  */
12883
- const version = "4.0.0-dev-20260914201232";
12915
+ const version = "4.0.0-dev-20260915135732";
12884
12916
  /**
12885
12917
  * Flag indicating the library has been loaded and is ready to use.
12886
12918
  * For UMD builds: `window.SignalWire.ready`
@@ -12902,7 +12934,7 @@ const ready = true;
12902
12934
  */
12903
12935
  const emitReadyEvent = () => {
12904
12936
  if (typeof window !== "undefined") {
12905
- const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-dev-20260914201232" } });
12937
+ const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-dev-20260915135732" } });
12906
12938
  window.dispatchEvent(event);
12907
12939
  }
12908
12940
  };