Video Embed & Thumbnail Generator - Version 4.3.3

Version Description

  • July 20, 2014 =
  • Changed .mov files back to type "video/mp4" to fix "No compatible source was found for this video" errors.
  • Added "mute" shortcode attribute.
  • Added default volume and mute options.
  • Added option to set custom default shortcode attributes.
  • Fixed WordPress default player alternate H.264 sources.
  • Fixed WordPress default player volume and preload settings.
  • Fixed Video.js volume slider appearance when using the custom skin.
  • Disabled JW Player custom context menu when right-clicking is disabled.
Download this release

Release Info

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

Code changes from version 4.3.2 to 4.3.3

css/video-embed-thumbnail-generator_admin.css CHANGED
@@ -547,5 +547,9 @@ td.media-icon img {
547
  }
548
 
549
  #kgflashmediaplayer-table input {
550
- width: auto;
 
 
 
 
551
  }
547
  }
548
 
549
  #kgflashmediaplayer-table input {
550
+ width: auto;
551
+ }
552
+
553
+ .attachment-preview.type-video .thumbnail {
554
+ z-index: 0;
555
  }
js/kgvid_video_embed.js CHANGED
@@ -200,6 +200,7 @@ function kgvid_setup_video(id) {
200
  //if ( video_vars.resolutions_plugin == true ) { player.resolutions(true); }
201
 
202
  if ( video_vars.set_volume != "" ) { player.volume(video_vars.set_volume); }
 
203
 
204
  player.on('play', function kgvid_play_start(){
205
  player.off('timeupdate', kgvid_timeupdate);
@@ -293,7 +294,10 @@ function kgvid_setup_video(id) {
293
 
294
  player = jQuery('#video_'+id+'_div video');
295
 
296
- if ( video_vars.set_volume != "" ) { player[0].volume = video_vars.set_volume; }
 
 
 
297
 
298
  player.on('play', function kgvid_play_start(){
299
  jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
@@ -328,6 +332,7 @@ function kgvid_setup_video(id) {
328
  var player = jwplayer(player_id);
329
 
330
  if ( video_vars.set_volume != "" ) { player.setVolume(Math.round(video_vars.set_volume*100)); }
 
331
 
332
  player.onPlay( function() {
333
  kgvid_video_counter(id, 'play');
@@ -355,6 +360,12 @@ function kgvid_setup_video(id) {
355
 
356
  });
357
 
 
 
 
 
 
 
358
  }
359
 
360
  if ( video_vars.resize == "true" || window.location.search.indexOf("kgvid_video_embed[enable]=true") !== false ) {
200
  //if ( video_vars.resolutions_plugin == true ) { player.resolutions(true); }
201
 
202
  if ( video_vars.set_volume != "" ) { player.volume(video_vars.set_volume); }
203
+ if ( video_vars.mute == "true" ) { player.muted(true); }
204
 
205
  player.on('play', function kgvid_play_start(){
206
  player.off('timeupdate', kgvid_timeupdate);
294
 
295
  player = jQuery('#video_'+id+'_div video');
296
 
297
+ player.on('loadedmetadata', function() {
298
+ if ( video_vars.set_volume != "" ) { player[0].volume = video_vars.set_volume; }
299
+ if ( video_vars.mute == "true" ) { player[0].setMuted(true); }
300
+ });
301
 
302
  player.on('play', function kgvid_play_start(){
303
  jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
332
  var player = jwplayer(player_id);
333
 
334
  if ( video_vars.set_volume != "" ) { player.setVolume(Math.round(video_vars.set_volume*100)); }
335
+ if ( video_vars.mute == "true" ) { player.setMute(true); }
336
 
337
  player.onPlay( function() {
338
  kgvid_video_counter(id, 'play');
360
 
361
  });
362
 
363
+ if ( video_vars.right_click != "on" ) {
364
+ player.onReady( function() {
365
+ jQuery('#video_'+id+'_div .jwclick').remove();
366
+ });
367
+ }
368
+
369
  }
370
 
371
  if ( video_vars.resize == "true" || window.location.search.indexOf("kgvid_video_embed[enable]=true") !== false ) {
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, preview, poster, ffmpeg, libav, embed, mobile, webm, ogg, h.264, h264, responsive, mp4, jwplayer
5
  Requires at least: 3.5
6
  Tested up to: 4.0
7
- Stable tag: 4.3.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -66,6 +66,12 @@ To embed videos on other sites you can use code like this.
66
  `[KGVID poster="http://www.kylegilman.net/wp-content/uploads/2011/10/Reel-11-10-10-web_thumb2.jpg"
67
  width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/2006/09/Reel-2012-05-15-720.mp4[/KGVID]`
68
 
 
 
 
 
 
 
69
  I'm not really a software developer. I'm just a film editor with some time on his hands who wanted to post video for clients and wasn't happy with the current state of any available software. But I want to really make this thing work, so please help me out by posting your feedback on <a href="https://github.com/kylegilman/video-embed-thumbnail-generator/issues?state=open">Github</a>.
70
 
71
  = If you want to further modify the way the video player works, you can add the following options inside the `[KGVID]` tag. These will override anything you've set in the plugin settings or attachment details. If the plugin is installed on your site, this information is also available in the post edit help screen. =
@@ -81,6 +87,7 @@ I'm not really a software developer. I'm just a film editor with some time on hi
81
  * `align="left/right/center"`
82
  * `inline="true/false"` allow other content on the same line as the video
83
  * `volume="0.x"` pre-sets the volume for unusually loud videos. Value between 0 and 1.
 
84
  * `controlbar="docked/floating/none"` sets the controlbar position. Video.js only responds to the "none" option.
85
  * `loop="true/false"`
86
  * `autoplay="true/false"`
@@ -103,7 +110,7 @@ I'm not really a software developer. I'm just a film editor with some time on hi
103
 
104
  = These options will only affect Video.js playback =
105
 
106
- * `skin="example-css-class"` Completely change the look of the video player. <a href="https://github.com/zencoder/video-js/blob/master/docs/skins.md">Instructions here.</a>
107
 
108
  = These options will only affect Flash playback in Strobe Media Playback video elements. They will have no effect on other players. =
109
 
@@ -214,6 +221,16 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
214
 
215
  == Changelog ==
216
 
 
 
 
 
 
 
 
 
 
 
217
  = 4.3.2 - July 15, 2014 =
218
  * Updated Video.js to version 4.6.4
219
  * Added Spanish, French, and Bulgarian translations.
4
  Tags: video, video player, video gallery, html5, shortcode, thumbnail, preview, poster, ffmpeg, libav, embed, mobile, webm, ogg, h.264, h264, responsive, mp4, jwplayer
5
  Requires at least: 3.5
6
  Tested up to: 4.0
7
+ Stable tag: 4.3.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
66
  `[KGVID poster="http://www.kylegilman.net/wp-content/uploads/2011/10/Reel-11-10-10-web_thumb2.jpg"
67
  width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/2006/09/Reel-2012-05-15-720.mp4[/KGVID]`
68
 
69
+ = Translations included:=
70
+
71
+ * Español por Andrew Kurtis de <a href="http://www.webhostinghub.com/">WebHostingHub</a>.
72
+ * Français par F.R. 'Friss' Ferry, friss.designs@gmail.com
73
+ * Българска от Емил Георгиев, svinqvmraka@gmail.com
74
+
75
  I'm not really a software developer. I'm just a film editor with some time on his hands who wanted to post video for clients and wasn't happy with the current state of any available software. But I want to really make this thing work, so please help me out by posting your feedback on <a href="https://github.com/kylegilman/video-embed-thumbnail-generator/issues?state=open">Github</a>.
76
 
77
  = If you want to further modify the way the video player works, you can add the following options inside the `[KGVID]` tag. These will override anything you've set in the plugin settings or attachment details. If the plugin is installed on your site, this information is also available in the post edit help screen. =
87
  * `align="left/right/center"`
88
  * `inline="true/false"` allow other content on the same line as the video
89
  * `volume="0.x"` pre-sets the volume for unusually loud videos. Value between 0 and 1.
90
+ * `mute="true/false"` sets the mute button on or off.
91
  * `controlbar="docked/floating/none"` sets the controlbar position. Video.js only responds to the "none" option.
92
  * `loop="true/false"`
93
  * `autoplay="true/false"`
110
 
111
  = These options will only affect Video.js playback =
112
 
113
+ * `skin="example-css-class"` Completely change the look of the video player. <a href="http://designer.videojs.com/">Video.js provides a custom skin designer here.</a>
114
 
115
  = These options will only affect Flash playback in Strobe Media Playback video elements. They will have no effect on other players. =
116
 
221
 
222
  == Changelog ==
223
 
224
+ = 4.3.3 - July 20, 2014 =
225
+ * Changed .mov files back to type "video/mp4" to fix "No compatible source was found for this video" errors.
226
+ * Added "mute" shortcode attribute.
227
+ * Added default volume and mute options.
228
+ * Added option to set custom default shortcode attributes.
229
+ * Fixed WordPress default player alternate H.264 sources.
230
+ * Fixed WordPress default player volume and preload settings.
231
+ * Fixed Video.js volume slider appearance when using the custom skin.
232
+ * Disabled JW Player custom context menu when right-clicking is disabled.
233
+
234
  = 4.3.2 - July 15, 2014 =
235
  * Updated Video.js to version 4.6.4
236
  * Added Spanish, French, and Bulgarian translations.
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.3.2
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
  Text Domain: video-embed-thumbnail-generator
@@ -54,7 +54,7 @@ function kgvid_default_options_fn() {
54
  $edit_others_capable = kgvid_check_if_capable('edit_others_posts');
55
 
56
  $options = array(
57
- "version" => 4.302,
58
  "embed_method" => "Video.js",
59
  "jw_player_id" => "",
60
  "template" => false,
@@ -94,6 +94,8 @@ function kgvid_default_options_fn() {
94
  "controlbar_style" => "docked",
95
  "autoplay" => false,
96
  "loop" => false,
 
 
97
  "preload" => "metadata",
98
  "endofvideooverlay" => false,
99
  "endofvideooverlaysame" => "",
@@ -101,6 +103,7 @@ function kgvid_default_options_fn() {
101
  "configuration" => "",
102
  "skin" => plugins_url("", __FILE__)."/flash/skin/kg_skin.xml",
103
  "js_skin" => "kg-video-js-skin",
 
104
  "stream_type" => "liveOrRecorded",
105
  "scale_mode" => "letterbox",
106
  "autohide" => "on",
@@ -213,6 +216,7 @@ function kgvid_video_formats() {
213
  "width" => 4096,
214
  "height" => 2304,
215
  "type" => "h264",
 
216
  "suffix" => "-fullres.mp4",
217
  "vcodec" => "libx264"
218
  ),
@@ -221,6 +225,7 @@ function kgvid_video_formats() {
221
  "width" => 1920,
222
  "height" => 1080,
223
  "type" => "h264",
 
224
  "suffix" => "-1080.mp4",
225
  "old_suffix" => "-1080.m4v",
226
  "vcodec" => "libx264"
@@ -230,6 +235,7 @@ function kgvid_video_formats() {
230
  "width" => 1280,
231
  "height" => 720,
232
  "type" => "h264",
 
233
  "suffix" => "-720.mp4",
234
  "old_suffix" => "-720.m4v",
235
  "vcodec" => "libx264"
@@ -240,6 +246,7 @@ function kgvid_video_formats() {
240
  "height" => 480,
241
  "type" => "h264",
242
  "suffix" => "-480.mp4",
 
243
  "old_suffix" => "-ipod.m4v",
244
  "vcodec" => "libx264"
245
  ),
@@ -248,6 +255,7 @@ function kgvid_video_formats() {
248
  "width" => 0,
249
  "height" => 0,
250
  "type" => "webm",
 
251
  "suffix" => ".webm",
252
  "vcodec" => "libvpx",
253
  ),
@@ -256,6 +264,7 @@ function kgvid_video_formats() {
256
  "width" => 0,
257
  "height" => 0,
258
  "type" => "ogv",
 
259
  "suffix" => ".ogv",
260
  "vcodec" => "libtheora"
261
  )
@@ -1241,54 +1250,69 @@ function kgvid_shortcode_atts($atts) {
1241
  if ( in_the_loop() ) { $post_ID = get_the_ID(); }
1242
  else { $post_ID = 1; }
1243
 
1244
- $query_atts = shortcode_atts(
1245
- array(
1246
- 'id' => '',
1247
- 'orderby' => 'menu_order',
1248
- 'order' => 'ASC',
1249
- 'videos' => -1,
1250
- 'width' => $options['width'],
1251
- 'height' => $options['height'],
1252
- 'align' => $options['align'],
1253
- 'controlbar' => $options['controlbar_style'],
1254
- 'autohide' => $options['autohide'],
1255
- 'poster' => $options['poster'],
1256
- 'watermark' => $options['watermark'],
1257
- 'endofvideooverlay' => $options['endofvideooverlay'],
1258
- 'endofvideooverlaysame' => $options['endofvideooverlaysame'],
1259
- 'playbutton' => $options['playbutton'],
1260
- 'loop' => $options['loop'],
1261
- 'autoplay' => $options['autoplay'],
1262
- 'streamtype' => $options['stream_type'],
1263
- 'scalemode' => $options['scale_mode'],
1264
- 'backgroundcolor' => $options['bgcolor'],
1265
- 'configuration' => $options['configuration'],
1266
- 'skin' => $options['skin'],
1267
- 'gallery' => 'false',
1268
- 'gallery_thumb' => $options['gallery_thumb'],
1269
- 'gallery_orderby' => 'menu_order',
1270
- 'gallery_order' => 'ASC',
1271
- 'gallery_exclude' => '',
1272
- 'gallery_include' => '',
1273
- 'gallery_id' => $post_ID,
1274
- 'gallery_end' => '',
1275
- 'volume' => '',
1276
- 'title' => $options['overlay_title'],
1277
- 'embedcode' => $options['overlay_embedcode'],
1278
- 'view_count' => $options['view_count'],
1279
- 'caption' => '',
1280
- 'description' => '',
1281
- 'inline' => $options['inline'],
1282
- 'downloadlink' => $options['downloadlink'],
1283
- 'right_click' => $options['right_click'],
1284
- 'resize' => $options['resize'],
1285
- 'track_kind' => 'subtitles',
1286
- 'track_srclang' => substr(get_bloginfo('language'), 0, 2),
1287
- 'track_src' => '',
1288
- 'track_label' => get_bloginfo('language')
1289
- ), $atts, 'KGVID');
1290
-
1291
- $checkbox_convert = array ( "autohide", "endofvideooverlaysame", "playbutton", "loop", "autoplay", "title", "embedcode", "view_count", "inline", "resize", "downloadlink");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1292
  foreach ( $checkbox_convert as $query ) {
1293
  if ( $query_atts[$query] == "on" ) { $query_atts[$query] = "true"; }
1294
  if ( $query_atts[$query] == false ) { $query_atts[$query] = "false"; }
@@ -1438,14 +1462,21 @@ function KGVID_shortcode($atts, $content = ''){
1438
  $countable = false;
1439
  }
1440
 
1441
- $moviefiletype = pathinfo($content, PATHINFO_EXTENSION);
1442
- if ( $moviefiletype == "mov" || $moviefiletype == "m4v" ) { $moviefiletype = "mp4"; }
 
 
 
 
 
 
 
1443
 
1444
  $video_formats = kgvid_video_formats();
1445
  unset($video_formats['fullres']);
1446
- $video_formats = array('original' => array( "type" => $moviefiletype, "name" => "Full" ) ) + $video_formats;
1447
 
1448
- if ( in_array($moviefiletype, $compatible) ) {
1449
  $encodevideo_info["original_exists"] = true;
1450
  $encodevideo_info["originalurl"] = $content;
1451
  }
@@ -1512,15 +1543,14 @@ function KGVID_shortcode($atts, $content = ''){
1512
  foreach ($video_formats as $format => $format_stats) {
1513
  if ( $format != "original" && $encodevideo_info[$format."url"] == $content ) { unset($sources['original']); }
1514
  if ( $encodevideo_info[$format."_exists"] ) {
1515
- if ( $format_stats['type'] != "mp4" || !$mp4already ) {
1516
  $shortcode_type = wp_check_filetype( $encodevideo_info[$format."url"], wp_get_mime_types() );
1517
  $sources[$format] = $shortcode_type['ext'].'="'.$encodevideo_info[$format."url"].'" ';
1518
- if ( $format_stats['type'] == "mp4" ) { //WordPress built-in shortcode doesn't support multiple videos of the same type but we'll hack it in later
1519
- $search_string = '<source type="video/mp4" src="'.esc_attr($encodevideo_info[$format."url"]).'" />';
1520
  $mp4already = true;
1521
  }
1522
  }
1523
- else { $sources_hack .= '<source type="video/'.$format_stats['type'].'" src="'.esc_attr($encodevideo_info[$format."url"]).'" />'; }
1524
  }
1525
  }
1526
 
@@ -1529,12 +1559,13 @@ function KGVID_shortcode($atts, $content = ''){
1529
  $wp_shortcode .= 'width='.$query_atts["width"].' height='.$query_atts["height"].' ';
1530
  if ( $query_atts["loop"] == 'true') { $wp_shortcode .= 'loop="true" '; }
1531
  if ( $query_atts["autoplay"] == 'true') { $wp_shortcode .= 'autoplay="true" '; }
 
1532
  $wp_shortcode .= "]";
1533
  $content_width = $query_atts['width'];
1534
  $executed_shortcode = do_shortcode($wp_shortcode);
1535
  $content_width = $content_width_save;
1536
  if ( $sources_hack ) { //insert remaining mp4 sources manually
1537
- $position = strpos($executed_shortcode, $search_string) + strlen($search_string);
1538
  $executed_shortcode = substr_replace( $executed_shortcode, $sources_hack, $position, 0 );
1539
  }
1540
  if ( !empty($track_code) ) { //insert track code manually
@@ -1567,8 +1598,6 @@ function KGVID_shortcode($atts, $content = ''){
1567
  }
1568
  }
1569
 
1570
-
1571
-
1572
  $jw_shortcode = "[jwplayer ";
1573
  $jw_shortcode .= 'sources="'.implode(',', $sources).'" ';
1574
  $jw_shortcode .= 'tracks="'.implode(',', $jw_tracks).'" ';
@@ -1582,9 +1611,8 @@ function KGVID_shortcode($atts, $content = ''){
1582
  if ( !empty($jw_player_config) ) { $jw_shortcode .= ' player="'.$options['jw_player_id'].'" '; }
1583
  }
1584
 
1585
- $jw_config_options = array_diff($atts, $query_atts); //whatever isn't a KGVID attribute could be a JWPLAYER attribute
1586
- if ( !empty($jw_config_options) && is_array($jw_config_options) ) {
1587
- foreach ( $jw_config_options as $jw_param => $jw_setting ) {
1588
  $jw_shortcode .= ' '.$jw_param.'="'.$jw_setting.'" ';
1589
  }
1590
  }
@@ -1611,8 +1639,8 @@ function KGVID_shortcode($atts, $content = ''){
1611
  foreach ($video_formats as $format => $format_stats) {
1612
  if ( $format != "original" && $encodevideo_info[$format."url"] == $content ) { unset($sources['original']); }
1613
  if ( $encodevideo_info[$format."_exists"] ) {
1614
- $mime_type = wp_check_filetype($encodevideo_info[$format."url"]);
1615
- $sources[$format] = "\t\t\t\t\t".'<source src="'.esc_attr($encodevideo_info[$format."url"]).'" type="'.$mime_type['type'].'"';
1616
  /* if ( $format_stats['type'] == 'mp4' ) {
1617
  $sources[$format] .= ' data-res="'.$video_format_labels[$format].'"';
1618
  if ( $mp4already ) { //there is more than one resolution available
@@ -1688,7 +1716,8 @@ function KGVID_shortcode($atts, $content = ''){
1688
  'height' => $query_atts['height'],
1689
  'countable' => $countable,
1690
  'autoplay' => $query_atts['autoplay'],
1691
- 'set_volume' => $query_atts["volume"],
 
1692
  'meta' => $kgvid_meta,
1693
  'endofvideooverlay' => $query_atts['endofvideooverlay'],
1694
  'resize' => $query_atts['resize'],
@@ -2476,8 +2505,10 @@ function kgvid_video_embed_options_init() {
2476
  add_settings_field('controlbar_style', __('Video controls:', 'video-embed-thumbnail-generator'), 'kgvid_controlbar_style_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'controlbar_style' ) );
2477
  add_settings_field('autoplay', __('Autoplay:', 'video-embed-thumbnail-generator'), 'kgvid_autoplay_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'autoplay' ) );
2478
  add_settings_field('loop', _x('Loop:', 'verb', 'video-embed-thumbnail-generator'), 'kgvid_loop_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'loop' ) );
 
2479
  add_settings_field('preload', __('Preload:', 'video-embed-thumbnail-generator'), 'kgvid_preload_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'preload' ) );
2480
  add_settings_field('js_skin', _x('Skin class:', 'CSS class for video skin', 'video-embed-thumbnail-generator'), 'kgvid_js_skin_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'js_skin' ) );
 
2481
 
2482
  add_settings_field('bgcolor', __('Background color:', 'video-embed-thumbnail-generator'), 'kgvid_bgcolor_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'bgcolor' ) );
2483
  add_settings_field('configuration', __('XML configuration file:', 'video-embed-thumbnail-generator'), 'kgvid_configuration_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'configuration' ) );
@@ -2664,6 +2695,14 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
2664
  echo "<input class='affects_player' ".checked( $options['loop'], "on", false )." id='loop' name='kgvid_video_embed_options[loop]' type='checkbox' /> <label for='loop'>".__('Loop to beginning when video ends.', 'video-embed-thumbnail-generator')."</label>\n\t";
2665
  }
2666
 
 
 
 
 
 
 
 
 
2667
  function kgvid_preload_callback() {
2668
  $options = kgvid_get_options();
2669
  $items = array(
@@ -2683,6 +2722,11 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
2683
  echo "<input class='regular-text code affects_player' id='js_skin' name='kgvid_video_embed_options[js_skin]' type='text' value='".$options['js_skin']."' /><br /><em><small>".sprintf( __('Use %s for a nice, circular play button. Leave blank for the default square play button.', 'video-embed-thumbnail-generator')." <a href='http://videojs.com/docs/skins/'>".__('Or build your own CSS skin.', 'video-embed-thumbnail-generator'), '<code>kg-video-js-skin</code>')."</a></small></em>\n\t";
2684
  }
2685
 
 
 
 
 
 
2686
  function kgvid_bgcolor_callback() {
2687
  $options = kgvid_get_options();
2688
  echo "<input class='small-text affects_player' id='bgcolor' name='kgvid_video_embed_options[bgcolor]' maxlength='7' type='text' value='".$options['bgcolor']."' /> #rrggbb\n\t";
@@ -3276,7 +3320,6 @@ function kgvid_update_settings() {
3276
  kgvid_set_capabilities($options["capabilities"]);
3277
 
3278
  }
3279
-
3280
  if ( $options['version'] < 4.301 ) {
3281
  $options['version'] = 4.301;
3282
  if ( !array_key_exists('capabilities', $options ) ) { //fix bug in 4.3 that didn't create capabilties for single installs
@@ -3285,6 +3328,13 @@ function kgvid_update_settings() {
3285
  kgvid_set_capabilities($options['capabilities']);
3286
  }
3287
 
 
 
 
 
 
 
 
3288
  if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
3289
  if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
3290
  }
@@ -6021,6 +6071,7 @@ function kgvid_add_contextual_help_tab() {
6021
  <li><code>align="left/right/center"</code></li>
6022
  <li><code>inline="true/false"</code> '.__('allow other content on the same line as the video', 'video-embed-thumbnail-generator').'</li>
6023
  <li><code>volume="0.x"</code> '.__('pre-sets the volume for unusually loud videos. Value between 0 and 1.', 'video-embed-thumbnail-generator').'</li>
 
6024
  <li><code>controlbar="docked/floating/none"</code> '.__('sets the controlbar position. "Floating" option only works with Strobe Media Playback.', 'video-embed-thumbnail-generator').'</li>
6025
  <li><code>loop="true/false"</code></li>
6026
  <li><code>autoplay="true/false"</code></li>
@@ -6065,6 +6116,7 @@ function kgvid_add_contextual_help_tab() {
6065
 
6066
  }
6067
  add_action( 'admin_head-post.php', 'kgvid_add_contextual_help_tab' );
 
6068
 
6069
 
6070
  function kgvid_clear_cron_and_roles() {
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.3.3
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
  Text Domain: video-embed-thumbnail-generator
54
  $edit_others_capable = kgvid_check_if_capable('edit_others_posts');
55
 
56
  $options = array(
57
+ "version" => 4.303,
58
  "embed_method" => "Video.js",
59
  "jw_player_id" => "",
60
  "template" => false,
94
  "controlbar_style" => "docked",
95
  "autoplay" => false,
96
  "loop" => false,
97
+ "volume" => 1,
98
+ "mute" => false,
99
  "preload" => "metadata",
100
  "endofvideooverlay" => false,
101
  "endofvideooverlaysame" => "",
103
  "configuration" => "",
104
  "skin" => plugins_url("", __FILE__)."/flash/skin/kg_skin.xml",
105
  "js_skin" => "kg-video-js-skin",
106
+ "custom_attributes" => "",
107
  "stream_type" => "liveOrRecorded",
108
  "scale_mode" => "letterbox",
109
  "autohide" => "on",
216
  "width" => 4096,
217
  "height" => 2304,
218
  "type" => "h264",
219
+ "mime" => "video/mp4",
220
  "suffix" => "-fullres.mp4",
221
  "vcodec" => "libx264"
222
  ),
225
  "width" => 1920,
226
  "height" => 1080,
227
  "type" => "h264",
228
+ "mime" => "video/mp4",
229
  "suffix" => "-1080.mp4",
230
  "old_suffix" => "-1080.m4v",
231
  "vcodec" => "libx264"
235
  "width" => 1280,
236
  "height" => 720,
237
  "type" => "h264",
238
+ "mime" => "video/mp4",
239
  "suffix" => "-720.mp4",
240
  "old_suffix" => "-720.m4v",
241
  "vcodec" => "libx264"
246
  "height" => 480,
247
  "type" => "h264",
248
  "suffix" => "-480.mp4",
249
+ "mime" => "video/mp4",
250
  "old_suffix" => "-ipod.m4v",
251
  "vcodec" => "libx264"
252
  ),
255
  "width" => 0,
256
  "height" => 0,
257
  "type" => "webm",
258
+ "mime" => "video/webm",
259
  "suffix" => ".webm",
260
  "vcodec" => "libvpx",
261
  ),
264
  "width" => 0,
265
  "height" => 0,
266
  "type" => "ogv",
267
+ "mime" => "video/ogg",
268
  "suffix" => ".ogv",
269
  "vcodec" => "libtheora"
270
  )
1250
  if ( in_the_loop() ) { $post_ID = get_the_ID(); }
1251
  else { $post_ID = 1; }
1252
 
1253
+ $default_atts = array(
1254
+ 'id' => '',
1255
+ 'orderby' => 'menu_order',
1256
+ 'order' => 'ASC',
1257
+ 'videos' => -1,
1258
+ 'width' => $options['width'],
1259
+ 'height' => $options['height'],
1260
+ 'align' => $options['align'],
1261
+ 'controlbar' => $options['controlbar_style'],
1262
+ 'autohide' => $options['autohide'],
1263
+ 'poster' => $options['poster'],
1264
+ 'watermark' => $options['watermark'],
1265
+ 'endofvideooverlay' => $options['endofvideooverlay'],
1266
+ 'endofvideooverlaysame' => $options['endofvideooverlaysame'],
1267
+ 'playbutton' => $options['playbutton'],
1268
+ 'loop' => $options['loop'],
1269
+ 'autoplay' => $options['autoplay'],
1270
+ 'streamtype' => $options['stream_type'],
1271
+ 'scalemode' => $options['scale_mode'],
1272
+ 'backgroundcolor' => $options['bgcolor'],
1273
+ 'configuration' => $options['configuration'],
1274
+ 'skin' => $options['skin'],
1275
+ 'gallery' => 'false',
1276
+ 'gallery_thumb' => $options['gallery_thumb'],
1277
+ 'gallery_orderby' => 'menu_order',
1278
+ 'gallery_order' => 'ASC',
1279
+ 'gallery_exclude' => '',
1280
+ 'gallery_include' => '',
1281
+ 'gallery_id' => $post_ID,
1282
+ 'gallery_end' => '',
1283
+ 'volume' => $options['volume'],
1284
+ 'mute' => $options['mute'],
1285
+ 'title' => $options['overlay_title'],
1286
+ 'embedcode' => $options['overlay_embedcode'],
1287
+ 'view_count' => $options['view_count'],
1288
+ 'caption' => '',
1289
+ 'description' => '',
1290
+ 'inline' => $options['inline'],
1291
+ 'downloadlink' => $options['downloadlink'],
1292
+ 'right_click' => $options['right_click'],
1293
+ 'resize' => $options['resize'],
1294
+ 'track_kind' => 'subtitles',
1295
+ 'track_srclang' => substr(get_bloginfo('language'), 0, 2),
1296
+ 'track_src' => '',
1297
+ 'track_label' => get_bloginfo('language')
1298
+ );
1299
+
1300
+ $custom_atts_return = array();
1301
+ if ( !empty($options['custom_attributes']) ) {
1302
+ preg_match_all('/(\w+)\s*=\s*(["\'])((?:(?!\2).)*)\2/', $options['custom_attributes'], $custom_atts, PREG_SET_ORDER);
1303
+ if ( !empty($custom_atts) && is_array($custom_atts) ) {
1304
+ foreach ( $custom_atts as $custom_att ) {
1305
+ if ( array_key_exists($custom_att[1], $default_atts) ) {
1306
+ $default_atts[$custom_att[1]] = $custom_att[3];
1307
+ }
1308
+ else { $default_atts['custom_atts'][$custom_att[1]] = $custom_att[3]; }
1309
+ }
1310
+ }
1311
+ }
1312
+
1313
+ $query_atts = shortcode_atts($default_atts, $atts, 'KGVID');
1314
+
1315
+ $checkbox_convert = array ( "autohide", "endofvideooverlaysame", "playbutton", "loop", "autoplay", "title", "embedcode", "view_count", "inline", "resize", "downloadlink", "mute");
1316
  foreach ( $checkbox_convert as $query ) {
1317
  if ( $query_atts[$query] == "on" ) { $query_atts[$query] = "true"; }
1318
  if ( $query_atts[$query] == false ) { $query_atts[$query] = "false"; }
1462
  $countable = false;
1463
  }
1464
 
1465
+ $mime_type_check = wp_check_filetype($content);
1466
+ if ( in_array($mime_type_check['ext'], $h264compatible) ) {
1467
+ $format_type = "h264";
1468
+ $mime_type = "video/mp4";
1469
+ }
1470
+ else {
1471
+ $format_type = $mime_type_check['ext'];
1472
+ $mime_type = $mime_type_check['type'];
1473
+ }
1474
 
1475
  $video_formats = kgvid_video_formats();
1476
  unset($video_formats['fullres']);
1477
+ $video_formats = array('original' => array( "type" => $format_type, "mime" => $mime_type, "name" => "Full" ) ) + $video_formats;
1478
 
1479
+ if ( in_array($mime_type_check['ext'], $compatible) ) {
1480
  $encodevideo_info["original_exists"] = true;
1481
  $encodevideo_info["originalurl"] = $content;
1482
  }
1543
  foreach ($video_formats as $format => $format_stats) {
1544
  if ( $format != "original" && $encodevideo_info[$format."url"] == $content ) { unset($sources['original']); }
1545
  if ( $encodevideo_info[$format."_exists"] ) {
1546
+ if ( $format_stats['type'] != "h264" || !$mp4already ) {
1547
  $shortcode_type = wp_check_filetype( $encodevideo_info[$format."url"], wp_get_mime_types() );
1548
  $sources[$format] = $shortcode_type['ext'].'="'.$encodevideo_info[$format."url"].'" ';
1549
+ if ( $format_stats['type'] == "h264" ) { //WordPress built-in shortcode doesn't support multiple videos of the same type but we'll hack it in later
 
1550
  $mp4already = true;
1551
  }
1552
  }
1553
+ else { $sources_hack .= '<source type="'.$format_stats['mime'].'" src="'.esc_attr($encodevideo_info[$format."url"]).'" />'; }
1554
  }
1555
  }
1556
 
1559
  $wp_shortcode .= 'width='.$query_atts["width"].' height='.$query_atts["height"].' ';
1560
  if ( $query_atts["loop"] == 'true') { $wp_shortcode .= 'loop="true" '; }
1561
  if ( $query_atts["autoplay"] == 'true') { $wp_shortcode .= 'autoplay="true" '; }
1562
+ $wp_shortcode .= 'preload="'.$options['preload'].'"';
1563
  $wp_shortcode .= "]";
1564
  $content_width = $query_atts['width'];
1565
  $executed_shortcode = do_shortcode($wp_shortcode);
1566
  $content_width = $content_width_save;
1567
  if ( $sources_hack ) { //insert remaining mp4 sources manually
1568
+ $position = strpos($executed_shortcode, '<a href=');
1569
  $executed_shortcode = substr_replace( $executed_shortcode, $sources_hack, $position, 0 );
1570
  }
1571
  if ( !empty($track_code) ) { //insert track code manually
1598
  }
1599
  }
1600
 
 
 
1601
  $jw_shortcode = "[jwplayer ";
1602
  $jw_shortcode .= 'sources="'.implode(',', $sources).'" ';
1603
  $jw_shortcode .= 'tracks="'.implode(',', $jw_tracks).'" ';
1611
  if ( !empty($jw_player_config) ) { $jw_shortcode .= ' player="'.$options['jw_player_id'].'" '; }
1612
  }
1613
 
1614
+ if ( !empty($query_atts['custom_atts']) && is_array($query_atts['custom_atts']) ) {
1615
+ foreach ( $query_atts['custom_atts'] as $jw_param => $jw_setting ) {
 
1616
  $jw_shortcode .= ' '.$jw_param.'="'.$jw_setting.'" ';
1617
  }
1618
  }
1639
  foreach ($video_formats as $format => $format_stats) {
1640
  if ( $format != "original" && $encodevideo_info[$format."url"] == $content ) { unset($sources['original']); }
1641
  if ( $encodevideo_info[$format."_exists"] ) {
1642
+
1643
+ $sources[$format] = "\t\t\t\t\t".'<source src="'.esc_attr($encodevideo_info[$format."url"]).'" type="'.$format_stats["mime"].'"';
1644
  /* if ( $format_stats['type'] == 'mp4' ) {
1645
  $sources[$format] .= ' data-res="'.$video_format_labels[$format].'"';
1646
  if ( $mp4already ) { //there is more than one resolution available
1716
  'height' => $query_atts['height'],
1717
  'countable' => $countable,
1718
  'autoplay' => $query_atts['autoplay'],
1719
+ 'set_volume' => $query_atts['volume'],
1720
+ 'mute' => $query_atts['mute'],
1721
  'meta' => $kgvid_meta,
1722
  'endofvideooverlay' => $query_atts['endofvideooverlay'],
1723
  'resize' => $query_atts['resize'],
2505
  add_settings_field('controlbar_style', __('Video controls:', 'video-embed-thumbnail-generator'), 'kgvid_controlbar_style_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'controlbar_style' ) );
2506
  add_settings_field('autoplay', __('Autoplay:', 'video-embed-thumbnail-generator'), 'kgvid_autoplay_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'autoplay' ) );
2507
  add_settings_field('loop', _x('Loop:', 'verb', 'video-embed-thumbnail-generator'), 'kgvid_loop_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'loop' ) );
2508
+ add_settings_field('audio', __('Volume:', 'video-embed-thumbnail-generator'), 'kgvid_audio_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'volume' ) );
2509
  add_settings_field('preload', __('Preload:', 'video-embed-thumbnail-generator'), 'kgvid_preload_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'preload' ) );
2510
  add_settings_field('js_skin', _x('Skin class:', 'CSS class for video skin', 'video-embed-thumbnail-generator'), 'kgvid_js_skin_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'js_skin' ) );
2511
+ add_settings_field('custom_attributes', __('Custom attributes:', 'video-embed-thumbnail-generator'), 'kgvid_custom_attributes_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'custom_attributes' ) );
2512
 
2513
  add_settings_field('bgcolor', __('Background color:', 'video-embed-thumbnail-generator'), 'kgvid_bgcolor_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'bgcolor' ) );
2514
  add_settings_field('configuration', __('XML configuration file:', 'video-embed-thumbnail-generator'), 'kgvid_configuration_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'configuration' ) );
2695
  echo "<input class='affects_player' ".checked( $options['loop'], "on", false )." id='loop' name='kgvid_video_embed_options[loop]' type='checkbox' /> <label for='loop'>".__('Loop to beginning when video ends.', 'video-embed-thumbnail-generator')."</label>\n\t";
2696
  }
2697
 
2698
+ function kgvid_audio_callback() {
2699
+ $options = kgvid_get_options();
2700
+ echo "<input type='range' min='0' max='1' value='".$options['volume']."' step='0.05' class='affects_player' style='vertical-align: middle;
2701
+ margin-right: 10px;' onchange='document.getElementById(\"volume_number\").value=this.value*100+\"%\"' oninput='document.getElementById(\"volume_number\").value=this.value*100+\"%\"' name='kgvid_video_embed_options[volume]' id='volume' /><input disabled id='volume_number' class='small-text' style='font-size:90%' value='". floatval($options['volume'])*100 ."%' /><br />\n\t";
2702
+ echo "<input class='affects_player' ".checked( $options['mute'], "on", false )." id='mute' name='kgvid_video_embed_options[mute]' type='checkbox' /> <label for='mute'>".__('Mute', 'video-embed-thumbnail-generator')."</label>\n\t";
2703
+
2704
+ }
2705
+
2706
  function kgvid_preload_callback() {
2707
  $options = kgvid_get_options();
2708
  $items = array(
2722
  echo "<input class='regular-text code affects_player' id='js_skin' name='kgvid_video_embed_options[js_skin]' type='text' value='".$options['js_skin']."' /><br /><em><small>".sprintf( __('Use %s for a nice, circular play button. Leave blank for the default square play button.', 'video-embed-thumbnail-generator')." <a href='http://videojs.com/docs/skins/'>".__('Or build your own CSS skin.', 'video-embed-thumbnail-generator'), '<code>kg-video-js-skin</code>')."</a></small></em>\n\t";
2723
  }
2724
 
2725
+ function kgvid_custom_attributes_callback() {
2726
+ $options = kgvid_get_options();
2727
+ echo "<input class='regular-text code affects_player' id='custom_attributes' name='kgvid_video_embed_options[custom_attributes]' type='text' value='".$options['custom_attributes']."' /><br /><em><small>".sprintf( __('Space-separated list to add to all videos. Example: %s', 'video-embed-thumbnail-generator'), '<code>orderby="title" order="DESC" startparam="start"</code>' )."</small></em>\n\t";
2728
+ }
2729
+
2730
  function kgvid_bgcolor_callback() {
2731
  $options = kgvid_get_options();
2732
  echo "<input class='small-text affects_player' id='bgcolor' name='kgvid_video_embed_options[bgcolor]' maxlength='7' type='text' value='".$options['bgcolor']."' /> #rrggbb\n\t";
3320
  kgvid_set_capabilities($options["capabilities"]);
3321
 
3322
  }
 
3323
  if ( $options['version'] < 4.301 ) {
3324
  $options['version'] = 4.301;
3325
  if ( !array_key_exists('capabilities', $options ) ) { //fix bug in 4.3 that didn't create capabilties for single installs
3328
  kgvid_set_capabilities($options['capabilities']);
3329
  }
3330
 
3331
+ if ( $options['version'] < 4.303 ) {
3332
+ $options['version'] = 4.303;
3333
+ $options['volume'] = 1;
3334
+ $options['mute'] = false;
3335
+ $options['custom_attributes'] = '';
3336
+ }
3337
+
3338
  if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
3339
  if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
3340
  }
6071
  <li><code>align="left/right/center"</code></li>
6072
  <li><code>inline="true/false"</code> '.__('allow other content on the same line as the video', 'video-embed-thumbnail-generator').'</li>
6073
  <li><code>volume="0.x"</code> '.__('pre-sets the volume for unusually loud videos. Value between 0 and 1.', 'video-embed-thumbnail-generator').'</li>
6074
+ <li><code>mute="true/false"</code> '.__('sets the mute button on or off.', 'video-embed-thumbnail-generator').'</li>
6075
  <li><code>controlbar="docked/floating/none"</code> '.__('sets the controlbar position. "Floating" option only works with Strobe Media Playback.', 'video-embed-thumbnail-generator').'</li>
6076
  <li><code>loop="true/false"</code></li>
6077
  <li><code>autoplay="true/false"</code></li>
6116
 
6117
  }
6118
  add_action( 'admin_head-post.php', 'kgvid_add_contextual_help_tab' );
6119
+ add_action( 'admin_head-post-new.php', 'kgvid_add_contextual_help_tab' );
6120
 
6121
 
6122
  function kgvid_clear_cron_and_roles() {
video-js/kg-video-js-skin.css CHANGED
@@ -217,11 +217,19 @@ fonts to show/hide properly.
217
  top: 0;
218
  left: 0;
219
  height: 0.5em;
 
 
 
220
  background: #66a8cc url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat;
221
  }
222
  .kg-video-js-skin .vjs-volume-bar .vjs-volume-handle {
223
  width: 0.5em;
224
  height: 0.5em;
 
 
 
 
 
225
  }
226
  .kg-video-js-skin .vjs-volume-handle:before {
227
  font-size: 0.9em;
217
  top: 0;
218
  left: 0;
219
  height: 0.5em;
220
+ /* assuming volume starts at 1.0 */
221
+
222
+ width: 100%;
223
  background: #66a8cc url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat;
224
  }
225
  .kg-video-js-skin .vjs-volume-bar .vjs-volume-handle {
226
  width: 0.5em;
227
  height: 0.5em;
228
+ /* Assumes volume starts at 1.0. If you change the size of the
229
+ handle relative to the volume bar, you'll need to update this value
230
+ too. */
231
+
232
+ left: 4.5em;
233
  }
234
  .kg-video-js-skin .vjs-volume-handle:before {
235
  font-size: 0.9em;