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

Function resolveDuration

packages/core/src/runtime/clipTree.ts:79–92  ·  view source on GitHub ↗
(
  el: Element,
  timelineRegistry: Record<string, RuntimeTimelineLike | undefined>,
  rootDuration: number,
  absoluteStart: number,
)

Source from the content-addressed store, hash-verified

77
78// Used only to filter out zero-duration (decorative) elements at build time.
79function resolveDuration(
80 el: Element,
81 timelineRegistry: Record<string, RuntimeTimelineLike | undefined>,
82 rootDuration: number,
83 absoluteStart: number,
84): number {
85 const attr = parseNum(el.getAttribute("data-duration"));
86 if (attr != null && attr > 0) return attr;
87 return (
88 durationFromTimeline(el, timelineRegistry) ??
89 durationFromMedia(el) ??
90 Math.max(0, rootDuration - absoluteStart)
91 );
92}
93
94function linkParentChild(elementToNode: Map<Element, MutableClipNode>): void {
95 for (const [el, node] of elementToNode) {

Callers 1

createClipTreeFunction · 0.85

Calls 4

durationFromTimelineFunction · 0.85
durationFromMediaFunction · 0.85
parseNumFunction · 0.70
getAttributeMethod · 0.65

Tested by

no test coverage detected