softbuilders-react-video-player 1.0.6 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/BigPlayButton/index.d.ts +1 -1
- package/dist/components/BigPlayButton/index.js +2 -3
- package/dist/components/BigPlayButton/index.js.map +1 -1
- package/dist/components/BigPlayButton/index.tsx +31 -0
- package/dist/components/BufferTracker/index.d.ts +1 -2
- package/dist/components/BufferTracker/index.js +3 -2
- package/dist/components/BufferTracker/index.js.map +1 -1
- package/dist/components/BufferTracker/index.tsx +19 -0
- package/dist/components/ChapterTooltip/index.d.ts +1 -2
- package/dist/components/ChapterTooltip/index.js +4 -13
- package/dist/components/ChapterTooltip/index.js.map +1 -1
- package/dist/components/ChapterTooltip/index.tsx +65 -0
- package/dist/components/ChaptersPanal/index.d.ts +1 -2
- package/dist/components/ChaptersPanal/index.js +3 -2
- package/dist/components/ChaptersPanal/index.js.map +1 -1
- package/dist/components/ChaptersPanal/index.tsx +40 -0
- package/dist/components/ControlBar/index.d.ts +1 -1
- package/dist/components/ControlBar/index.js +14 -31
- package/dist/components/ControlBar/index.js.map +1 -1
- package/dist/components/ControlBar/index.tsx +127 -0
- package/dist/components/CreateNoteMenu/index.d.ts +1 -2
- package/dist/components/CreateNoteMenu/index.js +3 -9
- package/dist/components/CreateNoteMenu/index.js.map +1 -1
- package/dist/components/CreateNoteMenu/index.tsx +61 -0
- package/dist/components/CurrentTimeLabel/index.d.ts +1 -2
- package/dist/components/CurrentTimeLabel/index.js +2 -2
- package/dist/components/CurrentTimeLabel/index.js.map +1 -1
- package/dist/components/CurrentTimeLabel/index.tsx +13 -0
- package/dist/components/CurrentTimeTracker/index.d.ts +1 -2
- package/dist/components/CurrentTimeTracker/index.js +3 -2
- package/dist/components/CurrentTimeTracker/index.js.map +1 -1
- package/dist/components/CurrentTimeTracker/index.tsx +18 -0
- package/dist/components/Menu/index.d.ts +1 -2
- package/dist/components/Menu/index.js +2 -7
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/index.tsx +49 -0
- package/dist/components/MenuButton/index.d.ts +1 -1
- package/dist/components/MenuButton/index.js +3 -4
- package/dist/components/MenuButton/index.js.map +1 -1
- package/dist/components/MenuButton/index.tsx +67 -0
- package/dist/components/NoteTooltip/index.d.ts +1 -2
- package/dist/components/NoteTooltip/index.js +3 -7
- package/dist/components/NoteTooltip/index.js.map +1 -1
- package/dist/components/NoteTooltip/index.tsx +46 -0
- package/dist/components/NotesPanal/index.d.ts +1 -2
- package/dist/components/NotesPanal/index.js +3 -2
- package/dist/components/NotesPanal/index.js.map +1 -1
- package/dist/components/NotesPanal/index.tsx +34 -0
- package/dist/components/QualityMenu/index.d.ts +1 -2
- package/dist/components/QualityMenu/index.js +19 -28
- package/dist/components/QualityMenu/index.js.map +1 -1
- package/dist/components/QualityMenu/index.tsx +122 -0
- package/dist/components/Slider/index.d.ts +1 -1
- package/dist/components/Slider/index.js +2 -2
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/index.tsx +37 -0
- package/dist/components/SoftBuildersVideoPlayer/index.d.ts +1 -1
- package/dist/components/SoftBuildersVideoPlayer/index.js +3 -2
- package/dist/components/SoftBuildersVideoPlayer/index.js.map +1 -1
- package/dist/components/SoftBuildersVideoPlayer/index.tsx +108 -0
- package/dist/components/SubtitleMenu/index.d.ts +1 -2
- package/dist/components/SubtitleMenu/index.js +12 -21
- package/dist/components/SubtitleMenu/index.js.map +1 -1
- package/dist/components/SubtitleMenu/index.tsx +108 -0
- package/dist/components/TimeSlider/index.d.ts +1 -2
- package/dist/components/TimeSlider/index.js +10 -12
- package/dist/components/TimeSlider/index.js.map +1 -1
- package/dist/components/TimeSlider/index.tsx +107 -0
- package/dist/components/TimeSliderContainer/index.d.ts +1 -2
- package/dist/components/TimeSliderContainer/index.js +2 -7
- package/dist/components/TimeSliderContainer/index.js.map +1 -1
- package/dist/components/TimeSliderContainer/index.tsx +35 -0
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/Tooltip/index.js.map +1 -1
- package/dist/components/Tooltip/index.tsx +16 -0
- package/dist/components/VideoPlayerComponent/index.d.ts +1 -2
- package/dist/components/VideoPlayerComponent/index.js +5 -7
- package/dist/components/VideoPlayerComponent/index.js.map +1 -1
- package/dist/components/VideoPlayerComponent/index.tsx +244 -0
- package/dist/components/VideoPlayerComponent/provider.d.ts +1 -1
- package/dist/components/VideoPlayerComponent/provider.js +4 -3
- package/dist/components/VideoPlayerComponent/provider.js.map +1 -1
- package/dist/components/VideoPlayerComponent/provider.tsx +82 -0
- package/dist/components/VolumeSlider/index.d.ts +1 -2
- package/dist/components/VolumeSlider/index.js +3 -4
- package/dist/components/VolumeSlider/index.js.map +1 -1
- package/dist/components/VolumeSlider/index.tsx +52 -0
- package/dist/components/icons/BackwardIcon.d.ts +3 -0
- package/dist/components/icons/BackwardIcon.js +4 -0
- package/dist/components/icons/BackwardIcon.js.map +1 -0
- package/dist/components/icons/BackwardIcon.tsx +20 -0
- package/dist/components/icons/CheckedIcon.d.ts +3 -0
- package/dist/components/icons/CheckedIcon.js +4 -0
- package/dist/components/icons/CheckedIcon.js.map +1 -0
- package/dist/components/icons/CheckedIcon.tsx +20 -0
- package/dist/components/icons/ClosedNoteIcon.d.ts +3 -0
- package/dist/components/icons/ClosedNoteIcon.js +4 -0
- package/dist/components/icons/ClosedNoteIcon.js.map +1 -0
- package/dist/components/icons/ClosedNoteIcon.tsx +17 -0
- package/dist/components/icons/ForwardIcon.d.ts +3 -0
- package/dist/components/icons/ForwardIcon.js +4 -0
- package/dist/components/icons/ForwardIcon.js.map +1 -0
- package/dist/components/icons/ForwardIcon.tsx +20 -0
- package/dist/components/icons/FullScreenIcon.d.ts +3 -0
- package/dist/components/icons/FullScreenIcon.js +4 -0
- package/dist/components/icons/FullScreenIcon.js.map +1 -0
- package/dist/components/icons/FullScreenIcon.tsx +20 -0
- package/dist/components/icons/LeftArrowIcon.d.ts +3 -0
- package/dist/components/icons/LeftArrowIcon.js +4 -0
- package/dist/components/icons/LeftArrowIcon.js.map +1 -0
- package/dist/components/icons/LeftArrowIcon.tsx +20 -0
- package/dist/components/icons/MuteIcon.d.ts +3 -0
- package/dist/components/icons/MuteIcon.js +4 -0
- package/dist/components/icons/MuteIcon.js.map +1 -0
- package/dist/components/icons/MuteIcon.tsx +21 -0
- package/dist/components/icons/NoteIcon.d.ts +3 -0
- package/dist/components/icons/NoteIcon.js +4 -0
- package/dist/components/icons/NoteIcon.js.map +1 -0
- package/dist/components/icons/NoteIcon.tsx +17 -0
- package/dist/components/icons/OpenNoteIcon.d.ts +3 -0
- package/dist/components/icons/OpenNoteIcon.js +4 -0
- package/dist/components/icons/OpenNoteIcon.js.map +1 -0
- package/dist/components/icons/OpenNoteIcon.tsx +17 -0
- package/dist/components/icons/PauseIcon.d.ts +3 -0
- package/dist/components/icons/PauseIcon.js +4 -0
- package/dist/components/icons/PauseIcon.js.map +1 -0
- package/dist/components/icons/PauseIcon.tsx +14 -0
- package/dist/components/icons/PlayIcon.d.ts +3 -0
- package/dist/components/icons/PlayIcon.js +4 -0
- package/dist/components/icons/PlayIcon.js.map +1 -0
- package/dist/components/icons/PlayIcon.tsx +20 -0
- package/dist/components/icons/SettingsIcon.d.ts +3 -0
- package/dist/components/icons/SettingsIcon.js +4 -0
- package/dist/components/icons/SettingsIcon.js.map +1 -0
- package/dist/components/icons/SettingsIcon.tsx +17 -0
- package/dist/components/icons/SubtitlesIcon.d.ts +3 -0
- package/dist/components/icons/SubtitlesIcon.js +4 -0
- package/dist/components/icons/SubtitlesIcon.js.map +1 -0
- package/dist/components/icons/SubtitlesIcon.tsx +14 -0
- package/dist/components/icons/UnmuteIcon.d.ts +3 -0
- package/dist/components/icons/UnmuteIcon.js +4 -0
- package/dist/components/icons/UnmuteIcon.js.map +1 -0
- package/dist/components/icons/UnmuteIcon.tsx +17 -0
- package/dist/components/icons/index.d.ts +14 -0
- package/dist/components/icons/index.js +15 -0
- package/dist/components/icons/index.js.map +1 -0
- package/dist/components/icons/index.ts +14 -0
- package/dist/images/index.d.ts +14 -14
- package/dist/images/index.js +14 -14
- package/dist/images/index.js.map +1 -1
- package/dist/index.css +663 -0
- package/dist/index.d.mts +49 -0
- package/dist/index.mjs +1383 -0
- package/package.json +9 -4
@@ -0,0 +1,122 @@
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
2
|
+
import MenuButton from "../MenuButton";
|
3
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
4
|
+
|
5
|
+
import { SoftBuildersVideoPlayerSource } from "../../types";
|
6
|
+
import { CheckedIcon, LeftArrowIcon, SettingsIcon } from "../../images";
|
7
|
+
|
8
|
+
type QualityOptionProps = {
|
9
|
+
isSelected: boolean;
|
10
|
+
quality: SoftBuildersVideoPlayerSource;
|
11
|
+
onClick: () => void;
|
12
|
+
};
|
13
|
+
const QualityOption = ({
|
14
|
+
isSelected,
|
15
|
+
quality,
|
16
|
+
onClick,
|
17
|
+
}: QualityOptionProps) => {
|
18
|
+
return (
|
19
|
+
<button className="hover:sb-text-orange-500 sb-p-2" onClick={onClick}>
|
20
|
+
<div className="sb-grid sb-grid-cols-12 sb-items-center sb-gap-2">
|
21
|
+
<div className="sb-col-span-3">
|
22
|
+
{isSelected ? <CheckedIcon className="sb-w-5 sb-h-5" /> : <div></div>}
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<p className="sb-text-left sb-col-span-9">{quality.label}</p>
|
26
|
+
</div>
|
27
|
+
</button>
|
28
|
+
);
|
29
|
+
};
|
30
|
+
|
31
|
+
type QualityMenuProps = {};
|
32
|
+
|
33
|
+
const QualityMenu = ({}: QualityMenuProps) => {
|
34
|
+
const { player } = useSoftBuildersVideoPlayerContext();
|
35
|
+
|
36
|
+
const [closeMenuFunction, setCloseMenuFunction] = useState<
|
37
|
+
Function | undefined
|
38
|
+
>(undefined);
|
39
|
+
|
40
|
+
const [qualities, setQualities] = useState<SoftBuildersVideoPlayerSource[]>(
|
41
|
+
[]
|
42
|
+
);
|
43
|
+
|
44
|
+
const [currentQualitySrc, setCurrentQualitySrc] = useState<
|
45
|
+
string | undefined
|
46
|
+
>(undefined);
|
47
|
+
|
48
|
+
useEffect(() => {
|
49
|
+
if (player) {
|
50
|
+
const sources = player.currentSources();
|
51
|
+
|
52
|
+
const qs: SoftBuildersVideoPlayerSource[] = JSON.parse(
|
53
|
+
JSON.stringify(sources)
|
54
|
+
);
|
55
|
+
|
56
|
+
setQualities(qs);
|
57
|
+
|
58
|
+
const source = player.currentSource();
|
59
|
+
const quality: SoftBuildersVideoPlayerSource = JSON.parse(
|
60
|
+
JSON.stringify(source)
|
61
|
+
);
|
62
|
+
|
63
|
+
setCurrentQualitySrc(quality.src);
|
64
|
+
}
|
65
|
+
}, [player]);
|
66
|
+
|
67
|
+
return (
|
68
|
+
<MenuButton
|
69
|
+
buttonContent={<SettingsIcon className="sb-w-3 sb-h-3" />}
|
70
|
+
menuContent={
|
71
|
+
<div className="sb-rounded-md sb-bg-[#303030] sb-bg-opacity-50 sb-py-5 sb-w-[150px]">
|
72
|
+
<div className="sb-flex sb-flex-col sb-gap-3">
|
73
|
+
<div className="sb-px-5 sb-flex sb-flex-row sb-gap-3 sb-items-start">
|
74
|
+
<button
|
75
|
+
onClick={() => {
|
76
|
+
if (closeMenuFunction) {
|
77
|
+
closeMenuFunction();
|
78
|
+
}
|
79
|
+
}}
|
80
|
+
className="hover:sb-scale-150"
|
81
|
+
>
|
82
|
+
<LeftArrowIcon className="sb-w-3 sb-h-3" />
|
83
|
+
</button>
|
84
|
+
<h3>Quality</h3>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div className="sb-w-full sb-h-[.1px] sb-bg-[#AAAAAA] sb-bg-opacity-70" />
|
88
|
+
|
89
|
+
<div className="sb-px-5 sb-flex sb-flex-col sb-gap-3 sb-items-start">
|
90
|
+
{qualities.map((q, i) => {
|
91
|
+
return (
|
92
|
+
<QualityOption
|
93
|
+
key={`quality-${q.label}-${i}`}
|
94
|
+
isSelected={currentQualitySrc === q.src}
|
95
|
+
quality={q}
|
96
|
+
onClick={() => {
|
97
|
+
const source = qualities.find(
|
98
|
+
(_q) => q.label == _q.label
|
99
|
+
);
|
100
|
+
if (source && source.src != currentQualitySrc) {
|
101
|
+
player?.src(source.src);
|
102
|
+
const currentTime = player?.currentTime();
|
103
|
+
setCurrentQualitySrc(source.src);
|
104
|
+
player?.currentTime(currentTime);
|
105
|
+
player?.play();
|
106
|
+
}
|
107
|
+
}}
|
108
|
+
/>
|
109
|
+
);
|
110
|
+
})}
|
111
|
+
</div>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
}
|
115
|
+
close={(fn: Function) => {
|
116
|
+
setCloseMenuFunction(() => fn);
|
117
|
+
}}
|
118
|
+
/>
|
119
|
+
);
|
120
|
+
};
|
121
|
+
|
122
|
+
export default QualityMenu;
|
@@ -6,5 +6,5 @@ type Props = {
|
|
6
6
|
min?: number;
|
7
7
|
max?: number;
|
8
8
|
} & InputHTMLAttributes<HTMLInputElement>;
|
9
|
-
declare const Slider: ({ value, handleValueChange, min, max, ...rest }: Props) =>
|
9
|
+
declare const Slider: ({ value, handleValueChange, min, max, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
10
10
|
export default Slider;
|
@@ -9,11 +9,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
-
import
|
12
|
+
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 } = _a, rest = __rest(_a, ["value", "handleValueChange", "min", "max"]);
|
16
|
-
return (
|
16
|
+
return (_jsx("input", Object.assign({ type: "range", min: min, max: max, value: value, onChange: handleValueChange, 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
17
|
rest.className, style: {
|
18
18
|
background: `linear-gradient(to right, #f97316 ${value}%, #30303070 ${value}%)`,
|
19
19
|
} }, rest)));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Slider/index.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Slider/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,aAAa,CAAC;AASrB,MAAM,MAAM,GAAG,CAAC,EAMR,EAAE,EAAE;QANI,EACd,KAAK,EACL,iBAAiB,EACjB,GAAG,GAAG,CAAC,EACP,GAAG,GAAG,GAAG,OAEH,EADH,IAAI,cALO,4CAMf,CADQ;IAEP,OAAO,CACL,8BACE,IAAI,EAAC,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EACP,yIAAyI;YACzI,IAAI,CAAC,SAAS,EAEhB,KAAK,EAAE;YACL,UAAU,EAAE,qCAAqC,KAAK,gBAAgB,KAAK,IAAI;SAChF,IACG,IAAI,EACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import React, { InputHTMLAttributes, SetStateAction, useState } from "react";
|
2
|
+
import "./style.css";
|
3
|
+
|
4
|
+
type Props = {
|
5
|
+
value: number;
|
6
|
+
handleValueChange: React.ChangeEventHandler<HTMLInputElement>;
|
7
|
+
min?: number;
|
8
|
+
max?: number;
|
9
|
+
} & InputHTMLAttributes<HTMLInputElement>;
|
10
|
+
|
11
|
+
const Slider = ({
|
12
|
+
value,
|
13
|
+
handleValueChange,
|
14
|
+
min = 0,
|
15
|
+
max = 100,
|
16
|
+
...rest
|
17
|
+
}: Props) => {
|
18
|
+
return (
|
19
|
+
<input
|
20
|
+
type="range"
|
21
|
+
min={min}
|
22
|
+
max={max}
|
23
|
+
value={value}
|
24
|
+
onChange={handleValueChange}
|
25
|
+
className={
|
26
|
+
"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
|
+
rest.className
|
28
|
+
}
|
29
|
+
style={{
|
30
|
+
background: `linear-gradient(to right, #f97316 ${value}%, #30303070 ${value}%)`,
|
31
|
+
}}
|
32
|
+
{...rest}
|
33
|
+
/>
|
34
|
+
);
|
35
|
+
};
|
36
|
+
|
37
|
+
export default Slider;
|
@@ -9,5 +9,5 @@ export type Props<T = any> = {
|
|
9
9
|
onPlay?: (time: number) => void;
|
10
10
|
onPause?: (time: number) => void;
|
11
11
|
};
|
12
|
-
declare const SoftBuildersVideoPlayer: React.MemoExoticComponent<(<T>({ options, notes, chapters, startTime, handleSaveNoteAction, onPlay, onPause, }: Props<T>) =>
|
12
|
+
declare const SoftBuildersVideoPlayer: React.MemoExoticComponent<(<T>({ options, notes, chapters, startTime, handleSaveNoteAction, onPlay, onPause, }: Props<T>) => import("react/jsx-runtime").JSX.Element)>;
|
13
13
|
export default SoftBuildersVideoPlayer;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { memo, useEffect, useState } from "react";
|
2
3
|
import VideoPlayerComponent from "../VideoPlayerComponent";
|
3
4
|
import { convertSRTtoVTT } from "../../utils";
|
4
5
|
const DEFAULT_OPTIONS = {
|
@@ -43,7 +44,7 @@ const Component = ({ options, notes, chapters, startTime = 0, handleSaveNoteActi
|
|
43
44
|
getTracks();
|
44
45
|
}, [options.tracks]);
|
45
46
|
const id = (Date.now() + Math.random() * 100).toString();
|
46
|
-
return (
|
47
|
+
return (_jsx(VideoPlayerComponent, { id: id, chapters: chapters, options: Object.assign(Object.assign({}, options), { tracks }), notes: notes, startTime: startTime, handleSaveNoteAction: handleSaveNoteAction, onPause: onPause, onPlay: onPlay }));
|
47
48
|
};
|
48
49
|
const SoftBuildersVideoPlayer = memo(Component, (prevProps, nextProps) => {
|
49
50
|
return (prevProps.options === nextProps.options &&
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SoftBuildersVideoPlayer/index.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SoftBuildersVideoPlayer/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAO3D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,eAAe,GAAmC;IACtD,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;CACX,CAAC;AAYF,MAAM,SAAS,GAAG,CAAK,EACrB,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,CAAC,EACb,oBAAoB,EACpB,MAAM,EACN,OAAO,GACE,EAAE,EAAE;IACb,OAAO,GAAG,gCACL,OAAO,KACV,UAAU,EAAE,IAAI,EAChB,iBAAiB,EAAE,CAAC,EACpB,UAAU,EAAE;YACV,YAAY,EAAE,MAAM;SACrB,GACK,CAAC;IAET,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS;QAChC,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;IAC9C,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS;QAChC,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAC,QAAQ,CAAC;IAC9C,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,CAAC,K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AAO,kCAAO,OAAO,KAAE,MAAM,KAC7B,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,oBAAoB,EAAE,oBAAoB,EAC1C,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;IACvE,OAAO,CACL,SAAS,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO;QACvC,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC,KAAK;QACnC,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ;QACzC,SAAS,CAAC,SAAS,KAAK,SAAS,CAAC,SAAS,CAC5C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,uBAAuB,CAAC"}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
import React, { memo, useEffect, useState } from "react";
|
2
|
+
import VideoPlayerComponent from "../VideoPlayerComponent";
|
3
|
+
import {
|
4
|
+
SoftBuildersVideoPlayerChapter,
|
5
|
+
SoftBuildersVideoPlayerNote,
|
6
|
+
SoftBuildersVideoPlayerOptions,
|
7
|
+
SoftBuildersVideoPlayerTrack,
|
8
|
+
} from "../../types";
|
9
|
+
import { convertSRTtoVTT } from "../../utils";
|
10
|
+
|
11
|
+
const DEFAULT_OPTIONS: SoftBuildersVideoPlayerOptions = {
|
12
|
+
autoplay: false,
|
13
|
+
controls: true,
|
14
|
+
fluid: true,
|
15
|
+
muted: true,
|
16
|
+
height: 420,
|
17
|
+
width: 720,
|
18
|
+
sources: [],
|
19
|
+
tracks: [],
|
20
|
+
};
|
21
|
+
|
22
|
+
export type Props<T = any> = {
|
23
|
+
options: SoftBuildersVideoPlayerOptions;
|
24
|
+
notes: SoftBuildersVideoPlayerNote[];
|
25
|
+
chapters: SoftBuildersVideoPlayerChapter[];
|
26
|
+
startTime?: number;
|
27
|
+
handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
|
28
|
+
onPlay?: (time: number) => void;
|
29
|
+
onPause?: (time: number) => void;
|
30
|
+
};
|
31
|
+
|
32
|
+
const Component = <T,>({
|
33
|
+
options,
|
34
|
+
notes,
|
35
|
+
chapters,
|
36
|
+
startTime = 0,
|
37
|
+
handleSaveNoteAction,
|
38
|
+
onPlay,
|
39
|
+
onPause,
|
40
|
+
}: Props<T>) => {
|
41
|
+
options = {
|
42
|
+
...options,
|
43
|
+
responsive: true,
|
44
|
+
inactivityTimeout: 0,
|
45
|
+
fullscreen: {
|
46
|
+
navigationUI: "hide",
|
47
|
+
},
|
48
|
+
} as any;
|
49
|
+
|
50
|
+
if (options.autoplay === undefined)
|
51
|
+
options.autoplay = DEFAULT_OPTIONS.autoplay;
|
52
|
+
if (options.controls === undefined)
|
53
|
+
options.controls = DEFAULT_OPTIONS.controls;
|
54
|
+
if (options.fluid === undefined) options.fluid = DEFAULT_OPTIONS.fluid;
|
55
|
+
if (options.muted === undefined) options.muted = DEFAULT_OPTIONS.muted;
|
56
|
+
if (options.height === undefined) options.height = DEFAULT_OPTIONS.height;
|
57
|
+
if (options.width === undefined) options.width = DEFAULT_OPTIONS.width;
|
58
|
+
|
59
|
+
const [tracks, setTracks] = useState<SoftBuildersVideoPlayerTrack[]>([]);
|
60
|
+
|
61
|
+
useEffect(() => {
|
62
|
+
const getTracks = async () => {
|
63
|
+
const newTracks: SoftBuildersVideoPlayerTrack[] = [];
|
64
|
+
for (const [i, s] of options.tracks.entries()) {
|
65
|
+
let src = s.src;
|
66
|
+
|
67
|
+
if (s.memeType == "text/srt") {
|
68
|
+
src = await convertSRTtoVTT(s.src);
|
69
|
+
}
|
70
|
+
|
71
|
+
newTracks.push({
|
72
|
+
...s,
|
73
|
+
src,
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
setTracks(newTracks);
|
78
|
+
};
|
79
|
+
|
80
|
+
getTracks();
|
81
|
+
}, [options.tracks]);
|
82
|
+
|
83
|
+
const id = (Date.now() + Math.random() * 100).toString();
|
84
|
+
|
85
|
+
return (
|
86
|
+
<VideoPlayerComponent
|
87
|
+
id={id}
|
88
|
+
chapters={chapters}
|
89
|
+
options={{ ...options, tracks }}
|
90
|
+
notes={notes}
|
91
|
+
startTime={startTime}
|
92
|
+
handleSaveNoteAction={handleSaveNoteAction}
|
93
|
+
onPause={onPause}
|
94
|
+
onPlay={onPlay}
|
95
|
+
/>
|
96
|
+
);
|
97
|
+
};
|
98
|
+
|
99
|
+
const SoftBuildersVideoPlayer = memo(Component, (prevProps, nextProps) => {
|
100
|
+
return (
|
101
|
+
prevProps.options === nextProps.options &&
|
102
|
+
prevProps.notes === nextProps.notes &&
|
103
|
+
prevProps.chapters === nextProps.chapters &&
|
104
|
+
prevProps.startTime === nextProps.startTime
|
105
|
+
);
|
106
|
+
});
|
107
|
+
|
108
|
+
export default SoftBuildersVideoPlayer;
|
@@ -1,12 +1,10 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useEffect, useState } from "react";
|
2
3
|
import MenuButton from "../MenuButton";
|
3
4
|
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
4
5
|
import { CheckedIcon, LeftArrowIcon, SubtitlesIcon } from "../../images";
|
5
6
|
const SubtitleOption = ({ isSelected, subtitle, onClick, }) => {
|
6
|
-
return (
|
7
|
-
React.createElement("div", { className: "sb-grid sb-grid-cols-12 sb-items-center sb-gap-2" },
|
8
|
-
React.createElement("div", { className: "sb-col-span-3" }, isSelected ? React.createElement(CheckedIcon, { className: "sb-w-5 sb-h-5" }) : React.createElement("div", null)),
|
9
|
-
React.createElement("p", { className: "sb-text-left sb-col-span-9" }, subtitle.label))));
|
7
|
+
return (_jsx("button", { className: "hover:sb-text-orange-500 sb-p-2", onClick: onClick, children: _jsxs("div", { className: "sb-grid sb-grid-cols-12 sb-items-center sb-gap-2", children: [_jsx("div", { className: "sb-col-span-3", children: isSelected ? _jsx(CheckedIcon, { className: "sb-w-5 sb-h-5" }) : _jsx("div", {}) }), _jsx("p", { className: "sb-text-left sb-col-span-9", children: subtitle.label })] }) }));
|
10
8
|
};
|
11
9
|
const SubtitleMenu = ({}) => {
|
12
10
|
const { player } = useSoftBuildersVideoPlayerContext();
|
@@ -31,22 +29,15 @@ const SubtitleMenu = ({}) => {
|
|
31
29
|
setSubtitles(textTracks);
|
32
30
|
}
|
33
31
|
}, [player]);
|
34
|
-
return (
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
React.createElement("h3", null, "Subtitle")),
|
44
|
-
React.createElement("div", { className: "sb-w-full sb-h-[.1px] sb-bg-[#AAAAAA] sb-bg-opacity-70" }),
|
45
|
-
React.createElement("div", { className: "sb-px-5 sb-flex sb-flex-col sb-gap-3 sb-items-start" }, subtitles.map((q, i) => {
|
46
|
-
return (React.createElement(SubtitleOption, { key: `subtitle-${q.label}-${i}`, isSelected: q.mode === "showing", subtitle: q, onClick: () => {
|
47
|
-
handleSelectSubtitle(q);
|
48
|
-
} }));
|
49
|
-
})))), close: (fn) => {
|
32
|
+
return (_jsx(MenuButton, { buttonContent: _jsx(SubtitlesIcon, { className: "sb-w-3 sb-h-3" }), menuContent: _jsx("div", { className: "sb-rounded-md sb-bg-[#303030] sb-bg-opacity-50 sb-py-5 sb-w-[150px]", children: _jsxs("div", { className: "sb-flex sb-flex-col sb-gap-3", children: [_jsxs("div", { className: "sb-px-5 sb-flex sb-flex-row sb-gap-3 sb-items-start", children: [_jsx("button", { onClick: () => {
|
33
|
+
if (closeMenuFunction) {
|
34
|
+
closeMenuFunction();
|
35
|
+
}
|
36
|
+
}, className: "hover:sb-scale-150", children: _jsx(LeftArrowIcon, { className: "sb-w-3 sb-h-3" }) }), _jsx("h3", { children: "Subtitle" })] }), _jsx("div", { className: "sb-w-full sb-h-[.1px] sb-bg-[#AAAAAA] sb-bg-opacity-70" }), _jsx("div", { className: "sb-px-5 sb-flex sb-flex-col sb-gap-3 sb-items-start", children: subtitles.map((q, i) => {
|
37
|
+
return (_jsx(SubtitleOption, { isSelected: q.mode === "showing", subtitle: q, onClick: () => {
|
38
|
+
handleSelectSubtitle(q);
|
39
|
+
} }, `subtitle-${q.label}-${i}`));
|
40
|
+
}) })] }) }), close: (fn) => {
|
50
41
|
setCloseMenuFunction(() => fn);
|
51
42
|
} }));
|
52
43
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SubtitleMenu/index.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SubtitleMenu/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAe,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQzE,MAAM,cAAc,GAAG,CAAC,EACtB,UAAU,EACV,QAAQ,EACR,OAAO,GACa,EAAE,EAAE;IACxB,OAAO,CACL,iBAAQ,SAAS,EAAC,iCAAiC,EAAC,OAAO,EAAE,OAAO,YAClE,eAAK,SAAS,EAAC,kDAAkD,aAC/D,cAAK,SAAS,EAAC,eAAe,YAC3B,UAAU,CAAC,CAAC,CAAC,KAAC,WAAW,IAAC,SAAS,EAAC,eAAe,GAAG,CAAC,CAAC,CAAC,eAAW,GACjE,EAEN,YAAG,SAAS,EAAC,4BAA4B,YAAE,QAAQ,CAAC,KAAK,GAAK,IAC1D,GACC,CACV,CAAC;AACJ,CAAC,CAAC;AAIF,MAAM,YAAY,GAAG,CAAC,EAAqB,EAAE,EAAE;IAC7C,MAAM,EAAE,MAAM,EAAE,GAA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pC,EACT,oCAAiB,IACb,EAEN,cAAK,SAAS,EAAC,wDAAwD,GAAG,EAE1E,cAAK,SAAS,EAAC,sDAAsD,YAClE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;4BACtB,OAAO,CACL,KAAC,cAAc,IAEb,UAAU,EAAE,CAAC,CAAC,IAAI,KAAK,SAAS,EAChC,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,GAAG,EAAE;oCACZ,oBAAoB,CAAC,CAAC,CAAC,CAAC;gCAC1B,CAAC,IALI,YAAY,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,CAM/B,CACH,CAAC;wBACJ,CAAC,CAAC,GACE,IACF,GACF,EAER,KAAK,EAAE,CAAC,EAAY,EAAE,EAAE;YACtB,oBAAoB,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
@@ -0,0 +1,108 @@
|
|
1
|
+
import React, { useCallback, useEffect, useState } from "react";
|
2
|
+
import MenuButton from "../MenuButton";
|
3
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
4
|
+
import { CheckedIcon, LeftArrowIcon, SubtitlesIcon } from "../../images";
|
5
|
+
|
6
|
+
|
7
|
+
type SubtitleOptionProps = {
|
8
|
+
isSelected: boolean;
|
9
|
+
subtitle: TextTrack;
|
10
|
+
onClick: () => void;
|
11
|
+
};
|
12
|
+
const SubtitleOption = ({
|
13
|
+
isSelected,
|
14
|
+
subtitle,
|
15
|
+
onClick,
|
16
|
+
}: SubtitleOptionProps) => {
|
17
|
+
return (
|
18
|
+
<button className="hover:sb-text-orange-500 sb-p-2" onClick={onClick}>
|
19
|
+
<div className="sb-grid sb-grid-cols-12 sb-items-center sb-gap-2">
|
20
|
+
<div className="sb-col-span-3">
|
21
|
+
{isSelected ? <CheckedIcon className="sb-w-5 sb-h-5" /> : <div></div>}
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<p className="sb-text-left sb-col-span-9">{subtitle.label}</p>
|
25
|
+
</div>
|
26
|
+
</button>
|
27
|
+
);
|
28
|
+
};
|
29
|
+
|
30
|
+
type SubtitleMenuProps = {};
|
31
|
+
|
32
|
+
const SubtitleMenu = ({}: SubtitleMenuProps) => {
|
33
|
+
const { player } = useSoftBuildersVideoPlayerContext();
|
34
|
+
|
35
|
+
const [closeMenuFunction, setCloseMenuFunction] = useState<
|
36
|
+
Function | undefined
|
37
|
+
>(undefined);
|
38
|
+
|
39
|
+
const [subtitles, setSubtitles] = useState<TextTrack[]>([]);
|
40
|
+
|
41
|
+
const handleSelectSubtitle = (textTrack: TextTrack) => {
|
42
|
+
const newSubtitles = subtitles.map((s) => {
|
43
|
+
if (s.label === textTrack.label) {
|
44
|
+
s.mode = "showing";
|
45
|
+
} else {
|
46
|
+
s.mode = "disabled";
|
47
|
+
}
|
48
|
+
return s;
|
49
|
+
});
|
50
|
+
|
51
|
+
setSubtitles(newSubtitles);
|
52
|
+
};
|
53
|
+
|
54
|
+
useEffect(() => {
|
55
|
+
if (player) {
|
56
|
+
const textTracks: TextTrack[] = (player as any).textTracks()?.tracks_;
|
57
|
+
|
58
|
+
setSubtitles(textTracks);
|
59
|
+
}
|
60
|
+
}, [player]);
|
61
|
+
|
62
|
+
return (
|
63
|
+
<MenuButton
|
64
|
+
buttonContent={<SubtitlesIcon className="sb-w-3 sb-h-3" />}
|
65
|
+
menuContent={
|
66
|
+
<div className="sb-rounded-md sb-bg-[#303030] sb-bg-opacity-50 sb-py-5 sb-w-[150px]">
|
67
|
+
<div className="sb-flex sb-flex-col sb-gap-3">
|
68
|
+
<div className="sb-px-5 sb-flex sb-flex-row sb-gap-3 sb-items-start">
|
69
|
+
<button
|
70
|
+
onClick={() => {
|
71
|
+
if (closeMenuFunction) {
|
72
|
+
closeMenuFunction();
|
73
|
+
}
|
74
|
+
}}
|
75
|
+
className="hover:sb-scale-150"
|
76
|
+
>
|
77
|
+
<LeftArrowIcon className="sb-w-3 sb-h-3" />
|
78
|
+
</button>
|
79
|
+
<h3>Subtitle</h3>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<div className="sb-w-full sb-h-[.1px] sb-bg-[#AAAAAA] sb-bg-opacity-70" />
|
83
|
+
|
84
|
+
<div className="sb-px-5 sb-flex sb-flex-col sb-gap-3 sb-items-start">
|
85
|
+
{subtitles.map((q, i) => {
|
86
|
+
return (
|
87
|
+
<SubtitleOption
|
88
|
+
key={`subtitle-${q.label}-${i}`}
|
89
|
+
isSelected={q.mode === "showing"}
|
90
|
+
subtitle={q}
|
91
|
+
onClick={() => {
|
92
|
+
handleSelectSubtitle(q);
|
93
|
+
}}
|
94
|
+
/>
|
95
|
+
);
|
96
|
+
})}
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
}
|
101
|
+
close={(fn: Function) => {
|
102
|
+
setCloseMenuFunction(() => fn);
|
103
|
+
}}
|
104
|
+
/>
|
105
|
+
);
|
106
|
+
};
|
107
|
+
|
108
|
+
export default SubtitleMenu;
|
@@ -1,7 +1,6 @@
|
|
1
|
-
import React from "react";
|
2
1
|
import { SoftBuildersVideoPlayerChapter } from "../../types";
|
3
2
|
type Props = {
|
4
3
|
chapters: SoftBuildersVideoPlayerChapter[];
|
5
4
|
};
|
6
|
-
declare const TimeSlider: ({ chapters }: Props) =>
|
5
|
+
declare const TimeSlider: ({ chapters }: Props) => import("react/jsx-runtime").JSX.Element;
|
7
6
|
export default TimeSlider;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useEffect, useState } from "react";
|
2
3
|
import Slider from "../Slider";
|
3
4
|
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
4
5
|
const MIN = 0, MAX = 100;
|
@@ -40,13 +41,10 @@ const TimeSlider = ({ chapters }) => {
|
|
40
41
|
arr.push(`black 100%`);
|
41
42
|
setMaskCuttes(arr.toString());
|
42
43
|
}, [chapters, duration]);
|
43
|
-
return (
|
44
|
-
|
45
|
-
|
46
|
-
background:
|
47
|
-
} })),
|
48
|
-
React.createElement("div", { className: "sb-absolute sb-top-0 sb-left-0 sb-w-full sb-h-2 sb-bg-slate-400 sb-rounded-md", style: {
|
49
|
-
background: `
|
44
|
+
return (_jsxs("div", { className: " sb-w-full sb-h-2 sb-flex sb-items-center sb-justify-center", children: [_jsx("div", { className: "sb-absolute sb-top-0 sb-left-0 sb-w-full sb-z-10", children: _jsx(Slider, { value: timeSlider, handleValueChange: handleValueChange, min: MIN, max: MAX, style: {
|
45
|
+
background: "transparent",
|
46
|
+
} }) }), _jsx("div", { className: "sb-absolute sb-top-0 sb-left-0 sb-w-full sb-h-2 sb-bg-slate-400 sb-rounded-md", style: {
|
47
|
+
background: `
|
50
48
|
linear-gradient(to right,
|
51
49
|
#f97316 0%,
|
52
50
|
#f97316 ${timeSlider}%,
|
@@ -56,14 +54,14 @@ const TimeSlider = ({ chapters }) => {
|
|
56
54
|
#30303030 100%
|
57
55
|
)
|
58
56
|
`,
|
59
|
-
|
57
|
+
maskImage: `
|
60
58
|
linear-gradient(to right,
|
61
59
|
${maskCuttes}
|
62
60
|
)
|
63
61
|
`,
|
64
|
-
|
65
|
-
|
66
|
-
|
62
|
+
maskSize: "100% 100%",
|
63
|
+
maskRepeat: "no-repeat",
|
64
|
+
} })] }));
|
67
65
|
};
|
68
66
|
export default TimeSlider;
|
69
67
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/TimeSlider/index.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/TimeSlider/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;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