softbuilders-react-video-player 1.1.9 → 1.1.11
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/BigPlayButton/index.js +1 -1
- package/dist/components/BigPlayButton/index.js.map +1 -1
- package/dist/components/BigPlayButton/index.tsx +11 -9
- package/dist/components/ControlBar/index.js +9 -4
- package/dist/components/ControlBar/index.js.map +1 -1
- package/dist/components/ControlBar/index.tsx +11 -4
- package/dist/components/Slider/index.js +7 -1
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/index.tsx +10 -1
- package/dist/components/VideoPlayerComponent/index.js +20 -4
- package/dist/components/VideoPlayerComponent/index.js.map +1 -1
- package/dist/components/VideoPlayerComponent/index.tsx +21 -6
- package/dist/components/VolumeSlider/index.js +5 -1
- package/dist/components/VolumeSlider/index.js.map +1 -1
- package/dist/components/VolumeSlider/index.tsx +5 -1
- package/dist/index.css +3 -0
- package/dist/index.mjs +50 -10
- package/dist/styles/tailwind.css +3 -0
- package/package.json +1 -1
@@ -8,7 +8,7 @@ const BigPlayButton = ({ player, isPaused, setIsPaused }) => {
|
|
8
8
|
player === null || player === void 0 ? void 0 : player.pause();
|
9
9
|
setIsPaused(!isPaused);
|
10
10
|
};
|
11
|
-
return (_jsx("
|
11
|
+
return (_jsx("div", { onClick: togglePlay, className: "sb-w-16 sb-h-16 sb-rounded-full sb-bg-white/30 sb-backdrop-blur-lg sb-flex sb-items-center sb-justify-center ", children: isPaused ? (_jsx(PlayIcon, { className: "sb-w-4 sb-h-4" })) : (_jsx(PauseIcon, { className: "sb-w-4 sb-h-4" })) }));
|
12
12
|
};
|
13
13
|
export default BigPlayButton;
|
14
14
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/BigPlayButton/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/BigPlayButton/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAQnD,MAAM,aAAa,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAS,EAAE,EAAE;IACjE,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,IAAI,QAAQ;YAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,EAAE,CAAC;;YACxB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,EAAE,CAAC;QAErB,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,CACL,cACE,OAAO,EAAE,UAAU,EACnB,SAAS,EAAC,+GAA+G,YAExH,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,QAAQ,IAAC,SAAS,EAAC,eAAe,GAAG,CACvC,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,SAAS,EAAC,eAAe,GAAG,CACxC,GACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import Player from "video.js/dist/types/player";
|
3
3
|
import { PauseIcon, PlayIcon } from "../../images";
|
4
|
+
import log from "video.js/dist/types/utils/log";
|
4
5
|
|
5
6
|
type Props = {
|
6
7
|
player: Player | undefined;
|
@@ -16,15 +17,16 @@ const BigPlayButton = ({ player, isPaused, setIsPaused }: Props) => {
|
|
16
17
|
};
|
17
18
|
|
18
19
|
return (
|
19
|
-
<
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
<div
|
21
|
+
onClick={togglePlay}
|
22
|
+
className="sb-w-16 sb-h-16 sb-rounded-full sb-bg-white/30 sb-backdrop-blur-lg sb-flex sb-items-center sb-justify-center "
|
23
|
+
>
|
24
|
+
{isPaused ? (
|
25
|
+
<PlayIcon className="sb-w-4 sb-h-4" />
|
26
|
+
) : (
|
27
|
+
<PauseIcon className="sb-w-4 sb-h-4" />
|
28
|
+
)}
|
29
|
+
</div>
|
28
30
|
);
|
29
31
|
};
|
30
32
|
|
@@ -21,7 +21,6 @@ const ControlBar = ({ player, isPaused, setIsPaused, duration, notes, chapters,
|
|
21
21
|
const container = document.getElementById(`video-container-${id}`);
|
22
22
|
function handleWidthChange(width) {
|
23
23
|
setwidth(width);
|
24
|
-
console.log(width);
|
25
24
|
}
|
26
25
|
const resizeObserver = new ResizeObserver((entries) => {
|
27
26
|
for (let entry of entries) {
|
@@ -31,7 +30,10 @@ const ControlBar = ({ player, isPaused, setIsPaused, duration, notes, chapters,
|
|
31
30
|
});
|
32
31
|
// Start observing the element
|
33
32
|
resizeObserver.observe(container);
|
34
|
-
const togglePlay = () => {
|
33
|
+
const togglePlay = (e) => {
|
34
|
+
e.preventDefault();
|
35
|
+
e.stopPropagation();
|
36
|
+
console.log("ok");
|
35
37
|
if (isPaused)
|
36
38
|
player === null || player === void 0 ? void 0 : player.play();
|
37
39
|
else
|
@@ -46,9 +48,12 @@ const ControlBar = ({ player, isPaused, setIsPaused, duration, notes, chapters,
|
|
46
48
|
}, [duration]);
|
47
49
|
return (_jsxs("div", { className: " sb-px-2 sb-flex sb-justify-center sb-gap-3 sb-w-full sb-h-full sb-items-end pb-2", children: [_jsx(BufferTracker, {}), _jsx(CurrentTimeTracker, {}), _jsx("button", { onClick: () => {
|
48
50
|
seek(-seekStep);
|
49
|
-
}, children: _jsx(BackwardIcon, { className: "sb-w-3 sb-h-3" }) }), _jsx("button", { onClick: togglePlay, children: isPaused ? (_jsx(PlayIcon, { className: "sb-w-3 sb-h-3" })) : (_jsx(PauseIcon, { className: "sb-w-3 sb-h-3" })) }), _jsx("button", { onClick: () => {
|
51
|
+
}, children: _jsx(BackwardIcon, { className: "sb-w-3 sb-h-3" }) }), _jsx("button", { onClick: togglePlay, children: isPaused ? (_jsx(PlayIcon, { className: "sb-w-3 sb-h-3" })) : (_jsx(PauseIcon, { className: "sb-w-3 sb-h-3" })) }), _jsx("button", { onClick: (e) => {
|
52
|
+
e.preventDefault();
|
50
53
|
seek(seekStep);
|
51
|
-
}, children: _jsx(ForwardIcon, { className: "sb-w-3 sb-h-3" }) }), _jsx(CurrentTimeLabel, {}), _jsx("div", { className: "sb-w-[30%] hover:sb-w-[45%] sb-transition-all sb-ease-in-out sb-duration-500", children: _jsx(TimeSliderContainer, { chapters: chapters, notes: notes }) }), _jsx("p", { children: durationFormater(duration) }), _jsx("div", { className: "sb-h-full", children: _jsx(VolumeSlider, { width: width }) }), _jsx(QualityMenu, {}), _jsx("button", { onClick: () => {
|
54
|
+
}, children: _jsx(ForwardIcon, { className: "sb-w-3 sb-h-3" }) }), _jsx(CurrentTimeLabel, {}), _jsx("div", { className: "sb-w-[30%] hover:sb-w-[45%] sb-transition-all sb-ease-in-out sb-duration-500", children: _jsx(TimeSliderContainer, { chapters: chapters, notes: notes }) }), _jsx("p", { children: durationFormater(duration) }), _jsx("div", { className: "sb-h-full", children: _jsx(VolumeSlider, { width: width }) }), _jsx(QualityMenu, {}), _jsx("button", { onClick: (e) => {
|
55
|
+
e.preventDefault();
|
56
|
+
e.stopPropagation();
|
52
57
|
if (player === null || player === void 0 ? void 0 : player.isFullscreen()) {
|
53
58
|
player === null || player === void 0 ? void 0 : player.exitFullscreen();
|
54
59
|
}
|
@@ -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;AAGnD,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,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EF,eAAe,UAAU,CAAC"}
|
@@ -56,7 +56,6 @@ const ControlBar = <T,>({
|
|
56
56
|
const container = document.getElementById(`video-container-${id}`);
|
57
57
|
function handleWidthChange(width) {
|
58
58
|
setwidth(width);
|
59
|
-
console.log(width);
|
60
59
|
}
|
61
60
|
const resizeObserver = new ResizeObserver((entries) => {
|
62
61
|
for (let entry of entries) {
|
@@ -67,7 +66,11 @@ const ControlBar = <T,>({
|
|
67
66
|
|
68
67
|
// Start observing the element
|
69
68
|
resizeObserver.observe(container);
|
70
|
-
const togglePlay = () => {
|
69
|
+
const togglePlay = (e) => {
|
70
|
+
e.preventDefault();
|
71
|
+
e.stopPropagation();
|
72
|
+
console.log("ok");
|
73
|
+
|
71
74
|
if (isPaused) player?.play();
|
72
75
|
else player?.pause();
|
73
76
|
|
@@ -104,7 +107,8 @@ const ControlBar = <T,>({
|
|
104
107
|
)}
|
105
108
|
</button>
|
106
109
|
<button
|
107
|
-
onClick={() => {
|
110
|
+
onClick={(e) => {
|
111
|
+
e.preventDefault();
|
108
112
|
seek(seekStep);
|
109
113
|
}}
|
110
114
|
>
|
@@ -126,7 +130,10 @@ const ControlBar = <T,>({
|
|
126
130
|
<QualityMenu />
|
127
131
|
|
128
132
|
<button
|
129
|
-
onClick={() => {
|
133
|
+
onClick={(e) => {
|
134
|
+
e.preventDefault();
|
135
|
+
e.stopPropagation();
|
136
|
+
|
130
137
|
if (player?.isFullscreen()) {
|
131
138
|
player?.exitFullscreen();
|
132
139
|
} else {
|
@@ -13,7 +13,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import "./style.css";
|
14
14
|
const Slider = (_a) => {
|
15
15
|
var { value, handleValueChange, min = 0, max = 100, className } = _a, rest = __rest(_a, ["value", "handleValueChange", "min", "max", "className"]);
|
16
|
-
return (_jsx("input", Object.assign({ type: "range", min: min,
|
16
|
+
return (_jsx("input", Object.assign({ type: "range", min: min, onMouseDown: (e) => e.stopPropagation(), onClick: (e) => {
|
17
|
+
e.stopPropagation();
|
18
|
+
}, onMouseUp: (e) => e.stopPropagation(), max: max, value: value, onChange: (e) => {
|
19
|
+
e.preventDefault();
|
20
|
+
e.stopPropagation();
|
21
|
+
handleValueChange(e);
|
22
|
+
}, className: `sb-w-full sb-h-2 sb-bg-transparent sb-bg-opacity-50 sb-rounded-lg sb-appearance-none sb-cursor-pointer sb-range-slider sb-slider-thumb
|
17
23
|
${className}`, style: {
|
18
24
|
background: `linear-gradient(to right, #f97316 ${value}%, #30303070 ${value}%)`,
|
19
25
|
} }, rest)));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Slider/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,aAAa,CAAC;AASrB,MAAM,MAAM,GAAG,CAAC,EAOR,EAAE,EAAE;QAPI,EACd,KAAK,EACL,iBAAiB,EACjB,GAAG,GAAG,CAAC,EACP,GAAG,GAAG,GAAG,EACT,SAAS,OAEH,EADH,IAAI,cANO,yDAOf,CADQ;IAEP,OAAO,CACL,8BACE,IAAI,EAAC,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,iBAAiB,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Slider/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,aAAa,CAAC;AASrB,MAAM,MAAM,GAAG,CAAC,EAOR,EAAE,EAAE;QAPI,EACd,KAAK,EACL,iBAAiB,EACjB,GAAG,GAAG,CAAC,EACP,GAAG,GAAG,GAAG,EACT,SAAS,OAEH,EADH,IAAI,cANO,yDAOf,CADQ;IAEP,OAAO,CACL,8BACE,IAAI,EAAC,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACvC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,eAAe,EAAE,CAAC;QACtB,CAAC,EACD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAAE,EACrC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,iBAAiB,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC,EACD,SAAS,EAAE;UACP,SAAS,EAAE,EACf,KAAK,EAAE;YACL,UAAU,EAAE,qCAAqC,KAAK,gBAAgB,KAAK,IAAI;SAChF,IACG,IAAI,EACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -20,9 +20,18 @@ const Slider = ({
|
|
20
20
|
<input
|
21
21
|
type="range"
|
22
22
|
min={min}
|
23
|
+
onMouseDown={(e) => e.stopPropagation()}
|
24
|
+
onClick={(e) => {
|
25
|
+
e.stopPropagation();
|
26
|
+
}}
|
27
|
+
onMouseUp={(e) => e.stopPropagation()}
|
23
28
|
max={max}
|
24
29
|
value={value}
|
25
|
-
onChange={
|
30
|
+
onChange={(e) => {
|
31
|
+
e.preventDefault();
|
32
|
+
e.stopPropagation();
|
33
|
+
handleValueChange(e);
|
34
|
+
}}
|
26
35
|
className={`sb-w-full sb-h-2 sb-bg-transparent sb-bg-opacity-50 sb-rounded-lg sb-appearance-none sb-cursor-pointer sb-range-slider sb-slider-thumb
|
27
36
|
${className}`}
|
28
37
|
style={{
|
@@ -42,7 +42,7 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
|
|
42
42
|
const playerRef = useRef(undefined);
|
43
43
|
const [isReady, setIsReady] = useState(false);
|
44
44
|
const [isPaused, setIsPaused] = useState(!options.autoplay);
|
45
|
-
const [duration,
|
45
|
+
const [duration, setDuration] = useState(1);
|
46
46
|
const onReady = (player) => {
|
47
47
|
if (playerRef) {
|
48
48
|
playerRef.current = player;
|
@@ -55,7 +55,7 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
|
|
55
55
|
});
|
56
56
|
player.on("loadedmetadata", () => {
|
57
57
|
const d = player.duration() || 0;
|
58
|
-
|
58
|
+
setDuration(d);
|
59
59
|
});
|
60
60
|
}
|
61
61
|
};
|
@@ -137,10 +137,26 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
|
|
137
137
|
return () => clearInterval(intervalId);
|
138
138
|
}
|
139
139
|
}, []);
|
140
|
-
|
140
|
+
const handlePlayerClick = (e) => {
|
141
|
+
e.preventDefault();
|
142
|
+
console.log("all");
|
143
|
+
if (playerRef.current) {
|
144
|
+
if (playerRef.current.paused()) {
|
145
|
+
playerRef.current.play();
|
146
|
+
setIsPaused(false);
|
147
|
+
}
|
148
|
+
else {
|
149
|
+
playerRef.current.pause();
|
150
|
+
setIsPaused(true);
|
151
|
+
if (onPause)
|
152
|
+
onPause(playerRef.current.currentTime());
|
153
|
+
}
|
154
|
+
}
|
155
|
+
};
|
156
|
+
return (_jsx("div", { id: `video-container-${id}`, className: "sb-relative sb-rounded-md sb-overflow-hidden", children: _jsx("div", { className: "hover:sb-cursor-pointer", "data-vjs-player": true, style: {
|
141
157
|
height: "100%", // Adjust height as needed
|
142
158
|
position: "relative",
|
143
|
-
}, children: _jsx("div", { ref: videoRef }) }) }));
|
159
|
+
}, children: _jsx("div", { onClick: handlePlayerClick, ref: videoRef }) }) }));
|
144
160
|
};
|
145
161
|
export default VideoPlayerComponent;
|
146
162
|
//# sourceMappingURL=index.js.map
|
@@ -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,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AC,KAAK,CAAC,CAAC;QAEnB,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;YACtB,IAAI,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC/B,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;gBACzB,WAAW,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBAC1B,WAAW,CAAC,IAAI,CAAC,CAAC;gBAClB,IAAI,OAAO;oBAAE,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,cACE,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAC3B,SAAS,EAAC,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;AAEF,eAAe,oBAAoB,CAAC"}
|
@@ -110,7 +110,6 @@ const VideoPlayerComponent = <T,>({
|
|
110
110
|
startTime = 0,
|
111
111
|
handleSaveNoteAction,
|
112
112
|
poster,
|
113
|
-
|
114
113
|
onPlay,
|
115
114
|
onPause,
|
116
115
|
}: Props<T>) => {
|
@@ -119,13 +118,12 @@ const VideoPlayerComponent = <T,>({
|
|
119
118
|
|
120
119
|
const [isReady, setIsReady] = useState(false);
|
121
120
|
const [isPaused, setIsPaused] = useState(!options.autoplay);
|
122
|
-
const [duration,
|
121
|
+
const [duration, setDuration] = useState(1);
|
123
122
|
|
124
123
|
const onReady = (player: Player) => {
|
125
124
|
if (playerRef) {
|
126
125
|
playerRef.current = player;
|
127
126
|
setIsReady(true);
|
128
|
-
|
129
127
|
player.currentTime(startTime);
|
130
128
|
|
131
129
|
player.on("waiting", () => {});
|
@@ -137,7 +135,7 @@ const VideoPlayerComponent = <T,>({
|
|
137
135
|
|
138
136
|
player.on("loadedmetadata", () => {
|
139
137
|
const d = player.duration() || 0;
|
140
|
-
|
138
|
+
setDuration(d);
|
141
139
|
});
|
142
140
|
}
|
143
141
|
};
|
@@ -147,7 +145,6 @@ const VideoPlayerComponent = <T,>({
|
|
147
145
|
const videoElement = document.createElement("video-js");
|
148
146
|
videoElement.classList.add("vjs-big-play-centered");
|
149
147
|
// Set the poster attribute here
|
150
|
-
|
151
148
|
if (poster) {
|
152
149
|
videoElement.setAttribute("poster", poster);
|
153
150
|
}
|
@@ -239,19 +236,37 @@ const VideoPlayerComponent = <T,>({
|
|
239
236
|
}
|
240
237
|
}, []);
|
241
238
|
|
239
|
+
const handlePlayerClick = (e) => {
|
240
|
+
e.preventDefault();
|
241
|
+
console.log("all");
|
242
|
+
|
243
|
+
if (playerRef.current) {
|
244
|
+
if (playerRef.current.paused()) {
|
245
|
+
playerRef.current.play();
|
246
|
+
setIsPaused(false);
|
247
|
+
} else {
|
248
|
+
playerRef.current.pause();
|
249
|
+
setIsPaused(true);
|
250
|
+
if (onPause) onPause(playerRef.current.currentTime());
|
251
|
+
}
|
252
|
+
}
|
253
|
+
};
|
254
|
+
|
242
255
|
return (
|
243
256
|
<div
|
244
257
|
id={`video-container-${id}`}
|
245
258
|
className="sb-relative sb-rounded-md sb-overflow-hidden"
|
246
259
|
>
|
247
260
|
<div
|
261
|
+
className="hover:sb-cursor-pointer"
|
262
|
+
// Attach click event
|
248
263
|
data-vjs-player
|
249
264
|
style={{
|
250
265
|
height: "100%", // Adjust height as needed
|
251
266
|
position: "relative",
|
252
267
|
}}
|
253
268
|
>
|
254
|
-
<div ref={videoRef} />
|
269
|
+
<div onClick={handlePlayerClick} ref={videoRef} />
|
255
270
|
</div>
|
256
271
|
</div>
|
257
272
|
);
|
@@ -11,10 +11,14 @@ const VolumeSlider = ({ width }) => {
|
|
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 toggleVisiblity = () => {
|
14
|
+
const toggleVisiblity = (e) => {
|
15
|
+
e.preventDefault();
|
16
|
+
e.stopPropagation();
|
15
17
|
setVisible((prev) => !prev);
|
16
18
|
};
|
17
19
|
const handleValueChange = (e) => {
|
20
|
+
e.preventDefault();
|
21
|
+
e.stopPropagation();
|
18
22
|
const newVolume = Number(e.target.value);
|
19
23
|
setVolume(newVolume);
|
20
24
|
player === null || player === void 0 ? void 0 : player.volume(newVolume / 100);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/VolumeSlider/index.tsx"],"names":[],"mappings":";AAAA,OAAc,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;AAEpD,MAAM,GAAG,GAAG,CAAC,EACX,GAAG,GAAG,GAAG,CAAC;AAMZ,MAAM,YAAY,GAAG,CAAC,EAAE,KAAK,EAAS,EAAE,EAAE;IACxC,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;IAExC,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,EAAE,EAAC,C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GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,GACjE,CACH,GACG,EAEN,cAAK,SAAS,EAAC,2CAA2C,YAExD,cACE,SAAS,EAAE,GACT,SAAS,IAAI,KAAK,GAAG,GAAG;wBACtB,CAAC,CAAC,cAAc;wBAChB,CAAC,CAAC,CAAC,SAAS,IAAI,KAAK,GAAG,GAAG;4BAC3B,CAAC,CAAC,WAAW;4BACb,CAAC,CAAC,EACN,kDACE,KAAK,GAAG,GAAG;wBACT,CAAC,CAAC,iDAAiD;wBACnD,CAAC,CAAC,kBACN,EAAE,YAEF,KAAC,MAAM,IACL,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,iBAAiB,EACpC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAC,UAAU,GACpB,GACE,GACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
@@ -18,11 +18,15 @@ const VolumeSlider = ({ width }: Props) => {
|
|
18
18
|
useEffect(() => {
|
19
19
|
setVolume(player?.muted() ? 0 : Number(player?.volume()) * 100 || 0);
|
20
20
|
}, [player]);
|
21
|
-
const toggleVisiblity = () => {
|
21
|
+
const toggleVisiblity = (e) => {
|
22
|
+
e.preventDefault();
|
23
|
+
e.stopPropagation();
|
22
24
|
setVisible((prev) => !prev);
|
23
25
|
};
|
24
26
|
|
25
27
|
const handleValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
28
|
+
e.preventDefault();
|
29
|
+
e.stopPropagation();
|
26
30
|
const newVolume = Number(e.target.value);
|
27
31
|
|
28
32
|
setVolume(newVolume);
|
package/dist/index.css
CHANGED
@@ -729,6 +729,9 @@ video {
|
|
729
729
|
--tw-scale-y: 1.5;
|
730
730
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
731
731
|
}
|
732
|
+
.hover\:sb-cursor-pointer:hover {
|
733
|
+
cursor: pointer;
|
734
|
+
}
|
732
735
|
.hover\:sb-text-orange-500:hover {
|
733
736
|
--tw-text-opacity: 1;
|
734
737
|
color: rgb(249 115 22 / var(--tw-text-opacity));
|
package/dist/index.mjs
CHANGED
@@ -177,9 +177,18 @@ var Slider = (_a) => {
|
|
177
177
|
__spreadValues({
|
178
178
|
type: "range",
|
179
179
|
min,
|
180
|
+
onMouseDown: (e) => e.stopPropagation(),
|
181
|
+
onClick: (e) => {
|
182
|
+
e.stopPropagation();
|
183
|
+
},
|
184
|
+
onMouseUp: (e) => e.stopPropagation(),
|
180
185
|
max,
|
181
186
|
value,
|
182
|
-
onChange:
|
187
|
+
onChange: (e) => {
|
188
|
+
e.preventDefault();
|
189
|
+
e.stopPropagation();
|
190
|
+
handleValueChange(e);
|
191
|
+
},
|
183
192
|
className: `sb-w-full sb-h-2 sb-bg-transparent sb-bg-opacity-50 sb-rounded-lg sb-appearance-none sb-cursor-pointer sb-range-slider sb-slider-thumb
|
184
193
|
${className}`,
|
185
194
|
style: {
|
@@ -508,10 +517,14 @@ var VolumeSlider = ({ width }) => {
|
|
508
517
|
useEffect2(() => {
|
509
518
|
setVolume((player == null ? void 0 : player.muted()) ? 0 : Number(player == null ? void 0 : player.volume()) * 100 || 0);
|
510
519
|
}, [player]);
|
511
|
-
const toggleVisiblity = () => {
|
520
|
+
const toggleVisiblity = (e) => {
|
521
|
+
e.preventDefault();
|
522
|
+
e.stopPropagation();
|
512
523
|
setVisible((prev) => !prev);
|
513
524
|
};
|
514
525
|
const handleValueChange = (e) => {
|
526
|
+
e.preventDefault();
|
527
|
+
e.stopPropagation();
|
515
528
|
const newVolume = Number(e.target.value);
|
516
529
|
setVolume(newVolume);
|
517
530
|
player == null ? void 0 : player.volume(newVolume / 100);
|
@@ -1124,7 +1137,6 @@ var ControlBar = ({
|
|
1124
1137
|
const container = document.getElementById(`video-container-${id}`);
|
1125
1138
|
function handleWidthChange(width2) {
|
1126
1139
|
setwidth(width2);
|
1127
|
-
console.log(width2);
|
1128
1140
|
}
|
1129
1141
|
const resizeObserver = new ResizeObserver((entries) => {
|
1130
1142
|
for (let entry of entries) {
|
@@ -1133,7 +1145,10 @@ var ControlBar = ({
|
|
1133
1145
|
}
|
1134
1146
|
});
|
1135
1147
|
resizeObserver.observe(container);
|
1136
|
-
const togglePlay = () => {
|
1148
|
+
const togglePlay = (e) => {
|
1149
|
+
e.preventDefault();
|
1150
|
+
e.stopPropagation();
|
1151
|
+
console.log("ok");
|
1137
1152
|
if (isPaused) player == null ? void 0 : player.play();
|
1138
1153
|
else player == null ? void 0 : player.pause();
|
1139
1154
|
setIsPaused(!isPaused);
|
@@ -1160,7 +1175,8 @@ var ControlBar = ({
|
|
1160
1175
|
/* @__PURE__ */ jsx33(
|
1161
1176
|
"button",
|
1162
1177
|
{
|
1163
|
-
onClick: () => {
|
1178
|
+
onClick: (e) => {
|
1179
|
+
e.preventDefault();
|
1164
1180
|
seek(seekStep);
|
1165
1181
|
},
|
1166
1182
|
children: /* @__PURE__ */ jsx33(ForwardIcon_default, { className: "sb-w-3 sb-h-3" })
|
@@ -1174,7 +1190,9 @@ var ControlBar = ({
|
|
1174
1190
|
/* @__PURE__ */ jsx33(
|
1175
1191
|
"button",
|
1176
1192
|
{
|
1177
|
-
onClick: () => {
|
1193
|
+
onClick: (e) => {
|
1194
|
+
e.preventDefault();
|
1195
|
+
e.stopPropagation();
|
1178
1196
|
if (player == null ? void 0 : player.isFullscreen()) {
|
1179
1197
|
player == null ? void 0 : player.exitFullscreen();
|
1180
1198
|
} else {
|
@@ -1198,7 +1216,14 @@ var BigPlayButton = ({ player, isPaused, setIsPaused }) => {
|
|
1198
1216
|
else player == null ? void 0 : player.pause();
|
1199
1217
|
setIsPaused(!isPaused);
|
1200
1218
|
};
|
1201
|
-
return /* @__PURE__ */ jsx34(
|
1219
|
+
return /* @__PURE__ */ jsx34(
|
1220
|
+
"div",
|
1221
|
+
{
|
1222
|
+
onClick: togglePlay,
|
1223
|
+
className: "sb-w-16 sb-h-16 sb-rounded-full sb-bg-white/30 sb-backdrop-blur-lg sb-flex sb-items-center sb-justify-center ",
|
1224
|
+
children: isPaused ? /* @__PURE__ */ jsx34(PlayIcon_default, { className: "sb-w-4 sb-h-4" }) : /* @__PURE__ */ jsx34(PauseIcon_default, { className: "sb-w-4 sb-h-4" })
|
1225
|
+
}
|
1226
|
+
);
|
1202
1227
|
};
|
1203
1228
|
var BigPlayButton_default = BigPlayButton;
|
1204
1229
|
|
@@ -1272,7 +1297,7 @@ var VideoPlayerComponent = ({
|
|
1272
1297
|
const playerRef = useRef2(void 0);
|
1273
1298
|
const [isReady, setIsReady] = useState13(false);
|
1274
1299
|
const [isPaused, setIsPaused] = useState13(!options.autoplay);
|
1275
|
-
const [duration,
|
1300
|
+
const [duration, setDuration] = useState13(1);
|
1276
1301
|
const onReady = (player) => {
|
1277
1302
|
if (playerRef) {
|
1278
1303
|
playerRef.current = player;
|
@@ -1286,7 +1311,7 @@ var VideoPlayerComponent = ({
|
|
1286
1311
|
});
|
1287
1312
|
player.on("loadedmetadata", () => {
|
1288
1313
|
const d = player.duration() || 0;
|
1289
|
-
|
1314
|
+
setDuration(d);
|
1290
1315
|
});
|
1291
1316
|
}
|
1292
1317
|
};
|
@@ -1373,6 +1398,20 @@ var VideoPlayerComponent = ({
|
|
1373
1398
|
return () => clearInterval(intervalId);
|
1374
1399
|
}
|
1375
1400
|
}, []);
|
1401
|
+
const handlePlayerClick = (e) => {
|
1402
|
+
e.preventDefault();
|
1403
|
+
console.log("all");
|
1404
|
+
if (playerRef.current) {
|
1405
|
+
if (playerRef.current.paused()) {
|
1406
|
+
playerRef.current.play();
|
1407
|
+
setIsPaused(false);
|
1408
|
+
} else {
|
1409
|
+
playerRef.current.pause();
|
1410
|
+
setIsPaused(true);
|
1411
|
+
if (onPause) onPause(playerRef.current.currentTime());
|
1412
|
+
}
|
1413
|
+
}
|
1414
|
+
};
|
1376
1415
|
return /* @__PURE__ */ jsx35(
|
1377
1416
|
"div",
|
1378
1417
|
{
|
@@ -1381,13 +1420,14 @@ var VideoPlayerComponent = ({
|
|
1381
1420
|
children: /* @__PURE__ */ jsx35(
|
1382
1421
|
"div",
|
1383
1422
|
{
|
1423
|
+
className: "hover:sb-cursor-pointer",
|
1384
1424
|
"data-vjs-player": true,
|
1385
1425
|
style: {
|
1386
1426
|
height: "100%",
|
1387
1427
|
// Adjust height as needed
|
1388
1428
|
position: "relative"
|
1389
1429
|
},
|
1390
|
-
children: /* @__PURE__ */ jsx35("div", { ref: videoRef })
|
1430
|
+
children: /* @__PURE__ */ jsx35("div", { onClick: handlePlayerClick, ref: videoRef })
|
1391
1431
|
}
|
1392
1432
|
)
|
1393
1433
|
}
|
package/dist/styles/tailwind.css
CHANGED
@@ -822,6 +822,9 @@ video {
|
|
822
822
|
--tw-scale-y: 1.5;
|
823
823
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
824
824
|
}
|
825
|
+
.hover\:sb-cursor-pointer:hover {
|
826
|
+
cursor: pointer;
|
827
|
+
}
|
825
828
|
.hover\:sb-text-orange-500:hover {
|
826
829
|
--tw-text-opacity: 1;
|
827
830
|
color: rgb(249 115 22 / var(--tw-text-opacity));
|