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

Version Description

  • Skin selector (default, WMP, TED)
  • Audio height and width
  • Leave off the extension on the src attribute and files will be automatically detected
Download this release

Release Info

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

Code changes from version 2.1.6 to 2.1.7

mediaelement-js-wp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package MediaElementJS
4
- * @version 2.1.5
5
  */
6
 
7
  /*
@@ -9,8 +9,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.5
13
- Author URI: http://johndyer.me/
14
  License: GPLv3, MIT
15
  */
16
 
@@ -24,18 +24,28 @@ $mediaElementPlayerIndex = 1;
24
  register_activation_hook(__FILE__,'mejs_install');
25
 
26
  function mejs_install() {
 
 
27
  add_option('mep_default_video_height', 270);
28
  add_option('mep_default_video_width', 480);
29
  add_option('mep_default_video_type', '');
 
 
 
30
  add_option('mep_default_audio_type', '');
31
  }
32
 
33
  /* Runs on plugin deactivation*/
34
  register_deactivation_hook( __FILE__, 'mejs_remove' );
35
  function mejs_remove() {
 
 
36
  delete_option('mep_default_video_height');
37
  delete_option('mep_default_video_width');
38
- delete_option('mep_default_video_type');
 
 
 
39
  delete_option('mep_default_audio_type');
40
  }
41
 
@@ -54,9 +64,14 @@ function mejs_create_menu() {
54
 
55
  function mejs_register_settings() {
56
  //register our settings
 
 
57
  register_setting( 'mep_settings', 'mep_default_video_height' );
58
  register_setting( 'mep_settings', 'mep_default_video_width' );
59
  register_setting( 'mep_settings', 'mep_default_video_type' );
 
 
 
60
  register_setting( 'mep_settings', 'mep_default_audio_type' );
61
  }
62
 
@@ -98,14 +113,42 @@ function mejs_settings_page() {
98
  <td >
99
  <input name="mep_default_video_type" type="text" id="mep_default_video_type" value="<?php echo get_option('mep_default_video_type'); ?>" /> <span class="description">such as "video/mp4"</span>
100
  </td>
101
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
102
  </table>
103
 
104
  <h3 class="title"><span>Audio Settings</span></h3>
105
 
106
 
107
  <table class="form-table">
 
 
 
 
 
 
 
 
 
108
  <tr valign="top">
 
 
 
 
 
 
 
109
  <th scope="row">
110
  <label for="mep_default_audio_type">Default Type</label>
111
  </th>
@@ -116,7 +159,7 @@ function mejs_settings_page() {
116
  </table>
117
 
118
  <input type="hidden" name="action" value="update" />
119
- <input type="hidden" name="page_options" value="mep_default_video_width,mep_default_video_height,mep_default_video_type,mep_default_audio_type" />
120
 
121
  <p>
122
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
@@ -147,6 +190,10 @@ 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');
@@ -197,10 +244,11 @@ function mejs_media_shortcode($tagName, $atts){
197
  'flv' => '',
198
  'ogg' => '',
199
  'poster' => '',
200
- 'width' => get_option('mep_default_video_width'),
201
- 'height' => get_option('mep_default_video_height'),
202
  'type' => get_option('mep_default_'.$tagName.'_type'),
203
  'preload' => 'none',
 
204
  'autoplay' => '',
205
  'loop' => '',
206
 
@@ -219,10 +267,82 @@ function mejs_media_shortcode($tagName, $atts){
219
  $type_attribute = 'type="'.$type.'"';
220
  }
221
 
 
222
  if ($src) {
223
  $src_attribute = 'src="'.htmlspecialchars($src).'"';
224
  $flash_src = htmlspecialchars($src);
225
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
 
227
  if ($mp4) {
228
  $mp4_source = '<source src="'.htmlspecialchars($mp4).'" type="'.$tagName.'/mp4" />';
@@ -291,10 +411,21 @@ function mejs_media_shortcode($tagName, $atts){
291
  if ($fullscreen == 'true')
292
  $controls_option .= ",'fullscreen'";
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}
300
  {$webm_source}
@@ -302,7 +433,7 @@ function mejs_media_shortcode($tagName, $atts){
302
  {$wmv_source}
303
  {$ogg_source}
304
  {$captions_source}
305
- <object width="320" height="240" type="application/x-shockwave-flash" data="{$dir}flashmediaelement.swf">
306
  <param name="movie" value="{$dir}flashmediaelement.swf" />
307
  <param name="flashvars" value="controls=true&amp;file={$flash_src}" />
308
  </object>
@@ -313,6 +444,7 @@ jQuery(document).ready(function($) {
313
  m:1
314
  {$loop_option}
315
  {$controls_option}
 
316
  });
317
  });
318
  </script>
1
  <?php
2
  /**
3
  * @package MediaElementJS
4
+ * @version 2.1.7
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.7
13
+ Author URI: http://j.hn/
14
  License: GPLv3, MIT
15
  */
16
 
24
  register_activation_hook(__FILE__,'mejs_install');
25
 
26
  function mejs_install() {
27
+ add_option('mep_video_skin', '');
28
+
29
  add_option('mep_default_video_height', 270);
30
  add_option('mep_default_video_width', 480);
31
  add_option('mep_default_video_type', '');
32
+
33
+ add_option('mep_default_audio_height', 30);
34
+ add_option('mep_default_audio_width', 400);
35
  add_option('mep_default_audio_type', '');
36
  }
37
 
38
  /* Runs on plugin deactivation*/
39
  register_deactivation_hook( __FILE__, 'mejs_remove' );
40
  function mejs_remove() {
41
+ delete_option('mep_video_skin');
42
+
43
  delete_option('mep_default_video_height');
44
  delete_option('mep_default_video_width');
45
+ delete_option('mep_default_video_type');
46
+
47
+ delete_option('mep_default_audio_height');
48
+ delete_option('mep_default_audio_width');
49
  delete_option('mep_default_audio_type');
50
  }
51
 
64
 
65
  function mejs_register_settings() {
66
  //register our settings
67
+ register_setting( 'mep_settings', 'mep_video_skin' );
68
+
69
  register_setting( 'mep_settings', 'mep_default_video_height' );
70
  register_setting( 'mep_settings', 'mep_default_video_width' );
71
  register_setting( 'mep_settings', 'mep_default_video_type' );
72
+
73
+ register_setting( 'mep_settings', 'mep_default_audio_height' );
74
+ register_setting( 'mep_settings', 'mep_default_audio_width' );
75
  register_setting( 'mep_settings', 'mep_default_audio_type' );
76
  }
77
 
113
  <td >
114
  <input name="mep_default_video_type" type="text" id="mep_default_video_type" value="<?php echo get_option('mep_default_video_type'); ?>" /> <span class="description">such as "video/mp4"</span>
115
  </td>
116
+ </tr>
117
+ <tr valign="top">
118
+ <th scope="row">
119
+ <label for="mep_video_skin">Video Skin</label>
120
+ </th>
121
+ <td >
122
+ <select name="mep_video_skin" id="mep_video_skin">
123
+ <option value="" <?php echo (get_option('mep_video_skin') == '') ? ' selected' : ''; ?>>Default</option>
124
+ <option value="wmp" <?php echo (get_option('mep_video_skin') == 'wmp') ? ' selected' : ''; ?>>WMP</option>
125
+ <option value="ted" <?php echo (get_option('mep_video_skin') == 'ted') ? ' selected' : ''; ?>>TED</option>
126
+ </select>
127
+ </td>
128
+ </tr>
129
  </table>
130
 
131
  <h3 class="title"><span>Audio Settings</span></h3>
132
 
133
 
134
  <table class="form-table">
135
+ <tr valign="top">
136
+ <tr valign="top">
137
+ <th scope="row">
138
+ <label for="mep_default_audio_width">Default Width</label>
139
+ </th>
140
+ <td >
141
+ <input name="mep_default_audio_width" type="text" id="mep_default_audio_width" value="<?php echo get_option('mep_default_audio_width'); ?>" />
142
+ </td>
143
+ </tr>
144
  <tr valign="top">
145
+ <th scope="row">
146
+ <label for="mep_default_audio_height">Default Height</label>
147
+ </th>
148
+ <td >
149
+ <input name="mep_default_audio_height" type="text" id="mep_default_audio_height" value="<?php echo get_option('mep_default_audio_height'); ?>" />
150
+ </td>
151
+ </tr>
152
  <th scope="row">
153
  <label for="mep_default_audio_type">Default Type</label>
154
  </th>
159
  </table>
160
 
161
  <input type="hidden" name="action" value="update" />
162
+ <input type="hidden" name="page_options" value="mep_default_video_width,mep_default_video_height,mep_default_video_type,mep_default_audio_type,mep_default_audio_width,mep_default_audio_height,mep_video_skin" />
163
 
164
  <p>
165
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
190
  if (!is_admin()){
191
  // the style
192
  wp_enqueue_style("mediaelementjs-styles", MEDIAELEMENTJS_DIR ."mediaelementplayer.css");
193
+
194
+ if (get_option('mep_video_skin') != '') {
195
+ wp_enqueue_style("mediaelementjs-skins", MEDIAELEMENTJS_DIR ."mejs-skins.css");
196
+ }
197
  }
198
  }
199
  add_action('wp_print_styles', 'mejs_add_styles');
244
  'flv' => '',
245
  'ogg' => '',
246
  'poster' => '',
247
+ 'width' => get_option('mep_default_'.$tagName.'_width'),
248
+ 'height' => get_option('mep_default_'.$tagName.'_height'),
249
  'type' => get_option('mep_default_'.$tagName.'_type'),
250
  'preload' => 'none',
251
+ 'skin' => get_option('mep_video_skin'),
252
  'autoplay' => '',
253
  'loop' => '',
254
 
267
  $type_attribute = 'type="'.$type.'"';
268
  }
269
 
270
+ /*
271
  if ($src) {
272
  $src_attribute = 'src="'.htmlspecialchars($src).'"';
273
  $flash_src = htmlspecialchars($src);
274
  }
275
+ */
276
+
277
+ if ($src) {
278
+
279
+ // does it have an extension?
280
+ if (substr($src, strlen($src)-4, 1)=='.') {
281
+ $src_attribute = 'src="'.htmlspecialchars($src).'"';
282
+ $flash_src = htmlspecialchars($src);
283
+ } else {
284
+
285
+ // for missing extension, we try to find all possible files in the system
286
+
287
+ if (substr($src, 0, 4)!='http')
288
+ $filename = WP_CONTENT_DIR . substr($src, strlen(WP_CONTENT_DIR)-strrpos(WP_CONTENT_DIR, '/'));
289
+ else
290
+ $filename = WP_CONTENT_DIR . substr($src, strlen(WP_CONTENT_URL));
291
+
292
+ if ($tagName == 'video') {
293
+ // MP4
294
+ if (file_exists($filename.'.mp4')) {
295
+ $mp4=$src.'.mp4';
296
+ } elseif (file_exists($filename.'.m4v')) {
297
+ $mp4=$src.'.m4v';
298
+ }
299
+
300
+ // WEBM
301
+ if (file_exists($filename.'.webm')) {
302
+ $webm=$src.'.webm';
303
+ }
304
+
305
+ // OGG
306
+ if (file_exists($filename.'.ogg')) {
307
+ $ogg=$src.'.ogg';
308
+ } elseif (file_exists($filename.'.ogv')) {
309
+ $ogg=$src.'.ogv';
310
+ }
311
+
312
+ // FLV
313
+ if (file_exists($filename.'.flv')) {
314
+ $flv=$src.'.flv';
315
+ }
316
+
317
+ // WMV
318
+ if (file_exists($filename.'.wmv')) {
319
+ $wmv=$src.'.wmv';
320
+ }
321
+
322
+ // POSTER
323
+ if (file_exists($filename.'.jpg')) {
324
+ $poster=$src.'.jpg';
325
+ }
326
+
327
+ } elseif ($tagName == 'audio') {
328
+
329
+ // MP3
330
+ if (file_exists($filename.'.mp3')) {
331
+ $mp3=$src.'.mp3';
332
+ }
333
+
334
+ // OGG
335
+ if (file_exists($filename.'.ogg')) {
336
+ $ogg=$src.'.ogg';
337
+ } elseif (file_exists($filename.'.oga')) {
338
+ $ogg=$src.'.oga';
339
+ }
340
+
341
+ }
342
+ }
343
+ }
344
+
345
+
346
 
347
  if ($mp4) {
348
  $mp4_source = '<source src="'.htmlspecialchars($mp4).'" type="'.$tagName.'/mp4" />';
411
  if ($fullscreen == 'true')
412
  $controls_option .= ",'fullscreen'";
413
  $controls_option .= "]";
414
+
415
+ // AUDIO SIZE
416
+ $audio_size = '';
417
+ if ($tagName == 'audio') {
418
+ $audio_size = ',audioWidth:'.$width.',audioHeight:'.$height;
419
+ }
420
+
421
+ // VIDEO class (skin)
422
+ $video_skin_attribute = '';
423
+ if ($skin != '' && $tagName == 'video') {
424
+ $video_skin_attribute = 'class="mejs-'.$skin.'"';
425
+ }
426
 
427
  $mediahtml .= <<<_end_
428
+ <{$tagName} id="wp_mep_{$mediaElementPlayerIndex}" {$src_attribute} {$type_attribute} {$width_attribute} {$height_attribute} {$poster_attribute} controls="controls" {$preload_attribute} {$autoplay_attribute} $video_skin_attribute>
429
  {$mp4_source}
430
  {$mp3_source}
431
  {$webm_source}
433
  {$wmv_source}
434
  {$ogg_source}
435
  {$captions_source}
436
+ <object width="{$width}" height="{$height}" type="application/x-shockwave-flash" data="{$dir}flashmediaelement.swf">
437
  <param name="movie" value="{$dir}flashmediaelement.swf" />
438
  <param name="flashvars" value="controls=true&amp;file={$flash_src}" />
439
  </object>
444
  m:1
445
  {$loop_option}
446
  {$controls_option}
447
+ {$audio_size}
448
  });
449
  });
450
  </script>
mediaelement/background.png ADDED
Binary file
mediaelement/bigplay.png ADDED
Binary file
mediaelement/controls-ted.png ADDED
Binary file
mediaelement/controls-wmp-bg.png ADDED
Binary file
mediaelement/controls-wmp.png ADDED
Binary file
mediaelement/controls.png ADDED
Binary file
mediaelement/flashmediaelement.swf ADDED
Binary file
mediaelement/loading.gif ADDED
Binary file
mediaelement/mediaelement-and-player.js ADDED
@@ -0,0 +1,2591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * MediaElement.js
3
+ * HTML5 <video> and <audio> shim and player
4
+ * http://mediaelementjs.com/
5
+ *
6
+ * Creates a JavaScript object that mimics HTML5 MediaElement API
7
+ * for browsers that don't understand HTML5 or can't play the provided codec
8
+ * Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
9
+ *
10
+ * Copyright 2010-2011, John Dyer (http://j.hn)
11
+ * Dual licensed under the MIT or GPL Version 2 licenses.
12
+ *
13
+ */
14
+ // Namespace
15
+ var mejs = mejs || {};
16
+
17
+ // version number
18
+ mejs.version = '2.1.7';
19
+
20
+ // player number (for missing, same id attr)
21
+ mejs.meIndex = 0;
22
+
23
+ // media types accepted by plugins
24
+ mejs.plugins = {
25
+ silverlight: [
26
+ {version: [3,0], types: ['video/mp4','video/m4v','video/mov','video/wmv','audio/wma','audio/m4a','audio/mp3','audio/wav','audio/mpeg']}
27
+ ],
28
+ flash: [
29
+ {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']}
30
+ //,{version: [11,0], types: ['video/webm']} // for future reference
31
+ ]
32
+ };
33
+
34
+ /*
35
+ Utility methods
36
+ */
37
+ mejs.Utility = {
38
+ encodeUrl: function(url) {
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');
46
+ el.innerHTML = '<a href="' + this.escapeHTML(url) + '">x</a>';
47
+ return el.firstChild.href;
48
+ },
49
+ getScriptPath: function(scriptNames) {
50
+ var
51
+ i = 0,
52
+ j,
53
+ path = '',
54
+ name = '',
55
+ script,
56
+ scripts = document.getElementsByTagName('script');
57
+
58
+ for (; i < scripts.length; i++) {
59
+ script = scripts[i].src;
60
+ for (j = 0; j < scriptNames.length; j++) {
61
+ name = scriptNames[j];
62
+ if (script.indexOf(name) > -1) {
63
+ path = script.substring(0, script.indexOf(name));
64
+ break;
65
+ }
66
+ }
67
+ if (path !== '') {
68
+ break;
69
+ }
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
+
93
+
94
+ // Core detector, plugins are added below
95
+ mejs.PluginDetector = {
96
+
97
+ // main public function to test a plug version number PluginDetector.hasPluginVersion('flash',[9,0,125]);
98
+ hasPluginVersion: function(plugin, v) {
99
+ var pv = this.plugins[plugin];
100
+ v[1] = v[1] || 0;
101
+ v[2] = v[2] || 0;
102
+ return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
103
+ },
104
+
105
+ // cached values
106
+ nav: window.navigator,
107
+ ua: window.navigator.userAgent.toLowerCase(),
108
+
109
+ // stored version numbers
110
+ plugins: [],
111
+
112
+ // runs detectPlugin() and stores the version number
113
+ addPlugin: function(p, pluginName, mimeType, activeX, axDetect) {
114
+ this.plugins[p] = this.detectPlugin(pluginName, mimeType, activeX, axDetect);
115
+ },
116
+
117
+ // get the version number from the mimetype (all but IE) or ActiveX (IE)
118
+ detectPlugin: function(pluginName, mimeType, activeX, axDetect) {
119
+
120
+ var version = [0,0,0],
121
+ description,
122
+ i,
123
+ ax;
124
+
125
+ // Firefox, Webkit, Opera
126
+ if (typeof(this.nav.plugins) != 'undefined' && typeof this.nav.plugins[pluginName] == 'object') {
127
+ description = this.nav.plugins[pluginName].description;
128
+ if (description && !(typeof this.nav.mimeTypes != 'undefined' && this.nav.mimeTypes[mimeType] && !this.nav.mimeTypes[mimeType].enabledPlugin)) {
129
+ version = description.replace(pluginName, '').replace(/^\s+/,'').replace(/\sr/gi,'.').split('.');
130
+ for (i=0; i<version.length; i++) {
131
+ version[i] = parseInt(version[i].match(/\d+/), 10);
132
+ }
133
+ }
134
+ // Internet Explorer / ActiveX
135
+ } else if (typeof(window.ActiveXObject) != 'undefined') {
136
+ try {
137
+ ax = new ActiveXObject(activeX);
138
+ if (ax) {
139
+ version = axDetect(ax);
140
+ }
141
+ }
142
+ catch (e) { }
143
+ }
144
+ return version;
145
+ }
146
+ };
147
+
148
+ // Add Flash detection
149
+ mejs.PluginDetector.addPlugin('flash','Shockwave Flash','application/x-shockwave-flash','ShockwaveFlash.ShockwaveFlash', function(ax) {
150
+ // adapted from SWFObject
151
+ var version = [],
152
+ d = ax.GetVariable("$version");
153
+ if (d) {
154
+ d = d.split(" ")[1].split(",");
155
+ version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
156
+ }
157
+ return version;
158
+ });
159
+
160
+ // Add Silverlight detection
161
+ mejs.PluginDetector.addPlugin('silverlight','Silverlight Plug-In','application/x-silverlight-2','AgControl.AgControl', function (ax) {
162
+ // Silverlight cannot report its version number to IE
163
+ // but it does have a isVersionSupported function, so we have to loop through it to get a version number.
164
+ // adapted from http://www.silverlightversion.com/
165
+ var v = [0,0,0,0],
166
+ loopMatch = function(ax, v, i, n) {
167
+ while(ax.isVersionSupported(v[0]+ "."+ v[1] + "." + v[2] + "." + v[3])){
168
+ v[i]+=n;
169
+ }
170
+ v[i] -= n;
171
+ };
172
+ loopMatch(ax, v, 0, 1);
173
+ loopMatch(ax, v, 1, 1);
174
+ loopMatch(ax, v, 2, 10000); // the third place in the version number is usually 5 digits (4.0.xxxxx)
175
+ loopMatch(ax, v, 2, 1000);
176
+ loopMatch(ax, v, 2, 100);
177
+ loopMatch(ax, v, 2, 10);
178
+ loopMatch(ax, v, 2, 1);
179
+ loopMatch(ax, v, 3, 1);
180
+
181
+ return v;
182
+ });
183
+ // add adobe acrobat
184
+ /*
185
+ PluginDetector.addPlugin('acrobat','Adobe Acrobat','application/pdf','AcroPDF.PDF', function (ax) {
186
+ var version = [],
187
+ d = ax.GetVersions().split(',')[0].split('=')[1].split('.');
188
+
189
+ if (d) {
190
+ version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
191
+ }
192
+ return version;
193
+ });
194
+ */
195
+
196
+ // special case for Android which sadly doesn't implement the canPlayType function (always returns '')
197
+ if (mejs.PluginDetector.ua.match(/android 2\.[12]/) !== null) {
198
+ HTMLMediaElement.canPlayType = function(type) {
199
+ return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'probably' : '';
200
+ };
201
+ }
202
+
203
+ // necessary detection (fixes for <IE9)
204
+ mejs.MediaFeatures = {
205
+ init: function() {
206
+ var
207
+ nav = mejs.PluginDetector.nav,
208
+ ua = mejs.PluginDetector.ua.toLowerCase(),
209
+ i,
210
+ v,
211
+ html5Elements = ['source','track','audio','video'];
212
+
213
+ // detect browsers (only the ones that have some kind of quirk we need to work around)
214
+ this.isiPad = (ua.match(/ipad/i) !== null);
215
+ this.isiPhone = (ua.match(/iphone/i) !== null);
216
+ this.isAndroid = (ua.match(/android/i) !== null);
217
+ this.isIE = (nav.appName.toLowerCase().indexOf("microsoft") != -1);
218
+ this.isChrome = (ua.match(/chrome/gi) !== null);
219
+
220
+ // create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
221
+ for (i=0; i<html5Elements.length; i++) {
222
+ v = document.createElement(html5Elements[i]);
223
+ }
224
+
225
+ // detect native JavaScript fullscreen (Safari only, Chrome fails)
226
+ this.hasNativeFullScreen = (typeof v.webkitEnterFullScreen !== 'undefined');
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();
237
+
238
+
239
+ /*
240
+ extension methods to <video> or <audio> object to bring it into parity with PluginMediaElement (see below)
241
+ */
242
+ mejs.HtmlMediaElement = {
243
+ pluginType: 'native',
244
+ isFullScreen: false,
245
+
246
+ setCurrentTime: function (time) {
247
+ this.currentTime = time;
248
+ },
249
+
250
+ setMuted: function (muted) {
251
+ this.muted = muted;
252
+ },
253
+
254
+ setVolume: function (volume) {
255
+ this.volume = volume;
256
+ },
257
+
258
+ // for parity with the plugin versions
259
+ stop: function () {
260
+ this.pause();
261
+ },
262
+
263
+ // This can be a url string
264
+ // or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
265
+ setSrc: function (url) {
266
+ if (typeof url == 'string') {
267
+ this.src = url;
268
+ } else {
269
+ var i, media;
270
+
271
+ for (i=0; i<url.length; i++) {
272
+ media = url[i];
273
+ if (this.canPlayType(media.type)) {
274
+ this.src = media.src;
275
+ }
276
+ }
277
+ }
278
+ },
279
+
280
+ setVideoSize: function (width, height) {
281
+ this.width = width;
282
+ this.height = height;
283
+ }
284
+ };
285
+
286
+ /*
287
+ Mimics the <video/audio> element by calling Flash's External Interface or Silverlights [ScriptableMember]
288
+ */
289
+ mejs.PluginMediaElement = function (pluginid, pluginType, mediaUrl) {
290
+ this.id = pluginid;
291
+ this.pluginType = pluginType;
292
+ this.src = mediaUrl;
293
+ this.events = {};
294
+ };
295
+
296
+ // JavaScript values and ExternalInterface methods that match HTML5 video properties methods
297
+ // http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/fl/video/FLVPlayback.html
298
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
299
+ mejs.PluginMediaElement.prototype = {
300
+
301
+ // special
302
+ pluginElement: null,
303
+ pluginType: '',
304
+ isFullScreen: false,
305
+
306
+ // not implemented :(
307
+ playbackRate: -1,
308
+ defaultPlaybackRate: -1,
309
+ seekable: [],
310
+ played: [],
311
+
312
+ // HTML5 read-only properties
313
+ paused: true,
314
+ ended: false,
315
+ seeking: false,
316
+ duration: 0,
317
+ error: null,
318
+
319
+ // HTML5 get/set properties, but only set (updated by event handlers)
320
+ muted: false,
321
+ volume: 1,
322
+ currentTime: 0,
323
+
324
+ // HTML5 methods
325
+ play: function () {
326
+ if (this.pluginApi != null) {
327
+ this.pluginApi.playMedia();
328
+ this.paused = false;
329
+ }
330
+ },
331
+ load: function () {
332
+ if (this.pluginApi != null) {
333
+ this.pluginApi.loadMedia();
334
+ this.paused = false;
335
+ }
336
+ },
337
+ pause: function () {
338
+ if (this.pluginApi != null) {
339
+ this.pluginApi.pauseMedia();
340
+ this.paused = true;
341
+ }
342
+ },
343
+ stop: function () {
344
+ if (this.pluginApi != null) {
345
+ this.pluginApi.stopMedia();
346
+ this.paused = true;
347
+ }
348
+ },
349
+ canPlayType: function(type) {
350
+ var i,
351
+ j,
352
+ pluginInfo,
353
+ pluginVersions = mejs.plugins[this.pluginType];
354
+
355
+ for (i=0; i<pluginVersions.length; i++) {
356
+ pluginInfo = pluginVersions[i];
357
+
358
+ // test if user has the correct plugin version
359
+ if (mejs.PluginDetector.hasPluginVersion(this.pluginType, pluginInfo.version)) {
360
+
361
+ // test for plugin playback types
362
+ for (j=0; j<pluginInfo.types.length; j++) {
363
+ // find plugin that can play the type
364
+ if (type == pluginInfo.types[j]) {
365
+ return true;
366
+ }
367
+ }
368
+ }
369
+ }
370
+
371
+ return false;
372
+ },
373
+
374
+ // custom methods since not all JavaScript implementations support get/set
375
+
376
+ // This can be a url string
377
+ // or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
378
+ setSrc: function (url) {
379
+ if (typeof url == 'string') {
380
+ this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(url));
381
+ this.src = mejs.Utility.absolutizeUrl(url);
382
+ } else {
383
+ var i, media;
384
+
385
+ for (i=0; i<url.length; i++) {
386
+ media = url[i];
387
+ if (this.canPlayType(media.type)) {
388
+ this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
389
+ this.src = mejs.Utility.absolutizeUrl(url);
390
+ }
391
+ }
392
+ }
393
+
394
+ },
395
+ setCurrentTime: function (time) {
396
+ if (this.pluginApi != null) {
397
+ this.pluginApi.setCurrentTime(time);
398
+ this.currentTime = time;
399
+ }
400
+ },
401
+ setVolume: function (volume) {
402
+ if (this.pluginApi != null) {
403
+ this.pluginApi.setVolume(volume);
404
+ this.volume = volume;
405
+ }
406
+ },
407
+ setMuted: function (muted) {
408
+ if (this.pluginApi != null) {
409
+ this.pluginApi.setMuted(muted);
410
+ this.muted = muted;
411
+ }
412
+ },
413
+
414
+ // additional non-HTML5 methods
415
+ setVideoSize: function (width, height) {
416
+ if ( this.pluginElement.style) {
417
+ this.pluginElement.style.width = width + 'px';
418
+ this.pluginElement.style.height = height + 'px';
419
+ }
420
+ if (this.pluginApi != null) {
421
+ this.pluginApi.setVideoSize(width, height);
422
+ }
423
+ },
424
+
425
+ setFullscreen: function (fullscreen) {
426
+ if (this.pluginApi != null) {
427
+ this.pluginApi.setFullscreen(fullscreen);
428
+ }
429
+ },
430
+
431
+ // start: fake events
432
+ addEventListener: function (eventName, callback, bubble) {
433
+ this.events[eventName] = this.events[eventName] || [];
434
+ this.events[eventName].push(callback);
435
+ },
436
+ removeEventListener: function (eventName, callback) {
437
+ if (!eventName) { this.events = {}; return true; }
438
+ var callbacks = this.events[eventName];
439
+ if (!callbacks) return true;
440
+ if (!callback) { this.events[eventName] = []; return true; }
441
+ for (i = 0; i < callbacks.length; i++) {
442
+ if (callbacks[i] === callback) {
443
+ this.events[eventName].splice(i, 1);
444
+ return true;
445
+ }
446
+ }
447
+ return false;
448
+ },
449
+ dispatchEvent: function (eventName) {
450
+ var i,
451
+ args,
452
+ callbacks = this.events[eventName];
453
+
454
+ if (callbacks) {
455
+ args = Array.prototype.slice.call(arguments, 1);
456
+ for (i = 0; i < callbacks.length; i++) {
457
+ callbacks[i].apply(null, args);
458
+ }
459
+ }
460
+ }
461
+ // end: fake events
462
+ };
463
+
464
+
465
+ // Handles calls from Flash/Silverlight and reports them as native <video/audio> events and properties
466
+ mejs.MediaPluginBridge = {
467
+
468
+ pluginMediaElements:{},
469
+ htmlMediaElements:{},
470
+
471
+ registerPluginElement: function (id, pluginMediaElement, htmlMediaElement) {
472
+ this.pluginMediaElements[id] = pluginMediaElement;
473
+ this.htmlMediaElements[id] = htmlMediaElement;
474
+ },
475
+
476
+ // when Flash/Silverlight is ready, it calls out to this method
477
+ initPlugin: function (id) {
478
+
479
+ var pluginMediaElement = this.pluginMediaElements[id],
480
+ htmlMediaElement = this.htmlMediaElements[id];
481
+
482
+ // find the javascript bridge
483
+ switch (pluginMediaElement.pluginType) {
484
+ case "flash":
485
+ pluginMediaElement.pluginElement = pluginMediaElement.pluginApi = document.getElementById(id);
486
+ break;
487
+ case "silverlight":
488
+ pluginMediaElement.pluginElement = document.getElementById(pluginMediaElement.id);
489
+ pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
490
+ break;
491
+ }
492
+
493
+ if (pluginMediaElement.pluginApi != null && pluginMediaElement.success) {
494
+ pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
495
+ }
496
+ },
497
+
498
+ // receives events from Flash/Silverlight and sends them out as HTML5 media events
499
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
500
+ fireEvent: function (id, eventName, values) {
501
+
502
+ var
503
+ e,
504
+ i,
505
+ bufferedTime,
506
+ pluginMediaElement = this.pluginMediaElements[id];
507
+
508
+ pluginMediaElement.ended = false;
509
+ pluginMediaElement.paused = true;
510
+
511
+ // fake event object to mimic real HTML media event.
512
+ e = {
513
+ type: eventName,
514
+ target: pluginMediaElement
515
+ };
516
+
517
+ // attach all values to element and event object
518
+ for (i in values) {
519
+ pluginMediaElement[i] = values[i];
520
+ e[i] = values[i];
521
+ }
522
+
523
+ // fake the newer W3C buffered TimeRange (loaded and total have been removed)
524
+ bufferedTime = values.bufferedTime || 0;
525
+
526
+ e.target.buffered = e.buffered = {
527
+ start: function(index) {
528
+ return 0;
529
+ },
530
+ end: function (index) {
531
+ return bufferedTime;
532
+ },
533
+ length: 1
534
+ };
535
+
536
+ pluginMediaElement.dispatchEvent(e.type, e);
537
+ }
538
+ };
539
+
540
+ /*
541
+ Default options
542
+ */
543
+ mejs.MediaElementDefaults = {
544
+ // allows testing on HTML5, flash, silverlight
545
+ // auto: attempts to detect what the browser can do
546
+ // native: forces HTML5 playback
547
+ // shim: disallows HTML5, will attempt either Flash or Silverlight
548
+ // none: forces fallback view
549
+ mode: 'auto',
550
+ // remove or reorder to change plugin priority and availability
551
+ plugins: ['flash','silverlight'],
552
+ // shows debug errors on screen
553
+ enablePluginDebug: false,
554
+ // overrides the type specified, useful for dynamic instantiation
555
+ type: '',
556
+ // path to Flash and Silverlight plugins
557
+ pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
558
+ // name of flash file
559
+ flashName: 'flashmediaelement.swf',
560
+ // turns on the smoothing filter in Flash
561
+ enablePluginSmoothing: false,
562
+ // name of silverlight file
563
+ silverlightName: 'silverlightmediaelement.xap',
564
+ // default if the <video width> is not specified
565
+ defaultVideoWidth: 480,
566
+ // default if the <video height> is not specified
567
+ defaultVideoHeight: 270,
568
+ // overrides <video width>
569
+ pluginWidth: -1,
570
+ // overrides <video height>
571
+ pluginHeight: -1,
572
+ // rate in milliseconds for Flash and Silverlight to fire the timeupdate event
573
+ // larger number is less accurate, but less strain on plugin->JavaScript bridge
574
+ timerRate: 250,
575
+ success: function () { },
576
+ error: function () { }
577
+ };
578
+
579
+ /*
580
+ Determines if a browser supports the <video> or <audio> element
581
+ and returns either the native element or a Flash/Silverlight version that
582
+ mimics HTML5 MediaElement
583
+ */
584
+ mejs.MediaElement = function (el, o) {
585
+ return mejs.HtmlMediaElementShim.create(el,o);
586
+ };
587
+
588
+ mejs.HtmlMediaElementShim = {
589
+
590
+ create: function(el, o) {
591
+ var
592
+ options = mejs.MediaElementDefaults,
593
+ htmlMediaElement = (typeof(el) == 'string') ? document.getElementById(el) : el,
594
+ isVideo = (htmlMediaElement.tagName.toLowerCase() == 'video'),
595
+ supportsMediaTag = (typeof(htmlMediaElement.canPlayType) != 'undefined'),
596
+ playback = {method:'', url:''},
597
+ poster = htmlMediaElement.getAttribute('poster'),
598
+ autoplay = htmlMediaElement.getAttribute('autoplay'),
599
+ preload = htmlMediaElement.getAttribute('preload'),
600
+ controls = htmlMediaElement.getAttribute('controls'),
601
+ prop;
602
+
603
+ // extend options
604
+ for (prop in o) {
605
+ options[prop] = o[prop];
606
+ }
607
+
608
+ // check for real poster
609
+ poster = (typeof poster == 'undefined' || poster === null) ? '' : poster;
610
+ preload = (typeof preload == 'undefined' || preload === null || preload === 'false') ? 'none' : preload;
611
+ autoplay = !(typeof autoplay == 'undefined' || autoplay === null || autoplay === 'false');
612
+ controls = !(typeof controls == 'undefined' || controls === null || controls === 'false');
613
+
614
+ // test for HTML5 and plugin capabilities
615
+ playback = this.determinePlayback(htmlMediaElement, options, isVideo, supportsMediaTag);
616
+
617
+ if (playback.method == 'native') {
618
+ // add methods to native HTMLMediaElement
619
+ return this.updateNative( htmlMediaElement, options, autoplay, preload, playback);
620
+ } else if (playback.method !== '') {
621
+ // create plugin to mimic HTMLMediaElement
622
+ return this.createPlugin( htmlMediaElement, options, isVideo, playback.method, (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '', poster, autoplay, preload, controls);
623
+ } else {
624
+ // boo, no HTML5, no Flash, no Silverlight.
625
+ this.createErrorMessage( htmlMediaElement, options, (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '', poster );
626
+ }
627
+ },
628
+
629
+ determinePlayback: function(htmlMediaElement, options, isVideo, supportsMediaTag) {
630
+ var
631
+ mediaFiles = [],
632
+ i,
633
+ j,
634
+ k,
635
+ l,
636
+ n,
637
+ type,
638
+ result = { method: '', url: ''},
639
+ src = htmlMediaElement.getAttribute('src'),
640
+ pluginName,
641
+ pluginVersions,
642
+ pluginInfo;
643
+
644
+ // clean up src attr
645
+ if (src == 'undefined' || src == '' || src === null)
646
+ src = null;
647
+
648
+ // STEP 1: Get URL and type from <video src> or <source src>
649
+
650
+ // supplied type overrides all HTML
651
+ if (typeof (options.type) != 'undefined' && options.type !== '') {
652
+ mediaFiles.push({type:options.type, url:src});
653
+
654
+ // test for src attribute first
655
+ } else if (src !== null) {
656
+ type = this.checkType(src, htmlMediaElement.getAttribute('type'), isVideo);
657
+ mediaFiles.push({type:type, url:src});
658
+
659
+ // then test for <source> elements
660
+ } else {
661
+ // test <source> types to see if they are usable
662
+ for (i = 0; i < htmlMediaElement.childNodes.length; i++) {
663
+ n = htmlMediaElement.childNodes[i];
664
+ if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
665
+ src = n.getAttribute('src');
666
+ type = this.checkType(src, n.getAttribute('type'), isVideo);
667
+ mediaFiles.push({type:type, url:src});
668
+ }
669
+ }
670
+ }
671
+
672
+ // STEP 2: Test for playback method
673
+
674
+ // test for native playback first
675
+ if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'native')) {
676
+ for (i=0; i<mediaFiles.length; i++) {
677
+ // normal check
678
+ if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
679
+ // special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
680
+ || htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== '') {
681
+ result.method = 'native';
682
+ result.url = mediaFiles[i].url;
683
+ return result;
684
+ }
685
+ }
686
+ }
687
+
688
+ // if native playback didn't work, then test plugins
689
+ if (options.mode === 'auto' || options.mode === 'shim') {
690
+ for (i=0; i<mediaFiles.length; i++) {
691
+ type = mediaFiles[i].type;
692
+
693
+ // test all plugins in order of preference [silverlight, flash]
694
+ for (j=0; j<options.plugins.length; j++) {
695
+
696
+ pluginName = options.plugins[j];
697
+
698
+ // test version of plugin (for future features)
699
+ pluginVersions = mejs.plugins[pluginName];
700
+ for (k=0; k<pluginVersions.length; k++) {
701
+ pluginInfo = pluginVersions[k];
702
+
703
+ // test if user has the correct plugin version
704
+ if (mejs.PluginDetector.hasPluginVersion(pluginName, pluginInfo.version)) {
705
+
706
+ // test for plugin playback types
707
+ for (l=0; l<pluginInfo.types.length; l++) {
708
+ // find plugin that can play the type
709
+ if (type == pluginInfo.types[l]) {
710
+ result.method = pluginName;
711
+ result.url = mediaFiles[i].url;
712
+ return result;
713
+ }
714
+ }
715
+ }
716
+ }
717
+ }
718
+ }
719
+ }
720
+
721
+ // what if there's nothing to play? just grab the first available
722
+ if (result.method === '') {
723
+ result.url = mediaFiles[0].url;
724
+ }
725
+
726
+ return result;
727
+ },
728
+
729
+ checkType: function(url, type, isVideo) {
730
+ var ext;
731
+
732
+ // if no type is supplied, fake it with the extension
733
+ if (url && !type) {
734
+ ext = url.substring(url.lastIndexOf('.') + 1);
735
+ return ((isVideo) ? 'video' : 'audio') + '/' + ext;
736
+ } else {
737
+ // only return the mime part of the type in case the attribute contains the codec
738
+ // see http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-source-element
739
+ // `video/mp4; codecs="avc1.42E01E, mp4a.40.2"` becomes `video/mp4`
740
+
741
+ if (type && ~type.indexOf(';')) {
742
+ return type.substr(0, type.indexOf(';'));
743
+ } else {
744
+ return type;
745
+ }
746
+ }
747
+ },
748
+
749
+ createErrorMessage: function(htmlMediaElement, options, downloadUrl, poster) {
750
+ var errorContainer = document.createElement('div');
751
+ errorContainer.className = 'me-cannotplay';
752
+
753
+ try {
754
+ errorContainer.style.width = htmlMediaElement.width + 'px';
755
+ errorContainer.style.height = htmlMediaElement.height + 'px';
756
+ } catch (e) {}
757
+
758
+ errorContainer.innerHTML = (poster !== '') ?
759
+ '<a href="' + downloadUrl + '"><img src="' + poster + '" /></a>' :
760
+ '<a href="' + downloadUrl + '"><span>Download File</span></a>';
761
+
762
+ htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
763
+ htmlMediaElement.style.display = 'none';
764
+
765
+ options.error(htmlMediaElement);
766
+ },
767
+
768
+ createPlugin:function(htmlMediaElement, options, isVideo, pluginType, mediaUrl, poster, autoplay, preload, controls) {
769
+ var width = 1,
770
+ height = 1,
771
+ pluginid = 'me_' + pluginType + '_' + (mejs.meIndex++),
772
+ pluginMediaElement = new mejs.PluginMediaElement(pluginid, pluginType, mediaUrl),
773
+ container = document.createElement('div'),
774
+ specialIEContainer,
775
+ node,
776
+ initVars;
777
+
778
+ // check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
779
+ node = htmlMediaElement.parentNode;
780
+ while (node !== null && node.tagName.toLowerCase() != 'body') {
781
+ if (node.parentNode.tagName.toLowerCase() == 'p') {
782
+ node.parentNode.parentNode.insertBefore(node, node.parentNode);
783
+ break;
784
+ }
785
+ node = node.parentNode;
786
+ }
787
+
788
+ if (isVideo) {
789
+ width = (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
790
+ height = (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
791
+ } else {
792
+ if (options.enablePluginDebug) {
793
+ width = 320;
794
+ height = 240;
795
+ }
796
+ }
797
+
798
+ // register plugin
799
+ pluginMediaElement.success = options.success;
800
+ mejs.MediaPluginBridge.registerPluginElement(pluginid, pluginMediaElement, htmlMediaElement);
801
+
802
+ // add container (must be added to DOM before inserting HTML for IE)
803
+ container.className = 'me-plugin';
804
+ htmlMediaElement.parentNode.insertBefore(container, htmlMediaElement);
805
+
806
+ // flash/silverlight vars
807
+ initVars = [
808
+ 'id=' + pluginid,
809
+ 'isvideo=' + ((isVideo) ? "true" : "false"),
810
+ 'autoplay=' + ((autoplay) ? "true" : "false"),
811
+ 'preload=' + preload,
812
+ 'width=' + width,
813
+ 'startvolume=' + options.startVolume,
814
+ 'timerrate=' + options.timerRate,
815
+ 'height=' + height];
816
+
817
+ if (mediaUrl !== null) {
818
+ if (pluginType == 'flash') {
819
+ initVars.push('file=' + mejs.Utility.encodeUrl(mediaUrl));
820
+ } else {
821
+ initVars.push('file=' + mediaUrl);
822
+ }
823
+ }
824
+ if (options.enablePluginDebug) {
825
+ initVars.push('debug=true');
826
+ }
827
+ if (options.enablePluginSmoothing) {
828
+ initVars.push('smoothing=true');
829
+ }
830
+ if (controls) {
831
+ initVars.push('controls=true'); // shows controls in the plugin if desired
832
+ }
833
+
834
+ switch (pluginType) {
835
+ case 'silverlight':
836
+ container.innerHTML =
837
+ '<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + pluginid + '" name="' + pluginid + '" width="' + width + '" height="' + height + '">' +
838
+ '<param name="initParams" value="' + initVars.join(',') + '" />' +
839
+ '<param name="windowless" value="true" />' +
840
+ '<param name="background" value="black" />' +
841
+ '<param name="minRuntimeVersion" value="3.0.0.0" />' +
842
+ '<param name="autoUpgrade" value="true" />' +
843
+ '<param name="source" value="' + options.pluginPath + options.silverlightName + '" />' +
844
+ '</object>';
845
+ break;
846
+
847
+ case 'flash':
848
+
849
+ if (mejs.MediaFeatures.isIE) {
850
+ specialIEContainer = document.createElement('div');
851
+ container.appendChild(specialIEContainer);
852
+ specialIEContainer.outerHTML =
853
+ '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
854
+ 'id="' + pluginid + '" width="' + width + '" height="' + height + '">' +
855
+ '<param name="movie" value="' + options.pluginPath + options.flashName + '?x=' + (new Date()) + '" />' +
856
+ '<param name="flashvars" value="' + initVars.join('&amp;') + '" />' +
857
+ '<param name="quality" value="high" />' +
858
+ '<param name="bgcolor" value="#000000" />' +
859
+ '<param name="wmode" value="transparent" />' +
860
+ '<param name="allowScriptAccess" value="always" />' +
861
+ '<param name="allowFullScreen" value="true" />' +
862
+ '</object>';
863
+
864
+ } else {
865
+
866
+ container.innerHTML =
867
+ '<embed id="' + pluginid + '" name="' + pluginid + '" ' +
868
+ 'play="true" ' +
869
+ 'loop="false" ' +
870
+ 'quality="high" ' +
871
+ 'bgcolor="#000000" ' +
872
+ 'wmode="transparent" ' +
873
+ 'allowScriptAccess="always" ' +
874
+ 'allowFullScreen="true" ' +
875
+ 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ' +
876
+ 'src="' + options.pluginPath + options.flashName + '" ' +
877
+ 'flashvars="' + initVars.join('&') + '" ' +
878
+ 'width="' + width + '" ' +
879
+ 'height="' + height + '"></embed>';
880
+ }
881
+ break;
882
+ }
883
+ // hide original element
884
+ htmlMediaElement.style.display = 'none';
885
+
886
+ // FYI: options.success will be fired by the MediaPluginBridge
887
+
888
+ return pluginMediaElement;
889
+ },
890
+
891
+ updateNative: function(htmlMediaElement, options, autoplay, preload, playback) {
892
+ // add methods to video object to bring it into parity with Flash Object
893
+ for (var m in mejs.HtmlMediaElement) {
894
+ htmlMediaElement[m] = mejs.HtmlMediaElement[m];
895
+ }
896
+
897
+ /*
898
+ Chrome now supports preload="none"
899
+ if (mejs.MediaFeatures.isChrome) {
900
+
901
+ // special case to enforce preload attribute (Chrome doesn't respect this)
902
+ if (preload === 'none' && !autoplay) {
903
+
904
+ // forces the browser to stop loading (note: fails in IE9)
905
+ htmlMediaElement.src = '';
906
+ htmlMediaElement.load();
907
+ htmlMediaElement.canceledPreload = true;
908
+
909
+ htmlMediaElement.addEventListener('play',function() {
910
+ if (htmlMediaElement.canceledPreload) {
911
+ htmlMediaElement.src = playback.url;
912
+ htmlMediaElement.load();
913
+ htmlMediaElement.play();
914
+ htmlMediaElement.canceledPreload = false;
915
+ }
916
+ }, false);
917
+ // for some reason Chrome forgets how to autoplay sometimes.
918
+ } else if (autoplay) {
919
+ htmlMediaElement.load();
920
+ htmlMediaElement.play();
921
+ }
922
+ }
923
+ */
924
+
925
+ // fire success code
926
+ options.success(htmlMediaElement, htmlMediaElement);
927
+
928
+ return htmlMediaElement;
929
+ }
930
+ };
931
+
932
+ window.mejs = mejs;
933
+ window.MediaElement = mejs.MediaElement;
934
+
935
+ /*!
936
+ * MediaElementPlayer
937
+ * http://mediaelementjs.com/
938
+ *
939
+ * Creates a controller bar for HTML5 <video> add <audio> tags
940
+ * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
941
+ *
942
+ * Copyright 2010-2011, John Dyer (http://j.hn/)
943
+ * Dual licensed under the MIT or GPL Version 2 licenses.
944
+ *
945
+ */
946
+ if (typeof jQuery != 'undefined') {
947
+ mejs.$ = jQuery;
948
+ } else if (typeof ender != 'undefined') {
949
+ mejs.$ = ender;
950
+ }
951
+ (function ($) {
952
+
953
+ // default player values
954
+ mejs.MepDefaults = {
955
+ // url to poster (to fix iOS 3.x)
956
+ poster: '',
957
+ // default if the <video width> is not specified
958
+ defaultVideoWidth: 480,
959
+ // default if the <video height> is not specified
960
+ defaultVideoHeight: 270,
961
+ // if set, overrides <video width>
962
+ videoWidth: -1,
963
+ // if set, overrides <video height>
964
+ videoHeight: -1,
965
+ // width of audio player
966
+ audioWidth: 400,
967
+ // height of audio player
968
+ audioHeight: 30,
969
+ // initial volume when the player starts (overrided by user cookie)
970
+ startVolume: 0.8,
971
+ // useful for <audio> player loops
972
+ loop: false,
973
+ // resize to media dimensions
974
+ enableAutosize: true,
975
+ // forces the hour marker (##:00:00)
976
+ alwaysShowHours: false,
977
+ // Hide controls when playing and mouse is not over the video
978
+ alwaysShowControls: false,
979
+ // features to show
980
+ features: ['playpause','current','progress','duration','tracks','volume','fullscreen']
981
+ };
982
+
983
+ mejs.mepIndex = 0;
984
+
985
+ // wraps a MediaElement object in player controls
986
+ mejs.MediaElementPlayer = function(node, o) {
987
+ // enforce object, even without "new" (via John Resig)
988
+ if ( !(this instanceof mejs.MediaElementPlayer) ) {
989
+ return new mejs.MediaElementPlayer(node, o);
990
+ }
991
+
992
+ var
993
+ t = this,
994
+ mf = mejs.MediaFeatures;
995
+
996
+ // create options
997
+ t.options = $.extend({},mejs.MepDefaults,o);
998
+ t.$media = t.$node = $(node);
999
+
1000
+ // these will be reset after the MediaElement.success fires
1001
+ t.node = t.media = t.$media[0];
1002
+
1003
+ // check for existing player
1004
+ if (typeof t.node.player != 'undefined') {
1005
+ return t.node.player;
1006
+ } else {
1007
+ // attach player to DOM node for reference
1008
+ t.node.player = t;
1009
+ }
1010
+
1011
+ t.isVideo = (t.media.tagName.toLowerCase() === 'video');
1012
+
1013
+ /* FUTURE WORK = create player without existing <video> or <audio> node
1014
+
1015
+ // if not a video or audio tag, then we'll dynamically create it
1016
+ if (tagName == 'video' || tagName == 'audio') {
1017
+ t.$media = $($node);
1018
+ } else if (o.tagName !== '' && o.src !== '') {
1019
+ // create a new node
1020
+ if (o.mode == 'auto' || o.mode == 'native') {
1021
+
1022
+ $media = $(o.tagName);
1023
+ if (typeof o.src == 'string') {
1024
+ $media.attr('src',o.src);
1025
+ } else if (typeof o.src == 'object') {
1026
+ // create source nodes
1027
+ for (var x in o.src) {
1028
+ $media.append($('<source src="' + o.src[x].src + '" type="' + o.src[x].type + '" />'));
1029
+ }
1030
+ }
1031
+ if (o.type != '') {
1032
+ $media.attr('type',o.type);
1033
+ }
1034
+ if (o.poster != '') {
1035
+ $media.attr('poster',o.poster);
1036
+ }
1037
+ if (o.videoWidth > 0) {
1038
+ $media.attr('width',o.videoWidth);
1039
+ }
1040
+ if (o.videoHeight > 0) {
1041
+ $media.attr('height',o.videoHeight);
1042
+ }
1043
+
1044
+ $node.clear();
1045
+ $node.append($media);
1046
+ t.$media = $media;
1047
+ } else if (o.mode == 'shim') {
1048
+ $media = $();
1049
+ // doesn't want a media node
1050
+ // let MediaElement object handle this
1051
+ }
1052
+ } else {
1053
+ // fail?
1054
+ return;
1055
+ }
1056
+ */
1057
+
1058
+ t.init();
1059
+
1060
+ return t;
1061
+ };
1062
+
1063
+ // actual player
1064
+ mejs.MediaElementPlayer.prototype = {
1065
+ init: function() {
1066
+
1067
+ var
1068
+ t = this,
1069
+ mf = mejs.MediaFeatures,
1070
+ // options for MediaElement (shim)
1071
+ meOptions = $.extend(true, {}, t.options, {
1072
+ success: function(media, domNode) { t.meReady(media, domNode); },
1073
+ error: function(e) { t.handleError(e);}
1074
+ });
1075
+
1076
+
1077
+ // use native controls in iPad, iPhone, and Android
1078
+ if (mf.isiPad || mf.isiPhone) {
1079
+ // add controls and stop
1080
+ t.$media.attr('controls', 'controls');
1081
+
1082
+ // fix iOS 3 bug
1083
+ t.$media.removeAttr('poster');
1084
+
1085
+ // override Apple's autoplay override for iPads
1086
+ if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
1087
+ t.media.load();
1088
+ t.media.play();
1089
+ }
1090
+
1091
+ } else if (mf.isAndroid) {
1092
+
1093
+ if (t.isVideo) {
1094
+ // Android fails when there are multiple source elements and the type is specified
1095
+ // <video>
1096
+ // <source src="file.mp4" type="video/mp4" />
1097
+ // <source src="file.webm" type="video/webm" />
1098
+ // </video>
1099
+ if (t.$media.find('source').length > 0) {
1100
+ // find an mp4 and make it the root element source
1101
+ t.media.src = t.$media.find('source[src$="mp4"]').attr('src');
1102
+ }
1103
+
1104
+ // attach a click event to the video and hope Android can play it
1105
+ t.$media.click(function() {
1106
+ t.media.play();
1107
+ });
1108
+
1109
+ } else {
1110
+ // audio?
1111
+ // 2.1 = no support
1112
+ // 2.2 = Flash support
1113
+ // 2.3 = Native HTML5
1114
+ }
1115
+
1116
+ } else {
1117
+
1118
+ // DESKTOP: use MediaElementPlayer controls
1119
+
1120
+ // remove native controls
1121
+ t.$media.removeAttr('controls');
1122
+
1123
+ // unique ID
1124
+ t.id = 'mep_' + mejs.mepIndex++;
1125
+
1126
+ // build container
1127
+ t.container =
1128
+ $('<div id="' + t.id + '" class="mejs-container">'+
1129
+ '<div class="mejs-inner">'+
1130
+ '<div class="mejs-mediaelement"></div>'+
1131
+ '<div class="mejs-layers"></div>'+
1132
+ '<div class="mejs-controls"></div>'+
1133
+ '<div class="mejs-clear"></div>'+
1134
+ '</div>' +
1135
+ '</div>')
1136
+ .addClass(t.$media[0].className)
1137
+ .insertBefore(t.$media);
1138
+
1139
+ // move the <video/video> tag into the right spot
1140
+ t.container.find('.mejs-mediaelement').append(t.$media);
1141
+
1142
+ // find parts
1143
+ t.controls = t.container.find('.mejs-controls');
1144
+ t.layers = t.container.find('.mejs-layers');
1145
+
1146
+ // determine the size
1147
+ if (t.isVideo) {
1148
+ // priority = videoWidth (forced), width attribute, defaultVideoWidth
1149
+ t.width = (t.options.videoWidth > 0) ? t.options.videoWidth : (t.$media[0].getAttribute('width') !== null) ? t.$media.attr('width') : t.options.defaultVideoWidth;
1150
+ t.height = (t.options.videoHeight > 0) ? t.options.videoHeight : (t.$media[0].getAttribute('height') !== null) ? t.$media.attr('height') : t.options.defaultVideoHeight;
1151
+ } else {
1152
+ t.width = t.options.audioWidth;
1153
+ t.height = t.options.audioHeight;
1154
+ }
1155
+
1156
+ // set the size, while we wait for the plugins to load below
1157
+ t.setPlayerSize(t.width, t.height);
1158
+
1159
+ // create MediaElementShim
1160
+ meOptions.pluginWidth = t.height;
1161
+ meOptions.pluginHeight = t.width;
1162
+ }
1163
+
1164
+ // create MediaElement shim
1165
+ mejs.MediaElement(t.$media[0], meOptions);
1166
+ },
1167
+
1168
+ // Sets up all controls and events
1169
+ meReady: function(media, domNode) {
1170
+
1171
+
1172
+ var t = this,
1173
+ mf = mejs.MediaFeatures,
1174
+ f,
1175
+ feature;
1176
+
1177
+ // make sure it can't create itself again if a plugin reloads
1178
+ if (this.created)
1179
+ return;
1180
+ else
1181
+ this.created = true;
1182
+
1183
+ t.media = media;
1184
+ t.domNode = domNode;
1185
+
1186
+ if (!mf.isiPhone && !mf.isAndroid && !mf.isiPad) {
1187
+
1188
+
1189
+ // two built in features
1190
+ t.buildposter(t, t.controls, t.layers, t.media);
1191
+ t.buildoverlays(t, t.controls, t.layers, t.media);
1192
+
1193
+ // grab for use by feautres
1194
+ t.findTracks();
1195
+
1196
+ // add user-defined features/controls
1197
+ for (f in t.options.features) {
1198
+ feature = t.options.features[f];
1199
+ if (t['build' + feature]) {
1200
+ try {
1201
+ t['build' + feature](t, t.controls, t.layers, t.media);
1202
+ } catch (e) {
1203
+ // TODO: report control error
1204
+ //throw e;
1205
+ }
1206
+ }
1207
+ }
1208
+
1209
+ // reset all layers and controls
1210
+ t.setPlayerSize(t.width, t.height);
1211
+ t.setControlsSize();
1212
+
1213
+ // controls fade
1214
+ if (t.isVideo) {
1215
+ // show/hide controls
1216
+ t.container
1217
+ .bind('mouseenter', function () {
1218
+ if (!t.options.alwaysShowControls) {
1219
+ t.controls.css('visibility','visible');
1220
+ t.controls.stop(true, true).fadeIn(200);
1221
+ }
1222
+ })
1223
+ .bind('mouseleave', function () {
1224
+ if (!t.media.paused && !t.options.alwaysShowControls) {
1225
+ t.controls.stop(true, true).fadeOut(200, function() {
1226
+ $(this).css('visibility','hidden');
1227
+ $(this).css('display','block');
1228
+ });
1229
+ }
1230
+ });
1231
+
1232
+ // check for autoplay
1233
+ if (t.domNode.getAttribute('autoplay') !== null && !t.options.alwaysShowControls) {
1234
+ t.controls.css('visibility','hidden');
1235
+ }
1236
+
1237
+ // resizer
1238
+ if (t.options.enableAutosize) {
1239
+ t.media.addEventListener('loadedmetadata', function(e) {
1240
+ // if the <video height> was not set and the options.videoHeight was not set
1241
+ // then resize to the real dimensions
1242
+ if (t.options.videoHeight <= 0 && t.domNode.getAttribute('height') === null && !isNaN(e.target.videoHeight)) {
1243
+ t.setPlayerSize(e.target.videoWidth, e.target.videoHeight);
1244
+ t.setControlsSize();
1245
+ t.media.setVideoSize(e.target.videoWidth, e.target.videoHeight);
1246
+ }
1247
+ }, false);
1248
+ }
1249
+ }
1250
+
1251
+ // ended for all
1252
+ t.media.addEventListener('ended', function (e) {
1253
+ t.media.setCurrentTime(0);
1254
+ t.media.pause();
1255
+
1256
+ if (t.setProgressRail)
1257
+ t.setProgressRail();
1258
+ if (t.setCurrentRail)
1259
+ t.setCurrentRail();
1260
+
1261
+ if (t.options.loop) {
1262
+ t.media.play();
1263
+ } else if (!t.options.alwaysShowControls) {
1264
+ t.controls.css('visibility','visible');
1265
+ }
1266
+ }, true);
1267
+
1268
+ // resize on the first play
1269
+ t.media.addEventListener('loadedmetadata', function(e) {
1270
+ if (t.updateDuration) {
1271
+ t.updateDuration();
1272
+ }
1273
+ if (t.updateCurrent) {
1274
+ t.updateCurrent();
1275
+ }
1276
+
1277
+ t.setControlsSize();
1278
+ }, true);
1279
+
1280
+
1281
+ // webkit has trouble doing this without a delay
1282
+ setTimeout(function () {
1283
+ t.setControlsSize();
1284
+ t.setPlayerSize(t.width, t.height);
1285
+ }, 50);
1286
+
1287
+ }
1288
+
1289
+
1290
+ if (t.options.success) {
1291
+ t.options.success(t.media, t.domNode);
1292
+ }
1293
+ },
1294
+
1295
+ handleError: function(e) {
1296
+ // Tell user that the file cannot be played
1297
+ if (this.options.error) {
1298
+ this.options.error(e);
1299
+ }
1300
+ },
1301
+
1302
+ setPlayerSize: function(width,height) {
1303
+ var t = this;
1304
+
1305
+ // ie9 appears to need this (jQuery bug?)
1306
+ t.width = parseInt(width, 10);
1307
+ t.height = parseInt(height, 10);
1308
+
1309
+ t.container
1310
+ .width(t.width)
1311
+ .height(t.height);
1312
+
1313
+ t.layers.children('.mejs-layer')
1314
+ .width(t.width)
1315
+ .height(t.height);
1316
+ },
1317
+
1318
+ setControlsSize: function() {
1319
+ var t = this,
1320
+ usedWidth = 0,
1321
+ railWidth = 0,
1322
+ rail = t.controls.find('.mejs-time-rail'),
1323
+ total = t.controls.find('.mejs-time-total'),
1324
+ current = t.controls.find('.mejs-time-current'),
1325
+ loaded = t.controls.find('.mejs-time-loaded');
1326
+ others = rail.siblings();
1327
+
1328
+ // find the size of all the other controls besides the rail
1329
+ others.each(function() {
1330
+ if ($(this).css('position') != 'absolute') {
1331
+ usedWidth += $(this).outerWidth(true);
1332
+ }
1333
+ });
1334
+ // fit the rail into the remaining space
1335
+ railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.outerWidth(false));
1336
+
1337
+ // outer area
1338
+ rail.width(railWidth);
1339
+ // dark space
1340
+ total.width(railWidth - (total.outerWidth(true) - total.width()));
1341
+
1342
+ if (t.setProgressRail)
1343
+ t.setProgressRail();
1344
+ if (t.setCurrentRail)
1345
+ t.setCurrentRail();
1346
+ },
1347
+
1348
+
1349
+ buildposter: function(player, controls, layers, media) {
1350
+ var poster =
1351
+ $('<div class="mejs-poster mejs-layer">'+
1352
+ '<img />'+
1353
+ '</div>')
1354
+ .appendTo(layers),
1355
+ posterUrl = player.$media.attr('poster'),
1356
+ posterImg = poster.find('img').width(player.width).height(player.height);
1357
+
1358
+ // prioriy goes to option (this is useful if you need to support iOS 3.x (iOS completely fails with poster)
1359
+ if (player.options.poster != '') {
1360
+ posterImg.attr('src',player.options.poster);
1361
+ // second, try the real poster
1362
+ } else if (posterUrl !== '' && posterUrl != null) {
1363
+ posterImg.attr('src',posterUrl);
1364
+ } else {
1365
+ poster.remove();
1366
+ }
1367
+
1368
+ media.addEventListener('play',function() {
1369
+ poster.hide();
1370
+ }, false);
1371
+ },
1372
+
1373
+ buildoverlays: function(player, controls, layers, media) {
1374
+ if (!player.isVideo)
1375
+ return;
1376
+
1377
+ var
1378
+ loading =
1379
+ $('<div class="mejs-overlay mejs-layer">'+
1380
+ '<div class="mejs-overlay-loading"><span></span></div>'+
1381
+ '</div>')
1382
+ .hide() // start out hidden
1383
+ .appendTo(layers),
1384
+ error =
1385
+ $('<div class="mejs-overlay mejs-layer">'+
1386
+ '<div class="mejs-overlay-error"></div>'+
1387
+ '</div>')
1388
+ .hide() // start out hidden
1389
+ .appendTo(layers),
1390
+
1391
+ // this needs to come last so it's on top
1392
+ bigPlay =
1393
+ $('<div class="mejs-overlay mejs-layer mejs-overlay-play">'+
1394
+ '<div class="mejs-overlay-button"></div>'+
1395
+ '</div>')
1396
+ .appendTo(layers)
1397
+ .click(function() {
1398
+ if (media.paused) {
1399
+ media.play();
1400
+ } else {
1401
+ media.pause();
1402
+ }
1403
+ });
1404
+
1405
+
1406
+ // show/hide big play button
1407
+ media.addEventListener('play',function() {
1408
+ bigPlay.hide();
1409
+ error.hide();
1410
+ }, false);
1411
+ media.addEventListener('pause',function() {
1412
+ bigPlay.show();
1413
+ }, false);
1414
+
1415
+ // show/hide loading
1416
+ media.addEventListener('loadstart',function() {
1417
+ // for some reason Chrome is firing this event
1418
+ if (mejs.MediaFeatures.isChrome && media.getAttribute('preload') === 'none')
1419
+ return;
1420
+
1421
+ loading.show();
1422
+ }, false);
1423
+ media.addEventListener('canplay',function() {
1424
+ loading.hide();
1425
+ }, false);
1426
+
1427
+ // error handling
1428
+ media.addEventListener('error',function() {
1429
+ loading.hide();
1430
+ error.show();
1431
+ error.find('mejs-overlay-error').html("Error loading this resource");
1432
+ }, false);
1433
+ },
1434
+
1435
+ findTracks: function() {
1436
+ var t = this,
1437
+ tracktags = t.$media.find('track');
1438
+
1439
+ // store for use by plugins
1440
+ t.tracks = [];
1441
+ tracktags.each(function() {
1442
+ t.tracks.push({
1443
+ srclang: $(this).attr('srclang').toLowerCase(),
1444
+ src: $(this).attr('src'),
1445
+ kind: $(this).attr('kind'),
1446
+ entries: [],
1447
+ isLoaded: false
1448
+ });
1449
+ });
1450
+ },
1451
+ changeSkin: function(className) {
1452
+ this.container[0].className = 'mejs-container ' + className;
1453
+ this.setPlayerSize();
1454
+ this.setControlsSize();
1455
+ },
1456
+ play: function() {
1457
+ this.media.play();
1458
+ },
1459
+ pause: function() {
1460
+ this.media.pause();
1461
+ },
1462
+ load: function() {
1463
+ this.media.load();
1464
+ },
1465
+ setMuted: function(muted) {
1466
+ this.media.setMuted(muted);
1467
+ },
1468
+ setCurrentTime: function(time) {
1469
+ this.media.setCurrentTime(time);
1470
+ },
1471
+ getCurrentTime: function() {
1472
+ return this.media.currentTime;
1473
+ },
1474
+ setVolume: function(volume) {
1475
+ this.media.setVolume(volume);
1476
+ },
1477
+ getVolume: function() {
1478
+ return this.media.volume;
1479
+ },
1480
+ setSrc: function(src) {
1481
+ this.media.setSrc(src);
1482
+ }
1483
+ };
1484
+
1485
+ // turn into jQuery plugin
1486
+ if (typeof jQuery != 'undefined') {
1487
+ jQuery.fn.mediaelementplayer = function (options) {
1488
+ return this.each(function () {
1489
+ new mejs.MediaElementPlayer(this, options);
1490
+ });
1491
+ };
1492
+ }
1493
+
1494
+ // push out to window
1495
+ window.MediaElementPlayer = mejs.MediaElementPlayer;
1496
+
1497
+ })(mejs.$);
1498
+ (function($) {
1499
+ // PLAY/pause BUTTON
1500
+ MediaElementPlayer.prototype.buildplaypause = function(player, controls, layers, media) {
1501
+ var play =
1502
+ $('<div class="mejs-button mejs-playpause-button mejs-play" type="button">' +
1503
+ '<button type="button"></button>' +
1504
+ '</div>')
1505
+ .appendTo(controls)
1506
+ .click(function(e) {
1507
+ e.preventDefault();
1508
+
1509
+ if (media.paused) {
1510
+ media.play();
1511
+ } else {
1512
+ media.pause();
1513
+ }
1514
+
1515
+ return false;
1516
+ });
1517
+
1518
+ media.addEventListener('play',function() {
1519
+ play.removeClass('mejs-play').addClass('mejs-pause');
1520
+ }, false);
1521
+ media.addEventListener('playing',function() {
1522
+ play.removeClass('mejs-play').addClass('mejs-pause');
1523
+ }, false);
1524
+
1525
+
1526
+ media.addEventListener('pause',function() {
1527
+ play.removeClass('mejs-pause').addClass('mejs-play');
1528
+ }, false);
1529
+ media.addEventListener('paused',function() {
1530
+ play.removeClass('mejs-pause').addClass('mejs-play');
1531
+ }, false);
1532
+ }
1533
+
1534
+ })(mejs.$);
1535
+ (function($) {
1536
+ // STOP BUTTON
1537
+ MediaElementPlayer.prototype.buildstop = function(player, controls, layers, media) {
1538
+ var stop =
1539
+ $('<div class="mejs-button mejs-stop-button mejs-stop">' +
1540
+ '<button type="button"></button>' +
1541
+ '</div>')
1542
+ .appendTo(controls)
1543
+ .click(function() {
1544
+ if (!media.paused) {
1545
+ media.pause();
1546
+ }
1547
+ if (media.currentTime > 0) {
1548
+ media.setCurrentTime(0);
1549
+ controls.find('.mejs-time-current').width('0px');
1550
+ controls.find('.mejs-time-handle').css('left', '0px');
1551
+ controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0) );
1552
+ controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0) );
1553
+ layers.find('.mejs-poster').show();
1554
+ }
1555
+ });
1556
+ }
1557
+
1558
+ })(mejs.$);
1559
+ (function($) {
1560
+ // progress/loaded bar
1561
+ MediaElementPlayer.prototype.buildprogress = function(player, controls, layers, media) {
1562
+
1563
+ $('<div class="mejs-time-rail">'+
1564
+ '<span class="mejs-time-total">'+
1565
+ '<span class="mejs-time-loaded"></span>'+
1566
+ '<span class="mejs-time-current"></span>'+
1567
+ '<span class="mejs-time-handle"></span>'+
1568
+ '<span class="mejs-time-float">' +
1569
+ '<span class="mejs-time-float-current">00:00</span>' +
1570
+ '<span class="mejs-time-float-corner"></span>' +
1571
+ '</span>'+
1572
+ '</span>'+
1573
+ '</div>')
1574
+ .appendTo(controls);
1575
+
1576
+ var
1577
+ t = this,
1578
+ total = controls.find('.mejs-time-total'),
1579
+ loaded = controls.find('.mejs-time-loaded'),
1580
+ current = controls.find('.mejs-time-current'),
1581
+ handle = controls.find('.mejs-time-handle'),
1582
+ timefloat = controls.find('.mejs-time-float'),
1583
+ timefloatcurrent = controls.find('.mejs-time-float-current'),
1584
+ handleMouseMove = function (e) {
1585
+ // mouse position relative to the object
1586
+ var x = e.pageX,
1587
+ offset = total.offset(),
1588
+ width = total.outerWidth(),
1589
+ percentage = 0,
1590
+ newTime = 0;
1591
+
1592
+
1593
+ if (x > offset.left && x <= width + offset.left && media.duration) {
1594
+ percentage = ((x - offset.left) / width);
1595
+ newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
1596
+
1597
+ // seek to where the mouse is
1598
+ if (mouseIsDown) {
1599
+ media.setCurrentTime(newTime);
1600
+ }
1601
+
1602
+ // position floating time box
1603
+ var pos = x - offset.left;
1604
+ timefloat.css('left', pos);
1605
+ timefloatcurrent.html( mejs.Utility.secondsToTimeCode(newTime) );
1606
+ }
1607
+ },
1608
+ mouseIsDown = false,
1609
+ mouseIsOver = false;
1610
+
1611
+ // handle clicks
1612
+ //controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
1613
+ total
1614
+ .bind('mousedown', function (e) {
1615
+ mouseIsDown = true;
1616
+ handleMouseMove(e);
1617
+ return false;
1618
+ });
1619
+
1620
+ controls.find('.mejs-time-rail')
1621
+ .bind('mouseenter', function(e) {
1622
+ mouseIsOver = true;
1623
+ })
1624
+ .bind('mouseleave',function(e) {
1625
+ mouseIsOver = false;
1626
+ });
1627
+
1628
+ $(document)
1629
+ .bind('mouseup', function (e) {
1630
+ mouseIsDown = false;
1631
+ //handleMouseMove(e);
1632
+ })
1633
+ .bind('mousemove', function (e) {
1634
+ if (mouseIsDown || mouseIsOver) {
1635
+ handleMouseMove(e);
1636
+ }
1637
+ });
1638
+
1639
+ // loading
1640
+ media.addEventListener('progress', function (e) {
1641
+ player.setProgressRail(e);
1642
+ player.setCurrentRail(e);
1643
+ }, false);
1644
+
1645
+ // current time
1646
+ media.addEventListener('timeupdate', function(e) {
1647
+ player.setProgressRail(e);
1648
+ player.setCurrentRail(e);
1649
+ }, false);
1650
+
1651
+
1652
+ // store for later use
1653
+ t.loaded = loaded;
1654
+ t.total = total;
1655
+ t.current = current;
1656
+ t.handle = handle;
1657
+ }
1658
+ MediaElementPlayer.prototype.setProgressRail = function(e) {
1659
+
1660
+ var
1661
+ t = this,
1662
+ target = (e != undefined) ? e.target : t.media,
1663
+ percent = null;
1664
+
1665
+ // newest HTML5 spec has buffered array (FF4, Webkit)
1666
+ if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
1667
+ // TODO: account for a real array with multiple values (only Firefox 4 has this so far)
1668
+ percent = target.buffered.end(0) / target.duration;
1669
+ }
1670
+ // Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
1671
+ // to be anything other than 0. If the byte count is available we use this instead.
1672
+ // Browsers that support the else if do not seem to have the bufferedBytes value and
1673
+ // should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
1674
+ else if (target && target.bytesTotal != undefined && target.bytesTotal > 0 && target.bufferedBytes != undefined) {
1675
+ percent = target.bufferedBytes / target.bytesTotal;
1676
+ }
1677
+ // Firefox 3 with an Ogg file seems to go this way
1678
+ else if (e && e.lengthComputable && e.total != 0) {
1679
+ percent = e.loaded/e.total;
1680
+ }
1681
+
1682
+ // finally update the progress bar
1683
+ if (percent !== null) {
1684
+ percent = Math.min(1, Math.max(0, percent));
1685
+ // update loaded bar
1686
+ if (t.loaded && t.total) {
1687
+ t.loaded.width(t.total.width() * percent);
1688
+ }
1689
+ }
1690
+ }
1691
+ MediaElementPlayer.prototype.setCurrentRail = function() {
1692
+
1693
+ var t = this;
1694
+
1695
+ if (t.media.currentTime != undefined && t.media.duration) {
1696
+
1697
+ // update bar and handle
1698
+ if (t.total && t.handle) {
1699
+ var
1700
+ newWidth = t.total.width() * t.media.currentTime / t.media.duration,
1701
+ handlePos = newWidth - (t.handle.outerWidth(true) / 2);
1702
+
1703
+ t.current.width(newWidth);
1704
+ t.handle.css('left', handlePos);
1705
+ }
1706
+ }
1707
+
1708
+ }
1709
+
1710
+ })(mejs.$);
1711
+ (function($) {
1712
+ // current and duration 00:00 / 00:00
1713
+ MediaElementPlayer.prototype.buildcurrent = function(player, controls, layers, media) {
1714
+ var t = this;
1715
+
1716
+ $('<div class="mejs-time">'+
1717
+ '<span class="mejs-currenttime">' + (player.options.alwaysShowHours ? '00:' : '') + '00:00</span>'+
1718
+ '</div>')
1719
+ .appendTo(controls);
1720
+
1721
+ t.currenttime = t.controls.find('.mejs-currenttime');
1722
+
1723
+ media.addEventListener('timeupdate',function() {
1724
+ player.updateCurrent();
1725
+ }, false);
1726
+ };
1727
+
1728
+ MediaElementPlayer.prototype.buildduration = function(player, controls, layers, media) {
1729
+ var t = this;
1730
+
1731
+ if (controls.children().last().find('.mejs-currenttime').length > 0) {
1732
+ $(' <span> | </span> '+
1733
+ '<span class="mejs-duration">' + (player.options.alwaysShowHours ? '00:' : '') + '00:00</span>')
1734
+ .appendTo(controls.find('.mejs-time'));
1735
+ } else {
1736
+
1737
+ // add class to current time
1738
+ controls.find('.mejs-currenttime').parent().addClass('mejs-currenttime-container');
1739
+
1740
+ $('<div class="mejs-time mejs-duration-container">'+
1741
+ '<span class="mejs-duration">' + (player.options.alwaysShowHours ? '00:' : '') + '00:00</span>'+
1742
+ '</div>')
1743
+ .appendTo(controls);
1744
+ }
1745
+
1746
+ t.durationD = t.controls.find('.mejs-duration');
1747
+
1748
+ media.addEventListener('timeupdate',function() {
1749
+ player.updateDuration();
1750
+ }, false);
1751
+ };
1752
+
1753
+ MediaElementPlayer.prototype.updateCurrent = function() {
1754
+ var t = this;
1755
+
1756
+ if (t.currenttime) {
1757
+ t.currenttime.html(mejs.Utility.secondsToTimeCode(t.media.currentTime | 0, t.options.alwaysShowHours || t.media.duration > 3600 ));
1758
+ }
1759
+ }
1760
+ MediaElementPlayer.prototype.updateDuration = function() {
1761
+ var t = this;
1762
+
1763
+ if (t.media.duration && t.durationD) {
1764
+ t.durationD.html(mejs.Utility.secondsToTimeCode(t.media.duration, t.options.alwaysShowHours));
1765
+ }
1766
+ };
1767
+
1768
+ })(mejs.$);
1769
+ (function($) {
1770
+ MediaElementPlayer.prototype.buildvolume = function(player, controls, layers, media) {
1771
+ var mute =
1772
+ $('<div class="mejs-button mejs-volume-button mejs-mute">'+
1773
+ '<button type="button"></button>'+
1774
+ '<div class="mejs-volume-slider">'+ // outer background
1775
+ '<div class="mejs-volume-total"></div>'+ // line background
1776
+ '<div class="mejs-volume-current"></div>'+ // current volume
1777
+ '<div class="mejs-volume-handle"></div>'+ // handle
1778
+ '</div>'+
1779
+ '</div>')
1780
+ .appendTo(controls),
1781
+ volumeSlider = mute.find('.mejs-volume-slider'),
1782
+ volumeTotal = mute.find('.mejs-volume-total'),
1783
+ volumeCurrent = mute.find('.mejs-volume-current'),
1784
+ volumeHandle = mute.find('.mejs-volume-handle'),
1785
+
1786
+ positionVolumeHandle = function(volume) {
1787
+
1788
+ var
1789
+ top = volumeTotal.height() - (volumeTotal.height() * volume);
1790
+
1791
+ // handle
1792
+ volumeHandle.css('top', top - (volumeHandle.height() / 2));
1793
+
1794
+ // show the current visibility
1795
+ volumeCurrent.height(volumeTotal.height() - top + parseInt(volumeTotal.css('top').replace(/px/,''),10));
1796
+ volumeCurrent.css('top', top);
1797
+ },
1798
+ handleVolumeMove = function(e) {
1799
+ var
1800
+ railHeight = volumeTotal.height(),
1801
+ totalOffset = volumeTotal.offset(),
1802
+ totalTop = parseInt(volumeTotal.css('top').replace(/px/,''),10),
1803
+ newY = e.pageY - totalOffset.top,
1804
+ volume = (railHeight - newY) / railHeight
1805
+
1806
+ // TODO: handle vertical and horizontal CSS
1807
+ // only allow it to move within the rail
1808
+ if (newY < 0)
1809
+ newY = 0;
1810
+ else if (newY > railHeight)
1811
+ newY = railHeight;
1812
+
1813
+ // move the handle to match the mouse
1814
+ volumeHandle.css('top', newY - (volumeHandle.height() / 2) + totalTop );
1815
+
1816
+ // show the current visibility
1817
+ volumeCurrent.height(railHeight-newY);
1818
+ volumeCurrent.css('top',newY+totalTop);
1819
+
1820
+ // set mute status
1821
+ if (volume == 0) {
1822
+ media.setMuted(true);
1823
+ mute.removeClass('mejs-mute').addClass('mejs-unmute');
1824
+ } else {
1825
+ media.setMuted(false);
1826
+ mute.removeClass('mejs-unmute').addClass('mejs-mute');
1827
+ }
1828
+
1829
+ volume = Math.max(0,volume);
1830
+ volume = Math.min(volume,1);
1831
+
1832
+ // set the volume
1833
+ media.setVolume(volume);
1834
+ },
1835
+ mouseIsDown = false;
1836
+
1837
+ // SLIDER
1838
+ volumeSlider
1839
+ .bind('mousedown', function (e) {
1840
+ handleVolumeMove(e);
1841
+ mouseIsDown = true;
1842
+ return false;
1843
+ });
1844
+ $(document)
1845
+ .bind('mouseup', function (e) {
1846
+ mouseIsDown = false;
1847
+ })
1848
+ .bind('mousemove', function (e) {
1849
+ if (mouseIsDown) {
1850
+ handleVolumeMove(e);
1851
+ }
1852
+ });
1853
+
1854
+
1855
+ // MUTE button
1856
+ mute.find('button').click(function() {
1857
+ if (media.muted) {
1858
+ media.setMuted(false);
1859
+ mute.removeClass('mejs-unmute').addClass('mejs-mute');
1860
+ positionVolumeHandle(1);
1861
+ } else {
1862
+ media.setMuted(true);
1863
+ mute.removeClass('mejs-mute').addClass('mejs-unmute');
1864
+ positionVolumeHandle(0);
1865
+ }
1866
+ });
1867
+
1868
+ // listen for volume change events from other sources
1869
+ media.addEventListener('volumechange', function(e) {
1870
+ if (!mouseIsDown) {
1871
+ positionVolumeHandle(e.target.volume);
1872
+ }
1873
+ }, true);
1874
+
1875
+ // set initial volume
1876
+ positionVolumeHandle(player.options.startVolume);
1877
+
1878
+ // shim gets the startvolume as a parameter, but we have to set it on the native <video> and <audio> elements
1879
+ if (media.pluginType === 'native') {
1880
+ media.setVolume(player.options.startVolume);
1881
+ }
1882
+ }
1883
+
1884
+ })(mejs.$);
1885
+
1886
+ (function($) {
1887
+ MediaElementPlayer.prototype.buildfullscreen = function(player, controls, layers, media) {
1888
+
1889
+ if (!player.isVideo)
1890
+ return;
1891
+
1892
+ var
1893
+ normalHeight = 0,
1894
+ normalWidth = 0,
1895
+ container = player.container,
1896
+ fullscreenBtn =
1897
+ $('<div class="mejs-button mejs-fullscreen-button"><button type="button"></button></div>')
1898
+ .appendTo(controls)
1899
+ .click(function() {
1900
+ var goFullscreen = (mejs.MediaFeatures.hasNativeFullScreen) ?
1901
+ !media.webkitDisplayingFullscreen :
1902
+ !media.isFullScreen;
1903
+ setFullScreen(goFullscreen);
1904
+ }),
1905
+ setFullScreen = function(goFullScreen) {
1906
+ switch (media.pluginType) {
1907
+ case 'flash':
1908
+ case 'silverlight':
1909
+ media.setFullscreen(goFullScreen);
1910
+ break;
1911
+ case 'native':
1912
+
1913
+ if (mejs.MediaFeatures.hasNativeFullScreen) {
1914
+ if (goFullScreen) {
1915
+ media.webkitEnterFullScreen();
1916
+ media.isFullScreen = true;
1917
+ } else {
1918
+ media.webkitExitFullScreen();
1919
+ media.isFullScreen = false;
1920
+ }
1921
+ } else {
1922
+ if (goFullScreen) {
1923
+
1924
+ // store
1925
+ normalHeight = player.$media.height();
1926
+ normalWidth = player.$media.width();
1927
+
1928
+ // make full size
1929
+ container
1930
+ .addClass('mejs-container-fullscreen')
1931
+ .width('100%')
1932
+ .height('100%')
1933
+ .css('z-index', 1000);
1934
+
1935
+ player.$media
1936
+ .width('100%')
1937
+ .height('100%');
1938
+
1939
+
1940
+ layers.children('div')
1941
+ .width('100%')
1942
+ .height('100%');
1943
+
1944
+ fullscreenBtn
1945
+ .removeClass('mejs-fullscreen')
1946
+ .addClass('mejs-unfullscreen');
1947
+
1948
+ player.setControlsSize();
1949
+ media.isFullScreen = true;
1950
+ } else {
1951
+
1952
+ container
1953
+ .removeClass('mejs-container-fullscreen')
1954
+ .width(normalWidth)
1955
+ .height(normalHeight)
1956
+ .css('z-index', 1);
1957
+
1958
+ player.$media
1959
+ .width(normalWidth)
1960
+ .height(normalHeight);
1961
+
1962
+ layers.children('div')
1963
+ .width(normalWidth)
1964
+ .height(normalHeight);
1965
+
1966
+ fullscreenBtn
1967
+ .removeClass('mejs-unfullscreen')
1968
+ .addClass('mejs-fullscreen');
1969
+
1970
+ player.setControlsSize();
1971
+ media.isFullScreen = false;
1972
+ }
1973
+ }
1974
+ }
1975
+ };
1976
+
1977
+ $(document).bind('keydown',function (e) {
1978
+ if (media.isFullScreen && e.keyCode == 27) {
1979
+ setFullScreen(false);
1980
+ }
1981
+ });
1982
+
1983
+ }
1984
+
1985
+ })(mejs.$);
1986
+ (function($) {
1987
+
1988
+ // add extra default options
1989
+ $.extend(mejs.MepDefaults, {
1990
+ // this will automatically turn on a <track>
1991
+ startLanguage: '',
1992
+ // a list of languages to auto-translate via Google
1993
+ translations: [],
1994
+ // a dropdownlist of automatic translations
1995
+ translationSelector: false,
1996
+ // key for tranlsations
1997
+ googleApiKey: ''
1998
+ });
1999
+
2000
+ $.extend(MediaElementPlayer.prototype, {
2001
+
2002
+ buildtracks: function(player, controls, layers, media) {
2003
+ if (!player.isVideo)
2004
+ return;
2005
+
2006
+ if (player.tracks.length == 0)
2007
+ return;
2008
+
2009
+ var i, options = '';
2010
+
2011
+ player.chapters =
2012
+ $('<div class="mejs-chapters mejs-layer"></div>')
2013
+ .prependTo(layers).hide();
2014
+ player.captions =
2015
+ $('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position"><span class="mejs-captions-text"></span></div></div>')
2016
+ .prependTo(layers).hide();
2017
+ player.captionsText = player.captions.find('.mejs-captions-text');
2018
+ player.captionsButton =
2019
+ $('<div class="mejs-button mejs-captions-button">'+
2020
+ '<button type="button" ></button>'+
2021
+ '<div class="mejs-captions-selector">'+
2022
+ '<ul>'+
2023
+ '<li>'+
2024
+ '<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
2025
+ '<label for="' + player.id + '_captions_none">None</label>'+
2026
+ '</li>' +
2027
+ '</ul>'+
2028
+ '</div>'+
2029
+ '</button>')
2030
+ .appendTo(controls)
2031
+ // handle clicks to the language radio buttons
2032
+ .delegate('input[type=radio]','click',function() {
2033
+ lang = this.value;
2034
+
2035
+ if (lang == 'none') {
2036
+ player.selectedTrack = null;
2037
+ } else {
2038
+ for (i=0; i<player.tracks.length; i++) {
2039
+ if (player.tracks[i].srclang == lang) {
2040
+ player.selectedTrack = player.tracks[i];
2041
+ player.captions.attr('lang', player.selectedTrack.srclang);
2042
+ player.displayCaptions();
2043
+ break;
2044
+ }
2045
+ }
2046
+ }
2047
+ });
2048
+ //.bind('mouseenter', function() {
2049
+ // player.captionsButton.find('.mejs-captions-selector').css('visibility','visible')
2050
+ //});
2051
+
2052
+ if (!player.options.alwaysShowControls) {
2053
+ // move with controls
2054
+ player.container
2055
+ .bind('mouseenter', function () {
2056
+ // push captions above controls
2057
+ player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
2058
+
2059
+ })
2060
+ .bind('mouseleave', function () {
2061
+ if (!media.paused) {
2062
+ // move back to normal place
2063
+ player.container.find('.mejs-captions-position').removeClass('mejs-captions-position-hover');
2064
+ }
2065
+ });
2066
+ } else {
2067
+ player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
2068
+ }
2069
+
2070
+ player.trackToLoad = -1;
2071
+ player.selectedTrack = null;
2072
+ player.isLoadingTrack = false;
2073
+
2074
+ // add user-defined translations
2075
+ if (player.tracks.length > 0 && player.options.translations.length > 0) {
2076
+ for (i=0; i<player.options.translations.length; i++) {
2077
+ player.tracks.push({
2078
+ srclang: player.options.translations[i].toLowerCase(),
2079
+ src: null,
2080
+ kind: 'subtitles',
2081
+ entries: [],
2082
+ isLoaded: false,
2083
+ isTranslation: true
2084
+ });
2085
+ }
2086
+ }
2087
+
2088
+ // add to list
2089
+ for (i=0; i<player.tracks.length; i++) {
2090
+ if (player.tracks[i].kind == 'subtitles') {
2091
+ player.addTrackButton(player.tracks[i].srclang, player.tracks[i].isTranslation);
2092
+ }
2093
+ }
2094
+
2095
+ player.loadNextTrack();
2096
+
2097
+
2098
+ media.addEventListener('timeupdate',function(e) {
2099
+ player.displayCaptions();
2100
+ }, false);
2101
+
2102
+ media.addEventListener('loadedmetadata', function(e) {
2103
+ player.displayChapters();
2104
+ }, false);
2105
+
2106
+ player.container.hover(
2107
+ function () {
2108
+ // chapters
2109
+ player.chapters.css('visibility','visible');
2110
+ player.chapters.fadeIn(200);
2111
+ },
2112
+ function () {
2113
+ if (!media.paused) {
2114
+ player.chapters.fadeOut(200, function() {
2115
+ $(this).css('visibility','hidden');
2116
+ $(this).css('display','block');
2117
+ });
2118
+ }
2119
+ });
2120
+
2121
+ // check for autoplay
2122
+ if (player.node.getAttribute('autoplay') !== null) {
2123
+ player.chapters.css('visibility','hidden');
2124
+ }
2125
+
2126
+ // auto selector
2127
+ if (player.options.translationSelector) {
2128
+ for (i in mejs.language.codes) {
2129
+ options += '<option value="' + i + '">' + mejs.language.codes[i] + '</option>';
2130
+ }
2131
+ player.container.find('.mejs-captions-selector ul').before($(
2132
+ '<select class="mejs-captions-translations">' +
2133
+ '<option value="">--Add Translation--</option>' +
2134
+ options +
2135
+ '</select>'
2136
+ ));
2137
+ // add clicks
2138
+ player.container.find('.mejs-captions-translations').change(function() {
2139
+ var
2140
+ option = $(this);
2141
+ lang = option.val();
2142
+ // add this language to the tracks list
2143
+ if (lang != '') {
2144
+ player.tracks.push({
2145
+ srclang: lang,
2146
+ src: null,
2147
+ entries: [],
2148
+ isLoaded: false,
2149
+ isTranslation: true
2150
+ });
2151
+
2152
+ if (!player.isLoadingTrack) {
2153
+ player.trackToLoad--;
2154
+ player.addTrackButton(lang,true);
2155
+ player.options.startLanguage = lang;
2156
+ player.loadNextTrack();
2157
+ }
2158
+ }
2159
+ });
2160
+ }
2161
+
2162
+ },
2163
+
2164
+ loadNextTrack: function() {
2165
+ var t = this;
2166
+
2167
+ t.trackToLoad++;
2168
+ if (t.trackToLoad < t.tracks.length) {
2169
+ t.isLoadingTrack = true;
2170
+ t.loadTrack(t.trackToLoad);
2171
+ } else {
2172
+ // add done?
2173
+ t.isLoadingTrack = false;
2174
+ }
2175
+ },
2176
+
2177
+ loadTrack: function(index){
2178
+ var
2179
+ t = this,
2180
+ track = t.tracks[index],
2181
+ after = function() {
2182
+
2183
+ track.isLoaded = true;
2184
+
2185
+ // create button
2186
+ //t.addTrackButton(track.srclang);
2187
+ t.enableTrackButton(track.srclang);
2188
+
2189
+ t.loadNextTrack();
2190
+
2191
+ };
2192
+
2193
+ if (track.isTranslation) {
2194
+
2195
+ // translate the first track
2196
+ mejs.TrackFormatParser.translateTrackText(t.tracks[0].entries, t.tracks[0].srclang, track.srclang, t.options.googleApiKey, function(newOne) {
2197
+
2198
+ // store the new translation
2199
+ track.entries = newOne;
2200
+
2201
+ after();
2202
+ });
2203
+
2204
+ } else {
2205
+ $.ajax({
2206
+ url: track.src,
2207
+ success: function(d) {
2208
+
2209
+ // parse the loaded file
2210
+ track.entries = mejs.TrackFormatParser.parse(d);
2211
+ after();
2212
+
2213
+ if (track.kind == 'chapters' && t.media.duration > 0) {
2214
+ t.drawChapters(track);
2215
+ }
2216
+ },
2217
+ error: function() {
2218
+ t.loadNextTrack();
2219
+ }
2220
+ });
2221
+ }
2222
+ },
2223
+
2224
+ enableTrackButton: function(lang) {
2225
+ var t = this;
2226
+
2227
+ t.captionsButton
2228
+ .find('input[value=' + lang + ']')
2229
+ .prop('disabled',false)
2230
+ .siblings('label')
2231
+ .html( mejs.language.codes[lang] || lang );
2232
+
2233
+ // auto select
2234
+ if (t.options.startLanguage == lang) {
2235
+ $('#' + t.id + '_captions_' + lang).click();
2236
+ }
2237
+
2238
+ t.adjustLanguageBox();
2239
+ },
2240
+
2241
+ addTrackButton: function(lang, isTranslation) {
2242
+ var t = this,
2243
+ l = mejs.language.codes[lang] || lang;
2244
+
2245
+ t.captionsButton.find('ul').append(
2246
+ $('<li>'+
2247
+ '<input type="radio" name="' + t.id + '_captions" id="' + t.id + '_captions_' + lang + '" value="' + lang + '" disabled="disabled" />' +
2248
+ '<label for="' + t.id + '_captions_' + lang + '">' + l + ((isTranslation) ? ' (translating)' : ' (loading)') + '</label>'+
2249
+ '</li>')
2250
+ );
2251
+
2252
+ t.adjustLanguageBox();
2253
+
2254
+ // remove this from the dropdownlist (if it exists)
2255
+ t.container.find('.mejs-captions-translations option[value=' + lang + ']').remove();
2256
+ },
2257
+
2258
+ adjustLanguageBox:function() {
2259
+ var t = this;
2260
+ // adjust the size of the outer box
2261
+ t.captionsButton.find('.mejs-captions-selector').height(
2262
+ t.captionsButton.find('.mejs-captions-selector ul').outerHeight(true) +
2263
+ t.captionsButton.find('.mejs-captions-translations').outerHeight(true)
2264
+ );
2265
+ },
2266
+
2267
+ displayCaptions: function() {
2268
+
2269
+ if (typeof this.tracks == 'undefined')
2270
+ return;
2271
+
2272
+ var
2273
+ t = this,
2274
+ i,
2275
+ track = t.selectedTrack;
2276
+
2277
+ if (track != null && track.isLoaded) {
2278
+ for (i=0; i<track.entries.times.length; i++) {
2279
+ if (t.media.currentTime >= track.entries.times[i].start && t.media.currentTime <= track.entries.times[i].stop){
2280
+ t.captionsText.html(track.entries.text[i]);
2281
+ t.captions.show();
2282
+ return; // exit out if one is visible;
2283
+ }
2284
+ }
2285
+ t.captions.hide();
2286
+ } else {
2287
+ t.captions.hide();
2288
+ }
2289
+ },
2290
+
2291
+ displayChapters: function() {
2292
+ var
2293
+ t = this,
2294
+ i;
2295
+
2296
+ for (i=0; i<t.tracks.length; i++) {
2297
+ if (t.tracks[i].kind == 'chapters' && t.tracks[i].isLoaded) {
2298
+ t.drawChapters(t.tracks[i]);
2299
+ break;
2300
+ }
2301
+ }
2302
+ },
2303
+
2304
+ drawChapters: function(chapters) {
2305
+ var
2306
+ t = this,
2307
+ i,
2308
+ dur,
2309
+ //width,
2310
+ //left,
2311
+ percent = 0,
2312
+ usedPercent = 0;
2313
+
2314
+ t.chapters.empty();
2315
+
2316
+ for (i=0; i<chapters.entries.times.length; i++) {
2317
+ dur = chapters.entries.times[i].stop - chapters.entries.times[i].start;
2318
+ percent = Math.floor(dur / t.media.duration * 100);
2319
+ if (percent + usedPercent > 100 || // too large
2320
+ i == chapters.entries.times.length-1 && percent + usedPercent < 100) // not going to fill it in
2321
+ {
2322
+ percent = 100 - usedPercent;
2323
+ }
2324
+ //width = Math.floor(t.width * dur / t.media.duration);
2325
+ //left = Math.floor(t.width * chapters.entries.times[i].start / t.media.duration);
2326
+ //if (left + width > t.width) {
2327
+ // width = t.width - left;
2328
+ //}
2329
+
2330
+ t.chapters.append( $(
2331
+ '<div class="mejs-chapter" rel="' + chapters.entries.times[i].start + '" style="left: ' + usedPercent.toString() + '%;width: ' + percent.toString() + '%;">' +
2332
+ '<div class="mejs-chapter-block' + ((i==chapters.entries.times.length-1) ? ' mejs-chapter-block-last' : '') + '">' +
2333
+ '<span class="ch-title">' + chapters.entries.text[i] + '</span>' +
2334
+ '<span class="ch-time">' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].start) + '&ndash;' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].stop) + '</span>' +
2335
+ '</div>' +
2336
+ '</div>'));
2337
+ usedPercent += percent;
2338
+ }
2339
+
2340
+ t.chapters.find('div.mejs-chapter').click(function() {
2341
+ t.media.setCurrentTime( parseFloat( $(this).attr('rel') ) );
2342
+ if (t.media.paused) {
2343
+ t.media.play();
2344
+ }
2345
+ });
2346
+
2347
+ t.chapters.show();
2348
+ }
2349
+ });
2350
+
2351
+
2352
+
2353
+ mejs.language = {
2354
+ codes: {
2355
+ af:'Afrikaans',
2356
+ sq:'Albanian',
2357
+ ar:'Arabic',
2358
+ be:'Belarusian',
2359
+ bg:'Bulgarian',
2360
+ ca:'Catalan',
2361
+ zh:'Chinese',
2362
+ 'zh-cn':'Chinese Simplified',
2363
+ 'zh-tw':'Chinese Traditional',
2364
+ hr:'Croatian',
2365
+ cs:'Czech',
2366
+ da:'Danish',
2367
+ nl:'Dutch',
2368
+ en:'English',
2369
+ et:'Estonian',
2370
+ tl:'Filipino',
2371
+ fi:'Finnish',
2372
+ fr:'French',
2373
+ gl:'Galician',
2374
+ de:'German',
2375
+ el:'Greek',
2376
+ ht:'Haitian Creole',
2377
+ iw:'Hebrew',
2378
+ hi:'Hindi',
2379
+ hu:'Hungarian',
2380
+ is:'Icelandic',
2381
+ id:'Indonesian',
2382
+ ga:'Irish',
2383
+ it:'Italian',
2384
+ ja:'Japanese',
2385
+ ko:'Korean',
2386
+ lv:'Latvian',
2387
+ lt:'Lithuanian',
2388
+ mk:'Macedonian',
2389
+ ms:'Malay',
2390
+ mt:'Maltese',
2391
+ no:'Norwegian',
2392
+ fa:'Persian',
2393
+ pl:'Polish',
2394
+ pt:'Portuguese',
2395
+ //'pt-pt':'Portuguese (Portugal)',
2396
+ ro:'Romanian',
2397
+ ru:'Russian',
2398
+ sr:'Serbian',
2399
+ sk:'Slovak',
2400
+ sl:'Slovenian',
2401
+ es:'Spanish',
2402
+ sw:'Swahili',
2403
+ sv:'Swedish',
2404
+ tl:'Tagalog',
2405
+ th:'Thai',
2406
+ tr:'Turkish',
2407
+ uk:'Ukrainian',
2408
+ vi:'Vietnamese',
2409
+ cy:'Welsh',
2410
+ yi:'Yiddish'
2411
+ }
2412
+ };
2413
+
2414
+ /*
2415
+ Parses WebVVT format which should be formatted as
2416
+ ================================
2417
+ WEBVTT
2418
+
2419
+ 1
2420
+ 00:00:01,1 --> 00:00:05,000
2421
+ A line of text
2422
+
2423
+ 2
2424
+ 00:01:15,1 --> 00:02:05,000
2425
+ A second line of text
2426
+
2427
+ ===============================
2428
+
2429
+ Adapted from: http://www.delphiki.com/html5/playr
2430
+ */
2431
+ mejs.TrackFormatParser = {
2432
+ pattern_identifier: /^[0-9]+$/,
2433
+ 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})?)(.*)$/,
2434
+
2435
+ split2: function (text, regex) {
2436
+ // normal version for compliant browsers
2437
+ // see below for IE fix
2438
+ return text.split(regex);
2439
+ },
2440
+ parse: function(trackText) {
2441
+ var
2442
+ i = 0,
2443
+ lines = this.split2(trackText, /\r?\n/),
2444
+ entries = {text:[], times:[]},
2445
+ timecode,
2446
+ text;
2447
+
2448
+ for(; i<lines.length; i++) {
2449
+ // check for the line number
2450
+ if (this.pattern_identifier.exec(lines[i])){
2451
+ // skip to the next line where the start --> end time code should be
2452
+ i++;
2453
+ timecode = this.pattern_timecode.exec(lines[i]);
2454
+ if (timecode && i<lines.length){
2455
+ i++;
2456
+ // grab all the (possibly multi-line) text that follows
2457
+ text = lines[i];
2458
+ i++;
2459
+ while(lines[i] !== '' && i<lines.length){
2460
+ text = text + '\n' + lines[i];
2461
+ i++;
2462
+ }
2463
+
2464
+ // Text is in a different array so I can use .join
2465
+ entries.text.push(text);
2466
+ entries.times.push(
2467
+ {
2468
+ start: mejs.Utility.timeCodeToSeconds(timecode[1]),
2469
+ stop: mejs.Utility.timeCodeToSeconds(timecode[3]),
2470
+ settings: timecode[5]
2471
+ });
2472
+ }
2473
+ }
2474
+ }
2475
+
2476
+ return entries;
2477
+ },
2478
+
2479
+ translateTrackText: function(trackData, fromLang, toLang, googleApiKey, callback) {
2480
+
2481
+ var
2482
+ entries = {text:[], times:[]},
2483
+ lines,
2484
+ i
2485
+
2486
+ this.translateText( trackData.text.join(' <a></a>'), fromLang, toLang, googleApiKey, function(result) {
2487
+ // split on separators
2488
+ lines = result.split('<a></a>');
2489
+
2490
+ // create new entries
2491
+ for (i=0;i<trackData.text.length; i++) {
2492
+ // add translated line
2493
+ entries.text[i] = lines[i];
2494
+ // copy existing times
2495
+ entries.times[i] = {
2496
+ start: trackData.times[i].start,
2497
+ stop: trackData.times[i].stop,
2498
+ settings: trackData.times[i].settings
2499
+ };
2500
+ }
2501
+
2502
+ callback(entries);
2503
+ });
2504
+ },
2505
+
2506
+ translateText: function(text, fromLang, toLang, googleApiKey, callback) {
2507
+
2508
+ var
2509
+ separatorIndex,
2510
+ chunks = [],
2511
+ chunk,
2512
+ maxlength = 1000,
2513
+ result = '',
2514
+ nextChunk= function() {
2515
+ if (chunks.length > 0) {
2516
+ chunk = chunks.shift();
2517
+ mejs.TrackFormatParser.translateChunk(chunk, fromLang, toLang, googleApiKey, function(r) {
2518
+ if (r != 'undefined') {
2519
+ result += r;
2520
+ }
2521
+ nextChunk();
2522
+ });
2523
+ } else {
2524
+ callback(result);
2525
+ }
2526
+ };
2527
+
2528
+ // split into chunks
2529
+ while (text.length > 0) {
2530
+ if (text.length > maxlength) {
2531
+ separatorIndex = text.lastIndexOf('.', maxlength);
2532
+ chunks.push(text.substring(0, separatorIndex));
2533
+ text = text.substring(separatorIndex+1);
2534
+ } else {
2535
+ chunks.push(text);
2536
+ text = '';
2537
+ }
2538
+ }
2539
+
2540
+ // start handling the chunks
2541
+ nextChunk();
2542
+ },
2543
+ translateChunk: function(text, fromLang, toLang, googleApiKey, callback) {
2544
+
2545
+ var data = {
2546
+ q: text,
2547
+ langpair: fromLang + '|' + toLang,
2548
+ v: '1.0'
2549
+ };
2550
+ if (googleApiKey !== '' && googleApiKey !== null) {
2551
+ data.key = googleApiKey;
2552
+ }
2553
+
2554
+ $.ajax({
2555
+ url: 'https://ajax.googleapis.com/ajax/services/language/translate', // 'https://www.google.com/uds/Gtranslate', //'https://ajax.googleapis.com/ajax/services/language/translate', //
2556
+ data: data,
2557
+ type: 'GET',
2558
+ dataType: 'jsonp',
2559
+ success: function(d) {
2560
+ callback(d.responseData.translatedText);
2561
+ },
2562
+ error: function(e) {
2563
+ callback(null);
2564
+ }
2565
+ });
2566
+ }
2567
+ };
2568
+ // test for browsers with bad String.split method.
2569
+ if ('x\n\ny'.split(/\n/gi).length != 3) {
2570
+ // add super slow IE8 and below version
2571
+ mejs.TrackFormatParser.split2 = function(text, regex) {
2572
+ var
2573
+ parts = [],
2574
+ chunk = '',
2575
+ i;
2576
+
2577
+ for (i=0; i<text.length; i++) {
2578
+ chunk += text.substring(i,i+1);
2579
+ if (regex.test(chunk)) {
2580
+ parts.push(chunk.replace(regex, ''));
2581
+ chunk = '';
2582
+ }
2583
+ }
2584
+ parts.push(chunk);
2585
+ return parts;
2586
+ }
2587
+ }
2588
+
2589
+ })(mejs.$);
2590
+
2591
+
mediaelement/mediaelement-and-player.min.js ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * MediaElement.js
3
+ * HTML5 <video> and <audio> shim and player
4
+ * http://mediaelementjs.com/
5
+ *
6
+ * Creates a JavaScript object that mimics HTML5 MediaElement API
7
+ * for browsers that don't understand HTML5 or can't play the provided codec
8
+ * Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
9
+ *
10
+ * Copyright 2010-2011, John Dyer (http://j.hn)
11
+ * Dual licensed under the MIT or GPL Version 2 licenses.
12
+ *
13
+ */var mejs=mejs||{};mejs.version="2.1.7";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}};
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=
27
+ a+"px";this.pluginElement.style.height=b+"px"}this.pluginApi!=null&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen(a)},addEventListener:function(a,b){this.events[a]=this.events[a]||[];this.events[a].push(b)},removeEventListener:function(a,b){if(!a){this.events={};return true}var c=this.events[a];if(!c)return true;if(!b){this.events[a]=[];return true}for(i=0;i<c.length;i++)if(c[i]===b){this.events[a].splice(i,1);return true}return false},
28
+ dispatchEvent:function(a){var b,c,d=this.events[a];if(d){c=Array.prototype.slice.call(arguments,1);for(b=0;b<d.length;b++)d[b].apply(null,c)}}};
29
+ mejs.MediaPluginBridge={pluginMediaElements:{},htmlMediaElements:{},registerPluginElement:function(a,b,c){this.pluginMediaElements[a]=b;this.htmlMediaElements[a]=c},initPlugin:function(a){var b=this.pluginMediaElements[a],c=this.htmlMediaElements[a];switch(b.pluginType){case "flash":b.pluginElement=b.pluginApi=document.getElementById(a);break;case "silverlight":b.pluginElement=document.getElementById(b.id);b.pluginApi=b.pluginElement.Content.MediaElementJS}b.pluginApi!=null&&b.success&&b.success(b,
30
+ c)},fireEvent:function(a,b,c){var d,e;a=this.pluginMediaElements[a];a.ended=false;a.paused=true;b={type:b,target:a};for(d in c){a[d]=c[d];b[d]=c[d]}e=c.bufferedTime||0;b.target.buffered=b.buffered={start:function(){return 0},end:function(){return e},length:1};a.dispatchEvent(b.type,b)}};
31
+ mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight"],enablePluginDebug:false,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",enablePluginSmoothing:false,silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,timerRate:250,success:function(){},error:function(){}};
32
+ mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
33
+ mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase()=="video",f=typeof d.canPlayType!="undefined",g={method:"",url:""},k=d.getAttribute("poster"),h=d.getAttribute("autoplay"),l=d.getAttribute("preload"),j=d.getAttribute("controls"),n;for(n in b)c[n]=b[n];k=typeof k=="undefined"||k===null?"":k;l=typeof l=="undefined"||l===null||l==="false"?"none":l;h=!(typeof h=="undefined"||h===null||h==="false");
34
+ j=!(typeof j=="undefined"||j===null||j==="false");g=this.determinePlayback(d,c,e,f);if(g.method=="native")return this.updateNative(d,c,h,l,g);else if(g.method!=="")return this.createPlugin(d,c,e,g.method,g.url!==null?mejs.Utility.absolutizeUrl(g.url):"",k,h,l,j);else this.createErrorMessage(d,c,g.url!==null?mejs.Utility.absolutizeUrl(g.url):"",k)},determinePlayback:function(a,b,c,d){var e=[],f,g,k={method:"",url:""},h=a.getAttribute("src"),l,j;if(h=="undefined"||h==""||h===null)h=null;if(typeof b.type!=
35
+ "undefined"&&b.type!=="")e.push({type:b.type,url:h});else if(h!==null){g=this.checkType(h,a.getAttribute("type"),c);e.push({type:g,url:h})}else for(f=0;f<a.childNodes.length;f++){g=a.childNodes[f];if(g.nodeType==1&&g.tagName.toLowerCase()=="source"){h=g.getAttribute("src");g=this.checkType(h,g.getAttribute("type"),c);e.push({type:g,url:h})}}if(d&&(b.mode==="auto"||b.mode==="native"))for(f=0;f<e.length;f++)if(a.canPlayType(e[f].type).replace(/no/,"")!==""||a.canPlayType(e[f].type.replace(/mp3/,"mpeg")).replace(/no/,
36
+ "")!==""){k.method="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")+"/"+
37
+ a}else return b&&~b.indexOf(";")?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,
38
+ d,e),o=document.createElement("div"),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;
39
+ mejs.MediaPluginBridge.registerPluginElement(j,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=
40
+ '<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+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");
41
+ 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="'+j+'" width="'+f+'" height="'+l+'"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+c.join("&amp;")+'" /><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=
42
+ '<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="'+b.pluginPath+b.flashName+'" flashvars="'+c.join("&")+'" width="'+f+'" height="'+l+'"></embed>'}a.style.display="none";return n},updateNative:function(a,b){for(var c in mejs.HtmlMediaElement)a[c]=mejs.HtmlMediaElement[c];b.success(a,a);return a}};
43
+ window.mejs=mejs;window.MediaElement=mejs.MediaElement;
44
+
45
+ /*!
46
+ * MediaElementPlayer
47
+ * http://mediaelementjs.com/
48
+ *
49
+ * Creates a controller bar for HTML5 <video> add <audio> tags
50
+ * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
51
+ *
52
+ * Copyright 2010-2011, John Dyer (http://j.hn/)
53
+ * Dual licensed under the MIT or GPL Version 2 licenses.
54
+ *
55
+ */if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
56
+ (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,alwaysShowControls: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,
57
+ c);this.$media=this.$node=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");
58
+ if(c.isiPad&&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);
59
+ 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,
60
+ 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,
61
+ b.height);b.setControlsSize();if(b.isVideo){b.container.bind("mouseenter",function(){if(!b.options.alwaysShowControls){b.controls.css("visibility","visible");b.controls.stop(true,true).fadeIn(200)}}).bind("mouseleave",function(){!b.media.paused&&!b.options.alwaysShowControls&&b.controls.stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});b.domNode.getAttribute("autoplay")!==null&&!b.options.alwaysShowControls&&b.controls.css("visibility","hidden");
62
+ b.options.enableAutosize&&b.media.addEventListener("loadedmetadata",function(h){if(b.options.videoHeight<=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();if(b.options.loop)b.media.play();
63
+ else b.options.alwaysShowControls||b.controls.css("visibility","visible")},true);b.media.addEventListener("loadedmetadata",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=
64
+ parseInt(c,10);this.container.width(this.width).height(this.height);this.layers.children(".mejs-layer").width(this.width).height(this.height)},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)-
65
+ b.outerWidth(false));b.width(c);d.width(c-(d.outerWidth(true)-d.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},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,
66
+ 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),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",
67
+ function(){h.show()},false);d.addEventListener("loadstart",function(){mejs.MediaFeatures.isChrome&&d.getAttribute("preload")==="none"||e.show()},false);d.addEventListener("canplay",function(){e.hide()},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"),
68
+ 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()},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},
69
+ setSrc:function(a){this.media.setSrc(a)}};if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){return this.each(function(){new mejs.MediaElementPlayer(this,a)})};window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
70
+ (function(f){MediaElementPlayer.prototype.buildplaypause=function(a,c,b,d){var e=f('<div class="mejs-button mejs-playpause-button mejs-play" type="button"><button type="button"></button></div>').appendTo(c).click(function(g){g.preventDefault();d.paused?d.play():d.pause();return false});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",
71
+ function(){e.removeClass("mejs-pause").addClass("mejs-play")},false);d.addEventListener("paused",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false)}})(mejs.$);
72
+ (function(f){MediaElementPlayer.prototype.buildstop=function(a,c,b,d){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button"></button></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()}})}})(mejs.$);
73
+ (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"),
74
+ 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});
75
+ 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=
76
+ 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&&this.total&&this.loaded.width(this.total.width()*b)}};MediaElementPlayer.prototype.setCurrentRail=function(){if(this.media.currentTime!=undefined&&this.media.duration)if(this.total&&this.handle){var a=this.total.width()*this.media.currentTime/this.media.duration,
77
+ c=a-this.handle.outerWidth(true)/2;this.current.width(a);this.handle.css("left",c)}}})(mejs.$);
78
+ (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){if(c.children().last().find(".mejs-currenttime").length>0)f(' <span> | </span> <span class="mejs-duration">'+(a.options.alwaysShowHours?
79
+ "00:":"")+"00:00</span>").appendTo(c.find(".mejs-time"));else{c.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");f('<div class="mejs-time mejs-duration-container"><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|
80
+ 0,this.options.alwaysShowHours||this.media.duration>3600))};MediaElementPlayer.prototype.updateDuration=function(){this.media.duration&&this.durationD&&this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours))}})(mejs.$);
81
+ (function(f){MediaElementPlayer.prototype.buildvolume=function(a,c,b,d){var e=f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button"></button><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()*
82
+ i;j.css("top",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)},
83
+ o=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("button").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.pluginType==="native"&&d.setVolume(a.options.startVolume)}})(mejs.$);
84
+ (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"><button type="button"></button></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();
85
+ d.isFullScreen=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);
86
+ b.children("div").width(g).height(e);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)})}}})(mejs.$);
87
+ (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");
88
+ a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" ></button><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></button>').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=
89
+ a.tracks[e];a.captions.attr("lang",a.selectedTrack.srclang);a.displayCaptions();break}});a.options.alwaysShowControls?a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):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=
90
+ 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(),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()},
91
+ 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","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>'+
92
+ g+"</select>"));a.container.find(".mejs-captions-translations").change(function(){lang=f(this).val();if(lang!=""){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=
93
+ this,b=c.tracks[a],d=function(){b.isLoaded=true;c.enableTrackButton(b.srclang);c.loadNextTrack()};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="+
94
+ a+"]").prop("disabled",false).siblings("label").html(mejs.language.codes[a]||a);this.options.startLanguage==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();
95
+ 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)+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&&
96
+ 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=="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);
97
+ 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==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)+"&ndash;"+mejs.Utility.secondsToTimeCode(a.entries.times[b].stop)+"</span></div></div>"));
98
+ 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",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",
99
+ 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",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})?)(.*)$/,
100
+ split2:function(a,c){return a.split(c)},parse:function(a){var c=0;a=this.split2(a,/\r?\n/);for(var b={text:[],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:[]},
101
+ 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]=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+
102
+ 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=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);
103
+ return b}})(mejs.$);
104
+
mediaelement/mediaelementplayer.css ADDED
@@ -0,0 +1,569 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .mejs-container {
2
+ position: relative;
3
+ background: #000;
4
+ font-family: Helvetica, Arial;
5
+ }
6
+
7
+ .mejs-container-fullscreen {
8
+ position: fixed;
9
+ left: 0;
10
+ top: 0;
11
+ right: 0;
12
+ bottom: 0;
13
+ overflow: hidden;
14
+ }
15
+ .mejs-container-fullscreen .mejs-mediaelement,
16
+ .mejs-container-fullscreen video {
17
+ width: 100%;
18
+ height: 100%;
19
+ }
20
+
21
+ /* Start: LAYERS */
22
+ .mejs-background {
23
+ position: absolute;
24
+ top: 0;
25
+ left: 0;
26
+ }
27
+ .mejs-mediaelement {
28
+ position: absolute;
29
+ top: 0;
30
+ left: 0;
31
+ }
32
+ .mejs-poster {
33
+ position: absolute;
34
+ top: 0;
35
+ left: 0;
36
+ }
37
+ .mejs-overlay {
38
+ position: absolute;
39
+ top: 0;
40
+ left: 0;
41
+ }
42
+ .mejs-overlay-play {
43
+ cursor: pointer;
44
+ }
45
+ .mejs-overlay-button {
46
+ position: absolute;
47
+ top: 50%;
48
+ left: 50%;
49
+ width: 100px;
50
+ height: 100px;
51
+ margin: -50px 0 0 -50px;
52
+ background: url(bigplay.png) top left no-repeat;
53
+ }
54
+ .mejs-overlay:hover .mejs-overlay-button{
55
+ background-position: 0 -100px ;
56
+ }
57
+ .mejs-overlay-loading {
58
+ position: absolute;
59
+ top: 50%;
60
+ left: 50%;
61
+ width: 80px;
62
+ height: 80px;
63
+ margin: -40px 0 0 -40px;
64
+ background: #333;
65
+ background: url(background.png);
66
+ background: rgba(0, 0, 0, 0.9);
67
+ background: -webkit-gradient(linear, left top, left bottom, from(rgba(50,50,50,0.9)), to(rgba(0,0,0,0.9)));
68
+ background: -moz-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
69
+ background: linear-gradient(rgba(50,50,50,0.9), rgba(0,0,0,0.9));
70
+ }
71
+ .mejs-overlay-loading span {
72
+ display:block;
73
+ width: 80px;
74
+ height: 80px;
75
+ background: transparent url(loading.gif) center center no-repeat;
76
+ }
77
+
78
+ /* End: LAYERS */
79
+
80
+ /* Start: CONTROL BAR */
81
+ .mejs-container .mejs-controls {
82
+ position: absolute;
83
+ background: none;
84
+ list-style-type: none;
85
+ margin: 0;
86
+ padding: 0;
87
+ bottom: 0;
88
+ left: 0;
89
+ background: url(background.png);
90
+ background: rgba(0, 0, 0, 0.7);
91
+ background: -webkit-gradient(linear, left top, left bottom, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
92
+ background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
93
+ background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
94
+ height: 30px;
95
+ width: 100%;
96
+ }
97
+ .mejs-container .mejs-controls div {
98
+ list-style-type: none;
99
+ background-image: none;
100
+ display: block;
101
+ float: left;
102
+ margin: 0;
103
+ padding: 0;
104
+ width: 26px;
105
+ height: 26px;
106
+ font-size: 11px;
107
+ line-height: 11px;
108
+ background: 0;
109
+ font-family: Helvetica, Arial;
110
+ border: 0;
111
+ }
112
+
113
+ .mejs-controls .mejs-button button {
114
+ cursor: pointer;
115
+ display: block;
116
+ font-size: 0px;
117
+ line-height: 0;
118
+ text-decoration: none;
119
+ margin: 7px 5px;
120
+ padding: 0;
121
+ position: absolute;
122
+ height: 16px;
123
+ width: 16px;
124
+ border: 0;
125
+ background: transparent url(controls.png) 0 0 no-repeat;
126
+ }
127
+ /* End: CONTROL BAR */
128
+
129
+ /* Start: Time (current / duration) */
130
+ .mejs-container .mejs-controls .mejs-time {
131
+ color: #fff;
132
+ display: block;
133
+ height: 17px;
134
+ width: auto;
135
+ padding: 8px 3px 0 3px ;
136
+ overflow: hidden;
137
+ text-align: center;
138
+ padding: auto 4px;
139
+ }
140
+ .mejs-container .mejs-controls .mejs-time span {
141
+ font-size: 11px;
142
+ color: #fff;
143
+ line-height: 12px;
144
+ display: block;
145
+ float: left;
146
+ margin: 1px 2px 0 0;
147
+ width: auto;
148
+ }
149
+ /* End: Time (current / duration) */
150
+
151
+
152
+ /* Start: Play/pause */
153
+ .mejs-controls .mejs-play button {
154
+ background-position:0 0;
155
+ }
156
+ .mejs-controls .mejs-pause button {
157
+ background-position:0 -16px;
158
+ }
159
+ /* End: Play/pause */
160
+
161
+
162
+ /* Stop */
163
+ .mejs-controls .mejs-stop button {
164
+ background-position: -112px 0;
165
+ }
166
+ /* End: Play/pause */
167
+
168
+ /* Start: Progress bar */
169
+ .mejs-controls div.mejs-time-rail {
170
+ width: 200px;
171
+ padding-top: 5px;
172
+ }
173
+ .mejs-controls .mejs-time-rail span {
174
+ display: block;
175
+ position: absolute;
176
+ width: 180px;
177
+ height: 10px;
178
+ -webkit-border-radius: 2px;
179
+ -moz-border-radius: 2px;
180
+ border-radius: 2px;
181
+ cursor: pointer;
182
+ }
183
+ .mejs-controls .mejs-time-rail .mejs-time-total {
184
+ margin: 5px;
185
+ background: #333;
186
+ background: rgba(50,50,50,0.8);
187
+ background: -webkit-gradient(linear, left top, left bottom, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
188
+ background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
189
+ background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
190
+ filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#1E1E1E,endColorstr=#3C3C3C);
191
+ }
192
+ .mejs-controls .mejs-time-rail .mejs-time-loaded {
193
+ background: #3caac8;
194
+ background: rgba(60,170,200,0.8);
195
+ background: -webkit-gradient(linear, left top, left bottom, from(rgba(44,124,145,0.8)), to(rgba(78,183,212,0.8)));
196
+ background: -moz-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
197
+ background: linear-gradient(rgba(44,124,145,0.8), rgba(78,183,212,0.8));
198
+ filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#2C7C91,endColorstr=#4EB7D4);
199
+ width: 0;
200
+ }
201
+ .mejs-controls .mejs-time-rail .mejs-time-current {
202
+ width: 0;
203
+ background: #fff;
204
+ background: rgba(255,255,255,0.8);
205
+ background: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
206
+ background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
207
+ filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#FFFFFF,endColorstr=#C8C8C8);
208
+ }
209
+
210
+ .mejs-controls .mejs-time-rail .mejs-time-handle {
211
+ display: none;
212
+ position: absolute;
213
+ margin: 0;
214
+ width: 10px;
215
+ background: #fff;
216
+ -webkit-border-radius: 5px;
217
+ -moz-border-radius: 5px;
218
+ border-radius: 5px;
219
+ cursor: pointer;
220
+ border: solid 2px #333;
221
+ top: -2px;
222
+ text-align: center;
223
+ }
224
+
225
+ .mejs-controls .mejs-time-rail .mejs-time-float {
226
+ visibility: hidden;
227
+ position: absolute;
228
+ display: block;
229
+ background: #eee;
230
+ width: 36px;
231
+ height: 17px;
232
+ border: solid 1px #333;
233
+ top: -26px;
234
+ margin-left: -18px;
235
+ text-align: center;
236
+ color: #111;
237
+ }
238
+ .mejs-controls .mejs-time-rail:hover .mejs-time-float {
239
+ visibility: visible;
240
+ }
241
+ .mejs-controls .mejs-time-rail .mejs-time-float-current {
242
+ margin: 2px;
243
+ width: 30px;
244
+ display: block;
245
+ text-align: center;
246
+ left: 0;
247
+ }
248
+ .mejs-controls .mejs-time-rail .mejs-time-float-corner {
249
+ position: absolute;
250
+ display: block;
251
+ width: 0;
252
+ height: 0;
253
+ line-height: 0;
254
+ border: solid 5px #eee;
255
+ border-color: #eee transparent transparent transparent;
256
+ -webkit-border-radius: 0;
257
+ -moz-border-radius: 0;
258
+ border-radius: 0;
259
+ top: 15px;
260
+ left: 13px;
261
+
262
+ }
263
+
264
+
265
+
266
+
267
+ /*
268
+ .mejs-controls .mejs-time-rail:hover .mejs-time-handle {
269
+ visibility:visible;
270
+ }
271
+ */
272
+ /* End: Progress bar */
273
+
274
+ /* Start: Fullscreen */
275
+ .mejs-controls .mejs-fullscreen-button button {
276
+ background-position:-32px 0;
277
+ }
278
+ .mejs-controls .mejs-unfullscreen button {
279
+ background-position:-32px -16px;
280
+ }
281
+ /* End: Fullscreen */
282
+
283
+
284
+ /* Start: Mute/Volume */
285
+ .mejs-controls .mejs-volume-button {
286
+ }
287
+
288
+ .mejs-controls .mejs-mute button {
289
+ background-position:-16px -16px;
290
+ }
291
+
292
+ .mejs-controls .mejs-unmute button {
293
+ background-position:-16px 0;
294
+ }
295
+
296
+ .mejs-controls .mejs-volume-button {
297
+ position: relative;
298
+ }
299
+
300
+ .mejs-controls .mejs-volume-button .mejs-volume-slider {
301
+ display: none;
302
+ height: 115px;
303
+ width: 25px;
304
+ background: url(background.png);
305
+ background: rgba(50, 50, 50, 0.7);
306
+ -webkit-border-radius: 0;
307
+ -moz-border-radius: 0;
308
+ border-radius: 0;
309
+ top: -115px;
310
+ left: 0;
311
+ z-index: 1;
312
+ position: absolute;
313
+ margin: 0;
314
+ }
315
+ .mejs-controls .mejs-volume-button:hover {
316
+ -webkit-border-radius: 0 0 4px 4px ;
317
+ -moz-border-radius: 0 0 4px 4px ;
318
+ border-radius: 0 0 4px 4px ;
319
+ }
320
+ .mejs-controls .mejs-volume-button:hover .mejs-volume-slider {
321
+ display: block;
322
+ }
323
+
324
+ .mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total {
325
+ position: absolute;
326
+ left: 11px;
327
+ top: 8px;
328
+ width: 2px;
329
+ height: 100px;
330
+ background: #ddd;
331
+ background: rgba(255, 255, 255, 0.5);
332
+ margin: 0;
333
+ }
334
+
335
+ .mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current {
336
+ position: absolute;
337
+ left: 11px;
338
+ top: 8px;
339
+ width: 2px;
340
+ height: 100px;
341
+ background: #ddd;
342
+ background: rgba(255, 255, 255, 0.9);
343
+ margin: 0;
344
+ }
345
+
346
+ .mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle {
347
+ position: absolute;
348
+ left: 4px;
349
+ top: -3px;
350
+ width: 16px;
351
+ height: 6px;
352
+ background: #ddd;
353
+ background: rgba(255, 255, 255, 0.9);
354
+ cursor: N-resize;
355
+ -webkit-border-radius: 1px;
356
+ -moz-border-radius: 1px;
357
+ border-radius: 1px;
358
+ margin: 0;
359
+ }
360
+
361
+ /* End: Mute/Volume */
362
+
363
+
364
+
365
+
366
+ /* Start: TRACK (Captions and Chapters) */
367
+ .mejs-controls .mejs-captions-button {
368
+ position: relative;
369
+ }
370
+
371
+ .mejs-controls .mejs-captions-button button {
372
+ background-position:-48px 0;
373
+ }
374
+ .mejs-controls .mejs-captions-button .mejs-captions-selector {
375
+ visibility: hidden;
376
+ position: absolute;
377
+ bottom: 26px;
378
+ right: -10px;
379
+ width: 130px;
380
+ height: 100px;
381
+ background: url(background.png);
382
+ background: rgba(50,50,50,0.7);
383
+ border: solid 1px transparent;
384
+ padding: 10px;
385
+ overflow: hidden;
386
+ -webkit-border-radius: 0;
387
+ -moz-border-radius: 0;
388
+ border-radius: 0;
389
+ }
390
+ .mejs-controls .mejs-captions-button:hover .mejs-captions-selector {
391
+ visibility: visible;
392
+ }
393
+
394
+ .mejs-controls .mejs-captions-button .mejs-captions-selector ul {
395
+ margin: 0;
396
+ padding: 0;
397
+ display: block;
398
+ list-style-type: none !important;
399
+ overflow: hidden;
400
+ }
401
+ .mejs-controls .mejs-captions-button .mejs-captions-selector ul li{
402
+ margin: 0 0 6px 0;
403
+ padding: 0;
404
+ list-style-type: none !important;
405
+ display:block;
406
+ color: #fff;
407
+ overflow: hidden;
408
+ }
409
+ .mejs-controls .mejs-captions-button .mejs-captions-selector ul li input{
410
+ clear: both;
411
+ float: left;
412
+ margin: 3px 3px 0px 5px;
413
+ }
414
+ .mejs-controls .mejs-captions-button .mejs-captions-selector ul li label{
415
+ width: 100px;
416
+ float: left;
417
+ padding: 4px 0 0 0;
418
+ line-height: 15px;
419
+ font-family: helvetica, arial;
420
+ font-size: 10px;
421
+ }
422
+
423
+ .mejs-controls .mejs-captions-button .mejs-captions-translations {
424
+ font-size: 10px;
425
+ margin: 0 0 5px 0;
426
+ }
427
+
428
+
429
+ .mejs-chapters {
430
+ position: absolute;
431
+ top: 0;
432
+ left: 0;
433
+ -xborder-right: solid 1px #fff;
434
+ width: 10000px;
435
+ }
436
+ .mejs-chapters .mejs-chapter {
437
+ position: absolute;
438
+ float: left;
439
+ background: #222;
440
+ background: rgba(0, 0, 0, 0.7);
441
+ background: -webkit-gradient(linear, left top, left bottom, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
442
+ background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
443
+ background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
444
+ filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#323232,endColorstr=#000000);
445
+ overflow: hidden;
446
+ border: 0;
447
+ }
448
+ .mejs-chapters .mejs-chapter .mejs-chapter-block {
449
+ font-size: 11px;
450
+ color: #fff;
451
+ padding: 5px;
452
+ display: block;
453
+ border-right: solid 1px #333;
454
+ border-bottom: solid 1px #333;
455
+ cursor: pointer;
456
+ }
457
+ .mejs-chapters .mejs-chapter .mejs-chapter-block-last {
458
+ border-right: none;
459
+ }
460
+
461
+ .mejs-chapters .mejs-chapter .mejs-chapter-block:hover {
462
+ /*background: #333;*/
463
+ background: #666;
464
+ background: rgba(102,102,102, 0.7);
465
+ background: -webkit-gradient(linear, left top, left bottom, from(rgba(102,102,102,0.7)), to(rgba(50,50,50,0.6)));
466
+ background: -moz-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
467
+ filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#666666,endColorstr=#323232);
468
+ }
469
+ .mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{
470
+ font-size: 12px;
471
+ font-weight: bold;
472
+ display: block;
473
+ white-space:nowrap;
474
+ text-overflow: ellipsis;
475
+ margin: 0 0 3px 0;
476
+ line-height: 12px;
477
+ }
478
+ .mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{
479
+ font-size: 12px;
480
+ line-height: 12px;
481
+ margin: 3px 0 4px 0;
482
+ display: block;
483
+ white-space:nowrap;
484
+ text-overflow: ellipsis;
485
+ }
486
+
487
+
488
+ .mejs-captions-layer {
489
+ position: absolute;
490
+ bottom: 0;
491
+ left: 0;
492
+ text-align:center;
493
+ /*font-weight: bold;*/
494
+ line-height: 22px;
495
+ font-size: 12px;
496
+ color: #fff;
497
+ }
498
+ .mejs-captions-layer a {
499
+ color: #fff;
500
+ text-decoration: underline;
501
+ }
502
+ .mejs-captions-layer[lang=ar] {
503
+ font-size: 20px;
504
+ font-weight: normal;
505
+ }
506
+
507
+ .mejs-captions-position {
508
+ position: absolute;
509
+ width: 100%;
510
+ bottom: 15px;
511
+ left: 0;
512
+ }
513
+
514
+ .mejs-captions-position-hover {
515
+ bottom: 45px;
516
+ }
517
+
518
+ .mejs-captions-text {
519
+ padding: 3px 5px;
520
+ background: url(background.png);
521
+ background: rgba(20, 20, 20, 0.8);
522
+
523
+ }
524
+ /* End: TRACK (Captions and Chapters) */
525
+
526
+
527
+
528
+ .mejs-clear {
529
+ clear: both;
530
+ }
531
+
532
+ /* Start: ERROR */
533
+ .me-cannotplay {
534
+ }
535
+ .me-cannotplay a {
536
+ color: #fff;
537
+ font-weight: bold;
538
+ }
539
+ .me-cannotplay span {
540
+ padding: 15px;
541
+ display: block;
542
+ }
543
+ /* End: ERROR */
544
+
545
+
546
+ /* Start: Loop */
547
+ .mejs-controls .mejs-loop-off button{
548
+ background-position: -64px -16px;
549
+ }
550
+ .mejs-controls .mejs-loop-on button {
551
+ background-position: -64px 0;
552
+ }
553
+ /* End: Loop */
554
+
555
+ /* Start: backlight */
556
+ .mejs-controls .mejs-backlight-off button{
557
+ background-position: -80px -16px;
558
+ }
559
+ .mejs-controls .mejs-backlight-on button {
560
+ background-position: -80px 0;
561
+ }
562
+ /* End: backlight */
563
+
564
+
565
+ /* Start: picture controls */
566
+ .mejs-controls .mejs-picturecontrols-button{
567
+ background-position: -96px 0;
568
+ }
569
+ /* End: picture controls */
mediaelement/mediaelementplayer.min.css ADDED
@@ -0,0 +1 @@
 
1
+ .mejs-container{position:relative;background:#000;font-family:Helvetica,Arial;}.mejs-container-fullscreen{position:fixed;left:0;top:0;right:0;bottom:0;overflow:hidden;}.mejs-container-fullscreen .mejs-mediaelement,.mejs-container-fullscreen video{width:100%;height:100%;}.mejs-background{position:absolute;top:0;left:0;}.mejs-mediaelement{position:absolute;top:0;left:0;}.mejs-poster{position:absolute;top:0;left:0;}.mejs-overlay{position:absolute;top:0;left:0;}.mejs-overlay-play{cursor:pointer;}.mejs-overlay-button{position:absolute;top:50%;left:50%;width:100px;height:100px;margin:-50px 0 0 -50px;background:url(bigplay.png) top left no-repeat;}.mejs-overlay:hover .mejs-overlay-button{background-position:0 -100px;}.mejs-overlay-loading{position:absolute;top:50%;left:50%;width:80px;height:80px;margin:-40px 0 0 -40px;background:#333;background:url(background.png);background:rgba(0,0,0,0.9);background:-webkit-gradient(linear,left top,left bottom,from(rgba(50,50,50,0.9)),to(rgba(0,0,0,0.9)));background:-moz-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:linear-gradient(rgba(50,50,50,0.9),rgba(0,0,0,0.9));}.mejs-overlay-loading span{display:block;width:80px;height:80px;background:transparent url(loading.gif) center center no-repeat;}.mejs-container .mejs-controls{position:absolute;background:none;list-style-type:none;margin:0;padding:0;bottom:0;left:0;background:url(background.png);background:rgba(0,0,0,0.7);background:-webkit-gradient(linear,left top,left bottom,from(rgba(50,50,50,0.7)),to(rgba(0,0,0,0.7)));background:-moz-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:linear-gradient(rgba(50,50,50,0.7),rgba(0,0,0,0.7));height:30px;width:100%;}.mejs-container .mejs-controls div{list-style-type:none;background-image:none;display:block;float:left;margin:0;padding:0;width:26px;height:26px;font-size:11px;line-height:11px;background:0;font-family:Helvetica,Arial;border:0;}.mejs-controls .mejs-button button{cursor:pointer;display:block;font-size:0;line-height:0;text-decoration:none;margin:7px 5px;padding:0;position:absolute;height:16px;width:16px;border:0;background:transparent url(controls.png) 0 0 no-repeat;}.mejs-container .mejs-controls .mejs-time{color:#fff;display:block;height:17px;width:auto;padding:8px 3px 0 3px;overflow:hidden;text-align:center;padding:auto 4px;}.mejs-container .mejs-controls .mejs-time span{font-size:11px;color:#fff;line-height:12px;display:block;float:left;margin:1px 2px 0 0;width:auto;}.mejs-controls .mejs-play button{background-position:0 0;}.mejs-controls .mejs-pause button{background-position:0 -16px;}.mejs-controls .mejs-stop button{background-position:-112px 0;}.mejs-controls div.mejs-time-rail{width:200px;padding-top:5px;}.mejs-controls .mejs-time-rail span{display:block;position:absolute;width:180px;height:10px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;cursor:pointer;}.mejs-controls .mejs-time-rail .mejs-time-total{margin:5px;background:#333;background:rgba(50,50,50,0.8);background:-webkit-gradient(linear,left top,left bottom,from(rgba(30,30,30,0.8)),to(rgba(60,60,60,0.8)));background:-moz-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:linear-gradient(rgba(30,30,30,0.8),rgba(60,60,60,0.8));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,startColorstr=#1E1E1E,endColorstr=#3C3C3C);}.mejs-controls .mejs-time-rail .mejs-time-loaded{background:#3caac8;background:rgba(60,170,200,0.8);background:-webkit-gradient(linear,left top,left bottom,from(rgba(44,124,145,0.8)),to(rgba(78,183,212,0.8)));background:-moz-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:linear-gradient(rgba(44,124,145,0.8),rgba(78,183,212,0.8));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,startColorstr=#2C7C91,endColorstr=#4EB7D4);width:0;}.mejs-controls .mejs-time-rail .mejs-time-current{width:0;background:#fff;background:rgba(255,255,255,0.8);background:-webkit-gradient(linear,left top,left bottom,from(rgba(255,255,255,0.9)),to(rgba(200,200,200,0.8)));background:-moz-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,startColorstr=#FFFFFF,endColorstr=#C8C8C8);}.mejs-controls .mejs-time-rail .mejs-time-handle{display:none;position:absolute;margin:0;width:10px;background:#fff;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;cursor:pointer;border:solid 2px #333;top:-2px;text-align:center;}.mejs-controls .mejs-time-rail .mejs-time-float{visibility:hidden;position:absolute;display:block;background:#eee;width:36px;height:17px;border:solid 1px #333;top:-26px;margin-left:-18px;text-align:center;color:#111;}.mejs-controls .mejs-time-rail:hover .mejs-time-float{visibility:visible;}.mejs-controls .mejs-time-rail .mejs-time-float-current{margin:2px;width:30px;display:block;text-align:center;left:0;}.mejs-controls .mejs-time-rail .mejs-time-float-corner{position:absolute;display:block;width:0;height:0;line-height:0;border:solid 5px #eee;border-color:#eee transparent transparent transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;top:15px;left:13px;}.mejs-controls .mejs-fullscreen-button button{background-position:-32px 0;}.mejs-controls .mejs-unfullscreen button{background-position:-32px -16px;}.mejs-controls .mejs-mute button{background-position:-16px -16px;}.mejs-controls .mejs-unmute button{background-position:-16px 0;}.mejs-controls .mejs-volume-button{position:relative;}.mejs-controls .mejs-volume-button .mejs-volume-slider{display:none;height:115px;width:25px;background:url(background.png);background:rgba(50,50,50,0.7);-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;top:-115px;left:0;z-index:1;position:absolute;margin:0;}.mejs-controls .mejs-volume-button:hover{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px;}.mejs-controls .mejs-volume-button:hover .mejs-volume-slider{display:block;}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total{position:absolute;left:11px;top:8px;width:2px;height:100px;background:#ddd;background:rgba(255,255,255,0.5);margin:0;}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current{position:absolute;left:11px;top:8px;width:2px;height:100px;background:#ddd;background:rgba(255,255,255,0.9);margin:0;}.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle{position:absolute;left:4px;top:-3px;width:16px;height:6px;background:#ddd;background:rgba(255,255,255,0.9);cursor:N-resize;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;margin:0;}.mejs-controls .mejs-captions-button{position:relative;}.mejs-controls .mejs-captions-button button{background-position:-48px 0;}.mejs-controls .mejs-captions-button .mejs-captions-selector{visibility:hidden;position:absolute;bottom:26px;right:-10px;width:130px;height:100px;background:url(background.png);background:rgba(50,50,50,0.7);border:solid 1px transparent;padding:10px;overflow:hidden;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}.mejs-controls .mejs-captions-button:hover .mejs-captions-selector{visibility:visible;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li{margin:0 0 6px 0;padding:0;list-style-type:none!important;display:block;color:#fff;overflow:hidden;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px;}.mejs-controls .mejs-captions-button .mejs-captions-selector ul li label{width:100px;float:left;padding:4px 0 0 0;line-height:15px;font-family:helvetica,arial;font-size:10px;}.mejs-controls .mejs-captions-button .mejs-captions-translations{font-size:10px;margin:0 0 5px 0;}.mejs-chapters{position:absolute;top:0;left:0;-xborder-right:solid 1px #fff;width:10000px;}.mejs-chapters .mejs-chapter{position:absolute;float:left;background:#222;background:rgba(0,0,0,0.7);background:-webkit-gradient(linear,left top,left bottom,from(rgba(50,50,50,0.7)),to(rgba(0,0,0,0.7)));background:-moz-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:linear-gradient(rgba(50,50,50,0.7),rgba(0,0,0,0.7));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,startColorstr=#323232,endColorstr=#000000);overflow:hidden;border:0;}.mejs-chapters .mejs-chapter .mejs-chapter-block{font-size:11px;color:#fff;padding:5px;display:block;border-right:solid 1px #333;border-bottom:solid 1px #333;cursor:pointer;}.mejs-chapters .mejs-chapter .mejs-chapter-block-last{border-right:none;}.mejs-chapters .mejs-chapter .mejs-chapter-block:hover{background:#666;background:rgba(102,102,102,0.7);background:-webkit-gradient(linear,left top,left bottom,from(rgba(102,102,102,0.7)),to(rgba(50,50,50,0.6)));background:-moz-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,startColorstr=#666666,endColorstr=#323232);}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{font-size:12px;font-weight:bold;display:block;white-space:nowrap;text-overflow:ellipsis;margin:0 0 3px 0;line-height:12px;}.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{font-size:12px;line-height:12px;margin:3px 0 4px 0;display:block;white-space:nowrap;text-overflow:ellipsis;}.mejs-captions-layer{position:absolute;bottom:0;left:0;text-align:center;line-height:22px;font-size:12px;color:#fff;}.mejs-captions-layer a{color:#fff;text-decoration:underline;}.mejs-captions-layer[lang=ar]{font-size:20px;font-weight:normal;}.mejs-captions-position{position:absolute;width:100%;bottom:15px;left:0;}.mejs-captions-position-hover{bottom:45px;}.mejs-captions-text{padding:3px 5px;background:url(background.png);background:rgba(20,20,20,0.8);}.mejs-clear{clear:both;}.me-cannotplay a{color:#fff;font-weight:bold;}.me-cannotplay span{padding:15px;display:block;}.mejs-controls .mejs-loop-off button{background-position:-64px -16px;}.mejs-controls .mejs-loop-on button{background-position:-64px 0;}.mejs-controls .mejs-backlight-off button{background-position:-80px -16px;}.mejs-controls .mejs-backlight-on button{background-position:-80px 0;}.mejs-controls .mejs-picturecontrols-button{background-position:-96px 0;}
mediaelement/mejs-skins.css ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* TED player */
2
+ .mejs-container.mejs-ted {
3
+
4
+ }
5
+ .mejs-ted .mejs-controls {
6
+ background: #eee;
7
+ height: 65px;
8
+ }
9
+
10
+ .mejs-ted .mejs-button,
11
+ .mejs-ted .mejs-time {
12
+ position: absolute;
13
+ background: #ddd;
14
+ }
15
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-total {
16
+ background-color: none;
17
+ background: url(controls-ted.png) repeat-x 0 -52px;
18
+ height: 6px;
19
+ }
20
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-loaded {
21
+ background-color: none;
22
+ background: url(controls-ted.png) repeat-x 0 -52px;
23
+ width: 0;
24
+ height: 6px;
25
+ }
26
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-current {
27
+ width: 0;
28
+ height: 6px;
29
+ background-color: none;
30
+ background: url(controls-ted.png) repeat-x 0 -59px;
31
+ }
32
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-handle {
33
+ display: block;
34
+ margin: 0;
35
+ width: 14px;
36
+ height: 21px;
37
+ top: -7px;
38
+ border: 0;
39
+ background: url(controls-ted.png) no-repeat 0 0;
40
+ }
41
+ .mejs-ted .mejs-controls .mejs-time-rail .mejs-time-float {
42
+ display: none;
43
+ }
44
+ .mejs-ted .mejs-controls .mejs-playpause-button {
45
+ top: 29px;
46
+ left: 9px;
47
+ width: 49px;
48
+ height: 28px;
49
+ }
50
+ .mejs-ted .mejs-controls .mejs-playpause-button button {
51
+ width: 49px;
52
+ height: 28px;
53
+ background: url(controls-ted.png) no-repeat -50px -23px;
54
+ margin: 0;
55
+ padding: 0;
56
+ }
57
+ .mejs-ted .mejs-controls .mejs-pause button {
58
+ background-position: 0 -23px;
59
+ }
60
+
61
+ .mejs-ted .mejs-controls .mejs-fullscreen-button {
62
+ top: 34px;
63
+ right: 9px;
64
+ width: 17px;
65
+ height: 15px;
66
+ background : none;
67
+ }
68
+ .mejs-ted .mejs-controls .mejs-fullscreen-button button {
69
+ width: 19px;
70
+ height: 17px;
71
+ background: transparent url(controls-ted.png) no-repeat 0 -66px;
72
+ margin: 0;
73
+ padding: 0;
74
+ }
75
+ .mejs-ted .mejs-controls .mejs-unfullscreen button {
76
+ background: transparent url(controls-ted.png) no-repeat -21px -66px;
77
+ margin: 0;
78
+ padding: 0;
79
+ }
80
+ .mejs-ted .mejs-controls .mejs-volume-button {
81
+ top: 30px;
82
+ right: 35px;
83
+ width: 24px;
84
+ height: 22px;
85
+ }
86
+ .mejs-ted .mejs-controls .mejs-mute button {
87
+ background: url(controls-ted.png) no-repeat -15px 0;
88
+ width: 24px;
89
+ height: 22px;
90
+ margin: 0;
91
+ padding: 0;
92
+ }
93
+ .mejs-ted .mejs-controls .mejs-unmute button {
94
+ background: url(controls-ted.png) no-repeat -40px 0;
95
+ width: 24px;
96
+ height: 22px;
97
+ margin: 0;
98
+ padding: 0;
99
+ }
100
+ .mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-slider {
101
+ background: #fff;
102
+ border: solid 1px #aaa;
103
+ border-width: 1px 1px 0 1px;
104
+ width: 22px;
105
+ height: 65px;
106
+ top: -65px;
107
+ }
108
+ .mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-total {
109
+ background: url(controls-ted.png) repeat-y -41px -66px;
110
+ left: 8px;
111
+ width: 6px;
112
+ height: 50px;
113
+ }
114
+ .mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-current {
115
+ left: 8px;
116
+ width: 6px;
117
+ background: url(controls-ted.png) repeat-y -48px -66px;
118
+ height: 50px;
119
+ }
120
+
121
+ .mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-handle {
122
+ display: none;
123
+ }
124
+
125
+ .mejs-ted .mejs-controls .mejs-time span {
126
+ color: #333;
127
+ }
128
+ .mejs-ted .mejs-controls .mejs-currenttime-container {
129
+ position: absolute;
130
+ top: 32px;
131
+ right: 100px;
132
+ border: solid 1px #999;
133
+ background: #fff;
134
+ color: #333;
135
+ padding-top: 2px;
136
+ border-radius: 3px;
137
+ color: #333;
138
+ }
139
+ .mejs-ted .mejs-controls .mejs-duration-container {
140
+
141
+ position: absolute;
142
+ top: 32px;
143
+ right: 65px;
144
+ border: solid 1px #999;
145
+ background: #fff;
146
+ color: #333;
147
+ padding-top: 2px;
148
+ border-radius: 3px;
149
+ color: #333;
150
+ }
151
+
152
+ .mejs-ted .mejs-controls .mejs-time button{
153
+ color: #333;
154
+ }
155
+ .mejs-ted .mejs-controls .mejs-captions-button {
156
+ display: none;
157
+ }
158
+ /* END: TED player */
159
+
160
+
161
+ /* WMP player */
162
+ .mejs-container.mejs-wmp {
163
+
164
+ }
165
+ .mejs-wmp .mejs-controls {
166
+ background: transparent url(controls-wmp-bg.png) center 16px no-repeat;
167
+ height: 65px;
168
+ }
169
+
170
+ .mejs-wmp .mejs-button,
171
+ .mejs-wmp .mejs-time {
172
+ position: absolute;
173
+ background: transparent;
174
+ }
175
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-total {
176
+ background-color: transparent;
177
+ border: solid 1px #ccc;
178
+ height: 3px;
179
+ }
180
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-loaded {
181
+ background-color: rgba(255,255,255,0.3);
182
+ width: 0;
183
+ height: 3px;
184
+ }
185
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-current {
186
+ width: 0;
187
+ height: 1px;
188
+ background-color: #014CB6;
189
+ border: solid 1px #7FC9FA;
190
+ border-width: 1px 0;
191
+ border-color: #7FC9FA #fff #619FF2 #fff;
192
+ }
193
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-handle {
194
+ display: block;
195
+ margin: 0;
196
+ width: 16px;
197
+ height: 9px;
198
+ top: -3px;
199
+ border: 0;
200
+ background: url(controls-wmp.png) no-repeat 0 -80px;
201
+ }
202
+ .mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-float {
203
+ display: none;
204
+ }
205
+ .mejs-wmp .mejs-controls .mejs-playpause-button {
206
+ top: 10px;
207
+ left: 50%;
208
+ margin: 10px 0 0 -20px;
209
+ width: 40px;
210
+ height: 40px;
211
+
212
+ }
213
+ .mejs-wmp .mejs-controls .mejs-playpause-button button {
214
+ width: 40px;
215
+ height: 40px;
216
+ background: url(controls-wmp.png) no-repeat 0 0;
217
+ margin: 0;
218
+ padding: 0;
219
+ }
220
+ .mejs-wmp .mejs-controls .mejs-pause button {
221
+ background-position: 0 -40px;
222
+ }
223
+
224
+ .mejs-wmp .mejs-controls .mejs-currenttime-container {
225
+ position: absolute;
226
+ top: 25px;
227
+ left: 50%;
228
+ margin-left: -93px;
229
+ }
230
+ .mejs-wmp .mejs-controls .mejs-duration-container {
231
+ position: absolute;
232
+ top: 25px;
233
+ left: 50%;
234
+ margin-left: -58px;
235
+ }
236
+
237
+
238
+ .mejs-wmp .mejs-controls .mejs-volume-button {
239
+ top: 32px;
240
+ right: 50%;
241
+ margin-right: -55px;
242
+ width: 20px;
243
+ height: 15px;
244
+ }
245
+ .mejs-wmp .mejs-controls .mejs-volume-button button {
246
+ margin: 0;
247
+ padding: 0;
248
+ background: url(controls-wmp.png) no-repeat -42px -17px;
249
+ width: 20px;
250
+ height: 15px;
251
+ }
252
+ .mejs-wmp .mejs-controls .mejs-unmute button {
253
+ margin: 0;
254
+ padding: 0;
255
+ background: url(controls-wmp.png) no-repeat -42px 0;
256
+ width: 20px;
257
+ height: 15px;
258
+ }
259
+ .mejs-wmp .mejs-controls .mejs-volume-button .mejs-volume-slider {
260
+ background: rgba(102,102,102,0.6);
261
+ }
262
+
263
+ .mejs-wmp .mejs-controls .mejs-fullscreen-button {
264
+ top: 32px;
265
+ right: 50%;
266
+ margin-right: -82px;
267
+ width: 15px;
268
+ height: 14px;
269
+ }
270
+ .mejs-wmp .mejs-controls .mejs-fullscreen-button button {
271
+ margin: 0;
272
+ padding: 0;
273
+ background: url(controls-wmp.png) no-repeat -63px 0;
274
+ width: 15px;
275
+ height: 14px;
276
+ }
277
+ .mejs-wmp .mejs-controls .mejs-captions-button {
278
+ display: none;
279
+ }
280
+ /* END: WMP player */
281
+
282
+
283
+
mediaelement/silverlightmediaelement.xap ADDED
Binary file
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: johndyer
3
  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.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
 
@@ -25,11 +25,21 @@ Check out <a href="http://mediaelementjs.com/">mediaElementjs.com</a> for more i
25
 
26
  ### Shortcode Options
27
 
 
 
 
 
 
 
28
  = src =
29
  This location of any audio or video file
30
 
31
  [video src="http://mysite.com/mymedia.mp4"]
32
 
 
 
 
 
33
  = type =
34
  The media type of the resource
35
 
@@ -130,6 +140,12 @@ All options enabled
130
 
131
  [audio mp3="http://mysite.com/mymedia.mp3" ogg="http://mysite.com/mymedia.ogg" preload="true" autoplay="true"]
132
 
 
 
 
 
 
 
133
  == Installation ==
134
 
135
  View <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more information.
@@ -140,6 +156,11 @@ View <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more inform
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")
3
  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.2
7
+ Stable tag: 2.1.7
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
 
25
 
26
  ### Shortcode Options
27
 
28
+ = Alternatives =
29
+ If you have a plugin that conflicts with MediaElement.js, you can also use the short codes
30
+
31
+ [mejsvideo src="http://mysite.com/mymedia.mp4" width="640" height="360"]
32
+ [mejsaudio src="http://mysite.com/mymedia.mp3"]
33
+
34
  = src =
35
  This location of any audio or video file
36
 
37
  [video src="http://mysite.com/mymedia.mp4"]
38
 
39
+ You can also leave off the extention and MediaElement.js will look for all media files matching the filename (mymedia.mp4, mymedia.webm, etc.)
40
+
41
+ [video src="http://mysite.com/mymedia"]
42
+
43
  = type =
44
  The media type of the resource
45
 
140
 
141
  [audio mp3="http://mysite.com/mymedia.mp3" ogg="http://mysite.com/mymedia.ogg" preload="true" autoplay="true"]
142
 
143
+ ### Use in a template
144
+ You can use Wordpress shortcodes in your templates using the do_shortcode function.
145
+
146
+ <?php echo do_shortcode('[video src="myvfile.mp4"]'); ?>
147
+
148
+
149
  == Installation ==
150
 
151
  View <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more information.
156
 
157
  == Changelog ==
158
 
159
+ = 2.1.7 =
160
+ * Skin selector (default, WMP, TED)
161
+ * Audio height and width
162
+ * Leave off the extension on the src attribute and files will be automatically detected
163
+
164
  = 2.1.4 =
165
  * Updated to latest MediaElement.js code
166
  * Changed scripts to use wp_enqueue_script("mediaelementjs-scripts")