Autoplay in video pop-up on productpage - by Ton

This topic has 8 replies, 3 voices, and was last updated 7 years, 3 months ago ago by Rose Tyler

  • Avatar: Ton
    Ton
    Participant
    August 29, 2017 at 21:24

    Hi,

    Do you know if it is possible to set the video in the video pop-up on the productpage as ‘Autoplay’?
    I have tried several possibilities I found, but neither one worked.

    Thanks, Ton.

    7 Answers
    Avatar: laranz
    Laranz
    Participant
    August 30, 2017 at 04:35

    Hi,

    You can use YouTube embed code with autoplay,

    example:

    <iframe width="560" height="315" src="https://www.youtube.com/embed/dmVAmlpbnD4?rel=0&controls=0&showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe>

    Let us know,

    Thanks,
    laranz.

    Avatar: Ton
    Ton
    Participant
    August 30, 2017 at 06:51

    Hi,

    Thanks for the very quick response.

    Unfortunately ‘Autoplay’ already starts if the page opens.
    Even before the play button is clicked. So you hear sound but the video is still hidden behind the play-button.
    Any suggestions?

    Cheers, Ton.

    Avatar: laranz
    Laranz
    Participant
    August 31, 2017 at 10:45

    Hi Ton,

    Yes it behaves like that, sorry about that. I will forward this feature request to the development team. For now it won’t support autoplay option.

    Let us know if you have any other questions,

    Thanks,
    laranz.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 31, 2017 at 10:56

    Hello,

    You may try this solution:
    Add this code in function.php file of your child theme https://prnt.sc/gfb65z:

    wp_enqueue_script('child-theme', get_stylesheet_directory_uri().'/etheme-child.js',array(),false,true); 
    

    then create etheme-child.js file in your child theme and add this code:

    jQuery(document).ready(function() {
    	if (jQuery("div#product-video-popup")){
    		var src = jQuery("#product-video-popup iframe").attr('src'); 
    	    jQuery('.open-video-popup').on('click', function(e) {
            jQuery("#product-video-popup iframe").attr('src', src+"&autoplay=1");
            	e.preventDefault();
        	});
    
    		jQuery('.mfp-content').live('click', function(e) {
    		if (e.target !== this) { 
          		return;
    		}
    		jQuery("#product-video-popup iframe").attr('src', src);
    	});
    	}
    });

    Please note that such question requests additional customization which is beyond our basic support scope. You can contact WPKraken team to get help with additional development.

    Regards

    Avatar: Ton
    Ton
    Participant
    August 31, 2017 at 10:56

    Thanks Laranz,

    Hopefully will the development team finds a solution.
    For the time being it is a little pity but OK. I will tell the client is not yet possible.

    Cheers, Ton.

    Avatar: Ton
    Ton
    Participant
    August 31, 2017 at 11:15

    Thanks, Rose.

    I will give it a try.
    I understand that it is additional. Therefore is my gratitude even bigger 🙂
    Thanks also for the recommendation of the WPKraken team. That might come in handy.

    Nice day,

    Ton.

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    August 31, 2017 at 12:01

    You’re welcome!

    Regards

  • Viewing 8 results - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.