Improve video player controls by keeping them visible longer

Extend video player control visibility by sending mouse events to the iframe when the mouse enters or moves over the player.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 2eb1084e-b728-4449-9231-f1665924c8d5
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/2eb1084e-b728-4449-9231-f1665924c8d5/Skm35EV
This commit is contained in:
sebastjanartic 2025-08-28 21:20:16 +00:00
parent e612f2029d
commit 9bd61f667d

View File

@ -258,7 +258,40 @@ export default function BunnyVideoModal({ video, isOpen, onClose, onEdit, videos
<div className="flex-1 flex flex-col lg:flex-row gap-4 min-h-0">
{/* Main video player */}
<div className="flex-1">
<div className="relative w-full aspect-video bg-black rounded-lg overflow-hidden">
<div
className="relative w-full aspect-video bg-black rounded-lg overflow-hidden"
onMouseMove={() => {
const iframe = document.querySelector('iframe');
if (iframe && iframe.contentWindow) {
// Trigger mouse events to keep controls visible longer
try {
iframe.contentWindow.postMessage(JSON.stringify({ method: "mousemove" }), '*');
} catch (e) {
// Ignore errors
}
}
}}
onMouseEnter={() => {
const iframe = document.querySelector('iframe');
if (iframe && iframe.contentWindow) {
try {
iframe.contentWindow.postMessage(JSON.stringify({ method: "mouseenter" }), '*');
} catch (e) {
// Ignore errors
}
}
}}
onClick={() => {
const iframe = document.querySelector('iframe');
if (iframe && iframe.contentWindow) {
try {
iframe.contentWindow.postMessage(JSON.stringify({ method: "click" }), '*');
} catch (e) {
// Ignore errors
}
}
}}
>
{video.videoUrlIframe ? (
<iframe
src={video.videoUrlIframe}