vendor/assets/javascripts/webshims/shims/combos/23.js in webshims-rails-1.10.11 vs vendor/assets/javascripts/webshims/shims/combos/23.js in webshims-rails-1.11.1
- old
+ new
@@ -474,10 +474,11 @@
return;
}
if(hasNative){
var videoElem = document.createElement('video');
Modernizr.videoBuffered = ('buffered' in videoElem);
+ Modernizr.mediaDefaultMuted = ('defaultMuted' in videoElem);
supportsLoop = ('loop' in videoElem);
webshims.capturingEvents(['play', 'playing', 'waiting', 'paused', 'ended', 'durationchange', 'loadedmetadata', 'canplay', 'volumechange']);
if(!Modernizr.videoBuffered ){
@@ -487,24 +488,19 @@
webshims.loader.loadList(['mediaelement-native-fix']);
}
if(!options.preferFlash){
var noSwitch = {
- 1: 1,
- 2: 1
+ 1: 1
};
var switchOptions = function(e){
var media, error, parent;
if(!options.preferFlash &&
($(e.target).is('audio, video') || ((parent = e.target.parentNode) && $('source:last', parent)[0] == e.target)) &&
- (media = $(e.target).closest('audio, video')) && !noSwitch[(error = media.prop('error'))]
+ (media = $(e.target).closest('audio, video')) && (error = media.prop('error')) && !noSwitch[error.code]
){
- if(error == null){
- webshims.warn("There was an unspecified error on a mediaelement");
- return;
-
- }
+
$(function(){
if(hasSwf && !options.preferFlash){
loadSwf();
webshims.ready('WINDOWLOAD '+swfType, function(){
setTimeout(function(){
@@ -512,11 +508,11 @@
options.preferFlash = true;
document.removeEventListener('error', switchOptions, true);
$('audio, video').each(function(){
webshims.mediaelement.selectSource(this);
});
- webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error'));
+ webshims.error("switching mediaelements option to 'preferFlash', due to an error with native player: "+e.target.src+" Mediaerror: "+ media.prop('error')+ 'first error: '+ error);
}
}, 9);
});
} else{
document.removeEventListener('error', switchOptions, true);
@@ -718,11 +714,11 @@
return 'video/youtube';
}
if(src.indexOf('rtmp') === 0){
return nodeName+'/rtmp';
}
- src = src.split('?')[0].split('.');
+ src = src.split('?')[0].split('#')[0].split('.');
src = src[src.length - 1];
var mt;
$.each(mediaelement.mimeTypes[nodeName], function(mimeType, exts){
if(exts.indexOf(src) !== -1){
@@ -837,11 +833,11 @@
}
$(elem).pause().data('mediaerror', message);
webshims.error('mediaelementError: '+ message);
setTimeout(function(){
if($(elem).data('mediaerror')){
- $(elem).trigger('mediaerror');
+ $(elem).addClass('media-error').trigger('mediaerror');
}
}, 1);
}
@@ -901,10 +897,11 @@
var baseData = webshims.data(elem, 'mediaelementBase') || webshims.data(elem, 'mediaelementBase', {});
var _srces = mediaelement.srces(elem);
var parent = elem.parentNode;
clearTimeout(baseData.loadTimer);
+ $(elem).removeClass('media-error');
$.data(elem, 'mediaerror', false);
if(!_srces.length || !parent || parent.nodeType != 1 || stopParent.test(parent.nodeName || '')){return;}
data = data || webshims.data(elem, 'mediaelement');
if(mediaelement.sortMedia){
@@ -928,10 +925,12 @@
var handleMedia = false;
var initMediaElements = function(){
var testFixMedia = function(){
if(webshims.implement(this, 'mediaelement')){
selectSource(this);
-
+ if(!Modernizr.mediaDefaultMuted && $.attr(this, 'muted') != null){
+ $.prop(this, 'muted', true);
+ }
//fixes for FF 12 and IE9/10 || does not hurt, if run in other browsers
if(hasNative && (!supportsLoop || ('ActiveXObject' in window))){
var bufferTimer;
var lastBuffered;
var elem = this;
\ No newline at end of file