softbuilders-react-video-player 1.2.4 → 1.2.6
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/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 +121 -111
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +135 -147
- 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";
|
@@ -1532,6 +1525,9 @@ var ControlBar = ({
|
|
1532
1525
|
};
|
1533
1526
|
var ControlBar_default = ControlBar;
|
1534
1527
|
|
1528
|
+
// src/components/VideoPlayerComponent/index.tsx
|
1529
|
+
import { isEqual } from "lodash";
|
1530
|
+
|
1535
1531
|
// src/components/BigPlayButton/index.tsx
|
1536
1532
|
import { jsx as jsx35 } from "react/jsx-runtime";
|
1537
1533
|
var BigPlayButton = ({ player, isPaused, setIsPaused }) => {
|
@@ -1552,7 +1548,6 @@ var BigPlayButton = ({ player, isPaused, setIsPaused }) => {
|
|
1552
1548
|
var BigPlayButton_default = BigPlayButton;
|
1553
1549
|
|
1554
1550
|
// src/components/VideoPlayerComponent/index.tsx
|
1555
|
-
import { isEqual } from "lodash";
|
1556
1551
|
import { jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
|
1557
1552
|
var bigPlayButtonRoot = {};
|
1558
1553
|
var renderBigPlayButton = (id, player, isPaused, setIsPaused, opacity = "100") => {
|
@@ -1582,22 +1577,20 @@ var controlBarRoot = {};
|
|
1582
1577
|
var renderControlBar = (id, player, isPaused, setIsPaused, duration, notes, chapters, seekStep = 5, handleSaveNoteAction, opacity = "0", handleControlDisplayTimer = () => {
|
1583
1578
|
}, bgColor = "transparent", setIsQualityMenuOpen, setIsSubtitleMenuOpen, disableNote, setNoteOpen, noteButtonClick) => {
|
1584
1579
|
const container = document.getElementById(`video-container-${id}`);
|
1585
|
-
console.log("container: ", container);
|
1586
1580
|
if (container) {
|
1587
|
-
console.log("container1: ");
|
1588
1581
|
container.style.height = "100%";
|
1589
1582
|
container.style.aspectRatio = "16 / 9";
|
1590
1583
|
const element = container.querySelector(".vjs-control-bar");
|
1591
1584
|
if (element) {
|
1592
|
-
console.log("container2: ");
|
1593
1585
|
if (!controlBarRoot[id]) {
|
1586
|
+
console.log("pooklo");
|
1594
1587
|
controlBarRoot[id] = ReactDOM.createRoot(element);
|
1595
|
-
element.style.display = "flex";
|
1596
|
-
element.style.height = "100%";
|
1597
|
-
element.style.alignItems = "flex-end";
|
1598
1588
|
}
|
1589
|
+
element.style.display = "flex";
|
1599
1590
|
element.style.opacity = opacity;
|
1600
1591
|
element.style.backgroundColor = `${bgColor} !important`;
|
1592
|
+
element.style.height = "100%";
|
1593
|
+
element.style.alignItems = "flex-end";
|
1601
1594
|
controlBarRoot[id].render(
|
1602
1595
|
/* @__PURE__ */ jsx36(SoftBuildersVideoPlayerProvider, { children: /* @__PURE__ */ jsx36(
|
1603
1596
|
ControlBar_default,
|
@@ -1637,10 +1630,12 @@ var VideoPlayerComponent = forwardRef(
|
|
1637
1630
|
disableNote,
|
1638
1631
|
childRef,
|
1639
1632
|
bottomRedBar = true,
|
1640
|
-
noteButtonClick
|
1633
|
+
noteButtonClick,
|
1634
|
+
videoID
|
1641
1635
|
}, ref) => {
|
1642
1636
|
const videoRef = useRef2(void 0);
|
1643
1637
|
const playerRef = useRef2(void 0);
|
1638
|
+
const idRef = useRef2(void 0);
|
1644
1639
|
const [isReady, setIsReady] = useState14(false);
|
1645
1640
|
const [isPaused, setIsPaused] = useState14(!options.autoplay);
|
1646
1641
|
const [duration, setDuration] = useState14(1);
|
@@ -1649,14 +1644,14 @@ var VideoPlayerComponent = forwardRef(
|
|
1649
1644
|
const [bgColor, setBgColor] = useState14("transparent");
|
1650
1645
|
const [isQualityMenuOpen, setIsQualityMenuOpen] = useState14(false);
|
1651
1646
|
const [isSubtitleMenuOpen, setIsSubtitleMenuOpen] = useState14(false);
|
1647
|
+
const [isHovered, setIsHovered] = useState14(false);
|
1652
1648
|
const [isNoteOpen, setNoteOpen] = useState14(false);
|
1653
|
-
console.log("notes", notes);
|
1654
1649
|
const onReady = (player) => {
|
1655
|
-
console.log("onReady: ", onReady);
|
1656
1650
|
if (playerRef) {
|
1657
1651
|
playerRef.current = player;
|
1658
1652
|
setIsReady(true);
|
1659
1653
|
player == null ? void 0 : player.currentTime(startTime);
|
1654
|
+
console.log("startTime: ", startTime);
|
1660
1655
|
player.on("waiting", () => {
|
1661
1656
|
});
|
1662
1657
|
player.on("dispose", () => {
|
@@ -1669,41 +1664,30 @@ var VideoPlayerComponent = forwardRef(
|
|
1669
1664
|
});
|
1670
1665
|
}
|
1671
1666
|
};
|
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
1667
|
useEffect14(() => {
|
1689
|
-
if (playerRef.current) {
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1668
|
+
if (!playerRef.current) {
|
1669
|
+
const videoElement = document.createElement("video-js");
|
1670
|
+
videoElement.setAttribute("playsinline", "true");
|
1671
|
+
videoElement.classList.add("vjs-big-play-centered");
|
1672
|
+
if (poster) {
|
1673
|
+
videoElement.setAttribute("poster", poster);
|
1694
1674
|
}
|
1675
|
+
videoRef.current.appendChild(videoElement);
|
1676
|
+
videoElement.style.width = "100%";
|
1677
|
+
videoElement.style.height = "100%";
|
1678
|
+
videoElement.style.objectFit = "cover";
|
1679
|
+
playerRef.current = videojs(videoElement, options, () => {
|
1680
|
+
onReady(playerRef.current);
|
1681
|
+
});
|
1695
1682
|
}
|
1696
|
-
initializePlayer();
|
1697
|
-
console.log("initializePlayer: ghhh");
|
1698
|
-
}, [options]);
|
1699
|
-
useEffect14(() => {
|
1700
1683
|
return () => {
|
1684
|
+
var _a, _b;
|
1701
1685
|
if (playerRef.current) {
|
1702
|
-
|
1703
|
-
|
1686
|
+
if (!isEqual((_b = (_a = idRef == null ? void 0 : idRef.current) == null ? void 0 : _a.sources) != null ? _b : "", options.sources)) {
|
1687
|
+
idRef.current = options;
|
1704
1688
|
playerRef.current.dispose();
|
1705
|
-
console.log("dispose7: ");
|
1706
1689
|
playerRef.current = void 0;
|
1690
|
+
console.log("dispose8: ");
|
1707
1691
|
setTimeout(() => {
|
1708
1692
|
if (bigPlayButtonRoot[id]) {
|
1709
1693
|
bigPlayButtonRoot[id].unmount();
|
@@ -1718,55 +1702,56 @@ var VideoPlayerComponent = forwardRef(
|
|
1718
1702
|
}
|
1719
1703
|
};
|
1720
1704
|
}, [options]);
|
1705
|
+
useEffect14(() => {
|
1706
|
+
if (playerRef.current) {
|
1707
|
+
console.log("time");
|
1708
|
+
playerRef.current.currentTime(startTime);
|
1709
|
+
}
|
1710
|
+
}, [startTime]);
|
1721
1711
|
useEffect14(() => {
|
1722
1712
|
if (playerRef.current && isReady) {
|
1723
1713
|
const currentTime = playerRef.current.currentTime() || 0;
|
1714
|
+
console.log("currentTime: ", currentTime);
|
1724
1715
|
if (isPaused) {
|
1725
1716
|
if (onPause) onPause(currentTime);
|
1726
1717
|
} else {
|
1727
1718
|
if (onPlay) onPlay(currentTime);
|
1728
1719
|
}
|
1729
1720
|
}
|
1730
|
-
}, [isPaused
|
1721
|
+
}, [isPaused]);
|
1731
1722
|
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
|
-
}
|
1723
|
+
const controlBarTimeout = setTimeout(() => {
|
1724
|
+
renderControlBar(
|
1725
|
+
id,
|
1726
|
+
playerRef.current,
|
1727
|
+
isPaused,
|
1728
|
+
setIsPaused,
|
1729
|
+
duration,
|
1730
|
+
notes,
|
1731
|
+
chapters,
|
1732
|
+
5,
|
1733
|
+
handleSaveNoteAction,
|
1734
|
+
opacity,
|
1735
|
+
(e) => {
|
1736
|
+
handlePlayerClick(e, true);
|
1737
|
+
},
|
1738
|
+
bgColor,
|
1739
|
+
setIsQualityMenuOpen,
|
1740
|
+
setIsSubtitleMenuOpen,
|
1741
|
+
disableNote,
|
1742
|
+
setNoteOpen,
|
1743
|
+
noteButtonClick
|
1744
|
+
);
|
1745
|
+
}, 0);
|
1746
|
+
return () => clearTimeout(controlBarTimeout);
|
1759
1747
|
}, [
|
1760
|
-
id,
|
1761
|
-
playerRef,
|
1762
1748
|
isPaused,
|
1763
1749
|
setIsPaused,
|
1764
1750
|
notes,
|
1765
|
-
chapters,
|
1766
|
-
isReady,
|
1767
1751
|
handleSaveNoteAction,
|
1768
1752
|
duration,
|
1769
|
-
opacity
|
1753
|
+
opacity,
|
1754
|
+
isReady
|
1770
1755
|
]);
|
1771
1756
|
useEffect14(() => {
|
1772
1757
|
if (isReady) {
|
@@ -1781,36 +1766,15 @@ var VideoPlayerComponent = forwardRef(
|
|
1781
1766
|
}, 500);
|
1782
1767
|
return () => clearTimeout(playButtonTimeout);
|
1783
1768
|
}
|
1784
|
-
}, [
|
1769
|
+
}, [isPaused, opacity, isReady, options]);
|
1785
1770
|
useEffect14(() => {
|
1786
1771
|
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
1772
|
const intervalId = setInterval(() => {
|
1801
1773
|
if (playerRef.current) setIsPaused(playerRef.current.paused());
|
1802
1774
|
}, 500);
|
1803
1775
|
return () => clearInterval(intervalId);
|
1804
1776
|
}
|
1805
1777
|
}, []);
|
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
1778
|
const timeoutRef = useRef2(null);
|
1815
1779
|
useEffect14(() => {
|
1816
1780
|
if (isQualityMenuOpen || isSubtitleMenuOpen) {
|
@@ -1829,8 +1793,20 @@ var VideoPlayerComponent = forwardRef(
|
|
1829
1793
|
}
|
1830
1794
|
}, [isQualityMenuOpen, isSubtitleMenuOpen]);
|
1831
1795
|
useEffect14(() => {
|
1832
|
-
console.log("
|
1833
|
-
|
1796
|
+
console.log("isNoteOpen: ", isNoteOpen);
|
1797
|
+
if (isNoteOpen) {
|
1798
|
+
if (timeoutRef.current) {
|
1799
|
+
clearTimeout(timeoutRef.current);
|
1800
|
+
}
|
1801
|
+
} else {
|
1802
|
+
if (timeoutRef.current) {
|
1803
|
+
clearTimeout(timeoutRef.current);
|
1804
|
+
}
|
1805
|
+
timeoutRef.current = setTimeout(() => {
|
1806
|
+
setIsControlBarPresent(false);
|
1807
|
+
}, 3e3);
|
1808
|
+
}
|
1809
|
+
}, [isNoteOpen]);
|
1834
1810
|
const handlePlayerClick = async (e, isTimerOnly = false) => {
|
1835
1811
|
e.preventDefault();
|
1836
1812
|
if (timeoutRef.current) {
|
@@ -1852,7 +1828,6 @@ var VideoPlayerComponent = forwardRef(
|
|
1852
1828
|
if (playerRef.current) {
|
1853
1829
|
if (playerRef.current.paused()) {
|
1854
1830
|
try {
|
1855
|
-
console.log("startTime: ", startTime);
|
1856
1831
|
await playerRef.current.play();
|
1857
1832
|
setIsPaused(false);
|
1858
1833
|
} catch (error) {
|
@@ -1900,9 +1875,10 @@ var VideoPlayerComponent = forwardRef(
|
|
1900
1875
|
const [timeSeeker, setTimeSeeker] = useState14("0");
|
1901
1876
|
useEffect14(() => {
|
1902
1877
|
const updateTimeSeeker = () => {
|
1903
|
-
if (playerRef.current) {
|
1878
|
+
if (playerRef.current && isReady) {
|
1904
1879
|
const currentTime = playerRef.current.currentTime();
|
1905
1880
|
const duration2 = playerRef.current.duration();
|
1881
|
+
console.log("duration: ", duration2, currentTime);
|
1906
1882
|
if (duration2 && currentTime !== void 0) {
|
1907
1883
|
setTimeSeeker(`${currentTime / duration2 * 100}%`);
|
1908
1884
|
} else {
|
@@ -1918,10 +1894,12 @@ var VideoPlayerComponent = forwardRef(
|
|
1918
1894
|
{
|
1919
1895
|
ref: videoRefs,
|
1920
1896
|
id: `video-container-${id}`,
|
1921
|
-
onMouseMove: (
|
1922
|
-
handlePlayerClick(
|
1897
|
+
onMouseMove: () => {
|
1898
|
+
!isNoteOpen ? handlePlayerClick(event, true) : "";
|
1923
1899
|
},
|
1924
1900
|
className: "sb-relative sb-rounded-md sb-overflow-hidden sb-w-full sb-h-full sb-bottom-2 ",
|
1901
|
+
onMouseEnter: () => setIsHovered(true),
|
1902
|
+
onMouseLeave: () => setIsHovered(false),
|
1925
1903
|
children: [
|
1926
1904
|
bottomRedBar && /* @__PURE__ */ jsx36(
|
1927
1905
|
"div",
|
@@ -1982,40 +1960,52 @@ var Component = forwardRef2(
|
|
1982
1960
|
disableNote,
|
1983
1961
|
childRef,
|
1984
1962
|
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
|
-
}
|
1963
|
+
noteButtonClick,
|
1964
|
+
videoId
|
1965
|
+
}) => {
|
1966
|
+
options = __spreadProps(__spreadValues({}, options), {
|
1967
|
+
responsive: true,
|
1968
|
+
inactivityTimeout: 0,
|
1969
|
+
fullscreen: {
|
1970
|
+
navigationUI: "hide"
|
2006
1971
|
}
|
2007
|
-
|
2008
|
-
|
1972
|
+
});
|
1973
|
+
if (options.autoplay === void 0)
|
1974
|
+
options.autoplay = DEFAULT_OPTIONS.autoplay;
|
1975
|
+
if (options.controls === void 0)
|
1976
|
+
options.controls = DEFAULT_OPTIONS.controls;
|
1977
|
+
if (options.fluid === void 0) options.fluid = DEFAULT_OPTIONS.fluid;
|
1978
|
+
if ((options == null ? void 0 : options.muted) === void 0) options.muted = DEFAULT_OPTIONS == null ? void 0 : DEFAULT_OPTIONS.muted;
|
1979
|
+
if (options.height === void 0) options.height = DEFAULT_OPTIONS.height;
|
1980
|
+
if (options.width === void 0) options.width = DEFAULT_OPTIONS.width;
|
1981
|
+
const [tracks, setTracks] = useState15([]);
|
1982
|
+
useEffect15(() => {
|
1983
|
+
}, [isFocused]);
|
2009
1984
|
useEffect15(() => {
|
1985
|
+
const getTracks = async () => {
|
1986
|
+
const newTracks = [];
|
1987
|
+
if (Array.isArray(options == null ? void 0 : options.tracks))
|
1988
|
+
for (const [i, s] of options == null ? void 0 : options.tracks.entries()) {
|
1989
|
+
let src = s.src;
|
1990
|
+
if (s.memeType == "text/srt") {
|
1991
|
+
src = await convertSRTtoVTT(s.src);
|
1992
|
+
}
|
1993
|
+
newTracks.push(__spreadProps(__spreadValues({}, s), {
|
1994
|
+
src
|
1995
|
+
}));
|
1996
|
+
}
|
1997
|
+
setTracks(newTracks);
|
1998
|
+
};
|
2010
1999
|
getTracks();
|
2011
|
-
}, [
|
2012
|
-
const id =
|
2000
|
+
}, [options == null ? void 0 : options.tracks]);
|
2001
|
+
const id = (Date.now() + Math.random() * 100).toString();
|
2002
|
+
console.log("id: ", id);
|
2013
2003
|
return /* @__PURE__ */ jsx37(
|
2014
2004
|
VideoPlayerComponent_default,
|
2015
2005
|
{
|
2016
|
-
id,
|
2006
|
+
id: "videoID",
|
2017
2007
|
chapters,
|
2018
|
-
options: __spreadProps(__spreadValues({},
|
2008
|
+
options: __spreadProps(__spreadValues({}, options), { tracks }),
|
2019
2009
|
notes,
|
2020
2010
|
poster: "",
|
2021
2011
|
startTime,
|
@@ -2031,8 +2021,6 @@ var Component = forwardRef2(
|
|
2031
2021
|
}
|
2032
2022
|
);
|
2033
2023
|
var SoftBuildersVideoPlayer = memo(Component, (prevProps, nextProps) => {
|
2034
|
-
console.log(isEqual2(prevProps.options, nextProps.options));
|
2035
|
-
console.log(nextProps.notes, prevProps.notes);
|
2036
2024
|
return isEqual2(prevProps.options, nextProps.options) && prevProps.notes === nextProps.notes && prevProps.chapters === nextProps.chapters && prevProps.startTime === nextProps.startTime;
|
2037
2025
|
});
|
2038
2026
|
var SoftBuildersVideoPlayer_default = SoftBuildersVideoPlayer;
|