Video Embed & Thumbnail Generator - Version 4.5.3

Version Description

  • July 11, 2015 =
  • Fixed error that could zero out view counts when editing videos.
  • Fixed 'strlen' error when updating videos with subtitles.
  • Attempting to enable 'default' subtitle tracks on more browsers, but implementation is inconsistent.
Download this release

Release Info

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

Code changes from version 4.5.2 to 4.5.3

js/kgvid_video_embed.js CHANGED
@@ -231,10 +231,21 @@ function kgvid_setup_video(id) {
231
 
232
  jQuery('#video_'+id).append(jQuery('#video_'+id+'_watermark'));
233
 
234
- setTimeout(function() {
 
 
 
 
 
 
 
 
 
 
235
  if ( video_vars.set_volume != "" ) { player.volume(video_vars.set_volume); }
236
  if ( video_vars.mute == "true" ) { player.muted(true); }
237
- }, 0);
 
238
 
239
  player.on('play', function kgvid_play_start(){
240
  player.off('timeupdate', kgvid_timeupdate);
231
 
232
  jQuery('#video_'+id).append(jQuery('#video_'+id+'_watermark'));
233
 
234
+ player.on('loadedmetadata', function(){
235
+
236
+ var text_tracks = player.textTracks();
237
+ var default_track_id = jQuery('#video_'+id+'_div track[default]').first().attr('id');
238
+
239
+ if ( default_track_id != null ) {
240
+ jQuery(text_tracks).each(function(index, track) {
241
+ if ( track.id == default_track_id && track.mode != 'showing' ) { player.textTracks()[index].mode = 'showing'; }
242
+ });
243
+ }
244
+
245
  if ( video_vars.set_volume != "" ) { player.volume(video_vars.set_volume); }
246
  if ( video_vars.mute == "true" ) { player.muted(true); }
247
+
248
+ });
249
 
250
  player.on('play', function kgvid_play_start(){
251
  player.off('timeupdate', kgvid_timeupdate);
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, html5, shortcode, thumbnail, video thumbnail, preview, poster, ffmpeg, libav, embed, oembed, mobile, webm, ogg, h.264, h264, vp9, responsive, mp4, jwplayer, resolution
5
  Requires at least: 3.5
6
  Tested up to: 4.3
7
- Stable tag: 4.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -229,6 +229,11 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
229
 
230
  == Changelog ==
231
 
 
 
 
 
 
232
  = 4.5.2 - July 10, 2015 =
233
  * Fixed bug that failed to set the volume or count views when using the WordPress Default or JW Player.
234
  * Fixed bug that failed to count views when WordPress Default player was on autoplay.
4
  Tags: video, video player, video gallery, html5, shortcode, thumbnail, video thumbnail, preview, poster, ffmpeg, libav, embed, oembed, mobile, webm, ogg, h.264, h264, vp9, responsive, mp4, jwplayer, resolution
5
  Requires at least: 3.5
6
  Tested up to: 4.3
7
+ Stable tag: 4.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
229
 
230
  == Changelog ==
231
 
232
+ = 4.5.3 - July 11, 2015 =
233
+ * Fixed error that could zero out view counts when editing videos.
234
+ * Fixed 'strlen' error when updating videos with subtitles.
235
+ * Attempting to enable 'default' subtitle tracks on more browsers, but implementation is inconsistent.
236
+
237
  = 4.5.2 - July 10, 2015 =
238
  * Fixed bug that failed to set the volume or count views when using the WordPress Default or JW Player.
239
  * Fixed bug that failed to count views when WordPress Default player was on autoplay.
video-embed-thumbnail-generator.php CHANGED
@@ -3,10 +3,11 @@
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.5.2
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
  Text Domain: video-embed-thumbnail-generator
 
10
 
11
  This program is free software; you can redistribute it and/or modify
12
  it under the terms of the GNU General Public License as published by
@@ -268,7 +269,12 @@ function kgvid_get_attachment_meta($post_id) {
268
  delete_post_meta($post_id, "_kgflashmediaplayer-".$key);
269
  }
270
 
271
- array_filter($kgvid_postmeta, 'strlen'); //remove empty elements
 
 
 
 
 
272
  kgvid_save_attachment_meta($post_id, $kgvid_postmeta);
273
 
274
  }
@@ -283,10 +289,12 @@ function kgvid_get_attachment_meta($post_id) {
283
 
284
  function kgvid_save_attachment_meta($post_id, $kgvid_postmeta) {
285
 
286
- $options = kgvid_get_options();
287
-
288
  if ( is_array($kgvid_postmeta) ) {
289
 
 
 
 
 
290
  foreach ( $kgvid_postmeta as $key => $meta ) { //don't save if it's the same as the default values or empty
291
 
292
  if ( (array_key_exists($key, $options) && $meta == $options[$key])
@@ -2145,7 +2153,7 @@ function KGVID_shortcode($atts, $content = ''){
2145
  if ( empty($value) ) { $track_attribute[$attribute] = $query_atts['track_'.$attribute]; }
2146
  }
2147
  if ( $options['embed_method'] == "WordPress Default" && $track_attribute['kind'] == 'captions' ) { $track_attribute['kind'] = 'subtitles'; }
2148
- $track_code .= "\t\t\t\t\t<track kind='".esc_attr($track_attribute['kind'])."' src='".esc_attr($track_attribute['src'])."' srclang='".esc_attr($track_attribute['srclang'])."' label='".esc_attr($track_attribute['label'])."' ".esc_attr($track_attribute['default'])." />\n";
2149
  }
2150
  }
2151
 
@@ -4877,7 +4885,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
4877
  URL: <input name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][src]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_src" type="text" value="'.$kgvid_postmeta['track'][$track]['src'].'" class="text" style="width:180px;"><br />
4878
  '._x('Language code:', 'two-letter code indicating track\'s language', 'video-embed-thumbnail-generator').' <input name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][srclang]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_srclang" type="text" value="'.$kgvid_postmeta['track'][$track]['srclang'].'" maxlength="2" style="width:40px;"><br />
4879
  '.__('Label:', 'video-embed-thumbnail-generator').' <input name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][label]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_label" type="text" value="'.$kgvid_postmeta['track'][$track]['label'].'" class="text" style="width:172px;"><br />
4880
- '.__('Default:', 'video-embed-thumbnail-generator').'<input '.checked(array_key_exists('default', $kgvid_postmeta['track'][$track]), true, false).' name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][default]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_default" type="checkbox" value="default"></div>';
4881
  }
4882
  }
4883
 
@@ -5323,6 +5331,12 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
5323
  if( !isset($attachment['kgflashmediaplayer-'.$checkbox]) ) { $attachment['kgflashmediaplayer-'.$checkbox] = "false"; }
5324
  }
5325
 
 
 
 
 
 
 
5326
  $kgvid_postmeta = array();
5327
 
5328
  foreach ( $attachment as $kgflashmediaplayer_key => $value ) {
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.5.3
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
  Text Domain: video-embed-thumbnail-generator
10
+ Domain Path: /languages
11
 
12
  This program is free software; you can redistribute it and/or modify
13
  it under the terms of the GNU General Public License as published by
269
  delete_post_meta($post_id, "_kgflashmediaplayer-".$key);
270
  }
271
 
272
+ foreach ( $kgvid_postmeta as $key => $value ) {
273
+ if ( $value === null ) {
274
+ unset( $kgvid_postmeta[ $meta ] ); //remove empty elements
275
+ }
276
+ }
277
+
278
  kgvid_save_attachment_meta($post_id, $kgvid_postmeta);
279
 
280
  }
289
 
290
  function kgvid_save_attachment_meta($post_id, $kgvid_postmeta) {
291
 
 
 
292
  if ( is_array($kgvid_postmeta) ) {
293
 
294
+ $options = kgvid_get_options();
295
+ $kgvid_old_postmeta = kgvid_get_attachment_meta($post_id);
296
+ $kgvid_postmeta = array_merge($kgvid_old_postmeta, $kgvid_postmeta); //make sure all keys are saved
297
+
298
  foreach ( $kgvid_postmeta as $key => $meta ) { //don't save if it's the same as the default values or empty
299
 
300
  if ( (array_key_exists($key, $options) && $meta == $options[$key])
2153
  if ( empty($value) ) { $track_attribute[$attribute] = $query_atts['track_'.$attribute]; }
2154
  }
2155
  if ( $options['embed_method'] == "WordPress Default" && $track_attribute['kind'] == 'captions' ) { $track_attribute['kind'] = 'subtitles'; }
2156
+ $track_code .= "\t\t\t\t\t<track id='".$div_suffix."_text_".$track."' kind='".esc_attr($track_attribute['kind'])."' src='".esc_attr($track_attribute['src'])."' srclang='".esc_attr($track_attribute['srclang'])."' label='".esc_attr($track_attribute['label'])."' ".esc_attr($track_attribute['default'])." />\n";
2157
  }
2158
  }
2159
 
4885
  URL: <input name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][src]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_src" type="text" value="'.$kgvid_postmeta['track'][$track]['src'].'" class="text" style="width:180px;"><br />
4886
  '._x('Language code:', 'two-letter code indicating track\'s language', 'video-embed-thumbnail-generator').' <input name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][srclang]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_srclang" type="text" value="'.$kgvid_postmeta['track'][$track]['srclang'].'" maxlength="2" style="width:40px;"><br />
4887
  '.__('Label:', 'video-embed-thumbnail-generator').' <input name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][label]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_label" type="text" value="'.$kgvid_postmeta['track'][$track]['label'].'" class="text" style="width:172px;"><br />
4888
+ '.__('Default:', 'video-embed-thumbnail-generator').'<input '.checked($kgvid_postmeta['track'][$track]['default'], 'default', false).' name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][default]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_default" type="checkbox" value="default"></div>';
4889
  }
4890
  }
4891
 
5331
  if( !isset($attachment['kgflashmediaplayer-'.$checkbox]) ) { $attachment['kgflashmediaplayer-'.$checkbox] = "false"; }
5332
  }
5333
 
5334
+ if ( isset( $attachment['kgflashmediaplayer-track'] ) && is_array( $attachment['kgflashmediaplayer-track'] ) ) {
5335
+ foreach ( $attachment['kgflashmediaplayer-track'] as $track => $track_attribute ) {
5336
+ if ( !array_key_exists('default', $track_attribute) ) { $attachment['kgflashmediaplayer-track'][ $track ]['default'] = ''; }
5337
+ }
5338
+ }
5339
+
5340
  $kgvid_postmeta = array();
5341
 
5342
  foreach ( $attachment as $kgflashmediaplayer_key => $value ) {