softbuilders-react-video-player 1.1.72 → 1.1.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/components/ChapterTooltip/index.tsx +65 -65
- package/dist/components/CurrentTimeLabel/index.tsx +13 -13
- package/dist/components/Menu/index.tsx +49 -49
- package/dist/components/NoteTooltip/index.tsx +46 -46
- package/dist/components/SoftBuildersVideoPlayer/index.js +55 -32
- package/dist/components/SoftBuildersVideoPlayer/index.js.map +1 -1
- package/dist/components/SoftBuildersVideoPlayer/index.tsx +80 -40
- package/dist/components/VideoPlayerComponent/index.js +25 -21
- package/dist/components/VideoPlayerComponent/index.js.map +1 -1
- package/dist/components/VideoPlayerComponent/index.tsx +28 -19
- package/dist/components/VideoPlayerComponent/provider.tsx +82 -82
- package/dist/components/VolumeSlider/index.js +1 -1
- package/dist/components/VolumeSlider/index.js.map +1 -1
- package/dist/components/VolumeSlider/index.tsx +1 -1
- package/dist/index.mjs +57 -56
- package/dist/styles/tailwind.css +125 -125
- package/package.json +2 -1
package/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2024 masri-softbuilders
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 masri-softbuilders
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -1,65 +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
|
+
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,13 +1,13 @@
|
|
1
|
-
"use client";
|
2
|
-
import React, { useEffect } from "react";
|
3
|
-
import { durationFormater } from "../../utils";
|
4
|
-
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
5
|
-
type Props = {};
|
6
|
-
|
7
|
-
const CurrentTimeLabel = ({}: Props) => {
|
8
|
-
const { currentTime } = useSoftBuildersVideoPlayerContext();
|
9
|
-
|
10
|
-
return <p>{durationFormater(currentTime)}</p>;
|
11
|
-
};
|
12
|
-
|
13
|
-
export default CurrentTimeLabel;
|
1
|
+
"use client";
|
2
|
+
import React, { useEffect } from "react";
|
3
|
+
import { durationFormater } from "../../utils";
|
4
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
5
|
+
type Props = {};
|
6
|
+
|
7
|
+
const CurrentTimeLabel = ({}: Props) => {
|
8
|
+
const { currentTime } = useSoftBuildersVideoPlayerContext();
|
9
|
+
|
10
|
+
return <p>{durationFormater(currentTime)}</p>;
|
11
|
+
};
|
12
|
+
|
13
|
+
export default CurrentTimeLabel;
|
@@ -1,49 +1,49 @@
|
|
1
|
-
import React from "react";
|
2
|
-
|
3
|
-
type Props = {
|
4
|
-
name: string;
|
5
|
-
};
|
6
|
-
|
7
|
-
const Menu = ({ name }: Props) => {
|
8
|
-
return (
|
9
|
-
<div className="absolute right-0 z-10 w-48 mt-2 origin-top-right bg-white border border-gray-300 rounded-md shadow-lg focus:outline-none">
|
10
|
-
<div
|
11
|
-
className="py-1"
|
12
|
-
role="menu"
|
13
|
-
aria-orientation="vertical"
|
14
|
-
aria-labelledby={`${name}-button`}
|
15
|
-
>
|
16
|
-
<a
|
17
|
-
href="#"
|
18
|
-
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
19
|
-
role="menuitem"
|
20
|
-
>
|
21
|
-
Dashboard
|
22
|
-
</a>
|
23
|
-
<a
|
24
|
-
href="#"
|
25
|
-
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
26
|
-
role="menuitem"
|
27
|
-
>
|
28
|
-
Settings
|
29
|
-
</a>
|
30
|
-
<a
|
31
|
-
href="#"
|
32
|
-
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
33
|
-
role="menuitem"
|
34
|
-
>
|
35
|
-
Profile
|
36
|
-
</a>
|
37
|
-
<a
|
38
|
-
href="#"
|
39
|
-
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
40
|
-
role="menuitem"
|
41
|
-
>
|
42
|
-
Logout
|
43
|
-
</a>
|
44
|
-
</div>
|
45
|
-
</div>
|
46
|
-
);
|
47
|
-
};
|
48
|
-
|
49
|
-
export default Menu;
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
type Props = {
|
4
|
+
name: string;
|
5
|
+
};
|
6
|
+
|
7
|
+
const Menu = ({ name }: Props) => {
|
8
|
+
return (
|
9
|
+
<div className="absolute right-0 z-10 w-48 mt-2 origin-top-right bg-white border border-gray-300 rounded-md shadow-lg focus:outline-none">
|
10
|
+
<div
|
11
|
+
className="py-1"
|
12
|
+
role="menu"
|
13
|
+
aria-orientation="vertical"
|
14
|
+
aria-labelledby={`${name}-button`}
|
15
|
+
>
|
16
|
+
<a
|
17
|
+
href="#"
|
18
|
+
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
19
|
+
role="menuitem"
|
20
|
+
>
|
21
|
+
Dashboard
|
22
|
+
</a>
|
23
|
+
<a
|
24
|
+
href="#"
|
25
|
+
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
26
|
+
role="menuitem"
|
27
|
+
>
|
28
|
+
Settings
|
29
|
+
</a>
|
30
|
+
<a
|
31
|
+
href="#"
|
32
|
+
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
33
|
+
role="menuitem"
|
34
|
+
>
|
35
|
+
Profile
|
36
|
+
</a>
|
37
|
+
<a
|
38
|
+
href="#"
|
39
|
+
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
|
40
|
+
role="menuitem"
|
41
|
+
>
|
42
|
+
Logout
|
43
|
+
</a>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
);
|
47
|
+
};
|
48
|
+
|
49
|
+
export default Menu;
|
@@ -1,46 +1,46 @@
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
2
|
-
import Tooltip from "../Tooltip";
|
3
|
-
import { durationFormater } from "../../utils";
|
4
|
-
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
5
|
-
import { SoftBuildersVideoPlayerNote } from "../../types";
|
6
|
-
type Note = SoftBuildersVideoPlayerNote & { percentage: number };
|
7
|
-
|
8
|
-
type Props = {
|
9
|
-
note: Note;
|
10
|
-
};
|
11
|
-
|
12
|
-
const NoteTooltip = ({ note }: Props) => {
|
13
|
-
const [open, setOpen] = useState(false);
|
14
|
-
const { currentTime } = useSoftBuildersVideoPlayerContext();
|
15
|
-
|
16
|
-
useEffect(() => {
|
17
|
-
if (currentTime === Math.floor(note.time)) {
|
18
|
-
setOpen(true);
|
19
|
-
|
20
|
-
setTimeout(() => {
|
21
|
-
setOpen(false);
|
22
|
-
}, 5000);
|
23
|
-
}
|
24
|
-
}, [currentTime, note.time]);
|
25
|
-
return (
|
26
|
-
<div
|
27
|
-
className="sb-w-1 sb-h-1 sb-rounded-full sb-bg-white sb-absolute sb-z-30"
|
28
|
-
style={{ left: `${note.percentage}%` }}
|
29
|
-
onMouseEnter={() => setOpen(true)}
|
30
|
-
onMouseLeave={() => setOpen(false)}
|
31
|
-
>
|
32
|
-
<div className="sb-relative">
|
33
|
-
<Tooltip open={open}>
|
34
|
-
<div className="sb-flex sb-flex-col sb-gap-2 sb-items-center">
|
35
|
-
<p>{note.label}</p>
|
36
|
-
<p className="sb-p-2 sb-bg-[#303030] sb-bg-opacity-50 sb-rounded-md">
|
37
|
-
{durationFormater(note.time)}
|
38
|
-
</p>
|
39
|
-
</div>
|
40
|
-
</Tooltip>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
);
|
44
|
-
};
|
45
|
-
|
46
|
-
export default NoteTooltip;
|
1
|
+
import React, { useEffect, useState } from "react";
|
2
|
+
import Tooltip from "../Tooltip";
|
3
|
+
import { durationFormater } from "../../utils";
|
4
|
+
import { useSoftBuildersVideoPlayerContext } from "../VideoPlayerComponent/provider";
|
5
|
+
import { SoftBuildersVideoPlayerNote } from "../../types";
|
6
|
+
type Note = SoftBuildersVideoPlayerNote & { percentage: number };
|
7
|
+
|
8
|
+
type Props = {
|
9
|
+
note: Note;
|
10
|
+
};
|
11
|
+
|
12
|
+
const NoteTooltip = ({ note }: Props) => {
|
13
|
+
const [open, setOpen] = useState(false);
|
14
|
+
const { currentTime } = useSoftBuildersVideoPlayerContext();
|
15
|
+
|
16
|
+
useEffect(() => {
|
17
|
+
if (currentTime === Math.floor(note.time)) {
|
18
|
+
setOpen(true);
|
19
|
+
|
20
|
+
setTimeout(() => {
|
21
|
+
setOpen(false);
|
22
|
+
}, 5000);
|
23
|
+
}
|
24
|
+
}, [currentTime, note.time]);
|
25
|
+
return (
|
26
|
+
<div
|
27
|
+
className="sb-w-1 sb-h-1 sb-rounded-full sb-bg-white sb-absolute sb-z-30"
|
28
|
+
style={{ left: `${note.percentage}%` }}
|
29
|
+
onMouseEnter={() => setOpen(true)}
|
30
|
+
onMouseLeave={() => setOpen(false)}
|
31
|
+
>
|
32
|
+
<div className="sb-relative">
|
33
|
+
<Tooltip open={open}>
|
34
|
+
<div className="sb-flex sb-flex-col sb-gap-2 sb-items-center">
|
35
|
+
<p>{note.label}</p>
|
36
|
+
<p className="sb-p-2 sb-bg-[#303030] sb-bg-opacity-50 sb-rounded-md">
|
37
|
+
{durationFormater(note.time)}
|
38
|
+
</p>
|
39
|
+
</div>
|
40
|
+
</Tooltip>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
);
|
44
|
+
};
|
45
|
+
|
46
|
+
export default NoteTooltip;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { forwardRef, memo, useEffect, useState } from "react";
|
2
|
+
import { forwardRef, memo, useCallback, useEffect, useMemo, useState, } from "react";
|
3
3
|
import VideoPlayerComponent from "../VideoPlayerComponent";
|
4
4
|
import { convertSRTtoVTT } from "../../utils";
|
5
5
|
const DEFAULT_OPTIONS = {
|
@@ -13,40 +13,63 @@ const DEFAULT_OPTIONS = {
|
|
13
13
|
tracks: [],
|
14
14
|
};
|
15
15
|
const Component = forwardRef(({ options, notes, chapters, startTime = 0, handleSaveNoteAction, onPlay, onPause, isFocused = true, disableNote, childRef, bottomRedBar, noteButtonClick, }, ref) => {
|
16
|
-
options =
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
if (
|
26
|
-
|
27
|
-
if (options.
|
28
|
-
|
29
|
-
if (options.
|
30
|
-
|
16
|
+
// options = {
|
17
|
+
// ...options,
|
18
|
+
// responsive: true,
|
19
|
+
// inactivityTimeout: 0,
|
20
|
+
// fullscreen: {
|
21
|
+
// navigationUI: "hide",
|
22
|
+
// },
|
23
|
+
// } as any;
|
24
|
+
const mergedOptions = useMemo(() => (Object.assign(Object.assign(Object.assign({}, DEFAULT_OPTIONS), options), { responsive: true, inactivityTimeout: 0, fullscreen: { navigationUI: "hide" } })), [options]);
|
25
|
+
// if (options.autoplay === undefined)
|
26
|
+
// options.autoplay = DEFAULT_OPTIONS.autoplay;
|
27
|
+
// if (options.controls === undefined)
|
28
|
+
// options.controls = DEFAULT_OPTIONS.controls;
|
29
|
+
// if (options.fluid === undefined) options.fluid = DEFAULT_OPTIONS.fluid;
|
30
|
+
// if (options?.muted === undefined) options.muted = DEFAULT_OPTIONS?.muted;
|
31
|
+
// if (options.height === undefined) options.height = DEFAULT_OPTIONS.height;
|
32
|
+
// if (options.width === undefined) options.width = DEFAULT_OPTIONS.width;
|
33
|
+
// const [tracks, setTracks] = useState<SoftBuildersVideoPlayerTrack[]>([]);
|
34
|
+
// useEffect(() => {}, [isFocused]);
|
35
|
+
// useEffect(() => {
|
36
|
+
// const getTracks = async () => {
|
37
|
+
// const newTracks: SoftBuildersVideoPlayerTrack[] = [];
|
38
|
+
// if (Array.isArray(options?.tracks))
|
39
|
+
// for (const [i, s] of options?.tracks.entries()) {
|
40
|
+
// let src = s.src;
|
41
|
+
// if (s.memeType == "text/srt") {
|
42
|
+
// src = await convertSRTtoVTT(s.src);
|
43
|
+
// }
|
44
|
+
// newTracks.push({
|
45
|
+
// ...s,
|
46
|
+
// src,
|
47
|
+
// });
|
48
|
+
// }
|
49
|
+
// setTracks(newTracks);
|
50
|
+
// };
|
51
|
+
// getTracks();
|
52
|
+
// }, [options?.tracks]);
|
53
|
+
// const id = (Date.now() + Math.random() * 100).toString();
|
31
54
|
const [tracks, setTracks] = useState([]);
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
const
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
if (s.memeType == "text/srt") {
|
40
|
-
src = await convertSRTtoVTT(s.src);
|
41
|
-
}
|
42
|
-
newTracks.push(Object.assign(Object.assign({}, s), { src }));
|
55
|
+
const getTracks = useCallback(async () => {
|
56
|
+
const newTracks = [];
|
57
|
+
if (Array.isArray(mergedOptions.tracks)) {
|
58
|
+
for (const s of mergedOptions.tracks) {
|
59
|
+
let src = s.src;
|
60
|
+
if (s.memeType === "text/srt") {
|
61
|
+
src = await convertSRTtoVTT(s.src);
|
43
62
|
}
|
44
|
-
|
45
|
-
|
63
|
+
newTracks.push(Object.assign(Object.assign({}, s), { src }));
|
64
|
+
}
|
65
|
+
}
|
66
|
+
setTracks(newTracks);
|
67
|
+
}, [mergedOptions.tracks]);
|
68
|
+
useEffect(() => {
|
46
69
|
getTracks();
|
47
|
-
}, [
|
48
|
-
const id = (Date.now() + Math.random() * 100).toString();
|
49
|
-
return (_jsx(VideoPlayerComponent, { id: id, chapters: chapters, options: Object.assign(Object.assign({},
|
70
|
+
}, [getTracks]);
|
71
|
+
const id = useMemo(() => (Date.now() + Math.random() * 100).toString(), []);
|
72
|
+
return (_jsx(VideoPlayerComponent, { id: id, chapters: chapters, options: Object.assign(Object.assign({}, mergedOptions), { tracks }), notes: notes, poster: "", startTime: startTime, handleSaveNoteAction: handleSaveNoteAction, disableNote: disableNote, onPause: onPause, onPlay: onPlay, childRef: childRef, bottomRedBar: bottomRedBar, noteButtonClick: noteButtonClick }));
|
50
73
|
});
|
51
74
|
const SoftBuildersVideoPlayer = memo(Component, (prevProps, nextProps) => {
|
52
75
|
return (prevProps.options === nextProps.options &&
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SoftBuildersVideoPlayer/index.tsx"],"names":[],"mappings":";AAAA,OAAc,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SoftBuildersVideoPlayer/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EACZ,UAAU,EACV,IAAI,EACJ,WAAW,EACX,SAAS,EACT,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,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,KAAK;IACZ,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;CACX,CAAC;AAiBF,MAAM,SAAS,GAAG,UAAU,CAC1B,CACE,EACE,OAAO,EACP,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,CAAC,EACb,oBAAoB,EACpB,MAAM,EACN,OAAO,EACP,SAAS,GAAG,IAAI,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,eAAe,GACJ,EACb,GAAS,EACT,EAAE;IACF,cAAc;IACd,gBAAgB;IAChB,sBAAsB;IACtB,0BAA0B;IAC1B,kBAAkB;IAClB,4BAA4B;IAC5B,OAAO;IACP,YAAY;IAEZ,MAAM,aAAa,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,+CACD,eAAe,GACf,OAAO,KACV,UAAU,EAAE,IAAI,EAChB,iBAAiB,EAAE,CAAC,EACpB,UAAU,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,IACpC,EACF,CAAC,OAAO,CAAC,CACV,CAAC;IAEF,sCAAsC;IACtC,iDAAiD;IACjD,sCAAsC;IACtC,iDAAiD;IACjD,0EAA0E;IAC1E,4EAA4E;IAC5E,6EAA6E;IAC7E,0EAA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