Version Description
- November 14, 2017 =
- Updated WordPress Default player resizing methods and speed and resolution selector plugins for the new player included with WordPress 4.9.
- Added 480p resolution option.
- Added option to hide unwanted encode formats from the attachment pages and encode queue.
- Fixed bug that prevented 360p encoding for videos less than 480p.
- Fixed bug that did not automatically select default encoding formats.
Download this release
Release Info
Developer | kylegilman |
Plugin | Video Embed & Thumbnail Generator |
Version | 4.6.20 |
Comparing to | |
See all releases |
Code changes from version 4.6.19 to 4.6.20
- css/kgvid_styles.css +127 -44
- js/kgvid_video_embed.js +4 -7
- js/kgvid_video_plugin_admin.js +2 -2
- js/mejs-source-chooser.js +200 -0
- js/mejs-speed.js +174 -0
- js/mep-speed.js +170 -1
- readme.txt +9 -2
- video-embed-thumbnail-generator.php +70 -31
css/kgvid_styles.css
CHANGED
@@ -504,12 +504,16 @@ ul li.vjs-menu-title.vjs-res-menu-title:hover {
|
|
504 |
z-index: 2;
|
505 |
}
|
506 |
|
|
|
|
|
|
|
|
|
507 |
/* fix iPhone play button */
|
508 |
.kgvid_wrapper video::-webkit-media-controls-start-playback-button { display: none; }
|
509 |
.kgvid_wrapper .video-js.vjs-controls-enabled .vjs-big-play-button { display: none; }
|
510 |
.kgvid_wrapper .video-js.vjs-controls-enabled.vjs-paused .vjs-big-play-button { display: block; }
|
511 |
|
512 |
-
/*
|
513 |
|
514 |
.kgvid_wrapper .mejs-controls div.mejs-sourcechooser-button button {
|
515 |
background: none;
|
@@ -523,7 +527,8 @@ ul li.vjs-menu-title.vjs-res-menu-title:hover {
|
|
523 |
content: "\f111";
|
524 |
}
|
525 |
|
526 |
-
|
|
|
527 |
display: none;
|
528 |
position: absolute;
|
529 |
bottom: -7px;
|
@@ -537,7 +542,7 @@ ul li.vjs-menu-title.vjs-res-menu-title:hover {
|
|
537 |
border-top-color: rgba(40, 40, 40, 0.5);
|
538 |
}
|
539 |
|
540 |
-
div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector {
|
541 |
visibility: inherit;
|
542 |
bottom: 17px;
|
543 |
right: -28px;
|
@@ -550,109 +555,187 @@ div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector {
|
|
550 |
box-shadow: -0.2em -0.2em 0.3em rgba(255, 255, 255, 0.2);
|
551 |
}
|
552 |
|
553 |
-
div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector span {
|
554 |
color: white;
|
555 |
padding: 0px 10px 5px 10px;
|
556 |
display: block;
|
557 |
white-space: nowrap;
|
558 |
}
|
559 |
|
560 |
-
div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li {
|
561 |
margin: 3px 0 3px 0;
|
562 |
padding: 2px 10px 5px 10px;
|
563 |
cursor: pointer;
|
564 |
}
|
565 |
|
566 |
-
div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li.mejs-sourcechooser-selected {
|
567 |
background: rgba(20,20,20,0.8);
|
568 |
}
|
569 |
|
570 |
-
div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li:hover {
|
571 |
color: #111;
|
572 |
background-color: #ffffff;
|
573 |
background-color: rgba(255, 255, 255, 0.75);
|
574 |
}
|
575 |
|
576 |
-
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input {
|
577 |
display: none;
|
578 |
}
|
579 |
|
580 |
-
div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label {
|
581 |
width: auto;
|
582 |
}
|
583 |
|
584 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
position: relative;
|
586 |
}
|
587 |
|
588 |
-
.mejs__speed-button > button,
|
|
|
589 |
background: transparent;
|
590 |
-
|
591 |
-
margin: 11px 0 0 0;
|
592 |
font-size: 11px;
|
593 |
line-height: normal;
|
594 |
-
|
|
|
595 |
}
|
596 |
|
597 |
-
.mejs__speed-selector,
|
598 |
-
|
599 |
-
position: absolute;
|
600 |
-
top: -100px;
|
601 |
-
left: -10px;
|
602 |
-
width: 60px;
|
603 |
-
height: 100px;
|
604 |
background: rgba(50, 50, 50, 0.7);
|
605 |
border: solid 1px transparent;
|
606 |
-
padding: 0;
|
607 |
-
overflow: hidden;
|
608 |
border-radius: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
609 |
}
|
610 |
|
611 |
-
.mejs__speed-selector,
|
|
|
612 |
visibility: visible;
|
613 |
}
|
614 |
|
615 |
-
.mejs__speed-selector-list,
|
616 |
-
|
617 |
-
padding: 0;
|
618 |
display: block;
|
619 |
list-style-type: none !important;
|
|
|
620 |
overflow: hidden;
|
|
|
621 |
}
|
622 |
|
623 |
-
.mejs__speed-selector-list-item,
|
624 |
-
|
625 |
-
padding: 0 10px;
|
626 |
-
list-style-type: none !important;
|
627 |
-
display: block;
|
628 |
color: #fff;
|
|
|
|
|
|
|
629 |
overflow: hidden;
|
|
|
630 |
}
|
631 |
|
632 |
-
.mejs__speed-selector-list-item:hover,
|
|
|
633 |
background-color: rgb(200, 200, 200) !important;
|
634 |
background-color: rgba(255, 255, 255, 0.4) !important;
|
635 |
}
|
636 |
|
637 |
-
.mejs__speed-selector-input,
|
|
|
638 |
clear: both;
|
639 |
float: left;
|
|
|
640 |
margin: 3px 3px 0 5px;
|
641 |
position: absolute;
|
642 |
-
left: -1000px;
|
643 |
}
|
644 |
|
645 |
-
.mejs__speed-selector-label,
|
646 |
-
|
647 |
-
float: left;
|
648 |
-
padding: 4px 0 0 0;
|
649 |
-
line-height: 15px;
|
650 |
-
font-size: 11px;
|
651 |
color: white;
|
652 |
-
margin-left: 5px;
|
653 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
|
654 |
}
|
655 |
|
656 |
-
.
|
657 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
658 |
}
|
504 |
z-index: 2;
|
505 |
}
|
506 |
|
507 |
+
.kgvid_wrapper .wp-video-shortcode {
|
508 |
+
max-height: 100%;
|
509 |
+
}
|
510 |
+
|
511 |
/* fix iPhone play button */
|
512 |
.kgvid_wrapper video::-webkit-media-controls-start-playback-button { display: none; }
|
513 |
.kgvid_wrapper .video-js.vjs-controls-enabled .vjs-big-play-button { display: none; }
|
514 |
.kgvid_wrapper .video-js.vjs-controls-enabled.vjs-paused .vjs-big-play-button { display: block; }
|
515 |
|
516 |
+
/* mejs-sourcechooser plugin styles */
|
517 |
|
518 |
.kgvid_wrapper .mejs-controls div.mejs-sourcechooser-button button {
|
519 |
background: none;
|
527 |
content: "\f111";
|
528 |
}
|
529 |
|
530 |
+
/* mep-feature-sourcechooser backwards compatible plugin styles */
|
531 |
+
.kgvid_wrapper.kgvid_compat_mep .mejs-container .mejs-controls div.mejs-menu-arrow {
|
532 |
display: none;
|
533 |
position: absolute;
|
534 |
bottom: -7px;
|
542 |
border-top-color: rgba(40, 40, 40, 0.5);
|
543 |
}
|
544 |
|
545 |
+
.kgvid_wrapper.kgvid_compat_mep div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector {
|
546 |
visibility: inherit;
|
547 |
bottom: 17px;
|
548 |
right: -28px;
|
555 |
box-shadow: -0.2em -0.2em 0.3em rgba(255, 255, 255, 0.2);
|
556 |
}
|
557 |
|
558 |
+
.kgvid_wrapper.kgvid_compat_mep div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector span {
|
559 |
color: white;
|
560 |
padding: 0px 10px 5px 10px;
|
561 |
display: block;
|
562 |
white-space: nowrap;
|
563 |
}
|
564 |
|
565 |
+
.kgvid_wrapper.kgvid_compat_mep div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li {
|
566 |
margin: 3px 0 3px 0;
|
567 |
padding: 2px 10px 5px 10px;
|
568 |
cursor: pointer;
|
569 |
}
|
570 |
|
571 |
+
.kgvid_wrapper.kgvid_compat_mep div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li.mejs-sourcechooser-selected {
|
572 |
background: rgba(20,20,20,0.8);
|
573 |
}
|
574 |
|
575 |
+
.kgvid_wrapper.kgvid_compat_mep div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li:hover {
|
576 |
color: #111;
|
577 |
background-color: #ffffff;
|
578 |
background-color: rgba(255, 255, 255, 0.75);
|
579 |
}
|
580 |
|
581 |
+
.kgvid_wrapper.kgvid_compat_mep .mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input {
|
582 |
display: none;
|
583 |
}
|
584 |
|
585 |
+
.kgvid_wrapper.kgvid_compat_mep div.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label {
|
586 |
width: auto;
|
587 |
}
|
588 |
|
589 |
+
/* mejs-sourcechooser new plugin styles */
|
590 |
+
|
591 |
+
.mejs__sourcechooser-button .mejs__sourcechooser-selector,
|
592 |
+
.mejs-sourcechooser-button .mejs-sourcechooser-selector {
|
593 |
+
background: rgba(50, 50, 50, 0.7);
|
594 |
+
border: solid 1px transparent;
|
595 |
+
border-radius: 0;
|
596 |
+
bottom: 40px;
|
597 |
+
overflow: hidden;
|
598 |
+
padding: 0;
|
599 |
+
position: absolute;
|
600 |
+
}
|
601 |
+
|
602 |
+
.mejs__sourcechooser-selector ul,
|
603 |
+
.mejs-sourcechooser-selector ul {
|
604 |
+
display: block;
|
605 |
+
list-style-type: none !important;
|
606 |
+
margin: 0;
|
607 |
+
overflow: hidden;
|
608 |
+
padding: 0;
|
609 |
+
}
|
610 |
+
|
611 |
+
.mejs__sourcechooser-selector li,
|
612 |
+
.mejs-sourcechooser-selector li {
|
613 |
+
color: #fff;
|
614 |
+
display: block;
|
615 |
+
list-style-type: none !important;
|
616 |
+
margin: 0;
|
617 |
+
overflow: hidden;
|
618 |
+
padding: 5px 10px 5px 0px;
|
619 |
+
}
|
620 |
+
|
621 |
+
.mejs-sourcechooser-selector li.sourcechooser-selected {
|
622 |
+
background-color: rgba(255, 255, 255, 0.2);
|
623 |
+
}
|
624 |
+
|
625 |
+
.mejs__sourcechooser-selector li:hover,
|
626 |
+
.mejs-sourcechooser-selector li:hover {
|
627 |
+
background-color: rgba(255, 255, 255, 0.2);
|
628 |
+
cursor: pointer;
|
629 |
+
}
|
630 |
+
|
631 |
+
.mejs__sourcechooser-selector input,
|
632 |
+
.mejs-sourcechooser-selector input {
|
633 |
+
clear: both;
|
634 |
+
float: left;
|
635 |
+
margin: 3px 3px 0 0;
|
636 |
+
visibility: hidden;
|
637 |
+
}
|
638 |
+
|
639 |
+
.mejs__sourcechooser-selector label,
|
640 |
+
.mejs-sourcechooser-selector label {
|
641 |
+
color: #fff;
|
642 |
+
display: inline-block;
|
643 |
+
float: left;
|
644 |
+
font-size: 10px;
|
645 |
+
line-height: 15px;
|
646 |
+
padding: 4px 0 0;
|
647 |
+
}
|
648 |
+
|
649 |
+
/* mejs-speed styles */
|
650 |
+
.mejs__speed-button,
|
651 |
+
.mejs-speed-button {
|
652 |
position: relative;
|
653 |
}
|
654 |
|
655 |
+
.mejs__speed-button > button,
|
656 |
+
.mejs-speed-button > button {
|
657 |
background: transparent;
|
658 |
+
color: #fff;
|
|
|
659 |
font-size: 11px;
|
660 |
line-height: normal;
|
661 |
+
margin: 11px 0 0;
|
662 |
+
width: 36px;
|
663 |
}
|
664 |
|
665 |
+
.mejs__speed-selector,
|
666 |
+
.mejs-speed-selector {
|
|
|
|
|
|
|
|
|
|
|
667 |
background: rgba(50, 50, 50, 0.7);
|
668 |
border: solid 1px transparent;
|
|
|
|
|
669 |
border-radius: 0;
|
670 |
+
left: -10px;
|
671 |
+
overflow: hidden;
|
672 |
+
padding: 0;
|
673 |
+
position: absolute;
|
674 |
+
top: -100px;
|
675 |
+
visibility: hidden;
|
676 |
+
width: 60px;
|
677 |
}
|
678 |
|
679 |
+
.mejs__speed-selector,
|
680 |
+
.mejs-speed-selector {
|
681 |
visibility: visible;
|
682 |
}
|
683 |
|
684 |
+
.mejs__speed-selector-list,
|
685 |
+
.mejs-speed-selector-list {
|
|
|
686 |
display: block;
|
687 |
list-style-type: none !important;
|
688 |
+
margin: 0;
|
689 |
overflow: hidden;
|
690 |
+
padding: 0;
|
691 |
}
|
692 |
|
693 |
+
.mejs__speed-selector-list-item,
|
694 |
+
.mejs-speed-selector-list-item {
|
|
|
|
|
|
|
695 |
color: #fff;
|
696 |
+
display: block;
|
697 |
+
list-style-type: none !important;
|
698 |
+
margin: 0 0 6px;
|
699 |
overflow: hidden;
|
700 |
+
padding: 0 10px;
|
701 |
}
|
702 |
|
703 |
+
.mejs__speed-selector-list-item:hover,
|
704 |
+
.mejs-speed-selector-list-item:hover {
|
705 |
background-color: rgb(200, 200, 200) !important;
|
706 |
background-color: rgba(255, 255, 255, 0.4) !important;
|
707 |
}
|
708 |
|
709 |
+
.mejs__speed-selector-input,
|
710 |
+
.mejs-speed-selector-input {
|
711 |
clear: both;
|
712 |
float: left;
|
713 |
+
left: -1000px;
|
714 |
margin: 3px 3px 0 5px;
|
715 |
position: absolute;
|
|
|
716 |
}
|
717 |
|
718 |
+
.mejs__speed-selector-label,
|
719 |
+
.mejs-speed-selector-label {
|
|
|
|
|
|
|
|
|
720 |
color: white;
|
|
|
721 |
cursor: pointer;
|
722 |
+
float: left;
|
723 |
+
font-size: 10px;
|
724 |
+
line-height: 14px;
|
725 |
+
margin-left: 5px;
|
726 |
+
padding: 4px 0 0;
|
727 |
+
width: 60px;
|
728 |
}
|
729 |
|
730 |
+
li.mejs-speed-selected {
|
731 |
+
background: rgba(255, 255, 255, 0.4);
|
732 |
+
}
|
733 |
+
|
734 |
+
.mejs__speed-selector,
|
735 |
+
.mejs-speed-selector {
|
736 |
+
visibility: hidden;
|
737 |
+
}
|
738 |
+
.mejs__speed-button:hover .mejs__speed-selector,
|
739 |
+
.mejs-speed-button:hover .mejs-speed-selector {
|
740 |
+
visibility: visible;
|
741 |
}
|
js/kgvid_video_embed.js
CHANGED
@@ -603,8 +603,8 @@ function kgvid_setup_video(id) {
|
|
603 |
|
604 |
var mejs_player = eval('mejs.players.'+mejs_id);
|
605 |
|
606 |
-
if ( mejs_player.isFullScreen
|
607 |
-
|
608 |
}
|
609 |
});
|
610 |
|
@@ -792,18 +792,15 @@ function kgvid_resize_video(id) {
|
|
792 |
jQuery('#video_'+id+'_html5_api').attr('width',set_width).attr('height',set_height);
|
793 |
}
|
794 |
|
795 |
-
if ( video_vars.player_type == "WordPressDefault" ) {
|
796 |
|
797 |
-
jQuery('#kgvid_'+id+'_wrapper .wp-video').css('width', set_width+'px');
|
798 |
-
|
799 |
-
if ( typeof mejs !== 'undefined' ) {
|
800 |
player = eval('mejs.players.'+jQuery('#kgvid_'+id+'_wrapper div.wp-video-shortcode').attr('id'));
|
|
|
801 |
if ( change_aspect ) {
|
802 |
player.options.setDimensions = false;
|
803 |
jQuery('#kgvid_'+id+'_wrapper div.wp-video-shortcode').css('height', set_height+'px');
|
804 |
}
|
805 |
|
806 |
-
}
|
807 |
}
|
808 |
|
809 |
if ( ( video_vars.player_type == "Video.js" && eval('videojs.players.video_'+id) != null )
|
603 |
|
604 |
var mejs_player = eval('mejs.players.'+mejs_id);
|
605 |
|
606 |
+
if ( mejs_player.isFullScreen ) {
|
607 |
+
//mejs_player.enterFullScreen();
|
608 |
}
|
609 |
});
|
610 |
|
792 |
jQuery('#video_'+id+'_html5_api').attr('width',set_width).attr('height',set_height);
|
793 |
}
|
794 |
|
795 |
+
if ( video_vars.player_type == "WordPressDefault" && typeof mejs !== 'undefined' ) {
|
796 |
|
|
|
|
|
|
|
797 |
player = eval('mejs.players.'+jQuery('#kgvid_'+id+'_wrapper div.wp-video-shortcode').attr('id'));
|
798 |
+
|
799 |
if ( change_aspect ) {
|
800 |
player.options.setDimensions = false;
|
801 |
jQuery('#kgvid_'+id+'_wrapper div.wp-video-shortcode').css('height', set_height+'px');
|
802 |
}
|
803 |
|
|
|
804 |
}
|
805 |
|
806 |
if ( ( video_vars.player_type == "Video.js" && eval('videojs.players.video_'+id) != null )
|
js/kgvid_video_plugin_admin.js
CHANGED
@@ -751,7 +751,7 @@ function kgvid_enqueue_video_encode(postID, blogID) {
|
|
751 |
page = "queue";
|
752 |
}
|
753 |
|
754 |
-
var formats = new Array("fullres", "1080", "720", "mobile", "ogg", "webm", "vp9", "custom");
|
755 |
var kgvid_encode = new Object();
|
756 |
jQuery.each(formats, function(key,formats) {
|
757 |
kgvid_encode[formats] = "";
|
@@ -1141,7 +1141,7 @@ function kgvid_redraw_encode_checkboxes(movieurl, postID, page, blogID) {
|
|
1141 |
|
1142 |
if ( kgflashmediaplayersecurity ) { //sometimes this tries to run after the media modal is closed
|
1143 |
|
1144 |
-
var formats = new Array("fullres", "1080", "720", "mobile", "ogg", "webm");
|
1145 |
var kgvid_encode = new Object();
|
1146 |
|
1147 |
jQuery.each(formats, function(key,formats) {
|
751 |
page = "queue";
|
752 |
}
|
753 |
|
754 |
+
var formats = new Array("fullres", "1080", "720", "480", "mobile", "ogg", "webm", "vp9", "custom");
|
755 |
var kgvid_encode = new Object();
|
756 |
jQuery.each(formats, function(key,formats) {
|
757 |
kgvid_encode[formats] = "";
|
1141 |
|
1142 |
if ( kgflashmediaplayersecurity ) { //sometimes this tries to run after the media modal is closed
|
1143 |
|
1144 |
+
var formats = new Array("fullres", "1080", "720", "480", "mobile", "ogg", "webm", "vp9", "custom");
|
1145 |
var kgvid_encode = new Object();
|
1146 |
|
1147 |
jQuery.each(formats, function(key,formats) {
|
js/mejs-source-chooser.js
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* MediaElement.js
|
3 |
+
* http://www.mediaelementjs.com/
|
4 |
+
*
|
5 |
+
* Wrapper that mimics native HTML5 MediaElement (audio and video)
|
6 |
+
* using a variety of technologies (pure JavaScript, Flash, iframe)
|
7 |
+
*
|
8 |
+
* Copyright 2010-2017, John Dyer (http://j.hn/)
|
9 |
+
* License: MIT
|
10 |
+
*
|
11 |
+
*/(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
12 |
+
'use strict';
|
13 |
+
|
14 |
+
Object.assign(mejs.MepDefaults, {
|
15 |
+
sourcechooserText: null
|
16 |
+
});
|
17 |
+
|
18 |
+
Object.assign(MediaElementPlayer.prototype, {
|
19 |
+
buildsourcechooser: function buildsourcechooser(player, controls, layers, media) {
|
20 |
+
|
21 |
+
var t = this,
|
22 |
+
sourceTitle = mejs.Utils.isString(t.options.sourcechooserText) ? t.options.sourcechooserText : mejs.i18n.t('mejs.source-chooser'),
|
23 |
+
sources = [],
|
24 |
+
children = t.mediaFiles ? t.mediaFiles : t.node.children;
|
25 |
+
|
26 |
+
var hoverTimeout = void 0;
|
27 |
+
|
28 |
+
for (var i = 0, total = children.length; i < total; i++) {
|
29 |
+
var s = children[i];
|
30 |
+
|
31 |
+
if (t.mediaFiles) {
|
32 |
+
sources.push(s);
|
33 |
+
} else if (s.nodeName === 'SOURCE') {
|
34 |
+
sources.push(s);
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
if (sources.length <= 1) {
|
39 |
+
return;
|
40 |
+
}
|
41 |
+
|
42 |
+
player.sourcechooserButton = document.createElement('div');
|
43 |
+
player.sourcechooserButton.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'sourcechooser-button';
|
44 |
+
player.sourcechooserButton.innerHTML = '<button type="button" role="button" aria-haspopup="true" aria-owns="' + t.id + '" title="' + sourceTitle + '" aria-label="' + sourceTitle + '" tabindex="0"></button>' + ('<div class="' + t.options.classPrefix + 'sourcechooser-selector ' + t.options.classPrefix + 'offscreen" role="menu" aria-expanded="false" aria-hidden="true"><ul></ul></div>');
|
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 |
+
|
55 |
+
player.sourcechooserButton.addEventListener('mouseover', function () {
|
56 |
+
clearTimeout(hoverTimeout);
|
57 |
+
player.showSourcechooserSelector();
|
58 |
+
});
|
59 |
+
player.sourcechooserButton.addEventListener('mouseout', function () {
|
60 |
+
hoverTimeout = setTimeout(function () {
|
61 |
+
player.hideSourcechooserSelector();
|
62 |
+
}, 0);
|
63 |
+
});
|
64 |
+
|
65 |
+
player.sourcechooserButton.addEventListener('keydown', function (e) {
|
66 |
+
|
67 |
+
if (t.options.keyActions.length) {
|
68 |
+
var keyCode = e.which || e.keyCode || 0;
|
69 |
+
|
70 |
+
switch (keyCode) {
|
71 |
+
case 32:
|
72 |
+
if (!mejs.MediaFeatures.isFirefox) {
|
73 |
+
player.showSourcechooserSelector();
|
74 |
+
}
|
75 |
+
player.sourcechooserButton.querySelector('input[type=radio]:checked').focus();
|
76 |
+
break;
|
77 |
+
case 13:
|
78 |
+
player.showSourcechooserSelector();
|
79 |
+
player.sourcechooserButton.querySelector('input[type=radio]:checked').focus();
|
80 |
+
break;
|
81 |
+
case 27:
|
82 |
+
player.hideSourcechooserSelector();
|
83 |
+
player.sourcechooserButton.querySelector('button').focus();
|
84 |
+
break;
|
85 |
+
default:
|
86 |
+
return true;
|
87 |
+
}
|
88 |
+
|
89 |
+
e.preventDefault();
|
90 |
+
e.stopPropagation();
|
91 |
+
}
|
92 |
+
});
|
93 |
+
|
94 |
+
player.sourcechooserButton.addEventListener('focusout', mejs.Utils.debounce(function () {
|
95 |
+
setTimeout(function () {
|
96 |
+
var parent = document.activeElement.closest('.' + t.options.classPrefix + 'sourcechooser-selector');
|
97 |
+
if (!parent) {
|
98 |
+
player.hideSourcechooserSelector();
|
99 |
+
}
|
100 |
+
}, 0);
|
101 |
+
}, 100));
|
102 |
+
|
103 |
+
var radios = player.sourcechooserButton.querySelectorAll('input[type=radio]');
|
104 |
+
|
105 |
+
for (var _i2 = 0, _total2 = radios.length; _i2 < _total2; _i2++) {
|
106 |
+
radios[_i2].addEventListener('click', function () {
|
107 |
+
this.setAttribute('aria-selected', true);
|
108 |
+
this.checked = true;
|
109 |
+
this.parentElement.className = 'sourcechooser-selected';
|
110 |
+
|
111 |
+
var otherRadios = this.closest('.' + t.options.classPrefix + 'sourcechooser-selector').querySelectorAll('input[type=radio]');
|
112 |
+
|
113 |
+
for (var j = 0, radioTotal = otherRadios.length; j < radioTotal; j++) {
|
114 |
+
if (otherRadios[j] !== this) {
|
115 |
+
otherRadios[j].setAttribute('aria-selected', 'false');
|
116 |
+
otherRadios[j].removeAttribute('checked');
|
117 |
+
otherRadios[j].parentElement.className = '';
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
var src = this.value;
|
122 |
+
|
123 |
+
if (media.getSrc() !== src) {
|
124 |
+
var currentTime = media.currentTime;
|
125 |
+
|
126 |
+
var paused = media.paused,
|
127 |
+
canPlayAfterSourceSwitchHandler = function canPlayAfterSourceSwitchHandler() {
|
128 |
+
if (!paused) {
|
129 |
+
media.setCurrentTime(currentTime);
|
130 |
+
media.play();
|
131 |
+
}
|
132 |
+
media.removeEventListener('canplay', canPlayAfterSourceSwitchHandler);
|
133 |
+
};
|
134 |
+
|
135 |
+
media.pause();
|
136 |
+
media.setSrc(src);
|
137 |
+
media.load();
|
138 |
+
media.addEventListener('canplay', canPlayAfterSourceSwitchHandler);
|
139 |
+
}
|
140 |
+
});
|
141 |
+
}
|
142 |
+
|
143 |
+
player.sourcechooserButton.querySelector('button').addEventListener('click', function () {
|
144 |
+
if (mejs.Utils.hasClass(mejs.Utils.siblings(this), t.options.classPrefix + 'offscreen')) {
|
145 |
+
player.showSourcechooserSelector();
|
146 |
+
player.sourcechooserButton.querySelector('input[type=radio]:checked').focus();
|
147 |
+
} else {
|
148 |
+
player.hideSourcechooserSelector();
|
149 |
+
}
|
150 |
+
});
|
151 |
+
},
|
152 |
+
addSourceButton: function addSourceButton(src, label, type, isCurrent) {
|
153 |
+
var t = this;
|
154 |
+
if (label === '' || label === undefined) {
|
155 |
+
label = src;
|
156 |
+
}
|
157 |
+
type = type.split('/')[1];
|
158 |
+
|
159 |
+
t.sourcechooserButton.querySelector('ul').innerHTML += '<li' + (isCurrent ? ' class="sourcechooser-selected"' : '') + '>' + ('<input type="radio" name="' + t.id + '_sourcechooser" id="' + t.id + '_sourcechooser_' + label + type + '" ') + ('role="menuitemradio" value="' + src + '" ' + (isCurrent ? 'checked="checked"' : '') + ' aria-selected="' + isCurrent + '"/>') + ('<label for="' + t.id + '_sourcechooser_' + label + type + '" aria-hidden="true">' + label + '</label>') + '</li>';
|
160 |
+
|
161 |
+
},
|
162 |
+
hideSourcechooserSelector: function hideSourcechooserSelector() {
|
163 |
+
|
164 |
+
var t = this;
|
165 |
+
|
166 |
+
if (t.sourcechooserButton === undefined || !t.sourcechooserButton.querySelector('input[type=radio]')) {
|
167 |
+
return;
|
168 |
+
}
|
169 |
+
|
170 |
+
var selector = t.sourcechooserButton.querySelector('.' + t.options.classPrefix + 'sourcechooser-selector'),
|
171 |
+
radios = selector.querySelectorAll('input[type=radio]');
|
172 |
+
selector.setAttribute('aria-expanded', 'false');
|
173 |
+
selector.setAttribute('aria-hidden', 'true');
|
174 |
+
mejs.Utils.addClass(selector, t.options.classPrefix + 'offscreen');
|
175 |
+
|
176 |
+
for (var i = 0, total = radios.length; i < total; i++) {
|
177 |
+
radios[i].setAttribute('tabindex', '-1');
|
178 |
+
}
|
179 |
+
},
|
180 |
+
showSourcechooserSelector: function showSourcechooserSelector() {
|
181 |
+
|
182 |
+
var t = this;
|
183 |
+
|
184 |
+
if (t.sourcechooserButton === undefined || !t.sourcechooserButton.querySelector('input[type=radio]')) {
|
185 |
+
return;
|
186 |
+
}
|
187 |
+
|
188 |
+
var selector = t.sourcechooserButton.querySelector('.' + t.options.classPrefix + 'sourcechooser-selector'),
|
189 |
+
radios = selector.querySelectorAll('input[type=radio]');
|
190 |
+
selector.setAttribute('aria-expanded', 'true');
|
191 |
+
selector.setAttribute('aria-hidden', 'false');
|
192 |
+
mejs.Utils.removeClass(selector, t.options.classPrefix + 'offscreen');
|
193 |
+
|
194 |
+
for (var i = 0, total = radios.length; i < total; i++) {
|
195 |
+
radios[i].setAttribute('tabindex', '0');
|
196 |
+
}
|
197 |
+
}
|
198 |
+
});
|
199 |
+
|
200 |
+
},{}]},{},[1]);
|
js/mejs-speed.js
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* MediaElement.js
|
3 |
+
* http://www.mediaelementjs.com/
|
4 |
+
*
|
5 |
+
* Wrapper that mimics native HTML5 MediaElement (audio and video)
|
6 |
+
* using a variety of technologies (pure JavaScript, Flash, iframe)
|
7 |
+
*
|
8 |
+
* Copyright 2010-2017, John Dyer (http://j.hn/)
|
9 |
+
* License: MIT
|
10 |
+
*
|
11 |
+
*/(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
12 |
+
'use strict';
|
13 |
+
|
14 |
+
Object.assign(mejs.MepDefaults, {
|
15 |
+
speeds: ['2.00', '1.50', '1.25', '1.00', '0.75'],
|
16 |
+
|
17 |
+
defaultSpeed: '1.00',
|
18 |
+
|
19 |
+
speedChar: 'x',
|
20 |
+
|
21 |
+
speedText: null
|
22 |
+
});
|
23 |
+
|
24 |
+
Object.assign(MediaElementPlayer.prototype, {
|
25 |
+
buildspeed: function buildspeed(player, controls, layers, media) {
|
26 |
+
var t = this,
|
27 |
+
isNative = t.media.rendererName !== null && /(native|html5)/i.test(t.media.rendererName);
|
28 |
+
|
29 |
+
if (!isNative) {
|
30 |
+
return;
|
31 |
+
}
|
32 |
+
|
33 |
+
var speeds = [],
|
34 |
+
speedTitle = mejs.Utils.isString(t.options.speedText) ? t.options.speedText : mejs.i18n.t('mejs.speed-rate'),
|
35 |
+
getSpeedNameFromValue = function getSpeedNameFromValue(value) {
|
36 |
+
for (var i = 0, total = speeds.length; i < total; i++) {
|
37 |
+
if (speeds[i].value === value) {
|
38 |
+
return speeds[i].name;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
};
|
42 |
+
|
43 |
+
var playbackSpeed = void 0,
|
44 |
+
defaultInArray = false;
|
45 |
+
|
46 |
+
for (var i = 0, total = t.options.speeds.length; i < total; i++) {
|
47 |
+
var s = t.options.speeds[i];
|
48 |
+
|
49 |
+
if (typeof s === 'string') {
|
50 |
+
speeds.push({
|
51 |
+
name: '' + s + t.options.speedChar,
|
52 |
+
value: s
|
53 |
+
});
|
54 |
+
|
55 |
+
if (s === t.options.defaultSpeed) {
|
56 |
+
defaultInArray = true;
|
57 |
+
}
|
58 |
+
} else {
|
59 |
+
speeds.push(s);
|
60 |
+
if (s.value === t.options.defaultSpeed) {
|
61 |
+
defaultInArray = true;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
if (!defaultInArray) {
|
67 |
+
speeds.push({
|
68 |
+
name: t.options.defaultSpeed + t.options.speedChar,
|
69 |
+
value: t.options.defaultSpeed
|
70 |
+
});
|
71 |
+
}
|
72 |
+
|
73 |
+
speeds.sort(function (a, b) {
|
74 |
+
return parseFloat(b.value) - parseFloat(a.value);
|
75 |
+
});
|
76 |
+
|
77 |
+
t.cleanspeed(player);
|
78 |
+
|
79 |
+
player.speedButton = document.createElement('div');
|
80 |
+
player.speedButton.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'speed-button';
|
81 |
+
player.speedButton.innerHTML = '<button type="button" aria-controls="' + t.id + '" title="' + speedTitle + '" ' + ('aria-label="' + speedTitle + '" tabindex="0">' + getSpeedNameFromValue(t.options.defaultSpeed) + '</button>') + ('<div class="' + t.options.classPrefix + 'speed-selector ' + t.options.classPrefix + 'offscreen">') + ('<ul class="' + t.options.classPrefix + 'speed-selector-list"></ul>') + '</div>';
|
82 |
+
|
83 |
+
t.addControlElement(player.speedButton, 'speed');
|
84 |
+
|
85 |
+
for (var _i = 0, _total = speeds.length; _i < _total; _i++) {
|
86 |
+
|
87 |
+
var inputId = t.id + '-speed-' + speeds[_i].value;
|
88 |
+
|
89 |
+
player.speedButton.querySelector('ul').innerHTML += '<li class="' + t.options.classPrefix + 'speed-selector-list-item' + (speeds[_i].value === t.options.defaultSpeed ? ' ' + t.options.classPrefix + 'speed-selected' : '') + '">' + ('<input class="' + t.options.classPrefix + 'speed-selector-input" type="radio" name="' + t.id + '_speed"') + ('disabled="disabled" value="' + speeds[_i].value + '" id="' + inputId + '" ') + ((speeds[_i].value === t.options.defaultSpeed ? ' checked="checked"' : '') + '/>') + ('<label for="' + inputId + '" class="' + t.options.classPrefix + 'speed-selector-label') + ((speeds[_i].value === t.options.defaultSpeed ? ' ' + t.options.classPrefix + 'speed-selected' : '') + '">') + (speeds[_i].name + '</label>') + '</li>';
|
90 |
+
}
|
91 |
+
|
92 |
+
playbackSpeed = t.options.defaultSpeed;
|
93 |
+
|
94 |
+
player.speedSelector = player.speedButton.querySelector('.' + t.options.classPrefix + 'speed-selector');
|
95 |
+
|
96 |
+
var inEvents = ['mouseenter', 'focusin'],
|
97 |
+
outEvents = ['mouseleave', 'focusout'],
|
98 |
+
radios = player.speedButton.querySelectorAll('input[type="radio"]'),
|
99 |
+
labels = player.speedButton.querySelectorAll('.' + t.options.classPrefix + 'speed-selector-label');
|
100 |
+
|
101 |
+
for (var _i2 = 0, _total2 = inEvents.length; _i2 < _total2; _i2++) {
|
102 |
+
player.speedButton.addEventListener(inEvents[_i2], function () {
|
103 |
+
mejs.Utils.removeClass(player.speedSelector, t.options.classPrefix + 'offscreen');
|
104 |
+
player.speedSelector.style.height = player.speedSelector.querySelector('ul').offsetHeight;
|
105 |
+
player.speedSelector.style.top = -1 * parseFloat(player.speedSelector.offsetHeight) + 'px';
|
106 |
+
});
|
107 |
+
}
|
108 |
+
|
109 |
+
for (var _i3 = 0, _total3 = outEvents.length; _i3 < _total3; _i3++) {
|
110 |
+
player.speedSelector.addEventListener(outEvents[_i3], function () {
|
111 |
+
mejs.Utils.addClass(this, t.options.classPrefix + 'offscreen');
|
112 |
+
});
|
113 |
+
}
|
114 |
+
|
115 |
+
for (var _i4 = 0, _total4 = radios.length; _i4 < _total4; _i4++) {
|
116 |
+
var radio = radios[_i4];
|
117 |
+
radio.disabled = false;
|
118 |
+
radio.addEventListener('click', function () {
|
119 |
+
var self = this,
|
120 |
+
newSpeed = self.value;
|
121 |
+
|
122 |
+
playbackSpeed = newSpeed;
|
123 |
+
media.playbackRate = parseFloat(newSpeed);
|
124 |
+
player.speedButton.querySelector('button').innerHTML = getSpeedNameFromValue(newSpeed);
|
125 |
+
var selected = player.speedButton.querySelectorAll('.' + t.options.classPrefix + 'speed-selected');
|
126 |
+
for (var _i5 = 0, _total5 = selected.length; _i5 < _total5; _i5++) {
|
127 |
+
mejs.Utils.removeClass(selected[_i5], t.options.classPrefix + 'speed-selected');
|
128 |
+
}
|
129 |
+
|
130 |
+
self.checked = true;
|
131 |
+
var siblings = mejs.Utils.siblings(self, function (el) {
|
132 |
+
return mejs.Utils.hasClass(el, t.options.classPrefix + 'speed-selector-label');
|
133 |
+
});
|
134 |
+
for (var j = 0, _total6 = siblings.length; j < _total6; j++) {
|
135 |
+
mejs.Utils.addClass(siblings[j], t.options.classPrefix + 'speed-selected');
|
136 |
+
mejs.Utils.addClass(siblings[j].parentElement, t.options.classPrefix + 'speed-selected');
|
137 |
+
}
|
138 |
+
|
139 |
+
});
|
140 |
+
}
|
141 |
+
|
142 |
+
for (var _i6 = 0, _total7 = labels.length; _i6 < _total7; _i6++) {
|
143 |
+
labels[_i6].addEventListener('click', function () {
|
144 |
+
var radio = mejs.Utils.siblings(this, function (el) {
|
145 |
+
return el.tagName === 'INPUT';
|
146 |
+
})[0],
|
147 |
+
event = mejs.Utils.createEvent('click', radio);
|
148 |
+
radio.dispatchEvent(event);
|
149 |
+
});
|
150 |
+
}
|
151 |
+
|
152 |
+
player.speedSelector.addEventListener('keydown', function (e) {
|
153 |
+
e.stopPropagation();
|
154 |
+
});
|
155 |
+
|
156 |
+
media.addEventListener('loadedmetadata', function () {
|
157 |
+
if (playbackSpeed) {
|
158 |
+
media.playbackRate = parseFloat(playbackSpeed);
|
159 |
+
}
|
160 |
+
});
|
161 |
+
},
|
162 |
+
cleanspeed: function cleanspeed(player) {
|
163 |
+
if (player) {
|
164 |
+
if (player.speedButton) {
|
165 |
+
player.speedButton.parentNode.removeChild(player.speedButton);
|
166 |
+
}
|
167 |
+
if (player.speedSelector) {
|
168 |
+
player.speedSelector.parentNode.removeChild(player.speedSelector);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
});
|
173 |
+
|
174 |
+
},{}]},{},[1]);
|
js/mep-speed.js
CHANGED
@@ -1 +1,170 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Speed button
|
6 |
+
*
|
7 |
+
* This feature creates a button to speed media in different levels.
|
8 |
+
*/
|
9 |
+
|
10 |
+
// Translations (English required)
|
11 |
+
mejs.i18n.en["mejs.speed"] = "Speed Rate";
|
12 |
+
|
13 |
+
|
14 |
+
// Feature configuration
|
15 |
+
Object.assign(mejs.MepDefaults, {
|
16 |
+
/**
|
17 |
+
* The speeds media can be accelerated
|
18 |
+
*
|
19 |
+
* Supports an array of float values or objects with format
|
20 |
+
* [{name: 'Slow', value: '0.75'}, {name: 'Normal', value: '1.00'}, ...]
|
21 |
+
* @type {{String[]|Object[]}}
|
22 |
+
*/
|
23 |
+
speeds: ['2.00', '1.50', '1.25', '1.00', '0.75'],
|
24 |
+
/**
|
25 |
+
* @type {String}
|
26 |
+
*/
|
27 |
+
defaultSpeed: '1.00',
|
28 |
+
/**
|
29 |
+
* @type {String}
|
30 |
+
*/
|
31 |
+
speedChar: 'x',
|
32 |
+
/**
|
33 |
+
* @type {?String}
|
34 |
+
*/
|
35 |
+
speedText: ''
|
36 |
+
});
|
37 |
+
|
38 |
+
Object.assign(MediaElementPlayer.prototype, {
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Feature constructor.
|
42 |
+
*
|
43 |
+
* Always has to be prefixed with `build` and the name that will be used in MepDefaults.features list
|
44 |
+
* @param {MediaElementPlayer} player
|
45 |
+
* @param {$} controls
|
46 |
+
* @param {$} layers
|
47 |
+
* @param {HTMLElement} media
|
48 |
+
*/
|
49 |
+
buildspeed: function buildspeed(player, controls, layers, media) {
|
50 |
+
var t = this,
|
51 |
+
isNative = t.media.rendererName !== null && t.media.rendererName.match(/(native|html5)/) !== null;
|
52 |
+
|
53 |
+
if (!isNative) {
|
54 |
+
return;
|
55 |
+
}
|
56 |
+
|
57 |
+
var playbackSpeed = void 0,
|
58 |
+
inputId = void 0,
|
59 |
+
speedTitle = mejs.Utils.isString(t.options.speedText) ? t.options.speedText : 'mejs.i18n.t(mejs.speed)',
|
60 |
+
speeds = [],
|
61 |
+
defaultInArray = false,
|
62 |
+
getSpeedNameFromValue = function getSpeedNameFromValue(value) {
|
63 |
+
for (var i = 0, len = speeds.length; i < len; i++) {
|
64 |
+
if (speeds[i].value === value) {
|
65 |
+
return speeds[i].name;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
};
|
69 |
+
|
70 |
+
for (var i = 0, len = t.options.speeds.length; i < len; i++) {
|
71 |
+
var s = t.options.speeds[i];
|
72 |
+
|
73 |
+
if (typeof s === 'string') {
|
74 |
+
speeds.push({
|
75 |
+
name: "" + s + t.options.speedChar,
|
76 |
+
value: s
|
77 |
+
});
|
78 |
+
if (s === t.options.defaultSpeed) {
|
79 |
+
defaultInArray = true;
|
80 |
+
}
|
81 |
+
} else {
|
82 |
+
speeds.push(s);
|
83 |
+
if (s.value === t.options.defaultSpeed) {
|
84 |
+
defaultInArray = true;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
if (!defaultInArray) {
|
90 |
+
speeds.push({
|
91 |
+
name: t.options.defaultSpeed + t.options.speedChar,
|
92 |
+
value: t.options.defaultSpeed
|
93 |
+
});
|
94 |
+
}
|
95 |
+
|
96 |
+
speeds.sort(function (a, b) {
|
97 |
+
return parseFloat(b.value) - parseFloat(a.value);
|
98 |
+
});
|
99 |
+
|
100 |
+
t.clearspeed(player);
|
101 |
+
|
102 |
+
player.speedButton = $("<div class=\"" + t.options.classPrefix + "button " + t.options.classPrefix + "speed-button\">" + ("<button type=\"button\" aria-controls=\"" + t.id + "\" title=\"" + speedTitle + "\" ") + ("aria-label=\"" + speedTitle + "\" tabindex=\"0\">" + getSpeedNameFromValue(t.options.defaultSpeed) + "</button>") + ("<div class=\"" + t.options.classPrefix + "speed-selector " + t.options.classPrefix + "offscreen\">") + ("<ul class=\"" + t.options.classPrefix + "speed-selector-list\"></ul>") + "</div>" + "</div>");
|
103 |
+
|
104 |
+
t.addControlElement(player.speedButton, 'speed');
|
105 |
+
|
106 |
+
for (var _i = 0, il = speeds.length; _i < il; _i++) {
|
107 |
+
|
108 |
+
inputId = t.id + "-speed-" + speeds[_i].value;
|
109 |
+
|
110 |
+
player.speedButton.find('ul').append($("<li class=\"" + t.options.classPrefix + "speed-selector-list-item\">" + ("<input class=\"" + t.options.classPrefix + "speed-selector-input\" type=\"radio\" name=\"" + t.id + "_speed\"") + ("disabled=\"disabled\" value=\"" + speeds[_i].value + "\" id=\"" + inputId + "\" ") + ((speeds[_i].value === t.options.defaultSpeed ? ' checked="checked"' : '') + "/>") + ("<label class=\"" + t.options.classPrefix + "speed-selector-label") + ((speeds[_i].value === t.options.defaultSpeed ? " " + t.options.classPrefix + "speed-selected" : '') + "\">") + (speeds[_i].name + "</label>") + "</li>"));
|
111 |
+
}
|
112 |
+
|
113 |
+
playbackSpeed = t.options.defaultSpeed;
|
114 |
+
|
115 |
+
// Enable inputs after they have been appended to controls to avoid tab and up/down arrow focus issues
|
116 |
+
$.each(player.speedButton.find('input[type="radio"]'), function () {
|
117 |
+
$(this).prop('disabled', false);
|
118 |
+
});
|
119 |
+
|
120 |
+
player.speedSelector = player.speedButton.find("." + t.options.classPrefix + "speed-selector");
|
121 |
+
|
122 |
+
// hover or keyboard focus
|
123 |
+
player.speedButton.on('mouseenter focusin', function () {
|
124 |
+
player.speedSelector.removeClass(t.options.classPrefix + "offscreen").height(player.speedSelector.find('ul').outerHeight(true)).css('top', -1 * player.speedSelector.height() + 'px');
|
125 |
+
}).on('mouseleave focusout', function () {
|
126 |
+
player.speedSelector.addClass(t.options.classPrefix + "offscreen");
|
127 |
+
})
|
128 |
+
// handle clicks to the language radio buttons
|
129 |
+
.on('click', 'input[type=radio]', function () {
|
130 |
+
var self = $(this),
|
131 |
+
newSpeed = self.val();
|
132 |
+
|
133 |
+
playbackSpeed = newSpeed;
|
134 |
+
media.playbackRate = parseFloat(newSpeed);
|
135 |
+
player.speedButton.find('button').html(getSpeedNameFromValue(newSpeed)).end().find("." + t.options.classPrefix + "speed-selected").removeClass(t.options.classPrefix + "speed-selected").end().find('input[type="radio"]');
|
136 |
+
|
137 |
+
self.prop('checked', true).siblings("." + t.options.classPrefix + "speed-selector-label").addClass(t.options.classPrefix + "speed-selected");
|
138 |
+
}).on('click', "." + t.options.classPrefix + "speed-selector-label", function () {
|
139 |
+
$(this).siblings('input[type="radio"]').trigger('click');
|
140 |
+
})
|
141 |
+
//Allow up/down arrow to change the selected radio without changing the volume.
|
142 |
+
.on('keydown', function (e) {
|
143 |
+
e.stopPropagation();
|
144 |
+
});
|
145 |
+
|
146 |
+
media.addEventListener('loadedmetadata', function () {
|
147 |
+
if (playbackSpeed) {
|
148 |
+
media.playbackRate = parseFloat(playbackSpeed);
|
149 |
+
}
|
150 |
+
}, true);
|
151 |
+
},
|
152 |
+
/**
|
153 |
+
* Feature destructor.
|
154 |
+
*
|
155 |
+
* Always has to be prefixed with `clean` and the name that was used in MepDefaults.features list
|
156 |
+
* @param {MediaElementPlayer} player
|
157 |
+
*/
|
158 |
+
clearspeed: function clearspeed(player) {
|
159 |
+
if (player) {
|
160 |
+
if (player.speedButton) {
|
161 |
+
player.speedButton.remove();
|
162 |
+
}
|
163 |
+
if (player.speedSelector) {
|
164 |
+
player.speedSelector.remove();
|
165 |
+
}
|
166 |
+
}
|
167 |
+
}
|
168 |
+
});
|
169 |
+
|
170 |
+
},{}]},{},[1]);
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ 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: 4.
|
7 |
-
Stable tag: 4.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -246,6 +246,13 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
|
|
246 |
|
247 |
== Changelog ==
|
248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
= 4.6.19 - November 2, 2017 =
|
250 |
* Fixed shorthand array declaration to retain compatiblity with versions of PHP older than 5.4.
|
251 |
|
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: 4.9
|
7 |
+
Stable tag: 4.6.20
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
246 |
|
247 |
== Changelog ==
|
248 |
|
249 |
+
= 4.6.20 - November 14, 2017 =
|
250 |
+
* Updated WordPress Default player resizing methods and speed and resolution selector plugins for the new player included with WordPress 4.9.
|
251 |
+
* Added 480p resolution option.
|
252 |
+
* Added option to hide unwanted encode formats from the attachment pages and encode queue.
|
253 |
+
* Fixed bug that prevented 360p encoding for videos less than 480p.
|
254 |
+
* Fixed bug that did not automatically select default encoding formats.
|
255 |
+
|
256 |
= 4.6.19 - November 2, 2017 =
|
257 |
* Fixed shorthand array declaration to retain compatiblity with versions of PHP older than 5.4.
|
258 |
|
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,
|
@@ -69,6 +69,7 @@ function kgvid_default_options_fn() {
|
|
69 |
"encode_fullres" => false,
|
70 |
"encode_1080" => "on",
|
71 |
"encode_720" => "on",
|
|
|
72 |
"encode_mobile" => "on",
|
73 |
"encode_webm" => false,
|
74 |
"encode_vp9" => false,
|
@@ -79,6 +80,7 @@ function kgvid_default_options_fn() {
|
|
79 |
'width' => '',
|
80 |
'height' => ''
|
81 |
),
|
|
|
82 |
"app_path" => "/usr/local/bin",
|
83 |
"video_app" => "ffmpeg",
|
84 |
"ffmpeg_exists" =>"notchecked",
|
@@ -268,12 +270,13 @@ function kgvid_get_attachment_meta($post_id) {
|
|
268 |
'play_75' => '0',
|
269 |
'completeviews' => '0',
|
270 |
'pickedformat' => '',
|
271 |
-
'
|
272 |
-
'
|
273 |
-
'
|
274 |
-
'
|
275 |
-
'
|
276 |
-
'
|
|
|
277 |
'encodecustom_h264' => '',
|
278 |
'encodecustom_webm' => '',
|
279 |
'encodecustom_ogg' => '',
|
@@ -416,11 +419,23 @@ function kgvid_video_formats( $return_replace = false, $return_customs = true )
|
|
416 |
"old_suffix" => "-720.m4v",
|
417 |
"vcodec" => "libx264"
|
418 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
"mobile" => array(
|
420 |
"name" => "360p H.264",
|
421 |
"label" => '360p',
|
422 |
"width" => 640,
|
423 |
-
"height" =>
|
424 |
"type" => "h264",
|
425 |
"extension" => "mp4",
|
426 |
"suffix" => "-360.mp4",
|
@@ -1232,12 +1247,6 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
1232 |
'filepath' => $uploads['basedir']."/html5encodes/".$encodevideo_info['moviefilebasename'].$old_suffix ),
|
1233 |
);
|
1234 |
if ( !array_key_exists('old_suffix', $format_stats) ) { unset($potential_locations['same_directory_old_suffix']); }
|
1235 |
-
if ( $format == 'mobile' ) {
|
1236 |
-
$potential_locations['480p'] = array(
|
1237 |
-
'url' => $sanitized_url['noextension'].'-480.mp4',
|
1238 |
-
'filepath' => $encodevideo_info['encodepath'].$encodevideo_info['moviefilebasename'].'-480.mp4'
|
1239 |
-
);
|
1240 |
-
}
|
1241 |
|
1242 |
foreach ( $potential_locations as $name => $location ) {
|
1243 |
|
@@ -2041,10 +2050,6 @@ function kgvid_enqueue_shortcode_scripts() {
|
|
2041 |
wp_enqueue_script( 'swfobject' );
|
2042 |
}
|
2043 |
|
2044 |
-
if ( $options['embed_method'] == "Wordpress Default" ) {
|
2045 |
-
wp_register_script( 'mejs-speed', plugins_url( 'js/mep-speed.js', __FILE__ ), array( 'mediaelement' ), $options['version'], true );
|
2046 |
-
}
|
2047 |
-
|
2048 |
if ( !wp_script_is('kgvid_video_embed', 'enqueued') ) {
|
2049 |
|
2050 |
wp_enqueue_script( 'kgvid_video_embed', plugins_url("/js/kgvid_video_embed.js", __FILE__), array('jquery'), $options['version'], true );
|
@@ -2274,6 +2279,8 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2274 |
global $kgvid_video_id;
|
2275 |
if ( !$kgvid_video_id ) { $kgvid_video_id = 0; }
|
2276 |
|
|
|
|
|
2277 |
$options = kgvid_get_options();
|
2278 |
$code = "";
|
2279 |
$id_array = array();
|
@@ -2580,7 +2587,11 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2580 |
|
2581 |
} //if Strobe Media
|
2582 |
|
2583 |
-
$code .= '<div id="kgvid_'.$div_suffix.'_wrapper" class="kgvid_wrapper'
|
|
|
|
|
|
|
|
|
2584 |
$code .= '<div id="video_'.$div_suffix.'_div" class="fitvidsignore kgvid_videodiv" data-id="'.$div_suffix.'" data-kgvid_video_vars="'.esc_attr(json_encode($video_variables)).'" ';
|
2585 |
if ( $query_atts["schema"] == "true" ) {
|
2586 |
$code .= 'itemprop="video" itemscope itemtype="https://schema.org/VideoObject">';
|
@@ -2707,12 +2718,20 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2707 |
|
2708 |
$wpmejssettings = array(
|
2709 |
'features' => array( 'playpause', 'progress', 'volume', 'tracks' ),
|
|
|
|
|
2710 |
'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
|
2711 |
'success' => 'kgvid_mejs_success'
|
2712 |
);
|
2713 |
|
2714 |
if ( $enable_resolutions_plugin && !wp_script_is('mejs_sourcechooser', 'enqueued') ) {
|
2715 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2716 |
array_push($wpmejssettings['features'], 'sourcechooser');
|
2717 |
$localize = true;
|
2718 |
}
|
@@ -2724,6 +2743,13 @@ function kgvid_single_video_code($query_atts, $atts, $content, $post_id) {
|
|
2724 |
if ( $query_atts['playback_rate'] == 'true' ) {
|
2725 |
array_push($wpmejssettings['features'], 'speed');
|
2726 |
$wpmejssettings['speeds'] = array('0.5', '1', '1.25', '1.5', '2');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2727 |
}
|
2728 |
|
2729 |
array_push($wpmejssettings['features'], 'fullscreen');
|
@@ -3603,7 +3629,7 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page, $blog_id =
|
|
3603 |
|
3604 |
if ( $format_stats['status'] == "lowres" ||
|
3605 |
(
|
3606 |
-
$actualheight != "" &&
|
3607 |
(
|
3608 |
( strpos($post_mime_type, "mp4") !== false && $actualheight <= $format_stats['height'] ) ||
|
3609 |
( strpos($post_mime_type, "mp4") === false && $actualheight < $format_stats['height'] )
|
@@ -3611,7 +3637,12 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page, $blog_id =
|
|
3611 |
)
|
3612 |
) { continue; } //if the format is bigger than the original video, skip the checkbox
|
3613 |
|
3614 |
-
if ( !empty($encodevideo_info) && !$encodevideo_info[$format]['exists']
|
|
|
|
|
|
|
|
|
|
|
3615 |
|
3616 |
if ( $format == 'fullres' ) {
|
3617 |
|
@@ -4757,14 +4788,15 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
4757 |
echo "</select> ";
|
4758 |
|
4759 |
|
4760 |
-
echo "</label> <span class='kgvid_tooltip wp-ui-text-highlight'><span class='kgvid_tooltip_classic'>".__('If you have FFMPEG/LIBAV and the proper libraries installed, you can choose to replace your uploaded video with your preferred format, and also transcode into
|
4761 |
-
echo "<input ".checked( $options['encode_1080'], "on", false )." id='encode_1080' name='kgvid_video_embed_options[encode_1080]' type='checkbox' /> <label for='encode_1080'>1080p H.264
|
4762 |
-
echo "<input ".checked( $options['encode_720'], "on", false )." id='encode_720' name='kgvid_video_embed_options[encode_720]' type='checkbox' /> <label for='encode_720'>720p H.264
|
4763 |
-
echo "<input ".checked( $options['
|
|
|
4764 |
echo "<input ".checked( $options['encode_webm'], "on", false )." id='encode_webm' name='kgvid_video_embed_options[encode_webm]' type='checkbox' /> <label for='encode_webm'>WEBM <small><em>(Firefox, Chrome, Android 2.3+, Opera)</em></small></label><br />";
|
4765 |
-
echo "<input ".checked( $options['encode_vp9'], "on", false )." id='encode_vp9' name='kgvid_video_embed_options[encode_vp9]' type='checkbox' /> <label for='encode_vp9'>WEBM VP9 <small><em>(Firefox, Chrome, Opera)</em></small></label><br />";
|
4766 |
echo "<input ".checked( $options['encode_ogg'], "on", false )." id='encode_ogg' name='kgvid_video_embed_options[encode_ogg]' type='checkbox' /> <label for='encode_ogg'>OGV <small><em>(Firefox, Chrome, Android 2.3+, Opera)</em></small></label><br />";
|
4767 |
-
echo "<input ".checked( $options['encode_custom'], "on", false )." id='encode_custom' name='kgvid_video_embed_options[encode_custom]' type='checkbox' /> <label for='encode_custom'>Custom
|
4768 |
$items = array( "H.264" => "h264" , "WEBM" => "webm", "OGV" => "ogg" );
|
4769 |
echo " <select id='custom_format_type' name='kgvid_video_embed_options[custom_format][format]' class='affects_ffmpeg'>";
|
4770 |
foreach($items as $name=>$value) {
|
@@ -4772,7 +4804,8 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
4772 |
echo "<option value='$value' $selected>$name</option>";
|
4773 |
}
|
4774 |
echo "</select> ";
|
4775 |
-
echo "<small>Width: <input id='custom_format_width' name='kgvid_video_embed_options[custom_format][width]' class='small-text affects_ffmpeg kgvid_custom_format' value='".$options['custom_format']['width']."' /> Height: <input id='custom_format_height' name='kgvid_video_embed_options[custom_format][height]' class='small-text affects_ffmpeg kgvid_custom_format' value='".$options['custom_format']['height']."' /></small></label
|
|
|
4776 |
echo "</div>\n\t";
|
4777 |
}
|
4778 |
|
@@ -5291,6 +5324,12 @@ function kgvid_update_settings() {
|
|
5291 |
}
|
5292 |
}
|
5293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5294 |
if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
|
5295 |
if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
|
5296 |
}
|
@@ -7114,7 +7153,7 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id, $
|
|
7114 |
foreach ( $video_formats as $format => $format_stats ) {
|
7115 |
if ( array_key_exists($format, $encode_checked) && $encode_checked[$format] == "true" ) {
|
7116 |
if ( !$encodevideo_info[$format]['exists'] ) {
|
7117 |
-
if (
|
7118 |
(
|
7119 |
( strpos($mime_type_check['type'], "mp4") !== false && $movie_height <= $format_stats['height'] ) ||
|
7120 |
( strpos($mime_type_check['type'], "mp4") === false && $movie_height < $format_stats['height'] )
|
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.20
|
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.20',
|
64 |
"embed_method" => "Video.js",
|
65 |
"jw_player_id" => "",
|
66 |
"template" => false,
|
69 |
"encode_fullres" => false,
|
70 |
"encode_1080" => "on",
|
71 |
"encode_720" => "on",
|
72 |
+
"encode_480" => "on",
|
73 |
"encode_mobile" => "on",
|
74 |
"encode_webm" => false,
|
75 |
"encode_vp9" => false,
|
80 |
'width' => '',
|
81 |
'height' => ''
|
82 |
),
|
83 |
+
"hide_video_formats" => "on",
|
84 |
"app_path" => "/usr/local/bin",
|
85 |
"video_app" => "ffmpeg",
|
86 |
"ffmpeg_exists" =>"notchecked",
|
270 |
'play_75' => '0',
|
271 |
'completeviews' => '0',
|
272 |
'pickedformat' => '',
|
273 |
+
'encode_fullres' => '',
|
274 |
+
'encode_1080' => '',
|
275 |
+
'encode_720' => '',
|
276 |
+
'encode_480' => '',
|
277 |
+
'encode_mobile' => '',
|
278 |
+
'encode_webm' => '',
|
279 |
+
'encode_ogg' => '',
|
280 |
'encodecustom_h264' => '',
|
281 |
'encodecustom_webm' => '',
|
282 |
'encodecustom_ogg' => '',
|
419 |
"old_suffix" => "-720.m4v",
|
420 |
"vcodec" => "libx264"
|
421 |
),
|
422 |
+
"480" => array(
|
423 |
+
"name" => "480p H.264",
|
424 |
+
"label" => '480p',
|
425 |
+
"width" => 854,
|
426 |
+
"height" => 480,
|
427 |
+
"type" => "h264",
|
428 |
+
"extension" => "mp4",
|
429 |
+
"mime" => "video/mp4",
|
430 |
+
"suffix" => "-480.mp4",
|
431 |
+
"old_suffix" => "-480.m4v",
|
432 |
+
"vcodec" => "libx264"
|
433 |
+
),
|
434 |
"mobile" => array(
|
435 |
"name" => "360p H.264",
|
436 |
"label" => '360p',
|
437 |
"width" => 640,
|
438 |
+
"height" => 360,
|
439 |
"type" => "h264",
|
440 |
"extension" => "mp4",
|
441 |
"suffix" => "-360.mp4",
|
1247 |
'filepath' => $uploads['basedir']."/html5encodes/".$encodevideo_info['moviefilebasename'].$old_suffix ),
|
1248 |
);
|
1249 |
if ( !array_key_exists('old_suffix', $format_stats) ) { unset($potential_locations['same_directory_old_suffix']); }
|
|
|
|
|
|
|
|
|
|
|
|
|
1250 |
|
1251 |
foreach ( $potential_locations as $name => $location ) {
|
1252 |
|
2050 |
wp_enqueue_script( 'swfobject' );
|
2051 |
}
|
2052 |
|
|
|
|
|
|
|
|
|
2053 |
if ( !wp_script_is('kgvid_video_embed', 'enqueued') ) {
|
2054 |
|
2055 |
wp_enqueue_script( 'kgvid_video_embed', plugins_url("/js/kgvid_video_embed.js", __FILE__), array('jquery'), $options['version'], true );
|
2279 |
global $kgvid_video_id;
|
2280 |
if ( !$kgvid_video_id ) { $kgvid_video_id = 0; }
|
2281 |
|
2282 |
+
global $wp_version;
|
2283 |
+
|
2284 |
$options = kgvid_get_options();
|
2285 |
$code = "";
|
2286 |
$id_array = array();
|
2587 |
|
2588 |
} //if Strobe Media
|
2589 |
|
2590 |
+
$code .= '<div id="kgvid_'.$div_suffix.'_wrapper" class="kgvid_wrapper';
|
2591 |
+
if ( $wp_version < 4.9 && $options['embed_method'] == "WordPress Default" ) {
|
2592 |
+
$code .= ' kgvid_compat_mep';
|
2593 |
+
}
|
2594 |
+
$code .= $aligncode.'">'."\n\t\t\t";
|
2595 |
$code .= '<div id="video_'.$div_suffix.'_div" class="fitvidsignore kgvid_videodiv" data-id="'.$div_suffix.'" data-kgvid_video_vars="'.esc_attr(json_encode($video_variables)).'" ';
|
2596 |
if ( $query_atts["schema"] == "true" ) {
|
2597 |
$code .= 'itemprop="video" itemscope itemtype="https://schema.org/VideoObject">';
|
2718 |
|
2719 |
$wpmejssettings = array(
|
2720 |
'features' => array( 'playpause', 'progress', 'volume', 'tracks' ),
|
2721 |
+
'classPrefix' => 'mejs-',
|
2722 |
+
'stretching' => 'responsive',
|
2723 |
'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
|
2724 |
'success' => 'kgvid_mejs_success'
|
2725 |
);
|
2726 |
|
2727 |
if ( $enable_resolutions_plugin && !wp_script_is('mejs_sourcechooser', 'enqueued') ) {
|
2728 |
+
if ( $wp_version >= 4.9 ) {
|
2729 |
+
$sourcechooser_path = plugins_url( 'js/mejs-source-chooser.js', __FILE__ );
|
2730 |
+
}
|
2731 |
+
else {
|
2732 |
+
$sourcechooser_path = plugins_url( 'js/mep-feature-sourcechooser.js', __FILE__ );
|
2733 |
+
}
|
2734 |
+
wp_enqueue_script( 'mejs_sourcechooser', $sourcechooser_path, array( 'mediaelement' ), $options['version'], true );
|
2735 |
array_push($wpmejssettings['features'], 'sourcechooser');
|
2736 |
$localize = true;
|
2737 |
}
|
2743 |
if ( $query_atts['playback_rate'] == 'true' ) {
|
2744 |
array_push($wpmejssettings['features'], 'speed');
|
2745 |
$wpmejssettings['speeds'] = array('0.5', '1', '1.25', '1.5', '2');
|
2746 |
+
if ( $wp_version >= 4.9 ) {
|
2747 |
+
$speed_path = plugins_url( 'js/mejs-speed.js', __FILE__ );
|
2748 |
+
}
|
2749 |
+
else {
|
2750 |
+
$speed_path = plugins_url( 'js/mep-speed.js', __FILE__ );;
|
2751 |
+
}
|
2752 |
+
wp_enqueue_script( 'mejs-speed', $speed_path, array( 'mediaelement' ), $options['version'], true );
|
2753 |
}
|
2754 |
|
2755 |
array_push($wpmejssettings['features'], 'fullscreen');
|
3629 |
|
3630 |
if ( $format_stats['status'] == "lowres" ||
|
3631 |
(
|
3632 |
+
$actualheight != "" && $format_stats['type'] == "h264" && $format != "fullres" &&
|
3633 |
(
|
3634 |
( strpos($post_mime_type, "mp4") !== false && $actualheight <= $format_stats['height'] ) ||
|
3635 |
( strpos($post_mime_type, "mp4") === false && $actualheight < $format_stats['height'] )
|
3637 |
)
|
3638 |
) { continue; } //if the format is bigger than the original video, skip the checkbox
|
3639 |
|
3640 |
+
if ( !empty($encodevideo_info) && !$encodevideo_info[$format]['exists']
|
3641 |
+
&& (
|
3642 |
+
strpos($format, 'custom_') === 0 //skip custom formats that don't exist
|
3643 |
+
|| ( $format != 'fullres' && $options['encode_'.$format] == false && $options['hide_video_formats'] )
|
3644 |
+
)
|
3645 |
+
) { continue; }
|
3646 |
|
3647 |
if ( $format == 'fullres' ) {
|
3648 |
|
4788 |
echo "</select> ";
|
4789 |
|
4790 |
|
4791 |
+
echo "</label> <span class='kgvid_tooltip wp-ui-text-highlight'><span class='kgvid_tooltip_classic'>".__('If you have FFMPEG/LIBAV and the proper libraries installed, you can choose to replace your uploaded video with your preferred format, and also transcode into several additional formats depending on the resolution of your original source. Different browsers have different playback capabilities. Most desktop browsers can play H.264, and all modern mobile devices can play at least 360p H.264. If you create multiple H.264 resolutions, the highest resolution supported by the device will be served up automatically. The plugin will not upconvert your video, so if you upload a 720p video, it will not waste your time creating a 1080p version. There was a time when it seemed like a good idea to provide OGV or WEBM for some desktop browsers, but even Firefox allows H.264 playback on most operating systems now. I no longer recommend encoding OGV or WEBM. WEBM VP9 is a new technology and requires a version of FFMPEG or LIBAV newer than October 2013. Most browsers except Safari currently support it.', 'video-embed-thumbnail-generator')."</span></span><br />";
|
4792 |
+
echo "<input ".checked( $options['encode_1080'], "on", false )." id='encode_1080' name='kgvid_video_embed_options[encode_1080]' type='checkbox' /> <label for='encode_1080'>1080p H.264</label><br />";
|
4793 |
+
echo "<input ".checked( $options['encode_720'], "on", false )." id='encode_720' name='kgvid_video_embed_options[encode_720]' type='checkbox' /> <label for='encode_720'>720p H.264</label><br />";
|
4794 |
+
echo "<input ".checked( $options['encode_480'], "on", false )." id='encode_480' name='kgvid_video_embed_options[encode_480]' type='checkbox' /> <label for='encode_480'>480p H.264</label><br />";
|
4795 |
+
echo "<input ".checked( $options['encode_mobile'], "on", false )." id='encode_mobile' name='kgvid_video_embed_options[encode_mobile]' type='checkbox' /> <label for='encode_mobile'>360p H.264</label><br />";
|
4796 |
echo "<input ".checked( $options['encode_webm'], "on", false )." id='encode_webm' name='kgvid_video_embed_options[encode_webm]' type='checkbox' /> <label for='encode_webm'>WEBM <small><em>(Firefox, Chrome, Android 2.3+, Opera)</em></small></label><br />";
|
4797 |
+
echo "<input ".checked( $options['encode_vp9'], "on", false )." id='encode_vp9' name='kgvid_video_embed_options[encode_vp9]' type='checkbox' /> <label for='encode_vp9'>WEBM VP9 <small><em>(Android 4.4+, Firefox, Chrome, Opera, Edge)</em></small></label><br />";
|
4798 |
echo "<input ".checked( $options['encode_ogg'], "on", false )." id='encode_ogg' name='kgvid_video_embed_options[encode_ogg]' type='checkbox' /> <label for='encode_ogg'>OGV <small><em>(Firefox, Chrome, Android 2.3+, Opera)</em></small></label><br />";
|
4799 |
+
echo "<input ".checked( $options['encode_custom'], "on", false )." id='encode_custom' name='kgvid_video_embed_options[encode_custom]' type='checkbox' /> <label for='encode_custom'>".__('Custom', 'video-embed-thumbnail-generator');
|
4800 |
$items = array( "H.264" => "h264" , "WEBM" => "webm", "OGV" => "ogg" );
|
4801 |
echo " <select id='custom_format_type' name='kgvid_video_embed_options[custom_format][format]' class='affects_ffmpeg'>";
|
4802 |
foreach($items as $name=>$value) {
|
4804 |
echo "<option value='$value' $selected>$name</option>";
|
4805 |
}
|
4806 |
echo "</select> ";
|
4807 |
+
echo "<small>Width: <input id='custom_format_width' name='kgvid_video_embed_options[custom_format][width]' class='small-text affects_ffmpeg kgvid_custom_format' value='".$options['custom_format']['width']."' /> Height: <input id='custom_format_height' name='kgvid_video_embed_options[custom_format][height]' class='small-text affects_ffmpeg kgvid_custom_format' value='".$options['custom_format']['height']."' /></small></label><br />";
|
4808 |
+
echo "<br><input ".checked( $options['hide_video_formats'], "on", false )." id='hide_video_formats' name='kgvid_video_embed_options[hide_video_formats]' type='checkbox' /> <label for='hide_video_formats'>".__('Only show video formats selected above on attachment pages and encode queue.', 'video-embed-thumbnail-generator');
|
4809 |
echo "</div>\n\t";
|
4810 |
}
|
4811 |
|
5324 |
}
|
5325 |
}
|
5326 |
|
5327 |
+
if ( version_compare( $options['version'], '4.6.20', '<' ) ) {
|
5328 |
+
$options['version'] = '4.6.20';
|
5329 |
+
$options['encode_480'] = false;
|
5330 |
+
$options['hide_video_formats'] = false;
|
5331 |
+
}
|
5332 |
+
|
5333 |
if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
|
5334 |
if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
|
5335 |
}
|
7153 |
foreach ( $video_formats as $format => $format_stats ) {
|
7154 |
if ( array_key_exists($format, $encode_checked) && $encode_checked[$format] == "true" ) {
|
7155 |
if ( !$encodevideo_info[$format]['exists'] ) {
|
7156 |
+
if ( $format_stats['type'] == "h264" && $format != "fullres" &&
|
7157 |
(
|
7158 |
( strpos($mime_type_check['type'], "mp4") !== false && $movie_height <= $format_stats['height'] ) ||
|
7159 |
( strpos($mime_type_check['type'], "mp4") === false && $movie_height < $format_stats['height'] )
|