diff --git a/src/components/VideoPlayerWithChapters.tsx b/src/components/VideoPlayerWithChapters.tsx index 1e93713..b2516c9 100644 --- a/src/components/VideoPlayerWithChapters.tsx +++ b/src/components/VideoPlayerWithChapters.tsx @@ -35,6 +35,7 @@ export const VideoPlayerWithChapters = forwardRef(null); const playerRef = useRef(null); const [currentChapterIndex, setCurrentChapterIndex] = useState(-1); + const [isPlaying, setIsPlaying] = useState(false); // Detect if this is a YouTube URL const isYouTube = videoUrl && ( @@ -92,6 +93,11 @@ export const VideoPlayerWithChapters = forwardRef setIsPlaying(true)); + player.on('pause', () => setIsPlaying(false)); + player.on('ended', () => setIsPlaying(false)); + // Apply custom accent color if (accentColor) { const style = document.createElement('style'); @@ -195,12 +201,12 @@ export const VideoPlayerWithChapters = forwardRef {youtubeId && ( <> - {/* CSS Overlay to block YouTube UI interactions - only covers iframe */} + {/* CSS Overlay to block YouTube UI interactions - shows when paused */}