- {props.flag ? (
-
-
-
- ) : null}
-
- {props.children}
-
- {props.subtitleType && (
-
- {props.subtitleType.toUpperCase()}
-
- )}
- {props.subtitleSource && (
+
+ {props.flag ? (
+
+
+
+ ) : null}
- {props.subtitleSource.toUpperCase()}
+ {props.children}
- )}
- {props.isHearingImpaired && (
-
- )}
+
+
+ {props.subtitleType && (
+
+ {props.subtitleType.toUpperCase()}
+
+ )}
+ {props.subtitleSource && (
+
+ {props.subtitleSource.toUpperCase()}
+
+ )}
+ {props.isHearingImpaired && (
+
+ )}
+ {props.matchScore !== undefined && props.matchScore !== null && (
+ = 80,
+ "text-yellow-500":
+ props.matchScore >= 50 && props.matchScore < 80,
+ "text-video-context-error": props.matchScore < 50,
+ },
+ )}
+ >
+ ~{props.matchScore}% match
+
+ )}
+
{tooltipContent && showTooltip && (
@@ -420,7 +446,7 @@ export function CaptionsView({
}: CaptionsViewProps) {
const { t } = useTranslation();
const router = useOverlayRouter(id);
- const selectedCaptionId = usePlayerStore((s) => s.caption.selected?.id);
+ const selectedCaption = usePlayerStore((s) => s.caption.selected);
const currentTranslateTask = usePlayerStore((s) => s.caption.translateTask);
const { disable, selectRandomCaptionFromLastUsedLanguage } = useCaptions();
const [isRandomSelecting, setIsRandomSelecting] = useState(false);
@@ -447,6 +473,7 @@ export function CaptionsView({
const delay = useSubtitleStore((s) => s.delay);
const appLanguage = useLanguageStore((s) => s.language);
const setCustomSubs = useSubtitleStore((s) => s.setCustomSubs);
+ const matchScore = useCaptionMatchScore();
// Get combined caption list
const captions = useMemo(
@@ -512,13 +539,13 @@ export function CaptionsView({
// Get current subtitle text preview
const currentSubtitleText = useMemo(() => {
- if (!srtData || !selectedCaptionId) return null;
+ if (!srtData || !selectedCaption) return null;
const parsedCaptions = parseSubtitles(srtData, selectedLanguage);
const visibleCaption = parsedCaptions.find(({ start, end }) =>
captionIsVisible(start, end, delay, videoTime),
);
return visibleCaption?.content;
- }, [srtData, selectedLanguage, delay, videoTime, selectedCaptionId]);
+ }, [srtData, selectedLanguage, delay, videoTime, selectedCaption]);
function onDrop(event: DragEvent