Version Description
- March 18, 2014 =
- Prepared plugin for internationalization. Translators welcome!
- Finally paying attention to multisite. Several FFMPEG settings and the encode queue are now controlled at the network level if the plugin is network activated.
- Added JW Player option if the JW Player WordPress plugin is active.
- Added video subtitle/captions support.
- Revised and simplified video gallery popup method. Switched to lighter SimpleModal plugin and no longer loading jQuery-ui libraries.
- Added "gallery_ended" shortcode attribute to set an action when a pop-up video gallery video ends.
- Added next and previous buttons to navigate between pop-up video gallery items.
- Updated Video.js to version 4.4.3
- Strobe Media Playback is now deprecated. New features added to the plugin might not work if this player is selected.
- Added option to add a watermark to videos encoded with FFMPEG/LIBAV.
- Added option to automatically generate multiple thumbnails when a video is uploaded.
- Added option to encode more than one video at the same time.
- Added option to turn on video download link by default.
- Added option to set video preload attribute.
- Added list of shortcode attribute options to the post edit help tab.
- Added "order" and "orderby" shortcode attributes to sort videos embedded without a URL or ID specified.
- Added float to inline videos to allow text to wrap around them.
- Added play button overlay to gallery thumbnails when using WordPress Default player.
- Applied video alignment setting to video galleries for center and right justifying galleries.
- Now only loading plugin-related JavaScripts when the shortcode is used on the page and moved links to the footer to speed up page loading.
- Added wpdb->prepare to all database queries for increased security.
- Added nonce check when recording video play counts for increased security.
- Fixed bug that broke responsive resizing in IE 8 and for all videos with apostrophes in their titles.
- Fixed bug that disabled FFMPEG if the path to WordPress had spaces in it.
- Fixed bug that generated an error if the exec function was disabled on the server using suhosin or safe mode.
- Fixed bug that caused video encode problems when FFMPEG output contained special characters.
- Fixed bug that generated misaligned play button arrows in some themes when using the Video.js player.
- Fixed bug that sometimes generated jagged rows in galleries with mixed aspect ratios.
- Fixed bug that attempted to generate thumbnails using FFMPEG if a user had previously installed FFMPEG, disabled in-browser thumbnails, then disabled FFMPEG.
- Fixed several user capability related bugs related to users who were not assigned any roles and capabilities that were not assigned to any roles.
- Changed video title overlay z-index to 103 to avoid floating over other elements.
Download this release
Release Info
Developer | kylegilman |
Plugin | Video Embed & Thumbnail Generator |
Version | 4.3 |
Comparing to | |
See all releases |
Code changes from version 4.2.9 to 4.3
- css/images/ui-bg_flat_0_000000_40x100.png +0 -0
- css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- css/images/ui-bg_gloss-wave_16_121212_500x100.png +0 -0
- css/images/ui-bg_highlight-hard_15_888888_1x100.png +0 -0
- css/images/ui-bg_highlight-hard_55_555555_1x100.png +0 -0
- css/images/ui-bg_highlight-soft_35_adadad_1x100.png +0 -0
- css/images/ui-bg_highlight-soft_60_000000_1x100.png +0 -0
- css/images/ui-bg_inset-soft_15_121212_1x100.png +0 -0
- css/images/ui-icons_00a2f2_256x240.png +0 -0
- css/images/ui-icons_aaaaaa_256x240.png +0 -0
- css/images/ui-icons_bbbbbb_256x240.png +0 -0
- css/images/ui-icons_cccccc_256x240.png +0 -0
- css/images/ui-icons_cd0a0a_256x240.png +0 -0
- css/images/ui-icons_ffffff_256x240.png +0 -0
- css/kgvid_styles.css +109 -70
- css/video-embed-thumbnail-generator_admin.css +58 -0
- images/sample-video-h264.mp4 +0 -0
- js/jquery.simplemodal.1.4.5.min.js +7 -0
- js/kgvid_video_embed.js +272 -72
- js/kgvid_video_plugin_admin.js +170 -101
- readme.txt +86 -25
- uninstall.php +22 -3
- video-embed-thumbnail-generator.php +2342 -1208
- video-js/kg-video-js-skin.css +3 -3
- video-js/video-js.css +1 -1
- video-js/video-js.swf +0 -0
- video-js/video.js +132 -124
css/images/ui-bg_flat_0_000000_40x100.png
DELETED
Binary file
|
css/images/ui-bg_glass_95_fef1ec_1x400.png
DELETED
Binary file
|
css/images/ui-bg_gloss-wave_16_121212_500x100.png
DELETED
Binary file
|
css/images/ui-bg_highlight-hard_15_888888_1x100.png
DELETED
Binary file
|
css/images/ui-bg_highlight-hard_55_555555_1x100.png
DELETED
Binary file
|
css/images/ui-bg_highlight-soft_35_adadad_1x100.png
DELETED
Binary file
|
css/images/ui-bg_highlight-soft_60_000000_1x100.png
DELETED
Binary file
|
css/images/ui-bg_inset-soft_15_121212_1x100.png
DELETED
Binary file
|
css/images/ui-icons_00a2f2_256x240.png
DELETED
Binary file
|
css/images/ui-icons_aaaaaa_256x240.png
DELETED
Binary file
|
css/images/ui-icons_bbbbbb_256x240.png
DELETED
Binary file
|
css/images/ui-icons_cccccc_256x240.png
DELETED
Binary file
|
css/images/ui-icons_cd0a0a_256x240.png
DELETED
Binary file
|
css/images/ui-icons_ffffff_256x240.png
DELETED
Binary file
|
css/kgvid_styles.css
CHANGED
@@ -1,10 +1,42 @@
|
|
1 |
.kgvid_wrapper {
|
2 |
margin: 1em 0px;
|
3 |
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
}
|
5 |
|
6 |
.kgvid_gallerywrapper {
|
7 |
display: inline-block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
}
|
9 |
|
10 |
.kgvid_videodiv {
|
@@ -33,7 +65,7 @@
|
|
33 |
.vjs-fullscreen {padding-top: 0px}
|
34 |
|
35 |
div.kgvid_ios_novideo {
|
36 |
-
z-index:
|
37 |
position:absolute;
|
38 |
width:100%;
|
39 |
height:100%;
|
@@ -54,7 +86,7 @@ img.kgvid_ios_novideo {
|
|
54 |
display: block;
|
55 |
position: absolute;
|
56 |
top: 0px;
|
57 |
-
z-index:
|
58 |
margin: 0px;
|
59 |
width: 100%;
|
60 |
height: 32px;
|
@@ -123,10 +155,10 @@ img.kgvid_ios_novideo {
|
|
123 |
|
124 |
.kgvid_video_gallery_thumb {
|
125 |
position: relative;
|
126 |
-
|
127 |
display:inline-block;
|
128 |
-
|
129 |
-
|
130 |
}
|
131 |
|
132 |
.kgvid_video_gallery_thumb img {
|
@@ -142,13 +174,25 @@ img.kgvid_ios_novideo {
|
|
142 |
left:0px;
|
143 |
width:100%;
|
144 |
padding:0px;
|
145 |
-
background
|
|
|
|
|
|
|
|
|
146 |
overflow:hidden;
|
147 |
z-index: 3;
|
148 |
}
|
149 |
|
|
|
|
|
|
|
|
|
150 |
.kgvid_video_gallery_thumb:hover .titlebackground {
|
151 |
-
background
|
|
|
|
|
|
|
|
|
152 |
}
|
153 |
|
154 |
.kgvid_video_gallery_thumb .videotitle {
|
@@ -166,66 +210,61 @@ img.kgvid_ios_novideo {
|
|
166 |
left:5px;
|
167 |
}
|
168 |
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
.kgvid_gallery .ui-button-icon-only .ui-icon, .kgvid_gallery .ui-button-text-icon-primary .ui-icon, .kgvid_gallery .ui-button-text-icon-secondary .ui-icon, .kgvid_gallery .ui-button-text-icons .ui-icon, .kgvid_gallery .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
228 |
-
.kgvid_gallery .ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
|
229 |
-
.kgvid_gallery .ui-button-text-icon-primary .ui-button-icon-primary, .kgvid_gallery .ui-button-text-icons .ui-button-icon-primary, .kgvid_gallery .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
|
230 |
-
.kgvid_gallery .ui-button-text-icon-secondary .ui-button-icon-secondary, .kgvid_gallery .ui-button-text-icons .ui-button-icon-secondary, .kgvid_gallery .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
231 |
-
.kgvid_gallery .ui-button-text-icons .ui-button-icon-secondary, .kgvid_gallery .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
1 |
.kgvid_wrapper {
|
2 |
margin: 1em 0px;
|
3 |
position: relative;
|
4 |
+
max-width: 100%
|
5 |
+
}
|
6 |
+
|
7 |
+
.kgvid_wrapper_auto_left {
|
8 |
+
margin-left: auto;
|
9 |
+
}
|
10 |
+
|
11 |
+
.kgvid_wrapper_auto_right {
|
12 |
+
margin-right: auto;
|
13 |
+
}
|
14 |
+
|
15 |
+
.kgvid_wrapper_inline {
|
16 |
+
display: inline-block;
|
17 |
+
}
|
18 |
+
|
19 |
+
.kgvid_wrapper_inline_left {
|
20 |
+
float: left;
|
21 |
+
margin: 1em 1em 0 0;
|
22 |
+
}
|
23 |
+
|
24 |
+
.kgvid_wrapper_inline_right {
|
25 |
+
float: right;
|
26 |
+
margin: 1em 0 0 1em;
|
27 |
}
|
28 |
|
29 |
.kgvid_gallerywrapper {
|
30 |
display: inline-block;
|
31 |
+
max-width: 100%;
|
32 |
+
}
|
33 |
+
|
34 |
+
.kgvid_textalign_right {
|
35 |
+
text-align:right;
|
36 |
+
}
|
37 |
+
|
38 |
+
.kgvid_textalign_center {
|
39 |
+
text-align:center;
|
40 |
}
|
41 |
|
42 |
.kgvid_videodiv {
|
65 |
.vjs-fullscreen {padding-top: 0px}
|
66 |
|
67 |
div.kgvid_ios_novideo {
|
68 |
+
z-index:3;
|
69 |
position:absolute;
|
70 |
width:100%;
|
71 |
height:100%;
|
86 |
display: block;
|
87 |
position: absolute;
|
88 |
top: 0px;
|
89 |
+
z-index: 103;
|
90 |
margin: 0px;
|
91 |
width: 100%;
|
92 |
height: 32px;
|
155 |
|
156 |
.kgvid_video_gallery_thumb {
|
157 |
position: relative;
|
158 |
+
vertical-align: bottom;
|
159 |
display:inline-block;
|
160 |
+
cursor: pointer !important;
|
161 |
+
margin: 7px 7px;
|
162 |
}
|
163 |
|
164 |
.kgvid_video_gallery_thumb img {
|
174 |
left:0px;
|
175 |
width:100%;
|
176 |
padding:0px;
|
177 |
+
background:rgb(0,0,0);
|
178 |
+
background: transparent\9;
|
179 |
+
background:rgba(0,0,0,0.4);
|
180 |
+
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#66000000,endColorstr=#66000000);
|
181 |
+
zoom: 1;
|
182 |
overflow:hidden;
|
183 |
z-index: 3;
|
184 |
}
|
185 |
|
186 |
+
.kgvid_video_gallery_thumb:nth-child(n) {
|
187 |
+
filter: none;
|
188 |
+
}
|
189 |
+
|
190 |
.kgvid_video_gallery_thumb:hover .titlebackground {
|
191 |
+
background:rgb(0,0,0);
|
192 |
+
background: transparent\9;
|
193 |
+
background:rgba(0,0,0,0.8);
|
194 |
+
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#cc000000,endColorstr=#cc000000);
|
195 |
+
zoom: 1;
|
196 |
}
|
197 |
|
198 |
.kgvid_video_gallery_thumb .videotitle {
|
210 |
left:5px;
|
211 |
}
|
212 |
|
213 |
+
/* SimpleModal styles */
|
214 |
+
#kgvid-simplemodal-overlay {background-color:#000;}
|
215 |
+
|
216 |
+
#kgvid-simplemodal-container { color:black; background-color:#000; height:auto; }
|
217 |
+
#kgvid-simplemodal-container .simplemodal-data {margin-top:-1em; padding:5px;}
|
218 |
+
#kgvid-simplemodal-container a.modalCloseImg {
|
219 |
+
width: 17px;
|
220 |
+
height: 17px;
|
221 |
+
display: inline;
|
222 |
+
z-index: 10003;
|
223 |
+
position: absolute;
|
224 |
+
top: -22px;
|
225 |
+
right: 0px;
|
226 |
+
cursor: pointer;
|
227 |
+
text-align: center;
|
228 |
+
font-size: 10px;
|
229 |
+
border: 1px solid #888;
|
230 |
+
border-radius: 5px;
|
231 |
+
background-color: #666;
|
232 |
+
color: #ccc;
|
233 |
+
font-family: Arial, sans-serif;
|
234 |
+
line-height: 17px;
|
235 |
+
font-weight: 900;
|
236 |
+
text-decoration: none;
|
237 |
+
}
|
238 |
+
|
239 |
+
#kgvid-simplemodal-container .kgvid_gallery_nav {
|
240 |
+
cursor: pointer;
|
241 |
+
display: inline-block;
|
242 |
+
width: 26px;
|
243 |
+
height: 14px;
|
244 |
+
background-color: #666;
|
245 |
+
text-align: center;
|
246 |
+
color: #ccc;
|
247 |
+
border-radius: 5px;
|
248 |
+
font-family: Arial, sans-serif;
|
249 |
+
font-size: 16px;
|
250 |
+
font-weight: 900;
|
251 |
+
border: 1px solid #888;
|
252 |
+
line-height: 12px;
|
253 |
+
z-index: 10003;
|
254 |
+
position: absolute;
|
255 |
+
text-decoration: none;
|
256 |
+
}
|
257 |
+
|
258 |
+
.kgvid_gallery_prev {
|
259 |
+
top: -20px;
|
260 |
+
right: 58px;
|
261 |
+
}
|
262 |
+
|
263 |
+
.kgvid_gallery_next {
|
264 |
+
top: -20px;
|
265 |
+
right: 25px;
|
266 |
+
}
|
267 |
+
|
268 |
+
#kgvid-simplemodal-container a.modalCloseImg:hover, #kgvid-simplemodal-container .kgvid_gallery_nav:hover {
|
269 |
+
background-color: #555;
|
270 |
+
}
|
|
|
|
|
|
|
|
|
|
css/video-embed-thumbnail-generator_admin.css
CHANGED
@@ -148,6 +148,32 @@ div.kgvid_thumbnail_box {
|
|
148 |
padding:5px;
|
149 |
}
|
150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
div.kgvid_chosen_thumbnail_box {
|
152 |
border-width:6px;
|
153 |
width: 200px;
|
@@ -167,6 +193,10 @@ div.kgvid_thumbnail_overlay {
|
|
167 |
filter: alpha(opacity = 50); /* required for opacity to work in IE */
|
168 |
}
|
169 |
|
|
|
|
|
|
|
|
|
170 |
div.kgvid_thumbnail_select {
|
171 |
text-align:center;
|
172 |
display:inline-block;
|
@@ -489,3 +519,31 @@ td.media-icon img {
|
|
489 |
line-height: 17pt;
|
490 |
margin-bottom: 10px;
|
491 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
padding:5px;
|
149 |
}
|
150 |
|
151 |
+
div.kgvid_track_box {
|
152 |
+
text-align:left;
|
153 |
+
}
|
154 |
+
|
155 |
+
div.kgvid_track_box:hover {
|
156 |
+
background-color: #F7F7F7;
|
157 |
+
}
|
158 |
+
|
159 |
+
.compat-item .field .kgvid_track_box input {
|
160 |
+
margin-top: 3px;
|
161 |
+
}
|
162 |
+
|
163 |
+
.kgvid_track_box_removeable {
|
164 |
+
width: 15px;
|
165 |
+
height: 15px;
|
166 |
+
float: right;
|
167 |
+
text-align: right;
|
168 |
+
font-weight: bold;
|
169 |
+
color: #BC0B0B;
|
170 |
+
cursor: pointer;
|
171 |
+
}
|
172 |
+
|
173 |
+
.kgvid_track_box_removeable:hover {
|
174 |
+
color: red;
|
175 |
+
}
|
176 |
+
|
177 |
div.kgvid_chosen_thumbnail_box {
|
178 |
border-width:6px;
|
179 |
width: 200px;
|
193 |
filter: alpha(opacity = 50); /* required for opacity to work in IE */
|
194 |
}
|
195 |
|
196 |
+
div.kgvid_video_app_required {
|
197 |
+
background: inherit;
|
198 |
+
}
|
199 |
+
|
200 |
div.kgvid_thumbnail_select {
|
201 |
text-align:center;
|
202 |
display:inline-block;
|
519 |
line-height: 17pt;
|
520 |
margin-bottom: 10px;
|
521 |
}
|
522 |
+
|
523 |
+
.kgvid_warning {
|
524 |
+
color:red;
|
525 |
+
}
|
526 |
+
|
527 |
+
.kgvid_50_width {
|
528 |
+
max-width: 50px;
|
529 |
+
}
|
530 |
+
|
531 |
+
.kgvid_user_roles {
|
532 |
+
display: inline-block;
|
533 |
+
margin: 0 45px 15px 0;
|
534 |
+
}
|
535 |
+
|
536 |
+
.kgvid_user_roles strong {
|
537 |
+
padding-bottom: 5px;
|
538 |
+
display: inline-block;
|
539 |
+
}
|
540 |
+
|
541 |
+
.kgvid_queue_message {
|
542 |
+
font-size: 129%;
|
543 |
+
margin-left: 10px;
|
544 |
+
color: #298CBA;
|
545 |
+
}
|
546 |
+
|
547 |
+
#jw_player_id_select {
|
548 |
+
margin-top: 5px;
|
549 |
+
}
|
images/sample-video-h264.mp4
CHANGED
Binary file
|
js/jquery.simplemodal.1.4.5.min.js
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* SimpleModal 1.4.5 - jQuery Plugin
|
3 |
+
* http://simplemodal.com/
|
4 |
+
* Copyright (c) 2013 Eric Martin
|
5 |
+
* Licensed under MIT and GPL
|
6 |
+
*/
|
7 |
+
(function(e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(jQuery)}})(function(e){var t=[],n=e(document),r=navigator.userAgent.toLowerCase(),i=e(window),s=[];var o={ieQuirks:null,msie:/msie/.test(r)&&!/opera/.test(r),opera:/opera/.test(r)};o.ie6=o.msie&&/msie 6./.test(r)&&typeof window["XMLHttpRequest"]!=="object";o.ie7=o.msie&&/msie 7.0/.test(r);o.boxModel=document.compatMode==="CSS1Compat";e.modal=function(t,n){return e.modal.impl.init(t,n)};e.modal.close=function(){e.modal.impl.close()};e.modal.focus=function(t){e.modal.impl.focus(t)};e.modal.setContainerDimensions=function(){e.modal.impl.setContainerDimensions()};e.modal.setPosition=function(){e.modal.impl.setPosition()};e.modal.update=function(t,n){e.modal.impl.update(t,n)};e.fn.modal=function(t){return e.modal.impl.init(this,t)};e.modal.defaults={appendTo:"body",focus:true,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:null,minWidth:null,maxHeight:null,maxWidth:null,autoResize:false,autoPosition:true,zIndex:1e3,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",escClose:true,overlayClose:false,fixed:true,position:null,persist:false,modal:true,onOpen:null,onShow:null,onClose:null};e.modal.impl={d:{},init:function(t,n){var r=this;if(r.d.data){return false}o.ieQuirks=o.msie&&!o.boxModel;r.o=e.extend({},e.modal.defaults,n);r.zIndex=r.o.zIndex;r.occb=false;if(typeof t==="object"){t=t instanceof e?t:e(t);r.d.placeholder=false;if(t.parent().parent().size()>0){t.before(e("<span></span>").attr("id","simplemodal-placeholder").css({display:"none"}));r.d.placeholder=true;r.display=t.css("display");if(!r.o.persist){r.d.orig=t.clone(true)}}}else if(typeof t==="string"||typeof t==="number"){t=e("<div></div>").html(t)}else{alert("SimpleModal Error: Unsupported data type: "+typeof t);return r}r.create(t);t=null;r.open();if(e.isFunction(r.o.onShow)){r.o.onShow.apply(r,[r.d])}return r},create:function(n){var r=this;r.getDimensions();if(r.o.modal&&o.ie6){r.d.iframe=e('<iframe src="javascript:false;"></iframe>').css(e.extend(r.o.iframeCss,{display:"none",opacity:0,position:"fixed",height:s[0],width:s[1],zIndex:r.o.zIndex,top:0,left:0})).appendTo(r.o.appendTo)}r.d.overlay=e("<div></div>").attr("id",r.o.overlayId).addClass("simplemodal-overlay").css(e.extend(r.o.overlayCss,{display:"none",opacity:r.o.opacity/100,height:r.o.modal?t[0]:0,width:r.o.modal?t[1]:0,position:"fixed",left:0,top:0,zIndex:r.o.zIndex+1})).appendTo(r.o.appendTo);r.d.container=e("<div></div>").attr("id",r.o.containerId).addClass("simplemodal-container").css(e.extend({position:r.o.fixed?"fixed":"absolute"},r.o.containerCss,{display:"none",zIndex:r.o.zIndex+2})).append(r.o.close&&r.o.closeHTML?e(r.o.closeHTML).addClass(r.o.closeClass):"").appendTo(r.o.appendTo);r.d.wrap=e("<div></div>").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(r.d.container);r.d.data=n.attr("id",n.attr("id")||r.o.dataId).addClass("simplemodal-data").css(e.extend(r.o.dataCss,{display:"none"})).appendTo("body");n=null;r.setContainerDimensions();r.d.data.appendTo(r.d.wrap);if(o.ie6||o.ieQuirks){r.fixIE()}},bindEvents:function(){var r=this;e("."+r.o.closeClass).bind("click.simplemodal",function(e){e.preventDefault();r.close()});if(r.o.modal&&r.o.close&&r.o.overlayClose){r.d.overlay.bind("click.simplemodal",function(e){e.preventDefault();r.close()})}n.bind("keydown.simplemodal",function(e){if(r.o.modal&&e.keyCode===9){r.watchTab(e)}else if(r.o.close&&r.o.escClose&&e.keyCode===27){e.preventDefault();r.close()}});i.bind("resize.simplemodal orientationchange.simplemodal",function(){r.getDimensions();r.o.autoResize?r.setContainerDimensions():r.o.autoPosition&&r.setPosition();if(o.ie6||o.ieQuirks){r.fixIE()}else if(r.o.modal){r.d.iframe&&r.d.iframe.css({height:s[0],width:s[1]});r.d.overlay.css({height:t[0],width:t[1]})}})},unbindEvents:function(){e("."+this.o.closeClass).unbind("click.simplemodal");n.unbind("keydown.simplemodal");i.unbind(".simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var t=this,n=t.o.position;e.each([t.d.iframe||null,!t.o.modal?null:t.d.overlay,t.d.container.css("position")==="fixed"?t.d.container:null],function(e,t){if(t){var r="document.body.clientHeight",i="document.body.clientWidth",s="document.body.scrollHeight",o="document.body.scrollLeft",u="document.body.scrollTop",a="document.body.scrollWidth",f="document.documentElement.clientHeight",l="document.documentElement.clientWidth",c="document.documentElement.scrollLeft",h="document.documentElement.scrollTop",d=t[0].style;d.position="absolute";if(e<2){d.removeExpression("height");d.removeExpression("width");d.setExpression("height",""+s+" > "+r+" ? "+s+" : "+r+' + "px"');d.setExpression("width",""+a+" > "+i+" ? "+a+" : "+i+' + "px"')}else{var v,m;if(n&&n.constructor===Array){var g=n[0]?typeof n[0]==="number"?n[0].toString():n[0].replace(/px/,""):t.css("top").replace(/px/,"");v=g.indexOf("%")===-1?g+" + (t = "+h+" ? "+h+" : "+u+') + "px"':parseInt(g.replace(/%/,""))+" * (("+f+" || "+r+") / 100) + (t = "+h+" ? "+h+" : "+u+') + "px"';if(n[1]){var y=typeof n[1]==="number"?n[1].toString():n[1].replace(/px/,"");m=y.indexOf("%")===-1?y+" + (t = "+c+" ? "+c+" : "+o+') + "px"':parseInt(y.replace(/%/,""))+" * (("+l+" || "+i+") / 100) + (t = "+c+" ? "+c+" : "+o+') + "px"'}}else{v="("+f+" || "+r+") / 2 - (this.offsetHeight / 2) + (t = "+h+" ? "+h+" : "+u+') + "px"';m="("+l+" || "+i+") / 2 - (this.offsetWidth / 2) + (t = "+c+" ? "+c+" : "+o+') + "px"'}d.removeExpression("top");d.removeExpression("left");d.setExpression("top",v);d.setExpression("left",m)}}})},focus:function(t){var n=this,r=t&&e.inArray(t,["first","last"])!==-1?t:"first";var i=e(":input:enabled:visible:"+r,n.d.wrap);setTimeout(function(){i.length>0?i.focus():n.d.wrap.focus()},10)},getDimensions:function(){var e=this,r=typeof window.innerHeight==="undefined"?i.height():window.innerHeight;t=[n.height(),n.width()];s=[r,i.width()]},getVal:function(e,t){return e?typeof e==="number"?e:e==="auto"?0:e.indexOf("%")>0?parseInt(e.replace(/%/,""))/100*(t==="h"?s[0]:s[1]):parseInt(e.replace(/px/,"")):null},update:function(e,t){var n=this;if(!n.d.data){return false}n.d.origHeight=n.getVal(e,"h");n.d.origWidth=n.getVal(t,"w");n.d.data.hide();e&&n.d.container.css("height",e);t&&n.d.container.css("width",t);n.setContainerDimensions();n.d.data.show();n.o.focus&&n.focus();n.unbindEvents();n.bindEvents()},setContainerDimensions:function(){var e=this,t=o.ie6||o.ie7;var n=e.d.origHeight?e.d.origHeight:o.opera?e.d.container.height():e.getVal(t?e.d.container[0].currentStyle["height"]:e.d.container.css("height"),"h"),r=e.d.origWidth?e.d.origWidth:o.opera?e.d.container.width():e.getVal(t?e.d.container[0].currentStyle["width"]:e.d.container.css("width"),"w"),i=e.d.data.outerHeight(true),u=e.d.data.outerWidth(true);e.d.origHeight=e.d.origHeight||n;e.d.origWidth=e.d.origWidth||r;var a=e.o.maxHeight?e.getVal(e.o.maxHeight,"h"):null,f=e.o.maxWidth?e.getVal(e.o.maxWidth,"w"):null,l=a&&a<s[0]?a:s[0],c=f&&f<s[1]?f:s[1];var h=e.o.minHeight?e.getVal(e.o.minHeight,"h"):"auto";if(!n){if(!i){n=h}else{if(i>l){n=l}else if(e.o.minHeight&&h!=="auto"&&i<h){n=h}else{n=i}}}else{n=e.o.autoResize&&n>l?l:n<h?h:n}var p=e.o.minWidth?e.getVal(e.o.minWidth,"w"):"auto";if(!r){if(!u){r=p}else{if(u>c){r=c}else if(e.o.minWidth&&p!=="auto"&&u<p){r=p}else{r=u}}}else{r=e.o.autoResize&&r>c?c:r<p?p:r}e.d.container.css({height:n,width:r});e.d.wrap.css({overflow:i>n||u>r?"auto":"visible"});e.o.autoPosition&&e.setPosition()},setPosition:function(){var e=this,t,n,r=s[0]/2-e.d.container.outerHeight(true)/2,o=s[1]/2-e.d.container.outerWidth(true)/2,u=e.d.container.css("position")!=="fixed"?i.scrollTop():0;if(e.o.position&&Object.prototype.toString.call(e.o.position)==="[object Array]"){t=u+(e.o.position[0]||r);n=e.o.position[1]||o}else{t=u+r;n=o}e.d.container.css({left:n,top:t})},watchTab:function(t){var n=this;if(e(t.target).parents(".simplemodal-container").length>0){n.inputs=e(":input:enabled:visible:first, :input:enabled:visible:last",n.d.data[0]);if(!t.shiftKey&&t.target===n.inputs[n.inputs.length-1]||t.shiftKey&&t.target===n.inputs[0]||n.inputs.length===0){t.preventDefault();var r=t.shiftKey?"last":"first";n.focus(r)}}else{t.preventDefault();n.focus()}},open:function(){var t=this;t.d.iframe&&t.d.iframe.show();if(e.isFunction(t.o.onOpen)){t.o.onOpen.apply(t,[t.d])}else{t.d.overlay.show();t.d.container.show();t.d.data.show()}t.o.focus&&t.focus();t.bindEvents()},close:function(){var t=this;if(!t.d.data){return false}t.unbindEvents();if(e.isFunction(t.o.onClose)&&!t.occb){t.occb=true;t.o.onClose.apply(t,[t.d])}else{if(t.d.placeholder){var n=e("#simplemodal-placeholder");if(t.o.persist){n.replaceWith(t.d.data.removeClass("simplemodal-data").css("display",t.display))}else{t.d.data.hide().remove();n.replaceWith(t.d.orig)}}else{t.d.data.hide().remove()}t.d.container.hide().remove();t.d.overlay.hide();t.d.iframe&&t.d.iframe.hide().remove();t.d.overlay.remove();t.d={}}}}})
|
js/kgvid_video_embed.js
CHANGED
@@ -1,28 +1,181 @@
|
|
1 |
-
|
2 |
|
3 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
var aspect_ratio = Math.round(height/width*1000)/1000
|
5 |
-
if ( width >
|
6 |
-
width =
|
7 |
height = Math.round(width * aspect_ratio);
|
8 |
}
|
9 |
-
var
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
jQuery
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
18 |
|
19 |
-
function
|
|
|
|
|
|
|
|
|
|
|
20 |
|
|
|
21 |
jQuery('#'+this.id()+' > .vjs-poster').fadeOut();
|
22 |
}
|
23 |
|
24 |
function kgvid_setup_video(id) {
|
|
|
25 |
var video_vars = kgvid_video_vars[id];
|
|
|
|
|
|
|
26 |
var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false );
|
27 |
if (iOS && video_vars.player_type == "Strobe Media Playback" ) { video_vars.player_type = "Video.js"; }
|
28 |
|
@@ -30,6 +183,11 @@ function kgvid_setup_video(id) {
|
|
30 |
jQuery('#video_'+id+'_watermark').attr('style', ''); //shows the hidden watermark div
|
31 |
jQuery('#video_'+id+'_div').prepend(jQuery('#video_'+id+'_meta'));
|
32 |
jQuery('#video_'+id+'_meta').attr('style', ''); //shows the hidden meta div
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
if ( video_vars.player_type == "Video.js" ) {
|
35 |
|
@@ -61,12 +219,16 @@ function kgvid_setup_video(id) {
|
|
61 |
player.on('ended', function kgvid_play_end(){
|
62 |
kgvid_video_counter(id, 'end');
|
63 |
setTimeout(function() { jQuery('#video_'+id+' > .vjs-loading-spinner').hide(); }, 250);
|
64 |
-
if ( video_vars.
|
65 |
jQuery('#video_'+id+' > .vjs-poster').css({
|
66 |
'background-image':'url('+video_vars.endofvideooverlay+')'
|
67 |
}).fadeIn();
|
68 |
|
69 |
player.on('timeupdate', kgvid_timeupdate);
|
|
|
|
|
|
|
|
|
70 |
}
|
71 |
});
|
72 |
|
@@ -113,7 +275,6 @@ function kgvid_setup_video(id) {
|
|
113 |
|
114 |
if ( video_vars.player_type == "Strobe Media Playback" || video_vars.player_type == "WordPress Default" ) {
|
115 |
|
116 |
-
if ( video_vars.autoplay == "true" ) { jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover'); }
|
117 |
jQuery('#video_'+id+'_div').hover(
|
118 |
function(){
|
119 |
jQuery('#video_'+id+'_meta').addClass('kgvid_video_meta_hover');
|
@@ -130,23 +291,10 @@ function kgvid_setup_video(id) {
|
|
130 |
|
131 |
player = jQuery('#video_'+id+'_div video');
|
132 |
|
133 |
-
if ( video_vars.autoplay == "true" ) { jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover'); }
|
134 |
-
|
135 |
-
if ( video_vars.meta ) {
|
136 |
-
jQuery('#video_'+id+'_div').hover(
|
137 |
-
function(){
|
138 |
-
jQuery('#video_'+id+'_meta').addClass('kgvid_video_meta_hover');
|
139 |
-
|
140 |
-
},
|
141 |
-
function(){
|
142 |
-
jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
|
143 |
-
}
|
144 |
-
);
|
145 |
-
}
|
146 |
-
|
147 |
if ( video_vars.set_volume != "" ) { player[0].volume = video_vars.set_volume; }
|
148 |
|
149 |
player.on('play', function kgvid_play_start(){
|
|
|
150 |
kgvid_video_counter(id, 'play');
|
151 |
});
|
152 |
|
@@ -165,79 +313,128 @@ function kgvid_setup_video(id) {
|
|
165 |
}
|
166 |
} );
|
167 |
}
|
|
|
|
|
|
|
168 |
});
|
169 |
|
|
|
170 |
} //end if WordPress Default
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
if ( video_vars.resize == "true" || window.location.search.indexOf("kgvid_video_embed[enable]=true") !== false ) {
|
173 |
kgvid_resize_video(id);
|
174 |
-
window.
|
175 |
}
|
176 |
}
|
177 |
|
178 |
function kgvid_resize_all_videos() {
|
|
|
179 |
for (var id in kgvid_video_vars) {
|
180 |
kgvid_resize_video(id);
|
181 |
}
|
|
|
182 |
}
|
183 |
|
184 |
function kgvid_resize_video(id) {
|
185 |
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
if (
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
jQuery('#
|
208 |
-
if ( set_width <
|
209 |
-
jQuery('#video_'+id+' > .vjs-control-bar > .vjs-
|
210 |
-
if ( set_width <
|
211 |
-
jQuery('#video_'+id+' > .vjs-control-bar > .vjs-
|
|
|
|
|
|
|
212 |
}
|
213 |
}
|
214 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
}
|
216 |
-
else { jQuery('#kgvid_'+id+'_wrapper .vjs-big-play-button').removeAttr('style'); }
|
217 |
-
}
|
218 |
-
if ( video_vars.player_type == "Strobe Media Playback" ) {
|
219 |
-
jQuery('#video_'+id+'_div').height(set_height);
|
220 |
-
jQuery('#video_'+id).attr('width',set_width).attr('height',set_height);
|
221 |
-
jQuery('#video_'+id+'_html5_api').attr('width',set_width).attr('height',set_height);
|
222 |
-
}
|
223 |
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
|
228 |
-
|
229 |
-
|
|
|
|
|
230 |
|
231 |
}
|
232 |
|
|
|
|
|
|
|
|
|
|
|
233 |
}
|
234 |
-
|
235 |
}
|
236 |
|
237 |
function kgvid_strobemedia_callback(id) {
|
238 |
|
239 |
var player = document.getElementById('video_'+id);
|
240 |
var video_vars = kgvid_video_vars[id];
|
|
|
241 |
if ( player.getState() == 'buffering' || player.getState() == 'playing' ) {
|
242 |
kgvid_video_counter(video_vars.id, 'play');
|
243 |
}
|
@@ -245,12 +442,14 @@ function kgvid_strobemedia_callback(id) {
|
|
245 |
if ( player.getState() == 'uninitialized' && video_vars.set_volume != "" ) {
|
246 |
player.setVolume(video_vars.set_volume);
|
247 |
}
|
|
|
248 |
}
|
249 |
|
250 |
function kgvid_video_counter(id, event) {
|
251 |
|
252 |
var video_vars = kgvid_video_vars[id];
|
253 |
var changed = false;
|
|
|
254 |
|
255 |
var played = jQuery('#video_'+id+'_div').data("played") || "not played";
|
256 |
if ( played == "not played" ) {
|
@@ -258,17 +457,18 @@ function kgvid_video_counter(id, event) {
|
|
258 |
changed = true;
|
259 |
jQuery('#video_'+id+'_div').data("played", "played");
|
260 |
}
|
261 |
-
if (typeof _gaq != "undefined") { _gaq.push(["_trackEvent", "Videos",
|
262 |
}
|
263 |
if ( event == "end" ) {
|
264 |
if (video_vars.countable) { //video is in the db
|
265 |
changed = true;
|
266 |
}
|
267 |
-
if (typeof _gaq != 'undefined') { _gaq.push(['_trackEvent', 'Videos',
|
268 |
}
|
269 |
if ( changed == true ) {
|
270 |
-
jQuery.post(
|
271 |
action: 'kgvid_count_play',
|
|
|
272 |
post_id: id,
|
273 |
video_event: event
|
274 |
}, function(data) {
|
1 |
+
kgvid_video_vars = {};
|
2 |
|
3 |
+
jQuery(document).ready(function() {
|
4 |
+
|
5 |
+
jQuery('.kgvid_videodiv').each(function(){ //setup individual videos
|
6 |
+
var id = jQuery(this).data('id');
|
7 |
+
var video_variable_name = 'kgvid_video_vars_'+id;
|
8 |
+
kgvid_video_vars[id] = eval(video_variable_name);
|
9 |
+
|
10 |
+
if ( kgvid_video_vars[id].player_type == "Strobe Media Playback" ) {
|
11 |
+
swfobject.embedSWF(kgvid_video_vars[id].swfurl, 'video_'+id, kgvid_video_vars[id].width, kgvid_video_vars[id].height, '10.1.0', kgvid_video_vars[id].expressinstallswfurl, kgvid_video_vars[id].flashvars, kgvid_video_vars[id].params);
|
12 |
+
}
|
13 |
+
|
14 |
+
kgvid_setup_video(id);
|
15 |
+
|
16 |
+
});
|
17 |
+
|
18 |
+
jQuery('.kgvid_video_gallery_thumb').each(function(){ //add onclick for gallery thumbnails
|
19 |
+
var id = jQuery(this).data('id');
|
20 |
+
jQuery(this).on('click', function() { kgvid_SetVideo(id); } );
|
21 |
+
});
|
22 |
+
|
23 |
+
});
|
24 |
+
|
25 |
+
function kgvid_SetVideo(id) {
|
26 |
+
|
27 |
+
//set the viewport meta tag so the gallery fits in iOS
|
28 |
+
var viewport_meta = jQuery('meta[name="viewport"]').first();
|
29 |
+
var viewport_original = "";
|
30 |
+
if ( viewport_meta.length == 1 ) {
|
31 |
+
var viewport_original = viewport_meta.attr('content');
|
32 |
+
viewport_meta.attr('content', 'width=device-width, initial-scale=1');
|
33 |
+
}
|
34 |
+
else { jQuery('head').append('<meta name="viewport" content="width=device-width, initial-scale=1" id="kgvid_gallery_viewport">'); }
|
35 |
+
|
36 |
+
var gallery_id = jQuery('#kgvid_video_gallery_thumb_'+id).parent().attr('id');
|
37 |
+
|
38 |
+
var width = jQuery('#kgvid_video_gallery_thumb_'+id).data('width');
|
39 |
+
var height = jQuery('#kgvid_video_gallery_thumb_'+id).data('height');
|
40 |
var aspect_ratio = Math.round(height/width*1000)/1000
|
41 |
+
if ( width > window.outerWidth ) {
|
42 |
+
width = window.outerWidth-60;
|
43 |
height = Math.round(width * aspect_ratio);
|
44 |
}
|
45 |
+
var frame_height = height;
|
46 |
+
var meta = jQuery('#kgvid_video_gallery_thumb_'+id).data('meta');
|
47 |
+
if ( meta > 0 ) { frame_height = parseInt(height)+Math.round(24*meta); }
|
48 |
+
var frame_width = parseInt(width) + 10;
|
49 |
+
frame_height = parseInt(frame_height) + 10;
|
50 |
+
|
51 |
+
jQuery.modal("", {
|
52 |
+
overlayId: 'kgvid-simplemodal-overlay',
|
53 |
+
containerId: 'kgvid-simplemodal-container',
|
54 |
+
opacity:70,
|
55 |
+
minWidth:frame_width,
|
56 |
+
minHeight:frame_height,
|
57 |
+
autoResize: false,
|
58 |
+
overlayClose:true,
|
59 |
+
closeHTML:'<a class="modalCloseImg simplemodal-close" title="Close">X</a>',
|
60 |
+
zIndex:10000,
|
61 |
+
onShow: function(dialog) {
|
62 |
+
|
63 |
+
//build next/previous buttons
|
64 |
+
|
65 |
+
var nav_code = '';
|
66 |
+
if ( jQuery('#kgvid_video_gallery_thumb_'+id).prev('#'+gallery_id+' .kgvid_video_gallery_thumb').length > 0 ) {
|
67 |
+
nav_code += '<a class="kgvid_gallery_nav kgvid_gallery_prev" title="'+kgvidL10n_frontend.previous+'">←</a>';
|
68 |
+
}
|
69 |
+
if ( jQuery('#kgvid_video_gallery_thumb_'+id).next('#'+gallery_id+' .kgvid_video_gallery_thumb').length > 0 ) {
|
70 |
+
nav_code += '<a class="kgvid_gallery_nav kgvid_gallery_next" title="'+kgvidL10n_frontend.next+'">→</a>';
|
71 |
+
}
|
72 |
+
|
73 |
+
jQuery('#kgvid-simplemodal-container').prepend(nav_code);
|
74 |
+
|
75 |
+
jQuery('.kgvid_gallery_next').click( function() {
|
76 |
+
jQuery.modal.close();
|
77 |
+
jQuery('#kgvid_video_gallery_thumb_'+id).next('.kgvid_video_gallery_thumb').trigger('click');
|
78 |
+
});
|
79 |
+
|
80 |
+
jQuery('.kgvid_gallery_prev').click( function() {
|
81 |
+
jQuery.modal.close();
|
82 |
+
jQuery('#kgvid_video_gallery_thumb_'+id).prev('.kgvid_video_gallery_thumb').trigger('click');
|
83 |
+
});
|
84 |
+
jQuery('#simplemodal-data').prepend('<div id="kgvid_popup_video_holder_'+id+'"></div>');
|
85 |
+
|
86 |
+
//load the video player embed code
|
87 |
+
jQuery.post(kgvid_ajax_object.ajaxurl, {
|
88 |
+
action: 'kgvid_set_gallery_video',
|
89 |
+
security: kgvid_ajax_object.ajax_nonce,
|
90 |
+
video_id: id
|
91 |
+
}, function(data) {
|
92 |
+
|
93 |
+
if ( jQuery('#kgvid_popup_video_holder_'+id).length == 1 ) { //make sure the user hasn't moved on to another video
|
94 |
+
|
95 |
+
kgvid_video_vars[id] = data.kgvid_video_vars;
|
96 |
+
var video_vars = data.kgvid_video_vars;
|
97 |
+
|
98 |
+
jQuery('#kgvid_popup_video_holder_'+id).html(data.code);
|
99 |
+
|
100 |
+
if ( kgvid_video_vars[id].player_type == "Strobe Media Playback" ) {
|
101 |
+
swfobject.embedSWF(kgvid_video_vars[id].swfurl, 'video_'+id, kgvid_video_vars[id].width, kgvid_video_vars[id].height, '10.1.0', kgvid_video_vars[id].expressinstallswfurl, kgvid_video_vars[id].flashvars, kgvid_video_vars[id].params);
|
102 |
+
}
|
103 |
+
|
104 |
+
kgvid_setup_video(id);
|
105 |
+
jQuery.modal.setContainerDimensions();
|
106 |
+
dialog.wrap.css('overflow', 'hidden'); //disable scroll bars
|
107 |
+
if ( meta > 0 ) { jQuery('#kgvid-simplemodal-container').css('color','white'); } //show text if there's anything to see below the video
|
108 |
+
|
109 |
+
if ( video_vars.player_type == "Video.js" ) {
|
110 |
+
videojs('video_'+id).load();
|
111 |
+
videojs('video_'+id).play();
|
112 |
+
}//end if Video.js
|
113 |
+
|
114 |
+
if ( video_vars.player_type == "WordPress Default" ) {
|
115 |
+
jQuery('#kgvid_'+id+'_wrapper video').mediaelementplayer({
|
116 |
+
success: function(mediaElement, domObject) {
|
117 |
+
if (mediaElement.pluginType == 'flash' || mediaElement.pluginType == 'silverlight') {
|
118 |
+
mediaElement.addEventListener('canplay', function() {
|
119 |
+
// Player is ready
|
120 |
+
mediaElement.play();
|
121 |
+
}, false);
|
122 |
+
|
123 |
+
mediaElement.addEventListener('ended', function() {
|
124 |
+
if ( jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end') != "" && jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end') != null ) {
|
125 |
+
kgvid_video_gallery_end_action(id, jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end'));
|
126 |
+
}
|
127 |
+
}, false);
|
128 |
+
}//end if flash or silverlight
|
129 |
+
else { mediaElement.play(); }
|
130 |
+
}
|
131 |
+
});
|
132 |
+
}//end if WordPress Default
|
133 |
+
}//end check to make sure video still needs to load
|
134 |
+
},"json"); //end .post
|
135 |
+
}, //end onShow function
|
136 |
+
onClose: function(dialog) {
|
137 |
+
|
138 |
+
if ( viewport_original != "" ) { viewport_meta.attr('content', viewport_original); }
|
139 |
+
else { jQuery('#kgvid_gallery_viewport').remove(); }
|
140 |
+
|
141 |
+
var video_vars = kgvid_video_vars[id];
|
142 |
+
if ( video_vars !== undefined ) {
|
143 |
+
if ( video_vars.player_type == "Video.js" ) {
|
144 |
+
videojs('video_'+id).dispose();
|
145 |
+
}
|
146 |
+
if ( video_vars.player_type == "JW Player" ) {
|
147 |
+
jwplayer(jQuery('#kgvid_'+id+'_wrapper .jwplayer').attr('id')).stop();
|
148 |
+
}
|
149 |
+
}
|
150 |
+
try{
|
151 |
+
delete kgvid_video_vars[id];
|
152 |
+
}catch(e){} //gets around error thrown in IE 8
|
153 |
+
|
154 |
+
jQuery(window).off('resize', kgvid_resize_video(id));
|
155 |
+
|
156 |
+
jQuery.modal.close();
|
157 |
+
}
|
158 |
+
}); //end modal call
|
159 |
+
|
160 |
}
|
161 |
|
162 |
+
function kgvid_video_gallery_end_action(id, action) {
|
163 |
+
jQuery.modal.close();
|
164 |
+
if ( action == "next" ) {
|
165 |
+
jQuery('#kgvid_video_gallery_thumb_'+id).next('#'+jQuery('#kgvid_video_gallery_thumb_'+id).parent().attr('id')+' .kgvid_video_gallery_thumb').trigger('click')
|
166 |
+
}
|
167 |
+
}
|
168 |
|
169 |
+
function kgvid_timeupdate() {
|
170 |
jQuery('#'+this.id()+' > .vjs-poster').fadeOut();
|
171 |
}
|
172 |
|
173 |
function kgvid_setup_video(id) {
|
174 |
+
|
175 |
var video_vars = kgvid_video_vars[id];
|
176 |
+
|
177 |
+
if ( typeof (jQuery) == 'function' ) { jQuery.fn.fitVids=function(){}; }; //disable fitvids
|
178 |
+
|
179 |
var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false );
|
180 |
if (iOS && video_vars.player_type == "Strobe Media Playback" ) { video_vars.player_type = "Video.js"; }
|
181 |
|
183 |
jQuery('#video_'+id+'_watermark').attr('style', ''); //shows the hidden watermark div
|
184 |
jQuery('#video_'+id+'_div').prepend(jQuery('#video_'+id+'_meta'));
|
185 |
jQuery('#video_'+id+'_meta').attr('style', ''); //shows the hidden meta div
|
186 |
+
if ( video_vars.autoplay == "true" ) { jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover'); }
|
187 |
+
|
188 |
+
if ( video_vars.right_click != "on" ) {
|
189 |
+
jQuery('#video_'+id+'_div').bind('contextmenu',function() { return false; });
|
190 |
+
}
|
191 |
|
192 |
if ( video_vars.player_type == "Video.js" ) {
|
193 |
|
219 |
player.on('ended', function kgvid_play_end(){
|
220 |
kgvid_video_counter(id, 'end');
|
221 |
setTimeout(function() { jQuery('#video_'+id+' > .vjs-loading-spinner').hide(); }, 250);
|
222 |
+
if ( video_vars.endofvideooverlay != "" ) {
|
223 |
jQuery('#video_'+id+' > .vjs-poster').css({
|
224 |
'background-image':'url('+video_vars.endofvideooverlay+')'
|
225 |
}).fadeIn();
|
226 |
|
227 |
player.on('timeupdate', kgvid_timeupdate);
|
228 |
+
|
229 |
+
}
|
230 |
+
if ( jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end') != "" && jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end') != null ) {
|
231 |
+
kgvid_video_gallery_end_action(id, jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end'));
|
232 |
}
|
233 |
});
|
234 |
|
275 |
|
276 |
if ( video_vars.player_type == "Strobe Media Playback" || video_vars.player_type == "WordPress Default" ) {
|
277 |
|
|
|
278 |
jQuery('#video_'+id+'_div').hover(
|
279 |
function(){
|
280 |
jQuery('#video_'+id+'_meta').addClass('kgvid_video_meta_hover');
|
291 |
|
292 |
player = jQuery('#video_'+id+'_div video');
|
293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
if ( video_vars.set_volume != "" ) { player[0].volume = video_vars.set_volume; }
|
295 |
|
296 |
player.on('play', function kgvid_play_start(){
|
297 |
+
jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
|
298 |
kgvid_video_counter(id, 'play');
|
299 |
});
|
300 |
|
313 |
}
|
314 |
} );
|
315 |
}
|
316 |
+
if ( jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end') != "" && jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end') != null ) {
|
317 |
+
kgvid_video_gallery_end_action(id, jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end'));
|
318 |
+
}
|
319 |
});
|
320 |
|
321 |
+
|
322 |
} //end if WordPress Default
|
323 |
|
324 |
+
if ( kgvid_video_vars[id].player_type == "JW Player" ) {
|
325 |
+
player_id = jQuery('#video_'+id+'_div').children('div[id^="jwplayer"]').attr('id');
|
326 |
+
var player = jwplayer(player_id);
|
327 |
+
|
328 |
+
if ( video_vars.set_volume != "" ) { player.setVolume(Math.round(video_vars.set_volume*100)); }
|
329 |
+
|
330 |
+
player.onPlay( function() {
|
331 |
+
kgvid_video_counter(id, 'play');
|
332 |
+
|
333 |
+
if ( video_vars.meta ) {
|
334 |
+
jQuery('#video_'+id+'_div').hover(
|
335 |
+
function(){
|
336 |
+
jQuery('#video_'+id+'_meta').addClass('kgvid_video_meta_hover');
|
337 |
+
},
|
338 |
+
function(){
|
339 |
+
jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
|
340 |
+
}
|
341 |
+
);
|
342 |
+
jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
|
343 |
+
}
|
344 |
+
|
345 |
+
});
|
346 |
+
|
347 |
+
player.onComplete( function() {
|
348 |
+
kgvid_video_counter(id, 'end');
|
349 |
+
|
350 |
+
if ( jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end') != "" && jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end') != null ) {
|
351 |
+
kgvid_video_gallery_end_action(id, jQuery('#kgvid_video_gallery_thumb_'+id).data('gallery_end'));
|
352 |
+
}
|
353 |
+
|
354 |
+
});
|
355 |
+
|
356 |
+
}
|
357 |
+
|
358 |
if ( video_vars.resize == "true" || window.location.search.indexOf("kgvid_video_embed[enable]=true") !== false ) {
|
359 |
kgvid_resize_video(id);
|
360 |
+
jQuery(window).resize( function(){ kgvid_resize_video(id) } );
|
361 |
}
|
362 |
}
|
363 |
|
364 |
function kgvid_resize_all_videos() {
|
365 |
+
|
366 |
for (var id in kgvid_video_vars) {
|
367 |
kgvid_resize_video(id);
|
368 |
}
|
369 |
+
|
370 |
}
|
371 |
|
372 |
function kgvid_resize_video(id) {
|
373 |
|
374 |
+
if ( kgvid_video_vars.hasOwnProperty(id) ) {
|
375 |
+
var video_vars = kgvid_video_vars[id];
|
376 |
+
var set_width = video_vars.width;
|
377 |
+
var set_height = video_vars.height;
|
378 |
+
var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false );
|
379 |
+
if ( iOS ) { video_vars.player_type = "iOS"; }
|
380 |
+
var aspect_ratio = Math.round(set_height/set_width*1000)/1000
|
381 |
+
var reference_div = jQuery('#kgvid_'+id+'_wrapper').parent();
|
382 |
+
if ( reference_div.is('body') ) { parent_width = window.innerWidth; }
|
383 |
+
if ( reference_div.is('#simplemodal-data') ) { parent_width = window.outerWidth-40; }
|
384 |
+
else { parent_width = reference_div.width(); }
|
385 |
+
if ( parent_width < set_width ) { set_width = parent_width; }
|
386 |
+
|
387 |
+
if ( set_width != 0 ) {
|
388 |
+
|
389 |
+
jQuery('#kgvid_'+id+'_wrapper').width(set_width);
|
390 |
+
var set_height = Math.round(set_width * aspect_ratio);
|
391 |
+
if ( video_vars.player_type == "Video.js" ) {
|
392 |
+
videojs('video_'+id).width(set_width).height(set_height);
|
393 |
+
if ( set_width < 500 ) {
|
394 |
+
var scale = Math.round(100*set_width/500)/100;
|
395 |
+
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+')');
|
396 |
+
if ( set_width < 261 ) {
|
397 |
+
jQuery('#video_'+id+' > .vjs-control-bar > .vjs-mute-control').css('display', 'none');
|
398 |
+
if ( set_width < 221 ) {
|
399 |
+
jQuery('#video_'+id+' > .vjs-control-bar > .vjs-volume-control').css('display', 'none');
|
400 |
+
if ( set_width < 171 ) {
|
401 |
+
jQuery('#video_'+id+' > .vjs-control-bar > .vjs-duration, #video_'+id+' > .vjs-control-bar > .vjs-time-divider').css('display', 'none');
|
402 |
+
}
|
403 |
}
|
404 |
}
|
405 |
}
|
406 |
+
else { jQuery('#kgvid_'+id+'_wrapper .vjs-big-play-button').removeAttr('style'); }
|
407 |
+
}
|
408 |
+
if ( video_vars.player_type == "Strobe Media Playback" ) {
|
409 |
+
jQuery('#video_'+id+'_div').height(set_height);
|
410 |
+
jQuery('#video_'+id).attr('width',set_width).attr('height',set_height);
|
411 |
+
jQuery('#video_'+id+'_html5_api').attr('width',set_width).attr('height',set_height);
|
412 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
|
414 |
+
if ( video_vars.player_type == "iOS" ) {
|
415 |
+
jQuery('#video_'+id).attr('width',set_width).attr('height',set_height);
|
416 |
+
jQuery('#video_'+id).width(set_width).height(set_height);
|
417 |
|
418 |
+
jQuery('#kgvid_'+id+'_wrapper').find('.wp-video-shortcode').attr('width',set_width).attr('height',set_height);
|
419 |
+
jQuery('#kgvid_'+id+'_wrapper').find('.wp-video-shortcode').width(set_width).height(set_height);
|
420 |
+
|
421 |
+
}
|
422 |
|
423 |
}
|
424 |
|
425 |
+
var meta = jQuery('#kgvid_video_gallery_thumb_'+id).data('meta');
|
426 |
+
var extra_meta_height = Math.round(20*meta);
|
427 |
+
jQuery('#kgvid-simplemodal-container').width(parseInt(set_width)+10);
|
428 |
+
jQuery('#kgvid-simplemodal-container').height(parseInt(set_height)+10+extra_meta_height);
|
429 |
+
jQuery('.simplemodal-wrap').css('overflow', 'hidden');
|
430 |
}
|
|
|
431 |
}
|
432 |
|
433 |
function kgvid_strobemedia_callback(id) {
|
434 |
|
435 |
var player = document.getElementById('video_'+id);
|
436 |
var video_vars = kgvid_video_vars[id];
|
437 |
+
|
438 |
if ( player.getState() == 'buffering' || player.getState() == 'playing' ) {
|
439 |
kgvid_video_counter(video_vars.id, 'play');
|
440 |
}
|
442 |
if ( player.getState() == 'uninitialized' && video_vars.set_volume != "" ) {
|
443 |
player.setVolume(video_vars.set_volume);
|
444 |
}
|
445 |
+
|
446 |
}
|
447 |
|
448 |
function kgvid_video_counter(id, event) {
|
449 |
|
450 |
var video_vars = kgvid_video_vars[id];
|
451 |
var changed = false;
|
452 |
+
var title = jQuery('#kgvid_'+id+'_wrapper meta[itemprop=name]').attr('content');
|
453 |
|
454 |
var played = jQuery('#video_'+id+'_div').data("played") || "not played";
|
455 |
if ( played == "not played" ) {
|
457 |
changed = true;
|
458 |
jQuery('#video_'+id+'_div').data("played", "played");
|
459 |
}
|
460 |
+
if (typeof _gaq != "undefined") { _gaq.push(["_trackEvent", "Videos", kgvidL10n_frontend.playstart, title]); }
|
461 |
}
|
462 |
if ( event == "end" ) {
|
463 |
if (video_vars.countable) { //video is in the db
|
464 |
changed = true;
|
465 |
}
|
466 |
+
if (typeof _gaq != 'undefined') { _gaq.push(['_trackEvent', 'Videos', kgvidL10n_frontend.completeview, title]); }
|
467 |
}
|
468 |
if ( changed == true ) {
|
469 |
+
jQuery.post(kgvid_ajax_object.ajaxurl, {
|
470 |
action: 'kgvid_count_play',
|
471 |
+
security: kgvid_ajax_object.ajax_nonce,
|
472 |
post_id: id,
|
473 |
video_event: event
|
474 |
}, function(data) {
|
js/kgvid_video_plugin_admin.js
CHANGED
@@ -11,8 +11,8 @@ function kgvid_disable_thumb_buttons(postID, event) {
|
|
11 |
}
|
12 |
|
13 |
if (event == "onchange") {
|
14 |
-
document.getElementById('attachments-'+postID+'-thumbgenerate').value =
|
15 |
-
document.getElementById('attachments-'+postID+'-thumbrandomize').value =
|
16 |
}
|
17 |
}
|
18 |
}
|
@@ -65,9 +65,6 @@ function kgvid_break_video_on_close(postID) {
|
|
65 |
|
66 |
var playButton = jQuery(".kgvid-play-pause");
|
67 |
|
68 |
-
/* if ( jQuery('#show-thumb-video-'+postID+' :nth-child(2)').html() == "Hide video..." ) {
|
69 |
-
kgvid_reveal_thumb_video(postID); //hide the video if it's open
|
70 |
-
} */
|
71 |
playButton.off("click.kgvid");
|
72 |
video.preload = "none";
|
73 |
video.src = "";
|
@@ -99,7 +96,7 @@ function kgvid_thumb_video_loaded(postID) { //sets up mini custom player for mak
|
|
99 |
ed_media.on( 'escape',
|
100 |
function(postID) {
|
101 |
return function() {
|
102 |
-
if ( jQuery('#show-thumb-video-'+postID+' :nth-child(2)').html() ==
|
103 |
kgvid_reveal_thumb_video(postID);
|
104 |
}
|
105 |
//kgvid_break_video_on_close(postID);
|
@@ -190,14 +187,14 @@ function kgvid_reveal_thumb_video(postID) {
|
|
190 |
var text = jQuery('#show-thumb-video-'+postID+' :nth-child(2)');
|
191 |
video = document.getElementById('thumb-video-'+postID);
|
192 |
|
193 |
-
if ( text.html() ==
|
194 |
jQuery(video).data('busy', true);
|
195 |
jQuery(video).removeAttr('src');
|
196 |
jQuery(video).attr("preload", "metadata");
|
197 |
video.load();
|
198 |
|
199 |
if ( video.networkState == 1 || video.networkState == 2 ) {
|
200 |
-
text.html(
|
201 |
jQuery('#attachments-'+postID+'-thumbnailplaceholder').empty();
|
202 |
jQuery('#thumb-video-'+postID).on('timeupdate.kgvid', function() {
|
203 |
if (document.getElementById('thumb-video-'+postID).currentTime != 0) {
|
@@ -206,14 +203,14 @@ function kgvid_reveal_thumb_video(postID) {
|
|
206 |
}
|
207 |
});
|
208 |
}
|
209 |
-
else { text.html(
|
210 |
}
|
211 |
else { //video is being hidden
|
212 |
|
213 |
video.pause();
|
214 |
jQuery('#thumb-video-'+postID).off('timeupdate.kgvid');
|
215 |
kgvid_break_video_on_close(postID);
|
216 |
-
text.html(
|
217 |
|
218 |
}
|
219 |
jQuery('#thumb-video-'+postID+'-player').animate({opacity: 'toggle', height: 'toggle'}, 500);
|
@@ -248,7 +245,7 @@ function kgvid_generate_thumb(postID, buttonPushed) {
|
|
248 |
var page = "attachment";
|
249 |
|
250 |
jQuery(thumbnailplaceholderid).empty();
|
251 |
-
jQuery(thumbnailplaceholderid).append('<strong>
|
252 |
|
253 |
function kgvid_do_post() {
|
254 |
|
@@ -276,7 +273,7 @@ function kgvid_generate_thumb(postID, buttonPushed) {
|
|
276 |
jQuery(thumbnailboxoverlayID).fadeTo(2000, 1);
|
277 |
jQuery(cancelthumbdivID).animate({opacity: 'toggle', height: 'toggle'}, 500);
|
278 |
jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts", null);
|
279 |
-
jQuery(thumbnailboxID).prepend('<div id="saveallthumbs-'+postID+'-div"><input style="display:none;" type="button" id="attachments-'+postID+'-saveallthumbs" class="button-secondary kgvid-centered-block" value="
|
280 |
jQuery('#attachments-'+postID+'-saveallthumbs').animate({opacity: 'toggle', height: 'toggle'}, 1000);
|
281 |
}
|
282 |
|
@@ -342,7 +339,7 @@ function kgvid_generate_thumb(postID, buttonPushed) {
|
|
342 |
video.load();
|
343 |
jQuery(thumbnailboxoverlayID).fadeTo(2000, 1);
|
344 |
jQuery(cancelthumbdivID).animate({opacity: 0, height: 'toggle'}, 500);
|
345 |
-
jQuery(thumbnailboxID).prepend('<div id="saveallthumbs-'+postID+'-div"><input style="display:none;" type="button" id="attachments-'+postID+'-saveallthumbs" class="button-secondary kgvid-centered-block" value="
|
346 |
jQuery('#attachments-'+postID+'-saveallthumbs').animate({opacity: 'toggle', height: 'toggle'}, 500);
|
347 |
kgvid_break_video_on_close(postID);
|
348 |
}
|
@@ -406,7 +403,6 @@ function kgvid_save_canvas_thumb(postID, time_id, total, index) {
|
|
406 |
.done( function(thumb_url) {
|
407 |
if ( total == 1 ) {
|
408 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-poster').val(thumb_url).change();
|
409 |
-
//jQuery.post( ajaxurl , { action:"kgvid_schedule_cleanup_generated_files", security:kgflashmediaplayersecurity, thumbs:"true" } );
|
410 |
}
|
411 |
else {
|
412 |
kgvid_thumbnail_saveall_progress(postID, total);
|
@@ -435,7 +431,7 @@ function kgvid_saveall_thumbs(postID) {
|
|
435 |
var thumbnails = jQuery('#attachments-'+postID+'-kgflashmediaplayer-thumbnailbox').find('.kgvid_thumbnail');
|
436 |
var total = thumbnails.length;
|
437 |
|
438 |
-
jQuery('#saveallthumbs-'+postID+'-div').append('<div style="margin:5px;" id="saving_thumbs_meter" class="kgvid_meter"><div class="kgvid_meter_bar" style="width:0%;"><div class="kgvid_meter_text"></div></div></div><span id="saving_thumbs_status">
|
439 |
|
440 |
jQuery.each(thumbnails, function(key, value) {
|
441 |
if ( value.tagName.toLowerCase() == "canvas" ) {
|
@@ -519,7 +515,7 @@ function kgvid_enqueue_video_encode(postID) {
|
|
519 |
|
520 |
jQuery(encodeplaceholderid).empty();
|
521 |
jQuery(encodeprogressplaceholderid).empty();
|
522 |
-
jQuery(encodeplaceholderid).append('<strong>
|
523 |
|
524 |
jQuery.post(ajaxurl, { action:"kgvid_callffmpeg", security: kgflashmediaplayersecurity, movieurl: attachmentURL, ffmpeg_action: 'enqueue', encodeformats: kgvid_encode, attachmentID: postID, parent_id: parent_post_id, }, function(data) {
|
525 |
|
@@ -529,8 +525,11 @@ function kgvid_enqueue_video_encode(postID) {
|
|
529 |
jQuery.post( ajaxurl , { action:"kgvid_ajax_encode_videos", security:kgflashmediaplayersecurity } , function(data) {
|
530 |
jQuery(encodeprogressplaceholderid).empty();
|
531 |
jQuery(encodeplaceholderid).append(data.embed_display);
|
532 |
-
|
533 |
-
|
|
|
|
|
|
|
534 |
}, "json");
|
535 |
|
536 |
}, "json");
|
@@ -557,8 +556,8 @@ function kgvid_change_singleurl(url, basename, oldbasename) {
|
|
557 |
document.getElementById('attachments-'+oldbasename+'-thumbnailplaceholder').id = 'attachments-'+basename+'-thumbnailplaceholder';
|
558 |
document.getElementById('attachments-'+basename+'-thumbnailplaceholder').setAttribute("onchange", "document.getElementById('attachments-"+basename+"-thumbtime').value='';");
|
559 |
document.getElementById('attachments-'+basename+'-numberofthumbs').setAttribute("onchange", "document.getElementById('attachments-"+basename+"-thumbtime').value='';");
|
560 |
-
jQuery('#attachments-'+basename+'-thumbgenerate').replaceWith('<input type="button" id="attachments-'+basename+'-thumbgenerate" class="button-secondary" value="
|
561 |
-
jQuery('#attachments-'+basename+'-thumbrandomize').replaceWith('<input type="button" id="attachments-'+basename+'-thumbrandomize" class="button-secondary" value="
|
562 |
|
563 |
|
564 |
if ( document.getElementById('attachments-'+basename+'-kgflashmediaplayer-ffmpegexists').value == "on" ) {
|
@@ -567,12 +566,12 @@ function kgvid_change_singleurl(url, basename, oldbasename) {
|
|
567 |
document.getElementById('attachments-'+basename+'-thumbrandomize').disabled = false;
|
568 |
document.getElementById('attachments-'+basename+'-thumbrandomize').title = "";
|
569 |
//document.getElementById('attachments-'+basename+'-kgflashmediaplayer-encode').disabled = false;
|
570 |
-
document.getElementById('attachments-'+basename+'-kgflashmediaplayer-encode').title =
|
571 |
|
572 |
}
|
573 |
else {
|
574 |
-
document.getElementById('attachments-'+basename+'-thumbgenerate').title =
|
575 |
-
document.getElementById('attachments-'+basename+'-thumbrandomize').title =
|
576 |
}
|
577 |
document.getElementById('insertonlybutton').disabled = false;
|
578 |
document.getElementById('insertonlybutton').title = "";
|
@@ -606,17 +605,17 @@ function kgvid_set_singleurl() {
|
|
606 |
}
|
607 |
|
608 |
if (extensionExists == false) {
|
609 |
-
if ( url != "" ) { alert(
|
610 |
basename = "singleurl";
|
611 |
kgvid_change_singleurl(url, basename, oldbasename);
|
612 |
document.getElementById('attachments-'+basename+'-thumbgenerate').disabled = true;
|
613 |
-
document.getElementById('attachments-'+basename+'-thumbgenerate').title =
|
614 |
document.getElementById('attachments-'+basename+'-thumbrandomize').disabled = true;
|
615 |
-
document.getElementById('attachments-'+basename+'-thumbrandomize').title =
|
616 |
document.getElementById('attachments-'+basename+'-kgflashmediaplayer-encode').disabled = true;
|
617 |
-
document.getElementById('attachments-'+basename+'-kgflashmediaplayer-encode').title =
|
618 |
document.getElementById('insertonlybutton').disabled = true;
|
619 |
-
document.getElementById('insertonlybutton').title =
|
620 |
}
|
621 |
|
622 |
}
|
@@ -632,7 +631,7 @@ function kgvid_insert_shortcode() {
|
|
632 |
else { var set_featured = false; }
|
633 |
|
634 |
jQuery.post(ajaxurl, { action:'kgvid_callffmpeg', security: kgflashmediaplayersecurity, attachmentID: basename, movieurl: url, ffmpeg_action:'submit', poster: posterurl, parent_id: postid, set_featured: set_featured }, function(data) {
|
635 |
-
|
636 |
}, "json" );
|
637 |
|
638 |
var shortcode = "";
|
@@ -655,8 +654,8 @@ function kgvid_insert_shortcode() {
|
|
655 |
if (document.getElementById('attachments-'+basename+'-kgflashmediaplayer-poster').value !="") { shortcode += ' poster="' + document.getElementById('attachments-'+basename+'-kgflashmediaplayer-poster').value + '"'; }
|
656 |
if (document.getElementById('attachments-'+basename+'-kgflashmediaplayer-width').value !="") { shortcode += ' width="' + document.getElementById('attachments-'+basename+'-kgflashmediaplayer-width').value + '"'; }
|
657 |
if (document.getElementById('attachments-'+basename+'-kgflashmediaplayer-height').value !="") { shortcode += ' height="' + document.getElementById('attachments-'+basename+'-kgflashmediaplayer-height').value + '"'; }
|
|
|
658 |
shortcode += ']' + url + '[/KGVID] '; }
|
659 |
-
if (document.getElementById('downloadlink').checked) { shortcode += '<br /><a href="' + document.getElementById('attachments-'+basename+'-kgflashmediaplayer-url').value + '">Right-click or ctrl-click this link to download</a>'; }
|
660 |
|
661 |
parent.send_to_editor(shortcode);
|
662 |
}
|
@@ -682,9 +681,9 @@ function kgvid_cancel_encode(kgvid_pid, postID, video_key, format) {
|
|
682 |
|
683 |
}
|
684 |
|
685 |
-
function kgvid_delete_video(movieurl, postID, format, childID) {
|
686 |
|
687 |
-
var delete_for_sure = confirm(
|
688 |
|
689 |
if ( delete_for_sure == true ) {
|
690 |
|
@@ -695,7 +694,7 @@ function kgvid_delete_video(movieurl, postID, format, childID) {
|
|
695 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-meta'+format).append('<strong>Deleted</strong>');
|
696 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-security]')[0].value;
|
697 |
|
698 |
-
jQuery.post(ajaxurl, { action: "kgvid_delete_video", security: kgflashmediaplayersecurity, movieurl: movieurl, postid: postID, format: format, childid: childID }, function(data) {
|
699 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+format).change();
|
700 |
}, "json" );
|
701 |
|
@@ -719,7 +718,7 @@ function kgvid_cancel_thumbs(postID) {
|
|
719 |
|
720 |
}
|
721 |
|
722 |
-
function kgvid_redraw_encode_checkboxes(movieurl, postID, page) {
|
723 |
|
724 |
var kgflashmediaplayersecurity = jQuery('#attachments-'+postID+'-kgflashmediaplayer-security').val();
|
725 |
|
@@ -735,13 +734,13 @@ function kgvid_redraw_encode_checkboxes(movieurl, postID, page) {
|
|
735 |
});
|
736 |
JSON.stringify(kgvid_encode);
|
737 |
|
738 |
-
jQuery.post(ajaxurl, { action:"kgvid_generate_encode_checkboxes", security: kgflashmediaplayersecurity, movieurl: movieurl, post_id: postID, page: page, encodeformats: kgvid_encode }, function(data) {
|
739 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').empty();
|
740 |
-
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').append(data.
|
741 |
if ( page == "queue" ) {
|
742 |
jQuery('#tr_'+postID+'.currently_encoding').removeClass('currently_encoding');
|
743 |
-
jQuery('#tr_'+postID+'
|
744 |
-
if ( data.
|
745 |
jQuery('#clear_'+postID).css("display", "none");
|
746 |
jQuery('#tr_'+postID).addClass('currently_encoding');
|
747 |
}
|
@@ -785,16 +784,19 @@ function kgvid_encode_queue(action, order, id) {
|
|
785 |
var CheckboxTimeout = jQuery('#wpwrap').data("KGVIDCheckboxTimeout") || null;
|
786 |
if ( CheckboxTimeout ) { clearTimeout(CheckboxTimeout); }
|
787 |
|
|
|
|
|
|
|
788 |
if ( action == "delete" ) {
|
789 |
jQuery('#tr_'+id).fadeTo('slow', 0.5);
|
790 |
-
jQuery.post(ajaxurl, { action:"kgvid_clear_queue_entry", security: kgflashmediaplayersecurity, index: order }, function(data) {
|
791 |
jQuery('table.widefat > tbody').replaceWith("<tbody class='rows'>"+data+"</tbody>");
|
792 |
}, "html" );
|
793 |
}
|
794 |
|
795 |
if ( action == "clear_completed" ) {
|
796 |
jQuery('tbody > .kgvid_complete').fadeTo('slow', 0.5);
|
797 |
-
jQuery.post(ajaxurl, { action:"kgvid_clear_completed_queue", security: kgflashmediaplayersecurity }, function(data) {
|
798 |
jQuery('table.widefat > tbody').replaceWith("<tbody class='rows'>"+data+"</tbody>");
|
799 |
}, "html" );
|
800 |
}
|
@@ -802,7 +804,10 @@ function kgvid_encode_queue(action, order, id) {
|
|
802 |
}
|
803 |
|
804 |
function kgvid_save_plugin_settings(input_obj) {
|
|
|
805 |
jQuery('#setting-error-options-reset').fadeOut() //if settings were reset previously, clear the warning
|
|
|
|
|
806 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
807 |
var setting_value = input_obj.value;
|
808 |
|
@@ -811,13 +816,11 @@ function kgvid_save_plugin_settings(input_obj) {
|
|
811 |
else { setting_value = false; }
|
812 |
}
|
813 |
|
814 |
-
|
815 |
-
|
816 |
-
var save_span = '<span id="save_'+input_obj.id+'" class="settings-save-status kgvid_spinner"><span class="spinner" style="display:inline-block;"></span><span class="saved" style="display:none;">Saved.</span></span>';
|
817 |
if ( jQuery(input_obj).parents(".kgvid_video_app_required").length ) { jQuery(input_obj).parents(".kgvid_video_app_required").append(save_span); }
|
818 |
else { jQuery(input_obj).parents("td:first").append(save_span); }
|
819 |
|
820 |
-
if ( jQuery(input_obj).hasClass('affects_ffmpeg') == true ) { jQuery('#ffmpeg_h264_sample,#ffmpeg_output').html(
|
821 |
|
822 |
function kgvid_ajax_save() {
|
823 |
|
@@ -846,12 +849,23 @@ function kgvid_save_plugin_settings(input_obj) {
|
|
846 |
if ( jQuery(input_obj).hasClass('affects_player') == true ) {
|
847 |
jQuery( '#kgvid_samplevideo' ).attr( 'src', function ( i, val ) { return val; }); //reload the video iframe
|
848 |
}
|
849 |
-
|
850 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
851 |
jQuery('#ffmpeg_h264_sample').html(data.encode_string);
|
852 |
-
jQuery
|
853 |
-
|
854 |
-
|
|
|
|
|
|
|
|
|
|
|
855 |
}
|
856 |
|
857 |
jQuery( '#save_'+save_queue[0].id+' > .spinner' ).fadeOut(500).delay(500).next().delay(500).fadeIn(500).delay(1500).fadeOut(1000, function(){ jQuery(this).remove(); });
|
@@ -899,42 +913,39 @@ function kgvid_switch_settings_tab(tab) {
|
|
899 |
|
900 |
jQuery("#general_tab").addClass("nav-tab-active");
|
901 |
jQuery("#encoding_tab").removeClass("nav-tab-active");
|
902 |
-
jQuery(
|
903 |
-
jQuery(
|
904 |
jQuery(".kgvid_setting_nearvid").show();
|
905 |
-
jQuery(
|
906 |
-
jQuery(
|
907 |
-
jQuery("table:contains(Default number of thumbnails to generate)").show();
|
908 |
-
jQuery("h3:contains(Video Encoding Settings)").hide();
|
909 |
-
jQuery("table:contains(Path to applications folder on server)").hide();
|
910 |
}
|
911 |
|
912 |
if ( tab == "encoding" ) {
|
913 |
|
914 |
jQuery("#general_tab").removeClass("nav-tab-active");
|
915 |
jQuery("#encoding_tab").addClass("nav-tab-active");
|
916 |
-
|
917 |
-
jQuery(
|
|
|
918 |
jQuery(".kgvid_setting_nearvid").hide();
|
919 |
-
jQuery(
|
920 |
-
jQuery(
|
921 |
-
jQuery("table:contains(Default number of thumbnails to generate)").hide();
|
922 |
-
jQuery("table:contains(XML configuration file)").hide();
|
923 |
-
jQuery("h3:contains(The following options will only affect Flash playback)").hide();
|
924 |
-
jQuery("h3:contains(Video Encoding Settings)").show();
|
925 |
-
jQuery("table:contains(Path to applications folder on server)").show();
|
926 |
|
927 |
if ( jQuery('#app_path').data('ffmpeg_exists') == "on" && jQuery('#ffmpeg_output').html() == "" ) {
|
928 |
-
jQuery('#ffmpeg_output').html('Running test...')
|
929 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
930 |
-
jQuery.post(ajaxurl, { action: "kgvid_test_ffmpeg", security: kgflashmediaplayersecurity
|
931 |
-
jQuery('#ffmpeg_output').html(output);
|
932 |
-
|
|
|
|
|
|
|
|
|
933 |
}
|
934 |
}
|
935 |
|
936 |
kgvid_hide_plugin_settings();
|
937 |
-
kgvid_hide_ffmpeg_settings();
|
938 |
|
939 |
}
|
940 |
|
@@ -946,22 +957,39 @@ function kgvid_hide_plugin_settings() {
|
|
946 |
var encoding_tab = jQuery('#encoding_tab').hasClass('nav-tab-active');
|
947 |
|
948 |
if ( playback_option != "Strobe Media Playback" || encoding_tab ) {
|
949 |
-
jQuery(
|
950 |
-
jQuery(
|
951 |
-
}
|
952 |
-
if ( playback_option == "Strobe Media Playback" && general_tab ) {
|
953 |
-
jQuery("table:contains(XML configuration file)").show();
|
954 |
-
jQuery("h3:contains(The following options will only affect Flash playback)").show();
|
955 |
}
|
956 |
|
957 |
-
if (
|
958 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
959 |
}
|
960 |
-
else { jQuery("tr:contains(Skin Class)").show(); }
|
961 |
|
962 |
if ( ffmpeg_exists == "notinstalled" ) {
|
963 |
jQuery(".kgvid_video_app_required").addClass("kgvid_thumbnail_overlay");
|
964 |
-
jQuery(".kgvid_video_app_required").attr('title',
|
965 |
jQuery(".kgvid_video_app_required :input").attr('disabled', 'disabled');
|
966 |
jQuery("#ffmpeg_sample_div").slideUp(1000);
|
967 |
|
@@ -979,27 +1007,15 @@ function kgvid_hide_ffmpeg_settings() {
|
|
979 |
var video_app = jQuery('#video_app').val();
|
980 |
|
981 |
if (video_app == "ffmpeg") {
|
982 |
-
jQuery(
|
983 |
}
|
984 |
if (video_app == "avconv") {
|
985 |
-
jQuery(
|
986 |
video_app = "libav";
|
987 |
}
|
988 |
|
989 |
jQuery('.video_app_name').html(video_app.toUpperCase());
|
990 |
|
991 |
-
/* var rate_control = jQuery('#rate_control').val();
|
992 |
-
|
993 |
-
if ( rate_control == "crf" ) {
|
994 |
-
jQuery("tr:contains(Constant Rate Factors)").show();
|
995 |
-
jQuery("tr:contains(Average Bit Rate:)").hide();
|
996 |
-
}
|
997 |
-
|
998 |
-
if ( rate_control == "abr" ) {
|
999 |
-
jQuery("tr:contains(Constant Rate Factors)").hide();
|
1000 |
-
jQuery("tr:contains(Average Bit Rate:)").show();
|
1001 |
-
} */
|
1002 |
-
|
1003 |
}
|
1004 |
|
1005 |
function kgvid_set_bitrate_display() {
|
@@ -1015,11 +1031,11 @@ function kgvid_set_bitrate_display() {
|
|
1015 |
|
1016 |
function kgvid_set_all_featured() {
|
1017 |
|
1018 |
-
var set_for_sure = confirm("
|
1019 |
|
1020 |
if ( set_for_sure == true ) {
|
1021 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
1022 |
-
jQuery('td:contains(Set all as featured)').append('<div id="set_featured_meter" class="kgvid_meter"><div class="kgvid_meter_bar" style="width:0%;"><div class="kgvid_meter_text"></div></div></div><span id="set_featured_status">
|
1023 |
jQuery.post(ajaxurl, { action: "kgvid_get_set_featured", security: kgflashmediaplayersecurity }, function(count) {
|
1024 |
jQuery.post(ajaxurl, { action: "kgvid_set_featured", security: kgflashmediaplayersecurity });
|
1025 |
var interval = setInterval(function(){kgvid_check_cms_progress(count, 'set_featured')}, 1000);
|
@@ -1032,13 +1048,15 @@ function kgvid_switch_parents() {
|
|
1032 |
|
1033 |
var new_parent = document.getElementById("thumb_parent").value;
|
1034 |
var old_parent = "video";
|
1035 |
-
if (new_parent == "video") {
|
1036 |
-
|
1037 |
-
|
|
|
|
|
1038 |
|
1039 |
if ( set_for_sure == true ) {
|
1040 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
1041 |
-
jQuery('
|
1042 |
jQuery.post(ajaxurl, { action: "kgvid_get_switch_parents", security: kgflashmediaplayersecurity, parent: new_parent }, function(count) {
|
1043 |
jQuery.post(ajaxurl, { action: "kgvid_switch_parents", security: kgflashmediaplayersecurity, parent: new_parent });
|
1044 |
var interval = setInterval(function(){kgvid_check_cms_progress(count, 'switching_parents')}, 1000);
|
@@ -1058,7 +1076,7 @@ function kgvid_check_cms_progress(total, cms_type) {
|
|
1058 |
if ( remaining == 0 ) {
|
1059 |
clearInterval(interval);
|
1060 |
jQuery( '#wpbody-content' ).data(cms_type+'_interval', '');
|
1061 |
-
jQuery( '#'+cms_type+'_status' ).html('
|
1062 |
setTimeout(function(){ jQuery('#'+cms_type+'_meter, #'+cms_type+'_status').fadeOut("normal", function(){ jQuery(this).remove(); }); }, 3000);
|
1063 |
}
|
1064 |
}, "text" );
|
@@ -1114,6 +1132,49 @@ function kgvid_pick_image(button) {
|
|
1114 |
|
1115 |
}
|
1116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1117 |
function kgvid_media_library_icon_overlay() {
|
1118 |
var thumbnails = jQuery('.attachment-80x60, .attachment-preview.type-video .icon');
|
1119 |
jQuery.each(thumbnails, function(key, value) {
|
@@ -1123,3 +1184,11 @@ function kgvid_media_library_icon_overlay() {
|
|
1123 |
});
|
1124 |
jQuery('.kgvid-media-icon-overlay').prepend('<div class="kgvid-media-icon-play"><span></span></div>');
|
1125 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
12 |
|
13 |
if (event == "onchange") {
|
14 |
+
document.getElementById('attachments-'+postID+'-thumbgenerate').value = kgvidL10n.wait;
|
15 |
+
document.getElementById('attachments-'+postID+'-thumbrandomize').value = kgvidL10n.wait;
|
16 |
}
|
17 |
}
|
18 |
}
|
65 |
|
66 |
var playButton = jQuery(".kgvid-play-pause");
|
67 |
|
|
|
|
|
|
|
68 |
playButton.off("click.kgvid");
|
69 |
video.preload = "none";
|
70 |
video.src = "";
|
96 |
ed_media.on( 'escape',
|
97 |
function(postID) {
|
98 |
return function() {
|
99 |
+
if ( jQuery('#show-thumb-video-'+postID+' :nth-child(2)').html() == kgvidL10n.hidevideo ) {
|
100 |
kgvid_reveal_thumb_video(postID);
|
101 |
}
|
102 |
//kgvid_break_video_on_close(postID);
|
187 |
var text = jQuery('#show-thumb-video-'+postID+' :nth-child(2)');
|
188 |
video = document.getElementById('thumb-video-'+postID);
|
189 |
|
190 |
+
if ( text.html() == kgvidL10n.choosefromvideo ) { //video is being revealed
|
191 |
jQuery(video).data('busy', true);
|
192 |
jQuery(video).removeAttr('src');
|
193 |
jQuery(video).attr("preload", "metadata");
|
194 |
video.load();
|
195 |
|
196 |
if ( video.networkState == 1 || video.networkState == 2 ) {
|
197 |
+
text.html(kgvidL10n.hidevideo);
|
198 |
jQuery('#attachments-'+postID+'-thumbnailplaceholder').empty();
|
199 |
jQuery('#thumb-video-'+postID).on('timeupdate.kgvid', function() {
|
200 |
if (document.getElementById('thumb-video-'+postID).currentTime != 0) {
|
203 |
}
|
204 |
});
|
205 |
}
|
206 |
+
else { text.html(kgvidL10n.cantloadvideo); }
|
207 |
}
|
208 |
else { //video is being hidden
|
209 |
|
210 |
video.pause();
|
211 |
jQuery('#thumb-video-'+postID).off('timeupdate.kgvid');
|
212 |
kgvid_break_video_on_close(postID);
|
213 |
+
text.html(kgvidL10n.choosefromvideo);
|
214 |
|
215 |
}
|
216 |
jQuery('#thumb-video-'+postID+'-player').animate({opacity: 'toggle', height: 'toggle'}, 500);
|
245 |
var page = "attachment";
|
246 |
|
247 |
jQuery(thumbnailplaceholderid).empty();
|
248 |
+
jQuery(thumbnailplaceholderid).append('<strong>'+kgvidL10n.choosethumbnail+' </strong><div style="display:inline-block;" id="attachments-'+postID+'-kgflashmediaplayer-cancelthumbsdiv" name="attachments-'+postID+'-kgflashmediaplayer-cancelthumbsdiv"> <input type="button" id="attachments-'+postID+'-kgflashmediaplayer-cancelencode" class="button-secondary" value="Cancel Generating" name="attachments-'+postID+'-cancelencode" onclick="kgvid_cancel_thumbs(\''+postID+'\');"></div><div id="attachments-'+postID+'-kgflashmediaplayer-thumbnailboxoverlay" name="attachments-'+postID+'-kgflashmediaplayer-thumbnailboxoverlay" class="kgvid_thumbnail_overlay"><div name="attachments-'+postID+'-kgflashmediaplayer-thumbnailbox" id="attachments-'+postID+'-kgflashmediaplayer-thumbnailbox" class="kgvid_thumbnail_box"></div></div>');
|
249 |
|
250 |
function kgvid_do_post() {
|
251 |
|
273 |
jQuery(thumbnailboxoverlayID).fadeTo(2000, 1);
|
274 |
jQuery(cancelthumbdivID).animate({opacity: 'toggle', height: 'toggle'}, 500);
|
275 |
jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts", null);
|
276 |
+
jQuery(thumbnailboxID).prepend('<div id="saveallthumbs-'+postID+'-div"><input style="display:none;" type="button" id="attachments-'+postID+'-saveallthumbs" class="button-secondary kgvid-centered-block" value="'+kgvidL10n.saveallthumbnails+'" name="attachments-'+postID+'-saveallthumbs" onclick="kgvid_saveall_thumbs(\''+postID+'\');"></div>');
|
277 |
jQuery('#attachments-'+postID+'-saveallthumbs').animate({opacity: 'toggle', height: 'toggle'}, 1000);
|
278 |
}
|
279 |
|
339 |
video.load();
|
340 |
jQuery(thumbnailboxoverlayID).fadeTo(2000, 1);
|
341 |
jQuery(cancelthumbdivID).animate({opacity: 0, height: 'toggle'}, 500);
|
342 |
+
jQuery(thumbnailboxID).prepend('<div id="saveallthumbs-'+postID+'-div"><input style="display:none;" type="button" id="attachments-'+postID+'-saveallthumbs" class="button-secondary kgvid-centered-block" value="'+kgvidL10n.saveallthumbnails+'" name="attachments-'+postID+'-saveallthumbs" onclick="kgvid_saveall_thumbs(\''+postID+'\');"></div>');
|
343 |
jQuery('#attachments-'+postID+'-saveallthumbs').animate({opacity: 'toggle', height: 'toggle'}, 500);
|
344 |
kgvid_break_video_on_close(postID);
|
345 |
}
|
403 |
.done( function(thumb_url) {
|
404 |
if ( total == 1 ) {
|
405 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-poster').val(thumb_url).change();
|
|
|
406 |
}
|
407 |
else {
|
408 |
kgvid_thumbnail_saveall_progress(postID, total);
|
431 |
var thumbnails = jQuery('#attachments-'+postID+'-kgflashmediaplayer-thumbnailbox').find('.kgvid_thumbnail');
|
432 |
var total = thumbnails.length;
|
433 |
|
434 |
+
jQuery('#saveallthumbs-'+postID+'-div').append('<div style="margin:5px;" id="saving_thumbs_meter" class="kgvid_meter"><div class="kgvid_meter_bar" style="width:0%;"><div class="kgvid_meter_text"></div></div></div><span id="saving_thumbs_status"> '+kgvidL10n.saving+'</span>');
|
435 |
|
436 |
jQuery.each(thumbnails, function(key, value) {
|
437 |
if ( value.tagName.toLowerCase() == "canvas" ) {
|
515 |
|
516 |
jQuery(encodeplaceholderid).empty();
|
517 |
jQuery(encodeprogressplaceholderid).empty();
|
518 |
+
jQuery(encodeplaceholderid).append('<strong>'+kgvidL10n.loading+'</strong>');
|
519 |
|
520 |
jQuery.post(ajaxurl, { action:"kgvid_callffmpeg", security: kgflashmediaplayersecurity, movieurl: attachmentURL, ffmpeg_action: 'enqueue', encodeformats: kgvid_encode, attachmentID: postID, parent_id: parent_post_id, }, function(data) {
|
521 |
|
525 |
jQuery.post( ajaxurl , { action:"kgvid_ajax_encode_videos", security:kgflashmediaplayersecurity } , function(data) {
|
526 |
jQuery(encodeprogressplaceholderid).empty();
|
527 |
jQuery(encodeplaceholderid).append(data.embed_display);
|
528 |
+
|
529 |
+
setTimeout(function(){
|
530 |
+
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').css('opacity', '0.5');
|
531 |
+
kgvid_redraw_encode_checkboxes(attachmentURL, postID, page);
|
532 |
+
}, 2000);
|
533 |
}, "json");
|
534 |
|
535 |
}, "json");
|
556 |
document.getElementById('attachments-'+oldbasename+'-thumbnailplaceholder').id = 'attachments-'+basename+'-thumbnailplaceholder';
|
557 |
document.getElementById('attachments-'+basename+'-thumbnailplaceholder').setAttribute("onchange", "document.getElementById('attachments-"+basename+"-thumbtime').value='';");
|
558 |
document.getElementById('attachments-'+basename+'-numberofthumbs').setAttribute("onchange", "document.getElementById('attachments-"+basename+"-thumbtime').value='';");
|
559 |
+
jQuery('#attachments-'+basename+'-thumbgenerate').replaceWith('<input disabled="disabled" type="button" id="attachments-'+basename+'-thumbgenerate" class="button-secondary" value="'+kgvidL10n.generate+'" name="thumbgenerate" onclick="kgvid_generate_thumb(\''+basename+'\', \'generate\');" >');
|
560 |
+
jQuery('#attachments-'+basename+'-thumbrandomize').replaceWith('<input disabled="disabled" type="button" id="attachments-'+basename+'-thumbrandomize" class="button-secondary" value="'+kgvidL10n.randomize+'" name="thumbgenerate" onclick="kgvid_generate_thumb(\''+basename+'\', \'random\');" >');
|
561 |
|
562 |
|
563 |
if ( document.getElementById('attachments-'+basename+'-kgflashmediaplayer-ffmpegexists').value == "on" ) {
|
566 |
document.getElementById('attachments-'+basename+'-thumbrandomize').disabled = false;
|
567 |
document.getElementById('attachments-'+basename+'-thumbrandomize').title = "";
|
568 |
//document.getElementById('attachments-'+basename+'-kgflashmediaplayer-encode').disabled = false;
|
569 |
+
document.getElementById('attachments-'+basename+'-kgflashmediaplayer-encode').title = kgvidL10n.loading;
|
570 |
|
571 |
}
|
572 |
else {
|
573 |
+
document.getElementById('attachments-'+basename+'-thumbgenerate').title = kgvidL10n.ffmpegnotfound;
|
574 |
+
document.getElementById('attachments-'+basename+'-thumbrandomize').title = kgvidL10n.ffmpegnotfound;
|
575 |
}
|
576 |
document.getElementById('insertonlybutton').disabled = false;
|
577 |
document.getElementById('insertonlybutton').title = "";
|
605 |
}
|
606 |
|
607 |
if (extensionExists == false) {
|
608 |
+
if ( url != "" ) { alert(kgvidL10n.validurlalert); }
|
609 |
basename = "singleurl";
|
610 |
kgvid_change_singleurl(url, basename, oldbasename);
|
611 |
document.getElementById('attachments-'+basename+'-thumbgenerate').disabled = true;
|
612 |
+
document.getElementById('attachments-'+basename+'-thumbgenerate').title = kgvidL10n.pleasevalidurl;
|
613 |
document.getElementById('attachments-'+basename+'-thumbrandomize').disabled = true;
|
614 |
+
document.getElementById('attachments-'+basename+'-thumbrandomize').title = kgvidL10n.pleasevalidurl;
|
615 |
document.getElementById('attachments-'+basename+'-kgflashmediaplayer-encode').disabled = true;
|
616 |
+
document.getElementById('attachments-'+basename+'-kgflashmediaplayer-encode').title = kgvidL10n.pleasevalidurl;
|
617 |
document.getElementById('insertonlybutton').disabled = true;
|
618 |
+
document.getElementById('insertonlybutton').title = kgvidL10n.pleasevalidurl;
|
619 |
}
|
620 |
|
621 |
}
|
631 |
else { var set_featured = false; }
|
632 |
|
633 |
jQuery.post(ajaxurl, { action:'kgvid_callffmpeg', security: kgflashmediaplayersecurity, attachmentID: basename, movieurl: url, ffmpeg_action:'submit', poster: posterurl, parent_id: postid, set_featured: set_featured }, function(data) {
|
634 |
+
|
635 |
}, "json" );
|
636 |
|
637 |
var shortcode = "";
|
654 |
if (document.getElementById('attachments-'+basename+'-kgflashmediaplayer-poster').value !="") { shortcode += ' poster="' + document.getElementById('attachments-'+basename+'-kgflashmediaplayer-poster').value + '"'; }
|
655 |
if (document.getElementById('attachments-'+basename+'-kgflashmediaplayer-width').value !="") { shortcode += ' width="' + document.getElementById('attachments-'+basename+'-kgflashmediaplayer-width').value + '"'; }
|
656 |
if (document.getElementById('attachments-'+basename+'-kgflashmediaplayer-height').value !="") { shortcode += ' height="' + document.getElementById('attachments-'+basename+'-kgflashmediaplayer-height').value + '"'; }
|
657 |
+
if (document.getElementById('downloadlink').checked ) { shortcode += ' downloadlink="true"'; }
|
658 |
shortcode += ']' + url + '[/KGVID] '; }
|
|
|
659 |
|
660 |
parent.send_to_editor(shortcode);
|
661 |
}
|
681 |
|
682 |
}
|
683 |
|
684 |
+
function kgvid_delete_video(movieurl, postID, format, childID, blogID) {
|
685 |
|
686 |
+
var delete_for_sure = confirm(kgvidL10n.deletemessage);
|
687 |
|
688 |
if ( delete_for_sure == true ) {
|
689 |
|
694 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-meta'+format).append('<strong>Deleted</strong>');
|
695 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-security]')[0].value;
|
696 |
|
697 |
+
jQuery.post(ajaxurl, { action: "kgvid_delete_video", security: kgflashmediaplayersecurity, movieurl: movieurl, postid: postID, format: format, childid: childID, blogid: blogID }, function(data) {
|
698 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+format).change();
|
699 |
}, "json" );
|
700 |
|
718 |
|
719 |
}
|
720 |
|
721 |
+
function kgvid_redraw_encode_checkboxes(movieurl, postID, page, blogID) {
|
722 |
|
723 |
var kgflashmediaplayersecurity = jQuery('#attachments-'+postID+'-kgflashmediaplayer-security').val();
|
724 |
|
734 |
});
|
735 |
JSON.stringify(kgvid_encode);
|
736 |
|
737 |
+
jQuery.post(ajaxurl, { action:"kgvid_generate_encode_checkboxes", security: kgflashmediaplayersecurity, movieurl: movieurl, post_id: postID, page: page, blog_id: blogID, encodeformats: kgvid_encode }, function(data) {
|
738 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').empty();
|
739 |
+
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').append(data.checkboxes);
|
740 |
if ( page == "queue" ) {
|
741 |
jQuery('#tr_'+postID+'.currently_encoding').removeClass('currently_encoding');
|
742 |
+
jQuery('#tr_'+postID+' #clear_'+postID).css("display", "block");
|
743 |
+
if ( data.encoding == true ) {
|
744 |
jQuery('#clear_'+postID).css("display", "none");
|
745 |
jQuery('#tr_'+postID).addClass('currently_encoding');
|
746 |
}
|
784 |
var CheckboxTimeout = jQuery('#wpwrap').data("KGVIDCheckboxTimeout") || null;
|
785 |
if ( CheckboxTimeout ) { clearTimeout(CheckboxTimeout); }
|
786 |
|
787 |
+
var scope = 'blog';
|
788 |
+
if ( pagenow == 'settings_page_kgvid_network_video_encoding_queue-network' ) { scope = 'network' }
|
789 |
+
|
790 |
if ( action == "delete" ) {
|
791 |
jQuery('#tr_'+id).fadeTo('slow', 0.5);
|
792 |
+
jQuery.post(ajaxurl, { action:"kgvid_clear_queue_entry", security: kgflashmediaplayersecurity, index: order, scope: scope }, function(data) {
|
793 |
jQuery('table.widefat > tbody').replaceWith("<tbody class='rows'>"+data+"</tbody>");
|
794 |
}, "html" );
|
795 |
}
|
796 |
|
797 |
if ( action == "clear_completed" ) {
|
798 |
jQuery('tbody > .kgvid_complete').fadeTo('slow', 0.5);
|
799 |
+
jQuery.post(ajaxurl, { action:"kgvid_clear_completed_queue", security: kgflashmediaplayersecurity, scope: scope }, function(data) {
|
800 |
jQuery('table.widefat > tbody').replaceWith("<tbody class='rows'>"+data+"</tbody>");
|
801 |
}, "html" );
|
802 |
}
|
804 |
}
|
805 |
|
806 |
function kgvid_save_plugin_settings(input_obj) {
|
807 |
+
|
808 |
jQuery('#setting-error-options-reset').fadeOut() //if settings were reset previously, clear the warning
|
809 |
+
jQuery('.settings-error').fadeOut(); //clear error messages
|
810 |
+
|
811 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
812 |
var setting_value = input_obj.value;
|
813 |
|
816 |
else { setting_value = false; }
|
817 |
}
|
818 |
|
819 |
+
var save_span = '<span id="save_'+input_obj.id+'" class="settings-save-status kgvid_spinner"><span class="spinner" style="display:inline-block;"></span><span class="saved" style="display:none;">'+kgvidL10n.saved+'</span></span>';
|
|
|
|
|
820 |
if ( jQuery(input_obj).parents(".kgvid_video_app_required").length ) { jQuery(input_obj).parents(".kgvid_video_app_required").append(save_span); }
|
821 |
else { jQuery(input_obj).parents("td:first").append(save_span); }
|
822 |
|
823 |
+
if ( jQuery(input_obj).hasClass('affects_ffmpeg') == true ) { jQuery('#ffmpeg_h264_sample,#ffmpeg_output').html(kgvidL10n.saving); }
|
824 |
|
825 |
function kgvid_ajax_save() {
|
826 |
|
849 |
if ( jQuery(input_obj).hasClass('affects_player') == true ) {
|
850 |
jQuery( '#kgvid_samplevideo' ).attr( 'src', function ( i, val ) { return val; }); //reload the video iframe
|
851 |
}
|
852 |
+
|
853 |
+
if ( data.auto_thumb_label != "" ) {
|
854 |
+
jQuery('#auto_thumb_label').html(data.auto_thumb_label);
|
855 |
+
jQuery('#auto_thumb_label :input').change(function() { kgvid_save_plugin_settings(this); } );
|
856 |
+
}
|
857 |
+
|
858 |
+
if ( jQuery('#app_path').data('ffmpeg_exists') == "on" && jQuery(input_obj).hasClass('affects_ffmpeg') == true && jQuery('#ffmpeg_output').length != 0 ) {
|
859 |
+
jQuery('#ffmpeg_output').html(kgvidL10n.runningtest);
|
860 |
jQuery('#ffmpeg_h264_sample').html(data.encode_string);
|
861 |
+
jQuery('#ffmpeg_watermark_example').slideUp('slow');
|
862 |
+
jQuery.post(ajaxurl, { action: "kgvid_test_ffmpeg", security: kgflashmediaplayersecurity }, function(data) {
|
863 |
+
jQuery('#ffmpeg_output').html(data.output);
|
864 |
+
if ( 'watermark_preview' in data ) {
|
865 |
+
jQuery('#ffmpeg_watermark_example').empty().append('<img src="'+data.watermark_preview+'?'+String(Math.floor((Math.random()*1000)+1))+'" style="margin-top:10px;width:640px;">').slideDown('slow');
|
866 |
+
}
|
867 |
+
|
868 |
+
}, "json" );
|
869 |
}
|
870 |
|
871 |
jQuery( '#save_'+save_queue[0].id+' > .spinner' ).fadeOut(500).delay(500).next().delay(500).fadeIn(500).delay(1500).fadeOut(1000, function(){ jQuery(this).remove(); });
|
913 |
|
914 |
jQuery("#general_tab").addClass("nav-tab-active");
|
915 |
jQuery("#encoding_tab").removeClass("nav-tab-active");
|
916 |
+
jQuery('h3:eq(0), h3:eq(2)').show();
|
917 |
+
jQuery('table:eq(0), table:eq(1), table:eq(3)').show();
|
918 |
jQuery(".kgvid_setting_nearvid").show();
|
919 |
+
jQuery('h3:eq(3)').hide();
|
920 |
+
jQuery('table:eq(4)').hide();
|
|
|
|
|
|
|
921 |
}
|
922 |
|
923 |
if ( tab == "encoding" ) {
|
924 |
|
925 |
jQuery("#general_tab").removeClass("nav-tab-active");
|
926 |
jQuery("#encoding_tab").addClass("nav-tab-active");
|
927 |
+
|
928 |
+
jQuery('h3:eq(0), h3:eq(2)').hide();
|
929 |
+
jQuery('table:eq(0), table:eq(1), table:eq(2), table:eq(3)').hide();
|
930 |
jQuery(".kgvid_setting_nearvid").hide();
|
931 |
+
jQuery('h3:eq(3)').show();
|
932 |
+
jQuery('table:eq(4)').show();
|
|
|
|
|
|
|
|
|
|
|
933 |
|
934 |
if ( jQuery('#app_path').data('ffmpeg_exists') == "on" && jQuery('#ffmpeg_output').html() == "" ) {
|
935 |
+
jQuery('#ffmpeg_output').html('Running test...');
|
936 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
937 |
+
jQuery.post(ajaxurl, { action: "kgvid_test_ffmpeg", security: kgflashmediaplayersecurity }, function(data) {
|
938 |
+
jQuery('#ffmpeg_output').html(data.output);
|
939 |
+
jQuery('#ffmpeg_watermark_example').empty();
|
940 |
+
if ( 'watermark_preview' in data ) {
|
941 |
+
jQuery('#ffmpeg_watermark_example').append('<img src="'+data.watermark_preview+'?'+String(Math.floor((Math.random()*1000)+1))+'" style="margin-top:10px;width:640px;">');
|
942 |
+
}
|
943 |
+
}, "json" );
|
944 |
}
|
945 |
}
|
946 |
|
947 |
kgvid_hide_plugin_settings();
|
948 |
+
if ( jQuery('#video_app').length > 0 ) { kgvid_hide_ffmpeg_settings(); }
|
949 |
|
950 |
}
|
951 |
|
957 |
var encoding_tab = jQuery('#encoding_tab').hasClass('nav-tab-active');
|
958 |
|
959 |
if ( playback_option != "Strobe Media Playback" || encoding_tab ) {
|
960 |
+
jQuery('table:eq(2)').hide();
|
961 |
+
jQuery('h3:eq(1)').hide();
|
|
|
|
|
|
|
|
|
962 |
}
|
963 |
|
964 |
+
if ( general_tab ) {
|
965 |
+
|
966 |
+
if ( playback_option == "Strobe Media Playback" ) {
|
967 |
+
jQuery('table:eq(2)').show();
|
968 |
+
jQuery('h3:eq(1)').show();
|
969 |
+
}
|
970 |
+
|
971 |
+
if ( playback_option == "WordPress Default" || playback_option == "JW Player" ) {
|
972 |
+
jQuery('#js_skin').parents().eq(1).hide();
|
973 |
+
}
|
974 |
+
|
975 |
+
if ( playback_option == "Video.js" || playback_option == "Strobe Media Playback" ) {
|
976 |
+
jQuery('#js_skin').parents().eq(1).show();
|
977 |
+
}
|
978 |
+
|
979 |
+
if ( playback_option == "JW Player" ) {
|
980 |
+
jQuery('#endofvideooverlay').parents().eq(1).hide();
|
981 |
+
jQuery('#jw_player_id_select').fadeIn();
|
982 |
+
}
|
983 |
+
else {
|
984 |
+
jQuery('#endofvideooverlay').parents().eq(1).show();
|
985 |
+
jQuery('#jw_player_id_select').fadeOut();
|
986 |
+
}
|
987 |
+
|
988 |
}
|
|
|
989 |
|
990 |
if ( ffmpeg_exists == "notinstalled" ) {
|
991 |
jQuery(".kgvid_video_app_required").addClass("kgvid_thumbnail_overlay");
|
992 |
+
jQuery(".kgvid_video_app_required").attr('title', kgvidL10n.ffmpegrequired);
|
993 |
jQuery(".kgvid_video_app_required :input").attr('disabled', 'disabled');
|
994 |
jQuery("#ffmpeg_sample_div").slideUp(1000);
|
995 |
|
1007 |
var video_app = jQuery('#video_app').val();
|
1008 |
|
1009 |
if (video_app == "ffmpeg") {
|
1010 |
+
jQuery('#video_bitrate_flag').parents().eq(2).show();
|
1011 |
}
|
1012 |
if (video_app == "avconv") {
|
1013 |
+
jQuery('#video_bitrate_flag').parents().eq(2).hide();
|
1014 |
video_app = "libav";
|
1015 |
}
|
1016 |
|
1017 |
jQuery('.video_app_name').html(video_app.toUpperCase());
|
1018 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1019 |
}
|
1020 |
|
1021 |
function kgvid_set_bitrate_display() {
|
1031 |
|
1032 |
function kgvid_set_all_featured() {
|
1033 |
|
1034 |
+
var set_for_sure = confirm(kgvidL10n.featuredwarning+"\n"+kgvidL10n.cancel_ok);
|
1035 |
|
1036 |
if ( set_for_sure == true ) {
|
1037 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
1038 |
+
jQuery('td:contains(Set all as featured)').append('<div id="set_featured_meter" class="kgvid_meter"><div class="kgvid_meter_bar" style="width:0%;"><div class="kgvid_meter_text"></div></div></div><span id="set_featured_status"> '+kgvidL10n.processing+'</span>');
|
1039 |
jQuery.post(ajaxurl, { action: "kgvid_get_set_featured", security: kgflashmediaplayersecurity }, function(count) {
|
1040 |
jQuery.post(ajaxurl, { action: "kgvid_set_featured", security: kgflashmediaplayersecurity });
|
1041 |
var interval = setInterval(function(){kgvid_check_cms_progress(count, 'set_featured')}, 1000);
|
1048 |
|
1049 |
var new_parent = document.getElementById("thumb_parent").value;
|
1050 |
var old_parent = "video";
|
1051 |
+
if (new_parent == "video") {
|
1052 |
+
old_parent = "post";
|
1053 |
+
var set_for_sure = confirm(kgvidL10n.parentwarning_videos+"\n "+kgvidL10n.cancel_ok);
|
1054 |
+
}
|
1055 |
+
else { var set_for_sure = confirm(kgvidL10n.parentwarning_posts+"\n "+kgvidL10n.cancel_ok); }
|
1056 |
|
1057 |
if ( set_for_sure == true ) {
|
1058 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
1059 |
+
jQuery('#thumb_parent').parent().append('<div id="switching_parents_meter" class="kgvid_meter"><div class="kgvid_meter_bar" style="width:0%;"><div class="kgvid_meter_text"></div></div></div><span id="switching_parents_status"> '+kgvidL10n.processing+'</span>');
|
1060 |
jQuery.post(ajaxurl, { action: "kgvid_get_switch_parents", security: kgflashmediaplayersecurity, parent: new_parent }, function(count) {
|
1061 |
jQuery.post(ajaxurl, { action: "kgvid_switch_parents", security: kgflashmediaplayersecurity, parent: new_parent });
|
1062 |
var interval = setInterval(function(){kgvid_check_cms_progress(count, 'switching_parents')}, 1000);
|
1076 |
if ( remaining == 0 ) {
|
1077 |
clearInterval(interval);
|
1078 |
jQuery( '#wpbody-content' ).data(cms_type+'_interval', '');
|
1079 |
+
jQuery( '#'+cms_type+'_status' ).html(' '+kgvidL10n.complete);
|
1080 |
setTimeout(function(){ jQuery('#'+cms_type+'_meter, #'+cms_type+'_status').fadeOut("normal", function(){ jQuery(this).remove(); }); }, 3000);
|
1081 |
}
|
1082 |
}, "text" );
|
1132 |
|
1133 |
}
|
1134 |
|
1135 |
+
function kgvid_pick_attachment(button) {
|
1136 |
+
|
1137 |
+
var frame;
|
1138 |
+
|
1139 |
+
jQuery( function() {
|
1140 |
+
|
1141 |
+
// Build the choose from library frame.
|
1142 |
+
|
1143 |
+
var $el = jQuery(button);
|
1144 |
+
event.preventDefault();
|
1145 |
+
|
1146 |
+
// If the media frame already exists, reopen it.
|
1147 |
+
if ( frame ) {
|
1148 |
+
frame.open();
|
1149 |
+
return;
|
1150 |
+
}
|
1151 |
+
|
1152 |
+
// Create the media frame.
|
1153 |
+
frame = wp.media.frames.customHeader = wp.media({
|
1154 |
+
// Set the title of the modal.
|
1155 |
+
title: $el.data('choose'),
|
1156 |
+
|
1157 |
+
// Customize the submit button.
|
1158 |
+
button: {
|
1159 |
+
// Set the text of the button.
|
1160 |
+
text: $el.data('update'),
|
1161 |
+
close: true
|
1162 |
+
}
|
1163 |
+
});
|
1164 |
+
|
1165 |
+
// When an image is selected, run a callback.
|
1166 |
+
frame.on( 'select', function() {
|
1167 |
+
// Grab the selected attachment.
|
1168 |
+
var attachment = frame.state().get('selection').first()
|
1169 |
+
jQuery('#'+$el.data('change')).val(attachment.attributes.url);
|
1170 |
+
jQuery('#'+$el.data('change')).change();
|
1171 |
+
});
|
1172 |
+
|
1173 |
+
frame.open();
|
1174 |
+
});
|
1175 |
+
|
1176 |
+
}
|
1177 |
+
|
1178 |
function kgvid_media_library_icon_overlay() {
|
1179 |
var thumbnails = jQuery('.attachment-80x60, .attachment-preview.type-video .icon');
|
1180 |
jQuery.each(thumbnails, function(key, value) {
|
1184 |
});
|
1185 |
jQuery('.kgvid-media-icon-overlay').prepend('<div class="kgvid-media-icon-play"><span></span></div>');
|
1186 |
}
|
1187 |
+
|
1188 |
+
function kgvid_add_subtitles(id) {
|
1189 |
+
var tracks = jQuery('#kgflashmediaplayer-'+id+'-trackdiv');
|
1190 |
+
track_number = tracks.children().length;
|
1191 |
+
track_label = track_number+1;
|
1192 |
+
tracks.append('<div id="kgflashmediaplayer-'+id+'-trackdiv-'+track_number+'" class="kgvid_thumbnail_box kgvid_track_box"><strong>Track '+track_label+'</strong><span class="kgvid_track_box_removeable">X</span><br />'+kgvidL10n.tracktype+' <select name="attachments['+id+'][kgflashmediaplayer-track]['+track_number+'][kind]" id="attachments-'+id+'-kgflashmediaplayer-track_'+track_number+'_kind]"><option value="subtitles">'+kgvidL10n.subtitles+'</option><option value="captions">'+kgvidL10n.captions+'</option><option value="chapters">'+kgvidL10n.chapters+'</option></select><br /><span id="pick-track'+track_number+'" class="button-secondary" style="margin:10px 0;" data-choose="'+kgvidL10n.choosetextfile+'" data-update="'+kgvidL10n.settracksource+'" data-change="attachments-'+id+'-kgflashmediaplayer-track_'+track_number+'_src" onclick="kgvid_pick_attachment(this);">'+kgvidL10n.choosefromlibrary+'</span><br />URL: <input name="attachments['+id+'][kgflashmediaplayer-track]['+track_number+'][src]" id="attachments-'+id+'-kgflashmediaplayer-track_'+track_number+'_src" type="text" value="" class="text"><br />'+kgvidL10n.languagecode+' <input name="attachments['+id+'][kgflashmediaplayer-track]['+track_number+'][srclang]" id="attachments-'+id+'-kgflashmediaplayer-track_'+track_number+'_srclang" type="text" value="" maxlength="2" style="width:4'+track_number+'px;"><br />'+kgvidL10n.label+' <input name="attachments['+id+'][kgflashmediaplayer-track]['+track_number+'][label]" id="attachments-'+id+'-kgflashmediaplayer-track_'+track_number+'_label" type="text" value="" class="text"></div>');
|
1193 |
+
jQuery('.kgvid_track_box_removeable').click(function() { jQuery(this).parent().remove(); jQuery('form.compat-item input').first().change(); });
|
1194 |
+
}
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Video Embed & Thumbnail Generator ===
|
2 |
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, html5, shortcode, thumbnail, poster, ffmpeg, libav, embed, mobile, webm, ogg, h.264, h264, responsive, mp4
|
5 |
Requires at least: 3.5
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 4.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -12,31 +12,43 @@ Generates thumbnails, encodes HTML5-compliant videos, and embeds locally hosted
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
= A plugin to make embedding videos, generating thumbnails, and encoding HTML5-
|
16 |
|
17 |
-
|
18 |
|
19 |
-
You have the option to use
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
26 |
|
27 |
After you select a thumbnail it will be registered in the Wordpress Media Library and added to the video's attachments. Unused thumbnails will be deleted.
|
28 |
|
29 |
In the plugin settings you can set the default maximum width and height based on the dimensions of your particular template and those values will be filled in when you open the window. If you generate thumbnails, the video display dimensions will be adjusted automatically to match the size and aspect ratio of the video file. You can make further adjustments if you want.
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
34 |
|
35 |
-
If you have the proper libraries installed, you can choose to replace your uploaded video with an H.264 file of the same resolution, and generate as many as five additional formats depending on your original source. 1080p, 720p, or up to 480p H.264, WEBM, and OGV. Different browsers have different playback capabilities. Most desktop browsers can play H.264, and all modern mobile devices can play at least 480p 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 Firefox supports H.264 playback in Windows now and will soon support it in Mac
|
36 |
|
37 |
-
The files will encode in the background and will take
|
38 |
|
39 |
-
Encoded H.264 files can be fixed for streaming using "movflags faststart" introduced in recent versions of FFMPEG/LIBAV, or qt-faststart or MP4Box if you have one of them installed in the same directory as your encoder and select it in the plugin settings. Without one of these options enabled, FFMPEG/LIBAV will place moov atoms at the end of H.264 encoded files, which forces the entire file to download before playback can start
|
40 |
|
41 |
If you want to make ogv, webm, or H.264 files available and can't use the FFMPEG encode button, you can upload your own files to the same directory as the original and the plugin will automatically find them. For example, if your main file is awesomevid.mp4, the plugin will look for awesomevid-1080.mp4, awesomevid-720.mp4, awesomevid-480.mp4 (up to 480p H.264), awesomevid.webm and awesomevid.ogv as well. No matter what format your original video is, you can use it in the shortcode and the plugin will attempt to find all compatible formats related to it. For example, you might have an AVI called awesomevid.avi which is not compatible with any browser, but if you have other formats encoded already, [KGVID]http://yoursite.com/awesomevid.avi[/KGVID] will ignore the incompatible AVI file, but find those other formats and embed them.
|
42 |
|
@@ -53,10 +65,14 @@ To embed videos on other sites you can use code like this.
|
|
53 |
`[KGVID poster="http://www.kylegilman.net/wp-content/uploads/2011/10/Reel-11-10-10-web_thumb2.jpg"
|
54 |
width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/2006/09/Reel-2012-05-15-720.mp4[/KGVID]`
|
55 |
|
56 |
-
|
|
|
|
|
57 |
|
58 |
* `id="xxx"` video attachment ID (instead of using a URL).
|
59 |
-
* `videos="x"` number of attached videos to display if no URL or
|
|
|
|
|
60 |
* `poster="http://www.example.com/image.jpg"` sets the thumbnail.
|
61 |
* `endofvideooverlay="http://www.example.com/end_image.jpg` sets the image shown when the video ends.
|
62 |
* `width="xxx"`
|
@@ -71,12 +87,19 @@ width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/2006/09/Re
|
|
71 |
* `title="Video Title"` or `"false"` to disable.
|
72 |
* `embedcode="html code"` changes text displayed in the embed code overlay in order to provide a custom method for embedding a video or `"false"` to disable.
|
73 |
* `view_count="true/false"` turns the view count on or off.
|
74 |
-
* `caption="Caption"`
|
75 |
* `description="Description"` Used for metadata only.
|
76 |
* `downloadlink="true/false"` generates a link below the video to make it easier for users to save the video file to their computers.
|
77 |
* `right_click="true/false"` allow or disable right-clicking on the video player.
|
78 |
* `resize="true/false"` allow or disable responsive resizing.
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
= These options will only affect Video.js playback =
|
81 |
|
82 |
* `skin="example-css-class"` Completely change the look of the video player. <a href="https://github.com/zencoder/video-js/blob/master/docs/skins.md">Instructions here.</a>
|
@@ -97,11 +120,10 @@ width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/2006/09/Re
|
|
97 |
* `gallery_thumb="xxx"` width in pixels to display gallery thumbnails
|
98 |
* `gallery_exclude="15"` comma separated video attachment IDs. Excludes the videos from the gallery.
|
99 |
* `gallery_include="65"` comma separated video attachment IDs. Includes only these videos in the gallery. Please note that include and exclude cannot be used together.
|
100 |
-
* `gallery_orderby="menu_order/title/post_date/rand/ID"` criteria for sorting the gallery
|
101 |
-
* `gallery_order="ASC/DESC"` sort order
|
102 |
-
* `gallery_id="241"` post ID to display a gallery made up of videos associated with a different post
|
103 |
-
|
104 |
-
I'm not really a software developer. I'm just a film editor with some time on his hands who wanted to post video for clients and wasn't happy with the current state of any available software. But I want to really make this thing work, so please help me out by posting your feedback on <a href="https://github.com/kylegilman/video-embed-thumbnail-generator/issues?state=open">Github</a>.
|
105 |
|
106 |
== Installation ==
|
107 |
|
@@ -120,9 +142,15 @@ Optional: `AddType video/mp4 .mov` will help with IE playback of .mov files but
|
|
120 |
|
121 |
Most of the time your video doesn't play because it's not encoded in the right format. Videos have containers like mp4, mov, ogv, mkv, flv, etc and within those containers there are video and audio codecs like H.264, MPEG-4, VP8, etc. The best option for this plugin is an mp4 container with H.264 video and AAC audio. mp4s with MPEG-4 video will not play in the Flash player, and if you don't use AAC audio you won't get any audio.
|
122 |
|
123 |
-
|
|
|
|
|
124 |
|
125 |
-
|
|
|
|
|
|
|
|
|
126 |
|
127 |
= Why doesn't this work with YouTube? =
|
128 |
|
@@ -140,7 +168,7 @@ First off, don't panic.
|
|
140 |
|
141 |
This plugin can use FFMPEG or LIBAV to make thumbnails and create alternate video formats. Unfortunately most servers don't have FFMPEG installed and most shared hosting plans don't allow you to install FFMPEG because of the system resources it requires. You're getting this error message because you don't have FFMPEG installed in the most common directory. If you know you have FFMPEG installed on your server, you'll need to find the actual path to the program and enter it in the plugin settings field `Path to applications on server`
|
142 |
|
143 |
-
|
144 |
|
145 |
= How can I encode videos in directories protected by .htaccess passwords? =
|
146 |
|
@@ -155,6 +183,39 @@ Enter the username & password in the plugin settings "FFMPEG Settings" tab, or u
|
|
155 |
|
156 |
== Changelog ==
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
= 4.2.9 - November 15, 2013 =
|
159 |
* Fixed bug that interfered with database queries that do not have post_meta (The Events Calendar revealed the bug, but it likely had an effect on other plugins).
|
160 |
* Fixed bug that assigned auto-encoded videos to nobody.
|
1 |
=== Video Embed & Thumbnail Generator ===
|
2 |
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, html5, shortcode, thumbnail, preview, poster, ffmpeg, libav, embed, mobile, webm, ogg, h.264, h264, responsive, mp4, jwplayer
|
5 |
Requires at least: 3.5
|
6 |
+
Tested up to: 3.9
|
7 |
+
Stable tag: 4.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
= A plugin to make embedding videos, generating thumbnails, and encoding HTML5-compatible files a little bit easier. =
|
16 |
|
17 |
+
This plugin adds several fields to any video uploaded to the WordPress Media Library. Just choose a few options, make thumbnails, click "Insert into Post" and you'll get a shortcode in the post editor that will embed a flexible, responsive HTML5 video player with Flash fallback for unsupported browsers.
|
18 |
|
19 |
+
You have the option to use a few different video players:
|
20 |
+
* Video.js
|
21 |
+
* The WordPress default player using MediaElement.js, which was introduced in WordPress version 3.6
|
22 |
+
* JW Player (if <a href="http://wordpress.org/plugins/jw-player-plugin-for-wordpress/">their plugin</a> is installed)
|
23 |
+
* Adobe's Strobe Media Playback Flash player.
|
24 |
|
25 |
+
<em>The Strobe Media Playback option hasn't been updated since 2011 and is not recommended, but I'm keeping it around for longtime users of this plugin who don't want to change. Most features of the plugin will work when using Strobe Media Playback, but new features will not be tested with it. Selecting Strobe Media Playback will default to a Flash video player if you're using a Flash-compatible file (flv, f4v, mp4, mov, or m4v). Otherwise it will use the Video.js player as a fallback.</em>
|
26 |
|
27 |
+
No matter which player you use, the video will resize on the fly to fit the container it's in. There is no need to use FitVids.js and in fact FitVids.js will break responsive resizing for some players if it's running on your site.
|
28 |
|
29 |
+
You can also use the plugin to create a popup video gallery. The shortcode uses options similar to the WordPress image gallery shortcode. In its simplest form use the code `[KGVID gallery="true"]` to create a gallery of all videos attached to the post. Thumbnail size and video popup size can be set on the plugin settings page or in the shortcode.
|
30 |
+
|
31 |
+
If your video can be <a href="http://en.wikipedia.org/wiki/HTML5_video#Browser_support">played natively in your browser</a>, or if you have FFMPEG or LIBAV installed on your server, you can generate thumbnails from your video. Using either the "Generate" or "Randomize" buttons will create an array to choose from. The "Generate" button will always generate thumbnails from the same frames of your video, evenly spaced. If you don't like them, you can randomize the results with the "Randomize" button. If you want to see the first frame of the video, check the "Force 1st Frame Thumbnail" button. After creating an array of thumbnails you can save them all using the "Save all thumbnails" button.
|
32 |
+
|
33 |
+
If you know which frame you want to use for your thumbnail, click "Choose from video..." to select it from the video. This will only work for <a href="http://en.wikipedia.org/wiki/HTML5_video#Browser_support">videos that can be played natively in your browser</a>. If you want really fine control you can enter timecode in the "Thumbnail timecode" field. Use `mm:ss` format. Use decimals to approximate frames. For example, `23.5` will generate a thumbnail halfway between the 23rd and 24th seconds in the video. `02:23.25` would be one quarter of the way between the 143rd and 144th seconds. You can generate as many or as few as you need (up to 99 at a time).
|
34 |
|
35 |
After you select a thumbnail it will be registered in the Wordpress Media Library and added to the video's attachments. Unused thumbnails will be deleted.
|
36 |
|
37 |
In the plugin settings you can set the default maximum width and height based on the dimensions of your particular template and those values will be filled in when you open the window. If you generate thumbnails, the video display dimensions will be adjusted automatically to match the size and aspect ratio of the video file. You can make further adjustments if you want.
|
38 |
|
39 |
+
You can add subtitle and caption tracks by choosing properly formatted WebVTT files from the media library or entering a URL directly. Enter the two-letter language code and the label text that will be shown to users. Currently the Video.js and WordPress default players do not work with the "default" attribute but I will add the option to turn a text track on by default if that changes in the future. The WordPress default player does not differentiate between captions and subtitles, but Video.js will show a different icon depending on the selection.
|
40 |
+
|
41 |
+
I highly recommend using <a href="http://handbrake.fr/">Handbrake</a> to make a file with H.264 video and AAC audio in an MP4 container. If you're encoding with Handbrake make sure that "Web Optimized" is checked. Using Apple's Compressor, the "Streaming" setting should be "Fast Start" (not Fast Start - Compressed Header).
|
42 |
+
|
43 |
+
The plugin can use FFMPEG or LIBAV to encode videos and make thumbnails if you have one of them installed on your server. You can even choose to generate thumbnails and alternate video formats automatically whenever a new video is uploaded to the database.
|
44 |
|
45 |
+
By default the plugin looks for FFMPEG in `/usr/local/bin` but if the application is installed in a different place on your server, you can point it to the correct place in the plugin settings. Users running WordPress on Windows servers should try using Linux-style paths (with forward slashes instead of backslashes and a forward slash `/` instead of `C:\`).
|
46 |
|
47 |
+
If you have the proper libraries installed, you can choose to replace your uploaded video with an H.264 file of the same resolution, and generate as many as five additional formats depending on your original source. 1080p, 720p, or up to 480p H.264, WEBM, and OGV. Different browsers have different playback capabilities. Most desktop browsers can play H.264, and all modern mobile devices can play at least 480p 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 Firefox supports H.264 playback in Windows & Linux now and will soon support it in Mac. I no longer recommend encoding OGV or WEBM unless you expect a large number of no-Flash sticklers visiting your site. However, your needs may vary.
|
48 |
|
49 |
+
The files will encode in the background and will take some time to complete, depending on your server setup and the length and size of your video. The plugin adds a Video Encode Queue menu to the Tools menu. You will see encoding progress, the option to cancel an encoding job, and you should get an error message if something goes wrong. Users on Windows servers may get inconsistent results with the encoding queue.
|
50 |
|
51 |
+
Encoded H.264 files can be fixed for streaming using "movflags faststart" introduced in recent versions of FFMPEG/LIBAV, or qt-faststart or MP4Box if you have one of them installed in the same directory as your encoder and select it in the plugin settings. Without one of these options enabled, FFMPEG/LIBAV will place moov atoms at the end of H.264 encoded files, which in some cases forces the entire file to download before playback can start.
|
52 |
|
53 |
If you want to make ogv, webm, or H.264 files available and can't use the FFMPEG encode button, you can upload your own files to the same directory as the original and the plugin will automatically find them. For example, if your main file is awesomevid.mp4, the plugin will look for awesomevid-1080.mp4, awesomevid-720.mp4, awesomevid-480.mp4 (up to 480p H.264), awesomevid.webm and awesomevid.ogv as well. No matter what format your original video is, you can use it in the shortcode and the plugin will attempt to find all compatible formats related to it. For example, you might have an AVI called awesomevid.avi which is not compatible with any browser, but if you have other formats encoded already, [KGVID]http://yoursite.com/awesomevid.avi[/KGVID] will ignore the incompatible AVI file, but find those other formats and embed them.
|
54 |
|
65 |
`[KGVID poster="http://www.kylegilman.net/wp-content/uploads/2011/10/Reel-11-10-10-web_thumb2.jpg"
|
66 |
width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/2006/09/Reel-2012-05-15-720.mp4[/KGVID]`
|
67 |
|
68 |
+
I'm not really a software developer. I'm just a film editor with some time on his hands who wanted to post video for clients and wasn't happy with the current state of any available software. But I want to really make this thing work, so please help me out by posting your feedback on <a href="https://github.com/kylegilman/video-embed-thumbnail-generator/issues?state=open">Github</a>.
|
69 |
+
|
70 |
+
= If you want to further modify the way the video player works, you can add the following options inside the `[KGVID]` tag. These will override anything you've set in the plugin settings or attachment details. If the plugin is installed on your site, this information is also available in the post edit help screen. =
|
71 |
|
72 |
* `id="xxx"` video attachment ID (instead of using a URL).
|
73 |
+
* `videos="x"` number of attached videos to display if no URL or ID is given.
|
74 |
+
* `orderby="menu_order/title/post_date/rand/ID"` criteria for sorting attached videos if no URL or ID is given.
|
75 |
+
* `order="ASC/DESC"` sort order.
|
76 |
* `poster="http://www.example.com/image.jpg"` sets the thumbnail.
|
77 |
* `endofvideooverlay="http://www.example.com/end_image.jpg` sets the image shown when the video ends.
|
78 |
* `width="xxx"`
|
87 |
* `title="Video Title"` or `"false"` to disable.
|
88 |
* `embedcode="html code"` changes text displayed in the embed code overlay in order to provide a custom method for embedding a video or `"false"` to disable.
|
89 |
* `view_count="true/false"` turns the view count on or off.
|
90 |
+
* `caption="Caption"` text that is displayed below the video (not subtitles or closed captioning)
|
91 |
* `description="Description"` Used for metadata only.
|
92 |
* `downloadlink="true/false"` generates a link below the video to make it easier for users to save the video file to their computers.
|
93 |
* `right_click="true/false"` allow or disable right-clicking on the video player.
|
94 |
* `resize="true/false"` allow or disable responsive resizing.
|
95 |
|
96 |
+
= These options will add a subtitle/caption track =
|
97 |
+
|
98 |
+
* `track_src="http://www.example.com/subtitles.vtt_.txt"` URL of the WebVTT file.
|
99 |
+
* `track_kind=subtitles/captions/chapters`
|
100 |
+
* `track_srclang=xx` the track's two-character language code (en, fr, es, etc)
|
101 |
+
* `track_label="Track Label"` text that will be shown to the user when selecting the track.
|
102 |
+
|
103 |
= These options will only affect Video.js playback =
|
104 |
|
105 |
* `skin="example-css-class"` Completely change the look of the video player. <a href="https://github.com/zencoder/video-js/blob/master/docs/skins.md">Instructions here.</a>
|
120 |
* `gallery_thumb="xxx"` width in pixels to display gallery thumbnails
|
121 |
* `gallery_exclude="15"` comma separated video attachment IDs. Excludes the videos from the gallery.
|
122 |
* `gallery_include="65"` comma separated video attachment IDs. Includes only these videos in the gallery. Please note that include and exclude cannot be used together.
|
123 |
+
* `gallery_orderby="menu_order/title/post_date/rand/ID"` criteria for sorting the gallery.
|
124 |
+
* `gallery_order="ASC/DESC"` sort order.
|
125 |
+
* `gallery_id="241"` post ID to display a gallery made up of videos associated with a different post.
|
126 |
+
* `gallery_end="close/next"` either close the pop-up or start playing the next video when the current video finishes playing.
|
|
|
127 |
|
128 |
== Installation ==
|
129 |
|
142 |
|
143 |
Most of the time your video doesn't play because it's not encoded in the right format. Videos have containers like mp4, mov, ogv, mkv, flv, etc and within those containers there are video and audio codecs like H.264, MPEG-4, VP8, etc. The best option for this plugin is an mp4 container with H.264 video and AAC audio. mp4s with MPEG-4 video will not play in the Flash player, and if you don't use AAC audio you won't get any audio.
|
144 |
|
145 |
+
Use <a href="http://mediaarea.net/en/MediaInfo">MediaInfo</a> to get really detailed information about your media files.
|
146 |
+
|
147 |
+
= Why does my video have to download completely before it starts playing? =
|
148 |
|
149 |
+
mp4/m4v/mov files have something called a moov atom that gives the video player information about the content of the video (dimensions, duration, codecs, etc). Depending on the program you used to make your video, the moov atom can be at the beginning or the end of the file. Most video players will wait until they find the moov atom before starting playback. Otherwise it doesn't know how to display the information it's downloading. If it's at the beginning of the file, playback starts very soon after the user hits the play button. If it's at the end of the file, the whole video has to download before playback starts.
|
150 |
+
|
151 |
+
There are a number of ways to fix this problem. Most video encoding programs have an option like "Web optimized," "Streaming," "Fast start," or "Progressive download." Try to find and enable that option in your program. If you can't do that, there are programs designed to move the moov atom to the head of the file. Try <a href="http://renaun.com/blog/code/qtindexswapper/">QTIndexSwapper</a> for Adobe Air (cross platform), <a href="http://www.datagoround.com/lab/">MP4 Faststart</a> for Windows, or <a href="http://mac.softpedia.com/get/Video/QTFastStart.shtml">QTFastStart</a> for Mac.
|
152 |
+
|
153 |
+
FFMPEG puts the moov atom at the end of the file, so this can be a problem. The plugin will fix this problem on newly encoded H.264 videos if you have a recent version of FFMPEG and enable the "movflags faststart" option in the plugin settings or if you have qt-faststart or MP4Box installed on your server.
|
154 |
|
155 |
= Why doesn't this work with YouTube? =
|
156 |
|
168 |
|
169 |
This plugin can use FFMPEG or LIBAV to make thumbnails and create alternate video formats. Unfortunately most servers don't have FFMPEG installed and most shared hosting plans don't allow you to install FFMPEG because of the system resources it requires. You're getting this error message because you don't have FFMPEG installed in the most common directory. If you know you have FFMPEG installed on your server, you'll need to find the actual path to the program and enter it in the plugin settings field `Path to applications on server`
|
170 |
|
171 |
+
Most of the features of the plugin will work without FFMPEG. You can generate embed shortcodes for your videos and make thumbnails on any host because that part of the plugin is JavaScript running in your browser. But without FFMPEG you won't be able to automatically generate thumbnails or encode alternate formats on the server. If you don't have your own VPS or dedicated server, Dreamhost is one of the few shared hosts I know of that has FFMPEG installed and available for users.
|
172 |
|
173 |
= How can I encode videos in directories protected by .htaccess passwords? =
|
174 |
|
183 |
|
184 |
== Changelog ==
|
185 |
|
186 |
+
= 4.3 - March 18, 2014 =
|
187 |
+
* Prepared plugin for internationalization. Translators welcome!
|
188 |
+
* Finally paying attention to multisite. Several FFMPEG settings and the encode queue are now controlled at the network level if the plugin is network activated.
|
189 |
+
* Added JW Player option if the JW Player WordPress plugin is active.
|
190 |
+
* Added video subtitle/captions support.
|
191 |
+
* Revised and simplified video gallery popup method. Switched to lighter SimpleModal plugin and no longer loading jQuery-ui libraries.
|
192 |
+
* Added "gallery_ended" shortcode attribute to set an action when a pop-up video gallery video ends.
|
193 |
+
* Added next and previous buttons to navigate between pop-up video gallery items.
|
194 |
+
* Updated Video.js to version 4.4.3
|
195 |
+
* Strobe Media Playback is now deprecated. New features added to the plugin might not work if this player is selected.
|
196 |
+
* Added option to add a watermark to videos encoded with FFMPEG/LIBAV.
|
197 |
+
* Added option to automatically generate multiple thumbnails when a video is uploaded.
|
198 |
+
* Added option to encode more than one video at the same time.
|
199 |
+
* Added option to turn on video download link by default.
|
200 |
+
* Added option to set video preload attribute.
|
201 |
+
* Added list of shortcode attribute options to the post edit help tab.
|
202 |
+
* Added "order" and "orderby" shortcode attributes to sort videos embedded without a URL or ID specified.
|
203 |
+
* Added float to inline videos to allow text to wrap around them.
|
204 |
+
* Added play button overlay to gallery thumbnails when using WordPress Default player.
|
205 |
+
* Applied video alignment setting to video galleries for center and right justifying galleries.
|
206 |
+
* Now only loading plugin-related JavaScripts when the shortcode is used on the page and moved links to the footer to speed up page loading.
|
207 |
+
* Added wpdb->prepare to all database queries for increased security.
|
208 |
+
* Added nonce check when recording video play counts for increased security.
|
209 |
+
* Fixed bug that broke responsive resizing in IE 8 and for all videos with apostrophes in their titles.
|
210 |
+
* Fixed bug that disabled FFMPEG if the path to WordPress had spaces in it.
|
211 |
+
* Fixed bug that generated an error if the exec function was disabled on the server using suhosin or safe mode.
|
212 |
+
* Fixed bug that caused video encode problems when FFMPEG output contained special characters.
|
213 |
+
* Fixed bug that generated misaligned play button arrows in some themes when using the Video.js player.
|
214 |
+
* Fixed bug that sometimes generated jagged rows in galleries with mixed aspect ratios.
|
215 |
+
* Fixed bug that attempted to generate thumbnails using FFMPEG if a user had previously installed FFMPEG, disabled in-browser thumbnails, then disabled FFMPEG.
|
216 |
+
* Fixed several user capability related bugs related to users who were not assigned any roles and capabilities that were not assigned to any roles.
|
217 |
+
* Changed video title overlay z-index to 103 to avoid floating over other elements.
|
218 |
+
|
219 |
= 4.2.9 - November 15, 2013 =
|
220 |
* Fixed bug that interfered with database queries that do not have post_meta (The Events Calendar revealed the bug, but it likely had an effect on other plugins).
|
221 |
* Fixed bug that assigned auto-encoded videos to nobody.
|
uninstall.php
CHANGED
@@ -1,4 +1,23 @@
|
|
1 |
<?php
|
2 |
-
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit(); }
|
3 |
+
|
4 |
+
if ( !is_multisite() ) {
|
5 |
+
delete_option('kgvid_video_embed_options');
|
6 |
+
delete_option('kgvid_video_embed_queue');
|
7 |
+
}
|
8 |
+
else {
|
9 |
+
|
10 |
+
delete_site_option( 'kgvid_video_embed_network_options' );
|
11 |
+
delete_site_option( 'kgvid_video_embed_queue' );
|
12 |
+
|
13 |
+
$sites = wp_get_sites();
|
14 |
+
|
15 |
+
if ( is_array($sites) ) {
|
16 |
+
|
17 |
+
foreach ( $sites as $site ) {
|
18 |
+
delete_blog_option( $site['blog_id'], 'kgvid_video_embed_options' );
|
19 |
+
delete_blog_option( $site['blog_id'], 'kgvid_video_embed_queue');
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
?>
|
video-embed-thumbnail-generator.php
CHANGED
@@ -3,9 +3,10 @@
|
|
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.
|
7 |
Author: Kyle Gilman
|
8 |
Author URI: http://www.kylegilman.net/
|
|
|
9 |
|
10 |
This program is free software; you can redistribute it and/or modify
|
11 |
it under the terms of the GNU General Public License as published by
|
@@ -44,125 +45,164 @@ if ( ! defined( 'ABSPATH' ) )
|
|
44 |
|
45 |
function kgvid_default_options_fn() {
|
46 |
|
47 |
-
$upload_capable =
|
|
|
48 |
|
49 |
$options = array(
|
50 |
-
"version"=>4.
|
51 |
-
"embed_method"=>"Video.js",
|
52 |
-
"
|
53 |
-
"
|
54 |
-
"
|
55 |
-
"
|
56 |
-
"
|
57 |
-
"
|
58 |
-
"
|
59 |
-
"
|
60 |
-
"
|
61 |
-
"
|
62 |
-
"
|
63 |
-
"
|
64 |
-
"
|
65 |
-
"
|
66 |
-
"
|
67 |
-
"
|
68 |
-
"
|
69 |
-
"
|
70 |
-
"
|
71 |
-
"
|
72 |
-
"
|
73 |
-
"
|
74 |
-
"
|
75 |
-
"
|
76 |
-
"
|
77 |
-
"
|
78 |
-
"
|
79 |
-
"
|
80 |
-
"
|
81 |
-
"
|
82 |
-
"
|
83 |
-
"
|
84 |
-
"
|
85 |
-
"
|
86 |
-
"
|
87 |
-
"
|
88 |
-
"
|
89 |
-
"
|
90 |
-
"
|
91 |
-
"
|
92 |
-
"
|
93 |
-
"
|
94 |
-
"
|
95 |
-
"
|
96 |
-
"
|
97 |
-
"
|
98 |
-
"
|
99 |
-
"
|
100 |
-
"
|
101 |
-
"
|
102 |
-
"
|
103 |
-
"
|
104 |
-
"
|
105 |
-
"
|
106 |
-
"
|
107 |
-
"
|
108 |
-
"
|
109 |
-
"
|
110 |
-
"
|
111 |
-
"
|
112 |
-
"
|
113 |
-
"
|
114 |
-
"
|
115 |
-
"
|
116 |
-
"
|
117 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
);
|
|
|
119 |
return $options;
|
|
|
120 |
}
|
121 |
|
122 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
$options = get_option('kgvid_video_embed_options');
|
125 |
|
126 |
-
|
127 |
-
$
|
128 |
-
|
129 |
}
|
130 |
|
131 |
-
|
132 |
-
|
133 |
-
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) { kgvid_check_ffmpeg_exists($options, true); }
|
134 |
|
135 |
}
|
136 |
-
register_activation_hook(__FILE__, 'kgvid_register_default_options_fn');
|
137 |
|
138 |
-
function
|
139 |
-
$links[] = '<a href="'.get_admin_url(null, "options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php").'">Settings</a>';
|
140 |
-
return $links;
|
141 |
-
}
|
142 |
-
add_filter("plugin_action_links_".plugin_basename(__FILE__), 'kgvid_plugin_action_links' );
|
143 |
-
add_filter("network_admin_plugin_action_links_".plugin_basename(__FILE__), 'kgvid_plugin_action_links' );
|
144 |
|
|
|
|
|
|
|
145 |
|
146 |
-
|
|
|
|
|
|
|
147 |
|
148 |
-
$
|
149 |
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
|
|
155 |
}
|
156 |
-
|
157 |
|
158 |
}
|
159 |
-
add_filter( 'plugin_row_meta', 'kgvid_plugin_meta_links', 10, 2 );
|
160 |
|
161 |
function kgvid_video_formats() {
|
162 |
|
163 |
$video_formats = array(
|
164 |
"fullres" => array(
|
165 |
-
"name" => "Replace original with H.264",
|
166 |
"width" => 4096,
|
167 |
"height" => 2304,
|
168 |
"type" => "h264",
|
@@ -217,30 +257,168 @@ function kgvid_video_formats() {
|
|
217 |
|
218 |
}
|
219 |
|
220 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
global $wp_roles;
|
222 |
-
$
|
223 |
foreach ( $wp_roles->roles as $role => $role_info ) {
|
224 |
-
if (
|
225 |
-
$
|
226 |
}
|
227 |
-
else { $
|
228 |
}
|
229 |
-
return $
|
230 |
}
|
231 |
|
232 |
function kgvid_set_capabilities($capabilities) {
|
|
|
233 |
global $wp_roles;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
foreach ( $capabilities as $capability => $enabled_roles ) {
|
235 |
foreach ( $wp_roles->roles as $role => $role_info ) { //check all roles
|
236 |
-
if ( !array_key_exists($capability, $role_info['capabilities']) && array_key_exists($role, $enabled_roles) && $enabled_roles[$role] == "on" ) {
|
237 |
$wp_roles->add_cap( $role, $capability );
|
238 |
}
|
239 |
-
if ( array_key_exists($capability, $role_info['capabilities']) && !array_key_exists($role, $enabled_roles) ) {
|
240 |
$wp_roles->remove_cap( $role, $capability );
|
241 |
}
|
242 |
}
|
243 |
}
|
|
|
244 |
}
|
245 |
|
246 |
function kgvid_aac_encoders() {
|
@@ -254,6 +432,7 @@ function kgvid_add_upload_mimes ( $existing_mimes=array() ) {
|
|
254 |
|
255 |
// allows uploading .webm videos
|
256 |
$existing_mimes['webm'] = 'video/webm';
|
|
|
257 |
return $existing_mimes;
|
258 |
|
259 |
}
|
@@ -298,7 +477,7 @@ function kgvid_check_for_shortcode_in_content() {
|
|
298 |
global $post;
|
299 |
$pattern = get_shortcode_regex();
|
300 |
preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches );
|
301 |
-
if ( array_key_exists( 2, $matches ) && array_key_exists( 5, $matches ) ) {
|
302 |
foreach ( $matches[2] as $shortcode_index => $shortcode ) {
|
303 |
if ( $shortcode == "KGVID" || $shortcode == "FMP" ) { continue; }
|
304 |
else {
|
@@ -367,11 +546,25 @@ function kgvid_check_ffmpeg_exists($options, $save) {
|
|
367 |
$function = "";
|
368 |
$uploads = wp_upload_dir();
|
369 |
|
370 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
371 |
if (function_exists('escapeshellcmd')) {
|
372 |
$exec_enabled = true;
|
373 |
$test_path = rtrim($options['app_path'], '/');
|
374 |
-
$cmd = escapeshellcmd($test_path.'/'.$options['video_app'].' -i '.plugin_dir_path(__FILE__).'images/sample-video-h264.mp4 -vframes 1 -f mjpeg '.$uploads['path'].'/ffmpeg_exists_test.jpg');
|
375 |
exec ( $cmd, $output, $returnvalue );
|
376 |
}
|
377 |
else { $function = "ESCAPESHELLCMD"; }
|
@@ -382,7 +575,7 @@ function kgvid_check_ffmpeg_exists($options, $save) {
|
|
382 |
|
383 |
if ( !file_exists($uploads['path'].'/ffmpeg_exists_test.jpg') ) { //if FFMPEG has not executed successfully
|
384 |
$test_path = substr($test_path, 0, -strlen($options['video_app'])-1 );
|
385 |
-
$cmd = escapeshellcmd($test_path.'/'.$options['video_app'].' -i '.plugin_dir_path(__FILE__).'images/sample-video-h264.mp4 -vframes 1 -f mjpeg '.$uploads['path'].'/ffmpeg_exists_test.jpg');
|
386 |
exec ( $cmd, $output, $returnvalue );
|
387 |
}
|
388 |
|
@@ -395,12 +588,15 @@ function kgvid_check_ffmpeg_exists($options, $save) {
|
|
395 |
}
|
396 |
|
397 |
if ( $save ) {
|
|
|
398 |
if ( $ffmpeg_exists == true ) { $options['ffmpeg_exists'] = "on"; }
|
399 |
else {
|
400 |
$options['ffmpeg_exists'] = "notinstalled";
|
401 |
$options['browser_thumbnails'] = "on"; //if FFMPEG isn't around, this should be enabled
|
402 |
}
|
|
|
403 |
update_option('kgvid_video_embed_options', $options);
|
|
|
404 |
}
|
405 |
|
406 |
$output_output = implode("/n", $output);
|
@@ -416,18 +612,18 @@ function kgvid_check_ffmpeg_exists($options, $save) {
|
|
416 |
|
417 |
function kgvid_set_video_dimensions($id, $gallery = false) {
|
418 |
|
419 |
-
$options =
|
420 |
$video_meta = "";
|
421 |
$moviefile = get_attached_file($id);
|
422 |
|
423 |
$video_meta = get_post_meta( $id, '_wp_attachment_metadata', true);
|
424 |
|
425 |
-
if ( $video_meta && array_key_exists('width', $video_meta) ) { $widthactual = $video_meta['width']; }
|
426 |
else { $widthactual = get_post_meta($id, "_kgflashmediaplayer-actualwidth", true); }
|
427 |
$widthset = get_post_meta($id, "_kgflashmediaplayer-width", true);
|
428 |
if ( !$widthset ) { $widthset = $widthactual; }
|
429 |
|
430 |
-
if ( $video_meta && array_key_exists('height', $video_meta) ) { $heightactual = $video_meta['height']; }
|
431 |
else { $heightactual = get_post_meta($id, "_kgflashmediaplayer-actualheight", true); }
|
432 |
$heightset = get_post_meta($id, "_kgflashmediaplayer-height", true);
|
433 |
if ( !$heightset ) { $heightset = $heightactual; }
|
@@ -445,14 +641,30 @@ function kgvid_set_video_dimensions($id, $gallery = false) {
|
|
445 |
|
446 |
$heightset = round(intval($widthset)*$aspect_ratio);
|
447 |
|
448 |
-
$dimensions = array( 'width' => $widthset, 'height' => $heightset, 'actualwidth' => $widthactual, 'actualheight' => $heightactual );
|
449 |
return $dimensions;
|
450 |
|
451 |
}
|
452 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
function kgvid_encodevideo_info($movieurl, $postID) {
|
454 |
|
455 |
-
$options =
|
456 |
|
457 |
$uploads = wp_upload_dir();
|
458 |
$video_formats = kgvid_video_formats();
|
@@ -460,6 +672,7 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
460 |
$movieurl = $sanitized_url['movieurl'];
|
461 |
|
462 |
$encodevideo_info['moviefilebasename'] = $sanitized_url['basename'];
|
|
|
463 |
$encodevideo_info['encodepath'] = $uploads['path'];
|
464 |
if ( get_post_type($postID) == "attachment" ) { //if it's an attachment, not from URL
|
465 |
$moviefile = get_attached_file($postID);
|
@@ -476,7 +689,7 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
476 |
else {
|
477 |
|
478 |
$url_parts = parse_url($uploads['url']);
|
479 |
-
if ( array_key_exists('host', $url_parts) && strpos($movieurl, $url_parts['host']) !== false ) { //if we're on the same server
|
480 |
$encodevideo_info['sameserver'] = true;
|
481 |
$decodedurl = urldecode($movieurl);
|
482 |
$parsed_url= parse_url($decodedurl);
|
@@ -592,7 +805,7 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
592 |
* @author Jamie Scott
|
593 |
*/
|
594 |
function kgvid_get_video_dimensions($video = false) {
|
595 |
-
$options =
|
596 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
597 |
$movie_info = array();
|
598 |
|
@@ -607,7 +820,7 @@ function kgvid_get_video_dimensions($video = false) {
|
|
607 |
exec ( $command, $output );
|
608 |
$lastline = end($output);
|
609 |
$lastline = prev($output)."<br />".$lastline;
|
610 |
-
$movie_info['output'] = $lastline;
|
611 |
$output = implode("\n", $output);
|
612 |
$regex = "/([0-9]{2,4})x([0-9]{2,4})/";
|
613 |
if (preg_match($regex, $output, $regs)) { $result = $regs[0]; }
|
@@ -625,7 +838,7 @@ function kgvid_get_video_dimensions($video = false) {
|
|
625 |
$movie_info['duration'] = ($movie_duration_hours * 60 * 60) + ($movie_duration_minutes * 60) + $movie_duration_seconds;
|
626 |
|
627 |
preg_match('/rotate : (.*?)\n/', $output, $matches);
|
628 |
-
if ( array_key_exists(1, $matches) == true ) { $rotate = $matches[1]; }
|
629 |
else $rotate = "0";
|
630 |
|
631 |
switch ($rotate) {
|
@@ -648,8 +861,6 @@ function kgvid_get_video_dimensions($video = false) {
|
|
648 |
else { $movie_info['configuration'][$lib] = "false"; }
|
649 |
}
|
650 |
|
651 |
-
|
652 |
-
|
653 |
}
|
654 |
else {
|
655 |
$movie_info['worked'] = false;
|
@@ -658,9 +869,62 @@ function kgvid_get_video_dimensions($video = false) {
|
|
658 |
return $movie_info;
|
659 |
}
|
660 |
|
661 |
-
function
|
662 |
|
663 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
664 |
$encode_string = strtoupper($options['video_app'])." not found";
|
665 |
|
666 |
if ( $options['ffmpeg_exists'] == "on" ) {
|
@@ -693,6 +957,34 @@ function kgvid_generate_encode_string($input, $output, $libraries, $format, $wid
|
|
693 |
$rate_control_flag = " -".$video_bitrate_flag." ".round(floatval($options['bitrate_multiplier'])*$width*$height*30/1024)."k";
|
694 |
}
|
695 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
696 |
if ( $video_formats[$format]['type'] == 'h264' ) {
|
697 |
|
698 |
$aac_array = kgvid_aac_encoders();
|
@@ -739,8 +1031,13 @@ function kgvid_generate_encode_string($input, $output, $libraries, $format, $wid
|
|
739 |
if ( !empty($options['htaccess_login']) && strpos($input, 'http://') === 0 ) {
|
740 |
$input = substr_replace($input, $options['htaccess_login'].':'.$options['htaccess_password'].'@', 7, 0);
|
741 |
}
|
|
|
|
|
|
|
|
|
742 |
|
743 |
-
$
|
|
|
744 |
|
745 |
} //if FFMPEG is found
|
746 |
|
@@ -804,33 +1101,61 @@ class kgvid_Process{
|
|
804 |
}// class Process
|
805 |
|
806 |
function kgvid_video_embed_enqueue_scripts() {
|
807 |
-
$options =
|
808 |
|
809 |
-
|
810 |
-
wp_enqueue_script( 'swfobject' );
|
811 |
-
}
|
812 |
-
|
813 |
-
//Video.js script and skins
|
814 |
if ( $options['embed_method'] != "WordPress Default" ) {
|
815 |
-
|
816 |
-
wp_enqueue_style( 'video-js-css', plugins_url("", __FILE__).'/video-js/video-js.css', '', '4.3.0' );
|
817 |
wp_enqueue_style( 'video-js-kg-skin', plugins_url("", __FILE__).'/video-js/kg-video-js-skin.css', '', $options['version'] );
|
818 |
}
|
819 |
|
820 |
-
//plugin-related frontend
|
821 |
wp_enqueue_style( 'kgvid_video_styles', plugins_url("/css/kgvid_styles.css", __FILE__), '', $options['version'] );
|
822 |
-
|
823 |
-
wp_enqueue_script( 'kgvid_video_embed', plugins_url("/js/kgvid_video_embed.js", __FILE__), '', $options['version'] );
|
824 |
-
wp_localize_script( 'kgvid_video_embed', 'ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) ); // setting ajaxurl
|
825 |
}
|
826 |
add_action('wp_enqueue_scripts', 'kgvid_video_embed_enqueue_scripts', 12);
|
827 |
|
828 |
function enqueue_kgvid_script() { //loads plugin-related scripts in the admin area
|
829 |
-
$options =
|
830 |
|
831 |
-
wp_enqueue_script( '
|
832 |
wp_enqueue_style( 'video_embed_thumbnail_generator_style', plugins_url('/css/video-embed-thumbnail-generator_admin.css', __FILE__), '', $options['version'] );
|
833 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
834 |
}
|
835 |
add_action('admin_enqueue_scripts', 'enqueue_kgvid_script');
|
836 |
|
@@ -850,40 +1175,60 @@ function kgvid_video_embed_print_scripts() {
|
|
850 |
global $wpdb;
|
851 |
$posts = $wp_query->posts;
|
852 |
$pattern = get_shortcode_regex();
|
853 |
-
$options =
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
872 |
-
|
873 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
874 |
}
|
875 |
}
|
876 |
-
|
877 |
-
|
878 |
-
}
|
879 |
-
}
|
880 |
|
881 |
}
|
882 |
add_action('wp_head', 'kgvid_video_embed_print_scripts', 99);
|
883 |
|
|
|
|
|
|
|
|
|
|
|
|
|
884 |
function kgvid_shortcode_atts($atts) {
|
885 |
|
886 |
-
$options =
|
887 |
|
888 |
if ( in_the_loop() ) { $post_ID = get_the_ID(); }
|
889 |
else { $post_ID = 1; }
|
@@ -891,6 +1236,8 @@ function kgvid_shortcode_atts($atts) {
|
|
891 |
$query_atts = shortcode_atts(
|
892 |
array(
|
893 |
'id' => '',
|
|
|
|
|
894 |
'videos' => -1,
|
895 |
'width' => $options['width'],
|
896 |
'height' => $options['height'],
|
@@ -916,6 +1263,7 @@ function kgvid_shortcode_atts($atts) {
|
|
916 |
'gallery_exclude' => '',
|
917 |
'gallery_include' => '',
|
918 |
'gallery_id' => $post_ID,
|
|
|
919 |
'volume' => '',
|
920 |
'title' => $options['overlay_title'],
|
921 |
'embedcode' => $options['overlay_embedcode'],
|
@@ -923,20 +1271,24 @@ function kgvid_shortcode_atts($atts) {
|
|
923 |
'caption' => '',
|
924 |
'description' => '',
|
925 |
'inline' => $options['inline'],
|
926 |
-
'downloadlink' => '
|
927 |
'right_click' => $options['right_click'],
|
928 |
-
'resize' => $options['resize']
|
|
|
|
|
|
|
|
|
929 |
), $atts);
|
930 |
|
931 |
-
$checkbox_convert = array ( "autohide", "endofvideooverlaysame", "playbutton", "loop", "autoplay", "title", "embedcode", "view_count", "inline", "resize");
|
932 |
foreach ( $checkbox_convert as $query ) {
|
933 |
if ( $query_atts[$query] == "on" ) { $query_atts[$query] = "true"; }
|
934 |
if ( $query_atts[$query] == false ) { $query_atts[$query] = "false"; }
|
935 |
}
|
936 |
|
937 |
if ( $options['js_skin'] == "" ) { $options['js_skin'] = "vjs-default-skin"; }
|
938 |
-
if ( is_array($atts) ) {
|
939 |
-
|
940 |
}
|
941 |
|
942 |
return $query_atts;
|
@@ -948,395 +1300,454 @@ function KGVID_shortcode($atts, $content = ''){
|
|
948 |
global $content_width;
|
949 |
$content_width_save = $content_width;
|
950 |
|
951 |
-
$code = "";
|
952 |
-
if ( !is_feed() ) {
|
953 |
-
$options = get_option('kgvid_video_embed_options');
|
954 |
-
if ( in_the_loop() ) { $post_ID = get_the_ID(); }
|
955 |
-
else { $post_ID = 1; }
|
956 |
|
|
|
957 |
|
958 |
-
|
|
|
|
|
|
|
959 |
|
960 |
-
|
|
|
|
|
961 |
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
978 |
}
|
|
|
979 |
}
|
980 |
-
else { return; } //if there
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
981 |
}
|
982 |
-
else { return; } //if there's no post ID and no $content
|
983 |
-
}
|
984 |
-
else { // $content is a URL
|
985 |
-
// workaround for relative video URL (contributed by Lee Fernandes)
|
986 |
-
if(substr($content, 0, 1) == '/') $content = get_bloginfo('url').$content;
|
987 |
-
$content = trim($content);
|
988 |
-
$guid_convert = substr(str_replace(' ', '', $content), 12 );
|
989 |
-
global $wpdb;
|
990 |
-
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid LIKE '%{$guid_convert}'"; //GUID seems to be the only way to get a video URL
|
991 |
-
$id_array[0] = $wpdb->get_var($query);
|
992 |
-
}
|
993 |
|
994 |
-
|
995 |
|
996 |
-
|
997 |
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
|
1002 |
-
|
1003 |
-
|
1004 |
-
$h264compatible = array("mp4", "mov", "m4v");
|
1005 |
|
1006 |
-
|
1007 |
|
1008 |
-
|
1009 |
-
|
1010 |
-
|
1011 |
-
|
1012 |
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
-
|
1022 |
|
1023 |
-
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
|
|
1029 |
}
|
1030 |
-
}
|
1031 |
|
1032 |
-
|
1033 |
-
|
1034 |
-
|
1035 |
-
|
1036 |
-
|
1037 |
-
|
1038 |
-
|
1039 |
|
1040 |
-
|
1041 |
-
}
|
1042 |
-
else { //video is not in the database
|
1043 |
-
$div_suffix = substr(uniqid(rand(), true),0,4);
|
1044 |
-
$encodevideo_info = kgvid_encodevideo_info($content, $post_ID); //send the id of the post the video's embedded in
|
1045 |
-
if ( $query_atts['title'] == "true" ) {
|
1046 |
-
$query_atts['title'] = "false";
|
1047 |
}
|
1048 |
-
|
1049 |
-
|
1050 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1051 |
}
|
1052 |
|
1053 |
-
$
|
1054 |
-
|
1055 |
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
"original" => $moviefiletype,
|
1060 |
-
"1080" => "mp4",
|
1061 |
-
"720" => "mp4",
|
1062 |
-
"mobile" => "mp4",
|
1063 |
-
"webm" => "webm",
|
1064 |
-
"ogg" => "ogg"
|
1065 |
-
);
|
1066 |
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
|
|
|
|
1072 |
|
1073 |
-
|
1074 |
|
1075 |
-
|
1076 |
|
1077 |
-
|
1078 |
-
$minimum_flash = "10.1.0";
|
1079 |
|
1080 |
-
if (
|
1081 |
-
$
|
1082 |
-
$
|
|
|
|
|
1083 |
}
|
1084 |
else {
|
1085 |
-
$
|
1086 |
-
|
1087 |
-
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1091 |
}
|
|
|
|
|
1092 |
}
|
1093 |
}
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
1101 |
-
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
|
1107 |
-
|
1108 |
-
|
1109 |
-
$params = "{wmode:'opaque', allowfullscreen:'true', allowScriptAccess:'always', base:'".plugins_url("", __FILE__)."/flash/'}";
|
1110 |
-
}
|
1111 |
-
} //if Strobe Media Playback
|
1112 |
-
|
1113 |
-
if ( $query_atts['align'] != "left" || $query_atts['inline'] == "true" ) {
|
1114 |
-
$aligncode = ' style="';
|
1115 |
-
if ( $query_atts['align'] != "left" ) { $aligncode .= 'margin-left:auto; '; }
|
1116 |
-
if ( $query_atts['align'] == "center" ) { $aligncode .= ' margin-right:auto;'; }
|
1117 |
-
if ( $query_atts['inline'] == "true" ) { $aligncode .= 'display:inline-block;'; }
|
1118 |
-
$aligncode .= '" ';
|
1119 |
-
}
|
1120 |
-
else { $aligncode = ""; }
|
1121 |
-
|
1122 |
-
$code .= '<div id="kgvid_'.$div_suffix.'_wrapper" class="kgvid_wrapper"'.$aligncode.'>'."\n\t\t\t";
|
1123 |
-
$code .= '<div id="video_'.$div_suffix.'_div" class="kgvid_videodiv" itemscope itemtype="http://schema.org/VideoObject">';
|
1124 |
-
if ( $query_atts["poster"] != '' ) { $code .= '<meta itemprop="thumbnailURL" content="'.$query_atts["poster"].'" />'; }
|
1125 |
-
if ( !empty($id) ) { $schema_embedURL = site_url('/')."?attachment_id=".$id."&kgvid_video_embed[enable]=true"; }
|
1126 |
-
else { $schema_embedURL = $content; }
|
1127 |
-
$code .= '<meta itemprop="embedURL" content="'.$schema_embedURL.'" />';
|
1128 |
-
|
1129 |
-
if ( !empty($query_atts['title']) ) { $code .= '<meta itemprop="name" content="'.$query_atts['title'].'" />'; }
|
1130 |
-
if ( !empty($query_atts['description']) ) { $description = $query_atts['description']; }
|
1131 |
-
elseif ( !empty($query_atts['caption']) ) { $description = $query_atts['caption']; }
|
1132 |
-
else { $description = ""; }
|
1133 |
-
if ( !empty($description) ) { $code .= '<meta itemprop="description" content="'.esc_attr($description).'" />'; }
|
1134 |
-
|
1135 |
-
if ( $options['embed_method'] == "WordPress Default" ) {
|
1136 |
-
$wp_shortcode = "[video ";
|
1137 |
-
$mp4already = false;
|
1138 |
-
$sources_hack = "";
|
1139 |
-
foreach ($video_formats as $name => $type) {
|
1140 |
-
if ( $name != "original" && $encodevideo_info[$name."url"] == $content ) { unset($sources['original']); }
|
1141 |
-
if ( $encodevideo_info[$name."_exists"] ) {
|
1142 |
-
if ( $type != "mp4" || !$mp4already ) {
|
1143 |
-
$shortcode_type = wp_check_filetype( $encodevideo_info[$name."url"], wp_get_mime_types() );
|
1144 |
-
$sources[$name] = $shortcode_type['ext'].'="'.$encodevideo_info[$name."url"].'" ';
|
1145 |
-
if ( $type == "mp4" ) { //WordPress built-in shortcode doesn't support multiple videos of the same type but we'll hack it in later
|
1146 |
-
$search_string = '<source type="video/mp4" src="'.$encodevideo_info[$name."url"].'" />';
|
1147 |
-
$mp4already = true;
|
1148 |
}
|
|
|
1149 |
}
|
1150 |
-
else { $sources_hack .= '<source type="video/'.$type.'" src="'.$encodevideo_info[$name."url"].'" />'; }
|
1151 |
}
|
1152 |
-
}
|
1153 |
|
1154 |
-
|
1155 |
-
|
1156 |
-
|
1157 |
-
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
-
|
1162 |
-
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1166 |
}
|
1167 |
-
$code .= $executed_shortcode;
|
1168 |
-
}
|
1169 |
|
1170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1171 |
|
1172 |
-
foreach ($video_formats as $name => $type) {
|
1173 |
-
if ( $name != "original" && $encodevideo_info[$name."url"] == $content ) { unset($sources['original']); }
|
1174 |
-
if ( $encodevideo_info[$name."_exists"] ) { $sources[$name] = "\t\t\t\t\t".'<source src="'.$encodevideo_info[$name."url"].'" type="video/'.$type.'">'."\n"; }
|
1175 |
}
|
1176 |
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
-
$code .= 'width="'.$query_atts["width"].'" height="'.$query_atts["height"].'"';
|
1184 |
-
$code .= ' class="video-js '.$options['js_skin'].'" data-setup=\'{}\'';
|
1185 |
-
$code .= ">\n";
|
1186 |
|
1187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1188 |
|
1189 |
-
|
|
|
|
|
1190 |
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
|
1206 |
-
|
|
|
|
|
1207 |
}
|
1208 |
$code .= '</div>';
|
1209 |
}
|
1210 |
-
$code .= '</div>';
|
1211 |
}
|
1212 |
-
}
|
1213 |
|
1214 |
-
|
1215 |
-
$
|
1216 |
-
|
1217 |
-
|
1218 |
-
if ( $query_atts['embedcode']
|
1219 |
-
|
1220 |
-
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
$
|
|
|
|
|
|
|
1225 |
}
|
1226 |
-
$
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
'resize' => $query_atts['resize']
|
1244 |
-
);
|
1245 |
-
$json_video_variables = json_encode( $video_variables );
|
1246 |
|
1247 |
-
|
1248 |
-
kgvid_video_vars['".$div_suffix."'] = jQuery.parseJSON ( '".$json_video_variables."' );";
|
1249 |
-
if ( $options['embed_method'] == "Video.js" || ($options['embed_method'] == "Strobe Media Playback" && !$flash_source_found) ) {
|
1250 |
-
$code .= "\n\t\t\t"."if(typeof(jQuery)=='function'){(function($){\$.fn.fitVids=function(){}})(jQuery)};
|
1251 |
-
videojs('video_".$div_suffix."').ready(function(){ kgvid_setup_video('".$div_suffix."'); });";
|
1252 |
-
}
|
1253 |
-
elseif ( $options['embed_method'] == "Strobe Media Playback" && $flash_source_found ) {
|
1254 |
-
$code .= "\n\t\t\t"."swfobject.embedSWF('".$video_swf."', 'video_".$div_suffix."', '".trim($query_atts['width'])."', '".trim($query_atts['height'])."', '".$minimum_flash."', '".plugins_url("", __FILE__)."/flash/expressInstall.swf', $flashvars, $params, '', function(e) { kgvid_setup_video(".$div_suffix."); });";
|
1255 |
-
} //if Strobe Media
|
1256 |
-
else {
|
1257 |
-
$code .= "\n\t\t\t"."jQuery(document).ready(function(){ kgvid_setup_video('".$div_suffix."'); });";
|
1258 |
-
}
|
1259 |
|
1260 |
-
|
1261 |
-
|
|
|
|
|
1262 |
|
1263 |
-
|
1264 |
|
1265 |
-
|
1266 |
|
1267 |
-
|
1268 |
|
1269 |
-
|
1270 |
-
'post_type' => 'attachment',
|
1271 |
-
'orderby' => $query_atts['gallery_orderby'],
|
1272 |
-
'order' => $query_atts['gallery_order'],
|
1273 |
-
'post_mime_type' => 'video',
|
1274 |
-
'numberposts' => -1,
|
1275 |
-
'post_status' => null,
|
1276 |
-
'post_parent' => $query_atts['gallery_id'],
|
1277 |
-
'exclude' => $query_atts['gallery_exclude']
|
1278 |
-
);
|
1279 |
-
if ( !empty($query_atts['gallery_include']) ) {
|
1280 |
-
$args['include'] = $query_atts['gallery_include'];
|
1281 |
-
unset($args['post_parent']);
|
1282 |
-
}
|
1283 |
-
$attachments = get_posts($args);
|
1284 |
-
if ($attachments) {
|
1285 |
-
|
1286 |
-
$div_suffix = substr(uniqid(rand(), true),0,4);
|
1287 |
-
$code .= '<div class="kgvid_gallerywrapper">';
|
1288 |
-
foreach ( $attachments as $attachment ) {
|
1289 |
-
$thumbnail_url = get_post_meta($attachment->ID, "_kgflashmediaplayer-poster", true);
|
1290 |
-
$poster_id = get_post_meta($attachment->ID, '_kgflashmediaplayer-poster-id', true);
|
1291 |
-
if ( !empty($poster_id) && intval($query_atts['gallery_thumb']) <= get_option('medium_size_h') ) {
|
1292 |
-
$poster_post = get_post($poster_id);
|
1293 |
-
if ( $poster_post->guid == $thumbnail_url ) {
|
1294 |
-
$thumbnail_url = kgvid_get_attachment_medium_url($poster_id);
|
1295 |
-
} //use the "medium" size image if available
|
1296 |
-
}
|
1297 |
-
if (!$thumbnail_url) { $thumbnail_url = $options['poster']; } //use the default poster if no thumbnail set
|
1298 |
-
if (!$thumbnail_url) { $thumbnail_url = plugins_url('/images/nothumbnail.jpg', __FILE__);} //use the blank image if no other option
|
1299 |
|
1300 |
-
|
1301 |
|
1302 |
-
|
1303 |
|
1304 |
-
|
1305 |
-
if ( empty($query_atts['caption']) ) { $query_atts['caption'] = $attachment->post_excerpt; }
|
1306 |
-
$below_video = 0;
|
1307 |
-
if ( !empty($query_atts['caption']) ) { $below_video = 1; }
|
1308 |
-
if ( $downloadlink == "checked" ) { ++$below_video; }
|
1309 |
|
1310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1311 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1312 |
|
1313 |
-
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
-
|
1318 |
-
|
1319 |
-
|
1320 |
-
|
1321 |
-
|
1322 |
-
|
1323 |
-
|
1324 |
-
|
1325 |
-
open: function(event, ui){
|
1326 |
-
jQuery(\'.ui-widget-overlay\').wrap(\'<div class="kgvid_gallery" />\');
|
1327 |
-
},
|
1328 |
-
close: function(event, ui){
|
1329 |
-
jQuery(\'#kgvid_GalleryPlayerDiv_'.$div_suffix.'\').empty();
|
1330 |
-
jQuery(".kgvid_gallery").filter(function(){
|
1331 |
-
if (jQuery(this).text() == "") { return true; }
|
1332 |
-
return false;
|
1333 |
-
}).remove();
|
1334 |
}
|
1335 |
-
});
|
1336 |
-
}); </script>';
|
1337 |
|
1338 |
-
|
1339 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1340 |
} //if not feed
|
1341 |
return $code;
|
1342 |
}
|
@@ -1353,13 +1764,13 @@ add_filter( 'no_texturize_shortcodes', 'kgvid_no_texturize_shortcode' );
|
|
1353 |
|
1354 |
function kgvid_ajax_generate_encode_checkboxes() {
|
1355 |
|
1356 |
-
global $wpdb;
|
1357 |
-
|
1358 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
1359 |
|
1360 |
$movieurl = $_POST['movieurl'];
|
1361 |
$post_id = $_POST['post_id'];
|
1362 |
$page = $_POST['page'];
|
|
|
|
|
1363 |
|
1364 |
if (isset($_POST['encodeformats'])) {
|
1365 |
$encode_checked = $_POST['encodeformats'];
|
@@ -1369,18 +1780,17 @@ function kgvid_ajax_generate_encode_checkboxes() {
|
|
1369 |
}
|
1370 |
}
|
1371 |
|
1372 |
-
$checkboxes = kgvid_generate_encode_checkboxes($movieurl, $post_id, $page);
|
1373 |
-
|
1374 |
-
echo json_encode($arr);
|
1375 |
die();
|
1376 |
|
1377 |
}
|
1378 |
add_action('wp_ajax_kgvid_generate_encode_checkboxes', 'kgvid_ajax_generate_encode_checkboxes');
|
1379 |
|
1380 |
-
function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
1381 |
|
1382 |
-
$options =
|
1383 |
-
$
|
1384 |
$video_formats = kgvid_video_formats();
|
1385 |
|
1386 |
$video_queued = false;
|
@@ -1395,6 +1805,8 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1395 |
|
1396 |
if ( !empty($movieurl) ) {
|
1397 |
|
|
|
|
|
1398 |
$encodevideo_info = kgvid_encodevideo_info($movieurl, $post_id);
|
1399 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
1400 |
$movieurl = $sanitized_url['movieurl'];
|
@@ -1411,10 +1823,10 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1411 |
|
1412 |
$post_mime_type = "video/".pathinfo($movieurl, PATHINFO_EXTENSION);
|
1413 |
|
1414 |
-
if ( !empty($
|
1415 |
-
foreach ($
|
1416 |
if ( $video_entry['movieurl'] == $movieurl ) {
|
1417 |
-
if ( array_key_exists('movie_info', $video_entry) ) {
|
1418 |
$actualwidth = $video_entry['movie_info']['width'];
|
1419 |
$actualheight = $video_entry['movie_info']['height'];
|
1420 |
$rotated = $video_entry['movie_info']['rotate'];
|
@@ -1423,7 +1835,7 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1423 |
}
|
1424 |
}
|
1425 |
}
|
1426 |
-
reset($
|
1427 |
|
1428 |
if ( $page == "queue" ) {
|
1429 |
//$info = pathinfo($movieurl);
|
@@ -1431,20 +1843,21 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1431 |
}
|
1432 |
}
|
1433 |
if ( $post_mime_type == "video/m4v" || $post_mime_type == "video/quicktime" ) { $post_mime_type = "video/mp4"; }
|
1434 |
-
|
|
|
1435 |
else {
|
1436 |
-
$encode_disabled = ' disabled title="Please enter a valid video URL"';
|
1437 |
unset($video_formats['fullres']);
|
1438 |
}
|
1439 |
|
1440 |
if ( $options['ffmpeg_exists'] == "notinstalled" ) {
|
1441 |
-
$ffmpeg_disabled_text = 'disabled="disabled" title="'.
|
1442 |
}
|
1443 |
else { $ffmpeg_disabled_text = ""; }
|
1444 |
|
1445 |
$video_key = false;
|
1446 |
-
if ( !empty($
|
1447 |
-
foreach ($
|
1448 |
if ( $video_entry['movieurl'] == $movieurl ) {
|
1449 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
1450 |
if ( array_key_exists($format, $video_formats) ) { //don't recreate any formats that were previously unset
|
@@ -1488,7 +1901,7 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1488 |
if ( $format_stats['status'] != "notchecked" ) { //File is in queue
|
1489 |
$meta[$format] = ' <strong>'.ucfirst($format_stats['status']).'</strong>';
|
1490 |
if ( $format_stats['status'] == "error" ) {
|
1491 |
-
$meta[$format] .= ': <span
|
1492 |
}
|
1493 |
}
|
1494 |
|
@@ -1501,7 +1914,7 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1501 |
if ( $encodevideo_info[$format.'_writable']
|
1502 |
&& current_user_can('encode_videos')
|
1503 |
&& $format != "fullres" ) {
|
1504 |
-
$meta[$format] .= '<a id="delete-'.$post_id.'-'.$format.'" class="kgvid_delete-format" onclick="kgvid_delete_video(\''.$movieurl.'\', \''.$post_id.'\', \''.$format.'\', \''.$child_id[$format].'\');" href="javascript:void(0)">Delete Permanently</a>';
|
1505 |
}
|
1506 |
}
|
1507 |
$disabled[$format] = ' disabled title="Format already exists"';
|
@@ -1513,21 +1926,21 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1513 |
|
1514 |
if ( $format_stats['status'] == "encoding" ) {
|
1515 |
$encoding_now = true;
|
1516 |
-
$disabled[$format] = ' disabled title="Currently
|
1517 |
$checked[$format] = 'checked';
|
1518 |
$progress = kgvid_encode_progress($video_key, $format, $page);
|
1519 |
$meta[$format] = $progress['embed_display'];
|
1520 |
}
|
1521 |
|
1522 |
if ( $format_stats['status'] == "Encoding Complete" ) {
|
1523 |
-
$disabled[$format] = ' disabled title="Format already exists"';
|
1524 |
$checked[$format] = '';
|
1525 |
}
|
1526 |
|
1527 |
if ( $checked[$format] == '' ) { $something_to_encode = true; }
|
1528 |
|
1529 |
if ( !current_user_can('encode_videos') ) {
|
1530 |
-
$disabled[$format] = ' disabled title="You don\'t have permission to encode videos"';
|
1531 |
$something_to_encode = false;
|
1532 |
}
|
1533 |
|
@@ -1535,20 +1948,20 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1535 |
|
1536 |
}
|
1537 |
if ( $something_to_encode == false ) {
|
1538 |
-
$encode_disabled = ' disabled title="Nothing to encode" style="display:none;"';
|
1539 |
}
|
1540 |
|
1541 |
if ( $page == "queue" ) {
|
1542 |
-
$button_text =
|
1543 |
$checkboxes .= "\n\t\t\t".'<input type="hidden" name="attachments['.$post_id.'][kgflashmediaplayer-url]" value="'.$movieurl.'">';
|
1544 |
}
|
1545 |
-
else { $button_text =
|
1546 |
|
1547 |
|
1548 |
$checkboxes .= '<input type="button" id="attachments-'.$post_id.'-kgflashmediaplayer-encode" name="attachments['.$post_id.'][kgflashmediaplayer-encode]" class="button-secondary" value="'.$button_text.'" onclick="kgvid_enqueue_video_encode(\''.$post_id.'\');" '.$ffmpeg_disabled_text.$encode_disabled.'/><div style="display:block;" id="attachments-'.$post_id.'-encodeplaceholder"></div>';
|
1549 |
|
1550 |
if ( $page != "queue" ) {
|
1551 |
-
$checkboxes .= '<small><em>Generates additional video formats compatible with most mobile & HTML5-compatible browsers
|
1552 |
}
|
1553 |
|
1554 |
|
@@ -1564,16 +1977,47 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1564 |
}
|
1565 |
$checkboxes .= '</div>'; //close encodeboxes div
|
1566 |
|
1567 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1568 |
}
|
1569 |
|
1570 |
-
function kgvid_generate_queue_table() {
|
1571 |
|
1572 |
$html = "";
|
|
|
|
|
1573 |
|
1574 |
-
|
|
|
1575 |
|
1576 |
-
if ( !empty($
|
1577 |
|
1578 |
$video_formats = kgvid_video_formats();
|
1579 |
$currently_encoding = array();
|
@@ -1581,7 +2025,7 @@ function kgvid_generate_queue_table() {
|
|
1581 |
$nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
|
1582 |
$html .= "<input type='hidden' name='attachments[kgflashmediaplayer-security]' value='".$nonce."' />";
|
1583 |
|
1584 |
-
foreach ( $
|
1585 |
$html .= "\t<tr id='tr_".$video_entry['attachmentID']."'";
|
1586 |
foreach ( $video_formats as $format => $format_stats ) {
|
1587 |
if ( $video_entry['encode_formats'][$format]['status'] == "encoding" ) {
|
@@ -1601,119 +2045,261 @@ function kgvid_generate_queue_table() {
|
|
1601 |
elseif ( $queued[$order] ) { $html .= " class='kgvid_queued' "; }
|
1602 |
else { $html .= " class='kgvid_complete' "; }
|
1603 |
|
|
|
|
|
|
|
1604 |
$html .= ">";
|
|
|
|
|
1605 |
$html .= "<td id='td_".$video_entry['attachmentID']."'>".strval(intval($order)+1)."</td>\n";
|
1606 |
-
|
1607 |
-
|
1608 |
-
if ($
|
1609 |
-
|
1610 |
-
|
1611 |
-
if (
|
1612 |
-
$
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
$
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1631 |
$html .= "</td></tr>\n";
|
1632 |
}
|
1633 |
}
|
1634 |
-
else { $html = "\t<tr><td colspan='
|
1635 |
|
1636 |
return $html;
|
1637 |
|
1638 |
}
|
1639 |
|
1640 |
function kgvid_add_FFMPEG_Queue_Page() {
|
1641 |
-
$options =
|
1642 |
if ( $options['ffmpeg_exists'] == "on" ) { //only add the queue page if FFMPEG is installed
|
1643 |
-
add_submenu_page('tools.php', 'Video Embed & Thumbnail Generator Encoding Queue', 'Video Encode Queue', 'encode_videos', 'kgvid_video_encoding_queue', 'kgvid_FFMPEG_Queue_Page');
|
1644 |
}
|
1645 |
}
|
1646 |
add_action('admin_menu', 'kgvid_add_FFMPEG_Queue_Page');
|
1647 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1648 |
function kgvid_FFMPEG_Queue_Page() {
|
1649 |
|
1650 |
?>
|
1651 |
<div class="wrap">
|
1652 |
<div id="icon-tools" class="icon32"><br /></div>
|
1653 |
-
<h2
|
1654 |
<p></p>
|
1655 |
<form method="post" action="tools.php?page=kgvid_video_encoding_queue">
|
1656 |
<?php wp_nonce_field('video-embed-thumbnail-generator-nonce','video-embed-thumbnail-generator-nonce'); ?>
|
|
|
1657 |
<table class="widefat">
|
1658 |
<thead>
|
1659 |
-
|
1660 |
-
<th>Order</th>
|
1661 |
-
<th>Thumbnail</th>
|
1662 |
-
<th>File</th>
|
1663 |
-
<th>Formats</th>
|
1664 |
-
<th>Actions</th>
|
1665 |
</thead>
|
1666 |
<tfoot>
|
1667 |
-
|
1668 |
-
<th>Order</th>
|
1669 |
-
<th>Thumbnail</th>
|
1670 |
-
<th>File</th>
|
1671 |
-
<th>Formats</th>
|
1672 |
-
<th>Actions</th>
|
1673 |
</tfoot>
|
1674 |
<tbody class="rows">
|
1675 |
<?php echo kgvid_generate_queue_table(); ?>
|
1676 |
</tbody>
|
1677 |
</table>
|
1678 |
-
<!-- <input type='button' class='button-secondary' value='sort' onclick='jQuery("#sortable tbody.rows").trigger("sortupdate"); jQuery( "#sortable tbody.rows" ).sortable("refresh");'> -->
|
1679 |
<p>
|
1680 |
-
<input id='clear_completed' type='button' class='button-secondary' value='Clear All Completed' onclick='kgvid_encode_queue("clear_completed", 0, 0);'>
|
1681 |
</p>
|
1682 |
</form>
|
1683 |
</div>
|
1684 |
<?php
|
1685 |
}
|
1686 |
|
1687 |
-
function
|
1688 |
-
|
1689 |
}
|
1690 |
-
add_action('
|
1691 |
|
1692 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1693 |
wp_enqueue_media();
|
1694 |
-
$options =
|
1695 |
$video_app = $options['video_app'];
|
1696 |
if ( $video_app == "avconv" ) { $video_app = "libav"; }
|
1697 |
?>
|
1698 |
<div class="wrap">
|
1699 |
<div class="icon32" id="icon-options-general"><br></div>
|
1700 |
<h2>Video Embed & Thumbnail Generator</h2>
|
|
|
|
|
|
|
1701 |
<h2 class="nav-tab-wrapper">
|
1702 |
-
<a href="#" id="general_tab" class="nav-tab" onclick="kgvid_switch_settings_tab('general');"
|
1703 |
-
<a href="#" id="encoding_tab" class="nav-tab" onclick="kgvid_switch_settings_tab('encoding');"
|
1704 |
</h2>
|
|
|
1705 |
<form method="post" action="options.php">
|
1706 |
<?php settings_fields('kgvid_video_embed_options'); ?>
|
1707 |
<input type="hidden" id="kgvid_settings_security" value="<?php echo wp_create_nonce('video-embed-thumbnail-generator-nonce'); ?>">
|
1708 |
<?php do_settings_sections(__FILE__); ?>
|
1709 |
<p class='submit'>
|
1710 |
-
<?php submit_button('Save Changes', 'primary', 'kgvid_submit', false, array( 'onclick' => "jQuery('form :disabled').prop('disabled', false);" ) ); ?>
|
1711 |
-
<?php submit_button('Reset Options', 'secondary', 'video-embed-thumbnail-generator-reset', false); ?>
|
1712 |
</p>
|
1713 |
</form>
|
1714 |
-
|
1715 |
<div class="kgvid-blue-box">
|
1716 |
-
<span
|
1717 |
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
1718 |
<input type="hidden" name="cmd" value="_donations">
|
1719 |
<input type="hidden" name="business" value="kylegilman@gmail.com">
|
@@ -1725,8 +2311,7 @@ function kgvid_FMPOptionsPage() {
|
|
1725 |
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
1726 |
</form>
|
1727 |
</div>
|
1728 |
-
|
1729 |
-
<?php echo "<script type='text/javascript'>
|
1730 |
jQuery(document).ready(function() {
|
1731 |
kgvid_switch_settings_tab('general');
|
1732 |
jQuery('form :input').change(function() {
|
@@ -1734,67 +2319,133 @@ function kgvid_FMPOptionsPage() {
|
|
1734 |
});
|
1735 |
}
|
1736 |
);
|
1737 |
-
</script>
|
1738 |
</div>
|
1739 |
<?php
|
1740 |
}
|
1741 |
|
1742 |
function kgvid_video_embed_options_init() {
|
1743 |
|
1744 |
-
|
|
|
1745 |
|
1746 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1747 |
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
1768 |
-
|
1769 |
-
|
1770 |
-
|
1771 |
-
|
1772 |
-
|
1773 |
-
|
1774 |
-
|
1775 |
-
|
1776 |
-
|
1777 |
-
|
1778 |
-
|
1779 |
-
|
1780 |
-
|
1781 |
-
|
1782 |
-
|
1783 |
-
|
1784 |
-
|
1785 |
-
add_settings_field('
|
1786 |
-
add_settings_field('
|
1787 |
-
add_settings_field('
|
1788 |
-
add_settings_field('
|
1789 |
-
add_settings_field('
|
1790 |
-
add_settings_field('
|
1791 |
-
add_settings_field('
|
1792 |
-
add_settings_field('
|
1793 |
-
add_settings_field('
|
1794 |
-
add_settings_field('
|
1795 |
-
add_settings_field('
|
1796 |
-
add_settings_field('
|
1797 |
-
add_settings_field('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1798 |
|
1799 |
}
|
1800 |
add_action('admin_init', 'kgvid_video_embed_options_init' );
|
@@ -1802,8 +2453,9 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
1802 |
//callback functions generating HTML for the settings form
|
1803 |
|
1804 |
function kgvid_plugin_playback_settings_section_callback() {
|
|
|
1805 |
global $wp_version;
|
1806 |
-
$options =
|
1807 |
if ( $options['embeddable'] != "on" ) {
|
1808 |
$embed_disabled = "disabled='disabled'";
|
1809 |
if ( $options['overlay_embedcode'] == "on" || $options['open_graph'] == "on" ) {
|
@@ -1814,124 +2466,162 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
1814 |
}
|
1815 |
else { $embed_disabled = ""; }
|
1816 |
|
1817 |
-
$
|
1818 |
-
if ( $wp_version >= 3.6 ) { $
|
1819 |
-
|
1820 |
-
|
1821 |
-
|
1822 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1823 |
}
|
1824 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
1825 |
|
1826 |
-
$sampleheight = intval($options['height']) +
|
1827 |
echo "<div class='kgvid_setting_nearvid' style='width:".$options['width']."px;'>";
|
1828 |
-
echo "<div style='float:left;'><input class='affects_player' ".checked( $options['overlay_title'], "on", false )." id='overlay_title' name='kgvid_video_embed_options[overlay_title]' type='checkbox' /> <label for='overlay_title'>Overlay video title</label></div>";
|
1829 |
-
echo "<div style='float:right;'><input class='affects_player' ".checked( $options['overlay_embedcode'], "on", false )." id='overlay_embedcode' name='kgvid_video_embed_options[overlay_embedcode]' type='checkbox' ".$embed_disabled."/> <label for='overlay_embedcode'>Overlay embed code</label></div>";
|
1830 |
$iframeurl = site_url('/')."?kgvid_video_embed[enable]=true&kgvid_video_embed[sample]=true";
|
1831 |
echo "<iframe id='kgvid_samplevideo' style='border:2px;' src='".$iframeurl."' scrolling='no' width='".$options['width']."' height='".$sampleheight."'></iframe>";
|
1832 |
-
echo "<div style='float:
|
|
|
1833 |
echo "</div>\n\t";
|
1834 |
}
|
1835 |
function kgvid_plugin_flash_settings_section_callback() { }
|
1836 |
function kgvid_plugin_settings_section_callback() { }
|
1837 |
|
1838 |
function kgvid_poster_callback() {
|
1839 |
-
$options =
|
1840 |
-
echo "<input class='regular-text affects_player' id='poster' name='kgvid_video_embed_options[poster]' type='text' value='".$options['poster']."' /> <span id='pick-thumbnail' class='button-secondary' data-choose='Choose a Thumbnail' data-update='Set as video thumbnail' data-change='poster' onclick='kgvid_pick_image(this);'>Choose from Library</span>\n\t";
|
1841 |
}
|
1842 |
|
1843 |
function kgvid_endofvideooverlay_callback() {
|
1844 |
-
$options =
|
1845 |
-
echo "<input class='affects_player' ".checked( $options['endofvideooverlaysame'], "on", false )." id='endofvideooverlaysame' name='kgvid_video_embed_options[endofvideooverlaysame]' type='checkbox' /> <label for='endofvideooverlaysame'>Display thumbnail image again when video ends
|
1846 |
-
echo "<input class='regular-text affects_player' id='endofvideooverlay' name='kgvid_video_embed_options[endofvideooverlay]' ".disabled( $options['endofvideooverlaysame'], "true", false )." type='text' value='".$options['endofvideooverlay']."' /> <span id='pick-endofvideooverlay' class='button-secondary' data-choose='Choose End of Video Image' data-update='Set as end of video image' data-change='endofvideooverlay' onclick='kgvid_pick_image(this);'>Choose from Library</span><br />";
|
1847 |
echo "Display alternate image when video ends.<small>\n\t";
|
1848 |
}
|
1849 |
|
1850 |
function kgvid_watermark_callback() {
|
1851 |
-
$options =
|
1852 |
-
echo "<input class='regular-text affects_player' id='watermark' name='kgvid_video_embed_options[watermark]' type='text' value='".$options['watermark']."' /> <span id='pick-
|
1853 |
}
|
1854 |
|
1855 |
function kgvid_align_callback() {
|
1856 |
-
$options =
|
1857 |
-
$items = array("left", "center", "right");
|
1858 |
echo "<select id='align' name='kgvid_video_embed_options[align]'>";
|
1859 |
-
foreach($items as $
|
1860 |
-
$selected = ($options['align']==$
|
1861 |
-
echo "<option value='$
|
1862 |
}
|
1863 |
echo "</select>\n\t";
|
1864 |
}
|
1865 |
|
1866 |
function kgvid_resize_callback() {
|
1867 |
-
$options =
|
1868 |
-
echo "<input ".checked( $options['resize'], "on", false )." id='resize' name='kgvid_video_embed_options[resize]' type='checkbox' /> <label for='resize'>Make video player responsive
|
1869 |
}
|
1870 |
|
1871 |
function kgvid_inline_callback() {
|
1872 |
-
$options =
|
1873 |
-
echo "<input ".checked( $options['inline'], "on", false )." id='inline' name='kgvid_video_embed_options[inline]' type='checkbox' /> <label for='inline'>Allow other content on the same line as the video
|
1874 |
}
|
1875 |
|
1876 |
function kgvid_dimensions_callback() {
|
1877 |
-
$options =
|
1878 |
-
echo
|
1879 |
-
echo "<input ".checked( $options['minimum_width'], "on", false )." id='minimum_width' name='kgvid_video_embed_options[minimum_width]' type='checkbox' /> <label for='minimum_width'>Enlarge lower resolution videos to max width
|
1880 |
}
|
1881 |
|
1882 |
function kgvid_gallery_dimensions_callback() {
|
1883 |
-
$options =
|
1884 |
-
echo
|
1885 |
}
|
1886 |
|
1887 |
function kgvid_gallery_thumb_callback() {
|
1888 |
-
$options =
|
1889 |
echo "<input class='small-text' id='gallery_thumb' name='kgvid_video_embed_options[gallery_thumb]' type='text' value='".$options['gallery_thumb']."' />\n\t";
|
1890 |
}
|
1891 |
|
1892 |
function kgvid_controlbar_style_callback() {
|
1893 |
-
$options =
|
1894 |
-
$items = array(
|
|
|
|
|
|
|
1895 |
echo "<select class='affects_player' id='controlbar_style' name='kgvid_video_embed_options[controlbar_style]'>";
|
1896 |
-
foreach($items as $
|
1897 |
-
$selected = ($options['controlbar_style']==$
|
1898 |
-
echo "<option value='$
|
1899 |
}
|
1900 |
-
echo "</select
|
1901 |
}
|
1902 |
|
1903 |
function kgvid_autoplay_callback() {
|
1904 |
-
$options =
|
1905 |
-
echo "<input class='affects_player' ".checked( $options['autoplay'], "on", false )." id='autoplay' name='kgvid_video_embed_options[autoplay]' type='checkbox' /> <label for='autoplay'>Play automatically when page loads
|
1906 |
}
|
1907 |
|
1908 |
function kgvid_loop_callback() {
|
1909 |
-
$options =
|
1910 |
-
echo "<input class='affects_player' ".checked( $options['loop'], "on", false )." id='loop' name='kgvid_video_embed_options[loop]' type='checkbox' /> <label for='loop'>Loop to beginning when video ends
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1911 |
}
|
1912 |
|
1913 |
function kgvid_js_skin_callback() {
|
1914 |
-
$options =
|
1915 |
-
echo "<input class='regular-text code affects_player' id='js_skin' name='kgvid_video_embed_options[js_skin]' type='text' value='".$options['js_skin']."' /><br /><em><small>Use
|
1916 |
}
|
1917 |
|
1918 |
function kgvid_bgcolor_callback() {
|
1919 |
-
$options =
|
1920 |
echo "<input class='small-text affects_player' id='bgcolor' name='kgvid_video_embed_options[bgcolor]' maxlength='7' type='text' value='".$options['bgcolor']."' /> #rrggbb\n\t";
|
1921 |
}
|
1922 |
|
1923 |
function kgvid_configuration_callback() {
|
1924 |
-
$options =
|
1925 |
echo "<input class='regular-text affects_player' id='configuration' name='kgvid_video_embed_options[configuration]' type='text' value='".$options['configuration']."' />\n\t";
|
1926 |
}
|
1927 |
|
1928 |
function kgvid_skin_callback() {
|
1929 |
-
$options =
|
1930 |
-
echo "<input class='regular-text affects_player' id='skin' name='kgvid_video_embed_options[skin]' type='text' value='".$options['skin']."' /><br /><em><small>Use <code>".plugins_url("", __FILE__)."/flash/skin/kgvid_skin.xml</code>
|
1931 |
}
|
1932 |
|
1933 |
function kgvid_stream_type_callback() {
|
1934 |
-
$options =
|
1935 |
$items = array("liveOrRecorded", "live", "recorded", "dvr");
|
1936 |
echo "<select class='affects_player' id='stream_type' name='kgvid_video_embed_options[stream_type]'>";
|
1937 |
foreach($items as $item) {
|
@@ -1942,174 +2632,253 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
1942 |
}
|
1943 |
|
1944 |
function kgvid_scale_mode_callback() {
|
1945 |
-
$options =
|
1946 |
-
$items = array("letterbox", "none", "stretch", "zoom");
|
1947 |
echo "<select class='affects_player' id='scale_mode' name='kgvid_video_embed_options[scale_mode]'>";
|
1948 |
-
foreach($items as $
|
1949 |
-
$selected = ($options['scale_mode']==$
|
1950 |
-
echo "<option value='$
|
1951 |
}
|
1952 |
echo "</select>\n\t";
|
1953 |
}
|
1954 |
|
1955 |
function kgvid_autohide_callback() {
|
1956 |
-
$options =
|
1957 |
-
echo "<input ".checked( $options['autohide'], "on", false )." id='autohide' name='kgvid_video_embed_options[autohide]' type='checkbox' /> <label for='autohide'>Autohide controlbar
|
1958 |
}
|
1959 |
|
1960 |
function kgvid_playbutton_callback() {
|
1961 |
-
$options =
|
1962 |
-
echo "<input class='affects_player' ".checked( $options['playbutton'], "on", false )." id='playbutton' name='kgvid_video_embed_options[playbutton]' type='checkbox' /> <label for='playbutton'>Overlay play button on poster frame
|
1963 |
}
|
1964 |
|
1965 |
function kgvid_generate_thumbs_callback() {
|
1966 |
-
$options =
|
1967 |
echo "<input class='small-text' id='generate_thumbs' name='kgvid_video_embed_options[generate_thumbs]' maxlength='2' type='text' value='".strval($options['generate_thumbs'])."' />\n\t";
|
1968 |
}
|
1969 |
|
1970 |
-
function kgvid_user_roles_callback() {
|
1971 |
global $wp_roles;
|
1972 |
-
$options =
|
1973 |
$capabilities_checkboxes = array();
|
1974 |
-
$capabilities = array('make_video_thumbnails'=>'make thumbnails', 'encode_videos'=>'encode videos');
|
1975 |
foreach ( $capabilities as $capability => $capability_name ) {
|
1976 |
-
$capabilities_checkboxes[] = "<strong>
|
1977 |
foreach ( $wp_roles->roles as $role => $role_info ) {
|
1978 |
|
1979 |
$capability_enabled = false;
|
1980 |
-
if (
|
1981 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1982 |
|
1983 |
} //role loop
|
|
|
1984 |
}// capability loop
|
1985 |
-
echo implode("
|
1986 |
}
|
1987 |
|
1988 |
function kgvid_security_callback() {
|
1989 |
-
$options =
|
1990 |
if ( $options['embeddable'] != "on" ) { $embed_disabled = " disabled='disabled'"; }
|
1991 |
else { $embed_disabled = ""; }
|
1992 |
-
echo "<input class='affects_player' ".checked( $options['embeddable'], "on", false )." id='embeddable' name='kgvid_video_embed_options[embeddable]' type='checkbox' onclick='kgvid_embeddable_switch(this.checked);' /> <label for='embeddable'>Allow users to embed your videos on other sites
|
1993 |
-
echo "<input ".checked( $options['open_graph'], "on", false )." id='open_graph' name='kgvid_video_embed_options[open_graph]' type='checkbox'".$embed_disabled." /> <label for='open_graph'>Enable Open Graph video tags
|
1994 |
-
echo "<input class='affects_player' ".checked( $options['right_click'], "on", false )." id='right_click' name='kgvid_video_embed_options[right_click]' type='checkbox' /> <label for='right_click'>Allow right-clicking on videos
|
1995 |
}
|
1996 |
|
1997 |
function kgvid_featured_callback() {
|
1998 |
-
$options =
|
1999 |
-
echo "<input ".checked( $options['featured'], "on", false )." id='featured' name='kgvid_video_embed_options[featured]' type='checkbox' /> <label for='featured'>Set generated video thumbnails as featured images
|
2000 |
}
|
2001 |
|
2002 |
function kgvid_thumb_parent_callback() {
|
2003 |
-
$options =
|
2004 |
$items = array("post", "video");
|
2005 |
echo "<select id='thumb_parent' name='kgvid_video_embed_options[thumb_parent]'>";
|
2006 |
foreach($items as $item) {
|
2007 |
$selected = ($options['thumb_parent']==$item) ? 'selected="selected"' : '';
|
2008 |
echo "<option value='$item' $selected>$item</option>";
|
2009 |
}
|
2010 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2011 |
}
|
2012 |
|
2013 |
function kgvid_delete_children_callback() {
|
2014 |
-
$options =
|
2015 |
$items = array("none", "all", "encoded videos only");
|
2016 |
echo "<select id='delete_children' name='kgvid_video_embed_options[delete_children]'>";
|
2017 |
foreach($items as $item) {
|
2018 |
$selected = ($options['delete_children']==$item) ? 'selected="selected"' : '';
|
2019 |
echo "<option value='$item' $selected>$item</option>";
|
2020 |
}
|
2021 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2022 |
}
|
2023 |
|
2024 |
function kgvid_titlecode_callback() {
|
2025 |
-
$options =
|
2026 |
-
echo "<input class='regular-text code' id='titlecode' name='kgvid_video_embed_options[titlecode]' type='text' value='".htmlentities(stripslashes($options['titlecode']))."' /> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2027 |
}
|
2028 |
|
2029 |
function kgvid_template_callback() {
|
2030 |
-
$options =
|
2031 |
-
$items = array("Video title (WP default)"=>"none", "Video in existing template"=>"gentle", "Video only (deprecated)"=>"old");
|
2032 |
echo "<select id='template' name='kgvid_video_embed_options[template]'>";
|
2033 |
foreach($items as $name => $value) {
|
2034 |
$selected = ($options['template']==$value) ? 'selected="selected"' : '';
|
2035 |
echo "<option value='$value' $selected>$name</option>";
|
2036 |
}
|
2037 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2038 |
}
|
2039 |
|
2040 |
function kgvid_app_path_callback() {
|
2041 |
-
$options =
|
2042 |
-
|
|
|
2043 |
}
|
2044 |
|
2045 |
function kgvid_video_app_callback() {
|
2046 |
-
$options =
|
|
|
2047 |
echo "<select onchange='kgvid_hide_ffmpeg_settings();' class='affects_ffmpeg' id='video_app' name='kgvid_video_embed_options[video_app]'>";
|
2048 |
$items = array("FFMPEG"=>"ffmpeg", "LIBAV"=>"avconv");
|
2049 |
foreach($items as $name => $value) {
|
2050 |
$selected = ($options['video_app']==$value) ? 'selected="selected"' : '';
|
2051 |
echo "<option value='$value' $selected>$name</option>";
|
2052 |
}
|
2053 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2054 |
}
|
2055 |
|
2056 |
function kgvid_browser_thumbnails_callback() {
|
2057 |
-
$options =
|
2058 |
echo "<div class='kgvid_video_app_required'>";
|
2059 |
-
echo "<input ".checked( $options['browser_thumbnails'], "on", false )." id='browser_thumbnails' name='kgvid_video_embed_options[browser_thumbnails]' type='checkbox' /> <label for='browser_thumbnails'>When possible, use the browser's built-in video capabilities to make thumbnails instead of <strong class='video_app_name'>".strtoupper($options['video_app'])."</strong
|
2060 |
echo "</div>";
|
2061 |
}
|
2062 |
|
2063 |
function kgvid_encode_formats_callback() {
|
2064 |
-
$options =
|
2065 |
echo "<div class='kgvid_video_app_required'>";
|
2066 |
-
echo "<input ".checked( $options['encode_fullres'], "on", false )." id='encode_fullres' name='kgvid_video_embed_options[encode_fullres]' type='checkbox' /> <label for='encode_fullres'>Replace original with same resolution H.264</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2067 |
-
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 <small><em>(iPhone 4s+, iPad 2+,
|
2068 |
-
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 <small><em>(iPhone 4+, iPad,
|
2069 |
-
echo "<input ".checked( $options['encode_mobile'], "on", false )." id='encode_mobile' name='kgvid_video_embed_options[encode_mobile]' type='checkbox' /> <label for='encode_mobile'>480p H.264 <small><em>(iOS, Android, Windows Phone 7, Chrome, Safari, IE 9
|
2070 |
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 />";
|
2071 |
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>";
|
2072 |
echo "</div>\n\t";
|
2073 |
}
|
2074 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2075 |
function kgvid_automatic_callback() {
|
2076 |
-
$options =
|
2077 |
echo "<div class='kgvid_video_app_required'>";
|
2078 |
-
echo "<input ".checked( $options['auto_encode'], "on", false )." id='auto_encode' name='kgvid_video_embed_options[auto_encode]' type='checkbox' /> <label for='auto_encode'>Encode formats selected above
|
2079 |
-
|
2080 |
-
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
|
|
|
|
2085 |
}
|
2086 |
-
|
|
|
|
|
|
|
2087 |
echo "</div>\n\t";
|
2088 |
}
|
2089 |
|
2090 |
function kgvid_htaccess_callback() {
|
2091 |
-
$options =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2092 |
echo "<div class='kgvid_video_app_required'>";
|
2093 |
-
echo "<
|
2094 |
-
echo "<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2095 |
echo "</div>\n\t";
|
2096 |
}
|
2097 |
|
2098 |
function kgvid_moov_callback() {
|
2099 |
-
$options =
|
2100 |
echo "<div class='kgvid_video_app_required'>";
|
2101 |
-
$items = array("none"=>"none", "movflags faststart"=>"movflag", "qt-faststart"=>"qt-faststart", "MP4Box"=>"MP4Box");
|
2102 |
echo "<select id='moov' name='kgvid_video_embed_options[moov]' class='affects_ffmpeg'>";
|
2103 |
foreach($items as $name => $value) {
|
2104 |
$selected = ($options['moov']==$value) ? 'selected="selected"' : '';
|
2105 |
echo "<option value='$value' $selected>$name</option>";
|
2106 |
}
|
2107 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2108 |
echo "</div>\n\t";
|
2109 |
}
|
2110 |
|
2111 |
function kgvid_rate_control_callback() {
|
2112 |
-
$options =
|
2113 |
echo "<div class='kgvid_video_app_required'>";
|
2114 |
echo "<select id='rate_control' name='kgvid_video_embed_options[rate_control]' onchange='kgvid_hide_ffmpeg_settings();' class='affects_ffmpeg'>";
|
2115 |
$items = array("Constant Rate Factor"=>"crf", "Average Bit Rate"=>"abr");
|
@@ -2117,45 +2886,45 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
2117 |
$selected = ($options['rate_control']==$value) ? 'selected="selected"' : '';
|
2118 |
echo "<option value='$value' $selected>$name</option>";
|
2119 |
}
|
2120 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2121 |
echo "</div>\n\t";
|
2122 |
}
|
2123 |
|
2124 |
function kgvid_CRF_options_callback() {
|
2125 |
-
$options =
|
2126 |
echo "<div class='kgvid_video_app_required'>";
|
2127 |
echo "<select id='h264_CRF' name='kgvid_video_embed_options[h264_CRF]' class='affects_ffmpeg'>";
|
2128 |
for ($i = 0; $i <= 51; $i++ ) {
|
2129 |
$selected = ($options['h264_CRF']==$i) ? 'selected="selected"' : '';
|
2130 |
echo "<option value='".$i."' $selected>".$i."</option>";
|
2131 |
}
|
2132 |
-
echo "</select> H.264 <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2133 |
|
2134 |
echo "<select id='webm_CRF' name='kgvid_video_embed_options[webm_CRF]' class='affects_ffmpeg'>";
|
2135 |
for ($i = 4; $i <= 63; $i++ ) {
|
2136 |
$selected = ($options['webm_CRF']==$i) ? 'selected="selected"' : '';
|
2137 |
echo "<option value='".$i."' $selected>".$i."</option>";
|
2138 |
}
|
2139 |
-
echo "</select> WEBM <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2140 |
|
2141 |
echo "<select id='ogv_CRF' name='kgvid_video_embed_options[ogv_CRF]' class='affects_ffmpeg'>";
|
2142 |
for ($i = 1; $i <= 10; $i++ ) {
|
2143 |
$selected = ($options['ogv_CRF']==$i) ? 'selected="selected"' : '';
|
2144 |
echo "<option value='".$i."' $selected>".$i."</option>";
|
2145 |
}
|
2146 |
-
echo "</select> OGV (qscale) <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2147 |
echo "</div>\n\t";
|
2148 |
}
|
2149 |
|
2150 |
function kgvid_average_bitrate_callback() {
|
2151 |
-
$options =
|
2152 |
echo "<div class='kgvid_video_app_required'>";
|
2153 |
echo "<select onchange='kgvid_set_bitrate_display();' id='bitrate_multiplier' name='kgvid_video_embed_options[bitrate_multiplier]' class='affects_ffmpeg'>";
|
2154 |
for ($i = 0.01; $i <= 0.31; $i=$i+0.01 ) {
|
2155 |
$selected = ($options['bitrate_multiplier']==strval($i)) ? 'selected="selected"' : '';
|
2156 |
echo "<option value='$i' $selected>$i</option>";
|
2157 |
}
|
2158 |
-
echo "</select> bits per pixel. <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2159 |
echo "<span class='kgvid_gray_text'>1080p = <span id='1080_bitrate'>".round(floatval($options['bitrate_multiplier'])*1920*1080*30/1024)."</span> kbps<br />";
|
2160 |
echo "720p = <span id='720_bitrate'>".round(floatval($options['bitrate_multiplier'])*1280*720*30/1024)."</span> kbps<br />";
|
2161 |
echo "480p = <span id='360_bitrate'>".round(floatval($options['bitrate_multiplier'])*640*360*30/1024)."</span> kbps</span>";
|
@@ -2163,7 +2932,7 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
2163 |
}
|
2164 |
|
2165 |
function kgvid_h264_profile_callback() {
|
2166 |
-
$options =
|
2167 |
echo "<div class='kgvid_video_app_required'>";
|
2168 |
echo "<select id='h264_profile' name='kgvid_video_embed_options[h264_profile]' class='affects_ffmpeg'>";
|
2169 |
$items = array("none", "baseline", "main", "high", "high10", "high422", "high444");
|
@@ -2171,19 +2940,19 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
2171 |
$selected = ($options['h264_profile']==$item) ? 'selected="selected"' : '';
|
2172 |
echo "<option value='$item' $selected>$item</option>";
|
2173 |
}
|
2174 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2175 |
echo "<select id='h264_level' name='kgvid_video_embed_options[h264_level]' class='affects_ffmpeg'>";
|
2176 |
$items = array("none", "1", "1.1", "1.2", "1.3", "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1");
|
2177 |
foreach($items as $item) {
|
2178 |
$selected = ($options['h264_level']==$item) ? 'selected="selected"' : '';
|
2179 |
echo "<option value='$item' $selected>$item</option>";
|
2180 |
}
|
2181 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2182 |
echo "</div>\n\t";
|
2183 |
}
|
2184 |
|
2185 |
function kgvid_audio_bitrate_options_callback() {
|
2186 |
-
$options =
|
2187 |
echo "<div class='kgvid_video_app_required'>";
|
2188 |
$items = array(96, 112, 128, 160, 192, 224, 256, 320);
|
2189 |
echo "<select id='audio_bitrate' name='kgvid_video_embed_options[audio_bitrate]' class='affects_ffmpeg'>";
|
@@ -2196,38 +2965,67 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
2196 |
}
|
2197 |
|
2198 |
function kgvid_ffmpeg_options_callback() {
|
2199 |
-
$options =
|
2200 |
echo "<div class='kgvid_video_app_required'>";
|
2201 |
-
echo "<input class='affects_ffmpeg' onchange='if(jQuery(\"#ffmpeg_vpre\").attr(\"checked\")==\"checked\"){jQuery(\"#video_bitrate_flag\").attr(\"checked\", \"checked\");}' ".checked( $options['video_bitrate_flag'], "on", false )." id='video_bitrate_flag' name='kgvid_video_embed_options[video_bitrate_flag]' type='checkbox' /> <label for='video_bitrate_flag'>Enable legacy FFMPEG
|
2202 |
-
<input class='affects_ffmpeg' onchange='if(jQuery(\"#ffmpeg_vpre\").attr(\"checked\")==\"checked\"){jQuery(\"#video_bitrate_flag\").attr(\"checked\", \"checked\");}' ".checked( $options['ffmpeg_vpre'], "on", false )." id='ffmpeg_vpre' name='kgvid_video_embed_options[ffmpeg_vpre]' type='checkbox' /> <label for='ffmpeg_vpre'>Enable legacy FFMPEG parameters
|
2203 |
echo "</div>\n\t";
|
2204 |
}
|
2205 |
|
2206 |
function kgvid_execution_options_callback() {
|
2207 |
-
$options =
|
|
|
2208 |
echo "<div class='kgvid_video_app_required'>";
|
2209 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2210 |
echo "<select id='threads' name='kgvid_video_embed_options[threads]' class='affects_ffmpeg'>";
|
2211 |
for ($i = 0; $i <= 16; $i++ ) {
|
2212 |
$selected = ($options['threads']==$i) ? 'selected="selected"' : '';
|
2213 |
echo "<option value='".$i."' $selected>".$i."</option>";
|
2214 |
}
|
2215 |
-
echo "</select> threads <a class='kgvid_tooltip' href='javascript:void(0);'><img src='
|
2216 |
-
|
|
|
2217 |
echo "</div>";
|
2218 |
|
|
|
|
|
|
|
|
|
|
|
|
|
2219 |
$encode_string = "";
|
2220 |
if ( $options['ffmpeg_exists'] == "on" ) {
|
|
|
2221 |
$movie_info = kgvid_get_video_dimensions(plugin_dir_url(__FILE__)."images/sample-video-h264.mp4");
|
2222 |
$uploads = wp_upload_dir();
|
2223 |
-
|
|
|
|
|
|
|
|
|
2224 |
}
|
2225 |
|
|
|
|
|
|
|
2226 |
$display_div = "";
|
2227 |
if ( $options['ffmpeg_exists'] != "on" ) { $display_div = " style='display:none;'"; }
|
2228 |
|
2229 |
-
|
2230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2231 |
}
|
2232 |
|
2233 |
//end of settings page callback functions
|
@@ -2236,7 +3034,7 @@ function kgvid_update_settings() {
|
|
2236 |
|
2237 |
global $wpdb;
|
2238 |
|
2239 |
-
$options =
|
2240 |
$options_old = $options; //save the values that are in the db
|
2241 |
$default_options = kgvid_default_options_fn();
|
2242 |
|
@@ -2276,11 +3074,10 @@ function kgvid_update_settings() {
|
|
2276 |
delete_option($old_setting);
|
2277 |
}
|
2278 |
}
|
2279 |
-
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'wp_FMP%'" );
|
2280 |
|
2281 |
foreach ( $default_options as $key => $value ) { //apply default values for any settings that didn't exist before
|
2282 |
if ( !array_key_exists($key, $options) ) { $options[$key] = $value; }
|
2283 |
-
$options['embed_method'] = "Strobe Media Playback";
|
2284 |
}
|
2285 |
|
2286 |
update_option('kgvid_video_embed_options', $options);
|
@@ -2347,7 +3144,7 @@ function kgvid_update_settings() {
|
|
2347 |
$options["endofvideooverlay"] = $options["endOfVideoOverlay"];
|
2348 |
unset($options["endOfVideoOverlaySame"]);
|
2349 |
|
2350 |
-
$upload_capable =
|
2351 |
$options["capabilities"]["make_video_thumbnails"] = $upload_capable;
|
2352 |
$options["capabilities"]["encode_videos"] = $upload_capable;
|
2353 |
kgvid_set_capabilities($options["capabilities"]);
|
@@ -2372,6 +3169,23 @@ function kgvid_update_settings() {
|
|
2372 |
$options['version'] = 4.25;
|
2373 |
kgvid_check_ffmpeg_exists($options, true);
|
2374 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2375 |
if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
|
2376 |
if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
|
2377 |
}
|
@@ -2379,48 +3193,56 @@ function kgvid_update_settings() {
|
|
2379 |
}
|
2380 |
add_action('init', 'kgvid_update_settings' );
|
2381 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2382 |
function kgvid_video_embed_options_validate($input) { //validate & sanitize input from settings form
|
2383 |
|
2384 |
-
$options =
|
2385 |
$default_options = kgvid_default_options_fn();
|
2386 |
|
2387 |
if (isset ($_POST["video-embed-thumbnail-generator-reset"])) {
|
2388 |
$input = $default_options;
|
2389 |
-
add_settings_error( __FILE__, "options-reset", "Video Embed & Thumbnail Generator settings reset to default values.", "updated" );
|
2390 |
}
|
2391 |
|
2392 |
-
if ( $input['app_path'] != $options['app_path'] || $input['video_app'] != $options['video_app'] ) {
|
2393 |
-
|
2394 |
-
$ffmpeg_info = kgvid_check_ffmpeg_exists($input, false);
|
2395 |
-
if ( $ffmpeg_info['ffmpeg_exists'] == true ) { $input['ffmpeg_exists'] = "on"; }
|
2396 |
-
$input['app_path'] = $ffmpeg_info['app_path'];
|
2397 |
-
|
2398 |
-
if ( $ffmpeg_info['exec_enabled'] == false ) {
|
2399 |
-
add_settings_error( __FILE__, "ffmpeg-disabled", $ffmpeg_info['function']." is disabled in PHP settings. You can embed existing videos and make thumbnails with compatible browsers, but video encoding will not work. Contact your System Administrator to find out if you can enable ".$ffmpeg_info['function'].".", "updated");
|
2400 |
-
$input['ffmpeg_exists'] = "notinstalled";
|
2401 |
-
}
|
2402 |
-
elseif ( $ffmpeg_info['ffmpeg_exists'] == false ) {
|
2403 |
-
add_settings_error( __FILE__, "ffmpeg-disabled", strtoupper($input['video_app'])." not found at ".$input['app_path'].". You can embed existing videos and make thumbnails with compatible browsers, but video encoding is not possible without ".strtoupper($input['video_app']).".", "updated");
|
2404 |
-
$input['ffmpeg_exists'] = "notinstalled";
|
2405 |
-
}
|
2406 |
-
|
2407 |
}
|
2408 |
else { $input['ffmpeg_exists'] = $options['ffmpeg_exists']; }
|
2409 |
|
|
|
|
|
2410 |
if ( empty($input['width']) ) {
|
2411 |
-
add_settings_error( __FILE__, "width-zero", "You must enter a value for the maximum video width.");
|
2412 |
$input['width'] = $options['width'];
|
2413 |
}
|
2414 |
if ( empty($input['height']) ) {
|
2415 |
-
add_settings_error( __FILE__, "height-zero", "You must enter a value for the maximum video height.");
|
2416 |
$input['height'] = $options['height'];
|
2417 |
}
|
2418 |
if ( empty($input['gallery_width']) ) {
|
2419 |
-
add_settings_error( __FILE__, "gallery-width-zero", "You must enter a value for the maximum gallery video width.");
|
2420 |
$input['gallery_width'] = $options['gallery_width'];
|
2421 |
}
|
2422 |
if ( empty($input['gallery_height']) ) {
|
2423 |
-
add_settings_error( __FILE__, "gallery-height-zero", "You must enter a value for the maximum gallery video height.");
|
2424 |
$input['gallery_height'] = $options['gallery_height'];
|
2425 |
}
|
2426 |
|
@@ -2428,6 +3250,29 @@ function kgvid_video_embed_options_validate($input) { //validate & sanitize inpu
|
|
2428 |
|
2429 |
$input['titlecode'] = wp_kses_post( $input['titlecode'] );
|
2430 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2431 |
// load all settings and make sure they get a value of false if they weren't entered into the form
|
2432 |
foreach ( $default_options as $key => $value ) {
|
2433 |
if ( !array_key_exists($key, $input) ) { $input[$key] = false; }
|
@@ -2445,23 +3290,43 @@ function kgvid_ajax_save_settings() {
|
|
2445 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
2446 |
|
2447 |
if ( current_user_can('manage_options') ) {
|
|
|
2448 |
$setting = $_POST['setting'];
|
2449 |
$value = $_POST['value'];
|
2450 |
parse_str($_POST['all_settings'], $all_settings);
|
2451 |
$error_message = "";
|
2452 |
-
|
|
|
2453 |
global $wp_settings_errors;
|
2454 |
-
|
2455 |
-
|
2456 |
-
|
2457 |
-
|
2458 |
-
|
2459 |
-
|
2460 |
-
$
|
2461 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2462 |
}
|
2463 |
-
|
2464 |
-
|
|
|
|
|
|
|
|
|
2465 |
echo json_encode($arr);
|
2466 |
die();
|
2467 |
}
|
@@ -2470,7 +3335,7 @@ add_action('wp_ajax_kgvid_save_settings', 'kgvid_ajax_save_settings');
|
|
2470 |
|
2471 |
function kgvid_add_attachment_handler($post_id) {
|
2472 |
|
2473 |
-
$options =
|
2474 |
|
2475 |
if ( $options['auto_encode'] == "on" || $options['auto_thumb'] == "on" ) {
|
2476 |
$post = get_post($post_id);
|
@@ -2485,53 +3350,95 @@ add_action('add_attachment', 'kgvid_add_attachment_handler');
|
|
2485 |
|
2486 |
function kgvid_cron_new_attachment_handler($post_id) {
|
2487 |
|
2488 |
-
$options =
|
2489 |
$post = get_post($post_id);
|
2490 |
$movieurl = wp_get_attachment_url($post_id);
|
2491 |
|
2492 |
if ( $options['auto_thumb'] == "on" ) {
|
2493 |
|
2494 |
-
|
2495 |
-
|
2496 |
-
|
2497 |
-
|
2498 |
-
|
2499 |
-
|
2500 |
-
|
2501 |
-
|
2502 |
-
|
2503 |
-
|
2504 |
-
|
2505 |
-
|
2506 |
-
|
2507 |
-
|
2508 |
-
|
2509 |
-
|
2510 |
-
|
2511 |
-
|
2512 |
-
|
2513 |
-
|
2514 |
-
|
2515 |
-
|
2516 |
-
|
2517 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2518 |
break;
|
2519 |
-
|
2520 |
|
2521 |
-
|
2522 |
|
2523 |
-
if ( $
|
2524 |
-
|
2525 |
-
update_post_meta($post_id, '_kgflashmediaplayer-poster', $
|
2526 |
-
|
2527 |
-
|
2528 |
-
|
|
|
|
|
2529 |
|
2530 |
-
if( $options['featured'] == "on" ) {
|
2531 |
-
if ( !empty($thumb_id) && $post->post_parent ) { set_post_thumbnail($post->post_parent, $thumb_id); }
|
2532 |
-
}
|
2533 |
|
2534 |
-
}
|
2535 |
|
2536 |
if ( $options['auto_encode'] == "on" ) {
|
2537 |
$video_formats = kgvid_video_formats();
|
@@ -2555,13 +3462,15 @@ add_action('kgvid_cron_new_attachment', 'kgvid_cron_new_attachment_handler');
|
|
2555 |
*/
|
2556 |
function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
2557 |
|
2558 |
-
$options =
|
2559 |
|
2560 |
-
if ( substr($post->post_mime_type, 0, 5) == 'video'
|
2561 |
-
|
2562 |
) { //if the attachment is a video with no parent or if it has a parent the parent is not a video and the video doesn't have the externalurl post meta
|
2563 |
|
2564 |
wp_enqueue_media(); //allows using the media modal in the Media Library
|
|
|
|
|
2565 |
|
2566 |
$field_id = kgvid_backwards_compatible($post->ID);
|
2567 |
$movieurl = wp_get_attachment_url($post->ID);
|
@@ -2571,7 +3480,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
2571 |
$video_meta = array();
|
2572 |
$video_aspect = NULL;
|
2573 |
$video_meta = get_post_meta( $post->ID, '_wp_attachment_metadata', true);
|
2574 |
-
if ( $video_meta && array_key_exists('width', $video_meta) && array_key_exists('height', $video_meta) ) { $video_aspect = $video_meta['height']/$video_meta['width']; }
|
2575 |
elseif ( $widthsaved && $heightsaved ) { $video_aspect = intval($heightsaved)/intval($widthsaved); }
|
2576 |
|
2577 |
$form_fields["kgflashmediaplayer-url"]["input"] = "hidden";
|
@@ -2582,7 +3491,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
2582 |
if ( $widthsaved ) { $widthset = $widthsaved; }
|
2583 |
elseif ( $options['minimum_width'] == "on" ) { $widthset = $maxwidth; }
|
2584 |
else {
|
2585 |
-
if ( $video_meta && array_key_exists('width', $video_meta) ) { $widthset = $video_meta['width']; }
|
2586 |
else { $widthset = $maxwidth; }
|
2587 |
}
|
2588 |
if ( !$widthsaved ) { update_post_meta($post->ID, '_kgflashmediaplayer-width', $widthset); }
|
@@ -2598,7 +3507,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
2598 |
}
|
2599 |
elseif ( $video_aspect ) { $heightset = round($widthset*$video_aspect); }
|
2600 |
else {
|
2601 |
-
if ( $video_meta && array_key_exists('height', $video_meta) ) { $heightset = $video_meta['height']; }
|
2602 |
else { $heightset = $maxheight; }
|
2603 |
}
|
2604 |
if ( !$heightsaved ) { update_post_meta($post->ID, '_kgflashmediaplayer-height', $heightset); }
|
@@ -2620,9 +3529,9 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
2620 |
$starts = intval(get_post_meta($post->ID, "_kgflashmediaplayer-starts", true));
|
2621 |
$completeviews = intval(get_post_meta($post->ID, "_kgflashmediaplayer-completeviews", true));
|
2622 |
|
2623 |
-
$form_fields["views"]["label"] = __("Video Stats");
|
2624 |
$form_fields["views"]["input"] = "html";
|
2625 |
-
$form_fields["views"]["html"] = $
|
2626 |
|
2627 |
// ** Thumbnail section **//
|
2628 |
|
@@ -2648,7 +3557,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
2648 |
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
|
2649 |
kgvid_check_ffmpeg_exists($options, true);
|
2650 |
}
|
2651 |
-
if ( $options['ffmpeg_exists'] == "notinstalled" ) { $ffmpeg_disabled_text = 'disabled="disabled" title="'.strtoupper($
|
2652 |
else { $ffmpeg_disabled_text = ""; }
|
2653 |
|
2654 |
$randomizechecked = get_post_meta($post->ID, "_kgflashmediaplayer-randomize", true);
|
@@ -2723,70 +3632,101 @@ display: inline-block;">Loading thumbnail...</span></div>';
|
|
2723 |
}
|
2724 |
$generate_content = '<div id="generate-thumb-'.$post->ID.'-container" class="kgvid-tabs-content">
|
2725 |
<input id="attachments-'. $post->ID .'-numberofthumbs" name="attachments['.$post->ID.'][kgflashmediaplayer-numberofthumbs]" type="text" value="'.$numberofthumbs_value.'" maxlength="2" style="width:35px;text-align:center;" onchange="kgvid_disable_thumb_buttons(\''.$post->ID.'\', \'onchange\');document.getElementById(\''.$field_id['thumbtime'].'\').value =\'\';" '.$ffmpeg_disabled_text.'/>
|
2726 |
-
<input type="button" id="attachments-'. $post->ID .'-thumbgenerate" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kgvid_generate_thumb('. $post->ID .', \'generate\');" '.$ffmpeg_disabled_text.'/>
|
2727 |
-
<input type="button" id="attachments-'. $post->ID .'-thumbrandomize" class="button-secondary" value="Randomize" name="thumbrandomize" onclick="kgvid_generate_thumb('. $post->ID .', \'random\');" '.$ffmpeg_disabled_text.'/>
|
2728 |
-
<span style="white-space:nowrap;"><input type="checkbox" id="attachments-'. $post->ID .'-firstframe" name="attachments['.$post->ID.'][kgflashmediaplayer-forcefirst]" onchange="document.getElementById(\''.$field_id['thumbtime'].'\').value =\'\';" value="checked" '.$forcefirstchecked.' '.$ffmpeg_disabled_text.'/> <label for="attachments-'. $post->ID .'-firstframe">Force 1st frame thumbnail</label></span></div>';
|
2729 |
|
2730 |
$thumbnail_timecode = 'Thumbnail timecode: <input name="attachments['. $post->ID .'][thumbtime]" id="attachments-'. $post->ID .'-thumbtime" type="text" value="'.get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true).'" style="width:60px;"><br>';
|
2731 |
|
2732 |
}
|
2733 |
|
2734 |
-
$form_fields["generator"]["label"] =
|
2735 |
$form_fields["generator"]["input"] = "html";
|
2736 |
$form_fields["generator"]["html"] = '<input type="hidden" name="attachments['.$post->ID.'][kgflashmediaplayer-security]" id="attachments-'.$post->ID.'-kgflashmediaplayer-security" value="'.$nonce.'" />
|
2737 |
'.$choose_from_video_content.'
|
2738 |
'.$generate_content.'
|
2739 |
'.$thumbnail_timecode.'
|
2740 |
<div id="attachments-'.$post->ID.'-thumbnailplaceholder">'. $thumbnail_html .'</div>
|
2741 |
-
<span id="pick-thumbnail" class="button-secondary" style="margin:10px 0;" data-choose="Choose a Thumbnail" data-update="Set as video thumbnail" data-change="attachments-'. $post->ID .'-kgflashmediaplayer-poster" onclick="kgvid_pick_image(this);">Choose from Library</span><br />
|
2742 |
-
<input type="checkbox" id="attachments-'. $post->ID .'-featured" name="attachments['.$post->ID.'][kgflashmediaplayer-featured]" '.$featuredchecked.' '.$ffmpeg_disabled_text.'/> <label for="attachments-'. $post->ID .'-featured">Set thumbnail as featured image</label>'.$update_script;
|
2743 |
|
2744 |
-
$form_fields["kgflashmediaplayer-poster"]["label"] = __("Thumbnail URL");
|
2745 |
$form_fields["kgflashmediaplayer-poster"]["value"] = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
|
2746 |
-
$form_fields["kgflashmediaplayer-poster"]["helps"] = "<small>Leave blank to use <a href='options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php' target='_blank'>
|
2747 |
|
2748 |
$lockaspectchecked = get_post_meta($post->ID, "_kgflashmediaplayer-lockaspect", true);
|
2749 |
if ( $lockaspectchecked == "notchecked" ) { $lockaspectchecked = ""; }
|
2750 |
else { $lockaspectchecked = "checked"; }
|
2751 |
|
2752 |
-
$form_fields["kgflashmediaplayer-dimensions"]["label"] = __("Video Embed Dimensions");
|
2753 |
$form_fields["kgflashmediaplayer-dimensions"]["input"] = "html";
|
2754 |
-
$form_fields["kgflashmediaplayer-dimensions"]["html"] = 'Width: <input name="attachments['. $post->ID .'][kgflashmediaplayer-width]" id="attachments-'. $post->ID .'-kgflashmediaplayer-width" type="text" value="'.$widthset.'" style="width:50px;" data-minimum="'.$options['minimum_width'].'" onchange="kgvid_set_dimension('.$post->ID.', \'height\', this.value);" onkeyup="kgvid_set_dimension('.$post->ID.', \'height\', this.value);"> Height:
|
2755 |
<input name="attachments['. $post->ID .'][kgflashmediaplayer-height]" id="attachments-'. $post->ID .'-kgflashmediaplayer-height" type="text" value="'.$heightset.'" style="width:50px;" onchange="kgvid_set_dimension('.$post->ID.', \'width\', this.value);" onkeyup="kgvid_set_dimension('.$post->ID.', \'width\', this.value);"> <br />
|
2756 |
<input type="checkbox" name="attachments['. $post->ID .'][kgflashmediaplayer-lockaspect]" id="attachments-'. $post->ID .'-kgflashmediaplayer-lockaspect" onclick="kgvid_set_aspect('.$post->ID.', this.checked);" value="checked" '.$lockaspectchecked.'>
|
2757 |
-
<label for="attachments-'. $post->ID .'-kgflashmediaplayer-lockaspect"><small>Lock to aspect ratio</small></label>';
|
2758 |
-
$form_fields["kgflashmediaplayer-dimensions"]["helps"] = "<small>Leave blank to use <a href='options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php' target='_blank'>
|
2759 |
|
2760 |
|
2761 |
$checkboxes = kgvid_generate_encode_checkboxes($movieurl, $post->ID, "attachment");
|
2762 |
|
2763 |
-
$form_fields["kgflashmediaplayer-encode"]["label"] = __("Additional Formats");
|
2764 |
$form_fields["kgflashmediaplayer-encode"]["input"] = "html";
|
2765 |
-
$form_fields["kgflashmediaplayer-encode"]["html"] = $checkboxes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2766 |
|
2767 |
|
2768 |
$showtitlechecked = get_post_meta($post->ID, "_kgflashmediaplayer-showtitle", true);
|
2769 |
if ( $showtitlechecked == "notchecked" ) { $showtitlechecked = ""; }
|
2770 |
$downloadlinkchecked = get_post_meta($post->ID, "_kgflashmediaplayer-downloadlink", true);
|
|
|
|
|
2771 |
if ( $downloadlinkchecked == "notchecked" ) { $downloadlinkchecked = ""; }
|
2772 |
$embed_option = get_post_meta($post->ID, "_kgflashmediaplayer-embed", true);
|
2773 |
|
2774 |
-
$items = array("Single Video", "Video Gallery", "WordPress Default");
|
2775 |
$shortcode_select = '<select name="attachments['.$post->ID.'][kgflashmediaplayer-embed]" id="attachments['.$post->ID.'][kgflashmediaplayer-embed]">';
|
2776 |
-
foreach($items as $
|
2777 |
-
$selected = ($embed_option==$
|
2778 |
-
$shortcode_select .= "<option value='$
|
2779 |
}
|
2780 |
$shortcode_select .= "</select>";
|
2781 |
|
2782 |
-
$form_fields["kgflashmediaplayer-options"]["label"] = __("Video Embed Options");
|
2783 |
$form_fields["kgflashmediaplayer-options"]["input"] = "html";
|
2784 |
$form_fields["kgflashmediaplayer-options"]["html"] = '<input type="checkbox" name="attachments['.$post->ID.'][kgflashmediaplayer-showtitle]" id="attachments-'.$post->ID.'-kgflashmediaplayer-showtitle" value="checked" '.$showtitlechecked.'>
|
2785 |
-
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-showtitle">Insert title above video</label><br />
|
2786 |
-
|
2787 |
<input type="checkbox" name="attachments['.$post->ID.'][kgflashmediaplayer-downloadlink]" id="attachments-'.$post->ID.'-kgflashmediaplayer-downloadlink" value="checked" '.$downloadlinkchecked.'>
|
2788 |
-
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-downloadlink">Insert download link below video<em><small><br />Makes it easier for users to download file
|
2789 |
-
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-embed">Insert</label>
|
2790 |
'.$shortcode_select.'
|
2791 |
<script type="text/javascript">jQuery(document).ready(function(){kgvid_hide_standard_wordpress_display_settings('.$post->ID.');});</script>';
|
2792 |
|
@@ -2819,14 +3759,14 @@ display: inline-block;">Loading thumbnail...</span></div>';
|
|
2819 |
}
|
2820 |
$gallery_order_select .= "</select>";
|
2821 |
|
2822 |
-
$form_fields["kgflashmediaplayer-gallery"]["label"] = __("Gallery Settings (all optional)");
|
2823 |
$form_fields["kgflashmediaplayer-gallery"]["input"] = "html";
|
2824 |
-
$form_fields["kgflashmediaplayer-gallery"]["html"] = '<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_thumb_width]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_thumb_width" type ="text" value="'.$gallery_thumb_width.'"
|
2825 |
-
'.$gallery_orderby_select.' Order By<br />
|
2826 |
-
'.$gallery_order_select.' Sort Order<br />
|
2827 |
-
<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_exclude]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_exclude" type ="text" value="'.$gallery_exclude.'"
|
2828 |
-
<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_include]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_include" type ="text" value="'.$gallery_include.'"
|
2829 |
-
<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_id]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_id" type ="text" value="'.$gallery_id.'"
|
2830 |
';
|
2831 |
|
2832 |
}//if video gallery
|
@@ -2864,7 +3804,9 @@ function kgvid_change_video_icon($icon, $mime, $post_id) {
|
|
2864 |
$post = get_post($post_id);
|
2865 |
|
2866 |
if ( substr($mime, 0, 5) == 'video' ) {
|
2867 |
-
|
|
|
|
|
2868 |
$post_id = $post->post_parent; //use post parent if this is a child video or encoded from an external url
|
2869 |
}
|
2870 |
$poster_id = get_post_meta($post_id, '_kgflashmediaplayer-poster-id', true);
|
@@ -2968,7 +3910,7 @@ function kgvid_save_thumb($post_id, $post_name, $thumb_url, $index=false) {
|
|
2968 |
|
2969 |
global $user_ID;
|
2970 |
|
2971 |
-
$options =
|
2972 |
$uploads = wp_upload_dir();
|
2973 |
|
2974 |
$posterfile = pathinfo($thumb_url, PATHINFO_BASENAME);
|
@@ -3002,7 +3944,7 @@ function kgvid_save_thumb($post_id, $post_name, $thumb_url, $index=false) {
|
|
3002 |
|
3003 |
elseif ( $success ) { //no existing post with this filename
|
3004 |
|
3005 |
-
$desc = $post_name . ' thumbnail';
|
3006 |
if ( $index ) { $desc .= ' '.$index; }
|
3007 |
|
3008 |
//is image in uploads directory?
|
@@ -3018,6 +3960,15 @@ function kgvid_save_thumb($post_id, $post_name, $thumb_url, $index=false) {
|
|
3018 |
$filename = preg_replace('/\.[^.]+$/', '', basename($thumb_url));
|
3019 |
if ( $user_ID == 0 ) { $user_ID = $video->post_author; }
|
3020 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3021 |
$attachment = array(
|
3022 |
'guid' => $thumb_url,
|
3023 |
'post_mime_type' => $wp_filetype['type'],
|
@@ -3028,8 +3979,8 @@ function kgvid_save_thumb($post_id, $post_name, $thumb_url, $index=false) {
|
|
3028 |
);
|
3029 |
|
3030 |
$thumb_id = wp_insert_attachment( $attachment, $uploads['path'].'/'.$posterfile, $post_id );
|
3031 |
-
//
|
3032 |
-
//
|
3033 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
3034 |
$attach_data = wp_generate_attachment_metadata( $thumb_id, $uploads['path'].'/'.$posterfile );
|
3035 |
wp_update_attachment_metadata( $thumb_id, $attach_data );
|
@@ -3070,9 +4021,10 @@ function kgvid_save_thumb($post_id, $post_name, $thumb_url, $index=false) {
|
|
3070 |
|
3071 |
}//end else no existing db entry
|
3072 |
|
3073 |
-
if(!is_wp_error($thumb_id)) {
|
3074 |
|
3075 |
return $thumb_id;
|
|
|
3076 |
}
|
3077 |
|
3078 |
}
|
@@ -3085,10 +4037,11 @@ function kgvid_ajax_redraw_thumbnail_box() {
|
|
3085 |
$poster_id = get_post_meta($post_id, "_kgflashmediaplayer-poster-id", true);
|
3086 |
$thumbnail_size_url = "";
|
3087 |
if ( $poster_id ) {
|
3088 |
-
$
|
|
|
3089 |
}
|
3090 |
$response['thumb_url'] = get_post_meta($post_id, "_kgflashmediaplayer-poster", true);
|
3091 |
-
$response['thumbnail_size_url'] = $thumbnail_size_url
|
3092 |
$response['thumb_error'] = get_post_meta($post_id, "_kgflashmediaplayer-autothumb-error", true);
|
3093 |
echo json_encode($response);
|
3094 |
die();
|
@@ -3134,7 +4087,7 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
|
|
3134 |
if ( isset($_POST['action']) && $_POST['action'] == 'save-attachment-compat' && isset($_POST['post_id']) ) { //if this is in the media modal
|
3135 |
$post_parent = $_POST['post_id'];
|
3136 |
}
|
3137 |
-
elseif ( array_key_exists('post_parent', $post) ) {
|
3138 |
$post_parent = $post['post_parent'];
|
3139 |
}
|
3140 |
|
@@ -3159,6 +4112,9 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
|
|
3159 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-encode'.$format, "false"); }
|
3160 |
}
|
3161 |
|
|
|
|
|
|
|
3162 |
if( isset($attachment['kgflashmediaplayer-showtitle']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', $attachment['kgflashmediaplayer-showtitle']); }
|
3163 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', "notchecked"); }
|
3164 |
|
@@ -3194,7 +4150,7 @@ class kgInsertMedia {
|
|
3194 |
//function that does the modifying
|
3195 |
function kgmodifyMediaInsert($html, $attachment_id, $attachment) {
|
3196 |
|
3197 |
-
$options =
|
3198 |
$output = $html;
|
3199 |
$attachment['embed'] = get_post_meta($attachment_id, "_kgflashmediaplayer-embed", true);
|
3200 |
|
@@ -3253,18 +4209,18 @@ class kgInsertMedia {
|
|
3253 |
$kgIM = new kgInsertMedia();
|
3254 |
|
3255 |
function kgvid_embedurl_menu($tabs) {
|
3256 |
-
$newtab = array('embedurl' =>
|
3257 |
return array_merge($tabs, $newtab);
|
3258 |
}
|
3259 |
add_filter('media_upload_tabs', 'kgvid_embedurl_menu');
|
3260 |
|
3261 |
-
function
|
3262 |
|
3263 |
-
$options =
|
3264 |
|
3265 |
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
|
3266 |
kgvid_check_ffmpeg_exists($options, true);
|
3267 |
-
$options =
|
3268 |
}
|
3269 |
|
3270 |
$video_formats = kgvid_video_formats();
|
@@ -3282,53 +4238,53 @@ function media_embedurl_process() {
|
|
3282 |
<table id="kgflashmediaplayer-table" class="describe">
|
3283 |
<tbody>
|
3284 |
<tr>
|
3285 |
-
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="videotitle"
|
3286 |
<td class="field"><input type="text" id="videotitle" name="videotitle" value="" size="50" />
|
3287 |
-
<p class="help"><small
|
3288 |
</tr>
|
3289 |
<tr>
|
3290 |
<th valign="top" scope="row" class="label"><label for="attachments-singleurl-kgflashmediaplayer-url">Video URL</label></th>
|
3291 |
<td class="field"><input type="text" id="attachments-singleurl-kgflashmediaplayer-url" name="attachments[singleurl][kgflashmediaplayer-url]" value="" size="50" onchange="kgvid_set_singleurl();"/>
|
3292 |
-
<p class="help"><small
|
3293 |
</tr>
|
3294 |
<?php if ( current_user_can('make_video_thumbnails') ) { ?>
|
3295 |
<tr>
|
3296 |
-
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="numberofthumbs"
|
3297 |
<td class="field">
|
3298 |
-
<input id="attachments-singleurl-numberofthumbs" type="text" value="<?php echo $options['generate_thumbs']; ?>" maxlength="2" size="4" style="width:35px;text-align:center;" title="Number of Thumbnails" onchange="document.getElementById('attachments-singleurl-thumbtime').value='';" />
|
3299 |
-
<input type="button" id="attachments-singleurl-thumbgenerate" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kgvid_generate_thumb('singleurl', 'generate');" disabled title="Please enter a valid video URL" />
|
3300 |
-
<input type="button" id="attachments-singleurl-thumbrandomize" class="button-secondary" value="Randomize" name="thumbrandomize" onclick="kgvid_generate_thumb('singleurl', 'random');" disabled title="Please enter a valid video URL" />
|
3301 |
-
<input type="checkbox" id="attachments-singleurl-firstframe" onchange="document.getElementById('attachments-singleurl-thumbtime').value ='';" /><label for="attachments-singleurl-firstframe"
|
3302 |
<div id="attachments-singleurl-thumbnailplaceholder"></div>
|
3303 |
-
<span
|
3304 |
-
<input type="checkbox" <?php echo checked( $options["featured"], "on", false ); ?> id="attachments-singleurl-featured" name="attachments[singleurl][kgflashmediaplayer-featured]" /> Set thumbnail as featured image
|
3305 |
</td>
|
3306 |
</tr>
|
3307 |
<?php } ?>
|
3308 |
<tr>
|
3309 |
-
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="attachments-singleurl_kgflashmediaplayer_poster"
|
3310 |
<td class="field"><input type="text" name="attachments[singleurl][kgflashmediaplayer-poster]" id="attachments-singleurl-kgflashmediaplayer-poster" value="" size="50" />
|
3311 |
-
<p class="help"><small
|
3312 |
</tr>
|
3313 |
<tr>
|
3314 |
-
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="attachments-singleurl-kgflashmediaplayer-width"
|
3315 |
-
<td class="field"
|
3316 |
-
<p class="help"><small
|
3317 |
</tr>
|
3318 |
<?php if ( current_user_can('encode_videos') ) { ?>
|
3319 |
<tr>
|
3320 |
-
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="html5"
|
3321 |
-
<td><?php echo $checkboxes; ?></td>
|
3322 |
</tr>
|
3323 |
<?php } ?>
|
3324 |
<tr>
|
3325 |
<th valign="top" scope="row" class="label"><span class="alignleft"><label>Options</span></label></th>
|
3326 |
-
<td><input type="checkbox" name="downloadlink" id="downloadlink" value="true" class="field" /><label for="downloadlink"
|
3327 |
</tr>
|
3328 |
<tr class="submit">
|
3329 |
<td></td>
|
3330 |
<td>
|
3331 |
-
<input type="button" onclick="kgvid_insert_shortcode();" name="insertonlybutton" id="insertonlybutton" class="button" value="Insert into Post" disabled title="Please enter a valid video URL" />
|
3332 |
</td>
|
3333 |
</tr>
|
3334 |
</tbody></table>
|
@@ -3348,7 +4304,7 @@ function media_embedurl_process() {
|
|
3348 |
} //end media_embedurl_process
|
3349 |
|
3350 |
function kgvid_embedurl_handle() {
|
3351 |
-
return wp_iframe( '
|
3352 |
}
|
3353 |
add_action('media_upload_embedurl', 'kgvid_embedurl_handle');
|
3354 |
|
@@ -3362,15 +4318,15 @@ function kgvid_generate_attachment_shortcode($kgvid_video_embed) {
|
|
3362 |
|
3363 |
global $post;
|
3364 |
global $wp_query;
|
3365 |
-
$options =
|
3366 |
|
3367 |
-
if ( array_key_exists('sample', $kgvid_video_embed) ) { $url = plugins_url('/images/sample-video-h264.mp4', __FILE__); }
|
3368 |
else { $url = wp_get_attachment_url($post->ID); }
|
3369 |
|
3370 |
$poster = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
|
3371 |
$downloadlink = get_post_meta($post->ID, '_kgflashmediaplayer-downloadlink', true);
|
3372 |
|
3373 |
-
if ( array_key_exists('gallery', $kgvid_video_embed) ) { $gallery = true; }
|
3374 |
else { $gallery = false; }
|
3375 |
|
3376 |
$dimensions = kgvid_set_video_dimensions($post->ID, $gallery);
|
@@ -3380,11 +4336,12 @@ function kgvid_generate_attachment_shortcode($kgvid_video_embed) {
|
|
3380 |
if ( !empty($dimensions['width']) ) { $shortcode .= ' width="'.$dimensions['width'].'"'; }
|
3381 |
if ( !empty($dimensions['height']) ) { $shortcode .= ' height="'.$dimensions['height'].'"'; }
|
3382 |
if ( $downloadlink == "checked" ) { $shortcode .= ' downloadlink="true"'; }
|
3383 |
-
if (array_key_exists('gallery', $kgvid_video_embed)) { $shortcode .= ' autoplay="true"'; }
|
3384 |
-
if (array_key_exists('sample', $kgvid_video_embed)) {
|
3385 |
-
if ( $options['overlay_title'] == "on" ) { $shortcode .= ' title="Sample Video"'; }
|
3386 |
-
if ( $options['overlay_embedcode'] == "on" ) { $shortcode .= ' embedcode="Sample Embed Code"'; }
|
3387 |
-
$shortcode .= ' caption="
|
|
|
3388 |
}
|
3389 |
//else { $shortcode .= ' view_count="false"'; }
|
3390 |
$shortcode .= ']'.$url.'[/KGVID]';
|
@@ -3396,7 +4353,7 @@ function kgvid_generate_attachment_shortcode($kgvid_video_embed) {
|
|
3396 |
function kgvid_filter_video_attachment_content($content) {
|
3397 |
|
3398 |
global $post;
|
3399 |
-
$options =
|
3400 |
|
3401 |
if ( $options['template'] == "gentle" && strpos($post->post_mime_type, "video") !== false ) {
|
3402 |
$kgvid_video_embed = array(); //no query set
|
@@ -3413,7 +4370,7 @@ function kgvid_video_attachment_template() {
|
|
3413 |
global $wp_query;
|
3414 |
global $content_width;
|
3415 |
|
3416 |
-
$options =
|
3417 |
|
3418 |
$kgvid_video_embed = array ( 'enable' => 'false' ); //turned off by default
|
3419 |
if ( isset($wp_query->query_vars['kgvid_video_embed']) ) { $kgvid_video_embed = $wp_query->query_vars['kgvid_video_embed']; }
|
@@ -3505,7 +4462,7 @@ function kgvid_schedule_cleanup_generated_files($arg) { //schedules deleting all
|
|
3505 |
|
3506 |
function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser, $thumbtimecode, $dofirstframe, $generate_button) {
|
3507 |
|
3508 |
-
$options =
|
3509 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
3510 |
$uploads = wp_upload_dir();
|
3511 |
|
@@ -3609,7 +4566,7 @@ function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser,
|
|
3609 |
}//if ffmpeg can open movie
|
3610 |
|
3611 |
else {
|
3612 |
-
$thumbnaildisplaycode = "<strong>Can't open movie file
|
3613 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
3614 |
return $arr;
|
3615 |
} //can't open movie
|
@@ -3618,7 +4575,7 @@ function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser,
|
|
3618 |
|
3619 |
function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id) {
|
3620 |
|
3621 |
-
$options =
|
3622 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
3623 |
$uploads = wp_upload_dir();
|
3624 |
|
@@ -3670,11 +4627,13 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id) {
|
|
3670 |
$encode_formats[$format]['status'] = "notchecked";
|
3671 |
update_post_meta($postID, '_kgflashmediaplayer-encode'.$format, 'notchecked');
|
3672 |
}
|
3673 |
-
}
|
3674 |
|
3675 |
-
if ( !empty($encode_list) ) {
|
3676 |
-
|
|
|
3677 |
if ( empty($parent_id) ) { $parent_id = get_post($postID)->post_parent; }
|
|
|
3678 |
$queue_entry = array (
|
3679 |
'attachmentID'=>$postID,
|
3680 |
'parent_id'=>$parent_id,
|
@@ -3682,36 +4641,61 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id) {
|
|
3682 |
'encode_formats'=> $encode_formats,
|
3683 |
'movie_info' => $movie_info
|
3684 |
);
|
|
|
|
|
|
|
|
|
3685 |
$already_queued = false;
|
3686 |
-
if ( !empty($
|
3687 |
-
foreach ($
|
3688 |
if ( $entry['movieurl'] == $movieurl ) {
|
3689 |
$already_queued = $index;
|
3690 |
foreach ( $entry['encode_formats'] as $format => $value ) {
|
3691 |
-
|
3692 |
-
if ( $value['status'] == "
|
3693 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3694 |
}
|
3695 |
-
|
3696 |
-
|
3697 |
-
|
|
|
|
|
|
|
3698 |
|
3699 |
if ( $already_queued !== false ) {
|
3700 |
-
$
|
3701 |
-
|
3702 |
-
|
3703 |
-
|
|
|
3704 |
}
|
3705 |
else {
|
3706 |
-
$
|
3707 |
-
|
3708 |
-
$queue_position = intval(key( array_slice( $
|
3709 |
-
|
3710 |
-
|
|
|
3711 |
}
|
3712 |
}
|
3713 |
} //if any video formats don't already exist, add to queue
|
3714 |
-
else { $embed_display = "<strong>Nothing to encode
|
3715 |
|
3716 |
$replaceoptions = "";
|
3717 |
$originalselect = "";
|
@@ -3720,7 +4704,7 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id) {
|
|
3720 |
return $arr;
|
3721 |
}
|
3722 |
else {
|
3723 |
-
$thumbnaildisplaycode = "<strong>Can't open movie file
|
3724 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
3725 |
return $arr;
|
3726 |
} //can't open movie
|
@@ -3739,9 +4723,8 @@ function kgivd_save_singleurl_poster($parent_id, $poster, $movieurl, $set_featur
|
|
3739 |
function kgvid_callffmpeg() {
|
3740 |
|
3741 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
3742 |
-
global $wpdb;
|
3743 |
|
3744 |
-
$options =
|
3745 |
|
3746 |
if (isset($_POST['attachmentID'])) { $postID = $_POST['attachmentID']; }
|
3747 |
if (isset($_POST['movieurl'])) { $movieurl = $_POST['movieurl']; }
|
@@ -3774,7 +4757,7 @@ function kgvid_callffmpeg() {
|
|
3774 |
if ( $action == "submit" && current_user_can('make_video_thumbnails') ) { kgivd_save_singleurl_poster($parent_id, $poster, $movieurl, $set_featured); }
|
3775 |
}
|
3776 |
else {
|
3777 |
-
$thumbnaildisplaycode = '<strong>
|
3778 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
3779 |
echo json_encode($arr);
|
3780 |
}//no ffmpeg
|
@@ -3784,188 +4767,180 @@ add_action('wp_ajax_kgvid_callffmpeg', 'kgvid_callffmpeg');
|
|
3784 |
|
3785 |
function kgvid_encode_videos() {
|
3786 |
|
|
|
|
|
3787 |
$embed_display = "";
|
3788 |
-
$video =
|
3789 |
$video_key = "";
|
3790 |
$queued_format = "";
|
3791 |
-
$encoding =
|
|
|
|
|
3792 |
$uploads = wp_upload_dir();
|
3793 |
$movie_info = array("width"=>"", "height"=>"");
|
3794 |
-
$
|
3795 |
$video_formats = kgvid_video_formats();
|
3796 |
|
3797 |
-
if ( !empty($
|
3798 |
|
3799 |
-
$
|
3800 |
|
3801 |
-
foreach ( $
|
3802 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
3803 |
if ( $value['status'] == "encoding" ) {
|
3804 |
-
$video[] = $
|
3805 |
-
$encoding[] = $value;
|
3806 |
-
$
|
3807 |
-
if (
|
3808 |
}
|
3809 |
}
|
3810 |
}
|
3811 |
|
3812 |
-
if (
|
3813 |
-
|
|
|
3814 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
3815 |
if ( $value['status'] == "queued" ) {
|
3816 |
-
$
|
3817 |
-
$
|
3818 |
-
break 2;
|
3819 |
}
|
3820 |
}
|
3821 |
}
|
3822 |
}
|
3823 |
|
3824 |
-
if ( !empty($
|
3825 |
|
3826 |
-
$
|
3827 |
|
3828 |
-
|
3829 |
-
|
3830 |
-
else {
|
3831 |
-
$moviefilepath = str_replace(" ", "%20", esc_url_raw($video['movieurl']));
|
3832 |
-
$moviefilepath = str_replace("https://", "http://", $moviefilepath);
|
3833 |
-
}
|
3834 |
|
3835 |
-
|
3836 |
-
|
|
|
|
|
|
|
|
|
3837 |
|
3838 |
-
|
3839 |
-
|
3840 |
-
$serverOS = "";
|
3841 |
-
$ffmpeg_options = "";
|
3842 |
|
3843 |
-
|
3844 |
-
$
|
3845 |
-
$
|
3846 |
-
$
|
3847 |
-
}
|
3848 |
|
3849 |
-
|
3850 |
-
|
3851 |
-
|
3852 |
-
|
3853 |
-
|
3854 |
|
3855 |
-
|
3856 |
-
|
3857 |
-
|
3858 |
-
|
3859 |
-
|
3860 |
|
3861 |
-
|
3862 |
-
|
3863 |
-
|
|
|
|
|
3864 |
|
3865 |
-
|
|
|
|
|
3866 |
|
3867 |
-
if (
|
3868 |
-
else { $h264_movie_width = $movie_info['width']; }
|
3869 |
-
$h264_movie_height = strval(round(floatval($movie_info['height']) / floatval($movie_info['width']) * $h264_movie_width));
|
3870 |
-
if ( intval($h264_movie_height) > $format_stats['height'] ) { $h264_movie_height = $format_stats['height']; }
|
3871 |
-
$h264_movie_width = strval(round(floatval($movie_info['width']) / floatval($movie_info['height']) * $h264_movie_height));
|
3872 |
|
3873 |
-
|
3874 |
-
if ($h264_movie_width % 2 != 0) { $h264_movie_width--; } //if it's odd, decrease by 1 to make sure it's an even number
|
3875 |
|
3876 |
-
|
3877 |
|
3878 |
-
|
3879 |
-
|
3880 |
-
|
3881 |
-
|
3882 |
-
|
3883 |
-
|
3884 |
-
|
3885 |
-
|
3886 |
-
|
3887 |
-
|
3888 |
-
|
3889 |
-
|
|
|
|
|
|
|
|
|
3890 |
}
|
3891 |
-
|
3892 |
-
|
3893 |
-
|
3894 |
-
|
3895 |
-
|
3896 |
-
|
3897 |
-
|
3898 |
-
|
3899 |
-
|
3900 |
-
|
3901 |
-
|
3902 |
-
|
3903 |
-
|
3904 |
-
|
3905 |
-
|
3906 |
-
|
3907 |
-
|
3908 |
-
|
3909 |
-
|
3910 |
-
|
3911 |
-
$embed_display = "Missing libraries";
|
3912 |
-
}
|
3913 |
-
}//if file doesn't already exist
|
3914 |
-
else { $embed_display = $video_formats[$queued_format]['vcodec']." already encoded."; }
|
3915 |
-
}//if format is queued
|
3916 |
-
|
3917 |
-
if ( !empty($encode_string) ) {
|
3918 |
|
3919 |
-
|
3920 |
|
3921 |
-
|
3922 |
|
3923 |
-
|
3924 |
|
3925 |
-
|
3926 |
-
$arr = array ( "embed_display"=>"<span style='color:red;'>Error: Command 'escapeshellcmd' is disabled on your server.</span>" );
|
3927 |
-
return $arr;
|
3928 |
-
}
|
3929 |
-
$process = new kgvid_Process($cmd);
|
3930 |
|
3931 |
-
|
3932 |
|
3933 |
-
|
3934 |
-
|
|
|
|
|
|
|
3935 |
|
3936 |
-
|
3937 |
-
wp_schedule_single_event(time()+600, 'kgvid_cleanup_generated_logfiles', $args);
|
3938 |
-
if ( !wp_next_scheduled('kgvid_cleanup_queue', array ( 'scheduled' )) ) {
|
3939 |
-
wp_schedule_event( time()+86400, 'daily', 'kgvid_cleanup_queue', array ( 'scheduled' ) );
|
3940 |
-
}
|
3941 |
|
3942 |
-
|
3943 |
-
|
3944 |
-
'status' => 'encoding',
|
3945 |
-
'filepath' => $encodevideo_info[$queued_format.'filepath'],
|
3946 |
-
'url' => $encodevideo_info[$queued_format.'url'],
|
3947 |
-
'logfile' => $logfile,
|
3948 |
-
'PID' => $processPID,
|
3949 |
-
'OS' => $serverOS,
|
3950 |
-
'started' => time()
|
3951 |
-
);
|
3952 |
|
3953 |
-
|
3954 |
-
'
|
3955 |
-
'
|
3956 |
-
|
3957 |
-
|
3958 |
-
'movie_info' => $video['movie_info']
|
3959 |
-
);
|
3960 |
|
3961 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3962 |
|
3963 |
-
|
3964 |
|
3965 |
-
}
|
3966 |
|
3967 |
-
|
3968 |
-
kgvid_encode_progress($
|
3969 |
|
3970 |
} //if there's a format to encode
|
3971 |
|
@@ -3978,7 +4953,6 @@ function kgvid_encode_videos() {
|
|
3978 |
function kgvid_ajax_encode_videos() {
|
3979 |
|
3980 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
3981 |
-
global $wpdb;
|
3982 |
$arr = kgvid_encode_videos();
|
3983 |
echo json_encode($arr);
|
3984 |
die();
|
@@ -3989,27 +4963,37 @@ add_action('wp_ajax_kgvid_ajax_encode_videos', 'kgvid_ajax_encode_videos');
|
|
3989 |
function kgvid_test_ffmpeg() {
|
3990 |
|
3991 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
3992 |
-
$options =
|
3993 |
$uploads = wp_upload_dir();
|
|
|
|
|
3994 |
|
3995 |
-
$
|
3996 |
-
$cmd=escapeshellcmd(
|
3997 |
exec ( $cmd.' 2>&1', $output );
|
3998 |
-
$output = implode("\n", $output);
|
3999 |
-
|
4000 |
|
4001 |
-
|
4002 |
-
if ( file_exists($uploads['path']."/sample-video-h264-480p.mp4") ) {
|
4003 |
|
4004 |
if ( $options['moov'] == "qt-faststart" || $options['moov'] == "MP4Box" ) {
|
4005 |
-
$output .= kgvid_fix_moov_atom($uploads['path']."/sample-video-h264
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4006 |
}
|
4007 |
|
4008 |
-
unlink($uploads['path']."/sample-video-h264
|
4009 |
|
4010 |
}
|
4011 |
|
4012 |
-
echo $
|
4013 |
die;
|
4014 |
|
4015 |
}
|
@@ -4017,29 +5001,24 @@ add_action('wp_ajax_kgvid_test_ffmpeg', 'kgvid_test_ffmpeg');
|
|
4017 |
|
4018 |
function kgvid_encode_progress($video_key, $format, $page) {
|
4019 |
|
4020 |
-
$
|
4021 |
|
4022 |
-
if ( is_array($
|
4023 |
|
4024 |
-
$video_entry = $
|
4025 |
-
$script_function = 'kgvid_redraw_encode_checkboxes("'.$video_entry['movieurl'].'", "'.$video_entry['attachmentID'].'", "'.$page.'")';
|
4026 |
|
4027 |
-
if (
|
4028 |
-
|
4029 |
-
|
4030 |
-
|
4031 |
-
$embed_display .= '<script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
4032 |
-
$args = array($next_video['video_key'], $next_video['format'], $page);
|
4033 |
-
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
4034 |
-
}
|
4035 |
-
}
|
4036 |
|
4037 |
-
if ( array_key_exists('logfile', $
|
4038 |
|
4039 |
$pid = $video_entry['encode_formats'][$format]['PID'];
|
4040 |
$logfile = $video_entry['encode_formats'][$format]['logfile'];
|
4041 |
$started = $video_entry['encode_formats'][$format]['started'];
|
4042 |
$movie_duration = $video_entry['movie_info']['duration'];
|
|
|
4043 |
$embed_display = "";
|
4044 |
$percent_done = "";
|
4045 |
$time_remaining = "";
|
@@ -4078,14 +5057,11 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
4078 |
|
4079 |
preg_match('/time=(.*?) /', $lastline, $time_matches);
|
4080 |
|
4081 |
-
if ( array_key_exists(1, $time_matches) != true ) { //if something other than the regular FFMPEG encoding output check for these
|
4082 |
preg_match('/video:(.*?) /', $lastline, $video_matches);
|
4083 |
preg_match('/libx264 (.*?) /', $lastline, $libx264_matches);
|
4084 |
-
//preg_match('/h264 (.*?) /', $lastline, $h264_matches);
|
4085 |
-
//preg_match('/Press (.*?) /', $lastline, $Press_matches);
|
4086 |
-
//preg_match('/buffer (.*?) /', $lastline, $buffer_matches);
|
4087 |
}
|
4088 |
-
if ( array_key_exists(1, $time_matches) == true ) { //still encoding
|
4089 |
|
4090 |
if ( strpos($time_matches[1], ':') !== false ) {
|
4091 |
$current_hours = intval(substr($time_matches[1], -11, 2));
|
@@ -4104,7 +5080,7 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
4104 |
else { $percent_done_text = strval($percent_done)."%"; }
|
4105 |
|
4106 |
preg_match('/fps=\s+(.*?) /', $lastline, $fps_matches);
|
4107 |
-
if ( array_key_exists(1, $fps_matches) == true ) {
|
4108 |
if ( $fps_matches[1] != 0 ) { $fps_match = $fps_matches[1]; }
|
4109 |
else { $fps_match = "10"; }
|
4110 |
}
|
@@ -4117,31 +5093,36 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
4117 |
$args = array($video_key, $format, $page);
|
4118 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
4119 |
|
4120 |
-
$embed_display = '<strong>'.
|
4121 |
|
4122 |
if ( current_user_can('encode_videos') && $pid ) {
|
4123 |
-
$embed_display .= '<a href="javascript:void(0);" class="kgvid_cancel_button" id="attachments-'.$video_entry["attachmentID"].'-kgflashmediaplayer-cancelencode" onclick="kgvid_cancel_encode('.$pid.', \''.$video_entry["attachmentID"].'\', \''.$video_key.'\', \''.$format.'\');">Cancel</a>';
|
4124 |
}
|
4125 |
|
4126 |
-
$embed_display .= '<div style="display:block;"><small>Elapsed: '.date('H:i:s',$time_elapsed).'. Remaining: '.$time_remaining.'. FPS:'.$fps_match.'</small></div><script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, '.$time_to_wait.');</script>';
|
4127 |
}
|
4128 |
-
elseif ( time() - $started < 10 || time() - filemtime($
|
4129 |
$args = array($video_key, $format, $page);
|
4130 |
-
$embed_display = '<strong>Encoding</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
4131 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
4132 |
}
|
4133 |
-
elseif ( array_key_exists(1, $video_matches) == true || array_key_exists(1, $libx264_matches) == true ) { //encoding complete
|
|
|
|
|
|
|
4134 |
$percent_done = 100;
|
4135 |
$ended = filemtime($logfile);
|
4136 |
$time_elapsed = $ended - $started;
|
4137 |
$time_remaining = "0";
|
4138 |
$fps_match = "10";
|
4139 |
-
if ( array_key_exists(1, $libx264_matches) ) {
|
4140 |
-
|
4141 |
-
|
4142 |
-
$
|
|
|
|
|
4143 |
|
4144 |
-
|
4145 |
|
4146 |
if ( $format != "fullres" ) {
|
4147 |
|
@@ -4158,10 +5139,10 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
4158 |
|
4159 |
global $wpdb;
|
4160 |
global $user_ID;
|
4161 |
-
$query = "SELECT ID FROM
|
4162 |
$video_id = $wpdb->get_var($query);
|
4163 |
if ( !$video_id ) {
|
4164 |
-
$wp_filetype = wp_check_filetype(basename($
|
4165 |
$video_formats = kgvid_video_formats();
|
4166 |
$title .= " ".$video_formats[$format]['name'];
|
4167 |
|
@@ -4179,14 +5160,14 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
4179 |
'post_author' => $user_ID
|
4180 |
);
|
4181 |
|
4182 |
-
$new_id = wp_insert_attachment( $attachment, $
|
4183 |
// you must first include the image.php file
|
4184 |
// for the function wp_generate_attachment_metadata() to work and media.php for wp_read_video_metadata() in WP 3.6+
|
4185 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
4186 |
global $wp_version;
|
4187 |
if ( $wp_version >= 3.6 ) { require_once(ABSPATH . 'wp-admin/includes/media.php'); }
|
4188 |
require_once(ABSPATH . 'wp-admin/includes/media.php');
|
4189 |
-
$attach_data = wp_generate_attachment_metadata( $new_id, $
|
4190 |
wp_update_attachment_metadata( $new_id, $attach_data );
|
4191 |
update_post_meta( $new_id, '_kgflashmediaplayer-format', $format );
|
4192 |
if ( get_post_type($video_entry['attachmentID']) == false ) { update_post_meta( $new_id, '_kgflashmediaplayer-externalurl', $video_entry['movieurl'] ); } //connect new video to external url
|
@@ -4195,19 +5176,20 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
4195 |
|
4196 |
//finish inserting attachment
|
4197 |
|
4198 |
-
$embed_display = '<strong>Encoding Complete</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
|
|
4199 |
$next_video = kgvid_encode_videos(); //start the next queued video
|
4200 |
if ( !empty($next_video['format']) ) { //if there's something to encode, schedule cron
|
4201 |
$args = array($next_video['video_key'], $next_video['format'], $page);
|
4202 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
4203 |
}
|
4204 |
-
elseif ( $
|
4205 |
|
4206 |
$new_movie_url = kgvid_replace_video( $video_key, 'fullres' );
|
4207 |
$script_function = 'kgvid_redraw_encode_checkboxes("'.$new_movie_url.'", "'.$video_entry['attachmentID'].'", "'.$page.'")';
|
4208 |
|
4209 |
-
if ( $
|
4210 |
-
$
|
4211 |
delete_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-rotate');
|
4212 |
|
4213 |
$setwidth = $video_entry['movie_info']['width'];
|
@@ -4215,25 +5197,27 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
4215 |
if ( intval($setwidth) > intval($setheight) ) { //swap the width and height meta if it hasn't already been done
|
4216 |
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-actualwidth', $video_entry['movie_info']['height']);
|
4217 |
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-width', $setheight);
|
4218 |
-
$
|
4219 |
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-actualheight', $video_entry['movie_info']['width']);
|
4220 |
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-height', $setwidth);
|
4221 |
-
$
|
4222 |
}
|
4223 |
-
|
4224 |
}
|
4225 |
|
4226 |
$embed_display = '<strong>Encoding Complete</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
4227 |
|
4228 |
-
|
|
|
|
|
4229 |
|
4230 |
}
|
4231 |
else { //there was an unexpected output and the encoded file hasn't been modified in more than 10 seconds
|
4232 |
|
4233 |
if ( strpos($lastline, "signal 15") !== false ) { //if the encoding was intentionally canceled
|
4234 |
-
$lastline = "Encoding was canceled.";
|
4235 |
}
|
4236 |
-
$
|
4237 |
|
4238 |
}
|
4239 |
|
@@ -4241,15 +5225,15 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
4241 |
} //if logfile
|
4242 |
else {
|
4243 |
|
4244 |
-
$
|
4245 |
-
$lastline = "No log file";
|
4246 |
|
4247 |
}
|
4248 |
|
4249 |
-
if ( $
|
4250 |
-
$
|
4251 |
-
|
4252 |
-
$embed_display = '<strong>Error: </strong><span
|
4253 |
$next_video = kgvid_encode_videos(); //start the next queued video
|
4254 |
if ( !empty($next_video['format']) ) {
|
4255 |
$embed_display .= '<script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
@@ -4259,15 +5243,15 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
4259 |
}
|
4260 |
|
4261 |
}//if not completed
|
4262 |
-
else { $arr = array ( "embed_display"=>"<strong>".ucwords($
|
4263 |
} //if there's a queue and the video is encoding
|
4264 |
-
else { $arr = array ( "embed_display"=>"<strong>Waiting
|
4265 |
return $arr;
|
4266 |
|
4267 |
}//end if queue entry exists
|
4268 |
|
4269 |
}
|
4270 |
-
add_action('kgvid_cron_queue_check', 'kgvid_encode_progress',
|
4271 |
|
4272 |
function kgvid_ajax_encode_progress() {
|
4273 |
|
@@ -4275,7 +5259,6 @@ function kgvid_ajax_encode_progress() {
|
|
4275 |
$video_key = $_POST['video_key'];
|
4276 |
$format = $_POST['format'];
|
4277 |
$page = $_POST['page'];
|
4278 |
-
global $wpdb;
|
4279 |
$progress = kgvid_encode_progress($video_key, $format, $page);
|
4280 |
echo json_encode($progress);
|
4281 |
die();
|
@@ -4285,19 +5268,19 @@ add_action('wp_ajax_kgvid_encode_progress', 'kgvid_ajax_encode_progress');
|
|
4285 |
|
4286 |
function kgvid_replace_video ( $video_key, $format ) {
|
4287 |
|
4288 |
-
$
|
4289 |
-
$encoded_filename = $
|
4290 |
-
$video_id = $
|
4291 |
|
4292 |
$original_filename = get_attached_file($video_id);
|
4293 |
$path_parts = pathinfo($original_filename);
|
4294 |
if ( $path_parts['extension'] != "mp4" && $path_parts['extension'] != "m4v" ) {
|
4295 |
$new_filename = str_replace("-fullres", "", $encoded_filename);
|
4296 |
-
$sanitized_url = kgvid_sanitize_url($
|
4297 |
$new_url = $sanitized_url['noextension'].".mp4";
|
4298 |
-
$
|
4299 |
global $wpdb;
|
4300 |
-
$query = "SELECT ID FROM
|
4301 |
$results = $wpdb->get_results($query);
|
4302 |
if ( $results ) {
|
4303 |
foreach ( $results as $result ) {
|
@@ -4309,21 +5292,20 @@ function kgvid_replace_video ( $video_key, $format ) {
|
|
4309 |
}
|
4310 |
else {
|
4311 |
$new_filename = $original_filename;
|
4312 |
-
$new_url = $
|
4313 |
}
|
4314 |
|
4315 |
if ( file_exists($encoded_filename) ) {
|
4316 |
rename($encoded_filename, $new_filename);
|
4317 |
if ( file_exists($original_filename) && $original_filename != $new_filename ) { unlink($original_filename); }
|
4318 |
}
|
4319 |
-
$
|
4320 |
-
|
4321 |
|
4322 |
// you must first include the image.php file
|
4323 |
// for the function wp_generate_attachment_metadata() to work and media.php for wp_read_video_metadata() in WP 3.6+
|
4324 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
4325 |
global $wp_version;
|
4326 |
-
global $wpdb;
|
4327 |
if ( $wp_version >= 3.6 ) { require_once(ABSPATH . 'wp-admin/includes/media.php'); }
|
4328 |
$attach_data = wp_generate_attachment_metadata( $video_id, $new_filename );
|
4329 |
wp_update_attachment_metadata( $video_id, $attach_data );
|
@@ -4338,19 +5320,19 @@ function kgvid_replace_video ( $video_key, $format ) {
|
|
4338 |
return $new_url;
|
4339 |
}
|
4340 |
|
4341 |
-
function kgvid_clear_completed_queue($type) {
|
4342 |
|
4343 |
-
$
|
4344 |
|
4345 |
-
if ( !empty($
|
4346 |
|
4347 |
$keep = array();
|
4348 |
$cleared_video_queue = array();
|
4349 |
|
4350 |
-
foreach ( $
|
4351 |
if ( !empty($queue_entry['encode_formats']) ) {
|
4352 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
4353 |
-
if ( $value['status'] == "queued" || $value['status'] == "encoding" ) {
|
4354 |
$keep[$video_key] = true;
|
4355 |
break;
|
4356 |
}
|
@@ -4360,16 +5342,20 @@ function kgvid_clear_completed_queue($type) {
|
|
4360 |
break;
|
4361 |
}
|
4362 |
}
|
|
|
|
|
|
|
|
|
4363 |
}
|
4364 |
}
|
4365 |
}
|
4366 |
|
4367 |
foreach ( $keep as $video_key => $value ) {
|
4368 |
-
$cleared_video_queue[] = $
|
4369 |
}
|
4370 |
sort($cleared_video_queue);
|
4371 |
|
4372 |
-
|
4373 |
|
4374 |
}
|
4375 |
}
|
@@ -4379,9 +5365,9 @@ function kgvid_ajax_clear_completed_queue() {
|
|
4379 |
|
4380 |
if ( current_user_can('encode_videos') ) {
|
4381 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4382 |
-
|
4383 |
-
kgvid_clear_completed_queue('manual');
|
4384 |
-
$table = kgvid_generate_queue_table();
|
4385 |
echo ($table);
|
4386 |
die();
|
4387 |
}
|
@@ -4393,15 +5379,16 @@ function kgvid_ajax_clear_queue_entry() {
|
|
4393 |
|
4394 |
if ( current_user_can('encode_videos') ) {
|
4395 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4396 |
-
global $wpdb;
|
4397 |
$video_key = $_POST['index'];
|
4398 |
-
$
|
4399 |
-
|
4400 |
-
|
4401 |
-
|
|
|
4402 |
}
|
4403 |
-
|
4404 |
-
|
|
|
4405 |
echo ($table);
|
4406 |
die();
|
4407 |
}
|
@@ -4416,12 +5403,12 @@ add_action('kgvid_cleanup_queue', 'kgvid_cleanup_queue_handler');
|
|
4416 |
|
4417 |
function kgvid_fix_moov_atom($filepath) {
|
4418 |
|
4419 |
-
$options =
|
4420 |
$output = "";
|
4421 |
|
4422 |
if ( $options['moov'] == "qt-faststart" || $options['moov'] == "MP4Box" ) {
|
4423 |
|
4424 |
-
$output = "\
|
4425 |
|
4426 |
if ( $options['moov'] == 'qt-faststart' && file_exists($filepath) ) {
|
4427 |
$faststart_tmp_file = str_replace('.mp4', '-faststart.mp4', $filepath);
|
@@ -4460,9 +5447,9 @@ function kgvid_cancel_encode() {
|
|
4460 |
}
|
4461 |
$video_key = $_POST['video_key'];
|
4462 |
$format = $_POST['format'];
|
4463 |
-
$
|
4464 |
-
$
|
4465 |
-
|
4466 |
}
|
4467 |
die(); // this is required to return a proper result
|
4468 |
}
|
@@ -4474,13 +5461,15 @@ function kgvid_ajax_delete_video() {
|
|
4474 |
|
4475 |
if ( current_user_can('encode_videos') ) {
|
4476 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4477 |
-
global $wpdb;
|
4478 |
$deleted = false;
|
4479 |
$attachment_id = "";
|
4480 |
if ( isset($_POST['movieurl']) ) { $movieurl = $_POST['movieurl']; }
|
4481 |
if ( isset($_POST['postid']) ) { $post_id = $_POST['postid']; }
|
4482 |
if ( isset($_POST['format']) ) { $format = $_POST['format']; }
|
4483 |
if ( isset($_POST['childid']) ) { $attachment_id = $_POST['childid']; }
|
|
|
|
|
|
|
4484 |
if ( empty($attachment_id) ) { //if there's no post_meta giving us the attachment to delete
|
4485 |
$encodevideo_info = kgvid_encodevideo_info($movieurl, $post_id);
|
4486 |
if ( is_file($encodevideo_info[$format.'filepath']) ) {
|
@@ -4488,8 +5477,10 @@ function kgvid_ajax_delete_video() {
|
|
4488 |
}
|
4489 |
}
|
4490 |
else {
|
|
|
4491 |
$deleted = wp_delete_attachment($attachment_id);
|
4492 |
if ( !empty($deleted) ) { $deleted = true; }
|
|
|
4493 |
}
|
4494 |
echo($deleted);
|
4495 |
die();
|
@@ -4501,15 +5492,14 @@ add_action('wp_ajax_kgvid_delete_video', 'kgvid_ajax_delete_video');
|
|
4501 |
function kgvid_delete_video_attachment($video_id) {
|
4502 |
|
4503 |
if ( strpos(get_post_mime_type( $video_id ), 'video') !== false ) { //only do this for videos
|
4504 |
-
global $wpdb;
|
4505 |
$parent_post = get_post($video_id);
|
4506 |
-
$options =
|
4507 |
-
$
|
4508 |
$parent_id = get_post($video_id)->post_parent;
|
4509 |
$wp_attached_file = get_post_meta($video_id, '_wp_attached_file', true);
|
4510 |
|
4511 |
-
if ( !empty($
|
4512 |
-
foreach ($
|
4513 |
if ( $video_entry['attachmentID'] == $video_id ) {
|
4514 |
|
4515 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
@@ -4519,17 +5509,17 @@ function kgvid_delete_video_attachment($video_id) {
|
|
4519 |
}
|
4520 |
}
|
4521 |
|
4522 |
-
unset($
|
4523 |
-
sort($
|
4524 |
-
|
4525 |
break;
|
4526 |
}//if the video is an original format
|
4527 |
if ( $video_entry['attachmentID'] == $parent_id || get_post_meta($video_id, '_kgflashmediaplayer-externalurl', true) == $video_entry['movieurl'] ) {
|
4528 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
4529 |
if ( array_key_exists('filepath', $value) ) {
|
4530 |
if ( strpos($value['filepath'], $wp_attached_file) !== false ) {
|
4531 |
-
$
|
4532 |
-
|
4533 |
break;
|
4534 |
}//if the format has filepath information
|
4535 |
}//if the encoded child format is in the database
|
@@ -4600,17 +5590,6 @@ function kgvid_get_set_featured() {
|
|
4600 |
|
4601 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4602 |
|
4603 |
-
global $wpdb;
|
4604 |
-
|
4605 |
-
/* $querystr = "
|
4606 |
-
SELECT $wpdb->posts.*
|
4607 |
-
FROM $wpdb->posts, $wpdb->postmeta
|
4608 |
-
WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
|
4609 |
-
AND $wpdb->postmeta.meta_key = '_kgflashmediaplayer-poster-id'
|
4610 |
-
ORDER BY $wpdb->posts.post_date ASC
|
4611 |
-
";
|
4612 |
-
$videoposts = $wpdb->get_results($querystr, OBJECT); */
|
4613 |
-
|
4614 |
$args = array(
|
4615 |
'post_type' => null,
|
4616 |
'numberposts' => -1,
|
@@ -4755,8 +5734,8 @@ function kgvid_update_cms_progress() {
|
|
4755 |
if (isset($_POST['cms_type'])) { $type = $_POST['cms_type']; }
|
4756 |
if (isset($_POST['total'])) { $total = $_POST['total']; }
|
4757 |
$queue = get_option('kgvid_video_embed_cms_switch');
|
4758 |
-
if ( is_array($queue) ) {
|
4759 |
-
|
4760 |
}
|
4761 |
echo $remaining;
|
4762 |
die;
|
@@ -4777,7 +5756,7 @@ add_action('wp_ajax_kgvid_update_cms_progress', 'kgvid_update_cms_progress');
|
|
4777 |
);
|
4778 |
}
|
4779 |
}
|
4780 |
-
add_action( 'add_meta_boxes', 'kgvid_singleurl_meta_box' );
|
4781 |
|
4782 |
function kgvid_singleurl_inner_custom_box($post) {
|
4783 |
|
@@ -4790,7 +5769,7 @@ function kgvid_singleurl_inner_custom_box($post) {
|
|
4790 |
$nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
|
4791 |
echo '<h4>Alternate formats of embedded videos</h4>';
|
4792 |
foreach ( $urls as $movieurl ) {
|
4793 |
-
$query = "SELECT ID FROM
|
4794 |
$video_id = $wpdb->get_var($query);
|
4795 |
|
4796 |
echo '<div class="kgvid_post_meta_boxes">';
|
@@ -4838,8 +5817,12 @@ function kgvid_ajax_rescan_external_server() {
|
|
4838 |
die;
|
4839 |
}
|
4840 |
add_action('wp_ajax_kgvid_rescan_external_server', 'kgvid_ajax_rescan_external_server');
|
|
|
4841 |
|
4842 |
function kgvid_count_play() {
|
|
|
|
|
|
|
4843 |
$post_id = $_POST['post_id'];
|
4844 |
$event = $_POST['video_event'];
|
4845 |
if ( $event == "play" ) { $event = "starts"; }
|
@@ -4854,17 +5837,168 @@ function kgvid_count_play() {
|
|
4854 |
add_action( 'wp_ajax_kgvid_count_play', 'kgvid_count_play' ); // ajax for logged in users
|
4855 |
add_action( 'wp_ajax_nopriv_kgvid_count_play', 'kgvid_count_play' ); // ajax for not logged in users
|
4856 |
|
4857 |
-
function
|
4858 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4859 |
wp_clear_scheduled_hook('kgvid_cleanup_queue', array( 'scheduled' ) );
|
4860 |
-
|
|
|
4861 |
global $wp_roles;
|
4862 |
-
foreach ( $options['
|
4863 |
-
foreach ( $roles as $role => $role_info ) {
|
4864 |
$wp_roles->remove_cap( $role, $capability );
|
4865 |
}
|
4866 |
}
|
4867 |
}
|
4868 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4869 |
|
4870 |
?>
|
3 |
Plugin Name: Video Embed & Thumbnail Generator
|
4 |
Plugin URI: http://www.kylegilman.net/2011/01/18/video-embed-thumbnail-generator-wordpress-plugin/
|
5 |
Description: Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG or LIBAV for encoding.
|
6 |
+
Version: 4.3
|
7 |
Author: Kyle Gilman
|
8 |
Author URI: http://www.kylegilman.net/
|
9 |
+
Text Domain: video-embed-thumbnail-generator
|
10 |
|
11 |
This program is free software; you can redistribute it and/or modify
|
12 |
it under the terms of the GNU General Public License as published by
|
45 |
|
46 |
function kgvid_default_options_fn() {
|
47 |
|
48 |
+
$upload_capable = kgvid_check_if_capable('upload_files');
|
49 |
+
$edit_others_capable = kgvid_check_if_capable('edit_others_posts');
|
50 |
|
51 |
$options = array(
|
52 |
+
"version" => 4.3,
|
53 |
+
"embed_method" => "Video.js",
|
54 |
+
"jw_player_id" => "",
|
55 |
+
"template" => false,
|
56 |
+
"template_gentle" => "on",
|
57 |
+
"encode_fullres" => false,
|
58 |
+
"encode_1080" => "on",
|
59 |
+
"encode_720" => "on",
|
60 |
+
"encode_mobile" => "on",
|
61 |
+
"encode_webm" => false,
|
62 |
+
"encode_ogg" => false,
|
63 |
+
"app_path" => "/usr/local/bin",
|
64 |
+
"video_app" => "ffmpeg",
|
65 |
+
"ffmpeg_exists" =>"notchecked",
|
66 |
+
"video_bitrate_flag" => false,
|
67 |
+
"ffmpeg_vpre" => false,
|
68 |
+
"moov" => "none",
|
69 |
+
"generate_thumbs" => 4,
|
70 |
+
"featured" => "on",
|
71 |
+
"thumb_parent" => "video",
|
72 |
+
"delete_children" => "encoded videos only",
|
73 |
+
"titlecode" => "<strong>",
|
74 |
+
"poster" => "",
|
75 |
+
"watermark" => "",
|
76 |
+
"overlay_title" => "on",
|
77 |
+
"overlay_embedcode" => false,
|
78 |
+
"downloadlink" => false,
|
79 |
+
"view_count" => false,
|
80 |
+
"embeddable" => "on",
|
81 |
+
"inline" => false,
|
82 |
+
"align" => "left",
|
83 |
+
"width" => "640",
|
84 |
+
"height" => "360",
|
85 |
+
"minimum_width" => false,
|
86 |
+
"gallery_width" => "960",
|
87 |
+
"gallery_height" => "540",
|
88 |
+
"gallery_thumb" => "250",
|
89 |
+
"controlbar_style" => "docked",
|
90 |
+
"autoplay" => false,
|
91 |
+
"loop" => false,
|
92 |
+
"preload" => "metadata",
|
93 |
+
"endofvideooverlay" => false,
|
94 |
+
"endofvideooverlaysame" => "",
|
95 |
+
"bgcolor" => "",
|
96 |
+
"configuration" => "",
|
97 |
+
"skin" => plugins_url("", __FILE__)."/flash/skin/kg_skin.xml",
|
98 |
+
"js_skin" => "kg-video-js-skin",
|
99 |
+
"stream_type" => "liveOrRecorded",
|
100 |
+
"scale_mode" => "letterbox",
|
101 |
+
"autohide" => "on",
|
102 |
+
"playbutton" => "on",
|
103 |
+
"bitrate_multiplier" => 0.1,
|
104 |
+
"h264_CRF" => "23",
|
105 |
+
"webm_CRF" => "10",
|
106 |
+
"ogv_CRF" => "6",
|
107 |
+
"audio_bitrate" => 160,
|
108 |
+
"threads" => 1,
|
109 |
+
"nice" => "on",
|
110 |
+
"browser_thumbnails" => "on",
|
111 |
+
"rate_control" => "crf",
|
112 |
+
"h264_profile" => "baseline",
|
113 |
+
"h264_level" => "3.0",
|
114 |
+
"auto_encode" => false,
|
115 |
+
"auto_thumb" => false,
|
116 |
+
"auto_thumb_number" => 1,
|
117 |
+
"auto_thumb_position" => 50,
|
118 |
+
"right_click" => "on",
|
119 |
+
"resize" => "on",
|
120 |
+
"capabilities" => array(
|
121 |
+
"make_video_thumbnails" => $upload_capable,
|
122 |
+
"encode_videos" => $upload_capable,
|
123 |
+
"edit_others_video_encodes" => $edit_others_capable
|
124 |
+
),
|
125 |
+
"open_graph" => "on",
|
126 |
+
"htaccess_login" => "",
|
127 |
+
"htaccess_password" => "",
|
128 |
+
"sample_format" => "mobile",
|
129 |
+
"ffmpeg_watermark" => array(
|
130 |
+
"url" => "",
|
131 |
+
"scale" => "9",
|
132 |
+
"align" => "right",
|
133 |
+
"valign"=> "bottom",
|
134 |
+
"x" => "6",
|
135 |
+
"y" => "5"
|
136 |
+
),
|
137 |
+
"simultaneous_encodes" => 1
|
138 |
);
|
139 |
+
|
140 |
return $options;
|
141 |
+
|
142 |
}
|
143 |
|
144 |
+
function kgvid_default_network_options() {
|
145 |
+
|
146 |
+
$default_options = kgvid_default_options_fn();
|
147 |
+
$network_options = array(
|
148 |
+
'app_path' => $default_options['app_path'],
|
149 |
+
'video_app' => $default_options['video_app'],
|
150 |
+
'moov' => $default_options['moov'],
|
151 |
+
'video_bitrate_flag' => $default_options['video_bitrate_flag'],
|
152 |
+
'ffmpeg_vpre' => $default_options['ffmpeg_vpre'],
|
153 |
+
'nice' => $default_options['nice'],
|
154 |
+
'threads' => $default_options['threads'],
|
155 |
+
'ffmpeg_exists' => $default_options['ffmpeg_exists'],
|
156 |
+
'default_capabilities' => $default_options['capabilities'],
|
157 |
+
'simultaneous_encodes' => $default_options['simultaneous_encodes']
|
158 |
+
);
|
159 |
+
|
160 |
+
return $network_options;
|
161 |
+
|
162 |
+
}
|
163 |
+
|
164 |
+
function kgvid_get_options() {
|
165 |
|
166 |
$options = get_option('kgvid_video_embed_options');
|
167 |
|
168 |
+
if ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
169 |
+
$network_options = get_site_option('kgvid_video_embed_network_options');
|
170 |
+
if ( is_array($network_options) ) { $options = array_merge($options, $network_options); }
|
171 |
}
|
172 |
|
173 |
+
return $options;
|
|
|
|
|
174 |
|
175 |
}
|
|
|
176 |
|
177 |
+
function kgvid_get_encode_queue() {
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
+
if ( defined( 'DOING_CRON' ) ) { //unlike AJAX, cron doesn't load plugin.php
|
180 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
181 |
+
}
|
182 |
|
183 |
+
if ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
184 |
+
$video_encode_queue = get_site_option('kgvid_video_embed_queue');
|
185 |
+
}
|
186 |
+
else { $video_encode_queue = get_option('kgvid_video_embed_queue'); }
|
187 |
|
188 |
+
return $video_encode_queue;
|
189 |
|
190 |
+
}
|
191 |
+
|
192 |
+
function kgvid_save_encode_queue($video_encode_queue) {
|
193 |
+
|
194 |
+
if ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
195 |
+
update_site_option('kgvid_video_embed_queue', $video_encode_queue);
|
196 |
}
|
197 |
+
else { update_option('kgvid_video_embed_queue', $video_encode_queue); }
|
198 |
|
199 |
}
|
|
|
200 |
|
201 |
function kgvid_video_formats() {
|
202 |
|
203 |
$video_formats = array(
|
204 |
"fullres" => array(
|
205 |
+
"name" => __("Replace original with H.264", 'video-embed-thumbnail-generator'),
|
206 |
"width" => 4096,
|
207 |
"height" => 2304,
|
208 |
"type" => "h264",
|
257 |
|
258 |
}
|
259 |
|
260 |
+
function kgvid_register_default_options_fn() { //add default values for options
|
261 |
+
|
262 |
+
$options = kgvid_get_options();
|
263 |
+
|
264 |
+
if( !is_array($options) ) {
|
265 |
+
|
266 |
+
$options = kgvid_default_options_fn();
|
267 |
+
|
268 |
+
$ffmpeg_check = kgvid_check_ffmpeg_exists($options, false);
|
269 |
+
if ( true == $ffmpeg_check['ffmpeg_exists'] ) {
|
270 |
+
$options['ffmpeg_exists'] = 'on';
|
271 |
+
$options['app_path'] = $ffmpeg_check['app_path'];
|
272 |
+
}
|
273 |
+
else { $options['ffmpeg_exists'] = false; }
|
274 |
+
|
275 |
+
update_option('kgvid_video_embed_options', $options);
|
276 |
+
|
277 |
+
}
|
278 |
+
|
279 |
+
return $options;
|
280 |
+
|
281 |
+
}
|
282 |
+
|
283 |
+
function kgvid_video_embed_activation_hook( $network_wide ) {
|
284 |
+
|
285 |
+
if ( is_multisite() && $network_wide ) { // if activated on the entire network
|
286 |
+
|
287 |
+
$network_options = get_site_option( 'kgvid_video_embed_network_options' );
|
288 |
+
|
289 |
+
if( !is_array($network_options) ) {
|
290 |
+
|
291 |
+
$network_options = kgvid_default_network_options();
|
292 |
+
|
293 |
+
$ffmpeg_check = kgvid_check_ffmpeg_exists($network_options, false);
|
294 |
+
if ( true == $ffmpeg_check['ffmpeg_exists'] ) {
|
295 |
+
$network_options['ffmpeg_exists'] = 'on';
|
296 |
+
$network_options['app_path'] = $ffmpeg_check['app_path'];
|
297 |
+
}
|
298 |
+
else { $network_options['ffmpeg_exists'] = false; }
|
299 |
+
|
300 |
+
update_site_option('kgvid_video_embed_network_options', $network_options);
|
301 |
+
|
302 |
+
$current_blog_id = get_current_blog_id();
|
303 |
+
$sites = wp_get_sites();
|
304 |
+
|
305 |
+
if ( is_array($sites) ) {
|
306 |
+
|
307 |
+
foreach ( $sites as $site ) {
|
308 |
+
|
309 |
+
switch_to_blog($site['blog_id']);
|
310 |
+
|
311 |
+
$options = get_option('kgvid_video_embed_options');
|
312 |
+
|
313 |
+
if ( !is_array($options) ) {
|
314 |
+
kgvid_register_default_options_fn();
|
315 |
+
kgvid_set_capabilities($network_options['default_capabilities']);
|
316 |
+
}
|
317 |
+
|
318 |
+
}//end loop through sites
|
319 |
+
|
320 |
+
switch_to_blog($current_blog_id);
|
321 |
+
|
322 |
+
}//if there are existing sites to set
|
323 |
+
|
324 |
+
}// if network options haven't been set already
|
325 |
+
|
326 |
+
}
|
327 |
+
else { // Running on a single blog
|
328 |
+
|
329 |
+
$options = kgvid_register_default_options_fn();
|
330 |
+
kgvid_set_capabilities($options['default_capabilities']);
|
331 |
+
|
332 |
+
}
|
333 |
+
|
334 |
+
}
|
335 |
+
register_activation_hook(__FILE__, 'kgvid_video_embed_activation_hook');
|
336 |
+
|
337 |
+
function kgvid_add_new_blog($blog_id) {
|
338 |
+
|
339 |
+
switch_to_blog($blog_id);
|
340 |
+
|
341 |
+
$network_options = get_site_option( 'kgvid_video_embed_network_options' );
|
342 |
+
kgvid_set_capabilities($network_options['default_capabilities']);
|
343 |
+
|
344 |
+
restore_current_blog();
|
345 |
+
|
346 |
+
}
|
347 |
+
add_action( 'wpmu_new_blog', 'kgvid_add_new_blog' );
|
348 |
+
|
349 |
+
function kgvid_plugin_action_links($links) {
|
350 |
+
|
351 |
+
$links[] = '<a href="'.get_admin_url(null, "options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php").'">'.__('Settings', 'video-embed-thumbnail-generator').'</a>';
|
352 |
+
return $links;
|
353 |
+
|
354 |
+
}
|
355 |
+
add_filter("plugin_action_links_".plugin_basename(__FILE__), 'kgvid_plugin_action_links' );
|
356 |
+
|
357 |
+
function kgvid_plugin_network_action_links($links) {
|
358 |
+
|
359 |
+
$links[] = '<a href="'.network_admin_url().'settings.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">'.__('Network Settings', 'video-embed-thumbnail-generator').'</a>';
|
360 |
+
return $links;
|
361 |
+
|
362 |
+
}
|
363 |
+
add_filter("network_admin_plugin_action_links_".plugin_basename(__FILE__), 'kgvid_plugin_network_action_links' );
|
364 |
+
|
365 |
+
function kgvid_load_text_domain() {
|
366 |
+
|
367 |
+
load_plugin_textdomain( 'video-embed-thumbnail-generator', false, basename(dirname(__FILE__)).'/languages/' );
|
368 |
+
|
369 |
+
}
|
370 |
+
add_action('plugins_loaded', 'kgvid_load_text_domain');
|
371 |
+
|
372 |
+
|
373 |
+
function kgvid_plugin_meta_links( $links, $file ) {
|
374 |
+
|
375 |
+
$plugin = plugin_basename(__FILE__);
|
376 |
+
|
377 |
+
if ( $file == $plugin ) {
|
378 |
+
return array_merge(
|
379 |
+
$links,
|
380 |
+
array( '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation">Donate</a>' )
|
381 |
+
);
|
382 |
+
}
|
383 |
+
return $links;
|
384 |
+
|
385 |
+
}
|
386 |
+
add_filter( 'plugin_row_meta', 'kgvid_plugin_meta_links', 10, 2 );
|
387 |
+
|
388 |
+
function kgvid_check_if_capable($capability) {
|
389 |
global $wp_roles;
|
390 |
+
$capable = array();
|
391 |
foreach ( $wp_roles->roles as $role => $role_info ) {
|
392 |
+
if ( is_array($role_info['capabilities']) && array_key_exists($capability, $role_info['capabilities']) && $role_info['capabilities'][$capability] == 1 ) {
|
393 |
+
$capable[$role] = "on";
|
394 |
}
|
395 |
+
else { $capable[$role] = false; }
|
396 |
}
|
397 |
+
return $capable;
|
398 |
}
|
399 |
|
400 |
function kgvid_set_capabilities($capabilities) {
|
401 |
+
|
402 |
global $wp_roles;
|
403 |
+
|
404 |
+
$default_options = kgvid_default_options_fn();
|
405 |
+
foreach ( $default_options['capabilities'] as $default_capability => $default_enabled ) {
|
406 |
+
if ( is_array($capabilities) && !array_key_exists($default_capability, $capabilities) ) {
|
407 |
+
$capabilities[$default_capability] = array();
|
408 |
+
}
|
409 |
+
}
|
410 |
+
|
411 |
foreach ( $capabilities as $capability => $enabled_roles ) {
|
412 |
foreach ( $wp_roles->roles as $role => $role_info ) { //check all roles
|
413 |
+
if ( is_array($role_info['capabilities']) && !array_key_exists($capability, $role_info['capabilities']) && array_key_exists($role, $enabled_roles) && $enabled_roles[$role] == "on" ) {
|
414 |
$wp_roles->add_cap( $role, $capability );
|
415 |
}
|
416 |
+
if ( is_array($role_info['capabilities']) && array_key_exists($capability, $role_info['capabilities']) && !array_key_exists($role, $enabled_roles) ) {
|
417 |
$wp_roles->remove_cap( $role, $capability );
|
418 |
}
|
419 |
}
|
420 |
}
|
421 |
+
|
422 |
}
|
423 |
|
424 |
function kgvid_aac_encoders() {
|
432 |
|
433 |
// allows uploading .webm videos
|
434 |
$existing_mimes['webm'] = 'video/webm';
|
435 |
+
$existing_mimes['vtt'] = 'text/vtt';
|
436 |
return $existing_mimes;
|
437 |
|
438 |
}
|
477 |
global $post;
|
478 |
$pattern = get_shortcode_regex();
|
479 |
preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches );
|
480 |
+
if ( is_array($matches) && array_key_exists( 2, $matches ) && array_key_exists( 5, $matches ) ) {
|
481 |
foreach ( $matches[2] as $shortcode_index => $shortcode ) {
|
482 |
if ( $shortcode == "KGVID" || $shortcode == "FMP" ) { continue; }
|
483 |
else {
|
546 |
$function = "";
|
547 |
$uploads = wp_upload_dir();
|
548 |
|
549 |
+
$exec_available = true;
|
550 |
+
if (ini_get('safe_mode')) {
|
551 |
+
$exec_available = false;
|
552 |
+
} else {
|
553 |
+
$d = ini_get('disable_functions');
|
554 |
+
$s = ini_get('suhosin.executor.func.blacklist');
|
555 |
+
if ("$d$s") {
|
556 |
+
$array = preg_split('/,\s*/', "$d,$s");
|
557 |
+
if (in_array('exec', $array)) {
|
558 |
+
$exec_available = false;
|
559 |
+
}
|
560 |
+
}
|
561 |
+
}
|
562 |
+
|
563 |
+
if($exec_available) {
|
564 |
if (function_exists('escapeshellcmd')) {
|
565 |
$exec_enabled = true;
|
566 |
$test_path = rtrim($options['app_path'], '/');
|
567 |
+
$cmd = escapeshellcmd($test_path.'/'.$options['video_app'].' -i "'.plugin_dir_path(__FILE__).'images/sample-video-h264.mp4" -vframes 1 -f mjpeg '.$uploads['path'].'/ffmpeg_exists_test.jpg');
|
568 |
exec ( $cmd, $output, $returnvalue );
|
569 |
}
|
570 |
else { $function = "ESCAPESHELLCMD"; }
|
575 |
|
576 |
if ( !file_exists($uploads['path'].'/ffmpeg_exists_test.jpg') ) { //if FFMPEG has not executed successfully
|
577 |
$test_path = substr($test_path, 0, -strlen($options['video_app'])-1 );
|
578 |
+
$cmd = escapeshellcmd($test_path.'/'.$options['video_app'].' -i "'.plugin_dir_path(__FILE__).'images/sample-video-h264.mp4" -vframes 1 -f mjpeg '.$uploads['path'].'/ffmpeg_exists_test.jpg');
|
579 |
exec ( $cmd, $output, $returnvalue );
|
580 |
}
|
581 |
|
588 |
}
|
589 |
|
590 |
if ( $save ) {
|
591 |
+
|
592 |
if ( $ffmpeg_exists == true ) { $options['ffmpeg_exists'] = "on"; }
|
593 |
else {
|
594 |
$options['ffmpeg_exists'] = "notinstalled";
|
595 |
$options['browser_thumbnails'] = "on"; //if FFMPEG isn't around, this should be enabled
|
596 |
}
|
597 |
+
|
598 |
update_option('kgvid_video_embed_options', $options);
|
599 |
+
|
600 |
}
|
601 |
|
602 |
$output_output = implode("/n", $output);
|
612 |
|
613 |
function kgvid_set_video_dimensions($id, $gallery = false) {
|
614 |
|
615 |
+
$options = kgvid_get_options();
|
616 |
$video_meta = "";
|
617 |
$moviefile = get_attached_file($id);
|
618 |
|
619 |
$video_meta = get_post_meta( $id, '_wp_attachment_metadata', true);
|
620 |
|
621 |
+
if ( is_array($video_meta) && array_key_exists('width', $video_meta) ) { $widthactual = $video_meta['width']; }
|
622 |
else { $widthactual = get_post_meta($id, "_kgflashmediaplayer-actualwidth", true); }
|
623 |
$widthset = get_post_meta($id, "_kgflashmediaplayer-width", true);
|
624 |
if ( !$widthset ) { $widthset = $widthactual; }
|
625 |
|
626 |
+
if ( is_array($video_meta) && array_key_exists('height', $video_meta) ) { $heightactual = $video_meta['height']; }
|
627 |
else { $heightactual = get_post_meta($id, "_kgflashmediaplayer-actualheight", true); }
|
628 |
$heightset = get_post_meta($id, "_kgflashmediaplayer-height", true);
|
629 |
if ( !$heightset ) { $heightset = $heightactual; }
|
641 |
|
642 |
$heightset = round(intval($widthset)*$aspect_ratio);
|
643 |
|
644 |
+
$dimensions = array( 'width' => strval($widthset), 'height' => strval($heightset), 'actualwidth' => strval($widthactual), 'actualheight' => strval($heightactual) );
|
645 |
return $dimensions;
|
646 |
|
647 |
}
|
648 |
|
649 |
+
function kgvid_set_h264_encode_dimensions($movie_info, $format_stats) {
|
650 |
+
|
651 |
+
if ( intval($movie_info['width']) > $format_stats['width'] ) { $h264_movie_width = $format_stats['width']; }
|
652 |
+
else { $h264_movie_width = $movie_info['width']; }
|
653 |
+
$h264_movie_height = strval(round(floatval($movie_info['height']) / floatval($movie_info['width']) * $h264_movie_width));
|
654 |
+
if ( intval($h264_movie_height) > $format_stats['height'] ) { $h264_movie_height = $format_stats['height']; }
|
655 |
+
$h264_movie_width = strval(round(floatval($movie_info['width']) / floatval($movie_info['height']) * $h264_movie_height));
|
656 |
+
|
657 |
+
if ($h264_movie_height % 2 != 0) { $h264_movie_height++; } //if it's odd, increase by 1 to make sure it's an even number
|
658 |
+
if ($h264_movie_width % 2 != 0) { $h264_movie_width--; } //if it's odd, decrease by 1 to make sure it's an even number
|
659 |
+
|
660 |
+
$arr = array( 'width' => $h264_movie_width, 'height' => $h264_movie_height );
|
661 |
+
return $arr;
|
662 |
+
|
663 |
+
}
|
664 |
+
|
665 |
function kgvid_encodevideo_info($movieurl, $postID) {
|
666 |
|
667 |
+
$options = kgvid_get_options();
|
668 |
|
669 |
$uploads = wp_upload_dir();
|
670 |
$video_formats = kgvid_video_formats();
|
672 |
$movieurl = $sanitized_url['movieurl'];
|
673 |
|
674 |
$encodevideo_info['moviefilebasename'] = $sanitized_url['basename'];
|
675 |
+
|
676 |
$encodevideo_info['encodepath'] = $uploads['path'];
|
677 |
if ( get_post_type($postID) == "attachment" ) { //if it's an attachment, not from URL
|
678 |
$moviefile = get_attached_file($postID);
|
689 |
else {
|
690 |
|
691 |
$url_parts = parse_url($uploads['url']);
|
692 |
+
if ( is_array($url_parts) && array_key_exists('host', $url_parts) && strpos($movieurl, $url_parts['host']) !== false ) { //if we're on the same server
|
693 |
$encodevideo_info['sameserver'] = true;
|
694 |
$decodedurl = urldecode($movieurl);
|
695 |
$parsed_url= parse_url($decodedurl);
|
805 |
* @author Jamie Scott
|
806 |
*/
|
807 |
function kgvid_get_video_dimensions($video = false) {
|
808 |
+
$options = kgvid_get_options();
|
809 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
810 |
$movie_info = array();
|
811 |
|
820 |
exec ( $command, $output );
|
821 |
$lastline = end($output);
|
822 |
$lastline = prev($output)."<br />".$lastline;
|
823 |
+
$movie_info['output'] = addslashes($lastline);
|
824 |
$output = implode("\n", $output);
|
825 |
$regex = "/([0-9]{2,4})x([0-9]{2,4})/";
|
826 |
if (preg_match($regex, $output, $regs)) { $result = $regs[0]; }
|
838 |
$movie_info['duration'] = ($movie_duration_hours * 60 * 60) + ($movie_duration_minutes * 60) + $movie_duration_seconds;
|
839 |
|
840 |
preg_match('/rotate : (.*?)\n/', $output, $matches);
|
841 |
+
if ( is_array($matches) && array_key_exists(1, $matches) == true ) { $rotate = $matches[1]; }
|
842 |
else $rotate = "0";
|
843 |
|
844 |
switch ($rotate) {
|
861 |
else { $movie_info['configuration'][$lib] = "false"; }
|
862 |
}
|
863 |
|
|
|
|
|
864 |
}
|
865 |
else {
|
866 |
$movie_info['worked'] = false;
|
869 |
return $movie_info;
|
870 |
}
|
871 |
|
872 |
+
function kgvid_generate_flashvars($content, $query_atts, $encodevideo_info, $id) {
|
873 |
|
874 |
+
$flashvars = array();
|
875 |
+
$moviefiletype = pathinfo($content, PATHINFO_EXTENSION);
|
876 |
+
$flashcompatible = array("flv", "f4v", "mp4", "mov", "m4v");
|
877 |
+
|
878 |
+
if ( in_array($moviefiletype, $flashcompatible) ) { //if the original video is Flash video player compatible
|
879 |
+
$flashvars['src'] = urlencode($content);
|
880 |
+
$flash_source_found = true;
|
881 |
+
}
|
882 |
+
else {
|
883 |
+
$flash_source_found = false;
|
884 |
+
$video_formats = kgvid_video_formats();
|
885 |
+
foreach ($video_formats as $format => $format_stats) { //check if there's an H.264 format available and pick the highest quality one
|
886 |
+
if ( $encodevideo_info[$format."_exists"] && $format_stats['type'] == "mp4" ) {
|
887 |
+
$flashvars['src'] = urlencode(trim($encodevideo_info[$format.'url']));
|
888 |
+
$flash_source_found = true;
|
889 |
+
break;
|
890 |
+
}
|
891 |
+
}
|
892 |
+
}
|
893 |
+
if ( $flash_source_found ) {
|
894 |
+
|
895 |
+
if($query_atts["poster"] != '') { $flashvars['poster'] = urlencode(trim($query_atts["poster"])); }
|
896 |
+
if($query_atts["endofvideooverlay"] != '') { $flashvars['endofvideooverlay'] = urlencode(trim($query_atts["endofvideooverlay"])); }
|
897 |
+
if($query_atts["controlbar"] != '') { $flashvars['controlBarMode'] = $query_atts["controlbar"]; }
|
898 |
+
if($query_atts["autohide"] != '') { $flashvars['controlBarAutoHide'] = $query_atts["autohide"]; }
|
899 |
+
if($query_atts["playbutton"] != '') { $flashvars['playButtonOverlay'] = $query_atts["playbutton"]; }
|
900 |
+
if($query_atts["loop"] != '') { $flashvars['loop'] = $query_atts["loop"]; }
|
901 |
+
if($query_atts["autoplay"] != '') { $flashvars['autoPlay'] = $query_atts["autoplay"]; }
|
902 |
+
if($query_atts["streamtype"] != '') { $flashvars['streamType'] = $query_atts["streamtype"]; }
|
903 |
+
if($query_atts["scalemode"] != '') { $flashvars['scaleMode'] = $query_atts["scalemode"]; }
|
904 |
+
if($query_atts["backgroundcolor"] != '') { $flashvars['backgroundColor'] = $query_atts["backgroundcolor"]; }
|
905 |
+
if($query_atts["configuration"] != '') { $flashvars['configuration'] = urlencode($query_atts["configuration"]); }
|
906 |
+
if($query_atts["skin"] != '') { $flashvars['skin'] = urlencode($query_atts["skin"]); }
|
907 |
+
$flashvars['verbose'] = 'true';
|
908 |
+
$flashvars['javascriptCallbackFunction'] = "function(id){kgvid_strobemedia_callback(".$id.");}"; //this is necessary to turn on the js API
|
909 |
+
|
910 |
+
$params = array(
|
911 |
+
'wmode' => 'opaque',
|
912 |
+
'allowfullscreen' => 'true',
|
913 |
+
'allowScriptAccess' => 'always',
|
914 |
+
'base' => plugins_url("", __FILE__).'/flash/'
|
915 |
+
);
|
916 |
+
}
|
917 |
+
|
918 |
+
$arr = array( 'flashvars' => $flashvars, 'params' => $params, 'flash_source_found' => $flash_source_found );
|
919 |
+
return $arr;
|
920 |
+
|
921 |
+
}
|
922 |
+
|
923 |
+
|
924 |
+
function kgvid_generate_encode_string($input, $output, $movie_info, $format, $width, $height, $rotate) {
|
925 |
+
|
926 |
+
$options = kgvid_get_options();
|
927 |
+
$libraries = $movie_info['configuration'];
|
928 |
$encode_string = strtoupper($options['video_app'])." not found";
|
929 |
|
930 |
if ( $options['ffmpeg_exists'] == "on" ) {
|
957 |
$rate_control_flag = " -".$video_bitrate_flag." ".round(floatval($options['bitrate_multiplier'])*$width*$height*30/1024)."k";
|
958 |
}
|
959 |
|
960 |
+
if ( $options['ffmpeg_watermark']['url'] != "" ) {
|
961 |
+
|
962 |
+
$watermark_width = strval(round(intval($movie_info['width'])*(intval($options['ffmpeg_watermark']['scale'])/100)));
|
963 |
+
|
964 |
+
if ( $options['ffmpeg_watermark']['align'] == 'right' ) {
|
965 |
+
$watermark_align = "main_w-overlay_w-";
|
966 |
+
}
|
967 |
+
elseif ( $options['ffmpeg_watermark']['align'] == 'center' ) {
|
968 |
+
$watermark_align = "main_w/2-overlay_w/2-";
|
969 |
+
}
|
970 |
+
else { $watermark_align = ""; } //left justified
|
971 |
+
|
972 |
+
if ( $options['ffmpeg_watermark']['valign'] == 'bottom' ) {
|
973 |
+
$watermark_valign = "main_h-overlay_h-";
|
974 |
+
}
|
975 |
+
elseif ( $options['ffmpeg_watermark']['valign'] == 'center' ) {
|
976 |
+
$watermark_valign = "main_h/2-overlay_h/2-";
|
977 |
+
}
|
978 |
+
else { $watermark_valign = ""; } //top justified
|
979 |
+
|
980 |
+
$watermark_input = '-i "'.$options['ffmpeg_watermark']['url'].'" ';
|
981 |
+
$watermark_filter = ' -filter_complex "[1:v]scale='.$watermark_width.':-1[watermark];[0:v][watermark]overlay='.$watermark_align.'main_w*'.round($options['ffmpeg_watermark']['x']/100, 3).':'.$watermark_valign.'main_w*'.round($options['ffmpeg_watermark']['y']/100, 3).'"';
|
982 |
+
}
|
983 |
+
else {
|
984 |
+
$watermark_input = "";
|
985 |
+
$watermark_filter = "";
|
986 |
+
}
|
987 |
+
|
988 |
if ( $video_formats[$format]['type'] == 'h264' ) {
|
989 |
|
990 |
$aac_array = kgvid_aac_encoders();
|
1031 |
if ( !empty($options['htaccess_login']) && strpos($input, 'http://') === 0 ) {
|
1032 |
$input = substr_replace($input, $options['htaccess_login'].':'.$options['htaccess_password'].'@', 7, 0);
|
1033 |
}
|
1034 |
+
$encode_string = array();
|
1035 |
+
$encode_string[1] = $nice.$options['app_path']."/".$options['video_app'].' -y -i "'.$input.'" '.$watermark_input.$ffmpeg_options.$rate_control_flag.$rotate." -threads ".$options['threads'];
|
1036 |
+
$encode_string[2] = $watermark_filter;
|
1037 |
+
$encode_string[3] = ' "'.$output.'"';
|
1038 |
|
1039 |
+
$options['encode_string'] = $encode_string;
|
1040 |
+
update_option('kgvid_video_embed_options', $options);
|
1041 |
|
1042 |
} //if FFMPEG is found
|
1043 |
|
1101 |
}// class Process
|
1102 |
|
1103 |
function kgvid_video_embed_enqueue_scripts() {
|
1104 |
+
$options = kgvid_get_options();
|
1105 |
|
1106 |
+
//Video.js styles
|
|
|
|
|
|
|
|
|
1107 |
if ( $options['embed_method'] != "WordPress Default" ) {
|
1108 |
+
wp_enqueue_style( 'video-js-css', plugins_url("", __FILE__).'/video-js/video-js.css', '', '4.4.3' );
|
|
|
1109 |
wp_enqueue_style( 'video-js-kg-skin', plugins_url("", __FILE__).'/video-js/kg-video-js-skin.css', '', $options['version'] );
|
1110 |
}
|
1111 |
|
1112 |
+
//plugin-related frontend styles
|
1113 |
wp_enqueue_style( 'kgvid_video_styles', plugins_url("/css/kgvid_styles.css", __FILE__), '', $options['version'] );
|
1114 |
+
|
|
|
|
|
1115 |
}
|
1116 |
add_action('wp_enqueue_scripts', 'kgvid_video_embed_enqueue_scripts', 12);
|
1117 |
|
1118 |
function enqueue_kgvid_script() { //loads plugin-related scripts in the admin area
|
1119 |
+
$options = kgvid_get_options();
|
1120 |
|
1121 |
+
wp_enqueue_script( 'kgvid_video_plugin_admin', plugins_url('/js/kgvid_video_plugin_admin.js', __FILE__), array('jquery'), $options['version'], true );
|
1122 |
wp_enqueue_style( 'video_embed_thumbnail_generator_style', plugins_url('/css/video-embed-thumbnail-generator_admin.css', __FILE__), '', $options['version'] );
|
1123 |
|
1124 |
+
wp_localize_script( 'kgvid_video_plugin_admin', 'kgvidL10n', array(
|
1125 |
+
'wait' => _x('Wait', 'please wait', 'video-embed-thumbnail-generator'),
|
1126 |
+
'hidevideo' => __('Hide video...', 'video-embed-thumbnail-generator'),
|
1127 |
+
'choosefromvideo' => __('Choose from video...', 'video-embed-thumbnail-generator'),
|
1128 |
+
'cantloadvideo' => __('Can\'t load video', 'video-embed-thumbnail-generator'),
|
1129 |
+
'choosethumbnail' => __('Choose Thumbnail:', 'video-embed-thumbnail-generator'),
|
1130 |
+
'saveallthumbnails' => __('Save All Thumbnails', 'video-embed-thumbnail-generator'),
|
1131 |
+
'saving' => __('Saving...', 'video-embed-thumbnail-generator'),
|
1132 |
+
'loading' => __('Loading...', 'video-embed-thumbnail-generator'),
|
1133 |
+
'generate' => __('Generate', 'video-embed-thumbnail-generator'),
|
1134 |
+
'randomize' => __('Randomize', 'video-embed-thumbnail-generator'),
|
1135 |
+
'ffmpegnotfound' => sprintf( __('%s not found', 'video-embed-thumbnail-generator'), strtoupper($options['video_app']) ),
|
1136 |
+
'validurlalert' => __("Please enter a URL that points to a valid video file. Video sharing sites are not supported by this plugin.\nTo embed from YouTube, Vimeo, etc, just paste the link directly into the post window and WordPress will handle the rest.", 'video-embed-thumbnail-generator'),
|
1137 |
+
'pleasevalidurl' => __('Please enter a valid video URL', 'video-embed-thumbnail-generator'),
|
1138 |
+
'deletemessage' => __("You are about to permanently delete the encoded video.\n 'Cancel' to stop, 'OK' to delete.", 'video-embed-thumbnail-generator'),
|
1139 |
+
'saved' => __('Saved.', 'video-embed-thumbnail-generator'),
|
1140 |
+
'runningtest' => __('Running test...', 'video-embed-thumbnail-generator'),
|
1141 |
+
'ffmpegrequired' => __('FFMPEG or LIBAV required for these functions.', 'video-embed-thumbnail-generator'),
|
1142 |
+
'featuredwarning' => __("You are about to set all existing video thumbnails previously generated by this plugin as the featured images for their posts. There is no 'undo' button, so proceed at your own risk.", 'video-embed-thumbnail-generator'),
|
1143 |
+
'cancel_ok' => __("'Cancel' to stop, 'OK' to proceed.", 'video-embed-thumbnail-generator'),
|
1144 |
+
'processing' => __('Processing...', 'video-embed-thumbnail-generator'),
|
1145 |
+
'parentwarning_posts' => __("You are about to set all existing video thumbnails previously generated by this plugin as attachments of their posts rather than their associated videos. Proceed at your own risk.", 'video-embed-thumbnail-generator'),
|
1146 |
+
'parentwarning_videos' => __("You are about to set all existing video thumbnails previously generated by this plugin as attachments of their videos rather than their associated posts. Proceed at your own risk.", 'video-embed-thumbnail-generator'),
|
1147 |
+
'complete' => __('Complete', 'video-embed-thumbnail-generator'),
|
1148 |
+
'tracktype' => __('Track type:', 'video-embed-thumbnail-generator'),
|
1149 |
+
'subtitles' => __('subtitles', 'video-embed-thumbnail-generator'),
|
1150 |
+
'captions' => __('captions', 'video-embed-thumbnail-generator'),
|
1151 |
+
'chapters' => __('chapters', 'video-embed-thumbnail-generator'),
|
1152 |
+
'choosetextfile' => __('Choose a Text File', 'video-embed-thumbnail-generator'),
|
1153 |
+
'settracksource' => __('Set as track source', 'video-embed-thumbnail-generator'),
|
1154 |
+
'choosefromlibrary' => __('Choose from Library', 'video-embed-thumbnail-generator'),
|
1155 |
+
'languagecode' => __('Language code:', 'video-embed-thumbnail-generator'),
|
1156 |
+
'label' => _x('Label:', 'noun', 'video-embed-thumbnail-generator')
|
1157 |
+
) );
|
1158 |
+
|
1159 |
}
|
1160 |
add_action('admin_enqueue_scripts', 'enqueue_kgvid_script');
|
1161 |
|
1175 |
global $wpdb;
|
1176 |
$posts = $wp_query->posts;
|
1177 |
$pattern = get_shortcode_regex();
|
1178 |
+
$options = kgvid_get_options();
|
1179 |
+
|
1180 |
+
wp_register_script( 'kgvid_video_embed', plugins_url("/js/kgvid_video_embed.js", __FILE__), array('jquery'), $options['version'], true );
|
1181 |
+
wp_register_script( 'video-js', plugins_url("", __FILE__).'/video-js/video.js', '', '4.4.3', true );
|
1182 |
+
wp_register_script( 'simplemodal', plugins_url("/js/jquery.simplemodal.1.4.5.min.js", __FILE__), '', '1.4.5', true );
|
1183 |
+
|
1184 |
+
wp_localize_script( 'kgvid_video_embed', 'kgvid_ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'ajax_nonce' => wp_create_nonce('kgvid_frontend_nonce') ) ); // setting ajaxurl
|
1185 |
+
|
1186 |
+
wp_localize_script( 'kgvid_video_embed', 'kgvidL10n_frontend', array(
|
1187 |
+
'playstart' => _x("Play Start", 'noun for Google Analytics event', 'video-embed-thumbnail-generator'),
|
1188 |
+
'completeview' => _x("Complete View", 'noun for Google Analytics event', 'video-embed-thumbnail-generator'),
|
1189 |
+
'next' => _x("Next", 'button text to play next video', 'video-embed-thumbnail-generator'),
|
1190 |
+
'previous' => _x("Previous", 'button text to play previous video', 'video-embed-thumbnail-generator')
|
1191 |
+
) );
|
1192 |
+
|
1193 |
+
echo '<script type="text/javascript">document.createElement(\'video\');document.createElement(\'audio\');</script>'."\n";
|
1194 |
+
|
1195 |
+
if ( !empty($posts) && is_array($posts) ) {
|
1196 |
+
foreach ( $posts as $post ) {
|
1197 |
+
if ( $options['open_graph'] == "on"
|
1198 |
+
&& preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
|
1199 |
+
&& is_array($matches)
|
1200 |
+
&& array_key_exists( 2, $matches ) && array_key_exists( 5, $matches )
|
1201 |
+
&& !empty($matches[5][0])
|
1202 |
+
&& ( in_array( 'KGVID', $matches[2] ) || in_array( 'FMP', $matches[2] ) ) ) { //if KGVID or FMP shortcode is in posts on this page.
|
1203 |
+
|
1204 |
+
echo '<meta property="og:video" content="'.$matches[5][0].'" />'."\n";
|
1205 |
+
|
1206 |
+
if ( array_key_exists( 3, $matches ) ) {
|
1207 |
+
$attributes = shortcode_parse_atts($matches[3][0]);
|
1208 |
+
if ( is_array($attributes) && array_key_exists( 'width', $attributes ) ) {
|
1209 |
+
echo '<meta property="og:video:width" content="'.$attributes['width'].'" />'."\n";
|
1210 |
+
if ( array_key_exists( 'height', $attributes ) ) {
|
1211 |
+
echo '<meta property="og:video:height" content="'.$attributes['height'].'" />'."\n";
|
1212 |
+
}
|
1213 |
}
|
1214 |
}
|
1215 |
+
break;
|
1216 |
+
}//end if shortcode is in post
|
1217 |
+
}//end post loop
|
1218 |
+
}//end if posts
|
1219 |
|
1220 |
}
|
1221 |
add_action('wp_head', 'kgvid_video_embed_print_scripts', 99);
|
1222 |
|
1223 |
+
function kgvid_print_vidojs_footer() { //called by the shortcode if Video.js is used
|
1224 |
+
|
1225 |
+
echo '<script type="text/javascript">if(typeof videojs !== "undefined") { videojs.options.flash.swf = "'.plugins_url("", __FILE__).'/video-js/video-js.swf?4.4.0"; }</script>'."\n";
|
1226 |
+
|
1227 |
+
}
|
1228 |
+
|
1229 |
function kgvid_shortcode_atts($atts) {
|
1230 |
|
1231 |
+
$options = kgvid_get_options();
|
1232 |
|
1233 |
if ( in_the_loop() ) { $post_ID = get_the_ID(); }
|
1234 |
else { $post_ID = 1; }
|
1236 |
$query_atts = shortcode_atts(
|
1237 |
array(
|
1238 |
'id' => '',
|
1239 |
+
'orderby' => 'menu_order',
|
1240 |
+
'order' => 'ASC',
|
1241 |
'videos' => -1,
|
1242 |
'width' => $options['width'],
|
1243 |
'height' => $options['height'],
|
1263 |
'gallery_exclude' => '',
|
1264 |
'gallery_include' => '',
|
1265 |
'gallery_id' => $post_ID,
|
1266 |
+
'gallery_end' => '',
|
1267 |
'volume' => '',
|
1268 |
'title' => $options['overlay_title'],
|
1269 |
'embedcode' => $options['overlay_embedcode'],
|
1271 |
'caption' => '',
|
1272 |
'description' => '',
|
1273 |
'inline' => $options['inline'],
|
1274 |
+
'downloadlink' => $options['downloadlink'],
|
1275 |
'right_click' => $options['right_click'],
|
1276 |
+
'resize' => $options['resize'],
|
1277 |
+
'track_kind' => 'subtitles',
|
1278 |
+
'track_srclang' => substr(get_bloginfo('language'), 0, 2),
|
1279 |
+
'track_src' => '',
|
1280 |
+
'track_label' => get_bloginfo('language')
|
1281 |
), $atts);
|
1282 |
|
1283 |
+
$checkbox_convert = array ( "autohide", "endofvideooverlaysame", "playbutton", "loop", "autoplay", "title", "embedcode", "view_count", "inline", "resize", "downloadlink");
|
1284 |
foreach ( $checkbox_convert as $query ) {
|
1285 |
if ( $query_atts[$query] == "on" ) { $query_atts[$query] = "true"; }
|
1286 |
if ( $query_atts[$query] == false ) { $query_atts[$query] = "false"; }
|
1287 |
}
|
1288 |
|
1289 |
if ( $options['js_skin'] == "" ) { $options['js_skin'] = "vjs-default-skin"; }
|
1290 |
+
if ( is_array($atts) && array_key_exists('skin', $atts) ) {
|
1291 |
+
$options['js_skin'] = $atts['skin']; //allows user to set skin for individual videos using the skin="" attribute
|
1292 |
}
|
1293 |
|
1294 |
return $query_atts;
|
1300 |
global $content_width;
|
1301 |
$content_width_save = $content_width;
|
1302 |
|
1303 |
+
$code = "";
|
1304 |
+
if ( !is_feed() ) {
|
|
|
|
|
|
|
1305 |
|
1306 |
+
$options = kgvid_get_options();
|
1307 |
|
1308 |
+
if ( $options['embed_method'] != "WordPress Default" ) {
|
1309 |
+
wp_enqueue_script( 'video-js' );
|
1310 |
+
add_action('wp_footer', 'kgvid_print_vidojs_footer', 99);
|
1311 |
+
}
|
1312 |
|
1313 |
+
if ( $options['embed_method'] == "Strobe Media Playback" ) {
|
1314 |
+
wp_enqueue_script( 'swfobject' );
|
1315 |
+
}
|
1316 |
|
1317 |
+
wp_enqueue_script( 'kgvid_video_embed' );
|
1318 |
+
|
1319 |
+
if ( in_the_loop() ) { $post_ID = get_the_ID(); }
|
1320 |
+
else { $post_ID = 1; }
|
1321 |
+
|
1322 |
+
$query_atts = kgvid_shortcode_atts($atts);
|
1323 |
+
|
1324 |
+
if ( $query_atts["gallery"] != "true" ) { //if this is not a pop-up gallery
|
1325 |
+
|
1326 |
+
if ( empty($content) ) {
|
1327 |
+
if ( !empty($query_atts["id"]) ) {
|
1328 |
+
$id_array[0] = $query_atts["id"];
|
1329 |
+
}
|
1330 |
+
elseif ( $post_ID != 1 ) {
|
1331 |
+
$args = array(
|
1332 |
+
'numberposts' => $query_atts['videos'],
|
1333 |
+
'post_mime_type' => 'video',
|
1334 |
+
'post_parent' => $post_ID,
|
1335 |
+
'post_status' => null,
|
1336 |
+
'post_type' => 'attachment',
|
1337 |
+
'orderby' => $query_atts['orderby'],
|
1338 |
+
'order' => $query_atts['order']
|
1339 |
+
);
|
1340 |
+
$video_attachments = get_posts($args);
|
1341 |
+
if ( $video_attachments ) {
|
1342 |
+
foreach ( $video_attachments as $video ) {
|
1343 |
+
$id_array[] = $video->ID;
|
1344 |
+
}
|
1345 |
}
|
1346 |
+
else { return; } //if there are no video children of the current post
|
1347 |
}
|
1348 |
+
else { return; } //if there's no post ID and no $content
|
1349 |
+
}
|
1350 |
+
else { // $content is a URL
|
1351 |
+
// workaround for relative video URL (contributed by Lee Fernandes)
|
1352 |
+
if(substr($content, 0, 1) == '/') $content = get_bloginfo('url').$content;
|
1353 |
+
$content = trim($content);
|
1354 |
+
$guid_convert = substr(str_replace(' ', '', $content), 12 );
|
1355 |
+
global $wpdb;
|
1356 |
+
$query = $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE guid LIKE '%%%s'", $guid_convert); //GUID seems to be the only way to get a video URL
|
1357 |
+
$id_array[0] = $wpdb->get_var($query);
|
1358 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1359 |
|
1360 |
+
$original_content = $content;
|
1361 |
|
1362 |
+
foreach ( $id_array as $id ) { //loop through videos
|
1363 |
|
1364 |
+
$query_atts = kgvid_shortcode_atts($atts); //reset values so they can be different with multiple videos
|
1365 |
+
$content = $original_content;
|
1366 |
+
$sources = array();
|
1367 |
|
1368 |
+
$compatible = array("flv", "f4v", "mp4", "mov", "m4v", "ogv", "ogg", "webm");
|
1369 |
+
$h264compatible = array("mp4", "mov", "m4v");
|
|
|
1370 |
|
1371 |
+
if ( !empty($id) ) { //if the video is an attachment in the WordPress db
|
1372 |
|
1373 |
+
if ( empty($content) ) {
|
1374 |
+
$content = wp_get_attachment_url($id);
|
1375 |
+
if ( $content == false ) { echo "Invalid video ID"; continue; }
|
1376 |
+
}
|
1377 |
|
1378 |
+
$div_suffix = $id;
|
1379 |
+
$encodevideo_info = kgvid_encodevideo_info($content, $id);
|
1380 |
+
$attachment_info = get_post( $id );
|
1381 |
|
1382 |
+
if ( empty($atts['width']) ) {
|
1383 |
+
$dimensions = kgvid_set_video_dimensions($id);
|
1384 |
+
$query_atts['width'] = $dimensions['width'];
|
1385 |
+
$query_atts['height'] = $dimensions['height'];
|
1386 |
+
}
|
1387 |
|
1388 |
+
$poster_id = get_post_meta($id, '_kgflashmediaplayer-poster-id', true);
|
1389 |
+
if ( !empty($poster_id) ) {
|
1390 |
+
$poster_image_src = wp_get_attachment_image_src($poster_id, 'full');
|
1391 |
+
if ( empty($query_atts['poster']) ) { $query_atts['poster'] = $poster_image_src[0]; } //if there's no poster URL set, use the database to set it automatically
|
1392 |
+
if ( $poster_image_src[0] == $query_atts['poster'] && intval($query_atts['width']) <= get_option('medium_size_h') ) {
|
1393 |
+
$query_atts['poster'] = kgvid_get_attachment_medium_url($poster_id);
|
1394 |
+
}
|
1395 |
}
|
|
|
1396 |
|
1397 |
+
if ( $query_atts['title'] == "true" ) {
|
1398 |
+
$query_atts['title'] = $attachment_info->post_title;
|
1399 |
+
$stats_title = $query_atts['title'];
|
1400 |
+
}
|
1401 |
+
else { $stats_title = $attachment_info->post_title; }
|
1402 |
+
if ( empty($query_atts['caption']) ) { $query_atts['caption'] = $attachment_info->post_excerpt; }
|
1403 |
+
if ( empty($query_atts['description']) ) { $query_atts['description'] = $attachment_info->post_content; }
|
1404 |
|
1405 |
+
$countable = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
1406 |
}
|
1407 |
+
else { //video is not in the database
|
1408 |
+
$div_suffix = substr(uniqid(rand(), true),0,4);
|
1409 |
+
$encodevideo_info = kgvid_encodevideo_info($content, $post_ID); //send the id of the post the video's embedded in
|
1410 |
+
if ( $query_atts['title'] == "true" ) {
|
1411 |
+
$query_atts['title'] = "false";
|
1412 |
+
}
|
1413 |
+
$stats_title = basename($content);
|
1414 |
+
if ( $query_atts['embedcode'] == "true" ) {
|
1415 |
+
$query_atts['embedcode'] = "false"; //can't use embed code with videos that are not in the database
|
1416 |
+
}
|
1417 |
+
|
1418 |
+
$countable = false;
|
1419 |
}
|
1420 |
|
1421 |
+
$moviefiletype = pathinfo($content, PATHINFO_EXTENSION);
|
1422 |
+
if ( $moviefiletype == "mov" || $moviefiletype == "m4v" ) { $moviefiletype = "mp4"; }
|
1423 |
|
1424 |
+
$video_formats = kgvid_video_formats();
|
1425 |
+
unset($video_formats['fullres']);
|
1426 |
+
$video_formats['original'] = array( "type" => $moviefiletype, "name" => "Full" );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1427 |
|
1428 |
+
if ( in_array($moviefiletype, $compatible) ) {
|
1429 |
+
$encodevideo_info["original_exists"] = true;
|
1430 |
+
$encodevideo_info["originalurl"] = $content;
|
1431 |
+
}
|
1432 |
+
else { $encodevideo_info["original_exists"] = false; }
|
1433 |
+
|
1434 |
+
if($query_atts["endofvideooverlaysame"] == "true") { $query_atts["endofvideooverlay"] = $query_atts["poster"]; }
|
1435 |
|
1436 |
+
if ( $options['embed_method'] == "Strobe Media Playback" ) {
|
1437 |
|
1438 |
+
$flash_settings = kgvid_generate_flashvars($content, $query_atts, $encodevideo_info, $div_suffix);
|
1439 |
|
1440 |
+
} //if Strobe Media Playback
|
|
|
1441 |
|
1442 |
+
if ( $query_atts['inline'] == "true" ) {
|
1443 |
+
$aligncode = ' kgvid_wrapper_inline';
|
1444 |
+
if ( $query_atts['align'] == "left" ) { $aligncode .= ' kgvid_wrapper_inline_left'; }
|
1445 |
+
if ( $query_atts['align'] == "center" ) { $aligncode .= ' kgvid_wrapper_auto_left kgvid_wrapper_auto_right'; }
|
1446 |
+
if ( $query_atts['align'] == "right" ) { $aligncode .= ' kgvid_wrapper_inline_right'; }
|
1447 |
}
|
1448 |
else {
|
1449 |
+
if ( $query_atts['align'] == "left" ) { $aligncode = ''; }
|
1450 |
+
if ( $query_atts['align'] == "center" ) { $aligncode = ' kgvid_wrapper_auto_left kgvid_wrapper_auto_right'; }
|
1451 |
+
if ( $query_atts['align'] == "right" ) { $aligncode = ' kgvid_wrapper_auto_left'; }
|
1452 |
+
}
|
1453 |
+
|
1454 |
+
$code .= '<div id="kgvid_'.$div_suffix.'_wrapper" class="kgvid_wrapper'.$aligncode.'">'."\n\t\t\t";
|
1455 |
+
$code .= '<div id="video_'.$div_suffix.'_div" class="kgvid_videodiv" data-id="'.$div_suffix.'" itemscope itemtype="http://schema.org/VideoObject">';
|
1456 |
+
if ( $query_atts["poster"] != '' ) { $code .= '<meta itemprop="thumbnailURL" content="'.esc_attr($query_atts["poster"]).'" />'; }
|
1457 |
+
if ( !empty($id) ) { $schema_embedURL = site_url('/')."?attachment_id=".$id."&kgvid_video_embed[enable]=true"; }
|
1458 |
+
else { $schema_embedURL = $content; }
|
1459 |
+
$code .= '<meta itemprop="embedURL" content="'.esc_attr($schema_embedURL).'" />';
|
1460 |
+
|
1461 |
+
if ( !empty($query_atts['title']) ) { $code .= '<meta itemprop="name" content="'.esc_attr($query_atts['title']).'" />'; }
|
1462 |
+
if ( !empty($query_atts['description']) ) { $description = $query_atts['description']; }
|
1463 |
+
elseif ( !empty($query_atts['caption']) ) { $description = $query_atts['caption']; }
|
1464 |
+
else { $description = ""; }
|
1465 |
+
if ( !empty($description) ) { $code .= '<meta itemprop="description" content="'.esc_attr($description).'" />'; }
|
1466 |
+
|
1467 |
+
$track_keys = array('kind', 'srclang', 'src', 'label');
|
1468 |
+
$track_option = get_post_meta($id, "_kgflashmediaplayer-track", true);
|
1469 |
+
if ( !is_array($track_option) ) {
|
1470 |
+
$track_option = array();
|
1471 |
+
$track_option[0] = array ( 'kind' => '', 'srclang' => '', 'src' => '', 'label' => '' );
|
1472 |
+
}
|
1473 |
+
foreach ( $track_keys as $key ) {
|
1474 |
+
if ( empty($track_option[0][$key]) ) { $track_option[0][$key] = $query_atts['track_'.$key]; }
|
1475 |
+
}
|
1476 |
+
|
1477 |
+
$track_code = "";
|
1478 |
+
if ( !empty($track_option[0]['src']) ) {
|
1479 |
+
foreach ( $track_option as $track => $track_attribute ) {
|
1480 |
+
foreach ( $track_attribute as $attribute => $value ) {
|
1481 |
+
if ( empty($value) ) { $track_attribute[$attribute] = $query_atts['track_'.$attribute]; }
|
1482 |
}
|
1483 |
+
if ( $options['embed_method'] == "WordPress Default" && $track_attribute['kind'] == 'captions' ) { $track_attribute['kind'] = 'subtitles'; }
|
1484 |
+
$track_code .= "\t\t\t\t\t<track kind='".esc_attr($track_attribute['kind'])."' src='".esc_attr($track_attribute['src'])."' srclang='".esc_attr($track_attribute['srclang'])."' label='".esc_attr($track_attribute['label'])."' />\n";
|
1485 |
}
|
1486 |
}
|
1487 |
+
|
1488 |
+
if ( $options['embed_method'] == "WordPress Default" ) {
|
1489 |
+
$wp_shortcode = "[video ";
|
1490 |
+
$mp4already = false;
|
1491 |
+
$sources_hack = "";
|
1492 |
+
foreach ($video_formats as $format => $format_stats) {
|
1493 |
+
if ( $format != "original" && $encodevideo_info[$format."url"] == $content ) { unset($sources['original']); }
|
1494 |
+
if ( $encodevideo_info[$format."_exists"] ) {
|
1495 |
+
if ( $format_stats['type'] != "mp4" || !$mp4already ) {
|
1496 |
+
$shortcode_type = wp_check_filetype( $encodevideo_info[$format."url"], wp_get_mime_types() );
|
1497 |
+
$sources[$format] = $shortcode_type['ext'].'="'.$encodevideo_info[$format."url"].'" ';
|
1498 |
+
if ( $format_stats['type'] == "mp4" ) { //WordPress built-in shortcode doesn't support multiple videos of the same type but we'll hack it in later
|
1499 |
+
$search_string = '<source type="video/mp4" src="'.esc_attr($encodevideo_info[$format."url"]).'" />';
|
1500 |
+
$mp4already = true;
|
1501 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1502 |
}
|
1503 |
+
else { $sources_hack .= '<source type="video/'.$format_stats['type'].'" src="'.esc_attr($encodevideo_info[$format."url"]).'" />'; }
|
1504 |
}
|
|
|
1505 |
}
|
|
|
1506 |
|
1507 |
+
$wp_shortcode .= implode($sources);
|
1508 |
+
if ( $query_atts["poster"] != '' ) { $wp_shortcode .= 'poster="'.esc_attr($query_atts["poster"]).'" '; }
|
1509 |
+
$wp_shortcode .= 'width='.$query_atts["width"].' height='.$query_atts["height"].' ';
|
1510 |
+
if ( $query_atts["loop"] == 'true') { $wp_shortcode .= 'loop="true" '; }
|
1511 |
+
if ( $query_atts["autoplay"] == 'true') { $wp_shortcode .= 'autoplay="true" '; }
|
1512 |
+
$wp_shortcode .= "]";
|
1513 |
+
$content_width = $query_atts['width'];
|
1514 |
+
$executed_shortcode = do_shortcode($wp_shortcode);
|
1515 |
+
$content_width = $content_width_save;
|
1516 |
+
if ( $sources_hack ) { //insert remaining mp4 sources manually
|
1517 |
+
$position = strpos($executed_shortcode, $search_string) + strlen($search_string);
|
1518 |
+
$executed_shortcode = substr_replace( $executed_shortcode, $sources_hack, $position, 0 );
|
1519 |
+
}
|
1520 |
+
if ( !empty($track_code) ) { //insert track code manually
|
1521 |
+
$position = strpos($executed_shortcode, '</video>');
|
1522 |
+
$executed_shortcode = substr_replace( $executed_shortcode, $track_code, $position, 0 );
|
1523 |
+
}
|
1524 |
+
$code .= $executed_shortcode;
|
1525 |
}
|
|
|
|
|
1526 |
|
1527 |
+
if ( $options['embed_method'] == "JW Player" ) {
|
1528 |
+
|
1529 |
+
if ( class_exists('JWP6_Shortcode') ) {
|
1530 |
+
|
1531 |
+
$jw_video_formats = array( 'mobile' => '480p',
|
1532 |
+
'720' => '720p',
|
1533 |
+
'1080' => '1080p',
|
1534 |
+
'original' => 'Full',
|
1535 |
+
'webm' => 'WEBM',
|
1536 |
+
'ogg' => 'OGV'
|
1537 |
+
);
|
1538 |
+
foreach ($jw_video_formats as $format => $name) {
|
1539 |
+
if ( $format != "original" && $encodevideo_info[$format."url"] == $content ) { unset($sources['original']); }
|
1540 |
+
if ( $encodevideo_info[$format."_exists"] ) {
|
1541 |
+
$sources[$format] = '{ file:\''.esc_attr($encodevideo_info[$format."url"]).'\', label:\''.$name.'\'';
|
1542 |
+
if ( $format == "original" ) { $sources[$format] .= ', default:\'true\''; }
|
1543 |
+
$sources[$format] .= '}';
|
1544 |
+
}
|
1545 |
+
}
|
1546 |
+
|
1547 |
+
$jw_tracks = array();
|
1548 |
+
if ( !empty($track_option[0]['src']) ) {
|
1549 |
+
foreach ( $track_option as $track => $track_attribute ) {
|
1550 |
+
foreach ( $track_attribute as $attribute => $value ) {
|
1551 |
+
if ( empty($value) ) { $track_attribute[$attribute] = $query_atts['track_'.$attribute]; }
|
1552 |
+
}
|
1553 |
+
$jw_tracks[] = '{ file:\''.esc_attr($track_attribute['src']).'\', kind:\''.esc_attr($track_attribute['kind']).'\', label:\''.esc_attr($track_attribute['label']).'\'}';
|
1554 |
+
}
|
1555 |
+
}
|
1556 |
+
|
1557 |
+
$jw_shortcode = "[jwplayer ";
|
1558 |
+
$jw_shortcode .= 'sources="'.implode(',', $sources).'" ';
|
1559 |
+
$jw_shortcode .= 'tracks="'.implode(',', $jw_tracks).'" ';
|
1560 |
+
if ( $query_atts["poster"] != '' ) { $jw_shortcode .= 'image="'.esc_attr($query_atts["poster"]).'" '; }
|
1561 |
+
if ( $query_atts["loop"] == 'true' ) { $jw_shortcode .= 'repeat="true" '; }
|
1562 |
+
if ( $query_atts["autoplay"] == 'true' ) { $jw_shortcode .= 'autostart="true" '; }
|
1563 |
+
if ( $query_atts["controlbar"] == 'none') { $jw_shortcode .= 'controls="false" '; }
|
1564 |
+
if ( $query_atts['title'] != "false" ) { $jw_shortcode .= ' title="'.$query_atts['title'].'" '; }
|
1565 |
+
if ( $options['jw_player_id'] != "") {
|
1566 |
+
$jw_player_config = get_option('jwp6_player_config_'.$options['jw_player_id']);
|
1567 |
+
if ( !empty($jw_player_config) ) { $jw_shortcode .= ' player="'.$options['jw_player_id'].'" '; }
|
1568 |
+
}
|
1569 |
+
|
1570 |
+
$jw_shortcode = trim($jw_shortcode);
|
1571 |
+
$jw_shortcode .= ']';
|
1572 |
+
|
1573 |
+
$executed_shortcode = do_shortcode($jw_shortcode); //just in case the shortcode is active
|
1574 |
+
//this is JW Player's hack for executing without registering a WP shortcode
|
1575 |
+
$tag_regex = '/(.?)\[(jwplayer)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)/s';
|
1576 |
+
$executed_shortcode = preg_replace_callback($tag_regex, array("JWP6_Shortcode", "tag_parser"), $jw_shortcode);
|
1577 |
+
|
1578 |
+
$code .= $executed_shortcode;
|
1579 |
+
|
1580 |
+
}// if class exists
|
1581 |
+
else { $options['embed_method'] = "Video.js"; }
|
1582 |
|
|
|
|
|
|
|
1583 |
}
|
1584 |
|
1585 |
+
if ( $options['embed_method'] == "Video.js" || $options['embed_method'] == "Strobe Media Playback" ) {
|
1586 |
+
|
1587 |
+
foreach ($video_formats as $format => $format_stats) {
|
1588 |
+
if ( $format != "original" && $encodevideo_info[$format."url"] == $content ) { unset($sources['original']); }
|
1589 |
+
if ( $encodevideo_info[$format."_exists"] ) { $sources[$format] = "\t\t\t\t\t".'<source src="'.esc_attr($encodevideo_info[$format."url"]).'" type="video/'.$format_stats['type'].'">'."\n"; }
|
1590 |
+
}
|
|
|
|
|
|
|
1591 |
|
1592 |
+
$code .= '<video id="video_'.$div_suffix.'" ';
|
1593 |
+
if ( $query_atts["loop"] == 'true') { $code .= 'loop '; }
|
1594 |
+
if ( $query_atts["autoplay"] == 'true') { $code .= 'autoplay '; }
|
1595 |
+
if ( $query_atts["controlbar"] != 'none') { $code .= 'controls '; }
|
1596 |
+
$code .= 'preload="'.$options['preload'].'" ';
|
1597 |
+
if ( $query_atts["poster"] != '' ) { $code .= 'poster="'.esc_attr($query_atts["poster"]).'" '; }
|
1598 |
+
$code .= 'width="'.$query_atts["width"].'" height="'.esc_attr($query_atts["height"]).'"';
|
1599 |
+
$code .= ' class="'.esc_attr('video-js '.$options['js_skin']).'" data-setup=\'{}\'';
|
1600 |
+
$code .= ">\n";
|
1601 |
|
1602 |
+
$code .= implode("", $sources); //add the <source> tags created earlier
|
1603 |
+
$code .= $track_code; //if there's a text track
|
1604 |
+
$code .= "\t\t\t\t</video>\n";
|
1605 |
|
1606 |
+
}
|
1607 |
+
$code .= "\t\t\t</div>\n";
|
1608 |
+
$show_views = false;
|
1609 |
+
if ( !empty($id) || !empty($query_atts['caption']) || $query_atts['downloadlink'] == "true" || $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { //generate content below the video
|
1610 |
+
$view_count = number_format(intval(get_post_meta($id, "_kgflashmediaplayer-starts", true)));
|
1611 |
+
if ( empty($view_count) ) { $view_count = "0"; }
|
1612 |
+
if ( $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { $view_count = "XX"; }
|
1613 |
+
if ( $query_atts['view_count'] == "true" ) { $show_views = true; }
|
1614 |
+
if ( !empty($query_atts['caption']) || $show_views || $query_atts['downloadlink'] == "true" ) {
|
1615 |
+
$code .= "\t\t\t".'<div class="kgvid_below_video" id="video_'.$div_suffix.'_below">';
|
1616 |
+
if ( $show_views ) { $code .= '<div class="kgvid-viewcount" id="video_'.$div_suffix.'_viewcount">'.sprintf( _n( '%s view', '%s views', intval(str_replace(',', '', $view_count)) , 'video-embed-thumbnail-generator'), $view_count ).'</div>'; }
|
1617 |
+
if ( !empty($query_atts['caption']) || $query_atts['downloadlink'] == "true" ) {
|
1618 |
+
$code .= '<div class="kgvid-caption" id="video_'.$div_suffix.'_caption">'.$query_atts['caption'];
|
1619 |
+
if ( $query_atts['downloadlink'] == "true" ) {
|
1620 |
+
if ( !empty($query_atts['caption']) ) { $code .= '<br>'; }
|
1621 |
+
$code .= '<a href="'.$content.'">'.__('Right-click or ctrl-click on this link to download', 'video-embed-thumbnail-generator').'</a>';
|
1622 |
+
}
|
1623 |
+
$code .= '</div>';
|
1624 |
}
|
1625 |
$code .= '</div>';
|
1626 |
}
|
|
|
1627 |
}
|
|
|
1628 |
|
1629 |
+
if ( ( $query_atts['title'] != "false" && $options['embed_method'] != "JW Player" )
|
1630 |
+
|| $query_atts['embedcode'] != "false" ) { //generate content overlaid on video
|
1631 |
+
$kgvid_meta = true;
|
1632 |
+
$code .= "\t\t\t<div style=\"display:none;\" id=\"video_".$div_suffix."_meta\" class=\"kgvid_video_meta kgvid_video_meta_hover\">\n";
|
1633 |
+
if ( $query_atts['embedcode'] != "false" ) {
|
1634 |
+
if ( $query_atts['embedcode'] == "true" ) { $iframeurl = site_url('/')."?attachment_id=".$id."&kgvid_video_embed[enable]=true"; }
|
1635 |
+
else { $iframeurl = $query_atts['embedcode']; }
|
1636 |
+
$iframecode = "<iframe src='".$iframeurl."' frameborder='0' scrolling='no' width='".esc_attr($query_atts['width'])."' height='".esc_attr($query_atts["height"])."'></iframe>";
|
1637 |
+
$code .= "\t\t\t\t<div id=\"video_".$div_suffix."_embed\" class=\"kgvid_share\"><span>"._x('Embed:', 'precedes code for embedding video', 'video-embed-thumbnail-generator')." </span><input type=\"text\" value=\"".esc_attr($iframecode)."\" onClick=\"this.select();\"></div>\n";
|
1638 |
+
}
|
1639 |
+
if ( $query_atts['title'] != "false" && $options['embed_method'] != "JW Player" ) {
|
1640 |
+
$code .= "\t\t\t\t<div id='video_".$div_suffix."_title' class='kgvid_title'>".$query_atts['title']."</div>\n";
|
1641 |
+
}
|
1642 |
+
$code .= "\t\t\t</div>\n";
|
1643 |
}
|
1644 |
+
else { $kgvid_meta = false; }
|
1645 |
+
if ( !empty($query_atts["watermark"]) && $query_atts["watermark"] != "false" ) { $code .= "<div style=\"display:none;\" id='video_".$div_suffix."_watermark' class='kgvid_watermark'><img src='".esc_attr($query_atts["watermark"])."' alt='watermark'></div>"; } //generate watermark
|
1646 |
+
$code .= "\t\t</div>"; //end kgvid_XXXX_wrapper div
|
1647 |
+
|
1648 |
+
$video_variables = array(
|
1649 |
+
'id' => $div_suffix,
|
1650 |
+
'player_type' => $options['embed_method'],
|
1651 |
+
'width' => $query_atts['width'],
|
1652 |
+
'height' => $query_atts['height'],
|
1653 |
+
'countable' => $countable,
|
1654 |
+
'autoplay' => $query_atts['autoplay'],
|
1655 |
+
'set_volume' => $query_atts["volume"],
|
1656 |
+
'meta' => $kgvid_meta,
|
1657 |
+
'endofvideooverlay' => $query_atts['endofvideooverlay'],
|
1658 |
+
'resize' => $query_atts['resize'],
|
1659 |
+
'right_click' => $query_atts['right_click']
|
1660 |
+
);
|
|
|
|
|
|
|
1661 |
|
1662 |
+
if ( $options['embed_method'] == "Strobe Media Playback" && $flash_settings['flash_source_found'] ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1663 |
|
1664 |
+
$video_variables['swfurl'] = plugins_url('', __FILE__)."/flash/StrobeMediaPlayback.swf";
|
1665 |
+
$video_variables['expressinstallswfurl'] = plugins_url("", __FILE__)."/flash/expressInstall.swf";
|
1666 |
+
$video_variables['flashvars'] = $flash_settings['flashvars'];
|
1667 |
+
$video_variables['params'] = $flash_settings['params'];
|
1668 |
|
1669 |
+
} //if Strobe Media
|
1670 |
|
1671 |
+
wp_localize_script( 'kgvid_video_embed', 'kgvid_video_vars_'.$div_suffix, $video_variables ); //add video variables in footer
|
1672 |
|
1673 |
+
} //end id_array loop
|
1674 |
|
1675 |
+
} //if not gallery
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1676 |
|
1677 |
+
else { //if gallery
|
1678 |
|
1679 |
+
wp_enqueue_script( 'simplemodal' );
|
1680 |
|
1681 |
+
static $kgvid_gallery_id = 0;
|
|
|
|
|
|
|
|
|
1682 |
|
1683 |
+
$args = array(
|
1684 |
+
'post_type' => 'attachment',
|
1685 |
+
'orderby' => $query_atts['gallery_orderby'],
|
1686 |
+
'order' => $query_atts['gallery_order'],
|
1687 |
+
'post_mime_type' => 'video',
|
1688 |
+
'numberposts' => -1,
|
1689 |
+
'post_status' => null,
|
1690 |
+
'post_parent' => $query_atts['gallery_id'],
|
1691 |
+
'exclude' => $query_atts['gallery_exclude']
|
1692 |
+
);
|
1693 |
+
if ( !empty($query_atts['gallery_include']) ) {
|
1694 |
+
$args['include'] = $query_atts['gallery_include'];
|
1695 |
+
unset($args['post_parent']);
|
1696 |
}
|
1697 |
+
$attachments = get_posts($args);
|
1698 |
+
if ($attachments) {
|
1699 |
+
if ( $query_atts['align'] == "left" ) { $aligncode = ''; }
|
1700 |
+
if ( $query_atts['align'] == "center" ) { $aligncode = ' kgvid_textalign_center'; }
|
1701 |
+
if ( $query_atts['align'] == "right" ) { $aligncode = ' kgvid_textalign_right'; }
|
1702 |
+
$div_suffix = substr(uniqid(rand(), true),0,4);
|
1703 |
+
$code .= '<div class="kgvid_gallerywrapper'.$aligncode.'" id="kgvid_gallery_'.$kgvid_gallery_id.'">';
|
1704 |
+
foreach ( $attachments as $attachment ) {
|
1705 |
+
$thumbnail_url = get_post_meta($attachment->ID, "_kgflashmediaplayer-poster", true);
|
1706 |
+
$poster_id = get_post_meta($attachment->ID, '_kgflashmediaplayer-poster-id', true);
|
1707 |
+
if ( !empty($poster_id) && intval($query_atts['gallery_thumb']) <= get_option('medium_size_h') ) {
|
1708 |
+
$poster_post = get_post($poster_id);
|
1709 |
+
if ( $poster_post->guid == $thumbnail_url ) {
|
1710 |
+
$thumbnail_url = kgvid_get_attachment_medium_url($poster_id);
|
1711 |
+
} //use the "medium" size image if available
|
1712 |
+
}
|
1713 |
+
if (!$thumbnail_url) { $thumbnail_url = $options['poster']; } //use the default poster if no thumbnail set
|
1714 |
+
if (!$thumbnail_url) { $thumbnail_url = plugins_url('/images/nothumbnail.jpg', __FILE__);} //use the blank image if no other option
|
1715 |
|
1716 |
+
$downloadlink = get_post_meta($attachment->ID, "_kgflashmediaplayer-downloadlink", true);
|
1717 |
+
if ( empty($query_atts['caption']) ) { $query_atts['caption'] = $attachment->post_excerpt; }
|
1718 |
+
$below_video = 0;
|
1719 |
+
if ( !empty($query_atts['caption']) ) { $below_video = 1; }
|
1720 |
+
if ( $downloadlink == "checked" ) { ++$below_video; }
|
1721 |
+
|
1722 |
+
if ( $options['embed_method'] == "WordPress Default" ) {
|
1723 |
+
|
1724 |
+
$library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
|
1725 |
+
if ( 'mediaelement' === $library && did_action( 'init' ) ) {
|
1726 |
+
wp_enqueue_style( 'wp-mediaelement' );
|
1727 |
+
wp_enqueue_script( 'wp-mediaelement' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1728 |
}
|
|
|
|
|
1729 |
|
1730 |
+
$play_button_class = "mejs-overlay-button";
|
1731 |
+
$play_scale = strval( round(intval($query_atts["gallery_thumb"])/400,2) );
|
1732 |
+
$play_translate = 5;
|
1733 |
+
}
|
1734 |
+
else {
|
1735 |
+
$play_button_class = "vjs-big-play-button";
|
1736 |
+
$play_scale = strval( round(intval($query_atts["gallery_thumb"])/600,2) );
|
1737 |
+
$play_translate = 30;
|
1738 |
+
}
|
1739 |
+
|
1740 |
+
$dimensions = kgvid_set_video_dimensions($attachment->ID, true);
|
1741 |
+
|
1742 |
+
$code .= '<div class="kgvid_video_gallery_thumb" id="kgvid_video_gallery_thumb_'.$attachment->ID.'" data-id="'.$attachment->ID.'" 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']).'" style="width:'.$query_atts["gallery_thumb"].'px"><img src="'.esc_attr($thumbnail_url).'" alt="'.esc_attr($attachment->post_title).'"><div class="'.esc_attr($options['js_skin']).'" ><div class="'.$play_button_class.'" style="-webkit-transform: scale('.$play_scale.') translateY(-'.$play_translate.'px); -o-transform: scale('.$play_scale.') translateY(-'.$play_translate.'px); -ms-transform: scale('.$play_scale.') translateY(-'.$play_translate.'px); transform: scale('.$play_scale.') translateY(-'.$play_translate.'px);"><span></span></div></div><div class="titlebackground"><div class="videotitle">'.$attachment->post_title.'</div></div></div>'."\n\t\t\t";
|
1743 |
+
}
|
1744 |
+
|
1745 |
+
$code .= '</div>'; //end wrapper div
|
1746 |
+
|
1747 |
+
$kgvid_gallery_id++;
|
1748 |
+
|
1749 |
+
} //if there are attachments
|
1750 |
+
} //if gallery
|
1751 |
} //if not feed
|
1752 |
return $code;
|
1753 |
}
|
1764 |
|
1765 |
function kgvid_ajax_generate_encode_checkboxes() {
|
1766 |
|
|
|
|
|
1767 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
1768 |
|
1769 |
$movieurl = $_POST['movieurl'];
|
1770 |
$post_id = $_POST['post_id'];
|
1771 |
$page = $_POST['page'];
|
1772 |
+
if ( isset($_POST['blog_id']) ) { $blog_id = $_POST['blog_id']; }
|
1773 |
+
else { $blog_id = false; }
|
1774 |
|
1775 |
if (isset($_POST['encodeformats'])) {
|
1776 |
$encode_checked = $_POST['encodeformats'];
|
1780 |
}
|
1781 |
}
|
1782 |
|
1783 |
+
$checkboxes = kgvid_generate_encode_checkboxes($movieurl, $post_id, $page, $blog_id);
|
1784 |
+
echo json_encode($checkboxes);
|
|
|
1785 |
die();
|
1786 |
|
1787 |
}
|
1788 |
add_action('wp_ajax_kgvid_generate_encode_checkboxes', 'kgvid_ajax_generate_encode_checkboxes');
|
1789 |
|
1790 |
+
function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page, $blog_id = false) {
|
1791 |
|
1792 |
+
$options = kgvid_get_options();
|
1793 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
1794 |
$video_formats = kgvid_video_formats();
|
1795 |
|
1796 |
$video_queued = false;
|
1805 |
|
1806 |
if ( !empty($movieurl) ) {
|
1807 |
|
1808 |
+
if ( $blog_id ) { switch_to_blog($blog_id); }
|
1809 |
+
|
1810 |
$encodevideo_info = kgvid_encodevideo_info($movieurl, $post_id);
|
1811 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
1812 |
$movieurl = $sanitized_url['movieurl'];
|
1823 |
|
1824 |
$post_mime_type = "video/".pathinfo($movieurl, PATHINFO_EXTENSION);
|
1825 |
|
1826 |
+
if ( !empty($video_encode_queue) ) {
|
1827 |
+
foreach ($video_encode_queue as $video_key => $video_entry) {
|
1828 |
if ( $video_entry['movieurl'] == $movieurl ) {
|
1829 |
+
if ( is_array($video_entry) && array_key_exists('movie_info', $video_entry) ) {
|
1830 |
$actualwidth = $video_entry['movie_info']['width'];
|
1831 |
$actualheight = $video_entry['movie_info']['height'];
|
1832 |
$rotated = $video_entry['movie_info']['rotate'];
|
1835 |
}
|
1836 |
}
|
1837 |
}
|
1838 |
+
reset($video_encode_queue);
|
1839 |
|
1840 |
if ( $page == "queue" ) {
|
1841 |
//$info = pathinfo($movieurl);
|
1843 |
}
|
1844 |
}
|
1845 |
if ( $post_mime_type == "video/m4v" || $post_mime_type == "video/quicktime" ) { $post_mime_type = "video/mp4"; }
|
1846 |
+
|
1847 |
+
}//if movieurl is set
|
1848 |
else {
|
1849 |
+
$encode_disabled = ' disabled title="'.__('Please enter a valid video URL', 'video-embed-thumbnail-generator').'"';
|
1850 |
unset($video_formats['fullres']);
|
1851 |
}
|
1852 |
|
1853 |
if ( $options['ffmpeg_exists'] == "notinstalled" ) {
|
1854 |
+
$ffmpeg_disabled_text = 'disabled="disabled" title="'.sprintf( _x('%1$s not found at %2$s', 'ex: FFMPEG not found at /usr/local/bin', 'video-embed-thumbnail-generator'), strtoupper($options['video_app']), $options['app_path']).'"';
|
1855 |
}
|
1856 |
else { $ffmpeg_disabled_text = ""; }
|
1857 |
|
1858 |
$video_key = false;
|
1859 |
+
if ( !empty($video_encode_queue) && !empty($movieurl) ) {
|
1860 |
+
foreach ($video_encode_queue as $video_key => $video_entry) {
|
1861 |
if ( $video_entry['movieurl'] == $movieurl ) {
|
1862 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
1863 |
if ( array_key_exists($format, $video_formats) ) { //don't recreate any formats that were previously unset
|
1901 |
if ( $format_stats['status'] != "notchecked" ) { //File is in queue
|
1902 |
$meta[$format] = ' <strong>'.ucfirst($format_stats['status']).'</strong>';
|
1903 |
if ( $format_stats['status'] == "error" ) {
|
1904 |
+
$meta[$format] .= ': <span class="kgvid_warning">'.stripslashes($video_encode_queue[$video_key]['encode_formats'][$format]['lastline'])."</span>";
|
1905 |
}
|
1906 |
}
|
1907 |
|
1914 |
if ( $encodevideo_info[$format.'_writable']
|
1915 |
&& current_user_can('encode_videos')
|
1916 |
&& $format != "fullres" ) {
|
1917 |
+
$meta[$format] .= '<a id="delete-'.$post_id.'-'.$format.'" class="kgvid_delete-format" onclick="kgvid_delete_video(\''.$movieurl.'\', \''.$post_id.'\', \''.$format.'\', \''.$child_id[$format].'\', \''.$blog_id.'\');" href="javascript:void(0)">'.__('Delete Permanently', 'video-embed-thumbnail-generator').'</a>';
|
1918 |
}
|
1919 |
}
|
1920 |
$disabled[$format] = ' disabled title="Format already exists"';
|
1926 |
|
1927 |
if ( $format_stats['status'] == "encoding" ) {
|
1928 |
$encoding_now = true;
|
1929 |
+
$disabled[$format] = ' disabled title="'.__('Currently encoding', 'video-embed-thumbnail-generator').'"';
|
1930 |
$checked[$format] = 'checked';
|
1931 |
$progress = kgvid_encode_progress($video_key, $format, $page);
|
1932 |
$meta[$format] = $progress['embed_display'];
|
1933 |
}
|
1934 |
|
1935 |
if ( $format_stats['status'] == "Encoding Complete" ) {
|
1936 |
+
$disabled[$format] = ' disabled title="'.__('Format already exists', 'video-embed-thumbnail-generator').'"';
|
1937 |
$checked[$format] = '';
|
1938 |
}
|
1939 |
|
1940 |
if ( $checked[$format] == '' ) { $something_to_encode = true; }
|
1941 |
|
1942 |
if ( !current_user_can('encode_videos') ) {
|
1943 |
+
$disabled[$format] = ' disabled title="'.__('You don\'t have permission to encode videos', 'video-embed-thumbnail-generator').'"';
|
1944 |
$something_to_encode = false;
|
1945 |
}
|
1946 |
|
1948 |
|
1949 |
}
|
1950 |
if ( $something_to_encode == false ) {
|
1951 |
+
$encode_disabled = ' disabled title="'.__('Nothing to encode', 'video-embed-thumbnail-generator').'" style="display:none;"';
|
1952 |
}
|
1953 |
|
1954 |
if ( $page == "queue" ) {
|
1955 |
+
$button_text = _x('Update', 'Button text', 'video-embed-thumbnail-generator');
|
1956 |
$checkboxes .= "\n\t\t\t".'<input type="hidden" name="attachments['.$post_id.'][kgflashmediaplayer-url]" value="'.$movieurl.'">';
|
1957 |
}
|
1958 |
+
else { $button_text = _x('Encode', 'Button text', 'video-embed-thumbnail-generator'); }
|
1959 |
|
1960 |
|
1961 |
$checkboxes .= '<input type="button" id="attachments-'.$post_id.'-kgflashmediaplayer-encode" name="attachments['.$post_id.'][kgflashmediaplayer-encode]" class="button-secondary" value="'.$button_text.'" onclick="kgvid_enqueue_video_encode(\''.$post_id.'\');" '.$ffmpeg_disabled_text.$encode_disabled.'/><div style="display:block;" id="attachments-'.$post_id.'-encodeplaceholder"></div>';
|
1962 |
|
1963 |
if ( $page != "queue" ) {
|
1964 |
+
$checkboxes .= '<small><em>'.__('Generates additional video formats compatible with most mobile & HTML5-compatible browsers', 'video-embed-thumbnail-generator').'</em></small>';
|
1965 |
}
|
1966 |
|
1967 |
|
1977 |
}
|
1978 |
$checkboxes .= '</div>'; //close encodeboxes div
|
1979 |
|
1980 |
+
if ( $blog_id ) { restore_current_blog(); }
|
1981 |
+
|
1982 |
+
$arr = array('checkboxes'=>$checkboxes, 'encoding'=>$encoding_now );
|
1983 |
+
|
1984 |
+
return $arr;
|
1985 |
+
}
|
1986 |
+
|
1987 |
+
function kgvid_generate_queue_table_header() {
|
1988 |
+
|
1989 |
+
$table_headers = array( _x('Order', 'noun, column header', 'video-embed-thumbnail-generator'),
|
1990 |
+
_x('User', 'username, column header', 'video-embed-thumbnail-generator'),
|
1991 |
+
_x('Thumbnail', 'noun, column header', 'video-embed-thumbnail-generator'),
|
1992 |
+
_x('File', 'noun, column header', 'video-embed-thumbnail-generator'),
|
1993 |
+
_x('Formats', 'noun, column header', 'video-embed-thumbnail-generator'),
|
1994 |
+
_x('Actions', 'noun, column header', 'video-embed-thumbnail-generator')
|
1995 |
+
);
|
1996 |
+
|
1997 |
+
if ( is_network_admin() ) {
|
1998 |
+
array_splice( $table_headers, 2, 0, array( _x('Site', 'multisite site name, column header', 'video-embed-thumbnail-generator') ) );
|
1999 |
+
}
|
2000 |
+
|
2001 |
+
$code = "<tr>";
|
2002 |
+
foreach ( $table_headers as $header ) {
|
2003 |
+
$code .= "<th>".$header."</th>";
|
2004 |
+
}
|
2005 |
+
$code .= "</tr>\n";
|
2006 |
+
|
2007 |
+
return $code;
|
2008 |
+
|
2009 |
}
|
2010 |
|
2011 |
+
function kgvid_generate_queue_table( $scope = 'site' ) {
|
2012 |
|
2013 |
$html = "";
|
2014 |
+
$current_user = wp_get_current_user();
|
2015 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
2016 |
|
2017 |
+
if ( is_network_admin() || 'network' == $scope ) { $total_columns = 8; }
|
2018 |
+
else { $total_columns = 7; }
|
2019 |
|
2020 |
+
if ( !empty($video_encode_queue) ) {
|
2021 |
|
2022 |
$video_formats = kgvid_video_formats();
|
2023 |
$currently_encoding = array();
|
2025 |
$nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
|
2026 |
$html .= "<input type='hidden' name='attachments[kgflashmediaplayer-security]' value='".$nonce."' />";
|
2027 |
|
2028 |
+
foreach ( $video_encode_queue as $order => $video_entry ) {
|
2029 |
$html .= "\t<tr id='tr_".$video_entry['attachmentID']."'";
|
2030 |
foreach ( $video_formats as $format => $format_stats ) {
|
2031 |
if ( $video_entry['encode_formats'][$format]['status'] == "encoding" ) {
|
2045 |
elseif ( $queued[$order] ) { $html .= " class='kgvid_queued' "; }
|
2046 |
else { $html .= " class='kgvid_complete' "; }
|
2047 |
|
2048 |
+
if ( array_key_exists('blog_id', $video_entry) ) { $blog_id = $video_entry['blog_id']; }
|
2049 |
+
else { $blog_id = false; }
|
2050 |
+
|
2051 |
$html .= ">";
|
2052 |
+
|
2053 |
+
//Order
|
2054 |
$html .= "<td id='td_".$video_entry['attachmentID']."'>".strval(intval($order)+1)."</td>\n";
|
2055 |
+
|
2056 |
+
//User
|
2057 |
+
if ( (is_network_admin() || 'network' == $scope) && $blog_id ) { switch_to_blog($blog_id); }
|
2058 |
+
$post = get_post( $video_entry['attachmentID'] );
|
2059 |
+
|
2060 |
+
if ( ( is_network_admin() || 'network' == $scope )
|
2061 |
+
|| $current_user->ID == $post->post_author
|
2062 |
+
|| ( current_user_can('edit_others_video_encodes') && ( $blog_id && get_current_blog_id() == $blog_id || !$blog_id ) )
|
2063 |
+
) {
|
2064 |
+
|
2065 |
+
|
2066 |
+
$user = get_userdata( $post->post_author );
|
2067 |
+
$html .= "<td>".$user->display_name."</td>\n";
|
2068 |
+
|
2069 |
+
//Site
|
2070 |
+
if ( (is_network_admin() || 'network' == $scope) && $blog_id ) {
|
2071 |
+
$blog_details = get_bloginfo();
|
2072 |
+
$html .= "<td>".$blog_details."</td>\n";
|
2073 |
+
}
|
2074 |
+
|
2075 |
+
//Thumbnail
|
2076 |
+
$thumbnail_url = get_post_meta($video_entry['attachmentID'], "_kgflashmediaplayer-poster", true);
|
2077 |
+
$thumbnail_html = "";
|
2078 |
+
if ($thumbnail_url != "" ) {
|
2079 |
+
$thumbnail_html = '<img width="100" src="'.$thumbnail_url.'">';
|
2080 |
+
}
|
2081 |
+
|
2082 |
+
//File
|
2083 |
+
if ( $post->post_type == "attachment" ) {
|
2084 |
+
$moviefilepath = get_attached_file($video_entry['attachmentID']);
|
2085 |
+
$attachmentlink = get_admin_url()."post.php?post=".$video_entry['attachmentID']."&action=edit";
|
2086 |
+
}
|
2087 |
+
else {
|
2088 |
+
$moviefilepath = $video_entry['movieurl'];
|
2089 |
+
$attachmentlink = $video_entry['movieurl'];
|
2090 |
+
}
|
2091 |
+
$html .= "\t\t\t\t\t<td><a href='".$attachmentlink."'> ".$thumbnail_html."</a></td>\n";
|
2092 |
+
$path_info = pathinfo($moviefilepath);
|
2093 |
+
$file_name = basename($moviefilepath,'.'.$path_info['extension']);
|
2094 |
+
$html .= "\t\t\t\t\t<td><a id='".$moviefilepath."' href='".$attachmentlink."'>".urldecode($file_name)."</a><input type='hidden' name='attachments[".$video_entry['attachmentID']."][kgflashmediaplayer-url]' value='".$video_entry['movieurl']."'></td>\n";
|
2095 |
+
|
2096 |
+
//Formats
|
2097 |
+
$html .= "\t\t\t\t\t<td class='queue_encode_formats' id='formats_".$video_entry['attachmentID']."'>";
|
2098 |
+
$html .= "<input type='hidden' id='attachments-".$video_entry['attachmentID']."-kgflashmediaplayer-security' name='attachments[".$video_entry['attachmentID']."][kgflashmediaplayer-security]' value='".$nonce."' />";
|
2099 |
+
|
2100 |
+
$checkboxes = kgvid_generate_encode_checkboxes($video_entry['movieurl'], $video_entry['attachmentID'], 'queue', $blog_id);
|
2101 |
+
$html .= $checkboxes['checkboxes'];
|
2102 |
+
$html .= "</td>\n";
|
2103 |
+
|
2104 |
+
//Actions
|
2105 |
+
$html .= "\t\t\t\t\t<td>";
|
2106 |
+
$html .= "<a id='clear_".$video_entry['attachmentID']."' class='submitdelete' href='javascript:void(0)' onclick='kgvid_encode_queue(\"delete\", ".$order.", ".$video_entry['attachmentID'].")'";
|
2107 |
+
if ( $currently_encoding[$order] ) { $html .= " style='display:none;'"; }
|
2108 |
+
$html .= ">Clear</a>";
|
2109 |
+
|
2110 |
+
}//end if current user can see this stuff
|
2111 |
+
|
2112 |
+
if ( (is_network_admin() || 'network' == $scope) && $blog_id ) { restore_current_blog(); }
|
2113 |
+
|
2114 |
+
else { $html .= "<td colspan='".strval($total_columns-1)."'><strong class='kgvid_queue_message'>".__("Other user's video", 'video-embed-thumbnail-generator')."</strong></td>"; }
|
2115 |
$html .= "</td></tr>\n";
|
2116 |
}
|
2117 |
}
|
2118 |
+
else { $html = "\t<tr><td colspan='".strval($total_columns)."'><strong class='kgvid_queue_message'>".__('Queue is empty', 'video-embed-thumbnail-generator')."</strong></td></tr>\n"; }
|
2119 |
|
2120 |
return $html;
|
2121 |
|
2122 |
}
|
2123 |
|
2124 |
function kgvid_add_FFMPEG_Queue_Page() {
|
2125 |
+
$options = kgvid_get_options();
|
2126 |
if ( $options['ffmpeg_exists'] == "on" ) { //only add the queue page if FFMPEG is installed
|
2127 |
+
add_submenu_page('tools.php', _x('Video Embed & Thumbnail Generator Encoding Queue', 'Tools page title', 'video-embed-thumbnail-generator'), _x('Video Encode Queue', 'Title in admin sidebar', 'video-embed-thumbnail-generator'), 'encode_videos', 'kgvid_video_encoding_queue', 'kgvid_FFMPEG_Queue_Page');
|
2128 |
}
|
2129 |
}
|
2130 |
add_action('admin_menu', 'kgvid_add_FFMPEG_Queue_Page');
|
2131 |
|
2132 |
+
function kgvid_add_network_queue_page() {
|
2133 |
+
if ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
2134 |
+
add_submenu_page('settings.php', _x('Video Embed & Thumbnail Generator Encoding Queue', 'Tools page title', 'video-embed-thumbnail-generator'), _x('Network Video Encode Queue', 'Title in network admin sidebar', 'video-embed-thumbnail-generator'), 'manage_network', 'kgvid_network_video_encoding_queue', 'kgvid_FFMPEG_Queue_Page');
|
2135 |
+
}
|
2136 |
+
}
|
2137 |
+
add_action('network_admin_menu', 'kgvid_add_network_queue_page');
|
2138 |
+
|
2139 |
function kgvid_FFMPEG_Queue_Page() {
|
2140 |
|
2141 |
?>
|
2142 |
<div class="wrap">
|
2143 |
<div id="icon-tools" class="icon32"><br /></div>
|
2144 |
+
<h2><?php _e('Video Embed & Thumbnail Generator Encoding Queue', 'video-embed-thumbnail-generator') ?></h2>
|
2145 |
<p></p>
|
2146 |
<form method="post" action="tools.php?page=kgvid_video_encoding_queue">
|
2147 |
<?php wp_nonce_field('video-embed-thumbnail-generator-nonce','video-embed-thumbnail-generator-nonce'); ?>
|
2148 |
+
|
2149 |
<table class="widefat">
|
2150 |
<thead>
|
2151 |
+
<?php echo kgvid_generate_queue_table_header(); ?>
|
|
|
|
|
|
|
|
|
|
|
2152 |
</thead>
|
2153 |
<tfoot>
|
2154 |
+
<?php echo kgvid_generate_queue_table_header(); ?>
|
|
|
|
|
|
|
|
|
|
|
2155 |
</tfoot>
|
2156 |
<tbody class="rows">
|
2157 |
<?php echo kgvid_generate_queue_table(); ?>
|
2158 |
</tbody>
|
2159 |
</table>
|
|
|
2160 |
<p>
|
2161 |
+
<?php if ( current_user_can('edit_others_video_encodes') ) { echo "<input id='clear_completed' type='button' class='button-secondary' value='". __('Clear All Completed', 'video-embed-thumbnail-generator') ."' onclick='kgvid_encode_queue(\"clear_completed\", 0, 0);'>"; } ?>
|
2162 |
</p>
|
2163 |
</form>
|
2164 |
</div>
|
2165 |
<?php
|
2166 |
}
|
2167 |
|
2168 |
+
function kgvid_add_network_settings_page() {
|
2169 |
+
add_submenu_page('settings.php', _x('Video Embed & Thumbnail Generator', 'Settings page title', 'video-embed-thumbnail-generator'), __('Video Embed & Thumbnail Generator', 'Settings page title in admin sidebar', 'video-embed-thumbnail-generator'), 'manage_network_options', __FILE__, 'kgvid_network_settings_page' );
|
2170 |
}
|
2171 |
+
add_action('network_admin_menu', 'kgvid_add_network_settings_page');
|
2172 |
|
2173 |
+
function kgvid_validate_network_settings($input) {
|
2174 |
+
|
2175 |
+
$options = get_site_option( 'kgvid_video_embed_network_options' );
|
2176 |
+
$default_options = kgvid_default_network_options();
|
2177 |
+
|
2178 |
+
if ( $input['app_path'] != $options['app_path'] || $input['video_app'] != $options['video_app'] ) {
|
2179 |
+
$input = kgvid_validate_ffmpeg_settings($input);
|
2180 |
+
}
|
2181 |
+
else { $input['ffmpeg_exists'] = $options['ffmpeg_exists']; }
|
2182 |
+
|
2183 |
+
// load all settings and make sure they get a value of false if they weren't entered into the form
|
2184 |
+
foreach ( $default_options as $key => $value ) {
|
2185 |
+
if ( !array_key_exists($key, $input) ) { $input[$key] = false; }
|
2186 |
+
}
|
2187 |
+
|
2188 |
+
return $input;
|
2189 |
+
|
2190 |
+
}
|
2191 |
+
|
2192 |
+
function kgvid_network_settings_page() {
|
2193 |
+
|
2194 |
+
$network_options = get_site_option( 'kgvid_video_embed_network_options' );
|
2195 |
+
|
2196 |
+
if (isset($_POST['action']) && $_POST['action'] == 'update_kgvid_network_settings') {
|
2197 |
+
|
2198 |
+
check_admin_referer('save_network_settings', 'video-embed-thumbnail-generator-nonce');
|
2199 |
+
$input = $_POST['kgvid_video_embed_options'];
|
2200 |
+
$validated_options = kgvid_validate_network_settings($input);
|
2201 |
+
$options_updated = update_site_option( 'kgvid_video_embed_network_options', $validated_options );
|
2202 |
+
|
2203 |
+
}
|
2204 |
+
|
2205 |
+
?>
|
2206 |
+
<div class="wrap">
|
2207 |
+
<div class="icon32" id="icon-options-general"><br></div>
|
2208 |
+
<h2>Video Embed & Thumbnail Generator Network Settings</h2>
|
2209 |
+
<form method="post">
|
2210 |
+
<input type="hidden" name="action" value="update_kgvid_network_settings" />
|
2211 |
+
<input type="hidden" id="kgvid_settings_security" value="<?php echo wp_create_nonce('video-embed-thumbnail-generator-nonce'); ?>">
|
2212 |
+
<table class='form-table'>
|
2213 |
+
<tbody>
|
2214 |
+
<tr valign='middle'>
|
2215 |
+
<th scope='row'><label for='app_path'><?php _e('Path to applications on the server:', 'video-embed-thumbnail-generator'); ?></label></th>
|
2216 |
+
<td><?php kgvid_app_path_callback(); ?></td>
|
2217 |
+
</tr>
|
2218 |
+
<th scope='row'><label for='video_app'><?php _e('Application for thumbnails & encoding:', 'video-embed-thumbnail-generator'); ?></label></th>
|
2219 |
+
<td><?php kgvid_video_app_callback(); ?></td>
|
2220 |
+
</tr>
|
2221 |
+
<tr>
|
2222 |
+
<th scope='row'><label for='moov'><?php _e('Method to fix encoded H.264 headers for streaming:', 'video-embed-thumbnail-generator'); ?></label></th>
|
2223 |
+
<td><?php kgvid_moov_callback(); ?></td>
|
2224 |
+
</tr>
|
2225 |
+
<tr>
|
2226 |
+
<th scope='row'><label for='video_bitrate_flag'><?php _e('FFMPEG legacy options:', 'video-embed-thumbnail-generator'); ?></label></th>
|
2227 |
+
<td><?php kgvid_ffmpeg_options_callback(); ?></td>
|
2228 |
+
</tr>
|
2229 |
+
<tr>
|
2230 |
+
<th scope='row'><label for='video_app'><?php _e('Execution:', 'video-embed-thumbnail-generator'); ?></label></th>
|
2231 |
+
<td><?php kgvid_execution_options_callback(); ?></td>
|
2232 |
+
</tr>
|
2233 |
+
<tr>
|
2234 |
+
<th scope='row'><label><?php _e('User capabilties for new sites:', 'video-embed-thumbnail-generator'); ?></label></th>
|
2235 |
+
<td><?php kgvid_user_roles_callback('network'); ?></td>
|
2236 |
+
</tr>
|
2237 |
+
</tbody>
|
2238 |
+
</table>
|
2239 |
+
<p class='submit'>
|
2240 |
+
<?php submit_button(__('Save Changes', 'video-embed-thumbnail-generator'), 'primary', 'kgvid_submit', false, array( 'onclick' => "jQuery('form :disabled').prop('disabled', false);" ) ); ?>
|
2241 |
+
<?php submit_button(__('Reset Options', 'video-embed-thumbnail-generator'), 'secondary', 'video-embed-thumbnail-generator-reset', false); ?>
|
2242 |
+
</p>
|
2243 |
+
</form>
|
2244 |
+
<div class="kgvid-blue-box">
|
2245 |
+
<span><?php _e('If you\'re getting some use out of this plugin, please consider donating a few dollars to support its future development.', 'video-embed-thumbnail-generator') ?></span>
|
2246 |
+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
2247 |
+
<input type="hidden" name="cmd" value="_donations">
|
2248 |
+
<input type="hidden" name="business" value="kylegilman@gmail.com">
|
2249 |
+
<input type="hidden" name="lc" value="US">
|
2250 |
+
<input type="hidden" name="item_name" value="Video Embed & Thumbnail Generator Plugin Donation">
|
2251 |
+
<input type="hidden" name="currency_code" value="USD">
|
2252 |
+
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donateCC_LG.gif:NonHosted">
|
2253 |
+
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
2254 |
+
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
2255 |
+
</form>
|
2256 |
+
</div>
|
2257 |
+
<script type='text/javascript'>
|
2258 |
+
jQuery(document).ready(function() {
|
2259 |
+
kgvid_hide_plugin_settings();
|
2260 |
+
jQuery('form :input').change(function() {
|
2261 |
+
kgvid_save_plugin_settings(this);
|
2262 |
+
});
|
2263 |
+
}
|
2264 |
+
);
|
2265 |
+
</script>
|
2266 |
+
</div>
|
2267 |
+
<?php
|
2268 |
+
}
|
2269 |
+
|
2270 |
+
function kgvid_add_settings_page() {
|
2271 |
+
add_options_page( _x('Video Embed & Thumbnail Generator', 'Settings page title', 'video-embed-thumbnail-generator'), __('Video Embed & Thumbnail Generator', 'Settings page title in admin sidebar', 'video-embed-thumbnail-generator'), 'manage_options', __FILE__, 'kgvid_settings_page' );
|
2272 |
+
}
|
2273 |
+
add_action('admin_menu', 'kgvid_add_settings_page');
|
2274 |
+
|
2275 |
+
function kgvid_settings_page() {
|
2276 |
wp_enqueue_media();
|
2277 |
+
$options = kgvid_get_options();
|
2278 |
$video_app = $options['video_app'];
|
2279 |
if ( $video_app == "avconv" ) { $video_app = "libav"; }
|
2280 |
?>
|
2281 |
<div class="wrap">
|
2282 |
<div class="icon32" id="icon-options-general"><br></div>
|
2283 |
<h2>Video Embed & Thumbnail Generator</h2>
|
2284 |
+
<?php if ( !is_multisite()
|
2285 |
+
|| ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( plugin_basename(__FILE__) ) && $options['ffmpeg_exists'] == "on" )
|
2286 |
+
) { ?>
|
2287 |
<h2 class="nav-tab-wrapper">
|
2288 |
+
<a href="#" id="general_tab" class="nav-tab" onclick="kgvid_switch_settings_tab('general');"><?php _ex('General', 'Adjective, tab title', 'video-embed-thumbnail-generator') ?></a>
|
2289 |
+
<a href="#" id="encoding_tab" class="nav-tab" onclick="kgvid_switch_settings_tab('encoding');"><?php printf( _x('%s Settings', 'FFMPEG Settings, tab title', 'video-embed-thumbnail-generator'), "<span class='video_app_name'>".strtoupper($video_app)."</span>" ); ?></a>
|
2290 |
</h2>
|
2291 |
+
<?php } ?>
|
2292 |
<form method="post" action="options.php">
|
2293 |
<?php settings_fields('kgvid_video_embed_options'); ?>
|
2294 |
<input type="hidden" id="kgvid_settings_security" value="<?php echo wp_create_nonce('video-embed-thumbnail-generator-nonce'); ?>">
|
2295 |
<?php do_settings_sections(__FILE__); ?>
|
2296 |
<p class='submit'>
|
2297 |
+
<?php submit_button(__('Save Changes', 'video-embed-thumbnail-generator'), 'primary', 'kgvid_submit', false, array( 'onclick' => "jQuery('form :disabled').prop('disabled', false);" ) ); ?>
|
2298 |
+
<?php submit_button(__('Reset Options', 'video-embed-thumbnail-generator'), 'secondary', 'video-embed-thumbnail-generator-reset', false); ?>
|
2299 |
</p>
|
2300 |
</form>
|
|
|
2301 |
<div class="kgvid-blue-box">
|
2302 |
+
<span><?php _e('If you\'re getting some use out of this plugin, please consider donating a few dollars to support its future development.', 'video-embed-thumbnail-generator') ?></span>
|
2303 |
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
2304 |
<input type="hidden" name="cmd" value="_donations">
|
2305 |
<input type="hidden" name="business" value="kylegilman@gmail.com">
|
2311 |
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
2312 |
</form>
|
2313 |
</div>
|
2314 |
+
<script type='text/javascript'>
|
|
|
2315 |
jQuery(document).ready(function() {
|
2316 |
kgvid_switch_settings_tab('general');
|
2317 |
jQuery('form :input').change(function() {
|
2319 |
});
|
2320 |
}
|
2321 |
);
|
2322 |
+
</script>
|
2323 |
</div>
|
2324 |
<?php
|
2325 |
}
|
2326 |
|
2327 |
function kgvid_video_embed_options_init() {
|
2328 |
|
2329 |
+
//check for network options in 'admin_init' because is_plugin_active_for_network is not defined in 'init' hook
|
2330 |
+
if ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
2331 |
|
2332 |
+
$network_options = get_site_option( 'kgvid_video_embed_network_options' );
|
2333 |
+
|
2334 |
+
if( !is_array($network_options) ) { //if the network options haven't been set yet
|
2335 |
+
|
2336 |
+
switch_to_blog(1);
|
2337 |
+
$options = get_option('kgvid_video_embed_options');
|
2338 |
+
$network_options = kgvid_default_network_options();
|
2339 |
+
if ( is_array($options) ) {
|
2340 |
+
$network_options = array_intersect_key($network_options, $options); //copy options from main blog to network
|
2341 |
+
$network_options['default_capabilities'] = $options['capabilities'];
|
2342 |
+
if ( !array_key_exists('simultaneous_encodes', $network_options) ) { $network_options['simultaneous_encodes'] = 1; }
|
2343 |
+
}
|
2344 |
+
restore_current_blog();
|
2345 |
+
|
2346 |
+
if ( !isset($network_options['ffmpeg_exists']) || $network_options['ffmpeg_exists'] == "notchecked" ) {
|
2347 |
+
$ffmpeg_info = kgvid_check_ffmpeg_exists($network_options, false);
|
2348 |
+
if ( $ffmpeg_info['ffmpeg_exists'] == true ) { $network_options['ffmpeg_exists'] = "on"; }
|
2349 |
+
$network_options['app_path'] = $ffmpeg_info['app_path'];
|
2350 |
+
}
|
2351 |
+
update_site_option('kgvid_video_embed_network_options', $network_options);
|
2352 |
+
|
2353 |
+
}//end setting network options
|
2354 |
|
2355 |
+
$network_queue = get_site_option('kgvid_video_embed_queue');
|
2356 |
+
|
2357 |
+
if ( is_array($network_options) && array_key_exists('ffmpeg_exists', $network_options) && 'on' == $network_options['ffmpeg_exists']
|
2358 |
+
&& false === $network_queue ) { //if the network queue hasn't been set yet
|
2359 |
+
|
2360 |
+
$sites = wp_get_sites();
|
2361 |
+
|
2362 |
+
if ( is_array($sites) ) {
|
2363 |
+
$network_queue = array();
|
2364 |
+
foreach ( $sites as $site ) {
|
2365 |
+
|
2366 |
+
$site_queue = get_blog_option($site['blog_id'], 'kgvid_video_embed_queue');
|
2367 |
+
if ( is_array($site_queue) ) {
|
2368 |
+
foreach ( $site_queue as $index => $entry ) {
|
2369 |
+
$site_queue[$index]['blog_id'] = $site['blog_id'];
|
2370 |
+
}
|
2371 |
+
$network_queue = array_merge($network_queue, $site_queue);
|
2372 |
+
delete_blog_option($site['blog_id'], 'kgvid_video_embed_queue');
|
2373 |
+
}
|
2374 |
+
|
2375 |
+
}//end loop through sites
|
2376 |
+
array_multisort($network_queue);
|
2377 |
+
update_site_option( 'kgvid_video_embed_queue', $network_queue );
|
2378 |
+
}
|
2379 |
+
|
2380 |
+
}//end copying site queues to network
|
2381 |
+
}//end network activation setup
|
2382 |
+
|
2383 |
+
register_setting('kgvid_video_embed_options', 'kgvid_video_embed_options', 'kgvid_video_embed_options_validate' );
|
2384 |
+
|
2385 |
+
$options = kgvid_get_options();
|
2386 |
+
|
2387 |
+
add_settings_section('kgvid_video_embed_playback_settings', __('Default Video Playback Settings', 'video-embed-thumbnail-generator'), 'kgvid_plugin_playback_settings_section_callback', __FILE__);
|
2388 |
+
add_settings_section('kgvid_video_embed_flash_settings', __('The following options will only affect Flash playback', 'video-embed-thumbnail-generator'), 'kgvid_plugin_flash_settings_section_callback', __FILE__);
|
2389 |
+
add_settings_section('kgvid_video_embed_plugin_settings', __('Plugin Settings', 'video-embed-thumbnail-generator'), 'kgvid_plugin_settings_section_callback', __FILE__);
|
2390 |
+
add_settings_section('kgvid_video_embed_encode_settings', __('Video Encoding Settings', 'video-embed-thumbnail-generator'), 'kgvid_encode_settings_section_callback', __FILE__);
|
2391 |
+
|
2392 |
+
add_settings_field('poster', __('Default thumbnail:', 'video-embed-thumbnail-generator'), 'kgvid_poster_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'poster' ) );
|
2393 |
+
add_settings_field('endofvideooverlay', __('End of video image:', 'video-embed-thumbnail-generator'), 'kgvid_endofvideooverlay_callback', __FILE__, 'kgvid_video_embed_playback_settings' );
|
2394 |
+
add_settings_field('watermark', __('Watermark overlay:', 'video-embed-thumbnail-generator'), 'kgvid_watermark_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'watermark' ) );
|
2395 |
+
add_settings_field('align', __('Video alignment:', 'video-embed-thumbnail-generator'), 'kgvid_align_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'align' ) );
|
2396 |
+
add_settings_field('resize', __('Automatically resize videos:', 'video-embed-thumbnail-generator'), 'kgvid_resize_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'inline' ) );
|
2397 |
+
add_settings_field('inline', __('Inline videos:', 'video-embed-thumbnail-generator'), 'kgvid_inline_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'inline' ) );
|
2398 |
+
add_settings_field('dimensions', __('Max embedded video dimensions:', 'video-embed-thumbnail-generator'), 'kgvid_dimensions_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'width' ) );
|
2399 |
+
add_settings_field('gallery_dimensions', __('Max gallery video dimensions:', 'video-embed-thumbnail-generator'), 'kgvid_gallery_dimensions_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'gallery_width' ) );
|
2400 |
+
add_settings_field('gallery_thumb', __('Gallery thumbnail width:', 'video-embed-thumbnail-generator'), 'kgvid_gallery_thumb_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'gallery_thumb' ) );
|
2401 |
+
add_settings_field('controlbar_style', __('Video controls:', 'video-embed-thumbnail-generator'), 'kgvid_controlbar_style_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'controlbar_style' ) );
|
2402 |
+
add_settings_field('autoplay', __('Autoplay:', 'video-embed-thumbnail-generator'), 'kgvid_autoplay_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'autoplay' ) );
|
2403 |
+
add_settings_field('loop', _x('Loop:', 'verb', 'video-embed-thumbnail-generator'), 'kgvid_loop_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'loop' ) );
|
2404 |
+
add_settings_field('preload', __('Preload:', 'video-embed-thumbnail-generator'), 'kgvid_preload_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'preload' ) );
|
2405 |
+
add_settings_field('js_skin', _x('Skin class:', 'CSS class for video skin', 'video-embed-thumbnail-generator'), 'kgvid_js_skin_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'js_skin' ) );
|
2406 |
+
|
2407 |
+
add_settings_field('bgcolor', __('Background color:', 'video-embed-thumbnail-generator'), 'kgvid_bgcolor_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'bgcolor' ) );
|
2408 |
+
add_settings_field('configuration', __('XML configuration file:', 'video-embed-thumbnail-generator'), 'kgvid_configuration_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'configuration' ) );
|
2409 |
+
add_settings_field('skin', __('Video skin file:', 'video-embed-thumbnail-generator'), 'kgvid_skin_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'skin' ) );
|
2410 |
+
add_settings_field('stream_type', __('Video stream type:', 'video-embed-thumbnail-generator'), 'kgvid_stream_type_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'stream_type' ) );
|
2411 |
+
add_settings_field('scale_mode', __('Video scale mode:', 'video-embed-thumbnail-generator'), 'kgvid_scale_mode_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'scale_mode' ) );
|
2412 |
+
add_settings_field('autohide', __('Autohide:', 'video-embed-thumbnail-generator'), 'kgvid_autohide_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'autohide' ) );
|
2413 |
+
add_settings_field('playbutton', __('Play button overlay:', 'video-embed-thumbnail-generator'), 'kgvid_playbutton_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'playbutton' ) );
|
2414 |
+
|
2415 |
+
add_settings_field('generate_thumbs', __('Default number of thumbnails to generate:', 'video-embed-thumbnail-generator'), 'kgvid_generate_thumbs_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'generate_thumbs' ) );
|
2416 |
+
add_settings_field('user_roles', __('User capabilities:', 'video-embed-thumbnail-generator'), 'kgvid_user_roles_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'user_roles' ) );
|
2417 |
+
add_settings_field('security', __('Video security:', 'video-embed-thumbnail-generator'), 'kgvid_security_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'embeddable' ) );
|
2418 |
+
add_settings_field('featured', __('Featured image:', 'video-embed-thumbnail-generator'), 'kgvid_featured_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'featured' ) );
|
2419 |
+
add_settings_field('thumb_parent', __('Attach thumbnails to:', 'video-embed-thumbnail-generator'), 'kgvid_thumb_parent_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'thumb_parent' ) );
|
2420 |
+
add_settings_field('delete_children', __('Delete associated attachments:', 'video-embed-thumbnail-generator'), 'kgvid_delete_children_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'delete_children' ) );
|
2421 |
+
add_settings_field('titlecode', __('Video title text HTML formatting:', 'video-embed-thumbnail-generator'), 'kgvid_titlecode_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'titlecode' ) );
|
2422 |
+
add_settings_field('template', __('Attachment template display:', 'video-embed-thumbnail-generator'), 'kgvid_template_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'template' ) );
|
2423 |
+
|
2424 |
+
if ( !is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
2425 |
+
add_settings_field('app_path', __('Path to applications folder on server:', 'video-embed-thumbnail-generator'), 'kgvid_app_path_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'app_path' ) );
|
2426 |
+
add_settings_field('video_app', __('Application for thumbnails & encoding:', 'video-embed-thumbnail-generator'), 'kgvid_video_app_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'video_app' ) );
|
2427 |
+
}
|
2428 |
+
|
2429 |
+
add_settings_field('browser_thumbnails', __('Enable in-browser thumbnails:', 'video-embed-thumbnail-generator'), 'kgvid_browser_thumbnails_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'browser_thumbnails' ) );
|
2430 |
+
add_settings_field('encode_formats', __('Default video encode formats:', 'video-embed-thumbnail-generator'), 'kgvid_encode_formats_callback', __FILE__, 'kgvid_video_embed_encode_settings');
|
2431 |
+
add_settings_field('automatic', __('Do automatically on upload:', 'video-embed-thumbnail-generator'), 'kgvid_automatic_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'auto_encode' ) );
|
2432 |
+
add_settings_field('htaccess', __('htaccess login:', 'video-embed-thumbnail-generator'), 'kgvid_htaccess_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'htaccess_username' ) );
|
2433 |
+
add_settings_field('ffmpeg_watermark', __('Add watermark to encoded files:', 'video-embed-thumbnail-generator'), 'kgvid_ffmpeg_watermark_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'ffmpeg_watermark' ) );
|
2434 |
+
if ( !is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
2435 |
+
add_settings_field('moov', __('Method to fix encoded H.264 headers for streaming:', 'video-embed-thumbnail-generator'), 'kgvid_moov_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'moov' ) );
|
2436 |
+
}
|
2437 |
+
add_settings_field('rate_control', __('Encode quality control method:', 'video-embed-thumbnail-generator'), 'kgvid_rate_control_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'rate_control' ) );
|
2438 |
+
add_settings_field('CRFs', __('Constant Rate Factors (CRF):', 'video-embed-thumbnail-generator'), 'kgvid_CRF_options_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'h264_CRF' ) );
|
2439 |
+
add_settings_field('bitrate_multiplier', __('Average Bit Rate:', 'video-embed-thumbnail-generator'), 'kgvid_average_bitrate_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'bitrate_multiplier' ) );
|
2440 |
+
add_settings_field('h264_profile', __('H.264 profile:', 'video-embed-thumbnail-generator'), 'kgvid_h264_profile_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'h264_profile' ) );
|
2441 |
+
add_settings_field('audio_bitrate', __('Audio bit rate:', 'video-embed-thumbnail-generator'), 'kgvid_audio_bitrate_options_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'audio_bitrate' ) );
|
2442 |
+
|
2443 |
+
if ( !is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
2444 |
+
add_settings_field('ffmpeg_options', __('FFMPEG legacy options:', 'video-embed-thumbnail-generator'), 'kgvid_ffmpeg_options_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'video_bitrate_flag' ) );
|
2445 |
+
add_settings_field('execution', _x('Execution:', 'program execution options', 'video-embed-thumbnail-generator'), 'kgvid_execution_options_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'threads' ) );
|
2446 |
+
}
|
2447 |
+
|
2448 |
+
add_settings_field('test_ffmpeg', __('Test FFMPEG:', 'video-embed-thumbnail-generator'), 'kgvid_test_ffmpeg_options_callback', __FILE__, 'kgvid_video_embed_encode_settings' );
|
2449 |
|
2450 |
}
|
2451 |
add_action('admin_init', 'kgvid_video_embed_options_init' );
|
2453 |
//callback functions generating HTML for the settings form
|
2454 |
|
2455 |
function kgvid_plugin_playback_settings_section_callback() {
|
2456 |
+
|
2457 |
global $wp_version;
|
2458 |
+
$options = kgvid_get_options();
|
2459 |
if ( $options['embeddable'] != "on" ) {
|
2460 |
$embed_disabled = "disabled='disabled'";
|
2461 |
if ( $options['overlay_embedcode'] == "on" || $options['open_graph'] == "on" ) {
|
2466 |
}
|
2467 |
else { $embed_disabled = ""; }
|
2468 |
|
2469 |
+
$players["Video.js"] = "Video.js";
|
2470 |
+
if ( $wp_version >= 3.6 ) { $players[__("WordPress Default", 'video-embed-thumbnail-generator')] = "WordPress Default"; }
|
2471 |
+
|
2472 |
+
//add the JW Player if available
|
2473 |
+
$jw_player_select = "";
|
2474 |
+
if ( class_exists('JWP6_Shortcode') ) {
|
2475 |
+
$players["JW Player"] = "JW Player";
|
2476 |
+
$jw_players = get_option('jwp6_players');
|
2477 |
+
if ( count($jw_players) > 1 ) {
|
2478 |
+
$jw_player_select = " <div style='display:none;' id='jw_player_id_select'><select class='affects_player' onchange='kgvid_hide_plugin_settings();' id='jw_player_id' name='kgvid_video_embed_options[jw_player_id]'>";
|
2479 |
+
foreach( $jw_players as $jw_player_id ) {
|
2480 |
+
$selected = ($options['jw_player_id']==$jw_player_id) ? 'selected="selected"' : '';
|
2481 |
+
$jw_player_config = get_option('jwp6_player_config_'.$jw_player_id);
|
2482 |
+
if ( is_array($jw_player_config)
|
2483 |
+
&& array_key_exists('description', $jw_player_config)
|
2484 |
+
&& !empty($jw_player_config['description']) ) { $jw_player_config_description = $jw_player_config['description']; }
|
2485 |
+
else { $jw_player_config_description = $jw_player_id; }
|
2486 |
+
$jw_player_select .= "<option value='$jw_player_id' $selected>".stripcslashes($jw_player_config_description)."</option>";
|
2487 |
+
}
|
2488 |
+
$jw_player_select .= "</select> JW Player player</div>";
|
2489 |
+
}
|
2490 |
+
}
|
2491 |
+
|
2492 |
+
$players["Strobe Media Playback ".__('(deprecated)', 'video-embed-thumbnail-generator')] = "Strobe Media Playback";
|
2493 |
+
|
2494 |
+
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]'>";
|
2495 |
+
foreach($players as $name => $value) {
|
2496 |
+
$selected = ($options['embed_method']==$value) ? 'selected="selected"' : '';
|
2497 |
+
echo "<option value='$value' $selected>$name</option>";
|
2498 |
}
|
2499 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Video.js is the default player. Users running WordPress 3.6 or higher can choose the WordPress Default Mediaelement.js player which may already be skinned to match your theme. If the JW Player WordPress plugin is active it should be available as a video player. In the past this plugin used Adobe\'s Strobe Media Playback Flash player, which hasn\'t been updated since 2011 and is not recommended. It should still work, but new plugin functions are not guaranteed to be compatible.', 'video-embed-thumbnail-generator')."</span></a>".$jw_player_select."</td></tr></tbody></table>\n";
|
2500 |
|
2501 |
+
$sampleheight = intval($options['height']) + 50;
|
2502 |
echo "<div class='kgvid_setting_nearvid' style='width:".$options['width']."px;'>";
|
2503 |
+
echo "<div style='float:left;'><input class='affects_player' ".checked( $options['overlay_title'], "on", false )." id='overlay_title' name='kgvid_video_embed_options[overlay_title]' type='checkbox' /> <label for='overlay_title'>".__('Overlay video title', 'video-embed-thumbnail-generator')."</label></div>";
|
2504 |
+
echo "<div style='float:right;'><input class='affects_player' ".checked( $options['overlay_embedcode'], "on", false )." id='overlay_embedcode' name='kgvid_video_embed_options[overlay_embedcode]' type='checkbox' ".$embed_disabled."/> <label for='overlay_embedcode'>".__('Overlay embed code', 'video-embed-thumbnail-generator')."</label></div>";
|
2505 |
$iframeurl = site_url('/')."?kgvid_video_embed[enable]=true&kgvid_video_embed[sample]=true";
|
2506 |
echo "<iframe id='kgvid_samplevideo' style='border:2px;' src='".$iframeurl."' scrolling='no' width='".$options['width']."' height='".$sampleheight."'></iframe>";
|
2507 |
+
echo "<div style='float:left;'><input class='affects_player' ".checked( $options['downloadlink'], "on", false )." id='downloadlink' name='kgvid_video_embed_options[downloadlink]' type='checkbox' /> <label for='downloadlink'>".__('Show download link', 'video-embed-thumbnail-generator')."</label></div>";
|
2508 |
+
echo "<div style='float:right;'><input class='affects_player' ".checked( $options['view_count'], "on", false )." id='view_count' name='kgvid_video_embed_options[view_count]' type='checkbox' /> <label for='view_count'>".__('Show view count', 'video-embed-thumbnail-generator')."</label></div>";
|
2509 |
echo "</div>\n\t";
|
2510 |
}
|
2511 |
function kgvid_plugin_flash_settings_section_callback() { }
|
2512 |
function kgvid_plugin_settings_section_callback() { }
|
2513 |
|
2514 |
function kgvid_poster_callback() {
|
2515 |
+
$options = kgvid_get_options();
|
2516 |
+
echo "<input class='regular-text affects_player' id='poster' name='kgvid_video_embed_options[poster]' type='text' value='".$options['poster']."' /> <span id='pick-thumbnail' class='button-secondary' data-choose='".__('Choose a Thumbnail', 'video-embed-thumbnail-generator')."' data-update='".__('Set as video thumbnail', 'video-embed-thumbnail-generator')."' data-change='poster' onclick='kgvid_pick_image(this);'>".__('Choose from Library', 'video-embed-thumbnail-generator')."</span>\n\t";
|
2517 |
}
|
2518 |
|
2519 |
function kgvid_endofvideooverlay_callback() {
|
2520 |
+
$options = kgvid_get_options();
|
2521 |
+
echo "<input class='affects_player' ".checked( $options['endofvideooverlaysame'], "on", false )." id='endofvideooverlaysame' name='kgvid_video_embed_options[endofvideooverlaysame]' type='checkbox' /> <label for='endofvideooverlaysame'>".__('Display thumbnail image again when video ends.', 'video-embed-thumbnail-generator')."</label><br />";
|
2522 |
+
echo "<input class='regular-text affects_player' id='endofvideooverlay' name='kgvid_video_embed_options[endofvideooverlay]' ".disabled( $options['endofvideooverlaysame'], "true", false )." type='text' value='".$options['endofvideooverlay']."' /> <span id='pick-endofvideooverlay' class='button-secondary' data-choose='".__('Choose End of Video Image', 'video-embed-thumbnail-generator')."' data-update='".__('Set as end of video image', 'video-embed-thumbnail-generator')."' data-change='endofvideooverlay' onclick='kgvid_pick_image(this);'>".__('Choose from Library', 'video-embed-thumbnail-generator')."</span><br />";
|
2523 |
echo "Display alternate image when video ends.<small>\n\t";
|
2524 |
}
|
2525 |
|
2526 |
function kgvid_watermark_callback() {
|
2527 |
+
$options = kgvid_get_options();
|
2528 |
+
echo "<input class='regular-text affects_player' id='watermark' name='kgvid_video_embed_options[watermark]' type='text' value='".$options['watermark']."' /> <span id='pick-watermark' class='button-secondary' data-choose='".__('Choose a Watermark', 'video-embed-thumbnail-generator')."' data-update='".__('Set as watermark', 'video-embed-thumbnail-generator')."' data-change='watermark' onclick='kgvid_pick_image(this);'>".__('Choose from Library', 'video-embed-thumbnail-generator')."</span>\n\t";
|
2529 |
}
|
2530 |
|
2531 |
function kgvid_align_callback() {
|
2532 |
+
$options = kgvid_get_options();
|
2533 |
+
$items = array(__("left", 'video-embed-thumbnail-generator') => "left", __("center", 'video-embed-thumbnail-generator') => "center", __("right", 'video-embed-thumbnail-generator') => "right");
|
2534 |
echo "<select id='align' name='kgvid_video_embed_options[align]'>";
|
2535 |
+
foreach($items as $name => $value) {
|
2536 |
+
$selected = ($options['align']==$value) ? 'selected="selected"' : '';
|
2537 |
+
echo "<option value='$value' $selected>$name</option>";
|
2538 |
}
|
2539 |
echo "</select>\n\t";
|
2540 |
}
|
2541 |
|
2542 |
function kgvid_resize_callback() {
|
2543 |
+
$options = kgvid_get_options();
|
2544 |
+
echo "<input ".checked( $options['resize'], "on", false )." id='resize' name='kgvid_video_embed_options[resize]' type='checkbox' /> <label for='resize'>".__('Make video player responsive.', 'video-embed-thumbnail-generator')."</label>\n\t";
|
2545 |
}
|
2546 |
|
2547 |
function kgvid_inline_callback() {
|
2548 |
+
$options = kgvid_get_options();
|
2549 |
+
echo "<input ".checked( $options['inline'], "on", false )." id='inline' name='kgvid_video_embed_options[inline]' type='checkbox' /> <label for='inline'>".__('Allow other content on the same line as the video.', 'video-embed-thumbnail-generator')."</label>\n\t";
|
2550 |
}
|
2551 |
|
2552 |
function kgvid_dimensions_callback() {
|
2553 |
+
$options = kgvid_get_options();
|
2554 |
+
echo __('Width:', 'video-embed-thumbnail-generator')." <input class='small-text affects_player' id='width' name='kgvid_video_embed_options[width]' type='text' value='".$options['width']."' /> ".__('Height:', 'video-embed-thumbnail-generator')." <input class='small-text affects_player' id='height' name='kgvid_video_embed_options[height]' type='text' value='".$options['height']."' /> ";
|
2555 |
+
echo "<input ".checked( $options['minimum_width'], "on", false )." id='minimum_width' name='kgvid_video_embed_options[minimum_width]' type='checkbox' /> <label for='minimum_width'>".__('Enlarge lower resolution videos to max width.', 'video-embed-thumbnail-generator')."</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Usually if a video\'s resolution is less than the max width, the video player is set to the actual width of the video. Enabling this will always set the same width regardless of the quality of the video. When necessary you can override by setting the dimensions manually.', 'video-embed-thumbnail-generator')."</span></a>\n\t";
|
2556 |
}
|
2557 |
|
2558 |
function kgvid_gallery_dimensions_callback() {
|
2559 |
+
$options = kgvid_get_options();
|
2560 |
+
echo __('Width:', 'video-embed-thumbnail-generator')." <input class='small-text' id='gallery_width' name='kgvid_video_embed_options[gallery_width]' type='text' value='".$options['gallery_width']."' /> ".__('Height:', 'video-embed-thumbnail-generator')." <input class='small-text' id='gallery_height' name='kgvid_video_embed_options[gallery_height]' type='text' value='".$options['gallery_height']."' />\n\t";
|
2561 |
}
|
2562 |
|
2563 |
function kgvid_gallery_thumb_callback() {
|
2564 |
+
$options = kgvid_get_options();
|
2565 |
echo "<input class='small-text' id='gallery_thumb' name='kgvid_video_embed_options[gallery_thumb]' type='text' value='".$options['gallery_thumb']."' />\n\t";
|
2566 |
}
|
2567 |
|
2568 |
function kgvid_controlbar_style_callback() {
|
2569 |
+
$options = kgvid_get_options();
|
2570 |
+
$items = array();
|
2571 |
+
$items[__("docked", 'video-embed-thumbnail-generator')] = "docked";
|
2572 |
+
if ( $options['embed_method'] == "Strobe Media Playback" ) { $items[__("floating", 'video-embed-thumbnail-generator')] = "floating"; }
|
2573 |
+
$items[__("none", 'video-embed-thumbnail-generator')] = "none";
|
2574 |
echo "<select class='affects_player' id='controlbar_style' name='kgvid_video_embed_options[controlbar_style]'>";
|
2575 |
+
foreach($items as $name => $value) {
|
2576 |
+
$selected = ($options['controlbar_style']==$value) ? 'selected="selected"' : '';
|
2577 |
+
echo "<option value='$value' $selected>$name</option>";
|
2578 |
}
|
2579 |
+
echo "</select>\n\t";
|
2580 |
}
|
2581 |
|
2582 |
function kgvid_autoplay_callback() {
|
2583 |
+
$options = kgvid_get_options();
|
2584 |
+
echo "<input class='affects_player' ".checked( $options['autoplay'], "on", false )." id='autoplay' name='kgvid_video_embed_options[autoplay]' type='checkbox' /> <label for='autoplay'>".__('Play automatically when page loads.', 'video-embed-thumbnail-generator')."</label>\n\t";
|
2585 |
}
|
2586 |
|
2587 |
function kgvid_loop_callback() {
|
2588 |
+
$options = kgvid_get_options();
|
2589 |
+
echo "<input class='affects_player' ".checked( $options['loop'], "on", false )." id='loop' name='kgvid_video_embed_options[loop]' type='checkbox' /> <label for='loop'>".__('Loop to beginning when video ends.', 'video-embed-thumbnail-generator')."</label>\n\t";
|
2590 |
+
}
|
2591 |
+
|
2592 |
+
function kgvid_preload_callback() {
|
2593 |
+
$options = kgvid_get_options();
|
2594 |
+
$items = array("metadata", "auto", "none");
|
2595 |
+
echo "<select class='affects_player' id='preload' name='kgvid_video_embed_options[preload]'>";
|
2596 |
+
foreach($items as $item) {
|
2597 |
+
$selected = ($options['preload']==$item) ? 'selected="selected"' : '';
|
2598 |
+
echo "<option value='$item' $selected>$item</option>";
|
2599 |
+
}
|
2600 |
+
echo "</select><a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>"._x('Controls how much of a video to load before the user starts playback. Mobile browsers never preload any video information. Selecting "metadata" will load the height and width and format information along with a few seconds of the video in some desktop browsers. "Auto" will preload nearly a minute of video in most desktop browsers. "None" will prevent all data from preloading.', 'Suggest not translating the words in quotation marks', 'video-embed-thumbnail-generator')."</span></a>\n\t";
|
2601 |
}
|
2602 |
|
2603 |
function kgvid_js_skin_callback() {
|
2604 |
+
$options = kgvid_get_options();
|
2605 |
+
echo "<input class='regular-text code affects_player' id='js_skin' name='kgvid_video_embed_options[js_skin]' type='text' value='".$options['js_skin']."' /><br /><em><small>".sprintf( __('Use %s for a nice, circular play button. Leave blank for the default square play button.', 'video-embed-thumbnail-generator')." <a href='http://videojs.com/docs/skins/'>".__('Or build your own CSS skin.', 'video-embed-thumbnail-generator'), '<code>kg-video-js-skin</code>')."</a></small></em>\n\t";
|
2606 |
}
|
2607 |
|
2608 |
function kgvid_bgcolor_callback() {
|
2609 |
+
$options = kgvid_get_options();
|
2610 |
echo "<input class='small-text affects_player' id='bgcolor' name='kgvid_video_embed_options[bgcolor]' maxlength='7' type='text' value='".$options['bgcolor']."' /> #rrggbb\n\t";
|
2611 |
}
|
2612 |
|
2613 |
function kgvid_configuration_callback() {
|
2614 |
+
$options = kgvid_get_options();
|
2615 |
echo "<input class='regular-text affects_player' id='configuration' name='kgvid_video_embed_options[configuration]' type='text' value='".$options['configuration']."' />\n\t";
|
2616 |
}
|
2617 |
|
2618 |
function kgvid_skin_callback() {
|
2619 |
+
$options = kgvid_get_options();
|
2620 |
+
echo "<input class='regular-text affects_player' id='skin' name='kgvid_video_embed_options[skin]' type='text' value='".$options['skin']."' /><br /><em><small>".sprintf( __('Use %s for a modern, circular play button.', 'video-embed-thumbnail-generator'), "<code>".plugins_url("", __FILE__)."/flash/skin/kgvid_skin.xml</code>" )."<br /> ".__('Leave blank for the off-center square play button.', 'video-embed-thumbnail-generator')."</small></em>\n\t";
|
2621 |
}
|
2622 |
|
2623 |
function kgvid_stream_type_callback() {
|
2624 |
+
$options = kgvid_get_options();
|
2625 |
$items = array("liveOrRecorded", "live", "recorded", "dvr");
|
2626 |
echo "<select class='affects_player' id='stream_type' name='kgvid_video_embed_options[stream_type]'>";
|
2627 |
foreach($items as $item) {
|
2632 |
}
|
2633 |
|
2634 |
function kgvid_scale_mode_callback() {
|
2635 |
+
$options = kgvid_get_options();
|
2636 |
+
$items = array(__("letterbox", 'video-embed-thumbnail-generator') => "letterbox", __("none", 'video-embed-thumbnail-generator') => "none", __("stretch", 'video-embed-thumbnail-generator') => "stretch", __("zoom", 'video-embed-thumbnail-generator') => "zoom");
|
2637 |
echo "<select class='affects_player' id='scale_mode' name='kgvid_video_embed_options[scale_mode]'>";
|
2638 |
+
foreach($items as $name=>$value) {
|
2639 |
+
$selected = ($options['scale_mode']==$value) ? 'selected="selected"' : '';
|
2640 |
+
echo "<option value='$value' $selected>$name</option>";
|
2641 |
}
|
2642 |
echo "</select>\n\t";
|
2643 |
}
|
2644 |
|
2645 |
function kgvid_autohide_callback() {
|
2646 |
+
$options = kgvid_get_options();
|
2647 |
+
echo "<input ".checked( $options['autohide'], "on", false )." id='autohide' name='kgvid_video_embed_options[autohide]' type='checkbox' /> <label for='autohide'>".__('Autohide controlbar.', 'video-embed-thumbnail-generator')."</label>\n\t";
|
2648 |
}
|
2649 |
|
2650 |
function kgvid_playbutton_callback() {
|
2651 |
+
$options = kgvid_get_options();
|
2652 |
+
echo "<input class='affects_player' ".checked( $options['playbutton'], "on", false )." id='playbutton' name='kgvid_video_embed_options[playbutton]' type='checkbox' /> <label for='playbutton'>".__('Overlay play button on poster frame.', 'video-embed-thumbnail-generator')."</label>\n\t";
|
2653 |
}
|
2654 |
|
2655 |
function kgvid_generate_thumbs_callback() {
|
2656 |
+
$options = kgvid_get_options();
|
2657 |
echo "<input class='small-text' id='generate_thumbs' name='kgvid_video_embed_options[generate_thumbs]' maxlength='2' type='text' value='".strval($options['generate_thumbs'])."' />\n\t";
|
2658 |
}
|
2659 |
|
2660 |
+
function kgvid_user_roles_callback($page_scope = 'site') {
|
2661 |
global $wp_roles;
|
2662 |
+
$options = kgvid_get_options();
|
2663 |
$capabilities_checkboxes = array();
|
2664 |
+
$capabilities = array( 'make_video_thumbnails'=>__('Can make thumbnails', 'video-embed-thumbnail-generator'), 'encode_videos'=>__('Can encode videos', 'video-embed-thumbnail-generator'), 'edit_others_video_encodes' => __('Can view & modify other users encode queue', 'video-embed-thumbnail-generator') );
|
2665 |
foreach ( $capabilities as $capability => $capability_name ) {
|
2666 |
+
$capabilities_checkboxes[] = "<div class='kgvid_user_roles'><strong>".$capability_name.":</strong><br>";
|
2667 |
foreach ( $wp_roles->roles as $role => $role_info ) {
|
2668 |
|
2669 |
$capability_enabled = false;
|
2670 |
+
if ( $page_scope == 'network' ) {
|
2671 |
+
$option_name = 'default_capabilities';
|
2672 |
+
if ( array_key_exists('default_capabilities', $options)
|
2673 |
+
&& array_key_exists($role, $options['default_capabilities'][$capability])
|
2674 |
+
&& $options['default_capabilities'][$capability][$role] == "on" ) {
|
2675 |
+
$capability_enabled = true;
|
2676 |
+
}
|
2677 |
+
}
|
2678 |
+
else {
|
2679 |
+
$option_name = 'capabilities';
|
2680 |
+
if ( is_array($wp_roles->roles[$role]['capabilities']) && array_key_exists($capability, $wp_roles->roles[$role]['capabilities'])
|
2681 |
+
&& $wp_roles->roles[$role]['capabilities'][$capability] == 1 ) {
|
2682 |
+
$capability_enabled = true;
|
2683 |
+
}
|
2684 |
+
}
|
2685 |
+
$capabilities_checkboxes[] = "<input type='checkbox' ".checked( $capability_enabled, true, false )." id='capability-".$capability."-".$role."' name='kgvid_video_embed_options[".$option_name."][".$capability."][".$role."]'> <label for='capability-".$capability."-".$role."'>".$role_info['name']."</label><br>";
|
2686 |
|
2687 |
} //role loop
|
2688 |
+
$capabilities_checkboxes[] = "</div>";
|
2689 |
}// capability loop
|
2690 |
+
echo implode("", $capabilities_checkboxes)."\n\t";
|
2691 |
}
|
2692 |
|
2693 |
function kgvid_security_callback() {
|
2694 |
+
$options = kgvid_get_options();
|
2695 |
if ( $options['embeddable'] != "on" ) { $embed_disabled = " disabled='disabled'"; }
|
2696 |
else { $embed_disabled = ""; }
|
2697 |
+
echo "<input class='affects_player' ".checked( $options['embeddable'], "on", false )." id='embeddable' name='kgvid_video_embed_options[embeddable]' type='checkbox' onclick='kgvid_embeddable_switch(this.checked);' /> <label for='embeddable'>".__('Allow users to embed your videos on other sites.', 'video-embed-thumbnail-generator')."</label><br />";
|
2698 |
+
echo "<input ".checked( $options['open_graph'], "on", false )." id='open_graph' name='kgvid_video_embed_options[open_graph]' type='checkbox'".$embed_disabled." /> <label for='open_graph'>"._x('Enable Open Graph video tags', '"Open Graph" is a proper noun and might not need translation', 'video-embed-thumbnail-generator')."</label><a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Facebook and some other social media sites will use these tags to embed the first video in your post. For the majority of Facebook users who have enabled secure browsing, your video must be served via https in order to be embedded directly on the page.', 'video-embed-thumbnail-generator')."</span></a><br />";
|
2699 |
+
echo "<input class='affects_player' ".checked( $options['right_click'], "on", false )." id='right_click' name='kgvid_video_embed_options[right_click]' type='checkbox' /> <label for='right_click'>".__('Allow right-clicking on videos.', 'video-embed-thumbnail-generator')."</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('We can\'t prevent a user from simply saving the downloaded video file from the browser\'s cache, but disabling right-clicking will make it more difficult for casual users to save your videos.', 'video-embed-thumbnail-generator')."</span></a>\n\t";
|
2700 |
}
|
2701 |
|
2702 |
function kgvid_featured_callback() {
|
2703 |
+
$options = kgvid_get_options();
|
2704 |
+
echo "<input ".checked( $options['featured'], "on", false )." id='featured' name='kgvid_video_embed_options[featured]' type='checkbox' /> <label for='featured'>".__('Set generated video thumbnails as featured images.', 'video-embed-thumbnail-generator')."</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('If your theme uses the featured image meta tag, this will automatically set a video\'s parent post\'s featured image to the most recently saved thumbnail image.', 'video-embed-thumbnail-generator')."</span></a><br /> <a class='button-secondary' href='javascript:void(0);' onclick='kgvid_set_all_featured();'>"._x('Set all as featured', 'implied "Set all thumbnails as featured"', 'video-embed-thumbnail-generator')."</a> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('If you\'ve generated thumbnails before enabling this option, this will set all existing thumbnails as featured images. Be careful!', 'video-embed-thumbnail-generator')."</span></a>\n\t";
|
2705 |
}
|
2706 |
|
2707 |
function kgvid_thumb_parent_callback() {
|
2708 |
+
$options = kgvid_get_options();
|
2709 |
$items = array("post", "video");
|
2710 |
echo "<select id='thumb_parent' name='kgvid_video_embed_options[thumb_parent]'>";
|
2711 |
foreach($items as $item) {
|
2712 |
$selected = ($options['thumb_parent']==$item) ? 'selected="selected"' : '';
|
2713 |
echo "<option value='$item' $selected>$item</option>";
|
2714 |
}
|
2715 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('This depends on your theme. Thumbnails generated by the plugin can be saved as children of the video attachment or the post. Some themes use an image attached to a post instead of the built-in featured image meta tag. Version 3.x of this plugin saved all thumbnails as children of the video.', 'video-embed-thumbnail-generator')."</span></a><br /> <a class='button-secondary' href='javascript:void(0);' onclick='kgvid_switch_parents();'>".__('Set all parents', 'video-embed-thumbnail-generator')."</a> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('If you\'ve generated thumbnails before changing this option, this will set all existing thumbnails as children of your currently selected option.', 'video-embed-thumbnail-generator')."</span></a>\n\t";
|
2716 |
}
|
2717 |
|
2718 |
function kgvid_delete_children_callback() {
|
2719 |
+
$options = kgvid_get_options();
|
2720 |
$items = array("none", "all", "encoded videos only");
|
2721 |
echo "<select id='delete_children' name='kgvid_video_embed_options[delete_children]'>";
|
2722 |
foreach($items as $item) {
|
2723 |
$selected = ($options['delete_children']==$item) ? 'selected="selected"' : '';
|
2724 |
echo "<option value='$item' $selected>$item</option>";
|
2725 |
}
|
2726 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('If you delete the original video you can choose to delete all associated attachments (thumbnails & videos) or keep the thumbnail.', 'video-embed-thumbnail-generator')."</span></a>\n\t";
|
2727 |
}
|
2728 |
|
2729 |
function kgvid_titlecode_callback() {
|
2730 |
+
$options = kgvid_get_options();
|
2731 |
+
echo "<input class='regular-text code' id='titlecode' name='kgvid_video_embed_options[titlecode]' type='text' value='".htmlentities(stripslashes($options['titlecode']))."' /> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".sprintf( __('HTML tag applied to titles inserted above the video. Examples: %s. Corresponding closing tags will be applied to the end of the title automatically.', 'video-embed-thumbnail-generator'), "<strong>, <em>, <H2>, <span class='videotitle'>")."</span></a>\n\t";
|
2732 |
}
|
2733 |
|
2734 |
function kgvid_template_callback() {
|
2735 |
+
$options = kgvid_get_options();
|
2736 |
+
$items = array(__("Video title (WP default)", 'video-embed-thumbnail-generator')=>"none", __("Video in existing template", 'video-embed-thumbnail-generator')=>"gentle", __("Video only (deprecated)", 'video-embed-thumbnail-generator')=>"old");
|
2737 |
echo "<select id='template' name='kgvid_video_embed_options[template]'>";
|
2738 |
foreach($items as $name => $value) {
|
2739 |
$selected = ($options['template']==$value) ? 'selected="selected"' : '';
|
2740 |
echo "<option value='$value' $selected>$name</option>";
|
2741 |
}
|
2742 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('By default WordPress only displays a video\'s title on the attachment page. This plugin can filter your attachment page to display the video, or completely replace your attachment template to show only the video. If you were one of the few people using iframe embed codes before version 4.0 of this plugin then you should continue to use "Video only" but otherwise it\'s not recommended.', 'video-embed-thumbnail-generator')."</span></a>\n\t";
|
2743 |
+
}
|
2744 |
+
|
2745 |
+
function kgvid_encode_settings_section_callback() {
|
2746 |
+
if ( is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
2747 |
+
$options = kgvid_get_options();
|
2748 |
+
echo "<input type='hidden' id='app_path' data-ffmpeg_exists='".$options['ffmpeg_exists']."' name='kgvid_video_embed_options[app_path]' value='".$options['app_path']."'>";
|
2749 |
+
echo "<input type='hidden' id='video_app' name='kgvid_video_embed_options[video_app]' value='".strtoupper($options['video_app'])."'>";
|
2750 |
+
}
|
2751 |
}
|
2752 |
|
2753 |
function kgvid_app_path_callback() {
|
2754 |
+
$options = kgvid_get_options();
|
2755 |
+
//if ( is_plugin_active_for_network( plugin_basename(__FILE__) ) ) { $options = get_site_option( 'kgvid_video_embed_network_options' ); }
|
2756 |
+
echo "<input class='affects_ffmpeg regular-text code' id='app_path' data-ffmpeg_exists='".$options['ffmpeg_exists']."' name='kgvid_video_embed_options[app_path]' type='text' value='".$options['app_path']."' /><a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."//wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".sprintf( __('This should be the folder where applications are installed on your server, not a direct path to an application, so it doesn\'t usually end with %1$s. Example: %2$s.', 'video-embed-thumbnail-generator'), "<code><strong class='video_app_name'>".strtoupper($options['video_app'])."</strong></code>", "<code>/usr/local/bin</code>" )."\n\t";
|
2757 |
}
|
2758 |
|
2759 |
function kgvid_video_app_callback() {
|
2760 |
+
$options = kgvid_get_options();
|
2761 |
+
//if ( is_plugin_active_for_network( plugin_basename(__FILE__) ) ) { $options = get_site_option( 'kgvid_video_embed_network_options' ); }
|
2762 |
echo "<select onchange='kgvid_hide_ffmpeg_settings();' class='affects_ffmpeg' id='video_app' name='kgvid_video_embed_options[video_app]'>";
|
2763 |
$items = array("FFMPEG"=>"ffmpeg", "LIBAV"=>"avconv");
|
2764 |
foreach($items as $name => $value) {
|
2765 |
$selected = ($options['video_app']==$value) ? 'selected="selected"' : '';
|
2766 |
echo "<option value='$value' $selected>$name</option>";
|
2767 |
}
|
2768 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('FFMPEG split into two separate branches in 2011. The new branch is called LIBAV and executes using "avconv" instead of "ffmpeg." Both are still actively developed and FFMPEG frequently incorporates LIBAV features. Debian & Ubuntu users probably have LIBAV installed.', 'video-embed-thumbnail-generator')."</span></a>\n\t";
|
2769 |
}
|
2770 |
|
2771 |
function kgvid_browser_thumbnails_callback() {
|
2772 |
+
$options = kgvid_get_options();
|
2773 |
echo "<div class='kgvid_video_app_required'>";
|
2774 |
+
echo "<input ".checked( $options['browser_thumbnails'], "on", false )." id='browser_thumbnails' name='kgvid_video_embed_options[browser_thumbnails]' type='checkbox' /> <label for='browser_thumbnails'>".sprintf( __('When possible, use the browser\'s built-in video capabilities to make thumbnails instead of %s.', 'video-embed-thumbnail-generator'), "<strong class='video_app_name'>".strtoupper($options['video_app'])."</strong>")."</label>\n\t";
|
2775 |
echo "</div>";
|
2776 |
}
|
2777 |
|
2778 |
function kgvid_encode_formats_callback() {
|
2779 |
+
$options = kgvid_get_options();
|
2780 |
echo "<div class='kgvid_video_app_required'>";
|
2781 |
+
echo "<input ".checked( $options['encode_fullres'], "on", false )." id='encode_fullres' name='kgvid_video_embed_options[encode_fullres]' type='checkbox' /> <label for='encode_fullres'>".__('Replace original with same resolution H.264', 'video-embed-thumbnail-generator')."</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."//wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('If you have FFMPEG/LIBAV and the proper libraries installed, you can choose to replace your uploaded video with an H.264 video, and also transcode into as many as five 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 480p 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 Windows now. I no longer recommend encoding OGV or WEBM unless you expect a large number of no-Flash sticklers visiting your site.', 'video-embed-thumbnail-generator')."</span></a><br />";
|
2782 |
+
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 <small><em>".__('(iPhone 4s+, iPad 2+, modern Android, Windows Phone 8, Chrome, Safari, IE 9+, Firefox Windows)', 'video-embed-thumbnail-generator')."</em></small></label><br />";
|
2783 |
+
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 <small><em>".__('(iPhone 4+, iPad, most Android, Chrome, Safari, IE 9+, Firefox Windows)', 'video-embed-thumbnail-generator')."</em></small></label><br />";
|
2784 |
+
echo "<input ".checked( $options['encode_mobile'], "on", false )." id='encode_mobile' name='kgvid_video_embed_options[encode_mobile]' type='checkbox' /> <label for='encode_mobile'>480p H.264 <small><em>(iOS, Android, Windows Phone 7, Chrome, Safari, IE 9+, Firefox Windows)</em></small></label><br />";
|
2785 |
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 />";
|
2786 |
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>";
|
2787 |
echo "</div>\n\t";
|
2788 |
}
|
2789 |
|
2790 |
+
function kgvid_generate_auto_thumb_label() { //for localization and switching between 1 and many thumbnails
|
2791 |
+
$options = kgvid_get_options();
|
2792 |
+
if ( intval($options['auto_thumb_number']) == 1 ) {
|
2793 |
+
$items = array(0, 25, 50, 75);
|
2794 |
+
$percentage_select = "<select id='auto_thumb_position' name='kgvid_video_embed_options[auto_thumb_position]'>";
|
2795 |
+
foreach($items as $item) {
|
2796 |
+
$selected = ($options['auto_thumb_position']==$item) ? 'selected="selected"' : '';
|
2797 |
+
$percentage_select .= "<option value='$item' $selected>$item</option>";
|
2798 |
+
}
|
2799 |
+
$percentage_select .= "</select>";
|
2800 |
+
}
|
2801 |
+
else { $percentage_select = "<input id='auto_thumb_position' name='kgvid_video_embed_options[auto_thumb_position]' class='small-text' type='text' value='".$options['auto_thumb_position']."' maxlength='3'>"; }
|
2802 |
+
$auto_thumb_number_input = "<input id='auto_thumb_number' name='kgvid_video_embed_options[auto_thumb_number]' class='small-text' type='text' value='".$options['auto_thumb_number']."' maxlength='3'>";
|
2803 |
+
|
2804 |
+
$code = sprintf( _n('Generate %1$s thumbnail from %2$s%% of the way through the video.', 'Generate %1$s thumbnails and set #%2$s as the main image.', intval($options['auto_thumb_number']), 'video-embed-thumbnail-generator'), $auto_thumb_number_input, $percentage_select );
|
2805 |
+
|
2806 |
+
return $code;
|
2807 |
+
}
|
2808 |
+
|
2809 |
function kgvid_automatic_callback() {
|
2810 |
+
$options = kgvid_get_options();
|
2811 |
echo "<div class='kgvid_video_app_required'>";
|
2812 |
+
echo "<input ".checked( $options['auto_encode'], "on", false )." id='auto_encode' name='kgvid_video_embed_options[auto_encode]' type='checkbox' /> <label for='auto_encode'>".__('Encode formats selected above.', 'video-embed-thumbnail-generator')."</label><br />";
|
2813 |
+
if ( intval($options['auto_thumb_number']) == 1 ) {
|
2814 |
+
$items = array(0, 25, 50, 75);
|
2815 |
+
$percentage_select = "<select id='auto_thumb_position' name='kgvid_video_embed_options[auto_thumb_position]'>";
|
2816 |
+
foreach($items as $item) {
|
2817 |
+
$selected = ($options['auto_thumb_position']==$item) ? 'selected="selected"' : '';
|
2818 |
+
$percentage_select .= "<option value='$item' $selected>$item</option>";
|
2819 |
+
}
|
2820 |
+
$percentage_select .= "</select>";
|
2821 |
}
|
2822 |
+
else { $percentage_select = "<input id='auto_thumb_position' name='kgvid_video_embed_options[auto_thumb_position]' class='small-text' type='text' value='".$options['auto_thumb_position']."' maxlength='3'>"; }
|
2823 |
+
$auto_thumb_number_input = "<input id='auto_thumb_number' name='kgvid_video_embed_options[auto_thumb_number]' class='small-text' type='text' value='".$options['auto_thumb_number']."' maxlength='3'>";
|
2824 |
+
$auto_thumb_label = kgvid_generate_auto_thumb_label();
|
2825 |
+
echo "<input ".checked( $options['auto_thumb'], "on", false )." id='auto_thumb' name='kgvid_video_embed_options[auto_thumb]' type='checkbox' /> <label id='auto_thumb_label' for='auto_thumb'>".$auto_thumb_label." </label>";
|
2826 |
echo "</div>\n\t";
|
2827 |
}
|
2828 |
|
2829 |
function kgvid_htaccess_callback() {
|
2830 |
+
$options = kgvid_get_options();
|
2831 |
+
echo "<div class='kgvid_video_app_required'>";
|
2832 |
+
echo "<table class='kgvid_htaccess'><tbody><tr><td>".__('Username:', 'video-embed-thumbnail-generator')."</td><td><input class='regular-text affects_ffmpeg' id='htaccess_login' name='kgvid_video_embed_options[htaccess_login]' type='text' value='".$options['htaccess_login']."' /></td></tr>";
|
2833 |
+
echo "<tr><td>".__('Password:', 'video-embed-thumbnail-generator')."</td><td><input class='regular-text affects_ffmpeg' id='htaccess_password' name='kgvid_video_embed_options[htaccess_password]' type='text' value='".$options['htaccess_password']."' /> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".sprintf( __('If your videos are htaccess protected, %s will access them using these credentials.', 'video-embed-thumbnail-generator'), "<strong class='video_app_name'>".strtoupper($options['video_app'])."</strong>" )."</span></a></td></tr></tbody></table>";
|
2834 |
+
echo "</div>\n\t";
|
2835 |
+
}
|
2836 |
+
|
2837 |
+
function kgvid_ffmpeg_watermark_callback() {
|
2838 |
+
$options = kgvid_get_options();
|
2839 |
echo "<div class='kgvid_video_app_required'>";
|
2840 |
+
echo "<p><input class='regular-text affects_ffmpeg' id='ffmpeg_watermark_url' name='kgvid_video_embed_options[ffmpeg_watermark][url]' type='text' value='".$options['ffmpeg_watermark']['url']."' /> <span id='pick-ffmpeg-watermark' class='button-secondary' data-choose='".__('Choose a Watermark', 'video-embed-thumbnail-generator')."' data-update='".__('Set as watermark', 'video-embed-thumbnail-generator')."' data-change='ffmpeg_watermark_url' onclick='kgvid_pick_image(this);'>".__('Choose from Library', 'video-embed-thumbnail-generator')."</span></p>\n\t";
|
2841 |
+
echo "<p>".sprintf( __('Scale: %s%% of video covered by the watermark.', 'video-embed-thumbnail-generator'), "<input class='small-text affects_ffmpeg' id='ffmpeg_watermark_scale' name='kgvid_video_embed_options[ffmpeg_watermark][scale]' type='text' value='".$options['ffmpeg_watermark']['scale']."' maxlength='3' />" )."</p>";
|
2842 |
+
$items = array(__("left", 'video-embed-thumbnail-generator')=>"left", _x("center", "horizontal center", 'video-embed-thumbnail-generator')=>"center", __("right", 'video-embed-thumbnail-generator')=>"right");
|
2843 |
+
echo "<p>".__('Horizontal align:', 'video-embed-thumbnail-generator');
|
2844 |
+
echo " <select id='ffmpeg_watermark_align' name='kgvid_video_embed_options[ffmpeg_watermark][align]' class='affects_ffmpeg'>";
|
2845 |
+
foreach($items as $name=>$value) {
|
2846 |
+
$selected = ($options['ffmpeg_watermark']['align']==$value) ? 'selected="selected"' : '';
|
2847 |
+
echo "<option value='$value' $selected>$name</option>";
|
2848 |
+
}
|
2849 |
+
echo "</select> ";
|
2850 |
+
_e('offset', 'video-embed-thumbnail-generator');
|
2851 |
+
echo " <input class='small-text affects_ffmpeg' id='ffmpeg_watermark_x' name='kgvid_video_embed_options[ffmpeg_watermark][x]' type='text' value='".$options['ffmpeg_watermark']['x']."' maxlength='3' />%</p>";
|
2852 |
+
echo "<p>".__('Vertical align:', 'video-embed-thumbnail-generator');
|
2853 |
+
echo " <select id='ffmpeg_watermark_valign' name='kgvid_video_embed_options[ffmpeg_watermark][valign]' class='affects_ffmpeg'>";
|
2854 |
+
$items = array(__("top", 'video-embed-thumbnail-generator')=>"top", _x("center", "vertical center", 'video-embed-thumbnail-generator')=>"center", __("bottom", 'video-embed-thumbnail-generator')=>"bottom");
|
2855 |
+
foreach($items as $name=>$value) {
|
2856 |
+
$selected = ($options['ffmpeg_watermark']['valign']==$value) ? 'selected="selected"' : '';
|
2857 |
+
echo "<option value='$value' $selected>$name</option>";
|
2858 |
+
}
|
2859 |
+
echo "</select> ";
|
2860 |
+
_e('offset', 'video-embed-thumbnail-generator');
|
2861 |
+
echo " <input class='small-text affects_ffmpeg' id='ffmpeg_watermark_y' name='kgvid_video_embed_options[ffmpeg_watermark][y]' type='text' value='".$options['ffmpeg_watermark']['y']."' maxlength='3' />%";
|
2862 |
+
echo "</p>\n\t";
|
2863 |
+
echo "<div id='ffmpeg_watermark_example'></div>";
|
2864 |
echo "</div>\n\t";
|
2865 |
}
|
2866 |
|
2867 |
function kgvid_moov_callback() {
|
2868 |
+
$options = kgvid_get_options();
|
2869 |
echo "<div class='kgvid_video_app_required'>";
|
2870 |
+
$items = array(__("none", 'video-embed-thumbnail-generator')=>"none", "movflags faststart"=>"movflag", "qt-faststart"=>"qt-faststart", "MP4Box"=>"MP4Box");
|
2871 |
echo "<select id='moov' name='kgvid_video_embed_options[moov]' class='affects_ffmpeg'>";
|
2872 |
foreach($items as $name => $value) {
|
2873 |
$selected = ($options['moov']==$value) ? 'selected="selected"' : '';
|
2874 |
echo "<option value='$value' $selected>$name</option>";
|
2875 |
}
|
2876 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".sprintf( __('By default %1$s places moov atoms at the end of H.264 encoded files, which forces the entire file to download before playback can start and can prevent Flash players from playing them at all. Since approximately October 2012 %1$s can fix the problem at the end of the encoding process by using the option `movflags faststart`. This is the easiest and fastest way to correct the problem, but older versions of %1$s will not work if you select the movflags option. If you can\'t update to a new version of %1$s, select qt-faststart or MP4Box which will run after encoding is finished if they are installed on your server.', 'video-embed-thumbnail-generator'), "<strong class='video_app_name'>".strtoupper($options['video_app'])."</strong>")."</span></a>";
|
2877 |
echo "</div>\n\t";
|
2878 |
}
|
2879 |
|
2880 |
function kgvid_rate_control_callback() {
|
2881 |
+
$options = kgvid_get_options();
|
2882 |
echo "<div class='kgvid_video_app_required'>";
|
2883 |
echo "<select id='rate_control' name='kgvid_video_embed_options[rate_control]' onchange='kgvid_hide_ffmpeg_settings();' class='affects_ffmpeg'>";
|
2884 |
$items = array("Constant Rate Factor"=>"crf", "Average Bit Rate"=>"abr");
|
2886 |
$selected = ($options['rate_control']==$value) ? 'selected="selected"' : '';
|
2887 |
echo "<option value='$value' $selected>$name</option>";
|
2888 |
}
|
2889 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Constant Rate Factor (CRF) attempts to maintain a particular quality output for the entire video and only uses bits the encoder determines are necessary. Average Bit Rate is similar to the method used in older versions of this plugin. If CRF is selected, WEBM encoding will also use the ABR setting to set a max bit rate 25% higher than the ABR. Without a max bit rate setting WEBM files are terrible quality.', 'video-embed-thumbnail-generator')."</span></a>";
|
2890 |
echo "</div>\n\t";
|
2891 |
}
|
2892 |
|
2893 |
function kgvid_CRF_options_callback() {
|
2894 |
+
$options = kgvid_get_options();
|
2895 |
echo "<div class='kgvid_video_app_required'>";
|
2896 |
echo "<select id='h264_CRF' name='kgvid_video_embed_options[h264_CRF]' class='affects_ffmpeg'>";
|
2897 |
for ($i = 0; $i <= 51; $i++ ) {
|
2898 |
$selected = ($options['h264_CRF']==$i) ? 'selected="selected"' : '';
|
2899 |
echo "<option value='".$i."' $selected>".$i."</option>";
|
2900 |
}
|
2901 |
+
echo "</select> H.264 <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Lower values are higher quality. 18 is considered visually lossless. Default is 23.', 'video-embed-thumbnail-generator')."</span></a><br />";
|
2902 |
|
2903 |
echo "<select id='webm_CRF' name='kgvid_video_embed_options[webm_CRF]' class='affects_ffmpeg'>";
|
2904 |
for ($i = 4; $i <= 63; $i++ ) {
|
2905 |
$selected = ($options['webm_CRF']==$i) ? 'selected="selected"' : '';
|
2906 |
echo "<option value='".$i."' $selected>".$i."</option>";
|
2907 |
}
|
2908 |
+
echo "</select> WEBM <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Lower values are higher quality. Default is 10.', 'video-embed-thumbnail-generator')."</span></a><br />\n\t";
|
2909 |
|
2910 |
echo "<select id='ogv_CRF' name='kgvid_video_embed_options[ogv_CRF]' class='affects_ffmpeg'>";
|
2911 |
for ($i = 1; $i <= 10; $i++ ) {
|
2912 |
$selected = ($options['ogv_CRF']==$i) ? 'selected="selected"' : '';
|
2913 |
echo "<option value='".$i."' $selected>".$i."</option>";
|
2914 |
}
|
2915 |
+
echo "</select> OGV (qscale) <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Higher values are higher quality. Default is 6.', 'video-embed-thumbnail-generator')."</span></a>";
|
2916 |
echo "</div>\n\t";
|
2917 |
}
|
2918 |
|
2919 |
function kgvid_average_bitrate_callback() {
|
2920 |
+
$options = kgvid_get_options();
|
2921 |
echo "<div class='kgvid_video_app_required'>";
|
2922 |
echo "<select onchange='kgvid_set_bitrate_display();' id='bitrate_multiplier' name='kgvid_video_embed_options[bitrate_multiplier]' class='affects_ffmpeg'>";
|
2923 |
for ($i = 0.01; $i <= 0.31; $i=$i+0.01 ) {
|
2924 |
$selected = ($options['bitrate_multiplier']==strval($i)) ? 'selected="selected"' : '';
|
2925 |
echo "<option value='$i' $selected>$i</option>";
|
2926 |
}
|
2927 |
+
echo "</select> ".__('bits per pixel.', 'video-embed-thumbnail-generator')." <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Default is 0.1', 'video-embed-thumbnail-generator')."</span></a><br />";
|
2928 |
echo "<span class='kgvid_gray_text'>1080p = <span id='1080_bitrate'>".round(floatval($options['bitrate_multiplier'])*1920*1080*30/1024)."</span> kbps<br />";
|
2929 |
echo "720p = <span id='720_bitrate'>".round(floatval($options['bitrate_multiplier'])*1280*720*30/1024)."</span> kbps<br />";
|
2930 |
echo "480p = <span id='360_bitrate'>".round(floatval($options['bitrate_multiplier'])*640*360*30/1024)."</span> kbps</span>";
|
2932 |
}
|
2933 |
|
2934 |
function kgvid_h264_profile_callback() {
|
2935 |
+
$options = kgvid_get_options();
|
2936 |
echo "<div class='kgvid_video_app_required'>";
|
2937 |
echo "<select id='h264_profile' name='kgvid_video_embed_options[h264_profile]' class='affects_ffmpeg'>";
|
2938 |
$items = array("none", "baseline", "main", "high", "high10", "high422", "high444");
|
2940 |
$selected = ($options['h264_profile']==$item) ? 'selected="selected"' : '';
|
2941 |
echo "<option value='$item' $selected>$item</option>";
|
2942 |
}
|
2943 |
+
echo "</select> "._x('profile', 'H.264 profile. Might not need translation', 'video-embed-thumbnail-generator')." <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Lower profiles will slightly increase file sizes. This mostly depends on your need for compatability with Android devices. Main profile seems to work on recent phones, although officially Android only supports baseline. High profile is not recommended for mobile or Flash compatibility, and anything above high is designed for professional video and probably incompatible with consumer devices. Older versions of FFMPEG might ignore this setting altogether.', 'video-embed-thumbnail-generator')."</span></a><br />";
|
2944 |
echo "<select id='h264_level' name='kgvid_video_embed_options[h264_level]' class='affects_ffmpeg'>";
|
2945 |
$items = array("none", "1", "1.1", "1.2", "1.3", "2", "2.1", "2.2", "3", "3.1", "3.2", "4", "4.1", "4.2", "5", "5.1");
|
2946 |
foreach($items as $item) {
|
2947 |
$selected = ($options['h264_level']==$item) ? 'selected="selected"' : '';
|
2948 |
echo "<option value='$item' $selected>$item</option>";
|
2949 |
}
|
2950 |
+
echo "</select> "._x('level', 'H.264 level. Might not need translation', 'video-embed-thumbnail-generator')." <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('3.0 is default. Lower levels will lower maximum bit rates and decoding complexity. This mostly depends on your need for compatability with mobile devices. Older versions of FFMPEG might ignore this setting altogether.', 'video-embed-thumbnail-generator')."</span></a>";
|
2951 |
echo "</div>\n\t";
|
2952 |
}
|
2953 |
|
2954 |
function kgvid_audio_bitrate_options_callback() {
|
2955 |
+
$options = kgvid_get_options();
|
2956 |
echo "<div class='kgvid_video_app_required'>";
|
2957 |
$items = array(96, 112, 128, 160, 192, 224, 256, 320);
|
2958 |
echo "<select id='audio_bitrate' name='kgvid_video_embed_options[audio_bitrate]' class='affects_ffmpeg'>";
|
2965 |
}
|
2966 |
|
2967 |
function kgvid_ffmpeg_options_callback() {
|
2968 |
+
$options = kgvid_get_options();
|
2969 |
echo "<div class='kgvid_video_app_required'>";
|
2970 |
+
echo "<input class='affects_ffmpeg' onchange='if(jQuery(\"#ffmpeg_vpre\").attr(\"checked\")==\"checked\"){jQuery(\"#video_bitrate_flag\").attr(\"checked\", \"checked\");}' ".checked( $options['video_bitrate_flag'], "on", false )." id='video_bitrate_flag' name='kgvid_video_embed_options[video_bitrate_flag]' type='checkbox' /> <label for='video_bitrate_flag'>".__('Enable legacy FFMPEG "-b" and "-ba" bitrate flags.', 'video-embed-thumbnail-generator')."</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Enable if your installed version of FFMPEG is old enough that you can\'t use the newer -b:v flags (Dreamhost users must turn this on). It may cause newer versions of FFMPEG to fail.', 'video-embed-thumbnail-generator')."</span></a><br />
|
2971 |
+
<input class='affects_ffmpeg' onchange='if(jQuery(\"#ffmpeg_vpre\").attr(\"checked\")==\"checked\"){jQuery(\"#video_bitrate_flag\").attr(\"checked\", \"checked\");}' ".checked( $options['ffmpeg_vpre'], "on", false )." id='ffmpeg_vpre' name='kgvid_video_embed_options[ffmpeg_vpre]' type='checkbox' /> <label for='ffmpeg_vpre'>".__('Enable legacy FFMPEG parameters.', 'video-embed-thumbnail-generator')."</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".__('Enable if your installed version of FFMPEG is old enough that libx264 requires additional configuration to operate (Dreamhost users must turn this on). This should help if you can encode WEBM or OGV files but H264/Mobile files fail. It could cause newer versions of FFMPEG to fail.', 'video-embed-thumbnail-generator')."</span></a>";
|
2972 |
echo "</div>\n\t";
|
2973 |
}
|
2974 |
|
2975 |
function kgvid_execution_options_callback() {
|
2976 |
+
$options = kgvid_get_options();
|
2977 |
+
|
2978 |
echo "<div class='kgvid_video_app_required'>";
|
2979 |
+
echo "<select id='simultaneous_encodes' name='kgvid_video_embed_options[simultaneous_encodes]'>";
|
2980 |
+
for ($i = 1; $i <= 5; $i++ ) {
|
2981 |
+
$selected = ($options['simultaneous_encodes']==$i) ? 'selected="selected"' : '';
|
2982 |
+
echo "<option value='".$i."' $selected>".$i."</option>";
|
2983 |
+
}
|
2984 |
+
echo "</select> ".__('Simultaneous encodes.', 'video-embed-thumbnail-generator')." <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".sprintf( __('Increasing the number will allow %1$s to encode more than one file at a time, but may lead to %1$s monopolizing system resources.', 'video-embed-thumbnail-generator'), "<strong class='video_app_name'>".strtoupper($options['video_app'])."</strong>" )."</span></a><br />";
|
2985 |
+
|
2986 |
echo "<select id='threads' name='kgvid_video_embed_options[threads]' class='affects_ffmpeg'>";
|
2987 |
for ($i = 0; $i <= 16; $i++ ) {
|
2988 |
$selected = ($options['threads']==$i) ? 'selected="selected"' : '';
|
2989 |
echo "<option value='".$i."' $selected>".$i."</option>";
|
2990 |
}
|
2991 |
+
echo "</select> "._x('threads', 'CPU threads. Might not need translating', 'video-embed-thumbnail-generator')." <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".sprintf( __('Default is 1, which limits encoding speed but prevents encoding from using too many system resources. Selecting 0 will allow %1$s to optimize the number of threads or you can set the number manually. This may lead to %1$s monopolizing system resources.', 'video-embed-thumbnail-generator'), "<strong class='video_app_name'>".strtoupper($options['video_app'])."</strong>" )."</span></a><br />";
|
2992 |
+
|
2993 |
+
echo "<input ".checked( $options['nice'], "on", false )." id='nice' name='kgvid_video_embed_options[nice]' class='affects_ffmpeg' type='checkbox' /> <label for='nice'>"._x('Run', 'execute program', 'video-embed-thumbnail-generator')." <code>nice</code>.</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='".network_site_url()."/wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>".sprintf( __('Tells %1$s to run at a lower priority to avoid monopolizing system resources.', 'video-embed-thumbnail-generator'), "<strong class='video_app_name'>".strtoupper($options['video_app'])."</strong>" )."</span></a>";
|
2994 |
echo "</div>";
|
2995 |
|
2996 |
+
}
|
2997 |
+
|
2998 |
+
function kgvid_test_ffmpeg_options_callback( $scope = 'site' ) {
|
2999 |
+
|
3000 |
+
$options = kgvid_get_options();
|
3001 |
+
$video_formats = kgvid_video_formats();
|
3002 |
$encode_string = "";
|
3003 |
if ( $options['ffmpeg_exists'] == "on" ) {
|
3004 |
+
|
3005 |
$movie_info = kgvid_get_video_dimensions(plugin_dir_url(__FILE__)."images/sample-video-h264.mp4");
|
3006 |
$uploads = wp_upload_dir();
|
3007 |
+
if ( $video_formats[$options['sample_format']]['type'] == 'h264' ) {
|
3008 |
+
$encode_dimensions = kgvid_set_h264_encode_dimensions($movie_info, $video_formats[$options['sample_format']]);
|
3009 |
+
}
|
3010 |
+
else { $encode_dimensions = array( 'width' => $movie_info['width'], 'height' => $movie_info['height'] ); }
|
3011 |
+
$encode_string = kgvid_generate_encode_string(plugin_dir_url(__FILE__)."images/sample-video-h264.mp4", $uploads['path']."/sample-video-h264".$video_formats[$options['sample_format']]['suffix'], $movie_info, $options['sample_format'], $encode_dimensions['width'], $encode_dimensions['height'], '');
|
3012 |
}
|
3013 |
|
3014 |
+
if ( is_array($encode_string) ) { $encode_string_implode = implode('' , $encode_string); }
|
3015 |
+
else { $encode_string_implode = ''; }
|
3016 |
+
|
3017 |
$display_div = "";
|
3018 |
if ( $options['ffmpeg_exists'] != "on" ) { $display_div = " style='display:none;'"; }
|
3019 |
|
3020 |
+
$sample_format_select = "<select id='sample_format' name='kgvid_video_embed_options[sample_format]' class='affects_ffmpeg'>";
|
3021 |
+
foreach ( $video_formats as $format => $format_stats ) {
|
3022 |
+
$selected = ($options['sample_format']==$format) ? 'selected="selected"' : '';
|
3023 |
+
$sample_format_select .= "<option value='$format' $selected>".$format_stats['name']."</option>";
|
3024 |
+
}
|
3025 |
+
$sample_format_select .= "</select>";
|
3026 |
+
|
3027 |
+
echo "<div id='ffmpeg_sample_div'".$display_div."><p>".sprintf( __('%1$s sample %2$s encode command', 'video-embed-thumbnail-generator'), "<strong class='video_app_name'>".strtoupper($options['video_app'])."</strong>", $sample_format_select).":<br /><textarea id='ffmpeg_h264_sample' class='ffmpeg_sample_code code' cols='100' rows='5' wrap='soft' readonly='yes'>".$encode_string_implode."</textarea></p>";
|
3028 |
+
echo "<p>".sprintf( __('%s test output:', 'video-embed-thumbnail-generator'), "<strong class='video_app_name'>".strtoupper($options['video_app'])."</strong>")."<br /><textarea id='ffmpeg_output' class='ffmpeg_sample_code code' cols='100' rows='20' wrap='soft' readonly='yes'></textarea><br>".sprintf( __('For help interpreting this output, %s try our Wiki page on Github', 'video-embed-thumbnail-generator'), "<a href='https://github.com/kylegilman/video-embed-thumbnail-generator/wiki/Interpreting-FFMPEG-or-LIBAV-messages'>")."</a>.</p></div>\n\t";
|
3029 |
}
|
3030 |
|
3031 |
//end of settings page callback functions
|
3034 |
|
3035 |
global $wpdb;
|
3036 |
|
3037 |
+
$options = kgvid_get_options();
|
3038 |
$options_old = $options; //save the values that are in the db
|
3039 |
$default_options = kgvid_default_options_fn();
|
3040 |
|
3074 |
delete_option($old_setting);
|
3075 |
}
|
3076 |
}
|
3077 |
+
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name LIKE 'wp_FMP%'") );
|
3078 |
|
3079 |
foreach ( $default_options as $key => $value ) { //apply default values for any settings that didn't exist before
|
3080 |
if ( !array_key_exists($key, $options) ) { $options[$key] = $value; }
|
|
|
3081 |
}
|
3082 |
|
3083 |
update_option('kgvid_video_embed_options', $options);
|
3144 |
$options["endofvideooverlay"] = $options["endOfVideoOverlay"];
|
3145 |
unset($options["endOfVideoOverlaySame"]);
|
3146 |
|
3147 |
+
$upload_capable = kgvid_check_if_capable('upload_files');
|
3148 |
$options["capabilities"]["make_video_thumbnails"] = $upload_capable;
|
3149 |
$options["capabilities"]["encode_videos"] = $upload_capable;
|
3150 |
kgvid_set_capabilities($options["capabilities"]);
|
3169 |
$options['version'] = 4.25;
|
3170 |
kgvid_check_ffmpeg_exists($options, true);
|
3171 |
}
|
3172 |
+
if ( $options['version'] < 4.3 ) {
|
3173 |
+
|
3174 |
+
$options['version'] = 4.3;
|
3175 |
+
$options['jw_player_id'] = '';
|
3176 |
+
$options['preload'] = "metadata";
|
3177 |
+
$options['sample_format'] = "mobile";
|
3178 |
+
$options['ffmpeg_watermark'] = array("url" => "", "scale" => "9", "align" => "right", "valign"=> "bottom", "x" => "6", "y" => "5");
|
3179 |
+
$options['auto_thumb_number'] = 1;
|
3180 |
+
$options['simultaneous_encodes'] = 1;
|
3181 |
+
$options['downloadlink'] = false;
|
3182 |
+
|
3183 |
+
$edit_others_capable = kgvid_check_if_capable('edit_others_posts');
|
3184 |
+
$options["capabilities"]["edit_others_video_encodes"] = $edit_others_capable;
|
3185 |
+
kgvid_set_capabilities($options["capabilities"]);
|
3186 |
+
|
3187 |
+
}
|
3188 |
+
|
3189 |
if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
|
3190 |
if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
|
3191 |
}
|
3193 |
}
|
3194 |
add_action('init', 'kgvid_update_settings' );
|
3195 |
|
3196 |
+
function kgvid_validate_ffmpeg_settings($input) {
|
3197 |
+
|
3198 |
+
$ffmpeg_info = kgvid_check_ffmpeg_exists($input, false);
|
3199 |
+
if ( $ffmpeg_info['ffmpeg_exists'] == true ) { $input['ffmpeg_exists'] = "on"; }
|
3200 |
+
$input['app_path'] = $ffmpeg_info['app_path'];
|
3201 |
+
|
3202 |
+
if ( $ffmpeg_info['exec_enabled'] == false ) {
|
3203 |
+
add_settings_error( __FILE__, "ffmpeg-disabled", sprintf( __('%1$s is disabled in PHP settings. You can embed existing videos and make thumbnails with compatible browsers, but video encoding will not work. Contact your System Administrator to find out if you can enable %1$s.', 'video-embed-thumbnail-generator'), $ffmpeg_info['function']), "updated");
|
3204 |
+
$input['ffmpeg_exists'] = "notinstalled";
|
3205 |
+
}
|
3206 |
+
elseif ( $ffmpeg_info['ffmpeg_exists'] == false ) {
|
3207 |
+
add_settings_error( __FILE__, "ffmpeg-disabled", sprintf( __('%1$s not found at %2$s. You can embed existing videos and make thumbnails with compatible browsers, but video encoding is not possible without %1$s.', 'video-embed-thumbnail-generator'), strtoupper($input['video_app']), $input['app_path'] ), "updated");
|
3208 |
+
$input['ffmpeg_exists'] = "notinstalled";
|
3209 |
+
}
|
3210 |
+
|
3211 |
+
return $input;
|
3212 |
+
|
3213 |
+
}
|
3214 |
+
|
3215 |
function kgvid_video_embed_options_validate($input) { //validate & sanitize input from settings form
|
3216 |
|
3217 |
+
$options = kgvid_get_options();
|
3218 |
$default_options = kgvid_default_options_fn();
|
3219 |
|
3220 |
if (isset ($_POST["video-embed-thumbnail-generator-reset"])) {
|
3221 |
$input = $default_options;
|
3222 |
+
add_settings_error( __FILE__, "options-reset", __("Video Embed & Thumbnail Generator settings reset to default values.", 'video-embed-thumbnail-generator'), "updated" );
|
3223 |
}
|
3224 |
|
3225 |
+
if ( $input['app_path'] != $options['app_path'] || strtoupper($input['video_app']) != strtoupper($options['video_app']) ) {
|
3226 |
+
$input = kgvid_validate_ffmpeg_settings($input);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3227 |
}
|
3228 |
else { $input['ffmpeg_exists'] = $options['ffmpeg_exists']; }
|
3229 |
|
3230 |
+
if ( $input['ffmpeg_exists'] == "notinstalled" ) { $input['browser_thumbnails'] = "on"; } //in case a user had FFMPEG installed and disabled it, they can't choose to disable browser thumbnails if it's no longer installed
|
3231 |
+
|
3232 |
if ( empty($input['width']) ) {
|
3233 |
+
add_settings_error( __FILE__, "width-zero", __("You must enter a value for the maximum video width.", 'video-embed-thumbnail-generator') );
|
3234 |
$input['width'] = $options['width'];
|
3235 |
}
|
3236 |
if ( empty($input['height']) ) {
|
3237 |
+
add_settings_error( __FILE__, "height-zero", __("You must enter a value for the maximum video height.", 'video-embed-thumbnail-generator') );
|
3238 |
$input['height'] = $options['height'];
|
3239 |
}
|
3240 |
if ( empty($input['gallery_width']) ) {
|
3241 |
+
add_settings_error( __FILE__, "gallery-width-zero", __("You must enter a value for the maximum gallery video width.", 'video-embed-thumbnail-generator') );
|
3242 |
$input['gallery_width'] = $options['gallery_width'];
|
3243 |
}
|
3244 |
if ( empty($input['gallery_height']) ) {
|
3245 |
+
add_settings_error( __FILE__, "gallery-height-zero", __("You must enter a value for the maximum gallery video height.", 'video-embed-thumbnail-generator') );
|
3246 |
$input['gallery_height'] = $options['gallery_height'];
|
3247 |
}
|
3248 |
|
3250 |
|
3251 |
$input['titlecode'] = wp_kses_post( $input['titlecode'] );
|
3252 |
|
3253 |
+
if ( intval($options['auto_thumb_number']) == 1 && intval($input['auto_thumb_number']) > 1 ) {
|
3254 |
+
$input['auto_thumb_position'] = strval ( round( intval($input['auto_thumb_number']) * (intval($options['auto_thumb_position'])/100) ) );
|
3255 |
+
if ( $input['auto_thumb_position'] == "0" ) {
|
3256 |
+
$input['auto_thumb_position'] = "1";
|
3257 |
+
}
|
3258 |
+
|
3259 |
+
}
|
3260 |
+
if ( intval($options['auto_thumb_number']) > 1 && intval($input['auto_thumb_number']) == 1 ) {
|
3261 |
+
//round to the nearest 25 but not 100
|
3262 |
+
$input['auto_thumb_position'] = strval( round( round( intval($options['auto_thumb_position'])/intval($options['auto_thumb_number']) * 4 ) / 4 * 100 ) );
|
3263 |
+
if ( $input['auto_thumb_position'] == "100" ) {
|
3264 |
+
$input['auto_thumb_position'] = "75";
|
3265 |
+
}
|
3266 |
+
}
|
3267 |
+
|
3268 |
+
if ( intval($input['auto_thumb_number']) > 1 && intval($input['auto_thumb_position']) > intval($input['auto_thumb_number']) ) {
|
3269 |
+
$input['auto_thumb_position'] = $input['auto_thumb_number'];
|
3270 |
+
}
|
3271 |
+
|
3272 |
+
if ( intval($input['auto_thumb_number']) == 0 ) {
|
3273 |
+
$input['auto_thumb_number'] = $options['auto_thumb_number'];
|
3274 |
+
}
|
3275 |
+
|
3276 |
// load all settings and make sure they get a value of false if they weren't entered into the form
|
3277 |
foreach ( $default_options as $key => $value ) {
|
3278 |
if ( !array_key_exists($key, $input) ) { $input[$key] = false; }
|
3290 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
3291 |
|
3292 |
if ( current_user_can('manage_options') ) {
|
3293 |
+
|
3294 |
$setting = $_POST['setting'];
|
3295 |
$value = $_POST['value'];
|
3296 |
parse_str($_POST['all_settings'], $all_settings);
|
3297 |
$error_message = "";
|
3298 |
+
$encode_string = array();
|
3299 |
+
$auto_thumb_label = "";
|
3300 |
global $wp_settings_errors;
|
3301 |
+
|
3302 |
+
if ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( plugin_basename(__FILE__) ) && !array_key_exists('embed_method', $all_settings['kgvid_video_embed_options']) ) {
|
3303 |
+
$validated_options = kgvid_validate_network_settings($all_settings['kgvid_video_embed_options']);
|
3304 |
+
$options_updated = update_site_option('kgvid_video_embed_network_options', $validated_options);
|
3305 |
+
}
|
3306 |
+
else { //single site on the network
|
3307 |
+
$validated_options = kgvid_video_embed_options_validate($all_settings['kgvid_video_embed_options']);
|
3308 |
+
$options_updated = update_option('kgvid_video_embed_options', $validated_options);
|
3309 |
+
|
3310 |
+
|
3311 |
+
|
3312 |
+
if ( $validated_options['ffmpeg_exists'] == "on" ) {
|
3313 |
+
$movie_info = kgvid_get_video_dimensions(plugin_dir_url(__FILE__)."images/sample-video-h264.mp4");
|
3314 |
+
$uploads = wp_upload_dir();
|
3315 |
+
$video_formats = kgvid_video_formats();
|
3316 |
+
if ( $video_formats[$validated_options['sample_format']]['type'] == 'h264' ) {
|
3317 |
+
$encode_dimensions = kgvid_set_h264_encode_dimensions($movie_info, $video_formats[$validated_options['sample_format']]);
|
3318 |
+
}
|
3319 |
+
else { $encode_dimensions = array( 'width' => $movie_info['width'], 'height' => $movie_info['height'] ); }
|
3320 |
+
$encode_string = kgvid_generate_encode_string(plugin_dir_url(__FILE__)."images/sample-video-h264.mp4", $uploads['path']."/sample-video-h264".$video_formats[$validated_options['sample_format']]['suffix'], $movie_info, $validated_options['sample_format'], $encode_dimensions['width'], $encode_dimensions['height'], '');
|
3321 |
+
$auto_thumb_label = kgvid_generate_auto_thumb_label();
|
3322 |
+
}
|
3323 |
}
|
3324 |
+
|
3325 |
+
if ( !empty($wp_settings_errors) ) { $error_message = $wp_settings_errors[0]['message']; }
|
3326 |
+
|
3327 |
+
if ( strpos($setting, 'capability') !== false || strpos($setting, 'default_capabilities') !== false || strpos($setting, 'ffmpeg_watermark') !== false ) { $validated_options[$setting] = $value; }
|
3328 |
+
|
3329 |
+
$arr = array ( "error_message" => $error_message, "validated_value" => $validated_options[$setting], "ffmpeg_exists" => $validated_options['ffmpeg_exists'], "encode_string" => implode('', $encode_string), "app_path" => $validated_options['app_path'], "auto_thumb_label" => $auto_thumb_label );
|
3330 |
echo json_encode($arr);
|
3331 |
die();
|
3332 |
}
|
3335 |
|
3336 |
function kgvid_add_attachment_handler($post_id) {
|
3337 |
|
3338 |
+
$options = kgvid_get_options();
|
3339 |
|
3340 |
if ( $options['auto_encode'] == "on" || $options['auto_thumb'] == "on" ) {
|
3341 |
$post = get_post($post_id);
|
3350 |
|
3351 |
function kgvid_cron_new_attachment_handler($post_id) {
|
3352 |
|
3353 |
+
$options = kgvid_get_options();
|
3354 |
$post = get_post($post_id);
|
3355 |
$movieurl = wp_get_attachment_url($post_id);
|
3356 |
|
3357 |
if ( $options['auto_thumb'] == "on" ) {
|
3358 |
|
3359 |
+
$thumb_output = array();
|
3360 |
+
$thumb_id = array();
|
3361 |
+
$numberofthumbs = intval($options['auto_thumb_number']);
|
3362 |
+
|
3363 |
+
if ( $numberofthumbs == 1 ) {
|
3364 |
+
|
3365 |
+
switch ( $options['auto_thumb_position'] ) {
|
3366 |
+
case 0:
|
3367 |
+
$imaginary_numberofthumbs = 1;
|
3368 |
+
$iincreaser = 1;
|
3369 |
+
$thumbtimecode = "firstframe";
|
3370 |
+
$dofirstframe = true;
|
3371 |
+
break;
|
3372 |
+
case 25:
|
3373 |
+
$imaginary_numberofthumbs = 8;
|
3374 |
+
$iincreaser = 4;
|
3375 |
+
$thumbtimecode = "";
|
3376 |
+
$dofirstframe = false;
|
3377 |
+
break;
|
3378 |
+
case 50:
|
3379 |
+
$imaginary_numberofthumbs = 8;
|
3380 |
+
$iincreaser = 8;
|
3381 |
+
$thumbtimecode = "";
|
3382 |
+
$dofirstframe = false;
|
3383 |
+
break;
|
3384 |
+
case 75:
|
3385 |
+
$imaginary_numberofthumbs = 8;
|
3386 |
+
$iincreaser = 12;
|
3387 |
+
$thumbtimecode = "";
|
3388 |
+
$dofirstframe = false;
|
3389 |
+
break;
|
3390 |
+
}
|
3391 |
+
|
3392 |
+
$thumb_output[1] = kgvid_make_thumbs($post_id, $movieurl, $imaginary_numberofthumbs, 1, $iincreaser, $thumbtimecode, $dofirstframe, 'generate');
|
3393 |
+
$thumb_key = 1;
|
3394 |
+
|
3395 |
+
}//end if just one auto_thumb
|
3396 |
+
|
3397 |
+
if ( $numberofthumbs > 1 ) {
|
3398 |
+
|
3399 |
+
$thumb_key = intval($options['auto_thumb_position']);
|
3400 |
+
|
3401 |
+
$i = 1;
|
3402 |
+
$increaser = 0;
|
3403 |
+
$iincreaser = 0;
|
3404 |
+
while ( $i <= $numberofthumbs ) {
|
3405 |
+
$iincreaser = $i + $increaser;
|
3406 |
+
$thumb_output[$i] = kgvid_make_thumbs($post_id, $movieurl, $numberofthumbs, $i, $iincreaser, '', false, 'generate');
|
3407 |
+
if ( $thumb_output[$i]['lastthumbnumber'] == 'break' ) {
|
3408 |
+
$thumb_key = $i;
|
3409 |
+
break;
|
3410 |
+
}
|
3411 |
+
$increaser++;
|
3412 |
+
$i++;
|
3413 |
+
}
|
3414 |
+
|
3415 |
+
}//end if more than one auto_thumb
|
3416 |
+
|
3417 |
+
foreach ( $thumb_output as $key=>$output ) {
|
3418 |
+
|
3419 |
+
if ( $thumb_output[$key]['lastthumbnumber'] != 'break' ) {
|
3420 |
+
if ( $numberofthumbs == 1 ) { $index = false; }
|
3421 |
+
else { $index = $key; }
|
3422 |
+
$thumb_id[$key] = kgvid_save_thumb($post_id, $post->post_title, $thumb_output[$key]['thumb_url'], $index);
|
3423 |
+
}//end if there wasn't an error
|
3424 |
+
else {
|
3425 |
+
update_post_meta($post_id, '_kgflashmediaplayer-autothumb-error', $thumb_output[$thumb_key]['embed_display']);
|
3426 |
break;
|
3427 |
+
}
|
3428 |
|
3429 |
+
}//end loop through generated thumbnails to save them in the database
|
3430 |
|
3431 |
+
if ( !empty($thumb_id[$thumb_key]) ) {
|
3432 |
+
update_post_meta($post_id, '_kgflashmediaplayer-poster', $thumb_output[$thumb_key]['thumb_url']);
|
3433 |
+
update_post_meta($post_id, '_kgflashmediaplayer-poster-id', $thumb_id[$thumb_key]);
|
3434 |
+
set_post_thumbnail($post_id, $thumb_id[$thumb_key]);
|
3435 |
+
if( $options['featured'] == "on" ) {
|
3436 |
+
if ( !empty($thumb_id[$thumb_key]) && !empty($post->post_parent) ) { set_post_thumbnail($post->post_parent, $thumb_id[$thumb_key]); }
|
3437 |
+
}
|
3438 |
+
}//end setting main thumbnail
|
3439 |
|
|
|
|
|
|
|
3440 |
|
3441 |
+
}//end if auto_thumb is on
|
3442 |
|
3443 |
if ( $options['auto_encode'] == "on" ) {
|
3444 |
$video_formats = kgvid_video_formats();
|
3462 |
*/
|
3463 |
function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
3464 |
|
3465 |
+
$options = kgvid_get_options();
|
3466 |
|
3467 |
+
if ( substr($post->post_mime_type, 0, 5) == 'video' && (empty($post->post_parent)
|
3468 |
+
|| (strpos(get_post_mime_type( $post->post_parent ), 'video') === false && get_post_meta($post->ID, '_kgflashmediaplayer-externalurl', true) == false))
|
3469 |
) { //if the attachment is a video with no parent or if it has a parent the parent is not a video and the video doesn't have the externalurl post meta
|
3470 |
|
3471 |
wp_enqueue_media(); //allows using the media modal in the Media Library
|
3472 |
+
wp_enqueue_script('video_embed_thumbnail_generator_script');
|
3473 |
+
wp_enqueue_style('video_embed_thumbnail_generator_style');
|
3474 |
|
3475 |
$field_id = kgvid_backwards_compatible($post->ID);
|
3476 |
$movieurl = wp_get_attachment_url($post->ID);
|
3480 |
$video_meta = array();
|
3481 |
$video_aspect = NULL;
|
3482 |
$video_meta = get_post_meta( $post->ID, '_wp_attachment_metadata', true);
|
3483 |
+
if ( is_array($video_meta) && array_key_exists('width', $video_meta) && array_key_exists('height', $video_meta) ) { $video_aspect = $video_meta['height']/$video_meta['width']; }
|
3484 |
elseif ( $widthsaved && $heightsaved ) { $video_aspect = intval($heightsaved)/intval($widthsaved); }
|
3485 |
|
3486 |
$form_fields["kgflashmediaplayer-url"]["input"] = "hidden";
|
3491 |
if ( $widthsaved ) { $widthset = $widthsaved; }
|
3492 |
elseif ( $options['minimum_width'] == "on" ) { $widthset = $maxwidth; }
|
3493 |
else {
|
3494 |
+
if ( is_array($video_meta) && array_key_exists('width', $video_meta) && intval($video_meta['width']) <= intval($maxwidth) ) { $widthset = $video_meta['width']; }
|
3495 |
else { $widthset = $maxwidth; }
|
3496 |
}
|
3497 |
if ( !$widthsaved ) { update_post_meta($post->ID, '_kgflashmediaplayer-width', $widthset); }
|
3507 |
}
|
3508 |
elseif ( $video_aspect ) { $heightset = round($widthset*$video_aspect); }
|
3509 |
else {
|
3510 |
+
if ( is_array($video_meta) && array_key_exists('height', $video_meta) && intval($video_meta['height']) <= intval($maxheight) ) { $heightset = $video_meta['height']; }
|
3511 |
else { $heightset = $maxheight; }
|
3512 |
}
|
3513 |
if ( !$heightsaved ) { update_post_meta($post->ID, '_kgflashmediaplayer-height', $heightset); }
|
3529 |
$starts = intval(get_post_meta($post->ID, "_kgflashmediaplayer-starts", true));
|
3530 |
$completeviews = intval(get_post_meta($post->ID, "_kgflashmediaplayer-completeviews", true));
|
3531 |
|
3532 |
+
$form_fields["views"]["label"] = __("Video Stats", 'video-embed-thumbnail-generator');
|
3533 |
$form_fields["views"]["input"] = "html";
|
3534 |
+
$form_fields["views"]["html"] = sprintf( __('%1$s Starts, %2$s Complete Views', 'video-embed-thumbnail-generator'), $starts, $completeviews );
|
3535 |
|
3536 |
// ** Thumbnail section **//
|
3537 |
|
3557 |
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
|
3558 |
kgvid_check_ffmpeg_exists($options, true);
|
3559 |
}
|
3560 |
+
if ( $options['ffmpeg_exists'] == "notinstalled" ) { $ffmpeg_disabled_text = 'disabled="disabled" title="'.sprintf( __(strtoupper('%1$s not found at %2$s and unable to load video in browser for thumbnail generation.'), 'video-embed-thumbnail-generator'), $options['video_app'], $options['app_path'] ).'"'; }
|
3561 |
else { $ffmpeg_disabled_text = ""; }
|
3562 |
|
3563 |
$randomizechecked = get_post_meta($post->ID, "_kgflashmediaplayer-randomize", true);
|
3632 |
}
|
3633 |
$generate_content = '<div id="generate-thumb-'.$post->ID.'-container" class="kgvid-tabs-content">
|
3634 |
<input id="attachments-'. $post->ID .'-numberofthumbs" name="attachments['.$post->ID.'][kgflashmediaplayer-numberofthumbs]" type="text" value="'.$numberofthumbs_value.'" maxlength="2" style="width:35px;text-align:center;" onchange="kgvid_disable_thumb_buttons(\''.$post->ID.'\', \'onchange\');document.getElementById(\''.$field_id['thumbtime'].'\').value =\'\';" '.$ffmpeg_disabled_text.'/>
|
3635 |
+
<input type="button" id="attachments-'. $post->ID .'-thumbgenerate" class="button-secondary" value="'._x('Generate', 'Button text. Implied "Generate thumbnails"', 'video-embed-thumbnail-generator').'" name="thumbgenerate" onclick="kgvid_generate_thumb('. $post->ID .', \'generate\');" '.$ffmpeg_disabled_text.'/>
|
3636 |
+
<input type="button" id="attachments-'. $post->ID .'-thumbrandomize" class="button-secondary" value="'._x('Randomize', 'Button text. Implied "Randomize thumbnail generation"', 'video-embed-thumbnail-generator').'" name="thumbrandomize" onclick="kgvid_generate_thumb('. $post->ID .', \'random\');" '.$ffmpeg_disabled_text.'/>
|
3637 |
+
<span style="white-space:nowrap;"><input type="checkbox" id="attachments-'. $post->ID .'-firstframe" name="attachments['.$post->ID.'][kgflashmediaplayer-forcefirst]" onchange="document.getElementById(\''.$field_id['thumbtime'].'\').value =\'\';" value="checked" '.$forcefirstchecked.' '.$ffmpeg_disabled_text.'/> <label for="attachments-'. $post->ID .'-firstframe">'.__('Force 1st frame thumbnail', 'video-embed-thumbnail-generator').'</label></span></div>';
|
3638 |
|
3639 |
$thumbnail_timecode = 'Thumbnail timecode: <input name="attachments['. $post->ID .'][thumbtime]" id="attachments-'. $post->ID .'-thumbtime" type="text" value="'.get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true).'" style="width:60px;"><br>';
|
3640 |
|
3641 |
}
|
3642 |
|
3643 |
+
$form_fields["generator"]["label"] = _x("Thumbnails", 'Header for thumbnail section', 'video-embed-thumbnail-generator');
|
3644 |
$form_fields["generator"]["input"] = "html";
|
3645 |
$form_fields["generator"]["html"] = '<input type="hidden" name="attachments['.$post->ID.'][kgflashmediaplayer-security]" id="attachments-'.$post->ID.'-kgflashmediaplayer-security" value="'.$nonce.'" />
|
3646 |
'.$choose_from_video_content.'
|
3647 |
'.$generate_content.'
|
3648 |
'.$thumbnail_timecode.'
|
3649 |
<div id="attachments-'.$post->ID.'-thumbnailplaceholder">'. $thumbnail_html .'</div>
|
3650 |
+
<span id="pick-thumbnail" class="button-secondary" style="margin:10px 0;" data-choose="'.__('Choose a Thumbnail', 'video-embed-thumbnail-generator').'" data-update="'.__('Set as video thumbnail', 'video-embed-thumbnail-generator').'" data-change="attachments-'. $post->ID .'-kgflashmediaplayer-poster" onclick="kgvid_pick_image(this);">'.__('Choose from Library', 'video-embed-thumbnail-generator').'</span><br />
|
3651 |
+
<input type="checkbox" id="attachments-'. $post->ID .'-featured" name="attachments['.$post->ID.'][kgflashmediaplayer-featured]" '.$featuredchecked.' '.$ffmpeg_disabled_text.'/> <label for="attachments-'. $post->ID .'-featured">'.__('Set thumbnail as featured image', 'video-embed-thumbnail-generator').'</label>'.$update_script;
|
3652 |
|
3653 |
+
$form_fields["kgflashmediaplayer-poster"]["label"] = __("Thumbnail URL", 'video-embed-thumbnail-generator');
|
3654 |
$form_fields["kgflashmediaplayer-poster"]["value"] = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
|
3655 |
+
$form_fields["kgflashmediaplayer-poster"]["helps"] = "<small>".sprintf( __('Leave blank to use %sdefault thumbnail', 'video-embed-thumbnail-generator'), "<a href='options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php' target='_blank'>" )."</a>.</small>";
|
3656 |
|
3657 |
$lockaspectchecked = get_post_meta($post->ID, "_kgflashmediaplayer-lockaspect", true);
|
3658 |
if ( $lockaspectchecked == "notchecked" ) { $lockaspectchecked = ""; }
|
3659 |
else { $lockaspectchecked = "checked"; }
|
3660 |
|
3661 |
+
$form_fields["kgflashmediaplayer-dimensions"]["label"] = __("Video Embed Dimensions", 'video-embed-thumbnail-generator');
|
3662 |
$form_fields["kgflashmediaplayer-dimensions"]["input"] = "html";
|
3663 |
+
$form_fields["kgflashmediaplayer-dimensions"]["html"] = __('Width:', 'video-embed-thumbnail-generator').' <input name="attachments['. $post->ID .'][kgflashmediaplayer-width]" id="attachments-'. $post->ID .'-kgflashmediaplayer-width" type="text" value="'.$widthset.'" style="width:50px;" data-minimum="'.$options['minimum_width'].'" onchange="kgvid_set_dimension('.$post->ID.', \'height\', this.value);" onkeyup="kgvid_set_dimension('.$post->ID.', \'height\', this.value);"> '.__('Height:', 'video-embed-thumbnail-generator').'
|
3664 |
<input name="attachments['. $post->ID .'][kgflashmediaplayer-height]" id="attachments-'. $post->ID .'-kgflashmediaplayer-height" type="text" value="'.$heightset.'" style="width:50px;" onchange="kgvid_set_dimension('.$post->ID.', \'width\', this.value);" onkeyup="kgvid_set_dimension('.$post->ID.', \'width\', this.value);"> <br />
|
3665 |
<input type="checkbox" name="attachments['. $post->ID .'][kgflashmediaplayer-lockaspect]" id="attachments-'. $post->ID .'-kgflashmediaplayer-lockaspect" onclick="kgvid_set_aspect('.$post->ID.', this.checked);" value="checked" '.$lockaspectchecked.'>
|
3666 |
+
<label for="attachments-'. $post->ID .'-kgflashmediaplayer-lockaspect"><small>'.__('Lock to aspect ratio', 'video-embed-thumbnail-generator').'</small></label>';
|
3667 |
+
$form_fields["kgflashmediaplayer-dimensions"]["helps"] = "<small>".sprintf( __('Leave blank to use %sdefault dimensions', 'video-embed-thumbnail-generator'), "<a href='options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php' target='_blank'>" )."</a>.</small>";
|
3668 |
|
3669 |
|
3670 |
$checkboxes = kgvid_generate_encode_checkboxes($movieurl, $post->ID, "attachment");
|
3671 |
|
3672 |
+
$form_fields["kgflashmediaplayer-encode"]["label"] = __("Additional Formats", 'video-embed-thumbnail-generator');
|
3673 |
$form_fields["kgflashmediaplayer-encode"]["input"] = "html";
|
3674 |
+
$form_fields["kgflashmediaplayer-encode"]["html"] = $checkboxes['checkboxes'];
|
3675 |
+
|
3676 |
+
$track_option = get_post_meta($post->ID, "_kgflashmediaplayer-track", true);
|
3677 |
+
/*if ( !is_array($track_option) ) {
|
3678 |
+
$track_option = array();
|
3679 |
+
$track_option[0] = array ( 'kind' => '', 'srclang' => '', 'src' => '', 'label' => '' );
|
3680 |
+
}*/
|
3681 |
+
|
3682 |
+
$tracks_html = '';
|
3683 |
+
if ( is_array($track_option) ) {
|
3684 |
+
foreach ( $track_option as $track => $track_attribute ) {
|
3685 |
+
$items = array(__("subtitles", 'video-embed-thumbnail-generator')=>"subtitles", __("captions", 'video-embed-thumbnail-generator')=>"captions", __("chapters", 'video-embed-thumbnail-generator')=>"chapters");
|
3686 |
+
$track_type_select = '<select name="attachments['.$post->ID.'][kgflashmediaplayer-track]['.$track.'][kind]" id="attachments-'.$post->ID.'-kgflashmediaplayer-track_'.$track.'_kind]">';
|
3687 |
+
foreach($items as $name=>$value) {
|
3688 |
+
$selected = ($track_option[$track]['kind']==$value) ? 'selected="selected"' : '';
|
3689 |
+
$track_type_select .= "<option value='$value'>$name</option>";
|
3690 |
+
}
|
3691 |
+
$track_type_select .= "</select>";
|
3692 |
+
|
3693 |
+
$tracks_html .= '<div id="kgflashmediaplayer-'.$post->ID.'-trackdiv-'.$track.'" class="kgvid_thumbnail_box kgvid_track_box"><strong>'._x('Track', 'captions track', 'video-embed-thumbnail-generator').' '.strval($track+1).'</strong><span class="kgvid_track_box_removeable" onclick="jQuery(this).parent().remove();jQuery(\'form.compat-item input\').first().change();">X</span><br />
|
3694 |
+
'.__('Track type:', 'video-embed-thumbnail-generator').' '.$track_type_select.'<br />
|
3695 |
+
<span id="pick-track'.$track.'" class="button-secondary" style="margin:10px 0;" data-choose="'.__('Choose a Text File', 'video-embed-thumbnail-generator').'" data-update="'.__('Set as track source', 'video-embed-thumbnail-generator').'" data-change="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_src" onclick="kgvid_pick_attachment(this);">'.__('Choose from Library', 'video-embed-thumbnail-generator').'</span><br />
|
3696 |
+
URL: <input name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][src]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_src" type="text" value="'.$track_option[$track]['src'].'" class="text"><br />
|
3697 |
+
'._x('Language code:', 'two-letter code indicating track\'s language', 'video-embed-thumbnail-generator').' <input name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][srclang]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_srclang" type="text" value="'.$track_option[$track]['srclang'].'" maxlength="2" style="width:40px;"><br />
|
3698 |
+
'.__('Label:', 'video-embed-thumbnail-generator').' <input name="attachments['. $post->ID .'][kgflashmediaplayer-track]['.$track.'][label]" id="attachments-'. $post->ID .'-kgflashmediaplayer-track_'.$track.'_label" type="text" value="'.$track_option[$track]['label'].'" class="text"></div>';
|
3699 |
+
}
|
3700 |
+
}
|
3701 |
+
|
3702 |
+
$form_fields["kgflashmediaplayer-track"]["label"] = __("Subtitles & Captions", 'video-embed-thumbnail-generator');
|
3703 |
+
$form_fields["kgflashmediaplayer-track"]["input"] = "html";
|
3704 |
+
$form_fields["kgflashmediaplayer-track"]["html"] = '<div id="kgflashmediaplayer-'.$post->ID.'-trackdiv">'.$tracks_html.'</div><span class="button-secondary" id="kgflashmediaplayer-add_track" onclick="kgvid_add_subtitles('.$post->ID.')">'.__('Add track', 'video-embed-thumbnail-generator').'</span>';
|
3705 |
|
3706 |
|
3707 |
$showtitlechecked = get_post_meta($post->ID, "_kgflashmediaplayer-showtitle", true);
|
3708 |
if ( $showtitlechecked == "notchecked" ) { $showtitlechecked = ""; }
|
3709 |
$downloadlinkchecked = get_post_meta($post->ID, "_kgflashmediaplayer-downloadlink", true);
|
3710 |
+
if ( empty($downloadlinkchecked) ) { $downloadlinkchecked = $options['downloadlink']; }
|
3711 |
+
if ( $downloadlinkchecked == "on" ) { $downloadlinkchecked = "checked"; }
|
3712 |
if ( $downloadlinkchecked == "notchecked" ) { $downloadlinkchecked = ""; }
|
3713 |
$embed_option = get_post_meta($post->ID, "_kgflashmediaplayer-embed", true);
|
3714 |
|
3715 |
+
$items = array(__("Single Video", 'video-embed-thumbnail-generator')=>"Single Video", __("Video Gallery", 'video-embed-thumbnail-generator')=>"Video Gallery", __("WordPress Default", 'video-embed-thumbnail-generator')=>"WordPress Default");
|
3716 |
$shortcode_select = '<select name="attachments['.$post->ID.'][kgflashmediaplayer-embed]" id="attachments['.$post->ID.'][kgflashmediaplayer-embed]">';
|
3717 |
+
foreach($items as $name=>$value) {
|
3718 |
+
$selected = ($embed_option==$value) ? 'selected="selected"' : '';
|
3719 |
+
$shortcode_select .= "<option value='$value' $selected>$name</option>";
|
3720 |
}
|
3721 |
$shortcode_select .= "</select>";
|
3722 |
|
3723 |
+
$form_fields["kgflashmediaplayer-options"]["label"] = __("Video Embed Options", 'video-embed-thumbnail-generator');
|
3724 |
$form_fields["kgflashmediaplayer-options"]["input"] = "html";
|
3725 |
$form_fields["kgflashmediaplayer-options"]["html"] = '<input type="checkbox" name="attachments['.$post->ID.'][kgflashmediaplayer-showtitle]" id="attachments-'.$post->ID.'-kgflashmediaplayer-showtitle" value="checked" '.$showtitlechecked.'>
|
3726 |
+
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-showtitle">'.__('Insert title above video', 'video-embed-thumbnail-generator').'</label><br />
|
|
|
3727 |
<input type="checkbox" name="attachments['.$post->ID.'][kgflashmediaplayer-downloadlink]" id="attachments-'.$post->ID.'-kgflashmediaplayer-downloadlink" value="checked" '.$downloadlinkchecked.'>
|
3728 |
+
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-downloadlink">'.__('Insert download link below video', 'video-embed-thumbnail-generator').'<em><small><br />'.__('Makes it easier for users to download file.', 'video-embed-thumbnail-generator').'</em></small></label><br />
|
3729 |
+
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-embed">'.__('Insert', 'verb', 'video-embed-thumbnail-generator').'</label>
|
3730 |
'.$shortcode_select.'
|
3731 |
<script type="text/javascript">jQuery(document).ready(function(){kgvid_hide_standard_wordpress_display_settings('.$post->ID.');});</script>';
|
3732 |
|
3759 |
}
|
3760 |
$gallery_order_select .= "</select>";
|
3761 |
|
3762 |
+
$form_fields["kgflashmediaplayer-gallery"]["label"] = __("Gallery Settings (all optional)", 'video-embed-thumbnail-generator');
|
3763 |
$form_fields["kgflashmediaplayer-gallery"]["input"] = "html";
|
3764 |
+
$form_fields["kgflashmediaplayer-gallery"]["html"] = '<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_thumb_width]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_thumb_width" type ="text" value="'.$gallery_thumb_width.'" class="kgvid_50_width"> <label for="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_thumb_width">'.__('Thumbnail Width', 'video-embed-thumbnail-generator').'</label><br />
|
3765 |
+
'.$gallery_orderby_select.' '.__('Order By', 'video-embed-thumbnail-generator').'<br />
|
3766 |
+
'.$gallery_order_select.' '.__('Sort Order', 'video-embed-thumbnail-generator').'<br />
|
3767 |
+
<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_exclude]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_exclude" type ="text" value="'.$gallery_exclude.'" class="kgvid_50_width"> <label for="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_exclude">'.__('Exclude', 'video-embed-thumbnail-generator').'</label><br />
|
3768 |
+
<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_include]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_include" type ="text" value="'.$gallery_include.'" class="kgvid_50_width"> <label for="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_include">'.__('Include', 'video-embed-thumbnail-generator').'</label><br />
|
3769 |
+
<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_id]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_id" type ="text" value="'.$gallery_id.'" class="kgvid_50_width"> <label for="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_id">'.__('Post ID', 'video-embed-thumbnail-generator').'</label>
|
3770 |
';
|
3771 |
|
3772 |
}//if video gallery
|
3804 |
$post = get_post($post_id);
|
3805 |
|
3806 |
if ( substr($mime, 0, 5) == 'video' ) {
|
3807 |
+
|
3808 |
+
if ( !empty($post->post_parent) && strpos(get_post_mime_type( $post->post_parent ), 'video') !== false
|
3809 |
+
|| get_post_meta($post->ID, '_kgflashmediaplayer-externalurl', true) != false ) {
|
3810 |
$post_id = $post->post_parent; //use post parent if this is a child video or encoded from an external url
|
3811 |
}
|
3812 |
$poster_id = get_post_meta($post_id, '_kgflashmediaplayer-poster-id', true);
|
3910 |
|
3911 |
global $user_ID;
|
3912 |
|
3913 |
+
$options = kgvid_get_options();
|
3914 |
$uploads = wp_upload_dir();
|
3915 |
|
3916 |
$posterfile = pathinfo($thumb_url, PATHINFO_BASENAME);
|
3944 |
|
3945 |
elseif ( $success ) { //no existing post with this filename
|
3946 |
|
3947 |
+
$desc = $post_name . ' '._x('thumbnail', 'text appended to newly created thumbnail titles', 'video-embed-thumbnail-generator');
|
3948 |
if ( $index ) { $desc .= ' '.$index; }
|
3949 |
|
3950 |
//is image in uploads directory?
|
3960 |
$filename = preg_replace('/\.[^.]+$/', '', basename($thumb_url));
|
3961 |
if ( $user_ID == 0 ) { $user_ID = $video->post_author; }
|
3962 |
|
3963 |
+
|
3964 |
+
/*$file_array = array(
|
3965 |
+
'name' => basename($posterfile),
|
3966 |
+
'tmp_name' => $tmp_posterpath,
|
3967 |
+
);
|
3968 |
+
|
3969 |
+
//$return = apply_filters( 'wp_handle_upload', array( 'file' => $uploads['path'].'/'.$posterfile, 'url' => $thumb_url, 'type' => $wp_filetype['type'] ), 'sideload' );
|
3970 |
+
//$thumb_id = media_handle_sideload( $file_array, $post_id, $desc );*/
|
3971 |
+
|
3972 |
$attachment = array(
|
3973 |
'guid' => $thumb_url,
|
3974 |
'post_mime_type' => $wp_filetype['type'],
|
3979 |
);
|
3980 |
|
3981 |
$thumb_id = wp_insert_attachment( $attachment, $uploads['path'].'/'.$posterfile, $post_id );
|
3982 |
+
//you must first include the image.php file
|
3983 |
+
//for the function wp_generate_attachment_metadata() to work
|
3984 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
3985 |
$attach_data = wp_generate_attachment_metadata( $thumb_id, $uploads['path'].'/'.$posterfile );
|
3986 |
wp_update_attachment_metadata( $thumb_id, $attach_data );
|
4021 |
|
4022 |
}//end else no existing db entry
|
4023 |
|
4024 |
+
if( !empty($thumb_id) && !is_wp_error($thumb_id) ) {
|
4025 |
|
4026 |
return $thumb_id;
|
4027 |
+
|
4028 |
}
|
4029 |
|
4030 |
}
|
4037 |
$poster_id = get_post_meta($post_id, "_kgflashmediaplayer-poster-id", true);
|
4038 |
$thumbnail_size_url = "";
|
4039 |
if ( $poster_id ) {
|
4040 |
+
$thumbnail_src = wp_get_attachment_image_src($poster_id, 'thumbnail');
|
4041 |
+
if ( is_array($thumbnail_src) && array_key_exists(0, $thumbnail_src) ) { $thumbnail_size_url = $thumbnail_src[0]; }
|
4042 |
}
|
4043 |
$response['thumb_url'] = get_post_meta($post_id, "_kgflashmediaplayer-poster", true);
|
4044 |
+
$response['thumbnail_size_url'] = $thumbnail_size_url;
|
4045 |
$response['thumb_error'] = get_post_meta($post_id, "_kgflashmediaplayer-autothumb-error", true);
|
4046 |
echo json_encode($response);
|
4047 |
die();
|
4087 |
if ( isset($_POST['action']) && $_POST['action'] == 'save-attachment-compat' && isset($_POST['post_id']) ) { //if this is in the media modal
|
4088 |
$post_parent = $_POST['post_id'];
|
4089 |
}
|
4090 |
+
elseif ( is_array($post) && array_key_exists('post_parent', $post) ) {
|
4091 |
$post_parent = $post['post_parent'];
|
4092 |
}
|
4093 |
|
4112 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-encode'.$format, "false"); }
|
4113 |
}
|
4114 |
|
4115 |
+
if( isset($attachment['kgflashmediaplayer-track']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-track', array_values($attachment['kgflashmediaplayer-track'])); }
|
4116 |
+
else { delete_post_meta($post['ID'], '_kgflashmediaplayer-track'); }
|
4117 |
+
|
4118 |
if( isset($attachment['kgflashmediaplayer-showtitle']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', $attachment['kgflashmediaplayer-showtitle']); }
|
4119 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', "notchecked"); }
|
4120 |
|
4150 |
//function that does the modifying
|
4151 |
function kgmodifyMediaInsert($html, $attachment_id, $attachment) {
|
4152 |
|
4153 |
+
$options = kgvid_get_options();
|
4154 |
$output = $html;
|
4155 |
$attachment['embed'] = get_post_meta($attachment_id, "_kgflashmediaplayer-embed", true);
|
4156 |
|
4209 |
$kgIM = new kgInsertMedia();
|
4210 |
|
4211 |
function kgvid_embedurl_menu($tabs) {
|
4212 |
+
$newtab = array( 'embedurl' => _x('Embed Video from URL', 'Title in "Add Media" popup sidebar', 'video-embed-thumbnail-generator') );
|
4213 |
return array_merge($tabs, $newtab);
|
4214 |
}
|
4215 |
add_filter('media_upload_tabs', 'kgvid_embedurl_menu');
|
4216 |
|
4217 |
+
function kgvid_media_embedurl_process() {
|
4218 |
|
4219 |
+
$options = kgvid_get_options();
|
4220 |
|
4221 |
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
|
4222 |
kgvid_check_ffmpeg_exists($options, true);
|
4223 |
+
$options = kgvid_get_options();
|
4224 |
}
|
4225 |
|
4226 |
$video_formats = kgvid_video_formats();
|
4238 |
<table id="kgflashmediaplayer-table" class="describe">
|
4239 |
<tbody>
|
4240 |
<tr>
|
4241 |
+
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="videotitle"><?php _e('Video Title', 'video-embed-thumbnail-generator'); ?></label></span></th>
|
4242 |
<td class="field"><input type="text" id="videotitle" name="videotitle" value="" size="50" />
|
4243 |
+
<p class="help"><small><?php _e('Add an optional header above the video.', 'video-embed-thumbnail-generator'); ?></small></p></td>
|
4244 |
</tr>
|
4245 |
<tr>
|
4246 |
<th valign="top" scope="row" class="label"><label for="attachments-singleurl-kgflashmediaplayer-url">Video URL</label></th>
|
4247 |
<td class="field"><input type="text" id="attachments-singleurl-kgflashmediaplayer-url" name="attachments[singleurl][kgflashmediaplayer-url]" value="" size="50" onchange="kgvid_set_singleurl();"/>
|
4248 |
+
<p class="help"><small><?php _e('Specify the URL of the video file.', 'video-embed-thumbnail-generator'); ?></small></p></td>
|
4249 |
</tr>
|
4250 |
<?php if ( current_user_can('make_video_thumbnails') ) { ?>
|
4251 |
<tr>
|
4252 |
+
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="numberofthumbs"><?php _e('Thumbnails', 'video-embed-thumbnail-generator') ?></label></span></th>
|
4253 |
<td class="field">
|
4254 |
+
<input id="attachments-singleurl-numberofthumbs" type="text" value="<?php echo $options['generate_thumbs']; ?>" maxlength="2" size="4" style="width:35px;text-align:center;" title="<?php _e('Number of Thumbnails', 'video-embed-thumbnail-generator') ?>" onchange="document.getElementById('attachments-singleurl-thumbtime').value='';" />
|
4255 |
+
<input type="button" id="attachments-singleurl-thumbgenerate" class="button-secondary" value="<?php _e('Generate', 'video-embed-thumbnail-generator') ?>" name="thumbgenerate" onclick="kgvid_generate_thumb('singleurl', 'generate');" disabled title="<?php _e('Please enter a valid video URL', 'video-embed-thumbnail-generator') ?>" />
|
4256 |
+
<input type="button" id="attachments-singleurl-thumbrandomize" class="button-secondary" value="<?php _e('Randomize', 'video-embed-thumbnail-generator') ?>" name="thumbrandomize" onclick="kgvid_generate_thumb('singleurl', 'random');" disabled title="<?php _e('Please enter a valid video URL', 'video-embed-thumbnail-generator') ?>" />
|
4257 |
+
<input type="checkbox" id="attachments-singleurl-firstframe" onchange="document.getElementById('attachments-singleurl-thumbtime').value ='';" /><label for="attachments-singleurl-firstframe"><?php _e('Force 1st Frame Thumbnail', 'video-embed-thumbnail-generator') ?></label><br>
|
4258 |
<div id="attachments-singleurl-thumbnailplaceholder"></div>
|
4259 |
+
<span><?php _e('Thumbnail timecode:', 'video-embed-thumbnail-generator') ?></span> <input name="attachments[singleurl][thumbtime]" id="attachments-singleurl-thumbtime" type="text" value="" style="width:60px;"><br>
|
4260 |
+
<input type="checkbox" <?php echo checked( $options["featured"], "on", false ); ?> id="attachments-singleurl-featured" name="attachments[singleurl][kgflashmediaplayer-featured]" /> <?php _e('Set thumbnail as featured image', 'video-embed-thumbnail-generator') ?>
|
4261 |
</td>
|
4262 |
</tr>
|
4263 |
<?php } ?>
|
4264 |
<tr>
|
4265 |
+
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="attachments-singleurl_kgflashmediaplayer_poster"><?php _e('Thumbnail URL', 'video-embed-thumbnail-generator') ?></label></span></th>
|
4266 |
<td class="field"><input type="text" name="attachments[singleurl][kgflashmediaplayer-poster]" id="attachments-singleurl-kgflashmediaplayer-poster" value="" size="50" />
|
4267 |
+
<p class="help"><small><?php printf( __('Leave blank to use %sdefault thumbnail', 'video-embed-thumbnail-generator'), '<a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php" target="_blank">' ) ?></a>.</small></p></td>
|
4268 |
</tr>
|
4269 |
<tr>
|
4270 |
+
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="attachments-singleurl-kgflashmediaplayer-width"><?php _e('Dimensions', 'video-embed-thumbnail-generator') ?></label></span></th>
|
4271 |
+
<td class="field"><?php _e('Width:', 'video-embed-thumbnail-generator') ?> <input name="attachments[singleurl][kgflashmediaplayer-width]" type="text" value="<?php echo $maxwidth; ?>" id="attachments-singleurl-kgflashmediaplayer-width" type="text" class="kgvid_50_width" onchange="kgvid_set_dimension('singleurl', 'height', this.value);" onkeyup="kgvid_set_dimension('singleurl', 'height', this.value);"> <?php _e('Height:', 'video-embed-thumbnail-generator') ?> <input name="attachments[singleurl][kgflashmediaplayer-height]" id="attachments-singleurl-kgflashmediaplayer-height" type="text" value="<?php echo $maxheight; ?>" class="kgvid_50_width" onchange="kgvid_set_dimension('singleurl', 'width', this.value);" onkeyup="kgvid-set-dimension('singleurl', 'width', this.value);"> <input type="checkbox" name="attachments[singleurl][kgflashmediaplayer-lockaspect]" id="attachments-singleurl-kgflashmediaplayer-lockaspect" onclick="kgvid_set_aspect('singleurl', this.checked);" checked> <label for="attachments-singleurl-kgflashmediaplayer-lockaspect"><small><?php _e('Lock to Aspect Ratio', 'video-embed-thumbnail-generator') ?></small></label>
|
4272 |
+
<p class="help"><small><?php printf( __('Leave blank to use %sdefault dimensions', 'video-embed-thumbnail-generator'), '<a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php" target="_blank">' ) ?></a>.</small></p></td>
|
4273 |
</tr>
|
4274 |
<?php if ( current_user_can('encode_videos') ) { ?>
|
4275 |
<tr>
|
4276 |
+
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="html5"><?php _e('Additional Formats', 'video-embed-thumbnail-generator') ?></span></label></th>
|
4277 |
+
<td><?php echo $checkboxes['checkboxes']; ?></td>
|
4278 |
</tr>
|
4279 |
<?php } ?>
|
4280 |
<tr>
|
4281 |
<th valign="top" scope="row" class="label"><span class="alignleft"><label>Options</span></label></th>
|
4282 |
+
<td><input type="checkbox" <?php echo checked( $options["downloadlink"], "on", false ); ?> name="downloadlink" id="downloadlink" value="true" class="field" /><label for="downloadlink"><?php _e('Generate Download Link Below Video', 'video-embed-thumbnail-generator') ?><br /><small></em><?php _e('Makes it easier for users to download video file', 'video-embed-thumbnail-generator') ?></em></small></label></td>
|
4283 |
</tr>
|
4284 |
<tr class="submit">
|
4285 |
<td></td>
|
4286 |
<td>
|
4287 |
+
<input type="button" onclick="kgvid_insert_shortcode();" name="insertonlybutton" id="insertonlybutton" class="button" value="<?php _e('Insert into Post', 'video-embed-thumbnail-generator') ?>" disabled title="<?php _e('Please enter a valid video URL', 'video-embed-thumbnail-generator') ?>" />
|
4288 |
</td>
|
4289 |
</tr>
|
4290 |
</tbody></table>
|
4304 |
} //end media_embedurl_process
|
4305 |
|
4306 |
function kgvid_embedurl_handle() {
|
4307 |
+
return wp_iframe( 'kgvid_media_embedurl_process' );
|
4308 |
}
|
4309 |
add_action('media_upload_embedurl', 'kgvid_embedurl_handle');
|
4310 |
|
4318 |
|
4319 |
global $post;
|
4320 |
global $wp_query;
|
4321 |
+
$options = kgvid_get_options();
|
4322 |
|
4323 |
+
if ( is_array($kgvid_video_embed) && array_key_exists('sample', $kgvid_video_embed) ) { $url = plugins_url('/images/sample-video-h264.mp4', __FILE__); }
|
4324 |
else { $url = wp_get_attachment_url($post->ID); }
|
4325 |
|
4326 |
$poster = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
|
4327 |
$downloadlink = get_post_meta($post->ID, '_kgflashmediaplayer-downloadlink', true);
|
4328 |
|
4329 |
+
if ( is_array($kgvid_video_embed) && array_key_exists('gallery', $kgvid_video_embed) ) { $gallery = true; }
|
4330 |
else { $gallery = false; }
|
4331 |
|
4332 |
$dimensions = kgvid_set_video_dimensions($post->ID, $gallery);
|
4336 |
if ( !empty($dimensions['width']) ) { $shortcode .= ' width="'.$dimensions['width'].'"'; }
|
4337 |
if ( !empty($dimensions['height']) ) { $shortcode .= ' height="'.$dimensions['height'].'"'; }
|
4338 |
if ( $downloadlink == "checked" ) { $shortcode .= ' downloadlink="true"'; }
|
4339 |
+
if (is_array($kgvid_video_embed) && array_key_exists('gallery', $kgvid_video_embed)) { $shortcode .= ' autoplay="true"'; }
|
4340 |
+
if (is_array($kgvid_video_embed) && array_key_exists('sample', $kgvid_video_embed)) {
|
4341 |
+
if ( $options['overlay_title'] == "on" ) { $shortcode .= ' title="'._x('Sample Video', 'example video', 'video-embed-thumbnail-generator').'"'; }
|
4342 |
+
if ( $options['overlay_embedcode'] == "on" ) { $shortcode .= ' embedcode="'.__('Sample Embed Code', 'video-embed-thumbnail-generator').'"'; }
|
4343 |
+
$shortcode .= ' caption="'.__('If text is entered in the attachment\'s caption field it is displayed here automatically.', 'video-embed-thumbnail-generator').'"';
|
4344 |
+
if ( $options['downloadlink'] == "on" ) { $shortcode .= ' downloadlink="true"'; }
|
4345 |
}
|
4346 |
//else { $shortcode .= ' view_count="false"'; }
|
4347 |
$shortcode .= ']'.$url.'[/KGVID]';
|
4353 |
function kgvid_filter_video_attachment_content($content) {
|
4354 |
|
4355 |
global $post;
|
4356 |
+
$options = kgvid_get_options();
|
4357 |
|
4358 |
if ( $options['template'] == "gentle" && strpos($post->post_mime_type, "video") !== false ) {
|
4359 |
$kgvid_video_embed = array(); //no query set
|
4370 |
global $wp_query;
|
4371 |
global $content_width;
|
4372 |
|
4373 |
+
$options = kgvid_get_options();
|
4374 |
|
4375 |
$kgvid_video_embed = array ( 'enable' => 'false' ); //turned off by default
|
4376 |
if ( isset($wp_query->query_vars['kgvid_video_embed']) ) { $kgvid_video_embed = $wp_query->query_vars['kgvid_video_embed']; }
|
4462 |
|
4463 |
function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser, $thumbtimecode, $dofirstframe, $generate_button) {
|
4464 |
|
4465 |
+
$options = kgvid_get_options();
|
4466 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
4467 |
$uploads = wp_upload_dir();
|
4468 |
|
4566 |
}//if ffmpeg can open movie
|
4567 |
|
4568 |
else {
|
4569 |
+
$thumbnaildisplaycode = "<strong>".__('Can\'t open movie file.', 'video-embed-thumbnail-generator')."</strong><br />".$movie_info['output'];
|
4570 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
4571 |
return $arr;
|
4572 |
} //can't open movie
|
4575 |
|
4576 |
function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id) {
|
4577 |
|
4578 |
+
$options = kgvid_get_options();
|
4579 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
4580 |
$uploads = wp_upload_dir();
|
4581 |
|
4627 |
$encode_formats[$format]['status'] = "notchecked";
|
4628 |
update_post_meta($postID, '_kgflashmediaplayer-encode'.$format, 'notchecked');
|
4629 |
}
|
4630 |
+
}//end loop through video formats
|
4631 |
|
4632 |
+
if ( !empty($encode_list) ) { //if there's anything to encode
|
4633 |
+
|
4634 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
4635 |
if ( empty($parent_id) ) { $parent_id = get_post($postID)->post_parent; }
|
4636 |
+
|
4637 |
$queue_entry = array (
|
4638 |
'attachmentID'=>$postID,
|
4639 |
'parent_id'=>$parent_id,
|
4641 |
'encode_formats'=> $encode_formats,
|
4642 |
'movie_info' => $movie_info
|
4643 |
);
|
4644 |
+
if ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( plugin_basename(__FILE__) ) ) {
|
4645 |
+
$queue_entry['blog_id'] = get_current_blog_id();
|
4646 |
+
}
|
4647 |
+
|
4648 |
$already_queued = false;
|
4649 |
+
if ( !empty($video_encode_queue ) ) {
|
4650 |
+
foreach ($video_encode_queue as $index => $entry) {
|
4651 |
if ( $entry['movieurl'] == $movieurl ) {
|
4652 |
$already_queued = $index;
|
4653 |
foreach ( $entry['encode_formats'] as $format => $value ) {
|
4654 |
+
|
4655 |
+
if ( $value['status'] == "queued" && array_key_exists($format, $encode_list) ) {
|
4656 |
+
unset($encode_list[$format]);
|
4657 |
+
}
|
4658 |
+
|
4659 |
+
if ( $value['status'] == "encoding" || $encode_checked[$format] != "true" ) {
|
4660 |
+
$queue_entry['encode_formats'][$format] = $entry['encode_formats'][$format];
|
4661 |
+
} //don't edit queue entry for anything that's currently encoding or not checked
|
4662 |
+
|
4663 |
+
if ( $parent_id == "check" ) {
|
4664 |
+
$parent_id = $entry['parent_id'];
|
4665 |
+
$queue_entry['parent_id'] = $entry['parent_id'];
|
4666 |
+
}
|
4667 |
+
|
4668 |
+
}//loop through formats
|
4669 |
+
|
4670 |
+
if ( array_key_exists('blog_id', $entry) ) { //reset the ids in case this is the network queue
|
4671 |
+
$queue_entry['parent_id'] = $entry['parent_id'];
|
4672 |
+
$queue_entry['blog_id'] = $entry['blog_id'];
|
4673 |
}
|
4674 |
+
|
4675 |
+
}//url matches existing queue entry
|
4676 |
+
}//loop through queue
|
4677 |
+
}//if there's already a queue
|
4678 |
+
|
4679 |
+
$imploded_encode_list = implode(", " , $encode_list);
|
4680 |
|
4681 |
if ( $already_queued !== false ) {
|
4682 |
+
$video_encode_queue[$already_queued] = $queue_entry;
|
4683 |
+
kgvid_save_encode_queue($video_encode_queue);
|
4684 |
+
$existing_queue_position = strval(intval($already_queued)+1);
|
4685 |
+
if ( !empty($encode_list) ) { $embed_display = "<strong>".sprintf( __('%1$s updated in existing queue entry in position %2$s.', 'video-embed-thumbnail-generator'), $imploded_encode_list, $existing_queue_position )." </strong>"; }
|
4686 |
+
else { $embed_display = "<strong>".sprintf( __('Video is already queued in position %s.', 'video-embed-thumbnail-generator'), $existing_queue_position )." </strong>"; }
|
4687 |
}
|
4688 |
else {
|
4689 |
+
$video_encode_queue[] = $queue_entry;
|
4690 |
+
kgvid_save_encode_queue($video_encode_queue);
|
4691 |
+
$queue_position = intval(key( array_slice( $video_encode_queue, -1, 1, TRUE ) ));
|
4692 |
+
$new_queue_position = strval(intval($queue_position)+1);
|
4693 |
+
if ( $queue_position == 0 ) { $embed_display = "<strong>".__('Starting', 'video-embed-thumbnail-generator')." ".strtoupper($options['video_app'])."... </strong>"; }
|
4694 |
+
else { $embed_display = "<strong>".sprintf( __('%1$s added to queue in position %2$s.', 'video-embed-thumbnail-generator'), $imploded_encode_list, $new_queue_position )." </strong>";
|
4695 |
}
|
4696 |
}
|
4697 |
} //if any video formats don't already exist, add to queue
|
4698 |
+
else { $embed_display = "<strong>".__('Nothing to encode.', 'video-embed-thumbnail-generator')."</strong>"; }
|
4699 |
|
4700 |
$replaceoptions = "";
|
4701 |
$originalselect = "";
|
4704 |
return $arr;
|
4705 |
}
|
4706 |
else {
|
4707 |
+
$thumbnaildisplaycode = "<strong>".__('Can\'t open movie file.', 'video-embed-thumbnail-generator')."</strong><br />".$movie_info['output'];
|
4708 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
4709 |
return $arr;
|
4710 |
} //can't open movie
|
4723 |
function kgvid_callffmpeg() {
|
4724 |
|
4725 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
|
|
4726 |
|
4727 |
+
$options = kgvid_get_options();
|
4728 |
|
4729 |
if (isset($_POST['attachmentID'])) { $postID = $_POST['attachmentID']; }
|
4730 |
if (isset($_POST['movieurl'])) { $movieurl = $_POST['movieurl']; }
|
4757 |
if ( $action == "submit" && current_user_can('make_video_thumbnails') ) { kgivd_save_singleurl_poster($parent_id, $poster, $movieurl, $set_featured); }
|
4758 |
}
|
4759 |
else {
|
4760 |
+
$thumbnaildisplaycode = '<strong>'.sprintf( __('Error: %1$s not found. Verify that %1$s is installed at %2$s and check the %3$sapplication path plugin setting', 'video-embed-thumbnail-generator'), strtoupper($options["video_app"]), strtoupper($options["app_path"]), '<a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">' ).'</a>.</strong>' ;
|
4761 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
4762 |
echo json_encode($arr);
|
4763 |
}//no ffmpeg
|
4767 |
|
4768 |
function kgvid_encode_videos() {
|
4769 |
|
4770 |
+
$options = kgvid_get_options();
|
4771 |
+
|
4772 |
$embed_display = "";
|
4773 |
+
$video = array();
|
4774 |
$video_key = "";
|
4775 |
$queued_format = "";
|
4776 |
+
$encoding = array();
|
4777 |
+
$start_encoding = array();
|
4778 |
+
$encode_string = array();
|
4779 |
$uploads = wp_upload_dir();
|
4780 |
$movie_info = array("width"=>"", "height"=>"");
|
4781 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
4782 |
$video_formats = kgvid_video_formats();
|
4783 |
|
4784 |
+
if ( !empty($video_encode_queue) ) {
|
4785 |
|
4786 |
+
$x = $options['simultaneous_encodes'];
|
4787 |
|
4788 |
+
foreach ( $video_encode_queue as $video_key => $queue_entry ) { //search the queue for any encoding video
|
4789 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
4790 |
if ( $value['status'] == "encoding" ) {
|
4791 |
+
$video[] = $video_encode_queue[$video_key];
|
4792 |
+
$encoding[] = array('key'=>$video_encode_queue[$video_key], 'value' => $value);
|
4793 |
+
$x--;
|
4794 |
+
if ( 0 == $x ) { break 2; }
|
4795 |
}
|
4796 |
}
|
4797 |
}
|
4798 |
|
4799 |
+
if ( count($encoding) < intval($options['simultaneous_encodes']) ) {
|
4800 |
+
$x = count($encoding);
|
4801 |
+
foreach ( $video_encode_queue as $video_key => $queue_entry ) {
|
4802 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
4803 |
if ( $value['status'] == "queued" ) {
|
4804 |
+
$start_encoding[] = array('video_key' => $video_key, 'queued_format' => $format );
|
4805 |
+
$x++;
|
4806 |
+
if ( $x == intval($options['simultaneous_encodes']) ) { break 2; }
|
4807 |
}
|
4808 |
}
|
4809 |
}
|
4810 |
}
|
4811 |
|
4812 |
+
if ( !empty($start_encoding) ) {
|
4813 |
|
4814 |
+
foreach( $start_encoding as $key => $queue_info ) {
|
4815 |
|
4816 |
+
extract($queue_info, EXTR_OVERWRITE);
|
4817 |
+
$video = $video_encode_queue[$video_key];
|
|
|
|
|
|
|
|
|
4818 |
|
4819 |
+
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
4820 |
+
if ( get_post_type($video['attachmentID']) == "attachment" ) { $moviefilepath = get_attached_file($video['attachmentID']); }
|
4821 |
+
else {
|
4822 |
+
$moviefilepath = str_replace(" ", "%20", esc_url_raw($video['movieurl']));
|
4823 |
+
$moviefilepath = str_replace("https://", "http://", $moviefilepath);
|
4824 |
+
}
|
4825 |
|
4826 |
+
$movie_info = $video['movie_info'];
|
4827 |
+
$encodevideo_info = kgvid_encodevideo_info($video['movieurl'], $video['attachmentID']);
|
|
|
|
|
4828 |
|
4829 |
+
$logfile = "";
|
4830 |
+
$processPID = "";
|
4831 |
+
$serverOS = "";
|
4832 |
+
$ffmpeg_options = "";
|
|
|
4833 |
|
4834 |
+
if ( $options['video_app'] == "avconv" || $options['video_bitrate_flag'] == false ) {
|
4835 |
+
$video_bitrate_flag = "b:v";
|
4836 |
+
$audio_bitrate_flag = "b:a";
|
4837 |
+
$profile_flag = "profile:v";
|
4838 |
+
}
|
4839 |
|
4840 |
+
else {
|
4841 |
+
$video_bitrate_flag = "b";
|
4842 |
+
$audio_bitrate_flag = "ab";
|
4843 |
+
$profile_flag = "profile";
|
4844 |
+
}
|
4845 |
|
4846 |
+
$aac_array = kgvid_aac_encoders();
|
4847 |
+
$aac_available = false;
|
4848 |
+
foreach ( $aac_array as $aaclib ) { //cycle through available AAC encoders in order of quality
|
4849 |
+
if ( $movie_info['configuration'][$aaclib] == "true" ) { $aac_available = true; break; }
|
4850 |
+
}
|
4851 |
|
4852 |
+
foreach( $video_formats as $format => $format_stats ) {
|
4853 |
+
if ( $queued_format == $format && $format_stats['type'] == "h264" ) {
|
4854 |
+
if ( $movie_info['configuration']['libx264'] == "true" && $aac_available ) {
|
4855 |
|
4856 |
+
if ( ! $encodevideo_info[$format.'_exists'] || ($encodevideo_info['sameserver'] && filesize($encodevideo_info[$format.'filepath']) < 24576) ) {
|
|
|
|
|
|
|
|
|
4857 |
|
4858 |
+
$h264_encode_dimensions = kgvid_set_h264_encode_dimensions($movie_info, $format_stats);
|
|
|
4859 |
|
4860 |
+
$encode_string = kgvid_generate_encode_string($moviefilepath, $encodevideo_info[$format.'filepath'], $movie_info, $queued_format, $h264_encode_dimensions['width'], $h264_encode_dimensions['height'], $movie_info['rotate']);
|
4861 |
|
4862 |
+
}//if file doesn't already exist
|
4863 |
+
else { $embed_display = sprintf( __('%s already encoded', 'video-embed-thumbnail-generator'), $format_stats['name'] ); }
|
4864 |
+
break; //don't bother looping through the rest if we already found the format
|
4865 |
+
}//if the x264 library and an aac library is enabled
|
4866 |
+
else {
|
4867 |
+
$lastline = sprintf( __('%s missing library libx264 required for H.264 encoding', 'video-embed-thumbnail-generator'), strtoupper($options['video_app']) );
|
4868 |
+
if ( !$aac_available ) {
|
4869 |
+
array_pop($aac_array); //get rid of the built-in "aac" encoder since it can't really be "installed"
|
4870 |
+
$lastaac = array_pop($aac_array);
|
4871 |
+
$aac_list = implode(", ", $aac_array);
|
4872 |
+
$aac_list .= ", ".__('or', 'video-embed-thumbnail-generator')." ".$lastaac;
|
4873 |
+
$lastline .= " ".sprintf( __('and missing an AAC encoding library. Please install and enable libx264 and %s', 'video-embed-thumbnail-generator'), $aac_list );
|
4874 |
+
}
|
4875 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['status'] = "error";
|
4876 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['lastline'] = $lastline;
|
4877 |
+
$embed_display = __("Missing libraries", 'video-embed-thumbnail-generator');
|
4878 |
}
|
4879 |
+
}//if format is chosen for encoding
|
4880 |
+
}//H.264 format loop
|
4881 |
+
|
4882 |
+
if ( $queued_format == "webm" || $queued_format == "ogg" ) { //if it's not H.264 they both work essentially the same
|
4883 |
+
if ( ! $encodevideo_info[$queued_format.'_exists'] || ($encodevideo_info['sameserver'] && filesize($encodevideo_info[$queued_format.'filepath']) < 24576) ) {
|
4884 |
+
if ( $movie_info['configuration']['libvorbis'] == "true" && $movie_info['configuration'][$video_formats[$queued_format]['vcodec']] == "true" ) {
|
4885 |
+
$encode_string = kgvid_generate_encode_string($moviefilepath, $encodevideo_info[$queued_format.'filepath'], $movie_info, $queued_format, $movie_info['width'], $movie_info['height'], $movie_info['rotate']);
|
4886 |
+
$embed_display = sprintf( __('Encoding %s', 'video-embed-thumbnail-generator'), $video_formats[$queued_format]['name'] );
|
4887 |
+
}//if the necessary libraries are enabled
|
4888 |
+
else {
|
4889 |
+
$missing_libraries = array();
|
4890 |
+
if($movie_info['configuration']['libvorbis'] == 'false') { $missing_libraries[] = 'libvorbis'; }
|
4891 |
+
if($movie_info['configuration'][$video_formats[$queued_format]['vcodec']] == 'false') { $missing_libraries[] = $video_formats[$queued_format]['vcodec']; }
|
4892 |
+
$lastline = sprintf( __('%1$s missing library %2$s required for %3$s encoding.', 'video-embed-thumbnail-generator'), strtoupper($options['video_app']), implode(', ', $missing_libraries), $video_formats[$queued_format]['name']);
|
4893 |
+
$video_encode_queue[$video_key]['encode_formats'][$queued_format]['status'] = "error";
|
4894 |
+
$video_encode_queue[$video_key]['encode_formats'][$queued_format]['lastline'] = $lastline;
|
4895 |
+
$embed_display = __("Missing libraries", 'video-embed-thumbnail-generator');
|
4896 |
+
}
|
4897 |
+
}//if file doesn't already exist
|
4898 |
+
else { $embed_display = sprintf( __('%s already encoded.', 'video-embed-thumbnail-generator'), $video_formats[$queued_format]['vcodec'] ); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4899 |
|
4900 |
+
}//if webm or ogg format is queued
|
4901 |
|
4902 |
+
if ( !empty($encode_string) ) {
|
4903 |
|
4904 |
+
$logfile = $uploads['path'].'/'.str_replace(" ", "_", $encodevideo_info['moviefilebasename']).'_'.$queued_format.'_'.sprintf("%04s",mt_rand(1, 1000)).'_encode.txt';
|
4905 |
|
4906 |
+
$cmd = escapeshellcmd($encode_string[1]).$encode_string[2].escapeshellcmd($encode_string[3]);
|
|
|
|
|
|
|
|
|
4907 |
|
4908 |
+
if ( !empty($cmd) ) { $cmd = $cmd.' > "'.$logfile.'" 2>&1 & echo $!'; }
|
4909 |
|
4910 |
+
else {
|
4911 |
+
$arr = array ( "embed_display"=>"<span class='kgvid_warning'>".__("Error: Command 'escapeshellcmd' is disabled on your server.", 'video-embed-thumbnail-generator')."</span>" );
|
4912 |
+
return $arr;
|
4913 |
+
}
|
4914 |
+
$process = new kgvid_Process($cmd);
|
4915 |
|
4916 |
+
sleep(1);
|
|
|
|
|
|
|
|
|
4917 |
|
4918 |
+
$processPID = $process->getPid();
|
4919 |
+
$serverOS = $process->OS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4920 |
|
4921 |
+
$args = array('logfile'=>$logfile);
|
4922 |
+
wp_schedule_single_event(time()+600, 'kgvid_cleanup_generated_logfiles', $args);
|
4923 |
+
if ( !wp_next_scheduled('kgvid_cleanup_queue', array ( 'scheduled' )) ) {
|
4924 |
+
wp_schedule_event( time()+86400, 'daily', 'kgvid_cleanup_queue', array ( 'scheduled' ) );
|
4925 |
+
}
|
|
|
|
|
4926 |
|
4927 |
+
$video_encode_queue[$video_key]['encode_formats'][$queued_format] = array (
|
4928 |
+
'name' => $video_formats[$queued_format]['name'],
|
4929 |
+
'status' => 'encoding',
|
4930 |
+
'filepath' => $encodevideo_info[$queued_format.'filepath'],
|
4931 |
+
'url' => $encodevideo_info[$queued_format.'url'],
|
4932 |
+
'logfile' => $logfile,
|
4933 |
+
'PID' => $processPID,
|
4934 |
+
'OS' => $serverOS,
|
4935 |
+
'started' => time()
|
4936 |
+
);
|
4937 |
|
4938 |
+
} //end if there's stuff to encode
|
4939 |
|
4940 |
+
}//end loop
|
4941 |
|
4942 |
+
kgvid_save_encode_queue($video_encode_queue);
|
4943 |
+
//kgvid_encode_progress($start_encoding, $queued_format, "attachment");
|
4944 |
|
4945 |
} //if there's a format to encode
|
4946 |
|
4953 |
function kgvid_ajax_encode_videos() {
|
4954 |
|
4955 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
|
|
4956 |
$arr = kgvid_encode_videos();
|
4957 |
echo json_encode($arr);
|
4958 |
die();
|
4963 |
function kgvid_test_ffmpeg() {
|
4964 |
|
4965 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4966 |
+
$options = kgvid_get_options();
|
4967 |
$uploads = wp_upload_dir();
|
4968 |
+
$video_formats = kgvid_video_formats();
|
4969 |
+
$suffix = $video_formats[$options['sample_format']]['suffix'];
|
4970 |
|
4971 |
+
$encode_string = $options['encode_string'];
|
4972 |
+
$cmd = escapeshellcmd($encode_string[1]).$encode_string[2].escapeshellcmd($encode_string[3]);
|
4973 |
exec ( $cmd.' 2>&1', $output );
|
4974 |
+
$arr['output'] = implode("\n", $output);
|
|
|
4975 |
|
4976 |
+
if ( file_exists($uploads['path']."/sample-video-h264".$suffix) ) {
|
|
|
4977 |
|
4978 |
if ( $options['moov'] == "qt-faststart" || $options['moov'] == "MP4Box" ) {
|
4979 |
+
$output .= kgvid_fix_moov_atom($uploads['path']."/sample-video-h264".$suffix);
|
4980 |
+
}
|
4981 |
+
|
4982 |
+
if ( $options['ffmpeg_watermark']['url'] != "" ) {
|
4983 |
+
if (!file_exists($uploads['path'].'/thumb_tmp')) { mkdir($uploads['path'].'/thumb_tmp'); }
|
4984 |
+
$cmd = escapeshellcmd($options['app_path'].'/'.$options['video_app'].' -y -i "'.$uploads['path']."/sample-video-h264".$suffix.'" -vframes 1 -f mjpeg '.$uploads['path'].'/thumb_tmp/watermark_test.jpg');
|
4985 |
+
kgvid_schedule_cleanup_generated_files('thumbs');
|
4986 |
+
exec ( $cmd );
|
4987 |
+
if ( file_exists($uploads['path'].'/thumb_tmp/watermark_test.jpg') ) {
|
4988 |
+
$arr['watermark_preview'] = $uploads['url'].'/thumb_tmp/watermark_test.jpg';
|
4989 |
+
}
|
4990 |
}
|
4991 |
|
4992 |
+
unlink($uploads['path']."/sample-video-h264".$suffix);
|
4993 |
|
4994 |
}
|
4995 |
|
4996 |
+
echo json_encode($arr);
|
4997 |
die;
|
4998 |
|
4999 |
}
|
5001 |
|
5002 |
function kgvid_encode_progress($video_key, $format, $page) {
|
5003 |
|
5004 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
5005 |
|
5006 |
+
if ( is_array($video_encode_queue) && array_key_exists($video_key, $video_encode_queue) ) {
|
5007 |
|
5008 |
+
$video_entry = $video_encode_queue[$video_key];
|
|
|
5009 |
|
5010 |
+
if ( array_key_exists('blog_id', $video_entry) ) { $blog_id = $video_entry['blog_id']; }
|
5011 |
+
else { $blog_id = false; }
|
5012 |
+
|
5013 |
+
$script_function = 'kgvid_redraw_encode_checkboxes("'.$video_entry['movieurl'].'", "'.$video_entry['attachmentID'].'", "'.$page.'", "'.$blog_id.'")';
|
|
|
|
|
|
|
|
|
|
|
5014 |
|
5015 |
+
if ( is_array($video_entry['encode_formats'][$format]) && array_key_exists('logfile', $video_entry['encode_formats'][$format]) ) {
|
5016 |
|
5017 |
$pid = $video_entry['encode_formats'][$format]['PID'];
|
5018 |
$logfile = $video_entry['encode_formats'][$format]['logfile'];
|
5019 |
$started = $video_entry['encode_formats'][$format]['started'];
|
5020 |
$movie_duration = $video_entry['movie_info']['duration'];
|
5021 |
+
$filepath = $video_entry['encode_formats'][$format]['filepath'];
|
5022 |
$embed_display = "";
|
5023 |
$percent_done = "";
|
5024 |
$time_remaining = "";
|
5057 |
|
5058 |
preg_match('/time=(.*?) /', $lastline, $time_matches);
|
5059 |
|
5060 |
+
if ( is_array($time_matches) && array_key_exists(1, $time_matches) != true ) { //if something other than the regular FFMPEG encoding output check for these
|
5061 |
preg_match('/video:(.*?) /', $lastline, $video_matches);
|
5062 |
preg_match('/libx264 (.*?) /', $lastline, $libx264_matches);
|
|
|
|
|
|
|
5063 |
}
|
5064 |
+
if ( is_array($time_matches) && array_key_exists(1, $time_matches) == true ) { //still encoding
|
5065 |
|
5066 |
if ( strpos($time_matches[1], ':') !== false ) {
|
5067 |
$current_hours = intval(substr($time_matches[1], -11, 2));
|
5080 |
else { $percent_done_text = strval($percent_done)."%"; }
|
5081 |
|
5082 |
preg_match('/fps=\s+(.*?) /', $lastline, $fps_matches);
|
5083 |
+
if ( is_array($fps_matches) && array_key_exists(1, $fps_matches) == true ) {
|
5084 |
if ( $fps_matches[1] != 0 ) { $fps_match = $fps_matches[1]; }
|
5085 |
else { $fps_match = "10"; }
|
5086 |
}
|
5093 |
$args = array($video_key, $format, $page);
|
5094 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
5095 |
|
5096 |
+
$embed_display = '<strong>'.__('Encoding', 'video-embed-thumbnail-generator').'</strong> <div class="kgvid_meter"><div class="kgvid_meter_bar" style="width:'.$percent_done.'%;"><div class="kgvid_meter_text">'.$percent_done_text.'</div></div></div>';
|
5097 |
|
5098 |
if ( current_user_can('encode_videos') && $pid ) {
|
5099 |
+
$embed_display .= '<a href="javascript:void(0);" class="kgvid_cancel_button" id="attachments-'.$video_entry["attachmentID"].'-kgflashmediaplayer-cancelencode" onclick="kgvid_cancel_encode('.$pid.', \''.$video_entry["attachmentID"].'\', \''.$video_key.'\', \''.$format.'\');">'.__('Cancel', 'video-embed-thumbnail-generator').'</a>';
|
5100 |
}
|
5101 |
|
5102 |
+
$embed_display .= '<div style="display:block;"><small>'.__('Elapsed:', 'video-embed-thumbnail-generator').' '.date('H:i:s',$time_elapsed).'. '.__('Remaining:', 'video-embed-thumbnail-generator').' '.$time_remaining.'. '._x('FPS:', 'Frames per second', 'video-embed-thumbnail-generator').' '.$fps_match.'</small></div><script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, '.$time_to_wait.');</script>';
|
5103 |
}
|
5104 |
+
elseif ( time() - $started < 10 || ( file_exists($filepath) && time() - filemtime($filepath) < 10 ) ) { //not enough time has passed, so check again later
|
5105 |
$args = array($video_key, $format, $page);
|
5106 |
+
$embed_display = '<strong>'.__('Encoding', 'video-embed-thumbnail-generator').'</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
5107 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
5108 |
}
|
5109 |
+
elseif ( ( is_array($video_matches) && array_key_exists(1, $video_matches) == true ) || ( is_array($libx264_matches) && array_key_exists(1, $libx264_matches) == true ) ) { //encoding complete
|
5110 |
+
|
5111 |
+
if ( $blog_id ) { switch_to_blog($blog_id); }
|
5112 |
+
|
5113 |
$percent_done = 100;
|
5114 |
$ended = filemtime($logfile);
|
5115 |
$time_elapsed = $ended - $started;
|
5116 |
$time_remaining = "0";
|
5117 |
$fps_match = "10";
|
5118 |
+
if ( is_array($libx264_matches) && array_key_exists(1, $libx264_matches) ) {
|
5119 |
+
$moov_output = kgvid_fix_moov_atom($filepath);
|
5120 |
+
} //fix the moov atom if the file was encoded by libx264
|
5121 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['status'] = "Encoding Complete";
|
5122 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['ended'] = $ended;
|
5123 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['lastline'] = $lastline;
|
5124 |
|
5125 |
+
kgvid_save_encode_queue($video_encode_queue);
|
5126 |
|
5127 |
if ( $format != "fullres" ) {
|
5128 |
|
5139 |
|
5140 |
global $wpdb;
|
5141 |
global $user_ID;
|
5142 |
+
$query = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid='%s'", $video_encode_queue[$video_key]['encode_formats'][$format]['url'] ); //check for existing entry in the db
|
5143 |
$video_id = $wpdb->get_var($query);
|
5144 |
if ( !$video_id ) {
|
5145 |
+
$wp_filetype = wp_check_filetype(basename($filepath), null );
|
5146 |
$video_formats = kgvid_video_formats();
|
5147 |
$title .= " ".$video_formats[$format]['name'];
|
5148 |
|
5160 |
'post_author' => $user_ID
|
5161 |
);
|
5162 |
|
5163 |
+
$new_id = wp_insert_attachment( $attachment, $filepath, $parent_id );
|
5164 |
// you must first include the image.php file
|
5165 |
// for the function wp_generate_attachment_metadata() to work and media.php for wp_read_video_metadata() in WP 3.6+
|
5166 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
5167 |
global $wp_version;
|
5168 |
if ( $wp_version >= 3.6 ) { require_once(ABSPATH . 'wp-admin/includes/media.php'); }
|
5169 |
require_once(ABSPATH . 'wp-admin/includes/media.php');
|
5170 |
+
$attach_data = wp_generate_attachment_metadata( $new_id, $filepath );
|
5171 |
wp_update_attachment_metadata( $new_id, $attach_data );
|
5172 |
update_post_meta( $new_id, '_kgflashmediaplayer-format', $format );
|
5173 |
if ( get_post_type($video_entry['attachmentID']) == false ) { update_post_meta( $new_id, '_kgflashmediaplayer-externalurl', $video_entry['movieurl'] ); } //connect new video to external url
|
5176 |
|
5177 |
//finish inserting attachment
|
5178 |
|
5179 |
+
$embed_display = '<strong>'.__('Encoding Complete', 'video-embed-thumbnail-generator').'</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
5180 |
+
|
5181 |
$next_video = kgvid_encode_videos(); //start the next queued video
|
5182 |
if ( !empty($next_video['format']) ) { //if there's something to encode, schedule cron
|
5183 |
$args = array($next_video['video_key'], $next_video['format'], $page);
|
5184 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
5185 |
}
|
5186 |
+
elseif ( $video_encode_queue[$video_key]['encode_formats']['fullres']['status'] == "Encoding Complete" ) { //if there's nothing left to encode and we're replacing the original
|
5187 |
|
5188 |
$new_movie_url = kgvid_replace_video( $video_key, 'fullres' );
|
5189 |
$script_function = 'kgvid_redraw_encode_checkboxes("'.$new_movie_url.'", "'.$video_entry['attachmentID'].'", "'.$page.'")';
|
5190 |
|
5191 |
+
if ( $video_encode_queue[$video_key]['movie_info']['rotate'] != "" ) { //if the video needed rotating
|
5192 |
+
$video_encode_queue[$video_key]['movie_info']['rotate'] = ""; //clear rotation because we've just fixed that problem
|
5193 |
delete_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-rotate');
|
5194 |
|
5195 |
$setwidth = $video_entry['movie_info']['width'];
|
5197 |
if ( intval($setwidth) > intval($setheight) ) { //swap the width and height meta if it hasn't already been done
|
5198 |
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-actualwidth', $video_entry['movie_info']['height']);
|
5199 |
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-width', $setheight);
|
5200 |
+
$video_encode_queue[$video_key]['movie_info']['width'] = $video_entry['movie_info']['height'];
|
5201 |
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-actualheight', $video_entry['movie_info']['width']);
|
5202 |
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-height', $setwidth);
|
5203 |
+
$video_encode_queue[$video_key]['movie_info']['height'] = $video_entry['movie_info']['width'];
|
5204 |
}
|
5205 |
+
kgvid_save_encode_queue($video_encode_queue);
|
5206 |
}
|
5207 |
|
5208 |
$embed_display = '<strong>Encoding Complete</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
5209 |
|
5210 |
+
if ( $blog_id ) { restore_current_blog(); }
|
5211 |
+
|
5212 |
+
}//encoding complete
|
5213 |
|
5214 |
}
|
5215 |
else { //there was an unexpected output and the encoded file hasn't been modified in more than 10 seconds
|
5216 |
|
5217 |
if ( strpos($lastline, "signal 15") !== false ) { //if the encoding was intentionally canceled
|
5218 |
+
$lastline = __("Encoding was canceled.", 'video-embed-thumbnail-generator');
|
5219 |
}
|
5220 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['status'] = "error";
|
5221 |
|
5222 |
}
|
5223 |
|
5225 |
} //if logfile
|
5226 |
else {
|
5227 |
|
5228 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['status'] = "error";
|
5229 |
+
$lastline = __("No log file", 'video-embed-thumbnail-generator');
|
5230 |
|
5231 |
}
|
5232 |
|
5233 |
+
if ( $video_encode_queue[$video_key]['encode_formats'][$format]['status'] == "error" ) {
|
5234 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['lastline'] = addslashes($lastline);
|
5235 |
+
kgvid_save_encode_queue($video_encode_queue);
|
5236 |
+
$embed_display = '<strong>'.__('Error:', 'video-embed-thumbnail-generator').' </strong><span class="kgvid_warning">'.stripslashes($lastline).'.</span>';
|
5237 |
$next_video = kgvid_encode_videos(); //start the next queued video
|
5238 |
if ( !empty($next_video['format']) ) {
|
5239 |
$embed_display .= '<script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
5243 |
}
|
5244 |
|
5245 |
}//if not completed
|
5246 |
+
else { $arr = array ( "embed_display"=>"<strong>".ucwords($video_encode_queue[$video_key]['encode_formats'][$format]['status'])."</strong>" ); }
|
5247 |
} //if there's a queue and the video is encoding
|
5248 |
+
else { $arr = array ( "embed_display"=>"<strong>".__('Waiting...', 'video-embed-thumbnail-generator')."</strong><script type='text/javascript'>percent_timeout = setTimeout(function(){'.$script_function.'}, 2000);</script>" ); }
|
5249 |
return $arr;
|
5250 |
|
5251 |
}//end if queue entry exists
|
5252 |
|
5253 |
}
|
5254 |
+
add_action('kgvid_cron_queue_check', 'kgvid_encode_progress', 10, 3);
|
5255 |
|
5256 |
function kgvid_ajax_encode_progress() {
|
5257 |
|
5259 |
$video_key = $_POST['video_key'];
|
5260 |
$format = $_POST['format'];
|
5261 |
$page = $_POST['page'];
|
|
|
5262 |
$progress = kgvid_encode_progress($video_key, $format, $page);
|
5263 |
echo json_encode($progress);
|
5264 |
die();
|
5268 |
|
5269 |
function kgvid_replace_video ( $video_key, $format ) {
|
5270 |
|
5271 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
5272 |
+
$encoded_filename = $video_encode_queue[$video_key]['encode_formats'][$format]['filepath'];
|
5273 |
+
$video_id = $video_encode_queue[$video_key]['attachmentID'];
|
5274 |
|
5275 |
$original_filename = get_attached_file($video_id);
|
5276 |
$path_parts = pathinfo($original_filename);
|
5277 |
if ( $path_parts['extension'] != "mp4" && $path_parts['extension'] != "m4v" ) {
|
5278 |
$new_filename = str_replace("-fullres", "", $encoded_filename);
|
5279 |
+
$sanitized_url = kgvid_sanitize_url($video_encode_queue[$video_key]['movieurl']);
|
5280 |
$new_url = $sanitized_url['noextension'].".mp4";
|
5281 |
+
$video_encode_queue[$video_key]['movieurl'] = $new_url;
|
5282 |
global $wpdb;
|
5283 |
+
$query = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE `post_content` LIKE '%%%s%%'", $sanitized_url['basename'].".".$path_parts['extension'] ); //find posts that use the old filename
|
5284 |
$results = $wpdb->get_results($query);
|
5285 |
if ( $results ) {
|
5286 |
foreach ( $results as $result ) {
|
5292 |
}
|
5293 |
else {
|
5294 |
$new_filename = $original_filename;
|
5295 |
+
$new_url = $video_encode_queue[$video_key]['movieurl'];
|
5296 |
}
|
5297 |
|
5298 |
if ( file_exists($encoded_filename) ) {
|
5299 |
rename($encoded_filename, $new_filename);
|
5300 |
if ( file_exists($original_filename) && $original_filename != $new_filename ) { unlink($original_filename); }
|
5301 |
}
|
5302 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['url'] = $new_url;
|
5303 |
+
kgvid_save_encode_queue($video_encode_queue);
|
5304 |
|
5305 |
// you must first include the image.php file
|
5306 |
// for the function wp_generate_attachment_metadata() to work and media.php for wp_read_video_metadata() in WP 3.6+
|
5307 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
5308 |
global $wp_version;
|
|
|
5309 |
if ( $wp_version >= 3.6 ) { require_once(ABSPATH . 'wp-admin/includes/media.php'); }
|
5310 |
$attach_data = wp_generate_attachment_metadata( $video_id, $new_filename );
|
5311 |
wp_update_attachment_metadata( $video_id, $attach_data );
|
5320 |
return $new_url;
|
5321 |
}
|
5322 |
|
5323 |
+
function kgvid_clear_completed_queue($type, $scope = 'site') {
|
5324 |
|
5325 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
5326 |
|
5327 |
+
if ( !empty($video_encode_queue) ) {
|
5328 |
|
5329 |
$keep = array();
|
5330 |
$cleared_video_queue = array();
|
5331 |
|
5332 |
+
foreach ( $video_encode_queue as $video_key => $queue_entry ) {
|
5333 |
if ( !empty($queue_entry['encode_formats']) ) {
|
5334 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
5335 |
+
if ( $value['status'] == "queued" || $value['status'] == "encoding" ) { //if it's not completed yet
|
5336 |
$keep[$video_key] = true;
|
5337 |
break;
|
5338 |
}
|
5342 |
break;
|
5343 |
}
|
5344 |
}
|
5345 |
+
if ( !is_network_admin() && $scope == 'site' && array_key_exists('blog_id', $queue_entry) && $queue_entry['blog_id'] != get_current_blog_id() ) { //only clear entries from current blog
|
5346 |
+
$keep[$video_key] = true;
|
5347 |
+
break;
|
5348 |
+
}
|
5349 |
}
|
5350 |
}
|
5351 |
}
|
5352 |
|
5353 |
foreach ( $keep as $video_key => $value ) {
|
5354 |
+
$cleared_video_queue[] = $video_encode_queue[$video_key];
|
5355 |
}
|
5356 |
sort($cleared_video_queue);
|
5357 |
|
5358 |
+
kgvid_save_encode_queue($cleared_video_queue);
|
5359 |
|
5360 |
}
|
5361 |
}
|
5365 |
|
5366 |
if ( current_user_can('encode_videos') ) {
|
5367 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
5368 |
+
$scope = $_POST['scope'];
|
5369 |
+
kgvid_clear_completed_queue('manual', $scope);
|
5370 |
+
$table = kgvid_generate_queue_table($scope);
|
5371 |
echo ($table);
|
5372 |
die();
|
5373 |
}
|
5379 |
|
5380 |
if ( current_user_can('encode_videos') ) {
|
5381 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
|
|
5382 |
$video_key = $_POST['index'];
|
5383 |
+
$scope = $_POST['scope'];
|
5384 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
5385 |
+
if ( is_array($video_encode_queue) && array_key_exists($video_key, $video_encode_queue) ) {
|
5386 |
+
unset($video_encode_queue[$video_key]);
|
5387 |
+
sort($video_encode_queue);
|
5388 |
}
|
5389 |
+
kgvid_save_encode_queue($video_encode_queue);
|
5390 |
+
|
5391 |
+
$table = kgvid_generate_queue_table($scope);
|
5392 |
echo ($table);
|
5393 |
die();
|
5394 |
}
|
5403 |
|
5404 |
function kgvid_fix_moov_atom($filepath) {
|
5405 |
|
5406 |
+
$options = kgvid_get_options();
|
5407 |
$output = "";
|
5408 |
|
5409 |
if ( $options['moov'] == "qt-faststart" || $options['moov'] == "MP4Box" ) {
|
5410 |
|
5411 |
+
$output = "\n".__('Fixing moov atom for streaming', 'video-embed-thumbnail-generator');
|
5412 |
|
5413 |
if ( $options['moov'] == 'qt-faststart' && file_exists($filepath) ) {
|
5414 |
$faststart_tmp_file = str_replace('.mp4', '-faststart.mp4', $filepath);
|
5447 |
}
|
5448 |
$video_key = $_POST['video_key'];
|
5449 |
$format = $_POST['format'];
|
5450 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
5451 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['status'] = "canceling";
|
5452 |
+
kgvid_save_encode_queue($video_encode_queue);
|
5453 |
}
|
5454 |
die(); // this is required to return a proper result
|
5455 |
}
|
5461 |
|
5462 |
if ( current_user_can('encode_videos') ) {
|
5463 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
|
|
5464 |
$deleted = false;
|
5465 |
$attachment_id = "";
|
5466 |
if ( isset($_POST['movieurl']) ) { $movieurl = $_POST['movieurl']; }
|
5467 |
if ( isset($_POST['postid']) ) { $post_id = $_POST['postid']; }
|
5468 |
if ( isset($_POST['format']) ) { $format = $_POST['format']; }
|
5469 |
if ( isset($_POST['childid']) ) { $attachment_id = $_POST['childid']; }
|
5470 |
+
if ( isset($_POST['blogid']) ) { $blog_id = $_POST['blogid']; }
|
5471 |
+
else { $blog_id = false; }
|
5472 |
+
|
5473 |
if ( empty($attachment_id) ) { //if there's no post_meta giving us the attachment to delete
|
5474 |
$encodevideo_info = kgvid_encodevideo_info($movieurl, $post_id);
|
5475 |
if ( is_file($encodevideo_info[$format.'filepath']) ) {
|
5477 |
}
|
5478 |
}
|
5479 |
else {
|
5480 |
+
if ( $blog_id ) { switch_to_blog($blog_id); }
|
5481 |
$deleted = wp_delete_attachment($attachment_id);
|
5482 |
if ( !empty($deleted) ) { $deleted = true; }
|
5483 |
+
if ( $blog_id ) { restore_current_blog(); }
|
5484 |
}
|
5485 |
echo($deleted);
|
5486 |
die();
|
5492 |
function kgvid_delete_video_attachment($video_id) {
|
5493 |
|
5494 |
if ( strpos(get_post_mime_type( $video_id ), 'video') !== false ) { //only do this for videos
|
|
|
5495 |
$parent_post = get_post($video_id);
|
5496 |
+
$options = kgvid_get_options();
|
5497 |
+
$video_encode_queue = kgvid_get_encode_queue();
|
5498 |
$parent_id = get_post($video_id)->post_parent;
|
5499 |
$wp_attached_file = get_post_meta($video_id, '_wp_attached_file', true);
|
5500 |
|
5501 |
+
if ( !empty($video_encode_queue) ) { //remove any encode queue entry related to this attachment
|
5502 |
+
foreach ($video_encode_queue as $video_key => $video_entry) {
|
5503 |
if ( $video_entry['attachmentID'] == $video_id ) {
|
5504 |
|
5505 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
5509 |
}
|
5510 |
}
|
5511 |
|
5512 |
+
unset($video_encode_queue[$video_key]);
|
5513 |
+
sort($video_encode_queue);
|
5514 |
+
kgvid_save_encode_queue($video_encode_queue);
|
5515 |
break;
|
5516 |
}//if the video is an original format
|
5517 |
if ( $video_entry['attachmentID'] == $parent_id || get_post_meta($video_id, '_kgflashmediaplayer-externalurl', true) == $video_entry['movieurl'] ) {
|
5518 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
5519 |
if ( array_key_exists('filepath', $value) ) {
|
5520 |
if ( strpos($value['filepath'], $wp_attached_file) !== false ) {
|
5521 |
+
$video_encode_queue[$video_key]['encode_formats'][$format]['status'] = "deleted";
|
5522 |
+
kgvid_save_encode_queue($video_encode_queue);
|
5523 |
break;
|
5524 |
}//if the format has filepath information
|
5525 |
}//if the encoded child format is in the database
|
5590 |
|
5591 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
5592 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5593 |
$args = array(
|
5594 |
'post_type' => null,
|
5595 |
'numberposts' => -1,
|
5734 |
if (isset($_POST['cms_type'])) { $type = $_POST['cms_type']; }
|
5735 |
if (isset($_POST['total'])) { $total = $_POST['total']; }
|
5736 |
$queue = get_option('kgvid_video_embed_cms_switch');
|
5737 |
+
if ( is_array($queue) && array_key_exists($type, $queue) ) {
|
5738 |
+
$remaining = count($queue[$type]);
|
5739 |
}
|
5740 |
echo $remaining;
|
5741 |
die;
|
5756 |
);
|
5757 |
}
|
5758 |
}
|
5759 |
+
add_action( 'add_meta_boxes', 'kgvid_singleurl_meta_box' );
|
5760 |
|
5761 |
function kgvid_singleurl_inner_custom_box($post) {
|
5762 |
|
5769 |
$nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
|
5770 |
echo '<h4>Alternate formats of embedded videos</h4>';
|
5771 |
foreach ( $urls as $movieurl ) {
|
5772 |
+
$query = $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE guid='%s'", $movieurl ); //GUID seems to be the only way to get a video URL
|
5773 |
$video_id = $wpdb->get_var($query);
|
5774 |
|
5775 |
echo '<div class="kgvid_post_meta_boxes">';
|
5817 |
die;
|
5818 |
}
|
5819 |
add_action('wp_ajax_kgvid_rescan_external_server', 'kgvid_ajax_rescan_external_server');
|
5820 |
+
*/
|
5821 |
|
5822 |
function kgvid_count_play() {
|
5823 |
+
|
5824 |
+
check_ajax_referer( 'kgvid_frontend_nonce', 'security' );
|
5825 |
+
|
5826 |
$post_id = $_POST['post_id'];
|
5827 |
$event = $_POST['video_event'];
|
5828 |
if ( $event == "play" ) { $event = "starts"; }
|
5837 |
add_action( 'wp_ajax_kgvid_count_play', 'kgvid_count_play' ); // ajax for logged in users
|
5838 |
add_action( 'wp_ajax_nopriv_kgvid_count_play', 'kgvid_count_play' ); // ajax for not logged in users
|
5839 |
|
5840 |
+
function kgvid_set_gallery_video_code() {
|
5841 |
+
|
5842 |
+
check_ajax_referer( 'kgvid_frontend_nonce', 'security' );
|
5843 |
+
$options = kgvid_get_options();
|
5844 |
+
$id = $_POST['video_id'];
|
5845 |
+
$dimensions = kgvid_set_video_dimensions($id, true);
|
5846 |
+
$downloadlink = get_post_meta($id, "_kgflashmediaplayer-downloadlink", true);
|
5847 |
+
|
5848 |
+
$shortcode = '[KGVID autoplay="true" id="'.$id.'" width="'.$dimensions['width'].'" height="'.$dimensions['height'].'"';
|
5849 |
+
if ($downloadlink == "checked") { $shortcode .= ' downloadlink="true"'; }
|
5850 |
+
$shortcode .= '][/KGVID]';
|
5851 |
+
|
5852 |
+
$code = do_shortcode($shortcode);
|
5853 |
+
$width = $dimensions['width'];
|
5854 |
+
$code = preg_replace('/width: (.*?)px/i', "width: ".$width."px", $code); //WordPress thinks we're in the Admin area so it sets the content_width the same every time
|
5855 |
+
$code = preg_replace('/width="(.*?)"/i', 'width='.$width.'"', $code);
|
5856 |
+
$post = get_post($id);
|
5857 |
+
|
5858 |
+
if ( $options['embed_method'] == "JW Player" && !class_exists('JWP6_Shortcode') ) { $options['embed_method'] = "Video.js"; }
|
5859 |
+
|
5860 |
+
$video_variables = array(
|
5861 |
+
'id' => $id,
|
5862 |
+
'player_type' => $options['embed_method'],
|
5863 |
+
'width' => $dimensions['width'],
|
5864 |
+
'height' => $dimensions['height'],
|
5865 |
+
'countable' => "true",
|
5866 |
+
'autoplay' => "true",
|
5867 |
+
'set_volume' => '',
|
5868 |
+
'meta' => "true",
|
5869 |
+
'endofvideooverlay' => $options['endofvideooverlay'],
|
5870 |
+
'resize' => "true",
|
5871 |
+
'right_click' => $options['right_click']
|
5872 |
+
);
|
5873 |
+
|
5874 |
+
if ( $options['embed_method'] == "Strobe Media Playback" ) {
|
5875 |
+
|
5876 |
+
$content = wp_get_attachment_url($id);
|
5877 |
+
$encodevideo_info = kgvid_encodevideo_info($content, $id);
|
5878 |
+
$flash_settings = kgvid_generate_flashvars($content, $video_variables, $encodevideo_info, $id);
|
5879 |
+
|
5880 |
+
$video_variables['swfurl'] = plugins_url('', __FILE__)."/flash/StrobeMediaPlayback.swf";
|
5881 |
+
$video_variables['expressinstallswfurl'] = plugins_url("", __FILE__)."/flash/expressInstall.swf";
|
5882 |
+
$video_variables['flashvars'] = $flash_settings['flashvars'];
|
5883 |
+
$video_variables['params'] = $flash_settings['params'];
|
5884 |
+
|
5885 |
+
} //if Strobe Media
|
5886 |
+
|
5887 |
+
$data = array( 'kgvid_video_vars' => $video_variables, 'code' => $code );
|
5888 |
+
$data = json_encode($data);
|
5889 |
+
echo $data;
|
5890 |
+
die();
|
5891 |
+
|
5892 |
+
}
|
5893 |
+
add_action( 'wp_ajax_kgvid_set_gallery_video', 'kgvid_set_gallery_video_code' ); // ajax for logged in users
|
5894 |
+
add_action( 'wp_ajax_nopriv_kgvid_set_gallery_video', 'kgvid_set_gallery_video_code' ); // ajax for not logged in users
|
5895 |
+
|
5896 |
+
|
5897 |
+
function kgvid_add_contextual_help_tab() {
|
5898 |
+
|
5899 |
+
$false_code = '<code>"false"</code>';
|
5900 |
+
|
5901 |
+
get_current_screen()->add_help_tab( array(
|
5902 |
+
'id' => 'kgvid-help-tab',
|
5903 |
+
'title' => __( 'Video Embed & Thumbnail Generator Shortcode Reference' , 'video-embed-thumbnail-generator'),
|
5904 |
+
'content' => '<p><strong>'.__('Use these optional attributes in the [KGVID] shortcode:', 'video-embed-thumbnail-generator').'</strong></p>
|
5905 |
+
<ul><li><code>id="xxx"</code> '.__('video attachment ID (instead of using a URL).', 'video-embed-thumbnail-generator').'</li>
|
5906 |
+
<li><code>videos="x"</code> '.__('number of attached videos to display if no URL or ID is given.', 'video-embed-thumbnail-generator').'</li>
|
5907 |
+
<li><code>orderby="menu_order/title/post_date/rand/ID"</code> '.__('criteria for sorting attached videos if no URL or ID is given.', 'video-embed-thumbnail-generator').'</li>
|
5908 |
+
<li><code>order="ASC/DESC"</code> '.__('sort order.', 'video-embed-thumbnail-generator').'</li>
|
5909 |
+
<li><code>poster="http://www.example.com/image.jpg"</code> '.__('sets the thumbnail.', 'video-embed-thumbnail-generator').'</li>
|
5910 |
+
<li><code>endofvideooverlay="http://www.example.com/end_image.jpg</code> '.__('sets the image shown when the video ends.', 'video-embed-thumbnail-generator').'</li>
|
5911 |
+
<li><code>width="xxx"</code></li>
|
5912 |
+
<li><code>height="xxx"</code></li>
|
5913 |
+
<li><code>align="left/right/center"</code></li>
|
5914 |
+
<li><code>inline="true/false"</code> '.__('allow other content on the same line as the video', 'video-embed-thumbnail-generator').'</li>
|
5915 |
+
<li><code>volume="0.x"</code> '.__('pre-sets the volume for unusually loud videos. Value between 0 and 1.', 'video-embed-thumbnail-generator').'</li>
|
5916 |
+
<li><code>controlbar="docked/floating/none"</code> '.__('sets the controlbar position. "Floating" option only works with Strobe Media Playback.', 'video-embed-thumbnail-generator').'</li>
|
5917 |
+
<li><code>loop="true/false"</code></li>
|
5918 |
+
<li><code>autoplay="true/false"</code></li>
|
5919 |
+
<li><code>watermark="http://www.example.com/image.png"</code> '.sprintf( __('or %s to disable.', 'video-embed-thumbnail-generator'), $false_code ).'</li>
|
5920 |
+
<li><code>title="Video Title"</code> '.sprintf( __('or %s to disable.', 'video-embed-thumbnail-generator'), $false_code ).'</li>
|
5921 |
+
<li><code>embedcode="html code"</code> '.sprintf( __('changes text displayed in the embed code overlay in order to provide a custom method for embedding a video or %s to disable.', 'video-embed-thumbnail-generator'), $false_code ).'</li>
|
5922 |
+
<li><code>view_count="true/false"</code> '.__('turns the view count on or off.', 'video-embed-thumbnail-generator').'</li>
|
5923 |
+
<li><code>caption="Caption"</code> '.__('text that is displayed below the video (not subtitles or closed captioning)', 'video-embed-thumbnail-generator').'</li>
|
5924 |
+
<li><code>description="Description"</code> '.__('Used for metadata only.', 'video-embed-thumbnail-generator').'</li>
|
5925 |
+
<li><code>downloadlink="true/false"</code> '.__('generates a link below the video to make it easier for users to save the video file to their computers.', 'video-embed-thumbnail-generator').'</li>
|
5926 |
+
<li><code>right_click="true/false"</code> '.__('allow or disable right-clicking on the video player.', 'video-embed-thumbnail-generator').'</li>
|
5927 |
+
<li><code>resize="true/false"</code> '.__('allow or disable responsive resizing.', 'video-embed-thumbnail-generator').'</li></ul>
|
5928 |
+
|
5929 |
+
<p><strong>'.__('These options will add a subtitle/caption track.', 'video-embed-thumbnail-generator').'</strong></p>
|
5930 |
+
<ul><li><code>track_src="http://www.example.com/subtitles.vtt_.txt"</code> '.__('URL of the WebVTT file.', 'video-embed-thumbnail-generator').'</li>
|
5931 |
+
<li><code>track_kind=subtitles/captions/chapters</code></li>
|
5932 |
+
<li><code>track_srclang=xx</code> '.__('the track\'s two-character language code (en, fr, es, etc)', 'video-embed-thumbnail-generator').'</li>
|
5933 |
+
<li><code>track_label="Track Label"</code> '.__('text that will be shown to the user when selecting the track.', 'video-embed-thumbnail-generator').'</li></ul>
|
5934 |
+
|
5935 |
+
<p><strong>'.__('These options will only affect Video.js playback', 'video-embed-thumbnail-generator').'</strong></p>
|
5936 |
+
<ul><li><code>skin="example-css-class"</code> '.sprintf( __('Completely change the look of the video player. %sInstructions here.', 'video-embed-thumbnail-generator'), '<a href="https://github.com/zencoder/video-js/blob/master/docs/skins.md">' ).'</a></li></ul>
|
5937 |
+
|
5938 |
+
<p><strong>'.__('These options will only affect Flash playback in Strobe Media Playback video elements. They will have no effect on other players.', 'video-embed-thumbnail-generator').'</p></strong>
|
5939 |
+
<ul><li><code>autohide="true/false"</code> '.__('specify whether to autohide the control bar after a few seconds.', 'video-embed-thumbnail-generator').'</li>
|
5940 |
+
<li><code>playbutton="true/false"</code> '.__('turns the big play button overlay in the middle of the video on or off.', 'video-embed-thumbnail-generator').'</li>
|
5941 |
+
<li><code>streamtype="live/recorded/DVR"</code> '.__('I honestly don\'t know what this is for.', 'video-embed-thumbnail-generator').'</li>
|
5942 |
+
<li><code>scalemode="letterbox/none/stretch/zoom"</code> '.__('If the video display size isn\'t the same as the video file, this determines how the video will be scaled.', 'video-embed-thumbnail-generator').'</li>
|
5943 |
+
<li><code>backgroundcolor="'.__('#rrggbb', 'video-embed-thumbnail-generator').'"</code> '.__('set the background color to whatever hex code you want.', 'video-embed-thumbnail-generator').'</li>
|
5944 |
+
<li><code>configuration="http://www.example.com/config.xml"</code> '.__('Lets you specify all these flashvars in an XML file.', 'video-embed-thumbnail-generator').'</li>
|
5945 |
+
<li><code>skin="http://www.example.com/skin.xml"</code> '.sprintf( __('Completely change the look of the video player. %sInstructions here.', 'video-embed-thumbnail-generator'), '<a href="http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/14/building-skins">' ).'</a></li></ul>
|
5946 |
+
|
5947 |
+
<p><strong>'.__('These options are available for video galleries (options work the same as standard WordPress image galleries)', 'video-embed-thumbnail-generator').'</p></strong>
|
5948 |
+
<ul><li><code>gallery="true"</code> '.__('turns on the gallery', 'video-embed-thumbnail-generator').'</li>
|
5949 |
+
<li><code>gallery_thumb="xxx"</code> '.__('width in pixels to display gallery thumbnails', 'video-embed-thumbnail-generator').'</li>
|
5950 |
+
<li><code>gallery_exclude="15"</code> '.__('comma separated video attachment IDs. Excludes the videos from the gallery.', 'video-embed-thumbnail-generator').'</li>
|
5951 |
+
<li><code>gallery_include="65"</code> '.__('comma separated video attachment IDs. Includes only these videos in the gallery. Please note that include and exclude cannot be used together.', 'video-embed-thumbnail-generator').'</li>
|
5952 |
+
<li><code>gallery_orderby="menu_order/title/post_date/rand/ID"</code> '.__('criteria for sorting the gallery', 'video-embed-thumbnail-generator').'</li>
|
5953 |
+
<li><code>gallery_order="ASC/DESC"</code> '.__('sort order', 'video-embed-thumbnail-generator').'</li>
|
5954 |
+
<li><code>gallery_id="241"</code> '.__('post ID to display a gallery made up of videos associated with a different post.', 'video-embed-thumbnail-generator').'</li>
|
5955 |
+
<li><code>gallery_end="close/next"</code> '.__('either close the pop-up or start playing the next video when the current video finishes playing.', 'video-embed-thumbnail-generator').'</li></ul>'
|
5956 |
+
) );
|
5957 |
+
|
5958 |
+
}
|
5959 |
+
add_action( 'admin_head-post.php', 'kgvid_add_contextual_help_tab' );
|
5960 |
+
|
5961 |
+
|
5962 |
+
function kgvid_clear_cron_and_roles() {
|
5963 |
+
|
5964 |
+
$options = kgvid_default_options_fn();
|
5965 |
wp_clear_scheduled_hook('kgvid_cleanup_queue', array( 'scheduled' ) );
|
5966 |
+
wp_clear_scheduled_hook('kgvid_cleanup_generated_thumbnails');
|
5967 |
+
kgvid_cleanup_generated_thumbnails_handler(); //run this now because cron won't do it later
|
5968 |
global $wp_roles;
|
5969 |
+
foreach ( $options['capabilities'] as $capability => $roles ) {
|
5970 |
+
foreach ( $wp_roles->roles as $role => $role_info ) {
|
5971 |
$wp_roles->remove_cap( $role, $capability );
|
5972 |
}
|
5973 |
}
|
5974 |
}
|
5975 |
+
|
5976 |
+
function kgvid_deactivate_plugin( $network_wide ) {
|
5977 |
+
|
5978 |
+
if ( is_multisite() && $network_wide ) {
|
5979 |
+
|
5980 |
+
$current_blog_id = get_current_blog_id();
|
5981 |
+
$sites = wp_get_sites();
|
5982 |
+
|
5983 |
+
if ( is_array($sites) ) {
|
5984 |
+
|
5985 |
+
foreach ( $sites as $site ) {
|
5986 |
+
|
5987 |
+
switch_to_blog($site['blog_id']);
|
5988 |
+
kgvid_clear_cron_and_roles();
|
5989 |
+
|
5990 |
+
}//end loop through sites
|
5991 |
+
|
5992 |
+
switch_to_blog($current_blog_id);
|
5993 |
+
|
5994 |
+
}//end if there are sites
|
5995 |
+
|
5996 |
+
}//end if network activated
|
5997 |
+
|
5998 |
+
else { //if not network activated
|
5999 |
+
kgvid_clear_cron_and_roles();
|
6000 |
+
}
|
6001 |
+
}
|
6002 |
+
register_deactivation_hook( __FILE__, 'kgvid_deactivate_plugin' );
|
6003 |
|
6004 |
?>
|
video-js/kg-video-js-skin.css
CHANGED
@@ -375,9 +375,9 @@ easily in the skin designer. http://designer.videojs.com/
|
|
375 |
vertical-align: middle;
|
376 |
cursor: pointer;
|
377 |
opacity: 1;
|
378 |
-
box-sizing: content-box;
|
379 |
-
-moz-box-sizing: content-box;
|
380 |
-
-webkit-box-sizing: content-box;
|
381 |
/* Need a slightly gray bg so it can be seen on black backgrounds */
|
382 |
/* background-color-with-alpha */
|
383 |
background-color: rgb(40, 40, 40);
|
375 |
vertical-align: middle;
|
376 |
cursor: pointer;
|
377 |
opacity: 1;
|
378 |
+
box-sizing: content-box !important;
|
379 |
+
-moz-box-sizing: content-box !important;
|
380 |
+
-webkit-box-sizing: content-box !important;
|
381 |
/* Need a slightly gray bg so it can be seen on black backgrounds */
|
382 |
/* background-color-with-alpha */
|
383 |
background-color: rgb(40, 40, 40);
|
video-js/video-js.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*!
|
2 |
Video.js Default Styles (http://videojs.com)
|
3 |
-
Version 4.3
|
4 |
Create your own skin at http://designer.videojs.com
|
5 |
*/.vjs-default-skin{color:#ccc}@font-face{font-family:VideoJS;src:url(font/vjs.eot);src:url(font/vjs.eot?#iefix) format('embedded-opentype'),url(font/vjs.woff) format('woff'),url(font/vjs.ttf) format('truetype');font-weight:400;font-style:normal}.vjs-default-skin .vjs-slider{outline:0;position:relative;cursor:pointer;padding:0;background-color:#333;background-color:rgba(51,51,51,.9)}.vjs-default-skin .vjs-slider:focus{-webkit-box-shadow:0 0 2em #fff;-moz-box-shadow:0 0 2em #fff;box-shadow:0 0 2em #fff}.vjs-default-skin .vjs-slider-handle{position:absolute;left:0;top:0}.vjs-default-skin .vjs-slider-handle:before{content:"\e009";font-family:VideoJS;font-size:1em;line-height:1;text-align:center;text-shadow:0 0 1em #fff;position:absolute;top:0;left:0;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}.vjs-default-skin .vjs-control-bar{display:none;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#07141e;background-color:rgba(7,20,30,.7)}.vjs-default-skin.vjs-has-started .vjs-control-bar{display:block;visibility:visible;opacity:1;-webkit-transition:visibility .1s,opacity .1s;-moz-transition:visibility .1s,opacity .1s;-o-transition:visibility .1s,opacity .1s;transition:visibility .1s,opacity .1s}.vjs-default-skin.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{display:block;visibility:hidden;opacity:0;-webkit-transition:visibility 1s,opacity 1s;-moz-transition:visibility 1s,opacity 1s;-o-transition:visibility 1s,opacity 1s;transition:visibility 1s,opacity 1s}.vjs-default-skin.vjs-controls-disabled .vjs-control-bar{display:none}.vjs-default-skin.vjs-using-native-controls .vjs-control-bar{display:none}@media \0screen{.vjs-default-skin.vjs-user-inactive.vjs-playing .vjs-control-bar :before{content:""}}.vjs-default-skin .vjs-control{outline:0;position:relative;float:left;text-align:center;margin:0;padding:0;height:3em;width:4em}.vjs-default-skin .vjs-control:before{font-family:VideoJS;font-size:1.5em;line-height:2;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;text-shadow:1px 1px 1px rgba(0,0,0,.5)}.vjs-default-skin .vjs-control:focus:before,.vjs-default-skin .vjs-control:hover:before{text-shadow:0 0 1em #fff}.vjs-default-skin .vjs-control:focus{}.vjs-default-skin .vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.vjs-default-skin .vjs-play-control{width:5em;cursor:pointer}.vjs-default-skin .vjs-play-control:before{content:"\e001"}.vjs-default-skin.vjs-playing .vjs-play-control:before{content:"\e002"}.vjs-default-skin .vjs-mute-control,.vjs-default-skin .vjs-volume-menu-button{cursor:pointer;float:right}.vjs-default-skin .vjs-mute-control:before,.vjs-default-skin .vjs-volume-menu-button:before{content:"\e006"}.vjs-default-skin .vjs-mute-control.vjs-vol-0:before,.vjs-default-skin .vjs-volume-menu-button.vjs-vol-0:before{content:"\e003"}.vjs-default-skin .vjs-mute-control.vjs-vol-1:before,.vjs-default-skin .vjs-volume-menu-button.vjs-vol-1:before{content:"\e004"}.vjs-default-skin .vjs-mute-control.vjs-vol-2:before,.vjs-default-skin .vjs-volume-menu-button.vjs-vol-2:before{content:"\e005"}.vjs-default-skin .vjs-volume-control{width:5em;float:right}.vjs-default-skin .vjs-volume-bar{width:5em;height:.6em;margin:1.1em auto 0}.vjs-default-skin .vjs-volume-menu-button .vjs-menu-content{height:2.9em}.vjs-default-skin .vjs-volume-level{position:absolute;top:0;left:0;height:.5em;background:#66a8cc url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat}.vjs-default-skin .vjs-volume-bar .vjs-volume-handle{width:.5em;height:.5em}.vjs-default-skin .vjs-volume-handle:before{font-size:.9em;top:-.2em;left:-.2em;width:1em;height:1em}.vjs-default-skin .vjs-volume-menu-button .vjs-menu .vjs-menu-content{width:6em;left:-4em}.vjs-default-skin .vjs-progress-control{position:absolute;left:0;right:0;width:auto;font-size:.3em;height:1em;top:-1em;-webkit-transition:all .4s;-moz-transition:all .4s;-o-transition:all .4s;transition:all .4s}.vjs-default-skin:hover .vjs-progress-control{font-size:.9em;-webkit-transition:all .2s;-moz-transition:all .2s;-o-transition:all .2s;transition:all .2s}.vjs-default-skin .vjs-progress-holder{height:100%}.vjs-default-skin .vjs-progress-holder .vjs-play-progress,.vjs-default-skin .vjs-progress-holder .vjs-load-progress{position:absolute;display:block;height:100%;margin:0;padding:0;left:0;top:0}.vjs-default-skin .vjs-play-progress{background:#66a8cc url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat}.vjs-default-skin .vjs-load-progress{background:#646464;background:rgba(255,255,255,.4)}.vjs-default-skin .vjs-seek-handle{width:1.5em;height:100%}.vjs-default-skin .vjs-seek-handle:before{padding-top:.1em}.vjs-default-skin .vjs-time-controls{font-size:1em;line-height:3em}.vjs-default-skin .vjs-current-time{float:left}.vjs-default-skin .vjs-duration{float:left}.vjs-default-skin .vjs-remaining-time{display:none;float:left}.vjs-time-divider{float:left;line-height:3em}.vjs-default-skin .vjs-fullscreen-control{width:3.8em;cursor:pointer;float:right}.vjs-default-skin .vjs-fullscreen-control:before{content:"\e000"}.vjs-default-skin.vjs-fullscreen .vjs-fullscreen-control:before{content:"\e00b"}.vjs-default-skin .vjs-big-play-button{left:.5em;top:.5em;font-size:3em;display:block;z-index:2;position:absolute;width:4em;height:2.6em;text-align:center;vertical-align:middle;cursor:pointer;opacity:1;background-color:#07141e;background-color:rgba(7,20,30,.7);border:.1em solid #3b4249;-webkit-border-radius:.8em;-moz-border-radius:.8em;border-radius:.8em;-webkit-box-shadow:0 0 1em rgba(255,255,255,.25);-moz-box-shadow:0 0 1em rgba(255,255,255,.25);box-shadow:0 0 1em rgba(255,255,255,.25);-webkit-transition:all .4s;-moz-transition:all .4s;-o-transition:all .4s;transition:all .4s}.vjs-default-skin.vjs-big-play-centered .vjs-big-play-button{left:50%;margin-left:-2.1em;top:50%;margin-top:-1.4000000000000001em}.vjs-default-skin.vjs-controls-disabled .vjs-big-play-button{display:none}.vjs-default-skin.vjs-has-started .vjs-big-play-button{display:none}.vjs-default-skin.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-default-skin:hover .vjs-big-play-button,.vjs-default-skin .vjs-big-play-button:focus{outline:0;border-color:#fff;background-color:#505050;background-color:rgba(50,50,50,.75);-webkit-box-shadow:0 0 3em #fff;-moz-box-shadow:0 0 3em #fff;box-shadow:0 0 3em #fff;-webkit-transition:all 0s;-moz-transition:all 0s;-o-transition:all 0s;transition:all 0s}.vjs-default-skin .vjs-big-play-button:before{content:"\e001";font-family:VideoJS;line-height:2.6em;text-shadow:.05em .05em .1em #000;text-align:center;position:absolute;left:0;width:100%;height:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;font-size:4em;line-height:1;width:1em;height:1em;margin-left:-.5em;margin-top:-.5em;opacity:.75;-webkit-animation:spin 1.5s infinite linear;-moz-animation:spin 1.5s infinite linear;-o-animation:spin 1.5s infinite linear;animation:spin 1.5s infinite linear}.vjs-default-skin .vjs-loading-spinner:before{content:"\e01e";font-family:VideoJS;position:absolute;top:0;left:0;width:1em;height:1em;text-align:center;text-shadow:0 0 .1em #000}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}.vjs-default-skin .vjs-menu-button{float:right;cursor:pointer}.vjs-default-skin .vjs-menu{display:none;position:absolute;bottom:0;left:0;width:0;height:0;margin-bottom:3em;border-left:2em solid transparent;border-right:2em solid transparent;border-top:1.55em solid #000;border-top-color:rgba(7,40,50,.5)}.vjs-default-skin .vjs-menu-button .vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;position:absolute;width:10em;bottom:1.5em;max-height:15em;overflow:auto;left:-5em;background-color:#07141e;background-color:rgba(7,20,30,.7);-webkit-box-shadow:-.2em -.2em .3em rgba(255,255,255,.2);-moz-box-shadow:-.2em -.2em .3em rgba(255,255,255,.2);box-shadow:-.2em -.2em .3em rgba(255,255,255,.2)}.vjs-default-skin .vjs-menu-button:hover .vjs-menu{display:block}.vjs-default-skin .vjs-menu-button ul li{list-style:none;margin:0;padding:.3em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.vjs-default-skin .vjs-menu-button ul li.vjs-selected{background-color:#000}.vjs-default-skin .vjs-menu-button ul li:focus,.vjs-default-skin .vjs-menu-button ul li:hover,.vjs-default-skin .vjs-menu-button ul li.vjs-selected:focus,.vjs-default-skin .vjs-menu-button ul li.vjs-selected:hover{outline:0;color:#111;background-color:#fff;background-color:rgba(255,255,255,.75);-webkit-box-shadow:0 0 1em #fff;-moz-box-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.vjs-default-skin .vjs-menu-button ul li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em;font-weight:700;cursor:default}.vjs-default-skin .vjs-subtitles-button:before{content:"\e00c"}.vjs-default-skin .vjs-captions-button:before{content:"\e008"}.vjs-default-skin .vjs-captions-button:focus .vjs-control-content:before,.vjs-default-skin .vjs-captions-button:hover .vjs-control-content:before{-webkit-box-shadow:0 0 1em #fff;-moz-box-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.video-js{background-color:#000;position:relative;padding:0;font-size:10px;vertical-align:middle;font-weight:400;font-style:normal;font-family:Arial,sans-serif;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js:-moz-full-screen{position:absolute}body.vjs-full-window{padding:0;margin:0;height:100%;overflow-y:auto}.video-js.vjs-fullscreen{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0;width:100%!important;height:100%!important;_position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-poster{background-repeat:no-repeat;background-position:50% 50%;background-size:contain;cursor:pointer;height:100%;margin:0;padding:0;position:relative;width:100%}.vjs-poster img{display:block;margin:0 auto;max-height:100%;padding:0;width:100%}.video-js.vjs-using-native-controls .vjs-poster{display:none}.video-js .vjs-text-track-display{text-align:center;position:absolute;bottom:4em;left:1em;right:1em}.video-js .vjs-text-track{display:none;font-size:1.4em;text-align:center;margin-bottom:.1em;background-color:#000;background-color:rgba(0,0,0,.5)}.video-js .vjs-subtitles{color:#fff}.video-js .vjs-captions{color:#fc6}.vjs-tt-cue{display:block}.vjs-default-skin .vjs-hidden{display:none}.vjs-lock-showing{display:block!important;opacity:1;visibility:visible}
|
1 |
/*!
|
2 |
Video.js Default Styles (http://videojs.com)
|
3 |
+
Version 4.4.3
|
4 |
Create your own skin at http://designer.videojs.com
|
5 |
*/.vjs-default-skin{color:#ccc}@font-face{font-family:VideoJS;src:url(font/vjs.eot);src:url(font/vjs.eot?#iefix) format('embedded-opentype'),url(font/vjs.woff) format('woff'),url(font/vjs.ttf) format('truetype');font-weight:400;font-style:normal}.vjs-default-skin .vjs-slider{outline:0;position:relative;cursor:pointer;padding:0;background-color:#333;background-color:rgba(51,51,51,.9)}.vjs-default-skin .vjs-slider:focus{-webkit-box-shadow:0 0 2em #fff;-moz-box-shadow:0 0 2em #fff;box-shadow:0 0 2em #fff}.vjs-default-skin .vjs-slider-handle{position:absolute;left:0;top:0}.vjs-default-skin .vjs-slider-handle:before{content:"\e009";font-family:VideoJS;font-size:1em;line-height:1;text-align:center;text-shadow:0 0 1em #fff;position:absolute;top:0;left:0;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}.vjs-default-skin .vjs-control-bar{display:none;position:absolute;bottom:0;left:0;right:0;height:3em;background-color:#07141e;background-color:rgba(7,20,30,.7)}.vjs-default-skin.vjs-has-started .vjs-control-bar{display:block;visibility:visible;opacity:1;-webkit-transition:visibility .1s,opacity .1s;-moz-transition:visibility .1s,opacity .1s;-o-transition:visibility .1s,opacity .1s;transition:visibility .1s,opacity .1s}.vjs-default-skin.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar{display:block;visibility:hidden;opacity:0;-webkit-transition:visibility 1s,opacity 1s;-moz-transition:visibility 1s,opacity 1s;-o-transition:visibility 1s,opacity 1s;transition:visibility 1s,opacity 1s}.vjs-default-skin.vjs-controls-disabled .vjs-control-bar{display:none}.vjs-default-skin.vjs-using-native-controls .vjs-control-bar{display:none}@media \0screen{.vjs-default-skin.vjs-user-inactive.vjs-playing .vjs-control-bar :before{content:""}}.vjs-default-skin .vjs-control{outline:0;position:relative;float:left;text-align:center;margin:0;padding:0;height:3em;width:4em}.vjs-default-skin .vjs-control:before{font-family:VideoJS;font-size:1.5em;line-height:2;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;text-shadow:1px 1px 1px rgba(0,0,0,.5)}.vjs-default-skin .vjs-control:focus:before,.vjs-default-skin .vjs-control:hover:before{text-shadow:0 0 1em #fff}.vjs-default-skin .vjs-control:focus{}.vjs-default-skin .vjs-control-text{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.vjs-default-skin .vjs-play-control{width:5em;cursor:pointer}.vjs-default-skin .vjs-play-control:before{content:"\e001"}.vjs-default-skin.vjs-playing .vjs-play-control:before{content:"\e002"}.vjs-default-skin .vjs-mute-control,.vjs-default-skin .vjs-volume-menu-button{cursor:pointer;float:right}.vjs-default-skin .vjs-mute-control:before,.vjs-default-skin .vjs-volume-menu-button:before{content:"\e006"}.vjs-default-skin .vjs-mute-control.vjs-vol-0:before,.vjs-default-skin .vjs-volume-menu-button.vjs-vol-0:before{content:"\e003"}.vjs-default-skin .vjs-mute-control.vjs-vol-1:before,.vjs-default-skin .vjs-volume-menu-button.vjs-vol-1:before{content:"\e004"}.vjs-default-skin .vjs-mute-control.vjs-vol-2:before,.vjs-default-skin .vjs-volume-menu-button.vjs-vol-2:before{content:"\e005"}.vjs-default-skin .vjs-volume-control{width:5em;float:right}.vjs-default-skin .vjs-volume-bar{width:5em;height:.6em;margin:1.1em auto 0}.vjs-default-skin .vjs-volume-menu-button .vjs-menu-content{height:2.9em}.vjs-default-skin .vjs-volume-level{position:absolute;top:0;left:0;height:.5em;background:#66a8cc url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat}.vjs-default-skin .vjs-volume-bar .vjs-volume-handle{width:.5em;height:.5em}.vjs-default-skin .vjs-volume-handle:before{font-size:.9em;top:-.2em;left:-.2em;width:1em;height:1em}.vjs-default-skin .vjs-volume-menu-button .vjs-menu .vjs-menu-content{width:6em;left:-4em}.vjs-default-skin .vjs-progress-control{position:absolute;left:0;right:0;width:auto;font-size:.3em;height:1em;top:-1em;-webkit-transition:all .4s;-moz-transition:all .4s;-o-transition:all .4s;transition:all .4s}.vjs-default-skin:hover .vjs-progress-control{font-size:.9em;-webkit-transition:all .2s;-moz-transition:all .2s;-o-transition:all .2s;transition:all .2s}.vjs-default-skin .vjs-progress-holder{height:100%}.vjs-default-skin .vjs-progress-holder .vjs-play-progress,.vjs-default-skin .vjs-progress-holder .vjs-load-progress{position:absolute;display:block;height:100%;margin:0;padding:0;left:0;top:0}.vjs-default-skin .vjs-play-progress{background:#66a8cc url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat}.vjs-default-skin .vjs-load-progress{background:#646464;background:rgba(255,255,255,.4)}.vjs-default-skin .vjs-seek-handle{width:1.5em;height:100%}.vjs-default-skin .vjs-seek-handle:before{padding-top:.1em}.vjs-default-skin .vjs-time-controls{font-size:1em;line-height:3em}.vjs-default-skin .vjs-current-time{float:left}.vjs-default-skin .vjs-duration{float:left}.vjs-default-skin .vjs-remaining-time{display:none;float:left}.vjs-time-divider{float:left;line-height:3em}.vjs-default-skin .vjs-fullscreen-control{width:3.8em;cursor:pointer;float:right}.vjs-default-skin .vjs-fullscreen-control:before{content:"\e000"}.vjs-default-skin.vjs-fullscreen .vjs-fullscreen-control:before{content:"\e00b"}.vjs-default-skin .vjs-big-play-button{left:.5em;top:.5em;font-size:3em;display:block;z-index:2;position:absolute;width:4em;height:2.6em;text-align:center;vertical-align:middle;cursor:pointer;opacity:1;background-color:#07141e;background-color:rgba(7,20,30,.7);border:.1em solid #3b4249;-webkit-border-radius:.8em;-moz-border-radius:.8em;border-radius:.8em;-webkit-box-shadow:0 0 1em rgba(255,255,255,.25);-moz-box-shadow:0 0 1em rgba(255,255,255,.25);box-shadow:0 0 1em rgba(255,255,255,.25);-webkit-transition:all .4s;-moz-transition:all .4s;-o-transition:all .4s;transition:all .4s}.vjs-default-skin.vjs-big-play-centered .vjs-big-play-button{left:50%;margin-left:-2.1em;top:50%;margin-top:-1.4000000000000001em}.vjs-default-skin.vjs-controls-disabled .vjs-big-play-button{display:none}.vjs-default-skin.vjs-has-started .vjs-big-play-button{display:none}.vjs-default-skin.vjs-using-native-controls .vjs-big-play-button{display:none}.vjs-default-skin:hover .vjs-big-play-button,.vjs-default-skin .vjs-big-play-button:focus{outline:0;border-color:#fff;background-color:#505050;background-color:rgba(50,50,50,.75);-webkit-box-shadow:0 0 3em #fff;-moz-box-shadow:0 0 3em #fff;box-shadow:0 0 3em #fff;-webkit-transition:all 0s;-moz-transition:all 0s;-o-transition:all 0s;transition:all 0s}.vjs-default-skin .vjs-big-play-button:before{content:"\e001";font-family:VideoJS;line-height:2.6em;text-shadow:.05em .05em .1em #000;text-align:center;position:absolute;left:0;width:100%;height:100%}.vjs-loading-spinner{display:none;position:absolute;top:50%;left:50%;font-size:4em;line-height:1;width:1em;height:1em;margin-left:-.5em;margin-top:-.5em;opacity:.75;-webkit-animation:spin 1.5s infinite linear;-moz-animation:spin 1.5s infinite linear;-o-animation:spin 1.5s infinite linear;animation:spin 1.5s infinite linear}.vjs-default-skin .vjs-loading-spinner:before{content:"\e01e";font-family:VideoJS;position:absolute;top:0;left:0;width:1em;height:1em;text-align:center;text-shadow:0 0 .1em #000}@-moz-keyframes spin{0%{-moz-transform:rotate(0deg)}100%{-moz-transform:rotate(359deg)}}@-webkit-keyframes spin{0%{-webkit-transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg)}}@-o-keyframes spin{0%{-o-transform:rotate(0deg)}100%{-o-transform:rotate(359deg)}}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(359deg)}}.vjs-default-skin .vjs-menu-button{float:right;cursor:pointer}.vjs-default-skin .vjs-menu{display:none;position:absolute;bottom:0;left:0;width:0;height:0;margin-bottom:3em;border-left:2em solid transparent;border-right:2em solid transparent;border-top:1.55em solid #000;border-top-color:rgba(7,40,50,.5)}.vjs-default-skin .vjs-menu-button .vjs-menu .vjs-menu-content{display:block;padding:0;margin:0;position:absolute;width:10em;bottom:1.5em;max-height:15em;overflow:auto;left:-5em;background-color:#07141e;background-color:rgba(7,20,30,.7);-webkit-box-shadow:-.2em -.2em .3em rgba(255,255,255,.2);-moz-box-shadow:-.2em -.2em .3em rgba(255,255,255,.2);box-shadow:-.2em -.2em .3em rgba(255,255,255,.2)}.vjs-default-skin .vjs-menu-button:hover .vjs-menu{display:block}.vjs-default-skin .vjs-menu-button ul li{list-style:none;margin:0;padding:.3em 0;line-height:1.4em;font-size:1.2em;text-align:center;text-transform:lowercase}.vjs-default-skin .vjs-menu-button ul li.vjs-selected{background-color:#000}.vjs-default-skin .vjs-menu-button ul li:focus,.vjs-default-skin .vjs-menu-button ul li:hover,.vjs-default-skin .vjs-menu-button ul li.vjs-selected:focus,.vjs-default-skin .vjs-menu-button ul li.vjs-selected:hover{outline:0;color:#111;background-color:#fff;background-color:rgba(255,255,255,.75);-webkit-box-shadow:0 0 1em #fff;-moz-box-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.vjs-default-skin .vjs-menu-button ul li.vjs-menu-title{text-align:center;text-transform:uppercase;font-size:1em;line-height:2em;padding:0;margin:0 0 .3em;font-weight:700;cursor:default}.vjs-default-skin .vjs-subtitles-button:before{content:"\e00c"}.vjs-default-skin .vjs-captions-button:before{content:"\e008"}.vjs-default-skin .vjs-captions-button:focus .vjs-control-content:before,.vjs-default-skin .vjs-captions-button:hover .vjs-control-content:before{-webkit-box-shadow:0 0 1em #fff;-moz-box-shadow:0 0 1em #fff;box-shadow:0 0 1em #fff}.video-js{background-color:#000;position:relative;padding:0;font-size:10px;vertical-align:middle;font-weight:400;font-style:normal;font-family:Arial,sans-serif;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.video-js .vjs-tech{position:absolute;top:0;left:0;width:100%;height:100%}.video-js:-moz-full-screen{position:absolute}body.vjs-full-window{padding:0;margin:0;height:100%;overflow-y:auto}.video-js.vjs-fullscreen{position:fixed;overflow:hidden;z-index:1000;left:0;top:0;bottom:0;right:0;width:100%!important;height:100%!important;_position:absolute}.video-js:-webkit-full-screen{width:100%!important;height:100%!important}.video-js.vjs-fullscreen.vjs-user-inactive{cursor:none}.vjs-poster{background-repeat:no-repeat;background-position:50% 50%;background-size:contain;cursor:pointer;height:100%;margin:0;padding:0;position:relative;width:100%}.vjs-poster img{display:block;margin:0 auto;max-height:100%;padding:0;width:100%}.video-js.vjs-using-native-controls .vjs-poster{display:none}.video-js .vjs-text-track-display{text-align:center;position:absolute;bottom:4em;left:1em;right:1em}.video-js .vjs-text-track{display:none;font-size:1.4em;text-align:center;margin-bottom:.1em;background-color:#000;background-color:rgba(0,0,0,.5)}.video-js .vjs-subtitles{color:#fff}.video-js .vjs-captions{color:#fc6}.vjs-tt-cue{display:block}.vjs-default-skin .vjs-hidden{display:none}.vjs-lock-showing{display:block!important;opacity:1;visibility:visible}
|
video-js/video-js.swf
CHANGED
Binary file
|
video-js/video.js
CHANGED
@@ -1,129 +1,137 @@
|
|
1 |
-
/*! Video.js v4.3
|
2 |
-
|
3 |
-
|
4 |
-
u.
|
5 |
-
u.
|
6 |
-
u.
|
7 |
-
|
8 |
-
u.
|
9 |
-
|
10 |
-
u.
|
11 |
-
u.
|
12 |
-
u.
|
13 |
-
|
14 |
-
u.
|
15 |
-
|
16 |
-
u.
|
17 |
-
u.
|
|
|
|
|
18 |
u.get=function(a,c,d){var e,g;"undefined"===typeof XMLHttpRequest&&(window.XMLHttpRequest=function(){try{return new window.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new window.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new window.ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw Error("This browser does not support XMLHttpRequest.");});g=new XMLHttpRequest;try{g.open("GET",a)}catch(j){d(j)}e=0===a.indexOf("file:")||0===window.location.href.indexOf("file:")&&-1===a.indexOf("http");
|
19 |
-
g.onreadystatechange=function(){4===g.readyState&&(200===g.status||e&&0===g.status?c(g.responseText):d&&d())};try{g.send()}catch(k){d&&d(k)}};u.
|
20 |
-
u.log=function(){u.log.history=u.log.history||[];u.log.history.push(arguments);window.console&&window.console.log(Array.prototype.slice.call(arguments))};u.
|
21 |
-
u.
|
22 |
-
|
23 |
-
t.
|
24 |
-
t.
|
25 |
-
t.
|
26 |
-
t.
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
t.e=function(a,c){c=
|
31 |
-
t.
|
32 |
-
function
|
33 |
-
t.
|
34 |
-
function
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
function
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
function
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
t.
|
50 |
-
t.
|
51 |
-
t.
|
52 |
-
t.
|
53 |
-
t.
|
54 |
-
t.
|
55 |
-
(
|
56 |
-
|
57 |
-
t.
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
t.
|
62 |
-
|
63 |
-
u.
|
64 |
-
|
65 |
-
u.
|
66 |
-
u.
|
67 |
-
u.
|
68 |
-
u.
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
u.
|
74 |
-
|
75 |
-
u.
|
76 |
-
|
77 |
-
u.
|
78 |
-
u.
|
79 |
-
u.
|
80 |
-
u.
|
81 |
-
u.
|
82 |
-
u.
|
83 |
-
u.
|
84 |
-
|
85 |
-
u.r.
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
t.
|
92 |
-
t.ud=function(a){this.a.
|
93 |
-
u.l.
|
94 |
-
|
95 |
-
|
96 |
-
function(){
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
u.f.
|
|
|
|
|
|
|
|
|
101 |
u.f.version=function(){var a="0,0,0";try{a=(new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(c){try{navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(a=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(d){}}return a.split(",")};
|
102 |
-
u.f
|
103 |
-
u.f.
|
104 |
-
u.f.
|
105 |
-
u.
|
106 |
-
u.
|
107 |
-
t.e=function(){return u.
|
108 |
-
function X(a){0===a.ha&&a.load();0===a.ga&&(a.
|
109 |
-
t.
|
110 |
function Y(a){var c=a.split(":");a=0;var d,e,g;3==c.length?(d=c[0],e=c[1],c=c[2]):(d=0,e=c[0],c=c[1]);c=c.split(/\s+/);c=c.splice(0,1)[0];c=c.split(/\.|,/);g=parseFloat(c[1]);c=c[0];a+=3600*parseFloat(d);a+=60*parseFloat(e);a+=parseFloat(c);g&&(a+=g/1E3);return a}
|
111 |
-
t.update=function(){if(0<this
|
112 |
-
|
113 |
-
u.
|
114 |
-
u.
|
115 |
-
u.
|
116 |
-
u.
|
117 |
-
u.
|
118 |
-
t.
|
119 |
-
|
120 |
-
u.
|
|
|
121 |
if("undefined"!==typeof window.JSON&&"function"===window.JSON.parse)u.JSON=window.JSON;else{u.JSON={};var Z=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;u.JSON.parse=function(a,c){function d(a,e){var k,q,n=a[e];if(n&&"object"===typeof n)for(k in n)Object.prototype.hasOwnProperty.call(n,k)&&(q=d(n,k),q!==b?n[k]=q:delete n[k]);return c.call(a,e,n)}var e;a=String(a);Z.lastIndex=0;Z.test(a)&&(a=a.replace(Z,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));
|
122 |
if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof c?d({"":e},""):e;throw new SyntaxError("JSON.parse(): invalid or malformed JSON data");}}
|
123 |
-
u.
|
124 |
-
u.
|
125 |
-
u.
|
126 |
-
$("videojs.
|
127 |
-
$("videojs.PosterImage",u.
|
128 |
-
u.r.prototype.
|
129 |
-
u.f.canPlaySource=u.f.
|
|
1 |
+
/*! Video.js v4.4.3 Copyright 2014 Brightcove, Inc. https://github.com/videojs/video.js/blob/master/LICENSE */
|
2 |
+
(function() {var b=void 0,f=!0,h=null,l=!1;function m(){return function(){}}function p(a){return function(){return this[a]}}function r(a){return function(){return a}}var t;document.createElement("video");document.createElement("audio");document.createElement("track");function u(a,c,d){if("string"===typeof a){0===a.indexOf("#")&&(a=a.slice(1));if(u.va[a])return u.va[a];a=u.u(a)}if(!a||!a.nodeName)throw new TypeError("The element or ID supplied is not valid. (videojs)");return a.player||new u.Player(a,c,d)}
|
3 |
+
var videojs=u;window.Wd=window.Xd=u;u.Rb="4.4";u.Ec="https:"==document.location.protocol?"https://":"http://";u.options={techOrder:["html5","flash"],html5:{},flash:{},width:300,height:150,defaultVolume:0,children:{mediaLoader:{},posterImage:{},textTrackDisplay:{},loadingSpinner:{},bigPlayButton:{},controlBar:{}},notSupportedMessage:'Sorry, no compatible source and playback technology were found for this video. Try using another browser like <a href="http://bit.ly/ccMUEC">Chrome</a> or download the latest <a href="http://adobe.ly/mwfN1">Adobe Flash Player</a>.'};
|
4 |
+
"GENERATED_CDN_VSN"!==u.Rb&&(videojs.options.flash.swf=u.Ec+"vjs.zencdn.net/"+u.Rb+"/video-js.swf");u.va={};"function"===typeof define&&define.amd?define([],function(){return videojs}):"object"===typeof exports&&"object"===typeof module&&(module.exports=videojs);u.ka=u.CoreObject=m();
|
5 |
+
u.ka.extend=function(a){var c,d;a=a||{};c=a.init||a.h||this.prototype.init||this.prototype.h||m();d=function(){c.apply(this,arguments)};d.prototype=u.k.create(this.prototype);d.prototype.constructor=d;d.extend=u.ka.extend;d.create=u.ka.create;for(var e in a)a.hasOwnProperty(e)&&(d.prototype[e]=a[e]);return d};u.ka.create=function(){var a=u.k.create(this.prototype);this.apply(a,arguments);return a};
|
6 |
+
u.d=function(a,c,d){var e=u.getData(a);e.z||(e.z={});e.z[c]||(e.z[c]=[]);d.s||(d.s=u.s++);e.z[c].push(d);e.U||(e.disabled=l,e.U=function(c){if(!e.disabled){c=u.ic(c);var d=e.z[c.type];if(d)for(var d=d.slice(0),k=0,q=d.length;k<q&&!c.pc();k++)d[k].call(a,c)}});1==e.z[c].length&&(document.addEventListener?a.addEventListener(c,e.U,l):document.attachEvent&&a.attachEvent("on"+c,e.U))};
|
7 |
+
u.o=function(a,c,d){if(u.mc(a)){var e=u.getData(a);if(e.z)if(c){var g=e.z[c];if(g){if(d){if(d.s)for(e=0;e<g.length;e++)g[e].s===d.s&&g.splice(e--,1)}else e.z[c]=[];u.ec(a,c)}}else for(g in e.z)c=g,e.z[c]=[],u.ec(a,c)}};u.ec=function(a,c){var d=u.getData(a);0===d.z[c].length&&(delete d.z[c],document.removeEventListener?a.removeEventListener(c,d.U,l):document.detachEvent&&a.detachEvent("on"+c,d.U));u.Ab(d.z)&&(delete d.z,delete d.U,delete d.disabled);u.Ab(d)&&u.tc(a)};
|
8 |
+
u.ic=function(a){function c(){return f}function d(){return l}if(!a||!a.Bb){var e=a||window.event;a={};for(var g in e)"layerX"!==g&&("layerY"!==g&&"keyboardEvent.keyLocation"!==g)&&("returnValue"==g&&e.preventDefault||(a[g]=e[g]));a.target||(a.target=a.srcElement||document);a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;a.preventDefault=function(){e.preventDefault&&e.preventDefault();a.returnValue=l;a.zb=c};a.zb=d;a.stopPropagation=function(){e.stopPropagation&&e.stopPropagation();
|
9 |
+
a.cancelBubble=f;a.Bb=c};a.Bb=d;a.stopImmediatePropagation=function(){e.stopImmediatePropagation&&e.stopImmediatePropagation();a.pc=c;a.stopPropagation()};a.pc=d;if(a.clientX!=h){g=document.documentElement;var j=document.body;a.pageX=a.clientX+(g&&g.scrollLeft||j&&j.scrollLeft||0)-(g&&g.clientLeft||j&&j.clientLeft||0);a.pageY=a.clientY+(g&&g.scrollTop||j&&j.scrollTop||0)-(g&&g.clientTop||j&&j.clientTop||0)}a.which=a.charCode||a.keyCode;a.button!=h&&(a.button=a.button&1?0:a.button&4?1:a.button&2?2:
|
10 |
+
0)}return a};u.j=function(a,c){var d=u.mc(a)?u.getData(a):{},e=a.parentNode||a.ownerDocument;"string"===typeof c&&(c={type:c,target:a});c=u.ic(c);d.U&&d.U.call(a,c);if(e&&!c.Bb()&&c.bubbles!==l)u.j(e,c);else if(!e&&!c.zb()&&(d=u.getData(c.target),c.target[c.type])){d.disabled=f;if("function"===typeof c.target[c.type])c.target[c.type]();d.disabled=l}return!c.zb()};u.T=function(a,c,d){function e(){u.o(a,c,e);d.apply(this,arguments)}e.s=d.s=d.s||u.s++;u.d(a,c,e)};var v=Object.prototype.hasOwnProperty;
|
11 |
+
u.e=function(a,c){var d,e;d=document.createElement(a||"div");for(e in c)v.call(c,e)&&(-1!==e.indexOf("aria-")||"role"==e?d.setAttribute(e,c[e]):d[e]=c[e]);return d};u.Z=function(a){return a.charAt(0).toUpperCase()+a.slice(1)};u.k={};u.k.create=Object.create||function(a){function c(){}c.prototype=a;return new c};u.k.ra=function(a,c,d){for(var e in a)v.call(a,e)&&c.call(d||this,e,a[e])};u.k.B=function(a,c){if(!c)return a;for(var d in c)v.call(c,d)&&(a[d]=c[d]);return a};
|
12 |
+
u.k.Wc=function(a,c){var d,e,g;a=u.k.copy(a);for(d in c)v.call(c,d)&&(e=a[d],g=c[d],a[d]=u.k.Ma(e)&&u.k.Ma(g)?u.k.Wc(e,g):c[d]);return a};u.k.copy=function(a){return u.k.B({},a)};u.k.Ma=function(a){return!!a&&"object"===typeof a&&"[object Object]"===a.toString()&&a.constructor===Object};u.bind=function(a,c,d){function e(){return c.apply(a,arguments)}c.s||(c.s=u.s++);e.s=d?d+"_"+c.s:c.s;return e};u.pa={};u.s=1;u.expando="vdata"+(new Date).getTime();
|
13 |
+
u.getData=function(a){var c=a[u.expando];c||(c=a[u.expando]=u.s++,u.pa[c]={});return u.pa[c]};u.mc=function(a){a=a[u.expando];return!(!a||u.Ab(u.pa[a]))};u.tc=function(a){var c=a[u.expando];if(c){delete u.pa[c];try{delete a[u.expando]}catch(d){a.removeAttribute?a.removeAttribute(u.expando):a[u.expando]=h}}};u.Ab=function(a){for(var c in a)if(a[c]!==h)return l;return f};u.n=function(a,c){-1==(" "+a.className+" ").indexOf(" "+c+" ")&&(a.className=""===a.className?c:a.className+" "+c)};
|
14 |
+
u.t=function(a,c){var d,e;if(-1!=a.className.indexOf(c)){d=a.className.split(" ");for(e=d.length-1;0<=e;e--)d[e]===c&&d.splice(e,1);a.className=d.join(" ")}};u.W=u.e("video");u.I=navigator.userAgent;u.Kc=/iPhone/i.test(u.I);u.Jc=/iPad/i.test(u.I);u.Lc=/iPod/i.test(u.I);u.Ic=u.Kc||u.Jc||u.Lc;var aa=u,w;var x=u.I.match(/OS (\d+)_/i);w=x&&x[1]?x[1]:b;aa.Id=w;u.Hc=/Android/i.test(u.I);var ba=u,y;var z=u.I.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),A,B;
|
15 |
+
z?(A=z[1]&&parseFloat(z[1]),B=z[2]&&parseFloat(z[2]),y=A&&B?parseFloat(z[1]+"."+z[2]):A?A:h):y=h;ba.Fc=y;u.Mc=u.Hc&&/webkit/i.test(u.I)&&2.3>u.Fc;u.Ub=/Firefox/i.test(u.I);u.Jd=/Chrome/i.test(u.I);u.$b=!!("ontouchstart"in window||window.Gc&&document instanceof window.Gc);
|
16 |
+
u.wb=function(a){var c,d,e,g;c={};if(a&&a.attributes&&0<a.attributes.length){d=a.attributes;for(var j=d.length-1;0<=j;j--){e=d[j].name;g=d[j].value;if("boolean"===typeof a[e]||-1!==",autoplay,controls,loop,muted,default,".indexOf(","+e+","))g=g!==h?f:l;c[e]=g}}return c};
|
17 |
+
u.Nd=function(a,c){var d="";document.defaultView&&document.defaultView.getComputedStyle?d=document.defaultView.getComputedStyle(a,"").getPropertyValue(c):a.currentStyle&&(d=a["client"+c.substr(0,1).toUpperCase()+c.substr(1)]+"px");return d};u.yb=function(a,c){c.firstChild?c.insertBefore(a,c.firstChild):c.appendChild(a)};u.Ob={};u.u=function(a){0===a.indexOf("#")&&(a=a.slice(1));return document.getElementById(a)};
|
18 |
+
u.ta=function(a,c){c=c||a;var d=Math.floor(a%60),e=Math.floor(a/60%60),g=Math.floor(a/3600),j=Math.floor(c/60%60),k=Math.floor(c/3600);if(isNaN(a)||Infinity===a)g=e=d="-";g=0<g||0<k?g+":":"";return g+(((g||10<=j)&&10>e?"0"+e:e)+":")+(10>d?"0"+d:d)};u.Sc=function(){document.body.focus();document.onselectstart=r(l)};u.Dd=function(){document.onselectstart=r(f)};u.trim=function(a){return(a+"").replace(/^\s+|\s+$/g,"")};u.round=function(a,c){c||(c=0);return Math.round(a*Math.pow(10,c))/Math.pow(10,c)};
|
19 |
+
u.sb=function(a,c){return{length:1,start:function(){return a},end:function(){return c}}};
|
20 |
u.get=function(a,c,d){var e,g;"undefined"===typeof XMLHttpRequest&&(window.XMLHttpRequest=function(){try{return new window.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new window.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new window.ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw Error("This browser does not support XMLHttpRequest.");});g=new XMLHttpRequest;try{g.open("GET",a)}catch(j){d(j)}e=0===a.indexOf("file:")||0===window.location.href.indexOf("file:")&&-1===a.indexOf("http");
|
21 |
+
g.onreadystatechange=function(){4===g.readyState&&(200===g.status||e&&0===g.status?c(g.responseText):d&&d())};try{g.send()}catch(k){d&&d(k)}};u.vd=function(a){try{var c=window.localStorage||l;c&&(c.volume=a)}catch(d){22==d.code||1014==d.code?u.log("LocalStorage Full (VideoJS)",d):18==d.code?u.log("LocalStorage not allowed (VideoJS)",d):u.log("LocalStorage Error (VideoJS)",d)}};u.kc=function(a){a.match(/^https?:\/\//)||(a=u.e("div",{innerHTML:'<a href="'+a+'">x</a>'}).firstChild.href);return a};
|
22 |
+
u.log=function(){u.log.history=u.log.history||[];u.log.history.push(arguments);window.console&&window.console.log(Array.prototype.slice.call(arguments))};u.cd=function(a){var c,d;a.getBoundingClientRect&&a.parentNode&&(c=a.getBoundingClientRect());if(!c)return{left:0,top:0};a=document.documentElement;d=document.body;return{left:c.left+(window.pageXOffset||d.scrollLeft)-(a.clientLeft||d.clientLeft||0),top:c.top+(window.pageYOffset||d.scrollTop)-(a.clientTop||d.clientTop||0)}};u.ja={};
|
23 |
+
u.ja.Fb=function(a,c){var d,e,g;a=u.k.copy(a);for(d in c)c.hasOwnProperty(d)&&(e=a[d],g=c[d],a[d]=u.k.Ma(e)&&u.k.Ma(g)?u.ja.Fb(e,g):c[d]);return a};
|
24 |
+
u.b=u.ka.extend({h:function(a,c,d){this.c=a;this.g=u.k.copy(this.g);c=this.options(c);this.Q=c.id||(c.el&&c.el.id?c.el.id:a.id()+"_component_"+u.s++);this.kd=c.name||h;this.a=c.el||this.e();this.J=[];this.Ia={};this.Ja={};this.nc();this.H(d);if(c.uc!==l){var e,g;e=u.bind(this.C(),this.C().reportUserActivity);this.d("touchstart",function(){e();clearInterval(g);g=setInterval(e,250)});a=function(){e();clearInterval(g)};this.d("touchmove",e);this.d("touchend",a);this.d("touchcancel",a)}}});t=u.b.prototype;
|
25 |
+
t.dispose=function(){this.j({type:"dispose",bubbles:l});if(this.J)for(var a=this.J.length-1;0<=a;a--)this.J[a].dispose&&this.J[a].dispose();this.Ja=this.Ia=this.J=h;this.o();this.a.parentNode&&this.a.parentNode.removeChild(this.a);u.tc(this.a);this.a=h};t.c=f;t.C=p("c");t.options=function(a){return a===b?this.g:this.g=u.ja.Fb(this.g,a)};t.e=function(a,c){return u.e(a,c)};t.u=p("a");t.Ka=function(){return this.F||this.a};t.id=p("Q");t.name=p("kd");t.children=p("J");t.ed=function(a){return this.Ia[a]};
|
26 |
+
t.fa=function(a){return this.Ja[a]};t.Y=function(a,c){var d,e;"string"===typeof a?(e=a,c=c||{},d=c.componentClass||u.Z(e),c.name=e,d=new window.videojs[d](this.c||this,c)):d=a;this.J.push(d);"function"===typeof d.id&&(this.Ia[d.id()]=d);(e=e||d.name&&d.name())&&(this.Ja[e]=d);"function"===typeof d.el&&d.el()&&this.Ka().appendChild(d.el());return d};
|
27 |
+
t.removeChild=function(a){"string"===typeof a&&(a=this.fa(a));if(a&&this.J){for(var c=l,d=this.J.length-1;0<=d;d--)if(this.J[d]===a){c=f;this.J.splice(d,1);break}c&&(this.Ia[a.id]=h,this.Ja[a.name]=h,(c=a.u())&&c.parentNode===this.Ka()&&this.Ka().removeChild(a.u()))}};t.nc=function(){var a=this.g;if(a&&a.children){var c=this;u.k.ra(a.children,function(a,e){e!==l&&!e.loadEvent&&(c[a]=c.Y(a,e))})}};t.P=r("");t.d=function(a,c){u.d(this.a,a,u.bind(this,c));return this};
|
28 |
+
t.o=function(a,c){u.o(this.a,a,c);return this};t.T=function(a,c){u.T(this.a,a,u.bind(this,c));return this};t.j=function(a,c){u.j(this.a,a,c);return this};t.H=function(a){a&&(this.aa?a.call(this):(this.Ta===b&&(this.Ta=[]),this.Ta.push(a)));return this};t.Wa=function(){this.aa=f;var a=this.Ta;if(a&&0<a.length){for(var c=0,d=a.length;c<d;c++)a[c].call(this);this.Ta=[];this.j("ready")}};t.n=function(a){u.n(this.a,a);return this};t.t=function(a){u.t(this.a,a);return this};
|
29 |
+
t.show=function(){this.a.style.display="block";return this};t.D=function(){this.a.style.display="none";return this};function D(a){a.t("vjs-lock-showing")}t.disable=function(){this.D();this.show=m()};t.width=function(a,c){return E(this,"width",a,c)};t.height=function(a,c){return E(this,"height",a,c)};t.Yc=function(a,c){return this.width(a,f).height(c)};
|
30 |
+
function E(a,c,d,e){if(d!==b)return a.a.style[c]=-1!==(""+d).indexOf("%")||-1!==(""+d).indexOf("px")?d:"auto"===d?"":d+"px",e||a.j("resize"),a;if(!a.a)return 0;d=a.a.style[c];e=d.indexOf("px");return-1!==e?parseInt(d.slice(0,e),10):parseInt(a.a["offset"+u.Z(c)],10)}
|
31 |
+
u.q=u.b.extend({h:function(a,c){u.b.call(this,a,c);var d=l;this.d("touchstart",function(a){a.preventDefault();d=f});this.d("touchmove",function(){d=l});var e=this;this.d("touchend",function(a){d&&e.p(a);a.preventDefault()});this.d("click",this.p);this.d("focus",this.Pa);this.d("blur",this.Oa)}});t=u.q.prototype;
|
32 |
+
t.e=function(a,c){c=u.k.B({className:this.P(),innerHTML:'<div class="vjs-control-content"><span class="vjs-control-text">'+(this.oa||"Need Text")+"</span></div>",role:"button","aria-live":"polite",tabIndex:0},c);return u.b.prototype.e.call(this,a,c)};t.P=function(){return"vjs-control "+u.b.prototype.P.call(this)};t.p=m();t.Pa=function(){u.d(document,"keyup",u.bind(this,this.ba))};t.ba=function(a){if(32==a.which||13==a.which)a.preventDefault(),this.p()};
|
33 |
+
t.Oa=function(){u.o(document,"keyup",u.bind(this,this.ba))};u.N=u.b.extend({h:function(a,c){u.b.call(this,a,c);this.Rc=this.fa(this.g.barName);this.handle=this.fa(this.g.handleName);a.d(this.rc,u.bind(this,this.update));this.d("mousedown",this.Qa);this.d("touchstart",this.Qa);this.d("focus",this.Pa);this.d("blur",this.Oa);this.d("click",this.p);this.c.d("controlsvisible",u.bind(this,this.update));a.H(u.bind(this,this.update));this.O={}}});t=u.N.prototype;
|
34 |
+
t.e=function(a,c){c=c||{};c.className+=" vjs-slider";c=u.k.B({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},c);return u.b.prototype.e.call(this,a,c)};t.Qa=function(a){a.preventDefault();u.Sc();this.O.move=u.bind(this,this.Hb);this.O.end=u.bind(this,this.Ib);u.d(document,"mousemove",this.O.move);u.d(document,"mouseup",this.O.end);u.d(document,"touchmove",this.O.move);u.d(document,"touchend",this.O.end);this.Hb(a)};
|
35 |
+
t.Ib=function(){u.Dd();u.o(document,"mousemove",this.O.move,l);u.o(document,"mouseup",this.O.end,l);u.o(document,"touchmove",this.O.move,l);u.o(document,"touchend",this.O.end,l);this.update()};t.update=function(){if(this.a){var a,c=this.xb(),d=this.handle,e=this.Rc;isNaN(c)&&(c=0);a=c;if(d){a=this.a.offsetWidth;var g=d.u().offsetWidth;a=g?g/a:0;c*=1-a;a=c+a/2;d.u().style.left=u.round(100*c,2)+"%"}e.u().style.width=u.round(100*a,2)+"%"}};
|
36 |
+
function F(a,c){var d,e,g,j;d=a.a;e=u.cd(d);j=g=d.offsetWidth;d=a.handle;if(a.g.Ed)return j=e.top,e=c.changedTouches?c.changedTouches[0].pageY:c.pageY,d&&(d=d.u().offsetHeight,j+=d/2,g-=d),Math.max(0,Math.min(1,(j-e+g)/g));g=e.left;e=c.changedTouches?c.changedTouches[0].pageX:c.pageX;d&&(d=d.u().offsetWidth,g+=d/2,j-=d);return Math.max(0,Math.min(1,(e-g)/j))}t.Pa=function(){u.d(document,"keyup",u.bind(this,this.ba))};
|
37 |
+
t.ba=function(a){37==a.which?(a.preventDefault(),this.xc()):39==a.which&&(a.preventDefault(),this.yc())};t.Oa=function(){u.o(document,"keyup",u.bind(this,this.ba))};t.p=function(a){a.stopImmediatePropagation();a.preventDefault()};u.V=u.b.extend();u.V.prototype.defaultValue=0;u.V.prototype.e=function(a,c){c=c||{};c.className+=" vjs-slider-handle";c=u.k.B({innerHTML:'<span class="vjs-control-text">'+this.defaultValue+"</span>"},c);return u.b.prototype.e.call(this,"div",c)};u.la=u.b.extend();
|
38 |
+
function ca(a,c){a.Y(c);c.d("click",u.bind(a,function(){D(this)}))}u.la.prototype.e=function(){var a=this.options().Uc||"ul";this.F=u.e(a,{className:"vjs-menu-content"});a=u.b.prototype.e.call(this,"div",{append:this.F,className:"vjs-menu"});a.appendChild(this.F);u.d(a,"click",function(a){a.preventDefault();a.stopImmediatePropagation()});return a};u.M=u.q.extend({h:function(a,c){u.q.call(this,a,c);this.selected(c.selected)}});
|
39 |
+
u.M.prototype.e=function(a,c){return u.q.prototype.e.call(this,"li",u.k.B({className:"vjs-menu-item",innerHTML:this.g.label},c))};u.M.prototype.p=function(){this.selected(f)};u.M.prototype.selected=function(a){a?(this.n("vjs-selected"),this.a.setAttribute("aria-selected",f)):(this.t("vjs-selected"),this.a.setAttribute("aria-selected",l))};
|
40 |
+
u.R=u.q.extend({h:function(a,c){u.q.call(this,a,c);this.ua=this.La();this.Y(this.ua);this.K&&0===this.K.length&&this.D();this.d("keyup",this.ba);this.a.setAttribute("aria-haspopup",f);this.a.setAttribute("role","button")}});t=u.R.prototype;t.na=l;t.La=function(){var a=new u.la(this.c);this.options().title&&a.u().appendChild(u.e("li",{className:"vjs-menu-title",innerHTML:u.Z(this.A),Bd:-1}));if(this.K=this.createItems())for(var c=0;c<this.K.length;c++)ca(a,this.K[c]);return a};t.qa=m();
|
41 |
+
t.P=function(){return this.className+" vjs-menu-button "+u.q.prototype.P.call(this)};t.Pa=m();t.Oa=m();t.p=function(){this.T("mouseout",u.bind(this,function(){D(this.ua);this.a.blur()}));this.na?G(this):H(this)};t.ba=function(a){a.preventDefault();32==a.which||13==a.which?this.na?G(this):H(this):27==a.which&&this.na&&G(this)};function H(a){a.na=f;a.ua.n("vjs-lock-showing");a.a.setAttribute("aria-pressed",f);a.K&&0<a.K.length&&a.K[0].u().focus()}
|
42 |
+
function G(a){a.na=l;D(a.ua);a.a.setAttribute("aria-pressed",l)}
|
43 |
+
u.Player=u.b.extend({h:function(a,c,d){this.L=a;a.id=a.id||"vjs_video_"+u.s++;c=u.k.B(da(a),c);this.v={};this.sc=c.poster;this.rb=c.controls;a.controls=l;c.uc=l;u.b.call(this,this,c,d);this.controls()?this.n("vjs-controls-enabled"):this.n("vjs-controls-disabled");this.T("play",function(a){u.j(this.a,{type:"firstplay",target:this.a})||(a.preventDefault(),a.stopPropagation(),a.stopImmediatePropagation())});this.d("ended",this.ld);this.d("play",this.Kb);this.d("firstplay",this.md);this.d("pause",this.Jb);
|
44 |
+
this.d("progress",this.od);this.d("durationchange",this.qc);this.d("error",this.Gb);this.d("fullscreenchange",this.nd);u.va[this.Q]=this;c.plugins&&u.k.ra(c.plugins,function(a,c){this[a](c)},this);var e,g,j,k;e=u.bind(this,this.reportUserActivity);this.d("mousedown",function(){e();clearInterval(g);g=setInterval(e,250)});this.d("mousemove",e);this.d("mouseup",function(){e();clearInterval(g)});this.d("keydown",e);this.d("keyup",e);j=setInterval(u.bind(this,function(){this.ia&&(this.ia=l,this.userActive(f),
|
45 |
+
clearTimeout(k),k=setTimeout(u.bind(this,function(){this.ia||this.userActive(l)}),2E3))}),250);this.d("dispose",function(){clearInterval(j);clearTimeout(k)})}});t=u.Player.prototype;t.g=u.options;t.dispose=function(){this.j("dispose");this.o("dispose");u.va[this.Q]=h;this.L&&this.L.player&&(this.L.player=h);this.a&&this.a.player&&(this.a.player=h);clearInterval(this.Sa);this.wa();this.i&&this.i.dispose();u.b.prototype.dispose.call(this)};
|
46 |
+
function da(a){var c={sources:[],tracks:[]};u.k.B(c,u.wb(a));if(a.hasChildNodes()){var d,e,g,j;a=a.childNodes;g=0;for(j=a.length;g<j;g++)d=a[g],e=d.nodeName.toLowerCase(),"source"===e?c.sources.push(u.wb(d)):"track"===e&&c.tracks.push(u.wb(d))}return c}
|
47 |
+
t.e=function(){var a=this.a=u.b.prototype.e.call(this,"div"),c=this.L;c.removeAttribute("width");c.removeAttribute("height");if(c.hasChildNodes()){var d,e,g,j,k;d=c.childNodes;e=d.length;for(k=[];e--;)g=d[e],j=g.nodeName.toLowerCase(),"track"===j&&k.push(g);for(d=0;d<k.length;d++)c.removeChild(k[d])}a.id=c.id;a.className=c.className;c.id+="_html5_api";c.className="vjs-tech";c.player=a.player=this;this.n("vjs-paused");this.width(this.g.width,f);this.height(this.g.height,f);c.parentNode&&c.parentNode.insertBefore(a,
|
48 |
+
c);u.yb(c,a);return a};
|
49 |
+
function I(a,c,d){a.i&&(a.aa=l,a.i.dispose(),a.Db&&(a.Db=l,clearInterval(a.Sa)),a.Eb&&J(a),a.i=l);"Html5"!==c&&a.L&&(u.l.gc(a.L),a.L=h);a.xa=c;a.aa=l;var e=u.k.B({source:d,parentEl:a.a},a.g[c.toLowerCase()]);d&&(d.src==a.v.src&&0<a.v.currentTime&&(e.startTime=a.v.currentTime),a.v.src=d.src);a.i=new window.videojs[c](a,e);a.i.H(function(){this.c.Wa();if(!this.m.progressEvents){var a=this.c;a.Db=f;a.Sa=setInterval(u.bind(a,function(){this.v.mb<this.buffered().end(0)?this.j("progress"):1==this.bufferedPercent()&&
|
50 |
+
(clearInterval(this.Sa),this.j("progress"))}),500);a.i.T("progress",function(){this.m.progressEvents=f;var a=this.c;a.Db=l;clearInterval(a.Sa)})}this.m.timeupdateEvents||(a=this.c,a.Eb=f,a.d("play",a.Bc),a.d("pause",a.wa),a.i.T("timeupdate",function(){this.m.timeupdateEvents=f;J(this.c)}))})}function J(a){a.Eb=l;a.wa();a.o("play",a.Bc);a.o("pause",a.wa)}t.Bc=function(){this.fc&&this.wa();this.fc=setInterval(u.bind(this,function(){this.j("timeupdate")}),250)};t.wa=function(){clearInterval(this.fc)};
|
51 |
+
t.Kb=function(){u.t(this.a,"vjs-paused");u.n(this.a,"vjs-playing")};t.md=function(){this.g.starttime&&this.currentTime(this.g.starttime);this.n("vjs-has-started")};t.Jb=function(){u.t(this.a,"vjs-playing");u.n(this.a,"vjs-paused")};t.od=function(){1==this.bufferedPercent()&&this.j("loadedalldata")};t.ld=function(){this.g.loop&&(this.currentTime(0),this.play())};t.qc=function(){var a=K(this,"duration");a&&this.duration(a)};t.nd=function(){this.isFullScreen()?this.n("vjs-fullscreen"):this.t("vjs-fullscreen")};
|
52 |
+
t.Gb=function(a){u.log("Video Error",a)};function L(a,c,d){if(a.i&&!a.i.aa)a.i.H(function(){this[c](d)});else try{a.i[c](d)}catch(e){throw u.log(e),e;}}function K(a,c){if(a.i&&a.i.aa)try{return a.i[c]()}catch(d){throw a.i[c]===b?u.log("Video.js: "+c+" method not defined for "+a.xa+" playback technology.",d):"TypeError"==d.name?(u.log("Video.js: "+c+" unavailable on "+a.xa+" playback technology element.",d),a.i.aa=l):u.log(d),d;}}t.play=function(){L(this,"play");return this};
|
53 |
+
t.pause=function(){L(this,"pause");return this};t.paused=function(){return K(this,"paused")===l?l:f};t.currentTime=function(a){return a!==b?(L(this,"setCurrentTime",a),this.Eb&&this.j("timeupdate"),this):this.v.currentTime=K(this,"currentTime")||0};t.duration=function(a){if(a!==b)return this.v.duration=parseFloat(a),this;this.v.duration===b&&this.qc();return this.v.duration||0};
|
54 |
+
t.buffered=function(){var a=K(this,"buffered"),c=a.length-1,d=this.v.mb=this.v.mb||0;a&&(0<=c&&a.end(c)!==d)&&(d=a.end(c),this.v.mb=d);return u.sb(0,d)};t.bufferedPercent=function(){return this.duration()?this.buffered().end(0)/this.duration():0};t.volume=function(a){if(a!==b)return a=Math.max(0,Math.min(1,parseFloat(a))),this.v.volume=a,L(this,"setVolume",a),u.vd(a),this;a=parseFloat(K(this,"volume"));return isNaN(a)?1:a};
|
55 |
+
t.muted=function(a){return a!==b?(L(this,"setMuted",a),this):K(this,"muted")||l};t.Va=function(){return K(this,"supportsFullScreen")||l};t.oc=l;t.isFullScreen=function(a){return a!==b?(this.oc=a,this):this.oc};
|
56 |
+
t.requestFullScreen=function(){var a=u.Ob.requestFullScreen;this.isFullScreen(f);a?(u.d(document,a.ub,u.bind(this,function(c){this.isFullScreen(document[a.isFullScreen]);this.isFullScreen()===l&&u.o(document,a.ub,arguments.callee);this.j("fullscreenchange")})),this.a[a.vc]()):this.i.Va()?L(this,"enterFullScreen"):(this.fd=f,this.Zc=document.documentElement.style.overflow,u.d(document,"keydown",u.bind(this,this.jc)),document.documentElement.style.overflow="hidden",u.n(document.body,"vjs-full-window"),
|
57 |
+
this.j("enterFullWindow"),this.j("fullscreenchange"));return this};t.cancelFullScreen=function(){var a=u.Ob.requestFullScreen;this.isFullScreen(l);if(a)document[a.ob]();else this.i.Va()?L(this,"exitFullScreen"):(M(this),this.j("fullscreenchange"));return this};t.jc=function(a){27===a.keyCode&&(this.isFullScreen()===f?this.cancelFullScreen():M(this))};
|
58 |
+
function M(a){a.fd=l;u.o(document,"keydown",a.jc);document.documentElement.style.overflow=a.Zc;u.t(document.body,"vjs-full-window");a.j("exitFullWindow")}
|
59 |
+
t.src=function(a){if(a instanceof Array){var c;a:{c=a;for(var d=0,e=this.g.techOrder;d<e.length;d++){var g=u.Z(e[d]),j=window.videojs[g];if(j.isSupported())for(var k=0,q=c;k<q.length;k++){var n=q[k];if(j.canPlaySource(n)){c={source:n,i:g};break a}}}c=l}c?(a=c.source,c=c.i,c==this.xa?this.src(a):I(this,c,a)):this.a.appendChild(u.e("p",{innerHTML:this.options().notSupportedMessage}))}else a instanceof Object?window.videojs[this.xa].canPlaySource(a)?this.src(a.src):this.src([a]):(this.v.src=a,this.aa?
|
60 |
+
(L(this,"src",a),"auto"==this.g.preload&&this.load(),this.g.autoplay&&this.play()):this.H(function(){this.src(a)}));return this};t.load=function(){L(this,"load");return this};t.currentSrc=function(){return K(this,"currentSrc")||this.v.src||""};t.Ra=function(a){return a!==b?(L(this,"setPreload",a),this.g.preload=a,this):K(this,"preload")};t.autoplay=function(a){return a!==b?(L(this,"setAutoplay",a),this.g.autoplay=a,this):K(this,"autoplay")};
|
61 |
+
t.loop=function(a){return a!==b?(L(this,"setLoop",a),this.g.loop=a,this):K(this,"loop")};t.poster=function(a){if(a===b)return this.sc;this.sc=a;L(this,"setPoster",a);this.j("posterchange")};t.controls=function(a){return a!==b?(a=!!a,this.rb!==a&&((this.rb=a)?(this.t("vjs-controls-disabled"),this.n("vjs-controls-enabled"),this.j("controlsenabled")):(this.t("vjs-controls-enabled"),this.n("vjs-controls-disabled"),this.j("controlsdisabled"))),this):this.rb};u.Player.prototype.Qb;t=u.Player.prototype;
|
62 |
+
t.usingNativeControls=function(a){return a!==b?(a=!!a,this.Qb!==a&&((this.Qb=a)?(this.n("vjs-using-native-controls"),this.j("usingnativecontrols")):(this.t("vjs-using-native-controls"),this.j("usingcustomcontrols"))),this):this.Qb};t.error=function(){return K(this,"error")};t.ended=function(){return K(this,"ended")};t.seeking=function(){return K(this,"seeking")};t.ia=f;t.reportUserActivity=function(){this.ia=f};t.Pb=f;
|
63 |
+
t.userActive=function(a){return a!==b?(a=!!a,a!==this.Pb&&((this.Pb=a)?(this.ia=f,this.t("vjs-user-inactive"),this.n("vjs-user-active"),this.j("useractive")):(this.ia=l,this.i.T("mousemove",function(a){a.stopPropagation();a.preventDefault()}),this.t("vjs-user-active"),this.n("vjs-user-inactive"),this.j("userinactive"))),this):this.Pb};var N,O,P;P=document.createElement("div");O={};
|
64 |
+
P.Kd!==b?(O.vc="requestFullscreen",O.ob="exitFullscreen",O.ub="fullscreenchange",O.isFullScreen="fullScreen"):(document.mozCancelFullScreen?(N="moz",O.isFullScreen=N+"FullScreen"):(N="webkit",O.isFullScreen=N+"IsFullScreen"),P[N+"RequestFullScreen"]&&(O.vc=N+"RequestFullScreen",O.ob=N+"CancelFullScreen"),O.ub=N+"fullscreenchange");document[O.ob]&&(u.Ob.requestFullScreen=O);u.Ca=u.b.extend();
|
65 |
+
u.Ca.prototype.g={Pd:"play",children:{playToggle:{},currentTimeDisplay:{},timeDivider:{},durationDisplay:{},remainingTimeDisplay:{},progressControl:{},fullscreenToggle:{},volumeControl:{},muteToggle:{}}};u.Ca.prototype.e=function(){return u.e("div",{className:"vjs-control-bar"})};u.Xb=u.q.extend({h:function(a,c){u.q.call(this,a,c);a.d("play",u.bind(this,this.Kb));a.d("pause",u.bind(this,this.Jb))}});t=u.Xb.prototype;t.oa="Play";t.P=function(){return"vjs-play-control "+u.q.prototype.P.call(this)};
|
66 |
+
t.p=function(){this.c.paused()?this.c.play():this.c.pause()};t.Kb=function(){u.t(this.a,"vjs-paused");u.n(this.a,"vjs-playing");this.a.children[0].children[0].innerHTML="Pause"};t.Jb=function(){u.t(this.a,"vjs-playing");u.n(this.a,"vjs-paused");this.a.children[0].children[0].innerHTML="Play"};u.$a=u.b.extend({h:function(a,c){u.b.call(this,a,c);a.d("timeupdate",u.bind(this,this.da))}});
|
67 |
+
u.$a.prototype.e=function(){var a=u.b.prototype.e.call(this,"div",{className:"vjs-current-time vjs-time-controls vjs-control"});this.F=u.e("div",{className:"vjs-current-time-display",innerHTML:'<span class="vjs-control-text">Current Time </span>0:00',"aria-live":"off"});a.appendChild(this.F);return a};u.$a.prototype.da=function(){var a=this.c.Ua?this.c.v.currentTime:this.c.currentTime();this.F.innerHTML='<span class="vjs-control-text">Current Time </span>'+u.ta(a,this.c.duration())};
|
68 |
+
u.ab=u.b.extend({h:function(a,c){u.b.call(this,a,c);a.d("timeupdate",u.bind(this,this.da))}});u.ab.prototype.e=function(){var a=u.b.prototype.e.call(this,"div",{className:"vjs-duration vjs-time-controls vjs-control"});this.F=u.e("div",{className:"vjs-duration-display",innerHTML:'<span class="vjs-control-text">Duration Time </span>0:00',"aria-live":"off"});a.appendChild(this.F);return a};
|
69 |
+
u.ab.prototype.da=function(){var a=this.c.duration();a&&(this.F.innerHTML='<span class="vjs-control-text">Duration Time </span>'+u.ta(a))};u.bc=u.b.extend({h:function(a,c){u.b.call(this,a,c)}});u.bc.prototype.e=function(){return u.b.prototype.e.call(this,"div",{className:"vjs-time-divider",innerHTML:"<div><span>/</span></div>"})};u.gb=u.b.extend({h:function(a,c){u.b.call(this,a,c);a.d("timeupdate",u.bind(this,this.da))}});
|
70 |
+
u.gb.prototype.e=function(){var a=u.b.prototype.e.call(this,"div",{className:"vjs-remaining-time vjs-time-controls vjs-control"});this.F=u.e("div",{className:"vjs-remaining-time-display",innerHTML:'<span class="vjs-control-text">Remaining Time </span>-0:00',"aria-live":"off"});a.appendChild(this.F);return a};u.gb.prototype.da=function(){this.c.duration()&&(this.F.innerHTML='<span class="vjs-control-text">Remaining Time </span>-'+u.ta(this.c.duration()-this.c.currentTime()))};
|
71 |
+
u.Da=u.q.extend({h:function(a,c){u.q.call(this,a,c)}});u.Da.prototype.oa="Fullscreen";u.Da.prototype.P=function(){return"vjs-fullscreen-control "+u.q.prototype.P.call(this)};u.Da.prototype.p=function(){this.c.isFullScreen()?(this.c.cancelFullScreen(),this.a.children[0].children[0].innerHTML="Fullscreen"):(this.c.requestFullScreen(),this.a.children[0].children[0].innerHTML="Non-Fullscreen")};u.fb=u.b.extend({h:function(a,c){u.b.call(this,a,c)}});u.fb.prototype.g={children:{seekBar:{}}};
|
72 |
+
u.fb.prototype.e=function(){return u.b.prototype.e.call(this,"div",{className:"vjs-progress-control vjs-control"})};u.Yb=u.N.extend({h:function(a,c){u.N.call(this,a,c);a.d("timeupdate",u.bind(this,this.za));a.H(u.bind(this,this.za))}});t=u.Yb.prototype;t.g={children:{loadProgressBar:{},playProgressBar:{},seekHandle:{}},barName:"playProgressBar",handleName:"seekHandle"};t.rc="timeupdate";t.e=function(){return u.N.prototype.e.call(this,"div",{className:"vjs-progress-holder","aria-label":"video progress bar"})};
|
73 |
+
t.za=function(){var a=this.c.Ua?this.c.v.currentTime:this.c.currentTime();this.a.setAttribute("aria-valuenow",u.round(100*this.xb(),2));this.a.setAttribute("aria-valuetext",u.ta(a,this.c.duration()))};t.xb=function(){return this.c.currentTime()/this.c.duration()};t.Qa=function(a){u.N.prototype.Qa.call(this,a);this.c.Ua=f;this.Fd=!this.c.paused();this.c.pause()};t.Hb=function(a){a=F(this,a)*this.c.duration();a==this.c.duration()&&(a-=0.1);this.c.currentTime(a)};
|
74 |
+
t.Ib=function(a){u.N.prototype.Ib.call(this,a);this.c.Ua=l;this.Fd&&this.c.play()};t.yc=function(){this.c.currentTime(this.c.currentTime()+5)};t.xc=function(){this.c.currentTime(this.c.currentTime()-5)};u.cb=u.b.extend({h:function(a,c){u.b.call(this,a,c);a.d("progress",u.bind(this,this.update))}});u.cb.prototype.e=function(){return u.b.prototype.e.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text">Loaded: 0%</span>'})};
|
75 |
+
u.cb.prototype.update=function(){this.a.style&&(this.a.style.width=u.round(100*this.c.bufferedPercent(),2)+"%")};u.Wb=u.b.extend({h:function(a,c){u.b.call(this,a,c)}});u.Wb.prototype.e=function(){return u.b.prototype.e.call(this,"div",{className:"vjs-play-progress",innerHTML:'<span class="vjs-control-text">Progress: 0%</span>'})};u.Fa=u.V.extend({h:function(a,c){u.V.call(this,a,c);a.d("timeupdate",u.bind(this,this.da))}});u.Fa.prototype.defaultValue="00:00";
|
76 |
+
u.Fa.prototype.e=function(){return u.V.prototype.e.call(this,"div",{className:"vjs-seek-handle","aria-live":"off"})};u.Fa.prototype.da=function(){var a=this.c.Ua?this.c.v.currentTime:this.c.currentTime();this.a.innerHTML='<span class="vjs-control-text">'+u.ta(a,this.c.duration())+"</span>"};u.ib=u.b.extend({h:function(a,c){u.b.call(this,a,c);a.i&&(a.i.m&&a.i.m.volumeControl===l)&&this.n("vjs-hidden");a.d("loadstart",u.bind(this,function(){a.i.m&&a.i.m.volumeControl===l?this.n("vjs-hidden"):this.t("vjs-hidden")}))}});
|
77 |
+
u.ib.prototype.g={children:{volumeBar:{}}};u.ib.prototype.e=function(){return u.b.prototype.e.call(this,"div",{className:"vjs-volume-control vjs-control"})};u.hb=u.N.extend({h:function(a,c){u.N.call(this,a,c);a.d("volumechange",u.bind(this,this.za));a.H(u.bind(this,this.za));setTimeout(u.bind(this,this.update),0)}});t=u.hb.prototype;t.za=function(){this.a.setAttribute("aria-valuenow",u.round(100*this.c.volume(),2));this.a.setAttribute("aria-valuetext",u.round(100*this.c.volume(),2)+"%")};
|
78 |
+
t.g={children:{volumeLevel:{},volumeHandle:{}},barName:"volumeLevel",handleName:"volumeHandle"};t.rc="volumechange";t.e=function(){return u.N.prototype.e.call(this,"div",{className:"vjs-volume-bar","aria-label":"volume level"})};t.Hb=function(a){this.c.muted()&&this.c.muted(l);this.c.volume(F(this,a))};t.xb=function(){return this.c.muted()?0:this.c.volume()};t.yc=function(){this.c.volume(this.c.volume()+0.1)};t.xc=function(){this.c.volume(this.c.volume()-0.1)};
|
79 |
+
u.cc=u.b.extend({h:function(a,c){u.b.call(this,a,c)}});u.cc.prototype.e=function(){return u.b.prototype.e.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})};u.jb=u.V.extend();u.jb.prototype.defaultValue="00:00";u.jb.prototype.e=function(){return u.V.prototype.e.call(this,"div",{className:"vjs-volume-handle"})};
|
80 |
+
u.ea=u.q.extend({h:function(a,c){u.q.call(this,a,c);a.d("volumechange",u.bind(this,this.update));a.i&&(a.i.m&&a.i.m.volumeControl===l)&&this.n("vjs-hidden");a.d("loadstart",u.bind(this,function(){a.i.m&&a.i.m.volumeControl===l?this.n("vjs-hidden"):this.t("vjs-hidden")}))}});u.ea.prototype.e=function(){return u.q.prototype.e.call(this,"div",{className:"vjs-mute-control vjs-control",innerHTML:'<div><span class="vjs-control-text">Mute</span></div>'})};
|
81 |
+
u.ea.prototype.p=function(){this.c.muted(this.c.muted()?l:f)};u.ea.prototype.update=function(){var a=this.c.volume(),c=3;0===a||this.c.muted()?c=0:0.33>a?c=1:0.67>a&&(c=2);this.c.muted()?"Unmute"!=this.a.children[0].children[0].innerHTML&&(this.a.children[0].children[0].innerHTML="Unmute"):"Mute"!=this.a.children[0].children[0].innerHTML&&(this.a.children[0].children[0].innerHTML="Mute");for(a=0;4>a;a++)u.t(this.a,"vjs-vol-"+a);u.n(this.a,"vjs-vol-"+c)};
|
82 |
+
u.ma=u.R.extend({h:function(a,c){u.R.call(this,a,c);a.d("volumechange",u.bind(this,this.update));a.i&&(a.i.m&&a.i.m.Cc===l)&&this.n("vjs-hidden");a.d("loadstart",u.bind(this,function(){a.i.m&&a.i.m.Cc===l?this.n("vjs-hidden"):this.t("vjs-hidden")}));this.n("vjs-menu-button")}});u.ma.prototype.La=function(){var a=new u.la(this.c,{Uc:"div"}),c=new u.hb(this.c,u.k.B({Ed:f},this.g.Yd));a.Y(c);return a};u.ma.prototype.p=function(){u.ea.prototype.p.call(this);u.R.prototype.p.call(this)};
|
83 |
+
u.ma.prototype.e=function(){return u.q.prototype.e.call(this,"div",{className:"vjs-volume-menu-button vjs-menu-button vjs-control",innerHTML:'<div><span class="vjs-control-text">Mute</span></div>'})};u.ma.prototype.update=u.ea.prototype.update;u.Ea=u.q.extend({h:function(a,c){u.q.call(this,a,c);a.poster()&&this.src(a.poster());(!a.poster()||!a.controls())&&this.D();a.d("posterchange",u.bind(this,function(){this.src(a.poster())}));a.d("play",u.bind(this,this.D))}});var Q="backgroundSize"in u.W.style;
|
84 |
+
u.Ea.prototype.e=function(){var a=u.e("div",{className:"vjs-poster",tabIndex:-1});Q||a.appendChild(u.e("img"));return a};u.Ea.prototype.src=function(a){var c=this.u();a!==b&&(Q?c.style.backgroundImage='url("'+a+'")':c.firstChild.src=a)};u.Ea.prototype.p=function(){this.C().controls()&&this.c.play()};
|
85 |
+
u.Vb=u.b.extend({h:function(a,c){u.b.call(this,a,c);a.d("canplay",u.bind(this,this.D));a.d("canplaythrough",u.bind(this,this.D));a.d("playing",u.bind(this,this.D));a.d("seeked",u.bind(this,this.D));a.d("seeking",u.bind(this,this.show));a.d("seeked",u.bind(this,this.D));a.d("error",u.bind(this,this.show));a.d("waiting",u.bind(this,this.show))}});u.Vb.prototype.e=function(){return u.b.prototype.e.call(this,"div",{className:"vjs-loading-spinner"})};u.Ya=u.q.extend();
|
86 |
+
u.Ya.prototype.e=function(){return u.q.prototype.e.call(this,"div",{className:"vjs-big-play-button",innerHTML:'<span aria-hidden="true"></span>',"aria-label":"play video"})};u.Ya.prototype.p=function(){this.c.play()};
|
87 |
+
u.r=u.b.extend({h:function(a,c,d){c=c||{};c.uc=l;u.b.call(this,a,c,d);var e,g;g=this;e=this.C();a=function(){if(e.controls()&&!e.usingNativeControls()){var a;g.d("mousedown",g.p);g.d("touchstart",function(c){c.preventDefault();a=this.c.userActive()});g.d("touchmove",function(){a&&this.C().reportUserActivity()});var c,d,n,s;c=0;g.d("touchstart",function(){c=(new Date).getTime();n=f});s=function(){n=l};g.d("touchmove",s);g.d("touchleave",s);g.d("touchcancel",s);g.d("touchend",function(){n===f&&(d=(new Date).getTime()-
|
88 |
+
c,250>d&&this.j("tap"))});g.d("tap",g.pd)}};c=u.bind(g,g.sd);this.H(a);e.d("controlsenabled",a);e.d("controlsdisabled",c)}});t=u.r.prototype;t.sd=function(){this.o("tap");this.o("touchstart");this.o("touchmove");this.o("touchleave");this.o("touchcancel");this.o("touchend");this.o("click");this.o("mousedown")};t.p=function(a){0===a.button&&this.C().controls()&&(this.C().paused()?this.C().play():this.C().pause())};t.pd=function(){this.C().userActive(!this.C().userActive())};t.Mb=m();
|
89 |
+
t.m={volumeControl:f,fullscreenResize:l,progressEvents:l,timeupdateEvents:l};u.media={};u.media.Xa="play pause paused currentTime setCurrentTime duration buffered volume setVolume muted setMuted width height supportsFullScreen enterFullScreen src load currentSrc preload setPreload autoplay setAutoplay loop setLoop error networkState readyState seeking initialTime startOffsetTime played seekable ended videoTracks audioTracks videoWidth videoHeight textTracks defaultPlaybackRate playbackRate mediaGroup controller controls defaultMuted".split(" ");
|
90 |
+
function ea(){var a=u.media.Xa[i];return function(){throw Error('The "'+a+"\" method is not available on the playback technology's API");}}for(var i=u.media.Xa.length-1;0<=i;i--)u.r.prototype[u.media.Xa[i]]=ea();
|
91 |
+
u.l=u.r.extend({h:function(a,c,d){this.m.volumeControl=u.l.Tc();this.m.movingMediaElementInDOM=!u.Ic;this.m.fullscreenResize=f;u.r.call(this,a,c,d);for(d=u.l.bb.length-1;0<=d;d--)u.d(this.a,u.l.bb[d],u.bind(this.c,this.ad));(c=c.source)&&this.a.currentSrc===c.src&&0<this.a.networkState?a.j("loadstart"):c&&(this.a.src=c.src);if(u.$b&&a.options().nativeControlsForTouch!==l){var e,g,j,k;e=this;g=this.C();c=g.controls();e.a.controls=!!c;j=function(){e.a.controls=f};k=function(){e.a.controls=l};g.d("controlsenabled",
|
92 |
+
j);g.d("controlsdisabled",k);c=function(){g.o("controlsenabled",j);g.o("controlsdisabled",k)};e.d("dispose",c);g.d("usingcustomcontrols",c);g.usingNativeControls(f)}a.H(function(){this.L&&(this.g.autoplay&&this.paused())&&(delete this.L.poster,this.play())});this.Wa()}});t=u.l.prototype;t.dispose=function(){u.r.prototype.dispose.call(this)};
|
93 |
+
t.e=function(){var a=this.c,c=a.L,d;if(!c||this.m.movingMediaElementInDOM===l)c?(d=c.cloneNode(l),u.l.gc(c),c=d,a.L=h):c=u.e("video",{id:a.id()+"_html5_api",className:"vjs-tech"}),c.player=a,u.yb(c,a.u());d=["autoplay","preload","loop","muted"];for(var e=d.length-1;0<=e;e--){var g=d[e];a.g[g]!==h&&(c[g]=a.g[g])}return c};t.ad=function(a){this.j(a);a.stopPropagation()};t.play=function(){this.a.play()};t.pause=function(){this.a.pause()};t.paused=function(){return this.a.paused};t.currentTime=function(){return this.a.currentTime};
|
94 |
+
t.ud=function(a){try{this.a.currentTime=a}catch(c){u.log(c,"Video is not ready. (Video.js)")}};t.duration=function(){return this.a.duration||0};t.buffered=function(){return this.a.buffered};t.volume=function(){return this.a.volume};t.zd=function(a){this.a.volume=a};t.muted=function(){return this.a.muted};t.xd=function(a){this.a.muted=a};t.width=function(){return this.a.offsetWidth};t.height=function(){return this.a.offsetHeight};
|
95 |
+
t.Va=function(){return"function"==typeof this.a.webkitEnterFullScreen&&(/Android/.test(u.I)||!/Chrome|Mac OS X 10.5/.test(u.I))?f:l};t.hc=function(){var a=this.a;a.paused&&a.networkState<=a.Hd?(this.a.play(),setTimeout(function(){a.pause();a.webkitEnterFullScreen()},0)):a.webkitEnterFullScreen()};t.bd=function(){this.a.webkitExitFullScreen()};t.src=function(a){this.a.src=a};t.load=function(){this.a.load()};t.currentSrc=function(){return this.a.currentSrc};t.poster=function(){return this.a.poster};
|
96 |
+
t.Mb=function(a){this.a.poster=a};t.Ra=function(){return this.a.Ra};t.yd=function(a){this.a.Ra=a};t.autoplay=function(){return this.a.autoplay};t.td=function(a){this.a.autoplay=a};t.controls=function(){return this.a.controls};t.loop=function(){return this.a.loop};t.wd=function(a){this.a.loop=a};t.error=function(){return this.a.error};t.seeking=function(){return this.a.seeking};t.ended=function(){return this.a.ended};u.l.isSupported=function(){try{u.W.volume=0.5}catch(a){return l}return!!u.W.canPlayType};
|
97 |
+
u.l.nb=function(a){try{return!!u.W.canPlayType(a.type)}catch(c){return""}};u.l.Tc=function(){var a=u.W.volume;u.W.volume=a/2+0.1;return a!==u.W.volume};u.l.bb="loadstart suspend abort error emptied stalled loadedmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate progress play pause ratechange volumechange".split(" ");
|
98 |
+
u.l.gc=function(a){if(a){a.player=h;for(a.parentNode&&a.parentNode.removeChild(a);a.hasChildNodes();)a.removeChild(a.firstChild);a.removeAttribute("src");if("function"===typeof a.load)try{a.load()}catch(c){}}};u.Mc&&(document.createElement("video").constructor.prototype.canPlayType=function(a){return a&&-1!=a.toLowerCase().indexOf("video/mp4")?"maybe":""});
|
99 |
+
u.f=u.r.extend({h:function(a,c,d){u.r.call(this,a,c,d);var e=c.source;d=c.parentEl;var g=this.a=u.e("div",{id:a.id()+"_temp_flash"}),j=a.id()+"_flash_api";a=a.g;var k=u.k.B({readyFunction:"videojs.Flash.onReady",eventProxyFunction:"videojs.Flash.onEvent",errorEventProxyFunction:"videojs.Flash.onError",autoplay:a.autoplay,preload:a.Ra,loop:a.loop,muted:a.muted},c.flashVars),q=u.k.B({wmode:"opaque",bgcolor:"#000000"},c.params),n=u.k.B({id:j,name:j,"class":"vjs-tech"},c.attributes),s;e&&(e.type&&u.f.hd(e.type)?
|
100 |
+
(a=u.f.zc(e.src),k.rtmpConnection=encodeURIComponent(a.qb),k.rtmpStream=encodeURIComponent(a.Nb)):k.src=encodeURIComponent(u.kc(e.src)));this.setCurrentTime=function(a){s=a;this.a.vjs_setProperty("currentTime",a)};this.currentTime=function(){return this.seeking()?s:this.a.vjs_getProperty("currentTime")};u.yb(g,d);c.startTime&&this.H(function(){this.load();this.play();this.currentTime(c.startTime)});u.Ub&&this.H(function(){u.d(this.u(),"mousemove",u.bind(this,function(){this.C().j({type:"mousemove",
|
101 |
+
bubbles:l})}))});if(c.iFrameMode===f&&!u.Ub){var C=u.e("iframe",{id:j+"_iframe",name:j+"_iframe",className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0});k.readyFunction="ready";k.eventProxyFunction="events";k.errorEventProxyFunction="errors";u.d(C,"load",u.bind(this,function(){var a,d=C.contentWindow;a=C.contentDocument?C.contentDocument:C.contentWindow.document;a.write(u.f.lc(c.swf,k,q,n));d.player=this.c;d.ready=u.bind(this.c,function(c){var d=this.i;d.a=a.getElementById(c);
|
102 |
+
u.f.pb(d)});d.events=u.bind(this.c,function(a,c){this&&"flash"===this.xa&&this.j(c)});d.errors=u.bind(this.c,function(a,c){u.log("Flash Error",c)})}));g.parentNode.replaceChild(C,g)}else u.f.$c(c.swf,g,k,q,n)}});t=u.f.prototype;t.dispose=function(){u.r.prototype.dispose.call(this)};t.play=function(){this.a.vjs_play()};t.pause=function(){this.a.vjs_pause()};
|
103 |
+
t.src=function(a){u.f.gd(a)?(a=u.f.zc(a),this.Td(a.qb),this.Ud(a.Nb)):(a=u.kc(a),this.a.vjs_src(a));if(this.c.autoplay()){var c=this;setTimeout(function(){c.play()},0)}};t.currentSrc=function(){var a=this.a.vjs_getProperty("currentSrc");if(a==h){var c=this.Rd(),d=this.Sd();c&&d&&(a=u.f.Ad(c,d))}return a};t.load=function(){this.a.vjs_load()};t.poster=function(){this.a.vjs_getProperty("poster")};t.Mb=m();t.buffered=function(){return u.sb(0,this.a.vjs_getProperty("buffered"))};t.Va=r(l);t.hc=r(l);
|
104 |
+
var R=u.f.prototype,S="rtmpConnection rtmpStream preload defaultPlaybackRate playbackRate autoplay loop mediaGroup controller controls volume muted defaultMuted".split(" "),T="error currentSrc networkState readyState seeking initialTime duration startOffsetTime paused played seekable ended videoTracks audioTracks videoWidth videoHeight textTracks".split(" ");function fa(){var a=S[U],c=a.charAt(0).toUpperCase()+a.slice(1);R["set"+c]=function(c){return this.a.vjs_setProperty(a,c)}}
|
105 |
+
function V(a){R[a]=function(){return this.a.vjs_getProperty(a)}}var U;for(U=0;U<S.length;U++)V(S[U]),fa();for(U=0;U<T.length;U++)V(T[U]);u.f.isSupported=function(){return 10<=u.f.version()[0]};u.f.nb=function(a){if(!a.type)return"";a=a.type.replace(/;.*/,"").toLowerCase();if(a in u.f.dd||a in u.f.Ac)return"maybe"};u.f.dd={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"};u.f.Ac={"rtmp/mp4":"MP4","rtmp/flv":"FLV"};
|
106 |
+
u.f.onReady=function(a){a=u.u(a);var c=a.player||a.parentNode.player,d=c.i;a.player=c;d.a=a;u.f.pb(d)};u.f.pb=function(a){a.u().vjs_getProperty?a.Wa():setTimeout(function(){u.f.pb(a)},50)};u.f.onEvent=function(a,c){u.u(a).player.j(c)};u.f.onError=function(a,c){u.u(a).player.j("error");u.log("Flash Error",c,a)};
|
107 |
u.f.version=function(){var a="0,0,0";try{a=(new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(c){try{navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin&&(a=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1])}catch(d){}}return a.split(",")};
|
108 |
+
u.f.$c=function(a,c,d,e,g){a=u.f.lc(a,d,e,g);a=u.e("div",{innerHTML:a}).childNodes[0];d=c.parentNode;c.parentNode.replaceChild(a,c);var j=d.childNodes[0];setTimeout(function(){j.style.display="block"},1E3)};
|
109 |
+
u.f.lc=function(a,c,d,e){var g="",j="",k="";c&&u.k.ra(c,function(a,c){g+=a+"="+c+"&"});d=u.k.B({movie:a,flashvars:g,allowScriptAccess:"always",allowNetworking:"all"},d);u.k.ra(d,function(a,c){j+='<param name="'+a+'" value="'+c+'" />'});e=u.k.B({data:a,width:"100%",height:"100%"},e);u.k.ra(e,function(a,c){k+=a+'="'+c+'" '});return'<object type="application/x-shockwave-flash"'+k+">"+j+"</object>"};u.f.Ad=function(a,c){return a+"&"+c};
|
110 |
+
u.f.zc=function(a){var c={qb:"",Nb:""};if(!a)return c;var d=a.indexOf("&"),e;-1!==d?e=d+1:(d=e=a.lastIndexOf("/")+1,0===d&&(d=e=a.length));c.qb=a.substring(0,d);c.Nb=a.substring(e,a.length);return c};u.f.hd=function(a){return a in u.f.Ac};u.f.Oc=/^rtmp[set]?:\/\//i;u.f.gd=function(a){return u.f.Oc.test(a)};
|
111 |
+
u.Nc=u.b.extend({h:function(a,c,d){u.b.call(this,a,c,d);if(!a.g.sources||0===a.g.sources.length){c=0;for(d=a.g.techOrder;c<d.length;c++){var e=u.Z(d[c]),g=window.videojs[e];if(g&&g.isSupported()){I(a,e);break}}}else a.src(a.g.sources)}});u.Player.prototype.textTracks=function(){return this.ya=this.ya||[]};function W(a,c,d){for(var e=a.ya,g=0,j=e.length,k,q;g<j;g++)k=e[g],k.id()===c?(k.show(),q=k):d&&(k.G()==d&&0<k.mode())&&k.disable();(c=q?q.G():d?d:l)&&a.j(c+"trackchange")}
|
112 |
+
u.w=u.b.extend({h:function(a,c){u.b.call(this,a,c);this.Q=c.id||"vjs_"+c.kind+"_"+c.language+"_"+u.s++;this.wc=c.src;this.Xc=c["default"]||c.dflt;this.Cd=c.title;this.Od=c.srclang;this.jd=c.label;this.$=[];this.kb=[];this.ga=this.ha=0;this.c.d("fullscreenchange",u.bind(this,this.Qc))}});t=u.w.prototype;t.G=p("A");t.src=p("wc");t.tb=p("Xc");t.title=p("Cd");t.label=p("jd");t.Vc=p("$");t.Pc=p("kb");t.readyState=p("ha");t.mode=p("ga");
|
113 |
+
t.Qc=function(){this.a.style.fontSize=this.c.isFullScreen()?140*(screen.width/this.c.width())+"%":""};t.e=function(){return u.b.prototype.e.call(this,"div",{className:"vjs-"+this.A+" vjs-text-track"})};t.show=function(){X(this);this.ga=2;u.b.prototype.show.call(this)};t.D=function(){X(this);this.ga=1;u.b.prototype.D.call(this)};
|
114 |
+
t.disable=function(){2==this.ga&&this.D();this.c.o("timeupdate",u.bind(this,this.update,this.Q));this.c.o("ended",u.bind(this,this.reset,this.Q));this.reset();this.c.fa("textTrackDisplay").removeChild(this);this.ga=0};function X(a){0===a.ha&&a.load();0===a.ga&&(a.c.d("timeupdate",u.bind(a,a.update,a.Q)),a.c.d("ended",u.bind(a,a.reset,a.Q)),("captions"===a.A||"subtitles"===a.A)&&a.c.fa("textTrackDisplay").Y(a))}
|
115 |
+
t.load=function(){0===this.ha&&(this.ha=1,u.get(this.wc,u.bind(this,this.qd),u.bind(this,this.Gb)))};t.Gb=function(a){this.error=a;this.ha=3;this.j("error")};t.qd=function(a){var c,d;a=a.split("\n");for(var e="",g=1,j=a.length;g<j;g++)if(e=u.trim(a[g])){-1==e.indexOf("--\x3e")?(c=e,e=u.trim(a[++g])):c=this.$.length;c={id:c,index:this.$.length};d=e.split(" --\x3e ");c.startTime=Y(d[0]);c.sa=Y(d[1]);for(d=[];a[++g]&&(e=u.trim(a[g]));)d.push(e);c.text=d.join("<br/>");this.$.push(c)}this.ha=2;this.j("loaded")};
|
116 |
function Y(a){var c=a.split(":");a=0;var d,e,g;3==c.length?(d=c[0],e=c[1],c=c[2]):(d=0,e=c[0],c=c[1]);c=c.split(/\s+/);c=c.splice(0,1)[0];c=c.split(/\.|,/);g=parseFloat(c[1]);c=c[0];a+=3600*parseFloat(d);a+=60*parseFloat(e);a+=parseFloat(c);g&&(a+=g/1E3);return a}
|
117 |
+
t.update=function(){if(0<this.$.length){var a=this.c.currentTime();if(this.Lb===b||a<this.Lb||this.Na<=a){var c=this.$,d=this.c.duration(),e=0,g=l,j=[],k,q,n,s;a>=this.Na||this.Na===b?s=this.vb!==b?this.vb:0:(g=f,s=this.Cb!==b?this.Cb:c.length-1);for(;;){n=c[s];if(n.sa<=a)e=Math.max(e,n.sa),n.Ha&&(n.Ha=l);else if(a<n.startTime){if(d=Math.min(d,n.startTime),n.Ha&&(n.Ha=l),!g)break}else g?(j.splice(0,0,n),q===b&&(q=s),k=s):(j.push(n),k===b&&(k=s),q=s),d=Math.min(d,n.sa),e=Math.max(e,n.startTime),n.Ha=
|
118 |
+
f;if(g)if(0===s)break;else s--;else if(s===c.length-1)break;else s++}this.kb=j;this.Na=d;this.Lb=e;this.vb=k;this.Cb=q;a=this.kb;c="";d=0;for(e=a.length;d<e;d++)c+='<span class="vjs-tt-cue">'+a[d].text+"</span>";this.a.innerHTML=c;this.j("cuechange")}}};t.reset=function(){this.Na=0;this.Lb=this.c.duration();this.Cb=this.vb=0};u.Sb=u.w.extend();u.Sb.prototype.A="captions";u.Zb=u.w.extend();u.Zb.prototype.A="subtitles";u.Tb=u.w.extend();u.Tb.prototype.A="chapters";
|
119 |
+
u.ac=u.b.extend({h:function(a,c,d){u.b.call(this,a,c,d);if(a.g.tracks&&0<a.g.tracks.length){c=this.c;a=a.g.tracks;var e;for(d=0;d<a.length;d++){e=a[d];var g=c,j=e.kind,k=e.label,q=e.language,n=e;e=g.ya=g.ya||[];n=n||{};n.kind=j;n.label=k;n.language=q;j=u.Z(j||"subtitles");g=new window.videojs[j+"Track"](g,n);e.push(g)}}}});u.ac.prototype.e=function(){return u.b.prototype.e.call(this,"div",{className:"vjs-text-track-display"})};
|
120 |
+
u.X=u.M.extend({h:function(a,c){var d=this.ca=c.track;c.label=d.label();c.selected=d.tb();u.M.call(this,a,c);this.c.d(d.G()+"trackchange",u.bind(this,this.update))}});u.X.prototype.p=function(){u.M.prototype.p.call(this);W(this.c,this.ca.Q,this.ca.G())};u.X.prototype.update=function(){this.selected(2==this.ca.mode())};u.eb=u.X.extend({h:function(a,c){c.track={G:function(){return c.kind},C:a,label:function(){return c.kind+" off"},tb:r(l),mode:r(l)};u.X.call(this,a,c);this.selected(f)}});
|
121 |
+
u.eb.prototype.p=function(){u.X.prototype.p.call(this);W(this.c,this.ca.Q,this.ca.G())};u.eb.prototype.update=function(){for(var a=this.c.textTracks(),c=0,d=a.length,e,g=f;c<d;c++)e=a[c],e.G()==this.ca.G()&&2==e.mode()&&(g=l);this.selected(g)};u.S=u.R.extend({h:function(a,c){u.R.call(this,a,c);1>=this.K.length&&this.D()}});
|
122 |
+
u.S.prototype.qa=function(){var a=[],c;a.push(new u.eb(this.c,{kind:this.A}));for(var d=0;d<this.c.textTracks().length;d++)c=this.c.textTracks()[d],c.G()===this.A&&a.push(new u.X(this.c,{track:c}));return a};u.Aa=u.S.extend({h:function(a,c,d){u.S.call(this,a,c,d);this.a.setAttribute("aria-label","Captions Menu")}});u.Aa.prototype.A="captions";u.Aa.prototype.oa="Captions";u.Aa.prototype.className="vjs-captions-button";
|
123 |
+
u.Ga=u.S.extend({h:function(a,c,d){u.S.call(this,a,c,d);this.a.setAttribute("aria-label","Subtitles Menu")}});u.Ga.prototype.A="subtitles";u.Ga.prototype.oa="Subtitles";u.Ga.prototype.className="vjs-subtitles-button";u.Ba=u.S.extend({h:function(a,c,d){u.S.call(this,a,c,d);this.a.setAttribute("aria-label","Chapters Menu")}});t=u.Ba.prototype;t.A="chapters";t.oa="Chapters";t.className="vjs-chapters-button";
|
124 |
+
t.qa=function(){for(var a=[],c,d=0;d<this.c.textTracks().length;d++)c=this.c.textTracks()[d],c.G()===this.A&&a.push(new u.X(this.c,{track:c}));return a};
|
125 |
+
t.La=function(){for(var a=this.c.textTracks(),c=0,d=a.length,e,g,j=this.K=[];c<d;c++)if(e=a[c],e.G()==this.A&&e.tb()){if(2>e.readyState()){this.Ld=e;e.d("loaded",u.bind(this,this.La));return}g=e;break}a=this.ua=new u.la(this.c);a.a.appendChild(u.e("li",{className:"vjs-menu-title",innerHTML:u.Z(this.A),Bd:-1}));if(g){e=g.$;for(var k,c=0,d=e.length;c<d;c++)k=e[c],k=new u.Za(this.c,{track:g,cue:k}),j.push(k),a.Y(k)}0<this.K.length&&this.show();return a};
|
126 |
+
u.Za=u.M.extend({h:function(a,c){var d=this.ca=c.track,e=this.cue=c.cue,g=a.currentTime();c.label=e.text;c.selected=e.startTime<=g&&g<e.sa;u.M.call(this,a,c);d.d("cuechange",u.bind(this,this.update))}});u.Za.prototype.p=function(){u.M.prototype.p.call(this);this.c.currentTime(this.cue.startTime);this.update(this.cue.startTime)};u.Za.prototype.update=function(){var a=this.cue,c=this.c.currentTime();this.selected(a.startTime<=c&&c<a.sa)};
|
127 |
+
u.k.B(u.Ca.prototype.g.children,{subtitlesButton:{},captionsButton:{},chaptersButton:{}});
|
128 |
if("undefined"!==typeof window.JSON&&"function"===window.JSON.parse)u.JSON=window.JSON;else{u.JSON={};var Z=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;u.JSON.parse=function(a,c){function d(a,e){var k,q,n=a[e];if(n&&"object"===typeof n)for(k in n)Object.prototype.hasOwnProperty.call(n,k)&&(q=d(n,k),q!==b?n[k]=q:delete n[k]);return c.call(a,e,n)}var e;a=String(a);Z.lastIndex=0;Z.test(a)&&(a=a.replace(Z,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));
|
129 |
if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof c?d({"":e},""):e;throw new SyntaxError("JSON.parse(): invalid or malformed JSON data");}}
|
130 |
+
u.dc=function(){var a,c,d=document.getElementsByTagName("video");if(d&&0<d.length)for(var e=0,g=d.length;e<g;e++)if((c=d[e])&&c.getAttribute)c.player===b&&(a=c.getAttribute("data-setup"),a!==h&&(a=u.JSON.parse(a||"{}"),videojs(c,a)));else{u.lb();break}else u.Dc||u.lb()};u.lb=function(){setTimeout(u.dc,1)};"complete"===document.readyState?u.Dc=f:u.T(window,"load",function(){u.Dc=f});u.lb();u.rd=function(a,c){u.Player.prototype[a]=c};var ga=this;ga.Gd=f;function $(a,c){var d=a.split("."),e=ga;!(d[0]in e)&&e.execScript&&e.execScript("var "+d[0]);for(var g;d.length&&(g=d.shift());)!d.length&&c!==b?e[g]=c:e=e[g]?e[g]:e[g]={}};$("videojs",u);$("_V_",u);$("videojs.options",u.options);$("videojs.players",u.va);$("videojs.TOUCH_ENABLED",u.$b);$("videojs.cache",u.pa);$("videojs.Component",u.b);u.b.prototype.player=u.b.prototype.C;u.b.prototype.options=u.b.prototype.options;u.b.prototype.init=u.b.prototype.h;u.b.prototype.dispose=u.b.prototype.dispose;u.b.prototype.createEl=u.b.prototype.e;u.b.prototype.contentEl=u.b.prototype.Ka;u.b.prototype.el=u.b.prototype.u;u.b.prototype.addChild=u.b.prototype.Y;
|
131 |
+
u.b.prototype.getChild=u.b.prototype.fa;u.b.prototype.getChildById=u.b.prototype.ed;u.b.prototype.children=u.b.prototype.children;u.b.prototype.initChildren=u.b.prototype.nc;u.b.prototype.removeChild=u.b.prototype.removeChild;u.b.prototype.on=u.b.prototype.d;u.b.prototype.off=u.b.prototype.o;u.b.prototype.one=u.b.prototype.T;u.b.prototype.trigger=u.b.prototype.j;u.b.prototype.triggerReady=u.b.prototype.Wa;u.b.prototype.show=u.b.prototype.show;u.b.prototype.hide=u.b.prototype.D;
|
132 |
+
u.b.prototype.width=u.b.prototype.width;u.b.prototype.height=u.b.prototype.height;u.b.prototype.dimensions=u.b.prototype.Yc;u.b.prototype.ready=u.b.prototype.H;u.b.prototype.addClass=u.b.prototype.n;u.b.prototype.removeClass=u.b.prototype.t;u.b.prototype.buildCSSClass=u.b.prototype.P;u.Player.prototype.ended=u.Player.prototype.ended;$("videojs.MediaLoader",u.Nc);$("videojs.TextTrackDisplay",u.ac);$("videojs.ControlBar",u.Ca);$("videojs.Button",u.q);$("videojs.PlayToggle",u.Xb);
|
133 |
+
$("videojs.FullscreenToggle",u.Da);$("videojs.BigPlayButton",u.Ya);$("videojs.LoadingSpinner",u.Vb);$("videojs.CurrentTimeDisplay",u.$a);$("videojs.DurationDisplay",u.ab);$("videojs.TimeDivider",u.bc);$("videojs.RemainingTimeDisplay",u.gb);$("videojs.Slider",u.N);$("videojs.ProgressControl",u.fb);$("videojs.SeekBar",u.Yb);$("videojs.LoadProgressBar",u.cb);$("videojs.PlayProgressBar",u.Wb);$("videojs.SeekHandle",u.Fa);$("videojs.VolumeControl",u.ib);$("videojs.VolumeBar",u.hb);
|
134 |
+
$("videojs.VolumeLevel",u.cc);$("videojs.VolumeMenuButton",u.ma);$("videojs.VolumeHandle",u.jb);$("videojs.MuteToggle",u.ea);$("videojs.PosterImage",u.Ea);$("videojs.Menu",u.la);$("videojs.MenuItem",u.M);$("videojs.MenuButton",u.R);u.R.prototype.createItems=u.R.prototype.qa;u.S.prototype.createItems=u.S.prototype.qa;u.Ba.prototype.createItems=u.Ba.prototype.qa;$("videojs.SubtitlesButton",u.Ga);$("videojs.CaptionsButton",u.Aa);$("videojs.ChaptersButton",u.Ba);$("videojs.MediaTechController",u.r);
|
135 |
+
u.r.prototype.features=u.r.prototype.m;u.r.prototype.m.volumeControl=u.r.prototype.m.Cc;u.r.prototype.m.fullscreenResize=u.r.prototype.m.Md;u.r.prototype.m.progressEvents=u.r.prototype.m.Qd;u.r.prototype.m.timeupdateEvents=u.r.prototype.m.Vd;u.r.prototype.setPoster=u.r.prototype.Mb;$("videojs.Html5",u.l);u.l.Events=u.l.bb;u.l.isSupported=u.l.isSupported;u.l.canPlaySource=u.l.nb;u.l.prototype.setCurrentTime=u.l.prototype.ud;u.l.prototype.setVolume=u.l.prototype.zd;u.l.prototype.setMuted=u.l.prototype.xd;
|
136 |
+
u.l.prototype.setPreload=u.l.prototype.yd;u.l.prototype.setAutoplay=u.l.prototype.td;u.l.prototype.setLoop=u.l.prototype.wd;u.l.prototype.enterFullScreen=u.l.prototype.hc;u.l.prototype.exitFullScreen=u.l.prototype.bd;$("videojs.Flash",u.f);u.f.isSupported=u.f.isSupported;u.f.canPlaySource=u.f.nb;u.f.onReady=u.f.onReady;$("videojs.TextTrack",u.w);u.w.prototype.label=u.w.prototype.label;u.w.prototype.kind=u.w.prototype.G;u.w.prototype.mode=u.w.prototype.mode;u.w.prototype.cues=u.w.prototype.Vc;
|
137 |
+
u.w.prototype.activeCues=u.w.prototype.Pc;$("videojs.CaptionsTrack",u.Sb);$("videojs.SubtitlesTrack",u.Zb);$("videojs.ChaptersTrack",u.Tb);$("videojs.autoSetup",u.dc);$("videojs.plugin",u.rd);$("videojs.createTimeRange",u.sb);$("videojs.util",u.ja);u.ja.mergeOptions=u.ja.Fb;})();
|