softbuilders-react-video-player 1.1.21 → 1.1.23
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/ControlBar/index.js +10 -8
- package/dist/components/ControlBar/index.js.map +1 -1
- package/dist/components/ControlBar/index.tsx +20 -16
- package/dist/components/MenuButton/index.d.ts +2 -1
- package/dist/components/MenuButton/index.js +5 -2
- package/dist/components/MenuButton/index.js.map +1 -1
- package/dist/components/MenuButton/index.tsx +12 -3
- package/dist/components/QualityMenu/index.d.ts +4 -2
- package/dist/components/QualityMenu/index.js +9 -7
- package/dist/components/QualityMenu/index.js.map +1 -1
- package/dist/components/QualityMenu/index.tsx +33 -8
- package/dist/components/SoftBuildersVideoPlayer/index.d.ts +2 -1
- package/dist/components/SoftBuildersVideoPlayer/index.js +4 -1
- package/dist/components/SoftBuildersVideoPlayer/index.js.map +1 -1
- package/dist/components/SoftBuildersVideoPlayer/index.tsx +5 -1
- package/dist/components/SubtitleMenu/index.d.ts +4 -2
- package/dist/components/SubtitleMenu/index.js +8 -3
- package/dist/components/SubtitleMenu/index.js.map +1 -1
- package/dist/components/SubtitleMenu/index.tsx +19 -4
- package/dist/components/VideoPlayerComponent/index.js +70 -8
- package/dist/components/VideoPlayerComponent/index.js.map +1 -1
- package/dist/components/VideoPlayerComponent/index.tsx +80 -7
- package/dist/components/VideoPlayerComponent/style/style.css +1 -0
- package/dist/components/VolumeSlider/index.d.ts +1 -1
- package/dist/components/VolumeSlider/index.js +4 -2
- package/dist/components/VolumeSlider/index.js.map +1 -1
- package/dist/components/VolumeSlider/index.tsx +13 -7
- package/dist/index.css +35 -11
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +287 -157
- package/dist/styles/tailwind.css +34 -11
- 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
|
-
|
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
|
-
|
164
|
+
if (timeoutRef.current) {
|
165
|
+
clearTimeout(timeoutRef.current);
|
166
|
+
}
|
167
|
+
setOpacity("100");
|
168
|
+
setTimeout(() => {
|
169
|
+
setOpacity("0");
|
170
|
+
}, 5000);
|
143
171
|
if (playerRef.current) {
|
144
172
|
if (playerRef.current.paused()) {
|
145
|
-
|
146
|
-
|
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
|
-
|
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,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;
|
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,E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,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
|
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
|
-
|
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
|
-
|
240
|
+
if (timeoutRef.current) {
|
241
|
+
clearTimeout(timeoutRef.current);
|
242
|
+
}
|
243
|
+
setOpacity("100");
|
244
|
+
setTimeout(() => {
|
245
|
+
setOpacity("0");
|
246
|
+
}, 5000);
|
247
|
+
|
214
248
|
if (playerRef.current) {
|
215
249
|
if (playerRef.current.paused()) {
|
216
|
-
|
217
|
-
|
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
|
>
|
@@ -30,9 +30,11 @@ const VolumeSlider = ({ width = 0, setIsSeeking }) => {
|
|
30
30
|
player === null || player === void 0 ? void 0 : player.muted(false);
|
31
31
|
}
|
32
32
|
};
|
33
|
-
return (_jsxs("div", { className: `sb-flex ${isVisible ? "" : "-sb-ml-2"} sb-flex-col-reverse ${false ? "!sb-flex-row !sb-items-
|
33
|
+
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
34
|
? "sb-w-[22px] sb-opacity-100 sb-visible"
|
35
|
-
: "sb-w-0 sb-opacity-0 sb-invisible"}
|
35
|
+
: "sb-w-0 sb-opacity-0 sb-invisible"} ${width > 400
|
36
|
+
? "-sb-rotate-90 -sb-translate-y-1"
|
37
|
+
: "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
38
|
};
|
37
39
|
export default VolumeSlider;
|
38
40
|
//# 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;Q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SAAS,EAAC,4CAA4C,YAEzD,cACE,SAAS,EAAE,oDACT,SAAS;wBACP,CAAC,CAAC,uCAAuC;wBACzC,CAAC,CAAC,kCACN,KACE,KAAK,GAAG,GAAG;wBACT,CAAC,CAAC,iCAAiC;wBACnC,CAAC,CAAC,+BACN,gBACE,KAAK,CAAC,CAAC,CAAC,iDAAiD,CAAC,CAAC,CAAC,EAC9D,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;AACF,eAAe,YAAY,CAAC"}
|
@@ -6,7 +6,7 @@ const MIN = 0,
|
|
6
6
|
MAX = 100;
|
7
7
|
type Props = {
|
8
8
|
width?: number;
|
9
|
-
setIsSeeking
|
9
|
+
setIsSeeking: (val: boolean) => void;
|
10
10
|
};
|
11
11
|
const VolumeSlider = ({ width = 0, setIsSeeking }: Props) => {
|
12
12
|
const { player } = useSoftBuildersVideoPlayerContext();
|
@@ -35,15 +35,17 @@ const VolumeSlider = ({ width = 0, setIsSeeking }: Props) => {
|
|
35
35
|
};
|
36
36
|
return (
|
37
37
|
<div
|
38
|
-
className={`sb-flex ${isVisible ? "" : "-sb-ml-2"}
|
39
|
-
|
40
|
-
}
|
38
|
+
className={`sb-flex ${isVisible ? "" : "-sb-ml-2"} ${
|
39
|
+
width > 400 ? "sb-flex-col-reverse " : "sb-flex-col !sb-justify-start"
|
40
|
+
} ${
|
41
|
+
false ? "!sb-flex-row !sb-items-start " : ""
|
42
|
+
} sb-items-center sb-gap-1 sb-h-full`}
|
41
43
|
>
|
42
44
|
{/* Mute/Unmute Icon */}
|
43
45
|
<div
|
44
46
|
className={`sb-flex sb-relative ${
|
45
|
-
width < 400 ? "" : ""
|
46
|
-
}
|
47
|
+
width < 400 ? "-sb-top-1" : "sb-top-1"
|
48
|
+
} `}
|
47
49
|
onClick={toggleVisiblity}
|
48
50
|
>
|
49
51
|
{volume === 0 || player?.muted() ? (
|
@@ -64,7 +66,11 @@ const VolumeSlider = ({ width = 0, setIsSeeking }: Props) => {
|
|
64
66
|
isVisible
|
65
67
|
? "sb-w-[22px] sb-opacity-100 sb-visible"
|
66
68
|
: "sb-w-0 sb-opacity-0 sb-invisible"
|
67
|
-
}
|
69
|
+
} ${
|
70
|
+
width > 400
|
71
|
+
? "-sb-rotate-90 -sb-translate-y-1"
|
72
|
+
: "sb-rotate-90 sb-translate-y-1"
|
73
|
+
} sb-relative ${
|
68
74
|
false ? "sb-static sb-w-16 sb-rotate-0 sb-translate-y-0 " : ""
|
69
75
|
}`}
|
70
76
|
>
|
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-\[
|
530
|
-
width:
|
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
|
-
|
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 };
|