From 74f3893f8c2ce1821381fcdad5ae311949d86d29 Mon Sep 17 00:00:00 2001 From: ditiqi Date: Sun, 23 Feb 2025 21:42:56 +0800 Subject: [PATCH] add --- .../video-player/ControlButtons/Play.tsx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/apps/web/src/components/presentation/video-player/ControlButtons/Play.tsx b/apps/web/src/components/presentation/video-player/ControlButtons/Play.tsx index fdff076..721242d 100755 --- a/apps/web/src/components/presentation/video-player/ControlButtons/Play.tsx +++ b/apps/web/src/components/presentation/video-player/ControlButtons/Play.tsx @@ -4,22 +4,25 @@ import { PauseIcon, PlayIcon } from "@heroicons/react/24/solid"; export default function Play() { const { isPlaying, videoRef } = useContext(VideoPlayerContext); - + const handleClick = (event) => { + event.stopPropagation(); // 阻止事件冒泡 + if (videoRef.current?.paused) { + videoRef.current.play(); + } else { + videoRef.current?.pause(); + } + }; return ( <> - + ); }