feat: add wordsPerLine and activeColor support to Captions#199
feat: add wordsPerLine and activeColor support to Captions#199SecurityQQ merged 1 commit intomainfrom
Conversation
Add karaoke-style grouped captions with active word highlighting. - New wordsPerLine prop groups N words per subtitle line instead of 1 - Wire up activeColor prop (was in types but unused) for highlight color - ASS override tags (\c) color the active word differently - Cap group end times to next group start to prevent overlapping lines - Backward compatible: omitting wordsPerLine keeps existing 1-word behavior - Add unit tests for SRT conversion
|
Caution Review failedPull request was closed or merged during review 📝 Walkthroughwalkthroughadded word-level karaoke-style caption highlighting via changes
sequence diagram(s)sequenceDiagram
participant Client
participant renderCaptions as renderCaptions
participant convertSrtToAss as convertSrtToAss
participant convertSrtToAssGrouped as convertSrtToAssGrouped
participant ASS as ASS Output
Client->>renderCaptions: captions + wordsPerLine + activeColor
renderCaptions->>renderCaptions: compute activeColorAss
alt wordsPerLine provided
renderCaptions->>convertSrtToAssGrouped: pass SRT + grouping params
convertSrtToAssGrouped->>convertSrtToAssGrouped: parse & chunk SRT by wordsPerLine
convertSrtToAssGrouped->>convertSrtToAssGrouped: apply \\c color overrides per word
convertSrtToAssGrouped->>ASS: emit grouped dialogues with colors
else standard flow
renderCaptions->>convertSrtToAss: pass SRT (no grouping)
convertSrtToAss->>ASS: emit standard dialogues
end
ASS->>Client: formatted caption output
estimated code review effort🎯 3 (moderate) | ⏱️ ~22 minutes possibly related prs
poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
wordsPerLineprop to<Captions>that groups N words per subtitle line instead of showing one word at a timeactiveColorprop (was defined in types but never used) to highlight the currently-spoken word with a different color using ASS\coverride tagsUsage
Backward compatible
Omitting
wordsPerLinekeeps the existing 1-word-at-a-time behavior. No changes to existing templates required.Tests