@castlabs/prestoplay 1.1.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +768 -0
- package/README.md +52 -0
- package/cjs/cl.adobe.js +8 -0
- package/cjs/cl.airplay.js +8 -0
- package/cjs/cl.broadpeak.js +11 -0
- package/cjs/cl.cast.js +117 -0
- package/cjs/cl.conviva.js +38 -0
- package/cjs/cl.core.js +565 -0
- package/cjs/cl.crypto.js +15 -0
- package/cjs/cl.dash.js +78 -0
- package/cjs/cl.externs.js +4112 -0
- package/cjs/cl.freewheel.js +29 -0
- package/cjs/cl.hls.js +72 -0
- package/cjs/cl.hlssmpte.js +11 -0
- package/cjs/cl.htmlcue.js +35 -0
- package/cjs/cl.ima.js +29 -0
- package/cjs/cl.mse.js +279 -0
- package/cjs/cl.muxdata.js +19 -0
- package/cjs/cl.onboard.js +8 -0
- package/cjs/cl.persistent.js +19 -0
- package/cjs/cl.playlist.js +11 -0
- package/cjs/cl.simid.js +21 -0
- package/cjs/cl.smooth.js +76 -0
- package/cjs/cl.thumbnails.js +29 -0
- package/cjs/cl.tizen.js +76 -0
- package/cjs/cl.ttml.js +33 -0
- package/cjs/cl.verimatrix.js +10 -0
- package/cjs/cl.vimond.js +18 -0
- package/cjs/cl.vr.js +25 -0
- package/cjs/cl.vtt.js +19 -0
- package/cjs/cl.youbora.js +25 -0
- package/cjs/polyfill.min.js +47 -0
- package/cl.adobe.js +3 -0
- package/cl.airplay.js +3 -0
- package/cl.broadpeak.js +5 -0
- package/cl.cast.js +88 -0
- package/cl.conviva.js +27 -0
- package/cl.core.js +466 -0
- package/cl.crypto.js +9 -0
- package/cl.dash.js +68 -0
- package/cl.externs.js +4028 -0
- package/cl.freewheel.js +19 -0
- package/cl.hls.js +69 -0
- package/cl.hlssmpte.js +5 -0
- package/cl.htmlcue.js +26 -0
- package/cl.ima.js +17 -0
- package/cl.mse.js +241 -0
- package/cl.muxdata.js +12 -0
- package/cl.onboard.js +4 -0
- package/cl.persistent.js +11 -0
- package/cl.playlist.js +5 -0
- package/cl.simid.js +13 -0
- package/cl.smooth.js +59 -0
- package/cl.thumbnails.js +17 -0
- package/cl.tizen.js +57 -0
- package/cl.ttml.js +22 -0
- package/cl.verimatrix.js +4 -0
- package/cl.vimond.js +8 -0
- package/cl.vr.js +15 -0
- package/cl.vtt.js +12 -0
- package/cl.youbora.js +15 -0
- package/clpp.styles.css +166 -0
- package/package.json +63 -0
- package/typings.d.ts +8255 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var Mx=function(a,b){b=void 0===b?function(){return Promise.resolve()}:b;_.sl.call(this);this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.uc.bind(this)},Nx=function(a){a.trigger(new _.L(_.pf))},Ox=function(a,b){return 0<=b&&b<a.a.length};_.w(Mx,_.sl);_.r=Mx.prototype;_.r.on=function(a,b,c){return _.sl.prototype.on.call(this,a,b,c)};_.r.one=function(a,b,c){return _.sl.prototype.one.call(this,a,b,c)};_.r.off=function(a,b){return _.sl.prototype.off.call(this,a,b)};_.r.getPosition=function(){return this.f};
|
|
3
|
+
_.r.qk=function(){return this.a};_.r.Dd=function(){return 0<this.a.length&&Ox(this,this.f)?this.a[this.f]:null};_.r.sk=function(){var a=this.f+1;return 0<this.a.length&&Ox(this,a)?this.a[a]:null};_.r.Ek=function(){return this.h};_.r.start=function(){this.h||(this.h=!0,this.m.on(_.le,this.j),this.oe(this.f,!0))};_.r.stop=function(){this.h=!1;this.m.off(_.le,this.j)};_.r.uc=function(){this.next()};
|
|
4
|
+
_.r.next=function(){var a=this,b;return _.E(function(c){b=Math.min(a.a.length-1,a.f+1);return _.x(c,a.oe(b),0)})};_.r.cm=function(){var a=this,b;return _.E(function(c){b=Math.max(0,a.f-1);return _.x(c,a.oe(b),0)})};_.r.oe=function(a,b){b=void 0===b?!1:b;var c=this,d;return _.E(function(e){if(1==e.a){if(!(0<c.a.length&&Ox(c,a))||!b&&c.f===a)return e["return"]();c.f=a;return(d=c.Dd())?_.x(e,c.l(d),3):e.F(0)}if(4!=e.a)return _.x(e,c.m.load(d.configuration),4);c.trigger(new _.L(_.of,{item:d}));_.y(e)})};
|
|
5
|
+
_.r.append=function(a){this.a.push(a);Nx(this)};_.r.Ak=function(a,b){if(0<=b&&b<=this.a.length){var c=this.Dd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));Nx(this)}};_.r.remove=function(a){if(0<this.a.length&&Ox(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);Nx(this)}};_.r.clear=function(){this.stop();this.f=0;this.a=[];this.h=!1;Nx(this)};_.H("clpp.Playlist",Mx);Mx.prototype.clear=Mx.prototype.clear;Mx.prototype.remove=Mx.prototype.remove;
|
|
6
|
+
Mx.prototype.insert=Mx.prototype.Ak;Mx.prototype.append=Mx.prototype.append;Mx.prototype.goTo=Mx.prototype.oe;Mx.prototype.previous=Mx.prototype.cm;Mx.prototype.next=Mx.prototype.next;Mx.prototype.onEnded=Mx.prototype.uc;Mx.prototype.stop=Mx.prototype.stop;Mx.prototype.start=Mx.prototype.start;Mx.prototype.isStarted=Mx.prototype.Ek;Mx.prototype.getUpcoming=Mx.prototype.sk;Mx.prototype.getCurrent=Mx.prototype.Dd;Mx.prototype.getQueue=Mx.prototype.qk;Mx.prototype.getPosition=Mx.prototype.getPosition;
|
|
7
|
+
Mx.prototype.off=Mx.prototype.off;Mx.prototype.one=Mx.prototype.one;Mx.prototype.on=Mx.prototype.on;};
|
|
8
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
9
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
10
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
11
|
+
})();
|
package/cjs/cl.simid.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var ux="No surface found. Can not attach frame!",vx="SIMID:Media:timeupdate",wx="Starting creative",Bx=function(a){var b=this;this.f=a;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.Re;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=_.Re;this.a.style.overflow=_.qe;this.a.classList.add(_.wd);this.o=function(c){if(c.source===b.a.contentWindow&&
|
|
3
|
+
(c=(c=c.data)?typeof c===_.Vf?JSON.parse(c):c:null))if(c.type)switch(b.g.info("Received message ["+c.Fb+"] '"+c.type+"':",c.Pb),c.type){case "createSession":xx(b,c);break;case "resolve":c=c.Pb;var d=b.j.get(c.Fb);d&&d.resolve(c);break;case "reject":c=c.Pb;(d=b.j.get(c.Fb))&&d.reject(c);break;case "SIMID:Creative:requestResize":d=b.f;var e=c.Pb;d.g.info("Creative requested resize",e);if(d.m&&d.m.getSurface()&&d.m.getSurface().getMedia()&&e.Pk){d.h?d.m.getSurface().getMedia().style.transition="":(d.m.getSurface().getMedia().style.transition=
|
|
4
|
+
"left .5s, top .5s,width .5s, height .5s",d.h=!0);var f=yx(d,e.Pk);d.m.getSurface().getMedia().style.left=f.left;d.m.getSurface().getMedia().style.top=f.top;d.m.getSurface().getMedia().style.width=f.width;d.m.getSurface().getMedia().style.height=f.height}e.bf&&(e=yx(d,e.bf),d.a.a.style.left=e.left,d.a.a.style.top=e.top,d.a.a.style.width=e.width,d.a.a.style.height=e.height);zx(b,c)}else b.g.warn("WARNING: received message without 'type' property")};this.g=new _.K("clpp.simid.SimidPlayer");Ax(this.f,
|
|
5
|
+
this)},Ex=function(a){var b=Cx(a,"SIMID:Player:startCreative",void 0);Dx(a,b).then(function(){var c=a.f;c.g.info(wx);c.m.trigger(new _.L(_.Nf));a.a.style.opacity="1"})["catch"](function(c){a.unload();a.f.g.error("Error while starting creative",c)})},xx=function(a,b){var c;_.E(function(d){if(1==d.a){a.h=b.sessionId;zx(a,b);_.A(d,2);var e=a.f;var f=e.getSurface(),g=e.getContainer();e={ln:{Fm:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},bf:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},$j:f.isFullscreen(),
|
|
6
|
+
qn:!0,Fn:!1,Dn:"notSkippable",version:"1.1",Cn:"",Bn:window.location.toString(),appId:"",En:"",deviceId:"",muted:e.m.isMuted()||!1,volume:e.m.getVolume()||0,tn:"adHandles",en:"adHandles",vn:e.f.duration},fn:{adParameters:e.f.adParameters||"",cn:"",dn:""}};e=Cx(a,"SIMID:Player:init",e);e=Dx(a,e);return _.x(d,e,4)}if(2!=d.a)return a.g.info("Player Init acknowledged"),a.f.g.info("SIMID Player initialized"),_.$g(d,0);c=_.B(d);a.g.error("Error while initializing",c);a.f.g.error("Error while initializing SIMID player: ",
|
|
7
|
+
c);a.unload();_.y(d)})},Cx=function(a,b,c){return{type:b,sessionId:a.h,Fb:a.l++,timestamp:Date.now(),Pb:c}},Fx=function(a,b){a.h?(b.type!==vx&&a.g.info("Posting message ["+b.Fb+"] '"+b.type+"':",b.Pb),a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn("WARNING: no session available to send message '"+b.type+"'")},zx=function(a,b){Fx(a,Cx(a,"resolve",{Fb:b.Fb,value:void 0}))},Dx=function(a,b){return new Promise(function(c,d){new Gx(a.j,c,d,b);Fx(a,b)})},Gx=function(a,
|
|
8
|
+
b,c,d){var e=this;var f=void 0===f?-1:f;this.f=a;this.l=b;this.j=c;this.h=d;this.a=null;this.f.set(d.Fb,this);0<=f&&(this.a=setTimeout(function(){e.resolve()},f))},Hx=function(){this.g=new _.K("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.oj.bind(this);this.f=null;this.o=!1},Ix=function(a,b,c){return new ResizeObserver(function(){if(a.a.h){var d=a.a,e={Fm:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},bf:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},$j:c.isFullscreen()};
|
|
9
|
+
e=Cx(d,"SIMID:Player:resize",e);Fx(d,e)}})},Jx=function(a){this.m=a;this.a=null;this.g=new _.K("clpp.simid.Loader");this.h=!1;this.f=null},yx=function(a,b){var c=a.getContainer(),d=c.clientWidth;c=c.clientHeight;return{top:b.y/c*100+"%",left:b.x/d*100+"%",width:b.width/d*100+"%",height:b.height/c*100+"%"}},Ax=function(a,b){a.g.info("SIMID Session created");a.a=b},Kx=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(function(){a.m.getSurface().getMedia().style.transition=
|
|
10
|
+
""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width="";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height="";a.h=!1;a.m.trigger(new _.L(_.Of))},Lx=function(){};
|
|
11
|
+
Bx.prototype.load=function(a){window.addEventListener(_.Je,this.o);this.h="";this.l=0;var b=this.f.url();this.g.info('Loading "'+b+'" as src of iFrame');this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)};Bx.prototype.unload=function(){Kx(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Je,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)};
|
|
12
|
+
Gx.prototype.resolve=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.Fb);this.l(a)};Gx.prototype.reject=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.Fb);this.j(a)};_.w(Hx,_.ft);_.r=Hx.prototype;_.r.id=function(){return"simid"};_.r.onPlayerCreated=function(a){this.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new Jx(a)};
|
|
13
|
+
_.r.onContentWillLoad=function(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.g.info("Setting up SIMID plugin for "+this.l.length+" creatives"),b=this.m.getSurface()){this.g.info("Creating new session");this.a=new Bx(this.h);var c=b.getContainer();this.j=Ix(this,c,b);this.j.observe(c);a.on(_.dg,this.w)}else this.g.warn(ux)};
|
|
14
|
+
_.r.oj=function(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b],d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(Ex(this.a),this.o=!0,this.g.info(wx)),c&&(c=this.a,Fx(c,Cx(c,vx,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(ux),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=
|
|
15
|
+
b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)};_.r.onPlayerWillRelease=function(a){_.ft.prototype.onPlayerWillRelease.call(this,a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.dg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))};Jx.prototype.release=function(){this.g.info("Releasing loader")};
|
|
16
|
+
Jx.prototype.getContainer=function(){var a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.P(1,10,10100,"No player container found");return a};Jx.prototype.getSurface=function(){var a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.P(1,10,10100,"No surface");return a};Jx.prototype.url=function(){return this.f?this.f.url:""};Lx.prototype.create=function(){return new Hx};
|
|
17
|
+
_.jq(new Lx);};
|
|
18
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
19
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
20
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
21
|
+
})();
|
package/cjs/cl.smooth.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var aL="Full MP4 box must have flags defined",bL="clpp.smooth.SmoothMP4Processor",cL="codecPrivateData",dL=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.V(a,c);_.V(a,d)},eL=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.am()}},fL=function(a,b){eL(a,b>>16&255);eL(a,b>>8&255);eL(a,b&255)},gL=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.am()}},hL=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.am()}},iL=function(a,b){try{a.f.setInt16(a.a,
|
|
3
|
+
b,a.h),a.a+=2}catch(c){_.am()}},jL=function(a,b){if(void 0!=b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},kL=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]},Z=function(a,b,c){kL.call(this,a);this.version=b;this.flags=c},lL=function(a,b,c){kL.call(this,a);this.h=b;this.offset=c},mL=function(a,b,c,
|
|
4
|
+
d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},nL=function(a,b,c){kL.call(this,"ftyp");this.j=a;this.kh=b;this.h=c},oL=function(){kL.call(this,_.Ne)},pL=function(){kL.call(this,_.eg)},qL=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.j=c+1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},rL=function(){kL.call(this,"mvex")},sL=function(a){Z.call(this,"trex",0,0);this.h=a},tL=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);
|
|
5
|
+
this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},uL=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},vL=function(a){Z.call(this,"hdlr",0,0);this.h=a},wL=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},xL=function(a){kL.call(this,a);this.A=!0},yL=function(a){xL.call(this,a);this.height=this.width=0;this.depth=24},zL=
|
|
6
|
+
function(a,b,c,d){xL.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},AL=function(a,b){yL.call(this,"avc1");this.width=a;this.height=b},BL=function(a,b){AL.call(this,a,b);this.type="encv"},CL=function(a,b,c){zL.call(this,"mp4a",a,b,c)},DL=function(a,b,c){CL.call(this,a,b,c);this.type="enca"},EL=function(a,b){kL.call(this,"avcC");this.Sa=a;this.bc=b;this.version=1;this.h=this.Sa[0][1];this.j=this.Sa[0][2];this.level=this.Sa[0][3]},FL=function(a){Z.call(this,"esds",0,0);this.Qb=
|
|
7
|
+
a},GL=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},HL=function(){Z.call(this,"dref",0,0)},IL=function(){kL.call(this,_.Uf)},JL=function(){Z.call(this,_.Wf,0,0)},KL=function(){Z.call(this,"stts",0,0)},LL=function(){Z.call(this,"stsc",0,0)},ML=function(){Z.call(this,"stco",0,0)},NL=function(){Z.call(this,"stsz",0,0)},OL=function(){Z.call(this,"smhd",0,0)},PL=function(){kL.call(this,"dinf")},QL=function(){kL.call(this,_.Me)},RL=function(){kL.call(this,_.Ie)},SL=function(a,b){Z.call(this,
|
|
8
|
+
"tfdt",a,0);this.h=b},TL=function(){Z.call(this,"mfhd",0,0);this.h=0},UL=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},VL=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},WL=function(){kL.call(this,"traf")},XL=function(){kL.call(this,"moof")},YL=function(){kL.call(this,_.He);this.h=new Uint8Array(0)},ZL=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},$L=function(a,b){Z.call(this,
|
|
9
|
+
"schm",0,0);this.h=a;this.j=b;this.Kb=""},aM=function(a){kL.call(this,"frma");this.h=a},bM=function(){Z.call(this,"saio",0,0);this.offset=[0]},cM=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},dM=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},eM=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},fM=function(a,b,c,d){c=b.Ng[c];b=b.Em;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
|
|
10
|
+
String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.Ai([a],[b])[0]},gM=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.rg?c=["maxWidth","maxHeight","bitrate",cL,"fourCC"]:a.type===_.$c&&(c=["bitrate",cL,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ra(a,b,c,["id","segmentIndex"])},hM=function(a,b,c){var d=c.ee.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Sa:null,bc:null,width:NaN,height:NaN,Qb:null,Od:NaN,
|
|
11
|
+
sampleSize:NaN,channelCount:NaN};switch(c.type){case _.rg:a.Sa=[_.fj(d[1])];a.bc=[_.fj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.Qb=_.fj(c.ee),a.sampleSize=c.oi||16,a.Od=c.Od,a.channelCount=c.lg}return a},iM=function(a,b){return a.filter(function(c){return c.type===b})},jM=function(a,b){var c=a.exec(b);return null==c||""==c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},qM=function(a,b,c){var d=null;if(kM.test(a)){a=kM.exec(a);d=
|
|
12
|
+
Number(a[1]);var e=Number(a[2]),f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}else lM.test(a)?d=jM(lM,a):mM.test(a)?d=jM(mM,a):nM.test(a)?(a=nM.exec(a),d=Number(a[1])/c.frameRate):oM.test(a)?(a=oM.exec(a),d=Number(a[1])/c.a):pM.test(a)&&(d=jM(pM,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*d);return b+":"+c+":"+a+"."+d},rM=function(a,
|
|
13
|
+
b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0==this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))},tM=function(a){this.a=a;this.f=sM(this)},sM=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.$l(b)},uM=function(a,b,c){a:{var d=_.u([_.Rd,_.Pd]);for(var e=d.next();!e.done;e=d.next())if((e=c.le(e.value))&&e.keyId){d=e.keyId;break a}_.J(bL,"Could not get default Key ID for DRM init data!");
|
|
14
|
+
d=null}c=new kL("xxxx");a.type===_.rg?c=new BL(a.width,a.height):c=new DL(a.channelCount,a.sampleSize,a.Od);a=new ZL;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new kL("schi")).append([a]);b=(new kL(_.Pf)).append([new aM(b),new $L(_.rd,65536),a]);c.append([b]);return c},vM=function(a,b){var c=b.se(),d=new qL(a.timescale,a.duration,a.id),e=(new rL).append([new sL(a.id)]),f=new tL(a.id,a.duration,a.timescale,a.width,a.height),g=new uL(a.timescale,a.duration),h=new vL(a.type),l=null,m=new HL;
|
|
15
|
+
m.entries=[new GL];var n=new JL;switch(a.type){case _.rg:var p=new EL(a.Sa,a.bc);c?(l=uM(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new AL(a.width,a.height)).append([p]),n.entries=[l]);l=new wL;break;case _.$c:p=new FL(a.Qb),c?(l=uM(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new CL(a.channelCount,a.sampleSize,a.Od)).append([p]),n.entries=[l]),l=new OL}n=(new IL).append([n,new KL,new LL,new NL,new ML]);m=(new PL).append([m]);m=(new QL).append([l,m,n]);g=(new RL).append([g,h,m]);f=(new pL).append([f,
|
|
16
|
+
g]);d=(new oL).append([d,f,e]);e=new nL("dash",0,["iso6","mp41","avc1"]);c&&(c=b.le(_.Pd),f=b.le(_.Rd),c&&d.append([new lL("pssh",c.initData,8)]),f&&d.append([new lL("pssh",f.initData,8)]),c||f||_.J(bL,"Could not get PSSH init data!"));c=new tM([e,d]);return _.Ti(c.write())},xM=function(a,b){var c,d,e,f,g,h;(new _.lm).L("moof",_.mm).Y("mfhd",function(m){var n=new TL;n.h=_.W(m.reader);c=n}).L("traf",_.mm).Y("tfhd",function(m){var n=m.reader.Fa();if(null===m.flags)throw new _.P(_.Q,3,3019,aL);var p=
|
|
17
|
+
new VL(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.im(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.B=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.W(m.reader));d=p}).Y("trun",function(m){var n=m.reader.Fa();if(null===m.flags)throw new _.P(_.Q,3,3019,aL);var p=new UL(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-
|
|
18
|
+
m.reader.getPosition()&&m.flags&1&&(p.l=_.hm(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.W(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.W(m.reader)),m.flags&512&&p.sampleSize.push(_.W(m.reader)),m.flags&1024&&p.B.push(_.W(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.W(m.reader)):p.j.push(_.hm(m.reader)));e=p}).Y("sdtp",function(m){var n=_.km(m.reader,m.reader.Fa());f=new mL("sdtp",m.version||0,m.flags||0,n,0)}).L("uuid",function(m){var n=_.km(m.reader,
|
|
19
|
+
16);if(_.hj(n,wM)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new dM(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.fm(m.reader));for(var p=0;p<n.j;p++){var q={$g:_.km(m.reader,8),gd:0,Uf:[]};if(m.flags&2){q.gd=_.gm(m.reader);for(var t=0;t<q.gd;t++){var v={jg:0,kg:0};v.jg=_.gm(m.reader);v.kg=_.W(m.reader);q.Uf.push(v)}}n.h.push(q)}g=n}}).L(_.He,function(m){var n=new YL;0<m.reader.Fa()?n.h=_.km(m.reader,m.reader.Fa()):(_.J(bL,"mdat box is empty!"),n.h=new Uint8Array(0));h=n}).parse(a,
|
|
20
|
+
!1);if(!h)return null;var l=(new WL).append([d,e]);f&&l.append([f]);b.se()&&g&&l.append([g]);l=(new XL).append([c,l]);return new tM([l,h])},yM=function(a,b,c,d){var e=d.se(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=xM(b,d);if(null===g)return a.request.contentType===_.ag?a.data:g;d=g.get(_.He);if(a.request.contentType===_.ag){e=d.h.buffer;if(c){e=_.R.Bd(e);if((e=(new DOMParser).parseFromString(e,_.cg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new rM(h.getAttribute("ttp:frameRate"),
|
|
21
|
+
h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.ke],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var D=q[v].name;if(D=D.match(t)){p=p.getAttribute(D[0]);break b}}p=null}}f.setAttribute(l[m],qM(p||
|
|
22
|
+
"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.Ta(e).buffer}else c=e;return c}h=new XL;a=g.get("mfhd");b=new WL;l=g.get("tfhd");m=new SL(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.h=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.j;m++)l.push(10+6*c.h[m].gd);else g=8;b.append([c,new bM,new cM(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new tM([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=
|
|
23
|
+
c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},zM=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},AM=function(a,b,c){a=_.nn(a);c&&a.version!==c&&(a=_.jz(a,c));return{initData:_.hz(a),initDataType:_.rd,keyId:b,periodId:null}},CM=function(){this.w=this.h=this.f=this.C=null;this.M=1;this.T=0;this.l="";this.B=this.a=null;this.g=
|
|
24
|
+
new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.P=BM;this.H=0;this.D=this.I=Infinity;this.o=[];this.K=this.im.bind(this);this.G=new Map},DM=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=_.qj(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.C.networkingEngine.fetch(c),
|
|
25
|
+
_.x(f,d.O,2);e=f.f;a.l=e.uri;return f["return"](e)})},KM=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.R.Bd(b);var f=d.parseFromString(e.trim(),_.cg)}catch(WE){throw WE;}if(f&&f.documentElement.tagName==_.ac)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(WE){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+EM(a,c,"MajorVersion"),l=+EM(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+EM(a,c,"Duration"),
|
|
26
|
+
p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.Zm(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+h+"."+l))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.P(_.Q,4,4036,a.l);p?(FM(a,GM),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):FM(a,BM);a.a={startTime:0,delay:0,duration:n/m,df:t/m,Hd:0};if(v){var z=a.f.playreadyVersion,D=[],G=_.Zm(v,"ProtectionHeader")[0],
|
|
27
|
+
F=_.ej(_.an(G)||""),C=_.nn(F).a;D.push(zM(_.Rd,{initData:_.hz(_.fn(C)),initDataType:_.rd,keyId:C,periodId:null},[C]));D.push(zM(_.Pd,AM(F,C,z),[C]));a.o=D}var I=[],O=_.Zm(c,"StreamIndex");if(!O.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.l);for(var M=0;M<O.length;M++){for(var aa,oa=a,pa=O[M],Ja=EM(oa,pa,"Type"),Ma=+pa.getAttribute("Chunks"),wa=pa.getAttribute("Subtype"),qa=pa.getAttribute("Language")||_.gg,Fa=_.Mi(qa),nb=pa.getAttribute("Name")||"",ic=+pa.getAttribute(_.xb),Jb=
|
|
28
|
+
+pa.getAttribute(_.wb),ve=EM(oa,pa,"Url"),Hs=+pa.getAttribute("TimeScale")||null,Lc=[],zm=_.Zm(pa,_.Ob),qt=0;qt<zm.length;qt++){var qf=void 0,kc=void 0,rt=void 0,rf=oa,pd=zm[qt],st=Ja,sQ=+pd.getAttribute("Index"),tQ=+EM(rf,pd,"Bitrate"),ZE=NaN,$E=NaN,tn=NaN,tt=NaN,aF=NaN,bF=NaN,cF=NaN,dF=pd.getAttribute("FourCC");switch(st){case _.rg:ZE=+EM(rf,pd,_.wb);$E=+EM(rf,pd,_.xb);break;case _.$c:tt=+pd.getAttribute("Channels")||2,tn=+EM(rf,pd,"SamplingRate"),bF=+EM(rf,pd,"AudioTag"),aF=+EM(rf,pd,"BitsPerSample"),
|
|
29
|
+
cF=+EM(rf,pd,"PacketSize")}var ut=String(pd.getAttribute("CodecPrivateData"));if(st===_.$c&&!ut){var eF=tt,fF={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},un=fF[tn];if("AACH"===dF){kc=new Uint8Array(4);var gF=fF[2*tn];kc[0]=40|un>>1;kc[1]=un<<7|eF<<3|gF>>1;kc[2]=gF<<7|8;kc[3]=0;qf=new Uint16Array(2);qf[0]=(kc[0]<<8)+kc[1];qf[1]=(kc[2]<<8)+kc[3];rt=qf[0].toString(16)+qf[1].toString(16)}else kc=new Uint8Array(2),kc[0]=16|un>>1,kc[1]=un<<7|eF<<3,
|
|
30
|
+
qf=new Uint16Array(1),qf[0]=(kc[0]<<8)+kc[1],rt=qf[0].toString(16);ut=rt.toUpperCase()}var uQ={id:rf.T++,type:st,index:sQ,bitrate:tQ,ee:ut,maxHeight:ZE,maxWidth:$E,Od:tn,lg:tt,Ym:bF,oi:aF,wn:cF,Zj:dF,segmentIndex:null};Lc.push(uQ)}aa=Lc;for(var ze=[],hF=_.Zm(pa,"c"),Jj=0;Jj<hF.length;Jj++){var vt=hF[Jj],Nd=parseInt(vt.getAttribute("t"),10),Bh=parseInt(vt.getAttribute("d"),10),wt=parseInt(vt.getAttribute("r"),10),Kj=0;if(isNaN(Nd)&&isNaN(Bh))throw oa.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
|
|
31
|
+
new _.P(_.Q,4,4037,oa.l);0===Jj&&isNaN(Nd)&&(Kj=Nd=0);if(0<Jj){var og=ze[ze.length-1];Kj=og.n+1;og.d||(og.d=Nd-og.t);Nd||(Nd=og.t+og.d);Bh||(Bh=Nd-og.t)}ze.push({n:Kj,d:Bh,t:Nd});if(wt){wt--;for(var iF=0;iF<wt;iF++){var vn=ze[ze.length-1];Kj=vn.n+1;Nd=vn.t+vn.d;Bh=vn.d;ze.push({n:Kj,d:Bh,t:Nd})}}}oa.sd()||ze.length===Ma||oa.g.warn("Number of fragments ("+Ma+") differs from number of chunks ("+ze.length+").");I.push({type:Ja,bn:Ma,tm:wa,language:Fa,Gd:qa,name:nb,maxWidth:ic,maxHeight:Jb,Em:ve,tracks:aa,
|
|
32
|
+
Ng:ze,timescale:Hs})}var sf={sn:h,kh:l,timescale:m,duration:n,isLive:p,rn:q,df:t,pf:!1,streams:I};if(a.h&&a.w)return HM(a,sf),Promise.resolve();a.G.clear();var xt=sf.timescale,yt=sf.duration,wQ=iM(sf.streams,_.$c),xQ=iM(sf.streams,_.rg),yQ=iM(sf.streams,_.ag),jF=[],wn=IM(a,yt,xt,wQ),xn=IM(a,yt,xt,xQ),zQ=IM(a,yt,xt,yQ);wn.length||(wn=[null]);xn.length||(xn=[null]);for(var At=0;At<xn.length;At++)for(var Bt=0;Bt<wn.length;Bt++)jF.push(JM(a,xn[At],wn[Bt]));var kF={startTime:0,variants:jF,textStreams:zQ,
|
|
33
|
+
thumbStreams:[]};var BQ=sf.streams,Ct=a.a.startTime,lF=a.a.delay,Dt=a.I,mF=Math.min(a.a.duration||Infinity,Dt),Et=a.sd(),CQ=a.a.df,DQ=a.a.Hd,nF=a.H,oF=isFinite(a.D)?a.D:0;if(Et)mF=Infinity,Ct=Date.now()/1E3-DQ,a.a.startTime=Ct,lF=3*nF;else for(var EQ=isFinite(Dt)?Dt:a.a.duration,pF=_.u(BQ),Ft=pF.next();!Ft.done;Ft=pF.next())for(var qF=_.u(Ft.value.tracks),Gt=qF.next();!Gt.done;Gt=qF.next()){var rF=Gt.value;rF.segmentIndex.offset(-oF);_.Oz(rF.segmentIndex,EQ)}a.B=new _.Uz(Ct,lF,!Et,!0);a.B.f=mF;_.Yz(a.B,
|
|
34
|
+
nF);a.B.w=CQ;Et||a.B.offset(-oF);a.C.filterAllPeriods([kF]);a.h={presentationTimeline:a.B,periods:[kF],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.J||(a.C.networkingEngine.ld(a.K),a.J=!0);a.w=sf;return Promise.resolve()},HM=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.u(a.w.streams[c].tracks),g=f.next();!g.done;e={Ob:e.Ob},g=f.next())if(e.Ob=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Ob.type&&m.bitrate===l.Ob.bitrate}}(e))){gM(e.Ob,
|
|
35
|
+
g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=LM(a,a.w.timescale,d,g);g=e.Ob.segmentIndex;g.na(h);(h=a.a.df)&&_.jA(g,_.iA(g)-h).forEach(function(l){l.Pa().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.Ob.type+" track with bitrate "+(e.Ob.bitrate+". Skipping update."))},IM=function(a,b,c,d){for(var e=[],f={Gc:0};f.Gc<d.length;f={Gc:f.Gc},f.Gc++){var g=d[f.Gc].tracks.map(function(h){return function(l){var m=
|
|
36
|
+
d[h.Gc],n=LM(a,c,m,l);n=new _.hA(n);var p=null;m.type!==_.ag&&(p=MM(a,b,c,m,l));l.segmentIndex=n;var q=a.M++,t=Promise.resolve.bind(Promise),v=n.Pc.bind(n),z=n.get.bind(n),D=n.md.bind(n),G=n.getDuration.bind(n),F=NM[m.type],C="";switch(m.type){case _.rg:C=l.ee;var I=/00000001[0-9]7/.exec(C);C="avc1."+(I&&I[0]?C.substr(C.indexOf(I[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",C);break;case _.$c:C=l.ee,I=2,"AACH"===l.Zj?I=5:C&&(I=(parseInt(C.substr(0,2),16)&248)>>3),C="mp4a.40."+I,a.g.debug("AUDIO CODECS: ",
|
|
37
|
+
C)}I=m.type===_.ag?OM[m.tm]:void 0;return{id:q,originalId:null,yn:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:D,getDuration:G,segmentIndex:n,segmentLookupStrategy:_.Sy,initSegmentReference:p,mimeType:F,codecs:C,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:I,encrypted:a.rf(),keyId:null,language:m.language,originalLanguage:m.Gd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
38
|
+
roles:[],channelsCount:l.lg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},LM=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Ng.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.D=Math.min(a.D,n)}else n=f[l-1].endTime;var p=n+m,q=fM(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.Ki(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.rg||c.type===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Hd?a.a.Hd=b.endTime:a.a.Hd=Math.min(a.a.Hd,
|
|
39
|
+
b.endTime);return f},MM=function(a,b,c,d,e){b=hM(b,d.timescale||c,e);c={isLive:a.sd.bind(a),se:a.rf.bind(a),gk:function(){return 1},le:a.Pg.bind(a)};d=new Uint8Array(0);try{d=vM(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.P(_.Q,3,4035,g);}var f="data:text/plain;base64,"+_.dj(d);return new _.rz(function(){return[f]},0,null,null,!0)},JM=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.gg;return c||b?{id:a.M++,language:e,primary:!1,audio:c,
|
|
40
|
+
video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},EM=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.P(_.Q,4,4038,a.l,c);},PM=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Ib.bind(a),b))},FM=function(a,b){var c=b===BM;if(a.h&&a.h.presentationTimeline){var d=a.h.presentationTimeline;d.j=c;d.l=c}c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.P=b},QM=function(){};
|
|
41
|
+
kL.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this};kL.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.f.length;b++){if(this.f[b].type===a)return this.f[b];var c=this.f[b].get(a);if(c)return c}return null};kL.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(var c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b};
|
|
42
|
+
kL.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.V(a,1):_.V(a,this.size);_.bm(a,jL(this.type));this.size>b&&dL(a,this.size);"uuid"===this.type&&_.bm(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()};_.w(Z,kL);Z.prototype.a=function(){return 4+kL.prototype.a.call(this)};Z.prototype.write=function(a){kL.prototype.write.call(this,a);eL(a,this.version);fL(a,this.flags)};
|
|
43
|
+
_.w(lL,kL);lL.prototype.a=function(){return this.h.byteLength+kL.prototype.a.call(this)-this.offset};lL.prototype.write=function(a){kL.prototype.write.call(this,a);_.bm(a,this.h,this.offset);a.getPosition()};_.w(mL,Z);mL.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};mL.prototype.write=function(a){Z.prototype.write.call(this,a);_.bm(a,this.h,this.offset);a.getPosition()};_.w(nL,kL);
|
|
44
|
+
nL.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+kL.prototype.a.call(this)};nL.prototype.write=function(a){kL.prototype.write.call(this,a);_.bm(a,jL(this.j));_.V(a,this.kh);_.bm(a,jL(this.h.join("")));a.getPosition()};_.w(oL,kL);_.w(pL,kL);_.w(qL,Z);qL.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=Z.prototype.a.call(this)};
|
|
45
|
+
qL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(dL(a,0),dL(a,0),_.V(a,this.timescale),dL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);gL(a,this.volume);gL(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)eL(a,this.h[b]);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,this.j);a.getPosition()};_.w(rL,kL);_.w(sL,Z);sL.prototype.a=function(){return 20+Z.prototype.a.call(this)};
|
|
46
|
+
sL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);_.V(a,1);_.V(a,0);_.V(a,0);_.V(a,0);a.getPosition()};_.w(tL,Z);tL.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+Z.prototype.a.call(this)};
|
|
47
|
+
tL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(dL(a,0),dL(a,0),_.V(a,this.j),_.V(a,0),dL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.j),_.V(a,0),_.V(a,this.duration*this.timescale));_.V(a,0);_.V(a,0);gL(a,0);gL(a,0);gL(a,this.volume);gL(a,0);for(var b=0;b<this.h.length;b++)eL(a,this.h[b]);gL(a,this.width);gL(a,0);gL(a,this.height);gL(a,0);a.getPosition()};_.w(uL,Z);uL.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
|
|
48
|
+
uL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(dL(a,0),dL(a,0),_.V(a,this.timescale),dL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));gL(a,this.language);gL(a,0);a.getPosition()};_.w(vL,Z);vL.prototype.a=function(){return 33+Z.prototype.a.call(this)};
|
|
49
|
+
vL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);this.h===_.rg?_.bm(a,jL("vide")):_.bm(a,jL("soun"));_.V(a,0);_.V(a,0);_.V(a,0);this.h===_.rg?_.bm(a,jL("VideoHandler\x00")):_.bm(a,jL("SoundHandler\x00"));a.getPosition()};_.w(wL,Z);wL.prototype.a=function(){return 2+this.h.byteLength+Z.prototype.a.call(this)};wL.prototype.write=function(a){Z.prototype.write.call(this,a);gL(a,0);_.bm(a,this.h);a.getPosition()};_.w(xL,kL);xL.prototype.a=function(){return 8+kL.prototype.a.call(this)};
|
|
50
|
+
xL.prototype.write=function(a){kL.prototype.write.call(this,a);_.V(a,0);gL(a,0);gL(a,1)};_.w(yL,xL);yL.prototype.a=function(){return 70+xL.prototype.a.call(this)};yL.prototype.write=function(a){xL.prototype.write.call(this,a);gL(a,0);gL(a,0);_.V(a,0);_.V(a,0);_.V(a,0);gL(a,this.width);gL(a,this.height);_.V(a,4718592);_.V(a,4718592);_.V(a,0);gL(a,1);eL(a,10);_.bm(a,jL("AVC Coding",31));gL(a,this.depth);iL(a,-1)};_.w(zL,xL);zL.prototype.a=function(){return 20+xL.prototype.a.call(this)};
|
|
51
|
+
zL.prototype.write=function(a){xL.prototype.write.call(this,a);_.V(a,0);_.V(a,0);gL(a,this.channelCount);gL(a,this.sampleSize);iL(a,0);gL(a,0);gL(a,this.sampleRate);gL(a,0)};_.w(AL,yL);AL.prototype.write=function(a){yL.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(BL,AL);_.w(CL,zL);CL.prototype.write=function(a){zL.prototype.write.call(this,a);for(var b=0;b<this.f.length;b++)this.f[b].write(a);a.getPosition()};_.w(DL,CL);_.w(EL,kL);
|
|
52
|
+
EL.prototype.a=function(){for(var a=7,b=0;b<this.Sa.length;b++)a+=2,a+=this.Sa[b].byteLength;for(b=0;b<this.Sa.length;b++)a+=2,a+=this.bc[b].byteLength;return a+kL.prototype.a.call(this)};
|
|
53
|
+
EL.prototype.write=function(a){kL.prototype.write.call(this,a);eL(a,this.version);eL(a,this.h);eL(a,this.j);eL(a,this.level);eL(a,255);eL(a,224|this.Sa.length);for(var b=0;b<this.Sa.length;b++)gL(a,this.Sa[b].length),_.bm(a,this.Sa[b]);eL(a,this.bc.length);for(b=0;b<this.bc.length;b++)gL(a,this.bc[b].length),_.bm(a,this.bc[b]);a.getPosition()};_.w(FL,Z);FL.prototype.a=function(){return 22+(this.Qb.byteLength+3)+Z.prototype.a.call(this)};
|
|
54
|
+
FL.prototype.write=function(a){Z.prototype.write.call(this,a);eL(a,3);eL(a,23+this.Qb.byteLength);gL(a,1);eL(a,0);eL(a,4);eL(a,15+this.Qb.byteLength);eL(a,64);eL(a,21);fL(a,0);_.V(a,0);_.V(a,0);eL(a,5);eL(a,this.Qb.byteLength);_.bm(a,this.Qb);_.bm(a,new Uint8Array([6,1,2]));a.getPosition()};_.w(GL,Z);GL.prototype.a=function(){return this.location.length+Z.prototype.a.call(this)};GL.prototype.write=function(a){Z.prototype.write.call(this,a);0<this.location.length&&_.bm(a,jL(this.location));a.getPosition()};
|
|
55
|
+
_.w(HL,Z);HL.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};HL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(IL,kL);_.w(JL,Z);JL.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
|
|
56
|
+
JL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(KL,Z);KL.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};KL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(LL,Z);
|
|
57
|
+
LL.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};LL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(ML,Z);ML.prototype.a=function(){for(var a=4,b=0;b<this.entries.length;b++)a+=this.entries[b].a();return a+Z.prototype.a.call(this)};
|
|
58
|
+
ML.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.entries.length);for(var b=0;b<this.entries.length;b++)this.entries[b].write(a);a.getPosition()};_.w(NL,Z);NL.prototype.a=function(){return 8+Z.prototype.a.call(this)};NL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,0);_.V(a,0);a.getPosition()};_.w(OL,Z);OL.prototype.a=function(){return 4+Z.prototype.a.call(this)};OL.prototype.write=function(a){Z.prototype.write.call(this,a);iL(a,0);gL(a,0);a.getPosition()};
|
|
59
|
+
_.w(PL,kL);_.w(QL,kL);_.w(RL,kL);_.w(SL,Z);SL.prototype.a=function(){var a=0;a=1===this.version?a+8:a+4;return a+Z.prototype.a.call(this)};SL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?dL(a,this.h):_.V(a,this.h);a.getPosition()};_.w(TL,Z);TL.prototype.a=function(){return 4+Z.prototype.a.call(this)};TL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);a.getPosition()};_.w(UL,Z);
|
|
60
|
+
UL.prototype.a=function(){var a=4;this.flags&RM&&(a+=4);this.flags&SM&&(a+=4);for(var b=0;b<this.h;b++)this.flags&TM&&(a+=4),this.flags&UM&&(a+=4),this.flags&VM&&(a+=4),this.flags&WM&&(a+=4);return a+Z.prototype.a.call(this)};
|
|
61
|
+
UL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&RM&&(a.getPosition(),hL(a,this.l));this.flags&SM&&_.V(a,this.o);for(var b=0;b<this.h;b++)this.flags&TM&&_.V(a,this.w[b]),this.flags&UM&&_.V(a,this.sampleSize[b]),this.flags&VM&&_.V(a,this.B[b]),this.flags&WM&&(0===this.version?_.V(a,this.j[b]):hL(a,this.j[b]));a.getPosition()};var RM=1,SM=4,TM=256,UM=512,VM=1024,WM=2048;_.w(VL,Z);
|
|
62
|
+
VL.prototype.a=function(){var a=4;this.flags&XM&&(a+=8);this.flags&YM&&(a+=4);this.flags&ZM&&(a+=4);this.flags&$M&&(a+=4);this.flags&aN&&(a+=4);return a+Z.prototype.a.call(this)};VL.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);this.flags&XM&&dL(a,this.j);this.flags&YM&&_.V(a,this.B);this.flags&ZM&&_.V(a,this.l);this.flags&$M&&_.V(a,this.w);this.flags&aN&&_.V(a,this.o);a.getPosition()};var XM=1,YM=2,ZM=8,$M=16,aN=32;_.w(WL,kL);_.w(XL,kL);_.w(YL,kL);
|
|
63
|
+
YL.prototype.a=function(){return this.h.byteLength+kL.prototype.a.call(this)};YL.prototype.write=function(a){kL.prototype.write.call(this,a);0<this.h.byteLength&&_.bm(a,this.h)};_.w(ZL,Z);ZL.prototype.a=function(){var a=20;1===this.h&&0===this.j&&(a=a+1+this.l.length);return a+Z.prototype.a.call(this)};
|
|
64
|
+
ZL.prototype.write=function(a){Z.prototype.write.call(this,a);eL(a,0);0===this.version?eL(a,0):eL(a,0);eL(a,this.h);eL(a,this.j);_.bm(a,_.fj(this.o));if(1===this.h&&0===this.j){eL(a,0);for(var b=0;b<this.l.length;b++)eL(a,this.l[b])}a.getPosition()};_.w($L,Z);$L.prototype.a=function(){var a=8;this.flags&1&&(a+=jL(this.Kb).byteLength);return a+Z.prototype.a.call(this)};$L.prototype.write=function(a){Z.prototype.write.call(this,a);_.bm(a,jL(this.h));_.V(a,this.j);this.flags&1&&_.bm(a,jL(this.Kb));a.getPosition()};
|
|
65
|
+
_.w(aM,kL);aM.prototype.a=function(){return jL(this.h).byteLength+kL.prototype.a.call(this)};aM.prototype.write=function(a){kL.prototype.write.call(this,a);_.bm(a,jL(this.h));a.getPosition()};_.w(bM,Z);bM.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
|
|
66
|
+
bM.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));_.V(a,1);for(var b=0;1>b;b++)0===this.version?_.V(a,this.offset[b]):dL(a,this.offset[b]);a.getPosition()};_.w(cM,Z);cM.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);return a+Z.prototype.a.call(this)};
|
|
67
|
+
cM.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));eL(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)eL(a,this.l[b]);a.getPosition()};_.w(dM,Z);dM.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].$g.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].gd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
|
|
68
|
+
dM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&eL(a,this.l);for(var b=0;b<this.j;b++)if(_.bm(a,this.h[b].$g),this.flags&2){gL(a,this.h[b].gd);for(var c=0;c<this.h[b].gd;c++)gL(a,this.h[b].Uf[c].jg),_.V(a,this.h[b].Uf[c].kg)}a.getPosition()};var kM=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,lM=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,mM=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,nM=/^(\d*\.?\d*)f$/,oM=/^(\d*\.?\d*)t$/,pM=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;tM.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};tM.prototype.write=function(){this.f=sM(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var wM=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=CM.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.C=b;var d=_.Ng(new Set([a,eM(a)])).concat();return DM(this,d).then(function(e){return KM(c,e.data).then(function(){PM(c,c.A);return c.h})})};_.r.stop=function(){this.C&&this.C.networkingEngine.Be(this.K);this.A=this.w=this.h=this.f=this.C=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.D=Infinity;return Promise.resolve()};
|
|
69
|
+
_.r.update=function(){var a=this;if(this.sd())return DM(this,[this.l]).then(function(b){return KM(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.C)a.C.onError(b)})};_.r.onExpirationUpdated=function(){};_.r.setCurrentVariant=function(){};_.r.Ib=function(){var a=this;this.g.debug(_.Ly);this.C&&(this.j=null,this.update().then(function(){PM(a,a.A)})["catch"](function(b){a.C&&(a.C.onError(b),1===b.severity&&PM(a,100))}))};_.r.sd=function(){return this.P===GM};
|
|
70
|
+
_.r.rf=function(){return 0<this.o.length};_.r.Pg=function(a){var b=null;if(this.o.length)for(var c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b};
|
|
71
|
+
_.r.im=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.w.timescale,c={isLive:this.sd.bind(this),se:this.rf.bind(this),gk:function(){return 1},le:this.Pg.bind(this)},d=!1,e=new _.P(_.Q,3,4035,null),f=null;try{var g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=yM(a,b,g,c)}catch(h){d=
|
|
72
|
+
!0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};var NM={video:_.tg,audio:_.dd,text:_.Xc},BM=_.mc,GM="LIVE",OM={Im:_.md,Rm:_.Yf};_.w(QM,_.zr);QM.prototype.f=function(){_.ws.ism=CM;_.us[_.Yc]=CM};QM.prototype.a=function(){_.pA("ism");_.qA(_.Yc)};QM.prototype.id=function(){return"smooth"};_.H("clpp.smooth.SmoothComponent",QM);};
|
|
73
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
74
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
75
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
76
|
+
})();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var Tw="No thumbnail duration or URL specified",Uw="No thumbnail found for position ",Vw="Position is out of range: ",Ww="Thumbnail URL is mandatory",Xw="Wrong gridSize format",Yw="clpp.thumbnails",Zw=function(){this.log=new _.K(Yw);this.player=null;this.a=[];this.w=!1},ax=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Se&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return $w(a,0,e,!!f)})},Promise.resolve())},$w=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();
|
|
3
|
+
var e=b+c;return bx(a,d).then(function(){return a.a[b].load()}).then(function(){return $w(a,e,c,d)})},bx=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Io)c();else a.player.one(_.id,function(){c()})})},cx=function(a,b){return b>=a.time&&b<a.time+a.duration},dx=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=
|
|
4
|
+
a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ka=p;this.Fj=h;this.jm=l;this.tk=m;this.uk=n;this.$b=null},ex=function(){Zw.call(this);this.f=null;this.o=this.h=1;this.j=0},fx=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Ld=new _.vj},gx=function(){this.g=new _.K(Yw);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.vj},hx=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Ld.resolve()})},jx=function(a,b){return ix(a,b).then(function(c){return new dx(c,
|
|
5
|
+
b.time,b.duration)})},ix=function(a,b){return b.load().then(function(){var c=_.Ti(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.cj(c)})},kx=function(){Zw.call(this);this.f=null},lx=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},mx=function(){Zw.apply(this,arguments)},nx=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,e.startTime<=b&&(c=e);return c},ox=function(a,b){var c=a.horizontalTiles||
|
|
6
|
+
b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Ed:c,$f:d,Zg:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},px=function(){this.g=new _.K(Yw);this.a=this.m=null},qx=function(a){return a.some(function(b){return 0<b.thumbStreams.length})},rx=function(a){if(!a)return null;a=new _.Wj(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null},sx=function(){};Zw.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Ff,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&ax(c,b.preload)})};dx.prototype.raw=function(){return this.ka.cloneNode(!1)};
|
|
7
|
+
dx.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Xd);e.style.width=c+_.Cf;e.style.height=d+_.Cf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.ka.naturalWidth||this.ka.width))+"px "+Math.ceil(d/
|
|
8
|
+
this.height*(this.ka.naturalHeight||this.ka.height))+_.Cf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Cf;e.style.backgroundPositionY="-"+f*d+_.Cf;return e};
|
|
9
|
+
dx.prototype.load=function(){var a=this;this.$b||(this.$b=new Promise(function(b,c){function d(){a.width||(a.width=(a.ka.naturalWidth||a.ka.width)/a.Fj);a.height||(a.height=(a.ka.naturalHeight||a.ka.height)/a.jm);a.x||(a.x=a.width*a.tk);a.y||(a.y=a.height*a.uk)}if(a.ka.src&&a.ka.complete)d(),b(a);else{var e=null,f=function(){d();a.ka.removeEventListener("load",f);a.ka.removeEventListener(_.me,e);b(a)};e=function(){a.ka.removeEventListener("load",f);a.ka.removeEventListener(_.me,e);c()};a.ka.addEventListener("load",
|
|
10
|
+
f);a.ka.addEventListener(_.me,e);a.ka.src=a.src}}));return this.$b};_.H("clpp.thumbnails.Thumbnail",dx);dx.prototype.load=dx.prototype.load;dx.prototype.element=dx.prototype.element;dx.prototype.raw=dx.prototype.raw;_.w(ex,Zw);
|
|
11
|
+
ex.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(_.Q,7,7100,Ww);if("GRID"===b.mode&&!b.gridSize)throw new _.P(_.Q,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.P(_.Q,7,7100,"Duration is mandatory");this.f=b;var c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(Tw,c,d),new _.P(_.Q,7,7100,Tw);this.j=c;if(this.f.gridSize)try{var e=this.f.gridSize.split(/x/).map(function(f){return parseInt(f,10)}).filter(function(f){return 0<f});if(2===e.length)this.h=e[0],
|
|
12
|
+
this.o=e[1];else throw new _.P(_.Q,7,7100,Xw);}catch(f){throw this.log.error("Error during parsing gridSize",f),new _.P(_.Q,7,7100,Xw);}Zw.prototype.init.call(this,a,b)};ex.prototype.get=function(a){var b=this.player.getDuration();if(void 0===this.f.duration)return Promise.reject("Duration configuration not defined");var c=Math.floor(a/this.f.duration);if(0>a||a>b)return Promise.reject(Vw+a);var d=this.a[c];return d?d.load().then(function(){return d}):Promise.reject(Uw+a+" at index "+c)};
|
|
13
|
+
ex.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new dx(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};fx.prototype.load=function(){return this.Ld};
|
|
14
|
+
gx.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(_.Q,7,7100,Ww);var d=b.url,e=_.qj(d);e.type=_.pj;a.getNetworkEngine().fetch(e).O.then(function(f){f=f.data;var g=_.Ti(c.f);f=_.Ti(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."))}).then(function(){var f=c.f,g=_.Ti(f),
|
|
15
|
+
h=String.fromCharCode.apply(null,tx),l=Array.prototype.slice.call(g,0,8);g=64;var m=0;var n=!1;if(h===String.fromCharCode.apply(null,l))for(f=new DataView(f,16,20),f=f.getUint32(0,!0),0===f&&(f=1E3);!n;){m+=1;l=f;h=new DataView(c.f,g);n=h.getUint32(0,!0);l=n*l/1E3;h=h.getUint32(4,!0);h=new fx(l,h);if(l=c.a.length)l=c.a[l-1],l.length=h.offset-l.offset,l.duration=h.time-l.time;c.a.push(h);g+=8;(n=4294967295===n)&&c.h.resolve();if(1E5<m)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
|
|
16
|
+
}).then(function(){hx(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.P(1,7,2013,"Error while loading and parsing BIF thumbnails.",f))})};gx.prototype.get=function(a){var b=this;return 0>a?Promise.reject(Vw+a):this.h.then(function(){for(var c=0;c<b.a.length;c++){var d=b.a[c];if(cx(d,a))return jx(b,d).then(function(e){return e.load().then(function(){return e})})}return Promise.reject(Uw+a)})};var tx=[137,66,73,70,13,10,26,10];_.w(kx,Zw);
|
|
17
|
+
kx.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(_.Q,7,7100,Ww);var d=b.url,e=_.qj(d);e.type=_.pj;this.f=a.getNetworkEngine().fetch(e).O.then(function(f){if(f=f.data){f=_.R.Z(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=h.indexOf("#");h=0>t?h:h.substr(0,t);h.match(/^http|^\/\//)||(h=d.substr(0,d.lastIndexOf("/"))+"/"+
|
|
18
|
+
h);t=lx(l[0]);l=lx(l[1])-t;c.a.push(new dx(h,t,l,m,p,q,n,0,0))}}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.P(1,7,2013,"Error while loading VTT thumbnails.",f))});Zw.prototype.init.call(this,a,b)};
|
|
19
|
+
kx.prototype.get=function(a){var b=this;return 0>a?Promise.reject(Vw+a):this.f.then(function(){for(var c={},d=0;d<b.a.length;c={kd:c.kd},d++)if(c.kd=b.a[d],cx(c.kd,a))return c.kd.load().then(function(e){return function(){return e.kd}}(c));return Promise.reject(Uw+a)})};kx.prototype.l=function(){return this.f};_.w(mx,Zw);
|
|
20
|
+
mx.prototype.get=function(a){if(0>a)return this.log.error("Position must be greater than 0 but is "+a),Promise.reject();var b=this.player.getPeriods();b=nx(b,a);if(!b)return this.log.error("Could not find period for specified position",a),Promise.reject();var c=b.thumbStreams.sort(this.f)[0];if(!c)return this.log.error("Could not find thumb stream for specified position",a),Promise.reject();b=c.findSegmentPosition(a-b.startTime);if(null===b||void 0===b)return this.log.error("Could not find segment index for specified position",a),
|
|
21
|
+
Promise.reject();var d=c.getSegmentReference(b);if(d){var e=ox(d,c);a=Math.floor((a-d.startTime)/e.durationPerTile);var f;if(0<this.a.length)d=c.findSegmentPosition(0),null!==d&&(f=this.a[(b-d)*e.Zg+a]);else if((c=d.Pa())&&0<c.length){var g=0,h=0;d=d.startTime;1<e.Zg&&(g=a%e.Ed,h=Math.floor(a/e.Ed),d+=a*e.durationPerTile);f=new dx(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ed,e.$f,g,h)}if(f)return f.load().then(function(){return f})}this.log.error("segment reference for specified segment index does not exist",
|
|
22
|
+
b);return Promise.reject()};mx.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
|
|
23
|
+
mx.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=ox(d,b),f=d.Pa()[0],g=new Image,h=d.startTime,l=0;l<e.$f;++l)for(var m=0;m<e.Ed;++m)this.a.push(new dx(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Ed,e.$f,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=px.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
|
|
24
|
+
_.r.onContentWillLoad=function(a){var b=this,c=a.getConfiguration();if(c.thumbnails){var d=c.thumbnails;d&&(void 0===d.enabled||d.enabled)&&((c=d.mode)||(c=rx(d.url||null)),c&&("SINGLE"===c||"GRID"===c?this.a=new ex:"WEBVTT"===c?this.a=new kx:"BIF"===c&&(this.a=new gx)),this.a&&(this.g.info("Loading thumbs configuration",d),this.m.one(_.Ee,function(){b.g.info("Initialize thumbnails provider");b.a.init(a,d)})))}else this.a=null};
|
|
25
|
+
_.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();qx(d)&&(this.a=new mx,this.a.init(a,c))}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject()};_.r.id=function(){return"thumbnails"};_.H("clpp.thumbnails.ThumbnailsPlugin",px);px.prototype.get=px.prototype.get;px.Id="thumbnails";sx.prototype.create=function(){return new px};_.jq(new sx);};
|
|
26
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
27
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
28
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
29
|
+
})();
|
package/cjs/cl.tizen.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var vJ="An unknown error occurred while trying to get volume",wJ="Cannot get loading rendition due to platform limitations",xJ="PARAM_START_POSITION",yJ="SecurityError",zJ="The require privilege is: http://tizen.org/privilege/tv.audio",AJ="|STARTBITRATE\x3d",BJ=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},CJ=function(a,b){this.h=a;this.o=null;this.a=_.Re;this.l=null;this.j=!1;this.f=new Map;this.C=b;this.g=new _.K("clpp.tizen.DrmEngine")},FJ=function(a){var b,
|
|
3
|
+
c,d;return _.E(function(e){if(1==e.a){b=a.a===_.Rd||a.a===_.Pd;if(!b)throw new _.P(_.Q,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Kd)throw new _.P(_.Q,6,6012,"No license server given for "+a.a);_.A(e,2);return a.a===_.Rd?_.x(e,DJ(a),5):_.x(e,EJ(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Kd,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Kf,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
|
|
4
|
+
keyIds:[],periodId:null},_.$g(e,0);d=_.B(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.P(_.Q,6,6005,{message:JSON.stringify(d)});})},EJ=function(a,b){var c,d,e,f;return _.E(function(g){c=GJ;d=HJ;e={};e[d.ai]=!b.Kf;e[d.bi]=b.Kd;""!==b.customData&&(e[d.$h]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.y(g)})},DJ=function(a){var b;return _.E(function(c){b=GJ;try{webapis.avplay.setDrm(b.Xd,
|
|
5
|
+
"Initialize",""),webapis.avplay.setDrm(b.Xd,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Xd,"widevine_data_type",a.l.type)}catch(d){throw d;}_.y(c)})},IJ=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,D,G,F;_.E(function(C){if(1==C.a){c=GJ;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.Kd;l=_.qj([h],_.nj());l.type=3;l.body=f.buffer;l.method=
|
|
6
|
+
"POST";_.A(C,2);return _.x(C,a.C.Hb.fetch(l).O,4)}if(2!=C.a){m=C.f;if(a.j){n=_.Ti(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+xJ+(v+xJ);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.Xd,"widevine_license_data",z)}catch(I){a.g.error("License response rejected by CDM"),D=new _.P(_.Q,6,6008,{browserError:JSON.stringify(I)}),a.C.onError(D)}}return _.$g(C,0)}G=_.B(C);a.g.error("License request failed.",JSON.stringify(G));F=new _.P(_.Q,
|
|
7
|
+
6,6007,{message:_.ab,url:G.data.url,status:G.data.status||NaN,response:G.data.response||"",headers:G.data.headers||{}},G);a.C.onError(F);_.y(C)})},JJ=function(a){this.m=a;this.a=this.m.a;this.f=_.Do;this.j=_.Eo;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.K("clpp.tizen.StateManager")},LJ=function(a,b){if(a.f!==b)if(a.f===_.Oo&&b!==_.Do)a.g.debug(_.Iy+KJ(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Io?(a.o=(new Date).getTime(),a.m.trigger(new _.L(_.jd,{detail:{bufferedTimeMS:-1,
|
|
8
|
+
reason:a.h}}))):a.j===_.Io&&a.m.trigger(new _.L(_.id,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.L(_.Sf,{detail:d}));a.g.debug("State changed:",KJ(a.j),"-\x3e",KJ(a.f))}},KJ=function(a){return Object.keys(_.Mo)[a]},OJ=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case MJ:c=_.Ro;break;case NJ:c=_.Qo;break;default:a.m.isEnded()?c=_.Ko:a.g.debug("Inconsistent AVPlay playback state:",b)}LJ(a,
|
|
9
|
+
c)}},PJ=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.w=!0;this.l=null;this.g=new _.K("clpp.tizen.TextStreamer")},QJ=function(a){if(!a)return!1;a=a.periods;for(var b=!1,c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},RJ=function(a){var b,c;return _.E(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.x(d,_.ts(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},
|
|
10
|
+
SJ=function(a){var b=document.createElement(_.rg),c=new _.xA,d=new _.Gz(function(){return null}),e=a.m.getTextDisplayer();return new _.zA(b,c,e,d,a.m.getConfiguration())},TJ=function(a){var b={Cb:function(){return a.m.getPosition()},X:a.h,Hb:a.m.getNetworkEngine(),Bf:a.xj.bind(a),Af:a.wj.bind(a),onError:a.U.bind(a),qh:function(){},onEvent:function(){},uh:a.yj.bind(a),ze:function(){},hf:function(){return new _.EB},Ue:function(){return!1},xd:null};return new _.zC(a.a,b)},UJ=function(a){var b=a.m.getPosition(),
|
|
11
|
+
c=null;a=_.u(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},VJ=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Nj(String(c++),_.S);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
|
|
12
|
+
a[d].kind||_.bz;var f=new _.Vj(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},WJ=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.CC(a.f,_.ag),c=null;if(b){a=VJ(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},XJ=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.a&&a.f)){a.setTextVisibility(!0);var c=UJ(a),
|
|
13
|
+
d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)==d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(_.NC(a.f,c,!0,0),a.m.trigger(new _.L(_.ml))),a.o=c.language):a.g.error(_.Hy,d.id)}},YJ=function(){this.h=this.a=this.m=null;this.f={};this.g=new _.K("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.A=!1;this.o=1},ZJ=function(a,b){a.m.trigger(new _.L(_.vg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},
|
|
14
|
+
$J=function(a){var b=a.ha();b&&a.m.trigger(new _.L(_.gd,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},aK=function(a){var b=a.m.getConfiguration(),c=_.Sh(b.preferredAudioLanguage||[]),d=a.f[_.T]||[];if(d.length){var e=null;c.some(function(g){e=_.uz(g,d.map(function(h){return h.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),
|
|
15
|
+
0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.ya(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},eK=function(a,b){if(b){var c=b.track.type.toUpperCase();bK(a.a,c,Number(b.id)).then(function(){c===cK&&(a.j=b,a.m.trigger(new _.L(_.ll)));c===dK&&(a.l=b,a.m.trigger(new _.L(_.ml)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},fK=
|
|
16
|
+
function(a,b,c){var d=_.Mi(b.language||_.gg);c.language=_.Oj(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.dd;a=new _.Vj(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},gK=function(a,b,c){c.mimeType=_.tg;a=new _.Vj(String(a),c);a.track=c;a.width=b.Width||null;a.height=b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):null;a.codec=b.fourCC||null;return a},hK=function(a,b,c){b=_.Mi(b.track_lang||_.gg);c.mimeType="text/ttml";
|
|
17
|
+
c.language=_.Oj(b);c.originalLanguage=b;c.kind=_.bz;return new _.Vj(String(a),c)},iK=function(a,b){var c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},lK=function(a,b){function c(n,p){for(var q=0;q<n.length;q++)if(n[q].language===p)return n[q];return null}var d={};if(0>=b.length)return d;for(var e=b.filter(function(n){return n.type===jK}),f=b.filter(function(n){return n.type===cK}),g=[],h=0;h<f.length;h++){var l=iK(a,f[h].extra_info);if(l){var m=
|
|
18
|
+
_.Mi(l.language||_.gg);m=_.Oj(m);m=c(g,m);m||(m=new _.Nj(String(a.o++),_.T),g.push(m));m.renditions.push(fK(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Nj(String(a.o++),_.Pj);for(h=0;h<e.length;h++)(l=iK(a,e[h].extra_info))?f.renditions.push(gK(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.h?VJ(a.h):kK(a,b);d[_.Pj]=[f];d[_.T]=g;d[_.S]=e;return d},kK=function(a,b){for(var c=b.filter(function(h){return h.type===dK}),d=[],e=0;e<
|
|
19
|
+
c.length;e++){var f=iK(a,c[e].extra_info);if(f){var g=new _.Nj(String(a.o++),_.S);g.renditions.push(hK(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},mK=function(a,b){for(var c=a.f[_.Pj]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.N.ra(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},nK=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===
|
|
20
|
+
b){c=a[d].renditions[e];break}return c},pK=function(a,b){if(b===_.S&&a.h)return WJ(a.h);var c=oK(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Pj&&(d=iK(a,c.extra_info),d=mK(a,{width:d.Width,height:d.Height}));b===_.T&&(c?(d=nK(a,c,_.T),a.j=d):d=a.j);b===_.S&&(c?(d=nK(a,c,_.S),a.l=d):d=a.l);return d},qK=function(a){_.sl.call(this);this.m=a;this.h=null;this.g=new _.K("clpp.tizen.Middleware");this.D=1;this.B=!1;this.l=null;this.G=0;
|
|
21
|
+
this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},rK=function(a){return _.E(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.y(b)})},tK=function(a){try{webapis.avplay.setListener({onbufferingstart:a.rj.bind(a),onbufferingprogress:a.qj.bind(a),onbufferingcomplete:a.pj.bind(a),onstreamcompleted:a.uj.bind(a),oncurrentplaytime:function(b){a.trigger(new _.L(sK,
|
|
22
|
+
{currentTime:b}))},onevent:a.tj.bind(a),onsubtitlechange:a.vj.bind(a),ondrmevent:a.sj.bind(a),onerror:a.U.bind(a)})}catch(b){a.g.error(b)}},uK=function(a){var b=!!a.m.getTrackManager().Oa();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},vK=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,gn:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",AJ+d)}catch(e){a.g.debug(e)}},
|
|
23
|
+
wK=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+AJ+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},zK=function(a){return{position:a.getPosition(),state:a.m.getState(),ig:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:xK(a),volume:a.getVolume(),ym:yK(a),Mj:oK(a)}},BK=function(a){var b,c;return _.E(function(d){if(1==d.a)return _.x(d,AK(),2);if(3!=d.a)return b=new Promise(function(e){(new _.tk(e)).aa(5)}),
|
|
24
|
+
_.x(d,Promise.race([rK(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),d["return"](Promise.reject("SDK Timeout"));_.y(d)})},HK=function(a,b,c){var d,e,f,g,h,l,m,n;return _.E(function(p){switch(p.a){case 1:a.l=_.Vo(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.L(CK)),f=c.currentPosition);
|
|
25
|
+
_.A(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Tc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(wK(a,e.nextBandwidth),a.o=!1):(a.o||vK(a,e),a.o=!0);tK(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.F(4);break}m={onError:function(q){return a.m.onError(q)},Hb:a.m.getNetworkEngine()};a.h=new CJ(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.L(DK)),
|
|
26
|
+
_.x(p,EK(a),6);case 6:a.f||a.trigger(new _.L(FK));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&GK(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.$g(p,0);break;case 2:throw n=_.B(p),a.g.debug("Error while attempting to load source."),n;}})},EK=function(a){return _.E(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");
|
|
27
|
+
uK(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},IK=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=zK(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.ig;a.f=!1;a.a=
|
|
28
|
+
null;return e===NJ?a.pause():a.play()})}catch(e){return Promise.reject(e)}},yK=function(a){return a.f&&a.a?a.a.ym:webapis.avplay.getTotalTrackInfo()},oK=function(a){return a.f&&a.a?a.a.Mj:webapis.avplay.getCurrentStreamInfo()},bK=function(a,b,c){b=b.toUpperCase();b===dK&&JK(a,!0);var d=a.j[b];d&&(d.De.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
|
|
29
|
+
h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,fg:0,De:new _.tk(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.fg?(!a.w&&++l.fg,l.De.aa(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.De.stop(),a.j[h]=null,f())}}g(b,c)})},JK=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",
|
|
30
|
+
d)}},GK=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case yJ:a.g.warn("The application does not have the privilege to set mute.",zJ);break;default:a.g.warn(vJ,c)}}},xK=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case yJ:a.g.warn("The application doesn't have the privilege to get the mute state.",zJ);break;default:a.g.warn(vJ,c)}}return!!b},AK=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
|
|
31
|
+
BJ(c,"load",function(d){return a(d)});BJ(c,_.me,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},KK=function(){_.sl.call(this);this.a=new qK(this);this.f=new JJ(this);this.configuration=this.B=_.yl();this.w=null;this.g=new _.K("clpp.tizen.Player");this.j=null;this.l=new YJ;this.D=new _.Hj;this.o=this.h=null;this.A=!1},LK=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*
|
|
32
|
+
a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},MK=function(){},NK=function(){};
|
|
33
|
+
CJ.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.E(function(h){if(1==h.a){b=_.Tl[a.h.env]||null;if(!b)throw a.g.debug(_.Aa,_.Mb+a.h.env+_.ca),new _.P(_.Q,6,6015,_.Ba+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.Vl(b,a.h.customData);(e=d[_.Pd])&&a.f.set(_.Pd,{Kd:e.licenseUrl||"",customData:c,Kf:!1});(f=d[_.Rd])&&a.f.set(_.Rd,{Kd:f.licenseUrl||"",customData:c,
|
|
34
|
+
Kf:!1});if(0===a.f.size)throw new _.P(_.Q,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Pd))a.a=_.Pd;else if(a.f.get(_.Rd))a.a=_.Rd;else throw new _.P(_.Q,6,6001,"Configuration for the target system is missing.");return _.x(h,FJ(a),2)}a.j=!0;_.y(h)})};CJ.prototype.release=function(){var a=this;return _.E(function(b){a.j=!1;a.o=null;a.a=_.Re;a.l=null;a.f=new Map;_.y(b)})};CJ.prototype.getDrmInfo=function(){return this.o};
|
|
35
|
+
var HJ={ai:"DeleteLicenseAfterUse",bi:"LicenseServer",Nm:"GetChallenge",Om:"HttpHeader",Sm:"UserAgent",Jm:"Cookie",$h:"CustomData"};_.r=JJ.prototype;_.r.initialize=function(){this.a.on(CK,this.wg,this);this.a.on(OK,this.vg,this);this.a.on(PK,this.ug,this);this.a.on(DK,this.xh,this);this.a.on(FK,this.wh,this);this.a.on(QK,this.xg,this)};_.r.release=function(){LJ(this,_.Do);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(CK,this.wg);this.a.off(OK,this.vg);this.a.off(PK,this.ug);this.a.off(DK,this.xh);this.a.off(FK,this.wh);this.a.off(QK,this.xg);this.m=this.a=null};
|
|
36
|
+
_.r.wg=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;LJ(this,_.Io)};_.r.vg=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",KJ(this.f))};_.r.ug=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===RK;if(!a&&b){LJ(this,_.Qo);return}}if(a=this.f!==_.Po)a=this.a.getState(),a=a===MJ||a===NJ;a&&OJ(this)};
|
|
37
|
+
_.r.xh=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===SK?LJ(this,_.Po):this.g.error("AVPlay prepares while state is not IDLE")};_.r.wh=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.xg=function(){LJ(this,_.Ko)};_.r.getState=function(){return this.f};_.r=PJ.prototype;_.r.initialize=function(a){this.m=a};
|
|
38
|
+
_.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.E(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.x(m,RJ(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:function(){},filterAllPeriods:function(){},onTimelineCueAdded:function(){},onEvent:function(){},
|
|
39
|
+
onError:function(){}};_.A(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.$g(m,4);break;case 3:return f=_.B(m),b.g.warn(f),_.A(m,6),g=b,_.x(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.$g(m,4);break;case 6:h=_.B(m),b.g.error(h),b.a=null;case 4:if(!b.a||!QJ(b.a)){m.F(0);break}b.h=SJ(b);_.A(m,10);return _.x(m,b.h.I,12);case 12:b.f=TJ(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;_.$g(m,0);break;case 10:_.B(m),
|
|
40
|
+
b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.y(m)}})};_.r.xj=function(a){this.g.debug(_.Wy,a);this.w=!0;var b=_.hB(a.textStreams,this.o||"",this.A||"")[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}};_.r.wj=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.NC(this.f,this.l,!0,0),this.l=null)};_.r.U=function(){this.g.debug("onError_")};_.r.yj=function(){this.j&&this.j.update&&this.j.update()};
|
|
41
|
+
_.r.start=function(){var a=this;return _.E(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.y(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.r.release=function(){var a=this;return _.E(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.y(b)})};
|
|
42
|
+
_.r.destroy=function(){var a=this;return _.E(function(b){switch(b.a){case 1:if(!a.j){b.F(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.F(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.F(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.y(b)}})};_.w(YJ,_.U);_.r=YJ.prototype;_.r.mh=function(a){var b=a.eventid;a=a.data;switch(b){case TK:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+iK(this,b[0].extra_info).Bit_rate,b=mK(this,{bandwidth:b}))&&(this.w=b,ZJ(this,b));break;case UK:$J(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.Ef=function(a){a.detail.currentState===_.Ro&&this.m.off(_.Sf,this.Ef)};
|
|
43
|
+
_.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.Sf,function(c){b.A||(c=c.detail,c.currentState===_.Ro&&(b.g.debug("Current state",c.currentState),b.A=!0,aK(b)))});this.a.on(VK,this.mh,this)};_.r.release=function(){this.f={};this.h=this.w=this.l=this.j=null;this.A=!1;this.o=1};
|
|
44
|
+
_.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.h=this.m.h;this.m.off(_.Sf,this.Ef);this.m.on(_.Sf,this.Ef,this);try{var a=yK(this.a);this.f=lK(this,a);var b=this.f[_.T]||[];b.length&&(this.j=b[0].renditions[0]||null);$J(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off(VK,this.mh);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Pj]||[]};_.r.getAudioTracks=function(){return this.f[_.T]||[]};
|
|
45
|
+
_.r.ja=function(){return this.f[_.S]||[]};_.r.ha=function(){return pK(this,_.Pj)};_.r.Ma=function(){return pK(this,_.T)};_.r.Oa=function(){return pK(this,_.S)};_.r.ab=function(){return this.w};_.r.kb=function(){this.g.info(wJ);return null};_.r.lb=function(){this.g.info(wJ);return null};_.r.Qa=function(){var a=this.ha();return a?a.track:null};_.r.sa=function(){var a=this.Ma();return a?a.track:null};_.r.ta=function(){var a=this.Oa();return a?a.track:null};
|
|
46
|
+
_.r.gb=function(a){var b=this;null===a?(a=this.ha(),IK(this.a,a.bandwidth,null).then(function(){$J(b)})):0<a.renditions.length&&this.fb(a.renditions[0])};_.r.ya=function(a){a?eK(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.Ia=function(a){a?(a=a.renditions[0],this.h?XJ(this.h,a.track):eK(this,a)):(this.g.debug("Disabling text tracks"),this.l=null,JK(this.a,!1),this.m.trigger(new _.L(_.ml)))};
|
|
47
|
+
_.r.fb=function(a){var b=this,c=this.ha();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,ZJ(this,a),IK(this.a,c.bandwidth,a.bandwidth).then(function(){$J(b)})["catch"](function(d){var e=new _.P(_.Q,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.r.rb=function(a){eK(this,a)};_.r.sb=function(a){this.h?XJ(this.h,a.track):eK(this,a)};
|
|
48
|
+
_.r.addTextTrack=function(){};_.r.la=function(){return this.a.o};YJ.prototype.isAbrEnabled=YJ.prototype.la;YJ.prototype.addTextTrack=YJ.prototype.addTextTrack;YJ.prototype.setTextRendition=YJ.prototype.sb;YJ.prototype.setAudioRendition=YJ.prototype.rb;YJ.prototype.setVideoRendition=YJ.prototype.fb;YJ.prototype.setTextTrack=YJ.prototype.Ia;YJ.prototype.setAudioTrack=YJ.prototype.ya;YJ.prototype.setVideoTrack=YJ.prototype.gb;YJ.prototype.getTextTrack=YJ.prototype.ta;YJ.prototype.getAudioTrack=YJ.prototype.sa;
|
|
49
|
+
YJ.prototype.getVideoTrack=YJ.prototype.Qa;YJ.prototype.getLoadingTextRendition=YJ.prototype.lb;YJ.prototype.getLoadingAudioRendition=YJ.prototype.kb;YJ.prototype.getLoadingVideoRendition=YJ.prototype.ab;YJ.prototype.getTextRendition=YJ.prototype.Oa;YJ.prototype.getAudioRendition=YJ.prototype.Ma;YJ.prototype.getVideoRendition=YJ.prototype.ha;YJ.prototype.getTextTracks=YJ.prototype.ja;YJ.prototype.getAudioTracks=YJ.prototype.getAudioTracks;YJ.prototype.getVideoTracks=YJ.prototype.getVideoTracks;_.w(qK,_.sl);_.r=qK.prototype;_.r.rj=function(){this.w=!0;this.f||this.trigger(new _.L(CK))};_.r.qj=function(a){this.w=!0;this.trigger(new _.L(OK,{percent:a}))};_.r.pj=function(){this.w=!1;this.trigger(new _.L(PK))};_.r.uj=function(){this.trigger(new _.L(QK))};_.r.tj=function(a,b){this.trigger(new _.L(VK,{eventid:a,data:b}))};_.r.vj=function(a,b,c,d,e){this.trigger(new _.L(WK,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
|
|
50
|
+
_.r.sj=function(a,b){this.trigger(new _.L(XK,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Rd&&"Challenge"===b.name)IJ(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.P(_.Q,6,6005,{message:JSON.stringify(b)});c.C.onError(d)}}};_.r.U=function(a){this.trigger(new _.L(YK,{eventType:a}))};
|
|
51
|
+
_.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(sK,f,b);g=setTimeout(function(){b.off(sK,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===SK)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){uK(b);d(webapis.avplay.play())},function(f){b.trigger(new _.L(YK));e(f)})})).then(function(){return a()});if(c===NJ||c===RK)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===MJ?
|
|
52
|
+
Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===NJ?Promise.resolve():Promise.reject()};
|
|
53
|
+
_.r.setPlaybackRate=function(a){var b=this.getState();if(b===RK||b===MJ||b===NJ){try{webapis.avplay.setSpeed(a),this.D=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.D)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.D};
|
|
54
|
+
_.r.load=function(a,b){var c=this,d;return _.E(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.A(e,2),_.x(e,BK(c),4);case 4:return _.x(e,HK(c,a,b),5);case 5:_.$g(e,0);break;case 2:throw d=_.B(e),new _.P(_.Q,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.ig;try{return webapis.avplay.getState()}catch(a){this.U(JSON.stringify(a))}};
|
|
55
|
+
_.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.L(_.mg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.L(_.lg));d()},function(){b.B=!1;e()})})};_.r.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.U(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.U(JSON.stringify(a))}};
|
|
56
|
+
_.r.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.De.stop()}a.j={};a.D=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case yJ:this.g.debug("The application does not have the privilege to get the volume.",zJ);break;default:this.g.debug(vJ,b)}}return a};
|
|
57
|
+
_.r.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case yJ:this.g.warn("The application does not have the privilege to set the volume.",zJ);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
|
|
58
|
+
_.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.U(JSON.stringify(a))}};_.r.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.r.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.r.setSourceIndex=function(a){this.G=a};_.r.getSourceIndex=function(){return this.G};_.r.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
|
|
59
|
+
var SK="IDLE",RK="READY",MJ="PLAYING",NJ="PAUSED",jK=_.lc,cK="AUDIO",dK="TEXT",UK="PLAYER_MSG_RESOLUTION_CHANGED",TK="PLAYER_MSG_BITRATE_CHANGE",GJ={PLAYREADY:"PLAYREADY",Km:"EME_PLAYREADY",Tm:"VERIMATRIX",Xd:"WIDEVINE_CDM",Lm:"EME_WIDEVINE_CDM",Vm:"WIDEVINE_CLASSIC"};_.w(KK,_.sl);_.r=KK.prototype;_.r.sg=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.L(_.le));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.qg=function(a){this.trigger(new _.L(_.dg,{currentTime:a.currentTime/1E3}))};
|
|
60
|
+
_.r.tg=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.Tf(d))&&this.o.append([new _.ci(b,c,d)],[])};_.r.rg=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.oh=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
|
|
61
|
+
_.r.U=function(a){this.g.debug("Error: TYPE: "+a.eventType);LJ(this.f,_.Oo);a=new _.P(_.Q,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.L(_.me,{detail:a}))};
|
|
62
|
+
_.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(QK,this.sg,this);this.a.on(sK,this.qg,this);this.a.on(WK,this.tg,this);this.a.on(XK,this.rg,this);this.a.on(YK,this.U,this);this.a.on(PK,this.oh,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=ZK;ZK+=1;this.j=_.mp(_.Se,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
|
|
63
|
+
var e=[_.Gg,_.pe,"position",_.xe,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.u(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.op(c,f);LK(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};
|
|
64
|
+
_.r.destroy=function(){var a=this;return _.E(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(QK,a.sg);a.a.off(sK,a.qg);a.a.off(WK,a.tg);a.a.off(XK,a.rg);a.a.off(YK,a.U);a.a.off(PK,a.oh);if(!a.h){b.F(3);break}return _.x(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.y(b)}})};_.r.namespace=function(){return $K};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
|
|
65
|
+
_.r.setDrmCustomDataModifier=function(){};_.r.setCdnErrorCallback=function(){};_.r.detach=function(){};_.r.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.r.getPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.Ko?this.getDuration():this.a.getPosition()||0};_.r.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};_.r.getPresentationStartTime=function(){return null};
|
|
66
|
+
_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.r.setVolume=function(a){this.a.setVolume(a)};_.r.getDuration=function(){return this.a.getDuration()};_.r.getBufferInfo=function(){this.g.warn(_.va);return new _.rl};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
|
|
67
|
+
_.r.release=function(){var a=this;return _.E(function(b){switch(b.a){case 1:if(!a.h){b.F(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.F(4);break}return _.x(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.x(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.y(b)}})};
|
|
68
|
+
_.r.load=function(a){var b=this,c,d,e,f,g;return _.E(function(h){switch(h.a){case 1:_.Bl(a)&&(b.configuration=_.Al(b.B,a));c=_.ro(b.configuration,[_.re,"native"]);b.o=c.create(b);d=_.Vo(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new PJ;b.h.initialize(b);_.A(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.$g(h,2);break;case 3:f=_.B(h),b.g.error(f);case 2:return _.A(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.$g(h,7);break;
|
|
69
|
+
case 6:throw g=_.B(h),b.onError(g),g;case 7:b.l.load(),_.y(h)}})};_.r.play=function(){var a=this;this.trigger(new _.L(_.ff));LK(this);return this.a.play().then(function(){OJ(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){OJ(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.L(_.me,{detail:a});a.severity===_.Q&&(LJ(this.f,_.Oo),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
|
|
70
|
+
_.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return this.f.getState()===_.Ko};_.r.isPaused=function(){return this.a.getState()===NJ};_.r.isMuted=function(){return xK(this.a)};_.r.setMuted=function(a){GK(this.a,a)};_.r.getNetworkEngine=function(){return this.D};_.r.setNetworkEngine=function(a){this.D=a};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};_.r.getSourceIndex=function(){return this.a.getSourceIndex()};
|
|
71
|
+
_.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new MK).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};KK.prototype.getTextDisplayer=KK.prototype.getTextDisplayer;KK.prototype.setNetworkEngine=KK.prototype.setNetworkEngine;KK.prototype.getNetworkEngine=KK.prototype.getNetworkEngine;var $K="clpp.tizen",ZK=0;MK.prototype.a=function(){return $K};
|
|
72
|
+
MK.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Tc||a===_.bl||a===_.Yc)&&b){if(_.Cj(2))return 2;if(_.Cj(3)||_.Cj(4)||_.Cj(5)||_.Cj(6))return _.J("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};MK.prototype.create=function(){return new KK};_.w(NK,_.zr);NK.prototype.f=function(){_.yh(new MK)};NK.prototype.a=function(){var a=$K;a&&_.wh[a]&&(delete _.wh[a],_.xh.info("Removed Player factory: '"+a+"'"))};NK.prototype.id=function(){return"tizen"};_.H("clpp.tizen.TizenComponent",NK);var CK="onbufferingstart",OK="onbufferingprogress",PK="onbufferingcomplete",QK="onstreamcompleted",sK="oncurrentplaytime",VK="onevent",WK="onsubtitlechange",XK="ondrmevent",YK="onerror",DK="preparingstart",FK="preparingend";};
|
|
73
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
74
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
75
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
76
|
+
})();
|
package/cjs/cl.ttml.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var Hv='application/mp4; codecs\x3d"stpp.ttml"',Iv='application/mp4; codecs\x3d"stpp.ttml.im1i"',Jv='application/mp4; codecs\x3d"stpp.ttml.im1t"',Kv="backgroundColor",Lv="direction",Mv="displayAlign",Nv="region",Ov="sans-serif",Pv="textAlign",Qv="textDecoration",Rv="writingMode",Sv=function(a,b,c){this.h=a;this.f=b;this.a=c},Tv=function(a,b,c){Sv.call(this,a,[],c);this.j=b||""},Uv=function(a,b,c){Sv.call(this,a,b,c)},Vv=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(c in
|
|
3
|
+
e.a)return e.getAttribute(c)}return null},cw=function(a,b){var c=null;if(Wv.test(a)){c=Wv.exec(a);var d=Number(c[1]),e=Number(c[2]),f=Number(c[3]),g=Number(c[4]);g+=(Number(c[5])||0)/b.f;f+=g/b.frameRate;c=f+60*e+3600*d}else Xv.test(a)?c=Yv(Xv,a):Zv.test(a)?c=Yv(Zv,a):$v.test(a)?(c=$v.exec(a),c=Number(c[1])/b.frameRate):aw.test(a)?(c=aw.exec(a),c=Number(c[1])/b.a):bw.test(a)&&(c=Yv(bw,a));return c},Yv=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||
|
|
4
|
+
0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},dw=function(a){return a.split(":").pop()},ew=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},gw=function(a,b){for(;fw.test(a);){var c=fw.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},hw=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},iw=function(a,b,c,d,e,f,g){Sv.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},jw=function(a,b,c){a=Vv(a,b,Pv);if(!a&&c&&(a=Vv(c,b,Pv),!a&&"rltb"===Vv(c,
|
|
5
|
+
b,Rv)))return _.Jf;switch(a){case _.sd:return _.Yh;case _.Jf:case _.ke:return _.Jf;default:return _.xe}},kw=function(a,b,c){if(_.R.we(a.w))return document.createTextNode(_.R.Tf(a.w||""));if(a.A)return _.mp("br");for(var d=_.mp("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.np(d,f.value);a=_.u(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(kw(c.get(e.value),b,c));return d},lw=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*
|
|
6
|
+
this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},mw=function(a,b,c){Sv.call(this,a,b,c)},pw=function(a,b,c,d){var e=nw.exec(a);a=ow.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},qw=function(a,b){return typeof b===_.k&&0<b?_.di:ow.test(a)?0:_.di},rw=function(a,b){Sv.call(this,"root-container",[],b);this.j=a},sw=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},tw=function(a,b){var c=a.getAttribute("extent");
|
|
7
|
+
return(c=ow.exec(c))?Number(c[b]):null},vw=function(a){a=a.getAttribute("cellResolution");return(a=uw.exec(a))?Number(a[2]):null},ww=function(a,b,c){Sv.call(this,a,b,c)},xw=function(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]},zw=function(a){return yw.some(function(b){return b in a.attributes})},Aw=function(a,b){if(0===b.length)return[];for(var c=[],d=_.u(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.Ng(Aw(a,
|
|
8
|
+
a.a.get(e).f)).concat([e]));return c},Cw=function(){return"inline-"+Bw++},Dw=function(a){this.a=a.firstChild;this.f=new Set},Ew=function(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f},Fw=function(a){return dw(a.h.nodeName)},Gw=function(){this.a=new Map},Iw=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=_.Ng(l.l).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.Ng(l.f).concat(),
|
|
9
|
+
g={},Hw.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Nv)&&(c=b.getAttribute(Nv));b.hasAttribute(_.Xf)&&f.push.apply(f,_.Ng(b.getAttribute(_.Xf).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.u(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=dw(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new Ew(b,c,d,e,f,g);a.a.set(b,c);return c},Jw=function(a){this.a=a;this.f=new DOMParser},Kw=function(a){this.f=
|
|
10
|
+
a},Lw=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Mw=function(){},Nw=function(a){this.a=new Jw(a);this.g=new _.K("clpp.ttml.Mp4TtmlParser")},Ow=function(){this.j=new Mw};Sv.prototype.getId=function(){return this.h};Sv.prototype.getAttribute=function(a){return this.a[a]};_.w(Tv,Sv);_.w(Uv,Sv);var Wv=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Xv=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Zv=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,$v=/^(\d*(?:\.\d*)?)f$/,aw=/^(\d*(?:\.\d*)?)t$/,bw=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,nw=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,ow=/^(\d+)px (\d+)px$/,uw=/^(\d+) (\d+)$/,fw=/(\d+)px/,Pw=/^(\d+px|\d+em|\d*\.?\d+c)$/,yw=[Kv,"color",Lv,Mv,"fontFamily","fontSize","fontStyle","fontWeight",
|
|
11
|
+
"lineHeight","opacity","padding",Pv,Qv,"textOutline",Rv,"zIndex"],Hw=["begin",_.ke];_.w(iw,Uv);
|
|
12
|
+
iw.prototype.build=function(a,b,c,d,e,f,g){var h=cw(this.a.begin,b);b=cw(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.mp(_.Xd);for(var l=_.u(this.j),m=l.next();!m.done;m=l.next())c.appendChild(kw(g.get(m.value),e,g));g=new _.ci(h,b,c.innerHTML.trim(),_.fg);g.cssClassList=_.Ng(this.f).concat();g.textAlign=jw(this,e,null);g.writingMode=_.Zh;g.line=-1;g.lineInterpretation=_.$h;g.lineAlign=_.ai;g.containerRows=sw(null,vw(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
|
|
13
|
+
jw(this,e,f);a:switch(Vv(f,e,Rv)){case "tb":case "tblr":a=_.pg;break a;case "tbrl":a=_.qg;break a;default:a=_.Zh}g.writingMode=a;a:switch(Vv(f,e,Mv)){case _.sd:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Vv(f,e,Mv)){case _.sd:a=1;break a;default:a=_.$h}g.lineInterpretation=a;a:switch(Vv(f,e,Mv)){case _.sd:e=_.sd;break a;default:e=_.ai}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
|
|
14
|
+
g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(mw,Uv);
|
|
15
|
+
mw.prototype.build=function(a,b){var c=new _.fi;c.id=this.getId();var d=sw(a.j.containerWidth,tw(a,1),720),e=sw(a.j.containerHeight,tw(a,2),480);a:switch(Vv(this,b,Mv)){case "after":var f="flex-start";break a;case _.sd:f=_.sd;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Vv(this,b,Rv)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Kd}c.writingMode=f;f=this.getAttribute("extent")||Vv(this,b,"extent");c.width=pw(f,d,1,100);c.widthUnits=qw(f,d);c.height=
|
|
16
|
+
pw(f,e,2,100);c.heightUnits=qw(f,e);f=this.getAttribute("origin")||Vv(this,b,"origin");c.viewportAnchorX=pw(f,d,1,0);c.viewportAnchorY=pw(f,e,2,0);c.viewportAnchorUnits=qw(f,d);c.cssClassList=_.Ng(this.f).concat();return c};_.w(rw,Sv);_.w(ww,Sv);
|
|
17
|
+
ww.prototype.build=function(a){var b=null;var c=vw(a);c&&(b=sw(a.j.containerHeight,tw(a,2),480)/c);b=sw(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.u(Qw.entries()),e=d.next();!e.done;e=d.next()){var f=_.u(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+ew(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
|
|
18
|
+
e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Pw.test(g)&&Pw.test(h)&&Pw.test(l)?(e=g,f=h):2===d.length&&!Pw.test(g)&&Pw.test(h)?(e=g,f=h):2===d.length&&Pw.test(g)&&Pw.test(h)&&(f=g);if(""!==f){f=ew(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c+=d;"textShadow"in this.a?(d=hw(this.a.textShadow),d=ew(d),d="text-shadow:"+
|
|
19
|
+
d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Ov).replace("proportionalSerif",Ov).replace("sansSerif",Ov).replace("default",Ov)+";":"");a:{if(Qv in this.a){d=[];e=_.u(this.a.textDecoration.split(" "));for(f=e.next();!f.done;f=e.next())switch(f=f.value,f){case "underline":case "overline":d.push(f);break;case "lineThrough":d.push("line-through")}if(0<d.length){d=
|
|
20
|
+
"text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+ew(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=ew(e),e=gw(e,b),d=d+"line-height:"+e+";"):d="";a.push(c+d+"}");a:{if("fontSize"in this.a&&(c=this.a.fontSize.split(" "),d=null,1===c.length&&(d=c[0]),2===c.length&&(d=c[1]),d)){d=d.trim();d=ew(d);d=gw(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
|
|
21
|
+
c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var Qw=new Map([[Kv,"background-color"],["color","color"],[Lv,Lv],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);xw.prototype.Cd=function(){var a=this;return this.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})};var Bw=0;Dw.prototype.Yc=function(){return!!this.a};Dw.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Rw.has(dw(a.nodeName))||Sw.has(dw(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Rw.has(dw(a.nodeName))));var b=this.a;this.a=a;return b};
|
|
22
|
+
var Rw=new Set(["tt","head","layout",_.Ke,_.se,Nv,"styling",_.Xf,"body",_.Xd,"p","span","br"]),Sw=new Set([_.Xf,_.se]);Ew.prototype.getId=function(){return this.attributes.id};Jw.prototype.parseInit=function(){};
|
|
23
|
+
Jw.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.N.Va(this.a.ttml||{}),e=_.Ti(a,0,c[0]);e=_.R.Z(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.cg)}catch(n){throw new _.P(_.Q,2,2005,"Failed to parse TTML.");}d=new xw(d);e=new Gw;f=new Dw(f);b=b.periodStart;typeof b===_.k&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.Ti(a,b,h);l=_.cj(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Tv(m,l,{imageType:"PNG",encoding:"Base64"}));
|
|
24
|
+
b+=h}for(;f.Yc();)a=f.next(),a=Iw(e,a),"tt"===Fw(a)&&(d.l=new rw(d.B,Object.assign({},a.attributes))),"tt"===Fw(a)&&(d.w=new lw(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Fw(a)!==_.se||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Tv(c,a.h.textContent,a.attributes))),Fw(a)===_.se&&a.attributes.begin&&a.attributes.end?(c="#"+Cw(),b=new Tv(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
|
|
25
|
+
Fw(a)===_.Xf&&(c=a.getId()||Cw(),b=new ww(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Fw(a)!==_.Xf&&zw(a)?(c=Cw(),b=new ww(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Fw(a)!==_.Xd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Cw(),b=new mw(c,Aw(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Fw(a)!==Nv?c=null:(c=a.getId(),b=new mw(c,Aw(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
|
|
26
|
+
c=b),c&&(a.a=c.getId()),c=a.l,-1===["#text","span","br"].indexOf(Fw(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Cw(),b=new iw(c,"#text"===a.h.nodeName?a.h.textContent:null,"br"===Fw(a),a.a,a.j,Aw(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.j.push(c),c=b):c=null),c&&a.l.push(c.getId()),"p"===Fw(a)||a.j?(c=Cw(),b=new iw(c,null,!1,a.a,a.j,Aw(d,a.f),a.attributes),d.f.set(c,b),d.o.push(b),c=b):c=null,c&&a.l.push(c.getId());e=d.Cd();f=[];a=_.u(d.a.values());for(c=a.next();!c.done;c=
|
|
27
|
+
a.next())f.push.apply(f,_.Ng(c.value.build(d.l)));return{cues:e,styles:f}};Kw.prototype.a=function(a){a=(new Jw(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Lw(c.startTime)+" --\x3e "+Lw(c.endTime),e=[];switch(c.textAlign){case _.xe:e.push("align:left");break;case _.Jf:e.push("align:right");break;case _.Yh:e.push("align:middle");break;case _.xe:e.push("align:start");break;case _.Jf:e.push("align:end")}switch(c.writingMode){case _.pg:e.push("vertical:lr");break;
|
|
28
|
+
case _.qg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.Ta(b)};Mw.prototype.probe=function(a,b){return a===_.Xc&&b===_.bg};Mw.prototype.create=function(a){return new Kw(a)};Nw.prototype.parseInit=function(a){var b=!1;(new _.lm).L(_.Ne,_.mm).L(_.eg,_.mm).L(_.Ie,_.mm).L(_.Me,_.mm).L(_.Uf,_.mm).Y(_.Wf,_.nm).L("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.P(_.Q,2,2007);};
|
|
29
|
+
Nw.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.lm).L("moof",_.mm).L("traf",_.mm).Y("subs",function(h){for(var l=_.W(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.gm(h.reader),p=0;p<n;++p){var q=1===h.version?_.W(h.reader):_.gm(h.reader);g.push(q);h.reader.skip(6)}}}).L(_.He,_.om(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.w(Ow,_.zr);Ow.prototype.f=function(){_.Us[_.Xc]=Jw;_.Us[_.Vc]=Nw;_.Us[Hv]=Nw;_.Us[Jv]=Nw;_.Us[Iv]=Nw;_.nk.push(this.j)};Ow.prototype.a=function(){_.Vs(_.Xc);_.Vs(_.Vc);_.Vs(Hv);_.Vs(Jv);_.Vs(Iv);_.pk(this.j)};Ow.prototype.id=function(){return"subtitles-ttml"};_.H("clpp.ttml.TtmlComponent",Ow);};
|
|
30
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
31
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
32
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
33
|
+
})();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var vv="VerimatrixVCAS",wv="clpp.verimatrix.Vcas",xv="clpp.verimatrix.VcasComponent",Dv=function(a){_.Zl.call(this,vv);var b={};b[yv]=yv;b[zv]=zv;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Av:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Bv:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
|
|
3
|
+
this.D=d;this.B=b;this.w=Cv(this,e);this.o=Cv(this,f);this.l=Cv(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.K(wv);_.R.empty(this.w)?this.g.warn(_.pc):this.Ra(_.Rd,{licenseUrl:this.w,videoRobustness:[_.Vb,void 0],audioRobustness:[_.Ub,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.Gb):this.Ra(_.Pd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
|
|
4
|
+
_.R.empty(this.l)?this.g.warn(_.cb):_.R.empty(this.j)?this.g.warn(_.bb):this.Ra(_.Md,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.M.bind(this),extractContentId:this.I.bind(this)}})},Cv=function(a,b){if(a.D===Av){var c=Object.assign({},{deviceId:_.dj(_.R.hd(a.A))},a.a&&{authenticator:_.dj(_.R.hd(a.a))});return b+_.Yj(c)}return b},Ev=function(){this.g=new _.K(xv)};_.w(Dv,_.Zl);
|
|
5
|
+
Dv.prototype.h=function(a,b){if(this.D===Fv){var c=this.B[zv],d={};d[this.B[yv]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Dv.prototype.I=function(a,b){var c=_.um(b);switch(this.G){case Gv:c=_.Yj({r:c,zn:this.H},!0)}return c};Dv.prototype.K=function(a,b){this.h(a,b);_.xm(b)};Dv.prototype.M=function(a,b){_.ym(b)};_.H(wv,Dv);Dv.prototype.constructor=Dv.prototype.constructor;Dv.NAME=vv;var Av="query-string",Fv="http-header";
|
|
6
|
+
Dv.LicenseRequestVuidLocation={QUERY_STRING:Av,HTTP_HEADER:Fv};var yv="DeviceId",zv="Authenticator";Dv.LicenseRequestHttpHeader={DEVICE_ID_HEADER:yv,AUTHENTICATOR_HEADER:zv};var Bv="keyid",Gv="contentid-siteid";Dv.FairPlayAssetIdStrategy={KEYID:Bv,CONTENTID_SITEID:Gv};_.w(Ev,_.zr);Ev.prototype.a=function(){delete _.Tl.VerimatrixVCAS};Ev.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===vv){a=a.drm.customData;if(!a)throw new _.P(_.Q,7,7100,_.Sd);a=new Dv(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Ul(a)}};Ev.prototype.id=function(){return"verimatrix-vcas"};_.H(xv,Ev);};
|
|
7
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
8
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
9
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
10
|
+
})();
|
package/cjs/cl.vimond.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var kv="Registering listeners",lv="clpp.vimond.VimondPlugin",mv=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.D=e;this.a=new _.Dh;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.tk(this.Hg.bind(this));this.g=new _.K("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(kv),this.a.on(this.m,_.Sf,this.Dj.bind(this)),this.a.on(this.m,_.dg,this.Ej.bind(this)),this.a.on(this.m,_.vc,this.Bj.bind(this)),this.a.on(this.m,_.wc,this.Cj.bind(this)))},nv=function(a,
|
|
3
|
+
b){a.m.trigger(new _.L(_.wg,{detail:b}))},ov=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.P(b?_.Q:1,9,9201,c))},pv=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.K("clpp.vimond.VimondService");this.f=0},qv=function(a){this.m=a;this.a=new _.Dh;this.g=new _.K("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(kv),this.a.on(this.m,_.Ff,this.Al.bind(this)),this.a.on(this.m,_.vc,this.zj.bind(this)),this.a.on(this.m,_.wc,this.Aj.bind(this)))},
|
|
4
|
+
rv=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.nf];if(a.h)return[_.ke,_.bf];if(c===_.Ko)return[_.ke,null];if(c===_.Oo)return[_.me,_.bf];var d=_.bf;if(c===_.Io||c===_.Ro||a.f)d=_.nf;return["period",d]},sv=function(){this.a=!1;this.g=new _.K(lv);this.j=this.h=this.f=null},uv=function(){};_.r=mv.prototype;_.r.Ej=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.Bj=function(){this.g.debug("Ad break started");this.j=!0};
|
|
5
|
+
_.r.Cj=function(){this.g.debug("Ad break stopped");this.j=!1};
|
|
6
|
+
_.r.Dj=function(a){var b=this,c,d,e,f,g;return _.E(function(h){if(1==h.a){c=a.detail;d=_.Mo;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.F(0);
|
|
7
|
+
b.B=e;return _.x(h,b.Hg(),3)}e===d.ENDED&&b.h.stop();_.y(h)})};
|
|
8
|
+
_.r.Hg=function(){var a=this,b,c,d,e,f,g;return _.E(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.aa(a.l?10:a.G);a.l=!1;_.A(h,2);l=a.D;l.f++;var m=_.N.na(l.o);m.client.buildName=_.xa;m.client.buildVersion=_.ia;var n=m.client,p=l.a.m.getDrmInfo();n.drm=p?p.keySystem:"";m.client.pageUrl=document.location.href;m.client.streamUrl=l.a.m.getLoadedSource().url;m.client.userAgent=navigator.userAgent;m.client.videoFormat=
|
|
9
|
+
l.a.m.getLoadedSource().type||"";n=m.client;p=l.a.m.getLoadedSource();p=((new _.Wj(p.url)).scheme||"").replace(":","");n.videoProtocol=p;n=rv(l.a,l.f);m.client.playerEvent=n[0]||"";m.client.playerState=n[1]||"";m.progress.vod&&(m.progress.vod.position=l.a.getPosition());if(n=m.progress.live){p=l.a;var q=p.m.getPresentationStartTime()||0;p=Math.floor(q+p.m.getPosition());p=(new Date(1E3*p)).toISOString();n.position=p;q=l.a;p=q.m.getPosition();q=q.m.getSeekRange().end;n.onLiveEdge=30>Math.abs(q-p);
|
|
10
|
+
typeof n.liveResumePossible!==_.hd&&(n.liveResumePossible=!0)}m.progress.eventNumber=l.f;m.timestamp=(new Date).toISOString();l.g.debug("Fire an event");n=_.qj(l.l);n.method="POST";n.contentType="application/json";n.headers.Authorization="Bearer "+l.h;n.body=_.R.hd(JSON.stringify(m));l=l.j.fetch(n).O;return _.x(h,l,4)}if(2!=h.a)return b=h.f,nv(a,b),_.$g(h,0);d=c=_.B(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),nv(a,f),ov(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),
|
|
11
|
+
nv(a,f),ov(a,a.I,f)):a.g.error(c.toString());_.y(h)})};_.r.dispose=function(){this.g.debug(_.gc);_.Gh(this.a);this.h.stop()};pv.prototype.Zf=function(a){this.h=a};_.r=qv.prototype;_.r.getPosition=function(){return Math.floor(this.m.getPosition())};_.r.Al=function(){this.h=!0};_.r.zj=function(){this.f=!0};_.r.Aj=function(){this.f=!1};_.r.dispose=function(){this.g.debug(_.gc);_.Gh(this.a)};_.w(sv,_.ft);_.r=sv.prototype;_.r.onPlayerCreated=function(){};
|
|
12
|
+
_.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.N.R(b.vimond)&&typeof b.vimond===_.Se)?a.namespace()===_.Cd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.warn("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.u(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.P(1,9,9200));return}this.g.debug("Configuration is valid");
|
|
13
|
+
c=b.failIfUnreachable;typeof c!==_.hd&&(c=!0);d=b.failOnError;typeof d!==_.hd&&(d=!0);this.f=new qv(a);this.h=new pv(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new mv(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.h=this.f=null)};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
|
|
14
|
+
_.r.Zf=function(a){this.a&&this.h&&this.h.Zf(a)};_.H(lv,sv);sv.prototype.updateAuthToken=sv.prototype.Zf;sv.Id="vimond";uv.prototype.create=function(){return new sv};_.jq(new uv);};
|
|
15
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
16
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
17
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
18
|
+
})();
|
package/cjs/cl.vr.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
(function(){var g={}; var _ = _ || {}
|
|
2
|
+
var f=function(window){var Qu="touchmove",Ru="touchstart",Su=function(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1},Tu=function(a,b){var c=a.x,d=a.y,e=a.a,f=a.f;b.set(1-2*(d*d+e*e),2*(c*d-e*f),2*(c*e+d*f),0,2*(c*d+e*f),1-2*(c*c+e*e),2*(d*e-c*f),0,2*(c*e-d*f),2*(d*e+c*f),1-2*(c*c+d*d),0,0,0,0,1)},Uu=function(a,b,c){c*=.5;var d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Su(a/d*e,b/d*e,0/d*e,Math.cos(c))},Vu=function(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0},Wu=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=
|
|
3
|
+
b):(a.x=0,a.y=0,a.a=0)},Xu=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Yu=function(a,b,c){var d=b.x,e=b.y;b=b.a;var f=c.x,g=c.y;c=c.a;a.x=e*c-b*g;a.y=b*f-d*c;a.a=d*g-e*f;return a},Zu=function(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},$u=function(a,b,c){b=b.a;c=c.a;var d=a.a,e=0;do d[4*e]=b[4*e]*c[0]+b[4*e+1]*c[4]+b[4*e+2]*c[8]+b[4*e+3]*c[12],d[4*e+1]=b[4*e]*c[1]+b[4*e+1]*c[5]+b[4*e+2]*c[9]+b[4*e+3]*c[13],d[4*e+2]=b[4*e]*c[2]+b[4*e+1]*c[6]+b[4*e+2]*c[10]+b[4*e+3]*c[14],d[4*e+
|
|
4
|
+
3]=b[4*e]*c[3]+b[4*e+1]*c[7]+b[4*e+2]*c[11]+b[4*e+3]*c[15];while(4>++e);return a},av=function(a){var b=new Vu(0,0,0),c=new Vu(0,0,1),d=new Vu,e=new Vu,f=new Vu;a=a.a;var g=new Vu(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Wu(f,1/g);c=Yu(d,c,f);g=c.length();Wu(c,1/g);Yu(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Xu(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Xu(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Xu(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},cv=function(a){this.a=a;this.f=a.createProgram();this.l=
|
|
5
|
+
bv(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute highp vec2 aTexCoord;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_Position \x3d Mvpm * aPosition;\n oTexCoord \x3d aTexCoord;\n}\n");this.j=bv(this,!0,"precision highp float;\nuniform sampler2D Texture0;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_FragColor \x3d texture2D(Texture0, oTexCoord);\n gl_FragColor.w \x3d 1.0;\n}\n");a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,
|
|
6
|
+
0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.P(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.h=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)},bv=function(a,b,c){b=a.a.createShader(b?a.a.FRAGMENT_SHADER:a.a.VERTEX_SHADER);a.a.shaderSource(b,c);a.a.compileShader(b);if(!a.a.getShaderParameter(b,a.a.COMPILE_STATUS))throw new _.P(1,
|
|
7
|
+
9,9004,"Unable to compile GL shader: "+a.a.getShaderInfoLog(b));return b},dv=function(a){this.a=a;var b=[],c,d;for(d=0;70>=d;d++){var e=3>=d?d/4/64:67<=d?(63+(d-66)/4)/64:(d-3)/64;var f=(e-.5)*Math.PI,g=Math.cos(f);for(c=0;128>=c;c++){var h=c/128,l=(.5+h)*Math.PI*2;128===c?(b.push(b[645*d]),b.push(b[645*d+1]),b.push(b[645*d+2])):(b.push(100*Math.cos(l)*g),b.push(100*Math.sin(l)*g),b.push(100*Math.sin(f)));0===d||70===d?b.push(.5):b.push(1-h);b.push(1-e)}}e=[];for(c=0;128>c;c++)for(d=0;70>d;d++)f=
|
|
8
|
+
5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.h=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)},ev=function(a,
|
|
9
|
+
b){this.a=b;this.f=this.a.createTexture();b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.bindTexture(b.TEXTURE_2D,null)},fv=function(){var a=this;this.o=this.w=this.M=this.J=this.A=
|
|
10
|
+
this.ia=this.H=this.f=this.a=this.m=null;this.g=new _.K("clpp.vr");this.I=70;this.fa=1;this.T=this.P=!1;this.G=function(){if(a.a&&a.f){a.f.viewport(0,0,a.a.width,a.a.height);var b=a.M.a,c=Math.tan(.5*a.I*Math.PI/180);b[0]=1/(a.a.width/a.a.height*c);b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1/c;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=2E3/-1999.9;b[11]=200/-1999.9;b[12]=0;b[13]=0;b[14]=-1;b[15]=1}};this.l=this.j=0;this.h={x:0,y:0};this.V=new Zu;this.da=new Zu;this.oa=new Zu;this.pa=new Zu;this.B=this.xl.bind(this);
|
|
11
|
+
this.D=this.yl.bind(this);this.K=this.wl.bind(this)},gv=function(a){var b=Uu(1,0,a.l*Math.PI/180);Tu(Uu(0,1,a.j*Math.PI/180),a.V);Tu(b,a.da);av(a.oa);$u(a.pa,a.V,a.oa);$u(a.H,a.da,a.pa)},hv=function(a){a.a&&(a.a.removeEventListener("mousemove",a.B,!1),a.a.removeEventListener(Qu,a.B,!1),a.a.removeEventListener("mouseup",a.D,!1),a.a.removeEventListener("touchend",a.D,!1))},iv=function(){};Vu.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)};Zu.prototype.set=function(a,b,c,d,e,f,g,h,l,m,n,p,q,t,v,z){var D=this.a;D[0]=a;D[4]=b;D[8]=c;D[12]=d;D[1]=e;D[5]=f;D[9]=g;D[13]=h;D[2]=l;D[6]=m;D[10]=n;D[14]=p;D[3]=q;D[7]=t;D[11]=v;D[15]=z;return this};var jv={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1};_.w(fv,_.ft);_.r=fv.prototype;_.r.onPlayerCreated=function(a){this.g.info("Player created");this.m=a};
|
|
12
|
+
_.r.onContentWillLoad=function(a){var b=a.getConfiguration();if(b.vr&&b.vr.enable){var c=b.vr,d=c.fieldOfView,e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;if(void 0!==d&&_.N.ma(d))this.I=d;else throw new _.P(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.N.ma(e)&&0<e)this.fa=e;else throw new _.P(1,7,7100,"sensitivity configuration must be a positive number");this.P=!!f;this.T=!!c;if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.rg){this.g.info("Initialize VR Surface");
|
|
13
|
+
if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",jv)||this.a.getContext("experimental-webgl",jv);if(!this.f)throw new _.P(1,9,9003,"Unable to create GL context");this.H=new Zu;av(this.H);this.ia=new dv(this.f);this.A=new cv(this.f);this.J=new Zu;this.M=new Zu;this.o=this.w=null;this.a.addEventListener(_.If,this.G)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.K,
|
|
14
|
+
!1),this.a.addEventListener(Ru,this.K,!1));this.G();this.Lh()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}};
|
|
15
|
+
_.r.onPlayerWillRelease=function(){this.g.info("Releasing VR plugin resources");this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&&(delete this.f,this.f=null);this.a&&(hv(this),this.a.removeEventListener(_.If,this.G),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.K,!1),delete this.a,this.a=null)};_.r.onPlayerWillDestroy=function(){var a=this;return _.E(function(b){a.m=null;_.y(b)})};_.r.id=function(){return"vr"};
|
|
16
|
+
_.r.Lh=function(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.rg){this.w=requestAnimationFrame(this.Lh.bind(this));var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new ev(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,
|
|
17
|
+
0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.A;c.a.useProgram(c.f);c=$u(this.J,this.M,this.H).a;var d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d;b.uniformMatrix4fv(this.A.h,!1,this.J.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.ia;a.a.bindBuffer(a.a.ARRAY_BUFFER,
|
|
18
|
+
a.f);a.a.vertexAttribPointer(0,3,a.a.FLOAT,!1,20,0);a.a.vertexAttribPointer(1,2,a.a.FLOAT,!1,20,12);a.a.enableVertexAttribArray(0);a.a.enableVertexAttribArray(1);a.a.drawArrays(a.a.TRIANGLES,0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.A.a.useProgram(null)}}}};
|
|
19
|
+
_.r.wl=function(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Ru)a.type===Ru?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.B,!1),this.a.addEventListener(Qu,this.B,!1),this.a.addEventListener("mouseup",this.D,!1),this.a.addEventListener("touchend",this.D,!1)};
|
|
20
|
+
_.r.xl=function(a){a.preventDefault();var b=a.clientX,c=a.clientY;a.type===Qu&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;var d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.fa;c=d*b*(this.T?-1:1);this.j+=a*b*(this.P?-1:1);this.l+=c;gv(this)};_.r.yl=function(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();hv(this)};_.r.Sk=function(a,b){this.l=b;this.j=a;gv(this)};_.r.dk=function(){return{x:this.j,y:this.l}};
|
|
21
|
+
_.r.lm=function(a){this.I=a;this.G()};_.H("clpp.vr.VrPlugin",fv);fv.prototype.setCameraFieldOfView=fv.prototype.lm;fv.prototype.getCameraCoordinates=fv.prototype.dk;fv.prototype.moveCamera=fv.prototype.Sk;fv.Id="vr";iv.prototype.create=function(){return new fv};_.jq(new iv);};
|
|
22
|
+
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
23
|
+
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
24
|
+
else{_=this.clpp._;(f.call(g,this));}
|
|
25
|
+
})();
|