@castlabs/prestoplay 6.2.6 → 6.2.7

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/cjs/cl.adobe.js +3 -3
  4. package/cjs/cl.airplay.js +3 -3
  5. package/cjs/cl.broadpeak.js +6 -6
  6. package/cjs/cl.cast.js +101 -101
  7. package/cjs/cl.conviva.js +32 -32
  8. package/cjs/cl.core.js +362 -362
  9. package/cjs/cl.crypto.js +9 -9
  10. package/cjs/cl.dash.js +68 -68
  11. package/cjs/cl.externs.js +63 -32
  12. package/cjs/cl.freewheel.js +19 -19
  13. package/cjs/cl.hls.js +43 -43
  14. package/cjs/cl.hlssmpte.js +6 -6
  15. package/cjs/cl.htmlcue.js +30 -30
  16. package/cjs/cl.ima.js +18 -18
  17. package/cjs/cl.mse.js +252 -249
  18. package/cjs/cl.muxdata.js +11 -11
  19. package/cjs/cl.onboard.js +3 -3
  20. package/cjs/cl.persistent.js +13 -13
  21. package/cjs/cl.playlist.js +5 -5
  22. package/cjs/cl.smooth.js +69 -69
  23. package/cjs/cl.thumbnails.js +22 -22
  24. package/cjs/cl.tizen.js +69 -69
  25. package/cjs/cl.ttml.js +26 -26
  26. package/cjs/cl.verimatrix.js +5 -5
  27. package/cjs/cl.vimond.js +12 -12
  28. package/cjs/cl.vr.js +24 -0
  29. package/cjs/cl.vtt.js +14 -14
  30. package/cjs/cl.youbora.js +16 -16
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +5 -5
  34. package/cl.cast.js +78 -78
  35. package/cl.conviva.js +25 -25
  36. package/cl.core.js +172 -171
  37. package/cl.crypto.js +8 -8
  38. package/cl.dash.js +61 -61
  39. package/cl.externs.js +59 -32
  40. package/cl.freewheel.js +18 -18
  41. package/cl.hls.js +36 -36
  42. package/cl.hlssmpte.js +5 -5
  43. package/cl.htmlcue.js +24 -24
  44. package/cl.ima.js +15 -15
  45. package/cl.mse.js +223 -220
  46. package/cl.muxdata.js +9 -9
  47. package/cl.onboard.js +3 -3
  48. package/cl.persistent.js +9 -9
  49. package/cl.playlist.js +4 -4
  50. package/cl.smooth.js +57 -57
  51. package/cl.thumbnails.js +15 -15
  52. package/cl.tizen.js +55 -55
  53. package/cl.ttml.js +21 -21
  54. package/cl.verimatrix.js +4 -4
  55. package/cl.vimond.js +7 -7
  56. package/cl.vr.js +14 -0
  57. package/cl.vtt.js +7 -7
  58. package/cl.youbora.js +8 -8
  59. package/package.json +1 -1
@@ -1,27 +1,27 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Yr="No thumbnail duration or URL specified",Zr="No thumbnail found for position ",$r="Position is out of range: ",as="Thumbnail URL is mandatory",bs="Wrong gridSize format",cs="clpp.thumbnails",ds=function(a,b,c,d,e,f,g,k,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;k=void 0===k?1:k;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.a=p;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.g=k;this.m=
3
- l;this.h=m;this.j=n;this.f=null},es=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.a=new _.Nh},fs=function(){this.g=new _.C(cs);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Nh},gs=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.a.resolve()})},is=function(a,b){return hs(a,b).then(function(c){return new ds(c,b.time,b.duration)})},hs=function(a,b){return b.load().then(function(){var c=_.Q(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
4
- _.dj(c)})},js=function(){this.log=new _.C(cs);this.g=null;this.a=[];this.w=!1},ls=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Ad&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return ks(a,0,e,!!f)})},Promise.resolve())},ks=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return ms(a,d).then(function(){return a.a[b].load()}).then(function(){return ks(a,e,c,d)})},ms=function(a,b){return new Promise(function(c){if(b||a.g.getState()!==_.Dl)c();
5
- else a.g.one(_.ic,function(){c()})})},ns=function(){js.call(this);this.f=null},os=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},ps=function(){js.call(this);this.f=null;this.o=this.h=1;this.j=0},qs=function(){js.apply(this,arguments)},rs=function(a,b){for(var c=null,d=_.t(a),e=d.next();!e.done;e=d.next())e=e.value,e.startTime<=b&&(c=e);return c},ss=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||
6
- b.verticalTiles||1,e=c*d;return{Tc:c,Ue:d,Af:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},ts=function(){this.f=new _.C(cs);this.a=this.l=null},us=function(a){return a.some(function(b){return 0<b.thumbStreams.length})},vs=function(a){if(!a)return null;a=new _.Hj(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null},ws=function(){};ds.prototype.raw=function(){return this.a.cloneNode(!1)};
7
- ds.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(_.Lc);e.style.width=c+_.Ud;e.style.height=d+_.Ud;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage="url("+this.src+")";e.style.backgroundSize=Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))+"px "+Math.ceil(d/
2
+ var f=function(window){var ts="No thumbnail duration or URL specified",us="No thumbnail found for position ",vs="Position is out of range: ",ws="Thumbnail URL is mandatory",xs="Wrong gridSize format",ys="clpp.thumbnails",zs=function(a,b,c,d,e,f,g,k,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;k=void 0===k?1:k;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.a=p;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.g=k;this.m=
3
+ l;this.h=m;this.j=n;this.f=null},As=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.a=new _.Oh},Bs=function(){this.g=new _.D(ys);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Oh},Cs=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.a.resolve()})},Es=function(a,b){return Ds(a,b).then(function(c){return new zs(c,b.time,b.duration)})},Ds=function(a,b){return b.load().then(function(){var c=_.Q(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
4
+ _.ej(c)})},Fs=function(){this.log=new _.D(ys);this.g=null;this.a=[];this.w=!1},Hs=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Ad&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Gs(a,0,e,!!f)})},Promise.resolve())},Gs=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Is(a,d).then(function(){return a.a[b].load()}).then(function(){return Gs(a,e,c,d)})},Is=function(a,b){return new Promise(function(c){if(b||a.g.getState()!==_.El)c();
5
+ else a.g.one(_.ic,function(){c()})})},Js=function(){Fs.call(this);this.f=null},Ks=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},Ls=function(){Fs.call(this);this.f=null;this.o=this.h=1;this.j=0},Ms=function(){Fs.apply(this,arguments)},Ns=function(a,b){for(var c=null,d=_.t(a),e=d.next();!e.done;e=d.next())e=e.value,e.startTime<=b&&(c=e);return c},Os=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||
6
+ b.verticalTiles||1,e=c*d;return{Uc:c,We:d,Cf:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Ps=function(){this.f=new _.D(ys);this.a=this.l=null},Qs=function(a){return a.some(function(b){return 0<b.thumbStreams.length})},Rs=function(a){if(!a)return null;a=new _.Ij(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null},Ss=function(){};zs.prototype.raw=function(){return this.a.cloneNode(!1)};
7
+ zs.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(_.Lc);e.style.width=c+_.Ud;e.style.height=d+_.Ud;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage="url("+this.src+")";e.style.backgroundSize=Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))+"px "+Math.ceil(d/
8
8
  this.height*(this.a.naturalHeight||this.a.height))+_.Ud;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Ud;e.style.backgroundPositionY="-"+f*d+_.Ud;return e};
9
- ds.prototype.load=function(){var a=this;this.f||(this.f=new Promise(function(b,c){function d(){a.width||(a.width=(a.a.naturalWidth||a.a.width)/a.g);a.height||(a.height=(a.a.naturalHeight||a.a.height)/a.m);a.x||(a.x=a.width*a.h);a.y||(a.y=a.height*a.j)}if(a.a.src&&a.a.complete)d(),b(a);else{var e=null,f=function(){d();a.a.removeEventListener("load",f);a.a.removeEventListener(_.Wc,e);b(a)};e=function(){a.a.removeEventListener("load",f);a.a.removeEventListener(_.Wc,e);c()};a.a.addEventListener("load",
10
- f);a.a.addEventListener(_.Wc,e);a.a.src=a.src}}));return this.f};_.A("clpp.thumbnails.Thumbnail",ds);ds.prototype.load=ds.prototype.load;ds.prototype.element=ds.prototype.element;ds.prototype.raw=ds.prototype.raw;es.prototype.load=function(){return this.a};
11
- fs.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.J(_.K,7,7100,as);var d=_.fh(b.url);d.type=_.eh;a.getNetworkEngine().fetch(d).N.then(function(e){e=e.data;var f=_.Q(c.f);e=_.Q(e);for(var g=f.byteLength+e.byteLength,k=new ArrayBuffer(g),l=new DataView(k),m=0,n=0,p=f.byteLength;n<p;n++)l.setUint8(m,f[n]),m+=1;f=0;for(n=e.byteLength;f<n;f++)l.setUint8(m,e[f]),m+=1;c.f=k;c.g.info("Appended "+e.byteLength+" bytes.Total data now "+(g+" bytes."))}).then(function(){var e=c.f,f=_.Q(e),g=
12
- String.fromCharCode.apply(null,xs),k=Array.prototype.slice.call(f,0,8);f=64;var l=0;var m=!1;if(g===String.fromCharCode.apply(null,k))for(e=new DataView(e,16,20),e=e.getUint32(0,!0),0===e&&(e=1E3);!m;){l+=1;k=e;g=new DataView(c.f,f);m=g.getUint32(0,!0);k=m*k/1E3;g=g.getUint32(4,!0);g=new es(k,g);if(k=c.a.length)k=c.a[k-1],k.length=g.offset-k.offset,k.duration=g.time-k.time;c.a.push(g);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<l)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
13
- }).then(function(){gs(c)})["catch"](function(e){c.g.error("Error while loading thumbnail index",e)})};fs.prototype.get=function(a){var b=this;return 0>a?Promise.reject($r+a):this.h.then(function(){for(var c=0;c<b.a.length;c++){var d=b.a[c];if(d.time>=a&&a<d.time+d.duration)return is(b,d).then(function(e){return e.load().then(function(){return e})})}return Promise.reject(Zr+a)})};var xs=[137,66,73,70,13,10,26,10];js.prototype.init=function(a,b){var c=this;this.g=a;a.one(_.Xd,function(){c.w=!0});a.isLive()||this.m().then(function(){b&&b.preload&&ls(c,b.preload)})};_.u(ns,js);
14
- ns.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.J(_.K,7,7100,as);var d=b.url,e=_.fh(d);e.type=_.eh;this.f=a.getNetworkEngine().fetch(e).N.then(function(f){if(f=f.data){f=_.Qg(f).split(/\n/);for(var g=0;g<f.length;g++){var k=f[g],l=k.split(" --\x3e ");if(2===l.length){k=f[++g];var m=k.indexOf("\x3d"),n=0>m?[]:k.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var r=k.indexOf("#");k=0>r?k:k.substr(0,r);k.match(/^http|^\/\//)||(k=d.substr(0,d.lastIndexOf("/"))+"/"+
15
- k);r=os(l[0]);l=os(l[1])-r;c.a.push(new ds(k,r,l,m,p,q,n,0,0))}}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnail",f)});js.prototype.init.call(this,a,b)};ns.prototype.get=function(a){var b=this;return 0>a?Promise.reject($r+a):this.f.then(function(){for(var c={},d=0;d<b.a.length;c={Rb:c.Rb},d++)if(c.Rb=b.a[d],c.Rb.time>=a&&a<c.Rb.time+c.Rb.duration)return c.Rb.load().then(function(e){return function(){return e.Rb}}(c));return Promise.reject(Zr+a)})};ns.prototype.m=function(){return this.f};_.u(ps,js);
16
- ps.prototype.init=function(a,b){if(!b||!b.url)throw new _.J(_.K,7,7100,as);if("GRID"===b.mode&&!b.gridSize)throw new _.J(_.K,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.J(_.K,7,7100,"Duration is mandatory");this.f=b;var c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(Yr,c,d),new _.J(_.K,7,7100,Yr);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],
17
- this.o=e[1];else throw new _.J(_.K,7,7100,bs);}catch(f){throw this.log.error("Error during parsing gridSize",f),new _.J(_.K,7,7100,bs);}js.prototype.init.call(this,a,b)};ps.prototype.get=function(a){var b=this.g.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($r+a);var d=this.a[c];return d?d.load().then(function(){return d}):Promise.reject(Zr+a+" at index "+c)};
18
- ps.prototype.m=function(){if(0<this.a.length)return Promise.resolve();var a=this.g.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 ds(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()};_.u(qs,js);
19
- qs.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.g.getPeriods();b=rs(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),
20
- Promise.reject();var d=c.getSegmentReference(b);if(d){var e=ss(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.Af+a]);else if((c=d.Ra())&&0<c.length){var g=0,k=0;d=d.startTime;1<e.Af&&(g=a%e.Tc,k=Math.floor(a/e.Tc),d+=a*e.durationPerTile);f=new ds(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Tc,e.Ue,g,k)}if(f)return f.load().then(function(){return f})}this.log.error("segment reference for specified segment index does not exist",
21
- b);return Promise.reject()};qs.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
22
- qs.prototype.m=function(){if(0<this.a.length)return Promise.resolve();var a=this.g.getPeriods();a=_.t(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&&!_.H.R(d=b.getSegmentReference(c++));)for(var e=ss(d,b),f=d.Ra()[0],g=new Image,k=d.startTime,l=0;l<e.Ue;++l)for(var m=0;m<e.Tc;++m)this.a.push(new ds(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.Tc,e.Ue,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.h=ts.prototype;_.h.onPlayerCreated=function(a){this.l=a};_.h.onPlayerWillDestroy=function(){this.l=null};_.h.onPlayerWillRelease=function(){this.a=null};
23
- _.h.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=vs(d.url||null)),c&&("SINGLE"===c||"GRID"===c?this.a=new ps:"WEBVTT"===c?this.a=new ns:"BIF"===c&&(this.a=new fs)),this.a&&(this.f.info("Loading thumbs configuraiton",d),this.l.one(_.jd,function(){b.f.info("Initialize thumbnails provider");b.a.init(a,d)})))}else this.a=null};
24
- _.h.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();this.f.info(_.Cd,d);us(d)&&(this.a=new qs,this.a.init(a,c))}};_.h.get=function(a){return this.a?this.a.get(a):Promise.reject()};_.h.id=function(){return"thumbnails"};_.A("clpp.thumbnails.ThumbnailsPlugin",ts);ts.prototype.get=ts.prototype.get;ts.Id="thumbnails";ws.prototype.create=function(){return new ts};_.fn(new ws);};
9
+ zs.prototype.load=function(){var a=this;this.f||(this.f=new Promise(function(b,c){function d(){a.width||(a.width=(a.a.naturalWidth||a.a.width)/a.g);a.height||(a.height=(a.a.naturalHeight||a.a.height)/a.m);a.x||(a.x=a.width*a.h);a.y||(a.y=a.height*a.j)}if(a.a.src&&a.a.complete)d(),b(a);else{var e=null,f=function(){d();a.a.removeEventListener("load",f);a.a.removeEventListener(_.Vc,e);b(a)};e=function(){a.a.removeEventListener("load",f);a.a.removeEventListener(_.Vc,e);c()};a.a.addEventListener("load",
10
+ f);a.a.addEventListener(_.Vc,e);a.a.src=a.src}}));return this.f};_.A("clpp.thumbnails.Thumbnail",zs);zs.prototype.load=zs.prototype.load;zs.prototype.element=zs.prototype.element;zs.prototype.raw=zs.prototype.raw;As.prototype.load=function(){return this.a};
11
+ Bs.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.J(_.K,7,7100,ws);var d=_.gh(b.url);d.type=_.fh;a.getNetworkEngine().fetch(d).N.then(function(e){e=e.data;var f=_.Q(c.f);e=_.Q(e);for(var g=f.byteLength+e.byteLength,k=new ArrayBuffer(g),l=new DataView(k),m=0,n=0,p=f.byteLength;n<p;n++)l.setUint8(m,f[n]),m+=1;f=0;for(n=e.byteLength;f<n;f++)l.setUint8(m,e[f]),m+=1;c.f=k;c.g.info("Appended "+e.byteLength+" bytes.Total data now "+(g+" bytes."))}).then(function(){var e=c.f,f=_.Q(e),g=
12
+ String.fromCharCode.apply(null,Ts),k=Array.prototype.slice.call(f,0,8);f=64;var l=0;var m=!1;if(g===String.fromCharCode.apply(null,k))for(e=new DataView(e,16,20),e=e.getUint32(0,!0),0===e&&(e=1E3);!m;){l+=1;k=e;g=new DataView(c.f,f);m=g.getUint32(0,!0);k=m*k/1E3;g=g.getUint32(4,!0);g=new As(k,g);if(k=c.a.length)k=c.a[k-1],k.length=g.offset-k.offset,k.duration=g.time-k.time;c.a.push(g);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<l)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
13
+ }).then(function(){Cs(c)})["catch"](function(e){c.g.error("Error while loading thumbnail index",e)})};Bs.prototype.get=function(a){var b=this;return 0>a?Promise.reject(vs+a):this.h.then(function(){for(var c=0;c<b.a.length;c++){var d=b.a[c];if(d.time>=a&&a<d.time+d.duration)return Es(b,d).then(function(e){return e.load().then(function(){return e})})}return Promise.reject(us+a)})};var Ts=[137,66,73,70,13,10,26,10];Fs.prototype.init=function(a,b){var c=this;this.g=a;a.one(_.Xd,function(){c.w=!0});a.isLive()||this.m().then(function(){b&&b.preload&&Hs(c,b.preload)})};_.u(Js,Fs);
14
+ Js.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.J(_.K,7,7100,ws);var d=b.url,e=_.gh(d);e.type=_.fh;this.f=a.getNetworkEngine().fetch(e).N.then(function(f){if(f=f.data){f=_.Rg(f).split(/\n/);for(var g=0;g<f.length;g++){var k=f[g],l=k.split(" --\x3e ");if(2===l.length){k=f[++g];var m=k.indexOf("\x3d"),n=0>m?[]:k.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var r=k.indexOf("#");k=0>r?k:k.substr(0,r);k.match(/^http|^\/\//)||(k=d.substr(0,d.lastIndexOf("/"))+"/"+
15
+ k);r=Ks(l[0]);l=Ks(l[1])-r;c.a.push(new zs(k,r,l,m,p,q,n,0,0))}}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnail",f)});Fs.prototype.init.call(this,a,b)};Js.prototype.get=function(a){var b=this;return 0>a?Promise.reject(vs+a):this.f.then(function(){for(var c={},d=0;d<b.a.length;c={Rb:c.Rb},d++)if(c.Rb=b.a[d],c.Rb.time>=a&&a<c.Rb.time+c.Rb.duration)return c.Rb.load().then(function(e){return function(){return e.Rb}}(c));return Promise.reject(us+a)})};Js.prototype.m=function(){return this.f};_.u(Ls,Fs);
16
+ Ls.prototype.init=function(a,b){if(!b||!b.url)throw new _.J(_.K,7,7100,ws);if("GRID"===b.mode&&!b.gridSize)throw new _.J(_.K,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.J(_.K,7,7100,"Duration is mandatory");this.f=b;var c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(ts,c,d),new _.J(_.K,7,7100,ts);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],
17
+ this.o=e[1];else throw new _.J(_.K,7,7100,xs);}catch(f){throw this.log.error("Error during parsing gridSize",f),new _.J(_.K,7,7100,xs);}Fs.prototype.init.call(this,a,b)};Ls.prototype.get=function(a){var b=this.g.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(vs+a);var d=this.a[c];return d?d.load().then(function(){return d}):Promise.reject(us+a+" at index "+c)};
18
+ Ls.prototype.m=function(){if(0<this.a.length)return Promise.resolve();var a=this.g.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 zs(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()};_.u(Ms,Fs);
19
+ Ms.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.g.getPeriods();b=Ns(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),
20
+ Promise.reject();var d=c.getSegmentReference(b);if(d){var e=Os(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.Cf+a]);else if((c=d.Ra())&&0<c.length){var g=0,k=0;d=d.startTime;1<e.Cf&&(g=a%e.Uc,k=Math.floor(a/e.Uc),d+=a*e.durationPerTile);f=new zs(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Uc,e.We,g,k)}if(f)return f.load().then(function(){return f})}this.log.error("segment reference for specified segment index does not exist",
21
+ b);return Promise.reject()};Ms.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
22
+ Ms.prototype.m=function(){if(0<this.a.length)return Promise.resolve();var a=this.g.getPeriods();a=_.t(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&&!_.H.R(d=b.getSegmentReference(c++));)for(var e=Os(d,b),f=d.Ra()[0],g=new Image,k=d.startTime,l=0;l<e.We;++l)for(var m=0;m<e.Uc;++m)this.a.push(new zs(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.Uc,e.We,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.h=Ps.prototype;_.h.onPlayerCreated=function(a){this.l=a};_.h.onPlayerWillDestroy=function(){this.l=null};_.h.onPlayerWillRelease=function(){this.a=null};
23
+ _.h.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=Rs(d.url||null)),c&&("SINGLE"===c||"GRID"===c?this.a=new Ls:"WEBVTT"===c?this.a=new Js:"BIF"===c&&(this.a=new Bs)),this.a&&(this.f.info("Loading thumbs configuration",d),this.l.one(_.jd,function(){b.f.info("Initialize thumbnails provider");b.a.init(a,d)})))}else this.a=null};
24
+ _.h.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();this.f.info(_.Cd,d);Qs(d)&&(this.a=new Ms,this.a.init(a,c))}};_.h.get=function(a){return this.a?this.a.get(a):Promise.reject()};_.h.id=function(){return"thumbnails"};_.A("clpp.thumbnails.ThumbnailsPlugin",Ps);Ps.prototype.get=Ps.prototype.get;Ps.Id="thumbnails";Ss.prototype.create=function(){return new Ps};_.gn(new Ss);};
25
25
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
26
26
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
27
27
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.tizen.js CHANGED
@@ -1,75 +1,75 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var NC="An unknown error occured while trying to get volume",OC="Cannot get loading rendition due to platform limitations",PC="PARAM_START_POSITION",QC="SecurityError",RC="The require privilege is: http://tizen.org/privilege/tv.audio",SC="|STARTBITRATE\x3d",TC=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},UC=function(a,b){this.h=a;this.w=null;this.a=_.yd;this.o=null;this.j=!1;this.f=new Map;this.m=b;this.g=new _.C("clpp.tizen.DrmEngine")},XC=function(a){var b,
3
- c,d;return _.z(function(e){if(1==e.a){b=a.a===_.Fc||a.a===_.Ec;if(!b)throw new _.J(_.K,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Wc)throw new _.J(_.K,6,6012,"No license server given for "+a.a);_.pf(e,2);return a.a===_.Fc?_.v(e,VC(a),5):_.v(e,WC(a,c),5)}if(2!=e.a)return a.w={keySystem:a.a,licenseServerUri:c.Wc,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Fe,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
- keyIds:[],periodId:null},_.qf(e,0);d=_.rf(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.J(_.K,6,6005,{message:JSON.stringify(d)});})},WC=function(a,b){var c,d,e,f;return _.z(function(g){c=YC;d=ZC;e={};e[d.kg]=!b.Fe;e[d.lg]=b.Wc;""!==b.customData&&(e[d.jg]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(k){throw k;}_.w(g)})},VC=function(a){var b;return _.z(function(c){b=YC;try{webapis.avplay.setDrm(b.gd,
5
- "Initialize",""),webapis.avplay.setDrm(b.gd,"widevine_app_session",a.o.id),webapis.avplay.setDrm(b.gd,"widevine_data_type",a.o.type)}catch(d){throw d;}_.w(c)})},$C=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,r,x,y,E,I,F;_.z(function(G){if(1==G.a){c=YC;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);k=b.serverurl&&""!==b.serverurl?b.serverurl:d.Wc;l=_.fh([k],_.ch());l.type=3;l.body=f.buffer;l.method=
6
- "POST";_.pf(G,2);return _.v(G,a.m.wb.fetch(l).N,4)}if(2!=G.a){m=G.f;if(a.j){n=_.Q(m.data);p=n.byteLength;q="";for(r=0;r<p;r++)q+=String.fromCharCode(n[r]);x=btoa(q);y=b.session_id+PC+(x+PC);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.gd,"widevine_license_data",y)}catch(M){a.g.error("License response rejected by CDM"),E=new _.J(_.K,6,6008,{browserError:JSON.stringify(M)}),a.m.onError(E)}}return _.qf(G,0)}I=_.rf(G);a.g.error("License request failed.",JSON.stringify(I));F=new _.J(_.K,
7
- 6,6007,{message:_.Ba,url:I.data.url,status:I.data.status||NaN,response:I.data.response||"",headers:I.data.headers||{}},I);a.m.onError(F);_.w(G)})},aD=function(a){this.l=a;this.a=this.l.a;this.f=_.yl;this.j=_.zl;this.w=(new Date).getTime();this.m=!1;this.o=-1;this.h=2;this.g=new _.C("clpp.tizen.StateManager")},cD=function(a,b){if(a.f!==b)if(a.f===_.Jl&&b!==_.yl)a.g.debug(_.lt+bD(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Dl?(a.o=(new Date).getTime(),a.l.trigger(new _.D(_.jc,{detail:{bufferedTimeMS:-1,
8
- reason:a.h}}))):a.j===_.Dl&&a.l.trigger(new _.D(_.ic,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.l.trigger(new _.D(_.he,{detail:d}));a.g.debug("State changed:",bD(a.j),"-\x3e",bD(a.f))}},bD=function(a){return Object.keys(_.Hl)[a]},fD=function(a){if(a.m){var b=a.a.getState(),c=a.f;switch(b){case dD:c=_.Ml;break;case eD:c=_.Ll;break;default:a.l.isEnded()?c=_.Fl:a.g.debug("Inconsistent AVPlay plackback state:",b)}cD(a,
9
- c)}},gD=function(){this.o=this.A=this.g=this.h=this.B=this.l=this.j=this.f=null;this.w=!0;this.m=null;this.a=new _.C("clpp.tizen.TextStreamer")},hD=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},iD=function(a){var b,c;return _.z(function(d){if(1==d.a)return b=a.l.getConfiguration(),c=null,_.v(d,_.ho(a.B.url,a.l.getNetworkEngine(),b.manifest.attemptParameters,a.B.type),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},jD=function(a){var b=
10
- document.createElement(_.Ge),c=new _.Wu,d=new _.Wt(function(){return null}),e=a.l.getTextDisplayer();return new _.bv(b,c,e,d,a.l.getConfiguration())},kD=function(a){var b={qb:function(){return a.l.getPosition()},W:a.h,wb:a.l.getNetworkEngine(),ye:a.Hh.bind(a),xe:a.Gh.bind(a),onError:a.S.bind(a),Of:function(){},onEvent:function(){},Tf:a.Ih.bind(a),Cd:function(){},de:function(){return new _.fw}};return new _.$w(a.f,b)},lD=function(a){var b=a.l.getPosition(),c=null;a=_.t(a.f.periods);for(var d=a.next();!d.done;d=
11
- a.next())d=d.value,d.startTime<=b&&(c=d);return c},mD=function(a){a.a.debug("getTextStreams()",a.f);if(a.f){var b=[],c=a.f.periods;a.a.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.a.debug(c[d].startTime,a.l.getPosition()),c[d].startTime<=a.l.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.wg(String(c++),_.L);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.zt;var f=new _.Dg(String(a[d].id),e);
12
- f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},nD=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.g){var b=_.ax(a.g,_.re),c=null;if(b){a=mD(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},oD=function(a,b){a.a.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.f&&a.g)){a.setTextVisibility(!0);var c=lD(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)==
13
- d.id}))?(a.w?(a.a.debug("Switching period defer text selection"),a.m=c):(_.ix(a.g,c,!0,0),a.l.trigger(new _.D(_.Hh))),a.o=c.language):a.a.error(_.kt,d.id)}},pD=function(){this.h=this.f=this.l=null;this.g={};this.a=new _.C("clpp.tizen.TrackManager");this.w=this.m=this.j=null;this.A=!1;this.o=1},qD=function(a,b){a.l.trigger(new _.D(_.Ke,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.f.o}}))},rD=function(a){var b=a.fa();b&&a.l.trigger(new _.D(_.gc,{detail:{width:b.width,
14
- height:b.height,bandwidth:b.bandwidth,rendition:b}}))},sD=function(a){var b=a.l.getConfiguration(),c=_.vh(b.preferredAudioLanguage||[]),d=a.g[_.N]||[];if(d.length){var e=null;c.some(function(g){e=_.Kt(g,d.map(function(k){return k.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)}),0<f.length&&(c=f[0]));a.a.debug("Setting audio track with preferred language:",
15
- e);a.ma(c)}else a.a.debug("Preferred language(s) not available")}else a.a.debug("Could not set preferred audio language")},wD=function(a,b){if(b){var c=b.track.type.toUpperCase();tD(a.f,c,Number(b.id)).then(function(){c===uD&&(a.j=b,a.l.trigger(new _.D(_.Gh)));c===vD&&(a.m=b,a.l.trigger(new _.D(_.Hh)))})["catch"](function(){a.a.error("Could not select "+c+" track.")})}else a.a.debug("Must provide valid rendition")},xD=function(a,b,c){var d=_.rh(b.language||_.xe);c.language=_.xg(d);c.channelsCount=
16
- b.channels?Number(b.channels):null;c.mimeType=_.cc;a=new _.Dg(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},yD=function(a,b,c){c.mimeType=_.Ie;a=new _.Dg(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},zD=function(a,b,c){b=_.rh(b.track_lang||_.xe);c.mimeType="text/ttml";c.language=_.xg(b);c.kind=_.zt;return new _.Dg(String(a),c)},AD=function(a,b){var c=null;try{c=
17
- JSON.parse(b)}catch(d){a.a.warn("Couldn't retrieve extra infos from stream."),c=null}return c},DD=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===BD}),f=b.filter(function(n){return n.type===uD}),g=[],k=0;k<f.length;k++){var l=AD(a,f[k].extra_info);if(l){var m=_.rh(l.language||_.xe);m=_.xg(m);m=c(g,m);m||(m=new _.wg(String(a.o++),_.N),g.push(m));m.renditions.push(xD(f[k].index,
18
- l,m))}else a.a.warn("Skipping audio stream with no extra info")}f=new _.wg(String(a.o++),_.yg);for(k=0;k<e.length;k++)(l=AD(a,e[k].extra_info))?f.renditions.push(yD(e[k].index,l,f)):a.a.warn("Skipping video stream with no extra info");e=[];e=a.h?mD(a.h):CD(a,b);d[_.yg]=[f];d[_.N]=g;d[_.L]=e;return d},CD=function(a,b){for(var c=b.filter(function(k){return k.type===vD}),d=[],e=0;e<c.length;e++){var f=AD(a,c[e].extra_info);if(f){var g=new _.wg(String(a.o++),_.L);g.renditions.push(zD(c[e].index,f,g));
19
- d.push(g)}else a.a.warn("Skipping text stream with no extra info")}return d},ED=function(a,b){for(var c=a.g[_.yg]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.H.Oa(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},FD=function(a,b,c){a=a.g[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===b){c=a[d].renditions[e];break}return c},HD=function(a,b){if(b===_.L&&a.h)return nD(a.h);
20
- var c=GD(a.f)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.yg&&(d=AD(a,c.extra_info),d=ED(a,{width:d.Width,height:d.Height}));b===_.N&&(c?(d=FD(a,c,_.N),a.j=d):d=a.j);b===_.L&&(c?(d=FD(a,c,_.L),a.m=d):d=a.m);return d},ID=function(a){_.Mh.call(this);this.l=a;this.h=null;this.a=new _.C("clpp.tizen.Middleware");this.C=1;this.B=!1;this.m=null;this.D=0;this.o=!0;this.g=!1;this.f=null;this.A=1;this.w=!1;this.j={}},JD=function(a){return _.z(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",
21
- function(c){a.A=c.resolutionWidth/1920;a.a.debug("Display resolution ratio: ",a.A)},function(c){a.a.debug("Could not load DISPLAY property");throw c;});_.w(b)})},LD=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Bh.bind(a),onbufferingprogress:a.Ah.bind(a),onbufferingcomplete:a.zh.bind(a),onstreamcompleted:a.Eh.bind(a),oncurrentplaytime:function(b){a.trigger(new _.D(KD,{currentTime:b}))},onevent:a.Dh.bind(a),onsubtitlechange:a.Fh.bind(a),ondrmevent:a.Ch.bind(a),onerror:a.S.bind(a)})}catch(b){a.a.error(b)}},
22
- MD=function(a){var b=!!a.l.getTrackManager().Ba();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.a.debug("Could not set AVPlay subtitle config",c)}},ND=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.a.debug({estimatedBandwidth:c,Yj:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",SC+d)}catch(e){a.a.debug(e)}},OD=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+SC+b)}catch(c){throw a.a.debug("Could not set fixed bandwdth",
23
- c),c;}},RD=function(a){return{position:a.getPosition(),state:a.l.getState(),$e:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:PD(a),volume:a.getVolume(),Cj:QD(a),Rh:GD(a)}},TD=function(a){var b,c;return _.z(function(d){if(1==d.a)return _.v(d,SD(),2);if(3!=d.a)return b=new Promise(function(e){(new _.nh(e)).Z(5)}),_.v(d,Promise.race([JD(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.a.debug("Took to long for the SDK to be ready"),
24
- d["return"](Promise.reject("SDK Timeout"));_.w(d)})},ZD=function(a,b,c){var d,e,f,g,k,l,m,n;return _.z(function(p){switch(p.a){case 1:a.m=_.Ql(b);d=a.D;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.a.debug("Loading manifest URL: "+a.m[d].url);f=b.startTime||void 0;a.g&&(a.trigger(new _.D(UD)),f=c.currentPosition);_.pf(p,2);g=a.m[d].url;k=a.m[d].type;k!==_.Rb||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);
25
- e.nextBandwidth?(OD(a,e.nextBandwidth),a.o=!1):(a.o||ND(a,e),a.o=!0);LD(a);if(!b.drm||!b.drm.env){a.a.debug("No DRM configuration was provided. Assuming clear content");p.G(4);break}m={onError:function(q){return a.l.onError(q)},wb:a.l.getNetworkEngine()};a.h=new UC(b.drm,m);return _.v(p,a.h.init(),4);case 4:return a.g||a.trigger(new _.D(VD)),_.v(p,WD(a),6);case 6:a.g||a.trigger(new _.D(XD));f&&typeof f===_.zd&&0<f&&a.seek(f)["catch"](function(q){a.a.debug("Couldn't set start position",q)});a.g||(b.volume&&
26
- a.setVolume(b.volume),b.muted&&YD(a,b.muted),b.autoplay&&a.l.play()["catch"](function(q){a.a.debug("Autoplay failed",q)}));_.qf(p,0);break;case 2:throw n=_.rf(p),a.a.debug("Error while attempting to load source."),n;}})},WD=function(a){return _.z(function(b){a.a.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.a.debug("AVPlay is ready!");MD(a);c()},function(e){a.a.debug("prepareAsync failed",e);d(e)})}catch(e){a.a.debug("Failed to prepare media player for playback"),
27
- d(e)}}))})},$D=function(a,b,c){a.a.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.f=RD(a);a.g=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.l.getConfiguration(),d).then(function(){var e=a.f.$e;a.g=!1;a.f=null;return e===eD?a.pause():a.play()})}catch(e){return Promise.reject(e)}},QD=function(a){return a.g&&a.f?a.f.Cj:webapis.avplay.getTotalTrackInfo()},
28
- GD=function(a){return a.g&&a.f?a.f.Rh:webapis.avplay.getCurrentStreamInfo()},tD=function(a,b,c){b=b.toUpperCase();b===vD&&aE(a,!0);var d=a.j[b];d&&(d.Fd.stop(),a.j[b]=null,a.a.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(k,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(k,l),a.j[k]=null,e()}catch(n){a.a.debug("Could not set "+k+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[k]={type:k,index:l,Ye:0,
29
- Fd:new _.nh(function(){return g(k,c,!0)})}),(l=a.j[k])&&3>l.Ye?(!a.w&&++l.Ye,l.Fd.Z(a.w?.5:.25)):(a.a.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Fd.stop(),a.j[k]=null,f())}}g(b,c)})},aE=function(a,b){var c=a.l.getTextDisplayer();c&&c.setTextVisibility(b);c=a.l.g;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.a.debug("Could not set text track visibility",d)}},YD=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case QC:a.a.warn("The application does not have the privilege to set mute.",
30
- RC);break;default:a.a.warn(NC,c)}}},PD=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case QC:a.a.warn("The application doesn't have the privilege to get the mute state.",RC);break;default:a.a.warn(NC,c)}}return!!b},SD=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");TC(c,"load",function(d){return a(d)});TC(c,_.Wc,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},
31
- bE=function(){_.Mh.call(this);this.a=new ID(this);this.f=new aD(this);this.configuration=this.B=_.Ri();this.w=null;this.h=new _.C("clpp.tizen.Player");this.j=null;this.m=new pD;this.C=new _.ji;this.o=this.g=null;this.A=!1},cE=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*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.a.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,
32
- d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.h.debug("Could not apply dimension. Player state "+a.a.getState())},dE=function(){},eE=function(){this.a=null};
33
- UC.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.z(function(k){if(1==k.a){b=_.oj[a.h.env]||null;if(!b)throw a.g.debug(_.ra,_.$a+a.h.env+_.aa),new _.J(_.K,6,6015,_.sa+a.h.env+"' is missing.");a.o={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.qj(b,a.h.customData);(e=d[_.Ec])&&a.f.set(_.Ec,{Wc:e.licenseUrl||"",customData:c,Fe:!1});(f=d[_.Fc])&&a.f.set(_.Fc,{Wc:f.licenseUrl||"",customData:c,
34
- Fe:!1});if(0===a.f.size)throw new _.J(_.K,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Ec))a.a=_.Ec;else if(a.f.get(_.Fc))a.a=_.Fc;else throw new _.J(_.K,6,6001,"Configuration for the target system is missing.");return _.v(k,XC(a),2)}a.j=!0;_.w(k)})};UC.prototype.release=function(){var a=this;return _.z(function(b){a.j=!1;a.w=null;a.a=_.yd;a.o=null;a.f=new Map;_.w(b)})};UC.prototype.getDrmInfo=function(){return this.w};
35
- var ZC={kg:"DeleteLicenseAfterUse",lg:"LicenseServer",Mj:"GetChallenge",Nj:"HttpHeader",Rj:"UserAgent",Ij:"Cookie",jg:"CustomData"};_.h=aD.prototype;_.h.release=function(){cD(this,_.yl);this.m=!1;this.o=-1;this.h=2};_.h.destroy=function(){this.release();this.a.off(UD,this.mf);this.a.off(fE,this.lf);this.a.off(gE,this.kf);this.a.off(VD,this.Vf);this.a.off(XD,this.Uf);this.a.off(hE,this.nf);this.l=this.a=null};_.h.mf=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;cD(this,_.Dl)};_.h.lf=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",bD(this.f))};
36
- _.h.kf=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.m){this.m=!0;var a=this.l.getConfiguration().autoplay,b=this.a.getState()===iE;if(!a&&b){cD(this,_.Ll);return}}if(a=this.f!==_.Kl)a=this.a.getState(),a=a===dD||a===eD;a&&fD(this)};_.h.Vf=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===jE?cD(this,_.Kl):this.g.error("AVPlay prepares while state is not IDLE")};
37
- _.h.Uf=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.h.nf=function(){cD(this,_.Fl)};_.h.getState=function(){return this.f};_.h=gD.prototype;
38
- _.h.load=function(a){var b=this,c,d,e,f,g,k,l;return _.z(function(m){switch(m.a){case 1:if(!b.l)return b.a.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.v(m,iD(b),2);case 2:c.j=m.f;if(!b.j)return b.a.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={networkingEngine:b.l.getNetworkEngine(),filterNewPeriod:function(){},filterAllPeriods:function(){},onTimelineCueAdded:function(){},onEvent:function(){},onError:function(){}};
39
- _.pf(m,3);e=b;return _.v(m,b.j.start(a.url,d),5);case 5:e.f=m.f;_.qf(m,4);break;case 3:return f=_.rf(m),b.a.warn(f),_.pf(m,6),g=b,_.v(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.f=m.f;_.qf(m,4);break;case 6:k=_.rf(m),b.a.error(k),b.f=null;case 4:if(!b.f||!hD(b.f)){m.G(0);break}b.h=jD(b);_.pf(m,10);return _.v(m,b.h.H,12);case 12:b.g=kD(b);l=b.l.getConfiguration();b.g.m=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;_.qf(m,0);break;case 10:_.rf(m),b.a.debug("Could not setup media source..."),
40
- b.h=null,b.g=null,b.j=null,b.f=null,_.w(m)}})};_.h.Hh=function(a){this.a.debug(_.ut,a);this.w=!0;var b=_.Hv(a.textStreams,this.o||"",this.A||"")[0]||null;this.m&&(a.textStreams.includes(this.m)&&(b=this.m),this.m=null);return{variant:null,text:b}};_.h.Gh=function(){this.a.debug("canSwitch_");this.w=!1;this.m&&(_.ix(this.g,this.m,!0,0),this.m=null)};_.h.S=function(){this.a.debug("onError_")};_.h.Ih=function(){this.j&&this.j.update&&this.j.update()};
2
+ var f=function(window){var jD="An unknown error occurred while trying to get volume",kD="Cannot get loading rendition due to platform limitations",lD="PARAM_START_POSITION",mD="SecurityError",nD="The require privilege is: http://tizen.org/privilege/tv.audio",oD="|STARTBITRATE\x3d",pD=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},qD=function(a,b){this.h=a;this.w=null;this.a=_.yd;this.o=null;this.j=!1;this.f=new Map;this.m=b;this.g=new _.D("clpp.tizen.DrmEngine")},tD=function(a){var b,
3
+ c,d;return _.z(function(e){if(1==e.a){b=a.a===_.Fc||a.a===_.Ec;if(!b)throw new _.J(_.K,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Xc)throw new _.J(_.K,6,6012,"No license server given for "+a.a);_.qf(e,2);return a.a===_.Fc?_.v(e,rD(a),5):_.v(e,sD(a,c),5)}if(2!=e.a)return a.w={keySystem:a.a,licenseServerUri:c.Xc,distinctiveIdentifierRequired:!1,persistentStateRequired:c.He,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
+ keyIds:[],periodId:null},_.rf(e,0);d=_.sf(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.J(_.K,6,6005,{message:JSON.stringify(d)});})},sD=function(a,b){var c,d,e,f;return _.z(function(g){c=uD;d=vD;e={};e[d.ng]=!b.He;e[d.og]=b.Xc;""!==b.customData&&(e[d.mg]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(k){throw k;}_.w(g)})},rD=function(a){var b;return _.z(function(c){b=uD;try{webapis.avplay.setDrm(b.hd,
5
+ "Initialize",""),webapis.avplay.setDrm(b.hd,"widevine_app_session",a.o.id),webapis.avplay.setDrm(b.hd,"widevine_data_type",a.o.type)}catch(d){throw d;}_.w(c)})},wD=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,r,x,y,C,I,F;_.z(function(G){if(1==G.a){c=uD;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);k=b.serverurl&&""!==b.serverurl?b.serverurl:d.Xc;l=_.gh([k],_.dh());l.type=3;l.body=f.buffer;l.method=
6
+ "POST";_.qf(G,2);return _.v(G,a.m.wb.fetch(l).N,4)}if(2!=G.a){m=G.f;if(a.j){n=_.Q(m.data);p=n.byteLength;q="";for(r=0;r<p;r++)q+=String.fromCharCode(n[r]);x=btoa(q);y=b.session_id+lD+(x+lD);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.hd,"widevine_license_data",y)}catch(M){a.g.error("License response rejected by CDM"),C=new _.J(_.K,6,6008,{browserError:JSON.stringify(M)}),a.m.onError(C)}}return _.rf(G,0)}I=_.sf(G);a.g.error("License request failed.",JSON.stringify(I));F=new _.J(_.K,
7
+ 6,6007,{message:_.Aa,url:I.data.url,status:I.data.status||NaN,response:I.data.response||"",headers:I.data.headers||{}},I);a.m.onError(F);_.w(G)})},xD=function(a){this.l=a;this.a=this.l.a;this.f=_.zl;this.j=_.Al;this.w=(new Date).getTime();this.m=!1;this.o=-1;this.h=2;this.g=new _.D("clpp.tizen.StateManager")},zD=function(a,b){if(a.f!==b)if(a.f===_.Kl&&b!==_.zl)a.g.debug(_.Ht+yD(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.El?(a.o=(new Date).getTime(),a.l.trigger(new _.E(_.jc,{detail:{bufferedTimeMS:-1,
8
+ reason:a.h}}))):a.j===_.El&&a.l.trigger(new _.E(_.ic,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.l.trigger(new _.E(_.he,{detail:d}));a.g.debug("State changed:",yD(a.j),"-\x3e",yD(a.f))}},yD=function(a){return Object.keys(_.Il)[a]},CD=function(a){if(a.m){var b=a.a.getState(),c=a.f;switch(b){case AD:c=_.Nl;break;case BD:c=_.Ml;break;default:a.l.isEnded()?c=_.Gl:a.g.debug("Inconsistent AVPlay playback state:",b)}zD(a,
9
+ c)}},DD=function(){this.o=this.A=this.g=this.h=this.B=this.l=this.j=this.f=null;this.w=!0;this.m=null;this.a=new _.D("clpp.tizen.TextStreamer")},ED=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},FD=function(a){var b,c;return _.z(function(d){if(1==d.a)return b=a.l.getConfiguration(),c=null,_.v(d,_.io(a.B.url,a.l.getNetworkEngine(),b.manifest.attemptParameters,a.B.type),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},GD=function(a){var b=
10
+ document.createElement(_.He),c=new _.qv,d=new _.qu(function(){return null}),e=a.l.getTextDisplayer();return new _.xv(b,c,e,d,a.l.getConfiguration())},HD=function(a){var b={qb:function(){return a.l.getPosition()},X:a.h,wb:a.l.getNetworkEngine(),Ae:a.Kh.bind(a),ze:a.Jh.bind(a),onError:a.S.bind(a),Of:function(){},onEvent:function(){},Tf:a.Lh.bind(a),Ed:function(){},fe:function(){return new _.Aw}};return new _.ux(a.f,b)},ID=function(a){var b=a.l.getPosition(),c=null;a=_.t(a.f.periods);for(var d=a.next();!d.done;d=
11
+ a.next())d=d.value,d.startTime<=b&&(c=d);return c},JD=function(a){a.a.debug("getTextStreams()",a.f);if(a.f){var b=[],c=a.f.periods;a.a.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.a.debug(c[d].startTime,a.l.getPosition()),c[d].startTime<=a.l.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.xg(String(c++),_.L);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.Ut;var f=new _.Eg(String(a[d].id),e);
12
+ f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},KD=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.g){var b=_.vx(a.g,_.se),c=null;if(b){a=JD(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},LD=function(a,b){a.a.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.f&&a.g)){a.setTextVisibility(!0);var c=ID(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)==
13
+ d.id}))?(a.w?(a.a.debug("Switching period defer text selection"),a.m=c):(_.Dx(a.g,c,!0,0),a.l.trigger(new _.E(_.Ih))),a.o=c.language):a.a.error(_.Gt,d.id)}},MD=function(){this.h=this.f=this.l=null;this.g={};this.a=new _.D("clpp.tizen.TrackManager");this.w=this.m=this.j=null;this.A=!1;this.o=1},ND=function(a,b){a.l.trigger(new _.E(_.Le,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.f.o}}))},OD=function(a){var b=a.fa();b&&a.l.trigger(new _.E(_.fc,{detail:{width:b.width,
14
+ height:b.height,bandwidth:b.bandwidth,rendition:b}}))},PD=function(a){var b=a.l.getConfiguration(),c=_.wh(b.preferredAudioLanguage||[]),d=a.g[_.N]||[];if(d.length){var e=null;c.some(function(g){e=_.eu(g,d.map(function(k){return k.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)}),0<f.length&&(c=f[0]));a.a.debug("Setting audio track with preferred language:",
15
+ e);a.na(c)}else a.a.debug("Preferred language(s) not available")}else a.a.debug("Could not set preferred audio language")},TD=function(a,b){if(b){var c=b.track.type.toUpperCase();QD(a.f,c,Number(b.id)).then(function(){c===RD&&(a.j=b,a.l.trigger(new _.E(_.Hh)));c===SD&&(a.m=b,a.l.trigger(new _.E(_.Ih)))})["catch"](function(){a.a.error("Could not select "+c+" track.")})}else a.a.debug("Must provide valid rendition")},UD=function(a,b,c){var d=_.sh(b.language||_.ye);c.language=_.yg(d);c.channelsCount=
16
+ b.channels?Number(b.channels):null;c.mimeType=_.cc;a=new _.Eg(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},VD=function(a,b,c){c.mimeType=_.Je;a=new _.Eg(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},WD=function(a,b,c){b=_.sh(b.track_lang||_.ye);c.mimeType="text/ttml";c.language=_.yg(b);c.kind=_.Ut;return new _.Eg(String(a),c)},XD=function(a,b){var c=null;try{c=
17
+ JSON.parse(b)}catch(d){a.a.warn("Couldn't retrieve extra infos from stream."),c=null}return c},$D=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===YD}),f=b.filter(function(n){return n.type===RD}),g=[],k=0;k<f.length;k++){var l=XD(a,f[k].extra_info);if(l){var m=_.sh(l.language||_.ye);m=_.yg(m);m=c(g,m);m||(m=new _.xg(String(a.o++),_.N),g.push(m));m.renditions.push(UD(f[k].index,
18
+ l,m))}else a.a.warn("Skipping audio stream with no extra info")}f=new _.xg(String(a.o++),_.zg);for(k=0;k<e.length;k++)(l=XD(a,e[k].extra_info))?f.renditions.push(VD(e[k].index,l,f)):a.a.warn("Skipping video stream with no extra info");e=[];e=a.h?JD(a.h):ZD(a,b);d[_.zg]=[f];d[_.N]=g;d[_.L]=e;return d},ZD=function(a,b){for(var c=b.filter(function(k){return k.type===SD}),d=[],e=0;e<c.length;e++){var f=XD(a,c[e].extra_info);if(f){var g=new _.xg(String(a.o++),_.L);g.renditions.push(WD(c[e].index,f,g));
19
+ d.push(g)}else a.a.warn("Skipping text stream with no extra info")}return d},aE=function(a,b){for(var c=a.g[_.zg]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.H.Oa(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},bE=function(a,b,c){a=a.g[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===b){c=a[d].renditions[e];break}return c},dE=function(a,b){if(b===_.L&&a.h)return KD(a.h);
20
+ var c=cE(a.f)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.zg&&(d=XD(a,c.extra_info),d=aE(a,{width:d.Width,height:d.Height}));b===_.N&&(c?(d=bE(a,c,_.N),a.j=d):d=a.j);b===_.L&&(c?(d=bE(a,c,_.L),a.m=d):d=a.m);return d},eE=function(a){_.Nh.call(this);this.l=a;this.h=null;this.a=new _.D("clpp.tizen.Middleware");this.C=1;this.B=!1;this.m=null;this.D=0;this.o=!0;this.g=!1;this.f=null;this.A=1;this.w=!1;this.j={}},fE=function(a){return _.z(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",
21
+ function(c){a.A=c.resolutionWidth/1920;a.a.debug("Display resolution ratio: ",a.A)},function(c){a.a.debug("Could not load DISPLAY property");throw c;});_.w(b)})},hE=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Eh.bind(a),onbufferingprogress:a.Dh.bind(a),onbufferingcomplete:a.Ch.bind(a),onstreamcompleted:a.Hh.bind(a),oncurrentplaytime:function(b){a.trigger(new _.E(gE,{currentTime:b}))},onevent:a.Gh.bind(a),onsubtitlechange:a.Ih.bind(a),ondrmevent:a.Fh.bind(a),onerror:a.S.bind(a)})}catch(b){a.a.error(b)}},
22
+ iE=function(a){var b=!!a.l.getTrackManager().Ca();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.a.debug("Could not set AVPlay subtitle config",c)}},jE=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.a.debug({estimatedBandwidth:c,hk:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",oD+d)}catch(e){a.a.debug(e)}},kE=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+oD+b)}catch(c){throw a.a.debug("Could not set fixed bandwidth",
23
+ c),c;}},nE=function(a){return{position:a.getPosition(),state:a.l.getState(),bf:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:lE(a),volume:a.getVolume(),Kj:mE(a),Uh:cE(a)}},pE=function(a){var b,c;return _.z(function(d){if(1==d.a)return _.v(d,oE(),2);if(3!=d.a)return b=new Promise(function(e){(new _.oh(e)).$(5)}),_.v(d,Promise.race([fE(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.a.debug("Took to long for the SDK to be ready"),
24
+ d["return"](Promise.reject("SDK Timeout"));_.w(d)})},vE=function(a,b,c){var d,e,f,g,k,l,m,n;return _.z(function(p){switch(p.a){case 1:a.m=_.Rl(b);d=a.D;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.a.debug("Loading manifest URL: "+a.m[d].url);f=b.startTime||void 0;a.g&&(a.trigger(new _.E(qE)),f=c.currentPosition);_.qf(p,2);g=a.m[d].url;k=a.m[d].type;k!==_.Rb||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);
25
+ e.nextBandwidth?(kE(a,e.nextBandwidth),a.o=!1):(a.o||jE(a,e),a.o=!0);hE(a);if(!b.drm||!b.drm.env){a.a.debug("No DRM configuration was provided. Assuming clear content");p.H(4);break}m={onError:function(q){return a.l.onError(q)},wb:a.l.getNetworkEngine()};a.h=new qD(b.drm,m);return _.v(p,a.h.init(),4);case 4:return a.g||a.trigger(new _.E(rE)),_.v(p,sE(a),6);case 6:a.g||a.trigger(new _.E(tE));f&&typeof f===_.zd&&0<f&&a.seek(f)["catch"](function(q){a.a.debug("Couldn't set start position",q)});a.g||(b.volume&&
26
+ a.setVolume(b.volume),b.muted&&uE(a,b.muted),b.autoplay&&a.l.play()["catch"](function(q){a.a.debug("Autoplay failed",q)}));_.rf(p,0);break;case 2:throw n=_.sf(p),a.a.debug("Error while attempting to load source."),n;}})},sE=function(a){return _.z(function(b){a.a.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.a.debug("AVPlay is ready!");iE(a);c()},function(e){a.a.debug("prepareAsync failed",e);d(e)})}catch(e){a.a.debug("Failed to prepare media player for playback"),
27
+ d(e)}}))})},wE=function(a,b,c){a.a.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.f=nE(a);a.g=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.l.getConfiguration(),d).then(function(){var e=a.f.bf;a.g=!1;a.f=null;return e===BD?a.pause():a.play()})}catch(e){return Promise.reject(e)}},mE=function(a){return a.g&&a.f?a.f.Kj:webapis.avplay.getTotalTrackInfo()},
28
+ cE=function(a){return a.g&&a.f?a.f.Uh:webapis.avplay.getCurrentStreamInfo()},QD=function(a,b,c){b=b.toUpperCase();b===SD&&xE(a,!0);var d=a.j[b];d&&(d.Hd.stop(),a.j[b]=null,a.a.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(k,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(k,l),a.j[k]=null,e()}catch(n){a.a.debug("Could not set "+k+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[k]={type:k,index:l,$e:0,
29
+ Hd:new _.oh(function(){return g(k,c,!0)})}),(l=a.j[k])&&3>l.$e?(!a.w&&++l.$e,l.Hd.$(a.w?.5:.25)):(a.a.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Hd.stop(),a.j[k]=null,f())}}g(b,c)})},xE=function(a,b){var c=a.l.getTextDisplayer();c&&c.setTextVisibility(b);c=a.l.g;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.a.debug("Could not set text track visibility",d)}},uE=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case mD:a.a.warn("The application does not have the privilege to set mute.",
30
+ nD);break;default:a.a.warn(jD,c)}}},lE=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case mD:a.a.warn("The application doesn't have the privilege to get the mute state.",nD);break;default:a.a.warn(jD,c)}}return!!b},oE=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");pD(c,"load",function(d){return a(d)});pD(c,_.Vc,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},
31
+ yE=function(){_.Nh.call(this);this.a=new eE(this);this.f=new xD(this);this.configuration=this.B=_.Si();this.w=null;this.h=new _.D("clpp.tizen.Player");this.j=null;this.m=new MD;this.C=new _.ki;this.o=this.g=null;this.A=!1},zE=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*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.a.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,
32
+ d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.h.debug("Could not apply dimension. Player state "+a.a.getState())},AE=function(){},BE=function(){this.a=null};
33
+ qD.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.z(function(k){if(1==k.a){b=_.pj[a.h.env]||null;if(!b)throw a.g.debug(_.ra,_.$a+a.h.env+_.aa),new _.J(_.K,6,6015,_.sa+a.h.env+"' is missing.");a.o={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.rj(b,a.h.customData);(e=d[_.Ec])&&a.f.set(_.Ec,{Xc:e.licenseUrl||"",customData:c,He:!1});(f=d[_.Fc])&&a.f.set(_.Fc,{Xc:f.licenseUrl||"",customData:c,
34
+ He:!1});if(0===a.f.size)throw new _.J(_.K,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Ec))a.a=_.Ec;else if(a.f.get(_.Fc))a.a=_.Fc;else throw new _.J(_.K,6,6001,"Configuration for the target system is missing.");return _.v(k,tD(a),2)}a.j=!0;_.w(k)})};qD.prototype.release=function(){var a=this;return _.z(function(b){a.j=!1;a.w=null;a.a=_.yd;a.o=null;a.f=new Map;_.w(b)})};qD.prototype.getDrmInfo=function(){return this.w};
35
+ var vD={ng:"DeleteLicenseAfterUse",og:"LicenseServer",Vj:"GetChallenge",Wj:"HttpHeader",ak:"UserAgent",Rj:"Cookie",mg:"CustomData"};_.h=xD.prototype;_.h.release=function(){zD(this,_.zl);this.m=!1;this.o=-1;this.h=2};_.h.destroy=function(){this.release();this.a.off(qE,this.pf);this.a.off(CE,this.nf);this.a.off(DE,this.mf);this.a.off(rE,this.Vf);this.a.off(tE,this.Uf);this.a.off(EE,this.qf);this.l=this.a=null};_.h.pf=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;zD(this,_.El)};_.h.nf=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",yD(this.f))};
36
+ _.h.mf=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.m){this.m=!0;var a=this.l.getConfiguration().autoplay,b=this.a.getState()===FE;if(!a&&b){zD(this,_.Ml);return}}if(a=this.f!==_.Ll)a=this.a.getState(),a=a===AD||a===BD;a&&CD(this)};_.h.Vf=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===GE?zD(this,_.Ll):this.g.error("AVPlay prepares while state is not IDLE")};
37
+ _.h.Uf=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.h.qf=function(){zD(this,_.Gl)};_.h.getState=function(){return this.f};_.h=DD.prototype;
38
+ _.h.load=function(a){var b=this,c,d,e,f,g,k,l;return _.z(function(m){switch(m.a){case 1:if(!b.l)return b.a.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.v(m,FD(b),2);case 2:c.j=m.f;if(!b.j)return b.a.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={networkingEngine:b.l.getNetworkEngine(),filterNewPeriod:function(){},filterAllPeriods:function(){},onTimelineCueAdded:function(){},onEvent:function(){},onError:function(){}};
39
+ _.qf(m,3);e=b;return _.v(m,b.j.start(a.url,d),5);case 5:e.f=m.f;_.rf(m,4);break;case 3:return f=_.sf(m),b.a.warn(f),_.qf(m,6),g=b,_.v(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.f=m.f;_.rf(m,4);break;case 6:k=_.sf(m),b.a.error(k),b.f=null;case 4:if(!b.f||!ED(b.f)){m.H(0);break}b.h=GD(b);_.qf(m,10);return _.v(m,b.h.G,12);case 12:b.g=HD(b);l=b.l.getConfiguration();b.g.m=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;_.rf(m,0);break;case 10:_.sf(m),b.a.debug("Could not setup media source..."),
40
+ b.h=null,b.g=null,b.j=null,b.f=null,_.w(m)}})};_.h.Kh=function(a){this.a.debug(_.Qt,a);this.w=!0;var b=_.bw(a.textStreams,this.o||"",this.A||"")[0]||null;this.m&&(a.textStreams.includes(this.m)&&(b=this.m),this.m=null);return{variant:null,text:b}};_.h.Jh=function(){this.a.debug("canSwitch_");this.w=!1;this.m&&(_.Dx(this.g,this.m,!0,0),this.m=null)};_.h.S=function(){this.a.debug("onError_")};_.h.Lh=function(){this.j&&this.j.update&&this.j.update()};
41
41
  _.h.start=function(){var a=this;return _.z(function(b){if(!a.g)return b["return"]();try{a.g.start()}catch(c){a.a.error("Error while starting streaming engine",c)}_.w(b)})};_.h.setTextVisibility=function(a){this.a.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.h.release=function(){var a=this;return _.z(function(b){a.l=null;a.f=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.m=null;_.w(b)})};
42
- _.h.destroy=function(){var a=this;return _.z(function(b){switch(b.a){case 1:if(!a.j){b.G(2);break}return _.v(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.g){b.G(4);break}return _.v(b,a.g.destroy(),5);case 5:a.g=null,a.w=!0;case 4:if(!a.h){b.G(0);break}return _.v(b,a.h.destroy(),7);case 7:a.h=null,_.w(b)}})};_.u(pD,_.P);_.h=pD.prototype;_.h.Lf=function(a){var b=a.eventid;a=a.data;switch(b){case kE:0<Object.keys(this.g).length||(this.a.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+AD(this,b[0].extra_info).Bit_rate,b=ED(this,{bandwidth:b}))&&(this.w=b,qD(this,b));break;case lE:rD(this);break;default:this.a.debug("Event type: "+b+" data: "+a)}};_.h.Be=function(a){a.detail.currentState===_.Ml&&this.l.off(_.he,this.Be)};
43
- _.h.Fb=function(a){var b=this;this.l=a;this.f=this.l.a;this.l.on(_.he,function(c){b.A||(c=c.detail,c.currentState===_.Ml&&(b.a.debug("Current state",c.currentState),b.A=!0,sD(b)))});this.f.on(mE,this.Lf,this)};_.h.release=function(){this.g={};this.h=this.w=this.m=this.j=null;this.A=!1;this.o=1};
44
- _.h.load=function(){if(this.f&&!(0<Object.keys(this.g).length)){this.h=this.l.g;this.l.off(_.he,this.Be);this.l.on(_.he,this.Be,this);try{var a=QD(this.f);this.g=DD(this,a);var b=this.g[_.N]||[];b.length&&(this.j=b[0].renditions[0]||null);rD(this)}catch(c){this.a.debug("Could not load track manager")}}};_.h.destroy=function(){this.f.off(mE,this.Lf);this.f=this.l=null};_.h.getVideoTracks=function(){return this.g[_.yg]||[]};_.h.getAudioTracks=function(){return this.g[_.N]||[]};
45
- _.h.ea=function(){return this.g[_.L]||[]};_.h.fa=function(){return HD(this,_.yg)};_.h.za=function(){return HD(this,_.N)};_.h.Ba=function(){return HD(this,_.L)};_.h.Pa=function(){return this.w};_.h.Ya=function(){this.a.info(OC);return null};_.h.Za=function(){this.a.info(OC);return null};_.h.Ca=function(){var a=this.fa();return a?a.track:null};_.h.ha=function(){var a=this.za();return a?a.track:null};_.h.ia=function(){var a=this.Ba();return a?a.track:null};
46
- _.h.Va=function(a){var b=this;null===a?(a=this.fa(),$D(this.f,a.bandwidth,null).then(function(){rD(b)})):0<a.renditions.length&&this.Ua(a.renditions[0])};_.h.ma=function(a){a?wD(this,a.renditions[0]):this.a.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.h.ua=function(a){a?(a=a.renditions[0],this.h?oD(this.h,a.track):wD(this,a)):(this.a.debug("Disabling text tracks"),this.m=null,aE(this.f,!1),this.l.trigger(new _.D(_.Hh)))};
47
- _.h.Ua=function(a){var b=this,c=this.fa();this.f.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,qD(this,a),$D(this.f,c.bandwidth,a.bandwidth).then(function(){rD(b)})["catch"](function(d){var e=new _.J(_.K,7,7200,{tizenerror:d});b.a.debug("Error while switching video track",d);b.l.onError(e)})):this.a.debug("Trying to switch to already active rendition. Doing nothing...")};_.h.gb=function(a){wD(this,a)};_.h.hb=function(a){this.h?oD(this.h,a.track):wD(this,a)};
48
- _.h.addTextTrack=function(){};_.h.ja=function(){return this.f.o};pD.prototype.isAbrEnabled=pD.prototype.ja;pD.prototype.addTextTrack=pD.prototype.addTextTrack;pD.prototype.setTextRendition=pD.prototype.hb;pD.prototype.setAudioRendition=pD.prototype.gb;pD.prototype.setVideoRendition=pD.prototype.Ua;pD.prototype.setTextTrack=pD.prototype.ua;pD.prototype.setAudioTrack=pD.prototype.ma;pD.prototype.setVideoTrack=pD.prototype.Va;pD.prototype.getTextTrack=pD.prototype.ia;pD.prototype.getAudioTrack=pD.prototype.ha;
49
- pD.prototype.getVideoTrack=pD.prototype.Ca;pD.prototype.getLoadingTextRendition=pD.prototype.Za;pD.prototype.getLoadingAudioRendition=pD.prototype.Ya;pD.prototype.getLoadingVideoRendition=pD.prototype.Pa;pD.prototype.getTextRendition=pD.prototype.Ba;pD.prototype.getAudioRendition=pD.prototype.za;pD.prototype.getVideoRendition=pD.prototype.fa;pD.prototype.getTextTracks=pD.prototype.ea;pD.prototype.getAudioTracks=pD.prototype.getAudioTracks;pD.prototype.getVideoTracks=pD.prototype.getVideoTracks;_.u(ID,_.Mh);_.h=ID.prototype;_.h.Bh=function(){this.w=!0;this.g||this.trigger(new _.D(UD))};_.h.Ah=function(a){this.w=!0;this.trigger(new _.D(fE,{percent:a}))};_.h.zh=function(){this.w=!1;this.trigger(new _.D(gE))};_.h.Eh=function(){this.trigger(new _.D(hE))};_.h.Dh=function(a,b){this.trigger(new _.D(mE,{eventid:a,data:b}))};_.h.Fh=function(a,b,c,d,e){this.trigger(new _.D(nE,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
- _.h.Ch=function(a,b){this.trigger(new _.D(oE,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Fc&&"Challenge"===b.name)$C(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.J(_.K,6,6005,{message:JSON.stringify(b)});c.m.onError(d)}}};_.h.S=function(a){this.trigger(new _.D(pE,{eventType:a}))};
51
- _.h.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(KD,f,b);g=setTimeout(function(){b.off(KD,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===jE)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){MD(b);d(webapis.avplay.play())},function(f){b.trigger(new _.D(pE));e(f)})})).then(function(){return a()});if(c===eD||c===iE)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===dD?
52
- Promise.resolve():Promise.reject("Player is in invalid state")};_.h.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===eD?Promise.resolve():Promise.reject()};
53
- _.h.setPlaybackRate=function(a){var b=this.getState();if(b===iE||b===dD||b===eD){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.a.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.a.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.h.getPlaybackRate=function(){return this.C};
54
- _.h.load=function(a,b){var c=this,d;return _.z(function(e){switch(e.a){case 1:return c.a.debug("configure()",b||""),_.pf(e,2),_.v(e,TD(c),4);case 4:return _.v(e,ZD(c,a,b),5);case 5:_.qf(e,0);break;case 2:throw d=_.rf(e),new _.J(_.K,7,7003,null,d);}})};_.h.getState=function(){if(this.g&&this.f)return this.f.$e;try{return webapis.avplay.getState()}catch(a){this.S(JSON.stringify(a))}};
55
- _.h.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.l.trigger(new _.D(_.Ce));webapis.avplay.seekTo(c,function(){b.B=!1;b.l.trigger(new _.D(_.Be));d()},function(){b.B=!1;e()})})};_.h.getPosition=function(){if(this.g&&this.f)return this.f.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.S(JSON.stringify(a))}};_.h.getDuration=function(){if(this.g&&this.f)return this.f.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.S(JSON.stringify(a))}};
56
- _.h.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.Fd.stop()}a.j={};a.C=1;a.B=!1;a.m=null;a.f=null;return b()}catch(f){return c(f)}})};_.h.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case QC:this.a.debug("The application does not have the privilege to get the volume.",RC);break;default:this.a.debug(NC,b)}}return a};
57
- _.h.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.a.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case QC:this.a.warn("The application does not have the privilege to set the volume.",RC);break;default:this.a.warn("An unknown error occured while trying to set volume",b)}}};
42
+ _.h.destroy=function(){var a=this;return _.z(function(b){switch(b.a){case 1:if(!a.j){b.H(2);break}return _.v(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.g){b.H(4);break}return _.v(b,a.g.destroy(),5);case 5:a.g=null,a.w=!0;case 4:if(!a.h){b.H(0);break}return _.v(b,a.h.destroy(),7);case 7:a.h=null,_.w(b)}})};_.u(MD,_.P);_.h=MD.prototype;_.h.Lf=function(a){var b=a.eventid;a=a.data;switch(b){case HE:0<Object.keys(this.g).length||(this.a.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+XD(this,b[0].extra_info).Bit_rate,b=aE(this,{bandwidth:b}))&&(this.w=b,ND(this,b));break;case IE:OD(this);break;default:this.a.debug("Event type: "+b+" data: "+a)}};_.h.De=function(a){a.detail.currentState===_.Nl&&this.l.off(_.he,this.De)};
43
+ _.h.Fb=function(a){var b=this;this.l=a;this.f=this.l.a;this.l.on(_.he,function(c){b.A||(c=c.detail,c.currentState===_.Nl&&(b.a.debug("Current state",c.currentState),b.A=!0,PD(b)))});this.f.on(JE,this.Lf,this)};_.h.release=function(){this.g={};this.h=this.w=this.m=this.j=null;this.A=!1;this.o=1};
44
+ _.h.load=function(){if(this.f&&!(0<Object.keys(this.g).length)){this.h=this.l.g;this.l.off(_.he,this.De);this.l.on(_.he,this.De,this);try{var a=mE(this.f);this.g=$D(this,a);var b=this.g[_.N]||[];b.length&&(this.j=b[0].renditions[0]||null);OD(this)}catch(c){this.a.debug("Could not load track manager")}}};_.h.destroy=function(){this.f.off(JE,this.Lf);this.f=this.l=null};_.h.getVideoTracks=function(){return this.g[_.zg]||[]};_.h.getAudioTracks=function(){return this.g[_.N]||[]};
45
+ _.h.ea=function(){return this.g[_.L]||[]};_.h.fa=function(){return dE(this,_.zg)};_.h.Aa=function(){return dE(this,_.N)};_.h.Ca=function(){return dE(this,_.L)};_.h.Pa=function(){return this.w};_.h.Ya=function(){this.a.info(kD);return null};_.h.Za=function(){this.a.info(kD);return null};_.h.Da=function(){var a=this.fa();return a?a.track:null};_.h.ia=function(){var a=this.Aa();return a?a.track:null};_.h.ja=function(){var a=this.Ca();return a?a.track:null};
46
+ _.h.Va=function(a){var b=this;null===a?(a=this.fa(),wE(this.f,a.bandwidth,null).then(function(){OD(b)})):0<a.renditions.length&&this.Ua(a.renditions[0])};_.h.na=function(a){a?TD(this,a.renditions[0]):this.a.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.h.ua=function(a){a?(a=a.renditions[0],this.h?LD(this.h,a.track):TD(this,a)):(this.a.debug("Disabling text tracks"),this.m=null,xE(this.f,!1),this.l.trigger(new _.E(_.Ih)))};
47
+ _.h.Ua=function(a){var b=this,c=this.fa();this.f.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,ND(this,a),wE(this.f,c.bandwidth,a.bandwidth).then(function(){OD(b)})["catch"](function(d){var e=new _.J(_.K,7,7200,{tizenerror:d});b.a.debug("Error while switching video track",d);b.l.onError(e)})):this.a.debug("Trying to switch to already active rendition. Doing nothing...")};_.h.gb=function(a){TD(this,a)};_.h.hb=function(a){this.h?LD(this.h,a.track):TD(this,a)};
48
+ _.h.addTextTrack=function(){};_.h.ka=function(){return this.f.o};MD.prototype.isAbrEnabled=MD.prototype.ka;MD.prototype.addTextTrack=MD.prototype.addTextTrack;MD.prototype.setTextRendition=MD.prototype.hb;MD.prototype.setAudioRendition=MD.prototype.gb;MD.prototype.setVideoRendition=MD.prototype.Ua;MD.prototype.setTextTrack=MD.prototype.ua;MD.prototype.setAudioTrack=MD.prototype.na;MD.prototype.setVideoTrack=MD.prototype.Va;MD.prototype.getTextTrack=MD.prototype.ja;MD.prototype.getAudioTrack=MD.prototype.ia;
49
+ MD.prototype.getVideoTrack=MD.prototype.Da;MD.prototype.getLoadingTextRendition=MD.prototype.Za;MD.prototype.getLoadingAudioRendition=MD.prototype.Ya;MD.prototype.getLoadingVideoRendition=MD.prototype.Pa;MD.prototype.getTextRendition=MD.prototype.Ca;MD.prototype.getAudioRendition=MD.prototype.Aa;MD.prototype.getVideoRendition=MD.prototype.fa;MD.prototype.getTextTracks=MD.prototype.ea;MD.prototype.getAudioTracks=MD.prototype.getAudioTracks;MD.prototype.getVideoTracks=MD.prototype.getVideoTracks;_.u(eE,_.Nh);_.h=eE.prototype;_.h.Eh=function(){this.w=!0;this.g||this.trigger(new _.E(qE))};_.h.Dh=function(a){this.w=!0;this.trigger(new _.E(CE,{percent:a}))};_.h.Ch=function(){this.w=!1;this.trigger(new _.E(DE))};_.h.Hh=function(){this.trigger(new _.E(EE))};_.h.Gh=function(a,b){this.trigger(new _.E(JE,{eventid:a,data:b}))};_.h.Ih=function(a,b,c,d,e){this.trigger(new _.E(KE,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
+ _.h.Fh=function(a,b){this.trigger(new _.E(LE,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Fc&&"Challenge"===b.name)wD(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.J(_.K,6,6005,{message:JSON.stringify(b)});c.m.onError(d)}}};_.h.S=function(a){this.trigger(new _.E(ME,{eventType:a}))};
51
+ _.h.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(gE,f,b);g=setTimeout(function(){b.off(gE,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===GE)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){iE(b);d(webapis.avplay.play())},function(f){b.trigger(new _.E(ME));e(f)})})).then(function(){return a()});if(c===BD||c===FE)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===AD?
52
+ Promise.resolve():Promise.reject("Player is in invalid state")};_.h.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===BD?Promise.resolve():Promise.reject()};
53
+ _.h.setPlaybackRate=function(a){var b=this.getState();if(b===FE||b===AD||b===BD){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.a.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.a.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.h.getPlaybackRate=function(){return this.C};
54
+ _.h.load=function(a,b){var c=this,d;return _.z(function(e){switch(e.a){case 1:return c.a.debug("configure()",b||""),_.qf(e,2),_.v(e,pE(c),4);case 4:return _.v(e,vE(c,a,b),5);case 5:_.rf(e,0);break;case 2:throw d=_.sf(e),new _.J(_.K,7,7003,null,d);}})};_.h.getState=function(){if(this.g&&this.f)return this.f.bf;try{return webapis.avplay.getState()}catch(a){this.S(JSON.stringify(a))}};
55
+ _.h.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.l.trigger(new _.E(_.De));webapis.avplay.seekTo(c,function(){b.B=!1;b.l.trigger(new _.E(_.Ce));d()},function(){b.B=!1;e()})})};_.h.getPosition=function(){if(this.g&&this.f)return this.f.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.S(JSON.stringify(a))}};_.h.getDuration=function(){if(this.g&&this.f)return this.f.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.S(JSON.stringify(a))}};
56
+ _.h.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.Hd.stop()}a.j={};a.C=1;a.B=!1;a.m=null;a.f=null;return b()}catch(f){return c(f)}})};_.h.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case mD:this.a.debug("The application does not have the privilege to get the volume.",nD);break;default:this.a.debug(jD,b)}}return a};
57
+ _.h.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.a.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case mD:this.a.warn("The application does not have the privilege to set the volume.",nD);break;default:this.a.warn("An unknown error occurred while trying to set volume",b)}}};
58
58
  _.h.isLive=function(){if(this.g&&this.f)return this.f.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.S(JSON.stringify(a))}};_.h.stop=function(){try{webapis.avplay.stop()}catch(a){this.a.debug(a)}};_.h.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.h.setSourceIndex=function(a){this.D=a};_.h.getSourceIndex=function(){return this.D};_.h.getLoadedSource=function(){return this.m&&this.m[this.getSourceIndex()]};
59
- var jE="IDLE",iE="READY",dD="PLAYING",eD="PAUSED",BD="VIDEO",uD="AUDIO",vD="TEXT",lE="PLAYER_MSG_RESOLUTION_CHANGED",kE="PLAYER_MSG_BITRATE_CHANGE",YC={PLAYREADY:"PLAYREADY",Jj:"EME_PLAYREADY",Sj:"VERIMATRIX",gd:"WIDEVINE_CDM",Kj:"EME_WIDEVINE_CDM",Tj:"WIDEVINE_CLASSIC"};_.u(bE,_.Mh);_.h=bE.prototype;_.h.hf=function(){var a=this;this.h.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.D(_.Uc));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.h.debug("Could not loop playback")}):this.a.stop()};_.h.ff=function(a){this.trigger(new _.D(_.ue,{currentTime:a.currentTime/1E3}))};
60
- _.h.jf=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.h.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.bh(d))&&this.o.append([new _.pg(b,c,d)],[])};_.h.gf=function(a){this.h.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.h.Nf=function(){this.A||(this.h.debug("Initial buffering completed..."),this.A=!0)};
61
- _.h.S=function(a){this.h.debug("Error: TYPE: "+a.eventType);cD(this.f,_.Jl);a=new _.J(_.K,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.D(_.Wc,{detail:a}))};
62
- _.h.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(hE,this.hf,this);this.a.on(KD,this.ff,this);this.a.on(nE,this.jf,this);this.a.on(oE,this.gf,this);this.a.on(pE,this.S,this);this.a.on(gE,this.Nf,this);var c=this.f;c.a.on(UD,c.mf,c);c.a.on(fE,c.lf,c);c.a.on(gE,c.kf,c);c.a.on(VD,c.Vf,c);c.a.on(XD,c.Uf,c);c.a.on(hE,c.nf,c);this.m.Fb(this);this.h.debug("Initializing player surface");this.w.hideMediaElement();c=qE;qE+=1;this.j=_.gm(_.Ad,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});
63
- this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;var e=[_.Ve,_.Zc,"position",_.dd,"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=_.t(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.nm(c,f);cE(this)}};_.h.getSurface=function(){return this.w};_.h.getConfiguration=function(){return this.configuration};
64
- _.h.destroy=function(){var a=this;return _.z(function(b){switch(b.a){case 1:return _.v(b,a.release(),2);case 2:a.a.off(hE,a.hf);a.a.off(KD,a.ff);a.a.off(nE,a.jf);a.a.off(oE,a.gf);a.a.off(pE,a.S);a.a.off(gE,a.Nf);if(!a.g){b.G(3);break}return _.v(b,a.g.destroy(),4);case 4:a.g=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.m.destroy(),a.f.destroy(),a.m=null,a.f=null,_.w(b)}})};_.h.namespace=function(){return rE};_.h.getPlaybackRate=function(){return this.a.getPlaybackRate()};
65
- _.h.setDrmCustomDataModifier=function(){};_.h.setCdnErrorCallback=function(){};_.h.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.h.getPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.Fl?this.getDuration():this.a.getPosition()||0};_.h.seek=function(a){return typeof a===_.zd&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};_.h.getPresentationStartTime=function(){return 0};
66
- _.h.getSeekRange=function(){return{start:0,end:0}};_.h.getVolume=function(){var a=this.a.getVolume();return typeof a===_.zd?a/100:null};_.h.setVolume=function(a){this.a.setVolume(a)};_.h.getDuration=function(){return this.a.getDuration()};_.h.getBufferInfo=function(){this.h.warn(_.ma);return new _.Lh};_.h.getTrackManager=function(){return this.m};_.h.unload=function(){var a=this;return this.a.release().then(function(){a.m.release()})};
67
- _.h.release=function(){var a=this;return _.z(function(b){switch(b.a){case 1:if(!a.g){b.G(2);break}return _.v(b,a.g.release(),2);case 2:if(!a.o){b.G(4);break}return _.v(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.v(b,a.a.release(),6);case 6:a.m.release(),a.f.release(),a.A=!1,_.w(b)}})};
68
- _.h.load=function(a){var b=this,c,d,e,f,g;return _.z(function(k){switch(k.a){case 1:_.Wi(a)&&(b.configuration=_.Vi(b.B,a));c=_.ll(b.configuration,["html",_.xd]);b.o=c.create(b);d=_.Ql(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){k.G(2);break}b.g=new gD;b.g.l=b;_.pf(k,3);return _.v(k,b.g.load(d),5);case 5:b.g.start();_.qf(k,2);break;case 3:f=_.rf(k),b.h.error(f);case 2:return _.pf(k,6),_.v(k,b.a.load(b.configuration),8);case 8:_.qf(k,7);break;case 6:throw g=
69
- _.rf(k),b.onError(g),g;case 7:b.m.load(),_.w(k)}})};_.h.play=function(){var a=this;this.trigger(new _.D(_.Pd));cE(this);return this.a.play().then(function(){fD(a.f)})};_.h.pause=function(){var a=this;return this.a.pause().then(function(){fD(a.f)})};_.h.getState=function(){return this.f.getState()};_.h.getPeriods=function(){return[]};_.h.onError=function(a){var b=new _.D(_.Wc,{detail:a});a.severity===_.K&&(cD(this.f,_.Jl),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
70
- _.h.getDrmInfo=function(){return this.a.getDrmInfo()};_.h.isEnded=function(){return this.f.getState()===_.Fl};_.h.isPaused=function(){return this.a.getState()===eD};_.h.isMuted=function(){return PD(this.a)};_.h.setMuted=function(a){YD(this.a,a)};_.h.getNetworkEngine=function(){return this.C};_.h.setNetworkEngine=function(a){this.C=a};_.h.isLive=function(){return this.a.isLive()};_.h.getStats=function(){return null};_.h.setSourceIndex=function(a){this.a.setSourceIndex(a)};_.h.getSourceIndex=function(){return this.a.getSourceIndex()};
71
- _.h.getLoadedSource=function(){return this.a.getLoadedSource()};_.h.canPlay=function(a,b){return(new dE).canPlay(a,b)};_.h.getTimelineCues=function(){return[]};_.h.getTextDisplayer=function(){return this.o};_.h.resetAbr=function(){};bE.prototype.getTextDisplayer=bE.prototype.getTextDisplayer;bE.prototype.setNetworkEngine=bE.prototype.setNetworkEngine;bE.prototype.getNetworkEngine=bE.prototype.getNetworkEngine;var rE="clpp.tizen",qE=0;dE.prototype.a=function(){return rE};
72
- dE.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Rb||a===_.Xb||a===_.Wb)&&b){if(_.ei(2))return 2;if(_.ei(3)||_.ei(4)||_.ei(5)||_.ei(6))return _.B("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};dE.prototype.create=function(){return new bE};_.u(eE,_.ln);eE.prototype.Da=function(){this.a=new dE;_.Of(this.a)};eE.prototype.va=function(){if(this.a){var a=this.a.a();a&&_.Mf[a]&&(delete _.Mf[a],_.Nf.info("Removed Player factory: '"+a+"'"));this.a=null}};eE.prototype.id=function(){return"tizen"};_.A("clpp.tizen.TizenComponent",eE);var UD="onbufferingstart",fE="onbufferingprogress",gE="onbufferingcomplete",hE="onstreamcompleted",KD="oncurrentplaytime",mE="onevent",nE="onsubtitlechange",oE="ondrmevent",pE="onerror",VD="preparingstart",XD="preparingend";};
59
+ var GE="IDLE",FE="READY",AD="PLAYING",BD="PAUSED",YD="VIDEO",RD="AUDIO",SD="TEXT",IE="PLAYER_MSG_RESOLUTION_CHANGED",HE="PLAYER_MSG_BITRATE_CHANGE",uD={PLAYREADY:"PLAYREADY",Sj:"EME_PLAYREADY",bk:"VERIMATRIX",hd:"WIDEVINE_CDM",Tj:"EME_WIDEVINE_CDM",ck:"WIDEVINE_CLASSIC"};_.u(yE,_.Nh);_.h=yE.prototype;_.h.kf=function(){var a=this;this.h.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.E(_.Uc));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.h.debug("Could not loop playback")}):this.a.stop()};_.h.hf=function(a){this.trigger(new _.E(_.ve,{currentTime:a.currentTime/1E3}))};
60
+ _.h.lf=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.h.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.ch(d))&&this.o.append([new _.qg(b,c,d)],[])};_.h.jf=function(a){this.h.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.h.Nf=function(){this.A||(this.h.debug("Initial buffering completed..."),this.A=!0)};
61
+ _.h.S=function(a){this.h.debug("Error: TYPE: "+a.eventType);zD(this.f,_.Kl);a=new _.J(_.K,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.E(_.Vc,{detail:a}))};
62
+ _.h.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(EE,this.kf,this);this.a.on(gE,this.hf,this);this.a.on(KE,this.lf,this);this.a.on(LE,this.jf,this);this.a.on(ME,this.S,this);this.a.on(DE,this.Nf,this);var c=this.f;c.a.on(qE,c.pf,c);c.a.on(CE,c.nf,c);c.a.on(DE,c.mf,c);c.a.on(rE,c.Vf,c);c.a.on(tE,c.Uf,c);c.a.on(EE,c.qf,c);this.m.Fb(this);this.h.debug("Initializing player surface");this.w.hideMediaElement();c=NE;NE+=1;this.j=_.hm(_.Ad,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});
63
+ this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;var e=[_.We,_.Zc,"position",_.dd,"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=_.t(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.om(c,f);zE(this)}};_.h.getSurface=function(){return this.w};_.h.getConfiguration=function(){return this.configuration};
64
+ _.h.destroy=function(){var a=this;return _.z(function(b){switch(b.a){case 1:return _.v(b,a.release(),2);case 2:a.a.off(EE,a.kf);a.a.off(gE,a.hf);a.a.off(KE,a.lf);a.a.off(LE,a.jf);a.a.off(ME,a.S);a.a.off(DE,a.Nf);if(!a.g){b.H(3);break}return _.v(b,a.g.destroy(),4);case 4:a.g=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.m.destroy(),a.f.destroy(),a.m=null,a.f=null,_.w(b)}})};_.h.namespace=function(){return OE};_.h.getPlaybackRate=function(){return this.a.getPlaybackRate()};
65
+ _.h.setDrmCustomDataModifier=function(){};_.h.setCdnErrorCallback=function(){};_.h.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.h.getPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.Gl?this.getDuration():this.a.getPosition()||0};_.h.seek=function(a){return typeof a===_.zd&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};_.h.getPresentationStartTime=function(){return 0};
66
+ _.h.getSeekRange=function(){return{start:0,end:0}};_.h.getVolume=function(){var a=this.a.getVolume();return typeof a===_.zd?a/100:null};_.h.setVolume=function(a){this.a.setVolume(a)};_.h.getDuration=function(){return this.a.getDuration()};_.h.getBufferInfo=function(){this.h.warn(_.ma);return new _.Mh};_.h.getTrackManager=function(){return this.m};_.h.unload=function(){var a=this;return this.a.release().then(function(){a.m.release()})};
67
+ _.h.release=function(){var a=this;return _.z(function(b){switch(b.a){case 1:if(!a.g){b.H(2);break}return _.v(b,a.g.release(),2);case 2:if(!a.o){b.H(4);break}return _.v(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.v(b,a.a.release(),6);case 6:a.m.release(),a.f.release(),a.A=!1,_.w(b)}})};
68
+ _.h.load=function(a){var b=this,c,d,e,f,g;return _.z(function(k){switch(k.a){case 1:_.Vi(a)&&(b.configuration=_.Ui(b.B,a));c=_.ml(b.configuration,["html",_.xd]);b.o=c.create(b);d=_.Rl(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){k.H(2);break}b.g=new DD;b.g.l=b;_.qf(k,3);return _.v(k,b.g.load(d),5);case 5:b.g.start();_.rf(k,2);break;case 3:f=_.sf(k),b.h.error(f);case 2:return _.qf(k,6),_.v(k,b.a.load(b.configuration),8);case 8:_.rf(k,7);break;case 6:throw g=
69
+ _.sf(k),b.onError(g),g;case 7:b.m.load(),_.w(k)}})};_.h.play=function(){var a=this;this.trigger(new _.E(_.Pd));zE(this);return this.a.play().then(function(){CD(a.f)})};_.h.pause=function(){var a=this;return this.a.pause().then(function(){CD(a.f)})};_.h.getState=function(){return this.f.getState()};_.h.getPeriods=function(){return[]};_.h.onError=function(a){var b=new _.E(_.Vc,{detail:a});a.severity===_.K&&(zD(this.f,_.Kl),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
70
+ _.h.getDrmInfo=function(){return this.a.getDrmInfo()};_.h.isEnded=function(){return this.f.getState()===_.Gl};_.h.isPaused=function(){return this.a.getState()===BD};_.h.isMuted=function(){return lE(this.a)};_.h.setMuted=function(a){uE(this.a,a)};_.h.getNetworkEngine=function(){return this.C};_.h.setNetworkEngine=function(a){this.C=a};_.h.isLive=function(){return this.a.isLive()};_.h.getStats=function(){return null};_.h.setSourceIndex=function(a){this.a.setSourceIndex(a)};_.h.getSourceIndex=function(){return this.a.getSourceIndex()};
71
+ _.h.getLoadedSource=function(){return this.a.getLoadedSource()};_.h.canPlay=function(a,b){return(new AE).canPlay(a,b)};_.h.getTimelineCues=function(){return[]};_.h.getTextDisplayer=function(){return this.o};_.h.resetAbr=function(){};yE.prototype.getTextDisplayer=yE.prototype.getTextDisplayer;yE.prototype.setNetworkEngine=yE.prototype.setNetworkEngine;yE.prototype.getNetworkEngine=yE.prototype.getNetworkEngine;var OE="clpp.tizen",NE=0;AE.prototype.a=function(){return OE};
72
+ AE.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Rb||a===_.Xb||a===_.Wb)&&b){if(_.fi(2))return 2;if(_.fi(3)||_.fi(4)||_.fi(5)||_.fi(6))return _.B("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};AE.prototype.create=function(){return new yE};_.u(BE,_.mn);BE.prototype.Ea=function(){this.a=new AE;_.Pf(this.a)};BE.prototype.va=function(){if(this.a){var a=this.a.a();a&&_.Nf[a]&&(delete _.Nf[a],_.Of.info("Removed Player factory: '"+a+"'"));this.a=null}};BE.prototype.id=function(){return"tizen"};_.A("clpp.tizen.TizenComponent",BE);var qE="onbufferingstart",CE="onbufferingprogress",DE="onbufferingcomplete",EE="onstreamcompleted",gE="oncurrentplaytime",JE="onevent",KE="onsubtitlechange",LE="ondrmevent",ME="onerror",rE="preparingstart",tE="preparingend";};
73
73
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
74
74
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
75
75
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ttml.js CHANGED
@@ -1,30 +1,30 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var yq='application/mp4; codecs\x3d"stpp.ttml"',zq='application/mp4; codecs\x3d"stpp.ttml.im1i"',Aq='application/mp4; codecs\x3d"stpp.ttml.im1t"',Bq="backgroundColor",Cq="direction",Dq="displayAlign",Eq="region",Fq="sans-serif",Gq="textAlign",Hq="textDecoration",Iq="writingMode",Jq=function(a,b,c){this.g=a;this.f=b;this.a=c},Kq=function(a,b,c){Jq.call(this,a,[],c);this.h=b||""},Lq=function(a,b,c){Jq.call(this,a,b,c)},Mq=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},Uq=function(a,b){var c=null;if(Nq.test(a)){c=Nq.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 Oq.test(a)?c=Pq(Oq,a):Qq.test(a)?c=Pq(Qq,a):Rq.test(a)?(c=Rq.exec(a),c=Number(c[1])/b.frameRate):Sq.test(a)?(c=Sq.exec(a),c=Number(c[1])/b.a):Tq.test(a)&&(c=Pq(Tq,a));return c},Pq=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)},Vq=function(a){return a.split(":").pop()},Wq=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},Yq=function(a,b){for(;Xq.test(a);){var c=Xq.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},Zq=function(a,b,c,d,e,f,g){Jq.call(this,a,f,g);this.o=b;this.w=c;this.m=d;this.j=e;this.h=[]},$q=function(a,b,c){a=Mq(a,b,Gq);if(!a&&c&&(a=Mq(c,b,Gq),!a&&"rltb"===Mq(c,b,Iq)))return _.ae;switch(a){case _.qc:return _.kg;case _.ae:case _.Tc:return _.ae;default:return _.dd}},
5
- ar=function(a,b,c){if(_.Zg(a.o))return document.createTextNode(_.bh(a.o||""));if(a.w)return _.gm("br");for(var d=_.gm("span"),e=_.t(a.f),f=e.next();!f.done;f=e.next())_.mm(d,f.value);a=_.t(a.h);for(e=a.next();!e.done;e=a.next())d.appendChild(ar(c.get(e.value),b,c));return d},br=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*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},cr=function(a,
6
- b,c){Jq.call(this,a,b,c)},fr=function(a,b,c,d){var e=dr.exec(a);a=er.exec(a);return typeof b===_.zd&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},gr=function(a,b){return typeof b===_.zd&&0<b?_.qg:er.test(a)?0:_.qg},hr=function(a,b){Jq.call(this,"root-container",[],b);this.h=a},ir=function(a,b,c){return typeof a===_.zd?a:typeof b===_.zd?b:c},jr=function(a,b){var c=a.getAttribute("extent");return(c=er.exec(c))?Number(c[b]):null},lr=function(a){a=a.getAttribute("cellResolution");return(a=
7
- kr.exec(a))?Number(a[2]):null},mr=function(a,b,c){Jq.call(this,a,b,c)},nr=function(a){this.A=a;this.o=this.j=null;this.w=0;this.g=new Map;this.a=new Map;this.h=new Map;this.f=new Map;this.m=[]},pr=function(a){return or.some(function(b){return b in a.a})},qr=function(a,b){if(0===b.length)return[];for(var c=[],d=_.t(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.bf(qr(a,a.a.get(e).f)).concat([e]));return c},sr=function(){return"inline-"+rr++},tr=function(a){return a.m.map(function(b){return b.build(a.j,
8
- a.o,a.w,a.g,a.a,a.h,a.f)}).filter(function(b){return null!==b})},ur=function(a){this.a=a.firstChild;this.f=new Set},vr=function(a,b,c,d,e,f){this.h=a;this.f=b;this.j=c;this.m=d;this.g=e;this.a=f},wr=function(a){return Vq(a.h.nodeName)},xr=function(){this.a=new Map},Gr=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},k=b.parentNode;if(k&&a.a.has(k)){var l=a.a.get(k);e=_.bf(l.m).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.f,d=l.j,f=_.bf(l.g).concat(),
9
- g={},yr.forEach(function(n){n in l.a&&(g[n]=l.a[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Eq)&&(c=b.getAttribute(Eq));b.hasAttribute(_.ne)&&f.push.apply(f,_.bf(b.getAttribute(_.ne).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.t(d);for(k=d.next();!k.done;k=d.next()){k=k.value;var m=Vq(k);g[m]=b.getAttribute(k)}d=g.backgroundImage}c=new vr(b,c,d,e,f,g);a.a.set(b,c);return c},Or=function(a){this.a=a;this.f=new DOMParser},Pr=function(a){this.f=a},Qr=function(a){return String(Math.floor(a/
10
- 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")},Rr=function(){},Sr=function(a){this.f=new Or(a);this.a=new _.C("clpp.ttml.Mp4TtmlParser")},Tr=function(){this.a=new Rr};Jq.prototype.aa=function(){return this.g};Jq.prototype.getAttribute=function(a){return this.a[a]};_.u(Kq,Jq);_.u(Lq,Jq);var Nq=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Oq=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Qq=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Rq=/^(\d*(?:\.\d*)?)f$/,Sq=/^(\d*(?:\.\d*)?)t$/,Tq=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,dr=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,er=/^(\d+)px (\d+)px$/,kr=/^(\d+) (\d+)$/,Xq=/(\d+)px/,Ur=/^(\d+px|\d+em|\d*\.?\d+c)$/,or=["fontStyle","fontSize","fontFamily","fontWeight","lineHeight",
11
- "color",Bq,"opacity","padding","zIndex",Gq,Dq,Iq,Cq,Hq,"textOutline"],yr=["begin",_.Tc];_.u(Zq,Lq);
12
- Zq.prototype.build=function(a,b,c,d,e,f,g){var k=Uq(this.a.begin,b);b=Uq(this.a.end,b);if(null===k||null===b)return null;k+=c;b+=c;c=_.gm(_.Lc);for(var l=_.t(this.h),m=l.next();!m.done;m=l.next())c.appendChild(ar(g.get(m.value),e,g));g=new _.pg(k,b,c.innerHTML,_.we);g.cssClassList=_.bf(this.f).concat();g.textAlign=$q(this,e,null);g.writingMode=_.lg;g.line=-1;g.lineInterpretation=_.mg;g.lineAlign=_.ng;g.containerRows=ir(null,lr(a),15);if(this.m&&(f=f.get(this.m))){g.region=f.build(a,e);g.textAlign=
13
- $q(this,e,f);a:switch(Mq(f,e,Iq)){case "tb":case "tblr":a=_.Ee;break a;case "tbrl":a=_.Fe;break a;default:a=_.lg}g.writingMode=a;a:switch(Mq(f,e,Dq)){case _.qc:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Mq(f,e,Dq)){case _.qc:a=1;break a;default:a=_.mg}g.lineInterpretation=a;a:switch(Mq(f,e,Dq)){case _.qc:e=_.qc;break a;default:e=_.ng}g.lineAlign=e}this.j&&(a=d.get(this.j))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.h.trim(),
14
- g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.u(cr,Lq);
15
- cr.prototype.build=function(a,b){var c=new _.sg;c.id=this.aa();var d=ir(a.h.containerWidth,jr(a,1),720),e=ir(a.h.containerHeight,jr(a,2),480);a:switch(Mq(this,b,Dq)){case "after":var f="flex-start";break a;case _.qc:f=_.qc;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Mq(this,b,Iq)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Bc}c.writingMode=f;f=this.getAttribute("extent")||Mq(this,b,"extent");c.width=fr(f,d,1,100);c.widthUnits=gr(f,d);c.height=
16
- fr(f,e,2,100);c.heightUnits=gr(f,e);f=this.getAttribute("origin")||Mq(this,b,"origin");c.viewportAnchorX=fr(f,d,1,0);c.viewportAnchorY=fr(f,e,2,0);c.viewportAnchorUnits=gr(f,d);c.cssClassList=_.bf(this.f).concat();return c};_.u(hr,Jq);_.u(mr,Jq);
17
- mr.prototype.build=function(a){var b=null;var c=lr(a);c&&(b=ir(a.h.containerHeight,jr(a,2),480)/c);b=ir(a.h.fontSizeRadix,b,16);a=[];c="::ttml ."+this.g+", ::ttml ."+this.g+" * {";for(var d=_.t(Vr.entries()),e=d.next();!e.done;e=d.next()){var f=_.t(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+Wq(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(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Ur.test(g)&&Ur.test(k)&&Ur.test(l)?(e=g,f=k):2===d.length&&!Ur.test(g)&&Ur.test(k)?(e=g,f=k):2===d.length&&Ur.test(g)&&Ur.test(k)&&(f=g);if(""!==f){f=Wq(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif",
19
- "monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Fq).replace("proportionalSerif",Fq).replace("sansSerif",Fq).replace("default",Fq)+";":"");a:{if(Hq in this.a){d=[];e=_.t(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="text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+
20
- Wq(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=Wq(e),e=Yq(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=Wq(d);d=Yq(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.g+" .clpp-text-wrapper {",a.push(c+b+"}"),c="::ttml .clpp-text-wrapper__"+this.g+" {",a.push(c+b+"}"));return a};
21
- var Vr=new Map([["color","color"],[Bq,"background-color"],[Cq,Cq],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var rr=0;ur.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Wr.has(Vq(a.nodeName))||Xr.has(Vq(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&&!Wr.has(Vq(a.nodeName))));var b=this.a;this.a=a;return b};var Wr=new Set(["tt","head","layout",_.od,_.ad,Eq,"styling",_.ne,"body",_.Lc,"p","span","br"]),Xr=new Set([_.ne,_.ad]);vr.prototype.aa=function(){return this.a.id};Or.prototype.parseInit=function(){};
22
- Or.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.H.xa(this.a.ttml||{}),e=_.Q(a,0,c[0]);e=_.Qg(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.te)}catch(n){throw new _.J(_.K,2,2005,"Failed to parse TTML.");}d=new nr(d);e=new xr;f=new ur(f);b=b.periodStart;typeof b===_.zd&&(d.w=b);b=c[0];for(var g=1;g<c.length;++g){var k=c[g],l=_.Q(a,b,k);l=_.dj(l);var m="urn:mpeg:14496-30:subs:"+g;d.g.set(m,new Kq(m,l,{imageType:"PNG",encoding:"Base64"}));
23
- b+=k}for(;f.a;)a=f.next(),a=Gr(e,a),"tt"===wr(a)&&(d.j=new hr(d.A,Object.assign({},a.a))),"tt"===wr(a)&&(d.o=new br(a.a.frameRate,a.a.subFrameRate,a.a.frameRateMultiplier,a.a.tickRate)),wr(a)!==_.ad||a.a.begin||a.a.end||(c="#"+a.aa(),d.g.set(c,new Kq(c,a.h.textContent,a.a))),wr(a)===_.ad&&a.a.begin&&a.a.end?(c="#"+sr(),b=new Kq(c,a.h.textContent,a.a),d.g.set(c,b),c=b):c=null,c&&(a.j=c.aa()),wr(a)===_.ne&&(c=a.aa()||sr(),b=new mr(c,a.g,Object.assign({},a.a)),d.a.set(c,b),a.f&&d.h.get(a.f).f.push(c)),
24
- wr(a)!==_.ne&&pr(a)?(c=sr(),b=new mr(c,[],Object.assign({},a.a)),d.a.set(c,b),c=b):c=null,c&&a.g.push(c.aa()),wr(a)!==_.Lc||!a.a.extent&&!a.a.origin?c=null:(c=sr(),b=new cr(c,qr(d,a.g),Object.assign({},a.a)),d.h.set(c,b),c=b),c&&(a.f=c.aa()),wr(a)!==Eq?c=null:(c=a.aa(),b=new cr(c,qr(d,a.g),Object.assign({},a.a)),d.h.set(c,b),c=b),c&&(a.f=c.aa()),c=a.m,-1===["#text","span","br"].indexOf(wr(a))||0===c.length?c=null:(c=c[c.length-1],d.f.has(c)?(b=sr(),g=new Zq(b,"#text"===a.h.nodeName?a.h.textContent:
25
- null,"br"===wr(a),a.f,a.j,qr(d,a.g),a.a),d.f.set(b,g),d.f.get(c).h.push(b),c=g):c=null),c&&a.m.push(c.aa()),"p"===wr(a)||a.j?(c=sr(),b=new Zq(c,null,!1,a.f,a.j,qr(d,a.g),a.a),d.f.set(c,b),d.m.push(b),c=b):c=null,c&&a.m.push(c.aa());e=tr(d);f=[];a=_.t(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,_.bf(c.value.build(d.j)));return{cues:e,styles:f}};Pr.prototype.a=function(a){a=(new Or(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.t(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Qr(c.startTime)+" --\x3e "+Qr(c.endTime),e=[];switch(c.textAlign){case _.dd:e.push("align:left");break;case _.ae:e.push("align:right");break;case _.kg:e.push("align:middle");break;case _.dd:e.push("align:start");break;case _.ae:e.push("align:end")}switch(c.writingMode){case _.Ee:e.push("vertical:lr");break;
26
- case _.Fe:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.Ug(b)};Rr.prototype.probe=function(a,b){return a===_.Vb&&b===_.se};Rr.prototype.create=function(a){return new Pr(a)};Sr.prototype.parseInit=function(a){var b=!1;(new _.pk).L(_.rd,_.qk).L(_.ve,_.qk).L(_.md,_.qk).L(_.qd,_.qk).L(_.ke,_.qk).U(_.me,_.rk).L("stpp",function(c){b=!0;c.cb.stop()}).parse(a);if(!b)throw new _.J(_.K,2,2007);};
27
- Sr.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.pk).L("moof",_.qk).L("traf",_.qk).U("subs",function(k){for(var l=_.Dj(k.F),m=0;m<l;++m){k.F.skip(4);for(var n=_.Cj(k.F),p=0;p<n;++p){var q=1===k.version?_.Dj(k.F):_.Cj(k.F);g.push(q);k.F.skip(6)}}}).L(_.ld,_.sk(function(k){d=!0;k=c.f.parseMedia(k,b,g);e=e.concat(k.cues);f=f.concat(k.styles)})).parse(a);d||this.a.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.u(Tr,_.ln);Tr.prototype.Da=function(){_.Fo[_.Vb]=Or;_.Fo[_.Tb]=Sr;_.Fo[yq]=Sr;_.Fo[Aq]=Sr;_.Fo[zq]=Sr;_.oh.push(this.a)};Tr.prototype.va=function(){_.Go(_.Vb);_.Go(_.Tb);_.Go(yq);_.Go(Aq);_.Go(zq);_.qh(this.a)};Tr.prototype.id=function(){return _.pe};_.A("clpp.ttml.TtmlComponent",Tr);};
2
+ var f=function(window){var Uq='application/mp4; codecs\x3d"stpp.ttml"',Vq='application/mp4; codecs\x3d"stpp.ttml.im1i"',Wq='application/mp4; codecs\x3d"stpp.ttml.im1t"',Xq="backgroundColor",Yq="direction",Zq="displayAlign",$q="region",ar="sans-serif",br="textAlign",cr="textDecoration",dr="writingMode",er=function(a,b,c){this.g=a;this.f=b;this.a=c},fr=function(a,b,c){er.call(this,a,[],c);this.h=b||""},gr=function(a,b,c){er.call(this,a,b,c)},hr=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},pr=function(a,b){var c=null;if(ir.test(a)){c=ir.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 jr.test(a)?c=kr(jr,a):lr.test(a)?c=kr(lr,a):mr.test(a)?(c=mr.exec(a),c=Number(c[1])/b.frameRate):nr.test(a)?(c=nr.exec(a),c=Number(c[1])/b.a):or.test(a)&&(c=kr(or,a));return c},kr=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)},qr=function(a){return a.split(":").pop()},rr=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},tr=function(a,b){for(;sr.test(a);){var c=sr.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},ur=function(a,b,c,d,e,f,g){er.call(this,a,f,g);this.o=b;this.w=c;this.m=d;this.j=e;this.h=[]},vr=function(a,b,c){a=hr(a,b,br);if(!a&&c&&(a=hr(c,b,br),!a&&"rltb"===hr(c,b,dr)))return _.ae;switch(a){case _.qc:return _.lg;case _.ae:case _.Tc:return _.ae;default:return _.dd}},
5
+ wr=function(a,b,c){if(_.$g(a.o))return document.createTextNode(_.ch(a.o||""));if(a.w)return _.hm("br");for(var d=_.hm("span"),e=_.t(a.f),f=e.next();!f.done;f=e.next())_.im(d,f.value);a=_.t(a.h);for(e=a.next();!e.done;e=a.next())d.appendChild(wr(c.get(e.value),b,c));return d},xr=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*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},yr=function(a,
6
+ b,c){er.call(this,a,b,c)},Br=function(a,b,c,d){var e=zr.exec(a);a=Ar.exec(a);return typeof b===_.zd&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Cr=function(a,b){return typeof b===_.zd&&0<b?_.rg:Ar.test(a)?0:_.rg},Dr=function(a,b){er.call(this,"root-container",[],b);this.h=a},Er=function(a,b,c){return typeof a===_.zd?a:typeof b===_.zd?b:c},Fr=function(a,b){var c=a.getAttribute("extent");return(c=Ar.exec(c))?Number(c[b]):null},Vr=function(a){a=a.getAttribute("cellResolution");return(a=
7
+ Nr.exec(a))?Number(a[2]):null},Wr=function(a,b,c){er.call(this,a,b,c)},Xr=function(a){this.A=a;this.o=this.j=null;this.w=0;this.g=new Map;this.a=new Map;this.h=new Map;this.f=new Map;this.m=[]},Zr=function(a){return Yr.some(function(b){return b in a.a})},$r=function(a,b){if(0===b.length)return[];for(var c=[],d=_.t(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.af($r(a,a.a.get(e).f)).concat([e]));return c},bs=function(){return"inline-"+as++},cs=function(a){return a.m.map(function(b){return b.build(a.j,
8
+ a.o,a.w,a.g,a.a,a.h,a.f)}).filter(function(b){return null!==b})},ds=function(a){this.a=a.firstChild;this.f=new Set},es=function(a,b,c,d,e,f){this.h=a;this.f=b;this.j=c;this.m=d;this.g=e;this.a=f},fs=function(a){return qr(a.h.nodeName)},gs=function(){this.a=new Map},is=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},k=b.parentNode;if(k&&a.a.has(k)){var l=a.a.get(k);e=_.af(l.m).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.f,d=l.j,f=_.af(l.g).concat(),
9
+ g={},hs.forEach(function(n){n in l.a&&(g[n]=l.a[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute($q)&&(c=b.getAttribute($q));b.hasAttribute(_.ne)&&f.push.apply(f,_.af(b.getAttribute(_.ne).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.t(d);for(k=d.next();!k.done;k=d.next()){k=k.value;var m=qr(k);g[m]=b.getAttribute(k)}d=g.backgroundImage}c=new es(b,c,d,e,f,g);a.a.set(b,c);return c},js=function(a){this.a=a;this.f=new DOMParser},ks=function(a){this.f=a},ls=function(a){return String(Math.floor(a/
10
+ 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")},ms=function(){},ns=function(a){this.f=new js(a);this.a=new _.D("clpp.ttml.Mp4TtmlParser")},os=function(){this.a=new ms};er.prototype.ba=function(){return this.g};er.prototype.getAttribute=function(a){return this.a[a]};_.u(fr,er);_.u(gr,er);var ir=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,jr=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,lr=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,mr=/^(\d*(?:\.\d*)?)f$/,nr=/^(\d*(?:\.\d*)?)t$/,or=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,zr=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Ar=/^(\d+)px (\d+)px$/,Nr=/^(\d+) (\d+)$/,sr=/(\d+)px/,ps=/^(\d+px|\d+em|\d*\.?\d+c)$/,Yr=["fontStyle","fontSize","fontFamily","fontWeight","lineHeight",
11
+ "color",Xq,"opacity","padding","zIndex",br,Zq,dr,Yq,cr,"textOutline"],hs=["begin",_.Tc];_.u(ur,gr);
12
+ ur.prototype.build=function(a,b,c,d,e,f,g){var k=pr(this.a.begin,b);b=pr(this.a.end,b);if(null===k||null===b)return null;k+=c;b+=c;c=_.hm(_.Lc);for(var l=_.t(this.h),m=l.next();!m.done;m=l.next())c.appendChild(wr(g.get(m.value),e,g));g=new _.qg(k,b,c.innerHTML,_.xe);g.cssClassList=_.af(this.f).concat();g.textAlign=vr(this,e,null);g.writingMode=_.mg;g.line=-1;g.lineInterpretation=_.ng;g.lineAlign=_.og;g.containerRows=Er(null,Vr(a),15);if(this.m&&(f=f.get(this.m))){g.region=f.build(a,e);g.textAlign=
13
+ vr(this,e,f);a:switch(hr(f,e,dr)){case "tb":case "tblr":a=_.Fe;break a;case "tbrl":a=_.Ge;break a;default:a=_.mg}g.writingMode=a;a:switch(hr(f,e,Zq)){case _.qc:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(hr(f,e,Zq)){case _.qc:a=1;break a;default:a=_.ng}g.lineInterpretation=a;a:switch(hr(f,e,Zq)){case _.qc:e=_.qc;break a;default:e=_.og}g.lineAlign=e}this.j&&(a=d.get(this.j))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.h.trim(),
14
+ g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.u(yr,gr);
15
+ yr.prototype.build=function(a,b){var c=new _.tg;c.id=this.ba();var d=Er(a.h.containerWidth,Fr(a,1),720),e=Er(a.h.containerHeight,Fr(a,2),480);a:switch(hr(this,b,Zq)){case "after":var f="flex-start";break a;case _.qc:f=_.qc;break a;default:f="flex-end"}c.displayAlign=f;a:switch(hr(this,b,dr)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Bc}c.writingMode=f;f=this.getAttribute("extent")||hr(this,b,"extent");c.width=Br(f,d,1,100);c.widthUnits=Cr(f,d);c.height=
16
+ Br(f,e,2,100);c.heightUnits=Cr(f,e);f=this.getAttribute("origin")||hr(this,b,"origin");c.viewportAnchorX=Br(f,d,1,0);c.viewportAnchorY=Br(f,e,2,0);c.viewportAnchorUnits=Cr(f,d);c.cssClassList=_.af(this.f).concat();return c};_.u(Dr,er);_.u(Wr,er);
17
+ Wr.prototype.build=function(a){var b=null;var c=Vr(a);c&&(b=Er(a.h.containerHeight,Fr(a,2),480)/c);b=Er(a.h.fontSizeRadix,b,16);a=[];c="::ttml ."+this.g+", ::ttml ."+this.g+" * {";for(var d=_.t(qs.entries()),e=d.next();!e.done;e=d.next()){var f=_.t(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+rr(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(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!ps.test(g)&&ps.test(k)&&ps.test(l)?(e=g,f=k):2===d.length&&!ps.test(g)&&ps.test(k)?(e=g,f=k):2===d.length&&ps.test(g)&&ps.test(k)&&(f=g);if(""!==f){f=rr(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif",
19
+ "monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",ar).replace("proportionalSerif",ar).replace("sansSerif",ar).replace("default",ar)+";":"");a:{if(cr in this.a){d=[];e=_.t(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="text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+
20
+ rr(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=rr(e),e=tr(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=rr(d);d=tr(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.g+" .clpp-text-wrapper {",a.push(c+b+"}"),c="::ttml .clpp-text-wrapper__"+this.g+" {",a.push(c+b+"}"));return a};
21
+ var qs=new Map([["color","color"],[Xq,"background-color"],[Yq,Yq],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var as=0;ds.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!rs.has(qr(a.nodeName))||ss.has(qr(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&&!rs.has(qr(a.nodeName))));var b=this.a;this.a=a;return b};var rs=new Set(["tt","head","layout",_.od,_.ad,$q,"styling",_.ne,"body",_.Lc,"p","span","br"]),ss=new Set([_.ne,_.ad]);es.prototype.ba=function(){return this.a.id};js.prototype.parseInit=function(){};
22
+ js.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.H.ya(this.a.ttml||{}),e=_.Q(a,0,c[0]);e=_.Rg(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.ue)}catch(n){throw new _.J(_.K,2,2005,"Failed to parse TTML.");}d=new Xr(d);e=new gs;f=new ds(f);b=b.periodStart;typeof b===_.zd&&(d.w=b);b=c[0];for(var g=1;g<c.length;++g){var k=c[g],l=_.Q(a,b,k);l=_.ej(l);var m="urn:mpeg:14496-30:subs:"+g;d.g.set(m,new fr(m,l,{imageType:"PNG",encoding:"Base64"}));
23
+ b+=k}for(;f.a;)a=f.next(),a=is(e,a),"tt"===fs(a)&&(d.j=new Dr(d.A,Object.assign({},a.a))),"tt"===fs(a)&&(d.o=new xr(a.a.frameRate,a.a.subFrameRate,a.a.frameRateMultiplier,a.a.tickRate)),fs(a)!==_.ad||a.a.begin||a.a.end||(c="#"+a.ba(),d.g.set(c,new fr(c,a.h.textContent,a.a))),fs(a)===_.ad&&a.a.begin&&a.a.end?(c="#"+bs(),b=new fr(c,a.h.textContent,a.a),d.g.set(c,b),c=b):c=null,c&&(a.j=c.ba()),fs(a)===_.ne&&(c=a.ba()||bs(),b=new Wr(c,a.g,Object.assign({},a.a)),d.a.set(c,b),a.f&&d.h.get(a.f).f.push(c)),
24
+ fs(a)!==_.ne&&Zr(a)?(c=bs(),b=new Wr(c,[],Object.assign({},a.a)),d.a.set(c,b),c=b):c=null,c&&a.g.push(c.ba()),fs(a)!==_.Lc||!a.a.extent&&!a.a.origin?c=null:(c=bs(),b=new yr(c,$r(d,a.g),Object.assign({},a.a)),d.h.set(c,b),c=b),c&&(a.f=c.ba()),fs(a)!==$q?c=null:(c=a.ba(),b=new yr(c,$r(d,a.g),Object.assign({},a.a)),d.h.set(c,b),c=b),c&&(a.f=c.ba()),c=a.m,-1===["#text","span","br"].indexOf(fs(a))||0===c.length?c=null:(c=c[c.length-1],d.f.has(c)?(b=bs(),g=new ur(b,"#text"===a.h.nodeName?a.h.textContent:
25
+ null,"br"===fs(a),a.f,a.j,$r(d,a.g),a.a),d.f.set(b,g),d.f.get(c).h.push(b),c=g):c=null),c&&a.m.push(c.ba()),"p"===fs(a)||a.j?(c=bs(),b=new ur(c,null,!1,a.f,a.j,$r(d,a.g),a.a),d.f.set(c,b),d.m.push(b),c=b):c=null,c&&a.m.push(c.ba());e=cs(d);f=[];a=_.t(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,_.af(c.value.build(d.j)));return{cues:e,styles:f}};ks.prototype.a=function(a){a=(new js(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.t(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=ls(c.startTime)+" --\x3e "+ls(c.endTime),e=[];switch(c.textAlign){case _.dd:e.push("align:left");break;case _.ae:e.push("align:right");break;case _.lg:e.push("align:middle");break;case _.dd:e.push("align:start");break;case _.ae:e.push("align:end")}switch(c.writingMode){case _.Fe:e.push("vertical:lr");break;
26
+ case _.Ge:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.Vg(b)};ms.prototype.probe=function(a,b){return a===_.Vb&&b===_.te};ms.prototype.create=function(a){return new ks(a)};ns.prototype.parseInit=function(a){var b=!1;(new _.qk).M(_.rd,_.rk).M(_.we,_.rk).M(_.md,_.rk).M(_.qd,_.rk).M(_.je,_.rk).V(_.me,_.sk).M("stpp",function(c){b=!0;c.cb.stop()}).parse(a);if(!b)throw new _.J(_.K,2,2007);};
27
+ ns.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.qk).M("moof",_.rk).M("traf",_.rk).V("subs",function(k){for(var l=_.Ej(k.F),m=0;m<l;++m){k.F.skip(4);for(var n=_.Dj(k.F),p=0;p<n;++p){var q=1===k.version?_.Ej(k.F):_.Dj(k.F);g.push(q);k.F.skip(6)}}}).M(_.ld,_.tk(function(k){d=!0;k=c.f.parseMedia(k,b,g);e=e.concat(k.cues);f=f.concat(k.styles)})).parse(a);d||this.a.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.u(os,_.mn);os.prototype.Ea=function(){_.Go[_.Vb]=js;_.Go[_.Tb]=ns;_.Go[Uq]=ns;_.Go[Wq]=ns;_.Go[Vq]=ns;_.ph.push(this.a)};os.prototype.va=function(){_.Ho(_.Vb);_.Ho(_.Tb);_.Ho(Uq);_.Ho(Wq);_.Ho(Vq);_.rh(this.a)};os.prototype.id=function(){return _.qe};_.A("clpp.ttml.TtmlComponent",os);};
28
28
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
29
29
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
30
30
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,9 +1,9 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var mq="VerimatrixVCAS",nq="clpp.verimatrix.Vcas",oq="clpp.verimatrix.VcasComponent",uq=function(a){_.uj.call(this,mq);var b={};b[pq]=pq;b[qq]=qq;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?rq:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,k=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?sq:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.C=d;this.B=b;this.w=tq(this,e);this.o=tq(this,f);this.m=tq(this,g);this.j=k;this.H=l;this.D=m;this.f=new _.C(nq);_.$g(this.w)?this.f.warn(_.rb):this.Ea(_.Fc,{licenseUrl:this.w,videoRobustness:[_.gb,void 0],audioRobustness:[_.fb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.$g(this.o)?this.f.warn(_.Xa):this.Ea(_.Ec,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.$g(this.m)?this.f.warn(_.Da):_.$g(this.j)?this.f.warn(_.Ca):this.Ea(_.Dc,{licenseUrl:this.m,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.M.bind(this),extractContentId:this.I.bind(this)}})},tq=function(a,b){if(a.C===rq){var c=Object.assign({},{deviceId:_.ej(_.Wg(a.A))},a.a&&{authenticator:_.ej(_.Wg(a.a))});return b+_.Jj(c)}return b},vq=function(){this.l=null;this.a=new _.C(oq)};_.u(uq,_.uj);
5
- uq.prototype.h=function(a,b){if(this.C===wq){var c=this.B[qq],d={};d[this.B[pq]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};uq.prototype.I=function(a,b){var c=_.Nj(b);switch(this.D){case xq:c=_.Jj({r:c,ik:this.H},!0)}return c};uq.prototype.K=function(a,b){this.h(a,b);_.Pj(b)};uq.prototype.M=function(a,b){_.Qj(b)};_.A(nq,uq);uq.prototype.constructor=uq.prototype.constructor;uq.NAME=mq;var rq="query-string",wq="http-header";
6
- uq.LicenseRequestVuidLocation={QUERY_STRING:rq,HTTP_HEADER:wq};var pq="DeviceId",qq="Authenticator";uq.LicenseRequestHttpHeader={DEVICE_ID_HEADER:pq,AUTHENTICATOR_HEADER:qq};var sq="keyid",xq="contentid-siteid";uq.FairPlayAssetIdStrategy={KEYID:sq,CONTENTID_SITEID:xq};_.u(vq,_.ln);_.h=vq.prototype;_.h.Da=function(a){this.l=a};_.h.va=function(){this.l=null};_.h.Vb=function(){var a=this.l.getConfiguration();if(a.drm&&a.drm.env===mq){a=a.drm.customData;if(!a)throw new _.J(_.K,7,7100,_.Gc);a=new uq(a);this.a.info("Registering the Verimatrix VCAS Ultra environment");_.pj(a)}};_.h.release=function(){};_.h.id=function(){return"verimatrix-vcas"};_.A(oq,vq);};
2
+ var f=function(window){var Iq="VerimatrixVCAS",Jq="clpp.verimatrix.Vcas",Kq="clpp.verimatrix.VcasComponent",Qq=function(a){_.vj.call(this,Iq);var b={};b[Lq]=Lq;b[Mq]=Mq;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?Nq:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,k=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Oq:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.C=d;this.B=b;this.w=Pq(this,e);this.o=Pq(this,f);this.m=Pq(this,g);this.j=k;this.G=l;this.D=m;this.f=new _.D(Jq);_.ah(this.w)?this.f.warn(_.rb):this.Fa(_.Fc,{licenseUrl:this.w,videoRobustness:[_.gb,void 0],audioRobustness:[_.fb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.ah(this.o)?this.f.warn(_.Xa):this.Fa(_.Ec,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
+ _.ah(this.m)?this.f.warn(_.Da):_.ah(this.j)?this.f.warn(_.Ca):this.Fa(_.Dc,{licenseUrl:this.m,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},Pq=function(a,b){if(a.C===Nq){var c=Object.assign({},{deviceId:_.fj(_.Xg(a.A))},a.a&&{authenticator:_.fj(_.Xg(a.a))});return b+_.Kj(c)}return b},Rq=function(){this.l=null;this.a=new _.D(Kq)};_.u(Qq,_.vj);
5
+ Qq.prototype.h=function(a,b){if(this.C===Sq){var c=this.B[Mq],d={};d[this.B[Lq]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Qq.prototype.I=function(a,b){var c=_.Oj(b);switch(this.D){case Tq:c=_.Kj({r:c,tk:this.G},!0)}return c};Qq.prototype.K=function(a,b){this.h(a,b);_.Qj(b)};Qq.prototype.L=function(a,b){_.Rj(b)};_.A(Jq,Qq);Qq.prototype.constructor=Qq.prototype.constructor;Qq.NAME=Iq;var Nq="query-string",Sq="http-header";
6
+ Qq.LicenseRequestVuidLocation={QUERY_STRING:Nq,HTTP_HEADER:Sq};var Lq="DeviceId",Mq="Authenticator";Qq.LicenseRequestHttpHeader={DEVICE_ID_HEADER:Lq,AUTHENTICATOR_HEADER:Mq};var Oq="keyid",Tq="contentid-siteid";Qq.FairPlayAssetIdStrategy={KEYID:Oq,CONTENTID_SITEID:Tq};_.u(Rq,_.mn);_.h=Rq.prototype;_.h.Ea=function(a){this.l=a};_.h.va=function(){this.l=null};_.h.Vb=function(){var a=this.l.getConfiguration();if(a.drm&&a.drm.env===Iq){a=a.drm.customData;if(!a)throw new _.J(_.K,7,7100,_.Gc);a=new Qq(a);this.a.info("Registering the Verimatrix VCAS Ultra environment");_.qj(a)}};_.h.release=function(){};_.h.id=function(){return"verimatrix-vcas"};_.A(Kq,Rq);};
7
7
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
8
8
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
9
9
  else{_=this.clpp._;(f.call(g,this));}