@signalwire/js 4.0.0-dev-20260911135809 → 4.0.0-dev-20260911173516
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 +66 -14
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +67 -13
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +38 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -9
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +40 -9
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +37 -15
- package/dist/index.mjs.map +1 -1
- package/dist/operators/index.cjs +1 -1
- package/dist/operators/index.mjs +1 -1
- package/dist/{operators-GSyCbUIU.mjs → operators-B0xqG7Eu.mjs} +32 -2
- package/dist/operators-B0xqG7Eu.mjs.map +1 -0
- package/dist/{operators-B3G5z2B1.cjs → operators-Cgz7QUVJ.cjs} +43 -1
- package/dist/operators-Cgz7QUVJ.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/operators-B3G5z2B1.cjs.map +0 -1
- package/dist/operators-GSyCbUIU.mjs.map +0 -1
package/dist/browser.umd.js
CHANGED
|
@@ -9411,6 +9411,20 @@ var AuxiliaryLegTimeoutError = class extends Error {
|
|
|
9411
9411
|
this.name = "AuxiliaryLegTimeoutError";
|
|
9412
9412
|
}
|
|
9413
9413
|
};
|
|
9414
|
+
/**
|
|
9415
|
+
* An auxiliary leg was removed before it finished connecting.
|
|
9416
|
+
*
|
|
9417
|
+
* Typed rather than a bare resolve so a caller awaiting the start can tell a
|
|
9418
|
+
* cancel apart from a share that actually came up — the public methods return
|
|
9419
|
+
* `void`, so the promise is the only signal they have.
|
|
9420
|
+
*/
|
|
9421
|
+
var AuxiliaryLegCancelledError = class extends Error {
|
|
9422
|
+
constructor(leg) {
|
|
9423
|
+
super(`The ${leg} leg was removed before it finished connecting`);
|
|
9424
|
+
this.leg = leg;
|
|
9425
|
+
this.name = "AuxiliaryLegCancelledError";
|
|
9426
|
+
}
|
|
9427
|
+
};
|
|
9414
9428
|
var MediaTrackError = class extends Error {
|
|
9415
9429
|
constructor(operation, kind, originalError) {
|
|
9416
9430
|
super(`Media track ${operation} failed for ${kind}`, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
@@ -9447,6 +9461,22 @@ var MediaAccessError = class extends Error {
|
|
|
9447
9461
|
return isMediaAccessDenial(this.originalError);
|
|
9448
9462
|
}
|
|
9449
9463
|
};
|
|
9464
|
+
/**
|
|
9465
|
+
* Thrown by `startScreenShare()` when the call is already sharing a screen.
|
|
9466
|
+
*
|
|
9467
|
+
* A call carries at most one screen share. Accepting a second one would
|
|
9468
|
+
* overwrite the only reference the SDK holds to the first, leaving it
|
|
9469
|
+
* capturing and sending with no way to stop it — so the second request is
|
|
9470
|
+
* rejected and the live share is left untouched. Call `stopScreenShare()`
|
|
9471
|
+
* first to replace it.
|
|
9472
|
+
*/
|
|
9473
|
+
var ScreenShareAlreadyActiveError = class extends Error {
|
|
9474
|
+
constructor(screenShareId, options) {
|
|
9475
|
+
super(`A screen share is already active on this call (${screenShareId}). Call stopScreenShare() before starting another one.`, options);
|
|
9476
|
+
this.screenShareId = screenShareId;
|
|
9477
|
+
this.name = "ScreenShareAlreadyActiveError";
|
|
9478
|
+
}
|
|
9479
|
+
};
|
|
9450
9480
|
var DPoPInitError = class extends Error {
|
|
9451
9481
|
constructor(originalError, message = "Failed to initialize DPoP key pair") {
|
|
9452
9482
|
super(message, { cause: originalError instanceof Error ? originalError : void 0 });
|
|
@@ -14219,11 +14249,15 @@ var SelfParticipant = class extends Participant {
|
|
|
14219
14249
|
/**
|
|
14220
14250
|
* Starts sharing the local screen.
|
|
14221
14251
|
*
|
|
14222
|
-
*
|
|
14252
|
+
* A call carries at most one screen share. Read `screenShareStatus` before
|
|
14253
|
+
* calling and treat `'starting'`/`'stopping'` as busy.
|
|
14223
14254
|
*
|
|
14224
|
-
*
|
|
14225
|
-
* promise pending until the call ends, so do not gate UI on it.
|
|
14255
|
+
* The call is unaffected when acquisition fails.
|
|
14226
14256
|
*
|
|
14257
|
+
* @throws {ScreenShareAlreadyActiveError} When this call is already
|
|
14258
|
+
* sharing a screen. Call {@link stopScreenShare} before starting another.
|
|
14259
|
+
* @throws {AuxiliaryLegCancelledError} When {@link stopScreenShare} removes
|
|
14260
|
+
* the share before its leg finishes connecting.
|
|
14227
14261
|
* @throws The raw `getDisplayMedia` error. A dismissed picker or a
|
|
14228
14262
|
* permission denial rejects with a `NotAllowedError` `DOMException` —
|
|
14229
14263
|
* inspect `error.name` to tell benign cancels apart from real failures.
|
|
@@ -14232,7 +14266,8 @@ var SelfParticipant = class extends Participant {
|
|
|
14232
14266
|
try {
|
|
14233
14267
|
await this.vertoManager.addScreenMedia();
|
|
14234
14268
|
} catch (error) {
|
|
14235
|
-
logger$25.
|
|
14269
|
+
if (error instanceof AuxiliaryLegCancelledError) logger$25.debug("[Participant.startScreenShare] Screen share cancelled before connecting.");
|
|
14270
|
+
else logger$25.error("[Participant.startScreenShare] Screen share error:", error);
|
|
14236
14271
|
throw error;
|
|
14237
14272
|
}
|
|
14238
14273
|
}
|
|
@@ -14253,9 +14288,8 @@ var SelfParticipant = class extends Participant {
|
|
|
14253
14288
|
*
|
|
14254
14289
|
* The call is unaffected when acquisition fails.
|
|
14255
14290
|
*
|
|
14256
|
-
*
|
|
14257
|
-
*
|
|
14258
|
-
*
|
|
14291
|
+
* @throws {AuxiliaryLegCancelledError} When {@link removeAdditionalDevice}
|
|
14292
|
+
* removes the device before its leg finishes connecting.
|
|
14259
14293
|
* @throws The raw `getUserMedia` error (e.g. `NotAllowedError` on
|
|
14260
14294
|
* permission denial) — inspect `error.name` to decide how to react — or
|
|
14261
14295
|
* `AuxiliaryLegTimeoutError` if the leg does not connect in time.
|
|
@@ -14264,7 +14298,8 @@ var SelfParticipant = class extends Participant {
|
|
|
14264
14298
|
try {
|
|
14265
14299
|
await this.vertoManager.addInputDevice(options);
|
|
14266
14300
|
} catch (error) {
|
|
14267
|
-
logger$25.
|
|
14301
|
+
if (error instanceof AuxiliaryLegCancelledError) logger$25.debug("[Participant.addAdditionalDevice] Device removed before connecting.");
|
|
14302
|
+
else logger$25.error("[Participant.addAdditionalDevice] Additional device error:", error);
|
|
14268
14303
|
throw error;
|
|
14269
14304
|
}
|
|
14270
14305
|
}
|
|
@@ -16195,6 +16230,9 @@ var RTCPeerConnectionController = class extends Destroyable {
|
|
|
16195
16230
|
get propose() {
|
|
16196
16231
|
return this.options.propose ?? "main";
|
|
16197
16232
|
}
|
|
16233
|
+
get connectionState() {
|
|
16234
|
+
return this.peerConnection?.connectionState;
|
|
16235
|
+
}
|
|
16198
16236
|
get isAdditionalDevice() {
|
|
16199
16237
|
return this.propose === "additional-device";
|
|
16200
16238
|
}
|
|
@@ -17816,6 +17854,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
17816
17854
|
}
|
|
17817
17855
|
async initAdditionalPeerConnection(propose, options) {
|
|
17818
17856
|
const isScreenShare = propose === "screenshare";
|
|
17857
|
+
if (isScreenShare && this._screenShareId && this._rtcPeerConnectionsMap.has(this._screenShareId)) throw new ScreenShareAlreadyActiveError(this._screenShareId);
|
|
17819
17858
|
let firstPeerConnectionError;
|
|
17820
17859
|
let rtcPeerConnController = null;
|
|
17821
17860
|
try {
|
|
@@ -17835,20 +17874,26 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
17835
17874
|
this.reportLegError(error, rtcPeerConnController);
|
|
17836
17875
|
});
|
|
17837
17876
|
const pc = rtcPeerConnController;
|
|
17838
|
-
await (0, import_cjs$15.firstValueFrom)((0, import_cjs$15.merge)(pc.localMediaSettled$.pipe((0, import_cjs$15.take)(1), (0, import_cjs$15.switchMap)(() => pc.connectionState$.pipe((0, import_cjs$15.filter)((state) => state === "connected"), (0, import_cjs$15.take)(1), (0, import_cjs$15.timeout)(DEFAULT_AUX_LEG_CONNECT_TIMEOUT_MS)))), this.legError$(pc.id)).pipe((0, import_cjs$15.takeUntil)(this.destroyed$)));
|
|
17877
|
+
await (0, import_cjs$15.firstValueFrom)((0, import_cjs$15.merge)(pc.localMediaSettled$.pipe((0, import_cjs$15.take)(1), (0, import_cjs$15.switchMap)(() => pc.connectionState$.pipe((0, import_cjs$15.filter)((state) => state === "connected"), (0, import_cjs$15.take)(1), (0, import_cjs$15.timeout)(DEFAULT_AUX_LEG_CONNECT_TIMEOUT_MS)))), this.legError$(pc.id)).pipe((0, import_cjs$15.takeUntil)((0, import_cjs$15.merge)(this.destroyed$, pc.destroyed$))));
|
|
17839
17878
|
if (isScreenShare) this._screenShareStatus$.next("started");
|
|
17840
17879
|
logger$16.info(`[WebRTCManager] Additional peer connection connected (${propose}).`);
|
|
17841
17880
|
return rtcPeerConnController.id;
|
|
17842
17881
|
} catch (error) {
|
|
17843
|
-
|
|
17844
|
-
|
|
17882
|
+
const cancelled = error instanceof AuxiliaryLegCancelledError;
|
|
17883
|
+
const aborted = error instanceof import_cjs$15.EmptyError && !firstPeerConnectionError;
|
|
17884
|
+
if (!cancelled && !aborted) logger$16.warn("[WebRTCManager] Error initializing additional peer connection:", error);
|
|
17885
|
+
if (rtcPeerConnController && this._rtcPeerConnectionsMap.has(rtcPeerConnController.id)) {
|
|
17845
17886
|
rtcPeerConnController.destroy();
|
|
17846
17887
|
this._rtcPeerConnectionsMap.delete(rtcPeerConnController.id);
|
|
17847
17888
|
this._rtcPeerConnections$.next(Array.from(this._rtcPeerConnectionsMap.values()));
|
|
17848
17889
|
}
|
|
17849
17890
|
if (isScreenShare) {
|
|
17850
|
-
this._screenShareStatus$.next("none");
|
|
17851
17891
|
this._screenShareId = void 0;
|
|
17892
|
+
this._screenShareStatus$.next("none");
|
|
17893
|
+
}
|
|
17894
|
+
if (cancelled) {
|
|
17895
|
+
logger$16.debug("[WebRTCManager] Additional peer connection removed before connecting.");
|
|
17896
|
+
throw error;
|
|
17852
17897
|
}
|
|
17853
17898
|
if (firstPeerConnectionError) throw firstPeerConnectionError instanceof MediaAccessError && firstPeerConnectionError.originalError instanceof Error ? firstPeerConnectionError.originalError : firstPeerConnectionError;
|
|
17854
17899
|
if (error instanceof import_cjs$15.EmptyError) {
|
|
@@ -17872,7 +17917,10 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
17872
17917
|
if (removeTrack) return this.mainPeerConnection.stopTrackSender(removeTrack, { updateTransceiverDirection: true });
|
|
17873
17918
|
}
|
|
17874
17919
|
async removeScreenMedia() {
|
|
17875
|
-
if (!["starting", "started"].includes(this._screenShareStatus$.value))
|
|
17920
|
+
if (!["starting", "started"].includes(this._screenShareStatus$.value)) {
|
|
17921
|
+
logger$16.warn("[WebRTCManager] No active screen share to stop.");
|
|
17922
|
+
return;
|
|
17923
|
+
}
|
|
17876
17924
|
if (!this._screenShareId) {
|
|
17877
17925
|
logger$16.debug("[WebRTCManager] No screen share peer connection found.");
|
|
17878
17926
|
return;
|
|
@@ -17887,6 +17935,10 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
17887
17935
|
try {
|
|
17888
17936
|
if (rtcPeerConnController) await this.executeVertoBye(rtcPeerConnController);
|
|
17889
17937
|
} finally {
|
|
17938
|
+
if (rtcPeerConnController && rtcPeerConnController.connectionState !== "connected") this._legErrors$.next({
|
|
17939
|
+
legId: id,
|
|
17940
|
+
error: new AuxiliaryLegCancelledError(rtcPeerConnController.propose)
|
|
17941
|
+
});
|
|
17890
17942
|
rtcPeerConnController?.destroy();
|
|
17891
17943
|
this._rtcPeerConnectionsMap.delete(id);
|
|
17892
17944
|
this._rtcPeerConnections$.next(Array.from(this._rtcPeerConnectionsMap.values()));
|
|
@@ -23573,6 +23625,7 @@ if (typeof process === "undefined") globalThis.process = { env: { NODE_ENV: "pro
|
|
|
23573
23625
|
|
|
23574
23626
|
//#endregion
|
|
23575
23627
|
exports.Address = Address;
|
|
23628
|
+
exports.AuxiliaryLegCancelledError = AuxiliaryLegCancelledError;
|
|
23576
23629
|
exports.AuxiliaryLegTimeoutError = AuxiliaryLegTimeoutError;
|
|
23577
23630
|
exports.CallCreateError = CallCreateError;
|
|
23578
23631
|
exports.CallNotReadyError = CallNotReadyError;
|
|
@@ -23590,6 +23643,7 @@ exports.Participant = Participant;
|
|
|
23590
23643
|
exports.ParticipantNotReadyError = ParticipantNotReadyError;
|
|
23591
23644
|
exports.PreflightError = PreflightError;
|
|
23592
23645
|
exports.RecoveryError = RecoveryError;
|
|
23646
|
+
exports.ScreenShareAlreadyActiveError = ScreenShareAlreadyActiveError;
|
|
23593
23647
|
exports.SelfCapabilities = SelfCapabilities;
|
|
23594
23648
|
exports.SelfParticipant = SelfParticipant;
|
|
23595
23649
|
exports.SignalWire = SignalWire;
|