So your site embeds videos from Youtube, Vimeo, and other video sharing services? Do you have a problem with dead videos and no way to track them unless the video is reported? I have built a simple solution to automate this process. Currently it works for YouTube tracking, but I have plans to develop it further into using the other video hosting services that PlayTube integrates into. When a video is detected as dead, you can have it display a message if you run the script directly in your web browser, or you can set a cron job to email you or save the video link to a text file, and even DELETE the dead video, without ever raising a finger. Want to learn more? Enter your email address below to get a link to the free download with detailed instructions. By including your email, I can provide you with updates to the software along with any other development progress on other PlayTube expansions that I have created. You can unsubscribe at any time.
Protected: PlayTube Video Cleaner Download
Playtube Youtube Video Player
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.
You May Also Like
PlayTube Category Columns

I have a bunch of categories, so I had to be a little creative in the way I wanted to show them. With some simple CSS you can do the same.
Add in /themes/default/css/custom.style.css
1 2 3 4 5 6 |
/* Desktop Nav Columns */ nav.navbar-findcond ul.dropdown-menu.categories-drop-down { columns: 3 !important; -webkit-columns: 3 !important; -moz-columns: 3 !important; } |
You’ll need to clear your cache for this to fully take effect. Some users won’t see this until they delete their cache, so to resolve this problem I like to provide a version number for the CSS file. To do this is simple.
Find in /themes/default/layout/container.html
1 |
<link rel="stylesheet" href="{{CONFIG theme_url}}/css/custom.style.css"> |
Replace with
Find in /themes/default/layout/container.html
1 |
<link rel="stylesheet" href="{{CONFIG theme_url}}/css/custom.style.css?v=1.0.0"> |
As you can see from the above code we just added ?v=1.0.0 to the end. Anytime you add or modify code in this custom stylesheet just simply add onto it. So for example if you make a change after this, then it would become ?v=1.0.1
You May Also Like
PlayTube Embed Watermark Link to Video
PlayTube’s core doesn’t have an option to go to the video by clicking a button like some other services provide, however with a very simple and easy core modification you can link your watermark to your video’s url instead of it going to your website’s homepage. This modification only works with direct uploaded video’s as PlayTube disables watermarking importing videos to prevent copyright infringement. I’m not looking to cause any copyright infringement either so I won’t be sharing how to do it on imported videos as you are linking to your own service at this point and not your video provider.
For those PlayTube users who upload their own videos, this will really help establish your brand. Viewers can easily click your logo and be taken to your video from which they can comment, share, or embed your video.
In /themes/default/layout/embed/content.html find
1 |
<a href="{{CONFIG site_url}}" target="_blank"><img src="{{CONFIG watermark}}" alt='watermark logo'></a> |
Replace With
1 |
<a href="{{URL}}" target="_blank"><img src="{{CONFIG watermark}}" alt='watermark logo'></a> |
You May Also Like
Mobile Autoplay Mediaelementjs
For those running the PlayTube script you may have noticed that autoplay on mobile does not work. It’s currently an issue with the Mediaelementjs framework that PlayTube script uses. I’ve come up with a simple solution to resolve the autoplay issue with Mediaelementjs that works with all major mobile browsers. The only issue is with Facebook Webview which appears to be a limitation of the webview. I am still trying different methods as a work around, but I am open to ideas. If you have any, feel free to comment below.
Mobile autoplay fix is for the Playtube script, but can be easily adapted to any use of Mediaelementjs.
In /themes/default/layout/container.html find
1 2 3 4 5 |
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script> <script src="{{CONFIG theme_url}}/js/footer.js?ver=1.1.2"></script> <link rel="" =""> <script> $(document).ready(function(){ |
Below Add
1 |
$('#my-video')[0].play(); |
What does this do?
Basically it simulates a click on the play button element. While there are some browsers that do not support this type of behavior, I found it works for major browsers on mobile and doesn’t affect any desktop browser I have tested. Facebook Webview is the only one affected, which is either a limitation of their built in browser or was intentionally blocked to avoid any auto clicking of like buttons or other elements that Facebook deems unnecessary.
You May Also Like
PlayTube Autoplay Checked by Default
Another simple modification to your PlayTube core would be setting the autoplay checkbox defaulted to checked. This way anyone that visits your website will automatically be shown the next recommended video. If they choose to opt out by unchecking the Autoplay box, then they will still get the cookie stored so autoplay is no longer enabled for that visitor. This works for both logged in and unregistered members.
Find in /sources/watch/content.php
1 2 3 4 5 6 7 8 9 |
if (!empty($_SESSION['autoplay'])) { if ($_SESSION['autoplay'] == 2) { $checked = 'checked'; } } |
Add this above the previous code
1 2 3 4 5 |
if (empty($_SESSION['autoplay'])) { $checked = 'checked'; } |
Have a request? Feel free to reach out to me.
You May Also Like
PlayTube Sort Search Results by Newest
By default the results in PlayTube are sorted by oldest. In order to sort the results by newest, we need to make a small core modification. This isn’t tested with the latest version of PlayTube as I am still on the 1.4.3 version, but the modification is simple, just change ASC to DESC.
Find in /sources/search/content.php
1 2 3 4 5 6 7 8 9 |
if ($pt->config->total_videos > 1000000) { $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE MATCH (title) AGAINST ('$keyword') ORDER BY id ASC LIMIT 20"); } else { $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE title LIKE '%$keyword%' ORDER BY id ASC LIMIT 20"); } |
Replace with
1 2 3 4 5 6 7 8 9 |
if ($pt->config->total_videos > 1000000) { $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE MATCH (title) AGAINST ('$keyword') ORDER BY id DESC LIMIT 20"); } else { $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE title LIKE '%$keyword%' ORDER BY id DESC LIMIT 20"); } |
Thats it, now your search results are setup to show the latest videos under that search query. Don’t forget to setup Site Search on Google Analytics.
You May Also Like
PlayTube Optimize Speed
Get your pages to load up to 80% faster! Some of you may not know, but Google Page Rank counts page speed as a factor. You’d be surprised how many do not know this. If you are one of the few then awesome, you may already know this. Are you familiar with GZip? If not I am going to walk you through on how to set it up so that you can help decrease page load times and help with your SEO. Keep in mind I run on apache so this will be how to do this for apache servers.
Make sure you have mod_deflate enabled on your server
You may also need to add this line to your php.ini
1 |
zlib.output_compression = On |
If you are on a shared host, reach out to your hosting provider to see if they can enable this for you.
Next add the following to the top of your .htaccess
1 |
SetOutputFilter DEFLATE |
Thats it, now you can check to see if you have GZIP enabled via Check GZip Compression.
Note: PlayTube developers state they have seen some issues with this, this works fine on my platform, but depending on different variables and how you run your PlayTube script, this may not work for you.
You May Also Like
PlayTube Sharing Wrong Thumbnails
You may have noticed thumbnail sharing videos to social media via the PlayTube script sometimes shares the first Up Next video thumbnail. This is due to the image being too small for Facebook OG data. The reason is, that the script fetches maxresdefault.jpg, which sometimes Youtube does not provide and instead leaves a generic small invalid thumbnail. There’s a simple fix to get it working though.
Find in index.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
if ($pt->page == 'watch') { $og_meta = PT_LoadPage('watch/og-meta', array( 'TITLE' => $pt->title, 'DESC' => mb_substr($pt->description, 0, 400, "UTF-8"), 'THUMB' => str_replace('mqdefault', 'maxresdefault', $get_video->thumbnail), 'URL' => PT_Link('watch/' . PT_Slug($get_video->title, $get_video->video_id)) )); } |
Replace
1 |
'THUMB' => str_replace('mqdefault', 'maxresdefault', $get_video->thumbnail), |
With
1 |
'THUMB' => str_replace('mqdefault', '0', $get_video->thumbnail), |