softbuilders-react-video-player 1.1.23 → 1.1.25
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/ControlBar/index.d.ts +2 -1
- package/dist/components/ControlBar/index.js +2 -2
- package/dist/components/ControlBar/index.js.map +1 -1
- package/dist/components/ControlBar/index.tsx +7 -1
- package/dist/components/VideoPlayerComponent/index.js +10 -5
- package/dist/components/VideoPlayerComponent/index.js.map +1 -1
- package/dist/components/VideoPlayerComponent/index.tsx +12 -5
- package/dist/components/VolumeSlider/index.d.ts +2 -1
- package/dist/components/VolumeSlider/index.js +12 -4
- package/dist/components/VolumeSlider/index.js.map +1 -1
- package/dist/components/VolumeSlider/index.tsx +17 -3
- package/dist/index.css +0 -6
- package/dist/index.mjs +39 -11
- package/dist/styles/tailwind.css +0 -6
- package/package.json +1 -1
@@ -11,6 +11,7 @@ type Props<T> = {
|
|
11
11
|
seekStep?: number;
|
12
12
|
id?: string;
|
13
13
|
handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
|
14
|
+
handleControlDisplayTimer: (e: any) => void;
|
14
15
|
};
|
15
|
-
declare const ControlBar: <T>({ player, isPaused, setIsPaused, duration, notes, chapters, seekStep, id, handleSaveNoteAction, }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
16
|
+
declare const ControlBar: <T>({ player, isPaused, setIsPaused, duration, notes, chapters, seekStep, id, handleSaveNoteAction, handleControlDisplayTimer, }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
16
17
|
export default ControlBar;
|
@@ -11,7 +11,7 @@ import CurrentTimeTracker from "../CurrentTimeTracker";
|
|
11
11
|
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
12
12
|
import SubtitleMenu from "../SubtitleMenu";
|
13
13
|
import { BackwardIcon, ForwardIcon, FullScreenIcon, PauseIcon, PlayIcon, } from "../../images";
|
14
|
-
const ControlBar = ({ player, isPaused, setIsPaused, duration, notes, chapters, seekStep = 5, id, handleSaveNoteAction, }) => {
|
14
|
+
const ControlBar = ({ player, isPaused, setIsPaused, duration, notes, chapters, seekStep = 5, id, handleSaveNoteAction, handleControlDisplayTimer, }) => {
|
15
15
|
const { setPlayer, setDuration } = useSoftBuildersVideoPlayerContext();
|
16
16
|
const [width, setWidth] = useState(0);
|
17
17
|
const [isSeeking, setIsSeeking] = useState(true);
|
@@ -60,7 +60,7 @@ const ControlBar = ({ player, isPaused, setIsPaused, duration, notes, chapters,
|
|
60
60
|
left: "5%",
|
61
61
|
top: "90%",
|
62
62
|
}
|
63
|
-
: { width: "100%" }, className: `flex gap-2 ${width < 400 ? "absolute sb-top-1" : "-sb-translate-y-0 sb-w-full"} hover:sb-w-[45%] sb-transition-all sb-ease-in-out sb-duration-500`, children: [_jsx(CurrentTimeLabel, {}), _jsx(TimeSliderContainer, { chapters: chapters, notes: notes }), _jsx("p", { children: durationFormater(duration) })] }) }), _jsx("div", { className: "sb-h-full", children: _jsx(VolumeSlider, { width: width, setIsSeeking: (val) => setIsSeeking(val) }) }), _jsx(QualityMenu, { width: width }), handleSaveNoteAction && (_jsx(CreateNoteMenu, { handleSaveNoteAction: handleSaveNoteAction })), _jsx(SubtitleMenu, { width: width }), _jsx("button", { onClick: (e) => {
|
63
|
+
: { width: "100%" }, className: `flex gap-2 ${width < 400 ? "absolute sb-top-1" : "-sb-translate-y-0 sb-w-full"} hover:sb-w-[45%] sb-transition-all sb-ease-in-out sb-duration-500`, children: [_jsx(CurrentTimeLabel, {}), _jsx(TimeSliderContainer, { chapters: chapters, notes: notes }), _jsx("p", { children: durationFormater(duration) })] }) }), _jsx("div", { className: "sb-h-full", children: _jsx(VolumeSlider, { width: width, setIsSeeking: (val) => setIsSeeking(val), handleControlDisplayTimer: handleControlDisplayTimer }) }), _jsx(QualityMenu, { width: width }), handleSaveNoteAction && (_jsx(CreateNoteMenu, { handleSaveNoteAction: handleSaveNoteAction })), _jsx(SubtitleMenu, { width: width }), _jsx("button", { onClick: (e) => {
|
64
64
|
e.preventDefault();
|
65
65
|
e.stopPropagation();
|
66
66
|
if (player === null || player === void 0 ? void 0 : player.isFullscreen()) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ControlBar/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AACzD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAKvD,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,SAAS,EACT,QAAQ,GACT,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ControlBar/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AACzD,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAKvD,OAAO,EAAE,iCAAiC,EAAE,MA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MAAM,uBAAN,MAAM,CAAE,YAAY,EAAE,EAAE,CAAC;wBAC3B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,EAAE,CAAC;oBAC3B,CAAC;yBAAM,CAAC;wBACN,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,iBAAiB,EAAE,CAAC;oBAC9B,CAAC;gBACH,CAAC,YAED,KAAC,cAAc,IAAC,SAAS,EAAC,eAAe,GAAG,GACrC,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
@@ -32,6 +32,7 @@ type Props<T> = {
|
|
32
32
|
seekStep?: number;
|
33
33
|
id?: string;
|
34
34
|
handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
|
35
|
+
handleControlDisplayTimer: (e: any) => void;
|
35
36
|
};
|
36
37
|
|
37
38
|
const ControlBar = <T,>({
|
@@ -44,6 +45,7 @@ const ControlBar = <T,>({
|
|
44
45
|
seekStep = 5,
|
45
46
|
id,
|
46
47
|
handleSaveNoteAction,
|
48
|
+
handleControlDisplayTimer,
|
47
49
|
}: Props<T>) => {
|
48
50
|
const { setPlayer, setDuration } = useSoftBuildersVideoPlayerContext();
|
49
51
|
const [width, setWidth] = useState<number>(0);
|
@@ -151,7 +153,11 @@ const ControlBar = <T,>({
|
|
151
153
|
}
|
152
154
|
|
153
155
|
<div className="sb-h-full">
|
154
|
-
<VolumeSlider
|
156
|
+
<VolumeSlider
|
157
|
+
width={width}
|
158
|
+
setIsSeeking={(val) => setIsSeeking(val)}
|
159
|
+
handleControlDisplayTimer={handleControlDisplayTimer}
|
160
|
+
/>
|
155
161
|
</div>
|
156
162
|
|
157
163
|
<QualityMenu width={width} />
|
@@ -22,7 +22,7 @@ const renderBigPlayButton = (id, player, isPaused, setIsPaused) => {
|
|
22
22
|
}
|
23
23
|
};
|
24
24
|
let controlBarRoot = {};
|
25
|
-
const renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, chapters, seekStep = 5, handleSaveNoteAction, opacity = "0") => {
|
25
|
+
const renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, chapters, seekStep = 5, handleSaveNoteAction, opacity = "0", handleControlDisplayTimer = () => { }) => {
|
26
26
|
const container = document.getElementById(`video-container-${id}`);
|
27
27
|
if (container) {
|
28
28
|
const element = container.querySelector(".vjs-control-bar");
|
@@ -34,7 +34,7 @@ const renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, ch
|
|
34
34
|
element.style.opacity = opacity;
|
35
35
|
element.style.height = "100%";
|
36
36
|
element.style.alignItems = "flex-end";
|
37
|
-
controlBarRoot[id].render(_jsx(SoftBuildersVideoPlayerProvider, { children: _jsx(ControlBar, { id: id, player: player, isPaused: isPaused, setIsPaused: setIsPaused, duration: duration, notes: notes, chapters: chapters, seekStep: seekStep, handleSaveNoteAction: handleSaveNoteAction }) }));
|
37
|
+
controlBarRoot[id].render(_jsx(SoftBuildersVideoPlayerProvider, { children: _jsx(ControlBar, { id: id, player: player, isPaused: isPaused, setIsPaused: setIsPaused, duration: duration, notes: notes, chapters: chapters, seekStep: seekStep, handleSaveNoteAction: handleSaveNoteAction, handleControlDisplayTimer: handleControlDisplayTimer }) }));
|
38
38
|
}
|
39
39
|
}
|
40
40
|
};
|
@@ -108,7 +108,9 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
|
|
108
108
|
useEffect(() => {
|
109
109
|
if (isReady) {
|
110
110
|
const controlBarTimeout = setTimeout(() => {
|
111
|
-
renderControlBar(id, playerRef.current, isPaused, setIsPaused, duration, notes, chapters, 5, handleSaveNoteAction, opacity)
|
111
|
+
renderControlBar(id, playerRef.current, isPaused, setIsPaused, duration, notes, chapters, 5, handleSaveNoteAction, opacity, (e) => {
|
112
|
+
handlePlayerClick(e, true);
|
113
|
+
});
|
112
114
|
}, 500);
|
113
115
|
return () => clearTimeout(controlBarTimeout);
|
114
116
|
}
|
@@ -159,15 +161,18 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
|
|
159
161
|
};
|
160
162
|
}, []);
|
161
163
|
const timeoutRef = useRef(null);
|
162
|
-
const handlePlayerClick = async (e) => {
|
164
|
+
const handlePlayerClick = async (e, isTimerOnly = false) => {
|
163
165
|
e.preventDefault();
|
164
166
|
if (timeoutRef.current) {
|
165
167
|
clearTimeout(timeoutRef.current);
|
166
168
|
}
|
167
169
|
setOpacity("100");
|
168
|
-
setTimeout(() => {
|
170
|
+
timeoutRef.current = setTimeout(() => {
|
169
171
|
setOpacity("0");
|
170
172
|
}, 5000);
|
173
|
+
if (isTimerOnly) {
|
174
|
+
return;
|
175
|
+
}
|
171
176
|
if (playerRef.current) {
|
172
177
|
if (playerRef.current.paused()) {
|
173
178
|
try {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/VideoPlayerComponent/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,eAAe,CAAC;AAMvC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,IAAI,iBAAiB,GAEjB,EAAE,CAAC;AACP,MAAM,mBAAmB,GAAG,CAC1B,EAAU,EACV,MAA0B,EAC1B,QAAiB,EACjB,WAA0D,EAC1D,EAAE;IACF,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IACnE,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,OAAO,GAAQ,SAAS,CAAC,aAAa,CAAC,sBAAsB,CAAC,CAAC;QACrE,I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C,8CAA8C,YAExD,cACE,SAAS,EAAC,yBAAyB,2BAGnC,KAAK,EAAE;gBACL,MAAM,EAAE,MAAM,EAAE,0BAA0B;gBAC1C,QAAQ,EAAE,UAAU;aACrB,YAED,cAAK,OAAO,EAAE,iBAAiB,EAAE,GAAG,EAAE,QAAQ,GAAI,GAC9C,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,oBAAoB,CAAC"}
|
@@ -53,7 +53,8 @@ const renderControlBar = <T,>(
|
|
53
53
|
chapters: SoftBuildersVideoPlayerChapter[],
|
54
54
|
seekStep: number = 5,
|
55
55
|
handleSaveNoteAction?: (time: number, note: string) => Promise<T>,
|
56
|
-
opacity: string = "0"
|
56
|
+
opacity: string = "0",
|
57
|
+
handleControlDisplayTimer: (e: any) => void = () => {}
|
57
58
|
) => {
|
58
59
|
const container = document.getElementById(`video-container-${id}`);
|
59
60
|
if (container) {
|
@@ -78,6 +79,7 @@ const renderControlBar = <T,>(
|
|
78
79
|
chapters={chapters}
|
79
80
|
seekStep={seekStep}
|
80
81
|
handleSaveNoteAction={handleSaveNoteAction}
|
82
|
+
handleControlDisplayTimer={handleControlDisplayTimer}
|
81
83
|
/>
|
82
84
|
</SoftBuildersVideoPlayerProvider>
|
83
85
|
);
|
@@ -184,7 +186,10 @@ const VideoPlayerComponent = <T,>({
|
|
184
186
|
chapters,
|
185
187
|
5,
|
186
188
|
handleSaveNoteAction,
|
187
|
-
opacity
|
189
|
+
opacity,
|
190
|
+
(e: any) => {
|
191
|
+
handlePlayerClick(e, true);
|
192
|
+
}
|
188
193
|
);
|
189
194
|
}, 500);
|
190
195
|
return () => clearTimeout(controlBarTimeout);
|
@@ -235,16 +240,18 @@ const VideoPlayerComponent = <T,>({
|
|
235
240
|
};
|
236
241
|
}, []);
|
237
242
|
const timeoutRef = useRef<any>(null);
|
238
|
-
const handlePlayerClick = async (e: any) => {
|
243
|
+
const handlePlayerClick = async (e: any, isTimerOnly = false) => {
|
239
244
|
e.preventDefault();
|
240
245
|
if (timeoutRef.current) {
|
241
246
|
clearTimeout(timeoutRef.current);
|
242
247
|
}
|
243
248
|
setOpacity("100");
|
244
|
-
setTimeout(() => {
|
249
|
+
timeoutRef.current = setTimeout(() => {
|
245
250
|
setOpacity("0");
|
246
251
|
}, 5000);
|
247
|
-
|
252
|
+
if (isTimerOnly) {
|
253
|
+
return;
|
254
|
+
}
|
248
255
|
if (playerRef.current) {
|
249
256
|
if (playerRef.current.paused()) {
|
250
257
|
try {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
type Props = {
|
2
2
|
width?: number;
|
3
3
|
setIsSeeking: (val: boolean) => void;
|
4
|
+
handleControlDisplayTimer: (e: any) => void;
|
4
5
|
};
|
5
|
-
declare const VolumeSlider: ({ width, setIsSeeking }: Props) => import("react/jsx-runtime").JSX.Element;
|
6
|
+
declare const VolumeSlider: ({ width, setIsSeeking, handleControlDisplayTimer, }: Props) => import("react/jsx-runtime").JSX.Element;
|
6
7
|
export default VolumeSlider;
|
@@ -1,21 +1,29 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { useEffect, useState } from "react";
|
2
|
+
import React, { useEffect, useState } from "react";
|
3
3
|
import Slider from "../Slider";
|
4
4
|
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
5
5
|
import { MuteIcon, UnmuteIcon } from "../../images";
|
6
6
|
const MIN = 0, MAX = 100;
|
7
|
-
const VolumeSlider = ({ width = 0, setIsSeeking }) => {
|
7
|
+
const VolumeSlider = ({ width = 0, setIsSeeking, handleControlDisplayTimer, }) => {
|
8
8
|
const { player } = useSoftBuildersVideoPlayerContext();
|
9
9
|
const [isVisible, setVisible] = useState(false);
|
10
10
|
const [volume, setVolume] = useState(0);
|
11
11
|
useEffect(() => {
|
12
12
|
setVolume((player === null || player === void 0 ? void 0 : player.muted()) ? 0 : Number(player === null || player === void 0 ? void 0 : player.volume()) * 100 || 0);
|
13
13
|
}, [player]);
|
14
|
+
const timeoutRef = React.useRef(null);
|
14
15
|
const toggleVisiblity = (e) => {
|
15
16
|
e.preventDefault();
|
16
17
|
e.stopPropagation();
|
18
|
+
handleControlDisplayTimer(e);
|
17
19
|
setIsSeeking(isVisible);
|
20
|
+
if (timeoutRef.current) {
|
21
|
+
clearTimeout(timeoutRef.current);
|
22
|
+
}
|
18
23
|
setVisible((prev) => !prev);
|
24
|
+
timeoutRef.current = setTimeout(() => {
|
25
|
+
setVisible(false);
|
26
|
+
}, 5000);
|
19
27
|
};
|
20
28
|
const handleValueChange = (e) => {
|
21
29
|
e.preventDefault();
|
@@ -30,9 +38,9 @@ const VolumeSlider = ({ width = 0, setIsSeeking }) => {
|
|
30
38
|
player === null || player === void 0 ? void 0 : player.muted(false);
|
31
39
|
}
|
32
40
|
};
|
33
|
-
return (_jsxs("div", { className: `sb-flex ${isVisible ? "" : "
|
41
|
+
return (_jsxs("div", { className: `sb-flex ${isVisible ? "" : ""} ${width > 400 ? "sb-flex-col-reverse " : "sb-flex-col !sb-justify-start"} ${false ? "!sb-flex-row !sb-items-start " : ""} sb-items-center sb-gap-1 sb-h-full`, children: [_jsx("div", { className: `sb-flex sb-relative ${width < 400 ? "-sb-top-1" : "sb-top-1"} `, onClick: toggleVisiblity, children: volume === 0 || (player === null || player === void 0 ? void 0 : player.muted()) ? (_jsx(MuteIcon, { className: `sb-w-3 sb-h-3 ${width < 400 ? " " : ""} sb-h-5 sb-w-5` })) : (_jsx(UnmuteIcon, { className: `sb-w-3 sb-h-3 ${width < 400 ? "" : ""} sb-h-5 sb-w-5` })) }), _jsx("div", { className: "sb-flex sb-items-center sb-justify-center", children: _jsx("div", { className: `sb-transition-all sb-ease-in-out sb-duration-500 ${isVisible
|
34
42
|
? "sb-w-[22px] sb-opacity-100 sb-visible"
|
35
|
-
: "sb-w-
|
43
|
+
: " sb-w-[22px] sb-opacity-0 sb-invisible"} ${width > 400
|
36
44
|
? "-sb-rotate-90 -sb-translate-y-1"
|
37
45
|
: "sb-rotate-90 sb-translate-y-1"} sb-relative ${false ? "sb-static sb-w-16 sb-rotate-0 sb-translate-y-0 " : ""}`, children: _jsx(Slider, { value: volume, handleValueChange: handleValueChange, min: MIN, max: MAX, className: "!sb-w-16" }) }) })] }));
|
38
46
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/VolumeSlider/index.tsx"],"names":[],"mappings":";AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/VolumeSlider/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACpD,MAAM,GAAG,GAAG,CAAC,EACX,GAAG,GAAG,GAAG,CAAC;AAMZ,MAAM,YAAY,GAAG,CAAC,EACpB,KAAK,GAAG,CAAC,EACT,YAAY,EACZ,yBAAyB,GACnB,EAAE,EAAE;IACV,MAAM,EAAE,MAAM,EAAE,GAAG,iCAAiC,EAAE,CAAC;IACvD,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,EAAE,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC;IACvE,CAAC,EAAE,C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width?: number;
|
9
9
|
setIsSeeking: (val: boolean) => void;
|
10
|
+
handleControlDisplayTimer: (e: any) => void;
|
10
11
|
};
|
11
|
-
const VolumeSlider = ({
|
12
|
+
const VolumeSlider = ({
|
13
|
+
width = 0,
|
14
|
+
setIsSeeking,
|
15
|
+
handleControlDisplayTimer,
|
16
|
+
}: Props) => {
|
12
17
|
const { player } = useSoftBuildersVideoPlayerContext();
|
13
18
|
const [isVisible, setVisible] = useState(false);
|
14
19
|
const [volume, setVolume] = useState(0);
|
15
20
|
useEffect(() => {
|
16
21
|
setVolume(player?.muted() ? 0 : Number(player?.volume()) * 100 || 0);
|
17
22
|
}, [player]);
|
23
|
+
const timeoutRef = React.useRef<any>(null);
|
24
|
+
|
18
25
|
const toggleVisiblity = (e: any) => {
|
19
26
|
e.preventDefault();
|
20
27
|
e.stopPropagation();
|
28
|
+
handleControlDisplayTimer(e);
|
21
29
|
setIsSeeking(isVisible);
|
30
|
+
if (timeoutRef.current) {
|
31
|
+
clearTimeout(timeoutRef.current);
|
32
|
+
}
|
22
33
|
setVisible((prev) => !prev);
|
34
|
+
timeoutRef.current = setTimeout(() => {
|
35
|
+
setVisible(false);
|
36
|
+
}, 5000);
|
23
37
|
};
|
24
38
|
const handleValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
25
39
|
e.preventDefault();
|
@@ -35,7 +49,7 @@ const VolumeSlider = ({ width = 0, setIsSeeking }: Props) => {
|
|
35
49
|
};
|
36
50
|
return (
|
37
51
|
<div
|
38
|
-
className={`sb-flex ${isVisible ? "" : "
|
52
|
+
className={`sb-flex ${isVisible ? "" : ""} ${
|
39
53
|
width > 400 ? "sb-flex-col-reverse " : "sb-flex-col !sb-justify-start"
|
40
54
|
} ${
|
41
55
|
false ? "!sb-flex-row !sb-items-start " : ""
|
@@ -65,7 +79,7 @@ const VolumeSlider = ({ width = 0, setIsSeeking }: Props) => {
|
|
65
79
|
className={`sb-transition-all sb-ease-in-out sb-duration-500 ${
|
66
80
|
isVisible
|
67
81
|
? "sb-w-[22px] sb-opacity-100 sb-visible"
|
68
|
-
: "sb-w-
|
82
|
+
: " sb-w-[22px] sb-opacity-0 sb-invisible"
|
69
83
|
} ${
|
70
84
|
width > 400
|
71
85
|
? "-sb-rotate-90 -sb-translate-y-1"
|
package/dist/index.css
CHANGED
@@ -473,9 +473,6 @@ video {
|
|
473
473
|
.sb-col-span-9 {
|
474
474
|
grid-column: span 9 / span 9;
|
475
475
|
}
|
476
|
-
.-sb-ml-2 {
|
477
|
-
margin-left: -0.5rem;
|
478
|
-
}
|
479
476
|
.sb-mb-2 {
|
480
477
|
margin-bottom: 0.5rem;
|
481
478
|
}
|
@@ -518,9 +515,6 @@ video {
|
|
518
515
|
.\!sb-w-16 {
|
519
516
|
width: 4rem !important;
|
520
517
|
}
|
521
|
-
.sb-w-0 {
|
522
|
-
width: 0px;
|
523
|
-
}
|
524
518
|
.sb-w-1 {
|
525
519
|
width: 0.25rem;
|
526
520
|
}
|
package/dist/index.mjs
CHANGED
@@ -154,7 +154,7 @@ var CurrentTimeLabel = ({}) => {
|
|
154
154
|
var CurrentTimeLabel_default = CurrentTimeLabel;
|
155
155
|
|
156
156
|
// src/components/VolumeSlider/index.tsx
|
157
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
157
|
+
import React2, { useEffect as useEffect2, useState as useState2 } from "react";
|
158
158
|
|
159
159
|
// src/components/Slider/index.tsx
|
160
160
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
@@ -510,18 +510,30 @@ var SubIcon_default = SvgSubIcon;
|
|
510
510
|
import { jsx as jsx19, jsxs as jsxs4 } from "react/jsx-runtime";
|
511
511
|
var MIN = 0;
|
512
512
|
var MAX = 100;
|
513
|
-
var VolumeSlider = ({
|
513
|
+
var VolumeSlider = ({
|
514
|
+
width = 0,
|
515
|
+
setIsSeeking,
|
516
|
+
handleControlDisplayTimer
|
517
|
+
}) => {
|
514
518
|
const { player } = useSoftBuildersVideoPlayerContext();
|
515
519
|
const [isVisible, setVisible] = useState2(false);
|
516
520
|
const [volume, setVolume] = useState2(0);
|
517
521
|
useEffect2(() => {
|
518
522
|
setVolume((player == null ? void 0 : player.muted()) ? 0 : Number(player == null ? void 0 : player.volume()) * 100 || 0);
|
519
523
|
}, [player]);
|
524
|
+
const timeoutRef = React2.useRef(null);
|
520
525
|
const toggleVisiblity = (e) => {
|
521
526
|
e.preventDefault();
|
522
527
|
e.stopPropagation();
|
528
|
+
handleControlDisplayTimer(e);
|
523
529
|
setIsSeeking(isVisible);
|
530
|
+
if (timeoutRef.current) {
|
531
|
+
clearTimeout(timeoutRef.current);
|
532
|
+
}
|
524
533
|
setVisible((prev) => !prev);
|
534
|
+
timeoutRef.current = setTimeout(() => {
|
535
|
+
setVisible(false);
|
536
|
+
}, 5e3);
|
525
537
|
};
|
526
538
|
const handleValueChange = (e) => {
|
527
539
|
e.preventDefault();
|
@@ -538,7 +550,7 @@ var VolumeSlider = ({ width = 0, setIsSeeking }) => {
|
|
538
550
|
return /* @__PURE__ */ jsxs4(
|
539
551
|
"div",
|
540
552
|
{
|
541
|
-
className: `sb-flex ${isVisible ? "" : "
|
553
|
+
className: `sb-flex ${isVisible ? "" : ""} ${width > 400 ? "sb-flex-col-reverse " : "sb-flex-col !sb-justify-start"} ${false ? "!sb-flex-row !sb-items-start " : ""} sb-items-center sb-gap-1 sb-h-full`,
|
542
554
|
children: [
|
543
555
|
/* @__PURE__ */ jsx19(
|
544
556
|
"div",
|
@@ -561,7 +573,7 @@ var VolumeSlider = ({ width = 0, setIsSeeking }) => {
|
|
561
573
|
/* @__PURE__ */ jsx19("div", { className: "sb-flex sb-items-center sb-justify-center", children: /* @__PURE__ */ jsx19(
|
562
574
|
"div",
|
563
575
|
{
|
564
|
-
className: `sb-transition-all sb-ease-in-out sb-duration-500 ${isVisible ? "sb-w-[22px] sb-opacity-100 sb-visible" : "sb-w-
|
576
|
+
className: `sb-transition-all sb-ease-in-out sb-duration-500 ${isVisible ? "sb-w-[22px] sb-opacity-100 sb-visible" : " sb-w-[22px] sb-opacity-0 sb-invisible"} ${width > 400 ? "-sb-rotate-90 -sb-translate-y-1" : "sb-rotate-90 sb-translate-y-1"} sb-relative ${false ? "sb-static sb-w-16 sb-rotate-0 sb-translate-y-0 " : ""}`,
|
565
577
|
children: /* @__PURE__ */ jsx19(
|
566
578
|
Slider_default,
|
567
579
|
{
|
@@ -1179,7 +1191,8 @@ var ControlBar = ({
|
|
1179
1191
|
chapters,
|
1180
1192
|
seekStep = 5,
|
1181
1193
|
id,
|
1182
|
-
handleSaveNoteAction
|
1194
|
+
handleSaveNoteAction,
|
1195
|
+
handleControlDisplayTimer
|
1183
1196
|
}) => {
|
1184
1197
|
const { setPlayer, setDuration } = useSoftBuildersVideoPlayerContext();
|
1185
1198
|
const [width, setWidth] = useState12(0);
|
@@ -1263,7 +1276,14 @@ var ControlBar = ({
|
|
1263
1276
|
)
|
1264
1277
|
}
|
1265
1278
|
),
|
1266
|
-
/* @__PURE__ */ jsx33("div", { className: "sb-h-full", children: /* @__PURE__ */ jsx33(
|
1279
|
+
/* @__PURE__ */ jsx33("div", { className: "sb-h-full", children: /* @__PURE__ */ jsx33(
|
1280
|
+
VolumeSlider_default,
|
1281
|
+
{
|
1282
|
+
width,
|
1283
|
+
setIsSeeking: (val) => setIsSeeking(val),
|
1284
|
+
handleControlDisplayTimer
|
1285
|
+
}
|
1286
|
+
) }),
|
1267
1287
|
/* @__PURE__ */ jsx33(QualityMenu_default, { width }),
|
1268
1288
|
handleSaveNoteAction && /* @__PURE__ */ jsx33(CreateNoteMenu_default, { handleSaveNoteAction }),
|
1269
1289
|
/* @__PURE__ */ jsx33(SubtitleMenu_default, { width }),
|
@@ -1332,7 +1352,8 @@ var renderBigPlayButton = (id, player, isPaused, setIsPaused) => {
|
|
1332
1352
|
}
|
1333
1353
|
};
|
1334
1354
|
var controlBarRoot = {};
|
1335
|
-
var renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, chapters, seekStep = 5, handleSaveNoteAction, opacity = "0") => {
|
1355
|
+
var renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, chapters, seekStep = 5, handleSaveNoteAction, opacity = "0", handleControlDisplayTimer = () => {
|
1356
|
+
}) => {
|
1336
1357
|
const container = document.getElementById(`video-container-${id}`);
|
1337
1358
|
if (container) {
|
1338
1359
|
const element = container.querySelector(".vjs-control-bar");
|
@@ -1356,7 +1377,8 @@ var renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, chap
|
|
1356
1377
|
notes,
|
1357
1378
|
chapters,
|
1358
1379
|
seekStep,
|
1359
|
-
handleSaveNoteAction
|
1380
|
+
handleSaveNoteAction,
|
1381
|
+
handleControlDisplayTimer
|
1360
1382
|
}
|
1361
1383
|
) })
|
1362
1384
|
);
|
@@ -1450,7 +1472,10 @@ var VideoPlayerComponent = ({
|
|
1450
1472
|
chapters,
|
1451
1473
|
5,
|
1452
1474
|
handleSaveNoteAction,
|
1453
|
-
opacity
|
1475
|
+
opacity,
|
1476
|
+
(e) => {
|
1477
|
+
handlePlayerClick(e, true);
|
1478
|
+
}
|
1454
1479
|
);
|
1455
1480
|
}, 500);
|
1456
1481
|
return () => clearTimeout(controlBarTimeout);
|
@@ -1500,15 +1525,18 @@ var VideoPlayerComponent = ({
|
|
1500
1525
|
};
|
1501
1526
|
}, []);
|
1502
1527
|
const timeoutRef = useRef2(null);
|
1503
|
-
const handlePlayerClick = async (e) => {
|
1528
|
+
const handlePlayerClick = async (e, isTimerOnly = false) => {
|
1504
1529
|
e.preventDefault();
|
1505
1530
|
if (timeoutRef.current) {
|
1506
1531
|
clearTimeout(timeoutRef.current);
|
1507
1532
|
}
|
1508
1533
|
setOpacity("100");
|
1509
|
-
setTimeout(() => {
|
1534
|
+
timeoutRef.current = setTimeout(() => {
|
1510
1535
|
setOpacity("0");
|
1511
1536
|
}, 5e3);
|
1537
|
+
if (isTimerOnly) {
|
1538
|
+
return;
|
1539
|
+
}
|
1512
1540
|
if (playerRef.current) {
|
1513
1541
|
if (playerRef.current.paused()) {
|
1514
1542
|
try {
|
package/dist/styles/tailwind.css
CHANGED
@@ -565,9 +565,6 @@ video {
|
|
565
565
|
.sb-col-span-9 {
|
566
566
|
grid-column: span 9 / span 9;
|
567
567
|
}
|
568
|
-
.-sb-ml-2 {
|
569
|
-
margin-left: -0.5rem;
|
570
|
-
}
|
571
568
|
.sb-mb-2 {
|
572
569
|
margin-bottom: 0.5rem;
|
573
570
|
}
|
@@ -610,9 +607,6 @@ video {
|
|
610
607
|
.\!sb-w-16 {
|
611
608
|
width: 4rem !important;
|
612
609
|
}
|
613
|
-
.sb-w-0 {
|
614
|
-
width: 0px;
|
615
|
-
}
|
616
610
|
.sb-w-1 {
|
617
611
|
width: 0.25rem;
|
618
612
|
}
|