@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.umd.js
CHANGED
|
@@ -2883,7 +2883,7 @@ var require_observeOn = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2883
2883
|
var executeSchedule_1$7 = require_executeSchedule();
|
|
2884
2884
|
var lift_1$67 = require_lift();
|
|
2885
2885
|
var OperatorSubscriber_1$56 = require_OperatorSubscriber();
|
|
2886
|
-
function observeOn(scheduler, delay$1) {
|
|
2886
|
+
function observeOn$1(scheduler, delay$1) {
|
|
2887
2887
|
if (delay$1 === void 0) delay$1 = 0;
|
|
2888
2888
|
return lift_1$67.operate(function(source, subscriber) {
|
|
2889
2889
|
source.subscribe(OperatorSubscriber_1$56.createOperatorSubscriber(subscriber, function(value) {
|
|
@@ -2901,7 +2901,7 @@ var require_observeOn = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2901
2901
|
}));
|
|
2902
2902
|
});
|
|
2903
2903
|
}
|
|
2904
|
-
exports.observeOn = observeOn;
|
|
2904
|
+
exports.observeOn = observeOn$1;
|
|
2905
2905
|
}));
|
|
2906
2906
|
|
|
2907
2907
|
//#endregion
|
|
@@ -8960,6 +8960,40 @@ var Destroyable = class {
|
|
|
8960
8960
|
}
|
|
8961
8961
|
return cached;
|
|
8962
8962
|
}
|
|
8963
|
+
/**
|
|
8964
|
+
* Like `cachedObservable`, but defers emissions to the microtask queue
|
|
8965
|
+
* via `observeOn(asapScheduler)`.
|
|
8966
|
+
*
|
|
8967
|
+
* Use ONLY for public-facing observable getters that external consumers
|
|
8968
|
+
* subscribe to. Prevents a class of bugs where `BehaviorSubject` or
|
|
8969
|
+
* `ReplaySubject` replays synchronously during `subscribe()`, before
|
|
8970
|
+
* the subscription variable is assigned in the caller's scope.
|
|
8971
|
+
*
|
|
8972
|
+
* Do NOT use for observables consumed internally by the SDK — internal
|
|
8973
|
+
* code using `subscribeTo()`, `firstValueFrom()`, or `withLatestFrom()`
|
|
8974
|
+
* depends on synchronous emission delivery.
|
|
8975
|
+
*/
|
|
8976
|
+
publicCachedObservable(key, factory) {
|
|
8977
|
+
const publicKey = `public:${key}`;
|
|
8978
|
+
this._observableCache ??= /* @__PURE__ */ new Map();
|
|
8979
|
+
let cached = this._observableCache.get(publicKey);
|
|
8980
|
+
if (!cached) {
|
|
8981
|
+
cached = factory().pipe((0, import_cjs$22.observeOn)(import_cjs$22.asapScheduler));
|
|
8982
|
+
this._observableCache.set(publicKey, cached);
|
|
8983
|
+
}
|
|
8984
|
+
return cached;
|
|
8985
|
+
}
|
|
8986
|
+
/**
|
|
8987
|
+
* Wraps an observable so emissions are deferred to the microtask queue.
|
|
8988
|
+
*
|
|
8989
|
+
* Use ONLY for public-facing getters that expose a subject via
|
|
8990
|
+
* `.asObservable()` without going through `cachedObservable`.
|
|
8991
|
+
*
|
|
8992
|
+
* Do NOT use for observables consumed internally by the SDK.
|
|
8993
|
+
*/
|
|
8994
|
+
deferEmission(observable) {
|
|
8995
|
+
return observable.pipe((0, import_cjs$22.observeOn)(import_cjs$22.asapScheduler));
|
|
8996
|
+
}
|
|
8963
8997
|
subscribeTo(observable, observerOrNext) {
|
|
8964
8998
|
const subscription = observable.subscribe(observerOrNext);
|
|
8965
8999
|
this.subscriptions.push(subscription);
|
|
@@ -9120,20 +9154,12 @@ var CallCreateError = class extends Error {
|
|
|
9120
9154
|
}
|
|
9121
9155
|
};
|
|
9122
9156
|
var JSONRPCError = class extends Error {
|
|
9123
|
-
constructor(code, message, data, options) {
|
|
9157
|
+
constructor(code, message, data, options, requestId) {
|
|
9124
9158
|
super(message, options);
|
|
9125
9159
|
this.code = code;
|
|
9126
9160
|
this.data = data;
|
|
9127
|
-
this.name = "JSONRPCError";
|
|
9128
|
-
}
|
|
9129
|
-
};
|
|
9130
|
-
var RPCError = class extends Error {
|
|
9131
|
-
constructor(code, requestId, message, data, options) {
|
|
9132
|
-
super(message, options);
|
|
9133
|
-
this.code = code;
|
|
9134
9161
|
this.requestId = requestId;
|
|
9135
|
-
this.
|
|
9136
|
-
this.name = "RPCError";
|
|
9162
|
+
this.name = "JSONRPCError";
|
|
9137
9163
|
}
|
|
9138
9164
|
};
|
|
9139
9165
|
var InvalidParams = class extends Error {
|
|
@@ -10145,6 +10171,7 @@ var NavigatorDeviceController = class extends Destroyable {
|
|
|
10145
10171
|
|
|
10146
10172
|
//#endregion
|
|
10147
10173
|
//#region src/dependencies/DefaultLocalStorage.ts
|
|
10174
|
+
/** Default storage implementation backed by browser `localStorage` and `sessionStorage`. */
|
|
10148
10175
|
var DefaultLocalStorage = class {
|
|
10149
10176
|
constructor() {
|
|
10150
10177
|
if (typeof localStorage === "undefined") throw new StorageNotAvailableError("localStorage");
|
|
@@ -10658,17 +10685,21 @@ var AttachManager = class {
|
|
|
10658
10685
|
buildCallOptions(attachment) {
|
|
10659
10686
|
const { audio: audioDirection, video: videoDirection } = attachment.mediaDirections;
|
|
10660
10687
|
const { audioInputDevice, videoInputDevice } = attachment;
|
|
10688
|
+
const receiveAudio = audioDirection.includes("recv");
|
|
10689
|
+
const receiveVideo = videoDirection.includes("recv");
|
|
10690
|
+
const sendAudio = audioDirection.includes("send");
|
|
10691
|
+
const sendVideo = videoDirection.includes("send");
|
|
10661
10692
|
return {
|
|
10662
|
-
receiveAudio
|
|
10663
|
-
receiveVideo
|
|
10664
|
-
inputAudioDeviceConstraints: {
|
|
10665
|
-
audio:
|
|
10693
|
+
receiveAudio,
|
|
10694
|
+
receiveVideo,
|
|
10695
|
+
inputAudioDeviceConstraints: sendAudio ? {
|
|
10696
|
+
audio: true,
|
|
10666
10697
|
...this.deviceController.deviceInfoToConstraints(audioInputDevice)
|
|
10667
|
-
},
|
|
10668
|
-
inputVideoDeviceConstraints: {
|
|
10669
|
-
video:
|
|
10698
|
+
} : void 0,
|
|
10699
|
+
inputVideoDeviceConstraints: sendVideo ? {
|
|
10700
|
+
video: true,
|
|
10670
10701
|
...this.deviceController.deviceInfoToConstraints(videoInputDevice)
|
|
10671
|
-
},
|
|
10702
|
+
} : void 0,
|
|
10672
10703
|
reattach: true
|
|
10673
10704
|
};
|
|
10674
10705
|
}
|
|
@@ -11935,54 +11966,71 @@ var Participant = class extends Destroyable {
|
|
|
11935
11966
|
get type() {
|
|
11936
11967
|
return this._state$.value.type;
|
|
11937
11968
|
}
|
|
11969
|
+
/** Whether the participant has raised their hand. */
|
|
11938
11970
|
get handraised() {
|
|
11939
11971
|
return this._state$.value.handraised ?? false;
|
|
11940
11972
|
}
|
|
11973
|
+
/** Whether the participant is visible in the layout. */
|
|
11941
11974
|
get visible() {
|
|
11942
11975
|
return this._state$.value.visible ?? false;
|
|
11943
11976
|
}
|
|
11977
|
+
/** Whether the participant's audio is muted. */
|
|
11944
11978
|
get audioMuted() {
|
|
11945
11979
|
return this._state$.value.audio_muted ?? false;
|
|
11946
11980
|
}
|
|
11981
|
+
/** Whether the participant's video is muted. */
|
|
11947
11982
|
get videoMuted() {
|
|
11948
11983
|
return this._state$.value.video_muted ?? false;
|
|
11949
11984
|
}
|
|
11985
|
+
/** Whether the participant is deafened (incoming audio muted). */
|
|
11950
11986
|
get deaf() {
|
|
11951
11987
|
return this._state$.value.deaf ?? false;
|
|
11952
11988
|
}
|
|
11989
|
+
/** Current microphone input volume level, or `undefined` if not set. */
|
|
11953
11990
|
get inputVolume() {
|
|
11954
11991
|
return this._state$.value.input_volume;
|
|
11955
11992
|
}
|
|
11993
|
+
/** Current speaker output volume level, or `undefined` if not set. */
|
|
11956
11994
|
get outputVolume() {
|
|
11957
11995
|
return this._state$.value.output_volume;
|
|
11958
11996
|
}
|
|
11997
|
+
/** Current microphone input sensitivity level, or `undefined` if not set. */
|
|
11959
11998
|
get inputSensitivity() {
|
|
11960
11999
|
return this._state$.value.input_sensitivity;
|
|
11961
12000
|
}
|
|
12001
|
+
/** Whether echo cancellation is enabled. */
|
|
11962
12002
|
get echoCancellation() {
|
|
11963
12003
|
return this._state$.value.echo_cancellation ?? false;
|
|
11964
12004
|
}
|
|
12005
|
+
/** Whether automatic gain control is enabled. */
|
|
11965
12006
|
get autoGain() {
|
|
11966
12007
|
return this._state$.value.auto_gain ?? false;
|
|
11967
12008
|
}
|
|
12009
|
+
/** Whether noise suppression is enabled. */
|
|
11968
12010
|
get noiseSuppression() {
|
|
11969
12011
|
return this._state$.value.noise_suppression ?? false;
|
|
11970
12012
|
}
|
|
12013
|
+
/** Whether low-bitrate mode is active. */
|
|
11971
12014
|
get lowbitrate() {
|
|
11972
12015
|
return this._state$.value.lowbitrate ?? false;
|
|
11973
12016
|
}
|
|
12017
|
+
/** Whether noise reduction (denoise) is active. */
|
|
11974
12018
|
get denoise() {
|
|
11975
12019
|
return this._state$.value.denoise ?? false;
|
|
11976
12020
|
}
|
|
12021
|
+
/** Custom metadata for this participant, or `undefined` if not set. */
|
|
11977
12022
|
get meta() {
|
|
11978
12023
|
return this._state$.value.meta;
|
|
11979
12024
|
}
|
|
12025
|
+
/** Subscriber ID of this participant, or `undefined` if not available. */
|
|
11980
12026
|
get subscriberId() {
|
|
11981
12027
|
return this._state$.value.subscriber_id;
|
|
11982
12028
|
}
|
|
12029
|
+
/** Address ID of this participant, or `undefined` if not available. */
|
|
11983
12030
|
get addressId() {
|
|
11984
12031
|
return this._state$.value.address_id;
|
|
11985
12032
|
}
|
|
12033
|
+
/** Server node ID for this participant, or `undefined` if not available. */
|
|
11986
12034
|
get nodeId() {
|
|
11987
12035
|
return this._state$.value.node_id;
|
|
11988
12036
|
}
|
|
@@ -12054,15 +12102,24 @@ var Participant = class extends Destroyable {
|
|
|
12054
12102
|
async setAudioInputSensitivity(value) {
|
|
12055
12103
|
await this.executeMethod(this.id, "call.microphone.sensitivity.set", { sensitivity: value });
|
|
12056
12104
|
}
|
|
12057
|
-
/**
|
|
12105
|
+
/**
|
|
12106
|
+
* Sets the microphone input volume level.
|
|
12107
|
+
* @param value - Volume level (0-100).
|
|
12108
|
+
*/
|
|
12058
12109
|
async setAudioInputVolume(value) {
|
|
12059
12110
|
await this.executeMethod(this.id, "call.microphone.volume.set", { volume: value });
|
|
12060
12111
|
}
|
|
12061
|
-
/**
|
|
12112
|
+
/**
|
|
12113
|
+
* Sets the speaker output volume level.
|
|
12114
|
+
* @param value - Volume level (0-100).
|
|
12115
|
+
*/
|
|
12062
12116
|
async setAudioOutputVolume(value) {
|
|
12063
12117
|
await this.executeMethod(this.id, "call.speaker.volume.set", { volume: value });
|
|
12064
12118
|
}
|
|
12065
|
-
/**
|
|
12119
|
+
/**
|
|
12120
|
+
* Sets the participant's position in the video layout.
|
|
12121
|
+
* @param value - The {@link VideoPosition} to assign (e.g. `'auto'`, `'reserved-0'`).
|
|
12122
|
+
*/
|
|
12066
12123
|
async setPosition(value) {
|
|
12067
12124
|
await this.executeMethod(this.id, "call.member.position.set", { position: value });
|
|
12068
12125
|
}
|
|
@@ -12080,12 +12137,23 @@ var Participant = class extends Destroyable {
|
|
|
12080
12137
|
async end() {
|
|
12081
12138
|
await this.executeMethod(this.id, "call.end", {});
|
|
12082
12139
|
}
|
|
12140
|
+
/**
|
|
12141
|
+
* Replaces custom metadata for this participant.
|
|
12142
|
+
* @param _meta - Metadata object to set.
|
|
12143
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12144
|
+
*/
|
|
12083
12145
|
async setMeta(_meta) {
|
|
12084
12146
|
throw new UnimplementedError();
|
|
12085
12147
|
}
|
|
12148
|
+
/**
|
|
12149
|
+
* Merges values into custom metadata (unlike {@link setMeta} which replaces).
|
|
12150
|
+
* @param _meta - Metadata to merge.
|
|
12151
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
12152
|
+
*/
|
|
12086
12153
|
async updateMeta(_meta) {
|
|
12087
12154
|
throw new UnimplementedError();
|
|
12088
12155
|
}
|
|
12156
|
+
/** Destroys the participant, releasing all subscriptions and references. */
|
|
12089
12157
|
destroy() {
|
|
12090
12158
|
this.executeMethod = void 0;
|
|
12091
12159
|
super.destroy();
|
|
@@ -12098,6 +12166,7 @@ var Participant = class extends Destroyable {
|
|
|
12098
12166
|
* and local media stream management.
|
|
12099
12167
|
*/
|
|
12100
12168
|
var SelfParticipant = class extends Participant {
|
|
12169
|
+
/** @internal */
|
|
12101
12170
|
constructor(id, executeMethod, vertoManager, deviceController) {
|
|
12102
12171
|
super(id, executeMethod, deviceController);
|
|
12103
12172
|
this.vertoManager = vertoManager;
|
|
@@ -12188,6 +12257,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12188
12257
|
this.deviceController.selectAudioOutputDevice(device);
|
|
12189
12258
|
if (options.savePreference) PreferencesContainer.instance.preferredAudioOutput = device;
|
|
12190
12259
|
}
|
|
12260
|
+
/** Mutes local audio. Falls back to local device mute if the server RPC fails. */
|
|
12191
12261
|
async mute() {
|
|
12192
12262
|
try {
|
|
12193
12263
|
await super.mute();
|
|
@@ -12197,6 +12267,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12197
12267
|
this.vertoManager.muteMainAudioInputDevice();
|
|
12198
12268
|
}
|
|
12199
12269
|
}
|
|
12270
|
+
/** Unmutes local audio. Falls back to local device unmute if the server RPC fails. */
|
|
12200
12271
|
async unmute() {
|
|
12201
12272
|
try {
|
|
12202
12273
|
await super.unmute();
|
|
@@ -12206,6 +12277,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12206
12277
|
await this.vertoManager.unmuteMainAudioInputDevice();
|
|
12207
12278
|
}
|
|
12208
12279
|
}
|
|
12280
|
+
/** Mutes local video. Falls back to local device mute if the server RPC fails. */
|
|
12209
12281
|
async muteVideo() {
|
|
12210
12282
|
try {
|
|
12211
12283
|
await super.muteVideo();
|
|
@@ -12215,6 +12287,7 @@ var SelfParticipant = class extends Participant {
|
|
|
12215
12287
|
this.vertoManager.muteMainVideoInputDevice();
|
|
12216
12288
|
}
|
|
12217
12289
|
}
|
|
12290
|
+
/** Unmutes local video. Falls back to local device unmute if the server RPC fails. */
|
|
12218
12291
|
async unmuteVideo() {
|
|
12219
12292
|
try {
|
|
12220
12293
|
await super.unmuteVideo();
|
|
@@ -12244,6 +12317,9 @@ function isJSONRPCRequest(value) {
|
|
|
12244
12317
|
function isJSONRPCResponse(value) {
|
|
12245
12318
|
return isObject(value) && hasProperty(value, "jsonrpc") && value.jsonrpc === "2.0" && hasProperty(value, "id") && typeof value.id === "string" && (hasProperty(value, "result") || hasProperty(value, "error"));
|
|
12246
12319
|
}
|
|
12320
|
+
function isJSONRPCErrorResponse(value) {
|
|
12321
|
+
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"));
|
|
12322
|
+
}
|
|
12247
12323
|
|
|
12248
12324
|
//#endregion
|
|
12249
12325
|
//#region src/core/RPCMessages/guards/events.guards.ts
|
|
@@ -14086,6 +14162,11 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14086
14162
|
].includes(connectionState)))));
|
|
14087
14163
|
}
|
|
14088
14164
|
initSubscriptions() {
|
|
14165
|
+
this.subscribeTo(this.callJoinedEvent$, (event) => {
|
|
14166
|
+
const memberNodeId = event.room_session.members.find((m) => m.call_id === event.call_id)?.node_id;
|
|
14167
|
+
if (memberNodeId) this.setNodeIdIfNull(memberNodeId);
|
|
14168
|
+
if (event.member_id) this.setSelfIdIfNull(event.member_id);
|
|
14169
|
+
});
|
|
14089
14170
|
this.subscribeTo(this.vertoMedia$, (event) => {
|
|
14090
14171
|
logger$10.debug("[WebRTCManager] Received Verto media event (early media SDP):", event);
|
|
14091
14172
|
this._signalingStatus$.next("ringing");
|
|
@@ -14117,6 +14198,28 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14117
14198
|
this.sendVertoPong(vertoPing);
|
|
14118
14199
|
});
|
|
14119
14200
|
}
|
|
14201
|
+
/**
|
|
14202
|
+
* Set node_id/selfId only when the current value is null.
|
|
14203
|
+
*
|
|
14204
|
+
* During reattach, `call.joined` and `verto.answer` events can deliver
|
|
14205
|
+
* these identifiers before the `verto.invite` RPC response (`CALL CREATED`)
|
|
14206
|
+
* arrives. These methods let early events populate them eagerly so that
|
|
14207
|
+
* downstream RPC calls (e.g. `call.layout.list`) don't fail with empty
|
|
14208
|
+
* identifiers. `processInviteResponse()` remains the authoritative source
|
|
14209
|
+
* and always overwrites unconditionally.
|
|
14210
|
+
*/
|
|
14211
|
+
setNodeIdIfNull(nodeId) {
|
|
14212
|
+
if (!this._nodeId$.value && nodeId) {
|
|
14213
|
+
logger$10.debug(`[WebRTCManager] Early node_id set: ${nodeId}`);
|
|
14214
|
+
this._nodeId$.next(nodeId);
|
|
14215
|
+
}
|
|
14216
|
+
}
|
|
14217
|
+
setSelfIdIfNull(selfId) {
|
|
14218
|
+
if (!this._selfId$.value && selfId) {
|
|
14219
|
+
logger$10.debug(`[WebRTCManager] Early selfId set: ${selfId}`);
|
|
14220
|
+
this._selfId$.next(selfId);
|
|
14221
|
+
}
|
|
14222
|
+
}
|
|
14120
14223
|
async sendVertoPong(vertoPing) {
|
|
14121
14224
|
try {
|
|
14122
14225
|
const vertoPongMessage = VertoPong({ ...vertoPing });
|
|
@@ -14140,6 +14243,9 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14140
14243
|
get selfId() {
|
|
14141
14244
|
return this._selfId$.value;
|
|
14142
14245
|
}
|
|
14246
|
+
get callJoinedEvent$() {
|
|
14247
|
+
return this.webRtcCallSession.callEvent$.pipe((0, import_cjs$10.filter)(isCallJoinedPayload), (0, import_cjs$10.takeUntil)(this.destroyed$));
|
|
14248
|
+
}
|
|
14143
14249
|
get vertoMedia$() {
|
|
14144
14250
|
return this.webRtcCallSession.webrtcMessages$.pipe(filterAs(isVertoMediaInnerParams, "params"), (0, import_cjs$10.takeUntil)(this.destroyed$));
|
|
14145
14251
|
}
|
|
@@ -14446,7 +14552,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14446
14552
|
*
|
|
14447
14553
|
* @see selectAudioInputDevice
|
|
14448
14554
|
* @see selectVideoInputDevice
|
|
14449
|
-
* @param options
|
|
14555
|
+
* @param options - Media options specifying which input devices to add (defaults to audio only).
|
|
14450
14556
|
*/
|
|
14451
14557
|
async addMainInputDevices(options = { audio: true }) {
|
|
14452
14558
|
let deviceKind = void 0;
|
|
@@ -14530,7 +14636,7 @@ var WebRTCVertoManager = class extends VertoManager {
|
|
|
14530
14636
|
try {
|
|
14531
14637
|
const causeParams = cause ? {
|
|
14532
14638
|
cause,
|
|
14533
|
-
|
|
14639
|
+
causeCode: VertoByeCauseCodes[cause]
|
|
14534
14640
|
} : {};
|
|
14535
14641
|
await this.executeVerto(VertoBye({
|
|
14536
14642
|
...causeParams,
|
|
@@ -14671,7 +14777,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14671
14777
|
}
|
|
14672
14778
|
/** Observable stream of errors from media, signaling, and peer connection layers. */
|
|
14673
14779
|
get errors$() {
|
|
14674
|
-
return this._errors$.asObservable();
|
|
14780
|
+
return this.deferEmission(this._errors$.asObservable());
|
|
14675
14781
|
}
|
|
14676
14782
|
/**
|
|
14677
14783
|
* @internal Push an error to the call's error stream.
|
|
@@ -14691,7 +14797,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14691
14797
|
}
|
|
14692
14798
|
/** Observable of the address associated with this call. */
|
|
14693
14799
|
get address$() {
|
|
14694
|
-
return (0, import_cjs$9.from)([this.address]);
|
|
14800
|
+
return this.deferEmission((0, import_cjs$9.from)([this.address])).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14695
14801
|
}
|
|
14696
14802
|
/** Display name of the caller. */
|
|
14697
14803
|
get fromName() {
|
|
@@ -14729,36 +14835,64 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14729
14835
|
get self() {
|
|
14730
14836
|
return this.callEventsManager.self;
|
|
14731
14837
|
}
|
|
14838
|
+
/** Toggles the call lock state, preventing or allowing new participants from joining. */
|
|
14732
14839
|
async toggleLock() {
|
|
14733
14840
|
const method = this.locked ? "call.unlock" : "call.lock";
|
|
14734
14841
|
await this.executeMethod(this.selfId ?? "", method, {});
|
|
14735
14842
|
}
|
|
14843
|
+
/**
|
|
14844
|
+
* Toggles the hold state of the call (pauses/resumes local media transmission).
|
|
14845
|
+
*
|
|
14846
|
+
* Distinct from {@link Participant.toggleMute} which mutes individual tracks.
|
|
14847
|
+
*/
|
|
14736
14848
|
async toggleHold() {
|
|
14737
14849
|
if (this._holdState) await this.vertoManager.unhold();
|
|
14738
14850
|
else await this.vertoManager.hold();
|
|
14739
14851
|
this._holdState = !this._holdState;
|
|
14740
14852
|
}
|
|
14853
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link recording$}. */
|
|
14741
14854
|
async startRecording() {
|
|
14742
14855
|
throw new UnimplementedError();
|
|
14743
14856
|
}
|
|
14857
|
+
/** @throws {UnimplementedError} Not yet implemented. Status tracked via {@link streaming$}. */
|
|
14744
14858
|
async startStreaming() {
|
|
14745
14859
|
throw new UnimplementedError();
|
|
14746
14860
|
}
|
|
14861
|
+
/**
|
|
14862
|
+
* Replaces the call's custom metadata.
|
|
14863
|
+
* @param _meta - Metadata object to set.
|
|
14864
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14865
|
+
*/
|
|
14747
14866
|
async setMeta(_meta) {
|
|
14748
14867
|
throw new UnimplementedError();
|
|
14749
14868
|
}
|
|
14869
|
+
/**
|
|
14870
|
+
* Merges values into the call's custom metadata (unlike {@link setMeta} which replaces).
|
|
14871
|
+
* @param _meta - Metadata to merge.
|
|
14872
|
+
* @throws {UnimplementedError} Not yet implemented.
|
|
14873
|
+
*/
|
|
14750
14874
|
async updateMeta(_meta) {
|
|
14751
14875
|
throw new UnimplementedError();
|
|
14752
14876
|
}
|
|
14753
14877
|
/** Observable of layout layer positions for all participants. */
|
|
14754
14878
|
get layoutLayers$() {
|
|
14755
|
-
return this.callEventsManager.layoutLayers
|
|
14879
|
+
return this.deferEmission(this.callEventsManager.layoutLayers$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14756
14880
|
}
|
|
14757
14881
|
/** Current snapshot of layout layers. */
|
|
14758
14882
|
get layoutLayers() {
|
|
14759
14883
|
return this.callEventsManager.layoutLayers;
|
|
14760
14884
|
}
|
|
14761
|
-
/**
|
|
14885
|
+
/**
|
|
14886
|
+
* Executes a Verto RPC method targeting a specific participant.
|
|
14887
|
+
*
|
|
14888
|
+
* Constructs call context (node_id, call_id, member_id) and sends the RPC request.
|
|
14889
|
+
*
|
|
14890
|
+
* @param target - Target member ID string, or a {@link MemberTarget} object.
|
|
14891
|
+
* @param method - Verto method name (e.g. `'call.mute'`, `'call.member.remove'`).
|
|
14892
|
+
* @param args - Parameters for the RPC method.
|
|
14893
|
+
* @returns The RPC response.
|
|
14894
|
+
* @throws {JSONRPCError} If the RPC call returns an error.
|
|
14895
|
+
*/
|
|
14762
14896
|
async executeMethod(target, method, args) {
|
|
14763
14897
|
const params = this.buildMethodParams(target, args);
|
|
14764
14898
|
const request = buildRPCRequest({
|
|
@@ -14766,7 +14900,9 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14766
14900
|
params
|
|
14767
14901
|
});
|
|
14768
14902
|
try {
|
|
14769
|
-
|
|
14903
|
+
const response = await this.clientSession.execute(request);
|
|
14904
|
+
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);
|
|
14905
|
+
return response;
|
|
14770
14906
|
} catch (error) {
|
|
14771
14907
|
logger$9.error(`[Call] Error executing method ${method} with params`, params, error);
|
|
14772
14908
|
throw error;
|
|
@@ -14795,45 +14931,45 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14795
14931
|
}
|
|
14796
14932
|
/** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
|
|
14797
14933
|
get status$() {
|
|
14798
|
-
return this.
|
|
14934
|
+
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) => {
|
|
14799
14935
|
this._lastMergedStatus = status;
|
|
14800
14936
|
})));
|
|
14801
14937
|
}
|
|
14802
14938
|
/** Observable of the participants list, emits on join/leave/update. */
|
|
14803
14939
|
get participants$() {
|
|
14804
|
-
return this.callEventsManager.participants
|
|
14940
|
+
return this.deferEmission(this.callEventsManager.participants$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14805
14941
|
}
|
|
14806
14942
|
/** Observable of the local (self) participant. */
|
|
14807
14943
|
get self$() {
|
|
14808
|
-
return this.callEventsManager.self
|
|
14944
|
+
return this.deferEmission(this.callEventsManager.self$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14809
14945
|
}
|
|
14810
14946
|
/** Observable indicating whether the call is being recorded. */
|
|
14811
14947
|
get recording$() {
|
|
14812
|
-
return this.callEventsManager.recording
|
|
14948
|
+
return this.deferEmission(this.callEventsManager.recording$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14813
14949
|
}
|
|
14814
14950
|
/** Observable indicating whether the call is being streamed. */
|
|
14815
14951
|
get streaming$() {
|
|
14816
|
-
return this.callEventsManager.streaming
|
|
14952
|
+
return this.deferEmission(this.callEventsManager.streaming$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14817
14953
|
}
|
|
14818
14954
|
/** Observable indicating whether raise-hand priority is active. */
|
|
14819
14955
|
get raiseHandPriority$() {
|
|
14820
|
-
return this.callEventsManager.raiseHandPriority
|
|
14956
|
+
return this.deferEmission(this.callEventsManager.raiseHandPriority$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14821
14957
|
}
|
|
14822
14958
|
/** Observable indicating whether the call room is locked. */
|
|
14823
14959
|
get locked$() {
|
|
14824
|
-
return this.callEventsManager.locked
|
|
14960
|
+
return this.deferEmission(this.callEventsManager.locked$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14825
14961
|
}
|
|
14826
14962
|
/** Observable of custom metadata associated with the call. */
|
|
14827
14963
|
get meta$() {
|
|
14828
|
-
return this.callEventsManager.meta
|
|
14964
|
+
return this.deferEmission(this.callEventsManager.meta$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14829
14965
|
}
|
|
14830
14966
|
/** Observable of the call's capability flags. */
|
|
14831
14967
|
get capabilities$() {
|
|
14832
|
-
return this.callEventsManager.capabilities
|
|
14968
|
+
return this.deferEmission(this.callEventsManager.capabilities$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14833
14969
|
}
|
|
14834
14970
|
/** Observable of the current layout name. */
|
|
14835
14971
|
get layout$() {
|
|
14836
|
-
return this.callEventsManager.layout
|
|
14972
|
+
return this.deferEmission(this.callEventsManager.layout$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14837
14973
|
}
|
|
14838
14974
|
/** Current call status. */
|
|
14839
14975
|
get status() {
|
|
@@ -14865,7 +15001,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14865
15001
|
}
|
|
14866
15002
|
/** Observable of available layout names. */
|
|
14867
15003
|
get layouts$() {
|
|
14868
|
-
return this.callEventsManager.layouts
|
|
15004
|
+
return this.deferEmission(this.callEventsManager.layouts$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14869
15005
|
}
|
|
14870
15006
|
/** Current snapshot of available layout names. */
|
|
14871
15007
|
get layouts() {
|
|
@@ -14873,7 +15009,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14873
15009
|
}
|
|
14874
15010
|
/** Observable of the local media stream (camera/microphone). */
|
|
14875
15011
|
get localStream$() {
|
|
14876
|
-
return this.vertoManager.localStream
|
|
15012
|
+
return this.deferEmission(this.vertoManager.localStream$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14877
15013
|
}
|
|
14878
15014
|
/** Current local media stream, or `null` if not available. */
|
|
14879
15015
|
get localStream() {
|
|
@@ -14881,7 +15017,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14881
15017
|
}
|
|
14882
15018
|
/** Observable of the remote media stream from the far end. */
|
|
14883
15019
|
get remoteStream$() {
|
|
14884
|
-
return this.vertoManager.remoteStream
|
|
15020
|
+
return this.deferEmission(this.vertoManager.remoteStream$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14885
15021
|
}
|
|
14886
15022
|
/** Current remote media stream, or `null` if not available. */
|
|
14887
15023
|
get remoteStream() {
|
|
@@ -14889,7 +15025,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14889
15025
|
}
|
|
14890
15026
|
/** Observable of custom user variables associated with the call. */
|
|
14891
15027
|
get userVariables$() {
|
|
14892
|
-
return this._userVariables$.asObservable();
|
|
15028
|
+
return this.deferEmission(this._userVariables$.asObservable());
|
|
14893
15029
|
}
|
|
14894
15030
|
/** a copy of the current custom user variables of the call. */
|
|
14895
15031
|
get userVariables() {
|
|
@@ -14909,7 +15045,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14909
15045
|
}
|
|
14910
15046
|
/** Observable of the current audio/video send/receive directions. */
|
|
14911
15047
|
get mediaDirections$() {
|
|
14912
|
-
return this.vertoManager.mediaDirections
|
|
15048
|
+
return this.deferEmission(this.vertoManager.mediaDirections$).pipe((0, import_cjs$9.takeUntil)(this._destroyed$));
|
|
14913
15049
|
}
|
|
14914
15050
|
/** Current audio/video send/receive directions. */
|
|
14915
15051
|
get mediaDirections() {
|
|
@@ -14918,7 +15054,16 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14918
15054
|
get participantsId$() {
|
|
14919
15055
|
return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, import_cjs$9.map)((participants) => participants.map((participant) => participant.id))));
|
|
14920
15056
|
}
|
|
14921
|
-
/**
|
|
15057
|
+
/**
|
|
15058
|
+
* Executes a raw JSON-RPC request on the client session.
|
|
15059
|
+
*
|
|
15060
|
+
* Lower-level than {@link executeMethod} — allows full control over the RPC request structure.
|
|
15061
|
+
*
|
|
15062
|
+
* @param request - Complete JSON-RPC request object.
|
|
15063
|
+
* @param options - Optional RPC execution options (timeout, etc.).
|
|
15064
|
+
* @returns The RPC response.
|
|
15065
|
+
* @throws {JSONRPCError} If the RPC call returns an error response.
|
|
15066
|
+
*/
|
|
14922
15067
|
async execute(request, options) {
|
|
14923
15068
|
return this.clientSession.execute(request, options);
|
|
14924
15069
|
}
|
|
@@ -14955,31 +15100,31 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14955
15100
|
}
|
|
14956
15101
|
/** Observable of call-updated events. */
|
|
14957
15102
|
get callUpdated$() {
|
|
14958
|
-
return this.
|
|
15103
|
+
return this.publicCachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(filterAs(isCallUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14959
15104
|
}
|
|
14960
|
-
/** Observable of member-joined events. */
|
|
15105
|
+
/** Observable of member-joined events, emitted when a remote participant joins the call. */
|
|
14961
15106
|
get memberJoined$() {
|
|
14962
|
-
return this.
|
|
15107
|
+
return this.publicCachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(filterAs(isMemberJoinedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14963
15108
|
}
|
|
14964
|
-
/** Observable of member-left events. */
|
|
15109
|
+
/** Observable of member-left events, emitted when a participant leaves the call. */
|
|
14965
15110
|
get memberLeft$() {
|
|
14966
|
-
return this.
|
|
15111
|
+
return this.publicCachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(filterAs(isMemberLeftMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14967
15112
|
}
|
|
14968
15113
|
/** Observable of member-updated events (mute, volume, etc.). */
|
|
14969
15114
|
get memberUpdated$() {
|
|
14970
|
-
return this.
|
|
15115
|
+
return this.publicCachedObservable("memberUpdated$", () => this.callSessionEvents$.pipe(filterAs(isMemberUpdatedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14971
15116
|
}
|
|
14972
15117
|
/** Observable of member-talking events (speech start/stop). */
|
|
14973
15118
|
get memberTalking$() {
|
|
14974
|
-
return this.
|
|
15119
|
+
return this.publicCachedObservable("memberTalking$", () => this.callSessionEvents$.pipe(filterAs(isMemberTalkingMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14975
15120
|
}
|
|
14976
15121
|
/** Observable of call state-change events. */
|
|
14977
15122
|
get callStates$() {
|
|
14978
|
-
return this.
|
|
15123
|
+
return this.publicCachedObservable("callStates$", () => this.callSessionEvents$.pipe(filterAs(isCallStateMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14979
15124
|
}
|
|
14980
15125
|
/** Observable of layout-changed events. */
|
|
14981
15126
|
get layoutUpdates$() {
|
|
14982
|
-
return this.
|
|
15127
|
+
return this.publicCachedObservable("layoutUpdates$", () => this.callSessionEvents$.pipe(filterAs(isLayoutChangedMetadata, "params"), (0, import_cjs$9.takeUntil)(this.destroyed$)));
|
|
14983
15128
|
}
|
|
14984
15129
|
/** Underlying `RTCPeerConnection`, for advanced use cases. */
|
|
14985
15130
|
get rtcPeerConnection() {
|
|
@@ -14987,7 +15132,7 @@ var WebRTCCall = class extends Destroyable {
|
|
|
14987
15132
|
}
|
|
14988
15133
|
/** Observable of raw signaling events as plain objects. */
|
|
14989
15134
|
get signalingEvent$() {
|
|
14990
|
-
return this.
|
|
15135
|
+
return this.publicCachedObservable("signalingEvent$", () => this.callEvent$.pipe((0, import_cjs$9.map)((event) => JSON.parse(JSON.stringify(event)))));
|
|
14991
15136
|
}
|
|
14992
15137
|
/** Observable of WebRTC-specific signaling messages. */
|
|
14993
15138
|
get webrtcMessages$() {
|
|
@@ -15001,7 +15146,17 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15001
15146
|
get layoutEvent$() {
|
|
15002
15147
|
return this.cachedObservable("layoutEvent$", () => this.callEvent$.pipe(filterAs(isLayoutChangedMetadata, "params")));
|
|
15003
15148
|
}
|
|
15004
|
-
/**
|
|
15149
|
+
/**
|
|
15150
|
+
* Hangs up the call and releases all resources.
|
|
15151
|
+
*
|
|
15152
|
+
* Sends a Verto `bye` to the server, transitions status to `'disconnecting'`,
|
|
15153
|
+
* then destroys the call. After this, the call instance is no longer usable.
|
|
15154
|
+
*
|
|
15155
|
+
* @example
|
|
15156
|
+
* ```ts
|
|
15157
|
+
* await call.hangup();
|
|
15158
|
+
* ```
|
|
15159
|
+
*/
|
|
15005
15160
|
async hangup() {
|
|
15006
15161
|
this._status$.next("disconnecting");
|
|
15007
15162
|
try {
|
|
@@ -15010,11 +15165,35 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15010
15165
|
this.destroy();
|
|
15011
15166
|
}
|
|
15012
15167
|
}
|
|
15013
|
-
/**
|
|
15168
|
+
/**
|
|
15169
|
+
* Sends DTMF digits on the call.
|
|
15170
|
+
*
|
|
15171
|
+
* @param dtmf - The digit string to send (e.g. `'1234#'`).
|
|
15172
|
+
*
|
|
15173
|
+
* @example
|
|
15174
|
+
* ```ts
|
|
15175
|
+
* await call.sendDigits('1234#');
|
|
15176
|
+
* ```
|
|
15177
|
+
*/
|
|
15014
15178
|
async sendDigits(dtmf) {
|
|
15015
15179
|
return this.vertoManager.sendDigits(dtmf);
|
|
15016
15180
|
}
|
|
15017
|
-
/**
|
|
15181
|
+
/**
|
|
15182
|
+
* Accepts an inbound call, optionally overriding media options for the answer.
|
|
15183
|
+
*
|
|
15184
|
+
* @param options - Optional media constraints for the answer (audio/video).
|
|
15185
|
+
*
|
|
15186
|
+
* @example
|
|
15187
|
+
* ```ts
|
|
15188
|
+
* // Accept with defaults
|
|
15189
|
+
* call.answer();
|
|
15190
|
+
*
|
|
15191
|
+
* // Accept audio-only
|
|
15192
|
+
* call.answer({ audio: true, video: false });
|
|
15193
|
+
* ```
|
|
15194
|
+
* @see {@link reject} to decline the call instead.
|
|
15195
|
+
* @see {@link answered$} to observe the acceptance state.
|
|
15196
|
+
*/
|
|
15018
15197
|
answer(options) {
|
|
15019
15198
|
this._answerMediaOptions = options;
|
|
15020
15199
|
this._answered$.next(true);
|
|
@@ -15023,18 +15202,32 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15023
15202
|
get answerMediaOptions() {
|
|
15024
15203
|
return this._answerMediaOptions;
|
|
15025
15204
|
}
|
|
15026
|
-
/**
|
|
15205
|
+
/**
|
|
15206
|
+
* Rejects an inbound call, preventing media negotiation.
|
|
15207
|
+
*
|
|
15208
|
+
* @see {@link answer} to accept the call instead.
|
|
15209
|
+
* @see {@link answered$} to observe the rejection state.
|
|
15210
|
+
*/
|
|
15027
15211
|
reject() {
|
|
15028
15212
|
this._answered$.next(false);
|
|
15029
15213
|
}
|
|
15030
15214
|
/** Observable that emits `true` when answered, `false` when rejected. */
|
|
15031
15215
|
get answered$() {
|
|
15032
|
-
return this._answered$.asObservable();
|
|
15216
|
+
return this.deferEmission(this._answered$.asObservable());
|
|
15033
15217
|
}
|
|
15034
15218
|
/**
|
|
15035
15219
|
* Sets the call layout and participant positions.
|
|
15220
|
+
*
|
|
15036
15221
|
* @param layout - Layout name (must be one of {@link layouts}).
|
|
15037
|
-
* @param positions - Map of member IDs to
|
|
15222
|
+
* @param positions - Map of member IDs to {@link VideoPosition} values.
|
|
15223
|
+
* @throws {InvalidParams} If the layout is not in the available {@link layouts}.
|
|
15224
|
+
*
|
|
15225
|
+
* @example
|
|
15226
|
+
* ```ts
|
|
15227
|
+
* await call.setLayout('grid-responsive', {
|
|
15228
|
+
* [participantId]: 'reserved-0',
|
|
15229
|
+
* });
|
|
15230
|
+
* ```
|
|
15038
15231
|
*/
|
|
15039
15232
|
async setLayout(layout, positions) {
|
|
15040
15233
|
if (!this.layouts.includes(layout)) throw new InvalidParams(`Layout ${layout} is not available in the current call layouts: ${this.layouts.join(", ")}`);
|
|
@@ -15044,7 +15237,12 @@ var WebRTCCall = class extends Destroyable {
|
|
|
15044
15237
|
positions
|
|
15045
15238
|
});
|
|
15046
15239
|
}
|
|
15047
|
-
/**
|
|
15240
|
+
/**
|
|
15241
|
+
* Transfers the call to another destination.
|
|
15242
|
+
*
|
|
15243
|
+
* @param options - Transfer configuration including the target destination.
|
|
15244
|
+
* @see {@link status$} to observe the transfer progress.
|
|
15245
|
+
*/
|
|
15048
15246
|
async transfer(options) {
|
|
15049
15247
|
return this.vertoManager.transfer(options);
|
|
15050
15248
|
}
|
|
@@ -15405,11 +15603,28 @@ var Address = class extends Destroyable {
|
|
|
15405
15603
|
get locked$() {
|
|
15406
15604
|
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$)));
|
|
15407
15605
|
}
|
|
15408
|
-
/**
|
|
15606
|
+
/**
|
|
15607
|
+
* Sends a text message to this address.
|
|
15608
|
+
*
|
|
15609
|
+
* @param text - The message text to send.
|
|
15610
|
+
*
|
|
15611
|
+
* @example
|
|
15612
|
+
* ```ts
|
|
15613
|
+
* await address.sendText('Hello!');
|
|
15614
|
+
* ```
|
|
15615
|
+
*/
|
|
15409
15616
|
async sendText(text) {
|
|
15410
15617
|
return this.conversationManager.sendText(text, this.id);
|
|
15411
15618
|
}
|
|
15412
|
-
/**
|
|
15619
|
+
/**
|
|
15620
|
+
* Collection of text messages for this address, with pagination support.
|
|
15621
|
+
*
|
|
15622
|
+
* Returns `undefined` until {@link textMessages$} has been subscribed to (lazy-loaded).
|
|
15623
|
+
* Filters to `'chat'` subtype messages from the conversation.
|
|
15624
|
+
*
|
|
15625
|
+
* @see {@link textMessages$} to trigger lazy loading.
|
|
15626
|
+
* @see {@link sendText} to send a new message.
|
|
15627
|
+
*/
|
|
15413
15628
|
get textMessage() {
|
|
15414
15629
|
if (!this._conversationMessages) return;
|
|
15415
15630
|
this._textMessages$ = this._textMessages$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "chat", (item) => ({
|
|
@@ -15420,7 +15635,14 @@ var Address = class extends Destroyable {
|
|
|
15420
15635
|
}));
|
|
15421
15636
|
return this._textMessages$;
|
|
15422
15637
|
}
|
|
15423
|
-
/**
|
|
15638
|
+
/**
|
|
15639
|
+
* Collection of call history entries for this address, with pagination support.
|
|
15640
|
+
*
|
|
15641
|
+
* Returns `undefined` until {@link history$} has been subscribed to (lazy-loaded).
|
|
15642
|
+
* Filters to `'log'` subtype messages including kind, status, start/end times.
|
|
15643
|
+
*
|
|
15644
|
+
* @see {@link history$} to trigger lazy loading.
|
|
15645
|
+
*/
|
|
15424
15646
|
get history() {
|
|
15425
15647
|
if (!this._conversationMessages) return;
|
|
15426
15648
|
this._history$ = this._history$ ?? new EntityCollectionTransformed(this._conversationMessages, (item) => item.subtype === "log", (item) => ({
|
|
@@ -15486,7 +15708,7 @@ var PendingRPC = class PendingRPC {
|
|
|
15486
15708
|
next: (response) => {
|
|
15487
15709
|
isSettled = true;
|
|
15488
15710
|
if (response.error) {
|
|
15489
|
-
const rpcError = new
|
|
15711
|
+
const rpcError = new JSONRPCError(response.error.code, response.error.message, response.error.data, void 0, request.id);
|
|
15490
15712
|
logger$7.debug(`[PendingRPC(${this.id}) request:${request.id}] Rejecting promise with RPC error:`, rpcError);
|
|
15491
15713
|
reject(rpcError);
|
|
15492
15714
|
} else {
|
|
@@ -15777,6 +15999,7 @@ var ClientSessionManager = class extends Destroyable {
|
|
|
15777
15999
|
...params,
|
|
15778
16000
|
...persistedParams
|
|
15779
16001
|
});
|
|
16002
|
+
this.transport.resetSessionEpoch();
|
|
15780
16003
|
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)(() => {
|
|
15781
16004
|
logger$6.debug("[Session] Response passed filter, processing authentication result");
|
|
15782
16005
|
}), (0, import_cjs$5.take)(1), (0, import_cjs$5.catchError)((err) => {
|
|
@@ -16009,11 +16232,18 @@ var AddressFetcher = class extends Fetcher {
|
|
|
16009
16232
|
logger$4.error("Failed to fetch addresses");
|
|
16010
16233
|
}
|
|
16011
16234
|
};
|
|
16235
|
+
/** Collection of address states with reactive updates and pagination. */
|
|
16012
16236
|
var AddressStateCollection = class extends EntityCollection {
|
|
16013
16237
|
constructor(update$, http, onError) {
|
|
16014
16238
|
super(new AddressFetcher(http), update$, onError);
|
|
16015
16239
|
}
|
|
16016
16240
|
};
|
|
16241
|
+
/**
|
|
16242
|
+
* Manages the directory of {@link Address} entries with paginated loading.
|
|
16243
|
+
*
|
|
16244
|
+
* Implements the {@link Directory} interface and provides reactive access to
|
|
16245
|
+
* addresses via observables, along with pagination and lookup methods.
|
|
16246
|
+
*/
|
|
16017
16247
|
var DirectoryManager = class extends Destroyable {
|
|
16018
16248
|
constructor(http, clientSession, conversationManager, onError) {
|
|
16019
16249
|
super();
|
|
@@ -16038,6 +16268,7 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16038
16268
|
this._statesCollection = new AddressStateCollection(clientSession.signalingEvent$.pipe(filterAs(isConversationMessageUpdatedMetadata, "params"), (0, import_cjs$2.map)((_) => ({}))), this.http, this.onError);
|
|
16039
16269
|
this.initSubscriptions();
|
|
16040
16270
|
}
|
|
16271
|
+
/** Whether addresses are currently being loaded from the server. */
|
|
16041
16272
|
get loading() {
|
|
16042
16273
|
return this._statesCollection.loading;
|
|
16043
16274
|
}
|
|
@@ -16051,28 +16282,57 @@ var DirectoryManager = class extends Destroyable {
|
|
|
16051
16282
|
}
|
|
16052
16283
|
});
|
|
16053
16284
|
}
|
|
16285
|
+
/** Observable stream of all addresses in the directory. */
|
|
16054
16286
|
get addresses$() {
|
|
16055
16287
|
return this._addresses$.asObservable();
|
|
16056
16288
|
}
|
|
16289
|
+
/** Current snapshot of all loaded addresses. */
|
|
16057
16290
|
get addresses() {
|
|
16058
16291
|
return this._addresses$.value;
|
|
16059
16292
|
}
|
|
16293
|
+
/** Observable indicating whether more addresses can be loaded. */
|
|
16060
16294
|
get hasMore$() {
|
|
16061
16295
|
return this._statesCollection.hasMore$;
|
|
16062
16296
|
}
|
|
16297
|
+
/** Observable of the current loading state. */
|
|
16063
16298
|
get loading$() {
|
|
16064
16299
|
return this._statesCollection.loading$;
|
|
16065
16300
|
}
|
|
16301
|
+
/**
|
|
16302
|
+
* Loads the next page of addresses from the server.
|
|
16303
|
+
*
|
|
16304
|
+
* No-op if {@link hasMore$} is `false`. Loading state is observable via {@link loading$}.
|
|
16305
|
+
* New addresses are appended to {@link addresses$} when the page loads.
|
|
16306
|
+
*/
|
|
16066
16307
|
loadMore() {
|
|
16067
16308
|
if (this._statesCollection.hasMore) this._statesCollection.loadMore();
|
|
16068
16309
|
}
|
|
16310
|
+
/**
|
|
16311
|
+
* Returns a reactive observable for a specific address by ID.
|
|
16312
|
+
* @param id - The address ID to observe.
|
|
16313
|
+
* @returns An observable of the address, or `undefined` if not found.
|
|
16314
|
+
*/
|
|
16069
16315
|
get$(id) {
|
|
16070
16316
|
if (!this._observableRegistry.has(id)) this.addNewAddress(id);
|
|
16071
16317
|
return this._observableRegistry.get(id);
|
|
16072
16318
|
}
|
|
16319
|
+
/**
|
|
16320
|
+
* Returns an address by ID from the local cache.
|
|
16321
|
+
* @param addressId - The address ID to look up.
|
|
16322
|
+
* @returns The address, or `undefined` if not found.
|
|
16323
|
+
*/
|
|
16073
16324
|
get(addressId) {
|
|
16074
16325
|
return this._addressesInstances.get(addressId);
|
|
16075
16326
|
}
|
|
16327
|
+
/**
|
|
16328
|
+
* Finds an address ID by its resource name (URI).
|
|
16329
|
+
*
|
|
16330
|
+
* Searches locally loaded addresses first, then queries the server if not found.
|
|
16331
|
+
* The resource name is the {@link Address.name} identifier, distinct from display name.
|
|
16332
|
+
*
|
|
16333
|
+
* @param name - The resource name to search for (exact match, e.g. `'/public/conference'`).
|
|
16334
|
+
* @returns The address ID, or `undefined` if no match is found locally or on server.
|
|
16335
|
+
*/
|
|
16076
16336
|
async findAddressIdByURI(name) {
|
|
16077
16337
|
let addressId = this._addressesInstances.values().find((addr) => addr.name === name)?.id;
|
|
16078
16338
|
if (!addressId) {
|
|
@@ -16260,7 +16520,30 @@ function isSignalwirePingRequest(value) {
|
|
|
16260
16520
|
//#region src/managers/TransportManager.ts
|
|
16261
16521
|
var import_cjs$1 = require_cjs();
|
|
16262
16522
|
const logger$2 = getLogger();
|
|
16263
|
-
var TransportManager = class extends Destroyable {
|
|
16523
|
+
var TransportManager = class TransportManager extends Destroyable {
|
|
16524
|
+
/**
|
|
16525
|
+
* Normalise a server event timestamp to epoch seconds.
|
|
16526
|
+
*
|
|
16527
|
+
* The server uses two formats:
|
|
16528
|
+
* - `webrtc.message`: float epoch seconds (e.g. 1774372099.022817)
|
|
16529
|
+
* - all other events: int epoch microseconds (e.g. 1774372099925857)
|
|
16530
|
+
*
|
|
16531
|
+
* Values above 1e12 are treated as microseconds and divided by 1e6.
|
|
16532
|
+
*/
|
|
16533
|
+
static toEpochSeconds(ts) {
|
|
16534
|
+
const n = typeof ts === "string" ? Number(ts) : ts;
|
|
16535
|
+
return n > 0xe8d4a51000 ? n / 1e6 : n;
|
|
16536
|
+
}
|
|
16537
|
+
/**
|
|
16538
|
+
* Extract the event timestamp from a signalwire.event message.
|
|
16539
|
+
* Returns `null` for messages that have no timestamp
|
|
16540
|
+
* (e.g. signalwire.authorization.state, RPC responses).
|
|
16541
|
+
*/
|
|
16542
|
+
static extractEventTimestamp(message) {
|
|
16543
|
+
if (!isSignalwireRequest(message)) return null;
|
|
16544
|
+
if (message.params.event_type === "signalwire.authorization.state") return null;
|
|
16545
|
+
return TransportManager.toEpochSeconds(message.params.timestamp);
|
|
16546
|
+
}
|
|
16264
16547
|
constructor(storage, protocolKey, webSocketConstructor, relayHost, onError) {
|
|
16265
16548
|
super();
|
|
16266
16549
|
this.storage = storage;
|
|
@@ -16293,6 +16576,23 @@ var TransportManager = class extends Destroyable {
|
|
|
16293
16576
|
return true;
|
|
16294
16577
|
});
|
|
16295
16578
|
};
|
|
16579
|
+
this.discardStaleEvents = () => {
|
|
16580
|
+
return (0, import_cjs$1.filter)((message) => {
|
|
16581
|
+
const ts = TransportManager.extractEventTimestamp(message);
|
|
16582
|
+
if (ts === null) return true;
|
|
16583
|
+
if (this._sessionEpoch === null) {
|
|
16584
|
+
this._sessionEpoch = ts;
|
|
16585
|
+
return true;
|
|
16586
|
+
}
|
|
16587
|
+
if (ts < this._sessionEpoch) {
|
|
16588
|
+
const eventType = isSignalwireRequest(message) ? message.params.event_type : "unknown";
|
|
16589
|
+
logger$2.warn(`[Transport] Discarding stale event: ${eventType} (timestamp=${ts.toFixed(3)}, sessionEpoch=${this._sessionEpoch.toFixed(3)}, delta=${(this._sessionEpoch - ts).toFixed(3)}s)`);
|
|
16590
|
+
return false;
|
|
16591
|
+
}
|
|
16592
|
+
return true;
|
|
16593
|
+
});
|
|
16594
|
+
};
|
|
16595
|
+
this._sessionEpoch = null;
|
|
16296
16596
|
this._outgoingMessages$ = this.createSubject();
|
|
16297
16597
|
this._webSocketConnections = new WebSocketController(webSocketConstructor, relayHost, this._outgoingMessages$.asObservable(), {
|
|
16298
16598
|
connectionTimeout: PreferencesContainer.instance.connectionTimeout,
|
|
@@ -16317,7 +16617,14 @@ var TransportManager = class extends Destroyable {
|
|
|
16317
16617
|
return import_cjs$1.EMPTY;
|
|
16318
16618
|
}), (0, import_cjs$1.share)(), (0, import_cjs$1.takeUntil)(this.destroyed$));
|
|
16319
16619
|
this._jsonRPCResponse$ = this._jsonRPCMessage$.pipe((0, import_cjs$1.filter)(isJSONRPCResponse));
|
|
16320
|
-
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$));
|
|
16620
|
+
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$));
|
|
16621
|
+
}
|
|
16622
|
+
/**
|
|
16623
|
+
* Reset the session epoch. Call this before each signalwire.connect
|
|
16624
|
+
* so that the first event after authentication establishes the new baseline.
|
|
16625
|
+
*/
|
|
16626
|
+
resetSessionEpoch() {
|
|
16627
|
+
this._sessionEpoch = null;
|
|
16321
16628
|
}
|
|
16322
16629
|
async setProtocol(protocol) {
|
|
16323
16630
|
this.protocol$.next(protocol);
|
|
@@ -16460,6 +16767,12 @@ const buildOptionsFromDestination = (destination) => {
|
|
|
16460
16767
|
* ```
|
|
16461
16768
|
*/
|
|
16462
16769
|
var SignalWire = class extends Destroyable {
|
|
16770
|
+
/**
|
|
16771
|
+
* Creates a new SignalWire client and begins connecting.
|
|
16772
|
+
*
|
|
16773
|
+
* @param credentialProvider - Provider that supplies authentication credentials.
|
|
16774
|
+
* @param options - Configuration options (connection, device monitoring, preferences).
|
|
16775
|
+
*/
|
|
16463
16776
|
constructor(credentialProvider, options = {}) {
|
|
16464
16777
|
super();
|
|
16465
16778
|
this.preferences = new ClientPreferences();
|
|
@@ -16641,7 +16954,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16641
16954
|
* ```
|
|
16642
16955
|
*/
|
|
16643
16956
|
get subscriber$() {
|
|
16644
|
-
return this._subscriber$.asObservable();
|
|
16957
|
+
return this.deferEmission(this._subscriber$.asObservable());
|
|
16645
16958
|
}
|
|
16646
16959
|
/** Current subscriber snapshot, or `undefined` if not yet authenticated. */
|
|
16647
16960
|
get subscriber() {
|
|
@@ -16660,7 +16973,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16660
16973
|
* ```
|
|
16661
16974
|
*/
|
|
16662
16975
|
get directory$() {
|
|
16663
|
-
return this._directory$.asObservable();
|
|
16976
|
+
return this.deferEmission(this._directory$.asObservable());
|
|
16664
16977
|
}
|
|
16665
16978
|
/**
|
|
16666
16979
|
* Current directory snapshot, or `undefined` if the client is not yet connected.
|
|
@@ -16671,7 +16984,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16671
16984
|
}
|
|
16672
16985
|
/** Observable that emits when the subscriber registration state changes. */
|
|
16673
16986
|
get isRegistered$() {
|
|
16674
|
-
return this._isRegistered$.asObservable();
|
|
16987
|
+
return this.deferEmission(this._isRegistered$.asObservable());
|
|
16675
16988
|
}
|
|
16676
16989
|
/** Whether the subscriber is currently registered. */
|
|
16677
16990
|
get isRegistered() {
|
|
@@ -16683,17 +16996,22 @@ var SignalWire = class extends Destroyable {
|
|
|
16683
16996
|
}
|
|
16684
16997
|
/** Observable that emits when the connection state changes. */
|
|
16685
16998
|
get isConnected$() {
|
|
16686
|
-
return this._isConnected$.asObservable();
|
|
16999
|
+
return this.deferEmission(this._isConnected$.asObservable());
|
|
16687
17000
|
}
|
|
16688
17001
|
/** Observable that emits `true` when the client is both connected and authenticated. */
|
|
16689
17002
|
get ready$() {
|
|
16690
|
-
return this.
|
|
17003
|
+
return this.publicCachedObservable("ready$", () => this._isConnected$.pipe((0, import_cjs.switchMap)((connected) => connected ? this._clientSession.authenticated$ : (0, import_cjs.of)(false))));
|
|
16691
17004
|
}
|
|
16692
17005
|
/** Observable stream of errors from transport, authentication, and devices. */
|
|
16693
17006
|
get errors$() {
|
|
16694
|
-
return this._errors$.asObservable();
|
|
17007
|
+
return this.deferEmission(this._errors$.asObservable());
|
|
16695
17008
|
}
|
|
16696
|
-
/**
|
|
17009
|
+
/**
|
|
17010
|
+
* Disconnects the WebSocket and tears down the current session.
|
|
17011
|
+
*
|
|
17012
|
+
* The client can be reconnected by calling {@link connect} again,
|
|
17013
|
+
* which creates a fresh transport and session.
|
|
17014
|
+
*/
|
|
16697
17015
|
async disconnect() {
|
|
16698
17016
|
await this._clientSession.disconnect();
|
|
16699
17017
|
this._clientSession.destroy();
|
|
@@ -16702,7 +17020,14 @@ var SignalWire = class extends Destroyable {
|
|
|
16702
17020
|
async waitAuthentication() {
|
|
16703
17021
|
await (0, import_cjs.firstValueFrom)(this.ready$.pipe((0, import_cjs.filter)((ready$1) => ready$1 === true)));
|
|
16704
17022
|
}
|
|
16705
|
-
/**
|
|
17023
|
+
/**
|
|
17024
|
+
* Registers the subscriber as online to receive inbound calls and events.
|
|
17025
|
+
*
|
|
17026
|
+
* Waits for authentication to complete before sending the registration.
|
|
17027
|
+
* If the initial attempt fails, reauthentication is attempted automatically.
|
|
17028
|
+
*
|
|
17029
|
+
* @throws {InvalidCredentialsError} If registration and reauthentication both fail.
|
|
17030
|
+
*/
|
|
16706
17031
|
async register() {
|
|
16707
17032
|
try {
|
|
16708
17033
|
await this.waitAuthentication();
|
|
@@ -16730,7 +17055,11 @@ var SignalWire = class extends Destroyable {
|
|
|
16730
17055
|
throw error;
|
|
16731
17056
|
}
|
|
16732
17057
|
}
|
|
16733
|
-
/**
|
|
17058
|
+
/**
|
|
17059
|
+
* Unregisters the subscriber, going offline for inbound calls.
|
|
17060
|
+
*
|
|
17061
|
+
* The WebSocket connection remains open; use {@link disconnect} to fully close it.
|
|
17062
|
+
*/
|
|
16734
17063
|
async unregister() {
|
|
16735
17064
|
try {
|
|
16736
17065
|
await this._transport.execute(RPCExecute({
|
|
@@ -16746,9 +17075,27 @@ var SignalWire = class extends Destroyable {
|
|
|
16746
17075
|
}
|
|
16747
17076
|
/**
|
|
16748
17077
|
* Places an outbound call to the given destination.
|
|
16749
|
-
*
|
|
16750
|
-
*
|
|
17078
|
+
*
|
|
17079
|
+
* Waits for authentication before dialing. Media options are merged from
|
|
17080
|
+
* saved preferences, destination query parameters (e.g. `?channel=video`),
|
|
17081
|
+
* and the provided `options` (highest priority).
|
|
17082
|
+
*
|
|
17083
|
+
* Returns a {@link Call} in `'ringing'` state. Subscribe to {@link Call.status$}
|
|
17084
|
+
* to track progression through `'connected'` → `'disconnected'`.
|
|
17085
|
+
*
|
|
17086
|
+
* @param destination - Address URI string (e.g. `'/public/my-room'`) or {@link Address} instance.
|
|
17087
|
+
* @param options - Media and dial options (audio/video, device constraints). Overrides defaults.
|
|
16751
17088
|
* @returns The created {@link Call} instance.
|
|
17089
|
+
* @throws {Error} If authentication is not complete or call creation fails.
|
|
17090
|
+
*
|
|
17091
|
+
* @example
|
|
17092
|
+
* ```ts
|
|
17093
|
+
* const call = await client.dial('/public/conference', {
|
|
17094
|
+
* audio: true,
|
|
17095
|
+
* video: true,
|
|
17096
|
+
* });
|
|
17097
|
+
* call.status$.subscribe(status => console.log('Call:', status));
|
|
17098
|
+
* ```
|
|
16752
17099
|
*/
|
|
16753
17100
|
async dial(destination, options = {}) {
|
|
16754
17101
|
const computed_options = {
|
|
@@ -16766,7 +17113,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16766
17113
|
}
|
|
16767
17114
|
/** Observable list of available audio input (microphone) devices. */
|
|
16768
17115
|
get audioInputDevices$() {
|
|
16769
|
-
return this._deviceController.audioInputDevices
|
|
17116
|
+
return this.deferEmission(this._deviceController.audioInputDevices$);
|
|
16770
17117
|
}
|
|
16771
17118
|
/** Current snapshot of available audio input devices. */
|
|
16772
17119
|
get audioInputDevices() {
|
|
@@ -16774,7 +17121,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16774
17121
|
}
|
|
16775
17122
|
/** Observable list of available audio output (speaker) devices. */
|
|
16776
17123
|
get audioOutputDevices$() {
|
|
16777
|
-
return this._deviceController.audioOutputDevices
|
|
17124
|
+
return this.deferEmission(this._deviceController.audioOutputDevices$);
|
|
16778
17125
|
}
|
|
16779
17126
|
/** Current snapshot of available audio output devices. */
|
|
16780
17127
|
get audioOutputDevices() {
|
|
@@ -16782,7 +17129,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16782
17129
|
}
|
|
16783
17130
|
/** Observable list of available video input (camera) devices. */
|
|
16784
17131
|
get videoInputDevices$() {
|
|
16785
|
-
return this._deviceController.videoInputDevices
|
|
17132
|
+
return this.deferEmission(this._deviceController.videoInputDevices$);
|
|
16786
17133
|
}
|
|
16787
17134
|
/** Current snapshot of available video input devices. */
|
|
16788
17135
|
get videoInputDevices() {
|
|
@@ -16790,15 +17137,15 @@ var SignalWire = class extends Destroyable {
|
|
|
16790
17137
|
}
|
|
16791
17138
|
/** Observable of the currently selected audio input device. */
|
|
16792
17139
|
get selectedAudioInputDevice$() {
|
|
16793
|
-
return this._deviceController.selectedAudioInputDevice
|
|
17140
|
+
return this.deferEmission(this._deviceController.selectedAudioInputDevice$);
|
|
16794
17141
|
}
|
|
16795
17142
|
/** Observable of the currently selected audio output device. */
|
|
16796
17143
|
get selectedAudioOutputDevice$() {
|
|
16797
|
-
return this._deviceController.selectedAudioOutputDevice
|
|
17144
|
+
return this.deferEmission(this._deviceController.selectedAudioOutputDevice$);
|
|
16798
17145
|
}
|
|
16799
17146
|
/** Observable of the currently selected video input device. */
|
|
16800
17147
|
get selectedVideoInputDevice$() {
|
|
16801
|
-
return this._deviceController.selectedVideoInputDevice
|
|
17148
|
+
return this.deferEmission(this._deviceController.selectedVideoInputDevice$);
|
|
16802
17149
|
}
|
|
16803
17150
|
/** Currently selected audio input device, or `null` if none. */
|
|
16804
17151
|
get selectedAudioInputDevice() {
|
|
@@ -16844,12 +17191,23 @@ var SignalWire = class extends Destroyable {
|
|
|
16844
17191
|
disableDeviceMonitoring() {
|
|
16845
17192
|
this._deviceController.disableDeviceMonitoring();
|
|
16846
17193
|
}
|
|
17194
|
+
/**
|
|
17195
|
+
* Returns the capabilities of a media device.
|
|
17196
|
+
* @param deviceInfo - The device to query.
|
|
17197
|
+
* @returns The device capabilities, or `null` if unavailable.
|
|
17198
|
+
*/
|
|
16847
17199
|
async getDeviceCapabilities(deviceInfo) {
|
|
16848
17200
|
return this._deviceController.getDeviceCapabilities(deviceInfo);
|
|
16849
17201
|
}
|
|
17202
|
+
/**
|
|
17203
|
+
* Checks whether a device is still available and usable.
|
|
17204
|
+
* @param deviceInfo - The device to validate, or `null`.
|
|
17205
|
+
* @returns `true` if the device is valid and available. Returns `false` for `null`, audio output devices, or unavailable devices.
|
|
17206
|
+
*/
|
|
16850
17207
|
async isValidDevice(deviceInfo) {
|
|
16851
17208
|
return this._deviceController.isValidDevice(deviceInfo);
|
|
16852
17209
|
}
|
|
17210
|
+
/** Destroys the client, clearing timers and releasing all resources. */
|
|
16853
17211
|
destroy() {
|
|
16854
17212
|
if (this._refreshTimerId) {
|
|
16855
17213
|
clearTimeout(this._refreshTimerId);
|
|
@@ -16862,6 +17220,7 @@ var SignalWire = class extends Destroyable {
|
|
|
16862
17220
|
//#endregion
|
|
16863
17221
|
//#region src/dependencies/EmbedTokenCredentialProvider.ts
|
|
16864
17222
|
const logger = getLogger();
|
|
17223
|
+
/** Credential provider that exchanges an embed token for a SAT via the host's token endpoint. */
|
|
16865
17224
|
var EmbedTokenCredentialProvider = class {
|
|
16866
17225
|
constructor(host, embedToken) {
|
|
16867
17226
|
this.host = host;
|