Version Description
- October 21, 2011 =
- Fixed a shocking number of unenclosed stings in get_options() calls. Bad programming. Didn't affect functionality, but will stop generating errors.
- 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.
Download this release
Release Info
Developer | kylegilman |
Plugin | Video Embed & Thumbnail Generator |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- kg_callffmpeg.php +12 -13
- readme.txt +26 -8
- video-embed-thumbnail-generator.php +47 -47
kg_callffmpeg.php
CHANGED
@@ -166,7 +166,7 @@ if ($action == generate || $action == encode ) {
|
|
166 |
|
167 |
$thumbnailfilename[$i] = $jpgpath.$moviefilebasename."_thumb".$i.".jpg";
|
168 |
$thumbnailfilename[$i] = str_replace(" ", "_", $thumbnailfilename[$i]);
|
169 |
-
$ffmpeg_options = '-ss '.$movieoffset.' -i "'.$moviefilepath.'" -vframes 1 "'.$thumbnailfilename[$i].'"';
|
170 |
$thumbnailurl = $thumbnailfilebase."_thumb".$i.'.jpg';
|
171 |
$thumbnailurl = str_replace(" ", "_", $thumbnailurl);
|
172 |
|
@@ -211,11 +211,11 @@ if ($action == generate || $action == encode ) {
|
|
211 |
$ogvfilepath = $encodepath.$moviefilebasename.".ogv";
|
212 |
$webmfilepath = $encodepath.$moviefilebasename.".webm";
|
213 |
|
214 |
-
if ( ! file_exists($ipodfilepath) || filesize($webmfilepath) <
|
215 |
$ipod_movie_height = strval(round(floatval($movie_height) / floatval($movie_width) * 640));
|
216 |
if ($ipod_movie_height % 2 != 0) { $ipod_movie_height++; }
|
217 |
if ( strpos($movie_info['configuration'], 'enable-libfaac') && strpos($movie_info['configuration'], 'enable-libx264') ) {
|
218 |
-
$ffmpeg_ipod_options = ' -acodec libfaac -ab 128k -s 640x'.$ipod_movie_height.' -vcodec libx264 -vpre slow -vpre ipod640 -b 800k -bt 800k -threads
|
219 |
$embed_display .= "<strong> Encoding Mobile M4V... </strong>";
|
220 |
}//if the proper FFMPEG libraries are enabled
|
221 |
else { $embed_display .= "<strong>FFMPEG missing library 'libfaac' or 'libx264' required for iPod encoding. </strong>"; }
|
@@ -223,10 +223,11 @@ if ($action == generate || $action == encode ) {
|
|
223 |
else { $embed_display .= "<strong>Mobile M4V Already Encoded! </strong>"; }
|
224 |
|
225 |
if ($encodeogg == "true") {
|
226 |
-
if ( ! file_exists($ogvfilepath) || filesize($webmfilepath) <
|
|
|
227 |
if ( strpos($movie_info['configuration'], 'enable-libvorbis') && strpos($movie_info['configuration'], 'enable-libtheora') ) {
|
228 |
$ogvbitrate = $movie_height * 3;
|
229 |
-
$ffmpeg_ogv_options = ' -acodec libvorbis -ab 128k -vcodec libtheora -b '.$ogvbitrate.'k -threads
|
230 |
$embed_display .= "<strong> Encoding OGG... </strong>";
|
231 |
}//if the proper FFMPEG libraries are enabled
|
232 |
else { $embed_display .= "<strong>FFMPEG missing library 'libvorbis' or 'libtheora' required for ogv encoding. </strong>"; }
|
@@ -235,10 +236,10 @@ if ($action == generate || $action == encode ) {
|
|
235 |
}//if encodeogg is checked
|
236 |
|
237 |
if ($encodewebm == "true") {
|
238 |
-
if ( ! file_exists($webmfilepath) || filesize($webmfilepath) <
|
239 |
if ( strpos($movie_info['configuration'], 'enable-libvorbis') && strpos($movie_info['configuration'], 'enable-libvpx') ) {
|
240 |
$webmbitrate = $movie_height * 3;
|
241 |
-
$ffmpeg_webm_options = ' -ab 128k -b '.$webmbitrate.'k -threads
|
242 |
$embed_display .= "<strong> Encoding WEBM... </strong>";
|
243 |
}//if the proper FFMPEG libraries are enabled
|
244 |
else { $embed_display .= "<strong>FFMPEG missing library 'libvorbis' or 'libvpx' required for webm encoding. </strong>"; }
|
@@ -248,14 +249,12 @@ if ($action == generate || $action == encode ) {
|
|
248 |
|
249 |
|
250 |
if ( ! file_exists($ogvfilepath) || ! file_exists($ipodfilepath) || ! file_exists($webmfilepath) ) {
|
251 |
-
$ffmpeg_options = '-i "'.$moviefilepath.'"'.$ffmpeg_ipod_options.$ffmpeg_ogv_options.$ffmpeg_webm_options;
|
252 |
-
|
253 |
-
$
|
254 |
-
if ( strpos($pslist, $ffmpegPath) ) { $embed_display = "<strong>FFMPEG is busy. You'll have to wait until it's finished. Sorry, there's no queue.<strong>"; }
|
255 |
-
else { $process = new Process($ffmpegPath." ".$ffmpeg_options); }
|
256 |
|
257 |
}//if any HTML5 videos don't already exist
|
258 |
-
|
259 |
$arr = array ( "embed_display"=>$embed_display );
|
260 |
|
261 |
echo json_encode($arr);
|
166 |
|
167 |
$thumbnailfilename[$i] = $jpgpath.$moviefilebasename."_thumb".$i.".jpg";
|
168 |
$thumbnailfilename[$i] = str_replace(" ", "_", $thumbnailfilename[$i]);
|
169 |
+
$ffmpeg_options = '-y -ss '.$movieoffset.' -i "'.$moviefilepath.'" -vframes 1 "'.$thumbnailfilename[$i].'"';
|
170 |
$thumbnailurl = $thumbnailfilebase."_thumb".$i.'.jpg';
|
171 |
$thumbnailurl = str_replace(" ", "_", $thumbnailurl);
|
172 |
|
211 |
$ogvfilepath = $encodepath.$moviefilebasename.".ogv";
|
212 |
$webmfilepath = $encodepath.$moviefilebasename.".webm";
|
213 |
|
214 |
+
if ( ! file_exists($ipodfilepath) || filesize($webmfilepath) < 24576 ) {
|
215 |
$ipod_movie_height = strval(round(floatval($movie_height) / floatval($movie_width) * 640));
|
216 |
if ($ipod_movie_height % 2 != 0) { $ipod_movie_height++; }
|
217 |
if ( strpos($movie_info['configuration'], 'enable-libfaac') && strpos($movie_info['configuration'], 'enable-libx264') ) {
|
218 |
+
$ffmpeg_ipod_options = ' -acodec libfaac -ab 128k -s 640x'.$ipod_movie_height.' -vcodec libx264 -vpre slow -vpre ipod640 -b 800k -bt 800k -threads 1 -f ipod "'.$ipodfilepath.'"';
|
219 |
$embed_display .= "<strong> Encoding Mobile M4V... </strong>";
|
220 |
}//if the proper FFMPEG libraries are enabled
|
221 |
else { $embed_display .= "<strong>FFMPEG missing library 'libfaac' or 'libx264' required for iPod encoding. </strong>"; }
|
223 |
else { $embed_display .= "<strong>Mobile M4V Already Encoded! </strong>"; }
|
224 |
|
225 |
if ($encodeogg == "true") {
|
226 |
+
if ( ! file_exists($ogvfilepath) || filesize($webmfilepath) < 24576 ) {
|
227 |
+
|
228 |
if ( strpos($movie_info['configuration'], 'enable-libvorbis') && strpos($movie_info['configuration'], 'enable-libtheora') ) {
|
229 |
$ogvbitrate = $movie_height * 3;
|
230 |
+
$ffmpeg_ogv_options = ' -acodec libvorbis -ab 128k -vcodec libtheora -b '.$ogvbitrate.'k -threads 1 "'.$ogvfilepath.'"';
|
231 |
$embed_display .= "<strong> Encoding OGG... </strong>";
|
232 |
}//if the proper FFMPEG libraries are enabled
|
233 |
else { $embed_display .= "<strong>FFMPEG missing library 'libvorbis' or 'libtheora' required for ogv encoding. </strong>"; }
|
236 |
}//if encodeogg is checked
|
237 |
|
238 |
if ($encodewebm == "true") {
|
239 |
+
if ( ! file_exists($webmfilepath) || filesize($webmfilepath) < 24576 ) {
|
240 |
if ( strpos($movie_info['configuration'], 'enable-libvorbis') && strpos($movie_info['configuration'], 'enable-libvpx') ) {
|
241 |
$webmbitrate = $movie_height * 3;
|
242 |
+
$ffmpeg_webm_options = ' -ab 128k -b '.$webmbitrate.'k -threads 1 "'.$webmfilepath.'"';
|
243 |
$embed_display .= "<strong> Encoding WEBM... </strong>";
|
244 |
}//if the proper FFMPEG libraries are enabled
|
245 |
else { $embed_display .= "<strong>FFMPEG missing library 'libvorbis' or 'libvpx' required for webm encoding. </strong>"; }
|
249 |
|
250 |
|
251 |
if ( ! file_exists($ogvfilepath) || ! file_exists($ipodfilepath) || ! file_exists($webmfilepath) ) {
|
252 |
+
$ffmpeg_options = '-y -i "'.$moviefilepath.'"'.$ffmpeg_ipod_options.$ffmpeg_ogv_options.$ffmpeg_webm_options;
|
253 |
+
|
254 |
+
$process = new Process($ffmpegPath." ".$ffmpeg_options);
|
|
|
|
|
255 |
|
256 |
}//if any HTML5 videos don't already exist
|
257 |
+
|
258 |
$arr = array ( "embed_display"=>$embed_display );
|
259 |
|
260 |
echo json_encode($arr);
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: kylegilman
|
|
3 |
Tags: video, html5, shortcode, thumbnail, ffmpeg
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.2.1
|
6 |
-
Stable tag: 1.0.
|
7 |
|
8 |
Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG for thumbnails and encodes.
|
9 |
|
@@ -25,10 +25,9 @@ If FFMPEG is installed on your server, you can generate thumbnails using either
|
|
25 |
|
26 |
In the plugin settings you can set the default maximum width based on the width 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 automatically adjusted to match the size and aspect ratio of the video file. You can make further adjustments if you want.
|
27 |
|
28 |
-
The "Encode" button is still a bit experimental. If you have FFMPEG on your server, clicking the button will start encoding an iPod/iPad/Android compliant H.264 video (which will also work in Safari and IE 9) and a Firefox/Chrome-compatible WEBM video in the same directory as your original file. You can choose to also encode OGV or turn off WEBM encoding in the Video Embed & Thumbnail Generator
|
29 |
-
plugin's settings page. Anyone using a modern browser who doesn't have a Flash plugin will see these files instead of the original. 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. Currently, if something goes wrong after the encode starts, the plugin will not tell you. It also won't tell you when the files are done. You just have to wait.
|
30 |
|
31 |
-
The plugin is currently favoring Flash instead of HTML5 because Flash is a better user experience in most cases. I'm particularly not a fan of some browsers' tendencies to auto-download HTML5 video elements. I may eventually include the option to favor HTML5.
|
32 |
|
33 |
Android viewers who don't use Flash will see a play button superimposed on the thumbnail instead of the default still image.
|
34 |
|
@@ -50,6 +49,14 @@ I'm not really a software developer. I'm just a film editor with some time on hi
|
|
50 |
|
51 |
1. Upload the unzipped folder `video-embed-thumbnail-generator` to the `/wp-content/plugins/` directory.
|
52 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
1. Follow instructions on the Description page.
|
54 |
|
55 |
== Frequently Asked Questions ==
|
@@ -67,10 +74,21 @@ Some of it will work without FFMPEG. You can generate embed codes for your video
|
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
-
1.0.
|
|
|
|
|
|
|
|
|
|
|
71 |
|
72 |
-
1.0
|
|
|
|
|
|
|
|
|
73 |
|
74 |
-
0.2.1
|
|
|
75 |
|
76 |
-
0.2
|
|
3 |
Tags: video, html5, shortcode, thumbnail, ffmpeg
|
4 |
Requires at least: 3.0
|
5 |
Tested up to: 3.2.1
|
6 |
+
Stable tag: 1.0.2
|
7 |
|
8 |
Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG for thumbnails and encodes.
|
9 |
|
25 |
|
26 |
In the plugin settings you can set the default maximum width based on the width 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 automatically adjusted to match the size and aspect ratio of the video file. You can make further adjustments if you want.
|
27 |
|
28 |
+
The "Encode" button is still a bit experimental. If you have FFMPEG on your server, clicking the button will start encoding an iPod/iPad/Android compliant H.264 video (which will also work in Safari and IE 9) and a Firefox/Chrome-compatible WEBM video in the same directory as your original file. You can choose to also encode OGV or turn off WEBM encoding in the Video Embed & Thumbnail Generator plugin's settings page. Anyone using a modern browser who doesn't have a Flash plugin will see these files instead of the original. 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. Currently, if something goes wrong after the encode starts, the plugin will not tell you. It also won't tell you when the files are done. You just have to wait.
|
|
|
29 |
|
30 |
+
The plugin is currently favoring Flash instead of HTML5 because Flash is a better user experience in most cases. I'm particularly not a fan of some browsers' tendencies to auto-download HTML5 video elements. I may eventually include the option to favor HTML5. However, if you embed a non-Flash compatible file (like an ogv or webm file) then you will only get the HTML5 video element. 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.webm and awesomevid.ogv as well. If you want to embed a high-res H.264 video but also make a mobile-compatible version available, add -ipod.m4v to the end of the filename (awesomevid-ipod.m4v) and it will be served up to most smartphones and tablets instead of the original.
|
31 |
|
32 |
Android viewers who don't use Flash will see a play button superimposed on the thumbnail instead of the default still image.
|
33 |
|
49 |
|
50 |
1. Upload the unzipped folder `video-embed-thumbnail-generator` to the `/wp-content/plugins/` directory.
|
51 |
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
52 |
+
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:
|
53 |
+
|
54 |
+
`AddType video/ogg .ogv
|
55 |
+
AddType video/mp4 .mp4
|
56 |
+
AddType video/mp4 .m4v
|
57 |
+
AddType video/webm .webm`
|
58 |
+
|
59 |
+
Or use your web host's configuration panel (cpanel, etc) to add a custom MIME type.
|
60 |
1. Follow instructions on the Description page.
|
61 |
|
62 |
== Frequently Asked Questions ==
|
74 |
|
75 |
== Changelog ==
|
76 |
|
77 |
+
= 1.0.2 - October 21, 2011 =
|
78 |
+
* Fixed a shocking number of unenclosed stings in get_options() calls. Bad programming. Didn't affect functionality, but will stop generating errors.
|
79 |
+
* 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.
|
80 |
+
|
81 |
+
= 1.0.1 - October 21, 2011 =
|
82 |
+
* Quick fix to add mdetect.php to the plugin package from Wordpress
|
83 |
|
84 |
+
= 1.0 - October 20, 2011 =
|
85 |
+
* Huge re-write.
|
86 |
+
* Integrated with Wordpress Media Library and added WEBM support.
|
87 |
+
* Increased control over thumbnail generation.
|
88 |
+
* Added tab to Insert Video dialog box for adding by URL (like the old version).
|
89 |
|
90 |
+
= 0.2.1 - October 9, 2011 =
|
91 |
+
* Check made to ensure iPhone/iPod/Android compatible encode video height is an even number when HTML5 video encodes are made.
|
92 |
|
93 |
+
= 0.2 - January 18, 2011 =
|
94 |
+
* First Release
|
video-embed-thumbnail-generator.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Video Embed & Thumbnail Generator
|
4 |
Plugin URI: http://www.kylegilman.net/2011/01/18/video-embed-thumbnail-generator-wordpress-plugin/
|
5 |
Description: Generate video thumbnails, HTML5-compliant videos, and video embed shortcodes. Some functions require FFMPEG.
|
6 |
-
Version: 1.0.
|
7 |
Author: Kyle Gilman
|
8 |
Author URI: http://www.kylegilman.net/
|
9 |
|
@@ -120,7 +120,7 @@ function video_embed_thumbnail_generator_activate() {
|
|
120 |
register_activation_hook( __FILE__, 'video_embed_thumbnail_generator_activate' );
|
121 |
|
122 |
function addSWFObject() {
|
123 |
-
if(get_option(wp_FMP_swfobject) == "true") {
|
124 |
echo "\n<script src=\"http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\" type=\"text/javascript\"></script>\n";
|
125 |
}
|
126 |
}
|
@@ -132,23 +132,23 @@ function FMP_shortcode($atts, $content = ''){
|
|
132 |
if(substr($content, 0, 1) == '/') $content = get_bloginfo('url').$content;
|
133 |
|
134 |
$query_atts = shortcode_atts(
|
135 |
-
array('width' => get_option(wp_FMP_width),
|
136 |
-
'height' => get_option(wp_FMP_height),
|
137 |
-
'controlbar' => get_option(wp_FMP_controlbar_style),
|
138 |
-
'autohide' => get_option(wp_FMP_autohide),
|
139 |
-
'poster' => get_option(wp_FMP_poster),
|
140 |
-
'playbutton' => get_option(wp_FMP_playbutton),
|
141 |
-
'loop' => get_option(wp_FMP_loop),
|
142 |
-
'autoplay' => get_option(wp_FMP_autoplay),
|
143 |
-
'streamtype' => get_option(wp_FMP_stream_type),
|
144 |
-
'scalemode' => get_option(wp_FMP_scale_mode),
|
145 |
-
'backgroundcolor' => get_option(wp_FMP_bgcolor),
|
146 |
-
'configuration' => get_option(wp_FMP_configuration),
|
147 |
-
'skin' => get_option(wp_FMP_skin)), $atts);
|
148 |
|
149 |
$div_suffix = substr(uniqid(rand(), true),0,4);
|
150 |
|
151 |
-
if(get_option(wp_FMP_http_streaming) != "true") {
|
152 |
$video_swf = "http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf";
|
153 |
$minimum_flash = "10.0.0";
|
154 |
} else {
|
@@ -196,7 +196,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
196 |
|
197 |
$params = "{allowfullscreen:'true', allowscriptaccess:'always'}";
|
198 |
|
199 |
-
if(get_option(wp_FMP_HTML5) == "true") {
|
200 |
include_once dirname( __FILE__ ) .'/mdetect.php';
|
201 |
$uagent_obj = new uagent_info();
|
202 |
$isAndroid = $uagent_obj->DetectAndroid(); //determine if we're running on an Android device
|
@@ -267,7 +267,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
267 |
$code .= "</video>\n";
|
268 |
$code .= "</div>\n\n";
|
269 |
} else {
|
270 |
-
if ( in_array($moviefiletype, $flashcompatible) ) { $code = "<div id=\"flashcontent".$div_suffix."\">".get_option(wp_FMP_flashplayer)."</div>\n\n"; }
|
271 |
}
|
272 |
|
273 |
if ( in_array($moviefiletype, $flashcompatible) ) {
|
@@ -410,7 +410,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
410 |
<td>
|
411 |
<?php
|
412 |
echo "<input type='checkbox' name='wp_FMP_swfobject' id='wp_FMP_swfobject' value='use' ";
|
413 |
-
if(get_option(wp_FMP_swfobject) == "true") {
|
414 |
echo "checked";
|
415 |
}
|
416 |
echo " />\n";
|
@@ -426,7 +426,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
426 |
<td>
|
427 |
<?php
|
428 |
echo "<input type='checkbox' name='wp_FMP_HTML5' id='wp_FMP_HTML5' value='use' ";
|
429 |
-
if(get_option(wp_FMP_HTML5) == "true") {
|
430 |
echo "checked";
|
431 |
}
|
432 |
echo " />\n";
|
@@ -442,7 +442,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
442 |
<td>
|
443 |
<?php
|
444 |
echo "<input type='checkbox' name='wp_FMP_encodeogg' id='wp_FMP_encodeogg' value='use' ";
|
445 |
-
if(get_option(wp_FMP_encodeogg) == "true") {
|
446 |
echo "checked";
|
447 |
}
|
448 |
echo " />\n";
|
@@ -459,7 +459,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
459 |
<td>
|
460 |
<?php
|
461 |
echo "<input type='checkbox' name='wp_FMP_encodewebm' id='wp_FMP_encodewebm' value='use' ";
|
462 |
-
if(get_option(wp_FMP_encodewebm) == "true") {
|
463 |
echo "checked";
|
464 |
}
|
465 |
echo " />\n";
|
@@ -475,7 +475,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
475 |
<td>
|
476 |
<?php
|
477 |
echo "<input type='checkbox' name='wp_FMP_http_streaming' id='wp_FMP_http_streaming' value='use' ";
|
478 |
-
if(get_option(wp_FMP_http_streaming) == "true") {
|
479 |
echo "checked";
|
480 |
}
|
481 |
echo " />\n";
|
@@ -489,7 +489,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
489 |
</th>
|
490 |
<td width="10"></td>
|
491 |
<td>
|
492 |
-
<textarea name="wp_FMP_flashplayer" id="wp_FMP_flashplayer" rows="5" cols="50"><?php echo get_option(wp_FMP_flashplayer) ?></textarea><br />
|
493 |
<em>This message will only be shown if HTML5 video fallback is disabled</em>
|
494 |
</td>
|
495 |
</tr>
|
@@ -506,7 +506,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
506 |
</th>
|
507 |
<td width="10"></td>
|
508 |
<td>
|
509 |
-
<input name="wp_FMP_ffmpeg" id="wp_FMP_ffmpeg" type="text" value="<?php echo get_option(wp_FMP_ffmpeg) ?>" /><br />
|
510 |
<em><small>Don't include trailing slash. Example: /usr/local/bin</small></em>
|
511 |
</td>
|
512 |
</tr>
|
@@ -520,7 +520,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
520 |
</th>
|
521 |
<td width="10"></td>
|
522 |
<td>
|
523 |
-
<input name="wp_FMP_width" id="wp_FMP_width" type="text" value="<?php echo get_option(wp_FMP_width) ?>" />
|
524 |
</td>
|
525 |
</tr>
|
526 |
<tr>
|
@@ -529,7 +529,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
529 |
</th>
|
530 |
<td width="10"></td>
|
531 |
<td>
|
532 |
-
<input name="wp_FMP_height" id="wp_FMP_height" type="text" value="<?php echo get_option(wp_FMP_height) ?>" />
|
533 |
</td>
|
534 |
</tr>
|
535 |
<tr>
|
@@ -538,7 +538,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
538 |
</th>
|
539 |
<td width="10"></td>
|
540 |
<td>
|
541 |
-
<input name="wp_FMP_bgcolor" id="wp_FMP_bgcolor" type="text" value="<?php echo get_option(wp_FMP_bgcolor) ?>" />
|
542 |
</td>
|
543 |
</tr>
|
544 |
<tr>
|
@@ -547,7 +547,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
547 |
</th>
|
548 |
<td width="10"></td>
|
549 |
<td>
|
550 |
-
<input name="wp_FMP_configuration" id="wp_FMP_configuration" type="text" size="50" value="<?php echo get_option(wp_FMP_configuration) ?>" />
|
551 |
</td>
|
552 |
</tr>
|
553 |
<tr>
|
@@ -556,7 +556,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
556 |
</th>
|
557 |
<td width="10"></td>
|
558 |
<td>
|
559 |
-
<input name="wp_FMP_skin" id="wp_FMP_skin" type="text" size="50" value="<?php echo get_option(wp_FMP_skin) ?>" />
|
560 |
</td>
|
561 |
</tr>
|
562 |
<tr>
|
@@ -572,16 +572,16 @@ function FMP_shortcode($atts, $content = ''){
|
|
572 |
$recorded = "";
|
573 |
$dvr = "";
|
574 |
|
575 |
-
if(get_option(wp_FMP_stream_type) == "liveOrRecorded") {
|
576 |
$liveOrRecorded = " selected=\"selected\"";
|
577 |
}
|
578 |
-
if(get_option(wp_FMP_stream_type) == "live") {
|
579 |
$live = " selected=\"selected\"";
|
580 |
}
|
581 |
-
if(get_option(wp_FMP_stream_type) == "recorded") {
|
582 |
$recorded = " selected=\"selected\"";
|
583 |
}
|
584 |
-
if(get_option(wp_FMP_stream_type) == "dvr") {
|
585 |
$dvr = " selected=\"selected\"";
|
586 |
}
|
587 |
|
@@ -606,16 +606,16 @@ function FMP_shortcode($atts, $content = ''){
|
|
606 |
$stretch = "";
|
607 |
$zoom = "";
|
608 |
|
609 |
-
if(get_option(wp_FMP_scale_mode) == "letterbox") {
|
610 |
$letterbox = " selected=\"selected\"";
|
611 |
}
|
612 |
-
if(get_option(wp_FMP_scale_mode) == "none") {
|
613 |
$none = " selected=\"selected\"";
|
614 |
}
|
615 |
-
if(get_option(wp_FMP_scale_mode) == "stretch") {
|
616 |
$stretch = " selected=\"selected\"";
|
617 |
}
|
618 |
-
if(get_option(wp_FMP_scale_mode) == "zoom") {
|
619 |
$zoom = " selected=\"selected\"";
|
620 |
}
|
621 |
|
@@ -638,13 +638,13 @@ function FMP_shortcode($atts, $content = ''){
|
|
638 |
$docked = "";
|
639 |
$floating = "";
|
640 |
$none = "";
|
641 |
-
if(get_option(wp_FMP_controlbar_style) == "docked") {
|
642 |
$docked = " selected=\"selected\"";
|
643 |
}
|
644 |
-
if(get_option(wp_FMP_controlbar_style) == "floating") {
|
645 |
$floating = " selected=\"selected\"";
|
646 |
}
|
647 |
-
if(get_option(wp_FMP_controlbar_style) == "none") {
|
648 |
$none = " selected=\"selected\"";
|
649 |
}
|
650 |
?>
|
@@ -660,7 +660,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
660 |
</th>
|
661 |
<td width="10"></td>
|
662 |
<td>
|
663 |
-
<input type='text' name='wp_FMP_poster' id='wp_FMP_poster' size='50' value='<?php echo get_option(wp_FMP_poster) ?>' />
|
664 |
</td>
|
665 |
</tr>
|
666 |
<tr>
|
@@ -671,7 +671,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
671 |
<td>
|
672 |
<?php
|
673 |
echo "<input type='checkbox' name='wp_FMP_autohide' id='wp_FMP_autohide' value='use' ";
|
674 |
-
if(get_option(wp_FMP_autohide) == "true") {
|
675 |
echo "checked";
|
676 |
}
|
677 |
echo " />\n";
|
@@ -687,7 +687,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
687 |
<td>
|
688 |
<?php
|
689 |
echo "<input type='checkbox' name='wp_FMP_autoplay' id='wp_FMP_autoplay' value='use' ";
|
690 |
-
if(get_option(wp_FMP_autoplay) == "true") {
|
691 |
echo "checked";
|
692 |
}
|
693 |
echo " />\n";
|
@@ -703,7 +703,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
703 |
<td>
|
704 |
<?php
|
705 |
echo "<input type='checkbox' name='wp_FMP_loop' id='wp_FMP_loop' value='use' ";
|
706 |
-
if(get_option(wp_FMP_loop) == "true") {
|
707 |
echo "checked";
|
708 |
}
|
709 |
echo " />\n";
|
@@ -719,7 +719,7 @@ function FMP_shortcode($atts, $content = ''){
|
|
719 |
<td>
|
720 |
<?php
|
721 |
echo "<input type='checkbox' name='wp_FMP_playbutton' id='wp_FMP_playbutton' value='use' ";
|
722 |
-
if(get_option(wp_FMP_playbutton) == "true") {
|
723 |
echo "checked";
|
724 |
}
|
725 |
echo " />\n";
|
@@ -1089,4 +1089,4 @@ add_action('admin_enqueue_scripts', 'enqueue_kg_script');
|
|
1089 |
|
1090 |
add_shortcode('FMP', 'FMP_shortcode');
|
1091 |
|
1092 |
-
?>
|
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: Generate video thumbnails, HTML5-compliant videos, and video embed shortcodes. Some functions require FFMPEG.
|
6 |
+
Version: 1.0.2
|
7 |
Author: Kyle Gilman
|
8 |
Author URI: http://www.kylegilman.net/
|
9 |
|
120 |
register_activation_hook( __FILE__, 'video_embed_thumbnail_generator_activate' );
|
121 |
|
122 |
function addSWFObject() {
|
123 |
+
if(get_option('wp_FMP_swfobject') == "true") {
|
124 |
echo "\n<script src=\"http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js\" type=\"text/javascript\"></script>\n";
|
125 |
}
|
126 |
}
|
132 |
if(substr($content, 0, 1) == '/') $content = get_bloginfo('url').$content;
|
133 |
|
134 |
$query_atts = shortcode_atts(
|
135 |
+
array('width' => get_option('wp_FMP_width'),
|
136 |
+
'height' => get_option('wp_FMP_height'),
|
137 |
+
'controlbar' => get_option('wp_FMP_controlbar_style'),
|
138 |
+
'autohide' => get_option('wp_FMP_autohide'),
|
139 |
+
'poster' => get_option('wp_FMP_poster'),
|
140 |
+
'playbutton' => get_option('wp_FMP_playbutton'),
|
141 |
+
'loop' => get_option('wp_FMP_loop'),
|
142 |
+
'autoplay' => get_option('wp_FMP_autoplay'),
|
143 |
+
'streamtype' => get_option('wp_FMP_stream_type'),
|
144 |
+
'scalemode' => get_option('wp_FMP_scale_mode'),
|
145 |
+
'backgroundcolor' => get_option('wp_FMP_bgcolor'),
|
146 |
+
'configuration' => get_option('wp_FMP_configuration'),
|
147 |
+
'skin' => get_option('wp_FMP_skin')), $atts);
|
148 |
|
149 |
$div_suffix = substr(uniqid(rand(), true),0,4);
|
150 |
|
151 |
+
if(get_option('wp_FMP_http_streaming') != "true") {
|
152 |
$video_swf = "http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf";
|
153 |
$minimum_flash = "10.0.0";
|
154 |
} else {
|
196 |
|
197 |
$params = "{allowfullscreen:'true', allowscriptaccess:'always'}";
|
198 |
|
199 |
+
if(get_option('wp_FMP_HTML5') == "true") {
|
200 |
include_once dirname( __FILE__ ) .'/mdetect.php';
|
201 |
$uagent_obj = new uagent_info();
|
202 |
$isAndroid = $uagent_obj->DetectAndroid(); //determine if we're running on an Android device
|
267 |
$code .= "</video>\n";
|
268 |
$code .= "</div>\n\n";
|
269 |
} else {
|
270 |
+
if ( in_array($moviefiletype, $flashcompatible) ) { $code = "<div id=\"flashcontent".$div_suffix."\">".get_option('wp_FMP_flashplayer')."</div>\n\n"; }
|
271 |
}
|
272 |
|
273 |
if ( in_array($moviefiletype, $flashcompatible) ) {
|
410 |
<td>
|
411 |
<?php
|
412 |
echo "<input type='checkbox' name='wp_FMP_swfobject' id='wp_FMP_swfobject' value='use' ";
|
413 |
+
if(get_option('wp_FMP_swfobject') == "true") {
|
414 |
echo "checked";
|
415 |
}
|
416 |
echo " />\n";
|
426 |
<td>
|
427 |
<?php
|
428 |
echo "<input type='checkbox' name='wp_FMP_HTML5' id='wp_FMP_HTML5' value='use' ";
|
429 |
+
if(get_option('wp_FMP_HTML5') == "true") {
|
430 |
echo "checked";
|
431 |
}
|
432 |
echo " />\n";
|
442 |
<td>
|
443 |
<?php
|
444 |
echo "<input type='checkbox' name='wp_FMP_encodeogg' id='wp_FMP_encodeogg' value='use' ";
|
445 |
+
if(get_option('wp_FMP_encodeogg') == "true") {
|
446 |
echo "checked";
|
447 |
}
|
448 |
echo " />\n";
|
459 |
<td>
|
460 |
<?php
|
461 |
echo "<input type='checkbox' name='wp_FMP_encodewebm' id='wp_FMP_encodewebm' value='use' ";
|
462 |
+
if(get_option('wp_FMP_encodewebm') == "true") {
|
463 |
echo "checked";
|
464 |
}
|
465 |
echo " />\n";
|
475 |
<td>
|
476 |
<?php
|
477 |
echo "<input type='checkbox' name='wp_FMP_http_streaming' id='wp_FMP_http_streaming' value='use' ";
|
478 |
+
if(get_option('wp_FMP_http_streaming') == "true") {
|
479 |
echo "checked";
|
480 |
}
|
481 |
echo " />\n";
|
489 |
</th>
|
490 |
<td width="10"></td>
|
491 |
<td>
|
492 |
+
<textarea name="wp_FMP_flashplayer" id="wp_FMP_flashplayer" rows="5" cols="50"><?php echo get_option('wp_FMP_flashplayer') ?></textarea><br />
|
493 |
<em>This message will only be shown if HTML5 video fallback is disabled</em>
|
494 |
</td>
|
495 |
</tr>
|
506 |
</th>
|
507 |
<td width="10"></td>
|
508 |
<td>
|
509 |
+
<input name="wp_FMP_ffmpeg" id="wp_FMP_ffmpeg" type="text" value="<?php echo get_option('wp_FMP_ffmpeg') ?>" /><br />
|
510 |
<em><small>Don't include trailing slash. Example: /usr/local/bin</small></em>
|
511 |
</td>
|
512 |
</tr>
|
520 |
</th>
|
521 |
<td width="10"></td>
|
522 |
<td>
|
523 |
+
<input name="wp_FMP_width" id="wp_FMP_width" type="text" value="<?php echo get_option('wp_FMP_width') ?>" />
|
524 |
</td>
|
525 |
</tr>
|
526 |
<tr>
|
529 |
</th>
|
530 |
<td width="10"></td>
|
531 |
<td>
|
532 |
+
<input name="wp_FMP_height" id="wp_FMP_height" type="text" value="<?php echo get_option('wp_FMP_height') ?>" />
|
533 |
</td>
|
534 |
</tr>
|
535 |
<tr>
|
538 |
</th>
|
539 |
<td width="10"></td>
|
540 |
<td>
|
541 |
+
<input name="wp_FMP_bgcolor" id="wp_FMP_bgcolor" type="text" value="<?php echo get_option('wp_FMP_bgcolor') ?>" />
|
542 |
</td>
|
543 |
</tr>
|
544 |
<tr>
|
547 |
</th>
|
548 |
<td width="10"></td>
|
549 |
<td>
|
550 |
+
<input name="wp_FMP_configuration" id="wp_FMP_configuration" type="text" size="50" value="<?php echo get_option('wp_FMP_configuration') ?>" />
|
551 |
</td>
|
552 |
</tr>
|
553 |
<tr>
|
556 |
</th>
|
557 |
<td width="10"></td>
|
558 |
<td>
|
559 |
+
<input name="wp_FMP_skin" id="wp_FMP_skin" type="text" size="50" value="<?php echo get_option('wp_FMP_skin') ?>" />
|
560 |
</td>
|
561 |
</tr>
|
562 |
<tr>
|
572 |
$recorded = "";
|
573 |
$dvr = "";
|
574 |
|
575 |
+
if(get_option('wp_FMP_stream_type') == "liveOrRecorded") {
|
576 |
$liveOrRecorded = " selected=\"selected\"";
|
577 |
}
|
578 |
+
if(get_option('wp_FMP_stream_type') == "live") {
|
579 |
$live = " selected=\"selected\"";
|
580 |
}
|
581 |
+
if(get_option('wp_FMP_stream_type') == "recorded") {
|
582 |
$recorded = " selected=\"selected\"";
|
583 |
}
|
584 |
+
if(get_option('wp_FMP_stream_type') == "dvr") {
|
585 |
$dvr = " selected=\"selected\"";
|
586 |
}
|
587 |
|
606 |
$stretch = "";
|
607 |
$zoom = "";
|
608 |
|
609 |
+
if(get_option('wp_FMP_scale_mode') == "letterbox") {
|
610 |
$letterbox = " selected=\"selected\"";
|
611 |
}
|
612 |
+
if(get_option('wp_FMP_scale_mode') == "none") {
|
613 |
$none = " selected=\"selected\"";
|
614 |
}
|
615 |
+
if(get_option('wp_FMP_scale_mode') == "stretch") {
|
616 |
$stretch = " selected=\"selected\"";
|
617 |
}
|
618 |
+
if(get_option('wp_FMP_scale_mode') == "zoom") {
|
619 |
$zoom = " selected=\"selected\"";
|
620 |
}
|
621 |
|
638 |
$docked = "";
|
639 |
$floating = "";
|
640 |
$none = "";
|
641 |
+
if(get_option('wp_FMP_controlbar_style') == "docked") {
|
642 |
$docked = " selected=\"selected\"";
|
643 |
}
|
644 |
+
if(get_option('wp_FMP_controlbar_style') == "floating") {
|
645 |
$floating = " selected=\"selected\"";
|
646 |
}
|
647 |
+
if(get_option('wp_FMP_controlbar_style') == "none") {
|
648 |
$none = " selected=\"selected\"";
|
649 |
}
|
650 |
?>
|
660 |
</th>
|
661 |
<td width="10"></td>
|
662 |
<td>
|
663 |
+
<input type='text' name='wp_FMP_poster' id='wp_FMP_poster' size='50' value='<?php echo get_option('wp_FMP_poster') ?>' />
|
664 |
</td>
|
665 |
</tr>
|
666 |
<tr>
|
671 |
<td>
|
672 |
<?php
|
673 |
echo "<input type='checkbox' name='wp_FMP_autohide' id='wp_FMP_autohide' value='use' ";
|
674 |
+
if(get_option('wp_FMP_autohide') == "true") {
|
675 |
echo "checked";
|
676 |
}
|
677 |
echo " />\n";
|
687 |
<td>
|
688 |
<?php
|
689 |
echo "<input type='checkbox' name='wp_FMP_autoplay' id='wp_FMP_autoplay' value='use' ";
|
690 |
+
if(get_option('wp_FMP_autoplay') == "true") {
|
691 |
echo "checked";
|
692 |
}
|
693 |
echo " />\n";
|
703 |
<td>
|
704 |
<?php
|
705 |
echo "<input type='checkbox' name='wp_FMP_loop' id='wp_FMP_loop' value='use' ";
|
706 |
+
if(get_option('wp_FMP_loop') == "true") {
|
707 |
echo "checked";
|
708 |
}
|
709 |
echo " />\n";
|
719 |
<td>
|
720 |
<?php
|
721 |
echo "<input type='checkbox' name='wp_FMP_playbutton' id='wp_FMP_playbutton' value='use' ";
|
722 |
+
if(get_option('wp_FMP_playbutton') == "true") {
|
723 |
echo "checked";
|
724 |
}
|
725 |
echo " />\n";
|
1089 |
|
1090 |
add_shortcode('FMP', 'FMP_shortcode');
|
1091 |
|
1092 |
+
?>
|