@100mslive/roomkit-react 0.1.6-alpha.0 → 0.1.6-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/dist/{HLSView-PY2FKWX3.js → HLSView-HNVYG5VE.js} +208 -118
  2. package/dist/HLSView-HNVYG5VE.js.map +7 -0
  3. package/dist/Prebuilt/AppContext.d.ts +1 -1
  4. package/dist/Prebuilt/components/Chat/ChatFooter.d.ts +7 -0
  5. package/dist/Prebuilt/components/Connection/ConnectionIndicator.d.ts +6 -0
  6. package/dist/Prebuilt/components/Connection/TileConnection.d.ts +10 -0
  7. package/dist/Prebuilt/components/Footer/ChatToggle.d.ts +4 -0
  8. package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +14 -0
  9. package/dist/Prebuilt/components/Footer/RoleOptions.d.ts +6 -0
  10. package/dist/Prebuilt/components/Header/StreamActions.d.ts +11 -0
  11. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +4 -3
  12. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +4 -3
  13. package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +1 -2
  14. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +3 -1
  15. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +4 -3
  16. package/dist/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.d.ts +6 -0
  17. package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +3 -0
  18. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +16 -0
  19. package/dist/Prebuilt/components/RoleChangeRequestModal.d.ts +2 -0
  20. package/dist/Prebuilt/components/SecondaryTiles.d.ts +1 -1
  21. package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +1 -1
  22. package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +1 -0
  23. package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +5 -3
  24. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +6 -3
  25. package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +1 -1
  26. package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +1 -1
  27. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +1 -0
  28. package/dist/Prebuilt/components/hooks/useAutoStartStreaming.d.ts +1 -0
  29. package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +3 -0
  30. package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +2 -1
  31. package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +2 -0
  32. package/dist/Prebuilt/layouts/SidePane.d.ts +4 -1
  33. package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +2 -1
  34. package/dist/{VirtualBackground-AYDHYLIZ.js → VirtualBackground-UM2FOUHQ.js} +3 -3
  35. package/dist/{chunk-E2M2ZSOL.js → chunk-364HP22I.js} +2 -2
  36. package/dist/{chunk-RXTHJUMZ.js → chunk-LYSAET4G.js} +946 -390
  37. package/dist/chunk-LYSAET4G.js.map +7 -0
  38. package/dist/{chunk-GQD2AGWW.js → chunk-POE7H4IE.js} +12 -2
  39. package/dist/{chunk-GQD2AGWW.js.map → chunk-POE7H4IE.js.map} +2 -2
  40. package/dist/{conference-V2XZGTKU.js → conference-UWLJHMB2.js} +1116 -1316
  41. package/dist/conference-UWLJHMB2.js.map +7 -0
  42. package/dist/index.cjs.js +6080 -5631
  43. package/dist/index.cjs.js.map +4 -4
  44. package/dist/index.js +2 -2
  45. package/dist/meta.cjs.json +741 -493
  46. package/dist/meta.esbuild.json +782 -529
  47. package/package.json +8 -7
  48. package/src/Prebuilt/App.tsx +10 -21
  49. package/src/Prebuilt/AppContext.tsx +1 -1
  50. package/src/Prebuilt/IconButton.jsx +10 -0
  51. package/src/Prebuilt/common/PeersSorter.ts +1 -1
  52. package/src/Prebuilt/common/constants.js +1 -2
  53. package/src/Prebuilt/common/utils.js +1 -1
  54. package/src/Prebuilt/components/AppData/AppData.jsx +8 -2
  55. package/src/Prebuilt/components/AppData/useUISettings.js +6 -6
  56. package/src/Prebuilt/components/AudioVideoToggle.jsx +8 -6
  57. package/src/Prebuilt/components/Chat/Chat.jsx +23 -6
  58. package/src/Prebuilt/components/Chat/ChatBody.jsx +20 -21
  59. package/src/Prebuilt/components/Chat/{ChatFooter.jsx → ChatFooter.tsx} +38 -13
  60. package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +38 -27
  61. package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +5 -4
  62. package/src/Prebuilt/components/Connection/{ConnectionIndicator.jsx → ConnectionIndicator.tsx} +12 -4
  63. package/src/Prebuilt/components/Connection/{TileConnection.jsx → TileConnection.tsx} +20 -6
  64. package/src/Prebuilt/components/EmojiReaction.jsx +2 -6
  65. package/src/Prebuilt/components/Footer/{ChatToggle.jsx → ChatToggle.tsx} +13 -3
  66. package/src/Prebuilt/components/Footer/Footer.tsx +15 -6
  67. package/src/Prebuilt/components/Footer/ParticipantList.jsx +15 -47
  68. package/src/Prebuilt/components/Footer/{RoleAccordion.jsx → RoleAccordion.tsx} +33 -17
  69. package/src/Prebuilt/components/Footer/RoleOptions.tsx +155 -0
  70. package/src/Prebuilt/components/FullPageProgress.jsx +3 -3
  71. package/src/Prebuilt/components/HMSVideo/Controls.jsx +1 -0
  72. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +39 -17
  73. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +2 -2
  74. package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +5 -6
  75. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +1 -1
  76. package/src/Prebuilt/components/Header/{StreamActions.jsx → StreamActions.tsx} +23 -9
  77. package/src/Prebuilt/components/Header/common.jsx +5 -2
  78. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +6 -1
  79. package/src/Prebuilt/components/InsetTile.tsx +14 -8
  80. package/src/Prebuilt/components/Leave/DesktopLeaveRoom.tsx +21 -11
  81. package/src/Prebuilt/components/Leave/EndSessionContent.tsx +2 -5
  82. package/src/Prebuilt/components/Leave/LeaveCard.tsx +1 -3
  83. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +28 -25
  84. package/src/Prebuilt/components/Leave/LeaveSessionContent.tsx +8 -2
  85. package/src/Prebuilt/components/Leave/MwebLeaveRoom.tsx +8 -8
  86. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +4 -0
  87. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +1 -1
  88. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +9 -23
  89. package/src/Prebuilt/components/MoreSettings/SplitComponents/{MwebOptions.jsx → MwebOptions.tsx} +88 -27
  90. package/src/Prebuilt/components/Notifications/Notifications.jsx +30 -21
  91. package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +5 -11
  92. package/src/Prebuilt/components/Pagination.tsx +14 -12
  93. package/src/Prebuilt/components/Preview/{PreviewContainer.jsx → PreviewContainer.tsx} +11 -2
  94. package/src/Prebuilt/components/Preview/PreviewForm.tsx +6 -8
  95. package/src/Prebuilt/components/Preview/{PreviewJoin.jsx → PreviewJoin.tsx} +43 -19
  96. package/src/Prebuilt/components/{RoleChangeRequestModal.jsx → RoleChangeRequestModal.tsx} +32 -15
  97. package/src/Prebuilt/components/ScreenshareTile.jsx +6 -7
  98. package/src/Prebuilt/components/SecondaryTiles.tsx +12 -10
  99. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +1 -1
  100. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +14 -10
  101. package/src/Prebuilt/components/Toast/ToastConfig.jsx +5 -4
  102. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +13 -10
  103. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +36 -34
  104. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +33 -15
  105. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +45 -31
  106. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +12 -9
  107. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +25 -9
  108. package/src/Prebuilt/components/VideoLayouts/interface.ts +1 -0
  109. package/src/Prebuilt/components/VideoTile.jsx +45 -53
  110. package/src/Prebuilt/components/conference.jsx +71 -74
  111. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +57 -0
  112. package/src/Prebuilt/components/hooks/useMetadata.jsx +12 -3
  113. package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +34 -0
  114. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +1 -1
  115. package/src/Prebuilt/components/hooks/useTileLayout.tsx +24 -18
  116. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +4 -0
  117. package/src/Prebuilt/layouts/EmbedView.jsx +1 -11
  118. package/src/Prebuilt/layouts/HLSView.jsx +152 -82
  119. package/src/Prebuilt/layouts/SidePane.tsx +15 -3
  120. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +11 -47
  121. package/src/Prebuilt/plugins/FlyingEmoji.jsx +14 -2
  122. package/src/Prebuilt/services/FeatureFlags.jsx +0 -1
  123. package/src/VideoTile/StyledVideoTile.tsx +1 -0
  124. package/dist/HLSView-PY2FKWX3.js.map +0 -7
  125. package/dist/chunk-RXTHJUMZ.js.map +0 -7
  126. package/dist/conference-V2XZGTKU.js.map +0 -7
  127. package/src/Prebuilt/components/AudioLevel/BeamSpeakerLabelsLogging.jsx +0 -16
  128. package/src/Prebuilt/components/VideoList.jsx +0 -73
  129. /package/dist/{VirtualBackground-AYDHYLIZ.js.map → VirtualBackground-UM2FOUHQ.js.map} +0 -0
  130. /package/dist/{chunk-E2M2ZSOL.js.map → chunk-364HP22I.js.map} +0 -0
@@ -9,7 +9,7 @@ import {
9
9
  Slider,
10
10
  ToastManager,
11
11
  useTheme
12
- } from "./chunk-RXTHJUMZ.js";
12
+ } from "./chunk-LYSAET4G.js";
13
13
  import {
14
14
  Box,
15
15
  Flex,
@@ -20,16 +20,18 @@ import {
20
20
  Tooltip,
21
21
  __async,
22
22
  __objRest,
23
+ __spreadValues,
24
+ config,
23
25
  styled
24
- } from "./chunk-GQD2AGWW.js";
26
+ } from "./chunk-POE7H4IE.js";
25
27
 
26
28
  // src/Prebuilt/layouts/HLSView.jsx
27
- import React10, { useCallback, useEffect as useEffect3, useRef as useRef2, useState as useState5 } from "react";
28
- import { useFullscreen, useToggle } from "react-use";
29
+ import React10, { useCallback, useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
30
+ import { useFullscreen, useMedia, useToggle } from "react-use";
29
31
  import { HLSPlaybackState, HMSHLSPlayer, HMSHLSPlayerEvents as HMSHLSPlayerEvents2 } from "@100mslive/hls-player";
30
32
  import screenfull from "screenfull";
31
33
  import { selectAppData, selectHLSState, useHMSActions, useHMSStore } from "@100mslive/react-sdk";
32
- import { ExpandIcon, RadioIcon, ShrinkIcon } from "@100mslive/react-icons";
34
+ import { ColoredHandIcon, ExpandIcon, RadioIcon, ShrinkIcon } from "@100mslive/react-icons";
33
35
 
34
36
  // src/Prebuilt/components/HlsStatsOverlay.jsx
35
37
  import React, { memo } from "react";
@@ -115,6 +117,7 @@ var HlsStatsRow = memo(({ label, children }) => {
115
117
  var VideoControls = styled(Flex, {
116
118
  justifyContent: "center",
117
119
  alignItems: "center",
120
+ alignSelf: "stretch",
118
121
  width: "100%",
119
122
  gap: "$2"
120
123
  });
@@ -133,8 +136,9 @@ var RightControls = styled(Flex, {
133
136
 
134
137
  // src/Prebuilt/components/HMSVideo/HMSVideo.jsx
135
138
  import React2, { forwardRef } from "react";
136
- var HMSVideo = forwardRef(({ children }, videoRef) => {
137
- return /* @__PURE__ */ React2.createElement(Flex, { "data-testid": "hms-video", css: { size: "100%" }, direction: "column" }, /* @__PURE__ */ React2.createElement("video", { style: { flex: "1 1 0", margin: "0 auto", minHeight: "0" }, ref: videoRef, playsInline: true }), children);
139
+ var HMSVideo = forwardRef((_a, videoRef) => {
140
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
141
+ return /* @__PURE__ */ React2.createElement(Flex, __spreadValues({ "data-testid": "hms-video", css: { size: "100%", position: "relative" }, direction: "column" }, props), /* @__PURE__ */ React2.createElement("video", { style: { flex: "1 1 0", margin: "0 auto", minHeight: "0" }, ref: videoRef, playsInline: true }), children);
138
142
  });
139
143
 
140
144
  // src/Prebuilt/components/HMSVideo/PlayButton.jsx
@@ -207,7 +211,7 @@ var VideoProgress = ({ onValueChange, hlsPlayer: hlsPlayer2 }) => {
207
211
  Flex,
208
212
  {
209
213
  ref: progressRootRef,
210
- css: { paddingLeft: "$8", paddingRight: "$8", cursor: "pointer" },
214
+ css: { cursor: "pointer", h: "$4", alignSelf: "stretch" },
211
215
  onClick: onProgressChangeHandler
212
216
  },
213
217
  /* @__PURE__ */ React4.createElement(
@@ -217,8 +221,7 @@ var VideoProgress = ({ onValueChange, hlsPlayer: hlsPlayer2 }) => {
217
221
  css: {
218
222
  display: "inline",
219
223
  width: `${videoProgress}%`,
220
- background: "$primary_default",
221
- height: "0.3rem"
224
+ background: "$primary_default"
222
225
  }
223
226
  }
224
227
  ),
@@ -228,8 +231,8 @@ var VideoProgress = ({ onValueChange, hlsPlayer: hlsPlayer2 }) => {
228
231
  id: "video-buffer",
229
232
  css: {
230
233
  width: `${bufferProgress - videoProgress}%`,
231
- background: "$primary_dim",
232
- height: "0.3rem"
234
+ background: "$on_surface_high",
235
+ opacity: "25%"
233
236
  }
234
237
  }
235
238
  ),
@@ -239,8 +242,8 @@ var VideoProgress = ({ onValueChange, hlsPlayer: hlsPlayer2 }) => {
239
242
  id: "video-rest",
240
243
  css: {
241
244
  width: `${100 - bufferProgress}%`,
242
- background: "$surface_brighter",
243
- height: "0.3rem"
245
+ background: "$on_surface_high",
246
+ opacity: "10%"
244
247
  }
245
248
  }
246
249
  )
@@ -288,7 +291,7 @@ var VolumeControl = ({ hlsPlayer: hlsPlayer2 }) => {
288
291
  Flex,
289
292
  {
290
293
  align: "center",
291
- css: { color: "$on_primary_high" },
294
+ css: { color: "$on_surface_high" },
292
295
  onMouseOver: (event) => {
293
296
  event.stopPropagation();
294
297
  setShowSlider(true);
@@ -403,11 +406,10 @@ function HLSAutoplayBlockedPrompt({ open, unblockAutoPlay }) {
403
406
  }
404
407
 
405
408
  // src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx
406
- import React9, { useState as useState4 } from "react";
407
- import { CheckCircleIcon, SettingsIcon } from "@100mslive/react-icons";
408
- function HLSQualitySelector({ layers, onQualityChange, selection, isAuto }) {
409
- const [qualityDropDownOpen, setQualityDropDownOpen] = useState4(false);
410
- return /* @__PURE__ */ React9.createElement(Dropdown.Root, { open: qualityDropDownOpen, onOpenChange: (value) => setQualityDropDownOpen(value) }, /* @__PURE__ */ React9.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React9.createElement(
409
+ import React9 from "react";
410
+ import { CheckIcon, SettingsIcon } from "@100mslive/react-icons";
411
+ function HLSQualitySelector({ open, onOpen, layers, onQualityChange, selection, isAuto }) {
412
+ return /* @__PURE__ */ React9.createElement(Dropdown.Root, { open, onOpenChange: (value) => onOpen(value) }, /* @__PURE__ */ React9.createElement(Dropdown.Trigger, { asChild: true, "data-testid": "quality_selector" }, /* @__PURE__ */ React9.createElement(
411
413
  Flex,
412
414
  {
413
415
  css: {
@@ -424,7 +426,8 @@ function HLSQualitySelector({ layers, onQualityChange, selection, isAuto }) {
424
426
  w: "$9",
425
427
  h: "$9",
426
428
  display: "inline-flex",
427
- alignItems: "center"
429
+ alignItems: "center",
430
+ c: "$on_surface_high"
428
431
  }
429
432
  },
430
433
  /* @__PURE__ */ React9.createElement(SettingsIcon, null)
@@ -445,7 +448,7 @@ function HLSQualitySelector({ layers, onQualityChange, selection, isAuto }) {
445
448
  mx: "$2",
446
449
  w: "$2",
447
450
  h: "$2",
448
- background: "$on_primary_high",
451
+ background: "$on_surface_medium",
449
452
  r: "$1"
450
453
  }
451
454
  }
@@ -458,7 +461,15 @@ function HLSQualitySelector({ layers, onQualityChange, selection, isAuto }) {
458
461
  {
459
462
  sideOffset: 5,
460
463
  align: "end",
461
- css: { height: "auto", maxHeight: "$96", w: "$64", bg: "$surface_bright" }
464
+ css: {
465
+ height: "auto",
466
+ maxHeight: "$52",
467
+ w: "$40",
468
+ bg: "$surface_bright",
469
+ py: "$4",
470
+ gap: "$4",
471
+ display: "grid"
472
+ }
462
473
  },
463
474
  layers.map((layer) => {
464
475
  return /* @__PURE__ */ React9.createElement(
@@ -467,15 +478,18 @@ function HLSQualitySelector({ layers, onQualityChange, selection, isAuto }) {
467
478
  onClick: () => onQualityChange(layer),
468
479
  key: layer.width,
469
480
  css: {
470
- bg: "$surface_bright",
481
+ bg: !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) ? "$surface_default" : "$surface_bright",
471
482
  "&:hover": {
472
- bg: "$surface_default"
473
- }
483
+ bg: "$surface_brighter"
484
+ },
485
+ p: "$2 $4 $2 $8",
486
+ h: "$12",
487
+ gap: "$2"
474
488
  }
475
489
  },
476
- /* @__PURE__ */ React9.createElement(Text, null, getQualityText(layer)),
477
- /* @__PURE__ */ React9.createElement(Text, { css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
478
- !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React9.createElement(CheckCircleIcon, null)
490
+ /* @__PURE__ */ React9.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
491
+ /* @__PURE__ */ React9.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
492
+ !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React9.createElement(CheckIcon, { width: "16px", height: "16px" })
479
493
  );
480
494
  }),
481
495
  /* @__PURE__ */ React9.createElement(
@@ -484,14 +498,17 @@ function HLSQualitySelector({ layers, onQualityChange, selection, isAuto }) {
484
498
  onClick: () => onQualityChange({ height: "auto" }),
485
499
  key: "auto",
486
500
  css: {
487
- bg: "$surface_bright",
501
+ bg: !isAuto ? "$surface_bright" : "$surface_default",
488
502
  "&:hover": {
489
- bg: "$surface_default"
490
- }
503
+ bg: "$surface_brighter"
504
+ },
505
+ p: "$2 $4 $2 $8",
506
+ h: "$12",
507
+ gap: "$2"
491
508
  }
492
509
  },
493
- /* @__PURE__ */ React9.createElement(Text, { css: { flex: "1 1 0" } }, "Auto"),
494
- isAuto && /* @__PURE__ */ React9.createElement(CheckCircleIcon, null)
510
+ /* @__PURE__ */ React9.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold", flex: "1 1 0" } }, "Auto"),
511
+ isAuto && /* @__PURE__ */ React9.createElement(CheckIcon, { width: "16px", height: "16px" })
495
512
  )
496
513
  ));
497
514
  }
@@ -507,21 +524,27 @@ var HLSView = () => {
507
524
  const hlsState = useHMSStore(selectHLSState);
508
525
  const enablHlsStats = useHMSStore(selectAppData(APP_DATA.hlsStats));
509
526
  const hmsActions = useHMSActions();
510
- const { themeType } = useTheme();
511
- let [hlsStatsState, setHlsStatsState] = useState5(null);
527
+ const { themeType, theme } = useTheme();
528
+ const [streamEnded, setStreamEnded] = useState4(false);
529
+ let [hlsStatsState, setHlsStatsState] = useState4(null);
512
530
  const hlsUrl = (_a = hlsState.variants[0]) == null ? void 0 : _a.url;
513
- const [availableLayers, setAvailableLayers] = useState5([]);
514
- const [isVideoLive, setIsVideoLive] = useState5(true);
515
- const [isUserSelectedAuto, setIsUserSelectedAuto] = useState5(true);
516
- const [currentSelectedQuality, setCurrentSelectedQuality] = useState5(null);
517
- const [isHlsAutoplayBlocked, setIsHlsAutoplayBlocked] = useState5(false);
518
- const [isPaused, setIsPaused] = useState5(false);
531
+ const [availableLayers, setAvailableLayers] = useState4([]);
532
+ const [isVideoLive, setIsVideoLive] = useState4(true);
533
+ const [isUserSelectedAuto, setIsUserSelectedAuto] = useState4(true);
534
+ const [currentSelectedQuality, setCurrentSelectedQuality] = useState4(null);
535
+ const [isHlsAutoplayBlocked, setIsHlsAutoplayBlocked] = useState4(false);
536
+ const [isPaused, setIsPaused] = useState4(false);
519
537
  const isFullScreenSupported = screenfull.isEnabled;
520
538
  const [show, toggle] = useToggle(false);
539
+ const [controlsVisible, setControlsVisible] = useState4(true);
540
+ const controlsRef = useRef2();
541
+ const controlsTimerRef = useRef2();
542
+ const [qualityDropDownOpen, setQualityDropDownOpen] = useState4(false);
543
+ const isMobile = useMedia(config.media.md);
521
544
  const isFullScreen = useFullscreen(hlsViewRef, show, {
522
545
  onClose: () => toggle(false)
523
546
  });
524
- const [showLoader, setShowLoader] = useState5(false);
547
+ const [showLoader, setShowLoader] = useState4(false);
525
548
  useEffect3(() => {
526
549
  const videoEl = videoRef.current;
527
550
  const showLoader2 = () => setShowLoader(true);
@@ -533,6 +556,17 @@ var HLSView = () => {
533
556
  videoEl == null ? void 0 : videoEl.removeEventListener("waiting", showLoader2);
534
557
  };
535
558
  }, []);
559
+ useEffect3(() => {
560
+ const videoElem = videoRef.current;
561
+ const setStreamEndedCallback = () => {
562
+ setStreamEnded(true);
563
+ videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
564
+ };
565
+ videoElem == null ? void 0 : videoElem.addEventListener("ended", setStreamEndedCallback);
566
+ return () => {
567
+ videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
568
+ };
569
+ }, [hlsUrl]);
536
570
  useEffect3(() => {
537
571
  let videoEl = videoRef.current;
538
572
  const manifestLoadedHandler = ({ layers }) => {
@@ -543,6 +577,7 @@ var HLSView = () => {
543
577
  };
544
578
  const metadataLoadedHandler = (_a2) => {
545
579
  var _b = _a2, { payload } = _b, rest = __objRest(_b, ["payload"]);
580
+ var _a3;
546
581
  const parsePayload = (str) => {
547
582
  try {
548
583
  return JSON.parse(str);
@@ -554,7 +589,7 @@ var HLSView = () => {
554
589
  const parsedPayload = parsePayload(payload);
555
590
  switch (parsedPayload.type) {
556
591
  case EMOJI_REACTION_TYPE:
557
- window.showFlyingEmoji(parsedPayload == null ? void 0 : parsedPayload.emojiId, parsedPayload == null ? void 0 : parsedPayload.senderId);
592
+ (_a3 = window.showFlyingEmoji) == null ? void 0 : _a3.call(window, { emojiId: parsedPayload == null ? void 0 : parsedPayload.emojiId, senderId: parsedPayload == null ? void 0 : parsedPayload.senderId });
558
593
  break;
559
594
  default: {
560
595
  const toast = {
@@ -629,6 +664,41 @@ var HLSView = () => {
629
664
  const sfnOverlayClose = () => {
630
665
  hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats);
631
666
  };
667
+ useEffect3(() => {
668
+ if (controlsVisible && isFullScreen && !qualityDropDownOpen) {
669
+ if (controlsTimerRef.current) {
670
+ clearTimeout(controlsTimerRef.current);
671
+ }
672
+ controlsTimerRef.current = setTimeout(() => {
673
+ setControlsVisible(false);
674
+ }, 5e3);
675
+ }
676
+ if (!isFullScreen && controlsTimerRef.current) {
677
+ clearTimeout(controlsTimerRef.current);
678
+ }
679
+ return () => {
680
+ if (controlsTimerRef.current) {
681
+ clearTimeout(controlsTimerRef.current);
682
+ }
683
+ };
684
+ }, [controlsVisible, isFullScreen, qualityDropDownOpen]);
685
+ const onHoverHandler = useCallback(
686
+ (event) => {
687
+ if (event.type === "mouseenter" || qualityDropDownOpen) {
688
+ setControlsVisible(true);
689
+ return;
690
+ }
691
+ if (event.type === "mouseleave") {
692
+ setControlsVisible(false);
693
+ } else if (isFullScreen && !controlsVisible && event.type === "mousemove") {
694
+ setControlsVisible(true);
695
+ if (controlsTimerRef.current) {
696
+ clearTimeout(controlsTimerRef.current);
697
+ }
698
+ }
699
+ },
700
+ [controlsVisible, isFullScreen, qualityDropDownOpen]
701
+ );
632
702
  return /* @__PURE__ */ React10.createElement(
633
703
  Flex,
634
704
  {
@@ -640,7 +710,7 @@ var HLSView = () => {
640
710
  }
641
711
  },
642
712
  (hlsStatsState == null ? void 0 : hlsStatsState.url) && enablHlsStats ? /* @__PURE__ */ React10.createElement(HlsStatsOverlay, { hlsStatsState, onClose: sfnOverlayClose }) : null,
643
- hlsUrl && hlsState.running ? /* @__PURE__ */ React10.createElement(
713
+ hlsUrl && !streamEnded ? /* @__PURE__ */ React10.createElement(
644
714
  Flex,
645
715
  {
646
716
  id: "hls-player-container",
@@ -649,8 +719,7 @@ var HLSView = () => {
649
719
  css: {
650
720
  width: "100%",
651
721
  margin: "0 auto",
652
- height: "100%",
653
- background: "linear-gradient(180deg, rgba(0, 0, 0, 0.00) 0%, #000 100%)"
722
+ height: "100%"
654
723
  }
655
724
  },
656
725
  /* @__PURE__ */ React10.createElement(HLSAutoplayBlockedPrompt, { open: isHlsAutoplayBlocked, unblockAutoPlay }),
@@ -665,89 +734,110 @@ var HLSView = () => {
665
734
  },
666
735
  /* @__PURE__ */ React10.createElement(Loading, { width: 72, height: 72 })
667
736
  ),
668
- /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Root, { ref: videoRef }, /* @__PURE__ */ React10.createElement(
669
- Flex,
737
+ /* @__PURE__ */ React10.createElement(
738
+ HMSVideoPlayer.Root,
670
739
  {
671
- direction: "column",
672
- justify: "flex-end",
673
- align: "flex-start",
674
- css: {
675
- background: "linear-gradient(180deg, rgba(0, 0, 0, 0.00) 0%, #000 100%)"
676
- }
740
+ ref: videoRef,
741
+ onMouseEnter: onHoverHandler,
742
+ onMouseMove: onHoverHandler,
743
+ onMouseLeave: onHoverHandler
677
744
  },
678
- hlsPlayer && /* @__PURE__ */ React10.createElement(
679
- HMSVideoPlayer.Progress,
745
+ /* @__PURE__ */ React10.createElement(
746
+ Flex,
680
747
  {
681
- onValueChange: (currentTime) => {
682
- hlsPlayer.seekTo(currentTime);
683
- },
684
- hlsPlayer
685
- }
686
- ),
687
- /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Controls.Root, { css: { p: "$4 $8" } }, /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Controls.Left, null, /* @__PURE__ */ React10.createElement(
688
- HMSVideoPlayer.PlayButton,
689
- {
690
- onClick: () => __async(void 0, null, function* () {
691
- isPaused ? yield hlsPlayer == null ? void 0 : hlsPlayer.play() : hlsPlayer == null ? void 0 : hlsPlayer.pause();
692
- }),
693
- isPaused
694
- }
695
- ), /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Duration, { hlsPlayer }), /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Volume, { hlsPlayer }), /* @__PURE__ */ React10.createElement(
696
- IconButton,
697
- {
698
- variant: "standard",
699
- css: { px: "$2" },
700
- onClick: () => __async(void 0, null, function* () {
701
- yield hlsPlayer.seekToLivePosition();
702
- setIsVideoLive(true);
703
- }),
704
- key: "jump-to-live_btn",
705
- "data-testid": "jump-to-live_btn"
748
+ ref: controlsRef,
749
+ direction: "column",
750
+ justify: "flex-end",
751
+ align: "flex-start",
752
+ css: {
753
+ position: "absolute",
754
+ bottom: "0",
755
+ left: "0",
756
+ background: `linear-gradient(180deg, ${theme.colors.background_dim.value}00 29.46%, ${theme.colors.background_dim.value}A3 100%);`,
757
+ width: "100%",
758
+ pt: "$8",
759
+ flexShrink: 0,
760
+ transition: "visibility 0s 0.5s, opacity 0.5s linear",
761
+ visibility: controlsVisible ? `` : `hidden`,
762
+ opacity: controlsVisible ? `1` : "0"
763
+ }
706
764
  },
707
- /* @__PURE__ */ React10.createElement(Tooltip, { title: "Go to Live", side: "top" }, /* @__PURE__ */ React10.createElement(Flex, { justify: "center", gap: 2, align: "center" }, /* @__PURE__ */ React10.createElement(
708
- Box,
765
+ !isMobile && /* @__PURE__ */ React10.createElement(
766
+ HMSVideoPlayer.Controls.Root,
709
767
  {
710
768
  css: {
711
- height: "$4",
712
- width: "$4",
713
- background: isVideoLive ? "$alert_error_default" : "$on_primary_medium",
714
- r: "$1"
769
+ p: "$4 $8"
715
770
  }
716
- }
717
- ), /* @__PURE__ */ React10.createElement(
718
- Text,
719
- {
720
- variant: {
721
- "@sm": "xs"
771
+ },
772
+ /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Controls.Left, null, /* @__PURE__ */ React10.createElement(
773
+ HMSVideoPlayer.PlayButton,
774
+ {
775
+ onClick: () => __async(void 0, null, function* () {
776
+ isPaused ? yield hlsPlayer == null ? void 0 : hlsPlayer.play() : hlsPlayer == null ? void 0 : hlsPlayer.pause();
777
+ }),
778
+ isPaused
779
+ }
780
+ ), /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Duration, { hlsPlayer }), /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Volume, { hlsPlayer }), /* @__PURE__ */ React10.createElement(
781
+ IconButton,
782
+ {
783
+ variant: "standard",
784
+ css: { px: "$2" },
785
+ onClick: () => __async(void 0, null, function* () {
786
+ yield hlsPlayer.seekToLivePosition();
787
+ setIsVideoLive(true);
788
+ }),
789
+ key: "jump-to-live_btn",
790
+ "data-testid": "jump-to-live_btn"
722
791
  },
723
- css: {
724
- c: isVideoLive ? "$on_primary_high" : "$on_primary_medium"
792
+ /* @__PURE__ */ React10.createElement(Tooltip, { title: "Go to Live", side: "top" }, /* @__PURE__ */ React10.createElement(Flex, { justify: "center", gap: 2, align: "center" }, /* @__PURE__ */ React10.createElement(
793
+ Box,
794
+ {
795
+ css: {
796
+ height: "$4",
797
+ width: "$4",
798
+ background: isVideoLive ? "$alert_error_default" : "$on_primary_medium",
799
+ r: "$1"
800
+ }
801
+ }
802
+ ), /* @__PURE__ */ React10.createElement(
803
+ Text,
804
+ {
805
+ variant: {
806
+ "@sm": "xs"
807
+ },
808
+ css: {
809
+ c: isVideoLive ? "$on_surface_high" : "$on_surface_medium"
810
+ }
811
+ },
812
+ isVideoLive ? "LIVE" : "GO LIVE"
813
+ )))
814
+ )),
815
+ /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Controls.Right, null, availableLayers.length > 0 ? /* @__PURE__ */ React10.createElement(
816
+ HLSQualitySelector,
817
+ {
818
+ layers: availableLayers,
819
+ onOpen: setQualityDropDownOpen,
820
+ open: qualityDropDownOpen,
821
+ selection: currentSelectedQuality,
822
+ onQualityChange: handleQuality,
823
+ isAuto: isUserSelectedAuto
725
824
  }
726
- },
727
- isVideoLive ? "LIVE" : "GO LIVE"
728
- )))
729
- )), /* @__PURE__ */ React10.createElement(HMSVideoPlayer.Controls.Right, null, availableLayers.length > 0 ? /* @__PURE__ */ React10.createElement(
730
- HLSQualitySelector,
731
- {
732
- layers: availableLayers,
733
- selection: currentSelectedQuality,
734
- onQualityChange: handleQuality,
735
- isAuto: isUserSelectedAuto
736
- }
737
- ) : null, isFullScreenSupported ? /* @__PURE__ */ React10.createElement(
738
- FullScreenButton,
739
- {
740
- isFullScreen,
741
- onToggle: toggle,
742
- icon: isFullScreen ? /* @__PURE__ */ React10.createElement(ShrinkIcon, null) : /* @__PURE__ */ React10.createElement(ExpandIcon, null)
743
- }
744
- ) : null))
745
- ))
746
- ) : /* @__PURE__ */ React10.createElement(Flex, { align: "center", justify: "center", direction: "column", css: { size: "100%", px: "$10" } }, /* @__PURE__ */ React10.createElement(Flex, { css: { c: "$on_surface_high", r: "$round", bg: "$surface_default", p: "$2" } }, /* @__PURE__ */ React10.createElement(RadioIcon, { height: 56, width: 56 })), /* @__PURE__ */ React10.createElement(Text, { variant: "h5", css: { c: "$on_surface_high", mt: "$10", mb: 0, textAlign: "center" } }, "Stream yet to start"), /* @__PURE__ */ React10.createElement(Text, { variant: "md", css: { textAlign: "center", mt: "$4", c: "$on_surface_medium" } }, "Sit back and relax"))
825
+ ) : null, isFullScreenSupported ? /* @__PURE__ */ React10.createElement(
826
+ FullScreenButton,
827
+ {
828
+ isFullScreen,
829
+ onToggle: toggle,
830
+ icon: isFullScreen ? /* @__PURE__ */ React10.createElement(ShrinkIcon, null) : /* @__PURE__ */ React10.createElement(ExpandIcon, null)
831
+ }
832
+ ) : null)
833
+ )
834
+ )
835
+ )
836
+ ) : /* @__PURE__ */ React10.createElement(Flex, { align: "center", justify: "center", direction: "column", css: { size: "100%", px: "$10" } }, /* @__PURE__ */ React10.createElement(Flex, { css: { c: "$on_surface_high", r: "$round", bg: "$surface_default", p: "$2" } }, streamEnded ? /* @__PURE__ */ React10.createElement(ColoredHandIcon, { height: 56, width: 56 }) : /* @__PURE__ */ React10.createElement(RadioIcon, { height: 56, width: 56 })), /* @__PURE__ */ React10.createElement(Text, { variant: "h5", css: { c: "$on_surface_high", mt: "$10", mb: 0, textAlign: "center" } }, streamEnded ? "Stream has ended" : "Stream yet to start"), /* @__PURE__ */ React10.createElement(Text, { variant: "md", css: { textAlign: "center", mt: "$4", c: "$on_surface_medium" } }, streamEnded ? "Have a nice day!" : "Sit back and relax"))
747
837
  );
748
838
  };
749
839
  var HLSView_default = HLSView;
750
840
  export {
751
841
  HLSView_default as default
752
842
  };
753
- //# sourceMappingURL=HLSView-PY2FKWX3.js.map
843
+ //# sourceMappingURL=HLSView-HNVYG5VE.js.map