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

Function postState

packages/core/src/runtime/init.ts:1773–1795  ·  view source on GitHub ↗
(force: boolean)

Source from the content-addressed store, hash-verified

1771 };
1772
1773 const postState = (force: boolean) => {
1774 const frame = Math.max(0, Math.round((state.currentTime || 0) * state.canonicalFps));
1775 const now = Date.now();
1776 const shouldPost =
1777 force ||
1778 frame !== state.bridgeLastPostedFrame ||
1779 state.isPlaying !== state.bridgeLastPostedPlaying ||
1780 state.bridgeMuted !== state.bridgeLastPostedMuted ||
1781 now - state.bridgeLastPostedAt >= state.bridgeMaxPostIntervalMs;
1782 if (!shouldPost) return;
1783 state.bridgeLastPostedFrame = frame;
1784 state.bridgeLastPostedPlaying = state.isPlaying;
1785 state.bridgeLastPostedMuted = state.bridgeMuted;
1786 state.bridgeLastPostedAt = now;
1787 postRuntimeMessage({
1788 source: "hf-preview",
1789 type: "state",
1790 frame,
1791 isPlaying: state.isPlaying,
1792 muted: state.bridgeMuted,
1793 playbackRate: state.playbackRate,
1794 });
1795 };
1796
1797 // Signature the live __clipTree was built from; rebuild only when the set of
1798 // timed elements changes (e.g. a sub-composition finishes loading), not every

Callers 4

transportTickFunction · 0.85

Calls 2

postRuntimeMessageFunction · 0.90
nowMethod · 0.80

Tested by

no test coverage detected