@arcware-cloud/pixelstreaming-websdk 1.2.16 → 1.2.18
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/README.md +9 -0
- package/index.cjs.js +147 -78
- package/index.esm.js +170 -99
- package/index.umd.js +147 -78
- package/package.json +2 -2
- package/types/index.d.ts +3 -0
- package/types/lib/ApplyUrlHack.d.ts +2 -0
- package/types/lib/ArcwareApplication.d.ts +48 -0
- package/types/lib/ArcwareConfig.d.ts +35 -0
- package/types/lib/ArcwareInit.d.ts +15 -0
- package/types/lib/ArcwarePixelStreaming.d.ts +98 -0
- package/types/lib/DiagnosticsCollector.d.ts +181 -0
- package/types/lib/MessageTypes.d.ts +4 -0
- package/types/lib/domain/ArcwareSettingsSchema.d.ts +209 -0
- package/types/lib/domain/ConnectionIdentifier.d.ts +27 -0
- package/types/lib/domain/EventHandler.d.ts +11 -0
- package/types/lib/domain/Session.d.ts +29 -0
- package/types/lib/domain/Stats.d.ts +36 -0
- package/types/lib/domain/debounce.d.ts +1 -0
- package/types/lib/index.d.ts +6 -0
- package/types/lib/styles/ArcwarePixelStreamingApplicationStyles.d.ts +478 -0
- package/types/lib/ui/ArcwareLogoLoader/index.d.ts +6 -0
- package/types/lib/ui/AudioButton/AudioIcon.d.ts +7 -0
- package/types/lib/ui/AudioButton/index.d.ts +15 -0
- package/types/lib/ui/LoveLetters/index.d.ts +6 -0
- package/types/lib/ui/MicButton/index.d.ts +14 -0
- package/types/lib/ui/MicIcon/index.d.ts +7 -0
- package/types/lib/ui/MicrophoneOverlay/index.d.ts +11 -0
- package/types/lib/ui/PlayIcon/index.d.ts +5 -0
- package/types/lib/ui/StopButton/index.d.ts +16 -0
- package/types/lib/ui/StopIcon/index.d.ts +5 -0
- package/types/shared/index.d.ts +1 -0
- package/types/shared/lib/Messages/ErrorMessage.d.ts +18 -0
- package/types/shared/lib/Messages/LoveLetter.d.ts +18 -0
- package/types/shared/lib/Messages/Ping.d.ts +15 -0
- package/types/shared/lib/Messages/Queue.d.ts +58 -0
- package/types/shared/lib/Messages/SessionId.d.ts +12 -0
- package/types/shared/lib/Messages/Stats.d.ts +182 -0
- package/types/shared/lib/Messages/StreamInfo.d.ts +338 -0
- package/types/shared/lib/Messages/Version.d.ts +12 -0
- package/types/shared/lib/Messages/WebSdkSettings.d.ts +96 -0
- package/types/shared/lib/Messages/index.d.ts +192 -0
- package/types/shared/lib/index.d.ts +1 -0
- package/.npmiognore +0 -1
package/index.esm.js
CHANGED
|
@@ -23356,7 +23356,7 @@ class ArcwareConfig extends _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBP
|
|
|
23356
23356
|
if (!config.initialSettings.ss)
|
|
23357
23357
|
config.initialSettings.ss = DefaultUrl;
|
|
23358
23358
|
super(config);
|
|
23359
|
-
this.VERSION = "1.2.
|
|
23359
|
+
this.VERSION = "1.2.18";
|
|
23360
23360
|
this.settings = settings;
|
|
23361
23361
|
this.session = new _domain_Session__WEBPACK_IMPORTED_MODULE_0__.Session();
|
|
23362
23362
|
this._initialSettings = config.initialSettings;
|
|
@@ -23502,18 +23502,18 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23502
23502
|
/* harmony export */ });
|
|
23503
23503
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(655);
|
|
23504
23504
|
/* harmony import */ var _arcware_cloud_shared_pixelstreaming_websdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7910);
|
|
23505
|
-
/* harmony import */ var
|
|
23505
|
+
/* harmony import */ var _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(516);
|
|
23506
23506
|
/* harmony import */ var _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(7800);
|
|
23507
23507
|
/* harmony import */ var _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(7463);
|
|
23508
|
-
/* harmony import */ var
|
|
23509
|
-
/* harmony import */ var
|
|
23508
|
+
/* harmony import */ var _ApplyUrlHack__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4790);
|
|
23509
|
+
/* harmony import */ var _domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(3379);
|
|
23510
23510
|
/* harmony import */ var _domain_Stats__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9764);
|
|
23511
23511
|
/* harmony import */ var _domain_debounce__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(9580);
|
|
23512
23512
|
/* harmony import */ var _ui_LoveLetters__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(4572);
|
|
23513
23513
|
/* harmony import */ var _ui_ArcwareLogoLoader__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6469);
|
|
23514
|
-
/* harmony import */ var
|
|
23514
|
+
/* harmony import */ var _ui_MicrophoneOverlay__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(3613);
|
|
23515
23515
|
/* harmony import */ var _domain_ConnectionIdentifier__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5999);
|
|
23516
|
-
/* harmony import */ var
|
|
23516
|
+
/* harmony import */ var _DiagnosticsCollector__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6478);
|
|
23517
23517
|
|
|
23518
23518
|
|
|
23519
23519
|
|
|
@@ -23526,7 +23526,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23526
23526
|
|
|
23527
23527
|
|
|
23528
23528
|
|
|
23529
|
-
class ArcwarePixelStreaming extends
|
|
23529
|
+
class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_4__.PixelStreaming {
|
|
23530
23530
|
/** Returns a list of WebSocketStates of all PixelStreaming Instances generated. */
|
|
23531
23531
|
get WebsocketStates() {
|
|
23532
23532
|
return _domain_ConnectionIdentifier__WEBPACK_IMPORTED_MODULE_2__.ConnectionIdentifier.Instance.GetWebSocketStates();
|
|
@@ -23543,24 +23543,24 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
|
|
|
23543
23543
|
}
|
|
23544
23544
|
constructor(config, overrides) {
|
|
23545
23545
|
/** As soon as upstream is fixed, we got to adjust the url building process. */
|
|
23546
|
-
(0,
|
|
23546
|
+
(0,_ApplyUrlHack__WEBPACK_IMPORTED_MODULE_5__.ApplyUrlHack)();
|
|
23547
23547
|
super(config, overrides);
|
|
23548
23548
|
this.loveLettersQueue = [];
|
|
23549
23549
|
this.isProcessingQueue = false;
|
|
23550
23550
|
// Externalized
|
|
23551
23551
|
/** On ping the session creation timestamp will be updated. */
|
|
23552
|
-
this.queueHandler = new
|
|
23552
|
+
this.queueHandler = new _domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler();
|
|
23553
23553
|
/** Error receiver. */
|
|
23554
|
-
this.errorHandler = new
|
|
23554
|
+
this.errorHandler = new _domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler();
|
|
23555
23555
|
/** LoveLetter */
|
|
23556
|
-
this.loveLetterHandler = new
|
|
23556
|
+
this.loveLetterHandler = new _domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler();
|
|
23557
23557
|
/** SessionId */
|
|
23558
|
-
this.sessionIdHandler = new
|
|
23558
|
+
this.sessionIdHandler = new _domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler();
|
|
23559
23559
|
/** VideoInitialized */
|
|
23560
|
-
this.videoInitializedHandler = new
|
|
23560
|
+
this.videoInitializedHandler = new _domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler();
|
|
23561
23561
|
// Internal
|
|
23562
23562
|
/** WebSocket Close */
|
|
23563
|
-
this.websocketOnCloseHandler = new
|
|
23563
|
+
this.websocketOnCloseHandler = new _domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler();
|
|
23564
23564
|
/** Theoretically this call should be used to implement the signalling url, but this would not work at all, if config is setup for "AutoConnect=true"
|
|
23565
23565
|
* Instead we use ApplyUrlHack();
|
|
23566
23566
|
*/
|
|
@@ -23572,8 +23572,8 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
|
|
|
23572
23572
|
// Set override config.
|
|
23573
23573
|
this.config = config;
|
|
23574
23574
|
this.loveLettersList = [];
|
|
23575
|
-
this.microphoneOverlay = new
|
|
23576
|
-
this.diagnosticsCollector = new
|
|
23575
|
+
this.microphoneOverlay = new _ui_MicrophoneOverlay__WEBPACK_IMPORTED_MODULE_7__.MicrophoneOverlay(this);
|
|
23576
|
+
this.diagnosticsCollector = new _DiagnosticsCollector__WEBPACK_IMPORTED_MODULE_3__.DiagnosticsCollector({
|
|
23577
23577
|
enableBandwidthProbe: false,
|
|
23578
23578
|
});
|
|
23579
23579
|
// this.loveLettersContainer = null;
|
|
@@ -23684,30 +23684,30 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
|
|
|
23684
23684
|
}
|
|
23685
23685
|
onQueue(message) {
|
|
23686
23686
|
_epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_10__.Logger.Info(`QueueInfo received.`);
|
|
23687
|
-
|
|
23687
|
+
_domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler.Emit(this.queueHandler, message);
|
|
23688
23688
|
}
|
|
23689
23689
|
onError(error) {
|
|
23690
23690
|
_epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_10__.Logger.Error(error.type);
|
|
23691
|
-
|
|
23691
|
+
_domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler.Emit(this.errorHandler, error);
|
|
23692
23692
|
}
|
|
23693
23693
|
onLoveLetter(loveLetter) {
|
|
23694
23694
|
// Logger.Info(Logger.GetStackTrace(), loveLetter.reason);
|
|
23695
23695
|
if (this.config.settings.loveLetterLogging)
|
|
23696
23696
|
console.info(loveLetter.reason);
|
|
23697
|
-
|
|
23697
|
+
_domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler.Emit(this.loveLetterHandler, loveLetter);
|
|
23698
23698
|
this.pushLetter(loveLetter.reason);
|
|
23699
23699
|
}
|
|
23700
23700
|
onSessionId(message) {
|
|
23701
23701
|
_epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBPACK_IMPORTED_MODULE_10__.Logger.Info(message.sessionId);
|
|
23702
23702
|
// console.info(`Session: ${message.sessionId}`);
|
|
23703
23703
|
this.session.set(message.sessionId);
|
|
23704
|
-
|
|
23704
|
+
_domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler.Emit(this.sessionIdHandler, message.sessionId);
|
|
23705
23705
|
}
|
|
23706
23706
|
onVideoInitialized() {
|
|
23707
23707
|
/** The videoInitialized event is important for the Arcware Cloud BAckend, since without that event the instance will be cleaned up (killed). */
|
|
23708
23708
|
this.handleMouseLock();
|
|
23709
23709
|
this.send({ type: "onVideoInitialized" });
|
|
23710
|
-
|
|
23710
|
+
_domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler.Emit(this.videoInitializedHandler, undefined);
|
|
23711
23711
|
this.handleResolutionChange();
|
|
23712
23712
|
this.handleRemoveLoveLetters();
|
|
23713
23713
|
this.microphoneOverlay.toggleVisibility(false);
|
|
@@ -23928,7 +23928,7 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
|
|
|
23928
23928
|
var _a, _b;
|
|
23929
23929
|
let self = this;
|
|
23930
23930
|
(_b = (_a = this.webRtcController) === null || _a === void 0 ? void 0 : _a.transport) === null || _b === void 0 ? void 0 : _b.addEventListener("close", (event) => {
|
|
23931
|
-
|
|
23931
|
+
_domain_EventHandler__WEBPACK_IMPORTED_MODULE_6__.EventHandler.Emit(self.websocketOnCloseHandler, event);
|
|
23932
23932
|
});
|
|
23933
23933
|
}
|
|
23934
23934
|
onStreamingStateChange(callback) {
|
|
@@ -23975,7 +23975,9 @@ class ArcwarePixelStreaming extends _epicgames_ps_lib_pixelstreamingfrontend_ue5
|
|
|
23975
23975
|
|
|
23976
23976
|
__webpack_require__.r(__webpack_exports__);
|
|
23977
23977
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23978
|
-
/* harmony export */ "DiagnosticsCollector": () => (/* binding */ DiagnosticsCollector)
|
|
23978
|
+
/* harmony export */ "DiagnosticsCollector": () => (/* binding */ DiagnosticsCollector),
|
|
23979
|
+
/* harmony export */ "Orientation": () => (/* binding */ Orientation),
|
|
23980
|
+
/* harmony export */ "Type": () => (/* binding */ Type)
|
|
23979
23981
|
/* harmony export */ });
|
|
23980
23982
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(655);
|
|
23981
23983
|
/**
|
|
@@ -23992,15 +23994,27 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
23992
23994
|
* Default location: /diag/probe.bin
|
|
23993
23995
|
*/
|
|
23994
23996
|
|
|
23997
|
+
var Orientation;
|
|
23998
|
+
(function (Orientation) {
|
|
23999
|
+
Orientation["Landscape"] = "landscape";
|
|
24000
|
+
Orientation["Portrait"] = "portrait";
|
|
24001
|
+
})(Orientation || (Orientation = {}));
|
|
24002
|
+
var Type;
|
|
24003
|
+
(function (Type) {
|
|
24004
|
+
Type["Desktop"] = "desktop";
|
|
24005
|
+
Type["Mobile"] = "mobile";
|
|
24006
|
+
Type["Tablet"] = "tablet";
|
|
24007
|
+
})(Type || (Type = {}));
|
|
23995
24008
|
/**
|
|
23996
24009
|
* DiagnosticsCollector
|
|
23997
24010
|
*/
|
|
23998
24011
|
class DiagnosticsCollector {
|
|
23999
24012
|
constructor(opts = {}) {
|
|
24000
24013
|
var _a, _b, _c, _d;
|
|
24014
|
+
this.uaInfoCache = null;
|
|
24001
24015
|
this.opts = {
|
|
24002
24016
|
enableBandwidthProbe: (_a = opts.enableBandwidthProbe) !== null && _a !== void 0 ? _a : true,
|
|
24003
|
-
probeUrl: (_b = opts.probeUrl) !== null && _b !== void 0 ? _b :
|
|
24017
|
+
probeUrl: (_b = opts.probeUrl) !== null && _b !== void 0 ? _b : "/diag/probe.bin",
|
|
24004
24018
|
respectSaveData: (_c = opts.respectSaveData) !== null && _c !== void 0 ? _c : true,
|
|
24005
24019
|
sampleRate: Math.max(0, Math.min(1, (_d = opts.sampleRate) !== null && _d !== void 0 ? _d : 1))
|
|
24006
24020
|
};
|
|
@@ -24013,8 +24027,8 @@ class DiagnosticsCollector {
|
|
|
24013
24027
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function* () {
|
|
24014
24028
|
if (!this.shouldSample()) {
|
|
24015
24029
|
return {
|
|
24016
|
-
device: { type:
|
|
24017
|
-
runtime: { browser: { family:
|
|
24030
|
+
device: { type: Type.Desktop, touchSupport: false },
|
|
24031
|
+
runtime: { browser: { family: "Unknown", version: null }, os: { family: "Unknown", version: null } },
|
|
24018
24032
|
powerHints: { saveData: null, prefersReducedData: null, prefersReducedMotion: null },
|
|
24019
24033
|
network: { type: null, effectiveType: null, downlinkMbps: null, rttMs: null, measuredDownlinkMbps: null },
|
|
24020
24034
|
timestamps: { collectedAt: Date.now() }
|
|
@@ -24060,9 +24074,9 @@ class DiagnosticsCollector {
|
|
|
24060
24074
|
const stats = yield pc.getStats();
|
|
24061
24075
|
let selected, transport, local, remote;
|
|
24062
24076
|
stats.forEach((r) => {
|
|
24063
|
-
if (r.type ===
|
|
24077
|
+
if (r.type === "transport" && r.selectedCandidatePairId)
|
|
24064
24078
|
transport = r;
|
|
24065
|
-
if (r.type ===
|
|
24079
|
+
if (r.type === "candidate-pair" && (r.selected || r.nominated))
|
|
24066
24080
|
selected = r;
|
|
24067
24081
|
});
|
|
24068
24082
|
if (selected) {
|
|
@@ -24103,16 +24117,16 @@ class DiagnosticsCollector {
|
|
|
24103
24117
|
hasTouch() {
|
|
24104
24118
|
var _a;
|
|
24105
24119
|
const nav = navigator;
|
|
24106
|
-
return
|
|
24120
|
+
return "ontouchstart" in window || ((_a = nav.maxTouchPoints) !== null && _a !== void 0 ? _a : 0) > 0;
|
|
24107
24121
|
}
|
|
24108
24122
|
getOrientation() {
|
|
24109
24123
|
var _a;
|
|
24110
24124
|
try {
|
|
24111
24125
|
if ((_a = screen.orientation) === null || _a === void 0 ? void 0 : _a.type) {
|
|
24112
|
-
return screen.orientation.type.startsWith(
|
|
24126
|
+
return screen.orientation.type.startsWith("portrait") ? Orientation.Portrait : Orientation.Landscape;
|
|
24113
24127
|
}
|
|
24114
24128
|
if (window.matchMedia) {
|
|
24115
|
-
return window.matchMedia(
|
|
24129
|
+
return window.matchMedia("(orientation: portrait)").matches ? Orientation.Portrait : Orientation.Landscape;
|
|
24116
24130
|
}
|
|
24117
24131
|
}
|
|
24118
24132
|
catch (_b) { }
|
|
@@ -24120,8 +24134,8 @@ class DiagnosticsCollector {
|
|
|
24120
24134
|
}
|
|
24121
24135
|
hasWebGL() {
|
|
24122
24136
|
try {
|
|
24123
|
-
const canvas = document.createElement(
|
|
24124
|
-
return !!(canvas.getContext(
|
|
24137
|
+
const canvas = document.createElement("canvas");
|
|
24138
|
+
return !!(canvas.getContext("webgl") || canvas.getContext("experimental-webgl"));
|
|
24125
24139
|
}
|
|
24126
24140
|
catch (_a) {
|
|
24127
24141
|
return false;
|
|
@@ -24129,37 +24143,50 @@ class DiagnosticsCollector {
|
|
|
24129
24143
|
}
|
|
24130
24144
|
/**
|
|
24131
24145
|
* Heuristic device type: best-effort only.
|
|
24146
|
+
* Tries UA-CH, then UA fallback, then touch + screen size heuristics.
|
|
24132
24147
|
*/
|
|
24133
24148
|
inferDeviceType() {
|
|
24134
24149
|
const uaData = navigator.userAgentData;
|
|
24150
|
+
const ua = navigator.userAgent || "";
|
|
24135
24151
|
const isMobileCH = (uaData === null || uaData === void 0 ? void 0 : uaData.mobile) === true;
|
|
24136
24152
|
const minDim = Math.min(screen.width, screen.height);
|
|
24137
|
-
|
|
24138
|
-
|
|
24139
|
-
|
|
24140
|
-
|
|
24141
|
-
|
|
24142
|
-
|
|
24143
|
-
|
|
24144
|
-
|
|
24145
|
-
|
|
24153
|
+
// 1. Explicit iPad / tablet detection via UA (iOS often lies in CH)
|
|
24154
|
+
if (/\b(iPad|Tablet)\b/i.test(ua)) {
|
|
24155
|
+
return Type.Tablet;
|
|
24156
|
+
}
|
|
24157
|
+
// 2. UA-CH mobile hint (Chromium only, often accurate for Android)
|
|
24158
|
+
if (isMobileCH) {
|
|
24159
|
+
if (minDim >= 600)
|
|
24160
|
+
return Type.Tablet;
|
|
24161
|
+
return Type.Mobile;
|
|
24162
|
+
}
|
|
24163
|
+
// 3. UA sniffing fallback for mobile
|
|
24164
|
+
if (/\b(iPhone|Android.*Mobile|Windows Phone)\b/i.test(ua)) {
|
|
24165
|
+
return Type.Mobile;
|
|
24166
|
+
}
|
|
24167
|
+
// 4. Touch-capable with "tablet-like" dimensions
|
|
24168
|
+
if (("ontouchstart" in window || navigator.maxTouchPoints > 0) && minDim >= 600 && minDim <= 1100) {
|
|
24169
|
+
return Type.Tablet;
|
|
24170
|
+
}
|
|
24171
|
+
// 5. Default fallback
|
|
24172
|
+
return Type.Desktop;
|
|
24146
24173
|
}
|
|
24147
24174
|
getPowerHints() {
|
|
24148
24175
|
const conn = navigator.connection;
|
|
24149
|
-
const saveData = typeof (conn === null || conn === void 0 ? void 0 : conn.saveData) ===
|
|
24176
|
+
const saveData = typeof (conn === null || conn === void 0 ? void 0 : conn.saveData) === "boolean" ? conn.saveData : null;
|
|
24150
24177
|
let prefersReducedData = null;
|
|
24151
24178
|
let prefersReducedMotion = null;
|
|
24152
|
-
if (typeof window.matchMedia ===
|
|
24179
|
+
if (typeof window.matchMedia === "function") {
|
|
24153
24180
|
try {
|
|
24154
|
-
const mqData = window.matchMedia(
|
|
24155
|
-
if (typeof mqData.matches ===
|
|
24181
|
+
const mqData = window.matchMedia("(prefers-reduced-data: reduce)");
|
|
24182
|
+
if (typeof mqData.matches === "boolean") {
|
|
24156
24183
|
prefersReducedData = mqData.matches;
|
|
24157
24184
|
}
|
|
24158
24185
|
}
|
|
24159
24186
|
catch (_a) { }
|
|
24160
24187
|
try {
|
|
24161
|
-
const mqMotion = window.matchMedia(
|
|
24162
|
-
if (typeof mqMotion.matches ===
|
|
24188
|
+
const mqMotion = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
24189
|
+
if (typeof mqMotion.matches === "boolean") {
|
|
24163
24190
|
prefersReducedMotion = mqMotion.matches;
|
|
24164
24191
|
}
|
|
24165
24192
|
}
|
|
@@ -24170,10 +24197,10 @@ class DiagnosticsCollector {
|
|
|
24170
24197
|
getNetworkInfo(measuredDownlinkMbps) {
|
|
24171
24198
|
const conn = navigator.connection;
|
|
24172
24199
|
return {
|
|
24173
|
-
type:
|
|
24174
|
-
effectiveType:
|
|
24175
|
-
downlinkMbps:
|
|
24176
|
-
rttMs:
|
|
24200
|
+
type: typeof (conn === null || conn === void 0 ? void 0 : conn.type) === "string" ? conn.type : null,
|
|
24201
|
+
effectiveType: typeof (conn === null || conn === void 0 ? void 0 : conn.effectiveType) === "string" ? conn.effectiveType : null,
|
|
24202
|
+
downlinkMbps: typeof (conn === null || conn === void 0 ? void 0 : conn.downlink) === "number" ? conn.downlink : null,
|
|
24203
|
+
rttMs: typeof (conn === null || conn === void 0 ? void 0 : conn.rtt) === "number" ? conn.rtt : null,
|
|
24177
24204
|
measuredDownlinkMbps
|
|
24178
24205
|
};
|
|
24179
24206
|
}
|
|
@@ -24188,8 +24215,8 @@ class DiagnosticsCollector {
|
|
|
24188
24215
|
try {
|
|
24189
24216
|
const t0 = performance.now();
|
|
24190
24217
|
const res = yield fetch(this.withCacheBuster(this.opts.probeUrl), {
|
|
24191
|
-
cache:
|
|
24192
|
-
credentials:
|
|
24218
|
+
cache: "no-store",
|
|
24219
|
+
credentials: "omit"
|
|
24193
24220
|
});
|
|
24194
24221
|
const buf = yield res.arrayBuffer();
|
|
24195
24222
|
const t1 = performance.now();
|
|
@@ -24197,7 +24224,7 @@ class DiagnosticsCollector {
|
|
|
24197
24224
|
const seconds = (t1 - t0) / 1000;
|
|
24198
24225
|
if (seconds <= 0.05)
|
|
24199
24226
|
return null; // ignore unstable samples
|
|
24200
|
-
return +(
|
|
24227
|
+
return +(bits / seconds / 1000000).toFixed(2);
|
|
24201
24228
|
}
|
|
24202
24229
|
catch (_a) {
|
|
24203
24230
|
return null;
|
|
@@ -24208,7 +24235,7 @@ class DiagnosticsCollector {
|
|
|
24208
24235
|
var _a, _b;
|
|
24209
24236
|
const u = new URL(url, location.origin);
|
|
24210
24237
|
const token = (_b = (_a = crypto === null || crypto === void 0 ? void 0 : crypto.randomUUID) === null || _a === void 0 ? void 0 : _a.call(crypto)) !== null && _b !== void 0 ? _b : String(Date.now());
|
|
24211
|
-
u.searchParams.set(
|
|
24238
|
+
u.searchParams.set("cb", token);
|
|
24212
24239
|
return u.toString();
|
|
24213
24240
|
}
|
|
24214
24241
|
getCodecSupport() {
|
|
@@ -24223,10 +24250,10 @@ class DiagnosticsCollector {
|
|
|
24223
24250
|
supportsCodec(mime) {
|
|
24224
24251
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function* () {
|
|
24225
24252
|
try {
|
|
24226
|
-
if (
|
|
24253
|
+
if ("mediaCapabilities" in navigator) {
|
|
24227
24254
|
// @ts-ignore
|
|
24228
24255
|
const res = yield navigator.mediaCapabilities.decodingInfo({
|
|
24229
|
-
type:
|
|
24256
|
+
type: "file",
|
|
24230
24257
|
video: { contentType: mime, width: 1920, height: 1080, bitrate: 5000000, framerate: 30 }
|
|
24231
24258
|
});
|
|
24232
24259
|
return !!(res === null || res === void 0 ? void 0 : res.supported);
|
|
@@ -24234,8 +24261,8 @@ class DiagnosticsCollector {
|
|
|
24234
24261
|
}
|
|
24235
24262
|
catch (_a) { }
|
|
24236
24263
|
try {
|
|
24237
|
-
const v = document.createElement(
|
|
24238
|
-
return v.canPlayType(mime) !==
|
|
24264
|
+
const v = document.createElement("video");
|
|
24265
|
+
return v.canPlayType(mime) !== "";
|
|
24239
24266
|
}
|
|
24240
24267
|
catch (_b) {
|
|
24241
24268
|
return false;
|
|
@@ -24243,60 +24270,104 @@ class DiagnosticsCollector {
|
|
|
24243
24270
|
});
|
|
24244
24271
|
}
|
|
24245
24272
|
getUAInfo() {
|
|
24246
|
-
var _a, _b;
|
|
24247
24273
|
return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function* () {
|
|
24274
|
+
if (this.uaInfoCache)
|
|
24275
|
+
return this.uaInfoCache;
|
|
24248
24276
|
const nav = navigator;
|
|
24249
24277
|
const uaData = nav.userAgentData;
|
|
24250
|
-
|
|
24251
|
-
let
|
|
24252
|
-
let
|
|
24278
|
+
const ua = navigator.userAgent;
|
|
24279
|
+
let browserFamily = "Unknown";
|
|
24280
|
+
let browserVersion = null;
|
|
24281
|
+
let osFamily = "Unknown";
|
|
24282
|
+
let osVersion = null;
|
|
24283
|
+
let model = null;
|
|
24284
|
+
let architecture = null;
|
|
24285
|
+
let bitness = null;
|
|
24286
|
+
// --- UA-CH (modern browsers) ---
|
|
24253
24287
|
if (uaData === null || uaData === void 0 ? void 0 : uaData.getHighEntropyValues) {
|
|
24254
24288
|
try {
|
|
24255
24289
|
const high = yield uaData.getHighEntropyValues([
|
|
24256
|
-
|
|
24290
|
+
"platform",
|
|
24291
|
+
"platformVersion",
|
|
24292
|
+
"model",
|
|
24293
|
+
"architecture",
|
|
24294
|
+
"bitness",
|
|
24295
|
+
"fullVersionList"
|
|
24257
24296
|
]);
|
|
24258
|
-
osFamily = high.platform ||
|
|
24297
|
+
osFamily = high.platform || "Unknown";
|
|
24259
24298
|
osVersion = high.platformVersion || null;
|
|
24260
24299
|
model = high.model || null;
|
|
24261
24300
|
architecture = high.architecture || null;
|
|
24262
24301
|
bitness = high.bitness || null;
|
|
24263
24302
|
const brands = high.fullVersionList || uaData.brands || [];
|
|
24264
|
-
const
|
|
24265
|
-
|
|
24266
|
-
|
|
24267
|
-
|
|
24268
|
-
|
|
24269
|
-
|
|
24270
|
-
|
|
24271
|
-
|
|
24272
|
-
|
|
24273
|
-
|
|
24274
|
-
browserVersion = RegExp.$1;
|
|
24275
|
-
}
|
|
24276
|
-
else if (/Edg\/(\S+)/.test(ua)) {
|
|
24277
|
-
browserFamily = 'Edge';
|
|
24278
|
-
browserVersion = RegExp.$1;
|
|
24303
|
+
const realBrand = brands.find((b) => {
|
|
24304
|
+
if (!b.brand)
|
|
24305
|
+
return false;
|
|
24306
|
+
const normalized = b.brand.replace(/[^a-zA-Z]/g, "").toLowerCase();
|
|
24307
|
+
return !normalized.includes("chromium") && !normalized.includes("notabrand");
|
|
24308
|
+
});
|
|
24309
|
+
if (realBrand) {
|
|
24310
|
+
browserFamily = realBrand.brand;
|
|
24311
|
+
browserVersion = realBrand.version;
|
|
24312
|
+
}
|
|
24279
24313
|
}
|
|
24280
|
-
|
|
24281
|
-
|
|
24282
|
-
browserVersion = RegExp.$1;
|
|
24314
|
+
catch (_a) {
|
|
24315
|
+
// silently fail
|
|
24283
24316
|
}
|
|
24284
|
-
|
|
24285
|
-
|
|
24286
|
-
|
|
24317
|
+
}
|
|
24318
|
+
// --- Fallback to classic UA parsing if browser unknown ---
|
|
24319
|
+
if (!browserFamily || browserFamily === "Unknown") {
|
|
24320
|
+
const browserRegexes = [
|
|
24321
|
+
[/Edg\/(\S+)/, "Edge"],
|
|
24322
|
+
[/OPR\/(\S+)/, "Opera"],
|
|
24323
|
+
[/SamsungBrowser\/(\S+)/, "Samsung Internet"],
|
|
24324
|
+
[/Firefox\/(\S+)/, "Firefox"],
|
|
24325
|
+
[/Chrome\/(\S+)/, "Chrome"],
|
|
24326
|
+
[/Version\/(\S+).*Safari/, "Safari"]
|
|
24327
|
+
];
|
|
24328
|
+
for (const [regex, name] of browserRegexes) {
|
|
24329
|
+
const match = ua.match(regex);
|
|
24330
|
+
if (match) {
|
|
24331
|
+
browserFamily = name;
|
|
24332
|
+
browserVersion = match[1];
|
|
24333
|
+
break;
|
|
24334
|
+
}
|
|
24287
24335
|
}
|
|
24288
|
-
|
|
24289
|
-
|
|
24290
|
-
|
|
24291
|
-
|
|
24292
|
-
|
|
24293
|
-
|
|
24294
|
-
|
|
24295
|
-
|
|
24296
|
-
|
|
24297
|
-
|
|
24298
|
-
}
|
|
24299
|
-
|
|
24336
|
+
}
|
|
24337
|
+
// --- OS detection (always run, iOS first) ---
|
|
24338
|
+
if (/iPhone|iPad|iPod/.test(ua)) {
|
|
24339
|
+
osFamily = "iOS";
|
|
24340
|
+
const match = ua.match(/OS (\d+[_\d]*)/);
|
|
24341
|
+
if (match)
|
|
24342
|
+
osVersion = match[1].replace(/_/g, ".");
|
|
24343
|
+
}
|
|
24344
|
+
else if (uaData === null || uaData === void 0 ? void 0 : uaData.platform) {
|
|
24345
|
+
osFamily = uaData.platform;
|
|
24346
|
+
}
|
|
24347
|
+
else if (/Windows/.test(ua)) {
|
|
24348
|
+
osFamily = "Windows";
|
|
24349
|
+
const match = ua.match(/Windows NT (\d+\.\d+)/);
|
|
24350
|
+
if (match)
|
|
24351
|
+
osVersion = match[1];
|
|
24352
|
+
}
|
|
24353
|
+
else if (/Mac OS X/.test(ua)) {
|
|
24354
|
+
osFamily = "macOS";
|
|
24355
|
+
const match = ua.match(/Mac OS X (\d+[_\d]*)/);
|
|
24356
|
+
if (match)
|
|
24357
|
+
osVersion = match[1].replace(/_/g, ".");
|
|
24358
|
+
}
|
|
24359
|
+
else if (/Android/.test(ua)) {
|
|
24360
|
+
osFamily = "Android";
|
|
24361
|
+
const match = ua.match(/Android (\d+(\.\d+)?)/);
|
|
24362
|
+
if (match)
|
|
24363
|
+
osVersion = match[1];
|
|
24364
|
+
}
|
|
24365
|
+
else if (/Linux/.test(ua)) {
|
|
24366
|
+
osFamily = "Linux";
|
|
24367
|
+
}
|
|
24368
|
+
const result = { browserFamily, browserVersion, osFamily, osVersion, model, architecture, bitness };
|
|
24369
|
+
this.uaInfoCache = result;
|
|
24370
|
+
return result;
|
|
24300
24371
|
});
|
|
24301
24372
|
}
|
|
24302
24373
|
}
|