@7365admin1/layer-common 4.161.1 → 4.161.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.161.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7436e3d: CCTV Engine live view: the 10-second limit now covers the whole start of live video, including asking the engine for it, so a recorder that is slow to open another stream shows the still picture after 10 seconds instead of "Connecting" for half a minute.
8
+
3
9
  ## 4.161.1
4
10
 
5
11
  ### Patch Changes
@@ -3662,11 +3668,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
3662
3668
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
3663
3669
  own rule from two endpoints the console already calls, unprojected:
3664
3670
 
3665
- GET /api/members/user/:user/app/admin the Seven365 staff membership
3666
- GET /api/roles/id/:role that membership's role document
3671
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
3672
+ GET /api/roles/id/:role that membership's role document
3667
3673
 
3668
- owner = member.type === "admin" && role.type === "admin" && role.default === true
3669
- staff = member.type === "admin" && role.type === "admin"
3674
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
3675
+ staff = member.type === "admin" && role.type === "admin"
3670
3676
 
3671
3677
  `role.default` is the marker because it is the only property of a platform
3672
3678
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -49,6 +49,7 @@ const notice = computed(() => cctvNotice(failure.value));
49
49
 
50
50
  let pc: RTCPeerConnection | null = null;
51
51
  let timer: ReturnType<typeof setTimeout> | null = null;
52
+ const LIVE_START_MS = 10000;
52
53
  let run = 0; // bumps on every start/stop so a late answer from an old attempt is ignored
53
54
 
54
55
  function stop() {
@@ -110,7 +111,7 @@ async function tryWebrtc(token: number) {
110
111
  if (token !== run) return;
111
112
  await conn.setRemoteDescription({ type: "answer", sdp: answer.sdp });
112
113
  await connected;
113
- if (token === run) mode.value = "live";
114
+ if (token === run && mode.value === "connecting") mode.value = "live";
114
115
  }
115
116
 
116
117
  async function pollStill(token: number) {
@@ -147,7 +148,11 @@ async function start() {
147
148
  mode.value = "connecting";
148
149
  failure.value = null;
149
150
  try {
150
- await tryWebrtc(token);
151
+ // One limit for the whole attempt, the answer request included: a recorder that will not open
152
+ // another stream can keep that request waiting for half a minute.
153
+ const attempt = tryWebrtc(token);
154
+ attempt.catch(() => undefined); // a late failure after the limit is already handled below
155
+ await Promise.race([attempt, new Promise<never>((_, reject) => setTimeout(() => reject(new Error("webrtc-timeout")), LIVE_START_MS))]);
151
156
  } catch (e: any) {
152
157
  if (token !== run) return;
153
158
  // The engine being offline is the same for the still picture, so say it instead of pretending to fall back.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@7365admin1/layer-common",
3
3
  "license": "MIT",
4
4
  "type": "module",
5
- "version": "4.161.1",
5
+ "version": "4.161.2",
6
6
  "author": "7365admin1",
7
7
  "main": "./nuxt.config.ts",
8
8
  "//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",