analytica-frontend-lib 1.1.11 → 1.1.12
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/VideoPlayer/index.js +26 -6
- package/dist/VideoPlayer/index.js.map +1 -1
- package/dist/VideoPlayer/index.mjs +26 -6
- package/dist/VideoPlayer/index.mjs.map +1 -1
- package/dist/index.css +7 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -6
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +7 -0
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6789,6 +6789,8 @@ import {
|
|
|
6789
6789
|
DotsThreeVertical as DotsThreeVertical2
|
|
6790
6790
|
} from "phosphor-react";
|
|
6791
6791
|
import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6792
|
+
var CONTROLS_HIDE_TIMEOUT = 3e3;
|
|
6793
|
+
var LEAVE_HIDE_TIMEOUT = 1e3;
|
|
6792
6794
|
var formatTime = (seconds) => {
|
|
6793
6795
|
if (!seconds || isNaN(seconds)) return "0:00";
|
|
6794
6796
|
const mins = Math.floor(seconds / 60);
|
|
@@ -6908,6 +6910,16 @@ var VideoPlayer = ({
|
|
|
6908
6910
|
const controlsTimeoutRef = useRef9(null);
|
|
6909
6911
|
const lastMousePositionRef = useRef9({ x: 0, y: 0 });
|
|
6910
6912
|
const mouseMoveTimeoutRef = useRef9(null);
|
|
6913
|
+
const isUserInteracting = useCallback(() => {
|
|
6914
|
+
if (showSpeedMenu) return true;
|
|
6915
|
+
const activeElement = document.activeElement;
|
|
6916
|
+
const videoContainer = videoRef.current?.parentElement;
|
|
6917
|
+
if (activeElement && videoContainer?.contains(activeElement)) {
|
|
6918
|
+
const isControl = activeElement.matches("button, input, [tabindex]");
|
|
6919
|
+
if (isControl) return true;
|
|
6920
|
+
}
|
|
6921
|
+
return false;
|
|
6922
|
+
}, [showSpeedMenu]);
|
|
6911
6923
|
const clearControlsTimeout = useCallback(() => {
|
|
6912
6924
|
if (controlsTimeoutRef.current) {
|
|
6913
6925
|
clearTimeout(controlsTimeoutRef.current);
|
|
@@ -6924,12 +6936,11 @@ var VideoPlayer = ({
|
|
|
6924
6936
|
setShowControls(true);
|
|
6925
6937
|
clearControlsTimeout();
|
|
6926
6938
|
if (isPlaying) {
|
|
6927
|
-
const timeout = isFullscreen ? 2e3 : 3e3;
|
|
6928
6939
|
controlsTimeoutRef.current = window.setTimeout(() => {
|
|
6929
6940
|
setShowControls(false);
|
|
6930
|
-
},
|
|
6941
|
+
}, CONTROLS_HIDE_TIMEOUT);
|
|
6931
6942
|
}
|
|
6932
|
-
}, [isPlaying,
|
|
6943
|
+
}, [isPlaying, clearControlsTimeout]);
|
|
6933
6944
|
const handleMouseMove = useCallback(
|
|
6934
6945
|
(event) => {
|
|
6935
6946
|
const currentX = event.clientX;
|
|
@@ -6943,6 +6954,14 @@ var VideoPlayer = ({
|
|
|
6943
6954
|
},
|
|
6944
6955
|
[showControlsWithTimer]
|
|
6945
6956
|
);
|
|
6957
|
+
const handleMouseLeave = useCallback(() => {
|
|
6958
|
+
clearControlsTimeout();
|
|
6959
|
+
if (isPlaying && !isUserInteracting()) {
|
|
6960
|
+
controlsTimeoutRef.current = window.setTimeout(() => {
|
|
6961
|
+
setShowControls(false);
|
|
6962
|
+
}, LEAVE_HIDE_TIMEOUT);
|
|
6963
|
+
}
|
|
6964
|
+
}, [isPlaying, clearControlsTimeout, isUserInteracting]);
|
|
6946
6965
|
useEffect11(() => {
|
|
6947
6966
|
if (videoRef.current) {
|
|
6948
6967
|
videoRef.current.volume = volume;
|
|
@@ -7243,12 +7262,13 @@ var VideoPlayer = ({
|
|
|
7243
7262
|
className: cn(
|
|
7244
7263
|
"relative w-full bg-background overflow-hidden group",
|
|
7245
7264
|
title || subtitleText ? "rounded-b-xl" : "rounded-xl",
|
|
7246
|
-
// Hide cursor when controls are hidden and video is playing
|
|
7247
|
-
|
|
7265
|
+
// Hide cursor when controls are hidden and video is playing
|
|
7266
|
+
isPlaying && !showControls ? "cursor-none group-hover:cursor-default" : "cursor-default"
|
|
7248
7267
|
),
|
|
7249
7268
|
"aria-label": title ? `Video player: ${title}` : "Video player",
|
|
7250
|
-
onMouseMove:
|
|
7269
|
+
onMouseMove: handleMouseMove,
|
|
7251
7270
|
onMouseEnter: showControlsWithTimer,
|
|
7271
|
+
onMouseLeave: handleMouseLeave,
|
|
7252
7272
|
children: [
|
|
7253
7273
|
/* @__PURE__ */ jsx36(
|
|
7254
7274
|
"video",
|