mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-08 15:57:01 +00:00
* feat(studio): export can encode on the GPU, like render --gpu * test(studio): the 4K export assertion carries the GPU flag * refactor(studio): the GPU flag needs no comment beyond its name * fix(studio-server): only MP4 exports encode on the GPU, and render errors report it * fix(studio): the disabled GPU option dims like the other export controls
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
const RENDER_SETTINGS_KEY = "hf-studio-render-settings";
|
|
|
|
export interface PersistedRenderSettings {
|
|
format: "mp4" | "webm" | "mov";
|
|
quality: "draft" | "standard" | "high";
|
|
fps: 24 | 30 | 60;
|
|
gpu: boolean;
|
|
}
|
|
|
|
export function getPersistedRenderSettings(): PersistedRenderSettings {
|
|
try {
|
|
const raw = localStorage.getItem(RENDER_SETTINGS_KEY);
|
|
if (raw) {
|
|
const parsed = JSON.parse(raw);
|
|
return {
|
|
format: ["mp4", "webm", "mov"].includes(parsed.format) ? parsed.format : "mp4",
|
|
quality: ["draft", "standard", "high"].includes(parsed.quality)
|
|
? parsed.quality
|
|
: "standard",
|
|
fps: [24, 30, 60].includes(parsed.fps) ? parsed.fps : 30,
|
|
gpu: parsed.gpu === true,
|
|
};
|
|
}
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
return { format: "mp4", quality: "standard", fps: 30, gpu: false };
|
|
}
|
|
|
|
export function persistRenderSettings(
|
|
format: PersistedRenderSettings["format"],
|
|
quality: PersistedRenderSettings["quality"],
|
|
fps: PersistedRenderSettings["fps"],
|
|
gpu: boolean = getPersistedRenderSettings().gpu,
|
|
): void {
|
|
try {
|
|
localStorage.setItem(RENDER_SETTINGS_KEY, JSON.stringify({ format, quality, fps, gpu }));
|
|
} catch {
|
|
/* ignore */
|
|
}
|
|
}
|