Quellcode durchsuchen

delay autoplay

master
azri vor 1 Woche
Ursprung
Commit
7498f73be3
1 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen
  1. 6
    3
      src/components/VideoAds/VideoAds.jsx

+ 6
- 3
src/components/VideoAds/VideoAds.jsx Datei anzeigen

@@ -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
 

Laden…
Abbrechen
Speichern