From 7162667bbf3ec80a775e0a6e59197581b24126c3 Mon Sep 17 00:00:00 2001 From: "juancarlos.cavero" Date: Fri, 17 Jul 2026 20:56:18 +0200 Subject: [PATCH] fix(ui): keep subtitle preview playable for karaoke presets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Selecting a karaoke preset swapped the playable RemotionPreview for a static CSS mock, so the preview video couldn't be played/scrubbed. Instead, teach the Remotion Subtitles component to render dim (baseOpacity, opaque scaled color like the backend) and uppercase, and pass those from the modal — so the preview stays a live, playable Player that also reflects the karaoke look. Drops the static mock. --- dashboard/src/components/SubtitleModal.jsx | 43 ++----------------- .../src/remotion/compositions/Subtitles.tsx | 14 ++++++ dashboard/src/remotion/lib/types.ts | 3 ++ 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/dashboard/src/components/SubtitleModal.jsx b/dashboard/src/components/SubtitleModal.jsx index e48f82e..8357b24 100644 --- a/dashboard/src/components/SubtitleModal.jsx +++ b/dashboard/src/components/SubtitleModal.jsx @@ -60,16 +60,6 @@ const CAPTION_PRESETS = [ { id: 'classic', label: 'Classic', style: 'classic', effect: 'none', highlightColor: '#FFD700', baseOpacity: 1.0, uppercase: false, fontName: 'Verdana', borderWidth: 2 }, ]; -// Mirrors the backend's ASS dimming: a fully-opaque scaled color (not CSS -// opacity), so the preview matches what gets burned into the video. -const dimColor = (hex, k) => { - const m = /^#?([0-9a-f]{6})$/i.exec(hex || ''); - if (!m) return hex; - const scale = 0.35 + 0.65 * k; - const [r, g, b] = [0, 2, 4].map(i => Math.round(parseInt(m[1].slice(i, i + 2), 16) * scale)); - return `rgb(${r}, ${g}, ${b})`; -}; - const swatchClass = (selected) => `w-6 h-6 rounded-full transition-all ${selected ? 'ring-2 ring-[color:var(--color-accent)] ring-offset-2 ring-offset-[color:var(--color-paper-2)]' @@ -178,6 +168,9 @@ export default function SubtitleModal({ isOpen, onClose, onGenerate, onApplyAll, bgColor, bgOpacity, animation, + // Karaoke look reflected live in the playable preview. + baseOpacity: style === 'karaoke' ? baseOpacity : 1, + uppercase: style === 'karaoke' ? uppercase : false, }, }; @@ -220,36 +213,6 @@ export default function SubtitleModal({ isOpen, onClose, onGenerate, onApplyAll, Loading preview... - ) : style === 'karaoke' ? ( - /* Karaoke burns server-side; show a CSS mock that mirrors - the exact burned look (dim, uppercase, effects). */ - <> -