softbuilders-react-video-player 1.2.24 → 1.3.1

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/index.mjs CHANGED
@@ -727,33 +727,33 @@ var VolumeSlider = ({
727
727
  return /* @__PURE__ */ jsxs7(
728
728
  "div",
729
729
  {
730
- className: `sb-flex ${isVisible ? "" : ""} ${width > 400 && !isTrailer ? "sb-flex-col-reverse" : `sb-flex-col ${isTrailer ? "sb-justify-start" : ""}`} sb-items-center sb-gap-1 sb-h-full`,
730
+ className: `sb-flex ${isVisible ? "" : ""} ${(width > 400 || (player == null ? void 0 : player.isFullscreen_) === true) && !isTrailer ? "sb-flex-col-reverse" : `sb-flex-col ${isTrailer ? "sb-justify-start" : ""}`} sb-items-center sb-gap-1 sb-h-full`,
731
731
  children: [
732
732
  /* @__PURE__ */ jsx24(
733
733
  "div",
734
734
  {
735
- className: `sb-flex sb-relative ${width < 400 || isTrailer ? "-sb-top-1" : "sb-top-1"}`,
735
+ className: `sb-flex sb-relative ${width < 400 && (player == null ? void 0 : player.isFullscreen_) === false || isTrailer ? "-sb-top-1" : "sb-top-1"}`,
736
736
  onClick: toggleVisibility,
737
737
  onDoubleClick: handleDoubleClick,
738
738
  children: volume == 0 || (player == null ? void 0 : player.muted()) ? /* @__PURE__ */ jsx24(
739
739
  VolumeMute_default,
740
740
  {
741
- className: `sb-w-3 sb-h-3 ${width < 400 || isTrailer ? "" : ""} sb-h-5 sb-w-5`
741
+ className: `sb-w-3 sb-h-3 ${width < 400 && (player == null ? void 0 : player.isFullscreen_) === false || isTrailer ? "" : ""} sb-h-5 sb-w-5`
742
742
  }
743
743
  ) : volume < 25 ? /* @__PURE__ */ jsx24(
744
744
  VolumeVLow_default,
745
745
  {
746
- className: `sb-w-3 sb-h-3 ${width < 400 || isTrailer ? "" : ""} sb-h-5 sb-w-5`
746
+ className: `sb-w-3 sb-h-3 ${width < 400 && (player == null ? void 0 : player.isFullscreen_) === false || isTrailer ? "" : ""} sb-h-5 sb-w-5`
747
747
  }
748
748
  ) : volume < 50 ? /* @__PURE__ */ jsx24(
749
749
  VolumeLow_default,
750
750
  {
751
- className: `sb-w-3 sb-h-3 ${width < 400 || isTrailer ? "" : ""} sb-h-5 sb-w-5`
751
+ className: `sb-w-3 sb-h-3 ${width < 400 && (player == null ? void 0 : player.isFullscreen_) === false || isTrailer ? "" : ""} sb-h-5 sb-w-5`
752
752
  }
753
753
  ) : /* @__PURE__ */ jsx24(
754
754
  VolumeHigh_default,
755
755
  {
756
- className: `sb-w-3 sb-h-3 ${width < 400 || isTrailer ? "" : ""} sb-h-5 sb-w-5`
756
+ className: `sb-w-3 sb-h-3 ${width < 400 && (player == null ? void 0 : player.isFullscreen_) === false || isTrailer ? "" : ""} sb-h-5 sb-w-5`
757
757
  }
758
758
  )
759
759
  }
@@ -761,7 +761,7 @@ var VolumeSlider = ({
761
761
  /* @__PURE__ */ jsx24("div", { className: "sb-flex sb-items-center sb-justify-center", children: /* @__PURE__ */ jsx24(
762
762
  "div",
763
763
  {
764
- className: ` sb-transition-all sb-ease-in-out sb-duration-500 ${isVisible ? "sb-w-[22px] sb-opacity-100 sb-visible" : "sb-w-[22px] sb-opacity-0 sb-invisible"} ${width > 400 && !isTrailer ? "-sb-rotate-90 -sb-translate-y-1" : "sb-rotate-90 sb-translate-y-1"} sb-relative`,
764
+ className: ` sb-transition-all sb-ease-in-out sb-duration-500 ${isVisible ? "sb-w-[22px] sb-opacity-100 sb-visible" : "sb-w-[22px] sb-opacity-0 sb-invisible"} ${(width > 400 || (player == null ? void 0 : player.isFullscreen_) === true) && !isTrailer ? "-sb-rotate-90 -sb-translate-y-1" : "sb-rotate-90 sb-translate-y-1"} sb-relative`,
765
765
  children: /* @__PURE__ */ jsx24(
766
766
  Slider_default,
767
767
  {
@@ -865,7 +865,7 @@ var MenuButton = ({
865
865
  var MenuButton_default = MenuButton;
866
866
 
867
867
  // src/components/QualityMenu/index.tsx
868
- import { jsx as jsx26, jsxs as jsxs9 } from "react/jsx-runtime";
868
+ import { Fragment, jsx as jsx26, jsxs as jsxs9 } from "react/jsx-runtime";
869
869
  var QualityOption = ({
870
870
  isSelected,
871
871
  quality,
@@ -873,10 +873,11 @@ var QualityOption = ({
873
873
  width,
874
874
  isTrailer
875
875
  }) => {
876
+ const { player } = useSoftBuildersVideoPlayerContext();
876
877
  return /* @__PURE__ */ jsx26(
877
878
  "button",
878
879
  {
879
- className: `hover:sb-text-orange-500 ${width > 400 && !isTrailer ? "sb-p-2" : "sp-pb-1"}`,
880
+ className: `hover:sb-text-orange-500 ${(width > 400 || (player == null ? void 0 : player.isFullscreen_) === true) && !isTrailer ? "sb-p-2" : "sp-pb-1"}`,
880
881
  onClick: (e) => {
881
882
  e.stopPropagation();
882
883
  onClick(e);
@@ -885,10 +886,10 @@ var QualityOption = ({
885
886
  /* @__PURE__ */ jsx26("div", { className: "sb-col-span-3", children: isSelected ? /* @__PURE__ */ jsx26(
886
887
  CheckedIcon_default,
887
888
  {
888
- className: `${width > 400 && !isTrailer ? "sb-w-5 sb-h-5" : "sb-w-3 sb-h-3"}`
889
+ className: `${(width > 400 || (player == null ? void 0 : player.isFullscreen_) === true) && !isTrailer ? "sb-w-5 sb-h-5" : "sb-w-3 sb-h-3"}`
889
890
  }
890
891
  ) : /* @__PURE__ */ jsx26("div", {}) }),
891
- /* @__PURE__ */ jsx26("p", { className: "sb-text-left sb-col-span-9", children: quality == null ? void 0 : quality.label })
892
+ /* @__PURE__ */ jsx26("p", { className: "sb-text-left sb-col-span-9", children: quality.height })
892
893
  ] })
893
894
  }
894
895
  );
@@ -901,9 +902,7 @@ var QualityMenu = ({
901
902
  }) => {
902
903
  const { player } = useSoftBuildersVideoPlayerContext();
903
904
  const [closeMenuFunction, setCloseMenuFunction] = useState4(void 0);
904
- const [qualities, setQualities] = useState4(
905
- []
906
- );
905
+ const [qualities, setQualities] = useState4([]);
907
906
  const [currentQualitySrc, setCurrentQualitySrc] = useState4("Auto");
908
907
  useEffect4(() => {
909
908
  if (player) {
@@ -911,7 +910,10 @@ var QualityMenu = ({
911
910
  const qs = JSON.parse(
912
911
  JSON.stringify(sources)
913
912
  );
914
- setQualities(qs);
913
+ const qualityLevels = player == null ? void 0 : player.qualityLevels();
914
+ setQualities(qualityLevels.levels_);
915
+ console.log("qualityLevels.levels_: ", qualityLevels.levels_.length);
916
+ setQualities((pre) => [...pre, { width: "auto", height: "auto" }]);
915
917
  const source = player == null ? void 0 : player.currentSource();
916
918
  const quality = JSON.parse(
917
919
  JSON.stringify(source)
@@ -922,18 +924,45 @@ var QualityMenu = ({
922
924
  }
923
925
  }
924
926
  }, [player]);
927
+ function setQualityByHeight(height) {
928
+ if (player) {
929
+ const qualityLevels = player == null ? void 0 : player.qualityLevels();
930
+ for (let i = 0; i < qualityLevels.length; i++) {
931
+ const level = qualityLevels[i];
932
+ level.enabled = level.height === height;
933
+ }
934
+ }
935
+ }
936
+ function setAutoQuality() {
937
+ if (player) {
938
+ const qualityLevels = player.qualityLevels();
939
+ let highestQuality = null;
940
+ for (let i = 0; i < qualityLevels.length; i++) {
941
+ const level = qualityLevels[i];
942
+ if (!highestQuality || level.height > highestQuality.height) {
943
+ highestQuality = level;
944
+ }
945
+ }
946
+ if (highestQuality) {
947
+ for (let i = 0; i < qualityLevels.length; i++) {
948
+ const level = qualityLevels[i];
949
+ level.enabled = level === highestQuality;
950
+ }
951
+ }
952
+ }
953
+ }
925
954
  return /* @__PURE__ */ jsx26(
926
955
  MenuButton_default,
927
956
  {
928
- classContainer: `${width < 400 || isTrailer ? "!sb-top-8 -sb-left-9" : ""}`,
957
+ classContainer: `${width < 400 && (player == null ? void 0 : player.isFullscreen_) === false || isTrailer ? "!sb-top-8 -sb-left-9" : ""}`,
929
958
  onClick: (e, isOpen) => {
930
959
  onClick && onClick(e, isOpen);
931
960
  },
932
961
  buttonContent: /* @__PURE__ */ jsx26(SettingsIcon_default, { className: "sb-w-3 sb-h-3" }),
933
- menuContent: /* @__PURE__ */ jsx26(
962
+ menuContent: /* @__PURE__ */ jsx26(Fragment, { children: (qualities == null ? void 0 : qualities.length) > 1 && /* @__PURE__ */ jsx26(
934
963
  "div",
935
964
  {
936
- className: `sb-rounded-md sb-bg-[#303030] sb-bg-opacity-50 ${width > 400 && !isTrailer ? "sb-w-[150px] sb-py-5" : "sb-w-[90px] sb-items-center sb-justify-center sb-py-1"}`,
965
+ className: `sb-rounded-md sb-bg-[#303030] sb-bg-opacity-50 ${(width > 400 || (player == null ? void 0 : player.isFullscreen_) === true) && !isTrailer ? "sb-w-[150px] sb-py-5" : "sb-w-[90px] sb-items-center sb-justify-center sb-py-1"}`,
937
966
  children: /* @__PURE__ */ jsxs9("div", { className: "sb-flex sb-flex-col sb-gap-3", children: [
938
967
  /* @__PURE__ */ jsxs9(
939
968
  "div",
@@ -963,26 +992,20 @@ var QualityMenu = ({
963
992
  {
964
993
  width,
965
994
  isTrailer,
966
- isSelected: currentQualitySrc === (q == null ? void 0 : q.label),
995
+ isSelected: currentQualitySrc === (q == null ? void 0 : q.height),
967
996
  quality: q,
968
997
  onClick: (e) => {
969
- const source = qualities.find(
970
- (_q) => (q == null ? void 0 : q.label) == (_q == null ? void 0 : _q.label)
971
- );
972
- if (source && source.src != currentQualitySrc) {
973
- const currentTime = player == null ? void 0 : player.currentTime();
974
- setCurrentQualitySrc(source == null ? void 0 : source.label);
975
- }
998
+ q.height != "auto" ? setQualityByHeight(q.height) : setAutoQuality();
976
999
  closeMenuFunction && closeMenuFunction();
977
1000
  setIsModalChanged(false);
978
1001
  }
979
1002
  },
980
- `quality-${q == null ? void 0 : q.label}-${i}`
1003
+ q.width
981
1004
  );
982
1005
  }) })
983
1006
  ] })
984
1007
  }
985
- ),
1008
+ ) }),
986
1009
  close: (fn) => {
987
1010
  setCloseMenuFunction(() => fn);
988
1011
  }
@@ -1332,7 +1355,7 @@ var TimeSliderContainer_default = TimeSliderContainer;
1332
1355
 
1333
1356
  // src/components/BufferTracker/index.tsx
1334
1357
  import { useEffect as useEffect10 } from "react";
1335
- import { Fragment, jsx as jsx35 } from "react/jsx-runtime";
1358
+ import { Fragment as Fragment2, jsx as jsx35 } from "react/jsx-runtime";
1336
1359
  var BufferTracker = () => {
1337
1360
  const { player, setDownloadedBufferTimeufferTime } = useSoftBuildersVideoPlayerContext();
1338
1361
  useEffect10(() => {
@@ -1341,13 +1364,13 @@ var BufferTracker = () => {
1341
1364
  }, 1e3);
1342
1365
  return () => clearInterval(intervalId);
1343
1366
  }, [player]);
1344
- return /* @__PURE__ */ jsx35(Fragment, {});
1367
+ return /* @__PURE__ */ jsx35(Fragment2, {});
1345
1368
  };
1346
1369
  var BufferTracker_default = BufferTracker;
1347
1370
 
1348
1371
  // src/components/CurrentTimeTracker/index.tsx
1349
1372
  import { useEffect as useEffect11 } from "react";
1350
- import { Fragment as Fragment2, jsx as jsx36 } from "react/jsx-runtime";
1373
+ import { Fragment as Fragment3, jsx as jsx36 } from "react/jsx-runtime";
1351
1374
  var CurrentTimeTracker = () => {
1352
1375
  const { setCurrentTime, player } = useSoftBuildersVideoPlayerContext();
1353
1376
  useEffect11(() => {
@@ -1356,7 +1379,7 @@ var CurrentTimeTracker = () => {
1356
1379
  }, 500);
1357
1380
  return () => clearInterval(intervalId);
1358
1381
  }, [player]);
1359
- return /* @__PURE__ */ jsx36(Fragment2, {});
1382
+ return /* @__PURE__ */ jsx36(Fragment3, {});
1360
1383
  };
1361
1384
  var CurrentTimeTracker_default = CurrentTimeTracker;
1362
1385
 
@@ -1419,12 +1442,12 @@ var SubtitleMenu = ({
1419
1442
  onClick: (e, isOpen) => {
1420
1443
  onClick && onClick(e, isOpen);
1421
1444
  },
1422
- classContainer: `${width < 400 || isTrailer ? "!sb-top-8 -sb-left-9" : ""}`,
1445
+ classContainer: `${width < 400 && (player == null ? void 0 : player.isFullscreen_) === false || isTrailer ? "!sb-top-8 -sb-left-9" : ""}`,
1423
1446
  buttonContent: /* @__PURE__ */ jsx37(SubIcon_default, { className: "sb-w-4 sb-h-4 sb-text-white " }),
1424
1447
  menuContent: /* @__PURE__ */ jsx37(
1425
1448
  "div",
1426
1449
  {
1427
- className: `sb-rounded-md sb-bg-[#303030] sb-bg-opacity-50 ${width > 400 && !isTrailer ? "sb-w-[150px] sb-py-5" : "sb-w-[90px] sb-items-center sb-justify-center sb-py-1"}`,
1450
+ className: `sb-rounded-md sb-bg-[#303030] sb-bg-opacity-50 ${(width > 400 || (player == null ? void 0 : player.isFullscreen_) === true) && !isTrailer ? "sb-w-[150px] sb-py-5" : "sb-w-[90px] sb-items-center sb-justify-center sb-py-1"}`,
1428
1451
  children: /* @__PURE__ */ jsxs15("div", { className: "sb-flex sb-flex-col sb-gap-3", children: [
1429
1452
  /* @__PURE__ */ jsxs15("div", { className: "sb-px-5 sb-flex sb-flex-row sb-gap-3 sb-items-center sb-justify-center", children: [
1430
1453
  /* @__PURE__ */ jsx37(
@@ -1474,7 +1497,8 @@ var TooltipModal = ({
1474
1497
  children,
1475
1498
  isLeft = false,
1476
1499
  width = 0,
1477
- isModalChanged
1500
+ isModalChanged,
1501
+ player
1478
1502
  }) => {
1479
1503
  const [isOpen, setIsOpen] = useState12(false);
1480
1504
  const showTooltip = () => setIsOpen(true);
@@ -1500,7 +1524,7 @@ var TooltipModal = ({
1500
1524
  isOpen && /* @__PURE__ */ jsx38(
1501
1525
  "div",
1502
1526
  {
1503
- className: `sb-tooltip-modal sb-text-orange-900 sb-my-2 ${width > 400 ? "!sb-bottom-[105%]" : "!sb-top-[105%]"}`,
1527
+ className: `sb-tooltip-modal sb-text-orange-900 sb-my-2 ${width > 400 || (player == null ? void 0 : player.isFullscreen_) === true ? "!sb-bottom-[105%]" : "!sb-top-[105%]"}`,
1504
1528
  style: {
1505
1529
  position: "absolute",
1506
1530
  left: !isLeft ? "-100%" : "100%",
@@ -1577,19 +1601,22 @@ var ControlBar = ({
1577
1601
  return /* @__PURE__ */ jsxs17(
1578
1602
  "div",
1579
1603
  {
1580
- className: ` !sb-px-4 sb-flex sb-pt-2 sb-justify-center sb-gap-3 sb-w-full sb-h-full ${width > 400 && !isTrailer ? "sb-absolute sb-bottom-1 sb-items-end sb-mb-1 sb-pb-2 " : "sb-items-start"} sb-pb-2`,
1604
+ className: ` !sb-px-4 sb-flex sb-pt-2 sb-justify-center sb-gap-3 sb-w-full sb-h-full ${(width > 400 || (player == null ? void 0 : player.isFullscreen_) === true) && !isTrailer ? "sb-absolute sb-bottom-1 sb-items-end sb-mb-1 sb-pb-2 " : "sb-items-start"} sb-pb-2`,
1581
1605
  children: [
1582
1606
  /* @__PURE__ */ jsx39(BufferTracker_default, {}),
1583
1607
  /* @__PURE__ */ jsx39(CurrentTimeTracker_default, {}),
1584
1608
  !isTrailer && /* @__PURE__ */ jsx39(
1585
1609
  "button",
1586
1610
  {
1587
- onClick: () => {
1611
+ onClick: (e) => {
1612
+ e.preventDefault();
1613
+ e.stopPropagation();
1588
1614
  seek(-seekStep);
1589
1615
  },
1590
1616
  children: /* @__PURE__ */ jsx39(
1591
1617
  GlobalTooltip_default,
1592
1618
  {
1619
+ player,
1593
1620
  width,
1594
1621
  content: /* @__PURE__ */ jsx39("p", { children: "Backward 5 sec" }),
1595
1622
  isLeft: true,
@@ -1601,6 +1628,7 @@ var ControlBar = ({
1601
1628
  /* @__PURE__ */ jsx39("button", { onClick: togglePlay, children: /* @__PURE__ */ jsx39(
1602
1629
  GlobalTooltip_default,
1603
1630
  {
1631
+ player,
1604
1632
  width,
1605
1633
  content: /* @__PURE__ */ jsx39("p", { children: isPaused ? "Play" : "pause" }),
1606
1634
  isLeft: true,
@@ -1612,11 +1640,13 @@ var ControlBar = ({
1612
1640
  {
1613
1641
  onClick: (e) => {
1614
1642
  e.preventDefault();
1643
+ e.stopPropagation();
1615
1644
  seek(seekStep);
1616
1645
  },
1617
1646
  children: /* @__PURE__ */ jsx39(
1618
1647
  GlobalTooltip_default,
1619
1648
  {
1649
+ player,
1620
1650
  width,
1621
1651
  content: /* @__PURE__ */ jsx39("p", { children: "Forward 5 sec" }),
1622
1652
  isLeft: true,
@@ -1630,16 +1660,16 @@ var ControlBar = ({
1630
1660
  /* @__PURE__ */ jsx39(
1631
1661
  "div",
1632
1662
  {
1633
- className: `${width < 400 && !isTrailer ? "sb-flex-1 sb-ml-0 sb-mr-0" : "sb-w-full"}`,
1663
+ className: `${width < 400 && !isTrailer && (player == null ? void 0 : player.isFullscreen_) === false ? "sb-flex-1 sb-ml-0 sb-mr-0" : "sb-w-full"}`,
1634
1664
  children: /* @__PURE__ */ jsxs17(
1635
1665
  "div",
1636
1666
  {
1637
- style: width < 400 && !isTrailer ? {
1667
+ style: width < 400 && !isTrailer && (player == null ? void 0 : player.isFullscreen_) === false ? {
1638
1668
  width: `${width * 0.9}px`,
1639
1669
  left: "5%",
1640
1670
  top: "90%"
1641
1671
  } : { width: "98%" },
1642
- className: `flex gap-2 ${width < 400 && !isTrailer ? "absolute sb-top-1" : "-sb-translate-y-0 sb-w-full"} hover:sb-w-[45%] `,
1672
+ className: `flex gap-2 ${width < 400 && !isTrailer && (player == null ? void 0 : player.isFullscreen_) === false ? "absolute sb-top-1" : "-sb-translate-y-0 sb-w-full"} hover:sb-w-[45%] `,
1643
1673
  children: [
1644
1674
  /* @__PURE__ */ jsx39(CurrentTimeLabel_default, {}),
1645
1675
  /* @__PURE__ */ jsx39(TimeSliderContainer_default, { chapters, notes }),
@@ -1663,6 +1693,7 @@ var ControlBar = ({
1663
1693
  /* @__PURE__ */ jsx39(
1664
1694
  GlobalTooltip_default,
1665
1695
  {
1696
+ player,
1666
1697
  isModalChanged,
1667
1698
  width,
1668
1699
  content: /* @__PURE__ */ jsx39("p", { children: "Quality" }),
@@ -1681,22 +1712,30 @@ var ControlBar = ({
1681
1712
  )
1682
1713
  }
1683
1714
  ),
1684
- disableNote && /* @__PURE__ */ jsx39(GlobalTooltip_default, { width, content: /* @__PURE__ */ jsx39("p", { children: "Create note" }), children: /* @__PURE__ */ jsx39(
1685
- CreateNoteMenu_default,
1715
+ disableNote && /* @__PURE__ */ jsx39(
1716
+ GlobalTooltip_default,
1686
1717
  {
1687
- handleSaveNoteAction,
1718
+ player,
1688
1719
  width,
1689
- setNoteOpen,
1690
- noteButtonClick: (e) => {
1691
- noteButtonClick && noteButtonClick({
1692
- time: Number((player == null ? void 0 : player.currentTime()) || 0),
1693
- isOpen: e
1694
- });
1695
- player == null ? void 0 : player.pause();
1696
- }
1720
+ content: /* @__PURE__ */ jsx39("p", { children: "Create note" }),
1721
+ children: /* @__PURE__ */ jsx39(
1722
+ CreateNoteMenu_default,
1723
+ {
1724
+ handleSaveNoteAction,
1725
+ width,
1726
+ setNoteOpen,
1727
+ noteButtonClick: (e) => {
1728
+ noteButtonClick && noteButtonClick({
1729
+ time: Number((player == null ? void 0 : player.currentTime()) || 0),
1730
+ isOpen: e
1731
+ });
1732
+ player == null ? void 0 : player.pause();
1733
+ }
1734
+ }
1735
+ )
1697
1736
  }
1698
- ) }),
1699
- /* @__PURE__ */ jsx39(GlobalTooltip_default, { width, content: /* @__PURE__ */ jsx39("p", { children: "Subtitle" }), children: /* @__PURE__ */ jsx39(
1737
+ ),
1738
+ /* @__PURE__ */ jsx39(GlobalTooltip_default, { player, width, content: /* @__PURE__ */ jsx39("p", { children: "Subtitle" }), children: /* @__PURE__ */ jsx39(
1700
1739
  SubtitleMenu_default,
1701
1740
  {
1702
1741
  isTrailer,
@@ -1707,7 +1746,7 @@ var ControlBar = ({
1707
1746
  }
1708
1747
  }
1709
1748
  ) }),
1710
- /* @__PURE__ */ jsx39(GlobalTooltip_default, { width, content: /* @__PURE__ */ jsx39("p", { children: "Full screen" }), children: /* @__PURE__ */ jsx39(
1749
+ /* @__PURE__ */ jsx39(GlobalTooltip_default, { player, width, content: /* @__PURE__ */ jsx39("p", { children: "Full screen" }), children: /* @__PURE__ */ jsx39(
1711
1750
  "button",
1712
1751
  {
1713
1752
  onClick: (e) => {
@@ -1763,7 +1802,7 @@ var BigPlayButton = ({
1763
1802
  var BigPlayButton_default = BigPlayButton;
1764
1803
 
1765
1804
  // src/components/VideoPlayerComponent/index.tsx
1766
- import { Fragment as Fragment3, jsx as jsx41, jsxs as jsxs19 } from "react/jsx-runtime";
1805
+ import { Fragment as Fragment4, jsx as jsx41, jsxs as jsxs19 } from "react/jsx-runtime";
1767
1806
  var bigPlayButtonRoot = {};
1768
1807
  var renderBigPlayButton = (id, player, isPaused, setIsPaused, opacity = "100", height, heightValue, isLoading) => {
1769
1808
  const container = document.getElementById(`video-container-${id}`);
@@ -1853,6 +1892,7 @@ var VideoPlayerComponent = forwardRef(
1853
1892
  isTrailer,
1854
1893
  height
1855
1894
  }, ref) => {
1895
+ var _a;
1856
1896
  const videoRef = useRef2(void 0);
1857
1897
  const playerRef = useRef2(void 0);
1858
1898
  const idRef = useRef2(void 0);
@@ -1919,6 +1959,13 @@ var VideoPlayerComponent = forwardRef(
1919
1959
  }
1920
1960
  };
1921
1961
  }, [id]);
1962
+ useEffect15(() => {
1963
+ if (playerRef.current) {
1964
+ const myPlayer = playerRef.current.currentSources();
1965
+ playerRef.current.src(options.sources);
1966
+ playerRef.current.load();
1967
+ }
1968
+ }, [options.sources[0].type]);
1922
1969
  useEffect15(() => {
1923
1970
  if (!playerRef.current) {
1924
1971
  const videoElement = document.createElement("video-js");
@@ -1936,9 +1983,9 @@ var VideoPlayerComponent = forwardRef(
1936
1983
  });
1937
1984
  }
1938
1985
  return () => {
1939
- var _a, _b;
1986
+ var _a2, _b;
1940
1987
  if (playerRef.current) {
1941
- if (!isEqual((_b = (_a = idRef == null ? void 0 : idRef.current) == null ? void 0 : _a.sources) != null ? _b : "", options.sources)) {
1988
+ if (!isEqual((_b = (_a2 = idRef == null ? void 0 : idRef.current) == null ? void 0 : _a2.sources) != null ? _b : "", options.sources)) {
1942
1989
  idRef.current = options;
1943
1990
  playerRef.current.dispose();
1944
1991
  playerRef.current = void 0;
@@ -2005,7 +2052,8 @@ var VideoPlayerComponent = forwardRef(
2005
2052
  duration,
2006
2053
  opacity,
2007
2054
  isReady,
2008
- id
2055
+ id,
2056
+ (_a = playerRef == null ? void 0 : playerRef.current) == null ? void 0 : _a.isFullscreen_
2009
2057
  ]);
2010
2058
  useEffect15(() => {
2011
2059
  if (isReady) {
@@ -2101,9 +2149,9 @@ var VideoPlayerComponent = forwardRef(
2101
2149
  const observer = new IntersectionObserver(
2102
2150
  (entries) => {
2103
2151
  entries.forEach((entry) => {
2104
- var _a, _b;
2152
+ var _a2, _b;
2105
2153
  if (entry.isIntersecting === false) {
2106
- if (((_a = playerRef == null ? void 0 : playerRef.current) == null ? void 0 : _a.paused()) === false) {
2154
+ if (((_a2 = playerRef == null ? void 0 : playerRef.current) == null ? void 0 : _a2.paused()) === false) {
2107
2155
  try {
2108
2156
  (_b = playerRef == null ? void 0 : playerRef.current) == null ? void 0 : _b.pause();
2109
2157
  setIsPaused(true);
@@ -2177,7 +2225,7 @@ var VideoPlayerComponent = forwardRef(
2177
2225
  debounce((arg) => setIsloading(arg), 300)(false);
2178
2226
  });
2179
2227
  }
2180
- return /* @__PURE__ */ jsx41(Fragment3, { children: /* @__PURE__ */ jsx41(
2228
+ return /* @__PURE__ */ jsx41(Fragment4, { children: /* @__PURE__ */ jsx41(
2181
2229
  Suspense,
2182
2230
  {
2183
2231
  fallback: /* @__PURE__ */ jsx41(SkillamiIcon_default, { className: " sb-w-16 sb-h-16 sb-animate-spin sb-absolute -sb-top-2 -sb-right-2 " }),
@@ -2295,6 +2343,7 @@ var Component = forwardRef2(
2295
2343
  };
2296
2344
  getTracks();
2297
2345
  }, [options == null ? void 0 : options.tracks]);
2346
+ console.log("options:===. ", options);
2298
2347
  const id = (Date.now() + Math.random() * 100).toString();
2299
2348
  const [uuid, setUuid] = useState15("");
2300
2349
  useEffect16(() => {
@@ -2323,7 +2372,7 @@ var Component = forwardRef2(
2323
2372
  }
2324
2373
  );
2325
2374
  var SoftBuildersVideoPlayer = memo(Component, (prevProps, nextProps) => {
2326
- return isEqual2(prevProps.options, nextProps.options) && prevProps.notes === nextProps.notes && prevProps.chapters === nextProps.chapters && prevProps.startTime === nextProps.startTime && prevProps.height === nextProps.height;
2375
+ return isEqual2(prevProps.options, nextProps.options) && prevProps.options.sources[0].type === nextProps.options.sources[0].type && prevProps.notes === nextProps.notes && prevProps.chapters === nextProps.chapters && prevProps.startTime === nextProps.startTime && prevProps.height === nextProps.height;
2327
2376
  });
2328
2377
  var SoftBuildersVideoPlayer_default = SoftBuildersVideoPlayer;
2329
2378
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "softbuilders-react-video-player",
3
3
  "description": "Standalone video player component",
4
- "version": "1.2.24",
4
+ "version": "1.3.1",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "files": [
@@ -27,7 +27,8 @@
27
27
  "lodash": "^4.17.21",
28
28
  "typescript": "^5.6.2",
29
29
  "uuid": "^11.0.2",
30
- "video.js": "^8.18.0"
30
+ "video.js": "^8.18.0",
31
+ "videojs-contrib-quality-levels": "^4.1.0"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@svgr/cli": "^8.1.0",