-
AuthorPosts
-
November 24, 2022 at 5:44 pm #1373804
Hi, i would like to disable autoplay in a Color Section background video. How can i do this?
November 25, 2022 at 8:43 am #1373830Hey Michael,
Thank you for the inquiry.
This is possible but you have to edit themes\enfold\config-templatebuilder\avia-shortcodes\section\section.php file directly and adjust the video parameters in the following code around line 1575.
'attr' => array( 'id' => '', 'video' => $video , 'slide_type' => 'video', 'video_mute' => true, 'video_loop' => true, 'video_ratio' => $video_ratio, 'video_controls' => 'disabled', 'video_section_bg' => true, 'video_format' => '', 'video_mobile' => '', 'video_mobile_disabled' => $video_mobile_disabled ) );
Set video_mute to true to disable autoplay, then enable the video_controls.
Best regards,
IsmaelNovember 25, 2022 at 10:31 am #1373843Thank you Ismael! I am using a child theme – is it better to place the code somewhere in the theme childs folder than? Were do i have to put the code if so.
November 26, 2022 at 6:51 pm #1373960Hi,
You can add this function to your child theme functions.php, unless it is already there:function avia_include_shortcode_template( $paths ) { if( ! is_array( $paths ) ) { $paths = array(); } $template_url = get_stylesheet_directory(); array_unshift( $paths, $template_url . '/shortcodes/' ); return $paths; } add_filter( 'avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1 );
then in your child theme directory create a new directory /shortcodes/ then copy the folder with your customized element into it, in your case /section/section.php
I would recommend testing the customization on the parent theme file like Ismael recommended first to ensure that it worked as you expected.Best regards,
MikeNovember 29, 2022 at 1:49 am #1374224Enabling video_controls didn’t do the trick; tried the following settings:
‘enable’
‘enabled’
trueBut background videos still autoplay. Do you have other suggestions?
Thanks.
November 30, 2022 at 1:28 am #1374387Anybody there? :-)
November 30, 2022 at 11:41 pm #1374538Still nothing??
December 1, 2022 at 3:48 am #1374544Hey!
Sorry for the delay. You have to set the ‘video_mute‘ parameter to false to prevent the video from auto playing. Make sure to check the page on a different browser or in incognito mode.
Cheers!
IsmaelDecember 1, 2022 at 9:13 am #1374573Still not working. Tried different browser, cleared caches. Background video still autoplays…
December 2, 2022 at 8:30 am #1374729Hi,
We may need to access the site in order to check the issue further. Please provide the WP/FTP details in the private field.
Best regards,
IsmaelDecember 2, 2022 at 11:14 am #1374750Hi Ismael,
Hereby. Thanx!
MichaelDecember 6, 2022 at 9:50 am #1375190Hi,
Sorry for the delay. We modified the video attributes in the section.php file and set the video_autoplay to disabled.
array( 'id' => '', 'video' => $video , 'slide_type' => 'video', 'video_mute' => false, 'video_autoplay' => 'disabled', 'video_loop' => true, 'video_ratio' => $video_ratio, 'video_controls' => 'enabled', 'video_section_bg' => false, 'video_format' => '', 'video_mobile' => '', 'video_mobile_disabled' => $video_mobile_disabled ) );
The video is now automatically paused on page load, but the controls are still hidden. You may need to create a custom button and add a script to play/pause the video.
// https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Video_and_audio_APIs
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.