@livo-tv/blocks 1.33.0 → 1.35.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/video.cjs CHANGED
@@ -2730,13 +2730,13 @@ function captionDwellMs(text, backlog = 0) {
2730
2730
  const max = backlog > 0 ? CAPTION_RUSH_DWELL_MS : CAPTION_MAX_DWELL_MS;
2731
2731
  return Math.min(max, Math.max(CAPTION_MIN_DWELL_MS, raw));
2732
2732
  }
2733
- function advanceLiveCaptionPlayout(state, cues, now, lagMs, maxCharsPerLine = CAPTION_MAX_CHARS_PER_LINE) {
2733
+ function advanceLiveCaptionPlayout(state, cues, now, lagMs, maxCharsPerLine = CAPTION_MAX_CHARS_PER_LINE, extraLagMs = LIVE_CUE_EXTRA_LAG_MS) {
2734
2734
  let screen = state.screen;
2735
2735
  let hideAt = state.hideAt;
2736
2736
  let cursor = state.cursor;
2737
2737
  let queue = state.queue.slice();
2738
2738
  if (lagMs != null && Number.isFinite(lagMs) && lagMs >= 0) {
2739
- const threshold = lagMs + LIVE_CUE_EXTRA_LAG_MS;
2739
+ const threshold = lagMs + extraLagMs;
2740
2740
  const incoming = cues.filter(
2741
2741
  (cue) => Boolean(cue.text.trim()) && Number.isFinite(cue.receivedAt) && cue.receivedAt > cursor && now - cue.receivedAt >= threshold
2742
2742
  ).sort((left, right) => left.receivedAt - right.receivedAt);
@@ -3535,7 +3535,11 @@ function isEmbeddedWindow(win = window) {
3535
3535
  return true;
3536
3536
  }
3537
3537
  }
3538
- function CaptionOverlay({ screen }) {
3538
+ function CaptionOverlay({
3539
+ screen,
3540
+ className,
3541
+ textClassName
3542
+ }) {
3539
3543
  const lastSpeakerRef = React11__namespace.useRef(void 0);
3540
3544
  const lastSpeaker = lastSpeakerRef.current;
3541
3545
  React11__namespace.useLayoutEffect(() => {
@@ -3547,14 +3551,20 @@ function CaptionOverlay({ screen }) {
3547
3551
  return /* @__PURE__ */ jsxRuntime.jsx(
3548
3552
  "div",
3549
3553
  {
3550
- className: "pointer-events-none absolute inset-x-0 bottom-16 z-[1] flex justify-center px-4",
3554
+ className: cn(
3555
+ "pointer-events-none absolute inset-x-0 bottom-16 z-[1] flex justify-center px-4",
3556
+ className
3557
+ ),
3551
3558
  "data-slot": "video-captions",
3552
3559
  children: /* @__PURE__ */ jsxRuntime.jsx(
3553
3560
  "p",
3554
3561
  {
3555
3562
  role: "status",
3556
3563
  "aria-live": "polite",
3557
- className: "line-clamp-2 max-w-[90%] whitespace-pre-line break-words rounded-sm bg-black/70 px-3 py-1.5 text-center text-[length:clamp(10px,2.6cqh,0.875rem)] font-medium text-white shadow-sm [-webkit-text-size-adjust:100%] [text-size-adjust:100%]",
3564
+ className: cn(
3565
+ "line-clamp-2 max-w-[90%] whitespace-pre-line break-words rounded-sm bg-black/70 px-3 py-1.5 text-center text-[length:clamp(10px,2.6cqh,0.875rem)] font-medium text-white shadow-sm [-webkit-text-size-adjust:100%] [text-size-adjust:100%]",
3566
+ textClassName
3567
+ ),
3558
3568
  children: text
3559
3569
  }
3560
3570
  )
@@ -4134,16 +4144,21 @@ function VideoPlayer({
4134
4144
  if (video.paused) void video.play();
4135
4145
  else video.pause();
4136
4146
  }
4137
- function toggleMute() {
4147
+ function applyMuted(next) {
4138
4148
  const video = videoRef.current;
4139
- if (!video) return;
4140
- video.muted = !video.muted;
4149
+ isMutedRef.current = next;
4150
+ setIsMuted(next);
4151
+ if (video) video.muted = next;
4152
+ }
4153
+ function toggleMute() {
4154
+ applyMuted(!isMutedRef.current);
4141
4155
  }
4142
4156
  function changeVolume(next) {
4143
4157
  const video = videoRef.current;
4144
4158
  if (!video) return;
4145
4159
  video.volume = next;
4146
- video.muted = next === 0;
4160
+ setVolume(next);
4161
+ applyMuted(next === 0);
4147
4162
  }
4148
4163
  function seekTo(next) {
4149
4164
  const video = videoRef.current;
@@ -4405,7 +4420,7 @@ function VideoPlayer({
4405
4420
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "size-8 translate-x-0.5", fill: "currentColor" })
4406
4421
  }
4407
4422
  ) }),
4408
- state === "ready" && autoplayState === "muted" && /* @__PURE__ */ jsxRuntime.jsxs(
4423
+ state === "ready" && autoplayState === "muted" && isMuted && /* @__PURE__ */ jsxRuntime.jsxs(
4409
4424
  "button",
4410
4425
  {
4411
4426
  type: "button",
@@ -5089,6 +5104,7 @@ function createPlaybackBeaconClient({
5089
5104
  }
5090
5105
 
5091
5106
  exports.CAPTION_LOCALES = CAPTION_LOCALES;
5107
+ exports.CaptionOverlay = CaptionOverlay;
5092
5108
  exports.CurtainPicker = CurtainPicker;
5093
5109
  exports.CurtainPickerSkeleton = CurtainPickerSkeleton;
5094
5110
  exports.CurtainPreview = CurtainPreview;
@@ -5096,12 +5112,14 @@ exports.CurtainStage = CurtainStage;
5096
5112
  exports.DEFAULT_CURTAIN_PICKER_LABELS = DEFAULT_CURTAIN_PICKER_LABELS;
5097
5113
  exports.DEFAULT_SHADER_CURTAIN_CONFIG = DEFAULT_SHADER_CURTAIN_CONFIG;
5098
5114
  exports.DEFAULT_SHADER_CURTAIN_EDITOR_LABELS = DEFAULT_SHADER_CURTAIN_EDITOR_LABELS;
5115
+ exports.EMPTY_LIVE_CAPTION_PLAYOUT = EMPTY_LIVE_CAPTION_PLAYOUT;
5099
5116
  exports.FeedVideoPlayer = FeedVideoPlayer;
5100
5117
  exports.SHADER_CURTAIN_PRESETS = SHADER_CURTAIN_PRESETS;
5101
5118
  exports.ShaderCurtain = ShaderCurtain;
5102
5119
  exports.ShaderCurtainEditor = ShaderCurtainEditor;
5103
5120
  exports.VideoPlayer = VideoPlayer;
5104
5121
  exports.WaitingRoom = WaitingRoom;
5122
+ exports.advanceLiveCaptionPlayout = advanceLiveCaptionPlayout;
5105
5123
  exports.captionsVttUrlFromPlayback = captionsVttUrlFromPlayback;
5106
5124
  exports.captureShaderPoster = captureShaderPoster;
5107
5125
  exports.castHlsUrl = castHlsUrl;
@@ -5112,7 +5130,10 @@ exports.describeAvResync = describeAvResync;
5112
5130
  exports.describePlaybackError = describePlaybackError;
5113
5131
  exports.isCaptionLocale = isCaptionLocale;
5114
5132
  exports.isShaderCurtainKind = isShaderCurtainKind;
5133
+ exports.liveCaptionsUrl = liveCaptionsUrl;
5115
5134
  exports.loadCastSender = loadCastSender;
5135
+ exports.loadLiveCaptions = loadLiveCaptions;
5136
+ exports.mergeLiveCaptionCues = mergeLiveCaptionCues;
5116
5137
  exports.mergeShaderCurtainConfig = mergeShaderCurtainConfig;
5117
5138
  exports.parseShaderGradientUrl = parseShaderGradientUrl;
5118
5139
  exports.shouldRetryLiveEdge404 = shouldRetryLiveEdge404;