@camera.ui/browser 0.1.9 → 0.1.11
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/index.d.ts +2 -0
- package/dist/index.js +66 -76
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -265,6 +265,7 @@ export declare interface CameraUiContext {
|
|
|
265
265
|
extraProxyQuery: Readonly<Ref<Record<string, string> | undefined>>;
|
|
266
266
|
error: Readonly<Ref<Error | undefined>>;
|
|
267
267
|
wsTransport?: WsTransport;
|
|
268
|
+
iceServers?: Readonly<Ref<RTCIceServer[] | undefined>>;
|
|
268
269
|
on: (event: CameraUiEventType, cb: CameraUiEventCallback) => void;
|
|
269
270
|
off: (event: CameraUiEventType, cb: CameraUiEventCallback) => void;
|
|
270
271
|
}
|
|
@@ -280,6 +281,7 @@ export declare interface CameraUiPluginInput {
|
|
|
280
281
|
bulkTransport?: NatsTransport;
|
|
281
282
|
target: Ref<ConnectionTarget | null>;
|
|
282
283
|
wsTransport?: WsTransport;
|
|
284
|
+
iceServers?: Readonly<Ref<RTCIceServer[] | undefined>>;
|
|
283
285
|
}
|
|
284
286
|
|
|
285
287
|
/* Excluded from this release type: CarbonDioxideInfoProperties */
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { tryOnScopeDispose, useTimeoutFn, whenever } from "@vueuse/core";
|
|
|
4
4
|
import { SensorType } from "@camera.ui/sdk";
|
|
5
5
|
import { isNoRespondersError } from "@camera.ui/rpc";
|
|
6
6
|
import { classifyClose } from "@camera.ui/transport";
|
|
7
|
-
|
|
7
|
+
// src/utils/createDebouncedCache.ts
|
|
8
8
|
function createDebouncedCache(options = {}) {
|
|
9
9
|
const { releaseDelay = 1e3, onRelease } = options;
|
|
10
10
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -85,8 +85,7 @@ function createDebouncedCache(options = {}) {
|
|
|
85
85
|
forEachValue
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
//#region src/utils/createRetryTimer.ts
|
|
88
|
+
// src/utils/createRetryTimer.ts
|
|
90
89
|
var RETRY_MIN_MS = 1e3;
|
|
91
90
|
var RETRY_MAX_MS$1 = 3e4;
|
|
92
91
|
function createRetryTimer() {
|
|
@@ -113,23 +112,20 @@ function createRetryTimer() {
|
|
|
113
112
|
reset
|
|
114
113
|
};
|
|
115
114
|
}
|
|
116
|
-
|
|
117
|
-
//#region src/composables/useCameraUi.ts
|
|
115
|
+
// src/composables/useCameraUi.ts
|
|
118
116
|
function useCameraUi() {
|
|
119
117
|
const context = inject(CAMERA_UI_INJECTION_KEY);
|
|
120
118
|
if (!context) throw new Error("[camera.ui] useCameraUi() called without CameraUiPlugin installed. Make sure to call app.use(createCameraUiPlugin({ ... })) before using this composable.");
|
|
121
119
|
return context;
|
|
122
120
|
}
|
|
123
|
-
|
|
124
|
-
//#region ../../externals/camera.ui/server/src/utils/camera.ts
|
|
121
|
+
// ../../externals/camera.ui/server/src/utils/camera.ts
|
|
125
122
|
function normalizeCameraName(name) {
|
|
126
123
|
return name.replace(/ /g, "_").toLowerCase();
|
|
127
124
|
}
|
|
128
125
|
function createSourceName(cameraName, sourceName) {
|
|
129
126
|
return `cui_${normalizeCameraName(cameraName)}_${normalizeCameraName(sourceName)}`;
|
|
130
127
|
}
|
|
131
|
-
|
|
132
|
-
//#region ../../externals/camera.ui/server/src/rpc/namespaces.ts
|
|
128
|
+
// ../../externals/camera.ui/server/src/rpc/namespaces.ts
|
|
133
129
|
var NamespaceManager = class {
|
|
134
130
|
static coreManagerNamespaces() {
|
|
135
131
|
return {
|
|
@@ -251,8 +247,7 @@ var NamespaceManager = class {
|
|
|
251
247
|
return "workers.logs";
|
|
252
248
|
}
|
|
253
249
|
};
|
|
254
|
-
|
|
255
|
-
//#region src/composables/useRpc.ts
|
|
250
|
+
// src/composables/useRpc.ts
|
|
256
251
|
var DEFAULT_MAX_RETRIES = 3;
|
|
257
252
|
var DEFAULT_CONNECT_TIMEOUT_MS = 3e4;
|
|
258
253
|
var LINK_SETTLE_MS = 3e4;
|
|
@@ -488,8 +483,7 @@ function makeAbortError() {
|
|
|
488
483
|
err.name = "AbortError";
|
|
489
484
|
return err;
|
|
490
485
|
}
|
|
491
|
-
|
|
492
|
-
//#region src/composables/bulkLane.ts
|
|
486
|
+
// src/composables/bulkLane.ts
|
|
493
487
|
var PROBE_TIMEOUT_MS = 2e3;
|
|
494
488
|
var RECHECK_AFTER_MS = 6e4;
|
|
495
489
|
var deadMarks = /* @__PURE__ */ new WeakMap();
|
|
@@ -544,8 +538,7 @@ function clearMark(lane) {
|
|
|
544
538
|
deadMarks.get(lane)?.stop();
|
|
545
539
|
deadMarks.delete(lane);
|
|
546
540
|
}
|
|
547
|
-
|
|
548
|
-
//#region src/composables/useTabVisibility.ts
|
|
541
|
+
// src/composables/useTabVisibility.ts
|
|
549
542
|
var DEFAULT_TAB_PAUSE_MS = 3e4;
|
|
550
543
|
var log$2 = new Logger("TabVisibility");
|
|
551
544
|
var _isVisible = ref(typeof document === "undefined" ? true : document.visibilityState === "visible");
|
|
@@ -662,8 +655,7 @@ function useTabVisibility() {
|
|
|
662
655
|
onTabVisible
|
|
663
656
|
};
|
|
664
657
|
}
|
|
665
|
-
|
|
666
|
-
//#region src/composables/useSnapshot.ts
|
|
658
|
+
// src/composables/useSnapshot.ts
|
|
667
659
|
var REVOKE_DELAY_MS = 5e3;
|
|
668
660
|
var SERVER_CLOCK_STEP_MS = 6e4;
|
|
669
661
|
var REFRESH_LINGER_MS = 500;
|
|
@@ -998,8 +990,7 @@ function useSnapshot(cameraIdOrName) {
|
|
|
998
990
|
refresh
|
|
999
991
|
};
|
|
1000
992
|
}
|
|
1001
|
-
|
|
1002
|
-
//#region src/composables/useCamera.ts
|
|
993
|
+
// src/composables/useCamera.ts
|
|
1003
994
|
var NOT_MODIFIED = "not-modified";
|
|
1004
995
|
var CLOCK_SAMPLE_MAX_MS = 5e3;
|
|
1005
996
|
var snapshotWithMetaSupport = /* @__PURE__ */ new WeakMap();
|
|
@@ -1386,8 +1377,7 @@ function leaveSensorEvents(client, fanout, handler) {
|
|
|
1386
1377
|
if (sensorEventFanouts.get(client) === fanout) sensorEventFanouts.delete(client);
|
|
1387
1378
|
fanout.subscribed.then((off) => off()).catch(() => {});
|
|
1388
1379
|
}
|
|
1389
|
-
|
|
1390
|
-
//#region src/composables/useDeviceManager.ts
|
|
1380
|
+
// src/composables/useDeviceManager.ts
|
|
1391
1381
|
function useDeviceManager() {
|
|
1392
1382
|
const ctx = useCameraUi();
|
|
1393
1383
|
const namespaces = NamespaceManager.deviceManagerNamespaces();
|
|
@@ -1397,8 +1387,7 @@ function useDeviceManager() {
|
|
|
1397
1387
|
}
|
|
1398
1388
|
return { getCamera };
|
|
1399
1389
|
}
|
|
1400
|
-
|
|
1401
|
-
//#region src/composables/useCameraById.ts
|
|
1390
|
+
// src/composables/useCameraById.ts
|
|
1402
1391
|
var cameraCache = createDebouncedCache({
|
|
1403
1392
|
releaseDelay: 1e3,
|
|
1404
1393
|
onRelease: (_key, device) => device.close()
|
|
@@ -1571,8 +1560,7 @@ function useCameraById(cameraIdOrName) {
|
|
|
1571
1560
|
refresh
|
|
1572
1561
|
};
|
|
1573
1562
|
}
|
|
1574
|
-
|
|
1575
|
-
//#region src/composables/resolvePluginId.ts
|
|
1563
|
+
// src/composables/resolvePluginId.ts
|
|
1576
1564
|
var pluginIdCache = /* @__PURE__ */ new Map();
|
|
1577
1565
|
var pluginNames = /* @__PURE__ */ new Map();
|
|
1578
1566
|
var pendingResolves = /* @__PURE__ */ new Map();
|
|
@@ -1603,8 +1591,7 @@ async function resolvePluginId(rpcRef, pluginName) {
|
|
|
1603
1591
|
pendingResolves.set(pluginName, promise);
|
|
1604
1592
|
return promise;
|
|
1605
1593
|
}
|
|
1606
|
-
|
|
1607
|
-
//#region src/composables/useOAuth.ts
|
|
1594
|
+
// src/composables/useOAuth.ts
|
|
1608
1595
|
var POLL_ACTIVE_MS = 1500;
|
|
1609
1596
|
var POLL_IDLE_MS = 3e4;
|
|
1610
1597
|
var oauthStates = /* @__PURE__ */ new Map();
|
|
@@ -1719,8 +1706,7 @@ function useOAuth(pluginName) {
|
|
|
1719
1706
|
refresh
|
|
1720
1707
|
};
|
|
1721
1708
|
}
|
|
1722
|
-
|
|
1723
|
-
//#region src/composables/usePlugin.ts
|
|
1709
|
+
// src/composables/usePlugin.ts
|
|
1724
1710
|
var RETRY_BASE_MS = 2e3;
|
|
1725
1711
|
var RETRY_MAX_MS = 3e4;
|
|
1726
1712
|
var pluginCache = createDebouncedCache({ releaseDelay: 1e3 });
|
|
@@ -2051,15 +2037,13 @@ function usePlugin(pluginName, options = {}) {
|
|
|
2051
2037
|
refresh
|
|
2052
2038
|
};
|
|
2053
2039
|
}
|
|
2054
|
-
|
|
2055
|
-
//#region src/composables/utils.ts
|
|
2040
|
+
// src/composables/utils.ts
|
|
2056
2041
|
function extractCameraId(camera) {
|
|
2057
2042
|
if (!camera) return void 0;
|
|
2058
2043
|
if (typeof camera === "string") return camera;
|
|
2059
2044
|
return camera.id;
|
|
2060
2045
|
}
|
|
2061
|
-
|
|
2062
|
-
//#region src/composables/useSensor.ts
|
|
2046
|
+
// src/composables/useSensor.ts
|
|
2063
2047
|
function createSensorTypeGuard(sensorType) {
|
|
2064
2048
|
return (sensor) => sensor.type === sensorType;
|
|
2065
2049
|
}
|
|
@@ -2893,8 +2877,7 @@ function useClassifierSensors(camera) {
|
|
|
2893
2877
|
error
|
|
2894
2878
|
};
|
|
2895
2879
|
}
|
|
2896
|
-
|
|
2897
|
-
//#region src/composables/useStorage.ts
|
|
2880
|
+
// src/composables/useStorage.ts
|
|
2898
2881
|
function createReactiveStorage(proxy, client) {
|
|
2899
2882
|
const config = shallowRef();
|
|
2900
2883
|
const isLoading = ref(false);
|
|
@@ -3405,8 +3388,7 @@ function useSensorStorage(sensorId, pluginId) {
|
|
|
3405
3388
|
submitValue: operations.submitValue
|
|
3406
3389
|
};
|
|
3407
3390
|
}
|
|
3408
|
-
|
|
3409
|
-
//#region src/composables/resetClientState.ts
|
|
3391
|
+
// src/composables/resetClientState.ts
|
|
3410
3392
|
function resetClientState() {
|
|
3411
3393
|
clearPluginCache();
|
|
3412
3394
|
clearCameraCache();
|
|
@@ -3424,8 +3406,7 @@ function refreshClientStates() {
|
|
|
3424
3406
|
forgetPluginStatus();
|
|
3425
3407
|
refreshAllCameraDevices();
|
|
3426
3408
|
}
|
|
3427
|
-
|
|
3428
|
-
//#region src/plugin.ts
|
|
3409
|
+
// src/plugin.ts
|
|
3429
3410
|
var CAMERA_UI_INJECTION_KEY = Symbol("camera-ui");
|
|
3430
3411
|
var log$1 = new Logger("plugin");
|
|
3431
3412
|
function isContext(input) {
|
|
@@ -3433,7 +3414,7 @@ function isContext(input) {
|
|
|
3433
3414
|
}
|
|
3434
3415
|
var DOWN_DEBOUNCE_MS = 4e3;
|
|
3435
3416
|
function makeContextFromTransport(input) {
|
|
3436
|
-
const { natsTransport, bulkTransport, target, wsTransport } = input;
|
|
3417
|
+
const { natsTransport, bulkTransport, target, wsTransport, iceServers } = input;
|
|
3437
3418
|
let hasBeenConnected = natsTransport.getClient() !== null;
|
|
3438
3419
|
let lastClient = natsTransport.getClient();
|
|
3439
3420
|
let downTimer = null;
|
|
@@ -3525,6 +3506,7 @@ function makeContextFromTransport(input) {
|
|
|
3525
3506
|
extraProxyQuery,
|
|
3526
3507
|
error: readonly(error),
|
|
3527
3508
|
wsTransport,
|
|
3509
|
+
iceServers,
|
|
3528
3510
|
on,
|
|
3529
3511
|
off
|
|
3530
3512
|
});
|
|
@@ -3535,8 +3517,7 @@ function createCameraUiPlugin(input) {
|
|
|
3535
3517
|
app.provide(CAMERA_UI_INJECTION_KEY, ctx);
|
|
3536
3518
|
} };
|
|
3537
3519
|
}
|
|
3538
|
-
|
|
3539
|
-
//#region src/streaming/activityMode.ts
|
|
3520
|
+
// src/streaming/activityMode.ts
|
|
3540
3521
|
var DEFAULT_CONFIG = {
|
|
3541
3522
|
standbyTimeout: 5e3,
|
|
3542
3523
|
activityTimeout: 5e3,
|
|
@@ -3681,8 +3662,7 @@ function createActivityMode(options) {
|
|
|
3681
3662
|
dispose
|
|
3682
3663
|
};
|
|
3683
3664
|
}
|
|
3684
|
-
|
|
3685
|
-
//#region src/streaming/config.ts
|
|
3665
|
+
// src/streaming/config.ts
|
|
3686
3666
|
var STREAM_CONFIG = {
|
|
3687
3667
|
WEBRTC: {
|
|
3688
3668
|
RECONNECT_DELAY: 1e3,
|
|
@@ -3719,8 +3699,7 @@ var STREAM_CONFIG = {
|
|
|
3719
3699
|
]
|
|
3720
3700
|
}
|
|
3721
3701
|
};
|
|
3722
|
-
|
|
3723
|
-
//#region src/streaming/mjpeg.ts
|
|
3702
|
+
// src/streaming/mjpeg.ts
|
|
3724
3703
|
function isJpegFrame(data) {
|
|
3725
3704
|
if (data.byteLength < 2) return false;
|
|
3726
3705
|
const bytes = new Uint8Array(data, 0, 2);
|
|
@@ -3779,8 +3758,7 @@ function createMJPEGHandler(options) {
|
|
|
3779
3758
|
close
|
|
3780
3759
|
};
|
|
3781
3760
|
}
|
|
3782
|
-
|
|
3783
|
-
//#region src/streaming/fmp4.ts
|
|
3761
|
+
// src/streaming/fmp4.ts
|
|
3784
3762
|
var MOOV = 1836019574;
|
|
3785
3763
|
var TRAK = 1953653099;
|
|
3786
3764
|
var TKHD = 1953196132;
|
|
@@ -3936,8 +3914,7 @@ function scanRun(view, start, end, fragment, onKeyframe) {
|
|
|
3936
3914
|
}
|
|
3937
3915
|
return time;
|
|
3938
3916
|
}
|
|
3939
|
-
|
|
3940
|
-
//#region src/streaming/utils.ts
|
|
3917
|
+
// src/streaming/utils.ts
|
|
3941
3918
|
var H265_TEST_CODEC = "hvc1.1.6.L153.B0";
|
|
3942
3919
|
function safariVersion() {
|
|
3943
3920
|
return navigator.userAgent.match(/version\/(\d+)/i);
|
|
@@ -4044,8 +4021,7 @@ function abortableSleep(ms, signal) {
|
|
|
4044
4021
|
}, { once: true });
|
|
4045
4022
|
});
|
|
4046
4023
|
}
|
|
4047
|
-
|
|
4048
|
-
//#region src/streaming/mse.ts
|
|
4024
|
+
// src/streaming/mse.ts
|
|
4049
4025
|
var CUT_MARGIN = .001;
|
|
4050
4026
|
var MAX_KEYFRAMES = 256;
|
|
4051
4027
|
var LIVE_EDGE_MARGIN = .3;
|
|
@@ -4305,13 +4281,22 @@ async function playVideo(videoElement) {
|
|
|
4305
4281
|
}
|
|
4306
4282
|
}
|
|
4307
4283
|
}
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4284
|
+
// src/streaming/webrtc.ts
|
|
4285
|
+
function newPeerConnection(iceServers = [...STREAM_CONFIG.WEBRTC.ICE_SERVERS]) {
|
|
4286
|
+
try {
|
|
4287
|
+
return new RTCPeerConnection({
|
|
4288
|
+
bundlePolicy: "max-bundle",
|
|
4289
|
+
iceServers
|
|
4290
|
+
});
|
|
4291
|
+
} catch {
|
|
4292
|
+
return new RTCPeerConnection({
|
|
4293
|
+
bundlePolicy: "max-bundle",
|
|
4294
|
+
iceServers: [...STREAM_CONFIG.WEBRTC.ICE_SERVERS]
|
|
4295
|
+
});
|
|
4296
|
+
}
|
|
4297
|
+
}
|
|
4298
|
+
function createBasePeerConnection(signal, onCandidate, filterUdp, iceServers) {
|
|
4299
|
+
const peerConnection = newPeerConnection(iceServers);
|
|
4315
4300
|
peerConnection.onicecandidate = (ev) => {
|
|
4316
4301
|
if (signal.aborted) return;
|
|
4317
4302
|
if (filterUdp && ev.candidate?.protocol === "udp") return;
|
|
@@ -4354,7 +4339,7 @@ function closePeerConnection(state) {
|
|
|
4354
4339
|
state.isConnected = false;
|
|
4355
4340
|
}
|
|
4356
4341
|
function createWebRTCHandler(options) {
|
|
4357
|
-
const { mode, onConnected, onDisconnected, onFailed, onCandidate, signal } = options;
|
|
4342
|
+
const { mode, iceServers, onConnected, onDisconnected, onFailed, onCandidate, signal } = options;
|
|
4358
4343
|
const state = {
|
|
4359
4344
|
pc: null,
|
|
4360
4345
|
micTransceiver: null,
|
|
@@ -4362,7 +4347,7 @@ function createWebRTCHandler(options) {
|
|
|
4362
4347
|
};
|
|
4363
4348
|
const filterUdp = mode === "webrtc/tcp";
|
|
4364
4349
|
function createPeerConnection() {
|
|
4365
|
-
const peerConnection = createBasePeerConnection(signal, onCandidate, filterUdp);
|
|
4350
|
+
const peerConnection = createBasePeerConnection(signal, onCandidate, filterUdp, iceServers);
|
|
4366
4351
|
peerConnection.onconnectionstatechange = () => {
|
|
4367
4352
|
if (signal.aborted) return;
|
|
4368
4353
|
const connectionState = peerConnection.connectionState;
|
|
@@ -4407,7 +4392,7 @@ function createWebRTCHandler(options) {
|
|
|
4407
4392
|
};
|
|
4408
4393
|
}
|
|
4409
4394
|
function createBackchannelHandler(options) {
|
|
4410
|
-
const { filterUdp, onConnected, onFailed, onCandidate, signal } = options;
|
|
4395
|
+
const { filterUdp, iceServers, onConnected, onFailed, onCandidate, signal } = options;
|
|
4411
4396
|
const state = {
|
|
4412
4397
|
pc: null,
|
|
4413
4398
|
micTransceiver: null,
|
|
@@ -4429,7 +4414,7 @@ function createBackchannelHandler(options) {
|
|
|
4429
4414
|
});
|
|
4430
4415
|
}
|
|
4431
4416
|
function createPeerConnection() {
|
|
4432
|
-
const peerConnection = createBasePeerConnection(signal, sendCandidate, filterUdp);
|
|
4417
|
+
const peerConnection = createBasePeerConnection(signal, sendCandidate, filterUdp, iceServers);
|
|
4433
4418
|
peerConnection.onconnectionstatechange = () => {
|
|
4434
4419
|
if (signal.aborted) return;
|
|
4435
4420
|
const connectionState = peerConnection.connectionState;
|
|
@@ -4475,8 +4460,7 @@ async function processWebRTCMessage(handler, msg) {
|
|
|
4475
4460
|
case "webrtc/candidate": if (msg.value) await handler.handleCandidate(msg.value);
|
|
4476
4461
|
}
|
|
4477
4462
|
}
|
|
4478
|
-
|
|
4479
|
-
//#region src/streaming/streamConnection.ts
|
|
4463
|
+
// src/streaming/streamConnection.ts
|
|
4480
4464
|
var log = new Logger("StreamConnection");
|
|
4481
4465
|
var MSE_AUDIO_CODEC = /mp4a|opus|flac|mp3/i;
|
|
4482
4466
|
var RETRY_BASE_DELAY = 1e3;
|
|
@@ -4525,6 +4509,7 @@ var StreamConnection = class {
|
|
|
4525
4509
|
triedSourceIds = /* @__PURE__ */ new Set();
|
|
4526
4510
|
options;
|
|
4527
4511
|
wsTransport;
|
|
4512
|
+
iceServers;
|
|
4528
4513
|
scope = effectScope(true);
|
|
4529
4514
|
stopsWhenHidden = suspendsWhenHidden();
|
|
4530
4515
|
connectionGeneration = 0;
|
|
@@ -4580,6 +4565,7 @@ var StreamConnection = class {
|
|
|
4580
4565
|
if (!ctx.wsTransport) throw new Error("[camera.ui] StreamConnection requires a wsTransport on CameraUiContext — pass `wsTransport` to createCameraUiPlugin.");
|
|
4581
4566
|
this.target = ctx.target;
|
|
4582
4567
|
this.wsTransport = ctx.wsTransport;
|
|
4568
|
+
this.iceServers = ctx.iceServers;
|
|
4583
4569
|
const { autoStart = true } = options;
|
|
4584
4570
|
this.status = ref("idle");
|
|
4585
4571
|
this.activeMode = ref("webrtc");
|
|
@@ -5383,6 +5369,7 @@ var StreamConnection = class {
|
|
|
5383
5369
|
this.startConnectTimeout();
|
|
5384
5370
|
const handler = createWebRTCHandler({
|
|
5385
5371
|
mode,
|
|
5372
|
+
iceServers: this.iceServers?.value,
|
|
5386
5373
|
signal: this.abortController.signal,
|
|
5387
5374
|
onConnected: (stream) => this.handleWebRTCConnected(stream),
|
|
5388
5375
|
onDisconnected: () => this.handleWebRTCDisconnected(),
|
|
@@ -5721,6 +5708,7 @@ var StreamConnection = class {
|
|
|
5721
5708
|
if (this.webrtcHandler && (!this.webrtcHandler.isConnected || this.awaitingWebRTCFrame)) return;
|
|
5722
5709
|
const handler = createBackchannelHandler({
|
|
5723
5710
|
filterUdp: this.requestedMode.value === "webrtc/tcp",
|
|
5711
|
+
iceServers: this.iceServers?.value,
|
|
5724
5712
|
signal: this.abortController.signal,
|
|
5725
5713
|
onCandidate: (candidate) => this.sendWsMessage({
|
|
5726
5714
|
type: "webrtc/candidate",
|
|
@@ -5770,8 +5758,7 @@ var StreamConnection = class {
|
|
|
5770
5758
|
function createStreamConnection(options) {
|
|
5771
5759
|
return new StreamConnection(options);
|
|
5772
5760
|
}
|
|
5773
|
-
|
|
5774
|
-
//#region src/streaming/streamManager.ts
|
|
5761
|
+
// src/streaming/streamManager.ts
|
|
5775
5762
|
var StreamManager = class {
|
|
5776
5763
|
streams = /* @__PURE__ */ new Map();
|
|
5777
5764
|
standalone = /* @__PURE__ */ new Set();
|
|
@@ -5932,8 +5919,7 @@ var streamManager = new StreamManager();
|
|
|
5932
5919
|
function restartConnectedStreams() {
|
|
5933
5920
|
return streamManager.restartConnected();
|
|
5934
5921
|
}
|
|
5935
|
-
|
|
5936
|
-
//#region src/composables/useFullscreen.ts
|
|
5922
|
+
// src/composables/useFullscreen.ts
|
|
5937
5923
|
var fsRegistry = /* @__PURE__ */ new WeakMap();
|
|
5938
5924
|
var fullscreenRoot = null;
|
|
5939
5925
|
function setFullscreenRoot(el) {
|
|
@@ -6056,8 +6042,7 @@ function applyWrapperStyles(wrapper, mode) {
|
|
|
6056
6042
|
overscrollBehavior: "contain"
|
|
6057
6043
|
});
|
|
6058
6044
|
}
|
|
6059
|
-
|
|
6060
|
-
//#region src/composables/useCameraStream.ts
|
|
6045
|
+
// src/composables/useCameraStream.ts
|
|
6061
6046
|
var AUTO_STAGGER_STEP_MS = 75;
|
|
6062
6047
|
var AUTO_STAGGER_RESET_MS = 500;
|
|
6063
6048
|
var OFFSCREEN_STOP_DELAY_MS = 1e4;
|
|
@@ -6330,6 +6315,14 @@ function useCameraStream(options) {
|
|
|
6330
6315
|
isUsingCachedStream.value = true;
|
|
6331
6316
|
currentStream.value = cached.stream;
|
|
6332
6317
|
if (camDevice && cached.cameraDeviceRef) cached.cameraDeviceRef.value = camDevice;
|
|
6318
|
+
const resolution = toValue(options.resolution) ?? "high-resolution";
|
|
6319
|
+
if (cached.stream.requestedResolution.value !== resolution) {
|
|
6320
|
+
streamManager.updateMediaStream(camName, null);
|
|
6321
|
+
cached.stream.setResolution(resolution);
|
|
6322
|
+
}
|
|
6323
|
+
cleanupFns.push(watch(() => toValue(options.resolution), (role) => {
|
|
6324
|
+
if (role) cached.stream.setResolution(role);
|
|
6325
|
+
}));
|
|
6333
6326
|
let video = cached.sharedVideoElement;
|
|
6334
6327
|
if (!video) {
|
|
6335
6328
|
video = createVideoElement();
|
|
@@ -6718,8 +6711,7 @@ function useCameraStream(options) {
|
|
|
6718
6711
|
captureScreenshot
|
|
6719
6712
|
};
|
|
6720
6713
|
}
|
|
6721
|
-
|
|
6722
|
-
//#region src/composables/useCoreManager.ts
|
|
6714
|
+
// src/composables/useCoreManager.ts
|
|
6723
6715
|
function useCoreManager() {
|
|
6724
6716
|
const ctx = useCameraUi();
|
|
6725
6717
|
const namespaces = NamespaceManager.coreManagerNamespaces();
|
|
@@ -6733,8 +6725,7 @@ function useCoreManager() {
|
|
|
6733
6725
|
getInstanceId: () => rpcCall(ctx.rpc, (rpc) => proxy(rpc).getInstanceId())
|
|
6734
6726
|
};
|
|
6735
6727
|
}
|
|
6736
|
-
|
|
6737
|
-
//#region src/composables/useTerminal.ts
|
|
6728
|
+
// src/composables/useTerminal.ts
|
|
6738
6729
|
function useTerminal() {
|
|
6739
6730
|
const cameraUi = useCameraUi();
|
|
6740
6731
|
const { rpc, isConnected: isClientConnected } = cameraUi;
|
|
@@ -6893,5 +6884,4 @@ function useTerminal() {
|
|
|
6893
6884
|
close
|
|
6894
6885
|
};
|
|
6895
6886
|
}
|
|
6896
|
-
//#endregion
|
|
6897
6887
|
export { CAMERA_UI_INJECTION_KEY, NamespaceManager, STREAM_CONFIG, acquireSensorManager, clearCameraCache, clearOAuthCache, clearPluginCache, clearSensorCache, clearSnapshotCache, clearStorageCache, createActivityMode, createCameraUiPlugin, createReactiveCameraDevice, createSensorManager, getSnapshotUrl, isReactiveAudioSensor, isReactiveBatteryInfo, isReactiveCarbonDioxideInfo, isReactiveCarbonMonoxideSensor, isReactiveClassifierSensor, isReactiveColdSensor, isReactiveContactSensor, isReactiveDoorbellTrigger, isReactiveFaceSensor, isReactiveGarageControl, isReactiveGasSensor, isReactiveHeatSensor, isReactiveHumidityInfo, isReactiveIlluminanceInfo, isReactiveLeakSensor, isReactiveLicensePlateSensor, isReactiveLightControl, isReactiveLockControl, isReactiveMotionSensor, isReactiveObjectSensor, isReactiveOccupancySensor, isReactivePTZControl, isReactivePowerSensor, isReactiveProblemSensor, isReactiveSecuritySystem, isReactiveSirenControl, isReactiveSmokeSensor, isReactiveSwitchControl, isReactiveTamperSensor, isReactiveTemperatureInfo, isReactiveVibrationSensor, refreshClientSubscriptions, releaseSensorManager, resetClientState, restartConnectedStreams, rpcCall, setFullscreenRoot, useAllSensors, useAudioSensor, useCameraById, useCameraStorage, useCameraStream, useCameraUi, useClassifierSensors, useCoreManager, useCuiFullscreen, useDeviceManager, useFaceSensor, useLicensePlateSensor, useMotionSensor, useOAuth, useObjectSensor, usePTZControl, usePlugin, usePluginStorage, useRpcCall, useRpcSubscription, useSensorById, useSensorByType, useSensorStorage, useSensors, useSensorsByType, useSnapshot, useTabVisibility, useTerminal, useTopmostFullscreenElement };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "camera.ui browser client",
|
|
5
5
|
"author": "seydx (https://github.com/cameraui/clients)",
|
|
6
6
|
"type": "module",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"typescript-eslint": "^8.72.1",
|
|
63
63
|
"unplugin-dts": "^1.1.2",
|
|
64
64
|
"updates": "^20.0.0",
|
|
65
|
-
"vite": "^8.3.
|
|
65
|
+
"vite": "^8.3.6",
|
|
66
66
|
"vitest": "^5.1.0",
|
|
67
|
-
"vue": "^3.5.
|
|
67
|
+
"vue": "^3.5.45",
|
|
68
68
|
"vue-tsc": "3.3.11"
|
|
69
69
|
},
|
|
70
70
|
"overrides": {
|