I’ve had a couple of people ask how I have the Youtube player instead of the Playtube Player on Vigeos. Deen from PlayTube actually saved me a lot of time with research and implementation and had a quick solution for me, so I figured I would share it with y’all in case you wanted to do the same. Keep in mind my solution for Mobile Autoplay is for Mediaelementjs that PlayTube Script uses, so by you converting to the YouTube video player, my autoplay solution will no longer work.
Find in /themes/default/layout/watch/content.phtml
1 2 |
<?php } else if (!empty($pt->get_video->daily)) { ?> <div class="pt_vdo_plyr"><div class="embed-responsive embed-responsive-16by9"><iframe width="100%" src="//www.dailymotion.com/embed/video/{{VIDEO_ID}}?PARAMS" allowfullscreen></iframe></div></div> |
Below Add
1 2 |
<?php } else if (!empty($pt->get_video->youtube)) { //YouTube Player ?> <div class="pt_vdo_plyr"><div class="embed-responsive embed-responsive-16by9"><iframe src="https://www.youtube.com/embed/{{VIDEO_ID}}?autoplay=1&rel=0&showinfo=0" allow="autoplay; encrypted-media" width="100%" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div></div> |
You also need to make the changes in /themes/default/layout/watch/playlist.phtml
1 2 |
<?php } else if (!empty($pt->get_video->daily)) { ?> <iframe frameborder="0" width="100%" height="500" src="//www.dailymotion.com/embed/video/{{VIDEO_ID}}?PARAMS" allowfullscreen></iframe> |
Below Add
1 2 |
<?php } else if (!empty($pt->get_video->youtube)) { //YouTube Player ?> <iframe src="https://www.youtube.com/embed/{{VIDEO_ID}}?autoplay=1&rel=0&showinfo=0" allow="autoplay; encrypted-media" width="100%" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> |
This can also be applied to the other import services, just change the embed code to whichever you wanted to use along with changing the conditional statement to be that of the import service.
I have the Youtube player instead of the Playtube Player on my website,
I have solved this problem without having to do as you do, not affected by Auto play in Mediaelementjs.
Oh so autoplay still works for you? That’s good. I think the latest Chrome update will autoplay videos you frequent automatically, so that makes sense.
Hi Disquy,
Youtube player show check here https://prnt.sc/lengc1 but don’t show advertisement please make a solution for that if import videos from youtube. that will show ads this may help to keep adsense live on a website.
Thanks.
Sorry, PlayTube staff disabled this for legal reasons. For the same reason, I am unable to share how to show ads on YouTube videos.
Hello, is there any way to make videos play automatically when page loads?
Yes if you use the YouTube player, you can set the autoplay flag.