@supraio/client-daemon-js 1.0.0-mzbrightsigndecoder.473 → 1.0.0-mzbrightsigndecoder.478
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 +609 -38
- package/daemon.js.map +3 -3
- package/package.json +3 -3
- package/screen/options.d.ts +1 -0
- package/screen.html +1 -1
- package/screen.js +667 -47
- package/screen.js.map +4 -4
- package/sdk.js +658 -47
- package/sdk.js.map +4 -4
- package/supra-client-daemon.js +80 -63
- package/supra-client-daemon.js.map +1 -1
- package/supra-client-daemon.wasm +0 -0
- package/supra-client-screen.js +427 -338
- package/supra-client-screen.js.map +1 -1
- package/supra-client-screen.wasm +0 -0
package/sdk.js
CHANGED
|
@@ -19505,13 +19505,13 @@ var require_PlaybackSession = __commonJS({
|
|
|
19505
19505
|
}
|
|
19506
19506
|
}
|
|
19507
19507
|
/** Start native playback at the given URI and coordinates. */
|
|
19508
|
-
async start(uri, coords, options = {}) {
|
|
19508
|
+
async start(uri, coords, protocol, options = {}) {
|
|
19509
19509
|
if (this.playing) {
|
|
19510
19510
|
await this.stop();
|
|
19511
19511
|
}
|
|
19512
19512
|
this.uri = uri;
|
|
19513
19513
|
this.coordinates = coords;
|
|
19514
|
-
await this.bridge.play(uri, coords.x, coords.y, coords.width, coords.height, { protocol
|
|
19514
|
+
await this.bridge.play(uri, coords.x, coords.y, coords.width, coords.height, { protocol, ...options });
|
|
19515
19515
|
this.playing = true;
|
|
19516
19516
|
}
|
|
19517
19517
|
/**
|
|
@@ -19539,6 +19539,438 @@ var require_PlaybackSession = __commonJS({
|
|
|
19539
19539
|
}
|
|
19540
19540
|
});
|
|
19541
19541
|
|
|
19542
|
+
// node_modules/@signageos/brightsign-decoder/dist/decoder/NativeUdpSender.js
|
|
19543
|
+
var require_NativeUdpSender = __commonJS({
|
|
19544
|
+
"node_modules/@signageos/brightsign-decoder/dist/decoder/NativeUdpSender.js"(exports) {
|
|
19545
|
+
"use strict";
|
|
19546
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19547
|
+
exports.NativeUdpSender = exports.NativeUdpPreWriteError = void 0;
|
|
19548
|
+
var TS_PACKET_SIZE = 188;
|
|
19549
|
+
var DEFAULT_MAX_DATAGRAM_BYTES = 7 * TS_PACKET_SIZE;
|
|
19550
|
+
var DEFAULT_STARTUP_REPEAT_COUNT = 3;
|
|
19551
|
+
var DEFAULT_STARTUP_REPEAT_INTERVAL_MS = 20;
|
|
19552
|
+
var NativeUdpPreWriteError = class extends Error {
|
|
19553
|
+
constructor(message) {
|
|
19554
|
+
super(message);
|
|
19555
|
+
this.name = "NativeUdpPreWriteError";
|
|
19556
|
+
}
|
|
19557
|
+
};
|
|
19558
|
+
exports.NativeUdpPreWriteError = NativeUdpPreWriteError;
|
|
19559
|
+
var NativeUdpSender = class {
|
|
19560
|
+
constructor(options) {
|
|
19561
|
+
var _a, _b, _c;
|
|
19562
|
+
this.pendingWarmupDelays = /* @__PURE__ */ new Set();
|
|
19563
|
+
this.writeChain = Promise.resolve();
|
|
19564
|
+
this.sourcePort = 0;
|
|
19565
|
+
this.destinationPort = 0;
|
|
19566
|
+
this.datagramsSent = 0;
|
|
19567
|
+
this.bytesSent = 0;
|
|
19568
|
+
this.accessUnitsSent = 0;
|
|
19569
|
+
this.warmupAccessUnits = 0;
|
|
19570
|
+
this.warmupRepeats = 0;
|
|
19571
|
+
this.socketErrors = 0;
|
|
19572
|
+
this.sendErrors = 0;
|
|
19573
|
+
this.destroyed = false;
|
|
19574
|
+
this.teardownComplete = false;
|
|
19575
|
+
this.maxDatagramBytes = (_a = options == null ? void 0 : options.maxDatagramBytes) != null ? _a : DEFAULT_MAX_DATAGRAM_BYTES;
|
|
19576
|
+
this.maxPacketsPerDatagram = Math.floor(this.maxDatagramBytes / TS_PACKET_SIZE);
|
|
19577
|
+
this.startupRepeatCount = (_b = options == null ? void 0 : options.startupRepeatCount) != null ? _b : DEFAULT_STARTUP_REPEAT_COUNT;
|
|
19578
|
+
this.startupRepeatIntervalMs = (_c = options == null ? void 0 : options.startupRepeatIntervalMs) != null ? _c : DEFAULT_STARTUP_REPEAT_INTERVAL_MS;
|
|
19579
|
+
if (!Number.isSafeInteger(this.maxDatagramBytes) || this.maxDatagramBytes < TS_PACKET_SIZE) {
|
|
19580
|
+
throw new RangeError("maxDatagramBytes must be an integer greater than or equal to one TS packet");
|
|
19581
|
+
}
|
|
19582
|
+
if (this.maxPacketsPerDatagram <= 0) {
|
|
19583
|
+
throw new RangeError("maxDatagramBytes must allow at least one 188-byte TS packet");
|
|
19584
|
+
}
|
|
19585
|
+
if (!Number.isSafeInteger(this.startupRepeatCount) || this.startupRepeatCount <= 0) {
|
|
19586
|
+
throw new RangeError("startupRepeatCount must be a positive integer");
|
|
19587
|
+
}
|
|
19588
|
+
if (!Number.isFinite(this.startupRepeatIntervalMs) || this.startupRepeatIntervalMs < 0) {
|
|
19589
|
+
throw new RangeError("startupRepeatIntervalMs must be a finite non-negative number");
|
|
19590
|
+
}
|
|
19591
|
+
}
|
|
19592
|
+
async start(dgramModule) {
|
|
19593
|
+
if (this.destroyed) {
|
|
19594
|
+
throw new Error("NativeUdpSender has been destroyed");
|
|
19595
|
+
}
|
|
19596
|
+
if (this.socket !== void 0 || this.destinationSocket !== void 0) {
|
|
19597
|
+
throw new Error("NativeUdpSender is already started");
|
|
19598
|
+
}
|
|
19599
|
+
let destinationSocket;
|
|
19600
|
+
let socket;
|
|
19601
|
+
try {
|
|
19602
|
+
destinationSocket = narrowToDgramSocketLike(dgramModule.createSocket("udp4"));
|
|
19603
|
+
destinationSocket.on("error", (value) => {
|
|
19604
|
+
this.socketErrors += 1;
|
|
19605
|
+
if (!this.destroyed && this.socketFailure === void 0) {
|
|
19606
|
+
this.socketFailure = toError(value, "Loopback UDP destination reservation error");
|
|
19607
|
+
}
|
|
19608
|
+
});
|
|
19609
|
+
await bindDgramSocket(destinationSocket, 0, "127.0.0.1");
|
|
19610
|
+
const destinationAddress = destinationSocket.address();
|
|
19611
|
+
if (typeof destinationAddress !== "object" || destinationAddress === null || !Number.isInteger(destinationAddress.port)) {
|
|
19612
|
+
throw new Error("Loopback UDP reservation did not report a bound destination port");
|
|
19613
|
+
}
|
|
19614
|
+
socket = narrowToDgramSocketLike(dgramModule.createSocket("udp4"));
|
|
19615
|
+
socket.on("error", (value) => {
|
|
19616
|
+
this.socketErrors += 1;
|
|
19617
|
+
if (!this.destroyed && this.socketFailure === void 0) {
|
|
19618
|
+
this.socketFailure = toError(value, "Loopback UDP sender socket error");
|
|
19619
|
+
}
|
|
19620
|
+
});
|
|
19621
|
+
await bindDgramSocket(socket, 0, "127.0.0.1");
|
|
19622
|
+
if (this.destroyed) {
|
|
19623
|
+
throw new Error("NativeUdpSender was destroyed during initialization");
|
|
19624
|
+
}
|
|
19625
|
+
const address = socket.address();
|
|
19626
|
+
if (typeof address !== "object" || address === null || !Number.isInteger(address.port)) {
|
|
19627
|
+
throw new Error("Loopback UDP sender did not report a bound source port");
|
|
19628
|
+
}
|
|
19629
|
+
this.destinationSocket = destinationSocket;
|
|
19630
|
+
this.socket = socket;
|
|
19631
|
+
this.sourcePort = address.port;
|
|
19632
|
+
this.destinationPort = destinationAddress.port;
|
|
19633
|
+
return this.destinationPort;
|
|
19634
|
+
} catch (error) {
|
|
19635
|
+
if (socket !== void 0) {
|
|
19636
|
+
await closeDgramSocket(socket);
|
|
19637
|
+
}
|
|
19638
|
+
if (destinationSocket !== void 0) {
|
|
19639
|
+
await closeDgramSocket(destinationSocket);
|
|
19640
|
+
}
|
|
19641
|
+
this.sourcePort = 0;
|
|
19642
|
+
this.destinationPort = 0;
|
|
19643
|
+
throw toError(error, "Loopback UDP sender creation failed");
|
|
19644
|
+
}
|
|
19645
|
+
}
|
|
19646
|
+
getDiagnostics() {
|
|
19647
|
+
return {
|
|
19648
|
+
sourcePort: this.sourcePort,
|
|
19649
|
+
destinationPort: this.destinationPort,
|
|
19650
|
+
destinationReserved: this.destinationSocket !== void 0,
|
|
19651
|
+
datagramsSent: this.datagramsSent,
|
|
19652
|
+
bytesSent: this.bytesSent,
|
|
19653
|
+
accessUnitsSent: this.accessUnitsSent,
|
|
19654
|
+
warmupAccessUnits: this.warmupAccessUnits,
|
|
19655
|
+
warmupRepeats: this.warmupRepeats,
|
|
19656
|
+
pendingWarmupDelays: this.pendingWarmupDelays.size,
|
|
19657
|
+
socketErrors: this.socketErrors,
|
|
19658
|
+
sendErrors: this.sendErrors
|
|
19659
|
+
};
|
|
19660
|
+
}
|
|
19661
|
+
async writeAccessUnit(packets) {
|
|
19662
|
+
if (packets.length === 0) {
|
|
19663
|
+
return;
|
|
19664
|
+
}
|
|
19665
|
+
await this.enqueueWrite(async () => {
|
|
19666
|
+
const datagrams = buildDatagrams(packets, this.maxPacketsPerDatagram);
|
|
19667
|
+
await this.performDatagramBurst(datagrams);
|
|
19668
|
+
this.accessUnitsSent += 1;
|
|
19669
|
+
});
|
|
19670
|
+
}
|
|
19671
|
+
async releaseDestinationReservation() {
|
|
19672
|
+
const destinationSocket = this.destinationSocket;
|
|
19673
|
+
if (destinationSocket === void 0) {
|
|
19674
|
+
if (this.destinationPort === 0) {
|
|
19675
|
+
throw new Error("NativeUdpSender is not started");
|
|
19676
|
+
}
|
|
19677
|
+
return;
|
|
19678
|
+
}
|
|
19679
|
+
await closeDgramSocket(destinationSocket);
|
|
19680
|
+
this.destinationSocket = void 0;
|
|
19681
|
+
}
|
|
19682
|
+
async warmupAccessUnit(packets) {
|
|
19683
|
+
if (packets.length === 0) {
|
|
19684
|
+
return;
|
|
19685
|
+
}
|
|
19686
|
+
await this.enqueueWrite(async () => {
|
|
19687
|
+
const datagrams = buildDatagrams(packets, this.maxPacketsPerDatagram);
|
|
19688
|
+
let sentDatagrams = 0;
|
|
19689
|
+
for (let attempt = 0; attempt < this.startupRepeatCount; attempt += 1) {
|
|
19690
|
+
if (this.destroyed) {
|
|
19691
|
+
return;
|
|
19692
|
+
}
|
|
19693
|
+
try {
|
|
19694
|
+
sentDatagrams += await this.performDatagramBurst(datagrams);
|
|
19695
|
+
this.warmupRepeats += 1;
|
|
19696
|
+
} catch (error) {
|
|
19697
|
+
const normalized = toError(error, "Loopback UDP startup warmup failed");
|
|
19698
|
+
if (sentDatagrams === 0) {
|
|
19699
|
+
if (normalized instanceof NativeUdpPreWriteError) {
|
|
19700
|
+
throw normalized;
|
|
19701
|
+
}
|
|
19702
|
+
throw new NativeUdpPreWriteError(normalized.message);
|
|
19703
|
+
}
|
|
19704
|
+
throw normalized;
|
|
19705
|
+
}
|
|
19706
|
+
if (attempt + 1 < this.startupRepeatCount) {
|
|
19707
|
+
await this.waitWarmupInterval();
|
|
19708
|
+
}
|
|
19709
|
+
}
|
|
19710
|
+
this.warmupAccessUnits += 1;
|
|
19711
|
+
});
|
|
19712
|
+
}
|
|
19713
|
+
get uri() {
|
|
19714
|
+
if (this.destinationPort === 0) {
|
|
19715
|
+
throw new Error("NativeUdpSender is not started");
|
|
19716
|
+
}
|
|
19717
|
+
return `udp://127.0.0.1:${this.destinationPort}`;
|
|
19718
|
+
}
|
|
19719
|
+
destroy() {
|
|
19720
|
+
if (this.teardownComplete) {
|
|
19721
|
+
return Promise.resolve();
|
|
19722
|
+
}
|
|
19723
|
+
if (this.teardown !== void 0) {
|
|
19724
|
+
return this.teardown;
|
|
19725
|
+
}
|
|
19726
|
+
this.destroyed = true;
|
|
19727
|
+
for (const pending of this.pendingWarmupDelays) {
|
|
19728
|
+
clearTimeout(pending.timer);
|
|
19729
|
+
pending.resolve();
|
|
19730
|
+
}
|
|
19731
|
+
this.pendingWarmupDelays.clear();
|
|
19732
|
+
const attempt = this.performTeardown();
|
|
19733
|
+
const promise = attempt.then(() => {
|
|
19734
|
+
this.teardownComplete = true;
|
|
19735
|
+
}, (error) => {
|
|
19736
|
+
if (this.teardown === promise) {
|
|
19737
|
+
this.teardown = void 0;
|
|
19738
|
+
}
|
|
19739
|
+
throw error;
|
|
19740
|
+
});
|
|
19741
|
+
this.teardown = promise;
|
|
19742
|
+
return promise;
|
|
19743
|
+
}
|
|
19744
|
+
async performTeardown() {
|
|
19745
|
+
await this.writeChain;
|
|
19746
|
+
const destinationSocket = this.destinationSocket;
|
|
19747
|
+
if (destinationSocket !== void 0) {
|
|
19748
|
+
await closeDgramSocket(destinationSocket);
|
|
19749
|
+
this.destinationSocket = void 0;
|
|
19750
|
+
}
|
|
19751
|
+
const socket = this.socket;
|
|
19752
|
+
if (socket !== void 0) {
|
|
19753
|
+
await closeDgramSocket(socket);
|
|
19754
|
+
this.socket = void 0;
|
|
19755
|
+
}
|
|
19756
|
+
this.sourcePort = 0;
|
|
19757
|
+
this.destinationPort = 0;
|
|
19758
|
+
}
|
|
19759
|
+
enqueueWrite(operation) {
|
|
19760
|
+
const next = this.writeChain.then(operation);
|
|
19761
|
+
this.writeChain = next.catch(() => void 0);
|
|
19762
|
+
return next;
|
|
19763
|
+
}
|
|
19764
|
+
async performDatagramBurst(datagrams) {
|
|
19765
|
+
if (this.destroyed) {
|
|
19766
|
+
return 0;
|
|
19767
|
+
}
|
|
19768
|
+
const socket = this.socket;
|
|
19769
|
+
if (socket === void 0) {
|
|
19770
|
+
throw new NativeUdpPreWriteError("NativeUdpSender is not started");
|
|
19771
|
+
}
|
|
19772
|
+
const initialSocketFailure = this.getSocketFailure();
|
|
19773
|
+
if (initialSocketFailure !== void 0) {
|
|
19774
|
+
throw new NativeUdpPreWriteError(initialSocketFailure.message);
|
|
19775
|
+
}
|
|
19776
|
+
let sent = 0;
|
|
19777
|
+
for (const datagram of datagrams) {
|
|
19778
|
+
if (this.destroyed) {
|
|
19779
|
+
return sent;
|
|
19780
|
+
}
|
|
19781
|
+
const socketFailure = this.getSocketFailure();
|
|
19782
|
+
if (socketFailure !== void 0) {
|
|
19783
|
+
if (sent === 0) {
|
|
19784
|
+
throw new NativeUdpPreWriteError(socketFailure.message);
|
|
19785
|
+
}
|
|
19786
|
+
throw socketFailure;
|
|
19787
|
+
}
|
|
19788
|
+
try {
|
|
19789
|
+
await sendDatagram(socket, datagram, this.destinationPort, () => this.destroyed);
|
|
19790
|
+
if (this.destroyed) {
|
|
19791
|
+
return sent;
|
|
19792
|
+
}
|
|
19793
|
+
this.datagramsSent += 1;
|
|
19794
|
+
this.bytesSent += datagram.byteLength;
|
|
19795
|
+
sent += 1;
|
|
19796
|
+
} catch (error) {
|
|
19797
|
+
const normalized = toError(error, "Loopback UDP datagram send failed");
|
|
19798
|
+
this.sendErrors += 1;
|
|
19799
|
+
if (this.destroyed) {
|
|
19800
|
+
return sent;
|
|
19801
|
+
}
|
|
19802
|
+
if (sent === 0) {
|
|
19803
|
+
throw new NativeUdpPreWriteError(normalized.message);
|
|
19804
|
+
}
|
|
19805
|
+
throw normalized;
|
|
19806
|
+
}
|
|
19807
|
+
}
|
|
19808
|
+
return sent;
|
|
19809
|
+
}
|
|
19810
|
+
async waitWarmupInterval() {
|
|
19811
|
+
if (this.destroyed || this.startupRepeatIntervalMs === 0) {
|
|
19812
|
+
return;
|
|
19813
|
+
}
|
|
19814
|
+
await new Promise((resolve) => {
|
|
19815
|
+
const timer = setTimeout(() => {
|
|
19816
|
+
this.pendingWarmupDelays.delete(pending);
|
|
19817
|
+
resolve();
|
|
19818
|
+
}, this.startupRepeatIntervalMs);
|
|
19819
|
+
const pending = {
|
|
19820
|
+
timer,
|
|
19821
|
+
resolve: () => {
|
|
19822
|
+
this.pendingWarmupDelays.delete(pending);
|
|
19823
|
+
resolve();
|
|
19824
|
+
}
|
|
19825
|
+
};
|
|
19826
|
+
this.pendingWarmupDelays.add(pending);
|
|
19827
|
+
});
|
|
19828
|
+
}
|
|
19829
|
+
getSocketFailure() {
|
|
19830
|
+
return this.socketFailure;
|
|
19831
|
+
}
|
|
19832
|
+
};
|
|
19833
|
+
exports.NativeUdpSender = NativeUdpSender;
|
|
19834
|
+
async function bindDgramSocket(socket, port, address) {
|
|
19835
|
+
await new Promise((resolve, reject) => {
|
|
19836
|
+
let settled = false;
|
|
19837
|
+
const onError = (value) => {
|
|
19838
|
+
if (settled) {
|
|
19839
|
+
return;
|
|
19840
|
+
}
|
|
19841
|
+
settled = true;
|
|
19842
|
+
reject(toError(value, "Loopback UDP bind failed"));
|
|
19843
|
+
};
|
|
19844
|
+
socket.on("error", onError);
|
|
19845
|
+
try {
|
|
19846
|
+
socket.bind(port, address, () => {
|
|
19847
|
+
if (settled) {
|
|
19848
|
+
return;
|
|
19849
|
+
}
|
|
19850
|
+
settled = true;
|
|
19851
|
+
socket.removeListener("error", onError);
|
|
19852
|
+
resolve();
|
|
19853
|
+
});
|
|
19854
|
+
} catch (error) {
|
|
19855
|
+
if (!settled) {
|
|
19856
|
+
settled = true;
|
|
19857
|
+
socket.removeListener("error", onError);
|
|
19858
|
+
reject(toError(error, "Loopback UDP bind failed"));
|
|
19859
|
+
}
|
|
19860
|
+
}
|
|
19861
|
+
});
|
|
19862
|
+
}
|
|
19863
|
+
async function closeDgramSocket(socket) {
|
|
19864
|
+
await new Promise((resolve) => {
|
|
19865
|
+
try {
|
|
19866
|
+
socket.close(resolve);
|
|
19867
|
+
} catch {
|
|
19868
|
+
resolve();
|
|
19869
|
+
}
|
|
19870
|
+
});
|
|
19871
|
+
}
|
|
19872
|
+
async function sendDatagram(socket, datagram, destinationPort, isDestroyed) {
|
|
19873
|
+
if (isDestroyed()) {
|
|
19874
|
+
return;
|
|
19875
|
+
}
|
|
19876
|
+
await new Promise((resolve, reject) => {
|
|
19877
|
+
try {
|
|
19878
|
+
socket.send(datagram, destinationPort, "127.0.0.1", (error) => {
|
|
19879
|
+
if (error === void 0 || error === null || isDestroyed()) {
|
|
19880
|
+
resolve();
|
|
19881
|
+
return;
|
|
19882
|
+
}
|
|
19883
|
+
reject(toError(error, "Loopback UDP datagram send failed"));
|
|
19884
|
+
});
|
|
19885
|
+
} catch (error) {
|
|
19886
|
+
if (isDestroyed()) {
|
|
19887
|
+
resolve();
|
|
19888
|
+
return;
|
|
19889
|
+
}
|
|
19890
|
+
reject(toError(error, "Loopback UDP datagram send failed"));
|
|
19891
|
+
}
|
|
19892
|
+
});
|
|
19893
|
+
}
|
|
19894
|
+
function buildDatagrams(packets, maxPacketsPerDatagram) {
|
|
19895
|
+
if (packets.length === 0) {
|
|
19896
|
+
return [];
|
|
19897
|
+
}
|
|
19898
|
+
for (const packet of packets) {
|
|
19899
|
+
if (packet.byteLength !== TS_PACKET_SIZE || packet[0] !== 71) {
|
|
19900
|
+
throw new NativeUdpPreWriteError("Native UDP transport accepts only aligned 188-byte TS packets");
|
|
19901
|
+
}
|
|
19902
|
+
}
|
|
19903
|
+
const datagrams = [];
|
|
19904
|
+
for (let start = 0; start < packets.length; start += maxPacketsPerDatagram) {
|
|
19905
|
+
const end = Math.min(start + maxPacketsPerDatagram, packets.length);
|
|
19906
|
+
const datagram = new Uint8Array((end - start) * TS_PACKET_SIZE);
|
|
19907
|
+
let offset = 0;
|
|
19908
|
+
for (let index = start; index < end; index += 1) {
|
|
19909
|
+
const packet = packets[index];
|
|
19910
|
+
if (packet === void 0) {
|
|
19911
|
+
continue;
|
|
19912
|
+
}
|
|
19913
|
+
datagram.set(packet, offset);
|
|
19914
|
+
offset += TS_PACKET_SIZE;
|
|
19915
|
+
}
|
|
19916
|
+
datagrams.push(datagram);
|
|
19917
|
+
}
|
|
19918
|
+
return datagrams;
|
|
19919
|
+
}
|
|
19920
|
+
function narrowToDgramSocketLike(value) {
|
|
19921
|
+
if (typeof value !== "object" || value === null) {
|
|
19922
|
+
throw new TypeError("Expected a dgram socket object");
|
|
19923
|
+
}
|
|
19924
|
+
const on = Reflect.get(value, "on");
|
|
19925
|
+
const once = Reflect.get(value, "once");
|
|
19926
|
+
const removeListener = Reflect.get(value, "removeListener");
|
|
19927
|
+
const bind = Reflect.get(value, "bind");
|
|
19928
|
+
const send = Reflect.get(value, "send");
|
|
19929
|
+
const address = Reflect.get(value, "address");
|
|
19930
|
+
const close = Reflect.get(value, "close");
|
|
19931
|
+
if (typeof on !== "function" || typeof once !== "function" || typeof removeListener !== "function" || typeof bind !== "function" || typeof send !== "function" || typeof address !== "function" || typeof close !== "function") {
|
|
19932
|
+
throw new TypeError("Object does not satisfy the UDP socket contract");
|
|
19933
|
+
}
|
|
19934
|
+
return {
|
|
19935
|
+
on(event, listener) {
|
|
19936
|
+
Reflect.apply(on, value, [event, listener]);
|
|
19937
|
+
},
|
|
19938
|
+
once(event, listener) {
|
|
19939
|
+
Reflect.apply(once, value, [event, listener]);
|
|
19940
|
+
},
|
|
19941
|
+
removeListener(event, listener) {
|
|
19942
|
+
Reflect.apply(removeListener, value, [event, listener]);
|
|
19943
|
+
},
|
|
19944
|
+
bind(port, addressValue, callback) {
|
|
19945
|
+
Reflect.apply(bind, value, [port, addressValue, callback]);
|
|
19946
|
+
},
|
|
19947
|
+
send(buffer, port, addressValue, callback) {
|
|
19948
|
+
Reflect.apply(send, value, [buffer, port, addressValue, callback]);
|
|
19949
|
+
},
|
|
19950
|
+
address() {
|
|
19951
|
+
const result = Reflect.apply(address, value, []);
|
|
19952
|
+
if (typeof result === "string" || result === null) {
|
|
19953
|
+
return result;
|
|
19954
|
+
}
|
|
19955
|
+
if (typeof result === "object") {
|
|
19956
|
+
const port = Reflect.get(result, "port");
|
|
19957
|
+
if (typeof port === "number") {
|
|
19958
|
+
return { port };
|
|
19959
|
+
}
|
|
19960
|
+
}
|
|
19961
|
+
return null;
|
|
19962
|
+
},
|
|
19963
|
+
close(callback) {
|
|
19964
|
+
Reflect.apply(close, value, callback === void 0 ? [] : [callback]);
|
|
19965
|
+
}
|
|
19966
|
+
};
|
|
19967
|
+
}
|
|
19968
|
+
function toError(value, fallback) {
|
|
19969
|
+
return value instanceof Error ? value : new Error(fallback);
|
|
19970
|
+
}
|
|
19971
|
+
}
|
|
19972
|
+
});
|
|
19973
|
+
|
|
19542
19974
|
// node_modules/@signageos/brightsign-decoder/dist/decoder/NativeH264Decoder.js
|
|
19543
19975
|
var require_NativeH264Decoder = __commonJS({
|
|
19544
19976
|
"node_modules/@signageos/brightsign-decoder/dist/decoder/NativeH264Decoder.js"(exports) {
|
|
@@ -19549,11 +19981,12 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19549
19981
|
var MpegTsMuxer_1 = require_MpegTsMuxer();
|
|
19550
19982
|
var NativeHttpServer_1 = require_NativeHttpServer();
|
|
19551
19983
|
var PlaybackSession_1 = require_PlaybackSession();
|
|
19984
|
+
var NativeUdpSender_1 = require_NativeUdpSender();
|
|
19552
19985
|
var DEFAULT_MAX_QUEUED_ACCESS_UNITS = 16;
|
|
19553
19986
|
var DEFAULT_MAX_QUEUED_BYTES = 8 * 1024 * 1024;
|
|
19554
19987
|
var NativeH264Decoder = class {
|
|
19555
19988
|
constructor(dependencies) {
|
|
19556
|
-
var _a, _b, _c, _d, _e, _f;
|
|
19989
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
19557
19990
|
this.dependencies = dependencies;
|
|
19558
19991
|
this.queuedAtMs = [];
|
|
19559
19992
|
this.operationChain = Promise.resolve();
|
|
@@ -19567,16 +20000,20 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19567
20000
|
this.failedAccessUnits = 0;
|
|
19568
20001
|
this.capacityRejections = 0;
|
|
19569
20002
|
this.destroyed = false;
|
|
20003
|
+
this.httpServerStarted = false;
|
|
19570
20004
|
this.httpServerDestroyed = false;
|
|
20005
|
+
this.udpSenderStarted = false;
|
|
20006
|
+
this.udpSenderDestroyed = false;
|
|
19571
20007
|
this.playbackStopped = false;
|
|
19572
20008
|
this.initialized = false;
|
|
19573
20009
|
this.httpServer = (_a = dependencies.httpServer) != null ? _a : new NativeHttpServer_1.NativeHttpServer();
|
|
20010
|
+
this.udpSender = (_b = dependencies.udpSender) != null ? _b : dependencies.dgramModule === void 0 ? void 0 : new NativeUdpSender_1.NativeUdpSender();
|
|
19574
20011
|
this.playback = new PlaybackSession_1.PlaybackSession(dependencies.streamBridge);
|
|
19575
|
-
this.muxer = (
|
|
19576
|
-
this.referenceRegistry = (
|
|
19577
|
-
this.maxQueuedAccessUnits = (
|
|
19578
|
-
this.maxQueuedBytes = (
|
|
19579
|
-
this.now = (
|
|
20012
|
+
this.muxer = (_c = dependencies.muxer) != null ? _c : new MpegTsMuxer_1.MpegTsMuxer();
|
|
20013
|
+
this.referenceRegistry = (_d = dependencies.refRegistry) != null ? _d : new FrameReferenceRegistry_1.FrameReferenceRegistry();
|
|
20014
|
+
this.maxQueuedAccessUnits = (_e = dependencies.maxQueuedAccessUnits) != null ? _e : DEFAULT_MAX_QUEUED_ACCESS_UNITS;
|
|
20015
|
+
this.maxQueuedBytes = (_f = dependencies.maxQueuedBytes) != null ? _f : DEFAULT_MAX_QUEUED_BYTES;
|
|
20016
|
+
this.now = (_g = dependencies.now) != null ? _g : Date.now;
|
|
19580
20017
|
if (!Number.isSafeInteger(this.maxQueuedAccessUnits) || this.maxQueuedAccessUnits <= 0) {
|
|
19581
20018
|
throw new RangeError("maxQueuedAccessUnits must be a positive integer");
|
|
19582
20019
|
}
|
|
@@ -19633,8 +20070,10 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19633
20070
|
}
|
|
19634
20071
|
}
|
|
19635
20072
|
getDiagnostics() {
|
|
20073
|
+
var _a;
|
|
19636
20074
|
const oldest = this.queuedAtMs[0];
|
|
19637
20075
|
return {
|
|
20076
|
+
protocol: this.getConfiguredProtocol(),
|
|
19638
20077
|
queuedAccessUnits: this.queuedAccessUnits,
|
|
19639
20078
|
queuedBytes: this.queuedBytes,
|
|
19640
20079
|
highWaterAccessUnits: this.highWaterAccessUnits,
|
|
@@ -19645,7 +20084,8 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19645
20084
|
failedAccessUnits: this.failedAccessUnits,
|
|
19646
20085
|
capacityRejections: this.capacityRejections,
|
|
19647
20086
|
pendingError: this.pendingError !== void 0,
|
|
19648
|
-
httpTransport: this.httpServer.getDiagnostics()
|
|
20087
|
+
httpTransport: this.httpServer.getDiagnostics(),
|
|
20088
|
+
udpTransport: (_a = this.udpSender) == null ? void 0 : _a.getDiagnostics()
|
|
19649
20089
|
};
|
|
19650
20090
|
}
|
|
19651
20091
|
destroy() {
|
|
@@ -19676,7 +20116,7 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19676
20116
|
} catch {
|
|
19677
20117
|
}
|
|
19678
20118
|
}
|
|
19679
|
-
if (!this.httpServerDestroyed) {
|
|
20119
|
+
if (this.httpServerStarted && !this.httpServerDestroyed) {
|
|
19680
20120
|
try {
|
|
19681
20121
|
await this.httpServer.destroy();
|
|
19682
20122
|
this.httpServerDestroyed = true;
|
|
@@ -19684,6 +20124,14 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19684
20124
|
firstError = firstError != null ? firstError : toError(error, "HTTP transport teardown failed");
|
|
19685
20125
|
}
|
|
19686
20126
|
}
|
|
20127
|
+
if (this.udpSenderStarted && !this.udpSenderDestroyed && this.udpSender !== void 0) {
|
|
20128
|
+
try {
|
|
20129
|
+
await this.udpSender.destroy();
|
|
20130
|
+
this.udpSenderDestroyed = true;
|
|
20131
|
+
} catch (error) {
|
|
20132
|
+
firstError = firstError != null ? firstError : toError(error, "UDP transport teardown failed");
|
|
20133
|
+
}
|
|
20134
|
+
}
|
|
19687
20135
|
try {
|
|
19688
20136
|
await this.operationChain;
|
|
19689
20137
|
} catch (error) {
|
|
@@ -19703,22 +20151,28 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19703
20151
|
}
|
|
19704
20152
|
}
|
|
19705
20153
|
async performInitialization() {
|
|
19706
|
-
var _a, _b;
|
|
19707
20154
|
try {
|
|
19708
20155
|
const options = this.options;
|
|
19709
20156
|
if (options === void 0) {
|
|
19710
20157
|
throw new Error("Decoder options are unavailable");
|
|
19711
20158
|
}
|
|
19712
|
-
|
|
20159
|
+
if (this.getConfiguredProtocol() === "UDP") {
|
|
20160
|
+
const dgramModule = this.dependencies.dgramModule;
|
|
20161
|
+
if (dgramModule === void 0 || this.udpSender === void 0) {
|
|
20162
|
+
throw new Error("UDP playback requires a dgram module");
|
|
20163
|
+
}
|
|
20164
|
+
await this.udpSender.start(dgramModule);
|
|
20165
|
+
this.udpSenderStarted = true;
|
|
20166
|
+
} else {
|
|
20167
|
+
await this.httpServer.start(this.dependencies.httpModule);
|
|
20168
|
+
this.httpServerStarted = true;
|
|
20169
|
+
}
|
|
19713
20170
|
if (this.destroyed) {
|
|
19714
20171
|
throw new Error("Decoder was destroyed during initialization");
|
|
19715
20172
|
}
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
|
|
19719
|
-
width: options.width,
|
|
19720
|
-
height: options.height
|
|
19721
|
-
}, options.streamOptions);
|
|
20173
|
+
if (this.getConfiguredProtocol() === "HTTP") {
|
|
20174
|
+
await this.startPlayback(this.httpServer.uri, "HTTP");
|
|
20175
|
+
}
|
|
19722
20176
|
if (this.destroyed) {
|
|
19723
20177
|
throw new Error("Decoder was destroyed during initialization");
|
|
19724
20178
|
}
|
|
@@ -19726,14 +20180,23 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19726
20180
|
} catch (error) {
|
|
19727
20181
|
let result = toError(error, "Decoder initialization failed");
|
|
19728
20182
|
try {
|
|
19729
|
-
|
|
19730
|
-
|
|
20183
|
+
if (this.getConfiguredProtocol() === "HTTP" && !this.httpServerDestroyed) {
|
|
20184
|
+
await this.httpServer.destroy();
|
|
20185
|
+
this.httpServerDestroyed = true;
|
|
20186
|
+
}
|
|
19731
20187
|
} catch (cleanupError) {
|
|
19732
20188
|
result = new Error(`${result.message}; HTTP cleanup failed: ${toError(cleanupError, "unknown error").message}`);
|
|
19733
20189
|
}
|
|
20190
|
+
try {
|
|
20191
|
+
if (this.getConfiguredProtocol() === "UDP" && !this.udpSenderDestroyed && this.udpSender !== void 0) {
|
|
20192
|
+
await this.udpSender.destroy();
|
|
20193
|
+
this.udpSenderDestroyed = true;
|
|
20194
|
+
}
|
|
20195
|
+
} catch (cleanupError) {
|
|
20196
|
+
result = new Error(`${result.message}; UDP cleanup failed: ${toError(cleanupError, "unknown error").message}`);
|
|
20197
|
+
}
|
|
19734
20198
|
try {
|
|
19735
20199
|
await this.playback.stop();
|
|
19736
|
-
this.playbackStopped = true;
|
|
19737
20200
|
} catch (cleanupError) {
|
|
19738
20201
|
result = new Error(`${result.message}; playback cleanup failed: ${toError(cleanupError, "unknown error").message}`);
|
|
19739
20202
|
}
|
|
@@ -19775,10 +20238,10 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19775
20238
|
const operation = this.operationChain.then(async () => {
|
|
19776
20239
|
const prepared = this.muxer.prepare(ownedData, ownedTimestamp);
|
|
19777
20240
|
try {
|
|
19778
|
-
await this.
|
|
20241
|
+
await this.deliverAccessUnit(prepared.packets);
|
|
19779
20242
|
prepared.commit();
|
|
19780
20243
|
} catch (error) {
|
|
19781
|
-
if (error
|
|
20244
|
+
if (isPreWriteError(error)) {
|
|
19782
20245
|
prepared.rejectBeforeWrite();
|
|
19783
20246
|
} else {
|
|
19784
20247
|
prepared.commit();
|
|
@@ -19804,6 +20267,67 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19804
20267
|
this.queuedAccessUnits -= 1;
|
|
19805
20268
|
this.queuedBytes -= byteLength;
|
|
19806
20269
|
}
|
|
20270
|
+
getConfiguredProtocol() {
|
|
20271
|
+
var _a, _b;
|
|
20272
|
+
return (_b = (_a = this.options) == null ? void 0 : _a.streamProtocol) != null ? _b : "HTTP";
|
|
20273
|
+
}
|
|
20274
|
+
async startPlayback(uri, protocol) {
|
|
20275
|
+
var _a, _b;
|
|
20276
|
+
const options = this.options;
|
|
20277
|
+
if (options === void 0) {
|
|
20278
|
+
throw new Error("Decoder options are unavailable");
|
|
20279
|
+
}
|
|
20280
|
+
await this.playback.start(uri, {
|
|
20281
|
+
x: (_a = options.x) != null ? _a : 0,
|
|
20282
|
+
y: (_b = options.y) != null ? _b : 0,
|
|
20283
|
+
width: options.width,
|
|
20284
|
+
height: options.height
|
|
20285
|
+
}, protocol, options.streamOptions);
|
|
20286
|
+
}
|
|
20287
|
+
async deliverAccessUnit(packets) {
|
|
20288
|
+
if (this.getConfiguredProtocol() === "UDP") {
|
|
20289
|
+
await this.deliverUdpAccessUnit(packets);
|
|
20290
|
+
return;
|
|
20291
|
+
}
|
|
20292
|
+
await this.httpServer.writeAccessUnit(packets);
|
|
20293
|
+
}
|
|
20294
|
+
async deliverUdpAccessUnit(packets) {
|
|
20295
|
+
if (packets.length === 0) {
|
|
20296
|
+
return;
|
|
20297
|
+
}
|
|
20298
|
+
const udpSender = this.udpSender;
|
|
20299
|
+
if (udpSender === void 0) {
|
|
20300
|
+
throw new NativeUdpSender_1.NativeUdpPreWriteError("UDP transport is unavailable");
|
|
20301
|
+
}
|
|
20302
|
+
if (!this.playback.isPlaying) {
|
|
20303
|
+
await this.startUdpPlayback(udpSender, packets);
|
|
20304
|
+
return;
|
|
20305
|
+
}
|
|
20306
|
+
await udpSender.writeAccessUnit(packets);
|
|
20307
|
+
}
|
|
20308
|
+
async startUdpPlayback(udpSender, packets) {
|
|
20309
|
+
let playbackStarted = false;
|
|
20310
|
+
try {
|
|
20311
|
+
await udpSender.releaseDestinationReservation();
|
|
20312
|
+
await this.startPlayback(udpSender.uri, "UDP");
|
|
20313
|
+
playbackStarted = true;
|
|
20314
|
+
await udpSender.warmupAccessUnit(packets);
|
|
20315
|
+
} catch (error) {
|
|
20316
|
+
const preWriteFailure = error instanceof NativeUdpSender_1.NativeUdpPreWriteError || !playbackStarted;
|
|
20317
|
+
let result = toError(error, "UDP startup failed");
|
|
20318
|
+
if (playbackStarted) {
|
|
20319
|
+
try {
|
|
20320
|
+
await this.playback.stop();
|
|
20321
|
+
} catch (cleanupError) {
|
|
20322
|
+
result = new Error(`${result.message}; UDP playback cleanup failed: ${toError(cleanupError, "unknown error").message}`);
|
|
20323
|
+
}
|
|
20324
|
+
}
|
|
20325
|
+
if (preWriteFailure) {
|
|
20326
|
+
throw new NativeUdpSender_1.NativeUdpPreWriteError(result.message);
|
|
20327
|
+
}
|
|
20328
|
+
throw result;
|
|
20329
|
+
}
|
|
20330
|
+
}
|
|
19807
20331
|
};
|
|
19808
20332
|
exports.NativeH264Decoder = NativeH264Decoder;
|
|
19809
20333
|
function validateDecoderOptions(options) {
|
|
@@ -19851,6 +20375,9 @@ var require_NativeH264Decoder = __commonJS({
|
|
|
19851
20375
|
function toError(value, fallback) {
|
|
19852
20376
|
return value instanceof Error ? value : new Error(fallback);
|
|
19853
20377
|
}
|
|
20378
|
+
function isPreWriteError(error) {
|
|
20379
|
+
return error instanceof NativeHttpServer_1.NativeHttpPreWriteError || error instanceof NativeUdpSender_1.NativeUdpPreWriteError;
|
|
20380
|
+
}
|
|
19854
20381
|
}
|
|
19855
20382
|
});
|
|
19856
20383
|
|
|
@@ -19921,23 +20448,26 @@ var require_support = __commonJS({
|
|
|
19921
20448
|
if (typeof globalThis === "undefined") {
|
|
19922
20449
|
return false;
|
|
19923
20450
|
}
|
|
19924
|
-
const
|
|
19925
|
-
if (
|
|
19926
|
-
return
|
|
19927
|
-
}
|
|
19928
|
-
const parentRequire = safeGet(parentWindow, "require");
|
|
19929
|
-
if (typeof parentRequire !== "function") {
|
|
19930
|
-
return false;
|
|
19931
|
-
}
|
|
19932
|
-
const http = Reflect.apply(parentRequire, parentWindow, ["http"]);
|
|
19933
|
-
if (typeof http !== "object" || http === null) {
|
|
19934
|
-
return false;
|
|
20451
|
+
const localRequire = safeGet(globalThis, "require");
|
|
20452
|
+
if (probeHttpModule(localRequire, globalThis)) {
|
|
20453
|
+
return true;
|
|
19935
20454
|
}
|
|
19936
|
-
|
|
20455
|
+
const parentWindow = safeGet(globalThis, "parent");
|
|
20456
|
+
return probeHttpModule(safeGet(parentWindow, "require"), parentWindow);
|
|
19937
20457
|
} catch {
|
|
19938
20458
|
return false;
|
|
19939
20459
|
}
|
|
19940
20460
|
}
|
|
20461
|
+
function probeHttpModule(requireFunction, receiver) {
|
|
20462
|
+
if (typeof requireFunction !== "function") {
|
|
20463
|
+
return false;
|
|
20464
|
+
}
|
|
20465
|
+
const http = Reflect.apply(requireFunction, receiver, ["http"]);
|
|
20466
|
+
if (typeof http !== "object" || http === null) {
|
|
20467
|
+
return false;
|
|
20468
|
+
}
|
|
20469
|
+
return typeof Reflect.get(http, "createServer") === "function";
|
|
20470
|
+
}
|
|
19941
20471
|
function probeStreamBridge() {
|
|
19942
20472
|
try {
|
|
19943
20473
|
if (typeof globalThis === "undefined") {
|
|
@@ -19971,6 +20501,7 @@ var require_parentNode = __commonJS({
|
|
|
19971
20501
|
exports.discoverParentRequire = discoverParentRequire;
|
|
19972
20502
|
exports.validateNetModule = validateNetModule;
|
|
19973
20503
|
exports.validateHttpModule = validateHttpModule;
|
|
20504
|
+
exports.validateDgramModule = validateDgramModule;
|
|
19974
20505
|
function safeGet(target, key) {
|
|
19975
20506
|
try {
|
|
19976
20507
|
if (typeof target !== "object" || target === null) {
|
|
@@ -19993,6 +20524,10 @@ var require_parentNode = __commonJS({
|
|
|
19993
20524
|
if (typeof globalThis === "undefined") {
|
|
19994
20525
|
return void 0;
|
|
19995
20526
|
}
|
|
20527
|
+
const localRequire = safeGet(globalThis, "require");
|
|
20528
|
+
if (typeof localRequire === "function") {
|
|
20529
|
+
return wrapRequire(localRequire, globalThis);
|
|
20530
|
+
}
|
|
19996
20531
|
const parentWindow = safeGet(globalThis, "parent");
|
|
19997
20532
|
if (parentWindow !== void 0 && parentWindow !== null) {
|
|
19998
20533
|
const parentRequire = safeGet(parentWindow, "require");
|
|
@@ -20023,6 +20558,13 @@ var require_parentNode = __commonJS({
|
|
|
20023
20558
|
const cs = Reflect.get(mod, "createServer");
|
|
20024
20559
|
return typeof cs === "function";
|
|
20025
20560
|
}
|
|
20561
|
+
function validateDgramModule(mod) {
|
|
20562
|
+
if (typeof mod !== "object" || mod === null) {
|
|
20563
|
+
return false;
|
|
20564
|
+
}
|
|
20565
|
+
const createSocket = Reflect.get(mod, "createSocket");
|
|
20566
|
+
return typeof createSocket === "function";
|
|
20567
|
+
}
|
|
20026
20568
|
}
|
|
20027
20569
|
});
|
|
20028
20570
|
|
|
@@ -20031,7 +20573,7 @@ var require_dist = __commonJS({
|
|
|
20031
20573
|
"node_modules/@signageos/brightsign-decoder/dist/index.js"(exports) {
|
|
20032
20574
|
"use strict";
|
|
20033
20575
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20034
|
-
exports.validateHttpModule = exports.validateNetModule = exports.discoverParentRequire = exports.detectCapabilities = exports.isBrightSignDecoderSupported = exports.NativeHttpServer = exports.PlaybackSession = exports.WebCodecsH264Decoder = exports.NativeH264Decoder = exports.parseNalUnits = exports.NalType = exports.inspectAccessUnit = exports.getNalType = exports.findStartCodes = exports.u64Sub = exports.u64ToBigInt = exports.TransportClock = exports.verifyCrc32 = exports.computeCrc32 = exports.MpegTsMuxer = exports.TCP = exports.ConnectionRegistry = exports.FrameReferenceRegistry = exports.FrameCollector = exports.PacketParser = exports.FrameType = exports.ConnectionState = void 0;
|
|
20576
|
+
exports.validateHttpModule = exports.validateNetModule = exports.validateDgramModule = exports.discoverParentRequire = exports.detectCapabilities = exports.isBrightSignDecoderSupported = exports.NativeHttpServer = exports.PlaybackSession = exports.WebCodecsH264Decoder = exports.NativeH264Decoder = exports.parseNalUnits = exports.NalType = exports.inspectAccessUnit = exports.getNalType = exports.findStartCodes = exports.u64Sub = exports.u64ToBigInt = exports.TransportClock = exports.verifyCrc32 = exports.computeCrc32 = exports.MpegTsMuxer = exports.TCP = exports.ConnectionRegistry = exports.FrameReferenceRegistry = exports.FrameCollector = exports.PacketParser = exports.FrameType = exports.ConnectionState = void 0;
|
|
20035
20577
|
exports.createBrightSignDecoder = createBrightSignDecoder2;
|
|
20036
20578
|
exports.createBrightSignTCP = createBrightSignTCP2;
|
|
20037
20579
|
var contracts_1 = require_contracts();
|
|
@@ -20124,6 +20666,9 @@ var require_dist = __commonJS({
|
|
|
20124
20666
|
Object.defineProperty(exports, "discoverParentRequire", { enumerable: true, get: function() {
|
|
20125
20667
|
return parentNode_1.discoverParentRequire;
|
|
20126
20668
|
} });
|
|
20669
|
+
Object.defineProperty(exports, "validateDgramModule", { enumerable: true, get: function() {
|
|
20670
|
+
return parentNode_1.validateDgramModule;
|
|
20671
|
+
} });
|
|
20127
20672
|
Object.defineProperty(exports, "validateNetModule", { enumerable: true, get: function() {
|
|
20128
20673
|
return parentNode_1.validateNetModule;
|
|
20129
20674
|
} });
|
|
@@ -20138,9 +20683,29 @@ var require_dist = __commonJS({
|
|
|
20138
20683
|
function createBrightSignDecoder2(deps) {
|
|
20139
20684
|
var _a;
|
|
20140
20685
|
const resolved = deps != null ? deps : {};
|
|
20686
|
+
let dgramModule = resolved.dgramModule;
|
|
20141
20687
|
let httpModule = resolved.httpModule;
|
|
20142
20688
|
let streamBridge = resolved.streamBridge;
|
|
20143
20689
|
const refRegistry = (_a = resolved.refRegistry) != null ? _a : new FrameReferenceRegistry_2.FrameReferenceRegistry();
|
|
20690
|
+
if (dgramModule === void 0) {
|
|
20691
|
+
const parentRequire = (0, parentNode_2.discoverParentRequire)();
|
|
20692
|
+
if (parentRequire !== void 0) {
|
|
20693
|
+
try {
|
|
20694
|
+
const dgram = parentRequire("dgram");
|
|
20695
|
+
if ((0, parentNode_2.validateDgramModule)(dgram) && typeof dgram === "object" && dgram !== null) {
|
|
20696
|
+
const createSocket = Reflect.get(dgram, "createSocket");
|
|
20697
|
+
if (typeof createSocket === "function") {
|
|
20698
|
+
dgramModule = {
|
|
20699
|
+
createSocket(type) {
|
|
20700
|
+
return Reflect.apply(createSocket, dgram, [type]);
|
|
20701
|
+
}
|
|
20702
|
+
};
|
|
20703
|
+
}
|
|
20704
|
+
}
|
|
20705
|
+
} catch {
|
|
20706
|
+
}
|
|
20707
|
+
}
|
|
20708
|
+
}
|
|
20144
20709
|
if (httpModule === void 0) {
|
|
20145
20710
|
const parentRequire = (0, parentNode_2.discoverParentRequire)();
|
|
20146
20711
|
if (parentRequire !== void 0) {
|
|
@@ -20167,6 +20732,7 @@ var require_dist = __commonJS({
|
|
|
20167
20732
|
throw new Error("No stream bridge available \u2014 provide streamBridge or ensure sos.stream is accessible");
|
|
20168
20733
|
}
|
|
20169
20734
|
const fullDeps = {
|
|
20735
|
+
dgramModule,
|
|
20170
20736
|
httpModule,
|
|
20171
20737
|
streamBridge,
|
|
20172
20738
|
refRegistry
|
|
@@ -24202,6 +24768,7 @@ function isBrightSignRuntimeAvailable() {
|
|
|
24202
24768
|
function initBrightSignTCP() {
|
|
24203
24769
|
registerStreamErrorListener();
|
|
24204
24770
|
if (window.brightSignTCP) {
|
|
24771
|
+
console.log("BrightSign TCP already initialized");
|
|
24205
24772
|
return true;
|
|
24206
24773
|
}
|
|
24207
24774
|
try {
|
|
@@ -24211,6 +24778,7 @@ function initBrightSignTCP() {
|
|
|
24211
24778
|
maxPacketSize: 65535
|
|
24212
24779
|
});
|
|
24213
24780
|
registerTeardown();
|
|
24781
|
+
console.log("BrightSign TCP initialized");
|
|
24214
24782
|
return true;
|
|
24215
24783
|
} catch (error) {
|
|
24216
24784
|
console.log("BrightSign TCP is not available", error);
|
|
@@ -24218,11 +24786,14 @@ function initBrightSignTCP() {
|
|
|
24218
24786
|
}
|
|
24219
24787
|
}
|
|
24220
24788
|
async function initBrightSignDecoder(options) {
|
|
24221
|
-
var _a;
|
|
24789
|
+
var _a, _b, _c;
|
|
24222
24790
|
if (window.brightSignDecoder) {
|
|
24791
|
+
console.log("BrightSign decoder already initialized");
|
|
24223
24792
|
return true;
|
|
24224
24793
|
}
|
|
24225
|
-
|
|
24794
|
+
const runtimeAvailable = (0, import_brightsign_decoder.isBrightSignDecoderSupported)();
|
|
24795
|
+
console.log("BrightSign decoder runtime availability", runtimeAvailable);
|
|
24796
|
+
if (!runtimeAvailable) {
|
|
24226
24797
|
return false;
|
|
24227
24798
|
}
|
|
24228
24799
|
try {
|
|
@@ -24232,15 +24803,22 @@ async function initBrightSignDecoder(options) {
|
|
|
24232
24803
|
width: window.innerWidth,
|
|
24233
24804
|
height: window.innerHeight
|
|
24234
24805
|
};
|
|
24806
|
+
console.log("BrightSign decoder initialization begin", {
|
|
24807
|
+
geometry,
|
|
24808
|
+
streamProtocol: (_b = options.brightSignDecoderStreamProtocol) != null ? _b : "default",
|
|
24809
|
+
streamOptions: (_c = options.brightSignStreamOptions) != null ? _c : null
|
|
24810
|
+
});
|
|
24235
24811
|
const decoder = (0, import_brightsign_decoder.createBrightSignDecoder)({
|
|
24236
24812
|
refRegistry: getReferenceRegistry()
|
|
24237
24813
|
});
|
|
24238
24814
|
await decoder.initialize({
|
|
24239
24815
|
...geometry,
|
|
24816
|
+
streamProtocol: options.brightSignDecoderStreamProtocol,
|
|
24240
24817
|
streamOptions: options.brightSignStreamOptions ? { brightSign: options.brightSignStreamOptions } : void 0
|
|
24241
24818
|
});
|
|
24242
24819
|
window.brightSignDecoder = decoder;
|
|
24243
24820
|
registerTeardown();
|
|
24821
|
+
console.log("BrightSign decoder initialization complete");
|
|
24244
24822
|
return true;
|
|
24245
24823
|
} catch (error) {
|
|
24246
24824
|
console.error("Failed to initialize BrightSign decoder", error);
|
|
@@ -24267,6 +24845,7 @@ function registerStreamErrorListener() {
|
|
|
24267
24845
|
(event) => console.error("BrightSign native stream error", event)
|
|
24268
24846
|
]);
|
|
24269
24847
|
streamErrorListenerRegistered = true;
|
|
24848
|
+
console.log("BrightSign native stream error listener registered");
|
|
24270
24849
|
}
|
|
24271
24850
|
function getReferenceRegistry() {
|
|
24272
24851
|
if (!referenceRegistry) {
|
|
@@ -24283,12 +24862,14 @@ function registerTeardown() {
|
|
|
24283
24862
|
}
|
|
24284
24863
|
teardownRegistered = true;
|
|
24285
24864
|
window.addEventListener("unload", () => {
|
|
24865
|
+
console.log("BrightSign teardown begin");
|
|
24286
24866
|
const decoder = window.brightSignDecoder;
|
|
24287
24867
|
const tcp = window.brightSignTCP;
|
|
24288
24868
|
window.brightSignDecoder = void 0;
|
|
24289
24869
|
window.brightSignTCP = void 0;
|
|
24290
24870
|
void (decoder == null ? void 0 : decoder.destroy());
|
|
24291
24871
|
void (tcp == null ? void 0 : tcp.destroy());
|
|
24872
|
+
console.log("BrightSign teardown dispatched");
|
|
24292
24873
|
});
|
|
24293
24874
|
}
|
|
24294
24875
|
|
|
@@ -24321,7 +24902,7 @@ async function initSamsungWasmTCP() {
|
|
|
24321
24902
|
}
|
|
24322
24903
|
|
|
24323
24904
|
// daemon/plain.ts
|
|
24324
|
-
var DAEMON_JS_URL = "supra-client-daemon.js?v=1.0.0-mzbrightsigndecoder.
|
|
24905
|
+
var DAEMON_JS_URL = "supra-client-daemon.js?v=1.0.0-mzbrightsigndecoder.478";
|
|
24325
24906
|
async function startPlainDaemon() {
|
|
24326
24907
|
initBrightSignTCP();
|
|
24327
24908
|
await initNaClTCP();
|
|
@@ -24335,7 +24916,7 @@ async function startPlainDaemon() {
|
|
|
24335
24916
|
}
|
|
24336
24917
|
|
|
24337
24918
|
// daemon/wasm.ts
|
|
24338
|
-
var DAEMON_WASM_URL = "supra-client-daemon.wasm?v=1.0.0-mzbrightsigndecoder.
|
|
24919
|
+
var DAEMON_WASM_URL = "supra-client-daemon.wasm?v=1.0.0-mzbrightsigndecoder.478";
|
|
24339
24920
|
async function startWasmDaemon() {
|
|
24340
24921
|
initBrightSignTCP();
|
|
24341
24922
|
await initNaClTCP();
|
|
@@ -24760,15 +25341,41 @@ function getGoArgv2(binFile, options) {
|
|
|
24760
25341
|
}
|
|
24761
25342
|
|
|
24762
25343
|
// screen/plain.ts
|
|
24763
|
-
var SCREEN_JS_URL = "supra-client-screen.js?v=1.0.0-mzbrightsigndecoder.
|
|
25344
|
+
var SCREEN_JS_URL = "supra-client-screen.js?v=1.0.0-mzbrightsigndecoder.478";
|
|
24764
25345
|
async function startPlainScreen(options) {
|
|
25346
|
+
var _a, _b, _c, _d;
|
|
24765
25347
|
console.log("[Supra screen plain] initialization begin");
|
|
24766
25348
|
options = options != null ? options : parseQueryOptions();
|
|
24767
25349
|
options = { ...options, geometry: normalizeGeometry(options.geometry) };
|
|
25350
|
+
console.log("[Supra screen plain] resolved start options", {
|
|
25351
|
+
screenID: options.screenID,
|
|
25352
|
+
screenDriver: options.screenDriver,
|
|
25353
|
+
metadataDriver: options.metadataDriver,
|
|
25354
|
+
secure: options.secure,
|
|
25355
|
+
interactive: options.interactive,
|
|
25356
|
+
netInWorker: options.netInWorker === true,
|
|
25357
|
+
forceScreenSize: (_a = options.forceScreenSize) != null ? _a : null,
|
|
25358
|
+
geometry: (_b = options.geometry) != null ? _b : null,
|
|
25359
|
+
brightSignDecoderStreamProtocol: (_c = options.brightSignDecoderStreamProtocol) != null ? _c : "default",
|
|
25360
|
+
hasBrightSignStreamOptions: options.brightSignStreamOptions !== void 0,
|
|
25361
|
+
encodingPreferences: (_d = options.encodingPreferences) != null ? _d : null
|
|
25362
|
+
});
|
|
24768
25363
|
initNaCLDecoder(options);
|
|
24769
25364
|
initWorkerFrameConnection(options.netInWorker === true);
|
|
24770
|
-
initBrightSignTCP();
|
|
24771
|
-
|
|
25365
|
+
const brightSignTCPReady = initBrightSignTCP();
|
|
25366
|
+
console.log("[Supra screen plain] BrightSign TCP ready", brightSignTCPReady);
|
|
25367
|
+
const brightSignDecoderReady = await initBrightSignDecoder(options);
|
|
25368
|
+
console.log("[Supra screen plain] BrightSign decoder ready", brightSignDecoderReady);
|
|
25369
|
+
if (brightSignDecoderReady) {
|
|
25370
|
+
const sos = Reflect.get(globalThis, "sos");
|
|
25371
|
+
if (typeof sos === "object" && sos !== null) {
|
|
25372
|
+
const config2 = Reflect.get(sos, "config");
|
|
25373
|
+
if (typeof config2 === "object" && config2 !== null) {
|
|
25374
|
+
Reflect.set(config2, "stream", false);
|
|
25375
|
+
console.log("[Supra screen plain] disabled sos.stream fallback for native decoder");
|
|
25376
|
+
}
|
|
25377
|
+
}
|
|
25378
|
+
}
|
|
24772
25379
|
await initNaClTCP(options);
|
|
24773
25380
|
await initSamsungWasmTCP();
|
|
24774
25381
|
await initSamsungWasmDecoder(options);
|
|
@@ -24776,13 +25383,17 @@ async function startPlainScreen(options) {
|
|
|
24776
25383
|
window.fs = fs;
|
|
24777
25384
|
process.argv = ["go", ...getGoArgv2(SCREEN_JS_URL, options)];
|
|
24778
25385
|
Object.assign(process.env, getGoEnv());
|
|
25386
|
+
console.log("[Supra screen plain] Go argv prepared", {
|
|
25387
|
+
argvLength: process.argv.length,
|
|
25388
|
+
screenID: options.screenID
|
|
25389
|
+
});
|
|
24779
25390
|
console.log("[Supra screen plain] script injection begin");
|
|
24780
25391
|
await injectScript(SCREEN_JS_URL);
|
|
24781
25392
|
console.log("[Supra screen plain] script injection complete; waiting for close");
|
|
24782
25393
|
await new Promise((resolve) => {
|
|
24783
25394
|
const interval = setInterval(() => {
|
|
24784
|
-
var
|
|
24785
|
-
if (((
|
|
25395
|
+
var _a2;
|
|
25396
|
+
if (((_a2 = window.__supra) == null ? void 0 : _a2.screenStopCompleted) === true) {
|
|
24786
25397
|
clearInterval(interval);
|
|
24787
25398
|
console.log("[Supra screen plain] lifecycle complete");
|
|
24788
25399
|
resolve();
|
|
@@ -24792,7 +25403,7 @@ async function startPlainScreen(options) {
|
|
|
24792
25403
|
}
|
|
24793
25404
|
|
|
24794
25405
|
// screen/h264decoder.ts
|
|
24795
|
-
var H264_DECODER_URL = "h264decoder.js?v=1.0.0-mzbrightsigndecoder.
|
|
25406
|
+
var H264_DECODER_URL = "h264decoder.js?v=1.0.0-mzbrightsigndecoder.478";
|
|
24796
25407
|
async function initH264Decoder() {
|
|
24797
25408
|
if (window.VideoDecoder !== void 0) {
|
|
24798
25409
|
return void 0;
|
|
@@ -24831,7 +25442,7 @@ function getProperty(value, property) {
|
|
|
24831
25442
|
}
|
|
24832
25443
|
|
|
24833
25444
|
// screen/wasm.ts
|
|
24834
|
-
var SCREEN_WASM_URL = "supra-client-screen.wasm?v=1.0.0-mzbrightsigndecoder.
|
|
25445
|
+
var SCREEN_WASM_URL = "supra-client-screen.wasm?v=1.0.0-mzbrightsigndecoder.478";
|
|
24835
25446
|
async function initializePhase(name, initialize) {
|
|
24836
25447
|
const startedAt = Date.now();
|
|
24837
25448
|
console.log(`[Supra screen WASM] ${name} begin`);
|