softbuilders-react-video-player 1.0.6 → 1.0.7
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
@@ -5,5 +5,5 @@ type Props = {
|
|
5
5
|
isPaused: boolean;
|
6
6
|
setIsPaused: React.Dispatch<React.SetStateAction<boolean>>;
|
7
7
|
};
|
8
|
-
declare const BigPlayButton: ({ player, isPaused, setIsPaused }: Props) =>
|
8
|
+
declare const BigPlayButton: ({ player, isPaused, setIsPaused }: Props) => import("react/jsx-runtime").JSX.Element;
|
9
9
|
export default BigPlayButton;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { PauseIcon, PlayIcon } from "../../images";
|
3
3
|
const BigPlayButton = ({ player, isPaused, setIsPaused }) => {
|
4
4
|
const togglePlay = () => {
|
@@ -8,8 +8,7 @@ const BigPlayButton = ({ player, isPaused, setIsPaused }) => {
|
|
8
8
|
player === null || player === void 0 ? void 0 : player.pause();
|
9
9
|
setIsPaused(!isPaused);
|
10
10
|
};
|
11
|
-
return (
|
12
|
-
React.createElement("div", { className: "sb-w-16 sb-h-16 sb-rounded-full sb-bg-white/30 sb-backdrop-blur-lg sb-flex sb-items-center sb-justify-center " }, isPaused ? (React.createElement(PlayIcon, { className: "sb-w-4 sb-h-4" })) : (React.createElement(PauseIcon, { className: "sb-w-4 sb-h-4" })))));
|
11
|
+
return (_jsx("button", { onClick: togglePlay, children: _jsx("div", { className: "sb-w-16 sb-h-16 sb-rounded-full sb-bg-white/30 sb-backdrop-blur-lg sb-flex sb-items-center sb-justify-center ", children: isPaused ? (_jsx(PlayIcon, { className: "sb-w-4 sb-h-4" })) : (_jsx(PauseIcon, { className: "sb-w-4 sb-h-4" })) }) }));
|
13
12
|
};
|
14
13
|
export default BigPlayButton;
|
15
14
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/BigPlayButton/index.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/BigPlayButton/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAOnD,MAAM,aAAa,GAAG,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAS,EAAE,EAAE;IACjE,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,IAAI,QAAQ;YAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,EAAE,CAAC;;YACxB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,EAAE,CAAC;QAErB,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC,CAAC;IAEF,OAAO,CACL,iBAAQ,OAAO,EAAE,UAAU,YACzB,cAAK,SAAS,EAAC,+GAA+G,YAC3H,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,QAAQ,IAAC,SAAS,EAAC,eAAe,GAAG,CACvC,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,SAAS,EAAC,eAAe,GAAG,CACxC,GACG,GACC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import Player from "video.js/dist/types/player";
|
3
|
+
import { PauseIcon, PlayIcon } from "../../images";
|
4
|
+
|
5
|
+
type Props = {
|
6
|
+
player: Player | undefined;
|
7
|
+
isPaused: boolean;
|
8
|
+
setIsPaused: React.Dispatch<React.SetStateAction<boolean>>;
|
9
|
+
};
|
10
|
+
const BigPlayButton = ({ player, isPaused, setIsPaused }: Props) => {
|
11
|
+
const togglePlay = () => {
|
12
|
+
if (isPaused) player?.play();
|
13
|
+
else player?.pause();
|
14
|
+
|
15
|
+
setIsPaused(!isPaused);
|
16
|
+
};
|
17
|
+
|
18
|
+
return (
|
19
|
+
<button onClick={togglePlay}>
|
20
|
+
<div className="sb-w-16 sb-h-16 sb-rounded-full sb-bg-white/30 sb-backdrop-blur-lg sb-flex sb-items-center sb-justify-center ">
|
21
|
+
{isPaused ? (
|
22
|
+
<PlayIcon className="sb-w-4 sb-h-4" />
|
23
|
+
) : (
|
24
|
+
<PauseIcon className="sb-w-4 sb-h-4" />
|
25
|
+
)}
|
26
|
+
</div>
|
27
|
+
</button>
|
28
|
+
);
|
29
|
+
};
|
30
|
+
|
31
|
+
export default BigPlayButton;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useEffect } from "react";
|
2
3
|
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
3
4
|
const BufferTracker = () => {
|
4
5
|
const { player, setDownloadedBufferTimeufferTime } = useSoftBuildersVideoPlayerContext();
|
@@ -10,7 +11,7 @@ const BufferTracker = () => {
|
|
10
11
|
// Cleanup function to clear the interval
|
11
12
|
return () => clearInterval(intervalId);
|
12
13
|
}, [player]);
|
13
|
-
return
|
14
|
+
return _jsx(_Fragment, {});
|
14
15
|
};
|
15
16
|
export default BufferTracker;
|
16
17
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/BufferTracker/index.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/BufferTracker/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AAErF,MAAM,aAAa,GAAG,GAAG,EAAE;IACzB,MAAM,EAAE,MAAM,EAAE,gCAAgC,EAAE,GAChD,iCAAiC,EAAE,CAAC;IAEtC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;YAClC,IAAI,MAAM;gBAAE,gCAAgC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QACrE,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,yCAAyC;QACzC,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACb,OAAO,mBAAK,CAAC;AACf,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import React, { useEffect } from "react";
|
2
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
3
|
+
|
4
|
+
const BufferTracker = () => {
|
5
|
+
const { player, setDownloadedBufferTimeufferTime } =
|
6
|
+
useSoftBuildersVideoPlayerContext();
|
7
|
+
|
8
|
+
useEffect(() => {
|
9
|
+
const intervalId = setInterval(() => {
|
10
|
+
if (player) setDownloadedBufferTimeufferTime(player.bufferedEnd());
|
11
|
+
}, 1000);
|
12
|
+
|
13
|
+
// Cleanup function to clear the interval
|
14
|
+
return () => clearInterval(intervalId);
|
15
|
+
}, [player]);
|
16
|
+
return <></>;
|
17
|
+
};
|
18
|
+
|
19
|
+
export default BufferTracker;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import React from "react";
|
2
1
|
import { SoftBuildersVideoPlayerChapter } from "../../types";
|
3
2
|
type Chapter = SoftBuildersVideoPlayerChapter & {
|
4
3
|
startPercentage: number;
|
@@ -7,5 +6,5 @@ type Chapter = SoftBuildersVideoPlayerChapter & {
|
|
7
6
|
type Props = {
|
8
7
|
chapter: Chapter;
|
9
8
|
};
|
10
|
-
declare const ChapterTooltip: ({ chapter }: Props) =>
|
9
|
+
declare const ChapterTooltip: ({ chapter }: Props) => import("react/jsx-runtime").JSX.Element;
|
11
10
|
export default ChapterTooltip;
|
@@ -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 Tooltip from "../Tooltip";
|
3
4
|
import { durationFormater } from "../../utils";
|
4
5
|
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
@@ -17,20 +18,10 @@ const ChapterTooltip = ({ chapter }) => {
|
|
17
18
|
const handleClickChapter = () => {
|
18
19
|
player === null || player === void 0 ? void 0 : player.currentTime(chapter.startTime);
|
19
20
|
};
|
20
|
-
return (
|
21
|
+
return (_jsx("div", { id: `ii-section-${chapter.title}`, className: "sb-flex sb-items-center sb-w-full sb-h-full sb-absolute sb-z-20", style: {
|
21
22
|
left: `${chapter.startPercentage}%`,
|
22
23
|
width: `${chapter.endPercentage - chapter.startPercentage}%`,
|
23
|
-
}, onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false) },
|
24
|
-
React.createElement("button", { id: `section-${chapter.title}`, className: "sb-h-full sb-w-full", onClick: handleClickChapter },
|
25
|
-
React.createElement("div", { className: "sb-relative sb-flex sb-h-full sb-w-full sb-justify-between sb-items-center" },
|
26
|
-
React.createElement(Tooltip, { open: open },
|
27
|
-
React.createElement("div", { className: "sb-flex sb-flex-col sb-gap-2 sb-items-center" },
|
28
|
-
React.createElement("p", null, chapter.title),
|
29
|
-
React.createElement("p", { className: "sb-p-2 sb-bg-[#303030] sb-bg-opacity-50 sb-rounded-md" },
|
30
|
-
durationFormater(chapter.startTime),
|
31
|
-
" -",
|
32
|
-
" ",
|
33
|
-
durationFormater(chapter.endTime))))))));
|
24
|
+
}, onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), children: _jsx("button", { id: `section-${chapter.title}`, className: "sb-h-full sb-w-full", onClick: handleClickChapter, children: _jsx("div", { className: "sb-relative sb-flex sb-h-full sb-w-full sb-justify-between sb-items-center", children: _jsx(Tooltip, { open: open, children: _jsxs("div", { className: "sb-flex sb-flex-col sb-gap-2 sb-items-center", children: [_jsx("p", { children: chapter.title }), _jsxs("p", { className: "sb-p-2 sb-bg-[#303030] sb-bg-opacity-50 sb-rounded-md", children: [durationFormater(chapter.startTime), " -", " ", durationFormater(chapter.endTime)] })] }) }) }) }) }));
|
34
25
|
};
|
35
26
|
export default ChapterTooltip;
|
36
27
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ChapterTooltip/index.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ChapterTooltip/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AAQrF,MAAM,cAAc,GAAG,CAAC,EAAE,OAAO,EAAS,EAAE,EAAE;IAC5C,MAAM,EAAE,MAAM,EAAE,GAAG,iCAAiC,EAAE,CAAC;IAEvD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,EAAE,WAAW,EAAE,GAAG,iCAAiC,EAAE,CAAC;IAE5D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YAClD,OAAO,CAAC,IAAI,CAAC,CAAC;YAEd,UAAU,CAAC,GAAG,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IAErC,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC,CAAC;IAEF,OAAO,CACL,cACE,EAAE,EAAE,cAAc,OAAO,CAAC,KAAK,EAAE,EACjC,SAAS,EAAC,iEAAiE,EAC3E,KAAK,EAAE;YACL,IAAI,EAAE,GAAG,OAAO,CAAC,eAAe,GAAG;YACnC,KAAK,EAAE,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,eAAe,GAAG;SAC7D,EACD,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EACjC,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,YAElC,iBACE,EAAE,EAAE,WAAW,OAAO,CAAC,KAAK,EAAE,EAC9B,SAAS,EAAC,qBAAqB,EAC/B,OAAO,EAAE,kBAAkB,YAE3B,cAAK,SAAS,EAAC,4EAA4E,YACzF,KAAC,OAAO,IAAC,IAAI,EAAE,IAAI,YACjB,eAAK,SAAS,EAAC,8CAA8C,aAC3D,sBAAI,OAAO,CAAC,KAAK,GAAK,EACtB,aAAG,SAAS,EAAC,uDAAuD,aACjE,gBAAgB,CAAC,OAAO,CAAC,SAAS,CAAC,QAAI,GAAG,EAC1C,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,IAChC,IACA,GACE,GACN,GACC,GACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
import Tooltip from "../Tooltip";
|
3
|
+
import { durationFormater } from "../../utils";
|
4
|
+
import { SoftBuildersVideoPlayerChapter } from "../../types";
|
5
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
6
|
+
type Chapter = SoftBuildersVideoPlayerChapter & {
|
7
|
+
startPercentage: number;
|
8
|
+
endPercentage: number;
|
9
|
+
};
|
10
|
+
type Props = {
|
11
|
+
chapter: Chapter;
|
12
|
+
};
|
13
|
+
const ChapterTooltip = ({ chapter }: Props) => {
|
14
|
+
const { player } = useSoftBuildersVideoPlayerContext();
|
15
|
+
|
16
|
+
const [open, setOpen] = useState(false);
|
17
|
+
const { currentTime } = useSoftBuildersVideoPlayerContext();
|
18
|
+
|
19
|
+
useEffect(() => {
|
20
|
+
if (currentTime === Math.floor(chapter.startTime)) {
|
21
|
+
setOpen(true);
|
22
|
+
|
23
|
+
setTimeout(() => {
|
24
|
+
setOpen(false);
|
25
|
+
}, 5000);
|
26
|
+
}
|
27
|
+
}, [currentTime, chapter.startTime]);
|
28
|
+
|
29
|
+
const handleClickChapter = () => {
|
30
|
+
player?.currentTime(chapter.startTime);
|
31
|
+
};
|
32
|
+
|
33
|
+
return (
|
34
|
+
<div
|
35
|
+
id={`ii-section-${chapter.title}`}
|
36
|
+
className="sb-flex sb-items-center sb-w-full sb-h-full sb-absolute sb-z-20"
|
37
|
+
style={{
|
38
|
+
left: `${chapter.startPercentage}%`,
|
39
|
+
width: `${chapter.endPercentage - chapter.startPercentage}%`,
|
40
|
+
}}
|
41
|
+
onMouseEnter={() => setOpen(true)}
|
42
|
+
onMouseLeave={() => setOpen(false)}
|
43
|
+
>
|
44
|
+
<button
|
45
|
+
id={`section-${chapter.title}`}
|
46
|
+
className="sb-h-full sb-w-full"
|
47
|
+
onClick={handleClickChapter}
|
48
|
+
>
|
49
|
+
<div className="sb-relative sb-flex sb-h-full sb-w-full sb-justify-between sb-items-center">
|
50
|
+
<Tooltip open={open}>
|
51
|
+
<div className="sb-flex sb-flex-col sb-gap-2 sb-items-center">
|
52
|
+
<p>{chapter.title}</p>
|
53
|
+
<p className="sb-p-2 sb-bg-[#303030] sb-bg-opacity-50 sb-rounded-md">
|
54
|
+
{durationFormater(chapter.startTime)} -{" "}
|
55
|
+
{durationFormater(chapter.endTime)}
|
56
|
+
</p>
|
57
|
+
</div>
|
58
|
+
</Tooltip>
|
59
|
+
</div>
|
60
|
+
</button>
|
61
|
+
</div>
|
62
|
+
);
|
63
|
+
};
|
64
|
+
|
65
|
+
export default ChapterTooltip;
|
@@ -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 ChaptersPanal: ({ chapters }: Props) =>
|
5
|
+
declare const ChaptersPanal: ({ chapters }: Props) => import("react/jsx-runtime").JSX.Element;
|
7
6
|
export default ChaptersPanal;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useEffect, useState } from "react";
|
2
3
|
import ChapterTooltip from "../ChapterTooltip";
|
3
4
|
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
4
5
|
const ChaptersPanal = ({ chapters }) => {
|
@@ -13,7 +14,7 @@ const ChaptersPanal = ({ chapters }) => {
|
|
13
14
|
});
|
14
15
|
setCs(newCs);
|
15
16
|
}, [chapters, duration]);
|
16
|
-
return (
|
17
|
+
return (_jsx("div", { id: "chapters-panal", className: "sb-w-full sb-h-full sb-relative ", children: cs.map((c, i) => (_jsx(ChapterTooltip, { chapter: c }, `chapter-${i}-${c.startTime}`))) }));
|
17
18
|
};
|
18
19
|
export default ChaptersPanal;
|
19
20
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ChaptersPanal/index.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ChaptersPanal/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,M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
4
|
+
import { SoftBuildersVideoPlayerChapter } from "../../types";
|
5
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
6
|
+
|
7
|
+
type Chapter = SoftBuildersVideoPlayerChapter & {
|
8
|
+
startPercentage: number;
|
9
|
+
endPercentage: number;
|
10
|
+
};
|
11
|
+
type Props = {
|
12
|
+
chapters: SoftBuildersVideoPlayerChapter[];
|
13
|
+
};
|
14
|
+
const ChaptersPanal = ({ chapters }: Props) => {
|
15
|
+
const [cs, setCs] = useState<Chapter[]>([]);
|
16
|
+
const { duration } = useSoftBuildersVideoPlayerContext();
|
17
|
+
|
18
|
+
useEffect(() => {
|
19
|
+
const newCs = chapters.map((c) => {
|
20
|
+
const startPercentage = Math.floor((c.startTime * 100) / duration);
|
21
|
+
const endPercentage = Math.floor((c.endTime * 100) / duration);
|
22
|
+
return {
|
23
|
+
...c,
|
24
|
+
startPercentage,
|
25
|
+
endPercentage,
|
26
|
+
};
|
27
|
+
});
|
28
|
+
setCs(newCs);
|
29
|
+
}, [chapters, duration]);
|
30
|
+
|
31
|
+
return (
|
32
|
+
<div id="chapters-panal" className="sb-w-full sb-h-full sb-relative ">
|
33
|
+
{cs.map((c, i) => (
|
34
|
+
<ChapterTooltip key={`chapter-${i}-${c.startTime}`} chapter={c} />
|
35
|
+
))}
|
36
|
+
</div>
|
37
|
+
);
|
38
|
+
};
|
39
|
+
|
40
|
+
export default ChaptersPanal;
|
@@ -11,5 +11,5 @@ type Props<T> = {
|
|
11
11
|
seekStep?: number;
|
12
12
|
handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
|
13
13
|
};
|
14
|
-
declare const ControlBar: <T>({ player, isPaused, setIsPaused, duration, notes, chapters, seekStep, handleSaveNoteAction, }: Props<T>) =>
|
14
|
+
declare const ControlBar: <T>({ player, isPaused, setIsPaused, duration, notes, chapters, seekStep, handleSaveNoteAction, }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
15
15
|
export default ControlBar;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useEffect } from "react";
|
2
3
|
import CurrentTimeLabel from "../CurrentTimeLabel";
|
3
4
|
import { durationFormater } from "../../utils";
|
4
5
|
import VolumeSlider from "../VolumeSlider";
|
@@ -29,36 +30,18 @@ const ControlBar = ({ player, isPaused, setIsPaused, duration, notes, chapters,
|
|
29
30
|
useEffect(() => {
|
30
31
|
setDuration(duration);
|
31
32
|
}, [duration]);
|
32
|
-
return (
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
React.createElement(CurrentTimeLabel, null),
|
45
|
-
React.createElement("div", { className: "sb-w-[30%] hover:sb-w-[45%] sb-transition-all sb-ease-in-out sb-duration-500" },
|
46
|
-
React.createElement(TimeSliderContainer, { chapters: chapters, notes: notes })),
|
47
|
-
React.createElement("p", null, durationFormater(duration)),
|
48
|
-
React.createElement("div", { className: "sb-w-[10%]" },
|
49
|
-
React.createElement(VolumeSlider, null)),
|
50
|
-
React.createElement(QualityMenu, null),
|
51
|
-
React.createElement("button", { onClick: () => {
|
52
|
-
if (player === null || player === void 0 ? void 0 : player.isFullscreen()) {
|
53
|
-
player === null || player === void 0 ? void 0 : player.exitFullscreen();
|
54
|
-
}
|
55
|
-
else {
|
56
|
-
player === null || player === void 0 ? void 0 : player.requestFullscreen();
|
57
|
-
}
|
58
|
-
} },
|
59
|
-
React.createElement(FullScreenIcon, { className: "sb-w-3 sb-h-3" })),
|
60
|
-
handleSaveNoteAction && (React.createElement(CreateNoteMenu, { handleSaveNoteAction: handleSaveNoteAction })),
|
61
|
-
React.createElement(SubtitleMenu, null)));
|
33
|
+
return (_jsxs("div", { className: "sb-flex sb-items-center sb-justify-center sb-gap-3 sb-w-full", children: [_jsx(BufferTracker, {}), _jsx(CurrentTimeTracker, {}), _jsx("button", { onClick: () => {
|
34
|
+
seek(-seekStep);
|
35
|
+
}, children: _jsx(BackwardIcon, { className: "sb-w-3 sb-h-3" }) }), _jsx("button", { onClick: togglePlay, children: isPaused ? (_jsx(PlayIcon, { className: "sb-w-3 sb-h-3" })) : (_jsx(PauseIcon, { className: "sb-w-3 sb-h-3" })) }), _jsx("button", { onClick: () => {
|
36
|
+
seek(seekStep);
|
37
|
+
}, children: _jsx(ForwardIcon, { className: "sb-w-3 sb-h-3" }) }), _jsx(CurrentTimeLabel, {}), _jsx("div", { className: "sb-w-[30%] hover:sb-w-[45%] sb-transition-all sb-ease-in-out sb-duration-500", children: _jsx(TimeSliderContainer, { chapters: chapters, notes: notes }) }), _jsx("p", { children: durationFormater(duration) }), _jsx("div", { className: "sb-w-[10%]", children: _jsx(VolumeSlider, {}) }), _jsx(QualityMenu, {}), _jsx("button", { onClick: () => {
|
38
|
+
if (player === null || player === void 0 ? void 0 : player.isFullscreen()) {
|
39
|
+
player === null || player === void 0 ? void 0 : player.exitFullscreen();
|
40
|
+
}
|
41
|
+
else {
|
42
|
+
player === null || player === void 0 ? void 0 : player.requestFullscreen();
|
43
|
+
}
|
44
|
+
}, children: _jsx(FullScreenIcon, { className: "sb-w-3 sb-h-3" }) }), handleSaveNoteAction && (_jsx(CreateNoteMenu, { handleSaveNoteAction: handleSaveNoteAction })), _jsx(SubtitleMenu, {})] }));
|
62
45
|
};
|
63
46
|
export default ControlBar;
|
64
47
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ControlBar/index.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ControlBar/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,gBAAgB,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAA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C;yBAAM,CAAC;wBACN,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,iBAAiB,EAAE,CAAC;oBAC9B,CAAC;gBACH,CAAC,YAED,KAAC,cAAc,IAAC,SAAS,EAAC,eAAe,GAAG,GACrC,EAER,oBAAoB,IAAI,CACvB,KAAC,cAAc,IAAC,oBAAoB,EAAE,oBAAoB,GAAI,CAC/D,EAED,KAAC,YAAY,KAAG,IACZ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
import React, { useEffect } from "react";
|
2
|
+
|
3
|
+
import Player from "video.js/dist/types/player";
|
4
|
+
import CurrentTimeLabel from "../CurrentTimeLabel";
|
5
|
+
import { durationFormater } from "../../utils";
|
6
|
+
import VolumeSlider from "../VolumeSlider";
|
7
|
+
import QualityMenu from "../QualityMenu";
|
8
|
+
|
9
|
+
import CreateNoteMenu from "../CreateNoteMenu";
|
10
|
+
import TimeSliderContainer from "../TimeSliderContainer";
|
11
|
+
import BufferTracker from "../BufferTracker";
|
12
|
+
import CurrentTimeTracker from "../CurrentTimeTracker";
|
13
|
+
import {
|
14
|
+
SoftBuildersVideoPlayerChapter,
|
15
|
+
SoftBuildersVideoPlayerNote,
|
16
|
+
} from "../../types";
|
17
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
18
|
+
import SubtitleMenu from "../SubtitleMenu";
|
19
|
+
import { BackwardIcon, ForwardIcon, FullScreenIcon, PauseIcon, PlayIcon } from "../../images";
|
20
|
+
|
21
|
+
type Props<T> = {
|
22
|
+
player: Player | undefined;
|
23
|
+
isPaused: boolean;
|
24
|
+
setIsPaused: React.Dispatch<React.SetStateAction<boolean>>;
|
25
|
+
duration: number;
|
26
|
+
notes: SoftBuildersVideoPlayerNote[];
|
27
|
+
chapters: SoftBuildersVideoPlayerChapter[];
|
28
|
+
seekStep?: number;
|
29
|
+
handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
|
30
|
+
};
|
31
|
+
const ControlBar = <T,>({
|
32
|
+
player,
|
33
|
+
isPaused,
|
34
|
+
setIsPaused,
|
35
|
+
duration,
|
36
|
+
notes,
|
37
|
+
chapters,
|
38
|
+
seekStep = 5,
|
39
|
+
handleSaveNoteAction,
|
40
|
+
}: Props<T>) => {
|
41
|
+
const { setPlayer, setDuration } = useSoftBuildersVideoPlayerContext();
|
42
|
+
|
43
|
+
const seek = (duration: number) => {
|
44
|
+
const currentTime = Number(player?.currentTime() || 0);
|
45
|
+
player?.currentTime(currentTime + duration);
|
46
|
+
};
|
47
|
+
|
48
|
+
const togglePlay = () => {
|
49
|
+
if (isPaused) player?.play();
|
50
|
+
else player?.pause();
|
51
|
+
|
52
|
+
setIsPaused(!isPaused);
|
53
|
+
};
|
54
|
+
|
55
|
+
useEffect(() => {
|
56
|
+
setPlayer(player);
|
57
|
+
}, [player]);
|
58
|
+
|
59
|
+
useEffect(() => {
|
60
|
+
setDuration(duration);
|
61
|
+
}, [duration]);
|
62
|
+
|
63
|
+
return (
|
64
|
+
<div className="sb-flex sb-items-center sb-justify-center sb-gap-3 sb-w-full">
|
65
|
+
{/* Doesn't display anything, just set the downloaded buffer persentage */}
|
66
|
+
<BufferTracker />
|
67
|
+
{/* Doesn't display anything, just set the current time */}
|
68
|
+
<CurrentTimeTracker />
|
69
|
+
|
70
|
+
<button
|
71
|
+
onClick={() => {
|
72
|
+
seek(-seekStep);
|
73
|
+
}}
|
74
|
+
>
|
75
|
+
<BackwardIcon className="sb-w-3 sb-h-3" />
|
76
|
+
</button>
|
77
|
+
<button onClick={togglePlay}>
|
78
|
+
{isPaused ? (
|
79
|
+
<PlayIcon className="sb-w-3 sb-h-3" />
|
80
|
+
) : (
|
81
|
+
<PauseIcon className="sb-w-3 sb-h-3" />
|
82
|
+
)}
|
83
|
+
</button>
|
84
|
+
<button
|
85
|
+
onClick={() => {
|
86
|
+
seek(seekStep);
|
87
|
+
}}
|
88
|
+
>
|
89
|
+
<ForwardIcon className="sb-w-3 sb-h-3" />
|
90
|
+
</button>
|
91
|
+
|
92
|
+
<CurrentTimeLabel />
|
93
|
+
|
94
|
+
<div className="sb-w-[30%] hover:sb-w-[45%] sb-transition-all sb-ease-in-out sb-duration-500">
|
95
|
+
<TimeSliderContainer chapters={chapters} notes={notes} />
|
96
|
+
</div>
|
97
|
+
|
98
|
+
<p>{durationFormater(duration)}</p>
|
99
|
+
|
100
|
+
<div className="sb-w-[10%]">
|
101
|
+
<VolumeSlider />
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<QualityMenu />
|
105
|
+
|
106
|
+
<button
|
107
|
+
onClick={() => {
|
108
|
+
if (player?.isFullscreen()) {
|
109
|
+
player?.exitFullscreen();
|
110
|
+
} else {
|
111
|
+
player?.requestFullscreen();
|
112
|
+
}
|
113
|
+
}}
|
114
|
+
>
|
115
|
+
<FullScreenIcon className="sb-w-3 sb-h-3" />
|
116
|
+
</button>
|
117
|
+
|
118
|
+
{handleSaveNoteAction && (
|
119
|
+
<CreateNoteMenu handleSaveNoteAction={handleSaveNoteAction} />
|
120
|
+
)}
|
121
|
+
|
122
|
+
<SubtitleMenu />
|
123
|
+
</div>
|
124
|
+
);
|
125
|
+
};
|
126
|
+
|
127
|
+
export default ControlBar;
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import React from "react";
|
2
1
|
type Props<T> = {
|
3
2
|
handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
|
4
3
|
};
|
5
|
-
declare const CreateNoteMenu: <T>({ handleSaveNoteAction }: Props<T>) =>
|
4
|
+
declare const CreateNoteMenu: <T>({ handleSaveNoteAction }: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
6
5
|
export default CreateNoteMenu;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useState } from "react";
|
2
3
|
import MenuButton from "../MenuButton";
|
3
4
|
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
4
5
|
import { ClosedNoteIcon } from "../../images";
|
@@ -16,14 +17,7 @@ const CreateNoteMenu = ({ handleSaveNoteAction }) => {
|
|
16
17
|
window.alert("Video Player, there is no implementation for the handleSaveNoteAction function");
|
17
18
|
}
|
18
19
|
};
|
19
|
-
return (
|
20
|
-
React.createElement("div", { className: "sb-flex sb-flex-col sb-gap-3" },
|
21
|
-
React.createElement("h3", { className: "sb-px-5" }, "Add Note"),
|
22
|
-
React.createElement("div", { className: "sb-w-full sb-h-[.1px] sb-bg-[#AAAAAA] sb-bg-opacity-70" }),
|
23
|
-
React.createElement("div", { className: "sb-px-5 sb-flex sb-flex-col sb-gap-4 sb-items-start" },
|
24
|
-
React.createElement("input", { name: "note", type: "text", placeholder: "Add a note", value: note, onChange: (e) => setNote(e.target.value), required: true, className: "sb-text-white placeholder:sb-text-white sb-w-full sb-bg-transparent sb-px-4 sb-py-3 sb-border sb-border-[#AAAAAA] sb-rounded-md" }),
|
25
|
-
React.createElement("button", { className: "sb-w-full", onClick: handleSaveNote },
|
26
|
-
React.createElement("div", { className: "sb-px-4 sb-py-3 sb-text-center sb-font-bold sb-bg-orange-500 sb-rounded-md" }, "Save"))))) }));
|
20
|
+
return (_jsx(MenuButton, { buttonContent: _jsx(ClosedNoteIcon, { 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-[220px]", children: _jsxs("div", { className: "sb-flex sb-flex-col sb-gap-3", children: [_jsx("h3", { className: "sb-px-5", children: "Add Note" }), _jsx("div", { className: "sb-w-full sb-h-[.1px] sb-bg-[#AAAAAA] sb-bg-opacity-70" }), _jsxs("div", { className: "sb-px-5 sb-flex sb-flex-col sb-gap-4 sb-items-start", children: [_jsx("input", { name: "note", type: "text", placeholder: "Add a note", value: note, onChange: (e) => setNote(e.target.value), required: true, className: "sb-text-white placeholder:sb-text-white sb-w-full sb-bg-transparent sb-px-4 sb-py-3 sb-border sb-border-[#AAAAAA] sb-rounded-md" }), _jsx("button", { className: "sb-w-full", onClick: handleSaveNote, children: _jsx("div", { className: "sb-px-4 sb-py-3 sb-text-center sb-font-bold sb-bg-orange-500 sb-rounded-md", children: "Save" }) })] })] }) }) }));
|
27
21
|
};
|
28
22
|
export default CreateNoteMenu;
|
29
23
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CreateNoteMenu/index.tsx"],"names":[],"mappings":"AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CreateNoteMenu/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C,MAAM,cAAc,GAAG,CAAK,EAAE,oBAAoB,EAAY,EAAE,EAAE;IAChE,MAAM,EAAE,MAAM,EAAE,GAAG,iCAAiC,EAAE,CAAC;IAEvD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAErC,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,IAAI,oBAAoB,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,EAAE,KAAI,CAAC,CAAC;YACxC,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACjD,OAAO,CAAC,EAAE,CAAC,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,KAAK,CACV,gFAAgF,CACjF,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,UAAU,IACT,aAAa,EAAE,KAAC,cAAc,IAAC,SAAS,EAAC,eAAe,GAAG,EAC3D,WAAW,EACT,cAAK,SAAS,EAAC,qEAAqE,YAClF,eAAK,SAAS,EAAC,8BAA8B,aAC3C,aAAI,SAAS,EAAC,SAAS,yBAAc,EAErC,cAAK,SAAS,EAAC,wDAAwD,GAAG,EAE1E,eAAK,SAAS,EAAC,qDAAqD,aAClE,gBACE,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,MAAM,EACX,WAAW,EAAC,YAAY,EACxB,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACxC,QAAQ,QACR,SAAS,EAAC,iIAAiI,GAC3I,EAEF,iBAAQ,SAAS,EAAC,WAAW,EAAC,OAAO,EAAE,cAAc,YACnD,cAAK,SAAS,EAAC,4EAA4E,qBAErF,GACC,IACL,IACF,GACF,GAER,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import React, { useState } from "react";
|
2
|
+
import MenuButton from "../MenuButton";
|
3
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
4
|
+
import { ClosedNoteIcon } from "../../images";
|
5
|
+
|
6
|
+
type Props<T> = {
|
7
|
+
handleSaveNoteAction?: (time: number, note: string) => Promise<T>;
|
8
|
+
};
|
9
|
+
const CreateNoteMenu = <T,>({ handleSaveNoteAction }: Props<T>) => {
|
10
|
+
const { player } = useSoftBuildersVideoPlayerContext();
|
11
|
+
|
12
|
+
const [note, setNote] = useState("");
|
13
|
+
|
14
|
+
const handleSaveNote = () => {
|
15
|
+
if (handleSaveNoteAction) {
|
16
|
+
const time = player?.currentTime() || 0;
|
17
|
+
handleSaveNoteAction(time, note).then((response) => {
|
18
|
+
setNote("");
|
19
|
+
});
|
20
|
+
} else {
|
21
|
+
window.alert(
|
22
|
+
"Video Player, there is no implementation for the handleSaveNoteAction function"
|
23
|
+
);
|
24
|
+
}
|
25
|
+
};
|
26
|
+
|
27
|
+
return (
|
28
|
+
<MenuButton
|
29
|
+
buttonContent={<ClosedNoteIcon className="sb-w-3 sb-h-3" />}
|
30
|
+
menuContent={
|
31
|
+
<div className="sb-rounded-md sb-bg-[#303030] sb-bg-opacity-50 sb-py-5 sb-w-[220px]">
|
32
|
+
<div className="sb-flex sb-flex-col sb-gap-3">
|
33
|
+
<h3 className="sb-px-5">Add Note</h3>
|
34
|
+
|
35
|
+
<div className="sb-w-full sb-h-[.1px] sb-bg-[#AAAAAA] sb-bg-opacity-70" />
|
36
|
+
|
37
|
+
<div className="sb-px-5 sb-flex sb-flex-col sb-gap-4 sb-items-start">
|
38
|
+
<input
|
39
|
+
name="note"
|
40
|
+
type="text"
|
41
|
+
placeholder="Add a note"
|
42
|
+
value={note}
|
43
|
+
onChange={(e) => setNote(e.target.value)}
|
44
|
+
required
|
45
|
+
className="sb-text-white placeholder:sb-text-white sb-w-full sb-bg-transparent sb-px-4 sb-py-3 sb-border sb-border-[#AAAAAA] sb-rounded-md"
|
46
|
+
/>
|
47
|
+
|
48
|
+
<button className="sb-w-full" onClick={handleSaveNote}>
|
49
|
+
<div className="sb-px-4 sb-py-3 sb-text-center sb-font-bold sb-bg-orange-500 sb-rounded-md">
|
50
|
+
Save
|
51
|
+
</div>
|
52
|
+
</button>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
</div>
|
56
|
+
}
|
57
|
+
/>
|
58
|
+
);
|
59
|
+
};
|
60
|
+
|
61
|
+
export default CreateNoteMenu;
|