Browse Source

delay autoplay

master
azri 1 week ago
parent
commit
7498f73be3
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      src/components/VideoAds/VideoAds.jsx

+ 6
- 3
src/components/VideoAds/VideoAds.jsx View File

9
 
9
 
10
   useEffect(() => {
10
   useEffect(() => {
11
     if (videoRef.current) {
11
     if (videoRef.current) {
12
+
12
       videoRef.current.muted = true; // Ensure video starts muted for autoplay
13
       videoRef.current.muted = true; // Ensure video starts muted for autoplay
13
-      videoRef.current.play().catch((err) => {
14
-        console.warn('Autoplay failed:', err);
15
-      });
14
+      setTimeout(() => {
15
+        videoRef.current.play().catch((err) => {
16
+          console.warn('Autoplay failed:', err);
17
+        });
18
+      }, 1000);
16
     }
19
     }
17
   }, []);
20
   }, []);
18
 
21
 

Loading…
Cancel
Save