vendor/assets/javascripts/webshims/shims/combos/12.js in webshims-rails-1.14.6 vs vendor/assets/javascripts/webshims/shims/combos/12.js in webshims-rails-1.15.2
- old
+ new
@@ -279,13 +279,20 @@
}
}
})();
}
+ if(window.CanvasRenderingContext2D && CanvasRenderingContext2D.prototype){
+ CanvasRenderingContext2D.prototype.wsImageComplete = function(cb){
+ cb.call(this, this);
+ };
+ }
+
webshims.register('mediaelement-core', function($, webshims, window, document, undefined, options){
var hasSwf = swfmini.hasFlashPlayerVersion('11.3');
var mediaelement = webshims.mediaelement;
+ var allowYtLoading = false;
mediaelement.parseRtmp = function(data){
var src = data.src.split('://');
var paths = src[1].split('/');
var i, len, found;
@@ -377,11 +384,13 @@
var loadYt = (function(){
var loaded;
return function(){
if(loaded || !hasYt){return;}
loaded = true;
- webshims.loader.loadScript("https://www.youtube.com/player_api");
+ if(allowYtLoading){
+ webshims.loader.loadScript("https://www.youtube.com/player_api");
+ }
$(function(){
webshims._polyfill(["mediaelement-yt"]);
});
};
})();
@@ -563,10 +572,11 @@
handleThird( mediaElem, ret, data );
}
});
if(!requested && hasYt && !mediaelement.createSWF){
+ allowYtLoading = true;
loadYt();
}
};
})();
@@ -727,10 +737,11 @@
if(!handleMedia){
$('video, audio', context)
.add(insertedElement.filter('video, audio'))
.each(function(){
if(!mediaelement.canNativePlaySrces(this)){
+ allowYtLoading = true;
loadThird();
handleMedia = true;
return false;
}
})
@@ -749,10 +760,11 @@
if(({noCombo: 1, media: 1})[webshims.cfg.debug]){
$(document).on('mediaerror', function(e){
mediaelement.loadDebugger();
});
}
+
//set native implementation ready, before swf api is retested
if(hasNative){
webshims.isReady('mediaelement-core', true);
initMediaElements();
webshims.ready('WINDOWLOAD mediaelement', loadThird);
@@ -833,12 +845,16 @@
this.cues = mediaelement.createCueList();
} else {
var lastCue = this.cues[this.cues.length-1];
if(lastCue && lastCue.startTime > cue.startTime){
webshims.error("cue startTime higher than previous cue's startTime");
+ return;
}
}
+ if(cue.startTime >= cue.endTime ){
+ webshim.error('startTime >= endTime of cue: '+ cue.text);
+ }
if(cue.track && cue.track.removeCue){
cue.track.removeCue(cue);
}
cue.track = this;
this.cues.push(cue);
@@ -926,10 +942,11 @@
$([trackList]).triggerHandler($.Event({type: 'removetrack', track: removed[i]}));
}
for(i = 0, len = added.length; i < len; i++){
$([trackList]).triggerHandler($.Event({type: 'addtrack', track: added[i]}));
}
+ //todo: remove
if(baseData.scriptedTextTracks || removed.length){
$(this).triggerHandler('updatetrackdisplay');
}
}
};
@@ -942,11 +959,11 @@
if(trackData && !trackData.isTriggering){
trackData.isTriggering = true;
setTimeout(function(){
$(track).closest('audio, video').triggerHandler('updatetrackdisplay');
trackData.isTriggering = false;
- }, 1);
+ }, 9);
}
};
var isDefaultTrack = (function(){
var defaultKinds = {
subtitles: {
@@ -1135,18 +1152,13 @@
});
},
error: error
});
};
- if($.ajax && $.ajaxSettings.xhr){
- if(isDisabled){
- setTimeout(createAjax, loadingTracks * 2);
- } else {
- createAjax();
- }
+ if(isDisabled){
+ setTimeout(createAjax, loadingTracks * 2);
} else {
- webshims.ready('jajax', createAjax);
- webshims.loader.loadList(['jajax']);
+ createAjax();
}
} catch(er){
error();
webshims.error(er);
}