@castlabs/prestoplay 6.14.0 → 6.15.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 +25 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +113 -111
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +550 -529
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +74 -73
- package/cjs/cl.externs.js +191 -64
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +69 -68
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +290 -275
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -71
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +70 -70
- package/cjs/cl.ttml.js +28 -28
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- 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 +89 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +457 -438
- package/cl.crypto.js +9 -9
- package/cl.dash.js +70 -68
- package/cl.externs.js +187 -64
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +71 -69
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +255 -240
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- 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 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +2 -0
- package/package.json +1 -1
- package/typings.d.ts +387 -90
package/cl.thumbnails.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
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));a=document.createElement(_.
|
|
6
|
-
this.width*c+_.
|
|
7
|
-
d=f=>{this.
|
|
8
|
-
c),new _.
|
|
9
|
-
for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new
|
|
10
|
-
d[l]),k+=1;for(let l=0,m=e.byteLength;l<m;l++)h.setUint8(k,e[l]),k+=1;this.a=g;this.
|
|
11
|
-
h.offset-k.offset,k.duration=h.time-k.time;this.f.push(h);d+=8;(g=4294967295===g)&&this.
|
|
12
|
-
+ 'URL: ${c}`,d);a.onError(new _.
|
|
13
|
-
l);f.match(/^http|^\/\//)||(f=c.substr(0,c.lastIndexOf("/"))+"/"+f);l=
|
|
14
|
-
yield c.load();return c})}l(){return this.f}};var
|
|
15
|
-
e.findSegmentPosition(a-d.startTime);if(null===d||void 0===d)throw b.log.error("Could not find segment index for specified position",a),c();var f=e.getSegmentReference(d);if(f){const h=
|
|
16
|
-
h.
|
|
17
|
-
0;k<e.
|
|
18
|
-
this.
|
|
19
|
-
var
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Hw="Thumbnail URL is mandatory",Iw="Wrong gridSize format",Jw="clpp.thumbnails",Lw=function(a,b){b.reduce((c,d)=>{let e=d,f=!1;typeof d===_.De&&(e=d.step,f=d.preloadWhileBuffering);return c.then(()=>Kw(a,0,e,!!f))},Promise.resolve())},Kw=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();const e=b+c;return Mw(a,d).then(()=>a.a[b].load()).then(()=>Kw(a,e,c,d))},Mw=function(a,b){return new Promise(c=>{if(b||a.player.getState()!==_.Ln)c();else a.player.one(_.Sc,()=>{c()})})},
|
|
2
|
+
Nw=function(a){const b=a.a.byteLength;a.f.forEach(c=>{c.offset+c.length<b&&c.bd.resolve()})},Qw=function(a,b){return Ow(a,b).then(c=>new Pw(c,b.time,b.duration))},Ow=function(a,b){return b.load().then(()=>{const c=_.I(a.a,b.offset,b.length);return"data:image/jpeg;base64,"+_.xi(c)})},Rw=function(a){a=a.split(/\.|:/).map(parseFloat);let b=0,c;const d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},Sw=function(a,b){let c=null;for(const d of a)d.startTime<=b&&(c=d);return c},
|
|
3
|
+
Tw=function(a,b){const c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Tc:c,Je:d,pf:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Uw=function(a){return a.some(b=>0<b.thumbStreams.length)},bx=function(a){return a?a===Vw||a===Ww?new Xw:a===Yw?new Zw:a===$w?new ax:null:null},cx=function(a){if(!a)return null;a=new _.El(a);return a.path.match(/.*\.vtt$/i)?Yw:a.path.match(/.*\.bif$/i)?$w:a.path.match(/.*\.(png|jpg|jpeg)$/i)?
|
|
4
|
+
Vw:null};var dx=class{constructor(){this.log=new _.Q(Jw);this.player=null;this.a=[];this.w=!1}init(a,b){this.player=a;a.one(_.rf,()=>{this.w=!0});a.isLive()||this.l().then(()=>{b&&b.preload&&Lw(this,b.preload)})}};var Pw=class{constructor(a,b,c,d,e,f,g,h,k,l,m,n){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;k=void 0===k?1:k;l=void 0===l?0:l;m=void 0===m?0:m;n=void 0===n?new Image:n;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.la=n;this.jg=h;this.hh=k;this.Hg=l;this.Ig=m;this.de=null}raw(){return this.la.cloneNode(!1)}element(a,b){let c=this.width,d=this.height;const e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==
|
|
5
|
+
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));a=document.createElement(_.Gd);a.style.width=c+_.of;a.style.height=d+_.of;a.style.backgroundColor="#000";a.style.backgroundRepeat="no-repeat";a.style.backgroundImage=`url("${this.src}")`;a.style.backgroundSize=`${Math.ceil(c/this.width*(this.la.naturalWidth||this.la.width))}px ${Math.ceil(d/this.height*(this.la.naturalHeight||this.la.height))}px`;b=this.y/this.height;a.style.backgroundPositionX="-"+this.x/
|
|
6
|
+
this.width*c+_.of;a.style.backgroundPositionY="-"+b*d+_.of;return a}load(){this.de||(this.de=new Promise((a,b)=>{const c=()=>{this.width||(this.width=(this.la.naturalWidth||this.la.width)/this.jg);this.height||(this.height=(this.la.naturalHeight||this.la.height)/this.hh);this.x||(this.x=this.width*this.Hg);this.y||(this.y=this.height*this.Ig)};if(this.la.src&&this.la.complete)c(),a(this);else{var d=null,e=()=>{c();this.la.removeEventListener("load",e);this.la.removeEventListener(_.Vd,d);a(this)};
|
|
7
|
+
d=f=>{this.la.removeEventListener("load",e);this.la.removeEventListener(_.Vd,d);b(new _.G(1,9,2014,"Failed to load thumbnail.",f))};this.la.addEventListener("load",e);this.la.addEventListener(_.Vd,d);this.la.src=this.src}}));return this.de}};_.x("clpp.thumbnails.Thumbnail",Pw);Pw.prototype.load=Pw.prototype.load;Pw.prototype.element=Pw.prototype.element;Pw.prototype.raw=Pw.prototype.raw;var Xw=class extends dx{constructor(){super();this.f=null;this.o=this.g=1;this.j=0}init(a,b){if(!b||!b.url)throw new _.G(1,9,7100,Hw);if("GRID"===b.mode&&!b.gridSize)throw new _.G(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.G(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{const c=this.f.gridSize.split(/x/).map(d=>parseInt(d,10)).filter(d=>0<d);if(2===c.length)this.g=c[0],this.o=c[1];else throw new _.G(1,9,7100,Iw);}catch(c){throw this.log.error("Error during parsing gridSize",
|
|
8
|
+
c),new _.G(1,9,7100,Iw);}super.init(a,b)}get(a){const b=this;return _.w(function*(){var c=b.player.getDuration();if(0>a||a>c)throw new _.G(1,9,2014,`Position is out of range: ${a}`);c=Math.floor(a/b.f.duration);const d=b.a[c];if(!d)throw new _.G(1,9,2014,"No thumbnail found for position "+a+" at index "+c);yield d.load();return d})}l(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration();const b=this.g*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);const c=this.f.templateKey||"$index$";
|
|
9
|
+
for(let d=0;d<a;d++){const e=this.f.url.replace(c,String(d+1)),f=new Image;for(let g=0;g<b;g++)this.a.push(new Pw(e,this.j*(d*b+g),this.j,0,0,0,0,this.g,this.o,g%this.g,Math.floor(g/this.g),f))}return Promise.resolve()}};var ex=class{constructor(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.bd=new _.Ym}load(){return this.bd}},ax=class{constructor(){this.h=new _.Q(Jw);this.a=new ArrayBuffer(0);this.f=[];this.g=new _.Ym}init(a,b){if(!b||!b.url)throw new _.G(1,9,7100,Hw);const c=b.url;b=_.Ni(c);b.type=_.Mi;a.getNetworkEngine().fetch(b).P.then(d=>{var e=d.data;d=_.I(this.a);e=_.I(e);var f=d.byteLength+e.byteLength,g=new ArrayBuffer(f),h=new DataView(g),k=0;for(let l=0,m=d.byteLength;l<m;l++)h.setUint8(k,
|
|
10
|
+
d[l]),k+=1;for(let l=0,m=e.byteLength;l<m;l++)h.setUint8(k,e[l]),k+=1;this.a=g;this.h.info(`Appended ${e.byteLength} bytes.`+`Total data now ${f} bytes.`);f=this.a;d=_.I(f);h=String.fromCharCode.apply(null,fx);k=Array.prototype.slice.call(d,0,8);d=64;e=0;g=!1;if(h===String.fromCharCode.apply(null,k))for(f=new DataView(f,16,20),f=f.getUint32(0,!0),0===f&&(f=1E3);!g;){e+=1;k=f;h=new DataView(this.a,d);g=h.getUint32(0,!0);k=g*k/1E3;h=h.getUint32(4,!0);h=new ex(k,h);if(k=this.f.length)k=this.f[k-1],k.length=
|
|
11
|
+
h.offset-k.offset,k.duration=h.time-k.time;this.f.push(h);d+=8;(g=4294967295===g)&&this.g.resolve();if(1E5<e)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");Nw(this)}).catch(d=>{this.h.error(`[BIF] Error while loading thumbnails '
|
|
12
|
+
+ 'URL: ${c}`,d);a.onError(new _.G(1,9,2013,"Error while loading and parsing BIF thumbnails.",d))})}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.G(1,9,2014,`Position is out of range: ${a}`);yield b.g;var c=b.f.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.G(1,9,2014,`No thumbnail found for position: ${a}`);c=yield Qw(b,c);yield c.load();return c})}},fx=[137,66,73,70,13,10,26,10];var Zw=class extends dx{constructor(){super();this.f=null}init(a,b){if(!b||!b.url)throw new _.G(1,9,7100,Hw);const c=b.url,d=_.Ni(c);d.type=_.Mi;this.f=a.getNetworkEngine().fetch(d).P.then(e=>{e=e.data;if(!e)throw Error("No data in the response");e=_.ji(e).split(/\n/);for(let m=0;m<e.length;m++){var f=e[m],g=f.split(" --\x3e ");if(2===g.length){f=e[++m];var h=f.indexOf("\x3d");var k=h=0>h?[]:f.substr(h+1).split(/,/).map(parseFloat);h=k[0];const n=k[1],q=k[2];k=k[3];var l=f.indexOf("#");f=0>l?f:f.substr(0,
|
|
13
|
+
l);f.match(/^http|^\/\//)||(f=c.substr(0,c.lastIndexOf("/"))+"/"+f);l=Rw(g[0]);g=Rw(g[1])-l;this.a.push(new Pw(f,l,g,h,n,q,k,0,0))}}}).catch(e=>{this.log.error("[VTT] Error while loading thumbnails "+`URL: ${c}`,e);a.onError(new _.G(1,9,2013,"Error while loading VTT thumbnails.",e))});super.init(a,b)}get(a){const b=this;return _.w(function*(){if(0>a)throw new _.G(1,9,2014,`Position is out of range: ${a}`);yield b.f;const c=b.a.find(d=>a>=d.time&&a<d.time+d.duration);if(!c)throw new _.G(1,9,2014,`No thumbnail found for position: ${a}`);
|
|
14
|
+
yield c.load();return c})}l(){return this.f}};var gx=class extends dx{get(a){const b=this;return _.w(function*(){function c(){return new _.G(1,9,2014,`No thumbnail found for position: ${a}`)}if(0>a)throw b.log.error("Position must be greater than 0 but is "+a),new _.G(1,9,2014,`Position is out of range: ${a}`);var d=b.player.getPeriods();d=Sw(d,a);if(!d)throw b.log.error("Could not find period for specified position",a),c();var e=d.thumbStreams.sort(b.f)[0];if(!e)throw b.log.error("Could not find thumb stream for specified position",a),c();d=
|
|
15
|
+
e.findSegmentPosition(a-d.startTime);if(null===d||void 0===d)throw b.log.error("Could not find segment index for specified position",a),c();var f=e.getSegmentReference(d);if(f){const h=Tw(f,e),k=Math.floor((a-f.startTime)/h.durationPerTile);var g;if(0<b.a.length)f=e.findSegmentPosition(0),null!==f&&(g=b.a[(d-f)*h.pf+k]);else if((e=f.Ja())&&0<e.length){let l=g=0;f=f.startTime;1<h.pf&&(g=k%h.Tc,l=Math.floor(k/h.Tc),f+=k*h.durationPerTile);g=new Pw(e[0],f,h.durationPerTile,void 0,void 0,void 0,void 0,
|
|
16
|
+
h.Tc,h.Je,g,l)}if(g)return yield g.load(),g}b.log.error("segment reference for specified segment index does not exist",d);throw c();})}f(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0}l(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();for(const b of a)if(a=b.thumbStreams.sort(this.f)[0]){let c=a.findSegmentPosition(0),d;for(;null!==c&&!_.z(d=a.getSegmentReference(c++));){const e=Tw(d,a),f=d.Ja()[0],g=new Image;let h=d.startTime;for(let k=
|
|
17
|
+
0;k<e.Je;++k)for(let l=0;l<e.Tc;++l)this.a.push(new Pw(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Tc,e.Je,l,k,g)),h+=e.durationPerTile}}return Promise.resolve()}};var hx=class{constructor(){this.h=new _.Q(Jw);this.a=this.m=null}onPlayerCreated(a){this.m=a}onPlayerWillDestroy(){this.m=null}onPlayerWillRelease(){this.a=null}onContentWillLoad(a){const b=a.getConfiguration().thumbnails;if(b)if(!1===b.enabled)this.h.info("Thumbnails disabled.");else{var c=b.mode||null;c||(c=cx(b.url||null));(this.a=bx(c))?(this.h.info("Loading thumbs configuration",b),this.m.one(_.qe,()=>{this.h.info("Initialize thumbnails provider");try{this.a.init(a,b)}catch(d){this.m.onError(d)}})):
|
|
18
|
+
this.h.warn("Unknown thumbnail mode",c)}else this.a=null}onContentLoaded(a){if(!this.a){var b=a.getConfiguration();b=b&&b.thumbnails;if(!b||void 0===b.enabled||b.enabled){var c=a.getPeriods();if(Uw(c)){this.a=new gx;try{this.a.init(a,b)}catch(d){this.m.onError(d)}}}}}get(a){return this.a?this.a.get(a):Promise.reject(new _.G(1,9,2014,"Thumbnail format is not supported"))}id(){return"thumbnails"}};_.x("clpp.thumbnails.ThumbnailsPlugin",hx);hx.prototype.get=hx.prototype.get;hx.Id="thumbnails";_.Vo(new class{create(){return new hx}});
|
|
19
|
+
var Vw="SINGLE",Ww="GRID",Yw="WEBVTT",$w="BIF";};f.call(g, window);
|
package/cl.tizen.js
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
const b=a.f.get(a.a);if(!b
|
|
3
|
-
a.
|
|
4
|
-
k);try{webapis.avplay.setDrm(
|
|
5
|
-
"widevine_app_session",a.l.id),webapis.avplay.setDrm(
|
|
6
|
-
a.m.trigger(new _.
|
|
7
|
-
b)}
|
|
8
|
-
{wb:()=>a.m.getPosition(),Y:a.
|
|
9
|
-
c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];c=0;for(d=0;d<a.length;d++){const e=new _.
|
|
10
|
-
String(b.id)){c=a[d].renditions[0];break}}return c}return null}
|
|
11
|
-
height:b.height,bandwidth:b.bandwidth,rendition:b}}))},
|
|
12
|
-
return c[0]||null},
|
|
13
|
-
|
|
14
|
-
e.length;f++)(h=
|
|
15
|
-
|
|
16
|
-
b.bit_rate||null;return a},
|
|
17
|
-
continue}const f=new _.
|
|
18
|
-
10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=
|
|
19
|
-
b===
|
|
20
|
-
k&&k.
|
|
21
|
-
oncurrentplaytime:b=>{a.trigger(new _.
|
|
22
|
-
|
|
23
|
-
isLive:a.isLive(),duration:a.getDuration(),isMuted:
|
|
24
|
-
Promise.reject("SDK Timeout")})},
|
|
25
|
-
c)}}},
|
|
26
|
-
a.o=!0);
|
|
27
|
-
g;}})},
|
|
28
|
-
b){this.
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
this.H);this.a.off(
|
|
32
|
-
|
|
33
|
-
"http://"),c)}catch(e){b.
|
|
34
|
-
a);this.w=!0;let b=_.
|
|
35
|
-
a);this.
|
|
36
|
-
b+" data: "+a)}}A(a){a.detail.currentState===_.
|
|
37
|
-
const b=this.f[_.
|
|
38
|
-
this.
|
|
39
|
-
this.ka();this.a.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.
|
|
43
|
-
d)=>{webapis.avplay.prepareAsync(()=>{
|
|
44
|
-
this.C=a}catch(c){return this.
|
|
45
|
-
1E3*a;return new Promise((c,d)=>{this.B=!0;this.m.trigger(new _.
|
|
46
|
-
this.
|
|
47
|
-
"The passed value value should be in the range of 0 to 1.");break;case
|
|
48
|
-
a}getSourceIndex(){return this.F}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},
|
|
49
|
-
{currentTime:a.currentTime/1E3}))}I(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.
|
|
50
|
-
b){this.configuration=this.B=b;this.w=a;this.a.on(
|
|
51
|
-
_.
|
|
52
|
-
a.j=null);a.l.destroy();a.f.destroy();a.l=null;a.f=null})}namespace(){return
|
|
53
|
-
end:0}}getVolume(){const a=this.a.getVolume();return typeof a===_.r?a/100:null}setVolume(a){this.a.setVolume(a)}getDuration(){return this.a.getDuration()}getBufferInfo(){this.
|
|
54
|
-
(b.configuration=_.
|
|
55
|
-
new _.
|
|
56
|
-
b){return(new
|
|
57
|
-
var
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var zK="An unknown error occurred while trying to get volume",AK="Cannot get loading rendition due to platform limitations",BK="SecurityError",CK="The require privilege is: http://tizen.org/privilege/tv.audio",DK="|STARTBITRATE\x3d",EK=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,d)};a.addEventListener(b,d)},HK=function(a){return _.w(function*(){if(a.a!==_.yd&&a.a!==_.wd)throw new _.G(_.E,6,6001,`The key system ${a.a} is not supported by `+"the player or the platform");
|
|
2
|
+
const b=a.f.get(a.a);if(!b.$c)throw new _.G(_.E,6,6012,`No license server given for ${a.a}`);try{a.a===_.yd?yield FK(a):yield GK(a,b),a.o={keySystem:a.a,licenseServerUri:b.$c,distinctiveIdentifierRequired:!1,persistentStateRequired:b.qe,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null}}catch(c){throw a.h.error(`Error while configuring CDM for ${a.a}`,c),new _.G(_.E,6,6005,{message:JSON.stringify(c)});}})},JK=function(a,b){_.w(function*(){var c=a.f.get(a.a);
|
|
3
|
+
a.h.debug("DRM Challenge data: ",b.challenge);const d=atob(b.challenge);var e=new Uint8Array(d.length);for(let h=0;h<d.length;++h)e[h]=d.charCodeAt(h);c=_.Ni([b.serverurl&&""!==b.serverurl?b.serverurl:c.$c],_.Ki());c.type=3;c.body=e.buffer;c.method="POST";try{var f=yield a.D.nb.fetch(c).P;if(a.j){var g=_.I(f.data);const h=g.byteLength;e="";for(f=0;f<h;f++)e+=String.fromCharCode(g[f]);const k=`${b.session_id}PARAM_START_POSITION`+`${btoa(e)}PARAM_START_POSITION`;a.h.debug("Widevine license params",
|
|
4
|
+
k);try{webapis.avplay.setDrm(IK,"widevine_license_data",k)}catch(l){a.h.error("License response rejected by CDM");const m=new _.G(_.E,6,6008,{browserError:JSON.stringify(l)});a.D.onError(m)}}}catch(h){a.h.error("License request failed.",JSON.stringify(h)),g=new _.G(_.E,6,6007,{message:_.Ra,url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},FK=function(a){return _.w(function*(){try{webapis.avplay.setDrm(IK,"Initialize",""),webapis.avplay.setDrm(IK,
|
|
5
|
+
"widevine_app_session",a.l.id),webapis.avplay.setDrm(IK,"widevine_data_type",a.l.type)}catch(b){throw b;}})},GK=function(a,b){return _.w(function*(){var c={};c[KK]=!b.qe;c[LK]=b.$c;""!==b.customData&&(c[MK]=b.customData);c=JSON.stringify(c);a.h.debug("PlayReady properties: ",c);try{webapis.avplay.setDrm(NK,"SetProperties",c)}catch(d){throw d;}})},PK=function(a,b){if(a.f!==b)if(a.f===_.Pn&&b!==_.Qn)a.h.debug(_.ny+`${OK(b)}`);else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.Ln?(a.o=(new Date).getTime(),
|
|
6
|
+
a.m.trigger(new _.C(_.Tc,{detail:{bufferedTimeMS:-1,reason:a.g}}))):a.j===_.Ln&&a.m.trigger(new _.C(_.Sc,{detail:{bufferedTimeMS:c-a.o,reason:a.g}}));b={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.C(_.If,{detail:b}));a.h.debug("State changed:",OK(a.j),"-\x3e",OK(a.f))}},OK=function(a){return Object.keys(_.On)[a]},SK=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case QK:c=_.Tn;break;case RK:c=_.Sn;break;default:a.m.isEnded()?c=_.In:a.h.debug("Inconsistent AVPlay playback state:",
|
|
7
|
+
b)}PK(a,c)}},TK=function(a){return _.w(function*(){const b=a.m.getConfiguration();let c;(c=yield _.gr(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},UK=function(a){if(!a)return!1;a=a.periods;let b=!1;for(let c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},VK=function(a){const b=document.createElement(_.t),c=new _.pE,d=new _.wD(()=>null),e=a.m.getTextDisplayer();return new _.qE(b,c,e,d,a.m.getConfiguration())},WK=function(a){const b=
|
|
8
|
+
{configuration:{},wb:()=>a.m.getPosition(),Y:a.g,nb:a.m.getNetworkEngine(),le:a.G.bind(a),ke:a.F.bind(a),onError:a.V.bind(a),vf:()=>{},onEvent:()=>{},yf:a.H.bind(a),Fd:()=>{},Yd:()=>new _.WD,Od:()=>!1,Lc:null};return new _.IE(a.a,b)},XK=function(a){const b=a.m.getPosition();let c=null;for(const d of a.a.periods)d.startTime<=b&&(c=d);return c},YK=function(a){a.h.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.h.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.h.debug(c[d].startTime,
|
|
9
|
+
a.m.getPosition()),c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];c=0;for(d=0;d<a.length;d++){const e=new _.ej(String(c++),_.J);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.Jy;const f=new _.mj(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},ZK=function(a){if(a.g&&!a.g.getTextDisplayer().isTextVisible())return null;if(a.f){const b=_.rC(a.f,_.F);let c=null;if(b){a=YK(a);for(let d=
|
|
10
|
+
0;d<a.length;d++)if(a[d].renditions[0].id===String(b.id)){c=a[d].renditions[0];break}}return c}return null},$K=function(a,b){a.h.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.C=b.kind===_.Wd,a.a&&a.f)){a.setTextVisibility(!0);const c=XK(a),d=b.renditions[0];(b=c.textStreams.find(e=>String(e.id)===d.id))?(a.w?(a.h.debug("Switching period defer text selection"),a.l=b):(_.AC(a.f,b,!0,0),a.m.trigger(new _.C(_.Ek))),a.o=b.language):a.h.error(_.my,d.id)}},aL=function(a){const b=
|
|
11
|
+
a.ka();b&&a.m.trigger(new _.C(_.Qc,{detail:{width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b}}))},bL=function(a,b){a.m.trigger(new _.C(_.mg,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},cL=function(a,b){let c=null;try{c=JSON.parse(b)}catch(d){a.h.warn("Couldn't retrieve extra infos from stream."),c=null}return c},dL=function(a,b){a=a.f[_.L]||[];const c=[];for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)_.Tg(a[d].renditions[e],
|
|
12
|
+
b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||null},eL=function(a){const b=a.m.getConfiguration();var c=_.xh(b.preferredAudioLanguage||[]);const d=a.f[_.K]||[];if(d.length){var e=null;c.some(g=>{e=_.cz(g,d.map(h=>h.language));return!!e});if(e){var f=d.filter(g=>g.language===e);c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(g=>0<=g.roles.indexOf(b.preferredAudioRole)),0<f.length&&(c=f[0]));a.h.debug("Setting audio track with preferred language:",e);a.ra(c)}else a.h.debug("Preferred language(s) not available")}else a.h.debug("Could not set preferred audio language")},
|
|
13
|
+
kL=function(a,b){var c=(l,m)=>{for(let n=0;n<l.length;n++)if(l[n].language===m)return l[n];return null};const d={};if(0>=b.length)return d;var e=b.filter(l=>l.type===fL),f=b.filter(l=>l.type===gL);const g=[];for(var h=0;h<f.length;h++){const l=cL(a,f[h].extra_info);if(l){var k=_.Xh(l.language||_.Wf);k=_.Zi(k);k=c(g,k);k||(k=new _.ej(String(a.o++),_.K),g.push(k));k.renditions.push(hL(f[h].index,l,k))}else a.h.warn("Skipping audio stream with no extra info")}c=new _.ej(String(a.o++),_.L);for(f=0;f<
|
|
14
|
+
e.length;f++)(h=cL(a,e[f].extra_info))?c.renditions.push(iL(e[f].index,h,c)):a.h.warn("Skipping video stream with no extra info");e=[];e=a.g?YK(a.g):jL(a,b);d[_.L]=[c];d[_.K]=g;d[_.J]=e;return d},nL=function(a,b){if(b===_.J&&a.g)return ZK(a.g);var c=lL(a.a)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];var d=null;b===_.L&&(d=cL(a,c.extra_info),d=dL(a,{width:d.Width,height:d.Height}));b===_.K&&(c?(d=mL(a,c,_.K),a.j=d):d=a.j);b===_.J&&(c?(d=mL(a,c,_.J),a.l=d):d=a.l);return d},
|
|
15
|
+
qL=function(a,b){if(b){const c=b.track.type.toUpperCase();oL(a.a,c,Number(b.id)).then(()=>{c===gL&&(a.j=b,a.m.trigger(new _.C(_.Dk)));c===pL&&(a.l=b,a.m.trigger(new _.C(_.Ek)))}).catch(()=>{a.h.error("Could not select "+c+" track.")})}else a.h.debug("Must provide valid rendition")},hL=function(a,b,c){const d=_.Xh(b.language||_.Wf);c.language=_.Zi(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.Mc;a=new _.mj(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
|
|
16
|
+
b.bit_rate||null;return a},iL=function(a,b,c){c.mimeType=_.kg;a=new _.mj(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},rL=function(a,b,c){b=_.Xh(b.track_lang||_.Wf);c.mimeType="text/ttml";c.language=_.Zi(b);c.originalLanguage=b;c.kind=_.Jy;return new _.mj(String(a),c)},jL=function(a,b){b=b.filter(d=>d.type===pL);const c=[];for(let d=0;d<b.length;d++){const e=cL(a,b[d].extra_info);if(!e){a.h.warn("Skipping text stream with no extra info");
|
|
17
|
+
continue}const f=new _.ej(String(a.o++),_.J);f.renditions.push(rL(b[d].index,e,f));c.push(f)}return c},mL=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},sL=function(a){return a.f&&a.a?a.a.th:webapis.avplay.getTotalTrackInfo()},uL=function(a,b,c){a.h.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),
|
|
18
|
+
10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=tL(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(()=>{const e=a.a.Te;a.f=!1;a.a=null;return e===RK?a.pause():a.play()})}catch(d){return Promise.reject(d)}},vL=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.g;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.h.debug("Could not set text track visibility",d)}},oL=function(a,b,c){b=b.toUpperCase();
|
|
19
|
+
b===pL&&vL(a,!0);const d=a.j[b];d&&(d.Jd.stop(),a.j[b]=null,a.h.debug(`Cancelled pending track switch for ${b}`));return new Promise((e,f)=>{const g=(h,k,l)=>{l=void 0===l?!1:l;try{webapis.avplay.setSelectTrack(h,k),a.j[h]=null,e()}catch(m){a.h.debug(`Could not set ${h} track. Trying again...`+`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,Qe:0,Jd:new _.Nj(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.Qe?(!a.w&&++k.Qe,k.Jd.da(a.w?.5:.25)):(a.h.debug("Could not set track after multiple attempts.Giving up..."),
|
|
20
|
+
k&&k.Jd.stop(),a.j[h]=null,f())}};g(b,c)})},lL=function(a){return a.f&&a.a?a.a.lg:webapis.avplay.getCurrentStreamInfo()},wL=function(a){return _.w(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.h.debug("Display resolution ratio: ",a.A)},b=>{a.h.debug("Could not load DISPLAY property");throw b;})})},yL=function(a){try{webapis.avplay.setListener({onbufferingstart:a.I.bind(a),onbufferingprogress:a.H.bind(a),onbufferingcomplete:a.G.bind(a),onstreamcompleted:a.L.bind(a),
|
|
21
|
+
oncurrentplaytime:b=>{a.trigger(new _.C(xL,{currentTime:b}))},onevent:a.K.bind(a),onsubtitlechange:a.N.bind(a),ondrmevent:a.J.bind(a),onerror:a.V.bind(a)})}catch(b){a.h.error(b)}},zL=function(a){const b=!!a.m.getTrackManager().Ba();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.h.debug("Could not set AVPlay subtitle config",c)}},AL=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.h.debug({estimatedBandwidth:c,Ih:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",
|
|
22
|
+
DK+d)}catch(c){a.h.debug(c)}},BL=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+DK+b)}catch(c){throw a.h.debug("Could not set fixed bandwidth",c),c;}},CL=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case BK:a.h.warn("The application doesn't have the privilege to get the mute state.",CK);break;default:a.h.warn(zK,c)}}return!!b},tL=function(a){return{position:a.getPosition(),state:a.m.getState(),Te:a.getState(),playbackRate:a.getPlaybackRate(),
|
|
23
|
+
isLive:a.isLive(),duration:a.getDuration(),isMuted:CL(a),volume:a.getVolume(),th:sL(a),lg:lL(a)}},DL=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");EK(c,"load",d=>a(d));EK(c,_.Vd,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},EL=function(a){return _.w(function*(){yield DL();const b=new Promise(c=>{(new _.Nj(c)).da(5)});if(!(yield Promise.race([wL(a).then(()=>!0),b.then(()=>!1)])))return a.h.debug("Took to long for the SDK to be ready"),
|
|
24
|
+
Promise.reject("SDK Timeout")})},FL=function(a){return _.w(function*(){a.h.debug("avplay.prepare()");return new Promise((b,c)=>{try{webapis.avplay.prepareAsync(()=>{a.h.debug("AVPlay is ready!");zL(a);b()},d=>{a.h.debug("prepareAsync failed",d);c(d)})}catch(d){a.h.debug("Failed to prepare media player for playback"),c(d)}})})},GL=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case BK:a.h.warn("The application does not have the privilege to set mute.",CK);break;default:a.h.warn(zK,
|
|
25
|
+
c)}}},LL=function(a,b,c){return _.w(function*(){a.l=_.Wn(b);const d=a.F,e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.h.debug(`Loading manifest URL: ${a.l[d].url}`);let f=b.startTime||void 0;a.f&&(a.trigger(new _.C(HL)),f=c.currentPosition);try{let g=a.l[d].url;if(a.l[d].type===_.yc&&!g.includes(".mpd")){const h=new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(BL(a,e.nextBandwidth),a.o=!1):(a.o||AL(a,e),
|
|
26
|
+
a.o=!0);yL(a);if(b.drm&&b.drm.env){const h={onError:k=>a.m.onError(k),nb:a.m.getNetworkEngine()};a.g=new IL(b.drm,h);yield a.g.init()}else a.h.debug("No DRM configuration was provided. Assuming clear content");a.f||a.trigger(new _.C(JL));yield FL(a);a.f||a.trigger(new _.C(KL));f&&typeof f===_.r&&0<f&&a.seek(f).catch(h=>{a.h.debug("Couldn't set start position",h)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&GL(a,b.muted),b.autoplay&&a.m.play().catch(h=>{a.h.debug("Autoplay failed",h)}))}catch(g){throw a.h.debug("Error while attempting to load source."),
|
|
27
|
+
g;}})},ML=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();{a=a.a;const 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.h.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())},IL=class{constructor(a,
|
|
28
|
+
b){this.g=a;this.o=null;this.a=_.Ce;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.h=new _.Q("clpp.tizen.DrmEngine")}init(){const a=this;return _.w(function*(){var b=_.hl[a.g.env]||null;if(!b)throw a.h.debug(_.ua,_.xb+a.g.env+_.aa),new _.G(_.E,6,6015,`DRM environment '${a.g.env}' is missing.`);a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};var c=Object.keys(a.g.customData||{}).length?btoa(JSON.stringify(a.g.customData)):"";b=_.jl(b,a.g.customData);const d=b[_.wd];d&&a.f.set(_.wd,
|
|
29
|
+
{$c:d.licenseUrl||"",customData:c,qe:!1});(b=b[_.yd])&&a.f.set(_.yd,{$c:b.licenseUrl||"",customData:c,qe:!1});if(0===a.f.size)throw new _.G(_.E,6,6E3);if((c=a.g.preferredDrmSystem)&&a.f.get(c))a.a=c;else if(a.f.get(_.wd))a.a=_.wd;else if(a.f.get(_.yd))a.a=_.yd;else throw new _.G(_.E,6,6001,"Configuration for the target system is missing.");yield HK(a);a.j=!0})}release(){const a=this;return _.w(function*(){a.j=!1;a.o=null;a.a=_.Ce;a.l=null;a.f=new Map})}getDrmInfo(){return this.o}},KK="DeleteLicenseAfterUse",
|
|
30
|
+
LK="LicenseServer",MK="CustomData";var SL=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.Qn;this.j=_.ht;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.g=2;this.h=new _.Q("clpp.tizen.StateManager")}initialize(){this.a.on(HL,this.C,this);this.a.on(NL,this.B,this);this.a.on(OL,this.A,this);this.a.on(JL,this.H,this);this.a.on(KL,this.G,this);this.a.on(PL,this.F,this)}release(){PK(this,_.Qn);this.l=!1;this.o=-1;this.g=2}destroy(){this.release();this.a.off(HL,this.C);this.a.off(NL,this.B);this.a.off(OL,this.A);this.a.off(JL,
|
|
31
|
+
this.H);this.a.off(KL,this.G);this.a.off(PL,this.F);this.m=this.a=null}C(){this.h.debug("Buffering start. Player state: ",this.a.getState());this.g=this.a.B?1:2;PK(this,_.Ln)}B(a){this.h.debug("Buffering progress: "+a.percent+" %. Player state: ",OK(this.f))}A(){this.h.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay;const b=this.a.getState()===QL;if(!a&&b){PK(this,_.Sn);return}}if(a=this.f!==_.Rn)a=this.a.getState(),a=a===
|
|
32
|
+
QK||a===RK;a&&SK(this)}H(){this.h.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===RL?PK(this,_.Rn):this.h.error("AVPlay prepares while state is not IDLE")}G(){this.h.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){PK(this,_.In)}getState(){return this.f}};var TL=class{constructor(){this.o=this.A=this.f=this.g=this.B=this.m=this.j=this.a=null;this.C=!1;this.w=!0;this.l=null;this.h=new _.Q("clpp.tizen.TextStreamer")}initialize(a){this.m=a}load(a){const b=this;return _.w(function*(){if(b.m)if(b.B=a,b.j=yield TK(b),b.j){var c={configurationId:"",networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:()=>{},filterAllPeriods:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}};try{b.a=yield b.j.start(a.url,c)}catch(d){b.h.warn(d);try{b.a=yield b.j.start(a.url.replace("https://",
|
|
33
|
+
"http://"),c)}catch(e){b.h.error(e),b.a=null}}if(b.a&&UK(b.a)){b.g=VK(b);try{yield b.g.open();b.f=WK(b);const d=b.m.getConfiguration();b.f.g=d.streaming;b.o=d.preferredTextLanguage;b.A=d.preferredTextRole;b.C=d.preferForcedSubtitles}catch(d){b.h.debug("Could not setup media source..."),b.g=null,b.f=null,b.j=null,b.a=null}}}else b.h.debug("Could not find manifest parser for source. Make sure parsers are registered.");else b.h.debug("Text streamer is not initialized. Will not load()")})}G(a){this.h.debug(_.Cy,
|
|
34
|
+
a);this.w=!0;let b=_.kB(a.textStreams,this.o||"",this.A||"",this.C)[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}}F(){this.h.debug("canSwitch_");this.w=!1;this.l&&(_.AC(this.f,this.l,!0,0),this.l=null)}V(){this.h.debug("onError_")}H(){this.j&&this.j.update&&this.j.update()}start(){const a=this;return _.w(function*(){if(a.f)try{a.f.start()}catch(b){a.h.error("Error while starting streaming engine",b)}})}setTextVisibility(a){this.h.debug("Set text visibility",
|
|
35
|
+
a);this.g&&this.g.getTextDisplayer().setTextVisibility(a)}release(){const a=this;return _.w(function*(){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null})}destroy(){const a=this;return _.w(function*(){a.j&&(yield a.j.stop(),a.j=null);a.f&&(yield a.f.destroy(),a.f=null,a.w=!0);a.g&&(yield a.g.destroy(),a.g=null)})}};var V=class extends _.R{constructor(){super();this.g=this.a=this.m=null;this.f={};this.h=new _.Q("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.B=!1;this.o=1}C(a){var b=a.eventid;a=a.data;switch(b){case UL:0<Object.keys(this.f).length||(this.h.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+cL(this,b[0].extra_info).Bit_rate,b=dL(this,{bandwidth:b}))&&(this.w=b,bL(this,b));break;case VL:aL(this);break;default:this.h.debug("Event type: "+
|
|
36
|
+
b+" data: "+a)}}A(a){a.detail.currentState===_.Tn&&this.m.off(_.If,this.A)}initialize(a){this.m=a;this.a=this.m.a;this.m.on(_.If,b=>{this.B||(b=b.detail,b.currentState===_.Tn&&(this.h.debug("Current state",b.currentState),this.B=!0,eL(this)))});this.a.on(WL,this.C,this)}release(){this.f={};this.g=this.w=this.l=this.j=null;this.B=!1;this.o=1}load(){if(this.a&&!(0<Object.keys(this.f).length)){this.g=this.m.g;this.m.off(_.If,this.A);this.m.on(_.If,this.A,this);try{const a=sL(this.a);this.f=kL(this,a);
|
|
37
|
+
const b=this.f[_.K]||[];b.length&&(this.j=b[0].renditions[0]||null);aL(this)}catch(a){this.h.debug("Could not load track manager")}}}destroy(){this.a.off(WL,this.C);this.a=this.m=null}getVideoTracks(){return this.f[_.L]||[]}getAudioTracks(){return this.f[_.K]||[]}ga(){return this.f[_.J]||[]}ka(){return nL(this,_.L)}Ia(){return nL(this,_.K)}Ba(){return nL(this,_.J)}Ua(){return this.w}hb(){this.h.info(AK);return null}ib(){this.h.info(AK);return null}Ca(){const a=this.ka();return a?a.track:null}ja(){const a=
|
|
38
|
+
this.Ia();return a?a.track:null}oa(){const a=this.Ba();return a?a.track:null}$a(a){null===a?(a=this.ka(),uL(this.a,a.bandwidth,null).then(()=>{aL(this)})):0<a.renditions.length&&this.Pa(a.renditions[0])}ra(a){a?qL(this,a.renditions[0]):this.h.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")}Ea(a){a?(a=a.renditions[0],this.g?$K(this.g,a.track):qL(this,a)):(this.h.debug("Disabling text tracks"),this.l=null,vL(this.a,!1),this.m.trigger(new _.C(_.Ek)))}Pa(a){const b=
|
|
39
|
+
this.ka();this.a.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,bL(this,a),uL(this.a,b.bandwidth,a.bandwidth).then(()=>{aL(this)}).catch(c=>{const d=new _.G(_.E,7,7200,{tizenerror:c});this.h.debug("Error while switching video track",c);this.m.onError(d)})):this.h.debug("Trying to switch to already active rendition. Doing nothing...")}Ya(a){qL(this,a)}Za(a){this.g?$K(this.g,a.track):qL(this,a)}addTextTrack(){}ma(){return this.a.o}};V.prototype.isAbrEnabled=V.prototype.ma;
|
|
40
|
+
V.prototype.addTextTrack=V.prototype.addTextTrack;V.prototype.setTextRendition=V.prototype.Za;V.prototype.setAudioRendition=V.prototype.Ya;V.prototype.setVideoRendition=V.prototype.Pa;V.prototype.setTextTrack=V.prototype.Ea;V.prototype.setAudioTrack=V.prototype.ra;V.prototype.setVideoTrack=V.prototype.$a;V.prototype.getTextTrack=V.prototype.oa;V.prototype.getAudioTrack=V.prototype.ja;V.prototype.getVideoTrack=V.prototype.Ca;V.prototype.getLoadingTextRendition=V.prototype.ib;
|
|
41
|
+
V.prototype.getLoadingAudioRendition=V.prototype.hb;V.prototype.getLoadingVideoRendition=V.prototype.Ua;V.prototype.getTextRendition=V.prototype.Ba;V.prototype.getAudioRendition=V.prototype.Ia;V.prototype.getVideoRendition=V.prototype.ka;V.prototype.getTextTracks=V.prototype.ga;V.prototype.getAudioTracks=V.prototype.getAudioTracks;V.prototype.getVideoTracks=V.prototype.getVideoTracks;var $L=class extends _.Ns{constructor(a){super();this.m=a;this.g=null;this.h=new _.Q("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.F=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}}I(){this.w=!0;this.f||this.trigger(new _.C(HL))}H(a){this.w=!0;this.trigger(new _.C(NL,{percent:a}))}G(){this.w=!1;this.trigger(new _.C(OL))}L(){this.trigger(new _.C(PL))}K(a,b){this.trigger(new _.C(WL,{eventid:a,data:b}))}N(a,b,c,d,e){this.trigger(new _.C(XL,{duration:a,text:b,subtitleType:c,
|
|
42
|
+
attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.C(YL,{drmType:a,drmData:b}));this.g&&(a=this.g,a.j&&(a.a===_.yd&&"Challenge"===b.name?JK(a,b):"DrmError"===b.name&&(a.h.debug("DrmError event",b),b=new _.G(_.E,6,6005,{message:JSON.stringify(b)}),a.D.onError(b))))}V(a){this.trigger(new _.C(ZL,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(xL,f,this);e=setTimeout(()=>{this.off(xL,f);d("Timeout")},3E4)});if(a===RL)return(new Promise((c,
|
|
43
|
+
d)=>{webapis.avplay.prepareAsync(()=>{zL(this);c(webapis.avplay.play())},e=>{this.trigger(new _.C(ZL));d(e)})})).then(()=>b());if(a===RK||a===QL)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===QK?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===RK?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===QL||b===QK||b===RK){try{webapis.avplay.setSpeed(a),
|
|
44
|
+
this.C=a}catch(c){return this.h.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.h.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1}getPlaybackRate(){return this.C}load(a,b){const c=this;return _.w(function*(){c.h.debug("configure()",b||"");try{yield EL(c),yield LL(c,a,b)}catch(d){throw new _.G(_.E,7,7003,null,d);}})}getState(){if(this.f&&this.a)return this.a.Te;try{return webapis.avplay.getState()}catch(a){this.V(JSON.stringify(a))}}seek(a){const b=
|
|
45
|
+
1E3*a;return new Promise((c,d)=>{this.B=!0;this.m.trigger(new _.C(_.fg));webapis.avplay.seekTo(b,()=>{this.B=!1;this.m.trigger(new _.C(_.eg));c()},()=>{this.B=!1;d()})})}getPosition(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.V(JSON.stringify(a))}}getDuration(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.V(JSON.stringify(a))}}release(){return new Promise((a,b)=>{try{this.g&&(this.g.release(),
|
|
46
|
+
this.g=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.Jd.stop()}this.j={};this.C=1;this.B=!1;this.a=this.l=null;return a()}catch(c){return b(c)}})}getVolume(){let a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case BK:this.h.debug("The application does not have the privilege to get the volume.",CK);break;default:this.h.debug(zK,b)}}return a}setVolume(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.h.warn("Invalid value passed for setVolume.",
|
|
47
|
+
"The passed value value should be in the range of 0 to 1.");break;case BK:this.h.warn("The application does not have the privilege to set the volume.",CK);break;default:this.h.warn("An unknown error occurred while trying to set volume",b)}}}isLive(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.V(JSON.stringify(a))}}stop(){try{webapis.avplay.stop()}catch(a){this.h.debug(a)}}getDrmInfo(){this.g&&this.g.getDrmInfo();return null}setSourceIndex(a){this.F=
|
|
48
|
+
a}getSourceIndex(){return this.F}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},RL="IDLE",QL="READY",QK="PLAYING",RK="PAUSED",fL=_.Sb,gL="AUDIO",pL="TEXT",VL="PLAYER_MSG_RESOLUTION_CHANGED",UL="PLAYER_MSG_BITRATE_CHANGE",NK="PLAYREADY",IK="WIDEVINE_CDM";var dM=class extends _.Ns{constructor(){super();this.a=new $L(this);this.f=new SL(this);this.configuration=this.B=_.Ok();this.w=null;this.h=new _.Q("clpp.tizen.Player");this.j=null;this.l=new V;this.C=new _.So;this.o=this.g=null;this.A=!1}H(){this.h.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.C(_.Ud));this.configuration.loop?this.seek(this.configuration.startTime||0).catch(()=>{this.h.debug("Could not loop playback")}):this.a.stop()}F(a){this.trigger(new _.C(_.Sf,
|
|
49
|
+
{currentTime:a.currentTime/1E3}))}I(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.h.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.wi(d))&&this.o.append([new _.is(b,c,d)],[])}G(a){this.h.debug("DRM event: "+a.drmType+", data: "+a.drmData)}J(){this.A||(this.h.debug("Initial buffering completed..."),this.A=!0)}V(a){this.h.debug(`Error: TYPE: ${a.eventType}`);PK(this.f,_.Pn);a=new _.G(_.E,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.C(_.Vd,{detail:a}))}init(a,
|
|
50
|
+
b){this.configuration=this.B=b;this.w=a;this.a.on(PL,this.H,this);this.a.on(xL,this.F,this);this.a.on(XL,this.I,this);this.a.on(YL,this.G,this);this.a.on(ZL,this.V,this);this.a.on(OL,this.J,this);this.f.initialize();this.l.initialize(this);this.h.debug("Initializing player surface");this.w.hideMediaElement();a=aM;aM+=1;a="__clpp_tizen_player_"+a;this.j=_.oo(_.De,{id:a,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var c=this.w.getMedia();if(c){a=this.j;{b=[_.xg,_.Zd,"position",
|
|
51
|
+
_.je,"top"];const e={};c=null!==c.parentElement?window.getComputedStyle(c,null):c.style;if(!b||0===b.length)for(d in b||(b=[]),c)b.push(d);for(const f of b)e[f]=c[f];var d=e}_.qo(a,d);ML(this)}}getSurface(){return this.w}getConfiguration(){return this.configuration}getTimeline(){return null}setupPlaylist(){return Promise.reject(_.pb)}appendLoad(){return Promise.reject(_.pb)}seekWith(){return Promise.reject(_.pb)}destroy(){const a=this;return _.w(function*(){yield a.release();a.a.off(PL,a.H);a.a.off(xL,
|
|
52
|
+
a.F);a.a.off(XL,a.I);a.a.off(YL,a.G);a.a.off(ZL,a.V);a.a.off(OL,a.J);a.g&&(yield a.g.destroy(),a.g=null);a.j&&(a.j.parentElement.removeChild(a.j),a.j=null);a.l.destroy();a.f.destroy();a.l=null;a.f=null})}namespace(){return bM}getPlaybackRate(){return this.a.getPlaybackRate()}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}setPlaybackRate(a){this.a.setPlaybackRate(a)}getPosition(){return this.getMediaPosition()}getMediaPosition(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===
|
|
53
|
+
_.In?this.getDuration():this.a.getPosition()||0}seek(a){return typeof a===_.r&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()}getPresentationStartTime(){return null}getSeekRange(){return{start:0,end:0}}getVolume(){const a=this.a.getVolume();return typeof a===_.r?a/100:null}setVolume(a){this.a.setVolume(a)}getDuration(){return this.getMediaDuration()}getMediaDuration(){return this.a.getDuration()}getBufferInfo(){this.h.warn(_.qa);return new _.Ms}getTrackManager(){return this.l}unload(){return this.a.release().then(()=>
|
|
54
|
+
{this.l.release()})}release(){const a=this;return _.w(function*(){a.g&&(yield a.g.release());a.o&&(yield a.o.destroy(),a.o=null);yield a.a.release();a.l.release();a.f.release();a.A=!1})}load(a){const b=this;return _.w(function*(){b.configuration=_.Qk(b.B,a);var c=_.yn(b.configuration,[_.ae,"native"]);b.o=c.create(b);c=_.Wn(b.configuration)[0];if(b.configuration.tizen&&b.configuration.tizen.sideStreamText){b.g=new TL;b.g.initialize(b);try{yield b.g.load(c),b.g.start()}catch(d){b.h.error(d)}}try{yield b.a.load(b.configuration)}catch(d){throw b.onError(d),
|
|
55
|
+
d;}b.l.load()})}play(){this.trigger(new _.C(_.Re));ML(this);return this.a.play().then(()=>{SK(this.f)})}pause(){return this.a.pause().then(()=>{SK(this.f)})}getState(){return this.f.getState()}getPeriods(){return[]}onError(a){const b=new _.C(_.Vd,{detail:a});a.severity===_.E&&(PK(this.f,_.Pn),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)}getDrmInfo(){return this.a.getDrmInfo()}isEnded(){return this.f.getState()===_.In}isPaused(){return this.a.getState()===RK}isMuted(){return CL(this.a)}setMuted(a){GL(this.a,
|
|
56
|
+
a)}getNetworkEngine(){return this.C}setNetworkEngine(a){this.C=a}isLive(){return this.a.isLive()}getStats(){return null}setSourceIndex(a){this.a.setSourceIndex(a)}getSourceIndex(){return this.a.getSourceIndex()}getLoadedSource(){return this.a.getLoadedSource()}canPlay(a,b){return(new cM).canPlay(a,b)}getTimelineCues(){return[]}getTextDisplayer(){return this.o}resetAbr(){}};dM.prototype.getTextDisplayer=dM.prototype.getTextDisplayer;dM.prototype.setNetworkEngine=dM.prototype.setNetworkEngine;
|
|
57
|
+
dM.prototype.getNetworkEngine=dM.prototype.getNetworkEngine;var bM="clpp.tizen",aM=0,cM=class{a(){return bM}canPlay(a){a=a.type;const b=!!window.webapis;if((a===_.yc||a===_.Ik||a===_.Dc)&&b){if(_.Rj(2))return 2;if(_.Rj(3)||_.Rj(4)||_.Rj(5)||_.Rj(6))return _.B("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0}f(a){return a===_.na}create(){return new dM}};_.x("clpp.tizen.TizenComponent",class extends _.Ft{f(){_.hh(new cM)}a(){var a=bM;a&&_.fh[a]&&(delete _.fh[a],_.gh.info("Removed Player factory: '"+a+"'"))}id(){return"tizen"}});var HL="onbufferingstart",NL="onbufferingprogress",OL="onbufferingcomplete",PL="onstreamcompleted",xL="oncurrentplaytime",WL="onevent",XL="onsubtitlechange",YL="ondrmevent",ZL="onerror",JL="preparingstart",KL="preparingend";};f.call(g, window);
|
package/cl.ttml.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
Number(a[3]),f=Number(a[4]);f+=(Number(a[5])||0)/b.f;e+=f/b.frameRate;c=e+60*d+3600*c}}else
|
|
3
|
-
"$1em")},
|
|
4
|
-
e);for(const e of a.j)d.appendChild(
|
|
5
|
-
|
|
6
|
-
{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(
|
|
7
|
-
a%1E3)).padStart(3,"0")}`},
|
|
8
|
-
"lineHeight","opacity","padding",
|
|
9
|
-
f.get(this.o))){g.region=f.build(a,e);g.textAlign=
|
|
10
|
-
a.getAttribute("imagetype"),a=a.j.trim(),d="PNG"===e&&"Base64"===d&&0<a.length?`data:image/png;base64,${a}`:null,g.backgroundImage=d||"");return g}};var
|
|
11
|
-
d,1,100);c.widthUnits
|
|
12
|
-
this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!
|
|
13
|
-
"monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(
|
|
14
|
-
|
|
15
|
-
["color","color"],[
|
|
16
|
-
_.
|
|
17
|
-
new
|
|
18
|
-
g=new
|
|
19
|
-
c.getId()),c=d,g=a,
|
|
20
|
-
c.f.set(b,g),c.o.push(g),c=g):c=null,c&&a.l.push(c.getId());e=d.Oc();f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var
|
|
21
|
-
e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.
|
|
22
|
-
_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var xv='application/mp4; codecs\x3d"stpp.ttml"',yv='application/mp4; codecs\x3d"stpp.ttml.im1i"',zv='application/mp4; codecs\x3d"stpp.ttml.im1t"',Av="backgroundColor",Bv="direction",Cv="displayAlign",Dv="region",Ev="textAlign",Fv="textDecoration",Gv="writingMode",Hv=function(a,b,c){a=a.f;for(let d=a.length-1;0<=d;d--){const e=b.get(a[d]);if(c in e.a)return e.getAttribute(c)}return null},Pv=function(a,b){var c=null;if(Iv.test(a)){{a=Iv.exec(a);c=Number(a[1]);const d=Number(a[2]);let e=
|
|
2
|
+
Number(a[3]),f=Number(a[4]);f+=(Number(a[5])||0)/b.f;e+=f/b.frameRate;c=e+60*d+3600*c}}else Jv.test(a)?c=Kv(Jv,a):Lv.test(a)?c=Kv(Lv,a):Mv.test(a)?(a=Mv.exec(a),c=Number(a[1])/b.frameRate):Nv.test(a)?(a=Nv.exec(a),c=Number(a[1])/b.a):Ov.test(a)&&(c=Kv(Ov,a));return c},Kv=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},Qv=function(a){return a.split(":").pop()},Rv=function(a){return a.replace(/(\d*\.?\d+)c/g,
|
|
3
|
+
"$1em")},Tv=function(a,b){for(;Sv.test(a);){const c=Sv.exec(a)[0];a=a.replace(c,`${parseInt(c,10)/b}em`)}return a},Uv=function(a){return a?a.replace(/(\d*\.?\d+)%/g,(b,c)=>`${c/100}em`):""},Vv=function(a,b,c){a=Hv(a,b,Ev);if(!a&&c&&(a=Hv(c,b,Ev),!a&&"rltb"===Hv(c,b,Gv)))return _.vf;switch(a){case _.$c:return _.ds;case _.vf:case _.Td:return _.vf;default:return _.je}},Wv=function(a,b,c){if(_.si(a.w))return document.createTextNode(_.wi(a.w||""));if(a.A)return _.oo("br");const d=_.oo("span");for(const e of a.f)_.po(d,
|
|
4
|
+
e);for(const e of a.j)d.appendChild(Wv(c.get(e),b,c));return d},Zv=function(a,b,c,d){const e=Xv.exec(a);a=Yv.exec(a);return typeof b===_.r&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},$v=function(a,b){return typeof b===_.r&&0<b?_.ls:Yv.test(a)?0:_.ls},aw=function(a,b,c){return typeof a===_.r?a:typeof b===_.r?b:c},bw=function(a,b){a=a.getAttribute("extent");return(a=Yv.exec(a))?Number(a[b]):null},dw=function(a){a=a.getAttribute("cellResolution");return(a=cw.exec(a))?Number(a[2]):null},
|
|
5
|
+
fw=function(){return`${"inline-"}${ew++}`},hw=function(a){return gw.some(b=>b in a.attributes)},iw=function(a,b){if(0===b.length)return[];const c=[];for(const d of b)a.a.has(d)&&c.push(...iw(a,a.a.get(d).f),d);return c},jw=function(a){return Qv(a.g.nodeName)},mw=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null;let e=[],f=[],g={};const h=b.parentNode;if(h&&a.a.has(h)){const k=a.a.get(h);e=[...k.l];-1===["#text","span","br"].indexOf(b.nodeName)&&(c=k.a,d=k.j,f=[...k.f],g={},kw.forEach(l=>
|
|
6
|
+
{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Dv)&&(c=b.getAttribute(Dv));b.hasAttribute(_.Nf)&&f.push(...b.getAttribute(_.Nf).split(" "));d=Array.from(b.attributes).map(k=>k.name);for(const k of d)d=Qv(k),g[d]=b.getAttribute(k);d=g.backgroundImage}c=new lw(b,c,d,e,f,g);a.a.set(b,c);return c},nw=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*
|
|
7
|
+
a%1E3)).padStart(3,"0")}`},ow=class{constructor(a,b,c){this.g=a;this.f=b;this.a=c}getId(){return this.g}getAttribute(a){return this.a[a]}};var pw=class extends ow{constructor(a,b,c){super(a,[],c);this.j=b||""}};var qw=class extends ow{constructor(a,b,c){super(a,b,c)}};var Iv=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Jv=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Lv=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Mv=/^(\d*(?:\.\d*)?)f$/,Nv=/^(\d*(?:\.\d*)?)t$/,Ov=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Xv=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Yv=/^(\d+)px (\d+)px$/,cw=/^(\d+) (\d+)$/,Sv=/(\d+)px/,rw=/^(\d+px|\d+em|\d*\.?\d+c)$/,gw=[Av,"color",Bv,Cv,"fontFamily","fontSize","fontStyle","fontWeight",
|
|
8
|
+
"lineHeight","opacity","padding",Ev,Fv,"textOutline",Gv,"zIndex"],kw=["begin",_.Td];var sw=class extends qw{constructor(a,b,c,d,e,f,g){super(a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]}build(a,b,c,d,e,f,g){let h=Pv(this.a.begin,b);b=Pv(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.oo(_.Gd);for(const k of this.j)c.appendChild(Wv(g.get(k),e,g));g=new _.is(h,b,c.innerHTML.trim(),_.Vf);g.cssClassList=[...this.f];g.textAlign=Vv(this,e,null);g.writingMode=_.es;g.line=-1;g.lineInterpretation=_.fs;g.lineAlign=_.gs;g.containerRows=aw(null,dw(a),15);if(this.o&&(f=
|
|
9
|
+
f.get(this.o))){g.region=f.build(a,e);g.textAlign=Vv(this,e,f);a:switch(Hv(f,e,Gv)){case "tb":case "tblr":a=_.hg;break a;case "tbrl":a=_.ig;break a;default:a=_.es}g.writingMode=a;a:switch(Hv(f,e,Cv)){case _.$c:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Hv(f,e,Cv)){case _.$c:a=1;break a;default:a=_.fs}g.lineInterpretation=a;a:switch(Hv(f,e,Cv)){case _.$c:e=_.$c;break a;default:e=_.gs}g.lineAlign=e}this.l&&(d=d.get(this.l))&&(a=d,d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||
|
|
10
|
+
a.getAttribute("imagetype"),a=a.j.trim(),d="PNG"===e&&"Base64"===d&&0<a.length?`data:image/png;base64,${a}`:null,g.backgroundImage=d||"");return g}};var tw=class{constructor(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]))}};var uw=class extends qw{constructor(a,b,c){super(a,b,c)}build(a,b){const c=new _.ns;c.id=this.getId();const d=aw(a.j.containerWidth,bw(a,1),720);a=aw(a.j.containerHeight,bw(a,2),480);a:switch(Hv(this,b,Cv)){case "after":var e="flex-start";break a;case _.$c:e=_.$c;break a;default:e="flex-end"}c.displayAlign=e;a:switch(Hv(this,b,Gv)){case "tb":case "tblr":e="row-reverse";break a;case "tbrl":e="row";break a;default:e=_.sd}c.writingMode=e;e=this.getAttribute("extent")||Hv(this,b,"extent");c.width=Zv(e,
|
|
11
|
+
d,1,100);c.widthUnits=$v(e,d);c.height=Zv(e,a,2,100);c.heightUnits=$v(e,a);b=this.getAttribute("origin")||Hv(this,b,"origin");c.viewportAnchorX=Zv(b,d,1,0);c.viewportAnchorY=Zv(b,a,2,0);c.viewportAnchorUnits=$v(b,d);c.cssClassList=[...this.f];return c}};var vw=class extends ow{constructor(a,b){super("root-container",[],b);this.j=a}};var xw=class extends ow{constructor(a,b,c){super(a,b,c)}build(a){var b=null;var c=dw(a);c&&(b=aw(a.j.containerHeight,bw(a,2),480)/c);b=aw(a.j.fontSizeRadix,b,16);a=[];c=`::ttml .${this.g}, ::ttml .${this.g} * {`;for(const [g,h]of ww.entries())g in this.a&&(c+=`${h}:${Rv(this.a[g])};`);a:{if("unicodeBidi"in this.a){var d=this.a.unicodeBidi;var e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d=`unicode-bidi:${e};`;break a}}d=""}c+=d;a:{if("textOutline"in
|
|
12
|
+
this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!rw.test(h)&&rw.test(k)&&rw.test(l)?(e=h,g=k):2===d.length&&!rw.test(h)&&rw.test(k)?(e=h,g=k):2===d.length&&rw.test(h)&&rw.test(k)&&(g=h);if(""!==g){g=Rv(g);d="text-shadow:"+`0 0 ${g} ${e},`+`0 0 ${g} ${e},`+`0 0 ${g} ${e};`;break a}}d=""}c+=d;"textShadow"in this.a?(d=Uv(this.a.textShadow),d=Rv(d),d=`text-shadow:${d};`):d="";c=c+d+("fontFamily"in this.a?`font-family:${this.a.fontFamily.replace("monospaceSansSerif",
|
|
13
|
+
"monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(Fv in this.a){d=this.a.textDecoration.split(" ");e=[];for(f of d)switch(f){case "underline":case "overline":e.push(f);break;case "lineThrough":e.push("line-through")}if(0<e.length){var f=`text-decoration:${e.join(" ")};`;break a}}f=""}"padding"in this.a?(d="border: solid transparent;border-width:"+
|
|
14
|
+
Rv(this.a.padding),d+=";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=Rv(d),d=Tv(d,b),c+="line-height:",c+=d,c+=";"):c="";a.push(f+c+"}");a:{if("fontSize"in this.a&&(f=this.a.fontSize.split(" "),c=null,1===f.length&&(c=f[0]),2===f.length&&(c=f[1]),c)){c=c.trim();c=Rv(c);c=Tv(c,b);b=`font-size:${c};`;break a}b=null}b&&(f=`::ttml .${this.g} .clpp-text-wrapper {`,f+=b,f+="}",a.push(f),f=`::ttml .clpp-text-wrapper__${this.g} {`,f+=b,f+="}",a.push(f));return a}},ww=new Map([[Av,"background-color"],
|
|
15
|
+
["color","color"],[Bv,Bv],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var yw=class{constructor(a){this.B=a;this.w=this.l=null;this.A=0;this.g=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]}Oc(){return this.o.map(a=>a.build(this.l,this.w,this.A,this.g,this.a,this.j,this.f)).filter(a=>null!=a)}},ew=0;var Bw=class{constructor(a){this.a=a.firstChild;this.f=new Set}zc(){return!!this.a}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!zw.has(Qv(a.nodeName))||Aw.has(Qv(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&&!zw.has(Qv(a.nodeName))));const b=this.a;this.a=a;return b}},zw=new Set(["tt","head","layout",_.we,_.be,Dv,"styling",_.Nf,"body",
|
|
16
|
+
_.Gd,"p","span","br"]),Aw=new Set([_.Nf,_.be]);var lw=class{constructor(a,b,c,d,e,f){this.g=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f}getId(){return this.attributes.id}};var Cw=class{constructor(){this.a=new Map}};var Dw=class{constructor(a){this.a=a;this.f=new DOMParser}parseInit(){}parseMedia(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.Lg(this.a.ttml||{}),e=_.I(a,0,c[0]);e=_.ji(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.Rf)}catch(m){throw new _.G(_.E,2,2005,"Failed to parse TTML.");}d=new yw(d);e=new Cw;f=new Bw(f);b=b.periodStart;typeof b===_.r&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],k=_.I(a,b,h);k=_.xi(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.g.set(m,
|
|
17
|
+
new pw(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.zc();)a=f.next(),a=mw(e,a),c=d,b=a,"tt"===jw(b)&&(c.l=new vw(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===jw(b)&&(c.w=new tw(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,jw(b)!==_.be||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.g.set(g,new pw(g,b.g.textContent,b.attributes))),c=d,g=a,jw(g)===_.be&&g.attributes.begin&&g.attributes.end?(b=`#${fw()}`,
|
|
18
|
+
g=new pw(b,g.g.textContent,g.attributes),c.g.set(b,g),c=g):c=null,c&&(a.j=c.getId()),c=d,b=a,jw(b)===_.Nf&&(g=b.getId()||fw(),h=new xw(g,b.f,Object.assign({},b.attributes)),c.a.set(g,h),b.a&&c.j.get(b.a).f.push(g)),c=d,g=a,jw(g)!==_.Nf&&hw(g)?(b=fw(),g=new xw(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,jw(g)!==_.Gd||!g.attributes.extent&&!g.attributes.origin?c=null:(b=fw(),g=new uw(b,iw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=
|
|
19
|
+
c.getId()),c=d,g=a,jw(g)!==Dv?c=null:(b=g.getId(),g=new uw(b,iw(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=c.getId()),c=d,g=a,b=g.l,-1===["#text","span","br"].indexOf(jw(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=fw(),g=new sw(b,"#text"===g.g.nodeName?g.g.textContent:null,"br"===jw(g),g.a,g.j,iw(c,g.f),g.attributes),c.f.set(b,g),(c=c.f.get(h))&&c.j.push(b),c=g):c=null),c&&a.l.push(c.getId()),c=d,g=a,"p"===jw(g)||g.j?(b=fw(),g=new sw(b,null,!1,g.a,g.j,iw(c,g.f),g.attributes),
|
|
20
|
+
c.f.set(b,g),c.o.push(g),c=g):c=null,c&&a.l.push(c.getId());e=d.Oc();f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var Ew=class{constructor(a){this.f=a}a(a){var b=new Dw(this.f);({cues:a}=b.parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}));b="WEBVTT\n\n";for(const d of a){a=b;b=nw(d.startTime)+" --\x3e "+nw(d.endTime);{var c=d;const e=[];switch(c.textAlign){case _.je:e.push("align:left");break;case _.vf:e.push("align:right");break;case _.ds:e.push("align:middle");break;case _.je:e.push("align:start");break;case _.vf:e.push("align:end")}switch(c.writingMode){case _.hg:e.push("vertical:lr");break;case _.ig:e.push("vertical:rl")}c=
|
|
21
|
+
e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.ni(b)}},Fw=class{probe(a,b){return a===_.Cc&&b===_.Qf}create(a){return new Ew(a)}};var Gw=class{constructor(a){this.a=new Dw(a);this.h=new _.Q("clpp.ttml.Mp4TtmlParser")}parseInit(a){let b=!1;(new _.Gl).M(_.ze,_.zl).M(_.Tf,_.zl).M(_.ue,_.zl).M(_.ye,_.zl).M(_.Kf,_.zl).ba(_.Mf,_.Al).M("stpp",c=>{b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.G(_.E,2,2007);}parseMedia(a,b){let c=!1,d=[],e=[];const f=[];(new _.Gl).M("moof",_.zl).M("traf",_.zl).ba("subs",g=>{const h=_.O(g.reader);for(let k=0;k<h;++k){g.reader.skip(4);const l=_.sl(g.reader);for(let m=0;m<l;++m){const n=1===g.version?
|
|
22
|
+
_.O(g.reader):_.sl(g.reader);f.push(n);g.reader.skip(6)}}}).M(_.te,_.Bl(g=>{c=!0;g=this.a.parseMedia(g,b,f);d=d.concat(g.cues);e=e.concat(g.styles)})).parse(a);c||this.h.warn("Couldn't find the mdat box");return{cues:d,styles:e}}};_.x("clpp.ttml.TtmlComponent",class extends _.Ft{constructor(){super();this.j=new Fw}f(){_.Or(_.Cc,Dw);_.Or(_.Ac,Gw);_.Or(xv,Gw);_.Or(zv,Gw);_.Or(yv,Gw);_.yj.push(this.j)}a(){_.Qr(_.Cc);_.Qr(_.Ac);_.Qr(xv);_.Qr(zv);_.Qr(yv);_.Aj(this.j)}id(){return"subtitles-ttml"}});};f.call(g, window);
|
package/cl.verimatrix.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
modifiers:{licenseRequest:this.
|
|
4
|
-
b);_.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var lv="VerimatrixVCAS",mv="clpp.verimatrix.Vcas",nv="clpp.verimatrix.VcasComponent",pv=function(a,b){return a.C===ov?(a=Object.assign({},{deviceId:_.yi(_.pi(a.A))},a.a&&{authenticator:_.yi(_.pi(a.a))}),b+_.hj(a)):b},wv=class extends _.Ss{constructor(a){super(lv);const b={};b[qv]=qv;b[rv]=rv;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=ov,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
|
|
2
|
+
sv}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=pv(this,g);this.o=pv(this,h);this.l=pv(this,k);this.j=l;this.G=m;this.F=n;this.h=new _.Q(mv);_.ti(this.w)?this.h.warn(_.Wb):this.La(_.yd,{licenseUrl:this.w,videoRobustness:[_.Eb,void 0],audioRobustness:[_.Db,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.g.bind(this)}});_.ti(this.o)?this.h.warn(_.ub):this.La(_.wd,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
|
|
3
|
+
modifiers:{licenseRequest:this.g.bind(this)}});_.ti(this.l)?this.h.warn(_.Ta):_.ti(this.j)?this.h.warn(_.Sa):this.La(_.ud,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.J.bind(this),licenseResponse:this.K.bind(this),extractContentId:this.H.bind(this)}})}g(a,b){if(this.C===uv){a=this.B[rv];const c={};c[this.B[qv]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.Fl(b);switch(this.F){case vv:a=_.hj({r:a,Th:this.G},!0)}return a}J(a,b){this.g(a,
|
|
4
|
+
b);_.Kl(b)}K(a,b){_.Ll(b)}};_.x(mv,wv);wv.prototype.constructor=wv.prototype.constructor;wv.NAME=lv;var ov="query-string",uv="http-header";wv.LicenseRequestVuidLocation={QUERY_STRING:ov,HTTP_HEADER:uv};var qv="DeviceId",rv="Authenticator";wv.LicenseRequestHttpHeader={DEVICE_ID_HEADER:qv,AUTHENTICATOR_HEADER:rv};var sv="keyid",vv="contentid-siteid";wv.FairPlayAssetIdStrategy={KEYID:sv,CONTENTID_SITEID:vv};_.x(nv,class extends _.Ft{constructor(){super();this.h=new _.Q(nv)}a(){delete _.hl.VerimatrixVCAS}g(a){a=a.getConfiguration();if(a.drm&&a.drm.env===lv){({customData:a}=a.drm);if(!a)throw new _.G(_.E,7,7100,_.zd);a=new wv(a);this.h.info("Registering the Verimatrix VCAS Ultra environment");_.il(a)}}id(){return"verimatrix-vcas"}});};f.call(g, window);
|
package/cl.vimond.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
e;this.a=new _.
|
|
3
|
-
this.j=!1}I(a){const b=this;return _.
|
|
4
|
-
a.o} seconds ago`);a.o=n}a.
|
|
5
|
-
"")}e.videoProtocol=f;const
|
|
6
|
-
b.f;q.timestamp=(new Date).toISOString();b.
|
|
7
|
-
a.onError(new _.
|
|
8
|
-
this.
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var cv="Registering listeners",dv="clpp.vimond.VimondPlugin",ev=function(a,b){a.m.trigger(new _.C(_.ng,{detail:b}))},fv=function(a,b,c){b&&(a.B=!0,a.g.stop());a.m.onError(new _.G(b?_.E:1,9,9201,c))},gv=function(a,b){const c=a.m.getState();if(1===b)return["str-start",_.bf];if(a.g)return[_.Td,_.Ne];if(c===_.In)return[_.Td,null];if(c===_.Pn)return[_.Vd,_.Ne];b=_.Ne;if(c===_.Ln||c===_.Tn||a.f)b=_.bf;return["period",b]},hv=class{constructor(a,b,c,d,e){this.K=a;this.L=b;this.N=c;this.m=d;this.F=
|
|
2
|
+
e;this.a=new _.as;this.l=!0;this.f=this.j=this.B=!1;this.C=null;this.g=new _.Nj(this.A.bind(this));this.h=new _.Q("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.h.debug(cv),this.a.on(this.m,_.If,this.I.bind(this)),this.a.on(this.m,_.Sf,this.J.bind(this)),this.a.on(this.m,_.bc,this.G.bind(this)),this.a.on(this.m,_.cc,this.H.bind(this)))}J(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()}G(){this.h.debug("Ad break started");this.j=!0}H(){this.h.debug("Ad break stopped");
|
|
3
|
+
this.j=!1}I(a){const b=this;return _.w(function*(){const c=a.detail,d=c.currentState;b.h.debug(`State changed, prev: ${c.previousState} curr: ${d}`);b.B||b.j||(d!==b.C||b.f?b.l&&d!==_.Tn||(b.f&&[_.Sn,_.Ln].includes(d)?b.h.debug("Seeking"):(b.f&&d===_.Tn&&(b.h.debug("Seeked"),b.f=!1),[_.Tn,_.Sn,_.Pn,_.In].includes(d)&&(b.C=d,yield b.A(),d===_.In&&b.g.stop()))):b.h.debug("Ignore transition"))})}A(){const a=this;return _.w(function*(){{const n=Math.floor(Date.now()/1E3);0<a.o&&a.h.debug(`Last event was ${n-
|
|
4
|
+
a.o} seconds ago`);a.o=n}a.g.stop();a.g.da(a.l?10:a.K);a.l=!1;try{{var b=a.F;b.f++;const q=_.Kg(b.o);q.client.buildName=_.ra;q.client.buildVersion=_.fa;var c=q.client;{const A=b.a.m.getDrmInfo();var d=A?A.keySystem:""}c.drm=d;q.client.pageUrl=document.location.href;q.client.streamUrl=b.a.m.getLoadedSource().url;q.client.userAgent=navigator.userAgent;q.client.videoFormat=b.a.m.getLoadedSource().type||"";var e=q.client;{const A=b.a.m.getLoadedSource();var f=((new _.El(A.url)).scheme||"").replace(":",
|
|
5
|
+
"")}e.videoProtocol=f;const u=gv(b.a,b.f);q.client.playerEvent=u[0]||"";q.client.playerState=u[1]||"";q.progress.vod&&(q.progress.vod.position=b.a.getPosition());const v=q.progress.live;if(v){{var g=b.a;const A=g.m.getPresentationStartTime()||0,D=Math.floor(A+g.m.getPosition());var h=(new Date(1E3*D)).toISOString()}v.position=h;{var k=b.a;const A=k.m.getPosition(),D=k.m.getSeekRange().end;var l=30>Math.abs(D-A)}v.onLiveEdge=l;typeof v.liveResumePossible!==_.Rc&&(v.liveResumePossible=!0)}q.progress.eventNumber=
|
|
6
|
+
b.f;q.timestamp=(new Date).toISOString();b.h.debug("Fire an event");const y=_.Ni(b.l);y.method="POST";y.contentType="application/json";y.headers.Authorization=`Bearer ${b.g}`;y.body=_.pi(JSON.stringify(q));var m=b.j.fetch(y).P}const n=yield m;ev(a,n)}catch(n){m=n.code,b=n.data,[1002,1003].includes(m)?(a.h.debug("Unreachable service"),ev(a,b),fv(a,a.L,b)):1001===m?(a.h.debug("Generic service error"),ev(a,b),fv(a,a.N,b)):a.h.error(n.toString())}})}dispose(){this.h.debug(_.Ob);_.kh(this.a);this.g.stop()}};var iv=class{constructor(a,b,c,d,e){this.l=a;this.o=c;this.g=b;this.a=d;this.j=e;this.h=new _.Q("clpp.vimond.VimondService");this.f=0}Ie(a){this.g=a}};var jv=class{constructor(a){this.m=a;this.a=new _.as;this.h=new _.Q("clpp.vimond.VimondAdapter");this.f=this.g=!1;this.m&&this.a&&(this.h.debug(cv),this.a.on(this.m,_.rf,this.o.bind(this)),this.a.on(this.m,_.bc,this.j.bind(this)),this.a.on(this.m,_.cc,this.l.bind(this)))}getPosition(){return Math.floor(this.m.getPosition())}o(){this.g=!0}j(){this.f=!0}l(){this.f=!1}dispose(){this.h.debug(_.Ob);_.kh(this.a)}};var kv=class extends _.hu{constructor(){super();this.a=!1;this.h=new _.Q(dv);this.j=this.g=this.f=null}onPlayerCreated(){}onContentWillLoad(a){var b=a.getConfiguration();(this.a=!_.z(b.vimond)&&typeof b.vimond===_.De)?a.namespace()===_.kd&&(this.a=!1,this.h.info("Vimond does not report when casting.")):this.h.warn("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c of["authToken","playerEventRequest"])if(!b[c]){this.h.warn(`${c} key is missing`);
|
|
7
|
+
a.onError(new _.G(1,9,9200));return}this.h.debug("Configuration is valid");c=b.failIfUnreachable;typeof c!==_.Rc&&(c=!0);var d=b.failOnError;typeof d!==_.Rc&&(d=!0);this.f=new jv(a);this.g=new iv(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new hv(b.playerEventRequest.eventInterval,c,d,a,this.g)}}onPlayerWillRelease(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.g=this.f=null)}onPlayerWillDestroy(){}id(){return"vimond"}Ie(a){this.a&&
|
|
8
|
+
this.g&&this.g.Ie(a)}};_.x(dv,kv);kv.prototype.updateAuthToken=kv.prototype.Ie;kv.Id="vimond";_.Vo(new class{create(){return new kv}});};f.call(g, window);
|