@signalwire/js 4.0.0-dev-20260410161919 → 4.0.0-dev-20260410164129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.mjs +28 -15
- package/dist/browser.mjs.map +1 -1
- package/dist/browser.umd.js +28 -15
- package/dist/browser.umd.js.map +1 -1
- package/dist/index.cjs +28 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +28 -15
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2397,11 +2397,12 @@ var PreflightRunner = class extends Destroyable {
|
|
|
2397
2397
|
let pc;
|
|
2398
2398
|
try {
|
|
2399
2399
|
pc = new RTCPeerConnection({ iceServers: this.iceServers });
|
|
2400
|
+
const peerConnection = pc;
|
|
2400
2401
|
const candidateTypes = /* @__PURE__ */ new Set();
|
|
2401
2402
|
const startTime = Date.now();
|
|
2402
2403
|
const gatheringComplete = new Promise((resolve) => {
|
|
2403
2404
|
const timer$1 = setTimeout(resolve, ICE_GATHERING_TIMEOUT_MS);
|
|
2404
|
-
|
|
2405
|
+
peerConnection.onicecandidate = (event) => {
|
|
2405
2406
|
if (event.candidate) {
|
|
2406
2407
|
const candidateStr = event.candidate.candidate;
|
|
2407
2408
|
if (candidateStr.includes("typ host")) candidateTypes.add("host");
|
|
@@ -3936,8 +3937,8 @@ var CallEventsManager = class extends Destroyable {
|
|
|
3936
3937
|
}
|
|
3937
3938
|
updateParticipantPositions(layoutChangedEvent) {
|
|
3938
3939
|
if (Object.keys(this._participants$.value).length > 0 && !layoutChangedEvent.layers.some((layer) => !!layer.member_id)) logger$18.warn("[CallEventsManager] No layers with member_id found in layout.changed event. Nothing to update.");
|
|
3939
|
-
layoutChangedEvent.layers.filter((layer) =>
|
|
3940
|
-
if (!
|
|
3940
|
+
layoutChangedEvent.layers.filter((layer) => !!layer.member_id).filter((layer) => {
|
|
3941
|
+
if (!(layer.member_id in this._participants$.value)) {
|
|
3941
3942
|
logger$18.warn(`[CallEventsManager] Skipping layout layer for unknown member_id: ${layer.member_id}`);
|
|
3942
3943
|
return false;
|
|
3943
3944
|
}
|
|
@@ -6396,6 +6397,12 @@ function computePacketLossPercent(lost, received) {
|
|
|
6396
6397
|
if (total === 0) return 0;
|
|
6397
6398
|
return lost / total * 100;
|
|
6398
6399
|
}
|
|
6400
|
+
function isInboundRtpStat(stat) {
|
|
6401
|
+
return typeof stat === "object" && stat !== null && "type" in stat && stat.type === "inbound-rtp";
|
|
6402
|
+
}
|
|
6403
|
+
function isCandidatePairStat(stat) {
|
|
6404
|
+
return typeof stat === "object" && stat !== null && "type" in stat && stat.type === "candidate-pair";
|
|
6405
|
+
}
|
|
6399
6406
|
var RTCStatsMonitor = class extends Destroyable {
|
|
6400
6407
|
constructor(peerConnection, config = {}) {
|
|
6401
6408
|
super();
|
|
@@ -6527,17 +6534,15 @@ var RTCStatsMonitor = class extends Destroyable {
|
|
|
6527
6534
|
let roundTripTime = 0;
|
|
6528
6535
|
let availableOutgoingBitrate;
|
|
6529
6536
|
report.forEach((stat) => {
|
|
6530
|
-
if (stat.
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
videoPacketsLost += stat.packetsLost ?? 0;
|
|
6538
|
-
}
|
|
6537
|
+
if (isInboundRtpStat(stat)) if (stat.kind === "audio") {
|
|
6538
|
+
audioPacketsReceived += stat.packetsReceived ?? this.lastAudioPacketsReceived;
|
|
6539
|
+
audioPacketsLost += stat.packetsLost ?? 0;
|
|
6540
|
+
audioJitter = Math.max(audioJitter, (stat.jitter ?? 0) * 1e3);
|
|
6541
|
+
} else {
|
|
6542
|
+
videoPacketsReceived += stat.packetsReceived ?? this.lastVideoPacketsReceived;
|
|
6543
|
+
videoPacketsLost += stat.packetsLost ?? 0;
|
|
6539
6544
|
}
|
|
6540
|
-
if (stat
|
|
6545
|
+
if (isCandidatePairStat(stat) && stat.state === "succeeded" && stat.nominated) {
|
|
6541
6546
|
roundTripTime = stat.currentRoundTripTime ? stat.currentRoundTripTime * 1e3 : this.lastRoundTripTime;
|
|
6542
6547
|
availableOutgoingBitrate = stat.availableOutgoingBitrate ?? this.lastAvailableOutgoingBitrate;
|
|
6543
6548
|
}
|
|
@@ -10329,6 +10334,8 @@ var SignalWire = class extends Destroyable {
|
|
|
10329
10334
|
* Triggers the browser's media permission dialog and captures the user's device selections.
|
|
10330
10335
|
*
|
|
10331
10336
|
* @param options - Which permissions to request.
|
|
10337
|
+
* @param options.audio - Whether to request audio permission.
|
|
10338
|
+
* @param options.video - Whether to request video permission.
|
|
10332
10339
|
* @returns The permission result with selected devices.
|
|
10333
10340
|
*/
|
|
10334
10341
|
async requestMediaPermissions(options = {
|
|
@@ -10360,8 +10367,14 @@ var SignalWire = class extends Destroyable {
|
|
|
10360
10367
|
logger$1.warn("[SignalWire] Media permission request failed:", error);
|
|
10361
10368
|
}
|
|
10362
10369
|
await this._deviceController.enumerateDevices();
|
|
10363
|
-
if (audioGranted && selectedAudioDevice)
|
|
10364
|
-
|
|
10370
|
+
if (audioGranted && selectedAudioDevice) {
|
|
10371
|
+
const audioDeviceId = selectedAudioDevice.deviceId;
|
|
10372
|
+
selectedAudioDevice = this.audioInputDevices.find((d) => d.deviceId === audioDeviceId) ?? selectedAudioDevice;
|
|
10373
|
+
}
|
|
10374
|
+
if (videoGranted && selectedVideoDevice) {
|
|
10375
|
+
const videoDeviceId = selectedVideoDevice.deviceId;
|
|
10376
|
+
selectedVideoDevice = this.videoInputDevices.find((d) => d.deviceId === videoDeviceId) ?? selectedVideoDevice;
|
|
10377
|
+
}
|
|
10365
10378
|
if (audioGranted && selectedAudioDevice && !this.selectedAudioInputDevice) this.selectAudioInputDevice(selectedAudioDevice);
|
|
10366
10379
|
if (videoGranted && selectedVideoDevice && !this.selectedVideoInputDevice) this.selectVideoInputDevice(selectedVideoDevice);
|
|
10367
10380
|
return {
|