@livo-tv/blocks 1.20.0 → 1.22.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
@@ -3142,7 +3142,7 @@ function WaitingRoom({
3142
3142
  alt: "",
3143
3143
  className: "size-10 rounded-lg object-cover"
3144
3144
  }
3145
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-10 items-center justify-center rounded-lg bg-white/15 text-sm font-semibold", children: (organizationName ?? title).slice(0, 1).toUpperCase() }),
3145
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex size-10 items-center justify-center rounded-lg bg-primary/15 text-sm font-semibold", children: (organizationName ?? title).slice(0, 1).toUpperCase() }),
3146
3146
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3147
3147
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold tracking-tight", children: title }),
3148
3148
  organizationName ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-white/80", children: organizationName }) : null
@@ -3256,7 +3256,7 @@ function parseThumbnailsVtt(text, vttUrl) {
3256
3256
  return cues;
3257
3257
  }
3258
3258
  function cueAtTime(cues, time) {
3259
- if (cues.length === 0) return null;
3259
+ if (cues.length === 0 || !Number.isFinite(time)) return null;
3260
3260
  const hit = cues.find((cue) => time >= cue.start && time < cue.end);
3261
3261
  if (hit) return hit;
3262
3262
  const last = cues[cues.length - 1];
@@ -3264,10 +3264,18 @@ function cueAtTime(cues, time) {
3264
3264
  return cues[0] ?? null;
3265
3265
  }
3266
3266
  function hoverTimeFromClientX(clientX, rect, duration) {
3267
- if (rect.width <= 0 || duration <= 0) return 0;
3267
+ if (rect.width <= 0 || !Number.isFinite(duration) || duration <= 0) return 0;
3268
3268
  const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
3269
3269
  return ratio * duration;
3270
3270
  }
3271
+ function finitePlaybackDuration(duration, seekable, mode) {
3272
+ if (Number.isFinite(duration) && duration > 0) return duration;
3273
+ if (mode === "vod" && seekable.length > 0) {
3274
+ const span = seekable.end(seekable.length - 1) - seekable.start(0);
3275
+ if (Number.isFinite(span) && span > 0) return span;
3276
+ }
3277
+ return 0;
3278
+ }
3271
3279
  async function loadThumbnailsVtt(src) {
3272
3280
  const vttUrl = thumbnailsVttUrlFromPlayback(src);
3273
3281
  if (!vttUrl) return [];
@@ -3311,7 +3319,7 @@ function SeekBar({
3311
3319
  },
3312
3320
  [duration]
3313
3321
  );
3314
- const cue = hoverTime !== null && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
3322
+ const cue = hoverTime !== null && Number.isFinite(duration) && duration > 0 && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
3315
3323
  const hoverPercent = hoverTime !== null && duration > 0 ? Math.min(100, Math.max(0, hoverTime / duration * 100)) : 0;
3316
3324
  return /* @__PURE__ */ jsxRuntime.jsxs(
3317
3325
  "div",
@@ -3436,7 +3444,8 @@ function createLiveHlsConfig() {
3436
3444
  }
3437
3445
  function createVodHlsConfig() {
3438
3446
  return {
3439
- enableWorker: true
3447
+ enableWorker: true,
3448
+ startPosition: 0
3440
3449
  };
3441
3450
  }
3442
3451
 
@@ -4540,7 +4549,7 @@ function VideoPlayer({
4540
4549
  }
4541
4550
  }
4542
4551
  };
4543
- const onDuration = () => setDuration(video.duration);
4552
+ const onDuration = () => setDuration(finitePlaybackDuration(video.duration, video.seekable, mode));
4544
4553
  const onVolume = () => {
4545
4554
  setIsMuted(video.muted);
4546
4555
  setVolume(video.volume);
@@ -5003,7 +5012,7 @@ function VideoPlayer({
5003
5012
  {
5004
5013
  type: "button",
5005
5014
  onClick: retry,
5006
- className: "inline-flex items-center gap-2 rounded-md bg-white/15 px-3 py-1.5 text-sm hover:bg-white/25",
5015
+ className: "inline-flex items-center gap-2 rounded-md bg-primary/15 px-3 py-1.5 text-sm hover:bg-primary/25",
5007
5016
  children: [
5008
5017
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCw, { className: "size-4" }),
5009
5018
  t.retry
@@ -5115,7 +5124,7 @@ function VideoPlayer({
5115
5124
  {
5116
5125
  type: "button",
5117
5126
  onClick: goToLiveEdge,
5118
- className: "ml-1 flex shrink-0 items-center gap-1 rounded bg-white/15 px-2 py-0.5 text-xs hover:bg-white/25",
5127
+ className: "ml-1 flex shrink-0 items-center gap-1 rounded bg-primary/15 px-2 py-0.5 text-xs hover:bg-primary/25",
5119
5128
  children: [
5120
5129
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-1.5 rounded-full bg-red-500" }),
5121
5130
  t.goLive
@@ -5300,7 +5309,7 @@ function VideoPlayer({
5300
5309
  onSelect: () => setMorePane("quality")
5301
5310
  }
5302
5311
  ),
5303
- (mode === "vod" || showQuality) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px bg-white/15" }),
5312
+ (mode === "vod" || showQuality) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-1 h-px bg-primary/15" }),
5304
5313
  /* @__PURE__ */ jsxRuntime.jsx(
5305
5314
  MenuAction,
5306
5315
  {
@@ -5356,7 +5365,7 @@ function ControlButton({
5356
5365
  "aria-label": label,
5357
5366
  title: label,
5358
5367
  onClick,
5359
- className: "flex size-8 items-center justify-center rounded-md text-white/90 outline-none hover:bg-white/15 hover:text-white focus-visible:ring-2 focus-visible:ring-white/60",
5368
+ className: "flex size-8 items-center justify-center rounded-md text-white/90 outline-none hover:bg-primary/15 hover:text-white focus-visible:ring-2 focus-visible:ring-white/60",
5360
5369
  children
5361
5370
  }
5362
5371
  );
@@ -5379,7 +5388,7 @@ function MenuControl({
5379
5388
  "aria-expanded": open,
5380
5389
  title: label,
5381
5390
  onClick: () => onOpenChange(!open),
5382
- className: "flex h-8 items-center gap-1 rounded-md px-1.5 text-white/90 outline-none hover:bg-white/15 hover:text-white focus-visible:ring-2 focus-visible:ring-white/60",
5391
+ className: "flex h-8 items-center gap-1 rounded-md px-1.5 text-white/90 outline-none hover:bg-primary/15 hover:text-white focus-visible:ring-2 focus-visible:ring-white/60",
5383
5392
  children: [
5384
5393
  trigger,
5385
5394
  triggerBadge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-medium", children: triggerBadge })
@@ -5408,7 +5417,7 @@ function MenuItem({
5408
5417
  role: "menuitemradio",
5409
5418
  "aria-checked": selected,
5410
5419
  onClick: onSelect,
5411
- className: "flex w-full items-center justify-between gap-3 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5420
+ className: "flex w-full items-center justify-between gap-3 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
5412
5421
  children: [
5413
5422
  children,
5414
5423
  selected && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-4" })
@@ -5429,7 +5438,7 @@ function MenuNavRow({
5429
5438
  role: "menuitem",
5430
5439
  "aria-label": `${label}, ${value}`,
5431
5440
  onClick: onSelect,
5432
- className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5441
+ className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
5433
5442
  children: [
5434
5443
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-white/70", children: icon }),
5435
5444
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: label }),
@@ -5451,7 +5460,7 @@ function MenuBack({
5451
5460
  role: "menuitem",
5452
5461
  "aria-label": label,
5453
5462
  onClick: onSelect,
5454
- className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5463
+ className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
5455
5464
  children: [
5456
5465
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "size-4" }),
5457
5466
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: title })
@@ -5472,7 +5481,7 @@ function MenuAction({
5472
5481
  role: "menuitem",
5473
5482
  onClick: onSelect,
5474
5483
  className: cn(
5475
- "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5484
+ "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
5476
5485
  active && "text-primary"
5477
5486
  ),
5478
5487
  children: [