From c4671ffdfebb0bd040ecfe41df4b6bad8fafc251 Mon Sep 17 00:00:00 2001 From: Rao <1227431568@qq.com> Date: Wed, 5 Mar 2025 17:30:25 +0800 Subject: [PATCH] rht --- .../presentation/video-player/VideoDisplay.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/presentation/video-player/VideoDisplay.tsx b/apps/web/src/components/presentation/video-player/VideoDisplay.tsx index 976495b..7260304 100755 --- a/apps/web/src/components/presentation/video-player/VideoDisplay.tsx +++ b/apps/web/src/components/presentation/video-player/VideoDisplay.tsx @@ -25,6 +25,7 @@ export const VideoDisplay: React.FC = ({ isDragging, setIsDragging, progressRef, + isPlaying } = useContext(VideoPlayerContext); // 处理进度条拖拽 @@ -192,15 +193,19 @@ export const VideoDisplay: React.FC = ({ }, [src, onError, autoPlay]); const handleVideoClick = () => { - if (videoRef.current) { + if (videoRef.current && isPlaying) { videoRef.current.pause(); setIsPlaying(false); + }else if (videoRef.current && !isPlaying) { + videoRef.current.play(); + setIsPlaying(true); } }; return ( -
+