Version Description
- May 28, 2019 =
- Fixed bug that broke pop-up galleries when video title had a space in the name.
- Fixed bug that re-shuffled random gallery order every time a new gallery page was loaded.
- Fixed bug that disabled auto resolution switching when using the WordPress Default video player.
- Removed the built-in WordPress Default video player size limit for better responsive sizing.
- Reduced CPU load when responsive video resizing is enabled.
- Now selectively enqueuing Video.js resolution selector JavaScript file.
- Re-ordered resolution list so when original resolution is unknown, "Full" is at the top, enabled translation of the "Full" menu item and now automatically renaming it when video metadata is loaded.
- Better activation procedure that doesn't generate errors and disables FFMPEG functions if FFMPEG is not found.
- No longer turning on all video encode formats by default.
- Fixed bug that couldn't automatically discover alternate formats of videos on other servers via https.
- Fixed bug that broke tab switching on the settings page when other plugins modified the admin page.
- Code changes to allow for future child formats that aren't videos.
Download this release
Release Info
Developer | kylegilman |
Plugin | Video Embed & Thumbnail Generator |
Version | 4.6.25 |
Comparing to | |
See all releases |
Code changes from version 4.6.24 to 4.6.25
- css/kgvid_styles.css +4 -0
- js/kgvid_video_embed.js +36 -21
- js/kgvid_video_plugin_admin.js +13 -34
- js/mejs-source-chooser.js +105 -61
- readme.txt +17 -2
- video-embed-thumbnail-generator.php +189 -75
- video-js/video-quality-selector.js +28 -13
css/kgvid_styles.css
CHANGED
@@ -475,6 +475,10 @@ span.kgvid_gallery_pagination_arrow {
|
|
475 |
display: none;
|
476 |
}
|
477 |
|
|
|
|
|
|
|
|
|
478 |
.vjs-res-button:before {
|
479 |
font-family: VideoJs;
|
480 |
content: "\f110"; /* Gear icon */
|
475 |
display: none;
|
476 |
}
|
477 |
|
478 |
+
.vjs-res-button .vjs-menu li.vjs-menu-item {
|
479 |
+
text-transform: none;
|
480 |
+
}
|
481 |
+
|
482 |
.vjs-res-button:before {
|
483 |
font-family: VideoJs;
|
484 |
content: "\f110"; /* Gear icon */
|
js/kgvid_video_embed.js
CHANGED
@@ -1,16 +1,5 @@
|
|
1 |
-
jQuery('.kgvid_videodiv').each(function(){ //setup individual videos. WordPress Default has its own success callback
|
2 |
-
|
3 |
-
var video_vars = jQuery(this).data('kgvid_video_vars');
|
4 |
-
|
5 |
-
if ( video_vars.player_type == "Video.js" ) {
|
6 |
-
|
7 |
-
kgvid_load_videojs(video_vars);
|
8 |
-
|
9 |
-
}
|
10 |
-
});
|
11 |
-
|
12 |
jQuery(document).ready(kgvid_document_ready());
|
13 |
-
jQuery(window).load
|
14 |
|
15 |
function kgvid_document_ready() {
|
16 |
|
@@ -18,6 +7,12 @@ function kgvid_document_ready() {
|
|
18 |
|
19 |
var video_vars = jQuery(this).data('kgvid_video_vars');
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
if ( video_vars.player_type == "JWPlayer" ) {
|
22 |
var player_id = jQuery('#video_'+video_vars.id+'_div').children('div[id^="jwplayer"]').attr('id');
|
23 |
player_id = player_id.replace('_wrapper', ''); //Flash JW Players have wrapper in the id
|
@@ -316,7 +311,7 @@ function kgvid_load_videojs(video_vars) {
|
|
316 |
else {
|
317 |
videojs_options.fluid = false;
|
318 |
}
|
319 |
-
if ( video_vars.width != undefined && video_vars.width.indexOf('%') === -1 && video_vars.height != undefined ) {
|
320 |
videojs_options.aspectRatio = video_vars.width + ':' + video_vars.height;
|
321 |
}
|
322 |
if ( video_vars.nativecontrolsfortouch == "true" ) {
|
@@ -326,6 +321,8 @@ function kgvid_load_videojs(video_vars) {
|
|
326 |
videojs_options.playbackRates = [0.5, 1, 1.25, 1.5, 2];
|
327 |
}
|
328 |
if ( video_vars.enable_resolutions_plugin == "true" ) {
|
|
|
|
|
329 |
|
330 |
if ( videojs.VERSION.split('.')[0] >= 5 ) {
|
331 |
|
@@ -436,7 +433,10 @@ function kgvid_setup_video(id) {
|
|
436 |
|
437 |
if ( video_vars.pauseothervideos == "true" && videojs.VERSION.split('.')[0] >= 5 ) {
|
438 |
jQuery.each(videojs.getPlayers(), function(otherPlayerId, otherPlayer) {
|
439 |
-
if ( player.id() != otherPlayerId
|
|
|
|
|
|
|
440 |
otherPlayer.pause();
|
441 |
}
|
442 |
});
|
@@ -541,6 +541,7 @@ function kgvid_setup_video(id) {
|
|
541 |
var mejs_id = jQuery('#video_'+id+'_div .mejs-container').attr('id');
|
542 |
var played = jQuery('#video_'+id+'_div').data("played") || "not played";
|
543 |
|
|
|
544 |
jQuery('#video_'+id+'_div .mejs-container').append(jQuery('#video_'+id+'_watermark'));
|
545 |
|
546 |
if ( played == "not played" ) { //only turn on the default captions on first load
|
@@ -562,7 +563,6 @@ function kgvid_setup_video(id) {
|
|
562 |
|
563 |
player.on('loadedmetadata', function() {
|
564 |
|
565 |
-
var resolutions = player.availableRes;
|
566 |
var played = jQuery('#video_'+id+'_div').data("played") || "not played";
|
567 |
|
568 |
if ( video_vars.set_volume != "" ) { player[0].volume = video_vars.set_volume; }
|
@@ -719,9 +719,16 @@ function kgvid_setup_video(id) {
|
|
719 |
|
720 |
}
|
721 |
|
722 |
-
if ( video_vars.resize == "true"
|
|
|
|
|
|
|
723 |
kgvid_resize_video(id);
|
724 |
-
|
|
|
|
|
|
|
|
|
725 |
}
|
726 |
|
727 |
if ( typeof jQuery.modal !== "undefined" && jQuery('#kgvid-simplemodal-container').length > 0 ) { jQuery.modal.setPosition(); }
|
@@ -780,7 +787,7 @@ function kgvid_resize_video(id) {
|
|
780 |
|
781 |
var player = eval('videojs.players.video_'+id);
|
782 |
if ( change_aspect ) { player.aspectRatio(Math.floor(set_width)+':'+Math.floor(set_height)); }
|
783 |
-
|
784 |
if ( set_width < 500 ) {
|
785 |
var scale = Math.round(100*set_width/500)/100;
|
786 |
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+')');
|
@@ -828,6 +835,7 @@ function kgvid_resize_video(id) {
|
|
828 |
}
|
829 |
});
|
830 |
var current_resolution = parseInt(player.getCurrentRes());
|
|
|
831 |
if ( !isNaN(current_resolution) ) {
|
832 |
if ( video_vars.pixel_ratio == "true" && window.devicePixelRatio != undefined ) {
|
833 |
var pixel_ratio = window.devicePixelRatio;
|
@@ -863,9 +871,16 @@ function kgvid_resize_video(id) {
|
|
863 |
if ( video_vars.player_type == "WordPressDefault" ) {
|
864 |
|
865 |
if ( player.media.paused ) {
|
866 |
-
|
867 |
-
player.
|
868 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
869 |
}
|
870 |
else {
|
871 |
player.changeRes(set_res+'p');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(document).ready(kgvid_document_ready());
|
2 |
+
jQuery(window).on("load", kgvid_window_load);
|
3 |
|
4 |
function kgvid_document_ready() {
|
5 |
|
7 |
|
8 |
var video_vars = jQuery(this).data('kgvid_video_vars');
|
9 |
|
10 |
+
if ( video_vars.player_type == "Video.js" ) {
|
11 |
+
|
12 |
+
kgvid_load_videojs(video_vars);
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
if ( video_vars.player_type == "JWPlayer" ) {
|
17 |
var player_id = jQuery('#video_'+video_vars.id+'_div').children('div[id^="jwplayer"]').attr('id');
|
18 |
player_id = player_id.replace('_wrapper', ''); //Flash JW Players have wrapper in the id
|
311 |
else {
|
312 |
videojs_options.fluid = false;
|
313 |
}
|
314 |
+
if ( videojs_options.fluid == true && video_vars.width != undefined && video_vars.width.indexOf('%') === -1 && video_vars.height != undefined ) {
|
315 |
videojs_options.aspectRatio = video_vars.width + ':' + video_vars.height;
|
316 |
}
|
317 |
if ( video_vars.nativecontrolsfortouch == "true" ) {
|
321 |
videojs_options.playbackRates = [0.5, 1, 1.25, 1.5, 2];
|
322 |
}
|
323 |
if ( video_vars.enable_resolutions_plugin == "true" ) {
|
324 |
+
|
325 |
+
kgvid_load_video_quality_selector(); //defined in video-quality-selector.js
|
326 |
|
327 |
if ( videojs.VERSION.split('.')[0] >= 5 ) {
|
328 |
|
433 |
|
434 |
if ( video_vars.pauseothervideos == "true" && videojs.VERSION.split('.')[0] >= 5 ) {
|
435 |
jQuery.each(videojs.getPlayers(), function(otherPlayerId, otherPlayer) {
|
436 |
+
if ( player.id() != otherPlayerId
|
437 |
+
&& otherPlayer != null
|
438 |
+
&& !otherPlayer.paused()
|
439 |
+
&& !otherPlayer.autoplay() ) {
|
440 |
otherPlayer.pause();
|
441 |
}
|
442 |
});
|
541 |
var mejs_id = jQuery('#video_'+id+'_div .mejs-container').attr('id');
|
542 |
var played = jQuery('#video_'+id+'_div').data("played") || "not played";
|
543 |
|
544 |
+
jQuery('.wp-video').removeAttr('style');
|
545 |
jQuery('#video_'+id+'_div .mejs-container').append(jQuery('#video_'+id+'_watermark'));
|
546 |
|
547 |
if ( played == "not played" ) { //only turn on the default captions on first load
|
563 |
|
564 |
player.on('loadedmetadata', function() {
|
565 |
|
|
|
566 |
var played = jQuery('#video_'+id+'_div').data("played") || "not played";
|
567 |
|
568 |
if ( video_vars.set_volume != "" ) { player[0].volume = video_vars.set_volume; }
|
719 |
|
720 |
}
|
721 |
|
722 |
+
if ( video_vars.resize == "true"
|
723 |
+
|| video_vars.auto_res == "automatic"
|
724 |
+
|| window.location.search.indexOf("kgvid_video_embed[enable]=true") !== -1
|
725 |
+
) {
|
726 |
kgvid_resize_video(id);
|
727 |
+
var resizeId;
|
728 |
+
jQuery(window).resize( function(){
|
729 |
+
clearTimeout(resizeId);
|
730 |
+
resizeId = setTimeout(function(){kgvid_resize_video(id)}, 500);
|
731 |
+
} );
|
732 |
}
|
733 |
|
734 |
if ( typeof jQuery.modal !== "undefined" && jQuery('#kgvid-simplemodal-container').length > 0 ) { jQuery.modal.setPosition(); }
|
787 |
|
788 |
var player = eval('videojs.players.video_'+id);
|
789 |
if ( change_aspect ) { player.aspectRatio(Math.floor(set_width)+':'+Math.floor(set_height)); }
|
790 |
+
|
791 |
if ( set_width < 500 ) {
|
792 |
var scale = Math.round(100*set_width/500)/100;
|
793 |
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+')');
|
835 |
}
|
836 |
});
|
837 |
var current_resolution = parseInt(player.getCurrentRes());
|
838 |
+
|
839 |
if ( !isNaN(current_resolution) ) {
|
840 |
if ( video_vars.pixel_ratio == "true" && window.devicePixelRatio != undefined ) {
|
841 |
var pixel_ratio = window.devicePixelRatio;
|
871 |
if ( video_vars.player_type == "WordPressDefault" ) {
|
872 |
|
873 |
if ( player.media.paused ) {
|
874 |
+
if ( player.media.preload == 'none' ) {
|
875 |
+
jQuery(player.media).one('canplay', function() {
|
876 |
+
player.changeRes(set_res+'p');
|
877 |
+
});
|
878 |
+
}
|
879 |
+
else {
|
880 |
+
jQuery(player.media).one('play', function() {
|
881 |
+
player.changeRes(set_res+'p');
|
882 |
+
});
|
883 |
+
}
|
884 |
}
|
885 |
else {
|
886 |
player.changeRes(set_res+'p');
|
js/kgvid_video_plugin_admin.js
CHANGED
@@ -1406,17 +1406,12 @@ function kgvid_switch_settings_tab(tab) {
|
|
1406 |
jQuery("#general_tab").removeClass("nav-tab-active");
|
1407 |
jQuery("#encoding_tab").addClass("nav-tab-active");
|
1408 |
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
else { // before WP version 4.4
|
1414 |
-
jQuery('h3:eq(0), h3:eq(2)').hide();
|
1415 |
-
jQuery('h3:eq(3)').show();
|
1416 |
-
}
|
1417 |
-
jQuery('table:eq(0), table:eq(1), table:eq(2), table:eq(3)').hide();
|
1418 |
jQuery(".kgvid_setting_nearvid").hide();
|
1419 |
-
jQuery('
|
1420 |
|
1421 |
if ( jQuery('#app_path').data('ffmpeg_exists') == "on" && jQuery('#ffmpeg_output').html() == "" ) {
|
1422 |
jQuery('#ffmpeg_output').html('Running test...');
|
@@ -1445,18 +1440,14 @@ function kgvid_switch_settings_tab(tab) {
|
|
1445 |
|
1446 |
jQuery("#general_tab").addClass("nav-tab-active");
|
1447 |
jQuery("#encoding_tab").removeClass("nav-tab-active");
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
jQuery('h3:eq(0), h3:eq(2)').show();
|
1454 |
-
jQuery('h3:eq(3)').hide();
|
1455 |
-
}
|
1456 |
-
jQuery('table:eq(0), table:eq(1), table:eq(3)').show();
|
1457 |
jQuery(".kgvid_setting_nearvid").show();
|
1458 |
|
1459 |
-
jQuery('
|
1460 |
|
1461 |
}
|
1462 |
|
@@ -1473,25 +1464,13 @@ function kgvid_hide_plugin_settings() {
|
|
1473 |
var encoding_tab = jQuery('#encoding_tab').hasClass('nav-tab-active');
|
1474 |
|
1475 |
if ( playback_option != "Strobe Media Playback" || encoding_tab ) {
|
1476 |
-
jQuery('
|
1477 |
-
if ( jQuery('h3').length < 1 ) { // WP version 4.4 or later
|
1478 |
-
jQuery('h2:eq(2)').hide();
|
1479 |
-
}
|
1480 |
-
else { // before WP version 4.4
|
1481 |
-
jQuery('h3:eq(1)').hide();
|
1482 |
-
}
|
1483 |
}
|
1484 |
|
1485 |
if ( general_tab ) {
|
1486 |
|
1487 |
if ( playback_option == "Strobe Media Playback" ) {
|
1488 |
-
jQuery('
|
1489 |
-
if ( jQuery('h3').length < 1 ) { // WP version 4.4 or later
|
1490 |
-
jQuery('h2:eq(2)').show();
|
1491 |
-
}
|
1492 |
-
else {
|
1493 |
-
jQuery('h3:eq(1)').show();
|
1494 |
-
}
|
1495 |
}
|
1496 |
|
1497 |
if ( playback_option == "WordPress Default" || playback_option == "JW Player" ) {
|
1406 |
jQuery("#general_tab").removeClass("nav-tab-active");
|
1407 |
jQuery("#encoding_tab").addClass("nav-tab-active");
|
1408 |
|
1409 |
+
jQuery('#header_kgvid_video_embed_playback_settings, #header_kgvid_video_embed_plugin_settings').hide();
|
1410 |
+
jQuery('#header_kgvid_video_embed_encode_settings').show();
|
1411 |
+
|
1412 |
+
jQuery('#table_kgvid_video_embed_embed_method, #table_kgvid_video_embed_playback_settings, #table_kgvid_video_embed_flash_settings, #table_kgvid_video_embed_plugin_settings').hide();
|
|
|
|
|
|
|
|
|
|
|
1413 |
jQuery(".kgvid_setting_nearvid").hide();
|
1414 |
+
jQuery('#table_kgvid_video_embed_encode_settings').show();
|
1415 |
|
1416 |
if ( jQuery('#app_path').data('ffmpeg_exists') == "on" && jQuery('#ffmpeg_output').html() == "" ) {
|
1417 |
jQuery('#ffmpeg_output').html('Running test...');
|
1440 |
|
1441 |
jQuery("#general_tab").addClass("nav-tab-active");
|
1442 |
jQuery("#encoding_tab").removeClass("nav-tab-active");
|
1443 |
+
|
1444 |
+
jQuery('#header_kgvid_video_embed_playback_settings, #header_kgvid_video_embed_plugin_settings').show();
|
1445 |
+
jQuery('#header_kgvid_video_embed_encode_settings').hide();
|
1446 |
+
|
1447 |
+
jQuery('#table_kgvid_video_embed_embed_method, #table_kgvid_video_embed_playback_settings, #table_kgvid_video_embed_flash_settings, #table_kgvid_video_embed_plugin_settings').show();
|
|
|
|
|
|
|
|
|
1448 |
jQuery(".kgvid_setting_nearvid").show();
|
1449 |
|
1450 |
+
jQuery('#table_kgvid_video_embed_encode_settings').hide();
|
1451 |
|
1452 |
}
|
1453 |
|
1464 |
var encoding_tab = jQuery('#encoding_tab').hasClass('nav-tab-active');
|
1465 |
|
1466 |
if ( playback_option != "Strobe Media Playback" || encoding_tab ) {
|
1467 |
+
jQuery('#header_kgvid_video_embed_flash_settings, #table_kgvid_video_embed_flash_settings').hide();
|
|
|
|
|
|
|
|
|
|
|
|
|
1468 |
}
|
1469 |
|
1470 |
if ( general_tab ) {
|
1471 |
|
1472 |
if ( playback_option == "Strobe Media Playback" ) {
|
1473 |
+
jQuery('#header_kgvid_video_embed_flash_settings, #table_kgvid_video_embed_flash_settings').show();
|
|
|
|
|
|
|
|
|
|
|
|
|
1474 |
}
|
1475 |
|
1476 |
if ( playback_option == "WordPress Default" || playback_option == "JW Player" ) {
|
js/mejs-source-chooser.js
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
'use strict';
|
13 |
|
14 |
Object.assign(mejs.MepDefaults, {
|
15 |
-
sourcechooserText:
|
16 |
});
|
17 |
|
18 |
Object.assign(MediaElementPlayer.prototype, {
|
@@ -45,10 +45,22 @@ Object.assign(MediaElementPlayer.prototype, {
|
|
45 |
|
46 |
t.addControlElement(player.sourcechooserButton, 'sourcechooser');
|
47 |
|
|
|
|
|
48 |
for (var _i = 0, _total = sources.length; _i < _total; _i++) {
|
49 |
var src = sources[_i];
|
50 |
if (src.type !== undefined && typeof media.canPlayType === 'function') {
|
51 |
player.addSourceButton(src.src, src.dataset.res, src.type, media.src === src.src);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
53 |
}
|
54 |
|
@@ -105,65 +117,10 @@ Object.assign(MediaElementPlayer.prototype, {
|
|
105 |
for (var _i2 = 0, _total2 = selectorLIs.length; _i2 < _total2; _i2++) {
|
106 |
selectorLIs[_i2].addEventListener('click', function () {
|
107 |
var radio = this.querySelectorAll('input[type=radio]')[0];
|
108 |
-
radio.
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
var otherRadios = this.closest('.' + t.options.classPrefix + 'sourcechooser-selector').querySelectorAll('input[type=radio]');
|
113 |
-
|
114 |
-
for (var j = 0, radioTotal = otherRadios.length; j < radioTotal; j++) {
|
115 |
-
if (otherRadios[j] !== radio) {
|
116 |
-
otherRadios[j].setAttribute('aria-selected', 'false');
|
117 |
-
otherRadios[j].removeAttribute('checked');
|
118 |
-
otherRadios[j].parentElement.className = '';
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
var src = radio.value;
|
123 |
-
|
124 |
-
if (media.getSrc() !== src) {
|
125 |
-
var currentTime = media.currentTime;
|
126 |
-
|
127 |
-
var paused = media.paused,
|
128 |
-
canPlayAfterSourceSwitchHandler = function canPlayAfterSourceSwitchHandler() {
|
129 |
-
if (!paused) {
|
130 |
-
media.setCurrentTime(currentTime);
|
131 |
-
media.play();
|
132 |
-
}
|
133 |
-
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler);
|
134 |
-
};
|
135 |
-
|
136 |
-
media.pause();
|
137 |
-
|
138 |
-
if ( currentTime != 0 ) {
|
139 |
-
var video = jQuery(media).children('video')[0];
|
140 |
-
var canvas = document.createElement("canvas");
|
141 |
-
canvas.className = 'kgvid_temp_thumb';
|
142 |
-
canvas.width = ( video.videoWidth > video.videoHeight ) ? video.offsetWidth : video.videoWidth/video.videoHeight*video.offsetHeight;
|
143 |
-
canvas.height = ( video.videoWidth > video.videoHeight ) ? video.videoHeight/video.videoWidth*video.offsetWidth : video.offsetHeight;
|
144 |
-
var topOffset = Math.round((video.offsetHeight - canvas.height)/2);
|
145 |
-
if (topOffset > 2) {
|
146 |
-
canvas.setAttribute('style', 'top:' + topOffset + 'px;');
|
147 |
-
}
|
148 |
-
var leftOffset = Math.round((video.offsetWidth - canvas.width)/2);
|
149 |
-
if (leftOffset > 2) {
|
150 |
-
canvas.setAttribute('style', 'left:' + leftOffset + 'px;');
|
151 |
-
}
|
152 |
-
var context = canvas.getContext('2d');
|
153 |
-
context.fillRect(0, 0, canvas.width, canvas.height);
|
154 |
-
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
155 |
-
jQuery('#'+media.id).parents('.mejs-mediaelement').append(canvas);
|
156 |
-
|
157 |
-
jQuery(media).one( 'seeked', function() {
|
158 |
-
jQuery(canvas).remove();
|
159 |
-
});
|
160 |
-
}
|
161 |
-
|
162 |
-
media.setSrc(src);
|
163 |
-
media.load();
|
164 |
-
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler);
|
165 |
-
|
166 |
-
}
|
167 |
});
|
168 |
}
|
169 |
|
@@ -183,7 +140,7 @@ Object.assign(MediaElementPlayer.prototype, {
|
|
183 |
}
|
184 |
type = type.split('/')[1];
|
185 |
|
186 |
-
t.sourcechooserButton.querySelector('ul').innerHTML += '<li' + (isCurrent ? ' class="sourcechooser-selected"' : '') + '>' + ('<input type="radio" name="' + t.id + '_sourcechooser" id="' + t.id + '_sourcechooser_' + label +
|
187 |
|
188 |
},
|
189 |
hideSourcechooserSelector: function hideSourcechooserSelector() {
|
@@ -221,6 +178,93 @@ Object.assign(MediaElementPlayer.prototype, {
|
|
221 |
for (var i = 0, total = radios.length; i < total; i++) {
|
222 |
radios[i].setAttribute('tabindex', '0');
|
223 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
}
|
225 |
});
|
226 |
|
12 |
'use strict';
|
13 |
|
14 |
Object.assign(mejs.MepDefaults, {
|
15 |
+
sourcechooserText: kgvidL10n_frontend.quality
|
16 |
});
|
17 |
|
18 |
Object.assign(MediaElementPlayer.prototype, {
|
45 |
|
46 |
t.addControlElement(player.sourcechooserButton, 'sourcechooser');
|
47 |
|
48 |
+
player.availableRes = new Object();
|
49 |
+
|
50 |
for (var _i = 0, _total = sources.length; _i < _total; _i++) {
|
51 |
var src = sources[_i];
|
52 |
if (src.type !== undefined && typeof media.canPlayType === 'function') {
|
53 |
player.addSourceButton(src.src, src.dataset.res, src.type, media.src === src.src);
|
54 |
+
player.availableRes[src.dataset.res] = src.src;
|
55 |
+
|
56 |
+
if ( src.dataset.res == kgvidL10n_frontend.fullres ) {
|
57 |
+
media.addEventListener('loadedmetadata', function(){
|
58 |
+
if ( player.media.originalNode.videoHeight != NaN ) {
|
59 |
+
jQuery('.mejs-sourcechooser-button label:contains('+kgvidL10n_frontend.fullres+')').html(media.originalNode.videoHeight+'p');
|
60 |
+
}
|
61 |
+
});
|
62 |
+
}
|
63 |
+
|
64 |
}
|
65 |
}
|
66 |
|
117 |
for (var _i2 = 0, _total2 = selectorLIs.length; _i2 < _total2; _i2++) {
|
118 |
selectorLIs[_i2].addEventListener('click', function () {
|
119 |
var radio = this.querySelectorAll('input[type=radio]')[0];
|
120 |
+
var target_res = radio.value;
|
121 |
+
if (t.getCurrentRes() !== target_res) {
|
122 |
+
t.changeRes(target_res);
|
123 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
});
|
125 |
}
|
126 |
|
140 |
}
|
141 |
type = type.split('/')[1];
|
142 |
|
143 |
+
t.sourcechooserButton.querySelector('ul').innerHTML += '<li' + (isCurrent ? ' class="sourcechooser-selected"' : '') + '>' + ('<input type="radio" name="' + t.id + '_sourcechooser" id="' + t.id + '_sourcechooser_' + label + '" ') + ('role="menuitemradio" value="' + label + '" ' + (isCurrent ? 'checked="checked"' : '') + ' aria-selected="' + isCurrent + '"/>') + ('<label for="' + t.id + '_sourcechooser_' + label + '" aria-hidden="true">' + label + '</label>') + '</li>';
|
144 |
|
145 |
},
|
146 |
hideSourcechooserSelector: function hideSourcechooserSelector() {
|
178 |
for (var i = 0, total = radios.length; i < total; i++) {
|
179 |
radios[i].setAttribute('tabindex', '0');
|
180 |
}
|
181 |
+
},
|
182 |
+
getCurrentRes() {
|
183 |
+
|
184 |
+
if ( typeof this.currentRes !== 'undefined' ) {
|
185 |
+
|
186 |
+
return this.currentRes;
|
187 |
+
|
188 |
+
} else {
|
189 |
+
|
190 |
+
try {
|
191 |
+
|
192 |
+
return this.node.children[0].dataset.res;
|
193 |
+
|
194 |
+
} catch(e) {
|
195 |
+
|
196 |
+
return '';
|
197 |
+
}
|
198 |
+
}
|
199 |
+
},
|
200 |
+
changeRes(target_res) {
|
201 |
+
|
202 |
+
var currentRes = this.getCurrentRes();
|
203 |
+
|
204 |
+
if ( currentRes == target_res
|
205 |
+
|| ! this.availableRes
|
206 |
+
|| ! this.availableRes[target_res] ) { return; }
|
207 |
+
|
208 |
+
var media = this.media;
|
209 |
+
var src = this.availableRes[target_res];
|
210 |
+
var currentTime = media.currentTime;
|
211 |
+
var paused = media.paused;
|
212 |
+
|
213 |
+
var radio = document.querySelectorAll('#' + this.id + '_sourcechooser_' + target_res)[0];
|
214 |
+
radio.setAttribute('aria-selected', true);
|
215 |
+
radio.checked = true;
|
216 |
+
radio.parentElement.className = 'sourcechooser-selected';
|
217 |
+
|
218 |
+
var otherRadios = radio.parentElement.closest('.' + this.options.classPrefix + 'sourcechooser-selector').querySelectorAll('input[type=radio]');
|
219 |
+
|
220 |
+
for (var j = 0, radioTotal = otherRadios.length; j < radioTotal; j++) {
|
221 |
+
if (otherRadios[j] !== radio) {
|
222 |
+
otherRadios[j].setAttribute('aria-selected', 'false');
|
223 |
+
otherRadios[j].removeAttribute('checked');
|
224 |
+
otherRadios[j].parentElement.className = '';
|
225 |
+
}
|
226 |
+
}
|
227 |
+
|
228 |
+
var canPlayAfterSourceSwitchHandler = function(e) {
|
229 |
+
media.setCurrentTime(currentTime);
|
230 |
+
if (!paused) {
|
231 |
+
media.play();
|
232 |
+
}
|
233 |
+
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler);
|
234 |
+
}
|
235 |
+
;
|
236 |
+
|
237 |
+
media.pause();
|
238 |
+
|
239 |
+
if ( currentTime != 0 ) {
|
240 |
+
var video = jQuery(media).children('video')[0];
|
241 |
+
var canvas = document.createElement("canvas");
|
242 |
+
canvas.className = 'kgvid_temp_thumb';
|
243 |
+
canvas.width = ( video.videoWidth > video.videoHeight ) ? video.offsetWidth : video.videoWidth/video.videoHeight*video.offsetHeight;
|
244 |
+
canvas.height = ( video.videoWidth > video.videoHeight ) ? video.videoHeight/video.videoWidth*video.offsetWidth : video.offsetHeight;
|
245 |
+
var topOffset = Math.round((video.offsetHeight - canvas.height)/2);
|
246 |
+
if (topOffset > 2) {
|
247 |
+
canvas.setAttribute('style', 'top:' + topOffset + 'px;');
|
248 |
+
}
|
249 |
+
var leftOffset = Math.round((video.offsetWidth - canvas.width)/2);
|
250 |
+
if (leftOffset > 2) {
|
251 |
+
canvas.setAttribute('style', 'left:' + leftOffset + 'px;');
|
252 |
+
}
|
253 |
+
var context = canvas.getContext('2d');
|
254 |
+
context.fillRect(0, 0, canvas.width, canvas.height);
|
255 |
+
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
256 |
+
jQuery('#'+media.id).parents('.mejs-mediaelement').append(canvas);
|
257 |
+
|
258 |
+
jQuery(media).one( 'seeked', function() {
|
259 |
+
jQuery(canvas).remove();
|
260 |
+
});
|
261 |
+
}
|
262 |
+
|
263 |
+
media.setSrc(src);
|
264 |
+
media.load();
|
265 |
+
this.currentRes = target_res;
|
266 |
+
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler);
|
267 |
+
|
268 |
}
|
269 |
});
|
270 |
|
readme.txt
CHANGED
@@ -3,8 +3,9 @@ Contributors: kylegilman
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation
|
4 |
Tags: video, video player, video gallery, video thumbnail, ffmpeg, resolution
|
5 |
Requires at least: 4.4
|
6 |
-
Tested up to: 5.
|
7 |
-
|
|
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -248,6 +249,20 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
|
|
248 |
|
249 |
== Changelog ==
|
250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
= 4.6.24 - April 1, 2019 =
|
252 |
* Improved method for assigning Google Analytics Event labels.
|
253 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation
|
4 |
Tags: video, video player, video gallery, video thumbnail, ffmpeg, resolution
|
5 |
Requires at least: 4.4
|
6 |
+
Tested up to: 5.2
|
7 |
+
Requires PHP: 5.6.0
|
8 |
+
Stable tag: 4.6.25
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
249 |
|
250 |
== Changelog ==
|
251 |
|
252 |
+
= 4.6.25 - May 28, 2019 =
|
253 |
+
* Fixed bug that broke pop-up galleries when video title had a space in the name.
|
254 |
+
* Fixed bug that re-shuffled random gallery order every time a new gallery page was loaded.
|
255 |
+
* Fixed bug that disabled auto resolution switching when using the WordPress Default video player.
|
256 |
+
* Removed the built-in WordPress Default video player size limit for better responsive sizing.
|
257 |
+
* Reduced CPU load when responsive video resizing is enabled.
|
258 |
+
* Now selectively enqueuing Video.js resolution selector JavaScript file.
|
259 |
+
* Re-ordered resolution list so when original resolution is unknown, "Full" is at the top, enabled translation of the "Full" menu item and now automatically renaming it when video metadata is loaded.
|
260 |
+
* Better activation procedure that doesn't generate errors and disables FFMPEG functions if FFMPEG is not found.
|
261 |
+
* No longer turning on all video encode formats by default.
|
262 |
+
* Fixed bug that couldn't automatically discover alternate formats of videos on other servers via https.
|
263 |
+
* Fixed bug that broke tab switching on the settings page when other plugins modified the admin page.
|
264 |
+
* Code changes to allow for future child formats that aren't videos.
|
265 |
+
|
266 |
= 4.6.24 - April 1, 2019 =
|
267 |
* Improved method for assigning Google Analytics Event labels.
|
268 |
|
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 |
Author: Kyle Gilman
|
8 |
Author URI: http://www.kylegilman.net/
|
9 |
Text Domain: video-embed-thumbnail-generator
|
@@ -60,7 +60,7 @@ function kgvid_default_options_fn() {
|
|
60 |
$edit_others_capable = kgvid_check_if_capable('edit_others_posts');
|
61 |
|
62 |
$options = array(
|
63 |
-
"version" => '4.6.
|
64 |
"embed_method" => "Video.js",
|
65 |
"jw_player_id" => "",
|
66 |
"template" => false,
|
@@ -192,10 +192,9 @@ function kgvid_default_options_fn() {
|
|
192 |
|
193 |
$video_formats = kgvid_video_formats();
|
194 |
foreach ($video_formats as $format => $format_stats ) {
|
195 |
-
if (array_key_exists('default_encode', $format_stats)) {
|
196 |
$options['encode'][$format] = $format_stats['default_encode'];
|
197 |
}
|
198 |
-
else { $options['encode'][$format] = false; }
|
199 |
}
|
200 |
|
201 |
return $options;
|
@@ -409,7 +408,7 @@ function kgvid_video_formats( $return_replace = false, $return_customs = true, $
|
|
409 |
$video_formats = array(
|
410 |
"fullres" => array(
|
411 |
"name" => __("same resolution H.264", 'video-embed-thumbnail-generator'),
|
412 |
-
"label" =>
|
413 |
"width" => INF,
|
414 |
"height" => INF,
|
415 |
"type" => "h264",
|
@@ -568,18 +567,22 @@ function kgvid_video_formats( $return_replace = false, $return_customs = true, $
|
|
568 |
unset($video_formats['custom_'.$options['custom_format']['format']]);
|
569 |
}
|
570 |
|
571 |
-
$
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
|
|
|
|
581 |
|
582 |
-
|
|
|
|
|
583 |
|
584 |
return apply_filters('kgvid_video_formats', $video_formats, $return_replace, $return_customs, $return_dontembeds);
|
585 |
|
@@ -598,7 +601,7 @@ function kgvid_register_default_options_fn() { //add default values for options
|
|
598 |
$options['ffmpeg_exists'] = 'on';
|
599 |
$options['app_path'] = $ffmpeg_check['app_path'];
|
600 |
}
|
601 |
-
else { $options['ffmpeg_exists'] =
|
602 |
|
603 |
update_option('kgvid_video_embed_options', $options);
|
604 |
|
@@ -885,8 +888,19 @@ function kgvid_is_video($post) {
|
|
885 |
}
|
886 |
|
887 |
function kgvid_url_exists($url) {
|
888 |
-
|
889 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
890 |
}
|
891 |
|
892 |
function kgvid_url_mime_type($url, $post_id = false) {
|
@@ -1245,8 +1259,7 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
1245 |
$args = array(
|
1246 |
'numberposts' => '-1',
|
1247 |
'post_parent' => $postID,
|
1248 |
-
'post_type' => 'attachment'
|
1249 |
-
'post_mime_type' => 'video'
|
1250 |
);
|
1251 |
}
|
1252 |
elseif ($moviefile == '' || !is_file($moviefile) ) {
|
@@ -1271,8 +1284,7 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
1271 |
'numberposts' => '-1',
|
1272 |
'post_type' => 'attachment',
|
1273 |
'meta_key' => '_kgflashmediaplayer-externalurl',
|
1274 |
-
'meta_value' => $sanitized_url['movieurl']
|
1275 |
-
'post_mime_type' => 'video'
|
1276 |
);
|
1277 |
|
1278 |
}
|
@@ -1384,7 +1396,7 @@ function kgvid_get_video_dimensions($video = false) {
|
|
1384 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
1385 |
$movie_info = array();
|
1386 |
|
1387 |
-
if ( strpos($video, 'http
|
1388 |
$video_id = kgvid_url_to_id($video);
|
1389 |
if ( $video_id ) {
|
1390 |
$video_path = get_attached_file($video_id);
|
@@ -1396,6 +1408,7 @@ function kgvid_get_video_dimensions($video = false) {
|
|
1396 |
}
|
1397 |
}
|
1398 |
}
|
|
|
1399 |
$old_locale = kgvid_set_locale($video); //fixes UTF-8 encoding problems
|
1400 |
$command = escapeshellcmd($ffmpegPath . ' -i "' . $video . '"');
|
1401 |
$command = $command.' 2>&1';
|
@@ -1413,6 +1426,7 @@ function kgvid_get_video_dimensions($video = false) {
|
|
1413 |
$movie_info['worked'] = true;
|
1414 |
$movie_info['width'] = $regs [1] ? $regs [1] : null;
|
1415 |
$movie_info['height'] = $regs [2] ? $regs [2] : null;
|
|
|
1416 |
preg_match('/Duration: (.*?),/', $output, $matches);
|
1417 |
$duration = $matches[1];
|
1418 |
$movie_duration_hours = intval(substr($duration, -11, 2));
|
@@ -1434,15 +1448,20 @@ function kgvid_get_video_dimensions($video = false) {
|
|
1434 |
$old_locale = kgvid_set_locale($video); //fixes UTF-8 encoding problems
|
1435 |
$command = escapeshellcmd($ffmpegPath . ' -i "' . $video . '" -codecs');
|
1436 |
$command = $command.' 2>&1';
|
1437 |
-
exec ( $command, $
|
1438 |
$restore_locale = setlocale(LC_CTYPE, $old_locale);
|
1439 |
-
$
|
1440 |
-
$
|
1441 |
-
$
|
|
|
|
|
|
|
|
|
|
|
1442 |
$aac_array = kgvid_aac_encoders();
|
1443 |
$lib_list = array_merge($video_lib_array, $aac_array);
|
1444 |
foreach ($lib_list as $lib) {
|
1445 |
-
if ( strpos($
|
1446 |
else { $movie_info['configuration'][$lib] = "false"; }
|
1447 |
}
|
1448 |
|
@@ -1451,7 +1470,7 @@ function kgvid_get_video_dimensions($video = false) {
|
|
1451 |
$movie_info['worked'] = false;
|
1452 |
}
|
1453 |
|
1454 |
-
return apply_filters('kgvid_get_video_dimensions', $movie_info, $video);
|
1455 |
}
|
1456 |
|
1457 |
function kgvid_generate_flashvars($content, $query_atts, $encodevideo_info, $id) {
|
@@ -1641,10 +1660,9 @@ function kgvid_generate_encode_string($input, $output, $movie_info, $format, $wi
|
|
1641 |
$options = kgvid_get_options();
|
1642 |
$libraries = $movie_info['configuration'];
|
1643 |
$encode_string = strtoupper($options['video_app'])." not found";
|
|
|
1644 |
|
1645 |
-
if ( $options['ffmpeg_exists'] == "on" ) {
|
1646 |
-
|
1647 |
-
$video_formats = kgvid_video_formats();
|
1648 |
|
1649 |
if ( $options['video_app'] == "avconv" || $options['video_bitrate_flag'] != "on" ) {
|
1650 |
$video_bitrate_flag = "b:v";
|
@@ -1672,8 +1690,15 @@ function kgvid_generate_encode_string($input, $output, $movie_info, $format, $wi
|
|
1672 |
$options['vp9_CRF'] = round((-0.000002554 * $width * $height) + 35); //formula to generate close to Google-recommended CRFs https://developers.google.com/media/vp9/settings/vod/
|
1673 |
}
|
1674 |
$crf_flag = "crf";
|
1675 |
-
if ( $video_formats[$format]['type'] == 'ogv' ) {
|
1676 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1677 |
}
|
1678 |
else {
|
1679 |
if ( $video_formats[$format]['type'] == 'vp9' ) {
|
@@ -1749,12 +1774,14 @@ function kgvid_generate_encode_string($input, $output, $movie_info, $format, $wi
|
|
1749 |
$encode_string[2] = $watermark_strings['filter'];
|
1750 |
$encode_string[3] = ' "'.$output.'"';
|
1751 |
|
1752 |
-
$
|
1753 |
-
update_option('kgvid_video_embed_options', $options);
|
1754 |
|
1755 |
} //if FFMPEG is found
|
1756 |
|
1757 |
-
|
|
|
|
|
|
|
1758 |
|
1759 |
}
|
1760 |
|
@@ -1817,10 +1844,37 @@ function kgvid_video_embed_enqueue_styles() {
|
|
1817 |
|
1818 |
$options = kgvid_get_options();
|
1819 |
|
|
|
|
|
|
|
|
|
1820 |
//Video.js styles
|
1821 |
if ( $options['embed_method'] == "Video.js" || $options['embed_method'] == "Strobe Media Playback" ) {
|
1822 |
wp_enqueue_style( 'video-js', plugins_url("", __FILE__).'/video-js/video-js.css', '', '5.20.5' );
|
1823 |
if ( $options['js_skin'] == 'kg-video-js-skin' ){ wp_enqueue_style( 'video-js-kg-skin', plugins_url("", __FILE__).'/video-js/kg-video-js-skin.css', '', $options['version'] ); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1824 |
}
|
1825 |
|
1826 |
//plugin-related frontend styles, requires dashicons
|
@@ -1829,7 +1883,7 @@ function kgvid_video_embed_enqueue_styles() {
|
|
1829 |
if ( $options['alwaysloadscripts'] == 'on' ) {
|
1830 |
kgvid_enqueue_shortcode_scripts();
|
1831 |
wp_enqueue_script( 'simplemodal', plugins_url("/js/jquery.simplemodal.1.4.5.min.js", __FILE__), '', '1.4.5', true );
|
1832 |
-
}
|
1833 |
|
1834 |
}
|
1835 |
add_action('wp_enqueue_scripts', 'kgvid_video_embed_enqueue_styles', 12);
|
@@ -2161,9 +2215,14 @@ function kgvid_enqueue_shortcode_scripts() {
|
|
2161 |
$options = kgvid_get_options();
|
2162 |
|
2163 |
if ( $options['embed_method'] == "Video.js" || $options['embed_method'] == "Strobe Media Playback" ) {
|
2164 |
-
|
2165 |
-
wp_enqueue_script( 'video-js'
|
2166 |
add_action('wp_footer', 'kgvid_print_videojs_footer', 99);
|
|
|
|
|
|
|
|
|
|
|
2167 |
}
|
2168 |
|
2169 |
if ( $options['embed_method'] == "Strobe Media Playback" ) {
|
@@ -2172,7 +2231,7 @@ function kgvid_enqueue_shortcode_scripts() {
|
|
2172 |
|
2173 |
if ( !wp_script_is('kgvid_video_embed', 'enqueued') ) {
|
2174 |
|
2175 |
-
wp_enqueue_script( 'kgvid_video_embed'
|
2176 |
|
2177 |
wp_localize_script( 'kgvid_video_embed', 'kgvidL10n_frontend', array(
|
2178 |
'ajaxurl' => admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ),
|
@@ -2181,7 +2240,8 @@ function kgvid_enqueue_shortcode_scripts() {
|
|
2181 |
'completeview' => _x("Complete View", 'noun for Google Analytics event', 'video-embed-thumbnail-generator'),
|
2182 |
'next' => _x("Next", 'button text to play next video', 'video-embed-thumbnail-generator'),
|
2183 |
'previous' => _x("Previous", 'button text to play previous video', 'video-embed-thumbnail-generator'),
|
2184 |
-
'quality' => _x("Quality", 'text above list of video resolutions', 'video-embed-thumbnail-generator')
|
|
|
2185 |
) );
|
2186 |
|
2187 |
}
|
@@ -2303,8 +2363,7 @@ function kgvid_gallery_page($page_number, $query_atts, $last_video_id = 0) {
|
|
2303 |
else { $post_id = 1; }
|
2304 |
$content = '';
|
2305 |
$popup_code = kgvid_single_video_code($popup_atts, $atts, $content, $post_id);
|
2306 |
-
|
2307 |
-
preg_match('/data-kgvid_video_vars=.*? /', $popup_code, $video_vars);
|
2308 |
$popup_code = str_replace(array("\r", "\n", "\t", $video_vars[0]), "", $popup_code);
|
2309 |
|
2310 |
if ( $options['js_skin'] == "" ) { $options['js_skin'] = "vjs-default-skin"; }
|
@@ -2312,7 +2371,7 @@ function kgvid_gallery_page($page_number, $query_atts, $last_video_id = 0) {
|
|
2312 |
$options['js_skin'] = $query_atts['skin']; //allows user to set skin for individual videos using the skin="" attribute
|
2313 |
}
|
2314 |
|
2315 |
-
$code .= '<div class="kgvid_video_gallery_thumb" onclick="kgvid_SetVideo(\'kgvid_'.strval($kgvid_video_id-1).'\')" id="kgvid_video_gallery_thumb_kgvid_'.strval($kgvid_video_id-1).'" data-id="kgvid_'.strval($kgvid_video_id-1).'" data-width="'.esc_attr($dimensions['width']).'" data-height="'.esc_attr($dimensions['height']).'" data-meta="'.esc_attr($below_video).'" data-gallery_end="'.esc_attr($query_atts['gallery_end']).'" data-popupcode="'.
|
2316 |
|
2317 |
if ( $query_atts['gallery_thumb_aspect'] == "true" ) {
|
2318 |
$code .= ' height:'.round($options["height"]/$options["width"]*$query_atts["gallery_thumb"]).'px;';
|
@@ -2557,7 +2616,7 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2557 |
}
|
2558 |
|
2559 |
unset($video_formats['fullres']);
|
2560 |
-
$video_formats = array('original' => array( "type" => $format_type, "mime" => $mime_type, "name" => "Full", "label" => "Full" ) ) + $video_formats;
|
2561 |
|
2562 |
if ( in_array($mime_type_check['ext'], $compatible) ) {
|
2563 |
|
@@ -2674,7 +2733,11 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2674 |
}
|
2675 |
else { $source_key = $x; }
|
2676 |
|
2677 |
-
|
|
|
|
|
|
|
|
|
2678 |
if ( $format == 'vp9' ) { $sources[$source_key] .= ' codecs="vp9, vorbis"'; }
|
2679 |
if ( $format_stats['type'] == 'h264' ) {
|
2680 |
$sources[$source_key] .= ' data-res="'.$format_stats['label'].'"';
|
@@ -2697,6 +2760,10 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2697 |
|
2698 |
if ( $enable_resolutions_plugin ) {
|
2699 |
$video_variables['enable_resolutions_plugin'] = "true";
|
|
|
|
|
|
|
|
|
2700 |
if ( $query_atts["auto_res"] == "highest" ) { $video_variables['default_res'] = end($h264_resolutions); }
|
2701 |
if ( $query_atts["auto_res"] == "lowest" ) { $video_variables['default_res'] = reset($h264_resolutions); }
|
2702 |
elseif ( in_array($query_atts["auto_res"], $h264_resolutions) ) { $video_variables['default_res'] = $query_atts["auto_res"]; }
|
@@ -2857,13 +2924,7 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2857 |
);
|
2858 |
|
2859 |
if ( $enable_resolutions_plugin && !wp_script_is('mejs_sourcechooser', 'enqueued') ) {
|
2860 |
-
|
2861 |
-
$sourcechooser_path = plugins_url( 'js/mejs-source-chooser.js', __FILE__ );
|
2862 |
-
}
|
2863 |
-
else {
|
2864 |
-
$sourcechooser_path = plugins_url( 'js/mep-feature-sourcechooser.js', __FILE__ );
|
2865 |
-
}
|
2866 |
-
wp_enqueue_script( 'mejs_sourcechooser', $sourcechooser_path, array( 'mediaelement' ), $options['version'], true );
|
2867 |
array_push($wpmejssettings['features'], 'sourcechooser');
|
2868 |
$localize = true;
|
2869 |
}
|
@@ -2875,13 +2936,7 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2875 |
if ( $query_atts['playback_rate'] == 'true' ) {
|
2876 |
array_push($wpmejssettings['features'], 'speed');
|
2877 |
$wpmejssettings['speeds'] = array('0.5', '1', '1.25', '1.5', '2');
|
2878 |
-
|
2879 |
-
$speed_path = plugins_url( 'js/mejs-speed.js', __FILE__ );
|
2880 |
-
}
|
2881 |
-
else {
|
2882 |
-
$speed_path = plugins_url( 'js/mep-speed.js', __FILE__ );;
|
2883 |
-
}
|
2884 |
-
wp_enqueue_script( 'mejs-speed', $speed_path, array( 'mediaelement' ), $options['version'], true );
|
2885 |
}
|
2886 |
|
2887 |
array_push($wpmejssettings['features'], 'fullscreen');
|
@@ -2894,7 +2949,6 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2894 |
if ( function_exists('wp_video_shortcode') ) { $executed_shortcode = wp_video_shortcode($attr); }
|
2895 |
else { $executed_shortcode = 'WordPress video shortcode function does not exist.'; }
|
2896 |
$content_width = $content_width_save;
|
2897 |
-
|
2898 |
if ( $enable_resolutions_plugin ) {
|
2899 |
$executed_shortcode = preg_replace( '/<source .*<a /', implode(' />', $sources).' /><a ', $executed_shortcode );
|
2900 |
}
|
@@ -3348,8 +3402,7 @@ function KGVID_shortcode($atts, $content = '') {
|
|
3348 |
if ( !is_feed() ) {
|
3349 |
|
3350 |
$options = kgvid_get_options();
|
3351 |
-
|
3352 |
-
kgvid_enqueue_shortcode_scripts();
|
3353 |
|
3354 |
if ( in_the_loop() ) {
|
3355 |
$post_id = get_the_ID();
|
@@ -3386,7 +3439,11 @@ function KGVID_shortcode($atts, $content = '') {
|
|
3386 |
$gallery_query_atts = array();
|
3387 |
foreach($gallery_query_index as $index) { $gallery_query_atts[$index] = $query_atts[$index]; };
|
3388 |
|
3389 |
-
|
|
|
|
|
|
|
|
|
3390 |
|
3391 |
if ( $query_atts['align'] == "left" ) { $aligncode = ' kgvid_textalign_left'; }
|
3392 |
if ( $query_atts['align'] == "center" ) { $aligncode = ' kgvid_textalign_center'; }
|
@@ -3401,6 +3458,8 @@ function KGVID_shortcode($atts, $content = '') {
|
|
3401 |
|
3402 |
} //if gallery
|
3403 |
|
|
|
|
|
3404 |
} //if not feed
|
3405 |
|
3406 |
return apply_filters('KGVID_shortcode', $code, $query_atts, $content);
|
@@ -4306,7 +4365,7 @@ function kgvid_settings_page() {
|
|
4306 |
<form method="post" action="options.php">
|
4307 |
<?php settings_fields('kgvid_video_embed_options'); ?>
|
4308 |
<input type="hidden" id="kgvid_settings_security" value="<?php echo wp_create_nonce('video-embed-thumbnail-generator-nonce'); ?>">
|
4309 |
-
<?php
|
4310 |
<p class='submit'>
|
4311 |
<?php submit_button(__('Save Changes', 'video-embed-thumbnail-generator'), 'primary', 'kgvid_submit', false, array( 'onclick' => "jQuery('form :disabled').prop('disabled', false);" ) ); ?>
|
4312 |
<?php submit_button(__('Reset Options', 'video-embed-thumbnail-generator'), 'secondary', 'video-embed-thumbnail-generator-reset', false); ?>
|
@@ -4405,6 +4464,31 @@ function kgvid_video_embed_options_init() {
|
|
4405 |
}//end copying site queues to network
|
4406 |
}//end network activation setup
|
4407 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4408 |
register_setting('kgvid_video_embed_options', 'kgvid_video_embed_options', 'kgvid_video_embed_options_validate' );
|
4409 |
|
4410 |
$options = kgvid_get_options();
|
@@ -4522,7 +4606,7 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
4522 |
|
4523 |
$players = apply_filters('kgvid_available_video_players', $players);
|
4524 |
|
4525 |
-
echo "<table class='form-table'><tbody><tr valign='middle'><th scope='row'><label for='embed_method'>".__('Video player:', 'video-embed-thumbnail-generator')."</label></th><td><select class='affects_player' onchange='kgvid_hide_plugin_settings();' id='embed_method' name='kgvid_video_embed_options[embed_method]'>";
|
4526 |
foreach($players as $name => $value) {
|
4527 |
$selected = ($options['embed_method']==$value) ? 'selected="selected"' : '';
|
4528 |
echo "<option value='$value' $selected>$name</option>";
|
@@ -4958,7 +5042,7 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
4958 |
$items['custom'] = __('Custom', 'video-embed-thumbnail-generator');
|
4959 |
|
4960 |
echo "<div class='kgvid_video_app_required'>";
|
4961 |
-
echo "<input ".checked( array_key_exists('fullres', $options['encode']), true, false )." id='encode_fullres' name='kgvid_video_embed_options[encode][fullres]' type='checkbox' /> <label for='encode_fullres'>".__('Replace original with', 'video-embed-thumbnail-generator');
|
4962 |
|
4963 |
echo " <select id='replace_format' name='kgvid_video_embed_options[replace_format]' class='affects_ffmpeg' onchange='kgvid_change_replace_format();'>";
|
4964 |
foreach($items as $value=>$name) {
|
@@ -4977,7 +5061,7 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
4977 |
}
|
4978 |
|
4979 |
foreach ( $video_formats as $format => $format_stats ) {
|
4980 |
-
echo "<input ".checked( array_key_exists($format, $options['encode']), true, false )." id='encode_".$format."' name='kgvid_video_embed_options[encode][".$format."]' type='checkbox' /> <label for='encode_".$format."'>".$format_stats['name']."</label><br />";
|
4981 |
}
|
4982 |
|
4983 |
echo "<input ".checked( array_key_exists('custom', $options['encode']), true, false )." id='encode_custom' name='kgvid_video_embed_options[encode][custom]' type='checkbox' /> <label for='encode_custom'>".__('Custom', 'video-embed-thumbnail-generator');
|
@@ -5280,8 +5364,14 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
5280 |
$options = kgvid_get_options();
|
5281 |
$video_formats = kgvid_video_formats(false, false);
|
5282 |
$encode_string = "";
|
|
|
5283 |
if ( $options['ffmpeg_exists'] == "on" ) {
|
5284 |
|
|
|
|
|
|
|
|
|
|
|
5285 |
$movie_info = kgvid_get_video_dimensions(plugin_dir_path(__FILE__)."images/sample-video-h264.mp4");
|
5286 |
$uploads = wp_upload_dir();
|
5287 |
$encode_dimensions = kgvid_set_encode_dimensions($movie_info, $video_formats[$options['sample_format']]);
|
@@ -7740,14 +7830,24 @@ function kgvid_encode_videos() {
|
|
7740 |
}
|
7741 |
}
|
7742 |
|
7743 |
-
if (
|
7744 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7745 |
if ( $movie_info['configuration']['libvorbis'] == "true" && $movie_info['configuration'][$video_formats[$queued_format]['vcodec']] == "true" ) {
|
7746 |
|
7747 |
$encode_string = kgvid_generate_encode_string($moviefilepath, $encodevideo_info[$queued_format]['filepath'], $movie_info, $queued_format, $encode_dimensions['width'], $encode_dimensions['height'], $movie_info['rotate']);
|
7748 |
$embed_display = sprintf( __('Encoding %s', 'video-embed-thumbnail-generator'), $video_formats[$queued_format]['name'] );
|
|
|
7749 |
}//if the necessary libraries are enabled
|
7750 |
else {
|
|
|
7751 |
$missing_libraries = array();
|
7752 |
if($movie_info['configuration']['libvorbis'] == 'false') { $missing_libraries[] = 'libvorbis'; }
|
7753 |
if($movie_info['configuration'][$video_formats[$queued_format]['vcodec']] == 'false') { $missing_libraries[] = $video_formats[$queued_format]['vcodec']; }
|
@@ -7755,12 +7855,21 @@ function kgvid_encode_videos() {
|
|
7755 |
$video_encode_queue[$video_key]['encode_formats'][$queued_format]['status'] = "error";
|
7756 |
$video_encode_queue[$video_key]['encode_formats'][$queued_format]['lastline'] = $lastline;
|
7757 |
$embed_display = __("Missing libraries", 'video-embed-thumbnail-generator');
|
|
|
7758 |
}
|
|
|
7759 |
}//if file doesn't already exist
|
7760 |
else { $embed_display = sprintf( __('%s already encoded.', 'video-embed-thumbnail-generator'), $video_formats[$queued_format]['vcodec'] ); }
|
7761 |
|
7762 |
}//if webm or ogg format is queued
|
7763 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7764 |
}//if format is chosen for encoding
|
7765 |
|
7766 |
}//format loop
|
@@ -8558,7 +8667,10 @@ add_action('wp_ajax_kgvid_delete_video', 'kgvid_ajax_delete_video');
|
|
8558 |
|
8559 |
function kgvid_delete_video_attachment($video_id) {
|
8560 |
|
8561 |
-
if ( strpos(get_post_mime_type( $video_id ), 'video') !== false
|
|
|
|
|
|
|
8562 |
$parent_post = get_post($video_id);
|
8563 |
$options = kgvid_get_options();
|
8564 |
$video_encode_queue = kgvid_get_encode_queue();
|
@@ -8581,7 +8693,9 @@ function kgvid_delete_video_attachment($video_id) {
|
|
8581 |
kgvid_save_encode_queue($video_encode_queue);
|
8582 |
break;
|
8583 |
}//if the video is an original format
|
8584 |
-
if ( $video_entry['attachmentID'] == $parent_id
|
|
|
|
|
8585 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
8586 |
if ( array_key_exists('filepath', $value) ) {
|
8587 |
if ( strpos($value['filepath'], $wp_attached_file) !== false ) {
|
@@ -8632,7 +8746,7 @@ function kgvid_delete_video_attachment($video_id) {
|
|
8632 |
}
|
8633 |
}
|
8634 |
}//end if there are any children
|
8635 |
-
}//end if video
|
8636 |
|
8637 |
elseif ( strpos(get_post_mime_type( $video_id ), 'image') !== false ) {
|
8638 |
$args = array(
|
3 |
Plugin Name: Video Embed & Thumbnail Generator
|
4 |
Plugin URI: http://www.kylegilman.net/2011/01/18/video-embed-thumbnail-generator-wordpress-plugin/
|
5 |
Description: Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for encoding.
|
6 |
+
Version: 4.6.25
|
7 |
Author: Kyle Gilman
|
8 |
Author URI: http://www.kylegilman.net/
|
9 |
Text Domain: video-embed-thumbnail-generator
|
60 |
$edit_others_capable = kgvid_check_if_capable('edit_others_posts');
|
61 |
|
62 |
$options = array(
|
63 |
+
"version" => '4.6.25',
|
64 |
"embed_method" => "Video.js",
|
65 |
"jw_player_id" => "",
|
66 |
"template" => false,
|
192 |
|
193 |
$video_formats = kgvid_video_formats();
|
194 |
foreach ($video_formats as $format => $format_stats ) {
|
195 |
+
if ( array_key_exists('default_encode', $format_stats) && $format_stats['default_encode'] == 'on' ) {
|
196 |
$options['encode'][$format] = $format_stats['default_encode'];
|
197 |
}
|
|
|
198 |
}
|
199 |
|
200 |
return $options;
|
408 |
$video_formats = array(
|
409 |
"fullres" => array(
|
410 |
"name" => __("same resolution H.264", 'video-embed-thumbnail-generator'),
|
411 |
+
"label" => _x('Full', 'Full resolution', 'video-embed-thumbnail-generator'),
|
412 |
"width" => INF,
|
413 |
"height" => INF,
|
414 |
"type" => "h264",
|
567 |
unset($video_formats['custom_'.$options['custom_format']['format']]);
|
568 |
}
|
569 |
|
570 |
+
if ( isset($options['replace_format']) ) {
|
571 |
+
|
572 |
+
$video_formats['fullres'] = array(
|
573 |
+
'name' => sprintf( __("Replace original with %s", 'video-embed-thumbnail-generator'), $video_formats[$options['replace_format']]['name'] ),
|
574 |
+
'width' => $video_formats[$options['replace_format']]['width'],
|
575 |
+
'height' => $video_formats[$options['replace_format']]['height'],
|
576 |
+
'type' => $video_formats[$options['replace_format']]['type'],
|
577 |
+
'extension' => $video_formats[$options['replace_format']]['extension'],
|
578 |
+
'mime' => $video_formats[$options['replace_format']]['mime'],
|
579 |
+
'suffix' => '-fullres.'.$video_formats[$options['replace_format']]['extension'],
|
580 |
+
'vcodec' => $video_formats[$options['replace_format']]['vcodec']
|
581 |
+
);
|
582 |
|
583 |
+
if ( !$return_replace && $options['replace_format'] != 'fullres' ) { unset($video_formats[$options['replace_format']]); }
|
584 |
+
|
585 |
+
}
|
586 |
|
587 |
return apply_filters('kgvid_video_formats', $video_formats, $return_replace, $return_customs, $return_dontembeds);
|
588 |
|
601 |
$options['ffmpeg_exists'] = 'on';
|
602 |
$options['app_path'] = $ffmpeg_check['app_path'];
|
603 |
}
|
604 |
+
else { $options['ffmpeg_exists'] = 'notinstalled'; }
|
605 |
|
606 |
update_option('kgvid_video_embed_options', $options);
|
607 |
|
888 |
}
|
889 |
|
890 |
function kgvid_url_exists($url) {
|
891 |
+
|
892 |
+
$ssl_context_options = array(
|
893 |
+
'ssl' => array(
|
894 |
+
'verify_peer' => false,
|
895 |
+
'verify_peer_name' => false,
|
896 |
+
)
|
897 |
+
);
|
898 |
+
$ssl_context = stream_context_create($ssl_context_options);
|
899 |
+
|
900 |
+
$hdrs = @get_headers($url, 0, $ssl_context);
|
901 |
+
|
902 |
+
return is_array($hdrs) ? preg_match('/^HTTP\\/\\d+\\.\\d+\\s+2\\d\\d\\s+.*$/',$hdrs[0]) : false;
|
903 |
+
|
904 |
}
|
905 |
|
906 |
function kgvid_url_mime_type($url, $post_id = false) {
|
1259 |
$args = array(
|
1260 |
'numberposts' => '-1',
|
1261 |
'post_parent' => $postID,
|
1262 |
+
'post_type' => 'attachment'
|
|
|
1263 |
);
|
1264 |
}
|
1265 |
elseif ($moviefile == '' || !is_file($moviefile) ) {
|
1284 |
'numberposts' => '-1',
|
1285 |
'post_type' => 'attachment',
|
1286 |
'meta_key' => '_kgflashmediaplayer-externalurl',
|
1287 |
+
'meta_value' => $sanitized_url['movieurl']
|
|
|
1288 |
);
|
1289 |
|
1290 |
}
|
1396 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
1397 |
$movie_info = array();
|
1398 |
|
1399 |
+
if ( strpos($video, 'http') === 0 ) { //if it's a URL
|
1400 |
$video_id = kgvid_url_to_id($video);
|
1401 |
if ( $video_id ) {
|
1402 |
$video_path = get_attached_file($video_id);
|
1408 |
}
|
1409 |
}
|
1410 |
}
|
1411 |
+
|
1412 |
$old_locale = kgvid_set_locale($video); //fixes UTF-8 encoding problems
|
1413 |
$command = escapeshellcmd($ffmpegPath . ' -i "' . $video . '"');
|
1414 |
$command = $command.' 2>&1';
|
1426 |
$movie_info['worked'] = true;
|
1427 |
$movie_info['width'] = $regs [1] ? $regs [1] : null;
|
1428 |
$movie_info['height'] = $regs [2] ? $regs [2] : null;
|
1429 |
+
|
1430 |
preg_match('/Duration: (.*?),/', $output, $matches);
|
1431 |
$duration = $matches[1];
|
1432 |
$movie_duration_hours = intval(substr($duration, -11, 2));
|
1448 |
$old_locale = kgvid_set_locale($video); //fixes UTF-8 encoding problems
|
1449 |
$command = escapeshellcmd($ffmpegPath . ' -i "' . $video . '" -codecs');
|
1450 |
$command = $command.' 2>&1';
|
1451 |
+
exec ( $command, $codec_output );
|
1452 |
$restore_locale = setlocale(LC_CTYPE, $old_locale);
|
1453 |
+
$codec_output = implode("\n", $codec_output);
|
1454 |
+
$video_lib_array = array('libvorbis');
|
1455 |
+
$video_formats = kgvid_video_formats();
|
1456 |
+
foreach ( $video_formats as $format => $format_stats ) {
|
1457 |
+
if ( isset($format_stats['vcodec']) ) {
|
1458 |
+
$video_lib_array[] = $format_stats['vcodec'];
|
1459 |
+
}
|
1460 |
+
}
|
1461 |
$aac_array = kgvid_aac_encoders();
|
1462 |
$lib_list = array_merge($video_lib_array, $aac_array);
|
1463 |
foreach ($lib_list as $lib) {
|
1464 |
+
if ( strpos($codec_output, $lib) !== false ) { $movie_info['configuration'][$lib] = "true"; }
|
1465 |
else { $movie_info['configuration'][$lib] = "false"; }
|
1466 |
}
|
1467 |
|
1470 |
$movie_info['worked'] = false;
|
1471 |
}
|
1472 |
|
1473 |
+
return apply_filters('kgvid_get_video_dimensions', $movie_info, $video, $output, $codec_output);
|
1474 |
}
|
1475 |
|
1476 |
function kgvid_generate_flashvars($content, $query_atts, $encodevideo_info, $id) {
|
1660 |
$options = kgvid_get_options();
|
1661 |
$libraries = $movie_info['configuration'];
|
1662 |
$encode_string = strtoupper($options['video_app'])." not found";
|
1663 |
+
$video_formats = kgvid_video_formats();
|
1664 |
|
1665 |
+
if ( $options['ffmpeg_exists'] == "on" && isset($video_formats[$format]) ) {
|
|
|
|
|
1666 |
|
1667 |
if ( $options['video_app'] == "avconv" || $options['video_bitrate_flag'] != "on" ) {
|
1668 |
$video_bitrate_flag = "b:v";
|
1690 |
$options['vp9_CRF'] = round((-0.000002554 * $width * $height) + 35); //formula to generate close to Google-recommended CRFs https://developers.google.com/media/vp9/settings/vod/
|
1691 |
}
|
1692 |
$crf_flag = "crf";
|
1693 |
+
if ( $video_formats[$format]['type'] == 'ogv' ) { //ogg doesn't do CRF
|
1694 |
+
$crf_flag = $qscale_flag;
|
1695 |
+
}
|
1696 |
+
if ( isset( $options[$crf_option] ) ) {
|
1697 |
+
$rate_control_flag = " -".$crf_flag." ".$options[$crf_option];
|
1698 |
+
}
|
1699 |
+
else {
|
1700 |
+
$rate_control_flag = '';
|
1701 |
+
}
|
1702 |
}
|
1703 |
else {
|
1704 |
if ( $video_formats[$format]['type'] == 'vp9' ) {
|
1774 |
$encode_string[2] = $watermark_strings['filter'];
|
1775 |
$encode_string[3] = ' "'.$output.'"';
|
1776 |
|
1777 |
+
$encode_string = apply_filters('kgvid_generate_encode_string', $encode_string, $input, $output, $movie_info, $format, $width, $height, $rotate, $nostdin);
|
|
|
1778 |
|
1779 |
} //if FFMPEG is found
|
1780 |
|
1781 |
+
$options['encode_string'] = $encode_string;
|
1782 |
+
update_option('kgvid_video_embed_options', $options);
|
1783 |
+
|
1784 |
+
return $encode_string;
|
1785 |
|
1786 |
}
|
1787 |
|
1844 |
|
1845 |
$options = kgvid_get_options();
|
1846 |
|
1847 |
+
wp_register_script( 'kgvid_video_embed', plugins_url("/js/kgvid_video_embed.js", __FILE__), array('jquery'), $options['version'], true );
|
1848 |
+
|
1849 |
+
wp_register_script( 'simplemodal', plugins_url("/js/jquery.simplemodal.1.4.5.min.js", __FILE__), '', '1.4.5', true );
|
1850 |
+
|
1851 |
//Video.js styles
|
1852 |
if ( $options['embed_method'] == "Video.js" || $options['embed_method'] == "Strobe Media Playback" ) {
|
1853 |
wp_enqueue_style( 'video-js', plugins_url("", __FILE__).'/video-js/video-js.css', '', '5.20.5' );
|
1854 |
if ( $options['js_skin'] == 'kg-video-js-skin' ){ wp_enqueue_style( 'video-js-kg-skin', plugins_url("", __FILE__).'/video-js/kg-video-js-skin.css', '', $options['version'] ); }
|
1855 |
+
|
1856 |
+
wp_register_script( 'video-js', plugins_url("", __FILE__).'/video-js/video.js', '', '5.20.5', true );
|
1857 |
+
wp_register_script( 'video-quality-selector', plugins_url("", __FILE__).'/video-js/video-quality-selector.js', array('video-js'), $options['version'], true );
|
1858 |
+
|
1859 |
+
}
|
1860 |
+
|
1861 |
+
if ( $options['embed_method'] == "WordPress Default" ) {
|
1862 |
+
global $wp_version;
|
1863 |
+
|
1864 |
+
if ( $wp_version >= 4.9 ) {
|
1865 |
+
$sourcechooser_path = plugins_url( 'js/mejs-source-chooser.js', __FILE__ );
|
1866 |
+
}
|
1867 |
+
else {
|
1868 |
+
$sourcechooser_path = plugins_url( 'js/mep-feature-sourcechooser.js', __FILE__ );
|
1869 |
+
}
|
1870 |
+
wp_register_script( 'mejs_sourcechooser', $sourcechooser_path, array( 'mediaelement' ), $options['version'], true );
|
1871 |
+
if ( $wp_version >= 4.9 ) {
|
1872 |
+
$speed_path = plugins_url( 'js/mejs-speed.js', __FILE__ );
|
1873 |
+
}
|
1874 |
+
else {
|
1875 |
+
$speed_path = plugins_url( 'js/mep-speed.js', __FILE__ );;
|
1876 |
+
}
|
1877 |
+
wp_register_script( 'mejs-speed', $speed_path, array( 'mediaelement' ), $options['version'], true );
|
1878 |
}
|
1879 |
|
1880 |
//plugin-related frontend styles, requires dashicons
|
1883 |
if ( $options['alwaysloadscripts'] == 'on' ) {
|
1884 |
kgvid_enqueue_shortcode_scripts();
|
1885 |
wp_enqueue_script( 'simplemodal', plugins_url("/js/jquery.simplemodal.1.4.5.min.js", __FILE__), '', '1.4.5', true );
|
1886 |
+
}
|
1887 |
|
1888 |
}
|
1889 |
add_action('wp_enqueue_scripts', 'kgvid_video_embed_enqueue_styles', 12);
|
2215 |
$options = kgvid_get_options();
|
2216 |
|
2217 |
if ( $options['embed_method'] == "Video.js" || $options['embed_method'] == "Strobe Media Playback" ) {
|
2218 |
+
|
2219 |
+
wp_enqueue_script( 'video-js' );
|
2220 |
add_action('wp_footer', 'kgvid_print_videojs_footer', 99);
|
2221 |
+
|
2222 |
+
if ( $options['alwaysloadscripts'] == 'on' ) {
|
2223 |
+
wp_enqueue_script( 'video-quality-selector' );
|
2224 |
+
}
|
2225 |
+
|
2226 |
}
|
2227 |
|
2228 |
if ( $options['embed_method'] == "Strobe Media Playback" ) {
|
2231 |
|
2232 |
if ( !wp_script_is('kgvid_video_embed', 'enqueued') ) {
|
2233 |
|
2234 |
+
wp_enqueue_script( 'kgvid_video_embed' );
|
2235 |
|
2236 |
wp_localize_script( 'kgvid_video_embed', 'kgvidL10n_frontend', array(
|
2237 |
'ajaxurl' => admin_url( 'admin-ajax.php', is_ssl() ? 'admin' : 'http' ),
|
2240 |
'completeview' => _x("Complete View", 'noun for Google Analytics event', 'video-embed-thumbnail-generator'),
|
2241 |
'next' => _x("Next", 'button text to play next video', 'video-embed-thumbnail-generator'),
|
2242 |
'previous' => _x("Previous", 'button text to play previous video', 'video-embed-thumbnail-generator'),
|
2243 |
+
'quality' => _x("Quality", 'text above list of video resolutions', 'video-embed-thumbnail-generator'),
|
2244 |
+
'fullres' => _x("Full", 'Full resolution', 'video-embed-thumbnail-generator')
|
2245 |
) );
|
2246 |
|
2247 |
}
|
2363 |
else { $post_id = 1; }
|
2364 |
$content = '';
|
2365 |
$popup_code = kgvid_single_video_code($popup_atts, $atts, $content, $post_id);
|
2366 |
+
preg_match('/data-kgvid_video_vars=".*?"/', $popup_code, $video_vars);
|
|
|
2367 |
$popup_code = str_replace(array("\r", "\n", "\t", $video_vars[0]), "", $popup_code);
|
2368 |
|
2369 |
if ( $options['js_skin'] == "" ) { $options['js_skin'] = "vjs-default-skin"; }
|
2371 |
$options['js_skin'] = $query_atts['skin']; //allows user to set skin for individual videos using the skin="" attribute
|
2372 |
}
|
2373 |
|
2374 |
+
$code .= '<div class="kgvid_video_gallery_thumb" onclick="kgvid_SetVideo(\'kgvid_'.strval($kgvid_video_id-1).'\')" id="kgvid_video_gallery_thumb_kgvid_'.strval($kgvid_video_id-1).'" data-id="kgvid_'.strval($kgvid_video_id-1).'" data-width="'.esc_attr($dimensions['width']).'" data-height="'.esc_attr($dimensions['height']).'" data-meta="'.esc_attr($below_video).'" data-gallery_end="'.esc_attr($query_atts['gallery_end']).'" data-popupcode="'.esc_attr($popup_code).'" '.$video_vars[0].'" style="width:'.$query_atts["gallery_thumb"].'px;';
|
2375 |
|
2376 |
if ( $query_atts['gallery_thumb_aspect'] == "true" ) {
|
2377 |
$code .= ' height:'.round($options["height"]/$options["width"]*$query_atts["gallery_thumb"]).'px;';
|
2616 |
}
|
2617 |
|
2618 |
unset($video_formats['fullres']);
|
2619 |
+
$video_formats = array('original' => array( "type" => $format_type, "mime" => $mime_type, "name" => "Full", "label" => _x("Full", 'Full resolution', 'video-embed-thumbnail-generator') ) ) + $video_formats;
|
2620 |
|
2621 |
if ( in_array($mime_type_check['ext'], $compatible) ) {
|
2622 |
|
2733 |
}
|
2734 |
else { $source_key = $x; }
|
2735 |
|
2736 |
+
if ( strpos($encodevideo_info[$format]["url"], '?') === false ) { //if there isn't already a query string in this URL
|
2737 |
+
$encodevideo_info[$format]["url"] = $encodevideo_info[$format]["url"].'?id='.$kgvid_video_id;
|
2738 |
+
}
|
2739 |
+
|
2740 |
+
$sources[$source_key] = "\t\t\t\t\t".'<source src="'.esc_attr($encodevideo_info[$format]["url"]).'" type="'.$format_stats["mime"].'"';
|
2741 |
if ( $format == 'vp9' ) { $sources[$source_key] .= ' codecs="vp9, vorbis"'; }
|
2742 |
if ( $format_stats['type'] == 'h264' ) {
|
2743 |
$sources[$source_key] .= ' data-res="'.$format_stats['label'].'"';
|
2760 |
|
2761 |
if ( $enable_resolutions_plugin ) {
|
2762 |
$video_variables['enable_resolutions_plugin'] = "true";
|
2763 |
+
if ( wp_script_is('kgvid_video_embed', 'enqueued') ) {
|
2764 |
+
wp_dequeue_script('kgvid_video_embed'); //ensure that the video-quality-selector script is loaded before kgvid_video_embed.js
|
2765 |
+
}
|
2766 |
+
wp_enqueue_script( 'video-quality-selector' );
|
2767 |
if ( $query_atts["auto_res"] == "highest" ) { $video_variables['default_res'] = end($h264_resolutions); }
|
2768 |
if ( $query_atts["auto_res"] == "lowest" ) { $video_variables['default_res'] = reset($h264_resolutions); }
|
2769 |
elseif ( in_array($query_atts["auto_res"], $h264_resolutions) ) { $video_variables['default_res'] = $query_atts["auto_res"]; }
|
2924 |
);
|
2925 |
|
2926 |
if ( $enable_resolutions_plugin && !wp_script_is('mejs_sourcechooser', 'enqueued') ) {
|
2927 |
+
wp_enqueue_script( 'mejs_sourcechooser' );
|
|
|
|
|
|
|
|
|
|
|
|
|
2928 |
array_push($wpmejssettings['features'], 'sourcechooser');
|
2929 |
$localize = true;
|
2930 |
}
|
2936 |
if ( $query_atts['playback_rate'] == 'true' ) {
|
2937 |
array_push($wpmejssettings['features'], 'speed');
|
2938 |
$wpmejssettings['speeds'] = array('0.5', '1', '1.25', '1.5', '2');
|
2939 |
+
wp_enqueue_script( 'mejs-speed' );
|
|
|
|
|
|
|
|
|
|
|
|
|
2940 |
}
|
2941 |
|
2942 |
array_push($wpmejssettings['features'], 'fullscreen');
|
2949 |
if ( function_exists('wp_video_shortcode') ) { $executed_shortcode = wp_video_shortcode($attr); }
|
2950 |
else { $executed_shortcode = 'WordPress video shortcode function does not exist.'; }
|
2951 |
$content_width = $content_width_save;
|
|
|
2952 |
if ( $enable_resolutions_plugin ) {
|
2953 |
$executed_shortcode = preg_replace( '/<source .*<a /', implode(' />', $sources).' /><a ', $executed_shortcode );
|
2954 |
}
|
3402 |
if ( !is_feed() ) {
|
3403 |
|
3404 |
$options = kgvid_get_options();
|
3405 |
+
if ( $options['embed_method'] != 'Video.js' ) { kgvid_enqueue_shortcode_scripts(); }
|
|
|
3406 |
|
3407 |
if ( in_the_loop() ) {
|
3408 |
$post_id = get_the_ID();
|
3439 |
$gallery_query_atts = array();
|
3440 |
foreach($gallery_query_index as $index) { $gallery_query_atts[$index] = $query_atts[$index]; };
|
3441 |
|
3442 |
+
if ( $gallery_query_atts['gallery_orderby'] == 'rand' ) {
|
3443 |
+
$gallery_query_atts['gallery_orderby'] = 'RAND('.rand().')'; //use the same seed on every page load
|
3444 |
+
}
|
3445 |
+
|
3446 |
+
wp_enqueue_script( 'simplemodal' );
|
3447 |
|
3448 |
if ( $query_atts['align'] == "left" ) { $aligncode = ' kgvid_textalign_left'; }
|
3449 |
if ( $query_atts['align'] == "center" ) { $aligncode = ' kgvid_textalign_center'; }
|
3458 |
|
3459 |
} //if gallery
|
3460 |
|
3461 |
+
if ( $options['embed_method'] == 'Video.js' ) { kgvid_enqueue_shortcode_scripts(); }
|
3462 |
+
|
3463 |
} //if not feed
|
3464 |
|
3465 |
return apply_filters('KGVID_shortcode', $code, $query_atts, $content);
|
4365 |
<form method="post" action="options.php">
|
4366 |
<?php settings_fields('kgvid_video_embed_options'); ?>
|
4367 |
<input type="hidden" id="kgvid_settings_security" value="<?php echo wp_create_nonce('video-embed-thumbnail-generator-nonce'); ?>">
|
4368 |
+
<?php kgvid_do_settings_sections(__FILE__); ?>
|
4369 |
<p class='submit'>
|
4370 |
<?php submit_button(__('Save Changes', 'video-embed-thumbnail-generator'), 'primary', 'kgvid_submit', false, array( 'onclick' => "jQuery('form :disabled').prop('disabled', false);" ) ); ?>
|
4371 |
<?php submit_button(__('Reset Options', 'video-embed-thumbnail-generator'), 'secondary', 'video-embed-thumbnail-generator-reset', false); ?>
|
4464 |
}//end copying site queues to network
|
4465 |
}//end network activation setup
|
4466 |
|
4467 |
+
function kgvid_do_settings_sections( $page ) {
|
4468 |
+
global $wp_settings_sections, $wp_settings_fields;
|
4469 |
+
|
4470 |
+
if ( ! isset( $wp_settings_sections[ $page ] ) ) {
|
4471 |
+
return;
|
4472 |
+
}
|
4473 |
+
|
4474 |
+
foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
|
4475 |
+
if ( $section['title'] ) {
|
4476 |
+
echo "<h2 id='header_{$section['id']}'>{$section['title']}</h2>\n";
|
4477 |
+
}
|
4478 |
+
|
4479 |
+
if ( $section['callback'] ) {
|
4480 |
+
call_user_func( $section['callback'], $section );
|
4481 |
+
}
|
4482 |
+
|
4483 |
+
if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
|
4484 |
+
continue;
|
4485 |
+
}
|
4486 |
+
echo '<table class="form-table" id="table_'.$section["id"].'">';
|
4487 |
+
do_settings_fields( $page, $section['id'] );
|
4488 |
+
echo '</table>';
|
4489 |
+
}
|
4490 |
+
}
|
4491 |
+
|
4492 |
register_setting('kgvid_video_embed_options', 'kgvid_video_embed_options', 'kgvid_video_embed_options_validate' );
|
4493 |
|
4494 |
$options = kgvid_get_options();
|
4606 |
|
4607 |
$players = apply_filters('kgvid_available_video_players', $players);
|
4608 |
|
4609 |
+
echo "<table class='form-table' id='table_kgvid_video_embed_embed_method'><tbody><tr valign='middle'><th scope='row'><label for='embed_method'>".__('Video player:', 'video-embed-thumbnail-generator')."</label></th><td><select class='affects_player' onchange='kgvid_hide_plugin_settings();' id='embed_method' name='kgvid_video_embed_options[embed_method]'>";
|
4610 |
foreach($players as $name => $value) {
|
4611 |
$selected = ($options['embed_method']==$value) ? 'selected="selected"' : '';
|
4612 |
echo "<option value='$value' $selected>$name</option>";
|
5042 |
$items['custom'] = __('Custom', 'video-embed-thumbnail-generator');
|
5043 |
|
5044 |
echo "<div class='kgvid_video_app_required'>";
|
5045 |
+
echo "<input ".checked( array_key_exists('fullres', $options['encode']) && $options['encode']['fullres'] == 'on', true, false )." id='encode_fullres' name='kgvid_video_embed_options[encode][fullres]' type='checkbox' /> <label for='encode_fullres'>".__('Replace original with', 'video-embed-thumbnail-generator');
|
5046 |
|
5047 |
echo " <select id='replace_format' name='kgvid_video_embed_options[replace_format]' class='affects_ffmpeg' onchange='kgvid_change_replace_format();'>";
|
5048 |
foreach($items as $value=>$name) {
|
5061 |
}
|
5062 |
|
5063 |
foreach ( $video_formats as $format => $format_stats ) {
|
5064 |
+
echo "<input ".checked( array_key_exists($format, $options['encode']) && $options['encode'][$format] == 'on', true, false )." id='encode_".$format."' name='kgvid_video_embed_options[encode][".$format."]' type='checkbox' /> <label for='encode_".$format."'>".$format_stats['name']."</label><br />";
|
5065 |
}
|
5066 |
|
5067 |
echo "<input ".checked( array_key_exists('custom', $options['encode']), true, false )." id='encode_custom' name='kgvid_video_embed_options[encode][custom]' type='checkbox' /> <label for='encode_custom'>".__('Custom', 'video-embed-thumbnail-generator');
|
5364 |
$options = kgvid_get_options();
|
5365 |
$video_formats = kgvid_video_formats(false, false);
|
5366 |
$encode_string = "";
|
5367 |
+
|
5368 |
if ( $options['ffmpeg_exists'] == "on" ) {
|
5369 |
|
5370 |
+
if ( !isset( $video_formats[$options['sample_format']] ) ) {
|
5371 |
+
$options['sample_format'] = 'mobile';
|
5372 |
+
update_option('kgvid_video_embed_options', $options);
|
5373 |
+
}
|
5374 |
+
|
5375 |
$movie_info = kgvid_get_video_dimensions(plugin_dir_path(__FILE__)."images/sample-video-h264.mp4");
|
5376 |
$uploads = wp_upload_dir();
|
5377 |
$encode_dimensions = kgvid_set_encode_dimensions($movie_info, $video_formats[$options['sample_format']]);
|
7830 |
}
|
7831 |
}
|
7832 |
|
7833 |
+
if (
|
7834 |
+
$format_stats['type'] == "webm"
|
7835 |
+
|| $format_stats['type'] == "ogv"
|
7836 |
+
|| $format_stats['type'] == "vp9"
|
7837 |
+
) { //if it's not H.264 they both work essentially the same
|
7838 |
+
if (
|
7839 |
+
!$encodevideo_info[$queued_format]['exists']
|
7840 |
+
|| ($encodevideo_info['sameserver']
|
7841 |
+
&& filesize($encodevideo_info[$queued_format]['filepath']) < 24576)
|
7842 |
+
) {
|
7843 |
if ( $movie_info['configuration']['libvorbis'] == "true" && $movie_info['configuration'][$video_formats[$queued_format]['vcodec']] == "true" ) {
|
7844 |
|
7845 |
$encode_string = kgvid_generate_encode_string($moviefilepath, $encodevideo_info[$queued_format]['filepath'], $movie_info, $queued_format, $encode_dimensions['width'], $encode_dimensions['height'], $movie_info['rotate']);
|
7846 |
$embed_display = sprintf( __('Encoding %s', 'video-embed-thumbnail-generator'), $video_formats[$queued_format]['name'] );
|
7847 |
+
|
7848 |
}//if the necessary libraries are enabled
|
7849 |
else {
|
7850 |
+
|
7851 |
$missing_libraries = array();
|
7852 |
if($movie_info['configuration']['libvorbis'] == 'false') { $missing_libraries[] = 'libvorbis'; }
|
7853 |
if($movie_info['configuration'][$video_formats[$queued_format]['vcodec']] == 'false') { $missing_libraries[] = $video_formats[$queued_format]['vcodec']; }
|
7855 |
$video_encode_queue[$video_key]['encode_formats'][$queued_format]['status'] = "error";
|
7856 |
$video_encode_queue[$video_key]['encode_formats'][$queued_format]['lastline'] = $lastline;
|
7857 |
$embed_display = __("Missing libraries", 'video-embed-thumbnail-generator');
|
7858 |
+
|
7859 |
}
|
7860 |
+
|
7861 |
}//if file doesn't already exist
|
7862 |
else { $embed_display = sprintf( __('%s already encoded.', 'video-embed-thumbnail-generator'), $video_formats[$queued_format]['vcodec'] ); }
|
7863 |
|
7864 |
}//if webm or ogg format is queued
|
7865 |
|
7866 |
+
else { //a format type we haven't accounted for yet
|
7867 |
+
if ( !$encodevideo_info[$queued_format]['exists'] ) {
|
7868 |
+
$encode_string = kgvid_generate_encode_string($moviefilepath, $encodevideo_info[$queued_format]['filepath'], $movie_info, $queued_format, $encode_dimensions['width'], $encode_dimensions['height'], $movie_info['rotate']);
|
7869 |
+
$embed_display = sprintf( __('Encoding %s', 'video-embed-thumbnail-generator'), $video_formats[$queued_format]['name'] );
|
7870 |
+
}
|
7871 |
+
}
|
7872 |
+
|
7873 |
}//if format is chosen for encoding
|
7874 |
|
7875 |
}//format loop
|
8667 |
|
8668 |
function kgvid_delete_video_attachment($video_id) {
|
8669 |
|
8670 |
+
if ( strpos(get_post_mime_type( $video_id ), 'video') !== false
|
8671 |
+
|| !empty(get_post_meta($video_id, '_kgflashmediaplayer-format', true))
|
8672 |
+
) { //only do this for videos or other child formats
|
8673 |
+
|
8674 |
$parent_post = get_post($video_id);
|
8675 |
$options = kgvid_get_options();
|
8676 |
$video_encode_queue = kgvid_get_encode_queue();
|
8693 |
kgvid_save_encode_queue($video_encode_queue);
|
8694 |
break;
|
8695 |
}//if the video is an original format
|
8696 |
+
if ( $video_entry['attachmentID'] == $parent_id
|
8697 |
+
|| get_post_meta($video_id, '_kgflashmediaplayer-externalurl', true) == $video_entry['movieurl']
|
8698 |
+
) {
|
8699 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
8700 |
if ( array_key_exists('filepath', $value) ) {
|
8701 |
if ( strpos($value['filepath'], $wp_attached_file) !== false ) {
|
8746 |
}
|
8747 |
}
|
8748 |
}//end if there are any children
|
8749 |
+
}//end if video or other child format
|
8750 |
|
8751 |
elseif ( strpos(get_post_mime_type( $video_id ), 'image') !== false ) {
|
8752 |
$args = array(
|
video-js/video-quality-selector.js
CHANGED
@@ -142,16 +142,6 @@ videojs.ResolutionSelector.prototype.createItems = function() {
|
|
142 |
items = [],
|
143 |
current_res;
|
144 |
|
145 |
-
// Add the menu title item
|
146 |
-
items.push( new videojs.ResolutionTitleMenuItem( player, {
|
147 |
-
|
148 |
-
el : videojs.getComponent( 'Component' ).prototype.createEl( 'li', {
|
149 |
-
|
150 |
-
className : 'vjs-menu-title vjs-res-menu-title',
|
151 |
-
innerHTML : kgvidL10n_frontend.quality
|
152 |
-
})
|
153 |
-
}));
|
154 |
-
|
155 |
// Add an item for each available resolution
|
156 |
for ( current_res in player.availableRes ) {
|
157 |
|
@@ -171,12 +161,30 @@ videojs.ResolutionSelector.prototype.createItems = function() {
|
|
171 |
|
172 |
return -1;
|
173 |
|
174 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
return parseInt( b.resolution ) - parseInt( a.resolution );
|
|
|
177 |
}
|
178 |
});
|
179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
return items;
|
181 |
};
|
182 |
|
@@ -229,6 +237,15 @@ videojs.plugin( 'resolutionSelector', function( options ) {
|
|
229 |
}
|
230 |
|
231 |
available_res[current_res].push( sources[i] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
}
|
233 |
|
234 |
// Check for forced types
|
@@ -439,5 +456,3 @@ videojs.plugin( 'resolutionSelector', function( options ) {
|
|
439 |
});
|
440 |
|
441 |
}
|
442 |
-
|
443 |
-
kgvid_load_video_quality_selector();
|
142 |
items = [],
|
143 |
current_res;
|
144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
// Add an item for each available resolution
|
146 |
for ( current_res in player.availableRes ) {
|
147 |
|
161 |
|
162 |
return -1;
|
163 |
|
164 |
+
}
|
165 |
+
else if ( a.resolution == kgvidL10n_frontend.fullres ) { //sort the 'Full' resolution value to the top of the list
|
166 |
+
return -1;
|
167 |
+
}
|
168 |
+
else if ( b.resolution == kgvidL10n_frontend.fullres ) {
|
169 |
+
return 1;
|
170 |
+
}
|
171 |
+
else {
|
172 |
|
173 |
return parseInt( b.resolution ) - parseInt( a.resolution );
|
174 |
+
|
175 |
}
|
176 |
});
|
177 |
|
178 |
+
// Add the menu title item
|
179 |
+
items.unshift( new videojs.ResolutionTitleMenuItem( player, {
|
180 |
+
|
181 |
+
el : videojs.getComponent( 'Component' ).prototype.createEl( 'li', {
|
182 |
+
|
183 |
+
className : 'vjs-menu-title vjs-res-menu-title',
|
184 |
+
innerHTML : kgvidL10n_frontend.quality
|
185 |
+
})
|
186 |
+
}));
|
187 |
+
|
188 |
return items;
|
189 |
};
|
190 |
|
237 |
}
|
238 |
|
239 |
available_res[current_res].push( sources[i] );
|
240 |
+
|
241 |
+
if ( current_res == kgvidL10n_frontend.fullres ) {
|
242 |
+
player.on('loadedmetadata', function(){
|
243 |
+
if ( player.videoHeight() != NaN ) {
|
244 |
+
jQuery('.vjs-res-button li:contains('+kgvidL10n_frontend.fullres+')').html(player.videoHeight()+'p');
|
245 |
+
}
|
246 |
+
});
|
247 |
+
}
|
248 |
+
|
249 |
}
|
250 |
|
251 |
// Check for forced types
|
456 |
});
|
457 |
|
458 |
}
|
|
|
|