@100mslive/roomkit-react 0.2.8-alpha.6 → 0.2.8-alpha.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. package/dist/{HLSView-53PDKIS2.js → HLSView-6KPQ2KD6.js} +176 -174
  2. package/dist/HLSView-6KPQ2KD6.js.map +7 -0
  3. package/dist/Prebuilt/components/HMSVideo/HLSQualitySelector.d.ts +3 -2
  4. package/dist/Prebuilt/components/HMSVideo/utils.d.ts +0 -1
  5. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +2 -1
  6. package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +2 -1
  7. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +2 -1
  8. package/dist/Prebuilt/components/RaiseHand.d.ts +4 -1
  9. package/dist/Sheet/Sheet.d.ts +1 -0
  10. package/dist/{chunk-2ZFAT7KY.js → chunk-JQCSGJIR.js} +742 -639
  11. package/dist/chunk-JQCSGJIR.js.map +7 -0
  12. package/dist/index.cjs.js +1253 -1144
  13. package/dist/index.cjs.js.map +4 -4
  14. package/dist/index.js +1 -1
  15. package/dist/meta.cjs.json +256 -201
  16. package/dist/meta.esbuild.json +263 -206
  17. package/package.json +6 -6
  18. package/src/Button/Button.tsx +4 -4
  19. package/src/Fieldset/Fieldset.tsx +1 -1
  20. package/src/Input/PasswordInput.stories.tsx +1 -1
  21. package/src/Pagination/StyledPagination.stories.tsx +2 -2
  22. package/src/Prebuilt/IconButton.tsx +1 -1
  23. package/src/Prebuilt/components/AppData/useSidepane.js +22 -10
  24. package/src/Prebuilt/components/Chat/Chat.tsx +41 -1
  25. package/src/Prebuilt/components/Chat/ChatFooter.tsx +19 -15
  26. package/src/Prebuilt/components/EmojiReaction.jsx +32 -22
  27. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx +85 -78
  28. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +3 -4
  29. package/src/Prebuilt/components/HMSVideo/MwebHLSViewTitle.tsx +49 -56
  30. package/src/Prebuilt/components/HMSVideo/VideoTime.tsx +2 -1
  31. package/src/Prebuilt/components/HMSVideo/utils.ts +0 -8
  32. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.tsx +1 -1
  33. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +50 -46
  34. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +10 -5
  35. package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +12 -6
  36. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +7 -3
  37. package/src/Prebuilt/components/Notifications/HandRaisedNotifications.tsx +4 -1
  38. package/src/Prebuilt/components/Polls/Voting/Voting.tsx +3 -2
  39. package/src/Prebuilt/components/Polls/common/OptionInputWithDelete.tsx +1 -1
  40. package/src/Prebuilt/components/Polls/common/utils.ts +2 -2
  41. package/src/Prebuilt/components/RaiseHand.tsx +8 -2
  42. package/src/Prebuilt/components/RoomDetails/RoomDetailsPane.tsx +41 -14
  43. package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +2 -2
  44. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +1 -1
  45. package/src/Prebuilt/layouts/HLSView.jsx +27 -24
  46. package/src/Prebuilt/layouts/SidePane.tsx +1 -2
  47. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +3 -2
  48. package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
  49. package/src/Sheet/Sheet.tsx +3 -3
  50. package/dist/HLSView-53PDKIS2.js.map +0 -7
  51. package/dist/chunk-2ZFAT7KY.js.map +0 -7
@@ -14,6 +14,7 @@ import {
14
14
  LeaveRoom,
15
15
  Loading,
16
16
  Logo,
17
+ RoomDetailsRow,
17
18
  SIDE_PANE_OPTIONS,
18
19
  Sheet,
19
20
  Slider,
@@ -24,20 +25,21 @@ import {
24
25
  __objRest,
25
26
  __spreadValues,
26
27
  config,
27
- getFormattedCount,
28
28
  init_define_process_env,
29
29
  styled,
30
30
  theme,
31
31
  useIsLandscape,
32
+ useIsSidepaneTypeOpen,
32
33
  usePollViewToggle,
33
34
  useRoomLayoutConferencingScreen,
35
+ useRoomLayoutHeader,
34
36
  useSidepaneToggle,
35
37
  useTheme
36
- } from "./chunk-2ZFAT7KY.js";
38
+ } from "./chunk-JQCSGJIR.js";
37
39
 
38
40
  // src/Prebuilt/layouts/HLSView.jsx
39
41
  init_define_process_env();
40
- import React14, { useCallback as useCallback2, useEffect as useEffect4, useRef as useRef2, useState as useState5 } from "react";
42
+ import React14, { useCallback, useEffect as useEffect3, useRef, useState as useState4 } from "react";
41
43
  import { useFullscreen, useMedia as useMedia4, usePrevious, useToggle } from "react-use";
42
44
  import { HLSPlaybackState, HMSHLSPlayer, HMSHLSPlayerEvents as HMSHLSPlayerEvents2 } from "@100mslive/hls-player";
43
45
  import screenfull from "screenfull";
@@ -45,12 +47,12 @@ import {
45
47
  HLSPlaylistType,
46
48
  HMSNotificationTypes,
47
49
  selectAppData,
48
- selectHLSState as selectHLSState2,
50
+ selectHLSState,
49
51
  selectPeerNameByID,
50
52
  selectPollByID,
51
53
  useHMSActions,
52
54
  useHMSNotifications,
53
- useHMSStore as useHMSStore2,
55
+ useHMSStore,
54
56
  useHMSVanillaStore
55
57
  } from "@100mslive/react-sdk";
56
58
  import { BackwardArrowIcon, ColoredHandIcon, ForwardArrowIcon, GoLiveIcon } from "@100mslive/react-icons";
@@ -178,13 +180,12 @@ var HMSVideo = forwardRef((_a, videoRef) => {
178
180
  position: "relative",
179
181
  "& video::cue": {
180
182
  color: "white",
181
- // textShadow: '0px 0px 4px #000',
182
183
  whiteSpace: "pre-line",
183
- fontSize: "$lg",
184
+ fontSize: "$sm",
184
185
  fontStyle: "normal",
185
- fontWeight: "$semiBold",
186
+ fontWeight: "$regular",
186
187
  lineHeight: "$sm",
187
- letterSpacing: "0.5px"
188
+ letterSpacing: "0.25px"
188
189
  },
189
190
  "& video::-webkit-media-text-track-display": {
190
191
  padding: "0 $4",
@@ -282,13 +283,6 @@ function getDurationFromSeconds2(timeInSeconds) {
282
283
  }
283
284
  return videoTimeStr;
284
285
  }
285
- function getTime(timeInMilles) {
286
- const timeInSeconds = Math.floor(timeInMilles / 1e3);
287
- const hours = Math.floor(timeInSeconds / 3600);
288
- const minutes = Math.floor(timeInSeconds % 3600 / 60);
289
- const hour = hours !== 0 ? `${hours < 10 ? "0" : ""}${hours}` : "";
290
- return hour + `${hour ? "h:" : ""}` + minutes + "m";
291
- }
292
286
 
293
287
  // src/Prebuilt/components/HMSVideo/VideoProgress.tsx
294
288
  var VideoProgress = ({ isDvr = true }) => {
@@ -378,7 +372,8 @@ var VideoTime = () => {
378
372
  const timeupdateHandler = (currentTime) => {
379
373
  const videoEl = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
380
374
  if (videoEl) {
381
- setVideoTime(getDurationFromSeconds2(videoEl.duration - currentTime));
375
+ const duration = isFinite(videoEl.duration) ? videoEl.duration : videoEl.seekable.end(0) || 0;
376
+ setVideoTime(getDurationFromSeconds2(duration - currentTime));
382
377
  } else {
383
378
  setVideoTime(getDurationFromSeconds2(currentTime));
384
379
  }
@@ -584,10 +579,14 @@ function HLSQualitySelector({
584
579
  layers,
585
580
  onQualityChange,
586
581
  selection,
587
- isAuto
582
+ isAuto,
583
+ containerRef
588
584
  }) {
589
585
  const isMobile = useMedia3(config.media.md);
590
586
  const isLandscape = useIsLandscape();
587
+ if (layers.length === 0) {
588
+ return null;
589
+ }
591
590
  if (isMobile || isLandscape) {
592
591
  return /* @__PURE__ */ React12.createElement(Sheet.Root, { open, onOpenChange }, /* @__PURE__ */ React12.createElement(Sheet.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React12.createElement(
593
592
  Flex,
@@ -600,26 +599,57 @@ function HLSQualitySelector({
600
599
  }
601
600
  },
602
601
  /* @__PURE__ */ React12.createElement(SettingsIcon, null)
603
- )), layers.length > 0 && /* @__PURE__ */ React12.createElement(Sheet.Content, { css: { bg: "$surface_default", pb: "$1" }, onClick: () => onOpenChange(false) }, /* @__PURE__ */ React12.createElement(
604
- Sheet.Title,
602
+ )), /* @__PURE__ */ React12.createElement(
603
+ Sheet.Content,
605
604
  {
606
- css: {
607
- display: "flex",
608
- color: "$on_surface_high",
609
- w: "100%",
610
- justifyContent: "space-between",
611
- mt: "$8",
612
- fontSize: "$md",
613
- px: "$10",
614
- pb: "$8",
615
- borderBottom: "1px solid $border_bright",
616
- alignItems: "center"
617
- }
605
+ container: containerRef,
606
+ css: { bg: "$surface_default", pb: "$1" },
607
+ onClick: () => onOpenChange(false)
618
608
  },
619
- "Quality",
620
- /* @__PURE__ */ React12.createElement(Sheet.Close, { css: { color: "$on_surface_high" }, onClick: () => onOpenChange(false) }, /* @__PURE__ */ React12.createElement(CrossIcon2, null))
621
- ), layers.map((layer) => {
622
- return /* @__PURE__ */ React12.createElement(
609
+ /* @__PURE__ */ React12.createElement(
610
+ Sheet.Title,
611
+ {
612
+ css: {
613
+ display: "flex",
614
+ color: "$on_surface_high",
615
+ w: "100%",
616
+ justifyContent: "space-between",
617
+ mt: "$8",
618
+ fontSize: "$md",
619
+ px: "$10",
620
+ pb: "$8",
621
+ borderBottom: "1px solid $border_bright",
622
+ alignItems: "center"
623
+ }
624
+ },
625
+ "Quality",
626
+ /* @__PURE__ */ React12.createElement(Sheet.Close, { css: { color: "$on_surface_high" }, onClick: () => onOpenChange(false) }, /* @__PURE__ */ React12.createElement(CrossIcon2, null))
627
+ ),
628
+ layers.map((layer) => {
629
+ return /* @__PURE__ */ React12.createElement(
630
+ Flex,
631
+ {
632
+ align: "center",
633
+ css: {
634
+ w: "100%",
635
+ bg: "$surface_default",
636
+ "&:hover": {
637
+ bg: "$surface_brighter"
638
+ },
639
+ cursor: "pointer",
640
+ gap: "$4",
641
+ py: "$8",
642
+ px: "$10"
643
+ },
644
+ key: layer.width,
645
+ onClick: () => onQualityChange(layer)
646
+ },
647
+ /* @__PURE__ */ React12.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
648
+ /* @__PURE__ */ React12.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
649
+ !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React12.createElement(CheckIcon, { width: "16px", height: "16px" })
650
+ );
651
+ }),
652
+ /* @__PURE__ */ React12.createElement(
623
653
  Flex,
624
654
  {
625
655
  align: "center",
@@ -634,36 +664,15 @@ function HLSQualitySelector({
634
664
  py: "$8",
635
665
  px: "$10"
636
666
  },
637
- key: layer.width,
638
- onClick: () => onQualityChange(layer)
667
+ key: "auto",
668
+ onClick: () => onQualityChange({ height: "auto" })
639
669
  },
640
- /* @__PURE__ */ React12.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
641
- /* @__PURE__ */ React12.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
642
- !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React12.createElement(CheckIcon, { width: "16px", height: "16px" })
643
- );
644
- }), /* @__PURE__ */ React12.createElement(
645
- Flex,
646
- {
647
- align: "center",
648
- css: {
649
- w: "100%",
650
- bg: "$surface_default",
651
- "&:hover": {
652
- bg: "$surface_brighter"
653
- },
654
- cursor: "pointer",
655
- gap: "$4",
656
- py: "$8",
657
- px: "$10"
658
- },
659
- key: "auto",
660
- onClick: () => onQualityChange({ height: "auto" })
661
- },
662
- /* @__PURE__ */ React12.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold", flex: "1 1 0" } }, "Auto"),
663
- isAuto && /* @__PURE__ */ React12.createElement(CheckIcon, { width: "16px", height: "16px" })
664
- )));
670
+ /* @__PURE__ */ React12.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold", flex: "1 1 0" } }, "Auto"),
671
+ isAuto && /* @__PURE__ */ React12.createElement(CheckIcon, { width: "16px", height: "16px" })
672
+ )
673
+ ));
665
674
  }
666
- return /* @__PURE__ */ React12.createElement(Dropdown.Root, { open, onOpenChange: (value) => onOpenChange(value) }, /* @__PURE__ */ React12.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React12.createElement(
675
+ return /* @__PURE__ */ React12.createElement(Dropdown.Root, { open, onOpenChange: (value) => onOpenChange(value), modal: false }, /* @__PURE__ */ React12.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React12.createElement(
667
676
  Flex,
668
677
  {
669
678
  css: {
@@ -710,7 +719,7 @@ function HLSQualitySelector({
710
719
  selection && Math.min(selection.width || 0, selection.height || 0),
711
720
  "p"
712
721
  )))
713
- )), layers.length > 0 && /* @__PURE__ */ React12.createElement(
722
+ )), /* @__PURE__ */ React12.createElement(Dropdown.Portal, { container: containerRef }, /* @__PURE__ */ React12.createElement(
714
723
  Dropdown.Content,
715
724
  {
716
725
  sideOffset: 5,
@@ -764,48 +773,50 @@ function HLSQualitySelector({
764
773
  /* @__PURE__ */ React12.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold", flex: "1 1 0" } }, "Auto"),
765
774
  isAuto && /* @__PURE__ */ React12.createElement(CheckIcon, { width: "16px", height: "16px" })
766
775
  )
767
- ));
776
+ )));
768
777
  }
769
778
  var getQualityText = (layer) => `${Math.min(layer.height || 0, layer.width || 0)}p `;
770
779
  var getBitrateText = (layer) => `(${(Number(layer.bitrate / 1e3) / 1e3).toFixed(2)} Mbps)`;
771
780
 
772
781
  // src/Prebuilt/components/HMSVideo/MwebHLSViewTitle.tsx
773
782
  init_define_process_env();
774
- import React13, { useCallback, useEffect as useEffect3, useRef, useState as useState4 } from "react";
775
- import { selectHLSState, selectPeerCount, useHMSStore } from "@100mslive/react-sdk";
783
+ import React13 from "react";
784
+ import { ChevronDownIcon } from "@100mslive/react-icons";
776
785
  var HLSViewTitle = () => {
777
- const peerCount = useHMSStore(selectPeerCount);
778
- const hlsState = useHMSStore(selectHLSState);
779
- const intervalRef = useRef(null);
780
- const { screenType } = useRoomLayoutConferencingScreen();
781
- const [liveTime, setLiveTime] = useState4(0);
782
- const startTimer = useCallback(() => {
783
- intervalRef.current = setInterval(() => {
784
- var _a;
785
- const timeStamp = (_a = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a[screenType === "hls_live_streaming" ? "startedAt" : "initialisedAt"];
786
- if ((hlsState == null ? void 0 : hlsState.running) && timeStamp) {
787
- setLiveTime(Date.now() - timeStamp.getTime());
788
- }
789
- }, 6e4);
790
- }, [hlsState == null ? void 0 : hlsState.running, hlsState == null ? void 0 : hlsState.variants, screenType]);
791
- useEffect3(() => {
792
- var _a;
793
- if (hlsState == null ? void 0 : hlsState.running) {
794
- startTimer();
795
- const timeStamp = (_a = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a[screenType === "hls_live_streaming" ? "startedAt" : "initialisedAt"];
796
- if ((hlsState == null ? void 0 : hlsState.running) && timeStamp) {
797
- setLiveTime(Date.now() - timeStamp.getTime());
798
- }
799
- }
800
- if (!(hlsState == null ? void 0 : hlsState.running) && intervalRef.current) {
801
- clearInterval(intervalRef.current);
802
- }
803
- return () => {
804
- if (intervalRef.current) {
805
- clearInterval(intervalRef.current);
806
- }
807
- };
808
- }, [hlsState == null ? void 0 : hlsState.running, hlsState == null ? void 0 : hlsState.variants, screenType, startTimer]);
786
+ const { title, details } = useRoomLayoutHeader();
787
+ const toggleDetailsPane = useSidepaneToggle(SIDE_PANE_OPTIONS.ROOM_DETAILS);
788
+ const isDetailSidepaneOpen = useIsSidepaneTypeOpen(SIDE_PANE_OPTIONS.ROOM_DETAILS);
789
+ if (isDetailSidepaneOpen) {
790
+ return /* @__PURE__ */ React13.createElement(
791
+ Flex,
792
+ {
793
+ gap: "4",
794
+ align: "center",
795
+ justify: "between",
796
+ css: {
797
+ position: "relative",
798
+ h: "fit-content",
799
+ w: "100%",
800
+ borderBottom: "1px solid $border_bright",
801
+ p: "$8",
802
+ backgroundColor: "$surface_dim"
803
+ }
804
+ },
805
+ /* @__PURE__ */ React13.createElement(Text, { variant: "sub2", css: { fontWeight: "$semiBold" } }, "About Session"),
806
+ /* @__PURE__ */ React13.createElement(
807
+ Flex,
808
+ {
809
+ onClick: toggleDetailsPane,
810
+ css: {
811
+ color: "$on_surface_high",
812
+ cursor: "pointer",
813
+ "&:hover": { opacity: "0.8" }
814
+ }
815
+ },
816
+ /* @__PURE__ */ React13.createElement(ChevronDownIcon, null)
817
+ )
818
+ );
819
+ }
809
820
  return /* @__PURE__ */ React13.createElement(
810
821
  Flex,
811
822
  {
@@ -821,19 +832,7 @@ var HLSViewTitle = () => {
821
832
  }
822
833
  },
823
834
  /* @__PURE__ */ React13.createElement(Logo, null),
824
- /* @__PURE__ */ React13.createElement(Flex, { direction: "column" }, /* @__PURE__ */ React13.createElement(Text, { variant: "sub2", css: { fontWeight: "$semiBold" } }, "Tech Talk"), /* @__PURE__ */ React13.createElement(Flex, { gap: "1" }, /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { color: "$on_surface_medium" } }, getFormattedCount(peerCount) + " watching"), /* @__PURE__ */ React13.createElement(
825
- Flex,
826
- {
827
- direction: "column",
828
- css: {
829
- w: "$3",
830
- h: "$3",
831
- backgroundColor: "$on_surface_medium",
832
- borderRadius: "50%",
833
- alignSelf: "center"
834
- }
835
- }
836
- ), /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { color: "$on_surface_medium" } }, "Started " + getTime(liveTime) + " ago")))
835
+ /* @__PURE__ */ React13.createElement(Flex, { direction: "column" }, title ? /* @__PURE__ */ React13.createElement(Text, { variant: "sub2", css: { fontWeight: "$semiBold" } }, title) : null, /* @__PURE__ */ React13.createElement(Flex, null, /* @__PURE__ */ React13.createElement(RoomDetailsRow, { details }), /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { color: "$on_surface_medium" }, onClick: toggleDetailsPane }, "\xA0...more")))
837
836
  );
838
837
  };
839
838
 
@@ -841,36 +840,36 @@ var HLSViewTitle = () => {
841
840
  var hlsPlayer;
842
841
  var toastMap = {};
843
842
  var HLSView = () => {
844
- var _a, _b;
845
- const videoRef = useRef2(null);
846
- const hlsViewRef = useRef2(null);
847
- const hlsState = useHMSStore2(selectHLSState2);
848
- const enablHlsStats = useHMSStore2(selectAppData(APP_DATA.hlsStats));
843
+ var _a, _b, _c;
844
+ const videoRef = useRef(null);
845
+ const hlsViewRef = useRef();
846
+ const hlsState = useHMSStore(selectHLSState);
847
+ const enablHlsStats = useHMSStore(selectAppData(APP_DATA.hlsStats));
849
848
  const { elements, screenType } = useRoomLayoutConferencingScreen();
850
849
  const notification = useHMSNotifications(HMSNotificationTypes.POLL_STOPPED);
851
850
  const hmsActions = useHMSActions();
852
851
  const { themeType } = useTheme();
853
- const [streamEnded, setStreamEnded] = useState5(false);
854
- let [hlsStatsState, setHlsStatsState] = useState5(null);
852
+ const [streamEnded, setStreamEnded] = useState4(false);
853
+ let [hlsStatsState, setHlsStatsState] = useState4(null);
855
854
  const hlsUrl = (_a = hlsState.variants[0]) == null ? void 0 : _a.url;
856
- const [availableLayers, setAvailableLayers] = useState5([]);
857
- const [isVideoLive, setIsVideoLive] = useState5(true);
858
- const [isCaptionEnabled, setIsCaptionEnabled] = useState5(true);
859
- const [hasCaptions, setHasCaptions] = useState5(false);
860
- const [currentSelectedQuality, setCurrentSelectedQuality] = useState5(null);
861
- const [isHlsAutoplayBlocked, setIsHlsAutoplayBlocked] = useState5(false);
862
- const [isSeekEnabled, setIsSeekEnabled] = useState5(false);
863
- const [isPaused, setIsPaused] = useState5(false);
855
+ const [availableLayers, setAvailableLayers] = useState4([]);
856
+ const [isVideoLive, setIsVideoLive] = useState4(true);
857
+ const [isCaptionEnabled, setIsCaptionEnabled] = useState4(true);
858
+ const [hasCaptions, setHasCaptions] = useState4(false);
859
+ const [currentSelectedQuality, setCurrentSelectedQuality] = useState4(null);
860
+ const [isHlsAutoplayBlocked, setIsHlsAutoplayBlocked] = useState4(false);
861
+ const [isSeekEnabled, setIsSeekEnabled] = useState4(false);
862
+ const [isPaused, setIsPaused] = useState4(false);
864
863
  const [show, toggle] = useToggle(false);
865
864
  const lastHlsUrl = usePrevious(hlsUrl);
866
865
  const togglePollView = usePollViewToggle();
867
866
  const vanillaStore = useHMSVanillaStore();
868
- const [controlsVisible, setControlsVisible] = useState5(true);
869
- const [isUserSelectedAuto, setIsUserSelectedAuto] = useState5(true);
870
- const [qualityDropDownOpen, setQualityDropDownOpen] = useState5(false);
871
- const controlsRef = useRef2(null);
872
- const controlsTimerRef = useRef2();
873
- const sidepane = useHMSStore2(selectAppData(APP_DATA.sidePane));
867
+ const [controlsVisible, setControlsVisible] = useState4(true);
868
+ const [isUserSelectedAuto, setIsUserSelectedAuto] = useState4(true);
869
+ const [qualityDropDownOpen, setQualityDropDownOpen] = useState4(false);
870
+ const controlsRef = useRef(null);
871
+ const controlsTimerRef = useRef();
872
+ const sidepane = useHMSStore(selectAppData(APP_DATA.sidePane));
874
873
  const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
875
874
  const showChat = !!(elements == null ? void 0 : elements.chat);
876
875
  const isFullScreenSupported = screenfull.isEnabled;
@@ -879,14 +878,14 @@ var HLSView = () => {
879
878
  const isFullScreen = useFullscreen(hlsViewRef, show, {
880
879
  onClose: () => toggle(false)
881
880
  });
882
- const [showLoader, setShowLoader] = useState5(false);
881
+ const [showLoader, setShowLoader] = useState4(false);
883
882
  const isMwebHLSStream = screenType === "hls_live_streaming" && isMobile;
884
- useEffect4(() => {
883
+ useEffect3(() => {
885
884
  if (sidepane === "" && isMwebHLSStream && showChat) {
886
885
  toggleChat();
887
886
  }
888
887
  }, [sidepane, isMwebHLSStream, toggleChat, showChat]);
889
- useEffect4(() => {
888
+ useEffect3(() => {
890
889
  const videoEl = videoRef.current;
891
890
  const showLoader2 = () => setShowLoader(true);
892
891
  const hideLoader = () => setShowLoader(false);
@@ -897,12 +896,12 @@ var HLSView = () => {
897
896
  videoEl == null ? void 0 : videoEl.removeEventListener("waiting", showLoader2);
898
897
  };
899
898
  }, []);
900
- useEffect4(() => {
899
+ useEffect3(() => {
901
900
  if (streamEnded && lastHlsUrl !== hlsUrl) {
902
901
  setStreamEnded(false);
903
902
  }
904
903
  }, [hlsUrl, streamEnded, lastHlsUrl]);
905
- useEffect4(() => {
904
+ useEffect3(() => {
906
905
  if (!notification)
907
906
  return;
908
907
  const toastID = toastMap == null ? void 0 : toastMap[notification.data.id];
@@ -911,7 +910,7 @@ var HLSView = () => {
911
910
  delete toastMap[notification.data.id];
912
911
  }
913
912
  }, [notification]);
914
- useEffect4(() => {
913
+ useEffect3(() => {
915
914
  const videoElem = videoRef.current;
916
915
  const setStreamEndedCallback = () => {
917
916
  setStreamEnded(true);
@@ -922,7 +921,7 @@ var HLSView = () => {
922
921
  videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
923
922
  };
924
923
  }, [hlsUrl]);
925
- const handleQuality = useCallback2(
924
+ const handleQuality = useCallback(
926
925
  (quality) => {
927
926
  var _a2;
928
927
  if (hlsPlayer) {
@@ -933,7 +932,7 @@ var HLSView = () => {
933
932
  [availableLayers]
934
933
  //eslint-disable-line
935
934
  );
936
- useEffect4(() => {
935
+ useEffect3(() => {
937
936
  let videoEl = videoRef.current;
938
937
  const manifestLoadedHandler = ({ layers }) => {
939
938
  setAvailableLayers(layers);
@@ -958,25 +957,27 @@ var HLSView = () => {
958
957
  const pollId = parsedPayload.substr(parsedPayload.indexOf(":") + 1);
959
958
  const poll = vanillaStore.getState(selectPollByID(pollId));
960
959
  const pollStartedBy = vanillaStore.getState(selectPeerNameByID(poll.startedBy)) || "Participant";
961
- const toastID = ToastManager.addToast({
962
- title: `${pollStartedBy} started a ${poll.type}: ${poll.title}`,
963
- action: /* @__PURE__ */ React14.createElement(
964
- Button,
965
- {
966
- onClick: () => togglePollView(pollId),
967
- variant: "standard",
968
- css: {
969
- backgroundColor: "$surface_bright",
970
- fontWeight: "$semiBold",
971
- color: "$on_surface_high",
972
- p: "$xs $md"
973
- }
974
- },
975
- poll.type === "quiz" ? "Answer" : "Vote"
976
- ),
977
- duration: Infinity
978
- });
979
- toastMap[pollId] = toastID;
960
+ if (!toastMap[pollId]) {
961
+ const toastID = ToastManager.addToast({
962
+ title: `${pollStartedBy} started a ${poll.type}: ${poll.title}`,
963
+ action: /* @__PURE__ */ React14.createElement(
964
+ Button,
965
+ {
966
+ onClick: () => togglePollView(pollId),
967
+ variant: "standard",
968
+ css: {
969
+ backgroundColor: "$surface_bright",
970
+ fontWeight: "$semiBold",
971
+ color: "$on_surface_high",
972
+ p: "$xs $md"
973
+ }
974
+ },
975
+ poll.type === "quiz" ? "Answer" : "Vote"
976
+ ),
977
+ duration: Infinity
978
+ });
979
+ toastMap[pollId] = toastID;
980
+ }
980
981
  return;
981
982
  }
982
983
  switch (parsedPayload.type) {
@@ -1028,7 +1029,7 @@ var HLSView = () => {
1028
1029
  };
1029
1030
  }
1030
1031
  }, [hlsUrl, togglePollView, vanillaStore]);
1031
- useEffect4(() => {
1032
+ useEffect3(() => {
1032
1033
  const onHLSStats = (state) => setHlsStatsState(state);
1033
1034
  if (enablHlsStats) {
1034
1035
  hlsPlayer == null ? void 0 : hlsPlayer.on(HMSHLSPlayerEvents2.STATS, onHLSStats);
@@ -1050,7 +1051,7 @@ var HLSView = () => {
1050
1051
  const sfnOverlayClose = () => {
1051
1052
  hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats);
1052
1053
  };
1053
- useEffect4(() => {
1054
+ useEffect3(() => {
1054
1055
  if (controlsVisible && isFullScreen && !qualityDropDownOpen) {
1055
1056
  if (controlsTimerRef.current) {
1056
1057
  clearTimeout(controlsTimerRef.current);
@@ -1068,11 +1069,11 @@ var HLSView = () => {
1068
1069
  }
1069
1070
  };
1070
1071
  }, [controlsVisible, isFullScreen, qualityDropDownOpen]);
1071
- const onSeekTo = useCallback2((seek) => {
1072
+ const onSeekTo = useCallback((seek) => {
1072
1073
  var _a2;
1073
1074
  hlsPlayer == null ? void 0 : hlsPlayer.seekTo(((_a2 = videoRef.current) == null ? void 0 : _a2.currentTime) + seek);
1074
1075
  }, []);
1075
- const onDoubleClickHandler = useCallback2(
1076
+ const onDoubleClickHandler = useCallback(
1076
1077
  (event) => {
1077
1078
  if (!(isMobile || isLandscape)) {
1078
1079
  return;
@@ -1090,7 +1091,7 @@ var HLSView = () => {
1090
1091
  },
1091
1092
  [isLandscape, isMobile, onSeekTo]
1092
1093
  );
1093
- const onClickHandler = useCallback2(() => {
1094
+ const onClickHandler = useCallback(() => {
1094
1095
  if (!(isMobile || isLandscape)) {
1095
1096
  return;
1096
1097
  }
@@ -1099,7 +1100,7 @@ var HLSView = () => {
1099
1100
  clearTimeout(controlsTimerRef.current);
1100
1101
  }
1101
1102
  }, [isLandscape, isMobile]);
1102
- const onHoverHandler = useCallback2(
1103
+ const onHoverHandler = useCallback(
1103
1104
  (event) => {
1104
1105
  event.preventDefault();
1105
1106
  if (isMobile || isLandscape) {
@@ -1240,8 +1241,8 @@ var HLSView = () => {
1240
1241
  p: "$4 $8"
1241
1242
  }
1242
1243
  },
1243
- /* @__PURE__ */ React14.createElement(HMSVideoPlayer.Controls.Left, null, /* @__PURE__ */ React14.createElement(LeaveRoom, { screenType })),
1244
- /* @__PURE__ */ React14.createElement(HMSVideoPlayer.Controls.Right, null, isLandscape && /* @__PURE__ */ React14.createElement(ChatToggle, null), hasCaptions && !isHlsAutoplayBlocked && /* @__PURE__ */ React14.createElement(HLSCaptionSelector, { isEnabled: isCaptionEnabled }), availableLayers.length > 0 && !isHlsAutoplayBlocked ? /* @__PURE__ */ React14.createElement(
1244
+ /* @__PURE__ */ React14.createElement(HMSVideoPlayer.Controls.Left, null, hlsViewRef.current && /* @__PURE__ */ React14.createElement(LeaveRoom, { screenType, container: hlsViewRef.current })),
1245
+ /* @__PURE__ */ React14.createElement(HMSVideoPlayer.Controls.Right, null, isLandscape && /* @__PURE__ */ React14.createElement(ChatToggle, null), hasCaptions && !isHlsAutoplayBlocked && /* @__PURE__ */ React14.createElement(HLSCaptionSelector, { isEnabled: isCaptionEnabled }), hlsViewRef.current && availableLayers.length > 0 && !isHlsAutoplayBlocked ? /* @__PURE__ */ React14.createElement(
1245
1246
  HLSQualitySelector,
1246
1247
  {
1247
1248
  layers: availableLayers,
@@ -1249,7 +1250,8 @@ var HLSView = () => {
1249
1250
  open: qualityDropDownOpen,
1250
1251
  selection: currentSelectedQuality,
1251
1252
  onQualityChange: handleQuality,
1252
- isAuto: isUserSelectedAuto
1253
+ isAuto: isUserSelectedAuto,
1254
+ containerRef: hlsViewRef.current
1253
1255
  }
1254
1256
  ) : null, /* @__PURE__ */ React14.createElement(HLSAutoplayBlockedPrompt, { open: isHlsAutoplayBlocked, unblockAutoPlay }))
1255
1257
  )
@@ -1262,7 +1264,7 @@ var HLSView = () => {
1262
1264
  align: "start",
1263
1265
  css: {
1264
1266
  position: "absolute",
1265
- bottom: "0",
1267
+ bottom: isFullScreen && ((_b = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _b.playlist_type) === HLSPlaylistType.DVR ? "$8" : "0",
1266
1268
  left: "0",
1267
1269
  zIndex: 1,
1268
1270
  background: isMobile || isLandscape ? "" : `linear-gradient(180deg, ${theme.colors.background_dim.value}00 29.46%, ${theme.colors.background_dim.value}A3 100%);`,
@@ -1274,7 +1276,7 @@ var HLSView = () => {
1274
1276
  opacity: controlsVisible ? `1` : "0"
1275
1277
  }
1276
1278
  },
1277
- /* @__PURE__ */ React14.createElement(HMSVideoPlayer.Progress, { isDvr: ((_b = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _b.playlist_type) === HLSPlaylistType.DVR }),
1279
+ /* @__PURE__ */ React14.createElement(HMSVideoPlayer.Progress, { isDvr: ((_c = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _c.playlist_type) === HLSPlaylistType.DVR }),
1278
1280
  /* @__PURE__ */ React14.createElement(
1279
1281
  HMSVideoPlayer.Controls.Root,
1280
1282
  {
@@ -1347,11 +1349,11 @@ var HLSView = () => {
1347
1349
  )
1348
1350
  ))
1349
1351
  )
1350
- )), isMobile && !isFullScreen && /* @__PURE__ */ React14.createElement(HLSViewTitle, null)) : /* @__PURE__ */ React14.createElement(Flex, { align: "center", justify: "center", direction: "column", css: { size: "100%", px: "$10" } }, /* @__PURE__ */ React14.createElement(Flex, { align: "center", gap: "2", css: { position: "absolute", left: "$4", top: "$4", zIndex: 1 } }, /* @__PURE__ */ React14.createElement(LeaveRoom, { screenType })), /* @__PURE__ */ React14.createElement(Flex, { css: { c: "$on_surface_high", r: "$round", bg: "$surface_default", p: "$2" } }, streamEnded ? /* @__PURE__ */ React14.createElement(ColoredHandIcon, { height: 56, width: 56 }) : /* @__PURE__ */ React14.createElement(GoLiveIcon, { height: 56, width: 56 })), /* @__PURE__ */ React14.createElement(Text, { variant: "h5", css: { c: "$on_surface_high", mt: "$10", mb: 0, textAlign: "center" } }, streamEnded ? "Stream has ended" : "Stream yet to start"), /* @__PURE__ */ React14.createElement(Text, { variant: "md", css: { textAlign: "center", mt: "$4", c: "$on_surface_medium" } }, streamEnded ? "Have a nice day!" : "Sit back and relax"))
1352
+ )), isMobile && !isFullScreen && /* @__PURE__ */ React14.createElement(HLSViewTitle, null)) : /* @__PURE__ */ React14.createElement(Flex, { align: "center", justify: "center", direction: "column", css: { size: "100%", px: "$10" } }, /* @__PURE__ */ React14.createElement(Flex, { align: "center", gap: "2", css: { position: "absolute", left: "$4", top: "$4", zIndex: 1 } }, isMobile || isLandscape ? /* @__PURE__ */ React14.createElement(LeaveRoom, { screenType }) : null), /* @__PURE__ */ React14.createElement(Flex, { css: { c: "$on_surface_high", r: "$round", bg: "$surface_default", p: "$2" } }, streamEnded ? /* @__PURE__ */ React14.createElement(ColoredHandIcon, { height: 56, width: 56 }) : /* @__PURE__ */ React14.createElement(GoLiveIcon, { height: 56, width: 56 })), /* @__PURE__ */ React14.createElement(Text, { variant: "h5", css: { c: "$on_surface_high", mt: "$10", mb: 0, textAlign: "center" } }, streamEnded ? "Stream has ended" : "Stream yet to start"), /* @__PURE__ */ React14.createElement(Text, { variant: "md", css: { textAlign: "center", mt: "$4", c: "$on_surface_medium" } }, streamEnded ? "Have a nice day!" : "Sit back and relax"))
1351
1353
  );
1352
1354
  };
1353
1355
  var HLSView_default = HLSView;
1354
1356
  export {
1355
1357
  HLSView_default as default
1356
1358
  };
1357
- //# sourceMappingURL=HLSView-53PDKIS2.js.map
1359
+ //# sourceMappingURL=HLSView-6KPQ2KD6.js.map