@whereby.com/media 9.3.0 → 9.4.0
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 +39 -15
- package/dist/index.d.cts +7 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +39 -15
- package/dist/legacy-esm.js +39 -15
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -221,9 +221,22 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
221
221
|
return connection;
|
|
222
222
|
}
|
|
223
223
|
const RTCSTATS_URL = "wss://rtcstats.srv.whereby.com";
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
const noopServer = {
|
|
225
|
+
connected: false,
|
|
226
|
+
attemptedConnectedAtLeastOnce: false,
|
|
227
|
+
trace: noop,
|
|
228
|
+
close: noop,
|
|
229
|
+
connect: noop,
|
|
230
|
+
};
|
|
231
|
+
let server;
|
|
232
|
+
if (typeof window !== "undefined") {
|
|
233
|
+
server = rtcStatsConnection(RTCSTATS_URL);
|
|
234
|
+
const stats = rtcstats(server.trace, 10000, [""]);
|
|
235
|
+
resetDelta = (stats === null || stats === void 0 ? void 0 : stats.resetDelta) || noop;
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
server = noopServer;
|
|
239
|
+
}
|
|
227
240
|
const rtcStats = {
|
|
228
241
|
sendEvent: (type, value) => {
|
|
229
242
|
server.trace("customEvent", null, {
|
|
@@ -240,7 +253,7 @@ const rtcStats = {
|
|
|
240
253
|
server,
|
|
241
254
|
};
|
|
242
255
|
|
|
243
|
-
const debugOn = new URLSearchParams(window.location.search).has("debug");
|
|
256
|
+
const debugOn = (typeof window !== "undefined" && new URLSearchParams(window.location.search).has("debug"));
|
|
244
257
|
class Logger {
|
|
245
258
|
constructor() {
|
|
246
259
|
this._isEnabled = false;
|
|
@@ -1444,6 +1457,8 @@ function captureVideoSsrcMetrics(ssrcMetrics, currentSsrcStats, prevSsrcStats, t
|
|
|
1444
1457
|
ssrcMetrics.fps = (frameCountDiff * 1000) / timeDiff;
|
|
1445
1458
|
const freezeCountDiff = (currentSsrcStats.freezeCount || 0) - ((prevSsrcStats === null || prevSsrcStats === void 0 ? void 0 : prevSsrcStats.freezeCount) || 0);
|
|
1446
1459
|
ssrcMetrics.freezeRate = (freezeCountDiff * 1000) / timeDiff;
|
|
1460
|
+
const freezeDurationDiff = (currentSsrcStats.totalFreezesDuration || 0) - ((prevSsrcStats === null || prevSsrcStats === void 0 ? void 0 : prevSsrcStats.totalFreezesDuration) || 0);
|
|
1461
|
+
ssrcMetrics.freezeFraction = (freezeDurationDiff * 1000) / timeDiff;
|
|
1447
1462
|
}
|
|
1448
1463
|
else {
|
|
1449
1464
|
const kfCountDiff = currentSsrcStats.keyFramesEncoded - ((prevSsrcStats === null || prevSsrcStats === void 0 ? void 0 : prevSsrcStats.keyFramesEncoded) || 0);
|
|
@@ -1473,7 +1488,7 @@ const peerConnectionData = new WeakMap();
|
|
|
1473
1488
|
const removePeerConnection = (pc) => {
|
|
1474
1489
|
peerConnections = peerConnections.filter((old) => old !== pc);
|
|
1475
1490
|
};
|
|
1476
|
-
if (window.RTCPeerConnection) {
|
|
1491
|
+
if (typeof window !== "undefined" && window.RTCPeerConnection) {
|
|
1477
1492
|
const OriginalRTCPeerConnection = window.RTCPeerConnection;
|
|
1478
1493
|
function PatchedRTCPeerConnection(rtcConfig) {
|
|
1479
1494
|
const pc = new OriginalRTCPeerConnection(rtcConfig);
|
|
@@ -2431,7 +2446,7 @@ function fromLocation({ host = "whereby.com", protocol = "https:" } = {}) {
|
|
|
2431
2446
|
subdomain,
|
|
2432
2447
|
};
|
|
2433
2448
|
}
|
|
2434
|
-
fromLocation(window
|
|
2449
|
+
fromLocation(typeof window !== "undefined" ? window.location : undefined);
|
|
2435
2450
|
|
|
2436
2451
|
var _a$2, _b$1;
|
|
2437
2452
|
const adapter$2 = (_a$2 = adapterRaw.default) !== null && _a$2 !== void 0 ? _a$2 : adapterRaw;
|
|
@@ -6039,6 +6054,7 @@ const createQualityDetector = (type) => {
|
|
|
6039
6054
|
const maxSideReceived = Math.max(ssrc0.width || 0, ssrc0.height || 0);
|
|
6040
6055
|
const fpsReceived = ssrc0.fps || 0;
|
|
6041
6056
|
const hadFreeze = !!ssrc0.freezeRate;
|
|
6057
|
+
const freezeFraction = ssrc0.freezeFraction || 0;
|
|
6042
6058
|
const bitrate = ssrc0.bitrate || 0;
|
|
6043
6059
|
if (maxSideRendered < 100) {
|
|
6044
6060
|
if (type === "warning" && maxSideReceived < 160)
|
|
@@ -6063,8 +6079,12 @@ const createQualityDetector = (type) => {
|
|
|
6063
6079
|
return true;
|
|
6064
6080
|
if (type === "critical" && fpsReceived < 9)
|
|
6065
6081
|
return true;
|
|
6066
|
-
if (hadFreeze)
|
|
6067
|
-
|
|
6082
|
+
if (hadFreeze) {
|
|
6083
|
+
if (type === "warning" && freezeFraction > 0.3)
|
|
6084
|
+
return true;
|
|
6085
|
+
if (type === "critical" && freezeFraction > 0.6)
|
|
6086
|
+
return true;
|
|
6087
|
+
}
|
|
6068
6088
|
if (type === "warning" && bitrate < 50000)
|
|
6069
6089
|
return true;
|
|
6070
6090
|
if (type === "critical" && bitrate < 20000)
|
|
@@ -6083,8 +6103,12 @@ const createQualityDetector = (type) => {
|
|
|
6083
6103
|
return true;
|
|
6084
6104
|
if (type === "critical" && bitrate < 50000)
|
|
6085
6105
|
return true;
|
|
6086
|
-
if (hadFreeze)
|
|
6087
|
-
|
|
6106
|
+
if (hadFreeze) {
|
|
6107
|
+
if (type === "warning" && freezeFraction > 0.2)
|
|
6108
|
+
return true;
|
|
6109
|
+
if (type === "critical" && freezeFraction > 0.4)
|
|
6110
|
+
return true;
|
|
6111
|
+
}
|
|
6088
6112
|
}
|
|
6089
6113
|
}
|
|
6090
6114
|
}
|
|
@@ -6095,9 +6119,9 @@ const createQualityDetector = (type) => {
|
|
|
6095
6119
|
const deceleration = ssrc0.audioDeceleration || 0;
|
|
6096
6120
|
const audioDistortion = concealment + acceleration + deceleration;
|
|
6097
6121
|
if (audioLevel >= 0.01) {
|
|
6098
|
-
if (type === "warning" && audioDistortion > 0.
|
|
6122
|
+
if (type === "warning" && audioDistortion > 0.15)
|
|
6099
6123
|
return true;
|
|
6100
|
-
if (type === "critical" && audioDistortion > 0.
|
|
6124
|
+
if (type === "critical" && audioDistortion > 0.3)
|
|
6101
6125
|
return true;
|
|
6102
6126
|
}
|
|
6103
6127
|
}
|
|
@@ -7168,7 +7192,7 @@ class BandwidthTester extends EventEmitter {
|
|
|
7168
7192
|
}
|
|
7169
7193
|
|
|
7170
7194
|
const logger = new Logger();
|
|
7171
|
-
const isMobile = /mobi/i.test(navigator.userAgent);
|
|
7195
|
+
const isMobile = typeof navigator !== "undefined" && /mobi/i.test(navigator.userAgent);
|
|
7172
7196
|
class NoDevicesError extends Error {
|
|
7173
7197
|
constructor(...args) {
|
|
7174
7198
|
super(...args);
|
|
@@ -7426,8 +7450,8 @@ function hasGetDisplayMedia() {
|
|
|
7426
7450
|
}
|
|
7427
7451
|
const defaultDisplayMediaConstraints = {
|
|
7428
7452
|
video: {
|
|
7429
|
-
width: { max: window.screen.width },
|
|
7430
|
-
height: { max: window.screen.height },
|
|
7453
|
+
width: { max: typeof window !== "undefined" ? window.screen.width : 0 },
|
|
7454
|
+
height: { max: typeof window !== "undefined" ? window.screen.height : 0 },
|
|
7431
7455
|
},
|
|
7432
7456
|
};
|
|
7433
7457
|
function getDisplayMedia(constraints = defaultDisplayMediaConstraints, contentHint = "detail") {
|
package/dist/index.d.cts
CHANGED
|
@@ -100,6 +100,7 @@ interface SsrcStats {
|
|
|
100
100
|
sourceWidth?: number;
|
|
101
101
|
sourceFps?: number;
|
|
102
102
|
freezeRate?: number;
|
|
103
|
+
freezeFraction?: number;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
interface IssueDetector {
|
|
@@ -1759,6 +1760,12 @@ declare const rtcStats: {
|
|
|
1759
1760
|
trace: (...args: any) => void;
|
|
1760
1761
|
close: () => void;
|
|
1761
1762
|
connect: () => void;
|
|
1763
|
+
} | {
|
|
1764
|
+
connected: boolean;
|
|
1765
|
+
attemptedConnectedAtLeastOnce: boolean;
|
|
1766
|
+
trace: () => void;
|
|
1767
|
+
close: () => void;
|
|
1768
|
+
connect: () => void;
|
|
1762
1769
|
};
|
|
1763
1770
|
};
|
|
1764
1771
|
|
package/dist/index.d.mts
CHANGED
|
@@ -100,6 +100,7 @@ interface SsrcStats {
|
|
|
100
100
|
sourceWidth?: number;
|
|
101
101
|
sourceFps?: number;
|
|
102
102
|
freezeRate?: number;
|
|
103
|
+
freezeFraction?: number;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
interface IssueDetector {
|
|
@@ -1759,6 +1760,12 @@ declare const rtcStats: {
|
|
|
1759
1760
|
trace: (...args: any) => void;
|
|
1760
1761
|
close: () => void;
|
|
1761
1762
|
connect: () => void;
|
|
1763
|
+
} | {
|
|
1764
|
+
connected: boolean;
|
|
1765
|
+
attemptedConnectedAtLeastOnce: boolean;
|
|
1766
|
+
trace: () => void;
|
|
1767
|
+
close: () => void;
|
|
1768
|
+
connect: () => void;
|
|
1762
1769
|
};
|
|
1763
1770
|
};
|
|
1764
1771
|
|
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ interface SsrcStats {
|
|
|
100
100
|
sourceWidth?: number;
|
|
101
101
|
sourceFps?: number;
|
|
102
102
|
freezeRate?: number;
|
|
103
|
+
freezeFraction?: number;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
interface IssueDetector {
|
|
@@ -1759,6 +1760,12 @@ declare const rtcStats: {
|
|
|
1759
1760
|
trace: (...args: any) => void;
|
|
1760
1761
|
close: () => void;
|
|
1761
1762
|
connect: () => void;
|
|
1763
|
+
} | {
|
|
1764
|
+
connected: boolean;
|
|
1765
|
+
attemptedConnectedAtLeastOnce: boolean;
|
|
1766
|
+
trace: () => void;
|
|
1767
|
+
close: () => void;
|
|
1768
|
+
connect: () => void;
|
|
1762
1769
|
};
|
|
1763
1770
|
};
|
|
1764
1771
|
|
package/dist/index.mjs
CHANGED
|
@@ -201,9 +201,22 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
201
201
|
return connection;
|
|
202
202
|
}
|
|
203
203
|
const RTCSTATS_URL = "wss://rtcstats.srv.whereby.com";
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
const noopServer = {
|
|
205
|
+
connected: false,
|
|
206
|
+
attemptedConnectedAtLeastOnce: false,
|
|
207
|
+
trace: noop,
|
|
208
|
+
close: noop,
|
|
209
|
+
connect: noop,
|
|
210
|
+
};
|
|
211
|
+
let server;
|
|
212
|
+
if (typeof window !== "undefined") {
|
|
213
|
+
server = rtcStatsConnection(RTCSTATS_URL);
|
|
214
|
+
const stats = rtcstats(server.trace, 10000, [""]);
|
|
215
|
+
resetDelta = (stats === null || stats === void 0 ? void 0 : stats.resetDelta) || noop;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
server = noopServer;
|
|
219
|
+
}
|
|
207
220
|
const rtcStats = {
|
|
208
221
|
sendEvent: (type, value) => {
|
|
209
222
|
server.trace("customEvent", null, {
|
|
@@ -220,7 +233,7 @@ const rtcStats = {
|
|
|
220
233
|
server,
|
|
221
234
|
};
|
|
222
235
|
|
|
223
|
-
const debugOn = new URLSearchParams(window.location.search).has("debug");
|
|
236
|
+
const debugOn = (typeof window !== "undefined" && new URLSearchParams(window.location.search).has("debug"));
|
|
224
237
|
class Logger {
|
|
225
238
|
constructor() {
|
|
226
239
|
this._isEnabled = false;
|
|
@@ -1424,6 +1437,8 @@ function captureVideoSsrcMetrics(ssrcMetrics, currentSsrcStats, prevSsrcStats, t
|
|
|
1424
1437
|
ssrcMetrics.fps = (frameCountDiff * 1000) / timeDiff;
|
|
1425
1438
|
const freezeCountDiff = (currentSsrcStats.freezeCount || 0) - ((prevSsrcStats === null || prevSsrcStats === void 0 ? void 0 : prevSsrcStats.freezeCount) || 0);
|
|
1426
1439
|
ssrcMetrics.freezeRate = (freezeCountDiff * 1000) / timeDiff;
|
|
1440
|
+
const freezeDurationDiff = (currentSsrcStats.totalFreezesDuration || 0) - ((prevSsrcStats === null || prevSsrcStats === void 0 ? void 0 : prevSsrcStats.totalFreezesDuration) || 0);
|
|
1441
|
+
ssrcMetrics.freezeFraction = (freezeDurationDiff * 1000) / timeDiff;
|
|
1427
1442
|
}
|
|
1428
1443
|
else {
|
|
1429
1444
|
const kfCountDiff = currentSsrcStats.keyFramesEncoded - ((prevSsrcStats === null || prevSsrcStats === void 0 ? void 0 : prevSsrcStats.keyFramesEncoded) || 0);
|
|
@@ -1453,7 +1468,7 @@ const peerConnectionData = new WeakMap();
|
|
|
1453
1468
|
const removePeerConnection = (pc) => {
|
|
1454
1469
|
peerConnections = peerConnections.filter((old) => old !== pc);
|
|
1455
1470
|
};
|
|
1456
|
-
if (window.RTCPeerConnection) {
|
|
1471
|
+
if (typeof window !== "undefined" && window.RTCPeerConnection) {
|
|
1457
1472
|
const OriginalRTCPeerConnection = window.RTCPeerConnection;
|
|
1458
1473
|
function PatchedRTCPeerConnection(rtcConfig) {
|
|
1459
1474
|
const pc = new OriginalRTCPeerConnection(rtcConfig);
|
|
@@ -2411,7 +2426,7 @@ function fromLocation({ host = "whereby.com", protocol = "https:" } = {}) {
|
|
|
2411
2426
|
subdomain,
|
|
2412
2427
|
};
|
|
2413
2428
|
}
|
|
2414
|
-
fromLocation(window
|
|
2429
|
+
fromLocation(typeof window !== "undefined" ? window.location : undefined);
|
|
2415
2430
|
|
|
2416
2431
|
var _a$2, _b$1;
|
|
2417
2432
|
const adapter$2 = (_a$2 = adapterRaw.default) !== null && _a$2 !== void 0 ? _a$2 : adapterRaw;
|
|
@@ -6019,6 +6034,7 @@ const createQualityDetector = (type) => {
|
|
|
6019
6034
|
const maxSideReceived = Math.max(ssrc0.width || 0, ssrc0.height || 0);
|
|
6020
6035
|
const fpsReceived = ssrc0.fps || 0;
|
|
6021
6036
|
const hadFreeze = !!ssrc0.freezeRate;
|
|
6037
|
+
const freezeFraction = ssrc0.freezeFraction || 0;
|
|
6022
6038
|
const bitrate = ssrc0.bitrate || 0;
|
|
6023
6039
|
if (maxSideRendered < 100) {
|
|
6024
6040
|
if (type === "warning" && maxSideReceived < 160)
|
|
@@ -6043,8 +6059,12 @@ const createQualityDetector = (type) => {
|
|
|
6043
6059
|
return true;
|
|
6044
6060
|
if (type === "critical" && fpsReceived < 9)
|
|
6045
6061
|
return true;
|
|
6046
|
-
if (hadFreeze)
|
|
6047
|
-
|
|
6062
|
+
if (hadFreeze) {
|
|
6063
|
+
if (type === "warning" && freezeFraction > 0.3)
|
|
6064
|
+
return true;
|
|
6065
|
+
if (type === "critical" && freezeFraction > 0.6)
|
|
6066
|
+
return true;
|
|
6067
|
+
}
|
|
6048
6068
|
if (type === "warning" && bitrate < 50000)
|
|
6049
6069
|
return true;
|
|
6050
6070
|
if (type === "critical" && bitrate < 20000)
|
|
@@ -6063,8 +6083,12 @@ const createQualityDetector = (type) => {
|
|
|
6063
6083
|
return true;
|
|
6064
6084
|
if (type === "critical" && bitrate < 50000)
|
|
6065
6085
|
return true;
|
|
6066
|
-
if (hadFreeze)
|
|
6067
|
-
|
|
6086
|
+
if (hadFreeze) {
|
|
6087
|
+
if (type === "warning" && freezeFraction > 0.2)
|
|
6088
|
+
return true;
|
|
6089
|
+
if (type === "critical" && freezeFraction > 0.4)
|
|
6090
|
+
return true;
|
|
6091
|
+
}
|
|
6068
6092
|
}
|
|
6069
6093
|
}
|
|
6070
6094
|
}
|
|
@@ -6075,9 +6099,9 @@ const createQualityDetector = (type) => {
|
|
|
6075
6099
|
const deceleration = ssrc0.audioDeceleration || 0;
|
|
6076
6100
|
const audioDistortion = concealment + acceleration + deceleration;
|
|
6077
6101
|
if (audioLevel >= 0.01) {
|
|
6078
|
-
if (type === "warning" && audioDistortion > 0.
|
|
6102
|
+
if (type === "warning" && audioDistortion > 0.15)
|
|
6079
6103
|
return true;
|
|
6080
|
-
if (type === "critical" && audioDistortion > 0.
|
|
6104
|
+
if (type === "critical" && audioDistortion > 0.3)
|
|
6081
6105
|
return true;
|
|
6082
6106
|
}
|
|
6083
6107
|
}
|
|
@@ -7148,7 +7172,7 @@ class BandwidthTester extends EventEmitter {
|
|
|
7148
7172
|
}
|
|
7149
7173
|
|
|
7150
7174
|
const logger = new Logger();
|
|
7151
|
-
const isMobile = /mobi/i.test(navigator.userAgent);
|
|
7175
|
+
const isMobile = typeof navigator !== "undefined" && /mobi/i.test(navigator.userAgent);
|
|
7152
7176
|
class NoDevicesError extends Error {
|
|
7153
7177
|
constructor(...args) {
|
|
7154
7178
|
super(...args);
|
|
@@ -7406,8 +7430,8 @@ function hasGetDisplayMedia() {
|
|
|
7406
7430
|
}
|
|
7407
7431
|
const defaultDisplayMediaConstraints = {
|
|
7408
7432
|
video: {
|
|
7409
|
-
width: { max: window.screen.width },
|
|
7410
|
-
height: { max: window.screen.height },
|
|
7433
|
+
width: { max: typeof window !== "undefined" ? window.screen.width : 0 },
|
|
7434
|
+
height: { max: typeof window !== "undefined" ? window.screen.height : 0 },
|
|
7411
7435
|
},
|
|
7412
7436
|
};
|
|
7413
7437
|
function getDisplayMedia(constraints = defaultDisplayMediaConstraints, contentHint = "detail") {
|
package/dist/legacy-esm.js
CHANGED
|
@@ -201,9 +201,22 @@ function rtcStatsConnection(wsURL, logger = console) {
|
|
|
201
201
|
return connection;
|
|
202
202
|
}
|
|
203
203
|
const RTCSTATS_URL = "wss://rtcstats.srv.whereby.com";
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
const noopServer = {
|
|
205
|
+
connected: false,
|
|
206
|
+
attemptedConnectedAtLeastOnce: false,
|
|
207
|
+
trace: noop,
|
|
208
|
+
close: noop,
|
|
209
|
+
connect: noop,
|
|
210
|
+
};
|
|
211
|
+
let server;
|
|
212
|
+
if (typeof window !== "undefined") {
|
|
213
|
+
server = rtcStatsConnection(RTCSTATS_URL);
|
|
214
|
+
const stats = rtcstats(server.trace, 10000, [""]);
|
|
215
|
+
resetDelta = (stats === null || stats === void 0 ? void 0 : stats.resetDelta) || noop;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
server = noopServer;
|
|
219
|
+
}
|
|
207
220
|
const rtcStats = {
|
|
208
221
|
sendEvent: (type, value) => {
|
|
209
222
|
server.trace("customEvent", null, {
|
|
@@ -220,7 +233,7 @@ const rtcStats = {
|
|
|
220
233
|
server,
|
|
221
234
|
};
|
|
222
235
|
|
|
223
|
-
const debugOn = new URLSearchParams(window.location.search).has("debug");
|
|
236
|
+
const debugOn = (typeof window !== "undefined" && new URLSearchParams(window.location.search).has("debug"));
|
|
224
237
|
class Logger {
|
|
225
238
|
constructor() {
|
|
226
239
|
this._isEnabled = false;
|
|
@@ -1424,6 +1437,8 @@ function captureVideoSsrcMetrics(ssrcMetrics, currentSsrcStats, prevSsrcStats, t
|
|
|
1424
1437
|
ssrcMetrics.fps = (frameCountDiff * 1000) / timeDiff;
|
|
1425
1438
|
const freezeCountDiff = (currentSsrcStats.freezeCount || 0) - ((prevSsrcStats === null || prevSsrcStats === void 0 ? void 0 : prevSsrcStats.freezeCount) || 0);
|
|
1426
1439
|
ssrcMetrics.freezeRate = (freezeCountDiff * 1000) / timeDiff;
|
|
1440
|
+
const freezeDurationDiff = (currentSsrcStats.totalFreezesDuration || 0) - ((prevSsrcStats === null || prevSsrcStats === void 0 ? void 0 : prevSsrcStats.totalFreezesDuration) || 0);
|
|
1441
|
+
ssrcMetrics.freezeFraction = (freezeDurationDiff * 1000) / timeDiff;
|
|
1427
1442
|
}
|
|
1428
1443
|
else {
|
|
1429
1444
|
const kfCountDiff = currentSsrcStats.keyFramesEncoded - ((prevSsrcStats === null || prevSsrcStats === void 0 ? void 0 : prevSsrcStats.keyFramesEncoded) || 0);
|
|
@@ -1453,7 +1468,7 @@ const peerConnectionData = new WeakMap();
|
|
|
1453
1468
|
const removePeerConnection = (pc) => {
|
|
1454
1469
|
peerConnections = peerConnections.filter((old) => old !== pc);
|
|
1455
1470
|
};
|
|
1456
|
-
if (window.RTCPeerConnection) {
|
|
1471
|
+
if (typeof window !== "undefined" && window.RTCPeerConnection) {
|
|
1457
1472
|
const OriginalRTCPeerConnection = window.RTCPeerConnection;
|
|
1458
1473
|
function PatchedRTCPeerConnection(rtcConfig) {
|
|
1459
1474
|
const pc = new OriginalRTCPeerConnection(rtcConfig);
|
|
@@ -2411,7 +2426,7 @@ function fromLocation({ host = "whereby.com", protocol = "https:" } = {}) {
|
|
|
2411
2426
|
subdomain,
|
|
2412
2427
|
};
|
|
2413
2428
|
}
|
|
2414
|
-
fromLocation(window
|
|
2429
|
+
fromLocation(typeof window !== "undefined" ? window.location : undefined);
|
|
2415
2430
|
|
|
2416
2431
|
var _a$2, _b$1;
|
|
2417
2432
|
const adapter$2 = (_a$2 = adapterRaw.default) !== null && _a$2 !== void 0 ? _a$2 : adapterRaw;
|
|
@@ -6019,6 +6034,7 @@ const createQualityDetector = (type) => {
|
|
|
6019
6034
|
const maxSideReceived = Math.max(ssrc0.width || 0, ssrc0.height || 0);
|
|
6020
6035
|
const fpsReceived = ssrc0.fps || 0;
|
|
6021
6036
|
const hadFreeze = !!ssrc0.freezeRate;
|
|
6037
|
+
const freezeFraction = ssrc0.freezeFraction || 0;
|
|
6022
6038
|
const bitrate = ssrc0.bitrate || 0;
|
|
6023
6039
|
if (maxSideRendered < 100) {
|
|
6024
6040
|
if (type === "warning" && maxSideReceived < 160)
|
|
@@ -6043,8 +6059,12 @@ const createQualityDetector = (type) => {
|
|
|
6043
6059
|
return true;
|
|
6044
6060
|
if (type === "critical" && fpsReceived < 9)
|
|
6045
6061
|
return true;
|
|
6046
|
-
if (hadFreeze)
|
|
6047
|
-
|
|
6062
|
+
if (hadFreeze) {
|
|
6063
|
+
if (type === "warning" && freezeFraction > 0.3)
|
|
6064
|
+
return true;
|
|
6065
|
+
if (type === "critical" && freezeFraction > 0.6)
|
|
6066
|
+
return true;
|
|
6067
|
+
}
|
|
6048
6068
|
if (type === "warning" && bitrate < 50000)
|
|
6049
6069
|
return true;
|
|
6050
6070
|
if (type === "critical" && bitrate < 20000)
|
|
@@ -6063,8 +6083,12 @@ const createQualityDetector = (type) => {
|
|
|
6063
6083
|
return true;
|
|
6064
6084
|
if (type === "critical" && bitrate < 50000)
|
|
6065
6085
|
return true;
|
|
6066
|
-
if (hadFreeze)
|
|
6067
|
-
|
|
6086
|
+
if (hadFreeze) {
|
|
6087
|
+
if (type === "warning" && freezeFraction > 0.2)
|
|
6088
|
+
return true;
|
|
6089
|
+
if (type === "critical" && freezeFraction > 0.4)
|
|
6090
|
+
return true;
|
|
6091
|
+
}
|
|
6068
6092
|
}
|
|
6069
6093
|
}
|
|
6070
6094
|
}
|
|
@@ -6075,9 +6099,9 @@ const createQualityDetector = (type) => {
|
|
|
6075
6099
|
const deceleration = ssrc0.audioDeceleration || 0;
|
|
6076
6100
|
const audioDistortion = concealment + acceleration + deceleration;
|
|
6077
6101
|
if (audioLevel >= 0.01) {
|
|
6078
|
-
if (type === "warning" && audioDistortion > 0.
|
|
6102
|
+
if (type === "warning" && audioDistortion > 0.15)
|
|
6079
6103
|
return true;
|
|
6080
|
-
if (type === "critical" && audioDistortion > 0.
|
|
6104
|
+
if (type === "critical" && audioDistortion > 0.3)
|
|
6081
6105
|
return true;
|
|
6082
6106
|
}
|
|
6083
6107
|
}
|
|
@@ -7148,7 +7172,7 @@ class BandwidthTester extends EventEmitter {
|
|
|
7148
7172
|
}
|
|
7149
7173
|
|
|
7150
7174
|
const logger = new Logger();
|
|
7151
|
-
const isMobile = /mobi/i.test(navigator.userAgent);
|
|
7175
|
+
const isMobile = typeof navigator !== "undefined" && /mobi/i.test(navigator.userAgent);
|
|
7152
7176
|
class NoDevicesError extends Error {
|
|
7153
7177
|
constructor(...args) {
|
|
7154
7178
|
super(...args);
|
|
@@ -7406,8 +7430,8 @@ function hasGetDisplayMedia() {
|
|
|
7406
7430
|
}
|
|
7407
7431
|
const defaultDisplayMediaConstraints = {
|
|
7408
7432
|
video: {
|
|
7409
|
-
width: { max: window.screen.width },
|
|
7410
|
-
height: { max: window.screen.height },
|
|
7433
|
+
width: { max: typeof window !== "undefined" ? window.screen.width : 0 },
|
|
7434
|
+
height: { max: typeof window !== "undefined" ? window.screen.height : 0 },
|
|
7411
7435
|
},
|
|
7412
7436
|
};
|
|
7413
7437
|
function getDisplayMedia(constraints = defaultDisplayMediaConstraints, contentHint = "detail") {
|