@geekapps/silo-elements-nextjs 0.2.42 → 0.2.43

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.
@@ -97,7 +97,6 @@ function Video({
97
97
  const [isFullscreen, setIsFullscreen] = useState(false);
98
98
  const [playerHeight, setPlayerHeight] = useState(0);
99
99
  const [playerWidth, setPlayerWidth] = useState(0);
100
- const [error, setError] = useState(null);
101
100
  const activeSource = parsed.sources[sourceIndex] ?? parsed.sources[0] ?? null;
102
101
  const progressPercent = duration ? currentTime / duration * 100 : 0;
103
102
  const bufferedPercent = duration ? bufferedTime / duration * 100 : 0;
@@ -368,7 +367,6 @@ function Video({
368
367
  return;
369
368
  }
370
369
  destroyMediaEngines();
371
- setError(null);
372
370
  setIsLoading(true);
373
371
  setCurrentTime(0);
374
372
  setBufferedTime(0);
@@ -413,13 +411,13 @@ function Video({
413
411
  setIsLoading(false);
414
412
  });
415
413
  dash.on(dashjs.MediaPlayer.events.ERROR, () => {
416
- setError("N\xE3o foi poss\xEDvel reproduzir o stream MPEG-DASH.");
414
+ console.error("[Silo] MPEG-DASH playback failed");
417
415
  setIsLoading(false);
418
416
  });
419
417
  dash.initialize(video, activeSource.src, false);
420
418
  } catch {
421
419
  if (!cancelled) {
422
- setError("N\xE3o foi poss\xEDvel carregar o player MPEG-DASH.");
420
+ console.error("[Silo] MPEG-DASH player load failed");
423
421
  setIsLoading(false);
424
422
  }
425
423
  }
@@ -485,7 +483,7 @@ function Video({
485
483
  hls.recoverMediaError();
486
484
  return;
487
485
  }
488
- setError("N\xE3o foi poss\xEDvel reproduzir o stream HLS.");
486
+ console.error("[Silo] HLS playback failed");
489
487
  setIsLoading(false);
490
488
  });
491
489
  return;
@@ -496,11 +494,11 @@ function Video({
496
494
  setIsLoading(false);
497
495
  return;
498
496
  }
499
- setError("Este navegador n\xE3o suporta HLS.");
497
+ console.error("[Silo] HLS not supported in this browser");
500
498
  setIsLoading(false);
501
499
  } catch {
502
500
  if (!cancelled) {
503
- setError("N\xE3o foi poss\xEDvel carregar o player HLS.");
501
+ console.error("[Silo] HLS player load failed");
504
502
  setIsLoading(false);
505
503
  }
506
504
  }
@@ -522,9 +520,18 @@ function Video({
522
520
  const togglePlay = useCallback(async () => {
523
521
  const video = videoRef.current;
524
522
  if (!video) return;
523
+ const wasPaused = video.paused;
525
524
  try {
526
- const wasPaused = video.paused;
527
525
  if (wasPaused) {
526
+ if (video.readyState < HTMLMediaElement.HAVE_FUTURE_DATA) {
527
+ await new Promise((resolve) => {
528
+ const onReady = () => {
529
+ video.removeEventListener("canplay", onReady);
530
+ resolve();
531
+ };
532
+ video.addEventListener("canplay", onReady);
533
+ });
534
+ }
528
535
  await video.play();
529
536
  } else {
530
537
  video.pause();
@@ -537,7 +544,6 @@ function Video({
537
544
  600
538
545
  );
539
546
  } catch {
540
- setError("O navegador bloqueou a reprodu\xE7\xE3o autom\xE1tica.");
541
547
  }
542
548
  }, []);
543
549
  const seekRelative = useCallback((seconds) => {
@@ -591,7 +597,7 @@ function Video({
591
597
  }
592
598
  throw new Error("Fullscreen unavailable");
593
599
  } catch {
594
- setError("N\xE3o foi poss\xEDvel alterar o modo fullscreen.");
600
+ console.error("[Silo] Fullscreen toggle failed");
595
601
  }
596
602
  }, []);
597
603
  const changeAudio = useCallback((trackId) => {
@@ -826,7 +832,6 @@ function Video({
826
832
  }
827
833
  ),
828
834
  isLoading && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 z-20 grid place-items-center bg-black/10", children: /* @__PURE__ */ jsx("div", { className: "size-9 animate-spin rounded-full border-2 border-white/25 border-t-white" }) }),
829
- error && /* @__PURE__ */ jsx("div", { className: "absolute inset-x-8 top-1/2 z-40 -translate-y-1/2 rounded-2xl border border-white/10 bg-black/75 p-5 text-center text-sm text-white shadow-2xl backdrop-blur-xl", children: error }),
830
835
  /* @__PURE__ */ jsxs(
831
836
  "div",
832
837
  {