To avoid loading unnecessary scripts if users aren’t actually using the video player, the player is only loaded in the header/footer on page load. Since infinite scroll doesn’t load a new page, the scripts aren’t loaded. You’ll have to always load the video player scripts. I think this will work if you add it to your functions:
function always_load_kgvid_shortcode_scripts() {
kgvid_enqueue_shortcode_scripts();
}
add_action('wp_enqueue_scripts', 'always_load_kgvid_shortcode_scripts', 12);
This has not been tested, so use at your own risk.
I had never considered converting animated GIFs using FFMPEG. I’ll look into it.
Thread Starter
vuewer
(@vuewer)
Hi Kyle,
Thanks for your quick reply! I’ve put the above code to my functions.php but with no results.
The plugin that i am using (http://codecanyon.net/item/animated-infinite-scroll-wordpress-plugin/9631163) supports jQuery callbacks>> http://prntscr.com/83eg7c (see below on screenshot)
Any suggestion for this? The two inputted callbacks above do work perfectly. Im be willing to pay you for this.
Thanks in advance!
Sander
kgvid_enqueue_shortcode_scripts() is a PHP function, not a jQuery or JavaScript function, so adding that to your infinite scroll plugin just generates an error on the page.
The scripts are loading but not initializing the dynamically loaded videos. Try defining this JavaScript function on every page either inline or in a .js file.
function kgvid_load_dynamic_video() {
jQuery('.video-js').each( function(){
videojs(this, {}, function() { } );
kgvid_resize_video(jQuery(this).parents('.kgvid_videodiv').data('id'));
});
}
Then add kgvid_load_dynamic_video(); to your infinite scroll plugin’s callback list.
Thread Starter
vuewer
(@vuewer)
Hi Kyle,
At first i thought it didn’t work, but after some research i added “use strict” statement to your provided code and: Bam! It worked.
I am very happy with with the plugin and the good support!
A buddy of mine who’s good with js/php is going to look into FFMPEG, GIF to MP4, WEBM(vp9) conversion based on this plugin. If you want i can send you the code when tested and finished.
Cheers!
Great. Glad I could help out. And feel free to donate any amount you feel like to support future development.
If you get GIF conversions working I’d be happy to see the code. I’ve been thinking about it a little and in principle it’s pretty simple. My main question is why would you do that though?
Thread Starter
vuewer
(@vuewer)
Hi Kyle,
While im waiting for the paid version, i donated 10USD, just for the gesture :).
The main reason of gif to video conversion is the size. A simple and short gif can easily be 24MB in size, if you convert it to webm/mp4 its like 2MB for the same file (10%). If you look at sites like imgur.com or 9gag.com, they do that also already.
As example http://i.imgur.com/MauOtlK.gifv
if you click the download link (right under) you’ll download the original uploaded gif file (40MB)
Now if you inspect the element in your browser you see that you are actually looking at a webm file and fallback to mp4 for non supported devices/browsers. If you download that webm its just 3.4MB.
Thanks again!
You’ll be waiting a while for the paid version, so thanks a lot for the donation in the meantime.
I hadn’t considered the size issue. GIFs are a terrible way to compress video so that makes a lot of sense.