diff --git a/enjoy/src/renderer/components/medias/media-caption.tsx b/enjoy/src/renderer/components/medias/media-caption.tsx index 17519ada..99d02847 100644 --- a/enjoy/src/renderer/components/medias/media-caption.tsx +++ b/enjoy/src/renderer/components/medias/media-caption.tsx @@ -337,33 +337,8 @@ export const MediaCaption = () => {
{/* use the words splitted by caption text if it is matched with the timeline length, otherwise use the timeline */} - {caption.text.split(" ").length === caption.timeline.length - ? caption.text.split(" ").map((word, index) => ( -
toggleRegion(index)} - > -
-
{word}
- {displayIpa && ( -
- {caption.timeline[index].timeline - .map((t) => - t.timeline - .map((s) => convertIpaToNormal(s.text)) - .join("") - ) - .join(" · ")} -
- )} -
-
- )) - : (caption.timeline || []).map((w, index) => ( + {caption.text.includes("-") + ? (caption.timeline || []).map((w, index) => (
{ )}
+ )) + : caption.text.split(" ").map((word, index) => ( +
toggleRegion(index)} + > +
+
{word}
+ {displayIpa && ( +
+ {caption.timeline[index].timeline + .map((t) => + t.timeline + .map((s) => convertIpaToNormal(s.text)) + .join("") + ) + .join(" · ")} +
+ )} +
+
))} diff --git a/enjoy/src/renderer/components/medias/media-loading-modal.tsx b/enjoy/src/renderer/components/medias/media-loading-modal.tsx index 51d05357..a64d8e7d 100644 --- a/enjoy/src/renderer/components/medias/media-loading-modal.tsx +++ b/enjoy/src/renderer/components/medias/media-loading-modal.tsx @@ -31,7 +31,7 @@ export const MediaLoadingModal = () => { } = useContext(MediaPlayerProviderContext); return ( - + @@ -59,7 +59,7 @@ export const MediaLoadingModal = () => { {t("loadingTranscription")} - ) : transcription.result ? ( + ) : transcription.result?.timeline ? (
{t("transcribedSuccessfully")} diff --git a/enjoy/src/renderer/hooks/use-transcriptions.tsx b/enjoy/src/renderer/hooks/use-transcriptions.tsx index 0a35921f..9671fead 100644 --- a/enjoy/src/renderer/hooks/use-transcriptions.tsx +++ b/enjoy/src/renderer/hooks/use-transcriptions.tsx @@ -54,10 +54,8 @@ export const useTranscriptions = (media: AudioType | VideoType) => { }; const generateTranscription = async () => { - if (transcription?.targetId === media.id) return; - let originalText: string; - if (transcription) { + if (transcription?.targetId === media.id) { originalText = transcription.result?.originalText; } else { const r = await findOrCreateTranscription();