@hyperframes/engine 0.8.191 → 0.8.193
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 +3 -2
- package/dist/index.js +3 -2
- package/dist/services/aacEncode.js +27 -0
- package/dist/services/audioMixer.js +105 -18
- package/dist/services/audioMixer.types.d.ts +2 -0
- package/dist/services/audioVolumeEnvelope.js +3 -2
- package/dist/services/browserManager.js +4 -0
- package/dist/services/captureFailure.d.ts +3 -0
- package/dist/services/captureFailure.js +29 -28
- package/dist/services/chunkEncoder.js +1 -1
- package/dist/services/extractionCache.js +5 -4
- package/dist/services/frameCapture.js +4 -1
- package/dist/services/parallelCoordinator.d.ts +2 -0
- package/dist/services/parallelCoordinator.js +10 -2
- package/dist/services/softwareEncoderThreads.d.ts +2 -1
- package/dist/services/softwareEncoderThreads.js +4 -2
- package/dist/services/streamingEncoder.js +1 -1
- package/dist/services/videoFrameExtractor.d.ts +15 -2
- package/dist/services/videoFrameExtractor.js +70 -19
- package/dist/utils/ffprobe.d.ts +16 -0
- package/dist/utils/ffprobe.js +184 -39
- package/dist/utils/htmlTemplate.js +1 -1
- package/dist/utils/processRss.js +5 -2
- package/dist/utils/renameWithRetry.d.ts +12 -0
- package/dist/utils/renameWithRetry.js +46 -0
- package/package.json +3 -3
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { renameSync } from "node:fs";
|
|
2
|
+
import { rename } from "node:fs/promises";
|
|
3
|
+
// Windows reports EPERM/EACCES/EBUSY while antivirus or a just-exited process still holds the
|
|
4
|
+
// file; the hold clears within milliseconds. Total wait before giving up: about 1.3 s.
|
|
5
|
+
const RETRYABLE = new Set(["EPERM", "EACCES", "EBUSY"]);
|
|
6
|
+
const BACKOFF_MS = [10, 20, 40, 80, 160, 320, 640];
|
|
7
|
+
function isRetryable(error, platform) {
|
|
8
|
+
if (platform !== "win32")
|
|
9
|
+
return false;
|
|
10
|
+
return RETRYABLE.has(error?.code ?? "");
|
|
11
|
+
}
|
|
12
|
+
function sleepSync(ms) {
|
|
13
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
14
|
+
}
|
|
15
|
+
/** `renameSync` that rides out Windows' transient file locks; other platforms and errors throw at once. */
|
|
16
|
+
export function renameWithRetry(from, to, options = {}) {
|
|
17
|
+
const doRename = options.rename ?? renameSync;
|
|
18
|
+
const platform = options.platform ?? process.platform;
|
|
19
|
+
for (let attempt = 0;; attempt++) {
|
|
20
|
+
try {
|
|
21
|
+
doRename(from, to);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
if (attempt >= BACKOFF_MS.length || !isRetryable(error, platform))
|
|
26
|
+
throw error;
|
|
27
|
+
sleepSync(BACKOFF_MS[attempt]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Async twin of {@link renameWithRetry}. */
|
|
32
|
+
export async function renameWithRetryAsync(from, to, options = {}) {
|
|
33
|
+
const doRename = options.rename ?? rename;
|
|
34
|
+
const platform = options.platform ?? process.platform;
|
|
35
|
+
for (let attempt = 0;; attempt++) {
|
|
36
|
+
try {
|
|
37
|
+
await doRename(from, to);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (attempt >= BACKOFF_MS.length || !isRetryable(error, platform))
|
|
42
|
+
throw error;
|
|
43
|
+
await new Promise((resolve) => setTimeout(resolve, BACKOFF_MS[attempt]));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/engine",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.193",
|
|
4
4
|
"description": "Seekable web page to video rendering engine (Puppeteer + FFmpeg)",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"linkedom": "^0.18.12",
|
|
51
51
|
"puppeteer": "^25.8.0",
|
|
52
52
|
"puppeteer-core": "^25.8.0",
|
|
53
|
-
"@hyperframes/
|
|
54
|
-
"@hyperframes/
|
|
53
|
+
"@hyperframes/core": "^0.8.193",
|
|
54
|
+
"@hyperframes/parsers": "^0.8.193"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^25.0.10",
|