@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/VideoPlayer.js
CHANGED
|
@@ -150,11 +150,20 @@ function Video({
|
|
|
150
150
|
const applySubtitleMode = useCallback((mode) => {
|
|
151
151
|
const video = videoRef.current;
|
|
152
152
|
if (!video) return;
|
|
153
|
+
let activeTrack = null;
|
|
153
154
|
Array.from(video.textTracks).forEach((track) => {
|
|
154
155
|
if (track.kind === "metadata") return;
|
|
155
|
-
|
|
156
|
+
const enabled = mode !== "off" && track.language === mode;
|
|
157
|
+
track.mode = enabled ? "hidden" : "disabled";
|
|
158
|
+
if (enabled) activeTrack = track;
|
|
156
159
|
});
|
|
157
|
-
if (
|
|
160
|
+
if (!activeTrack) {
|
|
161
|
+
setActiveCue(null);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const cues = activeTrack.activeCues;
|
|
165
|
+
const cue = cues && cues.length > 0 ? cues[0] : null;
|
|
166
|
+
setActiveCue(cue ? cue.text.replace(/<[^>]*>/g, "") : null);
|
|
158
167
|
}, []);
|
|
159
168
|
const showControlsTemporarily = useCallback(() => {
|
|
160
169
|
setControlsVisible(true);
|