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

Version Description

None

Download this release

Release Info

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

Code changes from version 2.2.5 to 2.7.0

mediaelement-js-wp.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package MediaElementJS
4
- * @version 2.2.5
5
  */
6
 
7
  /*
@@ -9,7 +9,7 @@ Plugin Name: MediaElement.js - HTML5 Audio and Video
9
  Plugin URI: http://mediaelementjs.com/
10
  Description: Video and audio plugin for WordPress built on MediaElement.js HTML5 video and audio player library. Embeds media in your post or page using HTML5 with Flash or Silverlight fallback support for non-HTML5 browsers. Video support: MP4, Ogg, WebM, WMV. Audio support: MP3, WMA, WAV
11
  Author: John Dyer
12
- Version: 2.2.5
13
  Author URI: http://j.hn/
14
  License: GPLv3, MIT
15
  */
@@ -19,12 +19,14 @@ Adapted from: http://videojs.com/ plugin
19
  */
20
 
21
  $mediaElementPlayerIndex = 1;
 
22
 
23
  /* Runs when plugin is activated */
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);
@@ -39,6 +41,7 @@ function mejs_install() {
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');
@@ -65,6 +68,7 @@ function mejs_create_menu() {
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' );
@@ -86,6 +90,18 @@ function mejs_settings_page() {
86
  <form method="post" action="options.php">
87
  <?php wp_nonce_field('update-options'); ?>
88
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
  <h3 class="title"><span>Video Settings</span></h3>
91
 
@@ -159,7 +175,7 @@ function mejs_settings_page() {
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') ?>" />
@@ -175,17 +191,21 @@ function mejs_settings_page() {
175
  }
176
 
177
 
178
- define('MEDIAELEMENTJS_DIR', WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/');
179
- // Javascript
 
 
180
  function mejs_add_scripts(){
181
- if (!is_admin()){
182
- // the scripts
183
- wp_enqueue_script("mediaelementjs-scripts", MEDIAELEMENTJS_DIR ."mediaelement-and-player.min.js", array('jquery'), "2.1.3", false);
184
- }
185
  }
186
  add_action('wp_print_scripts', 'mejs_add_scripts');
 
187
 
188
- // css
 
189
  function mejs_add_styles(){
190
  if (!is_admin()){
191
  // the style
@@ -198,42 +218,20 @@ function mejs_add_styles(){
198
  }
199
  add_action('wp_print_styles', 'mejs_add_styles');
200
 
201
- function mejs_add_header(){
202
- /*
203
 
204
- $dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
205
 
206
- echo <<<_end_
207
- <link rel="stylesheet" href="{$dir}mediaelementplayer.min.css" type="text/css" />
208
- <script src="{$dir}mediaelement-and-player.min.js" type="text/javascript"></script>
209
- _end_;
210
- */
211
-
212
- }
213
-
214
- // If this happens in the <head> tag it fails in iOS. Boo.
215
- function mejs_add_footer(){
216
- /*
217
- $defaultVideoWidth = get_option('mep_default_video_width');
218
- $defaultVideoHeight = get_option('mep_default_video_height');
219
-
220
- echo <<<_end_
221
- <script type="text/javascript">
222
- jQuery(document).ready(function($) {
223
- $('video[class=mep],audio[class=mep]').mediaelementplayer({defaultVideoWidth:{$defaultVideoWidth},defaultVideoHeight:{$defaultVideoHeight}});
224
- });
225
- </script>
226
- _end_;
227
- */
228
- }
229
-
230
- add_action('wp_head','mejs_add_header');
231
- add_action('wp_footer','mejs_add_footer');
232
-
233
- function mejs_media_shortcode($tagName, $atts){
234
 
235
  global $mediaElementPlayerIndex;
236
- $dir = WP_PLUGIN_URL.'/media-element-html5-video-and-audio-player/mediaelement/';
 
 
 
 
237
 
238
  extract(shortcode_atts(array(
239
  'src' => '',
@@ -264,12 +262,12 @@ function mejs_media_shortcode($tagName, $atts){
264
  ), $atts));
265
 
266
  if ($type) {
267
- $type_attribute = 'type="'.$type.'"';
268
  }
269
 
270
  /*
271
  if ($src) {
272
- $src_attribute = 'src="'.htmlspecialchars($src).'"';
273
  $flash_src = htmlspecialchars($src);
274
  }
275
  */
@@ -278,7 +276,7 @@ function mejs_media_shortcode($tagName, $atts){
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
 
@@ -342,113 +340,97 @@ function mejs_media_shortcode($tagName, $atts){
342
  }
343
  }
344
 
345
-
346
-
347
  if ($mp4) {
348
- $mp4_source = '<source src="'.htmlspecialchars($mp4).'" type="'.$tagName.'/mp4" />';
349
  $flash_src = htmlspecialchars($mp4);
350
  }
351
-
352
  if ($mp3) {
353
- $mp3_source = '<source src="'.htmlspecialchars($mp3).'" type="'.$tagName.'/mp3" />';
354
  $flash_src = htmlspecialchars($mp3);
355
- }
356
-
357
  if ($webm) {
358
- $webm_source = '<source src="'.htmlspecialchars($webm).'" type="'.$tagName.'/webm" />';
359
  }
360
-
361
  if ($ogg) {
362
- $ogg_source = '<source src="'.htmlspecialchars($ogg).'" type="'.$tagName.'/ogg" />';
363
  }
364
-
365
  if ($flv) {
366
- $flv_source = '<source src="'.htmlspecialchars($flv).'" type="'.$tagName.'/flv" />';
367
- }
368
-
369
  if ($wmv) {
370
- $wmv_source = '<source src="'.htmlspecialchars($wmv).'" type="'.$tagName.'/wmv" />';
371
  }
372
-
373
-
374
  if ($captions) {
375
- $captions_source = '<track src="'.$captions.'" kind="subtitles" srclang="'.$captionslang.'" />';
376
  }
377
 
 
378
  if ($width && $tagName == 'video') {
379
- $width_attribute = 'width="'.$width.'"';
380
  }
381
-
382
  if ($height && $tagName == 'video') {
383
- $height_attribute = 'height="'.$height.'"';
384
  }
385
-
386
  if ($poster) {
387
- $poster_attribute = 'poster="'.htmlspecialchars($poster).'"';
388
  }
389
-
390
  if ($preload) {
391
- $preload_attribute = 'preload="'.$preload.'"';
392
  }
393
-
394
  if ($autoplay) {
395
- $autoplay_attribute = 'autoplay="'.$autoplay.'"';
396
  }
397
 
 
398
  if ($loop) {
399
- $loop_option = ', loop: ' . $loop;
400
  }
401
 
402
- // CONTROLS
403
- $controls_option = ",features: ['playpause'";
404
- if ($progress == 'true')
405
- $controls_option .= ",'current','progress'";
406
- if ($duration == 'true')
407
- $controls_option .= ",'duration'";
408
- if ($volume == 'true')
409
- $controls_option .= ",'volume'";
410
- $controls_option .= ",'tracks'";
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}
432
- {$flv_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>
440
  </{$tagName}>
441
- <script type="text/javascript">
442
- jQuery(document).ready(function($) {
443
- $('#wp_mep_$mediaElementPlayerIndex').mediaelementplayer({
444
- m:1
445
- {$loop_option}
446
- {$controls_option}
447
- {$audio_size}
448
- });
449
- });
450
- </script>
451
-
452
  _end_;
453
 
454
  $mediaElementPlayerIndex++;
1
  <?php
2
  /**
3
  * @package MediaElementJS
4
+ * @version 2.7.0
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.7.0
13
  Author URI: http://j.hn/
14
  License: GPLv3, MIT
15
  */
19
  */
20
 
21
  $mediaElementPlayerIndex = 1;
22
+ define('MEDIAELEMENTJS_DIR', plugin_dir_url(__FILE__).'mediaelement/');
23
 
24
  /* Runs when plugin is activated */
25
  register_activation_hook(__FILE__,'mejs_install');
26
 
27
  function mejs_install() {
28
  add_option('mep_video_skin', '');
29
+ add_option('mep_script_on_demand', false);
30
 
31
  add_option('mep_default_video_height', 270);
32
  add_option('mep_default_video_width', 480);
41
  register_deactivation_hook( __FILE__, 'mejs_remove' );
42
  function mejs_remove() {
43
  delete_option('mep_video_skin');
44
+ delete_option('mep_script_on_demand');
45
 
46
  delete_option('mep_default_video_height');
47
  delete_option('mep_default_video_width');
68
  function mejs_register_settings() {
69
  //register our settings
70
  register_setting( 'mep_settings', 'mep_video_skin' );
71
+ register_setting( 'mep_settings', 'mep_script_on_demand' );
72
 
73
  register_setting( 'mep_settings', 'mep_default_video_height' );
74
  register_setting( 'mep_settings', 'mep_default_video_width' );
90
  <form method="post" action="options.php">
91
  <?php wp_nonce_field('update-options'); ?>
92
 
93
+ <h3 class="title"><span>General Settings</span></h3>
94
+
95
+ <table class="form-table">
96
+ <tr valign="top">
97
+ <th scope="row">
98
+ <label for="mep_script_on_demand">Load Script on Demand (requires WP 3.3)</label>
99
+ </th>
100
+ <td >
101
+ <input name="mep_script_on_demand" type="checkbox" id="mep_script_on_demand" <?php echo (get_option('mep_script_on_demand') == true ? "checked" : "") ?> />
102
+ </td>
103
+ </tr>
104
+ </table>
105
 
106
  <h3 class="title"><span>Video Settings</span></h3>
107
 
175
  </table>
176
 
177
  <input type="hidden" name="action" value="update" />
178
+ <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,mep_script_on_demand" />
179
 
180
  <p>
181
  <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
191
  }
192
 
193
 
194
+ // Javascript
195
+
196
+ // This is now handled by calling wp_enqueue_script inside the mejs_media_shortcode function by default. This means that MediaElement.js's JavaScript will only be called as needed
197
+ if (!get_option('mep_script_on_demand')) {
198
  function mejs_add_scripts(){
199
+ if (!is_admin()){
200
+ // the scripts
201
+ wp_enqueue_script("mediaelementjs-scripts", MEDIAELEMENTJS_DIR ."mediaelement-and-player.min.js", array('jquery'), "2.7.0", false);
202
+ }
203
  }
204
  add_action('wp_print_scripts', 'mejs_add_scripts');
205
+ }
206
 
207
+ // CSS
208
+ // still always enqueued so it happens in the <head> tag
209
  function mejs_add_styles(){
210
  if (!is_admin()){
211
  // the style
218
  }
219
  add_action('wp_print_styles', 'mejs_add_styles');
220
 
221
+ function mejs_media_shortcode($tagName, $atts){
 
222
 
 
223
 
224
+ // only enqueue when needed
225
+ if (get_option('mep_script_on_demand')) {
226
+ wp_enqueue_script("mediaelementjs-scripts", MEDIAELEMENTJS_DIR ."mediaelement-and-player.min.js", array('jquery'), "2.7.0", false);
227
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
 
229
  global $mediaElementPlayerIndex;
230
+ $dir = MEDIAELEMENTJS_DIR;
231
+ $attributes = array();
232
+ $sources = array();
233
+ $options = array();
234
+ $flash_src = '';
235
 
236
  extract(shortcode_atts(array(
237
  'src' => '',
262
  ), $atts));
263
 
264
  if ($type) {
265
+ $attributes[] = 'type="'.$type.'"';
266
  }
267
 
268
  /*
269
  if ($src) {
270
+ $attributes[] = 'src="'.htmlspecialchars($src).'"';
271
  $flash_src = htmlspecialchars($src);
272
  }
273
  */
276
 
277
  // does it have an extension?
278
  if (substr($src, strlen($src)-4, 1)=='.') {
279
+ $attributes[] = 'src="'.htmlspecialchars($src).'"';
280
  $flash_src = htmlspecialchars($src);
281
  } else {
282
 
340
  }
341
  }
342
 
343
+ // <source> tags
 
344
  if ($mp4) {
345
+ $sources[] = '<source src="'.htmlspecialchars($mp4).'" type="'.$tagName.'/mp4" />';
346
  $flash_src = htmlspecialchars($mp4);
347
  }
 
348
  if ($mp3) {
349
+ $sources[] = '<source src="'.htmlspecialchars($mp3).'" type="'.$tagName.'/mp3" />';
350
  $flash_src = htmlspecialchars($mp3);
351
+ }
 
352
  if ($webm) {
353
+ $sources[] = '<source src="'.htmlspecialchars($webm).'" type="'.$tagName.'/webm" />';
354
  }
 
355
  if ($ogg) {
356
+ $sources[] = '<source src="'.htmlspecialchars($ogg).'" type="'.$tagName.'/ogg" />';
357
  }
 
358
  if ($flv) {
359
+ $sources[] = '<source src="'.htmlspecialchars($flv).'" type="'.$tagName.'/flv" />';
360
+ }
 
361
  if ($wmv) {
362
+ $sources[] = '<source src="'.htmlspecialchars($wmv).'" type="'.$tagName.'/wmv" />';
363
  }
 
 
364
  if ($captions) {
365
+ $sources[] = '<track src="'.$captions.'" kind="subtitles" srclang="'.$captionslang.'" />';
366
  }
367
 
368
+ // <audio|video> attributes
369
  if ($width && $tagName == 'video') {
370
+ $attributes[] = 'width="'.$width.'"';
371
  }
 
372
  if ($height && $tagName == 'video') {
373
+ $attributes[] = 'height="'.$height.'"';
374
  }
 
375
  if ($poster) {
376
+ $attributes[] = 'poster="'.htmlspecialchars($poster).'"';
377
  }
 
378
  if ($preload) {
379
+ $attributes[] = 'preload="'.$preload.'"';
380
  }
 
381
  if ($autoplay) {
382
+ $attributes[] = 'autoplay="'.$autoplay.'"';
383
  }
384
 
385
+ // MEJS JavaScript options
386
  if ($loop) {
387
+ $options[] = 'loop: ' . $loop;
388
  }
389
 
390
+ // CONTROLS array
391
+ $controls_option[] = '"playpause"';
392
+ if ($progress == 'true') {
393
+ $controls_option[] = '"current"';
394
+ $controls_option[] = '"progress"';
395
+ }
396
+ if ($duration == 'true') {
397
+ $controls_option[] = '"duration"';
398
+ }
399
+ if ($volume == 'true') {
400
+ $controls_option[] = '"volume"';
401
+ }
402
+ $controls_option[] = '"tracks"';
403
+ if ($fullscreen == 'true') {
404
+ $controls_option[] = '"fullscreen"';
405
+ }
406
+ $options[] = '"features":[' . implode(',', $controls_option) . ']';
407
 
408
+ // <audio> size
 
409
  if ($tagName == 'audio') {
410
+ $options[] = '"audioWidth":'.$width;
411
+ $options[] = '"audioHeight":'.$height;
412
  }
413
 
414
+ // <video> class (skin)
415
+ $skin_class = '';
416
+ if ($skin != '') {
417
+ $skin_class = 'mejs-' . $skin;
418
  }
419
+
420
+
421
+ // BUILD HTML
422
+ $attributes_string = !empty($attributes) ? implode(' ', $attributes) : '';
423
+ $sources_string = !empty($sources) ? implode("\n\t\t", $sources) : '';
424
+ $options_string = !empty($options) ? '{' . implode(',', $options) . '}' : '';
425
+
426
+ $mediahtml = <<<_end_
427
+ <{$tagName} id="wp_mep_{$mediaElementPlayerIndex}" controls="controls" {$attributes_string} class="mejs-player {$skin_class}" data-mejsoptions='{$options_string}'>
428
+ {$sources_string}
429
  <object width="{$width}" height="{$height}" type="application/x-shockwave-flash" data="{$dir}flashmediaelement.swf">
430
  <param name="movie" value="{$dir}flashmediaelement.swf" />
431
  <param name="flashvars" value="controls=true&amp;file={$flash_src}" />
432
  </object>
433
  </{$tagName}>
 
 
 
 
 
 
 
 
 
 
 
434
  _end_;
435
 
436
  $mediaElementPlayerIndex++;
mediaelement/Thumbs.db ADDED
Binary file
mediaelement/controls.png CHANGED
Binary file
mediaelement/flashmediaelement.swf CHANGED
Binary file
mediaelement/mediaelement-and-player.js CHANGED
@@ -1,21 +1,21 @@
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.2.5';
19
 
20
  // player number (for missing, same id attr)
21
  mejs.meIndex = 0;
@@ -27,9 +27,15 @@ mejs.plugins = {
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: [12,0], types: ['video/webm']} // for future reference
 
 
 
 
 
 
31
  ]
32
- };
33
 
34
  /*
35
  Utility methods
@@ -53,11 +59,13 @@ mejs.Utility = {
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));
@@ -71,1043 +79,1459 @@ mejs.Utility = {
71
  return path;
72
  },
73
  secondsToTimeCode: function(time, forceHours, showFrameCount, fps) {
74
- //add framecount
75
- if (typeof showFrameCount == 'undefined') {
76
- showFrameCount=false;
77
- } else if(typeof fps == 'undefined') {
78
- fps = 25;
79
- }
80
-
81
- var hours = Math.floor(time / 3600) % 24,
82
- minutes = Math.floor(time / 60) % 60,
83
- seconds = Math.floor(time % 60),
84
- frames = Math.floor(((time % 1)*fps).toFixed(3)),
85
- result =
86
- ( (forceHours || hours > 0) ? (hours < 10 ? '0' + hours : hours) + ':' : '')
87
- + (minutes < 10 ? '0' + minutes : minutes) + ':'
88
- + (seconds < 10 ? '0' + seconds : seconds)
89
- + ((showFrameCount) ? ':' + (frames < 10 ? '0' + frames : frames) : '');
90
-
91
- return result;
92
- },
93
-
94
- timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
95
- if (typeof showFrameCount == 'undefined') {
96
- showFrameCount=false;
97
- } else if(typeof fps == 'undefined') {
98
- fps = 25;
99
- }
100
-
101
- var tc_array = hh_mm_ss_ff.split(":"),
102
- tc_hh = parseInt(tc_array[0]),
103
- tc_mm = parseInt(tc_array[1]),
104
- tc_ss = parseInt(tc_array[2]),
105
- tc_ff = 0,
106
- tc_in_seconds = 0;
107
-
108
- if (showFrameCount) {
109
- tc_ff = parseInt(tc_array[3])/fps;
110
- }
111
-
112
- tc_in_seconds = ( tc_hh * 3600 ) + ( tc_mm * 60 ) + tc_ss + tc_ff;
113
-
114
- return tc_in_seconds;
115
- }
116
- };
117
-
118
-
119
- // Core detector, plugins are added below
120
- mejs.PluginDetector = {
121
-
122
- // main public function to test a plug version number PluginDetector.hasPluginVersion('flash',[9,0,125]);
123
- hasPluginVersion: function(plugin, v) {
124
- var pv = this.plugins[plugin];
125
- v[1] = v[1] || 0;
126
- v[2] = v[2] || 0;
127
- 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;
128
- },
129
-
130
- // cached values
131
- nav: window.navigator,
132
- ua: window.navigator.userAgent.toLowerCase(),
133
-
134
- // stored version numbers
135
- plugins: [],
136
-
137
- // runs detectPlugin() and stores the version number
138
- addPlugin: function(p, pluginName, mimeType, activeX, axDetect) {
139
- this.plugins[p] = this.detectPlugin(pluginName, mimeType, activeX, axDetect);
140
- },
141
-
142
- // get the version number from the mimetype (all but IE) or ActiveX (IE)
143
- detectPlugin: function(pluginName, mimeType, activeX, axDetect) {
144
-
145
- var version = [0,0,0],
146
- description,
147
- i,
148
- ax;
149
-
150
- // Firefox, Webkit, Opera
151
- if (typeof(this.nav.plugins) != 'undefined' && typeof this.nav.plugins[pluginName] == 'object') {
152
- description = this.nav.plugins[pluginName].description;
153
- if (description && !(typeof this.nav.mimeTypes != 'undefined' && this.nav.mimeTypes[mimeType] && !this.nav.mimeTypes[mimeType].enabledPlugin)) {
154
- version = description.replace(pluginName, '').replace(/^\s+/,'').replace(/\sr/gi,'.').split('.');
155
- for (i=0; i<version.length; i++) {
156
- version[i] = parseInt(version[i].match(/\d+/), 10);
157
- }
158
- }
159
- // Internet Explorer / ActiveX
160
- } else if (typeof(window.ActiveXObject) != 'undefined') {
161
- try {
162
- ax = new ActiveXObject(activeX);
163
- if (ax) {
164
- version = axDetect(ax);
165
- }
166
- }
167
- catch (e) { }
168
- }
169
- return version;
170
- }
171
- };
172
-
173
- // Add Flash detection
174
- mejs.PluginDetector.addPlugin('flash','Shockwave Flash','application/x-shockwave-flash','ShockwaveFlash.ShockwaveFlash', function(ax) {
175
- // adapted from SWFObject
176
- var version = [],
177
- d = ax.GetVariable("$version");
178
- if (d) {
179
- d = d.split(" ")[1].split(",");
180
- version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
181
- }
182
- return version;
183
- });
184
-
185
- // Add Silverlight detection
186
- mejs.PluginDetector.addPlugin('silverlight','Silverlight Plug-In','application/x-silverlight-2','AgControl.AgControl', function (ax) {
187
- // Silverlight cannot report its version number to IE
188
- // but it does have a isVersionSupported function, so we have to loop through it to get a version number.
189
- // adapted from http://www.silverlightversion.com/
190
- var v = [0,0,0,0],
191
- loopMatch = function(ax, v, i, n) {
192
- while(ax.isVersionSupported(v[0]+ "."+ v[1] + "." + v[2] + "." + v[3])){
193
- v[i]+=n;
194
- }
195
- v[i] -= n;
196
- };
197
- loopMatch(ax, v, 0, 1);
198
- loopMatch(ax, v, 1, 1);
199
- loopMatch(ax, v, 2, 10000); // the third place in the version number is usually 5 digits (4.0.xxxxx)
200
- loopMatch(ax, v, 2, 1000);
201
- loopMatch(ax, v, 2, 100);
202
- loopMatch(ax, v, 2, 10);
203
- loopMatch(ax, v, 2, 1);
204
- loopMatch(ax, v, 3, 1);
205
-
206
- return v;
207
- });
208
- // add adobe acrobat
209
- /*
210
- PluginDetector.addPlugin('acrobat','Adobe Acrobat','application/pdf','AcroPDF.PDF', function (ax) {
211
- var version = [],
212
- d = ax.GetVersions().split(',')[0].split('=')[1].split('.');
213
-
214
- if (d) {
215
- version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
216
- }
217
- return version;
218
- });
219
- */
220
- // necessary detection (fixes for <IE9)
221
- mejs.MediaFeatures = {
222
- init: function() {
223
- var
224
- t = this,
225
- d = document,
226
- nav = mejs.PluginDetector.nav,
227
- ua = mejs.PluginDetector.ua.toLowerCase(),
228
- i,
229
- v,
230
- html5Elements = ['source','track','audio','video'];
231
-
232
- // detect browsers (only the ones that have some kind of quirk we need to work around)
233
- t.isiPad = (ua.match(/ipad/i) !== null);
234
- t.isiPhone = (ua.match(/iphone/i) !== null);
235
- t.isiOS = t.isiPhone || t.isiPad;
236
- t.isAndroid = (ua.match(/android/i) !== null);
237
- t.isBustedAndroid = (ua.match(/android 2\.[12]/) !== null);
238
- t.isIE = (nav.appName.toLowerCase().indexOf("microsoft") != -1);
239
- t.isChrome = (ua.match(/chrome/gi) !== null);
240
- t.isFirefox = (ua.match(/firefox/gi) !== null);
241
- t.isGecko = (ua.match(/gecko/gi) !== null);
242
- t.isWebkit = (ua.match(/webkit/gi) !== null);
243
-
244
- // create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
245
- for (i=0; i<html5Elements.length; i++) {
246
- v = document.createElement(html5Elements[i]);
247
- }
248
-
249
- t.supportsMediaTag = (typeof v.canPlayType !== 'undefined' || t.isBustedAndroid);
250
-
251
- // detect native JavaScript fullscreen (Safari/Firefox only, Chrome still fails)
252
-
253
- // iOS
254
- t.hasSemiNativeFullScreen = (typeof v.webkitEnterFullscreen !== 'undefined');
255
-
256
- // Webkit/firefox
257
- t.hasWebkitNativeFullScreen = (typeof v.webkitRequestFullScreen !== 'undefined');
258
- t.hasMozNativeFullScreen = (typeof v.mozRequestFullScreen !== 'undefined');
259
-
260
- t.hasTrueNativeFullScreen = (t.hasWebkitNativeFullScreen || t.hasMozNativeFullScreen);
261
-
262
-
263
- if (this.isChrome) {
264
- t.hasSemiNativeFullScreen = false;
265
- }
266
-
267
- if (t.hasTrueNativeFullScreen) {
268
- t.fullScreenEventName = (t.hasWebkitNativeFullScreen) ? 'webkitfullscreenchange' : 'mozfullscreenchange';
269
-
270
-
271
- t.isFullScreen = function() {
272
- if (v.mozRequestFullScreen) {
273
- return d.mozFullScreen;
274
- } else if (v.webkitRequestFullScreen) {
275
- return d.webkitIsFullScreen;
276
- }
277
- }
278
-
279
- t.requestFullScreen = function(el) {
280
-
281
- if (t.hasWebkitNativeFullScreen) {
282
- el.webkitRequestFullScreen();
283
- } else if (t.hasMozNativeFullScreen) {
284
- el.mozRequestFullScreen();
285
- }
286
- }
287
-
288
- t.cancelFullScreen = function() {
289
- if (t.hasWebkitNativeFullScreen) {
290
- document.webkitCancelFullScreen();
291
- } else if (t.hasMozNativeFullScreen) {
292
- document.mozCancelFullScreen();
293
- }
294
- }
295
-
296
- }
297
-
298
-
299
- // OS X 10.5 can't do this even if it says it can :(
300
- if (t.hasSemiNativeFullScreen && ua.match(/mac os x 10_5/i)) {
301
- t.hasNativeFullScreen = false;
302
- t.hasSemiNativeFullScreen = false;
303
- }
304
-
305
- }
306
- };
307
- mejs.MediaFeatures.init();
308
-
309
-
310
- /*
311
- extension methods to <video> or <audio> object to bring it into parity with PluginMediaElement (see below)
312
- */
313
- mejs.HtmlMediaElement = {
314
- pluginType: 'native',
315
- isFullScreen: false,
316
-
317
- setCurrentTime: function (time) {
318
- this.currentTime = time;
319
- },
320
-
321
- setMuted: function (muted) {
322
- this.muted = muted;
323
- },
324
-
325
- setVolume: function (volume) {
326
- this.volume = volume;
327
- },
328
-
329
- // for parity with the plugin versions
330
- stop: function () {
331
- this.pause();
332
- },
333
-
334
- // This can be a url string
335
- // or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
336
- setSrc: function (url) {
337
-
338
- // Fix for IE9 which can't set .src when there are <source> elements. Awesome, right?
339
- var
340
- existingSources = this.getElementsByTagName('source');
341
- while (existingSources.length > 0){
342
- this.removeChild(existingSources[0]);
343
  }
344
 
345
- if (typeof url == 'string') {
346
- this.src = url;
347
- } else {
348
- var i, media;
349
-
350
- for (i=0; i<url.length; i++) {
351
- media = url[i];
352
- if (this.canPlayType(media.type)) {
353
- this.src = media.src;
354
- }
355
- }
356
- }
357
- },
358
-
359
- setVideoSize: function (width, height) {
360
- this.width = width;
361
- this.height = height;
362
- }
363
- };
364
-
365
- /*
366
- Mimics the <video/audio> element by calling Flash's External Interface or Silverlights [ScriptableMember]
367
- */
368
- mejs.PluginMediaElement = function (pluginid, pluginType, mediaUrl) {
369
- this.id = pluginid;
370
- this.pluginType = pluginType;
371
- this.src = mediaUrl;
372
- this.events = {};
373
- };
374
-
375
- // JavaScript values and ExternalInterface methods that match HTML5 video properties methods
376
- // http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/fl/video/FLVPlayback.html
377
- // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
378
- mejs.PluginMediaElement.prototype = {
379
-
380
- // special
381
- pluginElement: null,
382
- pluginType: '',
383
- isFullScreen: false,
384
-
385
- // not implemented :(
386
- playbackRate: -1,
387
- defaultPlaybackRate: -1,
388
- seekable: [],
389
- played: [],
390
-
391
- // HTML5 read-only properties
392
- paused: true,
393
- ended: false,
394
- seeking: false,
395
- duration: 0,
396
- error: null,
397
-
398
- // HTML5 get/set properties, but only set (updated by event handlers)
399
- muted: false,
400
- volume: 1,
401
- currentTime: 0,
402
-
403
- // HTML5 methods
404
- play: function () {
405
- if (this.pluginApi != null) {
406
- this.pluginApi.playMedia();
407
- this.paused = false;
408
- }
409
- },
410
- load: function () {
411
- if (this.pluginApi != null) {
412
- this.pluginApi.loadMedia();
413
- this.paused = false;
414
- }
415
- },
416
- pause: function () {
417
- if (this.pluginApi != null) {
418
- this.pluginApi.pauseMedia();
419
- this.paused = true;
420
- }
421
- },
422
- stop: function () {
423
- if (this.pluginApi != null) {
424
- this.pluginApi.stopMedia();
425
- this.paused = true;
426
- }
427
- },
428
- canPlayType: function(type) {
429
- var i,
430
- j,
431
- pluginInfo,
432
- pluginVersions = mejs.plugins[this.pluginType];
433
-
434
- for (i=0; i<pluginVersions.length; i++) {
435
- pluginInfo = pluginVersions[i];
436
-
437
- // test if user has the correct plugin version
438
- if (mejs.PluginDetector.hasPluginVersion(this.pluginType, pluginInfo.version)) {
439
-
440
- // test for plugin playback types
441
- for (j=0; j<pluginInfo.types.length; j++) {
442
- // find plugin that can play the type
443
- if (type == pluginInfo.types[j]) {
444
- return true;
445
- }
446
- }
447
- }
448
- }
449
-
450
- return false;
451
- },
452
-
453
- // custom methods since not all JavaScript implementations support get/set
454
-
455
- // This can be a url string
456
- // or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
457
- setSrc: function (url) {
458
- if (typeof url == 'string') {
459
- this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(url));
460
- this.src = mejs.Utility.absolutizeUrl(url);
461
- } else {
462
- var i, media;
463
-
464
- for (i=0; i<url.length; i++) {
465
- media = url[i];
466
- if (this.canPlayType(media.type)) {
467
- this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
468
- this.src = mejs.Utility.absolutizeUrl(url);
469
- }
470
- }
471
- }
472
-
473
- },
474
- setCurrentTime: function (time) {
475
- if (this.pluginApi != null) {
476
- this.pluginApi.setCurrentTime(time);
477
- this.currentTime = time;
478
- }
479
- },
480
- setVolume: function (volume) {
481
- if (this.pluginApi != null) {
482
- this.pluginApi.setVolume(volume);
483
- this.volume = volume;
484
- }
485
- },
486
- setMuted: function (muted) {
487
- if (this.pluginApi != null) {
488
- this.pluginApi.setMuted(muted);
489
- this.muted = muted;
490
- }
491
- },
492
-
493
- // additional non-HTML5 methods
494
- setVideoSize: function (width, height) {
495
- if ( this.pluginElement.style) {
496
- this.pluginElement.style.width = width + 'px';
497
- this.pluginElement.style.height = height + 'px';
498
- }
499
- if (this.pluginApi != null) {
500
- this.pluginApi.setVideoSize(width, height);
501
- }
502
- },
503
-
504
- setFullscreen: function (fullscreen) {
505
- if (this.pluginApi != null) {
506
- this.pluginApi.setFullscreen(fullscreen);
507
- }
508
- },
509
 
510
- enterFullScreen: function() {
511
- this.setFullscreen(true);
512
  },
513
 
514
- enterFullScreen: function() {
515
- this.setFullscreen(false);
516
- },
517
-
518
- // start: fake events
519
- addEventListener: function (eventName, callback, bubble) {
520
- this.events[eventName] = this.events[eventName] || [];
521
- this.events[eventName].push(callback);
522
- },
523
- removeEventListener: function (eventName, callback) {
524
- if (!eventName) { this.events = {}; return true; }
525
- var callbacks = this.events[eventName];
526
- if (!callbacks) return true;
527
- if (!callback) { this.events[eventName] = []; return true; }
528
- for (i = 0; i < callbacks.length; i++) {
529
- if (callbacks[i] === callback) {
530
- this.events[eventName].splice(i, 1);
531
- return true;
532
- }
533
- }
534
- return false;
535
- },
536
- dispatchEvent: function (eventName) {
537
- var i,
538
- args,
539
- callbacks = this.events[eventName];
540
-
541
- if (callbacks) {
542
- args = Array.prototype.slice.call(arguments, 1);
543
- for (i = 0; i < callbacks.length; i++) {
544
- callbacks[i].apply(null, args);
545
- }
546
- }
547
- }
548
- // end: fake events
549
- };
550
-
551
-
552
- // Handles calls from Flash/Silverlight and reports them as native <video/audio> events and properties
553
- mejs.MediaPluginBridge = {
554
-
555
- pluginMediaElements:{},
556
- htmlMediaElements:{},
557
-
558
- registerPluginElement: function (id, pluginMediaElement, htmlMediaElement) {
559
- this.pluginMediaElements[id] = pluginMediaElement;
560
- this.htmlMediaElements[id] = htmlMediaElement;
561
- },
562
-
563
- // when Flash/Silverlight is ready, it calls out to this method
564
- initPlugin: function (id) {
565
-
566
- var pluginMediaElement = this.pluginMediaElements[id],
567
- htmlMediaElement = this.htmlMediaElements[id];
568
-
569
- // find the javascript bridge
570
- switch (pluginMediaElement.pluginType) {
571
- case "flash":
572
- pluginMediaElement.pluginElement = pluginMediaElement.pluginApi = document.getElementById(id);
573
- break;
574
- case "silverlight":
575
- pluginMediaElement.pluginElement = document.getElementById(pluginMediaElement.id);
576
- pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
577
- break;
578
- }
579
-
580
- if (pluginMediaElement.pluginApi != null && pluginMediaElement.success) {
581
- pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
582
- }
583
- },
584
-
585
- // receives events from Flash/Silverlight and sends them out as HTML5 media events
586
- // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
587
- fireEvent: function (id, eventName, values) {
588
-
589
- var
590
- e,
591
- i,
592
- bufferedTime,
593
- pluginMediaElement = this.pluginMediaElements[id];
594
-
595
- pluginMediaElement.ended = false;
596
- pluginMediaElement.paused = true;
597
-
598
- // fake event object to mimic real HTML media event.
599
- e = {
600
- type: eventName,
601
- target: pluginMediaElement
602
- };
603
-
604
- // attach all values to element and event object
605
- for (i in values) {
606
- pluginMediaElement[i] = values[i];
607
- e[i] = values[i];
608
- }
609
-
610
- // fake the newer W3C buffered TimeRange (loaded and total have been removed)
611
- bufferedTime = values.bufferedTime || 0;
612
-
613
- e.target.buffered = e.buffered = {
614
- start: function(index) {
615
- return 0;
616
- },
617
- end: function (index) {
618
- return bufferedTime;
619
- },
620
- length: 1
621
- };
622
-
623
- pluginMediaElement.dispatchEvent(e.type, e);
624
- }
625
- };
626
-
627
- /*
628
- Default options
629
- */
630
- mejs.MediaElementDefaults = {
631
- // allows testing on HTML5, flash, silverlight
632
- // auto: attempts to detect what the browser can do
633
- // native: forces HTML5 playback
634
- // shim: disallows HTML5, will attempt either Flash or Silverlight
635
- // none: forces fallback view
636
- mode: 'auto',
637
- // remove or reorder to change plugin priority and availability
638
- plugins: ['flash','silverlight'],
639
- // shows debug errors on screen
640
- enablePluginDebug: false,
641
- // overrides the type specified, useful for dynamic instantiation
642
- type: '',
643
- // path to Flash and Silverlight plugins
644
- pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
645
- // name of flash file
646
- flashName: 'flashmediaelement.swf',
647
- // turns on the smoothing filter in Flash
648
- enablePluginSmoothing: false,
649
- // name of silverlight file
650
- silverlightName: 'silverlightmediaelement.xap',
651
- // default if the <video width> is not specified
652
- defaultVideoWidth: 480,
653
- // default if the <video height> is not specified
654
- defaultVideoHeight: 270,
655
- // overrides <video width>
656
- pluginWidth: -1,
657
- // overrides <video height>
658
- pluginHeight: -1,
659
- // rate in milliseconds for Flash and Silverlight to fire the timeupdate event
660
- // larger number is less accurate, but less strain on plugin->JavaScript bridge
661
- timerRate: 250,
662
- // initial volume for player
663
- startVolume: 0.8,
664
- success: function () { },
665
- error: function () { }
666
- };
667
-
668
- /*
669
- Determines if a browser supports the <video> or <audio> element
670
- and returns either the native element or a Flash/Silverlight version that
671
- mimics HTML5 MediaElement
672
- */
673
- mejs.MediaElement = function (el, o) {
674
- return mejs.HtmlMediaElementShim.create(el,o);
675
- };
676
-
677
- mejs.HtmlMediaElementShim = {
678
-
679
- create: function(el, o) {
680
- var
681
- options = mejs.MediaElementDefaults,
682
- htmlMediaElement = (typeof(el) == 'string') ? document.getElementById(el) : el,
683
- tagName = htmlMediaElement.tagName.toLowerCase(),
684
- isMediaTag = (tagName === 'audio' || tagName === 'video'),
685
- src = (isMediaTag) ? htmlMediaElement.getAttribute('src') : htmlMediaElement.getAttribute('href'),
686
- poster = htmlMediaElement.getAttribute('poster'),
687
- autoplay = htmlMediaElement.getAttribute('autoplay'),
688
- preload = htmlMediaElement.getAttribute('preload'),
689
- controls = htmlMediaElement.getAttribute('controls'),
690
- playback,
691
- prop;
692
-
693
- // extend options
694
- for (prop in o) {
695
- options[prop] = o[prop];
696
- }
697
-
698
- // clean up attributes
699
- src = (src == 'undefined' || src == '' || src === null) ? null : src;
700
- poster = (typeof poster == 'undefined' || poster === null) ? '' : poster;
701
- preload = (typeof preload == 'undefined' || preload === null || preload === 'false') ? 'none' : preload;
702
- autoplay = !(typeof autoplay == 'undefined' || autoplay === null || autoplay === 'false');
703
- controls = !(typeof controls == 'undefined' || controls === null || controls === 'false');
704
-
705
- // test for HTML5 and plugin capabilities
706
- playback = this.determinePlayback(htmlMediaElement, options, mejs.MediaFeatures.supportsMediaTag, isMediaTag, src);
707
- playback.url = (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '';
708
-
709
- if (playback.method == 'native') {
710
- // second fix for android
711
- if (mejs.MediaFeatures.isBustedAndroid) {
712
- htmlMediaElement.src = playback.url;
713
- htmlMediaElement.addEventListener('click', function() {
714
- htmlMediaElement.play();
715
- }, true);
716
- }
717
-
718
- // add methods to native HTMLMediaElement
719
- return this.updateNative(playback, options, autoplay, preload);
720
- } else if (playback.method !== '') {
721
- // create plugin to mimic HTMLMediaElement
722
-
723
- return this.createPlugin( playback, options, poster, autoplay, preload, controls);
724
- } else {
725
- // boo, no HTML5, no Flash, no Silverlight.
726
- this.createErrorMessage( playback, options, poster );
727
  }
728
- },
729
 
730
- determinePlayback: function(htmlMediaElement, options, supportsMediaTag, isMediaTag, src) {
731
- var
732
- mediaFiles = [],
733
- i,
734
- j,
735
- k,
736
- l,
737
- n,
738
- type,
739
- result = { method: '', url: '', htmlMediaElement: htmlMediaElement, isVideo: (htmlMediaElement.tagName.toLowerCase() != 'audio')},
740
- pluginName,
741
- pluginVersions,
742
- pluginInfo,
743
- dummy;
744
-
745
- // STEP 1: Get URL and type from <video src> or <source src>
746
-
747
- // supplied type overrides <video type> and <source type>
748
- if (typeof options.type != 'undefined' && options.type !== '') {
749
-
750
- // accept either string or array of types
751
- if (typeof options.type == 'string') {
752
- mediaFiles.push({type:options.type, url:src});
753
- } else {
754
-
755
- for (i=0; i<options.type.length; i++) {
756
- mediaFiles.push({type:options.type[i], url:src});
757
- }
758
- }
759
-
760
- // test for src attribute first
761
- } else if (src !== null) {
762
- type = this.formatType(src, htmlMediaElement.getAttribute('type'));
763
- mediaFiles.push({type:type, url:src});
764
-
765
- // then test for <source> elements
766
- } else {
767
- // test <source> types to see if they are usable
768
- for (i = 0; i < htmlMediaElement.childNodes.length; i++) {
769
- n = htmlMediaElement.childNodes[i];
770
- if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
771
- src = n.getAttribute('src');
772
- type = this.formatType(src, n.getAttribute('type'));
773
- mediaFiles.push({type:type, url:src});
774
- }
775
- }
776
- }
777
 
778
- // in the case of dynamicly created players
779
- // check for audio types
780
- if (!isMediaTag && mediaFiles.length > 0 && mediaFiles[0].url !== null && this.getTypeFromFile(mediaFiles[0].url).indexOf('audio') > -1) {
781
- result.isVideo = false;
782
  }
783
 
784
-
785
- // STEP 2: Test for playback method
786
-
787
- // special case for Android which sadly doesn't implement the canPlayType function (always returns '')
788
- if (mejs.MediaFeatures.isBustedAndroid) {
789
- htmlMediaElement.canPlayType = function(type) {
790
- return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'maybe' : '';
791
- };
792
- }
793
 
794
-
795
- // test for native playback first
796
- if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'native')) {
797
-
798
- if (!isMediaTag) {
799
-
800
- // create a real HTML5 Media Element
801
- dummy = document.createElement( result.isVideo ? 'video' : 'audio');
802
- htmlMediaElement.parentNode.insertBefore(dummy, htmlMediaElement);
803
- htmlMediaElement.style.display = 'none';
804
-
805
- // use this one from now on
806
- result.htmlMediaElement = htmlMediaElement = dummy;
807
- }
808
-
809
- for (i=0; i<mediaFiles.length; i++) {
810
- // normal check
811
- if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
812
- // special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
813
- || htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== '') {
814
- result.method = 'native';
815
- result.url = mediaFiles[i].url;
816
- break;
817
- }
818
- }
819
-
820
- if (result.method === 'native') {
821
- if (result.url !== null) {
822
- htmlMediaElement.src = result.url;
823
- }
824
-
825
- return result;
826
- }
827
- }
828
-
829
- // if native playback didn't work, then test plugins
830
- if (options.mode === 'auto' || options.mode === 'shim') {
831
- for (i=0; i<mediaFiles.length; i++) {
832
- type = mediaFiles[i].type;
833
-
834
- // test all plugins in order of preference [silverlight, flash]
835
- for (j=0; j<options.plugins.length; j++) {
836
-
837
- pluginName = options.plugins[j];
838
-
839
- // test version of plugin (for future features)
840
- pluginVersions = mejs.plugins[pluginName];
841
- for (k=0; k<pluginVersions.length; k++) {
842
- pluginInfo = pluginVersions[k];
843
-
844
- // test if user has the correct plugin version
845
- if (mejs.PluginDetector.hasPluginVersion(pluginName, pluginInfo.version)) {
846
-
847
- // test for plugin playback types
848
- for (l=0; l<pluginInfo.types.length; l++) {
849
- // find plugin that can play the type
850
- if (type == pluginInfo.types[l]) {
851
- result.method = pluginName;
852
- result.url = mediaFiles[i].url;
853
- return result;
854
- }
855
- }
856
- }
857
- }
858
- }
859
- }
860
- }
861
-
862
- // what if there's nothing to play? just grab the first available
863
- if (result.method === '') {
864
- result.url = mediaFiles[0].url;
865
- }
866
-
867
- return result;
868
- },
869
-
870
- formatType: function(url, type) {
871
- var ext;
872
-
873
- // if no type is supplied, fake it with the extension
874
- if (url && !type) {
875
- return this.getTypeFromFile(url);
876
- } else {
877
- // only return the mime part of the type in case the attribute contains the codec
878
- // see http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-source-element
879
- // `video/mp4; codecs="avc1.42E01E, mp4a.40.2"` becomes `video/mp4`
880
-
881
- if (type && ~type.indexOf(';')) {
882
- return type.substr(0, type.indexOf(';'));
883
- } else {
884
- return type;
885
- }
886
- }
887
  },
888
 
889
- getTypeFromFile: function(url) {
890
- var ext = url.substring(url.lastIndexOf('.') + 1);
891
- return (/(mp4|m4v|ogg|ogv|webm|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video' : 'audio') + '/' + ext;
892
- },
893
-
894
- createErrorMessage: function(playback, options, poster) {
895
- var
896
- htmlMediaElement = playback.htmlMediaElement,
897
- errorContainer = document.createElement('div');
898
-
899
- errorContainer.className = 'me-cannotplay';
900
-
901
- try {
902
- errorContainer.style.width = htmlMediaElement.width + 'px';
903
- errorContainer.style.height = htmlMediaElement.height + 'px';
904
- } catch (e) {}
905
-
906
- errorContainer.innerHTML = (poster !== '') ?
907
- '<a href="' + playback.url + '"><img src="' + poster + '" /></a>' :
908
- '<a href="' + playback.url + '"><span>Download File</span></a>';
909
-
910
- htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
911
- htmlMediaElement.style.display = 'none';
912
-
913
- options.error(htmlMediaElement);
914
- },
915
-
916
- createPlugin:function(playback, options, poster, autoplay, preload, controls) {
917
- var
918
- htmlMediaElement = playback.htmlMediaElement,
919
- width = 1,
920
- height = 1,
921
- pluginid = 'me_' + playback.method + '_' + (mejs.meIndex++),
922
- pluginMediaElement = new mejs.PluginMediaElement(pluginid, playback.method, playback.url),
923
- container = document.createElement('div'),
924
- specialIEContainer,
925
- node,
926
- initVars;
927
-
928
- // check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
929
- node = htmlMediaElement.parentNode;
930
- while (node !== null && node.tagName.toLowerCase() != 'body') {
931
- if (node.parentNode.tagName.toLowerCase() == 'p') {
932
- node.parentNode.parentNode.insertBefore(node, node.parentNode);
933
- break;
934
- }
935
- node = node.parentNode;
936
- }
937
-
938
- if (playback.isVideo) {
939
- width = (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
940
- height = (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
941
-
942
- // in case of '%' make sure it's encoded
943
- width = mejs.Utility.encodeUrl(width);
944
- height = mejs.Utility.encodeUrl(height);
945
-
946
- } else {
947
- if (options.enablePluginDebug) {
948
- width = 320;
949
- height = 240;
950
- }
951
- }
952
-
953
- // register plugin
954
- pluginMediaElement.success = options.success;
955
- mejs.MediaPluginBridge.registerPluginElement(pluginid, pluginMediaElement, htmlMediaElement);
956
-
957
- // add container (must be added to DOM before inserting HTML for IE)
958
- container.className = 'me-plugin';
959
- htmlMediaElement.parentNode.insertBefore(container, htmlMediaElement);
960
-
961
- // flash/silverlight vars
962
- initVars = [
963
- 'id=' + pluginid,
964
- 'isvideo=' + ((playback.isVideo) ? "true" : "false"),
965
- 'autoplay=' + ((autoplay) ? "true" : "false"),
966
- 'preload=' + preload,
967
- 'width=' + width,
968
- 'startvolume=' + options.startVolume,
969
- 'timerrate=' + options.timerRate,
970
- 'height=' + height];
971
-
972
- if (playback.url !== null) {
973
- if (playback.method == 'flash') {
974
- initVars.push('file=' + mejs.Utility.encodeUrl(playback.url));
975
  } else {
976
- initVars.push('file=' + playback.url);
977
  }
978
  }
979
- if (options.enablePluginDebug) {
980
- initVars.push('debug=true');
981
- }
982
- if (options.enablePluginSmoothing) {
983
- initVars.push('smoothing=true');
984
- }
985
- if (controls) {
986
- initVars.push('controls=true'); // shows controls in the plugin if desired
987
- }
988
-
989
- switch (playback.method) {
990
- case 'silverlight':
991
- container.innerHTML =
992
- '<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + pluginid + '" name="' + pluginid + '" width="' + width + '" height="' + height + '">' +
993
- '<param name="initParams" value="' + initVars.join(',') + '" />' +
994
- '<param name="windowless" value="true" />' +
995
- '<param name="background" value="black" />' +
996
- '<param name="minRuntimeVersion" value="3.0.0.0" />' +
997
- '<param name="autoUpgrade" value="true" />' +
998
- '<param name="source" value="' + options.pluginPath + options.silverlightName + '" />' +
999
- '</object>';
1000
- break;
1001
-
1002
- case 'flash':
1003
-
1004
- if (mejs.MediaFeatures.isIE) {
1005
- specialIEContainer = document.createElement('div');
1006
- container.appendChild(specialIEContainer);
1007
- specialIEContainer.outerHTML =
1008
- '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
1009
- 'id="' + pluginid + '" width="' + width + '" height="' + height + '">' +
1010
- '<param name="movie" value="' + options.pluginPath + options.flashName + '?x=' + (new Date()) + '" />' +
1011
- '<param name="flashvars" value="' + initVars.join('&amp;') + '" />' +
1012
- '<param name="quality" value="high" />' +
1013
- '<param name="bgcolor" value="#000000" />' +
1014
- '<param name="wmode" value="transparent" />' +
1015
- '<param name="allowScriptAccess" value="always" />' +
1016
- '<param name="allowFullScreen" value="true" />' +
1017
- '</object>';
1018
-
1019
- } else {
1020
-
1021
- container.innerHTML =
1022
- '<embed id="' + pluginid + '" name="' + pluginid + '" ' +
1023
- 'play="true" ' +
1024
- 'loop="false" ' +
1025
- 'quality="high" ' +
1026
- 'bgcolor="#000000" ' +
1027
- 'wmode="transparent" ' +
1028
- 'allowScriptAccess="always" ' +
1029
- 'allowFullScreen="true" ' +
1030
- 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ' +
1031
- 'src="' + options.pluginPath + options.flashName + '" ' +
1032
- 'flashvars="' + initVars.join('&') + '" ' +
1033
- 'width="' + width + '" ' +
1034
- 'height="' + height + '"></embed>';
1035
- }
1036
- break;
1037
- }
1038
- // hide original element
1039
- htmlMediaElement.style.display = 'none';
1040
-
1041
- // FYI: options.success will be fired by the MediaPluginBridge
1042
-
1043
- return pluginMediaElement;
1044
  },
1045
-
1046
- updateNative: function(playback, options, autoplay, preload) {
1047
-
1048
- var htmlMediaElement = playback.htmlMediaElement,
1049
- m;
1050
-
1051
-
1052
- // add methods to video object to bring it into parity with Flash Object
1053
- for (m in mejs.HtmlMediaElement) {
1054
- htmlMediaElement[m] = mejs.HtmlMediaElement[m];
1055
- }
1056
-
1057
- /*
1058
- Chrome now supports preload="none"
1059
- if (mejs.MediaFeatures.isChrome) {
1060
-
1061
- // special case to enforce preload attribute (Chrome doesn't respect this)
1062
- if (preload === 'none' && !autoplay) {
1063
-
1064
- // forces the browser to stop loading (note: fails in IE9)
1065
- htmlMediaElement.src = '';
1066
- htmlMediaElement.load();
1067
- htmlMediaElement.canceledPreload = true;
1068
-
1069
- htmlMediaElement.addEventListener('play',function() {
1070
- if (htmlMediaElement.canceledPreload) {
1071
- htmlMediaElement.src = playback.url;
1072
- htmlMediaElement.load();
1073
- htmlMediaElement.play();
1074
- htmlMediaElement.canceledPreload = false;
1075
- }
1076
- }, false);
1077
- // for some reason Chrome forgets how to autoplay sometimes.
1078
- } else if (autoplay) {
1079
- htmlMediaElement.load();
1080
- htmlMediaElement.play();
1081
  }
1082
- }
1083
- */
1084
-
1085
- // fire success code
1086
- options.success(htmlMediaElement, htmlMediaElement);
1087
-
1088
- return htmlMediaElement;
1089
  }
1090
  };
1091
-
1092
- window.mejs = mejs;
1093
- window.MediaElement = mejs.MediaElement;
1094
-
1095
- /*!
1096
- * MediaElementPlayer
1097
- * http://mediaelementjs.com/
1098
- *
1099
- * Creates a controller bar for HTML5 <video> add <audio> tags
1100
- * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
1101
- *
1102
- * Copyright 2010-2011, John Dyer (http://j.hn/)
1103
- * Dual licensed under the MIT or GPL Version 2 licenses.
1104
- *
1105
- */
1106
- if (typeof jQuery != 'undefined') {
1107
- mejs.$ = jQuery;
1108
- } else if (typeof ender != 'undefined') {
1109
- mejs.$ = ender;
1110
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1111
  (function ($) {
1112
 
1113
  // default player values
@@ -1122,10 +1546,14 @@ if (typeof jQuery != 'undefined') {
1122
  videoWidth: -1,
1123
  // if set, overrides <video height>
1124
  videoHeight: -1,
 
 
 
 
1125
  // width of audio player
1126
- audioWidth: 400,
1127
  // height of audio player
1128
- audioHeight: 30,
1129
  // initial volume when the player starts (overrided by user cookie)
1130
  startVolume: 0.8,
1131
  // useful for <audio> player loops
@@ -1139,22 +1567,111 @@ if (typeof jQuery != 'undefined') {
1139
  showTimecodeFrameCount: false,
1140
  // used when showTimecodeFrameCount is set to true
1141
  framesPerSecond: 25,
1142
-
 
 
1143
  // Hide controls when playing and mouse is not over the video
1144
  alwaysShowControls: false,
1145
  // force iPad's native controls
1146
  iPadUseNativeControls: false,
1147
- // force iPad's native controls
1148
  iPhoneUseNativeControls: false,
1149
- // force iPad's native controls
1150
  AndroidUseNativeControls: false,
1151
  // features to show
1152
  features: ['playpause','current','progress','duration','tracks','volume','fullscreen'],
1153
  // only for dynamic
1154
- isVideo: true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1155
  };
1156
 
1157
  mejs.mepIndex = 0;
 
 
1158
 
1159
  // wraps a MediaElement object in player controls
1160
  mejs.MediaElementPlayer = function(node, o) {
@@ -1176,9 +1693,18 @@ if (typeof jQuery != 'undefined') {
1176
  // attach player to DOM node for reference
1177
  t.node.player = t;
1178
  }
1179
-
1180
- // create options
1181
- t.options = $.extend({},mejs.MepDefaults,o);
 
 
 
 
 
 
 
 
 
1182
 
1183
  // start up
1184
  t.init();
@@ -1188,6 +1714,11 @@ if (typeof jQuery != 'undefined') {
1188
 
1189
  // actual player
1190
  mejs.MediaElementPlayer.prototype = {
 
 
 
 
 
1191
  init: function() {
1192
 
1193
  var
@@ -1216,7 +1747,8 @@ if (typeof jQuery != 'undefined') {
1216
  t.$media.attr('controls', 'controls');
1217
 
1218
  // attempt to fix iOS 3 bug
1219
- t.$media.removeAttr('poster');
 
1220
 
1221
  // override Apple's autoplay override for iPads
1222
  if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
@@ -1249,10 +1781,20 @@ if (typeof jQuery != 'undefined') {
1249
  '</div>' +
1250
  '</div>')
1251
  .addClass(t.$media[0].className)
1252
- .insertBefore(t.$media);
 
 
 
 
 
 
 
 
 
 
1253
 
1254
  // move the <video/video> tag into the right spot
1255
- if (mf.isiPad || mf.isiPhone) {
1256
 
1257
  // sadly, you can't move nodes in iOS, so we have to destroy and recreate it!
1258
  var $newMedia = t.$media.clone();
@@ -1274,13 +1816,34 @@ if (typeof jQuery != 'undefined') {
1274
  t.layers = t.container.find('.mejs-layers');
1275
 
1276
  // determine the size
1277
- if (t.isVideo) {
1278
- // priority = videoWidth (forced), width attribute, defaultVideoWidth (for unspecified cases)
1279
- t.width = (t.options.videoWidth > 0) ? t.options.videoWidth : (t.$media[0].getAttribute('width') !== null) ? t.$media.attr('width') : t.options.defaultVideoWidth;
1280
- t.height = (t.options.videoHeight > 0) ? t.options.videoHeight : (t.$media[0].getAttribute('height') !== null) ? t.$media.attr('height') : t.options.defaultVideoHeight;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1281
  } else {
1282
- t.width = t.options.audioWidth;
1283
- t.height = t.options.audioHeight;
1284
  }
1285
 
1286
  // set the size, while we wait for the plugins to load below
@@ -1290,16 +1853,17 @@ if (typeof jQuery != 'undefined') {
1290
  meOptions.pluginWidth = t.height;
1291
  meOptions.pluginHeight = t.width;
1292
  }
 
 
1293
 
1294
  // create MediaElement shim
1295
  mejs.MediaElement(t.$media[0], meOptions);
1296
  },
1297
 
1298
- controlsAreVisible: true,
1299
-
1300
  showControls: function(doAnimation) {
1301
- var t = this,
1302
- doAnimation = typeof doAnimation == 'undefined' || doAnimation;
 
1303
 
1304
  if (t.controlsAreVisible)
1305
  return;
@@ -1332,9 +1896,9 @@ if (typeof jQuery != 'undefined') {
1332
  },
1333
 
1334
  hideControls: function(doAnimation) {
1335
- //console.log('hide doAnimation', doAnimation);
1336
- var t = this,
1337
- doAnimation = typeof doAnimation == 'undefined' || doAnimation;
1338
 
1339
  if (!t.controlsAreVisible)
1340
  return;
@@ -1375,8 +1939,9 @@ if (typeof jQuery != 'undefined') {
1375
 
1376
  startControlsTimer: function(timeout) {
1377
 
1378
- var t = this,
1379
- timeout = typeof timeout != 'undefined' ? timeout : 500;
 
1380
 
1381
  t.killControlsTimer('start');
1382
 
@@ -1441,6 +2006,7 @@ if (typeof jQuery != 'undefined') {
1441
 
1442
  // two built in features
1443
  t.buildposter(t, t.controls, t.layers, t.media);
 
1444
  t.buildoverlays(t, t.controls, t.layers, t.media);
1445
 
1446
  // grab for use by features
@@ -1470,54 +2036,70 @@ if (typeof jQuery != 'undefined') {
1470
 
1471
  // controls fade
1472
  if (t.isVideo) {
1473
- // click controls
1474
- if (t.media.pluginType == 'native') {
1475
- t.$media.click(function() {
1476
- if (media.paused) {
1477
- media.play();
 
 
 
 
 
 
 
1478
  } else {
1479
- media.pause();
 
 
1480
  }
1481
- });
 
1482
  } else {
1483
- $(t.media.pluginElement).click(function() {
 
 
 
 
1484
  if (media.paused) {
1485
  media.play();
1486
  } else {
1487
  media.pause();
1488
- }
1489
- });
1490
- }
1491
-
1492
-
1493
-
1494
- // show/hide controls
1495
- t.container
1496
- .bind('mouseenter mouseover', function () {
1497
- if (t.controlsEnabled) {
1498
- if (!t.options.alwaysShowControls) {
1499
- t.killControlsTimer('enter');
1500
- t.showControls();
1501
- t.startControlsTimer(2500);
1502
- }
1503
- }
1504
- })
1505
- .bind('mousemove', function() {
1506
- if (t.controlsEnabled) {
1507
- if (!t.controlsAreVisible)
1508
- t.showControls();
1509
- //t.killControlsTimer('move');
1510
- t.startControlsTimer(2500);
1511
- }
1512
- })
1513
- .bind('mouseleave', function () {
1514
- if (t.controlsEnabled) {
1515
- if (!t.media.paused && !t.options.alwaysShowControls) {
1516
- t.startControlsTimer(1000);
1517
- }
1518
  }
1519
  });
1520
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1521
  // check for autoplay
1522
  if (autoplay && !t.options.alwaysShowControls) {
1523
  t.hideControls();
@@ -1536,10 +2118,32 @@ if (typeof jQuery != 'undefined') {
1536
  }, false);
1537
  }
1538
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1539
 
1540
  // ended for all
1541
  t.media.addEventListener('ended', function (e) {
1542
- t.media.setCurrentTime(0);
 
 
 
 
1543
  t.media.pause();
1544
 
1545
  if (t.setProgressRail)
@@ -1552,7 +2156,7 @@ if (typeof jQuery != 'undefined') {
1552
  } else if (!t.options.alwaysShowControls && t.controlsEnabled) {
1553
  t.showControls();
1554
  }
1555
- }, true);
1556
 
1557
  // resize on the first play
1558
  t.media.addEventListener('loadedmetadata', function(e) {
@@ -1563,9 +2167,11 @@ if (typeof jQuery != 'undefined') {
1563
  t.updateCurrent();
1564
  }
1565
 
1566
- t.setPlayerSize(t.width, t.height);
1567
- t.setControlsSize();
1568
- }, true);
 
 
1569
 
1570
 
1571
  // webkit has trouble doing this without a delay
@@ -1586,6 +2192,10 @@ if (typeof jQuery != 'undefined') {
1586
  t.setControlsSize();
1587
  });
1588
 
 
 
 
 
1589
  }
1590
 
1591
  // force autoplay for HTML5
@@ -1596,7 +2206,12 @@ if (typeof jQuery != 'undefined') {
1596
 
1597
 
1598
  if (t.options.success) {
1599
- t.options.success(t.media, t.domNode, t);
 
 
 
 
 
1600
  }
1601
  },
1602
 
@@ -1614,10 +2229,13 @@ if (typeof jQuery != 'undefined') {
1614
  setPlayerSize: function(width,height) {
1615
  var t = this;
1616
 
1617
- // ie9 appears to need this (jQuery bug?)
1618
- //t.width = parseInt(width, 10);
1619
- //t.height = parseInt(height, 10);
1620
-
 
 
 
1621
  if (t.height.toString().indexOf('%') > 0) {
1622
 
1623
  // do we have the native dimensions yet?
@@ -1644,7 +2262,7 @@ if (typeof jQuery != 'undefined') {
1644
  .height('100%');
1645
 
1646
  // set shims
1647
- t.container.find('object embed')
1648
  .width('100%')
1649
  .height('100%');
1650
 
@@ -1680,15 +2298,28 @@ if (typeof jQuery != 'undefined') {
1680
  current = t.controls.find('.mejs-time-current'),
1681
  loaded = t.controls.find('.mejs-time-loaded');
1682
  others = rail.siblings();
 
1683
 
1684
- // find the size of all the other controls besides the rail
1685
- others.each(function() {
1686
- if ($(this).css('position') != 'absolute') {
1687
- usedWidth += $(this).outerWidth(true);
1688
- }
1689
- });
1690
- // fit the rail into the remaining space
1691
- railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.outerWidth(false));
 
 
 
 
 
 
 
 
 
 
 
 
1692
 
1693
  // outer area
1694
  rail.width(railWidth);
@@ -1770,22 +2401,39 @@ if (typeof jQuery != 'undefined') {
1770
  media.pause();
1771
  }
1772
  });
1773
-
 
1774
  if (mejs.MediaFeatures.isiOS || mejs.MediaFeatures.isAndroid) {
1775
  bigPlay.remove();
1776
  loading.remove();
1777
  }
 
1778
 
1779
 
1780
  // show/hide big play button
1781
  media.addEventListener('play',function() {
1782
  bigPlay.hide();
 
1783
  error.hide();
 
 
 
 
 
 
1784
  }, false);
 
1785
  media.addEventListener('pause',function() {
1786
- bigPlay.show();
 
 
1787
  }, false);
1788
 
 
 
 
 
 
1789
  // show/hide loading
1790
  media.addEventListener('loadeddata',function() {
1791
  // for some reason Chrome is firing this event
@@ -1805,6 +2453,41 @@ if (typeof jQuery != 'undefined') {
1805
  error.find('mejs-overlay-error').html("Error loading this resource");
1806
  }, false);
1807
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1808
 
1809
  findTracks: function() {
1810
  var t = this,
@@ -1812,11 +2495,15 @@ if (typeof jQuery != 'undefined') {
1812
 
1813
  // store for use by plugins
1814
  t.tracks = [];
1815
- tracktags.each(function() {
 
 
 
1816
  t.tracks.push({
1817
- srclang: $(this).attr('srclang').toLowerCase(),
1818
- src: $(this).attr('src'),
1819
- kind: $(this).attr('kind'),
 
1820
  entries: [],
1821
  isLoaded: false
1822
  });
@@ -1824,7 +2511,7 @@ if (typeof jQuery != 'undefined') {
1824
  },
1825
  changeSkin: function(className) {
1826
  this.container[0].className = 'mejs-container ' + className;
1827
- this.setPlayerSize();
1828
  this.setControlsSize();
1829
  },
1830
  play: function() {
@@ -1853,6 +2540,22 @@ if (typeof jQuery != 'undefined') {
1853
  },
1854
  setSrc: function(src) {
1855
  this.media.setSrc(src);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1856
  }
1857
  };
1858
 
@@ -1865,235 +2568,267 @@ if (typeof jQuery != 'undefined') {
1865
  };
1866
  }
1867
 
 
 
 
 
 
1868
  // push out to window
1869
  window.MediaElementPlayer = mejs.MediaElementPlayer;
1870
 
1871
  })(mejs.$);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1872
  (function($) {
1873
- // PLAY/pause BUTTON
1874
- $.extend(MediaElementPlayer.prototype, {
1875
- buildplaypause: function(player, controls, layers, media) {
1876
- var
1877
- t = this,
1878
- play =
1879
- $('<div class="mejs-button mejs-playpause-button mejs-play" >' +
1880
- '<button type="button" aria-controls="' + t.id + '" title="Play/Pause"></button>' +
1881
- '</div>')
1882
- .appendTo(controls)
1883
- .click(function(e) {
1884
- e.preventDefault();
1885
-
1886
- if (media.paused) {
1887
- media.play();
1888
- } else {
1889
- media.pause();
1890
- }
1891
-
1892
- return false;
1893
- });
1894
-
1895
- media.addEventListener('play',function() {
1896
- play.removeClass('mejs-play').addClass('mejs-pause');
1897
- }, false);
1898
- media.addEventListener('playing',function() {
1899
- play.removeClass('mejs-play').addClass('mejs-pause');
1900
- }, false);
1901
-
1902
-
1903
- media.addEventListener('pause',function() {
1904
- play.removeClass('mejs-pause').addClass('mejs-play');
1905
- }, false);
1906
- media.addEventListener('paused',function() {
1907
- play.removeClass('mejs-pause').addClass('mejs-play');
1908
- }, false);
1909
- }
1910
- });
1911
 
1912
- })(mejs.$);
1913
- (function($) {
1914
- // STOP BUTTON
1915
- $.extend(MediaElementPlayer.prototype, {
1916
- buildstop: function(player, controls, layers, media) {
1917
- var t = this,
1918
- stop =
1919
- $('<div class="mejs-button mejs-stop-button mejs-stop">' +
1920
- '<button type="button" aria-controls="' + t.id + '" title="Stop"></button>' +
1921
- '</div>')
1922
- .appendTo(controls)
1923
- .click(function() {
1924
- if (!media.paused) {
1925
- media.pause();
1926
- }
1927
- if (media.currentTime > 0) {
1928
- media.setCurrentTime(0);
1929
- controls.find('.mejs-time-current').width('0px');
1930
- controls.find('.mejs-time-handle').css('left', '0px');
1931
- controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0) );
1932
- controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0) );
1933
- layers.find('.mejs-poster').show();
1934
- }
1935
- });
1936
- }
1937
  });
1938
-
1939
- })(mejs.$);
1940
- (function($) {
1941
- // progress/loaded bar
1942
- $.extend(MediaElementPlayer.prototype, {
1943
- buildprogress: function(player, controls, layers, media) {
1944
-
1945
- $('<div class="mejs-time-rail">'+
1946
- '<span class="mejs-time-total">'+
1947
- '<span class="mejs-time-loaded"></span>'+
1948
- '<span class="mejs-time-current"></span>'+
1949
- '<span class="mejs-time-handle"></span>'+
1950
- '<span class="mejs-time-float">' +
1951
- '<span class="mejs-time-float-current">00:00</span>' +
1952
- '<span class="mejs-time-float-corner"></span>' +
1953
- '</span>'+
1954
- '</span>'+
1955
- '</div>')
1956
- .appendTo(controls);
1957
-
1958
- var
1959
- t = this,
1960
- total = controls.find('.mejs-time-total'),
1961
- loaded = controls.find('.mejs-time-loaded'),
1962
- current = controls.find('.mejs-time-current'),
1963
- handle = controls.find('.mejs-time-handle'),
1964
- timefloat = controls.find('.mejs-time-float'),
1965
- timefloatcurrent = controls.find('.mejs-time-float-current'),
1966
- handleMouseMove = function (e) {
1967
- // mouse position relative to the object
1968
- var x = e.pageX,
1969
- offset = total.offset(),
1970
- width = total.outerWidth(),
1971
- percentage = 0,
1972
- newTime = 0;
1973
-
1974
-
1975
- if (x > offset.left && x <= width + offset.left && media.duration) {
1976
- percentage = ((x - offset.left) / width);
1977
- newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
1978
-
1979
- // seek to where the mouse is
1980
- if (mouseIsDown) {
1981
- media.setCurrentTime(newTime);
1982
- }
1983
-
1984
- // position floating time box
1985
- var pos = x - offset.left;
1986
- timefloat.css('left', pos);
1987
- timefloatcurrent.html( mejs.Utility.secondsToTimeCode(newTime) );
1988
- }
1989
- },
1990
- mouseIsDown = false,
1991
- mouseIsOver = false;
1992
-
1993
- // handle clicks
1994
- //controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
1995
- total
1996
- .bind('mousedown', function (e) {
1997
- // only handle left clicks
1998
- if (e.which === 1) {
1999
- mouseIsDown = true;
2000
- handleMouseMove(e);
2001
- return false;
2002
- }
2003
- });
2004
-
2005
- controls.find('.mejs-time-total')
2006
- .bind('mouseenter', function(e) {
2007
- mouseIsOver = true;
2008
- })
2009
- .bind('mouseleave',function(e) {
2010
- mouseIsOver = false;
2011
- });
2012
-
2013
- $(document)
2014
- .bind('mouseup', function (e) {
2015
- mouseIsDown = false;
2016
- //handleMouseMove(e);
2017
- })
2018
- .bind('mousemove', function (e) {
2019
- if (mouseIsDown || mouseIsOver) {
2020
- handleMouseMove(e);
2021
- }
2022
- });
2023
-
2024
- // loading
2025
- media.addEventListener('progress', function (e) {
2026
- player.setProgressRail(e);
2027
- player.setCurrentRail(e);
2028
- }, false);
2029
-
2030
- // current time
2031
- media.addEventListener('timeupdate', function(e) {
2032
- player.setProgressRail(e);
2033
- player.setCurrentRail(e);
2034
- }, false);
2035
-
2036
-
2037
- // store for later use
2038
- t.loaded = loaded;
2039
- t.total = total;
2040
- t.current = current;
2041
- t.handle = handle;
2042
- },
2043
- setProgressRail: function(e) {
2044
-
2045
- var
2046
- t = this,
2047
- target = (e != undefined) ? e.target : t.media,
2048
- percent = null;
2049
-
2050
- // newest HTML5 spec has buffered array (FF4, Webkit)
2051
- if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
2052
- // TODO: account for a real array with multiple values (only Firefox 4 has this so far)
2053
- percent = target.buffered.end(0) / target.duration;
2054
- }
2055
- // Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
2056
- // to be anything other than 0. If the byte count is available we use this instead.
2057
- // Browsers that support the else if do not seem to have the bufferedBytes value and
2058
- // should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
2059
- else if (target && target.bytesTotal != undefined && target.bytesTotal > 0 && target.bufferedBytes != undefined) {
2060
- percent = target.bufferedBytes / target.bytesTotal;
2061
- }
2062
- // Firefox 3 with an Ogg file seems to go this way
2063
- else if (e && e.lengthComputable && e.total != 0) {
2064
- percent = e.loaded/e.total;
2065
- }
2066
-
2067
- // finally update the progress bar
2068
- if (percent !== null) {
2069
- percent = Math.min(1, Math.max(0, percent));
2070
- // update loaded bar
2071
- if (t.loaded && t.total) {
2072
- t.loaded.width(t.total.width() * percent);
2073
- }
2074
- }
2075
- },
2076
- setCurrentRail: function() {
2077
-
2078
- var t = this;
2079
-
2080
- if (t.media.currentTime != undefined && t.media.duration) {
2081
 
2082
- // update bar and handle
2083
- if (t.total && t.handle) {
2084
- var
2085
- newWidth = t.total.width() * t.media.currentTime / t.media.duration,
2086
- handlePos = newWidth - (t.handle.outerWidth(true) / 2);
2087
-
2088
- t.current.width(newWidth);
2089
- t.handle.css('left', handlePos);
2090
- }
2091
- }
2092
 
2093
- }
2094
- });
2095
- })(mejs.$);
2096
- (function($) {
2097
  // current and duration 00:00 / 00:00
2098
  $.extend(MediaElementPlayer.prototype, {
2099
  buildcurrent: function(player, controls, layers, media) {
@@ -2117,9 +2852,13 @@ if (typeof jQuery != 'undefined') {
2117
  var t = this;
2118
 
2119
  if (controls.children().last().find('.mejs-currenttime').length > 0) {
2120
- $(' <span> | </span> '+
2121
- '<span class="mejs-duration">' + (player.options.alwaysShowHours ? '00:' : '')
2122
- + (player.options.showTimecodeFrameCount? '00:00:00':'00:00')+ '</span>')
 
 
 
 
2123
  .appendTo(controls.find('.mejs-time'));
2124
  } else {
2125
 
@@ -2127,8 +2866,12 @@ if (typeof jQuery != 'undefined') {
2127
  controls.find('.mejs-currenttime').parent().addClass('mejs-currenttime-container');
2128
 
2129
  $('<div class="mejs-time mejs-duration-container">'+
2130
- '<span class="mejs-duration">' + (player.options.alwaysShowHours ? '00:' : '')
2131
- + (player.options.showTimecodeFrameCount? '00:00:00':'00:00')+ '</span>' +
 
 
 
 
2132
  '</div>')
2133
  .appendTo(controls);
2134
  }
@@ -2157,171 +2900,245 @@ if (typeof jQuery != 'undefined') {
2157
  }
2158
  });
2159
 
2160
- })(mejs.$);
2161
- (function($) {
2162
-
2163
- $.extend(MediaElementPlayer.prototype, {
2164
- buildvolume: function(player, controls, layers, media) {
2165
- var t = this,
2166
- mute =
2167
- $('<div class="mejs-button mejs-volume-button mejs-mute">'+
2168
- '<button type="button" aria-controls="' + t.id + '" title="Mute/Unmute"></button>'+
2169
- '<div class="mejs-volume-slider">'+ // outer background
2170
- '<div class="mejs-volume-total"></div>'+ // line background
2171
- '<div class="mejs-volume-current"></div>'+ // current volume
2172
- '<div class="mejs-volume-handle"></div>'+ // handle
2173
- '</div>'+
2174
- '</div>')
2175
- .appendTo(controls),
2176
- volumeSlider = mute.find('.mejs-volume-slider'),
2177
- volumeTotal = mute.find('.mejs-volume-total'),
2178
- volumeCurrent = mute.find('.mejs-volume-current'),
2179
- volumeHandle = mute.find('.mejs-volume-handle'),
2180
-
2181
- positionVolumeHandle = function(volume) {
2182
-
2183
- if (!volumeSlider.is(':visible')) {
2184
- volumeSlider.show();
2185
- positionVolumeHandle(volume);
2186
- volumeSlider.hide()
2187
- return;
2188
- }
2189
-
2190
- var
2191
-
2192
- // height of the full size volume slider background
2193
- totalHeight = volumeTotal.height(),
2194
-
2195
- // top/left of full size volume slider background
2196
- totalPosition = volumeTotal.position(),
2197
-
2198
- // the new top position based on the current volume
2199
- // 70% volume on 100px height == top:30px
2200
- newTop = totalHeight - (totalHeight * volume);
2201
-
2202
- // handle
2203
- volumeHandle.css('top', totalPosition.top + newTop - (volumeHandle.height() / 2));
2204
-
2205
- // show the current visibility
2206
- volumeCurrent.height(totalHeight - newTop );
2207
- volumeCurrent.css('top', totalPosition.top + newTop);
2208
- },
2209
- handleVolumeMove = function(e) {
2210
- var
2211
- railHeight = volumeTotal.height(),
2212
- totalOffset = volumeTotal.offset(),
2213
- totalTop = parseInt(volumeTotal.css('top').replace(/px/,''),10),
2214
- newY = e.pageY - totalOffset.top,
2215
- volume = (railHeight - newY) / railHeight
2216
-
2217
- // the controls just hide themselves (usually when mouse moves too far up)
2218
- if (totalOffset.top == 0)
2219
- return;
2220
-
2221
- // 0-1
2222
- volume = Math.max(0,volume);
2223
- volume = Math.min(volume,1);
2224
-
2225
- // TODO: handle vertical and horizontal CSS
2226
- // only allow it to move within the rail
2227
- if (newY < 0)
2228
- newY = 0;
2229
- else if (newY > railHeight)
2230
- newY = railHeight;
2231
-
2232
- // move the handle to match the mouse
2233
- volumeHandle.css('top', newY - (volumeHandle.height() / 2) + totalTop );
2234
-
2235
- // show the current visibility
2236
- volumeCurrent.height(railHeight-newY);
2237
- volumeCurrent.css('top',newY+totalTop);
2238
-
2239
- // set mute status
2240
- if (volume == 0) {
2241
- media.setMuted(true);
2242
- mute.removeClass('mejs-mute').addClass('mejs-unmute');
2243
- } else {
2244
- media.setMuted(false);
2245
- mute.removeClass('mejs-unmute').addClass('mejs-mute');
2246
- }
2247
-
2248
- volume = Math.max(0,volume);
2249
- volume = Math.min(volume,1);
2250
-
2251
- // set the volume
2252
- media.setVolume(volume);
2253
- },
2254
- mouseIsDown = false;
2255
-
2256
- // SLIDER
2257
- mute
2258
- .hover(function() {
2259
- volumeSlider.show();
2260
- }, function() {
2261
- volumeSlider.hide();
2262
- })
2263
-
2264
- volumeSlider
2265
- .bind('mousedown', function (e) {
2266
- handleVolumeMove(e);
2267
- mouseIsDown = true;
2268
- return false;
2269
- });
2270
- $(document)
2271
- .bind('mouseup', function (e) {
2272
- mouseIsDown = false;
2273
- })
2274
- .bind('mousemove', function (e) {
2275
- if (mouseIsDown) {
2276
- handleVolumeMove(e);
2277
- }
2278
- });
2279
-
2280
-
2281
- // MUTE button
2282
- mute.find('button').click(function() {
2283
-
2284
- media.setMuted( !media.muted );
2285
-
2286
- });
2287
-
2288
- // listen for volume change events from other sources
2289
- media.addEventListener('volumechange', function(e) {
2290
- if (!mouseIsDown) {
2291
- if (media.muted) {
2292
- positionVolumeHandle(0);
2293
- mute.removeClass('mejs-mute').addClass('mejs-unmute');
2294
- } else {
2295
- positionVolumeHandle(e.target.volume);
2296
- mute.removeClass('mejs-unmute').addClass('mejs-mute');
2297
- }
2298
- }
2299
- }, true);
2300
-
2301
- // set initial volume
2302
- //console.log('init volume',player.options.startVolume);
2303
- positionVolumeHandle(player.options.startVolume);
2304
-
2305
- // shim gets the startvolume as a parameter, but we have to set it on the native <video> and <audio> elements
2306
- if (media.pluginType === 'native') {
2307
- media.setVolume(player.options.startVolume);
2308
- }
2309
- }
2310
- });
2311
-
2312
- })(mejs.$);
2313
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2314
  (function($) {
2315
 
2316
  $.extend(mejs.MepDefaults, {
2317
- forcePluginFullScreen: false,
2318
- newWindowCallback: function() { return '';}
 
2319
  });
2320
 
2321
  $.extend(MediaElementPlayer.prototype, {
2322
 
2323
  isFullScreen: false,
2324
 
 
 
2325
  docStyleOverflow: null,
2326
 
2327
  isInIframe: false,
@@ -2335,13 +3152,18 @@ if (typeof jQuery != 'undefined') {
2335
 
2336
  // native events
2337
  if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
2338
- //player.container.bind(mejs.MediaFeatures.fullScreenEventName, function(e) {
2339
- player.container.bind('webkitfullscreenchange', function(e) {
2340
 
 
 
 
 
 
2341
  if (mejs.MediaFeatures.isFullScreen()) {
 
2342
  // reset the controls once we are fully in full screen
2343
  player.setControlsSize();
2344
- } else {
 
2345
  // when a user presses ESC
2346
  // make sure to put the player back into place
2347
  player.exitFullScreen();
@@ -2355,10 +3177,13 @@ if (typeof jQuery != 'undefined') {
2355
  container = player.container,
2356
  fullscreenBtn =
2357
  $('<div class="mejs-button mejs-fullscreen-button">' +
2358
- '<button type="button" aria-controls="' + t.id + '" title="Fullscreen"></button>' +
2359
  '</div>')
2360
- .appendTo(controls)
2361
- .click(function() {
 
 
 
2362
  var isFullScreen = (mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || player.isFullScreen;
2363
 
2364
  if (isFullScreen) {
@@ -2367,6 +3192,165 @@ if (typeof jQuery != 'undefined') {
2367
  player.enterFullScreen();
2368
  }
2369
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2370
 
2371
  player.fullscreenBtn = fullscreenBtn;
2372
 
@@ -2381,11 +3365,9 @@ if (typeof jQuery != 'undefined') {
2381
 
2382
  var t = this;
2383
 
2384
-
2385
-
2386
  // firefox+flash can't adjust plugin sizes without resetting :(
2387
- if (t.media.pluginType !== 'native' && (mejs.MediaFeatures.isGecko || t.options.forcePluginFullScreen)) {
2388
- t.media.setFullscreen(true);
2389
  //player.isFullScreen = true;
2390
  return;
2391
  }
@@ -2399,31 +3381,66 @@ if (typeof jQuery != 'undefined') {
2399
  normalHeight = t.container.height();
2400
  normalWidth = t.container.width();
2401
 
2402
-
2403
  // attempt to do true fullscreen (Safari 5.1 and Firefox Nightly only for now)
2404
- if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
2405
-
2406
- mejs.MediaFeatures.requestFullScreen(t.container[0]);
2407
- //return;
2408
-
2409
- } else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
2410
- t.media.webkitEnterFullscreen();
2411
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2412
  }
2413
 
2414
  // check for iframe launch
2415
- if (t.isInIframe && t.options.newWindowUrl !== '') {
2416
- t.pause();
2417
- //window.open(t.options.newWindowUrl, t.id, 'width=' + t.width + ',height=' + t.height + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
2418
  var url = t.options.newWindowCallback(this);
 
 
2419
  if (url !== '') {
2420
- window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
 
 
 
 
 
 
 
 
 
 
 
 
 
2421
  }
2422
- return;
2423
  }
2424
 
2425
  // full window code
2426
-
2427
 
2428
 
2429
  // make full size
@@ -2432,20 +3449,28 @@ if (typeof jQuery != 'undefined') {
2432
  .width('100%')
2433
  .height('100%');
2434
  //.css({position: 'fixed', left: 0, top: 0, right: 0, bottom: 0, overflow: 'hidden', width: '100%', height: '100%', 'z-index': 1000});
2435
- setTimeout(function() {
2436
- t.container.css({width: '100%', height: '100%'});
2437
- }, 500);
2438
- //console.log('fullscreen', t.container.width());
 
 
 
 
 
2439
 
2440
  if (t.pluginType === 'native') {
2441
  t.$media
2442
  .width('100%')
2443
  .height('100%');
2444
  } else {
2445
- t.container.find('object embed')
2446
  .width('100%')
2447
  .height('100%');
2448
- t.media.setVideoSize($(window).width(),$(window).height());
 
 
 
2449
  }
2450
 
2451
  t.layers.children('div')
@@ -2484,8 +3509,7 @@ if (typeof jQuery != 'undefined') {
2484
  t.container
2485
  .removeClass('mejs-container-fullscreen')
2486
  .width(normalWidth)
2487
- .height(normalHeight)
2488
- .css('z-index', 1);
2489
  //.css({position: '', left: '', top: '', right: '', bottom: '', overflow: 'inherit', width: normalWidth + 'px', height: normalHeight + 'px', 'z-index': 1});
2490
 
2491
  if (t.pluginType === 'native') {
@@ -2514,626 +3538,492 @@ if (typeof jQuery != 'undefined') {
2514
  });
2515
 
2516
  })(mejs.$);
2517
- (function($) {
2518
-
2519
- // add extra default options
2520
- $.extend(mejs.MepDefaults, {
2521
- // this will automatically turn on a <track>
2522
- startLanguage: '',
2523
- // a list of languages to auto-translate via Google
2524
- translations: [],
2525
- // a dropdownlist of automatic translations
2526
- translationSelector: false,
2527
- // key for tranlsations
2528
- googleApiKey: ''
2529
- });
2530
-
2531
- $.extend(MediaElementPlayer.prototype, {
2532
-
2533
- hasChapters: false,
2534
-
2535
- buildtracks: function(player, controls, layers, media) {
2536
- if (!player.isVideo)
2537
- return;
2538
-
2539
- if (player.tracks.length == 0)
2540
- return;
2541
-
2542
- var i, options = '';
2543
-
2544
- player.chapters =
2545
- $('<div class="mejs-chapters mejs-layer"></div>')
2546
- .prependTo(layers).hide();
2547
- player.captions =
2548
- $('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position"><span class="mejs-captions-text"></span></div></div>')
2549
- .prependTo(layers).hide();
2550
- player.captionsText = player.captions.find('.mejs-captions-text');
2551
- player.captionsButton =
2552
- $('<div class="mejs-button mejs-captions-button">'+
2553
- '<button type="button" aria-controls="' + this.id + '" title="Captions/Subtitles"></button>'+
2554
- '<div class="mejs-captions-selector">'+
2555
- '<ul>'+
2556
- '<li>'+
2557
- '<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
2558
- '<label for="' + player.id + '_captions_none">None</label>'+
2559
- '</li>' +
2560
- '</ul>'+
2561
- '</div>'+
2562
- '</div>')
2563
- .appendTo(controls)
2564
-
2565
- // hover
2566
- .hover(function() {
2567
- $(this).find('.mejs-captions-selector').css('visibility','visible');
2568
- }, function() {
2569
- $(this).find('.mejs-captions-selector').css('visibility','hidden');
2570
- })
2571
-
2572
- // handle clicks to the language radio buttons
2573
- .delegate('input[type=radio]','click',function() {
2574
- lang = this.value;
2575
-
2576
- if (lang == 'none') {
2577
- player.selectedTrack = null;
2578
- } else {
2579
- for (i=0; i<player.tracks.length; i++) {
2580
- if (player.tracks[i].srclang == lang) {
2581
- player.selectedTrack = player.tracks[i];
2582
- player.captions.attr('lang', player.selectedTrack.srclang);
2583
- player.displayCaptions();
2584
- break;
2585
- }
2586
- }
2587
- }
2588
- });
2589
- //.bind('mouseenter', function() {
2590
- // player.captionsButton.find('.mejs-captions-selector').css('visibility','visible')
2591
- //});
2592
-
2593
- if (!player.options.alwaysShowControls) {
2594
- // move with controls
2595
- player.container
2596
- .bind('mouseenter', function () {
2597
- // push captions above controls
2598
- player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
2599
-
2600
- })
2601
- .bind('mouseleave', function () {
2602
- if (!media.paused) {
2603
- // move back to normal place
2604
- player.container.find('.mejs-captions-position').removeClass('mejs-captions-position-hover');
2605
- }
2606
- });
2607
- } else {
2608
- player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
2609
- }
2610
-
2611
- player.trackToLoad = -1;
2612
- player.selectedTrack = null;
2613
- player.isLoadingTrack = false;
2614
-
2615
- // add user-defined translations
2616
- if (player.tracks.length > 0 && player.options.translations.length > 0) {
2617
- for (i=0; i<player.options.translations.length; i++) {
2618
- player.tracks.push({
2619
- srclang: player.options.translations[i].toLowerCase(),
2620
- src: null,
2621
- kind: 'subtitles',
2622
- entries: [],
2623
- isLoaded: false,
2624
- isTranslation: true
2625
- });
2626
- }
2627
- }
2628
-
2629
- // add to list
2630
- for (i=0; i<player.tracks.length; i++) {
2631
- if (player.tracks[i].kind == 'subtitles') {
2632
- player.addTrackButton(player.tracks[i].srclang, player.tracks[i].isTranslation);
2633
- }
2634
- }
2635
-
2636
- player.loadNextTrack();
2637
-
2638
-
2639
- media.addEventListener('timeupdate',function(e) {
2640
- player.displayCaptions();
2641
- }, false);
2642
-
2643
- media.addEventListener('loadedmetadata', function(e) {
2644
- player.displayChapters();
2645
- }, false);
2646
-
2647
- player.container.hover(
2648
- function () {
2649
- // chapters
2650
- if (player.hasChapters) {
2651
- player.chapters.css('visibility','visible');
2652
- player.chapters.fadeIn(200);
2653
- }
2654
- },
2655
- function () {
2656
- if (player.hasChapters && !media.paused) {
2657
- player.chapters.fadeOut(200, function() {
2658
- $(this).css('visibility','hidden');
2659
- $(this).css('display','block');
2660
- });
2661
- }
2662
- });
2663
-
2664
- // check for autoplay
2665
- if (player.node.getAttribute('autoplay') !== null) {
2666
- player.chapters.css('visibility','hidden');
2667
- }
2668
-
2669
- // auto selector
2670
- if (player.options.translationSelector) {
2671
- for (i in mejs.language.codes) {
2672
- options += '<option value="' + i + '">' + mejs.language.codes[i] + '</option>';
2673
- }
2674
- player.container.find('.mejs-captions-selector ul').before($(
2675
- '<select class="mejs-captions-translations">' +
2676
- '<option value="">--Add Translation--</option>' +
2677
- options +
2678
- '</select>'
2679
- ));
2680
- // add clicks
2681
- player.container.find('.mejs-captions-translations').change(function() {
2682
- var
2683
- option = $(this);
2684
- lang = option.val();
2685
- // add this language to the tracks list
2686
- if (lang != '') {
2687
- player.tracks.push({
2688
- srclang: lang,
2689
- src: null,
2690
- entries: [],
2691
- isLoaded: false,
2692
- isTranslation: true
2693
- });
2694
-
2695
- if (!player.isLoadingTrack) {
2696
- player.trackToLoad--;
2697
- player.addTrackButton(lang,true);
2698
- player.options.startLanguage = lang;
2699
- player.loadNextTrack();
2700
- }
2701
- }
2702
- });
2703
- }
2704
-
2705
- },
2706
-
2707
- loadNextTrack: function() {
2708
- var t = this;
2709
-
2710
- t.trackToLoad++;
2711
- if (t.trackToLoad < t.tracks.length) {
2712
- t.isLoadingTrack = true;
2713
- t.loadTrack(t.trackToLoad);
2714
- } else {
2715
- // add done?
2716
- t.isLoadingTrack = false;
2717
- }
2718
- },
2719
-
2720
- loadTrack: function(index){
2721
- var
2722
- t = this,
2723
- track = t.tracks[index],
2724
- after = function() {
2725
-
2726
- track.isLoaded = true;
2727
-
2728
- // create button
2729
- //t.addTrackButton(track.srclang);
2730
- t.enableTrackButton(track.srclang);
2731
-
2732
- t.loadNextTrack();
2733
-
2734
- };
2735
-
2736
- if (track.isTranslation) {
2737
-
2738
- // translate the first track
2739
- mejs.TrackFormatParser.translateTrackText(t.tracks[0].entries, t.tracks[0].srclang, track.srclang, t.options.googleApiKey, function(newOne) {
2740
-
2741
- // store the new translation
2742
- track.entries = newOne;
2743
-
2744
- after();
2745
- });
2746
-
2747
- } else {
2748
- $.ajax({
2749
- url: track.src,
2750
- success: function(d) {
2751
-
2752
- // parse the loaded file
2753
- track.entries = mejs.TrackFormatParser.parse(d);
2754
- after();
2755
-
2756
- if (track.kind == 'chapters' && t.media.duration > 0) {
2757
- t.drawChapters(track);
2758
- }
2759
- },
2760
- error: function() {
2761
- t.loadNextTrack();
2762
- }
2763
- });
2764
- }
2765
- },
2766
-
2767
- enableTrackButton: function(lang) {
2768
- var t = this;
2769
-
2770
- t.captionsButton
2771
- .find('input[value=' + lang + ']')
2772
- .prop('disabled',false)
2773
- .siblings('label')
2774
- .html( mejs.language.codes[lang] || lang );
2775
-
2776
- // auto select
2777
- if (t.options.startLanguage == lang) {
2778
- $('#' + t.id + '_captions_' + lang).click();
2779
- }
2780
-
2781
- t.adjustLanguageBox();
2782
- },
2783
-
2784
- addTrackButton: function(lang, isTranslation) {
2785
- var t = this,
2786
- l = mejs.language.codes[lang] || lang;
2787
-
2788
- t.captionsButton.find('ul').append(
2789
- $('<li>'+
2790
- '<input type="radio" name="' + t.id + '_captions" id="' + t.id + '_captions_' + lang + '" value="' + lang + '" disabled="disabled" />' +
2791
- '<label for="' + t.id + '_captions_' + lang + '">' + l + ((isTranslation) ? ' (translating)' : ' (loading)') + '</label>'+
2792
- '</li>')
2793
- );
2794
-
2795
- t.adjustLanguageBox();
2796
-
2797
- // remove this from the dropdownlist (if it exists)
2798
- t.container.find('.mejs-captions-translations option[value=' + lang + ']').remove();
2799
- },
2800
-
2801
- adjustLanguageBox:function() {
2802
- var t = this;
2803
- // adjust the size of the outer box
2804
- t.captionsButton.find('.mejs-captions-selector').height(
2805
- t.captionsButton.find('.mejs-captions-selector ul').outerHeight(true) +
2806
- t.captionsButton.find('.mejs-captions-translations').outerHeight(true)
2807
- );
2808
- },
2809
-
2810
- displayCaptions: function() {
2811
-
2812
- if (typeof this.tracks == 'undefined')
2813
- return;
2814
-
2815
- var
2816
- t = this,
2817
- i,
2818
- track = t.selectedTrack;
2819
-
2820
- if (track != null && track.isLoaded) {
2821
- for (i=0; i<track.entries.times.length; i++) {
2822
- if (t.media.currentTime >= track.entries.times[i].start && t.media.currentTime <= track.entries.times[i].stop){
2823
- t.captionsText.html(track.entries.text[i]);
2824
- t.captions.show();
2825
- return; // exit out if one is visible;
2826
- }
2827
- }
2828
- t.captions.hide();
2829
- } else {
2830
- t.captions.hide();
2831
- }
2832
- },
2833
-
2834
- displayChapters: function() {
2835
- var
2836
- t = this,
2837
- i;
2838
-
2839
- for (i=0; i<t.tracks.length; i++) {
2840
- if (t.tracks[i].kind == 'chapters' && t.tracks[i].isLoaded) {
2841
- t.drawChapters(t.tracks[i]);
2842
- t.hasChapters = true;
2843
- break;
2844
- }
2845
- }
2846
- },
2847
-
2848
- drawChapters: function(chapters) {
2849
- var
2850
- t = this,
2851
- i,
2852
- dur,
2853
- //width,
2854
- //left,
2855
- percent = 0,
2856
- usedPercent = 0;
2857
-
2858
- t.chapters.empty();
2859
-
2860
- for (i=0; i<chapters.entries.times.length; i++) {
2861
- dur = chapters.entries.times[i].stop - chapters.entries.times[i].start;
2862
- percent = Math.floor(dur / t.media.duration * 100);
2863
- if (percent + usedPercent > 100 || // too large
2864
- i == chapters.entries.times.length-1 && percent + usedPercent < 100) // not going to fill it in
2865
- {
2866
- percent = 100 - usedPercent;
2867
- }
2868
- //width = Math.floor(t.width * dur / t.media.duration);
2869
- //left = Math.floor(t.width * chapters.entries.times[i].start / t.media.duration);
2870
- //if (left + width > t.width) {
2871
- // width = t.width - left;
2872
- //}
2873
-
2874
- t.chapters.append( $(
2875
- '<div class="mejs-chapter" rel="' + chapters.entries.times[i].start + '" style="left: ' + usedPercent.toString() + '%;width: ' + percent.toString() + '%;">' +
2876
- '<div class="mejs-chapter-block' + ((i==chapters.entries.times.length-1) ? ' mejs-chapter-block-last' : '') + '">' +
2877
- '<span class="ch-title">' + chapters.entries.text[i] + '</span>' +
2878
- '<span class="ch-time">' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].start) + '&ndash;' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].stop) + '</span>' +
2879
- '</div>' +
2880
- '</div>'));
2881
- usedPercent += percent;
2882
- }
2883
-
2884
- t.chapters.find('div.mejs-chapter').click(function() {
2885
- t.media.setCurrentTime( parseFloat( $(this).attr('rel') ) );
2886
- if (t.media.paused) {
2887
- t.media.play();
2888
- }
2889
- });
2890
-
2891
- t.chapters.show();
2892
- }
2893
- });
2894
-
2895
-
2896
-
2897
- mejs.language = {
2898
- codes: {
2899
- af:'Afrikaans',
2900
- sq:'Albanian',
2901
- ar:'Arabic',
2902
- be:'Belarusian',
2903
- bg:'Bulgarian',
2904
- ca:'Catalan',
2905
- zh:'Chinese',
2906
- 'zh-cn':'Chinese Simplified',
2907
- 'zh-tw':'Chinese Traditional',
2908
- hr:'Croatian',
2909
- cs:'Czech',
2910
- da:'Danish',
2911
- nl:'Dutch',
2912
- en:'English',
2913
- et:'Estonian',
2914
- tl:'Filipino',
2915
- fi:'Finnish',
2916
- fr:'French',
2917
- gl:'Galician',
2918
- de:'German',
2919
- el:'Greek',
2920
- ht:'Haitian Creole',
2921
- iw:'Hebrew',
2922
- hi:'Hindi',
2923
- hu:'Hungarian',
2924
- is:'Icelandic',
2925
- id:'Indonesian',
2926
- ga:'Irish',
2927
- it:'Italian',
2928
- ja:'Japanese',
2929
- ko:'Korean',
2930
- lv:'Latvian',
2931
- lt:'Lithuanian',
2932
- mk:'Macedonian',
2933
- ms:'Malay',
2934
- mt:'Maltese',
2935
- no:'Norwegian',
2936
- fa:'Persian',
2937
- pl:'Polish',
2938
- pt:'Portuguese',
2939
- //'pt-pt':'Portuguese (Portugal)',
2940
- ro:'Romanian',
2941
- ru:'Russian',
2942
- sr:'Serbian',
2943
- sk:'Slovak',
2944
- sl:'Slovenian',
2945
- es:'Spanish',
2946
- sw:'Swahili',
2947
- sv:'Swedish',
2948
- tl:'Tagalog',
2949
- th:'Thai',
2950
- tr:'Turkish',
2951
- uk:'Ukrainian',
2952
- vi:'Vietnamese',
2953
- cy:'Welsh',
2954
- yi:'Yiddish'
2955
- }
2956
- };
2957
-
2958
- /*
2959
- Parses WebVVT format which should be formatted as
2960
- ================================
2961
- WEBVTT
2962
-
2963
- 1
2964
- 00:00:01,1 --> 00:00:05,000
2965
- A line of text
2966
-
2967
- 2
2968
- 00:01:15,1 --> 00:02:05,000
2969
- A second line of text
2970
-
2971
- ===============================
2972
-
2973
- Adapted from: http://www.delphiki.com/html5/playr
2974
- */
2975
- mejs.TrackFormatParser = {
2976
- // match start "chapter-" (or anythingelse)
2977
- pattern_identifier: /^([a-zA-z]+-)?[0-9]+$/,
2978
- 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})?)(.*)$/,
2979
-
2980
- split2: function (text, regex) {
2981
- // normal version for compliant browsers
2982
- // see below for IE fix
2983
- return text.split(regex);
2984
- },
2985
- parse: function(trackText) {
2986
- var
2987
- i = 0,
2988
- lines = this.split2(trackText, /\r?\n/),
2989
- entries = {text:[], times:[]},
2990
- timecode,
2991
- text;
2992
-
2993
- for(; i<lines.length; i++) {
2994
- // check for the line number
2995
- if (this.pattern_identifier.exec(lines[i])){
2996
- // skip to the next line where the start --> end time code should be
2997
- i++;
2998
- timecode = this.pattern_timecode.exec(lines[i]);
2999
-
3000
- if (timecode && i<lines.length){
3001
- i++;
3002
- // grab all the (possibly multi-line) text that follows
3003
- text = lines[i];
3004
- i++;
3005
- while(lines[i] !== '' && i<lines.length){
3006
- text = text + '\n' + lines[i];
3007
- i++;
3008
- }
3009
-
3010
- // Text is in a different array so I can use .join
3011
- entries.text.push(text);
3012
- entries.times.push(
3013
- {
3014
- start: mejs.Utility.timeCodeToSeconds(timecode[1]),
3015
- stop: mejs.Utility.timeCodeToSeconds(timecode[3]),
3016
- settings: timecode[5]
3017
- });
3018
- }
3019
- }
3020
- }
3021
-
3022
- return entries;
3023
- },
3024
-
3025
- translateTrackText: function(trackData, fromLang, toLang, googleApiKey, callback) {
3026
-
3027
- var
3028
- entries = {text:[], times:[]},
3029
- lines,
3030
- i
3031
-
3032
- this.translateText( trackData.text.join(' <a></a>'), fromLang, toLang, googleApiKey, function(result) {
3033
- // split on separators
3034
- lines = result.split('<a></a>');
3035
-
3036
- // create new entries
3037
- for (i=0;i<trackData.text.length; i++) {
3038
- // add translated line
3039
- entries.text[i] = lines[i];
3040
- // copy existing times
3041
- entries.times[i] = {
3042
- start: trackData.times[i].start,
3043
- stop: trackData.times[i].stop,
3044
- settings: trackData.times[i].settings
3045
- };
3046
- }
3047
-
3048
- callback(entries);
3049
- });
3050
- },
3051
-
3052
- translateText: function(text, fromLang, toLang, googleApiKey, callback) {
3053
-
3054
- var
3055
- separatorIndex,
3056
- chunks = [],
3057
- chunk,
3058
- maxlength = 1000,
3059
- result = '',
3060
- nextChunk= function() {
3061
- if (chunks.length > 0) {
3062
- chunk = chunks.shift();
3063
- mejs.TrackFormatParser.translateChunk(chunk, fromLang, toLang, googleApiKey, function(r) {
3064
- if (r != 'undefined') {
3065
- result += r;
3066
- }
3067
- nextChunk();
3068
- });
3069
- } else {
3070
- callback(result);
3071
- }
3072
- };
3073
-
3074
- // split into chunks
3075
- while (text.length > 0) {
3076
- if (text.length > maxlength) {
3077
- separatorIndex = text.lastIndexOf('.', maxlength);
3078
- chunks.push(text.substring(0, separatorIndex));
3079
- text = text.substring(separatorIndex+1);
3080
- } else {
3081
- chunks.push(text);
3082
- text = '';
3083
- }
3084
- }
3085
-
3086
- // start handling the chunks
3087
- nextChunk();
3088
- },
3089
- translateChunk: function(text, fromLang, toLang, googleApiKey, callback) {
3090
-
3091
- var data = {
3092
- q: text,
3093
- langpair: fromLang + '|' + toLang,
3094
- v: '1.0'
3095
- };
3096
- if (googleApiKey !== '' && googleApiKey !== null) {
3097
- data.key = googleApiKey;
3098
- }
3099
-
3100
- $.ajax({
3101
- url: 'https://ajax.googleapis.com/ajax/services/language/translate', // 'https://www.google.com/uds/Gtranslate', //'https://ajax.googleapis.com/ajax/services/language/translate', //
3102
- data: data,
3103
- type: 'GET',
3104
- dataType: 'jsonp',
3105
- success: function(d) {
3106
- callback(d.responseData.translatedText);
3107
- },
3108
- error: function(e) {
3109
- callback(null);
3110
- }
3111
- });
3112
- }
3113
- };
3114
- // test for browsers with bad String.split method.
3115
- if ('x\n\ny'.split(/\n/gi).length != 3) {
3116
- // add super slow IE8 and below version
3117
- mejs.TrackFormatParser.split2 = function(text, regex) {
3118
- var
3119
- parts = [],
3120
- chunk = '',
3121
- i;
3122
-
3123
- for (i=0; i<text.length; i++) {
3124
- chunk += text.substring(i,i+1);
3125
- if (regex.test(chunk)) {
3126
- parts.push(chunk.replace(regex, ''));
3127
- chunk = '';
3128
- }
3129
- }
3130
- parts.push(chunk);
3131
- return parts;
3132
- }
3133
- }
3134
-
3135
- })(mejs.$);
3136
-
3137
  /*
3138
  * ContextMenu Plugin
3139
  *
@@ -3326,5 +4216,5 @@ $.extend(mejs.MepDefaults,
3326
  }
3327
  });
3328
 
3329
- })(mejs.$);
3330
-
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-2012, 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.7.0';
19
 
20
  // player number (for missing, same id attr)
21
  mejs.meIndex = 0;
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: [12,0], types: ['video/webm']} // for future reference (hopefully!)
31
+ ],
32
+ youtube: [
33
+ {version: null, types: ['video/youtube']}
34
+ ],
35
+ vimeo: [
36
+ {version: null, types: ['video/vimeo']}
37
  ]
38
+ };
39
 
40
  /*
41
  Utility methods
59
  path = '',
60
  name = '',
61
  script,
62
+ scripts = document.getElementsByTagName('script'),
63
+ il = scripts.length,
64
+ jl = scriptNames.length;
65
 
66
+ for (; i < il; i++) {
67
  script = scripts[i].src;
68
+ for (j = 0; j < jl; j++) {
69
  name = scriptNames[j];
70
  if (script.indexOf(name) > -1) {
71
  path = script.substring(0, script.indexOf(name));
79
  return path;
80
  },
81
  secondsToTimeCode: function(time, forceHours, showFrameCount, fps) {
82
+ //add framecount
83
+ if (typeof showFrameCount == 'undefined') {
84
+ showFrameCount=false;
85
+ } else if(typeof fps == 'undefined') {
86
+ fps = 25;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
 
89
+ var hours = Math.floor(time / 3600) % 24,
90
+ minutes = Math.floor(time / 60) % 60,
91
+ seconds = Math.floor(time % 60),
92
+ frames = Math.floor(((time % 1)*fps).toFixed(3)),
93
+ result =
94
+ ( (forceHours || hours > 0) ? (hours < 10 ? '0' + hours : hours) + ':' : '')
95
+ + (minutes < 10 ? '0' + minutes : minutes) + ':'
96
+ + (seconds < 10 ? '0' + seconds : seconds)
97
+ + ((showFrameCount) ? ':' + (frames < 10 ? '0' + frames : frames) : '');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
+ return result;
 
100
  },
101
 
102
+ timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
103
+ if (typeof showFrameCount == 'undefined') {
104
+ showFrameCount=false;
105
+ } else if(typeof fps == 'undefined') {
106
+ fps = 25;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
 
108
 
109
+ var tc_array = hh_mm_ss_ff.split(":"),
110
+ tc_hh = parseInt(tc_array[0], 10),
111
+ tc_mm = parseInt(tc_array[1], 10),
112
+ tc_ss = parseInt(tc_array[2], 10),
113
+ tc_ff = 0,
114
+ tc_in_seconds = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
+ if (showFrameCount) {
117
+ tc_ff = parseInt(tc_array[3])/fps;
 
 
118
  }
119
 
120
+ tc_in_seconds = ( tc_hh * 3600 ) + ( tc_mm * 60 ) + tc_ss + tc_ff;
 
 
 
 
 
 
 
 
121
 
122
+ return tc_in_seconds;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  },
124
 
125
+ /* borrowed from SWFObject: http://code.google.com/p/swfobject/source/browse/trunk/swfobject/src/swfobject.js#474 */
126
+ removeSwf: function(id) {
127
+ var obj = document.getElementById(id);
128
+ if (obj && obj.nodeName == "OBJECT") {
129
+ if (mejs.MediaFeatures.isIE) {
130
+ obj.style.display = "none";
131
+ (function(){
132
+ if (obj.readyState == 4) {
133
+ mejs.Utility.removeObjectInIE(id);
134
+ } else {
135
+ setTimeout(arguments.callee, 10);
136
+ }
137
+ })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  } else {
139
+ obj.parentNode.removeChild(obj);
140
  }
141
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  },
143
+ removeObjectInIE: function(id) {
144
+ var obj = document.getElementById(id);
145
+ if (obj) {
146
+ for (var i in obj) {
147
+ if (typeof obj[i] == "function") {
148
+ obj[i] = null;
149
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  }
151
+ obj.parentNode.removeChild(obj);
152
+ }
 
 
 
 
 
153
  }
154
  };
155
+
156
+
157
+ // Core detector, plugins are added below
158
+ mejs.PluginDetector = {
159
+
160
+ // main public function to test a plug version number PluginDetector.hasPluginVersion('flash',[9,0,125]);
161
+ hasPluginVersion: function(plugin, v) {
162
+ var pv = this.plugins[plugin];
163
+ v[1] = v[1] || 0;
164
+ v[2] = v[2] || 0;
165
+ 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;
166
+ },
167
+
168
+ // cached values
169
+ nav: window.navigator,
170
+ ua: window.navigator.userAgent.toLowerCase(),
171
+
172
+ // stored version numbers
173
+ plugins: [],
174
+
175
+ // runs detectPlugin() and stores the version number
176
+ addPlugin: function(p, pluginName, mimeType, activeX, axDetect) {
177
+ this.plugins[p] = this.detectPlugin(pluginName, mimeType, activeX, axDetect);
178
+ },
179
+
180
+ // get the version number from the mimetype (all but IE) or ActiveX (IE)
181
+ detectPlugin: function(pluginName, mimeType, activeX, axDetect) {
182
+
183
+ var version = [0,0,0],
184
+ description,
185
+ i,
186
+ ax;
187
+
188
+ // Firefox, Webkit, Opera
189
+ if (typeof(this.nav.plugins) != 'undefined' && typeof this.nav.plugins[pluginName] == 'object') {
190
+ description = this.nav.plugins[pluginName].description;
191
+ if (description && !(typeof this.nav.mimeTypes != 'undefined' && this.nav.mimeTypes[mimeType] && !this.nav.mimeTypes[mimeType].enabledPlugin)) {
192
+ version = description.replace(pluginName, '').replace(/^\s+/,'').replace(/\sr/gi,'.').split('.');
193
+ for (i=0; i<version.length; i++) {
194
+ version[i] = parseInt(version[i].match(/\d+/), 10);
195
+ }
196
+ }
197
+ // Internet Explorer / ActiveX
198
+ } else if (typeof(window.ActiveXObject) != 'undefined') {
199
+ try {
200
+ ax = new ActiveXObject(activeX);
201
+ if (ax) {
202
+ version = axDetect(ax);
203
+ }
204
+ }
205
+ catch (e) { }
206
+ }
207
+ return version;
208
+ }
209
+ };
210
+
211
+ // Add Flash detection
212
+ mejs.PluginDetector.addPlugin('flash','Shockwave Flash','application/x-shockwave-flash','ShockwaveFlash.ShockwaveFlash', function(ax) {
213
+ // adapted from SWFObject
214
+ var version = [],
215
+ d = ax.GetVariable("$version");
216
+ if (d) {
217
+ d = d.split(" ")[1].split(",");
218
+ version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
219
+ }
220
+ return version;
221
+ });
222
+
223
+ // Add Silverlight detection
224
+ mejs.PluginDetector.addPlugin('silverlight','Silverlight Plug-In','application/x-silverlight-2','AgControl.AgControl', function (ax) {
225
+ // Silverlight cannot report its version number to IE
226
+ // but it does have a isVersionSupported function, so we have to loop through it to get a version number.
227
+ // adapted from http://www.silverlightversion.com/
228
+ var v = [0,0,0,0],
229
+ loopMatch = function(ax, v, i, n) {
230
+ while(ax.isVersionSupported(v[0]+ "."+ v[1] + "." + v[2] + "." + v[3])){
231
+ v[i]+=n;
232
+ }
233
+ v[i] -= n;
234
+ };
235
+ loopMatch(ax, v, 0, 1);
236
+ loopMatch(ax, v, 1, 1);
237
+ loopMatch(ax, v, 2, 10000); // the third place in the version number is usually 5 digits (4.0.xxxxx)
238
+ loopMatch(ax, v, 2, 1000);
239
+ loopMatch(ax, v, 2, 100);
240
+ loopMatch(ax, v, 2, 10);
241
+ loopMatch(ax, v, 2, 1);
242
+ loopMatch(ax, v, 3, 1);
243
+
244
+ return v;
245
+ });
246
+ // add adobe acrobat
247
+ /*
248
+ PluginDetector.addPlugin('acrobat','Adobe Acrobat','application/pdf','AcroPDF.PDF', function (ax) {
249
+ var version = [],
250
+ d = ax.GetVersions().split(',')[0].split('=')[1].split('.');
251
+
252
+ if (d) {
253
+ version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
254
+ }
255
+ return version;
256
+ });
257
+ */
258
+ // necessary detection (fixes for <IE9)
259
+ mejs.MediaFeatures = {
260
+ init: function() {
261
+ var
262
+ t = this,
263
+ d = document,
264
+ nav = mejs.PluginDetector.nav,
265
+ ua = mejs.PluginDetector.ua.toLowerCase(),
266
+ i,
267
+ v,
268
+ html5Elements = ['source','track','audio','video'];
269
+
270
+ // detect browsers (only the ones that have some kind of quirk we need to work around)
271
+ t.isiPad = (ua.match(/ipad/i) !== null);
272
+ t.isiPhone = (ua.match(/iphone/i) !== null);
273
+ t.isiOS = t.isiPhone || t.isiPad;
274
+ t.isAndroid = (ua.match(/android/i) !== null);
275
+ t.isBustedAndroid = (ua.match(/android 2\.[12]/) !== null);
276
+ t.isIE = (nav.appName.toLowerCase().indexOf("microsoft") != -1);
277
+ t.isChrome = (ua.match(/chrome/gi) !== null);
278
+ t.isFirefox = (ua.match(/firefox/gi) !== null);
279
+ t.isWebkit = (ua.match(/webkit/gi) !== null);
280
+ t.isGecko = (ua.match(/gecko/gi) !== null) && !t.isWebkit;
281
+ t.isOpera = (ua.match(/opera/gi) !== null);
282
+ t.hasTouch = ('ontouchstart' in window);
283
+
284
+ // create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
285
+ for (i=0; i<html5Elements.length; i++) {
286
+ v = document.createElement(html5Elements[i]);
287
+ }
288
+
289
+ t.supportsMediaTag = (typeof v.canPlayType !== 'undefined' || t.isBustedAndroid);
290
+
291
+ // detect native JavaScript fullscreen (Safari/Firefox only, Chrome still fails)
292
+
293
+ // iOS
294
+ t.hasSemiNativeFullScreen = (typeof v.webkitEnterFullscreen !== 'undefined');
295
+
296
+ // Webkit/firefox
297
+ t.hasWebkitNativeFullScreen = (typeof v.webkitRequestFullScreen !== 'undefined');
298
+ t.hasMozNativeFullScreen = (typeof v.mozRequestFullScreen !== 'undefined');
299
+
300
+ t.hasTrueNativeFullScreen = (t.hasWebkitNativeFullScreen || t.hasMozNativeFullScreen);
301
+ t.nativeFullScreenEnabled = t.hasTrueNativeFullScreen;
302
+ if (t.hasMozNativeFullScreen) {
303
+ t.nativeFullScreenEnabled = v.mozFullScreenEnabled;
304
+ }
305
+
306
+
307
+ if (this.isChrome) {
308
+ t.hasSemiNativeFullScreen = false;
309
+ }
310
+
311
+ if (t.hasTrueNativeFullScreen) {
312
+ t.fullScreenEventName = (t.hasWebkitNativeFullScreen) ? 'webkitfullscreenchange' : 'mozfullscreenchange';
313
+
314
+
315
+ t.isFullScreen = function() {
316
+ if (v.mozRequestFullScreen) {
317
+ return d.mozFullScreen;
318
+ } else if (v.webkitRequestFullScreen) {
319
+ return d.webkitIsFullScreen;
320
+ }
321
+ }
322
+
323
+ t.requestFullScreen = function(el) {
324
+
325
+ if (t.hasWebkitNativeFullScreen) {
326
+ el.webkitRequestFullScreen();
327
+ } else if (t.hasMozNativeFullScreen) {
328
+ el.mozRequestFullScreen();
329
+ }
330
+ }
331
+
332
+ t.cancelFullScreen = function() {
333
+ if (t.hasWebkitNativeFullScreen) {
334
+ document.webkitCancelFullScreen();
335
+ } else if (t.hasMozNativeFullScreen) {
336
+ document.mozCancelFullScreen();
337
+ }
338
+ }
339
+
340
+ }
341
+
342
+
343
+ // OS X 10.5 can't do this even if it says it can :(
344
+ if (t.hasSemiNativeFullScreen && ua.match(/mac os x 10_5/i)) {
345
+ t.hasNativeFullScreen = false;
346
+ t.hasSemiNativeFullScreen = false;
347
+ }
348
+
349
+ }
350
+ };
351
+ mejs.MediaFeatures.init();
352
+
353
+
354
+ /*
355
+ extension methods to <video> or <audio> object to bring it into parity with PluginMediaElement (see below)
356
+ */
357
+ mejs.HtmlMediaElement = {
358
+ pluginType: 'native',
359
+ isFullScreen: false,
360
+
361
+ setCurrentTime: function (time) {
362
+ this.currentTime = time;
363
+ },
364
+
365
+ setMuted: function (muted) {
366
+ this.muted = muted;
367
+ },
368
+
369
+ setVolume: function (volume) {
370
+ this.volume = volume;
371
+ },
372
+
373
+ // for parity with the plugin versions
374
+ stop: function () {
375
+ this.pause();
376
+ },
377
+
378
+ // This can be a url string
379
+ // or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
380
+ setSrc: function (url) {
381
+
382
+ // Fix for IE9 which can't set .src when there are <source> elements. Awesome, right?
383
+ var
384
+ existingSources = this.getElementsByTagName('source');
385
+ while (existingSources.length > 0){
386
+ this.removeChild(existingSources[0]);
387
+ }
388
+
389
+ if (typeof url == 'string') {
390
+ this.src = url;
391
+ } else {
392
+ var i, media;
393
+
394
+ for (i=0; i<url.length; i++) {
395
+ media = url[i];
396
+ if (this.canPlayType(media.type)) {
397
+ this.src = media.src;
398
+ }
399
+ }
400
+ }
401
+ },
402
+
403
+ setVideoSize: function (width, height) {
404
+ this.width = width;
405
+ this.height = height;
406
+ }
407
+ };
408
+
409
+ /*
410
+ Mimics the <video/audio> element by calling Flash's External Interface or Silverlights [ScriptableMember]
411
+ */
412
+ mejs.PluginMediaElement = function (pluginid, pluginType, mediaUrl) {
413
+ this.id = pluginid;
414
+ this.pluginType = pluginType;
415
+ this.src = mediaUrl;
416
+ this.events = {};
417
+ };
418
+
419
+ // JavaScript values and ExternalInterface methods that match HTML5 video properties methods
420
+ // http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/fl/video/FLVPlayback.html
421
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
422
+ mejs.PluginMediaElement.prototype = {
423
+
424
+ // special
425
+ pluginElement: null,
426
+ pluginType: '',
427
+ isFullScreen: false,
428
+
429
+ // not implemented :(
430
+ playbackRate: -1,
431
+ defaultPlaybackRate: -1,
432
+ seekable: [],
433
+ played: [],
434
+
435
+ // HTML5 read-only properties
436
+ paused: true,
437
+ ended: false,
438
+ seeking: false,
439
+ duration: 0,
440
+ error: null,
441
+ tagName: '',
442
+
443
+ // HTML5 get/set properties, but only set (updated by event handlers)
444
+ muted: false,
445
+ volume: 1,
446
+ currentTime: 0,
447
+
448
+ // HTML5 methods
449
+ play: function () {
450
+ if (this.pluginApi != null) {
451
+ if (this.pluginType == 'youtube') {
452
+ this.pluginApi.playVideo();
453
+ } else {
454
+ this.pluginApi.playMedia();
455
+ }
456
+ this.paused = false;
457
+ }
458
+ },
459
+ load: function () {
460
+ if (this.pluginApi != null) {
461
+ if (this.pluginType == 'youtube') {
462
+ } else {
463
+ this.pluginApi.loadMedia();
464
+ }
465
+
466
+ this.paused = false;
467
+ }
468
+ },
469
+ pause: function () {
470
+ if (this.pluginApi != null) {
471
+ if (this.pluginType == 'youtube') {
472
+ this.pluginApi.pauseVideo();
473
+ } else {
474
+ this.pluginApi.pauseMedia();
475
+ }
476
+
477
+
478
+ this.paused = true;
479
+ }
480
+ },
481
+ stop: function () {
482
+ if (this.pluginApi != null) {
483
+ if (this.pluginType == 'youtube') {
484
+ this.pluginApi.stopVideo();
485
+ } else {
486
+ this.pluginApi.stopMedia();
487
+ }
488
+ this.paused = true;
489
+ }
490
+ },
491
+ canPlayType: function(type) {
492
+ var i,
493
+ j,
494
+ pluginInfo,
495
+ pluginVersions = mejs.plugins[this.pluginType];
496
+
497
+ for (i=0; i<pluginVersions.length; i++) {
498
+ pluginInfo = pluginVersions[i];
499
+
500
+ // test if user has the correct plugin version
501
+ if (mejs.PluginDetector.hasPluginVersion(this.pluginType, pluginInfo.version)) {
502
+
503
+ // test for plugin playback types
504
+ for (j=0; j<pluginInfo.types.length; j++) {
505
+ // find plugin that can play the type
506
+ if (type == pluginInfo.types[j]) {
507
+ return true;
508
+ }
509
+ }
510
+ }
511
+ }
512
+
513
+ return false;
514
+ },
515
+
516
+ positionFullscreenButton: function(x,y,visibleAndAbove) {
517
+ if (this.pluginApi != null && this.pluginApi.positionFullscreenButton) {
518
+ this.pluginApi.positionFullscreenButton(x,y,visibleAndAbove);
519
+ }
520
+ },
521
+
522
+ hideFullscreenButton: function() {
523
+ if (this.pluginApi != null && this.pluginApi.hideFullscreenButton) {
524
+ this.pluginApi.hideFullscreenButton();
525
+ }
526
+ },
527
+
528
+
529
+ // custom methods since not all JavaScript implementations support get/set
530
+
531
+ // This can be a url string
532
+ // or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
533
+ setSrc: function (url) {
534
+ if (typeof url == 'string') {
535
+ this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(url));
536
+ this.src = mejs.Utility.absolutizeUrl(url);
537
+ } else {
538
+ var i, media;
539
+
540
+ for (i=0; i<url.length; i++) {
541
+ media = url[i];
542
+ if (this.canPlayType(media.type)) {
543
+ this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
544
+ this.src = mejs.Utility.absolutizeUrl(url);
545
+ }
546
+ }
547
+ }
548
+
549
+ },
550
+ setCurrentTime: function (time) {
551
+ if (this.pluginApi != null) {
552
+ if (this.pluginType == 'youtube') {
553
+ this.pluginApi.seekTo(time);
554
+ } else {
555
+ this.pluginApi.setCurrentTime(time);
556
+ }
557
+
558
+
559
+
560
+ this.currentTime = time;
561
+ }
562
+ },
563
+ setVolume: function (volume) {
564
+ if (this.pluginApi != null) {
565
+ // same on YouTube and MEjs
566
+ if (this.pluginType == 'youtube') {
567
+ this.pluginApi.setVolume(volume * 100);
568
+ } else {
569
+ this.pluginApi.setVolume(volume);
570
+ }
571
+ this.volume = volume;
572
+ }
573
+ },
574
+ setMuted: function (muted) {
575
+ if (this.pluginApi != null) {
576
+ if (this.pluginType == 'youtube') {
577
+ if (muted) {
578
+ this.pluginApi.mute();
579
+ } else {
580
+ this.pluginApi.unMute();
581
+ }
582
+ this.muted = muted;
583
+ this.dispatchEvent('volumechange');
584
+ } else {
585
+ this.pluginApi.setMuted(muted);
586
+ }
587
+ this.muted = muted;
588
+ }
589
+ },
590
+
591
+ // additional non-HTML5 methods
592
+ setVideoSize: function (width, height) {
593
+
594
+ //if (this.pluginType == 'flash' || this.pluginType == 'silverlight') {
595
+ if ( this.pluginElement.style) {
596
+ this.pluginElement.style.width = width + 'px';
597
+ this.pluginElement.style.height = height + 'px';
598
+ }
599
+ if (this.pluginApi != null && this.pluginApi.setVideoSize) {
600
+ this.pluginApi.setVideoSize(width, height);
601
+ }
602
+ //}
603
+ },
604
+
605
+ setFullscreen: function (fullscreen) {
606
+ if (this.pluginApi != null && this.pluginApi.setFullscreen) {
607
+ this.pluginApi.setFullscreen(fullscreen);
608
+ }
609
+ },
610
+
611
+ enterFullScreen: function() {
612
+ if (this.pluginApi != null && this.pluginApi.setFullscreen) {
613
+ this.setFullscreen(true);
614
+ }
615
+
616
+ },
617
+
618
+ exitFullScreen: function() {
619
+ if (this.pluginApi != null && this.pluginApi.setFullscreen) {
620
+ this.setFullscreen(false);
621
+ }
622
+ },
623
+
624
+ // start: fake events
625
+ addEventListener: function (eventName, callback, bubble) {
626
+ this.events[eventName] = this.events[eventName] || [];
627
+ this.events[eventName].push(callback);
628
+ },
629
+ removeEventListener: function (eventName, callback) {
630
+ if (!eventName) { this.events = {}; return true; }
631
+ var callbacks = this.events[eventName];
632
+ if (!callbacks) return true;
633
+ if (!callback) { this.events[eventName] = []; return true; }
634
+ for (i = 0; i < callbacks.length; i++) {
635
+ if (callbacks[i] === callback) {
636
+ this.events[eventName].splice(i, 1);
637
+ return true;
638
+ }
639
+ }
640
+ return false;
641
+ },
642
+ dispatchEvent: function (eventName) {
643
+ var i,
644
+ args,
645
+ callbacks = this.events[eventName];
646
+
647
+ if (callbacks) {
648
+ args = Array.prototype.slice.call(arguments, 1);
649
+ for (i = 0; i < callbacks.length; i++) {
650
+ callbacks[i].apply(null, args);
651
+ }
652
+ }
653
+ },
654
+ // end: fake events
655
+
656
+ // fake DOM attribute methods
657
+ attributes: {},
658
+ hasAttribute: function(name){
659
+ return (name in this.attributes);
660
+ },
661
+ removeAttribute: function(name){
662
+ delete this.attributes[name];
663
+ },
664
+ getAttribute: function(name){
665
+ if (this.hasAttribute(name)) {
666
+ return this.attributes[name];
667
+ }
668
+ return '';
669
+ },
670
+ setAttribute: function(name, value){
671
+ this.attributes[name] = value;
672
+ },
673
+
674
+ remove: function() {
675
+ mejs.Utility.removeSwf(this.pluginElement.id);
676
+ }
677
+ };
678
+
679
+ // Handles calls from Flash/Silverlight and reports them as native <video/audio> events and properties
680
+ mejs.MediaPluginBridge = {
681
+
682
+ pluginMediaElements:{},
683
+ htmlMediaElements:{},
684
+
685
+ registerPluginElement: function (id, pluginMediaElement, htmlMediaElement) {
686
+ this.pluginMediaElements[id] = pluginMediaElement;
687
+ this.htmlMediaElements[id] = htmlMediaElement;
688
+ },
689
+
690
+ // when Flash/Silverlight is ready, it calls out to this method
691
+ initPlugin: function (id) {
692
+
693
+ var pluginMediaElement = this.pluginMediaElements[id],
694
+ htmlMediaElement = this.htmlMediaElements[id];
695
+
696
+ if (pluginMediaElement) {
697
+ // find the javascript bridge
698
+ switch (pluginMediaElement.pluginType) {
699
+ case "flash":
700
+ pluginMediaElement.pluginElement = pluginMediaElement.pluginApi = document.getElementById(id);
701
+ break;
702
+ case "silverlight":
703
+ pluginMediaElement.pluginElement = document.getElementById(pluginMediaElement.id);
704
+ pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
705
+ break;
706
+ }
707
+
708
+ if (pluginMediaElement.pluginApi != null && pluginMediaElement.success) {
709
+ pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
710
+ }
711
+ }
712
+ },
713
+
714
+ // receives events from Flash/Silverlight and sends them out as HTML5 media events
715
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
716
+ fireEvent: function (id, eventName, values) {
717
+
718
+ var
719
+ e,
720
+ i,
721
+ bufferedTime,
722
+ pluginMediaElement = this.pluginMediaElements[id];
723
+
724
+ pluginMediaElement.ended = false;
725
+ pluginMediaElement.paused = true;
726
+
727
+ // fake event object to mimic real HTML media event.
728
+ e = {
729
+ type: eventName,
730
+ target: pluginMediaElement
731
+ };
732
+
733
+ // attach all values to element and event object
734
+ for (i in values) {
735
+ pluginMediaElement[i] = values[i];
736
+ e[i] = values[i];
737
+ }
738
+
739
+ // fake the newer W3C buffered TimeRange (loaded and total have been removed)
740
+ bufferedTime = values.bufferedTime || 0;
741
+
742
+ e.target.buffered = e.buffered = {
743
+ start: function(index) {
744
+ return 0;
745
+ },
746
+ end: function (index) {
747
+ return bufferedTime;
748
+ },
749
+ length: 1
750
+ };
751
+
752
+ pluginMediaElement.dispatchEvent(e.type, e);
753
+ }
754
+ };
755
+
756
+ /*
757
+ Default options
758
+ */
759
+ mejs.MediaElementDefaults = {
760
+ // allows testing on HTML5, flash, silverlight
761
+ // auto: attempts to detect what the browser can do
762
+ // native: forces HTML5 playback
763
+ // shim: disallows HTML5, will attempt either Flash or Silverlight
764
+ // none: forces fallback view
765
+ mode: 'auto',
766
+ // remove or reorder to change plugin priority and availability
767
+ plugins: ['flash','silverlight','youtube','vimeo'],
768
+ // shows debug errors on screen
769
+ enablePluginDebug: false,
770
+ // overrides the type specified, useful for dynamic instantiation
771
+ type: '',
772
+ // path to Flash and Silverlight plugins
773
+ pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
774
+ // name of flash file
775
+ flashName: 'flashmediaelement.swf',
776
+ // turns on the smoothing filter in Flash
777
+ enablePluginSmoothing: false,
778
+ // name of silverlight file
779
+ silverlightName: 'silverlightmediaelement.xap',
780
+ // default if the <video width> is not specified
781
+ defaultVideoWidth: 480,
782
+ // default if the <video height> is not specified
783
+ defaultVideoHeight: 270,
784
+ // overrides <video width>
785
+ pluginWidth: -1,
786
+ // overrides <video height>
787
+ pluginHeight: -1,
788
+ // additional plugin variables in 'key=value' form
789
+ pluginVars: [],
790
+ // rate in milliseconds for Flash and Silverlight to fire the timeupdate event
791
+ // larger number is less accurate, but less strain on plugin->JavaScript bridge
792
+ timerRate: 250,
793
+ // initial volume for player
794
+ startVolume: 0.8,
795
+ success: function () { },
796
+ error: function () { }
797
+ };
798
+
799
+ /*
800
+ Determines if a browser supports the <video> or <audio> element
801
+ and returns either the native element or a Flash/Silverlight version that
802
+ mimics HTML5 MediaElement
803
+ */
804
+ mejs.MediaElement = function (el, o) {
805
+ return mejs.HtmlMediaElementShim.create(el,o);
806
+ };
807
+
808
+ mejs.HtmlMediaElementShim = {
809
+
810
+ create: function(el, o) {
811
+ var
812
+ options = mejs.MediaElementDefaults,
813
+ htmlMediaElement = (typeof(el) == 'string') ? document.getElementById(el) : el,
814
+ tagName = htmlMediaElement.tagName.toLowerCase(),
815
+ isMediaTag = (tagName === 'audio' || tagName === 'video'),
816
+ src = (isMediaTag) ? htmlMediaElement.getAttribute('src') : htmlMediaElement.getAttribute('href'),
817
+ poster = htmlMediaElement.getAttribute('poster'),
818
+ autoplay = htmlMediaElement.getAttribute('autoplay'),
819
+ preload = htmlMediaElement.getAttribute('preload'),
820
+ controls = htmlMediaElement.getAttribute('controls'),
821
+ playback,
822
+ prop;
823
+
824
+ // extend options
825
+ for (prop in o) {
826
+ options[prop] = o[prop];
827
+ }
828
+
829
+ // clean up attributes
830
+ src = (typeof src == 'undefined' || src === null || src == '') ? null : src;
831
+ poster = (typeof poster == 'undefined' || poster === null) ? '' : poster;
832
+ preload = (typeof preload == 'undefined' || preload === null || preload === 'false') ? 'none' : preload;
833
+ autoplay = !(typeof autoplay == 'undefined' || autoplay === null || autoplay === 'false');
834
+ controls = !(typeof controls == 'undefined' || controls === null || controls === 'false');
835
+
836
+ // test for HTML5 and plugin capabilities
837
+ playback = this.determinePlayback(htmlMediaElement, options, mejs.MediaFeatures.supportsMediaTag, isMediaTag, src);
838
+ playback.url = (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '';
839
+
840
+ if (playback.method == 'native') {
841
+ // second fix for android
842
+ if (mejs.MediaFeatures.isBustedAndroid) {
843
+ htmlMediaElement.src = playback.url;
844
+ htmlMediaElement.addEventListener('click', function() {
845
+ htmlMediaElement.play();
846
+ }, false);
847
+ }
848
+
849
+ // add methods to native HTMLMediaElement
850
+ return this.updateNative(playback, options, autoplay, preload);
851
+ } else if (playback.method !== '') {
852
+ // create plugin to mimic HTMLMediaElement
853
+
854
+ return this.createPlugin( playback, options, poster, autoplay, preload, controls);
855
+ } else {
856
+ // boo, no HTML5, no Flash, no Silverlight.
857
+ this.createErrorMessage( playback, options, poster );
858
+
859
+ return this;
860
+ }
861
+ },
862
+
863
+ determinePlayback: function(htmlMediaElement, options, supportsMediaTag, isMediaTag, src) {
864
+ var
865
+ mediaFiles = [],
866
+ i,
867
+ j,
868
+ k,
869
+ l,
870
+ n,
871
+ type,
872
+ result = { method: '', url: '', htmlMediaElement: htmlMediaElement, isVideo: (htmlMediaElement.tagName.toLowerCase() != 'audio')},
873
+ pluginName,
874
+ pluginVersions,
875
+ pluginInfo,
876
+ dummy;
877
+
878
+ // STEP 1: Get URL and type from <video src> or <source src>
879
+
880
+ // supplied type overrides <video type> and <source type>
881
+ if (typeof options.type != 'undefined' && options.type !== '') {
882
+
883
+ // accept either string or array of types
884
+ if (typeof options.type == 'string') {
885
+ mediaFiles.push({type:options.type, url:src});
886
+ } else {
887
+
888
+ for (i=0; i<options.type.length; i++) {
889
+ mediaFiles.push({type:options.type[i], url:src});
890
+ }
891
+ }
892
+
893
+ // test for src attribute first
894
+ } else if (src !== null) {
895
+ type = this.formatType(src, htmlMediaElement.getAttribute('type'));
896
+ mediaFiles.push({type:type, url:src});
897
+
898
+ // then test for <source> elements
899
+ } else {
900
+ // test <source> types to see if they are usable
901
+ for (i = 0; i < htmlMediaElement.childNodes.length; i++) {
902
+ n = htmlMediaElement.childNodes[i];
903
+ if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
904
+ src = n.getAttribute('src');
905
+ type = this.formatType(src, n.getAttribute('type'));
906
+ mediaFiles.push({type:type, url:src});
907
+ }
908
+ }
909
+ }
910
+
911
+ // in the case of dynamicly created players
912
+ // check for audio types
913
+ if (!isMediaTag && mediaFiles.length > 0 && mediaFiles[0].url !== null && this.getTypeFromFile(mediaFiles[0].url).indexOf('audio') > -1) {
914
+ result.isVideo = false;
915
+ }
916
+
917
+
918
+ // STEP 2: Test for playback method
919
+
920
+ // special case for Android which sadly doesn't implement the canPlayType function (always returns '')
921
+ if (mejs.MediaFeatures.isBustedAndroid) {
922
+ htmlMediaElement.canPlayType = function(type) {
923
+ return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'maybe' : '';
924
+ };
925
+ }
926
+
927
+
928
+ // test for native playback first
929
+ if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'native')) {
930
+
931
+ if (!isMediaTag) {
932
+
933
+ // create a real HTML5 Media Element
934
+ dummy = document.createElement( result.isVideo ? 'video' : 'audio');
935
+ htmlMediaElement.parentNode.insertBefore(dummy, htmlMediaElement);
936
+ htmlMediaElement.style.display = 'none';
937
+
938
+ // use this one from now on
939
+ result.htmlMediaElement = htmlMediaElement = dummy;
940
+ }
941
+
942
+ for (i=0; i<mediaFiles.length; i++) {
943
+ // normal check
944
+ if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
945
+ // special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
946
+ || htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== '') {
947
+ result.method = 'native';
948
+ result.url = mediaFiles[i].url;
949
+ break;
950
+ }
951
+ }
952
+
953
+ if (result.method === 'native') {
954
+ if (result.url !== null) {
955
+ htmlMediaElement.src = result.url;
956
+ }
957
+
958
+ return result;
959
+ }
960
+ }
961
+
962
+ // if native playback didn't work, then test plugins
963
+ if (options.mode === 'auto' || options.mode === 'shim') {
964
+ for (i=0; i<mediaFiles.length; i++) {
965
+ type = mediaFiles[i].type;
966
+
967
+ // test all plugins in order of preference [silverlight, flash]
968
+ for (j=0; j<options.plugins.length; j++) {
969
+
970
+ pluginName = options.plugins[j];
971
+
972
+ // test version of plugin (for future features)
973
+ pluginVersions = mejs.plugins[pluginName];
974
+
975
+ for (k=0; k<pluginVersions.length; k++) {
976
+ pluginInfo = pluginVersions[k];
977
+
978
+ // test if user has the correct plugin version
979
+
980
+ // for youtube/vimeo
981
+ if (pluginInfo.version == null ||
982
+
983
+ mejs.PluginDetector.hasPluginVersion(pluginName, pluginInfo.version)) {
984
+
985
+ // test for plugin playback types
986
+ for (l=0; l<pluginInfo.types.length; l++) {
987
+ // find plugin that can play the type
988
+ if (type == pluginInfo.types[l]) {
989
+ result.method = pluginName;
990
+ result.url = mediaFiles[i].url;
991
+ return result;
992
+ }
993
+ }
994
+ }
995
+ }
996
+ }
997
+ }
998
+ }
999
+
1000
+ // what if there's nothing to play? just grab the first available
1001
+ if (result.method === '' && mediaFiles.length > 0) {
1002
+ result.url = mediaFiles[0].url;
1003
+ }
1004
+
1005
+ return result;
1006
+ },
1007
+
1008
+ formatType: function(url, type) {
1009
+ var ext;
1010
+
1011
+ // if no type is supplied, fake it with the extension
1012
+ if (url && !type) {
1013
+ return this.getTypeFromFile(url);
1014
+ } else {
1015
+ // only return the mime part of the type in case the attribute contains the codec
1016
+ // see http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-source-element
1017
+ // `video/mp4; codecs="avc1.42E01E, mp4a.40.2"` becomes `video/mp4`
1018
+
1019
+ if (type && ~type.indexOf(';')) {
1020
+ return type.substr(0, type.indexOf(';'));
1021
+ } else {
1022
+ return type;
1023
+ }
1024
+ }
1025
+ },
1026
+
1027
+ getTypeFromFile: function(url) {
1028
+ var ext = url.substring(url.lastIndexOf('.') + 1);
1029
+ return (/(mp4|m4v|ogg|ogv|webm|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video' : 'audio') + '/' + ext;
1030
+ },
1031
+
1032
+ createErrorMessage: function(playback, options, poster) {
1033
+ var
1034
+ htmlMediaElement = playback.htmlMediaElement,
1035
+ errorContainer = document.createElement('div');
1036
+
1037
+ errorContainer.className = 'me-cannotplay';
1038
+
1039
+ try {
1040
+ errorContainer.style.width = htmlMediaElement.width + 'px';
1041
+ errorContainer.style.height = htmlMediaElement.height + 'px';
1042
+ } catch (e) {}
1043
+
1044
+ errorContainer.innerHTML = (poster !== '') ?
1045
+ '<a href="' + playback.url + '"><img src="' + poster + '" width="100%" height="100%" /></a>' :
1046
+ '<a href="' + playback.url + '"><span>Download File</span></a>';
1047
+
1048
+ htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
1049
+ htmlMediaElement.style.display = 'none';
1050
+
1051
+ options.error(htmlMediaElement);
1052
+ },
1053
+
1054
+ createPlugin:function(playback, options, poster, autoplay, preload, controls) {
1055
+ var
1056
+ htmlMediaElement = playback.htmlMediaElement,
1057
+ width = 1,
1058
+ height = 1,
1059
+ pluginid = 'me_' + playback.method + '_' + (mejs.meIndex++),
1060
+ pluginMediaElement = new mejs.PluginMediaElement(pluginid, playback.method, playback.url),
1061
+ container = document.createElement('div'),
1062
+ specialIEContainer,
1063
+ node,
1064
+ initVars;
1065
+
1066
+ // copy tagName from html media element
1067
+ pluginMediaElement.tagName = htmlMediaElement.tagName
1068
+
1069
+ // copy attributes from html media element to plugin media element
1070
+ for (var i = 0; i < htmlMediaElement.attributes.length; i++) {
1071
+ var attribute = htmlMediaElement.attributes[i];
1072
+ if (attribute.specified == true) {
1073
+ pluginMediaElement.setAttribute(attribute.name, attribute.value);
1074
+ }
1075
+ }
1076
+
1077
+ // check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
1078
+ node = htmlMediaElement.parentNode;
1079
+ while (node !== null && node.tagName.toLowerCase() != 'body') {
1080
+ if (node.parentNode.tagName.toLowerCase() == 'p') {
1081
+ node.parentNode.parentNode.insertBefore(node, node.parentNode);
1082
+ break;
1083
+ }
1084
+ node = node.parentNode;
1085
+ }
1086
+
1087
+ if (playback.isVideo) {
1088
+ width = (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
1089
+ height = (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
1090
+
1091
+ // in case of '%' make sure it's encoded
1092
+ width = mejs.Utility.encodeUrl(width);
1093
+ height = mejs.Utility.encodeUrl(height);
1094
+
1095
+ } else {
1096
+ if (options.enablePluginDebug) {
1097
+ width = 320;
1098
+ height = 240;
1099
+ }
1100
+ }
1101
+
1102
+ // register plugin
1103
+ pluginMediaElement.success = options.success;
1104
+ mejs.MediaPluginBridge.registerPluginElement(pluginid, pluginMediaElement, htmlMediaElement);
1105
+
1106
+ // add container (must be added to DOM before inserting HTML for IE)
1107
+ container.className = 'me-plugin';
1108
+ container.id = pluginid + '_container';
1109
+
1110
+ if (playback.isVideo) {
1111
+ htmlMediaElement.parentNode.insertBefore(container, htmlMediaElement);
1112
+ } else {
1113
+ document.body.insertBefore(container, document.body.childNodes[0]);
1114
+ }
1115
+
1116
+ // flash/silverlight vars
1117
+ initVars = [
1118
+ 'id=' + pluginid,
1119
+ 'isvideo=' + ((playback.isVideo) ? "true" : "false"),
1120
+ 'autoplay=' + ((autoplay) ? "true" : "false"),
1121
+ 'preload=' + preload,
1122
+ 'width=' + width,
1123
+ 'startvolume=' + options.startVolume,
1124
+ 'timerrate=' + options.timerRate,
1125
+ 'height=' + height];
1126
+
1127
+ if (playback.url !== null) {
1128
+ if (playback.method == 'flash') {
1129
+ initVars.push('file=' + mejs.Utility.encodeUrl(playback.url));
1130
+ } else {
1131
+ initVars.push('file=' + playback.url);
1132
+ }
1133
+ }
1134
+ if (options.enablePluginDebug) {
1135
+ initVars.push('debug=true');
1136
+ }
1137
+ if (options.enablePluginSmoothing) {
1138
+ initVars.push('smoothing=true');
1139
+ }
1140
+ if (controls) {
1141
+ initVars.push('controls=true'); // shows controls in the plugin if desired
1142
+ }
1143
+ if (options.pluginVars) {
1144
+ initVars = initVars.concat(options.pluginVars);
1145
+ }
1146
+
1147
+ switch (playback.method) {
1148
+ case 'silverlight':
1149
+ container.innerHTML =
1150
+ '<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + pluginid + '" name="' + pluginid + '" width="' + width + '" height="' + height + '">' +
1151
+ '<param name="initParams" value="' + initVars.join(',') + '" />' +
1152
+ '<param name="windowless" value="true" />' +
1153
+ '<param name="background" value="black" />' +
1154
+ '<param name="minRuntimeVersion" value="3.0.0.0" />' +
1155
+ '<param name="autoUpgrade" value="true" />' +
1156
+ '<param name="source" value="' + options.pluginPath + options.silverlightName + '" />' +
1157
+ '</object>';
1158
+ break;
1159
+
1160
+ case 'flash':
1161
+
1162
+ if (mejs.MediaFeatures.isIE) {
1163
+ specialIEContainer = document.createElement('div');
1164
+ container.appendChild(specialIEContainer);
1165
+ specialIEContainer.outerHTML =
1166
+ '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
1167
+ 'id="' + pluginid + '" width="' + width + '" height="' + height + '">' +
1168
+ '<param name="movie" value="' + options.pluginPath + options.flashName + '?x=' + (new Date()) + '" />' +
1169
+ '<param name="flashvars" value="' + initVars.join('&amp;') + '" />' +
1170
+ '<param name="quality" value="high" />' +
1171
+ '<param name="bgcolor" value="#000000" />' +
1172
+ '<param name="wmode" value="transparent" />' +
1173
+ '<param name="allowScriptAccess" value="always" />' +
1174
+ '<param name="allowFullScreen" value="true" />' +
1175
+ '</object>';
1176
+
1177
+ } else {
1178
+
1179
+ container.innerHTML =
1180
+ '<embed id="' + pluginid + '" name="' + pluginid + '" ' +
1181
+ 'play="true" ' +
1182
+ 'loop="false" ' +
1183
+ 'quality="high" ' +
1184
+ 'bgcolor="#000000" ' +
1185
+ 'wmode="transparent" ' +
1186
+ 'allowScriptAccess="always" ' +
1187
+ 'allowFullScreen="true" ' +
1188
+ 'type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" ' +
1189
+ 'src="' + options.pluginPath + options.flashName + '" ' +
1190
+ 'flashvars="' + initVars.join('&') + '" ' +
1191
+ 'width="' + width + '" ' +
1192
+ 'height="' + height + '"></embed>';
1193
+ }
1194
+ break;
1195
+
1196
+ case 'youtube':
1197
+
1198
+
1199
+ var
1200
+ videoId = playback.url.substr(playback.url.lastIndexOf('=')+1);
1201
+ youtubeSettings = {
1202
+ container: container,
1203
+ containerId: container.id,
1204
+ pluginMediaElement: pluginMediaElement,
1205
+ pluginId: pluginid,
1206
+ videoId: videoId,
1207
+ height: height,
1208
+ width: width
1209
+ };
1210
+
1211
+ if (mejs.PluginDetector.hasPluginVersion('flash', [10,0,0]) ) {
1212
+ mejs.YouTubeApi.createFlash(youtubeSettings);
1213
+ } else {
1214
+ mejs.YouTubeApi.enqueueIframe(youtubeSettings);
1215
+ }
1216
+
1217
+ break;
1218
+
1219
+ // DEMO Code. Does NOT work.
1220
+ case 'vimeo':
1221
+ console.log('vimeoid');
1222
+
1223
+ pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
1224
+
1225
+ container.innerHTML =
1226
+ '<object width="' + width + '" height="' + height + '">' +
1227
+ '<param name="allowfullscreen" value="true" />' +
1228
+ '<param name="allowscriptaccess" value="always" />' +
1229
+ '<param name="flashvars" value="api=1" />' +
1230
+ '<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=' + pluginMediaElement.vimeoid + '&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" />' +
1231
+ '<embed src="//vimeo.com/moogaloop.swf?api=1&amp;clip_id=' + pluginMediaElement.vimeoid + '&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="' + width + '" height="' + height + '"></embed>' +
1232
+ '</object>';
1233
+
1234
+ break;
1235
+ }
1236
+ // hide original element
1237
+ htmlMediaElement.style.display = 'none';
1238
+
1239
+ // FYI: options.success will be fired by the MediaPluginBridge
1240
+
1241
+ return pluginMediaElement;
1242
+ },
1243
+
1244
+ updateNative: function(playback, options, autoplay, preload) {
1245
+
1246
+ var htmlMediaElement = playback.htmlMediaElement,
1247
+ m;
1248
+
1249
+
1250
+ // add methods to video object to bring it into parity with Flash Object
1251
+ for (m in mejs.HtmlMediaElement) {
1252
+ htmlMediaElement[m] = mejs.HtmlMediaElement[m];
1253
+ }
1254
+
1255
+ /*
1256
+ Chrome now supports preload="none"
1257
+ if (mejs.MediaFeatures.isChrome) {
1258
+
1259
+ // special case to enforce preload attribute (Chrome doesn't respect this)
1260
+ if (preload === 'none' && !autoplay) {
1261
+
1262
+ // forces the browser to stop loading (note: fails in IE9)
1263
+ htmlMediaElement.src = '';
1264
+ htmlMediaElement.load();
1265
+ htmlMediaElement.canceledPreload = true;
1266
+
1267
+ htmlMediaElement.addEventListener('play',function() {
1268
+ if (htmlMediaElement.canceledPreload) {
1269
+ htmlMediaElement.src = playback.url;
1270
+ htmlMediaElement.load();
1271
+ htmlMediaElement.play();
1272
+ htmlMediaElement.canceledPreload = false;
1273
+ }
1274
+ }, false);
1275
+ // for some reason Chrome forgets how to autoplay sometimes.
1276
+ } else if (autoplay) {
1277
+ htmlMediaElement.load();
1278
+ htmlMediaElement.play();
1279
+ }
1280
+ }
1281
+ */
1282
+
1283
+ // fire success code
1284
+ options.success(htmlMediaElement, htmlMediaElement);
1285
+
1286
+ return htmlMediaElement;
1287
+ }
1288
+ };
1289
+
1290
+ /*
1291
+ - test on IE (object vs. embed)
1292
+ - determine when to use iframe (Firefox, Safari, Mobile) vs. Flash (Chrome, IE)
1293
+ - fullscreen?
1294
+ */
1295
+
1296
+ // YouTube Flash and Iframe API
1297
+ mejs.YouTubeApi = {
1298
+ isIframeStarted: false,
1299
+ isIframeLoaded: false,
1300
+ loadIframeApi: function() {
1301
+ if (!this.isIframeStarted) {
1302
+ var tag = document.createElement('script');
1303
+ tag.src = "http://www.youtube.com/player_api";
1304
+ var firstScriptTag = document.getElementsByTagName('script')[0];
1305
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
1306
+ this.isIframeStarted = true;
1307
+ }
1308
+ },
1309
+ iframeQueue: [],
1310
+ enqueueIframe: function(yt) {
1311
+
1312
+ if (this.isLoaded) {
1313
+ this.createIframe(yt);
1314
+ } else {
1315
+ this.loadIframeApi();
1316
+ this.iframeQueue.push(yt);
1317
+ }
1318
+ },
1319
+ createIframe: function(settings) {
1320
+
1321
+ var
1322
+ pluginMediaElement = settings.pluginMediaElement,
1323
+ player = new YT.Player(settings.containerId, {
1324
+ height: settings.height,
1325
+ width: settings.width,
1326
+ videoId: settings.videoId,
1327
+ playerVars: {controls:0},
1328
+ events: {
1329
+ 'onReady': function() {
1330
+
1331
+ // hook up iframe object to MEjs
1332
+ settings.pluginMediaElement.pluginApi = player;
1333
+
1334
+ // init mejs
1335
+ mejs.MediaPluginBridge.initPlugin(settings.pluginId);
1336
+
1337
+ // create timer
1338
+ setInterval(function() {
1339
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
1340
+ }, 250);
1341
+ },
1342
+ 'onStateChange': function(e) {
1343
+
1344
+ mejs.YouTubeApi.handleStateChange(e.data, player, pluginMediaElement);
1345
+
1346
+ }
1347
+ }
1348
+ });
1349
+ },
1350
+
1351
+ createEvent: function (player, pluginMediaElement, eventName) {
1352
+ var obj = {
1353
+ type: eventName,
1354
+ target: pluginMediaElement
1355
+ };
1356
+
1357
+ if (player && player.getDuration) {
1358
+
1359
+ // time
1360
+ pluginMediaElement.currentTime = obj.currentTime = player.getCurrentTime();
1361
+ pluginMediaElement.duration = obj.duration = player.getDuration();
1362
+
1363
+ // state
1364
+ obj.paused = pluginMediaElement.paused;
1365
+ obj.ended = pluginMediaElement.ended;
1366
+
1367
+ // sound
1368
+ obj.muted = player.isMuted();
1369
+ obj.volume = player.getVolume() / 100;
1370
+
1371
+ // progress
1372
+ obj.bytesTotal = player.getVideoBytesTotal();
1373
+ obj.bufferedBytes = player.getVideoBytesLoaded();
1374
+
1375
+ // fake the W3C buffered TimeRange
1376
+ var bufferedTime = obj.bufferedBytes / obj.bytesTotal * obj.duration;
1377
+
1378
+ obj.target.buffered = obj.buffered = {
1379
+ start: function(index) {
1380
+ return 0;
1381
+ },
1382
+ end: function (index) {
1383
+ return bufferedTime;
1384
+ },
1385
+ length: 1
1386
+ };
1387
+
1388
+ }
1389
+
1390
+ // send event up the chain
1391
+ pluginMediaElement.dispatchEvent(obj.type, obj);
1392
+ },
1393
+
1394
+ iFrameReady: function() {
1395
+
1396
+ this.isLoaded = true;
1397
+ this.isIframeLoaded = true;
1398
+
1399
+ while (this.iframeQueue.length > 0) {
1400
+ var settings = this.iframeQueue.pop();
1401
+ this.createIframe(settings);
1402
+ }
1403
+ },
1404
+
1405
+ // FLASH!
1406
+ flashPlayers: {},
1407
+ createFlash: function(settings) {
1408
+
1409
+ this.flashPlayers[settings.pluginId] = settings;
1410
+
1411
+ /*
1412
+ settings.container.innerHTML =
1413
+ '<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="//www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid=' + settings.pluginId + '&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0" ' +
1414
+ 'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; ">' +
1415
+ '<param name="allowScriptAccess" value="always">' +
1416
+ '<param name="wmode" value="transparent">' +
1417
+ '</object>';
1418
+ */
1419
+
1420
+ var specialIEContainer,
1421
+ youtubeUrl = 'http://www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid=' + settings.pluginId + '&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0';
1422
+
1423
+ if (mejs.MediaFeatures.isIE) {
1424
+
1425
+ specialIEContainer = document.createElement('div');
1426
+ settings.container.appendChild(specialIEContainer);
1427
+ specialIEContainer.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
1428
+ 'id="' + settings.pluginId + '" width="' + settings.width + '" height="' + settings.height + '">' +
1429
+ '<param name="movie" value="' + youtubeUrl + '" />' +
1430
+ '<param name="wmode" value="transparent" />' +
1431
+ '<param name="allowScriptAccess" value="always" />' +
1432
+ '<param name="allowFullScreen" value="true" />' +
1433
+ '</object>';
1434
+ } else {
1435
+ settings.container.innerHTML =
1436
+ '<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="' + youtubeUrl + '" ' +
1437
+ 'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; ">' +
1438
+ '<param name="allowScriptAccess" value="always">' +
1439
+ '<param name="wmode" value="transparent">' +
1440
+ '</object>';
1441
+ }
1442
+
1443
+ },
1444
+
1445
+ flashReady: function(id) {
1446
+ var
1447
+ settings = this.flashPlayers[id],
1448
+ player = document.getElementById(id),
1449
+ pluginMediaElement = settings.pluginMediaElement;
1450
+
1451
+ // hook up and return to MediaELementPlayer.success
1452
+ pluginMediaElement.pluginApi =
1453
+ pluginMediaElement.pluginElement = player;
1454
+ mejs.MediaPluginBridge.initPlugin(id);
1455
+
1456
+ // load the youtube video
1457
+ player.cueVideoById(settings.videoId);
1458
+
1459
+ var callbackName = settings.containerId + '_callback'
1460
+
1461
+ window[callbackName] = function(e) {
1462
+ mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
1463
+ }
1464
+
1465
+ player.addEventListener('onStateChange', callbackName);
1466
+
1467
+ setInterval(function() {
1468
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
1469
+ }, 250);
1470
+ },
1471
+
1472
+ handleStateChange: function(youTubeState, player, pluginMediaElement) {
1473
+ switch (youTubeState) {
1474
+ case -1: // not started
1475
+ pluginMediaElement.paused = true;
1476
+ pluginMediaElement.ended = true;
1477
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'loadedmetadata');
1478
+ //createYouTubeEvent(player, pluginMediaElement, 'loadeddata');
1479
+ break;
1480
+ case 0:
1481
+ pluginMediaElement.paused = false;
1482
+ pluginMediaElement.ended = true;
1483
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'ended');
1484
+ break;
1485
+ case 1:
1486
+ pluginMediaElement.paused = false;
1487
+ pluginMediaElement.ended = false;
1488
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'play');
1489
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'playing');
1490
+ break;
1491
+ case 2:
1492
+ pluginMediaElement.paused = true;
1493
+ pluginMediaElement.ended = false;
1494
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'pause');
1495
+ break;
1496
+ case 3: // buffering
1497
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'progress');
1498
+ break;
1499
+ case 5:
1500
+ // cued?
1501
+ break;
1502
+
1503
+ }
1504
+
1505
+ }
1506
+ }
1507
+ // IFRAME
1508
+ function onYouTubePlayerAPIReady() {
1509
+ mejs.YouTubeApi.iFrameReady();
1510
+ }
1511
+ // FLASH
1512
+ function onYouTubePlayerReady(id) {
1513
+ mejs.YouTubeApi.flashReady(id);
1514
+ }
1515
+
1516
+ window.mejs = mejs;
1517
+ window.MediaElement = mejs.MediaElement;
1518
+
1519
+ /*!
1520
+ * MediaElementPlayer
1521
+ * http://mediaelementjs.com/
1522
+ *
1523
+ * Creates a controller bar for HTML5 <video> add <audio> tags
1524
+ * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
1525
+ *
1526
+ * Copyright 2010-2012, John Dyer (http://j.hn/)
1527
+ * Dual licensed under the MIT or GPL Version 2 licenses.
1528
+ *
1529
+ */
1530
+ if (typeof jQuery != 'undefined') {
1531
+ mejs.$ = jQuery;
1532
+ } else if (typeof ender != 'undefined') {
1533
+ mejs.$ = ender;
1534
+ }
1535
  (function ($) {
1536
 
1537
  // default player values
1546
  videoWidth: -1,
1547
  // if set, overrides <video height>
1548
  videoHeight: -1,
1549
+ // default if the user doesn't specify
1550
+ defaultAudioWidth: 400,
1551
+ // default if the user doesn't specify
1552
+ defaultAudioHeight: 30,
1553
  // width of audio player
1554
+ audioWidth: -1,
1555
  // height of audio player
1556
+ audioHeight: -1,
1557
  // initial volume when the player starts (overrided by user cookie)
1558
  startVolume: 0.8,
1559
  // useful for <audio> player loops
1567
  showTimecodeFrameCount: false,
1568
  // used when showTimecodeFrameCount is set to true
1569
  framesPerSecond: 25,
1570
+
1571
+ // automatically calculate the width of the progress bar based on the sizes of other elements
1572
+ autosizeProgress : true,
1573
  // Hide controls when playing and mouse is not over the video
1574
  alwaysShowControls: false,
1575
  // force iPad's native controls
1576
  iPadUseNativeControls: false,
1577
+ // force iPhone's native controls
1578
  iPhoneUseNativeControls: false,
1579
+ // force Android's native controls
1580
  AndroidUseNativeControls: false,
1581
  // features to show
1582
  features: ['playpause','current','progress','duration','tracks','volume','fullscreen'],
1583
  // only for dynamic
1584
+ isVideo: true,
1585
+
1586
+ // turns keyboard support on and off for this instance
1587
+ enableKeyboard: true,
1588
+
1589
+ // whenthis player starts, it will pause other players
1590
+ pauseOtherPlayers: true,
1591
+
1592
+ // array of keyboard actions such as play pause
1593
+ keyActions: [
1594
+ {
1595
+ keys: [
1596
+ 32, // SPACE
1597
+ 179 // GOOGLE play/pause button
1598
+ ],
1599
+ action: function(player, media) {
1600
+ if (media.paused || media.ended) {
1601
+ media.play();
1602
+ } else {
1603
+ media.pause();
1604
+ }
1605
+ }
1606
+ },
1607
+ {
1608
+ keys: [38], // UP
1609
+ action: function(player, media) {
1610
+ var newVolume = Math.min(media.volume + 0.1, 1);
1611
+ media.setVolume(newVolume);
1612
+ }
1613
+ },
1614
+ {
1615
+ keys: [40], // DOWN
1616
+ action: function(player, media) {
1617
+ var newVolume = Math.max(media.volume - 0.1, 0);
1618
+ media.setVolume(newVolume);
1619
+ }
1620
+ },
1621
+ {
1622
+ keys: [
1623
+ 37, // LEFT
1624
+ 227 // Google TV rewind
1625
+ ],
1626
+ action: function(player, media) {
1627
+ if (!isNaN(media.duration) && media.duration > 0) {
1628
+ if (player.isVideo) {
1629
+ player.showControls();
1630
+ player.startControlsTimer();
1631
+ }
1632
+
1633
+ // 5%
1634
+ var newTime = Math.min(media.currentTime - (media.duration * 0.05), media.duration);
1635
+ media.setCurrentTime(newTime);
1636
+ }
1637
+ }
1638
+ },
1639
+ {
1640
+ keys: [
1641
+ 39, // RIGHT
1642
+ 228 // Google TV forward
1643
+ ],
1644
+ action: function(player, media) {
1645
+ if (!isNaN(media.duration) && media.duration > 0) {
1646
+ if (player.isVideo) {
1647
+ player.showControls();
1648
+ player.startControlsTimer();
1649
+ }
1650
+
1651
+ // 5%
1652
+ var newTime = Math.max(media.currentTime + (media.duration * 0.05), 0);
1653
+ media.setCurrentTime(newTime);
1654
+ }
1655
+ }
1656
+ },
1657
+ {
1658
+ keys: [70], // f
1659
+ action: function(player, media) {
1660
+ if (typeof player.enterFullScreen != 'undefined') {
1661
+ if (player.isFullScreen) {
1662
+ player.exitFullScreen();
1663
+ } else {
1664
+ player.enterFullScreen();
1665
+ }
1666
+ }
1667
+ }
1668
+ }
1669
+ ]
1670
  };
1671
 
1672
  mejs.mepIndex = 0;
1673
+
1674
+ mejs.players = [];
1675
 
1676
  // wraps a MediaElement object in player controls
1677
  mejs.MediaElementPlayer = function(node, o) {
1693
  // attach player to DOM node for reference
1694
  t.node.player = t;
1695
  }
1696
+
1697
+
1698
+ // try to get options from data-mejsoptions
1699
+ if (typeof o == 'undefined') {
1700
+ o = t.$node.data('mejsoptions');
1701
+ }
1702
+
1703
+ // extend default options
1704
+ t.options = $.extend({},mejs.MepDefaults,o);
1705
+
1706
+ // add to player array (for focus events)
1707
+ mejs.players.push(t);
1708
 
1709
  // start up
1710
  t.init();
1714
 
1715
  // actual player
1716
  mejs.MediaElementPlayer.prototype = {
1717
+
1718
+ hasFocus: false,
1719
+
1720
+ controlsAreVisible: true,
1721
+
1722
  init: function() {
1723
 
1724
  var
1747
  t.$media.attr('controls', 'controls');
1748
 
1749
  // attempt to fix iOS 3 bug
1750
+ //t.$media.removeAttr('poster');
1751
+ // no Issue found on iOS3 -ttroxell
1752
 
1753
  // override Apple's autoplay override for iPads
1754
  if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
1781
  '</div>' +
1782
  '</div>')
1783
  .addClass(t.$media[0].className)
1784
+ .insertBefore(t.$media);
1785
+
1786
+ // add classes for user and content
1787
+ t.container.addClass(
1788
+ (mf.isAndroid ? 'mejs-android ' : '') +
1789
+ (mf.isiOS ? 'mejs-ios ' : '') +
1790
+ (mf.isiPad ? 'mejs-ipad ' : '') +
1791
+ (mf.isiPhone ? 'mejs-iphone ' : '') +
1792
+ (t.isVideo ? 'mejs-video ' : 'mejs-audio ')
1793
+ );
1794
+
1795
 
1796
  // move the <video/video> tag into the right spot
1797
+ if (mf.isiOS) {
1798
 
1799
  // sadly, you can't move nodes in iOS, so we have to destroy and recreate it!
1800
  var $newMedia = t.$media.clone();
1816
  t.layers = t.container.find('.mejs-layers');
1817
 
1818
  // determine the size
1819
+
1820
+ /* size priority:
1821
+ (1) videoWidth (forced),
1822
+ (2) style="width;height;"
1823
+ (3) width attribute,
1824
+ (4) defaultVideoWidth (for unspecified cases)
1825
+ */
1826
+
1827
+ var capsTagName = tagName.substring(0,1).toUpperCase() + tagName.substring(1);
1828
+
1829
+ if (t.options[tagName + 'Width'] > 0 || t.options[tagName + 'Width'].toString().indexOf('%') > -1) {
1830
+ t.width = t.options[tagName + 'Width'];
1831
+ } else if (t.media.style.width !== '' && t.media.style.width !== null) {
1832
+ t.width = t.media.style.width;
1833
+ } else if (t.media.getAttribute('width') !== null) {
1834
+ t.width = t.$media.attr('width');
1835
+ } else {
1836
+ t.width = t.options['default' + capsTagName + 'Width'];
1837
+ }
1838
+
1839
+ if (t.options[tagName + 'Height'] > 0 || t.options[tagName + 'Height'].toString().indexOf('%') > -1) {
1840
+ t.height = t.options[tagName + 'Height'];
1841
+ } else if (t.media.style.height !== '' && t.media.style.height !== null) {
1842
+ t.height = t.media.style.height;
1843
+ } else if (t.$media[0].getAttribute('height') !== null) {
1844
+ t.height = t.$media.attr('height');
1845
  } else {
1846
+ t.height = t.options['default' + capsTagName + 'Height'];
 
1847
  }
1848
 
1849
  // set the size, while we wait for the plugins to load below
1853
  meOptions.pluginWidth = t.height;
1854
  meOptions.pluginHeight = t.width;
1855
  }
1856
+
1857
+
1858
 
1859
  // create MediaElement shim
1860
  mejs.MediaElement(t.$media[0], meOptions);
1861
  },
1862
 
 
 
1863
  showControls: function(doAnimation) {
1864
+ var t = this;
1865
+
1866
+ doAnimation = typeof doAnimation == 'undefined' || doAnimation;
1867
 
1868
  if (t.controlsAreVisible)
1869
  return;
1896
  },
1897
 
1898
  hideControls: function(doAnimation) {
1899
+ var t = this;
1900
+
1901
+ doAnimation = typeof doAnimation == 'undefined' || doAnimation;
1902
 
1903
  if (!t.controlsAreVisible)
1904
  return;
1939
 
1940
  startControlsTimer: function(timeout) {
1941
 
1942
+ var t = this;
1943
+
1944
+ timeout = typeof timeout != 'undefined' ? timeout : 1500;
1945
 
1946
  t.killControlsTimer('start');
1947
 
2006
 
2007
  // two built in features
2008
  t.buildposter(t, t.controls, t.layers, t.media);
2009
+ t.buildkeyboard(t, t.controls, t.layers, t.media);
2010
  t.buildoverlays(t, t.controls, t.layers, t.media);
2011
 
2012
  // grab for use by features
2036
 
2037
  // controls fade
2038
  if (t.isVideo) {
2039
+
2040
+ if (mejs.MediaFeatures.hasTouch) {
2041
+
2042
+ // for touch devices (iOS, Android)
2043
+ // show/hide without animation on touch
2044
+
2045
+ t.$media.bind('touchstart', function() {
2046
+
2047
+
2048
+ // toggle controls
2049
+ if (t.controlsAreVisible) {
2050
+ t.hideControls(false);
2051
  } else {
2052
+ if (t.controlsEnabled) {
2053
+ t.showControls(false);
2054
+ }
2055
  }
2056
+ });
2057
+
2058
  } else {
2059
+ // click controls
2060
+ var clickElement = (t.media.pluginType == 'native') ? t.$media : $(t.media.pluginElement);
2061
+
2062
+ // click to play/pause
2063
+ clickElement.click(function() {
2064
  if (media.paused) {
2065
  media.play();
2066
  } else {
2067
  media.pause();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2068
  }
2069
  });
2070
 
2071
+
2072
+ // show/hide controls
2073
+ t.container
2074
+ .bind('mouseenter mouseover', function () {
2075
+ if (t.controlsEnabled) {
2076
+ if (!t.options.alwaysShowControls) {
2077
+ t.killControlsTimer('enter');
2078
+ t.showControls();
2079
+ t.startControlsTimer(2500);
2080
+ }
2081
+ }
2082
+ })
2083
+ .bind('mousemove', function() {
2084
+ if (t.controlsEnabled) {
2085
+ if (!t.controlsAreVisible) {
2086
+ t.showControls();
2087
+ }
2088
+ //t.killControlsTimer('move');
2089
+ if (!t.options.alwaysShowControls) {
2090
+ t.startControlsTimer(2500);
2091
+ }
2092
+ }
2093
+ })
2094
+ .bind('mouseleave', function () {
2095
+ if (t.controlsEnabled) {
2096
+ if (!t.media.paused && !t.options.alwaysShowControls) {
2097
+ t.startControlsTimer(1000);
2098
+ }
2099
+ }
2100
+ });
2101
+ }
2102
+
2103
  // check for autoplay
2104
  if (autoplay && !t.options.alwaysShowControls) {
2105
  t.hideControls();
2118
  }, false);
2119
  }
2120
  }
2121
+
2122
+ // EVENTS
2123
+
2124
+ // FOCUS: when a video starts playing, it takes focus from other players (possibily pausing them)
2125
+ media.addEventListener('play', function() {
2126
+
2127
+ // go through all other players
2128
+ for (var i=0, il=mejs.players.length; i<il; i++) {
2129
+ var p = mejs.players[i];
2130
+ if (p.id != t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended) {
2131
+ p.pause();
2132
+ }
2133
+ p.hasFocus = false;
2134
+ }
2135
+
2136
+ t.hasFocus = true;
2137
+ },false);
2138
+
2139
 
2140
  // ended for all
2141
  t.media.addEventListener('ended', function (e) {
2142
+ try{
2143
+ t.media.setCurrentTime(0);
2144
+ } catch (exp) {
2145
+
2146
+ }
2147
  t.media.pause();
2148
 
2149
  if (t.setProgressRail)
2156
  } else if (!t.options.alwaysShowControls && t.controlsEnabled) {
2157
  t.showControls();
2158
  }
2159
+ }, false);
2160
 
2161
  // resize on the first play
2162
  t.media.addEventListener('loadedmetadata', function(e) {
2167
  t.updateCurrent();
2168
  }
2169
 
2170
+ if (!t.isFullScreen) {
2171
+ t.setPlayerSize(t.width, t.height);
2172
+ t.setControlsSize();
2173
+ }
2174
+ }, false);
2175
 
2176
 
2177
  // webkit has trouble doing this without a delay
2192
  t.setControlsSize();
2193
  });
2194
 
2195
+ // TEMP: needs to be moved somewhere else
2196
+ if (t.media.pluginType == 'youtube') {
2197
+ t.container.find('.mejs-overlay-play').hide();
2198
+ }
2199
  }
2200
 
2201
  // force autoplay for HTML5
2206
 
2207
 
2208
  if (t.options.success) {
2209
+
2210
+ if (typeof t.options.success == 'string') {
2211
+ window[t.options.success](t.media, t.domNode, t);
2212
+ } else {
2213
+ t.options.success(t.media, t.domNode, t);
2214
+ }
2215
  }
2216
  },
2217
 
2229
  setPlayerSize: function(width,height) {
2230
  var t = this;
2231
 
2232
+ if (typeof width != 'undefined')
2233
+ t.width = width;
2234
+
2235
+ if (typeof height != 'undefined')
2236
+ t.height = height;
2237
+
2238
+ // detect 100% mode
2239
  if (t.height.toString().indexOf('%') > 0) {
2240
 
2241
  // do we have the native dimensions yet?
2262
  .height('100%');
2263
 
2264
  // set shims
2265
+ t.container.find('object, embed, iframe')
2266
  .width('100%')
2267
  .height('100%');
2268
 
2298
  current = t.controls.find('.mejs-time-current'),
2299
  loaded = t.controls.find('.mejs-time-loaded');
2300
  others = rail.siblings();
2301
+
2302
 
2303
+ // allow the size to come from custom CSS
2304
+ if (t.options && !t.options.autosizeProgress) {
2305
+ // Also, frontends devs can be more flexible
2306
+ // due the opportunity of absolute positioning.
2307
+ railWidth = parseInt(rail.css('width'));
2308
+ }
2309
+
2310
+ // attempt to autosize
2311
+ if (railWidth === 0 || !railWidth) {
2312
+
2313
+ // find the size of all the other controls besides the rail
2314
+ others.each(function() {
2315
+ if ($(this).css('position') != 'absolute') {
2316
+ usedWidth += $(this).outerWidth(true);
2317
+ }
2318
+ });
2319
+
2320
+ // fit the rail into the remaining space
2321
+ railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.outerWidth(false));
2322
+ }
2323
 
2324
  // outer area
2325
  rail.width(railWidth);
2401
  media.pause();
2402
  }
2403
  });
2404
+
2405
+ /*
2406
  if (mejs.MediaFeatures.isiOS || mejs.MediaFeatures.isAndroid) {
2407
  bigPlay.remove();
2408
  loading.remove();
2409
  }
2410
+ */
2411
 
2412
 
2413
  // show/hide big play button
2414
  media.addEventListener('play',function() {
2415
  bigPlay.hide();
2416
+ loading.hide();
2417
  error.hide();
2418
+ }, false);
2419
+
2420
+ media.addEventListener('playing', function() {
2421
+ bigPlay.hide();
2422
+ loading.hide();
2423
+ error.hide();
2424
  }, false);
2425
+
2426
  media.addEventListener('pause',function() {
2427
+ if (!mejs.MediaFeatures.isiPhone) {
2428
+ bigPlay.show();
2429
+ }
2430
  }, false);
2431
 
2432
+ media.addEventListener('waiting', function() {
2433
+ loading.show();
2434
+ }, false);
2435
+
2436
+
2437
  // show/hide loading
2438
  media.addEventListener('loadeddata',function() {
2439
  // for some reason Chrome is firing this event
2453
  error.find('mejs-overlay-error').html("Error loading this resource");
2454
  }, false);
2455
  },
2456
+
2457
+ buildkeyboard: function(player, controls, layers, media) {
2458
+
2459
+ var t = this;
2460
+
2461
+ // listen for key presses
2462
+ $(document).keydown(function(e) {
2463
+
2464
+ if (player.hasFocus && player.options.enableKeyboard) {
2465
+
2466
+ // find a matching key
2467
+ for (var i=0, il=player.options.keyActions.length; i<il; i++) {
2468
+ var keyAction = player.options.keyActions[i];
2469
+
2470
+ for (var j=0, jl=keyAction.keys.length; j<jl; j++) {
2471
+ if (e.keyCode == keyAction.keys[j]) {
2472
+ e.preventDefault();
2473
+ keyAction.action(player, media);
2474
+ return false;
2475
+ }
2476
+ }
2477
+ }
2478
+ }
2479
+
2480
+ return true;
2481
+ });
2482
+
2483
+ // check if someone clicked outside a player region, then kill its focus
2484
+ $(document).click(function(event) {
2485
+ if ($(event.target).closest('.mejs-container').length == 0) {
2486
+ player.hasFocus = false;
2487
+ }
2488
+ });
2489
+
2490
+ },
2491
 
2492
  findTracks: function() {
2493
  var t = this,
2495
 
2496
  // store for use by plugins
2497
  t.tracks = [];
2498
+ tracktags.each(function(index, track) {
2499
+
2500
+ track = $(track);
2501
+
2502
  t.tracks.push({
2503
+ srclang: track.attr('srclang').toLowerCase(),
2504
+ src: track.attr('src'),
2505
+ kind: track.attr('kind'),
2506
+ label: track.attr('label') || '',
2507
  entries: [],
2508
  isLoaded: false
2509
  });
2511
  },
2512
  changeSkin: function(className) {
2513
  this.container[0].className = 'mejs-container ' + className;
2514
+ this.setPlayerSize(this.width, this.height);
2515
  this.setControlsSize();
2516
  },
2517
  play: function() {
2540
  },
2541
  setSrc: function(src) {
2542
  this.media.setSrc(src);
2543
+ },
2544
+ remove: function() {
2545
+ var t = this;
2546
+
2547
+ if (t.media.pluginType == 'flash') {
2548
+ t.media.remove();
2549
+ } else if (t.media.pluginTyp == 'native') {
2550
+ t.media.prop('controls', true);
2551
+ }
2552
+
2553
+ // grab video and put it back in place
2554
+ if (!t.isDynamic) {
2555
+ t.$node.insertBefore(t.container)
2556
+ }
2557
+
2558
+ t.container.remove();
2559
  }
2560
  };
2561
 
2568
  };
2569
  }
2570
 
2571
+ $(document).ready(function() {
2572
+ // auto enable using JSON attribute
2573
+ $('.mejs-player').mediaelementplayer();
2574
+ });
2575
+
2576
  // push out to window
2577
  window.MediaElementPlayer = mejs.MediaElementPlayer;
2578
 
2579
  })(mejs.$);
2580
+
2581
+ (function($) {
2582
+
2583
+ $.extend(mejs.MepDefaults, {
2584
+ playpauseText: 'Play/Pause'
2585
+ });
2586
+
2587
+ // PLAY/pause BUTTON
2588
+ $.extend(MediaElementPlayer.prototype, {
2589
+ buildplaypause: function(player, controls, layers, media) {
2590
+ var
2591
+ t = this,
2592
+ play =
2593
+ $('<div class="mejs-button mejs-playpause-button mejs-play" >' +
2594
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.playpauseText + '"></button>' +
2595
+ '</div>')
2596
+ .appendTo(controls)
2597
+ .click(function(e) {
2598
+ e.preventDefault();
2599
+
2600
+ if (media.paused) {
2601
+ media.play();
2602
+ } else {
2603
+ media.pause();
2604
+ }
2605
+
2606
+ return false;
2607
+ });
2608
+
2609
+ media.addEventListener('play',function() {
2610
+ play.removeClass('mejs-play').addClass('mejs-pause');
2611
+ }, false);
2612
+ media.addEventListener('playing',function() {
2613
+ play.removeClass('mejs-play').addClass('mejs-pause');
2614
+ }, false);
2615
+
2616
+
2617
+ media.addEventListener('pause',function() {
2618
+ play.removeClass('mejs-pause').addClass('mejs-play');
2619
+ }, false);
2620
+ media.addEventListener('paused',function() {
2621
+ play.removeClass('mejs-pause').addClass('mejs-play');
2622
+ }, false);
2623
+ }
2624
+ });
2625
+
2626
+ })(mejs.$);
2627
+ (function($) {
2628
+
2629
+ $.extend(mejs.MepDefaults, {
2630
+ stopText: 'Stop'
2631
+ });
2632
+
2633
+ // STOP BUTTON
2634
+ $.extend(MediaElementPlayer.prototype, {
2635
+ buildstop: function(player, controls, layers, media) {
2636
+ var t = this,
2637
+ stop =
2638
+ $('<div class="mejs-button mejs-stop-button mejs-stop">' +
2639
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.stopText + '></button>' +
2640
+ '</div>')
2641
+ .appendTo(controls)
2642
+ .click(function() {
2643
+ if (!media.paused) {
2644
+ media.pause();
2645
+ }
2646
+ if (media.currentTime > 0) {
2647
+ media.setCurrentTime(0);
2648
+ controls.find('.mejs-time-current').width('0px');
2649
+ controls.find('.mejs-time-handle').css('left', '0px');
2650
+ controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0) );
2651
+ controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0) );
2652
+ layers.find('.mejs-poster').show();
2653
+ }
2654
+ });
2655
+ }
2656
+ });
2657
+
2658
+ })(mejs.$);
2659
+ (function($) {
2660
+ // progress/loaded bar
2661
+ $.extend(MediaElementPlayer.prototype, {
2662
+ buildprogress: function(player, controls, layers, media) {
2663
+
2664
+ $('<div class="mejs-time-rail">'+
2665
+ '<span class="mejs-time-total">'+
2666
+ '<span class="mejs-time-loaded"></span>'+
2667
+ '<span class="mejs-time-current"></span>'+
2668
+ '<span class="mejs-time-handle"></span>'+
2669
+ '<span class="mejs-time-float">' +
2670
+ '<span class="mejs-time-float-current">00:00</span>' +
2671
+ '<span class="mejs-time-float-corner"></span>' +
2672
+ '</span>'+
2673
+ '</span>'+
2674
+ '</div>')
2675
+ .appendTo(controls);
2676
+
2677
+ var
2678
+ t = this,
2679
+ total = controls.find('.mejs-time-total'),
2680
+ loaded = controls.find('.mejs-time-loaded'),
2681
+ current = controls.find('.mejs-time-current'),
2682
+ handle = controls.find('.mejs-time-handle'),
2683
+ timefloat = controls.find('.mejs-time-float'),
2684
+ timefloatcurrent = controls.find('.mejs-time-float-current'),
2685
+ handleMouseMove = function (e) {
2686
+ // mouse position relative to the object
2687
+ var x = e.pageX,
2688
+ offset = total.offset(),
2689
+ width = total.outerWidth(),
2690
+ percentage = 0,
2691
+ newTime = 0,
2692
+ pos = x - offset.left;
2693
+
2694
+
2695
+ if (x > offset.left && x <= width + offset.left && media.duration) {
2696
+ percentage = ((x - offset.left) / width);
2697
+ newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
2698
+
2699
+ // seek to where the mouse is
2700
+ if (mouseIsDown) {
2701
+ media.setCurrentTime(newTime);
2702
+ }
2703
+
2704
+ // position floating time box
2705
+ if (!mejs.MediaFeatures.hasTouch) {
2706
+ timefloat.css('left', pos);
2707
+ timefloatcurrent.html( mejs.Utility.secondsToTimeCode(newTime) );
2708
+ timefloat.show();
2709
+ }
2710
+ }
2711
+ },
2712
+ mouseIsDown = false,
2713
+ mouseIsOver = false;
2714
+
2715
+ // handle clicks
2716
+ //controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
2717
+ total
2718
+ .bind('mousedown', function (e) {
2719
+ // only handle left clicks
2720
+ if (e.which === 1) {
2721
+ mouseIsDown = true;
2722
+ handleMouseMove(e);
2723
+ return false;
2724
+ }
2725
+ });
2726
+
2727
+ controls.find('.mejs-time-total')
2728
+ .bind('mouseenter', function(e) {
2729
+ mouseIsOver = true;
2730
+ if (!mejs.MediaFeatures.hasTouch) {
2731
+ timefloat.show();
2732
+ }
2733
+ })
2734
+ .bind('mouseleave',function(e) {
2735
+ mouseIsOver = false;
2736
+ timefloat.hide();
2737
+ });
2738
+
2739
+ $(document)
2740
+ .bind('mouseup', function (e) {
2741
+ mouseIsDown = false;
2742
+ timefloat.hide();
2743
+ //handleMouseMove(e);
2744
+ })
2745
+ .bind('mousemove', function (e) {
2746
+ if (mouseIsDown || mouseIsOver) {
2747
+ handleMouseMove(e);
2748
+ }
2749
+ });
2750
+
2751
+ // loading
2752
+ media.addEventListener('progress', function (e) {
2753
+ player.setProgressRail(e);
2754
+ player.setCurrentRail(e);
2755
+ }, false);
2756
+
2757
+ // current time
2758
+ media.addEventListener('timeupdate', function(e) {
2759
+ player.setProgressRail(e);
2760
+ player.setCurrentRail(e);
2761
+ }, false);
2762
+
2763
+
2764
+ // store for later use
2765
+ t.loaded = loaded;
2766
+ t.total = total;
2767
+ t.current = current;
2768
+ t.handle = handle;
2769
+ },
2770
+ setProgressRail: function(e) {
2771
+
2772
+ var
2773
+ t = this,
2774
+ target = (e != undefined) ? e.target : t.media,
2775
+ percent = null;
2776
+
2777
+ // newest HTML5 spec has buffered array (FF4, Webkit)
2778
+ if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
2779
+ // TODO: account for a real array with multiple values (only Firefox 4 has this so far)
2780
+ percent = target.buffered.end(0) / target.duration;
2781
+ }
2782
+ // Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
2783
+ // to be anything other than 0. If the byte count is available we use this instead.
2784
+ // Browsers that support the else if do not seem to have the bufferedBytes value and
2785
+ // should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
2786
+ else if (target && target.bytesTotal != undefined && target.bytesTotal > 0 && target.bufferedBytes != undefined) {
2787
+ percent = target.bufferedBytes / target.bytesTotal;
2788
+ }
2789
+ // Firefox 3 with an Ogg file seems to go this way
2790
+ else if (e && e.lengthComputable && e.total != 0) {
2791
+ percent = e.loaded/e.total;
2792
+ }
2793
+
2794
+ // finally update the progress bar
2795
+ if (percent !== null) {
2796
+ percent = Math.min(1, Math.max(0, percent));
2797
+ // update loaded bar
2798
+ if (t.loaded && t.total) {
2799
+ t.loaded.width(t.total.width() * percent);
2800
+ }
2801
+ }
2802
+ },
2803
+ setCurrentRail: function() {
2804
+
2805
+ var t = this;
2806
+
2807
+ if (t.media.currentTime != undefined && t.media.duration) {
2808
+
2809
+ // update bar and handle
2810
+ if (t.total && t.handle) {
2811
+ var
2812
+ newWidth = t.total.width() * t.media.currentTime / t.media.duration,
2813
+ handlePos = newWidth - (t.handle.outerWidth(true) / 2);
2814
+
2815
+ t.current.width(newWidth);
2816
+ t.handle.css('left', handlePos);
2817
+ }
2818
+ }
2819
+
2820
+ }
2821
+ });
2822
+ })(mejs.$);
2823
  (function($) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2824
 
2825
+ // options
2826
+ $.extend(mejs.MepDefaults, {
2827
+ duration: -1,
2828
+ timeAndDurationSeparator: ' <span> | </span> '
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2829
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2830
 
 
 
 
 
 
 
 
 
 
 
2831
 
 
 
 
 
2832
  // current and duration 00:00 / 00:00
2833
  $.extend(MediaElementPlayer.prototype, {
2834
  buildcurrent: function(player, controls, layers, media) {
2852
  var t = this;
2853
 
2854
  if (controls.children().last().find('.mejs-currenttime').length > 0) {
2855
+ $(t.options.timeAndDurationSeparator +
2856
+ '<span class="mejs-duration">' +
2857
+ (t.options.duration > 0 ?
2858
+ mejs.Utility.secondsToTimeCode(t.options.duration, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25) :
2859
+ ((player.options.alwaysShowHours ? '00:' : '') + (player.options.showTimecodeFrameCount? '00:00:00':'00:00'))
2860
+ ) +
2861
+ '</span>')
2862
  .appendTo(controls.find('.mejs-time'));
2863
  } else {
2864
 
2866
  controls.find('.mejs-currenttime').parent().addClass('mejs-currenttime-container');
2867
 
2868
  $('<div class="mejs-time mejs-duration-container">'+
2869
+ '<span class="mejs-duration">' +
2870
+ (t.options.duration > 0 ?
2871
+ mejs.Utility.secondsToTimeCode(t.options.duration, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25) :
2872
+ ((player.options.alwaysShowHours ? '00:' : '') + (player.options.showTimecodeFrameCount? '00:00:00':'00:00'))
2873
+ ) +
2874
+ '</span>' +
2875
  '</div>')
2876
  .appendTo(controls);
2877
  }
2900
  }
2901
  });
2902
 
2903
+ })(mejs.$);
2904
+ (function($) {
2905
+
2906
+ $.extend(mejs.MepDefaults, {
2907
+ muteText: 'Mute Toggle',
2908
+ hideVolumeOnTouchDevices: true,
2909
+
2910
+ audioVolume: 'horizontal',
2911
+ videoVolume: 'vertical'
2912
+ });
2913
+
2914
+ $.extend(MediaElementPlayer.prototype, {
2915
+ buildvolume: function(player, controls, layers, media) {
2916
+
2917
+ // Android and iOS don't support volume controls
2918
+ if (mejs.MediaFeatures.hasTouch && this.options.hideVolumeOnTouchDevices)
2919
+ return;
2920
+
2921
+ var t = this,
2922
+ mode = (t.isVideo) ? t.options.videoVolume : t.options.audioVolume,
2923
+ mute = (mode == 'horizontal') ?
2924
+
2925
+ // horizontal version
2926
+ $('<div class="mejs-button mejs-volume-button mejs-mute">'+
2927
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.muteText + '"></button>'+
2928
+ '</div>' +
2929
+ '<div class="mejs-horizontal-volume-slider">'+ // outer background
2930
+ '<div class="mejs-horizontal-volume-total"></div>'+ // line background
2931
+ '<div class="mejs-horizontal-volume-current"></div>'+ // current volume
2932
+ '<div class="mejs-horizontal-volume-handle"></div>'+ // handle
2933
+ '</div>'
2934
+ )
2935
+ .appendTo(controls) :
2936
+
2937
+ // vertical version
2938
+ $('<div class="mejs-button mejs-volume-button mejs-mute">'+
2939
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.muteText + '"></button>'+
2940
+ '<div class="mejs-volume-slider">'+ // outer background
2941
+ '<div class="mejs-volume-total"></div>'+ // line background
2942
+ '<div class="mejs-volume-current"></div>'+ // current volume
2943
+ '<div class="mejs-volume-handle"></div>'+ // handle
2944
+ '</div>'+
2945
+ '</div>')
2946
+ .appendTo(controls),
2947
+ volumeSlider = t.container.find('.mejs-volume-slider, .mejs-horizontal-volume-slider'),
2948
+ volumeTotal = t.container.find('.mejs-volume-total, .mejs-horizontal-volume-total'),
2949
+ volumeCurrent = t.container.find('.mejs-volume-current, .mejs-horizontal-volume-current'),
2950
+ volumeHandle = t.container.find('.mejs-volume-handle, .mejs-horizontal-volume-handle'),
2951
+
2952
+ positionVolumeHandle = function(volume) {
2953
+
2954
+ if (!volumeSlider.is(':visible')) {
2955
+ volumeSlider.show();
2956
+ positionVolumeHandle(volume);
2957
+ volumeSlider.hide()
2958
+ return;
2959
+ }
2960
+
2961
+ // correct to 0-1
2962
+ volume = Math.max(0,volume);
2963
+ volume = Math.min(volume,1);
2964
+
2965
+ // ajust mute button style
2966
+ if (volume == 0) {
2967
+ mute.removeClass('mejs-mute').addClass('mejs-unmute');
2968
+ } else {
2969
+ mute.removeClass('mejs-unmute').addClass('mejs-mute');
2970
+ }
2971
+
2972
+ // position slider
2973
+ if (mode == 'vertical') {
2974
+ var
2975
+
2976
+ // height of the full size volume slider background
2977
+ totalHeight = volumeTotal.height(),
2978
+
2979
+ // top/left of full size volume slider background
2980
+ totalPosition = volumeTotal.position(),
2981
+
2982
+ // the new top position based on the current volume
2983
+ // 70% volume on 100px height == top:30px
2984
+ newTop = totalHeight - (totalHeight * volume);
2985
+
2986
+ // handle
2987
+ volumeHandle.css('top', totalPosition.top + newTop - (volumeHandle.height() / 2));
2988
+
2989
+ // show the current visibility
2990
+ volumeCurrent.height(totalHeight - newTop );
2991
+ volumeCurrent.css('top', totalPosition.top + newTop);
2992
+ } else {
2993
+ var
2994
+
2995
+ // height of the full size volume slider background
2996
+ totalWidth = volumeTotal.width(),
2997
+
2998
+ // top/left of full size volume slider background
2999
+ totalPosition = volumeTotal.position(),
3000
+
3001
+ // the new left position based on the current volume
3002
+ newLeft = totalWidth * volume;
3003
+
3004
+ // handle
3005
+ volumeHandle.css('left', totalPosition.left + newLeft - (volumeHandle.width() / 2));
3006
+
3007
+ // rezize the current part of the volume bar
3008
+ volumeCurrent.width( newLeft );
3009
+ }
3010
+ },
3011
+ handleVolumeMove = function(e) {
3012
+
3013
+ var volume = null,
3014
+ totalOffset = volumeTotal.offset();
3015
+
3016
+ // calculate the new volume based on the moust position
3017
+ if (mode == 'vertical') {
3018
+
3019
+ var
3020
+ railHeight = volumeTotal.height(),
3021
+ totalTop = parseInt(volumeTotal.css('top').replace(/px/,''),10),
3022
+ newY = e.pageY - totalOffset.top;
3023
+
3024
+ volume = (railHeight - newY) / railHeight;
3025
+
3026
+ // the controls just hide themselves (usually when mouse moves too far up)
3027
+ if (totalOffset.top == 0 || totalOffset.left == 0)
3028
+ return;
3029
+
3030
+ } else {
3031
+ var
3032
+ railWidth = volumeTotal.width(),
3033
+ newX = e.pageX - totalOffset.left;
3034
+
3035
+ volume = newX / railWidth;
3036
+ }
3037
+
3038
+ // ensure the volume isn't outside 0-1
3039
+ volume = Math.max(0,volume);
3040
+ volume = Math.min(volume,1);
3041
+
3042
+ // position the slider and handle
3043
+ positionVolumeHandle(volume);
3044
+
3045
+ // set the media object (this will trigger the volumechanged event)
3046
+ if (volume == 0) {
3047
+ media.setMuted(true);
3048
+ } else {
3049
+ media.setMuted(false);
3050
+ }
3051
+ media.setVolume(volume);
3052
+ },
3053
+ mouseIsDown = false,
3054
+ mouseIsOver = false;
3055
+
3056
+ // SLIDER
3057
+
3058
+ mute
3059
+ .hover(function() {
3060
+ volumeSlider.show();
3061
+ mouseIsOver = true;
3062
+ }, function() {
3063
+ mouseIsOver = false;
3064
+
3065
+ if (!mouseIsDown && mode == 'vertical') {
3066
+ volumeSlider.hide();
3067
+ }
3068
+ });
3069
+
3070
+ volumeSlider
3071
+ .bind('mouseover', function() {
3072
+ mouseIsOver = true;
3073
+ })
3074
+ .bind('mousedown', function (e) {
3075
+ handleVolumeMove(e);
3076
+ mouseIsDown = true;
3077
+
3078
+ return false;
3079
+ });
3080
+
3081
+ $(document)
3082
+ .bind('mouseup', function (e) {
3083
+ mouseIsDown = false;
3084
+
3085
+ if (!mouseIsOver && mode == 'vertical') {
3086
+ volumeSlider.hide();
3087
+ }
3088
+ })
3089
+ .bind('mousemove', function (e) {
3090
+ if (mouseIsDown) {
3091
+ handleVolumeMove(e);
3092
+ }
3093
+ });
3094
+
3095
+
3096
+ // MUTE button
3097
+ mute.find('button').click(function() {
3098
+ media.setMuted( !media.muted );
3099
+ });
3100
+
3101
+ // listen for volume change events from other sources
3102
+ media.addEventListener('volumechange', function(e) {
3103
+ if (!mouseIsDown) {
3104
+ if (media.muted) {
3105
+ positionVolumeHandle(0);
3106
+ mute.removeClass('mejs-mute').addClass('mejs-unmute');
3107
+ } else {
3108
+ positionVolumeHandle(media.volume);
3109
+ mute.removeClass('mejs-unmute').addClass('mejs-mute');
3110
+ }
3111
+ }
3112
+ }, false);
3113
+
3114
+ if (t.container.is(':visible')) {
3115
+ // set initial volume
3116
+ positionVolumeHandle(player.options.startVolume);
3117
+
3118
+ // shim gets the startvolume as a parameter, but we have to set it on the native <video> and <audio> elements
3119
+ if (media.pluginType === 'native') {
3120
+ media.setVolume(player.options.startVolume);
3121
+ }
3122
+ }
3123
+ }
3124
+ });
3125
+
3126
+ })(mejs.$);
3127
+
3128
  (function($) {
3129
 
3130
  $.extend(mejs.MepDefaults, {
3131
+ usePluginFullScreen: true,
3132
+ newWindowCallback: function() { return '';},
3133
+ fullscreenText: 'Fullscreen'
3134
  });
3135
 
3136
  $.extend(MediaElementPlayer.prototype, {
3137
 
3138
  isFullScreen: false,
3139
 
3140
+ isNativeFullScreen: false,
3141
+
3142
  docStyleOverflow: null,
3143
 
3144
  isInIframe: false,
3152
 
3153
  // native events
3154
  if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
 
 
3155
 
3156
+ // chrome doesn't alays fire this in an iframe
3157
+ player.container.bind(mejs.MediaFeatures.fullScreenEventName, function(e) {
3158
+ //player.container.bind('webkitfullscreenchange', function(e) {
3159
+
3160
+
3161
  if (mejs.MediaFeatures.isFullScreen()) {
3162
+ player.isNativeFullScreen = true;
3163
  // reset the controls once we are fully in full screen
3164
  player.setControlsSize();
3165
+ } else {
3166
+ player.isNativeFullScreen = false;
3167
  // when a user presses ESC
3168
  // make sure to put the player back into place
3169
  player.exitFullScreen();
3177
  container = player.container,
3178
  fullscreenBtn =
3179
  $('<div class="mejs-button mejs-fullscreen-button">' +
3180
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.fullscreenText + '"></button>' +
3181
  '</div>')
3182
+ .appendTo(controls);
3183
+
3184
+ if (t.media.pluginType === 'native' || (!t.options.usePluginFullScreen && !mejs.MediaFeatures.isFirefox)) {
3185
+
3186
+ fullscreenBtn.click(function() {
3187
  var isFullScreen = (mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || player.isFullScreen;
3188
 
3189
  if (isFullScreen) {
3192
  player.enterFullScreen();
3193
  }
3194
  });
3195
+
3196
+ } else {
3197
+
3198
+ var hideTimeout = null,
3199
+ supportsPointerEvents = (document.documentElement.style.pointerEvents === '');
3200
+
3201
+ if (supportsPointerEvents && !mejs.MediaFeatures.isOpera) { // opera doesn't allow this :(
3202
+
3203
+ // allows clicking through the fullscreen button and controls down directly to Flash
3204
+
3205
+ /*
3206
+ When a user puts his mouse over the fullscreen button, the controls are disabled
3207
+ So we put a div over the video and another one on iether side of the fullscreen button
3208
+ that caputre mouse movement
3209
+ and restore the controls once the mouse moves outside of the fullscreen button
3210
+ */
3211
+
3212
+ var fullscreenIsDisabled = false,
3213
+ restoreControls = function() {
3214
+ if (fullscreenIsDisabled) {
3215
+ // hide the hovers
3216
+ videoHoverDiv.hide();
3217
+ controlsLeftHoverDiv.hide();
3218
+ controlsRightHoverDiv.hide();
3219
+
3220
+ // restore the control bar
3221
+ fullscreenBtn.css('pointer-events', '');
3222
+ t.controls.css('pointer-events', '');
3223
+
3224
+ // store for later
3225
+ fullscreenIsDisabled = false;
3226
+ }
3227
+ },
3228
+ videoHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
3229
+ controlsLeftHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
3230
+ controlsRightHoverDiv = $('<div class="mejs-fullscreen-hover" />').appendTo(t.container).mouseover(restoreControls),
3231
+ positionHoverDivs = function() {
3232
+ var style = {position: 'absolute', top: 0, left: 0}; //, backgroundColor: '#f00'};
3233
+ videoHoverDiv.css(style);
3234
+ controlsLeftHoverDiv.css(style);
3235
+ controlsRightHoverDiv.css(style);
3236
+
3237
+ // over video, but not controls
3238
+ videoHoverDiv
3239
+ .width( t.container.width() )
3240
+ .height( t.container.height() - t.controls.height() );
3241
+
3242
+ // over controls, but not the fullscreen button
3243
+ var fullScreenBtnOffset = fullscreenBtn.offset().left - t.container.offset().left;
3244
+ fullScreenBtnWidth = fullscreenBtn.outerWidth(true);
3245
+
3246
+ controlsLeftHoverDiv
3247
+ .width( fullScreenBtnOffset )
3248
+ .height( t.controls.height() )
3249
+ .css({top: t.container.height() - t.controls.height()});
3250
+
3251
+ // after the fullscreen button
3252
+ controlsRightHoverDiv
3253
+ .width( t.container.width() - fullScreenBtnOffset - fullScreenBtnWidth )
3254
+ .height( t.controls.height() )
3255
+ .css({top: t.container.height() - t.controls.height(),
3256
+ left: fullScreenBtnOffset + fullScreenBtnWidth});
3257
+ };
3258
+
3259
+ $(document).resize(function() {
3260
+ positionHoverDivs();
3261
+ });
3262
+
3263
+ // on hover, kill the fullscreen button's HTML handling, allowing clicks down to Flash
3264
+ fullscreenBtn
3265
+ .mouseover(function() {
3266
+
3267
+ if (!t.isFullScreen) {
3268
+
3269
+ var buttonPos = fullscreenBtn.offset(),
3270
+ containerPos = player.container.offset();
3271
+
3272
+ // move the button in Flash into place
3273
+ media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, false);
3274
+
3275
+ // allows click through
3276
+ fullscreenBtn.css('pointer-events', 'none');
3277
+ t.controls.css('pointer-events', 'none');
3278
+
3279
+ // show the divs that will restore things
3280
+ videoHoverDiv.show();
3281
+ controlsRightHoverDiv.show();
3282
+ controlsLeftHoverDiv.show();
3283
+ positionHoverDivs();
3284
+
3285
+ fullscreenIsDisabled = true;
3286
+ }
3287
+
3288
+ });
3289
+
3290
+ // restore controls anytime the user enters or leaves fullscreen
3291
+ media.addEventListener('fullscreenchange', function(e) {
3292
+ restoreControls();
3293
+ });
3294
+
3295
+
3296
+ // the mouseout event doesn't work on the fullscren button, because we already killed the pointer-events
3297
+ // so we use the document.mousemove event to restore controls when the mouse moves outside the fullscreen button
3298
+ /*
3299
+ $(document).mousemove(function(e) {
3300
+
3301
+ // if the mouse is anywhere but the fullsceen button, then restore it all
3302
+ if (fullscreenIsDisabled) {
3303
+
3304
+ var fullscreenBtnPos = fullscreenBtn.offset();
3305
+
3306
+
3307
+ if (e.pageY < fullscreenBtnPos.top || e.pageY > fullscreenBtnPos.top + fullscreenBtn.outerHeight(true) ||
3308
+ e.pageX < fullscreenBtnPos.left || e.pageX > fullscreenBtnPos.left + fullscreenBtn.outerWidth(true)
3309
+ ) {
3310
+
3311
+ fullscreenBtn.css('pointer-events', '');
3312
+ t.controls.css('pointer-events', '');
3313
+
3314
+ fullscreenIsDisabled = false;
3315
+ }
3316
+ }
3317
+ });
3318
+ */
3319
+
3320
+
3321
+ } else {
3322
+
3323
+ // the hover state will show the fullscreen button in Flash to hover up and click
3324
+
3325
+ fullscreenBtn
3326
+ .mouseover(function() {
3327
+
3328
+ if (hideTimeout !== null) {
3329
+ clearTimeout(hideTimeout);
3330
+ delete hideTimeout;
3331
+ }
3332
+
3333
+ var buttonPos = fullscreenBtn.offset(),
3334
+ containerPos = player.container.offset();
3335
+
3336
+ media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top, true);
3337
+
3338
+ })
3339
+ .mouseout(function() {
3340
+
3341
+ if (hideTimeout !== null) {
3342
+ clearTimeout(hideTimeout);
3343
+ delete hideTimeout;
3344
+ }
3345
+
3346
+ hideTimeout = setTimeout(function() {
3347
+ media.hideFullscreenButton();
3348
+ }, 1500);
3349
+
3350
+
3351
+ });
3352
+ }
3353
+ }
3354
 
3355
  player.fullscreenBtn = fullscreenBtn;
3356
 
3365
 
3366
  var t = this;
3367
 
 
 
3368
  // firefox+flash can't adjust plugin sizes without resetting :(
3369
+ if (t.media.pluginType !== 'native' && (mejs.MediaFeatures.isFirefox || t.options.usePluginFullScreen)) {
3370
+ //t.media.setFullscreen(true);
3371
  //player.isFullScreen = true;
3372
  return;
3373
  }
3381
  normalHeight = t.container.height();
3382
  normalWidth = t.container.width();
3383
 
 
3384
  // attempt to do true fullscreen (Safari 5.1 and Firefox Nightly only for now)
3385
+ if (t.media.pluginType === 'native') {
3386
+ if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
3387
+
3388
+ mejs.MediaFeatures.requestFullScreen(t.container[0]);
3389
+ //return;
3390
+
3391
+ if (t.isInIframe) {
3392
+ // sometimes exiting from fullscreen doesn't work
3393
+ // notably in Chrome <iframe>. Fixed in version 17
3394
+ setTimeout(function checkFullscreen() {
3395
+
3396
+ if (t.isNativeFullScreen) {
3397
+
3398
+ // check if the video is suddenly not really fullscreen
3399
+ if ($(window).width() !== screen.width) {
3400
+ // manually exit
3401
+ t.exitFullScreen();
3402
+ } else {
3403
+ // test again
3404
+ setTimeout(checkFullscreen, 500);
3405
+ }
3406
+ }
3407
+
3408
+
3409
+ }, 500);
3410
+ }
3411
+
3412
+ } else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
3413
+ t.media.webkitEnterFullscreen();
3414
+ return;
3415
+ }
3416
  }
3417
 
3418
  // check for iframe launch
3419
+ if (t.isInIframe) {
 
 
3420
  var url = t.options.newWindowCallback(this);
3421
+
3422
+
3423
  if (url !== '') {
3424
+
3425
+ // launch immediately
3426
+ if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
3427
+ t.pause();
3428
+ window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
3429
+ return;
3430
+ } else {
3431
+ setTimeout(function() {
3432
+ if (!t.isNativeFullScreen) {
3433
+ t.pause();
3434
+ window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
3435
+ }
3436
+ }, 250);
3437
+ }
3438
  }
3439
+
3440
  }
3441
 
3442
  // full window code
3443
+
3444
 
3445
 
3446
  // make full size
3449
  .width('100%')
3450
  .height('100%');
3451
  //.css({position: 'fixed', left: 0, top: 0, right: 0, bottom: 0, overflow: 'hidden', width: '100%', height: '100%', 'z-index': 1000});
3452
+
3453
+ // Only needed for safari 5.1 native full screen, can cause display issues elsewhere
3454
+ // Actually, it seems to be needed for IE8, too
3455
+ //if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
3456
+ setTimeout(function() {
3457
+ t.container.css({width: '100%', height: '100%'});
3458
+ t.setControlsSize();
3459
+ }, 500);
3460
+ //}
3461
 
3462
  if (t.pluginType === 'native') {
3463
  t.$media
3464
  .width('100%')
3465
  .height('100%');
3466
  } else {
3467
+ t.container.find('object, embed, iframe')
3468
  .width('100%')
3469
  .height('100%');
3470
+
3471
+ //if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
3472
+ t.media.setVideoSize($(window).width(),$(window).height());
3473
+ //}
3474
  }
3475
 
3476
  t.layers.children('div')
3509
  t.container
3510
  .removeClass('mejs-container-fullscreen')
3511
  .width(normalWidth)
3512
+ .height(normalHeight);
 
3513
  //.css({position: '', left: '', top: '', right: '', bottom: '', overflow: 'inherit', width: normalWidth + 'px', height: normalHeight + 'px', 'z-index': 1});
3514
 
3515
  if (t.pluginType === 'native') {
3538
  });
3539
 
3540
  })(mejs.$);
3541
+
3542
+ (function($) {
3543
+
3544
+ // add extra default options
3545
+ $.extend(mejs.MepDefaults, {
3546
+ // this will automatically turn on a <track>
3547
+ startLanguage: '',
3548
+
3549
+ tracksText: 'Captions/Subtitles'
3550
+ });
3551
+
3552
+ $.extend(MediaElementPlayer.prototype, {
3553
+
3554
+ hasChapters: false,
3555
+
3556
+ buildtracks: function(player, controls, layers, media) {
3557
+ if (!player.isVideo)
3558
+ return;
3559
+
3560
+ if (player.tracks.length == 0)
3561
+ return;
3562
+
3563
+ var t= this, i, options = '';
3564
+
3565
+ player.chapters =
3566
+ $('<div class="mejs-chapters mejs-layer"></div>')
3567
+ .prependTo(layers).hide();
3568
+ player.captions =
3569
+ $('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position"><span class="mejs-captions-text"></span></div></div>')
3570
+ .prependTo(layers).hide();
3571
+ player.captionsText = player.captions.find('.mejs-captions-text');
3572
+ player.captionsButton =
3573
+ $('<div class="mejs-button mejs-captions-button">'+
3574
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.tracksText + '"></button>'+
3575
+ '<div class="mejs-captions-selector">'+
3576
+ '<ul>'+
3577
+ '<li>'+
3578
+ '<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
3579
+ '<label for="' + player.id + '_captions_none">None</label>'+
3580
+ '</li>' +
3581
+ '</ul>'+
3582
+ '</div>'+
3583
+ '</div>')
3584
+ .appendTo(controls)
3585
+
3586
+ // hover
3587
+ .hover(function() {
3588
+ $(this).find('.mejs-captions-selector').css('visibility','visible');
3589
+ }, function() {
3590
+ $(this).find('.mejs-captions-selector').css('visibility','hidden');
3591
+ })
3592
+
3593
+ // handle clicks to the language radio buttons
3594
+ .delegate('input[type=radio]','click',function() {
3595
+ lang = this.value;
3596
+
3597
+ if (lang == 'none') {
3598
+ player.selectedTrack = null;
3599
+ } else {
3600
+ for (i=0; i<player.tracks.length; i++) {
3601
+ if (player.tracks[i].srclang == lang) {
3602
+ player.selectedTrack = player.tracks[i];
3603
+ player.captions.attr('lang', player.selectedTrack.srclang);
3604
+ player.displayCaptions();
3605
+ break;
3606
+ }
3607
+ }
3608
+ }
3609
+ });
3610
+ //.bind('mouseenter', function() {
3611
+ // player.captionsButton.find('.mejs-captions-selector').css('visibility','visible')
3612
+ //});
3613
+
3614
+ if (!player.options.alwaysShowControls) {
3615
+ // move with controls
3616
+ player.container
3617
+ .bind('mouseenter', function () {
3618
+ // push captions above controls
3619
+ player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
3620
+
3621
+ })
3622
+ .bind('mouseleave', function () {
3623
+ if (!media.paused) {
3624
+ // move back to normal place
3625
+ player.container.find('.mejs-captions-position').removeClass('mejs-captions-position-hover');
3626
+ }
3627
+ });
3628
+ } else {
3629
+ player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
3630
+ }
3631
+
3632
+ player.trackToLoad = -1;
3633
+ player.selectedTrack = null;
3634
+ player.isLoadingTrack = false;
3635
+
3636
+
3637
+
3638
+ // add to list
3639
+ for (i=0; i<player.tracks.length; i++) {
3640
+ if (player.tracks[i].kind == 'subtitles') {
3641
+ player.addTrackButton(player.tracks[i].srclang, player.tracks[i].label);
3642
+ }
3643
+ }
3644
+
3645
+ player.loadNextTrack();
3646
+
3647
+
3648
+ media.addEventListener('timeupdate',function(e) {
3649
+ player.displayCaptions();
3650
+ }, false);
3651
+
3652
+ media.addEventListener('loadedmetadata', function(e) {
3653
+ player.displayChapters();
3654
+ }, false);
3655
+
3656
+ player.container.hover(
3657
+ function () {
3658
+ // chapters
3659
+ if (player.hasChapters) {
3660
+ player.chapters.css('visibility','visible');
3661
+ player.chapters.fadeIn(200);
3662
+ }
3663
+ },
3664
+ function () {
3665
+ if (player.hasChapters && !media.paused) {
3666
+ player.chapters.fadeOut(200, function() {
3667
+ $(this).css('visibility','hidden');
3668
+ $(this).css('display','block');
3669
+ });
3670
+ }
3671
+ });
3672
+
3673
+ // check for autoplay
3674
+ if (player.node.getAttribute('autoplay') !== null) {
3675
+ player.chapters.css('visibility','hidden');
3676
+ }
3677
+ },
3678
+
3679
+ loadNextTrack: function() {
3680
+ var t = this;
3681
+
3682
+ t.trackToLoad++;
3683
+ if (t.trackToLoad < t.tracks.length) {
3684
+ t.isLoadingTrack = true;
3685
+ t.loadTrack(t.trackToLoad);
3686
+ } else {
3687
+ // add done?
3688
+ t.isLoadingTrack = false;
3689
+ }
3690
+ },
3691
+
3692
+ loadTrack: function(index){
3693
+ var
3694
+ t = this,
3695
+ track = t.tracks[index],
3696
+ after = function() {
3697
+
3698
+ track.isLoaded = true;
3699
+
3700
+ // create button
3701
+ //t.addTrackButton(track.srclang);
3702
+ t.enableTrackButton(track.srclang, track.label);
3703
+
3704
+ t.loadNextTrack();
3705
+
3706
+ };
3707
+
3708
+ if (track.isTranslation) {
3709
+
3710
+ // translate the first track
3711
+ mejs.TrackFormatParser.translateTrackText(t.tracks[0].entries, t.tracks[0].srclang, track.srclang, t.options.googleApiKey, function(newOne) {
3712
+
3713
+ // store the new translation
3714
+ track.entries = newOne;
3715
+
3716
+ after();
3717
+ });
3718
+
3719
+ } else {
3720
+ $.ajax({
3721
+ url: track.src,
3722
+ success: function(d) {
3723
+
3724
+ // parse the loaded file
3725
+ track.entries = mejs.TrackFormatParser.parse(d);
3726
+ after();
3727
+
3728
+ if (track.kind == 'chapters' && t.media.duration > 0) {
3729
+ t.drawChapters(track);
3730
+ }
3731
+ },
3732
+ error: function() {
3733
+ t.loadNextTrack();
3734
+ }
3735
+ });
3736
+ }
3737
+ },
3738
+
3739
+ enableTrackButton: function(lang, label) {
3740
+ var t = this;
3741
+
3742
+ if (label === '') {
3743
+ label = mejs.language.codes[lang] || lang;
3744
+ }
3745
+
3746
+ t.captionsButton
3747
+ .find('input[value=' + lang + ']')
3748
+ .prop('disabled',false)
3749
+ .siblings('label')
3750
+ .html( label );
3751
+
3752
+ // auto select
3753
+ if (t.options.startLanguage == lang) {
3754
+ $('#' + t.id + '_captions_' + lang).click();
3755
+ }
3756
+
3757
+ t.adjustLanguageBox();
3758
+ },
3759
+
3760
+ addTrackButton: function(lang, label) {
3761
+ var t = this;
3762
+ if (label === '') {
3763
+ label = mejs.language.codes[lang] || lang;
3764
+ }
3765
+
3766
+ t.captionsButton.find('ul').append(
3767
+ $('<li>'+
3768
+ '<input type="radio" name="' + t.id + '_captions" id="' + t.id + '_captions_' + lang + '" value="' + lang + '" disabled="disabled" />' +
3769
+ '<label for="' + t.id + '_captions_' + lang + '">' + label + ' (loading)' + '</label>'+
3770
+ '</li>')
3771
+ );
3772
+
3773
+ t.adjustLanguageBox();
3774
+
3775
+ // remove this from the dropdownlist (if it exists)
3776
+ t.container.find('.mejs-captions-translations option[value=' + lang + ']').remove();
3777
+ },
3778
+
3779
+ adjustLanguageBox:function() {
3780
+ var t = this;
3781
+ // adjust the size of the outer box
3782
+ t.captionsButton.find('.mejs-captions-selector').height(
3783
+ t.captionsButton.find('.mejs-captions-selector ul').outerHeight(true) +
3784
+ t.captionsButton.find('.mejs-captions-translations').outerHeight(true)
3785
+ );
3786
+ },
3787
+
3788
+ displayCaptions: function() {
3789
+
3790
+ if (typeof this.tracks == 'undefined')
3791
+ return;
3792
+
3793
+ var
3794
+ t = this,
3795
+ i,
3796
+ track = t.selectedTrack;
3797
+
3798
+ if (track != null && track.isLoaded) {
3799
+ for (i=0; i<track.entries.times.length; i++) {
3800
+ if (t.media.currentTime >= track.entries.times[i].start && t.media.currentTime <= track.entries.times[i].stop){
3801
+ t.captionsText.html(track.entries.text[i]);
3802
+ t.captions.show();
3803
+ return; // exit out if one is visible;
3804
+ }
3805
+ }
3806
+ t.captions.hide();
3807
+ } else {
3808
+ t.captions.hide();
3809
+ }
3810
+ },
3811
+
3812
+ displayChapters: function() {
3813
+ var
3814
+ t = this,
3815
+ i;
3816
+
3817
+ for (i=0; i<t.tracks.length; i++) {
3818
+ if (t.tracks[i].kind == 'chapters' && t.tracks[i].isLoaded) {
3819
+ t.drawChapters(t.tracks[i]);
3820
+ t.hasChapters = true;
3821
+ break;
3822
+ }
3823
+ }
3824
+ },
3825
+
3826
+ drawChapters: function(chapters) {
3827
+ var
3828
+ t = this,
3829
+ i,
3830
+ dur,
3831
+ //width,
3832
+ //left,
3833
+ percent = 0,
3834
+ usedPercent = 0;
3835
+
3836
+ t.chapters.empty();
3837
+
3838
+ for (i=0; i<chapters.entries.times.length; i++) {
3839
+ dur = chapters.entries.times[i].stop - chapters.entries.times[i].start;
3840
+ percent = Math.floor(dur / t.media.duration * 100);
3841
+ if (percent + usedPercent > 100 || // too large
3842
+ i == chapters.entries.times.length-1 && percent + usedPercent < 100) // not going to fill it in
3843
+ {
3844
+ percent = 100 - usedPercent;
3845
+ }
3846
+ //width = Math.floor(t.width * dur / t.media.duration);
3847
+ //left = Math.floor(t.width * chapters.entries.times[i].start / t.media.duration);
3848
+ //if (left + width > t.width) {
3849
+ // width = t.width - left;
3850
+ //}
3851
+
3852
+ t.chapters.append( $(
3853
+ '<div class="mejs-chapter" rel="' + chapters.entries.times[i].start + '" style="left: ' + usedPercent.toString() + '%;width: ' + percent.toString() + '%;">' +
3854
+ '<div class="mejs-chapter-block' + ((i==chapters.entries.times.length-1) ? ' mejs-chapter-block-last' : '') + '">' +
3855
+ '<span class="ch-title">' + chapters.entries.text[i] + '</span>' +
3856
+ '<span class="ch-time">' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].start) + '&ndash;' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].stop) + '</span>' +
3857
+ '</div>' +
3858
+ '</div>'));
3859
+ usedPercent += percent;
3860
+ }
3861
+
3862
+ t.chapters.find('div.mejs-chapter').click(function() {
3863
+ t.media.setCurrentTime( parseFloat( $(this).attr('rel') ) );
3864
+ if (t.media.paused) {
3865
+ t.media.play();
3866
+ }
3867
+ });
3868
+
3869
+ t.chapters.show();
3870
+ }
3871
+ });
3872
+
3873
+
3874
+
3875
+ mejs.language = {
3876
+ codes: {
3877
+ af:'Afrikaans',
3878
+ sq:'Albanian',
3879
+ ar:'Arabic',
3880
+ be:'Belarusian',
3881
+ bg:'Bulgarian',
3882
+ ca:'Catalan',
3883
+ zh:'Chinese',
3884
+ 'zh-cn':'Chinese Simplified',
3885
+ 'zh-tw':'Chinese Traditional',
3886
+ hr:'Croatian',
3887
+ cs:'Czech',
3888
+ da:'Danish',
3889
+ nl:'Dutch',
3890
+ en:'English',
3891
+ et:'Estonian',
3892
+ tl:'Filipino',
3893
+ fi:'Finnish',
3894
+ fr:'French',
3895
+ gl:'Galician',
3896
+ de:'German',
3897
+ el:'Greek',
3898
+ ht:'Haitian Creole',
3899
+ iw:'Hebrew',
3900
+ hi:'Hindi',
3901
+ hu:'Hungarian',
3902
+ is:'Icelandic',
3903
+ id:'Indonesian',
3904
+ ga:'Irish',
3905
+ it:'Italian',
3906
+ ja:'Japanese',
3907
+ ko:'Korean',
3908
+ lv:'Latvian',
3909
+ lt:'Lithuanian',
3910
+ mk:'Macedonian',
3911
+ ms:'Malay',
3912
+ mt:'Maltese',
3913
+ no:'Norwegian',
3914
+ fa:'Persian',
3915
+ pl:'Polish',
3916
+ pt:'Portuguese',
3917
+ //'pt-pt':'Portuguese (Portugal)',
3918
+ ro:'Romanian',
3919
+ ru:'Russian',
3920
+ sr:'Serbian',
3921
+ sk:'Slovak',
3922
+ sl:'Slovenian',
3923
+ es:'Spanish',
3924
+ sw:'Swahili',
3925
+ sv:'Swedish',
3926
+ tl:'Tagalog',
3927
+ th:'Thai',
3928
+ tr:'Turkish',
3929
+ uk:'Ukrainian',
3930
+ vi:'Vietnamese',
3931
+ cy:'Welsh',
3932
+ yi:'Yiddish'
3933
+ }
3934
+ };
3935
+
3936
+ /*
3937
+ Parses WebVVT format which should be formatted as
3938
+ ================================
3939
+ WEBVTT
3940
+
3941
+ 1
3942
+ 00:00:01,1 --> 00:00:05,000
3943
+ A line of text
3944
+
3945
+ 2
3946
+ 00:01:15,1 --> 00:02:05,000
3947
+ A second line of text
3948
+
3949
+ ===============================
3950
+
3951
+ Adapted from: http://www.delphiki.com/html5/playr
3952
+ */
3953
+ mejs.TrackFormatParser = {
3954
+ // match start "chapter-" (or anythingelse)
3955
+ pattern_identifier: /^([a-zA-z]+-)?[0-9]+$/,
3956
+ 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})?)(.*)$/,
3957
+
3958
+ split2: function (text, regex) {
3959
+ // normal version for compliant browsers
3960
+ // see below for IE fix
3961
+ return text.split(regex);
3962
+ },
3963
+ parse: function(trackText) {
3964
+ var
3965
+ i = 0,
3966
+ lines = this.split2(trackText, /\r?\n/),
3967
+ entries = {text:[], times:[]},
3968
+ timecode,
3969
+ text;
3970
+
3971
+ for(; i<lines.length; i++) {
3972
+ // check for the line number
3973
+ if (this.pattern_identifier.exec(lines[i])){
3974
+ // skip to the next line where the start --> end time code should be
3975
+ i++;
3976
+ timecode = this.pattern_timecode.exec(lines[i]);
3977
+
3978
+ if (timecode && i<lines.length){
3979
+ i++;
3980
+ // grab all the (possibly multi-line) text that follows
3981
+ text = lines[i];
3982
+ i++;
3983
+ while(lines[i] !== '' && i<lines.length){
3984
+ text = text + '\n' + lines[i];
3985
+ i++;
3986
+ }
3987
+
3988
+ // Text is in a different array so I can use .join
3989
+ entries.text.push(text);
3990
+ entries.times.push(
3991
+ {
3992
+ start: mejs.Utility.timeCodeToSeconds(timecode[1]),
3993
+ stop: mejs.Utility.timeCodeToSeconds(timecode[3]),
3994
+ settings: timecode[5]
3995
+ });
3996
+ }
3997
+ }
3998
+ }
3999
+
4000
+ return entries;
4001
+ }
4002
+ };
4003
+
4004
+ // test for browsers with bad String.split method.
4005
+ if ('x\n\ny'.split(/\n/gi).length != 3) {
4006
+ // add super slow IE8 and below version
4007
+ mejs.TrackFormatParser.split2 = function(text, regex) {
4008
+ var
4009
+ parts = [],
4010
+ chunk = '',
4011
+ i;
4012
+
4013
+ for (i=0; i<text.length; i++) {
4014
+ chunk += text.substring(i,i+1);
4015
+ if (regex.test(chunk)) {
4016
+ parts.push(chunk.replace(regex, ''));
4017
+ chunk = '';
4018
+ }
4019
+ }
4020
+ parts.push(chunk);
4021
+ return parts;
4022
+ }
4023
+ }
4024
+
4025
+ })(mejs.$);
4026
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4027
  /*
4028
  * ContextMenu Plugin
4029
  *
4216
  }
4217
  });
4218
 
4219
+ })(mejs.$);
4220
+
mediaelement/mediaelement-and-player.min.js CHANGED
@@ -1,124 +1,147 @@
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.2.5";mejs.meIndex=0;mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mpeg"]}]};
14
- mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&amp;").split("<").join("&lt;").split('"').join("&quot;")},absolutizeUrl:function(a){var b=document.createElement("div");b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>';return b.firstChild.href},getScriptPath:function(a){for(var b=0,c,d="",e="",g,f=document.getElementsByTagName("script");b<f.length;b++){g=f[b].src;for(c=0;c<a.length;c++){e=a[c];if(g.indexOf(e)>-1){d=g.substring(0,
15
- g.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,g=Math.floor(a/60)%60,f=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(g<10?"0"+g:g)+":"+(f<10?"0"+f:f)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;a=a.split(":");b=parseInt(a[0]);var e=parseInt(a[1]),
16
- g=parseInt(a[2]),f=0,j=0;if(c)f=parseInt(a[3])/d;return j=b*3600+e*60+g+f}};
17
- 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],g;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
18
- !(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(g=new ActiveXObject(c))e=d(g)}catch(f){}return e}};
19
- 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});
20
- 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,g,f){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[g]+=f;e[g]-=f};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});
21
- mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,g=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isGecko=d.match(/gecko/gi)!==
22
- null;a.isWebkit=d.match(/webkit/gi)!==null;for(c=0;c<g.length;c++)e=document.createElement(g[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";a.hasMozNativeFullScreen=typeof e.mozRequestFullScreen!=="undefined";a.hasTrueNativeFullScreen=a.hasWebkitNativeFullScreen||a.hasMozNativeFullScreen;if(this.isChrome)a.hasSemiNativeFullScreen=
23
- false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;else if(e.webkitRequestFullScreen)return b.webkitIsFullScreen};a.requestFullScreen=function(f){if(a.hasWebkitNativeFullScreen)f.webkitRequestFullScreen();else a.hasMozNativeFullScreen&&f.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();
24
- else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
25
- 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){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if(typeof a=="string")this.src=a;else{var 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}};
26
- mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={}};
27
- 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=
28
- 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=
29
- 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=
30
- 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)},enterFullScreen:function(){this.setFullscreen(true)},enterFullScreen:function(){this.setFullscreen(false)},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]=
31
- [];return true}for(i=0;i<c.length;i++)if(c[i]===b){this.events[a].splice(i,1);return true}return false},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)}}};
32
- 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,
33
- 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)}};
34
- 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,startVolume:0.8,success:function(){},error:function(){}};
35
- mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
36
- mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),g=e==="audio"||e==="video",f=g?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var j=d.getAttribute("autoplay"),h=d.getAttribute("preload"),l=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];f=f=="undefined"||f==""||f===null?null:f;e=typeof e=="undefined"||e===null?"":e;h=typeof h=="undefined"||h===null||h==="false"?"none":
37
- h;j=!(typeof j=="undefined"||j===null||j==="false");l=!(typeof l=="undefined"||l===null||l==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,g,f);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},true)}return this.updateNative(k,c,j,h)}else if(k.method!=="")return this.createPlugin(k,c,e,j,h,l);else this.createErrorMessage(k,c,e)},determinePlayback:function(a,
38
- b,c,d,e){var g=[],f,j,h={method:"",url:"",htmlMediaElement:a,isVideo:a.tagName.toLowerCase()!="audio"},l,k;if(typeof b.type!="undefined"&&b.type!=="")if(typeof b.type=="string")g.push({type:b.type,url:e});else for(f=0;f<b.type.length;f++)g.push({type:b.type[f],url:e});else if(e!==null){j=this.formatType(e,a.getAttribute("type"));g.push({type:j,url:e})}else for(f=0;f<a.childNodes.length;f++){j=a.childNodes[f];if(j.nodeType==1&&j.tagName.toLowerCase()=="source"){e=j.getAttribute("src");j=this.formatType(e,
39
- j.getAttribute("type"));g.push({type:j,url:e})}}if(!d&&g.length>0&&g[0].url!==null&&this.getTypeFromFile(g[0].url).indexOf("audio")>-1)h.isVideo=false;if(mejs.MediaFeatures.isBustedAndroid)a.canPlayType=function(m){return m.match(/video\/(mp4|m4v)/gi)!==null?"maybe":""};if(c&&(b.mode==="auto"||b.mode==="native")){if(!d){f=document.createElement(h.isVideo?"video":"audio");a.parentNode.insertBefore(f,a);a.style.display="none";h.htmlMediaElement=a=f}for(f=0;f<g.length;f++)if(a.canPlayType(g[f].type).replace(/no/,
40
- "")!==""||a.canPlayType(g[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){h.method="native";h.url=g[f].url;break}if(h.method==="native"){if(h.url!==null)a.src=h.url;return h}}if(b.mode==="auto"||b.mode==="shim")for(f=0;f<g.length;f++){j=g[f].type;for(a=0;a<b.plugins.length;a++){e=b.plugins[a];l=mejs.plugins[e];for(c=0;c<l.length;c++){k=l[c];if(mejs.PluginDetector.hasPluginVersion(e,k.version))for(d=0;d<k.types.length;d++)if(j==k.types[d]){h.method=e;h.url=g[f].url;return h}}}}if(h.method===
41
- "")h.url=g[0].url;return h},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},getTypeFromFile:function(a){a=a.substring(a.lastIndexOf(".")+1);return(/(mp4|m4v|ogg|ogv|webm|flv|wmv|mpeg|mov)/gi.test(a)?"video":"audio")+"/"+a},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className="me-cannotplay";try{e.style.width=d.width+"px";e.style.height=d.height+"px"}catch(g){}e.innerHTML=c!==""?'<a href="'+
42
- a.url+'"><img src="'+c+'" /></a>':'<a href="'+a.url+'"><span>Download File</span></a>';d.parentNode.insertBefore(e,d);d.style.display="none";b.error(d)},createPlugin:function(a,b,c,d,e,g){c=a.htmlMediaElement;var f=1,j=1,h="me_"+a.method+"_"+mejs.meIndex++,l=new mejs.PluginMediaElement(h,a.method,a.url),k=document.createElement("div"),m;for(m=c.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);break}m=
43
- m.parentNode}if(a.isVideo){f=b.videoWidth>0?b.videoWidth:c.getAttribute("width")!==null?c.getAttribute("width"):b.defaultVideoWidth;j=b.videoHeight>0?b.videoHeight:c.getAttribute("height")!==null?c.getAttribute("height"):b.defaultVideoHeight;f=mejs.Utility.encodeUrl(f);j=mejs.Utility.encodeUrl(j)}else if(b.enablePluginDebug){f=320;j=240}l.success=b.success;mejs.MediaPluginBridge.registerPluginElement(h,l,c);k.className="me-plugin";c.parentNode.insertBefore(k,c);d=["id="+h,"isvideo="+(a.isVideo?"true":
44
- "false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+f,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"height="+j];if(a.url!==null)a.method=="flash"?d.push("file="+mejs.Utility.encodeUrl(a.url)):d.push("file="+a.url);b.enablePluginDebug&&d.push("debug=true");b.enablePluginSmoothing&&d.push("smoothing=true");g&&d.push("controls=true");switch(a.method){case "silverlight":k.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+h+'" name="'+
45
- h+'" width="'+f+'" height="'+j+'"><param name="initParams" value="'+d.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){a=document.createElement("div");k.appendChild(a);a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+
46
- h+'" width="'+f+'" height="'+j+'"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+d.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 k.innerHTML='<embed id="'+h+'" name="'+h+'" 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="'+
47
- b.pluginPath+b.flashName+'" flashvars="'+d.join("&")+'" width="'+f+'" height="'+j+'"></embed>'}c.style.display="none";return l},updateNative:function(a,b){var c=a.htmlMediaElement,d;for(d in mejs.HtmlMediaElement)c[d]=mejs.HtmlMediaElement[d];b.success(c,c);return c}};window.mejs=mejs;window.MediaElement=mejs.MediaElement;
48
-
49
- /*!
50
- * MediaElementPlayer
51
- * http://mediaelementjs.com/
52
- *
53
- * Creates a controller bar for HTML5 <video> add <audio> tags
54
- * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
55
- *
56
- * Copyright 2010-2011, John Dyer (http://j.hn/)
57
- * Dual licensed under the MIT or GPL Version 2 licenses.
58
- *
59
- */if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
60
- (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,showTimecodeFrameCount:false,framesPerSecond:25,alwaysShowControls:false,iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:true};mejs.mepIndex=0;mejs.MediaElementPlayer=
61
- function(a,c){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,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.options=f.extend({},mejs.MepDefaults,c);this.init();return this};mejs.MediaElementPlayer.prototype={init:function(){var a=this,c=mejs.MediaFeatures,b=f.extend(true,{},a.options,{success:function(e,h){a.meReady(e,h)},error:function(e){a.handleError(e)}}),
62
- d=a.media.tagName.toLowerCase();a.isDynamic=d!=="audio"&&d!=="video";a.isVideo=a.isDynamic?a.options.isVideo:d!=="audio"&&a.options.isVideo;if(c.isiPad&&a.options.iPadUseNativeControls||c.isiPhone&&a.options.iPhoneUseNativeControls){a.$media.attr("controls","controls");a.$media.removeAttr("poster");if(c.isiPad&&a.media.getAttribute("autoplay")!==null){a.media.load();a.media.play()}}else if(!(c.isAndroid&&a.AndroidUseNativeControls)){a.$media.removeAttr("controls");a.id="mep_"+mejs.mepIndex++;a.container=
63
- 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);if(c.isiPad||c.isiPhone){c=a.$media.clone();a.container.find(".mejs-mediaelement").append(c);a.$media.remove();a.$node=a.$media=c;a.node=a.media=c[0]}else a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");
64
- 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,a.height);b.pluginWidth=a.height;b.pluginHeight=a.width}mejs.MediaElement(a.$media[0],
65
- b)},controlsAreVisible:true,showControls:function(a){var c=this;a=typeof a=="undefined"||a;if(!c.controlsAreVisible){if(a){c.controls.css("visibility","visible").stop(true,true).fadeIn(200,function(){c.controlsAreVisible=true});c.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){c.controlsAreVisible=true})}else{c.controls.css("visibility","visible").css("display","block");c.container.find(".mejs-control").css("visibility","visible").css("display","block");
66
- c.controlsAreVisible=true}c.setControlsSize()}},hideControls:function(a){var c=this;a=typeof a=="undefined"||a;if(c.controlsAreVisible)if(a){c.controls.stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block");c.controlsAreVisible=false});c.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block")})}else{c.controls.css("visibility","hidden").css("display","block");c.container.find(".mejs-control").css("visibility",
67
- "hidden").css("display","block");c.controlsAreVisible=false}},controlsTimer:null,startControlsTimer:function(a){var c=this;a=typeof a!="undefined"?a:500;c.killControlsTimer("start");c.controlsTimer=setTimeout(function(){c.hideControls();c.killControlsTimer("hide")},a)},killControlsTimer:function(){if(this.controlsTimer!==null){clearTimeout(this.controlsTimer);delete this.controlsTimer;this.controlsTimer=null}},controlsEnabled:true,disableControls:function(){this.killControlsTimer();this.hideControls(false);
68
- this.controlsEnabled=false},enableControls:function(){this.showControls(false);this.controlsEnabled=true},meReady:function(a,c){var b=this,d=mejs.MediaFeatures,e=c.getAttribute("autoplay");e=!(typeof e=="undefined"||e===null||e==="false");var h;if(!b.created){b.created=true;b.media=a;b.domNode=c;if(!(d.isAndroid&&b.options.AndroidUseNativeControls)&&!(d.isiPad&&b.options.iPadUseNativeControls)&&!(d.isiPhone&&b.options.iPhoneUseNativeControls)){b.buildposter(b,b.controls,b.layers,b.media);b.buildoverlays(b,
69
- b.controls,b.layers,b.media);b.findTracks();for(h in b.options.features){d=b.options.features[h];if(b["build"+d])try{b["build"+d](b,b.controls,b.layers,b.media)}catch(j){}}b.container.trigger("controlsready");b.setPlayerSize(b.width,b.height);b.setControlsSize();if(b.isVideo){b.media.pluginType=="native"?b.$media.click(function(){a.paused?a.play():a.pause()}):f(b.media.pluginElement).click(function(){a.paused?a.play():a.pause()});b.container.bind("mouseenter mouseover",function(){if(b.controlsEnabled)if(!b.options.alwaysShowControls){b.killControlsTimer("enter");
70
- b.showControls();b.startControlsTimer(2500)}}).bind("mousemove",function(){if(b.controlsEnabled){b.controlsAreVisible||b.showControls();b.startControlsTimer(2500)}}).bind("mouseleave",function(){b.controlsEnabled&&!b.media.paused&&!b.options.alwaysShowControls&&b.startControlsTimer(1E3)});e&&!b.options.alwaysShowControls&&b.hideControls();b.options.enableAutosize&&b.media.addEventListener("loadedmetadata",function(i){if(b.options.videoHeight<=0&&b.domNode.getAttribute("height")===null&&!isNaN(i.target.videoHeight)){b.setPlayerSize(i.target.videoWidth,
71
- i.target.videoHeight);b.setControlsSize();b.media.setVideoSize(i.target.videoWidth,i.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();else!b.options.alwaysShowControls&&b.controlsEnabled&&b.showControls()},true);b.media.addEventListener("loadedmetadata",function(){b.updateDuration&&b.updateDuration();b.updateCurrent&&b.updateCurrent();
72
- b.setPlayerSize(b.width,b.height);b.setControlsSize()},true);setTimeout(function(){b.setPlayerSize(b.width,b.height);b.setControlsSize()},50);f(window).resize(function(){b.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||b.setPlayerSize(b.width,b.height);b.setControlsSize()})}if(e&&a.pluginType=="native"){a.load();a.play()}b.options.success&&b.options.success(b.media,b.domNode,b)}},handleError:function(a){this.controls.hide();this.options.error&&this.options.error(a)},
73
- setPlayerSize:function(){if(this.height.toString().indexOf("%")>0){var a=this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.options.defaultVideoWidth,c=this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.options.defaultVideoHeight,b=this.container.parent().width();a=parseInt(b*c/a,10);if(this.container.parent()[0].tagName.toLowerCase()==="body"){b=f(window).width();a=f(window).height()}this.container.width(b).height(a);this.$media.width("100%").height("100%");
74
- this.container.find("object embed").width("100%").height("100%");this.media.setVideoSize&&this.media.setVideoSize(b,a);this.layers.children(".mejs-layer").width("100%").height("100%")}else{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");
75
- others=b.siblings();others.each(function(){if(f(this).css("position")!="absolute")a+=f(this).outerWidth(true)});c=this.controls.width()-a-(b.outerWidth(true)-b.outerWidth(false));b.width(c);d.width(c-(d.outerWidth(true)-d.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},buildposter:function(a,c,b,d){var e=f('<div class="mejs-poster mejs-layer"></div>').appendTo(b);c=a.$media.attr("poster");if(a.options.poster!=="")c=a.options.poster;c!==""&&c!=null?
76
- this.setPoster(c):e.hide();d.addEventListener("play",function(){e.hide()},false)},setPoster:function(a){var c=this.container.find(".mejs-poster"),b=c.find("img");if(b.length==0)b=f('<img width="100%" height="100%" />').appendTo(c);b.attr("src",a)},buildoverlays:function(a,c,b,d){if(a.isVideo){var e=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(b),h=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(b),
77
- j=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()});if(mejs.MediaFeatures.isiOS||mejs.MediaFeatures.isAndroid){j.remove();e.remove()}d.addEventListener("play",function(){j.hide();h.hide()},false);d.addEventListener("pause",function(){j.show()},false);d.addEventListener("loadeddata",function(){e.show()},false);d.addEventListener("canplay",function(){e.hide()},false);d.addEventListener("error",
78
- function(){e.hide();h.show();h.find("mejs-overlay-error").html("Error loading this resource")},false)}},findTracks:function(){var a=this,c=a.$media.find("track");a.tracks=[];c.each(function(){a.tracks.push({srclang:f(this).attr("srclang").toLowerCase(),src:f(this).attr("src"),kind:f(this).attr("kind"),entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize();this.setControlsSize()},play:function(){this.media.play()},pause:function(){this.media.pause()},
79
- load:function(){this.media.load()},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)}};if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){return this.each(function(){new mejs.MediaElementPlayer(this,a)})};window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
80
- (function(f){f.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,c,b,d){var e=f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+this.id+'" title="Play/Pause"></button></div>').appendTo(c).click(function(h){h.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")},
81
- false);d.addEventListener("pause",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false);d.addEventListener("paused",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);
82
- (function(f){f.extend(MediaElementPlayer.prototype,{buildstop:function(a,c,b,d){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="Stop"></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));
83
- b.find(".mejs-poster").show()}})}})})(mejs.$);
84
- (function(f){f.extend(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 h=c.find(".mejs-time-current"),
85
- j=c.find(".mejs-time-handle"),i=c.find(".mejs-time-float"),k=c.find(".mejs-time-float-current"),n=function(g){g=g.pageX;var m=e.offset(),q=e.outerWidth(),o=0;o=0;if(g>m.left&&g<=q+m.left&&d.duration){o=(g-m.left)/q;o=o<=0.02?0:o*d.duration;l&&d.setCurrentTime(o);i.css("left",g-m.left);k.html(mejs.Utility.secondsToTimeCode(o))}},l=false,r=false;e.bind("mousedown",function(g){if(g.which===1){l=true;n(g);return false}});c.find(".mejs-time-total").bind("mouseenter",function(){r=true}).bind("mouseleave",
86
- function(){r=false});f(document).bind("mouseup",function(){l=false}).bind("mousemove",function(g){if(l||r)n(g)});d.addEventListener("progress",function(g){a.setProgressRail(g);a.setCurrentRail(g)},false);d.addEventListener("timeupdate",function(g){a.setProgressRail(g);a.setCurrentRail(g)},false);this.loaded=b;this.total=e;this.current=h;this.handle=j},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=c.buffered.end(0)/
87
- 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)}},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,c=a-this.handle.outerWidth(true)/
88
- 2;this.current.width(a);this.handle.css("left",c)}}})})(mejs.$);
89
- (function(f){f.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,c,b,d){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(c);this.currenttime=this.controls.find(".mejs-currenttime");d.addEventListener("timeupdate",function(){a.updateCurrent()},false)},buildduration:function(a,c,b,d){if(c.children().last().find(".mejs-currenttime").length>0)f(' <span> | </span> <span class="mejs-duration">'+
90
- (a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00: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:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(c)}this.durationD=this.controls.find(".mejs-duration");d.addEventListener("timeupdate",function(){a.updateDuration()},
91
- false)},updateCurrent:function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))},updateDuration:function(){if(this.media.duration&&this.durationD)this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))}})})(mejs.$);
92
- (function(f){f.extend(MediaElementPlayer.prototype,{buildvolume:function(a,c,b,d){var e=f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+this.id+'" title="Mute/Unmute"></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),h=e.find(".mejs-volume-slider"),j=e.find(".mejs-volume-total"),i=e.find(".mejs-volume-current"),k=e.find(".mejs-volume-handle"),
93
- n=function(g){if(h.is(":visible")){var m=j.height(),q=j.position();g=m-m*g;k.css("top",q.top+g-k.height()/2);i.height(m-g);i.css("top",q.top+g)}else{h.show();n(g);h.hide()}},l=function(g){var m=j.height(),q=j.offset(),o=parseInt(j.css("top").replace(/px/,""),10);g=g.pageY-q.top;var p=(m-g)/m;if(q.top!=0){p=Math.max(0,p);p=Math.min(p,1);if(g<0)g=0;else if(g>m)g=m;k.css("top",g-k.height()/2+o);i.height(m-g);i.css("top",g+o);if(p==0){d.setMuted(true);e.removeClass("mejs-mute").addClass("mejs-unmute")}else{d.setMuted(false);
94
- e.removeClass("mejs-unmute").addClass("mejs-mute")}p=Math.max(0,p);p=Math.min(p,1);d.setVolume(p)}},r=false;e.hover(function(){h.show()},function(){h.hide()});h.bind("mousedown",function(g){l(g);r=true;return false});f(document).bind("mouseup",function(){r=false}).bind("mousemove",function(g){r&&l(g)});e.find("button").click(function(){d.setMuted(!d.muted)});d.addEventListener("volumechange",function(g){if(!r)if(d.muted){n(0);e.removeClass("mejs-mute").addClass("mejs-unmute")}else{n(g.target.volume);
95
- e.removeClass("mejs-unmute").addClass("mejs-mute")}},true);n(a.options.startVolume);d.pluginType==="native"&&d.setVolume(a.options.startVolume)}})})(mejs.$);
96
- (function(f){f.extend(mejs.MepDefaults,{forcePluginFullScreen:false,newWindowCallback:function(){return""}});f.extend(MediaElementPlayer.prototype,{isFullScreen:false,docStyleOverflow:null,isInIframe:false,buildfullscreen:function(a,c){if(a.isVideo){a.isInIframe=window.location!=window.parent.location;mejs.MediaFeatures.hasTrueNativeFullScreen&&a.container.bind("webkitfullscreenchange",function(){mejs.MediaFeatures.isFullScreen()?a.setControlsSize():a.exitFullScreen()});var b=this,d=f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+
97
- b.id+'" title="Fullscreen"></button></div>').appendTo(c).click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});a.fullscreenBtn=d;f(document).bind("keydown",function(e){if((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||b.isFullScreen)&&e.keyCode==27)a.exitFullScreen()})}},enterFullScreen:function(){var a=this;if(a.media.pluginType!=="native"&&(mejs.MediaFeatures.isGecko||
98
- a.options.forcePluginFullScreen))a.media.setFullscreen(true);else{docStyleOverflow=document.documentElement.style.overflow;document.documentElement.style.overflow="hidden";normalHeight=a.container.height();normalWidth=a.container.width();if(mejs.MediaFeatures.hasTrueNativeFullScreen)mejs.MediaFeatures.requestFullScreen(a.container[0]);else if(mejs.MediaFeatures.hasSemiNativeFullScreen){a.media.webkitEnterFullscreen();return}if(a.isInIframe&&a.options.newWindowUrl!==""){a.pause();var c=a.options.newWindowCallback(this);
99
- c!==""&&window.open(c,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}else{a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");setTimeout(function(){a.container.css({width:"100%",height:"100%"})},500);if(a.pluginType==="native")a.$media.width("100%").height("100%");else{a.container.find("object embed").width("100%").height("100%");a.media.setVideoSize(f(window).width(),f(window).height())}a.layers.children("div").width("100%").height("100%");
100
- a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=true}}},exitFullScreen:function(){if(this.media.pluginType!=="native"&&mejs.MediaFeatures.isFirefox)this.media.setFullscreen(false);else{if(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen))mejs.MediaFeatures.cancelFullScreen();document.documentElement.style.overflow=docStyleOverflow;this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight).css("z-index",
101
- 1);if(this.pluginType==="native")this.$media.width(normalWidth).height(normalHeight);else{this.container.find("object embed").width(normalWidth).height(normalHeight);this.media.setVideoSize(normalWidth,normalHeight)}this.layers.children("div").width(normalWidth).height(normalHeight);this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");this.setControlsSize();this.isFullScreen=false}}})})(mejs.$);
102
- (function(f){f.extend(mejs.MepDefaults,{startLanguage:"",translations:[],translationSelector:false,googleApiKey:""});f.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(a,c,b,d){if(a.isVideo)if(a.tracks.length!=0){var e,h="";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();
103
- a.captionsText=a.captions.find(".mejs-captions-text");a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+this.id+'" title="Captions/Subtitles"></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></div>').appendTo(c).hover(function(){f(this).find(".mejs-captions-selector").css("visibility",
104
- "visible")},function(){f(this).find(".mejs-captions-selector").css("visibility","hidden")}).delegate("input[type=radio]","click",function(){lang=this.value;if(lang=="none")a.selectedTrack=null;else for(e=0;e<a.tracks.length;e++)if(a.tracks[e].srclang==lang){a.selectedTrack=a.tracks[e];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",
105
- function(){a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("mouseleave",function(){d.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;if(a.tracks.length>0&&a.options.translations.length>0)for(e=0;e<a.options.translations.length;e++)a.tracks.push({srclang:a.options.translations[e].toLowerCase(),src:null,kind:"subtitles",entries:[],isLoaded:false,
106
- isTranslation:true});for(e=0;e<a.tracks.length;e++)a.tracks[e].kind=="subtitles"&&a.addTrackButton(a.tracks[e].srclang,a.tracks[e].isTranslation);a.loadNextTrack();d.addEventListener("timeupdate",function(){a.displayCaptions()},false);d.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){if(a.hasChapters){a.chapters.css("visibility","visible");a.chapters.fadeIn(200)}},function(){a.hasChapters&&!d.paused&&a.chapters.fadeOut(200,function(){f(this).css("visibility",
107
- "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)h+='<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>'+h+"</select>"));a.container.find(".mejs-captions-translations").change(function(){lang=f(this).val();if(lang!=
108
- ""){a.tracks.push({srclang:lang,src:null,entries:[],isLoaded:false,isTranslation:true});if(!a.isLoadingTrack){a.trackToLoad--;a.addTrackButton(lang,true);a.options.startLanguage=lang;a.loadNextTrack()}}})}}},loadNextTrack:function(){this.trackToLoad++;if(this.trackToLoad<this.tracks.length){this.isLoadingTrack=true;this.loadTrack(this.trackToLoad)}else this.isLoadingTrack=false},loadTrack:function(a){var c=this,b=c.tracks[a],d=function(){b.isLoaded=true;c.enableTrackButton(b.srclang);c.loadNextTrack()};
109
- b.isTranslation?mejs.TrackFormatParser.translateTrackText(c.tracks[0].entries,c.tracks[0].srclang,b.srclang,c.options.googleApiKey,function(e){b.entries=e;d()}):f.ajax({url:b.src,success:function(e){b.entries=mejs.TrackFormatParser.parse(e);d();b.kind=="chapters"&&c.media.duration>0&&c.drawChapters(b)},error:function(){c.loadNextTrack()}})},enableTrackButton:function(a){this.captionsButton.find("input[value="+a+"]").prop("disabled",false).siblings("label").html(mejs.language.codes[a]||a);this.options.startLanguage==
110
- a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,c){var b=mejs.language.codes[a]||a;this.captionsButton.find("ul").append(f('<li><input type="radio" name="'+this.id+'_captions" id="'+this.id+"_captions_"+a+'" value="'+a+'" disabled="disabled" /><label for="'+this.id+"_captions_"+a+'">'+b+(c?" (translating)":" (loading)")+"</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+a+"]").remove()},adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+
111
- this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},displayCaptions:function(){if(typeof this.tracks!="undefined"){var a,c=this.selectedTrack;if(c!=null&&c.isLoaded)for(a=0;a<c.entries.times.length;a++)if(this.media.currentTime>=c.entries.times[a].start&&this.media.currentTime<=c.entries.times[a].stop){this.captionsText.html(c.entries.text[a]);this.captions.show();return}this.captions.hide()}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind==
112
- "chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);this.hasChapters=true;break}},drawChapters:function(a){var c=this,b,d,e=d=0;c.chapters.empty();for(b=0;b<a.entries.times.length;b++){d=a.entries.times[b].stop-a.entries.times[b].start;d=Math.floor(d/c.media.duration*100);if(d+e>100||b==a.entries.times.length-1&&d+e<100)d=100-e;c.chapters.append(f('<div class="mejs-chapter" rel="'+a.entries.times[b].start+'" style="left: '+e.toString()+"%;width: "+d.toString()+'%;"><div class="mejs-chapter-block'+
113
- (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>"));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",
114
- 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",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",
115
- 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:/^([a-zA-z]+-)?[0-9]+$/,pattern_timecode:/^([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,split2:function(a,c){return a.split(c)},parse:function(a){var c=0;a=this.split2(a,
116
- /\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 h={text:[],times:[]},j,i;this.translateText(a.text.join(" <a></a>"),c,b,d,function(k){j=k.split("<a></a>");
117
- for(i=0;i<a.text.length;i++){h.text[i]=j[i];h.times[i]={start:a.times[i].start,stop:a.times[i].stop,settings:a.times[i].settings}}e(h)})},translateText:function(a,c,b,d,e){for(var h,j=[],i,k="",n=function(){if(j.length>0){i=j.shift();mejs.TrackFormatParser.translateChunk(i,c,b,d,function(l){if(l!="undefined")k+=l;n()})}else e(k)};a.length>0;)if(a.length>1E3){h=a.lastIndexOf(".",1E3);j.push(a.substring(0,h));a=a.substring(h+1)}else{j.push(a);a=""}n()},translateChunk:function(a,c,b,d,e){a={q:a,langpair:c+
118
- "|"+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(h){e(h.responseData.translatedText)},error:function(){e(null)}})}};if("x\n\ny".split(/\n/gi).length!=3)mejs.TrackFormatParser.split2=function(a,c){var b=[],d="",e;for(e=0;e<a.length;e++){d+=a.substring(e,e+1);if(c.test(d)){b.push(d.replace(c,""));d=""}}b.push(d);return b}})(mejs.$);
119
- (function(f){f.extend(mejs.MepDefaults,contextMenuItems=[{render:function(a){if(typeof a.enterFullScreen=="undefined")return null;return a.isFullScreen?"Turn off Fullscreen":"Go Fullscreen"},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?"Unmute":"Mute"},click:function(a){a.media.muted?a.setMuted(false):a.setMuted(true)}},{isSeparator:true},{render:function(){return"Download Video"},click:function(a){window.location.href=a.media.currentSrc}}]);
120
- f.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a){a.contextMenu=f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide();a.container.bind("contextmenu",function(c){if(a.isContextMenuEnabled){c.preventDefault();a.renderContextMenu(c.clientX-1,c.clientY-1);return false}});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=
121
- true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;if(a!=null){clearTimeout(a);delete a}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(a,c){for(var b=this,d="",e=b.options.contextMenuItems,h=0,j=e.length;h<
122
- j;h++)if(e[h].isSeparator)d+='<div class="mejs-contextmenu-separator"></div>';else{var i=e[h].render(b);if(i!=null)d+='<div class="mejs-contextmenu-item" data-itemindex="'+h+'" id="element-'+Math.random()*1E6+'">'+i+"</div>"}b.contextMenu.empty().append(f(d)).css({top:c,left:a}).show();b.contextMenu.find(".mejs-contextmenu-item").each(function(){var k=f(this),n=parseInt(k.data("itemindex"),10),l=b.options.contextMenuItems[n];typeof l.show!="undefined"&&l.show(k,b);k.click(function(){typeof l.click!=
123
- "undefined"&&l.click(b);b.contextMenu.hide()})});setTimeout(function(){b.killControlsTimer("rev3")},100)}})})(mejs.$);
124
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-2012, John Dyer (http://j.hn)
11
+ * Dual licensed under the MIT or GPL Version 2 licenses.
12
+ *
13
+ */var mejs=mejs||{};mejs.version="2.7.0";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"]}],youtube:[{version:null,types:["video/youtube"]}],vimeo:[{version:null,types:["video/vimeo"]}]};
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="",g,f=document.getElementsByTagName("script"),j=f.length,h=a.length;b<j;b++){g=f[b].src;for(c=0;c<h;c++){e=a[c];if(g.indexOf(e)>
15
+ -1){d=g.substring(0,g.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,g=Math.floor(a/60)%60,f=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(g<10?"0"+g:g)+":"+(f<10?"0"+f:f)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;a=a.split(":");b=parseInt(a[0],
16
+ 10);var e=parseInt(a[1],10),g=parseInt(a[2],10),f=0,j=0;if(c)f=parseInt(a[3])/d;return j=b*3600+e*60+g+f},removeSwf:function(a){var b=document.getElementById(a);if(b&&b.nodeName=="OBJECT")if(mejs.MediaFeatures.isIE){b.style.display="none";(function(){b.readyState==4?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)})()}else b.parentNode.removeChild(b)},removeObjectInIE:function(a){if(a=document.getElementById(a)){for(var b in a)if(typeof a[b]=="function")a[b]=null;a.parentNode.removeChild(a)}}};
17
+ 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],g;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
18
+ !(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(g=new ActiveXObject(c))e=d(g)}catch(f){}return e}};
19
+ 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});
20
+ 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,g,f){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[g]+=f;e[g]-=f};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});
21
+ mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,g=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==
22
+ null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit;a.isOpera=d.match(/opera/gi)!==null;a.hasTouch="ontouchstart"in window;for(c=0;c<g.length;c++)e=document.createElement(g[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";a.hasMozNativeFullScreen=typeof e.mozRequestFullScreen!=="undefined";a.hasTrueNativeFullScreen=a.hasWebkitNativeFullScreen||
23
+ a.hasMozNativeFullScreen;a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=e.mozFullScreenEnabled;if(this.isChrome)a.hasSemiNativeFullScreen=false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;else if(e.webkitRequestFullScreen)return b.webkitIsFullScreen};a.requestFullScreen=function(f){if(a.hasWebkitNativeFullScreen)f.webkitRequestFullScreen();
24
+ else a.hasMozNativeFullScreen&&f.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
25
+ 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){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if(typeof a=="string")this.src=a;else{var 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}};
26
+ mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={}};
27
+ mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,tagName:"",muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=
28
+ false}},pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():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},
29
+ positionFullscreenButton:function(a,b,c){this.pluginApi!=null&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(a,b,c)},hideFullscreenButton:function(){this.pluginApi!=null&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},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=a[b];if(this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src));
30
+ this.src=mejs.Utility.absolutizeUrl(a)}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.setVolume(a*100):this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){if(this.pluginType=="youtube"){a?this.pluginApi.mute():this.pluginApi.unMute();this.muted=a;this.dispatchEvent("volumechange")}else this.pluginApi.setMuted(a);
31
+ this.muted=a}},setVideoSize:function(a,b){if(this.pluginElement.style){this.pluginElement.style.width=a+"px";this.pluginElement.style.height=b+"px"}this.pluginApi!=null&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.setFullscreen(true)},exitFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&
32
+ this.setFullscreen(false)},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},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)}},attributes:{},
33
+ hasAttribute:function(a){return a in this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){if(this.hasAttribute(a))return this.attributes[a];return""},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id)}};
34
+ 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];if(b){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,
35
+ 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)}};
36
+ mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],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,pluginVars:[],timerRate:250,startVolume:0.8,success:function(){},
37
+ error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
38
+ mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),g=e==="audio"||e==="video",f=g?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var j=d.getAttribute("autoplay"),h=d.getAttribute("preload"),l=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];f=typeof f=="undefined"||f===null||f==""?null:f;e=typeof e=="undefined"||e===null?"":e;h=typeof h=="undefined"||h===null||h==="false"?
39
+ "none":h;j=!(typeof j=="undefined"||j===null||j==="false");l=!(typeof l=="undefined"||l===null||l==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,g,f);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},false)}return this.updateNative(k,c,j,h)}else if(k.method!=="")return this.createPlugin(k,c,e,j,h,l);else{this.createErrorMessage(k,c,e);return this}},
40
+ determinePlayback:function(a,b,c,d,e){var g=[],f,j,h={method:"",url:"",htmlMediaElement:a,isVideo:a.tagName.toLowerCase()!="audio"},l,k;if(typeof b.type!="undefined"&&b.type!=="")if(typeof b.type=="string")g.push({type:b.type,url:e});else for(f=0;f<b.type.length;f++)g.push({type:b.type[f],url:e});else if(e!==null){j=this.formatType(e,a.getAttribute("type"));g.push({type:j,url:e})}else for(f=0;f<a.childNodes.length;f++){j=a.childNodes[f];if(j.nodeType==1&&j.tagName.toLowerCase()=="source"){e=j.getAttribute("src");
41
+ j=this.formatType(e,j.getAttribute("type"));g.push({type:j,url:e})}}if(!d&&g.length>0&&g[0].url!==null&&this.getTypeFromFile(g[0].url).indexOf("audio")>-1)h.isVideo=false;if(mejs.MediaFeatures.isBustedAndroid)a.canPlayType=function(m){return m.match(/video\/(mp4|m4v)/gi)!==null?"maybe":""};if(c&&(b.mode==="auto"||b.mode==="native")){if(!d){f=document.createElement(h.isVideo?"video":"audio");a.parentNode.insertBefore(f,a);a.style.display="none";h.htmlMediaElement=a=f}for(f=0;f<g.length;f++)if(a.canPlayType(g[f].type).replace(/no/,
42
+ "")!==""||a.canPlayType(g[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){h.method="native";h.url=g[f].url;break}if(h.method==="native"){if(h.url!==null)a.src=h.url;return h}}if(b.mode==="auto"||b.mode==="shim")for(f=0;f<g.length;f++){j=g[f].type;for(a=0;a<b.plugins.length;a++){e=b.plugins[a];l=mejs.plugins[e];for(c=0;c<l.length;c++){k=l[c];if(k.version==null||mejs.PluginDetector.hasPluginVersion(e,k.version))for(d=0;d<k.types.length;d++)if(j==k.types[d]){h.method=e;h.url=g[f].url;return h}}}}if(h.method===
43
+ ""&&g.length>0)h.url=g[0].url;return h},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},getTypeFromFile:function(a){a=a.substring(a.lastIndexOf(".")+1);return(/(mp4|m4v|ogg|ogv|webm|flv|wmv|mpeg|mov)/gi.test(a)?"video":"audio")+"/"+a},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className="me-cannotplay";try{e.style.width=d.width+"px";e.style.height=d.height+"px"}catch(g){}e.innerHTML=c!==
44
+ ""?'<a href="'+a.url+'"><img src="'+c+'" width="100%" height="100%" /></a>':'<a href="'+a.url+'"><span>Download File</span></a>';d.parentNode.insertBefore(e,d);d.style.display="none";b.error(d)},createPlugin:function(a,b,c,d,e,g){c=a.htmlMediaElement;var f=1,j=1,h="me_"+a.method+"_"+mejs.meIndex++,l=new mejs.PluginMediaElement(h,a.method,a.url),k=document.createElement("div"),m;l.tagName=c.tagName;for(m=0;m<c.attributes.length;m++){var n=c.attributes[m];n.specified==true&&l.setAttribute(n.name,n.value)}for(m=
45
+ c.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(a.isVideo){f=b.videoWidth>0?b.videoWidth:c.getAttribute("width")!==null?c.getAttribute("width"):b.defaultVideoWidth;j=b.videoHeight>0?b.videoHeight:c.getAttribute("height")!==null?c.getAttribute("height"):b.defaultVideoHeight;f=mejs.Utility.encodeUrl(f);j=mejs.Utility.encodeUrl(j)}else if(b.enablePluginDebug){f=320;j=240}l.success=
46
+ b.success;mejs.MediaPluginBridge.registerPluginElement(h,l,c);k.className="me-plugin";k.id=h+"_container";a.isVideo?c.parentNode.insertBefore(k,c):document.body.insertBefore(k,document.body.childNodes[0]);d=["id="+h,"isvideo="+(a.isVideo?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+f,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"height="+j];if(a.url!==null)a.method=="flash"?d.push("file="+mejs.Utility.encodeUrl(a.url)):d.push("file="+a.url);b.enablePluginDebug&&d.push("debug=true");
47
+ b.enablePluginSmoothing&&d.push("smoothing=true");g&&d.push("controls=true");if(b.pluginVars)d=d.concat(b.pluginVars);switch(a.method){case "silverlight":k.innerHTML='<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+h+'" name="'+h+'" width="'+f+'" height="'+j+'"><param name="initParams" value="'+d.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="'+
48
+ b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){a=document.createElement("div");k.appendChild(a);a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+h+'" width="'+f+'" height="'+j+'"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+d.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 k.innerHTML=
49
+ '<embed id="'+h+'" name="'+h+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+d.join("&")+'" width="'+f+'" height="'+j+'"></embed>';break;case "youtube":b=a.url.substr(a.url.lastIndexOf("=")+1);youtubeSettings={container:k,containerId:k.id,pluginMediaElement:l,pluginId:h,videoId:b,
50
+ height:j,width:f};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":console.log("vimeoid");l.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1);k.innerHTML='<object width="'+f+'" height="'+j+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="api=1" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id='+
51
+ l.vimeoid+'&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="//vimeo.com/moogaloop.swf?api=1&amp;clip_id='+l.vimeoid+'&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+f+'" height="'+j+'"></embed></object>'}c.style.display=
52
+ "none";return l},updateNative:function(a,b){var c=a.htmlMediaElement,d;for(d in mejs.HtmlMediaElement)c[d]=mejs.HtmlMediaElement[d];b.success(c,c);return c}};
53
+ mejs.YouTubeApi={isIframeStarted:false,isIframeLoaded:false,loadIframeApi:function(){if(!this.isIframeStarted){var a=document.createElement("script");a.src="http://www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);this.isIframeStarted=true}},iframeQueue:[],enqueueIframe:function(a){if(this.isLoaded)this.createIframe(a);else{this.loadIframeApi();this.iframeQueue.push(a)}},createIframe:function(a){var b=a.pluginMediaElement,c=new YT.Player(a.containerId,
54
+ {height:a.height,width:a.width,videoId:a.videoId,playerVars:{controls:0},events:{onReady:function(){a.pluginMediaElement.pluginApi=c;mejs.MediaPluginBridge.initPlugin(a.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(c,b,"timeupdate")},250)},onStateChange:function(d){mejs.YouTubeApi.handleStateChange(d.data,c,b)}}})},createEvent:function(a,b,c){c={type:c,target:b};if(a&&a.getDuration){b.currentTime=c.currentTime=a.getCurrentTime();b.duration=c.duration=a.getDuration();c.paused=b.paused;
55
+ c.ended=b.ended;c.muted=a.isMuted();c.volume=a.getVolume()/100;c.bytesTotal=a.getVideoBytesTotal();c.bufferedBytes=a.getVideoBytesLoaded();var d=c.bufferedBytes/c.bytesTotal*c.duration;c.target.buffered=c.buffered={start:function(){return 0},end:function(){return d},length:1}}b.dispatchEvent(c.type,c)},iFrameReady:function(){for(this.isIframeLoaded=this.isLoaded=true;this.iframeQueue.length>0;)this.createIframe(this.iframeQueue.pop())},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=
56
+ a;var b,c="http://www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid="+a.pluginId+"&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0";if(mejs.MediaFeatures.isIE){b=document.createElement("div");a.container.appendChild(b);b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'"><param name="movie" value="'+c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else a.container.innerHTML=
57
+ '<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; "><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c;mejs.MediaPluginBridge.initPlugin(a);c.cueVideoById(b.videoId);a=b.containerId+"_callback";window[a]=function(e){mejs.YouTubeApi.handleStateChange(e,
58
+ c,d)};c.addEventListener("onStateChange",a);setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250)},handleStateChange:function(a,b,c){switch(a){case -1:c.paused=true;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=false;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=false;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"play");mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=true;c.ended=false;mejs.YouTubeApi.createEvent(b,
59
+ c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress")}}};function onYouTubePlayerAPIReady(){mejs.YouTubeApi.iFrameReady()}function onYouTubePlayerReady(a){mejs.YouTubeApi.flashReady(a)}window.mejs=mejs;window.MediaElement=mejs.MediaElement;
60
+
61
+ /*!
62
+ * MediaElementPlayer
63
+ * http://mediaelementjs.com/
64
+ *
65
+ * Creates a controller bar for HTML5 <video> add <audio> tags
66
+ * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
67
+ *
68
+ * Copyright 2010-2012, John Dyer (http://j.hn/)
69
+ * Dual licensed under the MIT or GPL Version 2 licenses.
70
+ *
71
+ */if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
72
+ (function(f){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks",
73
+ "volume","fullscreen"],isVideo:true,enableKeyboard:true,pauseOtherPlayers:true,keyActions:[{keys:[32,179],action:function(a,c){c.paused||c.ended?c.play():c.pause()}},{keys:[38],action:function(a,c){c.setVolume(Math.min(c.volume+0.1,1))}},{keys:[40],action:function(a,c){c.setVolume(Math.max(c.volume-0.1,0))}},{keys:[37,227],action:function(a,c){if(!isNaN(c.duration)&&c.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}c.setCurrentTime(Math.min(c.currentTime-c.duration*0.05,c.duration))}}},
74
+ {keys:[39,228],action:function(a,c){if(!isNaN(c.duration)&&c.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}c.setCurrentTime(Math.max(c.currentTime+c.duration*0.05,0))}}},{keys:[70],action:function(a){if(typeof a.enterFullScreen!="undefined")a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}}]};mejs.mepIndex=0;mejs.players=[];mejs.MediaElementPlayer=function(a,c){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,c);this.$media=this.$node=f(a);
75
+ this.node=this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;if(typeof c=="undefined")c=this.$node.data("mejsoptions");this.options=f.extend({},mejs.MepDefaults,c);mejs.players.push(this);this.init();return this};mejs.MediaElementPlayer.prototype={hasFocus:false,controlsAreVisible:true,init:function(){var a=this,c=mejs.MediaFeatures,b=f.extend(true,{},a.options,{success:function(e,g){a.meReady(e,g)},error:function(e){a.handleError(e)}}),
76
+ d=a.media.tagName.toLowerCase();a.isDynamic=d!=="audio"&&d!=="video";a.isVideo=a.isDynamic?a.options.isVideo:d!=="audio"&&a.options.isVideo;if(c.isiPad&&a.options.iPadUseNativeControls||c.isiPhone&&a.options.iPhoneUseNativeControls){a.$media.attr("controls","controls");if(c.isiPad&&a.media.getAttribute("autoplay")!==null){a.media.load();a.media.play()}}else if(!(c.isAndroid&&a.AndroidUseNativeControls)){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);
77
+ a.container.addClass((c.isAndroid?"mejs-android ":"")+(c.isiOS?"mejs-ios ":"")+(c.isiPad?"mejs-ipad ":"")+(c.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio "));if(c.isiOS){c=a.$media.clone();a.container.find(".mejs-mediaelement").append(c);a.$media.remove();a.$node=a.$media=c;a.node=a.media=c[0]}else a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");c=d.substring(0,1).toUpperCase()+d.substring(1);
78
+ a.width=a.options[d+"Width"]>0||a.options[d+"Width"].toString().indexOf("%")>-1?a.options[d+"Width"]:a.media.style.width!==""&&a.media.style.width!==null?a.media.style.width:a.media.getAttribute("width")!==null?a.$media.attr("width"):a.options["default"+c+"Width"];a.height=a.options[d+"Height"]>0||a.options[d+"Height"].toString().indexOf("%")>-1?a.options[d+"Height"]:a.media.style.height!==""&&a.media.style.height!==null?a.media.style.height:a.$media[0].getAttribute("height")!==null?a.$media.attr("height"):
79
+ a.options["default"+c+"Height"];a.setPlayerSize(a.width,a.height);b.pluginWidth=a.height;b.pluginHeight=a.width}mejs.MediaElement(a.$media[0],b)},showControls:function(a){var c=this;a=typeof a=="undefined"||a;if(!c.controlsAreVisible){if(a){c.controls.css("visibility","visible").stop(true,true).fadeIn(200,function(){c.controlsAreVisible=true});c.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){c.controlsAreVisible=true})}else{c.controls.css("visibility",
80
+ "visible").css("display","block");c.container.find(".mejs-control").css("visibility","visible").css("display","block");c.controlsAreVisible=true}c.setControlsSize()}},hideControls:function(a){var c=this;a=typeof a=="undefined"||a;if(c.controlsAreVisible)if(a){c.controls.stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block");c.controlsAreVisible=false});c.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display",
81
+ "block")})}else{c.controls.css("visibility","hidden").css("display","block");c.container.find(".mejs-control").css("visibility","hidden").css("display","block");c.controlsAreVisible=false}},controlsTimer:null,startControlsTimer:function(a){var c=this;a=typeof a!="undefined"?a:1500;c.killControlsTimer("start");c.controlsTimer=setTimeout(function(){c.hideControls();c.killControlsTimer("hide")},a)},killControlsTimer:function(){if(this.controlsTimer!==null){clearTimeout(this.controlsTimer);delete this.controlsTimer;
82
+ this.controlsTimer=null}},controlsEnabled:true,disableControls:function(){this.killControlsTimer();this.hideControls(false);this.controlsEnabled=false},enableControls:function(){this.showControls(false);this.controlsEnabled=true},meReady:function(a,c){var b=this,d=mejs.MediaFeatures,e=c.getAttribute("autoplay");e=!(typeof e=="undefined"||e===null||e==="false");var g;if(!b.created){b.created=true;b.media=a;b.domNode=c;if(!(d.isAndroid&&b.options.AndroidUseNativeControls)&&!(d.isiPad&&b.options.iPadUseNativeControls)&&
83
+ !(d.isiPhone&&b.options.iPhoneUseNativeControls)){b.buildposter(b,b.controls,b.layers,b.media);b.buildkeyboard(b,b.controls,b.layers,b.media);b.buildoverlays(b,b.controls,b.layers,b.media);b.findTracks();for(g in b.options.features){d=b.options.features[g];if(b["build"+d])try{b["build"+d](b,b.controls,b.layers,b.media)}catch(k){}}b.container.trigger("controlsready");b.setPlayerSize(b.width,b.height);b.setControlsSize();if(b.isVideo){if(mejs.MediaFeatures.hasTouch)b.$media.bind("touchstart",function(){if(b.controlsAreVisible)b.hideControls(false);
84
+ else b.controlsEnabled&&b.showControls(false)});else{(b.media.pluginType=="native"?b.$media:f(b.media.pluginElement)).click(function(){a.paused?a.play():a.pause()});b.container.bind("mouseenter mouseover",function(){if(b.controlsEnabled)if(!b.options.alwaysShowControls){b.killControlsTimer("enter");b.showControls();b.startControlsTimer(2500)}}).bind("mousemove",function(){if(b.controlsEnabled){b.controlsAreVisible||b.showControls();b.options.alwaysShowControls||b.startControlsTimer(2500)}}).bind("mouseleave",
85
+ function(){b.controlsEnabled&&!b.media.paused&&!b.options.alwaysShowControls&&b.startControlsTimer(1E3)})}e&&!b.options.alwaysShowControls&&b.hideControls();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)}a.addEventListener("play",
86
+ function(){for(var h=0,o=mejs.players.length;h<o;h++){var n=mejs.players[h];n.id!=b.id&&b.options.pauseOtherPlayers&&!n.paused&&!n.ended&&n.pause();n.hasFocus=false}b.hasFocus=true},false);b.media.addEventListener("ended",function(){try{b.media.setCurrentTime(0)}catch(h){}b.media.pause();b.setProgressRail&&b.setProgressRail();b.setCurrentRail&&b.setCurrentRail();if(b.options.loop)b.media.play();else!b.options.alwaysShowControls&&b.controlsEnabled&&b.showControls()},false);b.media.addEventListener("loadedmetadata",
87
+ function(){b.updateDuration&&b.updateDuration();b.updateCurrent&&b.updateCurrent();if(!b.isFullScreen){b.setPlayerSize(b.width,b.height);b.setControlsSize()}},false);setTimeout(function(){b.setPlayerSize(b.width,b.height);b.setControlsSize()},50);f(window).resize(function(){b.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||b.setPlayerSize(b.width,b.height);b.setControlsSize()});b.media.pluginType=="youtube"&&b.container.find(".mejs-overlay-play").hide()}if(e&&
88
+ a.pluginType=="native"){a.load();a.play()}if(b.options.success)typeof b.options.success=="string"?window[b.options.success](b.media,b.domNode,b):b.options.success(b.media,b.domNode,b)}},handleError:function(a){this.controls.hide();this.options.error&&this.options.error(a)},setPlayerSize:function(a,c){if(typeof a!="undefined")this.width=a;if(typeof c!="undefined")this.height=c;if(this.height.toString().indexOf("%")>0){var b=this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.options.defaultVideoWidth,
89
+ d=this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.options.defaultVideoHeight,e=this.container.parent().width();b=parseInt(e*d/b,10);if(this.container.parent()[0].tagName.toLowerCase()==="body"){e=f(window).width();b=f(window).height()}this.container.width(e).height(b);this.$media.width("100%").height("100%");this.container.find("object, embed, iframe").width("100%").height("100%");this.media.setVideoSize&&this.media.setVideoSize(e,b);this.layers.children(".mejs-layer").width("100%").height("100%")}else{this.container.width(this.width).height(this.height);
90
+ 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();if(this.options&&!this.options.autosizeProgress)c=parseInt(b.css("width"));if(c===0||!c){others.each(function(){if(f(this).css("position")!="absolute")a+=f(this).outerWidth(true)});c=this.controls.width()-
91
+ a-(b.outerWidth(true)-b.outerWidth(false))}b.width(c);d.width(c-(d.outerWidth(true)-d.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},buildposter:function(a,c,b,d){var e=f('<div class="mejs-poster mejs-layer"></div>').appendTo(b);c=a.$media.attr("poster");if(a.options.poster!=="")c=a.options.poster;c!==""&&c!=null?this.setPoster(c):e.hide();d.addEventListener("play",function(){e.hide()},false)},setPoster:function(a){var c=this.container.find(".mejs-poster"),
92
+ b=c.find("img");if(b.length==0)b=f('<img width="100%" height="100%" />').appendTo(c);b.attr("src",a)},buildoverlays:function(a,c,b,d){if(a.isVideo){var e=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(b),g=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(b),k=f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(b).click(function(){d.paused?
93
+ d.play():d.pause()});d.addEventListener("play",function(){k.hide();e.hide();g.hide()},false);d.addEventListener("playing",function(){k.hide();e.hide();g.hide()},false);d.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||k.show()},false);d.addEventListener("waiting",function(){e.show()},false);d.addEventListener("loadeddata",function(){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")},
94
+ false)}},buildkeyboard:function(a,c,b,d){f(document).keydown(function(e){if(a.hasFocus&&a.options.enableKeyboard)for(var g=0,k=a.options.keyActions.length;g<k;g++)for(var h=a.options.keyActions[g],o=0,n=h.keys.length;o<n;o++)if(e.keyCode==h.keys[o]){e.preventDefault();h.action(a,d);return false}return true});f(document).click(function(e){if(f(e.target).closest(".mejs-container").length==0)a.hasFocus=false})},findTracks:function(){var a=this,c=a.$media.find("track");a.tracks=[];c.each(function(b,d){d=
95
+ f(d);a.tracks.push({srclang:d.attr("srclang").toLowerCase(),src:d.attr("src"),kind:d.attr("kind"),label:d.attr("label")||"",entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize(this.width,this.height);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)},
96
+ getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){if(this.media.pluginType=="flash")this.media.remove();else this.media.pluginTyp=="native"&&this.media.prop("controls",true);this.isDynamic||this.$node.insertBefore(this.container);this.container.remove()}};if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){return this.each(function(){new mejs.MediaElementPlayer(this,
97
+ a)})};f(document).ready(function(){f(".mejs-player").mediaelementplayer()});window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
98
+ (function(f){f.extend(mejs.MepDefaults,{playpauseText:"Play/Pause"});f.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,c,b,d){var e=f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+this.id+'" title="'+this.options.playpauseText+'"></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);
99
+ d.addEventListener("playing",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);d.addEventListener("pause",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false);d.addEventListener("paused",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);
100
+ (function(f){f.extend(mejs.MepDefaults,{stopText:"Stop"});f.extend(MediaElementPlayer.prototype,{buildstop:function(a,c,b,d){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="'+this.options.stopText+"></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));
101
+ c.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));b.find(".mejs-poster").show()}})}})})(mejs.$);
102
+ (function(f){f.extend(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"),
103
+ k=c.find(".mejs-time-handle"),h=c.find(".mejs-time-float"),o=c.find(".mejs-time-float-current"),n=function(l){l=l.pageX;var m=e.offset(),i=e.outerWidth(),j=0;j=0;var q=l-m.left;if(l>m.left&&l<=i+m.left&&d.duration){j=(l-m.left)/i;j=j<=0.02?0:j*d.duration;p&&d.setCurrentTime(j);if(!mejs.MediaFeatures.hasTouch){h.css("left",q);o.html(mejs.Utility.secondsToTimeCode(j));h.show()}}},p=false,r=false;e.bind("mousedown",function(l){if(l.which===1){p=true;n(l);return false}});c.find(".mejs-time-total").bind("mouseenter",
104
+ function(){r=true;mejs.MediaFeatures.hasTouch||h.show()}).bind("mouseleave",function(){r=false;h.hide()});f(document).bind("mouseup",function(){p=false;h.hide()}).bind("mousemove",function(l){if(p||r)n(l)});d.addEventListener("progress",function(l){a.setProgressRail(l);a.setCurrentRail(l)},false);d.addEventListener("timeupdate",function(l){a.setProgressRail(l);a.setCurrentRail(l)},false);this.loaded=b;this.total=e;this.current=g;this.handle=k},setProgressRail:function(a){var c=a!=undefined?a.target:
105
+ this.media,b=null;if(c&&c.buffered&&c.buffered.length>0&&c.buffered.end&&c.duration)b=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)}},setCurrentRail:function(){if(this.media.currentTime!=undefined&&this.media.duration)if(this.total&&this.handle){var a=
106
+ this.total.width()*this.media.currentTime/this.media.duration,c=a-this.handle.outerWidth(true)/2;this.current.width(a);this.handle.css("left",c)}}})})(mejs.$);
107
+ (function(f){f.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:" <span> | </span> "});f.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,c,b,d){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(c);this.currenttime=this.controls.find(".mejs-currenttime");d.addEventListener("timeupdate",function(){a.updateCurrent()},false)},buildduration:function(a,
108
+ c,b,d){if(c.children().last().find(".mejs-currenttime").length>0)f(this.options.timeAndDurationSeparator+'<span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span>").appendTo(c.find(".mejs-time"));else{c.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");
109
+ f('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span></div>").appendTo(c)}this.durationD=this.controls.find(".mejs-duration");d.addEventListener("timeupdate",function(){a.updateDuration()},
110
+ false)},updateCurrent:function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))},updateDuration:function(){if(this.media.duration&&this.durationD)this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))}})})(mejs.$);
111
+ (function(f){f.extend(mejs.MepDefaults,{muteText:"Mute Toggle",hideVolumeOnTouchDevices:true,audioVolume:"horizontal",videoVolume:"vertical"});f.extend(MediaElementPlayer.prototype,{buildvolume:function(a,c,b,d){if(!(mejs.MediaFeatures.hasTouch&&this.options.hideVolumeOnTouchDevices)){var e=this.isVideo?this.options.videoVolume:this.options.audioVolume,g=e=="horizontal"?f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+this.id+'" title="'+this.options.muteText+
112
+ '"></button></div><div class="mejs-horizontal-volume-slider"><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></div>').appendTo(c):f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+this.id+'" title="'+this.options.muteText+'"></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),
113
+ k=this.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),h=this.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),o=this.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),n=this.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),p=function(i){if(k.is(":visible")){i=Math.max(0,i);i=Math.min(i,1);i==0?g.removeClass("mejs-mute").addClass("mejs-unmute"):g.removeClass("mejs-unmute").addClass("mejs-mute");if(e=="vertical"){var j=
114
+ h.height(),q=h.position();i=j-j*i;n.css("top",q.top+i-n.height()/2);o.height(j-i);o.css("top",q.top+i)}else{j=h.width();q=h.position();i=j*i;n.css("left",q.left+i-n.width()/2);o.width(i)}}else{k.show();p(i);k.hide()}},r=function(i){var j=null,q=h.offset();if(e=="vertical"){j=h.height();parseInt(h.css("top").replace(/px/,""),10);j=(j-(i.pageY-q.top))/j;if(q.top==0||q.left==0)return}else{j=h.width();j=(i.pageX-q.left)/j}j=Math.max(0,j);j=Math.min(j,1);p(j);j==0?d.setMuted(true):d.setMuted(false);d.setVolume(j)},
115
+ l=false,m=false;g.hover(function(){k.show();m=true},function(){m=false;!l&&e=="vertical"&&k.hide()});k.bind("mouseover",function(){m=true}).bind("mousedown",function(i){r(i);l=true;return false});f(document).bind("mouseup",function(){l=false;!m&&e=="vertical"&&k.hide()}).bind("mousemove",function(i){l&&r(i)});g.find("button").click(function(){d.setMuted(!d.muted)});d.addEventListener("volumechange",function(){if(!l)if(d.muted){p(0);g.removeClass("mejs-mute").addClass("mejs-unmute")}else{p(d.volume);
116
+ g.removeClass("mejs-unmute").addClass("mejs-mute")}},false);if(this.container.is(":visible")){p(a.options.startVolume);d.pluginType==="native"&&d.setVolume(a.options.startVolume)}}}})})(mejs.$);
117
+ (function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:true,newWindowCallback:function(){return""},fullscreenText:"Fullscreen"});f.extend(MediaElementPlayer.prototype,{isFullScreen:false,isNativeFullScreen:false,docStyleOverflow:null,isInIframe:false,buildfullscreen:function(a,c,b,d){if(a.isVideo){a.isInIframe=window.location!=window.parent.location;mejs.MediaFeatures.hasTrueNativeFullScreen&&a.container.bind(mejs.MediaFeatures.fullScreenEventName,function(){if(mejs.MediaFeatures.isFullScreen()){a.isNativeFullScreen=
118
+ true;a.setControlsSize()}else{a.isNativeFullScreen=false;a.exitFullScreen()}});var e=this,g=f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+e.id+'" title="'+e.options.fullscreenText+'"></button></div>').appendTo(c);if(e.media.pluginType==="native"||!e.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});
119
+ else{var k=null;if(document.documentElement.style.pointerEvents===""&&!mejs.MediaFeatures.isOpera){var h=false,o=function(){if(h){n.hide();p.hide();r.hide();g.css("pointer-events","");e.controls.css("pointer-events","");h=false}},n=f('<div class="mejs-fullscreen-hover" />').appendTo(e.container).mouseover(o),p=f('<div class="mejs-fullscreen-hover" />').appendTo(e.container).mouseover(o),r=f('<div class="mejs-fullscreen-hover" />').appendTo(e.container).mouseover(o),l=function(){var m={position:"absolute",
120
+ top:0,left:0};n.css(m);p.css(m);r.css(m);n.width(e.container.width()).height(e.container.height()-e.controls.height());m=g.offset().left-e.container.offset().left;fullScreenBtnWidth=g.outerWidth(true);p.width(m).height(e.controls.height()).css({top:e.container.height()-e.controls.height()});r.width(e.container.width()-m-fullScreenBtnWidth).height(e.controls.height()).css({top:e.container.height()-e.controls.height(),left:m+fullScreenBtnWidth})};f(document).resize(function(){l()});g.mouseover(function(){if(!e.isFullScreen){var m=
121
+ g.offset(),i=a.container.offset();d.positionFullscreenButton(m.left-i.left,m.top-i.top,false);g.css("pointer-events","none");e.controls.css("pointer-events","none");n.show();r.show();p.show();l();h=true}});d.addEventListener("fullscreenchange",function(){o()})}else g.mouseover(function(){if(k!==null){clearTimeout(k);delete k}var m=g.offset(),i=a.container.offset();d.positionFullscreenButton(m.left-i.left,m.top-i.top,true)}).mouseout(function(){if(k!==null){clearTimeout(k);delete k}k=setTimeout(function(){d.hideFullscreenButton()},
122
+ 1500)})}a.fullscreenBtn=g;f(document).bind("keydown",function(m){if((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||e.isFullScreen)&&m.keyCode==27)a.exitFullScreen()})}},enterFullScreen:function(){var a=this;if(!(a.media.pluginType!=="native"&&(mejs.MediaFeatures.isFirefox||a.options.usePluginFullScreen))){docStyleOverflow=document.documentElement.style.overflow;document.documentElement.style.overflow="hidden";normalHeight=a.container.height();normalWidth=a.container.width();
123
+ if(a.media.pluginType==="native")if(mejs.MediaFeatures.hasTrueNativeFullScreen){mejs.MediaFeatures.requestFullScreen(a.container[0]);a.isInIframe&&setTimeout(function b(){if(a.isNativeFullScreen)f(window).width()!==screen.width?a.exitFullScreen():setTimeout(b,500)},500)}else if(mejs.MediaFeatures.hasSemiNativeFullScreen){a.media.webkitEnterFullscreen();return}if(a.isInIframe){var c=a.options.newWindowCallback(this);if(c!=="")if(mejs.MediaFeatures.hasTrueNativeFullScreen)setTimeout(function(){if(!a.isNativeFullScreen){a.pause();
124
+ window.open(c,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}},250);else{a.pause();window.open(c,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");return}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);if(a.pluginType===
125
+ "native")a.$media.width("100%").height("100%");else{a.container.find("object, embed, iframe").width("100%").height("100%");a.media.setVideoSize(f(window).width(),f(window).height())}a.layers.children("div").width("100%").height("100%");a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=true}},exitFullScreen:function(){if(this.media.pluginType!=="native"&&mejs.MediaFeatures.isFirefox)this.media.setFullscreen(false);else{if(mejs.MediaFeatures.hasTrueNativeFullScreen&&
126
+ (mejs.MediaFeatures.isFullScreen()||this.isFullScreen))mejs.MediaFeatures.cancelFullScreen();document.documentElement.style.overflow=docStyleOverflow;this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight);if(this.pluginType==="native")this.$media.width(normalWidth).height(normalHeight);else{this.container.find("object embed").width(normalWidth).height(normalHeight);this.media.setVideoSize(normalWidth,normalHeight)}this.layers.children("div").width(normalWidth).height(normalHeight);
127
+ this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");this.setControlsSize();this.isFullScreen=false}}})})(mejs.$);
128
+ (function(f){f.extend(mejs.MepDefaults,{startLanguage:"",tracksText:"Captions/Subtitles"});f.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(a,c,b,d){if(a.isVideo)if(a.tracks.length!=0){var e;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");
129
+ a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+this.id+'" title="'+this.options.tracksText+'"></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></div>').appendTo(c).hover(function(){f(this).find(".mejs-captions-selector").css("visibility","visible")},function(){f(this).find(".mejs-captions-selector").css("visibility",
130
+ "hidden")}).delegate("input[type=radio]","click",function(){lang=this.value;if(lang=="none")a.selectedTrack=null;else for(e=0;e<a.tracks.length;e++)if(a.tracks[e].srclang==lang){a.selectedTrack=a.tracks[e];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",
131
+ function(){d.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;for(e=0;e<a.tracks.length;e++)a.tracks[e].kind=="subtitles"&&a.addTrackButton(a.tracks[e].srclang,a.tracks[e].label);a.loadNextTrack();d.addEventListener("timeupdate",function(){a.displayCaptions()},false);d.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){if(a.hasChapters){a.chapters.css("visibility",
132
+ "visible");a.chapters.fadeIn(200)}},function(){a.hasChapters&&!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")}},loadNextTrack:function(){this.trackToLoad++;if(this.trackToLoad<this.tracks.length){this.isLoadingTrack=true;this.loadTrack(this.trackToLoad)}else this.isLoadingTrack=false},loadTrack:function(a){var c=this,b=c.tracks[a],d=function(){b.isLoaded=
133
+ true;c.enableTrackButton(b.srclang,b.label);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,c){if(c==="")c=mejs.language.codes[a]||a;this.captionsButton.find("input[value="+
134
+ a+"]").prop("disabled",false).siblings("label").html(c);this.options.startLanguage==a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,c){if(c==="")c=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+'">'+c+" (loading)</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+
135
+ 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&&this.media.currentTime<=c.entries.times[a].stop){this.captionsText.html(c.entries.text[a]);
136
+ 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]);this.hasChapters=true;break}},drawChapters:function(a){var c=this,b,d,e=d=0;c.chapters.empty();for(b=0;b<a.entries.times.length;b++){d=a.entries.times[b].stop-a.entries.times[b].start;d=Math.floor(d/c.media.duration*100);if(d+e>100||b==a.entries.times.length-1&&d+e<100)d=100-e;c.chapters.append(f('<div class="mejs-chapter" rel="'+
137
+ 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>"));e+=d}c.chapters.find("div.mejs-chapter").click(function(){c.media.setCurrentTime(parseFloat(f(this).attr("rel")));
138
+ 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",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",
139
+ 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:/^([a-zA-z]+-)?[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})?)(.*)$/,
140
+ 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}};if("x\n\ny".split(/\n/gi).length!=3)mejs.TrackFormatParser.split2=
141
+ function(a,c){var b=[],d="",e;for(e=0;e<a.length;e++){d+=a.substring(e,e+1);if(c.test(d)){b.push(d.replace(c,""));d=""}}b.push(d);return b}})(mejs.$);
142
+ (function(f){f.extend(mejs.MepDefaults,contextMenuItems=[{render:function(a){if(typeof a.enterFullScreen=="undefined")return null;return a.isFullScreen?"Turn off Fullscreen":"Go Fullscreen"},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?"Unmute":"Mute"},click:function(a){a.media.muted?a.setMuted(false):a.setMuted(true)}},{isSeparator:true},{render:function(){return"Download Video"},click:function(a){window.location.href=a.media.currentSrc}}]);
143
+ f.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a){a.contextMenu=f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide();a.container.bind("contextmenu",function(c){if(a.isContextMenuEnabled){c.preventDefault();a.renderContextMenu(c.clientX-1,c.clientY-1);return false}});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=
144
+ true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;if(a!=null){clearTimeout(a);delete a}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(a,c){for(var b=this,d="",e=b.options.contextMenuItems,g=0,k=e.length;g<
145
+ k;g++)if(e[g].isSeparator)d+='<div class="mejs-contextmenu-separator"></div>';else{var h=e[g].render(b);if(h!=null)d+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+Math.random()*1E6+'">'+h+"</div>"}b.contextMenu.empty().append(f(d)).css({top:c,left:a}).show();b.contextMenu.find(".mejs-contextmenu-item").each(function(){var o=f(this),n=parseInt(o.data("itemindex"),10),p=b.options.contextMenuItems[n];typeof p.show!="undefined"&&p.show(o,b);o.click(function(){typeof p.click!=
146
+ "undefined"&&p.click(b);b.contextMenu.hide()})});setTimeout(function(){b.killControlsTimer("rev3")},100)}})})(mejs.$);
147
+
mediaelement/mediaelement.js ADDED
@@ -0,0 +1,1478 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.5.0';
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: [12,0], types: ['video/webm']} // for future reference (hopefully!)
31
+ ],
32
+ youtube: [
33
+ {version: null, types: ['video/youtube']}
34
+ ],
35
+ vimeo: [
36
+ {version: null, types: ['video/vimeo']}
37
+ ]
38
+ };
39
+
40
+ /*
41
+ Utility methods
42
+ */
43
+ mejs.Utility = {
44
+ encodeUrl: function(url) {
45
+ return encodeURIComponent(url); //.replace(/\?/gi,'%3F').replace(/=/gi,'%3D').replace(/&/gi,'%26');
46
+ },
47
+ escapeHTML: function(s) {
48
+ return s.toString().split('&').join('&amp;').split('<').join('&lt;').split('"').join('&quot;');
49
+ },
50
+ absolutizeUrl: function(url) {
51
+ var el = document.createElement('div');
52
+ el.innerHTML = '<a href="' + this.escapeHTML(url) + '">x</a>';
53
+ return el.firstChild.href;
54
+ },
55
+ getScriptPath: function(scriptNames) {
56
+ var
57
+ i = 0,
58
+ j,
59
+ path = '',
60
+ name = '',
61
+ script,
62
+ scripts = document.getElementsByTagName('script');
63
+
64
+ for (; i < scripts.length; i++) {
65
+ script = scripts[i].src;
66
+ for (j = 0; j < scriptNames.length; j++) {
67
+ name = scriptNames[j];
68
+ if (script.indexOf(name) > -1) {
69
+ path = script.substring(0, script.indexOf(name));
70
+ break;
71
+ }
72
+ }
73
+ if (path !== '') {
74
+ break;
75
+ }
76
+ }
77
+ return path;
78
+ },
79
+ secondsToTimeCode: function(time, forceHours, showFrameCount, fps) {
80
+ //add framecount
81
+ if (typeof showFrameCount == 'undefined') {
82
+ showFrameCount=false;
83
+ } else if(typeof fps == 'undefined') {
84
+ fps = 25;
85
+ }
86
+
87
+ var hours = Math.floor(time / 3600) % 24,
88
+ minutes = Math.floor(time / 60) % 60,
89
+ seconds = Math.floor(time % 60),
90
+ frames = Math.floor(((time % 1)*fps).toFixed(3)),
91
+ result =
92
+ ( (forceHours || hours > 0) ? (hours < 10 ? '0' + hours : hours) + ':' : '')
93
+ + (minutes < 10 ? '0' + minutes : minutes) + ':'
94
+ + (seconds < 10 ? '0' + seconds : seconds)
95
+ + ((showFrameCount) ? ':' + (frames < 10 ? '0' + frames : frames) : '');
96
+
97
+ return result;
98
+ },
99
+
100
+ timeCodeToSeconds: function(hh_mm_ss_ff, forceHours, showFrameCount, fps){
101
+ if (typeof showFrameCount == 'undefined') {
102
+ showFrameCount=false;
103
+ } else if(typeof fps == 'undefined') {
104
+ fps = 25;
105
+ }
106
+
107
+ var tc_array = hh_mm_ss_ff.split(":"),
108
+ tc_hh = parseInt(tc_array[0], 10),
109
+ tc_mm = parseInt(tc_array[1], 10),
110
+ tc_ss = parseInt(tc_array[2], 10),
111
+ tc_ff = 0,
112
+ tc_in_seconds = 0;
113
+
114
+ if (showFrameCount) {
115
+ tc_ff = parseInt(tc_array[3])/fps;
116
+ }
117
+
118
+ tc_in_seconds = ( tc_hh * 3600 ) + ( tc_mm * 60 ) + tc_ss + tc_ff;
119
+
120
+ return tc_in_seconds;
121
+ },
122
+
123
+ /* borrowed from SWFObject: http://code.google.com/p/swfobject/source/browse/trunk/swfobject/src/swfobject.js#474 */
124
+ removeSwf: function(id) {
125
+ var obj = document.getElementById(id);
126
+ if (obj && obj.nodeName == "OBJECT") {
127
+ if (mejs.MediaFeatures.isIE) {
128
+ obj.style.display = "none";
129
+ (function(){
130
+ if (obj.readyState == 4) {
131
+ mejs.Utility.removeObjectInIE(id);
132
+ } else {
133
+ setTimeout(arguments.callee, 10);
134
+ }
135
+ })();
136
+ } else {
137
+ obj.parentNode.removeChild(obj);
138
+ }
139
+ }
140
+ },
141
+ removeObjectInIE: function(id) {
142
+ var obj = document.getElementById(id);
143
+ if (obj) {
144
+ for (var i in obj) {
145
+ if (typeof obj[i] == "function") {
146
+ obj[i] = null;
147
+ }
148
+ }
149
+ obj.parentNode.removeChild(obj);
150
+ }
151
+ }
152
+ };
153
+
154
+
155
+ // Core detector, plugins are added below
156
+ mejs.PluginDetector = {
157
+
158
+ // main public function to test a plug version number PluginDetector.hasPluginVersion('flash',[9,0,125]);
159
+ hasPluginVersion: function(plugin, v) {
160
+ var pv = this.plugins[plugin];
161
+ v[1] = v[1] || 0;
162
+ v[2] = v[2] || 0;
163
+ 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;
164
+ },
165
+
166
+ // cached values
167
+ nav: window.navigator,
168
+ ua: window.navigator.userAgent.toLowerCase(),
169
+
170
+ // stored version numbers
171
+ plugins: [],
172
+
173
+ // runs detectPlugin() and stores the version number
174
+ addPlugin: function(p, pluginName, mimeType, activeX, axDetect) {
175
+ this.plugins[p] = this.detectPlugin(pluginName, mimeType, activeX, axDetect);
176
+ },
177
+
178
+ // get the version number from the mimetype (all but IE) or ActiveX (IE)
179
+ detectPlugin: function(pluginName, mimeType, activeX, axDetect) {
180
+
181
+ var version = [0,0,0],
182
+ description,
183
+ i,
184
+ ax;
185
+
186
+ // Firefox, Webkit, Opera
187
+ if (typeof(this.nav.plugins) != 'undefined' && typeof this.nav.plugins[pluginName] == 'object') {
188
+ description = this.nav.plugins[pluginName].description;
189
+ if (description && !(typeof this.nav.mimeTypes != 'undefined' && this.nav.mimeTypes[mimeType] && !this.nav.mimeTypes[mimeType].enabledPlugin)) {
190
+ version = description.replace(pluginName, '').replace(/^\s+/,'').replace(/\sr/gi,'.').split('.');
191
+ for (i=0; i<version.length; i++) {
192
+ version[i] = parseInt(version[i].match(/\d+/), 10);
193
+ }
194
+ }
195
+ // Internet Explorer / ActiveX
196
+ } else if (typeof(window.ActiveXObject) != 'undefined') {
197
+ try {
198
+ ax = new ActiveXObject(activeX);
199
+ if (ax) {
200
+ version = axDetect(ax);
201
+ }
202
+ }
203
+ catch (e) { }
204
+ }
205
+ return version;
206
+ }
207
+ };
208
+
209
+ // Add Flash detection
210
+ mejs.PluginDetector.addPlugin('flash','Shockwave Flash','application/x-shockwave-flash','ShockwaveFlash.ShockwaveFlash', function(ax) {
211
+ // adapted from SWFObject
212
+ var version = [],
213
+ d = ax.GetVariable("$version");
214
+ if (d) {
215
+ d = d.split(" ")[1].split(",");
216
+ version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
217
+ }
218
+ return version;
219
+ });
220
+
221
+ // Add Silverlight detection
222
+ mejs.PluginDetector.addPlugin('silverlight','Silverlight Plug-In','application/x-silverlight-2','AgControl.AgControl', function (ax) {
223
+ // Silverlight cannot report its version number to IE
224
+ // but it does have a isVersionSupported function, so we have to loop through it to get a version number.
225
+ // adapted from http://www.silverlightversion.com/
226
+ var v = [0,0,0,0],
227
+ loopMatch = function(ax, v, i, n) {
228
+ while(ax.isVersionSupported(v[0]+ "."+ v[1] + "." + v[2] + "." + v[3])){
229
+ v[i]+=n;
230
+ }
231
+ v[i] -= n;
232
+ };
233
+ loopMatch(ax, v, 0, 1);
234
+ loopMatch(ax, v, 1, 1);
235
+ loopMatch(ax, v, 2, 10000); // the third place in the version number is usually 5 digits (4.0.xxxxx)
236
+ loopMatch(ax, v, 2, 1000);
237
+ loopMatch(ax, v, 2, 100);
238
+ loopMatch(ax, v, 2, 10);
239
+ loopMatch(ax, v, 2, 1);
240
+ loopMatch(ax, v, 3, 1);
241
+
242
+ return v;
243
+ });
244
+ // add adobe acrobat
245
+ /*
246
+ PluginDetector.addPlugin('acrobat','Adobe Acrobat','application/pdf','AcroPDF.PDF', function (ax) {
247
+ var version = [],
248
+ d = ax.GetVersions().split(',')[0].split('=')[1].split('.');
249
+
250
+ if (d) {
251
+ version = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
252
+ }
253
+ return version;
254
+ });
255
+ */
256
+ // necessary detection (fixes for <IE9)
257
+ mejs.MediaFeatures = {
258
+ init: function() {
259
+ var
260
+ t = this,
261
+ d = document,
262
+ nav = mejs.PluginDetector.nav,
263
+ ua = mejs.PluginDetector.ua.toLowerCase(),
264
+ i,
265
+ v,
266
+ html5Elements = ['source','track','audio','video'];
267
+
268
+ // detect browsers (only the ones that have some kind of quirk we need to work around)
269
+ t.isiPad = (ua.match(/ipad/i) !== null);
270
+ t.isiPhone = (ua.match(/iphone/i) !== null);
271
+ t.isiOS = t.isiPhone || t.isiPad;
272
+ t.isAndroid = (ua.match(/android/i) !== null);
273
+ t.isBustedAndroid = (ua.match(/android 2\.[12]/) !== null);
274
+ t.isIE = (nav.appName.toLowerCase().indexOf("microsoft") != -1);
275
+ t.isChrome = (ua.match(/chrome/gi) !== null);
276
+ t.isFirefox = (ua.match(/firefox/gi) !== null);
277
+ t.isWebkit = (ua.match(/webkit/gi) !== null);
278
+ t.isGecko = (ua.match(/gecko/gi) !== null) && !t.isWebkit;
279
+ t.hasTouch = ('ontouchstart' in window);
280
+
281
+ // create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection
282
+ for (i=0; i<html5Elements.length; i++) {
283
+ v = document.createElement(html5Elements[i]);
284
+ }
285
+
286
+ t.supportsMediaTag = (typeof v.canPlayType !== 'undefined' || t.isBustedAndroid);
287
+
288
+ // detect native JavaScript fullscreen (Safari/Firefox only, Chrome still fails)
289
+
290
+ // iOS
291
+ t.hasSemiNativeFullScreen = (typeof v.webkitEnterFullscreen !== 'undefined');
292
+
293
+ // Webkit/firefox
294
+ t.hasWebkitNativeFullScreen = (typeof v.webkitRequestFullScreen !== 'undefined');
295
+ t.hasMozNativeFullScreen = (typeof v.mozRequestFullScreen !== 'undefined');
296
+
297
+ t.hasTrueNativeFullScreen = (t.hasWebkitNativeFullScreen || t.hasMozNativeFullScreen);
298
+ t.nativeFullScreenEnabled = t.hasTrueNativeFullScreen;
299
+ if (t.hasMozNativeFullScreen) {
300
+ t.nativeFullScreenEnabled = v.mozFullScreenEnabled;
301
+ }
302
+
303
+
304
+ if (this.isChrome) {
305
+ t.hasSemiNativeFullScreen = false;
306
+ }
307
+
308
+ if (t.hasTrueNativeFullScreen) {
309
+ t.fullScreenEventName = (t.hasWebkitNativeFullScreen) ? 'webkitfullscreenchange' : 'mozfullscreenchange';
310
+
311
+
312
+ t.isFullScreen = function() {
313
+ if (v.mozRequestFullScreen) {
314
+ return d.mozFullScreen;
315
+ } else if (v.webkitRequestFullScreen) {
316
+ return d.webkitIsFullScreen;
317
+ }
318
+ }
319
+
320
+ t.requestFullScreen = function(el) {
321
+
322
+ if (t.hasWebkitNativeFullScreen) {
323
+ el.webkitRequestFullScreen();
324
+ } else if (t.hasMozNativeFullScreen) {
325
+ el.mozRequestFullScreen();
326
+ }
327
+ }
328
+
329
+ t.cancelFullScreen = function() {
330
+ if (t.hasWebkitNativeFullScreen) {
331
+ document.webkitCancelFullScreen();
332
+ } else if (t.hasMozNativeFullScreen) {
333
+ document.mozCancelFullScreen();
334
+ }
335
+ }
336
+
337
+ }
338
+
339
+
340
+ // OS X 10.5 can't do this even if it says it can :(
341
+ if (t.hasSemiNativeFullScreen && ua.match(/mac os x 10_5/i)) {
342
+ t.hasNativeFullScreen = false;
343
+ t.hasSemiNativeFullScreen = false;
344
+ }
345
+
346
+ }
347
+ };
348
+ mejs.MediaFeatures.init();
349
+
350
+
351
+ /*
352
+ extension methods to <video> or <audio> object to bring it into parity with PluginMediaElement (see below)
353
+ */
354
+ mejs.HtmlMediaElement = {
355
+ pluginType: 'native',
356
+ isFullScreen: false,
357
+
358
+ setCurrentTime: function (time) {
359
+ this.currentTime = time;
360
+ },
361
+
362
+ setMuted: function (muted) {
363
+ this.muted = muted;
364
+ },
365
+
366
+ setVolume: function (volume) {
367
+ this.volume = volume;
368
+ },
369
+
370
+ // for parity with the plugin versions
371
+ stop: function () {
372
+ this.pause();
373
+ },
374
+
375
+ // This can be a url string
376
+ // or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
377
+ setSrc: function (url) {
378
+
379
+ // Fix for IE9 which can't set .src when there are <source> elements. Awesome, right?
380
+ var
381
+ existingSources = this.getElementsByTagName('source');
382
+ while (existingSources.length > 0){
383
+ this.removeChild(existingSources[0]);
384
+ }
385
+
386
+ if (typeof url == 'string') {
387
+ this.src = url;
388
+ } else {
389
+ var i, media;
390
+
391
+ for (i=0; i<url.length; i++) {
392
+ media = url[i];
393
+ if (this.canPlayType(media.type)) {
394
+ this.src = media.src;
395
+ }
396
+ }
397
+ }
398
+ },
399
+
400
+ setVideoSize: function (width, height) {
401
+ this.width = width;
402
+ this.height = height;
403
+ }
404
+ };
405
+
406
+ /*
407
+ Mimics the <video/audio> element by calling Flash's External Interface or Silverlights [ScriptableMember]
408
+ */
409
+ mejs.PluginMediaElement = function (pluginid, pluginType, mediaUrl) {
410
+ this.id = pluginid;
411
+ this.pluginType = pluginType;
412
+ this.src = mediaUrl;
413
+ this.events = {};
414
+ };
415
+
416
+ // JavaScript values and ExternalInterface methods that match HTML5 video properties methods
417
+ // http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/fl/video/FLVPlayback.html
418
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
419
+ mejs.PluginMediaElement.prototype = {
420
+
421
+ // special
422
+ pluginElement: null,
423
+ pluginType: '',
424
+ isFullScreen: false,
425
+
426
+ // not implemented :(
427
+ playbackRate: -1,
428
+ defaultPlaybackRate: -1,
429
+ seekable: [],
430
+ played: [],
431
+
432
+ // HTML5 read-only properties
433
+ paused: true,
434
+ ended: false,
435
+ seeking: false,
436
+ duration: 0,
437
+ error: null,
438
+
439
+ // HTML5 get/set properties, but only set (updated by event handlers)
440
+ muted: false,
441
+ volume: 1,
442
+ currentTime: 0,
443
+
444
+ // HTML5 methods
445
+ play: function () {
446
+ if (this.pluginApi != null) {
447
+ if (this.pluginType == 'youtube') {
448
+ this.pluginApi.playVideo();
449
+ } else {
450
+ this.pluginApi.playMedia();
451
+ }
452
+ this.paused = false;
453
+ }
454
+ },
455
+ load: function () {
456
+ if (this.pluginApi != null) {
457
+ if (this.pluginType == 'youtube') {
458
+ } else {
459
+ this.pluginApi.loadMedia();
460
+ }
461
+
462
+ this.paused = false;
463
+ }
464
+ },
465
+ pause: function () {
466
+ if (this.pluginApi != null) {
467
+ if (this.pluginType == 'youtube') {
468
+ this.pluginApi.pauseVideo();
469
+ } else {
470
+ this.pluginApi.pauseMedia();
471
+ }
472
+
473
+
474
+ this.paused = true;
475
+ }
476
+ },
477
+ stop: function () {
478
+ if (this.pluginApi != null) {
479
+ if (this.pluginType == 'youtube') {
480
+ this.pluginApi.stopVideo();
481
+ } else {
482
+ this.pluginApi.stopMedia();
483
+ }
484
+ this.paused = true;
485
+ }
486
+ },
487
+ canPlayType: function(type) {
488
+ var i,
489
+ j,
490
+ pluginInfo,
491
+ pluginVersions = mejs.plugins[this.pluginType];
492
+
493
+ for (i=0; i<pluginVersions.length; i++) {
494
+ pluginInfo = pluginVersions[i];
495
+
496
+ // test if user has the correct plugin version
497
+ if (mejs.PluginDetector.hasPluginVersion(this.pluginType, pluginInfo.version)) {
498
+
499
+ // test for plugin playback types
500
+ for (j=0; j<pluginInfo.types.length; j++) {
501
+ // find plugin that can play the type
502
+ if (type == pluginInfo.types[j]) {
503
+ return true;
504
+ }
505
+ }
506
+ }
507
+ }
508
+
509
+ return false;
510
+ },
511
+
512
+ positionFullscreenButton: function(x,y) {
513
+ if (this.pluginApi != null && this.pluginApi.positionFullscreenButton) {
514
+ this.pluginApi.positionFullscreenButton(x,y);
515
+ }
516
+ },
517
+
518
+ hideFullscreenButton: function() {
519
+ if (this.pluginApi != null && this.pluginApi.hideFullscreenButton) {
520
+ this.pluginApi.hideFullscreenButton();
521
+ }
522
+ },
523
+
524
+
525
+ // custom methods since not all JavaScript implementations support get/set
526
+
527
+ // This can be a url string
528
+ // or an array [{src:'file.mp4',type:'video/mp4'},{src:'file.webm',type:'video/webm'}]
529
+ setSrc: function (url) {
530
+ if (typeof url == 'string') {
531
+ this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(url));
532
+ this.src = mejs.Utility.absolutizeUrl(url);
533
+ } else {
534
+ var i, media;
535
+
536
+ for (i=0; i<url.length; i++) {
537
+ media = url[i];
538
+ if (this.canPlayType(media.type)) {
539
+ this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(media.src));
540
+ this.src = mejs.Utility.absolutizeUrl(url);
541
+ }
542
+ }
543
+ }
544
+
545
+ },
546
+ setCurrentTime: function (time) {
547
+ if (this.pluginApi != null) {
548
+ if (this.pluginType == 'youtube') {
549
+ this.pluginApi.seekTo(time);
550
+ } else {
551
+ this.pluginApi.setCurrentTime(time);
552
+ }
553
+
554
+
555
+
556
+ this.currentTime = time;
557
+ }
558
+ },
559
+ setVolume: function (volume) {
560
+ if (this.pluginApi != null) {
561
+ // same on YouTube and MEjs
562
+ if (this.pluginType == 'youtube') {
563
+ this.pluginApi.setVolume(volume * 100);
564
+ } else {
565
+ this.pluginApi.setVolume(volume);
566
+ }
567
+ this.volume = volume;
568
+ }
569
+ },
570
+ setMuted: function (muted) {
571
+ if (this.pluginApi != null) {
572
+ if (this.pluginType == 'youtube') {
573
+ if (muted) {
574
+ this.pluginApi.mute();
575
+ } else {
576
+ this.pluginApi.unMute();
577
+ }
578
+ this.muted = muted;
579
+ this.dispatchEvent('volumechange');
580
+ } else {
581
+ this.pluginApi.setMuted(muted);
582
+ }
583
+ this.muted = muted;
584
+ }
585
+ },
586
+
587
+ // additional non-HTML5 methods
588
+ setVideoSize: function (width, height) {
589
+
590
+ //if (this.pluginType == 'flash' || this.pluginType == 'silverlight') {
591
+ if ( this.pluginElement.style) {
592
+ this.pluginElement.style.width = width + 'px';
593
+ this.pluginElement.style.height = height + 'px';
594
+ }
595
+ if (this.pluginApi != null && this.pluginApi.setVideoSize) {
596
+ this.pluginApi.setVideoSize(width, height);
597
+ }
598
+ //}
599
+ },
600
+
601
+ setFullscreen: function (fullscreen) {
602
+ if (this.pluginApi != null && this.pluginApi.setFullscreen) {
603
+ this.pluginApi.setFullscreen(fullscreen);
604
+ }
605
+ },
606
+
607
+ enterFullScreen: function() {
608
+ if (this.pluginApi != null && this.pluginApi.setFullscreen) {
609
+ this.setFullscreen(true);
610
+ }
611
+
612
+ },
613
+
614
+ exitFullScreen: function() {
615
+ if (this.pluginApi != null && this.pluginApi.setFullscreen) {
616
+ this.setFullscreen(false);
617
+ }
618
+ },
619
+
620
+ // start: fake events
621
+ addEventListener: function (eventName, callback, bubble) {
622
+ this.events[eventName] = this.events[eventName] || [];
623
+ this.events[eventName].push(callback);
624
+ },
625
+ removeEventListener: function (eventName, callback) {
626
+ if (!eventName) { this.events = {}; return true; }
627
+ var callbacks = this.events[eventName];
628
+ if (!callbacks) return true;
629
+ if (!callback) { this.events[eventName] = []; return true; }
630
+ for (i = 0; i < callbacks.length; i++) {
631
+ if (callbacks[i] === callback) {
632
+ this.events[eventName].splice(i, 1);
633
+ return true;
634
+ }
635
+ }
636
+ return false;
637
+ },
638
+ dispatchEvent: function (eventName) {
639
+ var i,
640
+ args,
641
+ callbacks = this.events[eventName];
642
+
643
+ if (callbacks) {
644
+ args = Array.prototype.slice.call(arguments, 1);
645
+ for (i = 0; i < callbacks.length; i++) {
646
+ callbacks[i].apply(null, args);
647
+ }
648
+ }
649
+ },
650
+ // end: fake events
651
+
652
+ remove: function() {
653
+ mejs.Utility.removeSwf(this.pluginElement.id);
654
+ }
655
+ };
656
+
657
+ // Handles calls from Flash/Silverlight and reports them as native <video/audio> events and properties
658
+ mejs.MediaPluginBridge = {
659
+
660
+ pluginMediaElements:{},
661
+ htmlMediaElements:{},
662
+
663
+ registerPluginElement: function (id, pluginMediaElement, htmlMediaElement) {
664
+ this.pluginMediaElements[id] = pluginMediaElement;
665
+ this.htmlMediaElements[id] = htmlMediaElement;
666
+ },
667
+
668
+ // when Flash/Silverlight is ready, it calls out to this method
669
+ initPlugin: function (id) {
670
+
671
+ var pluginMediaElement = this.pluginMediaElements[id],
672
+ htmlMediaElement = this.htmlMediaElements[id];
673
+
674
+ if (pluginMediaElement) {
675
+ // find the javascript bridge
676
+ switch (pluginMediaElement.pluginType) {
677
+ case "flash":
678
+ pluginMediaElement.pluginElement = pluginMediaElement.pluginApi = document.getElementById(id);
679
+ break;
680
+ case "silverlight":
681
+ pluginMediaElement.pluginElement = document.getElementById(pluginMediaElement.id);
682
+ pluginMediaElement.pluginApi = pluginMediaElement.pluginElement.Content.MediaElementJS;
683
+ break;
684
+ }
685
+
686
+ if (pluginMediaElement.pluginApi != null && pluginMediaElement.success) {
687
+ pluginMediaElement.success(pluginMediaElement, htmlMediaElement);
688
+ }
689
+ }
690
+ },
691
+
692
+ // receives events from Flash/Silverlight and sends them out as HTML5 media events
693
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html
694
+ fireEvent: function (id, eventName, values) {
695
+
696
+ var
697
+ e,
698
+ i,
699
+ bufferedTime,
700
+ pluginMediaElement = this.pluginMediaElements[id];
701
+
702
+ pluginMediaElement.ended = false;
703
+ pluginMediaElement.paused = true;
704
+
705
+ // fake event object to mimic real HTML media event.
706
+ e = {
707
+ type: eventName,
708
+ target: pluginMediaElement
709
+ };
710
+
711
+ // attach all values to element and event object
712
+ for (i in values) {
713
+ pluginMediaElement[i] = values[i];
714
+ e[i] = values[i];
715
+ }
716
+
717
+ // fake the newer W3C buffered TimeRange (loaded and total have been removed)
718
+ bufferedTime = values.bufferedTime || 0;
719
+
720
+ e.target.buffered = e.buffered = {
721
+ start: function(index) {
722
+ return 0;
723
+ },
724
+ end: function (index) {
725
+ return bufferedTime;
726
+ },
727
+ length: 1
728
+ };
729
+
730
+ pluginMediaElement.dispatchEvent(e.type, e);
731
+ }
732
+ };
733
+
734
+ /*
735
+ Default options
736
+ */
737
+ mejs.MediaElementDefaults = {
738
+ // allows testing on HTML5, flash, silverlight
739
+ // auto: attempts to detect what the browser can do
740
+ // native: forces HTML5 playback
741
+ // shim: disallows HTML5, will attempt either Flash or Silverlight
742
+ // none: forces fallback view
743
+ mode: 'auto',
744
+ // remove or reorder to change plugin priority and availability
745
+ plugins: ['flash','silverlight','youtube','vimeo'],
746
+ // shows debug errors on screen
747
+ enablePluginDebug: false,
748
+ // overrides the type specified, useful for dynamic instantiation
749
+ type: '',
750
+ // path to Flash and Silverlight plugins
751
+ pluginPath: mejs.Utility.getScriptPath(['mediaelement.js','mediaelement.min.js','mediaelement-and-player.js','mediaelement-and-player.min.js']),
752
+ // name of flash file
753
+ flashName: 'flashmediaelement.swf',
754
+ // turns on the smoothing filter in Flash
755
+ enablePluginSmoothing: false,
756
+ // name of silverlight file
757
+ silverlightName: 'silverlightmediaelement.xap',
758
+ // default if the <video width> is not specified
759
+ defaultVideoWidth: 480,
760
+ // default if the <video height> is not specified
761
+ defaultVideoHeight: 270,
762
+ // overrides <video width>
763
+ pluginWidth: -1,
764
+ // overrides <video height>
765
+ pluginHeight: -1,
766
+ // rate in milliseconds for Flash and Silverlight to fire the timeupdate event
767
+ // larger number is less accurate, but less strain on plugin->JavaScript bridge
768
+ timerRate: 250,
769
+ // initial volume for player
770
+ startVolume: 0.8,
771
+ success: function () { },
772
+ error: function () { }
773
+ };
774
+
775
+ /*
776
+ Determines if a browser supports the <video> or <audio> element
777
+ and returns either the native element or a Flash/Silverlight version that
778
+ mimics HTML5 MediaElement
779
+ */
780
+ mejs.MediaElement = function (el, o) {
781
+ return mejs.HtmlMediaElementShim.create(el,o);
782
+ };
783
+
784
+ mejs.HtmlMediaElementShim = {
785
+
786
+ create: function(el, o) {
787
+ var
788
+ options = mejs.MediaElementDefaults,
789
+ htmlMediaElement = (typeof(el) == 'string') ? document.getElementById(el) : el,
790
+ tagName = htmlMediaElement.tagName.toLowerCase(),
791
+ isMediaTag = (tagName === 'audio' || tagName === 'video'),
792
+ src = (isMediaTag) ? htmlMediaElement.getAttribute('src') : htmlMediaElement.getAttribute('href'),
793
+ poster = htmlMediaElement.getAttribute('poster'),
794
+ autoplay = htmlMediaElement.getAttribute('autoplay'),
795
+ preload = htmlMediaElement.getAttribute('preload'),
796
+ controls = htmlMediaElement.getAttribute('controls'),
797
+ playback,
798
+ prop;
799
+
800
+ // extend options
801
+ for (prop in o) {
802
+ options[prop] = o[prop];
803
+ }
804
+
805
+ // clean up attributes
806
+ src = (typeof src == 'undefined' || src === null || src == '') ? null : src;
807
+ poster = (typeof poster == 'undefined' || poster === null) ? '' : poster;
808
+ preload = (typeof preload == 'undefined' || preload === null || preload === 'false') ? 'none' : preload;
809
+ autoplay = !(typeof autoplay == 'undefined' || autoplay === null || autoplay === 'false');
810
+ controls = !(typeof controls == 'undefined' || controls === null || controls === 'false');
811
+
812
+ // test for HTML5 and plugin capabilities
813
+ playback = this.determinePlayback(htmlMediaElement, options, mejs.MediaFeatures.supportsMediaTag, isMediaTag, src);
814
+ playback.url = (playback.url !== null) ? mejs.Utility.absolutizeUrl(playback.url) : '';
815
+
816
+ if (playback.method == 'native') {
817
+ // second fix for android
818
+ if (mejs.MediaFeatures.isBustedAndroid) {
819
+ htmlMediaElement.src = playback.url;
820
+ htmlMediaElement.addEventListener('click', function() {
821
+ htmlMediaElement.play();
822
+ }, false);
823
+ }
824
+
825
+ // add methods to native HTMLMediaElement
826
+ return this.updateNative(playback, options, autoplay, preload);
827
+ } else if (playback.method !== '') {
828
+ // create plugin to mimic HTMLMediaElement
829
+
830
+ return this.createPlugin( playback, options, poster, autoplay, preload, controls);
831
+ } else {
832
+ // boo, no HTML5, no Flash, no Silverlight.
833
+ this.createErrorMessage( playback, options, poster );
834
+
835
+ return this;
836
+ }
837
+ },
838
+
839
+ determinePlayback: function(htmlMediaElement, options, supportsMediaTag, isMediaTag, src) {
840
+ var
841
+ mediaFiles = [],
842
+ i,
843
+ j,
844
+ k,
845
+ l,
846
+ n,
847
+ type,
848
+ result = { method: '', url: '', htmlMediaElement: htmlMediaElement, isVideo: (htmlMediaElement.tagName.toLowerCase() != 'audio')},
849
+ pluginName,
850
+ pluginVersions,
851
+ pluginInfo,
852
+ dummy;
853
+
854
+ // STEP 1: Get URL and type from <video src> or <source src>
855
+
856
+ // supplied type overrides <video type> and <source type>
857
+ if (typeof options.type != 'undefined' && options.type !== '') {
858
+
859
+ // accept either string or array of types
860
+ if (typeof options.type == 'string') {
861
+ mediaFiles.push({type:options.type, url:src});
862
+ } else {
863
+
864
+ for (i=0; i<options.type.length; i++) {
865
+ mediaFiles.push({type:options.type[i], url:src});
866
+ }
867
+ }
868
+
869
+ // test for src attribute first
870
+ } else if (src !== null) {
871
+ type = this.formatType(src, htmlMediaElement.getAttribute('type'));
872
+ mediaFiles.push({type:type, url:src});
873
+
874
+ // then test for <source> elements
875
+ } else {
876
+ // test <source> types to see if they are usable
877
+ for (i = 0; i < htmlMediaElement.childNodes.length; i++) {
878
+ n = htmlMediaElement.childNodes[i];
879
+ if (n.nodeType == 1 && n.tagName.toLowerCase() == 'source') {
880
+ src = n.getAttribute('src');
881
+ type = this.formatType(src, n.getAttribute('type'));
882
+ mediaFiles.push({type:type, url:src});
883
+ }
884
+ }
885
+ }
886
+
887
+ // in the case of dynamicly created players
888
+ // check for audio types
889
+ if (!isMediaTag && mediaFiles.length > 0 && mediaFiles[0].url !== null && this.getTypeFromFile(mediaFiles[0].url).indexOf('audio') > -1) {
890
+ result.isVideo = false;
891
+ }
892
+
893
+
894
+ // STEP 2: Test for playback method
895
+
896
+ // special case for Android which sadly doesn't implement the canPlayType function (always returns '')
897
+ if (mejs.MediaFeatures.isBustedAndroid) {
898
+ htmlMediaElement.canPlayType = function(type) {
899
+ return (type.match(/video\/(mp4|m4v)/gi) !== null) ? 'maybe' : '';
900
+ };
901
+ }
902
+
903
+
904
+ // test for native playback first
905
+ if (supportsMediaTag && (options.mode === 'auto' || options.mode === 'native')) {
906
+
907
+ if (!isMediaTag) {
908
+
909
+ // create a real HTML5 Media Element
910
+ dummy = document.createElement( result.isVideo ? 'video' : 'audio');
911
+ htmlMediaElement.parentNode.insertBefore(dummy, htmlMediaElement);
912
+ htmlMediaElement.style.display = 'none';
913
+
914
+ // use this one from now on
915
+ result.htmlMediaElement = htmlMediaElement = dummy;
916
+ }
917
+
918
+ for (i=0; i<mediaFiles.length; i++) {
919
+ // normal check
920
+ if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
921
+ // special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
922
+ || htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== '') {
923
+ result.method = 'native';
924
+ result.url = mediaFiles[i].url;
925
+ break;
926
+ }
927
+ }
928
+
929
+ if (result.method === 'native') {
930
+ if (result.url !== null) {
931
+ htmlMediaElement.src = result.url;
932
+ }
933
+
934
+ return result;
935
+ }
936
+ }
937
+
938
+ // if native playback didn't work, then test plugins
939
+ if (options.mode === 'auto' || options.mode === 'shim') {
940
+ for (i=0; i<mediaFiles.length; i++) {
941
+ type = mediaFiles[i].type;
942
+
943
+ // test all plugins in order of preference [silverlight, flash]
944
+ for (j=0; j<options.plugins.length; j++) {
945
+
946
+ pluginName = options.plugins[j];
947
+
948
+ // test version of plugin (for future features)
949
+ pluginVersions = mejs.plugins[pluginName];
950
+
951
+ for (k=0; k<pluginVersions.length; k++) {
952
+ pluginInfo = pluginVersions[k];
953
+
954
+ // test if user has the correct plugin version
955
+
956
+ // for youtube/vimeo
957
+ if (pluginInfo.version == null ||
958
+
959
+ mejs.PluginDetector.hasPluginVersion(pluginName, pluginInfo.version)) {
960
+
961
+ // test for plugin playback types
962
+ for (l=0; l<pluginInfo.types.length; l++) {
963
+ // find plugin that can play the type
964
+ if (type == pluginInfo.types[l]) {
965
+ result.method = pluginName;
966
+ result.url = mediaFiles[i].url;
967
+ return result;
968
+ }
969
+ }
970
+ }
971
+ }
972
+ }
973
+ }
974
+ }
975
+
976
+ // what if there's nothing to play? just grab the first available
977
+ if (result.method === '' && mediaFiles.length > 0) {
978
+ result.url = mediaFiles[0].url;
979
+ }
980
+
981
+ return result;
982
+ },
983
+
984
+ formatType: function(url, type) {
985
+ var ext;
986
+
987
+ // if no type is supplied, fake it with the extension
988
+ if (url && !type) {
989
+ return this.getTypeFromFile(url);
990
+ } else {
991
+ // only return the mime part of the type in case the attribute contains the codec
992
+ // see http://www.whatwg.org/specs/web-apps/current-work/multipage/video.html#the-source-element
993
+ // `video/mp4; codecs="avc1.42E01E, mp4a.40.2"` becomes `video/mp4`
994
+
995
+ if (type && ~type.indexOf(';')) {
996
+ return type.substr(0, type.indexOf(';'));
997
+ } else {
998
+ return type;
999
+ }
1000
+ }
1001
+ },
1002
+
1003
+ getTypeFromFile: function(url) {
1004
+ var ext = url.substring(url.lastIndexOf('.') + 1);
1005
+ return (/(mp4|m4v|ogg|ogv|webm|flv|wmv|mpeg|mov)/gi.test(ext) ? 'video' : 'audio') + '/' + ext;
1006
+ },
1007
+
1008
+ createErrorMessage: function(playback, options, poster) {
1009
+ var
1010
+ htmlMediaElement = playback.htmlMediaElement,
1011
+ errorContainer = document.createElement('div');
1012
+
1013
+ errorContainer.className = 'me-cannotplay';
1014
+
1015
+ try {
1016
+ errorContainer.style.width = htmlMediaElement.width + 'px';
1017
+ errorContainer.style.height = htmlMediaElement.height + 'px';
1018
+ } catch (e) {}
1019
+
1020
+ errorContainer.innerHTML = (poster !== '') ?
1021
+ '<a href="' + playback.url + '"><img src="' + poster + '" /></a>' :
1022
+ '<a href="' + playback.url + '"><span>Download File</span></a>';
1023
+
1024
+ htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
1025
+ htmlMediaElement.style.display = 'none';
1026
+
1027
+ options.error(htmlMediaElement);
1028
+ },
1029
+
1030
+ createPlugin:function(playback, options, poster, autoplay, preload, controls) {
1031
+ var
1032
+ htmlMediaElement = playback.htmlMediaElement,
1033
+ width = 1,
1034
+ height = 1,
1035
+ pluginid = 'me_' + playback.method + '_' + (mejs.meIndex++),
1036
+ pluginMediaElement = new mejs.PluginMediaElement(pluginid, playback.method, playback.url),
1037
+ container = document.createElement('div'),
1038
+ specialIEContainer,
1039
+ node,
1040
+ initVars;
1041
+
1042
+ // check for placement inside a <p> tag (sometimes WYSIWYG editors do this)
1043
+ node = htmlMediaElement.parentNode;
1044
+ while (node !== null && node.tagName.toLowerCase() != 'body') {
1045
+ if (node.parentNode.tagName.toLowerCase() == 'p') {
1046
+ node.parentNode.parentNode.insertBefore(node, node.parentNode);
1047
+ break;
1048
+ }
1049
+ node = node.parentNode;
1050
+ }
1051
+
1052
+ if (playback.isVideo) {
1053
+ width = (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
1054
+ height = (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
1055
+
1056
+ // in case of '%' make sure it's encoded
1057
+ width = mejs.Utility.encodeUrl(width);
1058
+ height = mejs.Utility.encodeUrl(height);
1059
+
1060
+ } else {
1061
+ if (options.enablePluginDebug) {
1062
+ width = 320;
1063
+ height = 240;
1064
+ }
1065
+ }
1066
+
1067
+ // register plugin
1068
+ pluginMediaElement.success = options.success;
1069
+ mejs.MediaPluginBridge.registerPluginElement(pluginid, pluginMediaElement, htmlMediaElement);
1070
+
1071
+ // add container (must be added to DOM before inserting HTML for IE)
1072
+ container.className = 'me-plugin';
1073
+ container.id = pluginid + '_container';
1074
+
1075
+ if (playback.isVideo) {
1076
+ htmlMediaElement.parentNode.insertBefore(container, htmlMediaElement);
1077
+ } else {
1078
+ document.body.insertBefore(container, document.body.childNodes[0]);
1079
+ }
1080
+
1081
+ // flash/silverlight vars
1082
+ initVars = [
1083
+ 'id=' + pluginid,
1084
+ 'isvideo=' + ((playback.isVideo) ? "true" : "false"),
1085
+ 'autoplay=' + ((autoplay) ? "true" : "false"),
1086
+ 'preload=' + preload,
1087
+ 'width=' + width,
1088
+ 'startvolume=' + options.startVolume,
1089
+ 'timerrate=' + options.timerRate,
1090
+ 'height=' + height];
1091
+
1092
+ if (playback.url !== null) {
1093
+ if (playback.method == 'flash') {
1094
+ initVars.push('file=' + mejs.Utility.encodeUrl(playback.url));
1095
+ } else {
1096
+ initVars.push('file=' + playback.url);
1097
+ }
1098
+ }
1099
+ if (options.enablePluginDebug) {
1100
+ initVars.push('debug=true');
1101
+ }
1102
+ if (options.enablePluginSmoothing) {
1103
+ initVars.push('smoothing=true');
1104
+ }
1105
+ if (controls) {
1106
+ initVars.push('controls=true'); // shows controls in the plugin if desired
1107
+ }
1108
+
1109
+ switch (playback.method) {
1110
+ case 'silverlight':
1111
+ container.innerHTML =
1112
+ '<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="' + pluginid + '" name="' + pluginid + '" width="' + width + '" height="' + height + '">' +
1113
+ '<param name="initParams" value="' + initVars.join(',') + '" />' +
1114
+ '<param name="windowless" value="true" />' +
1115
+ '<param name="background" value="black" />' +
1116
+ '<param name="minRuntimeVersion" value="3.0.0.0" />' +
1117
+ '<param name="autoUpgrade" value="true" />' +
1118
+ '<param name="source" value="' + options.pluginPath + options.silverlightName + '" />' +
1119
+ '</object>';
1120
+ break;
1121
+
1122
+ case 'flash':
1123
+
1124
+ if (mejs.MediaFeatures.isIE) {
1125
+ specialIEContainer = document.createElement('div');
1126
+ container.appendChild(specialIEContainer);
1127
+ specialIEContainer.outerHTML =
1128
+ '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
1129
+ 'id="' + pluginid + '" width="' + width + '" height="' + height + '">' +
1130
+ '<param name="movie" value="' + options.pluginPath + options.flashName + '?x=' + (new Date()) + '" />' +
1131
+ '<param name="flashvars" value="' + initVars.join('&amp;') + '" />' +
1132
+ '<param name="quality" value="high" />' +
1133
+ '<param name="bgcolor" value="#000000" />' +
1134
+ '<param name="wmode" value="transparent" />' +
1135
+ '<param name="allowScriptAccess" value="always" />' +
1136
+ '<param name="allowFullScreen" value="true" />' +
1137
+ '</object>';
1138
+
1139
+ } else {
1140
+
1141
+ container.innerHTML =
1142
+ '<embed id="' + pluginid + '" name="' + pluginid + '" ' +
1143
+ 'play="true" ' +
1144
+ 'loop="false" ' +
1145
+ 'quality="high" ' +
1146
+ 'bgcolor="#000000" ' +
1147
+ 'wmode="transparent" ' +
1148
+ 'allowScriptAccess="always" ' +
1149
+ 'allowFullScreen="true" ' +
1150
+ 'type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" ' +
1151
+ 'src="' + options.pluginPath + options.flashName + '" ' +
1152
+ 'flashvars="' + initVars.join('&') + '" ' +
1153
+ 'width="' + width + '" ' +
1154
+ 'height="' + height + '"></embed>';
1155
+ }
1156
+ break;
1157
+
1158
+ case 'youtube':
1159
+
1160
+
1161
+ var
1162
+ videoId = playback.url.substr(playback.url.lastIndexOf('=')+1);
1163
+ youtubeSettings = {
1164
+ container: container,
1165
+ containerId: container.id,
1166
+ pluginMediaElement: pluginMediaElement,
1167
+ pluginId: pluginid,
1168
+ videoId: videoId,
1169
+ height: height,
1170
+ width: width
1171
+ };
1172
+
1173
+ if (mejs.PluginDetector.hasPluginVersion('flash', [10,0,0]) ) {
1174
+ mejs.YouTubeApi.createFlash(youtubeSettings);
1175
+ } else {
1176
+ mejs.YouTubeApi.enqueueIframe(youtubeSettings);
1177
+ }
1178
+
1179
+ break;
1180
+
1181
+ // DEMO Code. Does NOT work.
1182
+ case 'vimeo':
1183
+ console.log('vimeoid');
1184
+
1185
+ pluginMediaElement.vimeoid = playback.url.substr(playback.url.lastIndexOf('/')+1);
1186
+
1187
+ container.innerHTML =
1188
+ '<object width="' + width + '" height="' + height + '">' +
1189
+ '<param name="allowfullscreen" value="true" />' +
1190
+ '<param name="allowscriptaccess" value="always" />' +
1191
+ '<param name="flashvars" value="api=1" />' +
1192
+ '<param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=' + pluginMediaElement.vimeoid + '&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" />' +
1193
+ '<embed src="//vimeo.com/moogaloop.swf?api=1&amp;clip_id=' + pluginMediaElement.vimeoid + '&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="' + width + '" height="' + height + '"></embed>' +
1194
+ '</object>';
1195
+
1196
+ break;
1197
+ }
1198
+ // hide original element
1199
+ htmlMediaElement.style.display = 'none';
1200
+
1201
+ // FYI: options.success will be fired by the MediaPluginBridge
1202
+
1203
+ return pluginMediaElement;
1204
+ },
1205
+
1206
+ updateNative: function(playback, options, autoplay, preload) {
1207
+
1208
+ var htmlMediaElement = playback.htmlMediaElement,
1209
+ m;
1210
+
1211
+
1212
+ // add methods to video object to bring it into parity with Flash Object
1213
+ for (m in mejs.HtmlMediaElement) {
1214
+ htmlMediaElement[m] = mejs.HtmlMediaElement[m];
1215
+ }
1216
+
1217
+ /*
1218
+ Chrome now supports preload="none"
1219
+ if (mejs.MediaFeatures.isChrome) {
1220
+
1221
+ // special case to enforce preload attribute (Chrome doesn't respect this)
1222
+ if (preload === 'none' && !autoplay) {
1223
+
1224
+ // forces the browser to stop loading (note: fails in IE9)
1225
+ htmlMediaElement.src = '';
1226
+ htmlMediaElement.load();
1227
+ htmlMediaElement.canceledPreload = true;
1228
+
1229
+ htmlMediaElement.addEventListener('play',function() {
1230
+ if (htmlMediaElement.canceledPreload) {
1231
+ htmlMediaElement.src = playback.url;
1232
+ htmlMediaElement.load();
1233
+ htmlMediaElement.play();
1234
+ htmlMediaElement.canceledPreload = false;
1235
+ }
1236
+ }, false);
1237
+ // for some reason Chrome forgets how to autoplay sometimes.
1238
+ } else if (autoplay) {
1239
+ htmlMediaElement.load();
1240
+ htmlMediaElement.play();
1241
+ }
1242
+ }
1243
+ */
1244
+
1245
+ // fire success code
1246
+ options.success(htmlMediaElement, htmlMediaElement);
1247
+
1248
+ return htmlMediaElement;
1249
+ }
1250
+ };
1251
+
1252
+ /*
1253
+ - test on IE (object vs. embed)
1254
+ - determine when to use iframe (Firefox, Safari, Mobile) vs. Flash (Chrome, IE)
1255
+ - fullscreen?
1256
+ */
1257
+
1258
+ // YouTube Flash and Iframe API
1259
+ mejs.YouTubeApi = {
1260
+ isIframeStarted: false,
1261
+ isIframeLoaded: false,
1262
+ loadIframeApi: function() {
1263
+ if (!this.isIframeStarted) {
1264
+ var tag = document.createElement('script');
1265
+ tag.src = "http://www.youtube.com/player_api";
1266
+ var firstScriptTag = document.getElementsByTagName('script')[0];
1267
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
1268
+ this.isIframeStarted = true;
1269
+ }
1270
+ },
1271
+ iframeQueue: [],
1272
+ enqueueIframe: function(yt) {
1273
+
1274
+ if (this.isLoaded) {
1275
+ this.createIframe(yt);
1276
+ } else {
1277
+ this.loadIframeApi();
1278
+ this.iframeQueue.push(yt);
1279
+ }
1280
+ },
1281
+ createIframe: function(settings) {
1282
+
1283
+ var
1284
+ pluginMediaElement = settings.pluginMediaElement,
1285
+ player = new YT.Player(settings.containerId, {
1286
+ height: settings.height,
1287
+ width: settings.width,
1288
+ videoId: settings.videoId,
1289
+ playerVars: {controls:0},
1290
+ events: {
1291
+ 'onReady': function() {
1292
+
1293
+ // hook up iframe object to MEjs
1294
+ settings.pluginMediaElement.pluginApi = player;
1295
+
1296
+ // init mejs
1297
+ mejs.MediaPluginBridge.initPlugin(settings.pluginId);
1298
+
1299
+ // create timer
1300
+ setInterval(function() {
1301
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
1302
+ }, 250);
1303
+ },
1304
+ 'onStateChange': function(e) {
1305
+
1306
+ mejs.YouTubeApi.handleStateChange(e.data, player, pluginMediaElement);
1307
+
1308
+ }
1309
+ }
1310
+ });
1311
+ },
1312
+
1313
+ createEvent: function (player, pluginMediaElement, eventName) {
1314
+ var obj = {
1315
+ type: eventName,
1316
+ target: pluginMediaElement
1317
+ };
1318
+
1319
+ if (player && player.getDuration) {
1320
+
1321
+ // time
1322
+ pluginMediaElement.currentTime = obj.currentTime = player.getCurrentTime();
1323
+ pluginMediaElement.duration = obj.duration = player.getDuration();
1324
+
1325
+ // state
1326
+ obj.paused = pluginMediaElement.paused;
1327
+ obj.ended = pluginMediaElement.ended;
1328
+
1329
+ // sound
1330
+ obj.muted = player.isMuted();
1331
+ obj.volume = player.getVolume() / 100;
1332
+
1333
+ // progress
1334
+ obj.bytesTotal = player.getVideoBytesTotal();
1335
+ obj.bufferedBytes = player.getVideoBytesLoaded();
1336
+
1337
+ // fake the W3C buffered TimeRange
1338
+ var bufferedTime = obj.bufferedBytes / obj.bytesTotal * obj.duration;
1339
+
1340
+ obj.target.buffered = obj.buffered = {
1341
+ start: function(index) {
1342
+ return 0;
1343
+ },
1344
+ end: function (index) {
1345
+ return bufferedTime;
1346
+ },
1347
+ length: 1
1348
+ };
1349
+
1350
+ }
1351
+
1352
+ // send event up the chain
1353
+ pluginMediaElement.dispatchEvent(obj.type, obj);
1354
+ },
1355
+
1356
+ iFrameReady: function() {
1357
+
1358
+ this.isIframeLoaded = true;
1359
+
1360
+ while (this.iframeQueue.length > 0) {
1361
+ var settings = this.iframeQueue.pop();
1362
+ this.createIframe(settings);
1363
+ }
1364
+ },
1365
+
1366
+ // FLASH!
1367
+ flashPlayers: {},
1368
+ createFlash: function(settings) {
1369
+
1370
+ this.flashPlayers[settings.pluginId] = settings;
1371
+
1372
+ /*
1373
+ settings.container.innerHTML =
1374
+ '<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="//www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid=' + settings.pluginId + '&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0" ' +
1375
+ 'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; ">' +
1376
+ '<param name="allowScriptAccess" value="always">' +
1377
+ '<param name="wmode" value="transparent">' +
1378
+ '</object>';
1379
+ */
1380
+
1381
+ var specialIEContainer,
1382
+ youtubeUrl = 'http://www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid=' + settings.pluginId + '&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0';
1383
+
1384
+ if (mejs.MediaFeatures.isIE) {
1385
+
1386
+ specialIEContainer = document.createElement('div');
1387
+ settings.container.appendChild(specialIEContainer);
1388
+ specialIEContainer.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" ' +
1389
+ 'id="' + settings.pluginId + '" width="' + settings.width + '" height="' + settings.height + '">' +
1390
+ '<param name="movie" value="' + youtubeUrl + '" />' +
1391
+ '<param name="wmode" value="transparent" />' +
1392
+ '<param name="allowScriptAccess" value="always" />' +
1393
+ '<param name="allowFullScreen" value="true" />' +
1394
+ '</object>';
1395
+ } else {
1396
+ settings.container.innerHTML =
1397
+ '<object type="application/x-shockwave-flash" id="' + settings.pluginId + '" data="' + youtubeUrl + '" ' +
1398
+ 'width="' + settings.width + '" height="' + settings.height + '" style="visibility: visible; ">' +
1399
+ '<param name="allowScriptAccess" value="always">' +
1400
+ '<param name="wmode" value="transparent">' +
1401
+ '</object>';
1402
+ }
1403
+
1404
+ },
1405
+
1406
+ flashReady: function(id) {
1407
+ var
1408
+ settings = this.flashPlayers[id],
1409
+ player = document.getElementById(id),
1410
+ pluginMediaElement = settings.pluginMediaElement;
1411
+
1412
+ // hook up and return to MediaELementPlayer.success
1413
+ pluginMediaElement.pluginApi =
1414
+ pluginMediaElement.pluginElement = player;
1415
+ mejs.MediaPluginBridge.initPlugin(id);
1416
+
1417
+ // load the youtube video
1418
+ player.cueVideoById(settings.videoId);
1419
+
1420
+ var callbackName = settings.containerId + '_callback'
1421
+
1422
+ window[callbackName] = function(e) {
1423
+ mejs.YouTubeApi.handleStateChange(e, player, pluginMediaElement);
1424
+ }
1425
+
1426
+ player.addEventListener('onStateChange', callbackName);
1427
+
1428
+ setInterval(function() {
1429
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'timeupdate');
1430
+ }, 250);
1431
+ },
1432
+
1433
+ handleStateChange: function(youTubeState, player, pluginMediaElement) {
1434
+ switch (youTubeState) {
1435
+ case -1: // not started
1436
+ pluginMediaElement.paused = true;
1437
+ pluginMediaElement.ended = true;
1438
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'loadedmetadata');
1439
+ //createYouTubeEvent(player, pluginMediaElement, 'loadeddata');
1440
+ break;
1441
+ case 0:
1442
+ pluginMediaElement.paused = false;
1443
+ pluginMediaElement.ended = true;
1444
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'ended');
1445
+ break;
1446
+ case 1:
1447
+ pluginMediaElement.paused = false;
1448
+ pluginMediaElement.ended = false;
1449
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'play');
1450
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'playing');
1451
+ break;
1452
+ case 2:
1453
+ pluginMediaElement.paused = true;
1454
+ pluginMediaElement.ended = false;
1455
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'pause');
1456
+ break;
1457
+ case 3: // buffering
1458
+ mejs.YouTubeApi.createEvent(player, pluginMediaElement, 'progress');
1459
+ break;
1460
+ case 5:
1461
+ // cued?
1462
+ break;
1463
+
1464
+ }
1465
+
1466
+ }
1467
+ }
1468
+ // IFRAME
1469
+ function onYouTubePlayerAPIReady() {
1470
+ mejs.YouTubeApi.iFrameReady();
1471
+ }
1472
+ // FLASH
1473
+ function onYouTubePlayerReady(id) {
1474
+ mejs.YouTubeApi.flashReady(id);
1475
+ }
1476
+
1477
+ window.mejs = mejs;
1478
+ window.MediaElement = mejs.MediaElement;
mediaelement/mediaelement.min.js ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.5.0";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"]}],youtube:[{version:null,types:["video/youtube"]}],vimeo:[{version:null,types:["video/vimeo"]}]};
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="",g,f=document.getElementsByTagName("script");b<f.length;b++){g=f[b].src;for(c=0;c<a.length;c++){e=a[c];if(g.indexOf(e)>-1){d=g.substring(0,
15
+ g.indexOf(e));break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,g=Math.floor(a/60)%60,f=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(g<10?"0"+g:g)+":"+(f<10?"0"+f:f)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;a=a.split(":");b=parseInt(a[0],10);var e=parseInt(a[1],
16
+ 10),g=parseInt(a[2],10),f=0,j=0;if(c)f=parseInt(a[3])/d;return j=b*3600+e*60+g+f},removeSwf:function(a){var b=document.getElementById(a);if(b&&b.nodeName=="OBJECT")if(mejs.MediaFeatures.isIE){b.style.display="none";(function(){b.readyState==4?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)})()}else b.parentNode.removeChild(b)},removeObjectInIE:function(a){if(a=document.getElementById(a)){for(var b in a)if(typeof a[b]=="function")a[b]=null;a.parentNode.removeChild(a)}}};
17
+ 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],g;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
18
+ !(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(g=new ActiveXObject(c))e=d(g)}catch(f){}return e}};
19
+ 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});
20
+ 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,g,f){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[g]+=f;e[g]-=f};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});
21
+ mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,g=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==
22
+ null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit;a.hasTouch="ontouchstart"in window;for(c=0;c<g.length;c++)e=document.createElement(g[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";a.hasMozNativeFullScreen=typeof e.mozRequestFullScreen!=="undefined";a.hasTrueNativeFullScreen=a.hasWebkitNativeFullScreen||a.hasMozNativeFullScreen;
23
+ a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=e.mozFullScreenEnabled;if(this.isChrome)a.hasSemiNativeFullScreen=false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;else if(e.webkitRequestFullScreen)return b.webkitIsFullScreen};a.requestFullScreen=function(f){if(a.hasWebkitNativeFullScreen)f.webkitRequestFullScreen();
24
+ else a.hasMozNativeFullScreen&&f.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
25
+ 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){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if(typeof a=="string")this.src=a;else{var 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}};
26
+ mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={}};
27
+ 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.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=false}},
28
+ pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():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},
29
+ positionFullscreenButton:function(a,b){this.pluginApi!=null&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(a,b)},hideFullscreenButton:function(){this.pluginApi!=null&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},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=a[b];if(this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src));
30
+ this.src=mejs.Utility.absolutizeUrl(a)}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.setVolume(a*100):this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){if(this.pluginType=="youtube"){a?this.pluginApi.mute():this.pluginApi.unMute();this.muted=a;this.dispatchEvent("volumechange")}else this.pluginApi.setMuted(a);
31
+ this.muted=a}},setVideoSize:function(a,b){if(this.pluginElement.style){this.pluginElement.style.width=a+"px";this.pluginElement.style.height=b+"px"}this.pluginApi!=null&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.setFullscreen(true)},exitFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&
32
+ this.setFullscreen(false)},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},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)}},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id)}};
33
+ 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];if(b){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,
34
+ 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)}};
35
+ mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],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,startVolume:0.8,success:function(){},error:function(){}};
36
+ mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
37
+ mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),g=e==="audio"||e==="video",f=g?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var j=d.getAttribute("autoplay"),h=d.getAttribute("preload"),l=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];f=typeof f=="undefined"||f===null||f==""?null:f;e=typeof e=="undefined"||e===null?"":e;h=typeof h=="undefined"||h===null||h==="false"?
38
+ "none":h;j=!(typeof j=="undefined"||j===null||j==="false");l=!(typeof l=="undefined"||l===null||l==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,g,f);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},false)}return this.updateNative(k,c,j,h)}else if(k.method!=="")return this.createPlugin(k,c,e,j,h,l);else{this.createErrorMessage(k,c,e);return this}},
39
+ determinePlayback:function(a,b,c,d,e){var g=[],f,j,h={method:"",url:"",htmlMediaElement:a,isVideo:a.tagName.toLowerCase()!="audio"},l,k;if(typeof b.type!="undefined"&&b.type!=="")if(typeof b.type=="string")g.push({type:b.type,url:e});else for(f=0;f<b.type.length;f++)g.push({type:b.type[f],url:e});else if(e!==null){j=this.formatType(e,a.getAttribute("type"));g.push({type:j,url:e})}else for(f=0;f<a.childNodes.length;f++){j=a.childNodes[f];if(j.nodeType==1&&j.tagName.toLowerCase()=="source"){e=j.getAttribute("src");
40
+ j=this.formatType(e,j.getAttribute("type"));g.push({type:j,url:e})}}if(!d&&g.length>0&&g[0].url!==null&&this.getTypeFromFile(g[0].url).indexOf("audio")>-1)h.isVideo=false;if(mejs.MediaFeatures.isBustedAndroid)a.canPlayType=function(m){return m.match(/video\/(mp4|m4v)/gi)!==null?"maybe":""};if(c&&(b.mode==="auto"||b.mode==="native")){if(!d){f=document.createElement(h.isVideo?"video":"audio");a.parentNode.insertBefore(f,a);a.style.display="none";h.htmlMediaElement=a=f}for(f=0;f<g.length;f++)if(a.canPlayType(g[f].type).replace(/no/,
41
+ "")!==""||a.canPlayType(g[f].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){h.method="native";h.url=g[f].url;break}if(h.method==="native"){if(h.url!==null)a.src=h.url;return h}}if(b.mode==="auto"||b.mode==="shim")for(f=0;f<g.length;f++){j=g[f].type;for(a=0;a<b.plugins.length;a++){e=b.plugins[a];l=mejs.plugins[e];for(c=0;c<l.length;c++){k=l[c];if(k.version==null||mejs.PluginDetector.hasPluginVersion(e,k.version))for(d=0;d<k.types.length;d++)if(j==k.types[d]){h.method=e;h.url=g[f].url;return h}}}}if(h.method===
42
+ ""&&g.length>0)h.url=g[0].url;return h},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},getTypeFromFile:function(a){a=a.substring(a.lastIndexOf(".")+1);return(/(mp4|m4v|ogg|ogv|webm|flv|wmv|mpeg|mov)/gi.test(a)?"video":"audio")+"/"+a},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className="me-cannotplay";try{e.style.width=d.width+"px";e.style.height=d.height+"px"}catch(g){}e.innerHTML=c!==
43
+ ""?'<a href="'+a.url+'"><img src="'+c+'" /></a>':'<a href="'+a.url+'"><span>Download File</span></a>';d.parentNode.insertBefore(e,d);d.style.display="none";b.error(d)},createPlugin:function(a,b,c,d,e,g){c=a.htmlMediaElement;var f=1,j=1,h="me_"+a.method+"_"+mejs.meIndex++,l=new mejs.PluginMediaElement(h,a.method,a.url),k=document.createElement("div"),m;for(m=c.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);
44
+ break}m=m.parentNode}if(a.isVideo){f=b.videoWidth>0?b.videoWidth:c.getAttribute("width")!==null?c.getAttribute("width"):b.defaultVideoWidth;j=b.videoHeight>0?b.videoHeight:c.getAttribute("height")!==null?c.getAttribute("height"):b.defaultVideoHeight;f=mejs.Utility.encodeUrl(f);j=mejs.Utility.encodeUrl(j)}else if(b.enablePluginDebug){f=320;j=240}l.success=b.success;mejs.MediaPluginBridge.registerPluginElement(h,l,c);k.className="me-plugin";k.id=h+"_container";a.isVideo?c.parentNode.insertBefore(k,
45
+ c):document.body.insertBefore(k,document.body.childNodes[0]);d=["id="+h,"isvideo="+(a.isVideo?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+f,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"height="+j];if(a.url!==null)a.method=="flash"?d.push("file="+mejs.Utility.encodeUrl(a.url)):d.push("file="+a.url);b.enablePluginDebug&&d.push("debug=true");b.enablePluginSmoothing&&d.push("smoothing=true");g&&d.push("controls=true");switch(a.method){case "silverlight":k.innerHTML=
46
+ '<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+h+'" name="'+h+'" width="'+f+'" height="'+j+'"><param name="initParams" value="'+d.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){a=document.createElement("div");
47
+ k.appendChild(a);a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+h+'" width="'+f+'" height="'+j+'"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+d.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 k.innerHTML=
48
+ '<embed id="'+h+'" name="'+h+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+d.join("&")+'" width="'+f+'" height="'+j+'"></embed>';break;case "youtube":b=a.url.substr(a.url.lastIndexOf("=")+1);youtubeSettings={container:k,containerId:k.id,pluginMediaElement:l,pluginId:h,videoId:b,
49
+ height:j,width:f};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":console.log("vimeoid");l.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1);k.innerHTML='<object width="'+f+'" height="'+j+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="flashvars" value="api=1" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id='+
50
+ l.vimeoid+'&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="//vimeo.com/moogaloop.swf?api=1&amp;clip_id='+l.vimeoid+'&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+f+'" height="'+j+'"></embed></object>'}c.style.display=
51
+ "none";return l},updateNative:function(a,b){var c=a.htmlMediaElement,d;for(d in mejs.HtmlMediaElement)c[d]=mejs.HtmlMediaElement[d];b.success(c,c);return c}};
52
+ mejs.YouTubeApi={isIframeStarted:false,isIframeLoaded:false,loadIframeApi:function(){if(!this.isIframeStarted){var a=document.createElement("script");a.src="http://www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);this.isIframeStarted=true}},iframeQueue:[],enqueueIframe:function(a){if(this.isLoaded)this.createIframe(a);else{this.loadIframeApi();this.iframeQueue.push(a)}},createIframe:function(a){var b=a.pluginMediaElement,c=new YT.Player(a.containerId,
53
+ {height:a.height,width:a.width,videoId:a.videoId,playerVars:{controls:0},events:{onReady:function(){a.pluginMediaElement.pluginApi=c;mejs.MediaPluginBridge.initPlugin(a.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(c,b,"timeupdate")},250)},onStateChange:function(d){mejs.YouTubeApi.handleStateChange(d.data,c,b)}}})},createEvent:function(a,b,c){c={type:c,target:b};if(a&&a.getDuration){b.currentTime=c.currentTime=a.getCurrentTime();b.duration=c.duration=a.getDuration();c.paused=b.paused;
54
+ c.ended=b.ended;c.muted=a.isMuted();c.volume=a.getVolume()/100;c.bytesTotal=a.getVideoBytesTotal();c.bufferedBytes=a.getVideoBytesLoaded();var d=c.bufferedBytes/c.bytesTotal*c.duration;c.target.buffered=c.buffered={start:function(){return 0},end:function(){return d},length:1}}b.dispatchEvent(c.type,c)},iFrameReady:function(){for(this.isIframeLoaded=true;this.iframeQueue.length>0;)this.createIframe(this.iframeQueue.pop())},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=a;var b,
55
+ c="http://www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid="+a.pluginId+"&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0";if(mejs.MediaFeatures.isIE){b=document.createElement("div");a.container.appendChild(b);b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'"><param name="movie" value="'+c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else a.container.innerHTML=
56
+ '<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; "><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c;mejs.MediaPluginBridge.initPlugin(a);c.cueVideoById(b.videoId);a=b.containerId+"_callback";window[a]=function(e){mejs.YouTubeApi.handleStateChange(e,
57
+ c,d)};c.addEventListener("onStateChange",a);setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250)},handleStateChange:function(a,b,c){switch(a){case -1:c.paused=true;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=false;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=false;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"play");mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=true;c.ended=false;mejs.YouTubeApi.createEvent(b,
58
+ c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress")}}};function onYouTubePlayerAPIReady(){mejs.YouTubeApi.iFrameReady()}function onYouTubePlayerReady(a){mejs.YouTubeApi.flashReady(a)}window.mejs=mejs;window.MediaElement=mejs.MediaElement;
mediaelement/mediaelementplayer.css CHANGED
@@ -1,623 +1,772 @@
1
- .mejs-container {
2
- position: relative;
3
- background: #000;
4
- font-family: Helvetica, Arial;
5
- }
6
-
7
- .mejs-embed, .mejs-embed body {
8
- width: 100%;
9
- height: 100%;
10
- margin: 0;
11
- padding: 0;
12
- background: #000;
13
- overflow: hidden;
14
- }
15
-
16
- .mejs-container-fullscreen {
17
- position: fixed;
18
- left: 0;
19
- top: 0;
20
- right: 0;
21
- bottom: 0;
22
- overflow: hidden;
23
- z-index: 1000;
24
- }
25
- .mejs-container-fullscreen .mejs-mediaelement,
26
- .mejs-container-fullscreen video {
27
- width: 100%;
28
- height: 100%;
29
- }
30
-
31
- /* Start: LAYERS */
32
- .mejs-background {
33
- position: absolute;
34
- top: 0;
35
- left: 0;
36
- }
37
- .mejs-mediaelement {
38
- position: absolute;
39
- top: 0;
40
- left: 0;
41
- width: 100%;
42
- height: 100%;
43
- }
44
- .mejs-poster {
45
- position: absolute;
46
- top: 0;
47
- left: 0;
48
- }
49
- .mejs-overlay {
50
- position: absolute;
51
- top: 0;
52
- left: 0;
53
- }
54
- .mejs-overlay-play {
55
- cursor: pointer;
56
- }
57
- .mejs-overlay-button {
58
- position: absolute;
59
- top: 50%;
60
- left: 50%;
61
- width: 100px;
62
- height: 100px;
63
- margin: -50px 0 0 -50px;
64
- background: url(bigplay.png) top left no-repeat;
65
- }
66
- .mejs-overlay:hover .mejs-overlay-button{
67
- background-position: 0 -100px ;
68
- }
69
- .mejs-overlay-loading {
70
- position: absolute;
71
- top: 50%;
72
- left: 50%;
73
- width: 80px;
74
- height: 80px;
75
- margin: -40px 0 0 -40px;
76
- background: #333;
77
- background: url(background.png);
78
- background: rgba(0, 0, 0, 0.9);
79
- background: -webkit-gradient(linear, left top, left bottom, from(rgba(50,50,50,0.9)), to(rgba(0,0,0,0.9)));
80
- background: -moz-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
81
- background: linear-gradient(rgba(50,50,50,0.9), rgba(0,0,0,0.9));
82
- }
83
- .mejs-overlay-loading span {
84
- display:block;
85
- width: 80px;
86
- height: 80px;
87
- background: transparent url(loading.gif) center center no-repeat;
88
- }
89
-
90
- /* End: LAYERS */
91
-
92
- /* Start: CONTROL BAR */
93
- .mejs-container .mejs-controls {
94
- position: absolute;
95
- background: none;
96
- list-style-type: none;
97
- margin: 0;
98
- padding: 0;
99
- bottom: 0;
100
- left: 0;
101
- background: url(background.png);
102
- background: rgba(0, 0, 0, 0.7);
103
- background: -webkit-gradient(linear, left top, left bottom, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
104
- background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
105
- background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
106
- height: 30px;
107
- width: 100%;
108
- }
109
- .mejs-container .mejs-controls div {
110
- list-style-type: none;
111
- background-image: none;
112
- display: block;
113
- float: left;
114
- margin: 0;
115
- padding: 0;
116
- width: 26px;
117
- height: 26px;
118
- font-size: 11px;
119
- line-height: 11px;
120
- background: 0;
121
- font-family: Helvetica, Arial;
122
- border: 0;
123
- }
124
-
125
- .mejs-controls .mejs-button button {
126
- cursor: pointer;
127
- display: block;
128
- font-size: 0px;
129
- line-height: 0;
130
- text-decoration: none;
131
- margin: 7px 5px;
132
- padding: 0;
133
- position: absolute;
134
- height: 16px;
135
- width: 16px;
136
- border: 0;
137
- background: transparent url(controls.png) 0 0 no-repeat;
138
- }
139
-
140
- /* :focus for accessibility */
141
- .mejs-controls .mejs-button button:focus {
142
- outline: solid 1px yellow;
143
- }
144
-
145
- /* End: CONTROL BAR */
146
-
147
- /* Start: Time (current / duration) */
148
- .mejs-container .mejs-controls .mejs-time {
149
- color: #fff;
150
- display: block;
151
- height: 17px;
152
- width: auto;
153
- padding: 8px 3px 0 3px ;
154
- overflow: hidden;
155
- text-align: center;
156
- padding: auto 4px;
157
- }
158
- .mejs-container .mejs-controls .mejs-time span {
159
- font-size: 11px;
160
- color: #fff;
161
- line-height: 12px;
162
- display: block;
163
- float: left;
164
- margin: 1px 2px 0 0;
165
- width: auto;
166
- }
167
- /* End: Time (current / duration) */
168
-
169
-
170
- /* Start: Play/pause */
171
- .mejs-controls .mejs-play button {
172
- background-position:0 0;
173
- }
174
- .mejs-controls .mejs-pause button {
175
- background-position:0 -16px;
176
- }
177
- /* End: Play/pause */
178
-
179
-
180
- /* Stop */
181
- .mejs-controls .mejs-stop button {
182
- background-position: -112px 0;
183
- }
184
- /* End: Play/pause */
185
-
186
- /* Start: Progress bar */
187
- .mejs-controls div.mejs-time-rail {
188
- width: 200px;
189
- padding-top: 5px;
190
- }
191
- .mejs-controls .mejs-time-rail span {
192
- display: block;
193
- position: absolute;
194
- width: 180px;
195
- height: 10px;
196
- -webkit-border-radius: 2px;
197
- -moz-border-radius: 2px;
198
- border-radius: 2px;
199
- cursor: pointer;
200
- }
201
- .mejs-controls .mejs-time-rail .mejs-time-total {
202
- margin: 5px;
203
- background: #333;
204
- background: rgba(50,50,50,0.8);
205
- background: -webkit-gradient(linear, left top, left bottom, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
206
- background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
207
- background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
208
- filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#1E1E1E,endColorstr=#3C3C3C);
209
- }
210
- .mejs-controls .mejs-time-rail .mejs-time-loaded {
211
- background: #3caac8;
212
- background: rgba(60,170,200,0.8);
213
- background: -webkit-gradient(linear, left top, left bottom, from(rgba(44,124,145,0.8)), to(rgba(78,183,212,0.8)));
214
- background: -moz-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
215
- background: linear-gradient(rgba(44,124,145,0.8), rgba(78,183,212,0.8));
216
- filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#2C7C91,endColorstr=#4EB7D4);
217
- width: 0;
218
- }
219
- .mejs-controls .mejs-time-rail .mejs-time-current {
220
- width: 0;
221
- background: #fff;
222
- background: rgba(255,255,255,0.8);
223
- background: -webkit-gradient(linear, left top, left bottom, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
224
- background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
225
- filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#FFFFFF,endColorstr=#C8C8C8);
226
- }
227
-
228
- .mejs-controls .mejs-time-rail .mejs-time-handle {
229
- display: none;
230
- position: absolute;
231
- margin: 0;
232
- width: 10px;
233
- background: #fff;
234
- -webkit-border-radius: 5px;
235
- -moz-border-radius: 5px;
236
- border-radius: 5px;
237
- cursor: pointer;
238
- border: solid 2px #333;
239
- top: -2px;
240
- text-align: center;
241
- }
242
-
243
- .mejs-controls .mejs-time-rail .mejs-time-float {
244
- visibility: hidden;
245
- position: absolute;
246
- display: block;
247
- background: #eee;
248
- width: 36px;
249
- height: 17px;
250
- border: solid 1px #333;
251
- top: -26px;
252
- margin-left: -18px;
253
- text-align: center;
254
- color: #111;
255
- }
256
- .mejs-controls .mejs-time-total:hover .mejs-time-float {
257
- visibility: visible;
258
- }
259
- .mejs-controls .mejs-time-rail .mejs-time-float-current {
260
- margin: 2px;
261
- width: 30px;
262
- display: block;
263
- text-align: center;
264
- left: 0;
265
- }
266
- .mejs-controls .mejs-time-rail .mejs-time-float-corner {
267
- position: absolute;
268
- display: block;
269
- width: 0;
270
- height: 0;
271
- line-height: 0;
272
- border: solid 5px #eee;
273
- border-color: #eee transparent transparent transparent;
274
- -webkit-border-radius: 0;
275
- -moz-border-radius: 0;
276
- border-radius: 0;
277
- top: 15px;
278
- left: 13px;
279
-
280
- }
281
-
282
-
283
-
284
-
285
- /*
286
- .mejs-controls .mejs-time-rail:hover .mejs-time-handle {
287
- visibility:visible;
288
- }
289
- */
290
- /* End: Progress bar */
291
-
292
- /* Start: Fullscreen */
293
- .mejs-controls .mejs-fullscreen-button button {
294
- background-position:-32px 0;
295
- }
296
- .mejs-controls .mejs-unfullscreen button {
297
- background-position:-32px -16px;
298
- }
299
- /* End: Fullscreen */
300
-
301
-
302
- /* Start: Mute/Volume */
303
- .mejs-controls .mejs-volume-button {
304
- }
305
-
306
- .mejs-controls .mejs-mute button {
307
- background-position:-16px -16px;
308
- }
309
-
310
- .mejs-controls .mejs-unmute button {
311
- background-position:-16px 0;
312
- }
313
-
314
- .mejs-controls .mejs-volume-button {
315
- position: relative;
316
- }
317
-
318
- .mejs-controls .mejs-volume-button .mejs-volume-slider {
319
- display: none;
320
- height: 115px;
321
- width: 25px;
322
- background: url(background.png);
323
- background: rgba(50, 50, 50, 0.7);
324
- -webkit-border-radius: 0;
325
- -moz-border-radius: 0;
326
- border-radius: 0;
327
- top: -115px;
328
- left: 0;
329
- z-index: 1;
330
- position: absolute;
331
- margin: 0;
332
- }
333
- .mejs-controls .mejs-volume-button:hover {
334
- -webkit-border-radius: 0 0 4px 4px ;
335
- -moz-border-radius: 0 0 4px 4px ;
336
- border-radius: 0 0 4px 4px ;
337
- }
338
- /*
339
- .mejs-controls .mejs-volume-button:hover .mejs-volume-slider {
340
- display: block;
341
- }
342
- */
343
-
344
- .mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total {
345
- position: absolute;
346
- left: 11px;
347
- top: 8px;
348
- width: 2px;
349
- height: 100px;
350
- background: #ddd;
351
- background: rgba(255, 255, 255, 0.5);
352
- margin: 0;
353
- }
354
-
355
- .mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current {
356
- position: absolute;
357
- left: 11px;
358
- top: 8px;
359
- width: 2px;
360
- height: 100px;
361
- background: #ddd;
362
- background: rgba(255, 255, 255, 0.9);
363
- margin: 0;
364
- }
365
-
366
- .mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle {
367
- position: absolute;
368
- left: 4px;
369
- top: -3px;
370
- width: 16px;
371
- height: 6px;
372
- background: #ddd;
373
- background: rgba(255, 255, 255, 0.9);
374
- cursor: N-resize;
375
- -webkit-border-radius: 1px;
376
- -moz-border-radius: 1px;
377
- border-radius: 1px;
378
- margin: 0;
379
- }
380
-
381
- /* End: Mute/Volume */
382
-
383
-
384
-
385
-
386
- /* Start: TRACK (Captions and Chapters) */
387
- .mejs-controls .mejs-captions-button {
388
- position: relative;
389
- }
390
-
391
- .mejs-controls .mejs-captions-button button {
392
- background-position:-48px 0;
393
- }
394
- .mejs-controls .mejs-captions-button .mejs-captions-selector {
395
- visibility: hidden;
396
- position: absolute;
397
- bottom: 26px;
398
- right: -10px;
399
- width: 130px;
400
- height: 100px;
401
- background: url(background.png);
402
- background: rgba(50,50,50,0.7);
403
- border: solid 1px transparent;
404
- padding: 10px;
405
- overflow: hidden;
406
- -webkit-border-radius: 0;
407
- -moz-border-radius: 0;
408
- border-radius: 0;
409
- }
410
- /*
411
- .mejs-controls .mejs-captions-button:hover .mejs-captions-selector {
412
- visibility: visible;
413
- }
414
- */
415
-
416
- .mejs-controls .mejs-captions-button .mejs-captions-selector ul {
417
- margin: 0;
418
- padding: 0;
419
- display: block;
420
- list-style-type: none !important;
421
- overflow: hidden;
422
- }
423
- .mejs-controls .mejs-captions-button .mejs-captions-selector ul li{
424
- margin: 0 0 6px 0;
425
- padding: 0;
426
- list-style-type: none !important;
427
- display:block;
428
- color: #fff;
429
- overflow: hidden;
430
- }
431
- .mejs-controls .mejs-captions-button .mejs-captions-selector ul li input{
432
- clear: both;
433
- float: left;
434
- margin: 3px 3px 0px 5px;
435
- }
436
- .mejs-controls .mejs-captions-button .mejs-captions-selector ul li label{
437
- width: 100px;
438
- float: left;
439
- padding: 4px 0 0 0;
440
- line-height: 15px;
441
- font-family: helvetica, arial;
442
- font-size: 10px;
443
- }
444
-
445
- .mejs-controls .mejs-captions-button .mejs-captions-translations {
446
- font-size: 10px;
447
- margin: 0 0 5px 0;
448
- }
449
-
450
-
451
- .mejs-chapters {
452
- position: absolute;
453
- top: 0;
454
- left: 0;
455
- -xborder-right: solid 1px #fff;
456
- width: 10000px;
457
- }
458
- .mejs-chapters .mejs-chapter {
459
- position: absolute;
460
- float: left;
461
- background: #222;
462
- background: rgba(0, 0, 0, 0.7);
463
- background: -webkit-gradient(linear, left top, left bottom, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
464
- background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
465
- background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
466
- filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#323232,endColorstr=#000000);
467
- overflow: hidden;
468
- border: 0;
469
- }
470
- .mejs-chapters .mejs-chapter .mejs-chapter-block {
471
- font-size: 11px;
472
- color: #fff;
473
- padding: 5px;
474
- display: block;
475
- border-right: solid 1px #333;
476
- border-bottom: solid 1px #333;
477
- cursor: pointer;
478
- }
479
- .mejs-chapters .mejs-chapter .mejs-chapter-block-last {
480
- border-right: none;
481
- }
482
-
483
- .mejs-chapters .mejs-chapter .mejs-chapter-block:hover {
484
- /*background: #333;*/
485
- background: #666;
486
- background: rgba(102,102,102, 0.7);
487
- background: -webkit-gradient(linear, left top, left bottom, from(rgba(102,102,102,0.7)), to(rgba(50,50,50,0.6)));
488
- background: -moz-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
489
- filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#666666,endColorstr=#323232);
490
- }
491
- .mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{
492
- font-size: 12px;
493
- font-weight: bold;
494
- display: block;
495
- white-space:nowrap;
496
- text-overflow: ellipsis;
497
- margin: 0 0 3px 0;
498
- line-height: 12px;
499
- }
500
- .mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{
501
- font-size: 12px;
502
- line-height: 12px;
503
- margin: 3px 0 4px 0;
504
- display: block;
505
- white-space:nowrap;
506
- text-overflow: ellipsis;
507
- }
508
-
509
-
510
- .mejs-captions-layer {
511
- position: absolute;
512
- bottom: 0;
513
- left: 0;
514
- text-align:center;
515
- /*font-weight: bold;*/
516
- line-height: 22px;
517
- font-size: 12px;
518
- color: #fff;
519
- }
520
- .mejs-captions-layer a {
521
- color: #fff;
522
- text-decoration: underline;
523
- }
524
- .mejs-captions-layer[lang=ar] {
525
- font-size: 20px;
526
- font-weight: normal;
527
- }
528
-
529
- .mejs-captions-position {
530
- position: absolute;
531
- width: 100%;
532
- bottom: 15px;
533
- left: 0;
534
- }
535
-
536
- .mejs-captions-position-hover {
537
- bottom: 45px;
538
- }
539
-
540
- .mejs-captions-text {
541
- padding: 3px 5px;
542
- background: url(background.png);
543
- background: rgba(20, 20, 20, 0.8);
544
-
545
- }
546
- /* End: TRACK (Captions and Chapters) */
547
-
548
-
549
-
550
- .mejs-clear {
551
- clear: both;
552
- }
553
-
554
- /* Start: ERROR */
555
- .me-cannotplay {
556
- }
557
- .me-cannotplay a {
558
- color: #fff;
559
- font-weight: bold;
560
- }
561
- .me-cannotplay span {
562
- padding: 15px;
563
- display: block;
564
- }
565
- /* End: ERROR */
566
-
567
-
568
- /* Start: Loop */
569
- .mejs-controls .mejs-loop-off button{
570
- background-position: -64px -16px;
571
- }
572
- .mejs-controls .mejs-loop-on button {
573
- background-position: -64px 0;
574
- }
575
- /* End: Loop */
576
-
577
- /* Start: backlight */
578
- .mejs-controls .mejs-backlight-off button{
579
- background-position: -80px -16px;
580
- }
581
- .mejs-controls .mejs-backlight-on button {
582
- background-position: -80px 0;
583
- }
584
- /* End: backlight */
585
-
586
-
587
- /* Start: picture controls */
588
- .mejs-controls .mejs-picturecontrols-button{
589
- background-position: -96px 0;
590
- }
591
- /* End: picture controls */
592
-
593
-
594
- /* context menu */
595
- .mejs-contextmenu {
596
- position: absolute;
597
- width: 150px;
598
- padding: 10px;
599
- border-radius: 4px;
600
- top: 0;
601
- left: 0;
602
- background: #fff;
603
- border: solid 1px #999;
604
- z-index: 1001; /* make sure it shows on fullscreen */
605
- }
606
- .mejs-contextmenu .mejs-contextmenu-separator {
607
- height: 1px;
608
- font-size: 0;
609
- margin: 5px 6px;
610
- background: #333;
611
- }
612
-
613
- .mejs-contextmenu .mejs-contextmenu-item {
614
- font-family: Helvetica, Arial;
615
- font-size: 12px;
616
- padding: 4px 6px;
617
- cursor: pointer;
618
- color: #333;
619
- }
620
- .mejs-contextmenu .mejs-contextmenu-item:hover {
621
- background: #2C7C91;
622
- color: #fff;
623
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .mejs-container {
2
+ position: relative;
3
+ background: #000;
4
+ font-family: Helvetica, Arial;
5
+ text-align: left;
6
+ vertical-align: top;
7
+ }
8
+
9
+ .me-plugin {
10
+ position: absolute;
11
+ }
12
+
13
+ .mejs-embed, .mejs-embed body {
14
+ width: 100%;
15
+ height: 100%;
16
+ margin: 0;
17
+ padding: 0;
18
+ background: #000;
19
+ overflow: hidden;
20
+ }
21
+
22
+ .mejs-container-fullscreen {
23
+ position: fixed;
24
+ left: 0;
25
+ top: 0;
26
+ right: 0;
27
+ bottom: 0;
28
+ overflow: hidden;
29
+ z-index: 1000;
30
+ }
31
+ .mejs-container-fullscreen .mejs-mediaelement,
32
+ .mejs-container-fullscreen video {
33
+ width: 100%;
34
+ height: 100%;
35
+ }
36
+
37
+ /* Start: LAYERS */
38
+ .mejs-background {
39
+ position: absolute;
40
+ top: 0;
41
+ left: 0;
42
+ }
43
+ .mejs-mediaelement {
44
+ position: absolute;
45
+ top: 0;
46
+ left: 0;
47
+ width: 100%;
48
+ height: 100%;
49
+ }
50
+ .mejs-poster {
51
+ position: absolute;
52
+ top: 0;
53
+ left: 0;
54
+ }
55
+ .mejs-poster img {
56
+ border: 0;
57
+ padding: 0;
58
+ border: 0;
59
+ display: block;
60
+ }
61
+ .mejs-overlay {
62
+ position: absolute;
63
+ top: 0;
64
+ left: 0;
65
+ }
66
+ .mejs-overlay-play {
67
+ cursor: pointer;
68
+ }
69
+ .mejs-overlay-button {
70
+ position: absolute;
71
+ top: 50%;
72
+ left: 50%;
73
+ width: 100px;
74
+ height: 100px;
75
+ margin: -50px 0 0 -50px;
76
+ background: url(bigplay.png) no-repeat;
77
+ }
78
+ .mejs-overlay:hover .mejs-overlay-button{
79
+ background-position: 0 -100px ;
80
+ }
81
+ .mejs-overlay-loading {
82
+ position: absolute;
83
+ top: 50%;
84
+ left: 50%;
85
+ width: 80px;
86
+ height: 80px;
87
+ margin: -40px 0 0 -40px;
88
+ background: #333;
89
+ background: url(background.png);
90
+ background: rgba(0, 0, 0, 0.9);
91
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.9)), to(rgba(0,0,0,0.9)));
92
+ background: -webkit-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
93
+ background: -moz-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
94
+ background: -o-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
95
+ background: -ms-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
96
+ background: linear-gradient(rgba(50,50,50,0.9), rgba(0,0,0,0.9));
97
+ }
98
+ .mejs-overlay-loading span {
99
+ display:block;
100
+ width: 80px;
101
+ height: 80px;
102
+ background: transparent url(loading.gif) 50% 50% no-repeat;
103
+ }
104
+
105
+ /* End: LAYERS */
106
+
107
+ /* Start: CONTROL BAR */
108
+ .mejs-container .mejs-controls {
109
+ position: absolute;
110
+ background: none;
111
+ list-style-type: none;
112
+ margin: 0;
113
+ padding: 0;
114
+ bottom: 0;
115
+ left: 0;
116
+ background: url(background.png);
117
+ background: rgba(0, 0, 0, 0.7);
118
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
119
+ background: -webkit-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
120
+ background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
121
+ background: -o-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
122
+ background: -ms-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
123
+ background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
124
+ height: 30px;
125
+ width: 100%;
126
+ }
127
+ .mejs-container .mejs-controls div {
128
+ list-style-type: none;
129
+ background-image: none;
130
+ display: block;
131
+ float: left;
132
+ margin: 0;
133
+ padding: 0;
134
+ width: 26px;
135
+ height: 26px;
136
+ font-size: 11px;
137
+ line-height: 11px;
138
+ background: 0;
139
+ font-family: Helvetica, Arial;
140
+ border: 0;
141
+ }
142
+
143
+ .mejs-controls .mejs-button button {
144
+ cursor: pointer;
145
+ display: block;
146
+ font-size: 0;
147
+ line-height: 0;
148
+ text-decoration: none;
149
+ margin: 7px 5px;
150
+ padding: 0;
151
+ position: absolute;
152
+ height: 16px;
153
+ width: 16px;
154
+ border: 0;
155
+ background: transparent url(controls.png) no-repeat;
156
+ }
157
+
158
+ /* :focus for accessibility */
159
+ .mejs-controls .mejs-button button:focus {
160
+ outline: solid 1px yellow;
161
+ }
162
+
163
+ /* End: CONTROL BAR */
164
+
165
+ /* Start: Time (current / duration) */
166
+ .mejs-container .mejs-controls .mejs-time {
167
+ color: #fff;
168
+ display: block;
169
+ height: 17px;
170
+ width: auto;
171
+ padding: 8px 3px 0 3px ;
172
+ overflow: hidden;
173
+ text-align: center;
174
+ padding: auto 4px;
175
+ }
176
+ .mejs-container .mejs-controls .mejs-time span {
177
+ font-size: 11px;
178
+ color: #fff;
179
+ line-height: 12px;
180
+ display: block;
181
+ float: left;
182
+ margin: 1px 2px 0 0;
183
+ width: auto;
184
+ }
185
+ /* End: Time (current / duration) */
186
+
187
+
188
+ /* Start: Play/pause */
189
+ .mejs-controls .mejs-play button {
190
+ background-position:0 0;
191
+ }
192
+ .mejs-controls .mejs-pause button {
193
+ background-position:0 -16px;
194
+ }
195
+ /* End: Play/pause */
196
+
197
+
198
+ /* Stop */
199
+ .mejs-controls .mejs-stop button {
200
+ background-position: -112px 0;
201
+ }
202
+ /* End: Play/pause */
203
+
204
+ /* Start: Progress bar */
205
+ .mejs-controls div.mejs-time-rail {
206
+ width: 200px;
207
+ padding-top: 5px;
208
+ }
209
+ .mejs-controls .mejs-time-rail span {
210
+ display: block;
211
+ position: absolute;
212
+ width: 180px;
213
+ height: 10px;
214
+ -webkit-border-radius: 2px;
215
+ -moz-border-radius: 2px;
216
+ border-radius: 2px;
217
+ cursor: pointer;
218
+ }
219
+ .mejs-controls .mejs-time-rail .mejs-time-total {
220
+ margin: 5px;
221
+ background: #333;
222
+ background: rgba(50,50,50,0.8);
223
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
224
+ background: -webkit-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
225
+ background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
226
+ background: -o-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
227
+ background: -ms-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
228
+ background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
229
+ }
230
+ .mejs-controls .mejs-time-rail .mejs-time-loaded {
231
+ background: #3caac8;
232
+ background: rgba(60,170,200,0.8);
233
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(44,124,145,0.8)), to(rgba(78,183,212,0.8)));
234
+ background: -webkit-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
235
+ background: -moz-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
236
+ background: -o-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
237
+ background: -ms-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
238
+ background: linear-gradient(rgba(44,124,145,0.8), rgba(78,183,212,0.8));
239
+ width: 0;
240
+ }
241
+ .mejs-controls .mejs-time-rail .mejs-time-current {
242
+ width: 0;
243
+ background: #fff;
244
+ background: rgba(255,255,255,0.8);
245
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
246
+ background: -webkit-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
247
+ background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
248
+ background: -o-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
249
+ background: -ms-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
250
+ background: linear-gradient(rgba(255,255,255,0.9), rgba(200,200,200,0.8));
251
+ }
252
+
253
+ .mejs-controls .mejs-time-rail .mejs-time-handle {
254
+ display: none;
255
+ position: absolute;
256
+ margin: 0;
257
+ width: 10px;
258
+ background: #fff;
259
+ -webkit-border-radius: 5px;
260
+ -moz-border-radius: 5px;
261
+ border-radius: 5px;
262
+ cursor: pointer;
263
+ border: solid 2px #333;
264
+ top: -2px;
265
+ text-align: center;
266
+ }
267
+
268
+ .mejs-controls .mejs-time-rail .mejs-time-float {
269
+ position: absolute;
270
+ display: none;
271
+ background: #eee;
272
+ width: 36px;
273
+ height: 17px;
274
+ border: solid 1px #333;
275
+ top: -26px;
276
+ margin-left: -18px;
277
+ text-align: center;
278
+ color: #111;
279
+ }
280
+
281
+ .mejs-controls .mejs-time-rail .mejs-time-float-current {
282
+ margin: 2px;
283
+ width: 30px;
284
+ display: block;
285
+ text-align: center;
286
+ left: 0;
287
+ }
288
+ .mejs-controls .mejs-time-rail .mejs-time-float-corner {
289
+ position: absolute;
290
+ display: block;
291
+ width: 0;
292
+ height: 0;
293
+ line-height: 0;
294
+ border: solid 5px #eee;
295
+ border-color: #eee transparent transparent transparent;
296
+ -webkit-border-radius: 0;
297
+ -moz-border-radius: 0;
298
+ border-radius: 0;
299
+ top: 15px;
300
+ left: 13px;
301
+
302
+ }
303
+
304
+
305
+
306
+
307
+ /*
308
+ .mejs-controls .mejs-time-rail:hover .mejs-time-handle {
309
+ visibility:visible;
310
+ }
311
+ */
312
+ /* End: Progress bar */
313
+
314
+ /* Start: Fullscreen */
315
+ .mejs-controls .mejs-fullscreen-button button {
316
+ background-position:-32px 0;
317
+ }
318
+ .mejs-controls .mejs-unfullscreen button {
319
+ background-position:-32px -16px;
320
+ }
321
+ /* End: Fullscreen */
322
+
323
+
324
+ /* Start: Mute/Volume */
325
+ .mejs-controls .mejs-volume-button {
326
+ }
327
+
328
+ .mejs-controls .mejs-mute button {
329
+ background-position:-16px -16px;
330
+ }
331
+
332
+ .mejs-controls .mejs-unmute button {
333
+ background-position:-16px 0;
334
+ }
335
+
336
+ .mejs-controls .mejs-volume-button {
337
+ position: relative;
338
+ }
339
+
340
+ .mejs-controls .mejs-volume-button .mejs-volume-slider {
341
+ display: none;
342
+ height: 115px;
343
+ width: 25px;
344
+ background: url(background.png);
345
+ background: rgba(50, 50, 50, 0.7);
346
+ -webkit-border-radius: 0;
347
+ -moz-border-radius: 0;
348
+ border-radius: 0;
349
+ top: -115px;
350
+ left: 0;
351
+ z-index: 1;
352
+ position: absolute;
353
+ margin: 0;
354
+ }
355
+ .mejs-controls .mejs-volume-button:hover {
356
+ -webkit-border-radius: 0 0 4px 4px;
357
+ -moz-border-radius: 0 0 4px 4px;
358
+ border-radius: 0 0 4px 4px;
359
+ }
360
+ /*
361
+ .mejs-controls .mejs-volume-button:hover .mejs-volume-slider {
362
+ display: block;
363
+ }
364
+ */
365
+
366
+ .mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total {
367
+ position: absolute;
368
+ left: 11px;
369
+ top: 8px;
370
+ width: 2px;
371
+ height: 100px;
372
+ background: #ddd;
373
+ background: rgba(255, 255, 255, 0.5);
374
+ margin: 0;
375
+ }
376
+
377
+ .mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current {
378
+ position: absolute;
379
+ left: 11px;
380
+ top: 8px;
381
+ width: 2px;
382
+ height: 100px;
383
+ background: #ddd;
384
+ background: rgba(255, 255, 255, 0.9);
385
+ margin: 0;
386
+ }
387
+
388
+ .mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle {
389
+ position: absolute;
390
+ left: 4px;
391
+ top: -3px;
392
+ width: 16px;
393
+ height: 6px;
394
+ background: #ddd;
395
+ background: rgba(255, 255, 255, 0.9);
396
+ cursor: N-resize;
397
+ -webkit-border-radius: 1px;
398
+ -moz-border-radius: 1px;
399
+ border-radius: 1px;
400
+ margin: 0;
401
+ }
402
+
403
+
404
+ /* horizontal version */
405
+
406
+ .mejs-controls div.mejs-horizontal-volume-slider {
407
+ height: 26px;
408
+ width: 60px;
409
+ position: relative;
410
+ }
411
+
412
+ .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
413
+ position: absolute;
414
+ left: 0;
415
+ top: 11px;
416
+ width: 50px;
417
+ height: 8px;
418
+ margin: 0;
419
+ padding: 0;
420
+ font-size: 1px;
421
+
422
+ -webkit-border-radius: 2px;
423
+ -moz-border-radius: 2px;
424
+ border-radius: 2px;
425
+
426
+ background: #333;
427
+ background: rgba(50,50,50,0.8);
428
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
429
+ background: -webkit-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
430
+ background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
431
+ background: -o-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
432
+ background: -ms-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
433
+ background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
434
+
435
+ }
436
+
437
+ .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
438
+ position: absolute;
439
+ left: 0;
440
+ top: 11px;
441
+ width: 50px;
442
+ height: 8px;
443
+ margin: 0;
444
+ padding: 0;
445
+ font-size: 1px;
446
+
447
+ -webkit-border-radius: 2px;
448
+ -moz-border-radius: 2px;
449
+ border-radius: 2px;
450
+
451
+ background: #fff;
452
+ background: rgba(255,255,255,0.8);
453
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
454
+ background: -webkit-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
455
+ background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
456
+ background: -o-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
457
+ background: -ms-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
458
+ background: linear-gradient(rgba(255,255,255,0.9), rgba(200,200,200,0.8));
459
+
460
+ }
461
+
462
+
463
+ .mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle {
464
+ display: none;
465
+ }
466
+
467
+ /* End: Mute/Volume */
468
+
469
+
470
+
471
+
472
+ /* Start: TRACK (Captions and Chapters) */
473
+ .mejs-controls .mejs-captions-button {
474
+ position: relative;
475
+ }
476
+
477
+ .mejs-controls .mejs-captions-button button {
478
+ background-position:-48px 0;
479
+ }
480
+ .mejs-controls .mejs-captions-button .mejs-captions-selector {
481
+ visibility: hidden;
482
+ position: absolute;
483
+ bottom: 26px;
484
+ right: -10px;
485
+ width: 130px;
486
+ height: 100px;
487
+ background: url(background.png);
488
+ background: rgba(50,50,50,0.7);
489
+ border: solid 1px transparent;
490
+ padding: 10px;
491
+ overflow: hidden;
492
+ -webkit-border-radius: 0;
493
+ -moz-border-radius: 0;
494
+ border-radius: 0;
495
+ }
496
+ /*
497
+ .mejs-controls .mejs-captions-button:hover .mejs-captions-selector {
498
+ visibility: visible;
499
+ }
500
+ */
501
+
502
+ .mejs-controls .mejs-captions-button .mejs-captions-selector ul {
503
+ margin: 0;
504
+ padding: 0;
505
+ display: block;
506
+ list-style-type: none !important;
507
+ overflow: hidden;
508
+ }
509
+ .mejs-controls .mejs-captions-button .mejs-captions-selector ul li{
510
+ margin: 0 0 6px 0;
511
+ padding: 0;
512
+ list-style-type: none !important;
513
+ display:block;
514
+ color: #fff;
515
+ overflow: hidden;
516
+ }
517
+ .mejs-controls .mejs-captions-button .mejs-captions-selector ul li input{
518
+ clear: both;
519
+ float: left;
520
+ margin: 3px 3px 0 5px;
521
+ }
522
+ .mejs-controls .mejs-captions-button .mejs-captions-selector ul li label{
523
+ width: 100px;
524
+ float: left;
525
+ padding: 4px 0 0 0;
526
+ line-height: 15px;
527
+ font-family: helvetica, arial;
528
+ font-size: 10px;
529
+ }
530
+
531
+ .mejs-controls .mejs-captions-button .mejs-captions-translations {
532
+ font-size: 10px;
533
+ margin: 0 0 5px 0;
534
+ }
535
+
536
+
537
+ .mejs-chapters {
538
+ position: absolute;
539
+ top: 0;
540
+ left: 0;
541
+ -xborder-right: solid 1px #fff;
542
+ width: 10000px;
543
+ }
544
+ .mejs-chapters .mejs-chapter {
545
+ position: absolute;
546
+ float: left;
547
+ background: #222;
548
+ background: rgba(0, 0, 0, 0.7);
549
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
550
+ background: -webkit-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
551
+ background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
552
+ background: -o-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
553
+ background: -ms-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
554
+ background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
555
+ filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#323232,endColorstr=#000000);
556
+ overflow: hidden;
557
+ border: 0;
558
+ }
559
+ .mejs-chapters .mejs-chapter .mejs-chapter-block {
560
+ font-size: 11px;
561
+ color: #fff;
562
+ padding: 5px;
563
+ display: block;
564
+ border-right: solid 1px #333;
565
+ border-bottom: solid 1px #333;
566
+ cursor: pointer;
567
+ }
568
+ .mejs-chapters .mejs-chapter .mejs-chapter-block-last {
569
+ border-right: none;
570
+ }
571
+
572
+ .mejs-chapters .mejs-chapter .mejs-chapter-block:hover {
573
+ /*background: #333;*/
574
+ background: #666;
575
+ background: rgba(102,102,102, 0.7);
576
+ background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(102,102,102,0.7)), to(rgba(50,50,50,0.6)));
577
+ background: -webkit-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
578
+ background: -moz-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
579
+ background: -o-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
580
+ background: -ms-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
581
+ background: linear-gradient(rgba(102,102,102,0.7), rgba(50,50,50,0.6));
582
+ filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#666666,endColorstr=#323232);
583
+ }
584
+ .mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title{
585
+ font-size: 12px;
586
+ font-weight: bold;
587
+ display: block;
588
+ white-space:nowrap;
589
+ text-overflow: ellipsis;
590
+ margin: 0 0 3px 0;
591
+ line-height: 12px;
592
+ }
593
+ .mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan{
594
+ font-size: 12px;
595
+ line-height: 12px;
596
+ margin: 3px 0 4px 0;
597
+ display: block;
598
+ white-space:nowrap;
599
+ text-overflow: ellipsis;
600
+ }
601
+
602
+
603
+ .mejs-captions-layer {
604
+ position: absolute;
605
+ bottom: 0;
606
+ left: 0;
607
+ text-align:center;
608
+ /*font-weight: bold;*/
609
+ line-height: 22px;
610
+ font-size: 12px;
611
+ color: #fff;
612
+ }
613
+ .mejs-captions-layer a {
614
+ color: #fff;
615
+ text-decoration: underline;
616
+ }
617
+ .mejs-captions-layer[lang=ar] {
618
+ font-size: 20px;
619
+ font-weight: normal;
620
+ }
621
+
622
+ .mejs-captions-position {
623
+ position: absolute;
624
+ width: 100%;
625
+ bottom: 15px;
626
+ left: 0;
627
+ }
628
+
629
+ .mejs-captions-position-hover {
630
+ bottom: 45px;
631
+ }
632
+
633
+ .mejs-captions-text {
634
+ padding: 3px 5px;
635
+ background: url(background.png);
636
+ background: rgba(20, 20, 20, 0.8);
637
+
638
+ }
639
+ /* End: TRACK (Captions and Chapters) */
640
+
641
+
642
+
643
+ .mejs-clear {
644
+ clear: both;
645
+ }
646
+
647
+ /* Start: ERROR */
648
+ .me-cannotplay {
649
+ }
650
+ .me-cannotplay a {
651
+ color: #fff;
652
+ font-weight: bold;
653
+ }
654
+ .me-cannotplay span {
655
+ padding: 15px;
656
+ display: block;
657
+ }
658
+ /* End: ERROR */
659
+
660
+
661
+ /* Start: Loop */
662
+ .mejs-controls .mejs-loop-off button{
663
+ background-position: -64px -16px;
664
+ }
665
+ .mejs-controls .mejs-loop-on button {
666
+ background-position: -64px 0;
667
+ }
668
+ /* End: Loop */
669
+
670
+ /* Start: backlight */
671
+ .mejs-controls .mejs-backlight-off button{
672
+ background-position: -80px -16px;
673
+ }
674
+ .mejs-controls .mejs-backlight-on button {
675
+ background-position: -80px 0;
676
+ }
677
+ /* End: backlight */
678
+
679
+
680
+ /* Start: picture controls */
681
+ .mejs-controls .mejs-picturecontrols-button{
682
+ background-position: -96px 0;
683
+ }
684
+ /* End: picture controls */
685
+
686
+
687
+ /* context menu */
688
+ .mejs-contextmenu {
689
+ position: absolute;
690
+ width: 150px;
691
+ padding: 10px;
692
+ border-radius: 4px;
693
+ top: 0;
694
+ left: 0;
695
+ background: #fff;
696
+ border: solid 1px #999;
697
+ z-index: 1001; /* make sure it shows on fullscreen */
698
+ }
699
+ .mejs-contextmenu .mejs-contextmenu-separator {
700
+ height: 1px;
701
+ font-size: 0;
702
+ margin: 5px 6px;
703
+ background: #333;
704
+ }
705
+
706
+ .mejs-contextmenu .mejs-contextmenu-item {
707
+ font-family: Helvetica, Arial;
708
+ font-size: 12px;
709
+ padding: 4px 6px;
710
+ cursor: pointer;
711
+ color: #333;
712
+ }
713
+ .mejs-contextmenu .mejs-contextmenu-item:hover {
714
+ background: #2C7C91;
715
+ color: #fff;
716
+ }
717
+
718
+
719
+ /* Start: SourceChooser */
720
+ .mejs-controls .mejs-sourcechooser-button {
721
+ position: relative;
722
+ }
723
+
724
+ .mejs-controls .mejs-sourcechooser-button button {
725
+ background-position: -128px 0;
726
+ }
727
+ .mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector {
728
+ visibility: hidden;
729
+ position: absolute;
730
+ bottom: 26px;
731
+ right: -10px;
732
+ width: 130px;
733
+ height: 100px;
734
+ background: url(background.png);
735
+ background: rgba(50,50,50,0.7);
736
+ border: solid 1px transparent;
737
+ padding: 10px;
738
+ overflow: hidden;
739
+ -webkit-border-radius: 0;
740
+ -moz-border-radius: 0;
741
+ border-radius: 0;
742
+ }
743
+
744
+ .mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul {
745
+ margin: 0;
746
+ padding: 0;
747
+ display: block;
748
+ list-style-type: none !important;
749
+ overflow: hidden;
750
+ }
751
+ .mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li{
752
+ margin: 0 0 6px 0;
753
+ padding: 0;
754
+ list-style-type: none !important;
755
+ display:block;
756
+ color: #fff;
757
+ overflow: hidden;
758
+ }
759
+ .mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input{
760
+ clear: both;
761
+ float: left;
762
+ margin: 3px 3px 0 5px;
763
+ }
764
+ .mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label{
765
+ width: 100px;
766
+ float: left;
767
+ padding: 4px 0 0 0;
768
+ line-height: 15px;
769
+ font-family: helvetica, arial;
770
+ font-size: 10px;
771
+ }
772
+ /* End: SourceChooser */
mediaelement/mediaelementplayer.js ADDED
@@ -0,0 +1,2473 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * MediaElementPlayer
3
+ * http://mediaelementjs.com/
4
+ *
5
+ * Creates a controller bar for HTML5 <video> add <audio> tags
6
+ * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
7
+ *
8
+ * Copyright 2010-2011, John Dyer (http://j.hn/)
9
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10
+ *
11
+ */
12
+ if (typeof jQuery != 'undefined') {
13
+ mejs.$ = jQuery;
14
+ } else if (typeof ender != 'undefined') {
15
+ mejs.$ = ender;
16
+ }
17
+ (function ($) {
18
+
19
+ // default player values
20
+ mejs.MepDefaults = {
21
+ // url to poster (to fix iOS 3.x)
22
+ poster: '',
23
+ // default if the <video width> is not specified
24
+ defaultVideoWidth: 480,
25
+ // default if the <video height> is not specified
26
+ defaultVideoHeight: 270,
27
+ // if set, overrides <video width>
28
+ videoWidth: -1,
29
+ // if set, overrides <video height>
30
+ videoHeight: -1,
31
+ // default if the user doesn't specify
32
+ defaultAudioWidth: 400,
33
+ // default if the user doesn't specify
34
+ defaultAudioHeight: 30,
35
+ // width of audio player
36
+ audioWidth: -1,
37
+ // height of audio player
38
+ audioHeight: -1,
39
+ // initial volume when the player starts (overrided by user cookie)
40
+ startVolume: 0.8,
41
+ // useful for <audio> player loops
42
+ loop: false,
43
+ // resize to media dimensions
44
+ enableAutosize: true,
45
+ // forces the hour marker (##:00:00)
46
+ alwaysShowHours: false,
47
+
48
+ // show framecount in timecode (##:00:00:00)
49
+ showTimecodeFrameCount: false,
50
+ // used when showTimecodeFrameCount is set to true
51
+ framesPerSecond: 25,
52
+
53
+ // automatically calculate the width of the progress bar based on the sizes of other elements
54
+ autosizeProgress : true,
55
+ // Hide controls when playing and mouse is not over the video
56
+ alwaysShowControls: false,
57
+ // force iPad's native controls
58
+ iPadUseNativeControls: false,
59
+ // force iPad's native controls
60
+ iPhoneUseNativeControls: false,
61
+ // force iPad's native controls
62
+ AndroidUseNativeControls: false,
63
+ // features to show
64
+ features: ['playpause','current','progress','duration','tracks','volume','fullscreen'],
65
+ // only for dynamic
66
+ isVideo: true,
67
+
68
+ // turns keyboard support on and off for this instance
69
+ enableKeyboard: true,
70
+
71
+ // whenthis player starts, it will pause other players
72
+ pauseOtherPlayers: true,
73
+
74
+ // array of keyboard actions such as play pause
75
+ keyActions: [
76
+ {
77
+ keys: [
78
+ 32, // SPACE
79
+ 179 // GOOGLE play/pause button
80
+ ],
81
+ action: function(player, media) {
82
+ if (media.paused || media.ended) {
83
+ media.play();
84
+ } else {
85
+ media.pause();
86
+ }
87
+ }
88
+ },
89
+ {
90
+ keys: [38], // UP
91
+ action: function(player, media) {
92
+ var newVolume = Math.min(media.volume + 0.1, 1);
93
+ media.setVolume(newVolume);
94
+ }
95
+ },
96
+ {
97
+ keys: [40], // DOWN
98
+ action: function(player, media) {
99
+ var newVolume = Math.max(media.volume - 0.1, 0);
100
+ media.setVolume(newVolume);
101
+ }
102
+ },
103
+ {
104
+ keys: [
105
+ 37, // LEFT
106
+ 227 // Google TV rewind
107
+ ],
108
+ action: function(player, media) {
109
+ if (!isNaN(media.duration) && media.duration > 0) {
110
+ if (player.isVideo) {
111
+ player.showControls();
112
+ player.startControlsTimer();
113
+ }
114
+
115
+ // 5%
116
+ var newTime = Math.min(media.currentTime - (media.duration * 0.05), media.duration);
117
+ media.setCurrentTime(newTime);
118
+ }
119
+ }
120
+ },
121
+ {
122
+ keys: [
123
+ 39, // RIGHT
124
+ 228 // Google TV forward
125
+ ],
126
+ action: function(player, media) {
127
+ if (!isNaN(media.duration) && media.duration > 0) {
128
+ if (player.isVideo) {
129
+ player.showControls();
130
+ player.startControlsTimer();
131
+ }
132
+
133
+ // 5%
134
+ var newTime = Math.max(media.currentTime + (media.duration * 0.05), 0);
135
+ media.setCurrentTime(newTime);
136
+ }
137
+ }
138
+ },
139
+ {
140
+ keys: [70], // f
141
+ action: function(player, media) {
142
+ if (typeof player.enterFullScreen != 'undefined') {
143
+ if (player.isFullScreen) {
144
+ player.exitFullScreen();
145
+ } else {
146
+ player.enterFullScreen();
147
+ }
148
+ }
149
+ }
150
+ }
151
+ ]
152
+ };
153
+
154
+ mejs.mepIndex = 0;
155
+
156
+ mejs.players = [];
157
+
158
+ // wraps a MediaElement object in player controls
159
+ mejs.MediaElementPlayer = function(node, o) {
160
+ // enforce object, even without "new" (via John Resig)
161
+ if ( !(this instanceof mejs.MediaElementPlayer) ) {
162
+ return new mejs.MediaElementPlayer(node, o);
163
+ }
164
+
165
+ var t = this;
166
+
167
+ // these will be reset after the MediaElement.success fires
168
+ t.$media = t.$node = $(node);
169
+ t.node = t.media = t.$media[0];
170
+
171
+ // check for existing player
172
+ if (typeof t.node.player != 'undefined') {
173
+ return t.node.player;
174
+ } else {
175
+ // attach player to DOM node for reference
176
+ t.node.player = t;
177
+ }
178
+
179
+
180
+ // try to get options from data-mejsoptions
181
+ if (typeof o == 'undefined') {
182
+ o = t.$node.data('mejsoptions');
183
+ }
184
+
185
+ // extend default options
186
+ t.options = $.extend({},mejs.MepDefaults,o);
187
+
188
+ // add to player array (for focus events)
189
+ mejs.players.push(t);
190
+
191
+ // start up
192
+ t.init();
193
+
194
+ return t;
195
+ };
196
+
197
+ // actual player
198
+ mejs.MediaElementPlayer.prototype = {
199
+
200
+ hasFocus: false,
201
+
202
+ controlsAreVisible: true,
203
+
204
+ init: function() {
205
+
206
+ var
207
+ t = this,
208
+ mf = mejs.MediaFeatures,
209
+ // options for MediaElement (shim)
210
+ meOptions = $.extend(true, {}, t.options, {
211
+ success: function(media, domNode) { t.meReady(media, domNode); },
212
+ error: function(e) { t.handleError(e);}
213
+ }),
214
+ tagName = t.media.tagName.toLowerCase();
215
+
216
+ t.isDynamic = (tagName !== 'audio' && tagName !== 'video');
217
+
218
+ if (t.isDynamic) {
219
+ // get video from src or href?
220
+ t.isVideo = t.options.isVideo;
221
+ } else {
222
+ t.isVideo = (tagName !== 'audio' && t.options.isVideo);
223
+ }
224
+
225
+ // use native controls in iPad, iPhone, and Android
226
+ if ((mf.isiPad && t.options.iPadUseNativeControls) || (mf.isiPhone && t.options.iPhoneUseNativeControls)) {
227
+
228
+ // add controls and stop
229
+ t.$media.attr('controls', 'controls');
230
+
231
+ // attempt to fix iOS 3 bug
232
+ t.$media.removeAttr('poster');
233
+
234
+ // override Apple's autoplay override for iPads
235
+ if (mf.isiPad && t.media.getAttribute('autoplay') !== null) {
236
+ t.media.load();
237
+ t.media.play();
238
+ }
239
+
240
+ } else if (mf.isAndroid && t.AndroidUseNativeControls) {
241
+
242
+ // leave default player
243
+
244
+ } else {
245
+
246
+ // DESKTOP: use MediaElementPlayer controls
247
+
248
+ // remove native controls
249
+ t.$media.removeAttr('controls');
250
+
251
+ // unique ID
252
+ t.id = 'mep_' + mejs.mepIndex++;
253
+
254
+ // build container
255
+ t.container =
256
+ $('<div id="' + t.id + '" class="mejs-container">'+
257
+ '<div class="mejs-inner">'+
258
+ '<div class="mejs-mediaelement"></div>'+
259
+ '<div class="mejs-layers"></div>'+
260
+ '<div class="mejs-controls"></div>'+
261
+ '<div class="mejs-clear"></div>'+
262
+ '</div>' +
263
+ '</div>')
264
+ .addClass(t.$media[0].className)
265
+ .insertBefore(t.$media);
266
+
267
+ // add classes for user and content
268
+ t.container.addClass(
269
+ (mf.isAndroid ? 'mejs-android ' : '') +
270
+ (mf.isiOS ? 'mejs-ios ' : '') +
271
+ (mf.isiPad ? 'mejs-ipad ' : '') +
272
+ (mf.isiPhone ? 'mejs-iphone ' : '') +
273
+ (t.isVideo ? 'mejs-video ' : 'mejs-audio ')
274
+ );
275
+
276
+
277
+ // move the <video/video> tag into the right spot
278
+ if (mf.isiOS) {
279
+
280
+ // sadly, you can't move nodes in iOS, so we have to destroy and recreate it!
281
+ var $newMedia = t.$media.clone();
282
+
283
+ t.container.find('.mejs-mediaelement').append($newMedia);
284
+
285
+ t.$media.remove();
286
+ t.$node = t.$media = $newMedia;
287
+ t.node = t.media = $newMedia[0]
288
+
289
+ } else {
290
+
291
+ // normal way of moving it into place (doesn't work on iOS)
292
+ t.container.find('.mejs-mediaelement').append(t.$media);
293
+ }
294
+
295
+ // find parts
296
+ t.controls = t.container.find('.mejs-controls');
297
+ t.layers = t.container.find('.mejs-layers');
298
+
299
+ // determine the size
300
+
301
+ /* size priority:
302
+ (1) videoWidth (forced),
303
+ (2) style="width;height;"
304
+ (3) width attribute,
305
+ (4) defaultVideoWidth (for unspecified cases)
306
+ */
307
+
308
+ var capsTagName = tagName.substring(0,1).toUpperCase() + tagName.substring(1);
309
+
310
+ if (t.options[tagName + 'Width'] > 0 || t.options[tagName + 'Width'].toString().indexOf('%') > -1) {
311
+ t.width = t.options[tagName + 'Width'];
312
+ } else if (t.media.style.width !== '' && t.media.style.width !== null) {
313
+ t.width = t.media.style.width;
314
+ } else if (t.media.getAttribute('width') !== null) {
315
+ t.width = t.$media.attr('width');
316
+ } else {
317
+ t.width = t.options['default' + capsTagName + 'Width'];
318
+ }
319
+
320
+ if (t.options[tagName + 'Height'] > 0 || t.options[tagName + 'Height'].toString().indexOf('%') > -1) {
321
+ t.height = t.options[tagName + 'Height'];
322
+ } else if (t.media.style.height !== '' && t.media.style.height !== null) {
323
+ t.height = t.media.style.height;
324
+ } else if (t.$media[0].getAttribute('height') !== null) {
325
+ t.height = t.$media.attr('height');
326
+ } else {
327
+ t.height = t.options['default' + capsTagName + 'Height'];
328
+ }
329
+
330
+ // set the size, while we wait for the plugins to load below
331
+ t.setPlayerSize(t.width, t.height);
332
+
333
+ // create MediaElementShim
334
+ meOptions.pluginWidth = t.height;
335
+ meOptions.pluginHeight = t.width;
336
+ }
337
+
338
+
339
+
340
+ // create MediaElement shim
341
+ mejs.MediaElement(t.$media[0], meOptions);
342
+ },
343
+
344
+ showControls: function(doAnimation) {
345
+ var t = this;
346
+
347
+ doAnimation = typeof doAnimation == 'undefined' || doAnimation;
348
+
349
+ if (t.controlsAreVisible)
350
+ return;
351
+
352
+ if (doAnimation) {
353
+ t.controls
354
+ .css('visibility','visible')
355
+ .stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
356
+
357
+ // any additional controls people might add and want to hide
358
+ t.container.find('.mejs-control')
359
+ .css('visibility','visible')
360
+ .stop(true, true).fadeIn(200, function() {t.controlsAreVisible = true;});
361
+
362
+ } else {
363
+ t.controls
364
+ .css('visibility','visible')
365
+ .css('display','block');
366
+
367
+ // any additional controls people might add and want to hide
368
+ t.container.find('.mejs-control')
369
+ .css('visibility','visible')
370
+ .css('display','block');
371
+
372
+ t.controlsAreVisible = true;
373
+ }
374
+
375
+ t.setControlsSize();
376
+
377
+ },
378
+
379
+ hideControls: function(doAnimation) {
380
+ var t = this;
381
+
382
+ doAnimation = typeof doAnimation == 'undefined' || doAnimation;
383
+
384
+ if (!t.controlsAreVisible)
385
+ return;
386
+
387
+ if (doAnimation) {
388
+ // fade out main controls
389
+ t.controls.stop(true, true).fadeOut(200, function() {
390
+ $(this)
391
+ .css('visibility','hidden')
392
+ .css('display','block');
393
+
394
+ t.controlsAreVisible = false;
395
+ });
396
+
397
+ // any additional controls people might add and want to hide
398
+ t.container.find('.mejs-control').stop(true, true).fadeOut(200, function() {
399
+ $(this)
400
+ .css('visibility','hidden')
401
+ .css('display','block');
402
+ });
403
+ } else {
404
+
405
+ // hide main controls
406
+ t.controls
407
+ .css('visibility','hidden')
408
+ .css('display','block');
409
+
410
+ // hide others
411
+ t.container.find('.mejs-control')
412
+ .css('visibility','hidden')
413
+ .css('display','block');
414
+
415
+ t.controlsAreVisible = false;
416
+ }
417
+ },
418
+
419
+ controlsTimer: null,
420
+
421
+ startControlsTimer: function(timeout) {
422
+
423
+ var t = this;
424
+
425
+ timeout = typeof timeout != 'undefined' ? timeout : 1500;
426
+
427
+ t.killControlsTimer('start');
428
+
429
+ t.controlsTimer = setTimeout(function() {
430
+ //console.log('timer fired');
431
+ t.hideControls();
432
+ t.killControlsTimer('hide');
433
+ }, timeout);
434
+ },
435
+
436
+ killControlsTimer: function(src) {
437
+
438
+ var t = this;
439
+
440
+ if (t.controlsTimer !== null) {
441
+ clearTimeout(t.controlsTimer);
442
+ delete t.controlsTimer;
443
+ t.controlsTimer = null;
444
+ }
445
+ },
446
+
447
+ controlsEnabled: true,
448
+
449
+ disableControls: function() {
450
+ var t= this;
451
+
452
+ t.killControlsTimer();
453
+ t.hideControls(false);
454
+ this.controlsEnabled = false;
455
+ },
456
+
457
+ enableControls: function() {
458
+ var t= this;
459
+
460
+ t.showControls(false);
461
+
462
+ t.controlsEnabled = true;
463
+ },
464
+
465
+
466
+ // Sets up all controls and events
467
+ meReady: function(media, domNode) {
468
+
469
+
470
+ var t = this,
471
+ mf = mejs.MediaFeatures,
472
+ autoplayAttr = domNode.getAttribute('autoplay'),
473
+ autoplay = !(typeof autoplayAttr == 'undefined' || autoplayAttr === null || autoplayAttr === 'false'),
474
+ featureIndex,
475
+ feature;
476
+
477
+ // make sure it can't create itself again if a plugin reloads
478
+ if (t.created)
479
+ return;
480
+ else
481
+ t.created = true;
482
+
483
+ t.media = media;
484
+ t.domNode = domNode;
485
+
486
+ if (!(mf.isAndroid && t.options.AndroidUseNativeControls) && !(mf.isiPad && t.options.iPadUseNativeControls) && !(mf.isiPhone && t.options.iPhoneUseNativeControls)) {
487
+
488
+ // two built in features
489
+ t.buildposter(t, t.controls, t.layers, t.media);
490
+ t.buildkeyboard(t, t.controls, t.layers, t.media);
491
+ t.buildoverlays(t, t.controls, t.layers, t.media);
492
+
493
+ // grab for use by features
494
+ t.findTracks();
495
+
496
+ // add user-defined features/controls
497
+ for (featureIndex in t.options.features) {
498
+ feature = t.options.features[featureIndex];
499
+ if (t['build' + feature]) {
500
+ try {
501
+ t['build' + feature](t, t.controls, t.layers, t.media);
502
+ } catch (e) {
503
+ // TODO: report control error
504
+ //throw e;
505
+ //console.log('error building ' + feature);
506
+ //console.log(e);
507
+ }
508
+ }
509
+ }
510
+
511
+ t.container.trigger('controlsready');
512
+
513
+ // reset all layers and controls
514
+ t.setPlayerSize(t.width, t.height);
515
+ t.setControlsSize();
516
+
517
+
518
+ // controls fade
519
+ if (t.isVideo) {
520
+
521
+ if (mejs.MediaFeatures.hasTouch) {
522
+
523
+ // for touch devices (iOS, Android)
524
+ // show/hide without animation on touch
525
+
526
+ t.$media.bind('touchstart', function() {
527
+
528
+
529
+ // toggle controls
530
+ if (t.controlsAreVisible) {
531
+ t.hideControls(false);
532
+ } else {
533
+ if (t.controlsEnabled) {
534
+ t.showControls(false);
535
+ }
536
+ }
537
+ });
538
+
539
+ } else {
540
+ // click controls
541
+ var clickElement = (t.media.pluginType == 'native') ? t.$media : $(t.media.pluginElement);
542
+
543
+ // click to play/pause
544
+ clickElement.click(function() {
545
+ if (media.paused) {
546
+ media.play();
547
+ } else {
548
+ media.pause();
549
+ }
550
+ });
551
+
552
+
553
+ // show/hide controls
554
+ t.container
555
+ .bind('mouseenter mouseover', function () {
556
+ if (t.controlsEnabled) {
557
+ if (!t.options.alwaysShowControls) {
558
+ t.killControlsTimer('enter');
559
+ t.showControls();
560
+ t.startControlsTimer(2500);
561
+ }
562
+ }
563
+ })
564
+ .bind('mousemove', function() {
565
+ if (t.controlsEnabled) {
566
+ if (!t.controlsAreVisible) {
567
+ t.showControls();
568
+ }
569
+ //t.killControlsTimer('move');
570
+ if (!t.options.alwaysShowControls) {
571
+ t.startControlsTimer(2500);
572
+ }
573
+ }
574
+ })
575
+ .bind('mouseleave', function () {
576
+ if (t.controlsEnabled) {
577
+ if (!t.media.paused && !t.options.alwaysShowControls) {
578
+ t.startControlsTimer(1000);
579
+ }
580
+ }
581
+ });
582
+ }
583
+
584
+ // check for autoplay
585
+ if (autoplay && !t.options.alwaysShowControls) {
586
+ t.hideControls();
587
+ }
588
+
589
+ // resizer
590
+ if (t.options.enableAutosize) {
591
+ t.media.addEventListener('loadedmetadata', function(e) {
592
+ // if the <video height> was not set and the options.videoHeight was not set
593
+ // then resize to the real dimensions
594
+ if (t.options.videoHeight <= 0 && t.domNode.getAttribute('height') === null && !isNaN(e.target.videoHeight)) {
595
+ t.setPlayerSize(e.target.videoWidth, e.target.videoHeight);
596
+ t.setControlsSize();
597
+ t.media.setVideoSize(e.target.videoWidth, e.target.videoHeight);
598
+ }
599
+ }, false);
600
+ }
601
+ }
602
+
603
+ // EVENTS
604
+
605
+ // FOCUS: when a video starts playing, it takes focus from other players (possibily pausing them)
606
+ media.addEventListener('play', function() {
607
+
608
+ // go through all other players
609
+ for (var i=0, il=mejs.players.length; i<il; i++) {
610
+ var p = mejs.players[i];
611
+ if (p.id != t.id && t.options.pauseOtherPlayers && !p.paused && !p.ended) {
612
+ p.pause();
613
+ }
614
+ p.hasFocus = false;
615
+ }
616
+
617
+ t.hasFocus = true;
618
+ },false);
619
+
620
+
621
+ // ended for all
622
+ t.media.addEventListener('ended', function (e) {
623
+ try{
624
+ t.media.setCurrentTime(0);
625
+ } catch (exp) {
626
+
627
+ }
628
+ t.media.pause();
629
+
630
+ if (t.setProgressRail)
631
+ t.setProgressRail();
632
+ if (t.setCurrentRail)
633
+ t.setCurrentRail();
634
+
635
+ if (t.options.loop) {
636
+ t.media.play();
637
+ } else if (!t.options.alwaysShowControls && t.controlsEnabled) {
638
+ t.showControls();
639
+ }
640
+ }, false);
641
+
642
+ // resize on the first play
643
+ t.media.addEventListener('loadedmetadata', function(e) {
644
+ if (t.updateDuration) {
645
+ t.updateDuration();
646
+ }
647
+ if (t.updateCurrent) {
648
+ t.updateCurrent();
649
+ }
650
+
651
+ if (!t.isFullScreen) {
652
+ t.setPlayerSize(t.width, t.height);
653
+ t.setControlsSize();
654
+ }
655
+ }, false);
656
+
657
+
658
+ // webkit has trouble doing this without a delay
659
+ setTimeout(function () {
660
+ t.setPlayerSize(t.width, t.height);
661
+ t.setControlsSize();
662
+ }, 50);
663
+
664
+ // adjust controls whenever window sizes (used to be in fullscreen only)
665
+ $(window).resize(function() {
666
+
667
+ // don't resize for fullscreen mode
668
+ if ( !(t.isFullScreen || (mejs.MediaFeatures.hasTrueNativeFullScreen && document.webkitIsFullScreen)) ) {
669
+ t.setPlayerSize(t.width, t.height);
670
+ }
671
+
672
+ // always adjust controls
673
+ t.setControlsSize();
674
+ });
675
+
676
+ // TEMP: needs to be moved somewhere else
677
+ if (t.media.pluginType == 'youtube') {
678
+ t.container.find('.mejs-overlay-play').hide();
679
+ }
680
+ }
681
+
682
+ // force autoplay for HTML5
683
+ if (autoplay && media.pluginType == 'native') {
684
+ media.load();
685
+ media.play();
686
+ }
687
+
688
+
689
+ if (t.options.success) {
690
+
691
+ if (typeof t.options.success == 'string') {
692
+ window[t.options.success](t.media, t.domNode, t);
693
+ } else {
694
+ t.options.success(t.media, t.domNode, t);
695
+ }
696
+ }
697
+ },
698
+
699
+ handleError: function(e) {
700
+ var t = this;
701
+
702
+ t.controls.hide();
703
+
704
+ // Tell user that the file cannot be played
705
+ if (t.options.error) {
706
+ t.options.error(e);
707
+ }
708
+ },
709
+
710
+ setPlayerSize: function(width,height) {
711
+ var t = this;
712
+
713
+ if (t.height.toString().indexOf('%') > 0) {
714
+
715
+ // do we have the native dimensions yet?
716
+ var
717
+ nativeWidth = (t.media.videoWidth && t.media.videoWidth > 0) ? t.media.videoWidth : t.options.defaultVideoWidth,
718
+ nativeHeight = (t.media.videoHeight && t.media.videoHeight > 0) ? t.media.videoHeight : t.options.defaultVideoHeight,
719
+ parentWidth = t.container.parent().width(),
720
+ newHeight = parseInt(parentWidth * nativeHeight/nativeWidth, 10);
721
+
722
+ if (t.container.parent()[0].tagName.toLowerCase() === 'body') { // && t.container.siblings().count == 0) {
723
+ parentWidth = $(window).width();
724
+ newHeight = $(window).height();
725
+ }
726
+
727
+
728
+ // set outer container size
729
+ t.container
730
+ .width(parentWidth)
731
+ .height(newHeight);
732
+
733
+ // set native <video>
734
+ t.$media
735
+ .width('100%')
736
+ .height('100%');
737
+
738
+ // set shims
739
+ t.container.find('object, embed, iframe')
740
+ .width('100%')
741
+ .height('100%');
742
+
743
+ // if shim is ready, send the size to the embeded plugin
744
+ if (t.media.setVideoSize)
745
+ t.media.setVideoSize(parentWidth, newHeight);
746
+
747
+ // set the layers
748
+ t.layers.children('.mejs-layer')
749
+ .width('100%')
750
+ .height('100%');
751
+
752
+
753
+ } else {
754
+
755
+ t.container
756
+ .width(t.width)
757
+ .height(t.height);
758
+
759
+ t.layers.children('.mejs-layer')
760
+ .width(t.width)
761
+ .height(t.height);
762
+
763
+ }
764
+ },
765
+
766
+ setControlsSize: function() {
767
+ var t = this,
768
+ usedWidth = 0,
769
+ railWidth = 0,
770
+ rail = t.controls.find('.mejs-time-rail'),
771
+ total = t.controls.find('.mejs-time-total'),
772
+ current = t.controls.find('.mejs-time-current'),
773
+ loaded = t.controls.find('.mejs-time-loaded');
774
+ others = rail.siblings();
775
+
776
+
777
+ // allow the size to come from custom CSS
778
+ if (t.options && !t.options.autosizeProgress) {
779
+ // Also, frontends devs can be more flexible
780
+ // due the opportunity of absolute positioning.
781
+ railWidth = parseInt(rail.css('width'));
782
+ }
783
+
784
+ // attempt to autosize
785
+ if (railWidth === 0 || !railWidth) {
786
+
787
+ // find the size of all the other controls besides the rail
788
+ others.each(function() {
789
+ if ($(this).css('position') != 'absolute') {
790
+ usedWidth += $(this).outerWidth(true);
791
+ }
792
+ });
793
+
794
+ // fit the rail into the remaining space
795
+ railWidth = t.controls.width() - usedWidth - (rail.outerWidth(true) - rail.outerWidth(false));
796
+ }
797
+
798
+ // outer area
799
+ rail.width(railWidth);
800
+ // dark space
801
+ total.width(railWidth - (total.outerWidth(true) - total.width()));
802
+
803
+ if (t.setProgressRail)
804
+ t.setProgressRail();
805
+ if (t.setCurrentRail)
806
+ t.setCurrentRail();
807
+ },
808
+
809
+
810
+ buildposter: function(player, controls, layers, media) {
811
+ var t = this,
812
+ poster =
813
+ $('<div class="mejs-poster mejs-layer">' +
814
+ '</div>')
815
+ .appendTo(layers),
816
+ posterUrl = player.$media.attr('poster');
817
+
818
+ // prioriy goes to option (this is useful if you need to support iOS 3.x (iOS completely fails with poster)
819
+ if (player.options.poster !== '') {
820
+ posterUrl = player.options.poster;
821
+ }
822
+
823
+ // second, try the real poster
824
+ if (posterUrl !== '' && posterUrl != null) {
825
+ t.setPoster(posterUrl);
826
+ } else {
827
+ poster.hide();
828
+ }
829
+
830
+ media.addEventListener('play',function() {
831
+ poster.hide();
832
+ }, false);
833
+ },
834
+
835
+ setPoster: function(url) {
836
+ var t = this,
837
+ posterDiv = t.container.find('.mejs-poster'),
838
+ posterImg = posterDiv.find('img');
839
+
840
+ if (posterImg.length == 0) {
841
+ posterImg = $('<img width="100%" height="100%" />').appendTo(posterDiv);
842
+ }
843
+
844
+ posterImg.attr('src', url);
845
+ },
846
+
847
+ buildoverlays: function(player, controls, layers, media) {
848
+ if (!player.isVideo)
849
+ return;
850
+
851
+ var
852
+ loading =
853
+ $('<div class="mejs-overlay mejs-layer">'+
854
+ '<div class="mejs-overlay-loading"><span></span></div>'+
855
+ '</div>')
856
+ .hide() // start out hidden
857
+ .appendTo(layers),
858
+ error =
859
+ $('<div class="mejs-overlay mejs-layer">'+
860
+ '<div class="mejs-overlay-error"></div>'+
861
+ '</div>')
862
+ .hide() // start out hidden
863
+ .appendTo(layers),
864
+
865
+ // this needs to come last so it's on top
866
+ bigPlay =
867
+ $('<div class="mejs-overlay mejs-layer mejs-overlay-play">'+
868
+ '<div class="mejs-overlay-button"></div>'+
869
+ '</div>')
870
+ .appendTo(layers)
871
+ .click(function() {
872
+ if (media.paused) {
873
+ media.play();
874
+ } else {
875
+ media.pause();
876
+ }
877
+ });
878
+
879
+ /*
880
+ if (mejs.MediaFeatures.isiOS || mejs.MediaFeatures.isAndroid) {
881
+ bigPlay.remove();
882
+ loading.remove();
883
+ }
884
+ */
885
+
886
+
887
+ // show/hide big play button
888
+ media.addEventListener('play',function() {
889
+ bigPlay.hide();
890
+ loading.hide();
891
+ error.hide();
892
+ }, false);
893
+
894
+ media.addEventListener('playing', function() {
895
+ bigPlay.hide();
896
+ loading.hide();
897
+ error.hide();
898
+ }, false);
899
+
900
+ media.addEventListener('pause',function() {
901
+ if (!mejs.MediaFeatures.isiPhone) {
902
+ bigPlay.show();
903
+ }
904
+ }, false);
905
+
906
+ media.addEventListener('waiting', function() {
907
+ loading.show();
908
+ }, false);
909
+
910
+
911
+ // show/hide loading
912
+ media.addEventListener('loadeddata',function() {
913
+ // for some reason Chrome is firing this event
914
+ //if (mejs.MediaFeatures.isChrome && media.getAttribute && media.getAttribute('preload') === 'none')
915
+ // return;
916
+
917
+ loading.show();
918
+ }, false);
919
+ media.addEventListener('canplay',function() {
920
+ loading.hide();
921
+ }, false);
922
+
923
+ // error handling
924
+ media.addEventListener('error',function() {
925
+ loading.hide();
926
+ error.show();
927
+ error.find('mejs-overlay-error').html("Error loading this resource");
928
+ }, false);
929
+ },
930
+
931
+ buildkeyboard: function(player, controls, layers, media) {
932
+
933
+ var t = this;
934
+
935
+ // listen for key presses
936
+ $(document).keydown(function(e) {
937
+
938
+ if (player.hasFocus && player.options.enableKeyboard) {
939
+
940
+ // find a matching key
941
+ for (var i=0, il=player.options.keyActions.length; i<il; i++) {
942
+ var keyAction = player.options.keyActions[i];
943
+
944
+ for (var j=0, jl=keyAction.keys.length; j<jl; j++) {
945
+ if (e.keyCode == keyAction.keys[j]) {
946
+ e.preventDefault();
947
+ keyAction.action(player, media);
948
+ return false;
949
+ }
950
+ }
951
+ }
952
+ }
953
+
954
+ return true;
955
+ });
956
+
957
+ // check if someone clicked outside a player region, then kill its focus
958
+ $(document).click(function(event) {
959
+ if ($(event.target).closest('.mejs-container').length == 0) {
960
+ player.hasFocus = false;
961
+ }
962
+ });
963
+
964
+ },
965
+
966
+ findTracks: function() {
967
+ var t = this,
968
+ tracktags = t.$media.find('track');
969
+
970
+ // store for use by plugins
971
+ t.tracks = [];
972
+ tracktags.each(function() {
973
+ t.tracks.push({
974
+ srclang: $(this).attr('srclang').toLowerCase(),
975
+ src: $(this).attr('src'),
976
+ kind: $(this).attr('kind'),
977
+ label: $(this).attr('label'),
978
+ entries: [],
979
+ isLoaded: false
980
+ });
981
+ });
982
+ },
983
+ changeSkin: function(className) {
984
+ this.container[0].className = 'mejs-container ' + className;
985
+ this.setPlayerSize();
986
+ this.setControlsSize();
987
+ },
988
+ play: function() {
989
+ this.media.play();
990
+ },
991
+ pause: function() {
992
+ this.media.pause();
993
+ },
994
+ load: function() {
995
+ this.media.load();
996
+ },
997
+ setMuted: function(muted) {
998
+ this.media.setMuted(muted);
999
+ },
1000
+ setCurrentTime: function(time) {
1001
+ this.media.setCurrentTime(time);
1002
+ },
1003
+ getCurrentTime: function() {
1004
+ return this.media.currentTime;
1005
+ },
1006
+ setVolume: function(volume) {
1007
+ this.media.setVolume(volume);
1008
+ },
1009
+ getVolume: function() {
1010
+ return this.media.volume;
1011
+ },
1012
+ setSrc: function(src) {
1013
+ this.media.setSrc(src);
1014
+ },
1015
+ remove: function() {
1016
+ var t = this;
1017
+
1018
+ if (t.media.pluginType == 'flash') {
1019
+ t.media.remove();
1020
+ } else if (t.media.pluginTyp == 'native') {
1021
+ t.media.prop('controls', true);
1022
+ }
1023
+
1024
+ // grab video and put it back in place
1025
+ if (!t.isDynamic) {
1026
+ t.$node.insertBefore(t.container)
1027
+ }
1028
+
1029
+ t.container.remove();
1030
+ }
1031
+ };
1032
+
1033
+ // turn into jQuery plugin
1034
+ if (typeof jQuery != 'undefined') {
1035
+ jQuery.fn.mediaelementplayer = function (options) {
1036
+ return this.each(function () {
1037
+ new mejs.MediaElementPlayer(this, options);
1038
+ });
1039
+ };
1040
+ }
1041
+
1042
+ $(document).ready(function() {
1043
+ // auto enable using JSON attribute
1044
+ $('.mejs-player').mediaelementplayer();
1045
+ });
1046
+
1047
+ // push out to window
1048
+ window.MediaElementPlayer = mejs.MediaElementPlayer;
1049
+
1050
+ })(mejs.$);
1051
+ (function($) {
1052
+
1053
+ $.extend(mejs.MepDefaults, {
1054
+ playpauseText: 'Play/Pause'
1055
+ });
1056
+
1057
+ // PLAY/pause BUTTON
1058
+ $.extend(MediaElementPlayer.prototype, {
1059
+ buildplaypause: function(player, controls, layers, media) {
1060
+ var
1061
+ t = this,
1062
+ play =
1063
+ $('<div class="mejs-button mejs-playpause-button mejs-play" >' +
1064
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.playpauseText + '"></button>' +
1065
+ '</div>')
1066
+ .appendTo(controls)
1067
+ .click(function(e) {
1068
+ e.preventDefault();
1069
+
1070
+ if (media.paused) {
1071
+ media.play();
1072
+ } else {
1073
+ media.pause();
1074
+ }
1075
+
1076
+ return false;
1077
+ });
1078
+
1079
+ media.addEventListener('play',function() {
1080
+ play.removeClass('mejs-play').addClass('mejs-pause');
1081
+ }, false);
1082
+ media.addEventListener('playing',function() {
1083
+ play.removeClass('mejs-play').addClass('mejs-pause');
1084
+ }, false);
1085
+
1086
+
1087
+ media.addEventListener('pause',function() {
1088
+ play.removeClass('mejs-pause').addClass('mejs-play');
1089
+ }, false);
1090
+ media.addEventListener('paused',function() {
1091
+ play.removeClass('mejs-pause').addClass('mejs-play');
1092
+ }, false);
1093
+ }
1094
+ });
1095
+
1096
+ })(mejs.$);
1097
+ (function($) {
1098
+
1099
+ $.extend(mejs.MepDefaults, {
1100
+ stopText: 'Stop'
1101
+ });
1102
+
1103
+ // STOP BUTTON
1104
+ $.extend(MediaElementPlayer.prototype, {
1105
+ buildstop: function(player, controls, layers, media) {
1106
+ var t = this,
1107
+ stop =
1108
+ $('<div class="mejs-button mejs-stop-button mejs-stop">' +
1109
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.stopText + '></button>' +
1110
+ '</div>')
1111
+ .appendTo(controls)
1112
+ .click(function() {
1113
+ if (!media.paused) {
1114
+ media.pause();
1115
+ }
1116
+ if (media.currentTime > 0) {
1117
+ media.setCurrentTime(0);
1118
+ controls.find('.mejs-time-current').width('0px');
1119
+ controls.find('.mejs-time-handle').css('left', '0px');
1120
+ controls.find('.mejs-time-float-current').html( mejs.Utility.secondsToTimeCode(0) );
1121
+ controls.find('.mejs-currenttime').html( mejs.Utility.secondsToTimeCode(0) );
1122
+ layers.find('.mejs-poster').show();
1123
+ }
1124
+ });
1125
+ }
1126
+ });
1127
+
1128
+ })(mejs.$);
1129
+ (function($) {
1130
+ // progress/loaded bar
1131
+ $.extend(MediaElementPlayer.prototype, {
1132
+ buildprogress: function(player, controls, layers, media) {
1133
+
1134
+ $('<div class="mejs-time-rail">'+
1135
+ '<span class="mejs-time-total">'+
1136
+ '<span class="mejs-time-loaded"></span>'+
1137
+ '<span class="mejs-time-current"></span>'+
1138
+ '<span class="mejs-time-handle"></span>'+
1139
+ '<span class="mejs-time-float">' +
1140
+ '<span class="mejs-time-float-current">00:00</span>' +
1141
+ '<span class="mejs-time-float-corner"></span>' +
1142
+ '</span>'+
1143
+ '</span>'+
1144
+ '</div>')
1145
+ .appendTo(controls);
1146
+
1147
+ var
1148
+ t = this,
1149
+ total = controls.find('.mejs-time-total'),
1150
+ loaded = controls.find('.mejs-time-loaded'),
1151
+ current = controls.find('.mejs-time-current'),
1152
+ handle = controls.find('.mejs-time-handle'),
1153
+ timefloat = controls.find('.mejs-time-float'),
1154
+ timefloatcurrent = controls.find('.mejs-time-float-current'),
1155
+ handleMouseMove = function (e) {
1156
+ // mouse position relative to the object
1157
+ var x = e.pageX,
1158
+ offset = total.offset(),
1159
+ width = total.outerWidth(),
1160
+ percentage = 0,
1161
+ newTime = 0,
1162
+ pos = x - offset.left;
1163
+
1164
+
1165
+ if (x > offset.left && x <= width + offset.left && media.duration) {
1166
+ percentage = ((x - offset.left) / width);
1167
+ newTime = (percentage <= 0.02) ? 0 : percentage * media.duration;
1168
+
1169
+ // seek to where the mouse is
1170
+ if (mouseIsDown) {
1171
+ media.setCurrentTime(newTime);
1172
+ }
1173
+
1174
+ // position floating time box
1175
+ if (!mejs.MediaFeatures.hasTouch) {
1176
+ timefloat.css('left', pos);
1177
+ timefloatcurrent.html( mejs.Utility.secondsToTimeCode(newTime) );
1178
+ timefloat.show();
1179
+ }
1180
+ }
1181
+ },
1182
+ mouseIsDown = false,
1183
+ mouseIsOver = false;
1184
+
1185
+ // handle clicks
1186
+ //controls.find('.mejs-time-rail').delegate('span', 'click', handleMouseMove);
1187
+ total
1188
+ .bind('mousedown', function (e) {
1189
+ // only handle left clicks
1190
+ if (e.which === 1) {
1191
+ mouseIsDown = true;
1192
+ handleMouseMove(e);
1193
+ return false;
1194
+ }
1195
+ });
1196
+
1197
+ controls.find('.mejs-time-total')
1198
+ .bind('mouseenter', function(e) {
1199
+ mouseIsOver = true;
1200
+ if (!mejs.MediaFeatures.hasTouch) {
1201
+ timefloat.show();
1202
+ }
1203
+ })
1204
+ .bind('mouseleave',function(e) {
1205
+ mouseIsOver = false;
1206
+ timefloat.hide();
1207
+ });
1208
+
1209
+ $(document)
1210
+ .bind('mouseup', function (e) {
1211
+ mouseIsDown = false;
1212
+ timefloat.hide();
1213
+ //handleMouseMove(e);
1214
+ })
1215
+ .bind('mousemove', function (e) {
1216
+ if (mouseIsDown || mouseIsOver) {
1217
+ handleMouseMove(e);
1218
+ }
1219
+ });
1220
+
1221
+ // loading
1222
+ media.addEventListener('progress', function (e) {
1223
+ player.setProgressRail(e);
1224
+ player.setCurrentRail(e);
1225
+ }, false);
1226
+
1227
+ // current time
1228
+ media.addEventListener('timeupdate', function(e) {
1229
+ player.setProgressRail(e);
1230
+ player.setCurrentRail(e);
1231
+ }, false);
1232
+
1233
+
1234
+ // store for later use
1235
+ t.loaded = loaded;
1236
+ t.total = total;
1237
+ t.current = current;
1238
+ t.handle = handle;
1239
+ },
1240
+ setProgressRail: function(e) {
1241
+
1242
+ var
1243
+ t = this,
1244
+ target = (e != undefined) ? e.target : t.media,
1245
+ percent = null;
1246
+
1247
+ // newest HTML5 spec has buffered array (FF4, Webkit)
1248
+ if (target && target.buffered && target.buffered.length > 0 && target.buffered.end && target.duration) {
1249
+ // TODO: account for a real array with multiple values (only Firefox 4 has this so far)
1250
+ percent = target.buffered.end(0) / target.duration;
1251
+ }
1252
+ // Some browsers (e.g., FF3.6 and Safari 5) cannot calculate target.bufferered.end()
1253
+ // to be anything other than 0. If the byte count is available we use this instead.
1254
+ // Browsers that support the else if do not seem to have the bufferedBytes value and
1255
+ // should skip to there. Tested in Safari 5, Webkit head, FF3.6, Chrome 6, IE 7/8.
1256
+ else if (target && target.bytesTotal != undefined && target.bytesTotal > 0 && target.bufferedBytes != undefined) {
1257
+ percent = target.bufferedBytes / target.bytesTotal;
1258
+ }
1259
+ // Firefox 3 with an Ogg file seems to go this way
1260
+ else if (e && e.lengthComputable && e.total != 0) {
1261
+ percent = e.loaded/e.total;
1262
+ }
1263
+
1264
+ // finally update the progress bar
1265
+ if (percent !== null) {
1266
+ percent = Math.min(1, Math.max(0, percent));
1267
+ // update loaded bar
1268
+ if (t.loaded && t.total) {
1269
+ t.loaded.width(t.total.width() * percent);
1270
+ }
1271
+ }
1272
+ },
1273
+ setCurrentRail: function() {
1274
+
1275
+ var t = this;
1276
+
1277
+ if (t.media.currentTime != undefined && t.media.duration) {
1278
+
1279
+ // update bar and handle
1280
+ if (t.total && t.handle) {
1281
+ var
1282
+ newWidth = t.total.width() * t.media.currentTime / t.media.duration,
1283
+ handlePos = newWidth - (t.handle.outerWidth(true) / 2);
1284
+
1285
+ t.current.width(newWidth);
1286
+ t.handle.css('left', handlePos);
1287
+ }
1288
+ }
1289
+
1290
+ }
1291
+ });
1292
+ })(mejs.$);
1293
+ (function($) {
1294
+
1295
+ // options
1296
+ $.extend(mejs.MepDefaults, {
1297
+ duration: -1
1298
+ });
1299
+
1300
+
1301
+ // current and duration 00:00 / 00:00
1302
+ $.extend(MediaElementPlayer.prototype, {
1303
+ buildcurrent: function(player, controls, layers, media) {
1304
+ var t = this;
1305
+
1306
+ $('<div class="mejs-time">'+
1307
+ '<span class="mejs-currenttime">' + (player.options.alwaysShowHours ? '00:' : '')
1308
+ + (player.options.showTimecodeFrameCount? '00:00:00':'00:00')+ '</span>'+
1309
+ '</div>')
1310
+ .appendTo(controls);
1311
+
1312
+ t.currenttime = t.controls.find('.mejs-currenttime');
1313
+
1314
+ media.addEventListener('timeupdate',function() {
1315
+ player.updateCurrent();
1316
+ }, false);
1317
+ },
1318
+
1319
+
1320
+ buildduration: function(player, controls, layers, media) {
1321
+ var t = this;
1322
+
1323
+ if (controls.children().last().find('.mejs-currenttime').length > 0) {
1324
+ $(' <span> | </span> '+
1325
+ '<span class="mejs-duration">' +
1326
+ (t.options.duration > 0 ?
1327
+ mejs.Utility.secondsToTimeCode(t.options.duration, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25) :
1328
+ ((player.options.alwaysShowHours ? '00:' : '') + (player.options.showTimecodeFrameCount? '00:00:00':'00:00'))
1329
+ ) +
1330
+ '</span>')
1331
+ .appendTo(controls.find('.mejs-time'));
1332
+ } else {
1333
+
1334
+ // add class to current time
1335
+ controls.find('.mejs-currenttime').parent().addClass('mejs-currenttime-container');
1336
+
1337
+ $('<div class="mejs-time mejs-duration-container">'+
1338
+ '<span class="mejs-duration">' +
1339
+ (t.options.duration > 0 ?
1340
+ mejs.Utility.secondsToTimeCode(t.options.duration, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25) :
1341
+ ((player.options.alwaysShowHours ? '00:' : '') + (player.options.showTimecodeFrameCount? '00:00:00':'00:00'))
1342
+ ) +
1343
+ '</span>' +
1344
+ '</div>')
1345
+ .appendTo(controls);
1346
+ }
1347
+
1348
+ t.durationD = t.controls.find('.mejs-duration');
1349
+
1350
+ media.addEventListener('timeupdate',function() {
1351
+ player.updateDuration();
1352
+ }, false);
1353
+ },
1354
+
1355
+ updateCurrent: function() {
1356
+ var t = this;
1357
+
1358
+ if (t.currenttime) {
1359
+ t.currenttime.html(mejs.Utility.secondsToTimeCode(t.media.currentTime, t.options.alwaysShowHours || t.media.duration > 3600, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25));
1360
+ }
1361
+ },
1362
+
1363
+ updateDuration: function() {
1364
+ var t = this;
1365
+
1366
+ if (t.media.duration && t.durationD) {
1367
+ t.durationD.html(mejs.Utility.secondsToTimeCode(t.media.duration, t.options.alwaysShowHours, t.options.showTimecodeFrameCount, t.options.framesPerSecond || 25));
1368
+ }
1369
+ }
1370
+ });
1371
+
1372
+ })(mejs.$);
1373
+ (function($) {
1374
+
1375
+ $.extend(mejs.MepDefaults, {
1376
+ muteText: 'Mute Toggle',
1377
+ hideVolumeOnTouchDevices: true
1378
+ });
1379
+
1380
+ $.extend(MediaElementPlayer.prototype, {
1381
+ buildvolume: function(player, controls, layers, media) {
1382
+
1383
+ // Android and iOS don't support volume controls
1384
+ if (mejs.MediaFeatures.hasTouch && this.options.hideVolumeOnTouchDevices)
1385
+ return;
1386
+
1387
+ var t = this,
1388
+ mute =
1389
+ $('<div class="mejs-button mejs-volume-button mejs-mute">'+
1390
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.muteText + '"></button>'+
1391
+ '<div class="mejs-volume-slider">'+ // outer background
1392
+ '<div class="mejs-volume-total"></div>'+ // line background
1393
+ '<div class="mejs-volume-current"></div>'+ // current volume
1394
+ '<div class="mejs-volume-handle"></div>'+ // handle
1395
+ '</div>'+
1396
+ '</div>')
1397
+ .appendTo(controls),
1398
+ volumeSlider = mute.find('.mejs-volume-slider'),
1399
+ volumeTotal = mute.find('.mejs-volume-total'),
1400
+ volumeCurrent = mute.find('.mejs-volume-current'),
1401
+ volumeHandle = mute.find('.mejs-volume-handle'),
1402
+
1403
+ positionVolumeHandle = function(volume) {
1404
+
1405
+ if (!volumeSlider.is(':visible')) {
1406
+ volumeSlider.show();
1407
+ positionVolumeHandle(volume);
1408
+ volumeSlider.hide()
1409
+ return;
1410
+ }
1411
+
1412
+ var
1413
+
1414
+ // height of the full size volume slider background
1415
+ totalHeight = volumeTotal.height(),
1416
+
1417
+ // top/left of full size volume slider background
1418
+ totalPosition = volumeTotal.position(),
1419
+
1420
+ // the new top position based on the current volume
1421
+ // 70% volume on 100px height == top:30px
1422
+ newTop = totalHeight - (totalHeight * volume);
1423
+
1424
+ // handle
1425
+ volumeHandle.css('top', totalPosition.top + newTop - (volumeHandle.height() / 2));
1426
+
1427
+ // show the current visibility
1428
+ volumeCurrent.height(totalHeight - newTop );
1429
+ volumeCurrent.css('top', totalPosition.top + newTop);
1430
+ },
1431
+ handleVolumeMove = function(e) {
1432
+ var
1433
+ railHeight = volumeTotal.height(),
1434
+ totalOffset = volumeTotal.offset(),
1435
+ totalTop = parseInt(volumeTotal.css('top').replace(/px/,''),10),
1436
+ newY = e.pageY - totalOffset.top,
1437
+ volume = (railHeight - newY) / railHeight
1438
+
1439
+ // the controls just hide themselves (usually when mouse moves too far up)
1440
+ if (totalOffset.top == 0)
1441
+ return;
1442
+
1443
+ // 0-1
1444
+ volume = Math.max(0,volume);
1445
+ volume = Math.min(volume,1);
1446
+
1447
+ // TODO: handle vertical and horizontal CSS
1448
+ // only allow it to move within the rail
1449
+ if (newY < 0)
1450
+ newY = 0;
1451
+ else if (newY > railHeight)
1452
+ newY = railHeight;
1453
+
1454
+ // move the handle to match the mouse
1455
+ volumeHandle.css('top', newY - (volumeHandle.height() / 2) + totalTop );
1456
+
1457
+ // show the current visibility
1458
+ volumeCurrent.height(railHeight-newY);
1459
+ volumeCurrent.css('top',newY+totalTop);
1460
+
1461
+ // set mute status
1462
+ if (volume == 0) {
1463
+ media.setMuted(true);
1464
+ mute.removeClass('mejs-mute').addClass('mejs-unmute');
1465
+ } else {
1466
+ media.setMuted(false);
1467
+ mute.removeClass('mejs-unmute').addClass('mejs-mute');
1468
+ }
1469
+
1470
+ volume = Math.max(0,volume);
1471
+ volume = Math.min(volume,1);
1472
+
1473
+ // set the volume
1474
+ media.setVolume(volume);
1475
+ },
1476
+ mouseIsDown = false,
1477
+ mouseIsOver = false;
1478
+
1479
+ // SLIDER
1480
+ mute
1481
+ .hover(function() {
1482
+ volumeSlider.show();
1483
+ mouseIsOver = true;
1484
+ }, function() {
1485
+ mouseIsOver = false;
1486
+
1487
+ if (!mouseIsDown) {
1488
+ volumeSlider.hide();
1489
+ }
1490
+ });
1491
+
1492
+ volumeSlider
1493
+ .bind('mouseover', function() {
1494
+ mouseIsOver = true;
1495
+ })
1496
+ .bind('mousedown', function (e) {
1497
+ handleVolumeMove(e);
1498
+ mouseIsDown = true;
1499
+
1500
+ return false;
1501
+ });
1502
+
1503
+ $(document)
1504
+ .bind('mouseup', function (e) {
1505
+ mouseIsDown = false;
1506
+
1507
+ if (!mouseIsOver) {
1508
+ volumeSlider.hide();
1509
+ }
1510
+ })
1511
+ .bind('mousemove', function (e) {
1512
+ if (mouseIsDown) {
1513
+ handleVolumeMove(e);
1514
+ }
1515
+ });
1516
+
1517
+
1518
+ // MUTE button
1519
+ mute.find('button').click(function() {
1520
+
1521
+ media.setMuted( !media.muted );
1522
+
1523
+ });
1524
+
1525
+ // listen for volume change events from other sources
1526
+ media.addEventListener('volumechange', function(e) {
1527
+ if (!mouseIsDown) {
1528
+ if (media.muted) {
1529
+ positionVolumeHandle(0);
1530
+ mute.removeClass('mejs-mute').addClass('mejs-unmute');
1531
+ } else {
1532
+ positionVolumeHandle(media.volume);
1533
+ mute.removeClass('mejs-unmute').addClass('mejs-mute');
1534
+ }
1535
+ }
1536
+ }, false);
1537
+
1538
+ // set initial volume
1539
+ //console.log('init volume',player.options.startVolume);
1540
+ positionVolumeHandle(player.options.startVolume);
1541
+
1542
+ // shim gets the startvolume as a parameter, but we have to set it on the native <video> and <audio> elements
1543
+ if (media.pluginType === 'native') {
1544
+ media.setVolume(player.options.startVolume);
1545
+ }
1546
+ }
1547
+ });
1548
+
1549
+ })(mejs.$);
1550
+
1551
+ (function($) {
1552
+
1553
+ $.extend(mejs.MepDefaults, {
1554
+ usePluginFullScreen: false,
1555
+ newWindowCallback: function() { return '';},
1556
+ fullscreenText: 'Fullscreen'
1557
+ });
1558
+
1559
+ $.extend(MediaElementPlayer.prototype, {
1560
+
1561
+ isFullScreen: false,
1562
+
1563
+ isNativeFullScreen: false,
1564
+
1565
+ docStyleOverflow: null,
1566
+
1567
+ isInIframe: false,
1568
+
1569
+ buildfullscreen: function(player, controls, layers, media) {
1570
+
1571
+ if (!player.isVideo)
1572
+ return;
1573
+
1574
+ player.isInIframe = (window.location != window.parent.location);
1575
+
1576
+ // native events
1577
+ if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
1578
+
1579
+ player.container.bind(mejs.MediaFeatures.fullScreenEventName, function(e) {
1580
+ //player.container.bind('webkitfullscreenchange', function(e) {
1581
+
1582
+
1583
+ if (mejs.MediaFeatures.isFullScreen()) {
1584
+ player.isNativeFullScreen = true;
1585
+ // reset the controls once we are fully in full screen
1586
+ player.setControlsSize();
1587
+ } else {
1588
+ player.isNativeFullScreen = false;
1589
+ // when a user presses ESC
1590
+ // make sure to put the player back into place
1591
+ player.exitFullScreen();
1592
+ }
1593
+ });
1594
+ }
1595
+
1596
+ var t = this,
1597
+ normalHeight = 0,
1598
+ normalWidth = 0,
1599
+ container = player.container,
1600
+ fullscreenBtn =
1601
+ $('<div class="mejs-button mejs-fullscreen-button">' +
1602
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.fullscreenText + '"></button>' +
1603
+ '</div>')
1604
+ .appendTo(controls);
1605
+
1606
+ if (t.media.pluginType === 'native' || (!t.options.usePluginFullScreen && !mejs.MediaFeatures.isFirefox)) {
1607
+
1608
+ fullscreenBtn.click(function() {
1609
+ var isFullScreen = (mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || player.isFullScreen;
1610
+
1611
+ if (isFullScreen) {
1612
+ player.exitFullScreen();
1613
+ } else {
1614
+ player.enterFullScreen();
1615
+ }
1616
+ });
1617
+
1618
+ } else {
1619
+
1620
+ var hideTimeout = null;
1621
+
1622
+ fullscreenBtn
1623
+ .mouseover(function() {
1624
+
1625
+ if (hideTimeout !== null) {
1626
+ clearTimeout(hideTimeout);
1627
+ delete hideTimeout;
1628
+ }
1629
+
1630
+ var buttonPos = fullscreenBtn.offset(),
1631
+ containerPos = player.container.offset();
1632
+
1633
+ media.positionFullscreenButton(buttonPos.left - containerPos.left, buttonPos.top - containerPos.top);
1634
+
1635
+ })
1636
+ .mouseout(function() {
1637
+
1638
+ if (hideTimeout !== null) {
1639
+ clearTimeout(hideTimeout);
1640
+ delete hideTimeout;
1641
+ }
1642
+
1643
+ hideTimeout = setTimeout(function() {
1644
+ media.hideFullscreenButton();
1645
+ }, 1500);
1646
+
1647
+
1648
+ })
1649
+ }
1650
+
1651
+ player.fullscreenBtn = fullscreenBtn;
1652
+
1653
+ $(document).bind('keydown',function (e) {
1654
+ if (((mejs.MediaFeatures.hasTrueNativeFullScreen && mejs.MediaFeatures.isFullScreen()) || t.isFullScreen) && e.keyCode == 27) {
1655
+ player.exitFullScreen();
1656
+ }
1657
+ });
1658
+
1659
+ },
1660
+ enterFullScreen: function() {
1661
+
1662
+ var t = this;
1663
+
1664
+ // firefox+flash can't adjust plugin sizes without resetting :(
1665
+ if (t.media.pluginType !== 'native' && (mejs.MediaFeatures.isFirefox || t.options.usePluginFullScreen)) {
1666
+ //t.media.setFullscreen(true);
1667
+ //player.isFullScreen = true;
1668
+ return;
1669
+ }
1670
+
1671
+ // store overflow
1672
+ docStyleOverflow = document.documentElement.style.overflow;
1673
+ // set it to not show scroll bars so 100% will work
1674
+ document.documentElement.style.overflow = 'hidden';
1675
+
1676
+ // store sizing
1677
+ normalHeight = t.container.height();
1678
+ normalWidth = t.container.width();
1679
+
1680
+ // attempt to do true fullscreen (Safari 5.1 and Firefox Nightly only for now)
1681
+ if (t.media.pluginType === 'native') {
1682
+ if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
1683
+
1684
+ mejs.MediaFeatures.requestFullScreen(t.container[0]);
1685
+ //return;
1686
+
1687
+ } else if (mejs.MediaFeatures.hasSemiNativeFullScreen) {
1688
+ t.media.webkitEnterFullscreen();
1689
+ return;
1690
+ }
1691
+ }
1692
+
1693
+ // check for iframe launch
1694
+ if (t.isInIframe) {
1695
+ var url = t.options.newWindowCallback(this);
1696
+
1697
+
1698
+ if (url !== '') {
1699
+
1700
+ // launch immediately
1701
+ if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
1702
+ t.pause();
1703
+ window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
1704
+ return;
1705
+ } else {
1706
+ setTimeout(function() {
1707
+ if (!t.isNativeFullScreen) {
1708
+ t.pause();
1709
+ window.open(url, t.id, 'top=0,left=0,width=' + screen.availWidth + ',height=' + screen.availHeight + ',resizable=yes,scrollbars=no,status=no,toolbar=no');
1710
+ }
1711
+ }, 250);
1712
+ }
1713
+ }
1714
+
1715
+ }
1716
+
1717
+ // full window code
1718
+
1719
+
1720
+
1721
+ // make full size
1722
+ t.container
1723
+ .addClass('mejs-container-fullscreen')
1724
+ .width('100%')
1725
+ .height('100%');
1726
+ //.css({position: 'fixed', left: 0, top: 0, right: 0, bottom: 0, overflow: 'hidden', width: '100%', height: '100%', 'z-index': 1000});
1727
+
1728
+ // Only needed for safari 5.1 native full screen, can cause display issues elsewhere
1729
+ // Actually, it seems to be needed for IE8, too
1730
+ //if (mejs.MediaFeatures.hasTrueNativeFullScreen) {
1731
+ setTimeout(function() {
1732
+ t.container.css({width: '100%', height: '100%'});
1733
+ t.setControlsSize();
1734
+ }, 500);
1735
+ //}
1736
+
1737
+ if (t.pluginType === 'native') {
1738
+ t.$media
1739
+ .width('100%')
1740
+ .height('100%');
1741
+ } else {
1742
+ t.container.find('object, embed, iframe')
1743
+ .width('100%')
1744
+ .height('100%');
1745
+
1746
+ //if (!mejs.MediaFeatures.hasTrueNativeFullScreen) {
1747
+ t.media.setVideoSize($(window).width(),$(window).height());
1748
+ //}
1749
+ }
1750
+
1751
+ t.layers.children('div')
1752
+ .width('100%')
1753
+ .height('100%');
1754
+
1755
+ if (t.fullscreenBtn) {
1756
+ t.fullscreenBtn
1757
+ .removeClass('mejs-fullscreen')
1758
+ .addClass('mejs-unfullscreen');
1759
+ }
1760
+
1761
+ t.setControlsSize();
1762
+ t.isFullScreen = true;
1763
+ },
1764
+
1765
+ exitFullScreen: function() {
1766
+
1767
+ var t = this;
1768
+
1769
+ // firefox can't adjust plugins
1770
+ if (t.media.pluginType !== 'native' && mejs.MediaFeatures.isFirefox) {
1771
+ t.media.setFullscreen(false);
1772
+ //player.isFullScreen = false;
1773
+ return;
1774
+ }
1775
+
1776
+ // come outo of native fullscreen
1777
+ if (mejs.MediaFeatures.hasTrueNativeFullScreen && (mejs.MediaFeatures.isFullScreen() || t.isFullScreen)) {
1778
+ mejs.MediaFeatures.cancelFullScreen();
1779
+ }
1780
+
1781
+ // restore scroll bars to document
1782
+ document.documentElement.style.overflow = docStyleOverflow;
1783
+
1784
+ t.container
1785
+ .removeClass('mejs-container-fullscreen')
1786
+ .width(normalWidth)
1787
+ .height(normalHeight);
1788
+ //.css({position: '', left: '', top: '', right: '', bottom: '', overflow: 'inherit', width: normalWidth + 'px', height: normalHeight + 'px', 'z-index': 1});
1789
+
1790
+ if (t.pluginType === 'native') {
1791
+ t.$media
1792
+ .width(normalWidth)
1793
+ .height(normalHeight);
1794
+ } else {
1795
+ t.container.find('object embed')
1796
+ .width(normalWidth)
1797
+ .height(normalHeight);
1798
+
1799
+ t.media.setVideoSize(normalWidth, normalHeight);
1800
+ }
1801
+
1802
+ t.layers.children('div')
1803
+ .width(normalWidth)
1804
+ .height(normalHeight);
1805
+
1806
+ t.fullscreenBtn
1807
+ .removeClass('mejs-unfullscreen')
1808
+ .addClass('mejs-fullscreen');
1809
+
1810
+ t.setControlsSize();
1811
+ t.isFullScreen = false;
1812
+ }
1813
+ });
1814
+
1815
+ })(mejs.$);
1816
+
1817
+ (function($) {
1818
+
1819
+ // add extra default options
1820
+ $.extend(mejs.MepDefaults, {
1821
+ // this will automatically turn on a <track>
1822
+ startLanguage: '',
1823
+
1824
+ tracksText: 'Captions/Subtitles'
1825
+ });
1826
+
1827
+ $.extend(MediaElementPlayer.prototype, {
1828
+
1829
+ hasChapters: false,
1830
+
1831
+ buildtracks: function(player, controls, layers, media) {
1832
+ if (!player.isVideo)
1833
+ return;
1834
+
1835
+ if (player.tracks.length == 0)
1836
+ return;
1837
+
1838
+ var t= this, i, options = '';
1839
+
1840
+ player.chapters =
1841
+ $('<div class="mejs-chapters mejs-layer"></div>')
1842
+ .prependTo(layers).hide();
1843
+ player.captions =
1844
+ $('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position"><span class="mejs-captions-text"></span></div></div>')
1845
+ .prependTo(layers).hide();
1846
+ player.captionsText = player.captions.find('.mejs-captions-text');
1847
+ player.captionsButton =
1848
+ $('<div class="mejs-button mejs-captions-button">'+
1849
+ '<button type="button" aria-controls="' + t.id + '" title="' + t.options.tracksText + '"></button>'+
1850
+ '<div class="mejs-captions-selector">'+
1851
+ '<ul>'+
1852
+ '<li>'+
1853
+ '<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
1854
+ '<label for="' + player.id + '_captions_none">None</label>'+
1855
+ '</li>' +
1856
+ '</ul>'+
1857
+ '</div>'+
1858
+ '</div>')
1859
+ .appendTo(controls)
1860
+
1861
+ // hover
1862
+ .hover(function() {
1863
+ $(this).find('.mejs-captions-selector').css('visibility','visible');
1864
+ }, function() {
1865
+ $(this).find('.mejs-captions-selector').css('visibility','hidden');
1866
+ })
1867
+
1868
+ // handle clicks to the language radio buttons
1869
+ .delegate('input[type=radio]','click',function() {
1870
+ lang = this.value;
1871
+
1872
+ if (lang == 'none') {
1873
+ player.selectedTrack = null;
1874
+ } else {
1875
+ for (i=0; i<player.tracks.length; i++) {
1876
+ if (player.tracks[i].srclang == lang) {
1877
+ player.selectedTrack = player.tracks[i];
1878
+ player.captions.attr('lang', player.selectedTrack.srclang);
1879
+ player.displayCaptions();
1880
+ break;
1881
+ }
1882
+ }
1883
+ }
1884
+ });
1885
+ //.bind('mouseenter', function() {
1886
+ // player.captionsButton.find('.mejs-captions-selector').css('visibility','visible')
1887
+ //});
1888
+
1889
+ if (!player.options.alwaysShowControls) {
1890
+ // move with controls
1891
+ player.container
1892
+ .bind('mouseenter', function () {
1893
+ // push captions above controls
1894
+ player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
1895
+
1896
+ })
1897
+ .bind('mouseleave', function () {
1898
+ if (!media.paused) {
1899
+ // move back to normal place
1900
+ player.container.find('.mejs-captions-position').removeClass('mejs-captions-position-hover');
1901
+ }
1902
+ });
1903
+ } else {
1904
+ player.container.find('.mejs-captions-position').addClass('mejs-captions-position-hover');
1905
+ }
1906
+
1907
+ player.trackToLoad = -1;
1908
+ player.selectedTrack = null;
1909
+ player.isLoadingTrack = false;
1910
+
1911
+
1912
+
1913
+ // add to list
1914
+ for (i=0; i<player.tracks.length; i++) {
1915
+ if (player.tracks[i].kind == 'subtitles') {
1916
+ player.addTrackButton(player.tracks[i].srclang, player.tracks[i].label);
1917
+ }
1918
+ }
1919
+
1920
+ player.loadNextTrack();
1921
+
1922
+
1923
+ media.addEventListener('timeupdate',function(e) {
1924
+ player.displayCaptions();
1925
+ }, false);
1926
+
1927
+ media.addEventListener('loadedmetadata', function(e) {
1928
+ player.displayChapters();
1929
+ }, false);
1930
+
1931
+ player.container.hover(
1932
+ function () {
1933
+ // chapters
1934
+ if (player.hasChapters) {
1935
+ player.chapters.css('visibility','visible');
1936
+ player.chapters.fadeIn(200);
1937
+ }
1938
+ },
1939
+ function () {
1940
+ if (player.hasChapters && !media.paused) {
1941
+ player.chapters.fadeOut(200, function() {
1942
+ $(this).css('visibility','hidden');
1943
+ $(this).css('display','block');
1944
+ });
1945
+ }
1946
+ });
1947
+
1948
+ // check for autoplay
1949
+ if (player.node.getAttribute('autoplay') !== null) {
1950
+ player.chapters.css('visibility','hidden');
1951
+ }
1952
+ },
1953
+
1954
+ loadNextTrack: function() {
1955
+ var t = this;
1956
+
1957
+ t.trackToLoad++;
1958
+ if (t.trackToLoad < t.tracks.length) {
1959
+ t.isLoadingTrack = true;
1960
+ t.loadTrack(t.trackToLoad);
1961
+ } else {
1962
+ // add done?
1963
+ t.isLoadingTrack = false;
1964
+ }
1965
+ },
1966
+
1967
+ loadTrack: function(index){
1968
+ var
1969
+ t = this,
1970
+ track = t.tracks[index],
1971
+ after = function() {
1972
+
1973
+ track.isLoaded = true;
1974
+
1975
+ // create button
1976
+ //t.addTrackButton(track.srclang);
1977
+ t.enableTrackButton(track.srclang, track.label);
1978
+
1979
+ t.loadNextTrack();
1980
+
1981
+ };
1982
+
1983
+ if (track.isTranslation) {
1984
+
1985
+ // translate the first track
1986
+ mejs.TrackFormatParser.translateTrackText(t.tracks[0].entries, t.tracks[0].srclang, track.srclang, t.options.googleApiKey, function(newOne) {
1987
+
1988
+ // store the new translation
1989
+ track.entries = newOne;
1990
+
1991
+ after();
1992
+ });
1993
+
1994
+ } else {
1995
+ $.ajax({
1996
+ url: track.src,
1997
+ success: function(d) {
1998
+
1999
+ // parse the loaded file
2000
+ track.entries = mejs.TrackFormatParser.parse(d);
2001
+ after();
2002
+
2003
+ if (track.kind == 'chapters' && t.media.duration > 0) {
2004
+ t.drawChapters(track);
2005
+ }
2006
+ },
2007
+ error: function() {
2008
+ t.loadNextTrack();
2009
+ }
2010
+ });
2011
+ }
2012
+ },
2013
+
2014
+ enableTrackButton: function(lang, label) {
2015
+ var t = this;
2016
+
2017
+ if (label === '') {
2018
+ label = mejs.language.codes[lang] || lang;
2019
+ }
2020
+
2021
+ t.captionsButton
2022
+ .find('input[value=' + lang + ']')
2023
+ .prop('disabled',false)
2024
+ .siblings('label')
2025
+ .html( label );
2026
+
2027
+ // auto select
2028
+ if (t.options.startLanguage == lang) {
2029
+ $('#' + t.id + '_captions_' + lang).click();
2030
+ }
2031
+
2032
+ t.adjustLanguageBox();
2033
+ },
2034
+
2035
+ addTrackButton: function(lang, label) {
2036
+ var t = this;
2037
+ if (label === '') {
2038
+ label = mejs.language.codes[lang] || lang;
2039
+ }
2040
+
2041
+ t.captionsButton.find('ul').append(
2042
+ $('<li>'+
2043
+ '<input type="radio" name="' + t.id + '_captions" id="' + t.id + '_captions_' + lang + '" value="' + lang + '" disabled="disabled" />' +
2044
+ '<label for="' + t.id + '_captions_' + lang + '">' + label + ' (loading)' + '</label>'+
2045
+ '</li>')
2046
+ );
2047
+
2048
+ t.adjustLanguageBox();
2049
+
2050
+ // remove this from the dropdownlist (if it exists)
2051
+ t.container.find('.mejs-captions-translations option[value=' + lang + ']').remove();
2052
+ },
2053
+
2054
+ adjustLanguageBox:function() {
2055
+ var t = this;
2056
+ // adjust the size of the outer box
2057
+ t.captionsButton.find('.mejs-captions-selector').height(
2058
+ t.captionsButton.find('.mejs-captions-selector ul').outerHeight(true) +
2059
+ t.captionsButton.find('.mejs-captions-translations').outerHeight(true)
2060
+ );
2061
+ },
2062
+
2063
+ displayCaptions: function() {
2064
+
2065
+ if (typeof this.tracks == 'undefined')
2066
+ return;
2067
+
2068
+ var
2069
+ t = this,
2070
+ i,
2071
+ track = t.selectedTrack;
2072
+
2073
+ if (track != null && track.isLoaded) {
2074
+ for (i=0; i<track.entries.times.length; i++) {
2075
+ if (t.media.currentTime >= track.entries.times[i].start && t.media.currentTime <= track.entries.times[i].stop){
2076
+ t.captionsText.html(track.entries.text[i]);
2077
+ t.captions.show();
2078
+ return; // exit out if one is visible;
2079
+ }
2080
+ }
2081
+ t.captions.hide();
2082
+ } else {
2083
+ t.captions.hide();
2084
+ }
2085
+ },
2086
+
2087
+ displayChapters: function() {
2088
+ var
2089
+ t = this,
2090
+ i;
2091
+
2092
+ for (i=0; i<t.tracks.length; i++) {
2093
+ if (t.tracks[i].kind == 'chapters' && t.tracks[i].isLoaded) {
2094
+ t.drawChapters(t.tracks[i]);
2095
+ t.hasChapters = true;
2096
+ break;
2097
+ }
2098
+ }
2099
+ },
2100
+
2101
+ drawChapters: function(chapters) {
2102
+ var
2103
+ t = this,
2104
+ i,
2105
+ dur,
2106
+ //width,
2107
+ //left,
2108
+ percent = 0,
2109
+ usedPercent = 0;
2110
+
2111
+ t.chapters.empty();
2112
+
2113
+ for (i=0; i<chapters.entries.times.length; i++) {
2114
+ dur = chapters.entries.times[i].stop - chapters.entries.times[i].start;
2115
+ percent = Math.floor(dur / t.media.duration * 100);
2116
+ if (percent + usedPercent > 100 || // too large
2117
+ i == chapters.entries.times.length-1 && percent + usedPercent < 100) // not going to fill it in
2118
+ {
2119
+ percent = 100 - usedPercent;
2120
+ }
2121
+ //width = Math.floor(t.width * dur / t.media.duration);
2122
+ //left = Math.floor(t.width * chapters.entries.times[i].start / t.media.duration);
2123
+ //if (left + width > t.width) {
2124
+ // width = t.width - left;
2125
+ //}
2126
+
2127
+ t.chapters.append( $(
2128
+ '<div class="mejs-chapter" rel="' + chapters.entries.times[i].start + '" style="left: ' + usedPercent.toString() + '%;width: ' + percent.toString() + '%;">' +
2129
+ '<div class="mejs-chapter-block' + ((i==chapters.entries.times.length-1) ? ' mejs-chapter-block-last' : '') + '">' +
2130
+ '<span class="ch-title">' + chapters.entries.text[i] + '</span>' +
2131
+ '<span class="ch-time">' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].start) + '&ndash;' + mejs.Utility.secondsToTimeCode(chapters.entries.times[i].stop) + '</span>' +
2132
+ '</div>' +
2133
+ '</div>'));
2134
+ usedPercent += percent;
2135
+ }
2136
+
2137
+ t.chapters.find('div.mejs-chapter').click(function() {
2138
+ t.media.setCurrentTime( parseFloat( $(this).attr('rel') ) );
2139
+ if (t.media.paused) {
2140
+ t.media.play();
2141
+ }
2142
+ });
2143
+
2144
+ t.chapters.show();
2145
+ }
2146
+ });
2147
+
2148
+
2149
+
2150
+ mejs.language = {
2151
+ codes: {
2152
+ af:'Afrikaans',
2153
+ sq:'Albanian',
2154
+ ar:'Arabic',
2155
+ be:'Belarusian',
2156
+ bg:'Bulgarian',
2157
+ ca:'Catalan',
2158
+ zh:'Chinese',
2159
+ 'zh-cn':'Chinese Simplified',
2160
+ 'zh-tw':'Chinese Traditional',
2161
+ hr:'Croatian',
2162
+ cs:'Czech',
2163
+ da:'Danish',
2164
+ nl:'Dutch',
2165
+ en:'English',
2166
+ et:'Estonian',
2167
+ tl:'Filipino',
2168
+ fi:'Finnish',
2169
+ fr:'French',
2170
+ gl:'Galician',
2171
+ de:'German',
2172
+ el:'Greek',
2173
+ ht:'Haitian Creole',
2174
+ iw:'Hebrew',
2175
+ hi:'Hindi',
2176
+ hu:'Hungarian',
2177
+ is:'Icelandic',
2178
+ id:'Indonesian',
2179
+ ga:'Irish',
2180
+ it:'Italian',
2181
+ ja:'Japanese',
2182
+ ko:'Korean',
2183
+ lv:'Latvian',
2184
+ lt:'Lithuanian',
2185
+ mk:'Macedonian',
2186
+ ms:'Malay',
2187
+ mt:'Maltese',
2188
+ no:'Norwegian',
2189
+ fa:'Persian',
2190
+ pl:'Polish',
2191
+ pt:'Portuguese',
2192
+ //'pt-pt':'Portuguese (Portugal)',
2193
+ ro:'Romanian',
2194
+ ru:'Russian',
2195
+ sr:'Serbian',
2196
+ sk:'Slovak',
2197
+ sl:'Slovenian',
2198
+ es:'Spanish',
2199
+ sw:'Swahili',
2200
+ sv:'Swedish',
2201
+ tl:'Tagalog',
2202
+ th:'Thai',
2203
+ tr:'Turkish',
2204
+ uk:'Ukrainian',
2205
+ vi:'Vietnamese',
2206
+ cy:'Welsh',
2207
+ yi:'Yiddish'
2208
+ }
2209
+ };
2210
+
2211
+ /*
2212
+ Parses WebVVT format which should be formatted as
2213
+ ================================
2214
+ WEBVTT
2215
+
2216
+ 1
2217
+ 00:00:01,1 --> 00:00:05,000
2218
+ A line of text
2219
+
2220
+ 2
2221
+ 00:01:15,1 --> 00:02:05,000
2222
+ A second line of text
2223
+
2224
+ ===============================
2225
+
2226
+ Adapted from: http://www.delphiki.com/html5/playr
2227
+ */
2228
+ mejs.TrackFormatParser = {
2229
+ // match start "chapter-" (or anythingelse)
2230
+ pattern_identifier: /^([a-zA-z]+-)?[0-9]+$/,
2231
+ 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})?)(.*)$/,
2232
+
2233
+ split2: function (text, regex) {
2234
+ // normal version for compliant browsers
2235
+ // see below for IE fix
2236
+ return text.split(regex);
2237
+ },
2238
+ parse: function(trackText) {
2239
+ var
2240
+ i = 0,
2241
+ lines = this.split2(trackText, /\r?\n/),
2242
+ entries = {text:[], times:[]},
2243
+ timecode,
2244
+ text;
2245
+
2246
+ for(; i<lines.length; i++) {
2247
+ // check for the line number
2248
+ if (this.pattern_identifier.exec(lines[i])){
2249
+ // skip to the next line where the start --> end time code should be
2250
+ i++;
2251
+ timecode = this.pattern_timecode.exec(lines[i]);
2252
+
2253
+ if (timecode && i<lines.length){
2254
+ i++;
2255
+ // grab all the (possibly multi-line) text that follows
2256
+ text = lines[i];
2257
+ i++;
2258
+ while(lines[i] !== '' && i<lines.length){
2259
+ text = text + '\n' + lines[i];
2260
+ i++;
2261
+ }
2262
+
2263
+ // Text is in a different array so I can use .join
2264
+ entries.text.push(text);
2265
+ entries.times.push(
2266
+ {
2267
+ start: mejs.Utility.timeCodeToSeconds(timecode[1]),
2268
+ stop: mejs.Utility.timeCodeToSeconds(timecode[3]),
2269
+ settings: timecode[5]
2270
+ });
2271
+ }
2272
+ }
2273
+ }
2274
+
2275
+ return entries;
2276
+ }
2277
+ };
2278
+
2279
+ })(mejs.$);
2280
+
2281
+ /*
2282
+ * ContextMenu Plugin
2283
+ *
2284
+ *
2285
+ */
2286
+
2287
+ (function($) {
2288
+
2289
+ $.extend(mejs.MepDefaults,
2290
+ contextMenuItems = [
2291
+ // demo of a fullscreen option
2292
+ {
2293
+ render: function(player) {
2294
+
2295
+ // check for fullscreen plugin
2296
+ if (typeof player.enterFullScreen == 'undefined')
2297
+ return null;
2298
+
2299
+ if (player.isFullScreen) {
2300
+ return "Turn off Fullscreen";
2301
+ } else {
2302
+ return "Go Fullscreen";
2303
+ }
2304
+ },
2305
+ click: function(player) {
2306
+ if (player.isFullScreen) {
2307
+ player.exitFullScreen();
2308
+ } else {
2309
+ player.enterFullScreen();
2310
+ }
2311
+ }
2312
+ }
2313
+ ,
2314
+ // demo of a mute/unmute button
2315
+ {
2316
+ render: function(player) {
2317
+ if (player.media.muted) {
2318
+ return "Unmute";
2319
+ } else {
2320
+ return "Mute";
2321
+ }
2322
+ },
2323
+ click: function(player) {
2324
+ if (player.media.muted) {
2325
+ player.setMuted(false);
2326
+ } else {
2327
+ player.setMuted(true);
2328
+ }
2329
+ }
2330
+ },
2331
+ // separator
2332
+ {
2333
+ isSeparator: true
2334
+ }
2335
+ ,
2336
+ // demo of simple download video
2337
+ {
2338
+ render: function(player) {
2339
+ return "Download Video";
2340
+ },
2341
+ click: function(player) {
2342
+ window.location.href = player.media.currentSrc;
2343
+ }
2344
+ }
2345
+ ]
2346
+ );
2347
+
2348
+
2349
+ $.extend(MediaElementPlayer.prototype, {
2350
+ buildcontextmenu: function(player, controls, layers, media) {
2351
+
2352
+ // create context menu
2353
+ player.contextMenu = $('<div class="mejs-contextmenu"></div>')
2354
+ .appendTo($('body'))
2355
+ .hide();
2356
+
2357
+ // create events for showing context menu
2358
+ player.container.bind('contextmenu', function(e) {
2359
+ if (player.isContextMenuEnabled) {
2360
+ e.preventDefault();
2361
+ player.renderContextMenu(e.clientX-1, e.clientY-1);
2362
+ return false;
2363
+ }
2364
+ });
2365
+ player.container.bind('click', function() {
2366
+ player.contextMenu.hide();
2367
+ });
2368
+ player.contextMenu.bind('mouseleave', function() {
2369
+
2370
+ //console.log('context hover out');
2371
+ player.startContextMenuTimer();
2372
+
2373
+ });
2374
+ },
2375
+
2376
+ isContextMenuEnabled: true,
2377
+ enableContextMenu: function() {
2378
+ this.isContextMenuEnabled = true;
2379
+ },
2380
+ disableContextMenu: function() {
2381
+ this.isContextMenuEnabled = false;
2382
+ },
2383
+
2384
+ contextMenuTimeout: null,
2385
+ startContextMenuTimer: function() {
2386
+ //console.log('startContextMenuTimer');
2387
+
2388
+ var t = this;
2389
+
2390
+ t.killContextMenuTimer();
2391
+
2392
+ t.contextMenuTimer = setTimeout(function() {
2393
+ t.hideContextMenu();
2394
+ t.killContextMenuTimer();
2395
+ }, 750);
2396
+ },
2397
+ killContextMenuTimer: function() {
2398
+ var timer = this.contextMenuTimer;
2399
+
2400
+ //console.log('killContextMenuTimer', timer);
2401
+
2402
+ if (timer != null) {
2403
+ clearTimeout(timer);
2404
+ delete timer;
2405
+ timer = null;
2406
+ }
2407
+ },
2408
+
2409
+ hideContextMenu: function() {
2410
+ this.contextMenu.hide();
2411
+ },
2412
+
2413
+ renderContextMenu: function(x,y) {
2414
+
2415
+ // alway re-render the items so that things like "turn fullscreen on" and "turn fullscreen off" are always written correctly
2416
+ var t = this,
2417
+ html = '',
2418
+ items = t.options.contextMenuItems;
2419
+
2420
+ for (var i=0, il=items.length; i<il; i++) {
2421
+
2422
+ if (items[i].isSeparator) {
2423
+ html += '<div class="mejs-contextmenu-separator"></div>';
2424
+ } else {
2425
+
2426
+ var rendered = items[i].render(t);
2427
+
2428
+ // render can return null if the item doesn't need to be used at the moment
2429
+ if (rendered != null) {
2430
+ html += '<div class="mejs-contextmenu-item" data-itemindex="' + i + '" id="element-' + (Math.random()*1000000) + '">' + rendered + '</div>';
2431
+ }
2432
+ }
2433
+ }
2434
+
2435
+ // position and show the context menu
2436
+ t.contextMenu
2437
+ .empty()
2438
+ .append($(html))
2439
+ .css({top:y, left:x})
2440
+ .show();
2441
+
2442
+ // bind events
2443
+ t.contextMenu.find('.mejs-contextmenu-item').each(function() {
2444
+
2445
+ // which one is this?
2446
+ var $dom = $(this),
2447
+ itemIndex = parseInt( $dom.data('itemindex'), 10 ),
2448
+ item = t.options.contextMenuItems[itemIndex];
2449
+
2450
+ // bind extra functionality?
2451
+ if (typeof item.show != 'undefined')
2452
+ item.show( $dom , t);
2453
+
2454
+ // bind click action
2455
+ $dom.click(function() {
2456
+ // perform click action
2457
+ if (typeof item.click != 'undefined')
2458
+ item.click(t);
2459
+
2460
+ // close
2461
+ t.contextMenu.hide();
2462
+ });
2463
+ });
2464
+
2465
+ // stop the controls from hiding
2466
+ setTimeout(function() {
2467
+ t.killControlsTimer('rev3');
2468
+ }, 100);
2469
+
2470
+ }
2471
+ });
2472
+
2473
+ })(mejs.$);
mediaelement/mediaelementplayer.min.css CHANGED
@@ -1 +1 @@
1
- .mejs-container{position:relative;background:#000;font-family:Helvetica,Arial;}.mejs-embed,.mejs-embed body{width:100%;height:100%;margin:0;padding:0;background:#000;overflow:hidden;}.mejs-container-fullscreen{position:fixed;left:0;top:0;right:0;bottom:0;overflow:hidden;z-index:1000;}.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;width:100%;height:100%;}.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-controls .mejs-button button:focus{outline:solid 1px yellow;}.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-total: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 .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 .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;}.mejs-contextmenu{position:absolute;width:150px;padding:10px;border-radius:4px;top:0;left:0;background:#fff;border:solid 1px #999;z-index:1001;}.mejs-contextmenu .mejs-contextmenu-separator{height:1px;font-size:0;margin:5px 6px;background:#333;}.mejs-contextmenu .mejs-contextmenu-item{font-family:Helvetica,Arial;font-size:12px;padding:4px 6px;cursor:pointer;color:#333;}.mejs-contextmenu .mejs-contextmenu-item:hover{background:#2C7C91;color:#fff;}
1
+ .mejs-container{position:relative;background:#000;font-family:Helvetica,Arial;text-align:left;vertical-align:top;}.me-plugin{position:absolute;}.mejs-embed,.mejs-embed body{width:100%;height:100%;margin:0;padding:0;background:#000;overflow:hidden;}.mejs-container-fullscreen{position:fixed;left:0;top:0;right:0;bottom:0;overflow:hidden;z-index:1000;}.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;width:100%;height:100%;}.mejs-poster{position:absolute;top:0;left:0;}.mejs-poster img{border:0;padding:0;border:0;display:block;}.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) 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,0% 0,0% 100%,from(rgba(50,50,50,0.9)),to(rgba(0,0,0,0.9)));background:-webkit-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:-moz-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:-o-linear-gradient(top,rgba(50,50,50,0.9),rgba(0,0,0,0.9));background:-ms-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) 50% 50% 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,0% 0,0% 100%,from(rgba(50,50,50,0.7)),to(rgba(0,0,0,0.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-moz-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-o-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-ms-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) no-repeat;}.mejs-controls .mejs-button button:focus{outline:solid 1px yellow;}.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,0% 0,0% 100%,from(rgba(30,30,30,0.8)),to(rgba(60,60,60,0.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-moz-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-o-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-ms-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));}.mejs-controls .mejs-time-rail .mejs-time-loaded{background:#3caac8;background:rgba(60,170,200,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(44,124,145,0.8)),to(rgba(78,183,212,0.8)));background:-webkit-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:-moz-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:-o-linear-gradient(top,rgba(44,124,145,0.8),rgba(78,183,212,0.8));background:-ms-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));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,0% 0,0% 100%,from(rgba(255,255,255,0.9)),to(rgba(200,200,200,0.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-moz-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-o-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-ms-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:linear-gradient(rgba(255,255,255,0.9),rgba(200,200,200,0.8));}.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{position:absolute;display:none;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 .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 .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 div.mejs-horizontal-volume-slider{height:26px;width:60px;position:relative;}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#333;background:rgba(50,50,50,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(30,30,30,0.8)),to(rgba(60,60,60,0.8)));background:-webkit-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-moz-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-o-linear-gradient(top,rgba(30,30,30,0.8),rgba(60,60,60,0.8));background:-ms-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));}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current{position:absolute;left:0;top:11px;width:50px;height:8px;margin:0;padding:0;font-size:1px;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;background:#fff;background:rgba(255,255,255,0.8);background:-webkit-gradient(linear,0% 0,0% 100%,from(rgba(255,255,255,0.9)),to(rgba(200,200,200,0.8)));background:-webkit-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-moz-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-o-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:-ms-linear-gradient(top,rgba(255,255,255,0.9),rgba(200,200,200,0.8));background:linear-gradient(rgba(255,255,255,0.9),rgba(200,200,200,0.8));}.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle{display:none;}.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 .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,0% 0,0% 100%,from(rgba(50,50,50,0.7)),to(rgba(0,0,0,0.7)));background:-webkit-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-moz-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-o-linear-gradient(top,rgba(50,50,50,0.7),rgba(0,0,0,0.7));background:-ms-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,0% 0,0% 100%,from(rgba(102,102,102,0.7)),to(rgba(50,50,50,0.6)));background:-webkit-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:-moz-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:-o-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:-ms-linear-gradient(top,rgba(102,102,102,0.7),rgba(50,50,50,0.6));background:linear-gradient(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;}.mejs-contextmenu{position:absolute;width:150px;padding:10px;border-radius:4px;top:0;left:0;background:#fff;border:solid 1px #999;z-index:1001;}.mejs-contextmenu .mejs-contextmenu-separator{height:1px;font-size:0;margin:5px 6px;background:#333;}.mejs-contextmenu .mejs-contextmenu-item{font-family:Helvetica,Arial;font-size:12px;padding:4px 6px;cursor:pointer;color:#333;}.mejs-contextmenu .mejs-contextmenu-item:hover{background:#2C7C91;color:#fff;}.mejs-controls .mejs-sourcechooser-button{position:relative;}.mejs-controls .mejs-sourcechooser-button button{background-position:-128px 0;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-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-sourcechooser-button .mejs-sourcechooser-selector ul{margin:0;padding:0;display:block;list-style-type:none!important;overflow:hidden;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li{margin:0 0 6px 0;padding:0;list-style-type:none!important;display:block;color:#fff;overflow:hidden;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input{clear:both;float:left;margin:3px 3px 0 5px;}.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label{width:100px;float:left;padding:4px 0 0 0;line-height:15px;font-family:helvetica,arial;font-size:10px;}
mediaelement/mediaelementplayer.min.js ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * MediaElementPlayer
3
+ * http://mediaelementjs.com/
4
+ *
5
+ * Creates a controller bar for HTML5 <video> add <audio> tags
6
+ * using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
7
+ *
8
+ * Copyright 2010-2011, John Dyer (http://j.hn/)
9
+ * Dual licensed under the MIT or GPL Version 2 licenses.
10
+ *
11
+ */if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
12
+ (function(f){mejs.MepDefaults={poster:"",defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks",
13
+ "volume","fullscreen"],isVideo:true,enableKeyboard:true,pauseOtherPlayers:true,keyActions:[{keys:[32,179],action:function(a,b){b.paused||b.ended?b.play():b.pause()}},{keys:[38],action:function(a,b){b.setVolume(Math.min(b.volume+0.1,1))}},{keys:[40],action:function(a,b){b.setVolume(Math.max(b.volume-0.1,0))}},{keys:[37,227],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}b.setCurrentTime(Math.min(b.currentTime-b.duration*0.05,b.duration))}}},
14
+ {keys:[39,228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}b.setCurrentTime(Math.max(b.currentTime+b.duration*0.05,0))}}},{keys:[70],action:function(a){if(typeof a.enterFullScreen!="undefined")a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}}]};mejs.mepIndex=0;mejs.players=[];mejs.MediaElementPlayer=function(a,b){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,b);this.$media=this.$node=f(a);
15
+ this.node=this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;if(typeof b=="undefined")b=this.$node.data("mejsoptions");this.options=f.extend({},mejs.MepDefaults,b);mejs.players.push(this);this.init();return this};mejs.MediaElementPlayer.prototype={hasFocus:false,controlsAreVisible:true,init:function(){var a=this,b=mejs.MediaFeatures,c=f.extend(true,{},a.options,{success:function(e,g){a.meReady(e,g)},error:function(e){a.handleError(e)}}),
16
+ d=a.media.tagName.toLowerCase();a.isDynamic=d!=="audio"&&d!=="video";a.isVideo=a.isDynamic?a.options.isVideo:d!=="audio"&&a.options.isVideo;if(b.isiPad&&a.options.iPadUseNativeControls||b.isiPhone&&a.options.iPhoneUseNativeControls){a.$media.attr("controls","controls");a.$media.removeAttr("poster");if(b.isiPad&&a.media.getAttribute("autoplay")!==null){a.media.load();a.media.play()}}else if(!(b.isAndroid&&a.AndroidUseNativeControls)){a.$media.removeAttr("controls");a.id="mep_"+mejs.mepIndex++;a.container=
17
+ 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);a.container.addClass((b.isAndroid?"mejs-android ":"")+(b.isiOS?"mejs-ios ":"")+(b.isiPad?"mejs-ipad ":"")+(b.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio "));if(b.isiOS){b=a.$media.clone();a.container.find(".mejs-mediaelement").append(b);
18
+ a.$media.remove();a.$node=a.$media=b;a.node=a.media=b[0]}else a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");b=d.substring(0,1).toUpperCase()+d.substring(1);a.width=a.options[d+"Width"]>0||a.options[d+"Width"].toString().indexOf("%")>-1?a.options[d+"Width"]:a.media.style.width!==""&&a.media.style.width!==null?a.media.style.width:a.media.getAttribute("width")!==null?a.$media.attr("width"):a.options["default"+
19
+ b+"Width"];a.height=a.options[d+"Height"]>0||a.options[d+"Height"].toString().indexOf("%")>-1?a.options[d+"Height"]:a.media.style.height!==""&&a.media.style.height!==null?a.media.style.height:a.$media[0].getAttribute("height")!==null?a.$media.attr("height"):a.options["default"+b+"Height"];a.setPlayerSize(a.width,a.height);c.pluginWidth=a.height;c.pluginHeight=a.width}mejs.MediaElement(a.$media[0],c)},showControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!b.controlsAreVisible){if(a){b.controls.css("visibility",
20
+ "visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true});b.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true})}else{b.controls.css("visibility","visible").css("display","block");b.container.find(".mejs-control").css("visibility","visible").css("display","block");b.controlsAreVisible=true}b.setControlsSize()}},hideControls:function(a){var b=this;a=typeof a=="undefined"||a;if(b.controlsAreVisible)if(a){b.controls.stop(true,
21
+ true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block");b.controlsAreVisible=false});b.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block")})}else{b.controls.css("visibility","hidden").css("display","block");b.container.find(".mejs-control").css("visibility","hidden").css("display","block");b.controlsAreVisible=false}},controlsTimer:null,startControlsTimer:function(a){var b=this;a=typeof a!=
22
+ "undefined"?a:1500;b.killControlsTimer("start");b.controlsTimer=setTimeout(function(){b.hideControls();b.killControlsTimer("hide")},a)},killControlsTimer:function(){if(this.controlsTimer!==null){clearTimeout(this.controlsTimer);delete this.controlsTimer;this.controlsTimer=null}},controlsEnabled:true,disableControls:function(){this.killControlsTimer();this.hideControls(false);this.controlsEnabled=false},enableControls:function(){this.showControls(false);this.controlsEnabled=true},meReady:function(a,
23
+ b){var c=this,d=mejs.MediaFeatures,e=b.getAttribute("autoplay");e=!(typeof e=="undefined"||e===null||e==="false");var g;if(!c.created){c.created=true;c.media=a;c.domNode=b;if(!(d.isAndroid&&c.options.AndroidUseNativeControls)&&!(d.isiPad&&c.options.iPadUseNativeControls)&&!(d.isiPhone&&c.options.iPhoneUseNativeControls)){c.buildposter(c,c.controls,c.layers,c.media);c.buildkeyboard(c,c.controls,c.layers,c.media);c.buildoverlays(c,c.controls,c.layers,c.media);c.findTracks();for(g in c.options.features){d=
24
+ c.options.features[g];if(c["build"+d])try{c["build"+d](c,c.controls,c.layers,c.media)}catch(j){}}c.container.trigger("controlsready");c.setPlayerSize(c.width,c.height);c.setControlsSize();if(c.isVideo){if(mejs.MediaFeatures.hasTouch)c.$media.bind("touchstart",function(){if(c.controlsAreVisible)c.hideControls(false);else c.controlsEnabled&&c.showControls(false)});else{(c.media.pluginType=="native"?c.$media:f(c.media.pluginElement)).click(function(){a.paused?a.play():a.pause()});c.container.bind("mouseenter mouseover",
25
+ function(){if(c.controlsEnabled)if(!c.options.alwaysShowControls){c.killControlsTimer("enter");c.showControls();c.startControlsTimer(2500)}}).bind("mousemove",function(){if(c.controlsEnabled){c.controlsAreVisible||c.showControls();c.options.alwaysShowControls||c.startControlsTimer(2500)}}).bind("mouseleave",function(){c.controlsEnabled&&!c.media.paused&&!c.options.alwaysShowControls&&c.startControlsTimer(1E3)})}e&&!c.options.alwaysShowControls&&c.hideControls();c.options.enableAutosize&&c.media.addEventListener("loadedmetadata",
26
+ function(h){if(c.options.videoHeight<=0&&c.domNode.getAttribute("height")===null&&!isNaN(h.target.videoHeight)){c.setPlayerSize(h.target.videoWidth,h.target.videoHeight);c.setControlsSize();c.media.setVideoSize(h.target.videoWidth,h.target.videoHeight)}},false)}a.addEventListener("play",function(){for(var h=0,l=mejs.players.length;h<l;h++){var m=mejs.players[h];m.id!=c.id&&c.options.pauseOtherPlayers&&!m.paused&&!m.ended&&m.pause();m.hasFocus=false}c.hasFocus=true},false);c.media.addEventListener("ended",
27
+ function(){try{c.media.setCurrentTime(0)}catch(h){}c.media.pause();c.setProgressRail&&c.setProgressRail();c.setCurrentRail&&c.setCurrentRail();if(c.options.loop)c.media.play();else!c.options.alwaysShowControls&&c.controlsEnabled&&c.showControls()},false);c.media.addEventListener("loadedmetadata",function(){c.updateDuration&&c.updateDuration();c.updateCurrent&&c.updateCurrent();if(!c.isFullScreen){c.setPlayerSize(c.width,c.height);c.setControlsSize()}},false);setTimeout(function(){c.setPlayerSize(c.width,
28
+ c.height);c.setControlsSize()},50);f(window).resize(function(){c.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||c.setPlayerSize(c.width,c.height);c.setControlsSize()});c.media.pluginType=="youtube"&&c.container.find(".mejs-overlay-play").hide()}if(e&&a.pluginType=="native"){a.load();a.play()}if(c.options.success)typeof c.options.success=="string"?window[c.options.success](c.media,c.domNode,c):c.options.success(c.media,c.domNode,c)}},handleError:function(a){this.controls.hide();
29
+ this.options.error&&this.options.error(a)},setPlayerSize:function(){if(this.height.toString().indexOf("%")>0){var a=this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.options.defaultVideoWidth,b=this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.options.defaultVideoHeight,c=this.container.parent().width();a=parseInt(c*b/a,10);if(this.container.parent()[0].tagName.toLowerCase()==="body"){c=f(window).width();a=f(window).height()}this.container.width(c).height(a);
30
+ this.$media.width("100%").height("100%");this.container.find("object, embed, iframe").width("100%").height("100%");this.media.setVideoSize&&this.media.setVideoSize(c,a);this.layers.children(".mejs-layer").width("100%").height("100%")}else{this.container.width(this.width).height(this.height);this.layers.children(".mejs-layer").width(this.width).height(this.height)}},setControlsSize:function(){var a=0,b=0,c=this.controls.find(".mejs-time-rail"),d=this.controls.find(".mejs-time-total");this.controls.find(".mejs-time-current");
31
+ this.controls.find(".mejs-time-loaded");others=c.siblings();if(this.options&&!this.options.autosizeProgress)b=parseInt(c.css("width"));if(b===0||!b){others.each(function(){if(f(this).css("position")!="absolute")a+=f(this).outerWidth(true)});b=this.controls.width()-a-(c.outerWidth(true)-c.outerWidth(false))}c.width(b);d.width(b-(d.outerWidth(true)-d.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},buildposter:function(a,b,c,d){var e=f('<div class="mejs-poster mejs-layer"></div>').appendTo(c);
32
+ b=a.$media.attr("poster");if(a.options.poster!=="")b=a.options.poster;b!==""&&b!=null?this.setPoster(b):e.hide();d.addEventListener("play",function(){e.hide()},false)},setPoster:function(a){var b=this.container.find(".mejs-poster"),c=b.find("img");if(c.length==0)c=f('<img width="100%" height="100%" />').appendTo(b);c.attr("src",a)},buildoverlays:function(a,b,c,d){if(a.isVideo){var e=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(c),
33
+ g=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(c),j=f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(c).click(function(){d.paused?d.play():d.pause()});d.addEventListener("play",function(){j.hide();e.hide();g.hide()},false);d.addEventListener("playing",function(){j.hide();e.hide();g.hide()},false);d.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||j.show()},false);
34
+ d.addEventListener("waiting",function(){e.show()},false);d.addEventListener("loadeddata",function(){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)}},buildkeyboard:function(a,b,c,d){f(document).keydown(function(e){if(a.hasFocus&&a.options.enableKeyboard)for(var g=0,j=a.options.keyActions.length;g<j;g++)for(var h=a.options.keyActions[g],l=0,m=h.keys.length;l<
35
+ m;l++)if(e.keyCode==h.keys[l]){e.preventDefault();h.action(a,d);return false}return true});f(document).click(function(e){if(f(e.target).closest(".mejs-container").length==0)a.hasFocus=false})},findTracks:function(){var a=this,b=a.$media.find("track");a.tracks=[];b.each(function(){a.tracks.push({srclang:f(this).attr("srclang").toLowerCase(),src:f(this).attr("src"),kind:f(this).attr("kind"),label:f(this).attr("label"),entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className=
36
+ "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},setSrc:function(a){this.media.setSrc(a)},remove:function(){if(this.media.pluginType==
37
+ "flash")this.media.remove();else this.media.pluginTyp=="native"&&this.media.prop("controls",true);this.isDynamic||this.$node.insertBefore(this.container);this.container.remove()}};if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){return this.each(function(){new mejs.MediaElementPlayer(this,a)})};f(document).ready(function(){f(".mejs-player").mediaelementplayer()});window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
38
+ (function(f){f.extend(mejs.MepDefaults,{playpauseText:"Play/Pause"});f.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,b,c,d){var e=f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+this.id+'" title="'+this.options.playpauseText+'"></button></div>').appendTo(b).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);
39
+ d.addEventListener("playing",function(){e.removeClass("mejs-play").addClass("mejs-pause")},false);d.addEventListener("pause",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false);d.addEventListener("paused",function(){e.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);
40
+ (function(f){f.extend(mejs.MepDefaults,{stopText:"Stop"});f.extend(MediaElementPlayer.prototype,{buildstop:function(a,b,c,d){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="'+this.options.stopText+"></button></div>").appendTo(b).click(function(){d.paused||d.pause();if(d.currentTime>0){d.setCurrentTime(0);b.find(".mejs-time-current").width("0px");b.find(".mejs-time-handle").css("left","0px");b.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));
41
+ b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-poster").show()}})}})})(mejs.$);
42
+ (function(f){f.extend(MediaElementPlayer.prototype,{buildprogress:function(a,b,c,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(b);var e=b.find(".mejs-time-total");c=b.find(".mejs-time-loaded");var g=b.find(".mejs-time-current"),
43
+ j=b.find(".mejs-time-handle"),h=b.find(".mejs-time-float"),l=b.find(".mejs-time-float-current"),m=function(k){k=k.pageX;var i=e.offset(),o=e.outerWidth(),n=0;n=0;var s=k-i.left;if(k>i.left&&k<=o+i.left&&d.duration){n=(k-i.left)/o;n=n<=0.02?0:n*d.duration;p&&d.setCurrentTime(n);if(!mejs.MediaFeatures.hasTouch){h.css("left",s);l.html(mejs.Utility.secondsToTimeCode(n));h.show()}}},p=false,r=false;e.bind("mousedown",function(k){if(k.which===1){p=true;m(k);return false}});b.find(".mejs-time-total").bind("mouseenter",
44
+ function(){r=true;mejs.MediaFeatures.hasTouch||h.show()}).bind("mouseleave",function(){r=false;h.hide()});f(document).bind("mouseup",function(){p=false;h.hide()}).bind("mousemove",function(k){if(p||r)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=c;this.total=e;this.current=g;this.handle=j},setProgressRail:function(a){var b=a!=undefined?a.target:
45
+ this.media,c=null;if(b&&b.buffered&&b.buffered.length>0&&b.buffered.end&&b.duration)c=b.buffered.end(0)/b.duration;else if(b&&b.bytesTotal!=undefined&&b.bytesTotal>0&&b.bufferedBytes!=undefined)c=b.bufferedBytes/b.bytesTotal;else if(a&&a.lengthComputable&&a.total!=0)c=a.loaded/a.total;if(c!==null){c=Math.min(1,Math.max(0,c));this.loaded&&this.total&&this.loaded.width(this.total.width()*c)}},setCurrentRail:function(){if(this.media.currentTime!=undefined&&this.media.duration)if(this.total&&this.handle){var a=
46
+ this.total.width()*this.media.currentTime/this.media.duration,b=a-this.handle.outerWidth(true)/2;this.current.width(a);this.handle.css("left",b)}}})})(mejs.$);
47
+ (function(f){f.extend(mejs.MepDefaults,{duration:-1});f.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,b,c,d){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(b);this.currenttime=this.controls.find(".mejs-currenttime");d.addEventListener("timeupdate",function(){a.updateCurrent()},false)},buildduration:function(a,b,c,d){if(b.children().last().find(".mejs-currenttime").length>
48
+ 0)f(' <span> | </span> <span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span>").appendTo(b.find(".mejs-time"));else{b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");f('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+
49
+ (this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span></div>").appendTo(b)}this.durationD=this.controls.find(".mejs-duration");d.addEventListener("timeupdate",function(){a.updateDuration()},false)},updateCurrent:function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,
50
+ this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))},updateDuration:function(){if(this.media.duration&&this.durationD)this.durationD.html(mejs.Utility.secondsToTimeCode(this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))}})})(mejs.$);
51
+ (function(f){f.extend(mejs.MepDefaults,{muteText:"Mute Toggle",hideVolumeOnTouchDevices:true});f.extend(MediaElementPlayer.prototype,{buildvolume:function(a,b,c,d){if(!(mejs.MediaFeatures.hasTouch&&this.options.hideVolumeOnTouchDevices)){var e=f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+this.id+'" title="'+this.options.muteText+'"></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(b),
52
+ g=e.find(".mejs-volume-slider"),j=e.find(".mejs-volume-total"),h=e.find(".mejs-volume-current"),l=e.find(".mejs-volume-handle"),m=function(i){if(g.is(":visible")){var o=j.height(),n=j.position();i=o-o*i;l.css("top",n.top+i-l.height()/2);h.height(o-i);h.css("top",n.top+i)}else{g.show();m(i);g.hide()}},p=function(i){var o=j.height(),n=j.offset(),s=parseInt(j.css("top").replace(/px/,""),10);i=i.pageY-n.top;var q=(o-i)/o;if(n.top!=0){q=Math.max(0,q);q=Math.min(q,1);if(i<0)i=0;else if(i>o)i=o;l.css("top",
53
+ i-l.height()/2+s);h.height(o-i);h.css("top",i+s);if(q==0){d.setMuted(true);e.removeClass("mejs-mute").addClass("mejs-unmute")}else{d.setMuted(false);e.removeClass("mejs-unmute").addClass("mejs-mute")}q=Math.max(0,q);q=Math.min(q,1);d.setVolume(q)}},r=false,k=false;e.hover(function(){g.show();k=true},function(){k=false;r||g.hide()});g.bind("mouseover",function(){k=true}).bind("mousedown",function(i){p(i);r=true;return false});f(document).bind("mouseup",function(){r=false;k||g.hide()}).bind("mousemove",
54
+ function(i){r&&p(i)});e.find("button").click(function(){d.setMuted(!d.muted)});d.addEventListener("volumechange",function(){if(!r)if(d.muted){m(0);e.removeClass("mejs-mute").addClass("mejs-unmute")}else{m(d.volume);e.removeClass("mejs-unmute").addClass("mejs-mute")}},false);m(a.options.startVolume);d.pluginType==="native"&&d.setVolume(a.options.startVolume)}}})})(mejs.$);
55
+ (function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:false,newWindowCallback:function(){return""},fullscreenText:"Fullscreen"});f.extend(MediaElementPlayer.prototype,{isFullScreen:false,isNativeFullScreen:false,docStyleOverflow:null,isInIframe:false,buildfullscreen:function(a,b,c,d){if(a.isVideo){a.isInIframe=window.location!=window.parent.location;mejs.MediaFeatures.hasTrueNativeFullScreen&&a.container.bind(mejs.MediaFeatures.fullScreenEventName,function(){if(mejs.MediaFeatures.isFullScreen()){a.isNativeFullScreen=
56
+ true;a.setControlsSize()}else{a.isNativeFullScreen=false;a.exitFullScreen()}});var e=this,g=f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+e.id+'" title="'+e.options.fullscreenText+'"></button></div>').appendTo(b);if(e.media.pluginType==="native"||!e.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});
57
+ else{var j=null;g.mouseover(function(){if(j!==null){clearTimeout(j);delete j}var h=g.offset(),l=a.container.offset();d.positionFullscreenButton(h.left-l.left,h.top-l.top)}).mouseout(function(){if(j!==null){clearTimeout(j);delete j}j=setTimeout(function(){d.hideFullscreenButton()},1500)})}a.fullscreenBtn=g;f(document).bind("keydown",function(h){if((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||e.isFullScreen)&&h.keyCode==27)a.exitFullScreen()})}},enterFullScreen:function(){var a=
58
+ this;if(!(a.media.pluginType!=="native"&&(mejs.MediaFeatures.isFirefox||a.options.usePluginFullScreen))){docStyleOverflow=document.documentElement.style.overflow;document.documentElement.style.overflow="hidden";normalHeight=a.container.height();normalWidth=a.container.width();if(a.media.pluginType==="native")if(mejs.MediaFeatures.hasTrueNativeFullScreen)mejs.MediaFeatures.requestFullScreen(a.container[0]);else if(mejs.MediaFeatures.hasSemiNativeFullScreen){a.media.webkitEnterFullscreen();return}if(a.isInIframe){var b=
59
+ a.options.newWindowCallback(this);if(b!=="")if(mejs.MediaFeatures.hasTrueNativeFullScreen)setTimeout(function(){if(!a.isNativeFullScreen){a.pause();window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}},250);else{a.pause();window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");return}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");
60
+ setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);if(a.pluginType==="native")a.$media.width("100%").height("100%");else{a.container.find("object, embed, iframe").width("100%").height("100%");a.media.setVideoSize(f(window).width(),f(window).height())}a.layers.children("div").width("100%").height("100%");a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=true}},exitFullScreen:function(){if(this.media.pluginType!==
61
+ "native"&&mejs.MediaFeatures.isFirefox)this.media.setFullscreen(false);else{if(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen))mejs.MediaFeatures.cancelFullScreen();document.documentElement.style.overflow=docStyleOverflow;this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight);if(this.pluginType==="native")this.$media.width(normalWidth).height(normalHeight);else{this.container.find("object embed").width(normalWidth).height(normalHeight);
62
+ this.media.setVideoSize(normalWidth,normalHeight)}this.layers.children("div").width(normalWidth).height(normalHeight);this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");this.setControlsSize();this.isFullScreen=false}}})})(mejs.$);
63
+ (function(f){f.extend(mejs.MepDefaults,{startLanguage:"",tracksText:"Captions/Subtitles"});f.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(a,b,c,d){if(a.isVideo)if(a.tracks.length!=0){var e;a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(c).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(c).hide();a.captionsText=a.captions.find(".mejs-captions-text");
64
+ a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+this.id+'" title="'+this.options.tracksText+'"></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></div>').appendTo(b).hover(function(){f(this).find(".mejs-captions-selector").css("visibility","visible")},function(){f(this).find(".mejs-captions-selector").css("visibility",
65
+ "hidden")}).delegate("input[type=radio]","click",function(){lang=this.value;if(lang=="none")a.selectedTrack=null;else for(e=0;e<a.tracks.length;e++)if(a.tracks[e].srclang==lang){a.selectedTrack=a.tracks[e];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",
66
+ function(){d.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;for(e=0;e<a.tracks.length;e++)a.tracks[e].kind=="subtitles"&&a.addTrackButton(a.tracks[e].srclang,a.tracks[e].label);a.loadNextTrack();d.addEventListener("timeupdate",function(){a.displayCaptions()},false);d.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){if(a.hasChapters){a.chapters.css("visibility",
67
+ "visible");a.chapters.fadeIn(200)}},function(){a.hasChapters&&!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")}},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 b=this,c=b.tracks[a],d=function(){c.isLoaded=
68
+ true;b.enableTrackButton(c.srclang,c.label);b.loadNextTrack()};c.isTranslation?mejs.TrackFormatParser.translateTrackText(b.tracks[0].entries,b.tracks[0].srclang,c.srclang,b.options.googleApiKey,function(e){c.entries=e;d()}):f.ajax({url:c.src,success:function(e){c.entries=mejs.TrackFormatParser.parse(e);d();c.kind=="chapters"&&b.media.duration>0&&b.drawChapters(c)},error:function(){b.loadNextTrack()}})},enableTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("input[value="+
69
+ a+"]").prop("disabled",false).siblings("label").html(b);this.options.startLanguage==a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,b){if(b==="")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+" (loading)</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+
70
+ 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,b=this.selectedTrack;if(b!=null&&b.isLoaded)for(a=0;a<b.entries.times.length;a++)if(this.media.currentTime>=b.entries.times[a].start&&this.media.currentTime<=b.entries.times[a].stop){this.captionsText.html(b.entries.text[a]);
71
+ 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]);this.hasChapters=true;break}},drawChapters:function(a){var b=this,c,d,e=d=0;b.chapters.empty();for(c=0;c<a.entries.times.length;c++){d=a.entries.times[c].stop-a.entries.times[c].start;d=Math.floor(d/b.media.duration*100);if(d+e>100||c==a.entries.times.length-1&&d+e<100)d=100-e;b.chapters.append(f('<div class="mejs-chapter" rel="'+
72
+ a.entries.times[c].start+'" style="left: '+e.toString()+"%;width: "+d.toString()+'%;"><div class="mejs-chapter-block'+(c==a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[c].start)+"&ndash;"+mejs.Utility.secondsToTimeCode(a.entries.times[c].stop)+"</span></div></div>"));e+=d}b.chapters.find("div.mejs-chapter").click(function(){b.media.setCurrentTime(parseFloat(f(this).attr("rel")));
73
+ b.media.paused&&b.media.play()});b.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",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",
74
+ 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:/^([a-zA-z]+-)?[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})?)(.*)$/,
75
+ split2:function(a,b){return a.split(b)},parse:function(a){var b=0;a=this.split2(a,/\r?\n/);for(var c={text:[],times:[]},d,e;b<a.length;b++)if(this.pattern_identifier.exec(a[b])){b++;if((d=this.pattern_timecode.exec(a[b]))&&b<a.length){b++;e=a[b];for(b++;a[b]!==""&&b<a.length;){e=e+"\n"+a[b];b++}c.text.push(e);c.times.push({start:mejs.Utility.timeCodeToSeconds(d[1]),stop:mejs.Utility.timeCodeToSeconds(d[3]),settings:d[5]})}}return c}}})(mejs.$);
76
+ (function(f){f.extend(mejs.MepDefaults,contextMenuItems=[{render:function(a){if(typeof a.enterFullScreen=="undefined")return null;return a.isFullScreen?"Turn off Fullscreen":"Go Fullscreen"},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?"Unmute":"Mute"},click:function(a){a.media.muted?a.setMuted(false):a.setMuted(true)}},{isSeparator:true},{render:function(){return"Download Video"},click:function(a){window.location.href=a.media.currentSrc}}]);
77
+ f.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a){a.contextMenu=f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide();a.container.bind("contextmenu",function(b){if(a.isContextMenuEnabled){b.preventDefault();a.renderContextMenu(b.clientX-1,b.clientY-1);return false}});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=
78
+ true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;if(a!=null){clearTimeout(a);delete a}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(a,b){for(var c=this,d="",e=c.options.contextMenuItems,g=0,j=e.length;g<
79
+ j;g++)if(e[g].isSeparator)d+='<div class="mejs-contextmenu-separator"></div>';else{var h=e[g].render(c);if(h!=null)d+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+Math.random()*1E6+'">'+h+"</div>"}c.contextMenu.empty().append(f(d)).css({top:b,left:a}).show();c.contextMenu.find(".mejs-contextmenu-item").each(function(){var l=f(this),m=parseInt(l.data("itemindex"),10),p=c.options.contextMenuItems[m];typeof p.show!="undefined"&&p.show(l,c);l.click(function(){typeof p.click!=
80
+ "undefined"&&p.click(c);c.contextMenu.hide()})});setTimeout(function(){c.killControlsTimer("rev3")},100)}})})(mejs.$);
mediaelement/mejs-skins.css CHANGED
@@ -1,283 +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
-
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 CHANGED
Binary file
readme.txt CHANGED
@@ -3,15 +3,15 @@ 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.2
7
- Stable tag: 2.2.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
 
11
  == Description ==
12
 
13
  Video and audio plugin for WordPress built on the MediaElement.js HTML5 media player library. Provides Flash or Silverlight fallback players for non-HTML5 browsers. Supports iPhone, iPad, and Andriod.
14
- Supports MP4, OGG, WebM, WMV, MP3, WAV, WMA files as well as captions with WebSRT files.
15
 
16
  Check out <a href="http://mediaelementjs.com/">mediaElementjs.com</a> for more information and examples.
17
 
@@ -156,6 +156,10 @@ View <a href="http://mediaelementjs.com/">MediaElementjs.com</a> for more inform
156
 
157
  == Changelog ==
158
 
 
 
 
 
159
  = 2.2.5 =
160
  * Update to 2.2.5 codebase
161
  * Support for true fullscreen in Chrome and Firefox (in addition to Safari)
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.3
7
+ Stable tag: 2.7.0
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
 
11
  == Description ==
12
 
13
  Video and audio plugin for WordPress built on the MediaElement.js HTML5 media player library. Provides Flash or Silverlight fallback players for non-HTML5 browsers. Supports iPhone, iPad, and Andriod.
14
+ Supports MP4, OGG, WebM, WMV, MP3, WAV, WMA files as well as captions with WebSRT files.
15
 
16
  Check out <a href="http://mediaelementjs.com/">mediaElementjs.com</a> for more information and examples.
17
 
156
 
157
  == Changelog ==
158
 
159
+ = 2.27.0 =
160
+ * Update to 2.7.0 codebase
161
+ * Lots of bug fixes and updates
162
+
163
  = 2.2.5 =
164
  * Update to 2.2.5 codebase
165
  * Support for true fullscreen in Chrome and Firefox (in addition to Safari)