@signalwire/js 4.0.0-dev-20260318145605 → 4.0.0-dev-20260326210326
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/{base-BxFSgMTI.d.cts → base-CQPEW1lJ.d.mts} +8 -7
- package/dist/base-CQPEW1lJ.d.mts.map +1 -0
- package/dist/{base-DKDZK4Rr.d.mts → base-Cif20s3C.d.cts} +8 -7
- package/dist/base-Cif20s3C.d.cts.map +1 -0
- package/dist/browser.mjs +445 -86
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +445 -86
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +442 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +412 -32
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +412 -32
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +443 -76
- package/dist/index.mjs.map +1 -1
- package/dist/operators/index.cjs +1 -1
- package/dist/operators/index.d.cts +1 -1
- package/dist/operators/index.d.mts +1 -1
- package/dist/operators/index.mjs +1 -1
- package/dist/{operators-CJEML6aa.cjs → operators-mm21prWr.cjs} +3 -17
- package/dist/operators-mm21prWr.cjs.map +1 -0
- package/dist/{operators-C8Tqm86j.mjs → operators-uT_fb8ba.mjs} +4 -12
- package/dist/operators-uT_fb8ba.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/base-BxFSgMTI.d.cts.map +0 -1
- package/dist/base-DKDZK4Rr.d.mts.map +0 -1
- package/dist/operators-C8Tqm86j.mjs.map +0 -1
- package/dist/operators-CJEML6aa.cjs.map +0 -1
package/dist/browser.mjs
CHANGED
|
@@ -2879,7 +2879,7 @@ var require_observeOn = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2879
2879
|
var executeSchedule_1$7 = require_executeSchedule();
|
|
2880
2880
|
var lift_1$67 = require_lift();
|
|
2881
2881
|
var OperatorSubscriber_1$56 = require_OperatorSubscriber();
|
|
2882
|
-
function observeOn(scheduler, delay$1) {
|
|
2882
|
+
function observeOn$1(scheduler, delay$1) {
|
|
2883
2883
|
if (delay$1 === void 0) delay$1 = 0;
|
|
2884
2884
|
return lift_1$67.operate(function(source, subscriber) {
|
|
2885
2885
|
source.subscribe(OperatorSubscriber_1$56.createOperatorSubscriber(subscriber, function(value) {
|
|
@@ -2897,7 +2897,7 @@ var require_observeOn = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2897
2897
|
}));
|
|
2898
2898
|
});
|
|
2899
2899
|
}
|
|
2900
|
-
exports.observeOn = observeOn;
|
|
2900
|
+
exports.observeOn = observeOn$1;
|
|
2901
2901
|
}));
|
|
2902
2902
|
|
|
2903
2903
|
//#endregion
|
|
@@ -8956,6 +8956,40 @@ var Destroyable = class {
|
|
|
8956
8956
|
}
|
|
8957
8957
|
return cached;
|
|
8958
8958
|
}
|
|
8959
|
+
/**
|
|
8960
|
+
* Like `cachedObservable`, but defers emissions to the microtask queue
|
|
8961
|
+
* via `observeOn(asapScheduler)`.
|
|
8962
|
+
*
|
|
8963
|
+
* Use ONLY for public-facing observable getters that external consumers
|
|
8964
|
+
* subscribe to. Prevents a class of bugs where `BehaviorSubject` or
|
|
8965
|
+
* `ReplaySubject` replays synchronously during `subscribe()`, before
|
|
8966
|
+
* the subscription variable is assigned in the caller's scope.
|
|
8967
|
+
*
|
|
8968
|
+
* Do NOT use for observables consumed internally by the SDK — internal
|
|
8969
|
+
* code using `subscribeTo()`, `firstValueFrom()`, or `withLatestFrom()`
|
|
8970
|
+
* depends on synchronous emission delivery.
|
|
8971
|
+
*/
|
|
8972
|
+
publicCachedObservable(key, factory) {
|
|
8973
|
+
const publicKey = `public:${key}`;
|
|
8974
|
+
this._observableCache ??= /* @__PURE__ */ new Map();
|
|
8975
|
+
let cached = this._observableCache.get(publicKey);
|
|
8976
|
+
if (!cached) {
|
|
8977
|
+
cached = factory().pipe((0, import_cjs$22.observeOn)(import_cjs$22.asapScheduler));
|
|
8978
|
+
this._observableCache.set(publicKey, cached);
|
|
8979
|
+
}
|
|
8980
|
+
return cached;
|
|
8981
|
+
}
|
|
8982
|
+
/**
|
|
8983
|
+
* Wraps an observable so emissions are deferred to the microtask queue.
|
|
8984
|
+
*
|
|
8985
|
+
* Use ONLY for public-facing getters that expose a subject via
|
|
8986
|
+
* `.asObservable()` without going through `cachedObservable`.
|
|
8987
|
+
*
|
|
8988
|
+
* Do NOT use for observables consumed internally by the SDK.
|
|
8989
|
+
*/
|
|
8990
|
+
deferEmission(observable) {
|
|
8991
|
+
return observable.pipe((0, import_cjs$22.observeOn)(import_cjs$22.asapScheduler));
|
|
8992
|
+
}
|
|
8959
8993
|
subscribeTo(observable, observerOrNext) {
|
|
8960
8994
|
const subscription = observable.subscribe(observerOrNext);
|
|
8961
8995
|
this.subscriptions.push(subscription);
|
|
@@ -9116,20 +9150,12 @@ var CallCreateError = class extends Error {
|
|
|
9116
9150
|
}
|
|
9117
9151
|
};
|
|
9118
9152
|
var JSONRPCError = class extends Error {
|
|
9119
|
-
constructor(code, message, data, options) {
|
|
9153
|
+
constructor(code, message, data, options, requestId) {
|
|
9120
9154
|
super(message, options);
|
|
9121
9155
|
this.code = code;
|
|
9122
9156
|
this.data = data;
|
|
9123
|
-
this.name = "JSONRPCError";
|
|
9124
|
-
}
|
|
9125
|
-
};
|
|
9126
|
-
var RPCError = class extends Error {
|
|
9127
|
-
constructor(code, requestId, message, data, options) {
|
|
9128
|
-
super(message, options);
|
|
9129
|
-
this.code = code;
|
|
9130
9157
|
this.requestId = requestId;
|
|
9131
|
-
this.
|
|
9132
|
-
this.name = "RPCError";
|
|
9158
|
+
this.name = "JSONRPCError";
|
|
9133
9159
|
}
|
|
9134
9160
|
};
|
|
9135
9161
|
var InvalidParams = class extends Error {
|
|
@@ -10141,6 +10167,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10141
10167
|
|
|
10142
10168
|
//#endregion
|
|
10143
10169
|
//#region src/dependencies/DefaultLocalStorage.ts
|
|
10170
|
+
/** Default storage implementation backed by browser `localStorage` and `sessionStorage`. */
|
|
10144
10171
|
var DefaultLocalStorage = class {
|
|
10145
10172
|
constructor() {
|
|
10146
10173
|
if (typeof localStorage === "undefined") throw new StorageNotAvailableError("localStorage");
|
|
@@ -10654,17 +10681,21 @@ var AttachManager = class {
|
|
|
10654
10681
|
buildCallOptions(attachment) {
|
|
10655
10682
|
const { audio: audioDirection, video: videoDirection } = attachment.mediaDirections;
|
|
10656
10683
|
const { audioInputDevice, videoInputDevice } = attachment;
|
|
10684
|
+
const receiveAudio = audioDirection.includes("recv");
|
|
10685
|
+
const receiveVideo = videoDirection.includes("recv");
|
|
10686
|
+
const sendAudio = audioDirection.includes("send");
|
|
10687
|
+
const sendVideo = videoDirection.includes("send");
|
|
10657
10688
|
return {
|
|
10658
|
-
receiveAudio
|
|
10659
|
-
receiveVideo
|
|
10660
|
-
inputAudioDeviceConstraints: {
|
|
10661
|
-
audio:
|
|
10689
|
+
receiveAudio,
|
|
10690
|
+
receiveVideo,
|
|
10691
|
+
inputAudioDeviceConstraints: sendAudio ? {
|
|
10692
|
+
audio: true,
|
|
10662
10693
|
...this.deviceController.deviceInfoToConstraints(audioInputDevice)
|
|
10663
|
-
},
|
|
10664
|
-
inputVideoDeviceConstraints: {
|
|
10665
|
-
video:
|
|
10694
|
+
} : void 0,
|
|
10695
|
+
inputVideoDeviceConstraints: sendVideo ? {
|
|
10696
|
+
video: true,
|
|
10666
10697
|
...this.deviceController.deviceInfoToConstraints(videoInputDevice)
|
|
10667
|
-
},
|
|
10698
|
+
} : void 0,
|
|
10668
10699
|
reattach: true
|
|
10669
10700
|
};
|
|
10670
10701
|
}
|
|
@@ -11931,54 +11962,71 @@ var Participant = class extends Destroyable {
|
|
|
11931
11962
|
get type() {
|
|
11932
11963
|
return this._state$.value.type;
|
|
11933
11964
|
}
|
|
11965
|
+
/** Whether the participant has raised their hand. */
|
|
11934
11966
|
get handraised() {
|
|
11935
11967
|
return this._state$.value.handraised ?? false;
|
|
11936
11968
|
}
|
|
11969
|
+
/** Whether the participant is visible in the layout. */
|
|
11937
11970
|
get visible() {
|
|
11938
11971
|
return this._state$.value.visible ?? false;
|
|
11939
11972
|
}
|
|
11973
|
+
/** Whether the participant's audio is muted. */
|
|
11940
11974
|
get audioMuted() {
|
|
11941
11975
|
return this._state$.value.audio_muted ?? false;
|
|
11942
11976
|
}
|
|
11977
|
+
/** Whether the participant's video is muted. */
|
|
11943
11978
|
get videoMuted() {
|
|
11944
11979
|
return this._state$.value.video_muted ?? false;
|
|
11945
11980
|
}
|
|
11981
|
+
/** Whether the participant is deafened (incoming audio muted). */
|
|
11946
11982
|
get deaf() {
|
|
11947
11983
|
return this._state$.value.deaf ?? false;
|
|
11948
11984
|
}
|
|
11985
|
+
/** Current microphone input volume level, or `undefined` if not set. */
|
|
11949
11986
|
get inputVolume() {
|
|
11950
11987
|
return this._state$.value.input_volume;
|
|
11951
11988
|
}
|
|
11989
|
+
/** Current speaker output volume level, or `undefined` if not set. */
|
|
11952
11990
|
get outputVolume() {
|
|
11953
11991
|
return this._state$.value.output_volume;
|
|
11954
11992
|
}
|
|
11993
|
+
/** Current microphone input sensitivity level, or `undefined` if not set. */
|
|
11955
11994
|
get inputSensitivity() {
|
|
11956
11995
|
return this._state$.value.input_sensitivity;
|
|
11957
11996
|
}
|
|
11997
|
+
/** Whether echo cancellation is enabled. */
|
|
11958
11998
|
get echoCancellation() {
|
|
11959
11999
|
return this._state$.value.echo_cancellation ?? false;
|
|
11960
12000
|
}
|
|
12001
|
+
/** Whether automatic gain control is enabled. */
|
|
11961
12002
|
get autoGain() {
|
|
11962
12003
|
return this._state$.value.auto_gain ?? false;
|
|
11963
12004
|
}
|
|
12005
|
+
/** Whether noise suppression is enabled. */
|
|
11964
12006
|
get noiseSuppression() {
|
|
11965
12007
|
return this._state$.value.noise_suppression ?? false;
|
|
11966
12008
|
}
|
|
12009
|
+
/** Whether low-bitrate mode is active. */
|
|
11967
12010
|
get lowbitrate() {
|
|
11968
12011
|
return this._state$.value.lowbitrate ?? false;
|
|
11969
12012
|
}
|
|
12013
|
+
/** Whether noise reduction (denoise) is active. */
|
|
11970
12014
|
get denoise() {
|
|
11971
12015
|
return this._state$.value.denoise ?? false;
|
|
11972
12016
|
}
|
|
12017
|
+
/** Custom metadata for this participant, or `undefined` if not set. */
|
|
11973
12018
|
get meta() {
|
|
11974
12019
|
return this._state$.value.meta;
|
|
11975
12020
|
}
|
|
12021
|
+
/** Subscriber ID of this participant, or `undefined` if not available. */
|
|
11976
12022
|
get subscriberId() {
|
|
11977
12023
|
return this._state$.value.subscriber_id;
|
|
11978
12024
|
}
|
|
12025
|
+
/** Address ID of this participant, or `undefined` if not available. */
|
|
11979
12026
|
get addressId() {
|
|
11980
12027
|
return this._state$.value.address_id;
|
|
11981
12028
|
}
|
|
12029
|
+
/** Server node ID for this participant, or `undefined` if not available. */
|
|
11982
12030
|
get nodeId() {
|
|
11983
12031
|
return this._state$.value.node_id;
|
|
11984
12032
|
}
|
|
@@ -12050,15 +12098,24 @@ var Participant = class extends Destroyable {
|
|
|
12050
12098
|
async setAudioInputSensitivity(value) {
|
|
12051
12099
|
await this.executeMethod(this.id, "call.microphone.sensitivity.set", { sensitivity: value });
|
|
12052
12100
|
}
|
|
12053
|
-
/**
|
|
12101
|
+
/**
|
|
12102
|
+
* Sets the microphone input volume level.
|
|
12103
|
+
* @param value - Volume level (0-100).
|
|
12104
|
+
*/
|
|
12054
12105
|
async setAudioInputVolume(value) {
|
|
12055
12106
|
await this.executeMethod(this.id, "call.microphone.volume.set", { volume: value });
|
|
12056
12107
|
}
|
|
12057
|
-
/**
|
|
12108
|
+
/**
|
|
12109
|
+
* Sets the speaker output volume level.
|
|
12110
|
+
* @param value - Volume level (0-100).
|
|
12111
|
+
*/
|
|
12058
12112
|
async setAudioOutputVolume(value) {
|
|
12059
12113
|
await this.executeMethod(this.id, "call.speaker.volume.set", { volume: value });
|
|
12060
12114
|
}
|
|
12061
|
-
/**
|
|
12115
|
+
/**
|
|
12116
|
+
* Sets the participant's position in the video layout.
|
|
12117
|
+
* @param value - The {@link VideoPosition} to assign (e.g. `'auto'`, `'reserved-0'`).
|
|
12118
|
+
*/
|
|
12062
12119
|
async setPosition(value) {
|
|
12063
12120
|
await this.executeMethod(this.id, "call.member.position.set", { position: value });
|
|
12064
12121
|
}
|
|
@@ -12076,12 +12133,23 @@ var Participant = class extends Destroyable {
|
|
|
12076
12133
|
async end() {
|
|
12077
12134
|
await this.executeMethod(this.id, "call.end", {});
|
|
12078
12135
|
}
|
|
12136
|
+
/**
|
|
12137
|
+
* Replaces custom metadata for this participant.
|
|
12138
|
+
* @param _meta - Metadata object to set.
|
|
12139
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12140
|
+
*/
|
|
12079
12141
|
async setMeta(_meta) {
|
|
12080
12142
|
throw new UnimplementedError();
|
|
12081
12143
|
}
|
|
12144
|
+
/**
|
|
12145
|
+
* Merges values into custom metadata (unlike {@link setMeta} which replaces).
|
|
12146
|
+
* @param _meta - Metadata to merge.
|
|
12147
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12148
|
+
*/
|
|
12082
12149
|
async updateMeta(_meta) {
|
|
12083
12150
|
throw new UnimplementedError();
|
|
12084
12151
|
}
|
|
12152
|
+
/** Destroys the participant, releasing all subscriptions and references. */
|
|
12085
12153
|
destroy() {
|
|
12086
12154
|
this.executeMethod = void 0;
|
|
12087
12155
|
super.destroy();
|
|
@@ -12094,6 +12162,7 @@ var Participant = class extends Destroyable {
|
|
|
12094
12162
|
* and local media stream management.
|
|
12095
12163
|
*/
|
|
12096
12164
|
var SelfParticipant = class extends Participant {
|
|
12165
|
+
/** @internal */
|
|
12097
12166
|
constructor(id, executeMethod, vertoManager, deviceController) {
|
|
12098
12167
|
super(id, executeMethod, deviceController);
|
|
12099
12168
|
this.vertoManager = vertoManager;
|
|
@@ -12184,6 +12253,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12184
12253
|
this.deviceController.selectAudioOutputDevice(device);
|
|
12185
12254
|
if (options.savePreference) PreferencesContainer.instance.preferredAudioOutput = device;
|
|
12186
12255
|
}
|
|
12256
|
+
/** Mutes local audio. Falls back to local device mute if the server RPC fails. */
|
|
12187
12257
|
async mute() {
|
|
12188
12258
|
try {
|
|
12189
12259
|
await super.mute();
|
|
@@ -12193,6 +12263,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12193
12263
|
this.vertoManager.muteMainAudioInputDevice();
|
|
12194
12264
|
}
|
|
12195
12265
|
}
|
|
12266
|
+
/** Unmutes local audio. Falls back to local device unmute if the server RPC fails. */
|
|
12196
12267
|
async unmute() {
|
|
12197
12268
|
try {
|
|
12198
12269
|
await super.unmute();
|
|
@@ -12202,6 +12273,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12202
12273
|
await this.vertoManager.unmuteMainAudioInputDevice();
|
|
12203
12274
|
}
|
|
12204
12275
|
}
|
|
12276
|
+
/** Mutes local video. Falls back to local device mute if the server RPC fails. */
|
|
12205
12277
|
async muteVideo() {
|
|
12206
12278
|
try {
|
|
12207
12279
|
await super.muteVideo();
|
|
@@ -12211,6 +12283,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12211
12283
|
this.vertoManager.muteMainVideoInputDevice();
|
|
12212
12284
|
}
|
|
12213
12285
|
}
|
|
12286
|
+
/** Unmutes local video. Falls back to local device unmute if the server RPC fails. */
|
|
12214
12287
|
async unmuteVideo() {
|
|
12215
12288
|
try {
|
|
12216
12289
|
await super.unmuteVideo();
|
|
@@ -12240,6 +12313,9 @@ function isJSONRPCRequest(value) {
|
|
|
12240
12313
|
function isJSONRPCResponse(value) {
|
|
12241
12314
|
return isObject(value) && hasProperty(value, "jsonrpc") && value.jsonrpc === "2.0" && hasProperty(value, "id") && typeof value.id === "string" && (hasProperty(value, "result") || hasProperty(value, "error"));
|
|
12242
12315
|
}
|
|
12316
|
+
function isJSONRPCErrorResponse(value) {
|
|
12317
|
+
return isObject(value) && hasProperty(value, "jsonrpc") && value.jsonrpc === "2.0" && hasProperty(value, "id") && typeof value.id === "string" && (hasProperty(value, "error") && isObject(value.error) && hasProperty(value.error, "code") && hasProperty(value.error, "message") || hasProperty(value, "result") && isObject(value.result) && hasProperty(value.result, "code") && value.result.code !== "200" && hasProperty(value.result, "message"));
|
|
12318
|
+
}
|
|
12243
12319
|
|
|
12244
12320
|
//#endregion
|
|
12245
12321
|
//#region src/core/RPCMessages/guards/events.guards.ts
|
|
@@ -14082,6 +14158,11 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14082
14158
|
].includes(connectionState)))));
|
|
14083
14159
|
}
|
|
14084
14160
|
initSubscriptions() {
|
|
14161
|
+
this.subscribeTo(this.callJoinedEvent$, (event) => {
|
|
14162
|
+
const memberNodeId = event.room_session.members.find((m) => m.call_id === event.call_id)?.node_id;
|
|
14163
|
+
if (memberNodeId) this.setNodeIdIfNull(memberNodeId);
|
|
14164
|
+
if (event.member_id) this.setSelfIdIfNull(event.member_id);
|
|
14165
|
+
});
|
|
14085
14166
|
this.subscribeTo(this.vertoMedia$, (event) => {
|
|
14086
14167
|
logger$10.debug("[WebRTCManager] Received Verto media event (early media SDP):", event);
|
|
14087
14168
|
this._signalingStatus$.next("ringing");
|
|
@@ -14113,6 +14194,28 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14113
14194
|
this.sendVertoPong(vertoPing);
|
|
14114
14195
|
});
|
|
14115
14196
|
}
|
|
14197
|
+
/**
|
|
14198
|
+
* Set node_id/selfId only when the current value is null.
|
|
14199
|
+
*
|
|
14200
|
+
* During reattach, `call.joined` and `verto.answer` events can deliver
|
|
14201
|
+
* these identifiers before the `verto.invite` RPC response (`CALL CREATED`)
|
|
14202
|
+
* arrives. These methods let early events populate them eagerly so that
|
|
14203
|
+
* downstream RPC calls (e.g. `call.layout.list`) don't fail with empty
|
|
14204
|
+
* identifiers. `processInviteResponse()` remains the authoritative source
|
|
14205
|
+
* and always overwrites unconditionally.
|
|
14206
|
+
*/
|
|
14207
|
+
setNodeIdIfNull(nodeId) {
|
|
14208
|
+
if (!this._nodeId$.value && nodeId) {
|
|
14209
|
+
logger$10.debug(`[WebRTCManager] Early node_id set: ${nodeId}`);
|
|
14210
|
+
this._nodeId$.next(nodeId);
|
|
14211
|
+
}
|
|
14212
|
+
}
|
|
14213
|
+
setSelfIdIfNull(selfId) {
|
|
14214
|
+
if (!this._selfId$.value && selfId) {
|
|
14215
|
+
logger$10.debug(`[WebRTCManager] Early selfId set: ${selfId}`);
|
|
14216
|
+
this._selfId$.next(selfId);
|
|
14217
|
+
}
|
|
14218
|
+
}
|
|
14116
14219
|
async sendVertoPong(vertoPing) {
|
|
14117
14220
|
try {
|
|
14118
14221
|
const vertoPongMessage = VertoPong({ ...vertoPing });
|
|
@@ -14136,6 +14239,9 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14136
14239
|
get selfId() {
|
|
14137
14240
|
return this._selfId$.value;
|
|
14138
14241
|
}
|
|
14242
|
+
get callJoinedEvent$() {
|
|
14243
|
+
return this.webRtcCallSession.callEvent$.pipe((0, import_cjs$10.filter)(isCallJoinedPayload), (0, import_cjs$10.takeUntil)(this.destroyed$));
|
|
14244
|
+
}
|
|
14139
14245
|
get vertoMedia$() {
|
|
14140
14246
|
return this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoMediaInnerParams, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$));
|
|
14141
14247
|
}
|
|
@@ -14442,7 +14548,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14442
14548
|
*
|
|
14443
14549
|
* @see selectAudioInputDevice
|
|
14444
14550
|
* @see selectVideoInputDevice
|
|
14445
|
-
* @param options
|
|
14551
|
+
* @param options - Media options specifying which input devices to add (defaults to audio only).
|
|
14446
14552
|
*/
|
|
14447
14553
|
async addMainInputDevices(options = { audio: true }) {
|
|
14448
14554
|
let deviceKind = void 0;
|
|
@@ -14526,7 +14632,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14526
14632
|
try {
|
|
14527
14633
|
const causeParams = cause ? {
|
|
14528
14634
|
cause,
|
|
14529
|
-
|
|
14635
|
+
causeCode: VertoByeCauseCodes[cause]
|
|
14530
14636
|
} : {};
|
|
14531
14637
|
await this.executeVerto(VertoBye({
|
|
14532
14638
|
...causeParams,
|
|
@@ -14667,7 +14773,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14667
14773
|
}
|
|
14668
14774
|
/** Observable stream of errors from media, signaling, and peer connection layers. */
|
|
14669
14775
|
get errors$() {
|
|
14670
|
-
return this._errors$.asObservable();
|
|
14776
|
+
return this.deferEmission(this._errors$.asObservable());
|
|
14671
14777
|
}
|
|
14672
14778
|
/**
|
|
14673
14779
|
* @internal Push an error to the call's error stream.
|
|
@@ -14687,7 +14793,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14687
14793
|
}
|
|
14688
14794
|
/** Observable of the address associated with this call. */
|
|
14689
14795
|
get address$() {
|
|
14690
|
-
return (0, import_cjs$9.from)([this.address]);
|
|
14796
|
+
return this.deferEmission((0, import_cjs$9.from)([this.address])).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14691
14797
|
}
|
|
14692
14798
|
/** Display name of the caller. */
|
|
14693
14799
|
get fromName() {
|
|
@@ -14725,36 +14831,64 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14725
14831
|
get self() {
|
|
14726
14832
|
return this.callEventsManager.self;
|
|
14727
14833
|
}
|
|
14834
|
+
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
14728
14835
|
async toggleLock() {
|
|
14729
14836
|
const method = this.locked ? "call.unlock" : "call.lock";
|
|
14730
14837
|
await this.executeMethod(this.selfId ?? "", method, {});
|
|
14731
14838
|
}
|
|
14839
|
+
/**
|
|
14840
|
+
* Toggles the hold state of the call (pauses/resumes local media transmission).
|
|
14841
|
+
*
|
|
14842
|
+
* Distinct from {@link Participant.toggleMute} which mutes individual tracks.
|
|
14843
|
+
*/
|
|
14732
14844
|
async toggleHold() {
|
|
14733
14845
|
if (this._holdState) await this.vertoManager.unhold();
|
|
14734
14846
|
else await this.vertoManager.hold();
|
|
14735
14847
|
this._holdState = !this._holdState;
|
|
14736
14848
|
}
|
|
14849
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
14737
14850
|
async startRecording() {
|
|
14738
14851
|
throw new UnimplementedError();
|
|
14739
14852
|
}
|
|
14853
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
14740
14854
|
async startStreaming() {
|
|
14741
14855
|
throw new UnimplementedError();
|
|
14742
14856
|
}
|
|
14857
|
+
/**
|
|
14858
|
+
* Replaces the call's custom metadata.
|
|
14859
|
+
* @param _meta - Metadata object to set.
|
|
14860
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14861
|
+
*/
|
|
14743
14862
|
async setMeta(_meta) {
|
|
14744
14863
|
throw new UnimplementedError();
|
|
14745
14864
|
}
|
|
14865
|
+
/**
|
|
14866
|
+
* Merges values into the call's custom metadata (unlike {@link setMeta} which replaces).
|
|
14867
|
+
* @param _meta - Metadata to merge.
|
|
14868
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14869
|
+
*/
|
|
14746
14870
|
async updateMeta(_meta) {
|
|
14747
14871
|
throw new UnimplementedError();
|
|
14748
14872
|
}
|
|
14749
14873
|
/** Observable of layout layer positions for all participants. */
|
|
14750
14874
|
get layoutLayers$() {
|
|
14751
|
-
return this.callEventsManager.layoutLayers
|
|
14875
|
+
return this.deferEmission(this.callEventsManager.layoutLayers$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14752
14876
|
}
|
|
14753
14877
|
/** Current snapshot of layout layers. */
|
|
14754
14878
|
get layoutLayers() {
|
|
14755
14879
|
return this.callEventsManager.layoutLayers;
|
|
14756
14880
|
}
|
|
14757
|
-
/**
|
|
14881
|
+
/**
|
|
14882
|
+
* Executes a Verto RPC method targeting a specific participant.
|
|
14883
|
+
*
|
|
14884
|
+
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
14885
|
+
*
|
|
14886
|
+
* @param target - Target member ID string, or a {@link MemberTarget} object.
|
|
14887
|
+
* @param method - Verto method name (e.g. `'call.mute'`, `'call.member.remove'`).
|
|
14888
|
+
* @param args - Parameters for the RPC method.
|
|
14889
|
+
* @returns The RPC response.
|
|
14890
|
+
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
14891
|
+
*/
|
|
14758
14892
|
async executeMethod(target, method, args) {
|
|
14759
14893
|
const params = this.buildMethodParams(target, args);
|
|
14760
14894
|
const request = buildRPCRequest({
|
|
@@ -14762,7 +14896,9 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14762
14896
|
params
|
|
14763
14897
|
});
|
|
14764
14898
|
try {
|
|
14765
|
-
|
|
14899
|
+
const response = await this.clientSession.execute(request);
|
|
14900
|
+
if (isJSONRPCErrorResponse(response)) throw new JSONRPCError(parseInt(response.result?.code ?? "0"), `Error response from method ${method}: ${response.result?.code} ${response.result?.message}`, void 0, void 0, request.id);
|
|
14901
|
+
return response;
|
|
14766
14902
|
} catch (error) {
|
|
14767
14903
|
logger$9.error(`[Call] Error executing method ${method} with params`, params, error);
|
|
14768
14904
|
throw error;
|
|
@@ -14791,45 +14927,45 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14791
14927
|
}
|
|
14792
14928
|
/** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
|
|
14793
14929
|
get status$() {
|
|
14794
|
-
return this.
|
|
14930
|
+
return this.publicCachedObservable("status$", () => (0, import_cjs$9.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$).pipe((0, import_cjs$9.distinctUntilChanged)(), (0, import_cjs$9.tap)((status) => {
|
|
14795
14931
|
this._lastMergedStatus = status;
|
|
14796
14932
|
})));
|
|
14797
14933
|
}
|
|
14798
14934
|
/** Observable of the participants list, emits on join/leave/update. */
|
|
14799
14935
|
get participants$() {
|
|
14800
|
-
return this.callEventsManager.participants
|
|
14936
|
+
return this.deferEmission(this.callEventsManager.participants$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14801
14937
|
}
|
|
14802
14938
|
/** Observable of the local (self) participant. */
|
|
14803
14939
|
get self$() {
|
|
14804
|
-
return this.callEventsManager.self
|
|
14940
|
+
return this.deferEmission(this.callEventsManager.self$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14805
14941
|
}
|
|
14806
14942
|
/** Observable indicating whether the call is being recorded. */
|
|
14807
14943
|
get recording$() {
|
|
14808
|
-
return this.callEventsManager.recording
|
|
14944
|
+
return this.deferEmission(this.callEventsManager.recording$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14809
14945
|
}
|
|
14810
14946
|
/** Observable indicating whether the call is being streamed. */
|
|
14811
14947
|
get streaming$() {
|
|
14812
|
-
return this.callEventsManager.streaming
|
|
14948
|
+
return this.deferEmission(this.callEventsManager.streaming$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14813
14949
|
}
|
|
14814
14950
|
/** Observable indicating whether raise-hand priority is active. */
|
|
14815
14951
|
get raiseHandPriority$() {
|
|
14816
|
-
return this.callEventsManager.raiseHandPriority
|
|
14952
|
+
return this.deferEmission(this.callEventsManager.raiseHandPriority$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14817
14953
|
}
|
|
14818
14954
|
/** Observable indicating whether the call room is locked. */
|
|
14819
14955
|
get locked$() {
|
|
14820
|
-
return this.callEventsManager.locked
|
|
14956
|
+
return this.deferEmission(this.callEventsManager.locked$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14821
14957
|
}
|
|
14822
14958
|
/** Observable of custom metadata associated with the call. */
|
|
14823
14959
|
get meta$() {
|
|
14824
|
-
return this.callEventsManager.meta
|
|
14960
|
+
return this.deferEmission(this.callEventsManager.meta$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14825
14961
|
}
|
|
14826
14962
|
/** Observable of the call's capability flags. */
|
|
14827
14963
|
get capabilities$() {
|
|
14828
|
-
return this.callEventsManager.capabilities
|
|
14964
|
+
return this.deferEmission(this.callEventsManager.capabilities$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14829
14965
|
}
|
|
14830
14966
|
/** Observable of the current layout name. */
|
|
14831
14967
|
get layout$() {
|
|
14832
|
-
return this.callEventsManager.layout
|
|
14968
|
+
return this.deferEmission(this.callEventsManager.layout$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14833
14969
|
}
|
|
14834
14970
|
/** Current call status. */
|
|
14835
14971
|
get status() {
|
|
@@ -14861,7 +14997,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14861
14997
|
}
|
|
14862
14998
|
/** Observable of available layout names. */
|
|
14863
14999
|
get layouts$() {
|
|
14864
|
-
return this.callEventsManager.layouts
|
|
15000
|
+
return this.deferEmission(this.callEventsManager.layouts$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14865
15001
|
}
|
|
14866
15002
|
/** Current snapshot of available layout names. */
|
|
14867
15003
|
get layouts() {
|
|
@@ -14869,7 +15005,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14869
15005
|
}
|
|
14870
15006
|
/** Observable of the local media stream (camera/microphone). */
|
|
14871
15007
|
get localStream$() {
|
|
14872
|
-
return this.vertoManager.localStream
|
|
15008
|
+
return this.deferEmission(this.vertoManager.localStream$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14873
15009
|
}
|
|
14874
15010
|
/** Current local media stream, or `null` if not available. */
|
|
14875
15011
|
get localStream() {
|
|
@@ -14877,7 +15013,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14877
15013
|
}
|
|
14878
15014
|
/** Observable of the remote media stream from the far end. */
|
|
14879
15015
|
get remoteStream$() {
|
|
14880
|
-
return this.vertoManager.remoteStream
|
|
15016
|
+
return this.deferEmission(this.vertoManager.remoteStream$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14881
15017
|
}
|
|
14882
15018
|
/** Current remote media stream, or `null` if not available. */
|
|
14883
15019
|
get remoteStream() {
|
|
@@ -14885,7 +15021,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14885
15021
|
}
|
|
14886
15022
|
/** Observable of custom user variables associated with the call. */
|
|
14887
15023
|
get userVariables$() {
|
|
14888
|
-
return this._userVariables$.asObservable();
|
|
15024
|
+
return this.deferEmission(this._userVariables$.asObservable());
|
|
14889
15025
|
}
|
|
14890
15026
|
/** a copy of the current custom user variables of the call. */
|
|
14891
15027
|
get userVariables() {
|
|
@@ -14905,7 +15041,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14905
15041
|
}
|
|
14906
15042
|
/** Observable of the current audio/video send/receive directions. */
|
|
14907
15043
|
get mediaDirections$() {
|
|
14908
|
-
return this.vertoManager.mediaDirections
|
|
15044
|
+
return this.deferEmission(this.vertoManager.mediaDirections$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14909
15045
|
}
|
|
14910
15046
|
/** Current audio/video send/receive directions. */
|
|
14911
15047
|
get mediaDirections() {
|
|
@@ -14914,7 +15050,16 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14914
15050
|
get participantsId$() {
|
|
14915
15051
|
return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, import_cjs$9.map)((participants) => participants.map((participant) => participant.id))));
|
|
14916
15052
|
}
|
|
14917
|
-
/**
|
|
15053
|
+
/**
|
|
15054
|
+
* Executes a raw JSON-RPC request on the client session.
|
|
15055
|
+
*
|
|
15056
|
+
* Lower-level than {@link executeMethod} — allows full control over the RPC request structure.
|
|
15057
|
+
*
|
|
15058
|
+
* @param request - Complete JSON-RPC request object.
|
|
15059
|
+
* @param options - Optional RPC execution options (timeout, etc.).
|
|
15060
|
+
* @returns The RPC response.
|
|
15061
|
+
* @throws {JSONRPCError} If the RPC call returns an error response.
|
|
15062
|
+
*/
|
|
14918
15063
|
async execute(request, options) {
|
|
14919
15064
|
return this.clientSession.execute(request, options);
|
|
14920
15065
|
}
|
|
@@ -14951,31 +15096,31 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14951
15096
|
}
|
|
14952
15097
|
/** Observable of call-updated events. */
|
|
14953
15098
|
get callUpdated$() {
|
|
14954
|
-
return this.
|
|
15099
|
+
return this.publicCachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(filterAs(isCallUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14955
15100
|
}
|
|
14956
|
-
/** Observable of member-joined events. */
|
|
15101
|
+
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
14957
15102
|
get memberJoined$() {
|
|
14958
|
-
return this.
|
|
15103
|
+
return this.publicCachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(filterAs(isMemberJoinedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14959
15104
|
}
|
|
14960
|
-
/** Observable of member-left events. */
|
|
15105
|
+
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
14961
15106
|
get memberLeft$() {
|
|
14962
|
-
return this.
|
|
15107
|
+
return this.publicCachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(filterAs(isMemberLeftMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14963
15108
|
}
|
|
14964
15109
|
/** Observable of member-updated events (mute, volume, etc.). */
|
|
14965
15110
|
get memberUpdated$() {
|
|
14966
|
-
return this.
|
|
15111
|
+
return this.publicCachedObservable("memberUpdated$", () => this.callSessionEvents$.pipe(filterAs(isMemberUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14967
15112
|
}
|
|
14968
15113
|
/** Observable of member-talking events (speech start/stop). */
|
|
14969
15114
|
get memberTalking$() {
|
|
14970
|
-
return this.
|
|
15115
|
+
return this.publicCachedObservable("memberTalking$", () => this.callSessionEvents$.pipe(filterAs(isMemberTalkingMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14971
15116
|
}
|
|
14972
15117
|
/** Observable of call state-change events. */
|
|
14973
15118
|
get callStates$() {
|
|
14974
|
-
return this.
|
|
15119
|
+
return this.publicCachedObservable("callStates$", () => this.callSessionEvents$.pipe(filterAs(isCallStateMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14975
15120
|
}
|
|
14976
15121
|
/** Observable of layout-changed events. */
|
|
14977
15122
|
get layoutUpdates$() {
|
|
14978
|
-
return this.
|
|
15123
|
+
return this.publicCachedObservable("layoutUpdates$", () => this.callSessionEvents$.pipe(filterAs(isLayoutChangedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14979
15124
|
}
|
|
14980
15125
|
/** Underlying `RTCPeerConnection`, for advanced use cases. */
|
|
14981
15126
|
get rtcPeerConnection() {
|
|
@@ -14983,7 +15128,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14983
15128
|
}
|
|
14984
15129
|
/** Observable of raw signaling events as plain objects. */
|
|
14985
15130
|
get signalingEvent$() {
|
|
14986
|
-
return this.
|
|
15131
|
+
return this.publicCachedObservable("signalingEvent$", () => this.callEvent$.pipe((0, import_cjs$9.map)((event) => JSON.parse(JSON.stringify(event)))));
|
|
14987
15132
|
}
|
|
14988
15133
|
/** Observable of WebRTC-specific signaling messages. */
|
|
14989
15134
|
get webrtcMessages$() {
|
|
@@ -14997,7 +15142,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14997
15142
|
get layoutEvent$() {
|
|
14998
15143
|
return this.cachedObservable("layoutEvent$", () => this.callEvent$.pipe(filterAs(isLayoutChangedMetadata, "params")));
|
|
14999
15144
|
}
|
|
15000
|
-
/**
|
|
15145
|
+
/**
|
|
15146
|
+
* Hangs up the call and releases all resources.
|
|
15147
|
+
*
|
|
15148
|
+
* Sends a Verto `bye` to the server, transitions status to `'disconnecting'`,
|
|
15149
|
+
* then destroys the call. After this, the call instance is no longer usable.
|
|
15150
|
+
*
|
|
15151
|
+
* @example
|
|
15152
|
+
* ```ts
|
|
15153
|
+
* await call.hangup();
|
|
15154
|
+
* ```
|
|
15155
|
+
*/
|
|
15001
15156
|
async hangup() {
|
|
15002
15157
|
this._status$.next("disconnecting");
|
|
15003
15158
|
try {
|
|
@@ -15006,11 +15161,35 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15006
15161
|
this.destroy();
|
|
15007
15162
|
}
|
|
15008
15163
|
}
|
|
15009
|
-
/**
|
|
15164
|
+
/**
|
|
15165
|
+
* Sends DTMF digits on the call.
|
|
15166
|
+
*
|
|
15167
|
+
* @param dtmf - The digit string to send (e.g. `'1234#'`).
|
|
15168
|
+
*
|
|
15169
|
+
* @example
|
|
15170
|
+
* ```ts
|
|
15171
|
+
* await call.sendDigits('1234#');
|
|
15172
|
+
* ```
|
|
15173
|
+
*/
|
|
15010
15174
|
async sendDigits(dtmf) {
|
|
15011
15175
|
return this.vertoManager.sendDigits(dtmf);
|
|
15012
15176
|
}
|
|
15013
|
-
/**
|
|
15177
|
+
/**
|
|
15178
|
+
* Accepts an inbound call, optionally overriding media options for the answer.
|
|
15179
|
+
*
|
|
15180
|
+
* @param options - Optional media constraints for the answer (audio/video).
|
|
15181
|
+
*
|
|
15182
|
+
* @example
|
|
15183
|
+
* ```ts
|
|
15184
|
+
* // Accept with defaults
|
|
15185
|
+
* call.answer();
|
|
15186
|
+
*
|
|
15187
|
+
* // Accept audio-only
|
|
15188
|
+
* call.answer({ audio: true, video: false });
|
|
15189
|
+
* ```
|
|
15190
|
+
* @see {@link reject} to decline the call instead.
|
|
15191
|
+
* @see {@link answered$} to observe the acceptance state.
|
|
15192
|
+
*/
|
|
15014
15193
|
answer(options) {
|
|
15015
15194
|
this._answerMediaOptions = options;
|
|
15016
15195
|
this._answered$.next(true);
|
|
@@ -15019,18 +15198,32 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15019
15198
|
get answerMediaOptions() {
|
|
15020
15199
|
return this._answerMediaOptions;
|
|
15021
15200
|
}
|
|
15022
|
-
/**
|
|
15201
|
+
/**
|
|
15202
|
+
* Rejects an inbound call, preventing media negotiation.
|
|
15203
|
+
*
|
|
15204
|
+
* @see {@link answer} to accept the call instead.
|
|
15205
|
+
* @see {@link answered$} to observe the rejection state.
|
|
15206
|
+
*/
|
|
15023
15207
|
reject() {
|
|
15024
15208
|
this._answered$.next(false);
|
|
15025
15209
|
}
|
|
15026
15210
|
/** Observable that emits `true` when answered, `false` when rejected. */
|
|
15027
15211
|
get answered$() {
|
|
15028
|
-
return this._answered$.asObservable();
|
|
15212
|
+
return this.deferEmission(this._answered$.asObservable());
|
|
15029
15213
|
}
|
|
15030
15214
|
/**
|
|
15031
15215
|
* Sets the call layout and participant positions.
|
|
15216
|
+
*
|
|
15032
15217
|
* @param layout - Layout name (must be one of {@link layouts}).
|
|
15033
|
-
* @param positions - Map of member IDs to
|
|
15218
|
+
* @param positions - Map of member IDs to {@link VideoPosition} values.
|
|
15219
|
+
* @throws {InvalidParams} If the layout is not in the available {@link layouts}.
|
|
15220
|
+
*
|
|
15221
|
+
* @example
|
|
15222
|
+
* ```ts
|
|
15223
|
+
* await call.setLayout('grid-responsive', {
|
|
15224
|
+
* [participantId]: 'reserved-0',
|
|
15225
|
+
* });
|
|
15226
|
+
* ```
|
|
15034
15227
|
*/
|
|
15035
15228
|
async setLayout(layout, positions) {
|
|
15036
15229
|
if (!this.layouts.includes(layout)) throw new InvalidParams(`Layout ${layout} is not available in the current call layouts: ${this.layouts.join(", ")}`);
|
|
@@ -15040,7 +15233,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15040
15233
|
positions
|
|
15041
15234
|
});
|
|
15042
15235
|
}
|
|
15043
|
-
/**
|
|
15236
|
+
/**
|
|
15237
|
+
* Transfers the call to another destination.
|
|
15238
|
+
*
|
|
15239
|
+
* @param options - Transfer configuration including the target destination.
|
|
15240
|
+
* @see {@link status$} to observe the transfer progress.
|
|
15241
|
+
*/
|
|
15044
15242
|
async transfer(options) {
|
|
15045
15243
|
return this.vertoManager.transfer(options);
|
|
15046
15244
|
}
|
|
@@ -15401,11 +15599,28 @@ var Address = class extends Destroyable {
|
|
|
15401
15599
|
get locked$() {
|
|
15402
15600
|
return this.cachedObservable("locked$", () => this._state$.pipe(filterNull(), (0, import_cjs$7.shareReplay)(1), (0, import_cjs$7.map)((state) => state.locked), (0, import_cjs$7.takeUntil)(this.destroyed$)));
|
|
15403
15601
|
}
|
|
15404
|
-
/**
|
|
15602
|
+
/**
|
|
15603
|
+
* Sends a text message to this address.
|
|
15604
|
+
*
|
|
15605
|
+
* @param text - The message text to send.
|
|
15606
|
+
*
|
|
15607
|
+
* @example
|
|
15608
|
+
* ```ts
|
|
15609
|
+
* await address.sendText('Hello!');
|
|
15610
|
+
* ```
|
|
15611
|
+
*/
|
|
15405
15612
|
async sendText(text) {
|
|
15406
15613
|
return this.conversationManager.sendText(text, this.id);
|
|
15407
15614
|
}
|
|
15408
|
-
/**
|
|
15615
|
+
/**
|
|
15616
|
+
* Collection of text messages for this address, with pagination support.
|
|
15617
|
+
*
|
|
15618
|
+
* Returns `undefined` until {@link textMessages$} has been subscribed to (lazy-loaded).
|
|
15619
|
+
* Filters to `'chat'` subtype messages from the conversation.
|
|
15620
|
+
*
|
|
15621
|
+
* @see {@link textMessages$} to trigger lazy loading.
|
|
15622
|
+
* @see {@link sendText} to send a new message.
|
|
15623
|
+
*/
|
|
15409
15624
|
get textMessage() {
|
|
15410
15625
|
if (!this._conversationMessages) return;
|
|
15411
15626
|
this._textMessages$ = this._textMessages$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "chat", (item) => ({
|
|
@@ -15416,7 +15631,14 @@ var Address = class extends Destroyable {
|
|
|
15416
15631
|
}));
|
|
15417
15632
|
return this._textMessages$;
|
|
15418
15633
|
}
|
|
15419
|
-
/**
|
|
15634
|
+
/**
|
|
15635
|
+
* Collection of call history entries for this address, with pagination support.
|
|
15636
|
+
*
|
|
15637
|
+
* Returns `undefined` until {@link history$} has been subscribed to (lazy-loaded).
|
|
15638
|
+
* Filters to `'log'` subtype messages including kind, status, start/end times.
|
|
15639
|
+
*
|
|
15640
|
+
* @see {@link history$} to trigger lazy loading.
|
|
15641
|
+
*/
|
|
15420
15642
|
get history() {
|
|
15421
15643
|
if (!this._conversationMessages) return;
|
|
15422
15644
|
this._history$ = this._history$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "log", (item) => ({
|
|
@@ -15482,7 +15704,7 @@ var PendingRPC = class PendingRPC {
|
|
|
15482
15704
|
next: (response) => {
|
|
15483
15705
|
isSettled = true;
|
|
15484
15706
|
if (response.error) {
|
|
15485
|
-
const rpcError = new
|
|
15707
|
+
const rpcError = new JSONRPCError(response.error.code, response.error.message, response.error.data, void 0, request.id);
|
|
15486
15708
|
logger$7.debug(`[PendingRPC(${this.id}) request:${request.id}] Rejecting promise with RPC error:`, rpcError);
|
|
15487
15709
|
reject(rpcError);
|
|
15488
15710
|
} else {
|
|
@@ -15773,6 +15995,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
15773
15995
|
...params,
|
|
15774
15996
|
...persistedParams
|
|
15775
15997
|
});
|
|
15998
|
+
this.transport.resetSessionEpoch();
|
|
15776
15999
|
const response = await (0, import_cjs$5.lastValueFrom)((0, import_cjs$5.from)(this.transport.execute(rpcConnectRequest)).pipe(throwOnRPCError(), (0, import_cjs$5.map)((res) => res.result), (0, import_cjs$5.filter)(isRPCConnectResult), (0, import_cjs$5.tap)(() => {
|
|
15777
16000
|
logger$6.debug("[Session] Response passed filter, processing authentication result");
|
|
15778
16001
|
}), (0, import_cjs$5.take)(1), (0, import_cjs$5.catchError)((err) => {
|
|
@@ -16005,11 +16228,18 @@ var AddressFetcher = class extends Fetcher {
|
|
|
16005
16228
|
logger$4.error("Failed to fetch addresses");
|
|
16006
16229
|
}
|
|
16007
16230
|
};
|
|
16231
|
+
/** Collection of address states with reactive updates and pagination. */
|
|
16008
16232
|
var AddressStateCollection = class extends EntityCollection {
|
|
16009
16233
|
constructor(update$, http, onError) {
|
|
16010
16234
|
super(new AddressFetcher(http), update$, onError);
|
|
16011
16235
|
}
|
|
16012
16236
|
};
|
|
16237
|
+
/**
|
|
16238
|
+
* Manages the directory of {@link Address} entries with paginated loading.
|
|
16239
|
+
*
|
|
16240
|
+
* Implements the {@link Directory} interface and provides reactive access to
|
|
16241
|
+
* addresses via observables, along with pagination and lookup methods.
|
|
16242
|
+
*/
|
|
16013
16243
|
var DirectoryManager = class extends Destroyable {
|
|
16014
16244
|
constructor(http, clientSession, conversationManager, onError) {
|
|
16015
16245
|
super();
|
|
@@ -16034,6 +16264,7 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16034
16264
|
this._statesCollection = new AddressStateCollection(clientSession.signalingEvent$.pipe(filterAs(isConversationMessageUpdatedMetadata, "params"), (0, import_cjs$2.map)((_) => ({}))), this.http, this.onError);
|
|
16035
16265
|
this.initSubscriptions();
|
|
16036
16266
|
}
|
|
16267
|
+
/** Whether addresses are currently being loaded from the server. */
|
|
16037
16268
|
get loading() {
|
|
16038
16269
|
return this._statesCollection.loading;
|
|
16039
16270
|
}
|
|
@@ -16047,28 +16278,57 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16047
16278
|
}
|
|
16048
16279
|
});
|
|
16049
16280
|
}
|
|
16281
|
+
/** Observable stream of all addresses in the directory. */
|
|
16050
16282
|
get addresses$() {
|
|
16051
16283
|
return this._addresses$.asObservable();
|
|
16052
16284
|
}
|
|
16285
|
+
/** Current snapshot of all loaded addresses. */
|
|
16053
16286
|
get addresses() {
|
|
16054
16287
|
return this._addresses$.value;
|
|
16055
16288
|
}
|
|
16289
|
+
/** Observable indicating whether more addresses can be loaded. */
|
|
16056
16290
|
get hasMore$() {
|
|
16057
16291
|
return this._statesCollection.hasMore$;
|
|
16058
16292
|
}
|
|
16293
|
+
/** Observable of the current loading state. */
|
|
16059
16294
|
get loading$() {
|
|
16060
16295
|
return this._statesCollection.loading$;
|
|
16061
16296
|
}
|
|
16297
|
+
/**
|
|
16298
|
+
* Loads the next page of addresses from the server.
|
|
16299
|
+
*
|
|
16300
|
+
* No-op if {@link hasMore$} is `false`. Loading state is observable via {@link loading$}.
|
|
16301
|
+
* New addresses are appended to {@link addresses$} when the page loads.
|
|
16302
|
+
*/
|
|
16062
16303
|
loadMore() {
|
|
16063
16304
|
if (this._statesCollection.hasMore) this._statesCollection.loadMore();
|
|
16064
16305
|
}
|
|
16306
|
+
/**
|
|
16307
|
+
* Returns a reactive observable for a specific address by ID.
|
|
16308
|
+
* @param id - The address ID to observe.
|
|
16309
|
+
* @returns An observable of the address, or `undefined` if not found.
|
|
16310
|
+
*/
|
|
16065
16311
|
get$(id) {
|
|
16066
16312
|
if (!this._observableRegistry.has(id)) this.addNewAddress(id);
|
|
16067
16313
|
return this._observableRegistry.get(id);
|
|
16068
16314
|
}
|
|
16315
|
+
/**
|
|
16316
|
+
* Returns an address by ID from the local cache.
|
|
16317
|
+
* @param addressId - The address ID to look up.
|
|
16318
|
+
* @returns The address, or `undefined` if not found.
|
|
16319
|
+
*/
|
|
16069
16320
|
get(addressId) {
|
|
16070
16321
|
return this._addressesInstances.get(addressId);
|
|
16071
16322
|
}
|
|
16323
|
+
/**
|
|
16324
|
+
* Finds an address ID by its resource name (URI).
|
|
16325
|
+
*
|
|
16326
|
+
* Searches locally loaded addresses first, then queries the server if not found.
|
|
16327
|
+
* The resource name is the {@link Address.name} identifier, distinct from display name.
|
|
16328
|
+
*
|
|
16329
|
+
* @param name - The resource name to search for (exact match, e.g. `'/public/conference'`).
|
|
16330
|
+
* @returns The address ID, or `undefined` if no match is found locally or on server.
|
|
16331
|
+
*/
|
|
16072
16332
|
async findAddressIdByURI(name) {
|
|
16073
16333
|
let addressId = this._addressesInstances.values().find((addr) => addr.name === name)?.id;
|
|
16074
16334
|
if (!addressId) {
|
|
@@ -16256,7 +16516,30 @@ function isSignalwirePingRequest(value) {
|
|
|
16256
16516
|
//#region src/managers/TransportManager.ts
|
|
16257
16517
|
var import_cjs$1 = require_cjs();
|
|
16258
16518
|
const logger$2 = getLogger();
|
|
16259
|
-
var TransportManager = class extends Destroyable {
|
|
16519
|
+
var TransportManager = class TransportManager extends Destroyable {
|
|
16520
|
+
/**
|
|
16521
|
+
* Normalise a server event timestamp to epoch seconds.
|
|
16522
|
+
*
|
|
16523
|
+
* The server uses two formats:
|
|
16524
|
+
* - `webrtc.message`: float epoch seconds (e.g. 1774372099.022817)
|
|
16525
|
+
* - all other events: int epoch microseconds (e.g. 1774372099925857)
|
|
16526
|
+
*
|
|
16527
|
+
* Values above 1e12 are treated as microseconds and divided by 1e6.
|
|
16528
|
+
*/
|
|
16529
|
+
static toEpochSeconds(ts) {
|
|
16530
|
+
const n = typeof ts === "string" ? Number(ts) : ts;
|
|
16531
|
+
return n > 0xe8d4a51000 ? n / 1e6 : n;
|
|
16532
|
+
}
|
|
16533
|
+
/**
|
|
16534
|
+
* Extract the event timestamp from a signalwire.event message.
|
|
16535
|
+
* Returns `null` for messages that have no timestamp
|
|
16536
|
+
* (e.g. signalwire.authorization.state, RPC responses).
|
|
16537
|
+
*/
|
|
16538
|
+
static extractEventTimestamp(message) {
|
|
16539
|
+
if (!isSignalwireRequest(message)) return null;
|
|
16540
|
+
if (message.params.event_type === "signalwire.authorization.state") return null;
|
|
16541
|
+
return TransportManager.toEpochSeconds(message.params.timestamp);
|
|
16542
|
+
}
|
|
16260
16543
|
constructor(storage, protocolKey, webSocketConstructor, relayHost, onError) {
|
|
16261
16544
|
super();
|
|
16262
16545
|
this.storage = storage;
|
|
@@ -16289,6 +16572,23 @@ var TransportManager = class extends Destroyable {
|
|
|
16289
16572
|
return true;
|
|
16290
16573
|
});
|
|
16291
16574
|
};
|
|
16575
|
+
this.discardStaleEvents = () => {
|
|
16576
|
+
return (0, import_cjs$1.filter)((message) => {
|
|
16577
|
+
const ts = TransportManager.extractEventTimestamp(message);
|
|
16578
|
+
if (ts === null) return true;
|
|
16579
|
+
if (this._sessionEpoch === null) {
|
|
16580
|
+
this._sessionEpoch = ts;
|
|
16581
|
+
return true;
|
|
16582
|
+
}
|
|
16583
|
+
if (ts < this._sessionEpoch) {
|
|
16584
|
+
const eventType = isSignalwireRequest(message) ? message.params.event_type : "unknown";
|
|
16585
|
+
logger$2.warn(`[Transport] Discarding stale event: ${eventType} (timestamp=${ts.toFixed(3)}, sessionEpoch=${this._sessionEpoch.toFixed(3)}, delta=${(this._sessionEpoch - ts).toFixed(3)}s)`);
|
|
16586
|
+
return false;
|
|
16587
|
+
}
|
|
16588
|
+
return true;
|
|
16589
|
+
});
|
|
16590
|
+
};
|
|
16591
|
+
this._sessionEpoch = null;
|
|
16292
16592
|
this._outgoingMessages$ = this.createSubject();
|
|
16293
16593
|
this._webSocketConnections = new WebSocketController(webSocketConstructor, relayHost, this._outgoingMessages$.asObservable(), {
|
|
16294
16594
|
connectionTimeout: PreferencesContainer.instance.connectionTimeout,
|
|
@@ -16313,7 +16613,14 @@ var TransportManager = class extends Destroyable {
|
|
|
16313
16613
|
return import_cjs$1.EMPTY;
|
|
16314
16614
|
}), (0, import_cjs$1.share)(), (0, import_cjs$1.takeUntil)(this.destroyed$));
|
|
16315
16615
|
this._jsonRPCResponse$ = this._jsonRPCMessage$.pipe((0, import_cjs$1.filter)(isJSONRPCResponse));
|
|
16316
|
-
this._incomingEvent$ = this._jsonRPCMessage$.pipe(this.ackEvent(), this.replySignalwirePing(), (0, import_cjs$1.filter)((message) => !isJSONRPCResponse(message)), (0, import_cjs$1.share)(), (0, import_cjs$1.takeUntil)(this.destroyed$));
|
|
16616
|
+
this._incomingEvent$ = this._jsonRPCMessage$.pipe(this.ackEvent(), this.replySignalwirePing(), (0, import_cjs$1.filter)((message) => !isJSONRPCResponse(message)), this.discardStaleEvents(), (0, import_cjs$1.share)(), (0, import_cjs$1.takeUntil)(this.destroyed$));
|
|
16617
|
+
}
|
|
16618
|
+
/**
|
|
16619
|
+
* Reset the session epoch. Call this before each signalwire.connect
|
|
16620
|
+
* so that the first event after authentication establishes the new baseline.
|
|
16621
|
+
*/
|
|
16622
|
+
resetSessionEpoch() {
|
|
16623
|
+
this._sessionEpoch = null;
|
|
16317
16624
|
}
|
|
16318
16625
|
async setProtocol(protocol) {
|
|
16319
16626
|
this.protocol$.next(protocol);
|
|
@@ -16456,6 +16763,12 @@ const buildOptionsFromDestination = (destination) => {
|
|
|
16456
16763
|
* ```
|
|
16457
16764
|
*/
|
|
16458
16765
|
var SignalWire = class extends Destroyable {
|
|
16766
|
+
/**
|
|
16767
|
+
* Creates a new SignalWire client and begins connecting.
|
|
16768
|
+
*
|
|
16769
|
+
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
16770
|
+
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
16771
|
+
*/
|
|
16459
16772
|
constructor(credentialProvider, options = {}) {
|
|
16460
16773
|
super();
|
|
16461
16774
|
this.preferences = new ClientPreferences();
|
|
@@ -16637,7 +16950,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16637
16950
|
* ```
|
|
16638
16951
|
*/
|
|
16639
16952
|
get subscriber$() {
|
|
16640
|
-
return this._subscriber$.asObservable();
|
|
16953
|
+
return this.deferEmission(this._subscriber$.asObservable());
|
|
16641
16954
|
}
|
|
16642
16955
|
/** Current subscriber snapshot, or `undefined` if not yet authenticated. */
|
|
16643
16956
|
get subscriber() {
|
|
@@ -16656,7 +16969,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16656
16969
|
* ```
|
|
16657
16970
|
*/
|
|
16658
16971
|
get directory$() {
|
|
16659
|
-
return this._directory$.asObservable();
|
|
16972
|
+
return this.deferEmission(this._directory$.asObservable());
|
|
16660
16973
|
}
|
|
16661
16974
|
/**
|
|
16662
16975
|
* Current directory snapshot, or `undefined` if the client is not yet connected.
|
|
@@ -16667,7 +16980,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16667
16980
|
}
|
|
16668
16981
|
/** Observable that emits when the subscriber registration state changes. */
|
|
16669
16982
|
get isRegistered$() {
|
|
16670
|
-
return this._isRegistered$.asObservable();
|
|
16983
|
+
return this.deferEmission(this._isRegistered$.asObservable());
|
|
16671
16984
|
}
|
|
16672
16985
|
/** Whether the subscriber is currently registered. */
|
|
16673
16986
|
get isRegistered() {
|
|
@@ -16679,17 +16992,22 @@ var SignalWire = class extends Destroyable {
|
|
|
16679
16992
|
}
|
|
16680
16993
|
/** Observable that emits when the connection state changes. */
|
|
16681
16994
|
get isConnected$() {
|
|
16682
|
-
return this._isConnected$.asObservable();
|
|
16995
|
+
return this.deferEmission(this._isConnected$.asObservable());
|
|
16683
16996
|
}
|
|
16684
16997
|
/** Observable that emits `true` when the client is both connected and authenticated. */
|
|
16685
16998
|
get ready$() {
|
|
16686
|
-
return this.
|
|
16999
|
+
return this.publicCachedObservable("ready$", () => this._isConnected$.pipe((0, import_cjs.switchMap)((connected) => connected ? this._clientSession.authenticated$ : (0, import_cjs.of)(false))));
|
|
16687
17000
|
}
|
|
16688
17001
|
/** Observable stream of errors from transport, authentication, and devices. */
|
|
16689
17002
|
get errors$() {
|
|
16690
|
-
return this._errors$.asObservable();
|
|
17003
|
+
return this.deferEmission(this._errors$.asObservable());
|
|
16691
17004
|
}
|
|
16692
|
-
/**
|
|
17005
|
+
/**
|
|
17006
|
+
* Disconnects the WebSocket and tears down the current session.
|
|
17007
|
+
*
|
|
17008
|
+
* The client can be reconnected by calling {@link connect} again,
|
|
17009
|
+
* which creates a fresh transport and session.
|
|
17010
|
+
*/
|
|
16693
17011
|
async disconnect() {
|
|
16694
17012
|
await this._clientSession.disconnect();
|
|
16695
17013
|
this._clientSession.destroy();
|
|
@@ -16698,7 +17016,14 @@ var SignalWire = class extends Destroyable {
|
|
|
16698
17016
|
async waitAuthentication() {
|
|
16699
17017
|
await (0, import_cjs.firstValueFrom)(this.ready$.pipe((0, import_cjs.filter)((ready$1) => ready$1 === true)));
|
|
16700
17018
|
}
|
|
16701
|
-
/**
|
|
17019
|
+
/**
|
|
17020
|
+
* Registers the subscriber as online to receive inbound calls and events.
|
|
17021
|
+
*
|
|
17022
|
+
* Waits for authentication to complete before sending the registration.
|
|
17023
|
+
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
17024
|
+
*
|
|
17025
|
+
* @throws {InvalidCredentialsError} If registration and reauthentication both fail.
|
|
17026
|
+
*/
|
|
16702
17027
|
async register() {
|
|
16703
17028
|
try {
|
|
16704
17029
|
await this.waitAuthentication();
|
|
@@ -16726,7 +17051,11 @@ var SignalWire = class extends Destroyable {
|
|
|
16726
17051
|
throw error;
|
|
16727
17052
|
}
|
|
16728
17053
|
}
|
|
16729
|
-
/**
|
|
17054
|
+
/**
|
|
17055
|
+
* Unregisters the subscriber, going offline for inbound calls.
|
|
17056
|
+
*
|
|
17057
|
+
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
17058
|
+
*/
|
|
16730
17059
|
async unregister() {
|
|
16731
17060
|
try {
|
|
16732
17061
|
await this._transport.execute(RPCExecute({
|
|
@@ -16742,9 +17071,27 @@ var SignalWire = class extends Destroyable {
|
|
|
16742
17071
|
}
|
|
16743
17072
|
/**
|
|
16744
17073
|
* Places an outbound call to the given destination.
|
|
16745
|
-
*
|
|
16746
|
-
*
|
|
17074
|
+
*
|
|
17075
|
+
* Waits for authentication before dialing. Media options are merged from
|
|
17076
|
+
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
17077
|
+
* and the provided `options` (highest priority).
|
|
17078
|
+
*
|
|
17079
|
+
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
17080
|
+
* to track progression through `'connected'` → `'disconnected'`.
|
|
17081
|
+
*
|
|
17082
|
+
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
17083
|
+
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
16747
17084
|
* @returns The created {@link Call} instance.
|
|
17085
|
+
* @throws {Error} If authentication is not complete or call creation fails.
|
|
17086
|
+
*
|
|
17087
|
+
* @example
|
|
17088
|
+
* ```ts
|
|
17089
|
+
* const call = await client.dial('/public/conference', {
|
|
17090
|
+
* audio: true,
|
|
17091
|
+
* video: true,
|
|
17092
|
+
* });
|
|
17093
|
+
* call.status$.subscribe(status => console.log('Call:', status));
|
|
17094
|
+
* ```
|
|
16748
17095
|
*/
|
|
16749
17096
|
async dial(destination, options = {}) {
|
|
16750
17097
|
const computed_options = {
|
|
@@ -16762,7 +17109,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16762
17109
|
}
|
|
16763
17110
|
/** Observable list of available audio input (microphone) devices. */
|
|
16764
17111
|
get audioInputDevices$() {
|
|
16765
|
-
return this._deviceController.audioInputDevices
|
|
17112
|
+
return this.deferEmission(this._deviceController.audioInputDevices$);
|
|
16766
17113
|
}
|
|
16767
17114
|
/** Current snapshot of available audio input devices. */
|
|
16768
17115
|
get audioInputDevices() {
|
|
@@ -16770,7 +17117,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16770
17117
|
}
|
|
16771
17118
|
/** Observable list of available audio output (speaker) devices. */
|
|
16772
17119
|
get audioOutputDevices$() {
|
|
16773
|
-
return this._deviceController.audioOutputDevices
|
|
17120
|
+
return this.deferEmission(this._deviceController.audioOutputDevices$);
|
|
16774
17121
|
}
|
|
16775
17122
|
/** Current snapshot of available audio output devices. */
|
|
16776
17123
|
get audioOutputDevices() {
|
|
@@ -16778,7 +17125,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16778
17125
|
}
|
|
16779
17126
|
/** Observable list of available video input (camera) devices. */
|
|
16780
17127
|
get videoInputDevices$() {
|
|
16781
|
-
return this._deviceController.videoInputDevices
|
|
17128
|
+
return this.deferEmission(this._deviceController.videoInputDevices$);
|
|
16782
17129
|
}
|
|
16783
17130
|
/** Current snapshot of available video input devices. */
|
|
16784
17131
|
get videoInputDevices() {
|
|
@@ -16786,15 +17133,15 @@ var SignalWire = class extends Destroyable {
|
|
|
16786
17133
|
}
|
|
16787
17134
|
/** Observable of the currently selected audio input device. */
|
|
16788
17135
|
get selectedAudioInputDevice$() {
|
|
16789
|
-
return this._deviceController.selectedAudioInputDevice
|
|
17136
|
+
return this.deferEmission(this._deviceController.selectedAudioInputDevice$);
|
|
16790
17137
|
}
|
|
16791
17138
|
/** Observable of the currently selected audio output device. */
|
|
16792
17139
|
get selectedAudioOutputDevice$() {
|
|
16793
|
-
return this._deviceController.selectedAudioOutputDevice
|
|
17140
|
+
return this.deferEmission(this._deviceController.selectedAudioOutputDevice$);
|
|
16794
17141
|
}
|
|
16795
17142
|
/** Observable of the currently selected video input device. */
|
|
16796
17143
|
get selectedVideoInputDevice$() {
|
|
16797
|
-
return this._deviceController.selectedVideoInputDevice
|
|
17144
|
+
return this.deferEmission(this._deviceController.selectedVideoInputDevice$);
|
|
16798
17145
|
}
|
|
16799
17146
|
/** Currently selected audio input device, or `null` if none. */
|
|
16800
17147
|
get selectedAudioInputDevice() {
|
|
@@ -16840,12 +17187,23 @@ var SignalWire = class extends Destroyable {
|
|
|
16840
17187
|
disableDeviceMonitoring() {
|
|
16841
17188
|
this._deviceController.disableDeviceMonitoring();
|
|
16842
17189
|
}
|
|
17190
|
+
/**
|
|
17191
|
+
* Returns the capabilities of a media device.
|
|
17192
|
+
* @param deviceInfo - The device to query.
|
|
17193
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
17194
|
+
*/
|
|
16843
17195
|
async getDeviceCapabilities(deviceInfo) {
|
|
16844
17196
|
return this._deviceController.getDeviceCapabilities(deviceInfo);
|
|
16845
17197
|
}
|
|
17198
|
+
/**
|
|
17199
|
+
* Checks whether a device is still available and usable.
|
|
17200
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
17201
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
17202
|
+
*/
|
|
16846
17203
|
async isValidDevice(deviceInfo) {
|
|
16847
17204
|
return this._deviceController.isValidDevice(deviceInfo);
|
|
16848
17205
|
}
|
|
17206
|
+
/** Destroys the client, clearing timers and releasing all resources. */
|
|
16849
17207
|
destroy() {
|
|
16850
17208
|
if (this._refreshTimerId) {
|
|
16851
17209
|
clearTimeout(this._refreshTimerId);
|
|
@@ -16858,6 +17216,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16858
17216
|
//#endregion
|
|
16859
17217
|
//#region src/dependencies/EmbedTokenCredentialProvider.ts
|
|
16860
17218
|
const logger = getLogger();
|
|
17219
|
+
/** Credential provider that exchanges an embed token for a SAT via the host's token endpoint. */
|
|
16861
17220
|
var EmbedTokenCredentialProvider = class {
|
|
16862
17221
|
constructor(host, embedToken) {
|
|
16863
17222
|
this.host = host;
|