@castlabs/prestoplay 6.2.8 → 6.3.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 +34 -1
- 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 -106
- package/cjs/cl.conviva.js +32 -31
- package/cjs/cl.core.js +371 -360
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +69 -69
- package/cjs/cl.externs.js +68 -17
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +44 -44
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +32 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +250 -255
- package/cjs/cl.muxdata.js +12 -11
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -5
- package/cjs/cl.smooth.js +70 -70
- package/cjs/cl.thumbnails.js +22 -22
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +26 -26
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +19 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +85 -81
- package/cl.conviva.js +27 -27
- package/cl.core.js +346 -337
- package/cl.crypto.js +8 -8
- package/cl.dash.js +62 -63
- package/cl.externs.js +68 -17
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +37 -37
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -24
- package/cl.ima.js +16 -16
- package/cl.mse.js +220 -224
- package/cl.muxdata.js +8 -9
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- package/cl.playlist.js +5 -4
- package/cl.smooth.js +57 -57
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +21 -21
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/package.json +1 -1
package/cjs/cl.thumbnails.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
var e=b+c;return
|
|
4
|
-
this.a=p;this.g=k;this.m=l;this.h=m;this.j=n;this.f=null},
|
|
5
|
-
b.time,b.duration)})},
|
|
6
|
-
b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{
|
|
7
|
-
|
|
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
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
|
-
|
|
10
|
-
f);a.a.addEventListener(_.
|
|
11
|
-
|
|
12
|
-
this.o=e[1];else throw new _.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
String.fromCharCode.apply(null,
|
|
16
|
-
}).then(function(){
|
|
17
|
-
|
|
18
|
-
k);r=
|
|
19
|
-
|
|
20
|
-
Promise.reject();var d=c.getSegmentReference(b);if(d){var e=
|
|
21
|
-
b);return Promise.reject()};
|
|
22
|
-
|
|
23
|
-
_.
|
|
24
|
-
_.
|
|
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);};
|
|
25
25
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
26
26
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
27
27
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.tizen.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
c,d;return _.
|
|
4
|
-
keyIds:[],periodId:null},_.sf(e,0);d=_.tf(e);a.g.error("Error while configuring CDM for "+a.a,d);throw new _.
|
|
5
|
-
"Initialize",""),webapis.avplay.setDrm(b.
|
|
6
|
-
"POST";_.rf(
|
|
7
|
-
6,6007,{message:_.
|
|
8
|
-
reason:a.h}}))):a.j===_.
|
|
9
|
-
c)}},
|
|
10
|
-
document.createElement(_.Ie),c=new _.
|
|
11
|
-
a.next())d=d.value,d.startTime<=b&&(c=d);return c},
|
|
12
|
-
f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b}
|
|
13
|
-
d.id}))?(a.w?(a.a.debug("Switching period defer text selection"),a.m=c):(_.
|
|
14
|
-
height:b.height,bandwidth:b.bandwidth,rendition:b}}))},
|
|
15
|
-
e);a.na(c)}else a.a.debug("Preferred language(s) not available")}else a.a.debug("Could not set preferred audio language")},
|
|
16
|
-
b.channels?Number(b.channels):null;c.mimeType=_.
|
|
17
|
-
JSON.parse(b)}catch(d){a.a.warn("Couldn't retrieve extra infos from stream."),c=null}return c},
|
|
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=
|
|
19
|
-
d.push(g)}else a.a.warn("Skipping text stream with no extra info")}return d},
|
|
20
|
-
var c=
|
|
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;});_.
|
|
22
|
-
|
|
23
|
-
c),c;}},
|
|
24
|
-
d["return"](Promise.reject("SDK Timeout"));_.
|
|
25
|
-
e.nextBandwidth?(
|
|
26
|
-
a.setVolume(b.volume),b.muted&&
|
|
27
|
-
d(e)}}))})},
|
|
28
|
-
|
|
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)})},
|
|
30
|
-
|
|
31
|
-
|
|
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())},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
_.h.mf=function(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.m){this.m=!0;var a=this.l.getConfiguration().autoplay,b=this.a.getState()===
|
|
37
|
-
_.
|
|
38
|
-
_.
|
|
39
|
-
_.rf(m,3);e=b;return _.
|
|
40
|
-
b.h=null,b.g=null,b.j=null,b.f=null,_.
|
|
41
|
-
_.
|
|
42
|
-
_.
|
|
43
|
-
_.
|
|
44
|
-
_.
|
|
45
|
-
_.
|
|
46
|
-
_.
|
|
47
|
-
_.
|
|
48
|
-
_.
|
|
49
|
-
|
|
50
|
-
_.
|
|
51
|
-
_.
|
|
52
|
-
Promise.resolve():Promise.reject("Player is in invalid state")};_.
|
|
53
|
-
_.
|
|
54
|
-
_.
|
|
55
|
-
_.
|
|
56
|
-
_.
|
|
57
|
-
_.
|
|
58
|
-
_.
|
|
59
|
-
var
|
|
60
|
-
_.
|
|
61
|
-
_.
|
|
62
|
-
_.
|
|
63
|
-
|
|
64
|
-
_.
|
|
65
|
-
_.
|
|
66
|
-
_.
|
|
67
|
-
_.
|
|
68
|
-
_.
|
|
69
|
-
_.tf(k),b.onError(g),g;case 7:b.m.load(),_.
|
|
70
|
-
_.
|
|
71
|
-
_.
|
|
72
|
-
|
|
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()};
|
|
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";};
|
|
73
73
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
74
74
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
75
75
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.ttml.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
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
|
-
|
|
8
|
-
a.o,a.w,a.g,a.a,a.h,a.f)}).filter(function(b){return null
|
|
9
|
-
|
|
10
|
-
3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},
|
|
11
|
-
"color",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
g.backgroundImage=("PNG"===e&&"Base64"===d&&0<a.length?"data:image/png;base64,"+a:null)||"");return g};_.
|
|
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(),k=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+=k}for(;f.a;)a=f.next(),a=
|
|
24
|
-
|
|
25
|
-
null,"br"===
|
|
26
|
-
case _.He:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.Xg(b)};
|
|
27
|
-
|
|
2
|
+
var f=function(window){var qr='application/mp4; codecs\x3d"stpp.ttml"',rr='application/mp4; codecs\x3d"stpp.ttml.im1i"',sr='application/mp4; codecs\x3d"stpp.ttml.im1t"',tr="backgroundColor",ur="direction",vr="displayAlign",wr="region",xr="sans-serif",yr="textAlign",zr="textDecoration",Ar="writingMode",Br=function(a,b,c){this.g=a;this.f=b;this.a=c},Cr=function(a,b,c){Br.call(this,a,[],c);this.h=b||""},Dr=function(a,b,c){Br.call(this,a,b,c)},Er=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},$r=function(a,b){var c=null;if(Fr.test(a)){c=Fr.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 Gr.test(a)?c=Hr(Gr,a):Ir.test(a)?c=Hr(Ir,a):Qr.test(a)?(c=Qr.exec(a),c=Number(c[1])/b.frameRate):Yr.test(a)?(c=Yr.exec(a),c=Number(c[1])/b.a):Zr.test(a)&&(c=Hr(Zr,a));return c},Hr=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)},as=function(a){return a.split(":").pop()},bs=function(a){return a.replace(/(\d*\.?\d+)c/g,"$1em")},ds=function(a,b){for(;cs.test(a);){var c=cs.exec(a)[0];a=a.replace(c,parseInt(c,10)/b+"em")}return a},es=function(a,b,c,d,e,f,g){Br.call(this,a,f,g);this.o=b;this.w=c;this.m=d;this.j=e;this.h=[]},fs=function(a,b,c){a=Er(a,b,yr);if(!a&&c&&(a=Er(c,b,yr),!a&&"rltb"===Er(c,b,Ar)))return _.ae;switch(a){case _.sc:return _.ng;case _.ae:case _.Xc:return _.ae;default:return _.gd}},
|
|
5
|
+
gs=function(a,b,c){if(_.bh(a.o))return document.createTextNode(_.eh(a.o||""));if(a.w)return _.Km("br");for(var d=_.Km("span"),e=_.u(a.f),f=e.next();!f.done;f=e.next())_.Lm(d,f.value);a=_.u(a.h);for(e=a.next();!e.done;e=a.next())d.appendChild(gs(c.get(e.value),b,c));return d},hs=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]))},is=function(a,
|
|
6
|
+
b,c){Br.call(this,a,b,c)},ls=function(a,b,c,d){var e=js.exec(a);a=ks.exec(a);return typeof b===_.h&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},ms=function(a,b){return typeof b===_.h&&0<b?_.tg:ks.test(a)?0:_.tg},ns=function(a,b){Br.call(this,"root-container",[],b);this.h=a},os=function(a,b,c){return typeof a===_.h?a:typeof b===_.h?b:c},ps=function(a,b){var c=a.getAttribute("extent");return(c=ks.exec(c))?Number(c[b]):null},rs=function(a){a=a.getAttribute("cellResolution");return(a=qs.exec(a))?
|
|
7
|
+
Number(a[2]):null},ss=function(a,b,c){Br.call(this,a,b,c)},ts=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=[]},vs=function(a){return us.some(function(b){return b in a.a})},ws=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,_.df(ws(a,a.a.get(e).f)).concat([e]));return c},ys=function(){return"inline-"+xs++},zs=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})},As=function(a){this.a=a.firstChild;this.f=new Set},Bs=function(a,b,c,d,e,f){this.h=a;this.f=b;this.j=c;this.m=d;this.g=e;this.a=f},Cs=function(a){return as(a.h.nodeName)},Ds=function(){this.a=new Map},Fs=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null,e=[],f=[],g={},k=b.parentNode;if(k&&a.a.has(k)){var l=a.a.get(k);e=_.df(l.m).concat();-1===["#text","span","br"].indexOf(b.nodeName)&&(c=l.f,d=l.j,f=_.df(l.g).concat(),g=
|
|
9
|
+
{},Es.forEach(function(n){n in l.a&&(g[n]=l.a[n])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(wr)&&(c=b.getAttribute(wr));b.hasAttribute(_.oe)&&f.push.apply(f,_.df(b.getAttribute(_.oe).split(" ")));d=Array.from(b.attributes).map(function(n){return n.name});d=_.u(d);for(k=d.next();!k.done;k=d.next()){k=k.value;var m=as(k);g[m]=b.getAttribute(k)}d=g.backgroundImage}c=new Bs(b,c,d,e,f,g);a.a.set(b,c);return c},Gs=function(a){this.a=a;this.f=new DOMParser},Hs=function(a){this.f=a},Is=function(a){return String(Math.floor(a/
|
|
10
|
+
3600)).padStart(2,"0")+":"+String(Math.floor(a/60%60)).padStart(2,"0")+":"+String(Math.floor(a%60)).padStart(2,"0")+"."+String(Math.floor(1E3*a%1E3)).padStart(3,"0")},Js=function(){},Ks=function(a){this.f=new Gs(a);this.a=new _.G("clpp.ttml.Mp4TtmlParser")},Ls=function(){this.a=new Js};Br.prototype.ba=function(){return this.g};Br.prototype.getAttribute=function(a){return this.a[a]};_.v(Cr,Br);_.v(Dr,Br);var Fr=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Gr=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Ir=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Qr=/^(\d*(?:\.\d*)?)f$/,Yr=/^(\d*(?:\.\d*)?)t$/,Zr=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,js=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,ks=/^(\d+)px (\d+)px$/,qs=/^(\d+) (\d+)$/,cs=/(\d+)px/,Ms=/^(\d+px|\d+em|\d*\.?\d+c)$/,us=["fontStyle","fontSize","fontFamily","fontWeight","lineHeight",
|
|
11
|
+
"color",tr,"opacity","padding","zIndex",yr,vr,Ar,ur,zr,"textOutline"],Es=["begin",_.Xc];_.v(es,Dr);
|
|
12
|
+
es.prototype.build=function(a,b,c,d,e,f,g){var k=$r(this.a.begin,b);b=$r(this.a.end,b);if(null===k||null===b)return null;k+=c;b+=c;c=_.Km(_.Oc);for(var l=_.u(this.h),m=l.next();!m.done;m=l.next())c.appendChild(gs(g.get(m.value),e,g));g=new _.sg(k,b,c.innerHTML,_.ye);g.cssClassList=_.df(this.f).concat();g.textAlign=fs(this,e,null);g.writingMode=_.og;g.line=-1;g.lineInterpretation=_.pg;g.lineAlign=_.qg;g.containerRows=os(null,rs(a),15);if(this.m&&(f=f.get(this.m))){g.region=f.build(a,e);g.textAlign=
|
|
13
|
+
fs(this,e,f);a:switch(Er(f,e,Ar)){case "tb":case "tblr":a=_.Ge;break a;case "tbrl":a=_.He;break a;default:a=_.og}g.writingMode=a;a:switch(Er(f,e,vr)){case _.sc:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Er(f,e,vr)){case _.sc:a=1;break a;default:a=_.pg}g.lineInterpretation=a;a:switch(Er(f,e,vr)){case _.sc:e=_.sc;break a;default:e=_.qg}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(is,Dr);
|
|
15
|
+
is.prototype.build=function(a,b){var c=new _.vg;c.id=this.ba();var d=os(a.h.containerWidth,ps(a,1),720),e=os(a.h.containerHeight,ps(a,2),480);a:switch(Er(this,b,vr)){case "after":var f="flex-start";break a;case _.sc:f=_.sc;break a;default:f="flex-end"}c.displayAlign=f;a:switch(Er(this,b,Ar)){case "tb":case "tblr":f="row-reverse";break a;case "tbrl":f="row";break a;default:f=_.Ec}c.writingMode=f;f=this.getAttribute("extent")||Er(this,b,"extent");c.width=ls(f,d,1,100);c.widthUnits=ms(f,d);c.height=
|
|
16
|
+
ls(f,e,2,100);c.heightUnits=ms(f,e);f=this.getAttribute("origin")||Er(this,b,"origin");c.viewportAnchorX=ls(f,d,1,0);c.viewportAnchorY=ls(f,e,2,0);c.viewportAnchorUnits=ms(f,d);c.cssClassList=_.df(this.f).concat();return c};_.v(ns,Br);_.v(ss,Br);
|
|
17
|
+
ss.prototype.build=function(a){var b=null;var c=rs(a);c&&(b=os(a.h.containerHeight,ps(a,2),480)/c);b=os(a.h.fontSizeRadix,b,16);a=[];c="::ttml ."+this.g+", ::ttml ."+this.g+" * {";for(var d=_.u(Ns.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+":"+bs(this.a[e])+";")}a:{if("unicodeBidi"in this.a){d=this.a.unicodeBidi;e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d="unicode-bidi:"+
|
|
18
|
+
e+";";break a}}d=""}c+=d;a:{if("textOutline"in this.a){d=this.a.textOutline.split(" ");e="black";f=".4em";var g=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Ms.test(g)&&Ms.test(k)&&Ms.test(l)?(e=g,f=k):2===d.length&&!Ms.test(g)&&Ms.test(k)?(e=g,f=k):2===d.length&&Ms.test(g)&&Ms.test(k)&&(f=g);if(""!==f){f=bs(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",xr).replace("proportionalSerif",xr).replace("sansSerif",xr).replace("default",xr)+";":"");a:{if(zr 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
|
+
bs(this.a.padding)+";":"";c=c+d+e;"lineHeight"in this.a?(d="",e=this.a.lineHeight,e=bs(e),e=ds(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=bs(d);d=ds(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 Ns=new Map([["color","color"],[tr,"background-color"],[ur,ur],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var xs=0;As.prototype.next=function(){if(!this.a)return null;var a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Os.has(as(a.nodeName))||Ps.has(as(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&&!Os.has(as(a.nodeName))));var b=this.a;this.a=a;return b};var Os=new Set(["tt","head","layout",_.rd,_.dd,wr,"styling",_.oe,"body",_.Oc,"p","span","br"]),Ps=new Set([_.oe,_.dd]);Bs.prototype.ba=function(){return this.a.id};Gs.prototype.parseInit=function(){};
|
|
22
|
+
Gs.prototype.parseMedia=function(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.J.Ha(this.a.ttml||{}),e=_.R(a,0,c[0]);e=_.Tg(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.ve)}catch(n){throw new _.K(_.M,2,2005,"Failed to parse TTML.");}d=new ts(d);e=new Ds;f=new As(f);b=b.periodStart;typeof b===_.h&&(d.w=b);b=c[0];for(var g=1;g<c.length;++g){var k=c[g],l=_.R(a,b,k);l=_.jj(l);var m="urn:mpeg:14496-30:subs:"+g;d.g.set(m,new Cr(m,l,{imageType:"PNG",encoding:"Base64"}));
|
|
23
|
+
b+=k}for(;f.a;)a=f.next(),a=Fs(e,a),"tt"===Cs(a)&&(d.j=new ns(d.A,Object.assign({},a.a))),"tt"===Cs(a)&&(d.o=new hs(a.a.frameRate,a.a.subFrameRate,a.a.frameRateMultiplier,a.a.tickRate)),Cs(a)!==_.dd||a.a.begin||a.a.end||(c="#"+a.ba(),d.g.set(c,new Cr(c,a.h.textContent,a.a))),Cs(a)===_.dd&&a.a.begin&&a.a.end?(c="#"+ys(),b=new Cr(c,a.h.textContent,a.a),d.g.set(c,b),c=b):c=null,c&&(a.j=c.ba()),Cs(a)===_.oe&&(c=a.ba()||ys(),b=new ss(c,a.g,Object.assign({},a.a)),d.a.set(c,b),a.f&&d.h.get(a.f).f.push(c)),
|
|
24
|
+
Cs(a)!==_.oe&&vs(a)?(c=ys(),b=new ss(c,[],Object.assign({},a.a)),d.a.set(c,b),c=b):c=null,c&&a.g.push(c.ba()),Cs(a)!==_.Oc||!a.a.extent&&!a.a.origin?c=null:(c=ys(),b=new is(c,ws(d,a.g),Object.assign({},a.a)),d.h.set(c,b),c=b),c&&(a.f=c.ba()),Cs(a)!==wr?c=null:(c=a.ba(),b=new is(c,ws(d,a.g),Object.assign({},a.a)),d.h.set(c,b),c=b),c&&(a.f=c.ba()),c=a.m,-1===["#text","span","br"].indexOf(Cs(a))||0===c.length?c=null:(c=c[c.length-1],d.f.has(c)?(b=ys(),g=new es(b,"#text"===a.h.nodeName?a.h.textContent:
|
|
25
|
+
null,"br"===Cs(a),a.f,a.j,ws(d,a.g),a.a),d.f.set(b,g),d.f.get(c).h.push(b),c=g):c=null),c&&a.m.push(c.ba()),"p"===Cs(a)||a.j?(c=ys(),b=new es(c,null,!1,a.f,a.j,ws(d,a.g),a.a),d.f.set(c,b),d.m.push(b),c=b):c=null,c&&a.m.push(c.ba());e=zs(d);f=[];a=_.u(d.a.values());for(c=a.next();!c.done;c=a.next())f.push.apply(f,_.df(c.value.build(d.j)));return{cues:e,styles:f}};Hs.prototype.a=function(a){a=(new Gs(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=Is(c.startTime)+" --\x3e "+Is(c.endTime),e=[];switch(c.textAlign){case _.gd:e.push("align:left");break;case _.ae:e.push("align:right");break;case _.ng:e.push("align:middle");break;case _.gd:e.push("align:start");break;case _.ae:e.push("align:end")}switch(c.writingMode){case _.Ge:e.push("vertical:lr");break;
|
|
26
|
+
case _.He:e.push("vertical:rl")}b+=d+(e.length?" "+e.join(" "):"")+"\n";b+=c.payload+"\n\n"}return _.Xg(b)};Js.prototype.probe=function(a,b){return a===_.Xb&&b===_.ue};Js.prototype.create=function(a){return new Hs(a)};Ks.prototype.parseInit=function(a){var b=!1;(new _.Pj).M(_.vd,_.Qj).M(_.xe,_.Qj).M(_.pd,_.Qj).M(_.td,_.Qj).M(_.le,_.Qj).V(_.ne,_.Rj).M("stpp",function(c){b=!0;c.Ua.stop()}).parse(a);if(!b)throw new _.K(_.M,2,2007);};
|
|
27
|
+
Ks.prototype.parseMedia=function(a,b){var c=this,d=!1,e=[],f=[],g=[];(new _.Pj).M("moof",_.Qj).M("traf",_.Qj).V("subs",function(k){for(var l=_.Kj(k.F),m=0;m<l;++m){k.F.skip(4);for(var n=_.Jj(k.F),p=0;p<n;++p){var q=1===k.version?_.Kj(k.F):_.Jj(k.F);g.push(q);k.F.skip(6)}}}).M(_.od,_.Sj(function(k){d=!0;k=c.f.parseMedia(k,b,g);e=e.concat(k.cues);f=f.concat(k.styles)})).parse(a);d||this.a.warn("Couldn't find the mdat box");return{cues:e,styles:f}};_.v(Ls,_.Kn);Ls.prototype.Da=function(){_.ep[_.Xb]=Gs;_.ep[_.Vb]=Ks;_.ep[qr]=Ks;_.ep[sr]=Ks;_.ep[rr]=Ks;_.rh.push(this.a)};Ls.prototype.va=function(){_.fp(_.Xb);_.fp(_.Vb);_.fp(qr);_.fp(sr);_.fp(rr);_.th(this.a)};Ls.prototype.id=function(){return _.re};_.B("clpp.ttml.TtmlComponent",Ls);};
|
|
28
28
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
29
29
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
30
30
|
else{_=this.clpp._;(f.call(g,this));}
|