@hyperstream/videoplayer 0.1.8 → 0.1.9

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.mjs CHANGED
@@ -15177,7 +15177,6 @@ var init_SettingsMenu = __esm({
15177
15177
  absolute z-30 w-56 max-h-80 overflow-y-auto bg-black/90 border border-white/20 backdrop-blur-sm rounded-lg shadow-2xl
15178
15178
  ${isFullscreen ? "bottom-20 right-4" : "bottom-16 right-4"}
15179
15179
  `,
15180
- onClick: (e) => e.stopPropagation(),
15181
15180
  children: menuLevel === "main" ? (
15182
15181
  // Main Menu
15183
15182
  /* @__PURE__ */ jsxs11("div", { className: "p-2", children: [
@@ -15439,7 +15438,6 @@ var init_DockPanel = __esm({
15439
15438
  border-l border-white/20 shadow-2xl flex flex-col z-20
15440
15439
  ${containerWidth < 768 ? "w-full" : containerWidth < 1024 ? "w-[50%]" : "w-[30%]"}
15441
15440
  `,
15442
- onClick: (e) => e.stopPropagation(),
15443
15441
  style: {
15444
15442
  height: showControls ? `calc(100% - ${containerWidth < 640 ? "60px" : "80px"})` : "100%"
15445
15443
  },
@@ -15797,7 +15795,6 @@ var init_PopupOverlay = __esm({
15797
15795
  activePopup,
15798
15796
  ((_g = activePopupStyles.overlay) == null ? void 0 : _g.padding) || "12px"
15799
15797
  )),
15800
- onClick: (e) => e.stopPropagation(),
15801
15798
  children: /* @__PURE__ */ jsxs13(
15802
15799
  motion.div,
15803
15800
  __spreadProps(__spreadValues({}, getPopupAnimationConfig(activePopup)), {
@@ -18112,7 +18109,6 @@ var ErrorDisplay = memo3(function ErrorDisplay2({
18112
18109
  animate: { opacity: 1 },
18113
18110
  exit: { opacity: 0 },
18114
18111
  className: "absolute inset-0 flex items-center justify-center z-30 bg-black/90",
18115
- onClick: (e) => e.stopPropagation(),
18116
18112
  children: /* @__PURE__ */ jsxs3("div", { className: "text-center px-6 max-w-md", children: [
18117
18113
  /* @__PURE__ */ jsx9(
18118
18114
  "div",
@@ -18247,10 +18243,7 @@ var PosterOverlay = memo4(function PosterOverlay2({
18247
18243
  transition: { duration: 0.3 },
18248
18244
  className: "absolute inset-0 z-50 cursor-pointer",
18249
18245
  style: { backgroundColor: "black" },
18250
- onClick: (e) => {
18251
- e.stopPropagation();
18252
- onPlay();
18253
- },
18246
+ onClick: onPlay,
18254
18247
  children: [
18255
18248
  /* @__PURE__ */ jsx11(
18256
18249
  "img",
@@ -19570,7 +19563,6 @@ function ControlBar({
19570
19563
  exit: { opacity: 0, y: 20 },
19571
19564
  transition: { duration: 0.25, ease: "easeOut" },
19572
19565
  className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/95 via-black/70 to-transparent backdrop-blur-md",
19573
- onClick: (e) => e.stopPropagation(),
19574
19566
  style: {
19575
19567
  padding: containerWidth < 400 ? "8px" : containerWidth < 640 ? "12px" : "16px"
19576
19568
  },
@@ -20121,7 +20113,6 @@ var PasswordDialog = memo6(function PasswordDialog2({
20121
20113
  animate: { scale: 1, opacity: 1 },
20122
20114
  exit: { scale: 0.9, opacity: 0 },
20123
20115
  className: "w-full max-w-sm mx-4",
20124
- onClick: (e) => e.stopPropagation(),
20125
20116
  children: /* @__PURE__ */ jsxs9("div", { className: "bg-gray-900/95 backdrop-blur-md rounded-xl shadow-2xl border border-white/10 p-6", children: [
20126
20117
  /* @__PURE__ */ jsxs9("div", { className: "text-center mb-6", children: [
20127
20118
  /* @__PURE__ */ jsx23(
@@ -20560,17 +20551,29 @@ function usePipMonitor({
20560
20551
  const [isPictureInPicture, setIsPictureInPicture] = useState9(false);
20561
20552
  const [isSupported, setIsSupported] = useState9(false);
20562
20553
  const [canActivate, setCanActivate] = useState9(false);
20554
+ const [videoElement, setVideoElement] = useState9(null);
20563
20555
  const onEnterPipRef = useRef14(onEnterPip);
20564
20556
  const onLeavePipRef = useRef14(onLeavePip);
20565
20557
  onEnterPipRef.current = onEnterPip;
20566
20558
  onLeavePipRef.current = onLeavePip;
20567
20559
  useEffect13(() => {
20568
- const video = videoRef.current;
20569
- const supported = isPipSupported() && video && "requestPictureInPicture" in video;
20570
- setIsSupported(!!supported);
20560
+ setIsSupported(isPipSupported());
20561
+ }, []);
20562
+ useEffect13(() => {
20563
+ if (videoRef.current) {
20564
+ setVideoElement(videoRef.current);
20565
+ return;
20566
+ }
20567
+ const interval = setInterval(() => {
20568
+ if (videoRef.current) {
20569
+ setVideoElement(videoRef.current);
20570
+ clearInterval(interval);
20571
+ }
20572
+ }, 100);
20573
+ return () => clearInterval(interval);
20571
20574
  }, [videoRef]);
20572
20575
  useEffect13(() => {
20573
- const video = videoRef.current;
20576
+ const video = videoElement;
20574
20577
  if (!video || !isSupported || !enabled) return;
20575
20578
  const handleEnterPip = () => {
20576
20579
  var _a;
@@ -20588,9 +20591,9 @@ function usePipMonitor({
20588
20591
  video.removeEventListener("enterpictureinpicture", handleEnterPip);
20589
20592
  video.removeEventListener("leavepictureinpicture", handleLeavePip);
20590
20593
  };
20591
- }, [videoRef, isSupported, enabled]);
20594
+ }, [videoElement, isSupported, enabled]);
20592
20595
  useEffect13(() => {
20593
- const video = videoRef.current;
20596
+ const video = videoElement;
20594
20597
  if (!video || !isSupported) {
20595
20598
  setCanActivate(false);
20596
20599
  return;
@@ -20609,7 +20612,7 @@ function usePipMonitor({
20609
20612
  video.removeEventListener("loadeddata", updateCanActivate);
20610
20613
  video.removeEventListener("canplay", updateCanActivate);
20611
20614
  };
20612
- }, [videoRef, isSupported]);
20615
+ }, [videoElement, isSupported]);
20613
20616
  const enterPip = useCallback12(() => __async(null, null, function* () {
20614
20617
  const video = videoRef.current;
20615
20618
  if (!video || !canActivate) return;
@@ -22029,7 +22032,7 @@ function UpNextOverlay({
22029
22032
  const maxSeconds = 10;
22030
22033
  const percentage = Math.max(0, Math.min(100, displaySeconds / maxSeconds * 100));
22031
22034
  const strokeDasharray = `${percentage} 100`;
22032
- return /* @__PURE__ */ jsx25("div", { className: "absolute right-6 bottom-[80px] z-[60] animate-in fade-in slide-in-from-bottom-4 duration-300", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxs10("div", { className: "bg-black/80 backdrop-blur-md border border-white/10 rounded-xl p-4 shadow-2xl flex items-center gap-4 w-[320px] transition-all hover:bg-black/90", children: [
22035
+ return /* @__PURE__ */ jsx25("div", { className: "absolute right-6 bottom-[80px] z-[60] animate-in fade-in slide-in-from-bottom-4 duration-300", children: /* @__PURE__ */ jsxs10("div", { className: "bg-black/80 backdrop-blur-md border border-white/10 rounded-xl p-4 shadow-2xl flex items-center gap-4 w-[320px] transition-all hover:bg-black/90", children: [
22033
22036
  /* @__PURE__ */ jsxs10("div", { className: "relative w-16 h-16 shrink-0 flex items-center justify-center rounded-lg bg-white/5 overflow-hidden group cursor-pointer", onClick: onPlayNext, children: [
22034
22037
  thumbnailUrl ? /* @__PURE__ */ jsx25("img", { src: thumbnailUrl, alt: nextVideoTitle, className: "w-full h-full object-cover opacity-60 group-hover:opacity-40 transition-opacity" }) : /* @__PURE__ */ jsx25("div", { className: "absolute inset-0 bg-white/5 group-hover:bg-white/10 transition-colors" }),
22035
22038
  /* @__PURE__ */ jsxs10("svg", { className: "absolute inset-0 w-full h-full -rotate-90 pointer-events-none", viewBox: "0 0 36 36", children: [
@@ -26331,8 +26334,7 @@ function SimpleVideoPlayer({
26331
26334
  if (!showControls) {
26332
26335
  viewDispatch(viewActions.setShowControls(true));
26333
26336
  }
26334
- togglePlay();
26335
- }, [showControls, togglePlay]);
26337
+ }, [showControls]);
26336
26338
  useKeyboardShortcuts({
26337
26339
  containerRef,
26338
26340
  togglePlay,