@castlabs/prestoplay 6.25.2-beta.7 → 6.25.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +105 -105
  6. package/cjs/cl.conviva.js +31 -31
  7. package/cjs/cl.core.js +329 -329
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +88 -88
  10. package/cjs/cl.externs.js +31 -31
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +77 -77
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +291 -289
  18. package/cjs/cl.muxdata.js +9 -9
  19. package/cjs/cl.persistent.js +10 -10
  20. package/cjs/cl.playlist.js +4 -4
  21. package/cjs/cl.sessions.js +8 -8
  22. package/cjs/cl.simid.js +4 -4
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +11 -11
  25. package/cjs/cl.tizen.js +69 -69
  26. package/cjs/cl.ttml.js +3 -3
  27. package/cjs/cl.verimatrix.js +2 -2
  28. package/cjs/cl.vimond.js +8 -8
  29. package/cjs/cl.vr.js +7 -7
  30. package/cjs/cl.vtt.js +2 -2
  31. package/cjs/cl.yospace.js +2 -2
  32. package/cjs/cl.youbora.js +17 -17
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +84 -84
  37. package/cl.conviva.js +26 -26
  38. package/cl.core.js +178 -178
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +82 -82
  41. package/cl.externs.js +31 -31
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +80 -80
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +17 -18
  47. package/cl.mediatailor.js +3 -3
  48. package/cl.mse.js +243 -243
  49. package/cl.muxdata.js +6 -6
  50. package/cl.persistent.js +2 -2
  51. package/cl.playlist.js +4 -4
  52. package/cl.sessions.js +2 -2
  53. package/cl.simid.js +1 -1
  54. package/cl.smooth.js +60 -60
  55. package/cl.thumbnails.js +9 -9
  56. package/cl.tizen.js +54 -54
  57. package/cl.ttml.js +2 -2
  58. package/cl.verimatrix.js +1 -1
  59. package/cl.vimond.js +3 -3
  60. package/cl.vr.js +2 -2
  61. package/cl.vtt.js +2 -2
  62. package/cl.yospace.js +2 -2
  63. package/cl.youbora.js +12 -12
  64. package/package.json +1 -1
  65. package/typings.d.ts +9 -0
@@ -1,27 +1,27 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
2
  var f=function(window){var Tz="No thumbnail found for position: ",Uz="Position is out of range: ",Vz="Thumbnail URL is mandatory",Wz="Wrong gridSize format",Xz="clpp.thumbnails",Yz=function(){this.log=new _.J(Xz);this.player=null;this.a=[];this.w=!1},$z=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Re&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Zz(a,0,e,!!f)})},Promise.resolve())},Zz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return aA(a,d).then(function(){return a.a[b].load()}).then(function(){return Zz(a,
3
- e,c,d)})},aA=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.yq)c();else a.player.one(_.$c,function(){c()})})},bA=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ua=p;this.il=h;this.fo=l;this.cm=m;this.dm=n;this.lg=null},cA=function(){Yz.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},dA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.yd=new _.kk},eA=function(){this.g=new _.J(Xz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.kk},fA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.yd.resolve()})},hA=function(a,b){return gA(a,b).then(function(c){return new bA(c,b.time,b.duration)})},gA=function(a,b){return b.load().then(function(){var c=_.Oj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.Lm(c)})},iA=function(){Yz.call(this);this.f=null},jA=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},kA=function(){Yz.apply(this,arguments)},lA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{me:c,Zg:d,ji:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},mA=function(){this.g=new _.J(Xz);this.a=this.m=null},nA=function(a){return a.some(function(b){return 0<
3
+ e,c,d)})},aA=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.yq)c();else a.player.one(_.$c,function(){c()})})},bA=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ua=p;this.nl=h;this.ko=l;this.hm=m;this.im=n;this.og=null},cA=function(){Yz.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},dA=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.zd=new _.kk},eA=function(){this.g=new _.J(Xz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.kk},fA=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.zd.resolve()})},hA=function(a,b){return gA(a,b).then(function(c){return new bA(c,b.time,b.duration)})},gA=function(a,b){return b.load().then(function(){var c=_.Oj(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.Lm(c)})},iA=function(){Yz.call(this);this.f=null},jA=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},kA=function(){Yz.apply(this,arguments)},lA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{ne:c,$g:d,mi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},mA=function(){this.g=new _.J(Xz);this.a=this.m=null},nA=function(a){return a.some(function(b){return 0<
6
6
  b.thumbStreams.length})},sA=function(a){return a?a===oA||a===pA?new cA:a===qA?new iA:a===rA?new eA:null:null},tA=function(a){if(!a)return null;a=new _.Mk(a);return a.path.match(/.*\.vtt$/i)?qA:a.path.match(/.*\.bif$/i)?rA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?oA:null},uA=function(){};Yz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Kf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&$z(c,b.preload)})};bA.prototype.raw=function(){return this.ua.cloneNode(!1)};
7
7
  bA.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(_.Qd);e.style.width=c+_.Hf;e.style.height=d+_.Hf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.ua.naturalWidth||this.ua.width))+"px "+Math.ceil(d/
8
8
  this.height*(this.ua.naturalHeight||this.ua.height))+_.Hf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Hf;e.style.backgroundPositionY="-"+f*d+_.Hf;return e};
9
- bA.prototype.load=function(){var a=this;this.lg||(this.lg=new Promise(function(b,c){function d(){a.width||(a.width=(a.ua.naturalWidth||a.ua.width)/a.il);a.height||(a.height=(a.ua.naturalHeight||a.ua.height)/a.fo);a.x||(a.x=a.width*a.cm);a.y||(a.y=a.height*a.dm)}if(a.ua.src&&a.ua.complete)d(),b(a);else{var e=null,f=function(){d();a.ua.removeEventListener(_.Be,f);a.ua.removeEventListener(_.ie,e);b(a)};e=function(g){a.ua.removeEventListener(_.Be,f);a.ua.removeEventListener(_.ie,e);c(new _.N(1,9,2014,
10
- "Failed to load thumbnail.",g))};a.ua.addEventListener(_.Be,f);a.ua.addEventListener(_.ie,e);a.ua.src=a.src}}));return this.lg};_.I("clpp.thumbnails.Thumbnail",bA);bA.prototype.load=bA.prototype.load;bA.prototype.element=bA.prototype.element;bA.prototype.raw=bA.prototype.raw;_.w(cA,Yz);
9
+ bA.prototype.load=function(){var a=this;this.og||(this.og=new Promise(function(b,c){function d(){a.width||(a.width=(a.ua.naturalWidth||a.ua.width)/a.nl);a.height||(a.height=(a.ua.naturalHeight||a.ua.height)/a.ko);a.x||(a.x=a.width*a.hm);a.y||(a.y=a.height*a.im)}if(a.ua.src&&a.ua.complete)d(),b(a);else{var e=null,f=function(){d();a.ua.removeEventListener(_.Be,f);a.ua.removeEventListener(_.ie,e);b(a)};e=function(g){a.ua.removeEventListener(_.Be,f);a.ua.removeEventListener(_.ie,e);c(new _.N(1,9,2014,
10
+ "Failed to load thumbnail.",g))};a.ua.addEventListener(_.Be,f);a.ua.addEventListener(_.ie,e);a.ua.src=a.src}}));return this.og};_.I("clpp.thumbnails.Thumbnail",bA);bA.prototype.load=bA.prototype.load;bA.prototype.element=bA.prototype.element;bA.prototype.raw=bA.prototype.raw;_.w(cA,Yz);
11
11
  cA.prototype.init=function(a,b){if(!b||!b.url)throw new _.N(1,9,7100,Vz);if("GRID"===b.mode&&!b.gridSize)throw new _.N(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.N(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{var c=this.f.gridSize.split(/x/).map(function(d){return parseInt(d,10)}).filter(function(d){return 0<d});if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.N(1,9,7100,Wz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
12
  new _.N(1,9,7100,Wz);}Yz.prototype.init.call(this,a,b)};cA.prototype.get=function(a){var b=this,c,d,e,f;return _.H(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.N(1,9,2014,Uz+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.N(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.x(g,f.load(),2)}return g["return"](f)})};
13
- cA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new bA(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()};dA.prototype.load=function(){return this.yd};
13
+ cA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new bA(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()};dA.prototype.load=function(){return this.zd};
14
14
  eA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Vz);var d=b.url,e=_.ck(d);e.type=_.bk;a.getNetworkEngine().fetch(e).S.then(function(f){f=f.data;var g=_.Oj(c.f);f=_.Oj(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.Oj(l);n=String.fromCharCode.apply(null,
15
15
  vA);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new dA(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
16
  fA(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.N(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};eA.prototype.get=function(a){var b=this,c,d;return _.H(function(e){switch(e.a){case 1:if(0>a)throw new _.N(1,9,2014,Uz+a);return _.x(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.N(1,9,2014,Tz+a);return _.x(e,hA(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
- eA.prototype.Ic=function(){return 0<this.a.length};var vA=[137,66,73,70,13,10,26,10];_.w(iA,Yz);
17
+ eA.prototype.Jc=function(){return 0<this.a.length};var vA=[137,66,73,70,13,10,26,10];_.w(iA,Yz);
18
18
  iA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,Vz);var d=b.url,e=_.ck(d);e.type=_.bk;this.f=a.getNetworkEngine().fetch(e).S.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.Q.ea(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=h.indexOf("#");h=0>t?h:h.substr(0,t);h.match(/^http|^\/\//)||(h=
19
19
  d.substr(0,d.lastIndexOf("/"))+"/"+h);t=jA(l[0]);l=jA(l[1])-t;c.a.push(new bA(h,t,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.N(1,9,2013,"Error while loading VTT thumbnails.",f))});Yz.prototype.init.call(this,a,b)};
20
20
  iA.prototype.get=function(a){var b=this,c;return _.H(function(d){if(1==d.a){if(0>a)throw new _.N(1,9,2014,Uz+a);return _.x(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.N(1,9,2014,Tz+a);return _.x(d,c.load(),3)}return d["return"](c)})};iA.prototype.l=function(){return this.f};_.w(kA,Yz);
21
- kA.prototype.get=function(a){function b(){return new _.N(1,9,2014,Tz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.H(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.N(1,9,2014,Uz+a);d=c.player.getPeriods();for(var E=null,G=_.u(d),B=G.next();!B.done;B=G.next())B=B.value,B.startTime<=a&&(E=B);e=E;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
- b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return A.F(2);l=lA(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.ji+m])):(q=h.cb())&&0<q.length&&(v=t=0,z=h.startTime,1<l.ji&&(t=m%l.me,v=Math.floor(m/l.me),z+=m*l.durationPerTile),n=new bA(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.me,l.Zg,
23
- t,v));return n?_.x(A,n.load(),4):A.F(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};kA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- kA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.L.R(d=b.getSegmentReference(c++));)for(var e=lA(d,b),f=d.cb()[0],g=new Image,h=d.startTime,l=0;l<e.Zg;++l)for(var m=0;m<e.me;++m)this.a.push(new bA(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.me,e.Zg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=mA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
21
+ kA.prototype.get=function(a){function b(){return new _.N(1,9,2014,Tz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.H(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.N(1,9,2014,Uz+a);d=c.player.getPeriods();for(var D=null,G=_.u(d),B=G.next();!B.done;B=G.next())B=B.value,B.startTime<=a&&(D=B);e=D;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
22
+ b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return A.D(2);l=lA(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.mi+m])):(q=h.cb())&&0<q.length&&(v=t=0,z=h.startTime,1<l.mi&&(t=m%l.ne,v=Math.floor(m/l.ne),z+=m*l.durationPerTile),n=new bA(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.ne,l.$g,
23
+ t,v));return n?_.x(A,n.load(),4):A.D(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};kA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ kA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.L.R(d=b.getSegmentReference(c++));)for(var e=lA(d,b),f=d.cb()[0],g=new Image,h=d.startTime,l=0;l<e.$g;++l)for(var m=0;m<e.ne;++m)this.a.push(new bA(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.ne,e.$g,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=mA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
25
25
  _.r.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=tA(c.url||null));(this.a=sA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.De,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
26
26
  _.r.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(nA(d)){this.a=new kA;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.N(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.I("clpp.thumbnails.ThumbnailsPlugin",mA);mA.prototype.get=mA.prototype.get;mA.Id="thumbnails";
27
27
  uA.prototype.create=function(){return new mA};_.Yt(new uA);var oA="SINGLE",pA="GRID",qA="WEBVTT",rA="BIF";};
package/cjs/cl.tizen.js CHANGED
@@ -1,76 +1,76 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var FN="An unknown error occurred while trying to get volume",GN="Cannot get loading rendition due to platform limitations",HN="PARAM_START_POSITION",IN="SecurityError",JN="The require privilege is: http://tizen.org/privilege/tv.audio",KN="|STARTBITRATE\x3d",LN=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},MN=function(a,b){this.h=a;this.o=null;this.a=_.Qe;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.J("clpp.tizen.DrmEngine")},PN=function(a){var b,
3
- c,d;return _.H(function(e){if(1==e.a){b=a.a===_.Gd||a.a===_.Ed;if(!b)throw new _.N(_.O,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.te)throw new _.N(_.O,6,6012,"No license server given for "+a.a);_.C(e,2);return a.a===_.Gd?_.x(e,NN(a),5):_.x(e,ON(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.te,distinctiveIdentifierRequired:!1,persistentStateRequired:c.zg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
- keyIds:[],periodId:null},_.uh(e,0);d=_.D(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.N(_.O,6,6005,{message:JSON.stringify(d)});})},ON=function(a,b){var c,d,e,f;return _.H(function(g){c=QN;d=RN;e={};e[d.tj]=!b.zg;e[d.wj]=b.te;""!==b.customData&&(e[d.rj]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.y(g)})},NN=function(a){var b;return _.H(function(c){b=QN;try{webapis.avplay.setDrm(b.Oe,
5
- "Initialize",""),webapis.avplay.setDrm(b.Oe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Oe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.y(c)})},SN=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,A,E,G;_.H(function(B){if(1==B.a){c=QN;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.te;l=_.ck([h],_.Yj());l.type=3;l.body=f.buffer;l.method=
6
- _.sb;_.C(B,2);return _.x(B,a.D.Cb.fetch(l).S,4)}if(2!=B.a){m=B.f;if(a.j){n=_.Oj(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+HN+(v+HN);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.Oe,"widevine_license_data",z)}catch(F){a.g.error("License response rejected by CDM"),A=new _.N(_.O,6,6008,{browserError:JSON.stringify(F)}),a.D.onError(A)}}return _.uh(B,0)}E=_.D(B);a.g.error("License request failed.",JSON.stringify(E));G=new _.N(_.O,
7
- 6,6007,{message:"Error while fetching license!",url:E.data.url,status:E.data.status||NaN,response:E.data.response||"",headers:E.data.headers||{}},E);a.D.onError(G);_.y(B)})},TN=function(a){this.m=a;this.a=this.m.a;this.f=_.tq;this.j=_.uq;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.J("clpp.tizen.StateManager")},VN=function(a,b){if(a.f!==b)if(a.f===_.Eq&&b!==_.tq)a.g.debug(_.UC+UN(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.yq?(a.o=(new Date).getTime(),a.m.trigger(new _.K(_.ad,
8
- {detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.yq&&a.m.trigger(new _.K(_.$c,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.K(_.bg,{detail:d}));a.g.debug("State changed:",UN(a.j),"-\x3e",UN(a.f))}},UN=function(a){return Object.keys(_.Cq)[a]},YN=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case WN:c=_.Hq;break;case XN:c=_.Gq;break;default:a.m.isEnded()?c=_.Aq:a.g.debug("Inconsistent AVPlay playback state:",
9
- b)}VN(a,c)}},ZN=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.C=!1;this.w=!0;this.l=null;this.g=new _.J("clpp.tizen.TextStreamer")},$N=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},aO=function(a){var b,c;return _.H(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.x(d,_.av(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},
10
- bO=function(a){var b=document.createElement(_.Jg),c=new _.yG,d=new _.cE,e=a.m.getTextDisplayer();return new _.AG(b,c,e,d,a.m.getConfiguration())},cO=function(a){var b={configuration:{},Ob:function(){return a.m.getPosition()},X:a.h,Cb:a.m.getNetworkEngine(),nd:null,rg:a.bl.bind(a),qg:a.al.bind(a),onError:a.cl.bind(a),Fi:function(){},onEvent:function(){},Ki:a.dl.bind(a),rf:function(){},ee:function(){return new _.mH},Tf:function(){return!1},Zd:null};return new _.TH(a.a,b)},dO=function(a){var b=a.m.getPosition(),
11
- c=null;a=_.u(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},eO=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Dk(String(c++),_.S);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
- a[d].kind||_.rD;var f=new _.Lk(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},fO=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.WH(a.f,_.pj),c=null;if(b){a=eO(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},gO=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.ke,a.a&&a.f)){a.setTextVisibility(!0);
13
- var c=dO(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)===d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(_.hI(a.f,c,!0,0),a.m.trigger(new _.K(_.mg))),a.o=c.language):a.g.error("No stream with id",d.id)}},hO=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.J("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},iO=function(a,b){a.m.trigger(new _.K(_.Ng,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,
14
- abrSelection:a.a.o}}))},jO=function(a){var b=a.ma();b&&a.m.trigger(new _.K(_.Yc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},kO=function(a){var b=a.m.getConfiguration(),c=_.Gi(b.preferredAudioLanguage||[]),d=a.f[_.T]||[];if(d.length){var e=null;c.some(function(g){e=_.OD(g,d.map(function(h){return h.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),
15
- 0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ia(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},oO=function(a,b){if(b){var c=b.track.type.toUpperCase();lO(a.a,c,Number(b.id)).then(function(){c===mO&&(a.l=b,a.m.trigger(new _.K(_.Wc)));c===nO&&(a.o=b,a.m.trigger(new _.K(_.mg)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},pO=
16
- function(a,b,c){var d=_.Cj(b.language||_.wg);c.language=_.Ek(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Tc;a=new _.Lk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},qO=function(a,b,c){c.mimeType=_.Lg;a=new _.Lk(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},rO=function(a,b,c){b=_.Cj(b.track_lang||_.wg);c.mimeType="text/ttml";
17
- c.language=_.Ek(b);c.originalLanguage=b;c.kind=_.rD;return new _.Lk(String(a),c)},sO=function(a,b){var c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},vO=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===tO}),f=b.filter(function(n){return n.type===mO}),g=[],h=0;h<f.length;h++){var l=sO(a,f[h].extra_info);if(l){var m=
18
- _.Cj(l.language||_.wg);m=_.Ek(m);m=c(g,m);m||(m=new _.Dk(String(a.h++),_.T),g.push(m));m.renditions.push(pO(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Dk(String(a.h++),_.Fk);for(h=0;h<e.length;h++)(l=sO(a,e[h].extra_info))?f.renditions.push(qO(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?eO(a.j):uO(a,b);d[_.Fk]=[f];d[_.T]=g;d[_.S]=e;return d},uO=function(a,b){for(var c=b.filter(function(h){return h.type===nO}),d=[],e=0;e<
19
- c.length;e++){var f=sO(a,c[e].extra_info);if(f){var g=new _.Dk(String(a.h++),_.S);g.renditions.push(rO(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},wO=function(a,b){for(var c=a.f[_.Fk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.L.pa(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},xO=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===
20
- b){c=a[d].renditions[e];break}return c},zO=function(a,b){if(b===_.S&&a.j)return fO(a.j);var c=yO(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Fk&&(d=sO(a,c.extra_info),d=wO(a,{width:d.Width,height:d.Height}));b===_.T&&(c?(d=xO(a,c,_.T),a.l=d):d=a.l);b===_.S&&(c?(d=xO(a,c,_.S),a.o=d):d=a.o);return d},AO=function(a){_.mm.call(this);this.m=a;this.h=null;this.g=new _.J("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.G=0;
21
- this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},BO=function(a){return _.H(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.y(b)})},DO=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Wk.bind(a),onbufferingprogress:a.Vk.bind(a),onbufferingcomplete:a.Uk.bind(a),onstreamcompleted:a.Zk.bind(a),oncurrentplaytime:function(b){a.trigger(new _.K(CO,
22
- {currentTime:b}))},onevent:a.Yk.bind(a),onsubtitlechange:a.$k.bind(a),ondrmevent:a.Xk.bind(a),onerror:a.Vd.bind(a)})}catch(b){a.g.error(b)}},EO=function(a){var b=!!a.m.getTrackManager().Wa();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},FO=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,fp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",KN+d)}catch(e){a.g.debug(e)}},
23
- GO=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+KN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},JO=function(a){return{position:a.getPosition(),state:a.m.getState(),mh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:HO(a),volume:a.getVolume(),Ao:IO(a),pl:yO(a)}},LO=function(a){var b,c;return _.H(function(d){if(1==d.a)return _.x(d,KO(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Xh(e)).ga(5)}),
24
- _.x(d,Promise.race([BO(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),d["return"](Promise.reject("SDK Timeout"));_.y(d)})},RO=function(a,b,c){var d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:a.l=_.Lq(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.K(MO)),f=c.currentPosition);
25
- _.C(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Ic||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(GO(a,e.nextBandwidth),a.o=!1):(a.o||FO(a,e),a.o=!0);DO(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.F(4);break}m={onError:function(q){return a.m.onError(q)},Cb:a.m.getNetworkEngine()};a.h=new MN(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.K(NO)),
26
- _.x(p,OO(a),6);case 6:a.f||a.trigger(new _.K(PO));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&QO(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.uh(p,0);break;case 2:throw n=_.D(p),a.g.debug("Error while attempting to load source."),n;}})},OO=function(a){return _.H(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");
27
- EO(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},SO=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=JO(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.mh;a.f=!1;a.a=
28
- null;return e===XN?a.pause():a.play()})}catch(e){return Promise.reject(e)}},IO=function(a){return a.f&&a.a?a.a.Ao:webapis.avplay.getTotalTrackInfo()},yO=function(a){return a.f&&a.a?a.a.pl:webapis.avplay.getCurrentStreamInfo()},lO=function(a,b,c){b=b.toUpperCase();b===nO&&TO(a,!0);var d=a.j[b];d&&(d.Bf.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
29
- h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,ih:0,Bf:new _.Xh(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.ih?(!a.w&&++l.ih,l.Bf.ga(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Bf.stop(),a.j[h]=null,f())}}g(b,c)})},TO=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",
30
- d)}},QO=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case IN:a.g.warn("The application does not have the privilege to set mute.",JN);break;default:a.g.warn(FN,c)}}},HO=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case IN:a.g.warn("The application doesn't have the privilege to get the mute state.",JN);break;default:a.g.warn(FN,c)}}return!!b},KO=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
- LN(c,_.Be,function(d){return a(d)});LN(c,_.ie,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},UO=function(){_.mm.call(this);this.a=new AO(this);this.f=new TN(this);this.configuration=this.B=_.tm();this.w=null;this.g=new _.J("clpp.tizen.Player");this.j=null;this.l=new hO;this.C=new _.vk;this.o=this.h=null;this.A=!1},VO=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*
32
- a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},WO=function(){},XO=function(){};
33
- MN.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){b=_.Vm[a.h.env]||null;if(!b)throw a.g.debug(_.Ea,_.xb+a.h.env+_.aa),new _.N(_.O,6,6015,_.Fa+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.Xm(b,a.h.customData);(e=d[_.Ed])&&a.f.set(_.Ed,{te:e.licenseUrl||"",customData:c,zg:!1});(f=d[_.Gd])&&a.f.set(_.Gd,{te:f.licenseUrl||"",customData:c,
34
- zg:!1});if(0===a.f.size)throw new _.N(_.O,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Ed))a.a=_.Ed;else if(a.f.get(_.Gd))a.a=_.Gd;else throw new _.N(_.O,6,6001,"Configuration for the target system is missing.");return _.x(h,PN(a),2)}a.j=!0;_.y(h)})};MN.prototype.release=function(){var a=this;return _.H(function(b){a.j=!1;a.o=null;a.a=_.Qe;a.l=null;a.f=new Map;_.y(b)})};MN.prototype.getDrmInfo=function(){return this.o};
35
- var RN={tj:"DeleteLicenseAfterUse",wj:"LicenseServer",Qo:"GetChallenge",Ro:"HttpHeader",To:"UserAgent",No:"Cookie",rj:"CustomData"};_.r=TN.prototype;_.r.initialize=function(){this.a.on(MO,this.Dh,this);this.a.on(YO,this.Ch,this);this.a.on(ZO,this.Bh,this);this.a.on(NO,this.Mi,this);this.a.on(PO,this.Li,this);this.a.on($O,this.Eh,this)};_.r.release=function(){VN(this,_.tq);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(MO,this.Dh);this.a.off(YO,this.Ch);this.a.off(ZO,this.Bh);this.a.off(NO,this.Mi);this.a.off(PO,this.Li);this.a.off($O,this.Eh);this.m=this.a=null};
36
- _.r.Dh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;VN(this,_.yq)};_.r.Ch=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",UN(this.f))};_.r.Bh=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===aP;if(!a&&b){VN(this,_.Gq);return}}if(a=this.f!==_.Fq)a=this.a.getState(),a=a===WN||a===XN;a&&YN(this)};
37
- _.r.Mi=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===bP?VN(this,_.Fq):this.g.error("AVPlay prepares while state is not IDLE")};_.r.Li=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.Eh=function(){VN(this,_.Aq)};_.r.getState=function(){return this.f};_.r=ZN.prototype;_.r.initialize=function(a){this.m=a};
38
- _.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.H(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.x(m,aO(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:function(){return null},filterNewPeriod:function(){},filterAllPeriods:function(){},
39
- onEvent:function(){},onError:function(){}};_.C(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.uh(m,4);break;case 3:return f=_.D(m),b.g.warn(f),_.C(m,6),g=b,_.x(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.uh(m,4);break;case 6:h=_.D(m),b.g.error(h),b.a=null;case 4:if(!b.a||!$N(b.a)){m.F(0);break}b.h=bO(b);_.C(m,10);return _.x(m,b.h.open(),12);case 12:b.f=cO(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.C=
40
- l.preferForcedSubtitles;_.uh(m,0);break;case 10:_.D(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.y(m)}})};_.r.bl=function(a){this.g.debug(_.lD,a);this.w=!0;var b=_.lH(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,eb:null}};_.r.al=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.hI(this.f,this.l,!0,0),this.l=null)};_.r.cl=function(){this.g.debug("onError_")};
41
- _.r.dl=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.H(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.y(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.r.release=function(){var a=this;return _.H(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.y(b)})};
42
- _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.j){b.F(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.F(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.F(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.y(b)}})};_.w(hO,_.gl);_.r=hO.prototype;_.r.Di=function(a){var b=a.eventid;a=a.data;switch(b){case cP:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+sO(this,b[0].extra_info).Bit_rate,b=wO(this,{bandwidth:b}))&&(this.w=b,iO(this,b));break;case dP:jO(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.vg=function(a){a.detail.currentState===_.Hq&&this.m.off(_.bg,this.vg)};
43
- _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.bg,function(c){b.A||(c=c.detail,c.currentState===_.Hq&&(b.g.debug("Current state",c.currentState),b.A=!0,kO(b)))});this.a.on(eP,this.Di,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
44
- _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.bg,this.vg);this.m.on(_.bg,this.vg,this);try{var a=IO(this.a);this.f=vO(this,a);var b=this.f[_.T]||[];b.length&&(this.l=b[0].renditions[0]||null);jO(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off(eP,this.Di);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Fk]||[]};_.r.getAudioTracks=function(){return this.f[_.T]||[]};
45
- _.r.la=function(){return this.f[_.S]||[]};_.r.ma=function(){return zO(this,_.Fk)};_.r.Sa=function(){return zO(this,_.T)};_.r.Wa=function(){return zO(this,_.S)};_.r.zb=function(){return this.w};_.r.Lb=function(){this.g.info(GN);return null};_.r.Mb=function(){this.g.info(GN);return null};_.r.La=function(){var a=this.ma();return a?a.track:null};_.r.qa=function(){var a=this.Sa();return a?a.track:null};_.r.Ba=function(){var a=this.Wa();return a?a.track:null};
46
- _.r.Hb=function(a){var b=this;null===a?(a=this.ma(),SO(this.a,a.bandwidth,null).then(function(){jO(b)})):0<a.renditions.length&&this.sb(a.renditions[0])};_.r.Ia=function(a){a?oO(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.Xa=function(a){a?(a=a.renditions[0],this.j?gO(this.j,a.track):oO(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,TO(this.a,!1),this.m.trigger(new _.K(_.mg)))};
47
- _.r.sb=function(a){var b=this,c=this.ma();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,iO(this,a),SO(this.a,c.bandwidth,a.bandwidth).then(function(){jO(b)})["catch"](function(d){var e=new _.N(_.O,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.r.Fb=function(a){oO(this,a)};_.r.Gb=function(a){this.j?gO(this.j,a.track):oO(this,a)};
48
- _.r.addTextTrack=function(){};_.r.va=function(){return this.a.o};hO.prototype.isAbrEnabled=hO.prototype.va;hO.prototype.addTextTrack=hO.prototype.addTextTrack;hO.prototype.setTextRendition=hO.prototype.Gb;hO.prototype.setAudioRendition=hO.prototype.Fb;hO.prototype.setVideoRendition=hO.prototype.sb;hO.prototype.setTextTrack=hO.prototype.Xa;hO.prototype.setAudioTrack=hO.prototype.Ia;hO.prototype.setVideoTrack=hO.prototype.Hb;hO.prototype.getTextTrack=hO.prototype.Ba;hO.prototype.getAudioTrack=hO.prototype.qa;
49
- hO.prototype.getVideoTrack=hO.prototype.La;hO.prototype.getLoadingTextRendition=hO.prototype.Mb;hO.prototype.getLoadingAudioRendition=hO.prototype.Lb;hO.prototype.getLoadingVideoRendition=hO.prototype.zb;hO.prototype.getTextRendition=hO.prototype.Wa;hO.prototype.getAudioRendition=hO.prototype.Sa;hO.prototype.getVideoRendition=hO.prototype.ma;hO.prototype.getTextTracks=hO.prototype.la;hO.prototype.getAudioTracks=hO.prototype.getAudioTracks;hO.prototype.getVideoTracks=hO.prototype.getVideoTracks;_.w(AO,_.mm);_.r=AO.prototype;_.r.Wk=function(){this.w=!0;this.f||this.trigger(new _.K(MO))};_.r.Vk=function(a){this.w=!0;this.trigger(new _.K(YO,{percent:a}))};_.r.Uk=function(){this.w=!1;this.trigger(new _.K(ZO))};_.r.Zk=function(){this.trigger(new _.K($O))};_.r.Yk=function(a,b){this.trigger(new _.K(eP,{eventid:a,data:b}))};_.r.$k=function(a,b,c,d,e){this.trigger(new _.K(fP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
- _.r.Xk=function(a,b){this.trigger(new _.K(gP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Gd&&"Challenge"===b.name)SN(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.N(_.O,6,6005,{message:JSON.stringify(b)});c.D.onError(d)}}};_.r.Vd=function(a){this.trigger(new _.K(hP,{eventType:a}))};
51
- _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(CO,f,b);g=setTimeout(function(){b.off(CO,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===bP)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){EO(b);d(webapis.avplay.play())},function(f){b.trigger(new _.K(hP));e(f)})})).then(function(){return a()});if(c===XN||c===aP)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===WN?
52
- Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===XN?Promise.resolve():Promise.reject()};
53
- _.r.setPlaybackRate=function(a){var b=this.getState();if(b===aP||b===WN||b===XN){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.C};
54
- _.r.load=function(a,b){var c=this,d;return _.H(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.C(e,2),_.x(e,LO(c),4);case 4:return _.x(e,RO(c,a,b),5);case 5:_.uh(e,0);break;case 2:throw d=_.D(e),new _.N(_.O,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.mh;try{return webapis.avplay.getState()}catch(a){this.Vd(JSON.stringify(a))}};
55
- _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.K(_.Cg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.K(_.Bg));d()},function(){b.B=!1;e()})})};_.r.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.Vd(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.Vd(JSON.stringify(a))}};
56
- _.r.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.Bf.stop()}a.j={};a.C=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case IN:this.g.debug("The application does not have the privilege to get the volume.",JN);break;default:this.g.debug(FN,b)}}return a};
57
- _.r.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case IN:this.g.warn("The application does not have the privilege to set the volume.",JN);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
58
- _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Vd(JSON.stringify(a))}};_.r.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.r.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.r.setSourceIndex=function(a){this.G=a};_.r.getSourceIndex=function(){return this.G};_.r.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
59
- var bP="IDLE",aP="READY",WN="PLAYING",XN="PAUSED",tO=_.Vb,mO=_.ja,nO="TEXT",dP="PLAYER_MSG_RESOLUTION_CHANGED",cP="PLAYER_MSG_BITRATE_CHANGE",QN={PLAYREADY:"PLAYREADY",Oo:"EME_PLAYREADY",Uo:"VERIMATRIX",Oe:"WIDEVINE_CDM",Po:"EME_WIDEVINE_CDM",Wo:"WIDEVINE_CLASSIC"};_.w(UO,_.mm);_.r=UO.prototype;_.r.zh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.K(_.he));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.wh=function(a){this.trigger(new _.K(_.rg,{currentTime:a.currentTime/1E3}))};
60
- _.r.Ah=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Q.Og(d))&&this.o.append([new _.Si(b,c,d)],[])};_.r.xh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.Ei=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
- _.r.yh=function(a){this.g.debug("Error: TYPE: "+a.eventType);VN(this.f,_.Eq);a=new _.N(_.O,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.K(_.ie,{detail:a}))};
62
- _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on($O,this.zh,this);this.a.on(CO,this.wh,this);this.a.on(fP,this.Ah,this);this.a.on(gP,this.xh,this);this.a.on(hP,this.yh,this);this.a.on(ZO,this.Ei,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=iP;iP+=1;this.j=_.er(_.Re,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
63
- var e=[_.Yg,_.pe,"position",_.ve,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.u(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.gr(c,f);VO(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.ob)};_.r.appendLoad=function(){return Promise.reject(_.ob)};
2
+ var f=function(window){var IN="An unknown error occurred while trying to get volume",JN="Cannot get loading rendition due to platform limitations",KN="PARAM_START_POSITION",LN="SecurityError",MN="The require privilege is: http://tizen.org/privilege/tv.audio",NN="|STARTBITRATE\x3d",ON=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},PN=function(a,b){this.h=a;this.o=null;this.a=_.Qe;this.l=null;this.j=!1;this.f=new Map;this.F=b;this.g=new _.J("clpp.tizen.DrmEngine")},SN=function(a){var b,
3
+ c,d;return _.H(function(e){if(1==e.a){b=a.a===_.Gd||a.a===_.Ed;if(!b)throw new _.N(_.O,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.ue)throw new _.N(_.O,6,6012,"No license server given for "+a.a);_.C(e,2);return a.a===_.Gd?_.x(e,QN(a),5):_.x(e,RN(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.ue,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Cg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
+ keyIds:[],periodId:null},_.uh(e,0);d=_.E(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.N(_.O,6,6005,{message:JSON.stringify(d)});})},RN=function(a,b){var c,d,e,f;return _.H(function(g){c=TN;d=UN;e={};e[d.uj]=!b.Cg;e[d.yj]=b.ue;""!==b.customData&&(e[d.tj]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.y(g)})},QN=function(a){var b;return _.H(function(c){b=TN;try{webapis.avplay.setDrm(b.Pe,
5
+ "Initialize",""),webapis.avplay.setDrm(b.Pe,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.Pe,"widevine_data_type",a.l.type)}catch(d){throw d;}_.y(c)})},VN=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,A,D,G;_.H(function(B){if(1==B.a){c=TN;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.ue;l=_.ck([h],_.Yj());l.type=3;l.body=f.buffer;l.method=
6
+ _.sb;_.C(B,2);return _.x(B,a.F.Db.fetch(l).S,4)}if(2!=B.a){m=B.f;if(a.j){n=_.Oj(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);v=btoa(q);z=b.session_id+KN+(v+KN);a.g.debug("Widevine license params",z);try{webapis.avplay.setDrm(c.Pe,"widevine_license_data",z)}catch(F){a.g.error("License response rejected by CDM"),A=new _.N(_.O,6,6008,{browserError:JSON.stringify(F)}),a.F.onError(A)}}return _.uh(B,0)}D=_.E(B);a.g.error("License request failed.",JSON.stringify(D));G=new _.N(_.O,
7
+ 6,6007,{message:"Error while fetching license!",url:D.data.url,status:D.data.status||NaN,response:D.data.response||"",headers:D.data.headers||{}},D);a.F.onError(G);_.y(B)})},WN=function(a){this.m=a;this.a=this.m.a;this.f=_.tq;this.j=_.uq;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.J("clpp.tizen.StateManager")},YN=function(a,b){if(a.f!==b)if(a.f===_.Eq&&b!==_.tq)a.g.debug(_.UC+XN(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.yq?(a.o=(new Date).getTime(),a.m.trigger(new _.K(_.ad,
8
+ {detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.yq&&a.m.trigger(new _.K(_.$c,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.K(_.bg,{detail:d}));a.g.debug("State changed:",XN(a.j),"-\x3e",XN(a.f))}},XN=function(a){return Object.keys(_.Cq)[a]},aO=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case ZN:c=_.Hq;break;case $N:c=_.Gq;break;default:a.m.isEnded()?c=_.Aq:a.g.debug("Inconsistent AVPlay playback state:",
9
+ b)}YN(a,c)}},bO=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.C=!1;this.w=!0;this.l=null;this.g=new _.J("clpp.tizen.TextStreamer")},cO=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},dO=function(a){var b,c;return _.H(function(d){if(1==d.a)return b=a.m.getConfiguration(),c=null,_.x(d,_.av(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},
10
+ eO=function(a){var b=document.createElement(_.Jg),c=new _.AG,d=new _.cE,e=a.m.getTextDisplayer();return new _.CG(b,c,e,d,a.m.getConfiguration())},fO=function(a){var b={configuration:{},Pb:function(){return a.m.getPosition()},X:a.h,Db:a.m.getNetworkEngine(),od:null,ug:a.gl.bind(a),tg:a.fl.bind(a),onError:a.hl.bind(a),Ii:function(){},onEvent:function(){},Ni:a.il.bind(a),uf:function(){},fe:function(){return new _.pH},Wf:function(){return!1},$d:null};return new _.WH(a.a,b)},gO=function(a){var b=a.m.getPosition(),
11
+ c=null;a=_.u(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},hO=function(a){a.g.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.g.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.g.debug(c[d].startTime,a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Dk(String(c++),_.S);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
+ a[d].kind||_.rD;var f=new _.Lk(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},iO=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.ZH(a.f,_.pj),c=null;if(b){a=hO(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},jO=function(a,b){a.g.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.ke,a.a&&a.f)){a.setTextVisibility(!0);
13
+ var c=gO(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)===d.id}))?(a.w?(a.g.debug("Switching period defer text selection"),a.l=c):(_.kI(a.f,c,!0,0),a.m.trigger(new _.K(_.mg))),a.o=c.language):a.g.error("No stream with id",d.id)}},kO=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.J("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},lO=function(a,b){a.m.trigger(new _.K(_.Ng,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,
14
+ abrSelection:a.a.o}}))},mO=function(a){var b=a.ma();b&&a.m.trigger(new _.K(_.Yc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},nO=function(a){var b=a.m.getConfiguration(),c=_.Gi(b.preferredAudioLanguage||[]),d=a.f[_.T]||[];if(d.length){var e=null;c.some(function(g){e=_.OD(g,d.map(function(h){return h.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),
15
+ 0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.Ia(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},rO=function(a,b){if(b){var c=b.track.type.toUpperCase();oO(a.a,c,Number(b.id)).then(function(){c===pO&&(a.l=b,a.m.trigger(new _.K(_.Wc)));c===qO&&(a.o=b,a.m.trigger(new _.K(_.mg)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},sO=
16
+ function(a,b,c){var d=_.Cj(b.language||_.wg);c.language=_.Ek(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Tc;a=new _.Lk(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},tO=function(a,b,c){c.mimeType=_.Lg;a=new _.Lk(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},uO=function(a,b,c){b=_.Cj(b.track_lang||_.wg);c.mimeType="text/ttml";
17
+ c.language=_.Ek(b);c.originalLanguage=b;c.kind=_.rD;return new _.Lk(String(a),c)},vO=function(a,b){var c=null;try{c=JSON.parse(b)}catch(d){a.g.warn("Couldn't retrieve extra infos from stream."),c=null}return c},yO=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===wO}),f=b.filter(function(n){return n.type===pO}),g=[],h=0;h<f.length;h++){var l=vO(a,f[h].extra_info);if(l){var m=
18
+ _.Cj(l.language||_.wg);m=_.Ek(m);m=c(g,m);m||(m=new _.Dk(String(a.h++),_.T),g.push(m));m.renditions.push(sO(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Dk(String(a.h++),_.Fk);for(h=0;h<e.length;h++)(l=vO(a,e[h].extra_info))?f.renditions.push(tO(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?hO(a.j):xO(a,b);d[_.Fk]=[f];d[_.T]=g;d[_.S]=e;return d},xO=function(a,b){for(var c=b.filter(function(h){return h.type===qO}),d=[],e=0;e<
19
+ c.length;e++){var f=vO(a,c[e].extra_info);if(f){var g=new _.Dk(String(a.h++),_.S);g.renditions.push(uO(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},zO=function(a,b){for(var c=a.f[_.Fk]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.L.pa(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},AO=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===
20
+ b){c=a[d].renditions[e];break}return c},CO=function(a,b){if(b===_.S&&a.j)return iO(a.j);var c=BO(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Fk&&(d=vO(a,c.extra_info),d=zO(a,{width:d.Width,height:d.Height}));b===_.T&&(c?(d=AO(a,c,_.T),a.l=d):d=a.l);b===_.S&&(c?(d=AO(a,c,_.S),a.o=d):d=a.o);return d},DO=function(a){_.mm.call(this);this.m=a;this.h=null;this.g=new _.J("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.G=0;
21
+ this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},EO=function(a){return _.H(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.y(b)})},GO=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Zk.bind(a),onbufferingprogress:a.Yk.bind(a),onbufferingcomplete:a.Xk.bind(a),onstreamcompleted:a.cl.bind(a),oncurrentplaytime:function(b){a.trigger(new _.K(FO,
22
+ {currentTime:b}))},onevent:a.al.bind(a),onsubtitlechange:a.el.bind(a),ondrmevent:a.$k.bind(a),onerror:a.Wd.bind(a)})}catch(b){a.g.error(b)}},HO=function(a){var b=!!a.m.getTrackManager().Wa();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},IO=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,jp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",NN+d)}catch(e){a.g.debug(e)}},
23
+ JO=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+NN+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",c),c;}},MO=function(a){return{position:a.getPosition(),state:a.m.getState(),ph:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:KO(a),volume:a.getVolume(),Eo:LO(a),ul:BO(a)}},OO=function(a){var b,c;return _.H(function(d){if(1==d.a)return _.x(d,NO(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Xh(e)).ga(5)}),
24
+ _.x(d,Promise.race([EO(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.g.debug("Took to long for the SDK to be ready"),d["return"](Promise.reject("SDK Timeout"));_.y(d)})},UO=function(a,b,c){var d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:a.l=_.Lq(b);d=a.G;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.g.debug("Loading manifest URL: "+a.l[d].url);f=b.startTime||void 0;a.f&&(a.trigger(new _.K(PO)),f=c.currentPosition);
25
+ _.C(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Ic||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(JO(a,e.nextBandwidth),a.o=!1):(a.o||IO(a,e),a.o=!0);GO(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.D(4);break}m={onError:function(q){return a.m.onError(q)},Db:a.m.getNetworkEngine()};a.h=new PN(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.K(QO)),
26
+ _.x(p,RO(a),6);case 6:a.f||a.trigger(new _.K(SO));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&TO(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.uh(p,0);break;case 2:throw n=_.E(p),a.g.debug("Error while attempting to load source."),n;}})},RO=function(a){return _.H(function(b){a.g.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.g.debug("AVPlay is ready!");
27
+ HO(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),d(e)}}))})},VO=function(a,b,c){a.g.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=MO(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.ph;a.f=!1;a.a=
28
+ null;return e===$N?a.pause():a.play()})}catch(e){return Promise.reject(e)}},LO=function(a){return a.f&&a.a?a.a.Eo:webapis.avplay.getTotalTrackInfo()},BO=function(a){return a.f&&a.a?a.a.ul:webapis.avplay.getCurrentStreamInfo()},oO=function(a,b,c){b=b.toUpperCase();b===qO&&WO(a,!0);var d=a.j[b];d&&(d.Ff.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(h,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(h,l),a.j[h]=null,e()}catch(n){a.g.debug("Could not set "+
29
+ h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,lh:0,Ff:new _.Xh(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.lh?(!a.w&&++l.lh,l.Ff.ga(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Ff.stop(),a.j[h]=null,f())}}g(b,c)})},WO=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.h;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.g.debug("Could not set text track visibility",
30
+ d)}},TO=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case LN:a.g.warn("The application does not have the privilege to set mute.",MN);break;default:a.g.warn(IN,c)}}},KO=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case LN:a.g.warn("The application doesn't have the privilege to get the mute state.",MN);break;default:a.g.warn(IN,c)}}return!!b},NO=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
+ ON(c,_.Be,function(d){return a(d)});ON(c,_.ie,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},XO=function(){_.mm.call(this);this.a=new DO(this);this.f=new WN(this);this.configuration=this.B=_.tm();this.w=null;this.g=new _.J("clpp.tizen.Player");this.j=null;this.l=new kO;this.C=new _.vk;this.o=this.h=null;this.A=!1},YO=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*
32
+ a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.g.debug("Could not apply dimension. Player state "+a.a.getState())},ZO=function(){},$O=function(){};
33
+ PN.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){b=_.Vm[a.h.env]||null;if(!b)throw a.g.debug(_.Ea,_.xb+a.h.env+_.aa),new _.N(_.O,6,6015,_.Fa+a.h.env+"' is missing.");a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.Xm(b,a.h.customData);(e=d[_.Ed])&&a.f.set(_.Ed,{ue:e.licenseUrl||"",customData:c,Cg:!1});(f=d[_.Gd])&&a.f.set(_.Gd,{ue:f.licenseUrl||"",customData:c,
34
+ Cg:!1});if(0===a.f.size)throw new _.N(_.O,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Ed))a.a=_.Ed;else if(a.f.get(_.Gd))a.a=_.Gd;else throw new _.N(_.O,6,6001,"Configuration for the target system is missing.");return _.x(h,SN(a),2)}a.j=!0;_.y(h)})};PN.prototype.release=function(){var a=this;return _.H(function(b){a.j=!1;a.o=null;a.a=_.Qe;a.l=null;a.f=new Map;_.y(b)})};PN.prototype.getDrmInfo=function(){return this.o};
35
+ var UN={uj:"DeleteLicenseAfterUse",yj:"LicenseServer",Uo:"GetChallenge",Vo:"HttpHeader",Xo:"UserAgent",Ro:"Cookie",tj:"CustomData"};_.r=WN.prototype;_.r.initialize=function(){this.a.on(PO,this.Gh,this);this.a.on(aP,this.Fh,this);this.a.on(bP,this.Eh,this);this.a.on(QO,this.Pi,this);this.a.on(SO,this.Oi,this);this.a.on(cP,this.Hh,this)};_.r.release=function(){YN(this,_.tq);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(PO,this.Gh);this.a.off(aP,this.Fh);this.a.off(bP,this.Eh);this.a.off(QO,this.Pi);this.a.off(SO,this.Oi);this.a.off(cP,this.Hh);this.m=this.a=null};
36
+ _.r.Gh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;YN(this,_.yq)};_.r.Fh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",XN(this.f))};_.r.Eh=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay,b=this.a.getState()===dP;if(!a&&b){YN(this,_.Gq);return}}if(a=this.f!==_.Fq)a=this.a.getState(),a=a===ZN||a===$N;a&&aO(this)};
37
+ _.r.Pi=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===eP?YN(this,_.Fq):this.g.error("AVPlay prepares while state is not IDLE")};_.r.Oi=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.Hh=function(){YN(this,_.Aq)};_.r.getState=function(){return this.f};_.r=bO.prototype;_.r.initialize=function(a){this.m=a};
38
+ _.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.H(function(m){switch(m.a){case 1:if(!b.m)return b.g.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.x(m,dO(b),2);case 2:c.j=m.f;if(!b.j)return b.g.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={configurationId:"",networkingEngine:b.m.getNetworkEngine(),onContentSteeringInfoFound:function(){return null},filterNewPeriod:function(){},filterAllPeriods:function(){},
39
+ onEvent:function(){},onError:function(){}};_.C(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.uh(m,4);break;case 3:return f=_.E(m),b.g.warn(f),_.C(m,6),g=b,_.x(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.a=m.f;_.uh(m,4);break;case 6:h=_.E(m),b.g.error(h),b.a=null;case 4:if(!b.a||!cO(b.a)){m.D(0);break}b.h=eO(b);_.C(m,10);return _.x(m,b.h.open(),12);case 12:b.f=fO(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.C=
40
+ l.preferForcedSubtitles;_.uh(m,0);break;case 10:_.E(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.y(m)}})};_.r.gl=function(a){this.g.debug(_.lD,a);this.w=!0;var b=_.oH(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,eb:null}};_.r.fl=function(){this.g.debug("canSwitch_");this.w=!1;this.l&&(_.kI(this.f,this.l,!0,0),this.l=null)};_.r.hl=function(){this.g.debug("onError_")};
41
+ _.r.il=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.H(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.y(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.r.release=function(){var a=this;return _.H(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.y(b)})};
42
+ _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.j){b.D(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.D(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.D(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.y(b)}})};_.w(kO,_.gl);_.r=kO.prototype;_.r.Gi=function(a){var b=a.eventid;a=a.data;switch(b){case fP:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+vO(this,b[0].extra_info).Bit_rate,b=zO(this,{bandwidth:b}))&&(this.w=b,lO(this,b));break;case gP:mO(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.yg=function(a){a.detail.currentState===_.Hq&&this.m.off(_.bg,this.yg)};
43
+ _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.bg,function(c){b.A||(c=c.detail,c.currentState===_.Hq&&(b.g.debug("Current state",c.currentState),b.A=!0,nO(b)))});this.a.on(hP,this.Gi,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
44
+ _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.bg,this.yg);this.m.on(_.bg,this.yg,this);try{var a=LO(this.a);this.f=yO(this,a);var b=this.f[_.T]||[];b.length&&(this.l=b[0].renditions[0]||null);mO(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off(hP,this.Gi);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.Fk]||[]};_.r.getAudioTracks=function(){return this.f[_.T]||[]};
45
+ _.r.la=function(){return this.f[_.S]||[]};_.r.ma=function(){return CO(this,_.Fk)};_.r.Sa=function(){return CO(this,_.T)};_.r.Wa=function(){return CO(this,_.S)};_.r.Ab=function(){return this.w};_.r.Mb=function(){this.g.info(JN);return null};_.r.Nb=function(){this.g.info(JN);return null};_.r.La=function(){var a=this.ma();return a?a.track:null};_.r.qa=function(){var a=this.Sa();return a?a.track:null};_.r.Ba=function(){var a=this.Wa();return a?a.track:null};
46
+ _.r.Ib=function(a){var b=this;null===a?(a=this.ma(),VO(this.a,a.bandwidth,null).then(function(){mO(b)})):0<a.renditions.length&&this.sb(a.renditions[0])};_.r.Ia=function(a){a?rO(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.Xa=function(a){a?(a=a.renditions[0],this.j?jO(this.j,a.track):rO(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,WO(this.a,!1),this.m.trigger(new _.K(_.mg)))};
47
+ _.r.sb=function(a){var b=this,c=this.ma();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,lO(this,a),VO(this.a,c.bandwidth,a.bandwidth).then(function(){mO(b)})["catch"](function(d){var e=new _.N(_.O,7,7200,{tizenerror:d});b.g.debug("Error while switching video track",d);b.m.onError(e)})):this.g.debug("Trying to switch to already active rendition. Doing nothing...")};_.r.Gb=function(a){rO(this,a)};_.r.Hb=function(a){this.j?jO(this.j,a.track):rO(this,a)};
48
+ _.r.addTextTrack=function(){};_.r.va=function(){return this.a.o};kO.prototype.isAbrEnabled=kO.prototype.va;kO.prototype.addTextTrack=kO.prototype.addTextTrack;kO.prototype.setTextRendition=kO.prototype.Hb;kO.prototype.setAudioRendition=kO.prototype.Gb;kO.prototype.setVideoRendition=kO.prototype.sb;kO.prototype.setTextTrack=kO.prototype.Xa;kO.prototype.setAudioTrack=kO.prototype.Ia;kO.prototype.setVideoTrack=kO.prototype.Ib;kO.prototype.getTextTrack=kO.prototype.Ba;kO.prototype.getAudioTrack=kO.prototype.qa;
49
+ kO.prototype.getVideoTrack=kO.prototype.La;kO.prototype.getLoadingTextRendition=kO.prototype.Nb;kO.prototype.getLoadingAudioRendition=kO.prototype.Mb;kO.prototype.getLoadingVideoRendition=kO.prototype.Ab;kO.prototype.getTextRendition=kO.prototype.Wa;kO.prototype.getAudioRendition=kO.prototype.Sa;kO.prototype.getVideoRendition=kO.prototype.ma;kO.prototype.getTextTracks=kO.prototype.la;kO.prototype.getAudioTracks=kO.prototype.getAudioTracks;kO.prototype.getVideoTracks=kO.prototype.getVideoTracks;_.w(DO,_.mm);_.r=DO.prototype;_.r.Zk=function(){this.w=!0;this.f||this.trigger(new _.K(PO))};_.r.Yk=function(a){this.w=!0;this.trigger(new _.K(aP,{percent:a}))};_.r.Xk=function(){this.w=!1;this.trigger(new _.K(bP))};_.r.cl=function(){this.trigger(new _.K(cP))};_.r.al=function(a,b){this.trigger(new _.K(hP,{eventid:a,data:b}))};_.r.el=function(a,b,c,d,e){this.trigger(new _.K(iP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
+ _.r.$k=function(a,b){this.trigger(new _.K(jP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Gd&&"Challenge"===b.name)VN(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.N(_.O,6,6005,{message:JSON.stringify(b)});c.F.onError(d)}}};_.r.Wd=function(a){this.trigger(new _.K(kP,{eventType:a}))};
51
+ _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(FO,f,b);g=setTimeout(function(){b.off(FO,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===eP)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){HO(b);d(webapis.avplay.play())},function(f){b.trigger(new _.K(kP));e(f)})})).then(function(){return a()});if(c===$N||c===dP)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===ZN?
52
+ Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===$N?Promise.resolve():Promise.reject()};
53
+ _.r.setPlaybackRate=function(a){var b=this.getState();if(b===dP||b===ZN||b===$N){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.C};
54
+ _.r.load=function(a,b){var c=this,d;return _.H(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.C(e,2),_.x(e,OO(c),4);case 4:return _.x(e,UO(c,a,b),5);case 5:_.uh(e,0);break;case 2:throw d=_.E(e),new _.N(_.O,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.ph;try{return webapis.avplay.getState()}catch(a){this.Wd(JSON.stringify(a))}};
55
+ _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.K(_.Cg));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.K(_.Bg));d()},function(){b.B=!1;e()})})};_.r.getPosition=function(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.Wd(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.Wd(JSON.stringify(a))}};
56
+ _.r.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.Ff.stop()}a.j={};a.C=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case LN:this.g.debug("The application does not have the privilege to get the volume.",MN);break;default:this.g.debug(IN,b)}}return a};
57
+ _.r.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.g.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case LN:this.g.warn("The application does not have the privilege to set the volume.",MN);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
58
+ _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Wd(JSON.stringify(a))}};_.r.stop=function(){try{webapis.avplay.stop()}catch(a){this.g.debug(a)}};_.r.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.r.setSourceIndex=function(a){this.G=a};_.r.getSourceIndex=function(){return this.G};_.r.getLoadedSource=function(){return this.l&&this.l[this.getSourceIndex()]};
59
+ var eP="IDLE",dP="READY",ZN="PLAYING",$N="PAUSED",wO=_.Vb,pO=_.ja,qO="TEXT",gP="PLAYER_MSG_RESOLUTION_CHANGED",fP="PLAYER_MSG_BITRATE_CHANGE",TN={PLAYREADY:"PLAYREADY",So:"EME_PLAYREADY",Yo:"VERIMATRIX",Pe:"WIDEVINE_CDM",To:"EME_WIDEVINE_CDM",$o:"WIDEVINE_CLASSIC"};_.w(XO,_.mm);_.r=XO.prototype;_.r.Ch=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.K(_.he));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.zh=function(a){this.trigger(new _.K(_.rg,{currentTime:a.currentTime/1E3}))};
60
+ _.r.Dh=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Q.Pg(d))&&this.o.append([new _.Si(b,c,d)],[])};_.r.Ah=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.Hi=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
61
+ _.r.Bh=function(a){this.g.debug("Error: TYPE: "+a.eventType);YN(this.f,_.Eq);a=new _.N(_.O,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.K(_.ie,{detail:a}))};
62
+ _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(cP,this.Ch,this);this.a.on(FO,this.zh,this);this.a.on(iP,this.Dh,this);this.a.on(jP,this.Ah,this);this.a.on(kP,this.Bh,this);this.a.on(bP,this.Hi,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=lP;lP+=1;this.j=_.er(_.Re,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
63
+ var e=[_.Yg,_.pe,"position",_.ve,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.u(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.gr(c,f);YO(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.ob)};_.r.appendLoad=function(){return Promise.reject(_.ob)};
64
64
  _.r.seekWith=function(){return Promise.reject(_.ob)};_.r.setSeekInterceptor=function(){};_.r.setPlaybackSessionId=function(){};_.r.getBandwidthEstimate=function(){return null};
65
- _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off($O,a.zh);a.a.off(CO,a.wh);a.a.off(fP,a.Ah);a.a.off(gP,a.xh);a.a.off(hP,a.yh);a.a.off(ZO,a.Ei);if(!a.h){b.F(3);break}return _.x(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.y(b)}})};_.r.namespace=function(){return jP};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
65
+ _.r.destroy=function(){var a=this;return _.H(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(cP,a.Ch);a.a.off(FO,a.zh);a.a.off(iP,a.Dh);a.a.off(jP,a.Ah);a.a.off(kP,a.Bh);a.a.off(bP,a.Hi);if(!a.h){b.D(3);break}return _.x(b,a.h.destroy(),4);case 4:a.h=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.l.destroy(),a.f.destroy(),a.l=null,a.f=null,_.y(b)}})};_.r.namespace=function(){return mP};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
66
66
  _.r.setDrmCustomDataModifier=function(){};_.r.setCdnErrorCallback=function(){};_.r.detach=function(){};_.r.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.r.getPosition=function(){return this.getMediaPosition()};_.r.getMediaPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.Aq?this.getDuration():this.a.getPosition()||0};_.r.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
67
67
  _.r.getPresentationStartTime=function(){return null};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.r.setVolume=function(a){this.a.setVolume(a)};_.r.getDuration=function(){return this.getMediaDuration()};_.r.getMediaDuration=function(){return this.a.getDuration()};_.r.getBufferInfo=function(){this.g.warn(_.wa);return new _.lm};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
68
- _.r.release=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.h){b.F(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.F(4);break}return _.x(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.x(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.y(b)}})};
69
- _.r.load=function(a){var b=this,c,d,e,f,g;return _.H(function(h){switch(h.a){case 1:b.configuration=_.vm(b.B,a);c=_.kq(b.configuration,[_.re,"native"]);b.o=c.create(b);d=_.Lq(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.F(2);break}b.h=new ZN;b.h.initialize(b);_.C(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.uh(h,2);break;case 3:f=_.D(h),b.g.error(f);case 2:return _.C(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.uh(h,7);break;case 6:throw g=
70
- _.D(h),b.onError(g),g;case 7:b.l.load(),_.y(h)}})};_.r.play=function(){var a=this;this.trigger(new _.K(_.ff));VO(this);return this.a.play().then(function(){YN(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){YN(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.K(_.ie,{detail:a});a.severity===_.O&&(VN(this.f,_.Eq),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
71
- _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return this.f.getState()===_.Aq};_.r.isPaused=function(){return this.a.getState()===XN};_.r.isMuted=function(){return HO(this.a)};_.r.setMuted=function(a){QO(this.a,a)};_.r.getNetworkEngine=function(){return this.C};_.r.setNetworkEngine=function(a){this.C=a};_.r.setCmsdManager=function(){};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};
72
- _.r.getSourceIndex=function(){return this.a.getSourceIndex()};_.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new WO).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var jP="clpp.tizen",iP=0;WO.prototype.a=function(){return jP};
73
- WO.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Ic||a===_.Zl||a===_.Nc)&&b){if(_.qk(2))return 2;if(_.qk(3)||_.qk(4)||_.qk(5)||_.qk(6))return _.Jh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};WO.prototype.f=function(a){return a===_.ra};WO.prototype.create=function(){return new UO};_.w(XO,_.Bu);XO.prototype.f=function(){_.Th(new WO)};XO.prototype.a=function(){var a=jP;a&&_.Rh[a]&&(delete _.Rh[a],_.Sh.info("Removed Player factory: '"+a+"'"))};XO.prototype.id=function(){return"tizen"};_.I("clpp.tizen.TizenComponent",XO);var MO="onbufferingstart",YO="onbufferingprogress",ZO="onbufferingcomplete",$O="onstreamcompleted",CO="oncurrentplaytime",eP="onevent",fP="onsubtitlechange",gP="ondrmevent",hP="onerror",NO="preparingstart",PO="preparingend";};
68
+ _.r.release=function(){var a=this;return _.H(function(b){switch(b.a){case 1:if(!a.h){b.D(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.D(4);break}return _.x(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.x(b,a.a.release(),6);case 6:a.l.release(),a.f.release(),a.A=!1,_.y(b)}})};
69
+ _.r.load=function(a){var b=this,c,d,e,f,g;return _.H(function(h){switch(h.a){case 1:b.configuration=_.vm(b.B,a);c=_.kq(b.configuration,[_.re,"native"]);b.o=c.create(b);d=_.Lq(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.D(2);break}b.h=new bO;b.h.initialize(b);_.C(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.uh(h,2);break;case 3:f=_.E(h),b.g.error(f);case 2:return _.C(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.uh(h,7);break;case 6:throw g=
70
+ _.E(h),b.onError(g),g;case 7:b.l.load(),_.y(h)}})};_.r.play=function(){var a=this;this.trigger(new _.K(_.ff));YO(this);return this.a.play().then(function(){aO(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){aO(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.K(_.ie,{detail:a});a.severity===_.O&&(YN(this.f,_.Eq),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
71
+ _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return this.f.getState()===_.Aq};_.r.isPaused=function(){return this.a.getState()===$N};_.r.isMuted=function(){return KO(this.a)};_.r.setMuted=function(a){TO(this.a,a)};_.r.getNetworkEngine=function(){return this.C};_.r.setNetworkEngine=function(a){this.C=a};_.r.setCmsdManager=function(){};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};
72
+ _.r.getSourceIndex=function(){return this.a.getSourceIndex()};_.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new ZO).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var mP="clpp.tizen",lP=0;ZO.prototype.a=function(){return mP};
73
+ ZO.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Ic||a===_.Zl||a===_.Nc)&&b){if(_.qk(2))return 2;if(_.qk(3)||_.qk(4)||_.qk(5)||_.qk(6))return _.Jh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};ZO.prototype.f=function(a){return a===_.ra};ZO.prototype.create=function(){return new XO};_.w($O,_.Bu);$O.prototype.f=function(){_.Th(new ZO)};$O.prototype.a=function(){var a=mP;a&&_.Rh[a]&&(delete _.Rh[a],_.Sh.info("Removed Player factory: '"+a+"'"))};$O.prototype.id=function(){return"tizen"};_.I("clpp.tizen.TizenComponent",$O);var PO="onbufferingstart",aP="onbufferingprogress",bP="onbufferingcomplete",cP="onstreamcompleted",FO="oncurrentplaytime",hP="onevent",iP="onsubtitlechange",jP="ondrmevent",kP="onerror",QO="preparingstart",SO="preparingend";};
74
74
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
75
75
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
76
76
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ttml.js CHANGED
@@ -2,7 +2,7 @@
2
2
  var f=function(window){var Gy='application/mp4; codecs\x3d"stpp.ttml"',Hy='application/mp4; codecs\x3d"stpp.ttml.im1i"',Iy='application/mp4; codecs\x3d"stpp.ttml.im1t"',Jy="backgroundColor",Ky="direction",Ly="displayAlign",My="region",Ny="sans-serif",Oy="textAlign",Py="textDecoration",Qy="writingMode",Ry=function(a,b,c){this.h=a;this.f=b;this.a=c},Sy=function(a,b,c){Ry.call(this,a,[],c);this.j=b||""},Ty=function(a,b,c){Ry.call(this,a,b,c)},Uy=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(e.hasAttribute(c))return e.getAttribute(c)}return null},
3
3
  bz=function(a,b){var c=null;if(Vy.test(a)){c=Vy.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 Wy.test(a)?c=Xy(Wy,a):Yy.test(a)?c=Xy(Yy,a):Zy.test(a)?(c=Zy.exec(a),c=Number(c[1])/b.frameRate):$y.test(a)?(c=$y.exec(a),c=Number(c[1])/b.a):az.test(a)&&(c=Xy(az,a));return c},Xy=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||
4
4
  0)},cz=function(a){return a.split(":").pop()},dz=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},fz=function(a,b){for(;ez.test(a);){var c=ez.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},gz=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},hz=function(a,b,c,d,e,f,g){Ry.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},iz=function(a,b,c){a=Uy(a,b,Oy);if(!a&&c&&(a=Uy(c,b,Oy),!a&&"rltb"===Uy(c,b,Qy)))return _.ge;switch(a){case _.id:return _.Ni;
5
- case _.Of:case _.ge:return _.ge;default:return _.ag}},jz=function(a,b,c){if(_.Q.lf(a.w))return document.createTextNode(_.Q.Og(a.w||""));if(a.A)return _.er("br");for(var d=_.er("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.fr(d,f.value);a=_.u(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(jz(c.get(e.value),b,c));return d},kz=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))&&
5
+ case _.Of:case _.ge:return _.ge;default:return _.ag}},jz=function(a,b,c){if(_.Q.nf(a.w))return document.createTextNode(_.Q.Pg(a.w||""));if(a.A)return _.er("br");for(var d=_.er("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.fr(d,f.value);a=_.u(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(jz(c.get(e.value),b,c));return d},kz=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))&&
6
6
  (this.frameRate*=Number(a[1])/Number(a[2]))},lz=function(a,b,c){Ry.call(this,a,b,c)},oz=function(a,b,c,d){var e=mz.exec(a);a=nz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},pz=function(a,b){return typeof b===_.k&&0<b?_.Ti:nz.test(a)?0:_.Ti},qz=function(a,b){Ry.call(this,"root-container",[],b);this.j=a},rz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},sz=function(a,b){var c=a.getAttribute("extent");return(c=nz.exec(c))?Number(c[b]):null},uz=
7
7
  function(a){a=a.getAttribute("cellResolution");return(a=tz.exec(a))?Number(a[2]):null},vz=function(a,b,c){Ry.call(this,a,b,c)},wz=function(a){this.B=a;this.w=this.l=null;this.A=0;this.h=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]},yz=function(a){return xz.some(function(b){return b in a.attributes})},zz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.u(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.gh(zz(a,a.a.get(e).f)).concat([e]));return c},Bz=
8
8
  function(){return"inline-"+Az++},Cz=function(a){return a.o.map(function(b){return b.build(a.l,a.w,a.A,a.h,a.a,a.j,a.f)}).filter(function(b){return null!=b})},Dz=function(a){this.a=a.firstChild;this.f=new Set},Ez=function(a,b,c,d,e,f){this.h=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f},Fz=function(a){return cz(a.h.nodeName)},Gz=function(){this.a=new Map},Iz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=
@@ -19,10 +19,10 @@ vz.prototype.build=function(a){var b=null;var c=uz(a);c&&(b=rz(a.j.containerHeig
19
19
  e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Pz.test(g)&&Pz.test(h)&&Pz.test(l)?(e=g,f=h):2===d.length&&!Pz.test(g)&&Pz.test(h)?(e=g,f=h):2===d.length&&Pz.test(g)&&Pz.test(h)&&(f=g);if(""!==f){f=dz(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c+=d;"textShadow"in this.a?(d=gz(this.a.textShadow),d=dz(d),d="text-shadow:"+
20
20
  d+";"):d="";c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",Ny).replace("proportionalSerif",Ny).replace("sansSerif",Ny).replace("default",Ny)+";":"");a:{if(Py in this.a){d=[];e=_.u(this.a.textDecoration.split(" "));for(f=e.next();!f.done;f=e.next())switch(f=f.value,f){case "underline":case "overline":d.push(f);break;case "lineThrough":d.push("line-through")}if(0<d.length){d=
21
21
  "text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+dz(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=dz(e),e=fz(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=dz(d);d=fz(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.h+" .clpp-text-wrapper {",a.push(c+b+"}"),
22
- c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var Qz=new Map([[Jy,"background-color"],["color","color"],[Ky,Ky],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Az=0;Dz.prototype.le=function(){return!!this.a};Dz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Rz.has(cz(a.nodeName))||Sz.has(cz(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&&!Rz.has(cz(a.nodeName))));var b=this.a;this.a=a;return b};
22
+ c="::ttml .clpp-text-wrapper__"+this.h+" {",a.push(c+b+"}"));return a};var Qz=new Map([[Jy,"background-color"],["color","color"],[Ky,Ky],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var Az=0;Dz.prototype.me=function(){return!!this.a};Dz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Rz.has(cz(a.nodeName))||Sz.has(cz(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&&!Rz.has(cz(a.nodeName))));var b=this.a;this.a=a;return b};
23
23
  var Rz=new Set(["tt","head","layout",_.Je,_.se,My,"styling",_.gg,"body",_.Qd,"p","span","br"]),Sz=new Set([_.gg,_.se]);Ez.prototype.getId=function(){return this.attributes.id};Jz.prototype.parseInit=function(){};
24
24
  Jz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.L.kb(this.a.ttml||{}),e=_.Oj(a,0,c[0]);e=_.Q.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.lg)}catch(n){throw new _.N(_.O,2,2005,"Failed to parse TTML.");}d=new wz(d);e=new Gz;f=new Dz(f);b=b.periodStart;typeof b===_.k&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.Oj(a,b,h);l=_.Lm(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Sy(m,l,{imageType:"PNG",encoding:"Base64"}));
25
- b+=h}for(;f.le();)a=f.next(),a=Iz(e,a),"tt"===Fz(a)&&(d.l=new qz(d.B,Object.assign({},a.attributes))),"tt"===Fz(a)&&(d.w=new kz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Fz(a)!==_.se||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Sy(c,a.h.textContent,a.attributes))),Fz(a)===_.se&&a.attributes.begin&&a.attributes.end?(c="#"+Bz(),b=new Sy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
25
+ b+=h}for(;f.me();)a=f.next(),a=Iz(e,a),"tt"===Fz(a)&&(d.l=new qz(d.B,Object.assign({},a.attributes))),"tt"===Fz(a)&&(d.w=new kz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),Fz(a)!==_.se||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Sy(c,a.h.textContent,a.attributes))),Fz(a)===_.se&&a.attributes.begin&&a.attributes.end?(c="#"+Bz(),b=new Sy(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
26
  Fz(a)===_.gg&&(c=a.getId()||Bz(),b=new vz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),Fz(a)!==_.gg&&yz(a)?(c=Bz(),b=new vz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),Fz(a)!==_.Qd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=Bz(),b=new lz(c,zz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),Fz(a)!==My?c=null:(c=a.getId(),b=new lz(c,zz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),
27
27
  c=b),c&&(a.a=c.getId()),c=a.l,-1===[_.da,"span","br"].indexOf(Fz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=Bz(),b=new hz(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===Fz(a),a.a,a.j,zz(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.j.push(c),c=b):c=null),c&&a.l.push(c.getId()),"p"===Fz(a)||a.j?(c=Bz(),b=new hz(c,null,!1,a.a,a.j,zz(d,a.f),a.attributes),d.f.set(c,b),d.o.push(b),c=b):c=null,c&&a.l.push(c.getId());e=Cz(d);f=[];a=_.u(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
28
  _.gh(c.value.build(d.l)));return{cues:e,styles:f}};Kz.prototype.a=function(a){a=(new Jz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Lz(c.startTime)+" --\x3e "+Lz(c.endTime),e=[];switch(c.textAlign){case _.ve:e.push("align:left");break;case _.Of:e.push("align:right");break;case _.Ni:e.push("align:middle");break;case _.ag:e.push("align:start");break;case _.ge:e.push("align:end")}switch(c.writingMode){case _.Gg:e.push("vertical:lr");break;
@@ -1,8 +1,8 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
2
  var f=function(window){var uy="VerimatrixVCAS",vy="clpp.verimatrix.Vcas",wy="clpp.verimatrix.VcasComponent",Cy=function(a){_.an.call(this,uy);var b={};b[xy]=xy;b[yy]=yy;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?zy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,h=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?Ay:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
3
  this.C=d;this.B=b;this.w=By(this,e);this.o=By(this,f);this.l=By(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.J(vy);_.Q.empty(this.w)?this.g.warn(_.Zb):this.fb(_.Gd,{licenseUrl:this.w,videoRobustness:[_.Fb,void 0],audioRobustness:[_.Eb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.Q.empty(this.o)?this.g.warn(_.tb):this.fb(_.Ed,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.Q.empty(this.l)?this.g.warn(_.Ra):_.Q.empty(this.j)?this.g.warn(_.Qa):this.fb(_.Cd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},By=function(a,b){if(a.C===zy){var c=Object.assign({},{deviceId:_.Mm(_.Q.Ed(a.A))},a.a&&{authenticator:_.Mm(_.Q.Ed(a.a))});return b+_.Ok(c)}return b},Dy=function(){this.g=new _.J(wy)};_.w(Cy,_.an);
5
- Cy.prototype.h=function(a,b){if(this.C===Ey){var c=this.B[yy],d={};d[this.B[xy]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Cy.prototype.I=function(a,b){var c=_.yn(b);switch(this.G){case Fy:c=_.Ok({r:c,up:this.H},!0)}return c};Cy.prototype.K=function(a,b){this.h(a,b);_.Bn(b)};Cy.prototype.L=function(a,b){_.Cn(b)};_.I(vy,Cy);Cy.prototype.constructor=Cy.prototype.constructor;Cy.NAME=uy;var zy="query-string",Ey="http-header";
4
+ _.Q.empty(this.l)?this.g.warn(_.Ra):_.Q.empty(this.j)?this.g.warn(_.Qa):this.fb(_.Cd,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},By=function(a,b){if(a.C===zy){var c=Object.assign({},{deviceId:_.Mm(_.Q.Fd(a.A))},a.a&&{authenticator:_.Mm(_.Q.Fd(a.a))});return b+_.Ok(c)}return b},Dy=function(){this.g=new _.J(wy)};_.w(Cy,_.an);
5
+ Cy.prototype.h=function(a,b){if(this.C===Ey){var c=this.B[yy],d={};d[this.B[xy]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};Cy.prototype.I=function(a,b){var c=_.yn(b);switch(this.G){case Fy:c=_.Ok({r:c,yp:this.H},!0)}return c};Cy.prototype.K=function(a,b){this.h(a,b);_.Bn(b)};Cy.prototype.L=function(a,b){_.Cn(b)};_.I(vy,Cy);Cy.prototype.constructor=Cy.prototype.constructor;Cy.NAME=uy;var zy="query-string",Ey="http-header";
6
6
  Cy.LicenseRequestVuidLocation={QUERY_STRING:zy,HTTP_HEADER:Ey};var xy="DeviceId",yy="Authenticator";Cy.LicenseRequestHttpHeader={DEVICE_ID_HEADER:xy,AUTHENTICATOR_HEADER:yy};var Ay="keyid",Fy="contentid-siteid";Cy.FairPlayAssetIdStrategy={KEYID:Ay,CONTENTID_SITEID:Fy};_.w(Dy,_.Bu);Dy.prototype.a=function(){delete _.Vm.VerimatrixVCAS};Dy.prototype.h=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===uy){a=a.drm.customData;if(!a)throw new _.N(_.O,7,7100,_.Hd);a=new Cy(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Wm(a)}};Dy.prototype.id=function(){return"verimatrix-vcas"};_.I(wy,Dy);};
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;});}
package/cjs/cl.vimond.js CHANGED
@@ -1,16 +1,16 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var ky="Registering listeners",ly="clpp.vimond.VimondPlugin",my=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.gi;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.Xh(this.Oh.bind(this));this.g=new _.J("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(ky),this.a.on(this.m,_.bg,this.gl.bind(this)),this.a.on(this.m,_.rg,this.hl.bind(this)),this.a.on(this.m,_.hc,this.el.bind(this)),this.a.on(this.m,_.ic,this.fl.bind(this)))},ny=function(a,
2
+ var f=function(window){var ky="Registering listeners",ly="clpp.vimond.VimondPlugin",my=function(a,b,c,d,e){this.G=a;this.H=b;this.I=c;this.m=d;this.C=e;this.a=new _.gi;this.l=!0;this.f=this.j=this.A=!1;this.B=null;this.h=new _.Xh(this.Rh.bind(this));this.g=new _.J("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.g.debug(ky),this.a.on(this.m,_.bg,this.ll.bind(this)),this.a.on(this.m,_.rg,this.ml.bind(this)),this.a.on(this.m,_.hc,this.jl.bind(this)),this.a.on(this.m,_.ic,this.kl.bind(this)))},ny=function(a,
3
3
  b){a.m.trigger(new _.K(_.Og,{detail:b}))},oy=function(a,b,c){b&&(a.A=!0,a.h.stop());a.m.onError(new _.N(b?_.O:1,9,9201,c))},py=function(a,b,c,d,e){this.l=a;this.o=c;this.h=b;this.a=d;this.j=e;this.g=new _.J("clpp.vimond.VimondService");this.f=0},qy=function(a){this.m=a;this.a=new _.gi;this.g=new _.J("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.m&&this.a&&(this.g.debug(ky),this.a.on(this.m,_.Kf,this.o.bind(this)),this.a.on(this.m,_.hc,this.j.bind(this)),this.a.on(this.m,_.ic,this.l.bind(this)))},
4
- ry=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.rf];if(a.h)return[_.ge,_.bf];if(c===_.Aq)return[_.ge,null];if(c===_.Eq)return[_.ie,_.bf];var d=_.bf;if(c===_.yq||c===_.Hq||a.f)d=_.rf;return["period",d]},sy=function(){this.a=!1;this.g=new _.J(ly);this.j=this.h=this.f=null},ty=function(){};_.r=my.prototype;_.r.hl=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.el=function(){this.g.debug("Ad break started");this.j=!0};
5
- _.r.fl=function(){this.g.debug("Ad break stopped");this.j=!1};
6
- _.r.gl=function(a){var b=this,c,d,e,f,g;return _.H(function(h){if(1==h.a){c=a.detail;d=_.Cq;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.F(0);
7
- b.B=e;return _.x(h,b.Oh(),3)}e===d.ENDED&&b.h.stop();_.y(h)})};
8
- _.r.Oh=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.ga(a.l?10:a.G);a.l=!1;_.C(h,2);return _.x(h,a.C.fireEvent(),4)}if(2!=h.a)return b=h.f,ny(a,b),_.uh(h,0);d=c=_.D(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),ny(a,f),oy(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),ny(a,f),oy(a,a.I,f)):a.g.error(c.toString());_.y(h)})};py.prototype.fireEvent=function(){this.f++;var a=_.L.ta(this.o);a.client.buildName=_.xa;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();c=((new _.Mk(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=ry(this.a,this.f);a.client.playerEvent=
4
+ ry=function(a,b){var c=a.m.getState();if(1===b)return["str-start",_.rf];if(a.h)return[_.ge,_.bf];if(c===_.Aq)return[_.ge,null];if(c===_.Eq)return[_.ie,_.bf];var d=_.bf;if(c===_.yq||c===_.Hq||a.f)d=_.rf;return["period",d]},sy=function(){this.a=!1;this.g=new _.J(ly);this.j=this.h=this.f=null},ty=function(){};_.r=my.prototype;_.r.ml=function(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()};_.r.jl=function(){this.g.debug("Ad break started");this.j=!0};
5
+ _.r.kl=function(){this.g.debug("Ad break stopped");this.j=!1};
6
+ _.r.ll=function(a){var b=this,c,d,e,f,g;return _.H(function(h){if(1==h.a){c=a.detail;d=_.Cq;e=c.currentState;f=c.previousState;b.g.debug("State changed, prev: "+f+" curr: "+e);if(b.A||b.j)return h["return"]();if(e===b.B&&!b.f)return b.g.debug("Ignore transition"),h["return"]();if(b.l&&e!==d.PLAYING)return h["return"]();if(b.f&&[d.PAUSED,d.BUFFERING].includes(e))return b.g.debug("Seeking"),h["return"]();b.f&&e===d.PLAYING&&(b.g.debug("Seeked"),b.f=!1);g=[d.PLAYING,d.PAUSED,d.ERROR,d.ENDED];if(!g.includes(e))return h.D(0);
7
+ b.B=e;return _.x(h,b.Rh(),3)}e===d.ENDED&&b.h.stop();_.y(h)})};
8
+ _.r.Rh=function(){var a=this,b,c,d,e,f,g;return _.H(function(h){if(1==h.a){var l=Math.floor(Date.now()/1E3);0<a.o&&a.g.debug("Last event was "+(l-a.o)+" seconds ago");a.o=l;a.h.stop();a.h.ga(a.l?10:a.G);a.l=!1;_.C(h,2);return _.x(h,a.C.fireEvent(),4)}if(2!=h.a)return b=h.f,ny(a,b),_.uh(h,0);d=c=_.E(h);e=d.code;f=d.data;g=[1002,1003];g.includes(e)?(a.g.debug("Unreachable service"),ny(a,f),oy(a,a.H,f)):1001===e?(a.g.debug("Generic service error"),ny(a,f),oy(a,a.I,f)):a.g.error(c.toString());_.y(h)})};py.prototype.fireEvent=function(){this.f++;var a=_.L.ta(this.o);a.client.buildName=_.xa;a.client.buildVersion=_.ia;var b=a.client,c=this.a.m.getDrmInfo();b.drm=c?c.keySystem:"";a.client.pageUrl=document.location.href;a.client.streamUrl=this.a.m.getLoadedSource().url;a.client.userAgent=navigator.userAgent;a.client.videoFormat=this.a.m.getLoadedSource().type||"";b=a.client;c=this.a.m.getLoadedSource();c=((new _.Mk(c.url)).scheme||"").replace(":","");b.videoProtocol=c;b=ry(this.a,this.f);a.client.playerEvent=
9
9
  b[0]||"";a.client.playerState=b[1]||"";a.progress.vod&&(a.progress.vod.position=this.a.getPosition());if(b=a.progress.live){c=this.a;var d=c.m.getPresentationStartTime()||0;c=Math.floor(d+c.m.getPosition());c=(new Date(1E3*c)).toISOString();b.position=c;d=this.a;c=d.m.getPosition();d=d.m.getSeekRange().end;b.onLiveEdge=30>Math.abs(d-c);typeof b.liveResumePossible!==_.Zc&&(b.liveResumePossible=!0)}a.progress.eventNumber=this.f;a.timestamp=(new Date).toISOString();this.g.debug("Fire an event");b=_.ck(this.l);
10
- b.method=_.sb;b.contentType="application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.Q.Ed(JSON.stringify(a));return this.j.fetch(b).S};py.prototype.Wg=function(a){this.h=a};qy.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};qy.prototype.o=function(){this.h=!0};qy.prototype.j=function(){this.f=!0};qy.prototype.l=function(){this.f=!1};_.w(sy,_.bw);_.r=sy.prototype;_.r.onPlayerCreated=function(){};
10
+ b.method=_.sb;b.contentType="application/json";b.headers.Authorization="Bearer "+this.h;b.body=_.Q.Fd(JSON.stringify(a));return this.j.fetch(b).S};py.prototype.Xg=function(a){this.h=a};qy.prototype.getPosition=function(){return Math.floor(this.m.getPosition())};qy.prototype.o=function(){this.h=!0};qy.prototype.j=function(){this.f=!0};qy.prototype.l=function(){this.f=!1};_.w(sy,_.bw);_.r=sy.prototype;_.r.onPlayerCreated=function(){};
11
11
  _.r.onContentWillLoad=function(a){var b=a.getConfiguration();(this.a=!_.L.R(b.vimond)&&typeof b.vimond===_.Re)?a.namespace()===_.sd&&(this.a=!1,this.g.info("Vimond does not report when casting.")):this.g.debug("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c=_.u(["authToken","playerEventRequest"]),d=c.next();!d.done;d=c.next())if(d=d.value,!b[d]){this.g.warn(d+" key is missing");a.onError(new _.N(1,9,9200));return}this.g.debug(_.ya);
12
12
  c=b.failIfUnreachable;typeof c!==_.Zc&&(c=!0);d=b.failOnError;typeof d!==_.Zc&&(d=!0);this.f=new qy(a);this.h=new py(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new my(b.playerEventRequest.eventInterval,c,d,a,this.h)}};_.r.onPlayerWillRelease=function(){if(this.a){if(this.f){var a=this.f;a.g.debug(_.Rb);_.ki(a.a)}this.j&&(a=this.j,a.g.debug(_.Rb),_.ki(a.a),a.h.stop());this.j=this.h=this.f=null}};_.r.onPlayerWillDestroy=function(){};_.r.id=function(){return"vimond"};
13
- _.r.Wg=function(a){this.a&&this.h&&this.h.Wg(a)};_.I(ly,sy);sy.prototype.updateAuthToken=sy.prototype.Wg;sy.Id="vimond";ty.prototype.create=function(){return new sy};_.Yt(new ty);};
13
+ _.r.Xg=function(a){this.a&&this.h&&this.h.Xg(a)};_.I(ly,sy);sy.prototype.updateAuthToken=sy.prototype.Xg;sy.Id="vimond";ty.prototype.create=function(){return new sy};_.Yt(new ty);};
14
14
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
15
15
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
16
16
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.vr.js CHANGED
@@ -7,18 +7,18 @@ by(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute
7
7
  9,9004,"Unable to compile GL shader: "+a.a.getShaderInfoLog(b));return b},dy=function(a){this.a=a;var b=[],c,d;for(d=0;70>=d;d++){var e=3>=d?d/4/64:67<=d?(63+(d-66)/4)/64:(d-3)/64;var f=(e-.5)*Math.PI,g=Math.cos(f);for(c=0;128>=c;c++){var h=c/128,l=(.5+h)*Math.PI*2;128===c?(b.push(b[645*d]),b.push(b[645*d+1]),b.push(b[645*d+2])):(b.push(100*Math.cos(l)*g),b.push(100*Math.sin(l)*g),b.push(100*Math.sin(f)));0===d||70===d?b.push(.5):b.push(1-h);b.push(1-e)}}e=[];for(c=0;128>c;c++)for(d=0;70>d;d++)f=
8
8
  5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.h=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)},ey=function(a,
9
9
  b){this.a=b;this.f=this.a.createTexture();b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.bindTexture(b.TEXTURE_2D,null)},fy=function(){var a=this;this.o=this.w=this.L=this.J=this.A=
10
- this.da=this.H=this.f=this.a=this.m=null;this.g=new _.J("clpp.vr");this.I=70;this.ca=1;this.P=this.N=!1;this.G=function(){if(a.a&&a.f){a.f.viewport(0,0,a.a.width,a.a.height);var b=a.L.a,c=Math.tan(.5*a.I*Math.PI/180);b[0]=1/(a.a.width/a.a.height*c);b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1/c;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=2E3/-1999.9;b[11]=200/-1999.9;b[12]=0;b[13]=0;b[14]=-1;b[15]=1}};this.l=this.j=0;this.h={x:0,y:0};this.T=new Zx;this.Y=new Zx;this.ha=new Zx;this.ja=new Zx;this.B=this.nn.bind(this);
11
- this.C=this.pn.bind(this);this.K=this.mn.bind(this)},gy=function(a){var b=Ux(1,0,a.l*Math.PI/180);Tx(Ux(0,1,a.j*Math.PI/180),a.T);Tx(b,a.Y);ay(a.ha);$x(a.ja,a.T,a.ha);$x(a.H,a.Y,a.ja)},hy=function(a){a.a&&(a.a.removeEventListener("mousemove",a.B,!1),a.a.removeEventListener(Qx,a.B,!1),a.a.removeEventListener("mouseup",a.C,!1),a.a.removeEventListener("touchend",a.C,!1))},iy=function(){};Vx.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)};Zx.prototype.set=function(a,b,c,d,e,f,g,h,l,m,n,p,q,t,v,z){var A=this.a;A[0]=a;A[4]=b;A[8]=c;A[12]=d;A[1]=e;A[5]=f;A[9]=g;A[13]=h;A[2]=l;A[6]=m;A[10]=n;A[14]=p;A[3]=q;A[7]=t;A[11]=v;A[15]=z;return this};var jy={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1};_.w(fy,_.bw);_.r=fy.prototype;_.r.onPlayerCreated=function(a){this.g.info("Player created");this.m=a};
10
+ this.da=this.H=this.f=this.a=this.m=null;this.g=new _.J("clpp.vr");this.I=70;this.ca=1;this.P=this.N=!1;this.G=function(){if(a.a&&a.f){a.f.viewport(0,0,a.a.width,a.a.height);var b=a.L.a,c=Math.tan(.5*a.I*Math.PI/180);b[0]=1/(a.a.width/a.a.height*c);b[1]=0;b[2]=0;b[3]=0;b[4]=0;b[5]=1/c;b[6]=0;b[7]=0;b[8]=0;b[9]=0;b[10]=2E3/-1999.9;b[11]=200/-1999.9;b[12]=0;b[13]=0;b[14]=-1;b[15]=1}};this.l=this.j=0;this.h={x:0,y:0};this.T=new Zx;this.Y=new Zx;this.ha=new Zx;this.ja=new Zx;this.B=this.tn.bind(this);
11
+ this.C=this.un.bind(this);this.K=this.sn.bind(this)},gy=function(a){var b=Ux(1,0,a.l*Math.PI/180);Tx(Ux(0,1,a.j*Math.PI/180),a.T);Tx(b,a.Y);ay(a.ha);$x(a.ja,a.T,a.ha);$x(a.H,a.Y,a.ja)},hy=function(a){a.a&&(a.a.removeEventListener("mousemove",a.B,!1),a.a.removeEventListener(Qx,a.B,!1),a.a.removeEventListener("mouseup",a.C,!1),a.a.removeEventListener("touchend",a.C,!1))},iy=function(){};Vx.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)};Zx.prototype.set=function(a,b,c,d,e,f,g,h,l,m,n,p,q,t,v,z){var A=this.a;A[0]=a;A[4]=b;A[8]=c;A[12]=d;A[1]=e;A[5]=f;A[9]=g;A[13]=h;A[2]=l;A[6]=m;A[10]=n;A[14]=p;A[3]=q;A[7]=t;A[11]=v;A[15]=z;return this};var jy={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1};_.w(fy,_.bw);_.r=fy.prototype;_.r.onPlayerCreated=function(a){this.g.info("Player created");this.m=a};
12
12
  _.r.onContentWillLoad=function(a){var b=a.getConfiguration();if(b.vr&&b.vr.enable){var c=b.vr,d=c.fieldOfView,e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;if(void 0!==d&&_.L.wa(d))this.I=d;else throw new _.N(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.L.wa(e)&&0<e)this.ca=e;else throw new _.N(1,7,7100,"sensitivity configuration must be a positive number");this.N=!!f;this.P=!!c;if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.Jg){this.g.info("Initialize VR Surface");
13
13
  if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",jy)||this.a.getContext("experimental-webgl",jy);if(!this.f)throw new _.N(1,9,9003,"Unable to create GL context");this.H=new Zx;ay(this.H);this.da=new dy(this.f);this.A=new cy(this.f);this.J=new Zx;this.L=new Zx;this.o=this.w=null;this.a.addEventListener(_.Nf,this.G)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.K,
14
- !1),this.a.addEventListener(Rx,this.K,!1));this.G();this.cj()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}};
14
+ !1),this.a.addEventListener(Rx,this.K,!1));this.G();this.fj()}else this.g.info("No video element found, can not initialize VR plugin");else this.g.info("No surface found, can not initialize VR plugin")}};
15
15
  _.r.onPlayerWillRelease=function(){this.g.info("Releasing VR plugin resources");this.w&&cancelAnimationFrame(this.w);this.h.x=0;this.l=this.j=this.h.y=0;this.f&&(delete this.f,this.f=null);this.a&&(hy(this),this.a.removeEventListener(_.Nf,this.G),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.K,!1),delete this.a,this.a=null)};_.r.onPlayerWillDestroy=function(){var a=this;return _.H(function(b){a.m=null;_.y(b)})};_.r.id=function(){return"vr"};
16
- _.r.cj=function(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.Jg){this.w=requestAnimationFrame(this.cj.bind(this));var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new ey(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,
16
+ _.r.fj=function(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.Jg){this.w=requestAnimationFrame(this.fj.bind(this));var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new ey(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,
17
17
  0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.A;c.a.useProgram(c.f);c=$x(this.J,this.L,this.H).a;var d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d;b.uniformMatrix4fv(this.A.h,!1,this.J.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.da;a.a.bindBuffer(a.a.ARRAY_BUFFER,
18
18
  a.f);a.a.vertexAttribPointer(0,3,a.a.FLOAT,!1,20,0);a.a.vertexAttribPointer(1,2,a.a.FLOAT,!1,20,12);a.a.enableVertexAttribArray(0);a.a.enableVertexAttribArray(1);a.a.drawArrays(a.a.TRIANGLES,0,a.h);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.A.a.useProgram(null)}}}};
19
- _.r.mn=function(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Rx)a.type===Rx?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.B,!1),this.a.addEventListener(Qx,this.B,!1),this.a.addEventListener("mouseup",this.C,!1),this.a.addEventListener("touchend",this.C,!1)};
20
- _.r.nn=function(a){a.preventDefault();var b=a.clientX,c=a.clientY;a.type===Qx&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;var d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.ca;c=d*b*(this.P?-1:1);this.j+=a*b*(this.N?-1:1);this.l+=c;gy(this)};_.r.pn=function(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();hy(this)};_.r.Gm=function(a,b){this.l=b;this.j=a;gy(this)};_.r.Kl=function(){return{x:this.j,y:this.l}};
21
- _.r.jo=function(a){this.I=a;this.G()};_.I("clpp.vr.VrPlugin",fy);fy.prototype.setCameraFieldOfView=fy.prototype.jo;fy.prototype.getCameraCoordinates=fy.prototype.Kl;fy.prototype.moveCamera=fy.prototype.Gm;fy.Id="vr";iy.prototype.create=function(){return new fy};_.Yt(new iy);};
19
+ _.r.sn=function(a){this.g.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Rx)a.type===Rx?a.touches[0]&&(this.h.x=a.touches[0].clientX,this.h.y=a.touches[0].clientY):(this.h.x=a.clientX,this.h.y=a.clientY),this.g.debug("Mouse Start coordinates:",this.h,a),this.a.addEventListener("mousemove",this.B,!1),this.a.addEventListener(Qx,this.B,!1),this.a.addEventListener("mouseup",this.C,!1),this.a.addEventListener("touchend",this.C,!1)};
20
+ _.r.tn=function(a){a.preventDefault();var b=a.clientX,c=a.clientY;a.type===Qx&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.h.x-b;var d=this.h.y-c;this.h.x=b;this.h.y=c;b=this.ca;c=d*b*(this.P?-1:1);this.j+=a*b*(this.N?-1:1);this.l+=c;gy(this)};_.r.un=function(a){this.g.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();hy(this)};_.r.Lm=function(a,b){this.l=b;this.j=a;gy(this)};_.r.Pl=function(){return{x:this.j,y:this.l}};
21
+ _.r.no=function(a){this.I=a;this.G()};_.I("clpp.vr.VrPlugin",fy);fy.prototype.setCameraFieldOfView=fy.prototype.no;fy.prototype.getCameraCoordinates=fy.prototype.Pl;fy.prototype.moveCamera=fy.prototype.Lm;fy.Id="vr";iy.prototype.create=function(){return new fy};_.Yt(new iy);};
22
22
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
23
23
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
24
24
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.vtt.js CHANGED
@@ -11,8 +11,8 @@ Number(m[1]),n.regionAnchorY=Number(m[2]);else if(m=/^viewportanchor:(\d{1,2}|10
11
11
  e.push(m[0]);while(m)}h=[];d=_.u(d);for(g=d.next();!g.done;g=d.next())if(g=g.value,g.includes("--\x3e")){p=g.split("\n");var q=c;if(1===p.length&&!p[0]||/^NOTE($|[ \t])/.test(p[0])||"STYLE"===p[0])g=null;else{g=null;p[0].includes("--\x3e")||(g=p[0],p.splice(0,1));l=new _.Ij(p[0]);m=Kx(l);var t=_.Jj(l,/[ \t]+--\x3e[ \t]+/g);n=Kx(l);if(null==m||null==t||null==n)throw new _.N(_.O,2,2001);m+=q;n+=q;p=p.slice(1).join("\n").trim();m=new _.Si(m,n,p,_.Qg);g&&(m.id=g);Cx(l);for(n=Dx(l);n;)Jx(m,n,f)||_.Jh(xx,
12
12
  n,wx),Cx(l),n=Dx(l);null!=g&&(m.id=g);g=m}g&&h.push(g)}return{cues:h,styles:e}};_.w(Lx,Hx);Lx.prototype.parseMedia=function(a,b){return Hx.prototype.parseMedia.call(this,(new Ex).a(a),b)};Mx.prototype.parseInit=function(a){var b=this,c=!1;(new _.pn).M(_.Ne,_.qn).M(_.tg,_.qn).M(_.He,_.qn).aa("mdhd",function(d){0===d.version?(d.reader.skip(4),d.reader.skip(4),b.a=_.kn(d.reader),d.reader.skip(4)):(d.reader.skip(8),d.reader.skip(8),b.a=_.kn(d.reader),d.reader.skip(8));d.reader.skip(4)}).M(_.Le,_.qn).M(_.dg,_.qn).aa(_.fg,_.rn).M("wvtt",function(){c=!0}).parse(a);if(!this.a)throw new _.N(_.O,2,2008);if(!c)throw new _.N(_.O,2,2008);};
13
13
  Mx.prototype.parseMedia=function(a,b){if(!this.a)throw this.g.error("No init segment for MP4+VTT!"),new _.N(_.O,2,2008);var c=0,d=[],e,f=[],g=!1,h=!1,l=!1,m=null;(new _.pn).M("moof",_.qn).M("traf",_.qn).aa("tfdt",function(F){g=!0;c=0===F.version?_.kn(F.reader):_.mn(F.reader)}).aa("tfhd",function(F){var M=F.flags;F=F.reader;F.skip(4);M&1&&F.skip(8);M&2&&F.skip(4);m=M&8?_.kn(F):null}).aa("trun",function(F){h=!0;var M=F.version,R=F.flags;F=F.reader;var ka=_.kn(F);R&1&&F.skip(4);R&4&&F.skip(4);for(var U=
14
- [],qa=0;qa<ka;qa++){var Ba={duration:null,sampleSize:null,Sg:null};R&256&&(Ba.duration=_.kn(F));R&512&&(Ba.sampleSize=_.kn(F));R&1024&&F.skip(4);R&2048&&(Ba.Sg=0===M?_.kn(F):_.ln(F));U.push(Ba)}d=U}).M(_.Ge,_.sn(function(F){l=!0;e=F})).parse(a);if(!l&&!g&&!h)throw new _.N(_.O,2,2008);var n=c,p=new DataView(e.buffer,e.byteOffset,e.byteLength);p=new _.en(p,!1);for(var q=_.u(d),t=q.next();!t.done;t=q.next()){t=t.value;var v=t.duration||m,z=t.Sg?c+t.Sg:n;n=z+(v||0);var A=0;do{var E=_.kn(p);A+=E;var G=
15
- _.kn(p);G=_.un(G);var B=null;"vttc"===G?8<E&&(B=_.on(p,E-8)):("vtte"!==G&&this.g.error("Unknown box "+G+"! Skipping!"),p.skip(E-8));v?B&&f.push(Ox(B,b.periodStart+z/this.a,b.periodStart+n/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(t.sampleSize&&A<t.sampleSize)}return{cues:f.filter(_.aj),styles:[]}};_.w(Px,_.Bu);Px.prototype.f=function(){_.Av(_.kg,Hx);_.Av(Ax,Hx);_.Av(Bx,Hx);_.Av(_.Lc,Mx);_.Av(zx,Lx);_.Av(yx,Lx);_.dl.push(this.j)};Px.prototype.a=function(){_.Cv(_.kg);_.Cv(Ax);_.Cv(Bx);_.Cv(_.Lc);_.Cv(zx);_.Cv(yx);_.fl(this.j)};Px.prototype.id=function(){return"subtitles-vtt"};_.I("clpp.vtt.VttComponent",Px);};
14
+ [],qa=0;qa<ka;qa++){var Ba={duration:null,sampleSize:null,Tg:null};R&256&&(Ba.duration=_.kn(F));R&512&&(Ba.sampleSize=_.kn(F));R&1024&&F.skip(4);R&2048&&(Ba.Tg=0===M?_.kn(F):_.ln(F));U.push(Ba)}d=U}).M(_.Ge,_.sn(function(F){l=!0;e=F})).parse(a);if(!l&&!g&&!h)throw new _.N(_.O,2,2008);var n=c,p=new DataView(e.buffer,e.byteOffset,e.byteLength);p=new _.en(p,!1);for(var q=_.u(d),t=q.next();!t.done;t=q.next()){t=t.value;var v=t.duration||m,z=t.Tg?c+t.Tg:n;n=z+(v||0);var A=0;do{var D=_.kn(p);A+=D;var G=
15
+ _.kn(p);G=_.un(G);var B=null;"vttc"===G?8<D&&(B=_.on(p,D-8)):("vtte"!==G&&this.g.error("Unknown box "+G+"! Skipping!"),p.skip(D-8));v?B&&f.push(Ox(B,b.periodStart+z/this.a,b.periodStart+n/this.a)):this.g.error("WVTT sample duration unknown, and no default found!")}while(t.sampleSize&&A<t.sampleSize)}return{cues:f.filter(_.aj),styles:[]}};_.w(Px,_.Bu);Px.prototype.f=function(){_.Av(_.kg,Hx);_.Av(Ax,Hx);_.Av(Bx,Hx);_.Av(_.Lc,Mx);_.Av(zx,Lx);_.Av(yx,Lx);_.dl.push(this.j)};Px.prototype.a=function(){_.Cv(_.kg);_.Cv(Ax);_.Cv(Bx);_.Cv(_.Lc);_.Cv(zx);_.Cv(yx);_.fl(this.j)};Px.prototype.id=function(){return"subtitles-vtt"};_.I("clpp.vtt.VttComponent",Px);};
16
16
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
17
17
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
18
18
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.yospace.js CHANGED
@@ -1,8 +1,8 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var rx="clpp.yospace.YospacePlugin",sx=function(){this.a=null;this.g=new _.J(rx)},tx=function(){};_.w(sx,_.bw);sx.prototype.fi=function(){return this.a};
2
+ var f=function(window){var rx="clpp.yospace.YospacePlugin",sx=function(){this.a=null;this.g=new _.J(rx)},tx=function(){};_.w(sx,_.bw);sx.prototype.ii=function(){return this.a};
3
3
  sx.prototype.onContentWillLoad=function(a,b){var c=this,d,e,f,g,h;return _.H(function(l){if(1==l.a){d=a.getConfiguration();e=d.yospace;if(!e.enabled)return l["return"]();if(typeof window.YospaceAdManagement!==_.Re)throw new _.N(_.O,9,7003,"Yospace SDK not found.");c.g.info("Yospace enabled.");f=e.streamType||ux;a:{var m=b.url;c.g.info("Creating Yospace session for stream type",f);switch(f){case ux:m=YospaceAdManagement.SessionVOD.create(m);break a;case vx:m=YospaceAdManagement.SessionLive.create(m);
4
4
  break a;default:m=YospaceAdManagement.SessionDVRLive.create(m)}}return _.x(l,m,2)}g=l.f;h=g.getSessionState();if(h!==YospaceAdManagement.SessionState.INITIALISED)throw c.g.error("Failed to initialize Yospace session. State:",h,"URL",b.url),new _.N(_.O,9,7003,"Yospace session failed to initialize.");a.trigger(new _.K(_.ch,{detail:g}));b.url=g.getPlaybackUrl();c.g.info("Yospace session initialized. New URL:",b.url);c.a=g;_.y(l)})};
5
- sx.prototype.onPlayerWillRelease=function(a){if(this.a){this.g.info("Shutting down Yospace session.");var b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.K(_.bh,{detail:b}))}};sx.prototype.id=function(){return"yospace"};_.I(rx,sx);sx.prototype.getSession=sx.prototype.fi;sx.Id="yospace";tx.prototype.create=function(){return new sx};_.Yt(new tx);var ux=_.Wb,vx="LIVE";_.I("clpp.yospace.StreamType",{VOD:ux,LIVE:vx,DVR:"DVR"});};
5
+ sx.prototype.onPlayerWillRelease=function(a){if(this.a){this.g.info("Shutting down Yospace session.");var b=this.a;this.a.shutdown();this.a=null;a.trigger(new _.K(_.bh,{detail:b}))}};sx.prototype.id=function(){return"yospace"};_.I(rx,sx);sx.prototype.getSession=sx.prototype.ii;sx.Id="yospace";tx.prototype.create=function(){return new sx};_.Yt(new tx);var ux=_.Wb,vx="LIVE";_.I("clpp.yospace.StreamType",{VOD:ux,LIVE:vx,DVR:"DVR"});};
6
6
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
7
7
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
8
8
  else{_=this.clpp._;(f.call(g,this));}