mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 04:38:33 +00:00
Preview audio with GSAP volume fades (e.g. data-volume="0" with a
gsap.to("#bgm", {volume:0.25, ...})) played ~1s then silenced. Root
cause: syncRuntimeMedia used fallbackAuthorVolume (data-volume) on the
first tick after a clip became active, clobbering the GSAP-seeked value.
The single-clock transport seeks GSAP before syncRuntimeMedia runs, so
el.volume already holds the animated value — we just need to trust it.
Fix — three layers, matching the renderer's approach (PR #1117):
1. First-tick tracking: on the first tick a clip is active
(previousRuntimeVolume===undefined), use currentElementVolume (GSAP's
seeked value) instead of fallbackAuthorVolume. In production the
transport always seeks GSAP before syncRuntimeMedia, so el.volume is
already at the correct animated position.
2. Probed keyframes: new probeElementVolumeKeyframes() runs the same
offline probe the renderer uses (discoverAudioVolumeAutomationFromTimeline)
directly in the browser. init.ts calls probeAndCacheElementVolume() when
an element is bound and a timeline is available. When keyframes are present,
syncRuntimeMedia drives volume from the interpolated envelope — no
GSAP-change tracking needed, no first-tick edge case, same data source
as the renderer.
3. Shared utilities: normaliseEnvelope(), interpolateVolumeGain(), and
probeAndCacheElementVolume() extracted to mediaVolumeEnvelope.ts and
exported from @hyperframes/core/media-volume-envelope. The engine's
audioVolumeEnvelope.ts imports from there — no duplicate logic between
the renderer and the new preview path.
Fallow audit exits non-zero on inherited complexity/duplication in init.ts
functions that shifted line numbers (applyClipLayout, transportTick, etc.),
unchanged by this PR — same known false-positive pattern noted in #1117.
Lint, format, typecheck, and unit tests all pass.
53 core/media tests pass (3 updated to pre-set el.volume to match the
runtime's bindMediaMetadataListeners — corrects a missing setup step).
audioVolumeEnvelope tests (6) still pass.
188 lines
6.6 KiB
JSON
188 lines
6.6 KiB
JSON
{
|
|
"name": "@hyperframes/core",
|
|
"version": "0.6.56",
|
|
"description": "",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "https://github.com/heygen-com/hyperframes",
|
|
"directory": "packages/core"
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"docs",
|
|
"schemas",
|
|
"README.md"
|
|
],
|
|
"type": "module",
|
|
"main": "./src/index.ts",
|
|
"types": "./src/index.ts",
|
|
"exports": {
|
|
".": {
|
|
"import": "./src/index.ts",
|
|
"types": "./src/index.ts"
|
|
},
|
|
"./lint": {
|
|
"import": "./src/lint/index.ts",
|
|
"types": "./src/lint/index.ts"
|
|
},
|
|
"./compiler": {
|
|
"import": "./src/compiler/index.ts",
|
|
"types": "./src/compiler/index.ts"
|
|
},
|
|
"./runtime": "./dist/hyperframe.runtime.iife.js",
|
|
"./runtime/lottie-readiness": {
|
|
"import": "./src/lottieReadiness.ts",
|
|
"types": "./src/lottieReadiness.ts"
|
|
},
|
|
"./studio-api": {
|
|
"import": "./src/studio-api/index.ts",
|
|
"types": "./src/studio-api/index.ts"
|
|
},
|
|
"./studio-api/screenshot-clip": {
|
|
"import": "./src/studio-api/helpers/screenshotClip.ts",
|
|
"types": "./src/studio-api/helpers/screenshotClip.ts"
|
|
},
|
|
"./studio-api/manual-edits-render-script": {
|
|
"import": "./src/studio-api/helpers/manualEditsRenderScript.ts",
|
|
"types": "./src/studio-api/helpers/manualEditsRenderScript.ts"
|
|
},
|
|
"./studio-api/studio-motion-render-script": {
|
|
"import": "./src/studio-api/helpers/studioMotionRenderScript.ts",
|
|
"types": "./src/studio-api/helpers/studioMotionRenderScript.ts"
|
|
},
|
|
"./text": {
|
|
"import": "./src/text/index.ts",
|
|
"types": "./src/text/index.ts"
|
|
},
|
|
"./registry": {
|
|
"import": "./src/registry/index.ts",
|
|
"types": "./src/registry/index.ts"
|
|
},
|
|
"./media-volume-envelope": {
|
|
"import": "./src/runtime/mediaVolumeEnvelope.ts",
|
|
"types": "./src/runtime/mediaVolumeEnvelope.ts"
|
|
},
|
|
"./gsap-parser": {
|
|
"import": "./src/parsers/gsapParser.ts",
|
|
"types": "./src/parsers/gsapParser.ts"
|
|
},
|
|
"./gsap-constants": {
|
|
"import": "./src/parsers/gsapConstants.ts",
|
|
"types": "./src/parsers/gsapConstants.ts"
|
|
},
|
|
"./schemas/registry.json": "./schemas/registry.json",
|
|
"./schemas/registry-item.json": "./schemas/registry-item.json"
|
|
},
|
|
"publishConfig": {
|
|
"access": "public",
|
|
"exports": {
|
|
".": {
|
|
"import": "./dist/index.js",
|
|
"types": "./dist/index.d.ts"
|
|
},
|
|
"./lint": {
|
|
"import": "./dist/lint/index.js",
|
|
"types": "./dist/lint/index.d.ts"
|
|
},
|
|
"./compiler": {
|
|
"import": "./dist/compiler/index.js",
|
|
"types": "./dist/compiler/index.d.ts"
|
|
},
|
|
"./runtime": "./dist/hyperframe.runtime.iife.js",
|
|
"./runtime/lottie-readiness": {
|
|
"import": "./dist/lottieReadiness.js",
|
|
"types": "./dist/lottieReadiness.d.ts"
|
|
},
|
|
"./studio-api": {
|
|
"import": "./dist/studio-api/index.js",
|
|
"types": "./dist/studio-api/index.d.ts"
|
|
},
|
|
"./studio-api/screenshot-clip": {
|
|
"import": "./dist/studio-api/helpers/screenshotClip.js",
|
|
"types": "./dist/studio-api/helpers/screenshotClip.d.ts"
|
|
},
|
|
"./studio-api/manual-edits-render-script": {
|
|
"import": "./dist/studio-api/helpers/manualEditsRenderScript.js",
|
|
"types": "./dist/studio-api/helpers/manualEditsRenderScript.d.ts"
|
|
},
|
|
"./studio-api/studio-motion-render-script": {
|
|
"import": "./dist/studio-api/helpers/studioMotionRenderScript.js",
|
|
"types": "./dist/studio-api/helpers/studioMotionRenderScript.d.ts"
|
|
},
|
|
"./text": {
|
|
"import": "./dist/text/index.js",
|
|
"types": "./dist/text/index.d.ts"
|
|
},
|
|
"./registry": {
|
|
"import": "./dist/registry/index.js",
|
|
"types": "./dist/registry/index.d.ts"
|
|
},
|
|
"./media-volume-envelope": {
|
|
"import": "./dist/runtime/mediaVolumeEnvelope.js",
|
|
"types": "./dist/runtime/mediaVolumeEnvelope.d.ts"
|
|
},
|
|
"./gsap-parser": {
|
|
"import": "./dist/parsers/gsapParser.js",
|
|
"types": "./dist/parsers/gsapParser.d.ts"
|
|
},
|
|
"./gsap-constants": {
|
|
"import": "./dist/parsers/gsapConstants.js",
|
|
"types": "./dist/parsers/gsapConstants.d.ts"
|
|
},
|
|
"./schemas/registry.json": "./schemas/registry.json",
|
|
"./schemas/registry-item.json": "./schemas/registry-item.json"
|
|
},
|
|
"main": "./dist/index.js",
|
|
"types": "./dist/index.d.ts"
|
|
},
|
|
"scripts": {
|
|
"build": "bun run build:hyperframes-runtime && tsc",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"test:coverage": "vitest run --coverage",
|
|
"typecheck": "tsc --noEmit",
|
|
"lint:runtime-preview-guards": "tsx scripts/lint-runtime-preview-guards.ts",
|
|
"build:hyperframes-runtime": "tsx scripts/build-hyperframes-runtime-artifact.ts",
|
|
"build:hyperframes-runtime:modular": "SANDBOX_RUNTIME_VARIANT=modular tsx scripts/build-hyperframes-runtime-artifact.ts",
|
|
"build:hyperframe-runtime": "tsx scripts/build-hyperframes-runtime-artifact.ts",
|
|
"test:hyperframe-runtime-contract": "tsx scripts/test-hyperframe-runtime-contract.ts",
|
|
"test:hyperframe-runtime-behavior": "tsx scripts/test-hyperframe-runtime-behavior.ts",
|
|
"test:hyperframe-runtime-seek": "tsx scripts/test-hyperframe-runtime-seek.ts",
|
|
"test:hyperframe-runtime-duration-guards": "tsx scripts/test-hyperframe-runtime-duration-guards.ts",
|
|
"test:hyperframe-runtime-parity": "tsx scripts/test-hyperframe-runtime-parity.ts",
|
|
"test:hyperframe-runtime-security": "tsx scripts/test-hyperframe-runtime-security.ts",
|
|
"test:hyperframe-linter": "tsx scripts/test-hyperframe-linter.ts",
|
|
"test:hyperframe-runtime-ci": "bun run build:hyperframes-runtime && bun run test:hyperframe-runtime-contract && bun run test:hyperframe-runtime-behavior && bun run test:hyperframe-runtime-seek && bun run test:hyperframe-runtime-duration-guards && bun run test:hyperframe-runtime-parity && bun run test:hyperframe-runtime-security",
|
|
"check:hyperframe-html": "tsx scripts/check-hyperframe-static.ts",
|
|
"debug:timeline": "tsx scripts/debug-timeline.ts",
|
|
"prepublishOnly": "echo skip"
|
|
},
|
|
"dependencies": {
|
|
"@babel/parser": "^7.27.0",
|
|
"@chenglou/pretext": "^0.0.5",
|
|
"postcss": "^8.5.8",
|
|
"recast": "^0.23.11"
|
|
},
|
|
"devDependencies": {
|
|
"@types/jsdom": "^28.0.0",
|
|
"@types/node": "^25.0.10",
|
|
"@vitest/coverage-v8": "^3.2.4",
|
|
"jsdom": "^29.0.0",
|
|
"tsx": "^4.21.0",
|
|
"typescript": "^5.0.0",
|
|
"vitest": "^3.2.4"
|
|
},
|
|
"peerDependencies": {
|
|
"hono": "^4.0.0"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"hono": {
|
|
"optional": true
|
|
}
|
|
},
|
|
"optionalDependencies": {
|
|
"esbuild": "^0.25.12",
|
|
"linkedom": "^0.18.12"
|
|
}
|
|
}
|