@castlabs/prestoplay 6.4.0 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +110 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +421 -402
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +54 -133
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +47 -49
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -32
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +258 -255
- package/cjs/cl.muxdata.js +12 -12
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +69 -69
- package/cjs/cl.thumbnails.js +24 -24
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +20 -20
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +363 -351
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +49 -132
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +40 -40
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +16 -16
- package/cl.mse.js +230 -231
- package/cl.muxdata.js +8 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -58
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -16
- package/package.json +8 -2
package/cjs/cl.thumbnails.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
var e=b+c;return
|
|
4
|
-
c;this.x=d;this.y=e;this.width=f;this.height=g;this.
|
|
5
|
-
b.time,b.duration)})},
|
|
6
|
-
b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{
|
|
7
|
-
|
|
8
|
-
this.height*(this.
|
|
9
|
-
|
|
10
|
-
f);a.
|
|
11
|
-
|
|
12
|
-
this.o=e[1];else throw new _.L(_.M,7,7100,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
h=String.fromCharCode.apply(null,
|
|
16
|
-
}).then(function(){
|
|
17
|
-
|
|
18
|
-
h);r=
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Promise.reject();var d=c.getSegmentReference(b);if(d){var e
|
|
22
|
-
b);return Promise.reject()};
|
|
23
|
-
|
|
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=
|
|
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();
|
|
2
|
+
var f=function(window){var Et="No thumbnail duration or URL specified",Ft="No thumbnail found for position ",Gt="Position is out of range: ",Ht="Thumbnail URL is mandatory",It="Wrong gridSize format",Jt="clpp.thumbnails",Kt=function(){this.log=new _.H(Jt);this.g=null;this.a=[];this.w=!1},Mt=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Jd&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Lt(a,0,e,!!f)})},Promise.resolve())},Lt=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();
|
|
3
|
+
var e=b+c;return Nt(a,d).then(function(){return a.a[b].load()}).then(function(){return Lt(a,e,c,d)})},Nt=function(a,b){return new Promise(function(c){if(b||a.g.getState()!==_.Um)c();else a.g.one(_.sc,function(){c()})})},Ot=function(a,b){return b>=a.time&&b<a.time+a.duration},Pt=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.ia=p;this.Th=h;this.Hj=l;this.ni=m;this.oi=n;this.Pb=null},Qt=function(){Kt.call(this);this.f=null;this.o=this.h=1;this.j=0},Rt=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Tf=new _.Nh},St=function(){this.g=new _.H(Jt);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.Nh},Tt=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Tf.resolve()})},Vt=function(a,b){return Ut(a,b).then(function(c){return new Pt(c,
|
|
5
|
+
b.time,b.duration)})},Ut=function(a,b){return b.load().then(function(){var c=_.N(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+_.bk(c)})},Wt=function(){Kt.call(this);this.f=null},Xt=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},Yt=function(){Kt.apply(this,arguments)},Zt=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},$t=function(a,b){var c=a.horizontalTiles||
|
|
6
|
+
b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{dd:c,gf:d,Mf:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},au=function(){this.f=new _.H(Jt);this.a=this.l=null},bu=function(a){return a.some(function(b){return 0<b.thumbStreams.length})},cu=function(a){if(!a)return null;a=new _.ni(a);return a.path.match(/.*\.vtt$/i)?"WEBVTT":a.path.match(/.*\.bif$/i)?"BIF":a.path.match(/.*\.(png|jpg|jpeg)$/i)?"SINGLE":null},du=function(){};Kt.prototype.init=function(a,b){var c=this;this.g=a;a.one(_.ee,function(){c.w=!0});a.isLive()||this.m().then(function(){b&&b.preload&&Mt(c,b.preload)})};Pt.prototype.raw=function(){return this.ia.cloneNode(!1)};
|
|
7
|
+
Pt.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(_.Wc);e.style.width=c+_.be;e.style.height=d+_.be;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.ia.naturalWidth||this.ia.width))+"px "+Math.ceil(d/
|
|
8
|
+
this.height*(this.ia.naturalHeight||this.ia.height))+_.be;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.be;e.style.backgroundPositionY="-"+f*d+_.be;return e};
|
|
9
|
+
Pt.prototype.load=function(){var a=this;this.Pb||(this.Pb=new Promise(function(b,c){function d(){a.width||(a.width=(a.ia.naturalWidth||a.ia.width)/a.Th);a.height||(a.height=(a.ia.naturalHeight||a.ia.height)/a.Hj);a.x||(a.x=a.width*a.ni);a.y||(a.y=a.height*a.oi)}if(a.ia.src&&a.ia.complete)d(),b(a);else{var e=null,f=function(){d();a.ia.removeEventListener("load",f);a.ia.removeEventListener(_.gd,e);b(a)};e=function(){a.ia.removeEventListener("load",f);a.ia.removeEventListener(_.gd,e);c()};a.ia.addEventListener("load",
|
|
10
|
+
f);a.ia.addEventListener(_.gd,e);a.ia.src=a.src}}));return this.Pb};_.C("clpp.thumbnails.Thumbnail",Pt);Pt.prototype.load=Pt.prototype.load;Pt.prototype.element=Pt.prototype.element;Pt.prototype.raw=Pt.prototype.raw;_.v(Qt,Kt);
|
|
11
|
+
Qt.prototype.init=function(a,b){if(!b||!b.url)throw new _.L(_.M,7,7100,Ht);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(Et,c,d),new _.L(_.M,7,7100,Et);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,It);}catch(f){throw this.log.error("Error during parsing gridSize",f),new _.L(_.M,7,7100,It);}Kt.prototype.init.call(this,a,b)};Qt.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(Gt+a);var d=this.a[c];return d?d.load().then(function(){return d}):Promise.reject(Ft+a+" at index "+c)};
|
|
13
|
+
Qt.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 Pt(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()};Rt.prototype.load=function(){return this.Tf};
|
|
14
|
+
St.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.L(_.M,7,7100,Ht);var d=b.url,e=_.Ih(d);e.type=_.Hh;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,eu),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 Rt(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(){Tt(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))})};St.prototype.get=function(a){var b=this;return 0>a?Promise.reject(Gt+a):this.h.then(function(){for(var c=0;c<b.a.length;c++){var d=b.a[c];if(Ot(d,a))return Vt(b,d).then(function(e){return e.load().then(function(){return e})})}return Promise.reject(Ft+a)})};var eu=[137,66,73,70,13,10,26,10];_.v(Wt,Kt);
|
|
17
|
+
Wt.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.L(_.M,7,7100,Ht);var d=b.url,e=_.Ih(d);e.type=_.Hh;this.f=a.getNetworkEngine().fetch(e).P.then(function(f){if(f=f.data){f=_.ph(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=Xt(l[0]);l=Xt(l[1])-r;c.a.push(new Pt(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))});Kt.prototype.init.call(this,a,b)};
|
|
19
|
+
Wt.prototype.get=function(a){var b=this;return 0>a?Promise.reject(Gt+a):this.f.then(function(){for(var c={},d=0;d<b.a.length;c={Pc:c.Pc},d++)if(c.Pc=b.a[d],Ot(c.Pc,a))return c.Pc.load().then(function(e){return function(){return e.Pc}}(c));return Promise.reject(Ft+a)})};Wt.prototype.m=function(){return this.f};_.v(Yt,Kt);
|
|
20
|
+
Yt.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=Zt(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=$t(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.Mf+a]);else if((c=d.Ha())&&0<c.length){var g=0,h=0;d=d.startTime;1<e.Mf&&(g=a%e.dd,h=Math.floor(a/e.dd),d+=a*e.durationPerTile);f=new Pt(c[0],d,e.durationPerTile,void 0,void 0,void 0,void 0,e.dd,e.gf,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()};Yt.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
|
|
23
|
+
Yt.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&&!_.K.S(d=b.getSegmentReference(c++));)for(var e=$t(d,b),f=d.Ha()[0],g=new Image,h=d.startTime,l=0;l<e.gf;++l)for(var m=0;m<e.dd;++m)this.a.push(new Pt(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.dd,e.gf,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.t=au.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=cu(d.url||null)),c&&("SINGLE"===c||"GRID"===c?this.a=new Qt:"WEBVTT"===c?this.a=new Wt:"BIF"===c&&(this.a=new St)),this.a&&(this.f.info("Loading thumbs configuration",d),this.l.one(_.vd,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();bu(d)&&(this.a=new Yt,this.a.init(a,c))}};_.t.get=function(a){return this.a?this.a.get(a):Promise.reject()};_.t.id=function(){return"thumbnails"};_.C("clpp.thumbnails.ThumbnailsPlugin",au);au.prototype.get=au.prototype.get;au.Id="thumbnails";du.prototype.create=function(){return new au};_.wo(new du);};
|
|
26
26
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
27
27
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
28
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
|
|
3
|
-
c,d;return _.
|
|
4
|
-
keyIds:[],periodId:null},_.
|
|
5
|
-
"Initialize",""),webapis.avplay.setDrm(b.
|
|
6
|
-
"POST";_.
|
|
7
|
-
6,6007,{message:_.
|
|
8
|
-
reason:a.h}}))):a.j===_.
|
|
9
|
-
c)}},
|
|
10
|
-
document.createElement(_.
|
|
11
|
-
_.u(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c},
|
|
12
|
-
_.
|
|
13
|
-
(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):(_.
|
|
14
|
-
a.
|
|
15
|
-
a.a.debug("Setting audio track with preferred language:",e);a.
|
|
16
|
-
_.
|
|
17
|
-
c)},
|
|
18
|
-
_.
|
|
19
|
-
_.
|
|
20
|
-
|
|
21
|
-
1;this.w=!1;this.j={}},
|
|
22
|
-
onevent:a.
|
|
23
|
-
b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+
|
|
24
|
-
_.
|
|
25
|
-
_.
|
|
26
|
-
_.
|
|
27
|
-
|
|
28
|
-
null;return e===
|
|
29
|
-
h+" track. Trying again...AVPlay state: "+(a.getState()+", buffering: ")+a.w,n),!1===m&&(a.j[h]={type:h,index:l,
|
|
30
|
-
d)}},
|
|
31
|
-
|
|
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())},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
_.t.
|
|
37
|
-
_.t.
|
|
38
|
-
_.t.load=function(a){var b=this,c,d,e,f,g,h,l;return _.
|
|
39
|
-
onError:function(){}};_.
|
|
40
|
-
b.a.debug("Could not setup media source..."),b.h=null,b.g=null,b.j=null,b.f=null,_.z(m)}})};_.t.
|
|
41
|
-
_.t.start=function(){var a=this;return _.
|
|
42
|
-
_.t.destroy=function(){var a=this;return _.
|
|
43
|
-
_.t.initialize=function(a){var b=this;this.l=a;this.f=this.l.a;this.l.on(_.
|
|
44
|
-
_.t.load=function(){if(this.f&&!(0<Object.keys(this.g).length)){this.h=this.l.g;this.l.off(_.
|
|
45
|
-
_.t.
|
|
46
|
-
_.t
|
|
47
|
-
_.t
|
|
48
|
-
_.t.addTextTrack=function(){};_.t.
|
|
49
|
-
|
|
50
|
-
_.t.
|
|
51
|
-
_.t.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(
|
|
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()===
|
|
53
|
-
_.t.setPlaybackRate=function(a){var b=this.getState();if(b===
|
|
54
|
-
_.t.load=function(a,b){var c=this,d;return _.
|
|
55
|
-
_.t.seek=function(a){var b=this,c=1E3*a;return new Promise(function(d,e){b.B=!0;b.l.trigger(new _.J(_.
|
|
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.
|
|
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
|
|
58
|
-
_.t.isLive=function(){if(this.g&&this.f)return this.f.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.
|
|
59
|
-
var
|
|
60
|
-
_.t.
|
|
61
|
-
_.t.
|
|
62
|
-
_.t.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(
|
|
63
|
-
var e=[_.
|
|
64
|
-
_.t.destroy=function(){var a=this;return _.
|
|
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()===_.
|
|
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(_.
|
|
67
|
-
_.t.release=function(){var a=this;return _.
|
|
68
|
-
_.t.load=function(a){var b=this,c,d,e,f,g;return _.
|
|
69
|
-
case 6:throw g=_.
|
|
70
|
-
_.t.getDrmInfo=function(){return this.a.getDrmInfo()};_.t.isEnded=function(){return this.f.getState()===_.
|
|
71
|
-
_.t.getLoadedSource=function(){return this.a.getLoadedSource()};_.t.canPlay=function(a,b){return(new
|
|
72
|
-
|
|
2
|
+
var f=function(window){var QE="An unknown error occurred while trying to get volume",RE="Cannot get loading rendition due to platform limitations",SE="PARAM_START_POSITION",TE="SecurityError",UE="The require privilege is: http://tizen.org/privilege/tv.audio",VE="|STARTBITRATE\x3d",WE=function(a,b,c){function d(e){c.call(a,e);a.removeEventListener(b,d)}a.addEventListener(b,d)},XE=function(a,b){this.h=a;this.o=null;this.a=_.Id;this.m=null;this.j=!1;this.f=new Map;this.C=b;this.g=new _.H("clpp.tizen.DrmEngine")},$E=function(a){var b,
|
|
3
|
+
c,d;return _.B(function(e){if(1==e.a){b=a.a===_.Qc||a.a===_.Pc;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.hd)throw new _.L(_.M,6,6012,"No license server given for "+a.a);_.yf(e,2);return a.a===_.Qc?_.x(e,YE(a),5):_.x(e,ZE(a,c),5)}if(2!=e.a)return a.o={keySystem:a.a,licenseServerUri:c.hd,distinctiveIdentifierRequired:!1,persistentStateRequired:c.Qe,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],
|
|
4
|
+
keyIds:[],periodId:null},_.zf(e,0);d=_.Af(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.L(_.M,6,6005,{message:JSON.stringify(d)});})},ZE=function(a,b){var c,d,e,f;return _.B(function(g){c=aF;d=bF;e={};e[d.zg]=!b.Qe;e[d.Ag]=b.hd;""!==b.customData&&(e[d.yg]=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)})},YE=function(a){var b;return _.B(function(c){b=aF;try{webapis.avplay.setDrm(b.sd,
|
|
5
|
+
"Initialize",""),webapis.avplay.setDrm(b.sd,"widevine_app_session",a.m.id),webapis.avplay.setDrm(b.sd,"widevine_data_type",a.m.type)}catch(d){throw d;}_.z(c)})},cF=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w,y,A,E,F;_.B(function(D){if(1==D.a){c=aF;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.hd;l=_.Ih([h],_.Fh());l.type=3;l.body=f.buffer;l.method=
|
|
6
|
+
"POST";_.yf(D,2);return _.x(D,a.C.Ab.fetch(l).P,4)}if(2!=D.a){m=D.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);y=b.session_id+SE+(w+SE);a.g.debug("Widevine license params",y);try{webapis.avplay.setDrm(c.sd,"widevine_license_data",y)}catch(I){a.g.error("License response rejected by CDM"),A=new _.L(_.M,6,6008,{browserError:JSON.stringify(I)}),a.C.onError(A)}}return _.zf(D,0)}E=_.Af(D);a.g.error("License request failed.",JSON.stringify(E));F=new _.L(_.M,
|
|
7
|
+
6,6007,{message:_.Ia,url:E.data.url,status:E.data.status||NaN,response:E.data.response||"",headers:E.data.headers||{}},E);a.C.onError(F);_.z(D)})},dF=function(a){this.l=a;this.a=this.l.a;this.f=_.Pm;this.j=_.Qm;this.w=(new Date).getTime();this.m=!1;this.o=-1;this.h=2;this.g=new _.H("clpp.tizen.StateManager")},fF=function(a,b){if(a.f!==b)if(a.f===_.$m&&b!==_.Pm)a.g.debug(_.Vu+eF(b));else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Um?(a.o=(new Date).getTime(),a.l.trigger(new _.J(_.tc,{detail:{bufferedTimeMS:-1,
|
|
8
|
+
reason:a.h}}))):a.j===_.Um&&a.l.trigger(new _.J(_.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 _.J(_.re,{detail:d}));a.g.debug("State changed:",eF(a.j),"-\x3e",eF(a.f))}},eF=function(a){return Object.keys(_.Ym)[a]},iF=function(a){if(a.m){var b=a.a.getState(),c=a.f;switch(b){case gF:c=_.cn;break;case hF:c=_.bn;break;default:a.l.isEnded()?c=_.Wm:a.g.debug("Inconsistent AVPlay playback state:",b)}fF(a,
|
|
9
|
+
c)}},jF=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")},kF=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},lF=function(a){var b,c;return _.B(function(d){if(1==d.a)return b=a.l.getConfiguration(),c=null,_.x(d,_.vp(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
|
+
mF=function(a){var b=document.createElement(_.Qe),c=new _.Cw,d=new _.Nv(function(){return null}),e=a.l.getTextDisplayer();return new _.Iw(b,c,e,d,a.l.getConfiguration())},nF=function(a){var b={wb:function(){return a.l.getPosition()},X:a.h,Ab:a.l.getNetworkEngine(),Je:a.Lh.bind(a),Ie:a.Kh.bind(a),onError:a.U.bind(a),ag:function(){},onEvent:function(){},fg:a.Mh.bind(a),Pd:function(){},re:function(){return new _.Lx},fe:function(){return!1},bd:null};return new _.Fy(a.f,b)},oF=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},pF=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 _.ei(String(c++),_.P);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=
|
|
12
|
+
a[d].kind||_.mv;var f=new _.mi(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},qF=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.g){var b=_.Hy(a.g,_.Be),c=null;if(b){a=pF(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},rF=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=oF(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):(_.Sy(a.g,c,!0,0),a.l.trigger(new _.J(_.Ej))),a.o=c.language):a.a.error(_.Uu,d.id)}},sF=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},tF=function(a,b){a.l.trigger(new _.J(_.Ue,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.f.o}}))},
|
|
14
|
+
uF=function(a){var b=a.ga();b&&a.l.trigger(new _.J(_.qc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},vF=function(a){var b=a.l.getConfiguration(),c=_.bi(b.preferredAudioLanguage||[]),d=a.g[_.Q]||[];if(d.length){var e=null;c.some(function(g){e=_.Hv(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.sa(c)}else a.a.debug("Preferred language(s) not available")}else a.a.debug("Could not set preferred audio language")},zF=function(a,b){if(b){var c=b.track.type.toUpperCase();wF(a.f,c,Number(b.id)).then(function(){c===xF&&(a.j=b,a.l.trigger(new _.J(_.Dj)));c===yF&&(a.m=b,a.l.trigger(new _.J(_.Ej)))})["catch"](function(){a.a.error("Could not select "+c+" track.")})}else a.a.debug("Must provide valid rendition")},AF=
|
|
16
|
+
function(a,b,c){var d=_.Gi(b.language||_.He);c.language=_.fi(d);c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.nc;a=new _.mi(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;return a},BF=function(a,b,c){c.mimeType=_.Se;a=new _.mi(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},CF=function(a,b,c){b=_.Gi(b.track_lang||_.He);c.mimeType="text/ttml";c.language=
|
|
17
|
+
_.fi(b);c.kind=_.mv;return new _.mi(String(a),c)},DF=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},GF=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===EF}),f=b.filter(function(n){return n.type===xF}),g=[],h=0;h<f.length;h++){var l=DF(a,f[h].extra_info);if(l){var m=_.Gi(l.language||_.He);
|
|
18
|
+
m=_.fi(m);m=c(g,m);m||(m=new _.ei(String(a.o++),_.Q),g.push(m));m.renditions.push(AF(f[h].index,l,m))}else a.a.warn("Skipping audio stream with no extra info")}f=new _.ei(String(a.o++),_.gi);for(h=0;h<e.length;h++)(l=DF(a,e[h].extra_info))?f.renditions.push(BF(e[h].index,l,f)):a.a.warn("Skipping video stream with no extra info");e=[];e=a.h?pF(a.h):FF(a,b);d[_.gi]=[f];d[_.Q]=g;d[_.P]=e;return d},FF=function(a,b){for(var c=b.filter(function(h){return h.type===yF}),d=[],e=0;e<c.length;e++){var f=DF(a,
|
|
19
|
+
c[e].extra_info);if(f){var g=new _.ei(String(a.o++),_.P);g.renditions.push(CF(c[e].index,f,g));d.push(g)}else a.a.warn("Skipping text stream with no extra info")}return d},HF=function(a,b){for(var c=a.g[_.gi]||[],d=[],e=0;e<c.length;e++)for(var f=0;f<c[e].renditions.length;f++)_.K.va(c[e].renditions[f],b,Object.keys(b))&&d.push(c[e].renditions[f]);return d[0]||null},IF=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},KF=function(a,b){if(b===_.P&&a.h)return qF(a.h);var c=JF(a.f)||[];if(0===c.length)return null;c=c.filter(function(e){return e.type===b.toUpperCase()})[0];var d=null;b===_.gi&&(d=DF(a,c.extra_info),d=HF(a,{width:d.Width,height:d.Height}));b===_.Q&&(c?(d=IF(a,c,_.Q),a.j=d):d=a.j);b===_.P&&(c?(d=IF(a,c,_.P),a.m=d):d=a.m);return d},LF=function(a){_.Kj.call(this);this.l=a;this.h=null;this.a=new _.H("clpp.tizen.Middleware");this.D=1;this.B=!1;this.m=null;this.F=0;
|
|
21
|
+
this.o=!0;this.g=!1;this.f=null;this.A=1;this.w=!1;this.j={}},MF=function(a){return _.B(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)})},OF=function(a){try{webapis.avplay.setListener({onbufferingstart:a.Fh.bind(a),onbufferingprogress:a.Eh.bind(a),onbufferingcomplete:a.Dh.bind(a),onstreamcompleted:a.Ih.bind(a),oncurrentplaytime:function(b){a.trigger(new _.J(NF,
|
|
22
|
+
{currentTime:b}))},onevent:a.Hh.bind(a),onsubtitlechange:a.Jh.bind(a),ondrmevent:a.Gh.bind(a),onerror:a.U.bind(a)})}catch(b){a.a.error(b)}},PF=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)}},QF=function(a,b){try{var c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.a.debug({estimatedBandwidth:c,mk:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",VE+d)}catch(e){a.a.debug(e)}},
|
|
23
|
+
RF=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+VE+b)}catch(c){throw a.a.debug("Could not set fixed bandwidth",c),c;}},UF=function(a){return{position:a.getPosition(),state:a.l.getState(),nf:a.getState(),playbackRate:a.getPlaybackRate(),isLive:a.isLive(),duration:a.getDuration(),isMuted:SF(a),volume:a.getVolume(),Pj:TF(a),Wh:JF(a)}},WF=function(a){var b,c;return _.B(function(d){if(1==d.a)return _.x(d,VF(),2);if(3!=d.a)return b=new Promise(function(e){(new _.Ni(e)).Z(5)}),
|
|
24
|
+
_.x(d,Promise.race([MF(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)})},bG=function(a,b,c){var d,e,f,g,h,l,m,n;return _.B(function(p){switch(p.a){case 1:a.m=_.gn(b);d=a.F;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 _.J(XF)),f=c.currentPosition);
|
|
25
|
+
_.yf(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?(RF(a,e.nextBandwidth),a.o=!1):(a.o||QF(a,e),a.o=!0);OF(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 XE(b.drm,m);return _.x(p,a.h.init(),4);case 4:return a.g||a.trigger(new _.J(YF)),
|
|
26
|
+
_.x(p,ZF(a),6);case 6:a.g||a.trigger(new _.J($F));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&&aG(a,b.muted),b.autoplay&&a.l.play()["catch"](function(q){a.a.debug("Autoplay failed",q)}));_.zf(p,0);break;case 2:throw n=_.Af(p),a.a.debug("Error while attempting to load source."),n;}})},ZF=function(a){return _.B(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
|
+
PF(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)}}))})},cG=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=UF(a);a.g=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.l.getConfiguration(),d).then(function(){var e=a.f.nf;a.g=!1;a.f=
|
|
28
|
+
null;return e===hF?a.pause():a.play()})}catch(e){return Promise.reject(e)}},TF=function(a){return a.g&&a.f?a.f.Pj:webapis.avplay.getTotalTrackInfo()},JF=function(a){return a.g&&a.f?a.f.Wh:webapis.avplay.getCurrentStreamInfo()},wF=function(a,b,c){b=b.toUpperCase();b===yF&&dG(a,!0);var d=a.j[b];d&&(d.Rd.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,lf:0,Rd:new _.Ni(function(){return g(h,c,!0)})}),(l=a.j[h])&&3>l.lf?(!a.w&&++l.lf,l.Rd.Z(a.w?.5:.25)):(a.a.debug("Could not set track after multiple attempts.Giving up..."),l&&l.Rd.stop(),a.j[h]=null,f())}}g(b,c)})},dG=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)}},aG=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case TE:a.a.warn("The application does not have the privilege to set mute.",UE);break;default:a.a.warn(QE,c)}}},SF=function(a){var b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case TE:a.a.warn("The application doesn't have the privilege to get the mute state.",UE);break;default:a.a.warn(QE,c)}}return!!b},VF=function(){return new Promise(function(a,b){if(window.webapis)a();else{var c=document.createElement("script");
|
|
31
|
+
WE(c,"load",function(d){return a(d)});WE(c,_.gd,function(d){return b(d)});c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},eG=function(){_.Kj.call(this);this.a=new LF(this);this.f=new dF(this);this.configuration=this.B=_.Qj();this.w=null;this.h=new _.H("clpp.tizen.Player");this.j=null;this.m=new sF;this.D=new _.Zh;this.o=this.g=null;this.A=!1},fG=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())},gG=function(){},hG=function(){this.a=null};
|
|
33
|
+
XE.prototype.init=function(){var a=this,b,c,d,e,f,g;return _.B(function(h){if(1==h.a){b=_.mk[a.h.env]||null;if(!b)throw a.g.debug(_.xa,_.gb+a.h.env+_.aa),new _.L(_.M,6,6015,_.ya+a.h.env+"' is missing.");a.m={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";d=_.ok(b,a.h.customData);(e=d[_.Pc])&&a.f.set(_.Pc,{hd:e.licenseUrl||"",customData:c,Qe:!1});(f=d[_.Qc])&&a.f.set(_.Qc,{hd:f.licenseUrl||"",customData:c,
|
|
34
|
+
Qe:!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(_.Pc))a.a=_.Pc;else if(a.f.get(_.Qc))a.a=_.Qc;else throw new _.L(_.M,6,6001,"Configuration for the target system is missing.");return _.x(h,$E(a),2)}a.j=!0;_.z(h)})};XE.prototype.release=function(){var a=this;return _.B(function(b){a.j=!1;a.o=null;a.a=_.Id;a.m=null;a.f=new Map;_.z(b)})};XE.prototype.getDrmInfo=function(){return this.o};
|
|
35
|
+
var bF={zg:"DeleteLicenseAfterUse",Ag:"LicenseServer",ak:"GetChallenge",bk:"HttpHeader",ek:"UserAgent",Xj:"Cookie",yg:"CustomData"};_.t=dF.prototype;_.t.initialize=function(){this.a.on(XF,this.Af,this);this.a.on(iG,this.zf,this);this.a.on(jG,this.yf,this);this.a.on(YF,this.hg,this);this.a.on($F,this.gg,this);this.a.on(kG,this.Bf,this)};_.t.release=function(){fF(this,_.Pm);this.m=!1;this.o=-1;this.h=2};_.t.destroy=function(){this.release();this.a.off(XF,this.Af);this.a.off(iG,this.zf);this.a.off(jG,this.yf);this.a.off(YF,this.hg);this.a.off($F,this.gg);this.a.off(kG,this.Bf);this.l=this.a=null};
|
|
36
|
+
_.t.Af=function(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;fF(this,_.Um)};_.t.zf=function(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",eF(this.f))};_.t.yf=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()===lG;if(!a&&b){fF(this,_.bn);return}}if(a=this.f!==_.an)a=this.a.getState(),a=a===gF||a===hF;a&&iF(this)};
|
|
37
|
+
_.t.hg=function(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===mG?fF(this,_.an):this.g.error("AVPlay prepares while state is not IDLE")};_.t.gg=function(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())};_.t.Bf=function(){fF(this,_.Wm)};_.t.getState=function(){return this.f};_.t=jF.prototype;_.t.initialize=function(a){this.l=a};
|
|
38
|
+
_.t.load=function(a){var b=this,c,d,e,f,g,h,l;return _.B(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 _.x(m,lF(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(){}};_.yf(m,3);e=b;return _.x(m,b.j.start(a.url,d),5);case 5:e.f=m.f;_.zf(m,4);break;case 3:return f=_.Af(m),b.a.warn(f),_.yf(m,6),g=b,_.x(m,b.j.start(a.url.replace("https://","http://"),d),8);case 8:g.f=m.f;_.zf(m,4);break;case 6:h=_.Af(m),b.a.error(h),b.f=null;case 4:if(!b.f||!kF(b.f)){m.H(0);break}b.h=mF(b);_.yf(m,10);return _.x(m,b.h.I,12);case 12:b.g=nF(b);l=b.l.getConfiguration();b.g.j=l.streaming;b.o=l.preferredTextLanguage;b.A=l.preferredTextRole;_.zf(m,0);break;case 10:_.Af(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.Lh=function(a){this.a.debug(_.gv,a);this.w=!0;var b=_.nx(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.Kh=function(){this.a.debug("canSwitch_");this.w=!1;this.m&&(_.Sy(this.g,this.m,!0,0),this.m=null)};_.t.U=function(){this.a.debug("onError_")};_.t.Mh=function(){this.j&&this.j.update&&this.j.update()};
|
|
41
|
+
_.t.start=function(){var a=this;return _.B(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 _.B(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 _.B(function(b){switch(b.a){case 1:if(!a.j){b.H(2);break}return _.x(b,a.j.stop(),3);case 3:a.j=null;case 2:if(!a.g){b.H(4);break}return _.x(b,a.g.destroy(),5);case 5:a.g=null,a.w=!0;case 4:if(!a.h){b.H(0);break}return _.x(b,a.h.destroy(),7);case 7:a.h=null,_.z(b)}})};_.v(sF,_.R);_.t=sF.prototype;_.t.Yf=function(a){var b=a.eventid;a=a.data;switch(b){case nG:0<Object.keys(this.g).length||(this.a.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+DF(this,b[0].extra_info).Bit_rate,b=HF(this,{bandwidth:b}))&&(this.w=b,tF(this,b));break;case oG:uF(this);break;default:this.a.debug("Event type: "+b+" data: "+a)}};_.t.Me=function(a){a.detail.currentState===_.cn&&this.l.off(_.re,this.Me)};
|
|
43
|
+
_.t.initialize=function(a){var b=this;this.l=a;this.f=this.l.a;this.l.on(_.re,function(c){b.A||(c=c.detail,c.currentState===_.cn&&(b.a.debug("Current state",c.currentState),b.A=!0,vF(b)))});this.f.on(pG,this.Yf,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(_.re,this.Me);this.l.on(_.re,this.Me,this);try{var a=TF(this.f);this.g=GF(this,a);var b=this.g[_.Q]||[];b.length&&(this.j=b[0].renditions[0]||null);uF(this)}catch(c){this.a.debug("Could not load track manager")}}};_.t.destroy=function(){this.f.off(pG,this.Yf);this.f=this.l=null};_.t.getVideoTracks=function(){return this.g[_.gi]||[]};_.t.getAudioTracks=function(){return this.g[_.Q]||[]};
|
|
45
|
+
_.t.ha=function(){return this.g[_.P]||[]};_.t.ga=function(){return KF(this,_.gi)};_.t.Fa=function(){return KF(this,_.Q)};_.t.Ga=function(){return KF(this,_.P)};_.t.Ua=function(){return this.w};_.t.fb=function(){this.a.info(RE);return null};_.t.gb=function(){this.a.info(RE);return null};_.t.Ia=function(){var a=this.ga();return a?a.track:null};_.t.ma=function(){var a=this.Fa();return a?a.track:null};_.t.na=function(){var a=this.Ga();return a?a.track:null};
|
|
46
|
+
_.t.ab=function(a){var b=this;null===a?(a=this.ga(),cG(this.f,a.bandwidth,null).then(function(){uF(b)})):0<a.renditions.length&&this.$a(a.renditions[0])};_.t.sa=function(a){a?zF(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?rF(this.h,a.track):zF(this,a)):(this.a.debug("Disabling text tracks"),this.m=null,dG(this.f,!1),this.l.trigger(new _.J(_.Ej)))};
|
|
47
|
+
_.t.$a=function(a){var b=this,c=this.ga();this.f.o||a.width!==c.width||a.height!==c.height||a.bandwidth!==c.bandwidth?(this.w=a,tF(this,a),cG(this.f,c.bandwidth,a.bandwidth).then(function(){uF(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.mb=function(a){zF(this,a)};_.t.nb=function(a){this.h?rF(this.h,a.track):zF(this,a)};
|
|
48
|
+
_.t.addTextTrack=function(){};_.t.ja=function(){return this.f.o};sF.prototype.isAbrEnabled=sF.prototype.ja;sF.prototype.addTextTrack=sF.prototype.addTextTrack;sF.prototype.setTextRendition=sF.prototype.nb;sF.prototype.setAudioRendition=sF.prototype.mb;sF.prototype.setVideoRendition=sF.prototype.$a;sF.prototype.setTextTrack=sF.prototype.Ba;sF.prototype.setAudioTrack=sF.prototype.sa;sF.prototype.setVideoTrack=sF.prototype.ab;sF.prototype.getTextTrack=sF.prototype.na;sF.prototype.getAudioTrack=sF.prototype.ma;
|
|
49
|
+
sF.prototype.getVideoTrack=sF.prototype.Ia;sF.prototype.getLoadingTextRendition=sF.prototype.gb;sF.prototype.getLoadingAudioRendition=sF.prototype.fb;sF.prototype.getLoadingVideoRendition=sF.prototype.Ua;sF.prototype.getTextRendition=sF.prototype.Ga;sF.prototype.getAudioRendition=sF.prototype.Fa;sF.prototype.getVideoRendition=sF.prototype.ga;sF.prototype.getTextTracks=sF.prototype.ha;sF.prototype.getAudioTracks=sF.prototype.getAudioTracks;sF.prototype.getVideoTracks=sF.prototype.getVideoTracks;_.v(LF,_.Kj);_.t=LF.prototype;_.t.Fh=function(){this.w=!0;this.g||this.trigger(new _.J(XF))};_.t.Eh=function(a){this.w=!0;this.trigger(new _.J(iG,{percent:a}))};_.t.Dh=function(){this.w=!1;this.trigger(new _.J(jG))};_.t.Ih=function(){this.trigger(new _.J(kG))};_.t.Hh=function(a,b){this.trigger(new _.J(pG,{eventid:a,data:b}))};_.t.Jh=function(a,b,c,d,e){this.trigger(new _.J(qG,{duration:a,text:b,subtitleType:c,attriCount:d,attributes:e}))};
|
|
50
|
+
_.t.Gh=function(a,b){this.trigger(new _.J(rG,{drmType:a,drmData:b}));if(this.h){var c=this.h;if(c.j)if(c.a===_.Qc&&"Challenge"===b.name)cF(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.C.onError(d)}}};_.t.U=function(a){this.trigger(new _.J(sG,{eventType:a}))};
|
|
51
|
+
_.t.play=function(){function a(){return new Promise(function(d,e){function f(){d();clearTimeout(g)}var g=null;b.one(NF,f,b);g=setTimeout(function(){b.off(NF,f);e("Timeout")},3E4)})}var b=this,c=this.getState();if(c===mG)return(new Promise(function(d,e){webapis.avplay.prepareAsync(function(){PF(b);d(webapis.avplay.play())},function(f){b.trigger(new _.J(sG));e(f)})})).then(function(){return a()});if(c===hF||c===lG)try{return webapis.avplay.play(),a()}catch(d){return Promise.reject(d)}return c===gF?
|
|
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()===hF?Promise.resolve():Promise.reject()};
|
|
53
|
+
_.t.setPlaybackRate=function(a){var b=this.getState();if(b===lG||b===gF||b===hF){try{webapis.avplay.setSpeed(a),this.D=a}catch(c){return this.a.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.D)}return!0}this.a.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1};_.t.getPlaybackRate=function(){return this.D};
|
|
54
|
+
_.t.load=function(a,b){var c=this,d;return _.B(function(e){switch(e.a){case 1:return c.a.debug("configure()",b||""),_.yf(e,2),_.x(e,WF(c),4);case 4:return _.x(e,bG(c,a,b),5);case 5:_.zf(e,0);break;case 2:throw d=_.Af(e),new _.L(_.M,7,7003,null,d);}})};_.t.getState=function(){if(this.g&&this.f)return this.f.nf;try{return webapis.avplay.getState()}catch(a){this.U(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 _.J(_.Me));webapis.avplay.seekTo(c,function(){b.B=!1;b.l.trigger(new _.J(_.Le));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.U(JSON.stringify(a))}};_.t.getDuration=function(){if(this.g&&this.f)return this.f.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.U(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.Rd.stop()}a.j={};a.D=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 TE:this.a.debug("The application does not have the privilege to get the volume.",UE);break;default:this.a.debug(QE,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 TE:this.a.warn("The application does not have the privilege to set the volume.",UE);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.U(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.F=a};_.t.getSourceIndex=function(){return this.F};_.t.getLoadedSource=function(){return this.m&&this.m[this.getSourceIndex()]};
|
|
59
|
+
var mG="IDLE",lG="READY",gF="PLAYING",hF="PAUSED",EF="VIDEO",xF="AUDIO",yF="TEXT",oG="PLAYER_MSG_RESOLUTION_CHANGED",nG="PLAYER_MSG_BITRATE_CHANGE",aF={PLAYREADY:"PLAYREADY",Yj:"EME_PLAYREADY",fk:"VERIMATRIX",sd:"WIDEVINE_CDM",Zj:"EME_WIDEVINE_CDM",gk:"WIDEVINE_CLASSIC"};_.v(eG,_.Kj);_.t=eG.prototype;_.t.wf=function(){var a=this;this.h.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.J(_.fd));this.configuration.loop?this.seek(this.configuration.startTime||0)["catch"](function(){a.h.debug("Could not loop playback")}):this.a.stop()};_.t.uf=function(a){this.trigger(new _.J(_.Ee,{currentTime:a.currentTime/1E3}))};
|
|
60
|
+
_.t.xf=function(a){var b=this.a.getPosition(),c=b+a.duration/1E3,d=a.text||"";this.h.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Ch(d))&&this.o.append([new _.yg(b,c,d)],[])};_.t.vf=function(a){this.h.debug("DRM event: "+a.drmType+", data: "+a.drmData)};_.t.$f=function(){this.A||(this.h.debug("Initial buffering completed..."),this.A=!0)};
|
|
61
|
+
_.t.U=function(a){this.h.debug("Error: TYPE: "+a.eventType);fF(this.f,_.$m);a=new _.L(_.M,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.J(_.gd,{detail:a}))};
|
|
62
|
+
_.t.init=function(a,b){this.configuration=this.B=b;this.w=a;this.a.on(kG,this.wf,this);this.a.on(NF,this.uf,this);this.a.on(qG,this.xf,this);this.a.on(rG,this.vf,this);this.a.on(sG,this.U,this);this.a.on(jG,this.$f,this);this.f.initialize();this.m.initialize(this);this.h.debug("Initializing player surface");this.w.hideMediaElement();var c=tG;tG+=1;this.j=_.zn(_.Jd,{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=[_.ef,_.jd,"position",_.pd,"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];_.Bn(c,f);fG(this)}};_.t.getSurface=function(){return this.w};_.t.getConfiguration=function(){return this.configuration};
|
|
64
|
+
_.t.destroy=function(){var a=this;return _.B(function(b){switch(b.a){case 1:return _.x(b,a.release(),2);case 2:a.a.off(kG,a.wf);a.a.off(NF,a.uf);a.a.off(qG,a.xf);a.a.off(rG,a.vf);a.a.off(sG,a.U);a.a.off(jG,a.$f);if(!a.g){b.H(3);break}return _.x(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 uG};_.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()===_.Wm?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 _.Jj};_.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 _.B(function(b){switch(b.a){case 1:if(!a.g){b.H(2);break}return _.x(b,a.g.release(),2);case 2:if(!a.o){b.H(4);break}return _.x(b,a.o.destroy(),5);case 5:a.o=null;case 4:return _.x(b,a.a.release(),6);case 6:a.m.release(),a.f.release(),a.A=!1,_.z(b)}})};
|
|
68
|
+
_.t.load=function(a){var b=this,c,d,e,f,g;return _.B(function(h){switch(h.a){case 1:_.Tj(a)&&(b.configuration=_.Sj(b.B,a));c=_.ym(b.configuration,["html","native"]);b.o=c.create(b);d=_.gn(b.configuration)[0];e=!!b.configuration.tizen&&b.configuration.tizen.sideStreamText;if(!e){h.H(2);break}b.g=new jF;b.g.initialize(b);_.yf(h,3);return _.x(h,b.g.load(d),5);case 5:b.g.start();_.zf(h,2);break;case 3:f=_.Af(h),b.h.error(f);case 2:return _.yf(h,6),_.x(h,b.a.load(b.configuration),8);case 8:_.zf(h,7);break;
|
|
69
|
+
case 6:throw g=_.Af(h),b.onError(g),g;case 7:b.m.load(),_.z(h)}})};_.t.play=function(){var a=this;this.trigger(new _.J(_.Xd));fG(this);return this.a.play().then(function(){iF(a.f)})};_.t.pause=function(){var a=this;return this.a.pause().then(function(){iF(a.f)})};_.t.getState=function(){return this.f.getState()};_.t.getPeriods=function(){return[]};_.t.onError=function(a){var b=new _.J(_.gd,{detail:a});a.severity===_.M&&(fF(this.f,_.$m),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()===_.Wm};_.t.isPaused=function(){return this.a.getState()===hF};_.t.isMuted=function(){return SF(this.a)};_.t.setMuted=function(a){aG(this.a,a)};_.t.getNetworkEngine=function(){return this.D};_.t.setNetworkEngine=function(a){this.D=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 gG).canPlay(a,b)};_.t.getTimelineCues=function(){return[]};_.t.getTextDisplayer=function(){return this.o};_.t.resetAbr=function(){};eG.prototype.getTextDisplayer=eG.prototype.getTextDisplayer;eG.prototype.setNetworkEngine=eG.prototype.setNetworkEngine;eG.prototype.getNetworkEngine=eG.prototype.getNetworkEngine;var uG="clpp.tizen",tG=0;gG.prototype.a=function(){return uG};
|
|
72
|
+
gG.prototype.canPlay=function(a){a=a.type;var b=!!window.webapis;if((a===_.bc||a===_.uj||a===_.gc)&&b){if(_.Uh(2))return 2;if(_.Uh(3)||_.Uh(4)||_.Uh(5)||_.Uh(6))return _.G("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0};gG.prototype.create=function(){return new eG};_.v(hG,_.Bo);hG.prototype.Ja=function(){this.a=new gG;_.$f(this.a)};hG.prototype.Ca=function(){if(this.a){var a=this.a.a();a&&_.Wf[a]&&(delete _.Wf[a],_.Xf.info("Removed Player factory: '"+a+"'"));this.a=null}};hG.prototype.id=function(){return"tizen"};_.C("clpp.tizen.TizenComponent",hG);var XF="onbufferingstart",iG="onbufferingprogress",jG="onbufferingcomplete",kG="onstreamcompleted",NF="oncurrentplaytime",pG="onevent",qG="onsubtitlechange",rG="ondrmevent",sG="onerror",YF="preparingstart",$F="preparingend";};
|
|
73
73
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
74
74
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
75
75
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.ttml.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
e.a)return e.getAttribute(c)}return null},
|
|
4
|
-
0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},
|
|
5
|
-
|
|
6
|
-
b,c){
|
|
7
|
-
Number(a[2]):null},
|
|
8
|
-
a.o,a.w,a.g,a.a,a.h,a.f)}).filter(function(b){return null!=b})},
|
|
9
|
-
g={},
|
|
10
|
-
a},
|
|
11
|
-
"color",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.v(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!
|
|
19
|
-
"monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
b+=h}for(;f.a;)a=f.next(),a=
|
|
24
|
-
_.
|
|
25
|
-
(a.a=c.getId()),c=a.j,-1===["#text","span","br"].indexOf(
|
|
26
|
-
_.
|
|
27
|
-
case _.
|
|
28
|
-
|
|
2
|
+
var f=function(window){var ss='application/mp4; codecs\x3d"stpp.ttml"',ts='application/mp4; codecs\x3d"stpp.ttml.im1i"',us='application/mp4; codecs\x3d"stpp.ttml.im1t"',vs="backgroundColor",ws="direction",xs="displayAlign",ys="region",zs="sans-serif",As="textAlign",Bs="textDecoration",Cs="writingMode",Ds=function(a,b,c){this.g=a;this.f=b;this.a=c},Es=function(a,b,c){Ds.call(this,a,[],c);this.h=b||""},Fs=function(a,b,c){Ds.call(this,a,b,c)},Gs=function(a,b,c){a=a.f;for(var d=a.length-1;0<=d;d--){var e=b.get(a[d]);if(c in
|
|
3
|
+
e.a)return e.getAttribute(c)}return null},Os=function(a,b){var c=null;if(Hs.test(a)){c=Hs.exec(a);var d=Number(c[1]),e=Number(c[2]),f=Number(c[3]),g=Number(c[4]);g+=(Number(c[5])||0)/b.f;f+=g/b.frameRate;c=f+60*e+3600*d}else Is.test(a)?c=Js(Is,a):Ks.test(a)?c=Js(Ks,a):Ls.test(a)?(c=Ls.exec(a),c=Number(c[1])/b.frameRate):Ms.test(a)?(c=Ms.exec(a),c=Number(c[1])/b.a):Ns.test(a)&&(c=Js(Ns,a));return c},Js=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||
|
|
4
|
+
0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},Ps=function(a){return a.split(":").pop()},Qs=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},Ss=function(a,b){for(;Rs.test(a);){var c=Rs.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},Ts=function(a,b,c,d,e,f,g){Ds.call(this,a,f,g);this.o=b;this.w=c;this.m=d;this.j=e;this.h=[]},Us=function(a,b,c){a=Gs(a,b,As);if(!a&&c&&(a=Gs(c,b,As),!a&&"rltb"===Gs(c,b,Cs)))return _.ie;switch(a){case _.Ac:return _.tg;case _.ie:case _.ed:return _.ie;default:return _.pd}},
|
|
5
|
+
Vs=function(a,b,c){if(_.yh(a.o))return document.createTextNode(_.Ch(a.o||""));if(a.w)return _.zn("br");for(var d=_.zn("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.An(d,f.value);a=_.u(a.h);for(e=a.next();!e.done;e=a.next())d.appendChild(Vs(c.get(e.value),b,c));return d},Ws=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))},Xs=function(a,
|
|
6
|
+
b,c){Ds.call(this,a,b,c)},$s=function(a,b,c,d){var e=Ys.exec(a);a=Zs.exec(a);return typeof b===_.k&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},at=function(a,b){return typeof b===_.k&&0<b?_.zg:Zs.test(a)?0:_.zg},bt=function(a,b){Ds.call(this,"root-container",[],b);this.h=a},ct=function(a,b,c){return typeof a===_.k?a:typeof b===_.k?b:c},dt=function(a,b){var c=a.getAttribute("extent");return(c=Zs.exec(c))?Number(c[b]):null},ft=function(a){a=a.getAttribute("cellResolution");return(a=et.exec(a))?
|
|
7
|
+
Number(a[2]):null},gt=function(a,b,c){Ds.call(this,a,b,c)},ht=function(a){this.A=a;this.o=this.j=null;this.w=0;this.g=new Map;this.a=new Map;this.h=new Map;this.f=new Map;this.m=[]},jt=function(a){return it.some(function(b){return b in a.attributes})},kt=function(a,b){if(0===b.length)return[];for(var c=[],d=_.u(b),e=d.next();!e.done;e=d.next())e=e.value,a.a.has(e)&&c.push.apply(c,_.lf(kt(a,a.a.get(e).f)).concat([e]));return c},mt=function(){return"inline-"+lt++},nt=function(a){return a.m.map(function(b){return b.build(a.j,
|
|
8
|
+
a.o,a.w,a.g,a.a,a.h,a.f)}).filter(function(b){return null!=b})},ot=function(a){this.a=a.firstChild;this.f=new Set},pt=function(a,b,c,d,e,f){this.g=a;this.a=b;this.h=c;this.j=d;this.f=e;this.attributes=f},qt=function(a){return Ps(a.g.nodeName)},rt=function(){this.a=new Map},tt=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},h=b.parentNode;if(h&&a.a.has(h)){var l=a.a.get(h);e=_.lf(l.j).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.a,d=l.h,f=_.lf(l.f).concat(),
|
|
9
|
+
g={},st.forEach(function(n){n in l.attributes&&(g[n]=l.attributes[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(ys)&&(c=b.getAttribute(ys));b.hasAttribute(_.we)&&f.push.apply(f,_.lf(b.getAttribute(_.we).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.u(d);for(h=d.next();!h.done;h=d.next()){h=h.value;var m=Ps(h);g[m]=b.getAttribute(h)}d=g.backgroundImage}c=new pt(b,c,d,e,f,g);a.a.set(b,c);return c},ut=function(a){this.a=a;this.f=new DOMParser},vt=function(a){this.f=
|
|
10
|
+
a},wt=function(a){return String(Math.floor(a/3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},xt=function(){},yt=function(a){this.f=new ut(a);this.a=new _.H("clpp.ttml.Mp4TtmlParser")},zt=function(){this.a=new xt};Ds.prototype.getId=function(){return this.g};Ds.prototype.getAttribute=function(a){return this.a[a]};_.v(Es,Ds);_.v(Fs,Ds);var Hs=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Is=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Ks=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Ls=/^(\d*(?:\.\d*)?)f$/,Ms=/^(\d*(?:\.\d*)?)t$/,Ns=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Ys=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Zs=/^(\d+)px (\d+)px$/,et=/^(\d+) (\d+)$/,Rs=/(\d+)px/,At=/^(\d+px|\d+em|\d*\.?\d+c)$/,it=["fontStyle","fontSize","fontFamily","fontWeight","lineHeight",
|
|
11
|
+
"color",vs,"opacity","padding","zIndex",As,xs,Cs,ws,Bs,"textOutline"],st=["begin",_.ed];_.v(Ts,Fs);
|
|
12
|
+
Ts.prototype.build=function(a,b,c,d,e,f,g){var h=Os(this.a.begin,b);b=Os(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.zn(_.Wc);for(var l=_.u(this.h),m=l.next();!m.done;m=l.next())c.appendChild(Vs(g.get(m.value),e,g));g=new _.yg(h,b,c.innerHTML.trim(),_.Ge);g.cssClassList=_.lf(this.f).concat();g.textAlign=Us(this,e,null);g.writingMode=_.ug;g.line=-1;g.lineInterpretation=_.vg;g.lineAlign=_.wg;g.containerRows=ct(null,ft(a),15);if(this.m&&(f=f.get(this.m))){g.region=f.build(a,e);g.textAlign=
|
|
13
|
+
Us(this,e,f);a:switch(Gs(f,e,Cs)){case "tb":case "tblr":a=_.Oe;break a;case "tbrl":a=_.Pe;break a;default:a=_.ug}g.writingMode=a;a:switch(Gs(f,e,xs)){case _.Ac:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Gs(f,e,xs)){case _.Ac:a=1;break a;default:a=_.vg}g.lineInterpretation=a;a:switch(Gs(f,e,xs)){case _.Ac:e=_.Ac;break a;default:e=_.wg}g.lineAlign=e}this.j&&(a=d.get(this.j))&&(d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||a.getAttribute("imagetype"),a=a.h.trim(),
|
|
14
|
+
g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.v(Xs,Fs);
|
|
15
|
+
Xs.prototype.build=function(a,b){var c=new _.Bg;c.id=this.getId();var d=ct(a.h.containerWidth,dt(a,1),720),e=ct(a.h.containerHeight,dt(a,2),480);a:switch(Gs(this,b,xs)){case "after":var f="flex-start";break a;case _.Ac:f=_.Ac;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Gs(this,b,Cs)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Mc}c.writingMode=f;f=this.getAttribute("extent")||Gs(this,b,"extent");c.width=$s(f,d,1,100);c.widthUnits=at(f,d);c.height=
|
|
16
|
+
$s(f,e,2,100);c.heightUnits=at(f,e);f=this.getAttribute("origin")||Gs(this,b,"origin");c.viewportAnchorX=$s(f,d,1,0);c.viewportAnchorY=$s(f,e,2,0);c.viewportAnchorUnits=at(f,d);c.cssClassList=_.lf(this.f).concat();return c};_.v(bt,Ds);_.v(gt,Ds);
|
|
17
|
+
gt.prototype.build=function(a){var b=null;var c=ft(a);c&&(b=ct(a.h.containerHeight,dt(a,2),480)/c);b=ct(a.h.fontSizeRadix,b,16);a=[];c="::ttml ."+this.g+", ::ttml ."+this.g+" * {";for(var d=_.u(Bt.entries()),e=d.next();!e.done;e=d.next()){var f=_.u(e.value);e=f.next().value;f=f.next().value;e in this.a&&(c+=f+":"+Qs(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
|
|
18
|
+
e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),h=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!At.test(g)&&At.test(h)&&At.test(l)?(e=g,f=h):2===d.length&&!At.test(g)&&At.test(h)?(e=g,f=h):2===d.length&&At.test(g)&&At.test(h)&&(f=g);if(""!==f){f=Qs(f);d="text-shadow:0 0 "+(f+" "+e+",0 0 ")+(f+" "+e+",0 0 ")+(f+" "+e+";");break a}}d=""}c=c+d+("fontFamily"in this.a?"font-family:"+this.a.fontFamily.replace("monospaceSansSerif",
|
|
19
|
+
"monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif",zs).replace("proportionalSerif",zs).replace("sansSerif",zs).replace("default",zs)+";":"");a:{if(Bs in this.a){d=[];e=_.u(this.a.textDecoration.split(" "));for(f=e.next();!f.done;f=e.next())switch(f=f.value,f){case "underline":case "overline":d.push(f);break;case "lineThrough":d.push("line-through")}if(0<d.length){d="text-decoration:"+d.join(" ")+";";break a}}d=""}e="padding"in this.a?"border: solid transparent;border-width:"+
|
|
20
|
+
Qs(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=Qs(e),e=Ss(e,b),d=d+"line-height:"+e+";"):d="";a.push(c+d+"}");a:{if("fontSize"in this.a&&(c=this.a.fontSize.split(" "),d=null,1===c.length&&(d=c[0]),2===c.length&&(d=c[1]),d)){d=d.trim();d=Qs(d);d=Ss(d,b);b="font-size:"+d+";";break a}b=null}b&&(c="::ttml ."+this.g+" .clpp-text-wrapper {",a.push(c+b+"}"),c="::ttml .clpp-text-wrapper__"+this.g+" {",a.push(c+b+"}"));return a};
|
|
21
|
+
var Bt=new Map([["color","color"],[vs,"background-color"],[ws,ws],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var lt=0;ot.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Ct.has(Ps(a.nodeName))||Dt.has(Ps(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Ct.has(Ps(a.nodeName))));var b=this.a;this.a=a;return b};var Ct=new Set(["tt","head","layout",_.Ad,_.ld,ys,"styling",_.we,"body",_.Wc,"p","span","br"]),Dt=new Set([_.we,_.ld]);pt.prototype.getId=function(){return this.attributes.id};ut.prototype.parseInit=function(){};
|
|
22
|
+
ut.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.K.Na(this.a.ttml||{}),e=_.N(a,0,c[0]);e=_.ph(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.De)}catch(n){throw new _.L(_.M,2,2005,"Failed to parse TTML.");}d=new ht(d);e=new rt;f=new ot(f);b=b.periodStart;typeof b===_.k&&(d.w=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],l=_.N(a,b,h);l=_.bk(l);var m="urn:mpeg:14496-30:subs:"+g;d.g.set(m,new Es(m,l,{imageType:"PNG",encoding:"Base64"}));
|
|
23
|
+
b+=h}for(;f.a;)a=f.next(),a=tt(e,a),"tt"===qt(a)&&(d.j=new bt(d.A,Object.assign({},a.attributes))),"tt"===qt(a)&&(d.o=new Ws(a.attributes.frameRate,a.attributes.subFrameRate,a.attributes.frameRateMultiplier,a.attributes.tickRate)),qt(a)!==_.ld||a.attributes.begin||a.attributes.end||(c="#"+a.getId(),d.g.set(c,new Es(c,a.g.textContent,a.attributes))),qt(a)===_.ld&&a.attributes.begin&&a.attributes.end?(c="#"+mt(),b=new Es(c,a.g.textContent,a.attributes),d.g.set(c,b),c=b):c=null,c&&(a.h=c.getId()),qt(a)===
|
|
24
|
+
_.we&&(c=a.getId()||mt(),b=new gt(c,a.f,Object.assign({},a.attributes)),d.a.set(c,b),a.a&&d.h.get(a.a).f.push(c)),qt(a)!==_.we&&jt(a)?(c=mt(),b=new gt(c,[],Object.assign({},a.attributes)),d.a.set(c,b),c=b):c=null,c&&a.f.push(c.getId()),qt(a)!==_.Wc||!a.attributes.extent&&!a.attributes.origin?c=null:(c=mt(),b=new Xs(c,kt(d,a.f),Object.assign({},a.attributes)),d.h.set(c,b),c=b),c&&(a.a=c.getId()),qt(a)!==ys?c=null:(c=a.getId(),b=new Xs(c,kt(d,a.f),Object.assign({},a.attributes)),d.h.set(c,b),c=b),c&&
|
|
25
|
+
(a.a=c.getId()),c=a.j,-1===["#text","span","br"].indexOf(qt(a))||0===c.length?c=null:(g=c[c.length-1],d.f.has(g)?(c=mt(),b=new Ts(c,"#text"===a.g.nodeName?a.g.textContent:null,"br"===qt(a),a.a,a.h,kt(d,a.f),a.attributes),d.f.set(c,b),(g=d.f.get(g))&&g.h.push(c),c=b):c=null),c&&a.j.push(c.getId()),"p"===qt(a)||a.h?(c=mt(),b=new Ts(c,null,!1,a.a,a.h,kt(d,a.f),a.attributes),d.f.set(c,b),d.m.push(b),c=b):c=null,c&&a.j.push(c.getId());e=nt(d);f=[];a=_.u(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,
|
|
26
|
+
_.lf(c.value.build(d.j)));return{cues:e,styles:f}};vt.prototype.a=function(a){a=(new ut(this.f)).parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}).cues;var b="WEBVTT\n\n";a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=wt(c.startTime)+" --\x3e "+wt(c.endTime),e=[];switch(c.textAlign){case _.pd:e.push("align:left");break;case _.ie:e.push("align:right");break;case _.tg:e.push("align:middle");break;case _.pd:e.push("align:start");break;case _.ie:e.push("align:end")}switch(c.writingMode){case _.Oe:e.push("vertical:lr");break;
|
|
27
|
+
case _.Pe:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.th(b)};xt.prototype.probe=function(a,b){return a===_.fc&&b===_.Ce};xt.prototype.create=function(a){return new vt(a)};yt.prototype.parseInit=function(a){var b=!1;(new _.Gk).M(_.Dd,_.Hk).M(_.Fe,_.Hk).M(_.yd,_.Hk).M(_.Cd,_.Hk).M(_.te,_.Hk).W(_.ve,_.Ik).M("stpp",function(c){b=!0;c.Xa.stop()}).parse(a);if(!b)throw new _.L(_.M,2,2007);};
|
|
28
|
+
yt.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.Gk).M("moof",_.Hk).M("traf",_.Hk).W("subs",function(h){for(var l=_.U(h.G),m=0;m<l;++m){h.G.skip(4);for(var n=_.Bk(h.G),p=0;p<n;++p){var q=1===h.version?_.U(h.G):_.Bk(h.G);g.push(q);h.G.skip(6)}}}).M(_.xd,_.Jk(function(h){d=!0;h=c.f.parseMedia(h,b,g);e=e.concat(h.cues);f=f.concat(h.styles)})).parse(a);d||this.a.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.v(zt,_.Bo);zt.prototype.Ja=function(){_.Tp[_.fc]=ut;_.Tp[_.dc]=yt;_.Tp[ss]=yt;_.Tp[us]=yt;_.Tp[ts]=yt;_.Di.push(this.a)};zt.prototype.Ca=function(){_.Up(_.fc);_.Up(_.dc);_.Up(ss);_.Up(us);_.Up(ts);_.Fi(this.a)};zt.prototype.id=function(){return _.ze};_.C("clpp.ttml.TtmlComponent",zt);};
|
|
29
29
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
30
30
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
31
31
|
else{_=this.clpp._;(f.call(g,this));}
|