Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1373804

    Hi, i would like to disable autoplay in a Color Section background video. How can i do this?

    #1373830

    Hey 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,
    Ismael

    #1373843

    Thank 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.

    #1373960

    Hi,
    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,
    Mike

    #1374224

    Enabling video_controls didn’t do the trick; tried the following settings:

    ‘enable’
    ‘enabled’
    true

    But background videos still autoplay. Do you have other suggestions?

    Thanks.

    #1374387

    Anybody there? :-)

    #1374538

    Still nothing??

    #1374544

    Hey!

    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!
    Ismael

    #1374573

    Still not working. Tried different browser, cleared caches. Background video still autoplays…

    #1374729

    Hi,

    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,
    Ismael

    #1374750

    Hi Ismael,
    Hereby. Thanx!
    Michael

    #1375190

    Hi,

    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

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.