@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/browser.mjs CHANGED
@@ -14336,22 +14336,31 @@ var SelfParticipant = class extends Participant {
14336
14336
  this.deviceController.selectAudioInputDevice(device);
14337
14337
  if (options.savePreference) PreferencesContainer.instance.preferredAudioInput = device;
14338
14338
  }
14339
- /** Updates the audio input track constraints for the active call. */
14339
+ /**
14340
+ * Updates the audio input track constraints for the active call.
14341
+ * @returns whether the constraints reached the media the call is sending.
14342
+ */
14340
14343
  async setAudioInputDeviceConstraints(constraints) {
14341
- await this.vertoManager.updateMediaConstraints({ audio: constraints });
14344
+ return this.vertoManager.updateMediaConstraints({ audio: constraints });
14342
14345
  }
14343
- /** Updates both audio and video input track constraints for the active call. */
14346
+ /**
14347
+ * Updates both audio and video input track constraints for the active call.
14348
+ * @returns whether both kinds took the constraints.
14349
+ */
14344
14350
  async setInputDevicesConstraints(constraints) {
14345
- await this.vertoManager.updateMediaConstraints(constraints);
14351
+ return this.vertoManager.updateMediaConstraints(constraints);
14346
14352
  }
14347
14353
  /** Selects the video input device for future calls. Optionally saves as a preference. */
14348
14354
  selectVideoInputDevice(device, options = {}) {
14349
14355
  this.deviceController.selectVideoInputDevice(device);
14350
14356
  if (options.savePreference) PreferencesContainer.instance.preferredVideoInput = device;
14351
14357
  }
14352
- /** Updates the video input track constraints for the active call. */
14358
+ /**
14359
+ * Updates the video input track constraints for the active call.
14360
+ * @returns whether the constraints reached the media the call is sending.
14361
+ */
14353
14362
  async setVideoInputDeviceConstraints(constraints) {
14354
- await this.vertoManager.updateMediaConstraints({ video: constraints });
14363
+ return this.vertoManager.updateMediaConstraints({ video: constraints });
14355
14364
  }
14356
14365
  /** Selects the audio output device. Optionally saves as a preference. */
14357
14366
  selectAudioOutputDevice(device, options = {}) {
@@ -16169,10 +16178,7 @@ var RTCPeerConnectionController = class extends Destroyable {
16169
16178
  }
16170
16179
  stopRawAudioInputForPipeline() {
16171
16180
  const rawTracks = this.localStreamController.localAudioTracks;
16172
- for (const track of rawTracks) if (track.readyState === "live") {
16173
- track.stop();
16174
- this.localStreamController.removeTrack(track.id);
16175
- }
16181
+ for (const track of rawTracks) if (track.readyState === "live") this.localStreamController.removeTrack(track.id);
16176
16182
  this._localAudioPipeline?.setInputTrack(null);
16177
16183
  }
16178
16184
  get isNegotiating$() {
@@ -16942,7 +16948,13 @@ var RTCPeerConnectionController = class extends Destroyable {
16942
16948
  * carries.
16943
16949
  */
16944
16950
  async updateSendersConstraints(kind, constraints) {
16945
- if (kind === "audio" && constraints && this._localAudioPipeline) return this.applyPipelineSourceConstraints(constraints);
16951
+ if (kind === "audio" && this._localAudioPipeline) {
16952
+ if (!constraints) {
16953
+ this.stopTrackSender("audio");
16954
+ return false;
16955
+ }
16956
+ return this.applyPipelineSourceConstraints(constraints);
16957
+ }
16946
16958
  return await this.transceiverController?.updateSendersConstraints(kind, constraints) ?? false;
16947
16959
  }
16948
16960
  /**
@@ -17390,16 +17402,25 @@ var WebRTCVertoManager = class extends VertoManager {
17390
17402
  this.onError?.(new VertoPongError(error));
17391
17403
  }
17392
17404
  }
17405
+ /**
17406
+ * @returns whether the constraints reached the media the call is sending.
17407
+ * `false` is an outcome, not a failure: the leg may have no live sender of
17408
+ * the kind, or carry media the SDK did not capture and may not replace.
17409
+ * A failure behind it still reaches the call's `errors$`, so a caller that
17410
+ * ignores this value learns of it there.
17411
+ */
17393
17412
  async updateMediaConstraints(options = {}) {
17394
17413
  const { audio, video } = options;
17414
+ let applied = true;
17395
17415
  try {
17396
- if (audio) await this.mainPeerConnection.updateSendersConstraints("audio", audio);
17397
- if (video) await this.mainPeerConnection.updateSendersConstraints("video", video);
17416
+ if (audio) applied = await this.mainPeerConnection.updateSendersConstraints("audio", audio) && applied;
17417
+ if (video) applied = await this.mainPeerConnection.updateSendersConstraints("video", video) && applied;
17398
17418
  } catch (error) {
17399
17419
  logger$16.warn("[WebRTCManager] Error updating media constraints:", error);
17400
17420
  this.reportLegError(toError(error), this.mainPeerConnection);
17401
17421
  throw error;
17402
17422
  }
17423
+ return applied;
17403
17424
  }
17404
17425
  get selfId() {
17405
17426
  return this._selfId$.value;
@@ -19958,17 +19979,28 @@ var WebRTCCall = class extends Destroyable {
19958
19979
  * (notably iOS Safari) fall back to re-acquiring the track with the new
19959
19980
  * constraint set and plumbing the replacement through the local audio
19960
19981
  * pipeline if one is active.
19982
+ *
19983
+ * @returns whether the constraint reached the microphone. `false` is an
19984
+ * outcome rather than an error — a leg sending media the SDK did not capture
19985
+ * is left alone — so a UI that reflects the toggle must read it. Any failure
19986
+ * behind a `false` is also reported on {@link errors$}.
19961
19987
  */
19962
19988
  async setEchoCancellation(enabled) {
19963
- await this.vertoManager.updateMediaConstraints({ audio: { echoCancellation: enabled } });
19989
+ return this.vertoManager.updateMediaConstraints({ audio: { echoCancellation: enabled } });
19964
19990
  }
19965
- /** Toggle browser noise suppression on the local mic at runtime. */
19991
+ /**
19992
+ * Toggle browser noise suppression on the local mic at runtime.
19993
+ * @returns whether the constraint reached the microphone.
19994
+ */
19966
19995
  async setNoiseSuppression(enabled) {
19967
- await this.vertoManager.updateMediaConstraints({ audio: { noiseSuppression: enabled } });
19996
+ return this.vertoManager.updateMediaConstraints({ audio: { noiseSuppression: enabled } });
19968
19997
  }
19969
- /** Toggle browser automatic gain control on the local mic at runtime. */
19998
+ /**
19999
+ * Toggle browser automatic gain control on the local mic at runtime.
20000
+ * @returns whether the constraint reached the microphone.
20001
+ */
19970
20002
  async setAutoGainControl(enabled) {
19971
- await this.vertoManager.updateMediaConstraints({ audio: { autoGainControl: enabled } });
20003
+ return this.vertoManager.updateMediaConstraints({ audio: { autoGainControl: enabled } });
19972
20004
  }
19973
20005
  /**
19974
20006
  * Observable of the aggregate remote audio level, 0..1 RMS. The server
@@ -23090,7 +23122,7 @@ var SignalWire = class extends Destroyable {
23090
23122
  logger$1.warn("[SignalWire] Failed to initialize VisibilityController:", error);
23091
23123
  }
23092
23124
  try {
23093
- this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-dev-20260914201232" });
23125
+ this._diagnosticsCollector = new DiagnosticsCollector({ sdkVersion: "4.0.0-dev-20260915135732" });
23094
23126
  } catch (error) {
23095
23127
  logger$1.warn("[SignalWire] Failed to initialize DiagnosticsCollector:", error);
23096
23128
  }
@@ -23645,7 +23677,7 @@ var StaticCredentialProvider = class {
23645
23677
  /**
23646
23678
  * Library version from package.json, injected at build time.
23647
23679
  */
23648
- const version = "4.0.0-dev-20260914201232";
23680
+ const version = "4.0.0-dev-20260915135732";
23649
23681
  /**
23650
23682
  * Flag indicating the library has been loaded and is ready to use.
23651
23683
  * For UMD builds: `window.SignalWire.ready`
@@ -23667,7 +23699,7 @@ const ready = true;
23667
23699
  */
23668
23700
  const emitReadyEvent = () => {
23669
23701
  if (typeof window !== "undefined") {
23670
- const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-dev-20260914201232" } });
23702
+ const event = new CustomEvent("signalwire:js:ready", { detail: { version: "4.0.0-dev-20260915135732" } });
23671
23703
  window.dispatchEvent(event);
23672
23704
  }
23673
23705
  };