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

Version Description

None

Download this release

Release Info

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

Code changes from version 2.0.6.2 to 2.1.0

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