@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.js CHANGED
@@ -15191,7 +15191,6 @@ var init_SettingsMenu = __esm({
15191
15191
  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
15192
15192
  ${isFullscreen ? "bottom-20 right-4" : "bottom-16 right-4"}
15193
15193
  `,
15194
- onClick: (e) => e.stopPropagation(),
15195
15194
  children: menuLevel === "main" ? (
15196
15195
  // Main Menu
15197
15196
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "p-2", children: [
@@ -15453,7 +15452,6 @@ var init_DockPanel = __esm({
15453
15452
  border-l border-white/20 shadow-2xl flex flex-col z-20
15454
15453
  ${containerWidth < 768 ? "w-full" : containerWidth < 1024 ? "w-[50%]" : "w-[30%]"}
15455
15454
  `,
15456
- onClick: (e) => e.stopPropagation(),
15457
15455
  style: {
15458
15456
  height: showControls ? `calc(100% - ${containerWidth < 640 ? "60px" : "80px"})` : "100%"
15459
15457
  },
@@ -15811,7 +15809,6 @@ var init_PopupOverlay = __esm({
15811
15809
  activePopup,
15812
15810
  ((_g = activePopupStyles.overlay) == null ? void 0 : _g.padding) || "12px"
15813
15811
  )),
15814
- onClick: (e) => e.stopPropagation(),
15815
15812
  children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
15816
15813
  motion.div,
15817
15814
  __spreadProps(__spreadValues({}, getPopupAnimationConfig(activePopup)), {
@@ -18127,7 +18124,6 @@ var ErrorDisplay = (0, import_react28.memo)(function ErrorDisplay2({
18127
18124
  animate: { opacity: 1 },
18128
18125
  exit: { opacity: 0 },
18129
18126
  className: "absolute inset-0 flex items-center justify-center z-30 bg-black/90",
18130
- onClick: (e) => e.stopPropagation(),
18131
18127
  children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "text-center px-6 max-w-md", children: [
18132
18128
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
18133
18129
  "div",
@@ -18262,10 +18258,7 @@ var PosterOverlay = (0, import_react30.memo)(function PosterOverlay2({
18262
18258
  transition: { duration: 0.3 },
18263
18259
  className: "absolute inset-0 z-50 cursor-pointer",
18264
18260
  style: { backgroundColor: "black" },
18265
- onClick: (e) => {
18266
- e.stopPropagation();
18267
- onPlay();
18268
- },
18261
+ onClick: onPlay,
18269
18262
  children: [
18270
18263
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
18271
18264
  "img",
@@ -19579,7 +19572,6 @@ function ControlBar({
19579
19572
  exit: { opacity: 0, y: 20 },
19580
19573
  transition: { duration: 0.25, ease: "easeOut" },
19581
19574
  className: "absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/95 via-black/70 to-transparent backdrop-blur-md",
19582
- onClick: (e) => e.stopPropagation(),
19583
19575
  style: {
19584
19576
  padding: containerWidth < 400 ? "8px" : containerWidth < 640 ? "12px" : "16px"
19585
19577
  },
@@ -20130,7 +20122,6 @@ var PasswordDialog = (0, import_react35.memo)(function PasswordDialog2({
20130
20122
  animate: { scale: 1, opacity: 1 },
20131
20123
  exit: { scale: 0.9, opacity: 0 },
20132
20124
  className: "w-full max-w-sm mx-4",
20133
- onClick: (e) => e.stopPropagation(),
20134
20125
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "bg-gray-900/95 backdrop-blur-md rounded-xl shadow-2xl border border-white/10 p-6", children: [
20135
20126
  /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "text-center mb-6", children: [
20136
20127
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -20569,17 +20560,29 @@ function usePipMonitor({
20569
20560
  const [isPictureInPicture, setIsPictureInPicture] = (0, import_react40.useState)(false);
20570
20561
  const [isSupported, setIsSupported] = (0, import_react40.useState)(false);
20571
20562
  const [canActivate, setCanActivate] = (0, import_react40.useState)(false);
20563
+ const [videoElement, setVideoElement] = (0, import_react40.useState)(null);
20572
20564
  const onEnterPipRef = (0, import_react40.useRef)(onEnterPip);
20573
20565
  const onLeavePipRef = (0, import_react40.useRef)(onLeavePip);
20574
20566
  onEnterPipRef.current = onEnterPip;
20575
20567
  onLeavePipRef.current = onLeavePip;
20576
20568
  (0, import_react40.useEffect)(() => {
20577
- const video = videoRef.current;
20578
- const supported = isPipSupported() && video && "requestPictureInPicture" in video;
20579
- setIsSupported(!!supported);
20569
+ setIsSupported(isPipSupported());
20570
+ }, []);
20571
+ (0, import_react40.useEffect)(() => {
20572
+ if (videoRef.current) {
20573
+ setVideoElement(videoRef.current);
20574
+ return;
20575
+ }
20576
+ const interval = setInterval(() => {
20577
+ if (videoRef.current) {
20578
+ setVideoElement(videoRef.current);
20579
+ clearInterval(interval);
20580
+ }
20581
+ }, 100);
20582
+ return () => clearInterval(interval);
20580
20583
  }, [videoRef]);
20581
20584
  (0, import_react40.useEffect)(() => {
20582
- const video = videoRef.current;
20585
+ const video = videoElement;
20583
20586
  if (!video || !isSupported || !enabled) return;
20584
20587
  const handleEnterPip = () => {
20585
20588
  var _a;
@@ -20597,9 +20600,9 @@ function usePipMonitor({
20597
20600
  video.removeEventListener("enterpictureinpicture", handleEnterPip);
20598
20601
  video.removeEventListener("leavepictureinpicture", handleLeavePip);
20599
20602
  };
20600
- }, [videoRef, isSupported, enabled]);
20603
+ }, [videoElement, isSupported, enabled]);
20601
20604
  (0, import_react40.useEffect)(() => {
20602
- const video = videoRef.current;
20605
+ const video = videoElement;
20603
20606
  if (!video || !isSupported) {
20604
20607
  setCanActivate(false);
20605
20608
  return;
@@ -20618,7 +20621,7 @@ function usePipMonitor({
20618
20621
  video.removeEventListener("loadeddata", updateCanActivate);
20619
20622
  video.removeEventListener("canplay", updateCanActivate);
20620
20623
  };
20621
- }, [videoRef, isSupported]);
20624
+ }, [videoElement, isSupported]);
20622
20625
  const enterPip = (0, import_react40.useCallback)(() => __async(null, null, function* () {
20623
20626
  const video = videoRef.current;
20624
20627
  if (!video || !canActivate) return;
@@ -22038,7 +22041,7 @@ function UpNextOverlay({
22038
22041
  const maxSeconds = 10;
22039
22042
  const percentage = Math.max(0, Math.min(100, displaySeconds / maxSeconds * 100));
22040
22043
  const strokeDasharray = `${percentage} 100`;
22041
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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__ */ (0, import_jsx_runtime25.jsxs)("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: [
22044
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute right-6 bottom-[80px] z-[60] animate-in fade-in slide-in-from-bottom-4 duration-300", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("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: [
22042
22045
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("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: [
22043
22046
  thumbnailUrl ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("img", { src: thumbnailUrl, alt: nextVideoTitle, className: "w-full h-full object-cover opacity-60 group-hover:opacity-40 transition-opacity" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute inset-0 bg-white/5 group-hover:bg-white/10 transition-colors" }),
22044
22047
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("svg", { className: "absolute inset-0 w-full h-full -rotate-90 pointer-events-none", viewBox: "0 0 36 36", children: [
@@ -26340,8 +26343,7 @@ function SimpleVideoPlayer({
26340
26343
  if (!showControls) {
26341
26344
  viewDispatch(viewActions.setShowControls(true));
26342
26345
  }
26343
- togglePlay();
26344
- }, [showControls, togglePlay]);
26346
+ }, [showControls]);
26345
26347
  useKeyboardShortcuts({
26346
26348
  containerRef,
26347
26349
  togglePlay,