@viji-dev/core 0.3.4 → 0.3.6
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/assets/{viji.worker-Cx1WpxdF.js → viji.worker-C3iqy9t2.js} +69 -13
- package/dist/assets/{viji.worker-Cx1WpxdF.js.map → viji.worker-C3iqy9t2.js.map} +1 -1
- package/dist/{essentia-wasm.web-tiEk3E7k.js → essentia-wasm.web-BzzJsZX8.js} +2 -2
- package/dist/{essentia-wasm.web-tiEk3E7k.js.map → essentia-wasm.web-BzzJsZX8.js.map} +1 -1
- package/dist/{index-C45WlX2a.js → index-DwVxY2zV.js} +3 -3
- package/dist/{index-C45WlX2a.js.map → index-DwVxY2zV.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -3444,6 +3444,8 @@ class VijiWorkerRuntime {
|
|
|
3444
3444
|
},
|
|
3445
3445
|
devices: []
|
|
3446
3446
|
};
|
|
3447
|
+
// Map deviceId → streamIndex for O(1) device video lookup
|
|
3448
|
+
deviceVideoMap = /* @__PURE__ */ new Map();
|
|
3447
3449
|
// Video state is now managed by the worker-side VideoSystem
|
|
3448
3450
|
// Artist API object
|
|
3449
3451
|
viji = {
|
|
@@ -3956,6 +3958,19 @@ class VijiWorkerRuntime {
|
|
|
3956
3958
|
case "additional":
|
|
3957
3959
|
this.updateVijiStreams();
|
|
3958
3960
|
break;
|
|
3961
|
+
case "device":
|
|
3962
|
+
if (deviceId) {
|
|
3963
|
+
this.deviceVideoMap.set(deviceId, index);
|
|
3964
|
+
const device = this.viji.devices.find((d) => d.id === deviceId);
|
|
3965
|
+
if (device) {
|
|
3966
|
+
if (device.video) {
|
|
3967
|
+
Object.assign(device.video, videoSystem.getVideoAPI());
|
|
3968
|
+
} else {
|
|
3969
|
+
device.video = videoSystem.getVideoAPI();
|
|
3970
|
+
}
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
break;
|
|
3959
3974
|
}
|
|
3960
3975
|
}
|
|
3961
3976
|
handleVideoFrameUpdate(message) {
|
|
@@ -3966,8 +3981,21 @@ class VijiWorkerRuntime {
|
|
|
3966
3981
|
imageBitmap: message.data.imageBitmap,
|
|
3967
3982
|
timestamp: message.data.timestamp
|
|
3968
3983
|
});
|
|
3969
|
-
|
|
3984
|
+
const streamType = vs.getStreamType();
|
|
3985
|
+
if (streamType === "main") {
|
|
3970
3986
|
Object.assign(this.viji.video, vs.getVideoAPI());
|
|
3987
|
+
} else if (streamType === "device") {
|
|
3988
|
+
const deviceId = vs.getDeviceId();
|
|
3989
|
+
if (deviceId) {
|
|
3990
|
+
const device = this.viji.devices.find((d) => d.id === deviceId);
|
|
3991
|
+
if (device) {
|
|
3992
|
+
if (device.video) {
|
|
3993
|
+
Object.assign(device.video, vs.getVideoAPI());
|
|
3994
|
+
} else {
|
|
3995
|
+
device.video = vs.getVideoAPI();
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
}
|
|
3971
3999
|
}
|
|
3972
4000
|
}
|
|
3973
4001
|
}
|
|
@@ -3975,6 +4003,15 @@ class VijiWorkerRuntime {
|
|
|
3975
4003
|
const index = message.data.streamIndex || 0;
|
|
3976
4004
|
const vs = this.videoSystems[index];
|
|
3977
4005
|
if (vs) {
|
|
4006
|
+
const streamType = vs.getStreamType();
|
|
4007
|
+
const deviceId = vs.getDeviceId();
|
|
4008
|
+
if (message.data.disconnect && streamType === "device" && deviceId) {
|
|
4009
|
+
this.deviceVideoMap.delete(deviceId);
|
|
4010
|
+
const device = this.viji.devices.find((d) => d.id === deviceId);
|
|
4011
|
+
if (device) {
|
|
4012
|
+
device.video = null;
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
3978
4015
|
vs.handleVideoConfigUpdate({
|
|
3979
4016
|
...message.data.targetFrameRate && { targetFrameRate: message.data.targetFrameRate },
|
|
3980
4017
|
...message.data.cvConfig && { cvConfig: message.data.cvConfig },
|
|
@@ -3983,8 +4020,19 @@ class VijiWorkerRuntime {
|
|
|
3983
4020
|
...message.data.disconnect && { disconnect: message.data.disconnect },
|
|
3984
4021
|
timestamp: message.data.timestamp
|
|
3985
4022
|
});
|
|
3986
|
-
if (
|
|
3987
|
-
|
|
4023
|
+
if (!message.data.disconnect) {
|
|
4024
|
+
if (streamType === "main") {
|
|
4025
|
+
Object.assign(this.viji.video, vs.getVideoAPI());
|
|
4026
|
+
} else if (streamType === "device" && deviceId) {
|
|
4027
|
+
const device = this.viji.devices.find((d) => d.id === deviceId);
|
|
4028
|
+
if (device) {
|
|
4029
|
+
if (device.video) {
|
|
4030
|
+
Object.assign(device.video, vs.getVideoAPI());
|
|
4031
|
+
} else {
|
|
4032
|
+
device.video = vs.getVideoAPI();
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
3988
4036
|
}
|
|
3989
4037
|
}
|
|
3990
4038
|
}
|
|
@@ -4227,16 +4275,24 @@ class VijiWorkerRuntime {
|
|
|
4227
4275
|
handleDeviceStateUpdate(message) {
|
|
4228
4276
|
this.deviceState = message.data;
|
|
4229
4277
|
this.viji.device = this.deviceState.device;
|
|
4230
|
-
const
|
|
4231
|
-
const
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4278
|
+
const updatedDevices = this.deviceState.devices.map((deviceData) => {
|
|
4279
|
+
const existingDevice = this.viji.devices.find((d) => d.id === deviceData.id);
|
|
4280
|
+
if (existingDevice) {
|
|
4281
|
+
existingDevice.name = deviceData.name;
|
|
4282
|
+
existingDevice.motion = deviceData.motion;
|
|
4283
|
+
existingDevice.orientation = deviceData.orientation;
|
|
4284
|
+
existingDevice.geolocation = deviceData.geolocation;
|
|
4285
|
+
return existingDevice;
|
|
4286
|
+
} else {
|
|
4287
|
+
const streamIndex = this.deviceVideoMap.get(deviceData.id);
|
|
4288
|
+
const videoSystem = streamIndex !== void 0 ? this.videoSystems[streamIndex] : void 0;
|
|
4289
|
+
return {
|
|
4290
|
+
...deviceData,
|
|
4291
|
+
video: videoSystem ? videoSystem.getVideoAPI() : null
|
|
4292
|
+
};
|
|
4293
|
+
}
|
|
4238
4294
|
});
|
|
4239
|
-
this.viji.devices =
|
|
4295
|
+
this.viji.devices = updatedDevices;
|
|
4240
4296
|
}
|
|
4241
4297
|
}
|
|
4242
4298
|
class SceneAnalyzer {
|
|
@@ -4303,4 +4359,4 @@ async function setSceneCode(sceneCode) {
|
|
|
4303
4359
|
}
|
|
4304
4360
|
}
|
|
4305
4361
|
self.setSceneCode = setSceneCode;
|
|
4306
|
-
//# sourceMappingURL=viji.worker-
|
|
4362
|
+
//# sourceMappingURL=viji.worker-C3iqy9t2.js.map
|