|
|
@@ -1,5 +1,5 @@
|
|
|
import React from "react";
|
|
|
-import { useCurrentFrame, useVideoConfig, interpolate } from "remotion";
|
|
|
+import { useCurrentFrame, useVideoConfig } from "remotion";
|
|
|
import type { WordTimestamp } from "@pipeline/shared";
|
|
|
|
|
|
interface SubtitleBarProps {
|
|
|
@@ -57,19 +57,6 @@ export const SubtitleBar: React.FC<SubtitleBarProps> = ({
|
|
|
|
|
|
if (!currentSegment) return null;
|
|
|
|
|
|
- let currentWordIndex = -1;
|
|
|
- for (let i = 0; i < currentSegment.words.length; i++) {
|
|
|
- if (
|
|
|
- currentTime >= currentSegment.words[i].startSeconds &&
|
|
|
- currentTime <= currentSegment.words[i].endSeconds
|
|
|
- ) {
|
|
|
- currentWordIndex = i;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const fadeIn = interpolate(frame, [0, 6], [0, 1], { extrapolateRight: "clamp" });
|
|
|
-
|
|
|
return (
|
|
|
<div
|
|
|
style={{
|
|
|
@@ -79,7 +66,6 @@ export const SubtitleBar: React.FC<SubtitleBarProps> = ({
|
|
|
right: 0,
|
|
|
display: "flex",
|
|
|
justifyContent: "center",
|
|
|
- opacity: fadeIn,
|
|
|
padding: "0 5%",
|
|
|
...style,
|
|
|
}}
|
|
|
@@ -97,6 +83,7 @@ export const SubtitleBar: React.FC<SubtitleBarProps> = ({
|
|
|
>
|
|
|
<span
|
|
|
style={{
|
|
|
+ color: "#ffffff",
|
|
|
fontSize: 40,
|
|
|
lineHeight: 1.6,
|
|
|
fontFamily: "sans-serif",
|
|
|
@@ -108,25 +95,9 @@ export const SubtitleBar: React.FC<SubtitleBarProps> = ({
|
|
|
>
|
|
|
{currentSegment.words
|
|
|
.filter((w) => !/[。,!?\s]/.test(w.word))
|
|
|
- .map((w, i) => {
|
|
|
- const isCurrent = i === currentWordIndex;
|
|
|
- const isPast = currentTime > w.endSeconds;
|
|
|
- return (
|
|
|
- <span
|
|
|
- key={i}
|
|
|
- style={{
|
|
|
- color: isCurrent
|
|
|
- ? "#fbbf24"
|
|
|
- : isPast
|
|
|
- ? "rgba(255,255,255,0.5)"
|
|
|
- : "#ffffff",
|
|
|
- fontWeight: isCurrent ? 700 : 400,
|
|
|
- }}
|
|
|
- >
|
|
|
- {w.word}
|
|
|
- </span>
|
|
|
- );
|
|
|
- })}
|
|
|
+ .map((w, i) => (
|
|
|
+ <span key={i}>{w.word}</span>
|
|
|
+ ))}
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|