This topic has 8 replies, 3 voices, and was last updated 7 years, 2 months ago ago by Rose Tyler
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.
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.
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.
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.
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
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.
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.
You’re welcome!
Regards
Tagged: autoplay, productpage, video pop-up, woocommerce, wordpress
You must be logged in to reply to this topic.Log in/Sign up