Video Embed & Thumbnail Generator - Version 1.1

Version Description

  • January 8, 2012 =
  • Includes Strobe Media Playback files so Flash Player is now hosted locally, which allows skinning.
  • Added skin with new, more modern looking play button. Upgraders should check the plugin settings for more details.
  • Fixed "Insert into Post" button in "Embed from URL" tab when editor is in HTML view mode. Used to do nothing! Now does something.
  • Added option to override default Mobile/HTML5 encode formats for each video
  • Added check for FFMPEG. Generate & Encode buttons are disabled if FFMPEG isn't found.
Download this release

Release Info

Developer kylegilman
Plugin Icon 128x128 Video Embed & Thumbnail Generator
Version 1.1
Comparing to
See all releases

Code changes from version 1.0.6 to 1.1

expressinstall.swf DELETED
Binary file
flash/StrobeMediaPlayback.swf ADDED
Binary file
flash/expressInstall.swf ADDED
Binary file
flash/skin/images/PlayNormal.png ADDED
Binary file
flash/skin/images/Play_Down.png ADDED
Binary file
flash/skin/images/Play_Over.png ADDED
Binary file
flash/skin/images/backDrop_center.png ADDED
Binary file
flash/skin/kg_skin.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <skin>
2
+ <elements basePath="skin/images/">
3
+ <element id="controlBarBackdrop" src="backDrop_center.png"/>
4
+ <element id = "playButtonOverlayNormal" src = "PlayNormal.png"/>
5
+ <element id = "playButtonOverlayOver" src = "Play_Over.png"/>
6
+ <element id = "playButtonOverlayDown" src = "Play_Down.png"/>
7
+ </elements>
8
+ </skin>
flash/swfobject.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ /* SWFObject v2.2 <http://code.google.com/p/swfobject/>
2
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
3
+ */
4
+ var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
images/AndroidPlay.png CHANGED
Binary file
kg_callffmpeg.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
  $ffmpegPath = $_POST['ffmpeg']."/ffmpeg";
 
4
  $encodeogg = $_POST['encodeogg'];
5
  $encodewebm = $_POST['encodewebm'];
6
  $movieurl = $_POST['movieurl'];
@@ -211,6 +212,7 @@ if ($action == generate || $action == encode ) {
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++; }
@@ -221,19 +223,7 @@ if ($action == generate || $action == encode ) {
221
  else { $embed_display .= "<strong>FFMPEG missing library 'libfaac' or 'libx264' required for iPod encoding. </strong>"; }
222
  }//if iPod file doesn't already exist
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>"; }
234
- }//if ogv doesn't already exist
235
- else { $embed_display .= "<strong>OGG Already Encoded! </strong>"; }
236
- }//if encodeogg is checked
237
 
238
  if ($encodewebm == "true") {
239
  if ( ! file_exists($webmfilepath) || filesize($webmfilepath) < 24576 ) {
@@ -242,11 +232,24 @@ if ($action == generate || $action == encode ) {
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>"; }
246
  }//if webm doesn't already exist
247
  else { $embed_display .= "<strong>WEBM Already Encoded! </strong>"; }
248
  }//if encodewebm is checked
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;
1
  <?php
2
 
3
  $ffmpegPath = $_POST['ffmpeg']."/ffmpeg";
4
+ $encodemobile = $_POST['encodemobile'];
5
  $encodeogg = $_POST['encodeogg'];
6
  $encodewebm = $_POST['encodewebm'];
7
  $movieurl = $_POST['movieurl'];
212
  $ogvfilepath = $encodepath.$moviefilebasename.".ogv";
213
  $webmfilepath = $encodepath.$moviefilebasename.".webm";
214
 
215
+ if ($encodemobile == "true") {
216
  if ( ! file_exists($ipodfilepath) || filesize($webmfilepath) < 24576 ) {
217
  $ipod_movie_height = strval(round(floatval($movie_height) / floatval($movie_width) * 640));
218
  if ($ipod_movie_height % 2 != 0) { $ipod_movie_height++; }
223
  else { $embed_display .= "<strong>FFMPEG missing library 'libfaac' or 'libx264' required for iPod encoding. </strong>"; }
224
  }//if iPod file doesn't already exist
225
  else { $embed_display .= "<strong>Mobile M4V Already Encoded! </strong>"; }
226
+ }//if mobile is checked
 
 
 
 
 
 
 
 
 
 
 
 
227
 
228
  if ($encodewebm == "true") {
229
  if ( ! file_exists($webmfilepath) || filesize($webmfilepath) < 24576 ) {
232
  $ffmpeg_webm_options = ' -ab 128k -b '.$webmbitrate.'k -threads 1 "'.$webmfilepath.'"';
233
  $embed_display .= "<strong> Encoding WEBM... </strong>";
234
  }//if the proper FFMPEG libraries are enabled
235
+ else { $embed_display .= "<strong>FFMPEG missing library 'libvorbis' or 'libvpx' required for WEBM encoding. </strong>"; }
236
  }//if webm doesn't already exist
237
  else { $embed_display .= "<strong>WEBM Already Encoded! </strong>"; }
238
  }//if encodewebm is checked
239
 
240
+ if ($encodeogg == "true") {
241
+ if ( ! file_exists($ogvfilepath) || filesize($webmfilepath) < 24576 ) {
242
+
243
+ if ( strpos($movie_info['configuration'], 'enable-libvorbis') && strpos($movie_info['configuration'], 'enable-libtheora') ) {
244
+ $ogvbitrate = $movie_height * 3;
245
+ $ffmpeg_ogv_options = ' -acodec libvorbis -ab 128k -vcodec libtheora -b '.$ogvbitrate.'k -threads 1 "'.$ogvfilepath.'"';
246
+ $embed_display .= "<strong> Encoding OGV... </strong>";
247
+ }//if the proper FFMPEG libraries are enabled
248
+ else { $embed_display .= "<strong>FFMPEG missing library 'libvorbis' or 'libtheora' required for OGV encoding. </strong>"; }
249
+ }//if ogv doesn't already exist
250
+ else { $embed_display .= "<strong>OGV Already Encoded! </strong>"; }
251
+ }//if encodeogg is checked
252
+
253
 
254
  if ( ! file_exists($ogvfilepath) || ! file_exists($ipodfilepath) || ! file_exists($webmfilepath) ) {
255
  $ffmpeg_options = '-y -i "'.$moviefilepath.'"'.$ffmpeg_ipod_options.$ffmpeg_ogv_options.$ffmpeg_webm_options;
kg_video_plugin.js CHANGED
@@ -19,6 +19,7 @@ if (checked) { document.getElementById('attachments['+postID+'][kgflashmediaplay
19
  function kg_generate_thumb(postID, buttonPushed) {
20
 
21
  var kg_ffmpeg_path = document.getElementById('attachments['+postID+'][kgflashmediaplayer-ffmpeg_path]').value;
 
22
  var kg_encodeogg = document.getElementById('attachments['+postID+'][kgflashmediaplayer-encodeogg]').value;
23
  var kg_encodewebm = document.getElementById('attachments['+postID+'][kgflashmediaplayer-encodewebm]').value;
24
  var kg_plugin_dir = document.getElementById('attachments['+postID+'][kgflashmediaplayer-plugin_dir]').value;
@@ -58,7 +59,7 @@ function kg_generate_thumb(postID, buttonPushed) {
58
  jQuery(encodeplaceholderid).empty();
59
  }
60
 
61
- jQuery.post(kg_plugin_dir + '/kg_callffmpeg.php', { movieurl: attachmentURL, numberofthumbs: howmanythumbs, action: actionName, ffmpeg: kg_ffmpeg_path, encodeogg: kg_encodeogg, encodewebm: kg_encodewebm, uploads_path: kg_upload_dir_path, uploads_url: kg_upload_dir_url, uploads_basedir: kg_upload_dir_basedir, attachmentID: postID, generate_button: buttonPushed, thumbtimecode: specifictimecode, dofirstframe: firstframethumb, poster: posterurl }, function(data) {
62
 
63
  if (buttonPushed != "encode") {
64
  jQuery(thumbnailplaceholderid).empty();
@@ -105,7 +106,5 @@ function kg_insert_shortcode() {
105
  shortcode += ']' + document.getElementById('attachments[singleurl][kgflashmediaplayer-url]').value + '[/FMP] '; }
106
  if (document.getElementById('downloadlink').checked) { shortcode += '<br /><a href="' + document.getElementById("attachments[singleurl][kgflashmediaplayer-url]").value + '">Right-click or ctrl-click this link to download</a>'; }
107
 
108
- parent.tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode);
109
- //Close window
110
- parent.jQuery("#TB_closeWindowButton").click();
111
  }
19
  function kg_generate_thumb(postID, buttonPushed) {
20
 
21
  var kg_ffmpeg_path = document.getElementById('attachments['+postID+'][kgflashmediaplayer-ffmpeg_path]').value;
22
+ var kg_encodemobile = document.getElementById('attachments['+postID+'][kgflashmediaplayer-encodemobile]').value;
23
  var kg_encodeogg = document.getElementById('attachments['+postID+'][kgflashmediaplayer-encodeogg]').value;
24
  var kg_encodewebm = document.getElementById('attachments['+postID+'][kgflashmediaplayer-encodewebm]').value;
25
  var kg_plugin_dir = document.getElementById('attachments['+postID+'][kgflashmediaplayer-plugin_dir]').value;
59
  jQuery(encodeplaceholderid).empty();
60
  }
61
 
62
+ jQuery.post(kg_plugin_dir + '/kg_callffmpeg.php', { movieurl: attachmentURL, numberofthumbs: howmanythumbs, action: actionName, ffmpeg: kg_ffmpeg_path, encodemobile: kg_encodemobile, encodeogg: kg_encodeogg, encodewebm: kg_encodewebm, uploads_path: kg_upload_dir_path, uploads_url: kg_upload_dir_url, uploads_basedir: kg_upload_dir_basedir, attachmentID: postID, generate_button: buttonPushed, thumbtimecode: specifictimecode, dofirstframe: firstframethumb, poster: posterurl }, function(data) {
63
 
64
  if (buttonPushed != "encode") {
65
  jQuery(thumbnailplaceholderid).empty();
106
  shortcode += ']' + document.getElementById('attachments[singleurl][kgflashmediaplayer-url]').value + '[/FMP] '; }
107
  if (document.getElementById('downloadlink').checked) { shortcode += '<br /><a href="' + document.getElementById("attachments[singleurl][kgflashmediaplayer-url]").value + '">Right-click or ctrl-click this link to download</a>'; }
108
 
109
+ parent.send_to_editor(shortcode);
 
 
110
  }
readme.txt CHANGED
@@ -2,26 +2,26 @@
2
  Contributors: kylegilman
3
  Tags: video, html5, shortcode, thumbnail, ffmpeg
4
  Requires at least: 3.0
5
- Tested up to: 3.3
6
- Stable tag: 1.0.6
7
 
8
  Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG for thumbnails and encodes.
9
 
10
  == Description ==
11
 
12
- = A plugin for the Wordpress visual editor to make embedding videos, generating thumbnails, and encoding HTML5-compliant files a little bit easier. =
13
 
14
- The plugin adds several fields to any video attachment in the Media Library:
15
 
16
  The embedded player 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 an HTML5 video element. I highly recommend H.264 video and AAC audio in an MP4 container. If you're encoding with 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>.
17
 
18
  The plugin uses FFMPEG to generate thumbnails and encode HTML5/mobile videos. By default the plugin looks for FFMPEG in `/usr/local/bin` but if FFMPEG is installed in a different place on your server, you can point it to the correct place in the plugin settings.
19
 
20
- If FFMPEG is installed on your server, you can generate thumbnails using either the "Generate" or "Randomize" buttons. 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. If you want really fine control you can enter timecode in the "Thumbnail Timecode" field. Use mm:ss format. If you want even more control 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. The unused thumbnails will be deleted once you click "Insert into Post" or "Save Changes."
21
 
22
  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.
23
 
24
- 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.
25
 
26
  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.
27
 
@@ -29,9 +29,7 @@ Android viewers who don't use Flash will see a play button superimposed on the t
29
 
30
  If you want to make it easier for people to save the video to their computers, you can choose to include a link by checking the "Generate Download Link Below Video" button.
31
 
32
- 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, or maybe it's hosted on another server. Either way, you can use the new tab "Embed from URL" which works much like the 0.2 of this plugin.
33
-
34
- Just enter the Video URL manually, and all other steps are the same as the Media Library options. If the video is in a directory that isn't writable, any encodes you make will go to an "html5encodes" subdirectory in the Wordpress uploads directory.
35
 
36
  = Once you've filled in all your options, click "Insert Flash Media Player" and you'll get a shortcode in the visual editor like this =
37
 
@@ -73,6 +71,14 @@ AddType video/webm .webm`
73
 
74
  == Frequently Asked Questions ==
75
 
 
 
 
 
 
 
 
 
76
  = I'm on shared hosting and can't install software. Does this work without FFMPEG? =
77
 
78
  Some of it will work without FFMPEG. You can generate embed codes 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 generate HTML5 videos. There is no way around this. A program has to read the video files in order to generate the thumbnails, and FFMPEG is the best one I've found to do that.
@@ -80,13 +86,17 @@ Some of it will work without FFMPEG. You can generate embed codes for your video
80
  == Screenshots ==
81
 
82
  1. Thumbnail & Embed Options in the Media Library/Insert Video page.
83
- 2. New "Embed by Url" tab.
84
  3. Shortcode inserted into the post content by the plugin.
85
 
86
  == Changelog ==
87
 
88
- = 1.0.6 - November 6, 2011 =
89
- * Resetting to defaults on the plugin settings page resets to actual values now, instead of undefined constants.
 
 
 
 
90
 
91
  = 1.0.5 - November 6, 2011 =
92
  * Fixed "Embed from URL" thumbnail creation. Generated thumbnails don't disappear anymore.
2
  Contributors: kylegilman
3
  Tags: video, html5, shortcode, thumbnail, ffmpeg
4
  Requires at least: 3.0
5
+ Tested up to: 3.3.1
6
+ Stable tag: 1.1
7
 
8
  Generates thumbnails, HTML5-compliant videos, and embed codes for locally hosted videos. Requires FFMPEG for thumbnails and encodes.
9
 
10
  == Description ==
11
 
12
+ = A plugin to make embedding videos, generating thumbnails, and encoding HTML5-compliant files a little bit easier. =
13
 
14
+ The plugin adds several fields to any video uploaded to the WordPress Media Library. Just choose a few options and click Insert into Post to and you'll get a shortcode in your post that will embed a flexible Flash & HTML5 video player with a preview image into your post.
15
 
16
  The embedded player 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 an HTML5 video element. I highly recommend H.264 video and AAC audio in an MP4 container. If you're encoding with 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>.
17
 
18
  The plugin uses FFMPEG to generate thumbnails and encode HTML5/mobile videos. By default the plugin looks for FFMPEG in `/usr/local/bin` but if FFMPEG is installed in a different place on your server, you can point it to the correct place in the plugin settings.
19
 
20
+ If FFMPEG is installed on your server, you can generate thumbnails using either the "Generate" or "Randomize" buttons. 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. If you want really fine control you can enter timecode in the "Thumbnail Timecode" field. Use mm:ss format. If you want even more control 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 9 at a time). The unused thumbnails will be deleted once you click "Insert into Post" or "Save Changes."
21
 
22
  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.
23
 
24
+ 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), or a Firefox/Chrome-compatible WEBM or OGV video in the same directory as your original file. 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.
25
 
26
  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.
27
 
29
 
30
  If you want to make it easier for people to save the video to their computers, you can choose to include a link by checking the "Generate Download Link Below Video" button.
31
 
32
+ 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, or maybe it's hosted on another server. Either way, you can use the tab "Embed 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. If the video is in a directory that isn't writable, any encodes you make will go to an "html5encodes" subdirectory in the Wordpress uploads directory.
 
 
33
 
34
  = Once you've filled in all your options, click "Insert Flash Media Player" and you'll get a shortcode in the visual editor like this =
35
 
71
 
72
  == Frequently Asked Questions ==
73
 
74
+ = Why doesn't my video play? =
75
+
76
+ 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.
77
+
78
+ = Why doesn't this work with YouTube? =
79
+
80
+ 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.
81
+
82
  = I'm on shared hosting and can't install software. Does this work without FFMPEG? =
83
 
84
  Some of it will work without FFMPEG. You can generate embed codes 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 generate HTML5 videos. There is no way around this. A program has to read the video files in order to generate the thumbnails, and FFMPEG is the best one I've found to do that.
86
  == Screenshots ==
87
 
88
  1. Thumbnail & Embed Options in the Media Library/Insert Video page.
89
+ 2. "Embed by Url" tab.
90
  3. Shortcode inserted into the post content by the plugin.
91
 
92
  == Changelog ==
93
 
94
+ = 1.1 - January 8, 2012 =
95
+ * Includes Strobe Media Playback files so Flash Player is now hosted locally, which allows skinning.
96
+ * Added skin with new, more modern looking play button. Upgraders should check the plugin settings for more details.
97
+ * Fixed "Insert into Post" button in "Embed from URL" tab when editor is in HTML view mode. Used to do nothing! Now does something.
98
+ * Added option to override default Mobile/HTML5 encode formats for each video
99
+ * Added check for FFMPEG. Generate & Encode buttons are disabled if FFMPEG isn't found.
100
 
101
  = 1.0.5 - November 6, 2011 =
102
  * Fixed "Embed from URL" thumbnail creation. Generated thumbnails don't disappear anymore.
screenshot-1.jpg CHANGED
Binary file
screenshot-2.jpg CHANGED
Binary file
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.6
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
 
@@ -21,9 +21,9 @@ You should have received a copy of the GNU General Public License
21
  along with this program; if not, write to the Free Software
22
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
 
24
- 1) Includes Jeroen Wijering's FLV Media Player (Creative Commons "BY-NC-SA" License) v5.1
25
- Website: http://www.jeroenwijering.com/?item=JW_FLV_Player
26
- License: http://creativecommons.org/licenses/by-nc-sa/2.0/
27
  2) Includes Geoff Stearns' SWFObject Javascript Library (MIT License) v2.1
28
  Website: http://code.google.com/p/swfobject/
29
  License: http://www.opensource.org/licenses/mit-license.php
@@ -76,7 +76,7 @@ function video_embed_thumbnail_generator_activate() {
76
 
77
  define("wp_FMP_swfobject_default", "true", true);
78
  define("wp_FMP_flashplayer_default", "<strong>Please upgrade Flash Player</strong> This content is shown when the user does not have a correct Flash Player version installed.", true);
79
- define("wp_FMP_default_width", "480", true);
80
  define("wp_FMP_default_height", "360", true);
81
  define("wp_FMP_default_HTML5", "true", true);
82
  define("wp_FMP_default_controlbar_style", "docked", true);
@@ -85,13 +85,14 @@ function video_embed_thumbnail_generator_activate() {
85
  define("wp_FMP_default_autoplay", "false", true);
86
  define("wp_FMP_default_loop", "false", true);
87
  define("wp_FMP_default_playbutton", "true", true);
88
- define("wp_FMP_default_http_streaming", "false", true);
89
  define("wp_FMP_default_stream_type", "liveOrRecorded", true);
90
  define("wp_FMP_default_scale_mode", "letterbox", true);
91
  define("wp_FMP_default_bgcolor", "", true);
92
  define("wp_FMP_default_configuration", "", true);
93
- define("wp_FMP_default_skin", "", true);
94
  define("wp_FMP_default_ffmpeg", "/usr/local/bin", true);
 
 
95
  define("wp_FMP_default_encodeogg", "false", true);
96
  define("wp_FMP_default_encodewebm", "true", true);
97
 
@@ -106,22 +107,29 @@ function video_embed_thumbnail_generator_activate() {
106
  add_option('wp_FMP_autoplay', wp_FMP_default_autoplay);
107
  add_option('wp_FMP_loop', wp_FMP_default_loop);
108
  add_option('wp_FMP_playbutton', wp_FMP_default_playbutton);
109
- add_option('wp_FMP_http_streaming', wp_FMP_default_http_streaming);
110
  add_option('wp_FMP_stream_type', wp_FMP_default_stream_type);
111
  add_option('wp_FMP_scale_mode', wp_FMP_default_scale_mode);
112
  add_option('wp_FMP_bgcolor', wp_FMP_default_bgcolor);
113
  add_option('wp_FMP_configuration', wp_FMP_default_configuration);
114
  add_option('wp_FMP_skin', wp_FMP_default_skin);
115
  add_option('wp_FMP_ffmpeg', wp_FMP_default_ffmpeg);
 
 
116
  add_option('wp_FMP_encodeogg', wp_FMP_default_encodeogg);
117
  add_option('wp_FMP_encodewebm', wp_FMP_default_encodewebm);
 
 
 
 
 
 
118
  }
119
 
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
  }
127
 
@@ -148,13 +156,9 @@ function FMP_shortcode($atts, $content = ''){
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 {
155
- $video_swf = "http://fpdownload.adobe.com/strobe/FlashMediaPlayback_101.swf";
156
- $minimum_flash = "10.1.0";
157
- }
158
 
159
  $flashvars = "{src:'".urlencode(trim($content))."'";
160
 
@@ -194,7 +198,7 @@ function FMP_shortcode($atts, $content = ''){
194
 
195
  $flashvars .= "}";
196
 
197
- $params = "{allowfullscreen:'true', allowscriptaccess:'always'}";
198
 
199
  if(get_option('wp_FMP_HTML5') == "true") {
200
  include_once dirname( __FILE__ ) .'/mdetect.php';
@@ -275,7 +279,7 @@ function FMP_shortcode($atts, $content = ''){
275
 
276
  if ( in_array($moviefiletype, $flashcompatible) ) {
277
  $code .= "<script type=\"text/javascript\">\n\t";
278
- $code .= "swfobject.embedSWF('".$video_swf."', 'flashcontent".$div_suffix."', '".trim($query_atts['width'])."', '".trim($query_atts['height'])."', '".$minimum_flash."', '".plugins_url("", __FILE__)."/expressinstall.swf', $flashvars, $params)\n";
279
  $code .= "</script>\n";
280
  }
281
 
@@ -291,7 +295,7 @@ function FMPOptionsPage() {
291
 
292
  define("wp_FMP_swfobject_default", "true", true);
293
  define("wp_FMP_flashplayer_default", "<strong>Please upgrade Flash Player</strong> This content is shown when the user does not have a correct Flash Player version installed.", true);
294
- define("wp_FMP_default_width", "480", true);
295
  define("wp_FMP_default_height", "360", true);
296
  define("wp_FMP_default_HTML5", "true", true);
297
  define("wp_FMP_default_controlbar_style", "docked", true);
@@ -300,13 +304,13 @@ function FMPOptionsPage() {
300
  define("wp_FMP_default_autoplay", "false", true);
301
  define("wp_FMP_default_loop", "false", true);
302
  define("wp_FMP_default_playbutton", "true", true);
303
- define("wp_FMP_default_http_streaming", "false", true);
304
  define("wp_FMP_default_stream_type", "liveOrRecorded", true);
305
  define("wp_FMP_default_scale_mode", "letterbox", true);
306
  define("wp_FMP_default_bgcolor", "", true);
307
  define("wp_FMP_default_configuration", "", true);
308
- define("wp_FMP_default_skin", "", true);
309
  define("wp_FMP_default_ffmpeg", "/usr/local/bin", true);
 
310
  define("wp_FMP_default_encodeogg", "false", true);
311
  define("wp_FMP_default_encodewebm", "true", true);
312
 
@@ -322,17 +326,27 @@ function FMPOptionsPage() {
322
  update_option('wp_FMP_autoplay', wp_FMP_default_autoplay);
323
  update_option('wp_FMP_loop', wp_FMP_default_loop);
324
  update_option('wp_FMP_playbutton', wp_FMP_default_playbutton);
325
- update_option('wp_FMP_http_streaming', wp_FMP_default_http_streaming);
326
  update_option('wp_FMP_stream_type', wp_FMP_default_stream_type);
327
  update_option('wp_FMP_scale_mode', wp_FMP_default_scale_mode);
328
  update_option('wp_FMP_bgcolor', wp_FMP_default_bgcolor);
329
  update_option('wp_FMP_configuration', wp_FMP_default_configuration);
330
  update_option('wp_FMP_skin', wp_FMP_default_skin);
331
  update_option('wp_FMP_ffmpeg', wp_FMP_default_ffmpeg);
 
332
  update_option('wp_FMP_encodeogg', wp_FMP_default_encodeogg);
333
- update_option('wp_FMP_encodewebm', wp_FMP_default_encodewebm);
334
-
335
- echo "<div class='updated'><p><strong>Video Embed & Thumbnail Generator plugin reset to default settings</strong></p></div>";
 
 
 
 
 
 
 
 
 
 
336
  }
337
 
338
  if (isset($_POST['wp_FMP_update'])) {
@@ -343,7 +357,7 @@ function FMPOptionsPage() {
343
  $use_autoplay = $_POST[wp_FMP_autoplay];
344
  $use_loop = $_POST[wp_FMP_loop];
345
  $use_playbutton = $_POST[wp_FMP_playbutton];
346
- $use_http_streaming = $_POST[wp_FMP_http_streaming];
347
  $use_encodeogg = $_POST[wp_FMP_encodeogg];
348
  $use_encodewebm = $_POST[wp_FMP_encodewebm];
349
 
@@ -383,11 +397,12 @@ function FMPOptionsPage() {
383
  update_option(wp_FMP_playbutton, "false");
384
  }
385
 
386
- if ($use_http_streaming == 'use') {
387
- update_option(wp_FMP_http_streaming, "true");
 
388
  } else {
389
- update_option(wp_FMP_http_streaming, "false");
390
- }
391
 
392
  if ($use_encodeogg == 'use') {
393
  update_option(wp_FMP_encodeogg, "true");
@@ -401,19 +416,28 @@ function FMPOptionsPage() {
401
  update_option(wp_FMP_encodewebm, "false");
402
  }
403
 
404
- update_option(wp_FMP_width, $_POST[wp_FMP_width]);
405
- update_option(wp_FMP_height, $_POST[wp_FMP_height]);
406
- update_option(wp_FMP_bgcolor, $_POST[wp_FMP_bgcolor]);
407
- update_option(wp_FMP_configuration, $_POST[wp_FMP_configuration]);
408
- update_option(wp_FMP_skin, $_POST[wp_FMP_skin]);
409
- update_option(wp_FMP_flashplayer, $_POST[wp_FMP_flashplayer]);
410
- update_option(wp_FMP_controlbar_style, $_POST[wp_FMP_controlbar_style]);
411
- update_option(wp_FMP_stream_type, $_POST[wp_FMP_stream_type]);
412
- update_option(wp_FMP_scale_mode, $_POST[wp_FMP_scale_mode]);
413
- update_option(wp_FMP_poster, $_POST[wp_FMP_poster]);
414
- update_option(wp_FMP_ffmpeg, $_POST[wp_FMP_ffmpeg]);
415
-
416
  echo "<div class='updated'><p><strong>Video Embed & Thumbnail Generator plugin settings updated</strong></p></div>";
 
 
 
 
 
 
 
 
 
417
  }
418
 
419
  ?>
@@ -461,27 +485,18 @@ function FMPOptionsPage() {
461
  </tr>
462
  <tr>
463
  <th scope="row" valign="top" align="left">
464
- <label>Generate OGV:</label>
465
  </th>
466
  <td width="10"></td>
467
  <td>
468
  <?php
469
- echo "<input type='checkbox' name='wp_FMP_encodeogg' id='wp_FMP_encodeogg' value='use' ";
470
- if(get_option('wp_FMP_encodeogg') == "true") {
471
  echo "checked";
472
  }
473
  echo " />\n";
474
  ?>
475
- Check to generate OGV files when encoding HTML5/Mobile videos.<br />
476
- <small><em>Turned off by default because OGV is becoming obsolete.</em></small>
477
- </td>
478
- </tr>
479
- <tr>
480
- <th scope="row" valign="top" align="left">
481
- <label>Generate WEBM:</label>
482
- </th>
483
- <td width="10"></td>
484
- <td>
485
  <?php
486
  echo "<input type='checkbox' name='wp_FMP_encodewebm' id='wp_FMP_encodewebm' value='use' ";
487
  if(get_option('wp_FMP_encodewebm') == "true") {
@@ -489,25 +504,28 @@ function FMPOptionsPage() {
489
  }
490
  echo " />\n";
491
  ?>
492
- Check to generate WEBM files when encoding HTML5/Mobile videos.<br />
 
 
 
 
 
 
 
 
 
493
  </td>
494
  </tr>
495
  <tr>
496
  <th scope="row" valign="top" align="left">
497
- <label>Enable HTTP Streaming or Flash Access 2.0:</label>
498
  </th>
499
  <td width="10"></td>
500
  <td>
501
- <?php
502
- echo "<input type='checkbox' name='wp_FMP_http_streaming' id='wp_FMP_http_streaming' value='use' ";
503
- if(get_option('wp_FMP_http_streaming') == "true") {
504
- echo "checked";
505
- }
506
- echo " />\n";
507
- ?>
508
- Check to support HTTP Streaming or Flash Access 2.0 (requires Flash Player 10.1)
509
  </td>
510
- </tr>
511
  <tr>
512
  <th scope="row" valign="top" align="left">
513
  <label>Flash Player not installed message:</label>
@@ -525,20 +543,19 @@ function FMPOptionsPage() {
525
  <div style="align:left"><input name="wp_FMP_update" value="Save Changes" type="submit" />&nbsp;&nbsp;&nbsp;<input name="wp_FMP_reset" value="Reset to defaults" type="submit" /></div>
526
  </td>
527
  </tr>
 
 
 
 
528
  <tr>
529
  <th scope="row" valign="top" align="left">
530
- <label>Path to FFMPEG:</label>
531
  </th>
532
  <td width="10"></td>
533
  <td>
534
- <input name="wp_FMP_ffmpeg" id="wp_FMP_ffmpeg" type="text" value="<?php echo get_option('wp_FMP_ffmpeg') ?>" /><br />
535
- <em><small>Don't include trailing slash. Example: /usr/local/bin</small></em>
536
  </td>
537
  </tr>
538
- <tr>
539
- <th colspan="2"><h3>Default argument values</h3></th><td>
540
- </td>
541
- </tr>
542
  <tr>
543
  <th scope="row" valign="top" align="left">
544
  <label>Default max video width:</label>
@@ -557,13 +574,76 @@ function FMPOptionsPage() {
557
  <input name="wp_FMP_height" id="wp_FMP_height" type="text" value="<?php echo get_option('wp_FMP_height') ?>" />
558
  </td>
559
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
560
  <tr>
561
  <th scope="row" valign="top" align="left">
562
  <label>Default background color:</label>
563
  </th>
564
  <td width="10"></td>
565
  <td>
566
- <input name="wp_FMP_bgcolor" id="wp_FMP_bgcolor" type="text" value="<?php echo get_option('wp_FMP_bgcolor') ?>" />
567
  </td>
568
  </tr>
569
  <tr>
@@ -581,7 +661,9 @@ function FMPOptionsPage() {
581
  </th>
582
  <td width="10"></td>
583
  <td>
584
- <input name="wp_FMP_skin" id="wp_FMP_skin" type="text" size="50" value="<?php echo get_option('wp_FMP_skin') ?>" />
 
 
585
  </td>
586
  </tr>
587
  <tr>
@@ -652,42 +734,6 @@ function FMPOptionsPage() {
652
  </select>
653
  </td>
654
  </tr>
655
- <tr>
656
- <th scope="row" valign="top" align="left">
657
- <label>Default controlbar style:</label>
658
- </th>
659
- <td width="10"></td>
660
- <td>
661
- <select name="wp_FMP_controlbar_style" id="wp_FMP_controlbar_style">
662
- <?php
663
- $docked = "";
664
- $floating = "";
665
- $none = "";
666
- if(get_option('wp_FMP_controlbar_style') == "docked") {
667
- $docked = " selected=\"selected\"";
668
- }
669
- if(get_option('wp_FMP_controlbar_style') == "floating") {
670
- $floating = " selected=\"selected\"";
671
- }
672
- if(get_option('wp_FMP_controlbar_style') == "none") {
673
- $none = " selected=\"selected\"";
674
- }
675
- ?>
676
- <option value="docked"<?php echo $docked ?>>docked</option>
677
- <option value="floating"<?php echo $floating ?>>floating</option>
678
- <option value="none"<?php echo $none ?>>none</option>
679
- </select>
680
- </td>
681
- </tr>
682
- <tr>
683
- <th scope="row" valign="top" align="left">
684
- <label>Default poster image:</label>
685
- </th>
686
- <td width="10"></td>
687
- <td>
688
- <input type='text' name='wp_FMP_poster' id='wp_FMP_poster' size='50' value='<?php echo get_option('wp_FMP_poster') ?>' />
689
- </td>
690
- </tr>
691
  <tr>
692
  <th scope="row" valign="top" align="left">
693
  <label>Default autohide behavior:</label>
@@ -704,38 +750,6 @@ function FMPOptionsPage() {
704
  Uncheck if you do not want controlbar to hide when video is playing
705
  </td>
706
  </tr>
707
- <tr>
708
- <th scope="row" valign="top" align="left">
709
- <label>Default autoplay behavior:</label>
710
- </th>
711
- <td width="10"></td>
712
- <td>
713
- <?php
714
- echo "<input type='checkbox' name='wp_FMP_autoplay' id='wp_FMP_autoplay' value='use' ";
715
- if(get_option('wp_FMP_autoplay') == "true") {
716
- echo "checked";
717
- }
718
- echo " />\n";
719
- ?>
720
- Check if you want video to automatically play when loaded
721
- </td>
722
- </tr>
723
- <tr>
724
- <th scope="row" valign="top" align="left">
725
- <label>Default loop behavior:</label>
726
- </th>
727
- <td width="10"></td>
728
- <td>
729
- <?php
730
- echo "<input type='checkbox' name='wp_FMP_loop' id='wp_FMP_loop' value='use' ";
731
- if(get_option('wp_FMP_loop') == "true") {
732
- echo "checked";
733
- }
734
- echo " />\n";
735
- ?>
736
- Check if you want video to loop
737
- </td>
738
- </tr>
739
  <tr>
740
  <th scope="row" valign="top" align="left">
741
  <label>Default play button overlay:</label>
@@ -839,11 +853,20 @@ add_action('save_post', 'kg_addPostSave');
839
  $form_fields["kgflashmediaplayer-ffmpeg_path"]["input"] = "hidden";
840
  $form_fields["kgflashmediaplayer-ffmpeg_path"]["value"] = get_option('wp_FMP_ffmpeg');
841
 
 
 
 
 
 
 
 
842
  $form_fields["kgflashmediaplayer-encodeogg"]["input"] = "hidden";
843
- $form_fields["kgflashmediaplayer-encodeogg"]["value"] = get_option('wp_FMP_encodeogg');
844
 
 
 
845
  $form_fields["kgflashmediaplayer-encodewebm"]["input"] = "hidden";
846
- $form_fields["kgflashmediaplayer-encodewebm"]["value"] = get_option('wp_FMP_encodewebm');
847
 
848
  $form_fields["kgflashmediaplayer-plugin_dir"]["input"] = "hidden";
849
  $form_fields["kgflashmediaplayer-plugin_dir"]["value"] = plugins_url("", __FILE__);
@@ -910,9 +933,24 @@ add_action('save_post', 'kg_addPostSave');
910
  if (get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true) != "") { $numberofthumbs_value = "1"; }
911
  else { $numberofthumbs_value = "4"; }
912
 
913
- $form_fields["generator"]["label"] = __("Thumbnails");
 
 
 
 
 
 
 
 
 
 
914
  $form_fields["generator"]["input"] = "html";
915
- $form_fields["generator"]["html"] = '<div id="attachments_'. $post->ID .'_thumbnailplaceholder">'. $thumbnail_html .'</div><input id="attachments_'. $post->ID .'_numberofthumbs" type="text" value="'.$numberofthumbs_value.'" maxlength="1" size="4" style="width:25px;" title="Number of Thumbnails" onchange="document.getElementById(\'attachments['.$post->ID.'][thumbtime]\').value =\'\';"><input type="button" id="attachments['. $post->ID .'][thumbgenerate]" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kg_generate_thumb('. $post->ID .', \'generate\');"/><input type="button" id="thumbrandomize" class="button-secondary" value="Randomize" name="thumbrandomize" onclick="kg_generate_thumb('. $post->ID .', \'random\');" /> <input type="checkbox" id="attachments_'. $post->ID .'_firstframe"><label for="attachments_'. $post->ID .'_firstframe">Force 1st Frame Thumbnail</label>';
 
 
 
 
 
916
 
917
  $form_fields["thumbtime"]["label"] = __("Thumbnail Timecode");
918
  $form_fields["thumbtime"]["value"] = get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true);
@@ -924,13 +962,32 @@ add_action('save_post', 'kg_addPostSave');
924
 
925
  $form_fields["kgflashmediaplayer-dimensions"]["label"] = __("Video Embed Dimensions");
926
  $form_fields["kgflashmediaplayer-dimensions"]["input"] = "html";
927
- $form_fields["kgflashmediaplayer-dimensions"]["html"] = 'Width: <input name="attachments_'. $post->ID .'_kgflashmediaplayer-width" type="text" value="'.$widthset.'" id="attachments_'. $post->ID .'_kgflashmediaplayer-width" type="text" style="width:50px;" onchange="kg_set_dimension('.$post->ID.', \'height\', this.value);" onkeyup="kg_set_dimension('.$post->ID.', \'height\', this.value);"> Height: <input id="attachments_'. $post->ID .'_kgflashmediaplayer-height" type="text" value="'.$heightset.'" style="width:50px;" onchange="kg_set_dimension('.$post->ID.', \'width\', this.value);" onkeyup="kg_set_dimension('.$post->ID.', \'width\', this.value);"> <input type="checkbox" id="attachments_'. $post->ID .'_kgflashmediaplayer-lockaspect" onclick="kg_set_aspect('.$post->ID.', this.checked);" checked> <label for="attachments_'. $post->ID .'_kgflashmediaplayer-lockaspect"><small>Lock to Aspect Ratio</small></label>';
 
 
 
928
  $form_fields["kgflashmediaplayer-dimensions"]["helps"] = "<small>Leave blank to use <a href='options-general.php?page=video-embed-thumbnail-generator.php' target='_blank'>default dimensions</a>.</small>";
929
 
 
 
 
 
 
 
930
  $form_fields["kgflashmediaplayer-encode"]["label"] = __("HTML5 & Mobile");
931
  $form_fields["kgflashmediaplayer-encode"]["input"] = "html";
932
- $form_fields["kgflashmediaplayer-encode"]["html"] = '<input type="button" id="attachments['. $post->ID .'][kgflasmediaplayer-encode]" name="attachments['. $post->ID .'][kgflasmediaplayer-encode]" class="button-secondary" value="Encode" name="thumbgenerate" onclick="kg_generate_thumb('. $post->ID .', \'encode\');"/><div style="display:inline-block;" id="attachments_'. $post->ID .'_encodeplaceholder"></div>';
933
- $form_fields["kgflashmediaplayer-encode"]["helps"] = "<small>(Experimental) Uses FFMPEG to enocde an H.264/M4V file compatible with most mobile browsers and either a WEBM or OGV depending on <a href='options-general.php?page=video-embed-thumbnail-generator.php' target='_blank'>settings</a>.</small>";
 
 
 
 
 
 
 
 
 
 
934
 
935
  $showtitlechecked = get_post_meta($post->ID, "_kgflashmediaplayer-showtitle", true);
936
  $downloadlinkchecked = get_post_meta($post->ID, "_kgflashmediaplayer-download", true);
@@ -939,7 +996,14 @@ add_action('save_post', 'kg_addPostSave');
939
  else { $embedchecked = "checked"; }
940
  $form_fields["kgflashmediaplayer-options"]["label"] = __("Video Embed Options");
941
  $form_fields["kgflashmediaplayer-options"]["input"] = "html";
942
- $form_fields["kgflashmediaplayer-options"]["html"] = '<input type="checkbox" name="attachments[{$post->ID}][kgflashmediaplayer-showtitle]" id="attachments[{$post->ID}][kgflashmediaplayer-showtitle]" value="checked" onclick="document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-showtitlesave]\').value = this.value;" '.$showtitlechecked.'> <label for="attachments[{$post->ID}][kgflashmediaplayer-showtitle]">Include Title Above Video</label><br /><input type="checkbox" name="attachments[{$post->ID}][kgflashmediaplayer-downloadlink]" id="attachments[{$post->ID}][kgflashmediaplayer-downloadlink]" value="checked" onclick="document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-downloadsave]\').value = this.value;" '.$downloadlinkchecked.'> <label for="attachments[{$post->ID}][kgflashmediaplayer-downloadlink]">Generate Download Link Below Video<em><small>(Makes it easier for users to download video file)</em></small></label><br /><input type="checkbox" name="attachments[{$post->ID}][kgflashmediaplayer-embed]" id="attachments[{$post->ID}][kgflashmediaplayer-embed]" value="checked" onclick="if(this.checked) { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-embedsave]\').value = \'checked\'; } else { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-embedsave]\').value = \'unchecked\'; }"'.$embedchecked.'> <label for="attachments[{$post->ID}][kgflashmediaplayer-embed]">Generate Embed Shortcode <em><small>(Turn off checkbox to use default WordPress video embedding)</small></em></label>';
 
 
 
 
 
 
 
943
 
944
  //$form_fields["kgflashmediaplayer-attachment"]["label"] = __("All Meta");
945
  //$form_fields["kgflashmediaplayer-attachment"]["value"] = get_post_meta($post->ID, "_kgflashmediaplayer-attachment", true);
@@ -979,6 +1043,9 @@ add_action('save_post', 'kg_addPostSave');
979
  if( isset($attachment['kgflashmediaplayer-widthsave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-width', $attachment['kgflashmediaplayer-widthsave']); }
980
  if( isset($attachment['kgflashmediaplayer-heightsave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-height', $attachment['kgflashmediaplayer-heightsave']); }
981
  if( isset($attachment['kgflashmediaplayer-aspect']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-aspect', $attachment['kgflashmediaplayer-aspect']); }
 
 
 
982
  if( isset($attachment['kgflashmediaplayer-embedsave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-embed', $attachment['kgflashmediaplayer-embedsave']); }
983
  if( isset($attachment['kgflashmediaplayer-downloadsave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-download', $attachment['kgflashmediaplayer-downloadsave']); }
984
  if( isset($attachment['kgflashmediaplayer-showtitlesave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', $attachment['kgflashmediaplayer-showtitlesave']); }
@@ -1042,6 +1109,21 @@ return array_merge($tabs, $newtab);
1042
  add_filter('media_upload_tabs', 'kg_embedurl_menu');
1043
 
1044
  function media_embedurl_process() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1045
  media_upload_header();
1046
  ?>
1047
  <form class="media-upload-form type-form validate" id="video-form" enctype="multipart/form-data" method="post" action="">
@@ -1062,7 +1144,11 @@ media_upload_header();
1062
  </tr>
1063
  <tr>
1064
  <th valign="top" scope="row" class="label"><span class="alignleft"><label for="numberofthumbs">Thumbnails</label></span></th>
1065
- <td class="field"><div id="attachments_singleurl_thumbnailplaceholder"></div><input id="attachments_singleurl_numberofthumbs" type="text" value="4" maxlength="2" size="4" style="width:25px;" title="Number of Thumbnails" onchange="document.getElementById('attachments[singleurl][thumbtime]').value='';"><input type="button" id="attachments[singleurl][thumbgenerate]" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kg_generate_thumb('singleurl', 'generate');"/><input type="button" id="thumbrandomize" class="button-secondary" value="Randomize" name="thumbrandomize" onclick="kg_generate_thumb('singleurl', 'random');" /> <input type="checkbox" id="attachments_singleurl_firstframe"><label for="attachments_singleurl_firstframe">Force 1st Frame Thumbnail</label></td>
 
 
 
 
1066
  </tr>
1067
  <tr>
1068
  <th valign="top" scope="row" class="label"><span class="alignleft"><label for="attachments[singleurl][thumbtime]">Thumbnail Timecode</span></label><br class="clear" /></th>
@@ -1079,14 +1165,26 @@ media_upload_header();
1079
  <td class="field">Width: <input name="attachments_singleurl_kgflashmediaplayer-width" type="text" value="" id="attachments_singleurl_kgflashmediaplayer-width" type="text" style="width:50px;" onchange="kg_set_dimension('singleurl', 'height', this.value);" onkeyup="kg_set_dimension('singleurl', 'height', this.value);"> Height: <input id="attachments_singleurl_kgflashmediaplayer-height" type="text" value="" style="width:50px;" onchange="kg_set_dimension('singleurl', 'width', this.value);" onkeyup="kg_set_dimension('singleurl', 'width', this.value);"> <input type="checkbox" id="attachments_singleurl_kgflashmediaplayer-lockaspect" onclick="kg_set_aspect('singleurl', this.checked);" checked> <label for="attachments_singleurl_kgflashmediaplayer-lockaspect"><small>Lock to Aspect Ratio</small></label>
1080
  <p class="help"><small>Leave blank to use <a href="options-general.php?page=video-embed-thumbnail-generator.php" target="_blank">default dimensions</a>.</small></p></td>
1081
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1082
  <tr>
1083
  <th valign="top" scope="row" class="label"><span class="alignleft"><label>Options</span></label></th>
1084
  <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>
1085
  </tr>
1086
- <tr>
1087
- <th valign="top" scope="row" class="label"><span class="alignleft"><label for="html5">HTML5 & Mobile</span></label></th>
1088
- <td><input type="button" id="html5" class="button-secondary" value="Encode" name="html5" onclick="kg_generate_thumb('singleurl', 'encode');" /><div id="attachments_singleurl_encodeplaceholder" name="attachments_singleurl_encodeplaceholder" style="display:inline-block;"></div><br />
1089
- <small>(Experimental) Uses FFMPEG to enocde an H.264/M4V file compatible with most mobile browsers and either a WEBM or OGV depending on <a href='options-general.php?page=video-embed-thumbnail-generator.php' target='_blank'>settings</a>.</small></td>
1090
  <tr class="submit">
1091
  <td></td>
1092
  <td>
@@ -1104,6 +1202,7 @@ $maxwidth = get_option('wp_FMP_width');
1104
  ?>
1105
 
1106
  <input type='hidden' name='attachments[singleurl][kgflashmediaplayer-ffmpeg_path]' id='attachments[singleurl][kgflashmediaplayer-ffmpeg_path]' value='<?php echo get_option('wp_FMP_ffmpeg'); ?>' />
 
1107
  <input type='hidden' name='attachments[singleurl][kgflashmediaplayer-encodeogg]' id='attachments[singleurl][kgflashmediaplayer-encodeogg]' value='<?php echo get_option('wp_FMP_encodeogg'); ?>' />
1108
  <input type='hidden' name='attachments[singleurl][kgflashmediaplayer-encodewebm]' id='attachments[singleurl][kgflashmediaplayer-encodewebm]' value='<?php echo get_option('wp_FMP_encodewebm'); ?>' />
1109
  <input type='hidden' name='attachments[singleurl][kgflashmediaplayer-plugin_dir]' id='attachments[singleurl][kgflashmediaplayer-plugin_dir]' value='<?php echo plugins_url("", __FILE__); ?>' />
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.1
7
  Author: Kyle Gilman
8
  Author URI: http://www.kylegilman.net/
9
 
21
  along with this program; if not, write to the Free Software
22
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
 
24
+ 1) Includes Strobe Media Playback Flash Player
25
+ Website: http://osmf.org/strobe_mediaplayback.html
26
+ License: http://creativecommons.org/licenses/by-nc/3.0/
27
  2) Includes Geoff Stearns' SWFObject Javascript Library (MIT License) v2.1
28
  Website: http://code.google.com/p/swfobject/
29
  License: http://www.opensource.org/licenses/mit-license.php
76
 
77
  define("wp_FMP_swfobject_default", "true", true);
78
  define("wp_FMP_flashplayer_default", "<strong>Please upgrade Flash Player</strong> This content is shown when the user does not have a correct Flash Player version installed.", true);
79
+ define("wp_FMP_default_width", "640", true);
80
  define("wp_FMP_default_height", "360", true);
81
  define("wp_FMP_default_HTML5", "true", true);
82
  define("wp_FMP_default_controlbar_style", "docked", true);
85
  define("wp_FMP_default_autoplay", "false", true);
86
  define("wp_FMP_default_loop", "false", true);
87
  define("wp_FMP_default_playbutton", "true", true);
 
88
  define("wp_FMP_default_stream_type", "liveOrRecorded", true);
89
  define("wp_FMP_default_scale_mode", "letterbox", true);
90
  define("wp_FMP_default_bgcolor", "", true);
91
  define("wp_FMP_default_configuration", "", true);
92
+ define("wp_FMP_default_skin", plugins_url("", __FILE__)."/flash/skin/kg_skin.xml", true);
93
  define("wp_FMP_default_ffmpeg", "/usr/local/bin", true);
94
+ define("wp_FMP_default_ffmpeg_exists", "notchecked", true);
95
+ define("wp_FMP_default_encodemobile", "true", true);
96
  define("wp_FMP_default_encodeogg", "false", true);
97
  define("wp_FMP_default_encodewebm", "true", true);
98
 
107
  add_option('wp_FMP_autoplay', wp_FMP_default_autoplay);
108
  add_option('wp_FMP_loop', wp_FMP_default_loop);
109
  add_option('wp_FMP_playbutton', wp_FMP_default_playbutton);
 
110
  add_option('wp_FMP_stream_type', wp_FMP_default_stream_type);
111
  add_option('wp_FMP_scale_mode', wp_FMP_default_scale_mode);
112
  add_option('wp_FMP_bgcolor', wp_FMP_default_bgcolor);
113
  add_option('wp_FMP_configuration', wp_FMP_default_configuration);
114
  add_option('wp_FMP_skin', wp_FMP_default_skin);
115
  add_option('wp_FMP_ffmpeg', wp_FMP_default_ffmpeg);
116
+ add_option('wp_FMP_ffmpeg_exists', wp_FMP_default_ffmpeg_exists);
117
+ add_option('wp_FMP_encodemobile', wp_FMP_default_encodemobile);
118
  add_option('wp_FMP_encodeogg', wp_FMP_default_encodeogg);
119
  add_option('wp_FMP_encodewebm', wp_FMP_default_encodewebm);
120
+
121
+ exec(get_option('wp_FMP_ffmpeg').'/ffmpeg /dev/null 2>&1', $output, $returnvalue); //attempt to execute FFMPEG
122
+ if ($returnvalue < 126 ) { //if FFMPEG executed
123
+ update_option('wp_FMP_ffmpeg_exists', "true");
124
+ }
125
+ else { update_option('wp_FMP_ffmpeg_exists', "notinstalled"); }
126
  }
127
 
128
  register_activation_hook( __FILE__, 'video_embed_thumbnail_generator_activate' );
129
 
130
  function addSWFObject() {
131
  if(get_option('wp_FMP_swfobject') == "true") {
132
+ echo "\n<script src=\"".plugins_url("", __FILE__)."/flash/swfobject.js\" type=\"text/javascript\"></script>\n";
133
  }
134
  }
135
 
156
 
157
  $div_suffix = substr(uniqid(rand(), true),0,4);
158
 
159
+
160
+ $video_swf = plugins_url('', __FILE__)."/flash/StrobeMediaPlayback.swf";
161
+ $minimum_flash = "10.1.0";
 
 
 
 
162
 
163
  $flashvars = "{src:'".urlencode(trim($content))."'";
164
 
198
 
199
  $flashvars .= "}";
200
 
201
+ $params = "{allowfullscreen:'true', allowscriptaccess:'always', base:'".plugins_url("", __FILE__)."/flash/'}";
202
 
203
  if(get_option('wp_FMP_HTML5') == "true") {
204
  include_once dirname( __FILE__ ) .'/mdetect.php';
279
 
280
  if ( in_array($moviefiletype, $flashcompatible) ) {
281
  $code .= "<script type=\"text/javascript\">\n\t";
282
+ $code .= "swfobject.embedSWF('".$video_swf."', 'flashcontent".$div_suffix."', '".trim($query_atts['width'])."', '".trim($query_atts['height'])."', '".$minimum_flash."', '".plugins_url("", __FILE__)."/flash/expressInstall.swf', $flashvars, $params)\n";
283
  $code .= "</script>\n";
284
  }
285
 
295
 
296
  define("wp_FMP_swfobject_default", "true", true);
297
  define("wp_FMP_flashplayer_default", "<strong>Please upgrade Flash Player</strong> This content is shown when the user does not have a correct Flash Player version installed.", true);
298
+ define("wp_FMP_default_width", "640", true);
299
  define("wp_FMP_default_height", "360", true);
300
  define("wp_FMP_default_HTML5", "true", true);
301
  define("wp_FMP_default_controlbar_style", "docked", true);
304
  define("wp_FMP_default_autoplay", "false", true);
305
  define("wp_FMP_default_loop", "false", true);
306
  define("wp_FMP_default_playbutton", "true", true);
 
307
  define("wp_FMP_default_stream_type", "liveOrRecorded", true);
308
  define("wp_FMP_default_scale_mode", "letterbox", true);
309
  define("wp_FMP_default_bgcolor", "", true);
310
  define("wp_FMP_default_configuration", "", true);
311
+ define("wp_FMP_default_skin", plugins_url("", __FILE__)."/flash/skin/kg_skin.xml", true);
312
  define("wp_FMP_default_ffmpeg", "/usr/local/bin", true);
313
+ define("wp_FMP_default_encodemobile", "true", true);
314
  define("wp_FMP_default_encodeogg", "false", true);
315
  define("wp_FMP_default_encodewebm", "true", true);
316
 
326
  update_option('wp_FMP_autoplay', wp_FMP_default_autoplay);
327
  update_option('wp_FMP_loop', wp_FMP_default_loop);
328
  update_option('wp_FMP_playbutton', wp_FMP_default_playbutton);
 
329
  update_option('wp_FMP_stream_type', wp_FMP_default_stream_type);
330
  update_option('wp_FMP_scale_mode', wp_FMP_default_scale_mode);
331
  update_option('wp_FMP_bgcolor', wp_FMP_default_bgcolor);
332
  update_option('wp_FMP_configuration', wp_FMP_default_configuration);
333
  update_option('wp_FMP_skin', wp_FMP_default_skin);
334
  update_option('wp_FMP_ffmpeg', wp_FMP_default_ffmpeg);
335
+ update_option('wp_FMP_encodemobile', wp_FMP_default_encodemobile);
336
  update_option('wp_FMP_encodeogg', wp_FMP_default_encodeogg);
337
+ update_option('wp_FMP_encodewebm', wp_FMP_default_encodewebm);
338
+
339
+ echo "<div class='updated'><p><strong>Video Embed & Thumbnail Generator plugin reset to default settings</strong></p></div>";
340
+
341
+ exec(get_option('wp_FMP_ffmpeg').'/ffmpeg /dev/null 2>&1', $output, $returnvalue); //attempt to execute FFMPEG
342
+ if ($returnvalue < 126 ) { //if FFMPEG executed
343
+ update_option('wp_FMP_ffmpeg_exists', "true");
344
+ }
345
+ else {
346
+ echo "<div class='error'><p><strong>FFMPEG not found at ".get_option('wp_FMP_ffmpeg').". Embed codes will work, but video thumbnail generation and Mobile/HTML5 encoding will not.</strong></p></div>";
347
+ update_option('wp_FMP_ffmpeg_exists', "notinstalled");
348
+ }
349
+
350
  }
351
 
352
  if (isset($_POST['wp_FMP_update'])) {
357
  $use_autoplay = $_POST[wp_FMP_autoplay];
358
  $use_loop = $_POST[wp_FMP_loop];
359
  $use_playbutton = $_POST[wp_FMP_playbutton];
360
+ $use_encodemobile = $_POST[wp_FMP_encodemobile];
361
  $use_encodeogg = $_POST[wp_FMP_encodeogg];
362
  $use_encodewebm = $_POST[wp_FMP_encodewebm];
363
 
397
  update_option(wp_FMP_playbutton, "false");
398
  }
399
 
400
+
401
+ if ($use_encodemobile == 'use') {
402
+ update_option(wp_FMP_encodemobile, "true");
403
  } else {
404
+ update_option(wp_FMP_encodemobile, "false");
405
+ }
406
 
407
  if ($use_encodeogg == 'use') {
408
  update_option(wp_FMP_encodeogg, "true");
416
  update_option(wp_FMP_encodewebm, "false");
417
  }
418
 
419
+ update_option('wp_FMP_width', $_POST[wp_FMP_width]);
420
+ update_option('wp_FMP_height', $_POST[wp_FMP_height]);
421
+ update_option('wp_FMP_bgcolor', $_POST[wp_FMP_bgcolor]);
422
+ update_option('wp_FMP_configuration', $_POST[wp_FMP_configuration]);
423
+ update_option('wp_FMP_skin', $_POST[wp_FMP_skin]);
424
+ update_option('wp_FMP_flashplayer', $_POST[wp_FMP_flashplayer]);
425
+ update_option('wp_FMP_controlbar_style', $_POST[wp_FMP_controlbar_style]);
426
+ update_option('wp_FMP_stream_type', $_POST[wp_FMP_stream_type]);
427
+ update_option('wp_FMP_scale_mode', $_POST[wp_FMP_scale_mode]);
428
+ update_option('wp_FMP_poster', $_POST[wp_FMP_poster]);
429
+ update_option('wp_FMP_ffmpeg', $_POST[wp_FMP_ffmpeg]);
430
+
431
  echo "<div class='updated'><p><strong>Video Embed & Thumbnail Generator plugin settings updated</strong></p></div>";
432
+
433
+ exec(get_option('wp_FMP_ffmpeg').'/ffmpeg /dev/null 2>&1', $output, $returnvalue); //attempt to execute FFMPEG
434
+ if ($returnvalue < 126 ) { //if FFMPEG executed
435
+ update_option('wp_FMP_ffmpeg_exists', "true");
436
+ }
437
+ else {
438
+ echo "<div class='error'><p><strong>FFMPEG not found at ".get_option('wp_FMP_ffmpeg').". Embed codes will work, but video thumbnail generation and Mobile/HTML5 encoding will not.</strong></p></div>";
439
+ update_option('wp_FMP_ffmpeg_exists', "false");
440
+ }
441
  }
442
 
443
  ?>
485
  </tr>
486
  <tr>
487
  <th scope="row" valign="top" align="left">
488
+ <label>Default Mobile/HTML5 Video Encode Formats:</label>
489
  </th>
490
  <td width="10"></td>
491
  <td>
492
  <?php
493
+ echo "<input type='checkbox' name='wp_FMP_encodemobile' id='wp_FMP_encodemobile' value='use' ";
494
+ if(get_option('wp_FMP_encodemobile') == "true") {
495
  echo "checked";
496
  }
497
  echo " />\n";
498
  ?>
499
+ H264/Mobile <small><em>(iOS, Android, Safari, IE 9)</em></small><br />
 
 
 
 
 
 
 
 
 
500
  <?php
501
  echo "<input type='checkbox' name='wp_FMP_encodewebm' id='wp_FMP_encodewebm' value='use' ";
502
  if(get_option('wp_FMP_encodewebm') == "true") {
504
  }
505
  echo " />\n";
506
  ?>
507
+ WEBM <small><em>(Firefox, Chrome, Android 2.3+, Opera)</em></small><br />
508
+ <?php
509
+ echo "<input type='checkbox' name='wp_FMP_encodeogg' id='wp_FMP_encodeogg' value='use' ";
510
+ if(get_option('wp_FMP_encodeogg') == "true") {
511
+ echo "checked";
512
+ }
513
+ echo " />\n";
514
+ ?>
515
+ OGV <small><em>(Firefox, Chrome, Android 2.3+, Opera)</em></small><br />
516
+ <em>Requires FFMPEG.</em>
517
  </td>
518
  </tr>
519
  <tr>
520
  <th scope="row" valign="top" align="left">
521
+ <label>Path to FFMPEG:</label>
522
  </th>
523
  <td width="10"></td>
524
  <td>
525
+ <input name="wp_FMP_ffmpeg" id="wp_FMP_ffmpeg" type="text" value="<?php echo get_option('wp_FMP_ffmpeg') ?>" /><br />
526
+ <em>Don't include trailing slash. Example: /usr/local/bin</em>
 
 
 
 
 
 
527
  </td>
528
+ </tr>
529
  <tr>
530
  <th scope="row" valign="top" align="left">
531
  <label>Flash Player not installed message:</label>
543
  <div style="align:left"><input name="wp_FMP_update" value="Save Changes" type="submit" />&nbsp;&nbsp;&nbsp;<input name="wp_FMP_reset" value="Reset to defaults" type="submit" /></div>
544
  </td>
545
  </tr>
546
+ <tr>
547
+ <th colspan="2"><h3>Default video playback settings</h3></th><td>
548
+ </td>
549
+ </tr>
550
  <tr>
551
  <th scope="row" valign="top" align="left">
552
+ <label>Default poster image:</label>
553
  </th>
554
  <td width="10"></td>
555
  <td>
556
+ <input type='text' name='wp_FMP_poster' id='wp_FMP_poster' size='50' value='<?php echo get_option('wp_FMP_poster') ?>' />
 
557
  </td>
558
  </tr>
 
 
 
 
559
  <tr>
560
  <th scope="row" valign="top" align="left">
561
  <label>Default max video width:</label>
574
  <input name="wp_FMP_height" id="wp_FMP_height" type="text" value="<?php echo get_option('wp_FMP_height') ?>" />
575
  </td>
576
  </tr>
577
+ <tr>
578
+ <th scope="row" valign="top" align="left">
579
+ <label>Default controlbar style:</label>
580
+ </th>
581
+ <td width="10"></td>
582
+ <td>
583
+ <select name="wp_FMP_controlbar_style" id="wp_FMP_controlbar_style">
584
+ <?php
585
+ $docked = "";
586
+ $floating = "";
587
+ $none = "";
588
+ if(get_option('wp_FMP_controlbar_style') == "docked") {
589
+ $docked = " selected=\"selected\"";
590
+ }
591
+ if(get_option('wp_FMP_controlbar_style') == "floating") {
592
+ $floating = " selected=\"selected\"";
593
+ }
594
+ if(get_option('wp_FMP_controlbar_style') == "none") {
595
+ $none = " selected=\"selected\"";
596
+ }
597
+ ?>
598
+ <option value="docked"<?php echo $docked ?>>docked</option>
599
+ <option value="floating"<?php echo $floating ?>>floating</option>
600
+ <option value="none"<?php echo $none ?>>none</option>
601
+ </select> HTML5 videos only respond to the "none" option.
602
+ </td>
603
+ </tr>
604
+ <tr>
605
+ <th scope="row" valign="top" align="left">
606
+ <label>Default autoplay behavior:</label>
607
+ </th>
608
+ <td width="10"></td>
609
+ <td>
610
+ <?php
611
+ echo "<input type='checkbox' name='wp_FMP_autoplay' id='wp_FMP_autoplay' value='use' ";
612
+ if(get_option('wp_FMP_autoplay') == "true") {
613
+ echo "checked";
614
+ }
615
+ echo " />\n";
616
+ ?>
617
+ Check if you want video to automatically play when loaded
618
+ </td>
619
+ </tr>
620
+ <tr>
621
+ <th scope="row" valign="top" align="left">
622
+ <label>Default loop behavior:</label>
623
+ </th>
624
+ <td width="10"></td>
625
+ <td>
626
+ <?php
627
+ echo "<input type='checkbox' name='wp_FMP_loop' id='wp_FMP_loop' value='use' ";
628
+ if(get_option('wp_FMP_loop') == "true") {
629
+ echo "checked";
630
+ }
631
+ echo " />\n";
632
+ ?>
633
+ Check if you want video to loop
634
+ </td>
635
+ </tr>
636
+ <tr>
637
+ <th colspan="3"><h4>The following options will only affect Flash playback</h4></th><td>
638
+ </td>
639
+ </tr>
640
  <tr>
641
  <th scope="row" valign="top" align="left">
642
  <label>Default background color:</label>
643
  </th>
644
  <td width="10"></td>
645
  <td>
646
+ <input name="wp_FMP_bgcolor" id="wp_FMP_bgcolor" type="text" value="<?php echo get_option('wp_FMP_bgcolor') ?>" /> #rrggbb
647
  </td>
648
  </tr>
649
  <tr>
661
  </th>
662
  <td width="10"></td>
663
  <td>
664
+ <input name="wp_FMP_skin" id="wp_FMP_skin" type="text" size="50" value="<?php echo get_option('wp_FMP_skin') ?>" /><br />
665
+ <em><small>Use <?php echo plugins_url("", __FILE__)."/flash/skin/kg_skin.xml" ?> for a modern, circular play button.<br />
666
+ Leave blank for the older, square play button.</small></em>
667
  </td>
668
  </tr>
669
  <tr>
734
  </select>
735
  </td>
736
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
737
  <tr>
738
  <th scope="row" valign="top" align="left">
739
  <label>Default autohide behavior:</label>
750
  Uncheck if you do not want controlbar to hide when video is playing
751
  </td>
752
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
753
  <tr>
754
  <th scope="row" valign="top" align="left">
755
  <label>Default play button overlay:</label>
853
  $form_fields["kgflashmediaplayer-ffmpeg_path"]["input"] = "hidden";
854
  $form_fields["kgflashmediaplayer-ffmpeg_path"]["value"] = get_option('wp_FMP_ffmpeg');
855
 
856
+ $encodemobileset = get_post_meta($post->ID, "_kgflashmediaplayer-encodemobile", true);
857
+ if ($encodemobileset == "") { $encodemobileset = get_option('wp_FMP_encodemobile'); }
858
+ $form_fields["kgflashmediaplayer-encodemobile"]["input"] = "hidden";
859
+ $form_fields["kgflashmediaplayer-encodemobile"]["value"] = $encodemobileset;
860
+
861
+ $encodeoggset = get_post_meta($post->ID, "_kgflashmediaplayer-encodeogg", true);
862
+ if ($encodeoggset == "") { $encodeoggset = get_option('wp_FMP_encodeogg'); }
863
  $form_fields["kgflashmediaplayer-encodeogg"]["input"] = "hidden";
864
+ $form_fields["kgflashmediaplayer-encodeogg"]["value"] = $encodeoggset;
865
 
866
+ $encodewebmset = get_post_meta($post->ID, "_kgflashmediaplayer-encodewebm", true);
867
+ if ($encodewebmset == "") { $encodewebmset = get_option('wp_FMP_encodewebm'); }
868
  $form_fields["kgflashmediaplayer-encodewebm"]["input"] = "hidden";
869
+ $form_fields["kgflashmediaplayer-encodewebm"]["value"] = $encodewebmset;
870
 
871
  $form_fields["kgflashmediaplayer-plugin_dir"]["input"] = "hidden";
872
  $form_fields["kgflashmediaplayer-plugin_dir"]["value"] = plugins_url("", __FILE__);
933
  if (get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true) != "") { $numberofthumbs_value = "1"; }
934
  else { $numberofthumbs_value = "4"; }
935
 
936
+ if ( get_option('wp_FMP_ffmpeg_exists') == false ) { //make sure the new ffmpeg_exists option exists
937
+ exec(get_option('wp_FMP_ffmpeg').'/ffmpeg /dev/null 2>&1', $output, $returnvalue); //attempt to execute FFMPEG
938
+ if ($returnvalue < 126 ) { //if FFMPEG executed
939
+ add_option('wp_FMP_ffmpeg_exists', "true");
940
+ }
941
+ else { add_option('wp_FMP_ffmpeg_exists', "notinstalled"); }
942
+ }
943
+
944
+ if ( get_option('wp_FMP_ffmpeg_exists') == "notinstalled" ) { $ffmpeg_disabled_text = 'disabled="disabled" title="FFMPEG not found at '.get_option('wp_FMP_ffmpeg').'"'; }
945
+
946
+ $form_fields["generator"]["label"] = __("Thumbnails");
947
  $form_fields["generator"]["input"] = "html";
948
+ $form_fields["generator"]["html"] = '<div id="attachments_'. $post->ID .'_thumbnailplaceholder">'. $thumbnail_html .'</div>
949
+ <input id="attachments_'. $post->ID .'_numberofthumbs" type="text" value="'.$numberofthumbs_value.'" maxlength="1" size="4" style="width:25px;" onchange="document.getElementById(\'attachments['.$post->ID.'][thumbtime]\').value =\'\';" '.$ffmpeg_disabled_text.'/>
950
+ <input type="button" id="attachments['. $post->ID .'][thumbgenerate]" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kg_generate_thumb('. $post->ID .', \'generate\');" '.$ffmpeg_disabled_text.'/>
951
+ <input type="button" id="thumbrandomize" class="button-secondary" value="Randomize" name="thumbrandomize" onclick="kg_generate_thumb('. $post->ID .', \'random\');" '.$ffmpeg_disabled_text.'/>
952
+ <input type="checkbox" id="attachments_'. $post->ID .'_firstframe" onchange="document.getElementById(\'attachments['.$post->ID.'][thumbtime]\').value =\'\';" '.$ffmpeg_disabled_text.'/>
953
+ <label for="attachments_'. $post->ID .'_firstframe">Force 1st Frame Thumbnail</label>';
954
 
955
  $form_fields["thumbtime"]["label"] = __("Thumbnail Timecode");
956
  $form_fields["thumbtime"]["value"] = get_post_meta($post->ID, "_kgflashmediaplayer-thumbtime", true);
962
 
963
  $form_fields["kgflashmediaplayer-dimensions"]["label"] = __("Video Embed Dimensions");
964
  $form_fields["kgflashmediaplayer-dimensions"]["input"] = "html";
965
+ $form_fields["kgflashmediaplayer-dimensions"]["html"] = 'Width: <input name="attachments_'. $post->ID .'_kgflashmediaplayer-width" type="text" value="'.$widthset.'" id="attachments_'. $post->ID .'_kgflashmediaplayer-width" type="text" style="width:50px;" onchange="kg_set_dimension('.$post->ID.', \'height\', this.value);" onkeyup="kg_set_dimension('.$post->ID.', \'height\', this.value);"> Height:
966
+ <input id="attachments_'. $post->ID .'_kgflashmediaplayer-height" type="text" value="'.$heightset.'" style="width:50px;" onchange="kg_set_dimension('.$post->ID.', \'width\', this.value);" onkeyup="kg_set_dimension('.$post->ID.', \'width\', this.value);">
967
+ <input type="checkbox" id="attachments_'. $post->ID .'_kgflashmediaplayer-lockaspect" onclick="kg_set_aspect('.$post->ID.', this.checked);" checked>
968
+ <label for="attachments_'. $post->ID .'_kgflashmediaplayer-lockaspect"><small>Lock to Aspect Ratio</small></label>';
969
  $form_fields["kgflashmediaplayer-dimensions"]["helps"] = "<small>Leave blank to use <a href='options-general.php?page=video-embed-thumbnail-generator.php' target='_blank'>default dimensions</a>.</small>";
970
 
971
+ if ($encodemobileset == "false") { $mobilechecked = ""; }
972
+ else { $mobilechecked = "checked"; }
973
+ if ($encodeoggset == "false") { $oggchecked = ""; }
974
+ else { $oggchecked = "checked"; }
975
+ if ($encodewebmset == "false") { $webmchecked = ""; }
976
+ else { $webmchecked = "checked"; }
977
  $form_fields["kgflashmediaplayer-encode"]["label"] = __("HTML5 & Mobile");
978
  $form_fields["kgflashmediaplayer-encode"]["input"] = "html";
979
+ $form_fields["kgflashmediaplayer-encode"]["html"] = '<input type="button" id="attachments['. $post->ID .'][kgflashmediaplayer-encode]" name="attachments['. $post->ID .'][kgflashmediaplayer-encode]" class="button-secondary" value="Encode" name="thumbgenerate" onclick="kg_generate_thumb('. $post->ID .', \'encode\');" '.$ffmpeg_disabled_text.'/>
980
+
981
+ <input type="checkbox" id="attachments['. $post->ID .'][kgflashmediaplayer-encodemobilecheck]" name="attachments['. $post->ID .'][kgflashmediaplayer-encodemobilecheck]" value="checked" onclick="if(this.checked) { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-encodemobile]\').value = \'true\'; } else { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-encodemobile]\').value = \'false\'; }" '.$mobilechecked.' '.$ffmpeg_disabled_text.'>
982
+ <label for="attachments['. $post->ID .'][kgflashmediaplayer-encodemobilecheck]">Mobile/H.264</label>
983
+
984
+ <input type="checkbox" id="attachments['. $post->ID .'][kgflashmediaplayer-encodewebmcheck]" name="attachments['. $post->ID .'][kgflashmediaplayer-encodewebmcheck]" value="checked" onclick="if(this.checked) { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-encodewebm]\').value = \'true\'; } else { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-encodewebm]\').value = \'false\'; }" '.$webmchecked.' '.$ffmpeg_disabled_text.'>
985
+ <label for="attachments['. $post->ID .'][kgflashmediaplayer-encodewebmcheck]">WEBM</label>
986
+
987
+ <input type="checkbox" id="attachments['. $post->ID .'][kgflashmediaplayer-encodeoggcheck]" name="attachments['. $post->ID .'][kgflashmediaplayer-encodeoggcheck]" value="checked" onclick="if(this.checked) { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-encodeogg]\').value = \'true\'; } else { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-encodeogg]\').value = \'false\'; }" '.$oggchecked.' '.$ffmpeg_disabled_text.'>
988
+ <label for="attachments['. $post->ID .'][kgflashmediaplayer-encodeoggcheck]">OGV</label>
989
+
990
+ <div style="display:inline-block;" id="attachments_'. $post->ID .'_encodeplaceholder"></div><br /><small><em>(Experimental) Generates video files compatible with most mobile & HTML5-compatible browsers.</em></small>';
991
 
992
  $showtitlechecked = get_post_meta($post->ID, "_kgflashmediaplayer-showtitle", true);
993
  $downloadlinkchecked = get_post_meta($post->ID, "_kgflashmediaplayer-download", true);
996
  else { $embedchecked = "checked"; }
997
  $form_fields["kgflashmediaplayer-options"]["label"] = __("Video Embed Options");
998
  $form_fields["kgflashmediaplayer-options"]["input"] = "html";
999
+ $form_fields["kgflashmediaplayer-options"]["html"] = '<input type="checkbox" name="attachments[{$post->ID}][kgflashmediaplayer-showtitle]" id="attachments[{$post->ID}][kgflashmediaplayer-showtitle]" value="checked" onclick="if(this.checked) { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-showtitlesave]\').value = \'checked\'; } else { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-showtitlesave]\').value = \'unchecked\'; }"" '.$showtitlechecked.'>
1000
+ <label for="attachments[{$post->ID}][kgflashmediaplayer-showtitle]">Include Title Above Video</label><br />
1001
+
1002
+ <input type="checkbox" name="attachments[{$post->ID}][kgflashmediaplayer-downloadlink]" id="attachments[{$post->ID}][kgflashmediaplayer-downloadlink]" value="checked" onclick="if(this.checked) { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-downloadsave]\').value = \'checked\'; } else { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-downloadsave]\').value = \'unchecked\'; }" '.$downloadlinkchecked.'>
1003
+ <label for="attachments[{$post->ID}][kgflashmediaplayer-downloadlink]">Generate Download Link Below Video<em><small>(Makes it easier for users to download video file)</em></small></label><br />
1004
+
1005
+ <input type="checkbox" name="attachments[{$post->ID}][kgflashmediaplayer-embed]" id="attachments[{$post->ID}][kgflashmediaplayer-embed]" value="checked" onclick="if(this.checked) { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-embedsave]\').value = \'checked\'; } else { document.getElementById(\'attachments['.$post->ID.'][kgflashmediaplayer-embedsave]\').value = \'unchecked\'; }" '.$embedchecked.'>
1006
+ <label for="attachments[{$post->ID}][kgflashmediaplayer-embed]">Generate Embed Shortcode <em><small>(Turn off checkbox to use default WordPress video embedding)</small></em></label>';
1007
 
1008
  //$form_fields["kgflashmediaplayer-attachment"]["label"] = __("All Meta");
1009
  //$form_fields["kgflashmediaplayer-attachment"]["value"] = get_post_meta($post->ID, "_kgflashmediaplayer-attachment", true);
1043
  if( isset($attachment['kgflashmediaplayer-widthsave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-width', $attachment['kgflashmediaplayer-widthsave']); }
1044
  if( isset($attachment['kgflashmediaplayer-heightsave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-height', $attachment['kgflashmediaplayer-heightsave']); }
1045
  if( isset($attachment['kgflashmediaplayer-aspect']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-aspect', $attachment['kgflashmediaplayer-aspect']); }
1046
+ if( isset($attachment['kgflashmediaplayer-encodemobile']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-encodemobile', $attachment['kgflashmediaplayer-encodemobile']); }
1047
+ if( isset($attachment['kgflashmediaplayer-encodeogg']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-encodeogg', $attachment['kgflashmediaplayer-encodeogg']); }
1048
+ if( isset($attachment['kgflashmediaplayer-encodewebm']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-encodewebm', $attachment['kgflashmediaplayer-encodewebm']); }
1049
  if( isset($attachment['kgflashmediaplayer-embedsave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-embed', $attachment['kgflashmediaplayer-embedsave']); }
1050
  if( isset($attachment['kgflashmediaplayer-downloadsave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-download', $attachment['kgflashmediaplayer-downloadsave']); }
1051
  if( isset($attachment['kgflashmediaplayer-showtitlesave']) ) { update_post_meta($post['ID'], '_kgflashmediaplayer-showtitle', $attachment['kgflashmediaplayer-showtitlesave']); }
1109
  add_filter('media_upload_tabs', 'kg_embedurl_menu');
1110
 
1111
  function media_embedurl_process() {
1112
+
1113
+ if ( get_option('wp_FMP_ffmpeg_exists') == false ) { //make sure the new ffmpeg_exists option exists
1114
+ exec(get_option('wp_FMP_ffmpeg').'/ffmpeg /dev/null 2>&1', $output, $returnvalue); //attempt to execute FFMPEG
1115
+ if ($returnvalue < 126 ) { //if FFMPEG executed
1116
+ add_option('wp_FMP_ffmpeg_exists', "true");
1117
+ }
1118
+ else { add_option('wp_FMP_ffmpeg_exists', "notinstalled"); }
1119
+ }
1120
+
1121
+ if ( get_option('wp_FMP_ffmpeg_exists') == "notinstalled" ) { $ffmpeg_disabled_text = 'disabled="disabled" title="FFMPEG not found at '.get_option('wp_FMP_ffmpeg').'"'; }
1122
+
1123
+ if ( get_option('wp_FMP_encodemobile') == "true" ) { $mobilechecked = "checked"; }
1124
+ if ( get_option('wp_FMP_encodeogg') == "true" ) { $oggchecked = "checked"; }
1125
+ if ( get_option('wp_FMP_encodewebm') == "true" ) { $webmchecked = "checked"; }
1126
+
1127
  media_upload_header();
1128
  ?>
1129
  <form class="media-upload-form type-form validate" id="video-form" enctype="multipart/form-data" method="post" action="">
1144
  </tr>
1145
  <tr>
1146
  <th valign="top" scope="row" class="label"><span class="alignleft"><label for="numberofthumbs">Thumbnails</label></span></th>
1147
+ <td class="field"><div id="attachments_singleurl_thumbnailplaceholder"></div>
1148
+ <input id="attachments_singleurl_numberofthumbs" type="text" value="4" maxlength="2" size="4" style="width:25px;" title="Number of Thumbnails" onchange="document.getElementById('attachments[singleurl][thumbtime]').value='';" <?php echo $ffmpeg_disabled_text; ?> />
1149
+ <input type="button" id="attachments[singleurl][thumbgenerate]" class="button-secondary" value="Generate" name="thumbgenerate" onclick="kg_generate_thumb('singleurl', 'generate');" <?php echo $ffmpeg_disabled_text; ?> />
1150
+ <input type="button" id="thumbrandomize" class="button-secondary" value="Randomize" name="thumbrandomize" onclick="kg_generate_thumb('singleurl', 'random');" <?php echo $ffmpeg_disabled_text; ?> />
1151
+ <input type="checkbox" id="attachments_singleurl_firstframe" onchange="document.getElementById('attachments[singleurl][thumbtime]').value ='';" <?php echo $ffmpeg_disabled_text; ?> /><label for="attachments_singleurl_firstframe">Force 1st Frame Thumbnail</label></td>
1152
  </tr>
1153
  <tr>
1154
  <th valign="top" scope="row" class="label"><span class="alignleft"><label for="attachments[singleurl][thumbtime]">Thumbnail Timecode</span></label><br class="clear" /></th>
1165
  <td class="field">Width: <input name="attachments_singleurl_kgflashmediaplayer-width" type="text" value="" id="attachments_singleurl_kgflashmediaplayer-width" type="text" style="width:50px;" onchange="kg_set_dimension('singleurl', 'height', this.value);" onkeyup="kg_set_dimension('singleurl', 'height', this.value);"> Height: <input id="attachments_singleurl_kgflashmediaplayer-height" type="text" value="" style="width:50px;" onchange="kg_set_dimension('singleurl', 'width', this.value);" onkeyup="kg_set_dimension('singleurl', 'width', this.value);"> <input type="checkbox" id="attachments_singleurl_kgflashmediaplayer-lockaspect" onclick="kg_set_aspect('singleurl', this.checked);" checked> <label for="attachments_singleurl_kgflashmediaplayer-lockaspect"><small>Lock to Aspect Ratio</small></label>
1166
  <p class="help"><small>Leave blank to use <a href="options-general.php?page=video-embed-thumbnail-generator.php" target="_blank">default dimensions</a>.</small></p></td>
1167
  </tr>
1168
+ <tr>
1169
+ <th valign="top" scope="row" class="label"><span class="alignleft"><label for="html5">HTML5 & Mobile</span></label></th>
1170
+ <td><input type="button" id="html5" class="button-secondary" value="Encode" name="html5" onclick="kg_generate_thumb('singleurl', 'encode');" <?php echo $ffmpeg_disabled_text; ?> />
1171
+
1172
+ <input type="checkbox" id="attachments[singleurl][kgflashmediaplayer-encodemobilecheck]" name="attachments[singleurl][kgflashmediaplayer-encodemobilecheck]" value="checked" onclick="if(this.checked) { document.getElementById('attachments[singleurl][kgflashmediaplayer-encodemobile]').value = 'true'; } else { document.getElementById('attachments[singleurl][kgflashmediaplayer-encodemobile]').value = 'false'; }" <?php echo ($mobilechecked." ".$ffmpeg_disabled_text); ?> />
1173
+ <label for="attachments[singleurl][kgflashmediaplayer-encodemobilecheck]">Mobile/H.264</label>
1174
+
1175
+ <input type="checkbox" id="attachments[singleurl][kgflashmediaplayer-encodewebmcheck]" name="attachments[singleurl][kgflashmediaplayer-encodewebmcheck]" value="checked" onclick="if(this.checked) { document.getElementById('attachments[singleurl][kgflashmediaplayer-encodewebm]').value = 'true'; } else { document.getElementById('attachments[singleurl][kgflashmediaplayer-encodewebm]').value = 'false'; }" <?php echo ($webmchecked." ".$ffmpeg_disabled_text); ?> />
1176
+ <label for="attachments[singleurl][kgflashmediaplayer-encodewebmcheck]">WEBM</label>
1177
+
1178
+ <input type="checkbox" id="attachments[singleurl][kgflashmediaplayer-encodeoggcheck]" name="attachments[singleurl][kgflashmediaplayer-encodeoggcheck]" value="checked" onclick="if(this.checked) { document.getElementById('attachments[singleurl][kgflashmediaplayer-encodeogg]').value = 'true'; } else { document.getElementById('attachments[singleurl][kgflashmediaplayer-encodeogg]').value = 'false'; }" <?php echo ($oggchecked." ".$ffmpeg_disabled_text); ?> />
1179
+ <label for="attachments[singleurl][kgflashmediaplayer-encodeoggcheck]">OGV</label>
1180
+
1181
+ <div id="attachments_singleurl_encodeplaceholder" name="attachments_singleurl_encodeplaceholder" style="display:inline-block;"></div><br />
1182
+ <small><em>(Experimental) Generates video files compatible with most mobile & HTML5-compatible browsers.</em></small></td>
1183
+ </tr>
1184
  <tr>
1185
  <th valign="top" scope="row" class="label"><span class="alignleft"><label>Options</span></label></th>
1186
  <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>
1187
  </tr>
 
 
 
 
1188
  <tr class="submit">
1189
  <td></td>
1190
  <td>
1202
  ?>
1203
 
1204
  <input type='hidden' name='attachments[singleurl][kgflashmediaplayer-ffmpeg_path]' id='attachments[singleurl][kgflashmediaplayer-ffmpeg_path]' value='<?php echo get_option('wp_FMP_ffmpeg'); ?>' />
1205
+ <input type='hidden' name='attachments[singleurl][kgflashmediaplayer-encodemobile]' id='attachments[singleurl][kgflashmediaplayer-encodemobile]' value='<?php echo get_option('wp_FMP_encodemobile'); ?>' />
1206
  <input type='hidden' name='attachments[singleurl][kgflashmediaplayer-encodeogg]' id='attachments[singleurl][kgflashmediaplayer-encodeogg]' value='<?php echo get_option('wp_FMP_encodeogg'); ?>' />
1207
  <input type='hidden' name='attachments[singleurl][kgflashmediaplayer-encodewebm]' id='attachments[singleurl][kgflashmediaplayer-encodewebm]' value='<?php echo get_option('wp_FMP_encodewebm'); ?>' />
1208
  <input type='hidden' name='attachments[singleurl][kgflashmediaplayer-plugin_dir]' id='attachments[singleurl][kgflashmediaplayer-plugin_dir]' value='<?php echo plugins_url("", __FILE__); ?>' />