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

Function normalizeDurationSeconds

packages/core/scripts/debug-timeline.ts:105–116  ·  view source on GitHub ↗
(
  rawDuration: number | null,
  fallbackDuration: number | null,
  maxDuration: number,
)

Source from the content-addressed store, hash-verified

103}
104
105function normalizeDurationSeconds(
106 rawDuration: number | null,
107 fallbackDuration: number | null,
108 maxDuration: number,
109): number {
110 const safeFallback = fallbackDuration != null && fallbackDuration > 0 ? fallbackDuration : 0;
111 const safeRaw =
112 rawDuration != null && Number.isFinite(rawDuration) && rawDuration > 0 ? rawDuration : 0;
113 if (safeRaw > 0) return Math.min(safeRaw, maxDuration);
114 if (safeFallback > 0) return Math.min(safeFallback, maxDuration);
115 return 0;
116}
117
118function shouldIncludeTimelineNode(tag: ParsedTag, rootCompositionId: string | null): boolean {
119 const attrs = tag.attrs;

Callers 2

inferClipDurationFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected