@livo-tv/blocks 1.27.0 → 1.29.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
@@ -4942,12 +4942,17 @@ function VideoPlayer({
4942
4942
  exitCssFullscreen();
4943
4943
  return;
4944
4944
  }
4945
- if (el && hasStandardFullscreen() && typeof el.requestFullscreen === "function") {
4946
- void el.requestFullscreen();
4945
+ if (video && typeof video.webkitEnterFullscreen === "function") {
4946
+ try {
4947
+ video.webkitEnterFullscreen();
4948
+ } catch {
4949
+ setCssFullscreen(true);
4950
+ setIsFullscreen(true);
4951
+ }
4947
4952
  return;
4948
4953
  }
4949
- if (embedded && video && typeof video.webkitEnterFullscreen === "function") {
4950
- video.webkitEnterFullscreen();
4954
+ if (el && hasStandardFullscreen() && typeof el.requestFullscreen === "function") {
4955
+ void el.requestFullscreen();
4951
4956
  return;
4952
4957
  }
4953
4958
  setCssFullscreen(true);
@@ -4972,6 +4977,18 @@ function VideoPlayer({
4972
4977
  setLevel(index);
4973
4978
  setOpenMenu(null);
4974
4979
  }
4980
+ function chooseCaption(locale) {
4981
+ setCaptionLocale(locale);
4982
+ setOpenMenu(null);
4983
+ }
4984
+ function toggleControls() {
4985
+ setOpenMenu(null);
4986
+ setControlsVisible((current) => {
4987
+ const next = !current;
4988
+ if (next) scheduleHide();
4989
+ return next;
4990
+ });
4991
+ }
4975
4992
  function handleKeyDown(e) {
4976
4993
  if (!active) return;
4977
4994
  switch (e.key) {
@@ -5037,7 +5054,7 @@ function VideoPlayer({
5037
5054
  }
5038
5055
  const VolumeIcon = isMuted || volume === 0 ? VolumeX : volume < 0.5 ? Volume1 : Volume2;
5039
5056
  const showSpinner = active && (state === "loading" || state === "waiting");
5040
- const showControls = active && state === "ready" && (controlsVisible || !isPlaying);
5057
+ const showControls = active && state === "ready" && controlsVisible;
5041
5058
  const showPoster = !active && !!poster;
5042
5059
  const currentLevelLabel = activeLevel < 0 ? t.auto : `${qualities.find((q) => q.index === activeLevel)?.height ?? ""}p`;
5043
5060
  const showQuality = showQualitySelector && qualities.length > 1;
@@ -5072,7 +5089,7 @@ function VideoPlayer({
5072
5089
  playsInline: true,
5073
5090
  muted: isMuted,
5074
5091
  className: "livo-video-player-media h-full w-full bg-black object-contain",
5075
- onClick: active ? togglePlay : void 0,
5092
+ onClick: active ? toggleControls : void 0,
5076
5093
  poster,
5077
5094
  children: !liveCaptionsBaseUrl ? CAPTION_LOCALES.map((locale) => {
5078
5095
  const url = captionsVttUrlFromPlayback(src, locale);
@@ -5235,7 +5252,7 @@ function VideoPlayer({
5235
5252
  MenuItem,
5236
5253
  {
5237
5254
  selected: captionLocale === "off",
5238
- onSelect: () => setCaptionLocale("off"),
5255
+ onSelect: () => chooseCaption("off"),
5239
5256
  children: t.captionsOff
5240
5257
  }
5241
5258
  ),
@@ -5243,7 +5260,7 @@ function VideoPlayer({
5243
5260
  MenuItem,
5244
5261
  {
5245
5262
  selected: captionLocale === locale,
5246
- onSelect: () => setCaptionLocale(locale),
5263
+ onSelect: () => chooseCaption(locale),
5247
5264
  children: captionLocaleLabel(locale, t)
5248
5265
  },
5249
5266
  locale