@geekapps/silo-elements-nextjs 0.2.49 → 0.2.50

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/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
- const defaultTrack = resolved.find((c) => c.default);
1177
- if (defaultTrack) {
1178
- setSubtitleMode(defaultTrack.srclang);
1179
- setSubtitleStyle((st) => ({ ...st, track: defaultTrack.srclang }));
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) {