MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / validateOutputResolutionOverride

Function validateOutputResolutionOverride

packages/producer/src/server.ts:237–250  ·  view source on GitHub ↗

* Validate an explicitly-supplied `outputResolution`. Rejects (a) non-string * values, which parseRenderOverrides would otherwise silently coerce to * `undefined`; (b) unknown presets; and (c) the alpha-format combination — * outputResolution drives deviceScaleFactor supersampling, which the webm

(body: Record<string, unknown>)

Source from the content-addressed store, hash-verified

235 * reject it here for a clean 400 regardless of which caller sent it.
236 */
237function validateOutputResolutionOverride(body: Record<string, unknown>): string | undefined {
238 if (body.outputResolution === undefined) return undefined;
239 if (typeof body.outputResolution !== "string") {
240 return 'outputResolution must be a string preset (e.g. "4k", "landscape-4k")';
241 }
242 const normalized = normalizeResolutionFlag(body.outputResolution);
243 if (body.outputResolution.trim().length > 0 && normalized === undefined) {
244 return `Invalid outputResolution "${body.outputResolution}". Must be one of: landscape, portrait, landscape-4k, portrait-4k, square, square-4k (aliases: 1080p, 4k, …).`;
245 }
246 if (normalized !== undefined && (body.format === "webm" || body.format === "mov")) {
247 return `outputResolution is not supported with format "${body.format}" — the alpha (webm/mov) capture path can't supersample. Use format "mp4", or omit outputResolution to render at the composition's native dimensions.`;
248 }
249 return undefined;
250}
251
252export async function prepareRenderBody(
253 body: Record<string, unknown>,

Callers 1

validateRenderOverridesFunction · 0.85

Calls 1

normalizeResolutionFlagFunction · 0.85

Tested by

no test coverage detected