@castlabs/prestoplay 6.30.0 → 6.31.0

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 +247 -179
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +19 -7
  5. package/cjs/cl.cast.js +120 -120
  6. package/cjs/cl.conviva.js +31 -31
  7. package/cjs/cl.core.js +567 -566
  8. package/cjs/cl.crypto.js +10 -10
  9. package/cjs/cl.dash.js +95 -92
  10. package/cjs/cl.externs.js +224 -40
  11. package/cjs/cl.freewheel.js +26 -25
  12. package/cjs/cl.hls.js +79 -78
  13. package/cjs/cl.hlssmpte.js +4 -4
  14. package/cjs/cl.htmlcue.js +19 -19
  15. package/cjs/cl.ima.js +26 -25
  16. package/cjs/cl.mediatailor.js +3 -3
  17. package/cjs/cl.mse.js +352 -350
  18. package/cjs/cl.muxdata.js +13 -13
  19. package/cjs/cl.onboard.js +2 -2
  20. package/cjs/cl.persistent.js +13 -13
  21. package/cjs/cl.playlist.js +6 -6
  22. package/cjs/cl.simid.js +10 -10
  23. package/cjs/cl.smooth.js +71 -71
  24. package/cjs/cl.thumbnails.js +16 -16
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +15 -15
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +11 -11
  29. package/cjs/cl.vr.js +12 -12
  30. package/cjs/cl.vtt.js +12 -12
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +35 -35
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +14 -6
  36. package/cl.cast.js +99 -98
  37. package/cl.conviva.js +26 -26
  38. package/cl.core.js +413 -412
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +87 -84
  41. package/cl.externs.js +225 -37
  42. package/cl.freewheel.js +20 -19
  43. package/cl.hls.js +76 -76
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +20 -19
  47. package/cl.mediatailor.js +2 -2
  48. package/cl.mse.js +299 -300
  49. package/cl.muxdata.js +12 -12
  50. package/cl.onboard.js +4 -4
  51. package/cl.persistent.js +10 -10
  52. package/cl.playlist.js +5 -5
  53. package/cl.simid.js +14 -14
  54. package/cl.smooth.js +62 -60
  55. package/cl.thumbnails.js +17 -17
  56. package/cl.tizen.js +55 -55
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +31 -31
  64. package/package.json +8 -7
  65. package/typings.d.ts +85 -61
@@ -1,28 +1,28 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Mz="No thumbnail found for position: ",Nz="Position is out of range: ",Oz="Thumbnail URL is mandatory",Pz="Wrong gridSize format",Qz="clpp.thumbnails",Rz=function(){this.log=new _.L(Qz);this.player=null;this.a=[];this.w=!1},Tz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.$e&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Sz(a,0,e,!!f)})},Promise.resolve())},Sz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Uz(a,d).then(function(){return a.a[b].load()}).then(function(){return Sz(a,
3
- e,c,d)})},Uz=function(a,b){return new Promise(function(c){if(b||2!==a.player.getState())c();else a.player.one(_.cd,function(){c()})})},Vz=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.a=p;this.h=h;this.o=l;this.j=m;this.l=n;this.f=null},Wz=function(){Rz.call(this);
4
- this.f=null;this.o=this.h=1;this.j=0},Xz=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.zd=new _.om},Yz=function(){this.g=new _.L(Qz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.om},Zz=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.zd.resolve()})},aA=function(a,b){return $z(a,b).then(function(c){return new Vz(c,b.time,b.duration)})},$z=function(a,b){return b.load().then(function(){var c=_.Qi(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
- _.Km(c)})},bA=function(){Rz.call(this);this.f=null},cA=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},dA=function(){Rz.apply(this,arguments)},eA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{se:c,qh:d,Ii:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},fA=function(){this.g=new _.L(Qz);this.a=this.m=null},gA=function(a){return a.some(function(b){return 0<
6
- b.thumbStreams.length})},lA=function(a){return a?a===hA||a===iA?new Wz:a===jA?new bA:a===kA?new Yz:null:null},mA=function(a){if(!a)return null;a=new _.wn(a);return a.path.match(/.*\.vtt$/i)?jA:a.path.match(/.*\.bif$/i)?kA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?hA:null},nA=function(){};Rz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Qf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Tz(c,b.preload)})};Vz.prototype.raw=function(){return this.a.cloneNode(!1)};
2
+ var f=function(window){var Mz="No thumbnail found for position: ",Nz="Position is out of range: ",Oz="Thumbnail URL is mandatory",Pz="Wrong gridSize format",Qz="clpp.thumbnails",Rz=function(){this.log=new _.M(Qz);this.player=null;this.a=[];this.w=!1},Tz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.$e&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Sz(a,0,e,!!f)})},Promise.resolve())},Sz=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Uz(a,d).then(function(){return a.a[b].load()}).then(function(){return Sz(a,
3
+ e,c,d)})},Uz=function(a,b){return new Promise(function(c){if(b||2!==a.player.getState())c();else a.player.one(_.cd,function(){c()})})},Vz=function(a,b,c,d,e,f,g,k,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;k=void 0===k?1:k;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.a=p;this.h=k;this.o=l;this.j=m;this.l=n;this.f=null},Wz=function(){Rz.call(this);
4
+ this.f=null;this.o=this.h=1;this.j=0},Xz=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Hd=new _.nm},Yz=function(){this.g=new _.M(Qz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.nm},Zz=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Hd.resolve()})},aA=function(a,b){return $z(a,b).then(function(c){return new Vz(c,b.time,b.duration)})},$z=function(a,b){return b.load().then(function(){var c=_.Qi(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
5
+ _.Jm(c)})},bA=function(){Rz.call(this);this.f=null},cA=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},dA=function(){Rz.apply(this,arguments)},eA=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{ve:c,uh:d,Mi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},fA=function(){this.g=new _.M(Qz);this.a=this.m=null},gA=function(a){return a.some(function(b){return 0<
6
+ b.thumbStreams.length})},lA=function(a){return a?a===hA||a===iA?new Wz:a===jA?new bA:a===kA?new Yz:null:null},mA=function(a){if(!a)return null;a=new _.vn(a);return a.path.match(/.*\.vtt$/i)?jA:a.path.match(/.*\.bif$/i)?kA:a.path.match(/.*\.(png|jpg|jpeg)$/i)?hA:null},nA=function(){};Rz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Qf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Tz(c,b.preload)})};Vz.prototype.raw=function(){return this.a.cloneNode(!1)};
7
7
  Vz.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Xd);e.style.width=c+_.Nf;e.style.height=d+_.Nf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))+"px "+Math.ceil(d/
8
8
  this.height*(this.a.naturalHeight||this.a.height))+_.Nf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Nf;e.style.backgroundPositionY="-"+f*d+_.Nf;return e};
9
9
  Vz.prototype.load=function(){var a=this;this.f||(this.f=new Promise(function(b,c){function d(){a.width||(a.width=(a.a.naturalWidth||a.a.width)/a.h);a.height||(a.height=(a.a.naturalHeight||a.a.height)/a.o);a.x||(a.x=a.width*a.j);a.y||(a.y=a.height*a.l)}if(a.a.src&&a.a.complete)d(),b(a);else{var e=null,f=function(){d();a.a.removeEventListener(_.Je,f);a.a.removeEventListener(_.qe,e);b(a)};e=function(g){a.a.removeEventListener(_.Je,f);a.a.removeEventListener(_.qe,e);c(new _.O(1,9,2014,"Failed to load thumbnail.",
10
10
  g))};a.a.addEventListener(_.Je,f);a.a.addEventListener(_.qe,e);a.a.src=a.src}}));return this.f};_.K("clpp.thumbnails.Thumbnail",Vz);Vz.prototype.load=Vz.prototype.load;Vz.prototype.element=Vz.prototype.element;Vz.prototype.raw=Vz.prototype.raw;_.w(Wz,Rz);
11
11
  Wz.prototype.init=function(a,b){if(!b||!b.url)throw new _.O(1,9,7100,Oz);if("GRID"===b.mode&&!b.gridSize)throw new _.O(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.O(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 _.O(1,9,7100,Pz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
12
12
  new _.O(1,9,7100,Pz);}Rz.prototype.init.call(this,a,b)};Wz.prototype.get=function(a){var b=this,c,d,e,f;return _.I(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.O(1,9,2014,Nz+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.O(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.x(g,f.load(),2)}return g["return"](f)})};
13
- Wz.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 Vz(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()};Xz.prototype.load=function(){return this.zd};
14
- Yz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Oz);var d=b.url,e=_.$k(d);e.type=_.Zk;a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;var g=_.Qi(c.f);f=_.Qi(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=_.Qi(l);n=String.fromCharCode.apply(null,
15
- oA);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 Xz(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");
13
+ Wz.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 Vz(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()};Xz.prototype.load=function(){return this.Hd};
14
+ Yz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Oz);var d=b.url,e=_.Zk(d);e.type=_.Yk;a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;var g=_.Qi(c.f);f=_.Qi(f);for(var k=g.byteLength+f.byteLength,l=new ArrayBuffer(k),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 "+(k+" bytes."));l=c.f;f=_.Qi(l);n=String.fromCharCode.apply(null,
15
+ oA);g=Array.prototype.slice.call(f,0,8);f=64;k=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;){k+=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 Xz(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<k)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
16
  Zz(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.O(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};Yz.prototype.get=function(a){var b=this,c,d;return _.I(function(e){switch(e.a){case 1:if(0>a)throw new _.O(1,9,2014,Nz+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 _.O(1,9,2014,Mz+a);return _.x(e,aA(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
17
- Yz.prototype.Qb=function(){return 0<this.a.length};var oA=[137,66,73,70,13,10,26,10];_.w(bA,Rz);
18
- bA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Oz);var d=b.url,e=_.$k(d);e.type=_.Zk;this.f=a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.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
- d.substr(0,d.lastIndexOf("/"))+"/"+h);t=cA(l[0]);l=cA(l[1])-t;c.a.push(new Vz(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 _.O(1,9,2013,"Error while loading VTT thumbnails.",f))});Rz.prototype.init.call(this,a,b)};
17
+ Yz.prototype.Wb=function(){return 0<this.a.length};var oA=[137,66,73,70,13,10,26,10];_.w(bA,Rz);
18
+ bA.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.O(1,9,7100,Oz);var d=b.url,e=_.Zk(d);e.type=_.Yk;this.f=a.getNetworkEngine().fetch(e).U.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.ga(f).split(/\n/);for(var g=0;g<f.length;g++){var k=f[g],l=k.split(" --\x3e ");if(2===l.length){k=f[++g];var m=k.indexOf("\x3d"),n=0>m?[]:k.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=k.indexOf("#");k=0>t?k:k.substr(0,t);k.match(/^http|^\/\//)||(k=
19
+ d.substr(0,d.lastIndexOf("/"))+"/"+k);t=cA(l[0]);l=cA(l[1])-t;c.a.push(new Vz(k,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 _.O(1,9,2013,"Error while loading VTT thumbnails.",f))});Rz.prototype.init.call(this,a,b)};
20
20
  bA.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.O(1,9,2014,Nz+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 _.O(1,9,2014,Mz+a);return _.x(d,c.load(),3)}return d["return"](c)})};bA.prototype.l=function(){return this.f};_.w(dA,Rz);
21
- dA.prototype.get=function(a){function b(){return new _.O(1,9,2014,Mz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,u,y;return _.I(function(D){if(1==D.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.O(1,9,2014,Nz+a);d=c.player.getPeriods();for(var C=null,B=_.v(d),E=B.next();!E.done;E=B.next())E=E.value,E.startTime<=a&&(C=E);e=C;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 D.C(2);l=eA(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.Ii+m])):(q=h.La())&&0<q.length&&(u=t=0,y=h.startTime,1<l.Ii&&(t=m%l.se,u=Math.floor(m/l.se),y+=m*l.durationPerTile),n=new Vz(q[0],y,l.durationPerTile,void 0,void 0,void 0,void 0,l.se,l.qh,
23
- t,u));return n?_.x(D,n.load(),4):D.C(2)}if(2!=D.a)return D["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};dA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
- dA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.v(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&&!_.M.R(d=b.getSegmentReference(c++));)for(var e=eA(d,b),f=d.La()[0],g=new Image,h=d.startTime,l=0;l<e.qh;++l)for(var m=0;m<e.se;++m)this.a.push(new Vz(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.se,e.qh,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=fA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
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=mA(c.url||null));(this.a=lA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Me,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};
21
+ dA.prototype.get=function(a){function b(){return new _.O(1,9,2014,Mz+a)}var c=this,d,e,f,g,k,l,m,n,p,q,t,u,y;return _.I(function(C){if(1==C.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.O(1,9,2014,Nz+a);d=c.player.getPeriods();for(var D=null,B=_.v(d),E=B.next();!E.done;E=B.next())E=E.value,E.startTime<=a&&(D=E);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();k=f.getSegmentReference(g);if(!k)return C.C(2);l=eA(k,f);m=Math.floor((a-k.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.Mi+m])):(q=k.Ia())&&0<q.length&&(u=t=0,y=k.startTime,1<l.Mi&&(t=m%l.ve,u=Math.floor(m/l.ve),y+=m*l.durationPerTile),n=new Vz(q[0],y,l.durationPerTile,void 0,void 0,void 0,void 0,l.ve,l.uh,
23
+ t,u));return n?_.x(C,n.load(),4):C.C(2)}if(2!=C.a)return C["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};dA.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
24
+ dA.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.v(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=eA(d,b),f=d.Ia()[0],g=new Image,k=d.startTime,l=0;l<e.uh;++l)for(var m=0;m<e.ve;++m)this.a.push(new Vz(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.ve,e.uh,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.r=fA.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
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=mA(c.url||null));(this.a=lA(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Le,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(gA(d)){this.a=new dA;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 _.O(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.K("clpp.thumbnails.ThumbnailsPlugin",fA);fA.prototype.get=fA.prototype.get;fA.Id="thumbnails";
27
27
  nA.prototype.create=function(){return new fA};var hA="SINGLE",iA="GRID",jA="WEBVTT",kA="BIF";_.bp(new nA);};
28
28
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
package/cjs/cl.tizen.js CHANGED
@@ -1,77 +1,77 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var hP="An unknown error occurred while trying to get volume",iP="Cannot get loading rendition due to platform limitations",jP="PARAM_START_POSITION",kP="SecurityError",lP="The require privilege is: http://tizen.org/privilege/tv.audio",mP="onbufferingcomplete",nP="onbufferingprogress",oP="onbufferingstart",pP="oncurrentplaytime",qP="ondrmevent",rP="onerror",sP="onstreamcompleted",tP="onsubtitlechange",uP="preparingend",vP="preparingstart",wP="|STARTBITRATE\x3d",xP=function(a,b,c){function d(e){c.call(a,
3
- e);a.removeEventListener(b,d)}a.addEventListener(b,d)},yP=function(a,b){this.h=a;this.o=null;this.a=_.Ze;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.L("clpp.tizen.DrmEngine")},BP=function(a){var b,c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Md||a.a===_.Kd;if(!b)throw new _.O(_.P,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Be)throw new _.O(_.P,6,6012,"No license server given for "+a.a);_.F(e,2);return a.a===_.Md?_.x(e,zP(a),
4
- 5):_.x(e,AP(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Be,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Rg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null},_.G(e,0);d=_.H(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.O(_.P,6,6005,{message:JSON.stringify(d)});})},AP=function(a,b){var c,d,e,f;return _.I(function(g){c=CP;d=DP;e={};e[d.Xj]=!b.Rg;e[d.Zj]=b.Be;""!==b.customData&&(e[d.Vj]=b.customData);
5
- f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.z(g)})},zP=function(a){var b;return _.I(function(c){b=CP;try{webapis.avplay.setDrm(b.af,"Initialize",""),webapis.avplay.setDrm(b.af,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.af,"widevine_data_type",a.l.type)}catch(d){throw d;}_.z(c)})},EP=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,D,C,B;_.I(function(E){if(1==E.a){c=CP;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",
6
- 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.Be;l=_.$k([h],_.Wk());l.type=3;l.body=f.buffer;l.method=_.rb;_.F(E,2);return _.x(E,a.D.Db.fetch(l).U,4)}if(2!=E.a){m=E.f;if(a.j){n=_.Qi(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);u=btoa(q);y=b.session_id+jP+(u+jP);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.af,"widevine_license_data",y)}catch(A){a.g.error("License response rejected by CDM"),
7
- D=new _.O(_.P,6,6008,{browserError:JSON.stringify(A)}),a.D.onError(D)}}return _.G(E,0)}C=_.H(E);a.g.error("License request failed.",JSON.stringify(C));B=new _.O(_.P,6,6007,{message:"Error while fetching license!",url:C.data.url,status:C.data.status||NaN,response:C.data.response||"",headers:C.data.headers||{}},C);a.D.onError(B);_.z(E)})},FP=function(a){this.m=a;this.a=this.m.a;this.f=_.eu;this.j=7;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.L("clpp.tizen.StateManager")},HP=
8
- function(a,b){if(a.f!==b)if(a.f===_.Co&&b!==_.eu)a.g.debug(_.FB+GP(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;2===a.f?(a.o=(new Date).getTime(),a.m.trigger(new _.Q(_.dd,{detail:{bufferedTimeMS:-1,reason:a.h}}))):2===a.j&&a.m.trigger(new _.Q(_.cd,{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 _.Q(_.ig,{detail:d}));a.g.debug("State changed:",GP(a.j),"-\x3e",GP(a.f))}},GP=function(a){return Object.keys(_.lu)[a]},
9
- KP=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case IP:c=3;break;case JP:c=4;break;default:a.m.isEnded()?c=5:a.g.debug("Inconsistent AVPlay playback state:",b)}HP(a,c)}},LP=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.F=!1;this.w=!0;this.l=null;this.g=new _.L("clpp.tizen.TextStreamer")},MP=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},NP=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=
10
- a.m.getConfiguration(),c=null,_.x(d,_.Vv(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)})},OP=function(a){var b=document.createElement(_.Sg),c=new _.iF,d=new _.SC,e=a.m.getTextDisplayer();return new _.kF(b,c,e,d,a.m.getConfiguration())},PP=function(a){var b={configuration:{},Bb:function(){return a.m.getPosition()},W:a.h,Db:a.m.getNetworkEngine(),od:null,Hg:a.El.bind(a),bj:a.Dl.bind(a),onError:a.Fl.bind(a),cj:function(){},
11
- onEvent:function(){},hj:a.Gl.bind(a),Jf:function(){},je:function(){return new _.YF},kg:function(){return!1},ce:null};return new _.EG(a.a,b)},QP=function(a){var b=a.m.getPosition(),c=null;a=_.v(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},RP=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=
12
- c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Zs(String(c++),_.at);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.cC;var f=new _.ht(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},SP=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.HG(a.f,_.Dn),c=null;if(b){a=RP(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];
13
- break}}return c}return null},TP=function(a,b){var c,d,e,f;_.I(function(g){if(1==g.a){c=_.XI;a.g.debug("Set active track",b);if(!b)return g.C(0);a.o=b.language;a.A=b.roles[0]||"";a.F=b.kind===c.uh;if(!a.a||!a.f)return g.C(0);a.setTextVisibility(!0);d=QP(a);e=b.renditions[0];f=d.textStreams.find(function(h){return String(h.id)===e.id});return f?a.w?(a.g.debug("Switching period defer text selection"),a.l=f,g.C(4)):_.x(g,_.aH(a.f,f),5):(a.g.error("No stream with id",e.id),g["return"]())}4!=g.a&&a.m.trigger(new _.Q(_.ug));
14
- a.o=f.language;_.z(g)})},UP=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.L("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},VP=function(a,b){a.m.trigger(new _.Q(_.Wg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},WP=function(a){var b=a.qa();b&&a.m.trigger(new _.Q(_.ad,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},XP=function(a){var b=a.m.getConfiguration(),c=_.Ii(b.preferredAudioLanguage||
15
- []),d=a.f[_.X]||[];if(d.length){var e=null;c.some(function(g){e=_.JC(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)}),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")},aQ=function(a,
16
- b){if(b){var c=b.track.type.toUpperCase();YP(a.a,c,Number(b.id)).then(function(){c===ZP&&(a.l=b,a.m.trigger(new _.Q(_.Zc)));c===$P&&(a.o=b,a.m.trigger(new _.Q(_.ug)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},bQ=function(a,b,c){var d=_.so(b.language||_.Hg);c.language=_.$s(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Wc;a=new _.ht(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
17
- b.bit_rate||null;return a},cQ=function(a,b,c){c.mimeType=_.Ug;a=new _.ht(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},dQ=function(a,b,c){b=_.so(b.track_lang||_.Hg);c.mimeType="text/ttml";c.language=_.$s(b);c.originalLanguage=b;c.kind=_.cC;return new _.ht(String(a),c)},eQ=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},
18
- hQ=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===fQ}),f=b.filter(function(n){return n.type===ZP}),g=[],h=0;h<f.length;h++){var l=eQ(a,f[h].extra_info);if(l){var m=_.so(l.language||_.Hg);m=_.$s(m);m=c(g,m);m||(m=new _.Zs(String(a.h++),_.X),g.push(m));m.renditions.push(bQ(f[h].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Zs(String(a.h++),
19
- _.bt);for(h=0;h<e.length;h++)(l=eQ(a,e[h].extra_info))?f.renditions.push(cQ(e[h].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?RP(a.j):gQ(a,b);d[_.bt]=[f];d[_.X]=g;d[_.at]=e;return d},gQ=function(a,b){for(var c=b.filter(function(h){return h.type===$P}),d=[],e=0;e<c.length;e++){var f=eQ(a,c[e].extra_info);if(f){var g=new _.Zs(String(a.h++),_.at);g.renditions.push(dQ(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},iQ=function(a,
20
- b){for(var c=a.f[_.bt]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.M.ta(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},jQ=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===b){c=a[d].renditions[e];break}return c},lQ=function(a,b){if(b===_.at&&a.j)return SP(a.j);var c=kQ(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===
21
- b.toUpperCase()})[0];var d=null;b===_.bt&&(d=eQ(a,c.extra_info),d=iQ(a,{width:d.Width,height:d.Height}));b===_.X&&(c?(d=jQ(a,c,_.X),a.l=d):d=a.l);b===_.at&&(c?(d=jQ(a,c,_.at),a.o=d):d=a.o);return d},mQ=function(a){_.Di.call(this);this.m=a;this.h=null;this.g=new _.L("clpp.tizen.Middleware");this.F=1;this.B=!1;this.l=null;this.G=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},nQ=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/
22
- 1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.z(b)})},oQ=function(a){try{webapis.avplay.setListener({onbufferingstart:a.yl.bind(a),onbufferingprogress:a.xl.bind(a),onbufferingcomplete:a.wl.bind(a),onstreamcompleted:a.Bl.bind(a),oncurrentplaytime:function(b){a.trigger(new _.Q(pP,{currentTime:b}))},onevent:a.Al.bind(a),onsubtitlechange:a.Cl.bind(a),ondrmevent:a.zl.bind(a),onerror:a.Yd.bind(a)})}catch(b){a.g.error(b)}},pQ=function(a){var b=
23
- !!a.m.getTrackManager().$a();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},qQ=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Gp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",wP+d)}catch(e){a.g.debug(e)}},rQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+wP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",
24
- c),c;}},uQ=function(a){return{position:a.getPosition(),state:a.m.getState(),Fh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:sQ(a),volume:a.getVolume(),$o:tQ(a),Rl:kQ(a)}},wQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.x(d,vQ(),2);if(3!=d.a)return b=new Promise(function(e){(new _.gj(e)).ha(5)}),_.x(d,Promise.race([nQ(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"),
25
- d["return"](Promise.reject("SDK Timeout"));_.z(d)})},zQ=function(a,b,c){var d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Sn(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 _.Q(oP)),f=c.currentPosition);_.F(p,2);g=a.l[d].url;h=a.l[d].type;h!==_.Lc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);
26
- e.nextBandwidth?(rQ(a,e.nextBandwidth),a.o=!1):(a.o||qQ(a,e),a.o=!0);oQ(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.C(4);break}m={onError:function(q){return a.m.onError(q)},Db:a.m.getNetworkEngine()};a.h=new yP(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.Q(vP)),_.x(p,xQ(a),6);case 6:a.f||a.trigger(new _.Q(uP));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&&
27
- a.setVolume(b.volume),b.muted&&yQ(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.G(p,0);break;case 2:throw n=_.H(p),a.g.debug("Error while attempting to load source."),n;}})},xQ=function(a){return _.I(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!");pQ(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),
28
- d(e)}}))})},AQ=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=uQ(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Fh;a.f=!1;a.a=null;return e===JP?a.pause():a.play()})}catch(e){return Promise.reject(e)}},tQ=function(a){return a.f&&a.a?a.a.$o:webapis.avplay.getTotalTrackInfo()},
29
- kQ=function(a){return a.f&&a.a?a.a.Rl:webapis.avplay.getCurrentStreamInfo()},YP=function(a,b,c){b=b.toUpperCase();b===$P&&BQ(a,!0);var d=a.j[b];d&&(d.Uf.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 "+h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,Bh:0,
30
- Uf:new _.gj(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.Bh?(a.w||++l.Bh,l.Uf.ha(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Uf.stop(),a.j[h]=null,f())}}g(b,c)})},BQ=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",d)}},yQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case kP:a.g.warn("The application does not have the privilege to set mute.",
31
- lP);break;default:a.g.warn(hP,c)}}},sQ=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case kP:a.g.warn("The application doesn't have the privilege to get the mute state.",lP);break;default:a.g.warn(hP,c)}}return!!b},vQ=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");xP(c,_.Je,function(d){return a(d)});xP(c,_.qe,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},
32
- CQ=function(){_.Di.call(this);this.a=new mQ(this);this.f=new FP(this);this.configuration=this.B=_.Mn();this.w=null;this.g=new _.L("clpp.tizen.Player");this.j=null;this.l=new UP;this.F=new _.Ym;this.o=this.h=null;this.A=!1},DQ=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,
33
- 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())},EQ=function(){},FQ=function(){};
34
- yP.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(h){if(1==h.a){b=_.Vn[a.h.env]||null;if(!b)throw a.g.debug(_.Ba,_.wb+a.h.env+_.aa),new _.O(_.P,6,6015,_.Da+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=_.Xn(b,a.h.customData);(e=d[_.Kd])&&a.f.set(_.Kd,{Be:e.licenseUrl||"",customData:c,Rg:!1});(f=d[_.Md])&&a.f.set(_.Md,{Be:f.licenseUrl||"",customData:c,
35
- Rg:!1});if(0===a.f.size)throw new _.O(_.P,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Kd))a.a=_.Kd;else if(a.f.get(_.Md))a.a=_.Md;else throw new _.O(_.P,6,6001,"Configuration for the target system is missing.");return _.x(h,BP(a),2)}a.j=!0;_.z(h)})};yP.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Ze;a.l=null;a.f=new Map;_.z(b)})};yP.prototype.getDrmInfo=function(){return this.o};
36
- var DP={Xj:"DeleteLicenseAfterUse",Zj:"LicenseServer",rp:"GetChallenge",sp:"HttpHeader",up:"UserAgent",op:"Cookie",Vj:"CustomData"};_.r=FP.prototype;_.r.initialize=function(){this.a.on(oP,this.Xh,this);this.a.on(nP,this.Wh,this);this.a.on(mP,this.Vh,this);this.a.on(vP,this.jj,this);this.a.on(uP,this.ij,this);this.a.on(sP,this.Yh,this)};_.r.release=function(){HP(this,_.eu);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(oP,this.Xh);this.a.off(nP,this.Wh);this.a.off(mP,this.Vh);this.a.off(vP,this.jj);this.a.off(uP,this.ij);this.a.off(sP,this.Yh);this.m=this.a=null};
37
- _.r.Xh=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;HP(this,2)};_.r.Wh=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",GP(this.f))};_.r.Vh=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()===GQ;if(!a&&b){HP(this,4);return}}if(a=1!==this.f)a=this.a.getState(),a=a===IP||a===JP;a&&KP(this)};
38
- _.r.jj=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===HQ?HP(this,1):this.g.error("AVPlay prepares while state is not IDLE")};_.r.ij=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.Yh=function(){HP(this,5)};_.r.getState=function(){return this.f};_.r=LP.prototype;_.r.initialize=function(a){this.m=a};
39
- _.r.load=function(a){var b=this,c,d,e,f,g,h,l;return _.I(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,NP(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(){},
40
- onEvent:function(){},onError:function(){}};_.F(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.G(m,4);break;case 3:return f=_.H(m),b.g.warn(f),_.F(m,6),g=b,_.x(m,b.j.start(a.url.replace(_.ze,"http://"),d),8);case 8:g.a=m.f;_.G(m,4);break;case 6:h=_.H(m),b.g.error(h),b.a=null;case 4:if(!b.a||!MP(b.a)){m.C(0);break}b.h=OP(b);_.F(m,10);return _.x(m,b.h.open(),12);case 12:b.f=PP(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.F=l.preferForcedSubtitles;
41
- _.G(m,0);break;case 10:_.H(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.z(m)}})};_.r.El=function(a){this.g.debug(_.XB,a.id);this.w=!0;var b=_.XF(a.textStreams,this.o||"",this.A||"",this.F)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,cb:null}};_.r.Dl=function(){var a=this;return _.I(function(b){if(1==b.a)return a.g.debug("canSwitch_"),a.w=!1,a.l?_.x(b,_.aH(a.f,a.l),3):b.C(0);a.l=null;_.z(b)})};
42
- _.r.Fl=function(){this.g.debug("onError_")};_.r.Gl=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.I(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.z(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};
43
- _.r.release=function(){var a=this;return _.I(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.z(b)})};_.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.C(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.C(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.C(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.z(b)}})};_.w(UP,_.xt);_.r=UP.prototype;_.r.$i=function(a){var b=a.eventid;a=a.data;switch(b){case IQ:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+eQ(this,b[0].extra_info).Bit_rate,b=iQ(this,{bandwidth:b}))&&(this.w=b,VP(this,b));break;case JQ:WP(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.Lg=function(a){3===a.detail.currentState&&this.m.off(_.ig,this.Lg)};
44
- _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.ig,function(c){b.A||(c=c.detail,3===c.currentState&&(b.g.debug("Current state",c.currentState),b.A=!0,XP(b)))});this.a.on("onevent",this.$i,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
45
- _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.ig,this.Lg);this.m.on(_.ig,this.Lg,this);try{var a=tQ(this.a);this.f=hQ(this,a);var b=this.f[_.X]||[];b.length&&(this.l=b[0].renditions[0]||null);WP(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off("onevent",this.$i);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.bt]||[]};_.r.getAudioTracks=function(){return this.f[_.X]||[]};
46
- _.r.pa=function(){return this.f[_.at]||[]};_.r.qa=function(){return lQ(this,_.bt)};_.r.Va=function(){return lQ(this,_.X)};_.r.$a=function(){return lQ(this,_.at)};_.r.zb=function(){return this.w};_.r.Nb=function(){this.g.info(iP);return null};_.r.Ob=function(){this.g.info(iP);return null};_.r.Ma=function(){var a=this.qa();return a?a.track:null};_.r.oa=function(){var a=this.Va();return a?a.track:null};_.r.xa=function(){var a=this.$a();return a?a.track:null};
47
- _.r.Hb=function(a){var b=this;null===a?(a=this.qa(),AQ(this.a,a.bandwidth,null).then(function(){WP(b)})):0<a.renditions.length&&this.rb(a.renditions[0])};_.r.Ia=function(a){a?aQ(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.ab=function(a){a?(a=a.renditions[0],this.j?TP(this.j,a.track):aQ(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,BQ(this.a,!1),this.m.trigger(new _.Q(_.ug)))};
48
- _.r.rb=function(a){var b=this,c=this.qa();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,VP(this,a),AQ(this.a,c.bandwidth,a.bandwidth).then(function(){WP(b)})["catch"](function(d){var e=new _.O(_.P,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){aQ(this,a)};_.r.Gb=function(a){this.j?TP(this.j,a.track):aQ(this,a)};
49
- _.r.addTextTrack=function(){};_.r.ya=function(){return this.a.o};UP.prototype.isAbrEnabled=UP.prototype.ya;UP.prototype.addTextTrack=UP.prototype.addTextTrack;UP.prototype.setTextRendition=UP.prototype.Gb;UP.prototype.setAudioRendition=UP.prototype.Fb;UP.prototype.setVideoRendition=UP.prototype.rb;UP.prototype.setTextTrack=UP.prototype.ab;UP.prototype.setAudioTrack=UP.prototype.Ia;UP.prototype.setVideoTrack=UP.prototype.Hb;UP.prototype.getTextTrack=UP.prototype.xa;UP.prototype.getAudioTrack=UP.prototype.oa;
50
- UP.prototype.getVideoTrack=UP.prototype.Ma;UP.prototype.getLoadingTextRendition=UP.prototype.Ob;UP.prototype.getLoadingAudioRendition=UP.prototype.Nb;UP.prototype.getLoadingVideoRendition=UP.prototype.zb;UP.prototype.getTextRendition=UP.prototype.$a;UP.prototype.getAudioRendition=UP.prototype.Va;UP.prototype.getVideoRendition=UP.prototype.qa;UP.prototype.getTextTracks=UP.prototype.pa;UP.prototype.getAudioTracks=UP.prototype.getAudioTracks;UP.prototype.getVideoTracks=UP.prototype.getVideoTracks;_.w(mQ,_.Di);_.r=mQ.prototype;_.r.yl=function(){this.w=!0;this.f||this.trigger(new _.Q(oP))};_.r.xl=function(a){this.w=!0;this.trigger(new _.Q(nP,{percent:a}))};_.r.wl=function(){this.w=!1;this.trigger(new _.Q(mP))};_.r.Bl=function(){this.trigger(new _.Q(sP))};_.r.Al=function(a,b){this.trigger(new _.Q("onevent",{eventid:a,data:b}))};_.r.Cl=function(a,b,c,d,e){this.trigger(new _.Q(tP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
51
- _.r.zl=function(a,b){this.trigger(new _.Q(qP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Md&&"Challenge"===b.name)EP(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.O(_.P,6,6005,{message:JSON.stringify(b)});c.D.onError(d)}}};_.r.Yd=function(a){this.trigger(new _.Q(rP,{eventType:a}))};
52
- _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(pP,f,b);g=setTimeout(function(){b.off(pP,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===HQ)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){pQ(b);d(webapis.avplay.play())},function(f){b.trigger(new _.Q(rP));e(f)})})).then(function(){return a()});if(c===JP||c===GQ)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===IP?
53
- Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===JP?Promise.resolve():Promise.reject()};
54
- _.r.setPlaybackRate=function(a){var b=this.getState();if(b===GQ||b===IP||b===JP){try{webapis.avplay.setSpeed(a),this.F=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.F)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.F};
55
- _.r.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.F(e,2),_.x(e,wQ(c),4);case 4:return _.x(e,zQ(c,a,b),5);case 5:_.G(e,0);break;case 2:throw d=_.H(e),new _.O(_.P,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.Fh;try{return webapis.avplay.getState()}catch(a){this.Yd(JSON.stringify(a))}};
56
- _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.Q(_.Ng));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.Q(_.Mg));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.Yd(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.Yd(JSON.stringify(a))}};
57
- _.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.Uf.stop()}a.j={};a.F=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 kP:this.g.debug("The application does not have the privilege to get the volume.",lP);break;default:this.g.debug(hP,b)}}return a};
58
- _.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 kP:this.g.warn("The application does not have the privilege to set the volume.",lP);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
59
- _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.Yd(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()]};
60
- var HQ="IDLE",GQ="READY",IP="PLAYING",JP="PAUSED",fQ=_.Tb,ZP=_.ja,$P="TEXT",JQ="PLAYER_MSG_RESOLUTION_CHANGED",IQ="PLAYER_MSG_BITRATE_CHANGE",CP={PLAYREADY:"PLAYREADY",pp:"EME_PLAYREADY",vp:"VERIMATRIX",af:"WIDEVINE_CDM",qp:"EME_WIDEVINE_CDM",xp:"WIDEVINE_CLASSIC"};_.w(CQ,_.Di);_.r=CQ.prototype;_.r.Th=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.Q(_.pe));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.Qh=function(a){this.trigger(new _.Q(_.zg,{currentTime:a.currentTime/1E3}))};
61
- _.r.Uh=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.fh(d))&&this.o.append([new _.Fp(b,c,d)],[])};_.r.Rh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.aj=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
62
- _.r.Sh=function(a){this.g.debug("Error: TYPE: "+a.eventType);HP(this.f,_.Co);a=new _.O(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.Q(_.qe,{detail:a}))};
63
- _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(sP,this.Th,this);this.a.on(pP,this.Qh,this);this.a.on(tP,this.Uh,this);this.a.on(qP,this.Rh,this);this.a.on(rP,this.Sh,this);this.a.on(mP,this.aj,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=KQ;KQ+=1;this.j=_.Yi(_.$e,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
64
- var e=[_.gh,_.ve,"position",_.De,"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=_.v(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.$i(c,f);DQ(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.nb)};_.r.appendLoad=function(){return Promise.reject(_.nb)};
2
+ var f=function(window){var fP="An unknown error occurred while trying to get volume",gP="Cannot get loading rendition due to platform limitations",hP="PARAM_START_POSITION",iP="SecurityError",jP="The require privilege is: http://tizen.org/privilege/tv.audio",kP="onbufferingcomplete",lP="onbufferingprogress",mP="onbufferingstart",nP="oncurrentplaytime",oP="ondrmevent",pP="onerror",qP="onstreamcompleted",rP="onsubtitlechange",sP="preparingend",tP="preparingstart",uP="|STARTBITRATE\x3d",vP=function(a,b,c){function d(e){c.call(a,
3
+ e);a.removeEventListener(b,d)}a.addEventListener(b,d)},wP=function(a,b){this.h=a;this.o=null;this.a=_.Ze;this.l=null;this.j=!1;this.f=new Map;this.F=b;this.g=new _.M("clpp.tizen.DrmEngine")},zP=function(a){var b,c,d;return _.I(function(e){if(1==e.a){b=a.a===_.Md||a.a===_.Kd;if(!b)throw new _.O(_.P,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Ee)throw new _.O(_.P,6,6012,"No license server given for "+a.a);_.F(e,2);return a.a===_.Md?_.x(e,xP(a),
4
+ 5):_.x(e,yP(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.Ee,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Wg,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null},_.G(e,0);d=_.H(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.O(_.P,6,6005,{message:JSON.stringify(d)});})},yP=function(a,b){var c,d,e,f;return _.I(function(g){c=AP;d=BP;e={};e[d.Zj]=!b.Wg;e[d.ak]=b.Ee;""!==b.customData&&(e[d.Xj]=b.customData);
5
+ f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(k){throw k;}_.A(g)})},xP=function(a){var b;return _.I(function(c){b=AP;try{webapis.avplay.setDrm(b.ef,"Initialize",""),webapis.avplay.setDrm(b.ef,"widevine_app_session",a.l.id),webapis.avplay.setDrm(b.ef,"widevine_data_type",a.l.type)}catch(d){throw d;}_.A(c)})},CP=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,t,u,y,C,D,B;_.I(function(E){if(1==E.a){c=AP;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",
6
+ b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);k=b.serverurl&&""!==b.serverurl?b.serverurl:d.Ee;l=_.Zk([k],_.Vk());l.type=3;l.body=f.buffer;l.method=_.rb;_.F(E,2);return _.x(E,a.F.Kb.fetch(l).U,4)}if(2!=E.a){m=E.f;if(a.j){n=_.Qi(m.data);p=n.byteLength;q="";for(t=0;t<p;t++)q+=String.fromCharCode(n[t]);u=btoa(q);y=b.session_id+hP+(u+hP);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.ef,"widevine_license_data",y)}catch(z){a.g.error("License response rejected by CDM"),
7
+ C=new _.O(_.P,6,6008,{browserError:JSON.stringify(z)}),a.F.onError(C)}}return _.G(E,0)}D=_.H(E);a.g.error("License request failed.",JSON.stringify(D));B=new _.O(_.P,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(B);_.A(E)})},DP=function(a){this.m=a;this.a=this.m.a;this.f=_.du;this.j=7;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.h=2;this.g=new _.M("clpp.tizen.StateManager")},FP=
8
+ function(a,b){if(a.f!==b)if(a.f===_.Bo&&b!==_.du)a.g.debug(_.GB+EP(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;2===a.f?(a.o=(new Date).getTime(),a.m.trigger(new _.Q(_.dd,{detail:{bufferedTimeMS:-1,reason:a.h}}))):2===a.j&&a.m.trigger(new _.Q(_.cd,{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 _.Q(_.ig,{detail:d}));a.g.debug("State changed:",EP(a.j),"-\x3e",EP(a.f))}},EP=function(a){return Object.keys(_.ku)[a]},
9
+ IP=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case GP:c=3;break;case HP:c=4;break;default:a.m.isEnded()?c=5:a.g.debug("Inconsistent AVPlay playback state:",b)}FP(a,c)}},JP=function(){this.o=this.A=this.f=this.h=this.B=this.m=this.j=this.a=null;this.D=!1;this.w=!0;this.l=null;this.g=new _.M("clpp.tizen.TextStreamer")},KP=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},LP=function(a){var b,c;return _.I(function(d){if(1==d.a)return b=
10
+ a.m.getConfiguration(),c=null,_.x(d,_.Uv(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)})},MP=function(a){var b=document.createElement(_.Sg),c=new _.hF,d=new _.TC,e=a.m.getTextDisplayer();return new _.jF(b,c,e,d,a.m.getConfiguration())},NP=function(a){var b={configuration:{},Gb:function(){return a.m.getPosition()},Y:a.h,Kb:a.m.getNetworkEngine(),td:null,Mg:a.Gl.bind(a),ej:a.Fl.bind(a),onError:a.Hl.bind(a),fj:function(){},
11
+ onEvent:function(){},jj:a.Il.bind(a),Nf:function(){},ne:function(){return new _.XF},pg:function(){return!1},ge:null};return new _.DG(a.a,b)},OP=function(a){var b=a.m.getPosition(),c=null;a=_.v(a.a.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},PP=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=
12
+ c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.Zs(String(c++),_.at);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.dC;var f=new _.gt(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},QP=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.f){var b=_.GG(a.f,_.Cn),c=null;if(b){a=PP(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];
13
+ break}}return c}return null},RP=function(a,b){var c,d,e,f;_.I(function(g){if(1==g.a){c=_.XI;a.g.debug("Set active track",b);if(!b)return g.C(0);a.o=b.language;a.A=b.roles[0]||"";a.D=b.kind===c.yh;if(!a.a||!a.f)return g.C(0);a.setTextVisibility(!0);d=OP(a);e=b.renditions[0];f=d.textStreams.find(function(k){return String(k.id)===e.id});return f?a.w?(a.g.debug("Switching period defer text selection"),a.l=f,g.C(4)):_.x(g,_.$G(a.f,f),5):(a.g.error("No stream with id",e.id),g["return"]())}4!=g.a&&a.m.trigger(new _.Q(_.ug));
14
+ a.o=f.language;_.A(g)})},SP=function(){this.j=this.a=this.m=null;this.f={};this.g=new _.M("clpp.tizen.TrackManager");this.w=this.o=this.l=null;this.A=!1;this.h=1},TP=function(a,b){a.m.trigger(new _.Q(_.Wg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},UP=function(a){var b=a.sa();b&&a.m.trigger(new _.Q(_.ad,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},VP=function(a){var b=a.m.getConfiguration(),c=_.Ii(b.preferredAudioLanguage||
15
+ []),d=a.f[_.X]||[];if(d.length){var e=null;c.some(function(g){e=_.KC(g,d.map(function(k){return k.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),0<f.length&&(c=f[0]));a.g.debug("Setting audio track with preferred language:",e);a.La(c)}else a.g.debug("Preferred language(s) not available")}else a.g.debug("Could not set preferred audio language")},ZP=function(a,
16
+ b){if(b){var c=b.track.type.toUpperCase();WP(a.a,c,Number(b.id)).then(function(){c===XP&&(a.l=b,a.m.trigger(new _.Q(_.Zc)));c===YP&&(a.o=b,a.m.trigger(new _.Q(_.ug)))})["catch"](function(){a.g.error("Could not select "+c+" track.")})}else a.g.debug("Must provide valid rendition")},$P=function(a,b,c){var d=_.ro(b.language||_.Hg);c.language=_.$s(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Wc;a=new _.gt(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
17
+ b.bit_rate||null;return a},aQ=function(a,b,c){c.mimeType=_.Ug;a=new _.gt(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},bQ=function(a,b,c){b=_.ro(b.track_lang||_.Hg);c.mimeType="text/ttml";c.language=_.$s(b);c.originalLanguage=b;c.kind=_.dC;return new _.gt(String(a),c)},cQ=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},
18
+ fQ=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===dQ}),f=b.filter(function(n){return n.type===XP}),g=[],k=0;k<f.length;k++){var l=cQ(a,f[k].extra_info);if(l){var m=_.ro(l.language||_.Hg);m=_.$s(m);m=c(g,m);m||(m=new _.Zs(String(a.h++),_.X),g.push(m));m.renditions.push($P(f[k].index,l,m))}else a.g.warn("Skipping audio stream with no extra info")}f=new _.Zs(String(a.h++),
19
+ _.bt);for(k=0;k<e.length;k++)(l=cQ(a,e[k].extra_info))?f.renditions.push(aQ(e[k].index,l,f)):a.g.warn("Skipping video stream with no extra info");e=[];e=a.j?PP(a.j):eQ(a,b);d[_.bt]=[f];d[_.X]=g;d[_.at]=e;return d},eQ=function(a,b){for(var c=b.filter(function(k){return k.type===YP}),d=[],e=0;e<c.length;e++){var f=cQ(a,c[e].extra_info);if(f){var g=new _.Zs(String(a.h++),_.at);g.renditions.push(bQ(c[e].index,f,g));d.push(g)}else a.g.warn("Skipping text stream with no extra info")}return d},gQ=function(a,
20
+ b){for(var c=a.f[_.bt]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.N.ua(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},hQ=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===b){c=a[d].renditions[e];break}return c},jQ=function(a,b){if(b===_.at&&a.j)return QP(a.j);var c=iQ(a.a)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===
21
+ b.toUpperCase()})[0];var d=null;b===_.bt&&(d=cQ(a,c.extra_info),d=gQ(a,{width:d.Width,height:d.Height}));b===_.X&&(c?(d=hQ(a,c,_.X),a.l=d):d=a.l);b===_.at&&(c?(d=hQ(a,c,_.at),a.o=d):d=a.o);return d},kQ=function(a){_.Di.call(this);this.m=a;this.h=null;this.g=new _.M("clpp.tizen.Middleware");this.D=1;this.B=!1;this.l=null;this.G=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}},lQ=function(a){return _.I(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/
22
+ 1920;a.g.debug("Display resolution ratio: ",a.A)},function(c){a.g.debug("Could not load DISPLAY property");throw c;});_.A(b)})},mQ=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Al.bind(a),onbufferingprogress:a.zl.bind(a),onbufferingcomplete:a.yl.bind(a),onstreamcompleted:a.Dl.bind(a),oncurrentplaytime:function(b){a.trigger(new _.Q(nP,{currentTime:b}))},onevent:a.Cl.bind(a),onsubtitlechange:a.El.bind(a),ondrmevent:a.Bl.bind(a),onerror:a.ce.bind(a)})}catch(b){a.g.error(b)}},nQ=function(a){var b=
23
+ !!a.m.getTrackManager().gb();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.g.debug("Could not set AVPlay subtitle config",c)}},oQ=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.g.debug({estimatedBandwidth:c,Lp:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",uP+d)}catch(e){a.g.debug(e)}},pQ=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+uP+b)}catch(c){throw a.g.debug("Could not set fixed bandwidth",
24
+ c),c;}},sQ=function(a){return{position:a.getPosition(),state:a.m.getState(),Jh:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:qQ(a),volume:a.getVolume(),ep:rQ(a),Tl:iQ(a)}},uQ=function(a){var b,c;return _.I(function(d){if(1==d.a)return _.x(d,tQ(),2);if(3!=d.a)return b=new Promise(function(e){(new _.gj(e)).ia(5)}),_.x(d,Promise.race([lQ(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"),
25
+ d["return"](Promise.reject("SDK Timeout"));_.A(d)})},xQ=function(a,b,c){var d,e,f,g,k,l,m,n;return _.I(function(p){switch(p.a){case 1:a.l=_.Rn(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 _.Q(mP)),f=c.currentPosition);_.F(p,2);g=a.l[d].url;k=a.l[d].type;k!==_.Lc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);
26
+ e.nextBandwidth?(pQ(a,e.nextBandwidth),a.o=!1):(a.o||oQ(a,e),a.o=!0);mQ(a);if(!b.drm||!b.drm.env){a.g.debug("No DRM configuration was provided. Assuming clear content");p.C(4);break}m={onError:function(q){return a.m.onError(q)},Kb:a.m.getNetworkEngine()};a.h=new wP(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.f||a.trigger(new _.Q(tP)),_.x(p,vQ(a),6);case 6:a.f||a.trigger(new _.Q(sP));f&&typeof f===_.h&&0<f&&a.seek(f)["catch"](function(q){a.g.debug("Couldn't set start position",q)});a.f||(b.volume&&
27
+ a.setVolume(b.volume),b.muted&&wQ(a,b.muted),b.autoplay&&a.m.play()["catch"](function(q){a.g.debug("Autoplay failed",q)}));_.G(p,0);break;case 2:throw n=_.H(p),a.g.debug("Error while attempting to load source."),n;}})},vQ=function(a){return _.I(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!");nQ(a);c()},function(e){a.g.debug("prepareAsync failed",e);d(e)})}catch(e){a.g.debug("Failed to prepare media player for playback"),
28
+ d(e)}}))})},yQ=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=sQ(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(function(){var e=a.a.Jh;a.f=!1;a.a=null;return e===HP?a.pause():a.play()})}catch(e){return Promise.reject(e)}},rQ=function(a){return a.f&&a.a?a.a.ep:webapis.avplay.getTotalTrackInfo()},
29
+ iQ=function(a){return a.f&&a.a?a.a.Tl:webapis.avplay.getCurrentStreamInfo()},WP=function(a,b,c){b=b.toUpperCase();b===YP&&zQ(a,!0);var d=a.j[b];d&&(d.Yf.stop(),a.j[b]=null,a.g.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(k,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(k,l),a.j[k]=null,e()}catch(n){a.g.debug("Could not set "+k+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[k]={type:k,index:l,Fh:0,
30
+ Yf:new _.gj(function(){return g(k,c,!0)})}),(l=a.j[k])&&3>l.Fh?(a.w||++l.Fh,l.Yf.ia(a.w?.5:.25)):(a.g.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Yf.stop(),a.j[k]=null,f())}}g(b,c)})},zQ=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",d)}},wQ=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case iP:a.g.warn("The application does not have the privilege to set mute.",
31
+ jP);break;default:a.g.warn(fP,c)}}},qQ=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case iP:a.g.warn("The application doesn't have the privilege to get the mute state.",jP);break;default:a.g.warn(fP,c)}}return!!b},tQ=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");vP(c,_.Je,function(d){return a(d)});vP(c,_.qe,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},
32
+ AQ=function(){_.Di.call(this);this.a=new kQ(this);this.f=new DP(this);this.configuration=this.B=_.Ln();this.w=null;this.g=new _.M("clpp.tizen.Player");this.j=null;this.l=new SP;this.D=new _.Xm;this.o=this.h=null;this.A=!1},BQ=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.g.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,
33
+ 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())},CQ=function(){},DQ=function(){};
34
+ wP.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.I(function(k){if(1==k.a){b=_.Un[a.h.env]||null;if(!b)throw a.g.debug(_.Ca,_.wb+a.h.env+_.aa),new _.O(_.P,6,6015,_.Da+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=_.Wn(b,a.h.customData);(e=d[_.Kd])&&a.f.set(_.Kd,{Ee:e.licenseUrl||"",customData:c,Wg:!1});(f=d[_.Md])&&a.f.set(_.Md,{Ee:f.licenseUrl||"",customData:c,
35
+ Wg:!1});if(0===a.f.size)throw new _.O(_.P,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Kd))a.a=_.Kd;else if(a.f.get(_.Md))a.a=_.Md;else throw new _.O(_.P,6,6001,"Configuration for the target system is missing.");return _.x(k,zP(a),2)}a.j=!0;_.A(k)})};wP.prototype.release=function(){var a=this;return _.I(function(b){a.j=!1;a.o=null;a.a=_.Ze;a.l=null;a.f=new Map;_.A(b)})};wP.prototype.getDrmInfo=function(){return this.o};
36
+ var BP={Zj:"DeleteLicenseAfterUse",ak:"LicenseServer",wp:"GetChallenge",xp:"HttpHeader",zp:"UserAgent",tp:"Cookie",Xj:"CustomData"};_.r=DP.prototype;_.r.initialize=function(){this.a.on(mP,this.ai,this);this.a.on(lP,this.$h,this);this.a.on(kP,this.Zh,this);this.a.on(tP,this.lj,this);this.a.on(sP,this.kj,this);this.a.on(qP,this.bi,this)};_.r.release=function(){FP(this,_.du);this.l=!1;this.o=-1;this.h=2};_.r.destroy=function(){this.release();this.a.off(mP,this.ai);this.a.off(lP,this.$h);this.a.off(kP,this.Zh);this.a.off(tP,this.lj);this.a.off(sP,this.kj);this.a.off(qP,this.bi);this.m=this.a=null};
37
+ _.r.ai=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;FP(this,2)};_.r.$h=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",EP(this.f))};_.r.Zh=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()===EQ;if(!a&&b){FP(this,4);return}}if(a=1!==this.f)a=this.a.getState(),a=a===GP||a===HP;a&&IP(this)};
38
+ _.r.lj=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===FQ?FP(this,1):this.g.error("AVPlay prepares while state is not IDLE")};_.r.kj=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.r.bi=function(){FP(this,5)};_.r.getState=function(){return this.f};_.r=JP.prototype;_.r.initialize=function(a){this.m=a};
39
+ _.r.load=function(a){var b=this,c,d,e,f,g,k,l;return _.I(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,LP(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(){},
40
+ onEvent:function(){},onError:function(){}};_.F(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.a=m.f;_.G(m,4);break;case 3:return f=_.H(m),b.g.warn(f),_.F(m,6),g=b,_.x(m,b.j.start(a.url.replace(_.ze,"http://"),d),8);case 8:g.a=m.f;_.G(m,4);break;case 6:k=_.H(m),b.g.error(k),b.a=null;case 4:if(!b.a||!KP(b.a)){m.C(0);break}b.h=MP(b);_.F(m,10);return _.x(m,b.h.open(),12);case 12:b.f=NP(b);l=b.m.getConfiguration();b.f.h=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;b.D=l.preferForcedSubtitles;
41
+ _.G(m,0);break;case 10:_.H(m),b.g.debug("Could not setup media source..."),b.h=null,b.f=null,b.j=null,b.a=null,_.A(m)}})};_.r.Gl=function(a){this.g.debug(_.YB,a.id);this.w=!0;var b=_.WF(a.textStreams,this.o||"",this.A||"",this.D)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{video:null,audio:null,text:b,ob:null}};_.r.Fl=function(){var a=this;return _.I(function(b){if(1==b.a)return a.g.debug("canSwitch_"),a.w=!1,a.l?_.x(b,_.$G(a.f,a.l),3):b.C(0);a.l=null;_.A(b)})};
42
+ _.r.Hl=function(){this.g.debug("onError_")};_.r.Il=function(){this.j&&this.j.update&&this.j.update()};_.r.start=function(){var a=this;return _.I(function(b){if(!a.f)return b["return"]();try{a.f.start()}catch(c){a.g.error("Error while starting streaming engine",c)}_.A(b)})};_.r.setTextVisibility=function(a){this.g.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};
43
+ _.r.release=function(){var a=this;return _.I(function(b){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null;_.A(b)})};_.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.j){b.C(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.f){b.C(4);break}return _.x(b,a.f.destroy(),5);case 5:a.f=null,a.w=!0;case 4:if(!a.h){b.C(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.A(b)}})};_.w(SP,_.wt);_.r=SP.prototype;_.r.cj=function(a){var b=a.eventid;a=a.data;switch(b){case GQ:0<Object.keys(this.f).length||(this.g.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+cQ(this,b[0].extra_info).Bit_rate,b=gQ(this,{bandwidth:b}))&&(this.w=b,TP(this,b));break;case HQ:UP(this);break;default:this.g.debug("Event type: "+b+" data: "+a)}};_.r.Qg=function(a){3===a.detail.currentState&&this.m.off(_.ig,this.Qg)};
44
+ _.r.initialize=function(a){var b=this;this.m=a;this.a=this.m.a;this.m.on(_.ig,function(c){b.A||(c=c.detail,3===c.currentState&&(b.g.debug("Current state",c.currentState),b.A=!0,VP(b)))});this.a.on("onevent",this.cj,this)};_.r.release=function(){this.f={};this.j=this.w=this.o=this.l=null;this.A=!1;this.h=1};
45
+ _.r.load=function(){if(this.a&&!(0<Object.keys(this.f).length)){this.j=this.m.h;this.m.off(_.ig,this.Qg);this.m.on(_.ig,this.Qg,this);try{var a=rQ(this.a);this.f=fQ(this,a);var b=this.f[_.X]||[];b.length&&(this.l=b[0].renditions[0]||null);UP(this)}catch(c){this.g.debug("Could not load track manager")}}};_.r.destroy=function(){this.a.off("onevent",this.cj);this.a=this.m=null};_.r.getVideoTracks=function(){return this.f[_.bt]||[]};_.r.getAudioTracks=function(){return this.f[_.X]||[]};
46
+ _.r.ra=function(){return this.f[_.at]||[]};_.r.sa=function(){return jQ(this,_.bt)};_.r.Za=function(){return jQ(this,_.X)};_.r.gb=function(){return jQ(this,_.at)};_.r.Fb=function(){return this.w};_.r.Ub=function(){this.g.info(gP);return null};_.r.Vb=function(){this.g.info(gP);return null};_.r.Qa=function(){var a=this.sa();return a?a.track:null};_.r.qa=function(){var a=this.Za();return a?a.track:null};_.r.xa=function(){var a=this.gb();return a?a.track:null};
47
+ _.r.Ob=function(a){var b=this;null===a?(a=this.sa(),yQ(this.a,a.bandwidth,null).then(function(){UP(b)})):0<a.renditions.length&&this.Bb(a.renditions[0])};_.r.La=function(a){a?ZP(this,a.renditions[0]):this.g.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.r.ib=function(a){a?(a=a.renditions[0],this.j?RP(this.j,a.track):ZP(this,a)):(this.g.debug("Disabling text tracks"),this.o=null,zQ(this.a,!1),this.m.trigger(new _.Q(_.ug)))};
48
+ _.r.Bb=function(a){var b=this,c=this.sa();this.a.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,TP(this,a),yQ(this.a,c.bandwidth,a.bandwidth).then(function(){UP(b)})["catch"](function(d){var e=new _.O(_.P,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.Mb=function(a){ZP(this,a)};_.r.Nb=function(a){this.j?RP(this.j,a.track):ZP(this,a)};
49
+ _.r.addTextTrack=function(){};_.r.ya=function(){return this.a.o};SP.prototype.isAbrEnabled=SP.prototype.ya;SP.prototype.addTextTrack=SP.prototype.addTextTrack;SP.prototype.setTextRendition=SP.prototype.Nb;SP.prototype.setAudioRendition=SP.prototype.Mb;SP.prototype.setVideoRendition=SP.prototype.Bb;SP.prototype.setTextTrack=SP.prototype.ib;SP.prototype.setAudioTrack=SP.prototype.La;SP.prototype.setVideoTrack=SP.prototype.Ob;SP.prototype.getTextTrack=SP.prototype.xa;SP.prototype.getAudioTrack=SP.prototype.qa;
50
+ SP.prototype.getVideoTrack=SP.prototype.Qa;SP.prototype.getLoadingTextRendition=SP.prototype.Vb;SP.prototype.getLoadingAudioRendition=SP.prototype.Ub;SP.prototype.getLoadingVideoRendition=SP.prototype.Fb;SP.prototype.getTextRendition=SP.prototype.gb;SP.prototype.getAudioRendition=SP.prototype.Za;SP.prototype.getVideoRendition=SP.prototype.sa;SP.prototype.getTextTracks=SP.prototype.ra;SP.prototype.getAudioTracks=SP.prototype.getAudioTracks;SP.prototype.getVideoTracks=SP.prototype.getVideoTracks;_.w(kQ,_.Di);_.r=kQ.prototype;_.r.Al=function(){this.w=!0;this.f||this.trigger(new _.Q(mP))};_.r.zl=function(a){this.w=!0;this.trigger(new _.Q(lP,{percent:a}))};_.r.yl=function(){this.w=!1;this.trigger(new _.Q(kP))};_.r.Dl=function(){this.trigger(new _.Q(qP))};_.r.Cl=function(a,b){this.trigger(new _.Q("onevent",{eventid:a,data:b}))};_.r.El=function(a,b,c,d,e){this.trigger(new _.Q(rP,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
51
+ _.r.Bl=function(a,b){this.trigger(new _.Q(oP,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Md&&"Challenge"===b.name)CP(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.O(_.P,6,6005,{message:JSON.stringify(b)});c.F.onError(d)}}};_.r.ce=function(a){this.trigger(new _.Q(pP,{eventType:a}))};
52
+ _.r.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(nP,f,b);g=setTimeout(function(){b.off(nP,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===FQ)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){nQ(b);d(webapis.avplay.play())},function(f){b.trigger(new _.Q(pP));e(f)})})).then(function(){return a()});if(c===HP||c===EQ)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===GP?
53
+ Promise.resolve():Promise.reject("Player is in invalid state")};_.r.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===HP?Promise.resolve():Promise.reject()};
54
+ _.r.setPlaybackRate=function(a){var b=this.getState();if(b===EQ||b===GP||b===HP){try{webapis.avplay.setSpeed(a),this.D=a}catch(c){return this.g.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.D)}return!0}this.g.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.r.getPlaybackRate=function(){return this.D};
55
+ _.r.load=function(a,b){var c=this,d;return _.I(function(e){switch(e.a){case 1:return c.g.debug("configure()",b||""),_.F(e,2),_.x(e,uQ(c),4);case 4:return _.x(e,xQ(c,a,b),5);case 5:_.G(e,0);break;case 2:throw d=_.H(e),new _.O(_.P,7,7003,null,d);}})};_.r.getState=function(){if(this.f&&this.a)return this.a.Jh;try{return webapis.avplay.getState()}catch(a){this.ce(JSON.stringify(a))}};
56
+ _.r.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.m.trigger(new _.Q(_.Ng));webapis.avplay.seekTo(c,function(){b.B=!1;b.m.trigger(new _.Q(_.Mg));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.ce(JSON.stringify(a))}};_.r.getDuration=function(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.ce(JSON.stringify(a))}};
57
+ _.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.Yf.stop()}a.j={};a.D=1;a.B=!1;a.l=null;a.a=null;return b()}catch(f){return c(f)}})};_.r.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case iP:this.g.debug("The application does not have the privilege to get the volume.",jP);break;default:this.g.debug(fP,b)}}return a};
58
+ _.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 iP:this.g.warn("The application does not have the privilege to set the volume.",jP);break;default:this.g.warn("An unknown error occurred while trying to set volume",b)}}};
59
+ _.r.isLive=function(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.ce(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()]};
60
+ var FQ="IDLE",EQ="READY",GP="PLAYING",HP="PAUSED",dQ=_.Tb,XP=_.ja,YP="TEXT",HQ="PLAYER_MSG_RESOLUTION_CHANGED",GQ="PLAYER_MSG_BITRATE_CHANGE",AP={PLAYREADY:"PLAYREADY",up:"EME_PLAYREADY",Ap:"VERIMATRIX",ef:"WIDEVINE_CDM",vp:"EME_WIDEVINE_CDM",Cp:"WIDEVINE_CLASSIC"};_.w(AQ,_.Di);_.r=AQ.prototype;_.r.Xh=function(){var a=this;this.g.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.Q(_.pe));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.g.debug("Could not loop playback")}):this.a.stop()};_.r.Uh=function(a){this.trigger(new _.Q(_.zg,{currentTime:a.currentTime/1E3}))};
61
+ _.r.Yh=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.g.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.R.jh(d))&&this.o.append([new _.Fp(b,c,d)],[])};_.r.Vh=function(a){this.g.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.r.dj=function(){this.A||(this.g.debug("Initial buffering completed..."),this.A=!0)};
62
+ _.r.Wh=function(a){this.g.debug("Error: TYPE: "+a.eventType);FP(this.f,_.Bo);a=new _.O(_.P,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.Q(_.qe,{detail:a}))};
63
+ _.r.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(qP,this.Xh,this);this.a.on(nP,this.Uh,this);this.a.on(rP,this.Yh,this);this.a.on(oP,this.Vh,this);this.a.on(pP,this.Wh,this);this.a.on(kP,this.dj,this);this.f.initialize();this.l.initialize(this);this.g.debug("Initializing player surface");this.w.hideMediaElement();var c=IQ;IQ+=1;this.j=_.Yi(_.$e,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
64
+ var e=[_.gh,_.ve,"position",_.De,"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=_.v(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.$i(c,f);BQ(this)}};_.r.getSurface=function(){return this.w};_.r.getConfiguration=function(){return this.configuration};_.r.getTimeline=function(){return null};_.r.setupPlaylist=function(){return Promise.reject(_.nb)};_.r.appendLoad=function(){return Promise.reject(_.nb)};
65
65
  _.r.seekWith=function(){return Promise.reject(_.nb)};_.r.setSeekInterceptor=function(){};_.r.setPlaybackSessionId=function(){};_.r.getBandwidthEstimate=function(){return null};
66
- _.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(sP,a.Th);a.a.off(pP,a.Qh);a.a.off(tP,a.Uh);a.a.off(qP,a.Rh);a.a.off(rP,a.Sh);a.a.off(mP,a.aj);if(!a.h){b.C(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,_.z(b)}})};_.r.namespace=function(){return LQ};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
67
- _.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:5===this.f.getState()?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()};
68
- _.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(_.xa);return new _.gi};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
69
- _.r.release=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.h){b.C(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.C(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,_.z(b)}})};
70
- _.r.load=function(a){var b=this,c,d,e,f,g;return _.I(function(h){switch(h.a){case 1:b.configuration=_.On([b.B,a]);c=_.Wt(b.configuration,[_.ye,"native"]);b.o=c.create(b);d=_.Sn(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.C(2);break}b.h=new LP;b.h.initialize(b);_.F(h,3);return _.x(h,b.h.load(d),5);case 5:b.h.start();_.G(h,2);break;case 3:f=_.H(h),b.g.error(f);case 2:return _.F(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.G(h,7);break;case 6:throw g=
71
- _.H(h),b.onError(g),g;case 7:b.l.load(),_.z(h)}})};_.r.play=function(){var a=this;this.trigger(new _.Q(_.pf));DQ(this);return this.a.play().then(function(){KP(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){KP(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.Q(_.qe,{detail:a});a.severity===_.P&&(HP(this.f,_.Co),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
72
- _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return 5===this.f.getState()};_.r.isPaused=function(){return this.a.getState()===JP};_.r.isMuted=function(){return sQ(this.a)};_.r.setMuted=function(a){yQ(this.a,a)};_.r.getNetworkEngine=function(){return this.F};_.r.setNetworkEngine=function(a){this.F=a};_.r.setCmsdManager=function(){};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};
73
- _.r.getSourceIndex=function(){return this.a.getSourceIndex()};_.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new EQ).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var LQ="clpp.tizen",KQ=0;EQ.prototype.a=function(){return LQ};
74
- EQ.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Lc||a===_.Yl||a===_.Qc)&&b){if(_.lj(2))return 2;if(_.lj(3)||_.lj(4)||_.lj(5)||_.lj(6))return _.Qh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};EQ.prototype.f=function(a){return a===_.ra};EQ.prototype.create=function(){return new CQ};_.w(FQ,_.bv);FQ.prototype.install=function(){_.$h(new EQ)};FQ.prototype.uninstall=function(){var a=LQ;a&&_.Yh[a]&&(delete _.Yh[a],_.Zh.info("Removed Player factory: '"+a+"'"))};FQ.prototype.id=function(){return"tizen"};_.K("clpp.tizen.TizenComponent",FQ);};
66
+ _.r.destroy=function(){var a=this;return _.I(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(qP,a.Xh);a.a.off(nP,a.Uh);a.a.off(rP,a.Yh);a.a.off(oP,a.Vh);a.a.off(pP,a.Wh);a.a.off(kP,a.dj);if(!a.h){b.C(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,_.A(b)}})};_.r.namespace=function(){return JQ};_.r.getPlaybackRate=function(){return this.a.getPlaybackRate()};
67
+ _.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:5===this.f.getState()?this.getDuration():this.a.getPosition()||0};_.r.seek=function(a){return typeof a===_.h&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};
68
+ _.r.getPresentationStartTime=function(){return null};_.r.getSeekRange=function(){return{start:0,end:0}};_.r.getVolume=function(){var a=this.a.getVolume();return typeof a===_.h?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(_.xa);return new _.gi};_.r.getTrackManager=function(){return this.l};_.r.unload=function(){var a=this;return this.a.release().then(function(){a.l.release()})};
69
+ _.r.release=function(){var a=this;return _.I(function(b){switch(b.a){case 1:if(!a.h){b.C(2);break}return _.x(b,a.h.release(),2);case 2:if(!a.o){b.C(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,_.A(b)}})};
70
+ _.r.load=function(a){var b=this,c,d,e,f,g;return _.I(function(k){switch(k.a){case 1:b.configuration=_.Nn([b.B,a]);c=_.Vt(b.configuration,[_.ye,"native"]);b.o=c.create(b);d=_.Rn(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){k.C(2);break}b.h=new JP;b.h.initialize(b);_.F(k,3);return _.x(k,b.h.load(d),5);case 5:b.h.start();_.G(k,2);break;case 3:f=_.H(k),b.g.error(f);case 2:return _.F(k,6),_.x(k,b.a.load(b.configuration),8);case 8:_.G(k,7);break;case 6:throw g=
71
+ _.H(k),b.onError(g),g;case 7:b.l.load(),_.A(k)}})};_.r.play=function(){var a=this;this.trigger(new _.Q(_.pf));BQ(this);return this.a.play().then(function(){IP(a.f)})};_.r.pause=function(){var a=this;return this.a.pause().then(function(){IP(a.f)})};_.r.getState=function(){return this.f.getState()};_.r.getPeriods=function(){return[]};_.r.onError=function(a){var b=new _.Q(_.qe,{detail:a});a.severity===_.P&&(FP(this.f,_.Bo),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
72
+ _.r.getDrmInfo=function(){return this.a.getDrmInfo()};_.r.isEnded=function(){return 5===this.f.getState()};_.r.isPaused=function(){return this.a.getState()===HP};_.r.isMuted=function(){return qQ(this.a)};_.r.setMuted=function(a){wQ(this.a,a)};_.r.getNetworkEngine=function(){return this.D};_.r.setNetworkEngine=function(a){this.D=a};_.r.setCmsdManager=function(){};_.r.isLive=function(){return this.a.isLive()};_.r.getStats=function(){return null};_.r.setSourceIndex=function(a){this.a.setSourceIndex(a)};
73
+ _.r.getSourceIndex=function(){return this.a.getSourceIndex()};_.r.getLoadedSource=function(){return this.a.getLoadedSource()};_.r.canPlay=function(a,b){return(new CQ).canPlay(a,b)};_.r.getTimelineCues=function(){return[]};_.r.getCueTimeline=function(){return null};_.r.getTextDisplayer=function(){return this.o};_.r.resetAbr=function(){};var JQ="clpp.tizen",IQ=0;CQ.prototype.a=function(){return JQ};
74
+ CQ.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Lc||a===_.Xl||a===_.Qc)&&b){if(_.lj(2))return 2;if(_.lj(3)||_.lj(4)||_.lj(5)||_.lj(6))return _.Qh("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};CQ.prototype.f=function(a){return a===_.pa};CQ.prototype.create=function(){return new AQ};_.w(DQ,_.av);DQ.prototype.install=function(){_.$h(new CQ)};DQ.prototype.uninstall=function(){var a=JQ;a&&_.Yh[a]&&(delete _.Yh[a],_.Zh.info("Removed Player factory: '"+a+"'"))};DQ.prototype.id=function(){return"tizen"};_.K("clpp.tizen.TizenComponent",DQ);};
75
75
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
76
76
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
77
77
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ttml.js CHANGED
@@ -1,33 +1,33 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
2
  var f=function(window){var zy='application/mp4; codecs\x3d"stpp.ttml"',Ay='application/mp4; codecs\x3d"stpp.ttml.im1i"',By='application/mp4; codecs\x3d"stpp.ttml.im1t"',Cy="backgroundColor",Dy="direction",Ey="displayAlign",Fy="region",Gy="sans-serif",Hy="textAlign",Iy="textDecoration",Jy="writingMode",Ky=function(a,b,c){this.h=a;this.f=b;this.a=c},Ly=function(a,b,c){Ky.call(this,a,[],c);this.j=b||""},My=function(a,b,c){Ky.call(this,a,b,c)},Ny=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
  Vy=function(a,b){var c=null;if(Oy.test(a)){c=Oy.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 Py.test(a)?c=Qy(Py,a):Ry.test(a)?c=Qy(Ry,a):Sy.test(a)?(c=Sy.exec(a),c=Number(c[1])/b.frameRate):Ty.test(a)?(c=Ty.exec(a),c=Number(c[1])/b.a):Uy.test(a)&&(c=Qy(Uy,a));return c},Qy=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
- 0)},Wy=function(a){return a.split(":").pop()},Xy=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},Zy=function(a,b){for(;Yy.test(a);){var c=Yy.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},$y=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},az=function(a,b,c,d,e,f,g){Ky.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},bz=function(a,b,c){a=Ny(a,b,Hy);if(!a&&c&&(a=Ny(c,b,Hy),!a&&"rltb"===Ny(c,b,Jy)))return _.oe;switch(a){case _.od:return _.Ap;
5
- case _.Uf:case _.oe:return _.oe;default:return _.hg}},cz=function(a,b,c){if(_.R.Ef(a.w))return document.createTextNode(_.R.fh(a.w||""));if(a.A)return _.Yi("br");for(var d=_.Yi("span"),e=_.v(a.f),f=e.next();!f.done;f=e.next())_.Zi(d,f.value);a=_.v(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(cz(c.get(e.value),b,c));return d},dz=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
- (this.frameRate*=Number(a[1])/Number(a[2]))},ez=function(a,b,c){Ky.call(this,a,b,c)},hz=function(a,b,c,d){var e=fz.exec(a);a=gz.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},iz=function(a,b){return typeof b===_.k&&0<b?_.Gp:gz.test(a)?0:_.Gp},jz=function(a,b){Ky.call(this,"root-container",[],b);this.j=a},kz=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},lz=function(a,b){var c=a.getAttribute("extent");return(c=gz.exec(c))?Number(c[b]):null},nz=
4
+ 0)},Wy=function(a){return a.split(":").pop()},Xy=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},Zy=function(a,b){for(;Yy.test(a);){var c=Yy.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},$y=function(a){return a?a.replace(/(\d*\.?\d+)%/g,function(b,c){return c/100+"em"}):""},az=function(a,b,c,d,e,f,g){Ky.call(this,a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]},bz=function(a,b,c){a=Ny(a,b,Hy);if(!a&&c&&(a=Ny(c,b,Hy),!a&&"rltb"===Ny(c,b,Jy)))return _.oe;switch(a){case _.md:return _.Ap;
5
+ case _.Uf:case _.oe:return _.oe;default:return _.hg}},cz=function(a,b,c){if(_.R.If(a.w))return document.createTextNode(_.R.jh(a.w||""));if(a.A)return _.Yi("br");for(var d=_.Yi("span"),e=_.v(a.f),f=e.next();!f.done;f=e.next())_.Zi(d,f.value);a=_.v(a.j);for(e=a.next();!e.done;e=a.next())d.appendChild(cz(c.get(e.value),b,c));return d},dz=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
+ (this.frameRate*=Number(a[1])/Number(a[2]))},ez=function(a,b,c){Ky.call(this,a,b,c)},hz=function(a,b,c,d){var e=fz.exec(a);a=gz.exec(a);return typeof b===_.h&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},iz=function(a,b){return typeof b===_.h&&0<b?_.Gp:gz.test(a)?0:_.Gp},jz=function(a,b){Ky.call(this,"root-container",[],b);this.j=a},kz=function(a,b,c){return typeof a===_.h?a:typeof b===_.h?b:c},lz=function(a,b){var c=a.getAttribute("extent");return(c=gz.exec(c))?Number(c[b]):null},nz=
7
7
  function(a){a=a.getAttribute("cellResolution");return(a=mz.exec(a))?Number(a[2]):null},oz=function(a,b,c){Ky.call(this,a,b,c)},pz=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=[]},rz=function(a){return qz.some(function(b){return b in a.attributes})},sz=function(a,b){if(0===b.length)return[];for(var c=[],d=_.v(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.ph(sz(a,a.a.get(e).f)).concat([e]));return c},uz=
8
- function(){return"inline-"+tz++},vz=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})},wz=function(a){this.a=a.firstChild;this.f=new Set},xz=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},yz=function(a){return Wy(a.h.nodeName)},zz=function(){this.a=new Map},Bz=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=
9
- _.ph(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.ph(l.f).concat(),g={},Az.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Fy)&&(c=b.getAttribute(Fy));b.hasAttribute(_.ng)&&f.push.apply(f,_.ph(b.getAttribute(_.ng).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.v(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=Wy(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new xz(b,
10
- c,d,e,f,g);a.a.set(b,c);return c},Cz=function(a){this.a=a;this.f=new DOMParser},Dz=function(a){this.f=a},Ez=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Fz=function(){},Gz=function(a){this.a=new Cz(a);this.g=new _.L("clpp.ttml.Mp4TtmlParser")},Hz=function(){this.a=new Fz};Ky.prototype.getId=function(){return this.h};
8
+ function(){return"inline-"+tz++},vz=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})},wz=function(a){this.a=a.firstChild;this.f=new Set},xz=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},yz=function(a){return Wy(a.h.nodeName)},zz=function(){this.a=new Map},Bz=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},k=b.parentNode;if(k&&a.a.has(k)){var l=a.a.get(k);e=
9
+ _.ph(l.l).concat();-1===[_.da,"span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.j,f=_.ph(l.f).concat(),g={},Az.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Fy)&&(c=b.getAttribute(Fy));b.hasAttribute(_.ng)&&f.push.apply(f,_.ph(b.getAttribute(_.ng).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.v(d);for(k=d.next();!k.done;k=d.next()){k=k.value;var m=Wy(k);g[m]=b.getAttribute(k)}d=g.backgroundImage}c=new xz(b,
10
+ c,d,e,f,g);a.a.set(b,c);return c},Cz=function(a){this.a=a;this.f=new DOMParser},Dz=function(a){this.f=a},Ez=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Fz=function(){},Gz=function(a){this.a=new Cz(a);this.g=new _.M("clpp.ttml.Mp4TtmlParser")},Hz=function(){this.a=new Fz};Ky.prototype.getId=function(){return this.h};
11
11
  Ky.prototype.hasAttribute=function(a){return a in this.a};Ky.prototype.getAttribute=function(a){return this.a[a]};_.w(Ly,Ky);_.w(My,Ky);var Oy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Py=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Ry=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Sy=/^(\d*(?:\.\d*)?)f$/,Ty=/^(\d*(?:\.\d*)?)t$/,Uy=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,fz=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,gz=/^(\d+)px (\d+)px$/,mz=/^(\d+) (\d+)$/,Yy=/(\d+)px/,Iz=/^(\d+px|\d+em|\d*\.?\d+c)$/,qz=[Cy,"color",Dy,Ey,"fontFamily","fontSize","fontStyle","fontWeight",
12
12
  "lineHeight","opacity","padding",Hy,Iy,"textOutline",Jy,"zIndex"],Az=["begin",_.oe];_.w(az,My);
13
- az.prototype.build=function(a,b,c,d,e,f,g){var h=Vy(this.a.begin,b);b=Vy(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Yi(_.Xd);for(var l=_.v(this.j),m=l.next();!m.done;m=l.next())c.appendChild(cz(g.get(m.value),e,g));g=new _.Fp(h,b,c.innerHTML.trim(),_.Eg);g.cssClassList=_.ph(this.f).concat();g.textAlign=bz(this,e,null);g.writingMode=_.Bp;g.line=-1;g.lineInterpretation=_.Cp;g.lineAlign=_.Dp;g.containerRows=kz(null,nz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
- bz(this,e,f);a:switch(Ny(f,e,Jy)){case "tb":case "tblr":a=_.Qg;break a;case "tbrl":a=_.Rg;break a;default:a=_.Bp}g.writingMode=a;a:switch(Ny(f,e,Ey)){case _.od:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Ny(f,e,Ey)){case _.od:a=1;break a;default:a=_.Cp}g.lineInterpretation=a;a:switch(Ny(f,e,Ey)){case _.od:e=_.od;break a;default:e=_.Dp}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
13
+ az.prototype.build=function(a,b,c,d,e,f,g){var k=Vy(this.a.begin,b);b=Vy(this.a.end,b);if(null===k||null===b)return null;k+=c;b+=c;c=_.Yi(_.Xd);for(var l=_.v(this.j),m=l.next();!m.done;m=l.next())c.appendChild(cz(g.get(m.value),e,g));g=new _.Fp(k,b,c.innerHTML.trim(),_.Cg);g.cssClassList=_.ph(this.f).concat();g.textAlign=bz(this,e,null);g.writingMode=_.Bp;g.line=-1;g.lineInterpretation=_.Cp;g.lineAlign=_.Dp;g.containerRows=kz(null,nz(a),15);if(this.o&&(f=f.get(this.o))){g.region=f.build(a,e);g.textAlign=
14
+ bz(this,e,f);a:switch(Ny(f,e,Jy)){case "tb":case "tblr":a=_.Qg;break a;case "tbrl":a=_.Rg;break a;default:a=_.Bp}g.writingMode=a;a:switch(Ny(f,e,Ey)){case _.md:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Ny(f,e,Ey)){case _.md:a=1;break a;default:a=_.Cp}g.lineInterpretation=a;a:switch(Ny(f,e,Ey)){case _.md:e=_.md;break a;default:e=_.Dp}g.lineAlign=e}this.l&&(a=d.get(this.l))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.j.trim(),
15
15
  g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.w(ez,My);
16
- ez.prototype.build=function(a,b){var c=new _.Ip;c.id=this.getId();var d=kz(a.j.containerWidth,lz(a,1),720),e=kz(a.j.containerHeight,lz(a,2),480);a:switch(Ny(this,b,Ey)){case "after":var f="flex-start";break a;case _.od:f=_.od;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Ny(this,b,Jy)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Gd}c.writingMode=f;f=this.getAttribute("extent")||Ny(this,b,"extent");c.width=hz(f,d,1,100);c.widthUnits=iz(f,d);c.height=
16
+ ez.prototype.build=function(a,b){var c=new _.Ip;c.id=this.getId();var d=kz(a.j.containerWidth,lz(a,1),720),e=kz(a.j.containerHeight,lz(a,2),480);a:switch(Ny(this,b,Ey)){case "after":var f="flex-start";break a;case _.md:f=_.md;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Ny(this,b,Jy)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Gd}c.writingMode=f;f=this.getAttribute("extent")||Ny(this,b,"extent");c.width=hz(f,d,1,100);c.widthUnits=iz(f,d);c.height=
17
17
  hz(f,e,2,100);c.heightUnits=iz(f,e);f=this.getAttribute("origin")||Ny(this,b,"origin");c.viewportAnchorX=hz(f,d,1,0);c.viewportAnchorY=hz(f,e,2,0);c.viewportAnchorUnits=iz(f,d);c.cssClassList=_.ph(this.f).concat();return c};_.w(jz,Ky);_.w(oz,Ky);
18
18
  oz.prototype.build=function(a){var b=null;var c=nz(a);c&&(b=kz(a.j.containerHeight,lz(a,2),480)/c);b=kz(a.j.fontSizeRadix,b,16);a=[];c="::ttml ."+this.h+", ::ttml ."+this.h+" * {";for(var d=_.v(Jz.entries()),e=d.next();!e.done;e=d.next()){var f=_.v(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+Xy(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
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&&!Iz.test(g)&&Iz.test(h)&&Iz.test(l)?(e=g,f=h):2===d.length&&!Iz.test(g)&&Iz.test(h)?(e=g,f=h):2===d.length&&Iz.test(g)&&Iz.test(h)&&(f=g);if(""!==f){f=Xy(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=$y(this.a.textShadow),d=Xy(d),d="text-shadow:"+
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(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Iz.test(g)&&Iz.test(k)&&Iz.test(l)?(e=g,f=k):2===d.length&&!Iz.test(g)&&Iz.test(k)?(e=g,f=k):2===d.length&&Iz.test(g)&&Iz.test(k)&&(f=g);if(""!==f){f=Xy(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=$y(this.a.textShadow),d=Xy(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",Gy).replace("proportionalSerif",Gy).replace("sansSerif",Gy).replace("default",Gy)+";":"");a:{if(Iy in this.a){d=[];e=_.v(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:"+Xy(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=Xy(e),e=Zy(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=Xy(d);d=Zy(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 Jz=new Map([[Cy,"background-color"],["color","color"],[Dy,Dy],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var tz=0;wz.prototype.re=function(){return!!this.a};wz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Kz.has(Wy(a.nodeName))||Lz.has(Wy(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&&!Kz.has(Wy(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 Jz=new Map([[Cy,"background-color"],["color","color"],[Dy,Dy],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var tz=0;wz.prototype.ue=function(){return!!this.a};wz.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Kz.has(Wy(a.nodeName))||Lz.has(Wy(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&&!Kz.has(Wy(a.nodeName))));var b=this.a;this.a=a;return b};
23
23
  var Kz=new Set(["tt","head","layout",_.Te,_.Ae,Fy,"styling",_.ng,"body",_.Xd,"p","span","br"]),Lz=new Set([_.ng,_.Ae]);xz.prototype.getId=function(){return this.attributes.id};Cz.prototype.parseInit=function(){};
24
- Cz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.M.jb(this.a.ttml||{}),e=_.Qi(a,0,c[0]);e=_.R.ea(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.tg)}catch(n){throw new _.O(_.P,2,2005,"Failed to parse TTML.");}d=new pz(d);e=new zz;f=new wz(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=_.Qi(a,b,h);l=_.Km(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Ly(m,l,{imageType:"PNG",encoding:"Base64"}));
25
- b+=h}for(;f.re();)a=f.next(),a=Bz(e,a),"tt"===yz(a)&&(d.l=new jz(d.B,Object.assign({},a.attributes))),"tt"===yz(a)&&(d.w=new dz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),yz(a)!==_.Ae||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Ly(c,a.h.textContent,a.attributes))),yz(a)===_.Ae&&a.attributes.begin&&a.attributes.end?(c="#"+uz(),b=new Ly(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
24
+ Cz.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.N.wb(this.a.ttml||{}),e=_.Qi(a,0,c[0]);e=_.R.ga(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.tg)}catch(n){throw new _.O(_.P,2,2005,"Failed to parse TTML.");}d=new pz(d);e=new zz;f=new wz(f);b=b.periodStart;typeof b===_.h&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var k=c[g],l=_.Qi(a,b,k);l=_.Jm(l);var m="urn:mpeg:14496-30:subs:"+g;d.h.set(m,new Ly(m,l,{imageType:"PNG",encoding:"Base64"}));
25
+ b+=k}for(;f.ue();)a=f.next(),a=Bz(e,a),"tt"===yz(a)&&(d.l=new jz(d.B,Object.assign({},a.attributes))),"tt"===yz(a)&&(d.w=new dz(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),yz(a)!==_.Ae||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.h.set(c,new Ly(c,a.h.textContent,a.attributes))),yz(a)===_.Ae&&a.attributes.begin&&a.attributes.end?(c="#"+uz(),b=new Ly(c,a.h.textContent,a.attributes),d.h.set(c,b),c=b):c=null,c&&(a.j=c.getId()),
26
26
  yz(a)===_.ng&&(c=a.getId()||uz(),b=new oz(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.j.get(a.a).f.push(c)),yz(a)!==_.ng&&rz(a)?(c=uz(),b=new oz(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),yz(a)!==_.Xd||!a.attributes.extent&&!a.attributes.origin?c=null:(c=uz(),b=new ez(c,sz(d,a.f),Object.assign({},a.attributes)),d.j.set(c,b),c=b),c&&(a.a=c.getId()),yz(a)!==Fy?c=null:(c=a.getId(),b=new ez(c,sz(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(yz(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=uz(),b=new az(c,a.h.nodeName===_.da?a.h.textContent:null,"br"===yz(a),a.a,a.j,sz(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"===yz(a)||a.j?(c=uz(),b=new az(c,null,!1,a.a,a.j,sz(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=vz(d);f=[];a=_.v(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
28
28
  _.ph(c.value.build(d.l)));return{cues:e,styles:f}};Dz.prototype.a=function(a){a=(new Cz(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.v(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=Ez(c.startTime)+" --\x3e "+Ez(c.endTime),e=[];switch(c.textAlign){case _.De:e.push("align:left");break;case _.Uf:e.push("align:right");break;case _.Ap:e.push("align:middle");break;case _.hg:e.push("align:start");break;case _.oe:e.push("align:end")}switch(c.writingMode){case _.Qg:e.push("vertical:lr");break;
29
- case _.Rg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.gb(b)};Fz.prototype.probe=function(a,b){return a===_.Pc&&b===_.sg};Fz.prototype.create=function(a){return new Dz(a)};Gz.prototype.parseInit=function(a){var b=!1;(new _.oq).M(_.We,_.pq).M(_.Bg,_.pq).M(_.Re,_.pq).M(_.Ve,_.pq).M(_.kg,_.pq).ba(_.mg,_.qq).M("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.O(_.P,2,2007);};
30
- Gz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.oq).M("moof",_.pq).M("traf",_.pq).ba("subs",function(h){for(var l=_.jq(h.reader),m=0;m<l;++m){h.reader.skip(4);for(var n=_.iq(h.reader),p=0;p<n;++p){var q=1===h.version?_.jq(h.reader):_.iq(h.reader);g.push(q);h.reader.skip(6)}}}).M(_.Qe,_.rq(function(h){d=!0;h=c.a.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.w(Hz,_.bv);Hz.prototype.install=function(){_.sv(_.Pc,Cz);_.sv(_.Nc,Gz);_.sv(zy,Gz);_.sv(By,Gz);_.sv(Ay,Gz);_.ut.push(this.a)};Hz.prototype.uninstall=function(){_.Hv(_.Pc);_.Hv(_.Nc);_.Hv(zy);_.Hv(By);_.Hv(Ay);_.wt(this.a)};Hz.prototype.id=function(){return"subtitles-ttml"};_.K("clpp.ttml.TtmlComponent",Hz);};
29
+ case _.Rg:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.R.sb(b)};Fz.prototype.probe=function(a,b){return a===_.Pc&&b===_.sg};Fz.prototype.create=function(a){return new Dz(a)};Gz.prototype.parseInit=function(a){var b=!1;(new _.oq).N(_.We,_.pq).N(_.Bg,_.pq).N(_.Qe,_.pq).N(_.Ve,_.pq).N(_.kg,_.pq).da(_.mg,_.qq).N("stpp",function(c){b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.O(_.P,2,2007);};
30
+ Gz.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.oq).N("moof",_.pq).N("traf",_.pq).da("subs",function(k){for(var l=_.jq(k.reader),m=0;m<l;++m){k.reader.skip(4);for(var n=_.iq(k.reader),p=0;p<n;++p){var q=1===k.version?_.jq(k.reader):_.iq(k.reader);g.push(q);k.reader.skip(6)}}}).N(_.Oe,_.rq(function(k){d=!0;k=c.a.parseMedia(k,b,g);e=e.concat(k.cues);f=f.concat(k.styles)})).parse(a);d||this.g.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.w(Hz,_.av);Hz.prototype.install=function(){_.rv(_.Pc,Cz);_.rv(_.Nc,Gz);_.rv(zy,Gz);_.rv(By,Gz);_.rv(Ay,Gz);_.tt.push(this.a)};Hz.prototype.uninstall=function(){_.uv(_.Pc);_.uv(_.Nc);_.uv(zy);_.uv(By);_.uv(Ay);_.vt(this.a)};Hz.prototype.id=function(){return"subtitles-ttml"};_.K("clpp.ttml.TtmlComponent",Hz);};
31
31
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
32
32
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
33
33
  else{_=this.clpp._;(f.call(g,this));}
@@ -1,9 +1,9 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var ny="VerimatrixVCAS",oy="clpp.verimatrix.Vcas",py="clpp.verimatrix.VcasComponent",vy=function(a){_.$p.call(this,ny);var b={};b[qy]=qy;b[ry]=ry;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?sy: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?ty:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
- this.F=d;this.B=b;this.w=uy(this,e);this.o=uy(this,f);this.l=uy(this,g);this.j=h;this.H=l;this.G=m;this.g=new _.L(oy);_.R.empty(this.w)?this.g.warn(_.Yb):this.eb(_.Md,{licenseUrl:this.w,videoRobustness:[_.Db,void 0],audioRobustness:[_.Cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.sb):this.eb(_.Kd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
- _.R.empty(this.l)?this.g.warn(_.Qa):_.R.empty(this.j)?this.g.warn(_.Pa):this.eb(_.Id,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},uy=function(a,b){if(a.F===sy){var c=Object.assign({},{deviceId:_.Lm(_.R.Gd(a.A))},a.a&&{authenticator:_.Lm(_.R.Gd(a.a))});return b+_.yn(c)}return b},wy=function(){this.g=new _.L(py)};_.w(vy,_.$p);
5
- vy.prototype.h=function(a,b){if(this.F===xy){var c=this.B[ry],d={};d[this.B[qy]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};vy.prototype.I=function(a,b){var c=_.xq(b);switch(this.G){case yy:c=_.yn({r:c,Vp:this.H},!0)}return c};vy.prototype.K=function(a,b){this.h(a,b);_.Aq(b)};vy.prototype.L=function(a,b){_.Bq(b)};_.K(oy,vy);vy.prototype.constructor=vy.prototype.constructor;vy.NAME=ny;var sy="query-string",xy="http-header";
6
- vy.LicenseRequestVuidLocation={QUERY_STRING:sy,HTTP_HEADER:xy};var qy="DeviceId",ry="Authenticator";vy.LicenseRequestHttpHeader={DEVICE_ID_HEADER:qy,AUTHENTICATOR_HEADER:ry};var ty="keyid",yy="contentid-siteid";vy.FairPlayAssetIdStrategy={KEYID:ty,CONTENTID_SITEID:yy};_.w(wy,_.bv);wy.prototype.uninstall=function(){delete _.Vn.VerimatrixVCAS};wy.prototype.beforeLoad=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===ny){a=a.drm.customData;if(!a)throw new _.O(_.P,7,7100,_.Pd);a=new vy(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Wn(a)}};wy.prototype.id=function(){return"verimatrix-vcas"};_.K(py,wy);};
2
+ var f=function(window){var ny="VerimatrixVCAS",oy="clpp.verimatrix.Vcas",py="clpp.verimatrix.VcasComponent",vy=function(a){_.$p.call(this,ny);var b={};b[qy]=qy;b[ry]=ry;var c=a.authenticator,d=void 0===a.licenseRequestVuidLocation?sy:a.licenseRequestVuidLocation;b=void 0===a.httpHeaderNames?b:a.httpHeaderNames;var e=a.widevineLicenseUrl,f=a.playReadyLicenseUrl,g=a.fairPlayLicenseUrl,k=a.fairPlayCertificateUrl,l=a.fairPlaySiteId,m=void 0===a.fairPlayAssetIdStrategy?ty:a.fairPlayAssetIdStrategy;this.A=a.deviceId;this.a=c;
3
+ this.D=d;this.B=b;this.w=uy(this,e);this.o=uy(this,f);this.l=uy(this,g);this.j=k;this.H=l;this.G=m;this.g=new _.M(oy);_.R.empty(this.w)?this.g.warn(_.Xb):this.qb(_.Md,{licenseUrl:this.w,videoRobustness:[_.Db,void 0],audioRobustness:[_.Cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.R.empty(this.o)?this.g.warn(_.sb):this.qb(_.Kd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],modifiers:{licenseRequest:this.h.bind(this)}});
4
+ _.R.empty(this.l)?this.g.warn(_.Pa):_.R.empty(this.j)?this.g.warn(_.Oa):this.qb(_.Id,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.K.bind(this),licenseResponse:this.L.bind(this),extractContentId:this.I.bind(this)}})},uy=function(a,b){if(a.D===sy){var c=Object.assign({},{deviceId:_.Km(_.R.Nd(a.A))},a.a&&{authenticator:_.Km(_.R.Nd(a.a))});return b+_.xn(c)}return b},wy=function(){this.g=new _.M(py)};_.w(vy,_.$p);
5
+ vy.prototype.h=function(a,b){if(this.D===xy){var c=this.B[ry],d={};d[this.B[qy]]=this.A;this.a&&(d[c]=this.a);Object.keys(d).forEach(function(e){b.headers[e]=d[e]})}};vy.prototype.I=function(a,b){var c=_.xq(b);switch(this.G){case yy:c=_.xn({r:c,$p:this.H},!0)}return c};vy.prototype.K=function(a,b){this.h(a,b);_.Aq(b)};vy.prototype.L=function(a,b){_.Bq(b)};_.K(oy,vy);vy.prototype.constructor=vy.prototype.constructor;vy.NAME=ny;var sy="query-string",xy="http-header";
6
+ vy.LicenseRequestVuidLocation={QUERY_STRING:sy,HTTP_HEADER:xy};var qy="DeviceId",ry="Authenticator";vy.LicenseRequestHttpHeader={DEVICE_ID_HEADER:qy,AUTHENTICATOR_HEADER:ry};var ty="keyid",yy="contentid-siteid";vy.FairPlayAssetIdStrategy={KEYID:ty,CONTENTID_SITEID:yy};_.w(wy,_.av);wy.prototype.uninstall=function(){delete _.Un.VerimatrixVCAS};wy.prototype.beforeLoad=function(a){a=a.getConfiguration();if(a.drm&&a.drm.env===ny){a=a.drm.customData;if(!a)throw new _.O(_.P,7,7100,_.Nd);a=new vy(a);this.g.info("Registering the Verimatrix VCAS Ultra environment");_.Vn(a)}};wy.prototype.id=function(){return"verimatrix-vcas"};_.K(py,wy);};
7
7
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
8
8
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
9
9
  else{_=this.clpp._;(f.call(g,this));}