Procházet zdrojové kódy

delay autoplay

master
azri před 1 týdnem
rodič
revize
7498f73be3
1 změnil soubory, kde provedl 6 přidání a 3 odebrání
  1. 6
    3
      src/components/VideoAds/VideoAds.jsx

+ 6
- 3
src/components/VideoAds/VideoAds.jsx Zobrazit soubor

@@ -9,10 +9,13 @@ const VideoAds = ({ video_url, height, width }) => {
9 9
 
10 10
   useEffect(() => {
11 11
     if (videoRef.current) {
12
+
12 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
 

Načítá se…
Zrušit
Uložit