softbuilders-react-video-player 1.1.22 → 1.1.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/dist/components/ControlBar/index.js +10 -8
  2. package/dist/components/ControlBar/index.js.map +1 -1
  3. package/dist/components/ControlBar/index.tsx +20 -16
  4. package/dist/components/MenuButton/index.d.ts +2 -1
  5. package/dist/components/MenuButton/index.js +5 -2
  6. package/dist/components/MenuButton/index.js.map +1 -1
  7. package/dist/components/MenuButton/index.tsx +12 -3
  8. package/dist/components/QualityMenu/index.d.ts +4 -2
  9. package/dist/components/QualityMenu/index.js +9 -7
  10. package/dist/components/QualityMenu/index.js.map +1 -1
  11. package/dist/components/QualityMenu/index.tsx +33 -8
  12. package/dist/components/SoftBuildersVideoPlayer/index.d.ts +2 -1
  13. package/dist/components/SoftBuildersVideoPlayer/index.js +4 -1
  14. package/dist/components/SoftBuildersVideoPlayer/index.js.map +1 -1
  15. package/dist/components/SoftBuildersVideoPlayer/index.tsx +5 -1
  16. package/dist/components/SubtitleMenu/index.d.ts +4 -2
  17. package/dist/components/SubtitleMenu/index.js +8 -3
  18. package/dist/components/SubtitleMenu/index.js.map +1 -1
  19. package/dist/components/SubtitleMenu/index.tsx +19 -4
  20. package/dist/components/VideoPlayerComponent/index.js +70 -8
  21. package/dist/components/VideoPlayerComponent/index.js.map +1 -1
  22. package/dist/components/VideoPlayerComponent/index.tsx +80 -7
  23. package/dist/components/VideoPlayerComponent/style/style.css +1 -0
  24. package/dist/components/VolumeSlider/index.js +12 -3
  25. package/dist/components/VolumeSlider/index.js.map +1 -1
  26. package/dist/components/VolumeSlider/index.tsx +20 -6
  27. package/dist/index.css +35 -11
  28. package/dist/index.d.mts +2 -1
  29. package/dist/index.mjs +295 -158
  30. package/dist/styles/tailwind.css +34 -11
  31. package/package.json +1 -1
@@ -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) => {
25
+ const renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, chapters, seekStep = 5, handleSaveNoteAction, opacity = "0") => {
26
26
  const container = document.getElementById(`video-container-${id}`);
27
27
  if (container) {
28
28
  const element = container.querySelector(".vjs-control-bar");
@@ -31,6 +31,7 @@ const renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, ch
31
31
  controlBarRoot[id] = ReactDOM.createRoot(element);
32
32
  }
33
33
  element.style.display = "flex";
34
+ element.style.opacity = opacity;
34
35
  element.style.height = "100%";
35
36
  element.style.alignItems = "flex-end";
36
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 }) }));
@@ -43,11 +44,12 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
43
44
  const [isReady, setIsReady] = useState(false);
44
45
  const [isPaused, setIsPaused] = useState(!options.autoplay);
45
46
  const [duration, setDuration] = useState(1);
47
+ const [opacity, setOpacity] = useState("0");
46
48
  const onReady = (player) => {
47
49
  if (playerRef) {
48
50
  playerRef.current = player;
49
51
  setIsReady(true);
50
- player.currentTime(startTime);
52
+ player === null || player === void 0 ? void 0 : player.currentTime(startTime);
51
53
  player.on("waiting", () => { });
52
54
  player.on("dispose", () => {
53
55
  videojs.log("player will dispose");
@@ -62,6 +64,7 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
62
64
  useEffect(() => {
63
65
  if (!playerRef.current) {
64
66
  const videoElement = document.createElement("video-js");
67
+ videoElement.setAttribute("playsinline", "true");
65
68
  videoElement.classList.add("vjs-big-play-centered");
66
69
  // Set the poster attribute here
67
70
  if (poster) {
@@ -105,7 +108,7 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
105
108
  useEffect(() => {
106
109
  if (isReady) {
107
110
  const controlBarTimeout = setTimeout(() => {
108
- renderControlBar(id, playerRef.current, isPaused, setIsPaused, duration, notes, chapters, 5, handleSaveNoteAction);
111
+ renderControlBar(id, playerRef.current, isPaused, setIsPaused, duration, notes, chapters, 5, handleSaveNoteAction, opacity);
109
112
  }, 500);
110
113
  return () => clearTimeout(controlBarTimeout);
111
114
  }
@@ -119,6 +122,7 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
119
122
  isReady,
120
123
  handleSaveNoteAction,
121
124
  duration,
125
+ opacity,
122
126
  ]);
123
127
  useEffect(() => {
124
128
  if (isReady) {
@@ -137,13 +141,42 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
137
141
  return () => clearInterval(intervalId);
138
142
  }
139
143
  }, []);
140
- const handlePlayerClick = (e) => {
144
+ useEffect(() => {
145
+ return () => {
146
+ if (playerRef.current) {
147
+ playerRef.current.dispose();
148
+ playerRef.current = undefined;
149
+ // Cleanup play button and control bar renders
150
+ if (bigPlayButtonRoot[id]) {
151
+ bigPlayButtonRoot[id].unmount();
152
+ bigPlayButtonRoot[id] = undefined;
153
+ }
154
+ if (controlBarRoot[id]) {
155
+ controlBarRoot[id].unmount();
156
+ controlBarRoot[id] = undefined;
157
+ }
158
+ }
159
+ };
160
+ }, []);
161
+ const timeoutRef = useRef(null);
162
+ const handlePlayerClick = async (e) => {
141
163
  e.preventDefault();
142
- console.log("all");
164
+ if (timeoutRef.current) {
165
+ clearTimeout(timeoutRef.current);
166
+ }
167
+ setOpacity("100");
168
+ timeoutRef.current = setTimeout(() => {
169
+ setOpacity("0");
170
+ }, 5000);
143
171
  if (playerRef.current) {
144
172
  if (playerRef.current.paused()) {
145
- playerRef.current.play();
146
- setIsPaused(false);
173
+ try {
174
+ await playerRef.current.play();
175
+ setIsPaused(false);
176
+ }
177
+ catch (error) {
178
+ console.error("Failed to play video:", error);
179
+ }
147
180
  }
148
181
  else {
149
182
  playerRef.current.pause();
@@ -153,7 +186,36 @@ const VideoPlayerComponent = ({ id, options, notes, chapters, startTime = 0, han
153
186
  }
154
187
  }
155
188
  };
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: {
189
+ const videoRefs = useRef(null); // Create a reference for the element
190
+ useEffect(() => {
191
+ const observer = new IntersectionObserver((entries) => {
192
+ entries.forEach((entry) => {
193
+ var _a, _b;
194
+ if (entry.isIntersecting === false) {
195
+ if (((_a = playerRef === null || playerRef === void 0 ? void 0 : playerRef.current) === null || _a === void 0 ? void 0 : _a.paused()) === false) {
196
+ try {
197
+ (_b = playerRef === null || playerRef === void 0 ? void 0 : playerRef.current) === null || _b === void 0 ? void 0 : _b.pause();
198
+ setIsPaused(true);
199
+ }
200
+ catch (error) {
201
+ console.error("Failed to play video:", error);
202
+ }
203
+ }
204
+ }
205
+ });
206
+ }, {
207
+ threshold: 0.1, // The amount of the component that must be visible (0.1 means 10% visible)
208
+ });
209
+ if (videoRefs.current) {
210
+ observer.observe(videoRefs.current); // Start observing the component
211
+ }
212
+ return () => {
213
+ if (videoRefs.current) {
214
+ observer.unobserve(videoRef.current); // Clean up the observer when the component unmounts
215
+ }
216
+ };
217
+ }, []);
218
+ return (_jsx("div", { ref: videoRefs, 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: {
157
219
  height: "100%", // Adjust height as needed
158
220
  position: "relative",
159
221
  }, children: _jsx("div", { onClick: handlePlayerClick, ref: videoRef }) }) }));
@@ -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,kBAA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B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,gCAAgC;QACvE,CAAC;QAED,OAAO,GAAG,EAAE;YACV,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;gBACtB,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,oDAAoD;YAC5F,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,cACE,GAAG,EAAE,SAAS,EACd,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;AACF,eAAe,oBAAoB,CAAC"}
@@ -13,6 +13,7 @@ import "./style/style.css";
13
13
  import "../../styles/tailwind.css";
14
14
  import { SoftBuildersVideoPlayerProvider } from "./provider";
15
15
  import BigPlayButton from "../BigPlayButton";
16
+ import { set } from "video.js/dist/types/tech/middleware";
16
17
  let bigPlayButtonRoot: {
17
18
  [key: string]: ReactDOM.Root | undefined;
18
19
  } = {};
@@ -51,7 +52,8 @@ const renderControlBar = <T,>(
51
52
  notes: SoftBuildersVideoPlayerNote[],
52
53
  chapters: SoftBuildersVideoPlayerChapter[],
53
54
  seekStep: number = 5,
54
- handleSaveNoteAction?: (time: number, note: string) => Promise<T>
55
+ handleSaveNoteAction?: (time: number, note: string) => Promise<T>,
56
+ opacity: string = "0"
55
57
  ) => {
56
58
  const container = document.getElementById(`video-container-${id}`);
57
59
  if (container) {
@@ -61,6 +63,7 @@ const renderControlBar = <T,>(
61
63
  controlBarRoot[id] = ReactDOM.createRoot(element as HTMLElement);
62
64
  }
63
65
  element.style.display = "flex";
66
+ element.style.opacity = opacity;
64
67
  element.style.height = "100%";
65
68
  element.style.alignItems = "flex-end";
66
69
  controlBarRoot[id].render(
@@ -108,11 +111,12 @@ const VideoPlayerComponent = <T,>({
108
111
  const [isReady, setIsReady] = useState(false);
109
112
  const [isPaused, setIsPaused] = useState(!options.autoplay);
110
113
  const [duration, setDuration] = useState(1);
114
+ const [opacity, setOpacity] = useState("0");
111
115
  const onReady = (player: Player) => {
112
116
  if (playerRef) {
113
117
  playerRef.current = player;
114
118
  setIsReady(true);
115
- player.currentTime(startTime);
119
+ player?.currentTime(startTime);
116
120
  player.on("waiting", () => {});
117
121
  player.on("dispose", () => {
118
122
  videojs.log("player will dispose");
@@ -127,6 +131,8 @@ const VideoPlayerComponent = <T,>({
127
131
  useEffect(() => {
128
132
  if (!playerRef.current) {
129
133
  const videoElement = document.createElement("video-js");
134
+ videoElement.setAttribute("playsinline", "true");
135
+
130
136
  videoElement.classList.add("vjs-big-play-centered");
131
137
  // Set the poster attribute here
132
138
  if (poster) {
@@ -164,6 +170,7 @@ const VideoPlayerComponent = <T,>({
164
170
  }
165
171
  }
166
172
  }, [isPaused, isReady]);
173
+
167
174
  useEffect(() => {
168
175
  if (isReady) {
169
176
  const controlBarTimeout = setTimeout(() => {
@@ -176,7 +183,8 @@ const VideoPlayerComponent = <T,>({
176
183
  notes,
177
184
  chapters,
178
185
  5,
179
- handleSaveNoteAction
186
+ handleSaveNoteAction,
187
+ opacity
180
188
  );
181
189
  }, 500);
182
190
  return () => clearTimeout(controlBarTimeout);
@@ -191,6 +199,7 @@ const VideoPlayerComponent = <T,>({
191
199
  isReady,
192
200
  handleSaveNoteAction,
193
201
  duration,
202
+ opacity,
194
203
  ]);
195
204
  useEffect(() => {
196
205
  if (isReady) {
@@ -208,13 +217,42 @@ const VideoPlayerComponent = <T,>({
208
217
  return () => clearInterval(intervalId);
209
218
  }
210
219
  }, []);
211
- const handlePlayerClick = (e: any) => {
220
+ useEffect(() => {
221
+ return () => {
222
+ if (playerRef.current) {
223
+ playerRef.current.dispose();
224
+ playerRef.current = undefined;
225
+ // Cleanup play button and control bar renders
226
+ if (bigPlayButtonRoot[id]) {
227
+ bigPlayButtonRoot[id].unmount();
228
+ bigPlayButtonRoot[id] = undefined;
229
+ }
230
+ if (controlBarRoot[id]) {
231
+ controlBarRoot[id].unmount();
232
+ controlBarRoot[id] = undefined;
233
+ }
234
+ }
235
+ };
236
+ }, []);
237
+ const timeoutRef = useRef<any>(null);
238
+ const handlePlayerClick = async (e: any) => {
212
239
  e.preventDefault();
213
- console.log("all");
240
+ if (timeoutRef.current) {
241
+ clearTimeout(timeoutRef.current);
242
+ }
243
+ setOpacity("100");
244
+ timeoutRef.current = setTimeout(() => {
245
+ setOpacity("0");
246
+ }, 5000);
247
+
214
248
  if (playerRef.current) {
215
249
  if (playerRef.current.paused()) {
216
- playerRef.current.play();
217
- setIsPaused(false);
250
+ try {
251
+ await playerRef.current.play();
252
+ setIsPaused(false);
253
+ } catch (error) {
254
+ console.error("Failed to play video:", error);
255
+ }
218
256
  } else {
219
257
  playerRef.current.pause();
220
258
  setIsPaused(true);
@@ -222,8 +260,43 @@ const VideoPlayerComponent = <T,>({
222
260
  }
223
261
  }
224
262
  };
263
+ const videoRefs = useRef<HTMLDivElement>(null); // Create a reference for the element
264
+
265
+ useEffect(() => {
266
+ const observer = new IntersectionObserver(
267
+ (entries) => {
268
+ entries.forEach((entry) => {
269
+ if (entry.isIntersecting === false) {
270
+ if (playerRef?.current?.paused() === false) {
271
+ try {
272
+ playerRef?.current?.pause();
273
+ setIsPaused(true);
274
+ } catch (error) {
275
+ console.error("Failed to play video:", error);
276
+ }
277
+ }
278
+ }
279
+ });
280
+ },
281
+ {
282
+ threshold: 0.1, // The amount of the component that must be visible (0.1 means 10% visible)
283
+ }
284
+ );
285
+
286
+ if (videoRefs.current) {
287
+ observer.observe(videoRefs.current); // Start observing the component
288
+ }
289
+
290
+ return () => {
291
+ if (videoRefs.current) {
292
+ observer.unobserve(videoRef.current); // Clean up the observer when the component unmounts
293
+ }
294
+ };
295
+ }, []);
296
+
225
297
  return (
226
298
  <div
299
+ ref={videoRefs}
227
300
  id={`video-container-${id}`}
228
301
  className="sb-relative sb-rounded-md sb-overflow-hidden"
229
302
  >
@@ -4,6 +4,7 @@
4
4
  }
5
5
  .vjs-control-bar{
6
6
  justify-content: center;
7
+ transition: opacity 0.5s ease-in-out;
7
8
  }
8
9
  .video-js .vjs-big-play-button {
9
10
  background-color: transparent;
@@ -1,5 +1,5 @@
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";
@@ -11,11 +11,18 @@ const VolumeSlider = ({ width = 0, setIsSeeking }) => {
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();
17
18
  setIsSeeking(isVisible);
19
+ if (timeoutRef.current) {
20
+ clearTimeout(timeoutRef.current);
21
+ }
18
22
  setVisible((prev) => !prev);
23
+ timeoutRef.current = setTimeout(() => {
24
+ setVisible(false);
25
+ }, 5000);
19
26
  };
20
27
  const handleValueChange = (e) => {
21
28
  e.preventDefault();
@@ -30,9 +37,11 @@ const VolumeSlider = ({ width = 0, setIsSeeking }) => {
30
37
  player === null || player === void 0 ? void 0 : player.muted(false);
31
38
  }
32
39
  };
33
- return (_jsxs("div", { className: `sb-flex ${isVisible ? "" : "-sb-ml-2"} sb-flex-col-reverse ${false ? "!sb-flex-row !sb-items-end " : ""} sb-items-center sb-justify-start sb-gap-1 sb-h-full`, children: [_jsx("div", { className: `sb-flex sb-relative ${width < 400 ? "" : ""} sb-top-1 sb-items-end`, 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
40
+ return (_jsxs("div", { className: `sb-flex ${isVisible ? "" : "-sb-ml-2"} ${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
41
  ? "sb-w-[22px] sb-opacity-100 sb-visible"
35
- : "sb-w-0 sb-opacity-0 sb-invisible"} -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" }) }) })] }));
42
+ : "sb-w-0 sb-opacity-0 sb-invisible"} ${width > 400
43
+ ? "-sb-rotate-90 -sb-translate-y-1"
44
+ : "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" }) }) })] }));
36
45
  };
37
46
  export default VolumeSlider;
38
47
  //# sourceMappingURL=index.js.map
@@ -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;AACpD,MAAM,GAAG,GAAG,CAAC,EACX,GAAG,GAAG,GAAG,CAAC;AAKZ,MAAM,YAAY,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,YAAY,EAAS,EAAE,EAAE;IAC1D,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,CAAC,MAAM,CAAC,CAAC,CAAC;IACb,MAAM,eAAe,GAAG,CAAC,CAAM,EAAE,EAAE;QACjC,CAAC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,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;AACF,eAAe,YAAY,CAAC"}
@@ -15,11 +15,19 @@ const VolumeSlider = ({ width = 0, setIsSeeking }: Props) => {
15
15
  useEffect(() => {
16
16
  setVolume(player?.muted() ? 0 : Number(player?.volume()) * 100 || 0);
17
17
  }, [player]);
18
+ const timeoutRef = React.useRef<any>(null);
19
+
18
20
  const toggleVisiblity = (e: any) => {
19
21
  e.preventDefault();
20
22
  e.stopPropagation();
21
23
  setIsSeeking(isVisible);
24
+ if (timeoutRef.current) {
25
+ clearTimeout(timeoutRef.current);
26
+ }
22
27
  setVisible((prev) => !prev);
28
+ timeoutRef.current = setTimeout(() => {
29
+ setVisible(false);
30
+ }, 5000);
23
31
  };
24
32
  const handleValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
25
33
  e.preventDefault();
@@ -35,15 +43,17 @@ const VolumeSlider = ({ width = 0, setIsSeeking }: Props) => {
35
43
  };
36
44
  return (
37
45
  <div
38
- className={`sb-flex ${isVisible ? "" : "-sb-ml-2"} sb-flex-col-reverse ${
39
- false ? "!sb-flex-row !sb-items-end " : ""
40
- } sb-items-center sb-justify-start sb-gap-1 sb-h-full`}
46
+ className={`sb-flex ${isVisible ? "" : "-sb-ml-2"} ${
47
+ width > 400 ? "sb-flex-col-reverse " : "sb-flex-col !sb-justify-start"
48
+ } ${
49
+ false ? "!sb-flex-row !sb-items-start " : ""
50
+ } sb-items-center sb-gap-1 sb-h-full`}
41
51
  >
42
52
  {/* Mute/Unmute Icon */}
43
53
  <div
44
54
  className={`sb-flex sb-relative ${
45
- width < 400 ? "" : ""
46
- } sb-top-1 sb-items-end`}
55
+ width < 400 ? "-sb-top-1" : "sb-top-1"
56
+ } `}
47
57
  onClick={toggleVisiblity}
48
58
  >
49
59
  {volume === 0 || player?.muted() ? (
@@ -64,7 +74,11 @@ const VolumeSlider = ({ width = 0, setIsSeeking }: Props) => {
64
74
  isVisible
65
75
  ? "sb-w-[22px] sb-opacity-100 sb-visible"
66
76
  : "sb-w-0 sb-opacity-0 sb-invisible"
67
- } -sb-rotate-90 -sb-translate-y-1 sb-relative ${
77
+ } ${
78
+ width > 400
79
+ ? "-sb-rotate-90 -sb-translate-y-1"
80
+ : "sb-rotate-90 sb-translate-y-1"
81
+ } sb-relative ${
68
82
  false ? "sb-static sb-w-16 sb-rotate-0 sb-translate-y-0 " : ""
69
83
  }`}
70
84
  >
package/dist/index.css CHANGED
@@ -41,6 +41,7 @@ input[type=range]::-moz-range-thumb {
41
41
  }
42
42
  .vjs-control-bar {
43
43
  justify-content: center;
44
+ transition: opacity 0.5s ease-in-out;
44
45
  }
45
46
  .video-js .vjs-big-play-button {
46
47
  background-color: transparent;
@@ -421,6 +422,15 @@ video {
421
422
  .sb-relative {
422
423
  position: relative;
423
424
  }
425
+ .\!sb-top-8 {
426
+ top: 2rem !important;
427
+ }
428
+ .-sb-left-9 {
429
+ left: -2.25rem;
430
+ }
431
+ .-sb-top-1 {
432
+ top: -0.25rem;
433
+ }
424
434
  .sb-bottom-10 {
425
435
  bottom: 2.5rem;
426
436
  }
@@ -526,8 +536,8 @@ video {
526
536
  .sb-w-5 {
527
537
  width: 1.25rem;
528
538
  }
529
- .sb-w-\[0px\] {
530
- width: 0px;
539
+ .sb-w-\[100px\] {
540
+ width: 100px;
531
541
  }
532
542
  .sb-w-\[150px\] {
533
543
  width: 150px;
@@ -538,6 +548,9 @@ video {
538
548
  .sb-w-\[22px\] {
539
549
  width: 22px;
540
550
  }
551
+ .sb-w-\[90px\] {
552
+ width: 90px;
553
+ }
541
554
  .sb-w-full {
542
555
  width: 100%;
543
556
  }
@@ -549,10 +562,6 @@ video {
549
562
  --tw-translate-y: -0.25rem;
550
563
  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));
551
564
  }
552
- .-sb-translate-y-9 {
553
- --tw-translate-y: -2.25rem;
554
- 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));
555
- }
556
565
  .sb--translate-x-1\/2 {
557
566
  --tw-translate-x: -50%;
558
567
  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));
@@ -561,6 +570,10 @@ video {
561
570
  --tw-translate-y: 0px;
562
571
  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));
563
572
  }
573
+ .sb-translate-y-1 {
574
+ --tw-translate-y: 0.25rem;
575
+ 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));
576
+ }
564
577
  .-sb-rotate-90 {
565
578
  --tw-rotate: -90deg;
566
579
  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));
@@ -569,6 +582,10 @@ video {
569
582
  --tw-rotate: 0deg;
570
583
  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));
571
584
  }
585
+ .sb-rotate-90 {
586
+ --tw-rotate: 90deg;
587
+ 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));
588
+ }
572
589
  .sb-transform {
573
590
  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));
574
591
  }
@@ -595,20 +612,20 @@ video {
595
612
  .sb-flex-col-reverse {
596
613
  flex-direction: column-reverse;
597
614
  }
615
+ .\!sb-items-start {
616
+ align-items: flex-start !important;
617
+ }
598
618
  .sb-items-start {
599
619
  align-items: flex-start;
600
620
  }
601
- .\!sb-items-end {
602
- align-items: flex-end !important;
603
- }
604
621
  .sb-items-end {
605
622
  align-items: flex-end;
606
623
  }
607
624
  .sb-items-center {
608
625
  align-items: center;
609
626
  }
610
- .sb-justify-start {
611
- justify-content: flex-start;
627
+ .\!sb-justify-start {
628
+ justify-content: flex-start !important;
612
629
  }
613
630
  .sb-justify-center {
614
631
  justify-content: center;
@@ -697,6 +714,10 @@ video {
697
714
  padding-left: 1.25rem;
698
715
  padding-right: 1.25rem;
699
716
  }
717
+ .sb-py-1 {
718
+ padding-top: 0.25rem;
719
+ padding-bottom: 0.25rem;
720
+ }
700
721
  .sb-py-3 {
701
722
  padding-top: 0.75rem;
702
723
  padding-bottom: 0.75rem;
@@ -708,6 +729,9 @@ video {
708
729
  .sb-pb-2 {
709
730
  padding-bottom: 0.5rem;
710
731
  }
732
+ .sb-pt-2 {
733
+ padding-top: 0.5rem;
734
+ }
711
735
  .sb-text-left {
712
736
  text-align: left;
713
737
  }
package/dist/index.d.mts CHANGED
@@ -43,7 +43,8 @@ type Props<T = any> = {
43
43
  handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
44
44
  onPlay?: (time: number) => void;
45
45
  onPause?: (time: number) => void;
46
+ isFocused?: boolean;
46
47
  };
47
- declare const SoftBuildersVideoPlayer: React.MemoExoticComponent<(<T>({ options, notes, chapters, startTime, handleSaveNoteAction, onPlay, onPause, }: Props<T>) => react_jsx_runtime.JSX.Element)>;
48
+ declare const SoftBuildersVideoPlayer: React.MemoExoticComponent<(<T>({ options, notes, chapters, startTime, handleSaveNoteAction, onPlay, onPause, isFocused, }: Props<T>) => react_jsx_runtime.JSX.Element)>;
48
49
 
49
50
  export { type SoftBuildersVideoPlayerChapter, type SoftBuildersVideoPlayerNote, type SoftBuildersVideoPlayerOptions, type SoftBuildersVideoPlayerSource, type SoftBuildersVideoPlayerTrack, SoftBuildersVideoPlayer as default };