@geekapps/silo-elements-nextjs 0.2.51 → 0.2.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/VideoPlayer.js +11 -2
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/styles.css +0 -2
package/dist/index.js
CHANGED
|
@@ -1277,11 +1277,20 @@ function Video({
|
|
|
1277
1277
|
const applySubtitleMode = useCallback((mode) => {
|
|
1278
1278
|
const video = videoRef.current;
|
|
1279
1279
|
if (!video) return;
|
|
1280
|
+
let activeTrack = null;
|
|
1280
1281
|
Array.from(video.textTracks).forEach((track) => {
|
|
1281
1282
|
if (track.kind === "metadata") return;
|
|
1282
|
-
|
|
1283
|
+
const enabled = mode !== "off" && track.language === mode;
|
|
1284
|
+
track.mode = enabled ? "hidden" : "disabled";
|
|
1285
|
+
if (enabled) activeTrack = track;
|
|
1283
1286
|
});
|
|
1284
|
-
if (
|
|
1287
|
+
if (!activeTrack) {
|
|
1288
|
+
setActiveCue(null);
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
const cues = activeTrack.activeCues;
|
|
1292
|
+
const cue = cues && cues.length > 0 ? cues[0] : null;
|
|
1293
|
+
setActiveCue(cue ? cue.text.replace(/<[^>]*>/g, "") : null);
|
|
1285
1294
|
}, []);
|
|
1286
1295
|
const showControlsTemporarily = useCallback(() => {
|
|
1287
1296
|
setControlsVisible(true);
|