@viji-dev/core 0.3.37 → 0.3.39

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.
@@ -590,7 +590,7 @@ class IFrameManager {
590
590
  }
591
591
  function WorkerWrapper(options) {
592
592
  return new Worker(
593
- "" + new URL("assets/viji.worker-DR0jmwBv.js", import.meta.url).href,
593
+ "" + new URL("assets/viji.worker-BoI8e3NI.js", import.meta.url).href,
594
594
  {
595
595
  type: "module",
596
596
  name: options?.name
@@ -1752,7 +1752,7 @@ class EssentiaOnsetDetection {
1752
1752
  this.initPromise = (async () => {
1753
1753
  try {
1754
1754
  const essentiaModule = await import("./essentia.js-core.es-DnrJE0uR.js");
1755
- const wasmModule = await import("./essentia-wasm.web-Ck3Tig5D.js").then((n) => n.e);
1755
+ const wasmModule = await import("./essentia-wasm.web-CdUmKTbm.js").then((n) => n.e);
1756
1756
  const EssentiaClass = essentiaModule.Essentia || essentiaModule.default?.Essentia || essentiaModule.default;
1757
1757
  let WASMModule = wasmModule.default || wasmModule.EssentiaWASM || wasmModule.default?.EssentiaWASM;
1758
1758
  if (!WASMModule) {
@@ -14596,6 +14596,12 @@ const simdBinary = new URL("assets/wasm/vision_wasm_internal.wasm", import.meta.
14596
14596
  const nosimdLoaderJs = new URL("assets/wasm/vision_wasm_nosimd_internal.js", import.meta.url).href;
14597
14597
  const nosimdBinary = new URL("assets/wasm/vision_wasm_nosimd_internal.wasm", import.meta.url).href;
14598
14598
  const cvWasmUrls = { simdLoaderJs, simdBinary, nosimdLoaderJs, nosimdBinary };
14599
+ function isCoordinateValueEqual(a, b) {
14600
+ if (a && b && typeof a === "object" && typeof b === "object" && "x" in a && "x" in b && "y" in a && "y" in b) {
14601
+ return a.x === b.x && a.y === b.y;
14602
+ }
14603
+ return false;
14604
+ }
14599
14605
  class VijiCore {
14600
14606
  iframeManager = null;
14601
14607
  workerManager = null;
@@ -14738,8 +14744,9 @@ class VijiCore {
14738
14744
  this.latestFrameBuffer = bitmap;
14739
14745
  }
14740
14746
  /**
14741
- * Get latest frame (transfers ownership, zero-copy).
14742
- * Internal: consumed by getLatestFramesFromSources().
14747
+ * Get latest auto-captured frame (transfers ownership, zero-copy).
14748
+ * Caller must call bitmap.close() when done to avoid memory leaks.
14749
+ * Returns null if no frame is available yet.
14743
14750
  */
14744
14751
  getLatestFrame() {
14745
14752
  const frame = this.latestFrameBuffer;
@@ -14753,7 +14760,8 @@ class VijiCore {
14753
14760
  return this.frameSourceCores.map((source) => source.getLatestFrame());
14754
14761
  }
14755
14762
  /**
14756
- * Enable auto-capture with optional format (internal, called by linkFrameSources)
14763
+ * Enable auto-capture. Captured frames are retrieved via getLatestFrame().
14764
+ * @param format.flipY — true for WebGL texture consumers, false for 2D canvas drawImage.
14757
14765
  */
14758
14766
  enableAutoCapture(format) {
14759
14767
  this.autoCaptureEnabled = true;
@@ -14767,7 +14775,7 @@ class VijiCore {
14767
14775
  this.debugLog(`[AutoCapture] ENABLED${formatInfo}`);
14768
14776
  }
14769
14777
  /**
14770
- * Disable auto-capture (internal)
14778
+ * Disable auto-capture and release any pending frame buffer.
14771
14779
  */
14772
14780
  disableAutoCapture() {
14773
14781
  if (!this.autoCaptureEnabled) return;
@@ -14879,6 +14887,9 @@ class VijiCore {
14879
14887
  );
14880
14888
  this.setupCommunication();
14881
14889
  await this.workerManager.createWorker();
14890
+ if (this.isDestroyed) {
14891
+ throw new VijiCoreError("Initialization cancelled", "INITIALIZATION_CANCELLED");
14892
+ }
14882
14893
  try {
14883
14894
  this.config.onRenderStart?.();
14884
14895
  } catch (e) {
@@ -14945,12 +14956,18 @@ class VijiCore {
14945
14956
  displayScale: this.iframeManager.getDisplayScale()
14946
14957
  });
14947
14958
  await this.detectScreenRefreshRate();
14959
+ if (this.isDestroyed) {
14960
+ throw new VijiCoreError("Initialization cancelled", "INITIALIZATION_CANCELLED");
14961
+ }
14948
14962
  this.workerManager.postMessage("refresh-rate-update", {
14949
14963
  screenRefreshRate: this.screenRefreshRate
14950
14964
  });
14951
14965
  if (this.config.audioStream) {
14952
14966
  await this.setAudioStream(this.config.audioStream);
14953
14967
  }
14968
+ if (this.isDestroyed) {
14969
+ throw new VijiCoreError("Initialization cancelled", "INITIALIZATION_CANCELLED");
14970
+ }
14954
14971
  for (let i = 0; i < this.audioStreams.length; i++) {
14955
14972
  const streamIndex = VijiCore.AUDIO_ADDITIONAL_BASE + i;
14956
14973
  await this.audioSystem.addStream(streamIndex, this.audioStreams[i]);
@@ -15168,7 +15185,8 @@ class VijiCore {
15168
15185
  value
15169
15186
  });
15170
15187
  }
15171
- if (oldValue !== value) {
15188
+ const isEqual = paramDef?.type === "coordinate" ? isCoordinateValueEqual(oldValue, value) : oldValue === value;
15189
+ if (!isEqual) {
15172
15190
  this.notifyParameterListeners(name, value);
15173
15191
  }
15174
15192
  }
@@ -15251,7 +15269,9 @@ class VijiCore {
15251
15269
  name,
15252
15270
  value
15253
15271
  });
15254
- if (oldValue !== value) {
15272
+ const paramDef = this.getParameterDefinition(name);
15273
+ const isEqual = paramDef?.type === "coordinate" ? isCoordinateValueEqual(oldValue, value) : oldValue === value;
15274
+ if (!isEqual) {
15255
15275
  changedParams.push({ name, value });
15256
15276
  }
15257
15277
  }
@@ -16447,4 +16467,4 @@ export {
16447
16467
  VijiCoreError as b,
16448
16468
  getDefaultExportFromCjs as g
16449
16469
  };
16450
- //# sourceMappingURL=index-BmeV_yOg.js.map
16470
+ //# sourceMappingURL=index-DZzYWg7c.js.map