Video Embed & Thumbnail Generator - Version 4.6.8

Version Description

  • June 22, 2016 =
  • Added keyboard control of video thumbnail selector. Spacebar to play/pause, arrow keys to move one frame forward or back, and JKL playback control. Reverse playback only works in Safari.
  • Added option to pause other videos on the page when starting a new video (or disable it for WP Default player).
  • Added option to always load plugin-related JavaScripts to support AJAX page loading.
  • Added functionality to dynamically embed attached videos outside of the loop.
  • Added check for changed filename extension if a video has been replaced by a different format but is still embedded using the old filename.
  • Fixed bug that disabled styling for WordPress Default video players on the page when embedded after an audio file.
  • Fixed bug that didn't record Video.js pop-up video gallery views or JW Player quarter playback stats.
  • Fixed bug that prevented automatic clearing of old encode queue entries.
  • Fixed bug that doubled non-H.264 video source tags.
  • Fixed bug that prevented encoding 1080p and 720p H.264 videos if original video is not H.264 and has the same resolution.
  • Improved iframe-embedded vertical video resizing.
  • Changed iPhone play button to match Video.js button style.
  • Tweaked embed code overlay styles.
  • Set WordPress Default bottom margin to 0.
Download this release

Release Info

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

Code changes from version 4.6.7 to 4.6.8

css/kgvid_styles.css CHANGED
@@ -233,8 +233,13 @@ input[type="text"].kgvid_embedcode {
233
  width: 30% !important;
234
  }
235
 
 
 
 
 
 
236
  input[type="text"].kgvid_start_at {
237
- width: 8%; !important;
238
  }
239
 
240
  .kgvid_share_icons .kgvid_social_icons {
@@ -398,7 +403,7 @@ span.kgvid_facebook_icon_holder {
398
  top: -22px;
399
  }
400
 
401
- #kgvid-simplemodal-container .wp-video {
402
  margin-bottom: 0px;
403
  }
404
 
@@ -494,6 +499,11 @@ ul li.vjs-menu-title.vjs-res-menu-title:hover {
494
  z-index: 2;
495
  }
496
 
 
 
 
 
 
497
  /* mep-feature-sourcechooser plugin styles */
498
 
499
  .kgvid_wrapper .mejs-controls div.mejs-sourcechooser-button button {
233
  width: 30% !important;
234
  }
235
 
236
+ span.kgvid_start_time {
237
+ margin-left: 15px;
238
+ white-space: nowrap;
239
+ }
240
+
241
  input[type="text"].kgvid_start_at {
242
+ width: 3em; !important;
243
  }
244
 
245
  .kgvid_share_icons .kgvid_social_icons {
403
  top: -22px;
404
  }
405
 
406
+ #kgvid-simplemodal-container .wp-video, .kgvid_wrapper .wp-video {
407
  margin-bottom: 0px;
408
  }
409
 
499
  z-index: 2;
500
  }
501
 
502
+ /* fix iPhone play button */
503
+ .kgvid_wrapper video::-webkit-media-controls-start-playback-button { display: none; }
504
+ .kgvid_wrapper .video-js.vjs-controls-enabled .vjs-big-play-button { display: none; }
505
+ .kgvid_wrapper .video-js.vjs-controls-enabled.vjs-paused .vjs-big-play-button { display: block; }
506
+
507
  /* mep-feature-sourcechooser plugin styles */
508
 
509
  .kgvid_wrapper .mejs-controls div.mejs-sourcechooser-button button {
js/kgvid_video_embed.js CHANGED
@@ -70,8 +70,12 @@ function kgvid_window_load() {
70
  }
71
 
72
  function kgvid_mejs_success(mediaElement, domObject) {
73
- var id = jQuery(domObject).parents('.kgvid_videodiv').data('id');
74
- kgvid_setup_video(id);
 
 
 
 
75
  }
76
 
77
  function kgvid_convert_to_timecode(time) {
@@ -196,11 +200,11 @@ function kgvid_SetVideo(id) { //for galleries
196
  jQuery(document).on('keydown.kgvid', function(e) {
197
  switch(e.which) {
198
  case 37: // left
199
- jQuery('.kgvid_gallery_prev').click()
200
  break;
201
 
202
  case 39: // right
203
- jQuery('.kgvid_gallery_next').click()
204
  break;
205
 
206
  default: return; // exit this handler for other keys
@@ -233,11 +237,6 @@ function kgvid_SetVideo(id) { //for galleries
233
  jQuery.modal.setPosition();
234
  }
235
 
236
- if ( video_vars.player_type == "Video.js" ) {
237
- videojs('video_'+id).load();
238
- videojs('video_'+id).play();
239
- }//end if Video.js
240
-
241
  if ( video_vars.player_type == "WordPressDefault" ) {
242
  jQuery('#kgvid_'+id+'_wrapper video').mediaelementplayer({
243
  success: function(mediaElement, domObject) {
@@ -388,6 +387,14 @@ function kgvid_setup_video(id) {
388
  if ( video_vars.autoplay == "true" ) { jQuery('#video_'+id+' > .vjs-control-bar').removeClass('vjs-fade-in'); }
389
  if ( video_vars.endofvideooverlay != "" ) { jQuery('#video_'+id+' > .vjs-poster').hide(); }
390
 
 
 
 
 
 
 
 
 
391
  kgvid_video_counter(id, 'play');
392
 
393
  player.on('timeupdate', function(){
@@ -491,6 +498,7 @@ function kgvid_setup_video(id) {
491
 
492
  if ( video_vars.set_volume != "" ) { player[0].volume = video_vars.set_volume; }
493
  if ( video_vars.mute == "true" ) { player[0].setMuted(true); }
 
494
  jQuery('#video_'+id+'_div .mejs-container').append(jQuery('#video_'+id+'_watermark'));
495
 
496
  if ( played == "not played" ) { //only turn on the default captions on first load
@@ -589,17 +597,34 @@ function kgvid_setup_video(id) {
589
  jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
590
  }
591
 
592
- player.on('timeupdate', function(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
 
594
- if ( jQuery('#video_'+id+'_div').data("25") == undefined && Math.round(player.currentTime() / player.duration() * 100) == 25 ) {
595
  jQuery('#video_'+id+'_div').data("25", true);
596
  kgvid_video_counter(id, '25');
597
  }
598
- else if ( jQuery('#video_'+id+'_div').data("50") == undefined && Math.round(player.currentTime() / player.duration() * 100) == 50 ) {
599
  jQuery('#video_'+id+'_div').data("50", true);
600
  kgvid_video_counter(id, '50');
601
  }
602
- else if ( jQuery('#video_'+id+'_div').data("75") == undefined && Math.round(player.currentTime() / player.duration() * 100) == 75 ) {
603
  jQuery('#video_'+id+'_div').data("75", true);
604
  kgvid_video_counter(id, '75');
605
 
@@ -652,7 +677,10 @@ function kgvid_resize_video(id) {
652
  var window_width = jQuery(window).width();
653
  var window_height = jQuery(window).height();
654
 
655
- if ( reference_div.is('body') ) { parent_width = window.innerWidth; set_width = window.innerWidth; }
 
 
 
656
  else if ( reference_div.attr('id') == 'kgvid_popup_video_holder_'+id ) { //if it's a pop-up video
657
  parent_width = window_width-40;
658
  }
@@ -667,18 +695,24 @@ function kgvid_resize_video(id) {
667
  jQuery('#kgvid_'+id+'_wrapper').width(set_width);
668
  var set_height = Math.round(set_width * aspect_ratio);
669
 
670
- if ( reference_div.attr('id') == 'kgvid_popup_video_holder_'+id && set_height > window_height-60 ) {
671
  set_height = window_height-60;
672
  set_width = Math.round(set_height / aspect_ratio);
673
  }
674
 
 
 
 
 
 
 
675
  if ( ( video_vars.player_type == "Video.js" && eval('videojs.getPlayers()["video_'+id+'"]') != null ) ) {
676
 
677
  video_vars.player_type == "Video.js"
678
 
679
  var player = videojs('video_'+id);
 
680
  player.width(set_width).height(set_height);
681
-
682
  if ( set_width < 500 ) {
683
  var scale = Math.round(100*set_width/500)/100;
684
  jQuery('#kgvid_'+id+'_wrapper .vjs-big-play-button').css('-webkit-transform','scale('+scale+')').css('-o-transform','scale('+scale+')').css('-ms-transform','scale('+scale+')').css('transform','scale('+scale+')');
@@ -692,7 +726,7 @@ function kgvid_resize_video(id) {
692
  }
693
  }
694
  }
695
- else { jQuery('#kgvid_'+id+'_wrapper .vjs-big-play-button').removeAttr('style'); }
696
  }
697
 
698
  if ( video_vars.player_type == "StrobeMediaPlayback" ) {
@@ -702,9 +736,16 @@ function kgvid_resize_video(id) {
702
  }
703
 
704
  if ( video_vars.player_type == "WordPressDefault" ) {
 
 
 
705
  if ( typeof mejs !== 'undefined' ) {
706
- jQuery('#kgvid_'+id+'_wrapper').find('.wp-video').attr('style', 'width:'+set_width+'px;');
707
  player = eval('mejs.players.'+jQuery('#kgvid_'+id+'_wrapper div.wp-video-shortcode').attr('id'));
 
 
 
 
 
708
  }
709
  }
710
 
70
  }
71
 
72
  function kgvid_mejs_success(mediaElement, domObject) {
73
+ if ( domObject.nodeName == "VIDEO" ) {
74
+ var id = jQuery(domObject).parents('.kgvid_videodiv').data('id');
75
+ if ( id != undefined ) { //make sure we're using KGVID shortcode
76
+ kgvid_setup_video(id);
77
+ }
78
+ }
79
  }
80
 
81
  function kgvid_convert_to_timecode(time) {
200
  jQuery(document).on('keydown.kgvid', function(e) {
201
  switch(e.which) {
202
  case 37: // left
203
+ jQuery('.kgvid_gallery_prev').click();
204
  break;
205
 
206
  case 39: // right
207
+ jQuery('.kgvid_gallery_next').click();
208
  break;
209
 
210
  default: return; // exit this handler for other keys
237
  jQuery.modal.setPosition();
238
  }
239
 
 
 
 
 
 
240
  if ( video_vars.player_type == "WordPressDefault" ) {
241
  jQuery('#kgvid_'+id+'_wrapper video').mediaelementplayer({
242
  success: function(mediaElement, domObject) {
387
  if ( video_vars.autoplay == "true" ) { jQuery('#video_'+id+' > .vjs-control-bar').removeClass('vjs-fade-in'); }
388
  if ( video_vars.endofvideooverlay != "" ) { jQuery('#video_'+id+' > .vjs-poster').hide(); }
389
 
390
+ if ( video_vars.pauseothervideos == "true" ) {
391
+ jQuery.each(videojs.getPlayers(), function(otherPlayerId, otherPlayer) {
392
+ if ( player.id() != otherPlayerId && !otherPlayer.paused() && !otherPlayer.autoplay() ) {
393
+ otherPlayer.pause();
394
+ }
395
+ });
396
+ }
397
+
398
  kgvid_video_counter(id, 'play');
399
 
400
  player.on('timeupdate', function(){
498
 
499
  if ( video_vars.set_volume != "" ) { player[0].volume = video_vars.set_volume; }
500
  if ( video_vars.mute == "true" ) { player[0].setMuted(true); }
501
+ if ( video_vars.pauseothervideos == "false" ) { mejs_player.options.pauseOtherPlayers = false; }
502
  jQuery('#video_'+id+'_div .mejs-container').append(jQuery('#video_'+id+'_watermark'));
503
 
504
  if ( played == "not played" ) { //only turn on the default captions on first load
597
  jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
598
  }
599
 
600
+ if ( video_vars.pauseothervideos == "true" ) {
601
+ var i = 0;
602
+ while (true) {
603
+ var testplayer = jwplayer(i);
604
+ if (!testplayer.id) {
605
+ break;
606
+ }
607
+ else if ( testplayer.id == player.id ) {
608
+ i++;
609
+ }
610
+ else {
611
+ testplayer.pause(true);
612
+ i++;
613
+ }
614
+ }//end loop through jwplayers
615
+ }
616
+
617
+ player.onTime( function(e){
618
 
619
+ if ( jQuery('#video_'+id+'_div').data("25") == undefined && Math.round(e.position / e.duration * 100) == 25 ) {
620
  jQuery('#video_'+id+'_div').data("25", true);
621
  kgvid_video_counter(id, '25');
622
  }
623
+ else if ( jQuery('#video_'+id+'_div').data("50") == undefined && Math.round(e.position / e.duration * 100) == 50 ) {
624
  jQuery('#video_'+id+'_div').data("50", true);
625
  kgvid_video_counter(id, '50');
626
  }
627
+ else if ( jQuery('#video_'+id+'_div').data("75") == undefined && Math.round(e.position / e.duration * 100) == 75 ) {
628
  jQuery('#video_'+id+'_div').data("75", true);
629
  kgvid_video_counter(id, '75');
630
 
677
  var window_width = jQuery(window).width();
678
  var window_height = jQuery(window).height();
679
 
680
+ if ( reference_div.is('body') ) { //if the video is embedded
681
+ parent_width = window.innerWidth;
682
+ set_width = window.innerWidth;
683
+ }
684
  else if ( reference_div.attr('id') == 'kgvid_popup_video_holder_'+id ) { //if it's a pop-up video
685
  parent_width = window_width-40;
686
  }
695
  jQuery('#kgvid_'+id+'_wrapper').width(set_width);
696
  var set_height = Math.round(set_width * aspect_ratio);
697
 
698
+ if ( reference_div.attr('id') == 'kgvid_popup_video_holder_'+id && set_height > window_height-60 ) { //if it's a popup video
699
  set_height = window_height-60;
700
  set_width = Math.round(set_height / aspect_ratio);
701
  }
702
 
703
+ if ( reference_div.is('body') && set_height > window.innerHeight ) { //if it's a tall embedded video
704
+ set_height = window.innerHeight;
705
+ var change_aspect = true;
706
+
707
+ } //if the video is embedded
708
+
709
  if ( ( video_vars.player_type == "Video.js" && eval('videojs.getPlayers()["video_'+id+'"]') != null ) ) {
710
 
711
  video_vars.player_type == "Video.js"
712
 
713
  var player = videojs('video_'+id);
714
+ if ( change_aspect ) { player.aspectRatio(Math.floor(set_width)+':'+Math.floor(set_height)); }
715
  player.width(set_width).height(set_height);
 
716
  if ( set_width < 500 ) {
717
  var scale = Math.round(100*set_width/500)/100;
718
  jQuery('#kgvid_'+id+'_wrapper .vjs-big-play-button').css('-webkit-transform','scale('+scale+')').css('-o-transform','scale('+scale+')').css('-ms-transform','scale('+scale+')').css('transform','scale('+scale+')');
726
  }
727
  }
728
  }
729
+ else { jQuery('#kgvid_'+id+'_wrapper .vjs-big-play-button').css('transform', ''); }
730
  }
731
 
732
  if ( video_vars.player_type == "StrobeMediaPlayback" ) {
736
  }
737
 
738
  if ( video_vars.player_type == "WordPressDefault" ) {
739
+
740
+ jQuery('#kgvid_'+id+'_wrapper .wp-video').css('width', set_width+'px');
741
+
742
  if ( typeof mejs !== 'undefined' ) {
 
743
  player = eval('mejs.players.'+jQuery('#kgvid_'+id+'_wrapper div.wp-video-shortcode').attr('id'));
744
+ if ( change_aspect ) {
745
+ player.options.setDimensions = false;
746
+ jQuery('#kgvid_'+id+'_wrapper div.wp-video-shortcode').css('height', set_height+'px');
747
+ }
748
+
749
  }
750
  }
751
 
js/kgvid_video_plugin_admin.js CHANGED
@@ -142,6 +142,7 @@ function kgvid_thumb_video_loaded(postID) { //sets up mini custom player for mak
142
  else {
143
  // Pause the video
144
  video.pause();
 
145
  }
146
  });
147
 
@@ -198,6 +199,62 @@ function kgvid_thumb_video_loaded(postID) { //sets up mini custom player for mak
198
  video.currentTime = maxduration * percentage / 100;
199
  };
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  jQuery(video).data('setup', true);
202
  if ( jQuery(video).data('busy') != true ) { kgvid_break_video_on_close(postID); }
203
  }
@@ -244,7 +301,7 @@ function kgvid_reveal_thumb_video(postID) {
244
 
245
  if ( video.networkState == 1 || video.networkState == 2 ) {
246
  text.html(kgvidL10n.hidevideo);
247
- jQuery('#attachments-'+postID+'-thumbnailplaceholder').empty();
248
  jQuery('#thumb-video-'+postID).on('timeupdate.kgvid', function() {
249
  if (document.getElementById('thumb-video-'+postID).currentTime != 0) {
250
  var thumbtimecode = kgvid_convert_to_timecode(document.getElementById('thumb-video-'+postID).currentTime);
@@ -263,6 +320,10 @@ function kgvid_reveal_thumb_video(postID) {
263
  kgvid_break_video_on_close(postID);
264
  text.html(kgvidL10n.choosefromvideo);
265
 
 
 
 
 
266
  }
267
  jQuery('#thumb-video-'+postID+'-player').animate({opacity: 'toggle', height: 'toggle'}, 500);
268
  jQuery('#generate-thumb-'+postID+'-container').animate({opacity: 'toggle', height: 'toggle'}, 500);
@@ -1318,14 +1379,12 @@ function kgvid_hide_plugin_settings() {
1318
  if ( playback_option == "WordPress Default" || playback_option == "JW Player" ) {
1319
  jQuery('#nativecontrolsfortouch').parents().eq(1).hide();
1320
  jQuery('#js_skin').parents().eq(1).hide();
1321
- jQuery('#chromecast').parents().eq(1).hide();
1322
  jQuery('#resize_div').hide();
1323
  }
1324
 
1325
  if ( playback_option == "Video.js" || playback_option == "Strobe Media Playback" ) {
1326
  jQuery('#nativecontrolsfortouch').parents().eq(1).show();
1327
  jQuery('#js_skin').parents().eq(1).show();
1328
- jQuery('#chromecast').parents().eq(1).show();
1329
  jQuery('#auto_res').parents().eq(1).show();
1330
  jQuery('#resize_div').show();
1331
  }
142
  else {
143
  // Pause the video
144
  video.pause();
145
+ video.playbackRate = 1;
146
  }
147
  });
148
 
199
  video.currentTime = maxduration * percentage / 100;
200
  };
201
 
202
+ jQuery(video).on('loadedmetadata', function() {
203
+ video.currentTime = kgvid_convert_from_timecode(jQuery('#attachments-'+postID+'-kgflashmediaplayer-thumbtime').val());
204
+ });
205
+
206
+ jQuery('.kgvid-video-controls').on('keydown.kgvid', function(e) {
207
+
208
+ e.stopImmediatePropagation();
209
+
210
+ switch(e.which) {
211
+ case 32: // spacebar
212
+ playButton.click();
213
+ break;
214
+
215
+ case 37: // left
216
+ video.pause();
217
+ video.currentTime = video.currentTime - 0.042;
218
+ break;
219
+
220
+ case 39: // right
221
+ video.pause();
222
+ video.currentTime = video.currentTime + 0.042;
223
+ break;
224
+
225
+ case 74: //j
226
+ if ( video.paused == false ) {
227
+ video.playbackRate = video.playbackRate - 1;
228
+ }
229
+ if ( video.playbackRate >= 0 ) { video.playbackRate = -1; }
230
+ video.play();
231
+ break;
232
+
233
+ case 75: // k
234
+ if ( video.paused == false ) { playButton.click(); }
235
+ break;
236
+
237
+ case 76: //l
238
+ if ( video.paused == false ) {
239
+ video.playbackRate = video.playbackRate + 1;
240
+ }
241
+ if ( video.playbackRate <= 0 ) { video.playbackRate = 1; }
242
+ video.play();
243
+ break;
244
+
245
+ default: return; // exit this handler for other keys
246
+ }
247
+ e.preventDefault(); // prevent the default action (scroll / move caret)
248
+ });
249
+
250
+ jQuery(video).click( function(e){
251
+ e.stopImmediatePropagation();
252
+ playButton.click();
253
+ jQuery('.kgvid-video-controls').focus();
254
+ });
255
+
256
+ jQuery('.kgvid-video-controls').focus();
257
+
258
  jQuery(video).data('setup', true);
259
  if ( jQuery(video).data('busy') != true ) { kgvid_break_video_on_close(postID); }
260
  }
301
 
302
  if ( video.networkState == 1 || video.networkState == 2 ) {
303
  text.html(kgvidL10n.hidevideo);
304
+ jQuery('#attachments-'+postID+'-thumbnailplaceholder').slideUp();
305
  jQuery('#thumb-video-'+postID).on('timeupdate.kgvid', function() {
306
  if (document.getElementById('thumb-video-'+postID).currentTime != 0) {
307
  var thumbtimecode = kgvid_convert_to_timecode(document.getElementById('thumb-video-'+postID).currentTime);
320
  kgvid_break_video_on_close(postID);
321
  text.html(kgvidL10n.choosefromvideo);
322
 
323
+ if ( jQuery('#attachments-'+postID+'-thumbnailplaceholder').is(":visible") == false ) {
324
+ jQuery('#attachments-'+postID+'-thumbnailplaceholder').slideDown();
325
+ }
326
+
327
  }
328
  jQuery('#thumb-video-'+postID+'-player').animate({opacity: 'toggle', height: 'toggle'}, 500);
329
  jQuery('#generate-thumb-'+postID+'-container').animate({opacity: 'toggle', height: 'toggle'}, 500);
1379
  if ( playback_option == "WordPress Default" || playback_option == "JW Player" ) {
1380
  jQuery('#nativecontrolsfortouch').parents().eq(1).hide();
1381
  jQuery('#js_skin').parents().eq(1).hide();
 
1382
  jQuery('#resize_div').hide();
1383
  }
1384
 
1385
  if ( playback_option == "Video.js" || playback_option == "Strobe Media Playback" ) {
1386
  jQuery('#nativecontrolsfortouch').parents().eq(1).show();
1387
  jQuery('#js_skin').parents().eq(1).show();
 
1388
  jQuery('#auto_res').parents().eq(1).show();
1389
  jQuery('#resize_div').show();
1390
  }
js/mep-feature-sourcechooser.js CHANGED
@@ -111,7 +111,6 @@
111
  var currentTime = media.currentTime;
112
  var paused = media.paused;
113
  media.pause();
114
-
115
  if ( currentTime != 0 ) {
116
  var canvas = document.createElement("canvas");
117
  canvas.className = 'kgvid_temp_thumb';
@@ -140,6 +139,7 @@
140
  if (!paused) {
141
  media.play();
142
  }
 
143
  media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler, true);
144
  };
145
  media.addEventListener('canplay', canPlayAfterSourceSwitchHandler, true);
111
  var currentTime = media.currentTime;
112
  var paused = media.paused;
113
  media.pause();
 
114
  if ( currentTime != 0 ) {
115
  var canvas = document.createElement("canvas");
116
  canvas.className = 'kgvid_temp_thumb';
139
  if (!paused) {
140
  media.play();
141
  }
142
+
143
  media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler, true);
144
  };
145
  media.addEventListener('canplay', canPlayAfterSourceSwitchHandler, true);
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.5
7
- Stable tag: 4.6.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -151,7 +151,7 @@ I'm not really a software developer. I'm just a film editor with some time on hi
151
 
152
  = These options can be added to the URL to further customize playback =
153
 
154
- Using the `kgvid_video_embed` query string any of the following options will modify playback: `auto_res, autoplay, default_res, fullwidth, height, mute, nativecontrolsfortouch, pixel_ratio, resize, set_volume, start, width`
155
 
156
  Example: `https://www.kylegilman.net/portfolio-item/bronx-warrants-pilot/?kgvid_video_embed[start]=29&kgvid_video_embed[autoplay]=true` autoplays the embedded video and starts 29 seconds in.
157
 
@@ -244,6 +244,22 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
244
 
245
  == Changelog ==
246
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
247
  = 4.6.7 - May 26, 2016 =
248
  * Updated Video.js to version 5.10.2
249
  * Fixed bug that set Video.js players to the highest resolution no matter what was set as the default.
4
  Tags: video, video player, video gallery, video thumbnail, ffmpeg, resolution
5
  Requires at least: 4.4
6
  Tested up to: 4.5
7
+ Stable tag: 4.6.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
151
 
152
  = These options can be added to the URL to further customize playback =
153
 
154
+ Using the `kgvid_video_embed` query string any of the following options will modify playback: auto_res, autoplay, default_res, fullwidth, height, mute, nativecontrolsfortouch, pixel_ratio, resize, set_volume, start, width
155
 
156
  Example: `https://www.kylegilman.net/portfolio-item/bronx-warrants-pilot/?kgvid_video_embed[start]=29&kgvid_video_embed[autoplay]=true` autoplays the embedded video and starts 29 seconds in.
157
 
244
 
245
  == Changelog ==
246
 
247
+ = 4.6.8 - June 22, 2016 =
248
+ * Added keyboard control of video thumbnail selector. Spacebar to play/pause, arrow keys to move one frame forward or back, and JKL playback control. Reverse playback only works in Safari.
249
+ * Added option to pause other videos on the page when starting a new video (or disable it for WP Default player).
250
+ * Added option to always load plugin-related JavaScripts to support AJAX page loading.
251
+ * Added functionality to dynamically embed attached videos outside of the loop.
252
+ * Added check for changed filename extension if a video has been replaced by a different format but is still embedded using the old filename.
253
+ * Fixed bug that disabled styling for WordPress Default video players on the page when embedded after an audio file.
254
+ * Fixed bug that didn't record Video.js pop-up video gallery views or JW Player quarter playback stats.
255
+ * Fixed bug that prevented automatic clearing of old encode queue entries.
256
+ * Fixed bug that doubled non-H.264 video source tags.
257
+ * Fixed bug that prevented encoding 1080p and 720p H.264 videos if original video is not H.264 and has the same resolution.
258
+ * Improved iframe-embedded vertical video resizing.
259
+ * Changed iPhone play button to match Video.js button style.
260
+ * Tweaked embed code overlay styles.
261
+ * Set WordPress Default bottom margin to 0.
262
+
263
  = 4.6.7 - May 26, 2016 =
264
  * Updated Video.js to version 5.10.2
265
  * Fixed bug that set Video.js players to the highest resolution no matter what was set as the default.
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.7
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.7',
63
  "embed_method" => "Video.js",
64
  "jw_player_id" => "",
65
  "template" => false,
@@ -119,6 +119,7 @@ function kgvid_default_options_fn() {
119
  "nativecontrolsfortouch" => false,
120
  "controlbar_style" => "docked",
121
  "autoplay" => false,
 
122
  "loop" => false,
123
  "volume" => 1,
124
  "mute" => false,
@@ -177,7 +178,8 @@ function kgvid_default_options_fn() {
177
  "y" => "5"
178
  ),
179
  "simultaneous_encodes" => 1,
180
- "error_email" => "nobody"
 
181
  );
182
 
183
  return $options;
@@ -721,17 +723,27 @@ add_filter('upload_mimes', 'kgvid_add_upload_mimes');
721
  function kgvid_url_to_id($url) {
722
 
723
  global $wpdb;
724
- $post_id = false;
 
725
  $uploads = wp_upload_dir();
 
726
 
727
  $url = str_replace(' ', '', $url); //in case a url with spaces got through
728
  // Get the path or the original size image by slicing the widthxheight off the end and adding the extension back
729
  $search_url = preg_replace( '/-\d+x\d+(\.(?:png|jpg|gif))$/i', '.' . pathinfo($url, PATHINFO_EXTENSION), $url );
 
 
730
 
731
- $post_id = (int)$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value LIKE RIGHT('%s', CHAR_LENGTH(meta_value))", $search_url ) );
 
 
 
 
 
 
 
732
 
733
- if ( $post_id ) { return $post_id; }
734
- else { return false; }
735
 
736
  }
737
 
@@ -1561,7 +1573,7 @@ class kgvid_Process{
1561
  }
1562
  }// class Process
1563
 
1564
- function kgvid_video_embed_enqueue_scripts() {
1565
 
1566
  $options = kgvid_get_options();
1567
 
@@ -1574,8 +1586,12 @@ function kgvid_video_embed_enqueue_scripts() {
1574
  //plugin-related frontend styles, requires dashicons
1575
  wp_enqueue_style( 'kgvid_video_styles', plugins_url("/css/kgvid_styles.css", __FILE__), array( 'dashicons' ), $options['version'] );
1576
 
 
 
 
 
1577
  }
1578
- add_action('wp_enqueue_scripts', 'kgvid_video_embed_enqueue_scripts', 12);
1579
 
1580
  function enqueue_kgvid_script() { //loads plugin-related scripts in the admin area
1581
 
@@ -1931,7 +1947,7 @@ function kgvid_enqueue_shortcode_scripts() {
1931
 
1932
  function kgvid_print_videojs_footer() { //called by the shortcode if Video.js is used
1933
 
1934
- echo '<script type="text/javascript">if(typeof videojs !== "undefined") { videojs.options.flash.swf = "'.plugins_url("", __FILE__).'/video-js/video-js.swf?5.0.1"; }</script>'."\n";
1935
 
1936
  }
1937
 
@@ -2145,7 +2161,7 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
2145
  if ( !empty($query_atts["id"]) ) {
2146
  $id_array[0] = $query_atts["id"];
2147
  }
2148
- elseif ( $post_id != 1 ) {
2149
  $args = array(
2150
  'numberposts' => $query_atts['videos'],
2151
  'post_mime_type' => 'video',
@@ -2184,7 +2200,7 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
2184
  $mp4already = false;
2185
  $dimensions = array();
2186
 
2187
- if ( $query_atts['gallery'] == 'false' && $kgvid_video_id === 0 && $post_id != 1 ) {
2188
  $first_embedded_video['atts'] = $atts;
2189
  $first_embedded_video['content'] = $content;
2190
  $first_embedded_video_meta = get_post_meta($post_id, '_kgvid_first_embedded_video', true);
@@ -2323,6 +2339,7 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
2323
  'countable' => $countable,
2324
  'start' => $query_atts['start'],
2325
  'autoplay' => $query_atts['autoplay'],
 
2326
  'set_volume' => $query_atts['volume'],
2327
  'mute' => $query_atts['mute'],
2328
  'meta' => $kgvid_meta,
@@ -2342,7 +2359,9 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
2342
  $h264_resolutions = array();
2343
 
2344
  foreach ($video_formats as $format => $format_stats) {
2345
- if ( $format != "original" && $encodevideo_info[$format]["url"] == $content ) { unset($sources['original']); }
 
 
2346
  if ( $encodevideo_info[$format]["exists"] ) {
2347
 
2348
  if ( array_key_exists('height', $encodevideo_info[$format]) && $format_stats['type'] == 'h264' ) {
@@ -2413,7 +2432,7 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
2413
  $code .= '<meta itemprop="description" content="'.esc_attr($description).'" />';
2414
 
2415
  if ( !empty($id) ) { $upload_date = get_the_date('c', $id); }
2416
- elseif ( $post_id != 1 ) { $upload_date = get_the_date('c', $post_id); }
2417
  else { $upload_date = current_time('c'); }
2418
  $code .= '<meta itemprop="uploadDate" content="'.esc_attr($upload_date).'" />';
2419
  }
@@ -2687,7 +2706,8 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
2687
  else { $iframeurl = $query_atts['embedcode']; }
2688
  $iframecode = "<iframe allowfullscreen src='".$iframeurl."' frameborder='0' scrolling='no' width='".esc_attr($query_atts['width'])."' height='".esc_attr($query_atts["height"])."'></iframe>";
2689
  $iframecode = apply_filters('kgvid_embedcode', $iframecode, $iframeurl, $id, $query_atts);
2690
- $embed_code .= "<span class='dashicons dashicons-editor-code'></span><span>"._x('Embed:', 'precedes code for embedding video', 'video-embed-thumbnail-generator')." </span><input class='kgvid_embedcode' type='text' value='".esc_attr($iframecode)."' onClick='this.select();'></span> <span class='kgvid_start_time'><input type='checkbox' class='kgvid_start_at_enable' onclick='kgvid_set_start_at(\"".$div_suffix."\")'> ".__('Start at:', 'video-embed-thumbnail-generator')." <input type='text' class='kgvid_start_at' onkeyup='kgvid_change_start_at(\"".$div_suffix."\")'></span>";
 
2691
  } //embed code
2692
 
2693
  if ( $options['twitter_button'] == 'on' || $options['facebook_button'] == 'on' ) {
@@ -2811,6 +2831,7 @@ function kgvid_shortcode_atts($atts) {
2811
  'playbutton' => $options['playbutton'],
2812
  'loop' => $options['loop'],
2813
  'autoplay' => $options['autoplay'],
 
2814
  'streamtype' => $options['stream_type'],
2815
  'scalemode' => $options['scale_mode'],
2816
  'backgroundcolor' => $options['bgcolor'],
@@ -2899,6 +2920,7 @@ function kgvid_shortcode_atts($atts) {
2899
  "playbutton",
2900
  "loop",
2901
  "autoplay",
 
2902
  "title",
2903
  "embedcode",
2904
  "view_count",
@@ -2937,8 +2959,13 @@ function KGVID_shortcode($atts, $content = ''){
2937
 
2938
  kgvid_enqueue_shortcode_scripts();
2939
 
2940
- if ( in_the_loop() ) { $post_id = get_the_ID(); }
2941
- else { $post_id = 1; }
 
 
 
 
 
2942
 
2943
  $query_atts = kgvid_shortcode_atts($atts);
2944
 
@@ -3994,10 +4021,6 @@ function kgvid_video_embed_options_init() {
3994
  add_settings_field('dimensions', __('Max embedded video dimensions:', 'video-embed-thumbnail-generator'), 'kgvid_dimensions_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'width' ) );
3995
  add_settings_field('gallery_options', __('Video gallery:', 'video-embed-thumbnail-generator'), 'kgvid_video_gallery_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'gallery_width' ) );
3996
  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' ) );
3997
- add_settings_field('autoplay', __('Autoplay:', 'video-embed-thumbnail-generator'), 'kgvid_autoplay_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'autoplay' ) );
3998
- add_settings_field('loop', _x('Loop:', 'verb', 'video-embed-thumbnail-generator'), 'kgvid_loop_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'loop' ) );
3999
- add_settings_field('audio', __('Volume:', 'video-embed-thumbnail-generator'), 'kgvid_audio_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'volume' ) );
4000
- add_settings_field('preload', __('Preload:', 'video-embed-thumbnail-generator'), 'kgvid_preload_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'preload' ) );
4001
  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' ) );
4002
  add_settings_field('nativecontrolsfortouch', __('Native controls:', 'video-embed-thumbnail-generator'), 'kgvid_nativecontrolsfortouch_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'nativecontrolsfortouch' ) );
4003
  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' ) );
@@ -4010,8 +4033,9 @@ function kgvid_video_embed_options_init() {
4010
  add_settings_field('autohide', __('Autohide:', 'video-embed-thumbnail-generator'), 'kgvid_autohide_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'autohide' ) );
4011
  add_settings_field('playbutton', __('Play button overlay:', 'video-embed-thumbnail-generator'), 'kgvid_playbutton_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'playbutton' ) );
4012
 
4013
- add_settings_field('generate_thumbs', __('Default number of thumbnails to generate:', 'video-embed-thumbnail-generator'), 'kgvid_generate_thumbs_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'generate_thumbs' ) );
4014
  add_settings_field('security', __('Video sharing:', 'video-embed-thumbnail-generator'), 'kgvid_security_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'right_click' ) );
 
 
4015
  add_settings_field('featured', __('Featured image:', 'video-embed-thumbnail-generator'), 'kgvid_featured_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'featured' ) );
4016
  add_settings_field('thumb_parent', __('Attach thumbnails to:', 'video-embed-thumbnail-generator'), 'kgvid_thumb_parent_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'thumb_parent' ) );
4017
  add_settings_field('user_roles', __('User capabilities:', 'video-embed-thumbnail-generator'), 'kgvid_user_roles_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'user_roles' ) );
@@ -4225,47 +4249,36 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
4225
  $items[__("docked", 'video-embed-thumbnail-generator')] = "docked";
4226
  if ( $options['embed_method'] == "Strobe Media Playback" ) { $items[__("floating", 'video-embed-thumbnail-generator')] = "floating"; }
4227
  $items[__("none", 'video-embed-thumbnail-generator')] = "none";
4228
- echo "<select class='affects_player' id='controlbar_style' name='kgvid_video_embed_options[controlbar_style]'>";
4229
  foreach($items as $name => $value) {
4230
  $selected = ($options['controlbar_style']==$value) ? 'selected="selected"' : '';
4231
  echo "<option value='$value' $selected>$name</option>";
4232
  }
4233
- echo "</select>\n\t";
4234
- }
4235
 
4236
- function kgvid_autoplay_callback() {
4237
- $options = kgvid_get_options();
4238
- echo "<input class='affects_player' ".checked( $options['autoplay'], "on", false )." id='autoplay' name='kgvid_video_embed_options[autoplay]' type='checkbox' /> <label for='autoplay'>".__('Play automatically when page loads.', 'video-embed-thumbnail-generator')."</label>\n\t";
4239
- }
4240
 
4241
- function kgvid_loop_callback() {
4242
- $options = kgvid_get_options();
4243
- 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";
4244
- }
4245
 
4246
- function kgvid_audio_callback() {
4247
- $options = kgvid_get_options();
4248
  $items = array();
4249
  $percent = 0;
4250
  for ( $percent = 0; $percent <= 1.05; $percent = $percent + 0.05 ) {
4251
  $items[sprintf( _x('%d%%', 'a list of percentages. eg: 15%', 'video-embed-thumbnail-generator'), round($percent*100) )] = strval($percent);
4252
  }
4253
- echo "<select class='affects_player' id='volume' name='kgvid_video_embed_options[volume]'>";
4254
  foreach($items as $name=>$value) {
4255
  $selected = ($options['volume']==$value) ? 'selected="selected"' : '';
4256
  echo "<option value='$value' $selected>$name</option>";
4257
  }
4258
- echo "</select> <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";
4259
-
4260
- }
4261
 
4262
- function kgvid_preload_callback() {
4263
- $options = kgvid_get_options();
4264
  $items = array(
4265
  __('metadata', 'video-embed-thumbnail-generator') => "metadata",
4266
  __('auto', 'video-embed-thumbnail-generator') => "auto",
4267
  __('none', 'video-embed-thumbnail-generator') => "none");
4268
- echo "<select class='affects_player' id='preload' name='kgvid_video_embed_options[preload]'>";
4269
  foreach($items as $name=>$value) {
4270
  $selected = ($options['preload']==$value) ? 'selected="selected"' : '';
4271
  echo "<option value='$value' $selected>$name</option>";
@@ -4344,11 +4357,6 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
4344
  echo "<input class='affects_player' ".checked( $options['playbutton'], "on", false )." id='playbutton' name='kgvid_video_embed_options[playbutton]' type='checkbox' /> <label for='playbutton'>".__('Overlay play button on poster frame.', 'video-embed-thumbnail-generator')."</label>\n\t";
4345
  }
4346
 
4347
- function kgvid_generate_thumbs_callback() {
4348
- $options = kgvid_get_options();
4349
- echo "<input class='small-text' id='generate_thumbs' name='kgvid_video_embed_options[generate_thumbs]' maxlength='2' type='text' value='".strval($options['generate_thumbs'])."' />\n\t";
4350
- }
4351
-
4352
  function kgvid_security_callback() {
4353
  $options = kgvid_get_options();
4354
 
@@ -4366,6 +4374,16 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
4366
  echo "<input ".checked( $options['oembed_security'], "on", false )." id='oembed_security' name='kgvid_video_embed_options[oembed_security]' type='checkbox' /> <label for='oembed_security'>"._x('Enable oEmbeds from unknown providers.', '"oEmbed" is a proper noun and might not need translation', 'video-embed-thumbnail-generator')."</label><span class='kgvid_tooltip wp-ui-text-highlight'><span class='kgvid_tooltip_classic'>".__('Allows your own users to embed content from any oEmbed provider. User must have the "unfiltered_html" capability which is limited to Administrators and Editors by default.', 'video-embed-thumbnail-generator')."</span></span><br />\n\t";
4367
  }
4368
 
 
 
 
 
 
 
 
 
 
 
4369
  function kgvid_featured_callback() {
4370
  $options = kgvid_get_options();
4371
  echo "<input ".checked( $options['featured'], "on", false )." id='featured' name='kgvid_video_embed_options[featured]' type='checkbox' /> <label for='featured'>".__('Set generated video thumbnails as featured images.', 'video-embed-thumbnail-generator')."</label> <span class='kgvid_tooltip wp-ui-text-highlight'><span class='kgvid_tooltip_classic'>".__('If your theme uses the featured image meta tag, this will automatically set a video\'s parent post\'s featured image to the most recently saved thumbnail image.', 'video-embed-thumbnail-generator')."</span></span><br /> <a class='button-secondary' href='javascript:void(0);' onclick='kgvid_set_all_featured();'>"._x('Set all as featured', 'implied "Set all thumbnails as featured"', 'video-embed-thumbnail-generator')."</a> <span class='kgvid_tooltip wp-ui-text-highlight'><span class='kgvid_tooltip_classic'>".__('If you\'ve generated thumbnails before enabling this option, this will set all existing thumbnails as featured images. Be careful!', 'video-embed-thumbnail-generator')."</span></span>\n\t";
@@ -5010,6 +5028,12 @@ function kgvid_update_settings() {
5010
  $options['twitter_username'] = kgvid_get_jetpack_twitter_username();
5011
  }
5012
 
 
 
 
 
 
 
5013
  if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
5014
  if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
5015
  }
@@ -5526,7 +5550,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
5526
  if ( $post->post_mime_type != 'image/gif' ) {
5527
  $form_fields["views"]["label"] = __('Video Stats', 'video-embed-thumbnail-generator');
5528
  $form_fields["views"]["input"] = "html";
5529
- $form_fields["views"]["html"] = sprintf( _n('%1$s%2$d%3$s Play', '%1$s%2$d%3$s Plays', intval($kgvid_postmeta['starts']), 'video-embed-thumbnail-generator'), '<strong>', intval($kgvid_postmeta['starts']), '</strong>' ).'<span class="kgvid-reveal-thumb-video" onclick="kgvid_reveal_video_stats('.$post->ID.')" id="show-video-stats-'.$post->ID.'"><br /><a class="kgvid-show-video">'.__('(More...)', 'video-embed-thumbnail-generator').'</a></span><div style="display:none;" id="video-'.$post->ID.'-stats">'.
5530
  intval($kgvid_postmeta['play_25']).' '.__('25%', 'video-embed-thumbnail-generator').
5531
  '<br /><strong>'.intval($kgvid_postmeta['play_50']).'</strong> '.__('50%', 'video-embed-thumbnail-generator').
5532
  '<br /><strong>'.intval($kgvid_postmeta['play_75']).'</strong> '.__('75%', 'video-embed-thumbnail-generator').
@@ -5602,7 +5626,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
5602
  <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>'.
5603
  implode("\n", $sources).'
5604
  </video>
5605
- <div class="kgvid-video-controls">
5606
  <div class="kgvid-play-pause"></div>
5607
  <div class="kgvid-seek-bar">
5608
  <div class="kgvid-play-progress"></div>
@@ -6789,6 +6813,7 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id, $
6789
  $post_type = get_post_type($postID);
6790
  if ( $post_type == "attachment" ) { $filepath = get_attached_file($postID); }
6791
  else { $filepath = $movieurl; }
 
6792
  $movie_info = kgvid_get_video_dimensions($filepath);
6793
 
6794
  if ($movie_info['worked'] == true) { //if FFMPEG was able to open the file
@@ -6811,7 +6836,12 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id, $
6811
  foreach ( $video_formats as $format => $format_stats ) {
6812
  if ( array_key_exists($format, $encode_checked) && $encode_checked[$format] == "true" ) {
6813
  if ( !$encodevideo_info[$format]['exists'] ) {
6814
- if ( ($format == "1080" && $movie_height <= 1080) || ($format == "720" && $movie_height <= 720) ) {
 
 
 
 
 
6815
  $movie_extension = pathinfo($movieurl, PATHINFO_EXTENSION);
6816
  if ( $encode_checked['fullres'] == "true" || in_array($movie_extension, $h264extensions) || $movie_height < intval($format) ) {
6817
  $encode_formats[$format]['status'] = "lowres";
@@ -7725,9 +7755,8 @@ function kgvid_clear_completed_queue($type, $scope = 'site') {
7725
 
7726
  $keep = array();
7727
  $cleared_video_queue = array();
7728
-
7729
  foreach ( $video_encode_queue as $video_key => $queue_entry ) {
7730
- if ( !empty($queue_entry['encode_formats']) ) {
7731
  foreach ( $queue_entry['encode_formats'] as $format => $value ) {
7732
  if ( $value['status'] == "encoding" ) { //if it's not completed yet
7733
  if ( $type != "all" ) { $keep[$video_key] = true; }
@@ -7753,10 +7782,13 @@ function kgvid_clear_completed_queue($type, $scope = 'site') {
7753
  $keep[$video_key] = true;
7754
  }
7755
  }
7756
- if ( ( $scope == 'site' && array_key_exists('blog_id', $queue_entry) && $queue_entry['blog_id'] != get_current_blog_id() )
7757
- || ( !current_user_can('edit_others_video_encodes') && $user_ID != $queue_entry['user_id'] )
7758
- || !current_user_can('encode_videos')
7759
- || ( $scope != 'site' && !current_user_can('manage_network') )
 
 
 
7760
  ) { //only clear entries from current blog
7761
  $keep[$video_key] = true;
7762
  break;
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.8
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.8',
63
  "embed_method" => "Video.js",
64
  "jw_player_id" => "",
65
  "template" => false,
119
  "nativecontrolsfortouch" => false,
120
  "controlbar_style" => "docked",
121
  "autoplay" => false,
122
+ "pauseothervideos" => "on",
123
  "loop" => false,
124
  "volume" => 1,
125
  "mute" => false,
178
  "y" => "5"
179
  ),
180
  "simultaneous_encodes" => 1,
181
+ "error_email" => "nobody",
182
+ "alwaysloadscripts" => false
183
  );
184
 
185
  return $options;
723
  function kgvid_url_to_id($url) {
724
 
725
  global $wpdb;
726
+ $options = kgvid_get_options();
727
+ $post_id = NULL;
728
  $uploads = wp_upload_dir();
729
+ $video_formats = kgvid_video_formats();
730
 
731
  $url = str_replace(' ', '', $url); //in case a url with spaces got through
732
  // Get the path or the original size image by slicing the widthxheight off the end and adding the extension back
733
  $search_url = preg_replace( '/-\d+x\d+(\.(?:png|jpg|gif))$/i', '.' . pathinfo($url, PATHINFO_EXTENSION), $url );
734
+ $search_query = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value LIKE RIGHT('%s', CHAR_LENGTH(meta_value))";
735
+ $post_id = (int)$wpdb->get_var( $wpdb->prepare( $search_query, $search_url ) );
736
 
737
+ if ( !$post_id && $options['ffmpeg_exists'] == "on" && $video_formats['fullres']['extension'] != pathinfo($url, PATHINFO_EXTENSION) ) {
738
+ $search_url = str_replace( pathinfo($url, PATHINFO_EXTENSION), $video_formats['fullres']['extension'], $url );
739
+ $post_id = (int)$wpdb->get_var( $wpdb->prepare( $search_query, $search_url ) );
740
+ if ( $post_id ) { $kgvid_postmeta = kgvid_get_attachment_meta($post_id); }
741
+ if ( !isset($kgvid_postmeta) || !is_array($kgvid_postmeta) || ( is_array($kgvid_postmeta) && !array_key_exists('original_replaced', $kgvid_postmeta) ) ) {
742
+ $post_id = NULL;
743
+ }
744
+ }
745
 
746
+ return $post_id;
 
747
 
748
  }
749
 
1573
  }
1574
  }// class Process
1575
 
1576
+ function kgvid_video_embed_enqueue_styles() {
1577
 
1578
  $options = kgvid_get_options();
1579
 
1586
  //plugin-related frontend styles, requires dashicons
1587
  wp_enqueue_style( 'kgvid_video_styles', plugins_url("/css/kgvid_styles.css", __FILE__), array( 'dashicons' ), $options['version'] );
1588
 
1589
+ if ( $options['alwaysloadscripts'] == 'on' ) {
1590
+ kgvid_enqueue_shortcode_scripts();
1591
+ }
1592
+
1593
  }
1594
+ add_action('wp_enqueue_scripts', 'kgvid_video_embed_enqueue_styles', 12);
1595
 
1596
  function enqueue_kgvid_script() { //loads plugin-related scripts in the admin area
1597
 
1947
 
1948
  function kgvid_print_videojs_footer() { //called by the shortcode if Video.js is used
1949
 
1950
+ echo '<script type="text/javascript">if(typeof videojs !== "undefined") { videojs.options.flash.swf = "'.plugins_url("", __FILE__).'/video-js/video-js.swf?5.0.2"; }</script>'."\n";
1951
 
1952
  }
1953
 
2161
  if ( !empty($query_atts["id"]) ) {
2162
  $id_array[0] = $query_atts["id"];
2163
  }
2164
+ elseif ( $post_id != 0 ) {
2165
  $args = array(
2166
  'numberposts' => $query_atts['videos'],
2167
  'post_mime_type' => 'video',
2200
  $mp4already = false;
2201
  $dimensions = array();
2202
 
2203
+ if ( $query_atts['gallery'] == 'false' && $kgvid_video_id === 0 && $post_id != 0 ) {
2204
  $first_embedded_video['atts'] = $atts;
2205
  $first_embedded_video['content'] = $content;
2206
  $first_embedded_video_meta = get_post_meta($post_id, '_kgvid_first_embedded_video', true);
2339
  'countable' => $countable,
2340
  'start' => $query_atts['start'],
2341
  'autoplay' => $query_atts['autoplay'],
2342
+ 'pauseothervideos' => $query_atts['pauseothervideos'],
2343
  'set_volume' => $query_atts['volume'],
2344
  'mute' => $query_atts['mute'],
2345
  'meta' => $kgvid_meta,
2359
  $h264_resolutions = array();
2360
 
2361
  foreach ($video_formats as $format => $format_stats) {
2362
+ if ( $format != "original" && $encodevideo_info[$format]["url"] == $content ) {
2363
+ continue; //don't double up on non-H.264 video sources
2364
+ }
2365
  if ( $encodevideo_info[$format]["exists"] ) {
2366
 
2367
  if ( array_key_exists('height', $encodevideo_info[$format]) && $format_stats['type'] == 'h264' ) {
2432
  $code .= '<meta itemprop="description" content="'.esc_attr($description).'" />';
2433
 
2434
  if ( !empty($id) ) { $upload_date = get_the_date('c', $id); }
2435
+ elseif ( $post_id != 0 ) { $upload_date = get_the_date('c', $post_id); }
2436
  else { $upload_date = current_time('c'); }
2437
  $code .= '<meta itemprop="uploadDate" content="'.esc_attr($upload_date).'" />';
2438
  }
2706
  else { $iframeurl = $query_atts['embedcode']; }
2707
  $iframecode = "<iframe allowfullscreen src='".$iframeurl."' frameborder='0' scrolling='no' width='".esc_attr($query_atts['width'])."' height='".esc_attr($query_atts["height"])."'></iframe>";
2708
  $iframecode = apply_filters('kgvid_embedcode', $iframecode, $iframeurl, $id, $query_atts);
2709
+ $embed_code .= "<span class='kgvid_embedcode_container'><span class='dashicons dashicons-editor-code'></span>
2710
+ <span>"._x('Embed:', 'precedes code for embedding video', 'video-embed-thumbnail-generator')." </span><span><input class='kgvid_embedcode' type='text' value='".esc_attr($iframecode)."' onClick='this.select();'></span> <span class='kgvid_start_time'><input type='checkbox' class='kgvid_start_at_enable' onclick='kgvid_set_start_at(\"".$div_suffix."\")'> ".__('Start at:', 'video-embed-thumbnail-generator')." <input type='text' class='kgvid_start_at' onkeyup='kgvid_change_start_at(\"".$div_suffix."\")'></span></span>";
2711
  } //embed code
2712
 
2713
  if ( $options['twitter_button'] == 'on' || $options['facebook_button'] == 'on' ) {
2831
  'playbutton' => $options['playbutton'],
2832
  'loop' => $options['loop'],
2833
  'autoplay' => $options['autoplay'],
2834
+ 'pauseothervideos' => $options['pauseothervideos'],
2835
  'streamtype' => $options['stream_type'],
2836
  'scalemode' => $options['scale_mode'],
2837
  'backgroundcolor' => $options['bgcolor'],
2920
  "playbutton",
2921
  "loop",
2922
  "autoplay",
2923
+ "pauseothervideos",
2924
  "title",
2925
  "embedcode",
2926
  "view_count",
2959
 
2960
  kgvid_enqueue_shortcode_scripts();
2961
 
2962
+ if ( in_the_loop() ) {
2963
+ $post_id = get_the_ID();
2964
+ }
2965
+ else {
2966
+ global $wp_query;
2967
+ $post_id = $wp_query->get_queried_object_id();
2968
+ }
2969
 
2970
  $query_atts = kgvid_shortcode_atts($atts);
2971
 
4021
  add_settings_field('dimensions', __('Max embedded video dimensions:', 'video-embed-thumbnail-generator'), 'kgvid_dimensions_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'width' ) );
4022
  add_settings_field('gallery_options', __('Video gallery:', 'video-embed-thumbnail-generator'), 'kgvid_video_gallery_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'gallery_width' ) );
4023
  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' ) );
 
 
 
 
4024
  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' ) );
4025
  add_settings_field('nativecontrolsfortouch', __('Native controls:', 'video-embed-thumbnail-generator'), 'kgvid_nativecontrolsfortouch_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'nativecontrolsfortouch' ) );
4026
  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' ) );
4033
  add_settings_field('autohide', __('Autohide:', 'video-embed-thumbnail-generator'), 'kgvid_autohide_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'autohide' ) );
4034
  add_settings_field('playbutton', __('Play button overlay:', 'video-embed-thumbnail-generator'), 'kgvid_playbutton_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'playbutton' ) );
4035
 
 
4036
  add_settings_field('security', __('Video sharing:', 'video-embed-thumbnail-generator'), 'kgvid_security_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'right_click' ) );
4037
+ add_settings_field('scriptloading', __("Script loading:", 'video-embed-thumbnail-generator'), 'kgvid_scriptloading_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'alwaysloadscripts' ) );
4038
+ add_settings_field('generate_thumbs', __('Default number of thumbnails to generate:', 'video-embed-thumbnail-generator'), 'kgvid_generate_thumbs_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'generate_thumbs' ) );
4039
  add_settings_field('featured', __('Featured image:', 'video-embed-thumbnail-generator'), 'kgvid_featured_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'featured' ) );
4040
  add_settings_field('thumb_parent', __('Attach thumbnails to:', 'video-embed-thumbnail-generator'), 'kgvid_thumb_parent_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'thumb_parent' ) );
4041
  add_settings_field('user_roles', __('User capabilities:', 'video-embed-thumbnail-generator'), 'kgvid_user_roles_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'user_roles' ) );
4249
  $items[__("docked", 'video-embed-thumbnail-generator')] = "docked";
4250
  if ( $options['embed_method'] == "Strobe Media Playback" ) { $items[__("floating", 'video-embed-thumbnail-generator')] = "floating"; }
4251
  $items[__("none", 'video-embed-thumbnail-generator')] = "none";
4252
+ echo __('Display controls:', 'video-embed-thumbnail-generator')." <select class='affects_player' id='controlbar_style' name='kgvid_video_embed_options[controlbar_style]'>";
4253
  foreach($items as $name => $value) {
4254
  $selected = ($options['controlbar_style']==$value) ? 'selected="selected"' : '';
4255
  echo "<option value='$value' $selected>$name</option>";
4256
  }
4257
+ echo "</select><br />\n\t";
 
4258
 
4259
+ echo "<input class='affects_player' ".checked( $options['autoplay'], "on", false )." id='autoplay' name='kgvid_video_embed_options[autoplay]' type='checkbox' /> <label for='autoplay'>".__('Play automatically when page loads.', 'video-embed-thumbnail-generator')."</label><br />\n\t";
 
 
 
4260
 
4261
+ echo "<input ".checked( $options['pauseothervideos'], "on", false )." id='pauseothervideos' name='kgvid_video_embed_options[pauseothervideos]' type='checkbox' /> <label for='pauseothervideos'>".__('Pause other videos on page when starting a new video.', 'video-embed-thumbnail-generator')."</label><br />\n\t";
4262
+
4263
+ 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><br />\n\t";
 
4264
 
 
 
4265
  $items = array();
4266
  $percent = 0;
4267
  for ( $percent = 0; $percent <= 1.05; $percent = $percent + 0.05 ) {
4268
  $items[sprintf( _x('%d%%', 'a list of percentages. eg: 15%', 'video-embed-thumbnail-generator'), round($percent*100) )] = strval($percent);
4269
  }
4270
+ echo __('Volume:', 'video-embed-thumbnail-generator')." <select class='affects_player' id='volume' name='kgvid_video_embed_options[volume]'>";
4271
  foreach($items as $name=>$value) {
4272
  $selected = ($options['volume']==$value) ? 'selected="selected"' : '';
4273
  echo "<option value='$value' $selected>$name</option>";
4274
  }
4275
+ echo "</select> <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><br />\n\t";
 
 
4276
 
 
 
4277
  $items = array(
4278
  __('metadata', 'video-embed-thumbnail-generator') => "metadata",
4279
  __('auto', 'video-embed-thumbnail-generator') => "auto",
4280
  __('none', 'video-embed-thumbnail-generator') => "none");
4281
+ echo __('Preload:', 'video-embed-thumbnail-generator')." <select class='affects_player' id='preload' name='kgvid_video_embed_options[preload]'>";
4282
  foreach($items as $name=>$value) {
4283
  $selected = ($options['preload']==$value) ? 'selected="selected"' : '';
4284
  echo "<option value='$value' $selected>$name</option>";
4357
  echo "<input class='affects_player' ".checked( $options['playbutton'], "on", false )." id='playbutton' name='kgvid_video_embed_options[playbutton]' type='checkbox' /> <label for='playbutton'>".__('Overlay play button on poster frame.', 'video-embed-thumbnail-generator')."</label>\n\t";
4358
  }
4359
 
 
 
 
 
 
4360
  function kgvid_security_callback() {
4361
  $options = kgvid_get_options();
4362
 
4374
  echo "<input ".checked( $options['oembed_security'], "on", false )." id='oembed_security' name='kgvid_video_embed_options[oembed_security]' type='checkbox' /> <label for='oembed_security'>"._x('Enable oEmbeds from unknown providers.', '"oEmbed" is a proper noun and might not need translation', 'video-embed-thumbnail-generator')."</label><span class='kgvid_tooltip wp-ui-text-highlight'><span class='kgvid_tooltip_classic'>".__('Allows your own users to embed content from any oEmbed provider. User must have the "unfiltered_html" capability which is limited to Administrators and Editors by default.', 'video-embed-thumbnail-generator')."</span></span><br />\n\t";
4375
  }
4376
 
4377
+ function kgvid_scriptloading_callback() {
4378
+ $options = kgvid_get_options();
4379
+ echo "<input ".checked( $options['alwaysloadscripts'], "on", false )." id='alwaysloadscripts' name='kgvid_video_embed_options[alwaysloadscripts]' type='checkbox' /> <label for='alwaysloadscripts'>".__('Always load plugin-related JavaScripts.', 'video-embed-thumbnail-generator')."</label> <span class='kgvid_tooltip wp-ui-text-highlight'><span class='kgvid_tooltip_classic'>".__("Usually the plugin's JavaScripts are only loaded if a video is present on the page. AJAX page loading can cause errors because the JavaScripts aren't loaded with the video content. Enabling this option will make sure the JavaScripts are always loaded.", 'video-embed-thumbnail-generator')."</span></span><br />";
4380
+ }
4381
+
4382
+ function kgvid_generate_thumbs_callback() {
4383
+ $options = kgvid_get_options();
4384
+ echo "<input class='small-text' id='generate_thumbs' name='kgvid_video_embed_options[generate_thumbs]' maxlength='2' type='text' value='".strval($options['generate_thumbs'])."' />\n\t";
4385
+ }
4386
+
4387
  function kgvid_featured_callback() {
4388
  $options = kgvid_get_options();
4389
  echo "<input ".checked( $options['featured'], "on", false )." id='featured' name='kgvid_video_embed_options[featured]' type='checkbox' /> <label for='featured'>".__('Set generated video thumbnails as featured images.', 'video-embed-thumbnail-generator')."</label> <span class='kgvid_tooltip wp-ui-text-highlight'><span class='kgvid_tooltip_classic'>".__('If your theme uses the featured image meta tag, this will automatically set a video\'s parent post\'s featured image to the most recently saved thumbnail image.', 'video-embed-thumbnail-generator')."</span></span><br /> <a class='button-secondary' href='javascript:void(0);' onclick='kgvid_set_all_featured();'>"._x('Set all as featured', 'implied "Set all thumbnails as featured"', 'video-embed-thumbnail-generator')."</a> <span class='kgvid_tooltip wp-ui-text-highlight'><span class='kgvid_tooltip_classic'>".__('If you\'ve generated thumbnails before enabling this option, this will set all existing thumbnails as featured images. Be careful!', 'video-embed-thumbnail-generator')."</span></span>\n\t";
5028
  $options['twitter_username'] = kgvid_get_jetpack_twitter_username();
5029
  }
5030
 
5031
+ if ( version_compare( $options['version'], '4.6.8', '<' ) ) {
5032
+ if ( $options['embed_method'] == "WordPress Default" ) { $options['pauseothervideos'] = "on"; }
5033
+ else { $options['pauseothervideos'] = false; }
5034
+ $options['alwaysloadscripts'] = false;
5035
+ }
5036
+
5037
  if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
5038
  if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
5039
  }
5550
  if ( $post->post_mime_type != 'image/gif' ) {
5551
  $form_fields["views"]["label"] = __('Video Stats', 'video-embed-thumbnail-generator');
5552
  $form_fields["views"]["input"] = "html";
5553
+ $form_fields["views"]["html"] = sprintf( _n('%1$s%2$d%3$s Play', '%1$s%2$d%3$s Plays', intval($kgvid_postmeta['starts']), 'video-embed-thumbnail-generator'), '<strong>', intval($kgvid_postmeta['starts']), '</strong>' ).'<span class="kgvid-reveal-thumb-video" onclick="kgvid_reveal_video_stats('.$post->ID.')" id="show-video-stats-'.$post->ID.'"><br /><a class="kgvid-show-video">('.__('More...', 'video-embed-thumbnail-generator').')</a></span><div style="display:none;" id="video-'.$post->ID.'-stats">'.
5554
  intval($kgvid_postmeta['play_25']).' '.__('25%', 'video-embed-thumbnail-generator').
5555
  '<br /><strong>'.intval($kgvid_postmeta['play_50']).'</strong> '.__('50%', 'video-embed-thumbnail-generator').
5556
  '<br /><strong>'.intval($kgvid_postmeta['play_75']).'</strong> '.__('75%', 'video-embed-thumbnail-generator').
5626
  <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>'.
5627
  implode("\n", $sources).'
5628
  </video>
5629
+ <div class="kgvid-video-controls" tabindex="0">
5630
  <div class="kgvid-play-pause"></div>
5631
  <div class="kgvid-seek-bar">
5632
  <div class="kgvid-play-progress"></div>
6813
  $post_type = get_post_type($postID);
6814
  if ( $post_type == "attachment" ) { $filepath = get_attached_file($postID); }
6815
  else { $filepath = $movieurl; }
6816
+ $mime_type_check = wp_check_filetype($filepath);
6817
  $movie_info = kgvid_get_video_dimensions($filepath);
6818
 
6819
  if ($movie_info['worked'] == true) { //if FFMPEG was able to open the file
6836
  foreach ( $video_formats as $format => $format_stats ) {
6837
  if ( array_key_exists($format, $encode_checked) && $encode_checked[$format] == "true" ) {
6838
  if ( !$encodevideo_info[$format]['exists'] ) {
6839
+ if ( ($format == "1080" || $format == "720") &&
6840
+ (
6841
+ ( strpos($mime_type_check['type'], "mp4") !== false && $movie_height <= $format_stats['height'] ) ||
6842
+ ( strpos($mime_type_check['type'], "mp4") === false && $movie_height < $format_stats['height'] )
6843
+ )
6844
+ ) {
6845
  $movie_extension = pathinfo($movieurl, PATHINFO_EXTENSION);
6846
  if ( $encode_checked['fullres'] == "true" || in_array($movie_extension, $h264extensions) || $movie_height < intval($format) ) {
6847
  $encode_formats[$format]['status'] = "lowres";
7755
 
7756
  $keep = array();
7757
  $cleared_video_queue = array();
 
7758
  foreach ( $video_encode_queue as $video_key => $queue_entry ) {
7759
+ if ( array_key_exists('encode_formats', $queue_entry) && !empty($queue_entry['encode_formats']) ) {
7760
  foreach ( $queue_entry['encode_formats'] as $format => $value ) {
7761
  if ( $value['status'] == "encoding" ) { //if it's not completed yet
7762
  if ( $type != "all" ) { $keep[$video_key] = true; }
7782
  $keep[$video_key] = true;
7783
  }
7784
  }
7785
+ if ( $type != "scheduled" &&
7786
+ (
7787
+ ( $scope == 'site' && array_key_exists('blog_id', $queue_entry) && $queue_entry['blog_id'] != get_current_blog_id() )
7788
+ || ( !current_user_can('edit_others_video_encodes') && $user_ID != $queue_entry['user_id'] )
7789
+ || !current_user_can('encode_videos')
7790
+ || ( $scope != 'site' && !current_user_can('manage_network') )
7791
+ )
7792
  ) { //only clear entries from current blog
7793
  $keep[$video_key] = true;
7794
  break;
video-js/video-quality-selector.js CHANGED
@@ -140,7 +140,7 @@ videojs.ResolutionSelector.prototype.createItems = function() {
140
  el : videojs.getComponent( 'Component' ).prototype.createEl( 'li', {
141
 
142
  className : 'vjs-menu-title vjs-res-menu-title',
143
- innerHTML : player.localize( 'Quality' )
144
  })
145
  }));
146
 
@@ -306,6 +306,7 @@ videojs.plugin( 'resolutionSelector', function( options ) {
306
 
307
  var video_el = player.el().firstChild,
308
  is_paused = player.paused(),
 
309
  current_time = player.currentTime(),
310
  button_nodes,
311
  button_node_count;
@@ -318,6 +319,8 @@ videojs.plugin( 'resolutionSelector', function( options ) {
318
  // Make sure the loadedmetadata event will fire
319
  if ( 'none' == video_el.preload ) { video_el.preload = 'metadata'; }
320
 
 
 
321
  if ( current_time != 0 ) {
322
 
323
  player.pause();
@@ -350,6 +353,9 @@ videojs.plugin( 'resolutionSelector', function( options ) {
350
  player.addClass( 'vjs-has-started' );
351
 
352
  if ( ! is_paused ) { player.play(); }
 
 
 
353
  }
354
 
355
  })
140
  el : videojs.getComponent( 'Component' ).prototype.createEl( 'li', {
141
 
142
  className : 'vjs-menu-title vjs-res-menu-title',
143
+ innerHTML : kgvidL10n_frontend.quality
144
  })
145
  }));
146
 
306
 
307
  var video_el = player.el().firstChild,
308
  is_paused = player.paused(),
309
+ is_autoplay = player.autoplay(),
310
  current_time = player.currentTime(),
311
  button_nodes,
312
  button_node_count;
319
  // Make sure the loadedmetadata event will fire
320
  if ( 'none' == video_el.preload ) { video_el.preload = 'metadata'; }
321
 
322
+ if ( is_autoplay ) { player.autoplay(false); }
323
+
324
  if ( current_time != 0 ) {
325
 
326
  player.pause();
353
  player.addClass( 'vjs-has-started' );
354
 
355
  if ( ! is_paused ) { player.play(); }
356
+
357
+ if ( is_autoplay ) { player.autoplay(true); }
358
+
359
  }
360
 
361
  })