' :
'Download File';
htmlMediaElement.parentNode.insertBefore(errorContainer, htmlMediaElement);
htmlMediaElement.style.display = 'none';
options.error(htmlMediaElement);
},
createPlugin:function(htmlMediaElement, options, isVideo, pluginType, mediaUrl, poster, autoplay, preload) {
var width = 1,
height = 1,
pluginid = 'me_' + pluginType + '_' + (mejs.meIndex++),
pluginMediaElement = new mejs.PluginMediaElement(pluginid, pluginType, mediaUrl),
container = document.createElement('div'),
node,
initVars;
// check for placement inside a tag (sometimes WYSIWYG editors do this)
node = htmlMediaElement.parentNode;
while (node !== null && node.tagName.toLowerCase() != 'body') {
if (node.parentNode.tagName.toLowerCase() == 'p') {
node.parentNode.parentNode.insertBefore(node, node.parentNode);
break;
}
node = node.parentNode;
}
if (isVideo) {
width = (options.videoWidth > 0) ? options.videoWidth : (htmlMediaElement.getAttribute('width') !== null) ? htmlMediaElement.getAttribute('width') : options.defaultVideoWidth;
height = (options.videoHeight > 0) ? options.videoHeight : (htmlMediaElement.getAttribute('height') !== null) ? htmlMediaElement.getAttribute('height') : options.defaultVideoHeight;
} else {
if (options.enablePluginDebug) {
width = 320;
height = 240;
}
}
// register plugin
pluginMediaElement.success = options.success;
mejs.MediaPluginBridge.registerPluginElement(pluginid, pluginMediaElement, htmlMediaElement);
// add container (must be added to DOM before inserting HTML for IE)
container.className = 'me-plugin';
htmlMediaElement.parentNode.insertBefore(container, htmlMediaElement);
// flash/silverlight vars
initVars = [
'id=' + pluginid,
'poster=' + poster,
'isvideo=' + ((isVideo) ? "true" : "false"),
'autoplay=' + ((autoplay) ? "true" : "false"),
'preload=' + preload,
'width=' + width,
'timerrate=' + options.timerRate,
'height=' + height];
if (mediaUrl !== null) {
initVars.push('file=' + mejs.Utility.encodeUrl(mediaUrl));
}
if (options.enablePluginDebug) {
initVars.push('debug=true');
}
if (options.enablePluginSmoothing) {
initVars.push('smoothing=true');
}
switch (pluginType) {
case 'silverlight':
container.innerHTML =
'';
break;
case 'flash':
if (mejs.MediaFeatures.isIE) {
container.outerHTML =
'';
} else {
container.innerHTML =
'';
}
break;
}
// hide original element
htmlMediaElement.style.display = 'none';
// FYI: options.success will be fired by the MediaPluginBridge
},
updateNative: function(htmlMediaElement, options, autoplay, preload, playback) {
// add methods to video object to bring it into parity with Flash Object
for (var m in mejs.HtmlMediaElement) {
htmlMediaElement[m] = mejs.HtmlMediaElement[m];
}
// special case to enforce preload attribute (Chrome doesn't respect this)
if (mejs.MediaFeatures.isChrome && preload == 'none' && autoplay !== '') {
// forces the browser to stop loading
htmlMediaElement.src = '';
htmlMediaElement.load();
htmlMediaElement.canceledPreload = true;
htmlMediaElement.addEventListener('play',function() {
if (htmlMediaElement.canceledPreload) {
htmlMediaElement.src = playback.url;
htmlMediaElement.load();
htmlMediaElement.play();
htmlMediaElement.canceledPreload = false;
}
}, false);
}
// fire success code
options.success(htmlMediaElement, htmlMediaElement);
}
};
window.mejs = mejs;
window.MediaElement = mejs.MediaElement;
/*!
* MediaElementPlayer
* http://mediaelementjs.com/
*
* Creates a controller bar for HTML5