From 40d2d94cbb5ce5385fc1024f591f4d1ff8e552cf Mon Sep 17 00:00:00 2001 From: amar-1995 Date: Tue, 27 Feb 2024 17:43:08 +0530 Subject: [PATCH] fix: added playlist button --- .../components/HMSVideo/PlayButton.tsx | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 packages/roomkit-react/src/Prebuilt/components/HMSVideo/PlayButton.tsx diff --git a/packages/roomkit-react/src/Prebuilt/components/HMSVideo/PlayButton.tsx b/packages/roomkit-react/src/Prebuilt/components/HMSVideo/PlayButton.tsx new file mode 100644 index 0000000000..b8b8770863 --- /dev/null +++ b/packages/roomkit-react/src/Prebuilt/components/HMSVideo/PlayButton.tsx @@ -0,0 +1,27 @@ +import React, { MouseEvent } from 'react'; +import { PauseIcon, PlayIcon } from '@100mslive/react-icons'; +import { IconButton, Tooltip } from '../../..'; +import { useHMSPlayerContext } from './PlayerContext'; + +export const PlayButton = ({ + isPaused, + width = 20, + height = 20, +}: { + isPaused: boolean; + width: number; + height: number; +}) => { + const { hlsPlayer } = useHMSPlayerContext(); + const onClick = async (event: MouseEvent) => { + event?.stopPropagation(); + isPaused ? await hlsPlayer?.play() : hlsPlayer?.pause(); + }; + return ( + + + {isPaused ? : } + + + ); +};