@supraio/client-daemon-js 1.0.0-mzupdateexptouch.448 → 1.0.0-tsfixstreamgeometrypanic.474
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/daemon.html +1 -1
- package/daemon.js +351 -38
- package/daemon.js.map +4 -4
- package/fs/browserfs.d.ts +1 -0
- package/package.json +4 -4
- package/screen/control.d.ts +23 -3
- package/screen/nacldecoder.d.ts +2 -1
- package/screen/options.d.ts +17 -0
- package/screen/samsungwasmdecoder.d.ts +1 -1
- package/screen.html +1 -1
- package/screen.js +479 -57
- package/screen.js.map +4 -4
- package/sdk.js +500 -63
- package/sdk.js.map +4 -4
- package/supra-client-daemon.js +1228 -581
- package/supra-client-daemon.js.map +1 -1
- package/supra-client-daemon.wasm +0 -0
- package/supra-client-screen.js +2240 -1048
- package/supra-client-screen.js.map +1 -1
- package/supra-client-screen.wasm +0 -0
package/sdk.js
CHANGED
|
@@ -10297,12 +10297,12 @@ var require_browserfs = __commonJS({
|
|
|
10297
10297
|
if (process2["initializeTTYs"]) {
|
|
10298
10298
|
process2["initializeTTYs"]();
|
|
10299
10299
|
}
|
|
10300
|
-
function
|
|
10300
|
+
function install(obj) {
|
|
10301
10301
|
obj.Buffer = Buffer2;
|
|
10302
10302
|
obj.process = process2;
|
|
10303
10303
|
var oldRequire = obj.require ? obj.require : null;
|
|
10304
10304
|
obj.require = function(arg) {
|
|
10305
|
-
var rv =
|
|
10305
|
+
var rv = BFSRequire2(arg);
|
|
10306
10306
|
if (!rv) {
|
|
10307
10307
|
return oldRequire.apply(null, Array.prototype.slice.call(arguments, 0));
|
|
10308
10308
|
} else {
|
|
@@ -10313,7 +10313,7 @@ var require_browserfs = __commonJS({
|
|
|
10313
10313
|
function registerFileSystem(name, fs2) {
|
|
10314
10314
|
Backends[name] = fs2;
|
|
10315
10315
|
}
|
|
10316
|
-
function
|
|
10316
|
+
function BFSRequire2(module5) {
|
|
10317
10317
|
switch (module5) {
|
|
10318
10318
|
case "fs":
|
|
10319
10319
|
return _fsMock;
|
|
@@ -10428,9 +10428,9 @@ var require_browserfs = __commonJS({
|
|
|
10428
10428
|
};
|
|
10429
10429
|
}
|
|
10430
10430
|
}
|
|
10431
|
-
exports2.install =
|
|
10431
|
+
exports2.install = install;
|
|
10432
10432
|
exports2.registerFileSystem = registerFileSystem;
|
|
10433
|
-
exports2.BFSRequire =
|
|
10433
|
+
exports2.BFSRequire = BFSRequire2;
|
|
10434
10434
|
exports2.initialize = initialize;
|
|
10435
10435
|
exports2.configure = configure2;
|
|
10436
10436
|
exports2.getFileSystem = getFileSystem;
|
|
@@ -17213,6 +17213,37 @@ var require_messageSender = __commonJS({
|
|
|
17213
17213
|
}
|
|
17214
17214
|
});
|
|
17215
17215
|
|
|
17216
|
+
// node_modules/@signageos/nacl-decoder/dist/NaClDecoder/geometry.js
|
|
17217
|
+
var require_geometry = __commonJS({
|
|
17218
|
+
"node_modules/@signageos/nacl-decoder/dist/NaClDecoder/geometry.js"(exports) {
|
|
17219
|
+
"use strict";
|
|
17220
|
+
var __assign = exports && exports.__assign || function() {
|
|
17221
|
+
__assign = Object.assign || function(t) {
|
|
17222
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17223
|
+
s = arguments[i];
|
|
17224
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
17225
|
+
t[p] = s[p];
|
|
17226
|
+
}
|
|
17227
|
+
return t;
|
|
17228
|
+
};
|
|
17229
|
+
return __assign.apply(this, arguments);
|
|
17230
|
+
};
|
|
17231
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17232
|
+
exports.normalizeGeometry = normalizeGeometry2;
|
|
17233
|
+
function normalizeGeometry2(geometry) {
|
|
17234
|
+
if (!Number.isFinite(geometry.x) || !Number.isFinite(geometry.y) || !Number.isFinite(geometry.width) || !Number.isFinite(geometry.height)) {
|
|
17235
|
+
throw new RangeError("NaCl module geometry values must be finite.");
|
|
17236
|
+
}
|
|
17237
|
+
var width = Math.floor(geometry.width);
|
|
17238
|
+
var height = Math.floor(geometry.height);
|
|
17239
|
+
if (width <= 0 || height <= 0) {
|
|
17240
|
+
throw new RangeError("NaCl module geometry width and height must be positive.");
|
|
17241
|
+
}
|
|
17242
|
+
return __assign(__assign({}, geometry), { width, height });
|
|
17243
|
+
}
|
|
17244
|
+
}
|
|
17245
|
+
});
|
|
17246
|
+
|
|
17216
17247
|
// node_modules/@signageos/nacl-decoder/dist/NaClDecoder/module.js
|
|
17217
17248
|
var require_module = __commonJS({
|
|
17218
17249
|
"node_modules/@signageos/nacl-decoder/dist/NaClDecoder/module.js"(exports) {
|
|
@@ -17220,14 +17251,17 @@ var require_module = __commonJS({
|
|
|
17220
17251
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17221
17252
|
exports.createNaClModule = createNaClModule;
|
|
17222
17253
|
exports.removeNaClModule = removeNaClModule;
|
|
17254
|
+
var geometry_1 = require_geometry();
|
|
17223
17255
|
function handleLoad(event) {
|
|
17224
17256
|
console.log("nacl load", event);
|
|
17225
17257
|
}
|
|
17226
17258
|
function handleCrash(event) {
|
|
17227
17259
|
console.log("nacl crash", event);
|
|
17228
17260
|
}
|
|
17229
|
-
|
|
17230
|
-
|
|
17261
|
+
var messageListeners = /* @__PURE__ */ new WeakMap();
|
|
17262
|
+
function createNaClModule(handleMessage, geometry) {
|
|
17263
|
+
var _a, _b, _c, _d;
|
|
17264
|
+
var normalizedGeometry = geometry ? (0, geometry_1.normalizeGeometry)(geometry) : void 0;
|
|
17231
17265
|
var listenerEl = document.createElement("div");
|
|
17232
17266
|
listenerEl.setAttribute("id", "listener");
|
|
17233
17267
|
listenerEl.addEventListener("message", handleMessage, true);
|
|
@@ -17237,22 +17271,34 @@ var require_module = __commonJS({
|
|
|
17237
17271
|
var baseHref = (_b = (_a = document.getElementsByTagName("base")[0]) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : location.href;
|
|
17238
17272
|
var nmpPath = new URL("nacl-decoder.nmf", baseHref).href;
|
|
17239
17273
|
var naclModuleEl = document.createElement("embed");
|
|
17240
|
-
|
|
17241
|
-
|
|
17274
|
+
var width = (_c = normalizedGeometry === null || normalizedGeometry === void 0 ? void 0 : normalizedGeometry.width) !== null && _c !== void 0 ? _c : window.screen.width;
|
|
17275
|
+
var height = (_d = normalizedGeometry === null || normalizedGeometry === void 0 ? void 0 : normalizedGeometry.height) !== null && _d !== void 0 ? _d : window.screen.height;
|
|
17276
|
+
naclModuleEl.setAttribute("width", "".concat(width));
|
|
17277
|
+
naclModuleEl.setAttribute("height", "".concat(height));
|
|
17278
|
+
if (normalizedGeometry) {
|
|
17279
|
+
naclModuleEl.style.position = "absolute";
|
|
17280
|
+
naclModuleEl.style.left = "".concat(normalizedGeometry.x, "px");
|
|
17281
|
+
naclModuleEl.style.top = "".concat(normalizedGeometry.y, "px");
|
|
17282
|
+
}
|
|
17242
17283
|
naclModuleEl.setAttribute("src", nmpPath);
|
|
17243
17284
|
naclModuleEl.setAttribute("type", "application/x-nacl");
|
|
17244
17285
|
naclModuleEl.setAttribute("id", "nacl_module");
|
|
17245
17286
|
listenerEl.appendChild(naclModuleEl);
|
|
17287
|
+
messageListeners.set(naclModuleEl, handleMessage);
|
|
17246
17288
|
return naclModuleEl;
|
|
17247
17289
|
}
|
|
17248
17290
|
function removeNaClModule(naclModuleEl) {
|
|
17249
17291
|
var listenerEl = naclModuleEl.parentElement;
|
|
17250
17292
|
if (listenerEl) {
|
|
17251
|
-
|
|
17293
|
+
var handleMessage = messageListeners.get(naclModuleEl);
|
|
17294
|
+
if (handleMessage) {
|
|
17295
|
+
listenerEl.removeEventListener("message", handleMessage, true);
|
|
17296
|
+
}
|
|
17252
17297
|
listenerEl.removeEventListener("load", handleLoad, true);
|
|
17253
17298
|
listenerEl.removeEventListener("crash", handleCrash, true);
|
|
17254
17299
|
listenerEl.remove();
|
|
17255
17300
|
}
|
|
17301
|
+
messageListeners.delete(naclModuleEl);
|
|
17256
17302
|
naclModuleEl.remove();
|
|
17257
17303
|
}
|
|
17258
17304
|
}
|
|
@@ -17976,14 +18022,17 @@ var require_naclDecoder = __commonJS({
|
|
|
17976
18022
|
var NaClDecoder = (
|
|
17977
18023
|
/** @class */
|
|
17978
18024
|
function() {
|
|
17979
|
-
function NaClDecoder2(messageSender, naclModuleEl) {
|
|
18025
|
+
function NaClDecoder2(messageSender, naclModuleEl, onDestroy) {
|
|
17980
18026
|
this.messageSender = messageSender;
|
|
17981
18027
|
this.naclModuleEl = naclModuleEl;
|
|
18028
|
+
this.onDestroy = onDestroy;
|
|
17982
18029
|
}
|
|
17983
18030
|
NaClDecoder2.prototype.destroy = function() {
|
|
17984
18031
|
return __awaiter(this, void 0, void 0, function() {
|
|
17985
|
-
|
|
18032
|
+
var _a;
|
|
18033
|
+
return __generator(this, function(_b) {
|
|
17986
18034
|
(0, module_1.removeNaClModule)(this.naclModuleEl);
|
|
18035
|
+
(_a = this.onDestroy) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
17987
18036
|
return [
|
|
17988
18037
|
2
|
|
17989
18038
|
/*return*/
|
|
@@ -18272,6 +18321,25 @@ var require_videoDecoder = __commonJS({
|
|
|
18272
18321
|
var require_dist = __commonJS({
|
|
18273
18322
|
"node_modules/@signageos/nacl-decoder/dist/index.js"(exports) {
|
|
18274
18323
|
"use strict";
|
|
18324
|
+
var __extends = exports && exports.__extends || /* @__PURE__ */ function() {
|
|
18325
|
+
var extendStatics = function(d, b) {
|
|
18326
|
+
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
18327
|
+
d2.__proto__ = b2;
|
|
18328
|
+
} || function(d2, b2) {
|
|
18329
|
+
for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
|
|
18330
|
+
};
|
|
18331
|
+
return extendStatics(d, b);
|
|
18332
|
+
};
|
|
18333
|
+
return function(d, b) {
|
|
18334
|
+
if (typeof b !== "function" && b !== null)
|
|
18335
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
18336
|
+
extendStatics(d, b);
|
|
18337
|
+
function __() {
|
|
18338
|
+
this.constructor = d;
|
|
18339
|
+
}
|
|
18340
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18341
|
+
};
|
|
18342
|
+
}();
|
|
18275
18343
|
var __assign = exports && exports.__assign || function() {
|
|
18276
18344
|
__assign = Object.assign || function(t) {
|
|
18277
18345
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -18283,6 +18351,102 @@ var require_dist = __commonJS({
|
|
|
18283
18351
|
};
|
|
18284
18352
|
return __assign.apply(this, arguments);
|
|
18285
18353
|
};
|
|
18354
|
+
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
18355
|
+
function adopt(value) {
|
|
18356
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
18357
|
+
resolve(value);
|
|
18358
|
+
});
|
|
18359
|
+
}
|
|
18360
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
18361
|
+
function fulfilled(value) {
|
|
18362
|
+
try {
|
|
18363
|
+
step(generator.next(value));
|
|
18364
|
+
} catch (e) {
|
|
18365
|
+
reject(e);
|
|
18366
|
+
}
|
|
18367
|
+
}
|
|
18368
|
+
function rejected(value) {
|
|
18369
|
+
try {
|
|
18370
|
+
step(generator["throw"](value));
|
|
18371
|
+
} catch (e) {
|
|
18372
|
+
reject(e);
|
|
18373
|
+
}
|
|
18374
|
+
}
|
|
18375
|
+
function step(result) {
|
|
18376
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
18377
|
+
}
|
|
18378
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18379
|
+
});
|
|
18380
|
+
};
|
|
18381
|
+
var __generator = exports && exports.__generator || function(thisArg, body) {
|
|
18382
|
+
var _ = { label: 0, sent: function() {
|
|
18383
|
+
if (t[0] & 1) throw t[1];
|
|
18384
|
+
return t[1];
|
|
18385
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
18386
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
18387
|
+
return this;
|
|
18388
|
+
}), g;
|
|
18389
|
+
function verb(n) {
|
|
18390
|
+
return function(v) {
|
|
18391
|
+
return step([n, v]);
|
|
18392
|
+
};
|
|
18393
|
+
}
|
|
18394
|
+
function step(op) {
|
|
18395
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
18396
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18397
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18398
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
18399
|
+
switch (op[0]) {
|
|
18400
|
+
case 0:
|
|
18401
|
+
case 1:
|
|
18402
|
+
t = op;
|
|
18403
|
+
break;
|
|
18404
|
+
case 4:
|
|
18405
|
+
_.label++;
|
|
18406
|
+
return { value: op[1], done: false };
|
|
18407
|
+
case 5:
|
|
18408
|
+
_.label++;
|
|
18409
|
+
y = op[1];
|
|
18410
|
+
op = [0];
|
|
18411
|
+
continue;
|
|
18412
|
+
case 7:
|
|
18413
|
+
op = _.ops.pop();
|
|
18414
|
+
_.trys.pop();
|
|
18415
|
+
continue;
|
|
18416
|
+
default:
|
|
18417
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
18418
|
+
_ = 0;
|
|
18419
|
+
continue;
|
|
18420
|
+
}
|
|
18421
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
18422
|
+
_.label = op[1];
|
|
18423
|
+
break;
|
|
18424
|
+
}
|
|
18425
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
18426
|
+
_.label = t[1];
|
|
18427
|
+
t = op;
|
|
18428
|
+
break;
|
|
18429
|
+
}
|
|
18430
|
+
if (t && _.label < t[2]) {
|
|
18431
|
+
_.label = t[2];
|
|
18432
|
+
_.ops.push(op);
|
|
18433
|
+
break;
|
|
18434
|
+
}
|
|
18435
|
+
if (t[2]) _.ops.pop();
|
|
18436
|
+
_.trys.pop();
|
|
18437
|
+
continue;
|
|
18438
|
+
}
|
|
18439
|
+
op = body.call(thisArg, _);
|
|
18440
|
+
} catch (e) {
|
|
18441
|
+
op = [6, e];
|
|
18442
|
+
y = 0;
|
|
18443
|
+
} finally {
|
|
18444
|
+
f = t = 0;
|
|
18445
|
+
}
|
|
18446
|
+
if (op[0] & 5) throw op[1];
|
|
18447
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
18448
|
+
}
|
|
18449
|
+
};
|
|
18286
18450
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18287
18451
|
exports.NaClTCPStreamConnection = exports.NaClTCPStream = exports.NaClTCPPacketConnection = exports.NaClTCPPacket = exports.NaClFrameCollector = exports.VideoProfile = exports.ResultStatus = exports.HWAcceleration = exports.NaClDecoder = void 0;
|
|
18288
18452
|
exports.isNaClSupported = isNaClSupported3;
|
|
@@ -18325,6 +18489,29 @@ var require_dist = __commonJS({
|
|
|
18325
18489
|
var DEFAULT_OPTIONS = {
|
|
18326
18490
|
timeoutMs: 1e3
|
|
18327
18491
|
};
|
|
18492
|
+
var RuntimeOwnedNaClDecoder = (
|
|
18493
|
+
/** @class */
|
|
18494
|
+
function(_super) {
|
|
18495
|
+
__extends(RuntimeOwnedNaClDecoder2, _super);
|
|
18496
|
+
function RuntimeOwnedNaClDecoder2(messageSender, naclModuleEl, releaseRuntime) {
|
|
18497
|
+
var _this = _super.call(this, messageSender, naclModuleEl) || this;
|
|
18498
|
+
_this.releaseRuntime = releaseRuntime;
|
|
18499
|
+
return _this;
|
|
18500
|
+
}
|
|
18501
|
+
RuntimeOwnedNaClDecoder2.prototype.destroy = function() {
|
|
18502
|
+
return __awaiter(this, void 0, void 0, function() {
|
|
18503
|
+
return __generator(this, function(_a) {
|
|
18504
|
+
this.releaseRuntime();
|
|
18505
|
+
return [
|
|
18506
|
+
2
|
|
18507
|
+
/*return*/
|
|
18508
|
+
];
|
|
18509
|
+
});
|
|
18510
|
+
});
|
|
18511
|
+
};
|
|
18512
|
+
return RuntimeOwnedNaClDecoder2;
|
|
18513
|
+
}(naclDecoder_1.NaClDecoder)
|
|
18514
|
+
);
|
|
18328
18515
|
var naclRuntime = null;
|
|
18329
18516
|
function isNaClSupported3() {
|
|
18330
18517
|
return (
|
|
@@ -18337,26 +18524,48 @@ var require_dist = __commonJS({
|
|
|
18337
18524
|
if (!isNaClSupported3()) {
|
|
18338
18525
|
throw new Error("NaCl is not supported in this browser.");
|
|
18339
18526
|
}
|
|
18340
|
-
var
|
|
18341
|
-
return new
|
|
18527
|
+
var _a = acquireNaClRuntime(requiredOptions.timeoutMs, options === null || options === void 0 ? void 0 : options.geometry), runtime = _a.runtime, release = _a.release;
|
|
18528
|
+
return new RuntimeOwnedNaClDecoder(runtime.messageSender, runtime.naclModuleEl, release);
|
|
18342
18529
|
}
|
|
18343
18530
|
function createNaClTCP2(options) {
|
|
18344
18531
|
var decoder = createNaClDecoder2(options);
|
|
18345
|
-
return decoder.createTCP()
|
|
18532
|
+
return __assign(__assign({}, decoder.createTCP()), { destroy: function() {
|
|
18533
|
+
return decoder.destroy();
|
|
18534
|
+
} });
|
|
18346
18535
|
}
|
|
18347
|
-
function
|
|
18348
|
-
|
|
18349
|
-
|
|
18536
|
+
function acquireNaClRuntime(timeoutMs, geometry) {
|
|
18537
|
+
var runtime = naclRuntime;
|
|
18538
|
+
if (!runtime) {
|
|
18539
|
+
var messageListeners = (0, messageListeners_1.createMessageListeners)();
|
|
18540
|
+
var messageReceiver = new messageReceiver_1.MessageReceiver(messageListeners);
|
|
18541
|
+
var naclModuleEl = (0, module_1.createNaClModule)(messageReceiver.handleMessage.bind(messageReceiver), geometry);
|
|
18542
|
+
var messageSender = new messageSender_1.MessageSender(naclModuleEl, messageListeners, timeoutMs);
|
|
18543
|
+
runtime = {
|
|
18544
|
+
messageSender,
|
|
18545
|
+
naclModuleEl,
|
|
18546
|
+
ownerCount: 0
|
|
18547
|
+
};
|
|
18548
|
+
naclRuntime = runtime;
|
|
18350
18549
|
}
|
|
18351
|
-
|
|
18352
|
-
var
|
|
18353
|
-
|
|
18354
|
-
|
|
18355
|
-
|
|
18356
|
-
|
|
18357
|
-
|
|
18550
|
+
runtime.ownerCount += 1;
|
|
18551
|
+
var released = false;
|
|
18552
|
+
return {
|
|
18553
|
+
runtime,
|
|
18554
|
+
release: function() {
|
|
18555
|
+
if (released) {
|
|
18556
|
+
return;
|
|
18557
|
+
}
|
|
18558
|
+
released = true;
|
|
18559
|
+
runtime.ownerCount -= 1;
|
|
18560
|
+
if (runtime.ownerCount > 0) {
|
|
18561
|
+
return;
|
|
18562
|
+
}
|
|
18563
|
+
(0, module_1.removeNaClModule)(runtime.naclModuleEl);
|
|
18564
|
+
if (naclRuntime === runtime) {
|
|
18565
|
+
naclRuntime = null;
|
|
18566
|
+
}
|
|
18567
|
+
}
|
|
18358
18568
|
};
|
|
18359
|
-
return naclRuntime;
|
|
18360
18569
|
}
|
|
18361
18570
|
}
|
|
18362
18571
|
});
|
|
@@ -18383,6 +18592,36 @@ var require_videoDecoder2 = __commonJS({
|
|
|
18383
18592
|
}
|
|
18384
18593
|
});
|
|
18385
18594
|
|
|
18595
|
+
// node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/videoElementGeometry.js
|
|
18596
|
+
var require_videoElementGeometry = __commonJS({
|
|
18597
|
+
"node_modules/@signageos/samsung-wasm-decoder/dist/WasmDecoder/videoElementGeometry.js"(exports) {
|
|
18598
|
+
"use strict";
|
|
18599
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18600
|
+
exports.normalizeVideoElementGeometry = normalizeVideoElementGeometry;
|
|
18601
|
+
function normalizeDimension(name, value) {
|
|
18602
|
+
var normalizedValue = Math.floor(value);
|
|
18603
|
+
if (!Number.isFinite(value) || normalizedValue <= 0) {
|
|
18604
|
+
throw new RangeError("".concat(name, " must be a finite positive number."));
|
|
18605
|
+
}
|
|
18606
|
+
return normalizedValue;
|
|
18607
|
+
}
|
|
18608
|
+
function normalizeCoordinate(name, value) {
|
|
18609
|
+
if (!Number.isFinite(value)) {
|
|
18610
|
+
throw new RangeError("".concat(name, " must be a finite number."));
|
|
18611
|
+
}
|
|
18612
|
+
return value;
|
|
18613
|
+
}
|
|
18614
|
+
function normalizeVideoElementGeometry(geometry) {
|
|
18615
|
+
return {
|
|
18616
|
+
x: normalizeCoordinate("x", geometry.x),
|
|
18617
|
+
y: normalizeCoordinate("y", geometry.y),
|
|
18618
|
+
width: normalizeDimension("width", geometry.width),
|
|
18619
|
+
height: normalizeDimension("height", geometry.height)
|
|
18620
|
+
};
|
|
18621
|
+
}
|
|
18622
|
+
}
|
|
18623
|
+
});
|
|
18624
|
+
|
|
18386
18625
|
// node_modules/@signageos/samsung-wasm-decoder/dist/dom/script.js
|
|
18387
18626
|
var require_script = __commonJS({
|
|
18388
18627
|
"node_modules/@signageos/samsung-wasm-decoder/dist/dom/script.js"(exports) {
|
|
@@ -19667,6 +19906,7 @@ var require_wasmDecoder = __commonJS({
|
|
|
19667
19906
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19668
19907
|
exports.SamsungWasmDecoder = void 0;
|
|
19669
19908
|
var videoDecoder_1 = require_videoDecoder2();
|
|
19909
|
+
var videoElementGeometry_1 = require_videoElementGeometry();
|
|
19670
19910
|
var wasmLoader_1 = require_wasmLoader();
|
|
19671
19911
|
var wasmTCP_1 = require_wasmTCP();
|
|
19672
19912
|
function detectKeyFrameAnnexB(bytes) {
|
|
@@ -19697,19 +19937,25 @@ var require_wasmDecoder = __commonJS({
|
|
|
19697
19937
|
}
|
|
19698
19938
|
return false;
|
|
19699
19939
|
}
|
|
19700
|
-
function ensureVideoElement(videoElementId) {
|
|
19940
|
+
function ensureVideoElement(videoElementId, geometry) {
|
|
19941
|
+
var normalizedGeometry = (0, videoElementGeometry_1.normalizeVideoElementGeometry)(geometry !== null && geometry !== void 0 ? geometry : {
|
|
19942
|
+
x: 0,
|
|
19943
|
+
y: 0,
|
|
19944
|
+
width: screen.width,
|
|
19945
|
+
height: screen.height
|
|
19946
|
+
});
|
|
19701
19947
|
var el = document.getElementById(videoElementId);
|
|
19702
19948
|
if (!el) {
|
|
19703
19949
|
el = document.createElement("video");
|
|
19704
19950
|
el.id = videoElementId;
|
|
19705
|
-
el.style.position = "absolute";
|
|
19706
|
-
el.style.top = "0";
|
|
19707
|
-
el.style.left = "0";
|
|
19708
|
-
el.style.width = "1920px";
|
|
19709
|
-
el.style.height = "1080px";
|
|
19710
19951
|
el.style.backgroundColor = "#000";
|
|
19711
19952
|
document.body.appendChild(el);
|
|
19712
19953
|
}
|
|
19954
|
+
el.style.position = "absolute";
|
|
19955
|
+
el.style.top = "".concat(normalizedGeometry.y, "px");
|
|
19956
|
+
el.style.left = "".concat(normalizedGeometry.x, "px");
|
|
19957
|
+
el.style.width = "".concat(normalizedGeometry.width, "px");
|
|
19958
|
+
el.style.height = "".concat(normalizedGeometry.height, "px");
|
|
19713
19959
|
el.autoplay = true;
|
|
19714
19960
|
el.muted = true;
|
|
19715
19961
|
el.playsInline = true;
|
|
@@ -19718,14 +19964,14 @@ var require_wasmDecoder = __commonJS({
|
|
|
19718
19964
|
var SamsungWasmDecoder2 = (
|
|
19719
19965
|
/** @class */
|
|
19720
19966
|
function() {
|
|
19721
|
-
function SamsungWasmDecoder3(videoElementId) {
|
|
19967
|
+
function SamsungWasmDecoder3(videoElementId, geometry) {
|
|
19722
19968
|
this.videoElementId = videoElementId;
|
|
19723
19969
|
this.initialized = false;
|
|
19724
19970
|
this.destroyed = false;
|
|
19725
19971
|
this.decoderHandle = 0;
|
|
19726
19972
|
this.ptsSeconds = 0;
|
|
19727
19973
|
this.frameDurationSeconds = 0;
|
|
19728
|
-
this.videoElement = ensureVideoElement(videoElementId);
|
|
19974
|
+
this.videoElement = ensureVideoElement(videoElementId, geometry);
|
|
19729
19975
|
}
|
|
19730
19976
|
SamsungWasmDecoder3.prototype.destroy = function() {
|
|
19731
19977
|
return __awaiter(this, void 0, void 0, function() {
|
|
@@ -20098,7 +20344,7 @@ var require_dist2 = __commonJS({
|
|
|
20098
20344
|
return [4, (0, wasmLoader_1.loadWasmModule)()];
|
|
20099
20345
|
case 1:
|
|
20100
20346
|
_a.sent();
|
|
20101
|
-
return [2, new wasmDecoder_1.SamsungWasmDecoder(options.videoElementId)];
|
|
20347
|
+
return [2, new wasmDecoder_1.SamsungWasmDecoder(options.videoElementId, options.geometry)];
|
|
20102
20348
|
}
|
|
20103
20349
|
});
|
|
20104
20350
|
});
|
|
@@ -20409,7 +20655,7 @@ var config = {
|
|
|
20409
20655
|
options: {}
|
|
20410
20656
|
};
|
|
20411
20657
|
async function initBrowserFS() {
|
|
20412
|
-
|
|
20658
|
+
installBrowserFSGlobals();
|
|
20413
20659
|
await new Promise((resolve, reject) => {
|
|
20414
20660
|
BrowserFS.configure(config, (error) => {
|
|
20415
20661
|
if (error) {
|
|
@@ -20423,6 +20669,73 @@ async function initBrowserFS() {
|
|
|
20423
20669
|
shim(fs);
|
|
20424
20670
|
return fs;
|
|
20425
20671
|
}
|
|
20672
|
+
var installedBrowserFSRequire;
|
|
20673
|
+
function installBrowserFSGlobals() {
|
|
20674
|
+
const browserFSProcess = BrowserFS.BFSRequire("process");
|
|
20675
|
+
if (!window.process) {
|
|
20676
|
+
Object.defineProperty(window, "process", {
|
|
20677
|
+
configurable: true,
|
|
20678
|
+
enumerable: true,
|
|
20679
|
+
value: {},
|
|
20680
|
+
writable: true
|
|
20681
|
+
});
|
|
20682
|
+
}
|
|
20683
|
+
const processPolyfills = /* @__PURE__ */ new Map([
|
|
20684
|
+
["browser", true],
|
|
20685
|
+
["env", {}],
|
|
20686
|
+
["getuid", browserFSProcess.getuid.bind(browserFSProcess)],
|
|
20687
|
+
["getgid", browserFSProcess.getgid.bind(browserFSProcess)],
|
|
20688
|
+
["geteuid", browserFSProcess.getuid.bind(browserFSProcess)],
|
|
20689
|
+
["getegid", browserFSProcess.getgid.bind(browserFSProcess)],
|
|
20690
|
+
["getgroups", () => {
|
|
20691
|
+
throw createNotImplementedError();
|
|
20692
|
+
}],
|
|
20693
|
+
["pid", browserFSProcess.pid],
|
|
20694
|
+
["ppid", -1],
|
|
20695
|
+
["umask", browserFSProcess.umask.bind(browserFSProcess)],
|
|
20696
|
+
["cwd", browserFSProcess.cwd.bind(browserFSProcess)],
|
|
20697
|
+
["chdir", browserFSProcess.chdir.bind(browserFSProcess)]
|
|
20698
|
+
]);
|
|
20699
|
+
for (const [property, value] of processPolyfills) {
|
|
20700
|
+
if (Reflect.get(window.process, property) === void 0) {
|
|
20701
|
+
Object.defineProperty(window.process, property, {
|
|
20702
|
+
configurable: true,
|
|
20703
|
+
value,
|
|
20704
|
+
writable: true
|
|
20705
|
+
});
|
|
20706
|
+
}
|
|
20707
|
+
}
|
|
20708
|
+
if (!installedBrowserFSRequire) {
|
|
20709
|
+
const previousRequire = window.require;
|
|
20710
|
+
installedBrowserFSRequire = (moduleName) => {
|
|
20711
|
+
const browserFSModule = BrowserFS.BFSRequire(moduleName);
|
|
20712
|
+
if (browserFSModule) {
|
|
20713
|
+
return browserFSModule;
|
|
20714
|
+
}
|
|
20715
|
+
if (previousRequire) {
|
|
20716
|
+
return previousRequire(moduleName);
|
|
20717
|
+
}
|
|
20718
|
+
throw new Error(`Cannot find module '${moduleName}'`);
|
|
20719
|
+
};
|
|
20720
|
+
}
|
|
20721
|
+
Object.defineProperty(window, "Buffer", {
|
|
20722
|
+
configurable: true,
|
|
20723
|
+
enumerable: true,
|
|
20724
|
+
value: BrowserFS.BFSRequire("buffer").Buffer,
|
|
20725
|
+
writable: true
|
|
20726
|
+
});
|
|
20727
|
+
Object.defineProperty(window, "require", {
|
|
20728
|
+
configurable: true,
|
|
20729
|
+
enumerable: true,
|
|
20730
|
+
value: installedBrowserFSRequire,
|
|
20731
|
+
writable: true
|
|
20732
|
+
});
|
|
20733
|
+
}
|
|
20734
|
+
function createNotImplementedError() {
|
|
20735
|
+
const error = new Error("not implemented");
|
|
20736
|
+
Object.defineProperty(error, "code", { value: "ENOSYS" });
|
|
20737
|
+
return error;
|
|
20738
|
+
}
|
|
20426
20739
|
function getStringFlagsByNumber(fs, origFlags) {
|
|
20427
20740
|
if ((origFlags & (fs.constants.O_APPEND | fs.constants.O_CREAT)) !== 0) {
|
|
20428
20741
|
return "a";
|
|
@@ -20643,7 +20956,7 @@ async function initSamsungWasmTCP() {
|
|
|
20643
20956
|
}
|
|
20644
20957
|
|
|
20645
20958
|
// daemon/plain.ts
|
|
20646
|
-
var DAEMON_JS_URL = "supra-client-daemon.js?v=1.0.0-
|
|
20959
|
+
var DAEMON_JS_URL = "supra-client-daemon.js?v=1.0.0-tsfixstreamgeometrypanic.474";
|
|
20647
20960
|
async function startPlainDaemon() {
|
|
20648
20961
|
await initNaClTCP();
|
|
20649
20962
|
await initSamsungWasmTCP();
|
|
@@ -20656,7 +20969,7 @@ async function startPlainDaemon() {
|
|
|
20656
20969
|
}
|
|
20657
20970
|
|
|
20658
20971
|
// daemon/wasm.ts
|
|
20659
|
-
var DAEMON_WASM_URL = "supra-client-daemon.wasm?v=1.0.0-
|
|
20972
|
+
var DAEMON_WASM_URL = "supra-client-daemon.wasm?v=1.0.0-tsfixstreamgeometrypanic.474";
|
|
20660
20973
|
async function startWasmDaemon() {
|
|
20661
20974
|
await initNaClTCP();
|
|
20662
20975
|
await initSamsungWasmTCP();
|
|
@@ -20678,9 +20991,13 @@ function getGoArgv() {
|
|
|
20678
20991
|
|
|
20679
20992
|
// screen/nacldecoder.ts
|
|
20680
20993
|
var import_nacl_decoder2 = __toESM(require_dist());
|
|
20681
|
-
function initNaCLDecoder() {
|
|
20994
|
+
function initNaCLDecoder(options) {
|
|
20682
20995
|
if ((0, import_nacl_decoder2.isNaClSupported)()) {
|
|
20683
|
-
|
|
20996
|
+
const geometry = options == null ? void 0 : options.geometry;
|
|
20997
|
+
window.createNaClDecoder = (decoderOptions) => {
|
|
20998
|
+
const optionsWithGeometry = { geometry, ...decoderOptions };
|
|
20999
|
+
return (0, import_nacl_decoder2.createNaClDecoder)(optionsWithGeometry);
|
|
21000
|
+
};
|
|
20684
21001
|
}
|
|
20685
21002
|
}
|
|
20686
21003
|
|
|
@@ -20845,6 +21162,10 @@ self.onmessage = function(event) {
|
|
|
20845
21162
|
self.postMessage({ type: 'write', id: message.id, bytes: message.data.byteLength });
|
|
20846
21163
|
} else if (message.type === 'close') {
|
|
20847
21164
|
closed = true;
|
|
21165
|
+
if (pendingRead) {
|
|
21166
|
+
postError(pendingRead, 'WebSocket closed');
|
|
21167
|
+
pendingRead = null;
|
|
21168
|
+
}
|
|
20848
21169
|
if (socket) {
|
|
20849
21170
|
socket.close(1000, 'Closed by client');
|
|
20850
21171
|
}
|
|
@@ -20911,8 +21232,13 @@ var createSupraFrameWorkerConnection = (url) => {
|
|
|
20911
21232
|
write: (data) => ready.then(() => request("write", { data }, [data])),
|
|
20912
21233
|
close: async () => {
|
|
20913
21234
|
await ready.catch(() => void 0);
|
|
20914
|
-
|
|
20915
|
-
|
|
21235
|
+
try {
|
|
21236
|
+
await request("close");
|
|
21237
|
+
} finally {
|
|
21238
|
+
pending.forEach(({ reject }) => reject(new Error("WebSocket worker closed")));
|
|
21239
|
+
pending.clear();
|
|
21240
|
+
worker.terminate();
|
|
21241
|
+
}
|
|
20916
21242
|
}
|
|
20917
21243
|
};
|
|
20918
21244
|
};
|
|
@@ -20928,14 +21254,41 @@ var import_samsung_wasm_decoder2 = __toESM(require_dist2());
|
|
|
20928
21254
|
var import_videoDecoder = __toESM(require_videoDecoder2());
|
|
20929
21255
|
async function initSamsungWasmDecoder(options) {
|
|
20930
21256
|
if ((0, import_samsung_wasm_decoder2.isSamsungWasmSupported)()) {
|
|
20931
|
-
|
|
20932
|
-
videoElementId: "samsung-wasm-video"
|
|
20933
|
-
|
|
21257
|
+
const decoderOptions = {
|
|
21258
|
+
videoElementId: "samsung-wasm-video",
|
|
21259
|
+
geometry: options.geometry
|
|
21260
|
+
};
|
|
21261
|
+
window.samsungWasmDecoder = await (0, import_samsung_wasm_decoder2.createSamsungWasmDecoder)(decoderOptions);
|
|
20934
21262
|
const latencyMode = options.interactive ? import_videoDecoder.LatencyMode.UltraLow : import_videoDecoder.LatencyMode.Low;
|
|
20935
21263
|
await window.samsungWasmDecoder.initialize({ latencyMode });
|
|
20936
21264
|
}
|
|
20937
21265
|
}
|
|
20938
21266
|
|
|
21267
|
+
// screen/options.ts
|
|
21268
|
+
var MIN_GEOMETRY_COORDINATE = -2147483648;
|
|
21269
|
+
var MAX_GEOMETRY_VALUE = 2147483647;
|
|
21270
|
+
function normalizeGeometry(geometry) {
|
|
21271
|
+
if (geometry === void 0) {
|
|
21272
|
+
return void 0;
|
|
21273
|
+
}
|
|
21274
|
+
if (!Number.isFinite(geometry.x) || !Number.isFinite(geometry.y)) {
|
|
21275
|
+
throw new RangeError("Geometry x and y must be finite CSS pixel coordinates");
|
|
21276
|
+
}
|
|
21277
|
+
const x = Math.floor(geometry.x);
|
|
21278
|
+
const y = Math.floor(geometry.y);
|
|
21279
|
+
const width = Math.floor(geometry.width);
|
|
21280
|
+
const height = Math.floor(geometry.height);
|
|
21281
|
+
if (x < MIN_GEOMETRY_COORDINATE || x > MAX_GEOMETRY_VALUE || y < MIN_GEOMETRY_COORDINATE || y > MAX_GEOMETRY_VALUE) {
|
|
21282
|
+
throw new RangeError("Geometry x and y must fit signed 32-bit CSS pixel coordinates");
|
|
21283
|
+
}
|
|
21284
|
+
if (!Number.isFinite(geometry.width) || !Number.isFinite(geometry.height) || width < 1 || height < 1 || width > MAX_GEOMETRY_VALUE || height > MAX_GEOMETRY_VALUE) {
|
|
21285
|
+
throw new RangeError(
|
|
21286
|
+
"Geometry width and height must floor to positive signed 32-bit CSS pixels"
|
|
21287
|
+
);
|
|
21288
|
+
}
|
|
21289
|
+
return { x, y, width, height };
|
|
21290
|
+
}
|
|
21291
|
+
|
|
20939
21292
|
// screen/shared.ts
|
|
20940
21293
|
var import_querystring = __toESM(require_querystring());
|
|
20941
21294
|
function parseQueryOptions() {
|
|
@@ -20985,6 +21338,21 @@ function parseQueryOptions() {
|
|
|
20985
21338
|
}
|
|
20986
21339
|
options.forceScreenSize = { width, height };
|
|
20987
21340
|
}
|
|
21341
|
+
if (typeof params.geometry === "string" && params.geometry !== "") {
|
|
21342
|
+
const geometryParts = params.geometry.split(",");
|
|
21343
|
+
if (geometryParts.length !== 4) {
|
|
21344
|
+
throw new Error(`Invalid geometry query param, expected "x,y,width,height"`);
|
|
21345
|
+
}
|
|
21346
|
+
const [x, y, width, height] = geometryParts.map(Number);
|
|
21347
|
+
if (!Number.isFinite(x) || !Number.isFinite(y)) {
|
|
21348
|
+
throw new Error(`Invalid geometry query param`);
|
|
21349
|
+
}
|
|
21350
|
+
try {
|
|
21351
|
+
options.geometry = normalizeGeometry({ x, y, width, height });
|
|
21352
|
+
} catch {
|
|
21353
|
+
throw new Error(`Invalid geometry query param`);
|
|
21354
|
+
}
|
|
21355
|
+
}
|
|
20988
21356
|
const encodingPreferences = {};
|
|
20989
21357
|
if (params.preferredPreset) {
|
|
20990
21358
|
encodingPreferences.preferredPreset = params.preferredPreset;
|
|
@@ -21019,15 +21387,18 @@ function getGoArgv2(binFile, options) {
|
|
|
21019
21387
|
options.clientSecret,
|
|
21020
21388
|
options.secure ? "1" : "0",
|
|
21021
21389
|
options.forceScreenSize ? `${options.forceScreenSize.width}x${options.forceScreenSize.height}` : "",
|
|
21022
|
-
encodingPrefsJson
|
|
21390
|
+
encodingPrefsJson,
|
|
21391
|
+
options.geometry ? JSON.stringify(normalizeGeometry(options.geometry)) : ""
|
|
21023
21392
|
];
|
|
21024
21393
|
}
|
|
21025
21394
|
|
|
21026
21395
|
// screen/plain.ts
|
|
21027
|
-
var SCREEN_JS_URL = "supra-client-screen.js?v=1.0.0-
|
|
21396
|
+
var SCREEN_JS_URL = "supra-client-screen.js?v=1.0.0-tsfixstreamgeometrypanic.474";
|
|
21028
21397
|
async function startPlainScreen(options) {
|
|
21398
|
+
console.log("[Supra screen plain] initialization begin");
|
|
21029
21399
|
options = options != null ? options : parseQueryOptions();
|
|
21030
|
-
|
|
21400
|
+
options = { ...options, geometry: normalizeGeometry(options.geometry) };
|
|
21401
|
+
initNaCLDecoder(options);
|
|
21031
21402
|
initWorkerFrameConnection(options.netInWorker === true);
|
|
21032
21403
|
await initNaClTCP();
|
|
21033
21404
|
await initSamsungWasmTCP();
|
|
@@ -21036,8 +21407,19 @@ async function startPlainScreen(options) {
|
|
|
21036
21407
|
window.fs = fs;
|
|
21037
21408
|
process.argv = ["go", ...getGoArgv2(SCREEN_JS_URL, options)];
|
|
21038
21409
|
Object.assign(process.env, getGoEnv());
|
|
21410
|
+
console.log("[Supra screen plain] script injection begin");
|
|
21039
21411
|
await injectScript(SCREEN_JS_URL);
|
|
21040
|
-
|
|
21412
|
+
console.log("[Supra screen plain] script injection complete; waiting for close");
|
|
21413
|
+
await new Promise((resolve) => {
|
|
21414
|
+
const interval = setInterval(() => {
|
|
21415
|
+
var _a;
|
|
21416
|
+
if (((_a = window.__supra) == null ? void 0 : _a.screenStopCompleted) === true) {
|
|
21417
|
+
clearInterval(interval);
|
|
21418
|
+
console.log("[Supra screen plain] lifecycle complete");
|
|
21419
|
+
resolve();
|
|
21420
|
+
}
|
|
21421
|
+
}, 500);
|
|
21422
|
+
});
|
|
21041
21423
|
}
|
|
21042
21424
|
|
|
21043
21425
|
// screen/h264decoder.ts
|
|
@@ -21054,23 +21436,57 @@ async function createH264Decoder() {
|
|
|
21054
21436
|
}
|
|
21055
21437
|
|
|
21056
21438
|
// screen/wasm.ts
|
|
21057
|
-
var SCREEN_WASM_URL = "supra-client-screen.wasm?v=1.0.0-
|
|
21439
|
+
var SCREEN_WASM_URL = "supra-client-screen.wasm?v=1.0.0-tsfixstreamgeometrypanic.474";
|
|
21440
|
+
async function initializePhase(name, initialize) {
|
|
21441
|
+
const startedAt = Date.now();
|
|
21442
|
+
console.log(`[Supra screen WASM] ${name} begin`);
|
|
21443
|
+
try {
|
|
21444
|
+
const result = await initialize();
|
|
21445
|
+
console.log(`[Supra screen WASM] ${name} complete`, {
|
|
21446
|
+
durationMs: Date.now() - startedAt
|
|
21447
|
+
});
|
|
21448
|
+
return result;
|
|
21449
|
+
} catch (error) {
|
|
21450
|
+
console.error(`[Supra screen WASM] ${name} failed`, {
|
|
21451
|
+
durationMs: Date.now() - startedAt,
|
|
21452
|
+
error
|
|
21453
|
+
});
|
|
21454
|
+
throw error;
|
|
21455
|
+
}
|
|
21456
|
+
}
|
|
21058
21457
|
async function startWasmScreen(options) {
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
|
|
21062
|
-
|
|
21063
|
-
|
|
21064
|
-
await
|
|
21065
|
-
|
|
21458
|
+
console.log("[Supra screen WASM] initialization begin");
|
|
21459
|
+
const initializedOptions = await initializePhase("options initialization", () => {
|
|
21460
|
+
const parsedOptions = options != null ? options : parseQueryOptions();
|
|
21461
|
+
return { ...parsedOptions, geometry: normalizeGeometry(parsedOptions.geometry) };
|
|
21462
|
+
});
|
|
21463
|
+
await initializePhase(
|
|
21464
|
+
"worker frame connection initialization",
|
|
21465
|
+
() => initWorkerFrameConnection(initializedOptions.netInWorker === true)
|
|
21466
|
+
);
|
|
21467
|
+
await initializePhase("Samsung WASM TCP initialization", initSamsungWasmTCP);
|
|
21468
|
+
await initializePhase("Samsung WASM decoder initialization", () => initSamsungWasmDecoder(initializedOptions));
|
|
21469
|
+
await initializePhase("H264 decoder initialization", initH264Decoder);
|
|
21470
|
+
await initializePhase("Go environment initialization", initGoEnvironment);
|
|
21471
|
+
console.log("[Supra screen WASM] initialization complete");
|
|
21472
|
+
await startGoScreen(initializedOptions);
|
|
21473
|
+
console.log("[Supra screen WASM] lifecycle complete");
|
|
21066
21474
|
}
|
|
21067
21475
|
async function startGoScreen(options) {
|
|
21476
|
+
console.log("[Supra screen WASM] instantiate begin");
|
|
21068
21477
|
const go = new window.Go();
|
|
21069
21478
|
go.h264 = window.h264Decoder.memory;
|
|
21070
21479
|
const result = await WebAssembly.instantiateStreaming(fetch(SCREEN_WASM_URL), go.importObject);
|
|
21480
|
+
console.log("[Supra screen WASM] instantiate complete");
|
|
21071
21481
|
go.env = getGoEnv();
|
|
21072
21482
|
go.argv = getGoArgv2(SCREEN_WASM_URL, options);
|
|
21483
|
+
if (window.__supra) {
|
|
21484
|
+
window.__supra.screenStopped = false;
|
|
21485
|
+
window.__supra.screenStopCompleted = false;
|
|
21486
|
+
}
|
|
21487
|
+
console.log("[Supra screen WASM] Go run begin");
|
|
21073
21488
|
await go.run(result.instance);
|
|
21489
|
+
console.log("[Supra screen WASM] Go run complete");
|
|
21074
21490
|
}
|
|
21075
21491
|
|
|
21076
21492
|
// screen/control.ts
|
|
@@ -21078,7 +21494,7 @@ function createScreenControl(initialPreferences) {
|
|
|
21078
21494
|
let currentPreferences = { ...initialPreferences };
|
|
21079
21495
|
function pushToGoBridge(prefs) {
|
|
21080
21496
|
var _a;
|
|
21081
|
-
if (typeof window !== "undefined" && ((_a = window.__supra) == null ? void 0 : _a.setEncodingPreferences)) {
|
|
21497
|
+
if (typeof window !== "undefined" && ((_a = window.__supra) == null ? void 0 : _a.setEncodingPreferences) && !window.__supra.screenStopCompleted) {
|
|
21082
21498
|
window.__supra.setEncodingPreferences(JSON.stringify(prefs));
|
|
21083
21499
|
}
|
|
21084
21500
|
}
|
|
@@ -21092,18 +21508,39 @@ function createScreenControl(initialPreferences) {
|
|
|
21092
21508
|
},
|
|
21093
21509
|
getCurrentStats() {
|
|
21094
21510
|
var _a;
|
|
21095
|
-
if (typeof window === "undefined" || !((_a = window.__supra) == null ? void 0 : _a.getCurrentStats)) {
|
|
21096
|
-
return null;
|
|
21097
|
-
}
|
|
21098
|
-
const json = window.__supra.getCurrentStats();
|
|
21099
|
-
if (!json) {
|
|
21511
|
+
if (typeof window === "undefined" || !((_a = window.__supra) == null ? void 0 : _a.getCurrentStats) || window.__supra.screenStopped || window.__supra.screenStopCompleted) {
|
|
21100
21512
|
return null;
|
|
21101
21513
|
}
|
|
21102
21514
|
try {
|
|
21515
|
+
const json = window.__supra.getCurrentStats();
|
|
21516
|
+
if (!json) {
|
|
21517
|
+
return null;
|
|
21518
|
+
}
|
|
21103
21519
|
return JSON.parse(json);
|
|
21104
21520
|
} catch {
|
|
21105
21521
|
return null;
|
|
21106
21522
|
}
|
|
21523
|
+
},
|
|
21524
|
+
stop() {
|
|
21525
|
+
var _a;
|
|
21526
|
+
if (typeof window === "undefined" || !((_a = window.__supra) == null ? void 0 : _a.stopScreen)) {
|
|
21527
|
+
console.log("[Supra screen control] stop bridge unavailable", {
|
|
21528
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
21529
|
+
});
|
|
21530
|
+
return false;
|
|
21531
|
+
}
|
|
21532
|
+
console.log("[Supra screen control] invoking stop bridge", {
|
|
21533
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
21534
|
+
screenStopped: window.__supra.screenStopped,
|
|
21535
|
+
screenStopCompleted: window.__supra.screenStopCompleted
|
|
21536
|
+
});
|
|
21537
|
+
window.__supra.stopScreen();
|
|
21538
|
+
console.log("[Supra screen control] stop bridge returned", {
|
|
21539
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
21540
|
+
screenStopped: window.__supra.screenStopped,
|
|
21541
|
+
screenStopCompleted: window.__supra.screenStopCompleted
|
|
21542
|
+
});
|
|
21543
|
+
return true;
|
|
21107
21544
|
}
|
|
21108
21545
|
};
|
|
21109
21546
|
}
|