@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.cjs CHANGED
@@ -4968,12 +4968,17 @@ function VideoPlayer({
4968
4968
  exitCssFullscreen();
4969
4969
  return;
4970
4970
  }
4971
- if (el && hasStandardFullscreen() && typeof el.requestFullscreen === "function") {
4972
- void el.requestFullscreen();
4971
+ if (video && typeof video.webkitEnterFullscreen === "function") {
4972
+ try {
4973
+ video.webkitEnterFullscreen();
4974
+ } catch {
4975
+ setCssFullscreen(true);
4976
+ setIsFullscreen(true);
4977
+ }
4973
4978
  return;
4974
4979
  }
4975
- if (embedded && video && typeof video.webkitEnterFullscreen === "function") {
4976
- video.webkitEnterFullscreen();
4980
+ if (el && hasStandardFullscreen() && typeof el.requestFullscreen === "function") {
4981
+ void el.requestFullscreen();
4977
4982
  return;
4978
4983
  }
4979
4984
  setCssFullscreen(true);
@@ -4998,6 +5003,18 @@ function VideoPlayer({
4998
5003
  setLevel(index);
4999
5004
  setOpenMenu(null);
5000
5005
  }
5006
+ function chooseCaption(locale) {
5007
+ setCaptionLocale(locale);
5008
+ setOpenMenu(null);
5009
+ }
5010
+ function toggleControls() {
5011
+ setOpenMenu(null);
5012
+ setControlsVisible((current) => {
5013
+ const next = !current;
5014
+ if (next) scheduleHide();
5015
+ return next;
5016
+ });
5017
+ }
5001
5018
  function handleKeyDown(e) {
5002
5019
  if (!active) return;
5003
5020
  switch (e.key) {
@@ -5063,7 +5080,7 @@ function VideoPlayer({
5063
5080
  }
5064
5081
  const VolumeIcon = isMuted || volume === 0 ? lucideReact.VolumeX : volume < 0.5 ? lucideReact.Volume1 : lucideReact.Volume2;
5065
5082
  const showSpinner = active && (state === "loading" || state === "waiting");
5066
- const showControls = active && state === "ready" && (controlsVisible || !isPlaying);
5083
+ const showControls = active && state === "ready" && controlsVisible;
5067
5084
  const showPoster = !active && !!poster;
5068
5085
  const currentLevelLabel = activeLevel < 0 ? t.auto : `${qualities.find((q) => q.index === activeLevel)?.height ?? ""}p`;
5069
5086
  const showQuality = showQualitySelector && qualities.length > 1;
@@ -5098,7 +5115,7 @@ function VideoPlayer({
5098
5115
  playsInline: true,
5099
5116
  muted: isMuted,
5100
5117
  className: "livo-video-player-media h-full w-full bg-black object-contain",
5101
- onClick: active ? togglePlay : void 0,
5118
+ onClick: active ? toggleControls : void 0,
5102
5119
  poster,
5103
5120
  children: !liveCaptionsBaseUrl ? CAPTION_LOCALES.map((locale) => {
5104
5121
  const url = captionsVttUrlFromPlayback(src, locale);
@@ -5261,7 +5278,7 @@ function VideoPlayer({
5261
5278
  MenuItem,
5262
5279
  {
5263
5280
  selected: captionLocale === "off",
5264
- onSelect: () => setCaptionLocale("off"),
5281
+ onSelect: () => chooseCaption("off"),
5265
5282
  children: t.captionsOff
5266
5283
  }
5267
5284
  ),
@@ -5269,7 +5286,7 @@ function VideoPlayer({
5269
5286
  MenuItem,
5270
5287
  {
5271
5288
  selected: captionLocale === locale,
5272
- onSelect: () => setCaptionLocale(locale),
5289
+ onSelect: () => chooseCaption(locale),
5273
5290
  children: captionLocaleLabel(locale, t)
5274
5291
  },
5275
5292
  locale