Skip to content

feat(brand): brand-driven hook music + local whoosh SFX - #68

Merged
natashaannn merged 9 commits into
mainfrom
refactor/s1-brand-loader
May 13, 2026
Merged

feat(brand): brand-driven hook music + local whoosh SFX#68
natashaannn merged 9 commits into
mainfrom
refactor/s1-brand-loader

Conversation

@natashaannn

Copy link
Copy Markdown
Member

Summary

  • Add brand.audio.hookMusic to the Brand type and brands/ragtech/brand.json so
    each brand owns its hook music path; calculateMetadata and calculateShortMetadata
    now fetch brand config and resolve hookMusicSrc automatically when it is not passed
    as an explicit prop — eliminating the hardcoded hook-music.mp3 default that caused
    a 404 on every ShortFormClip preview.
  • Replace @remotion/sfx's external CDN whoosh.wav URL with a local copy at
    public/sounds/whoosh.wav, fixing a CORS block that prevented the transition
    sound from loading in Remotion Studio dev mode.
  • Fix the Jest/Babel test environment: restructure .babelrc so next/babel only
    applies in development/production; the test env now uses an explicit
    @babel/preset-env with modules: "commonjs", resolving the
    SyntaxError: Cannot use import statement outside a module that blocked all
    React-project tests. Align babel-jest to 29.7.0 to match jest@^29.7.0.

How to review

  • remotion/types/brand.ts — new optional hookMusic? field on Brand.audio
  • remotion/Composition.tsx + remotion/ShortFormClip.tsxcalculateMetadata /
    calculateShortMetadata: look for the brand-fetch block that runs only when
    hookMusicSrc is not explicitly passed; explicit prop always takes priority
  • remotion/Root.tsxhookMusicSrc removed from ShortFormClip defaultProps;
    brand resolution handles it
  • remotion/components/Transition.tsximport { whoosh } from '@remotion/sfx'
    replaced with staticFile('sounds/whoosh.wav')
  • public/brands/ragtech/brand.jsonaudio.hookMusic set to
    sounds/jazz-cafe-music.mp3
  • .babelrc — verify next/babel is absent from the test env; only the three
    explicit presets + babel-plugin-transform-import-meta are active there
  • remotion/Composition.test.tsx, remotion/ShortFormClip.test.tsx,
    remotion/components/Transition.test.tsx — real tests replacing trivially-passing
    stubs; cover brand resolution, explicit override priority, and local SFX path

Test plan

  • npm test passes (246 node tests, 0 failures)
  • npm run test:react passes (13 react tests, 0 failures)

Manual verification completed:

  • [REMOTION-VISUAL] ShortFormClip in Remotion Studio: hook music plays from
    brand.audio.hookMusic, no 404 in console
  • [REMOTION-VISUAL] Transition frame window: whoosh plays from local file,
    no CORS error
  • [REMOTION-VISUAL] ragTechVodcast composition: hook section renders correctly

Issues

Closes #14

natashaannn and others added 9 commits May 13, 2026 17:15
- Add brandId prop to Composition and ShortFormClip components
- Resolve brandId to brands/{brandId}/brand.json path with brandSrc fallback
- Create public/brands/ragtech/brand.json with complete Brand schema
- Update Root.tsx to use brandId: 'ragtech' for short-form clips
- Preserve backward compatibility with existing brandSrc parameter
- All tests pass and build succeeds
- Fix next/image mock to avoid document.createElement usage
- Replace DOM manipulation with jest.fn() factory function
- Resolves Jest test failures in pre-commit hook
hook-music.mp3 is intentionally absent (user-supplied per README). The file
name was hardcoded as the default hookMusicSrc prop, causing getAudioDurationInSeconds
to eagerly fetch it and produce a 404 on every ShortFormClip preview.

Remove the default from both components and the Root.tsx defaultProps so the
guard (if props.hookMusicSrc) correctly skips the fetch when no file is provided.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add hookMusic?: string to Brand.audio. calculateMetadata and
calculateShortMetadata now fetch the brand JSON when no explicit
hookMusicSrc prop is provided and read brand.audio.hookMusic as the
fallback. The resolved path is written back into overrideProps so the
component renders the <Audio> tag correctly.

Set ragtech hookMusic to /sounds/jazz-cafe-music.mp3 in brand.json.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@remotion/sfx exports whoosh as https://remotion.media/whoosh.wav, which
the browser blocks with a CORS error in dev. Downloaded the file to
public/sounds/whoosh.wav and replaced the import with staticFile().

Also extend the ESLint Remotion override from remotion/*.tsx to
remotion/**/*.tsx so components in subdirectories are not linted under
Next.js rules (no-img-element does not apply in Remotion's render context).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…version

- Restructure .babelrc so next/babel only applies in development/production;
  test env uses explicit preset-env with modules:commonjs, preset-react, preset-typescript.
  next/babel's internal preset-env was overriding modules:commonjs, leaving import
  statements untransformed and causing SyntaxError in jest-runtime.
- Downgrade babel-jest from ^30.2.0 to 29.7.0 to match jest@^29.7.0 in use.
- Expand Composition and ShortFormClip tests to cover brand audio resolution paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
B1: add hookMusic? to Brand.audio spec in PRODUCTION_REFACTOR_PLAN.md
B2: fix brand.json backgroundMusic path (background-music.mp3 → jazz-cafe-music.mp3)
W1: remove vacuous eslint-disable-next-line; type next/image mock explicitly
W2: add Saloni to brand.json hosts array with correct role and colour
W3: fix team imgSrc extensions to .PNG to match actual files on disk

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@natashaannn
natashaannn force-pushed the refactor/s1-brand-loader branch from 7bfb09a to a9e9bf5 Compare May 13, 2026 09:26
@natashaannn
natashaannn merged commit 908d594 into main May 13, 2026
1 check passed
@natashaannn
natashaannn deleted the refactor/s1-brand-loader branch May 13, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create brands/ragtech/brand.json and brand loader

1 participant