@viji-dev/core 0.3.2 → 0.3.3

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.
@@ -586,7 +586,7 @@ class IFrameManager {
586
586
  }
587
587
  function WorkerWrapper(options) {
588
588
  return new Worker(
589
- "" + new URL("assets/viji.worker-BGYUuaFF.js", import.meta.url).href,
589
+ "" + new URL("assets/viji.worker-Cx1WpxdF.js", import.meta.url).href,
590
590
  {
591
591
  type: "module",
592
592
  name: options?.name
@@ -1935,7 +1935,7 @@ class EssentiaOnsetDetection {
1935
1935
  this.initPromise = (async () => {
1936
1936
  try {
1937
1937
  const essentiaModule = await import("./essentia.js-core.es-DnrJE0uR.js");
1938
- const wasmModule = await import("./essentia-wasm.web-Ca8e6Ylt.js").then((n) => n.e);
1938
+ const wasmModule = await import("./essentia-wasm.web-CQFnoLoE.js").then((n) => n.e);
1939
1939
  const EssentiaClass = essentiaModule.Essentia || essentiaModule.default?.Essentia || essentiaModule.default;
1940
1940
  let WASMModule = wasmModule.default || wasmModule.EssentiaWASM || wasmModule.default?.EssentiaWASM;
1941
1941
  if (!WASMModule) {
@@ -14031,6 +14031,8 @@ class VideoCoordinator {
14031
14031
  hasTransferredCanvas = false;
14032
14032
  // Callback to send data to worker
14033
14033
  sendToWorker = null;
14034
+ // Stream identification for multi-stream support
14035
+ streamIndex = 0;
14034
14036
  // Debug logging control
14035
14037
  debugMode = false;
14036
14038
  /**
@@ -14063,6 +14065,9 @@ class VideoCoordinator {
14063
14065
  */
14064
14066
  handleVideoStreamUpdate(data) {
14065
14067
  try {
14068
+ if (data.streamIndex !== void 0) {
14069
+ this.streamIndex = data.streamIndex;
14070
+ }
14066
14071
  if (data.videoStream) {
14067
14072
  this.setVideoStream(data.videoStream);
14068
14073
  } else {
@@ -14166,13 +14171,15 @@ class VideoCoordinator {
14166
14171
  offscreenCanvas,
14167
14172
  width,
14168
14173
  height,
14169
- timestamp: performance.now()
14174
+ timestamp: performance.now(),
14175
+ streamIndex: this.streamIndex
14170
14176
  }
14171
14177
  }, [offscreenCanvas]);
14172
14178
  this.hasTransferredCanvas = true;
14173
14179
  this.debugLog("✅ OffscreenCanvas transferred to worker (correct approach)", {
14174
14180
  width,
14175
- height
14181
+ height,
14182
+ streamIndex: this.streamIndex
14176
14183
  });
14177
14184
  }
14178
14185
  } catch (error) {
@@ -14291,7 +14298,8 @@ class VideoCoordinator {
14291
14298
  type: "video-frame-update",
14292
14299
  data: {
14293
14300
  imageBitmap,
14294
- timestamp: performance.now()
14301
+ timestamp: performance.now(),
14302
+ streamIndex: this.streamIndex
14295
14303
  }
14296
14304
  }, [imageBitmap]);
14297
14305
  }
@@ -14303,7 +14311,10 @@ class VideoCoordinator {
14303
14311
  if (this.sendToWorker) {
14304
14312
  this.sendToWorker({
14305
14313
  type: "video-config-update",
14306
- data: config
14314
+ data: {
14315
+ ...config,
14316
+ streamIndex: this.streamIndex
14317
+ }
14307
14318
  });
14308
14319
  }
14309
14320
  }
@@ -14744,6 +14755,9 @@ class VijiCore {
14744
14755
  if (this.videoStream) {
14745
14756
  this.mainVideoCoordinator = new VideoCoordinator((message, transfer) => {
14746
14757
  if (this.workerManager) {
14758
+ if (message.type === "video-canvas-setup") {
14759
+ message.data.streamType = "main";
14760
+ }
14747
14761
  if (transfer && transfer.length > 0) {
14748
14762
  this.workerManager.postMessage(message.type, message.data, transfer);
14749
14763
  } else {
@@ -14761,8 +14775,12 @@ class VijiCore {
14761
14775
  });
14762
14776
  }
14763
14777
  for (let i = 0; i < this.videoStreams.length; i++) {
14778
+ const streamIndex = 1 + i;
14764
14779
  const coordinator = new VideoCoordinator((message, transfer) => {
14765
14780
  if (this.workerManager) {
14781
+ if (message.type === "video-canvas-setup") {
14782
+ message.data.streamType = "additional";
14783
+ }
14766
14784
  if (transfer && transfer.length > 0) {
14767
14785
  this.workerManager.postMessage(message.type, message.data, transfer);
14768
14786
  } else {
@@ -14773,7 +14791,7 @@ class VijiCore {
14773
14791
  coordinator.setDebugMode(this.debugMode);
14774
14792
  coordinator.handleVideoStreamUpdate({
14775
14793
  videoStream: this.videoStreams[i],
14776
- streamIndex: 1 + i,
14794
+ streamIndex,
14777
14795
  streamType: "additional",
14778
14796
  targetFrameRate: 30,
14779
14797
  timestamp: performance.now()
@@ -15565,6 +15583,9 @@ class VijiCore {
15565
15583
  if (stream && this.workerManager) {
15566
15584
  this.mainVideoCoordinator = new VideoCoordinator((message, transfer) => {
15567
15585
  if (this.workerManager) {
15586
+ if (message.type === "video-canvas-setup") {
15587
+ message.data.streamType = "main";
15588
+ }
15568
15589
  if (transfer && transfer.length > 0) {
15569
15590
  this.workerManager.postMessage(message.type, message.data, transfer);
15570
15591
  } else {
@@ -15626,8 +15647,12 @@ class VijiCore {
15626
15647
  if (existingIndex !== -1) return existingIndex;
15627
15648
  this.videoStreams.push(stream);
15628
15649
  const newIndex = this.videoStreams.length - 1;
15650
+ const streamIndex = 1 + newIndex;
15629
15651
  const coordinator = new VideoCoordinator((message, transfer) => {
15630
15652
  if (this.workerManager) {
15653
+ if (message.type === "video-canvas-setup") {
15654
+ message.data.streamType = "additional";
15655
+ }
15631
15656
  if (transfer && transfer.length > 0) {
15632
15657
  this.workerManager.postMessage(message.type, message.data, transfer);
15633
15658
  } else {
@@ -15638,7 +15663,7 @@ class VijiCore {
15638
15663
  coordinator.setDebugMode(this.debugMode);
15639
15664
  coordinator.handleVideoStreamUpdate({
15640
15665
  videoStream: stream,
15641
- streamIndex: 1 + newIndex,
15666
+ streamIndex,
15642
15667
  streamType: "additional",
15643
15668
  targetFrameRate: 30,
15644
15669
  timestamp: performance.now()
@@ -15695,8 +15720,12 @@ class VijiCore {
15695
15720
  this.additionalCoordinators.forEach((coord) => coord.resetVideoState());
15696
15721
  this.additionalCoordinators = [];
15697
15722
  for (let i = 0; i < this.videoStreams.length; i++) {
15723
+ const streamIndex = 1 + i;
15698
15724
  const coordinator = new VideoCoordinator((message, transfer) => {
15699
15725
  if (this.workerManager) {
15726
+ if (message.type === "video-canvas-setup") {
15727
+ message.data.streamType = "additional";
15728
+ }
15700
15729
  if (transfer && transfer.length > 0) {
15701
15730
  this.workerManager.postMessage(message.type, message.data, transfer);
15702
15731
  } else {
@@ -15707,7 +15736,7 @@ class VijiCore {
15707
15736
  coordinator.setDebugMode(this.debugMode);
15708
15737
  coordinator.handleVideoStreamUpdate({
15709
15738
  videoStream: this.videoStreams[i],
15710
- streamIndex: 1 + i,
15739
+ streamIndex,
15711
15740
  streamType: "additional",
15712
15741
  targetFrameRate: 30,
15713
15742
  timestamp: performance.now()
@@ -16236,4 +16265,4 @@ export {
16236
16265
  VijiCoreError as b,
16237
16266
  getDefaultExportFromCjs as g
16238
16267
  };
16239
- //# sourceMappingURL=index-BTtBhJW4.js.map
16268
+ //# sourceMappingURL=index-BJPrSm-g.js.map