@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.js CHANGED
@@ -3116,7 +3116,7 @@ function WaitingRoom({
3116
3116
  alt: "",
3117
3117
  className: "size-10 rounded-lg object-cover"
3118
3118
  }
3119
- ) : /* @__PURE__ */ 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() }),
3119
+ ) : /* @__PURE__ */ 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() }),
3120
3120
  /* @__PURE__ */ jsxs("div", { children: [
3121
3121
  /* @__PURE__ */ jsx("p", { className: "text-lg font-semibold tracking-tight", children: title }),
3122
3122
  organizationName ? /* @__PURE__ */ jsx("p", { className: "text-sm text-white/80", children: organizationName }) : null
@@ -3230,7 +3230,7 @@ function parseThumbnailsVtt(text, vttUrl) {
3230
3230
  return cues;
3231
3231
  }
3232
3232
  function cueAtTime(cues, time) {
3233
- if (cues.length === 0) return null;
3233
+ if (cues.length === 0 || !Number.isFinite(time)) return null;
3234
3234
  const hit = cues.find((cue) => time >= cue.start && time < cue.end);
3235
3235
  if (hit) return hit;
3236
3236
  const last = cues[cues.length - 1];
@@ -3238,10 +3238,18 @@ function cueAtTime(cues, time) {
3238
3238
  return cues[0] ?? null;
3239
3239
  }
3240
3240
  function hoverTimeFromClientX(clientX, rect, duration) {
3241
- if (rect.width <= 0 || duration <= 0) return 0;
3241
+ if (rect.width <= 0 || !Number.isFinite(duration) || duration <= 0) return 0;
3242
3242
  const ratio = Math.min(1, Math.max(0, (clientX - rect.left) / rect.width));
3243
3243
  return ratio * duration;
3244
3244
  }
3245
+ function finitePlaybackDuration(duration, seekable, mode) {
3246
+ if (Number.isFinite(duration) && duration > 0) return duration;
3247
+ if (mode === "vod" && seekable.length > 0) {
3248
+ const span = seekable.end(seekable.length - 1) - seekable.start(0);
3249
+ if (Number.isFinite(span) && span > 0) return span;
3250
+ }
3251
+ return 0;
3252
+ }
3245
3253
  async function loadThumbnailsVtt(src) {
3246
3254
  const vttUrl = thumbnailsVttUrlFromPlayback(src);
3247
3255
  if (!vttUrl) return [];
@@ -3285,7 +3293,7 @@ function SeekBar({
3285
3293
  },
3286
3294
  [duration]
3287
3295
  );
3288
- const cue = hoverTime !== null && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
3296
+ const cue = hoverTime !== null && Number.isFinite(duration) && duration > 0 && cues && cues.length > 0 ? cueAtTime(cues, hoverTime) : null;
3289
3297
  const hoverPercent = hoverTime !== null && duration > 0 ? Math.min(100, Math.max(0, hoverTime / duration * 100)) : 0;
3290
3298
  return /* @__PURE__ */ jsxs(
3291
3299
  "div",
@@ -3410,7 +3418,8 @@ function createLiveHlsConfig() {
3410
3418
  }
3411
3419
  function createVodHlsConfig() {
3412
3420
  return {
3413
- enableWorker: true
3421
+ enableWorker: true,
3422
+ startPosition: 0
3414
3423
  };
3415
3424
  }
3416
3425
 
@@ -4514,7 +4523,7 @@ function VideoPlayer({
4514
4523
  }
4515
4524
  }
4516
4525
  };
4517
- const onDuration = () => setDuration(video.duration);
4526
+ const onDuration = () => setDuration(finitePlaybackDuration(video.duration, video.seekable, mode));
4518
4527
  const onVolume = () => {
4519
4528
  setIsMuted(video.muted);
4520
4529
  setVolume(video.volume);
@@ -4977,7 +4986,7 @@ function VideoPlayer({
4977
4986
  {
4978
4987
  type: "button",
4979
4988
  onClick: retry,
4980
- className: "inline-flex items-center gap-2 rounded-md bg-white/15 px-3 py-1.5 text-sm hover:bg-white/25",
4989
+ className: "inline-flex items-center gap-2 rounded-md bg-primary/15 px-3 py-1.5 text-sm hover:bg-primary/25",
4981
4990
  children: [
4982
4991
  /* @__PURE__ */ jsx(RotateCw, { className: "size-4" }),
4983
4992
  t.retry
@@ -5089,7 +5098,7 @@ function VideoPlayer({
5089
5098
  {
5090
5099
  type: "button",
5091
5100
  onClick: goToLiveEdge,
5092
- 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",
5101
+ 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",
5093
5102
  children: [
5094
5103
  /* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-red-500" }),
5095
5104
  t.goLive
@@ -5274,7 +5283,7 @@ function VideoPlayer({
5274
5283
  onSelect: () => setMorePane("quality")
5275
5284
  }
5276
5285
  ),
5277
- (mode === "vod" || showQuality) && /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-white/15" }),
5286
+ (mode === "vod" || showQuality) && /* @__PURE__ */ jsx("div", { className: "my-1 h-px bg-primary/15" }),
5278
5287
  /* @__PURE__ */ jsx(
5279
5288
  MenuAction,
5280
5289
  {
@@ -5330,7 +5339,7 @@ function ControlButton({
5330
5339
  "aria-label": label,
5331
5340
  title: label,
5332
5341
  onClick,
5333
- 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",
5342
+ 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",
5334
5343
  children
5335
5344
  }
5336
5345
  );
@@ -5353,7 +5362,7 @@ function MenuControl({
5353
5362
  "aria-expanded": open,
5354
5363
  title: label,
5355
5364
  onClick: () => onOpenChange(!open),
5356
- 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",
5365
+ 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",
5357
5366
  children: [
5358
5367
  trigger,
5359
5368
  triggerBadge && /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium", children: triggerBadge })
@@ -5382,7 +5391,7 @@ function MenuItem({
5382
5391
  role: "menuitemradio",
5383
5392
  "aria-checked": selected,
5384
5393
  onClick: onSelect,
5385
- 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",
5394
+ 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",
5386
5395
  children: [
5387
5396
  children,
5388
5397
  selected && /* @__PURE__ */ jsx(Check, { className: "size-4" })
@@ -5403,7 +5412,7 @@ function MenuNavRow({
5403
5412
  role: "menuitem",
5404
5413
  "aria-label": `${label}, ${value}`,
5405
5414
  onClick: onSelect,
5406
- className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5415
+ className: "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
5407
5416
  children: [
5408
5417
  /* @__PURE__ */ jsx("span", { className: "text-white/70", children: icon }),
5409
5418
  /* @__PURE__ */ jsx("span", { className: "flex-1", children: label }),
@@ -5425,7 +5434,7 @@ function MenuBack({
5425
5434
  role: "menuitem",
5426
5435
  "aria-label": label,
5427
5436
  onClick: onSelect,
5428
- className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5437
+ className: "flex w-full items-center gap-2 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
5429
5438
  children: [
5430
5439
  /* @__PURE__ */ jsx(ChevronLeft, { className: "size-4" }),
5431
5440
  /* @__PURE__ */ jsx("span", { className: "font-medium", children: title })
@@ -5446,7 +5455,7 @@ function MenuAction({
5446
5455
  role: "menuitem",
5447
5456
  onClick: onSelect,
5448
5457
  className: cn(
5449
- "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-white/15",
5458
+ "flex w-full items-center gap-2.5 rounded px-2 py-2.5 text-left text-white/90 hover:bg-primary/15",
5450
5459
  active && "text-primary"
5451
5460
  ),
5452
5461
  children: [