@viji-dev/core 0.3.36 → 0.3.38

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-W2GOyEnR.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
@@ -598,12 +598,13 @@ function WorkerWrapper(options) {
598
598
  );
599
599
  }
600
600
  class WorkerManager {
601
- constructor(sceneCode, offscreenCanvas, isHeadless = false, initialSC, initialRH) {
601
+ constructor(sceneCode, offscreenCanvas, isHeadless = false, initialSC, initialRH, cvWasmUrls2) {
602
602
  this.sceneCode = sceneCode;
603
603
  this.offscreenCanvas = offscreenCanvas;
604
604
  this.isHeadless = isHeadless;
605
605
  this.initialSC = initialSC;
606
606
  this.initialRH = initialRH;
607
+ this.cvWasmUrls = cvWasmUrls2;
607
608
  }
608
609
  worker = null;
609
610
  messageId = 0;
@@ -773,7 +774,8 @@ class WorkerManager {
773
774
  canvas: this.offscreenCanvas,
774
775
  isHeadless: this.isHeadless,
775
776
  sc: this.initialSC,
776
- rh: this.initialRH
777
+ rh: this.initialRH,
778
+ cvWasmUrls: this.cvWasmUrls
777
779
  }
778
780
  };
779
781
  return new Promise((resolve, reject) => {
@@ -1750,7 +1752,7 @@ class EssentiaOnsetDetection {
1750
1752
  this.initPromise = (async () => {
1751
1753
  try {
1752
1754
  const essentiaModule = await import("./essentia.js-core.es-DnrJE0uR.js");
1753
- const wasmModule = await import("./essentia-wasm.web-1nYWd1Cf.js").then((n) => n.e);
1755
+ const wasmModule = await import("./essentia-wasm.web-CdUmKTbm.js").then((n) => n.e);
1754
1756
  const EssentiaClass = essentiaModule.Essentia || essentiaModule.default?.Essentia || essentiaModule.default;
1755
1757
  let WASMModule = wasmModule.default || wasmModule.EssentiaWASM || wasmModule.default?.EssentiaWASM;
1756
1758
  if (!WASMModule) {
@@ -14589,6 +14591,17 @@ class SceneAnalyzer {
14589
14591
  return "2d";
14590
14592
  }
14591
14593
  }
14594
+ const simdLoaderJs = new URL("assets/wasm/vision_wasm_internal.js", import.meta.url).href;
14595
+ const simdBinary = new URL("assets/wasm/vision_wasm_internal.wasm", import.meta.url).href;
14596
+ const nosimdLoaderJs = new URL("assets/wasm/vision_wasm_nosimd_internal.js", import.meta.url).href;
14597
+ const nosimdBinary = new URL("assets/wasm/vision_wasm_nosimd_internal.wasm", import.meta.url).href;
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
+ }
14592
14605
  class VijiCore {
14593
14606
  iframeManager = null;
14594
14607
  workerManager = null;
@@ -14731,8 +14744,9 @@ class VijiCore {
14731
14744
  this.latestFrameBuffer = bitmap;
14732
14745
  }
14733
14746
  /**
14734
- * Get latest frame (transfers ownership, zero-copy).
14735
- * 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.
14736
14750
  */
14737
14751
  getLatestFrame() {
14738
14752
  const frame = this.latestFrameBuffer;
@@ -14746,7 +14760,8 @@ class VijiCore {
14746
14760
  return this.frameSourceCores.map((source) => source.getLatestFrame());
14747
14761
  }
14748
14762
  /**
14749
- * 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.
14750
14765
  */
14751
14766
  enableAutoCapture(format) {
14752
14767
  this.autoCaptureEnabled = true;
@@ -14760,7 +14775,7 @@ class VijiCore {
14760
14775
  this.debugLog(`[AutoCapture] ENABLED${formatInfo}`);
14761
14776
  }
14762
14777
  /**
14763
- * Disable auto-capture (internal)
14778
+ * Disable auto-capture and release any pending frame buffer.
14764
14779
  */
14765
14780
  disableAutoCapture() {
14766
14781
  if (!this.autoCaptureEnabled) return;
@@ -14867,10 +14882,14 @@ class VijiCore {
14867
14882
  offscreenCanvas,
14868
14883
  this.isHeadless,
14869
14884
  this.config._sc,
14870
- this.config._rh
14885
+ this.config._rh,
14886
+ cvWasmUrls
14871
14887
  );
14872
14888
  this.setupCommunication();
14873
14889
  await this.workerManager.createWorker();
14890
+ if (this.isDestroyed) {
14891
+ throw new VijiCoreError("Initialization cancelled", "INITIALIZATION_CANCELLED");
14892
+ }
14874
14893
  try {
14875
14894
  this.config.onRenderStart?.();
14876
14895
  } catch (e) {
@@ -14937,12 +14956,18 @@ class VijiCore {
14937
14956
  displayScale: this.iframeManager.getDisplayScale()
14938
14957
  });
14939
14958
  await this.detectScreenRefreshRate();
14959
+ if (this.isDestroyed) {
14960
+ throw new VijiCoreError("Initialization cancelled", "INITIALIZATION_CANCELLED");
14961
+ }
14940
14962
  this.workerManager.postMessage("refresh-rate-update", {
14941
14963
  screenRefreshRate: this.screenRefreshRate
14942
14964
  });
14943
14965
  if (this.config.audioStream) {
14944
14966
  await this.setAudioStream(this.config.audioStream);
14945
14967
  }
14968
+ if (this.isDestroyed) {
14969
+ throw new VijiCoreError("Initialization cancelled", "INITIALIZATION_CANCELLED");
14970
+ }
14946
14971
  for (let i = 0; i < this.audioStreams.length; i++) {
14947
14972
  const streamIndex = VijiCore.AUDIO_ADDITIONAL_BASE + i;
14948
14973
  await this.audioSystem.addStream(streamIndex, this.audioStreams[i]);
@@ -15160,7 +15185,8 @@ class VijiCore {
15160
15185
  value
15161
15186
  });
15162
15187
  }
15163
- if (oldValue !== value) {
15188
+ const isEqual = paramDef?.type === "coordinate" ? isCoordinateValueEqual(oldValue, value) : oldValue === value;
15189
+ if (!isEqual) {
15164
15190
  this.notifyParameterListeners(name, value);
15165
15191
  }
15166
15192
  }
@@ -15243,7 +15269,9 @@ class VijiCore {
15243
15269
  name,
15244
15270
  value
15245
15271
  });
15246
- if (oldValue !== value) {
15272
+ const paramDef = this.getParameterDefinition(name);
15273
+ const isEqual = paramDef?.type === "coordinate" ? isCoordinateValueEqual(oldValue, value) : oldValue === value;
15274
+ if (!isEqual) {
15247
15275
  changedParams.push({ name, value });
15248
15276
  }
15249
15277
  }
@@ -16439,4 +16467,4 @@ export {
16439
16467
  VijiCoreError as b,
16440
16468
  getDefaultExportFromCjs as g
16441
16469
  };
16442
- //# sourceMappingURL=index-D3clBOe3.js.map
16470
+ //# sourceMappingURL=index-DZzYWg7c.js.map