softbuilders-react-video-player 1.1.7 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/README.md +126 -126
- package/dist/components/BigPlayButton/index.tsx +31 -31
- package/dist/components/BufferTracker/index.tsx +19 -19
- package/dist/components/ChapterTooltip/index.tsx +65 -65
- package/dist/components/ChaptersPanal/index.tsx +40 -40
- package/dist/components/ControlBar/index.d.ts +2 -1
- package/dist/components/ControlBar/index.js +19 -5
- package/dist/components/ControlBar/index.js.map +1 -1
- package/dist/components/ControlBar/index.tsx +149 -127
- package/dist/components/CreateNoteMenu/index.tsx +61 -61
- package/dist/components/CurrentTimeLabel/index.tsx +13 -13
- package/dist/components/CurrentTimeTracker/index.tsx +18 -18
- package/dist/components/Menu/index.tsx +49 -49
- package/dist/components/MenuButton/index.js +1 -1
- package/dist/components/MenuButton/index.js.map +1 -1
- package/dist/components/MenuButton/index.tsx +67 -67
- package/dist/components/NoteTooltip/index.tsx +46 -46
- package/dist/components/NotesPanal/index.tsx +34 -34
- package/dist/components/QualityMenu/index.js +2 -2
- package/dist/components/QualityMenu/index.js.map +1 -1
- package/dist/components/QualityMenu/index.tsx +122 -122
- package/dist/components/Slider/index.d.ts +1 -1
- package/dist/components/Slider/index.js +3 -3
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/index.tsx +36 -37
- package/dist/components/Slider/style.css +49 -15
- package/dist/components/SoftBuildersVideoPlayer/index.js +1 -1
- package/dist/components/SoftBuildersVideoPlayer/index.js.map +1 -1
- package/dist/components/SoftBuildersVideoPlayer/index.tsx +110 -109
- package/dist/components/SubtitleMenu/index.js +2 -2
- package/dist/components/SubtitleMenu/index.js.map +1 -1
- package/dist/components/SubtitleMenu/index.tsx +107 -108
- package/dist/components/TimeSlider/index.js +13 -13
- package/dist/components/TimeSlider/index.tsx +107 -107
- package/dist/components/TimeSliderContainer/index.tsx +35 -35
- package/dist/components/Tooltip/index.tsx +16 -16
- package/dist/components/VideoPlayerComponent/index.d.ts +2 -1
- package/dist/components/VideoPlayerComponent/index.js +37 -34
- package/dist/components/VideoPlayerComponent/index.js.map +1 -1
- package/dist/components/VideoPlayerComponent/index.tsx +260 -249
- package/dist/components/VideoPlayerComponent/provider.tsx +82 -82
- package/dist/components/VideoPlayerComponent/style/style.css +36 -36
- package/dist/components/VolumeSlider/index.d.ts +4 -2
- package/dist/components/VolumeSlider/index.js +12 -2
- package/dist/components/VolumeSlider/index.js.map +1 -1
- package/dist/components/VolumeSlider/index.tsx +91 -52
- package/dist/components/icons/SubIcon.d.ts +3 -0
- package/dist/components/icons/SubIcon.js +4 -0
- package/dist/components/icons/SubIcon.js.map +1 -0
- package/dist/components/icons/SubIcon.tsx +28 -0
- package/dist/components/icons/index.d.ts +1 -0
- package/dist/components/icons/index.js +1 -0
- package/dist/components/icons/index.js.map +1 -1
- package/dist/components/icons/index.ts +15 -14
- package/dist/images/index.d.ts +1 -0
- package/dist/images/index.js +1 -0
- package/dist/images/index.js.map +1 -1
- package/dist/index.css +75 -3
- package/dist/index.mjs +253 -166
- package/dist/styles/tailwind.css +137 -87
- package/package.json +45 -45
@@ -1,82 +1,82 @@
|
|
1
|
-
import React, {
|
2
|
-
createContext,
|
3
|
-
useContext,
|
4
|
-
useState,
|
5
|
-
ReactNode,
|
6
|
-
useEffect,
|
7
|
-
} from "react";
|
8
|
-
import Player from "video.js/dist/types/player";
|
9
|
-
|
10
|
-
interface SoftBuildersVideoPlayerContextType {
|
11
|
-
player: Player | undefined;
|
12
|
-
setPlayer: React.Dispatch<React.SetStateAction<Player | undefined>>;
|
13
|
-
|
14
|
-
currentTime: number;
|
15
|
-
setCurrentTime: (value: number) => void;
|
16
|
-
|
17
|
-
duration: number;
|
18
|
-
setDuration: React.Dispatch<React.SetStateAction<number>>;
|
19
|
-
|
20
|
-
// isPaused: boolean;
|
21
|
-
// setIsPaused: React.Dispatch<React.SetStateAction<boolean>>;
|
22
|
-
|
23
|
-
downloadedBufferPercentage: number;
|
24
|
-
downloadedBufferTime: number;
|
25
|
-
setDownloadedBufferTimeufferTime: React.Dispatch<
|
26
|
-
React.SetStateAction<number>
|
27
|
-
>;
|
28
|
-
}
|
29
|
-
|
30
|
-
const SoftBuildersVideoPlayerContext = createContext<
|
31
|
-
SoftBuildersVideoPlayerContextType | undefined
|
32
|
-
>(undefined);
|
33
|
-
|
34
|
-
// Create a provider component
|
35
|
-
export const SoftBuildersVideoPlayerProvider = ({
|
36
|
-
children,
|
37
|
-
}: {
|
38
|
-
children: ReactNode;
|
39
|
-
}) => {
|
40
|
-
const [player, setPlayer] = useState<Player | undefined>(undefined);
|
41
|
-
const [currentTime, setCurrentTime] = useState<number>(0);
|
42
|
-
const [duration, setDuration] = useState<number>(1);
|
43
|
-
// const [isPaused, setIsPaused] = useState(false);
|
44
|
-
const [downloadedBufferTime, setDownloadedBufferTimeufferTime] = useState(0);
|
45
|
-
const [downloadedBufferPercentage, setDownloadedBufferPercentage] =
|
46
|
-
useState(0);
|
47
|
-
|
48
|
-
useEffect(() => {
|
49
|
-
setDownloadedBufferPercentage((downloadedBufferTime * 100) / duration);
|
50
|
-
}, [downloadedBufferTime]);
|
51
|
-
|
52
|
-
return (
|
53
|
-
<SoftBuildersVideoPlayerContext.Provider
|
54
|
-
value={{
|
55
|
-
player,
|
56
|
-
setPlayer,
|
57
|
-
duration,
|
58
|
-
setDuration,
|
59
|
-
currentTime,
|
60
|
-
setCurrentTime: (value) => setCurrentTime(Math.floor(value)),
|
61
|
-
// isPaused,
|
62
|
-
// setIsPaused,
|
63
|
-
downloadedBufferTime,
|
64
|
-
setDownloadedBufferTimeufferTime,
|
65
|
-
downloadedBufferPercentage,
|
66
|
-
}}
|
67
|
-
>
|
68
|
-
{children}
|
69
|
-
</SoftBuildersVideoPlayerContext.Provider>
|
70
|
-
);
|
71
|
-
};
|
72
|
-
|
73
|
-
// Custom hook to use the context
|
74
|
-
export const useSoftBuildersVideoPlayerContext = () => {
|
75
|
-
const context = useContext(SoftBuildersVideoPlayerContext);
|
76
|
-
if (!context) {
|
77
|
-
throw new Error(
|
78
|
-
"useSoftBuildersVideoPlayerContext must be used within an SoftBuildersVideoPlayerProvider"
|
79
|
-
);
|
80
|
-
}
|
81
|
-
return context;
|
82
|
-
};
|
1
|
+
import React, {
|
2
|
+
createContext,
|
3
|
+
useContext,
|
4
|
+
useState,
|
5
|
+
ReactNode,
|
6
|
+
useEffect,
|
7
|
+
} from "react";
|
8
|
+
import Player from "video.js/dist/types/player";
|
9
|
+
|
10
|
+
interface SoftBuildersVideoPlayerContextType {
|
11
|
+
player: Player | undefined;
|
12
|
+
setPlayer: React.Dispatch<React.SetStateAction<Player | undefined>>;
|
13
|
+
|
14
|
+
currentTime: number;
|
15
|
+
setCurrentTime: (value: number) => void;
|
16
|
+
|
17
|
+
duration: number;
|
18
|
+
setDuration: React.Dispatch<React.SetStateAction<number>>;
|
19
|
+
|
20
|
+
// isPaused: boolean;
|
21
|
+
// setIsPaused: React.Dispatch<React.SetStateAction<boolean>>;
|
22
|
+
|
23
|
+
downloadedBufferPercentage: number;
|
24
|
+
downloadedBufferTime: number;
|
25
|
+
setDownloadedBufferTimeufferTime: React.Dispatch<
|
26
|
+
React.SetStateAction<number>
|
27
|
+
>;
|
28
|
+
}
|
29
|
+
|
30
|
+
const SoftBuildersVideoPlayerContext = createContext<
|
31
|
+
SoftBuildersVideoPlayerContextType | undefined
|
32
|
+
>(undefined);
|
33
|
+
|
34
|
+
// Create a provider component
|
35
|
+
export const SoftBuildersVideoPlayerProvider = ({
|
36
|
+
children,
|
37
|
+
}: {
|
38
|
+
children: ReactNode;
|
39
|
+
}) => {
|
40
|
+
const [player, setPlayer] = useState<Player | undefined>(undefined);
|
41
|
+
const [currentTime, setCurrentTime] = useState<number>(0);
|
42
|
+
const [duration, setDuration] = useState<number>(1);
|
43
|
+
// const [isPaused, setIsPaused] = useState(false);
|
44
|
+
const [downloadedBufferTime, setDownloadedBufferTimeufferTime] = useState(0);
|
45
|
+
const [downloadedBufferPercentage, setDownloadedBufferPercentage] =
|
46
|
+
useState(0);
|
47
|
+
|
48
|
+
useEffect(() => {
|
49
|
+
setDownloadedBufferPercentage((downloadedBufferTime * 100) / duration);
|
50
|
+
}, [downloadedBufferTime]);
|
51
|
+
|
52
|
+
return (
|
53
|
+
<SoftBuildersVideoPlayerContext.Provider
|
54
|
+
value={{
|
55
|
+
player,
|
56
|
+
setPlayer,
|
57
|
+
duration,
|
58
|
+
setDuration,
|
59
|
+
currentTime,
|
60
|
+
setCurrentTime: (value) => setCurrentTime(Math.floor(value)),
|
61
|
+
// isPaused,
|
62
|
+
// setIsPaused,
|
63
|
+
downloadedBufferTime,
|
64
|
+
setDownloadedBufferTimeufferTime,
|
65
|
+
downloadedBufferPercentage,
|
66
|
+
}}
|
67
|
+
>
|
68
|
+
{children}
|
69
|
+
</SoftBuildersVideoPlayerContext.Provider>
|
70
|
+
);
|
71
|
+
};
|
72
|
+
|
73
|
+
// Custom hook to use the context
|
74
|
+
export const useSoftBuildersVideoPlayerContext = () => {
|
75
|
+
const context = useContext(SoftBuildersVideoPlayerContext);
|
76
|
+
if (!context) {
|
77
|
+
throw new Error(
|
78
|
+
"useSoftBuildersVideoPlayerContext must be used within an SoftBuildersVideoPlayerProvider"
|
79
|
+
);
|
80
|
+
}
|
81
|
+
return context;
|
82
|
+
};
|
@@ -1,36 +1,36 @@
|
|
1
|
-
.video-js .vjs-control-bar {
|
2
|
-
background-color: transparent;
|
3
|
-
display: none;
|
4
|
-
}
|
5
|
-
|
6
|
-
.video-js .vjs-big-play-button {
|
7
|
-
background-color: transparent;
|
8
|
-
display: block;
|
9
|
-
border: none;
|
10
|
-
padding: 0px;
|
11
|
-
opacity: 0;
|
12
|
-
transition: opacity 0.5s ease-in-out;
|
13
|
-
}
|
14
|
-
|
15
|
-
.video-js:hover .vjs-big-play-button {
|
16
|
-
background-color: transparent;
|
17
|
-
border: none;
|
18
|
-
padding: 0px;
|
19
|
-
opacity: 1;
|
20
|
-
transition: opacity 0.5s ease-in-out;
|
21
|
-
}
|
22
|
-
|
23
|
-
.vjs-poster {
|
24
|
-
display: inline-block;
|
25
|
-
vertical-align: middle;
|
26
|
-
cursor: pointer;
|
27
|
-
margin: 0;
|
28
|
-
padding: 0;
|
29
|
-
position: absolute;
|
30
|
-
top: 0;
|
31
|
-
right: 0;
|
32
|
-
bottom: 0;
|
33
|
-
left: 0;
|
34
|
-
height: 100%;
|
35
|
-
background-color: black;
|
36
|
-
}
|
1
|
+
.video-js .vjs-control-bar {
|
2
|
+
background-color: transparent;
|
3
|
+
display: none;
|
4
|
+
}
|
5
|
+
|
6
|
+
.video-js .vjs-big-play-button {
|
7
|
+
background-color: transparent;
|
8
|
+
display: block;
|
9
|
+
border: none;
|
10
|
+
padding: 0px;
|
11
|
+
opacity: 0;
|
12
|
+
transition: opacity 0.5s ease-in-out;
|
13
|
+
}
|
14
|
+
|
15
|
+
.video-js:hover .vjs-big-play-button {
|
16
|
+
background-color: transparent;
|
17
|
+
border: none;
|
18
|
+
padding: 0px;
|
19
|
+
opacity: 1;
|
20
|
+
transition: opacity 0.5s ease-in-out;
|
21
|
+
}
|
22
|
+
|
23
|
+
.vjs-poster {
|
24
|
+
display: inline-block;
|
25
|
+
vertical-align: middle;
|
26
|
+
cursor: pointer;
|
27
|
+
margin: 0;
|
28
|
+
padding: 0;
|
29
|
+
position: absolute;
|
30
|
+
top: 0;
|
31
|
+
right: 0;
|
32
|
+
bottom: 0;
|
33
|
+
left: 0;
|
34
|
+
height: 100%;
|
35
|
+
background-color: black;
|
36
|
+
}
|
@@ -4,12 +4,16 @@ 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 = ({}) => {
|
7
|
+
const VolumeSlider = ({ width }) => {
|
8
8
|
const { player } = useSoftBuildersVideoPlayerContext();
|
9
|
+
const [isVisible, setVisible] = useState(false);
|
9
10
|
const [volume, setVolume] = useState(0);
|
10
11
|
useEffect(() => {
|
11
12
|
setVolume((player === null || player === void 0 ? void 0 : player.muted()) ? 0 : Number(player === null || player === void 0 ? void 0 : player.volume()) * 100 || 0);
|
12
13
|
}, [player]);
|
14
|
+
const toggleVisiblity = () => {
|
15
|
+
setVisible((prev) => !prev);
|
16
|
+
};
|
13
17
|
const handleValueChange = (e) => {
|
14
18
|
const newVolume = Number(e.target.value);
|
15
19
|
setVolume(newVolume);
|
@@ -21,7 +25,13 @@ const VolumeSlider = ({}) => {
|
|
21
25
|
player === null || player === void 0 ? void 0 : player.muted(false);
|
22
26
|
}
|
23
27
|
};
|
24
|
-
return (_jsxs("div", { className: "sb-flex sb-items-center sb-gap-2", children:
|
28
|
+
return (_jsxs("div", { className: `sb-flex sb-flex-col-reverse ${width > 600 ? "!sb-flex-row !sb-items-end" : ""} sb-items-center sb-justify-start sb-gap-2 sb-h-full`, children: [_jsx("div", { className: `sb-flex sb-relative ${width > 600 ? "" : ""} 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 > 600 ? " " : ""} sb-h-5 sb-w-5` })) : (_jsx(UnmuteIcon, { className: `sb-w-3 sb-h-3 ${width > 600 ? "" : ""} sb-h-5 sb-w-5` })) }), _jsx("div", { className: "sb-flex sb-items-center sb-justify-center", children: _jsx("div", { className: `${isVisible && width < 600
|
29
|
+
? " sb-w-[22px]"
|
30
|
+
: !isVisible && width < 600
|
31
|
+
? "sb-hidden"
|
32
|
+
: ""} -sb-rotate-90 -sb-translate-y-2 sb-relative ${width > 600
|
33
|
+
? "sb-static sb-w-16 sb-rotate-0 sb-translate-y-0 "
|
34
|
+
: "sb-translate-y-0"}`, children: _jsx(Slider, { value: volume, handleValueChange: handleValueChange, min: MIN, max: MAX, className: "!sb-w-16" }) }) })] }));
|
25
35
|
};
|
26
36
|
export default VolumeSlider;
|
27
37
|
//# 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;AAEpD,MAAM,GAAG,GAAG,CAAC,EACX,GAAG,GAAG,GAAG,CAAC;
|
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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,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AC,CACF,KAAC,UAAU,IACT,SAAS,EAAE,iBAAiB,KAAK,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"}
|
@@ -1,52 +1,91 @@
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
2
|
-
import Slider from "../Slider";
|
3
|
-
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
4
|
-
import { MuteIcon, UnmuteIcon } from "../../images";
|
5
|
-
|
6
|
-
const MIN = 0,
|
7
|
-
MAX = 100;
|
8
|
-
|
9
|
-
type Props = {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}
|
51
|
-
|
52
|
-
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
import Slider from "../Slider";
|
3
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
4
|
+
import { MuteIcon, UnmuteIcon } from "../../images";
|
5
|
+
|
6
|
+
const MIN = 0,
|
7
|
+
MAX = 100;
|
8
|
+
|
9
|
+
type Props = {
|
10
|
+
width?: number;
|
11
|
+
};
|
12
|
+
|
13
|
+
const VolumeSlider = ({ width }: Props) => {
|
14
|
+
const { player } = useSoftBuildersVideoPlayerContext();
|
15
|
+
const [isVisible, setVisible] = useState(false);
|
16
|
+
const [volume, setVolume] = useState(0);
|
17
|
+
|
18
|
+
useEffect(() => {
|
19
|
+
setVolume(player?.muted() ? 0 : Number(player?.volume()) * 100 || 0);
|
20
|
+
}, [player]);
|
21
|
+
const toggleVisiblity = () => {
|
22
|
+
setVisible((prev) => !prev);
|
23
|
+
};
|
24
|
+
|
25
|
+
const handleValueChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
26
|
+
const newVolume = Number(e.target.value);
|
27
|
+
|
28
|
+
setVolume(newVolume);
|
29
|
+
|
30
|
+
player?.volume(newVolume / 100);
|
31
|
+
|
32
|
+
if (newVolume === 0) {
|
33
|
+
player?.muted(true);
|
34
|
+
} else {
|
35
|
+
player?.muted(false);
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
return (
|
40
|
+
<div
|
41
|
+
className={`sb-flex sb-flex-col-reverse ${
|
42
|
+
width > 600 ? "!sb-flex-row !sb-items-end" : ""
|
43
|
+
} sb-items-center sb-justify-start sb-gap-2 sb-h-full`}
|
44
|
+
>
|
45
|
+
{/* Mute/Unmute Icon */}
|
46
|
+
<div
|
47
|
+
className={`sb-flex sb-relative ${
|
48
|
+
width > 600 ? "" : ""
|
49
|
+
} sb-top-1 sb-items-end`}
|
50
|
+
onClick={toggleVisiblity}
|
51
|
+
>
|
52
|
+
{volume === 0 || player?.muted() ? (
|
53
|
+
<MuteIcon
|
54
|
+
className={`sb-w-3 sb-h-3 ${width > 600 ? " " : ""} sb-h-5 sb-w-5`}
|
55
|
+
/>
|
56
|
+
) : (
|
57
|
+
<UnmuteIcon
|
58
|
+
className={`sb-w-3 sb-h-3 ${width > 600 ? "" : ""} sb-h-5 sb-w-5`}
|
59
|
+
/>
|
60
|
+
)}
|
61
|
+
</div>
|
62
|
+
{/* Slider Wrapper */}
|
63
|
+
<div className="sb-flex sb-items-center sb-justify-center">
|
64
|
+
{/* Rotated Slider */}
|
65
|
+
<div
|
66
|
+
className={`${
|
67
|
+
isVisible && width < 600
|
68
|
+
? " sb-w-[22px]"
|
69
|
+
: !isVisible && width < 600
|
70
|
+
? "sb-hidden"
|
71
|
+
: ""
|
72
|
+
} -sb-rotate-90 -sb-translate-y-2 sb-relative ${
|
73
|
+
width > 600
|
74
|
+
? "sb-static sb-w-16 sb-rotate-0 sb-translate-y-0 "
|
75
|
+
: "sb-translate-y-0"
|
76
|
+
}`}
|
77
|
+
>
|
78
|
+
<Slider
|
79
|
+
value={volume}
|
80
|
+
handleValueChange={handleValueChange}
|
81
|
+
min={MIN}
|
82
|
+
max={MAX}
|
83
|
+
className="!sb-w-16"
|
84
|
+
/>
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
</div>
|
88
|
+
);
|
89
|
+
};
|
90
|
+
|
91
|
+
export default VolumeSlider;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
const SvgSubIcon = (props) => (_jsxs("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", stroke: "currentColor", viewBox: "0 0 15 15" }, props, { children: [_jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M1.25 7.5c0-2.487 0-3.731.658-4.561q.159-.2.346-.367c.785-.697 1.96-.697 4.309-.697h1.875c2.349 0 3.523 0 4.307.697q.19.168.347.367c.658.83.658 2.074.658 4.561s0 3.731-.658 4.561q-.157.2-.347.367c-.784.697-1.957.697-4.307.697H6.562c-2.349 0-3.523 0-4.308-.697a3 3 0 0 1-.346-.367c-.658-.83-.658-2.073-.658-4.561" }), _jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M6.563 5.625H6.25c-.582 0-.874 0-1.103.095a1.25 1.25 0 0 0-.677.677c-.095.23-.095.52-.095 1.103 0 .582 0 .874.095 1.103a1.25 1.25 0 0 0 .677.677c.23.095.52.095 1.103.095h.313m4.062-3.75h-.312c-.583 0-.874 0-1.104.095a1.25 1.25 0 0 0-.676.677c-.095.23-.095.52-.095 1.103 0 .582 0 .874.095 1.103a1.25 1.25 0 0 0 .676.677c.23.095.521.095 1.104.095h.312" })] })));
|
3
|
+
export default SvgSubIcon;
|
4
|
+
//# sourceMappingURL=SubIcon.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SubIcon.js","sourceRoot":"","sources":["../../../src/components/icons/SubIcon.tsx"],"names":[],"mappings":";AACA,MAAM,UAAU,GAAG,CAAC,KAA8B,EAAE,EAAE,CAAC,CACrD,6BACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,KAAK,EACX,MAAM,EAAC,KAAK,EACZ,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,OAAO,EAAC,WAAW,IACf,KAAK,eAET,eACE,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAE,GAAG,EAChB,CAAC,EAAC,yTAAyT,GAC3T,EACF,eACE,MAAM,EAAC,cAAc,EACrB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAE,GAAG,EAChB,CAAC,EAAC,+VAA+V,GACjW,KACE,CACP,CAAC;AACF,eAAe,UAAU,CAAC"}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import type { SVGProps } from "react";
|
2
|
+
const SvgSubIcon = (props: SVGProps<SVGSVGElement>) => (
|
3
|
+
<svg
|
4
|
+
xmlns="http://www.w3.org/2000/svg"
|
5
|
+
width="1em"
|
6
|
+
height="1em"
|
7
|
+
fill="none"
|
8
|
+
stroke="currentColor"
|
9
|
+
viewBox="0 0 15 15"
|
10
|
+
{...props}
|
11
|
+
>
|
12
|
+
<path
|
13
|
+
stroke="currentColor"
|
14
|
+
strokeLinecap="round"
|
15
|
+
strokeLinejoin="round"
|
16
|
+
strokeWidth={1.5}
|
17
|
+
d="M1.25 7.5c0-2.487 0-3.731.658-4.561q.159-.2.346-.367c.785-.697 1.96-.697 4.309-.697h1.875c2.349 0 3.523 0 4.307.697q.19.168.347.367c.658.83.658 2.074.658 4.561s0 3.731-.658 4.561q-.157.2-.347.367c-.784.697-1.957.697-4.307.697H6.562c-2.349 0-3.523 0-4.308-.697a3 3 0 0 1-.346-.367c-.658-.83-.658-2.073-.658-4.561"
|
18
|
+
/>
|
19
|
+
<path
|
20
|
+
stroke="currentColor"
|
21
|
+
strokeLinecap="round"
|
22
|
+
strokeLinejoin="round"
|
23
|
+
strokeWidth={1.5}
|
24
|
+
d="M6.563 5.625H6.25c-.582 0-.874 0-1.103.095a1.25 1.25 0 0 0-.677.677c-.095.23-.095.52-.095 1.103 0 .582 0 .874.095 1.103a1.25 1.25 0 0 0 .677.677c.23.095.52.095 1.103.095h.313m4.062-3.75h-.312c-.583 0-.874 0-1.104.095a1.25 1.25 0 0 0-.676.677c-.095.23-.095.52-.095 1.103 0 .582 0 .874.095 1.103a1.25 1.25 0 0 0 .676.677c.23.095.521.095 1.104.095h.312"
|
25
|
+
/>
|
26
|
+
</svg>
|
27
|
+
);
|
28
|
+
export default SvgSubIcon;
|
@@ -10,5 +10,6 @@ export { default as OpenNoteIcon } from "./OpenNoteIcon";
|
|
10
10
|
export { default as PauseIcon } from "./PauseIcon";
|
11
11
|
export { default as PlayIcon } from "./PlayIcon";
|
12
12
|
export { default as SettingsIcon } from "./SettingsIcon";
|
13
|
+
export { default as SubIcon } from "./SubIcon";
|
13
14
|
export { default as SubtitlesIcon } from "./SubtitlesIcon";
|
14
15
|
export { default as UnmuteIcon } from "./UnmuteIcon";
|
@@ -10,6 +10,7 @@ export { default as OpenNoteIcon } from "./OpenNoteIcon";
|
|
10
10
|
export { default as PauseIcon } from "./PauseIcon";
|
11
11
|
export { default as PlayIcon } from "./PlayIcon";
|
12
12
|
export { default as SettingsIcon } from "./SettingsIcon";
|
13
|
+
export { default as SubIcon } from "./SubIcon";
|
13
14
|
export { default as SubtitlesIcon } from "./SubtitlesIcon";
|
14
15
|
export { default as UnmuteIcon } from "./UnmuteIcon";
|
15
16
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/icons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,SA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,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
@@ -1,14 +1,15 @@
|
|
1
|
-
export { default as BackwardIcon } from "./BackwardIcon";
|
2
|
-
export { default as CheckedIcon } from "./CheckedIcon";
|
3
|
-
export { default as ClosedNoteIcon } from "./ClosedNoteIcon";
|
4
|
-
export { default as ForwardIcon } from "./ForwardIcon";
|
5
|
-
export { default as FullScreenIcon } from "./FullScreenIcon";
|
6
|
-
export { default as LeftArrowIcon } from "./LeftArrowIcon";
|
7
|
-
export { default as MuteIcon } from "./MuteIcon";
|
8
|
-
export { default as NoteIcon } from "./NoteIcon";
|
9
|
-
export { default as OpenNoteIcon } from "./OpenNoteIcon";
|
10
|
-
export { default as PauseIcon } from "./PauseIcon";
|
11
|
-
export { default as PlayIcon } from "./PlayIcon";
|
12
|
-
export { default as SettingsIcon } from "./SettingsIcon";
|
13
|
-
export { default as
|
14
|
-
export { default as
|
1
|
+
export { default as BackwardIcon } from "./BackwardIcon";
|
2
|
+
export { default as CheckedIcon } from "./CheckedIcon";
|
3
|
+
export { default as ClosedNoteIcon } from "./ClosedNoteIcon";
|
4
|
+
export { default as ForwardIcon } from "./ForwardIcon";
|
5
|
+
export { default as FullScreenIcon } from "./FullScreenIcon";
|
6
|
+
export { default as LeftArrowIcon } from "./LeftArrowIcon";
|
7
|
+
export { default as MuteIcon } from "./MuteIcon";
|
8
|
+
export { default as NoteIcon } from "./NoteIcon";
|
9
|
+
export { default as OpenNoteIcon } from "./OpenNoteIcon";
|
10
|
+
export { default as PauseIcon } from "./PauseIcon";
|
11
|
+
export { default as PlayIcon } from "./PlayIcon";
|
12
|
+
export { default as SettingsIcon } from "./SettingsIcon";
|
13
|
+
export { default as SubIcon } from "./SubIcon";
|
14
|
+
export { default as SubtitlesIcon } from "./SubtitlesIcon";
|
15
|
+
export { default as UnmuteIcon } from "./UnmuteIcon";
|
package/dist/images/index.d.ts
CHANGED
@@ -12,3 +12,4 @@ export { default as PlayIcon } from "./../components/icons/PlayIcon";
|
|
12
12
|
export { default as SettingsIcon } from "./../components/icons/SettingsIcon";
|
13
13
|
export { default as UnmuteIcon } from "./../components/icons/UnmuteIcon";
|
14
14
|
export { default as SubtitlesIcon } from "./../components/icons/SubtitlesIcon";
|
15
|
+
export { default as SubIcon } from "./../components/icons/SubIcon";
|
package/dist/images/index.js
CHANGED
@@ -12,4 +12,5 @@ export { default as PlayIcon } from "./../components/icons/PlayIcon";
|
|
12
12
|
export { default as SettingsIcon } from "./../components/icons/SettingsIcon";
|
13
13
|
export { default as UnmuteIcon } from "./../components/icons/UnmuteIcon";
|
14
14
|
export { default as SubtitlesIcon } from "./../components/icons/SubtitlesIcon";
|
15
|
+
export { default as SubIcon } from "./../components/icons/SubIcon";
|
15
16
|
//# sourceMappingURL=index.js.map
|
package/dist/images/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/images/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,iCA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