@viji-dev/core 0.3.10 → 0.3.12

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.
@@ -49,7 +49,6 @@ class IFrameManager {
49
49
  activeTouchIds = /* @__PURE__ */ new Set();
50
50
  // Device sensor support
51
51
  deviceSensorCallback = null;
52
- geolocationWatchId = null;
53
52
  /**
54
53
  * Creates a secure IFrame with proper sandbox attributes
55
54
  */
@@ -200,7 +199,7 @@ class IFrameManager {
200
199
  // Device Sensor Support
201
200
  // ========================================
202
201
  /**
203
- * Setup device sensor listeners (motion, orientation, geolocation)
202
+ * Setup device sensor listeners (motion, orientation)
204
203
  * @param callback Callback to receive sensor data updates
205
204
  */
206
205
  setupDeviceSensors(callback) {
@@ -212,19 +211,6 @@ class IFrameManager {
212
211
  }
213
212
  win.addEventListener("devicemotion", this.handleDeviceMotion.bind(this));
214
213
  win.addEventListener("deviceorientation", this.handleDeviceOrientation.bind(this));
215
- if (navigator.geolocation) {
216
- this.geolocationWatchId = navigator.geolocation.watchPosition(
217
- this.handleGeolocation.bind(this),
218
- (error) => {
219
- this.debugLog("Geolocation error:", error.message);
220
- },
221
- {
222
- enableHighAccuracy: true,
223
- maximumAge: 0,
224
- timeout: 5e3
225
- }
226
- );
227
- }
228
214
  this.debugLog("Device sensors setup complete");
229
215
  }
230
216
  /**
@@ -270,32 +256,11 @@ class IFrameManager {
270
256
  this.deviceSensorCallback({ orientation: orientationData });
271
257
  }
272
258
  }
273
- /**
274
- * Handle geolocation position updates
275
- */
276
- handleGeolocation(position) {
277
- const geolocationData = {
278
- latitude: position.coords.latitude,
279
- longitude: position.coords.longitude,
280
- altitude: position.coords.altitude,
281
- accuracy: position.coords.accuracy,
282
- altitudeAccuracy: position.coords.altitudeAccuracy,
283
- heading: position.coords.heading,
284
- speed: position.coords.speed
285
- };
286
- if (this.deviceSensorCallback) {
287
- this.deviceSensorCallback({ geolocation: geolocationData });
288
- }
289
- }
290
259
  /**
291
260
  * Destroys the IFrame and cleans up resources
292
261
  */
293
262
  destroy() {
294
263
  try {
295
- if (this.geolocationWatchId !== null) {
296
- navigator.geolocation.clearWatch(this.geolocationWatchId);
297
- this.geolocationWatchId = null;
298
- }
299
264
  if (this.iframe) {
300
265
  if (this.iframe.src.startsWith("blob:")) {
301
266
  URL.revokeObjectURL(this.iframe.src);
@@ -586,7 +551,7 @@ class IFrameManager {
586
551
  }
587
552
  function WorkerWrapper(options) {
588
553
  return new Worker(
589
- "" + new URL("assets/viji.worker-Dq0mIiTV.js", import.meta.url).href,
554
+ "" + new URL("assets/viji.worker-DTTIvWDe.js", import.meta.url).href,
590
555
  {
591
556
  type: "module",
592
557
  name: options?.name
@@ -1935,7 +1900,7 @@ class EssentiaOnsetDetection {
1935
1900
  this.initPromise = (async () => {
1936
1901
  try {
1937
1902
  const essentiaModule = await import("./essentia.js-core.es-DnrJE0uR.js");
1938
- const wasmModule = await import("./essentia-wasm.web-B3Bvwffq.js").then((n) => n.e);
1903
+ const wasmModule = await import("./essentia-wasm.web-wuvxiRYm.js").then((n) => n.e);
1939
1904
  const EssentiaClass = essentiaModule.Essentia || essentiaModule.default?.Essentia || essentiaModule.default;
1940
1905
  let WASMModule = wasmModule.default || wasmModule.EssentiaWASM || wasmModule.default?.EssentiaWASM;
1941
1906
  if (!WASMModule) {
@@ -14413,12 +14378,6 @@ class DeviceSensorManager {
14413
14378
  updateInternalOrientation(data) {
14414
14379
  this.internalDevice.orientation = data;
14415
14380
  }
14416
- /**
14417
- * Update internal device geolocation data
14418
- */
14419
- updateInternalGeolocation(data) {
14420
- this.internalDevice.geolocation = data;
14421
- }
14422
14381
  // ========================================
14423
14382
  // External Devices (WebRTC/Sockets)
14424
14383
  // ========================================
@@ -14435,7 +14394,6 @@ class DeviceSensorManager {
14435
14394
  name: device.name,
14436
14395
  motion: null,
14437
14396
  orientation: null,
14438
- geolocation: null,
14439
14397
  video: null
14440
14398
  };
14441
14399
  this.externalDevices.set(device.id, newDevice);
@@ -14454,7 +14412,6 @@ class DeviceSensorManager {
14454
14412
  if (update.name !== void 0) device.name = update.name;
14455
14413
  if (update.motion !== void 0) device.motion = update.motion;
14456
14414
  if (update.orientation !== void 0) device.orientation = update.orientation;
14457
- if (update.geolocation !== void 0) device.geolocation = update.geolocation;
14458
14415
  return true;
14459
14416
  }
14460
14417
  /**
@@ -14504,8 +14461,7 @@ class DeviceSensorManager {
14504
14461
  createEmptyDeviceSensorState() {
14505
14462
  return {
14506
14463
  motion: null,
14507
- orientation: null,
14508
- geolocation: null
14464
+ orientation: null
14509
14465
  };
14510
14466
  }
14511
14467
  /**
@@ -14544,11 +14500,17 @@ class VijiCore {
14544
14500
  isHeadless = false;
14545
14501
  // Audio stream management
14546
14502
  currentAudioStream = null;
14503
+ // ═══════════════════════════════════════════════════════════════════════════
14504
+ // VIDEO STREAM INDEX CONTRACT:
14505
+ // Index 0: ALWAYS reserved for main video (with CV) - even when absent
14506
+ // Index 1..N: Additional streams (no CV) - where N = videoStreams.length
14507
+ // Index N+1..: Device streams - dynamically allocated, tracked in deviceVideoStreamIndices
14508
+ // ═══════════════════════════════════════════════════════════════════════════
14547
14509
  // Separated video stream management
14548
14510
  videoStream = null;
14549
- // Main stream (CV enabled)
14511
+ // Main stream (CV enabled) - always index 0
14550
14512
  videoStreams = [];
14551
- // Additional streams (no CV)
14513
+ // Additional streams (no CV) - indices 1..N
14552
14514
  // Video coordinators
14553
14515
  mainVideoCoordinator = null;
14554
14516
  additionalCoordinators = [];
@@ -14556,7 +14518,7 @@ class VijiCore {
14556
14518
  directFrameSlots = 0;
14557
14519
  // Device video management (coordinators only, for cleanup)
14558
14520
  deviceVideoCoordinators = /* @__PURE__ */ new Map();
14559
- // Track assigned stream indices to prevent collisions on reconnect
14521
+ // Track assigned stream indices to prevent collisions (indices start at 1 + videoStreams.length)
14560
14522
  deviceVideoStreamIndices = /* @__PURE__ */ new Map();
14561
14523
  // Auto-capture frame buffer (zero-copy transfer)
14562
14524
  latestFrameBuffer = null;
@@ -14903,9 +14865,6 @@ class VijiCore {
14903
14865
  if (sensorData.orientation) {
14904
14866
  this.deviceSensorManager.updateInternalOrientation(sensorData.orientation);
14905
14867
  }
14906
- if (sensorData.geolocation) {
14907
- this.deviceSensorManager.updateInternalGeolocation(sensorData.geolocation);
14908
- }
14909
14868
  this.syncDeviceStateToWorker();
14910
14869
  });
14911
14870
  }
@@ -16117,7 +16076,7 @@ class VijiCore {
16117
16076
  async setDeviceVideo(deviceId, stream) {
16118
16077
  this.validateReady();
16119
16078
  await this.clearDeviceVideo(deviceId);
16120
- const baseOffset = (this.videoStream ? 1 : 0) + this.videoStreams.length;
16079
+ const baseOffset = 1 + this.videoStreams.length;
16121
16080
  const usedIndices = new Set(this.deviceVideoStreamIndices.values());
16122
16081
  let streamIndex = baseOffset;
16123
16082
  while (usedIndices.has(streamIndex)) {
@@ -16281,4 +16240,4 @@ export {
16281
16240
  VijiCoreError as b,
16282
16241
  getDefaultExportFromCjs as g
16283
16242
  };
16284
- //# sourceMappingURL=index-aXKP9TJe.js.map
16243
+ //# sourceMappingURL=index-Cj4pl_5w.js.map