@livo-tv/blocks 1.27.0 → 1.28.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.js CHANGED
@@ -4972,6 +4972,18 @@ function VideoPlayer({
4972
4972
  setLevel(index);
4973
4973
  setOpenMenu(null);
4974
4974
  }
4975
+ function chooseCaption(locale) {
4976
+ setCaptionLocale(locale);
4977
+ setOpenMenu(null);
4978
+ }
4979
+ function toggleControls() {
4980
+ setOpenMenu(null);
4981
+ setControlsVisible((current) => {
4982
+ const next = !current;
4983
+ if (next) scheduleHide();
4984
+ return next;
4985
+ });
4986
+ }
4975
4987
  function handleKeyDown(e) {
4976
4988
  if (!active) return;
4977
4989
  switch (e.key) {
@@ -5037,7 +5049,7 @@ function VideoPlayer({
5037
5049
  }
5038
5050
  const VolumeIcon = isMuted || volume === 0 ? VolumeX : volume < 0.5 ? Volume1 : Volume2;
5039
5051
  const showSpinner = active && (state === "loading" || state === "waiting");
5040
- const showControls = active && state === "ready" && (controlsVisible || !isPlaying);
5052
+ const showControls = active && state === "ready" && controlsVisible;
5041
5053
  const showPoster = !active && !!poster;
5042
5054
  const currentLevelLabel = activeLevel < 0 ? t.auto : `${qualities.find((q) => q.index === activeLevel)?.height ?? ""}p`;
5043
5055
  const showQuality = showQualitySelector && qualities.length > 1;
@@ -5072,7 +5084,7 @@ function VideoPlayer({
5072
5084
  playsInline: true,
5073
5085
  muted: isMuted,
5074
5086
  className: "livo-video-player-media h-full w-full bg-black object-contain",
5075
- onClick: active ? togglePlay : void 0,
5087
+ onClick: active ? toggleControls : void 0,
5076
5088
  poster,
5077
5089
  children: !liveCaptionsBaseUrl ? CAPTION_LOCALES.map((locale) => {
5078
5090
  const url = captionsVttUrlFromPlayback(src, locale);
@@ -5235,7 +5247,7 @@ function VideoPlayer({
5235
5247
  MenuItem,
5236
5248
  {
5237
5249
  selected: captionLocale === "off",
5238
- onSelect: () => setCaptionLocale("off"),
5250
+ onSelect: () => chooseCaption("off"),
5239
5251
  children: t.captionsOff
5240
5252
  }
5241
5253
  ),
@@ -5243,7 +5255,7 @@ function VideoPlayer({
5243
5255
  MenuItem,
5244
5256
  {
5245
5257
  selected: captionLocale === locale,
5246
- onSelect: () => setCaptionLocale(locale),
5258
+ onSelect: () => chooseCaption(locale),
5247
5259
  children: captionLocaleLabel(locale, t)
5248
5260
  },
5249
5261
  locale