From 85d4925ecc42f611c98e956184d387e510567638 Mon Sep 17 00:00:00 2001 From: Roland Date: Thu, 3 Aug 2023 22:36:27 -0600 Subject: [PATCH] Using correct caption track for each language. --- app/src/components/VideoPlayer.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/app/src/components/VideoPlayer.js b/app/src/components/VideoPlayer.js index 01eb64de..71cd5f58 100644 --- a/app/src/components/VideoPlayer.js +++ b/app/src/components/VideoPlayer.js @@ -40,6 +40,33 @@ function videoFileLink(path, directory = false) { } } +export function CaptionTrack({src, ...props}) { + if (src.endsWith('.de.vtt')) { + return + } else if (src.endsWith('.es.vtt')) { + return + } else if (src.endsWith('.fr.vtt')) { + return + } else if (src.endsWith('.id.vtt')) { + return + } else if (src.endsWith('.it.vtt')) { + return + } else if (src.endsWith('.ja.vtt')) { + return + } else if (src.endsWith('.pl.vtt')) { + return + } else if (src.endsWith('.pt.vtt')) { + return + } else if (src.endsWith('.ro.vtt')) { + return + } else if (src.endsWith('.ru.vtt')) { + return + } else if (src.endsWith('.th.vtt')) { + return + } + return +} + function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) { const {theme} = useContext(ThemeContext); @@ -187,7 +214,7 @@ function VideoPage({videoFile, prevFile, nextFile, fetchVideo, ...props}) { > {videoSource} {/* Only WebVTT captions can be displayed. */} - {captionUrls.map(i => )} + {captionUrls.map(i => )}