@100mslive/roomkit-react 0.3.9 → 0.3.10-alpha.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,10 +23,6 @@ import {
23
23
  Text,
24
24
  ToastManager,
25
25
  Tooltip,
26
- __async,
27
- __objRest,
28
- __spreadProps,
29
- __spreadValues,
30
26
  config,
31
27
  init_define_process_env,
32
28
  styled,
@@ -38,7 +34,7 @@ import {
38
34
  useRoomLayoutHeader,
39
35
  useSidepaneToggle,
40
36
  useTheme
41
- } from "./chunk-5KG27WWA.js";
37
+ } from "./chunk-WSDBUVSZ.js";
42
38
 
43
39
  // src/Prebuilt/layouts/HLSView.jsx
44
40
  init_define_process_env();
@@ -66,7 +62,6 @@ init_define_process_env();
66
62
  import React, { memo } from "react";
67
63
  import { CrossIcon } from "@100mslive/react-icons";
68
64
  function HlsStatsOverlay({ hlsStatsState, onClose }) {
69
- var _a, _b, _c;
70
65
  return /* @__PURE__ */ React.createElement(
71
66
  Flex,
72
67
  {
@@ -86,18 +81,18 @@ function HlsStatsOverlay({ hlsStatsState, onClose }) {
86
81
  "a",
87
82
  {
88
83
  style: { cursor: "pointer", textDecoration: "underline" },
89
- href: hlsStatsState == null ? void 0 : hlsStatsState.url,
84
+ href: hlsStatsState?.url,
90
85
  target: "_blank",
91
86
  rel: "noreferrer"
92
87
  },
93
88
  "Stream url"
94
89
  ))),
95
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Video size" }, ` ${(_a = hlsStatsState == null ? void 0 : hlsStatsState.videoSize) == null ? void 0 : _a.width}x${(_b = hlsStatsState == null ? void 0 : hlsStatsState.videoSize) == null ? void 0 : _b.height}`),
96
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Buffer duration" }, (_c = hlsStatsState == null ? void 0 : hlsStatsState.bufferedDuration) == null ? void 0 : _c.toFixed(2), " "),
97
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Connection speed" }, `${((hlsStatsState == null ? void 0 : hlsStatsState.bandwidthEstimate) / (1e3 * 1e3)).toFixed(2)} Mbps`),
98
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Bitrate" }, `${((hlsStatsState == null ? void 0 : hlsStatsState.bitrate) / (1e3 * 1e3)).toFixed(2)} Mbps`),
90
+ /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Video size" }, ` ${hlsStatsState?.videoSize?.width}x${hlsStatsState?.videoSize?.height}`),
91
+ /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Buffer duration" }, hlsStatsState?.bufferedDuration?.toFixed(2), " "),
92
+ /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Connection speed" }, `${(hlsStatsState?.bandwidthEstimate / (1e3 * 1e3)).toFixed(2)} Mbps`),
93
+ /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Bitrate" }, `${(hlsStatsState?.bitrate / (1e3 * 1e3)).toFixed(2)} Mbps`),
99
94
  /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "distance from live" }, getDurationFromSeconds(hlsStatsState.distanceFromLive / 1e3)),
100
- /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Dropped frames" }, hlsStatsState == null ? void 0 : hlsStatsState.droppedFrames)
95
+ /* @__PURE__ */ React.createElement(HlsStatsRow, { label: "Dropped frames" }, hlsStatsState?.droppedFrames)
101
96
  );
102
97
  }
103
98
  function getDurationFromSeconds(timeInSeconds) {
@@ -170,11 +165,10 @@ var RightControls = styled(Flex, {
170
165
  // src/Prebuilt/components/HMSVideo/HMSVideo.jsx
171
166
  init_define_process_env();
172
167
  import React2, { forwardRef } from "react";
173
- var HMSVideo = forwardRef((_a, videoRef) => {
174
- var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
168
+ var HMSVideo = forwardRef(({ children, ...props }, videoRef) => {
175
169
  return /* @__PURE__ */ React2.createElement(
176
170
  Flex,
177
- __spreadValues({
171
+ {
178
172
  "data-testid": "hms-video",
179
173
  css: {
180
174
  size: "100%",
@@ -205,8 +199,9 @@ var HMSVideo = forwardRef((_a, videoRef) => {
205
199
  fontSize: "$space$10 !important"
206
200
  }
207
201
  },
208
- direction: "column"
209
- }, props),
202
+ direction: "column",
203
+ ...props
204
+ },
210
205
  /* @__PURE__ */ React2.createElement(
211
206
  "video",
212
207
  {
@@ -255,10 +250,10 @@ var PlayPauseButton = ({
255
250
  height = 20
256
251
  }) => {
257
252
  const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
258
- const onClick = (event) => __async(void 0, null, function* () {
259
- event == null ? void 0 : event.stopPropagation();
260
- isPaused ? yield hlsPlayer2 == null ? void 0 : hlsPlayer2.play() : hlsPlayer2 == null ? void 0 : hlsPlayer2.pause();
261
- });
253
+ const onClick = async (event) => {
254
+ event?.stopPropagation();
255
+ isPaused ? await hlsPlayer2?.play() : hlsPlayer2?.pause();
256
+ };
262
257
  return /* @__PURE__ */ React4.createElement(Tooltip, { title: isPaused ? "Play" : "Pause", side: "top" }, /* @__PURE__ */ React4.createElement(IconButton, { onClick, "data-testid": "play_pause_btn" }, isPaused ? /* @__PURE__ */ React4.createElement(PlayIcon, { width, height }) : /* @__PURE__ */ React4.createElement(PauseIcon, { width, height })));
263
258
  };
264
259
 
@@ -445,9 +440,8 @@ var VideoProgress = ({
445
440
  const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
446
441
  const [videoProgress, setVideoProgress] = useState(0);
447
442
  const [bufferProgress, setBufferProgress] = useState(0);
448
- const videoEl = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
443
+ const videoEl = hlsPlayer2?.getVideoElement();
449
444
  const setProgress = useCallback(() => {
450
- var _a;
451
445
  if (!videoEl) {
452
446
  return;
453
447
  }
@@ -455,7 +449,7 @@ var VideoProgress = ({
455
449
  const videoProgress2 = Math.floor(getPercentage(videoEl.currentTime, duration));
456
450
  let bufferProgress2 = 0;
457
451
  if (videoEl.buffered.length > 0) {
458
- bufferProgress2 = Math.floor(getPercentage((_a = videoEl.buffered) == null ? void 0 : _a.end(0), duration));
452
+ bufferProgress2 = Math.floor(getPercentage(videoEl.buffered?.end(0), duration));
459
453
  }
460
454
  if (!isNaN(videoProgress2)) {
461
455
  setVideoProgress(videoProgress2);
@@ -477,19 +471,18 @@ var VideoProgress = ({
477
471
  setProgress();
478
472
  videoEl.addEventListener("timeupdate", timeupdateHandler);
479
473
  return function cleanup() {
480
- videoEl == null ? void 0 : videoEl.removeEventListener("timeupdate", timeupdateHandler);
474
+ videoEl?.removeEventListener("timeupdate", timeupdateHandler);
481
475
  };
482
476
  }, [setProgress, timeupdateHandler, videoEl]);
483
477
  const onProgress = (progress) => {
484
- var _a;
485
478
  const progress1 = Math.floor(getPercentage(progress[0], 100));
486
- const videoEl2 = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
479
+ const videoEl2 = hlsPlayer2?.getVideoElement();
487
480
  if (!videoEl2) {
488
481
  return;
489
482
  }
490
- const duration = isFinite(videoEl2.duration) ? videoEl2.duration : ((_a = videoEl2.seekable) == null ? void 0 : _a.end(0)) || 0;
483
+ const duration = isFinite(videoEl2.duration) ? videoEl2.duration : videoEl2.seekable?.end(0) || 0;
491
484
  const currentTime = progress1 * duration / 100;
492
- hlsPlayer2 == null ? void 0 : hlsPlayer2.seekTo(currentTime);
485
+ hlsPlayer2?.seekTo(currentTime);
493
486
  setProgress();
494
487
  };
495
488
  if (!videoEl) {
@@ -540,7 +533,7 @@ var VideoTime = () => {
540
533
  const [videoTime, setVideoTime] = useState2(getDurationFromSeconds2(0));
541
534
  const updateTime = useCallback2(
542
535
  (currentTime) => {
543
- const videoEl = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
536
+ const videoEl = hlsPlayer2?.getVideoElement();
544
537
  if (videoEl) {
545
538
  const duration = getDuration(videoEl);
546
539
  setVideoTime(getDurationFromSeconds2(duration - currentTime));
@@ -556,11 +549,11 @@ var VideoTime = () => {
556
549
  };
557
550
  if (hlsPlayer2) {
558
551
  hlsPlayer2.on(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
559
- const videoEl = hlsPlayer2 == null ? void 0 : hlsPlayer2.getVideoElement();
552
+ const videoEl = hlsPlayer2?.getVideoElement();
560
553
  updateTime(videoEl.currentTime);
561
554
  }
562
555
  return function cleanup() {
563
- hlsPlayer2 == null ? void 0 : hlsPlayer2.off(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
556
+ hlsPlayer2?.off(HMSHLSPlayerEvents.CURRENT_TIME, timeupdateHandler);
564
557
  };
565
558
  }, [hlsPlayer2, updateTime]);
566
559
  return hlsPlayer2 ? /* @__PURE__ */ React8.createElement(
@@ -585,9 +578,8 @@ init_define_process_env();
585
578
  import React9, { useState as useState3 } from "react";
586
579
  import { VolumeOneIcon, VolumeTwoIcon, VolumeZeroIcon } from "@100mslive/react-icons";
587
580
  var VolumeControl = () => {
588
- var _a;
589
581
  const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
590
- const [volume, setVolume] = useState3((_a = hlsPlayer2 == null ? void 0 : hlsPlayer2.volume) != null ? _a : 100);
582
+ const [volume, setVolume] = useState3(hlsPlayer2?.volume ?? 100);
591
583
  const [showSlider, setShowSlider] = useState3(false);
592
584
  return /* @__PURE__ */ React9.createElement(
593
585
  Flex,
@@ -610,10 +602,10 @@ var VolumeControl = () => {
610
602
  onClick: () => {
611
603
  if (volume > 0) {
612
604
  setVolume(0);
613
- hlsPlayer2 == null ? void 0 : hlsPlayer2.setVolume(0);
605
+ hlsPlayer2?.setVolume(0);
614
606
  } else {
615
607
  setVolume(100);
616
- hlsPlayer2 == null ? void 0 : hlsPlayer2.setVolume(100);
608
+ hlsPlayer2?.setVolume(100);
617
609
  }
618
610
  }
619
611
  }
@@ -636,7 +628,7 @@ var VolumeControl = () => {
636
628
  step: 1,
637
629
  value: [volume],
638
630
  onValueChange: (volume2) => {
639
- hlsPlayer2 == null ? void 0 : hlsPlayer2.setVolume(volume2[0]);
631
+ hlsPlayer2?.setVolume(volume2[0]);
640
632
  setVolume(volume2[0]);
641
633
  },
642
634
  thumbStyles: { w: "$6", h: "$6" }
@@ -697,9 +689,7 @@ function HLSAutoplayBlockedPrompt({
697
689
  color: "#000",
698
690
  r: "$2"
699
691
  },
700
- onClick: () => __async(this, null, function* () {
701
- return yield unblockAutoPlay();
702
- })
692
+ onClick: async () => await unblockAutoPlay()
703
693
  },
704
694
  /* @__PURE__ */ React11.createElement(VolumeTwoIcon2, { width: "32", height: "32" }),
705
695
  /* @__PURE__ */ React11.createElement(
@@ -720,19 +710,19 @@ function HLSAutoplayBlockedPrompt({
720
710
  Dialog.Root,
721
711
  {
722
712
  open,
723
- onOpenChange: (value) => __async(this, null, function* () {
713
+ onOpenChange: async (value) => {
724
714
  if (!value) {
725
- yield unblockAutoPlay();
715
+ await unblockAutoPlay();
726
716
  }
727
- })
717
+ }
728
718
  },
729
719
  /* @__PURE__ */ React11.createElement(DialogContent, { title: "Attention", closeable: false }, /* @__PURE__ */ React11.createElement(DialogRow, null, /* @__PURE__ */ React11.createElement(Text, { variant: "md" }, 'The browser wants us to get a confirmation for playing the HLS Stream. Please click "play stream" to proceed.')), /* @__PURE__ */ React11.createElement(DialogRow, { justify: "end" }, /* @__PURE__ */ React11.createElement(
730
720
  Button,
731
721
  {
732
722
  variant: "primary",
733
- onClick: () => __async(this, null, function* () {
734
- yield unblockAutoPlay();
735
- })
723
+ onClick: async () => {
724
+ await unblockAutoPlay();
725
+ }
736
726
  },
737
727
  "Play stream"
738
728
  )))
@@ -745,7 +735,7 @@ import React12 from "react";
745
735
  import { ClosedCaptionIcon, OpenCaptionIcon } from "@100mslive/react-icons";
746
736
  function HLSCaptionSelector({ isEnabled }) {
747
737
  const { hlsPlayer: hlsPlayer2 } = useHMSPlayerContext();
748
- return /* @__PURE__ */ React12.createElement(Tooltip, { title: "Subtitles/closed captions", side: "top" }, /* @__PURE__ */ React12.createElement(IconButton, { css: { p: "$2" }, onClick: () => hlsPlayer2 == null ? void 0 : hlsPlayer2.toggleCaption() }, isEnabled ? /* @__PURE__ */ React12.createElement(ClosedCaptionIcon, { width: "20", height: "20px" }) : /* @__PURE__ */ React12.createElement(OpenCaptionIcon, { width: "20", height: "20px" })));
738
+ return /* @__PURE__ */ React12.createElement(Tooltip, { title: "Subtitles/closed captions", side: "top" }, /* @__PURE__ */ React12.createElement(IconButton, { css: { p: "$2" }, onClick: () => hlsPlayer2?.toggleCaption() }, isEnabled ? /* @__PURE__ */ React12.createElement(ClosedCaptionIcon, { width: "20", height: "20px" }) : /* @__PURE__ */ React12.createElement(OpenCaptionIcon, { width: "20", height: "20px" })));
749
739
  }
750
740
 
751
741
  // src/Prebuilt/components/HMSVideo/HLSQualitySelector.tsx
@@ -826,7 +816,7 @@ function HLSQualitySelector({
826
816
  },
827
817
  /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
828
818
  /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
829
- !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
819
+ !isAuto && layer.width === selection?.width && layer.height === selection?.height && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
830
820
  );
831
821
  }),
832
822
  /* @__PURE__ */ React13.createElement(
@@ -921,7 +911,7 @@ function HLSQualitySelector({
921
911
  onClick: () => onQualityChange(layer),
922
912
  key: layer.width,
923
913
  css: {
924
- bg: !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) ? "$surface_default" : "$surface_bright",
914
+ bg: !isAuto && layer.width === selection?.width && layer.height === selection?.height ? "$surface_default" : "$surface_bright",
925
915
  "&:hover": {
926
916
  bg: "$surface_brighter"
927
917
  },
@@ -932,7 +922,7 @@ function HLSQualitySelector({
932
922
  },
933
923
  /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { fontWeight: "$semiBold" } }, getQualityText(layer)),
934
924
  /* @__PURE__ */ React13.createElement(Text, { variant: "caption", css: { flex: "1 1 0", c: "$on_surface_low", pl: "$2" } }, getBitrateText(layer)),
935
- !isAuto && layer.width === (selection == null ? void 0 : selection.width) && layer.height === (selection == null ? void 0 : selection.height) && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
925
+ !isAuto && layer.width === selection?.width && layer.height === selection?.height && /* @__PURE__ */ React13.createElement(CheckIcon, { width: "16px", height: "16px" })
936
926
  );
937
927
  }),
938
928
  /* @__PURE__ */ React13.createElement(
@@ -1023,7 +1013,7 @@ var ToggleChat = ({ isFullScreen = false }) => {
1023
1013
  const { elements } = useRoomLayoutConferencingScreen();
1024
1014
  const sidepane = useHMSStore(selectAppData(APP_DATA.sidePane));
1025
1015
  const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
1026
- const showChat = !!(elements == null ? void 0 : elements.chat);
1016
+ const showChat = !!elements?.chat;
1027
1017
  const isMobile = useMedia4(config.media.md);
1028
1018
  const hmsActions = useHMSActions();
1029
1019
  useEffect3(() => {
@@ -1039,7 +1029,6 @@ var ToggleChat = ({ isFullScreen = false }) => {
1039
1029
  return null;
1040
1030
  };
1041
1031
  var HLSView = () => {
1042
- var _a, _b, _c, _d, _e, _f, _g;
1043
1032
  const videoRef = useRef(null);
1044
1033
  const hlsViewRef = useRef();
1045
1034
  const { elements } = useRoomLayoutConferencingScreen();
@@ -1050,7 +1039,7 @@ var HLSView = () => {
1050
1039
  const { themeType } = useTheme();
1051
1040
  const [streamEnded, setStreamEnded] = useState4(false);
1052
1041
  let [hlsStatsState, setHlsStatsState] = useState4(null);
1053
- const hlsUrl = (_a = hlsState.variants[0]) == null ? void 0 : _a.url;
1042
+ const hlsUrl = hlsState.variants[0]?.url;
1054
1043
  const [availableLayers, setAvailableLayers] = useState4([]);
1055
1044
  const [isVideoLive, setIsVideoLive] = useState4(true);
1056
1045
  const [isCaptionEnabled, setIsCaptionEnabled] = useState4(true);
@@ -1074,7 +1063,7 @@ var HLSView = () => {
1074
1063
  const [seekProgress, setSeekProgress] = useState4(false);
1075
1064
  const isFullScreenSupported = screenfull.isEnabled;
1076
1065
  const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
1077
- const showChat = !!(elements == null ? void 0 : elements.chat);
1066
+ const showChat = !!elements?.chat;
1078
1067
  const isMobile = useMedia4(config.media.md);
1079
1068
  const isLandscape = useIsLandscape();
1080
1069
  const isFullScreen = useFullscreen(hlsViewRef, show, {
@@ -1085,11 +1074,11 @@ var HLSView = () => {
1085
1074
  const videoEl = videoRef.current;
1086
1075
  const showLoader2 = () => setShowLoader(true);
1087
1076
  const hideLoader = () => setShowLoader(false);
1088
- videoEl == null ? void 0 : videoEl.addEventListener("playing", hideLoader);
1089
- videoEl == null ? void 0 : videoEl.addEventListener("waiting", showLoader2);
1077
+ videoEl?.addEventListener("playing", hideLoader);
1078
+ videoEl?.addEventListener("waiting", showLoader2);
1090
1079
  return () => {
1091
- videoEl == null ? void 0 : videoEl.removeEventListener("playing", hideLoader);
1092
- videoEl == null ? void 0 : videoEl.removeEventListener("waiting", showLoader2);
1080
+ videoEl?.removeEventListener("playing", hideLoader);
1081
+ videoEl?.removeEventListener("waiting", showLoader2);
1093
1082
  };
1094
1083
  }, []);
1095
1084
  useEffect3(() => {
@@ -1100,7 +1089,7 @@ var HLSView = () => {
1100
1089
  useEffect3(() => {
1101
1090
  if (!notification)
1102
1091
  return;
1103
- const toastID = toastMap == null ? void 0 : toastMap[notification.data.id];
1092
+ const toastID = toastMap?.[notification.data.id];
1104
1093
  if (toastID) {
1105
1094
  ToastManager.removeToast(toastMap[notification.data.id]);
1106
1095
  delete toastMap[notification.data.id];
@@ -1110,19 +1099,18 @@ var HLSView = () => {
1110
1099
  const videoElem = videoRef.current;
1111
1100
  const setStreamEndedCallback = () => {
1112
1101
  setStreamEnded(true);
1113
- videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
1102
+ videoElem?.removeEventListener("ended", setStreamEndedCallback);
1114
1103
  };
1115
- videoElem == null ? void 0 : videoElem.addEventListener("ended", setStreamEndedCallback);
1104
+ videoElem?.addEventListener("ended", setStreamEndedCallback);
1116
1105
  return () => {
1117
- videoElem == null ? void 0 : videoElem.removeEventListener("ended", setStreamEndedCallback);
1106
+ videoElem?.removeEventListener("ended", setStreamEndedCallback);
1118
1107
  };
1119
1108
  }, [hlsUrl]);
1120
1109
  const handleQuality = useCallback3(
1121
1110
  (quality) => {
1122
- var _a2;
1123
1111
  if (hlsPlayer) {
1124
- setIsUserSelectedAuto(((_a2 = quality.height) == null ? void 0 : _a2.toString().toLowerCase()) === "auto");
1125
- hlsPlayer == null ? void 0 : hlsPlayer.setLayer(quality);
1112
+ setIsUserSelectedAuto(quality.height?.toString().toLowerCase() === "auto");
1113
+ hlsPlayer?.setLayer(quality);
1126
1114
  }
1127
1115
  },
1128
1116
  [availableLayers]
@@ -1132,14 +1120,12 @@ var HLSView = () => {
1132
1120
  let videoEl = videoRef.current;
1133
1121
  const manifestLoadedHandler = ({ layers }) => {
1134
1122
  setAvailableLayers(layers);
1135
- setHasCaptions(hlsPlayer == null ? void 0 : hlsPlayer.hasCaptions());
1123
+ setHasCaptions(hlsPlayer?.hasCaptions());
1136
1124
  };
1137
1125
  const layerUpdatedHandler = ({ layer }) => {
1138
1126
  setCurrentSelectedQuality(layer);
1139
1127
  };
1140
- const metadataLoadedHandler = (_a2) => {
1141
- var _b2 = _a2, { payload } = _b2, rest = __objRest(_b2, ["payload"]);
1142
- var _a3;
1128
+ const metadataLoadedHandler = ({ payload, ...rest }) => {
1143
1129
  const parsePayload = (str) => {
1144
1130
  try {
1145
1131
  return JSON.parse(str);
@@ -1184,7 +1170,7 @@ var HLSView = () => {
1184
1170
  }
1185
1171
  switch (parsedPayload.type) {
1186
1172
  case EMOJI_REACTION_TYPE:
1187
- (_a3 = window.showFlyingEmoji) == null ? void 0 : _a3.call(window, { emojiId: parsedPayload == null ? void 0 : parsedPayload.emojiId, senderId: parsedPayload == null ? void 0 : parsedPayload.senderId });
1173
+ window.showFlyingEmoji?.({ emojiId: parsedPayload?.emojiId, senderId: parsedPayload?.senderId });
1188
1174
  break;
1189
1175
  default: {
1190
1176
  const toast = {
@@ -1205,13 +1191,15 @@ var HLSView = () => {
1205
1191
  };
1206
1192
  const playbackEventHandler = (data) => {
1207
1193
  setIsPaused(data.state === HLSPlaybackState.paused);
1208
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1194
+ setHoverControlsVisible({
1195
+ ...hoverControlsVisible,
1209
1196
  pausePlay: true
1210
- }));
1197
+ });
1211
1198
  setTimeout(() => {
1212
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1199
+ setHoverControlsVisible({
1200
+ ...hoverControlsVisible,
1213
1201
  pausePlay: false
1214
- }));
1202
+ });
1215
1203
  }, 2e3);
1216
1204
  };
1217
1205
  const captionEnabledEventHandler = (isCaptionEnabled2) => {
@@ -1244,22 +1232,22 @@ var HLSView = () => {
1244
1232
  useEffect3(() => {
1245
1233
  const onHLSStats = (state) => setHlsStatsState(state);
1246
1234
  if (enablHlsStats) {
1247
- hlsPlayer == null ? void 0 : hlsPlayer.on(HMSHLSPlayerEvents2.STATS, onHLSStats);
1235
+ hlsPlayer?.on(HMSHLSPlayerEvents2.STATS, onHLSStats);
1248
1236
  } else {
1249
- hlsPlayer == null ? void 0 : hlsPlayer.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
1237
+ hlsPlayer?.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
1250
1238
  }
1251
1239
  return () => {
1252
- hlsPlayer == null ? void 0 : hlsPlayer.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
1240
+ hlsPlayer?.off(HMSHLSPlayerEvents2.STATS, onHLSStats);
1253
1241
  };
1254
1242
  }, [enablHlsStats]);
1255
- const unblockAutoPlay = () => __async(void 0, null, function* () {
1243
+ const unblockAutoPlay = async () => {
1256
1244
  try {
1257
- yield hlsPlayer.play();
1245
+ await hlsPlayer.play();
1258
1246
  setIsHlsAutoplayBlocked(false);
1259
1247
  } catch (error) {
1260
1248
  console.error("Tried to unblock Autoplay failed with", error.message);
1261
1249
  }
1262
- });
1250
+ };
1263
1251
  const sfnOverlayClose = () => {
1264
1252
  hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats);
1265
1253
  };
@@ -1285,62 +1273,64 @@ var HLSView = () => {
1285
1273
  }, [controlsVisible, isFullScreen, seekProgress, qualityDropDownOpen]);
1286
1274
  const onSeekTo = useCallback3(
1287
1275
  (seek) => {
1288
- var _a2;
1289
1276
  match({ isLandscape, isMobile, seek }).with({ seek: -10, isMobile: false, isLandscape: false }, () => {
1290
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), { seekBackward: true }));
1277
+ setHoverControlsVisible({ ...hoverControlsVisible, seekBackward: true });
1291
1278
  setTimeout(() => {
1292
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1279
+ setHoverControlsVisible({
1280
+ ...hoverControlsVisible,
1293
1281
  seekBackward: false
1294
- }));
1282
+ });
1295
1283
  }, 1e3);
1296
1284
  }).with({ seek: 10, isMobile: false, isLandscape: false }, () => {
1297
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), { seekForward: true }));
1285
+ setHoverControlsVisible({ ...hoverControlsVisible, seekForward: true });
1298
1286
  setTimeout(() => {
1299
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1287
+ setHoverControlsVisible({
1288
+ ...hoverControlsVisible,
1300
1289
  seekForward: false
1301
- }));
1290
+ });
1302
1291
  }, 1e3);
1303
1292
  }).otherwise(() => null);
1304
- hlsPlayer == null ? void 0 : hlsPlayer.seekTo(((_a2 = videoRef.current) == null ? void 0 : _a2.currentTime) + seek);
1293
+ hlsPlayer?.seekTo(videoRef.current?.currentTime + seek);
1305
1294
  },
1306
1295
  [hoverControlsVisible, isLandscape, isMobile]
1307
1296
  );
1308
1297
  const onDoubleClickHandler = useCallback3(
1309
1298
  (event) => {
1310
- var _a2;
1311
- if (!(isMobile || isLandscape) || ((_a2 = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a2.playlist_type) !== HLSPlaylistType.DVR) {
1299
+ if (!(isMobile || isLandscape) || hlsState?.variants[0]?.playlist_type !== HLSPlaylistType.DVR) {
1312
1300
  return;
1313
1301
  }
1314
1302
  const sidePercentage = event.screenX * 100 / event.target.clientWidth;
1315
1303
  if (sidePercentage < 45) {
1316
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1304
+ setHoverControlsVisible({
1305
+ ...hoverControlsVisible,
1317
1306
  seekBackward: true
1318
- }));
1307
+ });
1319
1308
  onSeekTo(-10);
1320
1309
  } else {
1321
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1310
+ setHoverControlsVisible({
1311
+ ...hoverControlsVisible,
1322
1312
  seekForward: true
1323
- }));
1313
+ });
1324
1314
  onSeekTo(10);
1325
1315
  }
1326
1316
  setTimeout(() => {
1327
- setHoverControlsVisible(__spreadProps(__spreadValues({}, hoverControlsVisible), {
1317
+ setHoverControlsVisible({
1318
+ ...hoverControlsVisible,
1328
1319
  seekForward: false,
1329
1320
  seekBackward: false
1330
- }));
1321
+ });
1331
1322
  }, 1e3);
1332
1323
  },
1333
- [hlsState == null ? void 0 : hlsState.variants, hoverControlsVisible, isLandscape, isMobile, onSeekTo]
1324
+ [hlsState?.variants, hoverControlsVisible, isLandscape, isMobile, onSeekTo]
1334
1325
  );
1335
- const onClickHandler = useCallback3(() => __async(void 0, null, function* () {
1336
- var _a2;
1337
- match({ isMobile, isLandscape, playlist_type: (_a2 = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a2.playlist_type }).with({ playlist_type: HLSPlaylistType.DVR, isMobile: false, isLandscape: false }, () => __async(void 0, null, function* () {
1326
+ const onClickHandler = useCallback3(async () => {
1327
+ match({ isMobile, isLandscape, playlist_type: hlsState?.variants[0]?.playlist_type }).with({ playlist_type: HLSPlaylistType.DVR, isMobile: false, isLandscape: false }, async () => {
1338
1328
  if (isPaused) {
1339
- yield hlsPlayer == null ? void 0 : hlsPlayer.play();
1329
+ await hlsPlayer?.play();
1340
1330
  } else {
1341
- hlsPlayer == null ? void 0 : hlsPlayer.pause();
1331
+ hlsPlayer?.pause();
1342
1332
  }
1343
- })).when(
1333
+ }).when(
1344
1334
  ({ isMobile: isMobile2, isLandscape: isLandscape2 }) => isMobile2 || isLandscape2,
1345
1335
  () => {
1346
1336
  setControlsVisible((value) => !value);
@@ -1349,7 +1339,7 @@ var HLSView = () => {
1349
1339
  }
1350
1340
  }
1351
1341
  ).otherwise(() => null);
1352
- }), [hlsState == null ? void 0 : hlsState.variants, isLandscape, isMobile, isPaused]);
1342
+ }, [hlsState?.variants, isLandscape, isMobile, isPaused]);
1353
1343
  const onHoverHandler = useCallback3(
1354
1344
  (event) => {
1355
1345
  event.preventDefault();
@@ -1407,7 +1397,7 @@ var HLSView = () => {
1407
1397
  }
1408
1398
  },
1409
1399
  hlsViewRef.current && (isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(Box, { css: { position: "fixed", left: "$4", top: "$4", zIndex: 11 } }, /* @__PURE__ */ React15.createElement(LeaveRoom, { screenType: "hls_live_streaming", container: hlsViewRef.current })),
1410
- /* @__PURE__ */ React15.createElement(HMSPlayerContext.Provider, { value: { hlsPlayer } }, (hlsStatsState == null ? void 0 : hlsStatsState.url) && enablHlsStats && !(isMobile || isLandscape) ? /* @__PURE__ */ React15.createElement(HlsStatsOverlay, { hlsStatsState, onClose: sfnOverlayClose }) : null, /* @__PURE__ */ React15.createElement(
1400
+ /* @__PURE__ */ React15.createElement(HMSPlayerContext.Provider, { value: { hlsPlayer } }, hlsStatsState?.url && enablHlsStats && !(isMobile || isLandscape) ? /* @__PURE__ */ React15.createElement(HlsStatsOverlay, { hlsStatsState, onClose: sfnOverlayClose }) : null, /* @__PURE__ */ React15.createElement(
1411
1401
  Flex,
1412
1402
  {
1413
1403
  id: "hls-player-container",
@@ -1421,12 +1411,11 @@ var HLSView = () => {
1421
1411
  },
1422
1412
  outline: "none"
1423
1413
  },
1424
- onKeyDown: (event) => __async(void 0, null, function* () {
1425
- var _a2;
1426
- if (((_a2 = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _a2.playlist_type) === HLSPlaylistType.DVR) {
1427
- yield keyHandler(event);
1414
+ onKeyDown: async (event) => {
1415
+ if (hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR) {
1416
+ await keyHandler(event);
1428
1417
  }
1429
- }),
1418
+ },
1430
1419
  tabIndex: "0"
1431
1420
  },
1432
1421
  !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(HLSAutoplayBlockedPrompt, { open: isHlsAutoplayBlocked, unblockAutoPlay }),
@@ -1467,7 +1456,7 @@ var HLSView = () => {
1467
1456
  size: "100%"
1468
1457
  }
1469
1458
  },
1470
- !showLoader && ((_b = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _b.playlist_type) === HLSPlaylistType.DVR && /* @__PURE__ */ React15.createElement(
1459
+ !showLoader && hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR && /* @__PURE__ */ React15.createElement(
1471
1460
  HMSVideoPlayer.PlayPauseSeekControls.Overlay,
1472
1461
  {
1473
1462
  isPaused,
@@ -1475,7 +1464,7 @@ var HLSView = () => {
1475
1464
  hoverControlsVisible
1476
1465
  }
1477
1466
  )
1478
- ), isMobile || isLandscape ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, !showLoader && ((_c = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _c.playlist_type) === HLSPlaylistType.DVR && /* @__PURE__ */ React15.createElement(
1467
+ ), isMobile || isLandscape ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, !showLoader && hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR && /* @__PURE__ */ React15.createElement(
1479
1468
  HMSVideoPlayer.PlayPauseSeekControls.Overlay,
1480
1469
  {
1481
1470
  isPaused,
@@ -1542,7 +1531,7 @@ var HLSView = () => {
1542
1531
  align: "start",
1543
1532
  css: {
1544
1533
  position: "absolute",
1545
- bottom: isFullScreen && ((_d = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _d.playlist_type) === HLSPlaylistType.DVR ? "$8" : "0",
1534
+ bottom: isFullScreen && hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR ? "$8" : "0",
1546
1535
  left: "0",
1547
1536
  zIndex: 1,
1548
1537
  background: isMobile || isLandscape ? "" : `linear-gradient(180deg, ${theme.colors.background_dim.value}00 29.46%, ${theme.colors.background_dim.value}A3 100%);`,
@@ -1552,7 +1541,7 @@ var HLSView = () => {
1552
1541
  transition: "visibility 0s 0.5s, opacity 0.5s linear"
1553
1542
  }
1554
1543
  },
1555
- ((_e = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _e.playlist_type) === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Progress, { seekProgress, setSeekProgress }) : null,
1544
+ hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Progress, { seekProgress, setSeekProgress }) : null,
1556
1545
  /* @__PURE__ */ React15.createElement(
1557
1546
  HMSVideoPlayer.Controls.Root,
1558
1547
  {
@@ -1561,15 +1550,15 @@ var HLSView = () => {
1561
1550
  },
1562
1551
  onClick: (e) => e.stopPropagation()
1563
1552
  },
1564
- /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Controls.Left, null, !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(React15.Fragment, null, ((_f = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _f.playlist_type) === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(HMSVideoPlayer.PlayPauseSeekControls.Button, { isPaused, onSeekTo }), !isVideoLive ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Duration, null) : null) : null, /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Volume, null)), /* @__PURE__ */ React15.createElement(
1553
+ /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Controls.Left, null, !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(React15.Fragment, null, hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(HMSVideoPlayer.PlayPauseSeekControls.Button, { isPaused, onSeekTo }), !isVideoLive ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Duration, null) : null) : null, /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Volume, null)), /* @__PURE__ */ React15.createElement(
1565
1554
  IconButton,
1566
1555
  {
1567
1556
  css: { px: "$2" },
1568
- onClick: (e) => __async(void 0, null, function* () {
1557
+ onClick: async (e) => {
1569
1558
  e.stopPropagation();
1570
- yield hlsPlayer == null ? void 0 : hlsPlayer.seekToLivePosition();
1559
+ await hlsPlayer?.seekToLivePosition();
1571
1560
  setIsVideoLive(true);
1572
- }),
1561
+ },
1573
1562
  key: "jump-to-live_btn",
1574
1563
  "data-testid": "jump-to-live_btn"
1575
1564
  },
@@ -1594,7 +1583,7 @@ var HLSView = () => {
1594
1583
  },
1595
1584
  isVideoLive ? "LIVE" : "GO LIVE"
1596
1585
  )))
1597
- ), (isMobile || isLandscape) && !isVideoLive && ((_g = hlsState == null ? void 0 : hlsState.variants[0]) == null ? void 0 : _g.playlist_type) === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Duration, null) : null),
1586
+ ), (isMobile || isLandscape) && !isVideoLive && hlsState?.variants[0]?.playlist_type === HLSPlaylistType.DVR ? /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Duration, null) : null),
1598
1587
  /* @__PURE__ */ React15.createElement(HMSVideoPlayer.Controls.Right, null, hasCaptions && !(isMobile || isLandscape) && /* @__PURE__ */ React15.createElement(HLSCaptionSelector, { isEnabled: isCaptionEnabled }), availableLayers.length > 0 && !(isMobile || isLandscape) ? /* @__PURE__ */ React15.createElement(
1599
1588
  HLSQualitySelector,
1600
1589
  {
@@ -1618,4 +1607,4 @@ var HLSView_default = HLSView;
1618
1607
  export {
1619
1608
  HLSView_default as default
1620
1609
  };
1621
- //# sourceMappingURL=HLSView-A6GH22QT.js.map
1610
+ //# sourceMappingURL=HLSView-5GXP76IN.js.map