agenda-libre-ruby/public/webshims/1.15.10/shims/mediaelement-debug.js

1 line
14 KiB
JavaScript
Raw Normal View History

!function(a,b){"use strict";function c(a,c,d,e){var f,g,h=b.Deferred(),i=b("#wsmediatestcontainer"),j=b("<div />").css({width:320,height:120,"float":"left"}),k=b(document.createElement(e.nodeName)).attr({src:a.src,"data-type":c,controls:"controls",preload:"none"}),l=function(){k.pause(),setTimeout(function(){j.remove(),b("video, audio",i).length||i.remove()},9),setTimeout(function(){h.resolve()},99)},m=function(b){var c=k.prop("duration"),e=k.prop("currentTime");c&&c>5?e>0&&5>e?l():("ended"==b.type||e>=c-1)&&(a.decode[d].endJump=!0,l()):l()},n=function(c){if(clearTimeout(f),c)if("loadedmetadata"==c.type){if("swf"==d)try{a.decode[d]=k.getShadowElement().find("object, embed")[0].api_get("meta")}catch(c){}(!a.decode[d]||b.isEmptyObject(a.decode[d]))&&(a.decode[d]={duration:k.prop("duration"),height:k.prop("videoHeight"),width:k.prop("videoWidth")}),a.decode[d].success=!0}else a.decode[d]={error:k.prop("error"),mediaError:k.data("mediaerror"),success:!1};else a.decode[d]={success:!1,timeout:!0};setTimeout(function(){k.play()},9),k.on("ended timeupdate",m),clearTimeout(g),setTimeout(l,300)};return i.length||(i=b('<div id="wsmediatestcontainer" />').css({position:"fixed",top:0,left:0,right:0,padding:10,zIndex:9999999999}).prependTo("body")),k.on("mediaerror loadedmetadata",n).appendTo(j),"native"==d&&k.on("error",n),j.appendTo(i),f=setTimeout(n,4e4),g=setTimeout(function(){k.prop("muted",!0),k.play()},200),k.mediaLoad(),h}function d(d,e){var f=[],g=d.declaredContainer||d.computedContainer||d.headerContainer||"",h=a.cfg.mediaelement.preferFlash;return l&&e.element.canPlayType(g)?(a.cfg.mediaelement.preferFlash=!1,f.push(c(d,g,"native",e))):d.decode.native={success:!1,notsupported:!0},k&&!/youtube|rtmp/i.test(g)&&-1!=j.swfMimeTypes.indexOf(g)?(a.cfg.mediaelement.preferFlash=!0,f.push(c(d,g,"swf",e))):d.decode.swf={success:!1,notsupported:"video/youtube"!=g},a.cfg.mediaelement.preferFlash=h,b.when.apply(b,f)}function e(a,c){var e=b.Deferred(),f=function(){o||(o++,b(p).off("finish",f),d(a,c).always(function(){e.resolve(),o--,b(p).trigger("finish")}))};o?b(p).on("finish",f):f(),a.decode.promise=e.promise()}function f(a,c){var d,f={src:b.prop(a,"src"),attrSrc:b.trim(b.attr(a,"src")),declaredType:b.attr(a,"type")||b(a).attr("data-type")||"",errors:{},decode:{"native":{},swf:{}}};f.declaredContainer=f.declaredType.split(";")[0].trim();try{f.computedContainer=j.getTypeForSrc(f.src,c.nodeName)}catch(g){f.computedContainer=""}if(f.src.indexOf(m))f.cors=!0;else try{f.headerType="",f.headers={},d=b.ajax({url:f.src,type:"head",success:function(){f.headerType=d.getResponseHeader("Content-Type")||"",/^\s*application\/octet\-stream\s*$/i.test(f.headerType)&&(f.headerType="",f.errors.octetStream="octetStream"),f.headerContainer=b.trim(f.headerType.split(";")[0]),["Location","Content-Type","Content-Length","Accept-Ranges","Content-Disposition","Content-Encoding"].forEach(function(a){f.headers[a]=d.getResponseHeader(a)||""})},error:function(a,b,c){f.httpError=b,f.httpErrorText=c}}),f.ajax=d}catch(g){}return e(f,c),f}function g(a){var c,d=[],e=[],g=b("source",a.element),h=[],i=b.Deferred(),j=0,k=function(){j++,j>1&&i.resolve()};return b.prop(a.element,"src")&&(c=f(a.element,a),c.attrMode=!0,c.typeNotRequired=!0,d.push(c)),g.each(function(b){var c=f(this,a);c.typeNotRequired=!!(b&&b>=g.length-1),d.push(c),c.ajax&&e.push(c.ajax),c.decode.promise&&h.push(c.decode.promise)}),a.srces=d,b.when.apply(b,h).always(k),b.when.apply(b,e).done(k).fail(function(){setTimeout(k,200)}),i.promise()}function h(a){b.each(n,function(b,c){var d,e=!1,f=c.message||b;c.srcTest?(c.srcTest.poster&&(d=c.test(a.poster,a),d&&("string"==typeof d?a.poster.errors[b]=d:(a.poster.errors[b]=f,e=!0))),c.srcTest.srces&&a.srces.forEach(function(g){d=c.test(g,a),d&&("string"==typeof d?g.errors[b]=d:(g.errors[b]=f,e=!0))})):e=c.test(a),e&&a.errors.push({message:f,level:c.level,name:b})}),a.errors.sort(function(a,b){return a.level>b.level}),console.log("---- Media Test Start ----"),console.log("Testing results for mediaelement network + markup debugger. For detailed information expand th