Skip to content

Commit

Permalink
fix: pause play on click event
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 committed Mar 12, 2024
1 parent 99513a1 commit 2d74a0a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/roomkit-react/src/Prebuilt/layouts/HLSView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,23 @@ const HLSView = () => {
},
[hlsState?.variants, isLandscape, isMobile, onSeekTo],
);
const onClickHandler = useCallback(() => {
const onClickHandler = useCallback(async () => {
if (!(isMobile || isLandscape) && hlsState?.variants[0]?.playlist_type !== HLSPlaylistType.DVR) {
return;
}
if (!(isMobile || isLandscape)) {
if (isPaused) {
await hlsPlayer?.play();
} else {
hlsPlayer.pause();
}
return;
}
setControlsVisible(value => !value);
if (controlsTimerRef.current) {
clearTimeout(controlsTimerRef.current);
}
}, [isLandscape, isMobile]);
}, [hlsState?.variants, isLandscape, isMobile, isPaused]);
const onHoverHandler = useCallback(
event => {
event.preventDefault();
Expand Down

0 comments on commit 2d74a0a

Please sign in to comment.