@castlabs/prestoplay 6.3.0 → 6.4.1

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 (58) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +108 -107
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +426 -398
  8. package/cjs/cl.crypto.js +10 -10
  9. package/cjs/cl.dash.js +72 -69
  10. package/cjs/cl.externs.js +79 -155
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +47 -44
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -32
  15. package/cjs/cl.ima.js +22 -22
  16. package/cjs/cl.mse.js +259 -254
  17. package/cjs/cl.muxdata.js +12 -12
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +69 -69
  22. package/cjs/cl.thumbnails.js +24 -23
  23. package/cjs/cl.tizen.js +70 -70
  24. package/cjs/cl.ttml.js +27 -26
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +18 -18
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -19
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -87
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +365 -348
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +67 -63
  38. package/cl.externs.js +74 -154
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +39 -37
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +16 -16
  44. package/cl.mse.js +233 -222
  45. package/cl.muxdata.js +8 -8
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +10 -10
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +58 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -21
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +16 -15
  58. package/package.json +4 -2
@@ -1,27 +1,28 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var Qs="No thumbnail duration or URL specified",Rs="No thumbnail found for position ",Ss="Position is out of range: ",Ts="Thumbnail URL is mandatory",Us="Wrong gridSize format",Vs="clpp.thumbnails",Ws=function(){this.log=new _.G(Vs);this.g=null;this.a=[];this.w=!1},Ys=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Bd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Xs(a,0,e,!!f)})},Promise.resolve())},Xs=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();
3
- var e=b+c;return Zs(a,d).then(function(){return a.a[b].load()}).then(function(){return Xs(a,e,c,d)})},Zs=function(a,b){return new Promise(function(c){if(b||a.g.getState()!==_.bm)c();else a.g.one(_.kc,function(){c()})})},$s=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;
4
- this.a=p;this.g=k;this.m=l;this.h=m;this.j=n;this.f=null},at=function(a,b){return b>=a.time&&b<a.time+a.duration},bt=function(){Ws.call(this);this.f=null;this.o=this.h=1;this.j=0},ct=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.a=new _.Qh},dt=function(){this.g=new _.G(Vs);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Qh},et=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.a.resolve()})},gt=function(a,b){return ft(a,b).then(function(c){return new $s(c,
5
- b.time,b.duration)})},ft=function(a,b){return b.load().then(function(){var c=_.R(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.jj(c)})},ht=function(){Ws.call(this);this.f=null},it=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},jt=function(){Ws.apply(this,arguments)},kt=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,e.startTime<=b&&(c=e);return c},lt=function(a,b){var c=a.horizontalTiles||
6
- b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Vc:c,We:d,Cf:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},mt=function(){this.f=new _.G(Vs);this.a=this.l=null},nt=function(a){return a.some(function(b){return 0<b.thumbStreams.length})},ot=function(a){if(!a)return null;a=new _.Wj(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null},pt=function(){};Ws.prototype.init=function(a,b){var c=this;this.g=a;a.one(_.Xd,function(){c.w=!0});a.isLive()||this.m().then(function(){b&&b.preload&&Ys(c,b.preload)})};$s.prototype.raw=function(){return this.a.cloneNode(!1)};
7
- $s.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(_.Oc);e.style.width=c+_.Ud;e.style.height=d+_.Ud;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.a.naturalWidth||this.a.width))+"px "+Math.ceil(d/
8
- this.height*(this.a.naturalHeight||this.a.height))+_.Ud;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Ud;e.style.backgroundPositionY="-"+f*d+_.Ud;return e};
9
- $s.prototype.load=function(){var a=this;this.f||(this.f=new Promise(function(b,c){function d(){a.width||(a.width=(a.a.naturalWidth||a.a.width)/a.g);a.height||(a.height=(a.a.naturalHeight||a.a.height)/a.m);a.x||(a.x=a.width*a.h);a.y||(a.y=a.height*a.j)}if(a.a.src&&a.a.complete)d(),b(a);else{var e=null,f=function(){d();a.a.removeEventListener("load",f);a.a.removeEventListener(_.Zc,e);b(a)};e=function(){a.a.removeEventListener("load",f);a.a.removeEventListener(_.Zc,e);c()};a.a.addEventListener("load",
10
- f);a.a.addEventListener(_.Zc,e);a.a.src=a.src}}));return this.f};_.B("clpp.thumbnails.Thumbnail",$s);$s.prototype.load=$s.prototype.load;$s.prototype.element=$s.prototype.element;$s.prototype.raw=$s.prototype.raw;_.v(bt,Ws);
11
- bt.prototype.init=function(a,b){if(!b||!b.url)throw new _.K(_.M,7,7100,Ts);if("GRID"===b.mode&&!b.gridSize)throw new _.K(_.M,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.K(_.M,7,7100,"Duration is mandatory");this.f=b;var c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(Qs,c,d),new _.K(_.M,7,7100,Qs);this.j=c;if(this.f.gridSize)try{var e=this.f.gridSize.split(/x/).map(function(f){return parseInt(f,10)}).filter(function(f){return 0<f});if(2===e.length)this.h=e[0],
12
- this.o=e[1];else throw new _.K(_.M,7,7100,Us);}catch(f){throw this.log.error("Error during parsing gridSize",f),new _.K(_.M,7,7100,Us);}Ws.prototype.init.call(this,a,b)};bt.prototype.get=function(a){var b=this.g.getDuration();if(void 0===this.f.duration)return Promise.reject("Duration configuration not defined");var c=Math.floor(a/this.f.duration);if(0>a||a>b)return Promise.reject(Ss+a);var d=this.a[c];return d?d.load().then(function(){return d}):Promise.reject(Rs+a+" at index "+c)};
13
- bt.prototype.m=function(){if(0<this.a.length)return Promise.resolve();var a=this.g.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new $s(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()};ct.prototype.load=function(){return this.a};
14
- dt.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.K(_.M,7,7100,Ts);var d=_.ih(b.url);d.type=_.hh;a.getNetworkEngine().fetch(d).O.then(function(e){e=e.data;var f=_.R(c.f);e=_.R(e);for(var g=f.byteLength+e.byteLength,k=new ArrayBuffer(g),l=new DataView(k),m=0,n=0,p=f.byteLength;n<p;n++)l.setUint8(m,f[n]),m+=1;f=0;for(n=e.byteLength;f<n;f++)l.setUint8(m,e[f]),m+=1;c.f=k;c.g.info("Appended "+e.byteLength+" bytes.Total data now "+(g+" bytes."))}).then(function(){var e=c.f,f=_.R(e),g=
15
- String.fromCharCode.apply(null,qt),k=Array.prototype.slice.call(f,0,8);f=64;var l=0;var m=!1;if(g===String.fromCharCode.apply(null,k))for(e=new DataView(e,16,20),e=e.getUint32(0,!0),0===e&&(e=1E3);!m;){l+=1;k=e;g=new DataView(c.f,f);m=g.getUint32(0,!0);k=m*k/1E3;g=g.getUint32(4,!0);g=new ct(k,g);if(k=c.a.length)k=c.a[k-1],k.length=g.offset-k.offset,k.duration=g.time-k.time;c.a.push(g);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<l)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
- }).then(function(){et(c)})["catch"](function(e){c.g.error("Error while loading thumbnail index",e)})};dt.prototype.get=function(a){var b=this;return 0>a?Promise.reject(Ss+a):this.h.then(function(){for(var c=0;c<b.a.length;c++){var d=b.a[c];if(a>=d.time&&a<d.time+d.duration)return gt(b,d).then(function(e){return e.load().then(function(){return e})})}return Promise.reject(Rs+a)})};var qt=[137,66,73,70,13,10,26,10];_.v(ht,Ws);
17
- ht.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.K(_.M,7,7100,Ts);var d=b.url,e=_.ih(d);e.type=_.hh;this.f=a.getNetworkEngine().fetch(e).O.then(function(f){if(f=f.data){f=_.Tg(f).split(/\n/);for(var g=0;g<f.length;g++){var k=f[g],l=k.split(" --\x3e ");if(2===l.length){k=f[++g];var m=k.indexOf("\x3d"),n=0>m?[]:k.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var r=k.indexOf("#");k=0>r?k:k.substr(0,r);k.match(/^http|^\/\//)||(k=d.substr(0,d.lastIndexOf("/"))+"/"+
18
- k);r=it(l[0]);l=it(l[1])-r;c.a.push(new $s(k,r,l,m,p,q,n,0,0))}}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnail",f)});Ws.prototype.init.call(this,a,b)};ht.prototype.get=function(a){var b=this;return 0>a?Promise.reject(Ss+a):this.f.then(function(){for(var c={},d=0;d<b.a.length;c={Kc:c.Kc},d++)if(c.Kc=b.a[d],at(c.Kc,a))return c.Kc.load().then(function(e){return function(){return e.Kc}}(c));return Promise.reject(Rs+a)})};ht.prototype.m=function(){return this.f};_.v(jt,Ws);
19
- jt.prototype.get=function(a){if(0>a)return this.log.error("Position must be greater than 0 but is "+a),Promise.reject();var b=this.g.getPeriods();b=kt(b,a);if(!b)return this.log.error("Could not find period for specified position",a),Promise.reject();var c=b.thumbStreams.sort(this.f)[0];if(!c)return this.log.error("Could not find thumb stream for specified position",a),Promise.reject();b=c.findSegmentPosition(a-b.startTime);if(null===b||void 0===b)return this.log.error("Could not find segment index for specified position",a),
20
- Promise.reject();var d=c.getSegmentReference(b);if(d){var e=lt(d,c);a=Math.floor((a-d.startTime)/e.durationPerTile);var f;if(0<this.a.length)d=c.findSegmentPosition(0),null!==d&&(f=this.a[(b-d)*e.Cf+a]);else if((c=d.Sa())&&0<c.length){var g=0,k=0;d=d.startTime;1<e.Cf&&(g=a%e.Vc,k=Math.floor(a/e.Vc),d+=a*e.durationPerTile);f=new $s(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.Vc,e.We,g,k)}if(f)return f.load().then(function(){return f})}this.log.error("segment reference for specified segment index does not exist",
21
- b);return Promise.reject()};jt.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
22
- jt.prototype.m=function(){if(0<this.a.length)return Promise.resolve();var a=this.g.getPeriods();a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.J.R(d=b.getSegmentReference(c++));)for(var e=lt(d,b),f=d.Sa()[0],g=new Image,k=d.startTime,l=0;l<e.We;++l)for(var m=0;m<e.Vc;++m)this.a.push(new $s(f,k,e.durationPerTile,void 0,void 0,void 0,void 0,e.Vc,e.We,m,l,g)),k+=e.durationPerTile;return Promise.resolve()};_.t=mt.prototype;_.t.onPlayerCreated=function(a){this.l=a};_.t.onPlayerWillDestroy=function(){this.l=null};_.t.onPlayerWillRelease=function(){this.a=null};
23
- _.t.onContentWillLoad=function(a){var b=this,c=a.getConfiguration();if(c.thumbnails){var d=c.thumbnails;d&&(void 0===d.enabled||d.enabled)&&((c=d.mode)||(c=ot(d.url||null)),c&&("SINGLE"===c||"GRID"===c?this.a=new bt:"WEBVTT"===c?this.a=new ht:"BIF"===c&&(this.a=new dt)),this.a&&(this.f.info("Loading thumbs configuration",d),this.l.one(_.md,function(){b.f.info("Initialize thumbnails provider");b.a.init(a,d)})))}else this.a=null};
24
- _.t.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();nt(d)&&(this.a=new jt,this.a.init(a,c))}};_.t.get=function(a){return this.a?this.a.get(a):Promise.reject()};_.t.id=function(){return"thumbnails"};_.B("clpp.thumbnails.ThumbnailsPlugin",mt);mt.prototype.get=mt.prototype.get;mt.Id="thumbnails";pt.prototype.create=function(){return new mt};_.Fn(new pt);};
2
+ var f=function(window){var At="No thumbnail duration or URL specified",Bt="No thumbnail found for position ",Ct="Position is out of range: ",Dt="Thumbnail URL is mandatory",Et="Wrong gridSize format",Ft="clpp.thumbnails",Gt=function(){this.log=new _.H(Ft);this.g=null;this.a=[];this.w=!1},It=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Id&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Ht(a,0,e,!!f)})},Promise.resolve())},Ht=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();
3
+ var e=b+c;return Jt(a,d).then(function(){return a.a[b].load()}).then(function(){return Ht(a,e,c,d)})},Jt=function(a,b){return new Promise(function(c){if(b||a.g.getState()!==_.Tm)c();else a.g.one(_.sc,function(){c()})})},Kt=function(a,b){return b>=a.time&&b<a.time+a.duration},Lt=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=
4
+ c;this.x=d;this.y=e;this.width=f;this.height=g;this.ga=p;this.Rh=h;this.Fj=l;this.li=m;this.mi=n;this.Nb=null},Mt=function(){Gt.call(this);this.f=null;this.o=this.h=1;this.j=0},Nt=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Qf=new _.Mh},Ot=function(){this.g=new _.H(Ft);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Mh},Pt=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Qf.resolve()})},Rt=function(a,b){return Qt(a,b).then(function(c){return new Lt(c,
5
+ b.time,b.duration)})},Qt=function(a,b){return b.load().then(function(){var c=_.N(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.ak(c)})},St=function(){Gt.call(this);this.f=null},Tt=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},Ut=function(){Gt.apply(this,arguments)},Vt=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,e.startTime<=b&&(c=e);return c},Wt=function(a,b){var c=a.horizontalTiles||
6
+ b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{bd:c,ef:d,Kf:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Xt=function(){this.f=new _.H(Ft);this.a=this.l=null},Yt=function(a){return a.some(function(b){return 0<b.thumbStreams.length})},Zt=function(a){if(!a)return null;a=new _.mi(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null},$t=function(){};Gt.prototype.init=function(a,b){var c=this;this.g=a;a.one(_.de,function(){c.w=!0});a.isLive()||this.m().then(function(){b&&b.preload&&It(c,b.preload)})};Lt.prototype.raw=function(){return this.ga.cloneNode(!1)};
7
+ Lt.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(_.Vc);e.style.width=c+_.ae;e.style.height=d+_.ae;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.ga.naturalWidth||this.ga.width))+"px "+Math.ceil(d/
8
+ this.height*(this.ga.naturalHeight||this.ga.height))+_.ae;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.ae;e.style.backgroundPositionY="-"+f*d+_.ae;return e};
9
+ Lt.prototype.load=function(){var a=this;this.Nb||(this.Nb=new Promise(function(b,c){function d(){a.width||(a.width=(a.ga.naturalWidth||a.ga.width)/a.Rh);a.height||(a.height=(a.ga.naturalHeight||a.ga.height)/a.Fj);a.x||(a.x=a.width*a.li);a.y||(a.y=a.height*a.mi)}if(a.ga.src&&a.ga.complete)d(),b(a);else{var e=null,f=function(){d();a.ga.removeEventListener("load",f);a.ga.removeEventListener(_.fd,e);b(a)};e=function(){a.ga.removeEventListener("load",f);a.ga.removeEventListener(_.fd,e);c()};a.ga.addEventListener("load",
10
+ f);a.ga.addEventListener(_.fd,e);a.ga.src=a.src}}));return this.Nb};_.B("clpp.thumbnails.Thumbnail",Lt);Lt.prototype.load=Lt.prototype.load;Lt.prototype.element=Lt.prototype.element;Lt.prototype.raw=Lt.prototype.raw;_.v(Mt,Gt);
11
+ Mt.prototype.init=function(a,b){if(!b||!b.url)throw new _.L(_.M,7,7100,Dt);if("GRID"===b.mode&&!b.gridSize)throw new _.L(_.M,7,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.L(_.M,7,7100,"Duration is mandatory");this.f=b;var c=this.f.duration,d=this.f.url;if(!c||!d)throw this.log.error(At,c,d),new _.L(_.M,7,7100,At);this.j=c;if(this.f.gridSize)try{var e=this.f.gridSize.split(/x/).map(function(f){return parseInt(f,10)}).filter(function(f){return 0<f});if(2===e.length)this.h=e[0],
12
+ this.o=e[1];else throw new _.L(_.M,7,7100,Et);}catch(f){throw this.log.error("Error during parsing gridSize",f),new _.L(_.M,7,7100,Et);}Gt.prototype.init.call(this,a,b)};Mt.prototype.get=function(a){var b=this.g.getDuration();if(void 0===this.f.duration)return Promise.reject("Duration configuration not defined");var c=Math.floor(a/this.f.duration);if(0>a||a>b)return Promise.reject(Ct+a);var d=this.a[c];return d?d.load().then(function(){return d}):Promise.reject(Bt+a+" at index "+c)};
13
+ Mt.prototype.m=function(){if(0<this.a.length)return Promise.resolve();var a=this.g.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new Lt(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()};Nt.prototype.load=function(){return this.Qf};
14
+ Ot.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.L(_.M,7,7100,Dt);var d=b.url,e=_.Hh(d);e.type=_.Gh;a.getNetworkEngine().fetch(e).P.then(function(f){f=f.data;var g=_.N(c.f);f=_.N(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."))}).then(function(){var f=c.f,g=_.N(f),
15
+ h=String.fromCharCode.apply(null,au),l=Array.prototype.slice.call(g,0,8);g=64;var m=0;var n=!1;if(h===String.fromCharCode.apply(null,l))for(f=new DataView(f,16,20),f=f.getUint32(0,!0),0===f&&(f=1E3);!n;){m+=1;l=f;h=new DataView(c.f,g);n=h.getUint32(0,!0);l=n*l/1E3;h=h.getUint32(4,!0);h=new Nt(l,h);if(l=c.a.length)l=c.a[l-1],l.length=h.offset-l.offset,l.duration=h.time-l.time;c.a.push(h);g+=8;(n=4294967295===n)&&c.h.resolve();if(1E5<m)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
16
+ }).then(function(){Pt(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.L(1,7,2013,"Error while loading and parsing BIF thumbnails.",f))})};Ot.prototype.get=function(a){var b=this;return 0>a?Promise.reject(Ct+a):this.h.then(function(){for(var c=0;c<b.a.length;c++){var d=b.a[c];if(Kt(d,a))return Rt(b,d).then(function(e){return e.load().then(function(){return e})})}return Promise.reject(Bt+a)})};var au=[137,66,73,70,13,10,26,10];_.v(St,Gt);
17
+ St.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.L(_.M,7,7100,Dt);var d=b.url,e=_.Hh(d);e.type=_.Gh;this.f=a.getNetworkEngine().fetch(e).P.then(function(f){if(f=f.data){f=_.oh(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 r=h.indexOf("#");h=0>r?h:h.substr(0,r);h.match(/^http|^\/\//)||(h=d.substr(0,d.lastIndexOf("/"))+"/"+
18
+ h);r=Tt(l[0]);l=Tt(l[1])-r;c.a.push(new Lt(h,r,l,m,p,q,n,0,0))}}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.L(1,7,2013,"Error while loading VTT thumbnails.",f))});Gt.prototype.init.call(this,a,b)};
19
+ St.prototype.get=function(a){var b=this;return 0>a?Promise.reject(Ct+a):this.f.then(function(){for(var c={},d=0;d<b.a.length;c={Nc:c.Nc},d++)if(c.Nc=b.a[d],Kt(c.Nc,a))return c.Nc.load().then(function(e){return function(){return e.Nc}}(c));return Promise.reject(Bt+a)})};St.prototype.m=function(){return this.f};_.v(Ut,Gt);
20
+ Ut.prototype.get=function(a){if(0>a)return this.log.error("Position must be greater than 0 but is "+a),Promise.reject();var b=this.g.getPeriods();b=Vt(b,a);if(!b)return this.log.error("Could not find period for specified position",a),Promise.reject();var c=b.thumbStreams.sort(this.f)[0];if(!c)return this.log.error("Could not find thumb stream for specified position",a),Promise.reject();b=c.findSegmentPosition(a-b.startTime);if(null===b||void 0===b)return this.log.error("Could not find segment index for specified position",a),
21
+ Promise.reject();var d=c.getSegmentReference(b);if(d){var e=Wt(d,c);a=Math.floor((a-d.startTime)/e.durationPerTile);var f;if(0<this.a.length)d=c.findSegmentPosition(0),null!==d&&(f=this.a[(b-d)*e.Kf+a]);else if((c=d.Ha())&&0<c.length){var g=0,h=0;d=d.startTime;1<e.Kf&&(g=a%e.bd,h=Math.floor(a/e.bd),d+=a*e.durationPerTile);f=new Lt(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.bd,e.ef,g,h)}if(f)return f.load().then(function(){return f})}this.log.error("segment reference for specified segment index does not exist",
22
+ b);return Promise.reject()};Ut.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
23
+ Ut.prototype.m=function(){if(0<this.a.length)return Promise.resolve();var a=this.g.getPeriods();a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.J.R(d=b.getSegmentReference(c++));)for(var e=Wt(d,b),f=d.Ha()[0],g=new Image,h=d.startTime,l=0;l<e.ef;++l)for(var m=0;m<e.bd;++m)this.a.push(new Lt(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.bd,e.ef,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.t=Xt.prototype;_.t.onPlayerCreated=function(a){this.l=a};_.t.onPlayerWillDestroy=function(){this.l=null};_.t.onPlayerWillRelease=function(){this.a=null};
24
+ _.t.onContentWillLoad=function(a){var b=this,c=a.getConfiguration();if(c.thumbnails){var d=c.thumbnails;d&&(void 0===d.enabled||d.enabled)&&((c=d.mode)||(c=Zt(d.url||null)),c&&("SINGLE"===c||"GRID"===c?this.a=new Mt:"WEBVTT"===c?this.a=new St:"BIF"===c&&(this.a=new Ot)),this.a&&(this.f.info("Loading thumbs configuration",d),this.l.one(_.ud,function(){b.f.info("Initialize thumbnails provider");b.a.init(a,d)})))}else this.a=null};
25
+ _.t.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();Yt(d)&&(this.a=new Ut,this.a.init(a,c))}};_.t.get=function(a){return this.a?this.a.get(a):Promise.reject()};_.t.id=function(){return"thumbnails"};_.B("clpp.thumbnails.ThumbnailsPlugin",Xt);Xt.prototype.get=Xt.prototype.get;Xt.Id="thumbnails";$t.prototype.create=function(){return new Xt};_.uo(new $t);};
25
26
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
26
27
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
27
28
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.tizen.js CHANGED
@@ -1,75 +1,75 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var zD="An unknown error occurred while trying to get volume",AD="Cannot get loading rendition due to platform limitations",BD="PARAM_START_POSITION",CD="SecurityError",DD="The require privilege is: http://tizen.org/privilege/tv.audio",ED="|STARTBITRATE\x3d",FD=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},GD=function(a,b){this.h=a;this.w=null;this.a=_.Ad;this.o=null;this.j=!1;this.f=new Map;this.m=b;this.g=new _.G("clpp.tizen.DrmEngine")},JD=function(a){var b,
3
- c,d;return _.A(function(e){if(1==e.a){b=a.a===_.Ic||a.a===_.Hc;if(!b)throw new _.K(_.M,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.Yc)throw new _.K(_.M,6,6012,"No license server given for "+a.a);_.rf(e,2);return a.a===_.Ic?_.w(e,HD(a),5):_.w(e,ID(a,c),5)}if(2!=e.a)return a.w={keySystem:a.a,licenseServerUri:c.Yc,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Ge,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
- keyIds:[],periodId:null},_.sf(e,0);d=_.tf(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.K(_.M,6,6005,{message:JSON.stringify(d)});})},ID=function(a,b){var c,d,e,f;return _.A(function(g){c=KD;d=LD;e={};e[d.ng]=!b.Ge;e[d.og]=b.Yc;""!==b.customData&&(e[d.mg]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(k){throw k;}_.z(g)})},HD=function(a){var b;return _.A(function(c){b=KD;try{webapis.avplay.setDrm(b.jd,
5
- "Initialize",""),webapis.avplay.setDrm(b.jd,"widevine_app_session",a.o.id),webapis.avplay.setDrm(b.jd,"widevine_data_type",a.o.type)}catch(d){throw d;}_.z(c)})},MD=function(a,b){var c,d,e,f,g,k,l,m,n,p,q,r,x,y,C,H,F;_.A(function(E){if(1==E.a){c=KD;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);k=b.serverurl&&""!==b.serverurl?b.serverurl:d.Yc;l=_.ih([k],_.fh());l.type=3;l.body=f.buffer;l.method=
6
- "POST";_.rf(E,2);return _.w(E,a.m.xb.fetch(l).O,4)}if(2!=E.a){m=E.f;if(a.j){n=_.R(m.data);p=n.byteLength;q="";for(r=0;r<p;r++)q+=String.fromCharCode(n[r]);x=btoa(q);y=b.session_id+BD+(x+BD);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.jd,"widevine_license_data",y)}catch(L){a.g.error("License response rejected by CDM"),C=new _.K(_.M,6,6008,{browserError:JSON.stringify(L)}),a.m.onError(C)}}return _.sf(E,0)}H=_.tf(E);a.g.error("License request failed.",JSON.stringify(H));F=new _.K(_.M,
7
- 6,6007,{message:_.Ba,url:H.data.url,status:H.data.status||NaN,response:H.data.response||"",headers:H.data.headers||{}},H);a.m.onError(F);_.z(E)})},ND=function(a){this.l=a;this.a=this.l.a;this.f=_.Xl;this.j=_.Yl;this.w=(new Date).getTime();this.m=!1;this.o=-1;this.h=2;this.g=new _.G("clpp.tizen.StateManager")},PD=function(a,b){if(a.f!==b)if(a.f===_.hm&&b!==_.Xl)a.g.debug(_.eu+OD(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.bm?(a.o=(new Date).getTime(),a.l.trigger(new _.I(_.lc,{detail:{bufferedTimeMS:-1,
8
- reason:a.h}}))):a.j===_.bm&&a.l.trigger(new _.I(_.kc,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.l.trigger(new _.I(_.ie,{detail:d}));a.g.debug("State changed:",OD(a.j),"-\x3e",OD(a.f))}},OD=function(a){return Object.keys(_.fm)[a]},SD=function(a){if(a.m){var b=a.a.getState(),c=a.f;switch(b){case QD:c=_.km;break;case RD:c=_.jm;break;default:a.l.isEnded()?c=_.dm:a.g.debug("Inconsistent AVPlay playback state:",b)}PD(a,
9
- c)}},TD=function(){this.o=this.A=this.g=this.h=this.B=this.l=this.j=this.f=null;this.w=!0;this.m=null;this.a=new _.G("clpp.tizen.TextStreamer")},UD=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},VD=function(a){var b,c;return _.A(function(d){if(1==d.a)return b=a.l.getConfiguration(),c=null,_.w(d,_.Ho(a.B.url,a.l.getNetworkEngine(),b.manifest.attemptParameters,a.B.type),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},WD=function(a){var b=
10
- document.createElement(_.Ie),c=new _.Bv,d=new _.Qu(function(){return null}),e=a.l.getTextDisplayer();return new _.Hv(b,c,e,d,a.l.getConfiguration())},XD=function(a){var b={sb:function(){return a.l.getPosition()},X:a.h,xb:a.l.getNetworkEngine(),ze:a.yh.bind(a),ye:a.xh.bind(a),onError:a.S.bind(a),Of:function(){},onEvent:function(){},Tf:a.zh.bind(a),Fd:function(){},ee:function(){return new _.Kw}};return new _.Ex(a.f,b)},YD=function(a){var b=a.l.getPosition(),c=null;a=_.u(a.f.periods);for(var d=a.next();!d.done;d=
11
- a.next())d=d.value,d.startTime<=b&&(c=d);return c},ZD=function(a){a.a.debug("getTextStreams()",a.f);if(a.f){var b=[],c=a.f.periods;a.a.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.a.debug(c[d].startTime,a.l.getPosition()),c[d].startTime<=a.l.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.zg(String(c++),_.N);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.ru;var f=new _.Gg(String(a[d].id),e);
12
- f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},$D=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.g){var b=_.Fx(a.g,_.te),c=null;if(b){a=ZD(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},aE=function(a,b){a.a.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.f&&a.g)){a.setTextVisibility(!0);var c=YD(a),d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)==
13
- d.id}))?(a.w?(a.a.debug("Switching period defer text selection"),a.m=c):(_.Nx(a.g,c,!0,0),a.l.trigger(new _.I(_.Kh))),a.o=c.language):a.a.error(_.du,d.id)}},bE=function(){this.h=this.f=this.l=null;this.g={};this.a=new _.G("clpp.tizen.TrackManager");this.w=this.m=this.j=null;this.A=!1;this.o=1},cE=function(a,b){a.l.trigger(new _.I(_.Me,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.f.o}}))},dE=function(a){var b=a.fa();b&&a.l.trigger(new _.I(_.ic,{detail:{width:b.width,
14
- height:b.height,bandwidth:b.bandwidth,rendition:b}}))},eE=function(a){var b=a.l.getConfiguration(),c=_.yh(b.preferredAudioLanguage||[]),d=a.g[_.P]||[];if(d.length){var e=null;c.some(function(g){e=_.Eu(g,d.map(function(k){return k.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),0<f.length&&(c=f[0]));a.a.debug("Setting audio track with preferred language:",
15
- e);a.na(c)}else a.a.debug("Preferred language(s) not available")}else a.a.debug("Could not set preferred audio language")},iE=function(a,b){if(b){var c=b.track.type.toUpperCase();fE(a.f,c,Number(b.id)).then(function(){c===gE&&(a.j=b,a.l.trigger(new _.I(_.Jh)));c===hE&&(a.m=b,a.l.trigger(new _.I(_.Kh)))})["catch"](function(){a.a.error("Could not select "+c+" track.")})}else a.a.debug("Must provide valid rendition")},jE=function(a,b,c){var d=_.uh(b.language||_.ze);c.language=_.Ag(d);c.channelsCount=
16
- b.channels?Number(b.channels):null;c.mimeType=_.ec;a=new _.Gg(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},kE=function(a,b,c){c.mimeType=_.Ke;a=new _.Gg(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},lE=function(a,b,c){b=_.uh(b.track_lang||_.ze);c.mimeType="text/ttml";c.language=_.Ag(b);c.kind=_.ru;return new _.Gg(String(a),c)},mE=function(a,b){var c=null;try{c=
17
- JSON.parse(b)}catch(d){a.a.warn("Couldn't retrieve extra infos from stream."),c=null}return c},pE=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===nE}),f=b.filter(function(n){return n.type===gE}),g=[],k=0;k<f.length;k++){var l=mE(a,f[k].extra_info);if(l){var m=_.uh(l.language||_.ze);m=_.Ag(m);m=c(g,m);m||(m=new _.zg(String(a.o++),_.P),g.push(m));m.renditions.push(jE(f[k].index,
18
- l,m))}else a.a.warn("Skipping audio stream with no extra info")}f=new _.zg(String(a.o++),_.Bg);for(k=0;k<e.length;k++)(l=mE(a,e[k].extra_info))?f.renditions.push(kE(e[k].index,l,f)):a.a.warn("Skipping video stream with no extra info");e=[];e=a.h?ZD(a.h):oE(a,b);d[_.Bg]=[f];d[_.P]=g;d[_.N]=e;return d},oE=function(a,b){for(var c=b.filter(function(k){return k.type===hE}),d=[],e=0;e<c.length;e++){var f=mE(a,c[e].extra_info);if(f){var g=new _.zg(String(a.o++),_.N);g.renditions.push(lE(c[e].index,f,g));
19
- d.push(g)}else a.a.warn("Skipping text stream with no extra info")}return d},qE=function(a,b){for(var c=a.g[_.Bg]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.J.Ja(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},rE=function(a,b,c){a=a.g[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},tE=function(a,b){if(b===_.N&&a.h)return $D(a.h);
20
- var c=sE(a.f)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.Bg&&(d=mE(a,c.extra_info),d=qE(a,{width:d.Width,height:d.Height}));b===_.P&&(c?(d=rE(a,c,_.P),a.j=d):d=a.j);b===_.N&&(c?(d=rE(a,c,_.N),a.m=d):d=a.m);return d},uE=function(a){_.Ph.call(this);this.l=a;this.h=null;this.a=new _.G("clpp.tizen.Middleware");this.C=1;this.B=!1;this.m=null;this.D=0;this.o=!0;this.g=!1;this.f=null;this.A=1;this.w=!1;this.j={}},vE=function(a){return _.A(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",
21
- function(c){a.A=c.resolutionWidth/1920;a.a.debug("Display resolution ratio: ",a.A)},function(c){a.a.debug("Could not load DISPLAY property");throw c;});_.z(b)})},xE=function(a){try{webapis.avplay.setListener({onbufferingstart:a.sh.bind(a),onbufferingprogress:a.rh.bind(a),onbufferingcomplete:a.qh.bind(a),onstreamcompleted:a.vh.bind(a),oncurrentplaytime:function(b){a.trigger(new _.I(wE,{currentTime:b}))},onevent:a.uh.bind(a),onsubtitlechange:a.wh.bind(a),ondrmevent:a.th.bind(a),onerror:a.S.bind(a)})}catch(b){a.a.error(b)}},
22
- yE=function(a){var b=!!a.l.getTrackManager().Ba();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.a.debug("Could not set AVPlay subtitle config",c)}},zE=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.a.debug({estimatedBandwidth:c,Qj:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",ED+d)}catch(e){a.a.debug(e)}},AE=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+ED+b)}catch(c){throw a.a.debug("Could not set fixed bandwidth",
23
- c),c;}},DE=function(a){return{position:a.getPosition(),state:a.l.getState(),bf:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:BE(a),volume:a.getVolume(),tj:CE(a),Ih:sE(a)}},FE=function(a){var b,c;return _.A(function(d){if(1==d.a)return _.w(d,EE(),2);if(3!=d.a)return b=new Promise(function(e){(new _.qh(e)).$(5)}),_.w(d,Promise.race([vE(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.a.debug("Took to long for the SDK to be ready"),
24
- d["return"](Promise.reject("SDK Timeout"));_.z(d)})},LE=function(a,b,c){var d,e,f,g,k,l,m,n;return _.A(function(p){switch(p.a){case 1:a.m=_.tm(b);d=a.D;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.a.debug("Loading manifest URL: "+a.m[d].url);f=b.startTime||void 0;a.g&&(a.trigger(new _.I(GE)),f=c.currentPosition);_.rf(p,2);g=a.m[d].url;k=a.m[d].type;k!==_.Tb||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);
25
- e.nextBandwidth?(AE(a,e.nextBandwidth),a.o=!1):(a.o||zE(a,e),a.o=!0);xE(a);if(!b.drm||!b.drm.env){a.a.debug("No DRM configuration was provided. Assuming clear content");p.H(4);break}m={onError:function(q){return a.l.onError(q)},xb:a.l.getNetworkEngine()};a.h=new GD(b.drm,m);return _.w(p,a.h.init(),4);case 4:return a.g||a.trigger(new _.I(HE)),_.w(p,IE(a),6);case 6:a.g||a.trigger(new _.I(JE));f&&typeof f===_.h&&0<f&&a.seek(f)["catch"](function(q){a.a.debug("Couldn't set start position",q)});a.g||(b.volume&&
26
- a.setVolume(b.volume),b.muted&&KE(a,b.muted),b.autoplay&&a.l.play()["catch"](function(q){a.a.debug("Autoplay failed",q)}));_.sf(p,0);break;case 2:throw n=_.tf(p),a.a.debug("Error while attempting to load source."),n;}})},IE=function(a){return _.A(function(b){a.a.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.a.debug("AVPlay is ready!");yE(a);c()},function(e){a.a.debug("prepareAsync failed",e);d(e)})}catch(e){a.a.debug("Failed to prepare media player for playback"),
27
- d(e)}}))})},ME=function(a,b,c){a.a.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.f=DE(a);a.g=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.l.getConfiguration(),d).then(function(){var e=a.f.bf;a.g=!1;a.f=null;return e===RD?a.pause():a.play()})}catch(e){return Promise.reject(e)}},CE=function(a){return a.g&&a.f?a.f.tj:webapis.avplay.getTotalTrackInfo()},
28
- sE=function(a){return a.g&&a.f?a.f.Ih:webapis.avplay.getCurrentStreamInfo()},fE=function(a,b,c){b=b.toUpperCase();b===hE&&NE(a,!0);var d=a.j[b];d&&(d.Hd.stop(),a.j[b]=null,a.a.debug("Cancelled pending track switch for "+b));return new Promise(function(e,f){function g(k,l,m){m=void 0===m?!1:m;try{webapis.avplay.setSelectTrack(k,l),a.j[k]=null,e()}catch(n){a.a.debug("Could not set "+k+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[k]={type:k,index:l,$e:0,
29
- Hd:new _.qh(function(){return g(k,c,!0)})}),(l=a.j[k])&&3>l.$e?(!a.w&&++l.$e,l.Hd.$(a.w?.5:.25)):(a.a.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Hd.stop(),a.j[k]=null,f())}}g(b,c)})},NE=function(a,b){var c=a.l.getTextDisplayer();c&&c.setTextVisibility(b);c=a.l.g;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.a.debug("Could not set text track visibility",d)}},KE=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case CD:a.a.warn("The application does not have the privilege to set mute.",
30
- DD);break;default:a.a.warn(zD,c)}}},BE=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case CD:a.a.warn("The application doesn't have the privilege to get the mute state.",DD);break;default:a.a.warn(zD,c)}}return!!b},EE=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");FD(c,"load",function(d){return a(d)});FD(c,_.Zc,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},
31
- OE=function(){_.Ph.call(this);this.a=new uE(this);this.f=new ND(this);this.configuration=this.B=_.Xi();this.w=null;this.h=new _.G("clpp.tizen.Player");this.j=null;this.m=new bE;this.C=new _.mi;this.o=this.g=null;this.A=!1},PE=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.a.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,
32
- d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.h.debug("Could not apply dimension. Player state "+a.a.getState())},QE=function(){},RE=function(){this.a=null};
33
- GD.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.A(function(k){if(1==k.a){b=_.uj[a.h.env]||null;if(!b)throw a.g.debug(_.ta,_.ab+a.h.env+_.aa),new _.K(_.M,6,6015,_.ua+a.h.env+"' is missing.");a.o={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.wj(b,a.h.customData);(e=d[_.Hc])&&a.f.set(_.Hc,{Yc:e.licenseUrl||"",customData:c,Ge:!1});(f=d[_.Ic])&&a.f.set(_.Ic,{Yc:f.licenseUrl||"",customData:c,
34
- Ge:!1});if(0===a.f.size)throw new _.K(_.M,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Hc))a.a=_.Hc;else if(a.f.get(_.Ic))a.a=_.Ic;else throw new _.K(_.M,6,6001,"Configuration for the target system is missing.");return _.w(k,JD(a),2)}a.j=!0;_.z(k)})};GD.prototype.release=function(){var a=this;return _.A(function(b){a.j=!1;a.w=null;a.a=_.Ad;a.o=null;a.f=new Map;_.z(b)})};GD.prototype.getDrmInfo=function(){return this.w};
35
- var LD={ng:"DeleteLicenseAfterUse",og:"LicenseServer",Ej:"GetChallenge",Fj:"HttpHeader",Ij:"UserAgent",Aj:"Cookie",mg:"CustomData"};_.t=ND.prototype;_.t.initialize=function(){this.a.on(GE,this.pf,this);this.a.on(SE,this.nf,this);this.a.on(TE,this.mf,this);this.a.on(HE,this.Vf,this);this.a.on(JE,this.Uf,this);this.a.on(UE,this.qf,this)};_.t.release=function(){PD(this,_.Xl);this.m=!1;this.o=-1;this.h=2};_.t.destroy=function(){this.release();this.a.off(GE,this.pf);this.a.off(SE,this.nf);this.a.off(TE,this.mf);this.a.off(HE,this.Vf);this.a.off(JE,this.Uf);this.a.off(UE,this.qf);this.l=this.a=null};
36
- _.t.pf=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;PD(this,_.bm)};_.t.nf=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",OD(this.f))};_.t.mf=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.m){this.m=!0;var a=this.l.getConfiguration().autoplay,b=this.a.getState()===VE;if(!a&&b){PD(this,_.jm);return}}if(a=this.f!==_.im)a=this.a.getState(),a=a===QD||a===RD;a&&SD(this)};
37
- _.t.Vf=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===WE?PD(this,_.im):this.g.error("AVPlay prepares while state is not IDLE")};_.t.Uf=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.t.qf=function(){PD(this,_.dm)};_.t.getState=function(){return this.f};_.t=TD.prototype;_.t.initialize=function(a){this.l=a};
38
- _.t.load=function(a){var b=this,c,d,e,f,g,k,l;return _.A(function(m){switch(m.a){case 1:if(!b.l)return b.a.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.w(m,VD(b),2);case 2:c.j=m.f;if(!b.j)return b.a.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={networkingEngine:b.l.getNetworkEngine(),filterNewPeriod:function(){},filterAllPeriods:function(){},onTimelineCueAdded:function(){},onEvent:function(){},
39
- onError:function(){}};_.rf(m,3);e=b;return _.w(m,b.j.start(a.url,d),5);case 5:e.f=m.f;_.sf(m,4);break;case 3:return f=_.tf(m),b.a.warn(f),_.rf(m,6),g=b,_.w(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.f=m.f;_.sf(m,4);break;case 6:k=_.tf(m),b.a.error(k),b.f=null;case 4:if(!b.f||!UD(b.f)){m.H(0);break}b.h=WD(b);_.rf(m,10);return _.w(m,b.h.G,12);case 12:b.g=XD(b);l=b.l.getConfiguration();b.g.m=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;_.sf(m,0);break;case 10:_.tf(m),
40
- b.a.debug("Could not setup media source..."),b.h=null,b.g=null,b.j=null,b.f=null,_.z(m)}})};_.t.yh=function(a){this.a.debug(_.nu,a);this.w=!0;var b=_.lw(a.textStreams,this.o||"",this.A||"")[0]||null;this.m&&(a.textStreams.includes(this.m)&&(b=this.m),this.m=null);return{variant:null,text:b}};_.t.xh=function(){this.a.debug("canSwitch_");this.w=!1;this.m&&(_.Nx(this.g,this.m,!0,0),this.m=null)};_.t.S=function(){this.a.debug("onError_")};_.t.zh=function(){this.j&&this.j.update&&this.j.update()};
2
+ var f=function(window){var LE="An unknown error occurred while trying to get volume",ME="Cannot get loading rendition due to platform limitations",NE="PARAM_START_POSITION",OE="SecurityError",PE="The require privilege is: http://tizen.org/privilege/tv.audio",QE="|STARTBITRATE\x3d",RE=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},SE=function(a,b){this.h=a;this.w=null;this.a=_.Hd;this.o=null;this.j=!1;this.f=new Map;this.m=b;this.g=new _.H("clpp.tizen.DrmEngine")},VE=function(a){var b,
3
+ c,d;return _.A(function(e){if(1==e.a){b=a.a===_.Pc||a.a===_.Oc;if(!b)throw new _.L(_.M,6,6001,"The key system "+a.a+" is not supported by the player or the platform");c=a.f.get(a.a);if(!c.fd)throw new _.L(_.M,6,6012,"No license server given for "+a.a);_.xf(e,2);return a.a===_.Pc?_.y(e,TE(a),5):_.y(e,UE(a,c),5)}if(2!=e.a)return a.w={keySystem:a.a,licenseServerUri:c.fd,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Oe,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
4
+ keyIds:[],periodId:null},_.yf(e,0);d=_.zf(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.L(_.M,6,6005,{message:JSON.stringify(d)});})},UE=function(a,b){var c,d,e,f;return _.A(function(g){c=WE;d=XE;e={};e[d.wg]=!b.Oe;e[d.xg]=b.fd;""!==b.customData&&(e[d.vg]=b.customData);f=JSON.stringify(e);a.g.debug("PlayReady properties: ",f);try{webapis.avplay.setDrm(c.PLAYREADY,"SetProperties",f)}catch(h){throw h;}_.z(g)})},TE=function(a){var b;return _.A(function(c){b=WE;try{webapis.avplay.setDrm(b.qd,
5
+ "Initialize",""),webapis.avplay.setDrm(b.qd,"widevine_app_session",a.o.id),webapis.avplay.setDrm(b.qd,"widevine_data_type",a.o.type)}catch(d){throw d;}_.z(c)})},YE=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w,x,C,D,E;_.A(function(G){if(1==G.a){c=WE;d=a.f.get(a.a);a.g.debug("DRM Challenge data: ",b.challenge);e=atob(b.challenge);f=new Uint8Array(e.length);for(g=0;g<e.length;++g)f[g]=e.charCodeAt(g);h=b.serverurl&&""!==b.serverurl?b.serverurl:d.fd;l=_.Hh([h],_.Eh());l.type=3;l.body=f.buffer;l.method=
6
+ "POST";_.xf(G,2);return _.y(G,a.m.Ab.fetch(l).P,4)}if(2!=G.a){m=G.f;if(a.j){n=_.N(m.data);p=n.byteLength;q="";for(r=0;r<p;r++)q+=String.fromCharCode(n[r]);w=btoa(q);x=b.session_id+NE+(w+NE);a.g.debug("Widevine license params",x);try{webapis.avplay.setDrm(c.qd,"widevine_license_data",x)}catch(K){a.g.error("License response rejected by CDM"),C=new _.L(_.M,6,6008,{browserError:JSON.stringify(K)}),a.m.onError(C)}}return _.yf(G,0)}D=_.zf(G);a.g.error("License request failed.",JSON.stringify(D));E=new _.L(_.M,
7
+ 6,6007,{message:_.Ha,url:D.data.url,status:D.data.status||NaN,response:D.data.response||"",headers:D.data.headers||{}},D);a.m.onError(E);_.z(G)})},ZE=function(a){this.l=a;this.a=this.l.a;this.f=_.Om;this.j=_.Pm;this.w=(new Date).getTime();this.m=!1;this.o=-1;this.h=2;this.g=new _.H("clpp.tizen.StateManager")},aF=function(a,b){if(a.f!==b)if(a.f===_.Zm&&b!==_.Om)a.g.debug(_.Ru+$E(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Tm?(a.o=(new Date).getTime(),a.l.trigger(new _.I(_.tc,{detail:{bufferedTimeMS:-1,
8
+ reason:a.h}}))):a.j===_.Tm&&a.l.trigger(new _.I(_.sc,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));var d={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.l.trigger(new _.I(_.pe,{detail:d}));a.g.debug("State changed:",$E(a.j),"-\x3e",$E(a.f))}},$E=function(a){return Object.keys(_.Xm)[a]},dF=function(a){if(a.m){var b=a.a.getState(),c=a.f;switch(b){case bF:c=_.bn;break;case cF:c=_.an;break;default:a.l.isEnded()?c=_.Vm:a.g.debug("Inconsistent AVPlay playback state:",b)}aF(a,
9
+ c)}},eF=function(){this.o=this.A=this.g=this.h=this.B=this.l=this.j=this.f=null;this.w=!0;this.m=null;this.a=new _.H("clpp.tizen.TextStreamer")},fF=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},gF=function(a){var b,c;return _.A(function(d){if(1==d.a)return b=a.l.getConfiguration(),c=null,_.y(d,_.tp(a.B.url,a.l.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null),2);(c=d.f)&&c.configure(b.manifest);return d["return"](c)})},
10
+ hF=function(a){var b=document.createElement(_.Pe),c=new _.yw,d=new _.Jv(function(){return null}),e=a.l.getTextDisplayer();return new _.Ew(b,c,e,d,a.l.getConfiguration())},iF=function(a){var b={wb:function(){return a.l.getPosition()},W:a.h,Ab:a.l.getNetworkEngine(),He:a.Jh.bind(a),Ge:a.Ih.bind(a),onError:a.T.bind(a),Yf:function(){},onEvent:function(){},cg:a.Kh.bind(a),Nd:function(){},pe:function(){return new _.Hx},de:function(){return!1},Zc:null};return new _.By(a.f,b)},jF=function(a){var b=a.l.getPosition(),
11
+ c=null;a=_.u(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},kF=function(a){a.a.debug("getTextStreams()",a.f);if(a.f){var b=[],c=a.f.periods;a.a.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.a.debug(c[d].startTime,a.l.getPosition()),c[d].startTime<=a.l.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];for(d=c=0;d<a.length;d++){var e=new _.di(String(c++),_.P);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
12
+ a[d].kind||_.iv;var f=new _.li(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},lF=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.g){var b=_.Dy(a.g,_.Ae),c=null;if(b){a=kF(a);for(var d=0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},mF=function(a,b){a.a.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.f&&a.g)){a.setTextVisibility(!0);var c=jF(a),
13
+ d=b.renditions[0];(c=c.textStreams.find(function(e){return String(e.id)==d.id}))?(a.w?(a.a.debug("Switching period defer text selection"),a.m=c):(_.Ly(a.g,c,!0,0),a.l.trigger(new _.I(_.Dj))),a.o=c.language):a.a.error(_.Qu,d.id)}},nF=function(){this.h=this.f=this.l=null;this.g={};this.a=new _.H("clpp.tizen.TrackManager");this.w=this.m=this.j=null;this.A=!1;this.o=1},oF=function(a,b){a.l.trigger(new _.I(_.Te,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.f.o}}))},
14
+ pF=function(a){var b=a.ea();b&&a.l.trigger(new _.I(_.qc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},qF=function(a){var b=a.l.getConfiguration(),c=_.ai(b.preferredAudioLanguage||[]),d=a.g[_.Q]||[];if(d.length){var e=null;c.some(function(g){e=_.Dv(g,d.map(function(h){return h.language}));return!!e});if(e){var f=d.filter(function(g){return g.language===e});c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(function(g){return 0<=g.roles.indexOf(b.preferredAudioRole)}),
15
+ 0<f.length&&(c=f[0]));a.a.debug("Setting audio track with preferred language:",e);a.ra(c)}else a.a.debug("Preferred language(s) not available")}else a.a.debug("Could not set preferred audio language")},uF=function(a,b){if(b){var c=b.track.type.toUpperCase();rF(a.f,c,Number(b.id)).then(function(){c===sF&&(a.j=b,a.l.trigger(new _.I(_.Cj)));c===tF&&(a.m=b,a.l.trigger(new _.I(_.Dj)))})["catch"](function(){a.a.error("Could not select "+c+" track.")})}else a.a.debug("Must provide valid rendition")},vF=
16
+ function(a,b,c){var d=_.Fi(b.language||_.Ge);c.language=_.ei(d);c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.nc;a=new _.li(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},wF=function(a,b,c){c.mimeType=_.Re;a=new _.li(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},xF=function(a,b,c){b=_.Fi(b.track_lang||_.Ge);c.mimeType="text/ttml";c.language=
17
+ _.ei(b);c.kind=_.iv;return new _.li(String(a),c)},yF=function(a,b){var c=null;try{c=JSON.parse(b)}catch(d){a.a.warn("Couldn't retrieve extra infos from stream."),c=null}return c},BF=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===zF}),f=b.filter(function(n){return n.type===sF}),g=[],h=0;h<f.length;h++){var l=yF(a,f[h].extra_info);if(l){var m=_.Fi(l.language||_.Ge);
18
+ m=_.ei(m);m=c(g,m);m||(m=new _.di(String(a.o++),_.Q),g.push(m));m.renditions.push(vF(f[h].index,l,m))}else a.a.warn("Skipping audio stream with no extra info")}f=new _.di(String(a.o++),_.fi);for(h=0;h<e.length;h++)(l=yF(a,e[h].extra_info))?f.renditions.push(wF(e[h].index,l,f)):a.a.warn("Skipping video stream with no extra info");e=[];e=a.h?kF(a.h):AF(a,b);d[_.fi]=[f];d[_.Q]=g;d[_.P]=e;return d},AF=function(a,b){for(var c=b.filter(function(h){return h.type===tF}),d=[],e=0;e<c.length;e++){var f=yF(a,
19
+ c[e].extra_info);if(f){var g=new _.di(String(a.o++),_.P);g.renditions.push(xF(c[e].index,f,g));d.push(g)}else a.a.warn("Skipping text stream with no extra info")}return d},CF=function(a,b){for(var c=a.g[_.fi]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.J.va(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},DF=function(a,b,c){a=a.g[c]||[];b=String(b.index);c=null;for(var d=0;d<a.length;d++)for(var e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===
20
+ b){c=a[d].renditions[e];break}return c},FF=function(a,b){if(b===_.P&&a.h)return lF(a.h);var c=EF(a.f)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.fi&&(d=yF(a,c.extra_info),d=CF(a,{width:d.Width,height:d.Height}));b===_.Q&&(c?(d=DF(a,c,_.Q),a.j=d):d=a.j);b===_.P&&(c?(d=DF(a,c,_.P),a.m=d):d=a.m);return d},GF=function(a){_.Jj.call(this);this.l=a;this.h=null;this.a=new _.H("clpp.tizen.Middleware");this.C=1;this.B=!1;this.m=null;this.D=0;
21
+ this.o=!0;this.g=!1;this.f=null;this.A=1;this.w=!1;this.j={}},HF=function(a){return _.A(function(b){tizen.systeminfo.getPropertyValue("DISPLAY",function(c){a.A=c.resolutionWidth/1920;a.a.debug("Display resolution ratio: ",a.A)},function(c){a.a.debug("Could not load DISPLAY property");throw c;});_.z(b)})},JF=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Dh.bind(a),onbufferingprogress:a.Ch.bind(a),onbufferingcomplete:a.Bh.bind(a),onstreamcompleted:a.Gh.bind(a),oncurrentplaytime:function(b){a.trigger(new _.I(IF,
22
+ {currentTime:b}))},onevent:a.Fh.bind(a),onsubtitlechange:a.Hh.bind(a),ondrmevent:a.Eh.bind(a),onerror:a.T.bind(a)})}catch(b){a.a.error(b)}},KF=function(a){var b=!!a.l.getTrackManager().Ga();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.a.debug("Could not set AVPlay subtitle config",c)}},LF=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.a.debug({estimatedBandwidth:c,jk:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",QE+d)}catch(e){a.a.debug(e)}},
23
+ MF=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+QE+b)}catch(c){throw a.a.debug("Could not set fixed bandwidth",c),c;}},PF=function(a){return{position:a.getPosition(),state:a.l.getState(),lf:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:NF(a),volume:a.getVolume(),Nj:OF(a),Uh:EF(a)}},RF=function(a){var b,c;return _.A(function(d){if(1==d.a)return _.y(d,QF(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Li(e)).Z(5)}),
24
+ _.y(d,Promise.race([HF(a).then(function(){return!0}),b.then(function(){return!1})]),3);c=d.f;if(!c)return a.a.debug("Took to long for the SDK to be ready"),d["return"](Promise.reject("SDK Timeout"));_.z(d)})},XF=function(a,b,c){var d,e,f,g,h,l,m,n;return _.A(function(p){switch(p.a){case 1:a.m=_.fn(b);d=a.D;e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.a.debug("Loading manifest URL: "+a.m[d].url);f=b.startTime||void 0;a.g&&(a.trigger(new _.I(SF)),f=c.currentPosition);
25
+ _.xf(p,2);g=a.m[d].url;h=a.m[d].type;h!==_.bc||g.includes(".mpd")||(l=new URL(g),l.searchParams.append("cl-ext",".mpd"),g=l.toString());webapis.avplay.open(g);e.nextBandwidth?(MF(a,e.nextBandwidth),a.o=!1):(a.o||LF(a,e),a.o=!0);JF(a);if(!b.drm||!b.drm.env){a.a.debug("No DRM configuration was provided. Assuming clear content");p.H(4);break}m={onError:function(q){return a.l.onError(q)},Ab:a.l.getNetworkEngine()};a.h=new SE(b.drm,m);return _.y(p,a.h.init(),4);case 4:return a.g||a.trigger(new _.I(TF)),
26
+ _.y(p,UF(a),6);case 6:a.g||a.trigger(new _.I(VF));f&&typeof f===_.k&&0<f&&a.seek(f)["catch"](function(q){a.a.debug("Couldn't set start position",q)});a.g||(b.volume&&a.setVolume(b.volume),b.muted&&WF(a,b.muted),b.autoplay&&a.l.play()["catch"](function(q){a.a.debug("Autoplay failed",q)}));_.yf(p,0);break;case 2:throw n=_.zf(p),a.a.debug("Error while attempting to load source."),n;}})},UF=function(a){return _.A(function(b){a.a.debug("avplay.prepare()");return b["return"](new Promise(function(c,d){try{webapis.avplay.prepareAsync(function(){a.a.debug("AVPlay is ready!");
27
+ KF(a);c()},function(e){a.a.debug("prepareAsync failed",e);d(e)})}catch(e){a.a.debug("Failed to prepare media player for playback"),d(e)}}))})},YF=function(a,b,c){a.a.debug("switchVideoTrack()");try{var d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.f=PF(a);a.g=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.l.getConfiguration(),d).then(function(){var e=a.f.lf;a.g=!1;a.f=
28
+ null;return e===cF?a.pause():a.play()})}catch(e){return Promise.reject(e)}},OF=function(a){return a.g&&a.f?a.f.Nj:webapis.avplay.getTotalTrackInfo()},EF=function(a){return a.g&&a.f?a.f.Uh:webapis.avplay.getCurrentStreamInfo()},rF=function(a,b,c){b=b.toUpperCase();b===tF&&ZF(a,!0);var d=a.j[b];d&&(d.Pd.stop(),a.j[b]=null,a.a.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.a.debug("Could not set "+
29
+ h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,jf:0,Pd:new _.Li(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.jf?(!a.w&&++l.jf,l.Pd.Z(a.w?.5:.25)):(a.a.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Pd.stop(),a.j[h]=null,f())}}g(b,c)})},ZF=function(a,b){var c=a.l.getTextDisplayer();c&&c.setTextVisibility(b);c=a.l.g;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.a.debug("Could not set text track visibility",
30
+ d)}},WF=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case OE:a.a.warn("The application does not have the privilege to set mute.",PE);break;default:a.a.warn(LE,c)}}},NF=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case OE:a.a.warn("The application doesn't have the privilege to get the mute state.",PE);break;default:a.a.warn(LE,c)}}return!!b},QF=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
31
+ RE(c,"load",function(d){return a(d)});RE(c,_.fd,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},$F=function(){_.Jj.call(this);this.a=new GF(this);this.f=new ZE(this);this.configuration=this.B=_.Pj();this.w=null;this.h=new _.H("clpp.tizen.Player");this.j=null;this.m=new nF;this.C=new _.Yh;this.o=this.g=null;this.A=!1},aG=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();a=a.a;var c=Math.floor(b.left*a.A),d=Math.floor(b.top*
32
+ a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.a.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}else a.h.debug("Could not apply dimension. Player state "+a.a.getState())},bG=function(){},cG=function(){this.a=null};
33
+ SE.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.A(function(h){if(1==h.a){b=_.lk[a.h.env]||null;if(!b)throw a.g.debug(_.wa,_.gb+a.h.env+_.aa),new _.L(_.M,6,6015,_.ya+a.h.env+"' is missing.");a.o={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.nk(b,a.h.customData);(e=d[_.Oc])&&a.f.set(_.Oc,{fd:e.licenseUrl||"",customData:c,Oe:!1});(f=d[_.Pc])&&a.f.set(_.Pc,{fd:f.licenseUrl||"",customData:c,
34
+ Oe:!1});if(0===a.f.size)throw new _.L(_.M,6,6E3);if((g=a.h.preferredDrmSystem)&&a.f.get(g))a.a=g;else if(a.f.get(_.Oc))a.a=_.Oc;else if(a.f.get(_.Pc))a.a=_.Pc;else throw new _.L(_.M,6,6001,"Configuration for the target system is missing.");return _.y(h,VE(a),2)}a.j=!0;_.z(h)})};SE.prototype.release=function(){var a=this;return _.A(function(b){a.j=!1;a.w=null;a.a=_.Hd;a.o=null;a.f=new Map;_.z(b)})};SE.prototype.getDrmInfo=function(){return this.w};
35
+ var XE={wg:"DeleteLicenseAfterUse",xg:"LicenseServer",Yj:"GetChallenge",Zj:"HttpHeader",bk:"UserAgent",Uj:"Cookie",vg:"CustomData"};_.t=ZE.prototype;_.t.initialize=function(){this.a.on(SF,this.yf,this);this.a.on(dG,this.xf,this);this.a.on(eG,this.wf,this);this.a.on(TF,this.eg,this);this.a.on(VF,this.dg,this);this.a.on(fG,this.zf,this)};_.t.release=function(){aF(this,_.Om);this.m=!1;this.o=-1;this.h=2};_.t.destroy=function(){this.release();this.a.off(SF,this.yf);this.a.off(dG,this.xf);this.a.off(eG,this.wf);this.a.off(TF,this.eg);this.a.off(VF,this.dg);this.a.off(fG,this.zf);this.l=this.a=null};
36
+ _.t.yf=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;aF(this,_.Tm)};_.t.xf=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",$E(this.f))};_.t.wf=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.m){this.m=!0;var a=this.l.getConfiguration().autoplay,b=this.a.getState()===gG;if(!a&&b){aF(this,_.an);return}}if(a=this.f!==_.$m)a=this.a.getState(),a=a===bF||a===cF;a&&dF(this)};
37
+ _.t.eg=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===hG?aF(this,_.$m):this.g.error("AVPlay prepares while state is not IDLE")};_.t.dg=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.t.zf=function(){aF(this,_.Vm)};_.t.getState=function(){return this.f};_.t=eF.prototype;_.t.initialize=function(a){this.l=a};
38
+ _.t.load=function(a){var b=this,c,d,e,f,g,h,l;return _.A(function(m){switch(m.a){case 1:if(!b.l)return b.a.debug("Text streamer is not initialized. Will not load()"),m["return"]();b.B=a;c=b;return _.y(m,gF(b),2);case 2:c.j=m.f;if(!b.j)return b.a.debug("Could not find manifest parser for source. Make sure parsers are registered."),m["return"]();d={networkingEngine:b.l.getNetworkEngine(),filterNewPeriod:function(){},filterAllPeriods:function(){},onTimelineCueAdded:function(){},onEvent:function(){},
39
+ onError:function(){}};_.xf(m,3);e=b;return _.y(m,b.j.start(a.url,d),5);case 5:e.f=m.f;_.yf(m,4);break;case 3:return f=_.zf(m),b.a.warn(f),_.xf(m,6),g=b,_.y(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.f=m.f;_.yf(m,4);break;case 6:h=_.zf(m),b.a.error(h),b.f=null;case 4:if(!b.f||!fF(b.f)){m.H(0);break}b.h=hF(b);_.xf(m,10);return _.y(m,b.h.G,12);case 12:b.g=iF(b);l=b.l.getConfiguration();b.g.m=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;_.yf(m,0);break;case 10:_.zf(m),
40
+ b.a.debug("Could not setup media source..."),b.h=null,b.g=null,b.j=null,b.f=null,_.z(m)}})};_.t.Jh=function(a){this.a.debug(_.cv,a);this.w=!0;var b=_.jx(a.textStreams,this.o||"",this.A||"")[0]||null;this.m&&(a.textStreams.includes(this.m)&&(b=this.m),this.m=null);return{variant:null,text:b}};_.t.Ih=function(){this.a.debug("canSwitch_");this.w=!1;this.m&&(_.Ly(this.g,this.m,!0,0),this.m=null)};_.t.T=function(){this.a.debug("onError_")};_.t.Kh=function(){this.j&&this.j.update&&this.j.update()};
41
41
  _.t.start=function(){var a=this;return _.A(function(b){if(!a.g)return b["return"]();try{a.g.start()}catch(c){a.a.error("Error while starting streaming engine",c)}_.z(b)})};_.t.setTextVisibility=function(a){this.a.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)};_.t.release=function(){var a=this;return _.A(function(b){a.l=null;a.f=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.m=null;_.z(b)})};
42
- _.t.destroy=function(){var a=this;return _.A(function(b){switch(b.a){case 1:if(!a.j){b.H(2);break}return _.w(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.g){b.H(4);break}return _.w(b,a.g.destroy(),5);case 5:a.g=null,a.w=!0;case 4:if(!a.h){b.H(0);break}return _.w(b,a.h.destroy(),7);case 7:a.h=null,_.z(b)}})};_.v(bE,_.Q);_.t=bE.prototype;_.t.Lf=function(a){var b=a.eventid;a=a.data;switch(b){case XE:0<Object.keys(this.g).length||(this.a.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+mE(this,b[0].extra_info).Bit_rate,b=qE(this,{bandwidth:b}))&&(this.w=b,cE(this,b));break;case YE:dE(this);break;default:this.a.debug("Event type: "+b+" data: "+a)}};_.t.Ce=function(a){a.detail.currentState===_.km&&this.l.off(_.ie,this.Ce)};
43
- _.t.initialize=function(a){var b=this;this.l=a;this.f=this.l.a;this.l.on(_.ie,function(c){b.A||(c=c.detail,c.currentState===_.km&&(b.a.debug("Current state",c.currentState),b.A=!0,eE(b)))});this.f.on(ZE,this.Lf,this)};_.t.release=function(){this.g={};this.h=this.w=this.m=this.j=null;this.A=!1;this.o=1};
44
- _.t.load=function(){if(this.f&&!(0<Object.keys(this.g).length)){this.h=this.l.g;this.l.off(_.ie,this.Ce);this.l.on(_.ie,this.Ce,this);try{var a=CE(this.f);this.g=pE(this,a);var b=this.g[_.P]||[];b.length&&(this.j=b[0].renditions[0]||null);dE(this)}catch(c){this.a.debug("Could not load track manager")}}};_.t.destroy=function(){this.f.off(ZE,this.Lf);this.f=this.l=null};_.t.getVideoTracks=function(){return this.g[_.Bg]||[]};_.t.getAudioTracks=function(){return this.g[_.P]||[]};
45
- _.t.ea=function(){return this.g[_.N]||[]};_.t.fa=function(){return tE(this,_.Bg)};_.t.za=function(){return tE(this,_.P)};_.t.Ba=function(){return tE(this,_.N)};_.t.Qa=function(){return this.w};_.t.$a=function(){this.a.info(AD);return null};_.t.ab=function(){this.a.info(AD);return null};_.t.Ca=function(){var a=this.fa();return a?a.track:null};_.t.ia=function(){var a=this.za();return a?a.track:null};_.t.ja=function(){var a=this.Ba();return a?a.track:null};
46
- _.t.Xa=function(a){var b=this;null===a?(a=this.fa(),ME(this.f,a.bandwidth,null).then(function(){dE(b)})):0<a.renditions.length&&this.Wa(a.renditions[0])};_.t.na=function(a){a?iE(this,a.renditions[0]):this.a.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.t.ua=function(a){a?(a=a.renditions[0],this.h?aE(this.h,a.track):iE(this,a)):(this.a.debug("Disabling text tracks"),this.m=null,NE(this.f,!1),this.l.trigger(new _.I(_.Kh)))};
47
- _.t.Wa=function(a){var b=this,c=this.fa();this.f.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,cE(this,a),ME(this.f,c.bandwidth,a.bandwidth).then(function(){dE(b)})["catch"](function(d){var e=new _.K(_.M,7,7200,{tizenerror:d});b.a.debug("Error while switching video track",d);b.l.onError(e)})):this.a.debug("Trying to switch to already active rendition. Doing nothing...")};_.t.ib=function(a){iE(this,a)};_.t.jb=function(a){this.h?aE(this.h,a.track):iE(this,a)};
48
- _.t.addTextTrack=function(){};_.t.ka=function(){return this.f.o};bE.prototype.isAbrEnabled=bE.prototype.ka;bE.prototype.addTextTrack=bE.prototype.addTextTrack;bE.prototype.setTextRendition=bE.prototype.jb;bE.prototype.setAudioRendition=bE.prototype.ib;bE.prototype.setVideoRendition=bE.prototype.Wa;bE.prototype.setTextTrack=bE.prototype.ua;bE.prototype.setAudioTrack=bE.prototype.na;bE.prototype.setVideoTrack=bE.prototype.Xa;bE.prototype.getTextTrack=bE.prototype.ja;bE.prototype.getAudioTrack=bE.prototype.ia;
49
- bE.prototype.getVideoTrack=bE.prototype.Ca;bE.prototype.getLoadingTextRendition=bE.prototype.ab;bE.prototype.getLoadingAudioRendition=bE.prototype.$a;bE.prototype.getLoadingVideoRendition=bE.prototype.Qa;bE.prototype.getTextRendition=bE.prototype.Ba;bE.prototype.getAudioRendition=bE.prototype.za;bE.prototype.getVideoRendition=bE.prototype.fa;bE.prototype.getTextTracks=bE.prototype.ea;bE.prototype.getAudioTracks=bE.prototype.getAudioTracks;bE.prototype.getVideoTracks=bE.prototype.getVideoTracks;_.v(uE,_.Ph);_.t=uE.prototype;_.t.sh=function(){this.w=!0;this.g||this.trigger(new _.I(GE))};_.t.rh=function(a){this.w=!0;this.trigger(new _.I(SE,{percent:a}))};_.t.qh=function(){this.w=!1;this.trigger(new _.I(TE))};_.t.vh=function(){this.trigger(new _.I(UE))};_.t.uh=function(a,b){this.trigger(new _.I(ZE,{eventid:a,data:b}))};_.t.wh=function(a,b,c,d,e){this.trigger(new _.I($E,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
- _.t.th=function(a,b){this.trigger(new _.I(aF,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Ic&&"Challenge"===b.name)MD(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.K(_.M,6,6005,{message:JSON.stringify(b)});c.m.onError(d)}}};_.t.S=function(a){this.trigger(new _.I(bF,{eventType:a}))};
51
- _.t.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(wE,f,b);g=setTimeout(function(){b.off(wE,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===WE)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){yE(b);d(webapis.avplay.play())},function(f){b.trigger(new _.I(bF));e(f)})})).then(function(){return a()});if(c===RD||c===VE)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===QD?
52
- Promise.resolve():Promise.reject("Player is in invalid state")};_.t.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===RD?Promise.resolve():Promise.reject()};
53
- _.t.setPlaybackRate=function(a){var b=this.getState();if(b===VE||b===QD||b===RD){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.a.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.a.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.t.getPlaybackRate=function(){return this.C};
54
- _.t.load=function(a,b){var c=this,d;return _.A(function(e){switch(e.a){case 1:return c.a.debug("configure()",b||""),_.rf(e,2),_.w(e,FE(c),4);case 4:return _.w(e,LE(c,a,b),5);case 5:_.sf(e,0);break;case 2:throw d=_.tf(e),new _.K(_.M,7,7003,null,d);}})};_.t.getState=function(){if(this.g&&this.f)return this.f.bf;try{return webapis.avplay.getState()}catch(a){this.S(JSON.stringify(a))}};
55
- _.t.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.l.trigger(new _.I(_.Ee));webapis.avplay.seekTo(c,function(){b.B=!1;b.l.trigger(new _.I(_.De));d()},function(){b.B=!1;e()})})};_.t.getPosition=function(){if(this.g&&this.f)return this.f.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.S(JSON.stringify(a))}};_.t.getDuration=function(){if(this.g&&this.f)return this.f.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.S(JSON.stringify(a))}};
56
- _.t.release=function(){var a=this;return new Promise(function(b,c){try{a.h&&(a.h.release(),a.h=null);webapis.avplay.stop();webapis.avplay.close();for(var d in a.j){var e=a.j[d];e&&e.Hd.stop()}a.j={};a.C=1;a.B=!1;a.m=null;a.f=null;return b()}catch(f){return c(f)}})};_.t.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case CD:this.a.debug("The application does not have the privilege to get the volume.",DD);break;default:this.a.debug(zD,b)}}return a};
57
- _.t.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.a.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case CD:this.a.warn("The application does not have the privilege to set the volume.",DD);break;default:this.a.warn("An unknown error occurred while trying to set volume",b)}}};
58
- _.t.isLive=function(){if(this.g&&this.f)return this.f.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.S(JSON.stringify(a))}};_.t.stop=function(){try{webapis.avplay.stop()}catch(a){this.a.debug(a)}};_.t.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.t.setSourceIndex=function(a){this.D=a};_.t.getSourceIndex=function(){return this.D};_.t.getLoadedSource=function(){return this.m&&this.m[this.getSourceIndex()]};
59
- var WE="IDLE",VE="READY",QD="PLAYING",RD="PAUSED",nE="VIDEO",gE="AUDIO",hE="TEXT",YE="PLAYER_MSG_RESOLUTION_CHANGED",XE="PLAYER_MSG_BITRATE_CHANGE",KD={PLAYREADY:"PLAYREADY",Bj:"EME_PLAYREADY",Jj:"VERIMATRIX",jd:"WIDEVINE_CDM",Cj:"EME_WIDEVINE_CDM",Kj:"WIDEVINE_CLASSIC"};_.v(OE,_.Ph);_.t=OE.prototype;_.t.kf=function(){var a=this;this.h.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.I(_.Yc));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.h.debug("Could not loop playback")}):this.a.stop()};_.t.hf=function(a){this.trigger(new _.I(_.we,{currentTime:a.currentTime/1E3}))};
60
- _.t.lf=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.h.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.eh(d))&&this.o.append([new _.sg(b,c,d)],[])};_.t.jf=function(a){this.h.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.t.Nf=function(){this.A||(this.h.debug("Initial buffering completed..."),this.A=!0)};
61
- _.t.S=function(a){this.h.debug("Error: TYPE: "+a.eventType);PD(this.f,_.hm);a=new _.K(_.M,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.I(_.Zc,{detail:a}))};
62
- _.t.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(UE,this.kf,this);this.a.on(wE,this.hf,this);this.a.on($E,this.lf,this);this.a.on(aF,this.jf,this);this.a.on(bF,this.S,this);this.a.on(TE,this.Nf,this);this.f.initialize();this.m.initialize(this);this.h.debug("Initializing player surface");this.w.hideMediaElement();var c=cF;cF+=1;this.j=_.Km(_.Bd,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
63
- var e=[_.Xe,_.bd,"position",_.gd,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.u(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.Mm(c,f);PE(this)}};_.t.getSurface=function(){return this.w};_.t.getConfiguration=function(){return this.configuration};
64
- _.t.destroy=function(){var a=this;return _.A(function(b){switch(b.a){case 1:return _.w(b,a.release(),2);case 2:a.a.off(UE,a.kf);a.a.off(wE,a.hf);a.a.off($E,a.lf);a.a.off(aF,a.jf);a.a.off(bF,a.S);a.a.off(TE,a.Nf);if(!a.g){b.H(3);break}return _.w(b,a.g.destroy(),4);case 4:a.g=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.m.destroy(),a.f.destroy(),a.m=null,a.f=null,_.z(b)}})};_.t.namespace=function(){return dF};_.t.getPlaybackRate=function(){return this.a.getPlaybackRate()};
65
- _.t.setDrmCustomDataModifier=function(){};_.t.setCdnErrorCallback=function(){};_.t.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.t.getPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.dm?this.getDuration():this.a.getPosition()||0};_.t.seek=function(a){return typeof a===_.h&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};_.t.getPresentationStartTime=function(){return null};
66
- _.t.getSeekRange=function(){return{start:0,end:0}};_.t.getVolume=function(){var a=this.a.getVolume();return typeof a===_.h?a/100:null};_.t.setVolume=function(a){this.a.setVolume(a)};_.t.getDuration=function(){return this.a.getDuration()};_.t.getBufferInfo=function(){this.h.warn(_.na);return new _.Oh};_.t.getTrackManager=function(){return this.m};_.t.unload=function(){var a=this;return this.a.release().then(function(){a.m.release()})};
67
- _.t.release=function(){var a=this;return _.A(function(b){switch(b.a){case 1:if(!a.g){b.H(2);break}return _.w(b,a.g.release(),2);case 2:if(!a.o){b.H(4);break}return _.w(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.w(b,a.a.release(),6);case 6:a.m.release(),a.f.release(),a.A=!1,_.z(b)}})};
68
- _.t.load=function(a){var b=this,c,d,e,f,g;return _.A(function(k){switch(k.a){case 1:_.$i(a)&&(b.configuration=_.Zi(b.B,a));c=_.Kl(b.configuration,["html",_.zd]);b.o=c.create(b);d=_.tm(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){k.H(2);break}b.g=new TD;b.g.initialize(b);_.rf(k,3);return _.w(k,b.g.load(d),5);case 5:b.g.start();_.sf(k,2);break;case 3:f=_.tf(k),b.h.error(f);case 2:return _.rf(k,6),_.w(k,b.a.load(b.configuration),8);case 8:_.sf(k,7);break;
69
- case 6:throw g=_.tf(k),b.onError(g),g;case 7:b.m.load(),_.z(k)}})};_.t.play=function(){var a=this;this.trigger(new _.I(_.Pd));PE(this);return this.a.play().then(function(){SD(a.f)})};_.t.pause=function(){var a=this;return this.a.pause().then(function(){SD(a.f)})};_.t.getState=function(){return this.f.getState()};_.t.getPeriods=function(){return[]};_.t.onError=function(a){var b=new _.I(_.Zc,{detail:a});a.severity===_.M&&(PD(this.f,_.hm),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
70
- _.t.getDrmInfo=function(){return this.a.getDrmInfo()};_.t.isEnded=function(){return this.f.getState()===_.dm};_.t.isPaused=function(){return this.a.getState()===RD};_.t.isMuted=function(){return BE(this.a)};_.t.setMuted=function(a){KE(this.a,a)};_.t.getNetworkEngine=function(){return this.C};_.t.setNetworkEngine=function(a){this.C=a};_.t.isLive=function(){return this.a.isLive()};_.t.getStats=function(){return null};_.t.setSourceIndex=function(a){this.a.setSourceIndex(a)};_.t.getSourceIndex=function(){return this.a.getSourceIndex()};
71
- _.t.getLoadedSource=function(){return this.a.getLoadedSource()};_.t.canPlay=function(a,b){return(new QE).canPlay(a,b)};_.t.getTimelineCues=function(){return[]};_.t.getTextDisplayer=function(){return this.o};_.t.resetAbr=function(){};OE.prototype.getTextDisplayer=OE.prototype.getTextDisplayer;OE.prototype.setNetworkEngine=OE.prototype.setNetworkEngine;OE.prototype.getNetworkEngine=OE.prototype.getNetworkEngine;var dF="clpp.tizen",cF=0;QE.prototype.a=function(){return dF};
72
- QE.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.Tb||a===_.Zb||a===_.Yb)&&b){if(_.hi(2))return 2;if(_.hi(3)||_.hi(4)||_.hi(5)||_.hi(6))return _.D("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};QE.prototype.create=function(){return new OE};_.v(RE,_.Kn);RE.prototype.Da=function(){this.a=new QE;_.Qf(this.a)};RE.prototype.va=function(){if(this.a){var a=this.a.a();a&&_.Of[a]&&(delete _.Of[a],_.Pf.info("Removed Player factory: '"+a+"'"));this.a=null}};RE.prototype.id=function(){return"tizen"};_.B("clpp.tizen.TizenComponent",RE);var GE="onbufferingstart",SE="onbufferingprogress",TE="onbufferingcomplete",UE="onstreamcompleted",wE="oncurrentplaytime",ZE="onevent",$E="onsubtitlechange",aF="ondrmevent",bF="onerror",HE="preparingstart",JE="preparingend";};
42
+ _.t.destroy=function(){var a=this;return _.A(function(b){switch(b.a){case 1:if(!a.j){b.H(2);break}return _.y(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.g){b.H(4);break}return _.y(b,a.g.destroy(),5);case 5:a.g=null,a.w=!0;case 4:if(!a.h){b.H(0);break}return _.y(b,a.h.destroy(),7);case 7:a.h=null,_.z(b)}})};_.v(nF,_.R);_.t=nF.prototype;_.t.Vf=function(a){var b=a.eventid;a=a.data;switch(b){case iG:0<Object.keys(this.g).length||(this.a.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+yF(this,b[0].extra_info).Bit_rate,b=CF(this,{bandwidth:b}))&&(this.w=b,oF(this,b));break;case jG:pF(this);break;default:this.a.debug("Event type: "+b+" data: "+a)}};_.t.Ke=function(a){a.detail.currentState===_.bn&&this.l.off(_.pe,this.Ke)};
43
+ _.t.initialize=function(a){var b=this;this.l=a;this.f=this.l.a;this.l.on(_.pe,function(c){b.A||(c=c.detail,c.currentState===_.bn&&(b.a.debug("Current state",c.currentState),b.A=!0,qF(b)))});this.f.on(kG,this.Vf,this)};_.t.release=function(){this.g={};this.h=this.w=this.m=this.j=null;this.A=!1;this.o=1};
44
+ _.t.load=function(){if(this.f&&!(0<Object.keys(this.g).length)){this.h=this.l.g;this.l.off(_.pe,this.Ke);this.l.on(_.pe,this.Ke,this);try{var a=OF(this.f);this.g=BF(this,a);var b=this.g[_.Q]||[];b.length&&(this.j=b[0].renditions[0]||null);pF(this)}catch(c){this.a.debug("Could not load track manager")}}};_.t.destroy=function(){this.f.off(kG,this.Vf);this.f=this.l=null};_.t.getVideoTracks=function(){return this.g[_.fi]||[]};_.t.getAudioTracks=function(){return this.g[_.Q]||[]};
45
+ _.t.fa=function(){return this.g[_.P]||[]};_.t.ea=function(){return FF(this,_.fi)};_.t.Fa=function(){return FF(this,_.Q)};_.t.Ga=function(){return FF(this,_.P)};_.t.Ta=function(){return this.w};_.t.eb=function(){this.a.info(ME);return null};_.t.fb=function(){this.a.info(ME);return null};_.t.Ia=function(){var a=this.ea();return a?a.track:null};_.t.ka=function(){var a=this.Fa();return a?a.track:null};_.t.la=function(){var a=this.Ga();return a?a.track:null};
46
+ _.t.$a=function(a){var b=this;null===a?(a=this.ea(),YF(this.f,a.bandwidth,null).then(function(){pF(b)})):0<a.renditions.length&&this.Za(a.renditions[0])};_.t.ra=function(a){a?uF(this,a.renditions[0]):this.a.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")};_.t.Ba=function(a){a?(a=a.renditions[0],this.h?mF(this.h,a.track):uF(this,a)):(this.a.debug("Disabling text tracks"),this.m=null,ZF(this.f,!1),this.l.trigger(new _.I(_.Dj)))};
47
+ _.t.Za=function(a){var b=this,c=this.ea();this.f.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,oF(this,a),YF(this.f,c.bandwidth,a.bandwidth).then(function(){pF(b)})["catch"](function(d){var e=new _.L(_.M,7,7200,{tizenerror:d});b.a.debug("Error while switching video track",d);b.l.onError(e)})):this.a.debug("Trying to switch to already active rendition. Doing nothing...")};_.t.lb=function(a){uF(this,a)};_.t.mb=function(a){this.h?mF(this.h,a.track):uF(this,a)};
48
+ _.t.addTextTrack=function(){};_.t.ha=function(){return this.f.o};nF.prototype.isAbrEnabled=nF.prototype.ha;nF.prototype.addTextTrack=nF.prototype.addTextTrack;nF.prototype.setTextRendition=nF.prototype.mb;nF.prototype.setAudioRendition=nF.prototype.lb;nF.prototype.setVideoRendition=nF.prototype.Za;nF.prototype.setTextTrack=nF.prototype.Ba;nF.prototype.setAudioTrack=nF.prototype.ra;nF.prototype.setVideoTrack=nF.prototype.$a;nF.prototype.getTextTrack=nF.prototype.la;nF.prototype.getAudioTrack=nF.prototype.ka;
49
+ nF.prototype.getVideoTrack=nF.prototype.Ia;nF.prototype.getLoadingTextRendition=nF.prototype.fb;nF.prototype.getLoadingAudioRendition=nF.prototype.eb;nF.prototype.getLoadingVideoRendition=nF.prototype.Ta;nF.prototype.getTextRendition=nF.prototype.Ga;nF.prototype.getAudioRendition=nF.prototype.Fa;nF.prototype.getVideoRendition=nF.prototype.ea;nF.prototype.getTextTracks=nF.prototype.fa;nF.prototype.getAudioTracks=nF.prototype.getAudioTracks;nF.prototype.getVideoTracks=nF.prototype.getVideoTracks;_.v(GF,_.Jj);_.t=GF.prototype;_.t.Dh=function(){this.w=!0;this.g||this.trigger(new _.I(SF))};_.t.Ch=function(a){this.w=!0;this.trigger(new _.I(dG,{percent:a}))};_.t.Bh=function(){this.w=!1;this.trigger(new _.I(eG))};_.t.Gh=function(){this.trigger(new _.I(fG))};_.t.Fh=function(a,b){this.trigger(new _.I(kG,{eventid:a,data:b}))};_.t.Hh=function(a,b,c,d,e){this.trigger(new _.I(lG,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
50
+ _.t.Eh=function(a,b){this.trigger(new _.I(mG,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Pc&&"Challenge"===b.name)YE(c,b);else if("DrmError"===b.name){c.g.debug("DrmError event",b);var d=new _.L(_.M,6,6005,{message:JSON.stringify(b)});c.m.onError(d)}}};_.t.T=function(a){this.trigger(new _.I(nG,{eventType:a}))};
51
+ _.t.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(IF,f,b);g=setTimeout(function(){b.off(IF,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===hG)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){KF(b);d(webapis.avplay.play())},function(f){b.trigger(new _.I(nG));e(f)})})).then(function(){return a()});if(c===cF||c===gG)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===bF?
52
+ Promise.resolve():Promise.reject("Player is in invalid state")};_.t.pause=function(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===cF?Promise.resolve():Promise.reject()};
53
+ _.t.setPlaybackRate=function(a){var b=this.getState();if(b===gG||b===bF||b===cF){try{webapis.avplay.setSpeed(a),this.C=a}catch(c){return this.a.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.a.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.t.getPlaybackRate=function(){return this.C};
54
+ _.t.load=function(a,b){var c=this,d;return _.A(function(e){switch(e.a){case 1:return c.a.debug("configure()",b||""),_.xf(e,2),_.y(e,RF(c),4);case 4:return _.y(e,XF(c,a,b),5);case 5:_.yf(e,0);break;case 2:throw d=_.zf(e),new _.L(_.M,7,7003,null,d);}})};_.t.getState=function(){if(this.g&&this.f)return this.f.lf;try{return webapis.avplay.getState()}catch(a){this.T(JSON.stringify(a))}};
55
+ _.t.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.l.trigger(new _.I(_.Le));webapis.avplay.seekTo(c,function(){b.B=!1;b.l.trigger(new _.I(_.Ke));d()},function(){b.B=!1;e()})})};_.t.getPosition=function(){if(this.g&&this.f)return this.f.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.T(JSON.stringify(a))}};_.t.getDuration=function(){if(this.g&&this.f)return this.f.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.T(JSON.stringify(a))}};
56
+ _.t.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.Pd.stop()}a.j={};a.C=1;a.B=!1;a.m=null;a.f=null;return b()}catch(f){return c(f)}})};_.t.getVolume=function(){var a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case OE:this.a.debug("The application does not have the privilege to get the volume.",PE);break;default:this.a.debug(LE,b)}}return a};
57
+ _.t.setVolume=function(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.a.warn("Invalid value passed for setVolume.","The passed value value should be in the range of 0 to 1.");break;case OE:this.a.warn("The application does not have the privilege to set the volume.",PE);break;default:this.a.warn("An unknown error occurred while trying to set volume",b)}}};
58
+ _.t.isLive=function(){if(this.g&&this.f)return this.f.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.T(JSON.stringify(a))}};_.t.stop=function(){try{webapis.avplay.stop()}catch(a){this.a.debug(a)}};_.t.getDrmInfo=function(){this.h&&this.h.getDrmInfo();return null};_.t.setSourceIndex=function(a){this.D=a};_.t.getSourceIndex=function(){return this.D};_.t.getLoadedSource=function(){return this.m&&this.m[this.getSourceIndex()]};
59
+ var hG="IDLE",gG="READY",bF="PLAYING",cF="PAUSED",zF="VIDEO",sF="AUDIO",tF="TEXT",jG="PLAYER_MSG_RESOLUTION_CHANGED",iG="PLAYER_MSG_BITRATE_CHANGE",WE={PLAYREADY:"PLAYREADY",Vj:"EME_PLAYREADY",ck:"VERIMATRIX",qd:"WIDEVINE_CDM",Wj:"EME_WIDEVINE_CDM",dk:"WIDEVINE_CLASSIC"};_.v($F,_.Jj);_.t=$F.prototype;_.t.uf=function(){var a=this;this.h.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.I(_.ed));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.h.debug("Could not loop playback")}):this.a.stop()};_.t.sf=function(a){this.trigger(new _.I(_.De,{currentTime:a.currentTime/1E3}))};
60
+ _.t.vf=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.h.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Bh(d))&&this.o.append([new _.xg(b,c,d)],[])};_.t.tf=function(a){this.h.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.t.Xf=function(){this.A||(this.h.debug("Initial buffering completed..."),this.A=!0)};
61
+ _.t.T=function(a){this.h.debug("Error: TYPE: "+a.eventType);aF(this.f,_.Zm);a=new _.L(_.M,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.I(_.fd,{detail:a}))};
62
+ _.t.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(fG,this.uf,this);this.a.on(IF,this.sf,this);this.a.on(lG,this.vf,this);this.a.on(mG,this.tf,this);this.a.on(nG,this.T,this);this.a.on(eG,this.Xf,this);this.f.initialize();this.m.initialize(this);this.h.debug("Initializing player surface");this.w.hideMediaElement();var c=oG;oG+=1;this.j=_.xn(_.Id,{id:"__clpp_tizen_player_"+c,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var d=this.w.getMedia();if(d){c=this.j;
63
+ var e=[_.df,_.id,"position",_.od,"top"],f={};d=null!==d.parentElement?window.getComputedStyle(d,null):d.style;if(!e||0===e.length){e||(e=[]);for(var g in d)e.push(g)}g=_.u(e);for(e=g.next();!e.done;e=g.next())e=e.value,f[e]=d[e];_.zn(c,f);aG(this)}};_.t.getSurface=function(){return this.w};_.t.getConfiguration=function(){return this.configuration};
64
+ _.t.destroy=function(){var a=this;return _.A(function(b){switch(b.a){case 1:return _.y(b,a.release(),2);case 2:a.a.off(fG,a.uf);a.a.off(IF,a.sf);a.a.off(lG,a.vf);a.a.off(mG,a.tf);a.a.off(nG,a.T);a.a.off(eG,a.Xf);if(!a.g){b.H(3);break}return _.y(b,a.g.destroy(),4);case 4:a.g=null;case 3:a.j&&(a.j.parentElement.removeChild(a.j),a.j=null),a.m.destroy(),a.f.destroy(),a.m=null,a.f=null,_.z(b)}})};_.t.namespace=function(){return pG};_.t.getPlaybackRate=function(){return this.a.getPlaybackRate()};
65
+ _.t.setDrmCustomDataModifier=function(){};_.t.setCdnErrorCallback=function(){};_.t.setPlaybackRate=function(a){this.a.setPlaybackRate(a)};_.t.getPosition=function(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.Vm?this.getDuration():this.a.getPosition()||0};_.t.seek=function(a){return typeof a===_.k&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()};_.t.getPresentationStartTime=function(){return null};
66
+ _.t.getSeekRange=function(){return{start:0,end:0}};_.t.getVolume=function(){var a=this.a.getVolume();return typeof a===_.k?a/100:null};_.t.setVolume=function(a){this.a.setVolume(a)};_.t.getDuration=function(){return this.a.getDuration()};_.t.getBufferInfo=function(){this.h.warn(_.sa);return new _.Ij};_.t.getTrackManager=function(){return this.m};_.t.unload=function(){var a=this;return this.a.release().then(function(){a.m.release()})};
67
+ _.t.release=function(){var a=this;return _.A(function(b){switch(b.a){case 1:if(!a.g){b.H(2);break}return _.y(b,a.g.release(),2);case 2:if(!a.o){b.H(4);break}return _.y(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.y(b,a.a.release(),6);case 6:a.m.release(),a.f.release(),a.A=!1,_.z(b)}})};
68
+ _.t.load=function(a){var b=this,c,d,e,f,g;return _.A(function(h){switch(h.a){case 1:_.Sj(a)&&(b.configuration=_.Rj(b.B,a));c=_.xm(b.configuration,["html","native"]);b.o=c.create(b);d=_.fn(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.H(2);break}b.g=new eF;b.g.initialize(b);_.xf(h,3);return _.y(h,b.g.load(d),5);case 5:b.g.start();_.yf(h,2);break;case 3:f=_.zf(h),b.h.error(f);case 2:return _.xf(h,6),_.y(h,b.a.load(b.configuration),8);case 8:_.yf(h,7);break;
69
+ case 6:throw g=_.zf(h),b.onError(g),g;case 7:b.m.load(),_.z(h)}})};_.t.play=function(){var a=this;this.trigger(new _.I(_.Wd));aG(this);return this.a.play().then(function(){dF(a.f)})};_.t.pause=function(){var a=this;return this.a.pause().then(function(){dF(a.f)})};_.t.getState=function(){return this.f.getState()};_.t.getPeriods=function(){return[]};_.t.onError=function(a){var b=new _.I(_.fd,{detail:a});a.severity===_.M&&(aF(this.f,_.Zm),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)};
70
+ _.t.getDrmInfo=function(){return this.a.getDrmInfo()};_.t.isEnded=function(){return this.f.getState()===_.Vm};_.t.isPaused=function(){return this.a.getState()===cF};_.t.isMuted=function(){return NF(this.a)};_.t.setMuted=function(a){WF(this.a,a)};_.t.getNetworkEngine=function(){return this.C};_.t.setNetworkEngine=function(a){this.C=a};_.t.isLive=function(){return this.a.isLive()};_.t.getStats=function(){return null};_.t.setSourceIndex=function(a){this.a.setSourceIndex(a)};_.t.getSourceIndex=function(){return this.a.getSourceIndex()};
71
+ _.t.getLoadedSource=function(){return this.a.getLoadedSource()};_.t.canPlay=function(a,b){return(new bG).canPlay(a,b)};_.t.getTimelineCues=function(){return[]};_.t.getTextDisplayer=function(){return this.o};_.t.resetAbr=function(){};$F.prototype.getTextDisplayer=$F.prototype.getTextDisplayer;$F.prototype.setNetworkEngine=$F.prototype.setNetworkEngine;$F.prototype.getNetworkEngine=$F.prototype.getNetworkEngine;var pG="clpp.tizen",oG=0;bG.prototype.a=function(){return pG};
72
+ bG.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.bc||a===_.tj||a===_.gc)&&b){if(_.Th(2))return 2;if(_.Th(3)||_.Th(4)||_.Th(5)||_.Th(6))return _.F("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};bG.prototype.create=function(){return new $F};_.v(cG,_.zo);cG.prototype.Ja=function(){this.a=new bG;_.Xf(this.a)};cG.prototype.Ca=function(){if(this.a){var a=this.a.a();a&&_.Uf[a]&&(delete _.Uf[a],_.Wf.info("Removed Player factory: '"+a+"'"));this.a=null}};cG.prototype.id=function(){return"tizen"};_.B("clpp.tizen.TizenComponent",cG);var SF="onbufferingstart",dG="onbufferingprogress",eG="onbufferingcomplete",fG="onstreamcompleted",IF="oncurrentplaytime",kG="onevent",lG="onsubtitlechange",mG="ondrmevent",nG="onerror",TF="preparingstart",VF="preparingend";};
73
73
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
74
74
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
75
75
  else{_=this.clpp._;(f.call(g,this));}