--- mediaelement-and-player.js 2015-07-09 19:37:33.000000000 -0500
+++ mediaelement-and-player.mine.js 2015-07-09 19:37:24.000000000 -0500
@@ -12,6 +12,8 @@
* License: MIT
*
*/
+define(['jquery'], function(jQuery) {
+
// Namespace
var mejs = mejs || {};
@@ -1133,8 +1135,6 @@
},
formatType: function(url, type) {
- var ext;
-
// if no type is supplied, fake it with the extension
if (url && !type) {
return this.getTypeFromFile(url);
@@ -1180,7 +1180,8 @@
createErrorMessage: function(playback, options, poster) {
var
htmlMediaElement = playback.htmlMediaElement,
- errorContainer = document.createElement('div');
+ errorContainer = document.createElement('div'),
+ errorContent = options.customError;
errorContainer.className = 'me-cannotplay';
@@ -1189,13 +1190,17 @@
errorContainer.style.height = htmlMediaElement.height + 'px';
} catch (e) {}
- if (options.customError) {
- errorContainer.innerHTML = options.customError;
- } else {
- errorContainer.innerHTML = (poster !== '') ?
- '' :
- '' + mejs.i18n.t('Download File') + '';
- }
+ if (!errorContent) {
+ errorContent = '';
+
+ if (poster !== '') {
+ errorContent += '
';
+ }
+
+ errorContent += '' + mejs.i18n.t('Download File') + '';
+ }
+
+ errorContainer.innerHTML = errorContent;
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
htmlMediaElement.style.display = 'none';
@@ -1221,7 +1226,7 @@
// copy attributes from html media element to plugin media element
for (var i = 0; i < htmlMediaElement.attributes.length; i++) {
var attribute = htmlMediaElement.attributes[i];
- if (attribute.specified == true) {
+ if (attribute.specified) {
pluginMediaElement.setAttribute(attribute.name, attribute.value);
}
}
@@ -1742,11 +1747,11 @@
}
}
// IFRAME
-function onYouTubePlayerAPIReady() {
+window.onYouTubePlayerAPIReady = function() {
mejs.YouTubeApi.iFrameReady();
}
// FLASH
-function onYouTubePlayerReady(id) {
+window.onYouTubePlayerReady = function(id) {
mejs.YouTubeApi.flashReady(id);
}
@@ -2844,8 +2849,6 @@
railWidth = 0,
rail = t.controls.find('.mejs-time-rail'),
total = t.controls.find('.mejs-time-total'),
- current = t.controls.find('.mejs-time-current'),
- loaded = t.controls.find('.mejs-time-loaded'),
others = rail.siblings(),
lastControl = others.last(),
lastControlPosition = null;
@@ -2892,11 +2895,8 @@
railWidth--;
}
} while (lastControlPosition !== null && lastControlPosition.top > 0 && railWidth > 0);
-
- if (t.setProgressRail)
- t.setProgressRail();
- if (t.setCurrentRail)
- t.setCurrentRail();
+
+ t.container.trigger('controlsresize');
},
@@ -2937,7 +2937,7 @@
posterImg = posterDiv.find('img');
if (posterImg.length === 0) {
- posterImg = $('
').appendTo(posterDiv);
+ posterImg = $('
').appendTo(posterDiv);
}
posterImg.attr('src', url);
@@ -3022,36 +3022,24 @@
// show/hide loading
- media.addEventListener('loadeddata',function() {
- // for some reason Chrome is firing this event
- //if (mejs.MediaFeatures.isChrome && media.getAttribute && media.getAttribute('preload') === 'none')
- // return;
-
+ media.addEventListener('loadstart',function() {
loading.show();
controls.find('.mejs-time-buffering').show();
- // Firing the 'canplay' event after a timeout which isn't getting fired on some Android 4.1 devices (https://github.com/johndyer/mediaelement/issues/1305)
- if (mejs.MediaFeatures.isAndroid) {
- media.canplayTimeout = window.setTimeout(
- function() {
- if (document.createEvent) {
- var evt = document.createEvent('HTMLEvents');
- evt.initEvent('canplay', true, true);
- return media.dispatchEvent(evt);
- }
- }, 300
- );
- }
}, false);
+ media.addEventListener('loadeddata',function() {
+ loading.hide();
+ controls.find('.mejs-time-buffering').hide();
+ }, false);
media.addEventListener('canplay',function() {
loading.hide();
controls.find('.mejs-time-buffering').hide();
- clearTimeout(media.canplayTimeout); // Clear timeout inside 'loadeddata' to prevent 'canplay' to fire twice
}, false);
// error handling
- media.addEventListener('error',function() {
+ media.addEventListener('error',function(e) {
+ t.handleError(e);
loading.hide();
- controls.find('.mejs-time-buffering').hide();
+ bigPlay.hide();
error.show();
error.find('.mejs-overlay-error').html("Error loading this resource");
}, false);
@@ -3364,9 +3352,9 @@
// STOP BUTTON
$.extend(MediaElementPlayer.prototype, {
buildstop: function(player, controls, layers, media) {
- var t = this,
- stop =
- $('