@whereby.com/media 9.2.0 → 9.2.2
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/index.cjs +19 -8
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +19 -8
- package/dist/legacy-esm.js +19 -8
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2473,11 +2473,9 @@ function getMediaConstraints({ disableAEC, disableAGC, hd, lax, lowDataMode, pre
|
|
|
2473
2473
|
function getConstraints({ devices, videoId, audioId, options, type = "ideal" }) {
|
|
2474
2474
|
const audioDevices = devices.filter((d) => d.kind === "audioinput");
|
|
2475
2475
|
const videoDevices = devices.filter((d) => d.kind === "videoinput");
|
|
2476
|
-
const useDefaultAudio = !audioId || !audioDevices.some((d) => d.deviceId === audioId);
|
|
2477
|
-
const useDefaultVideo = !videoId || !videoDevices.some((d) => d.deviceId === videoId);
|
|
2478
2476
|
const constraints = getMediaConstraints(Object.assign({ preferredDeviceIds: {
|
|
2479
|
-
audioId:
|
|
2480
|
-
videoId:
|
|
2477
|
+
audioId: typeof audioId === "string" ? { [type]: audioId } : null,
|
|
2478
|
+
videoId: typeof videoId === "string" ? { [type]: videoId } : null,
|
|
2481
2479
|
} }, options));
|
|
2482
2480
|
if (audioId === false || !audioDevices.length) {
|
|
2483
2481
|
delete constraints.audio;
|
|
@@ -4347,7 +4345,7 @@ function createVegaConnectionManager(config) {
|
|
|
4347
4345
|
}, timeToWaitForEarlyServerClose);
|
|
4348
4346
|
});
|
|
4349
4347
|
vegaConnection.on("close", () => {
|
|
4350
|
-
var _a;
|
|
4348
|
+
var _a, _b;
|
|
4351
4349
|
wasClosed = true;
|
|
4352
4350
|
if (vegaConnection === nominatedConnection) {
|
|
4353
4351
|
nominatedConnection = undefined;
|
|
@@ -4355,6 +4353,9 @@ function createVegaConnectionManager(config) {
|
|
|
4355
4353
|
hasNotifiedDisconnect = true;
|
|
4356
4354
|
(_a = config.onDisconnected) === null || _a === void 0 ? void 0 : _a.call(config);
|
|
4357
4355
|
}
|
|
4356
|
+
else {
|
|
4357
|
+
(_b = config.onAttemptFailed) === null || _b === void 0 ? void 0 : _b.call(config, { host, dc });
|
|
4358
|
+
}
|
|
4358
4359
|
handleFailedOrAbortedConnection();
|
|
4359
4360
|
});
|
|
4360
4361
|
}, timeBeforeConnect));
|
|
@@ -4560,9 +4561,14 @@ class VegaRtcManager {
|
|
|
4560
4561
|
});
|
|
4561
4562
|
}
|
|
4562
4563
|
_connect() {
|
|
4563
|
-
var _a;
|
|
4564
|
-
if (this._isConnectingOrConnected)
|
|
4564
|
+
var _a, _b, _c, _d, _e;
|
|
4565
|
+
if (this._isConnectingOrConnected) {
|
|
4566
|
+
rtcStats.sendEvent("SfuConnectEarlyBail", {
|
|
4567
|
+
readyState: (_b = (_a = this._vegaConnection) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.readyState,
|
|
4568
|
+
bufferedAmount: (_d = (_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.socket) === null || _d === void 0 ? void 0 : _d.bufferedAmount,
|
|
4569
|
+
});
|
|
4565
4570
|
return;
|
|
4571
|
+
}
|
|
4566
4572
|
if (!this._serverSocket.isConnected()) {
|
|
4567
4573
|
const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
|
|
4568
4574
|
if (!reconnectThresholdInMs)
|
|
@@ -4576,7 +4582,7 @@ class VegaRtcManager {
|
|
|
4576
4582
|
const hostList = this._features.sfuServersOverride ||
|
|
4577
4583
|
this._sfuServers ||
|
|
4578
4584
|
this._features.sfuServerOverrideHost ||
|
|
4579
|
-
((
|
|
4585
|
+
((_e = this._sfuServer) === null || _e === void 0 ? void 0 : _e.url);
|
|
4580
4586
|
this._vegaConnectionManager = createVegaConnectionManager({
|
|
4581
4587
|
initialHostList: hostList,
|
|
4582
4588
|
getUrlForHost: (host) => {
|
|
@@ -4603,6 +4609,9 @@ class VegaRtcManager {
|
|
|
4603
4609
|
this._isConnectingOrConnected = false;
|
|
4604
4610
|
this._onClose();
|
|
4605
4611
|
},
|
|
4612
|
+
onAttemptFailed: ({ host, dc }) => {
|
|
4613
|
+
rtcStats.sendEvent("SfuConnectAttemptFailed", { host, dc });
|
|
4614
|
+
},
|
|
4606
4615
|
});
|
|
4607
4616
|
}
|
|
4608
4617
|
this._vegaConnectionManager.connect((metric) => this.analytics[metric]++);
|
|
@@ -4622,12 +4631,14 @@ class VegaRtcManager {
|
|
|
4622
4631
|
}
|
|
4623
4632
|
this._qualityMonitor.close();
|
|
4624
4633
|
this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_CLOSED);
|
|
4634
|
+
rtcStats.sendEvent("SfuConnectionClosed", {});
|
|
4625
4635
|
}
|
|
4626
4636
|
_join() {
|
|
4627
4637
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4628
4638
|
var _a, _b;
|
|
4629
4639
|
logger$2.info("_join()");
|
|
4630
4640
|
this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_OPEN);
|
|
4641
|
+
rtcStats.sendEvent("SfuConnectionOpened", {});
|
|
4631
4642
|
try {
|
|
4632
4643
|
if (!this._vegaConnection) {
|
|
4633
4644
|
logger$2.error("_join() No VegaConnection found");
|
package/dist/index.d.cts
CHANGED
|
@@ -1853,6 +1853,10 @@ declare function createVegaConnectionManager(config: {
|
|
|
1853
1853
|
onConnected?: (vegaConnection: VegaConnection, info: ConnectionInfo) => void;
|
|
1854
1854
|
onDisconnected?: () => void;
|
|
1855
1855
|
onFailed?: () => void;
|
|
1856
|
+
onAttemptFailed?: (info: {
|
|
1857
|
+
host: string;
|
|
1858
|
+
dc: string;
|
|
1859
|
+
}) => void;
|
|
1856
1860
|
}): {
|
|
1857
1861
|
connect: (incrementAnalyticMetric?: VegaIncrementAnalyticMetric) => void;
|
|
1858
1862
|
updateHostList: (updatedHostList: string | HostListEntryOptionalDC[]) => void;
|
package/dist/index.d.mts
CHANGED
|
@@ -1853,6 +1853,10 @@ declare function createVegaConnectionManager(config: {
|
|
|
1853
1853
|
onConnected?: (vegaConnection: VegaConnection, info: ConnectionInfo) => void;
|
|
1854
1854
|
onDisconnected?: () => void;
|
|
1855
1855
|
onFailed?: () => void;
|
|
1856
|
+
onAttemptFailed?: (info: {
|
|
1857
|
+
host: string;
|
|
1858
|
+
dc: string;
|
|
1859
|
+
}) => void;
|
|
1856
1860
|
}): {
|
|
1857
1861
|
connect: (incrementAnalyticMetric?: VegaIncrementAnalyticMetric) => void;
|
|
1858
1862
|
updateHostList: (updatedHostList: string | HostListEntryOptionalDC[]) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1853,6 +1853,10 @@ declare function createVegaConnectionManager(config: {
|
|
|
1853
1853
|
onConnected?: (vegaConnection: VegaConnection, info: ConnectionInfo) => void;
|
|
1854
1854
|
onDisconnected?: () => void;
|
|
1855
1855
|
onFailed?: () => void;
|
|
1856
|
+
onAttemptFailed?: (info: {
|
|
1857
|
+
host: string;
|
|
1858
|
+
dc: string;
|
|
1859
|
+
}) => void;
|
|
1856
1860
|
}): {
|
|
1857
1861
|
connect: (incrementAnalyticMetric?: VegaIncrementAnalyticMetric) => void;
|
|
1858
1862
|
updateHostList: (updatedHostList: string | HostListEntryOptionalDC[]) => void;
|
package/dist/index.mjs
CHANGED
|
@@ -2452,11 +2452,9 @@ function getMediaConstraints({ disableAEC, disableAGC, hd, lax, lowDataMode, pre
|
|
|
2452
2452
|
function getConstraints({ devices, videoId, audioId, options, type = "ideal" }) {
|
|
2453
2453
|
const audioDevices = devices.filter((d) => d.kind === "audioinput");
|
|
2454
2454
|
const videoDevices = devices.filter((d) => d.kind === "videoinput");
|
|
2455
|
-
const useDefaultAudio = !audioId || !audioDevices.some((d) => d.deviceId === audioId);
|
|
2456
|
-
const useDefaultVideo = !videoId || !videoDevices.some((d) => d.deviceId === videoId);
|
|
2457
2455
|
const constraints = getMediaConstraints(Object.assign({ preferredDeviceIds: {
|
|
2458
|
-
audioId:
|
|
2459
|
-
videoId:
|
|
2456
|
+
audioId: typeof audioId === "string" ? { [type]: audioId } : null,
|
|
2457
|
+
videoId: typeof videoId === "string" ? { [type]: videoId } : null,
|
|
2460
2458
|
} }, options));
|
|
2461
2459
|
if (audioId === false || !audioDevices.length) {
|
|
2462
2460
|
delete constraints.audio;
|
|
@@ -4326,7 +4324,7 @@ function createVegaConnectionManager(config) {
|
|
|
4326
4324
|
}, timeToWaitForEarlyServerClose);
|
|
4327
4325
|
});
|
|
4328
4326
|
vegaConnection.on("close", () => {
|
|
4329
|
-
var _a;
|
|
4327
|
+
var _a, _b;
|
|
4330
4328
|
wasClosed = true;
|
|
4331
4329
|
if (vegaConnection === nominatedConnection) {
|
|
4332
4330
|
nominatedConnection = undefined;
|
|
@@ -4334,6 +4332,9 @@ function createVegaConnectionManager(config) {
|
|
|
4334
4332
|
hasNotifiedDisconnect = true;
|
|
4335
4333
|
(_a = config.onDisconnected) === null || _a === void 0 ? void 0 : _a.call(config);
|
|
4336
4334
|
}
|
|
4335
|
+
else {
|
|
4336
|
+
(_b = config.onAttemptFailed) === null || _b === void 0 ? void 0 : _b.call(config, { host, dc });
|
|
4337
|
+
}
|
|
4337
4338
|
handleFailedOrAbortedConnection();
|
|
4338
4339
|
});
|
|
4339
4340
|
}, timeBeforeConnect));
|
|
@@ -4539,9 +4540,14 @@ class VegaRtcManager {
|
|
|
4539
4540
|
});
|
|
4540
4541
|
}
|
|
4541
4542
|
_connect() {
|
|
4542
|
-
var _a;
|
|
4543
|
-
if (this._isConnectingOrConnected)
|
|
4543
|
+
var _a, _b, _c, _d, _e;
|
|
4544
|
+
if (this._isConnectingOrConnected) {
|
|
4545
|
+
rtcStats.sendEvent("SfuConnectEarlyBail", {
|
|
4546
|
+
readyState: (_b = (_a = this._vegaConnection) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.readyState,
|
|
4547
|
+
bufferedAmount: (_d = (_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.socket) === null || _d === void 0 ? void 0 : _d.bufferedAmount,
|
|
4548
|
+
});
|
|
4544
4549
|
return;
|
|
4550
|
+
}
|
|
4545
4551
|
if (!this._serverSocket.isConnected()) {
|
|
4546
4552
|
const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
|
|
4547
4553
|
if (!reconnectThresholdInMs)
|
|
@@ -4555,7 +4561,7 @@ class VegaRtcManager {
|
|
|
4555
4561
|
const hostList = this._features.sfuServersOverride ||
|
|
4556
4562
|
this._sfuServers ||
|
|
4557
4563
|
this._features.sfuServerOverrideHost ||
|
|
4558
|
-
((
|
|
4564
|
+
((_e = this._sfuServer) === null || _e === void 0 ? void 0 : _e.url);
|
|
4559
4565
|
this._vegaConnectionManager = createVegaConnectionManager({
|
|
4560
4566
|
initialHostList: hostList,
|
|
4561
4567
|
getUrlForHost: (host) => {
|
|
@@ -4582,6 +4588,9 @@ class VegaRtcManager {
|
|
|
4582
4588
|
this._isConnectingOrConnected = false;
|
|
4583
4589
|
this._onClose();
|
|
4584
4590
|
},
|
|
4591
|
+
onAttemptFailed: ({ host, dc }) => {
|
|
4592
|
+
rtcStats.sendEvent("SfuConnectAttemptFailed", { host, dc });
|
|
4593
|
+
},
|
|
4585
4594
|
});
|
|
4586
4595
|
}
|
|
4587
4596
|
this._vegaConnectionManager.connect((metric) => this.analytics[metric]++);
|
|
@@ -4601,12 +4610,14 @@ class VegaRtcManager {
|
|
|
4601
4610
|
}
|
|
4602
4611
|
this._qualityMonitor.close();
|
|
4603
4612
|
this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_CLOSED);
|
|
4613
|
+
rtcStats.sendEvent("SfuConnectionClosed", {});
|
|
4604
4614
|
}
|
|
4605
4615
|
_join() {
|
|
4606
4616
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4607
4617
|
var _a, _b;
|
|
4608
4618
|
logger$2.info("_join()");
|
|
4609
4619
|
this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_OPEN);
|
|
4620
|
+
rtcStats.sendEvent("SfuConnectionOpened", {});
|
|
4610
4621
|
try {
|
|
4611
4622
|
if (!this._vegaConnection) {
|
|
4612
4623
|
logger$2.error("_join() No VegaConnection found");
|
package/dist/legacy-esm.js
CHANGED
|
@@ -2452,11 +2452,9 @@ function getMediaConstraints({ disableAEC, disableAGC, hd, lax, lowDataMode, pre
|
|
|
2452
2452
|
function getConstraints({ devices, videoId, audioId, options, type = "ideal" }) {
|
|
2453
2453
|
const audioDevices = devices.filter((d) => d.kind === "audioinput");
|
|
2454
2454
|
const videoDevices = devices.filter((d) => d.kind === "videoinput");
|
|
2455
|
-
const useDefaultAudio = !audioId || !audioDevices.some((d) => d.deviceId === audioId);
|
|
2456
|
-
const useDefaultVideo = !videoId || !videoDevices.some((d) => d.deviceId === videoId);
|
|
2457
2455
|
const constraints = getMediaConstraints(Object.assign({ preferredDeviceIds: {
|
|
2458
|
-
audioId:
|
|
2459
|
-
videoId:
|
|
2456
|
+
audioId: typeof audioId === "string" ? { [type]: audioId } : null,
|
|
2457
|
+
videoId: typeof videoId === "string" ? { [type]: videoId } : null,
|
|
2460
2458
|
} }, options));
|
|
2461
2459
|
if (audioId === false || !audioDevices.length) {
|
|
2462
2460
|
delete constraints.audio;
|
|
@@ -4326,7 +4324,7 @@ function createVegaConnectionManager(config) {
|
|
|
4326
4324
|
}, timeToWaitForEarlyServerClose);
|
|
4327
4325
|
});
|
|
4328
4326
|
vegaConnection.on("close", () => {
|
|
4329
|
-
var _a;
|
|
4327
|
+
var _a, _b;
|
|
4330
4328
|
wasClosed = true;
|
|
4331
4329
|
if (vegaConnection === nominatedConnection) {
|
|
4332
4330
|
nominatedConnection = undefined;
|
|
@@ -4334,6 +4332,9 @@ function createVegaConnectionManager(config) {
|
|
|
4334
4332
|
hasNotifiedDisconnect = true;
|
|
4335
4333
|
(_a = config.onDisconnected) === null || _a === void 0 ? void 0 : _a.call(config);
|
|
4336
4334
|
}
|
|
4335
|
+
else {
|
|
4336
|
+
(_b = config.onAttemptFailed) === null || _b === void 0 ? void 0 : _b.call(config, { host, dc });
|
|
4337
|
+
}
|
|
4337
4338
|
handleFailedOrAbortedConnection();
|
|
4338
4339
|
});
|
|
4339
4340
|
}, timeBeforeConnect));
|
|
@@ -4539,9 +4540,14 @@ class VegaRtcManager {
|
|
|
4539
4540
|
});
|
|
4540
4541
|
}
|
|
4541
4542
|
_connect() {
|
|
4542
|
-
var _a;
|
|
4543
|
-
if (this._isConnectingOrConnected)
|
|
4543
|
+
var _a, _b, _c, _d, _e;
|
|
4544
|
+
if (this._isConnectingOrConnected) {
|
|
4545
|
+
rtcStats.sendEvent("SfuConnectEarlyBail", {
|
|
4546
|
+
readyState: (_b = (_a = this._vegaConnection) === null || _a === void 0 ? void 0 : _a.socket) === null || _b === void 0 ? void 0 : _b.readyState,
|
|
4547
|
+
bufferedAmount: (_d = (_c = this._vegaConnection) === null || _c === void 0 ? void 0 : _c.socket) === null || _d === void 0 ? void 0 : _d.bufferedAmount,
|
|
4548
|
+
});
|
|
4544
4549
|
return;
|
|
4550
|
+
}
|
|
4545
4551
|
if (!this._serverSocket.isConnected()) {
|
|
4546
4552
|
const reconnectThresholdInMs = this._serverSocket.getReconnectThreshold();
|
|
4547
4553
|
if (!reconnectThresholdInMs)
|
|
@@ -4555,7 +4561,7 @@ class VegaRtcManager {
|
|
|
4555
4561
|
const hostList = this._features.sfuServersOverride ||
|
|
4556
4562
|
this._sfuServers ||
|
|
4557
4563
|
this._features.sfuServerOverrideHost ||
|
|
4558
|
-
((
|
|
4564
|
+
((_e = this._sfuServer) === null || _e === void 0 ? void 0 : _e.url);
|
|
4559
4565
|
this._vegaConnectionManager = createVegaConnectionManager({
|
|
4560
4566
|
initialHostList: hostList,
|
|
4561
4567
|
getUrlForHost: (host) => {
|
|
@@ -4582,6 +4588,9 @@ class VegaRtcManager {
|
|
|
4582
4588
|
this._isConnectingOrConnected = false;
|
|
4583
4589
|
this._onClose();
|
|
4584
4590
|
},
|
|
4591
|
+
onAttemptFailed: ({ host, dc }) => {
|
|
4592
|
+
rtcStats.sendEvent("SfuConnectAttemptFailed", { host, dc });
|
|
4593
|
+
},
|
|
4585
4594
|
});
|
|
4586
4595
|
}
|
|
4587
4596
|
this._vegaConnectionManager.connect((metric) => this.analytics[metric]++);
|
|
@@ -4601,12 +4610,14 @@ class VegaRtcManager {
|
|
|
4601
4610
|
}
|
|
4602
4611
|
this._qualityMonitor.close();
|
|
4603
4612
|
this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_CLOSED);
|
|
4613
|
+
rtcStats.sendEvent("SfuConnectionClosed", {});
|
|
4604
4614
|
}
|
|
4605
4615
|
_join() {
|
|
4606
4616
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4607
4617
|
var _a, _b;
|
|
4608
4618
|
logger$2.info("_join()");
|
|
4609
4619
|
this._emitToPWA(rtcManagerEvents.SFU_CONNECTION_OPEN);
|
|
4620
|
+
rtcStats.sendEvent("SfuConnectionOpened", {});
|
|
4610
4621
|
try {
|
|
4611
4622
|
if (!this._vegaConnection) {
|
|
4612
4623
|
logger$2.error("_join() No VegaConnection found");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whereby.com/media",
|
|
3
3
|
"description": "Media library for Whereby",
|
|
4
|
-
"version": "9.2.
|
|
4
|
+
"version": "9.2.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/whereby/sdk",
|
|
7
7
|
"repository": {
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"prettier": "^3.5.3",
|
|
62
62
|
"process": "^0.11.10",
|
|
63
63
|
"typescript": "^5.8.3",
|
|
64
|
+
"@whereby.com/eslint-config": "0.1.0",
|
|
64
65
|
"@whereby.com/jest-config": "0.1.0",
|
|
65
66
|
"@whereby.com/prettier-config": "0.1.0",
|
|
66
67
|
"@whereby.com/rollup-config": "0.1.1",
|
|
67
|
-
"@whereby.com/tsconfig": "0.1.0"
|
|
68
|
-
"@whereby.com/eslint-config": "0.1.0"
|
|
68
|
+
"@whereby.com/tsconfig": "0.1.0"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=24.0.0"
|