Ensure videos start muted by default on the platform

Modify the VideoCard component to force muted state on onLoadStart, onPlay, and onCanPlay events for Video.js player.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 946a0075-7e32-454b-b348-9e7f576d7f45
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/60d372ff-2c10-46c7-b01b-10c3435136b0/946a0075-7e32-454b-b348-9e7f576d7f45/JlONw6J
This commit is contained in:
sebastjanartic 2025-09-04 13:07:43 +00:00
parent ff7203c5e6
commit 60c3ca23b3

View File

@ -240,9 +240,28 @@ export default function VideoCard({ video, onClick, className = "", hideOverlay
playsInline
controls={false}
disablePictureInPicture
onLoadStart={() => {}}
onLoadStart={() => {
// Force muted state on load start
if (videoRef.current) {
videoRef.current.muted = isMuted;
videoRef.current.volume = 0;
}
}}
onError={() => {}}
onCanPlay={() => {}}
onPlay={() => {
// Force muted state on play
if (videoRef.current) {
videoRef.current.muted = isMuted;
videoRef.current.volume = 0;
}
}}
onCanPlay={() => {
// Force muted state when video can play
if (videoRef.current) {
videoRef.current.muted = isMuted;
videoRef.current.volume = 0;
}
}}
onTimeUpdate={(e) => setCurrentTime(e.currentTarget.currentTime)}
onLoadedMetadata={(e) => setDuration(e.currentTarget.duration)}
onMouseMove={(e) => {