@livo-tv/blocks 1.15.0 → 1.16.0
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.cjs +14 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3954,6 +3954,15 @@ function captionAtTime(cues, time, options) {
|
|
|
3954
3954
|
if (matched) return matched;
|
|
3955
3955
|
return null;
|
|
3956
3956
|
}
|
|
3957
|
+
function vttCuesDueAt(cues, currentTime, cap = LIVE_STACK_MAX_CUES) {
|
|
3958
|
+
if (!Number.isFinite(currentTime)) return [];
|
|
3959
|
+
return cues.filter(
|
|
3960
|
+
(cue) => Boolean(cue.text.trim()) && Number.isFinite(cue.start) && cue.start <= currentTime
|
|
3961
|
+
).sort((left, right) => left.start - right.start).slice(-Math.max(1, cap)).map((cue) => ({
|
|
3962
|
+
text: cue.text.trim(),
|
|
3963
|
+
receivedAt: cue.start * 1e3
|
|
3964
|
+
}));
|
|
3965
|
+
}
|
|
3957
3966
|
function liveCuesDue(cues, now, lagMs, extraLagMs = LIVE_CUE_EXTRA_LAG_MS) {
|
|
3958
3967
|
if (lagMs == null || !Number.isFinite(lagMs) || lagMs < 0) return [];
|
|
3959
3968
|
const threshold = lagMs + extraLagMs;
|
|
@@ -4457,10 +4466,11 @@ function VideoPlayer({
|
|
|
4457
4466
|
window.clearInterval(timer);
|
|
4458
4467
|
};
|
|
4459
4468
|
}, [captionLocale, liveCaptionsBaseUrl, src]);
|
|
4469
|
+
const endedLiveReplay = !liveCaptionsBaseUrl && isLivePlaylistSrc(src);
|
|
4460
4470
|
const liveDueCues = liveCaptionsBaseUrl ? coalesceLiveCaptionCues(
|
|
4461
4471
|
liveCuesDue(liveCaptionCues, Date.now(), liveLagMs)
|
|
4462
|
-
) : [];
|
|
4463
|
-
const activeCaption = liveCaptionsBaseUrl ? null : captionAtTime(captionCues, currentTime);
|
|
4472
|
+
) : endedLiveReplay ? coalesceLiveCaptionCues(vttCuesDueAt(captionCues, currentTime)) : [];
|
|
4473
|
+
const activeCaption = liveCaptionsBaseUrl || endedLiveReplay ? null : captionAtTime(captionCues, currentTime);
|
|
4464
4474
|
function togglePlay() {
|
|
4465
4475
|
const video = videoRef.current;
|
|
4466
4476
|
if (!video) return;
|
|
@@ -4690,8 +4700,8 @@ function VideoPlayer({
|
|
|
4690
4700
|
] }),
|
|
4691
4701
|
typeof stats?.viewers === "number" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded bg-black/60 px-2 py-0.5 text-xs", children: t.formatViewers ? t.formatViewers(stats.viewers) : `\u{1F441} ${stats.viewers}` })
|
|
4692
4702
|
] }),
|
|
4693
|
-
liveCaptionsBaseUrl && captionLocale !== "off" && /* @__PURE__ */ jsxRuntime.jsx(LiveCaptionStack, { cues: liveDueCues, latestLabel: t.captionsLatest }),
|
|
4694
|
-
!liveCaptionsBaseUrl && activeCaption && captionLocale !== "off" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4703
|
+
(liveCaptionsBaseUrl || endedLiveReplay) && captionLocale !== "off" && /* @__PURE__ */ jsxRuntime.jsx(LiveCaptionStack, { cues: liveDueCues, latestLabel: t.captionsLatest }),
|
|
4704
|
+
!liveCaptionsBaseUrl && !endedLiveReplay && activeCaption && captionLocale !== "off" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4695
4705
|
"div",
|
|
4696
4706
|
{
|
|
4697
4707
|
className: "pointer-events-none absolute inset-x-0 bottom-16 z-[1] flex justify-center px-4",
|