@supraio/client-daemon-js 1.0.0-mzbrightsigndecoder.481 → 1.0.0-mzbrightsigndecoder.482

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/sdk.js CHANGED
@@ -24768,19 +24768,27 @@ function isBrightSignRuntimeAvailable() {
24768
24768
  function initBrightSignTCP() {
24769
24769
  registerStreamErrorListener();
24770
24770
  if (window.brightSignTCP) {
24771
+ updateNativeState({ lastEvent: "tcp-reused" });
24771
24772
  console.log("BrightSign TCP already initialized");
24772
24773
  return true;
24773
24774
  }
24774
24775
  try {
24776
+ updateNativeState({ lastEvent: "tcp-init-begin", tcp: "initializing" });
24775
24777
  const registry = getReferenceRegistry();
24776
24778
  window.brightSignTCP = (0, import_brightsign_decoder.createBrightSignTCP)({
24777
24779
  refRegistry: registry,
24778
24780
  maxPacketSize: 65535
24779
24781
  });
24780
24782
  registerTeardown();
24783
+ updateNativeState({ lastEvent: "tcp-init-complete", tcp: "ready" });
24781
24784
  console.log("BrightSign TCP initialized");
24782
24785
  return true;
24783
24786
  } catch (error) {
24787
+ updateNativeState({
24788
+ lastEvent: "tcp-init-failed",
24789
+ tcp: "failed",
24790
+ lastError: describeError(error)
24791
+ });
24784
24792
  console.log("BrightSign TCP is not available", error);
24785
24793
  return false;
24786
24794
  }
@@ -24788,10 +24796,15 @@ function initBrightSignTCP() {
24788
24796
  async function initBrightSignDecoder(options) {
24789
24797
  var _a, _b, _c;
24790
24798
  if (window.brightSignDecoder) {
24799
+ updateNativeState({ lastEvent: "decoder-reused" });
24791
24800
  console.log("BrightSign decoder already initialized");
24792
24801
  return true;
24793
24802
  }
24794
24803
  const runtimeAvailable = (0, import_brightsign_decoder.isBrightSignDecoderSupported)();
24804
+ updateNativeState({
24805
+ lastEvent: "decoder-runtime-check",
24806
+ decoder: runtimeAvailable ? "available" : "unsupported"
24807
+ });
24795
24808
  console.log("BrightSign decoder runtime availability", runtimeAvailable);
24796
24809
  if (!runtimeAvailable) {
24797
24810
  return false;
@@ -24808,6 +24821,7 @@ async function initBrightSignDecoder(options) {
24808
24821
  streamProtocol: (_b = options.brightSignDecoderStreamProtocol) != null ? _b : "default",
24809
24822
  streamOptions: (_c = options.brightSignStreamOptions) != null ? _c : null
24810
24823
  });
24824
+ updateNativeState({ lastEvent: "decoder-init-begin", decoder: "initializing" });
24811
24825
  const decoder = (0, import_brightsign_decoder.createBrightSignDecoder)({
24812
24826
  refRegistry: getReferenceRegistry()
24813
24827
  });
@@ -24818,9 +24832,15 @@ async function initBrightSignDecoder(options) {
24818
24832
  });
24819
24833
  window.brightSignDecoder = decoder;
24820
24834
  registerTeardown();
24835
+ updateNativeState({ lastEvent: "decoder-init-complete", decoder: "ready" });
24821
24836
  console.log("BrightSign decoder initialization complete");
24822
24837
  return true;
24823
24838
  } catch (error) {
24839
+ updateNativeState({
24840
+ lastEvent: "decoder-init-failed",
24841
+ decoder: "failed",
24842
+ lastError: describeError(error)
24843
+ });
24824
24844
  console.error("Failed to initialize BrightSign decoder", error);
24825
24845
  return false;
24826
24846
  }
@@ -24842,9 +24862,16 @@ function registerStreamErrorListener() {
24842
24862
  return;
24843
24863
  }
24844
24864
  Reflect.apply(onError, stream, [
24845
- (event) => console.error("BrightSign native stream error", event)
24865
+ (event) => {
24866
+ updateNativeState({
24867
+ lastEvent: "stream-error",
24868
+ lastError: describeError(event)
24869
+ });
24870
+ console.error("BrightSign native stream error", event);
24871
+ }
24846
24872
  ]);
24847
24873
  streamErrorListenerRegistered = true;
24874
+ updateNativeState({ lastEvent: "stream-error-listener-registered" });
24848
24875
  console.log("BrightSign native stream error listener registered");
24849
24876
  }
24850
24877
  function getReferenceRegistry() {
@@ -24862,16 +24889,70 @@ function registerTeardown() {
24862
24889
  }
24863
24890
  teardownRegistered = true;
24864
24891
  window.addEventListener("unload", () => {
24892
+ const nativeState = ensureNativeState();
24893
+ nativeState.unloadCount += 1;
24894
+ updateNativeState({
24895
+ lastEvent: "unload-begin",
24896
+ decoder: window.brightSignDecoder ? "destroying" : "missing",
24897
+ tcp: window.brightSignTCP ? "destroying" : "missing"
24898
+ });
24865
24899
  console.log("BrightSign teardown begin");
24866
24900
  const decoder = window.brightSignDecoder;
24867
24901
  const tcp = window.brightSignTCP;
24868
24902
  window.brightSignDecoder = void 0;
24869
24903
  window.brightSignTCP = void 0;
24870
- void (decoder == null ? void 0 : decoder.destroy());
24871
- void (tcp == null ? void 0 : tcp.destroy());
24904
+ void (decoder == null ? void 0 : decoder.destroy().then(() => {
24905
+ updateNativeState({ lastEvent: "decoder-destroyed", decoder: "destroyed" });
24906
+ }).catch((error) => {
24907
+ updateNativeState({
24908
+ lastEvent: "decoder-destroy-failed",
24909
+ decoder: "destroy-failed",
24910
+ lastError: describeError(error)
24911
+ });
24912
+ }));
24913
+ void (tcp == null ? void 0 : tcp.destroy().then(() => {
24914
+ updateNativeState({ lastEvent: "tcp-destroyed", tcp: "destroyed" });
24915
+ }).catch((error) => {
24916
+ updateNativeState({
24917
+ lastEvent: "tcp-destroy-failed",
24918
+ tcp: "destroy-failed",
24919
+ lastError: describeError(error)
24920
+ });
24921
+ }));
24922
+ updateNativeState({ lastEvent: "unload-dispatched" });
24872
24923
  console.log("BrightSign teardown dispatched");
24873
24924
  });
24874
24925
  }
24926
+ function ensureNativeState() {
24927
+ if (window.__supraNativeState) {
24928
+ return window.__supraNativeState;
24929
+ }
24930
+ const state = {
24931
+ tcp: "missing",
24932
+ decoder: "missing",
24933
+ lastEvent: "init",
24934
+ lastError: "",
24935
+ unloadCount: 0
24936
+ };
24937
+ window.__supraNativeState = state;
24938
+ return state;
24939
+ }
24940
+ function updateNativeState(partialState) {
24941
+ Object.assign(ensureNativeState(), partialState);
24942
+ }
24943
+ function describeError(value) {
24944
+ if (value instanceof Error) {
24945
+ return value.message;
24946
+ }
24947
+ if (typeof value === "string") {
24948
+ return value;
24949
+ }
24950
+ try {
24951
+ return JSON.stringify(value);
24952
+ } catch {
24953
+ return String(value);
24954
+ }
24955
+ }
24875
24956
 
24876
24957
  // screen/nacltcp.ts
24877
24958
  var import_nacl_decoder = __toESM(require_dist2());
@@ -24902,7 +24983,7 @@ async function initSamsungWasmTCP() {
24902
24983
  }
24903
24984
 
24904
24985
  // daemon/plain.ts
24905
- var DAEMON_JS_URL = "supra-client-daemon.js?v=1.0.0-mzbrightsigndecoder.481";
24986
+ var DAEMON_JS_URL = "supra-client-daemon.js?v=1.0.0-mzbrightsigndecoder.482";
24906
24987
  async function startPlainDaemon() {
24907
24988
  initBrightSignTCP();
24908
24989
  await initNaClTCP();
@@ -24916,7 +24997,7 @@ async function startPlainDaemon() {
24916
24997
  }
24917
24998
 
24918
24999
  // daemon/wasm.ts
24919
- var DAEMON_WASM_URL = "supra-client-daemon.wasm?v=1.0.0-mzbrightsigndecoder.481";
25000
+ var DAEMON_WASM_URL = "supra-client-daemon.wasm?v=1.0.0-mzbrightsigndecoder.482";
24920
25001
  async function startWasmDaemon() {
24921
25002
  initBrightSignTCP();
24922
25003
  await initNaClTCP();
@@ -25341,7 +25422,7 @@ function getGoArgv2(binFile, options) {
25341
25422
  }
25342
25423
 
25343
25424
  // screen/plain.ts
25344
- var SCREEN_JS_URL = "supra-client-screen.js?v=1.0.0-mzbrightsigndecoder.481";
25425
+ var SCREEN_JS_URL = "supra-client-screen.js?v=1.0.0-mzbrightsigndecoder.482";
25345
25426
  async function startPlainScreen(options) {
25346
25427
  var _a, _b, _c, _d;
25347
25428
  console.log("[Supra screen plain] initialization begin");
@@ -25403,7 +25484,7 @@ async function startPlainScreen(options) {
25403
25484
  }
25404
25485
 
25405
25486
  // screen/h264decoder.ts
25406
- var H264_DECODER_URL = "h264decoder.js?v=1.0.0-mzbrightsigndecoder.481";
25487
+ var H264_DECODER_URL = "h264decoder.js?v=1.0.0-mzbrightsigndecoder.482";
25407
25488
  async function initH264Decoder() {
25408
25489
  if (window.VideoDecoder !== void 0) {
25409
25490
  return void 0;
@@ -25442,7 +25523,7 @@ function getProperty(value, property) {
25442
25523
  }
25443
25524
 
25444
25525
  // screen/wasm.ts
25445
- var SCREEN_WASM_URL = "supra-client-screen.wasm?v=1.0.0-mzbrightsigndecoder.481";
25526
+ var SCREEN_WASM_URL = "supra-client-screen.wasm?v=1.0.0-mzbrightsigndecoder.482";
25446
25527
  async function initializePhase(name, initialize) {
25447
25528
  const startedAt = Date.now();
25448
25529
  console.log(`[Supra screen WASM] ${name} begin`);