@viji-dev/core 0.3.1 → 0.3.2
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/dist/artist-dts-p5.js +1 -1
- package/dist/artist-dts.js +1 -1
- package/dist/artist-global.d.ts +3 -1
- package/dist/artist-js-ambient.d.ts +47 -39
- package/dist/artist-jsdoc.d.ts +47 -39
- package/dist/assets/{viji.worker-Be0jZvYj.js → viji.worker-BGYUuaFF.js} +136 -29
- package/dist/assets/viji.worker-BGYUuaFF.js.map +1 -0
- package/dist/{essentia-wasm.web-D7gmeaO3.js → essentia-wasm.web-Ca8e6Ylt.js} +2 -2
- package/dist/{essentia-wasm.web-D7gmeaO3.js.map → essentia-wasm.web-Ca8e6Ylt.js.map} +1 -1
- package/dist/{index-BV1S8Ps-.js → index-BTtBhJW4.js} +69 -10
- package/dist/index-BTtBhJW4.js.map +1 -0
- package/dist/index.d.ts +24 -1
- package/dist/index.js +1 -1
- package/dist/shader-uniforms.js +125 -0
- package/package.json +1 -1
- package/dist/assets/viji.worker-Be0jZvYj.js.map +0 -1
- package/dist/index-BV1S8Ps-.js.map +0 -1
|
@@ -586,7 +586,7 @@ class IFrameManager {
|
|
|
586
586
|
}
|
|
587
587
|
function WorkerWrapper(options) {
|
|
588
588
|
return new Worker(
|
|
589
|
-
"" + new URL("assets/viji.worker-
|
|
589
|
+
"" + new URL("assets/viji.worker-BGYUuaFF.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-
|
|
1938
|
+
const wasmModule = await import("./essentia-wasm.web-Ca8e6Ylt.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) {
|
|
@@ -14419,7 +14419,8 @@ class DeviceSensorManager {
|
|
|
14419
14419
|
name: device.name,
|
|
14420
14420
|
motion: null,
|
|
14421
14421
|
orientation: null,
|
|
14422
|
-
geolocation: null
|
|
14422
|
+
geolocation: null,
|
|
14423
|
+
video: null
|
|
14423
14424
|
};
|
|
14424
14425
|
this.externalDevices.set(device.id, newDevice);
|
|
14425
14426
|
this.externalDeviceOrder.push(device.id);
|
|
@@ -14537,6 +14538,8 @@ class VijiCore {
|
|
|
14537
14538
|
additionalCoordinators = [];
|
|
14538
14539
|
// Direct frame injection
|
|
14539
14540
|
directFrameSlots = 0;
|
|
14541
|
+
// Device video management (coordinators only, for cleanup)
|
|
14542
|
+
deviceVideoCoordinators = /* @__PURE__ */ new Map();
|
|
14540
14543
|
// Auto-capture frame buffer (zero-copy transfer)
|
|
14541
14544
|
latestFrameBuffer = null;
|
|
14542
14545
|
autoCaptureEnabled = false;
|
|
@@ -14752,7 +14755,7 @@ class VijiCore {
|
|
|
14752
14755
|
this.mainVideoCoordinator.handleVideoStreamUpdate({
|
|
14753
14756
|
videoStream: this.videoStream,
|
|
14754
14757
|
streamIndex: 0,
|
|
14755
|
-
|
|
14758
|
+
streamType: "main",
|
|
14756
14759
|
targetFrameRate: 30,
|
|
14757
14760
|
timestamp: performance.now()
|
|
14758
14761
|
});
|
|
@@ -14771,7 +14774,7 @@ class VijiCore {
|
|
|
14771
14774
|
coordinator.handleVideoStreamUpdate({
|
|
14772
14775
|
videoStream: this.videoStreams[i],
|
|
14773
14776
|
streamIndex: 1 + i,
|
|
14774
|
-
|
|
14777
|
+
streamType: "additional",
|
|
14775
14778
|
targetFrameRate: 30,
|
|
14776
14779
|
timestamp: performance.now()
|
|
14777
14780
|
});
|
|
@@ -15573,7 +15576,7 @@ class VijiCore {
|
|
|
15573
15576
|
this.mainVideoCoordinator.handleVideoStreamUpdate({
|
|
15574
15577
|
videoStream: stream,
|
|
15575
15578
|
streamIndex: 0,
|
|
15576
|
-
|
|
15579
|
+
streamType: "main",
|
|
15577
15580
|
targetFrameRate: 30,
|
|
15578
15581
|
timestamp: performance.now()
|
|
15579
15582
|
});
|
|
@@ -15636,7 +15639,7 @@ class VijiCore {
|
|
|
15636
15639
|
coordinator.handleVideoStreamUpdate({
|
|
15637
15640
|
videoStream: stream,
|
|
15638
15641
|
streamIndex: 1 + newIndex,
|
|
15639
|
-
|
|
15642
|
+
streamType: "additional",
|
|
15640
15643
|
targetFrameRate: 30,
|
|
15641
15644
|
timestamp: performance.now()
|
|
15642
15645
|
});
|
|
@@ -15679,7 +15682,7 @@ class VijiCore {
|
|
|
15679
15682
|
this.additionalCoordinators[index].handleVideoStreamUpdate({
|
|
15680
15683
|
videoStream: stream,
|
|
15681
15684
|
streamIndex: 1 + index,
|
|
15682
|
-
|
|
15685
|
+
streamType: "additional",
|
|
15683
15686
|
targetFrameRate: 30,
|
|
15684
15687
|
timestamp: performance.now()
|
|
15685
15688
|
});
|
|
@@ -15705,7 +15708,7 @@ class VijiCore {
|
|
|
15705
15708
|
coordinator.handleVideoStreamUpdate({
|
|
15706
15709
|
videoStream: this.videoStreams[i],
|
|
15707
15710
|
streamIndex: 1 + i,
|
|
15708
|
-
|
|
15711
|
+
streamType: "additional",
|
|
15709
15712
|
targetFrameRate: 30,
|
|
15710
15713
|
timestamp: performance.now()
|
|
15711
15714
|
});
|
|
@@ -16051,6 +16054,9 @@ class VijiCore {
|
|
|
16051
16054
|
*/
|
|
16052
16055
|
removeExternalDevice(deviceId) {
|
|
16053
16056
|
if (!this.deviceSensorManager) return;
|
|
16057
|
+
if (this.deviceVideoCoordinators.has(deviceId)) {
|
|
16058
|
+
this.clearDeviceVideo(deviceId);
|
|
16059
|
+
}
|
|
16054
16060
|
this.deviceSensorManager.removeExternalDevice(deviceId);
|
|
16055
16061
|
this.syncDeviceStateToWorker();
|
|
16056
16062
|
this.debugLog(`External device removed: ${deviceId}`);
|
|
@@ -16063,6 +16069,55 @@ class VijiCore {
|
|
|
16063
16069
|
if (!this.deviceSensorManager) return [];
|
|
16064
16070
|
return this.deviceSensorManager.getExternalDeviceList();
|
|
16065
16071
|
}
|
|
16072
|
+
// ========================================
|
|
16073
|
+
// Device Video API
|
|
16074
|
+
// ========================================
|
|
16075
|
+
/**
|
|
16076
|
+
* Set video stream for an external device
|
|
16077
|
+
* Device camera will appear in viji.devices[].video
|
|
16078
|
+
* @param deviceId - Device identifier
|
|
16079
|
+
* @param stream - MediaStream from device camera
|
|
16080
|
+
*/
|
|
16081
|
+
async setDeviceVideo(deviceId, stream) {
|
|
16082
|
+
this.validateReady();
|
|
16083
|
+
await this.clearDeviceVideo(deviceId);
|
|
16084
|
+
const baseIndex = this.videoStream ? 1 : 0;
|
|
16085
|
+
const streamIndex = baseIndex + this.videoStreams.length + this.deviceVideoCoordinators.size;
|
|
16086
|
+
const coordinator = new VideoCoordinator((message, transfer) => {
|
|
16087
|
+
if (this.workerManager) {
|
|
16088
|
+
if (message.type === "video-canvas-setup") {
|
|
16089
|
+
message.data.deviceId = deviceId;
|
|
16090
|
+
message.data.streamType = "device";
|
|
16091
|
+
}
|
|
16092
|
+
if (transfer && transfer.length > 0) {
|
|
16093
|
+
this.workerManager.postMessage(message.type, message.data, transfer);
|
|
16094
|
+
} else {
|
|
16095
|
+
this.workerManager.postMessage(message.type, message.data);
|
|
16096
|
+
}
|
|
16097
|
+
}
|
|
16098
|
+
});
|
|
16099
|
+
coordinator.setDebugMode(this.debugMode);
|
|
16100
|
+
coordinator.handleVideoStreamUpdate({
|
|
16101
|
+
videoStream: stream,
|
|
16102
|
+
streamIndex,
|
|
16103
|
+
targetFrameRate: 30,
|
|
16104
|
+
// Same as all other videos
|
|
16105
|
+
timestamp: performance.now()
|
|
16106
|
+
});
|
|
16107
|
+
this.deviceVideoCoordinators.set(deviceId, coordinator);
|
|
16108
|
+
this.debugLog(`Device video set for ${deviceId} at index ${streamIndex}`);
|
|
16109
|
+
}
|
|
16110
|
+
/**
|
|
16111
|
+
* Clear video stream from device
|
|
16112
|
+
* @param deviceId - Device identifier
|
|
16113
|
+
*/
|
|
16114
|
+
async clearDeviceVideo(deviceId) {
|
|
16115
|
+
const coordinator = this.deviceVideoCoordinators.get(deviceId);
|
|
16116
|
+
if (!coordinator) return;
|
|
16117
|
+
coordinator.resetVideoState();
|
|
16118
|
+
this.deviceVideoCoordinators.delete(deviceId);
|
|
16119
|
+
this.debugLog(`Device video cleared for ${deviceId}`);
|
|
16120
|
+
}
|
|
16066
16121
|
/**
|
|
16067
16122
|
* Checks if the core is ready for use
|
|
16068
16123
|
*/
|
|
@@ -16091,6 +16146,10 @@ class VijiCore {
|
|
|
16091
16146
|
this.capabilitiesChangeListeners.clear();
|
|
16092
16147
|
this.unlinkEventSource();
|
|
16093
16148
|
this.unlinkFrameSources();
|
|
16149
|
+
for (const [deviceId] of this.deviceVideoCoordinators) {
|
|
16150
|
+
await this.clearDeviceVideo(deviceId);
|
|
16151
|
+
}
|
|
16152
|
+
this.deviceVideoCoordinators.clear();
|
|
16094
16153
|
if (this.deviceSensorManager) {
|
|
16095
16154
|
this.deviceSensorManager.destroy();
|
|
16096
16155
|
this.deviceSensorManager = null;
|
|
@@ -16177,4 +16236,4 @@ export {
|
|
|
16177
16236
|
VijiCoreError as b,
|
|
16178
16237
|
getDefaultExportFromCjs as g
|
|
16179
16238
|
};
|
|
16180
|
-
//# sourceMappingURL=index-
|
|
16239
|
+
//# sourceMappingURL=index-BTtBhJW4.js.map
|