MediaElement.js – HTML5 Video & Audio Player - Version 2.1.5

Version Description

None

Download this release

Release Info

Developer johndyer
Plugin Icon 128x128 MediaElement.js – HTML5 Video & Audio Player
Version 2.1.5
Comparing to
See all releases

Code changes from version 2.1.4 to 2.1.5

mediaelement-js-wp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package MediaElementJS
4
- * @version 2.1.4
5
  */
6
 
7
  /*
@@ -9,7 +9,7 @@ Plugin Name: MediaElement.js - HTML5 Audio and Video
9
  Plugin URI: http://mediaelementjs.com/
10
  Description: Video and audio plugin for WordPress built on MediaElement.js HTML5 video and audio player library. Embeds media in your post or page using HTML5 with Flash or Silverlight fallback support for non-HTML5 browsers. Video support: MP4, Ogg, WebM, WMV. Audio support: MP3, WMA, WAV
11
  Author: John Dyer
12
- Version: 2.1.4
13
  Author URI: http://johndyer.me/
14
  License: GPLv3, MIT
15
  */
1
  <?php
2
  /**
3
  * @package MediaElementJS
4
+ * @version 2.1.5
5
  */
6
 
7
  /*
9
  Plugin URI: http://mediaelementjs.com/
10
  Description: Video and audio plugin for WordPress built on MediaElement.js HTML5 video and audio player library. Embeds media in your post or page using HTML5 with Flash or Silverlight fallback support for non-HTML5 browsers. Video support: MP4, Ogg, WebM, WMV. Audio support: MP3, WMA, WAV
11
  Author: John Dyer
12
+ Version: 2.1.5
13
  Author URI: http://johndyer.me/
14
  License: GPLv3, MIT
15
  */
mediaelement/flashmediaelement.swf CHANGED
Binary file
mediaelement/mediaelement-and-player.js CHANGED
@@ -15,7 +15,7 @@
15
  var mejs = mejs || {};
16
 
17
  // version number
18
- mejs.version = '2.1.4';
19
 
20
  // player number (for missing, same id attr)
21
  mejs.meIndex = 0;
@@ -39,7 +39,7 @@ mejs.Utility = {
39
  return encodeURIComponent(url); //.replace(/\?/gi,'%3F').replace(/=/gi,'%3D').replace(/&/gi,'%26');
40
  },
41
  escapeHTML: function(s) {
42
- return s.split('&').join('&amp;').split('<').join('&lt;').split('"').join('&quot;');
43
  },
44
  absolutizeUrl: function(url) {
45
  var el = document.createElement('div');
@@ -1684,12 +1684,14 @@ window.MediaElement = mejs.MediaElement;
1684
  (function($) {
1685
  // current and duration 00:00 / 00:00
1686
  MediaElementPlayer.prototype.buildcurrent = function(player, controls, layers, media) {
 
 
1687
  $('<div class="mejs-time">'+
1688
  '<span class="mejs-currenttime">' + (player.options.alwaysShowHours ? '00:' : '') + '00:00</span>'+
1689
  '</div>')
1690
  .appendTo(controls);
1691
 
1692
- this.currenttime = this.controls.find('.mejs-currenttime');
1693
 
1694
  media.addEventListener('timeupdate',function() {
1695
  player.updateCurrent();
@@ -1697,6 +1699,8 @@ window.MediaElement = mejs.MediaElement;
1697
  };
1698
 
1699
  MediaElementPlayer.prototype.buildduration = function(player, controls, layers, media) {
 
 
1700
  if (controls.children().last().find('.mejs-currenttime').length > 0) {
1701
  $(' <span> | </span> '+
1702
  '<span class="mejs-duration">' + (player.options.alwaysShowHours ? '00:' : '') + '00:00</span>')
@@ -1709,7 +1713,7 @@ window.MediaElement = mejs.MediaElement;
1709
  .appendTo(controls);
1710
  }
1711
 
1712
- this.durationD = this.controls.find('.mejs-duration');
1713
 
1714
  media.addEventListener('timeupdate',function() {
1715
  player.updateDuration();
@@ -1719,13 +1723,15 @@ window.MediaElement = mejs.MediaElement;
1719
  MediaElementPlayer.prototype.updateCurrent = function() {
1720
  var t = this;
1721
 
1722
- t.currenttime.html(mejs.Utility.secondsToTimeCode(t.media.currentTime | 0, t.options.alwaysShowHours || t.media.duration > 3600 ));
 
 
1723
  }
1724
  MediaElementPlayer.prototype.updateDuration = function() {
1725
  var t = this;
1726
 
1727
- if (t.media.duration) {
1728
- this.durationD.html(mejs.Utility.secondsToTimeCode(t.media.duration, t.options.alwaysShowHours));
1729
  }
1730
  };
1731
 
15
  var mejs = mejs || {};
16
 
17
  // version number
18
+ mejs.version = '2.1.5';
19
 
20
  // player number (for missing, same id attr)
21
  mejs.meIndex = 0;
39
  return encodeURIComponent(url); //.replace(/\?/gi,'%3F').replace(/=/gi,'%3D').replace(/&/gi,'%26');
40
  },
41
  escapeHTML: function(s) {
42
+ return s.toString().split('&').join('&amp;').split('<').join('&lt;').split('"').join('&quot;');
43
  },
44
  absolutizeUrl: function(url) {
45
  var el = document.createElement('div');
1684
  (function($) {
1685
  // current and duration 00:00 / 00:00
1686
  MediaElementPlayer.prototype.buildcurrent = function(player, controls, layers, media) {
1687
+ var t = this;
1688
+
1689
  $('<div class="mejs-time">'+
1690
  '<span class="mejs-currenttime">' + (player.options.alwaysShowHours ? '00:' : '') + '00:00</span>'+
1691
  '</div>')
1692
  .appendTo(controls);
1693
 
1694
+ t.currenttime = t.controls.find('.mejs-currenttime');
1695
 
1696
  media.addEventListener('timeupdate',function() {
1697
  player.updateCurrent();
1699
  };
1700
 
1701
  MediaElementPlayer.prototype.buildduration = function(player, controls, layers, media) {
1702
+ var t = this;
1703
+
1704
  if (controls.children().last().find('.mejs-currenttime').length > 0) {
1705
  $(' <span> | </span> '+
1706
  '<span class="mejs-duration">' + (player.options.alwaysShowHours ? '00:' : '') + '00:00</span>')
1713
  .appendTo(controls);
1714
  }
1715
 
1716
+ t.durationD = t.controls.find('.mejs-duration');
1717
 
1718
  media.addEventListener('timeupdate',function() {
1719
  player.updateDuration();
1723
  MediaElementPlayer.prototype.updateCurrent = function() {
1724
  var t = this;
1725
 
1726
+ if (t.currenttime) {
1727
+ t.currenttime.html(mejs.Utility.secondsToTimeCode(t.media.currentTime | 0, t.options.alwaysShowHours || t.media.duration > 3600 ));
1728
+ }
1729
  }
1730
  MediaElementPlayer.prototype.updateDuration = function() {
1731
  var t = this;
1732
 
1733
+ if (t.media.duration && t.durationD) {
1734
+ t.durationD.html(mejs.Utility.secondsToTimeCode(t.media.duration, t.options.alwaysShowHours));
1735
  }
1736
  };
1737
 
mediaelement/mediaelement-and-player.min.js CHANGED
@@ -10,8 +10,8 @@
10
  * Copyright 2010, John Dyer (http://johndyer.me)
11
  * Dual licensed under the MIT or GPL Version 2 licenses.
12
  *
13
- */var mejs=mejs||{};mejs.version="2.1.4";mejs.meIndex=0;mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mpeg"]}]};
14
- mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.split("&").join("&amp;").split("<").join("&lt;").split('"').join("&quot;")},absolutizeUrl:function(a){var b=document.createElement("div");b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>';return b.firstChild.href},getScriptPath:function(a){for(var b=0,c,d="",e="",f,g=document.getElementsByTagName("script");b<g.length;b++){f=g[b].src;for(c=0;c<a.length;c++){e=a[c];if(f.indexOf(e)>-1){d=f.substring(0,
15
  f.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b){a=Math.round(a);var c,d=Math.floor(a/60);if(d>=60){c=Math.floor(d/60);d%=60}c=c===undefined?"00":c>=10?c:"0"+c;d=d>=10?d:"0"+d;a=Math.floor(a%60);a=a>=10?a:"0"+a;return(c>0||b===true?c+":":"")+d+":"+a},timeCodeToSeconds:function(a){a=a.split(":");return a[0]*60*60+a[1]*60+parseFloat(a[2].replace(",","."))}};
16
  mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],f;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
17
  !(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(f=new ActiveXObject(c))e=d(f)}catch(g){}return e}};
@@ -75,8 +75,8 @@ f(document).bind("mouseup",function(){o=false}).bind("mousemove",function(k){if(
75
  c.buffered.end(0)/c.duration;else if(c&&c.bytesTotal!=undefined&&c.bytesTotal>0&&c.bufferedBytes!=undefined)b=c.bufferedBytes/c.bytesTotal;else if(a&&a.lengthComputable&&a.total!=0)b=a.loaded/a.total;if(b!==null){b=Math.min(1,Math.max(0,b));this.loaded.width(this.total.width()*b)}};MediaElementPlayer.prototype.setCurrentRail=function(){if(this.media.currentTime!=undefined&&this.media.duration){var a=this.total.width()*this.media.currentTime/this.media.duration,c=a-this.handle.outerWidth(true)/2;this.current.width(a);
76
  this.handle.css("left",c)}}})(jQuery);
77
  (function(f){MediaElementPlayer.prototype.buildcurrent=function(a,c,b,d){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+"00:00</span></div>").appendTo(c);this.currenttime=this.controls.find(".mejs-currenttime");d.addEventListener("timeupdate",function(){a.updateCurrent()},false)};MediaElementPlayer.prototype.buildduration=function(a,c,b,d){c.children().last().find(".mejs-currenttime").length>0?f(' <span> | </span> <span class="mejs-duration">'+(a.options.alwaysShowHours?
78
- "00:":"")+"00:00</span>").appendTo(c.find(".mejs-time")):f('<div class="mejs-time"><span class="mejs-duration">'+(a.options.alwaysShowHours?"00:":"")+"00:00</span></div>").appendTo(c);this.durationD=this.controls.find(".mejs-duration");d.addEventListener("timeupdate",function(){a.updateDuration()},false)};MediaElementPlayer.prototype.updateCurrent=function(){this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime|0,this.options.alwaysShowHours||this.media.duration>3600))};MediaElementPlayer.prototype.updateDuration=
79
- function(){this.media.duration&&this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours))}})(jQuery);
80
  (function(f){MediaElementPlayer.prototype.buildvolume=function(a,c,b,d){var e=f('<div class="mejs-button mejs-volume-button mejs-mute"><span></span><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></div></div>').appendTo(c);c=e.find(".mejs-volume-slider");var g=e.find(".mejs-volume-total"),h=e.find(".mejs-volume-current"),j=e.find(".mejs-volume-handle"),l=function(i){i=g.height()-g.height()*i;j.css("top",
81
  i-j.height()/2);h.height(g.height()-i+parseInt(g.css("top").replace(/px/,""),10));h.css("top",i)},m=function(i){var k=g.height(),n=g.offset(),q=parseInt(g.css("top").replace(/px/,""),10);i=i.pageY-n.top;n=(k-i)/k;if(i<0)i=0;else if(i>k)i=k;j.css("top",i-j.height()/2+q);h.height(k-i);h.css("top",i+q);if(n==0){d.setMuted(true);e.removeClass("mejs-mute").addClass("mejs-unmute")}else{d.setMuted(false);e.removeClass("mejs-unmute").addClass("mejs-mute")}n=Math.max(0,n);n=Math.min(n,1);d.setVolume(n)},o=
82
  false;c.bind("mousedown",function(i){m(i);o=true;return false});f(document).bind("mouseup",function(){o=false}).bind("mousemove",function(i){o&&m(i)});e.find("span").click(function(){if(d.muted){d.setMuted(false);e.removeClass("mejs-unmute").addClass("mejs-mute");l(1)}else{d.setMuted(true);e.removeClass("mejs-mute").addClass("mejs-unmute");l(0)}});d.addEventListener("volumechange",function(i){o||l(i.target.volume)},true);l(a.options.startVolume);d.setVolume(a.options.startVolume)}})(jQuery);
10
  * Copyright 2010, John Dyer (http://johndyer.me)
11
  * Dual licensed under the MIT or GPL Version 2 licenses.
12
  *
13
+ */var mejs=mejs||{};mejs.version="2.1.5";mejs.meIndex=0;mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mpeg"]}]};
14
+ mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&amp;").split("<").join("&lt;").split('"').join("&quot;")},absolutizeUrl:function(a){var b=document.createElement("div");b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>';return b.firstChild.href},getScriptPath:function(a){for(var b=0,c,d="",e="",f,g=document.getElementsByTagName("script");b<g.length;b++){f=g[b].src;for(c=0;c<a.length;c++){e=a[c];if(f.indexOf(e)>-1){d=f.substring(0,
15
  f.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b){a=Math.round(a);var c,d=Math.floor(a/60);if(d>=60){c=Math.floor(d/60);d%=60}c=c===undefined?"00":c>=10?c:"0"+c;d=d>=10?d:"0"+d;a=Math.floor(a%60);a=a>=10?a:"0"+a;return(c>0||b===true?c+":":"")+d+":"+a},timeCodeToSeconds:function(a){a=a.split(":");return a[0]*60*60+a[1]*60+parseFloat(a[2].replace(",","."))}};
16
  mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],f;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
17
  !(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(f=new ActiveXObject(c))e=d(f)}catch(g){}return e}};
75
  c.buffered.end(0)/c.duration;else if(c&&c.bytesTotal!=undefined&&c.bytesTotal>0&&c.bufferedBytes!=undefined)b=c.bufferedBytes/c.bytesTotal;else if(a&&a.lengthComputable&&a.total!=0)b=a.loaded/a.total;if(b!==null){b=Math.min(1,Math.max(0,b));this.loaded.width(this.total.width()*b)}};MediaElementPlayer.prototype.setCurrentRail=function(){if(this.media.currentTime!=undefined&&this.media.duration){var a=this.total.width()*this.media.currentTime/this.media.duration,c=a-this.handle.outerWidth(true)/2;this.current.width(a);
76
  this.handle.css("left",c)}}})(jQuery);
77
  (function(f){MediaElementPlayer.prototype.buildcurrent=function(a,c,b,d){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+"00:00</span></div>").appendTo(c);this.currenttime=this.controls.find(".mejs-currenttime");d.addEventListener("timeupdate",function(){a.updateCurrent()},false)};MediaElementPlayer.prototype.buildduration=function(a,c,b,d){c.children().last().find(".mejs-currenttime").length>0?f(' <span> | </span> <span class="mejs-duration">'+(a.options.alwaysShowHours?
78
+ "00:":"")+"00:00</span>").appendTo(c.find(".mejs-time")):f('<div class="mejs-time"><span class="mejs-duration">'+(a.options.alwaysShowHours?"00:":"")+"00:00</span></div>").appendTo(c);this.durationD=this.controls.find(".mejs-duration");d.addEventListener("timeupdate",function(){a.updateDuration()},false)};MediaElementPlayer.prototype.updateCurrent=function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime|0,this.options.alwaysShowHours||this.media.duration>
79
+ 3600))};MediaElementPlayer.prototype.updateDuration=function(){this.media.duration&&this.durationD&&this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours))}})(jQuery);
80
  (function(f){MediaElementPlayer.prototype.buildvolume=function(a,c,b,d){var e=f('<div class="mejs-button mejs-volume-button mejs-mute"><span></span><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></div></div>').appendTo(c);c=e.find(".mejs-volume-slider");var g=e.find(".mejs-volume-total"),h=e.find(".mejs-volume-current"),j=e.find(".mejs-volume-handle"),l=function(i){i=g.height()-g.height()*i;j.css("top",
81
  i-j.height()/2);h.height(g.height()-i+parseInt(g.css("top").replace(/px/,""),10));h.css("top",i)},m=function(i){var k=g.height(),n=g.offset(),q=parseInt(g.css("top").replace(/px/,""),10);i=i.pageY-n.top;n=(k-i)/k;if(i<0)i=0;else if(i>k)i=k;j.css("top",i-j.height()/2+q);h.height(k-i);h.css("top",i+q);if(n==0){d.setMuted(true);e.removeClass("mejs-mute").addClass("mejs-unmute")}else{d.setMuted(false);e.removeClass("mejs-unmute").addClass("mejs-mute")}n=Math.max(0,n);n=Math.min(n,1);d.setVolume(n)},o=
82
  false;c.bind("mousedown",function(i){m(i);o=true;return false});f(document).bind("mouseup",function(){o=false}).bind("mousemove",function(i){o&&m(i)});e.find("span").click(function(){if(d.muted){d.setMuted(false);e.removeClass("mejs-unmute").addClass("mejs-mute");l(1)}else{d.setMuted(true);e.removeClass("mejs-mute").addClass("mejs-unmute");l(0)}});d.addEventListener("volumechange",function(i){o||l(i.target.volume)},true);l(a.options.startVolume);d.setVolume(a.options.startVolume)}})(jQuery);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://mediaelementjs.com/
4
  Tags: html5, video, audio, player, flash, mp4, mp3, ogg, webm, wmv, captions, subtitles, websrt, srt, accessible, Silverlight, javascript,
5
  Requires at least: 2.8
6
  Tested up to: 3.1
7
- Stable tag: 2.1.4
8
 
9
  MediaElement.js is an HTML5 video and audio player with Flash fallback and captions. Supports IE, Firefox, Opera, Safari, Chrome and iPhone, iPad, Android.
10
 
@@ -53,7 +53,7 @@ The location of the Theora/Ogg source for the video.
53
  = webm =
54
  The location of the VP8/WebM source for the video.
55
 
56
- [video ogg="http://mysite.com/mymedia.webm"]
57
 
58
  = poster =
59
  The location of the poster frame for the video.
4
  Tags: html5, video, audio, player, flash, mp4, mp3, ogg, webm, wmv, captions, subtitles, websrt, srt, accessible, Silverlight, javascript,
5
  Requires at least: 2.8
6
  Tested up to: 3.1
7
+ Stable tag: 2.1.5
8
 
9
  MediaElement.js is an HTML5 video and audio player with Flash fallback and captions. Supports IE, Firefox, Opera, Safari, Chrome and iPhone, iPad, Android.
10
 
53
  = webm =
54
  The location of the VP8/WebM source for the video.
55
 
56
+ [video webm="http://mysite.com/mymedia.webm"]
57
 
58
  = poster =
59
  The location of the poster frame for the video.