@camera.ui/browser 0.0.120 → 0.0.121
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.js +30 -42
- package/package.json +13 -12
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Logger } from "@camera.ui/logger";
|
|
1
2
|
import { computed, inject, markRaw, onBeforeUnmount, reactive, readonly, ref, shallowRef, toValue, watch } from "vue";
|
|
2
3
|
import { tryOnScopeDispose, useTimeoutFn, whenever } from "@vueuse/core";
|
|
3
4
|
import { SensorType } from "@camera.ui/sdk";
|
|
@@ -1823,6 +1824,7 @@ function refreshClientSubscriptions() {
|
|
|
1823
1824
|
//#endregion
|
|
1824
1825
|
//#region src/plugin.ts
|
|
1825
1826
|
var CAMERA_UI_INJECTION_KEY = Symbol("camera-ui");
|
|
1827
|
+
var log$2 = new Logger("plugin");
|
|
1826
1828
|
function isContext(input) {
|
|
1827
1829
|
return "rpc" in input && "isConnected" in input;
|
|
1828
1830
|
}
|
|
@@ -1857,7 +1859,7 @@ function makeContextFromTransport(input) {
|
|
|
1857
1859
|
for (const cb of set) try {
|
|
1858
1860
|
cb();
|
|
1859
1861
|
} catch (err) {
|
|
1860
|
-
|
|
1862
|
+
log$2.warn("context listener threw:", err);
|
|
1861
1863
|
}
|
|
1862
1864
|
}
|
|
1863
1865
|
natsTransport.subscribeClient((next) => {
|
|
@@ -2034,14 +2036,7 @@ function createActivityMode(options) {
|
|
|
2034
2036
|
//#endregion
|
|
2035
2037
|
//#region src/composables/useTabVisibility.ts
|
|
2036
2038
|
var DEFAULT_TAB_PAUSE_MS = 3e4;
|
|
2037
|
-
|
|
2038
|
-
const d = /* @__PURE__ */ new Date();
|
|
2039
|
-
const hh = String(d.getHours()).padStart(2, "0");
|
|
2040
|
-
const mm = String(d.getMinutes()).padStart(2, "0");
|
|
2041
|
-
const ss = String(d.getSeconds()).padStart(2, "0");
|
|
2042
|
-
const ms = String(d.getMilliseconds()).padStart(3, "0");
|
|
2043
|
-
console.log(`[TabVisibility ${hh}:${mm}:${ss}.${ms}]`, ...args);
|
|
2044
|
-
}
|
|
2039
|
+
var log$1 = new Logger("TabVisibility");
|
|
2045
2040
|
var _isVisible = ref(typeof document === "undefined" ? true : document.visibilityState === "visible");
|
|
2046
2041
|
var _hiddenAt = null;
|
|
2047
2042
|
var _hiddenListeners = /* @__PURE__ */ new Set();
|
|
@@ -2049,19 +2044,19 @@ var _pausedListeners = /* @__PURE__ */ new Set();
|
|
|
2049
2044
|
var _visibleListeners = /* @__PURE__ */ new Set();
|
|
2050
2045
|
var _initialized = false;
|
|
2051
2046
|
function _firePausedEntry(entry) {
|
|
2052
|
-
log$1(`paused listener fired (delay ${entry.delayMs}ms reached)`);
|
|
2047
|
+
log$1.debug(`paused listener fired (delay ${entry.delayMs}ms reached)`);
|
|
2053
2048
|
try {
|
|
2054
2049
|
entry.cb();
|
|
2055
2050
|
} catch (err) {
|
|
2056
|
-
|
|
2051
|
+
log$1.error("onTabPaused listener threw:", err);
|
|
2057
2052
|
}
|
|
2058
2053
|
}
|
|
2059
2054
|
function _schedulePausedEntry(entry) {
|
|
2060
|
-
log$1(`paused listener scheduled in ${entry.delayMs}ms`);
|
|
2055
|
+
log$1.debug(`paused listener scheduled in ${entry.delayMs}ms`);
|
|
2061
2056
|
entry.timer = setTimeout(() => {
|
|
2062
2057
|
entry.timer = null;
|
|
2063
2058
|
if (_isVisible.value) {
|
|
2064
|
-
log$1("paused listener skipped — tab visible before delay");
|
|
2059
|
+
log$1.debug("paused listener skipped — tab visible before delay");
|
|
2065
2060
|
return;
|
|
2066
2061
|
}
|
|
2067
2062
|
_firePausedEntry(entry);
|
|
@@ -2081,11 +2076,11 @@ function _init() {
|
|
|
2081
2076
|
if (!visible && _isVisible.value) {
|
|
2082
2077
|
_isVisible.value = false;
|
|
2083
2078
|
_hiddenAt = Date.now();
|
|
2084
|
-
log$1(`tab → hidden (hidden=${_hiddenListeners.size} paused=${_pausedListeners.size})`);
|
|
2079
|
+
log$1.debug(`tab → hidden (hidden=${_hiddenListeners.size} paused=${_pausedListeners.size})`);
|
|
2085
2080
|
for (const entry of _hiddenListeners) try {
|
|
2086
2081
|
entry.cb();
|
|
2087
2082
|
} catch (err) {
|
|
2088
|
-
|
|
2083
|
+
log$1.error("onTabHidden listener threw:", err);
|
|
2089
2084
|
}
|
|
2090
2085
|
for (const entry of _pausedListeners) _schedulePausedEntry(entry);
|
|
2091
2086
|
} else if (visible && !_isVisible.value) {
|
|
@@ -2093,11 +2088,11 @@ function _init() {
|
|
|
2093
2088
|
const hiddenMs = _hiddenAt != null ? Date.now() - _hiddenAt : 0;
|
|
2094
2089
|
_hiddenAt = null;
|
|
2095
2090
|
_isVisible.value = true;
|
|
2096
|
-
log$1(`tab → visible (hiddenMs=${hiddenMs}, visible-listeners=${_visibleListeners.size})`);
|
|
2091
|
+
log$1.debug(`tab → visible (hiddenMs=${hiddenMs}, visible-listeners=${_visibleListeners.size})`);
|
|
2097
2092
|
for (const { cb } of _visibleListeners) try {
|
|
2098
2093
|
cb({ hiddenMs });
|
|
2099
2094
|
} catch (err) {
|
|
2100
|
-
|
|
2095
|
+
log$1.error("onTabVisible listener threw:", err);
|
|
2101
2096
|
}
|
|
2102
2097
|
}
|
|
2103
2098
|
});
|
|
@@ -2576,14 +2571,7 @@ async function processWebRTCMessage(handler, msg) {
|
|
|
2576
2571
|
}
|
|
2577
2572
|
//#endregion
|
|
2578
2573
|
//#region src/streaming/streamConnection.ts
|
|
2579
|
-
|
|
2580
|
-
const d = /* @__PURE__ */ new Date();
|
|
2581
|
-
const hh = String(d.getHours()).padStart(2, "0");
|
|
2582
|
-
const mm = String(d.getMinutes()).padStart(2, "0");
|
|
2583
|
-
const ss = String(d.getSeconds()).padStart(2, "0");
|
|
2584
|
-
const ms = String(d.getMilliseconds()).padStart(3, "0");
|
|
2585
|
-
console.log(`[StreamConnection ${hh}:${mm}:${ss}.${ms}]`, ...args);
|
|
2586
|
-
}
|
|
2574
|
+
var log = new Logger("StreamConnection");
|
|
2587
2575
|
var StreamConnection = class {
|
|
2588
2576
|
status;
|
|
2589
2577
|
activeMode;
|
|
@@ -2691,19 +2679,19 @@ var StreamConnection = class {
|
|
|
2691
2679
|
this.stopReconnectTimeout = stopReconnectTimeout;
|
|
2692
2680
|
this.setupWatchers();
|
|
2693
2681
|
this.offTabPaused = onTabPaused(() => {
|
|
2694
|
-
log(`onTabPaused fired — status=${this.status.value}, isReady=${this.isReady.value}, target=${!!this.target.value}`);
|
|
2682
|
+
log.debug(`onTabPaused fired — status=${this.status.value}, isReady=${this.isReady.value}, target=${!!this.target.value}`);
|
|
2695
2683
|
if (this.status.value === "idle" || this.status.value === "closed") {
|
|
2696
|
-
log(`onTabPaused — already in ${this.status.value}, skipping stop()`);
|
|
2684
|
+
log.debug(`onTabPaused — already in ${this.status.value}, skipping stop()`);
|
|
2697
2685
|
return;
|
|
2698
2686
|
}
|
|
2699
2687
|
this.wasPausedByVisibility = true;
|
|
2700
2688
|
this.stop();
|
|
2701
|
-
log("onTabPaused — stop() done, wasPausedByVisibility=true");
|
|
2689
|
+
log.debug("onTabPaused — stop() done, wasPausedByVisibility=true");
|
|
2702
2690
|
});
|
|
2703
2691
|
this.offTabVisible = onTabVisible(() => {
|
|
2704
|
-
log(`onTabVisible fired — wasPausedByVisibility=${this.wasPausedByVisibility}, status=${this.status.value}, isReady=${this.isReady.value}, target=${!!this.target.value}`);
|
|
2692
|
+
log.debug(`onTabVisible fired — wasPausedByVisibility=${this.wasPausedByVisibility}, status=${this.status.value}, isReady=${this.isReady.value}, target=${!!this.target.value}`);
|
|
2705
2693
|
if (!this.wasPausedByVisibility) {
|
|
2706
|
-
log("onTabVisible — not paused by visibility, no-op");
|
|
2694
|
+
log.debug("onTabVisible — not paused by visibility, no-op");
|
|
2707
2695
|
return;
|
|
2708
2696
|
}
|
|
2709
2697
|
this.wasPausedByVisibility = false;
|
|
@@ -2714,13 +2702,13 @@ var StreamConnection = class {
|
|
|
2714
2702
|
}, { immediate: true });
|
|
2715
2703
|
}
|
|
2716
2704
|
async start() {
|
|
2717
|
-
log(`start() called — status=${this.status.value}, isReady=${this.isReady.value}`);
|
|
2705
|
+
log.debug(`start() called — status=${this.status.value}, isReady=${this.isReady.value}`);
|
|
2718
2706
|
if (this.status.value !== "idle" && this.status.value !== "closed") {
|
|
2719
|
-
log(`start() — skipped, status is ${this.status.value}`);
|
|
2707
|
+
log.debug(`start() — skipped, status is ${this.status.value}`);
|
|
2720
2708
|
return;
|
|
2721
2709
|
}
|
|
2722
2710
|
if (!this.isReady.value) {
|
|
2723
|
-
log("start() — skipped, isReady=false");
|
|
2711
|
+
log.debug("start() — skipped, isReady=false");
|
|
2724
2712
|
return;
|
|
2725
2713
|
}
|
|
2726
2714
|
this.cleanup();
|
|
@@ -2731,32 +2719,32 @@ var StreamConnection = class {
|
|
|
2731
2719
|
this.isPlaying.value = false;
|
|
2732
2720
|
try {
|
|
2733
2721
|
if (!this.initializeSource()) {
|
|
2734
|
-
log("start() — no streaming source available");
|
|
2722
|
+
log.debug("start() — no streaming source available");
|
|
2735
2723
|
this.error.value = /* @__PURE__ */ new Error("No streaming source available");
|
|
2736
2724
|
this.status.value = "error";
|
|
2737
2725
|
return;
|
|
2738
2726
|
}
|
|
2739
2727
|
await this.probeStream();
|
|
2740
2728
|
if (gen !== this.connectionGeneration) {
|
|
2741
|
-
log("start() — generation stale after probe, aborting");
|
|
2729
|
+
log.debug("start() — generation stale after probe, aborting");
|
|
2742
2730
|
return;
|
|
2743
2731
|
}
|
|
2744
2732
|
this.initializeSource();
|
|
2745
|
-
log("start() — connecting WebSocket");
|
|
2733
|
+
log.debug("start() — connecting WebSocket");
|
|
2746
2734
|
this.connectWebSocket();
|
|
2747
2735
|
} catch (err) {
|
|
2748
2736
|
if (gen !== this.connectionGeneration) return;
|
|
2749
|
-
log("start() — error:", err);
|
|
2737
|
+
log.debug("start() — error:", err);
|
|
2750
2738
|
this.error.value = err instanceof Error ? err : new Error(String(err));
|
|
2751
2739
|
this.status.value = "error";
|
|
2752
2740
|
}
|
|
2753
2741
|
}
|
|
2754
2742
|
stop() {
|
|
2755
2743
|
if (this.status.value === "closed") {
|
|
2756
|
-
log("stop() — already closed, no-op");
|
|
2744
|
+
log.debug("stop() — already closed, no-op");
|
|
2757
2745
|
return;
|
|
2758
2746
|
}
|
|
2759
|
-
log(`stop() — was ${this.status.value}, transitioning to closed`);
|
|
2747
|
+
log.debug(`stop() — was ${this.status.value}, transitioning to closed`);
|
|
2760
2748
|
++this.connectionGeneration;
|
|
2761
2749
|
this.status.value = "closed";
|
|
2762
2750
|
this.cleanup();
|
|
@@ -2855,14 +2843,14 @@ var StreamConnection = class {
|
|
|
2855
2843
|
}
|
|
2856
2844
|
startWhenReady() {
|
|
2857
2845
|
if (this.isReady.value) {
|
|
2858
|
-
log("startWhenReady — already ready, calling start() now");
|
|
2846
|
+
log.debug("startWhenReady — already ready, calling start() now");
|
|
2859
2847
|
this.start();
|
|
2860
2848
|
return;
|
|
2861
2849
|
}
|
|
2862
|
-
log(`startWhenReady — not ready (camera=${!!this.camera.value}, video=${!!this.videoElement.value}, target=${!!this.target.value}), watching isReady`);
|
|
2850
|
+
log.debug(`startWhenReady — not ready (camera=${!!this.camera.value}, video=${!!this.videoElement.value}, target=${!!this.target.value}), watching isReady`);
|
|
2863
2851
|
const stop = watch(this.isReady, (ready) => {
|
|
2864
2852
|
if (!ready) return;
|
|
2865
|
-
log("startWhenReady — isReady → true, calling start()");
|
|
2853
|
+
log.debug("startWhenReady — isReady → true, calling start()");
|
|
2866
2854
|
stop();
|
|
2867
2855
|
this.start();
|
|
2868
2856
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/browser",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.121",
|
|
4
4
|
"description": "camera.ui browser client",
|
|
5
5
|
"author": "seydx (https://github.com/cameraui/clients)",
|
|
6
6
|
"type": "module",
|
|
@@ -21,49 +21,50 @@
|
|
|
21
21
|
"dev": "vite build --watch",
|
|
22
22
|
"format": "prettier --write 'src/' --ignore-unknown --no-error-on-unmatched-pattern",
|
|
23
23
|
"install-updates": "npm i --save",
|
|
24
|
-
"lint": "eslint .",
|
|
25
|
-
"
|
|
26
|
-
"prepublishOnly": "npm i --package-lock-only && npm run lint:fix && npm run format && npm run build",
|
|
24
|
+
"lint": "eslint --fix .",
|
|
25
|
+
"prepublishOnly": "npm i --package-lock-only && npm run lint && npm run format && npm run build",
|
|
27
26
|
"test": "vitest run --passWithNoTests",
|
|
28
27
|
"test:watch": "vitest",
|
|
29
28
|
"update": "updates --update ./"
|
|
30
29
|
},
|
|
31
30
|
"peerDependencies": {
|
|
31
|
+
"@camera.ui/logger": ">=0.0.2",
|
|
32
32
|
"@camera.ui/rpc": ">=1.0.4",
|
|
33
|
-
"@camera.ui/sdk": ">=0.0.
|
|
33
|
+
"@camera.ui/sdk": ">=0.0.11",
|
|
34
34
|
"@camera.ui/transport": ">=0.0.1",
|
|
35
35
|
"@vueuse/core": ">=14.3.0",
|
|
36
36
|
"vue": ">=3.5.39"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
+
"@camera.ui/logger": "file:../../packages/logger",
|
|
39
40
|
"@camera.ui/rpc": "^1.0.4",
|
|
40
|
-
"@camera.ui/sdk": "~0.0.
|
|
41
|
+
"@camera.ui/sdk": "~0.0.11",
|
|
41
42
|
"@camera.ui/transport": "file:../../packages/transport",
|
|
42
43
|
"@eneris/push-receiver": "^4.3.1",
|
|
43
44
|
"@microsoft/api-extractor": "^7.58.9",
|
|
44
45
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
45
46
|
"@types/webrtc": "^0.0.47",
|
|
46
|
-
"@typescript-eslint/parser": "^8.62.
|
|
47
|
+
"@typescript-eslint/parser": "^8.62.1",
|
|
47
48
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
48
49
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
49
50
|
"@vue/eslint-config-typescript": "^14.9.0",
|
|
50
|
-
"@vue/language-core": "^3.3.
|
|
51
|
+
"@vue/language-core": "^3.3.6",
|
|
51
52
|
"@vue/tsconfig": "^0.9.1",
|
|
52
53
|
"@vueuse/core": "^14.3.0",
|
|
53
54
|
"@webgpu/types": "^0.1.71",
|
|
54
55
|
"eslint": "9.39.2",
|
|
55
56
|
"eslint-plugin-vue": "^10.9.2",
|
|
56
57
|
"globals": "^17.7.0",
|
|
57
|
-
"prettier": "^3.9.
|
|
58
|
+
"prettier": "^3.9.4",
|
|
58
59
|
"rimraf": "^6.1.3",
|
|
59
60
|
"typescript": "5.9.3",
|
|
60
|
-
"typescript-eslint": "^8.62.
|
|
61
|
+
"typescript-eslint": "^8.62.1",
|
|
61
62
|
"unplugin-dts": "^1.0.3",
|
|
62
63
|
"updates": "^17.18.1",
|
|
63
|
-
"vite": "^8.1.
|
|
64
|
+
"vite": "^8.1.2",
|
|
64
65
|
"vitest": "^4.1.9",
|
|
65
66
|
"vue": "^3.5.39",
|
|
66
|
-
"vue-tsc": "^3.3.
|
|
67
|
+
"vue-tsc": "^3.3.6"
|
|
67
68
|
},
|
|
68
69
|
"overrides": {
|
|
69
70
|
"@vue/language-core": "$@vue/language-core"
|