mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
fix(producer): accept plain integer fps in createRenderJob
The rational `Fps = { num, den }` refactor in 5dcc89c broke callers
passing `fps: 30` (the form documented in every code example and used
by external consumers). FFmpeg received `undefined/undefined` as the
framerate, causing a cryptic exit-code error.
Add `FpsInput = number | Fps` and `toFps()` normalizer in
@hyperframes/core. `createRenderJob` now accepts both forms —
plain integers are promoted to `{ num, den: 1 }` at the boundary;
`RenderConfig.fps` stays strict `Fps` internally so no downstream
code changes.
Also fixes the producer and engine docs, which showed phantom
`input`/`output` fields on `createRenderJob` and a wrong
`executeRenderJob(job)` signature (missing `projectDir`/`outputPath`
args).
Closes #1031
This commit is contained in:
@@ -20,6 +20,15 @@ export interface Fps {
|
||||
den: number;
|
||||
}
|
||||
|
||||
export type FpsInput = number | Fps;
|
||||
|
||||
export function toFps(input: FpsInput): Fps {
|
||||
if (typeof input === "number") {
|
||||
return { num: input, den: 1 };
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decimal value of an {@link Fps} rational. Used at sites that need a
|
||||
* `number` for arithmetic (frame-index → time, frame intervals, telemetry
|
||||
|
||||
@@ -12,6 +12,7 @@ export type {
|
||||
MediaElementType,
|
||||
CanvasResolution,
|
||||
Fps,
|
||||
FpsInput,
|
||||
FpsParseResult,
|
||||
MediaFile,
|
||||
CompositionAPI,
|
||||
@@ -42,6 +43,7 @@ export {
|
||||
normalizeResolutionFlag,
|
||||
parseFps,
|
||||
parseFpsWithDefault,
|
||||
toFps,
|
||||
fpsToNumber,
|
||||
fpsToFfmpegArg,
|
||||
TIMELINE_COLORS,
|
||||
|
||||
Reference in New Issue
Block a user