vendor/assets/javascripts/webshims/shims/combos/23.js in webshims-rails-1.14.6 vs vendor/assets/javascripts/webshims/shims/combos/23.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,9 +760,10 @@ 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);