Version Description
- Updated to latest MediaElement.js code
- Changed scripts to use wp_enqueue_script("mediaelementjs-scripts")
- Changed styles to use wp_enqueue_style("mediaelementjs-styles")
- Added [mejsaudio] and [mejsvideo] as valid short codes. Wordpress's Jetpack will now take over [audio]
Download this release
Release Info
Developer | johndyer |
Plugin | MediaElement.js – HTML5 Video & Audio Player |
Version | 2.1.4 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.1.4
- mediaelement-js-wp.php +34 -11
- mediaelement/flashmediaelement.swf +0 -0
- mediaelement/mediaelement-and-player.js +98 -48
- mediaelement/mediaelement-and-player.min.js +40 -38
- mediaelement/silverlightmediaelement.xap +0 -0
- readme.txt +7 -1
mediaelement-js-wp.php
CHANGED
@@ -1,14 +1,15 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package MediaElementJS
|
4 |
-
* @version 2.1.
|
5 |
*/
|
|
|
6 |
/*
|
7 |
-
Plugin Name:
|
8 |
Plugin URI: http://mediaelementjs.com/
|
9 |
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
|
10 |
Author: John Dyer
|
11 |
-
Version: 2.1.
|
12 |
Author URI: http://johndyer.me/
|
13 |
License: GPLv3, MIT
|
14 |
*/
|
@@ -44,7 +45,7 @@ add_action('admin_menu', 'mejs_create_menu');
|
|
44 |
function mejs_create_menu() {
|
45 |
|
46 |
//create new top-level menu
|
47 |
-
add_options_page('MediaElement.js
|
48 |
|
49 |
//call register settings function
|
50 |
add_action( 'admin_init', 'mejs_register_settings' );
|
@@ -130,8 +131,28 @@ function mejs_settings_page() {
|
|
130 |
<?php
|
131 |
}
|
132 |
|
133 |
-
function mejs_add_header(){
|
134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
|
136 |
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
|
137 |
|
@@ -139,6 +160,8 @@ function mejs_add_header(){
|
|
139 |
<link rel="stylesheet" href="{$dir}mediaelementplayer.min.css" type="text/css" />
|
140 |
<script src="{$dir}mediaelement-and-player.min.js" type="text/javascript"></script>
|
141 |
_end_;
|
|
|
|
|
142 |
}
|
143 |
|
144 |
// If this happens in the <head> tag it fails in iOS. Boo.
|
@@ -157,7 +180,6 @@ _end_;
|
|
157 |
*/
|
158 |
}
|
159 |
|
160 |
-
|
161 |
add_action('wp_head','mejs_add_header');
|
162 |
add_action('wp_footer','mejs_add_footer');
|
163 |
|
@@ -260,9 +282,9 @@ function mejs_media_shortcode($tagName, $atts){
|
|
260 |
// CONTROLS
|
261 |
$controls_option = ",features: ['playpause'";
|
262 |
if ($progress == 'true')
|
263 |
-
$controls_option .= ",'progress'";
|
264 |
if ($duration == 'true')
|
265 |
-
$controls_option .= ",'
|
266 |
if ($volume == 'true')
|
267 |
$controls_option .= ",'volume'";
|
268 |
$controls_option .= ",'tracks'";
|
@@ -271,7 +293,7 @@ function mejs_media_shortcode($tagName, $atts){
|
|
271 |
$controls_option .= "]";
|
272 |
|
273 |
|
274 |
-
$
|
275 |
<{$tagName} id="wp_mep_{$mediaElementPlayerIndex}" {$src_attribute} {$type_attribute} {$width_attribute} {$height_attribute} {$poster_attribute} controls="controls" {$preload_attribute} {$autoplay_attribute}>
|
276 |
{$mp4_source}
|
277 |
{$mp3_source}
|
@@ -299,7 +321,7 @@ _end_;
|
|
299 |
|
300 |
$mediaElementPlayerIndex++;
|
301 |
|
302 |
-
return $
|
303 |
}
|
304 |
|
305 |
|
@@ -312,8 +334,9 @@ function mejs_video_shortcode($atts){
|
|
312 |
}
|
313 |
|
314 |
add_shortcode('audio', 'mejs_audio_shortcode');
|
|
|
315 |
add_shortcode('video', 'mejs_video_shortcode');
|
316 |
-
|
317 |
|
318 |
function mejs_init() {
|
319 |
|
1 |
<?php
|
2 |
/**
|
3 |
* @package MediaElementJS
|
4 |
+
* @version 2.1.4
|
5 |
*/
|
6 |
+
|
7 |
/*
|
8 |
+
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 |
*/
|
45 |
function mejs_create_menu() {
|
46 |
|
47 |
//create new top-level menu
|
48 |
+
add_options_page('MediaElement.js', 'MediaElement.js', 'administrator', __FILE__, 'mejs_settings_page');
|
49 |
|
50 |
//call register settings function
|
51 |
add_action( 'admin_init', 'mejs_register_settings' );
|
131 |
<?php
|
132 |
}
|
133 |
|
|
|
134 |
|
135 |
+
define('MEDIAELEMENTJS_DIR', WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/');
|
136 |
+
// Javascript
|
137 |
+
function mejs_add_scripts(){
|
138 |
+
if (!is_admin()){
|
139 |
+
// the scripts
|
140 |
+
wp_enqueue_script("mediaelementjs-scripts", MEDIAELEMENTJS_DIR ."mediaelement-and-player.min.js", array('jquery'), "2.1.3", false);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
add_action('wp_print_scripts', 'mejs_add_scripts');
|
144 |
+
|
145 |
+
// css
|
146 |
+
function mejs_add_styles(){
|
147 |
+
if (!is_admin()){
|
148 |
+
// the style
|
149 |
+
wp_enqueue_style("mediaelementjs-styles", MEDIAELEMENTJS_DIR ."mediaelementplayer.css");
|
150 |
+
}
|
151 |
+
}
|
152 |
+
add_action('wp_print_styles', 'mejs_add_styles');
|
153 |
+
|
154 |
+
function mejs_add_header(){
|
155 |
+
/*
|
156 |
|
157 |
$dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
|
158 |
|
160 |
<link rel="stylesheet" href="{$dir}mediaelementplayer.min.css" type="text/css" />
|
161 |
<script src="{$dir}mediaelement-and-player.min.js" type="text/javascript"></script>
|
162 |
_end_;
|
163 |
+
*/
|
164 |
+
|
165 |
}
|
166 |
|
167 |
// If this happens in the <head> tag it fails in iOS. Boo.
|
180 |
*/
|
181 |
}
|
182 |
|
|
|
183 |
add_action('wp_head','mejs_add_header');
|
184 |
add_action('wp_footer','mejs_add_footer');
|
185 |
|
282 |
// CONTROLS
|
283 |
$controls_option = ",features: ['playpause'";
|
284 |
if ($progress == 'true')
|
285 |
+
$controls_option .= ",'current','progress'";
|
286 |
if ($duration == 'true')
|
287 |
+
$controls_option .= ",'duration'";
|
288 |
if ($volume == 'true')
|
289 |
$controls_option .= ",'volume'";
|
290 |
$controls_option .= ",'tracks'";
|
293 |
$controls_option .= "]";
|
294 |
|
295 |
|
296 |
+
$mediahtml .= <<<_end_
|
297 |
<{$tagName} id="wp_mep_{$mediaElementPlayerIndex}" {$src_attribute} {$type_attribute} {$width_attribute} {$height_attribute} {$poster_attribute} controls="controls" {$preload_attribute} {$autoplay_attribute}>
|
298 |
{$mp4_source}
|
299 |
{$mp3_source}
|
321 |
|
322 |
$mediaElementPlayerIndex++;
|
323 |
|
324 |
+
return $mediahtml;
|
325 |
}
|
326 |
|
327 |
|
334 |
}
|
335 |
|
336 |
add_shortcode('audio', 'mejs_audio_shortcode');
|
337 |
+
add_shortcode('mejsaudio', 'mejs_audio_shortcode');
|
338 |
add_shortcode('video', 'mejs_video_shortcode');
|
339 |
+
add_shortcode('mejsvideo', 'mejs_video_shortcode');
|
340 |
|
341 |
function mejs_init() {
|
342 |
|
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.
|
19 |
|
20 |
// player number (for missing, same id attr)
|
21 |
mejs.meIndex = 0;
|
@@ -70,13 +70,23 @@ mejs.Utility = {
|
|
70 |
}
|
71 |
return path;
|
72 |
},
|
73 |
-
secondsToTimeCode: function(seconds) {
|
74 |
seconds = Math.round(seconds);
|
75 |
-
var
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
minutes = (minutes >= 10) ? minutes : "0" + minutes;
|
77 |
seconds = Math.floor(seconds % 60);
|
78 |
seconds = (seconds >= 10) ? seconds : "0" + seconds;
|
79 |
-
return minutes + ":" + seconds;
|
|
|
|
|
|
|
|
|
80 |
}
|
81 |
};
|
82 |
|
@@ -217,6 +227,10 @@ mejs.MediaFeatures = {
|
|
217 |
if (this.isChrome) {
|
218 |
this.hasNativeFullScreen = false;
|
219 |
}
|
|
|
|
|
|
|
|
|
220 |
}
|
221 |
};
|
222 |
mejs.MediaFeatures.init();
|
@@ -792,6 +806,7 @@ mejs.HtmlMediaElementShim = {
|
|
792 |
'autoplay=' + ((autoplay) ? "true" : "false"),
|
793 |
'preload=' + preload,
|
794 |
'width=' + width,
|
|
|
795 |
'timerrate=' + options.timerRate,
|
796 |
'height=' + height];
|
797 |
|
@@ -946,6 +961,8 @@ window.MediaElement = mejs.MediaElement;
|
|
946 |
loop: false,
|
947 |
// resize to media dimensions
|
948 |
enableAutosize: true,
|
|
|
|
|
949 |
// features to show
|
950 |
features: ['playpause','current','progress','duration','tracks','volume','fullscreen']
|
951 |
};
|
@@ -1171,6 +1188,7 @@ window.MediaElement = mejs.MediaElement;
|
|
1171 |
t['build' + feature](t, t.controls, t.layers, t.media);
|
1172 |
} catch (e) {
|
1173 |
// TODO: report control error
|
|
|
1174 |
}
|
1175 |
}
|
1176 |
}
|
@@ -1231,6 +1249,18 @@ window.MediaElement = mejs.MediaElement;
|
|
1231 |
t.controls.css('visibility','visible');
|
1232 |
}
|
1233 |
}, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1234 |
|
1235 |
|
1236 |
// webkit has trouble doing this without a delay
|
@@ -1265,7 +1295,7 @@ window.MediaElement = mejs.MediaElement;
|
|
1265 |
.width(t.width)
|
1266 |
.height(t.height);
|
1267 |
|
1268 |
-
t.layers.children('
|
1269 |
.width(t.width)
|
1270 |
.height(t.height);
|
1271 |
},
|
@@ -1520,7 +1550,9 @@ window.MediaElement = mejs.MediaElement;
|
|
1520 |
'</div>')
|
1521 |
.appendTo(controls);
|
1522 |
|
1523 |
-
var
|
|
|
|
|
1524 |
loaded = controls.find('.mejs-time-loaded'),
|
1525 |
current = controls.find('.mejs-time-current'),
|
1526 |
handle = controls.find('.mejs-time-handle'),
|
@@ -1583,6 +1615,7 @@ window.MediaElement = mejs.MediaElement;
|
|
1583 |
|
1584 |
// loading
|
1585 |
media.addEventListener('progress', function (e) {
|
|
|
1586 |
player.setCurrentRail(e);
|
1587 |
}, false);
|
1588 |
|
@@ -1591,15 +1624,20 @@ window.MediaElement = mejs.MediaElement;
|
|
1591 |
player.setProgressRail(e);
|
1592 |
player.setCurrentRail(e);
|
1593 |
}, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1594 |
}
|
1595 |
MediaElementPlayer.prototype.setProgressRail = function(e) {
|
1596 |
|
1597 |
var
|
1598 |
t = this,
|
1599 |
target = (e != undefined) ? e.target : t.media,
|
1600 |
-
percent = null
|
1601 |
-
loaded = t.controls.find('.mejs-time-loaded'),
|
1602 |
-
total = t.controls.find('.mejs-time-total');
|
1603 |
|
1604 |
// newest HTML5 spec has buffered array (FF4, Webkit)
|
1605 |
if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
|
@@ -1622,25 +1660,22 @@ window.MediaElement = mejs.MediaElement;
|
|
1622 |
if (percent !== null) {
|
1623 |
percent = Math.min(1, Math.max(0, percent));
|
1624 |
// update loaded bar
|
1625 |
-
loaded.width(total.width() * percent);
|
1626 |
}
|
1627 |
}
|
1628 |
MediaElementPlayer.prototype.setCurrentRail = function() {
|
1629 |
|
1630 |
-
var t = this
|
1631 |
-
handle = t.controls.find('.mejs-time-handle'),
|
1632 |
-
current = t.controls.find('.mejs-time-current'),
|
1633 |
-
total = t.controls.find('.mejs-time-total');
|
1634 |
|
1635 |
if (t.media.currentTime != undefined && t.media.duration) {
|
1636 |
|
1637 |
// update bar and handle
|
1638 |
var
|
1639 |
-
newWidth = total.width() * t.media.currentTime / t.media.duration,
|
1640 |
-
handlePos = newWidth - (handle.outerWidth(true) / 2);
|
1641 |
|
1642 |
-
current.width(newWidth);
|
1643 |
-
handle.css('left', handlePos);
|
1644 |
}
|
1645 |
|
1646 |
}
|
@@ -1650,36 +1685,49 @@ window.MediaElement = mejs.MediaElement;
|
|
1650 |
// current and duration 00:00 / 00:00
|
1651 |
MediaElementPlayer.prototype.buildcurrent = function(player, controls, layers, media) {
|
1652 |
$('<div class="mejs-time">'+
|
1653 |
-
'<span class="mejs-currenttime">00:00</span>'+
|
1654 |
'</div>')
|
1655 |
.appendTo(controls);
|
|
|
|
|
1656 |
|
1657 |
media.addEventListener('timeupdate',function() {
|
1658 |
-
|
1659 |
-
controls.find('.mejs-currenttime').html(mejs.Utility.secondsToTimeCode(media.currentTime));
|
1660 |
-
}
|
1661 |
}, false);
|
1662 |
};
|
1663 |
|
1664 |
MediaElementPlayer.prototype.buildduration = function(player, controls, layers, media) {
|
1665 |
if (controls.children().last().find('.mejs-currenttime').length > 0) {
|
1666 |
$(' <span> | </span> '+
|
1667 |
-
'<span class="mejs-duration">00:00</span>')
|
1668 |
.appendTo(controls.find('.mejs-time'));
|
1669 |
} else {
|
1670 |
|
1671 |
$('<div class="mejs-time">'+
|
1672 |
-
'<span class="mejs-duration">00:00</span>'+
|
1673 |
'</div>')
|
1674 |
.appendTo(controls);
|
1675 |
}
|
|
|
|
|
1676 |
|
1677 |
media.addEventListener('timeupdate',function() {
|
1678 |
-
|
1679 |
-
controls.find('.mejs-duration').html(mejs.Utility.secondsToTimeCode(media.duration));
|
1680 |
-
}
|
1681 |
}, false);
|
1682 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1683 |
|
1684 |
})(jQuery);
|
1685 |
(function($) {
|
@@ -2030,7 +2078,7 @@ window.MediaElement = mejs.MediaElement;
|
|
2030 |
});
|
2031 |
|
2032 |
// check for autoplay
|
2033 |
-
if (
|
2034 |
player.chapters.css('visibility','hidden');
|
2035 |
}
|
2036 |
|
@@ -2104,7 +2152,7 @@ window.MediaElement = mejs.MediaElement;
|
|
2104 |
if (track.isTranslation) {
|
2105 |
|
2106 |
// translate the first track
|
2107 |
-
mejs.
|
2108 |
|
2109 |
// store the new translation
|
2110 |
track.entries = newOne;
|
@@ -2118,7 +2166,7 @@ window.MediaElement = mejs.MediaElement;
|
|
2118 |
success: function(d) {
|
2119 |
|
2120 |
// parse the loaded file
|
2121 |
-
track.entries = mejs.
|
2122 |
after();
|
2123 |
|
2124 |
if (track.kind == 'chapters' && t.media.duration > 0) {
|
@@ -2323,7 +2371,10 @@ window.MediaElement = mejs.MediaElement;
|
|
2323 |
};
|
2324 |
|
2325 |
/*
|
2326 |
-
Parses
|
|
|
|
|
|
|
2327 |
1
|
2328 |
00:00:01,1 --> 00:00:05,000
|
2329 |
A line of text
|
@@ -2331,25 +2382,24 @@ window.MediaElement = mejs.MediaElement;
|
|
2331 |
2
|
2332 |
00:01:15,1 --> 00:02:05,000
|
2333 |
A second line of text
|
|
|
|
|
2334 |
|
2335 |
Adapted from: http://www.delphiki.com/html5/playr
|
2336 |
*/
|
2337 |
-
mejs.
|
2338 |
pattern_identifier: /^[0-9]+$/,
|
2339 |
pattern_timecode: /^([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{3})?)(.*)$/,
|
2340 |
-
|
2341 |
-
var tab = timecode.split(':');
|
2342 |
-
return tab[0]*60*60 + tab[1]*60 + parseFloat(tab[2].replace(',','.'));
|
2343 |
-
},
|
2344 |
split2: function (text, regex) {
|
2345 |
// normal version for compliant browsers
|
2346 |
// see below for IE fix
|
2347 |
return text.split(regex);
|
2348 |
},
|
2349 |
-
parse: function(
|
2350 |
var
|
2351 |
i = 0,
|
2352 |
-
lines = this.split2(
|
2353 |
entries = {text:[], times:[]},
|
2354 |
timecode,
|
2355 |
text;
|
@@ -2374,8 +2424,8 @@ window.MediaElement = mejs.MediaElement;
|
|
2374 |
entries.text.push(text);
|
2375 |
entries.times.push(
|
2376 |
{
|
2377 |
-
start:
|
2378 |
-
stop:
|
2379 |
settings: timecode[5]
|
2380 |
});
|
2381 |
}
|
@@ -2385,26 +2435,26 @@ window.MediaElement = mejs.MediaElement;
|
|
2385 |
return entries;
|
2386 |
},
|
2387 |
|
2388 |
-
|
2389 |
|
2390 |
var
|
2391 |
entries = {text:[], times:[]},
|
2392 |
lines,
|
2393 |
i
|
2394 |
|
2395 |
-
this.translateText(
|
2396 |
// split on separators
|
2397 |
lines = result.split('<a></a>');
|
2398 |
|
2399 |
// create new entries
|
2400 |
-
for (i=0;i<
|
2401 |
// add translated line
|
2402 |
entries.text[i] = lines[i];
|
2403 |
// copy existing times
|
2404 |
entries.times[i] = {
|
2405 |
-
start:
|
2406 |
-
stop:
|
2407 |
-
settings:
|
2408 |
};
|
2409 |
}
|
2410 |
|
@@ -2423,7 +2473,7 @@ window.MediaElement = mejs.MediaElement;
|
|
2423 |
nextChunk= function() {
|
2424 |
if (chunks.length > 0) {
|
2425 |
chunk = chunks.shift();
|
2426 |
-
mejs.
|
2427 |
if (r != 'undefined') {
|
2428 |
result += r;
|
2429 |
}
|
@@ -2477,7 +2527,7 @@ window.MediaElement = mejs.MediaElement;
|
|
2477 |
// test for browsers with bad String.split method.
|
2478 |
if ('x\n\ny'.split(/\n/gi).length != 3) {
|
2479 |
// add super slow IE8 and below version
|
2480 |
-
mejs.
|
2481 |
var
|
2482 |
parts = [],
|
2483 |
chunk = '',
|
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;
|
70 |
}
|
71 |
return path;
|
72 |
},
|
73 |
+
secondsToTimeCode: function(seconds,forceHours) {
|
74 |
seconds = Math.round(seconds);
|
75 |
+
var hours,
|
76 |
+
minutes = Math.floor(seconds / 60);
|
77 |
+
if (minutes >= 60) {
|
78 |
+
hours = Math.floor(minutes / 60);
|
79 |
+
minutes = minutes % 60;
|
80 |
+
}
|
81 |
+
hours = hours === undefined ? "00" : (hours >= 10) ? hours : "0" + hours;
|
82 |
minutes = (minutes >= 10) ? minutes : "0" + minutes;
|
83 |
seconds = Math.floor(seconds % 60);
|
84 |
seconds = (seconds >= 10) ? seconds : "0" + seconds;
|
85 |
+
return ((hours > 0 || forceHours === true) ? hours + ":" :'') + minutes + ":" + seconds;
|
86 |
+
},
|
87 |
+
timeCodeToSeconds: function(timecode){
|
88 |
+
var tab = timecode.split(':');
|
89 |
+
return tab[0]*60*60 + tab[1]*60 + parseFloat(tab[2].replace(',','.'));
|
90 |
}
|
91 |
};
|
92 |
|
227 |
if (this.isChrome) {
|
228 |
this.hasNativeFullScreen = false;
|
229 |
}
|
230 |
+
// OS X 10.5 can't do this even if it says it can :(
|
231 |
+
if (this.hasNativeFullScreen && ua.match(/mac os x 10_5/i)) {
|
232 |
+
this.hasNativeFullScreen = false;
|
233 |
+
}
|
234 |
}
|
235 |
};
|
236 |
mejs.MediaFeatures.init();
|
806 |
'autoplay=' + ((autoplay) ? "true" : "false"),
|
807 |
'preload=' + preload,
|
808 |
'width=' + width,
|
809 |
+
'startvolume=' + options.startVolume,
|
810 |
'timerrate=' + options.timerRate,
|
811 |
'height=' + height];
|
812 |
|
961 |
loop: false,
|
962 |
// resize to media dimensions
|
963 |
enableAutosize: true,
|
964 |
+
// forces the hour marker (##:00:00)
|
965 |
+
alwaysShowHours: false,
|
966 |
// features to show
|
967 |
features: ['playpause','current','progress','duration','tracks','volume','fullscreen']
|
968 |
};
|
1188 |
t['build' + feature](t, t.controls, t.layers, t.media);
|
1189 |
} catch (e) {
|
1190 |
// TODO: report control error
|
1191 |
+
//throw e;
|
1192 |
}
|
1193 |
}
|
1194 |
}
|
1249 |
t.controls.css('visibility','visible');
|
1250 |
}
|
1251 |
}, true);
|
1252 |
+
|
1253 |
+
// resize on the first play
|
1254 |
+
t.media.addEventListener('loadedmetadata', function(e) {
|
1255 |
+
if (t.updateDuration) {
|
1256 |
+
t.updateDuration();
|
1257 |
+
}
|
1258 |
+
if (t.updateCurrent) {
|
1259 |
+
t.updateCurrent();
|
1260 |
+
}
|
1261 |
+
|
1262 |
+
t.setControlsSize();
|
1263 |
+
}, true);
|
1264 |
|
1265 |
|
1266 |
// webkit has trouble doing this without a delay
|
1295 |
.width(t.width)
|
1296 |
.height(t.height);
|
1297 |
|
1298 |
+
t.layers.children('.mejs-layer')
|
1299 |
.width(t.width)
|
1300 |
.height(t.height);
|
1301 |
},
|
1550 |
'</div>')
|
1551 |
.appendTo(controls);
|
1552 |
|
1553 |
+
var
|
1554 |
+
t = this,
|
1555 |
+
total = controls.find('.mejs-time-total'),
|
1556 |
loaded = controls.find('.mejs-time-loaded'),
|
1557 |
current = controls.find('.mejs-time-current'),
|
1558 |
handle = controls.find('.mejs-time-handle'),
|
1615 |
|
1616 |
// loading
|
1617 |
media.addEventListener('progress', function (e) {
|
1618 |
+
player.setProgressRail(e);
|
1619 |
player.setCurrentRail(e);
|
1620 |
}, false);
|
1621 |
|
1624 |
player.setProgressRail(e);
|
1625 |
player.setCurrentRail(e);
|
1626 |
}, false);
|
1627 |
+
|
1628 |
+
|
1629 |
+
// store for later use
|
1630 |
+
t.loaded = loaded;
|
1631 |
+
t.total = total;
|
1632 |
+
t.current = current;
|
1633 |
+
t.handle = handle;
|
1634 |
}
|
1635 |
MediaElementPlayer.prototype.setProgressRail = function(e) {
|
1636 |
|
1637 |
var
|
1638 |
t = this,
|
1639 |
target = (e != undefined) ? e.target : t.media,
|
1640 |
+
percent = null;
|
|
|
|
|
1641 |
|
1642 |
// newest HTML5 spec has buffered array (FF4, Webkit)
|
1643 |
if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
|
1660 |
if (percent !== null) {
|
1661 |
percent = Math.min(1, Math.max(0, percent));
|
1662 |
// update loaded bar
|
1663 |
+
t.loaded.width(t.total.width() * percent);
|
1664 |
}
|
1665 |
}
|
1666 |
MediaElementPlayer.prototype.setCurrentRail = function() {
|
1667 |
|
1668 |
+
var t = this;
|
|
|
|
|
|
|
1669 |
|
1670 |
if (t.media.currentTime != undefined && t.media.duration) {
|
1671 |
|
1672 |
// update bar and handle
|
1673 |
var
|
1674 |
+
newWidth = t.total.width() * t.media.currentTime / t.media.duration,
|
1675 |
+
handlePos = newWidth - (t.handle.outerWidth(true) / 2);
|
1676 |
|
1677 |
+
t.current.width(newWidth);
|
1678 |
+
t.handle.css('left', handlePos);
|
1679 |
}
|
1680 |
|
1681 |
}
|
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();
|
|
|
|
|
1696 |
}, false);
|
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>')
|
1703 |
.appendTo(controls.find('.mejs-time'));
|
1704 |
} else {
|
1705 |
|
1706 |
$('<div class="mejs-time">'+
|
1707 |
+
'<span class="mejs-duration">' + (player.options.alwaysShowHours ? '00:' : '') + '00:00</span>'+
|
1708 |
'</div>')
|
1709 |
.appendTo(controls);
|
1710 |
}
|
1711 |
+
|
1712 |
+
this.durationD = this.controls.find('.mejs-duration');
|
1713 |
|
1714 |
media.addEventListener('timeupdate',function() {
|
1715 |
+
player.updateDuration();
|
|
|
|
|
1716 |
}, false);
|
1717 |
};
|
1718 |
+
|
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 |
|
1732 |
})(jQuery);
|
1733 |
(function($) {
|
2078 |
});
|
2079 |
|
2080 |
// check for autoplay
|
2081 |
+
if (player.node.getAttribute('autoplay') !== null) {
|
2082 |
player.chapters.css('visibility','hidden');
|
2083 |
}
|
2084 |
|
2152 |
if (track.isTranslation) {
|
2153 |
|
2154 |
// translate the first track
|
2155 |
+
mejs.TrackFormatParser.translateTrackText(t.tracks[0].entries, t.tracks[0].srclang, track.srclang, t.options.googleApiKey, function(newOne) {
|
2156 |
|
2157 |
// store the new translation
|
2158 |
track.entries = newOne;
|
2166 |
success: function(d) {
|
2167 |
|
2168 |
// parse the loaded file
|
2169 |
+
track.entries = mejs.TrackFormatParser.parse(d);
|
2170 |
after();
|
2171 |
|
2172 |
if (track.kind == 'chapters' && t.media.duration > 0) {
|
2371 |
};
|
2372 |
|
2373 |
/*
|
2374 |
+
Parses WebVVT format which should be formatted as
|
2375 |
+
================================
|
2376 |
+
WEBVTT
|
2377 |
+
|
2378 |
1
|
2379 |
00:00:01,1 --> 00:00:05,000
|
2380 |
A line of text
|
2382 |
2
|
2383 |
00:01:15,1 --> 00:02:05,000
|
2384 |
A second line of text
|
2385 |
+
|
2386 |
+
===============================
|
2387 |
|
2388 |
Adapted from: http://www.delphiki.com/html5/playr
|
2389 |
*/
|
2390 |
+
mejs.TrackFormatParser = {
|
2391 |
pattern_identifier: /^[0-9]+$/,
|
2392 |
pattern_timecode: /^([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{3})?)(.*)$/,
|
2393 |
+
|
|
|
|
|
|
|
2394 |
split2: function (text, regex) {
|
2395 |
// normal version for compliant browsers
|
2396 |
// see below for IE fix
|
2397 |
return text.split(regex);
|
2398 |
},
|
2399 |
+
parse: function(trackText) {
|
2400 |
var
|
2401 |
i = 0,
|
2402 |
+
lines = this.split2(trackText, /\r?\n/),
|
2403 |
entries = {text:[], times:[]},
|
2404 |
timecode,
|
2405 |
text;
|
2424 |
entries.text.push(text);
|
2425 |
entries.times.push(
|
2426 |
{
|
2427 |
+
start: mejs.Utility.timeCodeToSeconds(timecode[1]),
|
2428 |
+
stop: mejs.Utility.timeCodeToSeconds(timecode[3]),
|
2429 |
settings: timecode[5]
|
2430 |
});
|
2431 |
}
|
2435 |
return entries;
|
2436 |
},
|
2437 |
|
2438 |
+
translateTrackText: function(trackData, fromLang, toLang, googleApiKey, callback) {
|
2439 |
|
2440 |
var
|
2441 |
entries = {text:[], times:[]},
|
2442 |
lines,
|
2443 |
i
|
2444 |
|
2445 |
+
this.translateText( trackData.text.join(' <a></a>'), fromLang, toLang, googleApiKey, function(result) {
|
2446 |
// split on separators
|
2447 |
lines = result.split('<a></a>');
|
2448 |
|
2449 |
// create new entries
|
2450 |
+
for (i=0;i<trackData.text.length; i++) {
|
2451 |
// add translated line
|
2452 |
entries.text[i] = lines[i];
|
2453 |
// copy existing times
|
2454 |
entries.times[i] = {
|
2455 |
+
start: trackData.times[i].start,
|
2456 |
+
stop: trackData.times[i].stop,
|
2457 |
+
settings: trackData.times[i].settings
|
2458 |
};
|
2459 |
}
|
2460 |
|
2473 |
nextChunk= function() {
|
2474 |
if (chunks.length > 0) {
|
2475 |
chunk = chunks.shift();
|
2476 |
+
mejs.TrackFormatParser.translateChunk(chunk, fromLang, toLang, googleApiKey, function(r) {
|
2477 |
if (r != 'undefined') {
|
2478 |
result += r;
|
2479 |
}
|
2527 |
// test for browsers with bad String.split method.
|
2528 |
if ('x\n\ny'.split(/\n/gi).length != 3) {
|
2529 |
// add super slow IE8 and below version
|
2530 |
+
mejs.TrackFormatParser.split2 = function(text, regex) {
|
2531 |
var
|
2532 |
parts = [],
|
2533 |
chunk = '',
|
mediaelement/mediaelement-and-player.min.js
CHANGED
@@ -10,17 +10,17 @@
|
|
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.
|
14 |
mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.split("&").join("&").split("<").join("<").split('"').join(""")},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){a=Math.round(a);var
|
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}};
|
18 |
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
|
19 |
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,f,g){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[f]+=g;e[f]-=g};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
|
20 |
if(mejs.PluginDetector.ua.match(/android 2\.[12]/)!==null)HTMLMediaElement.canPlayType=function(a){return a.match(/video\/(mp4|m4v)/gi)!==null?"probably":""};
|
21 |
mejs.MediaFeatures={init:function(){var a=mejs.PluginDetector.nav,b=mejs.PluginDetector.ua.toLowerCase(),c,d=["source","track","audio","video"];this.isiPad=b.match(/ipad/i)!==null;this.isiPhone=b.match(/iphone/i)!==null;this.isAndroid=b.match(/android/i)!==null;this.isIE=a.appName.toLowerCase().indexOf("microsoft")!=-1;this.isChrome=b.match(/chrome/gi)!==null;for(a=0;a<d.length;a++)c=document.createElement(d[a]);this.hasNativeFullScreen=typeof c.webkitEnterFullScreen!=="undefined";if(this.isChrome)this.hasNativeFullScreen=
|
22 |
-
false
|
23 |
-
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={}};
|
24 |
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginApi.loadMedia();this.paused=false}},pause:function(){if(this.pluginApi!=null){this.pluginApi.pauseMedia();this.paused=
|
25 |
true}},stop:function(){if(this.pluginApi!=null){this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return true}return false},setSrc:function(a){if(typeof a=="string"){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a));this.src=mejs.Utility.absolutizeUrl(a)}else{var b,c;for(b=0;b<a.length;b++){c=
|
26 |
a[b];if(this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src));this.src=mejs.Utility.absolutizeUrl(a)}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){this.pluginApi.setMuted(a);this.muted=a}},setVideoSize:function(a,b){if(this.pluginElement.style){this.pluginElement.style.width=
|
@@ -36,7 +36,7 @@ url:null});else if(h!="undefined"&&h!==null){g=this.checkType(h,a.getAttribute("
|
|
36 |
"native";k.url=e[f].url;return k}if(b.mode==="auto"||b.mode==="shim")for(f=0;f<e.length;f++){g=e[f].type;for(a=0;a<b.plugins.length;a++){h=b.plugins[a];l=mejs.plugins[h];for(c=0;c<l.length;c++){j=l[c];if(mejs.PluginDetector.hasPluginVersion(h,j.version))for(d=0;d<j.types.length;d++)if(g==j.types[d]){k.method=h;k.url=e[f].url;return k}}}}if(k.method==="")k.url=e[0].url;return k},checkType:function(a,b,c){if(a&&!b){a=a.substring(a.lastIndexOf(".")+1);return(c?"video":"audio")+"/"+a}else return b&&~b.indexOf(";")?
|
37 |
b.substr(0,b.indexOf(";")):b},createErrorMessage:function(a,b,c,d){var e=document.createElement("div");e.className="me-cannotplay";try{e.style.width=a.width+"px";e.style.height=a.height+"px"}catch(f){}e.innerHTML=d!==""?'<a href="'+c+'"><img src="'+d+'" /></a>':'<a href="'+c+'"><span>Download File</span></a>';a.parentNode.insertBefore(e,a);a.style.display="none";b.error(a)},createPlugin:function(a,b,c,d,e,f,g,k,h){var l=f=1,j="me_"+d+"_"+mejs.meIndex++,n=new mejs.PluginMediaElement(j,d,e),o=document.createElement("div"),
|
38 |
m;for(m=a.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);break}m=m.parentNode}if(c){f=b.videoWidth>0?b.videoWidth:a.getAttribute("width")!==null?a.getAttribute("width"):b.defaultVideoWidth;l=b.videoHeight>0?b.videoHeight:a.getAttribute("height")!==null?a.getAttribute("height"):b.defaultVideoHeight}else if(b.enablePluginDebug){f=320;l=240}n.success=b.success;mejs.MediaPluginBridge.registerPluginElement(j,
|
39 |
-
n,a);o.className="me-plugin";a.parentNode.insertBefore(o,a);c=["id="+j,"isvideo="+(c?"true":"false"),"autoplay="+(g?"true":"false"),"preload="+k,"width="+f,"timerrate="+b.timerRate,"height="+l];if(e!==null)d=="flash"?c.push("file="+mejs.Utility.encodeUrl(e)):c.push("file="+e);b.enablePluginDebug&&c.push("debug=true");b.enablePluginSmoothing&&c.push("smoothing=true");h&&c.push("controls=true");switch(d){case "silverlight":o.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+
|
40 |
j+'" name="'+j+'" width="'+f+'" height="'+l+'"><param name="initParams" value="'+c.join(",")+'" /><param name="windowless" value="true" /><param name="background" value="black" /><param name="minRuntimeVersion" value="3.0.0.0" /><param name="autoUpgrade" value="true" /><param name="source" value="'+b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){d=document.createElement("div");o.appendChild(d);d.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+
|
41 |
j+'" width="'+f+'" height="'+l+'"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+c.join("&")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else o.innerHTML='<embed id="'+j+'" name="'+j+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+
|
42 |
b.pluginPath+b.flashName+'" flashvars="'+c.join("&")+'" width="'+f+'" height="'+l+'"></embed>'}a.style.display="none";return n},updateNative:function(a,b,c,d,e){for(var f in mejs.HtmlMediaElement)a[f]=mejs.HtmlMediaElement[f];if(mejs.MediaFeatures.isChrome)if(d==="none"&&!c){a.src="";a.load();a.canceledPreload=true;a.addEventListener("play",function(){if(a.canceledPreload){a.src=e.url;a.load();a.play();a.canceledPreload=false}},false)}else if(c){a.load();a.play()}b.success(a,a);return a}};
|
@@ -52,49 +52,51 @@ window.mejs=mejs;window.MediaElement=mejs.MediaElement;
|
|
52 |
* Copyright 2010, John Dyer (http://johndyer.me)
|
53 |
* Dual licensed under the MIT or GPL Version 2 licenses.
|
54 |
*
|
55 |
-
*/(function(f){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,audioWidth:400,audioHeight:30,startVolume:0.8,loop:false,enableAutosize:true,features:["playpause","current","progress","duration","tracks","volume","fullscreen"]};mejs.mepIndex=0;mejs.MediaElementPlayer=function(a,c){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,c);this.options=f.extend({},mejs.MepDefaults,c);this.$media=this.$node=
|
56 |
-
this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;this.isVideo=this.media.tagName.toLowerCase()==="video";this.init();return this};mejs.MediaElementPlayer.prototype={init:function(){var a=this,c=mejs.MediaFeatures,b=f.extend(true,{},a.options,{success:function(d,e){a.meReady(d,e)},error:function(d){a.handleError(d)}});if(c.isiPad||c.isiPhone){a.$media.attr("controls","controls");a.$media.removeAttr("poster");if(c.isiPad&&
|
57 |
-
null){a.media.load();a.media.play()}}else if(c.isAndroid){if(a.isVideo){if(a.$media.find("source").length>0)a.media.src=a.$media.find('source[src$="mp4"]').attr("src");a.$media.click(function(){a.media.play()})}}else{a.$media.removeAttr("controls");a.id="mep_"+mejs.mepIndex++;a.container=f('<div id="'+a.id+'" class="mejs-container"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(a.$media[0].className).insertBefore(a.$media);
|
58 |
a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");if(a.isVideo){a.width=a.options.videoWidth>0?a.options.videoWidth:a.$media[0].getAttribute("width")!==null?a.$media.attr("width"):a.options.defaultVideoWidth;a.height=a.options.videoHeight>0?a.options.videoHeight:a.$media[0].getAttribute("height")!==null?a.$media.attr("height"):a.options.defaultVideoHeight}else{a.width=a.options.audioWidth;a.height=a.options.audioHeight}a.setPlayerSize(a.width,
|
59 |
a.height);b.pluginWidth=a.height;b.pluginHeight=a.width}mejs.MediaElement(a.$media[0],b)},meReady:function(a,c){var b=this,d=mejs.MediaFeatures,e;if(!this.created){this.created=true;b.media=a;b.domNode=c;if(!d.isiPhone&&!d.isAndroid&&!d.isiPad){b.buildposter(b,b.controls,b.layers,b.media);b.buildoverlays(b,b.controls,b.layers,b.media);b.findTracks();for(e in b.options.features){d=b.options.features[e];if(b["build"+d])try{b["build"+d](b,b.controls,b.layers,b.media)}catch(g){}}b.setPlayerSize(b.width,
|
60 |
-
b.height);b.setControlsSize();if(b.isVideo){b.container.bind("mouseenter",function(){b.controls.css("visibility","visible");b.controls.stop(true,true).fadeIn(200)}).bind("mouseleave",function(){b.media.paused||b.controls.stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});b.domNode.getAttribute("autoplay")!==null&&b.controls.css("visibility","hidden");b.options.enableAutosize&&b.media.addEventListener("loadedmetadata",function(
|
61 |
-
0&&b.domNode.getAttribute("height")===null&&!isNaN(
|
62 |
-
b.setPlayerSize(b.width,b.height)},50)}b.options.success&&b.options.success(b.media,b.domNode)}},handleError:function(a){this.options.error&&this.options.error(a)},setPlayerSize:function(a,c){this.width=parseInt(a,10);this.height=parseInt(c,10);this.container.width(this.width).height(this.height);this.layers.children("
|
63 |
-
this.controls.find(".mejs-time-loaded");others=b.siblings();others.each(function(){if(f(this).css("position")!="absolute")a+=f(this).outerWidth(true)});c=this.controls.width()-a-(b.outerWidth(true)-b.outerWidth(false));b.width(c);d.width(c-(d.outerWidth(true)-d.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},
|
64 |
-
if(a.options.poster!="")b.attr("src",a.options.poster);else c!==""&&c!=null?b.attr("src",c):e.remove();d.addEventListener("play",function(){e.hide()},false)},buildoverlays:function(a,c,b,d){if(a.isVideo){var e=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(b),
|
65 |
-
d.play():d.pause()});d.addEventListener("play",function(){
|
66 |
-
src:f(this).attr("src"),kind:f(this).attr("kind"),entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize();this.setControlsSize()},play:function(){this.media.play()},
|
67 |
-
getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)}};jQuery.fn.mediaelementplayer=function(a){return this.each(function(){new mejs.MediaElementPlayer(f(this),a)})};window.MediaElementPlayer=
|
68 |
-
|
69 |
-
|
|
|
70 |
(function(f){MediaElementPlayer.prototype.buildstop=function(a,c,b,d){f('<div class="mejs-button mejs-stop-button mejs-stop"><span></span></div>').appendTo(c).click(function(){d.paused||d.pause();if(d.currentTime>0){d.setCurrentTime(0);c.find(".mejs-time-current").width("0px");c.find(".mejs-time-handle").css("left","0px");c.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));b.find(".mejs-poster").show()}})}})(jQuery);
|
71 |
-
(function(f){MediaElementPlayer.prototype.buildprogress=function(a,c,b,d){f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></span></div>').appendTo(c);var e=c.find(".mejs-time-total");c.find(".mejs-time-loaded");c.find(".mejs-time-current")
|
72 |
-
|
73 |
-
function(){
|
74 |
-
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));
|
75 |
-
this.
|
76 |
-
(function(f){MediaElementPlayer.prototype.buildcurrent=function(a,c,b,d){f('<div class="mejs-time"><span class="mejs-currenttime">00:00</span></div>
|
77 |
-
f('<div class="mejs-time"><span class="mejs-duration">00:00</span></div>
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
(function(
|
82 |
-
|
83 |
-
|
|
|
84 |
(function(f){f.extend(mejs.MepDefaults,{startLanguage:"",translations:[],translationSelector:false,googleApiKey:""});f.extend(MediaElementPlayer.prototype,{buildtracks:function(a,c,b,d){if(a.isVideo)if(a.tracks.length!=0){var e,g="";a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(b).hide();a.captions=f('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position"><span class="mejs-captions-text"></span></div></div>').prependTo(b).hide();a.captionsText=a.captions.find(".mejs-captions-text");
|
85 |
a.captionsButton=f('<div class="mejs-button mejs-captions-button"><span></span><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+a.id+'_captions" id="'+a.id+'_captions_none" value="none" checked="checked" /><label for="'+a.id+'_captions_none">None</label></li></ul></div></div>').appendTo(c).delegate("input[type=radio]","click",function(){lang=this.value;if(lang=="none")a.selectedTrack=null;else for(e=0;e<a.tracks.length;e++)if(a.tracks[e].srclang==lang){a.selectedTrack=a.tracks[e];
|
86 |
a.captions.attr("lang",a.selectedTrack.srclang);a.displayCaptions();break}});a.container.bind("mouseenter",function(){a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("mouseleave",function(){d.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;if(a.tracks.length>0&&a.options.translations.length>0)for(e=0;e<a.options.translations.length;e++)a.tracks.push({srclang:a.options.translations[e].toLowerCase(),
|
87 |
src:null,kind:"subtitles",entries:[],isLoaded:false,isTranslation:true});for(e=0;e<a.tracks.length;e++)a.tracks[e].kind=="subtitles"&&a.addTrackButton(a.tracks[e].srclang,a.tracks[e].isTranslation);a.loadNextTrack();d.addEventListener("timeupdate",function(){a.displayCaptions()},false);d.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){a.chapters.css("visibility","visible");a.chapters.fadeIn(200)},function(){d.paused||a.chapters.fadeOut(200,function(){f(this).css("visibility",
|
88 |
-
"hidden");f(this).css("display","block")})});
|
89 |
""){a.tracks.push({srclang:lang,src:null,entries:[],isLoaded:false,isTranslation:true});if(!a.isLoadingTrack){a.trackToLoad--;a.addTrackButton(lang,true);a.options.startLanguage=lang;a.loadNextTrack()}}})}}},loadNextTrack:function(){this.trackToLoad++;if(this.trackToLoad<this.tracks.length){this.isLoadingTrack=true;this.loadTrack(this.trackToLoad)}else this.isLoadingTrack=false},loadTrack:function(a){var c=this,b=c.tracks[a],d=function(){b.isLoaded=true;c.enableTrackButton(b.srclang);c.loadNextTrack()};
|
90 |
-
b.isTranslation?mejs.
|
91 |
-
this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,c){var b=mejs.language.codes[a]||a;this.captionsButton.find("ul").append(f('<li><input type="radio" name="'+this.id+'_captions" id="'+this.id+"_captions_"+a+'" value="'+a+'" disabled="disabled" /><label for="'+this.id+"_captions_"+a+'">'+b+(c?" (translating)":" (loading)")+"</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+a+"]").remove()},adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+
|
92 |
this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},displayCaptions:function(){if(typeof this.tracks!="undefined"){var a,c=this.selectedTrack;if(c!=null&&c.isLoaded)for(a=0;a<c.entries.times.length;a++)if(this.media.currentTime>=c.entries.times[a].start&&this.media.currentTime<=c.entries.times[a].stop){this.captionsText.html(c.entries.text[a]);this.captions.show();return}this.captions.hide()}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind==
|
93 |
"chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);break}},drawChapters:function(a){var c=this,b,d,e=d=0;c.chapters.empty();for(b=0;b<a.entries.times.length;b++){d=a.entries.times[b].stop-a.entries.times[b].start;d=Math.floor(d/c.media.duration*100);if(d+e>100||b==a.entries.times.length-1&&d+e<100)d=100-e;c.chapters.append(f('<div class="mejs-chapter" rel="'+a.entries.times[b].start+'" style="left: '+e.toString()+"%;width: "+d.toString()+'%;"><div class="mejs-chapter-block'+(b==
|
94 |
a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[b]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[b].start)+"–"+mejs.Utility.secondsToTimeCode(a.entries.times[b].stop)+"</span></div></div>"));e+=d}c.chapters.find("div.mejs-chapter").click(function(){c.media.setCurrentTime(parseFloat(f(this).attr("rel")));c.media.paused&&c.media.play()});c.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",
|
95 |
be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",tl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",
|
96 |
-
pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
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("&").split("<").join("<").split('"').join(""")},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}};
|
18 |
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
|
19 |
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,f,g){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[f]+=g;e[f]-=g};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
|
20 |
if(mejs.PluginDetector.ua.match(/android 2\.[12]/)!==null)HTMLMediaElement.canPlayType=function(a){return a.match(/video\/(mp4|m4v)/gi)!==null?"probably":""};
|
21 |
mejs.MediaFeatures={init:function(){var a=mejs.PluginDetector.nav,b=mejs.PluginDetector.ua.toLowerCase(),c,d=["source","track","audio","video"];this.isiPad=b.match(/ipad/i)!==null;this.isiPhone=b.match(/iphone/i)!==null;this.isAndroid=b.match(/android/i)!==null;this.isIE=a.appName.toLowerCase().indexOf("microsoft")!=-1;this.isChrome=b.match(/chrome/gi)!==null;for(a=0;a<d.length;a++)c=document.createElement(d[a]);this.hasNativeFullScreen=typeof c.webkitEnterFullScreen!=="undefined";if(this.isChrome)this.hasNativeFullScreen=
|
22 |
+
false;if(this.hasNativeFullScreen&&b.match(/mac os x 10_5/i))this.hasNativeFullScreen=false}};mejs.MediaFeatures.init();
|
23 |
+
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:false,setCurrentTime:function(a){this.currentTime=a},setMuted:function(a){this.muted=a},setVolume:function(a){this.volume=a},stop:function(){this.pause()},setSrc:function(a){if(typeof a=="string")this.src=a;else{var b,c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type))this.src=c.src}}},setVideoSize:function(a,b){this.width=a;this.height=b}};mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={}};
|
24 |
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginApi.loadMedia();this.paused=false}},pause:function(){if(this.pluginApi!=null){this.pluginApi.pauseMedia();this.paused=
|
25 |
true}},stop:function(){if(this.pluginApi!=null){this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return true}return false},setSrc:function(a){if(typeof a=="string"){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a));this.src=mejs.Utility.absolutizeUrl(a)}else{var b,c;for(b=0;b<a.length;b++){c=
|
26 |
a[b];if(this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src));this.src=mejs.Utility.absolutizeUrl(a)}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){this.pluginApi.setMuted(a);this.muted=a}},setVideoSize:function(a,b){if(this.pluginElement.style){this.pluginElement.style.width=
|
36 |
"native";k.url=e[f].url;return k}if(b.mode==="auto"||b.mode==="shim")for(f=0;f<e.length;f++){g=e[f].type;for(a=0;a<b.plugins.length;a++){h=b.plugins[a];l=mejs.plugins[h];for(c=0;c<l.length;c++){j=l[c];if(mejs.PluginDetector.hasPluginVersion(h,j.version))for(d=0;d<j.types.length;d++)if(g==j.types[d]){k.method=h;k.url=e[f].url;return k}}}}if(k.method==="")k.url=e[0].url;return k},checkType:function(a,b,c){if(a&&!b){a=a.substring(a.lastIndexOf(".")+1);return(c?"video":"audio")+"/"+a}else return b&&~b.indexOf(";")?
|
37 |
b.substr(0,b.indexOf(";")):b},createErrorMessage:function(a,b,c,d){var e=document.createElement("div");e.className="me-cannotplay";try{e.style.width=a.width+"px";e.style.height=a.height+"px"}catch(f){}e.innerHTML=d!==""?'<a href="'+c+'"><img src="'+d+'" /></a>':'<a href="'+c+'"><span>Download File</span></a>';a.parentNode.insertBefore(e,a);a.style.display="none";b.error(a)},createPlugin:function(a,b,c,d,e,f,g,k,h){var l=f=1,j="me_"+d+"_"+mejs.meIndex++,n=new mejs.PluginMediaElement(j,d,e),o=document.createElement("div"),
|
38 |
m;for(m=a.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);break}m=m.parentNode}if(c){f=b.videoWidth>0?b.videoWidth:a.getAttribute("width")!==null?a.getAttribute("width"):b.defaultVideoWidth;l=b.videoHeight>0?b.videoHeight:a.getAttribute("height")!==null?a.getAttribute("height"):b.defaultVideoHeight}else if(b.enablePluginDebug){f=320;l=240}n.success=b.success;mejs.MediaPluginBridge.registerPluginElement(j,
|
39 |
+
n,a);o.className="me-plugin";a.parentNode.insertBefore(o,a);c=["id="+j,"isvideo="+(c?"true":"false"),"autoplay="+(g?"true":"false"),"preload="+k,"width="+f,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"height="+l];if(e!==null)d=="flash"?c.push("file="+mejs.Utility.encodeUrl(e)):c.push("file="+e);b.enablePluginDebug&&c.push("debug=true");b.enablePluginSmoothing&&c.push("smoothing=true");h&&c.push("controls=true");switch(d){case "silverlight":o.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+
|
40 |
j+'" name="'+j+'" width="'+f+'" height="'+l+'"><param name="initParams" value="'+c.join(",")+'" /><param name="windowless" value="true" /><param name="background" value="black" /><param name="minRuntimeVersion" value="3.0.0.0" /><param name="autoUpgrade" value="true" /><param name="source" value="'+b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){d=document.createElement("div");o.appendChild(d);d.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+
|
41 |
j+'" width="'+f+'" height="'+l+'"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+c.join("&")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else o.innerHTML='<embed id="'+j+'" name="'+j+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+
|
42 |
b.pluginPath+b.flashName+'" flashvars="'+c.join("&")+'" width="'+f+'" height="'+l+'"></embed>'}a.style.display="none";return n},updateNative:function(a,b,c,d,e){for(var f in mejs.HtmlMediaElement)a[f]=mejs.HtmlMediaElement[f];if(mejs.MediaFeatures.isChrome)if(d==="none"&&!c){a.src="";a.load();a.canceledPreload=true;a.addEventListener("play",function(){if(a.canceledPreload){a.src=e.url;a.load();a.play();a.canceledPreload=false}},false)}else if(c){a.load();a.play()}b.success(a,a);return a}};
|
52 |
* Copyright 2010, John Dyer (http://johndyer.me)
|
53 |
* Dual licensed under the MIT or GPL Version 2 licenses.
|
54 |
*
|
55 |
+
*/(function(f){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,audioWidth:400,audioHeight:30,startVolume:0.8,loop:false,enableAutosize:true,alwaysShowHours:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"]};mejs.mepIndex=0;mejs.MediaElementPlayer=function(a,c){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,c);this.options=f.extend({},mejs.MepDefaults,c);this.$media=this.$node=
|
56 |
+
f(a);this.node=this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;this.isVideo=this.media.tagName.toLowerCase()==="video";this.init();return this};mejs.MediaElementPlayer.prototype={init:function(){var a=this,c=mejs.MediaFeatures,b=f.extend(true,{},a.options,{success:function(d,e){a.meReady(d,e)},error:function(d){a.handleError(d)}});if(c.isiPad||c.isiPhone){a.$media.attr("controls","controls");a.$media.removeAttr("poster");if(c.isiPad&&
|
57 |
+
a.media.getAttribute("autoplay")!==null){a.media.load();a.media.play()}}else if(c.isAndroid){if(a.isVideo){if(a.$media.find("source").length>0)a.media.src=a.$media.find('source[src$="mp4"]').attr("src");a.$media.click(function(){a.media.play()})}}else{a.$media.removeAttr("controls");a.id="mep_"+mejs.mepIndex++;a.container=f('<div id="'+a.id+'" class="mejs-container"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(a.$media[0].className).insertBefore(a.$media);
|
58 |
a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");if(a.isVideo){a.width=a.options.videoWidth>0?a.options.videoWidth:a.$media[0].getAttribute("width")!==null?a.$media.attr("width"):a.options.defaultVideoWidth;a.height=a.options.videoHeight>0?a.options.videoHeight:a.$media[0].getAttribute("height")!==null?a.$media.attr("height"):a.options.defaultVideoHeight}else{a.width=a.options.audioWidth;a.height=a.options.audioHeight}a.setPlayerSize(a.width,
|
59 |
a.height);b.pluginWidth=a.height;b.pluginHeight=a.width}mejs.MediaElement(a.$media[0],b)},meReady:function(a,c){var b=this,d=mejs.MediaFeatures,e;if(!this.created){this.created=true;b.media=a;b.domNode=c;if(!d.isiPhone&&!d.isAndroid&&!d.isiPad){b.buildposter(b,b.controls,b.layers,b.media);b.buildoverlays(b,b.controls,b.layers,b.media);b.findTracks();for(e in b.options.features){d=b.options.features[e];if(b["build"+d])try{b["build"+d](b,b.controls,b.layers,b.media)}catch(g){}}b.setPlayerSize(b.width,
|
60 |
+
b.height);b.setControlsSize();if(b.isVideo){b.container.bind("mouseenter",function(){b.controls.css("visibility","visible");b.controls.stop(true,true).fadeIn(200)}).bind("mouseleave",function(){b.media.paused||b.controls.stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});b.domNode.getAttribute("autoplay")!==null&&b.controls.css("visibility","hidden");b.options.enableAutosize&&b.media.addEventListener("loadedmetadata",function(h){if(b.options.videoHeight<=
|
61 |
+
0&&b.domNode.getAttribute("height")===null&&!isNaN(h.target.videoHeight)){b.setPlayerSize(h.target.videoWidth,h.target.videoHeight);b.setControlsSize();b.media.setVideoSize(h.target.videoWidth,h.target.videoHeight)}},false)}b.media.addEventListener("ended",function(){b.media.setCurrentTime(0);b.media.pause();b.setProgressRail&&b.setProgressRail();b.setCurrentRail&&b.setCurrentRail();b.options.loop?b.media.play():b.controls.css("visibility","visible")},true);b.media.addEventListener("loadedmetadata",
|
62 |
+
function(){b.updateDuration&&b.updateDuration();b.updateCurrent&&b.updateCurrent();b.setControlsSize()},true);setTimeout(function(){b.setControlsSize();b.setPlayerSize(b.width,b.height)},50)}b.options.success&&b.options.success(b.media,b.domNode)}},handleError:function(a){this.options.error&&this.options.error(a)},setPlayerSize:function(a,c){this.width=parseInt(a,10);this.height=parseInt(c,10);this.container.width(this.width).height(this.height);this.layers.children(".mejs-layer").width(this.width).height(this.height)},
|
63 |
+
setControlsSize:function(){var a=0,c=0,b=this.controls.find(".mejs-time-rail"),d=this.controls.find(".mejs-time-total");this.controls.find(".mejs-time-current");this.controls.find(".mejs-time-loaded");others=b.siblings();others.each(function(){if(f(this).css("position")!="absolute")a+=f(this).outerWidth(true)});c=this.controls.width()-a-(b.outerWidth(true)-b.outerWidth(false));b.width(c);d.width(c-(d.outerWidth(true)-d.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},
|
64 |
+
buildposter:function(a,c,b,d){var e=f('<div class="mejs-poster mejs-layer"><img /></div>').appendTo(b);c=a.$media.attr("poster");b=e.find("img").width(a.width).height(a.height);if(a.options.poster!="")b.attr("src",a.options.poster);else c!==""&&c!=null?b.attr("src",c):e.remove();d.addEventListener("play",function(){e.hide()},false)},buildoverlays:function(a,c,b,d){if(a.isVideo){var e=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(b),
|
65 |
+
g=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(b),h=f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(b).click(function(){d.paused?d.play():d.pause()});d.addEventListener("play",function(){h.hide();g.hide()},false);d.addEventListener("pause",function(){h.show()},false);d.addEventListener("loadstart",function(){e.show()},false);d.addEventListener("canplay",function(){e.hide()},
|
66 |
+
false);d.addEventListener("error",function(){e.hide();g.show();g.find("mejs-overlay-error").html("Error loading this resource")},false)}},findTracks:function(){var a=this,c=a.$media.find("track");a.tracks=[];c.each(function(){a.tracks.push({srclang:f(this).attr("srclang").toLowerCase(),src:f(this).attr("src"),kind:f(this).attr("kind"),entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize();this.setControlsSize()},play:function(){this.media.play()},
|
67 |
+
pause:function(){this.media.pause()},load:function(){this.media.load()},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)}};jQuery.fn.mediaelementplayer=function(a){return this.each(function(){new mejs.MediaElementPlayer(f(this),a)})};window.MediaElementPlayer=
|
68 |
+
mejs.MediaElementPlayer})(jQuery);
|
69 |
+
(function(f){MediaElementPlayer.prototype.buildplaypause=function(a,c,b,d){var e=f('<div class="mejs-button mejs-playpause-button mejs-play"><span></span></div>').appendTo(c).click(function(){d.paused?d.play():d.pause()});d.addEventListener("play",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);d.addEventListener("playing",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);d.addEventListener("pause",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false);
|
70 |
+
d.addEventListener("paused",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false)}})(jQuery);
|
71 |
(function(f){MediaElementPlayer.prototype.buildstop=function(a,c,b,d){f('<div class="mejs-button mejs-stop-button mejs-stop"><span></span></div>').appendTo(c).click(function(){d.paused||d.pause();if(d.currentTime>0){d.setCurrentTime(0);c.find(".mejs-time-current").width("0px");c.find(".mejs-time-handle").css("left","0px");c.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));b.find(".mejs-poster").show()}})}})(jQuery);
|
72 |
+
(function(f){MediaElementPlayer.prototype.buildprogress=function(a,c,b,d){f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></span></div>').appendTo(c);var e=c.find(".mejs-time-total");b=c.find(".mejs-time-loaded");var g=c.find(".mejs-time-current"),
|
73 |
+
h=c.find(".mejs-time-handle"),j=c.find(".mejs-time-float"),l=c.find(".mejs-time-float-current"),m=function(k){k=k.pageX;var n=e.offset(),q=e.outerWidth(),p=0;p=0;if(k>n.left&&k<=q+n.left&&d.duration){p=(k-n.left)/q;p=p<=0.02?0:p*d.duration;o&&d.setCurrentTime(p);j.css("left",k-n.left);l.html(mejs.Utility.secondsToTimeCode(p))}},o=false,i=false;e.bind("mousedown",function(k){o=true;m(k);return false});c.find(".mejs-time-rail").bind("mouseenter",function(){i=true}).bind("mouseleave",function(){i=false});
|
74 |
+
f(document).bind("mouseup",function(){o=false}).bind("mousemove",function(k){if(o||i)m(k)});d.addEventListener("progress",function(k){a.setProgressRail(k);a.setCurrentRail(k)},false);d.addEventListener("timeupdate",function(k){a.setProgressRail(k);a.setCurrentRail(k)},false);this.loaded=b;this.total=e;this.current=g;this.handle=h};MediaElementPlayer.prototype.setProgressRail=function(a){var c=a!=undefined?a.target:this.media,b=null;if(c&&c.buffered&&c.buffered.length>0&&c.buffered.end&&c.duration)b=
|
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);
|
83 |
+
(function(f){MediaElementPlayer.prototype.buildfullscreen=function(a,c,b,d){if(a.isVideo){var e=0,g=0,h=a.container,j=f('<div class="mejs-button mejs-fullscreen-button"><span></span></div>').appendTo(c).click(function(){l(mejs.MediaFeatures.hasNativeFullScreen?!d.webkitDisplayingFullscreen:!d.isFullScreen)}),l=function(m){switch(d.pluginType){case "flash":case "silverlight":d.setFullscreen(m);break;case "native":if(mejs.MediaFeatures.hasNativeFullScreen)if(m){d.webkitEnterFullScreen();d.isFullScreen=
|
84 |
+
true}else{d.webkitExitFullScreen();d.isFullScreen=false}else if(m){e=a.$media.height();g=a.$media.width();h.addClass("mejs-container-fullscreen").width("100%").height("100%").css("z-index",1E3);a.$media.width("100%").height("100%");b.children("div").width("100%").height("100%");j.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();d.isFullScreen=true}else{h.removeClass("mejs-container-fullscreen").width(g).height(e).css("z-index",1);a.$media.width(g).height(e);b.children("div").width(g).height(e);
|
85 |
+
j.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");a.setControlsSize();d.isFullScreen=false}}};f(document).bind("keydown",function(m){d.isFullScreen&&m.keyCode==27&&l(false)})}}})(jQuery);
|
86 |
(function(f){f.extend(mejs.MepDefaults,{startLanguage:"",translations:[],translationSelector:false,googleApiKey:""});f.extend(MediaElementPlayer.prototype,{buildtracks:function(a,c,b,d){if(a.isVideo)if(a.tracks.length!=0){var e,g="";a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(b).hide();a.captions=f('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position"><span class="mejs-captions-text"></span></div></div>').prependTo(b).hide();a.captionsText=a.captions.find(".mejs-captions-text");
|
87 |
a.captionsButton=f('<div class="mejs-button mejs-captions-button"><span></span><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+a.id+'_captions" id="'+a.id+'_captions_none" value="none" checked="checked" /><label for="'+a.id+'_captions_none">None</label></li></ul></div></div>').appendTo(c).delegate("input[type=radio]","click",function(){lang=this.value;if(lang=="none")a.selectedTrack=null;else for(e=0;e<a.tracks.length;e++)if(a.tracks[e].srclang==lang){a.selectedTrack=a.tracks[e];
|
88 |
a.captions.attr("lang",a.selectedTrack.srclang);a.displayCaptions();break}});a.container.bind("mouseenter",function(){a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("mouseleave",function(){d.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;if(a.tracks.length>0&&a.options.translations.length>0)for(e=0;e<a.options.translations.length;e++)a.tracks.push({srclang:a.options.translations[e].toLowerCase(),
|
89 |
src:null,kind:"subtitles",entries:[],isLoaded:false,isTranslation:true});for(e=0;e<a.tracks.length;e++)a.tracks[e].kind=="subtitles"&&a.addTrackButton(a.tracks[e].srclang,a.tracks[e].isTranslation);a.loadNextTrack();d.addEventListener("timeupdate",function(){a.displayCaptions()},false);d.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){a.chapters.css("visibility","visible");a.chapters.fadeIn(200)},function(){d.paused||a.chapters.fadeOut(200,function(){f(this).css("visibility",
|
90 |
+
"hidden");f(this).css("display","block")})});a.node.getAttribute("autoplay")!==null&&a.chapters.css("visibility","hidden");if(a.options.translationSelector){for(e in mejs.language.codes)g+='<option value="'+e+'">'+mejs.language.codes[e]+"</option>";a.container.find(".mejs-captions-selector ul").before(f('<select class="mejs-captions-translations"><option value="">--Add Translation--</option>'+g+"</select>"));a.container.find(".mejs-captions-translations").change(function(){lang=f(this).val();if(lang!=
|
91 |
""){a.tracks.push({srclang:lang,src:null,entries:[],isLoaded:false,isTranslation:true});if(!a.isLoadingTrack){a.trackToLoad--;a.addTrackButton(lang,true);a.options.startLanguage=lang;a.loadNextTrack()}}})}}},loadNextTrack:function(){this.trackToLoad++;if(this.trackToLoad<this.tracks.length){this.isLoadingTrack=true;this.loadTrack(this.trackToLoad)}else this.isLoadingTrack=false},loadTrack:function(a){var c=this,b=c.tracks[a],d=function(){b.isLoaded=true;c.enableTrackButton(b.srclang);c.loadNextTrack()};
|
92 |
+
b.isTranslation?mejs.TrackFormatParser.translateTrackText(c.tracks[0].entries,c.tracks[0].srclang,b.srclang,c.options.googleApiKey,function(e){b.entries=e;d()}):f.ajax({url:b.src,success:function(e){b.entries=mejs.TrackFormatParser.parse(e);d();b.kind=="chapters"&&c.media.duration>0&&c.drawChapters(b)},error:function(){c.loadNextTrack()}})},enableTrackButton:function(a){this.captionsButton.find("input[value="+a+"]").attr("disabled","").siblings("label").html(mejs.language.codes[a]||a);this.options.startLanguage==
|
93 |
+
a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,c){var b=mejs.language.codes[a]||a;this.captionsButton.find("ul").append(f('<li><input type="radio" name="'+this.id+'_captions" id="'+this.id+"_captions_"+a+'" value="'+a+'" disabled="disabled" /><label for="'+this.id+"_captions_"+a+'">'+b+(c?" (translating)":" (loading)")+"</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+a+"]").remove()},adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+
|
94 |
this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},displayCaptions:function(){if(typeof this.tracks!="undefined"){var a,c=this.selectedTrack;if(c!=null&&c.isLoaded)for(a=0;a<c.entries.times.length;a++)if(this.media.currentTime>=c.entries.times[a].start&&this.media.currentTime<=c.entries.times[a].stop){this.captionsText.html(c.entries.text[a]);this.captions.show();return}this.captions.hide()}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind==
|
95 |
"chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);break}},drawChapters:function(a){var c=this,b,d,e=d=0;c.chapters.empty();for(b=0;b<a.entries.times.length;b++){d=a.entries.times[b].stop-a.entries.times[b].start;d=Math.floor(d/c.media.duration*100);if(d+e>100||b==a.entries.times.length-1&&d+e<100)d=100-e;c.chapters.append(f('<div class="mejs-chapter" rel="'+a.entries.times[b].start+'" style="left: '+e.toString()+"%;width: "+d.toString()+'%;"><div class="mejs-chapter-block'+(b==
|
96 |
a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[b]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[b].start)+"–"+mejs.Utility.secondsToTimeCode(a.entries.times[b].stop)+"</span></div></div>"));e+=d}c.chapters.find("div.mejs-chapter").click(function(){c.media.setCurrentTime(parseFloat(f(this).attr("rel")));c.media.paused&&c.media.play()});c.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",
|
97 |
be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",tl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",
|
98 |
+
pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.TrackFormatParser={pattern_identifier:/^[0-9]+$/,pattern_timecode:/^([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}(,[0-9]{3})?)(.*)$/,split2:function(a,c){return a.split(c)},parse:function(a){var c=0;a=this.split2(a,/\r?\n/);for(var b={text:[],
|
99 |
+
times:[]},d,e;c<a.length;c++)if(this.pattern_identifier.exec(a[c])){c++;if((d=this.pattern_timecode.exec(a[c]))&&c<a.length){c++;e=a[c];for(c++;a[c]!==""&&c<a.length;){e=e+"\n"+a[c];c++}b.text.push(e);b.times.push({start:mejs.Utility.timeCodeToSeconds(d[1]),stop:mejs.Utility.timeCodeToSeconds(d[3]),settings:d[5]})}}return b},translateTrackText:function(a,c,b,d,e){var g={text:[],times:[]},h,j;this.translateText(a.text.join(" <a></a>"),c,b,d,function(l){h=l.split("<a></a>");for(j=0;j<a.text.length;j++){g.text[j]=
|
100 |
+
h[j];g.times[j]={start:a.times[j].start,stop:a.times[j].stop,settings:a.times[j].settings}}e(g)})},translateText:function(a,c,b,d,e){for(var g,h=[],j,l="",m=function(){if(h.length>0){j=h.shift();mejs.TrackFormatParser.translateChunk(j,c,b,d,function(o){if(o!="undefined")l+=o;m()})}else e(l)};a.length>0;)if(a.length>1E3){g=a.lastIndexOf(".",1E3);h.push(a.substring(0,g));a=a.substring(g+1)}else{h.push(a);a=""}m()},translateChunk:function(a,c,b,d,e){a={q:a,langpair:c+"|"+b,v:"1.0"};if(d!==""&&d!==null)a.key=
|
101 |
+
d;f.ajax({url:"https://ajax.googleapis.com/ajax/services/language/translate",data:a,type:"GET",dataType:"jsonp",success:function(g){e(g.responseData.translatedText)},error:function(){e(null)}})}};if("x\n\ny".split(/\n/gi).length!=3)mejs.TrackFormatParser.split2=function(a,c){var b=[],d="",e;for(e=0;e<a.length;e++){d+=a.substring(e,e+1);if(c.test(d)){b.push(d.replace(c,""));d=""}}b.push(d);return b}})(jQuery);
|
102 |
|
mediaelement/silverlightmediaelement.xap
CHANGED
Binary file
|
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.
|
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 |
|
@@ -140,6 +140,12 @@ View <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more inform
|
|
140 |
|
141 |
== Changelog ==
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
= 2.0.6.2 =
|
144 |
* Fixed a problem with Wordpress SVN
|
145 |
|
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 |
|
140 |
|
141 |
== Changelog ==
|
142 |
|
143 |
+
= 2.1.4 =
|
144 |
+
* Updated to latest MediaElement.js code
|
145 |
+
* Changed scripts to use wp_enqueue_script("mediaelementjs-scripts")
|
146 |
+
* Changed styles to use wp_enqueue_style("mediaelementjs-styles")
|
147 |
+
* Added [mejsaudio] and [mejsvideo] as valid short codes. Wordpress's Jetpack will now take over [audio]
|
148 |
+
|
149 |
= 2.0.6.2 =
|
150 |
* Fixed a problem with Wordpress SVN
|
151 |
|