softbuilders-react-video-player 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/ControlBar/index.js +1 -0
- package/dist/components/ControlBar/index.js.map +1 -1
- package/dist/components/ControlBar/index.tsx +2 -0
- package/dist/components/NoteTooltip/index.js +1 -1
- package/dist/components/NoteTooltip/index.js.map +1 -1
- package/dist/components/NoteTooltip/index.tsx +2 -2
- package/dist/components/QualityMenu/index.js +8 -6
- package/dist/components/QualityMenu/index.js.map +1 -1
- package/dist/components/QualityMenu/index.tsx +8 -7
- package/dist/components/SoftBuildersVideoPlayer/index.d.ts +1 -0
- package/dist/components/SoftBuildersVideoPlayer/index.js +34 -58
- package/dist/components/SoftBuildersVideoPlayer/index.js.map +1 -1
- package/dist/components/SoftBuildersVideoPlayer/index.tsx +58 -101
- package/dist/components/SubtitleMenu/index.js +1 -1
- package/dist/components/SubtitleMenu/index.js.map +1 -1
- package/dist/components/SubtitleMenu/index.tsx +1 -1
- package/dist/components/TimeSlider/index.js +8 -2
- package/dist/components/TimeSlider/index.js.map +1 -1
- package/dist/components/TimeSlider/index.tsx +102 -93
- package/dist/components/VideoPlayerComponent/index.d.ts +1 -0
- package/dist/components/VideoPlayerComponent/index.js +91 -82
- package/dist/components/VideoPlayerComponent/index.js.map +1 -1
- package/dist/components/VideoPlayerComponent/index.tsx +135 -128
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +137 -148
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -31,14 +31,7 @@ var __objRest = (source, exclude) => {
|
|
31
31
|
};
|
32
32
|
|
33
33
|
// src/components/SoftBuildersVideoPlayer/index.tsx
|
34
|
-
import {
|
35
|
-
forwardRef as forwardRef2,
|
36
|
-
memo,
|
37
|
-
useCallback as useCallback4,
|
38
|
-
useEffect as useEffect15,
|
39
|
-
useMemo,
|
40
|
-
useState as useState15
|
41
|
-
} from "react";
|
34
|
+
import { forwardRef as forwardRef2, memo, useEffect as useEffect15, useState as useState15 } from "react";
|
42
35
|
|
43
36
|
// src/components/VideoPlayerComponent/index.tsx
|
44
37
|
import { forwardRef, useEffect as useEffect14, useRef as useRef2, useState as useState14 } from "react";
|
@@ -646,8 +639,8 @@ var MenuButton = ({
|
|
646
639
|
setIsOpen(false);
|
647
640
|
}, []);
|
648
641
|
useEffect3(() => {
|
649
|
-
const handleClickOutside = (
|
650
|
-
if (buttonRef.current && !buttonRef.current.contains(
|
642
|
+
const handleClickOutside = (event2) => {
|
643
|
+
if (buttonRef.current && !buttonRef.current.contains(event2.target) && menuRef.current && !menuRef.current.contains(event2.target)) {
|
651
644
|
setIsOpen(false);
|
652
645
|
}
|
653
646
|
};
|
@@ -720,7 +713,7 @@ var QualityOption = ({
|
|
720
713
|
className: `${width > 400 ? "sb-w-5 sb-h-5" : "sb-w-3 sb-h-3"}`
|
721
714
|
}
|
722
715
|
) : /* @__PURE__ */ jsx21("div", {}) }),
|
723
|
-
/* @__PURE__ */ jsx21("p", { className: "sb-text-left sb-col-span-9", children: quality.label })
|
716
|
+
/* @__PURE__ */ jsx21("p", { className: "sb-text-left sb-col-span-9", children: quality == null ? void 0 : quality.label })
|
724
717
|
] })
|
725
718
|
}
|
726
719
|
);
|
@@ -745,7 +738,7 @@ var QualityMenu = ({ width, onClick }) => {
|
|
745
738
|
);
|
746
739
|
if (qs) {
|
747
740
|
const el = qs == null ? void 0 : qs.find((ele) => ele.default);
|
748
|
-
el ? setCurrentQualitySrc(el.label) : setCurrentQualitySrc(qs[0].label);
|
741
|
+
el ? setCurrentQualitySrc(el == null ? void 0 : el.label) : setCurrentQualitySrc(qs[0].label);
|
749
742
|
}
|
750
743
|
}
|
751
744
|
}, [player]);
|
@@ -789,22 +782,22 @@ var QualityMenu = ({ width, onClick }) => {
|
|
789
782
|
QualityOption,
|
790
783
|
{
|
791
784
|
width,
|
792
|
-
isSelected: currentQualitySrc === q.label,
|
785
|
+
isSelected: currentQualitySrc === (q == null ? void 0 : q.label),
|
793
786
|
quality: q,
|
794
787
|
onClick: () => {
|
795
788
|
const source = qualities.find(
|
796
|
-
(_q) => q.label == _q.label
|
789
|
+
(_q) => (q == null ? void 0 : q.label) == (_q == null ? void 0 : _q.label)
|
797
790
|
);
|
798
791
|
if (source && source.src != currentQualitySrc) {
|
799
792
|
player == null ? void 0 : player.src(source.src);
|
800
793
|
const currentTime = player == null ? void 0 : player.currentTime();
|
801
|
-
setCurrentQualitySrc(source.label);
|
794
|
+
setCurrentQualitySrc(source == null ? void 0 : source.label);
|
802
795
|
player == null ? void 0 : player.currentTime(currentTime);
|
803
796
|
player == null ? void 0 : player.play();
|
804
797
|
}
|
805
798
|
}
|
806
799
|
},
|
807
|
-
`quality-${q.label}-${i}`
|
800
|
+
`quality-${q == null ? void 0 : q.label}-${i}`
|
808
801
|
);
|
809
802
|
}) })
|
810
803
|
] })
|
@@ -924,11 +917,11 @@ var NoteTooltip = ({ note }) => {
|
|
924
917
|
{
|
925
918
|
onClick: handleValueChange,
|
926
919
|
className: "sb-w-1 sb-h-1 sb-rounded-full sb-bg-white sb-absolute sb-z-30",
|
927
|
-
style: { left: `${note.percentage}%` },
|
920
|
+
style: { left: `${note == null ? void 0 : note.percentage}%` },
|
928
921
|
onMouseEnter: () => setOpen(true),
|
929
922
|
onMouseLeave: () => setOpen(false),
|
930
923
|
children: /* @__PURE__ */ jsx24("div", { className: "sb-relative", children: /* @__PURE__ */ jsx24(Tooltip_default, { open, children: /* @__PURE__ */ jsxs8("div", { className: "sb-flex sb-flex-col sb-gap-2 sb-items-center", children: [
|
931
|
-
/* @__PURE__ */ jsx24("p", { children: note.label }),
|
924
|
+
/* @__PURE__ */ jsx24("p", { children: note == null ? void 0 : note.label }),
|
932
925
|
/* @__PURE__ */ jsx24("p", { className: "sb-p-2 sb-bg-[#303030] sb-bg-opacity-50 sb-rounded-md", children: durationFormater(note.time) })
|
933
926
|
] }) }) })
|
934
927
|
}
|
@@ -1219,7 +1212,7 @@ var SubtitleMenu = ({
|
|
1219
1212
|
const [subtitles, setSubtitles] = useState11([]);
|
1220
1213
|
const handleSelectSubtitle = (textTrack) => {
|
1221
1214
|
const newSubtitles = subtitles.map((s) => {
|
1222
|
-
if (s.label === textTrack.label) {
|
1215
|
+
if ((s == null ? void 0 : s.label) === (textTrack == null ? void 0 : textTrack.label)) {
|
1223
1216
|
s.mode = "showing";
|
1224
1217
|
} else {
|
1225
1218
|
s.mode = "disabled";
|
@@ -1380,6 +1373,7 @@ var ControlBar = ({
|
|
1380
1373
|
});
|
1381
1374
|
container && resizeObserver.observe(container);
|
1382
1375
|
const togglePlay = (e) => {
|
1376
|
+
console.log(player.currentTime());
|
1383
1377
|
e.preventDefault();
|
1384
1378
|
e.stopPropagation();
|
1385
1379
|
if (isPaused) player == null ? void 0 : player.play();
|
@@ -1532,6 +1526,9 @@ var ControlBar = ({
|
|
1532
1526
|
};
|
1533
1527
|
var ControlBar_default = ControlBar;
|
1534
1528
|
|
1529
|
+
// src/components/VideoPlayerComponent/index.tsx
|
1530
|
+
import { isEqual } from "lodash";
|
1531
|
+
|
1535
1532
|
// src/components/BigPlayButton/index.tsx
|
1536
1533
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
1537
1534
|
var BigPlayButton = ({ player, isPaused, setIsPaused }) => {
|
@@ -1552,7 +1549,6 @@ var BigPlayButton = ({ player, isPaused, setIsPaused }) => {
|
|
1552
1549
|
var BigPlayButton_default = BigPlayButton;
|
1553
1550
|
|
1554
1551
|
// src/components/VideoPlayerComponent/index.tsx
|
1555
|
-
import { isEqual } from "lodash";
|
1556
1552
|
import { jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
|
1557
1553
|
var bigPlayButtonRoot = {};
|
1558
1554
|
var renderBigPlayButton = (id, player, isPaused, setIsPaused, opacity = "100") => {
|
@@ -1582,22 +1578,20 @@ var controlBarRoot = {};
|
|
1582
1578
|
var renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, chapters, seekStep = 5, handleSaveNoteAction, opacity = "0", handleControlDisplayTimer = () => {
|
1583
1579
|
}, bgColor = "transparent", setIsQualityMenuOpen, setIsSubtitleMenuOpen, disableNote, setNoteOpen, noteButtonClick) => {
|
1584
1580
|
const container = document.getElementById(`video-container-${id}`);
|
1585
|
-
console.log("container: ", container);
|
1586
1581
|
if (container) {
|
1587
|
-
console.log("container1: ");
|
1588
1582
|
container.style.height = "100%";
|
1589
1583
|
container.style.aspectRatio = "16 / 9";
|
1590
1584
|
const element = container.querySelector(".vjs-control-bar");
|
1591
1585
|
if (element) {
|
1592
|
-
console.log("container2: ");
|
1593
1586
|
if (!controlBarRoot[id]) {
|
1587
|
+
console.log("pooklo");
|
1594
1588
|
controlBarRoot[id] = ReactDOM.createRoot(element);
|
1595
|
-
element.style.display = "flex";
|
1596
|
-
element.style.height = "100%";
|
1597
|
-
element.style.alignItems = "flex-end";
|
1598
1589
|
}
|
1590
|
+
element.style.display = "flex";
|
1599
1591
|
element.style.opacity = opacity;
|
1600
1592
|
element.style.backgroundColor = `${bgColor} !important`;
|
1593
|
+
element.style.height = "100%";
|
1594
|
+
element.style.alignItems = "flex-end";
|
1601
1595
|
controlBarRoot[id].render(
|
1602
1596
|
/* @__PURE__ */ jsx36(SoftBuildersVideoPlayerProvider, { children: /* @__PURE__ */ jsx36(
|
1603
1597
|
ControlBar_default,
|
@@ -1637,10 +1631,12 @@ var VideoPlayerComponent = forwardRef(
|
|
1637
1631
|
disableNote,
|
1638
1632
|
childRef,
|
1639
1633
|
bottomRedBar = true,
|
1640
|
-
noteButtonClick
|
1641
|
-
|
1634
|
+
noteButtonClick,
|
1635
|
+
videoID
|
1636
|
+
}) => {
|
1642
1637
|
const videoRef = useRef2(void 0);
|
1643
1638
|
const playerRef = useRef2(void 0);
|
1639
|
+
const idRef = useRef2(void 0);
|
1644
1640
|
const [isReady, setIsReady] = useState14(false);
|
1645
1641
|
const [isPaused, setIsPaused] = useState14(!options.autoplay);
|
1646
1642
|
const [duration, setDuration] = useState14(1);
|
@@ -1649,14 +1645,14 @@ var VideoPlayerComponent = forwardRef(
|
|
1649
1645
|
const [bgColor, setBgColor] = useState14("transparent");
|
1650
1646
|
const [isQualityMenuOpen, setIsQualityMenuOpen] = useState14(false);
|
1651
1647
|
const [isSubtitleMenuOpen, setIsSubtitleMenuOpen] = useState14(false);
|
1648
|
+
const [isHovered, setIsHovered] = useState14(false);
|
1652
1649
|
const [isNoteOpen, setNoteOpen] = useState14(false);
|
1653
|
-
console.log("notes", notes);
|
1654
1650
|
const onReady = (player) => {
|
1655
|
-
console.log("onReady: ", onReady);
|
1656
1651
|
if (playerRef) {
|
1657
1652
|
playerRef.current = player;
|
1658
1653
|
setIsReady(true);
|
1659
1654
|
player == null ? void 0 : player.currentTime(startTime);
|
1655
|
+
console.log("startTime: ", startTime);
|
1660
1656
|
player.on("waiting", () => {
|
1661
1657
|
});
|
1662
1658
|
player.on("dispose", () => {
|
@@ -1669,41 +1665,30 @@ var VideoPlayerComponent = forwardRef(
|
|
1669
1665
|
});
|
1670
1666
|
}
|
1671
1667
|
};
|
1672
|
-
const initializePlayer = () => {
|
1673
|
-
const videoElement = document.createElement("video-js");
|
1674
|
-
videoElement.setAttribute("playsinline", "true");
|
1675
|
-
videoElement.classList.add("vjs-big-play-centered");
|
1676
|
-
if (poster) {
|
1677
|
-
videoElement.setAttribute("poster", poster);
|
1678
|
-
}
|
1679
|
-
videoRef.current.appendChild(videoElement);
|
1680
|
-
videoElement.style.width = "100%";
|
1681
|
-
videoElement.style.height = "100%";
|
1682
|
-
playerRef.current = videojs(videoElement, options, () => {
|
1683
|
-
var _a;
|
1684
|
-
(_a = playerRef.current) == null ? void 0 : _a.currentTime(startTime);
|
1685
|
-
});
|
1686
|
-
onReady(playerRef.current);
|
1687
|
-
};
|
1688
1668
|
useEffect14(() => {
|
1689
|
-
if (playerRef.current) {
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1669
|
+
if (!playerRef.current) {
|
1670
|
+
const videoElement = document.createElement("video-js");
|
1671
|
+
videoElement.setAttribute("playsinline", "true");
|
1672
|
+
videoElement.classList.add("vjs-big-play-centered");
|
1673
|
+
if (poster) {
|
1674
|
+
videoElement.setAttribute("poster", poster);
|
1694
1675
|
}
|
1676
|
+
videoRef.current.appendChild(videoElement);
|
1677
|
+
videoElement.style.width = "100%";
|
1678
|
+
videoElement.style.height = "100%";
|
1679
|
+
videoElement.style.objectFit = "cover";
|
1680
|
+
playerRef.current = videojs(videoElement, options, () => {
|
1681
|
+
onReady(playerRef.current);
|
1682
|
+
});
|
1695
1683
|
}
|
1696
|
-
initializePlayer();
|
1697
|
-
console.log("initializePlayer: ghhh");
|
1698
|
-
}, [options]);
|
1699
|
-
useEffect14(() => {
|
1700
1684
|
return () => {
|
1685
|
+
var _a, _b;
|
1701
1686
|
if (playerRef.current) {
|
1702
|
-
|
1703
|
-
|
1687
|
+
if (!isEqual((_b = (_a = idRef == null ? void 0 : idRef.current) == null ? void 0 : _a.sources) != null ? _b : "", options.sources)) {
|
1688
|
+
idRef.current = options;
|
1704
1689
|
playerRef.current.dispose();
|
1705
|
-
console.log("dispose7: ");
|
1706
1690
|
playerRef.current = void 0;
|
1691
|
+
console.log("dispose8: ");
|
1707
1692
|
setTimeout(() => {
|
1708
1693
|
if (bigPlayButtonRoot[id]) {
|
1709
1694
|
bigPlayButtonRoot[id].unmount();
|
@@ -1718,55 +1703,56 @@ var VideoPlayerComponent = forwardRef(
|
|
1718
1703
|
}
|
1719
1704
|
};
|
1720
1705
|
}, [options]);
|
1706
|
+
useEffect14(() => {
|
1707
|
+
if (playerRef.current) {
|
1708
|
+
console.log("time");
|
1709
|
+
playerRef.current.currentTime(startTime);
|
1710
|
+
}
|
1711
|
+
}, [startTime]);
|
1721
1712
|
useEffect14(() => {
|
1722
1713
|
if (playerRef.current && isReady) {
|
1723
1714
|
const currentTime = playerRef.current.currentTime() || 0;
|
1715
|
+
console.log("currentTime: ", currentTime);
|
1724
1716
|
if (isPaused) {
|
1725
1717
|
if (onPause) onPause(currentTime);
|
1726
1718
|
} else {
|
1727
1719
|
if (onPlay) onPlay(currentTime);
|
1728
1720
|
}
|
1729
1721
|
}
|
1730
|
-
}, [isPaused
|
1722
|
+
}, [isPaused]);
|
1731
1723
|
useEffect14(() => {
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
}, 0);
|
1757
|
-
return () => clearTimeout(controlBarTimeout);
|
1758
|
-
}
|
1724
|
+
const controlBarTimeout = setTimeout(() => {
|
1725
|
+
renderControlBar(
|
1726
|
+
id,
|
1727
|
+
playerRef.current,
|
1728
|
+
isPaused,
|
1729
|
+
setIsPaused,
|
1730
|
+
duration,
|
1731
|
+
notes,
|
1732
|
+
chapters,
|
1733
|
+
5,
|
1734
|
+
handleSaveNoteAction,
|
1735
|
+
opacity,
|
1736
|
+
(e) => {
|
1737
|
+
handlePlayerClick(e, true);
|
1738
|
+
},
|
1739
|
+
bgColor,
|
1740
|
+
setIsQualityMenuOpen,
|
1741
|
+
setIsSubtitleMenuOpen,
|
1742
|
+
disableNote,
|
1743
|
+
setNoteOpen,
|
1744
|
+
noteButtonClick
|
1745
|
+
);
|
1746
|
+
}, 0);
|
1747
|
+
return () => clearTimeout(controlBarTimeout);
|
1759
1748
|
}, [
|
1760
|
-
id,
|
1761
|
-
playerRef,
|
1762
1749
|
isPaused,
|
1763
1750
|
setIsPaused,
|
1764
1751
|
notes,
|
1765
|
-
chapters,
|
1766
|
-
isReady,
|
1767
1752
|
handleSaveNoteAction,
|
1768
1753
|
duration,
|
1769
|
-
opacity
|
1754
|
+
opacity,
|
1755
|
+
isReady
|
1770
1756
|
]);
|
1771
1757
|
useEffect14(() => {
|
1772
1758
|
if (isReady) {
|
@@ -1781,36 +1767,15 @@ var VideoPlayerComponent = forwardRef(
|
|
1781
1767
|
}, 500);
|
1782
1768
|
return () => clearTimeout(playButtonTimeout);
|
1783
1769
|
}
|
1784
|
-
}, [
|
1770
|
+
}, [isPaused, opacity, isReady, options]);
|
1785
1771
|
useEffect14(() => {
|
1786
1772
|
if (playerRef.current) {
|
1787
|
-
playerRef.current.dispose();
|
1788
|
-
console.log("dispose7: ");
|
1789
|
-
playerRef.current = void 0;
|
1790
|
-
setTimeout(() => {
|
1791
|
-
if (bigPlayButtonRoot[id]) {
|
1792
|
-
bigPlayButtonRoot[id].unmount();
|
1793
|
-
bigPlayButtonRoot[id] = void 0;
|
1794
|
-
}
|
1795
|
-
if (controlBarRoot[id]) {
|
1796
|
-
controlBarRoot[id].unmount();
|
1797
|
-
controlBarRoot[id] = void 0;
|
1798
|
-
}
|
1799
|
-
}, 0);
|
1800
1773
|
const intervalId = setInterval(() => {
|
1801
1774
|
if (playerRef.current) setIsPaused(playerRef.current.paused());
|
1802
1775
|
}, 500);
|
1803
1776
|
return () => clearInterval(intervalId);
|
1804
1777
|
}
|
1805
1778
|
}, []);
|
1806
|
-
useEffect14(() => {
|
1807
|
-
var _a, _b;
|
1808
|
-
if (playerRef.current) {
|
1809
|
-
(_a = playerRef.current) == null ? void 0 : _a.currentTime(startTime);
|
1810
|
-
console.log("startTimenotes: ", startTime);
|
1811
|
-
(_b = playerRef.current) == null ? void 0 : _b.play();
|
1812
|
-
}
|
1813
|
-
}, [startTime]);
|
1814
1779
|
const timeoutRef = useRef2(null);
|
1815
1780
|
useEffect14(() => {
|
1816
1781
|
if (isQualityMenuOpen || isSubtitleMenuOpen) {
|
@@ -1829,8 +1794,20 @@ var VideoPlayerComponent = forwardRef(
|
|
1829
1794
|
}
|
1830
1795
|
}, [isQualityMenuOpen, isSubtitleMenuOpen]);
|
1831
1796
|
useEffect14(() => {
|
1832
|
-
console.log("
|
1833
|
-
|
1797
|
+
console.log("isNoteOpen: ", isNoteOpen);
|
1798
|
+
if (isNoteOpen) {
|
1799
|
+
if (timeoutRef.current) {
|
1800
|
+
clearTimeout(timeoutRef.current);
|
1801
|
+
}
|
1802
|
+
} else {
|
1803
|
+
if (timeoutRef.current) {
|
1804
|
+
clearTimeout(timeoutRef.current);
|
1805
|
+
}
|
1806
|
+
timeoutRef.current = setTimeout(() => {
|
1807
|
+
setIsControlBarPresent(false);
|
1808
|
+
}, 3e3);
|
1809
|
+
}
|
1810
|
+
}, [isNoteOpen]);
|
1834
1811
|
const handlePlayerClick = async (e, isTimerOnly = false) => {
|
1835
1812
|
e.preventDefault();
|
1836
1813
|
if (timeoutRef.current) {
|
@@ -1852,7 +1829,6 @@ var VideoPlayerComponent = forwardRef(
|
|
1852
1829
|
if (playerRef.current) {
|
1853
1830
|
if (playerRef.current.paused()) {
|
1854
1831
|
try {
|
1855
|
-
console.log("startTime: ", startTime);
|
1856
1832
|
await playerRef.current.play();
|
1857
1833
|
setIsPaused(false);
|
1858
1834
|
} catch (error) {
|
@@ -1900,9 +1876,10 @@ var VideoPlayerComponent = forwardRef(
|
|
1900
1876
|
const [timeSeeker, setTimeSeeker] = useState14("0");
|
1901
1877
|
useEffect14(() => {
|
1902
1878
|
const updateTimeSeeker = () => {
|
1903
|
-
if (playerRef.current) {
|
1879
|
+
if (playerRef.current && isReady) {
|
1904
1880
|
const currentTime = playerRef.current.currentTime();
|
1905
1881
|
const duration2 = playerRef.current.duration();
|
1882
|
+
console.log("duration: ", duration2, currentTime);
|
1906
1883
|
if (duration2 && currentTime !== void 0) {
|
1907
1884
|
setTimeSeeker(`${currentTime / duration2 * 100}%`);
|
1908
1885
|
} else {
|
@@ -1918,10 +1895,12 @@ var VideoPlayerComponent = forwardRef(
|
|
1918
1895
|
{
|
1919
1896
|
ref: videoRefs,
|
1920
1897
|
id: `video-container-${id}`,
|
1921
|
-
onMouseMove: (
|
1922
|
-
handlePlayerClick(
|
1898
|
+
onMouseMove: () => {
|
1899
|
+
!isNoteOpen ? handlePlayerClick(event, true) : "";
|
1923
1900
|
},
|
1924
1901
|
className: "sb-relative sb-rounded-md sb-overflow-hidden sb-w-full sb-h-full sb-bottom-2 ",
|
1902
|
+
onMouseEnter: () => setIsHovered(true),
|
1903
|
+
onMouseLeave: () => setIsHovered(false),
|
1925
1904
|
children: [
|
1926
1905
|
bottomRedBar && /* @__PURE__ */ jsx36(
|
1927
1906
|
"div",
|
@@ -1982,40 +1961,52 @@ var Component = forwardRef2(
|
|
1982
1961
|
disableNote,
|
1983
1962
|
childRef,
|
1984
1963
|
bottomRedBar,
|
1985
|
-
noteButtonClick
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
[options]
|
1994
|
-
);
|
1995
|
-
const [tracks, setTracks] = useState15([]);
|
1996
|
-
const getTracks = useCallback4(async () => {
|
1997
|
-
const newTracks = [];
|
1998
|
-
if (Array.isArray(mergedOptions.tracks)) {
|
1999
|
-
for (const s of mergedOptions.tracks) {
|
2000
|
-
let src = s.src;
|
2001
|
-
if (s.memeType === "text/srt") {
|
2002
|
-
src = await convertSRTtoVTT(s.src);
|
2003
|
-
}
|
2004
|
-
newTracks.push(__spreadProps(__spreadValues({}, s), { src }));
|
2005
|
-
}
|
1964
|
+
noteButtonClick,
|
1965
|
+
videoId
|
1966
|
+
}) => {
|
1967
|
+
options = __spreadProps(__spreadValues({}, options), {
|
1968
|
+
responsive: true,
|
1969
|
+
inactivityTimeout: 0,
|
1970
|
+
fullscreen: {
|
1971
|
+
navigationUI: "hide"
|
2006
1972
|
}
|
2007
|
-
|
2008
|
-
|
1973
|
+
});
|
1974
|
+
if (options.autoplay === void 0)
|
1975
|
+
options.autoplay = DEFAULT_OPTIONS.autoplay;
|
1976
|
+
if (options.controls === void 0)
|
1977
|
+
options.controls = DEFAULT_OPTIONS.controls;
|
1978
|
+
if (options.fluid === void 0) options.fluid = DEFAULT_OPTIONS.fluid;
|
1979
|
+
if ((options == null ? void 0 : options.muted) === void 0) options.muted = DEFAULT_OPTIONS == null ? void 0 : DEFAULT_OPTIONS.muted;
|
1980
|
+
if (options.height === void 0) options.height = DEFAULT_OPTIONS.height;
|
1981
|
+
if (options.width === void 0) options.width = DEFAULT_OPTIONS.width;
|
1982
|
+
const [tracks, setTracks] = useState15([]);
|
1983
|
+
useEffect15(() => {
|
1984
|
+
}, [isFocused]);
|
2009
1985
|
useEffect15(() => {
|
1986
|
+
const getTracks = async () => {
|
1987
|
+
const newTracks = [];
|
1988
|
+
if (Array.isArray(options == null ? void 0 : options.tracks))
|
1989
|
+
for (const [i, s] of options == null ? void 0 : options.tracks.entries()) {
|
1990
|
+
let src = s.src;
|
1991
|
+
if (s.memeType == "text/srt") {
|
1992
|
+
src = await convertSRTtoVTT(s.src);
|
1993
|
+
}
|
1994
|
+
newTracks.push(__spreadProps(__spreadValues({}, s), {
|
1995
|
+
src
|
1996
|
+
}));
|
1997
|
+
}
|
1998
|
+
setTracks(newTracks);
|
1999
|
+
};
|
2010
2000
|
getTracks();
|
2011
|
-
}, [
|
2012
|
-
const id =
|
2001
|
+
}, [options == null ? void 0 : options.tracks]);
|
2002
|
+
const id = (Date.now() + Math.random() * 100).toString();
|
2003
|
+
console.log("id: ", id);
|
2013
2004
|
return /* @__PURE__ */ jsx37(
|
2014
2005
|
VideoPlayerComponent_default,
|
2015
2006
|
{
|
2016
|
-
id,
|
2007
|
+
id: "videoID",
|
2017
2008
|
chapters,
|
2018
|
-
options: __spreadProps(__spreadValues({},
|
2009
|
+
options: __spreadProps(__spreadValues({}, options), { tracks }),
|
2019
2010
|
notes,
|
2020
2011
|
poster: "",
|
2021
2012
|
startTime,
|
@@ -2031,8 +2022,6 @@ var Component = forwardRef2(
|
|
2031
2022
|
}
|
2032
2023
|
);
|
2033
2024
|
var SoftBuildersVideoPlayer = memo(Component, (prevProps, nextProps) => {
|
2034
|
-
console.log(isEqual2(prevProps.options, nextProps.options));
|
2035
|
-
console.log(nextProps.notes, prevProps.notes);
|
2036
2025
|
return isEqual2(prevProps.options, nextProps.options) && prevProps.notes === nextProps.notes && prevProps.chapters === nextProps.chapters && prevProps.startTime === nextProps.startTime;
|
2037
2026
|
});
|
2038
2027
|
var SoftBuildersVideoPlayer_default = SoftBuildersVideoPlayer;
|