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.
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
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.
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
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.
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.
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.
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.
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
$get_videos=$db->rawQuery("SELECT * FROM ".T_VIDEOS." WHERE MATCH (title) AGAINST ('$keyword') ORDER BY id ASC LIMIT 20");
$get_videos=$db->rawQuery("SELECT * FROM ".T_VIDEOS." WHERE title LIKE '%$keyword%' ORDER BY id ASC LIMIT 20");
$get_videos=$db->rawQuery("SELECT * FROM ".T_VIDEOS." WHERE MATCH (title) AGAINST ('$keyword') ORDER BY id DESC LIMIT 20");
$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.
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
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
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 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.