-
AuthorPosts
-
August 11, 2022 at 3:15 pm #1361473
Hello,
we have a color section with background Video on our Startpage.
Its running on all devices except on iphones and Ipads I didnt check Mac Computers.
I know there are Websites with Background Videos that work on ios devices. So it must be deactivated in Enfold. Somebody mentioned, it works if we do that with Layerslider. I tried that, but its the same problem. How can we get that thing running?Thanks in advance
René
August 12, 2022 at 1:14 am #1361506hey,
can you share a link to your website so we can check it.
August 14, 2022 at 5:58 pm #1361656Hi,
Thank you for your patience, unfortunately mobile background videos will not typically play on mobile devices, Safari & Chrome have set the standard a few years back that mobile video must be clicked by the user to play, this was to try to curb “video spamming” by websites. As with any standard there are “hacks” around this but with each update Safari & Chrome block more methods. We follow the rules, you can probably find a WordPress plugin that will if you really want to do this. The last time I checked the layerslider was still playing background videos on mobile, but there is no telling how long this will be for. I would recommend not trying to bypass this because you will constantly need to watch your site for this breaking.Best regards,
MikeAugust 16, 2022 at 3:32 pm #1361803yes Mike is right – and for a layerslider – you can see here a page of mine: https://webers-webdesign.de/
This video will play – and autostart the background-video. I don’t know if this is due to layerslider or by using on that layer a html5 video code.<video playsinline autoplay loop muted preload="metadata" style="min-width:1600; min-height:900;" > <source src="/wp-content/uploads/YOUR-VIDEO.mp4" type="video/mp4"> <img src="/wp-content/uploads/video-fallback.jpg" width="1600" height="900" alt="video-fallback-image" title="Your browser does not support the video tag"> </video>
BUT: keep in mind that videos on a page will cause a huge loss of performance. This page is ranked on gtmetrix on B 89% 88% – but with that background-video it will be : D 53% 82%We Webdesigners in Europe and to be more precise : in Germany suffer a little bit under that GDPR ( DSGVO ) Rules. Because a third party hosted Video will have better performance values – and even CDN do not fullfill all Need for the GDPR Compliance. So – without optin this will be illegal.
August 16, 2022 at 4:02 pm #1361811Hi René,
Autoplay videos don’t work by default for the reasons stated by Mike and @guenni007. If you want to allow it anyway, then you could try this script to see if you have any luck with it:
// custom script: autoplay youtube videos on mobile devices function ava_custom_script_autoplay_youtube_videos() { ?> <script type="text/javascript"> var tag = document.createElement('script'); tag.id = 'avia-yt-iframe-api'; tag.src = 'https://www.youtube.com/iframe_api'; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); var avia_players = document.querySelectorAll('.avia-video iframe[src*="youtube.com"]'); var players = []; function onYouTubeIframeAPIReady() { avia_players.forEach(function(video, index) { players.push(new YT.Player(video.id, { events: { 'onReady': onPlayerReady, } })); }); } function onPlayerReady(event) { event.target.mute(); event.target.playVideo(); } </script> <?php } add_action( 'wp_footer', 'ava_custom_script_autoplay_youtube_videos', 9999 );
Best regards,
RikardAugust 17, 2022 at 11:46 am #1361914Thanks Rikard – but as i said – on youtube and or vimeo etc. the loading had to be GDPR compliant. You had to opt in first – then starting the video.
this is hard to get with background-videos – even if they do not start automatically.August 17, 2022 at 12:12 pm #1361924 -
AuthorPosts
- You must be logged in to reply to this topic.