Video Embed & Thumbnail Generator - Version 4.6.12

Version Description

  • September 25, 2016 =
  • Restored Video.js resolution selection in pop-up video galleries.
  • Fixed thumbnail creation bugs in Chrome browser.
  • Fixed missing 'starts' error message when video had never been played.
Download this release

Release Info

Developer kylegilman
Plugin Icon 128x128 Video Embed & Thumbnail Generator
Version 4.6.12
Comparing to
See all releases

Code changes from version 4.6.11 to 4.6.12

css/kgvid_styles.css CHANGED
@@ -51,6 +51,10 @@
51
  max-width: 100%;
52
  }
53
 
 
 
 
 
54
  .kgvid_watermark img {
55
  display: block;
56
  position: absolute;
51
  max-width: 100%;
52
  }
53
 
54
+ .simplemodal-wrap .jetpack-video-wrapper {
55
+ margin-bottom: 0;
56
+ }
57
+
58
  .kgvid_watermark img {
59
  display: block;
60
  position: absolute;
js/kgvid_video_embed.js CHANGED
@@ -4,27 +4,7 @@ jQuery('.kgvid_videodiv').each(function(){ //setup individual videos. WordPress
4
 
5
  if ( video_vars.player_type == "Video.js" ) {
6
 
7
- var videojs_options = { "html5": { "nativeTextTracks" : false }, "language": video_vars.locale };
8
- if ( video_vars.resize == "true" || video_vars.fullwidth == "true" ) {
9
- videojs_options.fluid = true;
10
- }
11
- else {
12
- videojs_options.fluid = false;
13
- }
14
- if ( video_vars.width != undefined && video_vars.width.indexOf('%') === -1 && video_vars.height != undefined ) {
15
- videojs_options.aspectRatio = video_vars.width + ':' + video_vars.height;
16
- }
17
- if ( video_vars.nativecontrolsfortouch == "true" ) {
18
- videojs_options.nativeControlsForTouch = true;
19
- }
20
- if ( video_vars.enable_resolutions_plugin == "true" ) {
21
- videojs_options.plugins = { "resolutionSelector" : { "force_types" : ["video/mp4"] } };
22
- if ( video_vars.default_res ) {
23
- videojs_options.plugins.resolutionSelector.default_res = video_vars.default_res;
24
- }
25
- }
26
-
27
- videojs('video_'+video_vars.id, videojs_options ).ready(function(){ kgvid_setup_video(video_vars.id); });
28
 
29
  }
30
  });
@@ -224,7 +204,10 @@ function kgvid_SetVideo(id) { //for galleries
224
  swfobject.embedSWF(video_vars.swfurl, 'video_'+id, video_vars.width, video_vars.height, '10.1.0', video_vars.expressinstallswfurl, video_vars.flashvars, video_vars.params);
225
  }
226
 
227
- setTimeout(function() { kgvid_setup_video(id); }, 0);
 
 
 
228
 
229
  dialog.wrap.css('overflow', 'hidden'); //disable scroll bars
230
  if ( meta > 0 ) {
@@ -318,6 +301,32 @@ function kgvid_add_hover(id) {
318
 
319
  }
320
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  function kgvid_setup_video(id) {
322
 
323
  var video_vars = jQuery('#video_'+id+'_div').data('kgvid_video_vars');
4
 
5
  if ( video_vars.player_type == "Video.js" ) {
6
 
7
+ kgvid_load_videojs(video_vars);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  }
10
  });
204
  swfobject.embedSWF(video_vars.swfurl, 'video_'+id, video_vars.width, video_vars.height, '10.1.0', video_vars.expressinstallswfurl, video_vars.flashvars, video_vars.params);
205
  }
206
 
207
+ if ( video_vars.player_type == "Video.js" ) {
208
+ setTimeout(function() { kgvid_load_videojs(video_vars); }, 0);
209
+ }
210
+ else { setTimeout(function() { kgvid_setup_video(id); }, 0); }
211
 
212
  dialog.wrap.css('overflow', 'hidden'); //disable scroll bars
213
  if ( meta > 0 ) {
301
 
302
  }
303
 
304
+ function kgvid_load_videojs(video_vars) {
305
+
306
+ var videojs_options = { "html5": { "nativeTextTracks" : false }, "language": video_vars.locale };
307
+ if ( video_vars.resize == "true" || video_vars.fullwidth == "true" ) {
308
+ videojs_options.fluid = true;
309
+ }
310
+ else {
311
+ videojs_options.fluid = false;
312
+ }
313
+ if ( video_vars.width != undefined && video_vars.width.indexOf('%') === -1 && video_vars.height != undefined ) {
314
+ videojs_options.aspectRatio = video_vars.width + ':' + video_vars.height;
315
+ }
316
+ if ( video_vars.nativecontrolsfortouch == "true" ) {
317
+ videojs_options.nativeControlsForTouch = true;
318
+ }
319
+ if ( video_vars.enable_resolutions_plugin == "true" ) {
320
+ videojs_options.plugins = { "resolutionSelector" : { "force_types" : ["video/mp4"] } };
321
+ if ( video_vars.default_res ) {
322
+ videojs_options.plugins.resolutionSelector.default_res = video_vars.default_res;
323
+ }
324
+ }
325
+
326
+ videojs('video_'+video_vars.id, videojs_options ).ready(function(){ kgvid_setup_video(video_vars.id); });
327
+
328
+ }
329
+
330
  function kgvid_setup_video(id) {
331
 
332
  var video_vars = jQuery('#video_'+id+'_div').data('kgvid_video_vars');
js/kgvid_video_plugin_admin.js CHANGED
@@ -140,9 +140,6 @@ function kgvid_thumb_video_loaded(postID) { //sets up mini custom player for mak
140
  video.removeAttribute('style');
141
  video.setAttribute('width', '200');
142
 
143
- video.removeAttribute("controls");
144
- video.muted=true;
145
-
146
  var playButton = jQuery(".kgvid-play-pause");
147
  var seekBar = jQuery(".kgvid-seek-bar");
148
  var playProgress = jQuery(".kgvid-play-progress");
@@ -179,10 +176,16 @@ function kgvid_thumb_video_loaded(postID) { //sets up mini custom player for mak
179
 
180
  var timeDrag = false; /* Drag status */
181
  seekBar.mousedown(function(e) {
182
- video.pause();
 
 
183
 
184
- timeDrag = true;
185
- updatebar(e.pageX);
 
 
 
 
186
  });
187
  jQuery(document).mouseup(function(e) {
188
  if(timeDrag) {
@@ -211,14 +214,14 @@ function kgvid_thumb_video_loaded(postID) { //sets up mini custom player for mak
211
  playProgress.css('width', percentage+'%');
212
  seekHandle.css('left', percentage+'%');
213
  video.currentTime = maxduration * percentage / 100;
 
214
  };
215
 
216
  jQuery(video).on('loadedmetadata', function() {
217
  var currentTimecode = jQuery('#attachments-'+postID+'-kgflashmediaplayer-thumbtime').val();
218
- if ( !currentTimecode ) {
219
- currentTimecode = '0';
220
  }
221
- video.currentTime = kgvid_convert_from_timecode(currentTimecode);
222
  });
223
 
224
  jQuery('.kgvid-video-controls').on('keydown.kgvid', function(e) {
@@ -320,8 +323,8 @@ function kgvid_reveal_thumb_video(postID) {
320
  if ( video.networkState == 1 || video.networkState == 2 ) {
321
  text.html(kgvidL10n.hidevideo);
322
  jQuery('#attachments-'+postID+'-thumbnailplaceholder').slideUp();
323
- jQuery('#thumb-video-'+postID).on('timeupdate.kgvid', function() {
324
- if (document.getElementById('thumb-video-'+postID).currentTime != 0) {
325
  var thumbtimecode = kgvid_convert_to_timecode(document.getElementById('thumb-video-'+postID).currentTime);
326
  jQuery('#attachments-'+postID+'-kgflashmediaplayer-thumbtime').val(thumbtimecode);
327
  }
@@ -447,6 +450,8 @@ function kgvid_generate_thumb(postID, buttonPushed) {
447
  var thumbnail_saved = jQuery(video).data('thumbnail_data');
448
  if ( thumbnail_saved.length > 0 ) { //if there are any thumbnails that haven't been generated
449
 
 
 
450
  time_id = Math.round(video.currentTime*100);
451
  var time_display = kgvid_convert_to_timecode(video.currentTime);
452
 
@@ -493,6 +498,7 @@ function kgvid_generate_thumb(postID, buttonPushed) {
493
  var thumbtimecode = kgvid_convert_from_timecode(specifictimecode);
494
  thumbnails = [thumbtimecode];
495
  }
 
496
  video.currentTime = thumbnails[0];
497
  jQuery(video).data('thumbnail_data', thumbnails);
498
 
140
  video.removeAttribute('style');
141
  video.setAttribute('width', '200');
142
 
 
 
 
143
  var playButton = jQuery(".kgvid-play-pause");
144
  var seekBar = jQuery(".kgvid-seek-bar");
145
  var playProgress = jQuery(".kgvid-play-progress");
176
 
177
  var timeDrag = false; /* Drag status */
178
  seekBar.mousedown(function(e) {
179
+ if ( video.paused == false ) {
180
+ video.pause();
181
+ }
182
 
183
+ if ( video.currentTime == 0 ) {
184
+ video.play(); //video won't seek in Chrome unless it has played once already
185
+ }
186
+
187
+ timeDrag = true;
188
+ updatebar(e.pageX);
189
  });
190
  jQuery(document).mouseup(function(e) {
191
  if(timeDrag) {
214
  playProgress.css('width', percentage+'%');
215
  seekHandle.css('left', percentage+'%');
216
  video.currentTime = maxduration * percentage / 100;
217
+
218
  };
219
 
220
  jQuery(video).on('loadedmetadata', function() {
221
  var currentTimecode = jQuery('#attachments-'+postID+'-kgflashmediaplayer-thumbtime').val();
222
+ if ( currentTimecode ) {
223
+ video.currentTime = kgvid_convert_from_timecode(currentTimecode);
224
  }
 
225
  });
226
 
227
  jQuery('.kgvid-video-controls').on('keydown.kgvid', function(e) {
323
  if ( video.networkState == 1 || video.networkState == 2 ) {
324
  text.html(kgvidL10n.hidevideo);
325
  jQuery('#attachments-'+postID+'-thumbnailplaceholder').slideUp();
326
+ jQuery(video).on('timeupdate.kgvid', function() {
327
+ if (video.currentTime != 0) {
328
  var thumbtimecode = kgvid_convert_to_timecode(document.getElementById('thumb-video-'+postID).currentTime);
329
  jQuery('#attachments-'+postID+'-kgflashmediaplayer-thumbtime').val(thumbtimecode);
330
  }
450
  var thumbnail_saved = jQuery(video).data('thumbnail_data');
451
  if ( thumbnail_saved.length > 0 ) { //if there are any thumbnails that haven't been generated
452
 
453
+ if ( video.paused == false ) { video.pause(); }
454
+
455
  time_id = Math.round(video.currentTime*100);
456
  var time_display = kgvid_convert_to_timecode(video.currentTime);
457
 
498
  var thumbtimecode = kgvid_convert_from_timecode(specifictimecode);
499
  thumbnails = [thumbtimecode];
500
  }
501
+ video.play();
502
  video.currentTime = thumbnails[0];
503
  jQuery(video).data('thumbnail_data', thumbnails);
504
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kyleg
4
  Tags: video, video player, video gallery, video thumbnail, ffmpeg, resolution
5
  Requires at least: 4.4
6
  Tested up to: 4.6
7
- Stable tag: 4.6.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -245,6 +245,11 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
245
 
246
  == Changelog ==
247
 
 
 
 
 
 
248
  = 4.6.11 - September 17, 2016 =
249
  * Fixed broken video galleries in AJAX-loaded pages when the option to always load plugin-related JavaScripts is enabled.
250
  * Fixed untranslated "views" text after video is played.
4
  Tags: video, video player, video gallery, video thumbnail, ffmpeg, resolution
5
  Requires at least: 4.4
6
  Tested up to: 4.6
7
+ Stable tag: 4.6.12
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
245
 
246
  == Changelog ==
247
 
248
+ = 4.6.12 - September 25, 2016 =
249
+ * Restored Video.js resolution selection in pop-up video galleries.
250
+ * Fixed thumbnail creation bugs in Chrome browser.
251
+ * Fixed missing 'starts' error message when video had never been played.
252
+
253
  = 4.6.11 - September 17, 2016 =
254
  * Fixed broken video galleries in AJAX-loaded pages when the option to always load plugin-related JavaScripts is enabled.
255
  * Fixed untranslated "views" text after video is played.
video-embed-thumbnail-generator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Video Embed & Thumbnail Generator
4
  Plugin URI: http://www.kylegilman.net/2011/01/18/video-embed-thumbnail-generator-wordpress-plugin/
5
  Description: Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for encoding.
6
- Version: 4.6.11
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
  Text Domain: video-embed-thumbnail-generator
@@ -59,7 +59,7 @@ function kgvid_default_options_fn() {
59
  $edit_others_capable = kgvid_check_if_capable('edit_others_posts');
60
 
61
  $options = array(
62
- "version" => '4.6.11',
63
  "embed_method" => "Video.js",
64
  "jw_player_id" => "",
65
  "template" => false,
@@ -2655,8 +2655,13 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
2655
  $code .= "\t\t\t</div>\n";
2656
  $show_views = false;
2657
  if ( ( !empty($id) && $query_atts['view_count'] == "true" ) || !empty($query_atts['caption']) || $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { //generate content below the video
2658
- if ( is_array($kgvid_postmeta) && array_key_exists('starts', $kgvid_postmeta) ) { $view_count = number_format(intval($kgvid_postmeta['starts'])); }
2659
- else { $view_count = "0"; }
 
 
 
 
 
2660
  if ( $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { $view_count = "XX"; }
2661
  if ( $query_atts['view_count'] == "true" ) { $show_views = true; }
2662
  if ( !empty($query_atts['caption']) || $show_views || $query_atts['downloadlink'] == "true" ) {
@@ -5621,7 +5626,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
5621
  $choose_from_video_content = '<div style="display:none;" class="kgvid_thumbnail_box kgvid-tabs-content" id="thumb-video-'.$post->ID.'-container">
5622
  <div class="kgvid-reveal-thumb-video" onclick="kgvid_reveal_thumb_video('.$post->ID.')" id="show-thumb-video-'.$post->ID.'"><span class="kgvid-right-arrow"></span><span class="kgvid-show-video">'.__('Choose from video...', 'video-embed-thumbnail-generator').'</span></div>
5623
  <div style="display:none;" id="thumb-video-'.$post->ID.'-player">
5624
- <video crossorigin="anonymous" preload="metadata" class="kgvid-thumb-video" width="200" data-allowed="'.$options['browser_thumbnails'].'" onloadedmetadata="kgvid_thumb_video_loaded(\''.$post->ID.'\');" id="thumb-video-'.$post->ID.'" controls>'.
5625
  implode("\n", $sources).'
5626
  </video>
5627
  <div class="kgvid-video-controls" tabindex="0">
@@ -5822,6 +5827,7 @@ function kgvid_hide_video_children($wp_query_obj) {
5822
  && !array_key_exists('post_mime_type', $wp_query_obj->query_vars) //show children when specifically displaying videos
5823
  && ( array_key_exists('posts_per_page', $wp_query_obj->query_vars) && $wp_query_obj->query_vars['posts_per_page'] > 0 ) //hide children only when showing paged content (makes sure that -1 will actually return all attachments)
5824
  ) {
 
5825
  $wp_query_obj->set(
5826
  'meta_query',
5827
  array(
3
  Plugin Name: Video Embed & Thumbnail Generator
4
  Plugin URI: http://www.kylegilman.net/2011/01/18/video-embed-thumbnail-generator-wordpress-plugin/
5
  Description: Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for encoding.
6
+ Version: 4.6.12
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
  Text Domain: video-embed-thumbnail-generator
59
  $edit_others_capable = kgvid_check_if_capable('edit_others_posts');
60
 
61
  $options = array(
62
+ "version" => '4.6.12',
63
  "embed_method" => "Video.js",
64
  "jw_player_id" => "",
65
  "template" => false,
2655
  $code .= "\t\t\t</div>\n";
2656
  $show_views = false;
2657
  if ( ( !empty($id) && $query_atts['view_count'] == "true" ) || !empty($query_atts['caption']) || $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { //generate content below the video
2658
+ if ( is_array($kgvid_postmeta) && array_key_exists('starts', $kgvid_postmeta) ) {
2659
+ $view_count = number_format(intval($kgvid_postmeta['starts']));
2660
+ }
2661
+ else {
2662
+ $view_count = "0";
2663
+ $kgvid_postmeta['starts'] = 0;
2664
+ }
2665
  if ( $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { $view_count = "XX"; }
2666
  if ( $query_atts['view_count'] == "true" ) { $show_views = true; }
2667
  if ( !empty($query_atts['caption']) || $show_views || $query_atts['downloadlink'] == "true" ) {
5626
  $choose_from_video_content = '<div style="display:none;" class="kgvid_thumbnail_box kgvid-tabs-content" id="thumb-video-'.$post->ID.'-container">
5627
  <div class="kgvid-reveal-thumb-video" onclick="kgvid_reveal_thumb_video('.$post->ID.')" id="show-thumb-video-'.$post->ID.'"><span class="kgvid-right-arrow"></span><span class="kgvid-show-video">'.__('Choose from video...', 'video-embed-thumbnail-generator').'</span></div>
5628
  <div style="display:none;" id="thumb-video-'.$post->ID.'-player">
5629
+ <video crossorigin="anonymous" muted preload="metadata" class="kgvid-thumb-video" width="200" data-allowed="'.$options['browser_thumbnails'].'" onloadedmetadata="kgvid_thumb_video_loaded(\''.$post->ID.'\');" id="thumb-video-'.$post->ID.'">'.
5630
  implode("\n", $sources).'
5631
  </video>
5632
  <div class="kgvid-video-controls" tabindex="0">
5827
  && !array_key_exists('post_mime_type', $wp_query_obj->query_vars) //show children when specifically displaying videos
5828
  && ( array_key_exists('posts_per_page', $wp_query_obj->query_vars) && $wp_query_obj->query_vars['posts_per_page'] > 0 ) //hide children only when showing paged content (makes sure that -1 will actually return all attachments)
5829
  ) {
5830
+
5831
  $wp_query_obj->set(
5832
  'meta_query',
5833
  array(