@geekapps/silo-elements-nextjs 0.2.49 → 0.2.51
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 +12 -6
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/styles.css +1 -1
package/dist/index.js
CHANGED
|
@@ -1169,14 +1169,19 @@ function Video({
|
|
|
1169
1169
|
const parsed = useMemo(() => parseVideoChildren(children), [children]);
|
|
1170
1170
|
const [captions, setCaptions] = useState([]);
|
|
1171
1171
|
const [poster, setPoster] = useState(void 0);
|
|
1172
|
+
const captionsSourceRef = useRef("");
|
|
1172
1173
|
useEffect(() => {
|
|
1174
|
+
const sourceKey = parsed.captionsSrc ?? parsed.captionsData?.[0]?.srclang ?? "";
|
|
1173
1175
|
function applyResolved(data) {
|
|
1174
1176
|
const resolved = data.map((c, i) => ({ ...c, default: c.default ?? i === 0 }));
|
|
1175
1177
|
setCaptions(resolved);
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1178
|
+
if (captionsSourceRef.current !== sourceKey) {
|
|
1179
|
+
captionsSourceRef.current = sourceKey;
|
|
1180
|
+
const defaultTrack = resolved.find((c) => c.default);
|
|
1181
|
+
if (defaultTrack) {
|
|
1182
|
+
setSubtitleMode(defaultTrack.srclang);
|
|
1183
|
+
setSubtitleStyle((st) => ({ ...st, track: defaultTrack.srclang }));
|
|
1184
|
+
}
|
|
1180
1185
|
}
|
|
1181
1186
|
}
|
|
1182
1187
|
if (parsed.captionsData) {
|
|
@@ -1410,6 +1415,7 @@ function Video({
|
|
|
1410
1415
|
t.removeEventListener("cuechange", onCueChange);
|
|
1411
1416
|
t.addEventListener("cuechange", onCueChange);
|
|
1412
1417
|
});
|
|
1418
|
+
applySubtitleMode(subtitleModeRef.current);
|
|
1413
1419
|
};
|
|
1414
1420
|
bindTracks();
|
|
1415
1421
|
video.textTracks.addEventListener("addtrack", bindTracks);
|
|
@@ -1952,7 +1958,7 @@ function Video({
|
|
|
1952
1958
|
label: subtitle.label,
|
|
1953
1959
|
default: subtitle.default
|
|
1954
1960
|
},
|
|
1955
|
-
`${activeSource.src}-${subtitle.srclang}`
|
|
1961
|
+
`${activeSource.src}-${subtitle.srclang}-${subtitle.src}`
|
|
1956
1962
|
)),
|
|
1957
1963
|
parsed.storyboard?.src && /* @__PURE__ */ jsx(
|
|
1958
1964
|
"track",
|