mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 19:36:04 +00:00
* feat(engine): a chunk-fed encoder and the rule for which films may use it, off by default * test(engine): end the chunk encoder's ffprobe call with --
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
export interface InPageEncodeInput {
|
|
enabled: boolean;
|
|
captureMode: "drawelement" | "screenshot" | "beginframe";
|
|
format: string;
|
|
codec: string;
|
|
hdr: boolean;
|
|
transparent: boolean;
|
|
workers: number;
|
|
hls: boolean;
|
|
videoLayer: boolean;
|
|
encoderSupported: boolean;
|
|
}
|
|
|
|
export type InPageEncodeDecision = { eligible: true } | { eligible: false; reason: string };
|
|
|
|
export function resolveInPageEncode(input: InPageEncodeInput): InPageEncodeDecision {
|
|
const blocker = (
|
|
[
|
|
[!input.enabled, "disabled"],
|
|
[input.captureMode !== "drawelement", "capture is not drawElement"],
|
|
[input.format !== "mp4", "output is not mp4"],
|
|
[input.codec !== "h264", "codec is not h264"],
|
|
[input.hdr, "hdr"],
|
|
[input.transparent, "transparent"],
|
|
[input.workers !== 1, "parallel workers"],
|
|
[input.hls, "hls"],
|
|
[input.videoLayer, "video layer passthrough"],
|
|
[!input.encoderSupported, "page encoder unsupported"],
|
|
] as const
|
|
).find(([blocked]) => blocked);
|
|
return blocker ? { eligible: false, reason: blocker[1] } : { eligible: true };
|
|
}
|