Version Description
- October 5, 2013 =
- THUMBNAILS FOR EVERYBODY! Added in-browser thumbnail generation. Any video in the media library that can be played natively in the current browser can now be used to generate thumbnails without requiring special software on your server.
- Updated shortcode to support the simplest possible implementation: [KGVID]. Without any additional information, it will automatically find and display all videos attached to the post.
- Added "id" and "videos" attributes to shortcode to display specific video IDs or show a specific number of attached videos.
- If a video thumbnail is set, the video will now use its thumbnail as an icon in the WordPress admin area instead of the generic "video" icon.
- To avoid clutter, additional video formats encoded by the plugin are now hidden from lists of media, unless "Video" is specifically selected.
- When a master video is deleted and additional video formats are not deleted, the next highest quality format automatically becomes the master video.
- Updated Video.js to version 4.2.1, updated the included skin to work with it, and removed the unused image video-js.png.
- Added option to use the WordPress default video player introduced in WordPress version 3.6.
- Added buttons to choose thumbnails, end of video image, and watermark from the media library.
- Added option to add Open Graph tags for posting videos on Facebook. However, for the many Facebook users who browse with https, your own videos must be served via https in order to work.
- Added options to automatically generate a thumbnail and encode videos to multiple formats as soon as they are uploaded (FFMPEG/LIBAV only).
- Added option to disable responsive video resizing.
- Added options to restrict thumbnail making and video encoding to particular user roles.
- Added option to enter username and password to give FFMPEG/LIBAV access to .htaccess protected videos.
- Added option to disable right-clicking on videos.
- Added option to replace original video file with an H.264 video of the same resolution.
- Added advanced FFMPEG/LIBAV encoding options. New options include choice between Constant Rate Factor and Average Bit Rate, H.264 profiles and levels, audio bit rate, disabling
nice
on Linux, and the ability to encode with more than one thread. - Added
-movflags faststart
option available in newer versions of FFMPEG/LIBAV, eliminating the need for qt-faststart or MP4Box. - Added a test encoding output on the settings page for easier troubleshooting.
- Split plugin settings page in to two tabs.
- Fixed saving plugin settings when multiple settings are changed rapidly.
- No longer starting video encodes using
nohup
command on Linux servers. - FFMPEG vpre flag switched from slow to fast.
- Enabled actual support for encoding with libfdk_aac, and the experimental built-in aac encoder as a last resort.
- Fixed cases where the encode queue would not advance if an unexpected error happened.
- Fixed encoding library messages so the errors are saved to the encode queue and don't disappear immediately.
- Changed endOfVideoOverlay and endOfVideoOverlaySame options to lowercase.
- Revised method for determining if a video URL refers to an attachment in the WordPress database to account for differences between urls using http and https and filenames that slip into the database with spaces intact.
Download this release
Release Info
Developer | kylegilman |
Plugin | Video Embed & Thumbnail Generator |
Version | 4.2 |
Comparing to | |
See all releases |
Code changes from version 4.1.5 to 4.2
- css/kgvid_styles.css +3 -4
- css/video-embed-thumbnail-generator_admin.css +237 -15
- js/kgvid_video_embed.js +94 -41
- js/kgvid_video_plugin_admin.js +689 -117
- readme.txt +78 -35
- screenshot-1.jpg +0 -0
- screenshot-2.jpg +0 -0
- video-embed-thumbnail-generator.php +2240 -1159
- video-js/kg-video-js-skin.css +431 -254
- video-js/video-js.css +3 -2
- video-js/video-js.png +0 -0
- video-js/video-js.swf +0 -0
- video-js/video.js +126 -120
css/kgvid_styles.css
CHANGED
@@ -12,14 +12,14 @@
|
|
12 |
position: absolute;
|
13 |
bottom: 7%;
|
14 |
right: 5%;
|
15 |
-
z-index:
|
16 |
margin: 0px;
|
17 |
max-width: 10%;
|
18 |
box-shadow: none;
|
19 |
}
|
20 |
|
21 |
-
.vjs-controls {
|
22 |
-
z-index:
|
23 |
}
|
24 |
|
25 |
.vjs-fullscreen {padding-top: 0px}
|
@@ -98,7 +98,6 @@ img.kgvid_ios_novideo {
|
|
98 |
margin: 2px 6px 0px 4px;
|
99 |
min-height: 20px;
|
100 |
clear: both;
|
101 |
-
width: 100%;
|
102 |
overflow: hidden;
|
103 |
}
|
104 |
|
12 |
position: absolute;
|
13 |
bottom: 7%;
|
14 |
right: 5%;
|
15 |
+
z-index: 1;
|
16 |
margin: 0px;
|
17 |
max-width: 10%;
|
18 |
box-shadow: none;
|
19 |
}
|
20 |
|
21 |
+
.vjs-control-bar, .mejs-controls {
|
22 |
+
z-index:2;
|
23 |
}
|
24 |
|
25 |
.vjs-fullscreen {padding-top: 0px}
|
98 |
margin: 2px 6px 0px 4px;
|
99 |
min-height: 20px;
|
100 |
clear: both;
|
|
|
101 |
overflow: hidden;
|
102 |
}
|
103 |
|
css/video-embed-thumbnail-generator_admin.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
.kgvid_meter, .meter_finished {
|
2 |
-
height: 14px;
|
3 |
width: 125px;
|
4 |
display: inline-block;
|
5 |
position: relative;
|
@@ -9,7 +9,7 @@
|
|
9 |
-webkit-border-radius: 4px;
|
10 |
border-radius: 4px;
|
11 |
padding: 2px;
|
12 |
-
|
13 |
}
|
14 |
|
15 |
.kgvid_meter_bar {
|
@@ -112,22 +112,53 @@ div.kgvid_cancel_button input {
|
|
112 |
}
|
113 |
|
114 |
.compat-item .field {
|
115 |
-
width: 85%;
|
116 |
}
|
117 |
|
118 |
.compat-item .field input {
|
119 |
-
width: auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}
|
121 |
|
122 |
div.kgvid_thumbnail_box {
|
123 |
-
border-style:solid;
|
124 |
-
border-color:#ccc;
|
125 |
-
border-width:1px;
|
126 |
-
text-align:center;
|
127 |
-
margin
|
128 |
padding:5px;
|
129 |
}
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
div.kgvid_thumbnail_overlay {
|
132 |
width: 100%;
|
133 |
height:100%;
|
@@ -137,11 +168,11 @@ div.kgvid_thumbnail_overlay {
|
|
137 |
}
|
138 |
|
139 |
div.kgvid_thumbnail_select {
|
140 |
-
text-align:center;
|
141 |
-
display:inline-block;
|
142 |
}
|
143 |
|
144 |
-
img.kgvid_thumbnail {
|
145 |
margin:2px;
|
146 |
}
|
147 |
|
@@ -158,11 +189,28 @@ div.kgvid_cancel_button {
|
|
158 |
padding-left:5px;
|
159 |
}
|
160 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
.kgvid_setting_nearvid div {
|
162 |
margin: 5px;
|
163 |
font-weight: bold;
|
164 |
}
|
165 |
|
|
|
|
|
|
|
|
|
166 |
.kgvid_tooltip {
|
167 |
color: #000000; outline: none;
|
168 |
cursor: help; text-decoration: none;
|
@@ -213,7 +261,11 @@ div.kgvid_cancel_button {
|
|
213 |
* html a:hover { background: transparent; }
|
214 |
|
215 |
.widefat tr.currently_encoding {
|
216 |
-
background-color:#f3f3ff;
|
|
|
|
|
|
|
|
|
217 |
}
|
218 |
|
219 |
.widefat td.queue_encode_formats {
|
@@ -248,4 +300,174 @@ div.kgvid_post_meta_boxes {
|
|
248 |
padding: 10px;
|
249 |
margin: 5px;
|
250 |
vertical-align: top;
|
251 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.kgvid_meter, .meter_finished {
|
2 |
+
height: 14px;
|
3 |
width: 125px;
|
4 |
display: inline-block;
|
5 |
position: relative;
|
9 |
-webkit-border-radius: 4px;
|
10 |
border-radius: 4px;
|
11 |
padding: 2px;
|
12 |
+
text-align: left;
|
13 |
}
|
14 |
|
15 |
.kgvid_meter_bar {
|
112 |
}
|
113 |
|
114 |
.compat-item .field {
|
115 |
+
width: 85%;
|
116 |
}
|
117 |
|
118 |
.compat-item .field input {
|
119 |
+
width: auto;
|
120 |
+
}
|
121 |
+
|
122 |
+
#poststuff .nav-tab-wrapper.kgvid-tabs {
|
123 |
+
margin-top: 0;
|
124 |
+
padding: 0;
|
125 |
+
}
|
126 |
+
|
127 |
+
.kgvid-tabs > .nav-tab {
|
128 |
+
font-size: 14px;
|
129 |
+
padding: 2px 6px;
|
130 |
+
color: #aaa;
|
131 |
+
}
|
132 |
+
|
133 |
+
.kgvid-tabs > .nav-tab-active {
|
134 |
+
border-width: 1px;
|
135 |
+
color: #464646;
|
136 |
+
}
|
137 |
+
|
138 |
+
div.kgvid-tabs-content {
|
139 |
+
margin: 5px 0;
|
140 |
}
|
141 |
|
142 |
div.kgvid_thumbnail_box {
|
143 |
+
border-style:solid;
|
144 |
+
border-color:#ccc;
|
145 |
+
border-width:1px;
|
146 |
+
text-align:center;
|
147 |
+
margin:12px 0;
|
148 |
padding:5px;
|
149 |
}
|
150 |
|
151 |
+
div.kgvid_chosen_thumbnail_box {
|
152 |
+
border-width:6px;
|
153 |
+
width: 200px;
|
154 |
+
padding: 0;
|
155 |
+
}
|
156 |
+
|
157 |
+
.kgvid_chosen_thumbnail_box img, .kgvid_chosen_thumbnail_box canvas {
|
158 |
+
display: block;
|
159 |
+
width: 200px;
|
160 |
+
}
|
161 |
+
|
162 |
div.kgvid_thumbnail_overlay {
|
163 |
width: 100%;
|
164 |
height:100%;
|
168 |
}
|
169 |
|
170 |
div.kgvid_thumbnail_select {
|
171 |
+
text-align:center;
|
172 |
+
display:inline-block;
|
173 |
}
|
174 |
|
175 |
+
img.kgvid_thumbnail, canvas.kgvid_thumbnail {
|
176 |
margin:2px;
|
177 |
}
|
178 |
|
189 |
padding-left:5px;
|
190 |
}
|
191 |
|
192 |
+
.kgvid_gray_text {
|
193 |
+
color: #aaa;
|
194 |
+
}
|
195 |
+
|
196 |
+
.ffmpeg_sample_code {
|
197 |
+
background: #eee;
|
198 |
+
outline: 2px solid #aaa;
|
199 |
+
}
|
200 |
+
|
201 |
+
strong.video_app_name {
|
202 |
+
font-weight: normal;
|
203 |
+
}
|
204 |
+
|
205 |
.kgvid_setting_nearvid div {
|
206 |
margin: 5px;
|
207 |
font-weight: bold;
|
208 |
}
|
209 |
|
210 |
+
.kgvid_htaccess td {
|
211 |
+
padding: 0;
|
212 |
+
}
|
213 |
+
|
214 |
.kgvid_tooltip {
|
215 |
color: #000000; outline: none;
|
216 |
cursor: help; text-decoration: none;
|
261 |
* html a:hover { background: transparent; }
|
262 |
|
263 |
.widefat tr.currently_encoding {
|
264 |
+
background-color:#f3f3ff;
|
265 |
+
}
|
266 |
+
|
267 |
+
.widefat tr.kgvid_complete {
|
268 |
+
background-color: #F0F0F0;
|
269 |
}
|
270 |
|
271 |
.widefat td.queue_encode_formats {
|
300 |
padding: 10px;
|
301 |
margin: 5px;
|
302 |
vertical-align: top;
|
303 |
+
}
|
304 |
+
|
305 |
+
.kgvid-right-arrow {
|
306 |
+
width: 0;
|
307 |
+
height: 0;
|
308 |
+
border-top: 6px solid transparent;
|
309 |
+
border-bottom: 6px solid transparent;
|
310 |
+
border-left: 10px solid #bbb;
|
311 |
+
display: inline-block;
|
312 |
+
margin-right: 4px;
|
313 |
+
}
|
314 |
+
|
315 |
+
.kgvid-down-arrow {
|
316 |
+
width: 0;
|
317 |
+
height: 0;
|
318 |
+
border-left: 6px solid transparent;
|
319 |
+
border-right: 6px solid transparent;
|
320 |
+
border-top: 10px solid #bbb;
|
321 |
+
display: inline-block;
|
322 |
+
margin-right: 4px;
|
323 |
+
}
|
324 |
+
|
325 |
+
.kgvid-reveal-thumb-video {
|
326 |
+
cursor:pointer;
|
327 |
+
width: 200px;
|
328 |
+
text-align: left;
|
329 |
+
}
|
330 |
+
|
331 |
+
.kgvid-thumb-video {
|
332 |
+
width: 100%;
|
333 |
+
margin: 5px 0 5px 0;
|
334 |
+
background-color: black;
|
335 |
+
}
|
336 |
+
|
337 |
+
.kgvid-video-controls {
|
338 |
+
white-space: nowrap;
|
339 |
+
}
|
340 |
+
|
341 |
+
.kgvid-play-pause {
|
342 |
+
width: 0;
|
343 |
+
height: 0;
|
344 |
+
border-top: 6px solid transparent;
|
345 |
+
border-bottom: 6px solid transparent;
|
346 |
+
border-left: 10px solid #1e8cbe;
|
347 |
+
display: inline-block;
|
348 |
+
cursor: pointer;
|
349 |
+
margin-right: 5px;
|
350 |
+
}
|
351 |
+
|
352 |
+
.kgvid-play-pause.kgvid-playing {
|
353 |
+
|
354 |
+
width: 3px;
|
355 |
+
height: 12px;
|
356 |
+
margin-right: 6px;
|
357 |
+
border-left: 3px solid #1e8cbe;
|
358 |
+
border-right: 3px solid #1e8cbe;
|
359 |
+
border-top: none;
|
360 |
+
border-bottom: none;
|
361 |
+
|
362 |
+
}
|
363 |
+
|
364 |
+
.kgvid-seek-bar
|
365 |
+
{
|
366 |
+
display: inline-block;
|
367 |
+
position: relative;
|
368 |
+
width: 89%;
|
369 |
+
height: 10px;
|
370 |
+
background-color: #F5F5F5;
|
371 |
+
border: 1px solid #dfdfdf;
|
372 |
+
cursor: pointer;
|
373 |
+
}
|
374 |
+
|
375 |
+
.kgvid-seek-bar:hover {
|
376 |
+
background: #FAFAFA;
|
377 |
+
}
|
378 |
+
|
379 |
+
.kgvid-seek-bar:hover .kgvid-seek-handle {
|
380 |
+
width: 4px;
|
381 |
+
height: 14px;
|
382 |
+
margin-left: -2px;
|
383 |
+
margin-top: -2px;
|
384 |
+
}
|
385 |
+
|
386 |
+
.kgvid-play-progress
|
387 |
+
{
|
388 |
+
position: absolute;
|
389 |
+
top: 0;
|
390 |
+
left: 0;
|
391 |
+
width: 0;
|
392 |
+
height: 100%;
|
393 |
+
background-color: rgb(41,140,186);
|
394 |
+
background-image: -webkit-gradient(
|
395 |
+
linear,
|
396 |
+
left bottom,
|
397 |
+
left top,
|
398 |
+
color-stop(0, rgb(41,140,186)),
|
399 |
+
color-stop(1, rgb(64,176,228))
|
400 |
+
);
|
401 |
+
background-image: -webkit-linear-gradient(
|
402 |
+
center bottom,
|
403 |
+
rgb(41,140,186) 37%,
|
404 |
+
rgb(64,176,228) 69%
|
405 |
+
);
|
406 |
+
background-image: -moz-linear-gradient(
|
407 |
+
center bottom,
|
408 |
+
rgb(41,140,186) 37%,
|
409 |
+
rgb(64,176,228) 69%
|
410 |
+
);
|
411 |
+
background-image: -ms-linear-gradient(
|
412 |
+
center bottom,
|
413 |
+
rgb(41,140,186) 37%,
|
414 |
+
rgb(64,176,228) 69%
|
415 |
+
);
|
416 |
+
background-image: -o-linear-gradient(
|
417 |
+
center bottom,
|
418 |
+
rgb(41,140,186) 37%,
|
419 |
+
rgb(64,176,228) 69%
|
420 |
+
);
|
421 |
+
}
|
422 |
+
|
423 |
+
.kgvid-seek-handle {
|
424 |
+
display: block;
|
425 |
+
width: 2px;
|
426 |
+
height: 10px;
|
427 |
+
background: #AFDAED;
|
428 |
+
position: relative;
|
429 |
+
}
|
430 |
+
|
431 |
+
td.media-icon img {
|
432 |
+
width: auto;
|
433 |
+
}
|
434 |
+
|
435 |
+
.kgvid-media-icon-overlay {
|
436 |
+
position: relative;
|
437 |
+
}
|
438 |
+
|
439 |
+
.kgvid-media-icon-play {
|
440 |
+
display: block;
|
441 |
+
z-index: 2;
|
442 |
+
position: absolute;
|
443 |
+
top: 6px;
|
444 |
+
left: 16px;
|
445 |
+
width: 40px;
|
446 |
+
height: 40px;
|
447 |
+
text-align: center;
|
448 |
+
vertical-align: middle;
|
449 |
+
border: 4px solid rgb(255, 255, 255);
|
450 |
+
border-color: rgba(255, 255, 255, 0.7);
|
451 |
+
-webkit-border-radius: 100px;
|
452 |
+
-moz-border-radius: 100px;
|
453 |
+
border-radius: 100px;
|
454 |
+
}
|
455 |
+
|
456 |
+
.kgvid-media-icon-play span {
|
457 |
+
position: absolute;
|
458 |
+
top: 9px;
|
459 |
+
left: 13px;
|
460 |
+
width: 0;
|
461 |
+
height: 0;
|
462 |
+
border-top: 11px solid transparent;
|
463 |
+
border-bottom: 11px solid transparent;
|
464 |
+
border-left: 18px solid #fff;
|
465 |
+
border-left-color: rgba(255,255,255, 0.7);
|
466 |
+
display: inline-block;
|
467 |
+
}
|
468 |
+
|
469 |
+
.attachment-preview.type-video .icon[src*="kgvid"] {
|
470 |
+
width: 100%;
|
471 |
+
height: 100%;
|
472 |
+
padding: 0;
|
473 |
+
}
|
js/kgvid_video_embed.js
CHANGED
@@ -2,8 +2,8 @@ var kgvid_video_vars = {};
|
|
2 |
|
3 |
function kgvid_SetVideo(suffix, site_url, id, width, height, meta) {
|
4 |
var aspect_ratio = Math.round(height/width*1000)/1000
|
5 |
-
if ( width > screen.width ) {
|
6 |
-
width = screen.width-6;
|
7 |
height = Math.round(width * aspect_ratio);
|
8 |
}
|
9 |
var iframe_height = height;
|
@@ -15,7 +15,9 @@ function kgvid_SetVideo(suffix, site_url, id, width, height, meta) {
|
|
15 |
jQuery('#kgvid_GalleryPlayerDiv_'+suffix).dialog("option", "height", parseInt(iframe_height)+10);
|
16 |
jQuery('.ui-widget-overlay').click(function () { jQuery('#kgvid_GalleryPlayerDiv_'+suffix).dialog('close'); });
|
17 |
}
|
|
|
18 |
function kgvid_timeupdate() {
|
|
|
19 |
jQuery('#'+this.id()+' > .vjs-poster').fadeOut();
|
20 |
}
|
21 |
|
@@ -23,30 +25,30 @@ function kgvid_setup_video(id) {
|
|
23 |
var video_vars = kgvid_video_vars[id];
|
24 |
var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false );
|
25 |
if (iOS && video_vars.player_type == "Strobe Media Playback" ) { video_vars.player_type = "Video.js"; }
|
26 |
-
|
27 |
jQuery('#video_'+id+'_div').prepend(jQuery('#video_'+id+'_watermark'));
|
28 |
jQuery('#video_'+id+'_watermark').attr('style', ''); //shows the hidden watermark div
|
29 |
jQuery('#video_'+id+'_div').prepend(jQuery('#video_'+id+'_meta'));
|
30 |
jQuery('#video_'+id+'_meta').attr('style', ''); //shows the hidden meta div
|
31 |
|
32 |
if ( video_vars.player_type == "Video.js" ) {
|
33 |
-
|
34 |
var player = videojs('video_'+id);
|
35 |
-
|
36 |
if ( jQuery('#video_'+id+'_flash_api').parent().is('.fluid-width-video-wrapper') ) { //disables fitVids.js
|
37 |
-
jQuery('#video_'+id+'_flash_api').unwrap();
|
38 |
}
|
39 |
-
|
40 |
if ( video_vars.set_volume != "" ) { player.volume(video_vars.set_volume); }
|
41 |
-
|
42 |
player.on('play', function kgvid_play_start(){
|
43 |
player.off('timeupdate', kgvid_timeupdate);
|
44 |
if ( video_vars.meta ) {
|
45 |
jQuery('#video_'+id+'_div').hover(
|
46 |
-
function(){
|
47 |
jQuery('#video_'+id+'_meta').addClass('kgvid_video_meta_hover');
|
48 |
},
|
49 |
-
function(){
|
50 |
jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
|
51 |
}
|
52 |
);
|
@@ -55,21 +57,21 @@ function kgvid_setup_video(id) {
|
|
55 |
if ( video_vars.autoplay == "true" ) { jQuery('#video_'+id+' > .vjs-control-bar').removeClass('vjs-fade-in'); }
|
56 |
kgvid_video_counter(id, 'play');
|
57 |
});
|
58 |
-
|
59 |
-
player.on('ended', function kgvid_play_end(){
|
60 |
kgvid_video_counter(id, 'end');
|
61 |
setTimeout(function() { jQuery('#video_'+id+' > .vjs-loading-spinner').hide(); }, 250);
|
62 |
if ( video_vars.endOfVideoOverlay != "" ) {
|
63 |
jQuery('#video_'+id+' > .vjs-poster').css({
|
64 |
'background-image':'url('+video_vars.endofvideooverlay+')'
|
65 |
}).fadeIn();
|
66 |
-
|
67 |
player.on('timeupdate', kgvid_timeupdate);
|
68 |
}
|
69 |
});
|
70 |
-
|
71 |
player.on('fullscreenchange', function(){
|
72 |
-
|
73 |
var
|
74 |
fullScreenApi = {
|
75 |
supportsFullScreen: false,
|
@@ -80,7 +82,7 @@ function kgvid_setup_video(id) {
|
|
80 |
prefix: ''
|
81 |
},
|
82 |
browserPrefixes = 'webkit moz o ms khtml'.split(' ');
|
83 |
-
|
84 |
// check for native support
|
85 |
if (typeof document.cancelFullScreen != 'undefined') {
|
86 |
fullScreenApi.supportsFullScreen = true;
|
@@ -94,39 +96,84 @@ function kgvid_setup_video(id) {
|
|
94 |
}
|
95 |
}
|
96 |
}
|
97 |
-
|
98 |
if ( fullScreenApi.supportsFullScreen == true ) { jQuery('#video_'+id).removeClass('vjs-fullscreen'); }
|
99 |
else if ( jQuery('#video_'+id).hasClass('vjs-fullscreen') ) {
|
100 |
jQuery('#video_'+id+'_meta').hide();
|
101 |
jQuery('#video_'+id+'_watermark img').css('position', 'fixed');
|
102 |
}
|
103 |
-
else {
|
104 |
-
jQuery('#video_'+id+'_meta').show();
|
105 |
jQuery('#video_'+id+'_watermark img').css('position', 'absolute');
|
106 |
}
|
107 |
-
|
108 |
});
|
109 |
-
|
110 |
} //end if Video.js
|
111 |
-
|
112 |
-
if ( video_vars.player_type == "Strobe Media Playback" ) {
|
113 |
-
|
114 |
if ( video_vars.autoplay == "true" ) { jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover'); }
|
115 |
jQuery('#video_'+id+'_div').hover(
|
116 |
-
function(){
|
117 |
-
jQuery('#video_'+id+'_meta').addClass('kgvid_video_meta_hover');
|
118 |
jQuery('#video_'+id+'_watermark').fadeOut(100);
|
119 |
},
|
120 |
-
function(){
|
121 |
jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
|
122 |
setTimeout(function(){jQuery('#video_'+id+'_watermark').fadeIn('slow');},3000);
|
123 |
}
|
124 |
);
|
125 |
} //end if Strobe Media Playback
|
126 |
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
}
|
131 |
|
132 |
function kgvid_resize_all_videos() {
|
@@ -143,7 +190,8 @@ function kgvid_resize_video(id) {
|
|
143 |
var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false );
|
144 |
if ( iOS ) { video_vars.player_type = "iOS"; }
|
145 |
var aspect_ratio = Math.round(set_height/set_width*1000)/1000
|
146 |
-
reference_div = jQuery('#kgvid_'+id+'_wrapper').parent();
|
|
|
147 |
parent_width = reference_div.width();
|
148 |
if ( parent_width < set_width ) { set_width = parent_width; }
|
149 |
|
@@ -172,9 +220,14 @@ function kgvid_resize_video(id) {
|
|
172 |
jQuery('#video_'+id).attr('width',set_width).attr('height',set_height);
|
173 |
jQuery('#video_'+id+'_html5_api').attr('width',set_width).attr('height',set_height);
|
174 |
}
|
|
|
175 |
if ( video_vars.player_type == "iOS" ) {
|
176 |
jQuery('#video_'+id).attr('width',set_width).attr('height',set_height);
|
177 |
jQuery('#video_'+id).width(set_width).height(set_height);
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
|
180 |
}
|
@@ -185,10 +238,10 @@ function kgvid_strobemedia_callback(id) {
|
|
185 |
|
186 |
var player = document.getElementById('video_'+id);
|
187 |
var video_vars = kgvid_video_vars[id];
|
188 |
-
if ( player.getState() == 'buffering' || player.getState() == 'playing' ) {
|
189 |
-
kgvid_video_counter(video_vars.id, 'play');
|
190 |
}
|
191 |
-
|
192 |
if ( player.getState() == 'uninitialized' && video_vars.set_volume != "" ) {
|
193 |
player.setVolume(video_vars.set_volume);
|
194 |
}
|
@@ -197,19 +250,19 @@ function kgvid_strobemedia_callback(id) {
|
|
197 |
function kgvid_video_counter(id, event) {
|
198 |
|
199 |
var video_vars = kgvid_video_vars[id];
|
200 |
-
var changed = false;
|
201 |
-
|
202 |
var played = jQuery('#video_'+id+'_div').data("played") || "not played";
|
203 |
-
if ( played == "not played" ) {
|
204 |
if (video_vars.countable) { //video is in the db
|
205 |
-
changed = true;
|
206 |
jQuery('#video_'+id+'_div').data("played", "played");
|
207 |
}
|
208 |
if (typeof _gaq != "undefined") { _gaq.push(["_trackEvent", "Videos", "Play Start", video_vars.title]); }
|
209 |
}
|
210 |
if ( event == "end" ) {
|
211 |
-
if (video_vars.countable) { //video is in the db
|
212 |
-
changed = true;
|
213 |
}
|
214 |
if (typeof _gaq != 'undefined') { _gaq.push(['_trackEvent', 'Videos', 'Complete View', video_vars.title]); }
|
215 |
}
|
@@ -221,5 +274,5 @@ function kgvid_video_counter(id, event) {
|
|
221 |
}, function(data) {
|
222 |
if ( event == "play" ) { jQuery('#video_'+id+'_viewcount').html(data+' views'); }
|
223 |
});
|
224 |
-
}
|
225 |
-
}
|
2 |
|
3 |
function kgvid_SetVideo(suffix, site_url, id, width, height, meta) {
|
4 |
var aspect_ratio = Math.round(height/width*1000)/1000
|
5 |
+
if ( width > screen.width ) {
|
6 |
+
width = screen.width-6;
|
7 |
height = Math.round(width * aspect_ratio);
|
8 |
}
|
9 |
var iframe_height = height;
|
15 |
jQuery('#kgvid_GalleryPlayerDiv_'+suffix).dialog("option", "height", parseInt(iframe_height)+10);
|
16 |
jQuery('.ui-widget-overlay').click(function () { jQuery('#kgvid_GalleryPlayerDiv_'+suffix).dialog('close'); });
|
17 |
}
|
18 |
+
|
19 |
function kgvid_timeupdate() {
|
20 |
+
|
21 |
jQuery('#'+this.id()+' > .vjs-poster').fadeOut();
|
22 |
}
|
23 |
|
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 |
+
|
29 |
jQuery('#video_'+id+'_div').prepend(jQuery('#video_'+id+'_watermark'));
|
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 |
+
|
36 |
var player = videojs('video_'+id);
|
37 |
+
|
38 |
if ( jQuery('#video_'+id+'_flash_api').parent().is('.fluid-width-video-wrapper') ) { //disables fitVids.js
|
39 |
+
jQuery('#video_'+id+'_flash_api').unwrap();
|
40 |
}
|
41 |
+
|
42 |
if ( video_vars.set_volume != "" ) { player.volume(video_vars.set_volume); }
|
43 |
+
|
44 |
player.on('play', function kgvid_play_start(){
|
45 |
player.off('timeupdate', kgvid_timeupdate);
|
46 |
if ( video_vars.meta ) {
|
47 |
jQuery('#video_'+id+'_div').hover(
|
48 |
+
function(){
|
49 |
jQuery('#video_'+id+'_meta').addClass('kgvid_video_meta_hover');
|
50 |
},
|
51 |
+
function(){
|
52 |
jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
|
53 |
}
|
54 |
);
|
57 |
if ( video_vars.autoplay == "true" ) { jQuery('#video_'+id+' > .vjs-control-bar').removeClass('vjs-fade-in'); }
|
58 |
kgvid_video_counter(id, 'play');
|
59 |
});
|
60 |
+
|
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.endOfVideoOverlay != "" ) {
|
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 |
+
|
73 |
player.on('fullscreenchange', function(){
|
74 |
+
|
75 |
var
|
76 |
fullScreenApi = {
|
77 |
supportsFullScreen: false,
|
82 |
prefix: ''
|
83 |
},
|
84 |
browserPrefixes = 'webkit moz o ms khtml'.split(' ');
|
85 |
+
|
86 |
// check for native support
|
87 |
if (typeof document.cancelFullScreen != 'undefined') {
|
88 |
fullScreenApi.supportsFullScreen = true;
|
96 |
}
|
97 |
}
|
98 |
}
|
99 |
+
|
100 |
if ( fullScreenApi.supportsFullScreen == true ) { jQuery('#video_'+id).removeClass('vjs-fullscreen'); }
|
101 |
else if ( jQuery('#video_'+id).hasClass('vjs-fullscreen') ) {
|
102 |
jQuery('#video_'+id+'_meta').hide();
|
103 |
jQuery('#video_'+id+'_watermark img').css('position', 'fixed');
|
104 |
}
|
105 |
+
else {
|
106 |
+
jQuery('#video_'+id+'_meta').show();
|
107 |
jQuery('#video_'+id+'_watermark img').css('position', 'absolute');
|
108 |
}
|
109 |
+
|
110 |
});
|
111 |
+
|
112 |
} //end if Video.js
|
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');
|
120 |
jQuery('#video_'+id+'_watermark').fadeOut(100);
|
121 |
},
|
122 |
+
function(){
|
123 |
jQuery('#video_'+id+'_meta').removeClass('kgvid_video_meta_hover');
|
124 |
setTimeout(function(){jQuery('#video_'+id+'_watermark').fadeIn('slow');},3000);
|
125 |
}
|
126 |
);
|
127 |
} //end if Strobe Media Playback
|
128 |
|
129 |
+
if ( video_vars.player_type == "WordPress Default" ) {
|
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 |
+
|
153 |
+
player.on('ended', function kgvid_play_end(){
|
154 |
+
kgvid_video_counter(id, 'end');
|
155 |
+
if ( video_vars.endofvideooverlay != "" ) {
|
156 |
+
jQuery('#video_'+id+'_div .mejs-poster').css({
|
157 |
+
'background-image':'url('+video_vars.endofvideooverlay+')'
|
158 |
+
}).fadeIn();
|
159 |
+
|
160 |
+
player.on('seeking.kgvid', function() {
|
161 |
+
player = jQuery('#video_'+id+'_div video');
|
162 |
+
if ( player[0].currentTime != 0) {
|
163 |
+
jQuery('#video_'+id+'_div .mejs-poster').fadeOut();
|
164 |
+
player.off('seeking.kgvid');
|
165 |
+
}
|
166 |
+
} );
|
167 |
+
}
|
168 |
+
});
|
169 |
|
170 |
+
|
171 |
+
} //end if WordPress Default
|
172 |
+
|
173 |
+
if ( video_vars.resize == "true" ) {
|
174 |
+
kgvid_resize_video(id);
|
175 |
+
window.addEventListener('resize', kgvid_resize_all_videos, false);
|
176 |
+
}
|
177 |
}
|
178 |
|
179 |
function kgvid_resize_all_videos() {
|
190 |
var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/i) ? true : false );
|
191 |
if ( iOS ) { video_vars.player_type = "iOS"; }
|
192 |
var aspect_ratio = Math.round(set_height/set_width*1000)/1000
|
193 |
+
var reference_div = jQuery('#kgvid_'+id+'_wrapper').parent();
|
194 |
+
//if ( video_vars.player_type == "WordPress Default" ) { reference_div = jQuery('.wp-video-shortcode'); }
|
195 |
parent_width = reference_div.width();
|
196 |
if ( parent_width < set_width ) { set_width = parent_width; }
|
197 |
|
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 |
if ( video_vars.player_type == "iOS" ) {
|
225 |
jQuery('#video_'+id).attr('width',set_width).attr('height',set_height);
|
226 |
jQuery('#video_'+id).width(set_width).height(set_height);
|
227 |
+
|
228 |
+
jQuery('#kgvid_'+id+'_wrapper').find('.wp-video-shortcode').attr('width',set_width).attr('height',set_height);
|
229 |
+
jQuery('#kgvid_'+id+'_wrapper').find('.wp-video-shortcode').width(set_width).height(set_height);
|
230 |
+
|
231 |
}
|
232 |
|
233 |
}
|
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 |
}
|
244 |
+
|
245 |
if ( player.getState() == 'uninitialized' && video_vars.set_volume != "" ) {
|
246 |
player.setVolume(video_vars.set_volume);
|
247 |
}
|
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" ) {
|
257 |
if (video_vars.countable) { //video is in the db
|
258 |
+
changed = true;
|
259 |
jQuery('#video_'+id+'_div').data("played", "played");
|
260 |
}
|
261 |
if (typeof _gaq != "undefined") { _gaq.push(["_trackEvent", "Videos", "Play Start", video_vars.title]); }
|
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', 'Complete View', video_vars.title]); }
|
268 |
}
|
274 |
}, function(data) {
|
275 |
if ( event == "play" ) { jQuery('#video_'+id+'_viewcount').html(data+' views'); }
|
276 |
});
|
277 |
+
}
|
278 |
+
}
|
js/kgvid_video_plugin_admin.js
CHANGED
@@ -9,7 +9,7 @@ function kgvid_disable_thumb_buttons(postID, event) {
|
|
9 |
document.getElementById('attachments-'+postID+'-thumbgenerate').disabled = true;
|
10 |
document.getElementById('attachments-'+postID+'-thumbrandomize').disabled = true;
|
11 |
}
|
12 |
-
|
13 |
if (event == "onchange") {
|
14 |
document.getElementById('attachments-'+postID+'-thumbgenerate').value = "Wait";
|
15 |
document.getElementById('attachments-'+postID+'-thumbrandomize').value = "Wait";
|
@@ -22,16 +22,181 @@ function kgvid_set_dimension(postID, valuetochange, currentvalue) {
|
|
22 |
var changeaspect = kgvid_aspect;
|
23 |
if (valuetochange == "width") { changeaspect = 1/kgvid_aspect; }
|
24 |
var changedvalue = Math.round(currentvalue*changeaspect);
|
25 |
-
if (document.getElementById('attachments-'+postID+'-kgflashmediaplayer-lockaspect').checked == true && changedvalue != 0) {
|
26 |
-
document.getElementById('attachments-'+postID+'-kgflashmediaplayer-'+valuetochange).value = changedvalue;
|
27 |
}
|
28 |
}
|
29 |
|
30 |
function kgvid_set_aspect(postID, checked) {
|
31 |
-
if (checked) { document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-aspect]')[0].value = document.getElementById('attachments-'+postID+'-kgflashmediaplayer-height').value / document.getElementById('attachments-'+postID+'-kgflashmediaplayer-width').value;
|
32 |
}
|
33 |
}
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
function kgvid_generate_thumb(postID, buttonPushed) {
|
36 |
|
37 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-security]')[0].value;
|
@@ -41,10 +206,10 @@ function kgvid_generate_thumb(postID, buttonPushed) {
|
|
41 |
var posterurl = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-poster]')[0].value;
|
42 |
|
43 |
var specifictimecode = document.getElementsByName('attachments['+postID+'][thumbtime]')[0].value;
|
44 |
-
if (specifictimecode === "0") { specifictimecode = "firstframe"; }
|
|
|
45 |
if (specifictimecode != 0 ) { howmanythumbs = 1; }
|
46 |
-
|
47 |
-
|
48 |
var thumbnailplaceholderid = "#attachments-"+postID+"-thumbnailplaceholder";
|
49 |
var thumbnailboxID = "#attachments-"+postID+"-kgflashmediaplayer-thumbnailbox";
|
50 |
var thumbnailboxoverlayID = "#attachments-"+postID+"-kgflashmediaplayer-thumbnailboxoverlay";
|
@@ -57,21 +222,21 @@ function kgvid_generate_thumb(postID, buttonPushed) {
|
|
57 |
var increaser = 0;
|
58 |
var iincreaser = 0;
|
59 |
var page = "attachment";
|
60 |
-
|
61 |
jQuery(thumbnailplaceholderid).empty();
|
62 |
-
jQuery(thumbnailplaceholderid).append('<strong>Choose Thumbnail: </strong><div style="display:inline-block;" id="attachments-'+postID+'-kgflashmediaplayer-cancelthumbsdiv" name="attachments-'+postID+'-kgflashmediaplayer-cancelthumbsdiv">
|
63 |
|
64 |
function kgvid_do_post() {
|
65 |
|
66 |
iincreaser = i + increaser;
|
67 |
|
68 |
-
jQuery.post(ajaxurl, { action:"kgvid_callffmpeg", security: kgflashmediaplayersecurity, movieurl: attachmentURL, numberofthumbs: howmanythumbs, thumbnumber:i, thumbnumberplusincreaser:iincreaser, ffmpeg_action: 'generate', attachmentID: postID, generate_button: buttonPushed, thumbtimecode: specifictimecode, dofirstframe: firstframethumb, poster: posterurl }, function(data) {
|
69 |
-
|
70 |
kgthumbnailTimeout = jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts") || null;
|
71 |
jQuery(thumbnailboxID).append(data.thumbnaildisplaycode);
|
72 |
var thumbnailselectID = "#attachments-"+postID+"-thumb"+i;
|
73 |
jQuery(thumbnailselectID).css({display:"none"});
|
74 |
-
jQuery(thumbnailselectID).animate({opacity: 'toggle', height: 'toggle', width: 'toggle'}, 1000);
|
75 |
if (data.lastthumbnumber == "break" || (kgthumbnailTimeout == null && i != 1) ) { i = parseInt(howmanythumbs) + 1; }
|
76 |
else { i = parseInt(data.lastthumbnumber); }
|
77 |
increaser++;
|
@@ -83,26 +248,212 @@ function kgvid_generate_thumb(postID, buttonPushed) {
|
|
83 |
}, 750);
|
84 |
jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts", kgthumbnailTimeout);
|
85 |
}
|
86 |
-
else {
|
87 |
jQuery(thumbnailboxoverlayID).fadeTo(2000, 1);
|
88 |
-
jQuery(cancelthumbdivID).animate({opacity:
|
89 |
jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts", null);
|
|
|
|
|
90 |
}
|
91 |
|
92 |
kgvid_aspect = data.movie_height/data.movie_width;
|
93 |
document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-aspect]')[0].value = kgvid_aspect;
|
94 |
if (parseInt(data.movie_width) < parseInt(document.getElementsByName(maxwidthID)[0].value) ) { document.getElementById(widthID).value = data.movie_width; }
|
95 |
else { document.getElementById(widthID).value = document.getElementsByName(maxwidthID)[0].value; }
|
96 |
-
if (parseInt(data.movie_width) > parseInt(document.getElementsByName(maxwidthID)[0].value) ) { document.getElementById(heightID).value = Math.round(kgvid_aspect*parseInt(document.getElementsByName(maxwidthID)[0].value)); }
|
97 |
else { document.getElementById(heightID).value = data.movie_height; }
|
98 |
-
jQuery.post( ajaxurl , { action:"kgvid_schedule_cleanup_generated_files", security:kgflashmediaplayersecurity, thumbs:"true" } );
|
99 |
kgvid_redraw_encode_checkboxes(attachmentURL, postID, page);
|
100 |
|
101 |
}, "json");
|
102 |
|
103 |
}// end kgvid_do_post function
|
104 |
|
105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
}
|
107 |
|
108 |
function kgvid_enqueue_video_encode(postID) {
|
@@ -114,29 +465,29 @@ function kgvid_enqueue_video_encode(postID) {
|
|
114 |
var encodeplaceholderid = "#attachments-"+postID+"-encodeplaceholder";
|
115 |
var encodeprogressplaceholderid = "#attachments-"+postID+"-encodeprogressplaceholder";
|
116 |
|
117 |
-
var page = "attachment";
|
118 |
var document_url = document.URL;
|
119 |
var page_check = /[?&]page=([^&]+)/i;
|
120 |
var match = page_check.exec(document_url);
|
121 |
if (match != null) {
|
122 |
page = "queue";
|
123 |
}
|
124 |
-
|
125 |
-
var formats = new Array("
|
126 |
var kgvid_encode = new Object();
|
127 |
jQuery.each(formats, function(key,formats) {
|
128 |
kgvid_encode[formats] = "";
|
129 |
-
if ( jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+formats).length > 0) {
|
130 |
kgvid_encode[formats] = document.getElementById('attachments-'+postID+'-kgflashmediaplayer-encode'+formats).checked;
|
131 |
}
|
132 |
});
|
133 |
JSON.stringify(kgvid_encode);
|
134 |
-
|
135 |
jQuery(encodeplaceholderid).empty();
|
136 |
jQuery(encodeprogressplaceholderid).empty();
|
137 |
jQuery(encodeplaceholderid).append('<strong>Loading...</strong>');
|
138 |
-
|
139 |
-
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) {
|
140 |
|
141 |
jQuery(encodeplaceholderid).empty();
|
142 |
jQuery(encodeprogressplaceholderid).empty();
|
@@ -147,7 +498,7 @@ function kgvid_enqueue_video_encode(postID) {
|
|
147 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').css('opacity', '0.5');
|
148 |
kgvid_redraw_encode_checkboxes(attachmentURL, postID, page);
|
149 |
}, "json");
|
150 |
-
|
151 |
}, "json");
|
152 |
}
|
153 |
|
@@ -159,20 +510,29 @@ function kgvid_hide_standard_wordpress_display_settings(postID) {
|
|
159 |
|
160 |
function kgvid_change_singleurl(url, basename, oldbasename) {
|
161 |
|
162 |
-
jQuery('#kgvid-form :input').each(function(){
|
163 |
var newid = jQuery(this).attr("id").replace(oldbasename, basename);
|
164 |
-
jQuery(this).attr("id", newid);
|
165 |
-
if ( jQuery(this).attr("name") ) {
|
166 |
var newname = jQuery(this).attr("name").replace(oldbasename, basename);
|
167 |
jQuery(this).attr("name", newname);
|
168 |
}
|
169 |
});
|
170 |
jQuery('#kgflashmediaplayer-table').data("kgvid_attachment_id", basename);
|
171 |
-
document.getElementById('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
document.getElementById('attachments-'+oldbasename+'-thumbnailplaceholder').id = 'attachments-'+basename+'-thumbnailplaceholder';
|
|
|
|
|
173 |
jQuery('#attachments-'+basename+'-thumbgenerate').replaceWith('<input type="button" id="attachments-'+basename+'-thumbgenerate" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kgvid_generate_thumb(\''+basename+'\', \'generate\');" >');
|
174 |
jQuery('#attachments-'+basename+'-thumbrandomize').replaceWith('<input type="button" id="attachments-'+basename+'-thumbrandomize" class="button-secondary" value="Randomize" name="thumbgenerate" onclick="kgvid_generate_thumb(\''+basename+'\', \'random\');" >');
|
175 |
-
|
176 |
|
177 |
if ( document.getElementById('attachments-'+basename+'-kgflashmediaplayer-ffmpegexists').value == "on" ) {
|
178 |
document.getElementById('attachments-'+basename+'-thumbgenerate').disabled = false;
|
@@ -202,9 +562,9 @@ function kgvid_set_singleurl() {
|
|
202 |
var extensionExists = false;
|
203 |
|
204 |
if ( url.length > 0 ) {
|
205 |
-
|
206 |
for (var i = 0; i < validExtensions.length; i++) {
|
207 |
-
if (url.indexOf(validExtensions[i]) != -1) {
|
208 |
extensionExists = true;
|
209 |
jQuery.post(ajaxurl, { action:"kgvid_sanitize_url", security: kgflashmediaplayersecurity, movieurl: url }, function(data) {
|
210 |
basename = data.singleurl_id;
|
@@ -217,8 +577,8 @@ function kgvid_set_singleurl() {
|
|
217 |
}
|
218 |
}
|
219 |
}
|
220 |
-
|
221 |
-
if (extensionExists == false) {
|
222 |
if ( url != "" ) { alert("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."); }
|
223 |
basename = "singleurl";
|
224 |
kgvid_change_singleurl(url, basename, oldbasename);
|
@@ -231,7 +591,7 @@ function kgvid_set_singleurl() {
|
|
231 |
document.getElementById('insertonlybutton').disabled = true;
|
232 |
document.getElementById('insertonlybutton').title = "Please enter a valid video URL";
|
233 |
}
|
234 |
-
|
235 |
}
|
236 |
|
237 |
function kgvid_insert_shortcode() {
|
@@ -240,9 +600,11 @@ function kgvid_insert_shortcode() {
|
|
240 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+basename+'][kgflashmediaplayer-security]')[0].value;
|
241 |
var url = document.getElementById('attachments-'+basename+'-kgflashmediaplayer-url').value;
|
242 |
var posterurl = document.getElementById('attachments-'+basename+'-kgflashmediaplayer-poster').value;
|
243 |
-
var postid = parent.document.getElementById('post_ID').value
|
|
|
|
|
244 |
|
245 |
-
jQuery.post(ajaxurl, { action:'kgvid_callffmpeg', security: kgflashmediaplayersecurity, attachmentID: basename, movieurl: url, ffmpeg_action:'submit', poster: posterurl, parent_id: postid }, function(data) {
|
246 |
//jQuery('attachments-singleurl-thumbnailplaceholder').empty();
|
247 |
}, "json" );
|
248 |
|
@@ -296,7 +658,7 @@ function kgvid_cancel_encode(kgvid_pid, postID, video_key, format) {
|
|
296 |
function kgvid_delete_video(movieurl, postID, format, childID) {
|
297 |
|
298 |
var delete_for_sure = confirm("You are about to permanently delete the encoded video.\n 'Cancel' to stop, 'OK' to delete.");
|
299 |
-
|
300 |
if ( delete_for_sure == true ) {
|
301 |
|
302 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+format).removeAttr('disabled');
|
@@ -305,159 +667,310 @@ function kgvid_delete_video(movieurl, postID, format, childID) {
|
|
305 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-meta'+format).empty();
|
306 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-meta'+format).append('<strong>Deleted</strong>');
|
307 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-security]')[0].value;
|
308 |
-
|
309 |
jQuery.post(ajaxurl, { action: "kgvid_delete_video", security: kgflashmediaplayersecurity, movieurl: movieurl, postid: postID, format: format, childid: childID }, function(data) {
|
310 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+format).change();
|
311 |
}, "json" );
|
312 |
-
|
313 |
}
|
314 |
}
|
315 |
|
316 |
function kgvid_cancel_thumbs(postID) {
|
|
|
317 |
var thumbnailplaceholderid = "#attachments-"+postID+"-thumbnailplaceholder";
|
318 |
var thumbnailboxoverlayID = "#attachments-"+postID+"-kgflashmediaplayer-thumbnailboxoverlay";
|
319 |
var cancelthumbdivID = '#attachments-'+postID+'-kgflashmediaplayer-cancelthumbsdiv';
|
320 |
var kgthumbnailTimeout = jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts");
|
321 |
-
|
322 |
for( key in kgthumbnailTimeout ){ clearTimeout(kgthumbnailTimeout[key]); }
|
323 |
-
|
|
|
324 |
jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts", null);
|
|
|
325 |
jQuery(thumbnailboxoverlayID).fadeTo(2000, 1);
|
326 |
-
jQuery(cancelthumbdivID).animate({opacity: 0}, 500);
|
327 |
-
|
328 |
}
|
329 |
|
330 |
function kgvid_redraw_encode_checkboxes(movieurl, postID, page) {
|
331 |
-
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-security]')[0].value;
|
332 |
-
|
333 |
-
var formats = new Array("rotated", "1080", "720", "mobile", "ogg", "webm");
|
334 |
-
var kgvid_encode = new Object();
|
335 |
-
jQuery.each(formats, function(key,formats) {
|
336 |
-
kgvid_encode[formats] = "";
|
337 |
-
if ( jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+formats).length > 0) {
|
338 |
-
kgvid_encode[formats] = document.getElementById('attachments-'+postID+'-kgflashmediaplayer-encode'+formats).checked;
|
339 |
-
}
|
340 |
-
});
|
341 |
-
JSON.stringify(kgvid_encode);
|
342 |
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
353 |
}
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
} */
|
361 |
-
}, "json" );
|
362 |
}
|
363 |
|
364 |
-
function kgvid_encode_queue(action, order) {
|
365 |
|
366 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments[kgflashmediaplayer-security]')[0].value;
|
367 |
-
|
368 |
var CheckboxTimeout = jQuery('#wpwrap').data("KGVIDCheckboxTimeout") || null;
|
369 |
if ( CheckboxTimeout ) { clearTimeout(CheckboxTimeout); }
|
370 |
|
371 |
if ( action == "delete" ) {
|
|
|
372 |
jQuery.post(ajaxurl, { action:"kgvid_clear_queue_entry", security: kgflashmediaplayersecurity, index: order }, function(data) {
|
373 |
jQuery('table.widefat > tbody').replaceWith("<tbody class='rows'>"+data+"</tbody>");
|
374 |
}, "html" );
|
375 |
}
|
376 |
-
|
377 |
-
if ( action == "clear_completed" ) {
|
|
|
378 |
jQuery.post(ajaxurl, { action:"kgvid_clear_completed_queue", security: kgflashmediaplayersecurity }, function(data) {
|
379 |
jQuery('table.widefat > tbody').replaceWith("<tbody class='rows'>"+data+"</tbody>");
|
380 |
-
}, "html" );
|
381 |
}
|
382 |
|
383 |
}
|
384 |
|
385 |
function kgvid_save_plugin_settings(input_obj) {
|
386 |
-
jQuery('#setting-error-options-reset').fadeOut() //if settings were reset, clear the warning
|
387 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
388 |
var setting_value = input_obj.value;
|
389 |
-
|
390 |
if ( input_obj.type == "checkbox" ) {
|
391 |
if ( input_obj.checked ) { setting_value = "on"; }
|
392 |
else { setting_value = false; }
|
393 |
}
|
|
|
394 |
jQuery('.settings-error').fadeOut(); //clear error messages
|
395 |
-
|
396 |
-
var save_span = '<span class="settings-save-status kgvid_spinner"><span class="spinner" style="display:inline-block;"></span><span class="saved" style="display:none;">Saved.</span></span>';
|
397 |
if ( jQuery(input_obj).parents(".kgvid_video_app_required").length ) { jQuery(input_obj).parents(".kgvid_video_app_required").append(save_span); }
|
398 |
else { jQuery(input_obj).parents("td:first").append(save_span); }
|
399 |
-
|
400 |
-
jQuery.
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
}
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
save_timeout = setTimeout(function(){ jQuery('.settings-save-status').remove(); jQuery( '#wpbody-content' ).removeData('saving'); },1500);
|
420 |
-
jQuery( '#wpbody-content' ).data('saving', save_timeout);
|
421 |
-
}, "json" );
|
422 |
}
|
423 |
|
424 |
function kgvid_hide_plugin_settings() {
|
425 |
|
426 |
var playback_option = jQuery('#embed_method').val();
|
427 |
var ffmpeg_exists = jQuery('#app_path').data('ffmpeg_exists');
|
428 |
-
|
429 |
-
|
|
|
|
|
430 |
jQuery("table:contains(XML configuration file)").hide();
|
431 |
jQuery("h3:contains(The following options will only affect Flash playback)").hide();
|
432 |
}
|
433 |
-
if (playback_option == "Strobe Media Playback") {
|
434 |
-
jQuery("table:contains(
|
435 |
jQuery("h3:contains(The following options will only affect Flash playback)").show();
|
436 |
}
|
437 |
-
|
|
|
|
|
|
|
|
|
|
|
438 |
if ( ffmpeg_exists == "notinstalled" ) {
|
439 |
jQuery(".kgvid_video_app_required").addClass("kgvid_thumbnail_overlay");
|
440 |
jQuery(".kgvid_video_app_required").attr('title', 'FFMPEG or LIBAV required for these functions');
|
441 |
-
jQuery(".kgvid_video_app_required input").attr('disabled', 'disabled');
|
442 |
-
|
|
|
443 |
}
|
444 |
if ( ffmpeg_exists == "on" ) {
|
445 |
jQuery(".kgvid_video_app_required").removeClass("kgvid_thumbnail_overlay");
|
446 |
-
jQuery(".kgvid_video_app_required input").removeAttr('disabled');
|
447 |
jQuery(".kgvid_video_app_required").removeAttr('title');
|
|
|
448 |
}
|
449 |
}
|
450 |
|
451 |
function kgvid_hide_ffmpeg_settings() {
|
452 |
|
453 |
var video_app = jQuery('#video_app').val();
|
454 |
-
|
455 |
if (video_app == "ffmpeg") {
|
456 |
-
jQuery("tr:contains(FFMPEG
|
457 |
}
|
458 |
if (video_app == "avconv") {
|
459 |
-
jQuery("tr:contains(FFMPEG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
460 |
}
|
|
|
461 |
}
|
462 |
|
463 |
function kgvid_set_all_featured() {
|
@@ -501,13 +1014,72 @@ function kgvid_check_cms_progress(total, cms_type) {
|
|
501 |
jQuery.post(ajaxurl, { action: "kgvid_update_cms_progress", security: kgflashmediaplayersecurity, total: total, cms_type: cms_type }, function(remaining) {
|
502 |
var percent_done = Math.round(parseInt(total-remaining)/parseInt(total)*100)+'%';
|
503 |
jQuery('#'+cms_type+'_meter .kgvid_meter_bar').css('width', percent_done);
|
504 |
-
jQuery('#'+cms_type+'_meter .kgvid_meter_text').html(total-remaining+'/'+total)
|
505 |
if ( remaining == 0 ) {
|
506 |
-
clearInterval(interval);
|
507 |
jQuery( '#wpbody-content' ).data(cms_type+'_interval', '');
|
508 |
jQuery( '#'+cms_type+'_status' ).html(' Complete');
|
509 |
setTimeout(function(){ jQuery('#'+cms_type+'_meter, #'+cms_type+'_status').fadeOut("normal", function(){ jQuery(this).remove(); }); }, 3000);
|
510 |
}
|
511 |
}, "text" );
|
512 |
}
|
513 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
document.getElementById('attachments-'+postID+'-thumbgenerate').disabled = true;
|
10 |
document.getElementById('attachments-'+postID+'-thumbrandomize').disabled = true;
|
11 |
}
|
12 |
+
|
13 |
if (event == "onchange") {
|
14 |
document.getElementById('attachments-'+postID+'-thumbgenerate').value = "Wait";
|
15 |
document.getElementById('attachments-'+postID+'-thumbrandomize').value = "Wait";
|
22 |
var changeaspect = kgvid_aspect;
|
23 |
if (valuetochange == "width") { changeaspect = 1/kgvid_aspect; }
|
24 |
var changedvalue = Math.round(currentvalue*changeaspect);
|
25 |
+
if (document.getElementById('attachments-'+postID+'-kgflashmediaplayer-lockaspect').checked == true && changedvalue != 0) {
|
26 |
+
document.getElementById('attachments-'+postID+'-kgflashmediaplayer-'+valuetochange).value = changedvalue;
|
27 |
}
|
28 |
}
|
29 |
|
30 |
function kgvid_set_aspect(postID, checked) {
|
31 |
+
if (checked) { document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-aspect]')[0].value = document.getElementById('attachments-'+postID+'-kgflashmediaplayer-height').value / document.getElementById('attachments-'+postID+'-kgflashmediaplayer-width').value;
|
32 |
}
|
33 |
}
|
34 |
|
35 |
+
function kgvid_convert_to_timecode(time) {
|
36 |
+
|
37 |
+
var minutes = Math.floor(time / 60);
|
38 |
+
var seconds = Math.round((time - (minutes * 60))*100)/100;
|
39 |
+
if (minutes < 10) {minutes = "0"+minutes;}
|
40 |
+
if (seconds < 10) {seconds = "0"+seconds;}
|
41 |
+
var time_display = minutes+':'+seconds;
|
42 |
+
return time_display;
|
43 |
+
|
44 |
+
}
|
45 |
+
|
46 |
+
function kgvid_convert_from_timecode(timecode) {
|
47 |
+
|
48 |
+
var timecode_array = timecode.split(":");
|
49 |
+
timecode_array = timecode_array.reverse();
|
50 |
+
if ( timecode_array[1] ) { timecode_array[1] = timecode_array[1] * 60; }
|
51 |
+
if ( timecode_array[2] ) { timecode_array[2] = timecode_array[2] * 3600; }
|
52 |
+
var thumbtimecode = 0;
|
53 |
+
jQuery.each(timecode_array,function() {
|
54 |
+
thumbtimecode += parseFloat(this);
|
55 |
+
});
|
56 |
+
return thumbtimecode;
|
57 |
+
|
58 |
+
}
|
59 |
+
|
60 |
+
function kgvid_thumb_video_loaded(postID) { //sets up mini custom player for making thumbnails
|
61 |
+
|
62 |
+
jQuery('#attachments-'+postID+'-thumbgenerate').prop('disabled', false).attr('title', '');
|
63 |
+
jQuery('#attachments-'+postID+'-thumbrandomize').prop('disabled', false).attr('title', '');
|
64 |
+
jQuery('#attachments-'+postID+'-numberofthumbs').prop('disabled', false).attr('title', '');
|
65 |
+
|
66 |
+
jQuery('#thumb-video-'+postID+'-container').show();
|
67 |
+
|
68 |
+
var video = document.getElementById('thumb-video-'+postID);
|
69 |
+
|
70 |
+
if ( video != null ) {
|
71 |
+
|
72 |
+
if ( typeof wp !== 'undefined' ) {
|
73 |
+
ed_id = wp.media.editor.id();
|
74 |
+
var ed_media = wp.media.editor.get( ed_id ); // Then we try to first get the editor
|
75 |
+
ed_media = 'undefined' != typeof( ed_media ) ? ed_media : wp.media.editor.add( ed_id ); // If it hasn't been created yet, we create it
|
76 |
+
|
77 |
+
var kgvid_break_video_on_close = function() {
|
78 |
+
|
79 |
+
if ( jQuery('#show-thumb-video-'+postID+' :nth-child(2)').html() == "Hide video..." ) {
|
80 |
+
kgvid_reveal_thumb_video(postID); //hide the video if it's open
|
81 |
+
}
|
82 |
+
video.preload = "none";
|
83 |
+
video.src = "";
|
84 |
+
video.load();
|
85 |
+
};
|
86 |
+
|
87 |
+
if ( ed_media ) {
|
88 |
+
ed_media.on('escape', kgvid_break_video_on_close);
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
video.removeAttribute("controls");
|
93 |
+
video.muted=true;
|
94 |
+
var playButton = jQuery(".kgvid-play-pause");
|
95 |
+
var seekBar = jQuery(".kgvid-seek-bar");
|
96 |
+
var playProgress = jQuery(".kgvid-play-progress");
|
97 |
+
var seekHandle = jQuery(".kgvid-seek-handle");
|
98 |
+
|
99 |
+
playButton.on("click", function() {
|
100 |
+
if (video.paused == true) {
|
101 |
+
// Play the video
|
102 |
+
video.play();
|
103 |
+
|
104 |
+
} else {
|
105 |
+
// Pause the video
|
106 |
+
video.pause();
|
107 |
+
}
|
108 |
+
});
|
109 |
+
|
110 |
+
video.addEventListener('play', function() {
|
111 |
+
playButton.addClass('kgvid-playing');
|
112 |
+
});
|
113 |
+
|
114 |
+
video.addEventListener('pause', function() {
|
115 |
+
playButton.removeClass('kgvid-playing');
|
116 |
+
});
|
117 |
+
|
118 |
+
//update HTML5 video current play time
|
119 |
+
video.addEventListener('timeupdate', function() {
|
120 |
+
var currentPos = video.currentTime; //Get currenttime
|
121 |
+
var maxduration = video.duration; //Get video duration
|
122 |
+
var percentage = 100 * currentPos / maxduration; //in %
|
123 |
+
playProgress.css('width', percentage+'%');
|
124 |
+
seekHandle.css('left', percentage+'%');
|
125 |
+
});
|
126 |
+
|
127 |
+
var timeDrag = false; /* Drag status */
|
128 |
+
seekBar.mousedown(function(e) {
|
129 |
+
video.pause();
|
130 |
+
|
131 |
+
timeDrag = true;
|
132 |
+
updatebar(e.pageX);
|
133 |
+
});
|
134 |
+
jQuery(document).mouseup(function(e) {
|
135 |
+
if(timeDrag) {
|
136 |
+
timeDrag = false;
|
137 |
+
updatebar(e.pageX);
|
138 |
+
}
|
139 |
+
});
|
140 |
+
jQuery(document).mousemove(function(e) {
|
141 |
+
if(timeDrag) {
|
142 |
+
updatebar(e.pageX);
|
143 |
+
}
|
144 |
+
});
|
145 |
+
//update Progress Bar control
|
146 |
+
var updatebar = function(x) {
|
147 |
+
var maxduration = video.duration; //Video duraiton
|
148 |
+
var position = x - seekBar.offset().left; //Click pos
|
149 |
+
var percentage = 100 * position / seekBar.width();
|
150 |
+
//Check within range
|
151 |
+
if(percentage > 100) {
|
152 |
+
percentage = 100;
|
153 |
+
}
|
154 |
+
if(percentage < 0) {
|
155 |
+
percentage = 0;
|
156 |
+
}
|
157 |
+
//Update progress bar and video currenttime
|
158 |
+
playProgress.css('width', percentage+'%');
|
159 |
+
seekHandle.css('left', percentage+'%');
|
160 |
+
video.currentTime = maxduration * percentage / 100;
|
161 |
+
};
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
function kgvid_reveal_thumb_video(postID) {
|
166 |
+
jQuery('#show-thumb-video-'+postID+' :first').toggleClass( 'kgvid-down-arrow kgvid-right-arrow' );
|
167 |
+
var text = jQuery('#show-thumb-video-'+postID+' :nth-child(2)');
|
168 |
+
video = document.getElementById('thumb-video-'+postID);
|
169 |
+
|
170 |
+
if ( text.html() == "Choose from video..." ) { //video is being revealed
|
171 |
+
|
172 |
+
jQuery(video).removeAttr('src');
|
173 |
+
jQuery(video).attr("preload", "metadata");
|
174 |
+
video.load();
|
175 |
+
|
176 |
+
if ( video.networkState == 1 || video.networkState == 2 ) {
|
177 |
+
text.html('Hide video...');
|
178 |
+
jQuery('#attachments-'+postID+'-thumbnailplaceholder').empty();
|
179 |
+
jQuery('#thumb-video-'+postID).on('timeupdate.kgvid', function() {
|
180 |
+
if (document.getElementById('thumb-video-'+postID).currentTime != 0) {
|
181 |
+
var thumbtimecode = kgvid_convert_to_timecode(document.getElementById('thumb-video-'+postID).currentTime);
|
182 |
+
jQuery('#attachments-'+postID+'-thumbtime').val(thumbtimecode);
|
183 |
+
}
|
184 |
+
});
|
185 |
+
}
|
186 |
+
else { text.html('Can\'t load video'); }
|
187 |
+
}
|
188 |
+
else { //video is being hidden
|
189 |
+
|
190 |
+
video.pause();
|
191 |
+
jQuery('#thumb-video-'+postID).off('timeupdate.kgvid');
|
192 |
+
text.html('Choose from video...');
|
193 |
+
|
194 |
+
}
|
195 |
+
jQuery('#thumb-video-'+postID+'-player').animate({opacity: 'toggle', height: 'toggle'}, 500);
|
196 |
+
jQuery('#generate-thumb-'+postID+'-container').animate({opacity: 'toggle', height: 'toggle'}, 500);
|
197 |
+
|
198 |
+
}
|
199 |
+
|
200 |
function kgvid_generate_thumb(postID, buttonPushed) {
|
201 |
|
202 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-security]')[0].value;
|
206 |
var posterurl = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-poster]')[0].value;
|
207 |
|
208 |
var specifictimecode = document.getElementsByName('attachments['+postID+'][thumbtime]')[0].value;
|
209 |
+
if (specifictimecode === "0") { specifictimecode = "firstframe"; firstframethumb = true; }
|
210 |
+
if (buttonPushed == "random" || howmanythumbs > 1) { specifictimecode = 0; }
|
211 |
if (specifictimecode != 0 ) { howmanythumbs = 1; }
|
212 |
+
|
|
|
213 |
var thumbnailplaceholderid = "#attachments-"+postID+"-thumbnailplaceholder";
|
214 |
var thumbnailboxID = "#attachments-"+postID+"-kgflashmediaplayer-thumbnailbox";
|
215 |
var thumbnailboxoverlayID = "#attachments-"+postID+"-kgflashmediaplayer-thumbnailboxoverlay";
|
222 |
var increaser = 0;
|
223 |
var iincreaser = 0;
|
224 |
var page = "attachment";
|
225 |
+
|
226 |
jQuery(thumbnailplaceholderid).empty();
|
227 |
+
jQuery(thumbnailplaceholderid).append('<strong>Choose Thumbnail: </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>');
|
228 |
|
229 |
function kgvid_do_post() {
|
230 |
|
231 |
iincreaser = i + increaser;
|
232 |
|
233 |
+
jQuery.post(ajaxurl, { action:"kgvid_callffmpeg", security: kgflashmediaplayersecurity, movieurl: attachmentURL, numberofthumbs: howmanythumbs, thumbnumber:i, thumbnumberplusincreaser:iincreaser, ffmpeg_action: 'generate', attachmentID: postID, generate_button: buttonPushed, thumbtimecode: specifictimecode, dofirstframe: firstframethumb, poster: posterurl }, function(data) {
|
234 |
+
|
235 |
kgthumbnailTimeout = jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts") || null;
|
236 |
jQuery(thumbnailboxID).append(data.thumbnaildisplaycode);
|
237 |
var thumbnailselectID = "#attachments-"+postID+"-thumb"+i;
|
238 |
jQuery(thumbnailselectID).css({display:"none"});
|
239 |
+
jQuery(thumbnailselectID).animate({opacity: 'toggle', height: 'toggle', width: 'toggle'}, 1000);
|
240 |
if (data.lastthumbnumber == "break" || (kgthumbnailTimeout == null && i != 1) ) { i = parseInt(howmanythumbs) + 1; }
|
241 |
else { i = parseInt(data.lastthumbnumber); }
|
242 |
increaser++;
|
248 |
}, 750);
|
249 |
jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts", kgthumbnailTimeout);
|
250 |
}
|
251 |
+
else {
|
252 |
jQuery(thumbnailboxoverlayID).fadeTo(2000, 1);
|
253 |
+
jQuery(cancelthumbdivID).animate({opacity: 'toggle', height: 'toggle'}, 500);
|
254 |
jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts", null);
|
255 |
+
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="Save All Thumbnails" name="attachments-'+postID+'-saveallthumbs" onclick="kgvid_saveall_thumbs(\''+postID+'\');"></div>');
|
256 |
+
jQuery('#attachments-'+postID+'-saveallthumbs').animate({opacity: 'toggle', height: 'toggle'}, 1000);
|
257 |
}
|
258 |
|
259 |
kgvid_aspect = data.movie_height/data.movie_width;
|
260 |
document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-aspect]')[0].value = kgvid_aspect;
|
261 |
if (parseInt(data.movie_width) < parseInt(document.getElementsByName(maxwidthID)[0].value) ) { document.getElementById(widthID).value = data.movie_width; }
|
262 |
else { document.getElementById(widthID).value = document.getElementsByName(maxwidthID)[0].value; }
|
263 |
+
if (parseInt(data.movie_width) > parseInt(document.getElementsByName(maxwidthID)[0].value) ) { document.getElementById(heightID).value = Math.round(kgvid_aspect*parseInt(document.getElementsByName(maxwidthID)[0].value)); }
|
264 |
else { document.getElementById(heightID).value = data.movie_height; }
|
265 |
+
//jQuery.post( ajaxurl , { action:"kgvid_schedule_cleanup_generated_files", security:kgflashmediaplayersecurity, thumbs:"true" } );
|
266 |
kgvid_redraw_encode_checkboxes(attachmentURL, postID, page);
|
267 |
|
268 |
}, "json");
|
269 |
|
270 |
}// end kgvid_do_post function
|
271 |
|
272 |
+
if ( jQuery('#thumb-video-'+postID).data('allowed') == "on" ) {
|
273 |
+
|
274 |
+
video = document.getElementById('thumb-video-'+postID);
|
275 |
+
|
276 |
+
if ( video.preload == "none" ) {
|
277 |
+
jQuery(video).removeAttr('src');
|
278 |
+
jQuery(video).attr("preload", "metadata");
|
279 |
+
video.load();
|
280 |
+
jQuery(video).on( "loadedmetadata.kgvid", function() { kgvid_make_canvas_thumbs_loop(); } );
|
281 |
+
}
|
282 |
+
else { kgvid_make_canvas_thumbs_loop(); }
|
283 |
+
|
284 |
+
function kgvid_make_canvas_thumbs_loop() {
|
285 |
+
|
286 |
+
if (video.networkState == 1 || video.networkState == 2 ) { //if the browser can load the video, use it to make thumbnails
|
287 |
+
|
288 |
+
var video_width = video.videoWidth;
|
289 |
+
var video_height = video.videoHeight;
|
290 |
+
var video_aspect = video_height/video_width;
|
291 |
+
var thumbnails = [];
|
292 |
+
|
293 |
+
jQuery('#thumb-video-'+postID).on('seeked.kgvid', function(){ //when the video is finished seeking
|
294 |
+
|
295 |
+
var thumbnail_saved = jQuery(video).data('thumbnail_data');
|
296 |
+
if ( thumbnail_saved.length > 0 ) { //if there are any thumbnails that haven't been generated
|
297 |
+
|
298 |
+
time_id = Math.round(video.currentTime*100);
|
299 |
+
var time_display = kgvid_convert_to_timecode(video.currentTime);
|
300 |
+
|
301 |
+
jQuery(thumbnailboxID).append('<div style="display:none;" class="kgvid_thumbnail_select" name="attachments['+postID+'][thumb'+time_id+']" id="attachments-'+postID+'-thumb'+time_id+'"><label for="kgflashmedia-'+postID+'-thumbradio'+time_id+'"><canvas class="kgvid_thumbnail" style="width:200px;height:'+Math.round(200*video_aspect)+'px;" id="'+postID+'_thumb_'+time_id+'"></canvas></label><br /><input type="radio" name="attachments['+postID+'][thumbradio'+time_id+']" id="kgflashmedia-'+postID+'-thumbradio'+time_id+'" value="'+video.currentTime+'" onchange="document.getElementById(\'attachments-'+postID+'-thumbtime\').value = \''+time_display+'\'; document.getElementById(\'attachments-'+postID+'-numberofthumbs\').value =\'1\';kgvid_save_canvas_thumb(\''+postID+'\', \''+time_id+'\', 1, 1);"></div>');
|
302 |
+
var canvas = document.getElementById(postID+'_thumb_'+time_id);
|
303 |
+
canvas.width = video_width;
|
304 |
+
canvas.height = video_height;
|
305 |
+
var context = canvas.getContext('2d');
|
306 |
+
context.fillRect(0, 0, video_width, video_height);
|
307 |
+
context.drawImage(video, 0, 0, video_width, video_height);
|
308 |
+
jQuery('#attachments-'+postID+'-thumb'+time_id).animate({opacity: 'toggle', height: 'toggle', width: 'toggle'}, 1000);
|
309 |
+
|
310 |
+
thumbnail_saved.splice(0,1);
|
311 |
+
jQuery(video).data('thumbnail_data', thumbnail_saved);
|
312 |
+
if ( thumbnail_saved.length > 0 ) { video.currentTime = thumbnail_saved[0]; }
|
313 |
+
else {
|
314 |
+
jQuery(video).off('seeked.kgvid');
|
315 |
+
jQuery(video).off('loadedmetadata.kgvid');
|
316 |
+
video.preload="none";
|
317 |
+
video.load();
|
318 |
+
jQuery(thumbnailboxoverlayID).fadeTo(2000, 1);
|
319 |
+
jQuery(cancelthumbdivID).animate({opacity: 0, height: 'toggle'}, 500);
|
320 |
+
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="Save All Thumbnails" name="attachments-'+postID+'-saveallthumbs" onclick="kgvid_saveall_thumbs(\''+postID+'\');"></div>');
|
321 |
+
jQuery('#attachments-'+postID+'-saveallthumbs').animate({opacity: 'toggle', height: 'toggle'}, 500);
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
});
|
326 |
+
|
327 |
+
for (i; i<=howmanythumbs; i++) {
|
328 |
+
iincreaser = i + increaser;
|
329 |
+
increaser++;
|
330 |
+
var movieoffset = Math.round((video.duration * iincreaser) / (howmanythumbs * 2)*100)/100;
|
331 |
+
|
332 |
+
if (buttonPushed == "random") { //adjust offset random amount
|
333 |
+
var random_offset = Math.round(Math.random() * video.duration / howmanythumbs);
|
334 |
+
movieoffset = movieoffset - random_offset;
|
335 |
+
if (movieoffset < 0) { movieoffset = 0; }
|
336 |
+
}
|
337 |
+
|
338 |
+
thumbnails.push(movieoffset); //add offset to array
|
339 |
+
}
|
340 |
+
|
341 |
+
if ( firstframethumb ) { thumbnails[0] = 0; }
|
342 |
+
|
343 |
+
if ( specifictimecode ) {
|
344 |
+
var thumbtimecode = kgvid_convert_from_timecode(specifictimecode);
|
345 |
+
thumbnails = [thumbtimecode];
|
346 |
+
}
|
347 |
+
video.currentTime = thumbnails[0];
|
348 |
+
jQuery(video).data('thumbnail_data', thumbnails);
|
349 |
+
|
350 |
+
}
|
351 |
+
}//end canvas thumb function
|
352 |
+
}
|
353 |
+
else {
|
354 |
+
kgvid_do_post(); //call the FFMPEG loop if the browser can't do it
|
355 |
+
}
|
356 |
+
}
|
357 |
+
|
358 |
+
function kgvid_save_canvas_thumb(postID, time_id, total, index) {
|
359 |
+
|
360 |
+
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-security]')[0].value;
|
361 |
+
|
362 |
+
var video_url = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-url]')[0].value;
|
363 |
+
var canvas = document.getElementById(postID+'_thumb_'+time_id);
|
364 |
+
var png64dataURL = canvas.toDataURL(); //this is what saves the image. Do this after selection.
|
365 |
+
|
366 |
+
jQuery.ajax({
|
367 |
+
type: "POST",
|
368 |
+
url: ajaxurl,
|
369 |
+
data: { action:"kgvid_save_html5_thumb", security: kgflashmediaplayersecurity, raw_png: png64dataURL, url: video_url, offset: time_id, postID: postID, total: total, index: index },
|
370 |
+
async: false
|
371 |
+
})
|
372 |
+
.done( function(thumb_url) {
|
373 |
+
if ( total == 1 ) {
|
374 |
+
jQuery('#attachments-'+postID+'-kgflashmediaplayer-poster').val(thumb_url).change();
|
375 |
+
//jQuery.post( ajaxurl , { action:"kgvid_schedule_cleanup_generated_files", security:kgflashmediaplayersecurity, thumbs:"true" } );
|
376 |
+
}
|
377 |
+
else {
|
378 |
+
kgvid_thumbnail_saveall_progress(postID, total);
|
379 |
+
}
|
380 |
+
}
|
381 |
+
);
|
382 |
+
}
|
383 |
+
|
384 |
+
function kgvid_thumbnail_saveall_progress(postID, total) {
|
385 |
+
|
386 |
+
var percent_add = 100/total;
|
387 |
+
var percent_done = parseInt(jQuery('#saving_thumbs_meter .kgvid_meter_bar')[0].style.width)+percent_add;
|
388 |
+
var number = Math.round(percent_done/percent_add);
|
389 |
+
jQuery('#saving_thumbs_meter .kgvid_meter_bar').css('width', percent_done+'%');
|
390 |
+
jQuery('#saving_thumbs_meter .kgvid_meter_text').html(number+'/'+total);
|
391 |
+
|
392 |
+
if ( number == total ) {
|
393 |
+
jQuery('#saveallthumbs-'+postID+'-div').slideUp(1000);
|
394 |
+
}
|
395 |
+
|
396 |
+
}
|
397 |
+
|
398 |
+
function kgvid_saveall_thumbs(postID) {
|
399 |
+
|
400 |
+
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-security]')[0].value;
|
401 |
+
var thumbnails = jQuery('#attachments-'+postID+'-kgflashmediaplayer-thumbnailbox').find('.kgvid_thumbnail');
|
402 |
+
var total = thumbnails.length;
|
403 |
+
|
404 |
+
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"> Saving...</span>');
|
405 |
+
|
406 |
+
jQuery.each(thumbnails, function(key, value) {
|
407 |
+
if ( value.tagName.toLowerCase() == "canvas" ) {
|
408 |
+
var time_id = value.id.split("_").pop();
|
409 |
+
setTimeout( function(time_id, key) {
|
410 |
+
return function() {
|
411 |
+
kgvid_save_canvas_thumb(postID, time_id, total, key);
|
412 |
+
}
|
413 |
+
}(time_id, key), 0);
|
414 |
+
}
|
415 |
+
else { //thumbnails were made by ffmpeg
|
416 |
+
|
417 |
+
thumb_url = value.src.split("?")[0].replace('/thumb_tmp/', '/');
|
418 |
+
|
419 |
+
if ( isNaN(postID) ) { //dealing with an external URL
|
420 |
+
var postid = parent.document.getElementById('post_ID').value;
|
421 |
+
}
|
422 |
+
|
423 |
+
setTimeout( function(thumb_url, key) {
|
424 |
+
return function() {
|
425 |
+
jQuery.ajax({
|
426 |
+
type: "POST",
|
427 |
+
url: ajaxurl,
|
428 |
+
data: { action:'kgvid_save_thumb', security: kgflashmediaplayersecurity, post_id: postID, thumburl: thumb_url, index: key },
|
429 |
+
async: false
|
430 |
+
})
|
431 |
+
.done( function(thumb_url) {
|
432 |
+
kgvid_thumbnail_saveall_progress(postID, total);
|
433 |
+
}
|
434 |
+
);
|
435 |
+
}
|
436 |
+
}(thumb_url, key), 0);
|
437 |
+
}
|
438 |
+
}); //end each loop
|
439 |
+
}
|
440 |
+
|
441 |
+
function kgvid_thumb_video_manual(postID) {
|
442 |
+
|
443 |
+
var video = document.getElementById('thumb-video-'+postID);
|
444 |
+
var video_aspect = video.videoHeight/video.videoWidth;
|
445 |
+
var time_id = Math.round(video.currentTime);
|
446 |
+
var time_display = kgvid_convert_to_timecode(video.currentTime);
|
447 |
+
document.getElementById('attachments-'+postID+'-thumbtime').value = time_display;
|
448 |
+
jQuery("#attachments-"+postID+"-thumbnailplaceholder").html('<div class="kgvid_thumbnail_box kgvid_chosen_thumbnail_box"><canvas style="height:'+Math.round(200*video_aspect)+'px;" id="'+postID+'_thumb_'+time_id+'"></canvas></div>');
|
449 |
+
var canvas = document.getElementById(postID+'_thumb_'+time_id);
|
450 |
+
canvas.width = video.videoWidth;
|
451 |
+
canvas.height = video.videoHeight;
|
452 |
+
var context = canvas.getContext('2d');
|
453 |
+
context.fillRect(0, 0, video.videoWidth, video.videoHeight);
|
454 |
+
context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
|
455 |
+
kgvid_save_canvas_thumb(postID, time_id, 1, 1);
|
456 |
+
|
457 |
}
|
458 |
|
459 |
function kgvid_enqueue_video_encode(postID) {
|
465 |
var encodeplaceholderid = "#attachments-"+postID+"-encodeplaceholder";
|
466 |
var encodeprogressplaceholderid = "#attachments-"+postID+"-encodeprogressplaceholder";
|
467 |
|
468 |
+
var page = "attachment";
|
469 |
var document_url = document.URL;
|
470 |
var page_check = /[?&]page=([^&]+)/i;
|
471 |
var match = page_check.exec(document_url);
|
472 |
if (match != null) {
|
473 |
page = "queue";
|
474 |
}
|
475 |
+
|
476 |
+
var formats = new Array("fullres", "1080", "720", "mobile", "ogg", "webm");
|
477 |
var kgvid_encode = new Object();
|
478 |
jQuery.each(formats, function(key,formats) {
|
479 |
kgvid_encode[formats] = "";
|
480 |
+
if ( jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+formats).length > 0) {
|
481 |
kgvid_encode[formats] = document.getElementById('attachments-'+postID+'-kgflashmediaplayer-encode'+formats).checked;
|
482 |
}
|
483 |
});
|
484 |
JSON.stringify(kgvid_encode);
|
485 |
+
|
486 |
jQuery(encodeplaceholderid).empty();
|
487 |
jQuery(encodeprogressplaceholderid).empty();
|
488 |
jQuery(encodeplaceholderid).append('<strong>Loading...</strong>');
|
489 |
+
|
490 |
+
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) {
|
491 |
|
492 |
jQuery(encodeplaceholderid).empty();
|
493 |
jQuery(encodeprogressplaceholderid).empty();
|
498 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').css('opacity', '0.5');
|
499 |
kgvid_redraw_encode_checkboxes(attachmentURL, postID, page);
|
500 |
}, "json");
|
501 |
+
|
502 |
}, "json");
|
503 |
}
|
504 |
|
510 |
|
511 |
function kgvid_change_singleurl(url, basename, oldbasename) {
|
512 |
|
513 |
+
jQuery('#kgvid-form :input').each(function(){
|
514 |
var newid = jQuery(this).attr("id").replace(oldbasename, basename);
|
515 |
+
jQuery(this).attr("id", newid);
|
516 |
+
if ( jQuery(this).attr("name") ) {
|
517 |
var newname = jQuery(this).attr("name").replace(oldbasename, basename);
|
518 |
jQuery(this).attr("name", newname);
|
519 |
}
|
520 |
});
|
521 |
jQuery('#kgflashmediaplayer-table').data("kgvid_attachment_id", basename);
|
522 |
+
/* document.getElementById('thumb-video-'+oldbasename).setAttribute("onloadedmetadata", "kgvid_thumb_video_loaded('"+basename+"')");
|
523 |
+
document.getElementById('thumb-video-'+oldbasename).id = 'thumb-video-'+basename;
|
524 |
+
document.getElementById('manual-thumbnail').setAttribute("onclick", "kgvid_thumb_video_manual('"+basename+"');");
|
525 |
+
document.getElementById('thumb-video-'+oldbasename+'-container').id = 'thumb-video-'+basename+'-container';
|
526 |
+
document.getElementById('show-thumb-video-'+oldbasename).setAttribute("onclick", "kgvid_reveal_thumb_video('"+basename+"');");
|
527 |
+
document.getElementById('show-thumb-video-'+oldbasename).id = 'show-thumb-video-'+basename;
|
528 |
+
document.getElementById('thumb-video-'+oldbasename+'-player').id = 'thumb-video-'+basename+'-player'; */
|
529 |
+
jQuery('#attachments-'+oldbasename+'-kgflashmediaplayer-encodeboxes').attr('id', 'attachments-'+basename+'-kgflashmediaplayer-encodeboxes');
|
530 |
document.getElementById('attachments-'+oldbasename+'-thumbnailplaceholder').id = 'attachments-'+basename+'-thumbnailplaceholder';
|
531 |
+
document.getElementById('attachments-'+basename+'-thumbnailplaceholder').setAttribute("onchange", "document.getElementById('attachments-"+basename+"-thumbtime').value='';");
|
532 |
+
document.getElementById('attachments-'+basename+'-numberofthumbs').setAttribute("onchange", "document.getElementById('attachments-"+basename+"-thumbtime').value='';");
|
533 |
jQuery('#attachments-'+basename+'-thumbgenerate').replaceWith('<input type="button" id="attachments-'+basename+'-thumbgenerate" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kgvid_generate_thumb(\''+basename+'\', \'generate\');" >');
|
534 |
jQuery('#attachments-'+basename+'-thumbrandomize').replaceWith('<input type="button" id="attachments-'+basename+'-thumbrandomize" class="button-secondary" value="Randomize" name="thumbgenerate" onclick="kgvid_generate_thumb(\''+basename+'\', \'random\');" >');
|
535 |
+
|
536 |
|
537 |
if ( document.getElementById('attachments-'+basename+'-kgflashmediaplayer-ffmpegexists').value == "on" ) {
|
538 |
document.getElementById('attachments-'+basename+'-thumbgenerate').disabled = false;
|
562 |
var extensionExists = false;
|
563 |
|
564 |
if ( url.length > 0 ) {
|
565 |
+
|
566 |
for (var i = 0; i < validExtensions.length; i++) {
|
567 |
+
if (url.indexOf(validExtensions[i]) != -1) {
|
568 |
extensionExists = true;
|
569 |
jQuery.post(ajaxurl, { action:"kgvid_sanitize_url", security: kgflashmediaplayersecurity, movieurl: url }, function(data) {
|
570 |
basename = data.singleurl_id;
|
577 |
}
|
578 |
}
|
579 |
}
|
580 |
+
|
581 |
+
if (extensionExists == false) {
|
582 |
if ( url != "" ) { alert("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."); }
|
583 |
basename = "singleurl";
|
584 |
kgvid_change_singleurl(url, basename, oldbasename);
|
591 |
document.getElementById('insertonlybutton').disabled = true;
|
592 |
document.getElementById('insertonlybutton').title = "Please enter a valid video URL";
|
593 |
}
|
594 |
+
|
595 |
}
|
596 |
|
597 |
function kgvid_insert_shortcode() {
|
600 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+basename+'][kgflashmediaplayer-security]')[0].value;
|
601 |
var url = document.getElementById('attachments-'+basename+'-kgflashmediaplayer-url').value;
|
602 |
var posterurl = document.getElementById('attachments-'+basename+'-kgflashmediaplayer-poster').value;
|
603 |
+
var postid = parent.document.getElementById('post_ID').value;
|
604 |
+
if ( jQuery('#attachments-'+basename+'-featured').is(':checked') ) { var set_featured = "on"; }
|
605 |
+
else { var set_featured = false; }
|
606 |
|
607 |
+
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) {
|
608 |
//jQuery('attachments-singleurl-thumbnailplaceholder').empty();
|
609 |
}, "json" );
|
610 |
|
658 |
function kgvid_delete_video(movieurl, postID, format, childID) {
|
659 |
|
660 |
var delete_for_sure = confirm("You are about to permanently delete the encoded video.\n 'Cancel' to stop, 'OK' to delete.");
|
661 |
+
|
662 |
if ( delete_for_sure == true ) {
|
663 |
|
664 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+format).removeAttr('disabled');
|
667 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-meta'+format).empty();
|
668 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-meta'+format).append('<strong>Deleted</strong>');
|
669 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments['+postID+'][kgflashmediaplayer-security]')[0].value;
|
670 |
+
|
671 |
jQuery.post(ajaxurl, { action: "kgvid_delete_video", security: kgflashmediaplayersecurity, movieurl: movieurl, postid: postID, format: format, childid: childID }, function(data) {
|
672 |
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+format).change();
|
673 |
}, "json" );
|
674 |
+
|
675 |
}
|
676 |
}
|
677 |
|
678 |
function kgvid_cancel_thumbs(postID) {
|
679 |
+
|
680 |
var thumbnailplaceholderid = "#attachments-"+postID+"-thumbnailplaceholder";
|
681 |
var thumbnailboxoverlayID = "#attachments-"+postID+"-kgflashmediaplayer-thumbnailboxoverlay";
|
682 |
var cancelthumbdivID = '#attachments-'+postID+'-kgflashmediaplayer-cancelthumbsdiv';
|
683 |
var kgthumbnailTimeout = jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts");
|
684 |
+
|
685 |
for( key in kgthumbnailTimeout ){ clearTimeout(kgthumbnailTimeout[key]); }
|
686 |
+
jQuery('#thumb-video-'+postID).off('seeked.kgvid');
|
687 |
+
jQuery('#thumb-video-'+postID).data('thumbnail_data', []);
|
688 |
jQuery(thumbnailplaceholderid).data("kgthumbnailTimeouts", null);
|
689 |
+
|
690 |
jQuery(thumbnailboxoverlayID).fadeTo(2000, 1);
|
691 |
+
jQuery(cancelthumbdivID).animate({opacity: 0, height: 'toggle'}, 500);
|
692 |
+
|
693 |
}
|
694 |
|
695 |
function kgvid_redraw_encode_checkboxes(movieurl, postID, page) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
696 |
|
697 |
+
var kgflashmediaplayersecurity = jQuery('#attachments-'+postID+'-kgflashmediaplayer-security').val();
|
698 |
+
|
699 |
+
if ( kgflashmediaplayersecurity ) { //sometimes this tries to run after the media modal is closed
|
700 |
+
|
701 |
+
var formats = new Array("fullres", "1080", "720", "mobile", "ogg", "webm");
|
702 |
+
var kgvid_encode = new Object();
|
703 |
+
jQuery.each(formats, function(key,formats) {
|
704 |
+
kgvid_encode[formats] = "";
|
705 |
+
if ( jQuery('#attachments-'+postID+'-kgflashmediaplayer-encode'+formats).length > 0) {
|
706 |
+
kgvid_encode[formats] = document.getElementById('attachments-'+postID+'-kgflashmediaplayer-encode'+formats).checked;
|
707 |
+
}
|
708 |
+
});
|
709 |
+
JSON.stringify(kgvid_encode);
|
710 |
+
|
711 |
+
jQuery.post(ajaxurl, { action:"kgvid_generate_encode_checkboxes", security: kgflashmediaplayersecurity, movieurl: movieurl, post_id: postID, page: page, encodeformats: kgvid_encode }, function(data) {
|
712 |
+
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').empty();
|
713 |
+
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').append(data.embed_display);
|
714 |
+
if ( page == "queue" ) {
|
715 |
+
jQuery('#tr_'+postID+'.currently_encoding').removeClass('currently_encoding');
|
716 |
+
jQuery('#tr_'+postID+'.currently_encoding #clear_'+postID).css("display", "block");
|
717 |
+
if ( data.embed_display.indexOf('Encoding</strong>') >= 0) {
|
718 |
+
jQuery('#clear_'+postID).css("display", "none");
|
719 |
+
jQuery('#tr_'+postID).addClass('currently_encoding');
|
720 |
+
}
|
721 |
}
|
722 |
+
jQuery('#attachments-'+postID+'-kgflashmediaplayer-encodeboxes').removeAttr('style');
|
723 |
+
}, "json" );
|
724 |
+
}
|
725 |
+
}
|
726 |
+
|
727 |
+
function kgvid_redraw_thumbnail_box(postID) {
|
728 |
+
|
729 |
+
var kgflashmediaplayersecurity = jQuery('#attachments-'+postID+'-kgflashmediaplayer-security').val();
|
730 |
+
|
731 |
+
if ( kgflashmediaplayersecurity ) {
|
732 |
+
|
733 |
+
jQuery.post(ajaxurl, { action:"kgvid_redraw_thumbnail_box", security: kgflashmediaplayersecurity, post_id: postID }, function(thumbnail_url) {
|
734 |
+
if ( thumbnail_url ) {
|
735 |
+
jQuery('#attachments-'+postID+'-thumbnailplaceholder').html('<div class="kgvid_thumbnail_box kgvid_chosen_thumbnail_box"><img width="200" src="'+thumbnail_url+'"></div>');
|
736 |
}
|
737 |
+
|
738 |
+
else { setTimeout(function(){ kgvid_redraw_thumbnail_box(postID) }, 5000); }
|
739 |
+
|
740 |
+
}, "text" );
|
741 |
+
|
742 |
+
}
|
|
|
|
|
743 |
}
|
744 |
|
745 |
+
function kgvid_encode_queue(action, order, id) {
|
746 |
|
747 |
var kgflashmediaplayersecurity = document.getElementsByName('attachments[kgflashmediaplayer-security]')[0].value;
|
748 |
+
|
749 |
var CheckboxTimeout = jQuery('#wpwrap').data("KGVIDCheckboxTimeout") || null;
|
750 |
if ( CheckboxTimeout ) { clearTimeout(CheckboxTimeout); }
|
751 |
|
752 |
if ( action == "delete" ) {
|
753 |
+
jQuery('#tr_'+id).fadeTo('slow', 0.5);
|
754 |
jQuery.post(ajaxurl, { action:"kgvid_clear_queue_entry", security: kgflashmediaplayersecurity, index: order }, function(data) {
|
755 |
jQuery('table.widefat > tbody').replaceWith("<tbody class='rows'>"+data+"</tbody>");
|
756 |
}, "html" );
|
757 |
}
|
758 |
+
|
759 |
+
if ( action == "clear_completed" ) {
|
760 |
+
jQuery('tbody > .kgvid_complete').fadeTo('slow', 0.5);
|
761 |
jQuery.post(ajaxurl, { action:"kgvid_clear_completed_queue", security: kgflashmediaplayersecurity }, function(data) {
|
762 |
jQuery('table.widefat > tbody').replaceWith("<tbody class='rows'>"+data+"</tbody>");
|
763 |
+
}, "html" );
|
764 |
}
|
765 |
|
766 |
}
|
767 |
|
768 |
function kgvid_save_plugin_settings(input_obj) {
|
769 |
+
jQuery('#setting-error-options-reset').fadeOut() //if settings were reset previously, clear the warning
|
770 |
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
771 |
var setting_value = input_obj.value;
|
772 |
+
|
773 |
if ( input_obj.type == "checkbox" ) {
|
774 |
if ( input_obj.checked ) { setting_value = "on"; }
|
775 |
else { setting_value = false; }
|
776 |
}
|
777 |
+
|
778 |
jQuery('.settings-error').fadeOut(); //clear error messages
|
779 |
+
|
780 |
+
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>';
|
781 |
if ( jQuery(input_obj).parents(".kgvid_video_app_required").length ) { jQuery(input_obj).parents(".kgvid_video_app_required").append(save_span); }
|
782 |
else { jQuery(input_obj).parents("td:first").append(save_span); }
|
783 |
+
|
784 |
+
if ( jQuery(input_obj).hasClass('affects_ffmpeg') == true ) { jQuery('#ffmpeg_h264_sample,#ffmpeg_output').html('Saving...'); }
|
785 |
+
|
786 |
+
function kgvid_ajax_save() {
|
787 |
+
|
788 |
+
var all_settings = jQuery('form').serialize();
|
789 |
+
|
790 |
+
jQuery.post(ajaxurl, { action:"kgvid_save_settings", security: kgflashmediaplayersecurity, setting: save_queue[0].id, value: setting_value, all_settings: all_settings }, function(data) {
|
791 |
+
|
792 |
+
if ( input_obj.type != "checkbox" ) { jQuery(input_obj).val(data.validated_value); }
|
793 |
+
|
794 |
+
if ( data.error_message != "" ) { jQuery(input_obj).parents("td:first").append('<div class="error settings-error"><p><strong>'+data.error_message+'</strong></p>'); }
|
795 |
+
if ( save_queue[0].id == "width" || save_queue[0].id == "height" ) {
|
796 |
+
var dimension = "";
|
797 |
+
if ( save_queue[0].id == "height" ) { dimension = parseInt(data.validated_value) + 25; }
|
798 |
+
else { dimension = data.validated_value }
|
799 |
+
jQuery( '#kgvid_samplevideo' ).attr( save_queue[0].id, dimension);
|
800 |
+
jQuery( '.kgvid_setting_nearvid' ).width( jQuery('#width').val() );
|
801 |
+
}
|
802 |
+
if ( save_queue[0].id == "app_path" || save_queue[0].id == "video_app" ) {
|
803 |
+
jQuery('#app_path').data('ffmpeg_exists', data.ffmpeg_exists)
|
804 |
+
kgvid_hide_plugin_settings();
|
805 |
+
}
|
806 |
+
if ( jQuery(input_obj).hasClass('affects_player') == true ) {
|
807 |
+
jQuery( '#kgvid_samplevideo' ).attr( 'src', function ( i, val ) { return val; }); //reload the video iframe
|
808 |
+
}
|
809 |
+
if ( jQuery('#app_path').data('ffmpeg_exists') == "on" && jQuery(input_obj).hasClass('affects_ffmpeg') == true ) {
|
810 |
+
jQuery('#ffmpeg_output').html('Running test...');
|
811 |
+
jQuery('#ffmpeg_h264_sample').html(data.encode_string);
|
812 |
+
jQuery.post(ajaxurl, { action: "kgvid_test_ffmpeg", security: kgflashmediaplayersecurity, command: data.encode_string }, function(output) {
|
813 |
+
jQuery('#ffmpeg_output').html(output);
|
814 |
+
}, "html" );
|
815 |
+
}
|
816 |
+
|
817 |
+
jQuery( '#save_'+save_queue[0].id+' > .spinner' ).fadeOut(500).delay(500).next().delay(500).fadeIn(500).delay(1500).fadeOut(1000, function(){ jQuery(this).remove(); });
|
818 |
+
|
819 |
+
save_queue = jQuery( '#wpbody-content' ).data('save_queue');
|
820 |
+
save_queue.splice(0,1);
|
821 |
+
jQuery( '#wpbody-content' ).data('save_queue', save_queue);
|
822 |
+
if ( save_queue.length > 0 ) { kgvid_ajax_save(); }
|
823 |
+
|
824 |
+
}, "json" );
|
825 |
+
|
826 |
+
}
|
827 |
+
|
828 |
+
save_queue = jQuery( '#wpbody-content' ).data('save_queue');
|
829 |
+
if ( save_queue == undefined || save_queue.length == 0 ) { var save_queue = [{ 'id':input_obj.id, 'value':setting_value }]; }
|
830 |
+
else { save_queue.push({ 'id':input_obj.id, 'value':setting_value }); }
|
831 |
+
jQuery( '#wpbody-content' ).data('save_queue', save_queue);
|
832 |
+
if ( save_queue.length == 1 ) { kgvid_ajax_save(); }
|
833 |
+
}
|
834 |
+
|
835 |
+
function kgvid_embeddable_switch(checked) {
|
836 |
+
|
837 |
+
var overlay_embedcode = jQuery("#overlay_embedcode");
|
838 |
+
var open_graph = jQuery("#open_graph");
|
839 |
+
|
840 |
+
if (checked == false) {
|
841 |
+
overlay_embedcode[0].checked=false;
|
842 |
+
overlay_embedcode[0].disabled=true;
|
843 |
+
overlay_embedcode.change();
|
844 |
+
open_graph[0].checked=false;
|
845 |
+
open_graph[0].disabled=true;
|
846 |
+
open_graph.change();
|
847 |
+
}
|
848 |
+
else {
|
849 |
+
overlay_embedcode[0].disabled=false;
|
850 |
+
open_graph[0].disabled=false;
|
851 |
+
}
|
852 |
+
}
|
853 |
+
|
854 |
+
function kgvid_switch_settings_tab(tab) {
|
855 |
+
|
856 |
+
if ( tab == "general" ) {
|
857 |
+
|
858 |
+
var playback_option = jQuery('#embed_method').val();
|
859 |
+
|
860 |
+
jQuery("#general_tab").addClass("nav-tab-active");
|
861 |
+
jQuery("#encoding_tab").removeClass("nav-tab-active");
|
862 |
+
jQuery("h3:contains(Default Video Playback Settings)").show();
|
863 |
+
jQuery("table:contains(Video player:)").show();
|
864 |
+
jQuery(".kgvid_setting_nearvid").show();
|
865 |
+
jQuery("table:contains(End of video image)").show();
|
866 |
+
jQuery("h3:contains(Plugin Settings)").show();
|
867 |
+
jQuery("table:contains(Default number of thumbnails to generate)").show();
|
868 |
+
jQuery("h3:contains(Video Encoding Settings)").hide();
|
869 |
+
jQuery("table:contains(Path to applications on server)").hide();
|
870 |
+
}
|
871 |
+
|
872 |
+
if ( tab == "encoding" ) {
|
873 |
+
|
874 |
+
jQuery("#general_tab").removeClass("nav-tab-active");
|
875 |
+
jQuery("#encoding_tab").addClass("nav-tab-active");
|
876 |
+
jQuery("h3:contains(Default Video Playback Settings)").hide();
|
877 |
+
jQuery("table:contains(Video player:)").hide();
|
878 |
+
jQuery(".kgvid_setting_nearvid").hide();
|
879 |
+
jQuery("table:contains(End of video image)").hide();
|
880 |
+
jQuery("h3:contains(Plugin Settings)").hide();
|
881 |
+
jQuery("table:contains(Default number of thumbnails to generate)").hide();
|
882 |
+
jQuery("table:contains(XML configuration file)").hide();
|
883 |
+
jQuery("h3:contains(The following options will only affect Flash playback)").hide();
|
884 |
+
jQuery("h3:contains(Video Encoding Settings)").show();
|
885 |
+
jQuery("table:contains(Path to applications on server)").show();
|
886 |
+
|
887 |
+
if ( jQuery('#app_path').data('ffmpeg_exists') == "on" && jQuery('#ffmpeg_output').html() == "" ) {
|
888 |
+
jQuery('#ffmpeg_output').html('Running test...')
|
889 |
+
var kgflashmediaplayersecurity = document.getElementById("kgvid_settings_security").value;
|
890 |
+
jQuery.post(ajaxurl, { action: "kgvid_test_ffmpeg", security: kgflashmediaplayersecurity, command: jQuery('#ffmpeg_h264_sample').html() }, function(output) {
|
891 |
+
jQuery('#ffmpeg_output').html(output);
|
892 |
+
}, "html" );
|
893 |
}
|
894 |
+
}
|
895 |
+
|
896 |
+
kgvid_hide_plugin_settings();
|
897 |
+
kgvid_hide_ffmpeg_settings();
|
898 |
+
|
|
|
|
|
|
|
899 |
}
|
900 |
|
901 |
function kgvid_hide_plugin_settings() {
|
902 |
|
903 |
var playback_option = jQuery('#embed_method').val();
|
904 |
var ffmpeg_exists = jQuery('#app_path').data('ffmpeg_exists');
|
905 |
+
var general_tab = jQuery('#general_tab').hasClass('nav-tab-active');
|
906 |
+
var encoding_tab = jQuery('#encoding_tab').hasClass('nav-tab-active');
|
907 |
+
|
908 |
+
if ( playback_option != "Strobe Media Playback" || encoding_tab ) {
|
909 |
jQuery("table:contains(XML configuration file)").hide();
|
910 |
jQuery("h3:contains(The following options will only affect Flash playback)").hide();
|
911 |
}
|
912 |
+
if ( playback_option == "Strobe Media Playback" && general_tab ) {
|
913 |
+
jQuery("table:contains(XML configuration file)").show();
|
914 |
jQuery("h3:contains(The following options will only affect Flash playback)").show();
|
915 |
}
|
916 |
+
|
917 |
+
if ( playback_option == "WordPress Default" && general_tab ) {
|
918 |
+
jQuery("tr:contains(Skin Class)").hide();
|
919 |
+
}
|
920 |
+
else { jQuery("tr:contains(Skin Class)").show(); }
|
921 |
+
|
922 |
if ( ffmpeg_exists == "notinstalled" ) {
|
923 |
jQuery(".kgvid_video_app_required").addClass("kgvid_thumbnail_overlay");
|
924 |
jQuery(".kgvid_video_app_required").attr('title', 'FFMPEG or LIBAV required for these functions');
|
925 |
+
jQuery(".kgvid_video_app_required :input").attr('disabled', 'disabled');
|
926 |
+
jQuery("#ffmpeg_sample_div").slideUp(1000);
|
927 |
+
|
928 |
}
|
929 |
if ( ffmpeg_exists == "on" ) {
|
930 |
jQuery(".kgvid_video_app_required").removeClass("kgvid_thumbnail_overlay");
|
931 |
+
jQuery(".kgvid_video_app_required :input").removeAttr('disabled');
|
932 |
jQuery(".kgvid_video_app_required").removeAttr('title');
|
933 |
+
jQuery("#ffmpeg_sample_div").slideDown(1000);
|
934 |
}
|
935 |
}
|
936 |
|
937 |
function kgvid_hide_ffmpeg_settings() {
|
938 |
|
939 |
var video_app = jQuery('#video_app').val();
|
940 |
+
|
941 |
if (video_app == "ffmpeg") {
|
942 |
+
jQuery("tr:contains(FFMPEG legacy options)").show();
|
943 |
}
|
944 |
if (video_app == "avconv") {
|
945 |
+
jQuery("tr:contains(FFMPEG legacy options)").hide();
|
946 |
+
video_app = "libav";
|
947 |
+
}
|
948 |
+
|
949 |
+
jQuery('.video_app_name').html(video_app.toUpperCase());
|
950 |
+
|
951 |
+
/* var rate_control = jQuery('#rate_control').val();
|
952 |
+
|
953 |
+
if ( rate_control == "crf" ) {
|
954 |
+
jQuery("tr:contains(Constant Rate Factors)").show();
|
955 |
+
jQuery("tr:contains(Average Bit Rate:)").hide();
|
956 |
+
}
|
957 |
+
|
958 |
+
if ( rate_control == "abr" ) {
|
959 |
+
jQuery("tr:contains(Constant Rate Factors)").hide();
|
960 |
+
jQuery("tr:contains(Average Bit Rate:)").show();
|
961 |
+
} */
|
962 |
+
|
963 |
+
}
|
964 |
+
|
965 |
+
function kgvid_set_bitrate_display() {
|
966 |
+
|
967 |
+
var resolutions = [1080, 720, 360];
|
968 |
+
var multiplier = jQuery('#bitrate_multiplier').val();
|
969 |
+
for (var i=0;i<resolutions.length;i++) {
|
970 |
+
var video_width = Math.round(resolutions[i] * 1.7777);
|
971 |
+
jQuery('#'+resolutions[i]+'_bitrate').html(Math.round(resolutions[i]*video_width*30*multiplier/1024));
|
972 |
}
|
973 |
+
|
974 |
}
|
975 |
|
976 |
function kgvid_set_all_featured() {
|
1014 |
jQuery.post(ajaxurl, { action: "kgvid_update_cms_progress", security: kgflashmediaplayersecurity, total: total, cms_type: cms_type }, function(remaining) {
|
1015 |
var percent_done = Math.round(parseInt(total-remaining)/parseInt(total)*100)+'%';
|
1016 |
jQuery('#'+cms_type+'_meter .kgvid_meter_bar').css('width', percent_done);
|
1017 |
+
jQuery('#'+cms_type+'_meter .kgvid_meter_text').html(total-remaining+'/'+total);
|
1018 |
if ( remaining == 0 ) {
|
1019 |
+
clearInterval(interval);
|
1020 |
jQuery( '#wpbody-content' ).data(cms_type+'_interval', '');
|
1021 |
jQuery( '#'+cms_type+'_status' ).html(' Complete');
|
1022 |
setTimeout(function(){ jQuery('#'+cms_type+'_meter, #'+cms_type+'_status').fadeOut("normal", function(){ jQuery(this).remove(); }); }, 3000);
|
1023 |
}
|
1024 |
}, "text" );
|
1025 |
}
|
1026 |
+
}
|
1027 |
+
|
1028 |
+
function kgvid_pick_image(button) {
|
1029 |
+
|
1030 |
+
var frame;
|
1031 |
+
|
1032 |
+
jQuery( function() {
|
1033 |
+
|
1034 |
+
// Build the choose from library frame.
|
1035 |
+
|
1036 |
+
var $el = jQuery(button);
|
1037 |
+
event.preventDefault();
|
1038 |
+
|
1039 |
+
// If the media frame already exists, reopen it.
|
1040 |
+
if ( frame ) {
|
1041 |
+
frame.open();
|
1042 |
+
return;
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
// Create the media frame.
|
1046 |
+
frame = wp.media.frames.customHeader = wp.media({
|
1047 |
+
// Set the title of the modal.
|
1048 |
+
title: $el.data('choose'),
|
1049 |
+
|
1050 |
+
// Tell the modal to show only images.
|
1051 |
+
library: {
|
1052 |
+
type: 'image'
|
1053 |
+
},
|
1054 |
+
|
1055 |
+
// Customize the submit button.
|
1056 |
+
button: {
|
1057 |
+
// Set the text of the button.
|
1058 |
+
text: $el.data('update'),
|
1059 |
+
close: true
|
1060 |
+
}
|
1061 |
+
});
|
1062 |
+
|
1063 |
+
// When an image is selected, run a callback.
|
1064 |
+
frame.on( 'select', function() {
|
1065 |
+
// Grab the selected attachment.
|
1066 |
+
var attachment = frame.state().get('selection').first()
|
1067 |
+
jQuery('#'+$el.data('change')).val(attachment.attributes.url);
|
1068 |
+
if ( $el.data('change').substr(-25) == "kgflashmediaplayer-poster" ) { jQuery('#'+$el.data('change').slice(0, -25)+'thumbnailplaceholder').html('<div class="kgvid_thumbnail_box kgvid_chosen_thumbnail_box"><img width="200" src="'+attachment.attributes.url+'"></div>'); }
|
1069 |
+
jQuery('#'+$el.data('change')).change();
|
1070 |
+
});
|
1071 |
+
|
1072 |
+
frame.open();
|
1073 |
+
});
|
1074 |
+
|
1075 |
+
}
|
1076 |
+
|
1077 |
+
function kgvid_media_library_icon_overlay() {
|
1078 |
+
var thumbnails = jQuery('.attachment-80x60, .attachment-preview.type-video .icon');
|
1079 |
+
jQuery.each(thumbnails, function(key, value) {
|
1080 |
+
if ( value.src.split("?")[1] == "kgvid" ) {
|
1081 |
+
jQuery(value).wrap('<div class="kgvid-media-icon-overlay"></div>')
|
1082 |
+
}
|
1083 |
+
});
|
1084 |
+
jQuery('.kgvid-media-icon-overlay').prepend('<div class="kgvid-media-icon-play"><span></span></div>');
|
1085 |
+
}
|
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, responsive
|
5 |
-
Requires at least: 3.
|
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 |
|
@@ -14,43 +14,49 @@ Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted
|
|
14 |
|
15 |
= A plugin to make embedding videos, generating thumbnails, and encoding HTML5-compliant files a little bit easier. =
|
16 |
|
17 |
-
The plugin adds several fields to any video uploaded to the WordPress Media Library. Just choose a few options and click Insert into Post and you'll get a shortcode in the post editor that will embed a flexible, responsive HTML5
|
18 |
|
19 |
-
You have the option to use either the lightweight, flexible Video.js HTML5 player or Adobe's Strobe Media Playback Flash player. The
|
20 |
|
21 |
-
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"]
|
22 |
|
23 |
-
If
|
24 |
|
25 |
-
If
|
26 |
|
27 |
-
|
28 |
|
29 |
-
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
|
33 |
The files will encode in the background and will take several minutes 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.
|
34 |
|
35 |
-
Encoded H.264 files
|
36 |
|
37 |
-
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.
|
38 |
|
39 |
-
If you want to make it easier for
|
40 |
|
41 |
-
Sometimes for various reasons you might need to embed video files that are not saved in the Wordpress Media Library. Maybe your file is too large to upload through the media upload form (if it is, I suggest the excellent "Add From Server" plugin), or maybe it's hosted on another server. Either way, you can use the tab "Embed Video From URL" in the Add Media window. Just enter the Video URL manually, and all other steps are the same as the Media Library options. The plugin will look for alternate encoded files in the same directory as the original, but this takes a long time when the video is on another server so it will only check for them once.
|
42 |
|
43 |
To embed videos on other sites you can use code like this.
|
44 |
|
45 |
-
`<iframe src='http://www.kylegilman.net/?attachment_id=
|
46 |
|
47 |
= Once you've filled in all your options, click "Insert into Post" and you'll get a shortcode in the visual editor like this =
|
48 |
|
49 |
-
`[KGVID poster="http://www.kylegilman.net/wp-content/uploads/2011/10/Reel-11-10-10-web_thumb2.jpg"
|
50 |
-
width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/
|
51 |
|
52 |
= 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. =
|
53 |
|
|
|
|
|
54 |
* `poster="http://www.example.com/image.jpg"` sets the thumbnail.
|
55 |
* `endofvideooverlay="http://www.example.com/end_image.jpg` sets the image shown when the video ends.
|
56 |
* `width="xxx"`
|
@@ -62,18 +68,20 @@ width="720" height="404"]http://www.kylegilman.net/wp-content/uploads/2011/10/Re
|
|
62 |
* `loop="true/false"`
|
63 |
* `autoplay="true/false"`
|
64 |
* `watermark="http://www.example.com/image.png"` or `"false"` to disable.
|
65 |
-
* `title="Video Title"`
|
66 |
-
* `embedcode="html code"` changes text displayed in the embed code overlay in order to provide a custom method for embedding a video.
|
67 |
* `view_count="true/false"` turns the view count on or off.
|
68 |
* `caption="Caption"`
|
69 |
* `description="Description"` Used for metadata only.
|
70 |
* `downloadlink="true/false"` generates a link below the video to make it easier for users to save the video file to their computers.
|
|
|
|
|
71 |
|
72 |
= These options will only affect Video.js playback =
|
73 |
|
74 |
* `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>
|
75 |
|
76 |
-
= These options will only affect Flash playback in Strobe Media Playback video elements. They will have no effect on
|
77 |
|
78 |
* `autohide="true/false"` specify whether to autohide the control bar after a few seconds.
|
79 |
* `playbutton="true/false"` turns the big play button overlay in the middle of the video on or off.
|
@@ -99,37 +107,42 @@ I'm not really a software developer. I'm just a film editor with some time on hi
|
|
99 |
|
100 |
1. Upload the unzipped folder `video-embed-thumbnail-generator` to the `/wp-content/plugins/` directory.
|
101 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
102 |
-
1. Make sure you have all your MIME types configured correctly. Many servers don't have .mp4, .m4v, .ogv configured, and even more don't have .webm. There are a number of ways to do this. In your public_html directory you can edit your .htaccess file and add the following lines:
|
103 |
`AddType video/ogg .ogv
|
104 |
AddType video/mp4 .mp4
|
105 |
AddType video/mp4 .m4v
|
106 |
AddType video/webm .webm`
|
|
|
107 |
|
108 |
== Frequently Asked Questions ==
|
109 |
|
110 |
= Why doesn't my video play? =
|
111 |
|
112 |
-
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.
|
113 |
|
114 |
If you recorded the video using a Samsung Galaxy S II phone, even though most programs will tell you it's H.264 video with AAC audio, there's a good chance that it's actually recorded in 3gp4 format, which won't work with the Flash player. Use MediaInfo Library to get really detailed information about your media files.
|
115 |
|
116 |
-
The Strobe Media Playback Flash player will not play mp4/m4v/mov files that don't have the
|
117 |
|
118 |
= Why doesn't this work with YouTube? =
|
119 |
|
120 |
WordPress already has <a href="http://codex.wordpress.org/Embeds">a built-in system for embedding videos from YouTube, Vimeo, Dailymotion, etc</a>. Just put the URL into your post and WordPress will automatically convert it to an embedded video using oEmbed. You don't need this plugin to do that. If you're trying to generate new thumbnails from YouTube videos, I'm not going to risk Google's wrath by providing that functionality. I'm not even sure I could figure out how to do it anyway.
|
121 |
|
|
|
|
|
|
|
|
|
122 |
= I'm getting an error message FFMPEG not found at /usr/local/bin/. You can embed existing videos, but video thumbnail generation and Mobile/HTML5 video encoding is not possible without FFMPEG. =
|
123 |
|
124 |
First off, don't panic.
|
125 |
|
126 |
-
This plugin can use FFMPEG or LIBAV to make thumbnails and create alternate video formats
|
127 |
|
128 |
-
Many of the features of the plugin will work without FFMPEG. You can generate embed shortcodes for your videos on any host because that part of the plugin is JavaScript running in your browser. But without FFMPEG you won't be able to generate thumbnails or encode alternate formats on the server.
|
129 |
|
130 |
= How can I encode videos in directories protected by .htaccess passwords? =
|
131 |
|
132 |
-
|
133 |
|
134 |
== Screenshots ==
|
135 |
|
@@ -140,6 +153,36 @@ Use the "Embed from URL" tab and enter the URL in this format http://username:pa
|
|
140 |
|
141 |
== Changelog ==
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
= 4.1.5 - June 30, 2013 =
|
144 |
* Updated Video.js to version 4.1.0
|
145 |
* Restored code to show captions and download links in gallery pop-ups.
|
@@ -189,7 +232,7 @@ Use the "Embed from URL" tab and enter the URL in this format http://username:pa
|
|
189 |
* Removed post meta box below post editing window until I can work out a way to generate them without disabling video encode status monitoring in media modal popup when the same video is already in the post edit window.
|
190 |
* Replaced deprecated ereg PHP function with preg_match and used a more precise regular expression when determining the height and width of videos.
|
191 |
|
192 |
-
= 4.0.3 - May
|
193 |
* Fixed bug that caused video control text to display below videos on iPhones.
|
194 |
* Changed method for saving video plays to the database. Now more secure and accurate.
|
195 |
|
@@ -225,7 +268,7 @@ Use the "Embed from URL" tab and enter the URL in this format http://username:pa
|
|
225 |
* Fixed endless "loading" spinner shown at the end of videos in some browsers in Video.js player.
|
226 |
* Clicking "Insert into post" immediately after upload without changing any options now inserts shortcode instead of just the title of the video.
|
227 |
* Inserting shortcode without a thumbnail no longer attempts to save the nonexistent thumbnail. Thumbnail cleanup is handled better.
|
228 |
-
* Fixed error message "array_key_exists() expects parameter 2 to be array" when shortcode didn't have attributes.
|
229 |
* Escaped all shell commands for increased security.
|
230 |
* Fixed bug that made "Encode" button disappear if all formats were checked.
|
231 |
* Fixed missing argument for kgvid_clear_completed_queue() when scheduling cleanup.
|
@@ -257,7 +300,7 @@ Use the "Embed from URL" tab and enter the URL in this format http://username:pa
|
|
257 |
= 3.0.2 - January 24, 2013 =
|
258 |
* Fixed bug that permanently disabled buttons on the Embed Video from URL tab.
|
259 |
* Disabled "Delete Permanently" option for encoded files found on other servers.
|
260 |
-
* Reduced the jQuery UI Dialog css and put it in its own scope to avoid conflicts with existing jQuery UI Dialog themes.
|
261 |
* Cleaned out some leftover code.
|
262 |
|
263 |
= 3.0.1 - January 24, 2013 =
|
@@ -345,20 +388,20 @@ Use the "Embed from URL" tab and enter the URL in this format http://username:pa
|
|
345 |
* Revised thumbnail cleanup to make sure temp files aren't deleted when generating thumbnails for more than one video at a time.
|
346 |
|
347 |
= 1.0.2 - October 21, 2011 =
|
348 |
-
* Fixed a shocking number of unenclosed stings in get_options() calls. Bad programming. Didn't affect functionality, but will stop generating errors.
|
349 |
* Removed clumsy check for FFMPEG running. Was preventing encoding if ANY user on the server was running FFMPEG. Be wary of overusing your system resources though.
|
350 |
|
351 |
= 1.0.1 - October 21, 2011 =
|
352 |
* Quick fix to add mdetect.php to the plugin package from Wordpress
|
353 |
|
354 |
= 1.0 - October 20, 2011 =
|
355 |
-
* Huge re-write.
|
356 |
* Integrated with Wordpress Media Library and added WEBM support.
|
357 |
* Increased control over thumbnail generation.
|
358 |
* Added tab to Insert Video dialog box for adding by URL (like the old version).
|
359 |
|
360 |
= 0.2.1 - October 9, 2011 =
|
361 |
-
* Check made to ensure iPhone/iPod/Android compatible encode video height is an even number when HTML5 video encodes are made.
|
362 |
|
363 |
= 0.2 - January 18, 2011 =
|
364 |
* First Release
|
@@ -369,4 +412,4 @@ Use the "Embed from URL" tab and enter the URL in this format http://username:pa
|
|
369 |
Fixes thumbnails & encodes in WP 3.5. Not compatible with earlier WP versions.
|
370 |
|
371 |
= 2.0 =
|
372 |
-
Fixes several security issues.
|
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, responsive
|
5 |
+
Requires at least: 3.5
|
6 |
+
Tested up to: 3.7
|
7 |
+
Stable tag: 4.2
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
14 |
|
15 |
= A plugin to make embedding videos, generating thumbnails, and encoding HTML5-compliant files a little bit easier. =
|
16 |
|
17 |
+
The plugin adds several fields to any video uploaded to the WordPress Media Library. Just choose a few options and 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, and a preview image.
|
18 |
|
19 |
+
You have the option to use either the lightweight, flexible Video.js HTML5 player, the WordPress default player (introduced in WordPress version 3.6), or Adobe's Strobe Media Playback Flash player. The Video.js player is styled the same in all desktop browsers and is easily customizable. The Strobe Media Playback option is not recommended. It 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. No matter which player you use, the video will resize on the fly to fit the container it's in.
|
20 |
|
21 |
+
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 using the options listed below.
|
22 |
|
23 |
+
If your video can be played natively in your browser, 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.
|
24 |
|
25 |
+
If you know which frame you want to use, click "Choose from video�" to select it from the video. This will only work for videos that can be played natively in your browser. If you want really fine control you can enter timecode in the "Thumbnail timecode" field. Use `mm:ss` format. You can 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).
|
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 |
+
I highly recommend starting 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). I've written up my recommended video encode settings in <a href="http://www.kylegilman.net/2011/02/25/making-mp4-h-264-videos-in-apple-compressor/">a post on my website</a>.
|
32 |
+
|
33 |
+
The plugin can use FFMPEG or LIBAV to encode videos and make thumbnails if you have them installed on your server. 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:\`).
|
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 & Linux. I no longer recommend encoding OGV or WEBM unless you expect a large number of no-Flash sticklers visiting your site. However, your mileage may vary.
|
36 |
|
37 |
The files will encode in the background and will take several minutes 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.
|
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 and prevents the Strobe Media player from playing them at all.
|
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 |
|
43 |
+
If you want to make it easier for users to save your videos to their computers, you can choose to include a link by checking the "Generate Download Link Below Video" button.
|
44 |
|
45 |
+
Sometimes for various reasons you might need to embed video files that are not saved in the Wordpress Media Library. Maybe your file is too large to upload through the media upload form (if it is, I suggest the excellent "Add From Server" plugin), or maybe it's hosted on another server. Either way, you can use the tab "Embed Video From URL" in the Add Media window. Just enter the Video URL manually, and all other steps are the same as the Media Library options. The plugin will look for alternate encoded files in the same directory as the original, but this takes a long time when the video is on another server so it will only check for them once.
|
46 |
|
47 |
To embed videos on other sites you can use code like this.
|
48 |
|
49 |
+
`<iframe src='http://www.kylegilman.net/?attachment_id=2897&kgvid_video_embed[enable]=true' frameborder='0' scrolling='no' width='640' height='360'></iframe>`
|
50 |
|
51 |
= Once you've filled in all your options, click "Insert into Post" and you'll get a shortcode in the visual editor like this =
|
52 |
|
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 |
= 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. =
|
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 id is given.
|
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"`
|
68 |
* `loop="true/false"`
|
69 |
* `autoplay="true/false"`
|
70 |
* `watermark="http://www.example.com/image.png"` or `"false"` to disable.
|
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>
|
83 |
|
84 |
+
= These options will only affect Flash playback in Strobe Media Playback video elements. They will have no effect on other players. =
|
85 |
|
86 |
* `autohide="true/false"` specify whether to autohide the control bar after a few seconds.
|
87 |
* `playbutton="true/false"` turns the big play button overlay in the middle of the video on or off.
|
107 |
|
108 |
1. Upload the unzipped folder `video-embed-thumbnail-generator` to the `/wp-content/plugins/` directory.
|
109 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
110 |
+
1. Make sure you have all your MIME types configured correctly. Many servers don't have .mp4, .m4v, or .ogv configured, and even more don't have .webm. There are a number of ways to do this. In your public_html directory you can edit your .htaccess file and add the following lines:
|
111 |
`AddType video/ogg .ogv
|
112 |
AddType video/mp4 .mp4
|
113 |
AddType video/mp4 .m4v
|
114 |
AddType video/webm .webm`
|
115 |
+
Optional: `AddType video/mp4 .mov` will help with IE playback of .mov files but could interfere with other QuickTime players.
|
116 |
|
117 |
== Frequently Asked Questions ==
|
118 |
|
119 |
= Why doesn't my video play? =
|
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 |
If you recorded the video using a Samsung Galaxy S II phone, even though most programs will tell you it's H.264 video with AAC audio, there's a good chance that it's actually recorded in 3gp4 format, which won't work with the Flash player. Use MediaInfo Library to get really detailed information about your media files.
|
124 |
|
125 |
+
The Strobe Media Playback Flash player will not play mp4/m4v/mov files that don't have the moov atom at the head of the file. 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 qt-faststart or MP4Box installed on your server.
|
126 |
|
127 |
= Why doesn't this work with YouTube? =
|
128 |
|
129 |
WordPress already has <a href="http://codex.wordpress.org/Embeds">a built-in system for embedding videos from YouTube, Vimeo, Dailymotion, etc</a>. Just put the URL into your post and WordPress will automatically convert it to an embedded video using oEmbed. You don't need this plugin to do that. If you're trying to generate new thumbnails from YouTube videos, I'm not going to risk Google's wrath by providing that functionality. I'm not even sure I could figure out how to do it anyway.
|
130 |
|
131 |
+
= Why can't I make thumbnails? =
|
132 |
+
|
133 |
+
If you're like most users and don't have FFMPEG installed on your server, the plugin relies on your browser's built-in ability to play videos. Google Chrome is best when making thumbnails because it supports the most formats. Wikipedia has <a href="http://en.wikipedia.org/wiki/HTML5_video#Browser_support">a great chart that explains which browsers work with which video formats</a>.
|
134 |
+
|
135 |
= I'm getting an error message FFMPEG not found at /usr/local/bin/. You can embed existing videos, but video thumbnail generation and Mobile/HTML5 video encoding is not possible without FFMPEG. =
|
136 |
|
137 |
First off, don't panic.
|
138 |
|
139 |
+
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`
|
140 |
|
141 |
+
Many 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.
|
142 |
|
143 |
= How can I encode videos in directories protected by .htaccess passwords? =
|
144 |
|
145 |
+
Enter the username & password in the plugin settings "FFMPEG Settings" tab, or use the "Embed from URL" tab and enter the URL in this format http://username:password@yourdomain.com/uploads/2012/01/awesomevid.mp4 in the Video URL field.
|
146 |
|
147 |
== Screenshots ==
|
148 |
|
153 |
|
154 |
== Changelog ==
|
155 |
|
156 |
+
= 4.2 - October 5, 2013 =
|
157 |
+
* THUMBNAILS FOR EVERYBODY! Added in-browser thumbnail generation. Any video in the media library that can be played natively in the current browser can now be used to generate thumbnails without requiring special software on your server.
|
158 |
+
* Updated shortcode to support the simplest possible implementation: [KGVID]. Without any additional information, it will automatically find and display all videos attached to the post.
|
159 |
+
* Added "id" and "videos" attributes to shortcode to display specific video IDs or show a specific number of attached videos.
|
160 |
+
* If a video thumbnail is set, the video will now use its thumbnail as an icon in the WordPress admin area instead of the generic "video" icon.
|
161 |
+
* To avoid clutter, additional video formats encoded by the plugin are now hidden from lists of media, unless "Video" is specifically selected.
|
162 |
+
* When a master video is deleted and additional video formats are not deleted, the next highest quality format automatically becomes the master video.
|
163 |
+
* Updated Video.js to version 4.2.1, updated the included skin to work with it, and removed the unused image video-js.png.
|
164 |
+
* Added option to use the WordPress default video player introduced in WordPress version 3.6.
|
165 |
+
* Added buttons to choose thumbnails, end of video image, and watermark from the media library.
|
166 |
+
* Added option to add Open Graph tags for posting videos on Facebook. However, for the many Facebook users who browse with https, your own videos must be served via https in order to work.
|
167 |
+
* Added options to automatically generate a thumbnail and encode videos to multiple formats as soon as they are uploaded (FFMPEG/LIBAV only).
|
168 |
+
* Added option to disable responsive video resizing.
|
169 |
+
* Added options to restrict thumbnail making and video encoding to particular user roles.
|
170 |
+
* Added option to enter username and password to give FFMPEG/LIBAV access to .htaccess protected videos.
|
171 |
+
* Added option to disable right-clicking on videos.
|
172 |
+
* Added option to replace original video file with an H.264 video of the same resolution.
|
173 |
+
* Added advanced FFMPEG/LIBAV encoding options. New options include choice between Constant Rate Factor and Average Bit Rate, H.264 profiles and levels, audio bit rate, disabling `nice` on Linux, and the ability to encode with more than one thread.
|
174 |
+
* Added `-movflags faststart` option available in newer versions of FFMPEG/LIBAV, eliminating the need for qt-faststart or MP4Box.
|
175 |
+
* Added a test encoding output on the settings page for easier troubleshooting.
|
176 |
+
* Split plugin settings page in to two tabs.
|
177 |
+
* Fixed saving plugin settings when multiple settings are changed rapidly.
|
178 |
+
* No longer starting video encodes using `nohup` command on Linux servers.
|
179 |
+
* FFMPEG vpre flag switched from slow to fast.
|
180 |
+
* Enabled actual support for encoding with libfdk_aac, and the experimental built-in aac encoder as a last resort.
|
181 |
+
* Fixed cases where the encode queue would not advance if an unexpected error happened.
|
182 |
+
* Fixed encoding library messages so the errors are saved to the encode queue and don't disappear immediately.
|
183 |
+
* Changed endOfVideoOverlay and endOfVideoOverlaySame options to lowercase.
|
184 |
+
* Revised method for determining if a video URL refers to an attachment in the WordPress database to account for differences between urls using http and https and filenames that slip into the database with spaces intact.
|
185 |
+
|
186 |
= 4.1.5 - June 30, 2013 =
|
187 |
* Updated Video.js to version 4.1.0
|
188 |
* Restored code to show captions and download links in gallery pop-ups.
|
232 |
* Removed post meta box below post editing window until I can work out a way to generate them without disabling video encode status monitoring in media modal popup when the same video is already in the post edit window.
|
233 |
* Replaced deprecated ereg PHP function with preg_match and used a more precise regular expression when determining the height and width of videos.
|
234 |
|
235 |
+
= 4.0.3 - May 1, 2013 =
|
236 |
* Fixed bug that caused video control text to display below videos on iPhones.
|
237 |
* Changed method for saving video plays to the database. Now more secure and accurate.
|
238 |
|
268 |
* Fixed endless "loading" spinner shown at the end of videos in some browsers in Video.js player.
|
269 |
* Clicking "Insert into post" immediately after upload without changing any options now inserts shortcode instead of just the title of the video.
|
270 |
* Inserting shortcode without a thumbnail no longer attempts to save the nonexistent thumbnail. Thumbnail cleanup is handled better.
|
271 |
+
* Fixed error message "array_key_exists() expects parameter 2 to be array" when shortcode didn't have attributes.
|
272 |
* Escaped all shell commands for increased security.
|
273 |
* Fixed bug that made "Encode" button disappear if all formats were checked.
|
274 |
* Fixed missing argument for kgvid_clear_completed_queue() when scheduling cleanup.
|
300 |
= 3.0.2 - January 24, 2013 =
|
301 |
* Fixed bug that permanently disabled buttons on the Embed Video from URL tab.
|
302 |
* Disabled "Delete Permanently" option for encoded files found on other servers.
|
303 |
+
* Reduced the jQuery UI Dialog css and put it in its own scope to avoid conflicts with existing jQuery UI Dialog themes.
|
304 |
* Cleaned out some leftover code.
|
305 |
|
306 |
= 3.0.1 - January 24, 2013 =
|
388 |
* Revised thumbnail cleanup to make sure temp files aren't deleted when generating thumbnails for more than one video at a time.
|
389 |
|
390 |
= 1.0.2 - October 21, 2011 =
|
391 |
+
* Fixed a shocking number of unenclosed stings in get_options() calls. Bad programming. Didn't affect functionality, but will stop generating errors.
|
392 |
* Removed clumsy check for FFMPEG running. Was preventing encoding if ANY user on the server was running FFMPEG. Be wary of overusing your system resources though.
|
393 |
|
394 |
= 1.0.1 - October 21, 2011 =
|
395 |
* Quick fix to add mdetect.php to the plugin package from Wordpress
|
396 |
|
397 |
= 1.0 - October 20, 2011 =
|
398 |
+
* Huge re-write.
|
399 |
* Integrated with Wordpress Media Library and added WEBM support.
|
400 |
* Increased control over thumbnail generation.
|
401 |
* Added tab to Insert Video dialog box for adding by URL (like the old version).
|
402 |
|
403 |
= 0.2.1 - October 9, 2011 =
|
404 |
+
* Check made to ensure iPhone/iPod/Android compatible encode video height is an even number when HTML5 video encodes are made.
|
405 |
|
406 |
= 0.2 - January 18, 2011 =
|
407 |
* First Release
|
412 |
Fixes thumbnails & encodes in WP 3.5. Not compatible with earlier WP versions.
|
413 |
|
414 |
= 2.0 =
|
415 |
+
Fixes several security issues.
|
screenshot-1.jpg
CHANGED
Binary file
|
screenshot-2.jpg
CHANGED
Binary file
|
video-embed-thumbnail-generator.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
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 for thumbnails and encodes. <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">Settings</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kylegilman@gmail.com&item_name=Video%20Embed%20And%20Thumbnail%20Generator%20Plugin%20Donation
|
6 |
-
Version: 4.
|
7 |
Author: Kyle Gilman
|
8 |
Author URI: http://www.kylegilman.net/
|
9 |
|
@@ -34,17 +34,24 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
34 |
License: http://www.gnu.org/licenses/lgpl.html
|
35 |
6) Includes code adapted from Kathy Darling's custom solution for saving thumbnails
|
36 |
Website: http://www.kathyisawesome.com/
|
|
|
|
|
|
|
37 |
*/
|
38 |
|
39 |
if ( ! defined( 'ABSPATH' ) )
|
40 |
die( "Can't load this file directly" );
|
41 |
-
|
42 |
function kgvid_default_options_fn() {
|
|
|
|
|
|
|
43 |
$options = array(
|
44 |
-
"version"=>4.
|
45 |
"embed_method"=>"Video.js",
|
46 |
"template"=>false,
|
47 |
"template_gentle"=>"on",
|
|
|
48 |
"encode_1080"=>"on",
|
49 |
"encode_720"=>"on",
|
50 |
"encode_mobile"=>"on",
|
@@ -71,14 +78,15 @@ function kgvid_default_options_fn() {
|
|
71 |
"align"=>"left",
|
72 |
"width"=>"640",
|
73 |
"height"=>"360",
|
|
|
74 |
"gallery_width"=>"960",
|
75 |
"gallery_height"=>"540",
|
76 |
"gallery_thumb"=>"250",
|
77 |
"controlbar_style"=>"docked",
|
78 |
"autoplay"=>false,
|
79 |
"loop"=>false,
|
80 |
-
"
|
81 |
-
"
|
82 |
"bgcolor"=>"",
|
83 |
"configuration"=>"",
|
84 |
"skin"=>plugins_url("", __FILE__)."/flash/skin/kg_skin.xml",
|
@@ -86,41 +94,145 @@ function kgvid_default_options_fn() {
|
|
86 |
"stream_type"=>"liveOrRecorded",
|
87 |
"scale_mode"=>"letterbox",
|
88 |
"autohide"=>"on",
|
89 |
-
"playbutton"=>"on"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
);
|
91 |
return $options;
|
92 |
}
|
93 |
|
94 |
function kgvid_register_default_options_fn() { //add default values for options
|
|
|
95 |
$options = get_option('kgvid_video_embed_options');
|
|
|
96 |
if( !is_array($options) ) {
|
97 |
$options = kgvid_default_options_fn();
|
98 |
update_option('kgvid_video_embed_options', $options);
|
99 |
}
|
|
|
|
|
|
|
100 |
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) { kgvid_check_ffmpeg_exists($options, true); }
|
|
|
101 |
}
|
102 |
register_activation_hook(__FILE__, 'kgvid_register_default_options_fn');
|
103 |
|
104 |
function kgvid_video_formats() {
|
105 |
|
106 |
$video_formats = array(
|
107 |
-
"
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
);
|
114 |
return $video_formats;
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
function kgvid_add_upload_mimes ( $existing_mimes=array() ) {
|
119 |
-
|
120 |
// allows uploading .webm videos
|
121 |
$existing_mimes['webm'] = 'video/webm';
|
122 |
return $existing_mimes;
|
123 |
-
|
124 |
}
|
125 |
add_filter('upload_mimes', 'kgvid_add_upload_mimes');
|
126 |
|
@@ -164,12 +276,12 @@ function kgvid_check_for_shortcode_in_content() {
|
|
164 |
$pattern = get_shortcode_regex();
|
165 |
preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches );
|
166 |
if ( array_key_exists( 2, $matches ) && array_key_exists( 5, $matches ) ) {
|
167 |
-
foreach ( $matches[2] as $shortcode_index => $shortcode ) {
|
168 |
if ( $shortcode == "KGVID" || $shortcode == "FMP" ) { continue; }
|
169 |
-
else {
|
170 |
foreach ( $matches as $match_index => $shortcode_matches ) {
|
171 |
-
unset($matches[$match_index][$shortcode_index]);
|
172 |
-
}
|
173 |
}
|
174 |
}
|
175 |
foreach ( $matches[5] as $index => $url ) {
|
@@ -191,17 +303,17 @@ function kgvid_backwards_compatible($post_id) {
|
|
191 |
|
192 |
global $wp_version;
|
193 |
$field_id = array();
|
194 |
-
|
195 |
-
if ( $wp_version < 3.5 ) {
|
196 |
$field_id['poster'] = 'attachments['. $post_id .'][kgflashmediaplayer-poster]';
|
197 |
$field_id['thumbtime'] = 'attachments['. $post_id .'][thumbtime]';
|
198 |
}
|
199 |
-
else {
|
200 |
-
$field_id['poster'] = 'attachments-'. $post_id .'-kgflashmediaplayer-poster';
|
201 |
$field_id['thumbtime'] = 'attachments-'. $post_id .'-thumbtime';
|
202 |
}
|
203 |
return $field_id;
|
204 |
-
|
205 |
}
|
206 |
|
207 |
function kgvid_sanitize_url($movieurl) {
|
@@ -232,10 +344,10 @@ function kgvid_check_ffmpeg_exists($options, $save) {
|
|
232 |
$function = "";
|
233 |
$uploads = wp_upload_dir();
|
234 |
|
235 |
-
if(function_exists('exec')) {
|
236 |
if (function_exists('escapeshellcmd')) {
|
237 |
$exec_enabled = true;
|
238 |
-
$cmd = escapeshellcmd($options['app_path'].'/'.$options['video_app'].' -i '.plugin_dir_path(__FILE__).'
|
239 |
exec ( $cmd, $output, $returnvalue );
|
240 |
}
|
241 |
else { $function = "ESCAPESHELLCMD"; }
|
@@ -249,7 +361,10 @@ function kgvid_check_ffmpeg_exists($options, $save) {
|
|
249 |
|
250 |
if ( $save == true ) {
|
251 |
if ( $ffmpeg_exists == true ) { $options['ffmpeg_exists'] = "on"; }
|
252 |
-
else {
|
|
|
|
|
|
|
253 |
update_option('kgvid_video_embed_options', $options);
|
254 |
}
|
255 |
|
@@ -266,8 +381,8 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
266 |
$video_formats = kgvid_video_formats();
|
267 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
268 |
$movieurl = $sanitized_url['movieurl'];
|
269 |
-
|
270 |
-
$encodevideo_info['moviefilebasename'] = $sanitized_url['basename'];
|
271 |
$encodevideo_info['encodepath'] = $uploads['path'];
|
272 |
if ( get_post_type($postID) == "attachment" ) { //if it's an attachment, not from URL
|
273 |
$moviefile = get_attached_file($postID);
|
@@ -282,7 +397,7 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
282 |
);
|
283 |
}
|
284 |
else {
|
285 |
-
|
286 |
$url_parts = parse_url($uploads['url']);
|
287 |
if ( array_key_exists('host', $url_parts) && strpos($movieurl, $url_parts['host']) !== false ) { //if we're on the same server
|
288 |
$encodevideo_info['sameserver'] = true;
|
@@ -298,7 +413,7 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
298 |
$encodevideo_info['encodepath'] = rtrim($parsed_url['localpath'], $parsed_url['filename']);
|
299 |
}
|
300 |
else { $encodevideo_info['sameserver'] = false; }
|
301 |
-
|
302 |
$args = array(
|
303 |
'numberposts' => '-1',
|
304 |
'post_type' => 'attachment',
|
@@ -314,9 +429,9 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
314 |
|
315 |
$encodevideo_info[$format.'_exists'] = false;
|
316 |
$encodevideo_info[$format.'_writable'] = false;
|
317 |
-
|
318 |
//start with the new database info before checking other locations
|
319 |
-
|
320 |
if ($children) {
|
321 |
foreach ( $children as $child ) {
|
322 |
$mime_type = get_post_mime_type($child->ID);
|
@@ -332,64 +447,63 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
332 |
}
|
333 |
}
|
334 |
}
|
335 |
-
|
336 |
//if the format's not in the database, check these places
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
"html5encodes"
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
if (
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
update_post_meta($postID, '_kgflashmediaplayer-'.$sanitized_url['singleurl_id'].'-'.$format, $encodevideo_info[$format.'url']);
|
371 |
-
}
|
372 |
-
else {
|
373 |
-
update_post_meta($postID, '_kgflashmediaplayer-'.$sanitized_url['singleurl_id'].'-'.$format, 'not found');
|
374 |
-
}
|
375 |
}
|
376 |
-
else {
|
377 |
-
|
378 |
-
$encodevideo_info[$format.'_exists'] = true;
|
379 |
-
$encodevideo_info[$format.'url'] = $already_checked_url;
|
380 |
-
}
|
381 |
}
|
382 |
-
}
|
383 |
-
|
384 |
-
|
385 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
386 |
if ( !$encodevideo_info[$format.'_exists'] ) {
|
387 |
$encodevideo_info[$format.'url'] = $uploads['url'].'/'.$encodevideo_info['moviefilebasename'].$format_stats['suffix'];
|
388 |
$encodevideo_info[$format.'filepath'] = $uploads['path'].'/'.$encodevideo_info['moviefilebasename'].$format_stats['suffix'];
|
389 |
}
|
390 |
-
|
391 |
}//end format loop
|
392 |
-
|
393 |
return $encodevideo_info;
|
394 |
}
|
395 |
|
@@ -403,14 +517,18 @@ function kgvid_encodevideo_info($movieurl, $postID) {
|
|
403 |
function kgvid_get_video_dimensions($video = false) {
|
404 |
$options = get_option('kgvid_video_embed_options');
|
405 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
406 |
-
|
407 |
$video = str_replace("https://", "http://", $video);
|
408 |
|
|
|
|
|
|
|
|
|
409 |
$command = escapeshellcmd($ffmpegPath . ' -i "' . $video . '"');
|
410 |
$command = $command.' 2>&1';
|
411 |
exec ( $command, $output );
|
412 |
$lastline = end($output);
|
413 |
-
$lastline = prev($output)."<br />".$lastline;
|
414 |
$output = implode("\n", $output);
|
415 |
|
416 |
$regex = "/Video: ([^,]*), ([^,]*), ([0-9]{1,4})x([0-9]{1,4})/";
|
@@ -418,45 +536,141 @@ function kgvid_get_video_dimensions($video = false) {
|
|
418 |
else { $result = ""; }
|
419 |
|
420 |
if ( !empty($result) ) {
|
421 |
-
$
|
422 |
-
$
|
|
|
423 |
preg_match('/Duration: (.*?),/', $output, $matches);
|
424 |
$duration = $matches[1];
|
425 |
$movie_duration_hours = intval(substr($duration, -11, 2));
|
426 |
$movie_duration_minutes = intval(substr($duration, -8, 2));
|
427 |
-
$movie_duration_seconds =
|
428 |
-
$
|
429 |
|
430 |
preg_match('/rotate : (.*?)\n/', $output, $matches);
|
431 |
if ( array_key_exists(1, $matches) == true ) { $rotate = $matches[1]; }
|
432 |
else $rotate = "0";
|
433 |
-
|
434 |
switch ($rotate) {
|
435 |
-
case "90": $rotate = '-vf "transpose=1"'; break;
|
436 |
-
case "180": $rotate = '-vf "hflip,vflip"'; break;
|
437 |
-
case "270": $rotate = '-vf "transpose=2"'; break;
|
438 |
-
default: $rotate = ""; break;
|
439 |
}
|
440 |
-
|
441 |
$command = escapeshellcmd($ffmpegPath . ' -i "' . $video . '" -codecs');
|
442 |
$command = $command.' 2>&1';
|
443 |
exec ( $command, $output );
|
444 |
$output = implode("\n", $output);
|
445 |
$configuration = array();
|
446 |
-
$
|
|
|
|
|
447 |
foreach ($lib_list as $lib) {
|
448 |
-
if ( strpos($output, $lib) !== false ) { $configuration[$lib] = "true"; }
|
449 |
-
else { $configuration[$lib] = "false"; }
|
450 |
}
|
451 |
|
452 |
-
return
|
|
|
453 |
} else {
|
454 |
return array ('output'=>$lastline, 'worked'=>false);
|
455 |
}
|
456 |
|
457 |
}
|
458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
class kgvid_Process{
|
|
|
460 |
private $pid;
|
461 |
private $command;
|
462 |
|
@@ -467,23 +681,14 @@ class kgvid_Process{
|
|
467 |
}
|
468 |
}
|
469 |
private function runCom(){
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
$this->
|
477 |
-
|
478 |
-
|
479 |
-
else {
|
480 |
-
$command = 'nohup nice '.$this->command;
|
481 |
-
$this->OS = "linux";
|
482 |
-
}
|
483 |
-
|
484 |
-
exec($command ,$op);
|
485 |
-
$this->output = $op;
|
486 |
-
if(substr($sys,0,3) != "WIN") { $this->pid = (int)$op[0]; }
|
487 |
}
|
488 |
|
489 |
public function setPid($pid){
|
@@ -516,14 +721,14 @@ class kgvid_Process{
|
|
516 |
|
517 |
function kgvid_video_embed_enqueue_scripts() {
|
518 |
$options = get_option('kgvid_video_embed_options');
|
519 |
-
|
520 |
if ( $options['embed_method'] == "Strobe Media Playback" ) {
|
521 |
wp_enqueue_script( 'swfobject' );
|
522 |
}
|
523 |
|
524 |
//Video.js script and skins
|
525 |
-
wp_enqueue_script( 'video-js', plugins_url("", __FILE__).'/video-js/video.js', '', '4.1
|
526 |
-
wp_enqueue_style( 'video-js-css', plugins_url("", __FILE__).'/video-js/video-js.css', '', '4.1
|
527 |
wp_enqueue_style( 'video-js-kg-skin', plugins_url("", __FILE__).'/video-js/kg-video-js-skin.css', '', $options['version'] );
|
528 |
|
529 |
//plugin-related frontend scripts and styles
|
@@ -535,325 +740,474 @@ function kgvid_video_embed_enqueue_scripts() {
|
|
535 |
add_action('wp_enqueue_scripts', 'kgvid_video_embed_enqueue_scripts', 12);
|
536 |
|
537 |
function enqueue_kgvid_script() { //loads plugin-related scripts in the admin area
|
|
|
|
|
|
|
|
|
538 |
|
539 |
-
wp_enqueue_script( 'video_embed_thumbnail_generator_script', plugins_url('/js/kgvid_video_plugin_admin.js', __FILE__) );
|
540 |
-
wp_enqueue_style( 'video_embed_thumbnail_generator_style', plugins_url('/css/video-embed-thumbnail-generator_admin.css', __FILE__) );
|
541 |
-
|
542 |
}
|
543 |
add_action('admin_enqueue_scripts', 'enqueue_kgvid_script');
|
544 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
545 |
function kgvid_video_embed_print_scripts() {
|
546 |
|
547 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
548 |
|
549 |
}
|
550 |
-
add_action('wp_head', 'kgvid_video_embed_print_scripts');
|
551 |
|
552 |
-
function
|
553 |
|
554 |
$options = get_option('kgvid_video_embed_options');
|
|
|
555 |
if ( in_the_loop() ) { $post_ID = get_the_ID(); }
|
556 |
else { $post_ID = 1; }
|
557 |
|
558 |
$query_atts = shortcode_atts(
|
559 |
-
array(
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
|
|
|
|
|
|
|
|
|
|
594 |
foreach ( $checkbox_convert as $query ) {
|
595 |
if ( $query_atts[$query] == "on" ) { $query_atts[$query] = "true"; }
|
596 |
if ( $query_atts[$query] == false ) { $query_atts[$query] = "false"; }
|
597 |
}
|
598 |
-
|
599 |
if ( $options['js_skin'] == "" ) { $options['js_skin'] = "vjs-default-skin"; }
|
600 |
if ( is_array($atts) ) {
|
601 |
if ( array_key_exists('skin', $atts) ) { $options['js_skin'] = $atts['skin']; } //allows user to set skin for individual videos using the skin="" attribute
|
602 |
}
|
603 |
|
604 |
-
|
605 |
-
|
606 |
-
// workaround for relative video URL (contributed by Lee Fernandes)
|
607 |
-
if(substr($content, 0, 1) == '/') $content = get_bloginfo('url').$content;
|
608 |
-
$content = trim($content);
|
609 |
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
)
|
624 |
-
|
625 |
-
|
626 |
-
$h264compatible = array("mp4", "mov", "m4v");
|
627 |
-
|
628 |
-
if ( !empty($id) ) { //if the video is an attachment in the WordPress db
|
629 |
-
$div_suffix = $id;
|
630 |
-
$encodevideo_info = kgvid_encodevideo_info($content, $id);
|
631 |
-
$attachment_info = get_post( $id );
|
632 |
-
|
633 |
-
$poster_id = get_post_meta($id, '_kgflashmediaplayer-poster-id', true);
|
634 |
-
if ( !empty($poster_id) ) {
|
635 |
-
//$poster_post = get_post($poster_id);
|
636 |
-
$poster_image_src = wp_get_attachment_image_src($poster_id, 'full');
|
637 |
-
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
|
638 |
-
if ( $poster_image_src[0] == $query_atts['poster'] && intval($query_atts['width']) <= get_option('medium_size_h') ) {
|
639 |
-
$query_atts['poster'] = kgvid_get_attachment_medium_url($poster_id);
|
640 |
-
}
|
641 |
}
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
646 |
}
|
647 |
-
else {
|
648 |
-
if ( empty($query_atts['caption']) ) { $query_atts['caption'] = $attachment_info->post_excerpt; }
|
649 |
-
if ( empty($query_atts['description']) ) { $query_atts['description'] = $attachment_info->post_content; }
|
650 |
-
|
651 |
-
$countable = true;
|
652 |
}
|
653 |
-
else { //
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
$
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
$
|
669 |
-
$
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
681 |
}
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
$
|
693 |
-
|
694 |
-
|
695 |
-
$
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
701 |
}
|
702 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
703 |
}
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
$aligncode .= '" ';
|
736 |
-
}
|
737 |
-
else { $aligncode = ""; }
|
738 |
-
|
739 |
-
$code = "";
|
740 |
-
|
741 |
-
$code .= '<div id="kgvid_'.$div_suffix.'_wrapper" class="kgvid_wrapper"'.$aligncode.'>';
|
742 |
-
$code .= '<div id="video_'.$div_suffix.'_div" class="kgvid_videodiv" itemscope itemtype="http://schema.org/VideoObject">';
|
743 |
-
if ( $query_atts["poster"] != '' ) { $code .= '<meta itemprop="thumbnailURL" content="'.$query_atts["poster"].'" />'; }
|
744 |
-
if ( !empty($id) ) { $schema_embedURL = site_url('/')."?attachment_id=".$id."&kgvid_video_embed[enable]=true"; }
|
745 |
-
else { $schema_embedURL = $content; }
|
746 |
-
$code .= '<meta itemprop="embedURL" content="'.$schema_embedURL.'" />';
|
747 |
-
|
748 |
-
if ( !empty($query_atts['title']) ) { $code .= '<meta itemprop="name" content="'.$query_atts['title'].'" />'; }
|
749 |
-
if ( !empty($query_atts['description']) ) { $description = $query_atts['description']; }
|
750 |
-
elseif ( !empty($query_atts['caption']) ) { $description = $query_atts['caption']; }
|
751 |
-
else { $description = ""; }
|
752 |
-
if ( !empty($description) ) { $code .= '<meta itemprop="description" content="'.esc_attr($description).'" />'; }
|
753 |
-
|
754 |
-
$code .= '<video id="video_'.$div_suffix.'" ';
|
755 |
-
if ( $query_atts["loop"] == 'true') { $code .= 'loop '; }
|
756 |
-
if ( $query_atts["autoplay"] == 'true') { $code .= 'autoplay '; }
|
757 |
-
if ( $query_atts["controlbar"] != 'none') { $code .= 'controls '; }
|
758 |
-
$code .= 'preload="metadata" ';
|
759 |
-
if ( $query_atts["poster"] != '' ) { $code .= 'poster="'.$query_atts["poster"].'" '; }
|
760 |
-
$code .= 'width="'.$query_atts["width"].'" height="'.$query_atts["height"].'"';
|
761 |
-
$code .= ' class="video-js '.$options['js_skin'].'" data-setup=\'{}\'';
|
762 |
-
$code .= ">\n";
|
763 |
-
|
764 |
-
$code .= implode("\n", $sources); //add the <source> tags created earlier
|
765 |
-
|
766 |
-
$code .= "</video>\n";
|
767 |
-
$code .= "</div>";
|
768 |
-
|
769 |
-
$show_views = false;
|
770 |
-
if ( !empty($id) || !empty($query_atts['caption']) || $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { //generate content below the video
|
771 |
-
$view_count = number_format(intval(get_post_meta($id, "_kgflashmediaplayer-starts", true)));
|
772 |
-
if ( empty($view_count) ) { $view_count = "0"; }
|
773 |
-
if ( $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { $view_count = "XX"; }
|
774 |
-
if ( $query_atts['view_count'] == "true" ) { $show_views = true; }
|
775 |
-
if ( !empty($query_atts['caption']) || $show_views || $query_atts['downloadlink'] == "true" ) {
|
776 |
-
$code .= '<div class="kgvid_below_video" id="video_'.$div_suffix.'_below">';
|
777 |
-
if ( $show_views ) { $code .= '<div class="kgvid-viewcount" id="video_'.$div_suffix.'_viewcount">'.$view_count.' views</div>'; }
|
778 |
-
if ( !empty($query_atts['caption']) || $query_atts['downloadlink'] == "true" ) {
|
779 |
-
$code .= '<div class="kgvid-caption" id="video_'.$div_suffix.'_caption">'.$query_atts['caption'];
|
780 |
-
if ( $query_atts['downloadlink'] == "true" ) {
|
781 |
-
if ( !empty($query_atts['caption']) ) { $code .= '<br>'; }
|
782 |
-
$code .= '<a href="'.$content.'">Right-click or ctrl-click on this link to download.</a>';
|
783 |
}
|
784 |
-
$code .= '</div>';
|
785 |
}
|
786 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
787 |
}
|
788 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
789 |
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
if ( $query_atts[
|
795 |
-
|
796 |
-
$
|
797 |
-
$
|
|
|
|
|
|
|
|
|
798 |
}
|
799 |
-
|
800 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
801 |
}
|
802 |
$code .= "</div>";
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
-
|
834 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
835 |
} //if not gallery
|
836 |
-
|
837 |
else { //if gallery
|
838 |
$thumbnail_aspect = false;
|
839 |
-
$
|
840 |
-
|
841 |
-
'
|
842 |
-
'
|
843 |
-
'
|
844 |
-
'
|
845 |
-
'
|
846 |
-
'
|
847 |
-
'
|
848 |
-
'exclude' => $query_atts['gallery_exclude']
|
849 |
);
|
850 |
-
if ( !empty($query_atts['gallery_include']) ) {
|
851 |
$args['include'] = $query_atts['gallery_include'];
|
852 |
unset($args['post_parent']);
|
853 |
}
|
854 |
$attachments = get_posts($args);
|
855 |
if ($attachments) {
|
856 |
-
|
857 |
$div_suffix = substr(uniqid(rand(), true),0,4);
|
858 |
$code .= '<div class="kgvid_gallerywrapper">';
|
859 |
foreach ( $attachments as $attachment ) {
|
@@ -862,43 +1216,43 @@ function KGVID_shortcode($atts, $content = ''){
|
|
862 |
if ( !empty($poster_id) && intval($query_atts['gallery_thumb']) <= get_option('medium_size_h') ) {
|
863 |
$poster_post = get_post($poster_id);
|
864 |
if ( $poster_post->guid == $thumbnail_url ) {
|
865 |
-
$thumbnail_url = kgvid_get_attachment_medium_url($poster_id);
|
866 |
$thumbnail_info = wp_get_attachment_image_src($poster_id);
|
867 |
$thumbnail_aspect = round($thumbnail_info[2]/$thumbnail_info[1], 4); //height/width
|
868 |
} //use the "medium" size image if available
|
869 |
}
|
870 |
if (!$thumbnail_url) { $thumbnail_url = $options['poster']; } //use the default poster if no thumbnail set
|
871 |
if (!$thumbnail_url) { $thumbnail_url = plugins_url('/images/nothumbnail.jpg', __FILE__);} //use the blank image if no other option
|
872 |
-
|
873 |
$video_width = get_post_meta($attachment->ID, "_kgflashmediaplayer-actualwidth", true);
|
874 |
if ( !$video_width ) { $video_width = get_post_meta($attachment->ID, "_kgflashmediaplayer-width", true); }
|
875 |
if ( !$video_width || $video_width > intval($options['gallery_width']) ) { $video_width = $options['gallery_width']; }
|
876 |
-
|
877 |
$video_height = get_post_meta($attachment->ID, "_kgflashmediaplayer-actualheight", true);
|
878 |
if ( !$video_height ) { $video_height = get_post_meta($attachment->ID, "_kgflashmediaplayer-height", true); }
|
879 |
if ( !$video_height || $video_height > intval($options['gallery_height']) ) { $video_height = $options['gallery_height']; }
|
880 |
-
|
881 |
if ( !$thumbnail_aspect ) { $thumbnail_aspect = round($video_height/$video_width, 4); } //if the thumbnail's not an attachment, set the aspect ratio to the video's
|
882 |
-
|
883 |
$play_scale = strval( round(intval($query_atts["gallery_thumb"])/600,2) );
|
884 |
-
|
885 |
$downloadlink = get_post_meta($attachment->ID, "_kgflashmediaplayer-downloadlink", true);
|
886 |
if ( empty($query_atts['caption']) ) { $query_atts['caption'] = $attachment->post_excerpt; }
|
887 |
$below_video = 0;
|
888 |
if ( !empty($query_atts['caption']) ) { $below_video = 1; }
|
889 |
if ( $downloadlink == "checked" ) { ++$below_video; }
|
890 |
-
|
891 |
-
$code .= '<div onclick="kgvid_SetVideo(\''.$div_suffix.'\', \''.site_url('/').'\', \''.$attachment->ID.'\', \''.$video_width.'\', \''.$video_height.'\', '.$below_video.');return false;" class="kgvid_video_gallery_thumb" style="width:'.$query_atts["gallery_thumb"].'px"><img src="'.$thumbnail_url.'"><div class="'.$options['js_skin'].'" ><div class="vjs-big-play-button" style="-webkit-transform: scale('.$play_scale.') translateY(-30px); -o-transform: scale('.$play_scale.') translateY(-30px); -ms-transform: scale('.$play_scale.') translateY(-30px); transform: scale('.$play_scale.') translateY(-30px);"><span></span></div></div><div class="titlebackground"><div class="videotitle">'.$attachment->post_title.'</div></div></div>'."\n\t\t\t";
|
892 |
}
|
893 |
-
|
894 |
$code .= '</div>'; //end wrapper div
|
895 |
$code .= '<div id="kgvid_GalleryPlayerDiv_'.$div_suffix.'"></div>';
|
896 |
-
$code .= '<script type="text/javascript">jQuery(document).ready(function() {
|
897 |
-
jQuery(\'#kgvid_GalleryPlayerDiv_'.$div_suffix.'\').dialog({
|
898 |
-
zIndex: 1000,
|
899 |
-
autoOpen: false,
|
900 |
-
modal: true,
|
901 |
-
resizable: false,
|
902 |
dialogClass: \'notitle\',
|
903 |
create: function(event, ui){
|
904 |
jQuery(\'.ui-dialog\').wrap(\'<div class="kgvid_gallery" />\');
|
@@ -912,10 +1266,10 @@ function KGVID_shortcode($atts, $content = ''){
|
|
912 |
if (jQuery(this).text() == "") { return true; }
|
913 |
return false;
|
914 |
}).remove();
|
915 |
-
}
|
916 |
-
});
|
917 |
-
}); </script>';
|
918 |
-
|
919 |
} //if there are attachments
|
920 |
} //if gallery
|
921 |
return $code;
|
@@ -928,32 +1282,33 @@ function kgvid_ajax_generate_encode_checkboxes() {
|
|
928 |
global $wpdb;
|
929 |
|
930 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
|
|
931 |
$movieurl = $_POST['movieurl'];
|
932 |
$post_id = $_POST['post_id'];
|
933 |
$page = $_POST['page'];
|
934 |
-
|
935 |
-
if (isset($_POST['encodeformats'])) {
|
936 |
$encode_checked = $_POST['encodeformats'];
|
937 |
foreach ( $encode_checked as $format => $checked ) {
|
938 |
if ( $checked == "true" ) { update_post_meta($post_id, '_kgflashmediaplayer-encode'.$format, 'on'); }
|
939 |
else { update_post_meta($post_id, '_kgflashmediaplayer-encode'.$format, 'notchecked'); }
|
940 |
}
|
941 |
-
}
|
942 |
|
943 |
$checkboxes = kgvid_generate_encode_checkboxes($movieurl, $post_id, $page);
|
944 |
$arr = array("embed_display" => $checkboxes);
|
945 |
echo json_encode($arr);
|
946 |
die();
|
947 |
-
|
948 |
}
|
949 |
add_action('wp_ajax_kgvid_generate_encode_checkboxes', 'kgvid_ajax_generate_encode_checkboxes');
|
950 |
|
951 |
function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
952 |
-
|
953 |
$options = get_option('kgvid_video_embed_options');
|
954 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
955 |
$video_formats = kgvid_video_formats();
|
956 |
-
|
957 |
$video_queued = false;
|
958 |
$something_to_encode = false;
|
959 |
$encoding_now = false;
|
@@ -963,9 +1318,9 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
963 |
$actualheight = "1081";
|
964 |
$rotated = false;
|
965 |
$encodevideo_info = array();
|
966 |
-
|
967 |
if ( !empty($movieurl) ) {
|
968 |
-
|
969 |
$encodevideo_info = kgvid_encodevideo_info($movieurl, $post_id);
|
970 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
971 |
$movieurl = $sanitized_url['movieurl'];
|
@@ -976,12 +1331,14 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
976 |
$rotated = get_post_meta($post_id, "_kgflashmediaplayer-rotate", true);
|
977 |
}
|
978 |
else { //video's not in the database
|
979 |
-
|
|
|
|
|
980 |
$post_mime_type = "video/".pathinfo($movieurl, PATHINFO_EXTENSION);
|
981 |
|
982 |
if ( !empty($video_embed_queue) ) {
|
983 |
foreach ($video_embed_queue as $video_key => $video_entry) {
|
984 |
-
if ( $video_entry['movieurl'] == $movieurl ) {
|
985 |
if ( array_key_exists('movie_info', $video_entry) ) {
|
986 |
$actualwidth = $video_entry['movie_info']['width'];
|
987 |
$actualheight = $video_entry['movie_info']['height'];
|
@@ -992,9 +1349,9 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
992 |
}
|
993 |
}
|
994 |
reset($video_embed_queue);
|
995 |
-
|
996 |
if ( $page == "queue" ) {
|
997 |
-
//$info = pathinfo($movieurl);
|
998 |
//$post_id = 'singleurl_'.sanitize_title_with_dashes(urldecode(basename($movieurl,'.'.$info['extension'])));
|
999 |
}
|
1000 |
}
|
@@ -1002,32 +1359,27 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1002 |
}
|
1003 |
else {
|
1004 |
$encode_disabled = ' disabled title="Please enter a valid video URL"';
|
|
|
1005 |
}
|
1006 |
-
|
1007 |
-
if ( $options['ffmpeg_exists'] == "notinstalled" ) {
|
1008 |
-
$ffmpeg_disabled_text = 'disabled="disabled" title="'.strtoupper($options['video_app']).' not found at '.$options['app_path'].'"';
|
1009 |
}
|
1010 |
else { $ffmpeg_disabled_text = ""; }
|
1011 |
-
|
1012 |
$video_key = false;
|
1013 |
-
$rotated_queue = false;
|
1014 |
if ( !empty($video_embed_queue) && !empty($movieurl) ) {
|
1015 |
foreach ($video_embed_queue as $video_key => $video_entry) {
|
1016 |
-
if ( $video_entry['movieurl'] == $movieurl ) {
|
1017 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
1018 |
$video_formats[$format]['status'] = $value['status'];
|
1019 |
-
if ( $format == "rotated" && $value['status'] != 'notchecked') {
|
1020 |
-
$rotated_queue = true;
|
1021 |
-
}
|
1022 |
}
|
1023 |
$video_queued = true;
|
1024 |
break;
|
1025 |
}
|
1026 |
}
|
1027 |
}
|
1028 |
-
|
1029 |
-
if ( (!$rotated && !$rotated_queue) || $post_mime_type != "video/mp4" ) { unset($video_formats['rotated']); }
|
1030 |
-
|
1031 |
$checkboxes = '<div id="attachments-'.$post_id.'-kgflashmediaplayer-encodeboxes">';
|
1032 |
foreach ( $video_formats as $format => $format_stats ) {
|
1033 |
if ( strpos($post_mime_type, $format) !== false ) { continue; } //skip webm or ogv checkbox if the video is webm or ogv
|
@@ -1040,34 +1392,43 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1040 |
if ( !array_key_exists('status', $format_stats) ) { $format_stats['status'] = "notchecked"; } //if this video isn't in the queue
|
1041 |
|
1042 |
if ( get_post_type($post_id) == "attachment" ) { $encodeset[$format] = get_post_meta($post_id, "_kgflashmediaplayer-encode".$format, true); }
|
1043 |
-
if ( $encodeset[$format] == ""
|
1044 |
-
|
1045 |
-
if ( $format_stats['status'] == "lowres" ||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1046 |
|
1047 |
if ( $encodeset[$format] == "on" || $format_stats['status'] == "queued" ) { $checked[$format] = 'checked'; }
|
1048 |
|
1049 |
if ( $format_stats['status'] != "notchecked" ) { //File is in queue
|
1050 |
$meta[$format] = ' <strong>'.ucfirst($format_stats['status']).'</strong>';
|
1051 |
-
if ( $format_stats['status'] == "error" ) {
|
1052 |
$meta[$format] .= ': <span style="color:red;">'.$video_embed_queue[$video_key]['encode_formats'][$format]['lastline']."</span>";
|
1053 |
}
|
1054 |
-
}
|
1055 |
-
|
1056 |
if ( !empty($encodevideo_info) ) {
|
1057 |
if ( $encodevideo_info[$format.'_exists'] ) { //if the video file exists
|
1058 |
if ( $format_stats['status'] != "encoding" ) { // not currently encoding
|
1059 |
if ( $format_stats['status'] == "notchecked" ) { $meta[$format] = ' <strong>Encoded</strong>'; }
|
1060 |
if ( $format_stats['status'] != "canceling" ) {
|
1061 |
if ( array_key_exists($format.'id', $encodevideo_info) ) { $child_id[$format] = $encodevideo_info[$format.'id']; }
|
1062 |
-
if ( $encodevideo_info[$format.'_writable'] ) { $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>'; }
|
1063 |
}
|
1064 |
$disabled[$format] = ' disabled title="Format already exists"';
|
1065 |
$checked[$format] = '';
|
1066 |
-
}
|
1067 |
}
|
1068 |
else { $something_to_encode = true; } //if the video file doesn't exist, there's something to encode
|
1069 |
}
|
1070 |
-
|
1071 |
if ( $format_stats['status'] == "encoding" ) {
|
1072 |
$encoding_now = true;
|
1073 |
$disabled[$format] = ' disabled title="Currently Encoding"';
|
@@ -1075,45 +1436,52 @@ function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
|
1075 |
$progress = kgvid_encode_progress($video_key, $format, $page);
|
1076 |
$meta[$format] = $progress['embed_display'];
|
1077 |
}
|
1078 |
-
|
1079 |
if ( $format_stats['status'] == "Encoding Complete" ) {
|
1080 |
$disabled[$format] = ' disabled title="Format already exists"';
|
1081 |
$checked[$format] = '';
|
1082 |
}
|
1083 |
-
|
1084 |
if ( $checked[$format] == '' ) { $something_to_encode = true; }
|
1085 |
-
|
|
|
|
|
|
|
|
|
|
|
1086 |
$checkboxes .= "\n\t\t\t".'<input type="checkbox" id="attachments-'.$post_id.'-kgflashmediaplayer-encode'.$format.'" name="attachments['.$post_id.'][kgflashmediaplayer-encode'.$format.']" '.$checked[$format].' '.$ffmpeg_disabled_text.$disabled[$format].'> <label for="attachments-'.$post_id.'-kgflashmediaplayer-encode'.$format.'">'.$format_stats['name'].'</label> <span id="attachments-'.$post_id.'-kgflashmediaplayer-meta'.$format.'">'.$meta[$format].'</span><br />';
|
1087 |
|
1088 |
}
|
1089 |
if ( $something_to_encode == false ) {
|
1090 |
$encode_disabled = ' disabled title="Nothing to encode" style="display:none;"';
|
1091 |
}
|
1092 |
-
|
1093 |
-
if ( $page == "queue" ) {
|
1094 |
$button_text = "Update";
|
1095 |
$checkboxes .= "\n\t\t\t".'<input type="hidden" name="attachments['.$post_id.'][kgflashmediaplayer-url]" value="'.$movieurl.'">';
|
1096 |
}
|
1097 |
else { $button_text = "Encode"; }
|
1098 |
-
|
|
|
1099 |
$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>';
|
1100 |
-
|
1101 |
-
if ( $page != "queue" ) {
|
1102 |
$checkboxes .= '<small><em>Generates additional video formats compatible with most mobile & HTML5-compatible browsers.</em></small>';
|
1103 |
}
|
1104 |
-
|
|
|
1105 |
if ( $video_queued == true ) {
|
1106 |
while ( count($video_formats) > 0 ) {
|
1107 |
$last_format = array_pop( $video_formats );
|
1108 |
if ( $last_format['status'] != "notchecked" ) { break; } //get the final queued format
|
1109 |
}
|
1110 |
-
|
1111 |
if ( !$encoding_now && ($last_format['status'] == "queued" || $last_format['status'] == "canceling") ) {
|
1112 |
-
$checkboxes .= '<script type="text/javascript">percent_timeout = setTimeout(function(){ kgvid_redraw_encode_checkboxes("'.$video_entry['movieurl'].'", "'.$video_entry['attachmentID'].'", "'.$page.'") },
|
1113 |
}
|
1114 |
}
|
1115 |
$checkboxes .= '</div>'; //close encodeboxes div
|
1116 |
-
|
1117 |
return $checkboxes;
|
1118 |
}
|
1119 |
|
@@ -1122,51 +1490,63 @@ function kgvid_generate_queue_table() {
|
|
1122 |
$html = "";
|
1123 |
|
1124 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
1125 |
-
$nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
|
1126 |
|
1127 |
if ( !empty($video_embed_queue) ) {
|
1128 |
-
|
1129 |
$video_formats = kgvid_video_formats();
|
1130 |
$currently_encoding = array();
|
|
|
1131 |
$nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
|
1132 |
$html .= "<input type='hidden' name='attachments[kgflashmediaplayer-security]' value='".$nonce."' />";
|
1133 |
-
|
1134 |
foreach ( $video_embed_queue as $order => $video_entry ) {
|
1135 |
$html .= "\t<tr id='tr_".$video_entry['attachmentID']."'";
|
1136 |
foreach ( $video_formats as $format => $format_stats ) {
|
1137 |
if ( $video_entry['encode_formats'][$format]['status'] == "encoding" ) {
|
1138 |
$currently_encoding[$order] = true;
|
1139 |
-
$html .= " class='currently_encoding' ";
|
1140 |
break;
|
1141 |
}
|
1142 |
-
else
|
|
|
|
|
|
|
|
|
|
|
|
|
1143 |
}
|
|
|
|
|
|
|
|
|
|
|
1144 |
$html .= ">";
|
1145 |
$html .= "<td id='td_".$video_entry['attachmentID']."'>".strval(intval($order)+1)."</td>\n";
|
1146 |
$thumbnail_url = get_post_meta($video_entry['attachmentID'], "_kgflashmediaplayer-poster", true);
|
1147 |
$thumbnail_html = "";
|
1148 |
-
if ($thumbnail_url != "" ) {
|
1149 |
-
$thumbnail_html = '<img width="100" src="'.$thumbnail_url.'">';
|
1150 |
}
|
1151 |
-
if ( get_post_type($video_entry['attachmentID']) == "attachment" ) {
|
1152 |
$moviefilepath = get_attached_file($video_entry['attachmentID']);
|
1153 |
$attachmentlink = "media.php?attachment_id=".$video_entry['attachmentID']."&action=edit";
|
1154 |
}
|
1155 |
-
else {
|
1156 |
-
$moviefilepath = $video_entry['movieurl'];
|
1157 |
$attachmentlink = $video_entry['movieurl'];
|
1158 |
}
|
1159 |
-
$html .= "\t\t\t\t\t<td><a href='".$attachmentlink."'> ".$thumbnail_html."</a></td>\n";
|
1160 |
-
$
|
|
|
|
|
1161 |
$html .= "\t\t\t\t\t<td class='queue_encode_formats' id='formats_".$video_entry['attachmentID']."'>";
|
1162 |
-
$html .= "<input type='hidden' name='attachments[".$video_entry['attachmentID']."][kgflashmediaplayer-security]' value='".$nonce."' />";
|
1163 |
$html .= kgvid_generate_encode_checkboxes($video_entry['movieurl'], $video_entry['attachmentID'], 'queue');
|
1164 |
$html .= "</td>\n";
|
1165 |
$html .= "\t\t\t\t\t<td>";
|
1166 |
-
$html .= "<a id='clear_".$video_entry['attachmentID']."' class='submitdelete' href='javascript:void(0)' onclick='kgvid_encode_queue(\"delete\", ".$order.")'";
|
1167 |
if ( $currently_encoding[$order] ) { $html .= " style='display:none;'"; }
|
1168 |
$html .= ">Clear</a>";
|
1169 |
-
$html .= "</td></tr>\n";
|
1170 |
}
|
1171 |
}
|
1172 |
else { $html = "\t<tr><td colspan='5'>Queue is Empty</td></tr>\n"; }
|
@@ -1178,13 +1558,13 @@ return $html;
|
|
1178 |
function kgvid_add_FFMPEG_Queue_Page() {
|
1179 |
$options = get_option('kgvid_video_embed_options');
|
1180 |
if ( $options['ffmpeg_exists'] == "on" ) { //only add the queue page if FFMPEG is installed
|
1181 |
-
add_submenu_page('tools.php', 'Video Embed & Thumbnail Generator Encoding Queue', 'Video Encode Queue', '
|
1182 |
}
|
1183 |
}
|
1184 |
add_action('admin_menu', 'kgvid_add_FFMPEG_Queue_Page');
|
1185 |
|
1186 |
function kgvid_FFMPEG_Queue_Page() {
|
1187 |
-
|
1188 |
?>
|
1189 |
<div class="wrap">
|
1190 |
<div id="icon-tools" class="icon32"><br /></div>
|
@@ -1215,13 +1595,12 @@ function kgvid_FFMPEG_Queue_Page() {
|
|
1215 |
</table>
|
1216 |
<!-- <input type='button' class='button-secondary' value='sort' onclick='jQuery("#sortable tbody.rows").trigger("sortupdate"); jQuery( "#sortable tbody.rows" ).sortable("refresh");'> -->
|
1217 |
<p>
|
1218 |
-
|
1219 |
-
<input type='button' class='button-secondary' value='Clear All Completed' onclick='kgvid_encode_queue("clear_completed", 0);'>
|
1220 |
</p>
|
1221 |
</form>
|
1222 |
</div>
|
1223 |
<?php
|
1224 |
-
}
|
1225 |
|
1226 |
function kgvid_addFMPOptionsPage() {
|
1227 |
add_options_page('Video Embed & Thumbnail Generator', 'Video Embed & Thumbnail Generator', 'administrator', __FILE__, 'kgvid_FMPOptionsPage');
|
@@ -1229,11 +1608,18 @@ function kgvid_addFMPOptionsPage() {
|
|
1229 |
add_action('admin_menu', 'kgvid_addFMPOptionsPage');
|
1230 |
|
1231 |
function kgvid_FMPOptionsPage() {
|
|
|
1232 |
$options = get_option('kgvid_video_embed_options');
|
|
|
|
|
1233 |
?>
|
1234 |
<div class="wrap">
|
1235 |
<div class="icon32" id="icon-options-general"><br></div>
|
1236 |
<h2>Video Embed & Thumbnail Generator</h2>
|
|
|
|
|
|
|
|
|
1237 |
<form method="post" action="options.php">
|
1238 |
<?php settings_fields('kgvid_video_embed_options'); ?>
|
1239 |
<input type="hidden" id="kgvid_settings_security" value="<?php echo wp_create_nonce('video-embed-thumbnail-generator-nonce'); ?>">
|
@@ -1246,8 +1632,7 @@ function kgvid_FMPOptionsPage() {
|
|
1246 |
<?php echo "<script type='text/javascript'>
|
1247 |
jQuery(document).ready(function() {
|
1248 |
jQuery('#app_path').data('ffmpeg_exists', '".$options['ffmpeg_exists']."');
|
1249 |
-
|
1250 |
-
kgvid_hide_ffmpeg_settings();
|
1251 |
jQuery('form :input').change(function() {
|
1252 |
kgvid_save_plugin_settings(this);
|
1253 |
});
|
@@ -1261,17 +1646,19 @@ function kgvid_FMPOptionsPage() {
|
|
1261 |
function kgvid_video_embed_options_init() {
|
1262 |
|
1263 |
register_setting('kgvid_video_embed_options', 'kgvid_video_embed_options', 'kgvid_video_embed_options_validate' );
|
1264 |
-
|
1265 |
$options = get_option('kgvid_video_embed_options');
|
1266 |
-
|
1267 |
add_settings_section('kgvid_video_embed_playback_settings', 'Default Video Playback Settings', 'kgvid_plugin_playback_settings_section_callback', __FILE__);
|
1268 |
add_settings_section('kgvid_video_embed_flash_settings', 'The following options will only affect Flash playback', 'kgvid_plugin_flash_settings_section_callback', __FILE__);
|
1269 |
add_settings_section('kgvid_video_embed_plugin_settings', 'Plugin Settings', 'kgvid_plugin_settings_section_callback', __FILE__);
|
1270 |
-
|
|
|
1271 |
add_settings_field('poster', 'Default thumbnail:', 'kgvid_poster_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'poster' ) );
|
1272 |
-
add_settings_field('
|
1273 |
add_settings_field('watermark', 'Watermark image:', 'kgvid_watermark_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'watermark' ) );
|
1274 |
add_settings_field('align', 'Video alignment:', 'kgvid_align_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'align' ) );
|
|
|
1275 |
add_settings_field('inline', 'Inline videos:', 'kgvid_inline_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'inline' ) );
|
1276 |
add_settings_field('dimensions', 'Max embedded video dimensions:', 'kgvid_dimensions_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'width' ) );
|
1277 |
add_settings_field('gallery_dimensions', 'Max gallery video dimensions:', 'kgvid_gallery_dimensions_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'gallery_width' ) );
|
@@ -1280,7 +1667,7 @@ function kgvid_video_embed_options_init() {
|
|
1280 |
add_settings_field('autoplay', 'Autoplay:', 'kgvid_autoplay_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'autoplay' ) );
|
1281 |
add_settings_field('loop', 'Loop:', 'kgvid_loop_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'loop' ) );
|
1282 |
add_settings_field('js_skin', 'Skin Class:', 'kgvid_js_skin_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'js_skin' ) );
|
1283 |
-
|
1284 |
add_settings_field('bgcolor', 'Background color:', 'kgvid_bgcolor_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'bgcolor' ) );
|
1285 |
add_settings_field('configuration', 'XML configuration file:', 'kgvid_configuration_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'configuration' ) );
|
1286 |
add_settings_field('skin', 'Video skin file:', 'kgvid_skin_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'skin' ) );
|
@@ -1288,64 +1675,85 @@ function kgvid_video_embed_options_init() {
|
|
1288 |
add_settings_field('scale_mode', 'Video scale mode:', 'kgvid_scale_mode_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'scale_mode' ) );
|
1289 |
add_settings_field('autohide', 'Autohide:', 'kgvid_autohide_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'autohide' ) );
|
1290 |
add_settings_field('playbutton', 'Play button overlay:', 'kgvid_playbutton_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'playbutton' ) );
|
1291 |
-
|
1292 |
-
add_settings_field('app_path', 'Path to applications on server:', 'kgvid_app_path_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'app_path' ) );
|
1293 |
-
add_settings_field('video_app', 'Application for thumbnails & encoding:', 'kgvid_video_app_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'video_app' ) );
|
1294 |
-
add_settings_field('encode_formats', 'Default Mobile/HTML5 Video encode formats:', 'kgvid_encode_formats_callback', __FILE__, 'kgvid_video_embed_plugin_settings');
|
1295 |
-
add_settings_field('ffmpeg_options', 'FFMPEG Options:', 'kgvid_ffmpeg_options_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'video_bitrate_flag' ) );
|
1296 |
-
add_settings_field('moov', 'Application to fix encoded H.264 headers for streaming:', 'kgvid_moov_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'moov' ) );
|
1297 |
add_settings_field('generate_thumbs', 'Default number of thumbnails to generate:', 'kgvid_generate_thumbs_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'generate_thumbs' ) );
|
1298 |
-
add_settings_field('
|
|
|
1299 |
add_settings_field('featured', 'Featured Image:', 'kgvid_featured_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'featured' ) );
|
1300 |
add_settings_field('thumb_parent', 'Attach thumbnails to:', 'kgvid_thumb_parent_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'thumb_parent' ) );
|
1301 |
add_settings_field('delete_children', 'Delete associated attachments:', 'kgvid_delete_children_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'delete_children' ) );
|
1302 |
-
/* add_settings_field('video_security', 'Attempt to secure video file:', 'kgvid_video_security_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'video_security' ) ); */
|
1303 |
add_settings_field('titlecode', 'Video title text HTML formatting:', 'kgvid_titlecode_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'titlecode' ) );
|
1304 |
add_settings_field('template', 'Attachment template display:', 'kgvid_template_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'template' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1305 |
}
|
1306 |
add_action('admin_init', 'kgvid_video_embed_options_init' );
|
1307 |
|
1308 |
//callback functions generating HTML for the settings form
|
1309 |
|
1310 |
function kgvid_plugin_playback_settings_section_callback() {
|
|
|
1311 |
$options = get_option('kgvid_video_embed_options');
|
1312 |
-
if ( $options['embeddable']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1313 |
else { $embed_disabled = ""; }
|
1314 |
-
|
1315 |
-
$items = array("Strobe Media Playback"
|
1316 |
-
|
|
|
1317 |
foreach($items as $item) {
|
1318 |
$selected = ($options['embed_method']==$item) ? 'selected="selected"' : '';
|
1319 |
echo "<option value='$item' $selected>$item</option>";
|
1320 |
}
|
1321 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>This plugin
|
1322 |
-
|
1323 |
$sampleheight = intval($options['height']) + 25;
|
1324 |
echo "<div class='kgvid_setting_nearvid' style='width:".$options['width']."px;'>";
|
1325 |
-
echo "<div style='float:left;'><input ".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>";
|
1326 |
-
echo "<div style='float:right;'><input ".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>";
|
1327 |
$iframeurl = site_url('/')."?kgvid_video_embed[enable]=true&kgvid_video_embed[sample]=true";
|
1328 |
echo "<iframe id='kgvid_samplevideo' style='border:2px;' src='".$iframeurl."' scrolling='no' width='".$options['width']."' height='".$sampleheight."'></iframe>";
|
1329 |
-
echo "<div style='float:right;'><input ".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</label></div>";
|
1330 |
-
echo "</div
|
1331 |
}
|
1332 |
function kgvid_plugin_flash_settings_section_callback() { }
|
1333 |
function kgvid_plugin_settings_section_callback() { }
|
1334 |
-
|
1335 |
function kgvid_poster_callback() {
|
1336 |
$options = get_option('kgvid_video_embed_options');
|
1337 |
-
echo "<input class='regular-text' id='poster' name='kgvid_video_embed_options[poster]' type='text' value='".$options['poster']."' />";
|
1338 |
}
|
1339 |
-
|
1340 |
-
function
|
1341 |
$options = get_option('kgvid_video_embed_options');
|
1342 |
-
echo "<input ".checked( $options['
|
1343 |
-
echo "<input class='regular-text' id='
|
|
|
1344 |
}
|
1345 |
-
|
1346 |
function kgvid_watermark_callback() {
|
1347 |
$options = get_option('kgvid_video_embed_options');
|
1348 |
-
echo "<input class='regular-text' id='watermark' name='kgvid_video_embed_options[watermark]' type='text' value='".$options['watermark']."' />";
|
1349 |
}
|
1350 |
|
1351 |
function kgvid_align_callback() {
|
@@ -1356,221 +1764,414 @@ add_action('admin_init', 'kgvid_video_embed_options_init' );
|
|
1356 |
$selected = ($options['align']==$item) ? 'selected="selected"' : '';
|
1357 |
echo "<option value='$item' $selected>$item</option>";
|
1358 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1359 |
}
|
1360 |
-
|
1361 |
function kgvid_inline_callback() {
|
1362 |
$options = get_option('kgvid_video_embed_options');
|
1363 |
-
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.</label
|
1364 |
}
|
1365 |
-
|
1366 |
function kgvid_dimensions_callback() {
|
1367 |
$options = get_option('kgvid_video_embed_options');
|
1368 |
-
echo "Width: <input class='small-text' id='width' name='kgvid_video_embed_options[width]' type='text' value='".$options['width']."' /> Height: <input class='small-text' id='height' name='kgvid_video_embed_options[height]' type='text' value='".$options['height']."' />";
|
|
|
1369 |
}
|
1370 |
-
|
1371 |
function kgvid_gallery_dimensions_callback() {
|
1372 |
$options = get_option('kgvid_video_embed_options');
|
1373 |
-
echo "Width: <input class='small-text' id='gallery_width' name='kgvid_video_embed_options[gallery_width]' type='text' value='".$options['gallery_width']."' /> Width: <input class='small-text' id='gallery_height' name='kgvid_video_embed_options[gallery_height]' type='text' value='".$options['gallery_height']."'
|
1374 |
}
|
1375 |
-
|
1376 |
function kgvid_gallery_thumb_callback() {
|
1377 |
$options = get_option('kgvid_video_embed_options');
|
1378 |
-
echo "<input class='small-text' id='gallery_thumb' name='kgvid_video_embed_options[gallery_thumb]' type='text' value='".$options['gallery_thumb']."'
|
1379 |
}
|
1380 |
-
|
1381 |
function kgvid_controlbar_style_callback() {
|
1382 |
$options = get_option('kgvid_video_embed_options');
|
1383 |
$items = array("docked", "floating", "none");
|
1384 |
-
echo "<select id='controlbar_style' name='kgvid_video_embed_options[controlbar_style]'>";
|
1385 |
foreach($items as $item) {
|
1386 |
$selected = ($options['controlbar_style']==$item) ? 'selected="selected"' : '';
|
1387 |
echo "<option value='$item' $selected>$item</option>";
|
1388 |
}
|
1389 |
-
echo "</select> HTML5 video players only respond to the \"none\" option
|
1390 |
}
|
1391 |
-
|
1392 |
function kgvid_autoplay_callback() {
|
1393 |
$options = get_option('kgvid_video_embed_options');
|
1394 |
-
echo "<input ".checked( $options['autoplay'], "on", false )." id='autoplay' name='kgvid_video_embed_options[autoplay]' type='checkbox' /> <label for='autoplay'>Play automatically when page loads.</label
|
1395 |
}
|
1396 |
-
|
1397 |
function kgvid_loop_callback() {
|
1398 |
$options = get_option('kgvid_video_embed_options');
|
1399 |
-
echo "<input ".checked( $options['loop'], "on", false )." id='loop' name='kgvid_video_embed_options[loop]' type='checkbox' /> <label for='loop'>Loop to beginning when video ends.</label
|
1400 |
}
|
1401 |
-
|
1402 |
function kgvid_js_skin_callback() {
|
1403 |
$options = get_option('kgvid_video_embed_options');
|
1404 |
-
echo "<input class='regular-text code' id='js_skin' name='kgvid_video_embed_options[js_skin]' type='text' value='".$options['js_skin']."' /><br /><em><small>Use <code>kg-video-js-skin</code> for a nice, circular play button. Leave blank for the default square play button. <a href='http://videojs.com/docs/skins/'>Or build your own CSS skin.</a></small></em
|
1405 |
}
|
1406 |
-
|
1407 |
function kgvid_bgcolor_callback() {
|
1408 |
$options = get_option('kgvid_video_embed_options');
|
1409 |
-
echo "<input class='small-text' id='bgcolor' name='kgvid_video_embed_options[bgcolor]' maxlength='7' type='text' value='".$options['bgcolor']."' /> #rrggbb";
|
1410 |
}
|
1411 |
-
|
1412 |
function kgvid_configuration_callback() {
|
1413 |
$options = get_option('kgvid_video_embed_options');
|
1414 |
-
echo "<input class='regular-text' id='configuration' name='kgvid_video_embed_options[configuration]' type='text' value='".$options['configuration']."'
|
1415 |
}
|
1416 |
-
|
1417 |
function kgvid_skin_callback() {
|
1418 |
$options = get_option('kgvid_video_embed_options');
|
1419 |
-
echo "<input class='regular-text' 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> for a modern, circular play button.<br /> Leave blank for the
|
1420 |
}
|
1421 |
-
|
1422 |
function kgvid_stream_type_callback() {
|
1423 |
$options = get_option('kgvid_video_embed_options');
|
1424 |
$items = array("liveOrRecorded", "live", "recorded", "dvr");
|
1425 |
-
echo "<select id='stream_type' name='kgvid_video_embed_options[stream_type]'>";
|
1426 |
foreach($items as $item) {
|
1427 |
$selected = ($options['stream_type']==$item) ? 'selected="selected"' : '';
|
1428 |
echo "<option value='$item' $selected>$item</option>";
|
1429 |
}
|
1430 |
-
echo "</select
|
1431 |
}
|
1432 |
-
|
1433 |
function kgvid_scale_mode_callback() {
|
1434 |
$options = get_option('kgvid_video_embed_options');
|
1435 |
$items = array("letterbox", "none", "stretch", "zoom");
|
1436 |
-
echo "<select id='scale_mode' name='kgvid_video_embed_options[scale_mode]'>";
|
1437 |
foreach($items as $item) {
|
1438 |
$selected = ($options['scale_mode']==$item) ? 'selected="selected"' : '';
|
1439 |
echo "<option value='$item' $selected>$item</option>";
|
1440 |
}
|
1441 |
-
echo "</select
|
1442 |
}
|
1443 |
-
|
1444 |
function kgvid_autohide_callback() {
|
1445 |
$options = get_option('kgvid_video_embed_options');
|
1446 |
-
echo "<input ".checked( $options['autohide'], "on", false )." id='autohide' name='kgvid_video_embed_options[autohide]' type='checkbox' /> <label for='autohide'>Autohide controlbar.</label
|
1447 |
}
|
1448 |
-
|
1449 |
function kgvid_playbutton_callback() {
|
1450 |
$options = get_option('kgvid_video_embed_options');
|
1451 |
-
echo "<input ".checked( $options['playbutton'], "on", false )." id='playbutton' name='kgvid_video_embed_options[playbutton]' type='checkbox' /> <label for='playbutton'>Overlay play button on poster frame.</label
|
|
|
|
|
|
|
|
|
|
|
1452 |
}
|
1453 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1454 |
function kgvid_app_path_callback() {
|
1455 |
$options = get_option('kgvid_video_embed_options');
|
1456 |
-
echo "<input class='regular-text code' id='app_path' name='kgvid_video_embed_options[app_path]' type='text' value='".stripslashes($options['app_path'])."' /><a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Don't include trailing slash. Example: <code>/usr/local/bin</code>. On Windows servers, use / instead of C:\\";
|
1457 |
}
|
1458 |
|
1459 |
function kgvid_video_app_callback() {
|
1460 |
$options = get_option('kgvid_video_embed_options');
|
|
|
1461 |
$items = array("FFMPEG"=>"ffmpeg", "LIBAV"=>"avconv");
|
1462 |
-
echo "<select onchange='kgvid_hide_ffmpeg_settings();' id='video_app' name='kgvid_video_embed_options[video_app]'>";
|
1463 |
foreach($items as $name => $value) {
|
1464 |
$selected = ($options['video_app']==$value) ? 'selected="selected"' : '';
|
1465 |
echo "<option value='$value' $selected>$name</option>";
|
1466 |
}
|
1467 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>FFMPEG split into two separate branches in 2011. The new branch is called LIBAV. Both are still actively developed. Debian & Ubuntu users probably have LIBAV installed.</span></a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1468 |
}
|
1469 |
-
|
1470 |
function kgvid_encode_formats_callback() {
|
1471 |
-
$options = get_option('kgvid_video_embed_options');
|
1472 |
-
echo "<div class='kgvid_video_app_required'>";
|
1473 |
-
echo "<input ".checked( $options['
|
|
|
1474 |
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, some Android, Chrome, Safari, IE 9+)</em></small></label><br />";
|
1475 |
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+)</em></small></label><br />";
|
1476 |
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 />";
|
1477 |
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>";
|
1478 |
-
echo
|
1479 |
}
|
1480 |
-
|
1481 |
-
function
|
1482 |
$options = get_option('kgvid_video_embed_options');
|
1483 |
-
echo "<div class='kgvid_video_app_required'>";
|
1484 |
-
echo "<input
|
1485 |
-
<input
|
1486 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1487 |
}
|
1488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1489 |
function kgvid_moov_callback() {
|
1490 |
$options = get_option('kgvid_video_embed_options');
|
1491 |
-
echo "<div class='kgvid_video_app_required'>";
|
1492 |
-
$items = array("none", "qt-faststart", "MP4Box");
|
1493 |
-
echo "<select id='moov' name='kgvid_video_embed_options[moov]'>";
|
1494 |
-
foreach($items as $
|
1495 |
-
$selected = ($options['moov']==$
|
1496 |
-
echo "<option value='$
|
1497 |
}
|
1498 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>
|
1499 |
-
echo "</div
|
1500 |
}
|
1501 |
|
1502 |
-
function
|
1503 |
$options = get_option('kgvid_video_embed_options');
|
1504 |
-
echo "<div class='kgvid_video_app_required'>";
|
1505 |
-
echo "<
|
1506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1507 |
}
|
1508 |
-
|
1509 |
-
function
|
1510 |
$options = get_option('kgvid_video_embed_options');
|
1511 |
-
echo "<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1512 |
}
|
1513 |
-
|
1514 |
-
function
|
1515 |
$options = get_option('kgvid_video_embed_options');
|
1516 |
-
echo "<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1517 |
}
|
1518 |
-
|
1519 |
-
function
|
1520 |
$options = get_option('kgvid_video_embed_options');
|
1521 |
-
|
1522 |
-
echo "<select id='
|
|
|
1523 |
foreach($items as $item) {
|
1524 |
-
$selected = ($options['
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1525 |
echo "<option value='$item' $selected>$item</option>";
|
1526 |
}
|
1527 |
-
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>
|
|
|
1528 |
}
|
1529 |
-
|
1530 |
-
function
|
1531 |
$options = get_option('kgvid_video_embed_options');
|
1532 |
-
|
1533 |
-
|
|
|
1534 |
foreach($items as $item) {
|
1535 |
-
$selected = ($options['
|
1536 |
echo "<option value='$item' $selected>$item</option>";
|
1537 |
}
|
1538 |
-
echo "</select>
|
|
|
1539 |
}
|
1540 |
-
|
1541 |
-
|
1542 |
-
$options = get_option('kgvid_video_embed_options');
|
1543 |
-
echo "<input ".checked( $options['video_security'], "on", false )." id='video_security' name='kgvid_video_embed_options[video_security]' type='checkbox' /> <label for='video_security'>Disable right-clicking on video and obscure the video's URL.</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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 this will make it a little more difficult to download your videos.</span></a>";
|
1544 |
-
} */
|
1545 |
-
|
1546 |
-
function kgvid_titlecode_callback() {
|
1547 |
$options = get_option('kgvid_video_embed_options');
|
1548 |
-
echo "<
|
|
|
|
|
|
|
1549 |
}
|
1550 |
-
|
1551 |
-
function
|
1552 |
$options = get_option('kgvid_video_embed_options');
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1558 |
}
|
1559 |
-
|
|
|
|
|
|
|
|
|
|
|
1560 |
}
|
1561 |
|
1562 |
//end of settings page callback functions
|
1563 |
|
1564 |
function kgvid_update_settings() {
|
1565 |
-
|
1566 |
global $wpdb;
|
1567 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1568 |
$options = get_option('kgvid_video_embed_options');
|
1569 |
$options_old = $options; //save the values that are in the db
|
1570 |
$default_options = kgvid_default_options_fn();
|
1571 |
-
|
1572 |
if ( empty($options) ) { // run if the new settings don't exist yet (before version 3.0)
|
1573 |
-
|
1574 |
$options = array();
|
1575 |
|
1576 |
$old_setting_equivalents = array (
|
@@ -1578,7 +2179,7 @@ function kgvid_update_settings() {
|
|
1578 |
"height"=>"wp_FMP_height",
|
1579 |
"controlbar_style"=>"wp_FMP_controlbar_style",
|
1580 |
"poster"=>"wp_FMP_poster",
|
1581 |
-
"
|
1582 |
"autohide"=>"wp_FMP_autohide",
|
1583 |
"autoplay"=>"wp_FMP_autoplay",
|
1584 |
"loop"=>"wp_FMP_loop",
|
@@ -1606,21 +2207,21 @@ function kgvid_update_settings() {
|
|
1606 |
}
|
1607 |
}
|
1608 |
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'wp_FMP%'" );
|
1609 |
-
|
1610 |
foreach ( $default_options as $key => $value ) { //apply default values for any settings that didn't exist before
|
1611 |
if ( !array_key_exists($key, $options) ) { $options[$key] = $value; }
|
1612 |
$options['embed_method'] = "Strobe Media Playback";
|
1613 |
}
|
1614 |
-
|
1615 |
-
update_option('kgvid_video_embed_options', $options);
|
1616 |
}
|
1617 |
-
|
1618 |
else { //user is already upgraded to version 3.0, but needs the extra options introduced in later versions
|
1619 |
if ( $options['version'] < 3.1 ) {
|
1620 |
$options['version'] = 3.1;
|
1621 |
if ( $options['ffmpeg_vpre'] == "on" ) { $options['video_bitrate_flag'] = "on"; } //if user has ffmpeg_vpre turned on, they need the old bitrate flags too
|
1622 |
else { $options['video_bitrate_flag'] = false; }
|
1623 |
-
$options['watermark'] = "";
|
1624 |
}
|
1625 |
if ( $options['version'] < 4.0 ) {
|
1626 |
$options['version'] = 4.0;
|
@@ -1633,7 +2234,7 @@ function kgvid_update_settings() {
|
|
1633 |
$options['delete_children'] = "encoded videos only";
|
1634 |
if ( $options['template'] == "on" ) { $options['template'] = "old"; }
|
1635 |
else { $options['template'] = "gentle"; }
|
1636 |
-
$checkbox_convert = array ( "autohide", "
|
1637 |
foreach ( $checkbox_convert as $option ) {
|
1638 |
if ( $options[$option] == "true" ) { $options[$option] = "on"; } //some checkboxes were incorrectly set to "true" in older versions
|
1639 |
}
|
@@ -1641,16 +2242,68 @@ function kgvid_update_settings() {
|
|
1641 |
wp_clear_scheduled_hook('kgvid_cleanup_queue');
|
1642 |
wp_schedule_event( time()+86400, 'daily', 'kgvid_cleanup_queue', array ( 'scheduled' ) );
|
1643 |
}
|
1644 |
-
|
1645 |
}
|
1646 |
if ( $options['version'] < 4.1 ) {
|
1647 |
$options['version'] = 4.1;
|
1648 |
$options['embeddable'] = "on";
|
1649 |
$options['inline'] = "on";
|
1650 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1651 |
if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
|
1652 |
if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
|
1653 |
}
|
|
|
1654 |
}
|
1655 |
add_action('init', 'kgvid_update_settings' );
|
1656 |
|
@@ -1658,82 +2311,97 @@ function kgvid_video_embed_options_validate($input) { //validate & sanitize inpu
|
|
1658 |
|
1659 |
$options = get_option('kgvid_video_embed_options');
|
1660 |
$default_options = kgvid_default_options_fn();
|
1661 |
-
|
1662 |
if (isset ($_POST["video-embed-thumbnail-generator-reset"])) {
|
1663 |
$input = $default_options;
|
1664 |
add_settings_error( __FILE__, "options-reset", "Video Embed & Thumbnail Generator settings reset to default values.", "updated" );
|
1665 |
}
|
1666 |
|
1667 |
$ffmpeg_info = kgvid_check_ffmpeg_exists($input, false);
|
1668 |
-
|
1669 |
if ( $ffmpeg_info['exec_enabled'] == false ) {
|
1670 |
-
add_settings_error( __FILE__, "ffmpeg-disabled", $ffmpeg_info['function']." is disabled in PHP settings. You can embed existing videos
|
1671 |
$input['ffmpeg_exists'] = "notinstalled";
|
1672 |
}
|
1673 |
elseif ( $ffmpeg_info['ffmpeg_exists'] == false ) {
|
1674 |
-
add_settings_error( __FILE__, "ffmpeg-disabled", strtoupper($input['video_app'])." not found at ".$input['app_path'].". You can embed existing videos
|
1675 |
$input['ffmpeg_exists'] = "notinstalled";
|
1676 |
}
|
1677 |
if ( $ffmpeg_info['ffmpeg_exists'] == true ) { $input['ffmpeg_exists'] = "on"; }
|
1678 |
-
|
1679 |
-
if ( empty($input['width']) ) {
|
1680 |
add_settings_error( __FILE__, "width-zero", "You must enter a value for the maximum video width.");
|
1681 |
$input['width'] = $options['width'];
|
1682 |
}
|
1683 |
-
if ( empty($input['height']) ) {
|
1684 |
add_settings_error( __FILE__, "height-zero", "You must enter a value for the maximum video height.");
|
1685 |
$input['height'] = $options['height'];
|
1686 |
}
|
1687 |
-
if ( empty($input['gallery_width']) ) {
|
1688 |
add_settings_error( __FILE__, "gallery-width-zero", "You must enter a value for the maximum gallery video width.");
|
1689 |
$input['gallery_width'] = $options['gallery_width'];
|
1690 |
}
|
1691 |
-
if ( empty($input['gallery_height']) ) {
|
1692 |
add_settings_error( __FILE__, "gallery-height-zero", "You must enter a value for the maximum gallery video height.");
|
1693 |
$input['gallery_height'] = $options['gallery_height'];
|
1694 |
}
|
1695 |
-
|
|
|
|
|
1696 |
$input['titlecode'] = wp_kses_post( $input['titlecode'] );
|
1697 |
-
|
1698 |
// load all settings and make sure they get a value of false if they weren't entered into the form
|
1699 |
foreach ( $default_options as $key => $value ) {
|
1700 |
if ( !array_key_exists($key, $input) ) { $input[$key] = false; }
|
1701 |
}
|
1702 |
|
|
|
|
|
1703 |
$input['version'] = $default_options['version']; //since this isn't user selectable it has to be re-entered every time
|
1704 |
-
|
1705 |
return $input;
|
1706 |
}
|
1707 |
|
1708 |
function kgvid_ajax_save_settings() {
|
1709 |
|
1710 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1725 |
}
|
1726 |
add_action('wp_ajax_kgvid_save_settings', 'kgvid_ajax_save_settings');
|
1727 |
|
1728 |
-
|
1729 |
|
1730 |
-
$
|
1731 |
-
|
1732 |
-
|
1733 |
-
|
1734 |
-
|
|
|
|
|
|
|
|
|
1735 |
}
|
1736 |
-
|
1737 |
}
|
1738 |
add_action('add_attachment', 'kgvid_add_attachment_handler');
|
1739 |
|
@@ -1741,51 +2409,104 @@ function kgvid_cron_new_attachment_handler($post_id) {
|
|
1741 |
|
1742 |
$options = get_option('kgvid_video_embed_options');
|
1743 |
$post = get_post($post_id);
|
1744 |
-
error_log($post_id);
|
1745 |
$movieurl = wp_get_attachment_url($post_id);
|
1746 |
-
|
1747 |
-
$
|
1748 |
-
|
1749 |
-
|
1750 |
-
|
1751 |
-
|
1752 |
-
|
1753 |
-
|
1754 |
-
|
1755 |
-
|
1756 |
-
|
1757 |
-
|
1758 |
-
|
1759 |
-
|
1760 |
-
|
1761 |
-
|
1762 |
-
|
1763 |
-
|
1764 |
-
|
1765 |
-
|
1766 |
-
|
1767 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1768 |
|
1769 |
$options = get_option('kgvid_video_embed_options');
|
1770 |
|
1771 |
-
if ( substr($post->post_mime_type, 0, 5) == 'video'
|
|
|
|
|
1772 |
|
1773 |
-
|
1774 |
|
|
|
1775 |
$movieurl = wp_get_attachment_url($post->ID);
|
|
|
|
|
|
|
|
|
1776 |
$form_fields["kgflashmediaplayer-url"]["input"] = "hidden";
|
1777 |
$form_fields["kgflashmediaplayer-url"]["value"] = $movieurl;
|
1778 |
|
1779 |
$maxwidth = $options['width'];
|
1780 |
-
|
1781 |
-
|
|
|
|
|
|
|
|
|
1782 |
|
1783 |
$form_fields["kgflashmediaplayer-maxwidth"]["input"] = "hidden";
|
1784 |
$form_fields["kgflashmediaplayer-maxwidth"]["value"] = $maxwidth;
|
1785 |
|
1786 |
$maxheight = $options['height'];
|
1787 |
-
|
1788 |
-
|
|
|
|
|
|
|
|
|
1789 |
|
1790 |
$form_fields["kgflashmediaplayer-maxheight"]["input"] = "hidden";
|
1791 |
$form_fields["kgflashmediaplayer-maxheight"]["value"] = $maxheight;
|
@@ -1794,8 +2515,8 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
1794 |
$form_fields["kgflashmediaplayer-aspect"]["value"] = $heightset/$widthset;
|
1795 |
|
1796 |
$embedset = get_post_meta($post->ID, "_kgflashmediaplayer-embed", true);
|
1797 |
-
if ($embedset == "") {
|
1798 |
-
$embedset = "Single Video";
|
1799 |
update_post_meta($post->ID, '_kgflashmediaplayer-embed', $embedset); //make sure at least this value is set before attachment is inserted into post
|
1800 |
}
|
1801 |
|
@@ -1813,18 +2534,19 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
1813 |
else { if ( !kgvid_url_exists($thumbnail_url) ) { $thumbnail_url = ""; } }
|
1814 |
|
1815 |
$thumbnail_html = "";
|
1816 |
-
if ($thumbnail_url != "" ) {
|
1817 |
-
$thumbnail_html = '<div
|
1818 |
}
|
1819 |
|
1820 |
$numberofthumbs_value = get_post_meta($post->ID, "_kgflashmediaplayer-numberofthumbs", true);
|
1821 |
if (get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true) != "") { $numberofthumbs_value = "1"; }
|
1822 |
if ( empty($numberofthumbs_value) ) { $numberofthumbs_value = $options['generate_thumbs']; }
|
1823 |
|
1824 |
-
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
|
1825 |
kgvid_check_ffmpeg_exists($options, true);
|
1826 |
}
|
1827 |
|
|
|
1828 |
$forcefirstchecked = get_post_meta($post->ID, "_kgflashmediaplayer-forcefirst", true);
|
1829 |
|
1830 |
$featuredchecked = get_post_meta($post->ID, "_kgflashmediaplayer-featured", true);
|
@@ -1837,29 +2559,93 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
1837 |
|
1838 |
$nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
|
1839 |
|
1840 |
-
|
1841 |
-
|
1842 |
-
|
1843 |
-
|
1844 |
-
|
1845 |
-
|
1846 |
-
|
1847 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1848 |
|
1849 |
}
|
1850 |
|
1851 |
$form_fields["generator"]["label"] = __("Thumbnails");
|
1852 |
$form_fields["generator"]["input"] = "html";
|
1853 |
-
$form_fields["generator"]["html"] = '<input type="hidden" name="attachments['.$post->ID.'][kgflashmediaplayer-security]" id="attachments-'.$post->ID.'-kgflashmediaplayer-security" value="'.$nonce.'"
|
1854 |
-
|
1855 |
-
|
1856 |
-
|
1857 |
-
<
|
1858 |
-
<
|
1859 |
-
|
1860 |
-
$form_fields["thumbtime"]["label"] = __("Thumbnail Time");
|
1861 |
-
$form_fields["thumbtime"]["value"] = get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true);
|
1862 |
-
$form_fields["thumbtime"]["helps"] = "<small>Optional: generates a single thumbnail at the specified time (hh:mm:ss, mm:ss, or s).</small>";
|
1863 |
|
1864 |
$form_fields["kgflashmediaplayer-poster"]["label"] = __("Thumbnail URL");
|
1865 |
$form_fields["kgflashmediaplayer-poster"]["value"] = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
|
@@ -1871,9 +2657,9 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
1871 |
|
1872 |
$form_fields["kgflashmediaplayer-dimensions"]["label"] = __("Video Embed Dimensions");
|
1873 |
$form_fields["kgflashmediaplayer-dimensions"]["input"] = "html";
|
1874 |
-
$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;" onchange="kgvid_set_dimension('.$post->ID.', \'height\', this.value);" onkeyup="kgvid_set_dimension('.$post->ID.', \'height\', this.value);"> Height:
|
1875 |
<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 />
|
1876 |
-
<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.'>
|
1877 |
<label for="attachments-'. $post->ID .'-kgflashmediaplayer-lockaspect"><small>Lock to aspect ratio</small></label>';
|
1878 |
$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'>default dimensions</a>.</small>";
|
1879 |
|
@@ -1884,6 +2670,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
1884 |
$form_fields["kgflashmediaplayer-encode"]["input"] = "html";
|
1885 |
$form_fields["kgflashmediaplayer-encode"]["html"] = $checkboxes;
|
1886 |
|
|
|
1887 |
$showtitlechecked = get_post_meta($post->ID, "_kgflashmediaplayer-showtitle", true);
|
1888 |
if ( $showtitlechecked == "notchecked" ) { $showtitlechecked = ""; }
|
1889 |
$downloadlinkchecked = get_post_meta($post->ID, "_kgflashmediaplayer-downloadlink", true);
|
@@ -1900,27 +2687,28 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
1900 |
|
1901 |
$form_fields["kgflashmediaplayer-options"]["label"] = __("Video Embed Options");
|
1902 |
$form_fields["kgflashmediaplayer-options"]["input"] = "html";
|
1903 |
-
$form_fields["kgflashmediaplayer-options"]["html"] = '<input type="checkbox" name="attachments['.$post->ID.'][kgflashmediaplayer-showtitle]" id="attachments-'.$post->ID.'-kgflashmediaplayer-showtitle" value="checked" '.$showtitlechecked.'>
|
1904 |
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-showtitle">Insert title above video</label><br />
|
1905 |
|
1906 |
-
<input type="checkbox" name="attachments['.$post->ID.'][kgflashmediaplayer-downloadlink]" id="attachments-'.$post->ID.'-kgflashmediaplayer-downloadlink" value="checked" '.$downloadlinkchecked.'>
|
1907 |
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-downloadlink">Insert download link below video<em><small><br />Makes it easier for users to download file.</em></small></label><br />
|
|
|
1908 |
'.$shortcode_select.'
|
1909 |
-
<
|
1910 |
|
1911 |
if ( get_post_meta($post->ID, "_kgflashmediaplayer-embed", true) == "Video Gallery" ) {
|
1912 |
|
1913 |
$gallery_thumb_width = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_thumb_width", true);
|
1914 |
if ( empty($gallery_thumb_width) ) { $gallery_thumb_width = $options['gallery_thumb']; }
|
1915 |
-
|
1916 |
$gallery_exclude = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_exclude", true);
|
1917 |
$gallery_include = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_include", true);
|
1918 |
$gallery_orderby = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_orderby", true);
|
1919 |
$gallery_order = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_order", true);
|
1920 |
-
|
1921 |
$gallery_id = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_id", true);
|
1922 |
if ( empty($gallery_id) ) { $gallery_id = $post->post_parent; }
|
1923 |
-
|
1924 |
$items = array("menu_order", "title", "post_date", "rand", "ID");
|
1925 |
$gallery_orderby_select = '<select name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_orderby]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_orderby">';
|
1926 |
foreach($items as $item) {
|
@@ -1928,7 +2716,7 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
1928 |
$gallery_orderby_select .= "<option value='$item' $selected>$item</option>";
|
1929 |
}
|
1930 |
$gallery_orderby_select .= "</select>";
|
1931 |
-
|
1932 |
$items = array("ASC", "DESC");
|
1933 |
$gallery_order_select = '<select name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_order]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_order">';
|
1934 |
foreach($items as $item) {
|
@@ -1947,46 +2735,174 @@ function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
|
1947 |
<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_id]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_id" type ="text" value="'.$gallery_id.'" style="width:50px;"> <label for="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_id">Post ID</label>
|
1948 |
';
|
1949 |
|
1950 |
-
}//if video gallery
|
1951 |
} //only add fields if attachment is the right kind of video
|
1952 |
-
return $form_fields;
|
1953 |
-
}
|
1954 |
-
// attach our function to the correct hook
|
1955 |
-
add_filter("attachment_fields_to_edit", "kgvid_image_attachment_fields_to_edit", null, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1956 |
|
1957 |
-
function kgvid_save_thumb($post_id, $post_name, $thumb_url) {
|
1958 |
-
|
1959 |
$options = get_option('kgvid_video_embed_options');
|
1960 |
$uploads = wp_upload_dir();
|
1961 |
-
|
1962 |
$posterfile = pathinfo($thumb_url, PATHINFO_BASENAME);
|
1963 |
$tmp_posterpath = $uploads['path'].'/thumb_tmp/'.$posterfile;
|
1964 |
$final_posterpath = $uploads['path'].'/'.$posterfile;
|
1965 |
if ( !is_file($final_posterpath) ) { //if the file doesn't already exist
|
1966 |
-
if ( is_file($tmp_posterpath) ) {
|
1967 |
-
|
1968 |
-
$thumb_base = substr($tmp_posterpath, 0, strpos($tmp_posterpath, '_thumb'));
|
1969 |
-
foreach (glob($thumb_base."*.jpg") as $thumbfilename) {
|
1970 |
-
unlink($thumbfilename);
|
1971 |
-
}
|
1972 |
}
|
1973 |
-
if ( kgvid_is_empty_dir($uploads["path"].'/thumb_tmp') ) { kgvid_rrmdir($uploads["path"].'/thumb_tmp'); }
|
1974 |
}
|
1975 |
-
|
1976 |
//insert the $thumb_url into the media library if it does not already exist
|
1977 |
-
|
1978 |
-
|
1979 |
-
|
1980 |
-
$
|
1981 |
-
|
1982 |
-
|
1983 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1984 |
$desc = $post_name . ' thumbnail';
|
|
|
1985 |
|
1986 |
//is image in uploads directory?
|
1987 |
$upload_dir = wp_upload_dir();
|
1988 |
-
|
1989 |
-
$video = get_post($post_id);
|
1990 |
if ( $options['thumb_parent'] == "post" ) {
|
1991 |
if ( !empty($video->post_parent) ) { $post_id = $video->post_parent; }
|
1992 |
}
|
@@ -1996,7 +2912,7 @@ function kgvid_save_thumb($post_id, $post_name, $thumb_url) {
|
|
1996 |
$filename = preg_replace('/\.[^.]+$/', '', basename($thumb_url));
|
1997 |
|
1998 |
$attachment = array(
|
1999 |
-
'guid' => $thumb_url,
|
2000 |
'post_mime_type' => $wp_filetype['type'],
|
2001 |
'post_title' => $desc,
|
2002 |
'post_content' => '',
|
@@ -2009,7 +2925,7 @@ function kgvid_save_thumb($post_id, $post_name, $thumb_url) {
|
|
2009 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
2010 |
$attach_data = wp_generate_attachment_metadata( $thumb_id, $uploads['path'].'/'.$posterfile );
|
2011 |
wp_update_attachment_metadata( $thumb_id, $attach_data );
|
2012 |
-
}
|
2013 |
else { //not in uploads so we'll have to sideload it
|
2014 |
$tmp = download_url( $thumb_url );
|
2015 |
|
@@ -2024,7 +2940,7 @@ function kgvid_save_thumb($post_id, $post_name, $thumb_url) {
|
|
2024 |
@unlink($file_array['tmp_name']);
|
2025 |
$file_array['tmp_name'] = '';
|
2026 |
}
|
2027 |
-
|
2028 |
// do the validation and storage stuff
|
2029 |
$thumb_id = media_handle_sideload( $file_array, $post_id, $desc );
|
2030 |
|
@@ -2037,45 +2953,64 @@ function kgvid_save_thumb($post_id, $post_name, $thumb_url) {
|
|
2037 |
if ( $local_src = wp_get_attachment_url( $thumb_id ) ) {
|
2038 |
update_post_meta($post_id, '_kgflashmediaplayer-poster', $local_src);
|
2039 |
}
|
2040 |
-
|
2041 |
} //end sideload
|
2042 |
-
|
2043 |
-
$thumb_id = intval( $thumb_id );
|
2044 |
update_post_meta($post_id, '_kgflashmediaplayer-poster-id', $thumb_id);
|
2045 |
-
set_post_thumbnail($post_id, $thumb_id);
|
2046 |
update_post_meta($thumb_id, '_kgflashmediaplayer-video-id', $video->ID);
|
2047 |
-
|
2048 |
} //end get_attachment_id_from_src
|
2049 |
|
2050 |
if(!is_wp_error($thumb_id)) {
|
2051 |
-
|
2052 |
return $thumb_id;
|
2053 |
}
|
2054 |
|
2055 |
}
|
2056 |
|
2057 |
-
|
2058 |
-
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
-
|
2063 |
-
|
2064 |
-
|
2065 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2066 |
if( !empty($post['ID']) ) {
|
2067 |
$thumb_id = "";
|
2068 |
if( isset($attachment['kgflashmediaplayer-poster']) ) {
|
2069 |
-
|
2070 |
$thumb_url = $attachment['kgflashmediaplayer-poster'];
|
2071 |
-
if ( !empty($thumb_url) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2072 |
update_post_meta($post['ID'], '_kgflashmediaplayer-poster', $thumb_url);
|
2073 |
-
|
2074 |
}
|
|
|
2075 |
if( isset($attachment['kgflashmediaplayer-numberofthumbs']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-numberofthumbs', $attachment['kgflashmediaplayer-numberofthumbs']); }
|
2076 |
if( isset($attachment['kgflashmediaplayer-forcefirst']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-forcefirst', $attachment['kgflashmediaplayer-forcefirst']); }
|
2077 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-forcefirst', ""); }
|
2078 |
-
if( isset($attachment['kgflashmediaplayer-featured']) ) {
|
2079 |
update_post_meta($post['ID'], '_kgflashmediaplayer-featured', $attachment['kgflashmediaplayer-featured']);
|
2080 |
if ( !empty($thumb_id) && array_key_exists('post_parent', $post) ) { set_post_thumbnail($post['post_parent'], $thumb_id); }
|
2081 |
}
|
@@ -2086,20 +3021,19 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
|
|
2086 |
if( isset($attachment['kgflashmediaplayer-aspect']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-aspect', $attachment['kgflashmediaplayer-aspect']); }
|
2087 |
if( isset($attachment['kgflashmediaplayer-lockaspect']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-lockaspect', $attachment['kgflashmediaplayer-lockaspect']); }
|
2088 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-lockaspect', "notchecked"); }
|
2089 |
-
|
2090 |
-
$video_formats = kgvid_video_formats();
|
2091 |
foreach ( $video_formats as $format => $format_stats ) {
|
2092 |
if( isset($attachment['kgflashmediaplayer-encode'.$format]) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-encode'.$format, "on"); }
|
2093 |
-
|
2094 |
-
else { delete_post_meta($post['ID'], '_kgflashmediaplayer-encode'.$format); } //if it used to be checked, delete that meta value
|
2095 |
}
|
2096 |
-
|
2097 |
if( isset($attachment['kgflashmediaplayer-showtitle']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', $attachment['kgflashmediaplayer-showtitle']); }
|
2098 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', "notchecked"); }
|
2099 |
-
|
2100 |
if( isset($attachment['kgflashmediaplayer-downloadlink']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-downloadlink', $attachment['kgflashmediaplayer-downloadlink']); }
|
2101 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-downloadlink', "notchecked"); }
|
2102 |
-
|
2103 |
if( isset($attachment['kgflashmediaplayer-embed']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-embed', $attachment['kgflashmediaplayer-embed']); }
|
2104 |
if( isset($attachment['kgflashmediaplayer-gallery_thumb_width']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_thumb_width', $attachment['kgflashmediaplayer-gallery_thumb_width']); }
|
2105 |
if( isset($attachment['kgflashmediaplayer-gallery_exclude']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_exclude', $attachment['kgflashmediaplayer-gallery_exclude']); }
|
@@ -2107,19 +3041,26 @@ function kgvid_video_attachment_fields_to_save($post, $attachment) {
|
|
2107 |
if( isset($attachment['kgflashmediaplayer-gallery_orderby']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_orderby', $attachment['kgflashmediaplayer-gallery_orderby']); }
|
2108 |
if( isset($attachment['kgflashmediaplayer-gallery_order']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_order', $attachment['kgflashmediaplayer-gallery_order']); }
|
2109 |
if( isset($attachment['kgflashmediaplayer-gallery_id']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_id', $attachment['kgflashmediaplayer-gallery_id']); }
|
2110 |
-
|
2111 |
}
|
2112 |
return $post;
|
2113 |
}
|
2114 |
add_filter("attachment_fields_to_save", "kgvid_video_attachment_fields_to_save", null, 2);
|
2115 |
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2123 |
|
2124 |
$options = get_option('kgvid_video_embed_options');
|
2125 |
$output = $html;
|
@@ -2141,7 +3082,7 @@ class kgInsertMedia {
|
|
2141 |
$endtitlecode = str_replace("<", "</", $titlecode);
|
2142 |
$endtitlecode_array = explode(' ', $endtitlecode);
|
2143 |
if ( substr($endtitlecode_array[0], -1) != ">" ) { $endtitlecode = $endtitlecode_array[0].">"; }
|
2144 |
-
$output .= $titlecode.'<span itemprop="name">'.$attachment["title"].'</span>'.$endtitlecode.'<br />';
|
2145 |
}
|
2146 |
$output .= '[KGVID';
|
2147 |
if ($attachment['poster'] !="") { $output .= ' poster="'.$attachment["poster"].'"'; }
|
@@ -2150,18 +3091,18 @@ class kgInsertMedia {
|
|
2150 |
if ($attachment['downloadlink'] == "checked") { $output .= ' downloadlink="true"'; }
|
2151 |
$output .= ']'.$attachment["url"].'[/KGVID]<br />';
|
2152 |
} //if embed code is enabled
|
2153 |
-
|
2154 |
if ($attachment['embed'] == "Video Gallery" ) {
|
2155 |
-
|
2156 |
-
$attachment['gallery_thumb'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_thumb_width", true);
|
2157 |
$attachment['gallery_exclude'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_exclude", true);
|
2158 |
$attachment['gallery_include'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_include", true);
|
2159 |
-
$attachment['gallery_orderby'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_orderby", true);
|
2160 |
$attachment['gallery_order'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_order", true);
|
2161 |
$attachment['gallery_id'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_id", true);
|
2162 |
$post = get_post($attachment_id);
|
2163 |
$parent_id = $post->post_parent;
|
2164 |
-
|
2165 |
$output = "";
|
2166 |
$output .= '[KGVID gallery="true"';
|
2167 |
if ( !empty($attachment['gallery_thumb']) && $attachment['gallery_thumb'] != $options['gallery_thumb'] ) { $output .= ' gallery_thumb="'.$attachment["gallery_thumb"].'"'; }
|
@@ -2170,14 +3111,14 @@ class kgInsertMedia {
|
|
2170 |
if ( !empty($attachment['gallery_orderby']) && $attachment['gallery_orderby'] != "menu_order" ) { $output .= ' gallery_orderby="'.$attachment["gallery_orderby"].'"'; }
|
2171 |
if ( !empty($attachment['gallery_order']) && $attachment['gallery_order'] != "ASC" ) { $output .= ' gallery_order="'.$attachment["gallery_order"].'"'; }
|
2172 |
if ( !empty($attachment['gallery_id']) && $attachment['gallery_id'] != $parent_id ) { $output .= ' gallery_id="'.$attachment["gallery_id"].'"'; }
|
2173 |
-
$output .= ']
|
2174 |
}
|
2175 |
-
|
2176 |
-
return $output;
|
2177 |
-
}
|
2178 |
-
}
|
2179 |
-
//instantiate the class
|
2180 |
-
$kgIM = new kgInsertMedia();
|
2181 |
|
2182 |
function kgvid_embedurl_menu($tabs) {
|
2183 |
$newtab = array('embedurl' => __('Embed Video from URL', 'kgoutsidevideo'));
|
@@ -2188,22 +3129,22 @@ add_filter('media_upload_tabs', 'kgvid_embedurl_menu');
|
|
2188 |
function media_embedurl_process() {
|
2189 |
|
2190 |
$options = get_option('kgvid_video_embed_options');
|
2191 |
-
|
2192 |
-
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
|
2193 |
kgvid_check_ffmpeg_exists($options, true);
|
2194 |
$options = get_option('kgvid_video_embed_options');
|
2195 |
}
|
2196 |
-
|
2197 |
$video_formats = kgvid_video_formats();
|
2198 |
$checkboxes = kgvid_generate_encode_checkboxes("", "singleurl", "attachment");
|
2199 |
-
|
2200 |
$maxheight = $options['height'];
|
2201 |
$maxwidth = $options['width'];
|
2202 |
-
|
2203 |
media_upload_header();
|
2204 |
?>
|
2205 |
<form class="media-upload-form type-form validate" id="kgvid-form" enctype="multipart/form-data" method="post" action="">
|
2206 |
-
|
2207 |
<div id="media-items">
|
2208 |
<div class="media-item media-blank">
|
2209 |
<table id="kgflashmediaplayer-table" class="describe">
|
@@ -2218,19 +3159,20 @@ function media_embedurl_process() {
|
|
2218 |
<td class="field"><input type="text" id="attachments-singleurl-kgflashmediaplayer-url" name="attachments[singleurl][kgflashmediaplayer-url]" value="" size="50" onchange="kgvid_set_singleurl();"/>
|
2219 |
<p class="help"><small>Specify the URL of the video file.</small></p></td>
|
2220 |
</tr>
|
|
|
2221 |
<tr>
|
2222 |
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="numberofthumbs">Thumbnails</label></span></th>
|
2223 |
-
<td class="field"
|
2224 |
-
|
2225 |
-
|
2226 |
-
|
2227 |
-
|
2228 |
-
|
2229 |
-
|
2230 |
-
|
2231 |
-
|
2232 |
-
<p class="help"><small>Optional: generates a single thumbnail at the specified time (hh:mm:ss, mm:ss, or s).</small></p></td>
|
2233 |
</tr>
|
|
|
2234 |
<tr>
|
2235 |
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="attachments-singleurl_kgflashmediaplayer_poster">Thumbnail URL</label></span></th>
|
2236 |
<td class="field"><input type="text" name="attachments[singleurl][kgflashmediaplayer-poster]" id="attachments-singleurl-kgflashmediaplayer-poster" value="" size="50" />
|
@@ -2241,13 +3183,15 @@ function media_embedurl_process() {
|
|
2241 |
<td class="field">Width: <input name="attachments[singleurl][kgflashmediaplayer-width]" type="text" value="<?php echo $maxwidth; ?>" id="attachments-singleurl-kgflashmediaplayer-width" type="text" style="width:50px;" onchange="kgvid_set_dimension('singleurl', 'height', this.value);" onkeyup="kgvid_set_dimension('singleurl', 'height', this.value);"> Height: <input name="attachments[singleurl][kgflashmediaplayer-height]" id="attachments-singleurl-kgflashmediaplayer-height" type="text" value="<?php echo $maxheight; ?>" style="width:50px;" 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>Lock to Aspect Ratio</small></label>
|
2242 |
<p class="help"><small>Leave blank to use <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php" target="_blank">default dimensions</a>.</small></p></td>
|
2243 |
</tr>
|
|
|
2244 |
<tr>
|
2245 |
-
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="html5">
|
2246 |
<td><?php echo $checkboxes; ?></td>
|
2247 |
</tr>
|
|
|
2248 |
<tr>
|
2249 |
<th valign="top" scope="row" class="label"><span class="alignleft"><label>Options</span></label></th>
|
2250 |
-
<td><input type="checkbox" name="downloadlink" id="downloadlink" value="true" class="field" /><label for="downloadlink">Generate Download Link Below Video <small>(Makes it easier for users to download video file)</small></label></td>
|
2251 |
</tr>
|
2252 |
<tr class="submit">
|
2253 |
<td></td>
|
@@ -2258,7 +3202,7 @@ function media_embedurl_process() {
|
|
2258 |
</tbody></table>
|
2259 |
</div>
|
2260 |
</div>
|
2261 |
-
|
2262 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-security]' id='attachments-kgflashmediaplayer-security' value='<?php echo wp_create_nonce('video-embed-thumbnail-generator-nonce'); ?>' />
|
2263 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-maxwidth]' id='attachments-singleurl-kgflashmediaplayer-maxwidth' value='<?php echo($maxwidth); ?>' />
|
2264 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-maxheight]' id='attachments-singleurl-kgflashmediaplayer-maxheight' value='<?php echo($maxheight); ?>' />
|
@@ -2267,7 +3211,7 @@ function media_embedurl_process() {
|
|
2267 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-titlecode]' id='attachments-singleurl-kgflashmediaplayer-titlecode' value='<?php echo $options['titlecode']; ?>' />
|
2268 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-ffmpegexists]' id='attachments-singleurl-kgflashmediaplayer-ffmpegexists' value='<?php echo $options['ffmpeg_exists']; ?>' />
|
2269 |
</form>
|
2270 |
-
|
2271 |
<?php
|
2272 |
} //end media_embedurl_process
|
2273 |
|
@@ -2290,34 +3234,34 @@ function kgvid_generate_attachment_shortcode($kgvid_video_embed) {
|
|
2290 |
|
2291 |
if ( array_key_exists('sample', $kgvid_video_embed) ) { $url = plugins_url('/images/sample-video-h264.mp4', __FILE__); }
|
2292 |
else { $url = wp_get_attachment_url($post->ID); }
|
2293 |
-
|
2294 |
$poster = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
|
2295 |
$downloadlink = get_post_meta($post->ID, '_kgflashmediaplayer-downloadlink', true);
|
2296 |
-
|
2297 |
if ( array_key_exists('width', $kgvid_video_embed) ) { $width = $kgvid_video_embed['width']; }
|
2298 |
else { $width = get_post_meta($post->ID, "_kgflashmediaplayer-width", true); }
|
2299 |
if ( !$width ) { $width = get_post_meta($post->ID, "_kgflashmediaplayer-actualwidth", true); }
|
2300 |
if ( !$width ) { $width = $options['width']; }
|
2301 |
-
|
2302 |
if ( array_key_exists('height', $kgvid_video_embed) ) { $height = $kgvid_video_embed['height']; }
|
2303 |
else { $height = get_post_meta($post->ID, "_kgflashmediaplayer-height", true); }
|
2304 |
if ( !$height ) { $height = get_post_meta($post->ID, "_kgflashmediaplayer-actualheight", true); }
|
2305 |
if ( !$height ) { $width = $options['width']; }
|
2306 |
-
|
2307 |
$shortcode = '[KGVID';
|
2308 |
if ( $poster !="" ) { $shortcode .= ' poster="'.$poster.'"'; }
|
2309 |
if ( $width !="" ) { $shortcode .= ' width="'.$width.'"'; }
|
2310 |
if ( $height !="" ) { $shortcode .= ' height="'.$height.'"'; }
|
2311 |
if ( $downloadlink == "checked" ) { $shortcode .= ' downloadlink="true"'; }
|
2312 |
if (array_key_exists('gallery', $kgvid_video_embed)) { $shortcode .= ' autoplay="true"'; }
|
2313 |
-
if (array_key_exists('sample', $kgvid_video_embed)) {
|
2314 |
if ( $options['overlay_title'] == "on" ) { $shortcode .= ' title="Sample Video"'; }
|
2315 |
if ( $options['overlay_embedcode'] == "on" ) { $shortcode .= ' embedcode="Sample Embed Code"'; }
|
2316 |
-
$shortcode .= ' caption="Captions are shown automatically if entered."';
|
2317 |
}
|
2318 |
//else { $shortcode .= ' view_count="false"'; }
|
2319 |
$shortcode .= ']'.$url.'[/KGVID]';
|
2320 |
-
|
2321 |
return $shortcode;
|
2322 |
|
2323 |
}
|
@@ -2326,7 +3270,7 @@ function kgvid_filter_video_attachment_content($content) {
|
|
2326 |
|
2327 |
global $post;
|
2328 |
$options = get_option('kgvid_video_embed_options');
|
2329 |
-
|
2330 |
if ( $options['template'] == "gentle" && strpos($post->post_mime_type, "video") !== false ) {
|
2331 |
$kgvid_video_embed = array(); //no query set
|
2332 |
$content = kgvid_generate_attachment_shortcode($kgvid_video_embed);
|
@@ -2340,6 +3284,8 @@ function kgvid_video_attachment_template() {
|
|
2340 |
|
2341 |
global $post;
|
2342 |
global $wp_query;
|
|
|
|
|
2343 |
$options = get_option('kgvid_video_embed_options');
|
2344 |
|
2345 |
$kgvid_video_embed = array ( 'enable' => 'false' ); //turned off by default
|
@@ -2348,13 +3294,14 @@ function kgvid_video_attachment_template() {
|
|
2348 |
if ( (!is_array($kgvid_video_embed) && $kgvid_video_embed == "true") ) { $kgvid_video_embed = array ( 'enable' => 'true' ); } //maintain backwards compatibility
|
2349 |
|
2350 |
if ( $options['embeddable'] == 'false' && !array_key_exists('sample', $kgvid_video_embed) && !array_key_exists('gallery', $kgvid_video_embed) ) { $kgvid_video_embed['enable'] = 'false'; }
|
2351 |
-
|
2352 |
if ( array_key_exists('enable', $kgvid_video_embed) && $kgvid_video_embed['enable'] == 'true' && (strpos($post->post_mime_type,"video") !== false || array_key_exists('sample', $kgvid_video_embed)) ) {
|
2353 |
-
|
2354 |
remove_action('wp_head', '_admin_bar_bump_cb'); //don't show the WordPress admin bar if you're logged in
|
2355 |
-
|
|
|
2356 |
$shortcode = kgvid_generate_attachment_shortcode($kgvid_video_embed);
|
2357 |
-
|
2358 |
echo '<html style="background-color:transparent;"><head>';
|
2359 |
echo (wp_head());
|
2360 |
echo '<style>.kgvid_wrapper { margin:0; }';
|
@@ -2365,6 +3312,7 @@ function kgvid_video_attachment_template() {
|
|
2365 |
else { echo 'background-color:transparent; '; }
|
2366 |
echo '">';
|
2367 |
echo (do_shortcode( $shortcode ));
|
|
|
2368 |
echo '</body></html>';
|
2369 |
exit;
|
2370 |
}
|
@@ -2378,7 +3326,7 @@ add_action('template_redirect', 'kgvid_video_attachment_template');
|
|
2378 |
else { $video_id = get_post_meta($kgvid_video_embed['id'], '_kgflashmediaplayer-format', $kgvid_video_embed['format'] ); }
|
2379 |
$url = wp_get_attachment_url($video_id);
|
2380 |
$type = get_post_mime_type($video_id);
|
2381 |
-
|
2382 |
header('Location: ' .$url);
|
2383 |
header('Content-type: '.$type);
|
2384 |
exit(0);
|
@@ -2407,26 +3355,22 @@ function kgvid_cleanup_generated_thumbnails_handler() {
|
|
2407 |
}
|
2408 |
add_action('kgvid_cleanup_generated_thumbnails','kgvid_cleanup_generated_thumbnails_handler');
|
2409 |
|
2410 |
-
function kgvid_schedule_cleanup_generated_files() { //schedules deleting all tmp thumbnails or logfiles if no files are generated in an hour
|
2411 |
-
|
2412 |
-
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
2413 |
|
2414 |
-
if (
|
2415 |
$timestamp = wp_next_scheduled( 'kgvid_cleanup_generated_thumbnails' );
|
2416 |
wp_unschedule_event($timestamp, 'kgvid_cleanup_generated_thumbnails' );
|
2417 |
wp_schedule_single_event(time()+3600, 'kgvid_cleanup_generated_thumbnails');
|
2418 |
}
|
2419 |
|
2420 |
-
|
2421 |
$timestamp = wp_next_scheduled( 'kgvid_cleanup_generated_logfiles' );
|
2422 |
wp_unschedule_event($timestamp, 'kgvid_cleanup_generated_logfiles' );
|
2423 |
-
$args = array('logfile'=>$
|
2424 |
-
wp_schedule_single_event(time()+600, 'kgvid_cleanup_generated_logfiles', $args);
|
2425 |
}
|
2426 |
-
|
2427 |
-
die(); // this is required to return a proper result
|
2428 |
}
|
2429 |
-
add_action('wp_ajax_kgvid_schedule_cleanup_generated_files', 'kgvid_schedule_cleanup_generated_files');
|
2430 |
|
2431 |
function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser, $thumbtimecode, $dofirstframe, $generate_button) {
|
2432 |
|
@@ -2434,10 +3378,10 @@ function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser,
|
|
2434 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
2435 |
$uploads = wp_upload_dir();
|
2436 |
|
2437 |
-
if ( get_post_type($postID) == "attachment" ) {
|
2438 |
$moviefilepath = get_attached_file($postID);
|
2439 |
$movie_width = get_post_meta($postID, '_kgflashmediaplayer-actualwidth');
|
2440 |
-
if ( empty($movie_width) ) {
|
2441 |
$movie_info = kgvid_get_video_dimensions($moviefilepath);
|
2442 |
update_post_meta($postID, '_kgflashmediaplayer-actualwidth', $movie_info['width']);
|
2443 |
update_post_meta($postID, '_kgflashmediaplayer-actualheight', $movie_info['height']);
|
@@ -2459,13 +3403,13 @@ function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser,
|
|
2459 |
$moviefilepath = str_replace("https://", "http://", $moviefilepath);
|
2460 |
$movie_info = kgvid_get_video_dimensions($moviefilepath);
|
2461 |
}
|
2462 |
-
|
2463 |
if ($movie_info['worked'] == true) { //if FFMPEG was able to open the file
|
2464 |
-
|
2465 |
$movie_extension = pathinfo(parse_url($movieurl, PHP_URL_PATH), PATHINFO_EXTENSION);
|
2466 |
$moviefilebasename = sanitize_file_name(basename($movieurl,'.'.$movie_extension));
|
2467 |
$thumbnailfilebase = $uploads['url']."/thumb_tmp/".$moviefilebasename;
|
2468 |
-
|
2469 |
$movie_width = $movie_info['width'];
|
2470 |
$movie_height = $movie_info['height'];
|
2471 |
|
@@ -2473,16 +3417,19 @@ function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser,
|
|
2473 |
|
2474 |
if ( $movie_info['rotate'] === false) { $movie_info['rotate'] = ""; }
|
2475 |
switch ($movie_info['rotate']) { //if it's a sideways mobile video
|
2476 |
-
case '-vf "transpose=1"': //90 degrees
|
2477 |
-
case '-vf "transpose=2"': //270 degrees
|
2478 |
$movie_width ^= $movie_height ^= $movie_width ^= $movie_height; break; //swap height & width
|
2479 |
}
|
2480 |
-
|
2481 |
$thumbnailheight = strval(round(floatval($movie_height) / floatval($movie_width) * 200));
|
2482 |
|
2483 |
$jpgpath = $uploads['path']."/thumb_tmp/";
|
2484 |
-
|
2485 |
-
$movieoffset = round((
|
|
|
|
|
|
|
2486 |
|
2487 |
if ($generate_button == "random") { //adjust offset random amount
|
2488 |
$movieoffset = $movieoffset - rand(0, round(intval($movie_info['duration']) / $numberofthumbs));
|
@@ -2500,41 +3447,48 @@ function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser,
|
|
2500 |
$i = $numberofthumbs + 1;
|
2501 |
}
|
2502 |
|
2503 |
-
if ($dofirstframe == "true" && $i == 1) {
|
2504 |
$movieoffset = "0";
|
2505 |
}
|
2506 |
|
2507 |
-
$thumbnailfilename[$i] = $jpgpath.$moviefilebasename."_thumb"
|
2508 |
$thumbnailfilename[$i] = str_replace(" ", "_", $thumbnailfilename[$i]);
|
2509 |
-
|
2510 |
-
$
|
|
|
|
|
|
|
|
|
|
|
2511 |
$thumbnailurl = str_replace(" ", "_", $thumbnailurl);
|
2512 |
|
2513 |
exec(escapeshellcmd($ffmpegPath." ".$ffmpeg_options));
|
2514 |
|
|
|
|
|
2515 |
if (floatval($movieoffset) > 60) {
|
2516 |
$movieoffset_minutes = sprintf("%02s", intval(intval($movieoffset) / 60) );
|
2517 |
$movieoffset_seconds = sprintf("%02s", round(fmod( floatval($movieoffset), 60), 2) );
|
2518 |
$movieoffset_display = $movieoffset_minutes.":".$movieoffset_seconds;
|
2519 |
}
|
2520 |
else { $movieoffset_display = "00:".sprintf("%02s", $movieoffset); }
|
2521 |
-
|
2522 |
$field_id = kgvid_backwards_compatible($postID);
|
2523 |
|
2524 |
$thumbnaildisplaycode = '<div class="kgvid_thumbnail_select" name="attachments['.$postID.'][thumb'.$i.']" id="attachments-'.$postID.'-thumb'.$i.'"><label for="kgflashmedia-'.$postID.'-thumbradio'.$i.'"><img src="'.$thumbnailurl.'?'.rand().'" width="200" height="'.$thumbnailheight.'" class="kgvid_thumbnail"></label><br /><input type="radio" name="attachments['.$postID.'][thumbradio'.$i.']" id="kgflashmedia-'.$postID.'-thumbradio'.$i.'" value="'.str_replace('/thumb_tmp/', '/', $thumbnailurl).'" onchange="document.getElementById(\''.$field_id['poster'].'\').value = this.value; document.getElementById(\''.$field_id['thumbtime'].'\').value = \''. $movieoffset_display .'\'; document.getElementById(\'attachments-'. $postID .'-numberofthumbs\').value =\'1\';"></div>';
|
2525 |
|
2526 |
$i++;
|
2527 |
|
2528 |
-
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "movie_width"=>$movie_width, "movie_height"=>$movie_height, "lastthumbnumber"=>$i, "movieoffset"=>$movieoffset );
|
|
|
|
|
2529 |
|
2530 |
-
echo json_encode($arr);
|
2531 |
-
|
2532 |
}//if ffmpeg can open movie
|
2533 |
-
|
2534 |
-
else {
|
2535 |
$thumbnaildisplaycode = "<strong>Can't open movie file.</strong><br />".$movie_info['output'];
|
2536 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
2537 |
-
|
2538 |
} //can't open movie
|
2539 |
|
2540 |
}
|
@@ -2557,30 +3511,30 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id) {
|
|
2557 |
$movieurl = $sanitized_url['movieurl'];
|
2558 |
$movieurl = str_replace("https://", "http://", $movieurl);
|
2559 |
$movie_info = kgvid_get_video_dimensions($movieurl);
|
2560 |
-
|
2561 |
if ($movie_info['worked'] == true) { //if FFMPEG was able to open the file
|
2562 |
-
|
2563 |
$movie_width = $movie_info['width'];
|
2564 |
$movie_height = $movie_info['height'];
|
2565 |
if ( get_post_type($postID) == "attachment" ) {
|
2566 |
update_post_meta($postID, '_kgflashmediaplayer-actualheight', $movie_width);
|
2567 |
update_post_meta($postID, '_kgflashmediaplayer-actualheight', $movie_height);
|
2568 |
update_post_meta($postID, '_kgflashmediaplayer-duration', $movie_info['duration']);
|
2569 |
-
update_post_meta($postID, '_kgflashmediaplayer-rotate', $movie_info['rotate']);
|
2570 |
}
|
2571 |
-
|
2572 |
$encodevideo_info = kgvid_encodevideo_info($movieurl, $postID);
|
2573 |
-
|
2574 |
foreach ( $video_formats as $format => $format_stats ) {
|
2575 |
if ( $encode_checked[$format] == "true" ) {
|
2576 |
-
if ( !$encodevideo_info[$format.'_exists'] ) {
|
2577 |
if ( ($format == "1080" && $movie_height <= 1080) || ($format == "720" && $movie_height <= 720) ) {
|
2578 |
$movie_extension = pathinfo($movieurl, PATHINFO_EXTENSION);
|
2579 |
-
if ( in_array($movie_extension, $h264extensions) || $movie_height < intval($format) ) {
|
2580 |
$encode_formats[$format]['status'] = "lowres";
|
2581 |
} //skip if the resolution of an existing video is lower than the HD format
|
2582 |
}
|
2583 |
-
else {
|
2584 |
$encode_formats[$format]['status'] = "queued";
|
2585 |
$encode_formats[$format]['name'] = $format_stats['name'];
|
2586 |
$encode_list[$format] = $format_stats['name'];
|
@@ -2589,12 +3543,12 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id) {
|
|
2589 |
} // if video doesn't already exist
|
2590 |
else { $encode_formats[$format]['status'] = "encoded"; }
|
2591 |
} // if user wants to encode format
|
2592 |
-
else {
|
2593 |
-
$encode_formats[$format]['status'] = "notchecked";
|
2594 |
update_post_meta($postID, '_kgflashmediaplayer-encode'.$format, 'notchecked');
|
2595 |
}
|
2596 |
}
|
2597 |
-
|
2598 |
if ( !empty($encode_list) ) {
|
2599 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
2600 |
if ( empty($parent_id) ) { $parent_id = get_post($postID)->post_parent; }
|
@@ -2608,8 +3562,8 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id) {
|
|
2608 |
$already_queued = false;
|
2609 |
if ( !empty($video_embed_queue ) ) {
|
2610 |
foreach ($video_embed_queue as $index => $entry) {
|
2611 |
-
if ( $entry['movieurl'] == $movieurl ) {
|
2612 |
-
$already_queued = $index;
|
2613 |
foreach ( $entry['encode_formats'] as $format => $value ) {
|
2614 |
if ( $value['status'] == "queued" && array_key_exists($format, $encode_list) ) { unset($encode_list[$format]); }
|
2615 |
if ( $value['status'] == "encoding" || $encode_checked[$format] != "true" ) { $queue_entry['encode_formats'][$format] = $entry['encode_formats'][$format]; } //don't edit queue entry for anything that's currently encoding or not checked
|
@@ -2618,42 +3572,45 @@ function kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id) {
|
|
2618 |
}
|
2619 |
}
|
2620 |
}
|
2621 |
-
|
2622 |
-
if ( $already_queued !== false ) {
|
2623 |
$video_embed_queue[$already_queued] = $queue_entry;
|
2624 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
2625 |
if ( !empty($encode_list) ) { $embed_display = "<strong>".implode(", " , $encode_list)." updated in existing queue entry in position ".strval(intval($already_queued)+1).". </strong>"; }
|
2626 |
else { $embed_display = "<strong>Video is already queued in position ".strval(intval($already_queued)+1).". </strong>"; }
|
2627 |
}
|
2628 |
-
else {
|
2629 |
$video_embed_queue[] = $queue_entry;
|
2630 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
2631 |
$queue_position = intval(key( array_slice( $video_embed_queue, -1, 1, TRUE ) ));
|
2632 |
if ( $queue_position == 0 ) { $embed_display = "<strong>Starting ".strtoupper($options['video_app'])."... </strong>"; }
|
2633 |
else { $embed_display = "<strong>".implode(", " , $encode_list)." added to queue in position ".strval(intval($queue_position)+1). ". </strong>";
|
2634 |
}
|
2635 |
-
}
|
2636 |
} //if any video formats don't already exist, add to queue
|
2637 |
else { $embed_display = "<strong>Nothing to encode.</strong>"; }
|
2638 |
-
|
2639 |
$replaceoptions = "";
|
2640 |
$originalselect = "";
|
2641 |
-
|
2642 |
$arr = array ( "embed_display"=>$embed_display );
|
2643 |
-
|
2644 |
}
|
2645 |
-
else {
|
2646 |
$thumbnaildisplaycode = "<strong>Can't open movie file.</strong><br />".$movie_info['output'];
|
2647 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
2648 |
-
|
2649 |
-
} //can't open movie
|
2650 |
}
|
2651 |
|
2652 |
-
function kgivd_save_singleurl_poster($parent_id, $poster, $movieurl) { //called by the "Embed Video from URL" tab when submitting
|
2653 |
|
2654 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
2655 |
-
if ( !empty($poster) ) { kgvid_save_thumb($parent_id, $sanitized_url['basename'], $poster); }
|
2656 |
-
|
|
|
|
|
|
|
2657 |
}//if submit
|
2658 |
|
2659 |
function kgvid_callffmpeg() {
|
@@ -2671,23 +3628,30 @@ function kgvid_callffmpeg() {
|
|
2671 |
if (isset($_POST['thumbtimecode'])) { $thumbtimecode = $_POST['thumbtimecode']; }
|
2672 |
if (isset($_POST['dofirstframe'])) { $dofirstframe = $_POST['dofirstframe']; }
|
2673 |
if (isset($_POST['generate_button'])) { $generate_button = $_POST['generate_button']; }
|
2674 |
-
|
2675 |
if (isset($_POST['encodeformats'])) { $encode_checked = $_POST['encodeformats']; }
|
2676 |
|
2677 |
if (isset($_POST['poster'])) { $poster = $_POST['poster']; }
|
2678 |
if (isset($_POST['parent_id'])) { $parent_id = $_POST['parent_id']; }
|
2679 |
if ( !isset($parent_id) ) { $parent_id = "check"; }
|
|
|
2680 |
|
2681 |
if (isset($_POST['ffmpeg_action'])) { $action = $_POST['ffmpeg_action']; }
|
2682 |
-
|
2683 |
if ( $options['ffmpeg_exists'] == true ) {
|
2684 |
-
|
2685 |
-
if ( $action == "generate"
|
2686 |
-
|
2687 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2688 |
}
|
2689 |
else {
|
2690 |
-
$thumbnaildisplaycode = '<strong>Error: '.strtoupper($options["video_app"]).' not found. Verify that '.strtoupper($options["video_app"]).' is installed at '.strtoupper($options["app_path"]).' and check the <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">application path plugin setting</a>.</strong>' ;
|
2691 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
2692 |
echo json_encode($arr);
|
2693 |
}//no ffmpeg
|
@@ -2708,9 +3672,9 @@ function kgvid_encode_videos() {
|
|
2708 |
$video_formats = kgvid_video_formats();
|
2709 |
|
2710 |
if ( !empty($video_embed_queue) ) {
|
2711 |
-
|
2712 |
$simultaneous = 1;
|
2713 |
-
|
2714 |
foreach ( $video_embed_queue as $video_key => $queue_entry ) { //search the queue for any encoding video
|
2715 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
2716 |
if ( $value['status'] == "encoding" ) {
|
@@ -2721,137 +3685,127 @@ function kgvid_encode_videos() {
|
|
2721 |
}
|
2722 |
}
|
2723 |
}
|
2724 |
-
|
2725 |
if ( empty($encoding) ) {
|
2726 |
-
foreach ( $video_embed_queue as $video_key => $queue_entry ) {
|
2727 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
2728 |
-
if ( $value['status'] == "queued" ) {
|
2729 |
$video = $video_embed_queue[$video_key];
|
2730 |
$queued_format = $format;
|
2731 |
-
break 2;
|
2732 |
}
|
2733 |
}
|
2734 |
}
|
2735 |
}
|
2736 |
-
|
2737 |
if ( !empty($queued_format) ) {
|
2738 |
-
|
2739 |
$options = get_option('kgvid_video_embed_options');
|
2740 |
-
|
2741 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
2742 |
if ( get_post_type($video['attachmentID']) == "attachment" ) { $moviefilepath = get_attached_file($video['attachmentID']); }
|
2743 |
-
else {
|
2744 |
-
$moviefilepath = str_replace(" ", "%20", esc_url_raw($video['movieurl']));
|
2745 |
$moviefilepath = str_replace("https://", "http://", $moviefilepath);
|
2746 |
}
|
2747 |
-
|
2748 |
-
|
2749 |
$movie_info = $video['movie_info'];
|
2750 |
$encodevideo_info = kgvid_encodevideo_info($video['movieurl'], $video['attachmentID']);
|
2751 |
-
|
2752 |
$logfile = "";
|
2753 |
$processPID = "";
|
2754 |
$serverOS = "";
|
2755 |
$ffmpeg_options = "";
|
2756 |
-
|
2757 |
-
if ( $options['video_app'] == "avconv" || $options['video_bitrate_flag'] == false ) {
|
2758 |
$video_bitrate_flag = "b:v";
|
2759 |
$audio_bitrate_flag = "b:a";
|
|
|
2760 |
}
|
2761 |
-
|
2762 |
-
else {
|
2763 |
$video_bitrate_flag = "b";
|
2764 |
$audio_bitrate_flag = "ab";
|
|
|
2765 |
}
|
2766 |
-
|
2767 |
-
|
2768 |
-
|
2769 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2770 |
if ( ! $encodevideo_info[$format.'_exists'] || ($encodevideo_info['sameserver'] && filesize($encodevideo_info[$format.'filepath']) < 24576) ) {
|
2771 |
-
|
2772 |
if ( intval($movie_info['width']) > $format_stats['width'] ) { $h264_movie_width = $format_stats['width']; }
|
2773 |
else { $h264_movie_width = $movie_info['width']; }
|
2774 |
$h264_movie_height = strval(round(floatval($movie_info['height']) / floatval($movie_info['width']) * $h264_movie_width));
|
2775 |
if ( intval($h264_movie_height) > $format_stats['height'] ) { $h264_movie_height = $format_stats['height']; }
|
2776 |
$h264_movie_width = strval(round(floatval($movie_info['width']) / floatval($movie_info['height']) * $h264_movie_height));
|
2777 |
-
|
2778 |
if ($h264_movie_height % 2 != 0) { $h264_movie_height++; } //if it's odd, increase by 1 to make sure it's an even number
|
2779 |
-
if ($h264_movie_width % 2 != 0) { $h264_movie_width--; } //if it's odd,
|
2780 |
-
|
2781 |
-
|
2782 |
-
|
2783 |
-
|
2784 |
-
if ( $format == "rotated" ) { $h264bitrate = round($h264_movie_width * 4); }
|
2785 |
-
else { $h264bitrate = round($h264_movie_height * 4); }
|
2786 |
-
$vpre_flags = "";
|
2787 |
-
if ( $options['ffmpeg_vpre'] == 'on' ) { $vpre_flags = '-vpre slow -vpre ipod640'; }
|
2788 |
-
|
2789 |
-
$ffmpeg_options = ' -acodec '.$aaclib.' -'.$audio_bitrate_flag.' 128k -s '.$h264_movie_width.'x'.$h264_movie_height.' -vcodec libx264 '.$vpre_flags.' -threads 1 '.$movie_info['rotate'].' -'.$video_bitrate_flag.' '.$h264bitrate.'k -bt 800k -f ipod "'.$encodevideo_info[$format.'filepath'].'"';
|
2790 |
-
$embed_display .= "<strong>Encoding ".$format_stats['name']."</strong>";
|
2791 |
}//if file doesn't already exist
|
2792 |
-
else { $embed_display
|
2793 |
break; //don't bother looping through the rest if we already found the format
|
2794 |
-
}//if
|
2795 |
-
}//H.264 loop
|
2796 |
-
}//if the x264 & AAC libraries are enabled
|
2797 |
-
else {
|
2798 |
-
$missing_libraries = "";
|
2799 |
-
if($movie_info['configuration']['libfaac'] == 'false') { $missing_libraries .= 'libfaac '; }
|
2800 |
-
if($movie_info['configuration']['libvo_aacenc'] == 'false') { $missing_libraries .= 'libvo-aacenc '; }
|
2801 |
-
if($movie_info['configuration']['libfaac'] == 'false') { $missing_libraries .= 'libx264 '; }
|
2802 |
-
$embed_display .= "<strong>".strtoupper($options['video_app'])." missing library ".$missing_libraries."required for H.264/AAC encoding. </strong>";
|
2803 |
-
}
|
2804 |
-
|
2805 |
-
if ( $queued_format == "webm" ) {
|
2806 |
-
if ( ! $encodevideo_info['webm_exists'] || ($encodevideo_info['sameserver'] && filesize($encodevideo_info['webmfilepath']) < 24576) ) {
|
2807 |
-
if ( $movie_info['configuration']['libvorbis'] == "true" && $movie_info['configuration']['libvpx'] == "true" ) {
|
2808 |
-
$webmbitrate = $movie_info['height'] * 4;
|
2809 |
-
$ffmpeg_options = ' -'.$audio_bitrate_flag.' 128k -'.$video_bitrate_flag.' '.$webmbitrate.'k '.$movie_info['rotate'].' -threads 1 "'.$encodevideo_info['webmfilepath'].'"';
|
2810 |
-
$embed_display .= "<strong>Encoding WEBM. </strong>";
|
2811 |
-
}//if the necessary webm libraries are enabled
|
2812 |
else {
|
2813 |
-
$
|
2814 |
-
if(
|
2815 |
-
|
2816 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2817 |
}
|
2818 |
-
}//if
|
2819 |
-
|
2820 |
-
|
2821 |
-
|
2822 |
-
|
2823 |
-
|
2824 |
-
|
2825 |
-
|
2826 |
-
|
2827 |
-
$ffmpeg_options = ' -acodec libvorbis -'.$audio_bitrate_flag.' 128k -vcodec libtheora -'.$video_bitrate_flag.' '.$ogvbitrate.'k '.$movie_info['rotate'].' -threads 1 "'.$encodevideo_info['oggfilepath'].'"';
|
2828 |
-
$embed_display .= "<strong>Encoding OGV. </strong>";
|
2829 |
-
}//if the necessary OGV libraries are enabled
|
2830 |
else {
|
2831 |
-
$missing_libraries =
|
2832 |
-
if($movie_info['configuration']['libvorbis'] == 'false') { $missing_libraries
|
2833 |
-
if($movie_info['configuration']['
|
2834 |
-
$
|
|
|
|
|
|
|
2835 |
}
|
2836 |
-
}//if
|
2837 |
-
else { $embed_display
|
2838 |
-
}//if
|
2839 |
-
|
2840 |
-
if ( !empty($
|
2841 |
-
|
2842 |
-
$ffmpeg_args = '-y -i "'.$moviefilepath.'" '.$ffmpeg_options;
|
2843 |
$logfile = $uploads['path'].'/'.str_replace(" ", "_", $encodevideo_info['moviefilebasename'])."_".$queued_format."_".sprintf("%04s",mt_rand(1, 1000))."_encode.txt";
|
2844 |
-
|
2845 |
-
$cmd = escapeshellcmd($
|
|
|
2846 |
if ( !empty($cmd) ) { $cmd = $cmd." > ".$logfile." 2>&1 & echo $!"; }
|
2847 |
else {
|
2848 |
$arr = array ( "embed_display"=>"<span style='color:red;'>Error: Command 'escapeshellcmd' is disabled on your server.</span>" );
|
2849 |
return $arr;
|
2850 |
-
}
|
2851 |
$process = new kgvid_Process($cmd);
|
2852 |
-
|
2853 |
sleep(1);
|
2854 |
-
|
2855 |
$processPID = $process->getPid();
|
2856 |
$serverOS = $process->OS;
|
2857 |
|
@@ -2860,7 +3814,7 @@ function kgvid_encode_videos() {
|
|
2860 |
if ( !wp_next_scheduled('kgvid_cleanup_queue', array ( 'scheduled' )) ) {
|
2861 |
wp_schedule_event( time()+86400, 'daily', 'kgvid_cleanup_queue', array ( 'scheduled' ) );
|
2862 |
}
|
2863 |
-
|
2864 |
//update_post_meta($video['attachmentID'], '_kgflashmediaplayer-encode'.$format, 'on');
|
2865 |
|
2866 |
$video['encode_formats'][$queued_format] = array (
|
@@ -2883,9 +3837,9 @@ function kgvid_encode_videos() {
|
|
2883 |
);
|
2884 |
|
2885 |
$video_embed_queue[$video_key] = $queue_entry;
|
2886 |
-
|
2887 |
//$embed_display .= "<script type='text/javascript'>alert('".$ffmpegPath." ".$ffmpeg_args."');</script>";
|
2888 |
-
|
2889 |
} //end if there's stuff to encode
|
2890 |
|
2891 |
//$output_map = array_map(create_function('$key, $value', 'return $key.":".$value." # ";'), array_keys($process->output), array_values($process->output));
|
@@ -2896,37 +3850,63 @@ function kgvid_encode_videos() {
|
|
2896 |
kgvid_encode_progress($video_key, $queued_format, "attachment");
|
2897 |
|
2898 |
} //if there's a format to encode
|
2899 |
-
|
2900 |
} //if there's a queue
|
2901 |
-
$arr = array ( "embed_display"
|
2902 |
return $arr;
|
2903 |
|
2904 |
}
|
2905 |
|
2906 |
function kgvid_ajax_encode_videos() {
|
2907 |
|
2908 |
-
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
-
|
2913 |
-
|
2914 |
}
|
2915 |
add_action('wp_ajax_kgvid_ajax_encode_videos', 'kgvid_ajax_encode_videos');
|
2916 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2917 |
function kgvid_encode_progress($video_key, $format, $page) {
|
2918 |
|
2919 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
2920 |
-
|
2921 |
if ( is_array($video_embed_queue) && array_key_exists($video_key, $video_embed_queue) ) {
|
2922 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2923 |
if ( array_key_exists('logfile', $video_embed_queue[$video_key]['encode_formats'][$format]) ) {
|
2924 |
-
|
2925 |
$pid = $video_entry['encode_formats'][$format]['PID'];
|
2926 |
$logfile = $video_entry['encode_formats'][$format]['logfile'];
|
2927 |
$started = $video_entry['encode_formats'][$format]['started'];
|
2928 |
$movie_duration = $video_entry['movie_info']['duration'];
|
2929 |
-
$rotate_complete = false;
|
2930 |
$embed_display = "";
|
2931 |
$percent_done = "";
|
2932 |
$time_remaining = "";
|
@@ -2935,7 +3915,7 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
2935 |
$lastline = "";
|
2936 |
|
2937 |
if ( $video_entry['encode_formats'][$format]['status'] != "Encoding Complete" ) {
|
2938 |
-
|
2939 |
if ( is_file($logfile) ) {
|
2940 |
|
2941 |
$fp = fopen($logfile, 'r');
|
@@ -2943,6 +3923,7 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
2943 |
$read = '';
|
2944 |
$offset = -1;
|
2945 |
$lines = 2;
|
|
|
2946 |
while ( $lines && fseek($fp, $offset, SEEK_END) >= 0 ) {
|
2947 |
$c = fgetc($fp);
|
2948 |
if( $c == "\n" || $c == "\r" ) {
|
@@ -2953,7 +3934,7 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
2953 |
}
|
2954 |
fclose($fp);
|
2955 |
$lastline = strrev(rtrim($read,"\n\r"));
|
2956 |
-
|
2957 |
$last_match = "";
|
2958 |
$time_matches = "";
|
2959 |
$video_matches = "";
|
@@ -2961,11 +3942,9 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
2961 |
$fps_matches = "";
|
2962 |
$fps_match = "";
|
2963 |
$basename = "";
|
2964 |
-
|
2965 |
-
$script_function = 'kgvid_redraw_encode_checkboxes("'.$video_entry['movieurl'].'", "'.$video_entry['attachmentID'].'", "'.$page.'")';
|
2966 |
-
|
2967 |
preg_match('/time=(.*?) /', $lastline, $time_matches);
|
2968 |
-
|
2969 |
if ( array_key_exists(1, $time_matches) != true ) { //if something other than the regular FFMPEG encoding output check for these
|
2970 |
preg_match('/video:(.*?) /', $lastline, $video_matches);
|
2971 |
preg_match('/libx264 (.*?) /', $lastline, $libx264_matches);
|
@@ -2974,7 +3953,7 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
2974 |
//preg_match('/buffer (.*?) /', $lastline, $buffer_matches);
|
2975 |
}
|
2976 |
if ( array_key_exists(1, $time_matches) == true ) { //still encoding
|
2977 |
-
|
2978 |
if ( strpos($time_matches[1], ':') !== false ) {
|
2979 |
$current_hours = intval(substr($time_matches[1], -11, 2));
|
2980 |
$current_minutes = intval(substr($time_matches[1], -8, 2));
|
@@ -2982,7 +3961,7 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
2982 |
$current_seconds = ($current_hours * 60 * 60) + ($current_minutes * 60) + $current_seconds;
|
2983 |
}
|
2984 |
else { $current_seconds = $time_matches[1]; }
|
2985 |
-
|
2986 |
$percent_done = intval($current_seconds)/intval($movie_duration);
|
2987 |
$time_elapsed = time() - $started;
|
2988 |
if ( $percent_done != 0 ) { $time_remaining = date('H:i:s', round($time_elapsed / $percent_done) - $time_elapsed); }
|
@@ -2990,9 +3969,9 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
2990 |
$percent_done = round($percent_done*100);
|
2991 |
if ( $percent_done < 20 ) { $percent_done_text = ""; }
|
2992 |
else { $percent_done_text = strval($percent_done)."%"; }
|
2993 |
-
|
2994 |
preg_match('/fps=\s+(.*?) /', $lastline, $fps_matches);
|
2995 |
-
if ( array_key_exists(1, $fps_matches) == true ) {
|
2996 |
if ( $fps_matches[1] != 0 ) { $fps_match = $fps_matches[1]; }
|
2997 |
else { $fps_match = "10"; }
|
2998 |
}
|
@@ -3001,13 +3980,19 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
3001 |
if ( intval($time_to_wait) > 10000 ) { //wait no more than 10 seconds
|
3002 |
$time_to_wait = 10000;
|
3003 |
}
|
3004 |
-
|
3005 |
$args = array($video_key, $format, $page);
|
3006 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
3007 |
|
3008 |
-
$embed_display = '<strong>'.ucwords($video_entry['encode_formats'][$format]['status']).'</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
|
|
|
|
|
|
|
|
|
|
|
|
|
3009 |
}
|
3010 |
-
elseif ( time() - $started < 10 ) { //not enough time has passed, so check again later
|
3011 |
$args = array($video_key, $format, $page);
|
3012 |
$embed_display = '<strong>Encoding</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
3013 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
@@ -3017,92 +4002,88 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
3017 |
$ended = filemtime($logfile);
|
3018 |
$time_elapsed = $ended - $started;
|
3019 |
$time_remaining = "0";
|
3020 |
-
$fps_match = "10";
|
3021 |
if ( array_key_exists(1, $libx264_matches) ) { kgvid_fix_moov_atom($video_key, $format); } //fix the moov atom if the file was encoded by libx264
|
3022 |
$video_embed_queue[$video_key]['encode_formats'][$format]['status'] = "Encoding Complete";
|
3023 |
$video_embed_queue[$video_key]['encode_formats'][$format]['ended'] = $ended;
|
3024 |
$video_embed_queue[$video_key]['encode_formats'][$format]['lastline'] = $lastline;
|
3025 |
|
3026 |
-
if ( $format == "rotated" ) {
|
3027 |
-
|
3028 |
-
$video_embed_queue[$video_key]['movie_info']['rotate'] = ""; //clear rotation because we've just fixed that problem
|
3029 |
-
delete_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-rotate');
|
3030 |
-
|
3031 |
-
//$setwidth = get_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-width', true);
|
3032 |
-
//$setheight = get_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-height', true);
|
3033 |
-
$setwidth = $video_entry['movie_info']['width'];
|
3034 |
-
$setheight = $video_entry['movie_info']['height'];
|
3035 |
-
if ( intval($setwidth) > intval($setheight) ) { //swap the width and height meta if it hasn't already been done
|
3036 |
-
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-actualwidth', $video_entry['movie_info']['height']);
|
3037 |
-
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-width', $setheight);
|
3038 |
-
$video_embed_queue[$video_key]['movie_info']['width'] = $video_entry['movie_info']['height'];
|
3039 |
-
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-actualheight', $video_entry['movie_info']['width']);
|
3040 |
-
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-height', $setwidth);
|
3041 |
-
$video_embed_queue[$video_key]['movie_info']['height'] = $video_entry['movie_info']['width'];
|
3042 |
-
}
|
3043 |
-
$video_embed_queue[$video_key]['encode_formats'][$format]['url'] = $video_embed_queue[$video_key]['movieurl'];
|
3044 |
-
|
3045 |
-
$original_filename = get_attached_file($video_entry['attachmentID']);
|
3046 |
-
if (file_exists($video_embed_queue[$video_key]['encode_formats'][$format]['filepath'])) rename($video_embed_queue[$video_key]['encode_formats'][$format]['filepath'], $original_filename);
|
3047 |
-
// you must first include the image.php file
|
3048 |
-
// for the function wp_generate_attachment_metadata() to work and media.php for wp_read_video_metadata() in WP 3.6+
|
3049 |
-
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
3050 |
-
global $wp_version;
|
3051 |
-
if ( $wp_version >= 3.6 ) { require_once(ABSPATH . 'wp-admin/includes/media.php'); }
|
3052 |
-
$attach_data = wp_generate_attachment_metadata( $video_entry['attachmentID'], $original_filename );
|
3053 |
-
wp_update_attachment_metadata( $video_entry['attachmentID'], $attach_data );
|
3054 |
-
$rotate_complete = true;
|
3055 |
-
|
3056 |
-
} //end rotated video replacement
|
3057 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
3058 |
-
|
3059 |
-
|
3060 |
-
|
3061 |
-
|
3062 |
-
|
3063 |
-
|
3064 |
-
|
3065 |
-
|
3066 |
-
|
3067 |
-
|
3068 |
-
|
3069 |
-
|
3070 |
-
|
3071 |
-
|
3072 |
-
|
3073 |
-
$
|
3074 |
-
$
|
3075 |
-
|
3076 |
-
|
3077 |
-
|
3078 |
-
|
3079 |
-
|
3080 |
-
|
3081 |
-
|
3082 |
-
|
3083 |
-
|
3084 |
-
|
3085 |
-
|
3086 |
-
|
3087 |
-
|
3088 |
-
|
3089 |
-
|
3090 |
-
|
3091 |
-
|
3092 |
-
|
3093 |
-
|
|
|
|
|
|
|
|
|
3094 |
}
|
3095 |
-
|
3096 |
//finish inserting attachment
|
3097 |
-
|
3098 |
$embed_display = '<strong>Encoding Complete</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
3099 |
$next_video = kgvid_encode_videos(); //start the next queued video
|
3100 |
-
if ( !empty($next_video['format']) ) {
|
3101 |
$args = array($next_video['video_key'], $next_video['format'], $page);
|
3102 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
3103 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3104 |
}
|
3105 |
-
else { //there was an
|
|
|
3106 |
if ( strpos($lastline, "signal 15") !== false ) { //if the encoding was intentionally canceled
|
3107 |
$lastline = "Encoding was canceled.";
|
3108 |
}
|
@@ -3110,25 +4091,26 @@ function kgvid_encode_progress($video_key, $format, $page) {
|
|
3110 |
$video_embed_queue[$video_key]['encode_formats'][$format]['lastline'] = $lastline;
|
3111 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
3112 |
$other_message = $lastline;
|
3113 |
-
$embed_display = '<strong>Error: </strong><span style="color:red;">'.$lastline.'.</span>
|
3114 |
$next_video = kgvid_encode_videos(); //start the next queued video
|
3115 |
if ( !empty($next_video['format']) ) {
|
|
|
3116 |
$args = array($next_video['video_key'], $next_video['format'], $page);
|
3117 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
3118 |
}
|
3119 |
}
|
3120 |
-
|
3121 |
//$embed_display .= $lastline;
|
3122 |
-
$arr = array ( "embed_display"=>$embed_display
|
3123 |
}
|
3124 |
else { $arr = array ( "embed_display"=>"<strong>No log file</strong>" ); }
|
3125 |
-
|
3126 |
}//if not completed
|
3127 |
-
else { $arr = array ( "embed_display"=>"<strong>".ucwords($video_embed_queue[$video_key]['encode_formats'][$format]['status'])."</strong>" ); }
|
3128 |
} //if there's a queue and the video is encoding
|
3129 |
else { $arr = array ( "embed_display"=>"<strong>Waiting...</strong>" ); }
|
3130 |
return $arr;
|
3131 |
-
|
3132 |
}//end if queue entry exists
|
3133 |
|
3134 |
}
|
@@ -3144,16 +4126,69 @@ function kgvid_ajax_encode_progress() {
|
|
3144 |
$progress = kgvid_encode_progress($video_key, $format, $page);
|
3145 |
echo json_encode($progress);
|
3146 |
die();
|
3147 |
-
|
3148 |
}
|
3149 |
add_action('wp_ajax_kgvid_encode_progress', 'kgvid_ajax_encode_progress');
|
3150 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3151 |
function kgvid_clear_completed_queue($type) {
|
3152 |
|
3153 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
3154 |
-
|
3155 |
if ( !empty($video_embed_queue) ) {
|
3156 |
-
|
3157 |
$keep = array();
|
3158 |
$cleared_video_queue = array();
|
3159 |
|
@@ -3173,45 +4208,49 @@ function kgvid_clear_completed_queue($type) {
|
|
3173 |
}
|
3174 |
}
|
3175 |
}
|
3176 |
-
|
3177 |
foreach ( $keep as $video_key => $value ) {
|
3178 |
$cleared_video_queue[] = $video_embed_queue[$video_key];
|
3179 |
}
|
3180 |
sort($cleared_video_queue);
|
3181 |
|
3182 |
update_option('kgvid_video_embed_queue', $cleared_video_queue);
|
3183 |
-
|
3184 |
}
|
3185 |
}
|
3186 |
add_action('kgvid_cleanup_queue','kgvid_clear_completed_queue');
|
3187 |
|
3188 |
function kgvid_ajax_clear_completed_queue() {
|
3189 |
|
3190 |
-
|
3191 |
-
|
3192 |
-
|
3193 |
-
|
3194 |
-
|
3195 |
-
|
3196 |
-
|
|
|
|
|
3197 |
}
|
3198 |
add_action('wp_ajax_kgvid_clear_completed_queue', 'kgvid_ajax_clear_completed_queue');
|
3199 |
|
3200 |
function kgvid_ajax_clear_queue_entry() {
|
3201 |
|
3202 |
-
|
3203 |
-
|
3204 |
-
|
3205 |
-
|
3206 |
-
|
3207 |
-
|
3208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3209 |
}
|
3210 |
-
|
3211 |
-
$table = kgvid_generate_queue_table();
|
3212 |
-
echo ($table);
|
3213 |
-
die();
|
3214 |
-
|
3215 |
}
|
3216 |
add_action('wp_ajax_kgvid_clear_queue_entry', 'kgvid_ajax_clear_queue_entry');
|
3217 |
|
@@ -3223,9 +4262,9 @@ add_action('kgvid_cleanup_queue', 'kgvid_cleanup_queue_handler');
|
|
3223 |
function kgvid_fix_moov_atom($video_key, $format) {
|
3224 |
|
3225 |
$options = get_option('kgvid_video_embed_options');
|
3226 |
-
|
3227 |
-
if ( $options['moov']
|
3228 |
-
|
3229 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
3230 |
$filepath = $video_embed_queue[$video_key][$format]['filepath'];
|
3231 |
|
@@ -3238,58 +4277,63 @@ function kgvid_fix_moov_atom($video_key, $format) {
|
|
3238 |
rename($faststart_tmp_file, $filepath);
|
3239 |
}
|
3240 |
}//if qt-faststart is selected
|
3241 |
-
|
3242 |
if ( $options['moov'] == 'MP4Box' ) {
|
3243 |
$cmd = escapeshellcmd($options['app_path']."/".$options['moov']." -inter 500 ".$filepath);
|
3244 |
exec($cmd);
|
3245 |
}//if MP4Box is selected
|
3246 |
-
|
3247 |
}//if there is an application selected for fixing moov atoms on libx264-encoded files.
|
3248 |
|
3249 |
}
|
3250 |
|
3251 |
function kgvid_cancel_encode() {
|
3252 |
|
3253 |
-
|
|
|
3254 |
|
3255 |
-
|
3256 |
-
|
3257 |
-
|
3258 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
3259 |
}
|
3260 |
-
|
3261 |
-
$format = $_POST['format'];
|
3262 |
-
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
3263 |
-
$video_embed_queue[$video_key]['encode_formats'][$format]['status'] = "canceling";
|
3264 |
-
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
3265 |
}
|
3266 |
-
|
3267 |
}
|
3268 |
add_action('wp_ajax_kgvid_cancel_encode', 'kgvid_cancel_encode');
|
3269 |
|
3270 |
function kgvid_ajax_delete_video() {
|
3271 |
|
3272 |
-
|
3273 |
-
|
3274 |
-
|
3275 |
-
|
3276 |
-
|
3277 |
-
|
3278 |
-
|
3279 |
-
|
3280 |
-
|
3281 |
-
|
3282 |
-
|
3283 |
-
|
3284 |
-
|
3285 |
-
|
3286 |
-
|
3287 |
-
|
3288 |
-
|
3289 |
-
|
3290 |
-
|
3291 |
-
|
3292 |
-
|
|
|
|
|
3293 |
}
|
3294 |
add_action('wp_ajax_kgvid_delete_video', 'kgvid_ajax_delete_video');
|
3295 |
|
@@ -3302,10 +4346,18 @@ function kgvid_delete_video_attachment($video_id) {
|
|
3302 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
3303 |
$parent_id = get_post($video_id)->post_parent;
|
3304 |
$wp_attached_file = get_post_meta($video_id, '_wp_attached_file', true);
|
3305 |
-
|
3306 |
if ( !empty($video_embed_queue) ) { //remove any encode queue entry related to this attachment
|
3307 |
foreach ($video_embed_queue as $video_key => $video_entry) {
|
3308 |
if ( $video_entry['attachmentID'] == $video_id ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3309 |
unset($video_embed_queue[$video_key]);
|
3310 |
sort($video_embed_queue);
|
3311 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
@@ -3314,7 +4366,7 @@ function kgvid_delete_video_attachment($video_id) {
|
|
3314 |
if ( $video_entry['attachmentID'] == $parent_id || get_post_meta($video_id, '_kgflashmediaplayer-externalurl', true) == $video_entry['movieurl'] ) {
|
3315 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
3316 |
if ( array_key_exists('filepath', $value) ) {
|
3317 |
-
if ( strpos($value['filepath'], $wp_attached_file) !== false ) {
|
3318 |
$video_embed_queue[$video_key]['encode_formats'][$format]['status'] = "deleted";
|
3319 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
3320 |
break;
|
@@ -3324,21 +4376,43 @@ function kgvid_delete_video_attachment($video_id) {
|
|
3324 |
}//if the video is a child format
|
3325 |
}
|
3326 |
}
|
3327 |
-
|
3328 |
-
$args = array(
|
3329 |
'post_parent' => $video_id,
|
3330 |
'post_type' => 'attachment',
|
3331 |
'numberposts' => '-1'
|
3332 |
);
|
3333 |
$posts = get_posts( $args ); //find all children of the video in the database
|
3334 |
if ($posts) {
|
|
|
3335 |
foreach ($posts as $post) {
|
3336 |
wp_update_post( array( 'ID' => $post->ID, 'post_parent' => $parent_id ) ); //set post_parent field to the original video's post_parent
|
3337 |
if ( $options['delete_children'] != 'none' ) {
|
3338 |
if ( $options['delete_children'] == 'all' ) { wp_delete_attachment($post->ID, true); }
|
3339 |
else if ( strpos($post->post_mime_type, 'video') !== false ) { wp_delete_attachment($post->ID, true); } //only delete videos
|
3340 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
3341 |
}//end loop
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3342 |
}//end if there are any children
|
3343 |
}//end if video
|
3344 |
|
@@ -3366,16 +4440,16 @@ function kgvid_get_set_featured() {
|
|
3366 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
3367 |
|
3368 |
global $wpdb;
|
3369 |
-
|
3370 |
/* $querystr = "
|
3371 |
-
SELECT $wpdb->posts.*
|
3372 |
FROM $wpdb->posts, $wpdb->postmeta
|
3373 |
-
WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
|
3374 |
-
AND $wpdb->postmeta.meta_key = '_kgflashmediaplayer-poster-id'
|
3375 |
ORDER BY $wpdb->posts.post_date ASC
|
3376 |
";
|
3377 |
$videoposts = $wpdb->get_results($querystr, OBJECT); */
|
3378 |
-
|
3379 |
$args = array(
|
3380 |
'post_type' => null,
|
3381 |
'numberposts' => -1,
|
@@ -3391,7 +4465,7 @@ function kgvid_get_set_featured() {
|
|
3391 |
if ( !empty($post_id) && !empty($poster_id) ) { $posts[$post_id] = $poster_id; }
|
3392 |
}//end loop
|
3393 |
}//end if posts
|
3394 |
-
|
3395 |
$cms_switch_queue = get_option('kgvid_video_embed_cms_switch');
|
3396 |
$cms_switch_queue['set_featured'] = $posts;
|
3397 |
update_option('kgvid_video_embed_cms_switch', $cms_switch_queue);
|
@@ -3424,9 +4498,9 @@ function kgvid_get_switch_parents() {
|
|
3424 |
$new_parent = 'post';
|
3425 |
if (isset($_POST['parent'])) { $new_parent = $_POST['parent']; }
|
3426 |
$children = array();
|
3427 |
-
|
3428 |
if ( $new_parent == 'post' ) {
|
3429 |
-
|
3430 |
$args = array(
|
3431 |
'orderby' => 'post_date',
|
3432 |
'order' => 'ASC',
|
@@ -3438,7 +4512,7 @@ function kgvid_get_switch_parents() {
|
|
3438 |
|
3439 |
if ($attachments) {
|
3440 |
foreach ($attachments as $post) {
|
3441 |
-
if ( !empty($post->post_parent) ) { //if the video is attached to a post
|
3442 |
$args = array(
|
3443 |
'orderby' => 'post_date',
|
3444 |
'order' => 'ASC',
|
@@ -3457,9 +4531,9 @@ function kgvid_get_switch_parents() {
|
|
3457 |
}//end loop
|
3458 |
}//end if posts
|
3459 |
}//end if new parent is post
|
3460 |
-
|
3461 |
if ( $new_parent == 'video' ) {
|
3462 |
-
|
3463 |
$args = array(
|
3464 |
'orderby' => 'post_date',
|
3465 |
'order' => 'ASC',
|
@@ -3469,7 +4543,7 @@ function kgvid_get_switch_parents() {
|
|
3469 |
'numberposts' => -1
|
3470 |
);
|
3471 |
$thumbnails = get_posts( $args );
|
3472 |
-
|
3473 |
if ( $thumbnails ) {
|
3474 |
foreach ($thumbnails as $thumbnail) {
|
3475 |
$video_id = get_post_meta($thumbnail->ID, '_kgflashmediaplayer-video-id', true);
|
@@ -3492,13 +4566,13 @@ function kgvid_switch_parents() {
|
|
3492 |
if ( $queue['switching_parents'] ) {
|
3493 |
$new_parent = 'post';
|
3494 |
if (isset($_POST['parent'])) { $new_parent = $_POST['parent']; }
|
3495 |
-
|
3496 |
foreach ( $queue['switching_parents'] as $thumbnail_id => $thumbnail ) {
|
3497 |
if ( $new_parent == 'post' ) {
|
3498 |
wp_update_post( array( 'ID' => $thumbnail_id, 'post_parent' => $thumbnail['post_parent'] ) );
|
3499 |
update_post_meta($thumbnail_id, '_kgflashmediaplayer-video-id', $thumbnail['video_id']);
|
3500 |
}
|
3501 |
-
|
3502 |
if ( $new_parent == 'video' ) {
|
3503 |
wp_update_post( array( 'ID' => $thumbnail_id, 'post_parent' => $thumbnail['video_id'] ) );
|
3504 |
}
|
@@ -3525,14 +4599,14 @@ function kgvid_update_cms_progress() {
|
|
3525 |
}
|
3526 |
echo $remaining;
|
3527 |
die;
|
3528 |
-
|
3529 |
}
|
3530 |
add_action('wp_ajax_kgvid_update_cms_progress', 'kgvid_update_cms_progress');
|
3531 |
|
3532 |
-
function kgvid_singleurl_meta_box($postType) {
|
3533 |
|
3534 |
$matches = kgvid_check_for_shortcode_in_content();
|
3535 |
-
|
3536 |
if ( $matches[5] ) {
|
3537 |
add_meta_box(
|
3538 |
'kgvid_singleurl_meta',
|
@@ -3542,7 +4616,7 @@ function kgvid_singleurl_meta_box($postType) {
|
|
3542 |
);
|
3543 |
}
|
3544 |
}
|
3545 |
-
|
3546 |
|
3547 |
function kgvid_singleurl_inner_custom_box($post) {
|
3548 |
|
@@ -3557,7 +4631,7 @@ function kgvid_singleurl_inner_custom_box($post) {
|
|
3557 |
foreach ( $urls as $movieurl ) {
|
3558 |
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='{$movieurl}'"; //GUID seems to be the only way to get a video URL
|
3559 |
$video_id = $wpdb->get_var($query);
|
3560 |
-
|
3561 |
echo '<div class="kgvid_post_meta_boxes">';
|
3562 |
if ( empty($video_id) ) {
|
3563 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
@@ -3569,7 +4643,7 @@ function kgvid_singleurl_inner_custom_box($post) {
|
|
3569 |
else {
|
3570 |
echo '<input type="hidden" name="attachments['.$video_id.'][kgflashmediaplayer-security]" value="'.$nonce.'">';
|
3571 |
echo '<strong>'.get_the_title($video_id).'</strong>';
|
3572 |
-
echo kgvid_generate_encode_checkboxes($movieurl, $video_id, 'queue');
|
3573 |
}
|
3574 |
echo '</div>';
|
3575 |
}//loop through KGVID URLs
|
@@ -3620,9 +4694,16 @@ add_action( 'wp_ajax_kgvid_count_play', 'kgvid_count_play' ); // ajax for logged
|
|
3620 |
add_action( 'wp_ajax_nopriv_kgvid_count_play', 'kgvid_count_play' ); // ajax for not logged in users
|
3621 |
|
3622 |
function kgvid_deactivate() {
|
|
|
3623 |
wp_clear_scheduled_hook('kgvid_cleanup_queue', array( 'scheduled' ) );
|
3624 |
delete_option('kgvid_video_embed_queue');
|
|
|
|
|
|
|
|
|
|
|
|
|
3625 |
}
|
3626 |
register_deactivation_hook( __FILE__, 'kgvid_deactivate' );
|
3627 |
|
3628 |
-
?>
|
2 |
/*
|
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 for thumbnails and encodes. <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">Settings</a> | <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>
|
6 |
+
Version: 4.2
|
7 |
Author: Kyle Gilman
|
8 |
Author URI: http://www.kylegilman.net/
|
9 |
|
34 |
License: http://www.gnu.org/licenses/lgpl.html
|
35 |
6) Includes code adapted from Kathy Darling's custom solution for saving thumbnails
|
36 |
Website: http://www.kathyisawesome.com/
|
37 |
+
7) Includes code adapted from Jean-Marc Amiaud's "Replace WordPress default media icon with preview image"
|
38 |
+
Website: http://www.amiaud.org/tag/video/
|
39 |
+
|
40 |
*/
|
41 |
|
42 |
if ( ! defined( 'ABSPATH' ) )
|
43 |
die( "Can't load this file directly" );
|
44 |
+
|
45 |
function kgvid_default_options_fn() {
|
46 |
+
|
47 |
+
$upload_capable = kgvid_upload_capable();
|
48 |
+
|
49 |
$options = array(
|
50 |
+
"version"=>4.2,
|
51 |
"embed_method"=>"Video.js",
|
52 |
"template"=>false,
|
53 |
"template_gentle"=>"on",
|
54 |
+
"encode_fullres"=>false,
|
55 |
"encode_1080"=>"on",
|
56 |
"encode_720"=>"on",
|
57 |
"encode_mobile"=>"on",
|
78 |
"align"=>"left",
|
79 |
"width"=>"640",
|
80 |
"height"=>"360",
|
81 |
+
"minimum_width"=>false,
|
82 |
"gallery_width"=>"960",
|
83 |
"gallery_height"=>"540",
|
84 |
"gallery_thumb"=>"250",
|
85 |
"controlbar_style"=>"docked",
|
86 |
"autoplay"=>false,
|
87 |
"loop"=>false,
|
88 |
+
"endofvideooverlay"=>false,
|
89 |
+
"endofvideooverlaysame"=>"",
|
90 |
"bgcolor"=>"",
|
91 |
"configuration"=>"",
|
92 |
"skin"=>plugins_url("", __FILE__)."/flash/skin/kg_skin.xml",
|
94 |
"stream_type"=>"liveOrRecorded",
|
95 |
"scale_mode"=>"letterbox",
|
96 |
"autohide"=>"on",
|
97 |
+
"playbutton"=>"on",
|
98 |
+
"bitrate_multiplier"=>0.1,
|
99 |
+
"h264_CRF"=>"23",
|
100 |
+
"webm_CRF"=>"10",
|
101 |
+
"ogv_CRF"=>"6",
|
102 |
+
"audio_bitrate"=>160,
|
103 |
+
"threads"=>1,
|
104 |
+
"nice"=>"on",
|
105 |
+
"browser_thumbnails"=>"on",
|
106 |
+
"rate_control"=>"crf",
|
107 |
+
"h264_profile"=>"baseline",
|
108 |
+
"h264_level"=>"3.0",
|
109 |
+
"auto_encode"=>false,
|
110 |
+
"auto_thumb"=>false,
|
111 |
+
"auto_thumb_position"=>50,
|
112 |
+
"right_click"=>"on",
|
113 |
+
"resize"=>"on",
|
114 |
+
"capabilities"=>array("make_video_thumbnails"=>$upload_capable, "encode_videos"=>$upload_capable),
|
115 |
+
"open_graph"=>"on",
|
116 |
+
"htaccess_login"=>"",
|
117 |
+
"htaccess_password"=>""
|
118 |
);
|
119 |
return $options;
|
120 |
}
|
121 |
|
122 |
function kgvid_register_default_options_fn() { //add default values for options
|
123 |
+
|
124 |
$options = get_option('kgvid_video_embed_options');
|
125 |
+
|
126 |
if( !is_array($options) ) {
|
127 |
$options = kgvid_default_options_fn();
|
128 |
update_option('kgvid_video_embed_options', $options);
|
129 |
}
|
130 |
+
|
131 |
+
kgvid_set_capabilities($options['capabilities']);
|
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 kgvid_video_formats() {
|
139 |
|
140 |
$video_formats = array(
|
141 |
+
"fullres" => array(
|
142 |
+
"name" => "Replace original with H.264",
|
143 |
+
"width" => 4096,
|
144 |
+
"height" => 2304,
|
145 |
+
"type" => "h264",
|
146 |
+
"suffix" => "-fullres.mp4",
|
147 |
+
"vcodec" => "libx264"
|
148 |
+
),
|
149 |
+
"1080" => array(
|
150 |
+
"name" => "1080p H.264",
|
151 |
+
"width" => 1920,
|
152 |
+
"height" => 1080,
|
153 |
+
"type" => "h264",
|
154 |
+
"suffix" => "-1080.mp4",
|
155 |
+
"old_suffix" => "-1080.m4v",
|
156 |
+
"vcodec" => "libx264"
|
157 |
+
),
|
158 |
+
"720" => array(
|
159 |
+
"name" => "720p H.264",
|
160 |
+
"width" => 1280,
|
161 |
+
"height" => 720,
|
162 |
+
"type" => "h264",
|
163 |
+
"suffix" => "-720.mp4",
|
164 |
+
"old_suffix" => "-720.m4v",
|
165 |
+
"vcodec" => "libx264"
|
166 |
+
),
|
167 |
+
"mobile" => array(
|
168 |
+
"name" => "480p H.264",
|
169 |
+
"width" => 640,
|
170 |
+
"height" => 480,
|
171 |
+
"type" => "h264",
|
172 |
+
"suffix" => "-480.mp4",
|
173 |
+
"old_suffix" => "-ipod.m4v",
|
174 |
+
"vcodec" => "libx264"
|
175 |
+
),
|
176 |
+
"webm" => array(
|
177 |
+
"name" => "WEBM",
|
178 |
+
"width" => 0,
|
179 |
+
"height" => 0,
|
180 |
+
"type" => "webm",
|
181 |
+
"suffix" => ".webm",
|
182 |
+
"vcodec" => "libvpx",
|
183 |
+
),
|
184 |
+
"ogg" => array(
|
185 |
+
"name" => "OGV",
|
186 |
+
"width" => 0,
|
187 |
+
"height" => 0,
|
188 |
+
"type" => "ogv",
|
189 |
+
"suffix" => ".ogv",
|
190 |
+
"vcodec" => "libtheora"
|
191 |
+
)
|
192 |
);
|
193 |
return $video_formats;
|
194 |
+
|
195 |
+
}
|
196 |
+
|
197 |
+
function kgvid_upload_capable() {
|
198 |
+
global $wp_roles;
|
199 |
+
$upload_capable = array();
|
200 |
+
foreach ( $wp_roles->roles as $role => $role_info ) {
|
201 |
+
if ( array_key_exists('upload_files', $role_info['capabilities']) && $role_info['capabilities']['upload_files'] == 1 ) {
|
202 |
+
$upload_capable[$role] = "on";
|
203 |
+
}
|
204 |
+
else { $upload_capable[$role] = false; }
|
205 |
+
}
|
206 |
+
return $upload_capable;
|
207 |
+
}
|
208 |
+
|
209 |
+
function kgvid_set_capabilities($capabilities) {
|
210 |
+
global $wp_roles;
|
211 |
+
foreach ( $capabilities as $capability => $enabled_roles ) {
|
212 |
+
foreach ( $wp_roles->roles as $role => $role_info ) { //check all roles
|
213 |
+
if ( !array_key_exists($capability, $role_info['capabilities']) && array_key_exists($role, $enabled_roles) && $enabled_roles[$role] == "on" ) {
|
214 |
+
$wp_roles->add_cap( $role, $capability );
|
215 |
+
}
|
216 |
+
if ( array_key_exists($capability, $role_info['capabilities']) && !array_key_exists($role, $enabled_roles) ) {
|
217 |
+
$wp_roles->remove_cap( $role, $capability );
|
218 |
+
}
|
219 |
+
}
|
220 |
+
}
|
221 |
+
}
|
222 |
+
|
223 |
+
function kgvid_aac_encoders() {
|
224 |
+
|
225 |
+
$aac_array = array("libfdk_aac", "libfaac", "libvo_aacenc", "aac");
|
226 |
+
return $aac_array;
|
227 |
+
|
228 |
}
|
229 |
|
230 |
function kgvid_add_upload_mimes ( $existing_mimes=array() ) {
|
231 |
+
|
232 |
// allows uploading .webm videos
|
233 |
$existing_mimes['webm'] = 'video/webm';
|
234 |
return $existing_mimes;
|
235 |
+
|
236 |
}
|
237 |
add_filter('upload_mimes', 'kgvid_add_upload_mimes');
|
238 |
|
276 |
$pattern = get_shortcode_regex();
|
277 |
preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches );
|
278 |
if ( array_key_exists( 2, $matches ) && array_key_exists( 5, $matches ) ) {
|
279 |
+
foreach ( $matches[2] as $shortcode_index => $shortcode ) {
|
280 |
if ( $shortcode == "KGVID" || $shortcode == "FMP" ) { continue; }
|
281 |
+
else {
|
282 |
foreach ( $matches as $match_index => $shortcode_matches ) {
|
283 |
+
unset($matches[$match_index][$shortcode_index]);
|
284 |
+
}
|
285 |
}
|
286 |
}
|
287 |
foreach ( $matches[5] as $index => $url ) {
|
303 |
|
304 |
global $wp_version;
|
305 |
$field_id = array();
|
306 |
+
|
307 |
+
if ( $wp_version < 3.5 ) {
|
308 |
$field_id['poster'] = 'attachments['. $post_id .'][kgflashmediaplayer-poster]';
|
309 |
$field_id['thumbtime'] = 'attachments['. $post_id .'][thumbtime]';
|
310 |
}
|
311 |
+
else {
|
312 |
+
$field_id['poster'] = 'attachments-'. $post_id .'-kgflashmediaplayer-poster';
|
313 |
$field_id['thumbtime'] = 'attachments-'. $post_id .'-thumbtime';
|
314 |
}
|
315 |
return $field_id;
|
316 |
+
|
317 |
}
|
318 |
|
319 |
function kgvid_sanitize_url($movieurl) {
|
344 |
$function = "";
|
345 |
$uploads = wp_upload_dir();
|
346 |
|
347 |
+
if(function_exists('exec')) {
|
348 |
if (function_exists('escapeshellcmd')) {
|
349 |
$exec_enabled = true;
|
350 |
+
$cmd = escapeshellcmd($options['app_path'].'/'.$options['video_app'].' -i '.plugin_dir_path(__FILE__).'images/sample-video-h264.mp4 -vframes 1 -f mjpeg '.$uploads['path'].'/ffmpeg_exists_test.jpg');
|
351 |
exec ( $cmd, $output, $returnvalue );
|
352 |
}
|
353 |
else { $function = "ESCAPESHELLCMD"; }
|
361 |
|
362 |
if ( $save == true ) {
|
363 |
if ( $ffmpeg_exists == true ) { $options['ffmpeg_exists'] = "on"; }
|
364 |
+
else {
|
365 |
+
$options['ffmpeg_exists'] = "notinstalled";
|
366 |
+
$options['browser_thumbnails'] = "on"; //if FFMPEG isn't around, this should be enabled
|
367 |
+
}
|
368 |
update_option('kgvid_video_embed_options', $options);
|
369 |
}
|
370 |
|
381 |
$video_formats = kgvid_video_formats();
|
382 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
383 |
$movieurl = $sanitized_url['movieurl'];
|
384 |
+
|
385 |
+
$encodevideo_info['moviefilebasename'] = $sanitized_url['basename'];
|
386 |
$encodevideo_info['encodepath'] = $uploads['path'];
|
387 |
if ( get_post_type($postID) == "attachment" ) { //if it's an attachment, not from URL
|
388 |
$moviefile = get_attached_file($postID);
|
397 |
);
|
398 |
}
|
399 |
else {
|
400 |
+
|
401 |
$url_parts = parse_url($uploads['url']);
|
402 |
if ( array_key_exists('host', $url_parts) && strpos($movieurl, $url_parts['host']) !== false ) { //if we're on the same server
|
403 |
$encodevideo_info['sameserver'] = true;
|
413 |
$encodevideo_info['encodepath'] = rtrim($parsed_url['localpath'], $parsed_url['filename']);
|
414 |
}
|
415 |
else { $encodevideo_info['sameserver'] = false; }
|
416 |
+
|
417 |
$args = array(
|
418 |
'numberposts' => '-1',
|
419 |
'post_type' => 'attachment',
|
429 |
|
430 |
$encodevideo_info[$format.'_exists'] = false;
|
431 |
$encodevideo_info[$format.'_writable'] = false;
|
432 |
+
|
433 |
//start with the new database info before checking other locations
|
434 |
+
|
435 |
if ($children) {
|
436 |
foreach ( $children as $child ) {
|
437 |
$mime_type = get_post_mime_type($child->ID);
|
447 |
}
|
448 |
}
|
449 |
}
|
450 |
+
|
451 |
//if the format's not in the database, check these places
|
452 |
+
|
453 |
+
if ( array_key_exists('old_suffix', $format_stats) ) { $old_suffix = $format_stats['old_suffix']; }
|
454 |
+
else { $old_suffix = $format_stats['suffix']; }
|
455 |
+
$potential_locations = array(
|
456 |
+
"same_directory" => array(
|
457 |
+
'url' => $sanitized_url['noextension'].$format_stats['suffix'],
|
458 |
+
'filepath' => $encodevideo_info['encodepath'].$encodevideo_info['moviefilebasename'].$format_stats['suffix'] ),
|
459 |
+
"same_directory_old_suffix" => array(
|
460 |
+
'url' => $sanitized_url['noextension'].$old_suffix,
|
461 |
+
'filepath' => $encodevideo_info['encodepath'].$encodevideo_info['moviefilebasename'].$old_suffix ),
|
462 |
+
"html5encodes" => array(
|
463 |
+
'url' => $uploads['baseurl']."/html5encodes/".$encodevideo_info['moviefilebasename'].$old_suffix,
|
464 |
+
'filepath' => $uploads['basedir']."/html5encodes/".$encodevideo_info['moviefilebasename'].$old_suffix ),
|
465 |
+
);
|
466 |
+
if ( !array_key_exists('old_suffix', $format_stats) ) { unset($potential_locations['same_directory_old_suffix']); }
|
467 |
+
|
468 |
+
foreach ( $potential_locations as $name => $location ) {
|
469 |
+
|
470 |
+
if ( file_exists($location['filepath']) ) {
|
471 |
+
$encodevideo_info[$format.'_exists'] = true;
|
472 |
+
$encodevideo_info[$format.'url'] = $location['url'];
|
473 |
+
$encodevideo_info[$format.'filepath'] = $location['filepath'];
|
474 |
+
if ( is_writable($location['filepath']) ) { $encodevideo_info[$format.'_writable'] = true; }
|
475 |
+
break;
|
476 |
+
}
|
477 |
+
elseif ( !$encodevideo_info['sameserver'] && $name != "html5encodes" ) { //last resort if it's not on the same server, check url_exists
|
478 |
+
|
479 |
+
$already_checked_url = get_post_meta($postID, '_kgflashmediaplayer-'.$sanitized_url['singleurl_id'].'-'.$format, true);
|
480 |
+
if ( empty($already_checked_url) ) {
|
481 |
+
if ( kgvid_url_exists(esc_url_raw(str_replace(" ", "%20", $location['url']))) ) {
|
482 |
+
$encodevideo_info[$format.'_exists'] = true;
|
483 |
+
$encodevideo_info[$format.'url'] = $location['url'];
|
484 |
+
update_post_meta($postID, '_kgflashmediaplayer-'.$sanitized_url['singleurl_id'].'-'.$format, $encodevideo_info[$format.'url']);
|
|
|
|
|
|
|
|
|
|
|
485 |
}
|
486 |
+
else {
|
487 |
+
update_post_meta($postID, '_kgflashmediaplayer-'.$sanitized_url['singleurl_id'].'-'.$format, 'not found');
|
|
|
|
|
|
|
488 |
}
|
489 |
+
}
|
490 |
+
else { //url already checked
|
491 |
+
if ( substr($already_checked_url, 0, 4) == 'http' ) { //if it smells like a URL...
|
492 |
+
$encodevideo_info[$format.'_exists'] = true;
|
493 |
+
$encodevideo_info[$format.'url'] = $already_checked_url;
|
494 |
+
}
|
495 |
+
}
|
496 |
+
}//end if not on same server
|
497 |
+
}//end potential locations loop
|
498 |
+
|
499 |
+
|
500 |
if ( !$encodevideo_info[$format.'_exists'] ) {
|
501 |
$encodevideo_info[$format.'url'] = $uploads['url'].'/'.$encodevideo_info['moviefilebasename'].$format_stats['suffix'];
|
502 |
$encodevideo_info[$format.'filepath'] = $uploads['path'].'/'.$encodevideo_info['moviefilebasename'].$format_stats['suffix'];
|
503 |
}
|
504 |
+
|
505 |
}//end format loop
|
506 |
+
|
507 |
return $encodevideo_info;
|
508 |
}
|
509 |
|
517 |
function kgvid_get_video_dimensions($video = false) {
|
518 |
$options = get_option('kgvid_video_embed_options');
|
519 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
520 |
+
|
521 |
$video = str_replace("https://", "http://", $video);
|
522 |
|
523 |
+
if ( !empty($options['htaccess_login']) && strpos($video, 'http://') === 0 ) {
|
524 |
+
$video = substr_replace($video, $options['htaccess_login'].':'.$options['htaccess_password'].'@', 7, 0);
|
525 |
+
}
|
526 |
+
|
527 |
$command = escapeshellcmd($ffmpegPath . ' -i "' . $video . '"');
|
528 |
$command = $command.' 2>&1';
|
529 |
exec ( $command, $output );
|
530 |
$lastline = end($output);
|
531 |
+
$lastline = prev($output)."<br />".$lastline;
|
532 |
$output = implode("\n", $output);
|
533 |
|
534 |
$regex = "/Video: ([^,]*), ([^,]*), ([0-9]{1,4})x([0-9]{1,4})/";
|
536 |
else { $result = ""; }
|
537 |
|
538 |
if ( !empty($result) ) {
|
539 |
+
$movie_info['worked'] = true;
|
540 |
+
$movie_info['width'] = $regs [3] ? $regs [3] : null;
|
541 |
+
$movie_info['height'] = $regs [4] ? $regs [4] : null;
|
542 |
preg_match('/Duration: (.*?),/', $output, $matches);
|
543 |
$duration = $matches[1];
|
544 |
$movie_duration_hours = intval(substr($duration, -11, 2));
|
545 |
$movie_duration_minutes = intval(substr($duration, -8, 2));
|
546 |
+
$movie_duration_seconds = floatval(substr($duration, -5));
|
547 |
+
$movie_info['duration'] = ($movie_duration_hours * 60 * 60) + ($movie_duration_minutes * 60) + $movie_duration_seconds;
|
548 |
|
549 |
preg_match('/rotate : (.*?)\n/', $output, $matches);
|
550 |
if ( array_key_exists(1, $matches) == true ) { $rotate = $matches[1]; }
|
551 |
else $rotate = "0";
|
552 |
+
|
553 |
switch ($rotate) {
|
554 |
+
case "90": $movie_info['rotate'] = ' -vf "transpose=1"'; break;
|
555 |
+
case "180": $movie_info['rotate'] = ' -vf "hflip,vflip"'; break;
|
556 |
+
case "270": $movie_info['rotate'] = ' -vf "transpose=2"'; break;
|
557 |
+
default: $movie_info['rotate'] = ""; break;
|
558 |
}
|
559 |
+
|
560 |
$command = escapeshellcmd($ffmpegPath . ' -i "' . $video . '" -codecs');
|
561 |
$command = $command.' 2>&1';
|
562 |
exec ( $command, $output );
|
563 |
$output = implode("\n", $output);
|
564 |
$configuration = array();
|
565 |
+
$video_lib_array = array('libtheora', 'libvorbis', 'libvpx', 'libx264');
|
566 |
+
$aac_array = kgvid_aac_encoders();
|
567 |
+
$lib_list = array_merge($video_lib_array, $aac_array);
|
568 |
foreach ($lib_list as $lib) {
|
569 |
+
if ( strpos($output, $lib) !== false ) { $movie_info['configuration'][$lib] = "true"; }
|
570 |
+
else { $movie_info['configuration'][$lib] = "false"; }
|
571 |
}
|
572 |
|
573 |
+
return $movie_info;
|
574 |
+
|
575 |
} else {
|
576 |
return array ('output'=>$lastline, 'worked'=>false);
|
577 |
}
|
578 |
|
579 |
}
|
580 |
|
581 |
+
function kgvid_generate_encode_string($input, $output, $libraries, $format, $width, $height, $rotate) {
|
582 |
+
|
583 |
+
$options = get_option('kgvid_video_embed_options');
|
584 |
+
$encode_string = strtoupper($options['video_app'])." not found";
|
585 |
+
|
586 |
+
if ( $options['ffmpeg_exists'] == "on" ) {
|
587 |
+
|
588 |
+
$video_formats = kgvid_video_formats();
|
589 |
+
|
590 |
+
if ( $options['video_app'] == "avconv" || $options['video_bitrate_flag'] != "on" ) {
|
591 |
+
$video_bitrate_flag = "b:v";
|
592 |
+
$audio_bitrate_flag = "b:a";
|
593 |
+
$profile_flag = "profile:v";
|
594 |
+
$level_flag = "level:v";
|
595 |
+
$qscale_flag = "q:v";
|
596 |
+
}
|
597 |
+
|
598 |
+
else {
|
599 |
+
$video_bitrate_flag = "b";
|
600 |
+
$audio_bitrate_flag = "ab";
|
601 |
+
$profile_flag = "profile";
|
602 |
+
$level_flag = "level";
|
603 |
+
$qscale_flag = "qscale";
|
604 |
+
}
|
605 |
+
|
606 |
+
if ( $options['rate_control'] == "crf" ) {
|
607 |
+
$crf_option = $video_formats[$format]['type'].'_CRF';
|
608 |
+
$crf_flag = "crf";
|
609 |
+
if ( $video_formats[$format]['type'] == 'ogv' ) { $crf_flag = $qscale_flag; } //ogg doesn't do CRF
|
610 |
+
$rate_control_flag = " -".$crf_flag." ".$options[$crf_option];
|
611 |
+
}
|
612 |
+
else {
|
613 |
+
$rate_control_flag = " -".$video_bitrate_flag." ".round(floatval($options['bitrate_multiplier'])*$width*$height*30/1024)."k";
|
614 |
+
}
|
615 |
+
|
616 |
+
if ( $video_formats[$format]['type'] == 'h264' ) {
|
617 |
+
|
618 |
+
$aac_array = kgvid_aac_encoders();
|
619 |
+
foreach ( $aac_array as $aaclib ) { //cycle through available AAC encoders in order of quality
|
620 |
+
if ( $libraries[$aaclib] == "true" ) { break; }
|
621 |
+
}
|
622 |
+
if ( $aaclib == "aac" ) { $aaclib = "aac -strict experimental"; } //the built-in aac encoder is considered experimental
|
623 |
+
|
624 |
+
$vpre_flags = "";
|
625 |
+
if ( $options['ffmpeg_vpre'] == 'on' ) { $vpre_flags = ' -vpre fast -vpre ipod640'; }
|
626 |
+
|
627 |
+
$movflags = "";
|
628 |
+
if ( $options['moov'] == "movflag" ) {
|
629 |
+
$movflags = " -movflags faststart";
|
630 |
+
}
|
631 |
+
|
632 |
+
$profile_text = "";
|
633 |
+
if ( $options['h264_profile'] != "none" ) {
|
634 |
+
$profile_text = " -".$profile_flag." ".$options['h264_profile'];
|
635 |
+
if ( $options['h264_profile'] != "high422" && $options['h264_profile'] != "high444" ) {
|
636 |
+
$profile_text .= " -pix_fmt yuv420p"; //makes sure output is converted to 4:2:0
|
637 |
+
}
|
638 |
+
}
|
639 |
+
|
640 |
+
$level_text = "";
|
641 |
+
if ( $options['h264_level'] != "none" ) {
|
642 |
+
if ( $options['video_app'] == "avconv" ) { $options['h264_level'] = round(floatval($options['h264_level'])*10); }
|
643 |
+
$level_text = " -".$level_flag." ".$options['h264_level'];
|
644 |
+
}
|
645 |
+
|
646 |
+
$ffmpeg_options = "-acodec ".$aaclib." -".$audio_bitrate_flag." ".$options['audio_bitrate']."k -s ".$width."x".$height." -vcodec libx264".$vpre_flags.$movflags.$profile_text.$level_text;
|
647 |
+
|
648 |
+
}
|
649 |
+
else { //if it's not H.264 the settings are basically the same
|
650 |
+
$ffmpeg_options = "-acodec libvorbis -".$audio_bitrate_flag." ".$options['audio_bitrate']."k -vcodec ".$video_formats[$format]['vcodec'];
|
651 |
+
if ( $video_formats[$format]['type'] == 'webm' ) {
|
652 |
+
$ffmpeg_options .= " -".$video_bitrate_flag." ".round(floatval($options['bitrate_multiplier'])*1.25*$width*$height*30/1024)."k"; //set a max bitrate 25% larger than the ABR. Otherwise libvpx goes way too low.
|
653 |
+
}
|
654 |
+
}
|
655 |
+
|
656 |
+
$nice = "";
|
657 |
+
$sys = strtoupper(PHP_OS); // Get OS Name
|
658 |
+
if( substr($sys,0,3) != "WIN" && $options['nice'] == "on" ) { $nice = "nice "; }
|
659 |
+
|
660 |
+
if ( !empty($options['htaccess_login']) && strpos($input, 'http://') === 0 ) {
|
661 |
+
$input = substr_replace($input, $options['htaccess_login'].':'.$options['htaccess_password'].'@', 7, 0);
|
662 |
+
}
|
663 |
+
|
664 |
+
$encode_string = $nice.$options['app_path']."/".$options['video_app']." -y -i '".$input."' ".$ffmpeg_options.$rate_control_flag.$rotate." -threads ".$options['threads']." '".$output."'";
|
665 |
+
|
666 |
+
} //if FFMPEG is found
|
667 |
+
|
668 |
+
return $encode_string;
|
669 |
+
|
670 |
+
}
|
671 |
+
|
672 |
class kgvid_Process{
|
673 |
+
|
674 |
private $pid;
|
675 |
private $command;
|
676 |
|
681 |
}
|
682 |
}
|
683 |
private function runCom(){
|
684 |
+
$sys = strtoupper(PHP_OS); // Get OS Name
|
685 |
+
if(substr($sys,0,3) == "WIN") { $this->OS = "windows"; }
|
686 |
+
else { $this->OS = "linux"; }
|
687 |
+
|
688 |
+
$command = $this->command;
|
689 |
+
exec($command ,$op);
|
690 |
+
$this->output = $op;
|
691 |
+
if(substr($sys,0,3) != "WIN") { $this->pid = (int)$op[0]; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
692 |
}
|
693 |
|
694 |
public function setPid($pid){
|
721 |
|
722 |
function kgvid_video_embed_enqueue_scripts() {
|
723 |
$options = get_option('kgvid_video_embed_options');
|
724 |
+
|
725 |
if ( $options['embed_method'] == "Strobe Media Playback" ) {
|
726 |
wp_enqueue_script( 'swfobject' );
|
727 |
}
|
728 |
|
729 |
//Video.js script and skins
|
730 |
+
wp_enqueue_script( 'video-js', plugins_url("", __FILE__).'/video-js/video.js', '', '4.2.1' );
|
731 |
+
wp_enqueue_style( 'video-js-css', plugins_url("", __FILE__).'/video-js/video-js.css', '', '4.2.1' );
|
732 |
wp_enqueue_style( 'video-js-kg-skin', plugins_url("", __FILE__).'/video-js/kg-video-js-skin.css', '', $options['version'] );
|
733 |
|
734 |
//plugin-related frontend scripts and styles
|
740 |
add_action('wp_enqueue_scripts', 'kgvid_video_embed_enqueue_scripts', 12);
|
741 |
|
742 |
function enqueue_kgvid_script() { //loads plugin-related scripts in the admin area
|
743 |
+
$options = get_option('kgvid_video_embed_options');
|
744 |
+
|
745 |
+
wp_enqueue_script( 'video_embed_thumbnail_generator_script', plugins_url('/js/kgvid_video_plugin_admin.js', __FILE__), '', $options['version'] );
|
746 |
+
wp_enqueue_style( 'video_embed_thumbnail_generator_style', plugins_url('/css/video-embed-thumbnail-generator_admin.css', __FILE__), '', $options['version'] );
|
747 |
|
|
|
|
|
|
|
748 |
}
|
749 |
add_action('admin_enqueue_scripts', 'enqueue_kgvid_script');
|
750 |
|
751 |
+
function kgvid_admin_print_scripts() {
|
752 |
+
$screen = get_current_screen();
|
753 |
+
|
754 |
+
if ( $screen->base == "upload" ) {
|
755 |
+
echo '<script type="text/javascript">jQuery(document).ready(kgvid_media_library_icon_overlay());</script>'."\n";
|
756 |
+
}
|
757 |
+
|
758 |
+
}
|
759 |
+
add_action('admin_print_footer_scripts', 'kgvid_admin_print_scripts');
|
760 |
+
|
761 |
function kgvid_video_embed_print_scripts() {
|
762 |
|
763 |
+
global $wp_query;
|
764 |
+
global $wpdb;
|
765 |
+
$posts = $wp_query->posts;
|
766 |
+
$pattern = get_shortcode_regex();
|
767 |
+
$options = get_option('kgvid_video_embed_options');
|
768 |
+
|
769 |
+
echo '<script type="text/javascript">videojs.options.flash.swf = "'.plugins_url("", __FILE__).'/video-js/video-js.swf?4.2.1"</script>'."\n";
|
770 |
+
|
771 |
+
foreach ( $posts as $post ) {
|
772 |
+
if ( $options['open_graph'] == "on"
|
773 |
+
&& preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
|
774 |
+
&& array_key_exists( 2, $matches ) && array_key_exists( 5, $matches )
|
775 |
+
&& !empty($matches[5][0])
|
776 |
+
&& ( in_array( 'KGVID', $matches[2] ) || in_array( 'FMP', $matches[2] ) ) ) { //if KGVID or FMP shortcode is in posts on this page.
|
777 |
+
|
778 |
+
echo '<meta property="og:video" content="'.$matches[5][0].'" />'."\n";
|
779 |
+
|
780 |
+
if ( array_key_exists( 3, $matches ) ) {
|
781 |
+
$attributes = shortcode_parse_atts($matches[3][0]);
|
782 |
+
if ( is_array($attributes) && array_key_exists( 'width', $attributes ) ) {
|
783 |
+
echo '<meta property="og:video:width" content="'.$attributes['width'].'" />'."\n";
|
784 |
+
if ( array_key_exists( 'height', $attributes ) ) {
|
785 |
+
echo '<meta property="og:video:height" content="'.$attributes['height'].'" />'."\n";
|
786 |
+
}
|
787 |
+
}
|
788 |
+
}
|
789 |
+
break;
|
790 |
+
}
|
791 |
+
}
|
792 |
|
793 |
}
|
794 |
+
add_action('wp_head', 'kgvid_video_embed_print_scripts', 99);
|
795 |
|
796 |
+
function kgvid_shortcode_atts($atts) {
|
797 |
|
798 |
$options = get_option('kgvid_video_embed_options');
|
799 |
+
|
800 |
if ( in_the_loop() ) { $post_ID = get_the_ID(); }
|
801 |
else { $post_ID = 1; }
|
802 |
|
803 |
$query_atts = shortcode_atts(
|
804 |
+
array(
|
805 |
+
'id' => '',
|
806 |
+
'videos' => -1,
|
807 |
+
'width' => $options['width'],
|
808 |
+
'height' => $options['height'],
|
809 |
+
'align' => $options['align'],
|
810 |
+
'controlbar' => $options['controlbar_style'],
|
811 |
+
'autohide' => $options['autohide'],
|
812 |
+
'poster' => $options['poster'],
|
813 |
+
'watermark' => $options['watermark'],
|
814 |
+
'endofvideooverlay' => $options['endofvideooverlay'],
|
815 |
+
'endofvideooverlaysame' => $options['endofvideooverlaysame'],
|
816 |
+
'playbutton' => $options['playbutton'],
|
817 |
+
'loop' => $options['loop'],
|
818 |
+
'autoplay' => $options['autoplay'],
|
819 |
+
'streamtype' => $options['stream_type'],
|
820 |
+
'scalemode' => $options['scale_mode'],
|
821 |
+
'backgroundcolor' => $options['bgcolor'],
|
822 |
+
'configuration' => $options['configuration'],
|
823 |
+
'skin' => $options['skin'],
|
824 |
+
'gallery' => 'false',
|
825 |
+
'gallery_thumb' => $options['gallery_thumb'],
|
826 |
+
'gallery_orderby' => 'menu_order',
|
827 |
+
'gallery_order' => 'ASC',
|
828 |
+
'gallery_exclude' => '',
|
829 |
+
'gallery_include' => '',
|
830 |
+
'gallery_id' => $post_ID,
|
831 |
+
'volume' => '',
|
832 |
+
'title' => $options['overlay_title'],
|
833 |
+
'embedcode' => $options['overlay_embedcode'],
|
834 |
+
'view_count' => $options['view_count'],
|
835 |
+
'caption' => '',
|
836 |
+
'description' => '',
|
837 |
+
'inline' => $options['inline'],
|
838 |
+
'downloadlink' => 'false',
|
839 |
+
'right_click' => $options['right_click'],
|
840 |
+
'resize' => $options['resize']
|
841 |
+
), $atts);
|
842 |
+
|
843 |
+
$checkbox_convert = array ( "autohide", "endofvideooverlaysame", "playbutton", "loop", "autoplay", "title", "embedcode", "view_count", "inline", "resize");
|
844 |
foreach ( $checkbox_convert as $query ) {
|
845 |
if ( $query_atts[$query] == "on" ) { $query_atts[$query] = "true"; }
|
846 |
if ( $query_atts[$query] == false ) { $query_atts[$query] = "false"; }
|
847 |
}
|
848 |
+
|
849 |
if ( $options['js_skin'] == "" ) { $options['js_skin'] = "vjs-default-skin"; }
|
850 |
if ( is_array($atts) ) {
|
851 |
if ( array_key_exists('skin', $atts) ) { $options['js_skin'] = $atts['skin']; } //allows user to set skin for individual videos using the skin="" attribute
|
852 |
}
|
853 |
|
854 |
+
return $query_atts;
|
|
|
|
|
|
|
|
|
855 |
|
856 |
+
}
|
857 |
+
|
858 |
+
function KGVID_shortcode($atts, $content = ''){
|
859 |
+
|
860 |
+
$options = get_option('kgvid_video_embed_options');
|
861 |
+
if ( in_the_loop() ) { $post_ID = get_the_ID(); }
|
862 |
+
else { $post_ID = 1; }
|
863 |
+
$code = "";
|
864 |
+
|
865 |
+
$query_atts = kgvid_shortcode_atts($atts);
|
866 |
+
|
867 |
+
if ( $query_atts["gallery"] != "true" ) { //if this is not a pop-up gallery
|
868 |
+
|
869 |
+
if ( empty($content) ) {
|
870 |
+
if ( !empty($query_atts["id"]) ) {
|
871 |
+
$id_array[0] = $query_atts["id"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
}
|
873 |
+
elseif ( $post_ID != 1 ) {
|
874 |
+
$args = array(
|
875 |
+
'numberposts' => $query_atts['videos'],
|
876 |
+
'post_mime_type' => 'video',
|
877 |
+
'post_parent' => $post_ID,
|
878 |
+
'post_status' => null,
|
879 |
+
'post_type' => 'attachment',
|
880 |
+
);
|
881 |
+
$video_attachments = get_posts($args);
|
882 |
+
if ( $video_attachments ) {
|
883 |
+
foreach ( $video_attachments as $video ) {
|
884 |
+
$id_array[] = $video->ID;
|
885 |
+
}
|
886 |
+
}
|
887 |
+
else { return; } //if there are no video children of the current post
|
888 |
}
|
889 |
+
else { return; } //if there's no post ID and no $content
|
|
|
|
|
|
|
|
|
890 |
}
|
891 |
+
else { // $content is a URL
|
892 |
+
// workaround for relative video URL (contributed by Lee Fernandes)
|
893 |
+
if(substr($content, 0, 1) == '/') $content = get_bloginfo('url').$content;
|
894 |
+
$content = trim($content);
|
895 |
+
$guid_convert = substr(str_replace(' ', '', $content), 12 );
|
896 |
+
global $wpdb;
|
897 |
+
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid LIKE '%{$guid_convert}'"; //GUID seems to be the only way to get a video URL
|
898 |
+
$id_array[0] = $wpdb->get_var($query);
|
899 |
+
}
|
900 |
+
|
901 |
+
$original_content = $content;
|
902 |
+
|
903 |
+
foreach ( $id_array as $id ) { //loop through videos
|
904 |
+
|
905 |
+
$query_atts = kgvid_shortcode_atts($atts); //reset values so they can be different with multiple videos
|
906 |
+
$content = $original_content;
|
907 |
+
$sources = array();
|
908 |
+
|
909 |
+
$moviefiletype = pathinfo($content, PATHINFO_EXTENSION);
|
910 |
+
if ( $moviefiletype == "mov" || $moviefiletype == "m4v" ) { $moviefiletype = "mp4"; }
|
911 |
+
$video_formats = array(
|
912 |
+
"original" => $moviefiletype,
|
913 |
+
"1080" => "mp4",
|
914 |
+
"720" => "mp4",
|
915 |
+
"mobile" => "mp4",
|
916 |
+
"webm" => "webm",
|
917 |
+
"ogg" => "ogg"
|
918 |
+
);
|
919 |
+
$compatible = array("flv", "f4v", "mp4", "mov", "m4v", "ogv", "ogg", "webm");
|
920 |
+
$flashcompatible = array("flv", "f4v", "mp4", "mov", "m4v");
|
921 |
+
$h264compatible = array("mp4", "mov", "m4v");
|
922 |
+
|
923 |
+
if ( !empty($id) ) { //if the video is an attachment in the WordPress db
|
924 |
+
|
925 |
+
if ( empty($content) ) {
|
926 |
+
$content = wp_get_attachment_url($id);
|
927 |
+
if ( $content == false ) { echo "Invalid video ID"; continue; }
|
928 |
}
|
929 |
+
|
930 |
+
$div_suffix = $id;
|
931 |
+
$encodevideo_info = kgvid_encodevideo_info($content, $id);
|
932 |
+
$attachment_info = get_post( $id );
|
933 |
+
|
934 |
+
$video_meta = "";
|
935 |
+
$moviefile = get_attached_file($id);
|
936 |
+
|
937 |
+
if ( function_exists('wp_read_video_metadata') ) { $video_meta = wp_read_video_metadata($moviefile); }
|
938 |
+
|
939 |
+
if ( $video_meta && array_key_exists('width', $video_meta) ) { $widthset = $video_meta['width']; }
|
940 |
+
else { $widthset = get_post_meta($id, "_kgflashmediaplayer-actualwidth", true); }
|
941 |
+
|
942 |
+
if ( $video_meta && array_key_exists('height', $video_meta) ) { $heightset = $video_meta['height']; }
|
943 |
+
else { $heightset = get_post_meta($id, "_kgflashmediaplayer-actualheight", true); }
|
944 |
+
|
945 |
+
if ( !empty($widthset) && !empty($heightset) ) {
|
946 |
+
$aspect_ratio = $heightset/$widthset;
|
947 |
+
$query_atts['height'] = round($query_atts['width']*$aspect_ratio);
|
948 |
+
}
|
949 |
+
|
950 |
+
$poster_id = get_post_meta($id, '_kgflashmediaplayer-poster-id', true);
|
951 |
+
if ( !empty($poster_id) ) {
|
952 |
+
$poster_image_src = wp_get_attachment_image_src($poster_id, 'full');
|
953 |
+
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
|
954 |
+
if ( $poster_image_src[0] == $query_atts['poster'] && intval($query_atts['width']) <= get_option('medium_size_h') ) {
|
955 |
+
$query_atts['poster'] = kgvid_get_attachment_medium_url($poster_id);
|
956 |
}
|
957 |
}
|
958 |
+
|
959 |
+
if ( $query_atts['title'] == "true" ) {
|
960 |
+
$query_atts['title'] = $attachment_info->post_title;
|
961 |
+
$stats_title = $query_atts['title'];
|
962 |
+
}
|
963 |
+
else { $stats_title = $attachment_info->post_title; }
|
964 |
+
if ( empty($query_atts['caption']) ) { $query_atts['caption'] = $attachment_info->post_excerpt; }
|
965 |
+
if ( empty($query_atts['description']) ) { $query_atts['description'] = $attachment_info->post_content; }
|
966 |
+
|
967 |
+
$countable = true;
|
968 |
+
}
|
969 |
+
else { //video is not in the database
|
970 |
+
$div_suffix = substr(uniqid(rand(), true),0,4);
|
971 |
+
$encodevideo_info = kgvid_encodevideo_info($content, $post_ID); //send the id of the post the video's embedded in
|
972 |
+
if ( $query_atts['title'] == "true" ) {
|
973 |
+
$query_atts['title'] = "false";
|
974 |
+
}
|
975 |
+
$stats_title = basename($content);
|
976 |
+
if ( $query_atts['embedcode'] == "true" ) {
|
977 |
+
$query_atts['embedcode'] = "false"; //can't use embed code with videos that are not in the database
|
978 |
+
}
|
979 |
+
|
980 |
+
$countable = false;
|
981 |
+
}
|
982 |
+
|
983 |
+
if ( in_array($moviefiletype, $compatible) ) {
|
984 |
+
$encodevideo_info["original_exists"] = true;
|
985 |
+
$encodevideo_info["originalurl"] = $content;
|
986 |
}
|
987 |
+
else { $encodevideo_info["original_exists"] = false; }
|
988 |
+
|
989 |
+
if($query_atts["endofvideooverlaysame"] == "true") { $query_atts["endofvideooverlay"] = $query_atts["poster"]; }
|
990 |
+
|
991 |
+
/* if ( $query_atts['video_security'] == "on" && !empty($id) ) {
|
992 |
+
|
993 |
+
$token = bin2hex(openssl_random_pseudo_bytes(32));
|
994 |
+
foreach ($video_formats as $name => $type) {
|
995 |
+
if ( $encodevideo_info[$name."_exists"] ) {
|
996 |
+
$encodevideo_info[$name.'url'] = site_url('/')."?kgvid_video_embed[id]=".$id."&kgvid_video_embed[format]=".$name."&kgvid_video_embed[token]=".$token;
|
997 |
+
}
|
998 |
+
}
|
999 |
+
} */
|
1000 |
+
|
1001 |
+
if ( $options['embed_method'] == "Strobe Media Playback" ) {
|
1002 |
+
|
1003 |
+
$video_swf = plugins_url('', __FILE__)."/flash/StrobeMediaPlayback.swf";
|
1004 |
+
$minimum_flash = "10.1.0";
|
1005 |
+
|
1006 |
+
if ( in_array($moviefiletype, $flashcompatible) ) { //if the original video is Flash video player compatible
|
1007 |
+
$flashvars = "{src:'".urlencode($content)."'";
|
1008 |
+
$flash_source_found = true;
|
1009 |
+
}
|
1010 |
+
else {
|
1011 |
+
$flash_source_found = false;
|
1012 |
+
foreach ($video_formats as $name => $type) { //check if there's an H.264 format available and pick the highest quality one
|
1013 |
+
if ( $encodevideo_info[$name."_exists"] && $type == "mp4" ) {
|
1014 |
+
$flashvars = "{src:'".urlencode(trim($encodevideo_info[$name.'url']))."'";
|
1015 |
+
$flash_source_found = true;
|
1016 |
+
break;
|
1017 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1018 |
}
|
|
|
1019 |
}
|
1020 |
+
if ( $flash_source_found ) {
|
1021 |
+
if($query_atts["poster"] != '') { $flashvars .= ", poster:'".urlencode(trim($query_atts["poster"]))."'"; }
|
1022 |
+
if($query_atts["endofvideooverlay"] != '') { $flashvars .= ", endofvideooverlay:'".urlencode(trim($query_atts["endofvideooverlay"]))."'"; }
|
1023 |
+
if($query_atts["controlbar"] != '') { $flashvars .= ", controlBarMode:'".$query_atts["controlbar"]."'"; }
|
1024 |
+
if($query_atts["autohide"] != '') { $flashvars .= ", controlBarAutoHide:'".$query_atts["autohide"]."'"; }
|
1025 |
+
if($query_atts["playbutton"] != '') { $flashvars .= ", playButtonOverlay:'".$query_atts["playbutton"]."'"; }
|
1026 |
+
if($query_atts["loop"] != '') { $flashvars .= ", loop:'".$query_atts["loop"]."'"; }
|
1027 |
+
if($query_atts["autoplay"] != '') { $flashvars .= ", autoPlay:'".$query_atts["autoplay"]."'"; }
|
1028 |
+
if($query_atts["streamtype"] != '') { $flashvars .= ", streamType:'".$query_atts["streamtype"]."'"; }
|
1029 |
+
if($query_atts["scalemode"] != '') { $flashvars .= ", scaleMode:'".$query_atts["scalemode"]."'"; }
|
1030 |
+
if($query_atts["backgroundcolor"] != '') { $flashvars .= ", backgroundColor:'".$query_atts["backgroundcolor"]."'"; }
|
1031 |
+
if($query_atts["configuration"] != '') { $flashvars .= ", configuration:'".urlencode($query_atts["configuration"])."'"; }
|
1032 |
+
if($query_atts["skin"] != '') { $flashvars .= ", skin:'".urlencode($query_atts["skin"])."'"; }
|
1033 |
+
$flashvars .= ", verbose:'true', javascriptCallbackFunction:'function(id){kgvid_strobemedia_callback(".$div_suffix.");}'"; //this is necessary to turn on the js API
|
1034 |
+
$flashvars .= "}";
|
1035 |
+
$params = "{wmode:'opaque', allowfullscreen:'true', allowScriptAccess:'always', base:'".plugins_url("", __FILE__)."/flash/'}";
|
1036 |
+
}
|
1037 |
+
} //if Strobe Media Playback
|
1038 |
+
|
1039 |
+
if ( $query_atts['align'] != "left" || $query_atts['inline'] == "true" ) {
|
1040 |
+
$aligncode = ' style="';
|
1041 |
+
if ( $query_atts['align'] != "left" ) { $aligncode .= 'margin-left:auto; '; }
|
1042 |
+
if ( $query_atts['align'] == "center" ) { $aligncode .= ' margin-right:auto;'; }
|
1043 |
+
if ( $query_atts['inline'] == "true" ) { $aligncode .= 'display:inline-block;'; }
|
1044 |
+
$aligncode .= '" ';
|
1045 |
}
|
1046 |
+
else { $aligncode = ""; }
|
1047 |
+
|
1048 |
+
$code .= '<div id="kgvid_'.$div_suffix.'_wrapper" class="kgvid_wrapper"'.$aligncode.'>';
|
1049 |
+
$code .= '<div id="video_'.$div_suffix.'_div" class="kgvid_videodiv" itemscope itemtype="http://schema.org/VideoObject">';
|
1050 |
+
if ( $query_atts["poster"] != '' ) { $code .= '<meta itemprop="thumbnailURL" content="'.$query_atts["poster"].'" />'; }
|
1051 |
+
if ( !empty($id) ) { $schema_embedURL = site_url('/')."?attachment_id=".$id."&kgvid_video_embed[enable]=true"; }
|
1052 |
+
else { $schema_embedURL = $content; }
|
1053 |
+
$code .= '<meta itemprop="embedURL" content="'.$schema_embedURL.'" />';
|
1054 |
+
|
1055 |
+
if ( !empty($query_atts['title']) ) { $code .= '<meta itemprop="name" content="'.$query_atts['title'].'" />'; }
|
1056 |
+
if ( !empty($query_atts['description']) ) { $description = $query_atts['description']; }
|
1057 |
+
elseif ( !empty($query_atts['caption']) ) { $description = $query_atts['caption']; }
|
1058 |
+
else { $description = ""; }
|
1059 |
+
if ( !empty($description) ) { $code .= '<meta itemprop="description" content="'.esc_attr($description).'" />'; }
|
1060 |
+
|
1061 |
+
if ( $options['embed_method'] == "WordPress Default" ) {
|
1062 |
+
$wp_shortcode = "[video ";
|
1063 |
+
$mp4already = false;
|
1064 |
+
$sources_hack = "";
|
1065 |
+
foreach ($video_formats as $name => $type) {
|
1066 |
+
if ( $name != "original" && $encodevideo_info[$name."url"] == $content ) { unset($sources['original']); }
|
1067 |
+
if ( $encodevideo_info[$name."_exists"] ) {
|
1068 |
+
if ( $type != "mp4" || !$mp4already ) {
|
1069 |
+
$shortcode_type = $type;
|
1070 |
+
if ( $type == "ogg" ) { $shortcode_type = "ogv"; } //the shortcode requires ogv but MIME is still video/ogg
|
1071 |
+
$sources[$name] = $shortcode_type.'="'.$encodevideo_info[$name."url"].'" ';
|
1072 |
+
if ( $type == "mp4" ) { //WordPress built-in shortcode doesn't support multiple videos of the same type but we'll hack it in later
|
1073 |
+
$search_string = '<source type="video/mp4" src="'.$encodevideo_info[$name."url"].'" />';
|
1074 |
+
$mp4already = true;
|
1075 |
+
}
|
1076 |
+
}
|
1077 |
+
else { $sources_hack .= '<source type="video/'.$type.'" src="'.$encodevideo_info[$name."url"].'" />'; }
|
1078 |
+
}
|
1079 |
+
}
|
1080 |
|
1081 |
+
$wp_shortcode .= implode($sources);
|
1082 |
+
if ( $query_atts["poster"] != '' ) { $wp_shortcode .= 'poster="'.$query_atts["poster"].'" '; }
|
1083 |
+
$wp_shortcode .= 'width='.$query_atts["width"].' height='.$query_atts["height"].' ';
|
1084 |
+
if ( $query_atts["loop"] == 'true') { $wp_shortcode .= 'loop="true" '; }
|
1085 |
+
if ( $query_atts["autoplay"] == 'true') { $wp_shortcode .= 'autoplay="true" '; }
|
1086 |
+
$wp_shortcode .= "]";
|
1087 |
+
$executed_shortcode = do_shortcode($wp_shortcode);
|
1088 |
+
if ( $sources_hack ) { //insert remaining mp4 sources manually
|
1089 |
+
$position = strpos($executed_shortcode, $search_string) + strlen($search_string);
|
1090 |
+
$executed_shortcode = substr_replace( $executed_shortcode, $sources_hack, $position, 0 );
|
1091 |
+
}
|
1092 |
+
$code .= $executed_shortcode;
|
1093 |
}
|
1094 |
+
|
1095 |
+
else { //if it's not the WordPress default player
|
1096 |
+
|
1097 |
+
foreach ($video_formats as $name => $type) {
|
1098 |
+
if ( $name != "original" && $encodevideo_info[$name."url"] == $content ) { unset($sources['original']); }
|
1099 |
+
if ( $encodevideo_info[$name."_exists"] ) { $sources[$name] = '<source src="'.$encodevideo_info[$name."url"].'" type="video/'.$type.'">'; }
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
$code .= '<video id="video_'.$div_suffix.'" ';
|
1103 |
+
if ( $query_atts["loop"] == 'true') { $code .= 'loop '; }
|
1104 |
+
if ( $query_atts["autoplay"] == 'true') { $code .= 'autoplay '; }
|
1105 |
+
if ( $query_atts["controlbar"] != 'none') { $code .= 'controls '; }
|
1106 |
+
$code .= 'preload="metadata" ';
|
1107 |
+
if ( $query_atts["poster"] != '' ) { $code .= 'poster="'.$query_atts["poster"].'" '; }
|
1108 |
+
$code .= 'width="'.$query_atts["width"].'" height="'.$query_atts["height"].'"';
|
1109 |
+
$code .= ' class="video-js '.$options['js_skin'].'" data-setup=\'{}\'';
|
1110 |
+
$code .= ">\n";
|
1111 |
+
|
1112 |
+
$code .= implode("\n", $sources); //add the <source> tags created earlier
|
1113 |
+
|
1114 |
+
$code .= "</video>\n";
|
1115 |
+
|
1116 |
}
|
1117 |
$code .= "</div>";
|
1118 |
+
$show_views = false;
|
1119 |
+
if ( !empty($id) || !empty($query_atts['caption']) || $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { //generate content below the video
|
1120 |
+
$view_count = number_format(intval(get_post_meta($id, "_kgflashmediaplayer-starts", true)));
|
1121 |
+
if ( empty($view_count) ) { $view_count = "0"; }
|
1122 |
+
if ( $content == plugins_url('/images/sample-video-h264.mp4', __FILE__) ) { $view_count = "XX"; }
|
1123 |
+
if ( $query_atts['view_count'] == "true" ) { $show_views = true; }
|
1124 |
+
if ( !empty($query_atts['caption']) || $show_views || $query_atts['downloadlink'] == "true" ) {
|
1125 |
+
$code .= '<div class="kgvid_below_video" id="video_'.$div_suffix.'_below">';
|
1126 |
+
if ( $show_views ) { $code .= '<div class="kgvid-viewcount" id="video_'.$div_suffix.'_viewcount">'.$view_count.' views</div>'; }
|
1127 |
+
if ( !empty($query_atts['caption']) || $query_atts['downloadlink'] == "true" ) {
|
1128 |
+
$code .= '<div class="kgvid-caption" id="video_'.$div_suffix.'_caption">'.$query_atts['caption'];
|
1129 |
+
if ( $query_atts['downloadlink'] == "true" ) {
|
1130 |
+
if ( !empty($query_atts['caption']) ) { $code .= '<br>'; }
|
1131 |
+
$code .= '<a href="'.$content.'">Right-click or ctrl-click on this link to download.</a>';
|
1132 |
+
}
|
1133 |
+
$code .= '</div>';
|
1134 |
+
}
|
1135 |
+
$code .= '</div>';
|
1136 |
+
}
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
if ( $query_atts['title'] != "false" || $query_atts['embedcode'] != "false" ) { //generate content overlaid on video
|
1140 |
+
$kgvid_meta = true;
|
1141 |
+
$code .= "<div style=\"display:none;\" id=\"video_".$div_suffix."_meta\" class=\"kgvid_video_meta kgvid_video_meta_hover\">";
|
1142 |
+
if ( $query_atts['embedcode'] != "false" ) {
|
1143 |
+
if ( $query_atts['embedcode'] == "true" ) { $iframeurl = site_url('/')."?attachment_id=".$id."&kgvid_video_embed[enable]=true"; }
|
1144 |
+
else { $iframeurl = $query_atts['embedcode']; }
|
1145 |
+
$iframecode = "<iframe src='".$iframeurl."' frameborder='0' scrolling='no' width='".$query_atts['width']."' height='".$query_atts["height"]."'></iframe>";
|
1146 |
+
$code .= "<div id=\"video_".$div_suffix."_embed\" class=\"kgvid_share\"><span>Embed: </span><input type=\"text\" value=\"".$iframecode."\" onClick=\"this.select();\"></div>";
|
1147 |
+
}
|
1148 |
+
if ( $query_atts['title'] != "false" ) {
|
1149 |
+
$code .= "<div id='video_".$div_suffix."_title' class='kgvid_title'>".$query_atts['title']."</div>";
|
1150 |
+
}
|
1151 |
+
$code .= "</div>";
|
1152 |
+
}
|
1153 |
+
else { $kgvid_meta = false; }
|
1154 |
+
if ( !empty($query_atts["watermark"]) && $query_atts["watermark"] != "false" ) { $code .= "<div style=\"display:none;\" id='video_".$div_suffix."_watermark' class='kgvid_watermark'><img src='".$query_atts["watermark"]."' alt='watermark'></div>"; } //generate watermark
|
1155 |
+
$code .= "</div>"; //end kgvid_XXXX_wrapper div
|
1156 |
+
|
1157 |
+
$video_variables = array(
|
1158 |
+
'id' => $div_suffix,
|
1159 |
+
'player_type' => $options['embed_method'],
|
1160 |
+
'width' => $query_atts['width'],
|
1161 |
+
'height' => $query_atts['height'],
|
1162 |
+
'countable' => $countable,
|
1163 |
+
'title' => esc_js($stats_title),
|
1164 |
+
'autoplay' => $query_atts['autoplay'],
|
1165 |
+
'set_volume' => $query_atts["volume"],
|
1166 |
+
'meta' => $kgvid_meta,
|
1167 |
+
'endofvideooverlay' => $query_atts['endofvideooverlay'],
|
1168 |
+
'resize' => $query_atts['resize']
|
1169 |
+
);
|
1170 |
+
$json_video_variables = json_encode( $video_variables );
|
1171 |
+
|
1172 |
+
$code .= "\n\t\t"."<script type='text/javascript'>
|
1173 |
+
kgvid_video_vars['".$div_suffix."'] = jQuery.parseJSON ( '".$json_video_variables."' );";
|
1174 |
+
if ( $options['embed_method'] == "Video.js" || ($options['embed_method'] == "Strobe Media Playback" && !$flash_source_found) ) {
|
1175 |
+
$code .= "\n\t\t\t"."if(typeof(jQuery)=='function'){(function($){\$.fn.fitVids=function(){}})(jQuery)};
|
1176 |
+
videojs('video_".$div_suffix."').ready(function(){ kgvid_setup_video('".$div_suffix."'); });";
|
1177 |
+
}
|
1178 |
+
if ( $options['embed_method'] == "Strobe Media Playback" && $flash_source_found ) {
|
1179 |
+
$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."); });";
|
1180 |
+
} //if Strobe Media
|
1181 |
+
else {
|
1182 |
+
$code .= "\n\t\t\t"."jQuery(document).ready(function(){ kgvid_setup_video('".$div_suffix."'); });";
|
1183 |
+
}
|
1184 |
+
|
1185 |
+
if ( $query_atts["right_click"] != "on" ) { $code .= "\n\t\t\t"."jQuery('#video_".$div_suffix."').bind('contextmenu',function() { return false; });"; }
|
1186 |
+
$code .= "\n\t\t"."</script>"."\n";
|
1187 |
+
|
1188 |
+
} //end id_array loop
|
1189 |
+
|
1190 |
} //if not gallery
|
1191 |
+
|
1192 |
else { //if gallery
|
1193 |
$thumbnail_aspect = false;
|
1194 |
+
$args = array(
|
1195 |
+
'post_type' => 'attachment',
|
1196 |
+
'orderby' => $query_atts['gallery_orderby'],
|
1197 |
+
'order' => $query_atts['gallery_order'],
|
1198 |
+
'post_mime_type' => 'video',
|
1199 |
+
'numberposts' => -1,
|
1200 |
+
'post_status' => null,
|
1201 |
+
'post_parent' => $query_atts['gallery_id'],
|
1202 |
+
'exclude' => $query_atts['gallery_exclude']
|
|
|
1203 |
);
|
1204 |
+
if ( !empty($query_atts['gallery_include']) ) {
|
1205 |
$args['include'] = $query_atts['gallery_include'];
|
1206 |
unset($args['post_parent']);
|
1207 |
}
|
1208 |
$attachments = get_posts($args);
|
1209 |
if ($attachments) {
|
1210 |
+
|
1211 |
$div_suffix = substr(uniqid(rand(), true),0,4);
|
1212 |
$code .= '<div class="kgvid_gallerywrapper">';
|
1213 |
foreach ( $attachments as $attachment ) {
|
1216 |
if ( !empty($poster_id) && intval($query_atts['gallery_thumb']) <= get_option('medium_size_h') ) {
|
1217 |
$poster_post = get_post($poster_id);
|
1218 |
if ( $poster_post->guid == $thumbnail_url ) {
|
1219 |
+
$thumbnail_url = kgvid_get_attachment_medium_url($poster_id);
|
1220 |
$thumbnail_info = wp_get_attachment_image_src($poster_id);
|
1221 |
$thumbnail_aspect = round($thumbnail_info[2]/$thumbnail_info[1], 4); //height/width
|
1222 |
} //use the "medium" size image if available
|
1223 |
}
|
1224 |
if (!$thumbnail_url) { $thumbnail_url = $options['poster']; } //use the default poster if no thumbnail set
|
1225 |
if (!$thumbnail_url) { $thumbnail_url = plugins_url('/images/nothumbnail.jpg', __FILE__);} //use the blank image if no other option
|
1226 |
+
|
1227 |
$video_width = get_post_meta($attachment->ID, "_kgflashmediaplayer-actualwidth", true);
|
1228 |
if ( !$video_width ) { $video_width = get_post_meta($attachment->ID, "_kgflashmediaplayer-width", true); }
|
1229 |
if ( !$video_width || $video_width > intval($options['gallery_width']) ) { $video_width = $options['gallery_width']; }
|
1230 |
+
|
1231 |
$video_height = get_post_meta($attachment->ID, "_kgflashmediaplayer-actualheight", true);
|
1232 |
if ( !$video_height ) { $video_height = get_post_meta($attachment->ID, "_kgflashmediaplayer-height", true); }
|
1233 |
if ( !$video_height || $video_height > intval($options['gallery_height']) ) { $video_height = $options['gallery_height']; }
|
1234 |
+
|
1235 |
if ( !$thumbnail_aspect ) { $thumbnail_aspect = round($video_height/$video_width, 4); } //if the thumbnail's not an attachment, set the aspect ratio to the video's
|
1236 |
+
|
1237 |
$play_scale = strval( round(intval($query_atts["gallery_thumb"])/600,2) );
|
1238 |
+
|
1239 |
$downloadlink = get_post_meta($attachment->ID, "_kgflashmediaplayer-downloadlink", true);
|
1240 |
if ( empty($query_atts['caption']) ) { $query_atts['caption'] = $attachment->post_excerpt; }
|
1241 |
$below_video = 0;
|
1242 |
if ( !empty($query_atts['caption']) ) { $below_video = 1; }
|
1243 |
if ( $downloadlink == "checked" ) { ++$below_video; }
|
1244 |
+
|
1245 |
+
$code .= '<div onclick="kgvid_SetVideo(\''.$div_suffix.'\', \''.site_url('/').'\', \''.$attachment->ID.'\', \''.$video_width.'\', \''.$video_height.'\', '.$below_video.');return false;" class="kgvid_video_gallery_thumb" style="width:'.$query_atts["gallery_thumb"].'px"><img src="'.$thumbnail_url.'" alt="'.$attachment->post_title.'"><div class="'.$options['js_skin'].'" ><div class="vjs-big-play-button" style="-webkit-transform: scale('.$play_scale.') translateY(-30px); -o-transform: scale('.$play_scale.') translateY(-30px); -ms-transform: scale('.$play_scale.') translateY(-30px); transform: scale('.$play_scale.') translateY(-30px);"><span></span></div></div><div class="titlebackground"><div class="videotitle">'.$attachment->post_title.'</div></div></div>'."\n\t\t\t";
|
1246 |
}
|
1247 |
+
|
1248 |
$code .= '</div>'; //end wrapper div
|
1249 |
$code .= '<div id="kgvid_GalleryPlayerDiv_'.$div_suffix.'"></div>';
|
1250 |
+
$code .= '<script type="text/javascript">jQuery(document).ready(function() {
|
1251 |
+
jQuery(\'#kgvid_GalleryPlayerDiv_'.$div_suffix.'\').dialog({
|
1252 |
+
zIndex: 1000,
|
1253 |
+
autoOpen: false,
|
1254 |
+
modal: true,
|
1255 |
+
resizable: false,
|
1256 |
dialogClass: \'notitle\',
|
1257 |
create: function(event, ui){
|
1258 |
jQuery(\'.ui-dialog\').wrap(\'<div class="kgvid_gallery" />\');
|
1266 |
if (jQuery(this).text() == "") { return true; }
|
1267 |
return false;
|
1268 |
}).remove();
|
1269 |
+
}
|
1270 |
+
});
|
1271 |
+
}); </script>';
|
1272 |
+
|
1273 |
} //if there are attachments
|
1274 |
} //if gallery
|
1275 |
return $code;
|
1282 |
global $wpdb;
|
1283 |
|
1284 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
1285 |
+
|
1286 |
$movieurl = $_POST['movieurl'];
|
1287 |
$post_id = $_POST['post_id'];
|
1288 |
$page = $_POST['page'];
|
1289 |
+
|
1290 |
+
if (isset($_POST['encodeformats'])) {
|
1291 |
$encode_checked = $_POST['encodeformats'];
|
1292 |
foreach ( $encode_checked as $format => $checked ) {
|
1293 |
if ( $checked == "true" ) { update_post_meta($post_id, '_kgflashmediaplayer-encode'.$format, 'on'); }
|
1294 |
else { update_post_meta($post_id, '_kgflashmediaplayer-encode'.$format, 'notchecked'); }
|
1295 |
}
|
1296 |
+
}
|
1297 |
|
1298 |
$checkboxes = kgvid_generate_encode_checkboxes($movieurl, $post_id, $page);
|
1299 |
$arr = array("embed_display" => $checkboxes);
|
1300 |
echo json_encode($arr);
|
1301 |
die();
|
1302 |
+
|
1303 |
}
|
1304 |
add_action('wp_ajax_kgvid_generate_encode_checkboxes', 'kgvid_ajax_generate_encode_checkboxes');
|
1305 |
|
1306 |
function kgvid_generate_encode_checkboxes($movieurl, $post_id, $page) {
|
1307 |
+
|
1308 |
$options = get_option('kgvid_video_embed_options');
|
1309 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
1310 |
$video_formats = kgvid_video_formats();
|
1311 |
+
|
1312 |
$video_queued = false;
|
1313 |
$something_to_encode = false;
|
1314 |
$encoding_now = false;
|
1318 |
$actualheight = "1081";
|
1319 |
$rotated = false;
|
1320 |
$encodevideo_info = array();
|
1321 |
+
|
1322 |
if ( !empty($movieurl) ) {
|
1323 |
+
|
1324 |
$encodevideo_info = kgvid_encodevideo_info($movieurl, $post_id);
|
1325 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
1326 |
$movieurl = $sanitized_url['movieurl'];
|
1331 |
$rotated = get_post_meta($post_id, "_kgflashmediaplayer-rotate", true);
|
1332 |
}
|
1333 |
else { //video's not in the database
|
1334 |
+
|
1335 |
+
unset($video_formats['fullres']);
|
1336 |
+
|
1337 |
$post_mime_type = "video/".pathinfo($movieurl, PATHINFO_EXTENSION);
|
1338 |
|
1339 |
if ( !empty($video_embed_queue) ) {
|
1340 |
foreach ($video_embed_queue as $video_key => $video_entry) {
|
1341 |
+
if ( $video_entry['movieurl'] == $movieurl ) {
|
1342 |
if ( array_key_exists('movie_info', $video_entry) ) {
|
1343 |
$actualwidth = $video_entry['movie_info']['width'];
|
1344 |
$actualheight = $video_entry['movie_info']['height'];
|
1349 |
}
|
1350 |
}
|
1351 |
reset($video_embed_queue);
|
1352 |
+
|
1353 |
if ( $page == "queue" ) {
|
1354 |
+
//$info = pathinfo($movieurl);
|
1355 |
//$post_id = 'singleurl_'.sanitize_title_with_dashes(urldecode(basename($movieurl,'.'.$info['extension'])));
|
1356 |
}
|
1357 |
}
|
1359 |
}
|
1360 |
else {
|
1361 |
$encode_disabled = ' disabled title="Please enter a valid video URL"';
|
1362 |
+
unset($video_formats['fullres']);
|
1363 |
}
|
1364 |
+
|
1365 |
+
if ( $options['ffmpeg_exists'] == "notinstalled" ) {
|
1366 |
+
$ffmpeg_disabled_text = 'disabled="disabled" title="'.strtoupper($options['video_app']).' not found at '.$options['app_path'].'"';
|
1367 |
}
|
1368 |
else { $ffmpeg_disabled_text = ""; }
|
1369 |
+
|
1370 |
$video_key = false;
|
|
|
1371 |
if ( !empty($video_embed_queue) && !empty($movieurl) ) {
|
1372 |
foreach ($video_embed_queue as $video_key => $video_entry) {
|
1373 |
+
if ( $video_entry['movieurl'] == $movieurl ) {
|
1374 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
1375 |
$video_formats[$format]['status'] = $value['status'];
|
|
|
|
|
|
|
1376 |
}
|
1377 |
$video_queued = true;
|
1378 |
break;
|
1379 |
}
|
1380 |
}
|
1381 |
}
|
1382 |
+
|
|
|
|
|
1383 |
$checkboxes = '<div id="attachments-'.$post_id.'-kgflashmediaplayer-encodeboxes">';
|
1384 |
foreach ( $video_formats as $format => $format_stats ) {
|
1385 |
if ( strpos($post_mime_type, $format) !== false ) { continue; } //skip webm or ogv checkbox if the video is webm or ogv
|
1392 |
if ( !array_key_exists('status', $format_stats) ) { $format_stats['status'] = "notchecked"; } //if this video isn't in the queue
|
1393 |
|
1394 |
if ( get_post_type($post_id) == "attachment" ) { $encodeset[$format] = get_post_meta($post_id, "_kgflashmediaplayer-encode".$format, true); }
|
1395 |
+
if ( $encodeset[$format] == "" ) { $encodeset[$format] = $options['encode_'.$format]; }
|
1396 |
+
|
1397 |
+
if ( $format_stats['status'] == "lowres" ||
|
1398 |
+
(
|
1399 |
+
$actualheight != "" && ($format == "1080" || $format == "720") &&
|
1400 |
+
(
|
1401 |
+
( strpos($post_mime_type, "mp4") !== false && $actualheight <= $format_stats['height'] ) ||
|
1402 |
+
( strpos($post_mime_type, "mp4") === false && $actualheight < $format_stats['height'] ) ||
|
1403 |
+
( $actualheight == $format_stats['height'] && $encodeset['fullres'] == "on" )
|
1404 |
+
)
|
1405 |
+
)
|
1406 |
+
) { continue; } //if the format is bigger than the original video, skip the checkbox
|
1407 |
|
1408 |
if ( $encodeset[$format] == "on" || $format_stats['status'] == "queued" ) { $checked[$format] = 'checked'; }
|
1409 |
|
1410 |
if ( $format_stats['status'] != "notchecked" ) { //File is in queue
|
1411 |
$meta[$format] = ' <strong>'.ucfirst($format_stats['status']).'</strong>';
|
1412 |
+
if ( $format_stats['status'] == "error" ) {
|
1413 |
$meta[$format] .= ': <span style="color:red;">'.$video_embed_queue[$video_key]['encode_formats'][$format]['lastline']."</span>";
|
1414 |
}
|
1415 |
+
}
|
1416 |
+
|
1417 |
if ( !empty($encodevideo_info) ) {
|
1418 |
if ( $encodevideo_info[$format.'_exists'] ) { //if the video file exists
|
1419 |
if ( $format_stats['status'] != "encoding" ) { // not currently encoding
|
1420 |
if ( $format_stats['status'] == "notchecked" ) { $meta[$format] = ' <strong>Encoded</strong>'; }
|
1421 |
if ( $format_stats['status'] != "canceling" ) {
|
1422 |
if ( array_key_exists($format.'id', $encodevideo_info) ) { $child_id[$format] = $encodevideo_info[$format.'id']; }
|
1423 |
+
if ( $encodevideo_info[$format.'_writable'] && current_user_can('encode_videos') ) { $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>'; }
|
1424 |
}
|
1425 |
$disabled[$format] = ' disabled title="Format already exists"';
|
1426 |
$checked[$format] = '';
|
1427 |
+
}
|
1428 |
}
|
1429 |
else { $something_to_encode = true; } //if the video file doesn't exist, there's something to encode
|
1430 |
}
|
1431 |
+
|
1432 |
if ( $format_stats['status'] == "encoding" ) {
|
1433 |
$encoding_now = true;
|
1434 |
$disabled[$format] = ' disabled title="Currently Encoding"';
|
1436 |
$progress = kgvid_encode_progress($video_key, $format, $page);
|
1437 |
$meta[$format] = $progress['embed_display'];
|
1438 |
}
|
1439 |
+
|
1440 |
if ( $format_stats['status'] == "Encoding Complete" ) {
|
1441 |
$disabled[$format] = ' disabled title="Format already exists"';
|
1442 |
$checked[$format] = '';
|
1443 |
}
|
1444 |
+
|
1445 |
if ( $checked[$format] == '' ) { $something_to_encode = true; }
|
1446 |
+
|
1447 |
+
if ( !current_user_can('encode_videos') ) {
|
1448 |
+
$disabled[$format] = ' disabled title="You don\'t have permission to encode videos"';
|
1449 |
+
$something_to_encode = false;
|
1450 |
+
}
|
1451 |
+
|
1452 |
$checkboxes .= "\n\t\t\t".'<input type="checkbox" id="attachments-'.$post_id.'-kgflashmediaplayer-encode'.$format.'" name="attachments['.$post_id.'][kgflashmediaplayer-encode'.$format.']" '.$checked[$format].' '.$ffmpeg_disabled_text.$disabled[$format].'> <label for="attachments-'.$post_id.'-kgflashmediaplayer-encode'.$format.'">'.$format_stats['name'].'</label> <span id="attachments-'.$post_id.'-kgflashmediaplayer-meta'.$format.'">'.$meta[$format].'</span><br />';
|
1453 |
|
1454 |
}
|
1455 |
if ( $something_to_encode == false ) {
|
1456 |
$encode_disabled = ' disabled title="Nothing to encode" style="display:none;"';
|
1457 |
}
|
1458 |
+
|
1459 |
+
if ( $page == "queue" ) {
|
1460 |
$button_text = "Update";
|
1461 |
$checkboxes .= "\n\t\t\t".'<input type="hidden" name="attachments['.$post_id.'][kgflashmediaplayer-url]" value="'.$movieurl.'">';
|
1462 |
}
|
1463 |
else { $button_text = "Encode"; }
|
1464 |
+
|
1465 |
+
|
1466 |
$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>';
|
1467 |
+
|
1468 |
+
if ( $page != "queue" ) {
|
1469 |
$checkboxes .= '<small><em>Generates additional video formats compatible with most mobile & HTML5-compatible browsers.</em></small>';
|
1470 |
}
|
1471 |
+
|
1472 |
+
|
1473 |
if ( $video_queued == true ) {
|
1474 |
while ( count($video_formats) > 0 ) {
|
1475 |
$last_format = array_pop( $video_formats );
|
1476 |
if ( $last_format['status'] != "notchecked" ) { break; } //get the final queued format
|
1477 |
}
|
1478 |
+
|
1479 |
if ( !$encoding_now && ($last_format['status'] == "queued" || $last_format['status'] == "canceling") ) {
|
1480 |
+
$checkboxes .= '<script type="text/javascript">percent_timeout = setTimeout(function(){ kgvid_redraw_encode_checkboxes("'.$video_entry['movieurl'].'", "'.$video_entry['attachmentID'].'", "'.$page.'") }, 5000); jQuery(\'#wpwrap\').data("KGVIDCheckboxTimeout", percent_timeout);</script>';
|
1481 |
}
|
1482 |
}
|
1483 |
$checkboxes .= '</div>'; //close encodeboxes div
|
1484 |
+
|
1485 |
return $checkboxes;
|
1486 |
}
|
1487 |
|
1490 |
$html = "";
|
1491 |
|
1492 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
|
|
1493 |
|
1494 |
if ( !empty($video_embed_queue) ) {
|
1495 |
+
|
1496 |
$video_formats = kgvid_video_formats();
|
1497 |
$currently_encoding = array();
|
1498 |
+
$queued = array();
|
1499 |
$nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
|
1500 |
$html .= "<input type='hidden' name='attachments[kgflashmediaplayer-security]' value='".$nonce."' />";
|
1501 |
+
|
1502 |
foreach ( $video_embed_queue as $order => $video_entry ) {
|
1503 |
$html .= "\t<tr id='tr_".$video_entry['attachmentID']."'";
|
1504 |
foreach ( $video_formats as $format => $format_stats ) {
|
1505 |
if ( $video_entry['encode_formats'][$format]['status'] == "encoding" ) {
|
1506 |
$currently_encoding[$order] = true;
|
|
|
1507 |
break;
|
1508 |
}
|
1509 |
+
else if ( $video_entry['encode_formats'][$format]['status'] == "queued" ) {
|
1510 |
+
$queued[$order] = true;
|
1511 |
+
}
|
1512 |
+
else {
|
1513 |
+
if ( !array_key_exists($order, $currently_encoding) ) { $currently_encoding[$order] = false; }
|
1514 |
+
if ( !array_key_exists($order, $queued) ) { $queued[$order] = false; }
|
1515 |
+
}
|
1516 |
}
|
1517 |
+
|
1518 |
+
if ( $currently_encoding[$order] ) { $html .= " class='currently_encoding' "; }
|
1519 |
+
elseif ( $queued[$order] ) { $html .= " class='kgvid_queued' "; }
|
1520 |
+
else { $html .= " class='kgvid_complete' "; }
|
1521 |
+
|
1522 |
$html .= ">";
|
1523 |
$html .= "<td id='td_".$video_entry['attachmentID']."'>".strval(intval($order)+1)."</td>\n";
|
1524 |
$thumbnail_url = get_post_meta($video_entry['attachmentID'], "_kgflashmediaplayer-poster", true);
|
1525 |
$thumbnail_html = "";
|
1526 |
+
if ($thumbnail_url != "" ) {
|
1527 |
+
$thumbnail_html = '<img width="100" src="'.$thumbnail_url.'">';
|
1528 |
}
|
1529 |
+
if ( get_post_type($video_entry['attachmentID']) == "attachment" ) {
|
1530 |
$moviefilepath = get_attached_file($video_entry['attachmentID']);
|
1531 |
$attachmentlink = "media.php?attachment_id=".$video_entry['attachmentID']."&action=edit";
|
1532 |
}
|
1533 |
+
else {
|
1534 |
+
$moviefilepath = $video_entry['movieurl'];
|
1535 |
$attachmentlink = $video_entry['movieurl'];
|
1536 |
}
|
1537 |
+
$html .= "\t\t\t\t\t<td><a href='".$attachmentlink."'> ".$thumbnail_html."</a></td>\n";
|
1538 |
+
$path_info = pathinfo($moviefilepath);
|
1539 |
+
$file_name = basename($moviefilepath,'.'.$path_info['extension']);
|
1540 |
+
$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";
|
1541 |
$html .= "\t\t\t\t\t<td class='queue_encode_formats' id='formats_".$video_entry['attachmentID']."'>";
|
1542 |
+
$html .= "<input type='hidden' id='attachments-".$video_entry['attachmentID']."-kgflashmediaplayer-security' name='attachments[".$video_entry['attachmentID']."][kgflashmediaplayer-security]' value='".$nonce."' />";
|
1543 |
$html .= kgvid_generate_encode_checkboxes($video_entry['movieurl'], $video_entry['attachmentID'], 'queue');
|
1544 |
$html .= "</td>\n";
|
1545 |
$html .= "\t\t\t\t\t<td>";
|
1546 |
+
$html .= "<a id='clear_".$video_entry['attachmentID']."' class='submitdelete' href='javascript:void(0)' onclick='kgvid_encode_queue(\"delete\", ".$order.", ".$video_entry['attachmentID'].")'";
|
1547 |
if ( $currently_encoding[$order] ) { $html .= " style='display:none;'"; }
|
1548 |
$html .= ">Clear</a>";
|
1549 |
+
$html .= "</td></tr>\n";
|
1550 |
}
|
1551 |
}
|
1552 |
else { $html = "\t<tr><td colspan='5'>Queue is Empty</td></tr>\n"; }
|
1558 |
function kgvid_add_FFMPEG_Queue_Page() {
|
1559 |
$options = get_option('kgvid_video_embed_options');
|
1560 |
if ( $options['ffmpeg_exists'] == "on" ) { //only add the queue page if FFMPEG is installed
|
1561 |
+
add_submenu_page('tools.php', 'Video Embed & Thumbnail Generator Encoding Queue', 'Video Encode Queue', 'encode_videos', 'kgvid_video_encoding_queue', 'kgvid_FFMPEG_Queue_Page');
|
1562 |
}
|
1563 |
}
|
1564 |
add_action('admin_menu', 'kgvid_add_FFMPEG_Queue_Page');
|
1565 |
|
1566 |
function kgvid_FFMPEG_Queue_Page() {
|
1567 |
+
|
1568 |
?>
|
1569 |
<div class="wrap">
|
1570 |
<div id="icon-tools" class="icon32"><br /></div>
|
1595 |
</table>
|
1596 |
<!-- <input type='button' class='button-secondary' value='sort' onclick='jQuery("#sortable tbody.rows").trigger("sortupdate"); jQuery( "#sortable tbody.rows" ).sortable("refresh");'> -->
|
1597 |
<p>
|
1598 |
+
<input id='clear_completed' type='button' class='button-secondary' value='Clear All Completed' onclick='kgvid_encode_queue("clear_completed", 0, 0);'>
|
|
|
1599 |
</p>
|
1600 |
</form>
|
1601 |
</div>
|
1602 |
<?php
|
1603 |
+
}
|
1604 |
|
1605 |
function kgvid_addFMPOptionsPage() {
|
1606 |
add_options_page('Video Embed & Thumbnail Generator', 'Video Embed & Thumbnail Generator', 'administrator', __FILE__, 'kgvid_FMPOptionsPage');
|
1608 |
add_action('admin_menu', 'kgvid_addFMPOptionsPage');
|
1609 |
|
1610 |
function kgvid_FMPOptionsPage() {
|
1611 |
+
wp_enqueue_media();
|
1612 |
$options = get_option('kgvid_video_embed_options');
|
1613 |
+
$video_app = $options['video_app'];
|
1614 |
+
if ( $video_app == "avconv" ) { $video_app = "libav"; }
|
1615 |
?>
|
1616 |
<div class="wrap">
|
1617 |
<div class="icon32" id="icon-options-general"><br></div>
|
1618 |
<h2>Video Embed & Thumbnail Generator</h2>
|
1619 |
+
<h2 class="nav-tab-wrapper">
|
1620 |
+
<a href="#" id="general_tab" class="nav-tab" onclick="kgvid_switch_settings_tab('general');">General</a>
|
1621 |
+
<a href="#" id="encoding_tab" class="nav-tab" onclick="kgvid_switch_settings_tab('encoding');"><span class='video_app_name'><?php echo strtoupper($video_app); ?></span> Settings</a>
|
1622 |
+
</h2>
|
1623 |
<form method="post" action="options.php">
|
1624 |
<?php settings_fields('kgvid_video_embed_options'); ?>
|
1625 |
<input type="hidden" id="kgvid_settings_security" value="<?php echo wp_create_nonce('video-embed-thumbnail-generator-nonce'); ?>">
|
1632 |
<?php echo "<script type='text/javascript'>
|
1633 |
jQuery(document).ready(function() {
|
1634 |
jQuery('#app_path').data('ffmpeg_exists', '".$options['ffmpeg_exists']."');
|
1635 |
+
kgvid_switch_settings_tab('general');
|
|
|
1636 |
jQuery('form :input').change(function() {
|
1637 |
kgvid_save_plugin_settings(this);
|
1638 |
});
|
1646 |
function kgvid_video_embed_options_init() {
|
1647 |
|
1648 |
register_setting('kgvid_video_embed_options', 'kgvid_video_embed_options', 'kgvid_video_embed_options_validate' );
|
1649 |
+
|
1650 |
$options = get_option('kgvid_video_embed_options');
|
1651 |
+
|
1652 |
add_settings_section('kgvid_video_embed_playback_settings', 'Default Video Playback Settings', 'kgvid_plugin_playback_settings_section_callback', __FILE__);
|
1653 |
add_settings_section('kgvid_video_embed_flash_settings', 'The following options will only affect Flash playback', 'kgvid_plugin_flash_settings_section_callback', __FILE__);
|
1654 |
add_settings_section('kgvid_video_embed_plugin_settings', 'Plugin Settings', 'kgvid_plugin_settings_section_callback', __FILE__);
|
1655 |
+
add_settings_section('kgvid_video_embed_encode_settings', 'Video Encoding Settings', 'kgvid_plugin_settings_section_callback', __FILE__);
|
1656 |
+
|
1657 |
add_settings_field('poster', 'Default thumbnail:', 'kgvid_poster_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'poster' ) );
|
1658 |
+
add_settings_field('endofvideooverlay', 'End of video image:', 'kgvid_endofvideooverlay_callback', __FILE__, 'kgvid_video_embed_playback_settings' );
|
1659 |
add_settings_field('watermark', 'Watermark image:', 'kgvid_watermark_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'watermark' ) );
|
1660 |
add_settings_field('align', 'Video alignment:', 'kgvid_align_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'align' ) );
|
1661 |
+
add_settings_field('resize', 'Automatically resize videos:', 'kgvid_resize_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'inline' ) );
|
1662 |
add_settings_field('inline', 'Inline videos:', 'kgvid_inline_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'inline' ) );
|
1663 |
add_settings_field('dimensions', 'Max embedded video dimensions:', 'kgvid_dimensions_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'width' ) );
|
1664 |
add_settings_field('gallery_dimensions', 'Max gallery video dimensions:', 'kgvid_gallery_dimensions_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'gallery_width' ) );
|
1667 |
add_settings_field('autoplay', 'Autoplay:', 'kgvid_autoplay_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'autoplay' ) );
|
1668 |
add_settings_field('loop', 'Loop:', 'kgvid_loop_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'loop' ) );
|
1669 |
add_settings_field('js_skin', 'Skin Class:', 'kgvid_js_skin_callback', __FILE__, 'kgvid_video_embed_playback_settings', array( 'label_for' => 'js_skin' ) );
|
1670 |
+
|
1671 |
add_settings_field('bgcolor', 'Background color:', 'kgvid_bgcolor_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'bgcolor' ) );
|
1672 |
add_settings_field('configuration', 'XML configuration file:', 'kgvid_configuration_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'configuration' ) );
|
1673 |
add_settings_field('skin', 'Video skin file:', 'kgvid_skin_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'skin' ) );
|
1675 |
add_settings_field('scale_mode', 'Video scale mode:', 'kgvid_scale_mode_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'scale_mode' ) );
|
1676 |
add_settings_field('autohide', 'Autohide:', 'kgvid_autohide_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'autohide' ) );
|
1677 |
add_settings_field('playbutton', 'Play button overlay:', 'kgvid_playbutton_callback', __FILE__, 'kgvid_video_embed_flash_settings', array( 'label_for' => 'playbutton' ) );
|
1678 |
+
|
|
|
|
|
|
|
|
|
|
|
1679 |
add_settings_field('generate_thumbs', 'Default number of thumbnails to generate:', 'kgvid_generate_thumbs_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'generate_thumbs' ) );
|
1680 |
+
add_settings_field('user_roles', 'User roles:', 'kgvid_user_roles_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'user_roles' ) );
|
1681 |
+
add_settings_field('security', 'Video Security:', 'kgvid_security_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'embeddable' ) );
|
1682 |
add_settings_field('featured', 'Featured Image:', 'kgvid_featured_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'featured' ) );
|
1683 |
add_settings_field('thumb_parent', 'Attach thumbnails to:', 'kgvid_thumb_parent_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'thumb_parent' ) );
|
1684 |
add_settings_field('delete_children', 'Delete associated attachments:', 'kgvid_delete_children_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'delete_children' ) );
|
|
|
1685 |
add_settings_field('titlecode', 'Video title text HTML formatting:', 'kgvid_titlecode_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'titlecode' ) );
|
1686 |
add_settings_field('template', 'Attachment template display:', 'kgvid_template_callback', __FILE__, 'kgvid_video_embed_plugin_settings', array( 'label_for' => 'template' ) );
|
1687 |
+
|
1688 |
+
add_settings_field('app_path', 'Path to applications on server:', 'kgvid_app_path_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'app_path' ) );
|
1689 |
+
add_settings_field('video_app', 'Application for thumbnails & encoding:', 'kgvid_video_app_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'video_app' ) );
|
1690 |
+
add_settings_field('browser_thumbnails', 'Enable in-browser thumbnails:', 'kgvid_browser_thumbnails_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'browser_thumbnails' ) );
|
1691 |
+
add_settings_field('encode_formats', 'Default video encode formats:', 'kgvid_encode_formats_callback', __FILE__, 'kgvid_video_embed_encode_settings');
|
1692 |
+
add_settings_field('automatic', 'Do automatically on upload:', 'kgvid_automatic_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'auto_encode' ) );
|
1693 |
+
add_settings_field('htaccess', 'htaccess login:', 'kgvid_htaccess_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'htaccess_username' ) );
|
1694 |
+
add_settings_field('moov', 'Method to fix encoded H.264 headers for streaming:', 'kgvid_moov_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'moov' ) );
|
1695 |
+
add_settings_field('rate_control', 'Encode quality control method:', 'kgvid_rate_control_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'rate_control' ) );
|
1696 |
+
add_settings_field('CRFs', 'Constant Rate Factors (CRF):', 'kgvid_CRF_options_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'h264_CRF' ) );
|
1697 |
+
add_settings_field('bitrate_multiplier', 'Average Bit Rate:', 'kgvid_average_bitrate_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'bitrate_multiplier' ) );
|
1698 |
+
add_settings_field('h264_profile', 'H.264 profile:', 'kgvid_h264_profile_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'h264_profile' ) );
|
1699 |
+
add_settings_field('audio_bitrate', 'Audio bit rate:', 'kgvid_audio_bitrate_options_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'audio_bitrate' ) );
|
1700 |
+
add_settings_field('ffmpeg_options', 'FFMPEG legacy options:', 'kgvid_ffmpeg_options_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'video_bitrate_flag' ) );
|
1701 |
+
add_settings_field('execution', 'Execution:', 'kgvid_execution_options_callback', __FILE__, 'kgvid_video_embed_encode_settings', array( 'label_for' => 'threads' ) );
|
1702 |
+
|
1703 |
}
|
1704 |
add_action('admin_init', 'kgvid_video_embed_options_init' );
|
1705 |
|
1706 |
//callback functions generating HTML for the settings form
|
1707 |
|
1708 |
function kgvid_plugin_playback_settings_section_callback() {
|
1709 |
+
global $wp_version;
|
1710 |
$options = get_option('kgvid_video_embed_options');
|
1711 |
+
if ( $options['embeddable'] != "on" ) {
|
1712 |
+
$embed_disabled = "disabled='disabled'";
|
1713 |
+
if ( $options['overlay_embedcode'] == "on" || $options['open_graph'] == "on" ) {
|
1714 |
+
$options['overlay_embedcode'] = false;
|
1715 |
+
$options['open_graph'] = false;
|
1716 |
+
update_option('kgvid_video_embed_options', $options);
|
1717 |
+
}
|
1718 |
+
}
|
1719 |
else { $embed_disabled = ""; }
|
1720 |
+
|
1721 |
+
$items = array("Video.js", "Strobe Media Playback");
|
1722 |
+
if ( $wp_version >= 3.6 ) { $items = array("Video.js", "WordPress Default", "Strobe Media Playback"); }
|
1723 |
+
echo "<table class='form-table'><tbody><tr valign='middle'><th scope='row'><label for='embed_method'>Video player:</label></th><td><select class='affects_player' onchange='kgvid_hide_plugin_settings();' id='embed_method' name='kgvid_video_embed_options[embed_method]'>";
|
1724 |
foreach($items as $item) {
|
1725 |
$selected = ($options['embed_method']==$item) ? 'selected="selected"' : '';
|
1726 |
echo "<option value='$item' $selected>$item</option>";
|
1727 |
}
|
1728 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>This plugin used Strobe Media Playback for Flash playback in the past, but you can choose to use the newer and lighter Video.js method which will give priority to HTML5 and only use Flash as a fallback or if you're running WordPress version 3.6 or later you can use the built-in MediaElement.js video player.</span></a></td></tr></tbody></table>\n";
|
1729 |
+
|
1730 |
$sampleheight = intval($options['height']) + 25;
|
1731 |
echo "<div class='kgvid_setting_nearvid' style='width:".$options['width']."px;'>";
|
1732 |
+
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>";
|
1733 |
+
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>";
|
1734 |
$iframeurl = site_url('/')."?kgvid_video_embed[enable]=true&kgvid_video_embed[sample]=true";
|
1735 |
echo "<iframe id='kgvid_samplevideo' style='border:2px;' src='".$iframeurl."' scrolling='no' width='".$options['width']."' height='".$sampleheight."'></iframe>";
|
1736 |
+
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</label></div>";
|
1737 |
+
echo "</div>\n\t";
|
1738 |
}
|
1739 |
function kgvid_plugin_flash_settings_section_callback() { }
|
1740 |
function kgvid_plugin_settings_section_callback() { }
|
1741 |
+
|
1742 |
function kgvid_poster_callback() {
|
1743 |
$options = get_option('kgvid_video_embed_options');
|
1744 |
+
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";
|
1745 |
}
|
1746 |
+
|
1747 |
+
function kgvid_endofvideooverlay_callback() {
|
1748 |
$options = get_option('kgvid_video_embed_options');
|
1749 |
+
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.</label><br />";
|
1750 |
+
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 />";
|
1751 |
+
echo "Display alternate image when video ends.<small>\n\t";
|
1752 |
}
|
1753 |
+
|
1754 |
function kgvid_watermark_callback() {
|
1755 |
$options = get_option('kgvid_video_embed_options');
|
1756 |
+
echo "<input class='regular-text affects_player' id='watermark' name='kgvid_video_embed_options[watermark]' type='text' value='".$options['watermark']."' /> <span id='pick-endofvideooverlay' class='button-secondary' data-choose='Choose a Watermark' data-update='Set as watermark' data-change='watermark' onclick='kgvid_pick_image(this);'>Choose from Library</span>\n\t";
|
1757 |
}
|
1758 |
|
1759 |
function kgvid_align_callback() {
|
1764 |
$selected = ($options['align']==$item) ? 'selected="selected"' : '';
|
1765 |
echo "<option value='$item' $selected>$item</option>";
|
1766 |
}
|
1767 |
+
echo "</select>\n\t";
|
1768 |
+
}
|
1769 |
+
|
1770 |
+
function kgvid_resize_callback() {
|
1771 |
+
$options = get_option('kgvid_video_embed_options');
|
1772 |
+
echo "<input ".checked( $options['resize'], "on", false )." id='resize' name='kgvid_video_embed_options[resize]' type='checkbox' /> <label for='resize'>Make video player responsive.</label>\n\t";
|
1773 |
}
|
1774 |
+
|
1775 |
function kgvid_inline_callback() {
|
1776 |
$options = get_option('kgvid_video_embed_options');
|
1777 |
+
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.</label>\n\t";
|
1778 |
}
|
1779 |
+
|
1780 |
function kgvid_dimensions_callback() {
|
1781 |
$options = get_option('kgvid_video_embed_options');
|
1782 |
+
echo "Width: <input class='small-text affects_player' id='width' name='kgvid_video_embed_options[width]' type='text' value='".$options['width']."' /> Height: <input class='small-text affects_player' id='height' name='kgvid_video_embed_options[height]' type='text' value='".$options['height']."' /> ";
|
1783 |
+
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.</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a>\n\t";
|
1784 |
}
|
1785 |
+
|
1786 |
function kgvid_gallery_dimensions_callback() {
|
1787 |
$options = get_option('kgvid_video_embed_options');
|
1788 |
+
echo "Width: <input class='small-text' id='gallery_width' name='kgvid_video_embed_options[gallery_width]' type='text' value='".$options['gallery_width']."' /> Width: <input class='small-text' id='gallery_height' name='kgvid_video_embed_options[gallery_height]' type='text' value='".$options['gallery_height']."' />\n\t";
|
1789 |
}
|
1790 |
+
|
1791 |
function kgvid_gallery_thumb_callback() {
|
1792 |
$options = get_option('kgvid_video_embed_options');
|
1793 |
+
echo "<input class='small-text' id='gallery_thumb' name='kgvid_video_embed_options[gallery_thumb]' type='text' value='".$options['gallery_thumb']."' />\n\t";
|
1794 |
}
|
1795 |
+
|
1796 |
function kgvid_controlbar_style_callback() {
|
1797 |
$options = get_option('kgvid_video_embed_options');
|
1798 |
$items = array("docked", "floating", "none");
|
1799 |
+
echo "<select class='affects_player' id='controlbar_style' name='kgvid_video_embed_options[controlbar_style]'>";
|
1800 |
foreach($items as $item) {
|
1801 |
$selected = ($options['controlbar_style']==$item) ? 'selected="selected"' : '';
|
1802 |
echo "<option value='$item' $selected>$item</option>";
|
1803 |
}
|
1804 |
+
echo "</select> HTML5 video players only respond to the \"none\" option.\n\t";
|
1805 |
}
|
1806 |
+
|
1807 |
function kgvid_autoplay_callback() {
|
1808 |
$options = get_option('kgvid_video_embed_options');
|
1809 |
+
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.</label>\n\t";
|
1810 |
}
|
1811 |
+
|
1812 |
function kgvid_loop_callback() {
|
1813 |
$options = get_option('kgvid_video_embed_options');
|
1814 |
+
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.</label>\n\t";
|
1815 |
}
|
1816 |
+
|
1817 |
function kgvid_js_skin_callback() {
|
1818 |
$options = get_option('kgvid_video_embed_options');
|
1819 |
+
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 <code>kg-video-js-skin</code> for a nice, circular play button. Leave blank for the default square play button. <a href='http://videojs.com/docs/skins/'>Or build your own CSS skin.</a></small></em>\n\t";
|
1820 |
}
|
1821 |
+
|
1822 |
function kgvid_bgcolor_callback() {
|
1823 |
$options = get_option('kgvid_video_embed_options');
|
1824 |
+
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";
|
1825 |
}
|
1826 |
+
|
1827 |
function kgvid_configuration_callback() {
|
1828 |
$options = get_option('kgvid_video_embed_options');
|
1829 |
+
echo "<input class='regular-text affects_player' id='configuration' name='kgvid_video_embed_options[configuration]' type='text' value='".$options['configuration']."' />\n\t";
|
1830 |
}
|
1831 |
+
|
1832 |
function kgvid_skin_callback() {
|
1833 |
$options = get_option('kgvid_video_embed_options');
|
1834 |
+
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> for a modern, circular play button.<br /> Leave blank for the off-center square play button.</small></em>\n\t";
|
1835 |
}
|
1836 |
+
|
1837 |
function kgvid_stream_type_callback() {
|
1838 |
$options = get_option('kgvid_video_embed_options');
|
1839 |
$items = array("liveOrRecorded", "live", "recorded", "dvr");
|
1840 |
+
echo "<select class='affects_player' id='stream_type' name='kgvid_video_embed_options[stream_type]'>";
|
1841 |
foreach($items as $item) {
|
1842 |
$selected = ($options['stream_type']==$item) ? 'selected="selected"' : '';
|
1843 |
echo "<option value='$item' $selected>$item</option>";
|
1844 |
}
|
1845 |
+
echo "</select>\n\t";
|
1846 |
}
|
1847 |
+
|
1848 |
function kgvid_scale_mode_callback() {
|
1849 |
$options = get_option('kgvid_video_embed_options');
|
1850 |
$items = array("letterbox", "none", "stretch", "zoom");
|
1851 |
+
echo "<select class='affects_player' id='scale_mode' name='kgvid_video_embed_options[scale_mode]'>";
|
1852 |
foreach($items as $item) {
|
1853 |
$selected = ($options['scale_mode']==$item) ? 'selected="selected"' : '';
|
1854 |
echo "<option value='$item' $selected>$item</option>";
|
1855 |
}
|
1856 |
+
echo "</select>\n\t";
|
1857 |
}
|
1858 |
+
|
1859 |
function kgvid_autohide_callback() {
|
1860 |
$options = get_option('kgvid_video_embed_options');
|
1861 |
+
echo "<input ".checked( $options['autohide'], "on", false )." id='autohide' name='kgvid_video_embed_options[autohide]' type='checkbox' /> <label for='autohide'>Autohide controlbar.</label>\n\t";
|
1862 |
}
|
1863 |
+
|
1864 |
function kgvid_playbutton_callback() {
|
1865 |
$options = get_option('kgvid_video_embed_options');
|
1866 |
+
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.</label>\n\t";
|
1867 |
+
}
|
1868 |
+
|
1869 |
+
function kgvid_generate_thumbs_callback() {
|
1870 |
+
$options = get_option('kgvid_video_embed_options');
|
1871 |
+
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";
|
1872 |
}
|
1873 |
+
|
1874 |
+
function kgvid_user_roles_callback() {
|
1875 |
+
global $wp_roles;
|
1876 |
+
$options = get_option('kgvid_video_embed_options');
|
1877 |
+
$capabilities_checkboxes = array();
|
1878 |
+
$capabilities = array('make_video_thumbnails'=>'make thumbnails', 'encode_videos'=>'encode videos');
|
1879 |
+
foreach ( $capabilities as $capability => $capability_name ) {
|
1880 |
+
$capabilities_checkboxes[] = "<strong>Can ".$capability_name.":</strong>";
|
1881 |
+
foreach ( $wp_roles->roles as $role => $role_info ) {
|
1882 |
+
|
1883 |
+
$capability_enabled = false;
|
1884 |
+
if ( array_key_exists($role, $options['capabilities'][$capability]) && $options['capabilities'][$capability][$role] == "on" ) { $capability_enabled = true; }
|
1885 |
+
$capabilities_checkboxes[] = "<input type='checkbox' ".checked( $capability_enabled, true, false )." id='capability-".$capability."-".$role."' name='kgvid_video_embed_options[capabilities][".$capability."][".$role."]'> <label for='capability-".$capability."-".$role."'>".$role_info['name']."</label>";
|
1886 |
+
|
1887 |
+
} //role loop
|
1888 |
+
}// capability loop
|
1889 |
+
echo implode("<br>", $capabilities_checkboxes)."\n\t";
|
1890 |
+
}
|
1891 |
+
|
1892 |
+
function kgvid_security_callback() {
|
1893 |
+
$options = get_option('kgvid_video_embed_options');
|
1894 |
+
if ( $options['embeddable'] != "on" ) { $embed_disabled = " disabled='disabled'"; }
|
1895 |
+
else { $embed_disabled = ""; }
|
1896 |
+
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.</label><br />";
|
1897 |
+
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.</label><a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Facebook will use these tags to embed the first video in your post. For the many Facebook users who have enabled secure browsing, your video must be served via https in order to be embedded directly on the page.</span></a><br />";
|
1898 |
+
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.</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a>\n\t";
|
1899 |
+
}
|
1900 |
+
|
1901 |
+
function kgvid_featured_callback() {
|
1902 |
+
$options = get_option('kgvid_video_embed_options');
|
1903 |
+
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.</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a><br /> <a class='button-secondary' href='javascript:void(0);' onclick='kgvid_set_all_featured();'>Set all as featured</a> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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!</span></a>\n\t";
|
1904 |
+
}
|
1905 |
+
|
1906 |
+
function kgvid_thumb_parent_callback() {
|
1907 |
+
$options = get_option('kgvid_video_embed_options');
|
1908 |
+
$items = array("post", "video");
|
1909 |
+
echo "<select id='thumb_parent' name='kgvid_video_embed_options[thumb_parent]'>";
|
1910 |
+
foreach($items as $item) {
|
1911 |
+
$selected = ($options['thumb_parent']==$item) ? 'selected="selected"' : '';
|
1912 |
+
echo "<option value='$item' $selected>$item</option>";
|
1913 |
+
}
|
1914 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a><br /> <a class='button-secondary' href='javascript:void(0);' onclick='kgvid_switch_parents();'>Set all parents</a> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a>\n\t";
|
1915 |
+
}
|
1916 |
+
|
1917 |
+
function kgvid_delete_children_callback() {
|
1918 |
+
$options = get_option('kgvid_video_embed_options');
|
1919 |
+
$items = array("none", "all", "encoded videos only");
|
1920 |
+
echo "<select id='delete_children' name='kgvid_video_embed_options[delete_children]'>";
|
1921 |
+
foreach($items as $item) {
|
1922 |
+
$selected = ($options['delete_children']==$item) ? 'selected="selected"' : '';
|
1923 |
+
echo "<option value='$item' $selected>$item</option>";
|
1924 |
+
}
|
1925 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a>\n\t";
|
1926 |
+
}
|
1927 |
+
|
1928 |
+
function kgvid_titlecode_callback() {
|
1929 |
+
$options = get_option('kgvid_video_embed_options');
|
1930 |
+
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='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>HTML tag applied to titles inserted above the video. Ex: <strong>, <em>, <H2>, <span class='videotitle'>. Corresponding closing tags will be applied to the end of the title automatically.</span></a>\n\t";
|
1931 |
+
}
|
1932 |
+
|
1933 |
+
function kgvid_template_callback() {
|
1934 |
+
$options = get_option('kgvid_video_embed_options');
|
1935 |
+
$items = array("Video title (WP default)"=>"none", "Video in existing template"=>"gentle", "Video only (deprecated)"=>"old");
|
1936 |
+
echo "<select id='template' name='kgvid_video_embed_options[template]'>";
|
1937 |
+
foreach($items as $name => $value) {
|
1938 |
+
$selected = ($options['template']==$value) ? 'selected="selected"' : '';
|
1939 |
+
echo "<option value='$value' $selected>$name</option>";
|
1940 |
+
}
|
1941 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a>\n\t";
|
1942 |
+
}
|
1943 |
+
|
1944 |
function kgvid_app_path_callback() {
|
1945 |
$options = get_option('kgvid_video_embed_options');
|
1946 |
+
echo "<input class='affects_ffmpeg regular-text code' id='app_path' name='kgvid_video_embed_options[app_path]' type='text' value='".stripslashes($options['app_path'])."' /><a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Don't include trailing slash. Example: <code>/usr/local/bin</code>. On Windows servers, use / instead of C:\\"."\n\t";
|
1947 |
}
|
1948 |
|
1949 |
function kgvid_video_app_callback() {
|
1950 |
$options = get_option('kgvid_video_embed_options');
|
1951 |
+
echo "<select onchange='kgvid_hide_ffmpeg_settings();' class='affects_ffmpeg' id='video_app' name='kgvid_video_embed_options[video_app]'>";
|
1952 |
$items = array("FFMPEG"=>"ffmpeg", "LIBAV"=>"avconv");
|
|
|
1953 |
foreach($items as $name => $value) {
|
1954 |
$selected = ($options['video_app']==$value) ? 'selected="selected"' : '';
|
1955 |
echo "<option value='$value' $selected>$name</option>";
|
1956 |
}
|
1957 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a>\n\t";
|
1958 |
+
}
|
1959 |
+
|
1960 |
+
function kgvid_browser_thumbnails_callback() {
|
1961 |
+
$options = get_option('kgvid_video_embed_options');
|
1962 |
+
echo "<div class='kgvid_video_app_required'>";
|
1963 |
+
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>.</label>\n\t";
|
1964 |
+
echo "</div>";
|
1965 |
}
|
1966 |
+
|
1967 |
function kgvid_encode_formats_callback() {
|
1968 |
+
$options = get_option('kgvid_video_embed_options');
|
1969 |
+
echo "<div class='kgvid_video_app_required'>";
|
1970 |
+
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='../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.</span></a><br />";
|
1971 |
+
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+, few Android, Windows Phone 8, Chrome, Safari, IE 9+)</em></small></label><br />";
|
1972 |
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, some Android, Chrome, Safari, IE 9+)</em></small></label><br />";
|
1973 |
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+)</em></small></label><br />";
|
1974 |
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 />";
|
1975 |
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>";
|
1976 |
+
echo "</div>\n\t";
|
1977 |
}
|
1978 |
+
|
1979 |
+
function kgvid_automatic_callback() {
|
1980 |
$options = get_option('kgvid_video_embed_options');
|
1981 |
+
echo "<div class='kgvid_video_app_required'>";
|
1982 |
+
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.</label><br />";
|
1983 |
+
echo "<input ".checked( $options['auto_thumb'], "on", false )." id='auto_thumb' name='kgvid_video_embed_options[auto_thumb]' type='checkbox' /> <label for='auto_thumb'>Generate thumbnail from </label>";
|
1984 |
+
$items = array(0, 25, 50, 75);
|
1985 |
+
echo "<select id='auto_thumb_position' name='kgvid_video_embed_options[auto_thumb_position]'>";
|
1986 |
+
foreach($items as $item) {
|
1987 |
+
$selected = ($options['auto_thumb_position']==$item) ? 'selected="selected"' : '';
|
1988 |
+
echo "<option value='$item' $selected>$item</option>";
|
1989 |
+
}
|
1990 |
+
echo "</select>% of the way through the video.";
|
1991 |
+
echo "</div>\n\t";
|
1992 |
}
|
1993 |
+
|
1994 |
+
function kgvid_htaccess_callback() {
|
1995 |
+
$options = get_option('kgvid_video_embed_options');
|
1996 |
+
echo "<div class='kgvid_video_app_required'>";
|
1997 |
+
echo "<table class='kgvid_htaccess'><tbody><tr><td>User Name:</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>";
|
1998 |
+
echo "<tr><td>Password:</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='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>If your videos are htaccess protected, <strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> will access them using these credentials.</span></a></td></tr></tbody></table>";
|
1999 |
+
echo "</div>\n\t";
|
2000 |
+
}
|
2001 |
+
|
2002 |
function kgvid_moov_callback() {
|
2003 |
$options = get_option('kgvid_video_embed_options');
|
2004 |
+
echo "<div class='kgvid_video_app_required'>";
|
2005 |
+
$items = array("none"=>"none", "movflags faststart"=>"movflag", "qt-faststart"=>"qt-faststart", "MP4Box"=>"MP4Box");
|
2006 |
+
echo "<select id='moov' name='kgvid_video_embed_options[moov]' class='affects_ffmpeg'>";
|
2007 |
+
foreach($items as $name => $value) {
|
2008 |
+
$selected = ($options['moov']==$value) ? 'selected="selected"' : '';
|
2009 |
+
echo "<option value='$value' $selected>$name</option>";
|
2010 |
}
|
2011 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'><strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> 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 <strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> can fix the problem at the end of the encoding process using `movflags faststart`. Older versions of ".strtoupper($options['video_app'])." will not work if you select the movflags option. If that is the case, select qt-faststart or MP4Box which will run after encoding is finished if they are installed on your server.</span></a>";
|
2012 |
+
echo "</div>\n\t";
|
2013 |
}
|
2014 |
|
2015 |
+
function kgvid_rate_control_callback() {
|
2016 |
$options = get_option('kgvid_video_embed_options');
|
2017 |
+
echo "<div class='kgvid_video_app_required'>";
|
2018 |
+
echo "<select id='rate_control' name='kgvid_video_embed_options[rate_control]' onchange='kgvid_hide_ffmpeg_settings();' class='affects_ffmpeg'>";
|
2019 |
+
$items = array("Constant Rate Factor"=>"crf", "Average Bit Rate"=>"abr");
|
2020 |
+
foreach($items as $name => $value) {
|
2021 |
+
$selected = ($options['rate_control']==$value) ? 'selected="selected"' : '';
|
2022 |
+
echo "<option value='$value' $selected>$name</option>";
|
2023 |
+
}
|
2024 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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 previous 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.</span></a>";
|
2025 |
+
echo "</div>\n\t";
|
2026 |
}
|
2027 |
+
|
2028 |
+
function kgvid_CRF_options_callback() {
|
2029 |
$options = get_option('kgvid_video_embed_options');
|
2030 |
+
echo "<div class='kgvid_video_app_required'>";
|
2031 |
+
echo "<select id='h264_CRF' name='kgvid_video_embed_options[h264_CRF]' class='affects_ffmpeg'>";
|
2032 |
+
for ($i = 0; $i <= 51; $i++ ) {
|
2033 |
+
$selected = ($options['h264_CRF']==$i) ? 'selected="selected"' : '';
|
2034 |
+
echo "<option value='".$i."' $selected>".$i."</option>";
|
2035 |
+
}
|
2036 |
+
echo "</select> H.264 <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Lower values are higher quality. 18 is considered visually lossless. Default is 23.</span></a><br />";
|
2037 |
+
|
2038 |
+
echo "<select id='webm_CRF' name='kgvid_video_embed_options[webm_CRF]' class='affects_ffmpeg'>";
|
2039 |
+
for ($i = 4; $i <= 63; $i++ ) {
|
2040 |
+
$selected = ($options['webm_CRF']==$i) ? 'selected="selected"' : '';
|
2041 |
+
echo "<option value='".$i."' $selected>".$i."</option>";
|
2042 |
+
}
|
2043 |
+
echo "</select> WEBM <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Lower values are higher quality. Default is 10.</span></a><br />\n\t";
|
2044 |
+
|
2045 |
+
echo "<select id='ogv_CRF' name='kgvid_video_embed_options[ogv_CRF]' class='affects_ffmpeg'>";
|
2046 |
+
for ($i = 1; $i <= 10; $i++ ) {
|
2047 |
+
$selected = ($options['ogv_CRF']==$i) ? 'selected="selected"' : '';
|
2048 |
+
echo "<option value='".$i."' $selected>".$i."</option>";
|
2049 |
+
}
|
2050 |
+
echo "</select> OGV (qscale) <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Higher values are higher quality. Default is 6.</span></a>";
|
2051 |
+
echo "</div>\n\t";
|
2052 |
}
|
2053 |
+
|
2054 |
+
function kgvid_average_bitrate_callback() {
|
2055 |
$options = get_option('kgvid_video_embed_options');
|
2056 |
+
echo "<div class='kgvid_video_app_required'>";
|
2057 |
+
echo "<select onchange='kgvid_set_bitrate_display();' id='bitrate_multiplier' name='kgvid_video_embed_options[bitrate_multiplier]' class='affects_ffmpeg'>";
|
2058 |
+
for ($i = 0.01; $i <= 0.31; $i=$i+0.01 ) {
|
2059 |
+
$selected = ($options['bitrate_multiplier']==strval($i)) ? 'selected="selected"' : '';
|
2060 |
+
echo "<option value='$i' $selected>$i</option>";
|
2061 |
+
}
|
2062 |
+
echo "</select> bits per pixel. <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Default is 0.1</span></a><br />";
|
2063 |
+
echo "<span class='kgvid_gray_text'>1080p = <span id='1080_bitrate'>".round(floatval($options['bitrate_multiplier'])*1920*1080*30/1024)."</span> kbps<br />";
|
2064 |
+
echo "720p = <span id='720_bitrate'>".round(floatval($options['bitrate_multiplier'])*1280*720*30/1024)."</span> kbps<br />";
|
2065 |
+
echo "480p = <span id='360_bitrate'>".round(floatval($options['bitrate_multiplier'])*640*360*30/1024)."</span> kbps</span>";
|
2066 |
+
echo "</div>\n\t";
|
2067 |
}
|
2068 |
+
|
2069 |
+
function kgvid_h264_profile_callback() {
|
2070 |
$options = get_option('kgvid_video_embed_options');
|
2071 |
+
echo "<div class='kgvid_video_app_required'>";
|
2072 |
+
echo "<select id='h264_profile' name='kgvid_video_embed_options[h264_profile]' class='affects_ffmpeg'>";
|
2073 |
+
$items = array("none", "baseline", "main", "high", "high10", "high422", "high444");
|
2074 |
foreach($items as $item) {
|
2075 |
+
$selected = ($options['h264_profile']==$item) ? 'selected="selected"' : '';
|
2076 |
+
echo "<option value='$item' $selected>$item</option>";
|
2077 |
+
}
|
2078 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Lower profiles will 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.</span></a><br />";
|
2079 |
+
echo "<select id='h264_level' name='kgvid_video_embed_options[h264_level]' class='affects_ffmpeg'>";
|
2080 |
+
$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");
|
2081 |
+
foreach($items as $item) {
|
2082 |
+
$selected = ($options['h264_level']==$item) ? 'selected="selected"' : '';
|
2083 |
echo "<option value='$item' $selected>$item</option>";
|
2084 |
}
|
2085 |
+
echo "</select> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a>";
|
2086 |
+
echo "</div>\n\t";
|
2087 |
}
|
2088 |
+
|
2089 |
+
function kgvid_audio_bitrate_options_callback() {
|
2090 |
$options = get_option('kgvid_video_embed_options');
|
2091 |
+
echo "<div class='kgvid_video_app_required'>";
|
2092 |
+
$items = array(96, 112, 128, 160, 192, 224, 256, 320);
|
2093 |
+
echo "<select id='audio_bitrate' name='kgvid_video_embed_options[audio_bitrate]' class='affects_ffmpeg'>";
|
2094 |
foreach($items as $item) {
|
2095 |
+
$selected = ($options['audio_bitrate']==$item) ? 'selected="selected"' : '';
|
2096 |
echo "<option value='$item' $selected>$item</option>";
|
2097 |
}
|
2098 |
+
echo "</select> kbps";
|
2099 |
+
echo "</div>\n\t";
|
2100 |
}
|
2101 |
+
|
2102 |
+
function kgvid_ffmpeg_options_callback() {
|
|
|
|
|
|
|
|
|
|
|
2103 |
$options = get_option('kgvid_video_embed_options');
|
2104 |
+
echo "<div class='kgvid_video_app_required'>";
|
2105 |
+
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.</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../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.</span></a><br />
|
2106 |
+
<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 FFMPEG 'vpre' flags.</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Enable if your installed version of FFMPEG is old enough that libx264 requires vpre flags 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 will cause newer versions of FFMPEG to fail and probably won't work on Windows servers.</span></a>";
|
2107 |
+
echo "</div>\n\t";
|
2108 |
}
|
2109 |
+
|
2110 |
+
function kgvid_execution_options_callback() {
|
2111 |
$options = get_option('kgvid_video_embed_options');
|
2112 |
+
echo "<div class='kgvid_video_app_required'>";
|
2113 |
+
$items = array(96, 112, 128, 160, 192, 224, 256, 320);
|
2114 |
+
echo "<select id='threads' name='kgvid_video_embed_options[threads]' class='affects_ffmpeg'>";
|
2115 |
+
for ($i = 0; $i <= 16; $i++ ) {
|
2116 |
+
$selected = ($options['threads']==$i) ? 'selected="selected"' : '';
|
2117 |
+
echo "<option value='".$i."' $selected>".$i."</option>";
|
2118 |
+
}
|
2119 |
+
echo "</select> threads <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Default is 1, which limits encoding speed but prevents encoding from using too many system resources. Selecting 0 will allow <strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> to optimize the number of threads or you can set the number manually. This may lead to <strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> monopolizing system resources.</span></a><br />";
|
2120 |
+
echo "<input ".checked( $options['nice'], "on", false )." id='nice' name='kgvid_video_embed_options[nice]' class='affects_ffmpeg' type='checkbox' /> <label for='nice'>Run <code>nice</code>.</label> <a class='kgvid_tooltip' href='javascript:void(0);'><img src='../wp-includes/images/blank.gif'><span class='kgvid_tooltip_classic'>Tells <strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> to run at a lower priority to avoid monopolizing system resources.</span></a>";
|
2121 |
+
echo "</div>";
|
2122 |
+
|
2123 |
+
$encode_string = "";
|
2124 |
+
if ( $options['ffmpeg_exists'] == "on" ) {
|
2125 |
+
$movie_info = kgvid_get_video_dimensions(plugin_dir_url(__FILE__)."images/sample-video-h264.mp4");
|
2126 |
+
$uploads = wp_upload_dir();
|
2127 |
+
$encode_string = kgvid_generate_encode_string(plugin_dir_url(__FILE__)."images/sample-video-h264.mp4", $uploads['path']."/sample-video-h264-480p.mp4", $movie_info['configuration'], 'mobile', 640, 360, '');
|
2128 |
}
|
2129 |
+
|
2130 |
+
$display_div = "";
|
2131 |
+
if ( $options['ffmpeg_exists'] != "on" ) { $display_div = " style='display:none;'"; }
|
2132 |
+
|
2133 |
+
echo "<div id='ffmpeg_sample_div'".$display_div."><p><strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> sample H.264 encode command:<br /><textarea id='ffmpeg_h264_sample' class='ffmpeg_sample_code code' cols='100' rows='5' wrap='soft' readonly='yes'>".$encode_string."</textarea></p>";
|
2134 |
+
echo "<p><strong class='video_app_name'>".strtoupper($options['video_app'])."</strong> test output:<br /><textarea id='ffmpeg_output' class='ffmpeg_sample_code code' cols='100' rows='20' wrap='soft' readonly='yes'></textarea></p></div>\n\t";
|
2135 |
}
|
2136 |
|
2137 |
//end of settings page callback functions
|
2138 |
|
2139 |
function kgvid_update_settings() {
|
2140 |
+
|
2141 |
global $wpdb;
|
2142 |
+
|
2143 |
+
|
2144 |
+
/* $labels = array(
|
2145 |
+
'name' => 'Video Info',
|
2146 |
+
'singular_name' => 'Video Info',
|
2147 |
+
'search_items' => 'Search Video Info',
|
2148 |
+
'all_items' => 'All Video Info',
|
2149 |
+
'parent_item' => 'Parent Video Info',
|
2150 |
+
'parent_item_colon' => 'Parent Video Info:',
|
2151 |
+
'edit_item' => 'Edit Video Info',
|
2152 |
+
'update_item' => 'Update Video Info',
|
2153 |
+
'add_new_item' => 'Add New Video Info',
|
2154 |
+
'new_item_name' => 'New Video Info',
|
2155 |
+
'menu_name' => 'Video Info',
|
2156 |
+
);
|
2157 |
+
|
2158 |
+
$args = array(
|
2159 |
+
'labels' => $labels,
|
2160 |
+
'hierarchical' => true,
|
2161 |
+
'query_var' => 'true',
|
2162 |
+
'rewrite' => 'true',
|
2163 |
+
'show_admin_column' => 'true',
|
2164 |
+
'show_tagcloud' => 'false'
|
2165 |
+
);
|
2166 |
+
|
2167 |
+
register_taxonomy( 'kgvid-video-info', 'attachment', $args ); */
|
2168 |
+
|
2169 |
$options = get_option('kgvid_video_embed_options');
|
2170 |
$options_old = $options; //save the values that are in the db
|
2171 |
$default_options = kgvid_default_options_fn();
|
2172 |
+
|
2173 |
if ( empty($options) ) { // run if the new settings don't exist yet (before version 3.0)
|
2174 |
+
|
2175 |
$options = array();
|
2176 |
|
2177 |
$old_setting_equivalents = array (
|
2179 |
"height"=>"wp_FMP_height",
|
2180 |
"controlbar_style"=>"wp_FMP_controlbar_style",
|
2181 |
"poster"=>"wp_FMP_poster",
|
2182 |
+
"endofvideooverlay"=>"wp_FMP_endofvideooverlay",
|
2183 |
"autohide"=>"wp_FMP_autohide",
|
2184 |
"autoplay"=>"wp_FMP_autoplay",
|
2185 |
"loop"=>"wp_FMP_loop",
|
2207 |
}
|
2208 |
}
|
2209 |
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'wp_FMP%'" );
|
2210 |
+
|
2211 |
foreach ( $default_options as $key => $value ) { //apply default values for any settings that didn't exist before
|
2212 |
if ( !array_key_exists($key, $options) ) { $options[$key] = $value; }
|
2213 |
$options['embed_method'] = "Strobe Media Playback";
|
2214 |
}
|
2215 |
+
|
2216 |
+
update_option('kgvid_video_embed_options', $options);
|
2217 |
}
|
2218 |
+
|
2219 |
else { //user is already upgraded to version 3.0, but needs the extra options introduced in later versions
|
2220 |
if ( $options['version'] < 3.1 ) {
|
2221 |
$options['version'] = 3.1;
|
2222 |
if ( $options['ffmpeg_vpre'] == "on" ) { $options['video_bitrate_flag'] = "on"; } //if user has ffmpeg_vpre turned on, they need the old bitrate flags too
|
2223 |
else { $options['video_bitrate_flag'] = false; }
|
2224 |
+
$options['watermark'] = "";
|
2225 |
}
|
2226 |
if ( $options['version'] < 4.0 ) {
|
2227 |
$options['version'] = 4.0;
|
2234 |
$options['delete_children'] = "encoded videos only";
|
2235 |
if ( $options['template'] == "on" ) { $options['template'] = "old"; }
|
2236 |
else { $options['template'] = "gentle"; }
|
2237 |
+
$checkbox_convert = array ( "autohide", "endofvideooverlaysame", "playbutton", "loop", "autoplay" );
|
2238 |
foreach ( $checkbox_convert as $option ) {
|
2239 |
if ( $options[$option] == "true" ) { $options[$option] = "on"; } //some checkboxes were incorrectly set to "true" in older versions
|
2240 |
}
|
2242 |
wp_clear_scheduled_hook('kgvid_cleanup_queue');
|
2243 |
wp_schedule_event( time()+86400, 'daily', 'kgvid_cleanup_queue', array ( 'scheduled' ) );
|
2244 |
}
|
2245 |
+
|
2246 |
}
|
2247 |
if ( $options['version'] < 4.1 ) {
|
2248 |
$options['version'] = 4.1;
|
2249 |
$options['embeddable'] = "on";
|
2250 |
$options['inline'] = "on";
|
2251 |
}
|
2252 |
+
if ( $options['version'] < 4.2 ) {
|
2253 |
+
|
2254 |
+
$options['version'] = 4.2;
|
2255 |
+
$options["bitrate_multiplier"] = 0.1;
|
2256 |
+
$options["h264_CRF"] = 23;
|
2257 |
+
$options["webm_CRF"] = 10;
|
2258 |
+
$options["ogv_CRF"] = 6;
|
2259 |
+
$options["audio_bitrate"] = 160;
|
2260 |
+
$options["threads"] = 1;
|
2261 |
+
$options["nice"] = "on";
|
2262 |
+
$options["browser_thumbnails"] = "on";
|
2263 |
+
$options["rate_control"] = "abr";
|
2264 |
+
$options["h264_profile"] = "none";
|
2265 |
+
$options["h264_level"] = "none";
|
2266 |
+
$options["encode_fullres"] = false;
|
2267 |
+
$options["auto_encode"] = false;
|
2268 |
+
$options["auto_thumb"] = false;
|
2269 |
+
$options["auto_thumb_position"] = 50;
|
2270 |
+
$options["right_click"] = "on";
|
2271 |
+
$options["resize"] = "on";
|
2272 |
+
$options["htaccess_login"] = "";
|
2273 |
+
$options["htaccess_password"] = "";
|
2274 |
+
$options["minimum_width"] = false;
|
2275 |
+
|
2276 |
+
$options["endofvideooverlaysame"] = $options["endOfVideoOverlaySame"];
|
2277 |
+
unset($options["endOfVideoOverlaySame"]);
|
2278 |
+
$options["endofvideooverlay"] = $options["endOfVideoOverlay"];
|
2279 |
+
unset($options["endOfVideoOverlaySame"]);
|
2280 |
+
|
2281 |
+
$upload_capable = kgvid_upload_capable();
|
2282 |
+
$options["capabilities"]["make_video_thumbnails"] = $upload_capable;
|
2283 |
+
$options["capabilities"]["encode_videos"] = $upload_capable;
|
2284 |
+
kgvid_set_capabilities($options["capabilities"]);
|
2285 |
+
|
2286 |
+
if ( array_key_exists('embeddable', $options) && $options['embeddable'] != "on" ) { $options['open_graph'] = false; }
|
2287 |
+
else { $options['open_graph'] = "on"; }
|
2288 |
+
|
2289 |
+
$args = array(
|
2290 |
+
'numberposts' => -1,
|
2291 |
+
'post_mime_type' => 'video',
|
2292 |
+
'post_status' => null,
|
2293 |
+
'post_type' => 'attachment',
|
2294 |
+
);
|
2295 |
+
$video_attachments = get_posts($args);
|
2296 |
+
foreach ( $video_attachments as $post ) {
|
2297 |
+
if ( $post->post_parent && strpos(get_post_mime_type( $post->ID ), 'video') !== false ) {
|
2298 |
+
|
2299 |
+
}
|
2300 |
+
}
|
2301 |
+
}
|
2302 |
+
|
2303 |
if ( $options['version'] != $default_options['version'] ) { $options['version'] = $default_options['version']; }
|
2304 |
if ( $options !== $options_old ) { update_option('kgvid_video_embed_options', $options); }
|
2305 |
}
|
2306 |
+
|
2307 |
}
|
2308 |
add_action('init', 'kgvid_update_settings' );
|
2309 |
|
2311 |
|
2312 |
$options = get_option('kgvid_video_embed_options');
|
2313 |
$default_options = kgvid_default_options_fn();
|
2314 |
+
|
2315 |
if (isset ($_POST["video-embed-thumbnail-generator-reset"])) {
|
2316 |
$input = $default_options;
|
2317 |
add_settings_error( __FILE__, "options-reset", "Video Embed & Thumbnail Generator settings reset to default values.", "updated" );
|
2318 |
}
|
2319 |
|
2320 |
$ffmpeg_info = kgvid_check_ffmpeg_exists($input, false);
|
2321 |
+
|
2322 |
if ( $ffmpeg_info['exec_enabled'] == false ) {
|
2323 |
+
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");
|
2324 |
$input['ffmpeg_exists'] = "notinstalled";
|
2325 |
}
|
2326 |
elseif ( $ffmpeg_info['ffmpeg_exists'] == false ) {
|
2327 |
+
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");
|
2328 |
$input['ffmpeg_exists'] = "notinstalled";
|
2329 |
}
|
2330 |
if ( $ffmpeg_info['ffmpeg_exists'] == true ) { $input['ffmpeg_exists'] = "on"; }
|
2331 |
+
|
2332 |
+
if ( empty($input['width']) ) {
|
2333 |
add_settings_error( __FILE__, "width-zero", "You must enter a value for the maximum video width.");
|
2334 |
$input['width'] = $options['width'];
|
2335 |
}
|
2336 |
+
if ( empty($input['height']) ) {
|
2337 |
add_settings_error( __FILE__, "height-zero", "You must enter a value for the maximum video height.");
|
2338 |
$input['height'] = $options['height'];
|
2339 |
}
|
2340 |
+
if ( empty($input['gallery_width']) ) {
|
2341 |
add_settings_error( __FILE__, "gallery-width-zero", "You must enter a value for the maximum gallery video width.");
|
2342 |
$input['gallery_width'] = $options['gallery_width'];
|
2343 |
}
|
2344 |
+
if ( empty($input['gallery_height']) ) {
|
2345 |
add_settings_error( __FILE__, "gallery-height-zero", "You must enter a value for the maximum gallery video height.");
|
2346 |
$input['gallery_height'] = $options['gallery_height'];
|
2347 |
}
|
2348 |
+
|
2349 |
+
if ( $input['capabilities'] !== $options['capabilities'] ) { kgvid_set_capabilities($input['capabilities']); }
|
2350 |
+
|
2351 |
$input['titlecode'] = wp_kses_post( $input['titlecode'] );
|
2352 |
+
|
2353 |
// load all settings and make sure they get a value of false if they weren't entered into the form
|
2354 |
foreach ( $default_options as $key => $value ) {
|
2355 |
if ( !array_key_exists($key, $input) ) { $input[$key] = false; }
|
2356 |
}
|
2357 |
|
2358 |
+
if ( $input['embeddable'] == false ) { $input['overlay_embedcode'] = false; }
|
2359 |
+
|
2360 |
$input['version'] = $default_options['version']; //since this isn't user selectable it has to be re-entered every time
|
2361 |
+
|
2362 |
return $input;
|
2363 |
}
|
2364 |
|
2365 |
function kgvid_ajax_save_settings() {
|
2366 |
|
2367 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
2368 |
+
|
2369 |
+
if ( current_user_can('manage_options') ) {
|
2370 |
+
$setting = $_POST['setting'];
|
2371 |
+
$value = $_POST['value'];
|
2372 |
+
parse_str($_POST['all_settings'], $all_settings);
|
2373 |
+
$error_message = "";
|
2374 |
+
global $wpdb;
|
2375 |
+
global $wp_settings_errors;
|
2376 |
+
$validated_options = kgvid_video_embed_options_validate($all_settings['kgvid_video_embed_options']);
|
2377 |
+
$options_updated = update_option('kgvid_video_embed_options', $validated_options);
|
2378 |
+
if ( !empty($wp_settings_errors) ) { $error_message = $wp_settings_errors[0]['message']; }
|
2379 |
+
$encode_string = "";
|
2380 |
+
if ( $validated_options['ffmpeg_exists'] == "on" ) {
|
2381 |
+
$movie_info = kgvid_get_video_dimensions(plugin_dir_url(__FILE__)."images/sample-video-h264.mp4");
|
2382 |
+
$uploads = wp_upload_dir();
|
2383 |
+
$encode_string = kgvid_generate_encode_string(plugin_dir_url(__FILE__)."images/sample-video-h264.mp4", $uploads['path']."/sample-video-h264-480p.mp4", $movie_info['configuration'], 'mobile', 640, 360, '');
|
2384 |
+
}
|
2385 |
+
if ( strpos($setting, 'capability') !== false ) { $validated_options[$setting] = $value; }
|
2386 |
+
$arr = array ( "error_message" => $error_message, "validated_value" => $validated_options[$setting], "ffmpeg_exists" => $validated_options['ffmpeg_exists'], "encode_string" => $encode_string );
|
2387 |
+
echo json_encode($arr);
|
2388 |
+
die();
|
2389 |
+
}
|
2390 |
}
|
2391 |
add_action('wp_ajax_kgvid_save_settings', 'kgvid_ajax_save_settings');
|
2392 |
|
2393 |
+
function kgvid_add_attachment_handler($post_id) { // This will start encoding and thumbnail generating automatically in a future version
|
2394 |
|
2395 |
+
$options = get_option('kgvid_video_embed_options');
|
2396 |
+
|
2397 |
+
if ( $options['auto_encode'] == "on" || $options['auto_thumb'] == "on" ) {
|
2398 |
+
$post = get_post($post_id);
|
2399 |
+
if ( substr($post->post_mime_type, 0, 5) == 'video' && (empty($post->post_parent) || (strpos(get_post_mime_type( $post->post_parent ), 'video') === false && get_post_meta($post->ID, '_kgflashmediaplayer-externalurl', true) == false)) ) {
|
2400 |
+
$args = array($post_id);
|
2401 |
+
wp_schedule_single_event(time(), 'kgvid_cron_new_attachment', $args);
|
2402 |
+
spawn_cron();
|
2403 |
+
}
|
2404 |
}
|
|
|
2405 |
}
|
2406 |
add_action('add_attachment', 'kgvid_add_attachment_handler');
|
2407 |
|
2409 |
|
2410 |
$options = get_option('kgvid_video_embed_options');
|
2411 |
$post = get_post($post_id);
|
|
|
2412 |
$movieurl = wp_get_attachment_url($post_id);
|
2413 |
+
|
2414 |
+
if ( $options['auto_thumb'] == "on" ) {
|
2415 |
+
|
2416 |
+
switch ( $options['auto_thumb_position'] ) {
|
2417 |
+
case 0:
|
2418 |
+
$numberofthumbs = 1;
|
2419 |
+
$iincreaser = 1;
|
2420 |
+
$thumbtimecode = "firstframe";
|
2421 |
+
$dofirstframe = true;
|
2422 |
+
break;
|
2423 |
+
case 25:
|
2424 |
+
$numberofthumbs = 8;
|
2425 |
+
$iincreaser = 4;
|
2426 |
+
$thumbtimecode = "";
|
2427 |
+
$dofirstframe = false;
|
2428 |
+
break;
|
2429 |
+
case 50:
|
2430 |
+
$numberofthumbs = 8;
|
2431 |
+
$iincreaser = 8;
|
2432 |
+
$thumbtimecode = "";
|
2433 |
+
$dofirstframe = false;
|
2434 |
+
break;
|
2435 |
+
case 75:
|
2436 |
+
$numberofthumbs = 8;
|
2437 |
+
$iincreaser = 12;
|
2438 |
+
$thumbtimecode = "";
|
2439 |
+
$dofirstframe = false;
|
2440 |
+
break;
|
2441 |
+
}
|
2442 |
+
|
2443 |
+
$thumb_output = kgvid_make_thumbs($post_id, $movieurl, $numberofthumbs, 1, $iincreaser, $thumbtimecode, $dofirstframe, 'generate');
|
2444 |
+
$thumb_id = kgvid_save_thumb($post_id, $post->post_title, $thumb_output['thumb_url']);
|
2445 |
+
update_post_meta($post_id, '_kgflashmediaplayer-poster', $thumb_output['thumb_url']);
|
2446 |
+
update_post_meta($post_id, '_kgflashmediaplayer-poster-id', $thumb_id);
|
2447 |
+
if( $options['featured'] == "on" ) {
|
2448 |
+
if ( !empty($thumb_id) && $post->post_parent ) { set_post_thumbnail($post->post_parent, $thumb_id); }
|
2449 |
+
}
|
2450 |
+
|
2451 |
+
}
|
2452 |
+
|
2453 |
+
if ( $options['auto_encode'] == "on" ) {
|
2454 |
+
$video_formats = kgvid_video_formats();
|
2455 |
+
$encode_checked = array();
|
2456 |
+
foreach ( $video_formats as $format => $format_stats ) {
|
2457 |
+
if ( $options['encode_'.$format] == "on" ) { $encode_checked[$format] = "true"; }
|
2458 |
+
else { $encode_checked[$format] = "notchecked"; }
|
2459 |
+
}
|
2460 |
+
$output = kgvid_enqueue_videos($post_id, $movieurl, $encode_checked, $post->post_parent);
|
2461 |
+
$output = kgvid_encode_videos();
|
2462 |
+
}
|
2463 |
+
}
|
2464 |
+
add_action('kgvid_cron_new_attachment', 'kgvid_cron_new_attachment_handler');
|
2465 |
+
|
2466 |
+
/**
|
2467 |
+
* Adding our custom fields to the $form_fields array
|
2468 |
+
*
|
2469 |
+
* @param array $form_fields
|
2470 |
+
* @param object $post
|
2471 |
+
* @return array
|
2472 |
+
*/
|
2473 |
+
function kgvid_image_attachment_fields_to_edit($form_fields, $post) {
|
2474 |
|
2475 |
$options = get_option('kgvid_video_embed_options');
|
2476 |
|
2477 |
+
if ( substr($post->post_mime_type, 0, 5) == 'video'
|
2478 |
+
&& (empty($post->post_parent) || (strpos(get_post_mime_type( $post->post_parent ), 'video') === false && get_post_meta($post->ID, '_kgflashmediaplayer-externalurl', true) == false))
|
2479 |
+
) { //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
|
2480 |
|
2481 |
+
wp_enqueue_media(); //allows using the media modal in the Media Library
|
2482 |
|
2483 |
+
$field_id = kgvid_backwards_compatible($post->ID);
|
2484 |
$movieurl = wp_get_attachment_url($post->ID);
|
2485 |
+
$moviefile = get_attached_file($post->ID);
|
2486 |
+
$video_meta = array();
|
2487 |
+
if ( function_exists('wp_read_video_metadata') ) { $video_meta = wp_read_video_metadata($moviefile); }
|
2488 |
+
|
2489 |
$form_fields["kgflashmediaplayer-url"]["input"] = "hidden";
|
2490 |
$form_fields["kgflashmediaplayer-url"]["value"] = $movieurl;
|
2491 |
|
2492 |
$maxwidth = $options['width'];
|
2493 |
+
if ( $options['minimum_width'] == "on" ) { $widthset = $maxwidth; }
|
2494 |
+
else { $widthset = get_post_meta($post->ID, "_kgflashmediaplayer-width", true); }
|
2495 |
+
if ($widthset == "") {
|
2496 |
+
if ( $video_meta && array_key_exists('width', $video_meta) ) { $widthset = $video_meta['width']; }
|
2497 |
+
else { $widthset = $maxwidth; }
|
2498 |
+
}
|
2499 |
|
2500 |
$form_fields["kgflashmediaplayer-maxwidth"]["input"] = "hidden";
|
2501 |
$form_fields["kgflashmediaplayer-maxwidth"]["value"] = $maxwidth;
|
2502 |
|
2503 |
$maxheight = $options['height'];
|
2504 |
+
if ( $options['minimum_width'] == "on" ) { $heightset = $maxheight; }
|
2505 |
+
else { $heightset = get_post_meta($post->ID, "_kgflashmediaplayer-height", true); }
|
2506 |
+
if ($heightset == "") {
|
2507 |
+
if ( $video_meta && array_key_exists('height', $video_meta) ) { $heightset = $video_meta['height']; }
|
2508 |
+
else { $heightset = $maxheight; }
|
2509 |
+
}
|
2510 |
|
2511 |
$form_fields["kgflashmediaplayer-maxheight"]["input"] = "hidden";
|
2512 |
$form_fields["kgflashmediaplayer-maxheight"]["value"] = $maxheight;
|
2515 |
$form_fields["kgflashmediaplayer-aspect"]["value"] = $heightset/$widthset;
|
2516 |
|
2517 |
$embedset = get_post_meta($post->ID, "_kgflashmediaplayer-embed", true);
|
2518 |
+
if ($embedset == "") {
|
2519 |
+
$embedset = "Single Video";
|
2520 |
update_post_meta($post->ID, '_kgflashmediaplayer-embed', $embedset); //make sure at least this value is set before attachment is inserted into post
|
2521 |
}
|
2522 |
|
2534 |
else { if ( !kgvid_url_exists($thumbnail_url) ) { $thumbnail_url = ""; } }
|
2535 |
|
2536 |
$thumbnail_html = "";
|
2537 |
+
if ($thumbnail_url != "" ) {
|
2538 |
+
$thumbnail_html = '<div class="kgvid_thumbnail_box kgvid_chosen_thumbnail_box"><img width="200" src="'.$thumbnail_url.'"></div>';
|
2539 |
}
|
2540 |
|
2541 |
$numberofthumbs_value = get_post_meta($post->ID, "_kgflashmediaplayer-numberofthumbs", true);
|
2542 |
if (get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true) != "") { $numberofthumbs_value = "1"; }
|
2543 |
if ( empty($numberofthumbs_value) ) { $numberofthumbs_value = $options['generate_thumbs']; }
|
2544 |
|
2545 |
+
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
|
2546 |
kgvid_check_ffmpeg_exists($options, true);
|
2547 |
}
|
2548 |
|
2549 |
+
$randomizechecked = get_post_meta($post->ID, "_kgflashmediaplayer-randomize", true);
|
2550 |
$forcefirstchecked = get_post_meta($post->ID, "_kgflashmediaplayer-forcefirst", true);
|
2551 |
|
2552 |
$featuredchecked = get_post_meta($post->ID, "_kgflashmediaplayer-featured", true);
|
2559 |
|
2560 |
$nonce = wp_create_nonce('video-embed-thumbnail-generator-nonce');
|
2561 |
|
2562 |
+
$starts = intval(get_post_meta($post->ID, "_kgflashmediaplayer-starts", true));
|
2563 |
+
$completeviews = intval(get_post_meta($post->ID, "_kgflashmediaplayer-completeviews", true));
|
2564 |
+
|
2565 |
+
$form_fields["views"]["label"] = __("Video Stats");
|
2566 |
+
$form_fields["views"]["input"] = "html";
|
2567 |
+
$form_fields["views"]["html"] = $starts." Starts, ".$completeviews." Complete Views";
|
2568 |
+
|
2569 |
+
$update_script = "";
|
2570 |
+
$created_time = time()-get_post_time('U', true, $post->ID);
|
2571 |
+
if ( $created_time < 60 && ($options['auto_encode'] == "on" || $options['auto_thumb'] == "on") ) {
|
2572 |
+
$update_script = '<script type="text/javascript">jQuery(document).ready(function() { ';
|
2573 |
+
if ( $options['ffmpeg_exists'] == "on" && $options['auto_encode'] == "on" ) {
|
2574 |
+
$update_script .= 'percent_timeout = setTimeout(function(){ kgvid_redraw_encode_checkboxes("'.$movieurl.'", "'.$post->ID.'", "attachment") }, 5000); jQuery(\'#wpwrap\').data("KGVIDCheckboxTimeout", percent_timeout);';
|
2575 |
+
}
|
2576 |
+
if ( $options['ffmpeg_exists'] == "on" && $options['auto_thumb'] == "on" ) {
|
2577 |
+
if ( !$thumbnail_url ) { $thumbnail_html = '<div class="kgvid_thumbnail_box kgvid_chosen_thumbnail_box" style="height:112px;"><span style="margin-top: 45px;
|
2578 |
+
display: inline-block;">Loading thumbnail...</span></div>'; }
|
2579 |
+
$update_script .= ' setTimeout(function(){ kgvid_redraw_thumbnail_box("'.$post->ID.'") }, 5000);';
|
2580 |
+
}
|
2581 |
+
$update_script .= '});</script>';
|
2582 |
+
}
|
2583 |
+
|
2584 |
+
$choose_from_video_content = "";
|
2585 |
+
$generate_content = "";
|
2586 |
+
$thumbnail_timecode = "";
|
2587 |
+
|
2588 |
+
if ( current_user_can('make_video_thumbnails') ) {
|
2589 |
+
$moviefiletype = pathinfo($movieurl, PATHINFO_EXTENSION);
|
2590 |
+
$h264compatible = array("mp4", "mov", "m4v");
|
2591 |
+
if ( $moviefiletype == "mov" || $moviefiletype == "m4v" ) { $moviefiletype = "mp4"; }
|
2592 |
+
|
2593 |
+
$video_formats = array(
|
2594 |
+
"original" => $moviefiletype,
|
2595 |
+
"1080" => "mp4",
|
2596 |
+
"720" => "mp4",
|
2597 |
+
"mobile" => "mp4",
|
2598 |
+
"webm" => "webm",
|
2599 |
+
"ogg" => "ogg"
|
2600 |
+
);
|
2601 |
+
$encodevideo_info = kgvid_encodevideo_info($movieurl, $post->ID);
|
2602 |
+
if ( in_array($moviefiletype, $h264compatible) ) {
|
2603 |
+
$encodevideo_info["original_exists"] = true;
|
2604 |
+
$encodevideo_info["originalurl"] = $movieurl;
|
2605 |
+
}
|
2606 |
+
else { $encodevideo_info["original_exists"] = false; }
|
2607 |
+
|
2608 |
+
$sources = array();
|
2609 |
+
foreach ($video_formats as $name => $type) {
|
2610 |
+
if ( $name != "original" && $encodevideo_info[$name."url"] == $movieurl ) { unset($sources['original']); }
|
2611 |
+
if ( $encodevideo_info[$name."_exists"] ) { $sources[$name] = '<source src="'.$encodevideo_info[$name."url"].'" type="video/'.$type.'">'; }
|
2612 |
+
}
|
2613 |
+
|
2614 |
+
$choose_from_video_content = '<div style="display:none;" class="kgvid_thumbnail_box kgvid-tabs-content" id="thumb-video-'.$post->ID.'-container">
|
2615 |
+
<div class="kgvid-reveal-thumb-video" onclick="kgvid_reveal_thumb_video('.$post->ID.')" id="show-thumb-video-'.$post->ID.'"><span class="kgvid-right-arrow"></span><span class="kgvid-show-video">Choose from video...</span></div>
|
2616 |
+
<div style="display:none;" id="thumb-video-'.$post->ID.'-player">
|
2617 |
+
<video preload="metadata" class="kgvid-thumb-video" width="200" data-allowed="'.$options['browser_thumbnails'].'" onloadedmetadata="kgvid_thumb_video_loaded(\''.$post->ID.'\');" id="thumb-video-'.$post->ID.'" controls>'.
|
2618 |
+
implode("\n", $sources).'
|
2619 |
+
</video>
|
2620 |
+
<div class="kgvid-video-controls">
|
2621 |
+
<div class="kgvid-play-pause"></div>
|
2622 |
+
<div class="kgvid-seek-bar">
|
2623 |
+
<div class="kgvid-play-progress"></div>
|
2624 |
+
<div class="kgvid-seek-handle"></div></div>
|
2625 |
+
</div>
|
2626 |
+
<span id="manual-thumbnail" class="button-secondary" onclick="kgvid_thumb_video_manual('.$post->ID.');">Use this frame</span>
|
2627 |
+
</div>
|
2628 |
+
</div>';
|
2629 |
+
|
2630 |
+
$generate_content = '<div id="generate-thumb-'.$post->ID.'-container" class="kgvid-tabs-content">
|
2631 |
+
<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.'/>
|
2632 |
+
<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.'/>
|
2633 |
+
<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.'/>
|
2634 |
+
<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>';
|
2635 |
+
|
2636 |
+
$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>';
|
2637 |
|
2638 |
}
|
2639 |
|
2640 |
$form_fields["generator"]["label"] = __("Thumbnails");
|
2641 |
$form_fields["generator"]["input"] = "html";
|
2642 |
+
$form_fields["generator"]["html"] = '<input type="hidden" name="attachments['.$post->ID.'][kgflashmediaplayer-security]" id="attachments-'.$post->ID.'-kgflashmediaplayer-security" value="'.$nonce.'" />
|
2643 |
+
'.$choose_from_video_content.'
|
2644 |
+
'.$generate_content.'
|
2645 |
+
'.$thumbnail_timecode.'
|
2646 |
+
<div id="attachments-'.$post->ID.'-thumbnailplaceholder">'. $thumbnail_html .'</div>
|
2647 |
+
<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 />
|
2648 |
+
<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;
|
|
|
|
|
|
|
2649 |
|
2650 |
$form_fields["kgflashmediaplayer-poster"]["label"] = __("Thumbnail URL");
|
2651 |
$form_fields["kgflashmediaplayer-poster"]["value"] = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
|
2657 |
|
2658 |
$form_fields["kgflashmediaplayer-dimensions"]["label"] = __("Video Embed Dimensions");
|
2659 |
$form_fields["kgflashmediaplayer-dimensions"]["input"] = "html";
|
2660 |
+
$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;" onchange="kgvid_set_dimension('.$post->ID.', \'height\', this.value);" onkeyup="kgvid_set_dimension('.$post->ID.', \'height\', this.value);"> Height:
|
2661 |
<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 />
|
2662 |
+
<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.'>
|
2663 |
<label for="attachments-'. $post->ID .'-kgflashmediaplayer-lockaspect"><small>Lock to aspect ratio</small></label>';
|
2664 |
$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'>default dimensions</a>.</small>";
|
2665 |
|
2670 |
$form_fields["kgflashmediaplayer-encode"]["input"] = "html";
|
2671 |
$form_fields["kgflashmediaplayer-encode"]["html"] = $checkboxes;
|
2672 |
|
2673 |
+
|
2674 |
$showtitlechecked = get_post_meta($post->ID, "_kgflashmediaplayer-showtitle", true);
|
2675 |
if ( $showtitlechecked == "notchecked" ) { $showtitlechecked = ""; }
|
2676 |
$downloadlinkchecked = get_post_meta($post->ID, "_kgflashmediaplayer-downloadlink", true);
|
2687 |
|
2688 |
$form_fields["kgflashmediaplayer-options"]["label"] = __("Video Embed Options");
|
2689 |
$form_fields["kgflashmediaplayer-options"]["input"] = "html";
|
2690 |
+
$form_fields["kgflashmediaplayer-options"]["html"] = '<input type="checkbox" name="attachments['.$post->ID.'][kgflashmediaplayer-showtitle]" id="attachments-'.$post->ID.'-kgflashmediaplayer-showtitle" value="checked" '.$showtitlechecked.'>
|
2691 |
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-showtitle">Insert title above video</label><br />
|
2692 |
|
2693 |
+
<input type="checkbox" name="attachments['.$post->ID.'][kgflashmediaplayer-downloadlink]" id="attachments-'.$post->ID.'-kgflashmediaplayer-downloadlink" value="checked" '.$downloadlinkchecked.'>
|
2694 |
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-downloadlink">Insert download link below video<em><small><br />Makes it easier for users to download file.</em></small></label><br />
|
2695 |
+
<label for="attachments-'.$post->ID.'-kgflashmediaplayer-embed">Insert</label>
|
2696 |
'.$shortcode_select.'
|
2697 |
+
<script type="text/javascript">jQuery(document).ready(function(){kgvid_hide_standard_wordpress_display_settings('.$post->ID.');});</script>';
|
2698 |
|
2699 |
if ( get_post_meta($post->ID, "_kgflashmediaplayer-embed", true) == "Video Gallery" ) {
|
2700 |
|
2701 |
$gallery_thumb_width = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_thumb_width", true);
|
2702 |
if ( empty($gallery_thumb_width) ) { $gallery_thumb_width = $options['gallery_thumb']; }
|
2703 |
+
|
2704 |
$gallery_exclude = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_exclude", true);
|
2705 |
$gallery_include = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_include", true);
|
2706 |
$gallery_orderby = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_orderby", true);
|
2707 |
$gallery_order = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_order", true);
|
2708 |
+
|
2709 |
$gallery_id = get_post_meta($post->ID, "_kgflashmediaplayer-gallery_id", true);
|
2710 |
if ( empty($gallery_id) ) { $gallery_id = $post->post_parent; }
|
2711 |
+
|
2712 |
$items = array("menu_order", "title", "post_date", "rand", "ID");
|
2713 |
$gallery_orderby_select = '<select name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_orderby]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_orderby">';
|
2714 |
foreach($items as $item) {
|
2716 |
$gallery_orderby_select .= "<option value='$item' $selected>$item</option>";
|
2717 |
}
|
2718 |
$gallery_orderby_select .= "</select>";
|
2719 |
+
|
2720 |
$items = array("ASC", "DESC");
|
2721 |
$gallery_order_select = '<select name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_order]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_order">';
|
2722 |
foreach($items as $item) {
|
2735 |
<input name="attachments['.$post->ID.'][kgflashmediaplayer-gallery_id]" id="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_id" type ="text" value="'.$gallery_id.'" style="width:50px;"> <label for="attachments-'.$post->ID.'-kgflashmediaplayer-gallery_id">Post ID</label>
|
2736 |
';
|
2737 |
|
2738 |
+
}//if video gallery
|
2739 |
} //only add fields if attachment is the right kind of video
|
2740 |
+
return $form_fields;
|
2741 |
+
}
|
2742 |
+
// attach our function to the correct hook
|
2743 |
+
add_filter("attachment_fields_to_edit", "kgvid_image_attachment_fields_to_edit", null, 2);
|
2744 |
+
|
2745 |
+
function kgvid_hide_video_children($wp_query_obj) {
|
2746 |
+
|
2747 |
+
if ( is_admin()
|
2748 |
+
&& !array_key_exists('post_mime_type', $wp_query_obj->query_vars) //show children when specifically displaying videos
|
2749 |
+
&& array_key_exists('posts_per_page', $wp_query_obj->query_vars)
|
2750 |
+
&& $wp_query_obj->query_vars['posts_per_page'] > 0 ) { //hide children only when showing paged content (makes sure that -1 will actually return all attachments)
|
2751 |
+
$wp_query_obj->set(
|
2752 |
+
'meta_query',
|
2753 |
+
array(
|
2754 |
+
array(
|
2755 |
+
'key' => '_kgflashmediaplayer-format',
|
2756 |
+
'compare' => 'NOT EXISTS'
|
2757 |
+
)
|
2758 |
+
)
|
2759 |
+
);
|
2760 |
+
|
2761 |
+
}
|
2762 |
+
|
2763 |
+
}
|
2764 |
+
add_action('pre_get_posts','kgvid_hide_video_children');
|
2765 |
+
|
2766 |
+
function kgvid_change_video_icon($icon, $mime, $post_id) {
|
2767 |
+
|
2768 |
+
$post = get_post($post_id);
|
2769 |
+
|
2770 |
+
if ( substr($mime, 0, 5) == 'video' ) {
|
2771 |
+
if ( strpos(get_post_mime_type( $post->post_parent ), 'video') !== false || get_post_meta($post->ID, '_kgflashmediaplayer-externalurl', true) != false ) {
|
2772 |
+
$post_id = $post->post_parent; //use post parent if this is a child video or encoded from an external url
|
2773 |
+
}
|
2774 |
+
$poster_id = get_post_meta($post_id, '_kgflashmediaplayer-poster-id', true);
|
2775 |
+
if ( $poster_id ) {
|
2776 |
+
$poster_src = wp_get_attachment_image_src( $poster_id, 'thumbnail' );
|
2777 |
+
global $_current_video_icon_dir;
|
2778 |
+
$_current_video_icon_dir = dirname($poster_src[0]);
|
2779 |
+
// - Return your icon path
|
2780 |
+
return $poster_src[0].'?kgvid';
|
2781 |
+
}
|
2782 |
+
}
|
2783 |
+
return $icon;
|
2784 |
+
}
|
2785 |
+
add_filter('wp_mime_type_icon', 'kgvid_change_video_icon', 10, 3);
|
2786 |
+
|
2787 |
+
function kgvid_video_icon_dir($dir) {
|
2788 |
+
|
2789 |
+
global $_current_video_icon_dir;
|
2790 |
+
if(!empty($_current_video_icon_dir))
|
2791 |
+
{
|
2792 |
+
$var = $_current_video_icon_dir;
|
2793 |
+
$_current_video_icon_dir = null; //reset icon_dir if there's no thumbnail set
|
2794 |
+
return $var;
|
2795 |
+
}
|
2796 |
+
return $dir;
|
2797 |
+
|
2798 |
+
}
|
2799 |
+
add_filter('icon_dir', 'kgvid_video_icon_dir');
|
2800 |
+
|
2801 |
+
/* function kgvid_add_theme_support() {
|
2802 |
+
add_post_type_support( 'attachment:video', 'thumbnail' );
|
2803 |
+
add_theme_support( 'post-thumbnails', 'attachment:video' );
|
2804 |
+
}
|
2805 |
+
add_action( 'after_setup_theme', 'kgvid_add_theme_support' ); */
|
2806 |
+
|
2807 |
+
function kgvid_ajax_save_html5_thumb() {
|
2808 |
+
|
2809 |
+
if ( current_user_can('make_video_thumbnails') ) {
|
2810 |
+
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
2811 |
+
$uploads = wp_upload_dir();
|
2812 |
+
$post_id = $_POST['postID'];
|
2813 |
+
$raw_png = $_POST['raw_png'];
|
2814 |
+
$video_url = $_POST['url'];
|
2815 |
+
$movieoffset = $_POST['offset'];
|
2816 |
+
$total = $_POST['total'];
|
2817 |
+
$index = $_POST['index']+1;
|
2818 |
+
|
2819 |
+
$posterfile = sanitize_file_name(pathinfo($video_url, PATHINFO_FILENAME)).'_thumb'.$movieoffset;
|
2820 |
+
if (!file_exists($uploads['path'].'/thumb_tmp')) { mkdir($uploads['path'].'/thumb_tmp'); }
|
2821 |
+
$tmp_posterpath = $uploads['path'].'/thumb_tmp/'.$posterfile.'.png';
|
2822 |
+
$thumb_url = $uploads['url'].'/'.$posterfile.'.jpg';
|
2823 |
+
|
2824 |
+
$raw_png = str_replace('data:image/png;base64,', '', $raw_png);
|
2825 |
+
$raw_png = str_replace(' ', '+', $raw_png);
|
2826 |
+
$decoded_png = base64_decode($raw_png);
|
2827 |
+
$success = file_put_contents($tmp_posterpath, $decoded_png);
|
2828 |
+
|
2829 |
+
$editor = wp_get_image_editor( $tmp_posterpath );
|
2830 |
+
$new_image_info = $editor->save( $uploads['path'].'/thumb_tmp/'.$posterfile.'.jpg', 'image/jpeg' );
|
2831 |
+
unlink($tmp_posterpath);
|
2832 |
+
if ( $total > 1 ) {
|
2833 |
+
$post_name = get_the_title($post_id);
|
2834 |
+
$thumb_id = kgvid_save_thumb($post_id, $post_name, $thumb_url, $index);
|
2835 |
+
}
|
2836 |
+
kgvid_schedule_cleanup_generated_files('thumbs');
|
2837 |
+
echo ($thumb_url);
|
2838 |
+
die();
|
2839 |
+
}
|
2840 |
+
}
|
2841 |
+
add_action('wp_ajax_kgvid_save_html5_thumb', 'kgvid_ajax_save_html5_thumb');
|
2842 |
+
|
2843 |
+
function kgvid_ajax_save_thumb() {
|
2844 |
+
|
2845 |
+
if ( current_user_can('make_video_thumbnails') ) {
|
2846 |
+
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
2847 |
+
$post_id = $_POST['post_id'];
|
2848 |
+
$thumb_url = $_POST['thumburl'];
|
2849 |
+
if ( isset($_POST['index']) ) { $index = $_POST['index']+1; }
|
2850 |
+
else { $index = false; }
|
2851 |
+
|
2852 |
+
if ( is_numeric($post_id) ) {
|
2853 |
+
$post_name = get_the_title($post_id);
|
2854 |
+
}
|
2855 |
+
else { $post_name = str_replace('singleurl_','', $post_id); }
|
2856 |
+
|
2857 |
+
$thumb_id = kgvid_save_thumb($post_id, $post_name, $thumb_url, $index);
|
2858 |
+
|
2859 |
+
echo $thumb_id;
|
2860 |
+
die();
|
2861 |
+
}
|
2862 |
+
|
2863 |
+
}
|
2864 |
+
add_action('wp_ajax_kgvid_save_thumb', 'kgvid_ajax_save_thumb');
|
2865 |
+
|
2866 |
+
function kgvid_save_thumb($post_id, $post_name, $thumb_url, $index=false) {
|
2867 |
|
|
|
|
|
2868 |
$options = get_option('kgvid_video_embed_options');
|
2869 |
$uploads = wp_upload_dir();
|
2870 |
+
|
2871 |
$posterfile = pathinfo($thumb_url, PATHINFO_BASENAME);
|
2872 |
$tmp_posterpath = $uploads['path'].'/thumb_tmp/'.$posterfile;
|
2873 |
$final_posterpath = $uploads['path'].'/'.$posterfile;
|
2874 |
if ( !is_file($final_posterpath) ) { //if the file doesn't already exist
|
2875 |
+
if ( is_file($tmp_posterpath) ) {
|
2876 |
+
copy($tmp_posterpath, $final_posterpath);
|
|
|
|
|
|
|
|
|
2877 |
}
|
|
|
2878 |
}
|
2879 |
+
|
2880 |
//insert the $thumb_url into the media library if it does not already exist
|
2881 |
+
|
2882 |
+
usleep(250000);
|
2883 |
+
|
2884 |
+
$relative_upload_path = array_pop(explode($uploads['baseurl'].'/', $thumb_url));
|
2885 |
+
|
2886 |
+
$args = array(
|
2887 |
+
'numberposts' => '-1',
|
2888 |
+
'post_type' => 'attachment',
|
2889 |
+
'meta_key' => '_wp_attached_file',
|
2890 |
+
'meta_value' => $relative_upload_path
|
2891 |
+
);
|
2892 |
+
|
2893 |
+
$posts = get_posts($args);
|
2894 |
+
|
2895 |
+
if ( $posts ) { $thumb_id = $posts[0]->ID; }
|
2896 |
+
|
2897 |
+
else { //no existing post with this filename
|
2898 |
+
|
2899 |
$desc = $post_name . ' thumbnail';
|
2900 |
+
if ( $index ) { $desc .= ' '.$index; }
|
2901 |
|
2902 |
//is image in uploads directory?
|
2903 |
$upload_dir = wp_upload_dir();
|
2904 |
+
|
2905 |
+
$video = get_post($post_id);
|
2906 |
if ( $options['thumb_parent'] == "post" ) {
|
2907 |
if ( !empty($video->post_parent) ) { $post_id = $video->post_parent; }
|
2908 |
}
|
2912 |
$filename = preg_replace('/\.[^.]+$/', '', basename($thumb_url));
|
2913 |
|
2914 |
$attachment = array(
|
2915 |
+
'guid' => $thumb_url,
|
2916 |
'post_mime_type' => $wp_filetype['type'],
|
2917 |
'post_title' => $desc,
|
2918 |
'post_content' => '',
|
2925 |
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
2926 |
$attach_data = wp_generate_attachment_metadata( $thumb_id, $uploads['path'].'/'.$posterfile );
|
2927 |
wp_update_attachment_metadata( $thumb_id, $attach_data );
|
2928 |
+
}
|
2929 |
else { //not in uploads so we'll have to sideload it
|
2930 |
$tmp = download_url( $thumb_url );
|
2931 |
|
2940 |
@unlink($file_array['tmp_name']);
|
2941 |
$file_array['tmp_name'] = '';
|
2942 |
}
|
2943 |
+
|
2944 |
// do the validation and storage stuff
|
2945 |
$thumb_id = media_handle_sideload( $file_array, $post_id, $desc );
|
2946 |
|
2953 |
if ( $local_src = wp_get_attachment_url( $thumb_id ) ) {
|
2954 |
update_post_meta($post_id, '_kgflashmediaplayer-poster', $local_src);
|
2955 |
}
|
2956 |
+
|
2957 |
} //end sideload
|
2958 |
+
|
2959 |
+
$thumb_id = intval( $thumb_id );
|
2960 |
update_post_meta($post_id, '_kgflashmediaplayer-poster-id', $thumb_id);
|
2961 |
+
//set_post_thumbnail($post_id, $thumb_id);
|
2962 |
update_post_meta($thumb_id, '_kgflashmediaplayer-video-id', $video->ID);
|
2963 |
+
|
2964 |
} //end get_attachment_id_from_src
|
2965 |
|
2966 |
if(!is_wp_error($thumb_id)) {
|
2967 |
+
|
2968 |
return $thumb_id;
|
2969 |
}
|
2970 |
|
2971 |
}
|
2972 |
|
2973 |
+
function kgvid_ajax_redraw_thumbnail_box() {
|
2974 |
+
|
2975 |
+
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
2976 |
+
|
2977 |
+
$post_id = $_POST['post_id'];
|
2978 |
+
$thumb_url = get_post_meta($post_id, "_kgflashmediaplayer-poster", true);
|
2979 |
+
echo $thumb_url;
|
2980 |
+
die();
|
2981 |
+
|
2982 |
+
}
|
2983 |
+
add_action('wp_ajax_kgvid_redraw_thumbnail_box', 'kgvid_ajax_redraw_thumbnail_box');
|
2984 |
+
|
2985 |
+
/**
|
2986 |
+
* @param array $post
|
2987 |
+
* @param array $attachment
|
2988 |
+
* @return array
|
2989 |
+
*/
|
2990 |
+
function kgvid_video_attachment_fields_to_save($post, $attachment) {
|
2991 |
+
// $attachment part of the form $_POST ($_POST[attachments][postID])
|
2992 |
+
// $post attachments wp post array - will be saved after returned
|
2993 |
+
// $post['post_type'] == 'attachment'
|
2994 |
if( !empty($post['ID']) ) {
|
2995 |
$thumb_id = "";
|
2996 |
if( isset($attachment['kgflashmediaplayer-poster']) ) {
|
2997 |
+
|
2998 |
$thumb_url = $attachment['kgflashmediaplayer-poster'];
|
2999 |
+
if ( !empty($thumb_url) ) {
|
3000 |
+
$thumb_id = kgvid_save_thumb($post['ID'], $post['post_title'], $thumb_url);
|
3001 |
+
if ( $thumb_id ) { update_post_meta($post['ID'], '_kgflashmediaplayer-poster-id', $thumb_id); }
|
3002 |
+
}
|
3003 |
+
else {
|
3004 |
+
delete_post_meta($post['ID'], '_kgflashmediaplayer-poster');
|
3005 |
+
delete_post_meta($post['ID'], '_kgflashmediaplayer-poster-id');
|
3006 |
+
}
|
3007 |
update_post_meta($post['ID'], '_kgflashmediaplayer-poster', $thumb_url);
|
|
|
3008 |
}
|
3009 |
+
|
3010 |
if( isset($attachment['kgflashmediaplayer-numberofthumbs']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-numberofthumbs', $attachment['kgflashmediaplayer-numberofthumbs']); }
|
3011 |
if( isset($attachment['kgflashmediaplayer-forcefirst']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-forcefirst', $attachment['kgflashmediaplayer-forcefirst']); }
|
3012 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-forcefirst', ""); }
|
3013 |
+
if( isset($attachment['kgflashmediaplayer-featured']) ) {
|
3014 |
update_post_meta($post['ID'], '_kgflashmediaplayer-featured', $attachment['kgflashmediaplayer-featured']);
|
3015 |
if ( !empty($thumb_id) && array_key_exists('post_parent', $post) ) { set_post_thumbnail($post['post_parent'], $thumb_id); }
|
3016 |
}
|
3021 |
if( isset($attachment['kgflashmediaplayer-aspect']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-aspect', $attachment['kgflashmediaplayer-aspect']); }
|
3022 |
if( isset($attachment['kgflashmediaplayer-lockaspect']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-lockaspect', $attachment['kgflashmediaplayer-lockaspect']); }
|
3023 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-lockaspect', "notchecked"); }
|
3024 |
+
|
3025 |
+
$video_formats = kgvid_video_formats();
|
3026 |
foreach ( $video_formats as $format => $format_stats ) {
|
3027 |
if( isset($attachment['kgflashmediaplayer-encode'.$format]) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-encode'.$format, "on"); }
|
3028 |
+
else { update_post_meta($post['ID'], '_kgflashmediaplayer-encode'.$format, "false"); }
|
|
|
3029 |
}
|
3030 |
+
|
3031 |
if( isset($attachment['kgflashmediaplayer-showtitle']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', $attachment['kgflashmediaplayer-showtitle']); }
|
3032 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', "notchecked"); }
|
3033 |
+
|
3034 |
if( isset($attachment['kgflashmediaplayer-downloadlink']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-downloadlink', $attachment['kgflashmediaplayer-downloadlink']); }
|
3035 |
else { update_post_meta($post['ID'], '_kgflashmediaplayer-downloadlink', "notchecked"); }
|
3036 |
+
|
3037 |
if( isset($attachment['kgflashmediaplayer-embed']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-embed', $attachment['kgflashmediaplayer-embed']); }
|
3038 |
if( isset($attachment['kgflashmediaplayer-gallery_thumb_width']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_thumb_width', $attachment['kgflashmediaplayer-gallery_thumb_width']); }
|
3039 |
if( isset($attachment['kgflashmediaplayer-gallery_exclude']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_exclude', $attachment['kgflashmediaplayer-gallery_exclude']); }
|
3041 |
if( isset($attachment['kgflashmediaplayer-gallery_orderby']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_orderby', $attachment['kgflashmediaplayer-gallery_orderby']); }
|
3042 |
if( isset($attachment['kgflashmediaplayer-gallery_order']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_order', $attachment['kgflashmediaplayer-gallery_order']); }
|
3043 |
if( isset($attachment['kgflashmediaplayer-gallery_id']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-gallery_id', $attachment['kgflashmediaplayer-gallery_id']); }
|
3044 |
+
|
3045 |
}
|
3046 |
return $post;
|
3047 |
}
|
3048 |
add_filter("attachment_fields_to_save", "kgvid_video_attachment_fields_to_save", null, 2);
|
3049 |
|
3050 |
+
function kgvid_sync_thumbnail_with_featured ( $meta_id, $post_id, $meta_key, $meta_value ) {
|
3051 |
+
|
3052 |
+
if ( $meta_key == "_kgflashmediaplayer-poster-id" ) { set_post_thumbnail($post_id, $meta_value); }
|
3053 |
+
|
3054 |
+
}
|
3055 |
+
add_action( 'updated_post_meta', 'kgvid_sync_thumbnail_with_featured', 10, 4 );
|
3056 |
+
|
3057 |
+
class kgInsertMedia {
|
3058 |
+
//class constructor
|
3059 |
+
function kgInsertMedia () {
|
3060 |
+
add_filter('media_send_to_editor', array($this, 'kgmodifyMediaInsert') , 10, 3);
|
3061 |
+
}
|
3062 |
+
//function that does the modifying
|
3063 |
+
function kgmodifyMediaInsert($html, $attachment_id, $attachment) {
|
3064 |
|
3065 |
$options = get_option('kgvid_video_embed_options');
|
3066 |
$output = $html;
|
3082 |
$endtitlecode = str_replace("<", "</", $titlecode);
|
3083 |
$endtitlecode_array = explode(' ', $endtitlecode);
|
3084 |
if ( substr($endtitlecode_array[0], -1) != ">" ) { $endtitlecode = $endtitlecode_array[0].">"; }
|
3085 |
+
$output .= $titlecode.'<span itemprop="name">'.$attachment["title"].'</span>'.$endtitlecode.'<br />';
|
3086 |
}
|
3087 |
$output .= '[KGVID';
|
3088 |
if ($attachment['poster'] !="") { $output .= ' poster="'.$attachment["poster"].'"'; }
|
3091 |
if ($attachment['downloadlink'] == "checked") { $output .= ' downloadlink="true"'; }
|
3092 |
$output .= ']'.$attachment["url"].'[/KGVID]<br />';
|
3093 |
} //if embed code is enabled
|
3094 |
+
|
3095 |
if ($attachment['embed'] == "Video Gallery" ) {
|
3096 |
+
|
3097 |
+
$attachment['gallery_thumb'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_thumb_width", true);
|
3098 |
$attachment['gallery_exclude'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_exclude", true);
|
3099 |
$attachment['gallery_include'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_include", true);
|
3100 |
+
$attachment['gallery_orderby'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_orderby", true);
|
3101 |
$attachment['gallery_order'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_order", true);
|
3102 |
$attachment['gallery_id'] = get_post_meta($attachment_id, "_kgflashmediaplayer-gallery_id", true);
|
3103 |
$post = get_post($attachment_id);
|
3104 |
$parent_id = $post->post_parent;
|
3105 |
+
|
3106 |
$output = "";
|
3107 |
$output .= '[KGVID gallery="true"';
|
3108 |
if ( !empty($attachment['gallery_thumb']) && $attachment['gallery_thumb'] != $options['gallery_thumb'] ) { $output .= ' gallery_thumb="'.$attachment["gallery_thumb"].'"'; }
|
3111 |
if ( !empty($attachment['gallery_orderby']) && $attachment['gallery_orderby'] != "menu_order" ) { $output .= ' gallery_orderby="'.$attachment["gallery_orderby"].'"'; }
|
3112 |
if ( !empty($attachment['gallery_order']) && $attachment['gallery_order'] != "ASC" ) { $output .= ' gallery_order="'.$attachment["gallery_order"].'"'; }
|
3113 |
if ( !empty($attachment['gallery_id']) && $attachment['gallery_id'] != $parent_id ) { $output .= ' gallery_id="'.$attachment["gallery_id"].'"'; }
|
3114 |
+
$output .= ']';
|
3115 |
}
|
3116 |
+
|
3117 |
+
return $output;
|
3118 |
+
}
|
3119 |
+
}
|
3120 |
+
//instantiate the class
|
3121 |
+
$kgIM = new kgInsertMedia();
|
3122 |
|
3123 |
function kgvid_embedurl_menu($tabs) {
|
3124 |
$newtab = array('embedurl' => __('Embed Video from URL', 'kgoutsidevideo'));
|
3129 |
function media_embedurl_process() {
|
3130 |
|
3131 |
$options = get_option('kgvid_video_embed_options');
|
3132 |
+
|
3133 |
+
if ( !isset($options['ffmpeg_exists']) || $options['ffmpeg_exists'] == "notchecked" ) {
|
3134 |
kgvid_check_ffmpeg_exists($options, true);
|
3135 |
$options = get_option('kgvid_video_embed_options');
|
3136 |
}
|
3137 |
+
|
3138 |
$video_formats = kgvid_video_formats();
|
3139 |
$checkboxes = kgvid_generate_encode_checkboxes("", "singleurl", "attachment");
|
3140 |
+
|
3141 |
$maxheight = $options['height'];
|
3142 |
$maxwidth = $options['width'];
|
3143 |
+
|
3144 |
media_upload_header();
|
3145 |
?>
|
3146 |
<form class="media-upload-form type-form validate" id="kgvid-form" enctype="multipart/form-data" method="post" action="">
|
3147 |
+
|
3148 |
<div id="media-items">
|
3149 |
<div class="media-item media-blank">
|
3150 |
<table id="kgflashmediaplayer-table" class="describe">
|
3159 |
<td class="field"><input type="text" id="attachments-singleurl-kgflashmediaplayer-url" name="attachments[singleurl][kgflashmediaplayer-url]" value="" size="50" onchange="kgvid_set_singleurl();"/>
|
3160 |
<p class="help"><small>Specify the URL of the video file.</small></p></td>
|
3161 |
</tr>
|
3162 |
+
<?php if ( current_user_can('make_video_thumbnails') ) { ?>
|
3163 |
<tr>
|
3164 |
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="numberofthumbs">Thumbnails</label></span></th>
|
3165 |
+
<td class="field">
|
3166 |
+
<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='';" />
|
3167 |
+
<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" />
|
3168 |
+
<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" />
|
3169 |
+
<input type="checkbox" id="attachments-singleurl-firstframe" onchange="document.getElementById('attachments-singleurl-thumbtime').value ='';" /><label for="attachments-singleurl-firstframe">Force 1st Frame Thumbnail</label><br>
|
3170 |
+
<div id="attachments-singleurl-thumbnailplaceholder"></div>
|
3171 |
+
<span>Thumbnail timecode:</span> <input name="attachments[singleurl][thumbtime]" id="attachments-singleurl-thumbtime" type="text" value="" style="width:60px;"><br>
|
3172 |
+
<input type="checkbox" <?php echo checked( $options["featured"], "on", false ); ?> id="attachments-singleurl-featured" name="attachments[singleurl][kgflashmediaplayer-featured]" /> Set thumbnail as featured image
|
3173 |
+
</td>
|
|
|
3174 |
</tr>
|
3175 |
+
<?php } ?>
|
3176 |
<tr>
|
3177 |
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="attachments-singleurl_kgflashmediaplayer_poster">Thumbnail URL</label></span></th>
|
3178 |
<td class="field"><input type="text" name="attachments[singleurl][kgflashmediaplayer-poster]" id="attachments-singleurl-kgflashmediaplayer-poster" value="" size="50" />
|
3183 |
<td class="field">Width: <input name="attachments[singleurl][kgflashmediaplayer-width]" type="text" value="<?php echo $maxwidth; ?>" id="attachments-singleurl-kgflashmediaplayer-width" type="text" style="width:50px;" onchange="kgvid_set_dimension('singleurl', 'height', this.value);" onkeyup="kgvid_set_dimension('singleurl', 'height', this.value);"> Height: <input name="attachments[singleurl][kgflashmediaplayer-height]" id="attachments-singleurl-kgflashmediaplayer-height" type="text" value="<?php echo $maxheight; ?>" style="width:50px;" 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>Lock to Aspect Ratio</small></label>
|
3184 |
<p class="help"><small>Leave blank to use <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php" target="_blank">default dimensions</a>.</small></p></td>
|
3185 |
</tr>
|
3186 |
+
<?php if ( current_user_can('encode_videos') ) { ?>
|
3187 |
<tr>
|
3188 |
+
<th valign="top" scope="row" class="label"><span class="alignleft"><label for="html5">Additional Formats</span></label></th>
|
3189 |
<td><?php echo $checkboxes; ?></td>
|
3190 |
</tr>
|
3191 |
+
<?php } ?>
|
3192 |
<tr>
|
3193 |
<th valign="top" scope="row" class="label"><span class="alignleft"><label>Options</span></label></th>
|
3194 |
+
<td><input type="checkbox" name="downloadlink" id="downloadlink" value="true" class="field" /><label for="downloadlink">Generate Download Link Below Video <small>(Makes it easier for users to download video file)</small></label></td>
|
3195 |
</tr>
|
3196 |
<tr class="submit">
|
3197 |
<td></td>
|
3202 |
</tbody></table>
|
3203 |
</div>
|
3204 |
</div>
|
3205 |
+
|
3206 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-security]' id='attachments-kgflashmediaplayer-security' value='<?php echo wp_create_nonce('video-embed-thumbnail-generator-nonce'); ?>' />
|
3207 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-maxwidth]' id='attachments-singleurl-kgflashmediaplayer-maxwidth' value='<?php echo($maxwidth); ?>' />
|
3208 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-maxheight]' id='attachments-singleurl-kgflashmediaplayer-maxheight' value='<?php echo($maxheight); ?>' />
|
3211 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-titlecode]' id='attachments-singleurl-kgflashmediaplayer-titlecode' value='<?php echo $options['titlecode']; ?>' />
|
3212 |
<input type='hidden' name='attachments[singleurl][kgflashmediaplayer-ffmpegexists]' id='attachments-singleurl-kgflashmediaplayer-ffmpegexists' value='<?php echo $options['ffmpeg_exists']; ?>' />
|
3213 |
</form>
|
3214 |
+
|
3215 |
<?php
|
3216 |
} //end media_embedurl_process
|
3217 |
|
3234 |
|
3235 |
if ( array_key_exists('sample', $kgvid_video_embed) ) { $url = plugins_url('/images/sample-video-h264.mp4', __FILE__); }
|
3236 |
else { $url = wp_get_attachment_url($post->ID); }
|
3237 |
+
|
3238 |
$poster = get_post_meta($post->ID, "_kgflashmediaplayer-poster", true);
|
3239 |
$downloadlink = get_post_meta($post->ID, '_kgflashmediaplayer-downloadlink', true);
|
3240 |
+
|
3241 |
if ( array_key_exists('width', $kgvid_video_embed) ) { $width = $kgvid_video_embed['width']; }
|
3242 |
else { $width = get_post_meta($post->ID, "_kgflashmediaplayer-width", true); }
|
3243 |
if ( !$width ) { $width = get_post_meta($post->ID, "_kgflashmediaplayer-actualwidth", true); }
|
3244 |
if ( !$width ) { $width = $options['width']; }
|
3245 |
+
|
3246 |
if ( array_key_exists('height', $kgvid_video_embed) ) { $height = $kgvid_video_embed['height']; }
|
3247 |
else { $height = get_post_meta($post->ID, "_kgflashmediaplayer-height", true); }
|
3248 |
if ( !$height ) { $height = get_post_meta($post->ID, "_kgflashmediaplayer-actualheight", true); }
|
3249 |
if ( !$height ) { $width = $options['width']; }
|
3250 |
+
|
3251 |
$shortcode = '[KGVID';
|
3252 |
if ( $poster !="" ) { $shortcode .= ' poster="'.$poster.'"'; }
|
3253 |
if ( $width !="" ) { $shortcode .= ' width="'.$width.'"'; }
|
3254 |
if ( $height !="" ) { $shortcode .= ' height="'.$height.'"'; }
|
3255 |
if ( $downloadlink == "checked" ) { $shortcode .= ' downloadlink="true"'; }
|
3256 |
if (array_key_exists('gallery', $kgvid_video_embed)) { $shortcode .= ' autoplay="true"'; }
|
3257 |
+
if (array_key_exists('sample', $kgvid_video_embed)) {
|
3258 |
if ( $options['overlay_title'] == "on" ) { $shortcode .= ' title="Sample Video"'; }
|
3259 |
if ( $options['overlay_embedcode'] == "on" ) { $shortcode .= ' embedcode="Sample Embed Code"'; }
|
3260 |
+
$shortcode .= ' caption="Captions are shown automatically if entered."';
|
3261 |
}
|
3262 |
//else { $shortcode .= ' view_count="false"'; }
|
3263 |
$shortcode .= ']'.$url.'[/KGVID]';
|
3264 |
+
|
3265 |
return $shortcode;
|
3266 |
|
3267 |
}
|
3270 |
|
3271 |
global $post;
|
3272 |
$options = get_option('kgvid_video_embed_options');
|
3273 |
+
|
3274 |
if ( $options['template'] == "gentle" && strpos($post->post_mime_type, "video") !== false ) {
|
3275 |
$kgvid_video_embed = array(); //no query set
|
3276 |
$content = kgvid_generate_attachment_shortcode($kgvid_video_embed);
|
3284 |
|
3285 |
global $post;
|
3286 |
global $wp_query;
|
3287 |
+
global $content_width;
|
3288 |
+
$content_width = 2048;
|
3289 |
$options = get_option('kgvid_video_embed_options');
|
3290 |
|
3291 |
$kgvid_video_embed = array ( 'enable' => 'false' ); //turned off by default
|
3294 |
if ( (!is_array($kgvid_video_embed) && $kgvid_video_embed == "true") ) { $kgvid_video_embed = array ( 'enable' => 'true' ); } //maintain backwards compatibility
|
3295 |
|
3296 |
if ( $options['embeddable'] == 'false' && !array_key_exists('sample', $kgvid_video_embed) && !array_key_exists('gallery', $kgvid_video_embed) ) { $kgvid_video_embed['enable'] = 'false'; }
|
3297 |
+
|
3298 |
if ( array_key_exists('enable', $kgvid_video_embed) && $kgvid_video_embed['enable'] == 'true' && (strpos($post->post_mime_type,"video") !== false || array_key_exists('sample', $kgvid_video_embed)) ) {
|
3299 |
+
|
3300 |
remove_action('wp_head', '_admin_bar_bump_cb'); //don't show the WordPress admin bar if you're logged in
|
3301 |
+
add_filter( 'show_admin_bar', '__return_false' );
|
3302 |
+
|
3303 |
$shortcode = kgvid_generate_attachment_shortcode($kgvid_video_embed);
|
3304 |
+
|
3305 |
echo '<html style="background-color:transparent;"><head>';
|
3306 |
echo (wp_head());
|
3307 |
echo '<style>.kgvid_wrapper { margin:0; }';
|
3312 |
else { echo 'background-color:transparent; '; }
|
3313 |
echo '">';
|
3314 |
echo (do_shortcode( $shortcode ));
|
3315 |
+
echo (wp_footer());
|
3316 |
echo '</body></html>';
|
3317 |
exit;
|
3318 |
}
|
3326 |
else { $video_id = get_post_meta($kgvid_video_embed['id'], '_kgflashmediaplayer-format', $kgvid_video_embed['format'] ); }
|
3327 |
$url = wp_get_attachment_url($video_id);
|
3328 |
$type = get_post_mime_type($video_id);
|
3329 |
+
|
3330 |
header('Location: ' .$url);
|
3331 |
header('Content-type: '.$type);
|
3332 |
exit(0);
|
3355 |
}
|
3356 |
add_action('kgvid_cleanup_generated_thumbnails','kgvid_cleanup_generated_thumbnails_handler');
|
3357 |
|
3358 |
+
function kgvid_schedule_cleanup_generated_files($arg) { //schedules deleting all tmp thumbnails or logfiles if no files are generated in an hour
|
|
|
|
|
3359 |
|
3360 |
+
if ( $arg == 'thumbs' ) {
|
3361 |
$timestamp = wp_next_scheduled( 'kgvid_cleanup_generated_thumbnails' );
|
3362 |
wp_unschedule_event($timestamp, 'kgvid_cleanup_generated_thumbnails' );
|
3363 |
wp_schedule_single_event(time()+3600, 'kgvid_cleanup_generated_thumbnails');
|
3364 |
}
|
3365 |
|
3366 |
+
else {
|
3367 |
$timestamp = wp_next_scheduled( 'kgvid_cleanup_generated_logfiles' );
|
3368 |
wp_unschedule_event($timestamp, 'kgvid_cleanup_generated_logfiles' );
|
3369 |
+
$args = array('logfile'=>$arg);
|
3370 |
+
wp_schedule_single_event(time()+600, 'kgvid_cleanup_generated_logfiles', $args);
|
3371 |
}
|
3372 |
+
|
|
|
3373 |
}
|
|
|
3374 |
|
3375 |
function kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser, $thumbtimecode, $dofirstframe, $generate_button) {
|
3376 |
|
3378 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
3379 |
$uploads = wp_upload_dir();
|
3380 |
|
3381 |
+
if ( get_post_type($postID) == "attachment" ) {
|
3382 |
$moviefilepath = get_attached_file($postID);
|
3383 |
$movie_width = get_post_meta($postID, '_kgflashmediaplayer-actualwidth');
|
3384 |
+
if ( empty($movie_width) ) {
|
3385 |
$movie_info = kgvid_get_video_dimensions($moviefilepath);
|
3386 |
update_post_meta($postID, '_kgflashmediaplayer-actualwidth', $movie_info['width']);
|
3387 |
update_post_meta($postID, '_kgflashmediaplayer-actualheight', $movie_info['height']);
|
3403 |
$moviefilepath = str_replace("https://", "http://", $moviefilepath);
|
3404 |
$movie_info = kgvid_get_video_dimensions($moviefilepath);
|
3405 |
}
|
3406 |
+
|
3407 |
if ($movie_info['worked'] == true) { //if FFMPEG was able to open the file
|
3408 |
+
|
3409 |
$movie_extension = pathinfo(parse_url($movieurl, PHP_URL_PATH), PATHINFO_EXTENSION);
|
3410 |
$moviefilebasename = sanitize_file_name(basename($movieurl,'.'.$movie_extension));
|
3411 |
$thumbnailfilebase = $uploads['url']."/thumb_tmp/".$moviefilebasename;
|
3412 |
+
|
3413 |
$movie_width = $movie_info['width'];
|
3414 |
$movie_height = $movie_info['height'];
|
3415 |
|
3417 |
|
3418 |
if ( $movie_info['rotate'] === false) { $movie_info['rotate'] = ""; }
|
3419 |
switch ($movie_info['rotate']) { //if it's a sideways mobile video
|
3420 |
+
case ' -vf "transpose=1"': //90 degrees
|
3421 |
+
case ' -vf "transpose=2"': //270 degrees
|
3422 |
$movie_width ^= $movie_height ^= $movie_width ^= $movie_height; break; //swap height & width
|
3423 |
}
|
3424 |
+
|
3425 |
$thumbnailheight = strval(round(floatval($movie_height) / floatval($movie_width) * 200));
|
3426 |
|
3427 |
$jpgpath = $uploads['path']."/thumb_tmp/";
|
3428 |
+
|
3429 |
+
$movieoffset = round((floatval($movie_info['duration']) * $iincreaser) / ($numberofthumbs * 2), 2);
|
3430 |
+
if ( $movieoffset > floatval($movie_info['duration']) ) {
|
3431 |
+
$movieoffset = floatval($movie_info['duration']);
|
3432 |
+
}
|
3433 |
|
3434 |
if ($generate_button == "random") { //adjust offset random amount
|
3435 |
$movieoffset = $movieoffset - rand(0, round(intval($movie_info['duration']) / $numberofthumbs));
|
3447 |
$i = $numberofthumbs + 1;
|
3448 |
}
|
3449 |
|
3450 |
+
if ($dofirstframe == "true" && $i == 1) {
|
3451 |
$movieoffset = "0";
|
3452 |
}
|
3453 |
|
3454 |
+
$thumbnailfilename[$i] = $jpgpath.$moviefilebasename."_thumb".round($movieoffset).".jpg";
|
3455 |
$thumbnailfilename[$i] = str_replace(" ", "_", $thumbnailfilename[$i]);
|
3456 |
+
|
3457 |
+
if ( !empty($options['htaccess_login']) && strpos($moviefilepath, 'http://') === 0 ) {
|
3458 |
+
$moviefilepath = substr_replace($moviefilepath, $options['htaccess_login'].':'.$options['htaccess_password'].'@', 7, 0);
|
3459 |
+
}
|
3460 |
+
|
3461 |
+
$ffmpeg_options = '-y -ss '.$movieoffset.' -i "'.$moviefilepath.'"'.$movie_info['rotate'].' -qscale 1 -vframes 1 -f mjpeg "'.$thumbnailfilename[$i].'"';
|
3462 |
+
$thumbnailurl = $thumbnailfilebase."_thumb".round($movieoffset).'.jpg';
|
3463 |
$thumbnailurl = str_replace(" ", "_", $thumbnailurl);
|
3464 |
|
3465 |
exec(escapeshellcmd($ffmpegPath." ".$ffmpeg_options));
|
3466 |
|
3467 |
+
kgvid_schedule_cleanup_generated_files('thumbs');
|
3468 |
+
|
3469 |
if (floatval($movieoffset) > 60) {
|
3470 |
$movieoffset_minutes = sprintf("%02s", intval(intval($movieoffset) / 60) );
|
3471 |
$movieoffset_seconds = sprintf("%02s", round(fmod( floatval($movieoffset), 60), 2) );
|
3472 |
$movieoffset_display = $movieoffset_minutes.":".$movieoffset_seconds;
|
3473 |
}
|
3474 |
else { $movieoffset_display = "00:".sprintf("%02s", $movieoffset); }
|
3475 |
+
|
3476 |
$field_id = kgvid_backwards_compatible($postID);
|
3477 |
|
3478 |
$thumbnaildisplaycode = '<div class="kgvid_thumbnail_select" name="attachments['.$postID.'][thumb'.$i.']" id="attachments-'.$postID.'-thumb'.$i.'"><label for="kgflashmedia-'.$postID.'-thumbradio'.$i.'"><img src="'.$thumbnailurl.'?'.rand().'" width="200" height="'.$thumbnailheight.'" class="kgvid_thumbnail"></label><br /><input type="radio" name="attachments['.$postID.'][thumbradio'.$i.']" id="kgflashmedia-'.$postID.'-thumbradio'.$i.'" value="'.str_replace('/thumb_tmp/', '/', $thumbnailurl).'" onchange="document.getElementById(\''.$field_id['poster'].'\').value = this.value; document.getElementById(\''.$field_id['thumbtime'].'\').value = \''. $movieoffset_display .'\'; document.getElementById(\'attachments-'. $postID .'-numberofthumbs\').value =\'1\';"></div>';
|
3479 |
|
3480 |
$i++;
|
3481 |
|
3482 |
+
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "movie_width"=>$movie_width, "movie_height"=>$movie_height, "lastthumbnumber"=>$i, "movieoffset"=>$movieoffset, "thumb_url"=>str_replace('/thumb_tmp/', '/', $thumbnailurl) );
|
3483 |
+
|
3484 |
+
return $arr;
|
3485 |
|
|
|
|
|
3486 |
}//if ffmpeg can open movie
|
3487 |
+
|
3488 |
+
else {
|
3489 |
$thumbnaildisplaycode = "<strong>Can't open movie file.</strong><br />".$movie_info['output'];
|
3490 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
3491 |
+
return $arr;
|
3492 |
} //can't open movie
|
3493 |
|
3494 |
}
|
3511 |
$movieurl = $sanitized_url['movieurl'];
|
3512 |
$movieurl = str_replace("https://", "http://", $movieurl);
|
3513 |
$movie_info = kgvid_get_video_dimensions($movieurl);
|
3514 |
+
|
3515 |
if ($movie_info['worked'] == true) { //if FFMPEG was able to open the file
|
3516 |
+
|
3517 |
$movie_width = $movie_info['width'];
|
3518 |
$movie_height = $movie_info['height'];
|
3519 |
if ( get_post_type($postID) == "attachment" ) {
|
3520 |
update_post_meta($postID, '_kgflashmediaplayer-actualheight', $movie_width);
|
3521 |
update_post_meta($postID, '_kgflashmediaplayer-actualheight', $movie_height);
|
3522 |
update_post_meta($postID, '_kgflashmediaplayer-duration', $movie_info['duration']);
|
3523 |
+
update_post_meta($postID, '_kgflashmediaplayer-rotate', $movie_info['rotate']);
|
3524 |
}
|
3525 |
+
|
3526 |
$encodevideo_info = kgvid_encodevideo_info($movieurl, $postID);
|
3527 |
+
|
3528 |
foreach ( $video_formats as $format => $format_stats ) {
|
3529 |
if ( $encode_checked[$format] == "true" ) {
|
3530 |
+
if ( !$encodevideo_info[$format.'_exists'] ) {
|
3531 |
if ( ($format == "1080" && $movie_height <= 1080) || ($format == "720" && $movie_height <= 720) ) {
|
3532 |
$movie_extension = pathinfo($movieurl, PATHINFO_EXTENSION);
|
3533 |
+
if ( $encode_checked['fullres'] == "true" || in_array($movie_extension, $h264extensions) || $movie_height < intval($format) ) {
|
3534 |
$encode_formats[$format]['status'] = "lowres";
|
3535 |
} //skip if the resolution of an existing video is lower than the HD format
|
3536 |
}
|
3537 |
+
else {
|
3538 |
$encode_formats[$format]['status'] = "queued";
|
3539 |
$encode_formats[$format]['name'] = $format_stats['name'];
|
3540 |
$encode_list[$format] = $format_stats['name'];
|
3543 |
} // if video doesn't already exist
|
3544 |
else { $encode_formats[$format]['status'] = "encoded"; }
|
3545 |
} // if user wants to encode format
|
3546 |
+
else {
|
3547 |
+
$encode_formats[$format]['status'] = "notchecked";
|
3548 |
update_post_meta($postID, '_kgflashmediaplayer-encode'.$format, 'notchecked');
|
3549 |
}
|
3550 |
}
|
3551 |
+
|
3552 |
if ( !empty($encode_list) ) {
|
3553 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
3554 |
if ( empty($parent_id) ) { $parent_id = get_post($postID)->post_parent; }
|
3562 |
$already_queued = false;
|
3563 |
if ( !empty($video_embed_queue ) ) {
|
3564 |
foreach ($video_embed_queue as $index => $entry) {
|
3565 |
+
if ( $entry['movieurl'] == $movieurl ) {
|
3566 |
+
$already_queued = $index;
|
3567 |
foreach ( $entry['encode_formats'] as $format => $value ) {
|
3568 |
if ( $value['status'] == "queued" && array_key_exists($format, $encode_list) ) { unset($encode_list[$format]); }
|
3569 |
if ( $value['status'] == "encoding" || $encode_checked[$format] != "true" ) { $queue_entry['encode_formats'][$format] = $entry['encode_formats'][$format]; } //don't edit queue entry for anything that's currently encoding or not checked
|
3572 |
}
|
3573 |
}
|
3574 |
}
|
3575 |
+
|
3576 |
+
if ( $already_queued !== false ) {
|
3577 |
$video_embed_queue[$already_queued] = $queue_entry;
|
3578 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
3579 |
if ( !empty($encode_list) ) { $embed_display = "<strong>".implode(", " , $encode_list)." updated in existing queue entry in position ".strval(intval($already_queued)+1).". </strong>"; }
|
3580 |
else { $embed_display = "<strong>Video is already queued in position ".strval(intval($already_queued)+1).". </strong>"; }
|
3581 |
}
|
3582 |
+
else {
|
3583 |
$video_embed_queue[] = $queue_entry;
|
3584 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
3585 |
$queue_position = intval(key( array_slice( $video_embed_queue, -1, 1, TRUE ) ));
|
3586 |
if ( $queue_position == 0 ) { $embed_display = "<strong>Starting ".strtoupper($options['video_app'])."... </strong>"; }
|
3587 |
else { $embed_display = "<strong>".implode(", " , $encode_list)." added to queue in position ".strval(intval($queue_position)+1). ". </strong>";
|
3588 |
}
|
3589 |
+
}
|
3590 |
} //if any video formats don't already exist, add to queue
|
3591 |
else { $embed_display = "<strong>Nothing to encode.</strong>"; }
|
3592 |
+
|
3593 |
$replaceoptions = "";
|
3594 |
$originalselect = "";
|
3595 |
+
|
3596 |
$arr = array ( "embed_display"=>$embed_display );
|
3597 |
+
return $arr;
|
3598 |
}
|
3599 |
+
else {
|
3600 |
$thumbnaildisplaycode = "<strong>Can't open movie file.</strong><br />".$movie_info['output'];
|
3601 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
3602 |
+
return $arr;
|
3603 |
+
} //can't open movie
|
3604 |
}
|
3605 |
|
3606 |
+
function kgivd_save_singleurl_poster($parent_id, $poster, $movieurl, $set_featured) { //called by the "Embed Video from URL" tab when submitting
|
3607 |
|
3608 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
3609 |
+
if ( !empty($poster) ) { $thumb_id = kgvid_save_thumb($parent_id, $sanitized_url['basename'], $poster); }
|
3610 |
+
if ( !empty($thumb_id) && $set_featured == "on" ) {
|
3611 |
+
set_post_thumbnail($parent_id, $thumb_id);
|
3612 |
+
}
|
3613 |
+
|
3614 |
}//if submit
|
3615 |
|
3616 |
function kgvid_callffmpeg() {
|
3628 |
if (isset($_POST['thumbtimecode'])) { $thumbtimecode = $_POST['thumbtimecode']; }
|
3629 |
if (isset($_POST['dofirstframe'])) { $dofirstframe = $_POST['dofirstframe']; }
|
3630 |
if (isset($_POST['generate_button'])) { $generate_button = $_POST['generate_button']; }
|
3631 |
+
|
3632 |
if (isset($_POST['encodeformats'])) { $encode_checked = $_POST['encodeformats']; }
|
3633 |
|
3634 |
if (isset($_POST['poster'])) { $poster = $_POST['poster']; }
|
3635 |
if (isset($_POST['parent_id'])) { $parent_id = $_POST['parent_id']; }
|
3636 |
if ( !isset($parent_id) ) { $parent_id = "check"; }
|
3637 |
+
if ( isset($_POST['set_featured']) ) { $set_featured = $_POST['set_featured']; }
|
3638 |
|
3639 |
if (isset($_POST['ffmpeg_action'])) { $action = $_POST['ffmpeg_action']; }
|
3640 |
+
|
3641 |
if ( $options['ffmpeg_exists'] == true ) {
|
3642 |
+
|
3643 |
+
if ( $action == "generate" && current_user_can('make_video_thumbnails') ) {
|
3644 |
+
$arr = kgvid_make_thumbs($postID, $movieurl, $numberofthumbs, $i, $iincreaser, $thumbtimecode, $dofirstframe, $generate_button);
|
3645 |
+
echo json_encode($arr);
|
3646 |
+
}
|
3647 |
+
if ( $action == "enqueue" && current_user_can('encode_videos') ) {
|
3648 |
+
$arr = kgvid_enqueue_videos($postID, $movieurl, $encode_checked, $parent_id);
|
3649 |
+
echo json_encode($arr);
|
3650 |
+
}
|
3651 |
+
if ( $action == "submit" && current_user_can('make_video_thumbnails') ) { kgivd_save_singleurl_poster($parent_id, $poster, $movieurl, $set_featured); }
|
3652 |
}
|
3653 |
else {
|
3654 |
+
$thumbnaildisplaycode = '<strong>Error: '.strtoupper($options["video_app"]).' not found. Verify that '.strtoupper($options["video_app"]).' is installed at '.strtoupper($options["app_path"]).' and check the <a href="options-general.php?page=video-embed-thumbnail-generator/video-embed-thumbnail-generator.php">application path plugin setting</a>.</strong>' ;
|
3655 |
$arr = array ( "thumbnaildisplaycode"=>$thumbnaildisplaycode, "embed_display"=>$thumbnaildisplaycode, "lastthumbnumber"=>"break" );
|
3656 |
echo json_encode($arr);
|
3657 |
}//no ffmpeg
|
3672 |
$video_formats = kgvid_video_formats();
|
3673 |
|
3674 |
if ( !empty($video_embed_queue) ) {
|
3675 |
+
|
3676 |
$simultaneous = 1;
|
3677 |
+
|
3678 |
foreach ( $video_embed_queue as $video_key => $queue_entry ) { //search the queue for any encoding video
|
3679 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
3680 |
if ( $value['status'] == "encoding" ) {
|
3685 |
}
|
3686 |
}
|
3687 |
}
|
3688 |
+
|
3689 |
if ( empty($encoding) ) {
|
3690 |
+
foreach ( $video_embed_queue as $video_key => $queue_entry ) {
|
3691 |
foreach ( $queue_entry['encode_formats'] as $format => $value ) {
|
3692 |
+
if ( $value['status'] == "queued" ) {
|
3693 |
$video = $video_embed_queue[$video_key];
|
3694 |
$queued_format = $format;
|
3695 |
+
break 2;
|
3696 |
}
|
3697 |
}
|
3698 |
}
|
3699 |
}
|
3700 |
+
|
3701 |
if ( !empty($queued_format) ) {
|
3702 |
+
|
3703 |
$options = get_option('kgvid_video_embed_options');
|
3704 |
+
|
3705 |
$ffmpegPath = $options['app_path']."/".$options['video_app'];
|
3706 |
if ( get_post_type($video['attachmentID']) == "attachment" ) { $moviefilepath = get_attached_file($video['attachmentID']); }
|
3707 |
+
else {
|
3708 |
+
$moviefilepath = str_replace(" ", "%20", esc_url_raw($video['movieurl']));
|
3709 |
$moviefilepath = str_replace("https://", "http://", $moviefilepath);
|
3710 |
}
|
3711 |
+
|
|
|
3712 |
$movie_info = $video['movie_info'];
|
3713 |
$encodevideo_info = kgvid_encodevideo_info($video['movieurl'], $video['attachmentID']);
|
3714 |
+
|
3715 |
$logfile = "";
|
3716 |
$processPID = "";
|
3717 |
$serverOS = "";
|
3718 |
$ffmpeg_options = "";
|
3719 |
+
|
3720 |
+
if ( $options['video_app'] == "avconv" || $options['video_bitrate_flag'] == false ) {
|
3721 |
$video_bitrate_flag = "b:v";
|
3722 |
$audio_bitrate_flag = "b:a";
|
3723 |
+
$profile_flag = "profile:v";
|
3724 |
}
|
3725 |
+
|
3726 |
+
else {
|
3727 |
$video_bitrate_flag = "b";
|
3728 |
$audio_bitrate_flag = "ab";
|
3729 |
+
$profile_flag = "profile";
|
3730 |
}
|
3731 |
+
|
3732 |
+
$aac_array = kgvid_aac_encoders();
|
3733 |
+
$aac_available = false;
|
3734 |
+
foreach ( $aac_array as $aaclib ) { //cycle through available AAC encoders in order of quality
|
3735 |
+
if ( $movie_info['configuration'][$aaclib] == "true" ) { $aac_available = true; break; }
|
3736 |
+
}
|
3737 |
+
|
3738 |
+
foreach( $video_formats as $format => $format_stats ) {
|
3739 |
+
if ( $queued_format == $format && $format_stats['type'] == "h264" ) {
|
3740 |
+
if ( $movie_info['configuration']['libx264'] == "true" && $aac_available ) {
|
3741 |
+
|
3742 |
if ( ! $encodevideo_info[$format.'_exists'] || ($encodevideo_info['sameserver'] && filesize($encodevideo_info[$format.'filepath']) < 24576) ) {
|
3743 |
+
|
3744 |
if ( intval($movie_info['width']) > $format_stats['width'] ) { $h264_movie_width = $format_stats['width']; }
|
3745 |
else { $h264_movie_width = $movie_info['width']; }
|
3746 |
$h264_movie_height = strval(round(floatval($movie_info['height']) / floatval($movie_info['width']) * $h264_movie_width));
|
3747 |
if ( intval($h264_movie_height) > $format_stats['height'] ) { $h264_movie_height = $format_stats['height']; }
|
3748 |
$h264_movie_width = strval(round(floatval($movie_info['width']) / floatval($movie_info['height']) * $h264_movie_height));
|
3749 |
+
|
3750 |
if ($h264_movie_height % 2 != 0) { $h264_movie_height++; } //if it's odd, increase by 1 to make sure it's an even number
|
3751 |
+
if ($h264_movie_width % 2 != 0) { $h264_movie_width--; } //if it's odd, decrease by 1 to make sure it's an even number
|
3752 |
+
|
3753 |
+
$encode_string = kgvid_generate_encode_string($moviefilepath, $encodevideo_info[$format.'filepath'], $movie_info['configuration'], $queued_format, $h264_movie_width, $h264_movie_height, $movie_info['rotate']);
|
3754 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3755 |
}//if file doesn't already exist
|
3756 |
+
else { $embed_display = $format_stats['name']." already encoded"; }
|
3757 |
break; //don't bother looping through the rest if we already found the format
|
3758 |
+
}//if the x264 library and an aac library is enabled
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3759 |
else {
|
3760 |
+
$lastline = strtoupper($options['video_app'])." missing library libx264 required for H.264 encoding";
|
3761 |
+
if ( !$aac_available ) {
|
3762 |
+
array_pop($aac_array); //get rid of the built-in "aac" encoder since it can't really be "installed"
|
3763 |
+
$lastaac = array_pop($aac_array);
|
3764 |
+
$aac_list = implode(", ", $aac_array);
|
3765 |
+
$aac_list .= ", or ".$lastaac;
|
3766 |
+
$lastline .= " and missing an AAC encoding library. Please install and enable libx264 and ".$aac_list;
|
3767 |
+
}
|
3768 |
+
$video_embed_queue[$video_key]['encode_formats'][$format]['status'] = "error";
|
3769 |
+
$video_embed_queue[$video_key]['encode_formats'][$format]['lastline'] = $lastline;
|
3770 |
+
$embed_display = "Missing libraries";
|
3771 |
}
|
3772 |
+
}//if format is chosen for encoding
|
3773 |
+
}//H.264 format loop
|
3774 |
+
|
3775 |
+
if ( $queued_format == "webm" || $queued_format == "ogg" ) { //if it's not H.264 they both work essentially the same
|
3776 |
+
if ( ! $encodevideo_info[$queued_format.'_exists'] || ($encodevideo_info['sameserver'] && filesize($encodevideo_info[$queued_format.'filepath']) < 24576) ) {
|
3777 |
+
if ( $movie_info['configuration']['libvorbis'] == "true" && $movie_info['configuration'][$video_formats[$queued_format]['vcodec']] == "true" ) {
|
3778 |
+
$encode_string = kgvid_generate_encode_string($moviefilepath, $encodevideo_info[$queued_format.'filepath'], $movie_info['configuration'], $queued_format, $movie_info['width'], $movie_info['height'], $movie_info['rotate']);
|
3779 |
+
$embed_display = "Encoding ".$video_formats[$queued_format]['name'];
|
3780 |
+
}//if the necessary libraries are enabled
|
|
|
|
|
|
|
3781 |
else {
|
3782 |
+
$missing_libraries = array();
|
3783 |
+
if($movie_info['configuration']['libvorbis'] == 'false') { $missing_libraries[] = 'libvorbis'; }
|
3784 |
+
if($movie_info['configuration'][$video_formats[$queued_format]['vcodec']] == 'false') { $missing_libraries[] = $video_formats[$queued_format]['vcodec']; }
|
3785 |
+
$lastline = strtoupper($options['video_app'])." missing library ".implode(', ', $missing_libraries)." required for ".$video_formats[$queued_format]['name']." encoding.";
|
3786 |
+
$video_embed_queue[$video_key]['encode_formats'][$queued_format]['status'] = "error";
|
3787 |
+
$video_embed_queue[$video_key]['encode_formats'][$queued_format]['lastline'] = $lastline;
|
3788 |
+
$embed_display = "Missing libraries";
|
3789 |
}
|
3790 |
+
}//if file doesn't already exist
|
3791 |
+
else { $embed_display = $video_formats[$queued_format]['vcodec']." already encoded."; }
|
3792 |
+
}//if format is queued
|
3793 |
+
|
3794 |
+
if ( !empty($encode_string) ) {
|
3795 |
+
|
|
|
3796 |
$logfile = $uploads['path'].'/'.str_replace(" ", "_", $encodevideo_info['moviefilebasename'])."_".$queued_format."_".sprintf("%04s",mt_rand(1, 1000))."_encode.txt";
|
3797 |
+
|
3798 |
+
$cmd = escapeshellcmd($encode_string);
|
3799 |
+
|
3800 |
if ( !empty($cmd) ) { $cmd = $cmd." > ".$logfile." 2>&1 & echo $!"; }
|
3801 |
else {
|
3802 |
$arr = array ( "embed_display"=>"<span style='color:red;'>Error: Command 'escapeshellcmd' is disabled on your server.</span>" );
|
3803 |
return $arr;
|
3804 |
+
}
|
3805 |
$process = new kgvid_Process($cmd);
|
3806 |
+
|
3807 |
sleep(1);
|
3808 |
+
|
3809 |
$processPID = $process->getPid();
|
3810 |
$serverOS = $process->OS;
|
3811 |
|
3814 |
if ( !wp_next_scheduled('kgvid_cleanup_queue', array ( 'scheduled' )) ) {
|
3815 |
wp_schedule_event( time()+86400, 'daily', 'kgvid_cleanup_queue', array ( 'scheduled' ) );
|
3816 |
}
|
3817 |
+
|
3818 |
//update_post_meta($video['attachmentID'], '_kgflashmediaplayer-encode'.$format, 'on');
|
3819 |
|
3820 |
$video['encode_formats'][$queued_format] = array (
|
3837 |
);
|
3838 |
|
3839 |
$video_embed_queue[$video_key] = $queue_entry;
|
3840 |
+
|
3841 |
//$embed_display .= "<script type='text/javascript'>alert('".$ffmpegPath." ".$ffmpeg_args."');</script>";
|
3842 |
+
|
3843 |
} //end if there's stuff to encode
|
3844 |
|
3845 |
//$output_map = array_map(create_function('$key, $value', 'return $key.":".$value." # ";'), array_keys($process->output), array_values($process->output));
|
3850 |
kgvid_encode_progress($video_key, $queued_format, "attachment");
|
3851 |
|
3852 |
} //if there's a format to encode
|
3853 |
+
|
3854 |
} //if there's a queue
|
3855 |
+
$arr = array ( "embed_display"=>"<strong>".$embed_display."</strong>", "video_key"=>$video_key, "format"=>$queued_format, "actualwidth"=>$movie_info['width'], "actualheight"=>$movie_info['height'] );
|
3856 |
return $arr;
|
3857 |
|
3858 |
}
|
3859 |
|
3860 |
function kgvid_ajax_encode_videos() {
|
3861 |
|
3862 |
+
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
3863 |
+
global $wpdb;
|
3864 |
+
$arr = kgvid_encode_videos();
|
3865 |
+
echo json_encode($arr);
|
3866 |
+
die();
|
3867 |
+
|
3868 |
}
|
3869 |
add_action('wp_ajax_kgvid_ajax_encode_videos', 'kgvid_ajax_encode_videos');
|
3870 |
|
3871 |
+
function kgvid_test_ffmpeg() {
|
3872 |
+
|
3873 |
+
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
3874 |
+
$cmd = $_POST['command'];
|
3875 |
+
$cmd=escapeshellcmd(stripcslashes($cmd));
|
3876 |
+
exec ( $cmd.' 2>&1', $output );
|
3877 |
+
$uploads = wp_upload_dir();
|
3878 |
+
if ( file_exists($uploads['path']."/sample-video-h264-480p.mp4") ) { unlink($uploads['path']."/sample-video-h264-480p.mp4"); }
|
3879 |
+
echo implode("\n", $output);
|
3880 |
+
die;
|
3881 |
+
|
3882 |
+
}
|
3883 |
+
add_action('wp_ajax_kgvid_test_ffmpeg', 'kgvid_test_ffmpeg');
|
3884 |
+
|
3885 |
function kgvid_encode_progress($video_key, $format, $page) {
|
3886 |
|
3887 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
3888 |
+
|
3889 |
if ( is_array($video_embed_queue) && array_key_exists($video_key, $video_embed_queue) ) {
|
3890 |
|
3891 |
+
$video_entry = $video_embed_queue[$video_key];
|
3892 |
+
$script_function = 'kgvid_redraw_encode_checkboxes("'.$video_entry['movieurl'].'", "'.$video_entry['attachmentID'].'", "'.$page.'")';
|
3893 |
+
|
3894 |
+
if ( $video_entry['encode_formats'][$format]['status'] == "error" ) {
|
3895 |
+
$embed_display = '<strong>Error: </strong><span style="color:red;">'.$video_entry['encode_formats'][$format]['lastline'].'.</span>';
|
3896 |
+
$next_video = kgvid_encode_videos(); //start the next queued video
|
3897 |
+
if ( !empty($next_video['format']) ) {
|
3898 |
+
$embed_display .= '<script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
3899 |
+
$args = array($next_video['video_key'], $next_video['format'], $page);
|
3900 |
+
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
3901 |
+
}
|
3902 |
+
}
|
3903 |
+
|
3904 |
if ( array_key_exists('logfile', $video_embed_queue[$video_key]['encode_formats'][$format]) ) {
|
3905 |
+
|
3906 |
$pid = $video_entry['encode_formats'][$format]['PID'];
|
3907 |
$logfile = $video_entry['encode_formats'][$format]['logfile'];
|
3908 |
$started = $video_entry['encode_formats'][$format]['started'];
|
3909 |
$movie_duration = $video_entry['movie_info']['duration'];
|
|
|
3910 |
$embed_display = "";
|
3911 |
$percent_done = "";
|
3912 |
$time_remaining = "";
|
3915 |
$lastline = "";
|
3916 |
|
3917 |
if ( $video_entry['encode_formats'][$format]['status'] != "Encoding Complete" ) {
|
3918 |
+
|
3919 |
if ( is_file($logfile) ) {
|
3920 |
|
3921 |
$fp = fopen($logfile, 'r');
|
3923 |
$read = '';
|
3924 |
$offset = -1;
|
3925 |
$lines = 2;
|
3926 |
+
if ( substr(strtoupper(PHP_OS),0,3) == "WIN" ) { $lines = 4; }
|
3927 |
while ( $lines && fseek($fp, $offset, SEEK_END) >= 0 ) {
|
3928 |
$c = fgetc($fp);
|
3929 |
if( $c == "\n" || $c == "\r" ) {
|
3934 |
}
|
3935 |
fclose($fp);
|
3936 |
$lastline = strrev(rtrim($read,"\n\r"));
|
3937 |
+
|
3938 |
$last_match = "";
|
3939 |
$time_matches = "";
|
3940 |
$video_matches = "";
|
3942 |
$fps_matches = "";
|
3943 |
$fps_match = "";
|
3944 |
$basename = "";
|
3945 |
+
|
|
|
|
|
3946 |
preg_match('/time=(.*?) /', $lastline, $time_matches);
|
3947 |
+
|
3948 |
if ( array_key_exists(1, $time_matches) != true ) { //if something other than the regular FFMPEG encoding output check for these
|
3949 |
preg_match('/video:(.*?) /', $lastline, $video_matches);
|
3950 |
preg_match('/libx264 (.*?) /', $lastline, $libx264_matches);
|
3953 |
//preg_match('/buffer (.*?) /', $lastline, $buffer_matches);
|
3954 |
}
|
3955 |
if ( array_key_exists(1, $time_matches) == true ) { //still encoding
|
3956 |
+
|
3957 |
if ( strpos($time_matches[1], ':') !== false ) {
|
3958 |
$current_hours = intval(substr($time_matches[1], -11, 2));
|
3959 |
$current_minutes = intval(substr($time_matches[1], -8, 2));
|
3961 |
$current_seconds = ($current_hours * 60 * 60) + ($current_minutes * 60) + $current_seconds;
|
3962 |
}
|
3963 |
else { $current_seconds = $time_matches[1]; }
|
3964 |
+
|
3965 |
$percent_done = intval($current_seconds)/intval($movie_duration);
|
3966 |
$time_elapsed = time() - $started;
|
3967 |
if ( $percent_done != 0 ) { $time_remaining = date('H:i:s', round($time_elapsed / $percent_done) - $time_elapsed); }
|
3969 |
$percent_done = round($percent_done*100);
|
3970 |
if ( $percent_done < 20 ) { $percent_done_text = ""; }
|
3971 |
else { $percent_done_text = strval($percent_done)."%"; }
|
3972 |
+
|
3973 |
preg_match('/fps=\s+(.*?) /', $lastline, $fps_matches);
|
3974 |
+
if ( array_key_exists(1, $fps_matches) == true ) {
|
3975 |
if ( $fps_matches[1] != 0 ) { $fps_match = $fps_matches[1]; }
|
3976 |
else { $fps_match = "10"; }
|
3977 |
}
|
3980 |
if ( intval($time_to_wait) > 10000 ) { //wait no more than 10 seconds
|
3981 |
$time_to_wait = 10000;
|
3982 |
}
|
3983 |
+
|
3984 |
$args = array($video_key, $format, $page);
|
3985 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
3986 |
|
3987 |
+
$embed_display = '<strong>'.ucwords($video_entry['encode_formats'][$format]['status']).'</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>';
|
3988 |
+
|
3989 |
+
if ( current_user_can('encode_videos') ) {
|
3990 |
+
$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>';
|
3991 |
+
}
|
3992 |
+
|
3993 |
+
$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>';
|
3994 |
}
|
3995 |
+
elseif ( time() - $started < 10 || time() - filemtime($video_entry['encode_formats'][$format]['filepath']) < 10 ) { //not enough time has passed, so check again later
|
3996 |
$args = array($video_key, $format, $page);
|
3997 |
$embed_display = '<strong>Encoding</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
3998 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
4002 |
$ended = filemtime($logfile);
|
4003 |
$time_elapsed = $ended - $started;
|
4004 |
$time_remaining = "0";
|
4005 |
+
$fps_match = "10";
|
4006 |
if ( array_key_exists(1, $libx264_matches) ) { kgvid_fix_moov_atom($video_key, $format); } //fix the moov atom if the file was encoded by libx264
|
4007 |
$video_embed_queue[$video_key]['encode_formats'][$format]['status'] = "Encoding Complete";
|
4008 |
$video_embed_queue[$video_key]['encode_formats'][$format]['ended'] = $ended;
|
4009 |
$video_embed_queue[$video_key]['encode_formats'][$format]['lastline'] = $lastline;
|
4010 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4011 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
4012 |
+
|
4013 |
+
if ( $format != "fullres" ) {
|
4014 |
+
|
4015 |
+
//insert the encoded video as a child attachment of the original video, or post if external original
|
4016 |
+
if ( get_post_type($video_entry['attachmentID']) == "attachment" ) { //if the original video is in the database set that as parent
|
4017 |
+
$parent_id = $video_entry['attachmentID'];
|
4018 |
+
$title = get_the_title($video_entry['attachmentID']);
|
4019 |
+
}
|
4020 |
+
else { //otherwise set the post as the parent
|
4021 |
+
$parent_id = $video_entry['parent_id'];
|
4022 |
+
$sanitized_url = kgvid_sanitize_url($video_entry['movieurl']);
|
4023 |
+
$title = $sanitized_url['basename'];
|
4024 |
+
}
|
4025 |
+
|
4026 |
+
global $wpdb;
|
4027 |
+
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='".$video_embed_queue[$video_key]['encode_formats'][$format]['url']."'"; //check for existing entry in the db
|
4028 |
+
$video_id = $wpdb->get_var($query);
|
4029 |
+
if ( !$video_id ) {
|
4030 |
+
$wp_filetype = wp_check_filetype(basename($video_entry['encode_formats'][$format]['filepath']), null );
|
4031 |
+
$video_formats = kgvid_video_formats();
|
4032 |
+
$title .= " ".$video_formats[$format]['name'];
|
4033 |
+
$attachment = array(
|
4034 |
+
'guid' => $video_entry['encode_formats'][$format]['url'],
|
4035 |
+
'post_mime_type' => $wp_filetype['type'],
|
4036 |
+
'post_title' => $title,
|
4037 |
+
'post_content' => '',
|
4038 |
+
'post_status' => 'inherit'
|
4039 |
+
);
|
4040 |
+
$new_id = wp_insert_attachment( $attachment, $video_entry['encode_formats'][$format]['filepath'], $parent_id );
|
4041 |
+
// you must first include the image.php file
|
4042 |
+
// for the function wp_generate_attachment_metadata() to work and media.php for wp_read_video_metadata() in WP 3.6+
|
4043 |
+
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
4044 |
+
global $wp_version;
|
4045 |
+
if ( $wp_version >= 3.6 ) { require_once(ABSPATH . 'wp-admin/includes/media.php'); }
|
4046 |
+
require_once(ABSPATH . 'wp-admin/includes/media.php');
|
4047 |
+
$attach_data = wp_generate_attachment_metadata( $new_id, $video_entry['encode_formats'][$format]['filepath'] );
|
4048 |
+
wp_update_attachment_metadata( $new_id, $attach_data );
|
4049 |
+
update_post_meta( $new_id, '_kgflashmediaplayer-format', $format );
|
4050 |
+
if ( get_post_type($video_entry['attachmentID']) == false ) { update_post_meta( $new_id, '_kgflashmediaplayer-externalurl', $video_entry['movieurl'] ); } //connect new video to external url
|
4051 |
+
}
|
4052 |
}
|
4053 |
+
|
4054 |
//finish inserting attachment
|
4055 |
+
|
4056 |
$embed_display = '<strong>Encoding Complete</strong> <script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
4057 |
$next_video = kgvid_encode_videos(); //start the next queued video
|
4058 |
+
if ( !empty($next_video['format']) ) { //if there's something to encode, schedule cron
|
4059 |
$args = array($next_video['video_key'], $next_video['format'], $page);
|
4060 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
4061 |
}
|
4062 |
+
elseif ( $video_embed_queue[$video_key]['encode_formats']['fullres']['status'] == "Encoding Complete" ) { //if there's nothing left to encode and we're replacing the original
|
4063 |
+
|
4064 |
+
kgvid_replace_video( $video_key, 'fullres' );
|
4065 |
+
|
4066 |
+
if ( $video_embed_queue[$video_key]['movie_info']['rotate'] != "" ) { //if the video needed rotating
|
4067 |
+
$video_embed_queue[$video_key]['movie_info']['rotate'] = ""; //clear rotation because we've just fixed that problem
|
4068 |
+
delete_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-rotate');
|
4069 |
+
|
4070 |
+
$setwidth = $video_entry['movie_info']['width'];
|
4071 |
+
$setheight = $video_entry['movie_info']['height'];
|
4072 |
+
if ( intval($setwidth) > intval($setheight) ) { //swap the width and height meta if it hasn't already been done
|
4073 |
+
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-actualwidth', $video_entry['movie_info']['height']);
|
4074 |
+
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-width', $setheight);
|
4075 |
+
$video_embed_queue[$video_key]['movie_info']['width'] = $video_entry['movie_info']['height'];
|
4076 |
+
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-actualheight', $video_entry['movie_info']['width']);
|
4077 |
+
update_post_meta($video_entry['attachmentID'], '_kgflashmediaplayer-height', $setwidth);
|
4078 |
+
$video_embed_queue[$video_key]['movie_info']['height'] = $video_entry['movie_info']['width'];
|
4079 |
+
}
|
4080 |
+
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
4081 |
+
}
|
4082 |
+
}
|
4083 |
+
|
4084 |
}
|
4085 |
+
else { //there was an unexpected output and the encoded file hasn't been modified in more than 10 seconds
|
4086 |
+
|
4087 |
if ( strpos($lastline, "signal 15") !== false ) { //if the encoding was intentionally canceled
|
4088 |
$lastline = "Encoding was canceled.";
|
4089 |
}
|
4091 |
$video_embed_queue[$video_key]['encode_formats'][$format]['lastline'] = $lastline;
|
4092 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
4093 |
$other_message = $lastline;
|
4094 |
+
$embed_display = '<strong>Error: </strong><span style="color:red;">'.$lastline.'.</span>';
|
4095 |
$next_video = kgvid_encode_videos(); //start the next queued video
|
4096 |
if ( !empty($next_video['format']) ) {
|
4097 |
+
$embed_display .= '<script type="text/javascript">percent_timeout = setTimeout(function(){'.$script_function.'}, 1000);</script>';
|
4098 |
$args = array($next_video['video_key'], $next_video['format'], $page);
|
4099 |
wp_schedule_single_event(time()+60, 'kgvid_cron_queue_check', $args);
|
4100 |
}
|
4101 |
}
|
4102 |
+
|
4103 |
//$embed_display .= $lastline;
|
4104 |
+
$arr = array ( "embed_display"=>$embed_display );
|
4105 |
}
|
4106 |
else { $arr = array ( "embed_display"=>"<strong>No log file</strong>" ); }
|
4107 |
+
|
4108 |
}//if not completed
|
4109 |
+
else { $arr = array ( "embed_display"=>"<strong>".ucwords($video_embed_queue[$video_key]['encode_formats'][$format]['status'])."</strong>" ); }
|
4110 |
} //if there's a queue and the video is encoding
|
4111 |
else { $arr = array ( "embed_display"=>"<strong>Waiting...</strong>" ); }
|
4112 |
return $arr;
|
4113 |
+
|
4114 |
}//end if queue entry exists
|
4115 |
|
4116 |
}
|
4126 |
$progress = kgvid_encode_progress($video_key, $format, $page);
|
4127 |
echo json_encode($progress);
|
4128 |
die();
|
4129 |
+
|
4130 |
}
|
4131 |
add_action('wp_ajax_kgvid_encode_progress', 'kgvid_ajax_encode_progress');
|
4132 |
|
4133 |
+
function kgvid_replace_video ( $video_key, $format ) {
|
4134 |
+
|
4135 |
+
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
4136 |
+
$encoded_filename = $video_embed_queue[$video_key]['encode_formats'][$format]['filepath'];
|
4137 |
+
$video_id = $video_embed_queue[$video_key]['attachmentID'];
|
4138 |
+
|
4139 |
+
$original_filename = get_attached_file($video_id);
|
4140 |
+
$path_parts = pathinfo($original_filename);
|
4141 |
+
if ( $path_parts['extension'] != "mp4" && $path_parts['extension'] != "m4v" ) {
|
4142 |
+
$new_filename = str_replace("-fullres", "", $encoded_filename);
|
4143 |
+
$sanitized_url = kgvid_sanitize_url($video_embed_queue[$video_key]['movieurl']);
|
4144 |
+
$new_url = $sanitized_url['noextension'].".mp4";
|
4145 |
+
$video_embed_queue[$video_key]['movieurl'] = $new_url;
|
4146 |
+
global $wpdb;
|
4147 |
+
$query = "SELECT ID FROM {$wpdb->posts} WHERE `post_content` LIKE '%".$sanitized_url['basename'].".".$path_parts['extension']."%'"; //find posts that use the old filename
|
4148 |
+
$results = $wpdb->get_results($query);
|
4149 |
+
if ( $results ) {
|
4150 |
+
foreach ( $results as $result ) {
|
4151 |
+
$post = get_post($result->ID);
|
4152 |
+
$post->post_content = str_replace($sanitized_url['basename'].".".$path_parts['extension'], $sanitized_url['basename'].".mp4", $post->post_content);
|
4153 |
+
wp_update_post($post);
|
4154 |
+
}
|
4155 |
+
}
|
4156 |
+
}
|
4157 |
+
else {
|
4158 |
+
$new_filename = $original_filename;
|
4159 |
+
$new_url = $video_embed_queue[$video_key]['movieurl'];
|
4160 |
+
}
|
4161 |
+
|
4162 |
+
if ( file_exists($encoded_filename) ) {
|
4163 |
+
rename($encoded_filename, $new_filename);
|
4164 |
+
if ( file_exists($original_filename) && $original_filename != $new_filename ) { unlink($original_filename); }
|
4165 |
+
}
|
4166 |
+
$video_embed_queue[$video_key]['encode_formats'][$format]['url'] = $new_url;
|
4167 |
+
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
4168 |
+
|
4169 |
+
// you must first include the image.php file
|
4170 |
+
// for the function wp_generate_attachment_metadata() to work and media.php for wp_read_video_metadata() in WP 3.6+
|
4171 |
+
require_once(ABSPATH . 'wp-admin/includes/image.php');
|
4172 |
+
global $wp_version;
|
4173 |
+
global $wpdb;
|
4174 |
+
if ( $wp_version >= 3.6 ) { require_once(ABSPATH . 'wp-admin/includes/media.php'); }
|
4175 |
+
$attach_data = wp_generate_attachment_metadata( $video_id, $new_filename );
|
4176 |
+
wp_update_attachment_metadata( $video_id, $attach_data );
|
4177 |
+
update_attached_file( $video_id, $new_filename );
|
4178 |
+
|
4179 |
+
$new_mime = wp_check_filetype( $new_filename );
|
4180 |
+
$post = get_post($video_id);
|
4181 |
+
$post->guid = str_replace( $path_parts['extension'], $new_mime['ext'], $post->guid );
|
4182 |
+
$post->post_mime_type = $new_mime['type'];
|
4183 |
+
wp_update_post($post);
|
4184 |
+
}
|
4185 |
+
|
4186 |
function kgvid_clear_completed_queue($type) {
|
4187 |
|
4188 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
4189 |
+
|
4190 |
if ( !empty($video_embed_queue) ) {
|
4191 |
+
|
4192 |
$keep = array();
|
4193 |
$cleared_video_queue = array();
|
4194 |
|
4208 |
}
|
4209 |
}
|
4210 |
}
|
4211 |
+
|
4212 |
foreach ( $keep as $video_key => $value ) {
|
4213 |
$cleared_video_queue[] = $video_embed_queue[$video_key];
|
4214 |
}
|
4215 |
sort($cleared_video_queue);
|
4216 |
|
4217 |
update_option('kgvid_video_embed_queue', $cleared_video_queue);
|
4218 |
+
|
4219 |
}
|
4220 |
}
|
4221 |
add_action('kgvid_cleanup_queue','kgvid_clear_completed_queue');
|
4222 |
|
4223 |
function kgvid_ajax_clear_completed_queue() {
|
4224 |
|
4225 |
+
if ( current_user_can('encode_videos') ) {
|
4226 |
+
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4227 |
+
global $wpdb;
|
4228 |
+
kgvid_clear_completed_queue('manual');
|
4229 |
+
$table = kgvid_generate_queue_table();
|
4230 |
+
echo ($table);
|
4231 |
+
die();
|
4232 |
+
}
|
4233 |
+
|
4234 |
}
|
4235 |
add_action('wp_ajax_kgvid_clear_completed_queue', 'kgvid_ajax_clear_completed_queue');
|
4236 |
|
4237 |
function kgvid_ajax_clear_queue_entry() {
|
4238 |
|
4239 |
+
if ( current_user_can('encode_videos') ) {
|
4240 |
+
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4241 |
+
global $wpdb;
|
4242 |
+
$video_key = $_POST['index'];
|
4243 |
+
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
4244 |
+
if ( array_key_exists($video_key, $video_embed_queue) ) {
|
4245 |
+
unset($video_embed_queue[$video_key]);
|
4246 |
+
sort($video_embed_queue);
|
4247 |
+
}
|
4248 |
+
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
4249 |
+
$table = kgvid_generate_queue_table();
|
4250 |
+
echo ($table);
|
4251 |
+
die();
|
4252 |
}
|
4253 |
+
|
|
|
|
|
|
|
|
|
4254 |
}
|
4255 |
add_action('wp_ajax_kgvid_clear_queue_entry', 'kgvid_ajax_clear_queue_entry');
|
4256 |
|
4262 |
function kgvid_fix_moov_atom($video_key, $format) {
|
4263 |
|
4264 |
$options = get_option('kgvid_video_embed_options');
|
4265 |
+
|
4266 |
+
if ( $options['moov'] == "qt-faststart" || $options['moov'] == "MP4Box" ) {
|
4267 |
+
|
4268 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
4269 |
$filepath = $video_embed_queue[$video_key][$format]['filepath'];
|
4270 |
|
4277 |
rename($faststart_tmp_file, $filepath);
|
4278 |
}
|
4279 |
}//if qt-faststart is selected
|
4280 |
+
|
4281 |
if ( $options['moov'] == 'MP4Box' ) {
|
4282 |
$cmd = escapeshellcmd($options['app_path']."/".$options['moov']." -inter 500 ".$filepath);
|
4283 |
exec($cmd);
|
4284 |
}//if MP4Box is selected
|
4285 |
+
|
4286 |
}//if there is an application selected for fixing moov atoms on libx264-encoded files.
|
4287 |
|
4288 |
}
|
4289 |
|
4290 |
function kgvid_cancel_encode() {
|
4291 |
|
4292 |
+
if ( current_user_can('encode_videos') ) {
|
4293 |
+
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4294 |
|
4295 |
+
if (isset($_POST['kgvid_pid'])) {
|
4296 |
+
$kgvid_pid = $_POST['kgvid_pid'];
|
4297 |
+
if ( intval($kgvid_pid) > 0 ) {
|
4298 |
+
posix_kill($kgvid_pid, 15);
|
4299 |
+
}
|
4300 |
+
$video_key = $_POST['video_key'];
|
4301 |
+
$format = $_POST['format'];
|
4302 |
+
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
4303 |
+
$video_embed_queue[$video_key]['encode_formats'][$format]['status'] = "canceling";
|
4304 |
+
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
4305 |
}
|
4306 |
+
die(); // this is required to return a proper result
|
|
|
|
|
|
|
|
|
4307 |
}
|
4308 |
+
|
4309 |
}
|
4310 |
add_action('wp_ajax_kgvid_cancel_encode', 'kgvid_cancel_encode');
|
4311 |
|
4312 |
function kgvid_ajax_delete_video() {
|
4313 |
|
4314 |
+
if ( current_user_can('encode_videos') ) {
|
4315 |
+
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4316 |
+
global $wpdb;
|
4317 |
+
$deleted = false;
|
4318 |
+
$attachment_id = "";
|
4319 |
+
if ( isset($_POST['movieurl']) ) { $movieurl = $_POST['movieurl']; }
|
4320 |
+
if ( isset($_POST['postid']) ) { $post_id = $_POST['postid']; }
|
4321 |
+
if ( isset($_POST['format']) ) { $format = $_POST['format']; }
|
4322 |
+
if ( isset($_POST['childid']) ) { $attachment_id = $_POST['childid']; }
|
4323 |
+
if ( empty($attachment_id) ) { //if there's no post_meta giving us the attachment to delete
|
4324 |
+
$encodevideo_info = kgvid_encodevideo_info($movieurl, $post_id);
|
4325 |
+
if ( is_file($encodevideo_info[$format.'filepath']) ) {
|
4326 |
+
$deleted = unlink($encodevideo_info[$format.'filepath']);
|
4327 |
+
}
|
4328 |
+
}
|
4329 |
+
else {
|
4330 |
+
$deleted = wp_delete_attachment($attachment_id);
|
4331 |
+
if ( !empty($deleted) ) { $deleted = true; }
|
4332 |
+
}
|
4333 |
+
echo($deleted);
|
4334 |
+
die();
|
4335 |
+
}
|
4336 |
+
|
4337 |
}
|
4338 |
add_action('wp_ajax_kgvid_delete_video', 'kgvid_ajax_delete_video');
|
4339 |
|
4346 |
$video_embed_queue = get_option('kgvid_video_embed_queue');
|
4347 |
$parent_id = get_post($video_id)->post_parent;
|
4348 |
$wp_attached_file = get_post_meta($video_id, '_wp_attached_file', true);
|
4349 |
+
|
4350 |
if ( !empty($video_embed_queue) ) { //remove any encode queue entry related to this attachment
|
4351 |
foreach ($video_embed_queue as $video_key => $video_entry) {
|
4352 |
if ( $video_entry['attachmentID'] == $video_id ) {
|
4353 |
+
|
4354 |
+
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
4355 |
+
if ( $value['status'] == "encoding" ) {
|
4356 |
+
if ( intval($value['PID']) > 0 ) { posix_kill($value['PID'], 15); }
|
4357 |
+
if ( file_exists($value['filepath']) ) { unlink($value['filepath']); }
|
4358 |
+
}
|
4359 |
+
}
|
4360 |
+
|
4361 |
unset($video_embed_queue[$video_key]);
|
4362 |
sort($video_embed_queue);
|
4363 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
4366 |
if ( $video_entry['attachmentID'] == $parent_id || get_post_meta($video_id, '_kgflashmediaplayer-externalurl', true) == $video_entry['movieurl'] ) {
|
4367 |
foreach ( $video_entry['encode_formats'] as $format => $value ) {
|
4368 |
if ( array_key_exists('filepath', $value) ) {
|
4369 |
+
if ( strpos($value['filepath'], $wp_attached_file) !== false ) {
|
4370 |
$video_embed_queue[$video_key]['encode_formats'][$format]['status'] = "deleted";
|
4371 |
update_option('kgvid_video_embed_queue', $video_embed_queue);
|
4372 |
break;
|
4376 |
}//if the video is a child format
|
4377 |
}
|
4378 |
}
|
4379 |
+
|
4380 |
+
$args = array(
|
4381 |
'post_parent' => $video_id,
|
4382 |
'post_type' => 'attachment',
|
4383 |
'numberposts' => '-1'
|
4384 |
);
|
4385 |
$posts = get_posts( $args ); //find all children of the video in the database
|
4386 |
if ($posts) {
|
4387 |
+
$formats = array();
|
4388 |
foreach ($posts as $post) {
|
4389 |
wp_update_post( array( 'ID' => $post->ID, 'post_parent' => $parent_id ) ); //set post_parent field to the original video's post_parent
|
4390 |
if ( $options['delete_children'] != 'none' ) {
|
4391 |
if ( $options['delete_children'] == 'all' ) { wp_delete_attachment($post->ID, true); }
|
4392 |
else if ( strpos($post->post_mime_type, 'video') !== false ) { wp_delete_attachment($post->ID, true); } //only delete videos
|
4393 |
}
|
4394 |
+
else {
|
4395 |
+
if ( strpos($post->post_mime_type, 'video') !== false ) {
|
4396 |
+
$format = get_post_meta($post->ID, '_kgflashmediaplayer-format', true);
|
4397 |
+
if ( $format ) { $formats[$format] = $post->ID; }
|
4398 |
+
}
|
4399 |
+
}
|
4400 |
}//end loop
|
4401 |
+
if ( $options['delete_children'] == 'none' ) { //find a child to be the new master video
|
4402 |
+
$video_formats = kgvid_video_formats();
|
4403 |
+
foreach ( $video_formats as $format => $format_stats ) {
|
4404 |
+
if ( array_key_exists($format, $formats) ) {
|
4405 |
+
$new_master = $formats[$format];
|
4406 |
+
unset($formats[$format]);
|
4407 |
+
delete_post_meta($new_master, '_kgflashmediaplayer-format'); //master videos don't have the child format meta info
|
4408 |
+
wp_update_post( array( 'ID' => $new_master, 'post_title' => get_the_title($video_id) ) ); //set the new master's title to the old master's title
|
4409 |
+
foreach ( $formats as $child_id ) {
|
4410 |
+
wp_update_post( array( 'ID' => $child_id, 'post_parent' => $new_master ) ); //set all the other children as the new master's child
|
4411 |
+
}
|
4412 |
+
break; //stop after the highest quality format;
|
4413 |
+
}
|
4414 |
+
}
|
4415 |
+
}
|
4416 |
}//end if there are any children
|
4417 |
}//end if video
|
4418 |
|
4440 |
check_ajax_referer( 'video-embed-thumbnail-generator-nonce', 'security' );
|
4441 |
|
4442 |
global $wpdb;
|
4443 |
+
|
4444 |
/* $querystr = "
|
4445 |
+
SELECT $wpdb->posts.*
|
4446 |
FROM $wpdb->posts, $wpdb->postmeta
|
4447 |
+
WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
|
4448 |
+
AND $wpdb->postmeta.meta_key = '_kgflashmediaplayer-poster-id'
|
4449 |
ORDER BY $wpdb->posts.post_date ASC
|
4450 |
";
|
4451 |
$videoposts = $wpdb->get_results($querystr, OBJECT); */
|
4452 |
+
|
4453 |
$args = array(
|
4454 |
'post_type' => null,
|
4455 |
'numberposts' => -1,
|
4465 |
if ( !empty($post_id) && !empty($poster_id) ) { $posts[$post_id] = $poster_id; }
|
4466 |
}//end loop
|
4467 |
}//end if posts
|
4468 |
+
|
4469 |
$cms_switch_queue = get_option('kgvid_video_embed_cms_switch');
|
4470 |
$cms_switch_queue['set_featured'] = $posts;
|
4471 |
update_option('kgvid_video_embed_cms_switch', $cms_switch_queue);
|
4498 |
$new_parent = 'post';
|
4499 |
if (isset($_POST['parent'])) { $new_parent = $_POST['parent']; }
|
4500 |
$children = array();
|
4501 |
+
|
4502 |
if ( $new_parent == 'post' ) {
|
4503 |
+
|
4504 |
$args = array(
|
4505 |
'orderby' => 'post_date',
|
4506 |
'order' => 'ASC',
|
4512 |
|
4513 |
if ($attachments) {
|
4514 |
foreach ($attachments as $post) {
|
4515 |
+
if ( !empty($post->post_parent) ) { //if the video is attached to a post
|
4516 |
$args = array(
|
4517 |
'orderby' => 'post_date',
|
4518 |
'order' => 'ASC',
|
4531 |
}//end loop
|
4532 |
}//end if posts
|
4533 |
}//end if new parent is post
|
4534 |
+
|
4535 |
if ( $new_parent == 'video' ) {
|
4536 |
+
|
4537 |
$args = array(
|
4538 |
'orderby' => 'post_date',
|
4539 |
'order' => 'ASC',
|
4543 |
'numberposts' => -1
|
4544 |
);
|
4545 |
$thumbnails = get_posts( $args );
|
4546 |
+
|
4547 |
if ( $thumbnails ) {
|
4548 |
foreach ($thumbnails as $thumbnail) {
|
4549 |
$video_id = get_post_meta($thumbnail->ID, '_kgflashmediaplayer-video-id', true);
|
4566 |
if ( $queue['switching_parents'] ) {
|
4567 |
$new_parent = 'post';
|
4568 |
if (isset($_POST['parent'])) { $new_parent = $_POST['parent']; }
|
4569 |
+
|
4570 |
foreach ( $queue['switching_parents'] as $thumbnail_id => $thumbnail ) {
|
4571 |
if ( $new_parent == 'post' ) {
|
4572 |
wp_update_post( array( 'ID' => $thumbnail_id, 'post_parent' => $thumbnail['post_parent'] ) );
|
4573 |
update_post_meta($thumbnail_id, '_kgflashmediaplayer-video-id', $thumbnail['video_id']);
|
4574 |
}
|
4575 |
+
|
4576 |
if ( $new_parent == 'video' ) {
|
4577 |
wp_update_post( array( 'ID' => $thumbnail_id, 'post_parent' => $thumbnail['video_id'] ) );
|
4578 |
}
|
4599 |
}
|
4600 |
echo $remaining;
|
4601 |
die;
|
4602 |
+
|
4603 |
}
|
4604 |
add_action('wp_ajax_kgvid_update_cms_progress', 'kgvid_update_cms_progress');
|
4605 |
|
4606 |
+
/*function kgvid_singleurl_meta_box($postType) {
|
4607 |
|
4608 |
$matches = kgvid_check_for_shortcode_in_content();
|
4609 |
+
|
4610 |
if ( $matches[5] ) {
|
4611 |
add_meta_box(
|
4612 |
'kgvid_singleurl_meta',
|
4616 |
);
|
4617 |
}
|
4618 |
}
|
4619 |
+
add_action( 'add_meta_boxes', 'kgvid_singleurl_meta_box' ); */
|
4620 |
|
4621 |
function kgvid_singleurl_inner_custom_box($post) {
|
4622 |
|
4631 |
foreach ( $urls as $movieurl ) {
|
4632 |
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='{$movieurl}'"; //GUID seems to be the only way to get a video URL
|
4633 |
$video_id = $wpdb->get_var($query);
|
4634 |
+
|
4635 |
echo '<div class="kgvid_post_meta_boxes">';
|
4636 |
if ( empty($video_id) ) {
|
4637 |
$sanitized_url = kgvid_sanitize_url($movieurl);
|
4643 |
else {
|
4644 |
echo '<input type="hidden" name="attachments['.$video_id.'][kgflashmediaplayer-security]" value="'.$nonce.'">';
|
4645 |
echo '<strong>'.get_the_title($video_id).'</strong>';
|
4646 |
+
echo kgvid_generate_encode_checkboxes($movieurl, $video_id, 'queue');
|
4647 |
}
|
4648 |
echo '</div>';
|
4649 |
}//loop through KGVID URLs
|
4694 |
add_action( 'wp_ajax_nopriv_kgvid_count_play', 'kgvid_count_play' ); // ajax for not logged in users
|
4695 |
|
4696 |
function kgvid_deactivate() {
|
4697 |
+
$options = get_option('kgvid_video_embed_options');
|
4698 |
wp_clear_scheduled_hook('kgvid_cleanup_queue', array( 'scheduled' ) );
|
4699 |
delete_option('kgvid_video_embed_queue');
|
4700 |
+
global $wp_roles;
|
4701 |
+
foreach ( $options['capabilties'] as $capability => $roles ) {
|
4702 |
+
foreach ( $roles as $role => $role_info ) {
|
4703 |
+
$wp_roles->remove_cap( $role, $capability );
|
4704 |
+
}
|
4705 |
+
}
|
4706 |
}
|
4707 |
register_deactivation_hook( __FILE__, 'kgvid_deactivate' );
|
4708 |
|
4709 |
+
?>
|
video-js/kg-video-js-skin.css
CHANGED
@@ -1,100 +1,134 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
4 |
*/
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
font-family: 'VideoJS';
|
12 |
src: url('font/vjs.eot');
|
13 |
-
src: url('font/vjs.eot?#iefix') format('embedded-opentype'),
|
14 |
-
url('font/vjs.woff') format('woff'),
|
15 |
-
url('font/vjs.ttf') format('truetype');
|
16 |
font-weight: normal;
|
17 |
font-style: normal;
|
18 |
}
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
}
|
23 |
-
|
24 |
/* Slider - used for Volume bar and Seek bar */
|
25 |
.kg-video-js-skin .vjs-slider {
|
26 |
-
|
27 |
-
outline: 0;
|
28 |
position: relative;
|
29 |
cursor: pointer;
|
30 |
padding: 0;
|
31 |
-
|
32 |
-
background:
|
|
|
33 |
}
|
34 |
-
|
35 |
.kg-video-js-skin .vjs-slider:focus {
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
-moz-box-shadow: 0 0 2em rgba(255, 255, 255, 1);
|
41 |
-
box-shadow: 0 0 2em rgba(255, 255, 255, 1);
|
42 |
}
|
43 |
-
|
44 |
.kg-video-js-skin .vjs-slider-handle {
|
45 |
position: absolute;
|
46 |
/* Needed for IE6 */
|
47 |
left: 0;
|
48 |
top: 0;
|
49 |
}
|
50 |
-
|
51 |
.kg-video-js-skin .vjs-slider-handle:before {
|
52 |
-
|
53 |
-
content: "\e009"; /* Square icon */
|
54 |
font-family: VideoJS;
|
55 |
font-size: 1em;
|
56 |
line-height: 1;
|
57 |
text-align: center;
|
58 |
text-shadow: 0em 0em 1em #fff;
|
59 |
-
|
60 |
position: absolute;
|
61 |
top: 0;
|
62 |
left: 0;
|
63 |
-
|
64 |
/* Rotate the square icon to make a diamond */
|
|
|
65 |
-webkit-transform: rotate(-45deg);
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
}
|
71 |
-
|
72 |
/* Control Bar
|
73 |
-
--------------------------------------------------------------------------------
|
74 |
-
|
|
|
75 |
.kg-video-js-skin .vjs-control-bar {
|
76 |
-
|
|
|
77 |
position: absolute;
|
78 |
-
/*
|
|
|
79 |
bottom: 0;
|
80 |
-
/* 100% width of player div */
|
81 |
left: 0;
|
82 |
right: 0;
|
83 |
-
/* Controls are absolutely position, so no padding necessary */
|
84 |
-
padding: 0;
|
85 |
-
margin: 0;
|
86 |
/* Height includes any margin you want above or below control items */
|
87 |
height: 3.0em;
|
88 |
-
background-color
|
89 |
-
|
90 |
-
|
91 |
-
/* Default font settings */
|
92 |
-
font-style: normal;
|
93 |
-
font-weight: normal;
|
94 |
-
font-family: Arial, sans-serif;
|
95 |
-
z-index: 1002;
|
96 |
}
|
|
|
|
|
|
|
|
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
/* General styles for individual controls. */
|
99 |
.kg-video-js-skin .vjs-control {
|
100 |
outline: none;
|
@@ -106,7 +140,6 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
106 |
height: 3.0em;
|
107 |
width: 4em;
|
108 |
}
|
109 |
-
|
110 |
/* FontAwsome button icons */
|
111 |
.kg-video-js-skin .vjs-control:before {
|
112 |
font-family: VideoJS;
|
@@ -118,39 +151,44 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
118 |
width: 100%;
|
119 |
height: 100%;
|
120 |
text-align: center;
|
121 |
-
text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
|
122 |
}
|
123 |
-
|
124 |
/* Replacement for focus outline */
|
125 |
.kg-video-js-skin .vjs-control:focus:before,
|
126 |
.kg-video-js-skin .vjs-control:hover:before {
|
127 |
-
text-shadow: 0em 0em 1em
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
-
|
130 |
-
.kg-video-js-skin .vjs-control:focus { /* outline: 0; */ /* keyboard-only users cannot see the focus on several of the UI elements when this is set to 0 */ }
|
131 |
-
|
132 |
-
/* Hide control text visually, but have it available for screenreaders: h5bp.com/v */
|
133 |
-
.kg-video-js-skin .vjs-control-text { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
|
134 |
-
|
135 |
/* Play/Pause
|
136 |
-
--------------------------------------------------------------------------------
|
|
|
137 |
.kg-video-js-skin .vjs-play-control {
|
138 |
width: 5em;
|
139 |
cursor: pointer;
|
140 |
}
|
141 |
.kg-video-js-skin .vjs-play-control:before {
|
142 |
-
content: "\e001";
|
143 |
}
|
144 |
.kg-video-js-skin.vjs-playing .vjs-play-control:before {
|
145 |
-
content: "\e002";
|
146 |
}
|
147 |
-
|
148 |
-
/* Rewind
|
149 |
-
-------------------------------------------------------------------------------- */
|
150 |
-
/*.kg-video-js-skin .vjs-rewind-control { width: 5em; cursor: pointer !important; }
|
151 |
-
.kg-video-js-skin .vjs-rewind-control div { width: 19px; height: 16px; background: url('video-js.png'); margin: 0.5em auto 0; }
|
152 |
-
*/
|
153 |
-
|
154 |
/* Volume/Mute
|
155 |
-------------------------------------------------------------------------------- */
|
156 |
.kg-video-js-skin .vjs-mute-control,
|
@@ -160,21 +198,20 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
160 |
}
|
161 |
.kg-video-js-skin .vjs-mute-control:before,
|
162 |
.kg-video-js-skin .vjs-volume-menu-button:before {
|
163 |
-
content: "\e006";
|
164 |
}
|
165 |
.kg-video-js-skin .vjs-mute-control.vjs-vol-0:before,
|
166 |
.kg-video-js-skin .vjs-volume-menu-button.vjs-vol-0:before {
|
167 |
-
content: "\e003";
|
168 |
}
|
169 |
.kg-video-js-skin .vjs-mute-control.vjs-vol-1:before,
|
170 |
.kg-video-js-skin .vjs-volume-menu-button.vjs-vol-1:before {
|
171 |
-
content: "\e004";
|
172 |
}
|
173 |
.kg-video-js-skin .vjs-mute-control.vjs-vol-2:before,
|
174 |
.kg-video-js-skin .vjs-volume-menu-button.vjs-vol-2:before {
|
175 |
-
content: "\e005";
|
176 |
}
|
177 |
-
|
178 |
.kg-video-js-skin .vjs-volume-control {
|
179 |
width: 5em;
|
180 |
float: right;
|
@@ -184,46 +221,34 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
184 |
height: 0.6em;
|
185 |
margin: 1.1em auto 0;
|
186 |
}
|
187 |
-
|
188 |
.kg-video-js-skin .vjs-volume-menu-button .vjs-menu-content {
|
189 |
height: 2.9em;
|
190 |
}
|
191 |
-
|
192 |
.kg-video-js-skin .vjs-volume-level {
|
193 |
position: absolute;
|
194 |
top: 0;
|
195 |
left: 0;
|
196 |
height: 0.5em;
|
197 |
-
|
198 |
-
background: #66A8CC
|
199 |
-
url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC)
|
200 |
-
-50% 0 repeat;
|
201 |
}
|
202 |
.kg-video-js-skin .vjs-volume-bar .vjs-volume-handle {
|
203 |
width: 0.5em;
|
204 |
height: 0.5em;
|
205 |
}
|
206 |
-
|
207 |
.kg-video-js-skin .vjs-volume-handle:before {
|
208 |
font-size: 0.9em;
|
209 |
top: -0.2em;
|
210 |
left: -0.2em;
|
211 |
-
|
212 |
width: 1em;
|
213 |
height: 1em;
|
214 |
}
|
215 |
-
|
216 |
.kg-video-js-skin .vjs-volume-menu-button .vjs-menu .vjs-menu-content {
|
217 |
width: 6em;
|
218 |
left: -4em;
|
219 |
}
|
220 |
-
|
221 |
-
/*.kg-video-js-skin .vjs-menu-button .vjs-volume-control {
|
222 |
-
height: 1.5em;
|
223 |
-
}*/
|
224 |
-
|
225 |
/* Progress
|
226 |
-
--------------------------------------------------------------------------------
|
|
|
227 |
.kg-video-js-skin .vjs-progress-control {
|
228 |
position: absolute;
|
229 |
left: 0;
|
@@ -233,35 +258,31 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
233 |
height: 1em;
|
234 |
/* Set above the rest of the controls. */
|
235 |
top: -1em;
|
236 |
-
|
237 |
/* Shrink the bar slower than it grows. */
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
}
|
244 |
-
|
245 |
/* On hover, make the progress bar grow to something that's more clickable.
|
246 |
This simply changes the overall font for the progress bar, and this
|
247 |
updates both the em-based widths and heights, as wells as the icon font */
|
248 |
.kg-video-js-skin:hover .vjs-progress-control {
|
249 |
font-size: .9em;
|
250 |
-
|
251 |
/* Even though we're not changing the top/height, we need to include them in
|
252 |
the transition so they're handled correctly. */
|
253 |
-
-webkit-transition: top 0.2s, height 0.2s, font-size 0.2s, -webkit-transform 0.2s;
|
254 |
-
-moz-transition: top 0.2s, height 0.2s, font-size 0.2s, -moz-transform 0.2s;
|
255 |
-
-o-transition: top 0.2s, height 0.2s, font-size 0.2s, -o-transform 0.2s;
|
256 |
-
transition: top 0.2s, height 0.2s, font-size 0.2s, transform 0.2s;
|
257 |
-
}
|
258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
/* Box containing play and load progresses. Also acts as seek scrubber. */
|
260 |
.kg-video-js-skin .vjs-progress-holder {
|
261 |
-
/* Placement within the progress control item */
|
262 |
height: 100%;
|
263 |
}
|
264 |
-
|
265 |
/* Progress Bars */
|
266 |
.kg-video-js-skin .vjs-progress-holder .vjs-play-progress,
|
267 |
.kg-video-js-skin .vjs-progress-holder .vjs-load-progress {
|
@@ -274,64 +295,74 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
274 |
left: 0;
|
275 |
top: 0;
|
276 |
}
|
277 |
-
|
278 |
.kg-video-js-skin .vjs-play-progress {
|
279 |
/*
|
280 |
Using a data URI to create the white diagonal lines with a transparent
|
281 |
-
background.
|
282 |
Created using http://www.patternify.com
|
283 |
Changing the first color value will change the bar color.
|
284 |
Also using a paralax effect to make the lines move backwards.
|
285 |
The -50% left position makes that happen.
|
286 |
*/
|
287 |
-
|
288 |
-
|
289 |
-
-50% 0 repeat;
|
290 |
}
|
291 |
.kg-video-js-skin .vjs-load-progress {
|
292 |
-
background:
|
293 |
background: rgba(255, 255, 255, 0.4);
|
294 |
}
|
295 |
-
|
296 |
.kg-video-js-skin .vjs-seek-handle {
|
297 |
width: 1.5em;
|
298 |
height: 100%;
|
299 |
}
|
300 |
-
|
301 |
.kg-video-js-skin .vjs-seek-handle:before {
|
302 |
-
padding-top: 0.1em
|
303 |
}
|
304 |
-
|
305 |
/* Time Display
|
306 |
-
--------------------------------------------------------------------------------
|
|
|
307 |
.kg-video-js-skin .vjs-time-controls {
|
308 |
font-size: 1em;
|
309 |
/* Align vertically by making the line height the same as the control bar */
|
310 |
line-height: 3em;
|
311 |
}
|
312 |
-
.kg-video-js-skin .vjs-current-time {
|
313 |
-
|
|
|
|
|
|
|
|
|
314 |
/* Remaining time is in the HTML, but not included in default design */
|
315 |
-
.kg-video-js-skin .vjs-remaining-time {
|
316 |
-
|
317 |
-
|
|
|
|
|
|
|
|
|
|
|
318 |
/* Fullscreen
|
319 |
-
--------------------------------------------------------------------------------
|
|
|
320 |
.kg-video-js-skin .vjs-fullscreen-control {
|
321 |
width: 3.8em;
|
322 |
cursor: pointer;
|
323 |
float: right;
|
324 |
}
|
325 |
.kg-video-js-skin .vjs-fullscreen-control:before {
|
326 |
-
content: "\e000";
|
327 |
}
|
|
|
328 |
.kg-video-js-skin.vjs-fullscreen .vjs-fullscreen-control:before {
|
329 |
-
content: "\e00b";
|
330 |
}
|
331 |
-
|
332 |
-
|
333 |
-
|
|
|
|
|
334 |
.kg-video-js-skin .vjs-big-play-button {
|
|
|
335 |
display: block;
|
336 |
z-index: 2;
|
337 |
position: absolute;
|
@@ -347,177 +378,189 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
347 |
box-sizing: content-box;
|
348 |
-moz-box-sizing: content-box;
|
349 |
-webkit-box-sizing: content-box;
|
350 |
-
|
351 |
-
|
352 |
/* Need a slightly gray bg so it can be seen on black backgrounds */
|
|
|
353 |
background-color: rgb(40, 40, 40);
|
354 |
background-color: rgba(40, 40, 40, 0.6);
|
355 |
-
|
356 |
border: 0.6em solid rgb(255, 255, 255);
|
357 |
border-color: rgba(255, 255, 255, 0.7);
|
358 |
-
|
359 |
-webkit-border-radius: 100px;
|
360 |
-moz-border-radius: 100px;
|
361 |
border-radius: 100px;
|
362 |
-
|
363 |
-
-webkit-
|
364 |
-
|
365 |
-
|
366 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
}
|
368 |
-
|
369 |
.kg-video-js-skin:hover .vjs-big-play-button,
|
370 |
.kg-video-js-skin .vjs-big-play-button:focus {
|
371 |
outline: 0;
|
372 |
-
border-color:
|
373 |
-
border-color: rgba(255, 255, 255, 1);
|
374 |
/* IE8 needs a non-glow hover state */
|
375 |
-
background-color:
|
376 |
-
background-color: rgba(50, 50, 50, 0.
|
377 |
-
|
378 |
-
-webkit-
|
379 |
-
|
380 |
-
|
381 |
-
|
|
|
|
|
|
|
|
|
|
|
382 |
}
|
383 |
-
|
384 |
.kg-video-js-skin:hover .vjs-big-play-button:before {
|
385 |
color: white;
|
386 |
transition-property: color;
|
387 |
transition-duration: 0s;
|
388 |
}
|
389 |
-
|
390 |
.kg-video-js-skin .vjs-big-play-button:before {
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
}
|
403 |
-
|
404 |
/* Loading Spinner
|
405 |
-
|
|
|
406 |
.vjs-loading-spinner {
|
407 |
display: none;
|
408 |
position: absolute;
|
409 |
top: 50%;
|
410 |
left: 50%;
|
411 |
-
|
412 |
font-size: 5em;
|
413 |
line-height: 1;
|
414 |
-
|
415 |
width: 1em;
|
416 |
height: 1em;
|
417 |
-
|
418 |
margin-left: -0.5em;
|
419 |
margin-top: -0.5em;
|
420 |
-
|
421 |
opacity: 0.75;
|
422 |
-
|
423 |
-webkit-animation: spin 1.5s infinite linear;
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
}
|
428 |
-
|
429 |
.kg-video-js-skin .vjs-loading-spinner:before {
|
430 |
-
content: "\e00a";
|
431 |
font-family: VideoJS;
|
432 |
-
|
433 |
position: absolute;
|
|
|
|
|
434 |
width: 1em;
|
435 |
height: 1em;
|
436 |
text-align: center;
|
437 |
text-shadow: 0em 0em 0.1em #000;
|
438 |
}
|
439 |
-
|
440 |
-
/* Add a gradient to the spinner by overlaying another copy.
|
441 |
-
Text gradient plus a text shadow doesn't work
|
442 |
-
and `background-clip: text` only works in Webkit. */
|
443 |
-
.kg-video-js-skin .vjs-loading-spinner:after {
|
444 |
-
content: "\e00a"; /* Loading spinner icon */
|
445 |
-
font-family: VideoJS;
|
446 |
-
|
447 |
-
position: absolute;
|
448 |
-
width: 1em;
|
449 |
-
height: 1em;
|
450 |
-
text-align: center;
|
451 |
-
|
452 |
-
-webkit-background-clip: text;
|
453 |
-
-webkit-text-fill-color: transparent;
|
454 |
-
}
|
455 |
-
|
456 |
@-moz-keyframes spin {
|
457 |
-
0% {
|
458 |
-
|
|
|
|
|
|
|
|
|
459 |
}
|
460 |
@-webkit-keyframes spin {
|
461 |
-
0% {
|
462 |
-
|
|
|
|
|
|
|
|
|
463 |
}
|
464 |
@-o-keyframes spin {
|
465 |
-
0% {
|
466 |
-
|
467 |
-
}
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
}
|
472 |
@keyframes spin {
|
473 |
-
0% {
|
474 |
-
|
|
|
|
|
|
|
|
|
475 |
}
|
476 |
-
|
477 |
/* Menu Buttons (Captions/Subtitles/etc.)
|
478 |
-
--------------------------------------------------------------------------------
|
|
|
479 |
.kg-video-js-skin .vjs-menu-button {
|
480 |
float: right;
|
481 |
cursor: pointer;
|
482 |
}
|
483 |
-
|
484 |
.kg-video-js-skin .vjs-menu {
|
485 |
display: none;
|
486 |
position: absolute;
|
487 |
bottom: 0;
|
488 |
-
left: 0em;
|
|
|
|
|
489 |
width: 0em;
|
490 |
height: 0em;
|
491 |
margin-bottom: 3em;
|
492 |
-
|
493 |
border-left: 2em solid transparent;
|
494 |
border-right: 2em solid transparent;
|
|
|
|
|
495 |
|
496 |
-
border-top:
|
497 |
-
|
498 |
-
}
|
499 |
|
|
|
500 |
/* Button Pop-up Menu */
|
501 |
.kg-video-js-skin .vjs-menu-button .vjs-menu .vjs-menu-content {
|
502 |
display: block;
|
503 |
-
padding: 0;
|
|
|
504 |
position: absolute;
|
505 |
width: 10em;
|
506 |
-
bottom: 1.5em;
|
|
|
|
|
507 |
max-height: 15em;
|
508 |
overflow: auto;
|
|
|
|
|
509 |
|
510 |
-
|
511 |
-
|
512 |
-
background-color:
|
513 |
-
|
514 |
-
|
515 |
-
-
|
516 |
-
|
517 |
-
box-shadow: -0.2em -0.2em 0.3em rgba(255, 255, 255, 0.2);
|
518 |
}
|
519 |
-
|
520 |
-
/*.kg-video-js-skin .vjs-menu-button:focus ul,*/ /* This is not needed because keyboard accessibility for the caption button is not handled with the focus any more. */
|
521 |
.kg-video-js-skin .vjs-menu-button:hover .vjs-menu {
|
522 |
display: block;
|
523 |
}
|
@@ -527,7 +570,6 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
527 |
padding: 0.3em 0 0.3em 0;
|
528 |
line-height: 1.4em;
|
529 |
font-size: 1.2em;
|
530 |
-
font-weight: normal;
|
531 |
text-align: center;
|
532 |
text-transform: lowercase;
|
533 |
}
|
@@ -538,14 +580,15 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
538 |
.kg-video-js-skin .vjs-menu-button ul li:hover,
|
539 |
.kg-video-js-skin .vjs-menu-button ul li.vjs-selected:focus,
|
540 |
.kg-video-js-skin .vjs-menu-button ul li.vjs-selected:hover {
|
541 |
-
background-color: rgb(255, 255, 255);
|
542 |
-
background-color: rgba(255, 255, 255, 0.75);
|
543 |
-
color: #111;
|
544 |
outline: 0;
|
545 |
-
|
546 |
-
-
|
547 |
-
|
548 |
-
|
|
|
|
|
|
|
|
|
549 |
}
|
550 |
.kg-video-js-skin .vjs-menu-button ul li.vjs-menu-title {
|
551 |
text-align: center;
|
@@ -557,35 +600,169 @@ by Kyle Gilman (http://www.kylegilman.net/)
|
|
557 |
font-weight: bold;
|
558 |
cursor: default;
|
559 |
}
|
560 |
-
|
561 |
/* Subtitles Button */
|
562 |
-
.kg-video-js-skin .vjs-subtitles-button:before {
|
563 |
-
|
564 |
-
/* There's unfortunately no CC button in FontAwesome, so we need
|
565 |
-
to manually create one. Please +1 the fontawesome request.
|
566 |
-
https://github.com/FortAwesome/Font-Awesome/issues/968 */
|
567 |
-
.kg-video-js-skin .vjs-captions-button {
|
568 |
-
font-size: 1em; /* Font icons are 1.5em */
|
569 |
}
|
|
|
570 |
.kg-video-js-skin .vjs-captions-button:before {
|
571 |
content: "\e008";
|
572 |
-
|
573 |
-
|
574 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
position: absolute;
|
576 |
top: 0;
|
577 |
left: 0;
|
578 |
width: 100%;
|
579 |
height: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
580 |
text-align: center;
|
581 |
-
|
|
|
|
|
|
|
|
|
582 |
}
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
-
|
589 |
-
|
590 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
591 |
}
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
Video.js Default Styles (http://videojs.com)
|
3 |
+
Version 4.2.0
|
4 |
+
Create your own skin at http://designer.videojs.com
|
5 |
*/
|
6 |
+
/* SKIN
|
7 |
+
================================================================================
|
8 |
+
The main class name for all skin-specific styles. To make your own skin,
|
9 |
+
replace all occurances of 'vjs-default-skin' with a new name. Then add your new
|
10 |
+
skin name to your video tag instead of the default skin.
|
11 |
+
e.g. <video class="video-js my-skin-name">
|
12 |
+
*/
|
13 |
+
.kg-video-js-skin {
|
14 |
+
color: #cccccc;
|
15 |
+
}
|
16 |
+
/* Custom Icon Font
|
17 |
+
--------------------------------------------------------------------------------
|
18 |
+
The control icons are from a custom font. Each icon corresponds to a character
|
19 |
+
(e.g. "\e001"). Font icons allow for easy scaling and coloring of icons.
|
20 |
+
*/
|
21 |
+
@font-face {
|
22 |
font-family: 'VideoJS';
|
23 |
src: url('font/vjs.eot');
|
24 |
+
src: url('font/vjs.eot?#iefix') format('embedded-opentype'), url('font/vjs.woff') format('woff'), url('font/vjs.ttf') format('truetype');
|
|
|
|
|
25 |
font-weight: normal;
|
26 |
font-style: normal;
|
27 |
}
|
28 |
+
/* Base UI Component Classes
|
29 |
+
--------------------------------------------------------------------------------
|
30 |
+
*/
|
|
|
|
|
31 |
/* Slider - used for Volume bar and Seek bar */
|
32 |
.kg-video-js-skin .vjs-slider {
|
33 |
+
/* Replace browser focus hightlight with handle highlight */
|
34 |
+
outline: 0;
|
35 |
position: relative;
|
36 |
cursor: pointer;
|
37 |
padding: 0;
|
38 |
+
/* background-color-with-alpha */
|
39 |
+
background-color: #333333;
|
40 |
+
background-color: rgba(51, 51, 51, 0.9);
|
41 |
}
|
|
|
42 |
.kg-video-js-skin .vjs-slider:focus {
|
43 |
+
/* box-shadow */
|
44 |
+
-webkit-box-shadow: 0 0 2em #ffffff;
|
45 |
+
-moz-box-shadow: 0 0 2em #ffffff;
|
46 |
+
box-shadow: 0 0 2em #ffffff;
|
|
|
|
|
47 |
}
|
|
|
48 |
.kg-video-js-skin .vjs-slider-handle {
|
49 |
position: absolute;
|
50 |
/* Needed for IE6 */
|
51 |
left: 0;
|
52 |
top: 0;
|
53 |
}
|
|
|
54 |
.kg-video-js-skin .vjs-slider-handle:before {
|
55 |
+
content: "\e009";
|
|
|
56 |
font-family: VideoJS;
|
57 |
font-size: 1em;
|
58 |
line-height: 1;
|
59 |
text-align: center;
|
60 |
text-shadow: 0em 0em 1em #fff;
|
|
|
61 |
position: absolute;
|
62 |
top: 0;
|
63 |
left: 0;
|
|
|
64 |
/* Rotate the square icon to make a diamond */
|
65 |
+
/* transform */
|
66 |
-webkit-transform: rotate(-45deg);
|
67 |
+
-moz-transform: rotate(-45deg);
|
68 |
+
-ms-transform: rotate(-45deg);
|
69 |
+
-o-transform: rotate(-45deg);
|
70 |
+
transform: rotate(-45deg);
|
71 |
}
|
|
|
72 |
/* Control Bar
|
73 |
+
--------------------------------------------------------------------------------
|
74 |
+
The default control bar that is a container for most of the controls.
|
75 |
+
*/
|
76 |
.kg-video-js-skin .vjs-control-bar {
|
77 |
+
/* Start hidden */
|
78 |
+
display: none;
|
79 |
position: absolute;
|
80 |
+
/* Place control bar at the bottom of the player box/video.
|
81 |
+
If you want more margin below the control bar, add more height. */
|
82 |
bottom: 0;
|
83 |
+
/* Use left/right to stretch to 100% width of player div */
|
84 |
left: 0;
|
85 |
right: 0;
|
|
|
|
|
|
|
86 |
/* Height includes any margin you want above or below control items */
|
87 |
height: 3.0em;
|
88 |
+
/* background-color-with-alpha */
|
89 |
+
background-color: #282828;
|
90 |
+
background-color: rgba(40, 40, 40, 0.7);
|
|
|
|
|
|
|
|
|
|
|
91 |
}
|
92 |
+
/* Show the control bar only once the video has started playing */
|
93 |
+
.kg-video-js-skin.vjs-has-started .vjs-control-bar {
|
94 |
+
display: block;
|
95 |
+
/* Visibility needed to make sure things hide in older browsers too. */
|
96 |
|
97 |
+
visibility: visible;
|
98 |
+
opacity: 1;
|
99 |
+
/* transition */
|
100 |
+
-webkit-transition: visibility 0.1s, opacity 0.1s;
|
101 |
+
-moz-transition: visibility 0.1s, opacity 0.1s;
|
102 |
+
-o-transition: visibility 0.1s, opacity 0.1s;
|
103 |
+
transition: visibility 0.1s, opacity 0.1s;
|
104 |
+
}
|
105 |
+
/* Hide the control bar when the video is playing and the user is inactive */
|
106 |
+
.kg-video-js-skin.vjs-has-started.vjs-user-inactive.vjs-playing .vjs-control-bar {
|
107 |
+
display: block;
|
108 |
+
visibility: hidden;
|
109 |
+
opacity: 0;
|
110 |
+
/* transition */
|
111 |
+
-webkit-transition: visibility 1s, opacity 1s;
|
112 |
+
-moz-transition: visibility 1s, opacity 1s;
|
113 |
+
-o-transition: visibility 1s, opacity 1s;
|
114 |
+
transition: visibility 1s, opacity 1s;
|
115 |
+
}
|
116 |
+
.kg-video-js-skin.vjs-controls-disabled .vjs-control-bar {
|
117 |
+
display: none;
|
118 |
+
}
|
119 |
+
.kg-video-js-skin.vjs-using-native-controls .vjs-control-bar {
|
120 |
+
display: none;
|
121 |
+
}
|
122 |
+
/* IE8 is flakey with fonts, and you have to change the actual content to force
|
123 |
+
fonts to show/hide properly.
|
124 |
+
- "\9" IE8 hack didn't work for this
|
125 |
+
- Found in XP IE8 from http://modern.ie. Does not show up in "IE8 mode" in IE9
|
126 |
+
*/
|
127 |
+
@media \0screen {
|
128 |
+
.kg-video-js-skin.vjs-user-inactive.vjs-playing .vjs-control-bar :before {
|
129 |
+
content: "";
|
130 |
+
}
|
131 |
+
}
|
132 |
/* General styles for individual controls. */
|
133 |
.kg-video-js-skin .vjs-control {
|
134 |
outline: none;
|
140 |
height: 3.0em;
|
141 |
width: 4em;
|
142 |
}
|
|
|
143 |
/* FontAwsome button icons */
|
144 |
.kg-video-js-skin .vjs-control:before {
|
145 |
font-family: VideoJS;
|
151 |
width: 100%;
|
152 |
height: 100%;
|
153 |
text-align: center;
|
154 |
+
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
|
155 |
}
|
|
|
156 |
/* Replacement for focus outline */
|
157 |
.kg-video-js-skin .vjs-control:focus:before,
|
158 |
.kg-video-js-skin .vjs-control:hover:before {
|
159 |
+
text-shadow: 0em 0em 1em #ffffff;
|
160 |
+
}
|
161 |
+
.kg-video-js-skin .vjs-control:focus {
|
162 |
+
/* outline: 0; */
|
163 |
+
/* keyboard-only users cannot see the focus on several of the UI elements when
|
164 |
+
this is set to 0 */
|
165 |
+
|
166 |
+
}
|
167 |
+
/* Hide control text visually, but have it available for screenreaders */
|
168 |
+
.kg-video-js-skin .vjs-control-text {
|
169 |
+
/* hide-visually */
|
170 |
+
border: 0;
|
171 |
+
clip: rect(0 0 0 0);
|
172 |
+
height: 1px;
|
173 |
+
margin: -1px;
|
174 |
+
overflow: hidden;
|
175 |
+
padding: 0;
|
176 |
+
position: absolute;
|
177 |
+
width: 1px;
|
178 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
/* Play/Pause
|
180 |
+
--------------------------------------------------------------------------------
|
181 |
+
*/
|
182 |
.kg-video-js-skin .vjs-play-control {
|
183 |
width: 5em;
|
184 |
cursor: pointer;
|
185 |
}
|
186 |
.kg-video-js-skin .vjs-play-control:before {
|
187 |
+
content: "\e001";
|
188 |
}
|
189 |
.kg-video-js-skin.vjs-playing .vjs-play-control:before {
|
190 |
+
content: "\e002";
|
191 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
/* Volume/Mute
|
193 |
-------------------------------------------------------------------------------- */
|
194 |
.kg-video-js-skin .vjs-mute-control,
|
198 |
}
|
199 |
.kg-video-js-skin .vjs-mute-control:before,
|
200 |
.kg-video-js-skin .vjs-volume-menu-button:before {
|
201 |
+
content: "\e006";
|
202 |
}
|
203 |
.kg-video-js-skin .vjs-mute-control.vjs-vol-0:before,
|
204 |
.kg-video-js-skin .vjs-volume-menu-button.vjs-vol-0:before {
|
205 |
+
content: "\e003";
|
206 |
}
|
207 |
.kg-video-js-skin .vjs-mute-control.vjs-vol-1:before,
|
208 |
.kg-video-js-skin .vjs-volume-menu-button.vjs-vol-1:before {
|
209 |
+
content: "\e004";
|
210 |
}
|
211 |
.kg-video-js-skin .vjs-mute-control.vjs-vol-2:before,
|
212 |
.kg-video-js-skin .vjs-volume-menu-button.vjs-vol-2:before {
|
213 |
+
content: "\e005";
|
214 |
}
|
|
|
215 |
.kg-video-js-skin .vjs-volume-control {
|
216 |
width: 5em;
|
217 |
float: right;
|
221 |
height: 0.6em;
|
222 |
margin: 1.1em auto 0;
|
223 |
}
|
|
|
224 |
.kg-video-js-skin .vjs-volume-menu-button .vjs-menu-content {
|
225 |
height: 2.9em;
|
226 |
}
|
|
|
227 |
.kg-video-js-skin .vjs-volume-level {
|
228 |
position: absolute;
|
229 |
top: 0;
|
230 |
left: 0;
|
231 |
height: 0.5em;
|
232 |
+
background: #66a8cc url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat;
|
|
|
|
|
|
|
233 |
}
|
234 |
.kg-video-js-skin .vjs-volume-bar .vjs-volume-handle {
|
235 |
width: 0.5em;
|
236 |
height: 0.5em;
|
237 |
}
|
|
|
238 |
.kg-video-js-skin .vjs-volume-handle:before {
|
239 |
font-size: 0.9em;
|
240 |
top: -0.2em;
|
241 |
left: -0.2em;
|
|
|
242 |
width: 1em;
|
243 |
height: 1em;
|
244 |
}
|
|
|
245 |
.kg-video-js-skin .vjs-volume-menu-button .vjs-menu .vjs-menu-content {
|
246 |
width: 6em;
|
247 |
left: -4em;
|
248 |
}
|
|
|
|
|
|
|
|
|
|
|
249 |
/* Progress
|
250 |
+
--------------------------------------------------------------------------------
|
251 |
+
*/
|
252 |
.kg-video-js-skin .vjs-progress-control {
|
253 |
position: absolute;
|
254 |
left: 0;
|
258 |
height: 1em;
|
259 |
/* Set above the rest of the controls. */
|
260 |
top: -1em;
|
|
|
261 |
/* Shrink the bar slower than it grows. */
|
262 |
+
/* transition */
|
263 |
+
-webkit-transition: all 0.4s;
|
264 |
+
-moz-transition: all 0.4s;
|
265 |
+
-o-transition: all 0.4s;
|
266 |
+
transition: all 0.4s;
|
267 |
}
|
|
|
268 |
/* On hover, make the progress bar grow to something that's more clickable.
|
269 |
This simply changes the overall font for the progress bar, and this
|
270 |
updates both the em-based widths and heights, as wells as the icon font */
|
271 |
.kg-video-js-skin:hover .vjs-progress-control {
|
272 |
font-size: .9em;
|
|
|
273 |
/* Even though we're not changing the top/height, we need to include them in
|
274 |
the transition so they're handled correctly. */
|
|
|
|
|
|
|
|
|
|
|
275 |
|
276 |
+
/* transition */
|
277 |
+
-webkit-transition: all 0.2s;
|
278 |
+
-moz-transition: all 0.2s;
|
279 |
+
-o-transition: all 0.2s;
|
280 |
+
transition: all 0.2s;
|
281 |
+
}
|
282 |
/* Box containing play and load progresses. Also acts as seek scrubber. */
|
283 |
.kg-video-js-skin .vjs-progress-holder {
|
|
|
284 |
height: 100%;
|
285 |
}
|
|
|
286 |
/* Progress Bars */
|
287 |
.kg-video-js-skin .vjs-progress-holder .vjs-play-progress,
|
288 |
.kg-video-js-skin .vjs-progress-holder .vjs-load-progress {
|
295 |
left: 0;
|
296 |
top: 0;
|
297 |
}
|
|
|
298 |
.kg-video-js-skin .vjs-play-progress {
|
299 |
/*
|
300 |
Using a data URI to create the white diagonal lines with a transparent
|
301 |
+
background. Surprisingly works in IE8.
|
302 |
Created using http://www.patternify.com
|
303 |
Changing the first color value will change the bar color.
|
304 |
Also using a paralax effect to make the lines move backwards.
|
305 |
The -50% left position makes that happen.
|
306 |
*/
|
307 |
+
|
308 |
+
background: #66a8cc url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAYAAADgzO9IAAAAP0lEQVQIHWWMAQoAIAgDR/QJ/Ub//04+w7ZICBwcOg5FZi5iBB82AGzixEglJrd4TVK5XUJpskSTEvpdFzX9AB2pGziSQcvAAAAAAElFTkSuQmCC) -50% 0 repeat;
|
|
|
309 |
}
|
310 |
.kg-video-js-skin .vjs-load-progress {
|
311 |
+
background: #646464 /* IE8- Fallback */;
|
312 |
background: rgba(255, 255, 255, 0.4);
|
313 |
}
|
|
|
314 |
.kg-video-js-skin .vjs-seek-handle {
|
315 |
width: 1.5em;
|
316 |
height: 100%;
|
317 |
}
|
|
|
318 |
.kg-video-js-skin .vjs-seek-handle:before {
|
319 |
+
padding-top: 0.1em /* Minor adjustment */;
|
320 |
}
|
|
|
321 |
/* Time Display
|
322 |
+
--------------------------------------------------------------------------------
|
323 |
+
*/
|
324 |
.kg-video-js-skin .vjs-time-controls {
|
325 |
font-size: 1em;
|
326 |
/* Align vertically by making the line height the same as the control bar */
|
327 |
line-height: 3em;
|
328 |
}
|
329 |
+
.kg-video-js-skin .vjs-current-time {
|
330 |
+
float: left;
|
331 |
+
}
|
332 |
+
.kg-video-js-skin .vjs-duration {
|
333 |
+
float: left;
|
334 |
+
}
|
335 |
/* Remaining time is in the HTML, but not included in default design */
|
336 |
+
.kg-video-js-skin .vjs-remaining-time {
|
337 |
+
display: none;
|
338 |
+
float: left;
|
339 |
+
}
|
340 |
+
.vjs-time-divider {
|
341 |
+
float: left;
|
342 |
+
line-height: 3em;
|
343 |
+
}
|
344 |
/* Fullscreen
|
345 |
+
--------------------------------------------------------------------------------
|
346 |
+
*/
|
347 |
.kg-video-js-skin .vjs-fullscreen-control {
|
348 |
width: 3.8em;
|
349 |
cursor: pointer;
|
350 |
float: right;
|
351 |
}
|
352 |
.kg-video-js-skin .vjs-fullscreen-control:before {
|
353 |
+
content: "\e000";
|
354 |
}
|
355 |
+
/* Switch to the exit icon when the player is in fullscreen */
|
356 |
.kg-video-js-skin.vjs-fullscreen .vjs-fullscreen-control:before {
|
357 |
+
content: "\e00b";
|
358 |
}
|
359 |
+
/* Big Play Button (play button at start)
|
360 |
+
--------------------------------------------------------------------------------
|
361 |
+
Positioning of the play button in the center or other corners can be done more
|
362 |
+
easily in the skin designer. http://designer.videojs.com/
|
363 |
+
*/
|
364 |
.kg-video-js-skin .vjs-big-play-button {
|
365 |
+
|
366 |
display: block;
|
367 |
z-index: 2;
|
368 |
position: absolute;
|
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);
|
384 |
background-color: rgba(40, 40, 40, 0.6);
|
|
|
385 |
border: 0.6em solid rgb(255, 255, 255);
|
386 |
border-color: rgba(255, 255, 255, 0.7);
|
387 |
+
/* border-radius */
|
388 |
-webkit-border-radius: 100px;
|
389 |
-moz-border-radius: 100px;
|
390 |
border-radius: 100px;
|
391 |
+
/* box-shadow
|
392 |
+
-webkit-box-shadow: 0px 0px 1em rgba(255, 255, 255, 0.25);
|
393 |
+
-moz-box-shadow: 0px 0px 1em rgba(255, 255, 255, 0.25);
|
394 |
+
box-shadow: 0px 0px 1em rgba(255, 255, 255, 0.25);
|
395 |
+
*/
|
396 |
+
/* transition */
|
397 |
+
-webkit-transition: all 0.4s;
|
398 |
+
-moz-transition: all 0.4s;
|
399 |
+
-o-transition: all 0.4s;
|
400 |
+
transition: all 0.4s;
|
401 |
+
}
|
402 |
+
/* Hide if controls are disabled */
|
403 |
+
.kg-video-js-skin.vjs-controls-disabled .vjs-big-play-button {
|
404 |
+
display: none;
|
405 |
+
}
|
406 |
+
/* Hide when video starts playing */
|
407 |
+
.kg-video-js-skin.vjs-has-started .vjs-big-play-button {
|
408 |
+
display: none;
|
409 |
+
}
|
410 |
+
/* Hide on mobile devices. Remove when we stop using native controls
|
411 |
+
by default on mobile */
|
412 |
+
.kg-video-js-skin.vjs-using-native-controls .vjs-big-play-button {
|
413 |
+
display: none;
|
414 |
}
|
|
|
415 |
.kg-video-js-skin:hover .vjs-big-play-button,
|
416 |
.kg-video-js-skin .vjs-big-play-button:focus {
|
417 |
outline: 0;
|
418 |
+
border-color: #fff;
|
|
|
419 |
/* IE8 needs a non-glow hover state */
|
420 |
+
background-color: #505050;
|
421 |
+
background-color: rgba(50, 50, 50, 0.75);
|
422 |
+
/* box-shadow
|
423 |
+
-webkit-box-shadow: 0 0 3em #ffffff;
|
424 |
+
-moz-box-shadow: 0 0 3em #ffffff;
|
425 |
+
box-shadow: 0 0 3em #ffffff;
|
426 |
+
*/
|
427 |
+
/* transition */
|
428 |
+
-webkit-transition: all 0s;
|
429 |
+
-moz-transition: all 0s;
|
430 |
+
-o-transition: all 0s;
|
431 |
+
transition: all 0s;
|
432 |
}
|
|
|
433 |
.kg-video-js-skin:hover .vjs-big-play-button:before {
|
434 |
color: white;
|
435 |
transition-property: color;
|
436 |
transition-duration: 0s;
|
437 |
}
|
|
|
438 |
.kg-video-js-skin .vjs-big-play-button:before {
|
439 |
+
content: "\e001";
|
440 |
+
font-family: VideoJS;
|
441 |
+
line-height: 1.5em;
|
442 |
+
font-size: 5.5em;
|
443 |
+
text-align: center /* Needed for IE8 */;
|
444 |
+
position: absolute;
|
445 |
+
left: 2px;
|
446 |
+
width: 100%;
|
447 |
+
height: 100%;
|
448 |
+
transition-property: color;
|
449 |
+
transition-duration: 0.4s;
|
450 |
}
|
|
|
451 |
/* Loading Spinner
|
452 |
+
--------------------------------------------------------------------------------
|
453 |
+
*/
|
454 |
.vjs-loading-spinner {
|
455 |
display: none;
|
456 |
position: absolute;
|
457 |
top: 50%;
|
458 |
left: 50%;
|
|
|
459 |
font-size: 5em;
|
460 |
line-height: 1;
|
|
|
461 |
width: 1em;
|
462 |
height: 1em;
|
|
|
463 |
margin-left: -0.5em;
|
464 |
margin-top: -0.5em;
|
|
|
465 |
opacity: 0.75;
|
466 |
+
/* animation */
|
467 |
-webkit-animation: spin 1.5s infinite linear;
|
468 |
+
-moz-animation: spin 1.5s infinite linear;
|
469 |
+
-o-animation: spin 1.5s infinite linear;
|
470 |
+
animation: spin 1.5s infinite linear;
|
471 |
}
|
|
|
472 |
.kg-video-js-skin .vjs-loading-spinner:before {
|
473 |
+
content: "\e00a";
|
474 |
font-family: VideoJS;
|
|
|
475 |
position: absolute;
|
476 |
+
top: 0;
|
477 |
+
left: 0;
|
478 |
width: 1em;
|
479 |
height: 1em;
|
480 |
text-align: center;
|
481 |
text-shadow: 0em 0em 0.1em #000;
|
482 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
483 |
@-moz-keyframes spin {
|
484 |
+
0% {
|
485 |
+
-moz-transform: rotate(0deg);
|
486 |
+
}
|
487 |
+
100% {
|
488 |
+
-moz-transform: rotate(359deg);
|
489 |
+
}
|
490 |
}
|
491 |
@-webkit-keyframes spin {
|
492 |
+
0% {
|
493 |
+
-webkit-transform: rotate(0deg);
|
494 |
+
}
|
495 |
+
100% {
|
496 |
+
-webkit-transform: rotate(359deg);
|
497 |
+
}
|
498 |
}
|
499 |
@-o-keyframes spin {
|
500 |
+
0% {
|
501 |
+
-o-transform: rotate(0deg);
|
502 |
+
}
|
503 |
+
100% {
|
504 |
+
-o-transform: rotate(359deg);
|
505 |
+
}
|
506 |
}
|
507 |
@keyframes spin {
|
508 |
+
0% {
|
509 |
+
transform: rotate(0deg);
|
510 |
+
}
|
511 |
+
100% {
|
512 |
+
transform: rotate(359deg);
|
513 |
+
}
|
514 |
}
|
|
|
515 |
/* Menu Buttons (Captions/Subtitles/etc.)
|
516 |
+
--------------------------------------------------------------------------------
|
517 |
+
*/
|
518 |
.kg-video-js-skin .vjs-menu-button {
|
519 |
float: right;
|
520 |
cursor: pointer;
|
521 |
}
|
|
|
522 |
.kg-video-js-skin .vjs-menu {
|
523 |
display: none;
|
524 |
position: absolute;
|
525 |
bottom: 0;
|
526 |
+
left: 0em;
|
527 |
+
/* (Width of vjs-menu - width of button) / 2 */
|
528 |
+
|
529 |
width: 0em;
|
530 |
height: 0em;
|
531 |
margin-bottom: 3em;
|
|
|
532 |
border-left: 2em solid transparent;
|
533 |
border-right: 2em solid transparent;
|
534 |
+
border-top: 1.55em solid #000000;
|
535 |
+
/* Same width top as ul bottom */
|
536 |
|
537 |
+
border-top-color: rgba(7, 40, 50, 0.5);
|
538 |
+
/* Same as ul background */
|
|
|
539 |
|
540 |
+
}
|
541 |
/* Button Pop-up Menu */
|
542 |
.kg-video-js-skin .vjs-menu-button .vjs-menu .vjs-menu-content {
|
543 |
display: block;
|
544 |
+
padding: 0;
|
545 |
+
margin: 0;
|
546 |
position: absolute;
|
547 |
width: 10em;
|
548 |
+
bottom: 1.5em;
|
549 |
+
/* Same bottom as vjs-menu border-top */
|
550 |
+
|
551 |
max-height: 15em;
|
552 |
overflow: auto;
|
553 |
+
left: -5em;
|
554 |
+
/* Width of menu - width of button / 2 */
|
555 |
|
556 |
+
/* background-color-with-alpha */
|
557 |
+
background-color: #07141e;
|
558 |
+
background-color: rgba(7, 20, 30, 0.7);
|
559 |
+
/* box-shadow */
|
560 |
+
-webkit-box-shadow: -0.2em -0.2em 0.3em rgba(255, 255, 255, 0.2);
|
561 |
+
-moz-box-shadow: -0.2em -0.2em 0.3em rgba(255, 255, 255, 0.2);
|
562 |
+
box-shadow: -0.2em -0.2em 0.3em rgba(255, 255, 255, 0.2);
|
|
|
563 |
}
|
|
|
|
|
564 |
.kg-video-js-skin .vjs-menu-button:hover .vjs-menu {
|
565 |
display: block;
|
566 |
}
|
570 |
padding: 0.3em 0 0.3em 0;
|
571 |
line-height: 1.4em;
|
572 |
font-size: 1.2em;
|
|
|
573 |
text-align: center;
|
574 |
text-transform: lowercase;
|
575 |
}
|
580 |
.kg-video-js-skin .vjs-menu-button ul li:hover,
|
581 |
.kg-video-js-skin .vjs-menu-button ul li.vjs-selected:focus,
|
582 |
.kg-video-js-skin .vjs-menu-button ul li.vjs-selected:hover {
|
|
|
|
|
|
|
583 |
outline: 0;
|
584 |
+
color: #111;
|
585 |
+
/* background-color-with-alpha */
|
586 |
+
background-color: #ffffff;
|
587 |
+
background-color: rgba(255, 255, 255, 0.75);
|
588 |
+
/* box-shadow */
|
589 |
+
-webkit-box-shadow: 0 0 1em #ffffff;
|
590 |
+
-moz-box-shadow: 0 0 1em #ffffff;
|
591 |
+
box-shadow: 0 0 1em #ffffff;
|
592 |
}
|
593 |
.kg-video-js-skin .vjs-menu-button ul li.vjs-menu-title {
|
594 |
text-align: center;
|
600 |
font-weight: bold;
|
601 |
cursor: default;
|
602 |
}
|
|
|
603 |
/* Subtitles Button */
|
604 |
+
.kg-video-js-skin .vjs-subtitles-button:before {
|
605 |
+
content: "\e00c";
|
|
|
|
|
|
|
|
|
|
|
606 |
}
|
607 |
+
/* Captions Button */
|
608 |
.kg-video-js-skin .vjs-captions-button:before {
|
609 |
content: "\e008";
|
610 |
+
}
|
611 |
+
/* Replacement for focus outline */
|
612 |
+
.kg-video-js-skin .vjs-captions-button:focus .vjs-control-content:before,
|
613 |
+
.kg-video-js-skin .vjs-captions-button:hover .vjs-control-content:before {
|
614 |
+
/* box-shadow */
|
615 |
+
-webkit-box-shadow: 0 0 1em #ffffff;
|
616 |
+
-moz-box-shadow: 0 0 1em #ffffff;
|
617 |
+
box-shadow: 0 0 1em #ffffff;
|
618 |
+
}
|
619 |
+
/*
|
620 |
+
REQUIRED STYLES (be careful overriding)
|
621 |
+
================================================================================
|
622 |
+
When loading the player, the video tag is replaced with a DIV,
|
623 |
+
that will hold the video tag or object tag for other playback methods.
|
624 |
+
The div contains the video playback element (Flash or HTML5) and controls,
|
625 |
+
and sets the width and height of the video.
|
626 |
+
|
627 |
+
** If you want to add some kind of border/padding (e.g. a frame), or special
|
628 |
+
positioning, use another containing element. Otherwise you risk messing up
|
629 |
+
control positioning and full window mode. **
|
630 |
+
*/
|
631 |
+
.video-js {
|
632 |
+
background-color: #000;
|
633 |
+
position: relative;
|
634 |
+
padding: 0;
|
635 |
+
/* Start with 10px for base font size so other dimensions can be em based and
|
636 |
+
easily calculable. */
|
637 |
+
|
638 |
+
font-size: 10px;
|
639 |
+
/* Allow poster to be vertially aligned. */
|
640 |
+
|
641 |
+
vertical-align: middle;
|
642 |
+
/* display: table-cell; */
|
643 |
+
/*This works in Safari but not Firefox.*/
|
644 |
+
|
645 |
+
/* Provide some basic defaults for fonts */
|
646 |
+
|
647 |
+
font-weight: normal;
|
648 |
+
font-style: normal;
|
649 |
+
/* Avoiding helvetica: issue #376 */
|
650 |
+
|
651 |
+
font-family: Arial, sans-serif;
|
652 |
+
/* Turn off user selection (text highlighting) by default.
|
653 |
+
The majority of player components will not be text blocks.
|
654 |
+
Text areas will need to turn user selection back on. */
|
655 |
+
|
656 |
+
/* user-select */
|
657 |
+
-webkit-user-select: none;
|
658 |
+
-moz-user-select: none;
|
659 |
+
-ms-user-select: none;
|
660 |
+
user-select: none;
|
661 |
+
}
|
662 |
+
/* Playback technology elements expand to the width/height of the containing div
|
663 |
+
<video> or <object> */
|
664 |
+
.video-js .vjs-tech {
|
665 |
position: absolute;
|
666 |
top: 0;
|
667 |
left: 0;
|
668 |
width: 100%;
|
669 |
height: 100%;
|
670 |
+
}
|
671 |
+
/* Fix for Firefox 9 fullscreen (only if it is enabled). Not needed when
|
672 |
+
checking fullScreenEnabled. */
|
673 |
+
.video-js:-moz-full-screen {
|
674 |
+
position: absolute;
|
675 |
+
}
|
676 |
+
/* Fullscreen Styles */
|
677 |
+
body.vjs-full-window {
|
678 |
+
padding: 0;
|
679 |
+
margin: 0;
|
680 |
+
height: 100%;
|
681 |
+
/* Fix for IE6 full-window. http://www.cssplay.co.uk/layouts/fixed.html */
|
682 |
+
overflow-y: auto;
|
683 |
+
}
|
684 |
+
.video-js.vjs-fullscreen {
|
685 |
+
position: fixed;
|
686 |
+
overflow: hidden;
|
687 |
+
z-index: 1000;
|
688 |
+
left: 0;
|
689 |
+
top: 0;
|
690 |
+
bottom: 0;
|
691 |
+
right: 0;
|
692 |
+
width: 100% !important;
|
693 |
+
height: 100% !important;
|
694 |
+
/* IE6 full-window (underscore hack) */
|
695 |
+
_position: absolute;
|
696 |
+
}
|
697 |
+
.video-js:-webkit-full-screen {
|
698 |
+
width: 100% !important;
|
699 |
+
height: 100% !important;
|
700 |
+
}
|
701 |
+
.video-js.vjs-fullscreen.vjs-user-inactive {
|
702 |
+
cursor: none;
|
703 |
+
}
|
704 |
+
/* Poster Styles */
|
705 |
+
.vjs-poster {
|
706 |
+
background-repeat: no-repeat;
|
707 |
+
background-position: 50% 50%;
|
708 |
+
background-size: contain;
|
709 |
+
cursor: pointer;
|
710 |
+
height: 100%;
|
711 |
+
margin: 0;
|
712 |
+
padding: 0;
|
713 |
+
position: relative;
|
714 |
+
width: 100%;
|
715 |
+
}
|
716 |
+
.vjs-poster img {
|
717 |
+
display: block;
|
718 |
+
margin: 0 auto;
|
719 |
+
max-height: 100%;
|
720 |
+
padding: 0;
|
721 |
+
width: 100%;
|
722 |
+
}
|
723 |
+
/* Hide the poster when native controls are used otherwise it covers them */
|
724 |
+
.video-js.vjs-using-native-controls .vjs-poster {
|
725 |
+
display: none;
|
726 |
+
}
|
727 |
+
/* Text Track Styles */
|
728 |
+
/* Overall track holder for both captions and subtitles */
|
729 |
+
.video-js .vjs-text-track-display {
|
730 |
text-align: center;
|
731 |
+
position: absolute;
|
732 |
+
bottom: 4em;
|
733 |
+
/* Leave padding on left and right */
|
734 |
+
left: 1em;
|
735 |
+
right: 1em;
|
736 |
}
|
737 |
+
/* Individual tracks */
|
738 |
+
.video-js .vjs-text-track {
|
739 |
+
display: none;
|
740 |
+
font-size: 1.4em;
|
741 |
+
text-align: center;
|
742 |
+
margin-bottom: 0.1em;
|
743 |
+
/* Transparent black background, or fallback to all black (oldIE) */
|
744 |
+
/* background-color-with-alpha */
|
745 |
+
background-color: #000000;
|
746 |
+
background-color: rgba(0, 0, 0, 0.5);
|
747 |
+
}
|
748 |
+
.video-js .vjs-subtitles {
|
749 |
+
color: #ffffff /* Subtitles are white */;
|
750 |
+
}
|
751 |
+
.video-js .vjs-captions {
|
752 |
+
color: #ffcc66 /* Captions are yellow */;
|
753 |
+
}
|
754 |
+
.vjs-tt-cue {
|
755 |
+
display: block;
|
756 |
+
}
|
757 |
+
/* Hide disabled or unsupported controls */
|
758 |
+
.kg-video-js-skin .vjs-hidden {
|
759 |
+
display: none;
|
760 |
+
}
|
761 |
+
.vjs-lock-showing {
|
762 |
+
display: block !important;
|
763 |
+
opacity: 1;
|
764 |
+
visibility: visible;
|
765 |
}
|
766 |
+
/* -----------------------------------------------------------------------------
|
767 |
+
The original source of this file lives at
|
768 |
+
https://github.com/videojs/video.js/blob/master/src/css/video-js.less */
|
video-js/video-js.css
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
/*!
|
2 |
Video.js Default Styles (http://videojs.com)
|
3 |
-
Version 4.1
|
4 |
-
*/.video-js{background-color:#000;position:relative;padding:0;font-size:10px;vertical-align:middle;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-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}.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-text-track-display{text-align:center;position:absolute;bottom:4em;left:1em;right:1em;font-family:Arial,sans-serif}.video-js .vjs-text-track{display:none;font-size:1.4em;text-align:center;margin-bottom:.1em;background:#000;background:rgba(0,0,0,.5)}.video-js .vjs-subtitles{color:#fff}.video-js .vjs-captions{color:#fc6}.vjs-tt-cue{display:block}.vjs-fade-in{display:block!important;visibility:visible;opacity:1;-webkit-transition:visibility .1s,opacity .1s;-moz-transition:visibility .1s,opacity .1s;-ms-transition:visibility .1s,opacity .1s;-o-transition:visibility .1s,opacity .1s;transition:visibility .1s,opacity .1s}.vjs-fade-out{display:block!important;visibility:hidden;opacity:0;-webkit-transition:visibility 1.5s,opacity 1.5s;-moz-transition:visibility 1.5s,opacity 1.5s;-ms-transition:visibility 1.5s,opacity 1.5s;-o-transition:visibility 1.5s,opacity 1.5s;transition:visibility 1.5s,opacity 1.5s;-webkit-transition-delay:2s;-moz-transition-delay:2s;-ms-transition-delay:2s;-o-transition-delay:2s;transition-delay:2s}.vjs-default-skin .vjs-hidden{display:none}.vjs-lock-showing{display:block!important;opacity:1;visibility:visible}@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{color:#ccc}.vjs-default-skin .vjs-slider{outline:0;position:relative;cursor:pointer;padding:0;background:#323232;background:rgba(100,100,100,.5)}.vjs-default-skin .vjs-slider:focus{background:#464646;background:rgba(100,100,100,.7);-webkit-box-shadow:0 0 2em rgba(255,255,255,1);-moz-box-shadow:0 0 2em rgba(255,255,255,1);box-shadow:0 0 2em rgba(255,255,255,1)}.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);filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2)}.vjs-default-skin .vjs-control-bar{display:none;position:absolute;bottom:0;left:0;right:0;padding:0;margin:0;height:3em;background-color:#000;background-color:rgba(7,40,50,.7);font-style:normal;font-weight:400;font-family:Arial,sans-serif}.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 rgba(255,255,255,1)}.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:top .4s,height .4s,font-size .4s,-webkit-transform .4s;-moz-transition:top .4s,height .4s,font-size .4s,-moz-transform .4s;-o-transition:top .4s,height .4s,font-size .4s,-o-transform .4s;transition:top .4s,height .4s,font-size .4s,transform .4s}.vjs-default-skin:hover .vjs-progress-control{font-size:.9em;-webkit-transition:top .2s,height .2s,font-size .2s,-webkit-transform .2s;-moz-transition:top .2s,height .2s,font-size .2s,-moz-transform .2s;-o-transition:top .2s,height .2s,font-size .2s,-o-transform .2s;transition:top .2s,height .2s,font-size .2s,transform .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{display:block;z-index:2;position:absolute;top:2em;left:2em;width:12em;height:8em;margin:0;text-align:center;vertical-align:middle;cursor:pointer;opacity:1;background-color:#282828;background-color:rgba(7,40,50,.7);border:.3em solid #323232;border-color:rgba(255,255,255,.25);-webkit-border-radius:25px;-moz-border-radius:25px;border-radius:25px;-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:border .4s,-webkit-box-shadow .4s,-webkit-transform .4s;-moz-transition:border .4s,-moz-box-shadow .4s,-moz-transform .4s;-o-transition:border .4s,-o-box-shadow .4s,-o-transform .4s;transition:border .4s,box-shadow .4s,transform .4s}.vjs-default-skin:hover .vjs-big-play-button,.vjs-default-skin .vjs-big-play-button:focus{outline:0;border-color:#fff;border-color:rgba(255,255,255,1);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:border 0s,-webkit-box-shadow 0s,-webkit-transform 0s;-moz-transition:border 0s,-moz-box-shadow 0s,-moz-transform 0s;-o-transition:border 0s,-o-box-shadow 0s,-o-transform 0s;transition:border 0s,box-shadow 0s,transform 0s}.vjs-default-skin .vjs-big-play-button:before{content:"\e001";font-family:VideoJS;font-size:3em;line-height:2.66;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:5em;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:"\e00a";font-family:VideoJS;position:absolute;width:1em;height:1em;text-align:center;text-shadow:0 0 .1em #000}.vjs-default-skin .vjs-loading-spinner:after{content:"\e00a";font-family:VideoJS;position:absolute;width:1em;height:1em;text-align:center;-webkit-background-clip:text;-webkit-text-fill-color:transparent}@-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)}}@-ms-keyframes spin{0%{-ms-transform:rotate(0deg)}100%{-ms-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:#000;background-color:rgba(7,40,50,.7);-webkit-box-shadow:-20px -20px 0 rgba(255,255,255,.5);-moz-box-shadow:0 0 1em rgba(255,255,255,.5);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;font-weight:400;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{background-color:#fff;background-color:rgba(255,255,255,.75);color:#111;outline:0;-webkit-box-shadow:0 0 1em rgba(255,255,255,1);-moz-box-shadow:0 0 1em rgba(255,255,255,1);box-shadow:0 0 1em rgba(255,255,255,1)}.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 rgba(255,255,255,1);-moz-box-shadow:0 0 1em rgba(255,255,255,1);box-shadow:0 0 1em rgba(255,255,255,1)}
|
|
1 |
/*!
|
2 |
Video.js Default Styles (http://videojs.com)
|
3 |
+
Version 4.2.1
|
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-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:5em;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:"\e00a";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.png
DELETED
Binary file
|
video-js/video-js.swf
CHANGED
Binary file
|
video-js/video.js
CHANGED
@@ -1,121 +1,127 @@
|
|
1 |
-
/*! Video.js v4.1
|
2 |
-
|
3 |
-
|
4 |
-
u.ka.
|
5 |
-
u.
|
6 |
-
u.
|
7 |
-
|
8 |
-
|
9 |
-
u.
|
10 |
-
u.
|
11 |
-
u.
|
12 |
-
u.
|
13 |
-
|
14 |
-
|
15 |
-
u.
|
16 |
-
u.
|
17 |
-
u.
|
18 |
-
|
19 |
-
function(){
|
20 |
-
u.
|
21 |
-
|
22 |
-
t.
|
23 |
-
t.
|
24 |
-
t.
|
25 |
-
t.
|
26 |
-
|
27 |
-
function
|
28 |
-
u.
|
29 |
-
t.e=function(a,c){c=u.
|
30 |
-
t.
|
31 |
-
|
32 |
-
t.
|
33 |
-
function
|
34 |
-
|
35 |
-
function
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
this.
|
41 |
-
function da(a){var c={sources:[],tracks:[]};u.
|
42 |
-
t.e=function(){var a=this.
|
43 |
-
f);c.parentNode&&c.parentNode.insertBefore(a,c);u.
|
44 |
-
function
|
45 |
-
(clearInterval(this.Qa),this.
|
46 |
-
t.
|
47 |
-
function
|
48 |
-
t.paused=function(){return
|
49 |
-
t.
|
50 |
-
t.
|
51 |
-
t.
|
52 |
-
t.src=function(a){if(a instanceof Array){var c;a:{c=a;for(var d=0,e=this.
|
53 |
-
|
54 |
-
t.
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
u.
|
59 |
-
t.Jb=function(){u.
|
60 |
-
u.
|
61 |
-
u.
|
62 |
-
u.
|
63 |
-
u
|
64 |
-
u.
|
65 |
-
u.
|
66 |
-
u.
|
67 |
-
t
|
68 |
-
t.
|
69 |
-
u.
|
70 |
-
u.
|
71 |
-
u.
|
72 |
-
t.
|
73 |
-
u.
|
74 |
-
u.
|
75 |
-
u.
|
76 |
-
u.
|
77 |
-
u.
|
78 |
-
u.
|
79 |
-
u.
|
80 |
-
u.
|
81 |
-
u.
|
82 |
-
function
|
83 |
-
u.
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
u.
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
u.
|
99 |
-
u.
|
100 |
-
|
101 |
-
function
|
102 |
-
|
103 |
-
function
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
u.
|
113 |
-
u.
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
115 |
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");}}
|
116 |
-
u.
|
117 |
-
u.c.prototype.show=u.c.prototype.show;u.c.prototype.hide=u.c.prototype.
|
118 |
-
|
119 |
-
$("videojs.
|
120 |
-
u.
|
121 |
-
|
|
1 |
+
/*! Video.js v4.2.1 Copyright 2013 Brightcove, Inc. https://github.com/videojs/video.js/blob/master/LICENSE */ (function() {var b=void 0,f=!0,j=null,l=!1;function m(){return function(){}}function p(a){return function(){return this[a]}}function q(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.wa[a])return u.wa[a];a=u.v(a)}if(!a||!a.nodeName)throw new TypeError("The element or ID supplied is not valid. (videojs)");return a.player||new u.w(a,c,d)}var v=u;
|
2 |
+
window.Qd=window.Rd=u;u.Rb="4.2";u.Bc="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>.'};
|
3 |
+
"GENERATED_CDN_VSN"!==u.Rb&&(v.options.flash.swf=u.Bc+"vjs.zencdn.net/"+u.Rb+"/video-js.swf");u.wa={};u.ka=u.CoreObject=m();u.ka.extend=function(a){var c,d;a=a||{};c=a.init||a.i||this.prototype.init||this.prototype.i||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};
|
4 |
+
u.ka.create=function(){var a=u.k.create(this.prototype);this.apply(a,arguments);return a};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.W||(e.disabled=l,e.W=function(c){if(!e.disabled){c=u.gc(c);var d=e.z[c.type];if(d)for(var d=d.slice(0),k=0,r=d.length;k<r&&!c.lc();k++)d[k].call(a,c)}});1==e.z[c].length&&(document.addEventListener?a.addEventListener(c,e.W,l):document.attachEvent&&a.attachEvent("on"+c,e.W))};
|
5 |
+
u.n=function(a,c,d){if(u.kc(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.dc(a,c)}}else for(g in e.z)c=g,e.z[c]=[],u.dc(a,c)}};u.dc=function(a,c){var d=u.getData(a);0===d.z[c].length&&(delete d.z[c],document.removeEventListener?a.removeEventListener(c,d.W,l):document.detachEvent&&a.detachEvent("on"+c,d.W));u.Ab(d.z)&&(delete d.z,delete d.W,delete d.disabled);u.Ab(d)&&u.qc(a)};
|
6 |
+
u.gc=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&&(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();a.cancelBubble=f;a.Bb=c};a.Bb=d;a.stopImmediatePropagation=function(){e.stopImmediatePropagation&&
|
7 |
+
e.stopImmediatePropagation();a.lc=c;a.stopPropagation()};a.lc=d;if(a.clientX!=j){g=document.documentElement;var h=document.body;a.pageX=a.clientX+(g&&g.scrollLeft||h&&h.scrollLeft||0)-(g&&g.clientLeft||h&&h.clientLeft||0);a.pageY=a.clientY+(g&&g.scrollTop||h&&h.scrollTop||0)-(g&&g.clientTop||h&&h.clientTop||0)}a.which=a.charCode||a.keyCode;a.button!=j&&(a.button=a.button&1?0:a.button&4?1:a.button&2?2:0)}return a};
|
8 |
+
u.j=function(a,c){var d=u.kc(a)?u.getData(a):{},e=a.parentNode||a.ownerDocument;"string"===typeof c&&(c={type:c,target:a});c=u.gc(c);d.W&&d.W.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.U=function(a,c,d){function e(){u.n(a,c,e);d.apply(this,arguments)}e.s=d.s=d.s||u.s++;u.d(a,c,e)};var w=Object.prototype.hasOwnProperty;
|
9 |
+
u.e=function(a,c){var d,e;d=document.createElement(a||"div");for(e in c)w.call(c,e)&&(-1!==e.indexOf("aria-")||"role"==e?d.setAttribute(e,c[e]):d[e]=c[e]);return d};u.$=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.ta=function(a,c,d){for(var e in a)w.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)w.call(c,d)&&(a[d]=c[d]);return a};
|
10 |
+
u.k.fc=function(a,c){var d,e,g;a=u.k.copy(a);for(d in c)w.call(c,d)&&(e=a[d],g=c[d],a[d]=u.k.mc(e)&&u.k.mc(g)?u.k.fc(e,g):c[d]);return a};u.k.copy=function(a){return u.k.B({},a)};u.k.mc=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.qa={};u.s=1;u.expando="vdata"+(new Date).getTime();
|
11 |
+
u.getData=function(a){var c=a[u.expando];c||(c=a[u.expando]=u.s++,u.qa[c]={});return u.qa[c]};u.kc=function(a){a=a[u.expando];return!(!a||u.Ab(u.qa[a]))};u.qc=function(a){var c=a[u.expando];if(c){delete u.qa[c];try{delete a[u.expando]}catch(d){a.removeAttribute?a.removeAttribute(u.expando):a[u.expando]=j}}};u.Ab=function(a){for(var c in a)if(a[c]!==j)return l;return f};u.m=function(a,c){-1==(" "+a.className+" ").indexOf(" "+c+" ")&&(a.className=""===a.className?c:a.className+" "+c)};
|
12 |
+
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.ma=u.e("video");u.G=navigator.userAgent;u.Hc=/iPhone/i.test(u.G);u.Gc=/iPad/i.test(u.G);u.Ic=/iPod/i.test(u.G);u.Fc=u.Hc||u.Gc||u.Ic;var aa=u,x;var y=u.G.match(/OS (\d+)_/i);x=y&&y[1]?y[1]:b;aa.Cd=x;u.Dc=/Android/i.test(u.G);var ba=u,z;var A=u.G.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),B,C;
|
13 |
+
A?(B=A[1]&&parseFloat(A[1]),C=A[2]&&parseFloat(A[2]),z=B&&C?parseFloat(A[1]+"."+A[2]):B?B:j):z=j;ba.Cc=z;u.Jc=u.Dc&&/webkit/i.test(u.G)&&2.3>u.Cc;u.Ec=/Firefox/i.test(u.G);u.Dd=/Chrome/i.test(u.G);u.Mc="ontouchstart"in window;u.wb=function(a){var c,d,e,g;c={};if(a&&a.attributes&&0<a.attributes.length){d=a.attributes;for(var h=d.length-1;0<=h;h--){e=d[h].name;g=d[h].value;if("boolean"===typeof a[e]||-1!==",autoplay,controls,loop,muted,default,".indexOf(","+e+","))g=g!==j?f:l;c[e]=g}}return c};
|
14 |
+
u.Hd=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.Nb={};u.v=function(a){0===a.indexOf("#")&&(a=a.slice(1));return document.getElementById(a)};
|
15 |
+
u.Ka=function(a,c){c=c||a;var d=Math.floor(a%60),e=Math.floor(a/60%60),g=Math.floor(a/3600),h=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<=h)&&10>e?"0"+e:e)+":")+(10>d?"0"+d:d)};u.Pc=function(){document.body.focus();document.onselectstart=q(l)};u.yd=function(){document.onselectstart=q(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)};
|
16 |
+
u.sb=function(a,c){return{length:1,start:function(){return a},end:function(){return c}}};
|
17 |
+
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(h){d(h)}e=0===a.indexOf("file:")||0===window.location.href.indexOf("file:")&&-1===a.indexOf("http");
|
18 |
+
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.qd=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.ic=function(a){a.match(/^https?:\/\//)||(a=u.e("div",{innerHTML:'<a href="'+a+'">x</a>'}).firstChild.href);return a};
|
19 |
+
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.Xc=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)}};
|
20 |
+
u.c=u.ka.extend({i:function(a,c,d){this.b=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.cd=c.name||j;this.a=c.el||this.e();this.H=[];this.pb={};this.V={};if((a=this.g)&&a.children){var e=this;u.k.ta(a.children,function(a,c){c!==l&&!c.loadEvent&&(e[a]=e.Z(a,c))})}this.M(d)}});t=u.c.prototype;
|
21 |
+
t.D=function(){this.j("dispose");if(this.H)for(var a=this.H.length-1;0<=a;a--)this.H[a].D&&this.H[a].D();this.V=this.pb=this.H=j;this.n();this.a.parentNode&&this.a.parentNode.removeChild(this.a);u.qc(this.a);this.a=j};t.L=p("b");t.options=function(a){return a===b?this.g:this.g=u.k.fc(this.g,a)};t.e=function(a,c){return u.e(a,c)};t.v=p("a");t.id=p("Q");t.name=p("cd");t.children=p("H");
|
22 |
+
t.Z=function(a,c){var d,e;"string"===typeof a?(e=a,c=c||{},d=c.componentClass||u.$(e),c.name=e,d=new window.videojs[d](this.b||this,c)):d=a;this.H.push(d);"function"===typeof d.id&&(this.pb[d.id()]=d);(e=e||d.name&&d.name())&&(this.V[e]=d);"function"===typeof d.el&&d.el()&&(this.ra||this.a).appendChild(d.el());return d};
|
23 |
+
t.removeChild=function(a){"string"===typeof a&&(a=this.V[a]);if(a&&this.H){for(var c=l,d=this.H.length-1;0<=d;d--)if(this.H[d]===a){c=f;this.H.splice(d,1);break}c&&(this.pb[a.id]=j,this.V[a.name]=j,(c=a.v())&&c.parentNode===(this.ra||this.a)&&(this.ra||this.a).removeChild(a.v()))}};t.T=q("");t.d=function(a,c){u.d(this.a,a,u.bind(this,c));return this};t.n=function(a,c){u.n(this.a,a,c);return this};t.U=function(a,c){u.U(this.a,a,u.bind(this,c));return this};t.j=function(a,c){u.j(this.a,a,c);return this};
|
24 |
+
t.M=function(a){a&&(this.aa?a.call(this):(this.Ra===b&&(this.Ra=[]),this.Ra.push(a)));return this};t.Ta=function(){this.aa=f;var a=this.Ra;if(a&&0<a.length){for(var c=0,d=a.length;c<d;c++)a[c].call(this);this.Ra=[];this.j("ready")}};t.m=function(a){u.m(this.a,a);return this};t.t=function(a){u.t(this.a,a);return this};t.show=function(){this.a.style.display="block";return this};t.C=function(){this.a.style.display="none";return this};function D(a){a.t("vjs-lock-showing")}
|
25 |
+
t.disable=function(){this.C();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.Tc=function(a,c){return this.width(a,f).height(c)};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.$(c)],10)}
|
26 |
+
u.q=u.c.extend({i:function(a,c){u.c.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.Na);this.d("blur",this.Ma)}});t=u.q.prototype;
|
27 |
+
t.e=function(a,c){c=u.k.B({className:this.T(),innerHTML:'<div class="vjs-control-content"><span class="vjs-control-text">'+(this.pa||"Need Text")+"</span></div>",nd:"button","aria-live":"polite",tabIndex:0},c);return u.c.prototype.e.call(this,a,c)};t.T=function(){return"vjs-control "+u.c.prototype.T.call(this)};t.p=m();t.Na=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()};
|
28 |
+
t.Ma=function(){u.n(document,"keyup",u.bind(this,this.ba))};u.O=u.c.extend({i:function(a,c){u.c.call(this,a,c);this.Oc=this.V[this.g.barName];this.handle=this.V[this.g.handleName];a.d(this.oc,u.bind(this,this.update));this.d("mousedown",this.Oa);this.d("touchstart",this.Oa);this.d("focus",this.Na);this.d("blur",this.Ma);this.d("click",this.p);this.b.d("controlsvisible",u.bind(this,this.update));a.M(u.bind(this,this.update));this.P={}}});t=u.O.prototype;
|
29 |
+
t.e=function(a,c){c=c||{};c.className+=" vjs-slider";c=u.k.B({nd:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},c);return u.c.prototype.e.call(this,a,c)};t.Oa=function(a){a.preventDefault();u.Pc();this.P.move=u.bind(this,this.Gb);this.P.end=u.bind(this,this.Hb);u.d(document,"mousemove",this.P.move);u.d(document,"mouseup",this.P.end);u.d(document,"touchmove",this.P.move);u.d(document,"touchend",this.P.end);this.Gb(a)};
|
30 |
+
t.Hb=function(){u.yd();u.n(document,"mousemove",this.P.move,l);u.n(document,"mouseup",this.P.end,l);u.n(document,"touchmove",this.P.move,l);u.n(document,"touchend",this.P.end,l);this.update()};t.update=function(){if(this.a){var a,c=this.xb(),d=this.handle,e=this.Oc;isNaN(c)&&(c=0);a=c;if(d){a=this.a.offsetWidth;var g=d.v().offsetWidth;a=g?g/a:0;c*=1-a;a=c+a/2;d.v().style.left=u.round(100*c,2)+"%"}e.v().style.width=u.round(100*a,2)+"%"}};
|
31 |
+
function F(a,c){var d,e,g,h;d=a.a;e=u.Xc(d);h=g=d.offsetWidth;d=a.handle;if(a.g.zd)return h=e.top,e=c.changedTouches?c.changedTouches[0].pageY:c.pageY,d&&(d=d.v().offsetHeight,h+=d/2,g-=d),Math.max(0,Math.min(1,(h-e+g)/g));g=e.left;e=c.changedTouches?c.changedTouches[0].pageX:c.pageX;d&&(d=d.v().offsetWidth,g+=d/2,h-=d);return Math.max(0,Math.min(1,(e-g)/h))}t.Na=function(){u.d(document,"keyup",u.bind(this,this.ba))};
|
32 |
+
t.ba=function(a){37==a.which?(a.preventDefault(),this.uc()):39==a.which&&(a.preventDefault(),this.vc())};t.Ma=function(){u.n(document,"keyup",u.bind(this,this.ba))};t.p=function(a){a.stopImmediatePropagation();a.preventDefault()};u.ea=u.c.extend();u.ea.prototype.defaultValue=0;u.ea.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.c.prototype.e.call(this,"div",c)};u.la=u.c.extend();
|
33 |
+
function ca(a,c){a.Z(c);c.d("click",u.bind(a,function(){D(this)}))}u.la.prototype.e=function(){var a=this.options().Rc||"ul";this.ra=u.e(a,{className:"vjs-menu-content"});a=u.c.prototype.e.call(this,"div",{append:this.ra,className:"vjs-menu"});a.appendChild(this.ra);u.d(a,"click",function(a){a.preventDefault();a.stopImmediatePropagation()});return a};u.N=u.q.extend({i:function(a,c){u.q.call(this,a,c);this.selected(c.selected)}});
|
34 |
+
u.N.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.N.prototype.p=function(){this.selected(f)};u.N.prototype.selected=function(a){a?(this.m("vjs-selected"),this.a.setAttribute("aria-selected",f)):(this.t("vjs-selected"),this.a.setAttribute("aria-selected",l))};
|
35 |
+
u.R=u.q.extend({i:function(a,c){u.q.call(this,a,c);this.va=this.Ja();this.Z(this.va);this.J&&0===this.J.length&&this.C();this.d("keyup",this.ba);this.a.setAttribute("aria-haspopup",f);this.a.setAttribute("role","button")}});t=u.R.prototype;t.oa=l;t.Ja=function(){var a=new u.la(this.b);this.options().title&&a.v().appendChild(u.e("li",{className:"vjs-menu-title",innerHTML:u.$(this.A),wd:-1}));if(this.J=this.createItems())for(var c=0;c<this.J.length;c++)ca(a,this.J[c]);return a};t.sa=m();
|
36 |
+
t.T=function(){return this.className+" vjs-menu-button "+u.q.prototype.T.call(this)};t.Na=m();t.Ma=m();t.p=function(){this.U("mouseout",u.bind(this,function(){D(this.va);this.a.blur()}));this.oa?G(this):H(this)};t.ba=function(a){a.preventDefault();32==a.which||13==a.which?this.oa?G(this):H(this):27==a.which&&this.oa&&G(this)};function H(a){a.oa=f;a.va.m("vjs-lock-showing");a.a.setAttribute("aria-pressed",f);a.J&&0<a.J.length&&a.J[0].v().focus()}
|
37 |
+
function G(a){a.oa=l;D(a.va);a.a.setAttribute("aria-pressed",l)}
|
38 |
+
u.w=u.c.extend({i:function(a,c,d){this.F=a;c=u.k.B(da(a),c);this.u={};this.pc=c.poster;this.rb=c.controls;a.controls=l;u.c.call(this,this,c,d);this.controls()?this.m("vjs-controls-enabled"):this.m("vjs-controls-disabled");this.U("play",function(a){u.j(this.a,{type:"firstplay",target:this.a})||(a.preventDefault(),a.stopPropagation(),a.stopImmediatePropagation())});this.d("ended",this.ed);this.d("play",this.Jb);this.d("firstplay",this.fd);this.d("pause",this.Ib);this.d("progress",this.hd);this.d("durationchange",
|
39 |
+
this.dd);this.d("error",this.Fb);this.d("fullscreenchange",this.gd);u.wa[this.Q]=this;c.plugins&&u.k.ta(c.plugins,function(a,c){this[a](c)},this);var e,g,h,k;e=this.rc;a=function(){e();clearInterval(g);g=setInterval(u.bind(this,e),250)};c=function(){e();clearInterval(g)};this.d("mousedown",a);this.d("mousemove",e);this.d("mouseup",c);this.d("keydown",e);this.d("keyup",e);this.d("touchstart",a);this.d("touchmove",e);this.d("touchend",c);this.d("touchcancel",c);h=setInterval(u.bind(this,function(){this.ja&&
|
40 |
+
(this.ja=l,I(this,f),clearTimeout(k),k=setTimeout(u.bind(this,function(){this.ja||I(this,l)}),2E3))}),250);this.d("dispose",function(){clearInterval(h);clearTimeout(k)})}});t=u.w.prototype;t.g=u.options;t.D=function(){this.j("dispose");this.n("dispose");u.wa[this.Q]=j;this.F&&this.F.player&&(this.F.player=j);this.a&&this.a.player&&(this.a.player=j);clearInterval(this.Qa);this.ya();this.h&&this.h.D();u.c.prototype.D.call(this)};
|
41 |
+
function da(a){var c={sources:[],tracks:[]};u.k.B(c,u.wb(a));if(a.hasChildNodes()){var d,e,g,h;a=a.childNodes;g=0;for(h=a.length;g<h;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}
|
42 |
+
t.e=function(){var a=this.a=u.c.prototype.e.call(this,"div"),c=this.F;c.removeAttribute("width");c.removeAttribute("height");if(c.hasChildNodes()){var d,e,g,h,k;d=c.childNodes;e=d.length;for(k=[];e--;)g=d[e],h=g.nodeName.toLowerCase(),("source"===h||"track"===h)&&k.push(g);for(d=0;d<k.length;d++)c.removeChild(k[d])}c.id=c.id||"vjs_video_"+u.s++;a.id=c.id;a.className=c.className;c.id+="_html5_api";c.className="vjs-tech";c.player=a.player=this;this.m("vjs-paused");this.width(this.g.width,f);this.height(this.g.height,
|
43 |
+
f);c.parentNode&&c.parentNode.insertBefore(a,c);u.yb(c,a);return a};
|
44 |
+
function J(a,c,d){a.h?(a.aa=l,a.h.D(),a.Db&&(a.Db=l,clearInterval(a.Qa)),a.Eb&&K(a),a.h=l):"Html5"!==c&&a.F&&(a.a.removeChild(a.F),a.F.player=j,a.F=j);a.ia=c;a.aa=l;var e=u.k.B({source:d,parentEl:a.a},a.g[c.toLowerCase()]);d&&(d.src==a.u.src&&0<a.u.currentTime&&(e.startTime=a.u.currentTime),a.u.src=d.src);a.h=new window.videojs[c](a,e);a.h.M(function(){this.b.Ta();if(!this.l.progressEvents){var a=this.b;a.Db=f;a.Qa=setInterval(u.bind(a,function(){this.u.kb<this.buffered().end(0)?this.j("progress"):
|
45 |
+
1==this.Ia()&&(clearInterval(this.Qa),this.j("progress"))}),500);a.h.U("progress",function(){this.l.progressEvents=f;var a=this.b;a.Db=l;clearInterval(a.Qa)})}this.l.timeupdateEvents||(a=this.b,a.Eb=f,a.d("play",a.yc),a.d("pause",a.ya),a.h.U("timeupdate",function(){this.l.timeupdateEvents=f;K(this.b)}))})}function K(a){a.Eb=l;a.ya();a.n("play",a.yc);a.n("pause",a.ya)}t.yc=function(){this.ec&&this.ya();this.ec=setInterval(u.bind(this,function(){this.j("timeupdate")}),250)};t.ya=function(){clearInterval(this.ec)};
|
46 |
+
t.ed=function(){this.g.loop&&(this.currentTime(0),this.play())};t.Jb=function(){u.t(this.a,"vjs-paused");u.m(this.a,"vjs-playing")};t.fd=function(){this.g.starttime&&this.currentTime(this.g.starttime);this.m("vjs-has-started")};t.Ib=function(){u.t(this.a,"vjs-playing");u.m(this.a,"vjs-paused")};t.hd=function(){1==this.Ia()&&this.j("loadedalldata")};t.dd=function(){this.duration(L(this,"duration"))};t.Fb=function(a){u.log("Video Error",a)};t.gd=function(){this.I?this.m("vjs-fullscreen"):this.t("vjs-fullscreen")};
|
47 |
+
function M(a,c,d){if(a.h&&!a.h.aa)a.h.M(function(){this[c](d)});else try{a.h[c](d)}catch(e){throw u.log(e),e;}}function L(a,c){if(a.h&&a.h.aa)try{return a.h[c]()}catch(d){throw a.h[c]===b?u.log("Video.js: "+c+" method not defined for "+a.ia+" playback technology.",d):"TypeError"==d.name?(u.log("Video.js: "+c+" unavailable on "+a.ia+" playback technology element.",d),a.h.aa=l):u.log(d),d;}}t.play=function(){M(this,"play");return this};t.pause=function(){M(this,"pause");return this};
|
48 |
+
t.paused=function(){return L(this,"paused")===l?l:f};t.currentTime=function(a){return a!==b?(this.u.nc=a,M(this,"setCurrentTime",a),this.Eb&&this.j("timeupdate"),this):this.u.currentTime=L(this,"currentTime")||0};t.duration=function(a){return a!==b?(this.u.duration=parseFloat(a),this):this.u.duration};t.buffered=function(){var a=L(this,"buffered"),c=a.length-1,d=this.u.kb=this.u.kb||0;a&&(0<=c&&a.end(c)!==d)&&(d=a.end(c),this.u.kb=d);return u.sb(0,d)};
|
49 |
+
t.Ia=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.u.volume=a,M(this,"setVolume",a),u.qd(a),this;a=parseFloat(L(this,"volume"));return isNaN(a)?1:a};t.muted=function(a){return a!==b?(M(this,"setMuted",a),this):L(this,"muted")||l};t.Sa=function(){return L(this,"supportsFullScreen")||l};
|
50 |
+
t.xa=function(){var a=u.Nb.xa;this.I=f;a?(u.d(document,a.ub,u.bind(this,function(c){this.I=document[a.I];this.I===l&&u.n(document,a.ub,arguments.callee);this.j("fullscreenchange")})),this.a[a.sc]()):this.h.Sa()?M(this,"enterFullScreen"):(this.Zc=f,this.Uc=document.documentElement.style.overflow,u.d(document,"keydown",u.bind(this,this.hc)),document.documentElement.style.overflow="hidden",u.m(document.body,"vjs-full-window"),this.j("enterFullWindow"),this.j("fullscreenchange"));return this};
|
51 |
+
t.nb=function(){var a=u.Nb.xa;this.I=l;if(a)document[a.mb]();else this.h.Sa()?M(this,"exitFullScreen"):(N(this),this.j("fullscreenchange"));return this};t.hc=function(a){27===a.keyCode&&(this.I===f?this.nb():N(this))};function N(a){a.Zc=l;u.n(document,"keydown",a.hc);document.documentElement.style.overflow=a.Uc;u.t(document.body,"vjs-full-window");a.j("exitFullWindow")}
|
52 |
+
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.$(e[d]),h=window.videojs[g];if(h.isSupported())for(var k=0,r=c;k<r.length;k++){var n=r[k];if(h.canPlaySource(n)){c={source:n,h:g};break a}}}c=l}c?(a=c.source,c=c.h,c==this.ia?this.src(a):J(this,c,a)):this.a.appendChild(u.e("p",{innerHTML:this.options().notSupportedMessage}))}else a instanceof Object?window.videojs[this.ia].canPlaySource(a)?this.src(a.src):this.src([a]):(this.u.src=a,this.aa?
|
53 |
+
(M(this,"src",a),"auto"==this.g.preload&&this.load(),this.g.autoplay&&this.play()):this.M(function(){this.src(a)}));return this};t.load=function(){M(this,"load");return this};t.currentSrc=function(){return L(this,"currentSrc")||this.u.src||""};t.Pa=function(a){return a!==b?(M(this,"setPreload",a),this.g.preload=a,this):L(this,"preload")};t.autoplay=function(a){return a!==b?(M(this,"setAutoplay",a),this.g.autoplay=a,this):L(this,"autoplay")};
|
54 |
+
t.loop=function(a){return a!==b?(M(this,"setLoop",a),this.g.loop=a,this):L(this,"loop")};t.poster=function(a){a!==b&&(this.pc=a);return this.pc};t.controls=function(a){return a!==b?(a=!!a,this.rb!==a&&((this.rb=a)?(this.t("vjs-controls-disabled"),this.m("vjs-controls-enabled"),this.j("controlsenabled")):(this.t("vjs-controls-enabled"),this.m("vjs-controls-disabled"),this.j("controlsdisabled"))),this):this.rb};u.w.prototype.Qb;t=u.w.prototype;
|
55 |
+
t.Pb=function(a){return a!==b?(a=!!a,this.Qb!==a&&((this.Qb=a)?(this.m("vjs-using-native-controls"),this.j("usingnativecontrols")):(this.t("vjs-using-native-controls"),this.j("usingcustomcontrols"))),this):this.Qb};t.error=function(){return L(this,"error")};t.seeking=function(){return L(this,"seeking")};t.ja=f;t.rc=function(){this.ja=f};t.Ob=f;
|
56 |
+
function I(a,c){return c!==b?(c=!!c,c!==a.Ob&&((a.Ob=c)?(a.ja=f,a.t("vjs-user-inactive"),a.m("vjs-user-active"),a.j("useractive")):(a.ja=l,a.h.U("mousemove",function(a){a.stopPropagation();a.preventDefault()}),a.t("vjs-user-active"),a.m("vjs-user-inactive"),a.j("userinactive"))),a):a.Ob}var O,P,Q;Q=document.createElement("div");P={};
|
57 |
+
Q.Ed!==b?(P.sc="requestFullscreen",P.mb="exitFullscreen",P.ub="fullscreenchange",P.I="fullScreen"):(document.mozCancelFullScreen?(O="moz",P.I=O+"FullScreen"):(O="webkit",P.I=O+"IsFullScreen"),Q[O+"RequestFullScreen"]&&(P.sc=O+"RequestFullScreen",P.mb=O+"CancelFullScreen"),P.ub=O+"fullscreenchange");document[P.mb]&&(u.Nb.xa=P);u.Ea=u.c.extend();
|
58 |
+
u.Ea.prototype.g={Jd:"play",children:{playToggle:{},currentTimeDisplay:{},timeDivider:{},durationDisplay:{},remainingTimeDisplay:{},progressControl:{},fullscreenToggle:{},volumeControl:{},muteToggle:{}}};u.Ea.prototype.e=function(){return u.e("div",{className:"vjs-control-bar"})};u.Wb=u.q.extend({i:function(a,c){u.q.call(this,a,c);a.d("play",u.bind(this,this.Jb));a.d("pause",u.bind(this,this.Ib))}});t=u.Wb.prototype;t.pa="Play";t.T=function(){return"vjs-play-control "+u.q.prototype.T.call(this)};
|
59 |
+
t.p=function(){this.b.paused()?this.b.play():this.b.pause()};t.Jb=function(){u.t(this.a,"vjs-paused");u.m(this.a,"vjs-playing");this.a.children[0].children[0].innerHTML="Pause"};t.Ib=function(){u.t(this.a,"vjs-playing");u.m(this.a,"vjs-paused");this.a.children[0].children[0].innerHTML="Play"};u.Xa=u.c.extend({i:function(a,c){u.c.call(this,a,c);a.d("timeupdate",u.bind(this,this.Ba))}});
|
60 |
+
u.Xa.prototype.e=function(){var a=u.c.prototype.e.call(this,"div",{className:"vjs-current-time vjs-time-controls vjs-control"});this.content=u.e("div",{className:"vjs-current-time-display",innerHTML:'<span class="vjs-control-text">Current Time </span>0:00',"aria-live":"off"});a.appendChild(u.e("div").appendChild(this.content));return a};
|
61 |
+
u.Xa.prototype.Ba=function(){var a=this.b.Lb?this.b.u.currentTime:this.b.currentTime();this.content.innerHTML='<span class="vjs-control-text">Current Time </span>'+u.Ka(a,this.b.duration())};u.Ya=u.c.extend({i:function(a,c){u.c.call(this,a,c);a.d("timeupdate",u.bind(this,this.Ba))}});
|
62 |
+
u.Ya.prototype.e=function(){var a=u.c.prototype.e.call(this,"div",{className:"vjs-duration vjs-time-controls vjs-control"});this.content=u.e("div",{className:"vjs-duration-display",innerHTML:'<span class="vjs-control-text">Duration Time </span>0:00',"aria-live":"off"});a.appendChild(u.e("div").appendChild(this.content));return a};u.Ya.prototype.Ba=function(){var a=this.b.duration();a&&(this.content.innerHTML='<span class="vjs-control-text">Duration Time </span>'+u.Ka(a))};
|
63 |
+
u.$b=u.c.extend({i:function(a,c){u.c.call(this,a,c)}});u.$b.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-time-divider",innerHTML:"<div><span>/</span></div>"})};u.eb=u.c.extend({i:function(a,c){u.c.call(this,a,c);a.d("timeupdate",u.bind(this,this.Ba))}});
|
64 |
+
u.eb.prototype.e=function(){var a=u.c.prototype.e.call(this,"div",{className:"vjs-remaining-time vjs-time-controls vjs-control"});this.content=u.e("div",{className:"vjs-remaining-time-display",innerHTML:'<span class="vjs-control-text">Remaining Time </span>-0:00',"aria-live":"off"});a.appendChild(u.e("div").appendChild(this.content));return a};u.eb.prototype.Ba=function(){this.b.duration()&&(this.content.innerHTML='<span class="vjs-control-text">Remaining Time </span>-'+u.Ka(this.b.duration()-this.b.currentTime()))};
|
65 |
+
u.Fa=u.q.extend({i:function(a,c){u.q.call(this,a,c)}});u.Fa.prototype.pa="Fullscreen";u.Fa.prototype.T=function(){return"vjs-fullscreen-control "+u.q.prototype.T.call(this)};u.Fa.prototype.p=function(){this.b.I?(this.b.nb(),this.a.children[0].children[0].innerHTML="Fullscreen"):(this.b.xa(),this.a.children[0].children[0].innerHTML="Non-Fullscreen")};u.cb=u.c.extend({i:function(a,c){u.c.call(this,a,c)}});u.cb.prototype.g={children:{seekBar:{}}};
|
66 |
+
u.cb.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-progress-control vjs-control"})};u.Xb=u.O.extend({i:function(a,c){u.O.call(this,a,c);a.d("timeupdate",u.bind(this,this.Aa));a.M(u.bind(this,this.Aa))}});t=u.Xb.prototype;t.g={children:{loadProgressBar:{},playProgressBar:{},seekHandle:{}},barName:"playProgressBar",handleName:"seekHandle"};t.oc="timeupdate";t.e=function(){return u.O.prototype.e.call(this,"div",{className:"vjs-progress-holder","aria-label":"video progress bar"})};
|
67 |
+
t.Aa=function(){var a=this.b.Lb?this.b.u.currentTime:this.b.currentTime();this.a.setAttribute("aria-valuenow",u.round(100*this.xb(),2));this.a.setAttribute("aria-valuetext",u.Ka(a,this.b.duration()))};t.xb=function(){var a;"Flash"===this.b.ia&&this.b.seeking()?(a=this.b.u,a=a.nc?a.nc:this.b.currentTime()):a=this.b.currentTime();return a/this.b.duration()};t.Oa=function(a){u.O.prototype.Oa.call(this,a);this.b.Lb=f;this.Ad=!this.b.paused();this.b.pause()};
|
68 |
+
t.Gb=function(a){a=F(this,a)*this.b.duration();a==this.b.duration()&&(a-=0.1);this.b.currentTime(a)};t.Hb=function(a){u.O.prototype.Hb.call(this,a);this.b.Lb=l;this.Ad&&this.b.play()};t.vc=function(){this.b.currentTime(this.b.currentTime()+5)};t.uc=function(){this.b.currentTime(this.b.currentTime()-5)};u.$a=u.c.extend({i:function(a,c){u.c.call(this,a,c);a.d("progress",u.bind(this,this.update))}});u.$a.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-load-progress",innerHTML:'<span class="vjs-control-text">Loaded: 0%</span>'})};
|
69 |
+
u.$a.prototype.update=function(){this.a.style&&(this.a.style.width=u.round(100*this.b.Ia(),2)+"%")};u.Vb=u.c.extend({i:function(a,c){u.c.call(this,a,c)}});u.Vb.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-play-progress",innerHTML:'<span class="vjs-control-text">Progress: 0%</span>'})};u.fb=u.ea.extend();u.fb.prototype.defaultValue="00:00";u.fb.prototype.e=function(){return u.ea.prototype.e.call(this,"div",{className:"vjs-seek-handle"})};
|
70 |
+
u.hb=u.c.extend({i:function(a,c){u.c.call(this,a,c);a.h&&(a.h.l&&a.h.l.volumeControl===l)&&this.m("vjs-hidden");a.d("loadstart",u.bind(this,function(){a.h.l&&a.h.l.volumeControl===l?this.m("vjs-hidden"):this.t("vjs-hidden")}))}});u.hb.prototype.g={children:{volumeBar:{}}};u.hb.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-volume-control vjs-control"})};
|
71 |
+
u.gb=u.O.extend({i:function(a,c){u.O.call(this,a,c);a.d("volumechange",u.bind(this,this.Aa));a.M(u.bind(this,this.Aa));setTimeout(u.bind(this,this.update),0)}});t=u.gb.prototype;t.Aa=function(){this.a.setAttribute("aria-valuenow",u.round(100*this.b.volume(),2));this.a.setAttribute("aria-valuetext",u.round(100*this.b.volume(),2)+"%")};t.g={children:{volumeLevel:{},volumeHandle:{}},barName:"volumeLevel",handleName:"volumeHandle"};t.oc="volumechange";
|
72 |
+
t.e=function(){return u.O.prototype.e.call(this,"div",{className:"vjs-volume-bar","aria-label":"volume level"})};t.Gb=function(a){this.b.volume(F(this,a))};t.xb=function(){return this.b.muted()?0:this.b.volume()};t.vc=function(){this.b.volume(this.b.volume()+0.1)};t.uc=function(){this.b.volume(this.b.volume()-0.1)};u.ac=u.c.extend({i:function(a,c){u.c.call(this,a,c)}});u.ac.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"></span>'})};
|
73 |
+
u.ib=u.ea.extend();u.ib.prototype.defaultValue="00:00";u.ib.prototype.e=function(){return u.ea.prototype.e.call(this,"div",{className:"vjs-volume-handle"})};u.da=u.q.extend({i:function(a,c){u.q.call(this,a,c);a.d("volumechange",u.bind(this,this.update));a.h&&(a.h.l&&a.h.l.volumeControl===l)&&this.m("vjs-hidden");a.d("loadstart",u.bind(this,function(){a.h.l&&a.h.l.volumeControl===l?this.m("vjs-hidden"):this.t("vjs-hidden")}))}});
|
74 |
+
u.da.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>'})};u.da.prototype.p=function(){this.b.muted(this.b.muted()?l:f)};
|
75 |
+
u.da.prototype.update=function(){var a=this.b.volume(),c=3;0===a||this.b.muted()?c=0:0.33>a?c=1:0.67>a&&(c=2);this.b.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.m(this.a,"vjs-vol-"+c)};
|
76 |
+
u.na=u.R.extend({i:function(a,c){u.R.call(this,a,c);a.d("volumechange",u.bind(this,this.update));a.h&&(a.h.l&&a.h.l.zc===l)&&this.m("vjs-hidden");a.d("loadstart",u.bind(this,function(){a.h.l&&a.h.l.zc===l?this.m("vjs-hidden"):this.t("vjs-hidden")}));this.m("vjs-menu-button")}});u.na.prototype.Ja=function(){var a=new u.la(this.b,{Rc:"div"}),c=new u.gb(this.b,u.k.B({zd:f},this.g.Sd));a.Z(c);return a};u.na.prototype.p=function(){u.da.prototype.p.call(this);u.R.prototype.p.call(this)};
|
77 |
+
u.na.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.na.prototype.update=u.da.prototype.update;u.bb=u.q.extend({i:function(a,c){u.q.call(this,a,c);(!a.poster()||!a.controls())&&this.C();a.d("play",u.bind(this,this.C))}});
|
78 |
+
u.bb.prototype.e=function(){var a=u.e("div",{className:"vjs-poster",tabIndex:-1}),c=this.b.poster();c&&("backgroundSize"in a.style?a.style.backgroundImage='url("'+c+'")':a.appendChild(u.e("img",{src:c})));return a};u.bb.prototype.p=function(){this.L().controls()&&this.b.play()};
|
79 |
+
u.Ub=u.c.extend({i:function(a,c){u.c.call(this,a,c);a.d("canplay",u.bind(this,this.C));a.d("canplaythrough",u.bind(this,this.C));a.d("playing",u.bind(this,this.C));a.d("seeked",u.bind(this,this.C));a.d("seeking",u.bind(this,this.show));a.d("seeked",u.bind(this,this.C));a.d("error",u.bind(this,this.show));a.d("waiting",u.bind(this,this.show))}});u.Ub.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-loading-spinner"})};u.Va=u.q.extend();
|
80 |
+
u.Va.prototype.e=function(){return u.q.prototype.e.call(this,"div",{className:"vjs-big-play-button",innerHTML:"<span></span>","aria-label":"play video"})};u.Va.prototype.p=function(){this.b.play()};
|
81 |
+
u.r=u.c.extend({i:function(a,c,d){u.c.call(this,a,c,d);var e,g;g=this;e=this.L();a=function(){if(e.controls()&&!e.Pb()){var a,c;g.d("mousedown",g.p);g.d("touchstart",function(a){a.preventDefault();a.stopPropagation();c=I(this.b)});a=function(a){a.stopPropagation();c&&this.b.rc()};g.d("touchmove",a);g.d("touchleave",a);g.d("touchcancel",a);g.d("touchend",a);var d,n,s;d=0;g.d("touchstart",function(){d=(new Date).getTime();s=f});a=function(){s=l};g.d("touchmove",a);g.d("touchleave",a);g.d("touchcancel",
|
82 |
+
a);g.d("touchend",function(){s===f&&(n=(new Date).getTime()-d,250>n&&this.j("tap"))});g.d("tap",g.jd)}};c=u.bind(g,g.md);this.M(a);e.d("controlsenabled",a);e.d("controlsdisabled",c)}});u.r.prototype.md=function(){this.n("tap");this.n("touchstart");this.n("touchmove");this.n("touchleave");this.n("touchcancel");this.n("touchend");this.n("click");this.n("mousedown")};u.r.prototype.p=function(a){0===a.button&&this.L().controls()&&(this.L().paused()?this.L().play():this.L().pause())};
|
83 |
+
u.r.prototype.jd=function(){I(this.L(),!I(this.L()))};u.r.prototype.l={volumeControl:f,fullscreenResize:l,progressEvents:l,timeupdateEvents:l};u.media={};u.media.Ua="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(" ");
|
84 |
+
function ea(){var a=u.media.Ua[i];return function(){throw Error('The "'+a+"\" method is not available on the playback technology's API");}}for(var i=u.media.Ua.length-1;0<=i;i--)u.r.prototype[u.media.Ua[i]]=ea();
|
85 |
+
u.o=u.r.extend({i:function(a,c,d){this.l.volumeControl=u.o.Qc();this.l.movingMediaElementInDOM=!u.Fc;this.l.fullscreenResize=f;u.r.call(this,a,c,d);(c=c.source)&&this.a.currentSrc==c.src?a.j("loadstart"):c&&(this.a.src=c.src);if(u.Mc&&a.options().nativeControlsForTouch!==l){var e,g,h,k;e=this;g=this.L();c=g.controls();e.a.controls=!!c;h=function(){e.a.controls=f};k=function(){e.a.controls=l};g.d("controlsenabled",h);g.d("controlsdisabled",k);c=function(){g.n("controlsenabled",h);g.n("controlsdisabled",
|
86 |
+
k)};e.d("dispose",c);g.d("usingcustomcontrols",c);g.Pb(f)}a.M(function(){this.F&&(this.g.autoplay&&this.paused())&&(delete this.F.poster,this.play())});for(a=u.o.Za.length-1;0<=a;a--)u.d(this.a,u.o.Za[a],u.bind(this.b,this.Wc));this.Ta()}});t=u.o.prototype;t.D=function(){u.r.prototype.D.call(this)};
|
87 |
+
t.e=function(){var a=this.b,c=a.F;if(!c||this.l.movingMediaElementInDOM===l)c?(c.player=j,a.F=j,a.v().removeChild(c),c=c.cloneNode(l)):c=u.e("video",{id:a.id()+"_html5_api",className:"vjs-tech"}),c.player=a,u.yb(c,a.v());for(var d=["autoplay","preload","loop","muted"],e=d.length-1;0<=e;e--){var g=d[e];a.g[g]!==j&&(c[g]=a.g[g])}return c};t.Wc=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};
|
88 |
+
t.currentTime=function(){return this.a.currentTime};t.pd=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.ud=function(a){this.a.volume=a};t.muted=function(){return this.a.muted};t.sd=function(a){this.a.muted=a};t.width=function(){return this.a.offsetWidth};t.height=function(){return this.a.offsetHeight};
|
89 |
+
t.Sa=function(){return"function"==typeof this.a.webkitEnterFullScreen&&(/Android/.test(u.G)||!/Chrome|Mac OS X 10.5/.test(u.G))?f:l};t.src=function(a){this.a.src=a};t.load=function(){this.a.load()};t.currentSrc=function(){return this.a.currentSrc};t.Pa=function(){return this.a.Pa};t.td=function(a){this.a.Pa=a};t.autoplay=function(){return this.a.autoplay};t.od=function(a){this.a.autoplay=a};t.controls=function(){return this.a.controls};t.loop=function(){return this.a.loop};
|
90 |
+
t.rd=function(a){this.a.loop=a};t.error=function(){return this.a.error};t.seeking=function(){return this.a.seeking};u.o.isSupported=function(){return!!u.ma.canPlayType};u.o.lb=function(a){try{return!!u.ma.canPlayType(a.type)}catch(c){return""}};u.o.Qc=function(){var a=u.ma.volume;u.ma.volume=a/2+0.1;return a!==u.ma.volume};u.o.Za="loadstart suspend abort error emptied stalled loadedmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate progress play pause ratechange volumechange".split(" ");
|
91 |
+
u.Jc&&(document.createElement("video").constructor.prototype.canPlayType=function(a){return a&&-1!=a.toLowerCase().indexOf("video/mp4")?"maybe":""});
|
92 |
+
u.f=u.r.extend({i: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"}),h=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.Pa,loop:a.loop,muted:a.muted},c.flashVars),r=u.k.B({wmode:"opaque",bgcolor:"#000000"},c.params),n=u.k.B({id:h,name:h,"class":"vjs-tech"},c.attributes);e&&(e.type&&u.f.ad(e.type)?
|
93 |
+
(a=u.f.wc(e.src),k.rtmpConnection=encodeURIComponent(a.qb),k.rtmpStream=encodeURIComponent(a.Mb)):k.src=encodeURIComponent(u.ic(e.src)));u.yb(g,d);c.startTime&&this.M(function(){this.load();this.play();this.currentTime(c.startTime)});if(c.iFrameMode===f&&!u.Ec){var s=u.e("iframe",{id:h+"_iframe",name:h+"_iframe",className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0});k.readyFunction="ready";k.eventProxyFunction="events";k.errorEventProxyFunction="errors";u.d(s,"load",u.bind(this,
|
94 |
+
function(){var a,d=s.contentWindow;a=s.contentDocument?s.contentDocument:s.contentWindow.document;a.write(u.f.jc(c.swf,k,r,n));d.player=this.b;d.ready=u.bind(this.b,function(c){var d=this.h;d.a=a.getElementById(c);u.f.ob(d)});d.events=u.bind(this.b,function(a,c){this&&"flash"===this.ia&&this.j(c)});d.errors=u.bind(this.b,function(a,c){u.log("Flash Error",c)})}));g.parentNode.replaceChild(s,g)}else u.f.Vc(c.swf,g,k,r,n)}});t=u.f.prototype;t.D=function(){u.r.prototype.D.call(this)};t.play=function(){this.a.vjs_play()};
|
95 |
+
t.pause=function(){this.a.vjs_pause()};t.src=function(a){u.f.$c(a)?(a=u.f.wc(a),this.Nd(a.qb),this.Od(a.Mb)):(a=u.ic(a),this.a.vjs_src(a));if(this.b.autoplay()){var c=this;setTimeout(function(){c.play()},0)}};t.currentSrc=function(){var a=this.a.vjs_getProperty("currentSrc");if(a==j){var c=this.Ld(),d=this.Md();c&&d&&(a=u.f.vd(c,d))}return a};t.load=function(){this.a.vjs_load()};t.poster=function(){this.a.vjs_getProperty("poster")};t.buffered=function(){return u.sb(0,this.a.vjs_getProperty("buffered"))};
|
96 |
+
t.Sa=q(l);var R=u.f.prototype,S="rtmpConnection rtmpStream preload currentTime 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(" ");
|
97 |
+
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)}}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.lb=function(a){if(a.type in u.f.Yc||a.type in u.f.xc)return"maybe"};u.f.Yc={"video/flv":"FLV","video/x-flv":"FLV","video/mp4":"MP4","video/m4v":"MP4"};u.f.xc={"rtmp/mp4":"MP4","rtmp/flv":"FLV"};
|
98 |
+
u.f.onReady=function(a){a=u.v(a);var c=a.player||a.parentNode.player,d=c.h;a.player=c;d.a=a;u.f.ob(d)};u.f.ob=function(a){a.v().vjs_getProperty?a.Ta():setTimeout(function(){u.f.ob(a)},50)};u.f.onEvent=function(a,c){u.v(a).player.j(c)};u.f.onError=function(a,c){u.v(a).player.j("error");u.log("Flash Error",c,a)};
|
99 |
+
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(",")};
|
100 |
+
u.f.Vc=function(a,c,d,e,g){a=u.f.jc(a,d,e,g);a=u.e("div",{innerHTML:a}).childNodes[0];d=c.parentNode;c.parentNode.replaceChild(a,c);var h=d.childNodes[0];setTimeout(function(){h.style.display="block"},1E3)};
|
101 |
+
u.f.jc=function(a,c,d,e){var g="",h="",k="";c&&u.k.ta(c,function(a,c){g+=a+"="+c+"&"});d=u.k.B({movie:a,flashvars:g,allowScriptAccess:"always",allowNetworking:"all"},d);u.k.ta(d,function(a,c){h+='<param name="'+a+'" value="'+c+'" />'});e=u.k.B({data:a,width:"100%",height:"100%"},e);u.k.ta(e,function(a,c){k+=a+'="'+c+'" '});return'<object type="application/x-shockwave-flash"'+k+">"+h+"</object>"};u.f.vd=function(a,c){return a+"&"+c};
|
102 |
+
u.f.wc=function(a){var c={qb:"",Mb:""};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.Mb=a.substring(e,a.length);return c};u.f.ad=function(a){return a in u.f.xc};u.f.Lc=/^rtmp[set]?:\/\//i;u.f.$c=function(a){return u.f.Lc.test(a)};
|
103 |
+
u.Kc=u.c.extend({i:function(a,c,d){u.c.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.$(d[c]),g=window.videojs[e];if(g&&g.isSupported()){J(a,e);break}}}else a.src(a.g.sources)}});function W(a){a.za=a.za||[];return a.za}function X(a,c,d){for(var e=a.za,g=0,h=e.length,k,r;g<h;g++)k=e[g],k.id()===c?(k.show(),r=k):d&&(k.K()==d&&0<k.mode())&&k.disable();(c=r?r.K():d?d:l)&&a.j(c+"trackchange")}
|
104 |
+
u.X=u.c.extend({i:function(a,c){u.c.call(this,a,c);this.Q=c.id||"vjs_"+c.kind+"_"+c.language+"_"+u.s++;this.tc=c.src;this.Sc=c["default"]||c.dflt;this.xd=c.title;this.Id=c.srclang;this.bd=c.label;this.fa=[];this.bc=[];this.ga=this.ha=0;this.b.d("fullscreenchange",u.bind(this,this.Nc))}});t=u.X.prototype;t.K=p("A");t.src=p("tc");t.tb=p("Sc");t.title=p("xd");t.label=p("bd");t.readyState=p("ha");t.mode=p("ga");t.Nc=function(){this.a.style.fontSize=this.b.I?140*(screen.width/this.b.width())+"%":""};
|
105 |
+
t.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-"+this.A+" vjs-text-track"})};t.show=function(){Y(this);this.ga=2;u.c.prototype.show.call(this)};t.C=function(){Y(this);this.ga=1;u.c.prototype.C.call(this)};t.disable=function(){2==this.ga&&this.C();this.b.n("timeupdate",u.bind(this,this.update,this.Q));this.b.n("ended",u.bind(this,this.reset,this.Q));this.reset();this.b.V.textTrackDisplay.removeChild(this);this.ga=0};
|
106 |
+
function Y(a){0===a.ha&&a.load();0===a.ga&&(a.b.d("timeupdate",u.bind(a,a.update,a.Q)),a.b.d("ended",u.bind(a,a.reset,a.Q)),("captions"===a.A||"subtitles"===a.A)&&a.b.V.textTrackDisplay.Z(a))}t.load=function(){0===this.ha&&(this.ha=1,u.get(this.tc,u.bind(this,this.kd),u.bind(this,this.Fb)))};t.Fb=function(a){this.error=a;this.ha=3;this.j("error")};
|
107 |
+
t.kd=function(a){var c,d;a=a.split("\n");for(var e="",g=1,h=a.length;g<h;g++)if(e=u.trim(a[g])){-1==e.indexOf("--\x3e")?(c=e,e=u.trim(a[++g])):c=this.fa.length;c={id:c,index:this.fa.length};d=e.split(" --\x3e ");c.startTime=ga(d[0]);c.ua=ga(d[1]);for(d=[];a[++g]&&(e=u.trim(a[g]));)d.push(e);c.text=d.join("<br/>");this.fa.push(c)}this.ha=2;this.j("loaded")};
|
108 |
+
function ga(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}
|
109 |
+
t.update=function(){if(0<this.fa.length){var a=this.b.currentTime();if(this.Kb===b||a<this.Kb||this.La<=a){var c=this.fa,d=this.b.duration(),e=0,g=l,h=[],k,r,n,s;a>=this.La||this.La===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.ua<=a)e=Math.max(e,n.ua),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?(h.splice(0,0,n),r===b&&(r=s),k=s):(h.push(n),k===b&&(k=s),r=s),d=Math.min(d,n.ua),e=Math.max(e,n.startTime),
|
110 |
+
n.Ha=f;if(g)if(0===s)break;else s--;else if(s===c.length-1)break;else s++}this.bc=h;this.La=d;this.Kb=e;this.vb=k;this.Cb=r;a=this.bc;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.La=0;this.Kb=this.b.duration();this.Cb=this.vb=0};u.Sb=u.X.extend();u.Sb.prototype.A="captions";u.Yb=u.X.extend();u.Yb.prototype.A="subtitles";u.Tb=u.X.extend();u.Tb.prototype.A="chapters";
|
111 |
+
u.Zb=u.c.extend({i:function(a,c,d){u.c.call(this,a,c,d);if(a.g.tracks&&0<a.g.tracks.length){c=this.b;a=a.g.tracks;var e;for(d=0;d<a.length;d++){e=a[d];var g=c,h=e.kind,k=e.label,r=e.language,n=e;e=g.za=g.za||[];n=n||{};n.kind=h;n.label=k;n.language=r;h=u.$(h||"subtitles");g=new window.videojs[h+"Track"](g,n);e.push(g)}}}});u.Zb.prototype.e=function(){return u.c.prototype.e.call(this,"div",{className:"vjs-text-track-display"})};
|
112 |
+
u.Y=u.N.extend({i:function(a,c){var d=this.ca=c.track;c.label=d.label();c.selected=d.tb();u.N.call(this,a,c);this.b.d(d.K()+"trackchange",u.bind(this,this.update))}});u.Y.prototype.p=function(){u.N.prototype.p.call(this);X(this.b,this.ca.Q,this.ca.K())};u.Y.prototype.update=function(){this.selected(2==this.ca.mode())};u.ab=u.Y.extend({i:function(a,c){c.track={K:function(){return c.kind},L:a,label:function(){return c.kind+" off"},tb:q(l),mode:q(l)};u.Y.call(this,a,c);this.selected(f)}});
|
113 |
+
u.ab.prototype.p=function(){u.Y.prototype.p.call(this);X(this.b,this.ca.Q,this.ca.K())};u.ab.prototype.update=function(){for(var a=W(this.b),c=0,d=a.length,e,g=f;c<d;c++)e=a[c],e.K()==this.ca.K()&&2==e.mode()&&(g=l);this.selected(g)};u.S=u.R.extend({i:function(a,c){u.R.call(this,a,c);1>=this.J.length&&this.C()}});u.S.prototype.sa=function(){var a=[],c;a.push(new u.ab(this.b,{kind:this.A}));for(var d=0;d<W(this.b).length;d++)c=W(this.b)[d],c.K()===this.A&&a.push(new u.Y(this.b,{track:c}));return a};
|
114 |
+
u.Ca=u.S.extend({i:function(a,c,d){u.S.call(this,a,c,d);this.a.setAttribute("aria-label","Captions Menu")}});u.Ca.prototype.A="captions";u.Ca.prototype.pa="Captions";u.Ca.prototype.className="vjs-captions-button";u.Ga=u.S.extend({i: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.pa="Subtitles";u.Ga.prototype.className="vjs-subtitles-button";
|
115 |
+
u.Da=u.S.extend({i:function(a,c,d){u.S.call(this,a,c,d);this.a.setAttribute("aria-label","Chapters Menu")}});t=u.Da.prototype;t.A="chapters";t.pa="Chapters";t.className="vjs-chapters-button";t.sa=function(){for(var a=[],c,d=0;d<W(this.b).length;d++)c=W(this.b)[d],c.K()===this.A&&a.push(new u.Y(this.b,{track:c}));return a};
|
116 |
+
t.Ja=function(){for(var a=W(this.b),c=0,d=a.length,e,g,h=this.J=[];c<d;c++)if(e=a[c],e.K()==this.A&&e.tb()){if(2>e.readyState()){this.Fd=e;e.d("loaded",u.bind(this,this.Ja));return}g=e;break}a=this.va=new u.la(this.b);a.a.appendChild(u.e("li",{className:"vjs-menu-title",innerHTML:u.$(this.A),wd:-1}));if(g){e=g.fa;for(var k,c=0,d=e.length;c<d;c++)k=e[c],k=new u.Wa(this.b,{track:g,cue:k}),h.push(k),a.Z(k)}0<this.J.length&&this.show();return a};
|
117 |
+
u.Wa=u.N.extend({i: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.ua;u.N.call(this,a,c);d.d("cuechange",u.bind(this,this.update))}});u.Wa.prototype.p=function(){u.N.prototype.p.call(this);this.b.currentTime(this.cue.startTime);this.update(this.cue.startTime)};u.Wa.prototype.update=function(){var a=this.cue,c=this.b.currentTime();this.selected(a.startTime<=c&&c<a.ua)};
|
118 |
+
u.k.B(u.Ea.prototype.g.children,{subtitlesButton:{},captionsButton:{},chaptersButton:{}});
|
119 |
+
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,r,n=a[e];if(n&&"object"===typeof n)for(k in n)Object.prototype.hasOwnProperty.call(n,k)&&(r=d(n,k),r!==b?n[k]=r: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)}));
|
120 |
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");}}
|
121 |
+
u.cc=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!==j&&(a=u.JSON.parse(a||"{}"),v(c,a)));else{u.jb();break}else u.Ac||u.jb()};u.jb=function(){setTimeout(u.cc,1)};"complete"===document.readyState?u.Ac=f:u.U(window,"load",function(){u.Ac=f});u.jb();u.ld=function(a,c){u.w.prototype[a]=c};var ha=this;ha.Bd=f;function $(a,c){var d=a.split("."),e=ha;!(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.wa);$("videojs.cache",u.qa);$("videojs.Component",u.c);u.c.prototype.player=u.c.prototype.L;u.c.prototype.dispose=u.c.prototype.D;u.c.prototype.createEl=u.c.prototype.e;u.c.prototype.el=u.c.prototype.v;u.c.prototype.addChild=u.c.prototype.Z;u.c.prototype.children=u.c.prototype.children;u.c.prototype.on=u.c.prototype.d;u.c.prototype.off=u.c.prototype.n;u.c.prototype.one=u.c.prototype.U;u.c.prototype.trigger=u.c.prototype.j;
|
122 |
+
u.c.prototype.triggerReady=u.c.prototype.Ta;u.c.prototype.show=u.c.prototype.show;u.c.prototype.hide=u.c.prototype.C;u.c.prototype.width=u.c.prototype.width;u.c.prototype.height=u.c.prototype.height;u.c.prototype.dimensions=u.c.prototype.Tc;u.c.prototype.ready=u.c.prototype.M;u.c.prototype.addClass=u.c.prototype.m;u.c.prototype.removeClass=u.c.prototype.t;$("videojs.Player",u.w);u.w.prototype.dispose=u.w.prototype.D;u.w.prototype.requestFullScreen=u.w.prototype.xa;u.w.prototype.cancelFullScreen=u.w.prototype.nb;
|
123 |
+
u.w.prototype.bufferedPercent=u.w.prototype.Ia;u.w.prototype.usingNativeControls=u.w.prototype.Pb;$("videojs.MediaLoader",u.Kc);$("videojs.TextTrackDisplay",u.Zb);$("videojs.ControlBar",u.Ea);$("videojs.Button",u.q);$("videojs.PlayToggle",u.Wb);$("videojs.FullscreenToggle",u.Fa);$("videojs.BigPlayButton",u.Va);$("videojs.LoadingSpinner",u.Ub);$("videojs.CurrentTimeDisplay",u.Xa);$("videojs.DurationDisplay",u.Ya);$("videojs.TimeDivider",u.$b);$("videojs.RemainingTimeDisplay",u.eb);
|
124 |
+
$("videojs.Slider",u.O);$("videojs.ProgressControl",u.cb);$("videojs.SeekBar",u.Xb);$("videojs.LoadProgressBar",u.$a);$("videojs.PlayProgressBar",u.Vb);$("videojs.SeekHandle",u.fb);$("videojs.VolumeControl",u.hb);$("videojs.VolumeBar",u.gb);$("videojs.VolumeLevel",u.ac);$("videojs.VolumeMenuButton",u.na);$("videojs.VolumeHandle",u.ib);$("videojs.MuteToggle",u.da);$("videojs.PosterImage",u.bb);$("videojs.Menu",u.la);$("videojs.MenuItem",u.N);$("videojs.MenuButton",u.R);u.R.prototype.createItems=u.R.prototype.sa;
|
125 |
+
u.S.prototype.createItems=u.S.prototype.sa;u.Da.prototype.createItems=u.Da.prototype.sa;$("videojs.SubtitlesButton",u.Ga);$("videojs.CaptionsButton",u.Ca);$("videojs.ChaptersButton",u.Da);$("videojs.MediaTechController",u.r);u.r.prototype.features=u.r.prototype.l;u.r.prototype.l.volumeControl=u.r.prototype.l.zc;u.r.prototype.l.fullscreenResize=u.r.prototype.l.Gd;u.r.prototype.l.progressEvents=u.r.prototype.l.Kd;u.r.prototype.l.timeupdateEvents=u.r.prototype.l.Pd;$("videojs.Html5",u.o);
|
126 |
+
u.o.Events=u.o.Za;u.o.isSupported=u.o.isSupported;u.o.canPlaySource=u.o.lb;u.o.prototype.setCurrentTime=u.o.prototype.pd;u.o.prototype.setVolume=u.o.prototype.ud;u.o.prototype.setMuted=u.o.prototype.sd;u.o.prototype.setPreload=u.o.prototype.td;u.o.prototype.setAutoplay=u.o.prototype.od;u.o.prototype.setLoop=u.o.prototype.rd;$("videojs.Flash",u.f);u.f.isSupported=u.f.isSupported;u.f.canPlaySource=u.f.lb;u.f.onReady=u.f.onReady;$("videojs.TextTrack",u.X);u.X.prototype.label=u.X.prototype.label;
|
127 |
+
$("videojs.CaptionsTrack",u.Sb);$("videojs.SubtitlesTrack",u.Yb);$("videojs.ChaptersTrack",u.Tb);$("videojs.autoSetup",u.cc);$("videojs.plugin",u.ld);$("videojs.createTimeRange",u.sb);})();
|