@7365admin1/layer-common 4.97.1-staging.625 → 4.97.1-staging.626

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.
@@ -87,16 +87,19 @@ async function tryWebrtc(token: number) {
87
87
  conn.addTransceiver("video", { direction: "recvonly" });
88
88
  conn.addTransceiver("audio", { direction: "recvonly" });
89
89
  const connected = new Promise<void>((resolve, reject) => {
90
+ // A track is announced as soon as the answer is read, before any picture can arrive (the engine
91
+ // may be unreachable for video). "Live" waits for the first decoded frame; otherwise stills.
90
92
  conn.ontrack = (ev) => {
91
93
  if (token !== run || !video.value) return;
92
94
  video.value.srcObject = ev.streams[0] ?? new MediaStream([ev.track]);
93
- resolve();
95
+ video.value.addEventListener("loadeddata", () => resolve(), { once: true });
94
96
  };
95
97
  conn.onconnectionstatechange = () => {
96
98
  if (token !== run) return;
97
- if (conn.connectionState === "failed") reject(new Error("webrtc-failed"));
98
- if (conn.connectionState === "disconnected" || conn.connectionState === "closed") {
99
+ const state = conn.connectionState;
100
+ if (state === "failed" || state === "disconnected" || state === "closed") {
99
101
  if (mode.value === "live") fallbackToStill(token);
102
+ else reject(new Error("webrtc-failed"));
100
103
  }
101
104
  };
102
105
  setTimeout(() => reject(new Error("webrtc-timeout")), 10000);
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.97.1-staging.625",
5
+ "version": "4.97.1-staging.626",
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.",