chore(export): add nvidia cuda dev launcher

This commit is contained in:
wiiiii123
2026-05-13 03:40:27 +07:00
parent f8f4fdac1b
commit 7934c03490
2 changed files with 47 additions and 0 deletions
+1
View File
@@ -16,6 +16,7 @@
"type": "module",
"scripts": {
"dev": "vite --config vite.config.ts",
"dev:nvidia-cuda": "node scripts/dev-nvidia-cuda.mjs",
"postinstall": "node scripts/postinstall.mjs",
"build": "npm run build:platform-native-helpers && tsc && vite build --config vite.config.ts && npm run normalize:electron-main-cjs && npm run smoke:electron-main-cjs && electron-builder",
"lint": "biome check .",
+46
View File
@@ -0,0 +1,46 @@
import { spawn } from "node:child_process";
import path from "node:path";
import { fileURLToPath } from "node:url";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
const env = {
...process.env,
RECORDLY_EXPERIMENTAL_NVIDIA_CUDA_EXPORT: "1",
RECORDLY_NATIVE_EXPORT_DIAGNOSTICS:
process.env.RECORDLY_NATIVE_EXPORT_DIAGNOSTICS ?? "always",
RECORDLY_NVIDIA_CUDA_EXPORT_DIAGNOSTICS: "1",
RECORDLY_NVIDIA_CUDA_EXPORT_HIGH_PRIORITY: "1",
RECORDLY_NVIDIA_CUDA_FORCE_VIDEO_ONLY: "1",
RECORDLY_NVIDIA_CUDA_SAMPLE_GPU: "1",
};
delete env.RECORDLY_NVIDIA_CUDA_ALLOW_AUDIO_EXPORT;
const diagnosticsHint =
process.platform === "win32" && process.env.APPDATA
? path.join(process.env.APPDATA, "Recordly-dev", "native-export-diagnostics")
: "the Recordly-dev native-export-diagnostics userData folder";
console.log("Starting Recordly dev with guarded NVIDIA CUDA/NVENC export enabled.");
console.log("CUDA mode: video-only native render, then shared app audio mux.");
console.log(`Diagnostics: ${diagnosticsHint}`);
const child = spawn(npmCommand, ["run", "dev"], {
cwd: repoRoot,
env,
stdio: "inherit",
});
child.on("exit", (code, signal) => {
if (signal) {
process.kill(process.pid, signal);
return;
}
process.exit(code ?? 0);
});
child.on("error", (error) => {
console.error("Failed to launch Recordly dev:", error);
process.exit(1);
});