@castlabs/prestoplay 6.13.0 → 6.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -6
- package/cjs/cl.cast.js +111 -111
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +528 -518
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +60 -58
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +69 -67
- 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 +265 -274
- package/cjs/cl.muxdata.js +15 -14
- 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 +71 -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 +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +441 -431
- package/cl.crypto.js +8 -8
- package/cl.dash.js +68 -68
- package/cl.externs.js +60 -58
- 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 +236 -239
- package/cl.muxdata.js +13 -12
- 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 +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +2 -0
- package/package.json +4 -4
- package/typings.d.ts +93 -50
package/cjs/cl.mse.js
CHANGED
|
@@ -1,280 +1,271 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
_.
|
|
8
|
-
c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?
|
|
9
|
-
b,d||null,e,a,c)};_.
|
|
10
|
-
|
|
11
|
-
_
|
|
12
|
-
|
|
13
|
-
_.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
a.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return Promise.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
b.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
b
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
a;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
_.
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
a.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
b
|
|
132
|
-
|
|
133
|
-
a.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
_.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
a.
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
b
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
return _.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
_.
|
|
210
|
-
Kz.prototype.A=function(a){this.h=a.captions;var b=new Uint8Array(a.data.byteLength+a.initSegment.byteLength);b.set(a.initSegment,0);b.set(a.data,a.initSegment.byteLength);a.type===_.sg?this.o.push(b):a.type===_.$c&&this.l.push(b)};Kz.prototype.w=function(){var a={video:_.jj.apply(_.cj,_.Og(this.o)),captions:this.h,audio:_.jj.apply(_.cj,_.Og(this.l))};this.f.resolve(a);this.j=!1};
|
|
211
|
-
_.Tz.prototype.track=function(a){null!=this.player&&(this.player&&(this.player.off(_.Jf,this.a),this.f&&this.player.off(_.eg,this.a)),this.player=null);a&&(this.player=a,this.player.on(_.Jf,this.a,this))};
|
|
212
|
-
_.Tz.prototype.append=function(a,b,c){var d=this.j?this.j(c):null;d||this.log.debug("Unable to resolve rendition for id",c);c={start:a,end:b,rendition:d,width:d?d.width:0,height:d?d.height:0,bandwidth:d?d.bandwidth:0};var e=this.S.find(function(f){return f.start>=a&&f.end<=b});if(e)e.rendition=d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{d=_.u(this.S);for(e=d.next();!e.done;e=d.next())e=e.value,a>=e.start&&a<e.end?e.end=a:b>=e.start&&b<e.end&&(e.start=
|
|
213
|
-
b);this.S.push(c);this.S.sort(Sz)}Wz(this);this.a();this.player&&this.player.trigger(new _.L(_.vg))};_.Tz.prototype.clear=function(){this.S=[];Wz(this);this.player&&(this.player.trigger(new _.L(_.vg)),this.player.trigger(new _.L(_.ed)))};
|
|
214
|
-
_.Tz.prototype.a=function(){if(this.player){var a=this.player.getPosition();if(0<=a){a:{for(var b=this.S.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.S[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.S[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.S[0].rendition:null}if(a&&this.h!==a&&(this.h=a,this.player)){c=b=-1;if(a)b=a.width||-1,c=a.height||-1;else if(d=this.player.getSurface().getMedia())b=d.videoWidth,c=d.videoHeight;this.player.trigger(new _.L(_.gd,
|
|
215
|
-
{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};_.r=_.gA.prototype;_.r.Uc=function(){return this.I};_.r.getDuration=function(){return this.f};_.r.getPresentationStartTime=function(){return this.A};_.r.offset=function(a){null!=this.o&&(this.o+=a);null!=this.h&&(this.h+=a)};_.r.isLive=function(){return Infinity==this.f&&!this.j};rA.prototype.release=function(){this.f=function(){};this.a.clear()};rA.prototype.cues=function(){return this.a};
|
|
216
|
-
tA.prototype.next=function(){var a=this.h.get(this.a);a&&0<a.a.length?(this.f+=1,a.Ra().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=uA(this);return{value:a,done:!a}};_.r=_.vA.prototype;_.r.destroy=function(){this.a=[];return Promise.resolve()};
|
|
217
|
-
_.r.Nc=function(a){for(var b=this.a.length-1;0<=b;--b){var c=this.a[b];if(a>=c.startTime&&a<c.endTime)return c.position}if(this.a.length&&a<this.a[0].startTime)return this.a[0].position;this.g.warn("No Segment found for "+a+". We have "+this.a.length+" references");for(a=0;a<this.a.length;a++)b=this.a[a],this.g.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+b.position);return null};
|
|
2
|
+
var f=function(window){var gz,hz,iz,jz,kz,lz,mz,nz,oz,pz,sz,tz,uz,wz,xz,yz,zz,Az,Bz,Dz,Ez,Fz,Hz,Iz,Jz,Kz,Lz,Nz,Oz,Pz,Uz,Vz,Wz,Xz,Yz,Zz,bA,cA,eA,fA,gA,iA,jA,lA,mA,nA,oA,pA,qA,rA,tA,yA,CA,HA,KA,JA,MA,NA,OA,PA,QA,UA,WA,VA,XA,YA,aB,bB,cB,dB,fB,jB,hB,lB,mB,nB,oB,qB,pB,rB,tB,uB,vB,xB,wB,zB,sB,AB,yB,BB,HB,EB,CB,FB,GB,IB,JB,MB,LB,NB,OB,PB,DB,QB,KB,SB,TB,UB,VB,WB,XB,YB,ZB,aC,bC,$B,jC,iC,kC,lC,nC,oC,qC,pC,rC,uC,sC,tC,wC,vC,xC,yC,zC,CC,EC,DC,FC,GC,IC,JC,KC,HC,MC,LC,QC,RC,TC,PC,OC,UC,NC,SC,YC,$C,XC,aD,WC,ZC,VC,bD,cD,fD,eD,dD,hD,gD,
|
|
3
|
+
jD,mD,oD,pD,uD,xD,zD,BD,ED,GD,HD,JD,AD,MD,sD,ND,qD,LD,QD,OD,ID,KD,TD,SD,PD,ZD,$D,UD,bE,VD,XD,eE,dE,YD,cE,fE,rD,WD,FD,tD,vD,lD,wD,aE,CD,DD,iE,jE,kE,qE,xE,tE,rE,oE,nE,mE,pE,yE,zE,uE,vE,wE,CE,ME,NE,OE,IE,PE,fC,dC,gC,eC,hC,cC,XE,VE,KE,HE,RE,YE,WE,$E,QE,SE,AE,JE,aF,GE,bF,cF,fF,LE,FE,eF,dF,sE,ZE,UE,hF,DE,TE,gF,iF,BE,jF,kF,lF,mF,nF,oF,pF,qF,rF;gz=" buffer";hz=" is being or has been set up";iz="\x3c/DATA\x3e\x3c/WRMHEADER\x3e";jz="\x3c/LA_URL\x3e";kz="\x3cLA_URL\x3e";lz='\x3cWRMHEADER xmlns\x3d"http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version\x3d"';
|
|
4
|
+
mz="Choosing new streams after key status change";nz="IterateSegmentReference";oz="Jumping forward";pz="MediaSource threw QuotaExceededError:";_.qz="No stream with id";_.rz="Player is in ERROR state and can not switch to ";sz="PrestoPlay TextTrack";tz="Removing audio from variant - audio not compatible with platform";uz="Setting playback rate to\x3d";_.vz="Updating manifest...";wz="bufferBehind\x3d";xz="bufferedBehind\x3d";yz="calling onCanSwitch()...";zz="cannot find segment";Az="clpp.mse.Player";
|
|
5
|
+
Bz="currentPeriod.startTime\x3d";_.Cz="getSegmentNextReference";Dz="key-restriction";Ez="manifest.end";Fz="manifest.start";_.Gz="onChooseStreams_";Hz="presentationTime:";Iz="presentationTime\x3d";Jz="reference.endTime\x3d";Kz="reference.position\x3d";Lz="reference.startTime\x3d";_.Mz="subtitles";Nz="switch: Stream ";Oz=function(a,b){return _.Mg[a]=b};Pz=function(a){for(var b=a.a+a.f.byteOffset,c=void 0;_.qm(a);)if(0===_.sm(a)){c=a.a+a.f.byteOffset-1;break}a=a.f.buffer.slice(b,c);return _.R.Z(a)};
|
|
6
|
+
_.Rz=function(a){var b=new Uint8Array(Qz),c=4+b.byteLength+a.j.byteLength+4+a.f.byteLength,d=new _.mm(c,!1);_.V(d,c);_.om(d,b);_.om(d,a.j);_.V(d,a.f.byteLength);_.om(d,a.f);return _.Xi(d.buffer)};
|
|
7
|
+
_.Sz=function(a,b,c,d){var e=_.jj(b);if(8!==e.byteLength)e="";else{var f=_.zn(e);e=_.gj(f);b:switch(f=f.byteLength,_.uh("Trying to create PlayReady header in version",a),a){case "4.0.0.0":e=[lz+a+'"\x3e',"\x3cDATA\x3e\x3cPROTECTINFO\x3e","\x3cKEYLEN\x3e"+f+"\x3c/KEYLEN\x3e","\x3cALGID\x3eAESCTR\x3c/ALGID\x3e\x3c/PROTECTINFO\x3e","\x3cKID\x3e"+e+"\x3c/KID\x3e",c?"\x3cCHECKSUM\x3e"+c+"\x3c/CHECKSUM\x3e":"",d?kz+d+jz:"",iz].join("");break b;case "4.1.0.0":e=[lz+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKID ALGID\x3d"AESCTR" ',
|
|
8
|
+
c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/PROTECTINFO\x3e",d?kz+d+jz:"",iz].join("");break b;case "4.2.0.0":case "4.3.0.0":e=[lz+a+'"\x3e','\x3cDATA\x3e\x3cPROTECTINFO\x3e\x3cKIDS\x3e\x3cKID ALGID\x3d"AESCTR" ',c?'CHECKSUM\x3d"'+c+'" ':"",'VALUE\x3d"'+e+'"',"\x3e\x3c/KID\x3e\x3c/KIDS\x3e\x3c/PROTECTINFO\x3e",d?kz+d+jz:"",iz].join("");break b;default:_.J("Cannot create PlayReady header in version",a),e=""}}if(!e)return null;_.uh("New payload",e);e=_.Xi(_.R.Be(e,!0));return new _.wn(_.An,
|
|
9
|
+
b,d||null,e,a,c)};_.Tz=function(a,b){return b===a.version?a:_.Sz(b,a.a,a.l||void 0,a.h||void 0)};Uz=function(a,b){a:{if(b){var c=_.u(a.f.keys());for(var d=c.next();!d.done;d=c.next()){d=a.f.get(d.value);for(var e=0;e<d.ab.length;e++)if(d.ab[e]===b){c=d;break a}}}c=null}return c?c.Ja:null};Vz=function(a,b){if(_.Jk("Edge/"))return!0;b=b.toLowerCase();if(_.Gj()&&b.includes('codecs\x3d"ac-3"')){var c=b.replace("ac-3",_.le);return a.J.has(b)||a.J.has(c)}return a.J.has(b)};
|
|
10
|
+
Wz=function(a,b){var c=a.l.get(b);return!(!c||c!==_.df&&c!==_.xe)};Xz=function(a,b){var c=b.audio,d=b.video;if(c&&c.encrypted&&(c=_.oo(c),!Vz(a,c))||d&&d.encrypted&&(d=_.oo(d),!Vz(a,d)))return!1;var e=a.keySystem();return 0==b.drmInfos.length||b.drmInfos.some(function(f){return f.keySystem==e})};Yz=function(a,b){a.a=b.enabled};Zz=function(){};
|
|
11
|
+
_.$z=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:b||[],keyIds:[],periodId:c?c:null}};_.aA=function(a,b,c,d,e){this.Ra=a;this.wa=b;this.ia=c;this.keyInfo=d||null;this.Mc=_.O.R(e)?!1:!!e};bA=function(a,b){a=_.Qi(a);b=_.Qi(b);var c=a.split("-"),d=b.split("-");return c[0]==d[0]&&1==c.length&&2==d.length};
|
|
12
|
+
cA=function(a){return a.language?_.Qi(a.language):a.audio&&a.audio.language?_.Qi(a.audio.language):a.video&&a.video.language?_.Qi(a.video.language):_.ig};
|
|
13
|
+
_.dA=function(a,b){for(var c=_.Qi(a),d=new Set,e=_.u(b),f=e.next();!f.done;f=e.next())d.add(_.Qi(f.value));e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,f==c)return f;e=_.u(d);for(f=e.next();!f.done;f=e.next())if(f=f.value,bA(f,c))return f;e=_.u(d);for(f=e.next();!f.done;f=e.next()){var g=f=f.value,h=c;g=_.Qi(g);h=_.Qi(h);g=g.split("-");h=h.split("-");if(2==g.length&&2==h.length&&g[0]==h[0])return f}d=_.u(d);for(f=d.next();!f.done;f=d.next())if(e=f.value,bA(c,e))return e;return null};
|
|
14
|
+
eA=function(a,b){for(var c=0,d=_.u(a),e=d.next();!e.done;e=d.next())c+=b(e.value)?1:0;return c};fA=function(a,b){var c=_.Bk(b,a);if(!c)return!1;c=c();var d=c.isMuxed(a,b);c.destroy();return d};gA=function(a){var b=[a.mimeType];_.zu.forEach(function(c,d){var e=a[d];e&&b.push(c+'\x3d"'+e+'"')});return b.join(";")};_.hA=function(a){a=a.split(".");var b=a[0];a.pop();return[b,a.join(".")]};
|
|
15
|
+
iA=function(a,b){for(var c=new _.El(void 0,void 0===b?"total":b),d=_.u(a),e=d.next();!e.done;e=d.next())c.a.push(e.value);c.length=a.length;return c};jA=function(a,b){return a.start-b.start};_.kA=function(a){this.j=a;this.log=new _.K("clpp.renditions");this.S=[];this.h=this.player=null;this.f=!1};lA=function(a){return a.S.map(function(b){return{start:b.start,end:b.end,width:b.width,height:b.height,bandwidth:b.bandwidth,rendition:b.rendition}})};mA=function(a){a.player&&a.player.trigger(new _.L(_.fd))};
|
|
16
|
+
nA=function(a){if(a.player){for(var b=!1,c={},d=0;d<a.S.length;d++){var e=a.S[d],f=e.width+"x"+e.height,g=c[f];if(g&&g!==e.bandwidth){b=!0;break}c[f]=e.bandwidth}b&&!a.f?(a.log.debug("Tracking timeupdates"),a.player.on(_.fg,a.a,a),a.f=!0):!b&&a.f&&(a.log.debug("Stop tracking timeupdates"),a.player.off(_.fg,a.a),a.f=!1)}};oA=function(a,b,c){a.S=a.S.filter(function(d){if(d.end<=b||d.start>=c)return!1;d.start=Math.max(d.start,b);d.end=Math.min(d.end,c);return!0});a.player&&a.player.trigger(new _.L(_.wg))};
|
|
17
|
+
pA=function(a,b){for(var c=null,d=_.u(a),e=d.next();!e.done;e=d.next())e=e.value,b>=e.startTime&&(c=e);return c};qA=function(a){var b=new Set;a.variants.forEach(function(c){c.audio&&b.add(c.audio);c.video&&(b.add(c.video),c.video.trickModeVideo&&b.add(c.video.trickModeVideo))});a.textStreams.forEach(function(c){return b.add(c)});a.thumbStreams.forEach(function(c){return b.add(c)});return b};rA=function(a,b){for(var c=0;c<a.length;c++)if(qA(a[c]).has(b))return c;return-1};
|
|
18
|
+
tA=function(a,b){Array.from(qA(a)).forEach(function(c){c.segmentIndex&&_.sA(c.segmentIndex,b)})};_.uA=function(a){this.h=Math.exp(Math.log(.5)/a);this.f=this.a=0};_.vA=function(a,b,c){var d=Math.pow(a.h,b);c=c*(1-d)+d*a.a;isNaN(c)||(a.a=c,a.f+=b)};_.wA=function(a){return a.a/(1-Math.pow(a.h,a.f))};
|
|
19
|
+
_.xA=function(a,b,c,d,e,f,g,h){a=_.uj(a);a.timeout=d.timeout;a.maxAttempts=d.maxAttempts;a.baseDelay=d.baseDelay;a.fuzzFactor=d.fuzzFactor;a.backoffFactor=d.backoffFactor;if(0!==b||null!=c)a.headers.Range=c?"bytes\x3d"+b+"-"+c:"bytes\x3d"+b+"-";e&&(a.startTime=e);f&&(a.endTime=f);g&&(a.contentType=g);h&&(a.timescale=h);return a};yA=function(a){this.f=this.a=0;this.h=a};_.zA=function(a,b,c){a.a=b;a.f=c};
|
|
20
|
+
_.AA=function(a,b,c,d,e,f){f=void 0===f?!1:f;this.j=a;this.D=b;this.I=c;this.w=this.h=Infinity;this.f=1;this.G=0;this.l=this.o=null;this.H=0;this.B=this.A=d;this.K=void 0===e?!0:e;this.g=new _.K("clpp.media.PresentationTimeline");this.L=f;this.J=null;this.a=new yA(d)};_.BA=function(a,b){a.A=b;a.B=b;a.a.h=b};CA=function(a){return 2===a.j.version?a.a.h?a.a.f:null:a.A?a.h:a.B?a.l:null};
|
|
21
|
+
_.FA=function(a,b,c){if(0!=b.length){var d=b[b.length-1].endTime+c;_.DA(a,b[0].startTime+c);a.f=b.reduce(function(e,f){return Math.max(e,f.endTime-f.startTime)},a.f);_.EA(a,d);null!=a.D&&a.K&&(a.D=(Date.now()+a.H)/1E3-(a.l||0)-a.f);a.g.debug("notifySegments: maxSegmentDuration\x3d"+a.f)}};_.DA=function(a,b){a.o=null==a.o?b:Math.min(a.o,b)};_.EA=function(a,b){a.l=Math.max(a.l||0,b)};_.GA=function(a,b){a.f=Math.max(a.f,b);a.g.debug("notifyNewSegmentDuration: maxSegmentDuration\x3d"+a.f)};
|
|
22
|
+
_.IA=function(a){return 2===a.j.version?a.a.a:Infinity==a.w?0:Math.max(0,HA(a)-a.w)};HA=function(a){if(2===a.j.version)a=a.a.f;else if(a.A)a=a.h;else if(a.B)a=a.l||0;else{var b=(Date.now()+a.H)/1E3;a=Math.min(a.L?Math.max(0,b-(a.f-a.G)-a.D):Math.max(0,b-a.f-a.D),a.h)}return a};KA=function(a,b){if(2===a.j.version)return a.a.a;var c=Math.max(a.o,0);return Infinity==a.w?Math.ceil(1E3*c)/1E3:Math.max(c,Math.min(HA(a)-a.w+b,JA(a)))};_.LA=function(a){return 2===a.j.version?a.a.a:KA(a,0)};
|
|
23
|
+
JA=function(a){var b=a.A||a.B?0:a.I;return 2===a.j.version?a.a.f-b:Math.max(0,HA(a)-b)};MA=function(a){return{schemeIdUri:a.schemeIdUri,value:a.value,startTime:a.startTime,endTime:a.endTime,id:a.id,eventElement:a.eventElement,type:a.type,Xa:a.Xa}};NA=function(){this.f=function(){};this.a=new Set};OA=function(a,b){a.f=b};PA=function(a,b,c){this.h=a;this.a=b;this.f=c;this.g=new _.K("clpp.media.SegmentIterator")};
|
|
24
|
+
QA=function(a){var b=a.h.get(a.a);if(!b)return null;0<b.a.length&&b.Ra().length&&a.f>=b.a.length&&(a.a+=1,a.f=0,b=a.h.get(a.a));return b&&0<b.a.length?b.a[a.f]||null:b};_.RA=function(a){this.a=a;this.g=new _.K("clpp.media.SegmentIndex")};_.SA=function(a){return a.a.length?a.a[a.a.length-1].endTime:0};_.TA=function(a,b){for(var c=0;c<a.a.length;++c)if(a.a[c].endTime>b)return a.a.splice(0,c);c=a.a;a.a=[];return c};
|
|
25
|
+
UA=function(a,b){var c=a.Kc(b);c=null===c?-1:c-1;var d=a.get(c+1),e=-1;if(d&&0<d.a.length)for(var f=d.a.length-1;0<=f;--f){var g=d.a[f];if(b>=g.startTime&&b<g.endTime){for(;f&&!g.h;)--f,g=d.a[f];if(!g.h)break;c+=1;e=f-1;break}}return new PA(a,c,e)};_.sA=function(a,b){for(;a.a.length;)if(0>=a.a[0].endTime)a.a.shift();else break;0==a.a.length||a.a[a.a.length-1].startTime>=b||(a.a[a.a.length-1].endTime=b)};WA=function(a){var b=this;this.f=a;this.a=new Set;this.h=(new _.Gk(function(){VA(b,!1)})).kb(.25)};
|
|
26
|
+
VA=function(a,b){for(var c=_.u(a.a),d=c.next();!d.done;d=c.next())d.value.o(a.f.currentTime,b)};
|
|
27
|
+
XA=function(a){var b=this;this.l=a;this.j=new Map;this.a=function(){};this.f=function(){};this.h=function(){};this.w=[{zc:null,yc:2,mc:function(c,d){return b.a(c,d)}},{zc:1,yc:2,mc:function(c,d){return b.a(c,d)}},{zc:3,yc:2,mc:function(c,d){return b.a(c,d)}},{zc:2,yc:1,mc:function(c,d){return b.f(c,d)}},{zc:2,yc:3,mc:function(c,d){return b.f(c,d)}},{zc:1,yc:3,mc:function(c,d){return b.h(c,d)}},{zc:3,yc:1,mc:function(c,d){return b.h(c,d)}}]};YA=function(a,b,c,d){a.a=b;a.f=c;a.h=d};
|
|
28
|
+
_.ZA=function(a){_.dt[a]&&delete _.dt[a]};_.$A=function(a){_.bt[a]&&delete _.bt[a]};aB=function(a,b){this.w=null;this.D=a;this.h=b;this.j=this.A=0;this.l=Infinity;this.f=this.a=null;this.B="";this.o=new Map};
|
|
29
|
+
bB=function(a,b,c,d){return Promise.resolve().then(function(){if(a.w&&a.h)if(null==c||null==d)a.w.parseInit(_.Xi(b));else{var e={periodStart:a.A,segmentStart:c,segmentEnd:d};e=a.w.parseMedia(_.Xi(b),e);var f=e.cues.filter(function(g){return g.startTime>=a.j&&g.startTime<a.l});a.h.append(f,e.styles);null==a.a&&(a.a=Math.max(c,a.j));a.f=Math.min(d,a.l)}})};
|
|
30
|
+
cB=function(a,b,c){a.B=b;if(b=a.o.get(b))for(var d=_.u(b.keys()),e=d.next();!e.done;e=d.next())if(e=b.get(e.value))e=e.filter(function(f){return f.endTime<=c}),a.h.append(e,[])};
|
|
31
|
+
dB=function(a,b,c,d,e){var f=c+" "+d,g=new Map;b=_.u(b);for(var h=b.next();!h.done;h=b.next()){var l=h.value;h=l.stream;g.has(h)||g.set(h,new Map);g.get(h).has(f)||g.get(h).set(f,[]);l.startTime+=e;l.endTime+=e;l.startTime>=a.j&&l.startTime<a.l&&(l=new _.di(l.startTime,l.endTime,l.text),g.get(h).get(f).push(l),h==a.B&&a.h.append([l],[]))}e=_.u(g.keys());for(f=e.next();!f.done;f=e.next())for(f=f.value,a.o.has(f)||a.o.set(f,new Map),b=_.u(g.get(f).keys()),h=b.next();!h.done;h=b.next())h=h.value,l=g.get(f).get(h),
|
|
32
|
+
a.o.get(f).set(h,l);a.a=null==a.a?Math.max(c,a.j):Math.min(a.a,Math.max(c,a.j));a.f=Math.max(a.f,Math.min(d,a.l))};_.eB=function(a){a=a.toLowerCase();return _.St[a]||window.muxjs&&a==_.Sc?!0:!1};fB=function(){this.a=new muxjs.mp4.CaptionParser;this.l=[];this.j={}};_.gB=function(){};
|
|
33
|
+
_.iB=function(a,b,c,d,e){this.j=a;this.B=c;this.f={};this.L=!1;this.a=null;this.h={};this.l=new _.Eh;this.J=!1;this.A={};this.H=b;this.D=d;this.K=e;this.U=this.K.streaming.maxSegmentToMediaOffset||1;this.I=new _.zj;this.w="";this.G={};this.o=hB(this,this.I);this.P=!0;this.g=new _.K("clpp.mse.MediaSourceEngine")};jB=function(a){var b=_.Ck(a.mimeType,a.codecs),c=gA(a);return _.eB(b)||_.Xq(c)||(_.Bk(b,a.type)?!0:!1)};
|
|
34
|
+
hB=function(a,b){if(window.ManagedMediaSource){a.j.disableRemotePlayback=!0;var c=new ManagedMediaSource;a.l.one(c,"sourceopen",function(){URL.revokeObjectURL(a.w);b.resolve()});a.l.on(c,"startstreaming",function(){a.P=!0});a.l.on(c,"endstreaming",function(){a.P=!1});a.w=kB(c);a.j.src=a.w;return c}c=new MediaSource;a.w=kB(c);a.l.one(c,"sourceopen",function(){URL.revokeObjectURL(a.w);b.resolve()});a.j.src=a.w;return c};
|
|
35
|
+
lB=function(a,b){b.forEach(function(c,d){var e=a.o.addSourceBuffer(c);a.l.on(e,_.pe,a.T.bind(a,d));a.l.on(e,"updateend",a.Yc.bind(a,d));a.f[d]=e;a.h[d]=[];a.G[d]=!1});a.L=b.has(_.$c)&&b.has(_.tg)};mB=function(a){return a.K.streaming.ignoreManagedMediaSourceStreamingHints?!0:a.P};nB=function(a,b){a.a||(a.a=new aB(a.K,a.B));var c=a.a;if(b!=_.Sc){var d=_.St[b];if(!d)throw new _.P(_.Q,2,2012,"Text parser is unavailable for "+b);c.w=new d(c.D)}};oB=function(a){return a.o?a.o.readyState==_.oe:!0};
|
|
36
|
+
qB=function(a){var b={};b.total=new _.El(a.j.buffered,"total");b.audio=pB(a,_.$c);b.video=pB(a,_.tg);var c=[];a.a&&(c=[{start:a.a.xb(),end:a.a.Fa()}]);b.text=iA(c,_.Di);return b};pB=function(a,b){try{return new _.El(a.f[b].buffered,b)}catch(c){return b in a.f&&a.g.error("failed to get buffered range for "+b,c),null}};rB=function(a,b){if(!a.f[b])return"";var c=pB(a,b);return c?c.toString():""};
|
|
37
|
+
tB=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l=a.f[b],m=-1,n=0;l&&l.buffered&&(n=l.buffered.length);b===_.tg&&null!==d&&null!==e&&h&&(m=0<n?l.buffered.end(n-1):-1);b==_.Di?c=bB(a.a,c,d,e):a.A[b]?c=a.A[b].transmux(c).then(function(p){p.captions&&0<p.captions.length&&(a.a||nB(a,_.dg),dB(a.a,p.captions,d,e,a.f.video.timestampOffset));var q=[];0<p.audio.byteLength&&a.f.audio&&q.push(sB(a,_.$c,a.Ye.bind(a,_.$c,p.audio.buffer)));0<p.video.byteLength&&a.f.video&&q.push(sB(a,_.tg,a.Ye.bind(a,_.tg,p.video.buffer)));
|
|
38
|
+
return Promise.all(q)}):(f&&window.muxjs&&(a.a||nB(a,_.dg),null==d&&null==e?a.H.init(c):a.H.h(c,function(p){p.length&&dB(a.a,p,d,e,a.f.video.timestampOffset)})),c=sB(a,b,a.Ye.bind(a,b,c)));return c.then(function(){if(b===_.tg&&null!==d&&null!==e&&!h)a.D.append(d,e,g),null!==d&&null!==e&&a.g.debug("Appended video segment ",d,e,"Buffer:",rB(a,b));else if(b===_.$c&&null!==d&&null!==e)mA(a.D),null!==d&&null!==e&&a.g.debug("Appended audio segment ",d,e,"Buffer:",rB(a,b));else if(b===_.tg&&null!==d&&null!==
|
|
39
|
+
e&&h){var p=l.buffered.length,q=0<p?l.buffered.end(p-1):-1;0>m&&0<p&&(m=l.buffered.start(0));0<=m&&0<q&&a.D.append(m,q,g)}if(!a.G[b]&&l&&1===l.buffered.length){p=l.buffered.start(0);var t=d-p;if(Math.abs(t)>a.U&&0===l.timestampOffset)return a.g.warn("Detected a delta of "+t+" between media times and segment times for "+(b+". The segment start time is ")+(d+" and the media start time is ")+(p+". Adjusting timestampOffset.")),p=sB(a,b,function(){a.Oh(b,t)}),q=sB(a,b,a.Ig.bind(a,b,!1)),Promise.all([p,
|
|
40
|
+
q])}null!==d&&null!==e&&(a.G[b]=!0)})["catch"](function(p){throw p;})};uB=function(a,b){var c=a.Fa(_.tg)||0;cB(a.a,b,c)};vB=function(a){a.a&&cB(a.a,"",0)};xB=function(a,b,c,d,e){if(b==_.Di)return a.a.A=c,a=a.a,a.j=d,a.l=e,Promise.resolve();b=wB(a,b,c,d,e);a.L&&(b=b.concat(wB(a,_.$c,c,d,e)));return Promise.all(b)};wB=function(a,b,c,d,e){return[sB(a,b,a.fi.bind(a,b)),sB(a,b,a.Oh.bind(a,b,c)),sB(a,b,a.hm.bind(a,b,d,e))]};zB=function(a,b){yB(a,function(){a.o.duration=b})};
|
|
41
|
+
sB=function(a,b,c){if(a.J)return Promise.reject();c={start:c,p:new _.zj};a.h[b].push(c);1===a.h[b].length&&AB(a,b);return c.p};AB=function(a,b){var c=a.h[b][0];if(c)try{a.g.debug("Starting next operation for "+b),c.start()}catch(d){"QuotaExceededError"==d.name?c.p.reject(new _.P(_.Q,3,3017,{type:b})):c.p.reject(new _.P(_.Q,3,3015,{mediaError:d})),BB(a,b)}else a.g.debug("No more scheduled operations for "+b)};
|
|
42
|
+
yB=function(a,b){if(a.J)return Promise.reject();var c=[],d;for(d in a.f){var e=new _.zj,f={start:function(g){g.resolve()}.bind(null,e),p:e};a.h[d].push(f);c.push(e);1==a.h[d].length&&f.start()}return Promise.all(c).then(function(){for(var g in a.f);try{b()}catch(m){var h=Promise.reject(new _.P(_.Q,3,3015,{mediaError:m}))}for(var l in a.f)BB(a,l);return h},function(){for(var g in a.f)a.h[g].length&&a.h[g].shift();return Promise.reject()})};BB=function(a,b){a.h[b].shift();AB(a,b)};
|
|
43
|
+
HB=function(a,b,c,d){var e=a.periods.flatMap(function(n){return n.variants});if(b.length||c.length)e=CB(e,b,c);e=DB(e,d);if(1<a.periods.length){var f=function(n){n=n.split(".");var p=n[0];1<n.length&&(p+="."+n[1]);return p.toLowerCase()};b=[];c=_.u(a.periods);for(var g=c.next();!g.done;g=c.next()){d=new Set;g=_.u(g.value.variants);for(var h=g.next();!h.done;h=g.next())h=h.value,null!==h.audio&&d.add(f(h.audio.codecs));b.push(d)}var l=b[0];c={};for(d=1;d<b.length;c={He:c.He},d++)c.He=b[d],l=new Set(_.Pg(l).concat().filter(function(n){return function(p){return n.He.has(p)}}(c)));
|
|
44
|
+
e=e.filter(function(n){return 0===l.size&&null===n.audio?!0:0<l.size&&null===n.audio?!1:l.has(f(n.audio.codecs))})}e=EB(e);var m=FB(e);a=_.u(a.periods);for(e=a.next();!e.done;e=a.next())e=e.value,e.variants=e.variants.filter(function(n){if(GB(n)===m)return!0;_.uh("Dropping Variant (better codec available)",n);return!1})};EB=function(a){var b=new _.Ah;a=_.u(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=GB(c);b.push(d,c)}return b};
|
|
45
|
+
CB=function(a,b,c){var d={};b=_.u(b);for(var e=b.next();!e.done;d={Me:d.Me},e=b.next())if(d.Me=e.value,e=a.filter(function(f){return function(g){return g.video&&g.video.codecs.startsWith(f.Me)}}(d)),e.length){a=e;break}d={};c=_.u(c);for(b=c.next();!b.done;d={Fe:d.Fe},b=c.next())if(d.Fe=b.value,b=a.filter(function(f){return function(g){return g.audio&&g.audio.codecs.startsWith(f.Fe)}}(d)),b.length){a=b;break}return a};
|
|
46
|
+
FB=function(a){var b="",c=Infinity;a.forEach(function(d,e){var f=e.reduce(function(g,h){return g+h.bandwidth||0},0)/e.length;_.uh(_.Kd,d,"avg bandwidth",f);f<c&&(b=d,c=f)});return b};GB=function(a){var b="";a.video&&(b=_.hA(a.video.codecs)[0]);var c="";a.audio&&(c=_.hA(a.audio.codecs)[0]);return b+"-"+c};
|
|
47
|
+
IB=function(a,b,c){function d(f,g,h){return f>=g&&f<=h}var e=a.video;return e&&e.width&&e.height&&!(d(e.width,b.minWidth,Math.min(b.maxWidth,c.width))&&d(e.height,b.minHeight,Math.min(b.maxHeight,c.height))&&d(e.width*e.height,b.minPixels,b.maxPixels))||!d(a.bandwidth,b.minBandwidth,b.maxBandwidth)?!1:!0};JB=function(a,b,c){var d=!1;a=_.u(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var f=e.allowedByApplication;e.allowedByApplication=IB(e,b,c);f!=e.allowedByApplication&&(d=!0)}return d};
|
|
48
|
+
MB=function(a,b,c,d){var e=!1;d.variants=d.variants.filter(function(m){if(a&&a.da&&!Xz(a,m))return _.uh("Dropping variant - not compatible with key system",m),!1;var n=m.audio,p=m.video;if(n&&!jB(n)){var q=n.codecs;0<=n.codecs.indexOf(_.le)?(_.uh("Trying to use AC-3 for EC-3"),n.codecs=n.codecs.replace(_.le,"ac-3"),jB(n)?_.th("Using AC-3 instead of EC-3 for",KB(n)):(n.codecs=q,_.th(tz,KB(n)),m.audio=null,e=!0,n=null)):(_.th(tz,KB(n)),m.audio=null,e=!0,n=null)}return p&&!jB(p)?(_.th("Dropping variant - video not compatible with platform",
|
|
49
|
+
KB(p)),!1):n&&b&&!LB(n,b)?(_.th("Dropping variant - not compatible with active audio","active audio",KB(b),"variant.audio",KB(n)),!1):p&&c&&!LB(p,c)?(_.th("Dropping variant - not compatible with active video","active video",KB(c),"variant.video",KB(p)),!1):!0});if(e){for(var f=!1,g=!1,h=_.u(d.variants),l=h.next();!l.done;l=h.next())l=l.value,!f&&l.video&&l.audio&&(f=!0),g||l.audio||!l.video||(g=!0);f&&g&&(d.variants=d.variants.filter(function(m){return m.video&&!m.audio?(_.th("Dropping variant - not compatible with video + audio",
|
|
50
|
+
"variant.video",KB(m.video)),!1):!0}))}d.textStreams=d.textStreams.filter(function(m){var n=_.eB(_.Ck(m.mimeType,m.codecs));n||_.uh("Dropping text stream. Is not supported by the platform.",m);return n})};LB=function(a,b){return a.mimeType!=b.mimeType||a.codecs.split(".")[0]!=b.codecs.split(".")[0]?!1:!0};
|
|
51
|
+
NB=function(a){var b=a.audio,c=a.video,d=b?b.codecs:null,e=c?c.codecs:null,f=[];e&&f.push(e);d&&f.push(d);var g=c&&c.mimeType||null,h=b&&b.mimeType||null,l=[];b&&l.push(b.kind);c&&l.push(c.kind);l=l[0]||null;var m=new Set,n=new Set;if(b)for(var p=_.u(b.roles),q=p.next();!q.done;q=p.next())n.add(q.value);if(c)for(p=_.u(c.roles),q=p.next();!q.done;q=p.next())m.add(q.value);q=[c,b].map(function(t){return t?t.accessibility||[]:[]}).reduce(function(t,v){return t.concat(v)},[]);a={id:a.id,active:!1,type:"variant",
|
|
52
|
+
bandwidth:a.bandwidth,language:a.language,originalLanguage:a.language,label:null,kind:l,width:null,height:null,frameRate:null,trickPlay:!1,mimeType:g,audioMimeType:h,codecs:f.join(", "),audioCodec:d,videoCodec:e,primary:a.primary,roles:Array.from(m),audioRoles:Array.from(n),videoId:null,audioId:null,channelsCount:null,spatialAudio:!1,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,accessibility:q,keyId:c?c.keyId:b?b.keyId:null};c&&(a.videoId=c.id,
|
|
53
|
+
a.originalVideoId=c.originalId,a.width=c.width||null,a.height=c.height||null,a.frameRate=c.frameRate||null,a.trickPlay=!!c.trickPlay,a.videoBandwidth=c.bandwidth||null);b&&(a.audioId=b.id,a.originalAudioId=b.originalId,a.originalLanguage=b.originalLanguage,a.channelsCount=b.channelsCount,a.audioBandwidth=b.bandwidth||null,a.label=b.label,a.audioRoles=b.roles);return a};
|
|
54
|
+
OB=function(a){return{id:a.id,active:!1,type:_.Di,bandwidth:0,language:a.language,originalLanguage:a.originalLanguage,label:a.label,kind:a.kind||null,width:null,height:null,frameRate:null,trickPlay:!1,mimeType:a.mimeType,audioMimeType:null,codecs:a.codecs||null,audioCodec:null,videoCodec:null,primary:a.primary,roles:a.roles,audioRoles:null,videoId:null,audioId:null,channelsCount:null,spatialAudio:!1,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:a.originalId,
|
|
55
|
+
accessibility:a.accessibility,keyId:null}};PB=function(a){return a.allowedByApplication&&a.allowedByKeySystem};DB=function(a,b){var c=a.filter(function(g){return g.audio&&g.audio.channelsCount}),d=new Map;c=_.u(c);for(var e=c.next();!e.done;e=c.next()){e=e.value;var f=e.audio.channelsCount;d.has(f)||d.set(f,[]);d.get(f).push(e)}c=Array.from(d.keys());if(0===c.length)return a;e=c.filter(function(g){return g<=b});return e.length?d.get(Math.max.apply(null,e)):d.get(Math.min.apply(null,c))};
|
|
56
|
+
_.RB=function(a,b,c,d){b=_.Th(b);var e=a,f=a.filter(function(h){return h.primary});f.length&&(e=f);var g=e.length?e[0].language:"";e=e.filter(function(h){return h.language===g});b.some(function(h){var l=_.dA(_.Qi(h),a.map(function(m){return m.language}));return l?(e=a.filter(function(m){return _.Qi(m.language)===l}),!0):!1});e=e.filter(function(h){return d?h.kind===_.qe:h.kind!==_.qe});if(c){b=QB(e,c);if(b.length)return b;_.J("No exact match for the text role could be found.")}else if(b=e.filter(function(h){return 0===
|
|
57
|
+
h.roles.length}),b.length)return b;b=e.map(function(h){return h.roles}).reduce(_.mi,[]);return b.length?QB(e,b[0]):e};QB=function(a,b){return a.filter(function(c){return c.roles.includes(b)})};
|
|
58
|
+
KB=function(a){var b=gA(a);return a.type===_.$c?"type\x3daudio mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" channelsCount\x3d"+a.channelsCount:a.type===_.tg?"type\x3dvideo mimeType\x3d"+a.mimeType+" codecs\x3d"+a.codecs+" codecInfo\x3d"+b+" bandwidth\x3d"+a.bandwidth+" frameRate\x3d"+a.frameRate+" width\x3d"+a.width+" height\x3d"+a.height:"unexpected stream type"};
|
|
59
|
+
SB=function(a,b){var c=String(_.Xj++);c=new _.Rj(c,a);c.mimeType=_.Sj(b.mimeType);if(a===_.T||a===_.Tj)c.label=_.Sj(b.label),c.language=_.Sj(b.language),c.originalLanguage=_.Sj(b.originalLanguage);a===_.Uj?(c.frameRate=b.frameRate,c.roles=b.roles,c.trickPlay=b.trickPlay):a===_.Tj?(c.channelsCount=b.channelsCount,c.roles=b.audioRoles||[],c.mimeType=_.Sj(b.audioMimeType)):(c.kind=_.Sj(b.kind),c.roles=b.roles);c.accessibility=a===_.Uj||a===_.Tj?(b.accessibility||[]).filter(function(d){return d.type===
|
|
60
|
+
a}):b.accessibility||[];return c};
|
|
61
|
+
TB=function(a,b,c){var d=new _.ak(a===_.Uj?""+b.videoId:a===_.Tj?""+b.audioId:""+b.id,c);switch(a){case _.Uj:d.codec=_.Sj(b.videoCodec);d.bandwidth=b.videoBandwidth||b.bandwidth;d.width=b.width;d.height=b.height;d.originalId=b.originalVideoId;d.drm={keyId:b.keyId||void 0};break;case _.Tj:d.codec=_.Sj(b.audioCodec);d.bandwidth=b.audioBandwidth||b.bandwidth;d.originalId=b.originalAudioId;d.drm={keyId:b.keyId||void 0};break;default:d.codec=_.Sj(b.codecs),d.originalId=b.originalTextId}(a=c.renditions.find(function(e){return _.O.ta(e,
|
|
62
|
+
d,null,["id","track"])}))||c.renditions.push(d);return a||d};UB=function(a,b){var c=a.reduce(function(d,e){b===_.Uj?null===e.videoId||d[e.videoId]&&!e.active||(d[e.videoId]=e):b===_.Tj&&(null===e.audioId||d[e.audioId]&&!e.active||(d[e.audioId]=e));return d},{});return Object.values(c)};VB=function(a,b){if(void 0!==b&&null!==b){var c=a.filter(function(d){return d.audio&&d.audio.id===b});if(0<c.length)return c}return a};
|
|
63
|
+
WB=function(a,b,c){function d(f,g){return null==f?null==g:g.id==f}for(var e=0;e<c.length;e++)if(d(a,c[e].audio)&&d(b,c[e].video))return c[e];return null};XB=function(){this.g=new _.K("cl.api.mse.TrackManager");this.m=null;this.h=[];this.a=new Map;this.f=new Map};YB=function(a,b){return a.h.filter(function(c){return c.type===b})};ZB=function(a,b){var c=a.a.get(b)||null;return c&&c.track};
|
|
64
|
+
aC=function(a,b,c){if(!c||ZB(a,c.type)!==c||a.m.ma())switch(b){case _.Uj:a.Za(c&&c.renditions[0]);break;case _.Tj:a.hb(c&&c.renditions[0]);break;case _.T:a.ib(c&&c.renditions[0]);break;default:$B(a,b,c&&c.renditions[0])}};bC=function(a,b){a.a.set(b.track.type,b);b===(a.f.get(b.track.type)||null)&&a.f.set(b.track.type,null)};
|
|
65
|
+
$B=function(a,b,c,d){d=void 0===d?!1:d;if(a.m&&((a.a.get(b)||null)!==c||a.m.ma())){var e=a.m;if(c){if(0>a.h.indexOf(c.track))throw Error("Unknown rendition with ID "+c.id);if(b!==c.track.type)throw Error("Types mismatch");a.g.debug("Activate rendition type\n "+b+" with ID: "+c.id);if(b===_.T){var f=e.ea().find(function(n){return n.id==c.id});f&&(a.f.set(b,c),bC(a,c),e.trigger(new _.L(_.zl)),cC(e,!0).then(function(){dC(e,f)})["catch"](function(n){a.g.warn("Error while activating track",n)}))}else if(b===
|
|
66
|
+
_.Tj)a.f.set(b,c),eC(e,parseInt(c.id,10));else if(b===_.Uj){var g=a.a.get(_.Tj)||null,h=null;if(g){var l=fC(e).filter(function(n){return n.videoId==c.id});h=l.find(function(n){return n.audioId==g.id})||null;if(!h){a.g.debug("Unable to find exact variant. Searching for equivalent");var m=g.track.renditions.map(function(n){return n.id}).filter(function(n){return n!==g.id});h=l.find(function(n){return m.find(function(p){return p==n.audioId})})||null}}else h=fC(e).find(function(n){return n.videoId==c.id})||
|
|
67
|
+
null;h?(a.f.set(b,c),gC(e,h,d)):a.g.warn("Cannot find matching variant")}}else a.g.debug(_.Ha+b),(h=ZB(a,b))&&(b===_.T?cC(e,!1).then(function(){a.a.set(b,null);e.trigger(new _.L(_.zl))})["catch"](function(n){a.g.warn("Error while de-activating text tracks",n)}):b===_.Tj?a.g.info("Enabling ABR for audio is not supported"):b===_.Uj&&h.trickPlay?a.g.info("Enabling ABR for trick play tracks is not supported"):gC(e,null,d))}};
|
|
68
|
+
jC=function(a){if(a.m){a.g.debug("Track list change detected, updating track list");for(var b=[],c=_.u(Object.values(_.yu)),d=c.next();!d.done;d=c.next())d=d.value,a.a.set(d,null),a.f.set(d,null);c={};d=_.u(a.m.ea());for(var e=d.next();!e.done;c={ec:c.ec},e=d.next()){e=e.value;c.ec=SB(_.T,e);var f=b.find(function(h){return function(l){return h.ec.ta(l)}}(c));c.ec=f||c.ec;var g=TB(_.T,e,c.ec);e.active&&a.a.set(_.T,g);f||b.push(c.ec)}hC(a.m)||a.a.set(_.T,null);c=fC(a.m);iC(a,b,c,_.Uj);iC(a,b,c,_.Tj);
|
|
69
|
+
a.h=b}};iC=function(a,b,c,d){var e=UB(c,d);c={};e=_.u(e);for(var f=e.next();!f.done;c={fc:c.fc},f=e.next()){f=f.value;c.fc=SB(d,f);var g=b.find(function(l){return function(m){return l.fc.ta(m)}}(c));c.fc=g||c.fc;var h=TB(d,f,c.fc);f.active&&a.a.set(d,h);g||b.push(c.fc)}};
|
|
70
|
+
kC=function(a,b,c){if(b){a.h.length||jC(a);for(var d=b.type,e=a.a.get(d)||null,f,g=_.u(YB(a,d)),h=g.next();!h.done&&!(f=h.value.renditions.find(function(l){return l.id==b.id}));h=g.next());f&&e!==f&&(bC(a,f),d===_.Tj?a.m.trigger(new _.L(_.yl)):d===_.Uj&&a.m.trigger(new _.L(_.xg,{details:{width:f.width||0,height:f.height||0,bandwidth:f.bandwidth,track:f.track,abrSelection:c}})))}};lC=function(){this.f=new _.uA(2);this.h=new _.uA(5);this.a=0};
|
|
71
|
+
_.mC=function(){this.g=new _.K("clpp.abr");this.w=null;this.h=!1;this.o=new lC;this.l=[];this.j=1;this.D=this.B=!1;this.A=this.a=this.f=null};nC=function(a,b){a&&(b=b.filter(function(c){return c.video&&c.video.trickPlay?!1:IB(c,a,{width:Infinity,height:Infinity})}));return b.sort(function(c,d){return c.bandwidth-d.bandwidth})};oC=function(){this.a=new Map};qC=function(a,b){a.a.has(b)||a.a.set(b,new pC);return a.a.get(b)};pC=function(){this.text=this.variant=null};
|
|
72
|
+
rC=function(a,b){this.f=a;this.a=new Set([a]);b=b||[];for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.add(d.value)};uC=function(a,b){var c;if(!(c=!!a.audio!=!!b.audio||!!a.video!=!!b.video||a.language!=b.language)&&(c=a.audio&&b.audio)){c=a.audio;var d=b.audio;c=!(c.channelsCount==d.channelsCount&&sC(c,d)&&tC(c.roles,d.roles))}!c&&(c=a.video&&b.video)&&(c=a.video,d=b.video,c=!(sC(c,d)&&tC(c.roles,d.roles)));return c?!1:!0};
|
|
73
|
+
sC=function(a,b){if(a.mimeType!=b.mimeType)return!1;var c=a.codecs.split(",").map(function(f){return _.hA(f)[0]}),d=b.codecs.split(",").map(function(f){return _.hA(f)[0]});if(c.length!=d.length)return!1;c.sort();d.sort();for(var e=0;e<c.length;e++)if(c[e]!=d[e])return!1;return!0};tC=function(a,b){var c=new Set(a),d=new Set(b);c["delete"](_.Ke);d["delete"](_.Ke);if(c.size!=d.size)return!1;c=_.u(c);for(var e=c.next();!e.done;e=c.next())if(!d.has(e.value))return!1;return!0};
|
|
74
|
+
wC=function(a){this.a=a;this.f=new vC(a.language,"",a.audio&&a.audio.channelsCount?a.audio.channelsCount:0,!1)};vC=function(a,b,c,d){this.h=_.Th(a);this.a=b;this.f=c;this.j=void 0===d?!1:d};xC=function(a,b){var c=null;b.some(function(d){c=_.dA(_.Qi(d),a.map(function(e){return cA(e)}));return!!c});return c?a.filter(function(d){return c===cA(d)}):[]};yC=function(a,b){return a.filter(function(c){var d=c.audio;c=c.video;return d&&0<=d.roles.indexOf(b)||c&&0<=c.roles.indexOf(b)})};
|
|
75
|
+
zC=function(a,b){return a.filter(function(c){return c.audio&&c.audio.spatialAudio!=b?!1:!0})};CC=function(a,b){this.a=AC;this.f=(new Map).set(AC,b).set(BC,a)};
|
|
76
|
+
EC=function(a){var b=this;this.C=a;this.a=a.getConfiguration().streaming;this.f=new _.Eh;this.g=new _.K("clpp.mse.media.LiveEdgeObserver");DC(this)&&(a=this.C.getSurface().getMedia(),this.f.on(a,_.fg,function(){var c=b.C.getPosition(),d=b.C.getSeekRange().end;c=d-c;var e=b.C.getPlaybackRate(),f=b.a.stopChasingAt;1<=e&&c>=b.a.chaseJumpDistance?(b.g.debug("Too far from edge, jump to beginning."),b.C.setPlaybackRate(1),b.C.seek(d)):1===e&&c>=b.a.startChasingAt?(b.g.debug("Not on live edge, increase playback rate."),
|
|
77
|
+
b.C.setPlaybackRate(b.a.chasingRate,_.Wd)):1<e&&c<=f&&(b.g.debug("On live edge, reduce playback rate."),b.C.setPlaybackRate(1))}))};
|
|
78
|
+
DC=function(a){return 1>=a.a.chasingRate?(a.g.warn("chasingRate must be greater than 1."),!1):a.a.chaseJumpDistance<=a.a.startChasingAt?(a.g.warn("chaseJumpDistance must be greater than startChasingAt."),!1):a.a.startChasingAt<=a.a.stopChasingAt?(a.g.warn("startChasingAt must be greater than stopChasingAt."),!1):0>a.a.stopChasingAt?(a.g.warn("stopChasingAt must be greater than or equal to 0."),!1):!0};FC=function(a){this.h=a;this.a=null;this.f=function(){}};GC=function(a,b){a.f=b};
|
|
79
|
+
IC=function(a,b){this.h=a;this.l=HC(a);this.a=a.a.currentTime;this.j=Date.now()/1E3;this.o=b;this.f=function(){}};JC=function(a,b){a.f=b};KC=function(a){this.a=a};HC=function(a){if(a.a.paused||0==a.a.playbackRate||0===a.a.buffered.length)var b=!1;else a:{b=a.a.buffered;a=a.a.currentTime;for(var c=0;c<b.length;c++){var d=b.start(c),e=b.end(c);if(!(a<d-.1||a>e-(c+1===b.length?.5:.1))){b=!0;break a}}b=!1}return b};
|
|
80
|
+
MC=function(a,b,c,d,e){var f=this;this.a=a;this.G=b;this.l=c;this.D=e;this.h=new _.Eh;this.B=!1;this.I=a.readyState;this.j=!1;this.f=d;this.o=this.H=this.A=!1;this.h.on(a,_.Bg,function(){return LC(f)});this.w=(new _.Gk(function(){LC(f)})).kb(.25)};
|
|
81
|
+
LC=function(a){if(0!=a.a.readyState){if(a.a.seeking){if(!a.B)return}else a.B=!1;if(!a.a.paused&&!a.o){a.a.readyState!=a.I&&(a.j=!1,a.I=a.a.readyState);var b=a.l.smallGapLimit,c=a.a.currentTime,d=a.a.buffered;a:{var e=new _.El(d);var f=a.l.gapDetectionThreshold;if(e.length&&!(1===e.length&&1E-6>e.end(0)-e.start(0)))for(var g=0;g<e.length;g++)if(e.start(g)>c&&(0===g||e.end(g-1)-c<=f)){e=g;break a}e=null}if(null==e){if(a.f){a=a.f;d=a.h;c=HC(d);d=d.a.currentTime;b=Date.now()/1E3;if(a.a!=d||a.l!=c)a.j=
|
|
82
|
+
b,a.a=d,a.l=c;d=b-a.j;d>=a.o&&c&&a.f(a.a,d)}}else if((0!=e||a.A)&&a.H&&(f=d.start(e),!(f>=JA(a.G)))){g=f-c;b=g<=b;var h=!1;if(!(.001>g)){if(!b&&!a.j){a.j=!0;var l=new _.L("largegap",{detail:{currentTime:c,gapSize:g}});l.cancelable=!0;a.D(l);a.l.jumpLargeGaps&&!l.defaultPrevented?h=!0:_.th("Ignoring large gap at",c,"size",g)}if(b||h)0==e?_.th(oz,g,"seconds because of gap before start time of",f):_.th(oz,g,"seconds because of gap starting at",d.end(e-1),"and ending at",f),a.a.currentTime=f}}}}};
|
|
83
|
+
QC=function(a,b,c,d){this.a=a;this.j=b;this.o=d;this.A=c;this.l=!1;this.f=new _.Eh;this.h=new NC(a);this.w=!1;0<a.readyState?OC(this,c):PC(this,c)};RC=function(a){return a.l?a.a.currentTime:a.A};TC=function(a,b){0<a.a.readyState?SC(a.h,b):PC(a,b)};PC=function(a,b){a.A=b;a.f.off(a.a,_.Ie);a.f.one(a.a,_.Ie,function(){OC(a,b)})};OC=function(a,b){a.w||(a.w=!0,a.o&&a.o());.001>Math.abs(a.a.currentTime-b)?UC(a):(a.f.one(a.a,_.Of,function(){UC(a)}),SC(a.h,0==a.a.currentTime?b:a.a.currentTime))};
|
|
84
|
+
UC=function(a){_.Lk()&&!a.l&&a.j();a.l=!0;a.f.on(a.a,_.Of,function(){return a.j()})};NC=function(a){var b=this;this.f=a;this.o=10;this.l=this.h=this.j=0;this.a=new _.Gk(function(){0>=b.j?(_.J(["Failed to move playhead from",b.h,"to",b.l].join(" ")),b.a.stop()):b.f.currentTime!=b.h?b.a.stop():(b.f.currentTime=b.l,b.j--)})};SC=function(a,b){a.h=a.f.currentTime;a.l=b;a.j=a.o;a.f.currentTime=b;a.a.kb(.1)};
|
|
85
|
+
YC=function(a,b,c,d,e,f){var g=this;this.h=a;this.a=b.presentationTimeline;this.B=b.minBufferTime||0;this.l=c;this.A=e;this.w=null;this.j=new MC(a,b.presentationTimeline,c,VC(this,a,c),f);this.f=new QC(a,function(){a:{var h=g.j;h.B=!0;h.A=!1;h.j=!1;h=RC(g.f);var l=WC(g,h);if(.001<Math.abs(l-h)){var m=(new Date).getTime()/1E3;if(!g.w||g.w<m-1){g.w=m;TC(g.f,l);h=void 0;break a}}g.g.debug("Seek to "+h);g.A();h=void 0}return h},XC(this,d),function(){g.j.H=!0});this.o=(new _.Gk(function(){if(0!=g.h.readyState&&
|
|
86
|
+
!g.h.paused){var h=RC(g.f),l=_.LA(g.a),m=JA(g.a);3>m-l&&(l=m-3);h<l&&(l=WC(g,h),g.g.info("Jumping forward "+(l-h)+" seconds to catch up with the seek range."),g.h.currentTime=l)}})).kb(.25);this.g=new _.K("clpp.mse.Playhead")};$C=function(a){var b=RC(a.f);return 0<a.h.readyState&&!a.h.paused?ZC(a,b):b};XC=function(a,b){null==b?b=Infinity>a.a.getDuration()?_.LA(a.a):JA(a.a):0>b&&(b=JA(a.a)+b);return aD(a,ZC(a,b))};aD=function(a,b){var c=a.a.getDuration();return b>=c?c-a.l.durationBackoff:b};
|
|
87
|
+
WC=function(a,b){var c=new _.El(a.h.buffered);c=c.oc.bind(c);var d=Math.max(a.B,a.l.rebufferingGoal),e=a.l.safeSeekOffset,f=_.LA(a.a),g=JA(a.a),h=a.a.getDuration();3>g-f&&(f=g-3);var l=KA(a.a,d),m=KA(a.a,e);d=KA(a.a,d+e);if(b>=h)return a.g.debug("Playhead past duration."),aD(a,b);if(b>g)return a.g.debug("Playhead past end."),g;if(b<f){if(c(m))return a.g.debug("Playhead before start \x26 start is buffered"),m;a.g.debug("Playhead before start \x26 start is unbuffered");return d}if(b>=l||c(b))return a.g.debug("Playhead in safe region or in buffered region."),
|
|
88
|
+
b;a.g.debug("Playhead outside safe region \x26 in unbuffered region.");return d};ZC=function(a,b){var c=_.LA(a.a);if(b<c)return c;c=JA(a.a);return b>c?c:b};
|
|
89
|
+
VC=function(a,b,c){if(!c.stallEnabled)return null;var d=c.gapDetectionThreshold,e=c.stallSkip;c=new IC(new KC(b),c.stallThreshold);JC(c,function(f,g){a.g.warn("Stall detected at "+f+" for "+g+" seconds.");if(e){var h=new _.El(b.buffered),l;if(l=_.Jk("Edge/")||_.Jk("Trident/")||_.Gj()||_.Lk())a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){l=h.start(l+1)-h.end(l)>=d;break a}l=!1}if(l){a:{if(h.length&&!(1>=h.length))for(l=0;l<h.length-1;l++)if(f>h.start(l)&&f<h.end(l)){h=
|
|
90
|
+
h.start(l+1)-f;break a}h=null}h&&(e=Math.min(h+.1,e))}a.g.warn("Seeking forward "+e+" seconds to break stall.");b.currentTime+=e}else a.g.warn("Pausing and unpausing to break stall."),b.pause(),b.play()});return c};bD=function(a){var b=this;this.f=a;this.o=this.A=this.l=!1;this.h=this.f.Qg();this.w=_.Wd;this.j=null;this.a=new _.Gk(function(){b.A||b.f.Qk(.25*b.h)});this.g=new _.K("clpp.mse.media.PlayRateController")};cD=function(a,b){a.j=b;a.j.speedUpMode&&(a.w=a.j.speedUpMode)};
|
|
91
|
+
fD=function(a,b){a.a.stop();a.l||(a.o=!1);var c=a.l?0:a.h;if((b?b:a.w)===_.Wd||0===c||1===c)try{dD(a,c)}catch(d){a.g.warn('Set playbackRate using "decoder" mode fails, due to unsupported range by platform. Fallback to "seek" mode.',d),eD(a)}else eD(a)};eD=function(a){a.g.debug(uz,a.h,' using "seek" mode.');dD(a,0);a.o=!0;a.a.kb(.25)};dD=function(a,b){if(a.f.Qg()!=b){a.g.debug(uz,b,' using native playbackRate "decoder" mode.');try{a.f.nm(b)}catch(c){throw c;}}};
|
|
92
|
+
hD=function(a){function b(){d=!0}function c(m){f.push(m);_.zm(m)}a=_.Xi(a);var d=!1,e,f=[],g=[];(new _.ym).M(_.Re,c).M(_.gg,c).M(_.Me,c).M(_.Qe,c).M(_.Xf,c).Y(_.Zf,function(m){e=m;f.push(m);_.Am(m)}).Y("encv",b).Y("enca",b).Y("avc1",function(m){g.push({M:m,Xc:1701733238})}).Y("avc3",function(m){g.push({M:m,Xc:1701733238})}).Y("ac-3",function(m){g.push({M:m,Xc:1701733217})}).Y(_.le,function(m){g.push({M:m,Xc:1701733217})}).Y("mp4a",function(m){g.push({M:m,Xc:1701733217})}).parse(a);if(d)return _.th("Init segment already indicates encryption."),
|
|
93
|
+
a;if(0===g.length||!e)throw _.vh("Failed to find boxes needed to fake encryption!"),_.vh("Failed init segment (hex):",_.kj(a)),new _.P(_.Q,3,14E3);g.reverse();for(var h=_.u(g),l=h.next();!l.done;l=h.next())l=l.value,_.th('Inserting "'+_.Dm(l.Xc)+'" box into init segment.'),a=gD(a,e,l.M,f,l.Xc);return a};
|
|
94
|
+
gD=function(a,b,c,d,e){var f=iD.value(),g=a.subarray(c.start,c.start+c.size),h=_.dj(g),l=new Uint8Array(c.size+f.byteLength);l.set(g,0);g=_.dj(l);g.setUint32(4,e);l.set(f,c.size);e=h.getUint32(4);g.setUint32(c.size+16,e);jD(l,0,l.byteLength);e=new Uint8Array(a.byteLength+l.byteLength);c=_.Jk("Xbox One")||_.Ik()?c.start:c.start+c.size;f=a.subarray(c);e.set(a.subarray(0,c));e.set(l,c);e.set(f,c+l.byteLength);a=_.u(d);for(d=a.next();!d.done;d=a.next())d=d.value,jD(e,d.start,d.size+l.byteLength);l=_.dj(e,
|
|
95
|
+
b.start);b=_.Em(b);a=l.getUint32(b);l.setUint32(b,a+1);return e};jD=function(a,b,c){a=_.dj(a,b);b=a.getUint32(0);0!=b&&(1==b?(a.setUint32(8,c>>32),a.setUint32(12,c&4294967295)):a.setUint32(0,c))};_.kD=function(a,b){this.C=b;this.j=a;this.h=null;this.w=1;this.G=Promise.resolve();this.l=[];this.o=new Map;this.a=new Map;this.I=this.f=this.A=this.B=!1;this.H=0;this.g=new _.K("clpp.mse.Streaming");this.D=!1};mD=function(a){var b=a.a.get(_.tg);return b?lD(a)[b.Gb]:(b=a.a.get(_.$c))?lD(a)[b.Gb]:null};
|
|
96
|
+
oD=function(a){return _.nD(a,_.$c)};pD=function(a){return _.nD(a,_.tg)};
|
|
97
|
+
uD=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.E(function(q){switch(q.a){case 1:return c=_.tp,_.x(q,a.C.X.clear(c.TEXT),2);case 2:return a.H++,a.I=!1,d=a.H,e=a.C.X,f=new Map,g=new Set,f.set(c.TEXT,b),g.add(b),_.x(q,e.init(f,!1,a.h.disableAudioTracks),3);case 3:return a.f?q["return"]():_.x(q,qD(a,g),4);case 4:if(a.f)return q["return"]();l=(h=e.getTextDisplayer().isTextVisible())||a.h.alwaysStreamText;a.H!=d||a.a.has(c.TEXT)||a.I||!l||(m=a.C.Db(),n=rD(a,m),p=sD(b,n,0),a.a.set(c.TEXT,p),tD(a,p,0));
|
|
98
|
+
_.y(q)}})};xD=function(a){a.I=!0;var b=a.a.get(_.Di);b&&(vD(b),wD(b)["catch"](function(){}),a.a["delete"](_.Di))};zD=function(a,b,c,d){b.video&&_.yD(a,b.video,c,d);b.audio&&_.yD(a,b.audio,c,d)};
|
|
99
|
+
BD=function(a){function b(l){return a.C.X.oc(l,c,0)}var c=a.C.Db(),d=!1,e=rD(a,c);if(_.Ui(a.a.values(),function(l){return l.Gb==e}))for(var f=_.u(a.a.keys()),g=f.next();!g.done;g=f.next()){g=g.value;var h=a.a.get(g);h.stream.segmentIterator=null;b(g)||(AD(a,h),d=!0)}else if(!_.Ui(a.a.keys(),b)){a.g.debug("(all): seeked: unbuffered seek: clearing all buffers");d=_.u(a.a.values());for(f=d.next();!f.done;f=d.next())AD(a,f.value);d=!0}d||a.g.debug("(all): seeked: buffered seek: presentationTime\x3d"+
|
|
100
|
+
c)};ED=function(a,b){b=void 0===b?!1:b;if(a.f)a.g.error("Unable to retry after StreamingEngine is destroyed!");else if(a.A)a.g.error("Unable to retry after StreamingEngine encountered a fatal error!");else for(var c=_.u(a.a.values()),d=c.next();!d.done;d=c.next()){d=d.value;var e=CD(d);if(d.Sc||b&&DD(d))a.g.info(e,"Retrying after failure..."),d.Sc=!1,tD(a,d,.1)}};
|
|
101
|
+
GD=function(a){var b,c,d,e;return _.E(function(f){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,vD(e),e.fb&&e.Ib&&(e.fb=!1,b.push(e.Ib.abort())),e.Mb&&b.push(FD(a,e,!0,0));return _.x(f,Promise.all(b),0)})};HD=function(a,b,c){(a=a.a.get(b))&&c&&(vD(a),a.stream=c,a.Xb=c,a.va&&(a.va=c.getSegmentReference(a.va.position)),a.va||(a.Xb=null))};_.nD=function(a,b){var c=a.a.get(b);return c?c.ac||c.stream:null};
|
|
102
|
+
_.yD=function(a,b,c,d){var e=a.a.get(b.type);if(!e&&b.type==_.Di&&a.h.ignoreTextStreamFailures)uD(a,b);else if(e){var f=rA(lD(a),b);if(c&&f!=e.Gb)for(a.g.debug("switch: switching to stream in another Period; clearing buffer and changing Periods"),b=_.u(a.a.values()),c=b.next();!c.done;c=b.next())AD(a,c.value);else{e.ac&&(a.g.debug("switch during trick play mode",b),b.trickModeVideo?(e.ac=b,b=b.trickModeVideo,a.g.debug("switch found trick play stream",b)):(e.ac=null,a.g.debug("switch found no special trick play stream")));
|
|
103
|
+
var g=a.l[f];if(g&&g.$c&&(g=a.o.get(b.id))&&g.$c)if(e.stream!=b){g=a.j.presentationTimeline.getDuration();var h=a.C.Db();h=ID(a,e,h);!c&&(e.endOfStream||h>=g)?a.g.debug(Nz+CD(e)+" already buffered to the end. Not switching."):(b.type==_.Di&&nB(a.C.X,_.Ck(b.mimeType,b.codecs)),e.stream=b,e.stream.segmentIterator=null,e.Md=!0,a.g.debug("switch: switching to Stream "+CD(e)),JD(a,e,f)&&(a.g.info("Aborting current segment request to switch."),e.Ib.abort()),c&&(e.gc?e.De=!0:e.fb?(e.Mb=!0,e.be=d,e.De=!0):
|
|
104
|
+
(vD(e),FD(a,e,!0,d)["catch"](function(l){if(a.C)a.C.onError(l)}))))}else a.g.debug(Nz+CD(e)+" already active")}}};JD=function(a,b,c){if(!b.Ib)return!1;var d=a.C.Db(),e=a.C.X.Fa(b.type);c=(c=KD(a,b,d,e,c))?c.ia?c.ia-c.wa+1:null:null;if(null==c)return!1;var f=b.stream.initSegmentReference;f&&(c+=(f.ia?f.ia-f.wa+1:null)||0);f=a.C.df().getBandwidthEstimate();if(8*c/f<(null===e?0:e-d)-Math.max(a.j.minBufferTime||0,a.h.rebufferingGoal))return!0;a=b.Ib;a=a.j?a.j.bytesRemaining:-1;return 0>a||a>c?!0:!1};
|
|
105
|
+
AD=function(a,b){var c=CD(b);b.gc?a.g.debug(c,"clear: already clearing the buffer"):b.Mb?a.g.debug(c,"clear: already waiting"):b.fb?(a.g.debug(c,"clear: currently updating"),b.Mb=!0,b.be=0):null==a.C.X.xb(b.type)?(a.g.debug(c,"clear: nothing buffered"),null==b.wb&&tD(a,b,0)):(a.g.debug(c,"clear: handling right now"),vD(b),FD(a,b,!1,0)["catch"](function(d){if(a.C)a.C.onError(d)}))};
|
|
106
|
+
MD=function(a,b,c,d,e){var f,g,h,l,m,n,p;return _.E(function(q){if(1==q.a)return f=a.C.Db(),g=rD(a,f),h=_.tp,l=new Map,m=new Set,b&&(l.set(h.AUDIO,b),m.add(b)),c&&(l.set(h.VIDEO,c),m.add(c)),d&&(l.set(h.TEXT,d),m.add(d)),n=a.C.X,p=a.h.forceNativeTS,_.x(q,n.init(l,p,a.h.disableAudioTracks),2);if(3!=q.a){if(a.f)return q["return"]();LD(a);return _.x(q,qD(a,m),3)}if(a.f)return q["return"]();l.forEach(function(t,v){if(!a.a.has(v)){var z=sD(t,g,e);a.a.set(v,z);tD(a,z,0)}});_.y(q)})};
|
|
107
|
+
sD=function(a,b,c){return{stream:a,type:a.type,Xb:null,segmentIterator:null,va:null,ac:null,Md:!0,Gb:b,endOfStream:!1,fb:!1,wb:null,Mb:!1,be:0,De:!1,gc:!1,If:!1,Sc:!1,Mh:c||0,Ib:null,ee:!1,gh:0}};
|
|
108
|
+
ND=function(a,b){var c=a.l[b];if(c)return a.g.debug("(all) Period "+b+hz),c.O;a.g.debug("(all) setting up Period "+b);c={O:new _.zj,$c:!1};a.l[b]=c;for(var d=new Set,e=_.u(lD(a)[b].variants),f=e.next();!f.done;f=e.next())f=f.value,f.video&&d.add(f.video),f.video&&f.video.trickModeVideo&&d.add(f.video.trickModeVideo),f.audio&&d.add(f.audio);e=_.u(lD(a)[b].textStreams);for(f=e.next();!f.done;f=e.next())d.add(f.value);a.G=a.G.then(function(){return a.f?null:qD(a,d)}).then(function(){a.f||(a.l[b].O.resolve(),
|
|
109
|
+
a.l[b].$c=!0,a.g.debug("(all) setup Period "+b))})["catch"](function(g){a.f||(a.l[b].O["catch"](function(){}),a.l[b].O.reject(),delete a.l[b],a.g.warn("(all) failed to setup Period "+b),a.C.onError(g))});return c.O};
|
|
110
|
+
qD=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t;return _.E(function(v){switch(v.a){case 1:c=[];d=_.u(b);for(e=d.next();!e.done;e=d.next())f=e.value,(g=a.o.get(f.id))?(a.g.debug("(all) Stream "+f.id+hz),c.push(g.O)):(a.g.debug("(all) setting up Stream "+f.id),a.o.set(f.id,{O:new _.zj,$c:!1}),h=a.C.sb,c.push(f.createSegmentIndex(h)));_.A(v,2);return _.x(v,Promise.all(c),4);case 4:if(a.f)return v["return"]();_.bh(v,3);break;case 2:l=_.C(v);if(a.f)return v["return"]();m=_.u(b);for(e=m.next();!e.done;e=m.next())n=
|
|
111
|
+
e.value,a.o.get(n.id).O["catch"](function(){}),a.o.get(n.id).O.reject(),a.o["delete"](n.id);throw l;case 3:p=_.u(b);for(e=p.next();!e.done;e=p.next())q=e.value,t=a.o.get(q.id),t.$c||(t.O.resolve(),t.$c=!0,a.g.debug("(all) setup Stream "+q.id));_.y(v)}})};LD=function(a){var b=a.j.presentationTimeline.getDuration();Infinity>b?zB(a.C.X,b):zB(a.C.X,Math.pow(2,32))};
|
|
112
|
+
QD=function(a,b){function c(p){return p.type==_.Di&&p.stream.mimeType==_.Sc}if(c(b))return uB(a.C.X,b.stream.originalId||""),null;b.type==_.Di&&vB(a.C.X);if(!mB(a.C.X)&&b.type!=_.Di)return a.h.bufferLimitUpdateInterval?a.h.bufferLimitUpdateInterval/2:.5;var d=CD(b),e=a.C.Db(),f=ID(a,b,e);a.g.debug(d,"timeNeeded\x3d"+f);var g=rA(lD(a),b.stream),h=rD(a,f),l=a.C.X.Ma(b.type,e);a.g.debug(d,"update_:",Iz+e,"bufferedAhead\x3d"+l);var m=Math.max(a.j.minBufferTime||0,a.h.rebufferingGoal,a.h.bufferingGoal)*
|
|
113
|
+
a.w,n=CA(a.j.presentationTimeline);if(null!=n&&f>=n&&!b.ee)return OD(a,b),null;b.endOfStream=!1;b.Gb=h;if(h!=g)return a.g.debug(d,"need Period "+h,Iz+e,"timeNeeded\x3d"+f,"currentPeriodIndex\x3d"+g),null;if(l>=m)return a.g.debug(d,"buffering goal met"),a.h.bufferLimitUpdateInterval||.5;h=a.C.X.Fa(b.type);h=KD(a,b,e,h,g);if(!h)return a.j.presentationTimeline.isLive()||b.type===_.Di?a.h.bufferLimitUpdateInterval||1:(a.g.debug("Media state "+d+": no next segment found. Assuming EOS."),OD(a,b),null);
|
|
114
|
+
d=Infinity;l=_.u(a.a.values());for(m=l.next();!m.done;m=l.next())m=m.value,c(m)||(m=ID(a,m,e),d=Math.min(d,m));if(f>=d+a.j.presentationTimeline.f)return a.h.bufferLimitUpdateInterval||1;b.Mh=0;PD(a,b,e,g,h)["catch"](function(){});return null};OD=function(a,b){a.g.debug(CD(b),"buffered to end of presentation");b.endOfStream=!0;if(b.type==_.tg){var c=a.a.get(_.Di);c&&c.stream.mimeType==_.Sc&&(c.endOfStream=!0)}};
|
|
115
|
+
ID=function(a,b,c){if(!b.Xb||!b.va)return Math.max(c,b.Mh);c=rA(lD(a),b.Xb);return lD(a)[c].startTime+b.va.endTime};
|
|
116
|
+
KD=function(a,b,c,d,e){if(b.stream.segmentLookupStrategy===RD)b.stream.segmentIterator?a=QA(b.stream.segmentIterator):b.va||d?(c=b.va?b.va.endTime:d,a.g.info(nz,"looking up segment from new stream endTime:",c),b.stream.segmentIterator=UA(b.stream.segmentIndex,c),e=b.stream.segmentIterator.next().value,null===e&&(b.stream.segmentIterator=null,a.g.warn(nz,zz,"endTime:",c,b.va)),a=e):(e=Math.max(c,0),a.g.info(nz,"looking up segment","lookupTime:",e,Hz,c),d=null,d||(b.stream.segmentIterator=UA(b.stream.segmentIndex,
|
|
117
|
+
c),d=b.stream.segmentIterator.next().value),null===d&&a.g.warn(nz,zz,"lookupTime:",e,Hz,c),a=d);else{var f=CD(b);if(b.va&&b.stream==b.Xb)c=b.va.position+1,a.g.debug(f,"next position known:","position\x3d"+c),a=SD(a,b,e,c);else{if(b.va){a.g.debug(f,"next position unknown: another Stream buffered");f=rA(lD(a),b.Xb);var g=TD(a,b,lD(a)[f].startTime+b.va.endTime,e)}else a.g.debug(f,"next position unknown: nothing buffered"),g=TD(a,b,d||c,e);if(null==g)a=null;else if(f=SD(a,b,e,g),null==f)a=null;else{var h=
|
|
118
|
+
null==a.h?!1:a.h.ignoreDrift;null!=d||h||(d=f,d.ya+d.startTime+2>c&&(a=SD(a,b,e,Math.max(0,g-1)))&&(f=a));a=f}}}return a};TD=function(a,b,c,d){var e=CD(b);d=lD(a)[d];var f=Math.max(0,c-d.startTime);b=b.stream.findSegmentPosition(f);a.g.debug(e,"Looked up segment:",Iz+c,"lookupTime\x3d"+f,Bz+d.startTime,"Result: segment position\x3d"+b);null==b&&a.g.warn(e,"cannot find segment:",Bz+d.startTime,"lookupTime\x3d"+f);return b};
|
|
119
|
+
SD=function(a,b,c,d){var e=CD(b);c=lD(a)[c];var f=b.stream.getSegmentReference(d);if(!f)return a.g.debug(e,"segment does not exist:",Bz+c.startTime,"position\x3d"+d),null;var g=a.j.presentationTimeline;d=_.IA(g);g=HA(g);return!b.ee&&(c.startTime+f.endTime<d||c.startTime+f.startTime>g)?(a.g.debug(e,"segment is not available:",Bz+c.startTime,Lz+f.startTime,Jz+f.endTime,"availabilityStart\x3d"+d,"availabilityEnd\x3d"+g),null):f};
|
|
120
|
+
PD=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,v,z,D,G;return _.E(function(F){f=_.tp;g=CD(b);h=lD(a)[d];a.g.debug(g,"fetchAndAppend_:",Iz+c,Bz+h.startTime,Kz+e.position,Lz+e.startTime,Jz+e.endTime);l=b.stream;m=b.stream.segmentIterator;n=a.j.presentationTimeline.getDuration();p=lD(a)[d+1];q=Math.max(0,h.startTime-.1);t=p?p.startTime+.01:n;v=UD(a,b,d,q,t,e);b.fb=!0;b.Md=!1;a.g.debug(g,"fetching segment");z=!1;D=function(B,H){if(a.f||a.A)return null;z=!0;return VD(a,b,c,h,l,e,B,H)};G=a.C.X.Fa(b.type)||
|
|
121
|
+
0;v.then(function(){return a.f||a.A?null:WD(a,b,e,!1,function(B){return D(B.data,!0)})}).then(function(B){return a.f||a.A?null:z||null===B?(XD(a,b,G,e,l),null):D(B,!1)}).then(function(){if(!a.f&&!a.A){XD(a,b,G,e,l);b.fb=!1;b.If=!1;b.Mb||a.C.we();if(m){var B=m.next().value;B&&a.g.debug("New iterated segment",B)}tD(a,b,0);YD(a,b,l);a.g.debug(g,"finished fetch and append")}})["catch"](function(B){return _.E(function(H){if(a.f||a.A)return H["return"]();b.fb=!1;if(b.type==f.TEXT&&a.h.ignoreTextStreamFailures)return 1001==
|
|
122
|
+
B.code?a.g.warn(g,"Text stream failed to download. Proceeding without it."):a.g.warn(g,"Text stream failed to parse. Proceeding without it."),a.a["delete"](f.TEXT),H.F(0);if(7001==B.code)return b.fb=!1,b.wb=null,tD(a,b,0),H.F(0);if(3017===B.code)return ZD(a,b,B),H.F(0);if(1001===B.code&&B.data&&404===B.data[1])return a.g.warn(g,"request for segment failed","segment not available on server",Kz+e.position,Lz+e.startTime,Jz+e.endTime,"error\x3d"+B),b.fb=!1,b.wb=null,tD(a,b,1),H.F(0);if(b.type===f.TEXT)return B instanceof
|
|
123
|
+
_.P&&B.a(1),vD(b),a.C.onError(new _.P(1,2,2010,B)),H.F(0);if(1001<=B.code&&1003>=B.code)return _.x(H,$D(a,b,h,B),0);a.g.error(g,"failed fetch and append: code\x3d"+B.code);b.Sc=!0;B instanceof _.P&&B.a(_.Q);return _.x(H,aE(a,B),0)})});_.y(F)})};
|
|
124
|
+
ZD=function(a,b,c){var d=CD(b);if(Array.from(a.a.values()).some(function(f){return f!=b&&f.If}))a.g.debug(d,pz,"waiting for another stream to recover...");else{var e=Math.round(100*a.w);if(20<e)a.w-=.2;else if(4<e)a.w-=.04;else{a.g.error(d,"MediaSource threw QuotaExceededError too many times");b.Sc=!0;a.A=!0;a.C.onError(c);return}a.g.warn(d,pz,"reducing buffering goals by "+(100-Math.round(100*a.w))+"%");b.If=!0}tD(a,b,4)};
|
|
125
|
+
$D=function(a,b,c,d){var e,f;return _.E(function(g){e=1001===d.code&&500<=d.data.status;f=!0;e||(f=!a.C.Re(b.stream,c));if(!f)return g.F(0);b.Sc=!0;d.a(_.Q);return _.x(g,aE(a,d),0)})};
|
|
126
|
+
UD=function(a,b,c,d,e,f){c=lD(a)[c].startTime-f.ya;if(!b.Md&&c===b.gh)return Promise.resolve();b.gh=c;var g=CD(b);a.g.debug(g,"setting timestamp offset to "+c);a.g.debug(g,"setting append window start to "+d);a.g.debug(g,"setting append window end to "+e);d=xB(a.C.X,b.type,c,d,e);if(!b.stream.initSegmentReference||!b.Md)return d;a.g.debug(g,"fetching init segment");e=WD(a,b,b.stream.initSegmentReference,!0).then(function(h){if(a.f)return null;a.g.debug(g,"appending init segment");return bE(a,h,b).then(function(){return tB(a.C.X,
|
|
127
|
+
b.type,h,null,null,!!b.stream.closedCaptions&&0<b.stream.closedCaptions.size)})})["catch"](function(h){b.Md=!0;return Promise.reject(h)});return Promise.all([d,e])};bE=function(a,b,c){var d;return _.E(function(e){if(!a.h.patchEdgeWhenMixedContent||!_.Ik())return e.F(0);d=hD(b);return _.x(e,tB(a.C.X,c.type,d.buffer,null,null,!!c.stream.closedCaptions&&0<c.stream.closedCaptions.size),0)})};
|
|
128
|
+
VD=function(a,b,c,d,e,f,g,h){h=void 0===h?!1:h;var l,m,n,p,q,t,v,z,D;return _.E(function(G){switch(G.a){case 1:l=CD(b);if(!(e&&e.keyId&&a.C.wd)){G.F(2);break}m=Uz(a.C.wd,e.keyId);if(!m){a.g.warn("Unable to find DRM session for "+e.keyId);G.F(2);break}_.A(G,4);return _.x(G,m,6);case 6:_.bh(G,2);break;case 4:n=_.C(G),a.g.warn("DRM session load failed!",n);case 2:if(!(e.encrypted&&e.keyId&&a.C.wd&&Wz(a.C.wd,e.keyId))){G.F(7);break}vD(b);p=rA(lD(a),e);q=cE(a,p);if(!q){G.F(8);break}return _.x(G,q,8);case 8:return t=
|
|
129
|
+
a.C.Re(e,d,Dz),v=f.startTime+d.startTime,z=f.endTime+d.startTime,a.g.warn(l,"Blocked append for "+v+" - "+z+": "+t+". Stream with Key ID "+(e.keyId+" has restrictions.")),G["return"](Promise.resolve());case 7:return D=e.closedCaptions&&0<e.closedCaptions.size,null!=e.emsgSchemeIdUris&&0<e.emsgSchemeIdUris.length&&(new _.ym).Y("emsg",a.Kl.bind(a,d,f,e.emsgSchemeIdUris)).parse(g),G["return"](dE(a,b,c).then(function(){if(a.f)return null;var F=f.startTime+d.startTime,B=f.endTime+d.startTime;a.g.debug(l,
|
|
130
|
+
"Appending segment with "+(F.toFixed(3)+" - "+B.toFixed(3)+" KeyID: ")+(e.keyId+" Width: ")+(e.width+" Height: "+e.height+" Bitrate: ")+(_.R.Qe(e.bandwidth)+" Fragment: ")+h);return tB(a.C.X,b.type,g,F,B,D,e.id,h)}).then(function(){a.f||(a.g.debug(l,"appended media segment"),b.Xb=e,b.va=f)}))}})};
|
|
131
|
+
XD=function(a,b,c,d,e){if(!a.j.presentationTimeline.isLive()&&b.type!==_.Di){var f=CD(b),g=(a.C.X.Fa(b.type)||0)-c,h=d.endTime-d.startTime;c=g-h;if(Math.abs(c)>=Math.min(.01,h)&&Math.abs(c)<=Math.min(1,h))for(a.g.debug(f,"Adjusted segment",d.position,"with real duration",g,"and accounted for",c,"delta between segment duration and real duration"),b.ee=!0,a=lD(a),e.adjustSegmentDurations(d.position,c),d=rA(a,e),b=a[d],e=e.getDuration(),tA(b,e),e=d+1;e<a.length;e++)a[e].startTime+=c}};
|
|
132
|
+
eE=function(a,b,c){(new _.ym).M(_.Re,_.zm).M(_.gg,_.zm).M(_.Me,_.zm).M(_.Qe,_.zm).M(_.Xf,_.zm).Y(_.Zf,_.Am).M("encv",function(d){d.reader.skip(78);_.zm(d)}).M(_.Sf,_.zm).M("schi",_.zm).M("tenc",function(d){d.reader.skip(6);if(_.sm(d.reader)){d.reader.skip(1);var e=_.kj(_.xm(d.reader,16));e!==b.stream.keyId&&(a.g.debug(CD(b),"Key id from tenc mismatches with key id from manifest. Switching from "+(b.stream.keyId+" to "+e+".")),b.stream.keyId=e)}d.parser.stop()}).parse(c)};
|
|
133
|
+
dE=function(a,b,c){if(a.f)return Promise.resolve();var d=CD(b);a.g.debug(d,"checking buffer length");var e=Math.max(a.h.bufferBehind,a.j.presentationTimeline.f),f=a.C.X.xb(b.type);if(null==f)return a.g.debug(d,"buffer behind okay because nothing buffered:",Iz+c,wz+e),Promise.resolve();var g=c-f,h=g-e;if(.01>=h)return a.g.debug(d,"buffer behind okay:",Iz+c,xz+g,wz+e,"underflow\x3d"+Math.abs(h)),Promise.resolve();a.g.debug(d,"buffer behind too large:",Iz+c,xz+g,wz+e,"overflow\x3d"+h);return a.C.X.remove(b.type,
|
|
134
|
+
f,f+h).then(function(){a.f||a.g.debug(d,"evicted "+h+" seconds")})};YD=function(a,b,c){if(!a.B){b=CD(b);var d=Array.from(a.a.values());1!=d.length||d[0].type!=_.Di?a.B=d.every(function(e){return e.type==_.Di||a.D?!0:!e.Mb&&!e.gc&&e.va}):a.D&&(a.B=!0);a.B&&(a.g.debug(b,"startup complete"),c=rA(lD(a),c),cE(a,c))}};
|
|
135
|
+
cE=function(a,b){var c=null;a.l[b]||(c=ND(a,b).then(function(){a.f||(a.g.debug(yz),a.C.vf())})["catch"](Zz));for(var d=0;d<lD(a).length;++d)ND(a,d)["catch"](Zz);a.C.El&&(a.g.debug("calling onStartupComplete()..."),a.C.El());return c};
|
|
136
|
+
fE=function(a,b){var c=CD(b),d=rA(lD(a),b.stream);if(b.Gb!=d){var e=b.Gb,f=Array.from(a.a.values());f.every(function(g){return g.Gb==e})?f.every(DD)?(a.g.debug(c,"all need Period "+e),ND(a,e).then(function(){if(!a.f)if(f.every(function(n){var p=DD(n),q=rA(lD(a),n.stream);return p&&n.Gb==e&&q!=e})){var g=lD(a)[e];a.g.debug(c,"Streaming period",e,g);a.g.debug(c,"calling onChooseStreams()...");var h=a.C.wf(g);a.D=!h.variant&&!!h.text;var l=new Map;h.variant&&h.variant.video&&l.set(_.tg,h.variant.video);
|
|
137
|
+
h.variant&&h.variant.audio&&l.set(_.$c,h.variant.audio);h.text&&l.set(_.Di,h.text);var m=_.u(a.a.keys());for(h=m.next();!h.done;h=m.next())if(h=h.value,!l.has(h)&&h!=_.Di){a.g.error(c,"invalid Streams chosen: missing "+h+" Stream");a.C.onError(new _.P(_.Q,5,5005));return}m=_.u(Array.from(l.keys()));for(h=m.next();!h.done;h=m.next())if(h=h.value,!a.a.has(h))if(h==_.Di)MD(a,null,null,l.get(_.Di),g.startTime),l["delete"](h);else{a.g.error(c,"invalid Streams chosen: unusable "+h+" Stream");a.C.onError(new _.P(_.Q,
|
|
138
|
+
5,5005));return}g=_.u(Array.from(a.a.keys()));for(h=g.next();!h.done;h=g.next())h=h.value,(m=l.get(h))?(_.yD(a,m,!1,0),tD(a,a.a.get(h),0)):a.a["delete"](h);a.g.debug(c,yz);a.C.vf()}else a.g.debug(c,"ignoring transition to Period",e,"since another is happening")})["catch"](Zz)):a.g.debug(c,"all MediaStates need Period "+e+", but not all MediaStates are idle"):a.g.debug(c,"not all MediaStates need Period "+e)}};rD=function(a,b){var c=pA(lD(a),b+_.ru);return c?lD(a).indexOf(c):0};
|
|
139
|
+
WD=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?null:e;var f=_.xA(c.Ra(),c.wa,c.ia,a.h.attemptParameters,c.startTime,c.endTime,b.type,c.timescale);f.type=2;f.onFragment=c.Mc?null:e;f.disableFragmentSupport=c.Mc||a.h.disableFragmentSupport;f.disableMergedFragments=a.h.disableMergedFragments;if(e=c.f())f.keyInfo=e,f.onFragment=null;d&&(f.responseModifiers.push(function(g){eE(a,b,g.data)}),b.type===_.tg&&a.h.overridePasp&&f.responseModifiers.push(a.Bm.bind(a)));a.g.debug("fetching: reference\x3d",
|
|
140
|
+
c);c=a.C.sb.fetch(f);b.Ib=c;return c.O.then(function(g){var h=a.C.df(),l=g.timeMs,m=g.data.byteLength;l&&m&&!d&&h.segmentDownloaded(l,m);b.Ib=null;return g.data})};
|
|
141
|
+
FD=function(a,b,c,d){var e,f,g,h;return _.E(function(l){if(1==l.a)return e=CD(b),b.Mb=!1,b.De=!1,b.be=0,b.gc=!0,b.stream.segmentIterator=null,a.g.debug(e,"clearing buffer"),d?(g=a.C.Db(),h=a.C.X.getDuration(),f=a.C.X.remove(b.type,g+d,h)):f=a.C.X.clear(b.type).then(function(){return!a.f&&c?a.C.X.flush(b.type):null}),_.x(l,f,2);if(a.f)return l["return"]();a.g.debug(e,"cleared buffer");b.Xb=null;b.va=null;b.gc=!1;b.endOfStream=!1;b.ee=!1;tD(a,b,0);_.y(l)})};
|
|
142
|
+
tD=function(a,b,c){a.g.debug(CD(b),"updating in "+c+" seconds");b.wb=(new _.Ek(function(){var d;return _.E(function(e){if(1==e.a)return _.A(e,2),_.x(e,a.Hb(b),4);if(2!=e.a)return _.bh(e,0);d=_.C(e);if(a.C)a.C.onError(d);_.y(e)})})).aa(c)};vD=function(a){null!=a.wb&&(a.wb.stop(),a.wb=null)};lD=function(a){return a.j.adaptedPeriods||a.j.periods};wD=function(a){return _.E(function(b){return a.Ib?_.x(b,a.Ib.abort(),0):b.F(0)})};
|
|
143
|
+
aE=function(a,b){var c;return _.E(function(d){switch(d.a){case 1:if(a.f)return d["return"]();if(!a.C.Qh){d.F(2);break}_.A(d,3);return _.x(d,a.C.Qh(b),5);case 5:_.bh(d,2);break;case 3:c=_.C(d),c.cause=b,b=c;case 2:if(!b.f)a.C.onError(b);_.y(d)}})};CD=function(a){return"("+a.type+":"+a.stream.id+")"};DD=function(a){return!a.fb&&null==a.wb&&!a.Mb&&!a.gc};
|
|
144
|
+
iE=function(a){_.Pl.call(this,Az);var b=this;this.B=gE;this.j=this.Yb=this.ha=null;this.Ef=0;this.Gh=2;this.xd=null;this.rf=!1;this.l=new _.Eh;this.Dc=this.oe=this.D=this.Hc=this.w=this.J=this.o=null;this.nd=!1;this.H=this.h=this.f=this.ga=this.a=this.K=this.G=null;this.Vh=1E9;this.qe=new Set;this.da=!0;this.qa=null;this.Nh=!1;this.Hh=0;this.pa=null;this.U=new oC;this.Rh={width:Infinity,height:Infinity};this.I=null;this.Wa=_.Vo;this.Fc=new vC(this.configuration.preferredAudioLanguage||[],this.configuration.preferredAudioRole,
|
|
145
|
+
this.configuration.preferredAudioChannelCount,this.configuration.preferSpatialAudio);this.md=this.configuration.preferredTextLanguage;this.V=this.Gc=null;this.Ic=new Map;this.Da=null;this.ne=this.configuration.preferredTextRole;this.hd=this.configuration.preferForcedSubtitles;a&&a(this);this.tf=null;this.l.on(window,"online",function(){b.B===hE&&ED(b.a)});this.re=null};
|
|
146
|
+
jE=function(a){return new _.kA(function(b){if(void 0===b||null===b)return null;var c=a.getTrackManager(),d=[];if(c){c=_.u(c.getVideoTracks());for(var e=c.next();!e.done;e=c.next())d.push.apply(d,_.Pg(e.value.renditions))}return d.find(function(f){return f.id==b})||null})};
|
|
147
|
+
kE=function(a,b){if(a.Wa!==b){var c=_.R.Pj;if(a.Wa===_.fp&&b!==_.Vo)c=c(b,_.dp),a.log.info(_.rz+c);else{var d=a.Ef;d=0===d?0:Date.now()-d;var e=a.Wa;a.Wa=b;a.Ef=Date.now();null!==a.D&&(a.D.A=b===_.hp);a.I&&_.Lo(a.I.a,a.Wa);b===_.$o&&(a.Gh=a.nf?1:2);var f=a.Gh,g={currentState:a.Wa,previousState:e,timeSinceLastStateChangeMS:d,reason:b===_.$o||e===_.$o?f:void 0},h=c(e,_.dp),l=c(b,_.dp);c=b!==_.$o?"":"["+c(f,_.cp)+"]";a.log.info(_.Kb+h+" -\x3e "+(l+c));a.trigger(new _.L(_.Vf,{detail:g}));(b===_.bp||b===
|
|
148
|
+
_.fp)&&a.Dc&&a.Dc.stop();b===_.$o?a.trigger(new _.L(_.kd,{detail:{bufferedTimeMS:-1,reason:f}})):e===_.$o&&a.trigger(new _.L(_.jd,{detail:{bufferedTimeMS:d,reason:f}}))}}};
|
|
149
|
+
qE=function(a){var b=!1;b=void 0===b?!0:b;var c,d;return _.E(function(e){switch(e.a){case 1:return a.B===lE?e["return"](Promise.reject(new _.P(_.Q,7,7E3))):_.x(e,mE(a),2);case 2:return _.x(e,nE(a),3);case 3:c=_.Gj(4)||_.Gj(5);if(!b&&!c){e.F(0);break}d=a.getSurface().getMedia();return _.x(e,oE(a,d),5);case 5:return _.x(e,pE(a,d),0)}})};
|
|
150
|
+
xE=function(a,b,c){c=void 0===c?!0:c;var d,e,f,g,h,l,m,n,p;return _.E(function(q){switch(q.a){case 1:if(a.B===lE)return q["return"](Promise.reject(new _.P(_.Q,7,7E3)));d=new _.zj;e=function(){return a.Yb!==d};f=function(){a.log.info("Aborting current load");throw new _.P(_.Q,7,7E3);};a.Yb=d;_.A(q,2);e()&&f();if(!a.ha){q.F(4);break}_.A(q,5);return _.x(q,a.ha,7);case 7:_.bh(q,6,2);break;case 5:_.C(q,2);case 6:e()&&f();case 4:return a.I=new _.Qo,a.tf=Date.now()/1E3,kE(a,_.gp),a.ca=_.mp(b),a.configuration=
|
|
151
|
+
_.Nl(a.ge,b),a.log.info(_.ub,a.configuration),a.log.info(_.Jb,a.ca),(g=a.getTrackManager())&&g.load(),a.h&&(a.h.configure(a.configuration.abr),a.configuration.abr.enabled&&!a.da?a.h.enable():a.h.disable()),a.H&&(a.H.release(),a.H=null),a.H=new _.ut(a.getNetworkEngine()),Yz(a.H,{enabled:a.configuration.abr.useCmsd}),h=rE(a,a.configuration),e()&&f(),_.x(q,oE(a,h),8);case 8:return e()&&f(),_.x(q,pE(a,h),9);case 9:return e()&&f(),a.K=new NA,OA(a.K,function(t){sE(a,_.Ph,t)}),_.x(q,tE(a,b,function(){e()&&
|
|
152
|
+
f()}),10);case 10:return l=q.f,a.ga=l.parser,a.f=l.manifest,e()&&f(),m=a,_.x(q,uE(a,a.f,a.configuration.drm),11);case 11:m.o=q.f;_.Jn("initDrm.end");_.Kn("Init DRM",Ez,"initDrm.end");if(!c){q.F(12);break}e()&&f();return _.x(q,vE(a),13);case 13:return e()&&f(),_.x(q,wE(a),12);case 12:e()&&f();d.resolve();_.bh(q,0);break;case 2:throw p=n=_.C(q),e()&&(p=new _.P(_.Q,7,7E3)),d.reject(p),a.onError(p),p;}})};
|
|
153
|
+
tE=function(a,b,c){var d,e,f,g,h;return _.E(function(l){if(1==l.a)return d=b,e=_.mp(d),f=e[a.getSourceIndex()],_.x(l,yE(a,f),2);if(3!=l.a)return g=l.f,c(),_.Jn(Fz),_.x(l,zE(a,g,f),3);h=l.f;_.Jn(Ez);_.Kn("Fetch and parse manifest",Fz,Ez);return l["return"]({parser:g,manifest:h})})};rE=function(a,b){var c=a.getSurface().getMedia();c.loop=!!b.loop;_.O.R(b.volume)||a.setVolume(b.volume);_.O.R(b.muted)||a.setMuted(b.muted);return c};
|
|
154
|
+
oE=function(a,b){a.j||(a.l.on(b,_.pe,function(){if(a.j.error){var c=a.j.error.code;if(1==c)c=null;else{var d=a.j.error.msExtendedCode;d&&(0>d&&(d+=Math.pow(2,32)),d=d.toString(16));c=new _.P(_.Q,3,3016,{code:c,extendedError:d,message:a.j.error.message})}}else c=null;if(c)a.onError(c)}),a.j=b);return Promise.resolve()};nE=function(a){a.j&&(a.l.off(a.j,_.pe),a.j=null);return Promise.resolve()};
|
|
155
|
+
mE=function(a){var b;return _.E(function(c){switch(c.a){case 1:a.B!==lE&&(a.B=gE);if(b=a.j)a.l.off(b,_.He),a.l.off(b,_.tf),a.l.off(b,_.ef),a.l.off(b,_.oe),a.l.off(b,_.Gf),a.l.off(b,_.Ef);a.K&&(a.K.release(),a.K=null);a.Hc&&(a.Hc.release(),a.Hc=null);a.Dc&&(a.Dc.stop(),a.Dc=null);if(!a.ga){c.F(2);break}return _.x(c,a.ga.stop(),3);case 3:a.ga=null;case 2:if(!a.h){c.F(4);break}return _.x(c,a.h.stop(),4);case 4:if(!a.a){c.F(6);break}return _.x(c,a.a.destroy(),7);case 7:a.a=null;case 6:a.w&&(a.w.release(),
|
|
156
|
+
a.w=null);a.D&&(a.D.release(),a.D=null);if(!a.J){c.F(8);break}return _.x(c,a.J.destroy(),9);case 9:a.J=null;case 8:a.oe&&(a.oe.release(),a.oe=null);b&&b.src&&(b.removeAttribute("src"),b.load());if(!a.o){c.F(10);break}return _.x(c,a.o.destroy(),11);case 11:a.o=null;case 10:a.H&&(a.H.release(),a.H=null),a.U.clear(),a.G=null,a.qe.clear(),a.f=null,a.I=null,a.da=!0,a.Ic.clear(),a.nd=!1,AE(a),_.y(c)}})};
|
|
157
|
+
pE=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=window.muxjs?new fB:new _.gB,d=_.Jo(a.configuration,[_.ve,"single-native"]),a.L=d.create(a),a.xd=jE(a),a.xd.track(a),e=new _.iB(b,c,a.L,a.xd,a.configuration),_.x(f,e.I,2);a.J=e;_.y(f)})};yE=function(a,b){var c,d;return _.E(function(e){if(1==e.a)return c=a.getNetworkEngine(),_.x(e,_.at(b.url,c,a.configuration.manifest.attemptParameters,b.type||null),2);d=e.f;d.configure(a.configuration.manifest);return e["return"](d)})};
|
|
158
|
+
zE=function(a,b,c){return(new _.Aj(Promise.resolve().then(function(){var d,e,f;return _.E(function(g){switch(g.a){case 1:d=null;case 2:if(d){g.F(3);break}_.A(g,4);return _.x(g,b.start(c.url,BE(a)),6);case 6:d=g.f;_.bh(g,2);break;case 4:e=_.C(g);if(!a.Ec)throw e;return _.x(g,a.Ec(c.url,e),8);case 8:if(f=g.f)c.url=f;else throw e;g.F(2);break;case 3:if(0===d.periods.length)throw new _.P(_.Q,4,4014);CE(d.periods);return g["return"](d)}})}),function(){a.log.info("Aborting parser step...");return b.stop()})).O};
|
|
159
|
+
uE=function(a,b,c){var d,e,f,g,h,l;return _.E(function(m){switch(m.a){case 1:d=new _.Pn({sb:a.getNetworkEngine(),onError:function(n){return a.onError(n)},zf:function(n){if(a.a){var p=DE(a),q=!1,t=Object.keys(n);0===t.length&&a.log.warn("Got a key status event without any key statuses, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");var v=1===t.length&&"00"===t[0];v&&a.log.warn("Got a synthetic key status event, so we don't know the real key statuses. If we don't have all the keys, you'll need to set restrictions so we don't select those tracks.");
|
|
160
|
+
if(t.length){t=a.getPeriods();for(var z=0;z<t.length;z++)for(var D=t[z],G=_.u(D.variants),F=G.next();!F.done;F=G.next()){F=F.value;var B=[];F.audio&&B.push(F.audio);F.video&&B.push(F.video);B=_.u(B);for(var H=B.next();!H.done;H=B.next()){H=H.value;var N=F.allowedByKeySystem;if(H.keyId){var M=n[v?"00":H.keyId];M=!!M&&!EE.includes(M);F.allowedByKeySystem=M}N!==F.allowedByKeySystem&&(M=H.type,H.type===_.tg&&(M="video "+H.width+"x"+H.height+"@"+_.R.Qe(H.bandwidth)),a.log.warn("DRM Key not available for KID: '"+
|
|
161
|
+
(H.keyId+"'. Applying restrictions to "+M)));D===p&&N!==F.allowedByKeySystem&&(q=!0)}}}if(n=mD(a.a)){v=oD(a.a);t=pD(a.a);a:{z=n.variants;for(D=0;D<z.length;D++)if(z[D].audio===v&&z[D].video===t){v=z[D];break a}v=null}if(!v||v.allowedByKeySystem)a.log.info(mz),FE(a),GE(a,n.variants)}q&&n!==p&&(a.log.info(mz),FE(a),GE(a,p.variants))}},yf:function(n,p){a.trigger(new _.L(_.fe,{expirationTime:p}))},onEvent:function(n){return a.Xe(n)},getConfiguration:function(){return a.getConfiguration()},Qc:function(){return a.Qc()}});
|
|
162
|
+
e=_.im(c);d.h=e;f=c?c.offlineId||"":"";g=[];h=_.Us(b.periods);if(!f){m.F(2);break}l=_.Rl(_.ff);if(!l){m.F(2);break}return _.x(m,l.l(a,h),4);case 4:return _.x(m,l.j(f),5);case 5:g=m.f;case 2:return _.x(m,_.Un(d,h,g),6);case 6:return a.o=d,HE(a,b.periods),m["return"](d)}})};
|
|
163
|
+
vE=function(a){var b,c,d,e;return _.E(function(f){if(1==f.a)return b=a.j,c=function(g){a.j&&a.G&&(g.type===_.Of&&a.td?(a.G.a=BC,AE(a)):g.type===_.Bg&&a.getState()===_.ip&&.1>a.getBufferInfo().Ma(a.getPosition())?(a.G.a=BC,AE(a)):a.G&&IE(a));JE(a)},d=function(){if(a.j){var g=a.j.playbackRate;0!=g&&a.D.set(g)}},a.l.on(b,_.tf,c),a.l.on(b,_.ef,c),a.l.on(b,_.oe,c),a.l.on(b,_.Of,c),a.l.on(b,_.Nf,c),a.l.on(b,_.Ef,c),a.l.on(b,_.Bg,c),a.l.on(b,_.Gf,d),a.h||(a.h=new _.mC,a.h.configure(a.configuration.abr)),
|
|
164
|
+
null!==a.H&&a.h.setCmsdManager(a.H),KE(a,a.f.periods),a.Fc=new vC(a.configuration.preferredAudioLanguage||[],a.configuration.preferredAudioRole,a.configuration.preferredAudioChannelCount,a.configuration.preferSpatialAudio),a.md=a.configuration.preferredTextLanguage,a.ne=a.configuration.preferredTextRole,a.hd=a.configuration.preferForcedSubtitles,_.x(f,_.ho(a.o,b),2);if(!a.o)throw new _.P(_.Q,7,7001);a.h.init(function(g,h,l){!a.da&&LE(a,g,h,l)});a.w=ME(a,a.configuration.startTime);a.Hc=NE(a);a.D=new bD({Qg:function(){return b.playbackRate},
|
|
165
|
+
nm:function(g){b.playbackRate=g},Qk:function(g){b.currentTime+=g}});cD(a.D,a.configuration.trickPlay);a.isLive()&&a.configuration.streaming.enableLiveEdgeChasing&&(a.oe=new EC(a));e=Math.max(1E-4,a.configuration.streaming.rebufferingGoal);OE(a,e);HB(a.f,_.Th(a.configuration.preferredVideoCodec),_.Th(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);a.a=PE(a);a.a.h=a.configuration.streaming;a.B=hE;_.y(f)})};
|
|
166
|
+
wE=function(a){var b,c,d,e,f,g,h;return _.E(function(l){if(1==l.a)return _.x(l,a.a.start(),2);if(!a.a)throw new _.P(_.Q,7,7001);a.configuration.streaming.startAtSegmentBoundary&&(b=$C(a.w),c=QE(a,b),TC(a.w.f,c));d=_.u(a.f.periods);for(e=d.next();!e.done;e=d.next())f=e.value,RE(a,f);FE(a);g=DE(a)||a.f.periods[0];h=g.variants.some(function(m){return m.primary});a.configuration.preferredAudioLanguage||h||a.log.warn("No preferred audio language set. We will choose an arbitrary language initially");GE(a,
|
|
167
|
+
g.variants);a.l.one(a.j,_.He,function(){a.I.A=Date.now()/1E3-(null===a.tf?0:a.tf)});_.y(l)})};CE=function(a){function b(d){return d.video&&d.audio||d.video&&d.video.codecs.includes(",")}if(a.some(function(d){return d.variants.some(b)})){_.uh("Found variant with audio and video content, so filtering out audio-only content in all periods.");a=_.u(a);for(var c=a.next();!c.done;c=a.next())c=c.value,c.variants=c.variants.filter(b)}};
|
|
168
|
+
ME=function(a,b){return new YC(a.j,a.f,a.configuration.streaming,b,function(){a.Hc&&VA(a.Hc,!0);a.a&&BD(a.a)},function(c){return a.dispatchEvent(c)})};NE=function(a){var b=new WA(a.j),c=new FC(a.f);GC(c,function(){FE(a)});b.a.add(c);a.K&&(c=new XA(a.K),YA(c,function(d){d.ve&&d.ve();sE(a,_.Rh,d)},function(d){d.xf&&d.xf();sE(a,_.Sh,d)},function(d,e){e||(d.ve&&d.ve(),sE(a,_.Rh,d),d.xf&&d.xf(),sE(a,_.Sh,d))}),b.a.add(c));return b};OE=function(a,b){a.G=new CC(b,Math.min(.5,b/2));a.G.a=BC;AE(a);a.Dc=(new _.Gk(function(){IE(a)})).kb(.25)};
|
|
169
|
+
IE=function(a){switch(a.B){case hE:a:if(a.j.ended||oB(a.J))var b=!0;else{if(a.isLive()){b=HA(a.f.presentationTimeline);var c=a.getBufferInfo();if(null!==c&&(c=c.Fa(),null!==c&&c>=b)){b=!0;break a}}b=!1}break;default:b=!1}if(a.J){var d=qB(a.J);c=d.video;d=d.audio;var e=a.j.currentTime;c&&d?(c=c.Ma(e),d=d.Ma(e),c=Math.min(c,d)):c=c?c.Ma(e):d?d.Ma(e):0}else c=0;if(d=a.G){d=a.G;var f=b,g=d.f.get(d.a);e=d.a;c=f||c>=g?AC:BC;d.a=c;d=e!=c}c=d;d=SE(a);c||a.getState()===_.$o&&!d?(a.log.debug("Buffering state changed. Is buffering",
|
|
170
|
+
d,"buffered to end",b,"state",a.getState()),AE(a)):a.nd&&JE(a)};PE=function(a){var b={Db:function(){return $C(a.w)},X:a.J,sb:a.getNetworkEngine(),wf:a.fj.bind(a),vf:a.ej.bind(a),onError:a.onError.bind(a),oh:a.ml.bind(a),onEvent:a.Xe.bind(a),sh:a.gj.bind(a),we:a.zl.bind(a),df:function(){return a.h},Re:a.ni.bind(a),Qh:a.um.bind(a),wd:a.o};return new _.kD(a.f,b)};fC=function(a){if(a.f&&a.w){var b=TE(a),c=[];a=_.u(UE(a));for(var d=a.next();!d.done;d=a.next()){d=d.value;var e=NB(d);e.active=d==b;c.push(e)}return c}return[]};
|
|
171
|
+
dC=function(a,b){if(a.f&&a.a){var c=DE(a),d=c.textStreams.find(function(e){return e.id==b.id});d?(VE(a,c,d,!1),WE(a,d),a.md=d.language,a.hd=d.kind===_.qe):a.log.error(_.qz,b.id)}};
|
|
172
|
+
gC=function(a,b,c){var d=void 0===d?0:d;if(a.f&&a.a){var e=DE(a);if(a.configuration.abr.enabled&&b)a.log.info("Disable ABR and enable manual track selection to select "+(b.width+"x"+b.height+"@"+b.bandwidth)),a.configuration.abr.enabled=!1,a.h.disable();else if(!a.configuration.abr.enabled&&!b){a.log.info("Enable ABR Selection");a.configuration.abr.enabled=!0;a.h.enable();a.V=null;c=GE(a,e.variants);null!=a.Da&&(a.Fc=a.Da,a.Da=null);null==c||a.da||LE(a,c);return}if(b){a.V=b.id;var f=e.variants.find(function(g){return g.id==
|
|
173
|
+
b.id});f?(a.V=f.video.id,PB(f)?(XE(a,e,f,!1),YE(a,f,c,d),null==a.Da&&(a.Da=a.Fc),a.Fc=new wC(f),GE(a,e.variants)):a.log.error("Unable to switch to restricted track",b.id)):a.log.error("No variant with id",b.id)}else a.V=null,null!=a.Da&&(a.Fc=a.Da,a.Da=null),c=GE(a,e.variants),null==c||a.da||LE(a,c)}};
|
|
174
|
+
eC=function(a,b){if(a.configuration.streaming.disableAudioTracks)Promise.reject(Error("Audio tracks are disabled by config."));else{if(a.a&&(a.f||a.w)){var c=pD(a.a),d=oD(a.a),e=pA(a.f.periods,$C(a.w)),f=a.f.periods[e?a.f.periods.indexOf(e):0].variants.filter(function(m){return m.audio.id===b&&PB(m)});e=!1;var g=void 0;if(c){if(g=f.find(function(m){return m.video.id===c.id}),!g){a.log.debug("Cannot find exact variant, looking for anything else that matches with given audioId");e=!0;var h=a.getTrackManager().Ia();
|
|
175
|
+
if(h){var l=h.renditions.map(function(m){return m.id});g=f.find(function(m){return l.find(function(n){return n===String(m.video.id)})})}}}else g=f[0];if(g){if(d.codecs.split(".")[0]===g.audio.codecs.split(".")[0]){d=g.audio;a.Gc=d.id;a.h.setVariants(f);f=DE(a);XE(a,f,g,!1);e||a.da?YE(a,g,!0,0):_.yD(a.a,d,!0,0);Promise.resolve();return}a.log.warn("Target audio codecs not compatible with active audio codecs.")}}Promise.reject()}};
|
|
176
|
+
hC=function(a){var b=a.rf;return a.f?a.J.getTextDisplayer().isTextVisible():b};cC=function(a,b){var c,d,e,f;return _.E(function(g){c=a.rf;d=b;if(c==d)return g["return"]();a.rf=d;if(a.B!==hE)return g.F(0);a.J.getTextDisplayer().setTextVisibility(b);if(a.configuration.streaming.alwaysStreamText)return g.F(0);if(!b)return xD(a.a),g.F(0);e=DE(a);f=_.RB(e.textStreams,a.md,a.ne,a.hd);return 0<f.length?_.x(g,uD(a.a,f[0]),0):g.F(0)})};
|
|
177
|
+
XE=function(a,b,c,d){var e=a.getTrackManager();a.ga.setCurrentVariant(c);if(e){var f=a.I.B;if(c.video){kC(e,c.video,d);var g=e.ka();f.j!==g&&(f.j=g,f.a.push({timestamp:Date.now()/1E3,id:g.id,trackId:g.track.id,type:g.track.type,fromAdaptation:d,width:g.width,height:g.height,bandwidth:g.bandwidth}))}c.audio&&(kC(e,c.audio,d),e=e.Pa(),f.f!==e&&(f.f=e,f.a.push({timestamp:Date.now()/1E3,id:e.id,trackId:e.track.id,type:e.track.type,fromAdaptation:d,width:null,height:null,bandwidth:e.bandwidth})))}qC(a.U,
|
|
178
|
+
b).variant=c};VE=function(a,b,c,d){qC(a.U,b).text=c;if(b=a.getTrackManager())kC(b,c,d),c=b.Ha(),a=a.I.B,a.h!==c&&(a.h=c,a.a.push({timestamp:Date.now()/1E3,id:c.id,trackId:c.track.id,type:c.track.type,fromAdaptation:d,width:null,height:null,bandwidth:null}))};
|
|
179
|
+
KE=function(a,b){for(var c=0;c<b.length;c++){for(var d=b[c],e=new Map,f=_.u(d.variants),g=f.next();!g.done;g=f.next())if(g=g.value,g.video&&g.video.closedCaptions){g=g.video;for(var h=_.u(g.closedCaptions.keys()),l=h.next();!l.done;l=h.next())if(l=l.value,!e.has(l)){var m={id:a.Vh++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return null},getSegmentReference:function(){return null},initSegmentReference:null,ya:0,mimeType:_.Sc,codecs:"",kind:_.nd,encrypted:!1,
|
|
180
|
+
keyId:null,language:g.closedCaptions.get(l),label:null,type:_.Di,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:g.roles,channelsCount:null,spatialAudio:!1,closedCaptions:null};e.set(l,m)}}e=_.u(e.values());for(f=e.next();!f.done;f=e.next())d.textStreams.push(f.value)}};
|
|
181
|
+
HE=function(a,b){for(var c=a.a?oD(a.a):null,d=a.a?pD(a.a):null,e=_.u(b),f=e.next();!f.done;f=e.next())MB(a.o,c,d,f.value);c=eA(b,function(h){return h.variants.some(PB)});if(a.configuration.streaming.disableAudioTracks)for(d=_.u(b),e=d.next();!e.done;e=d.next())for(f=_.u(e.value.variants),e=f.next();!e.done;e=f.next())delete e.value.audio;if(a.configuration.streaming.disableVideoTracks)for(d=_.u(b),e=d.next();!e.done;e=d.next())for(f=_.u(e.value.variants),e=f.next();!e.done;e=f.next()){e=e.value;var g=
|
|
182
|
+
e.video;g&&!fA(g.type,_.Ck(g.mimeType,g.codecs))&&delete e.video}if(0===c)throw new _.P(_.Q,4,4032);if(c<b.length)throw new _.P(_.Q,4,4011);c=_.u(b);for(e=c.next();!e.done;e=c.next())d=e.value,JB(d.variants,a.configuration.restrictions,a.Rh)&&a.a&&DE(a)==d&&FE(a),ZE(a,d.variants)};
|
|
183
|
+
RE=function(a,b){var c=a.a?oD(a.a):null,d=a.a?pD(a.a):null;MB(a.o,c,d,b);d=b.variants;if(!d.some(PB))throw new _.P(_.Q,4,4011);ZE(a,b.variants);JB(d,a.configuration.restrictions,a.Rh)&&a.a&&DE(a)==b&&FE(a);if(!_.Gj(2)&&(c=a.o?a.o.getDrmInfo():null)){d=_.u(d);for(var e=d.next();!e.done;e=d.next()){e=_.u(e.value.drmInfos);for(var f=e.next();!f.done;f=e.next())if(f=f.value,f.keySystem===c.keySystem){f=_.u(f.initData||[]);for(var g=f.next();!g.done;g=f.next())g=g.value,_.ko(a.o,g.keyId,g.initData)||_.ao(a.o,
|
|
184
|
+
g.initDataType,g.initData,g.keyId)}}}};YE=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;a.da?(a.qa=b,a.Nh=c,a.Hh=d):zD(a.a,b,c,d)};WE=function(a,b){a.da?a.pa=b:_.yD(a.a,b,!0,0)};$E=function(a){if(a.a&&a.f){var b=mD(a.a),c=DE(a);null!=b&&b==c&&(oD(a.a),pD(a.a),_.nD(a.a,_.Di),qC(a.U,c),qC(a.U,c))}};
|
|
185
|
+
QE=function(a,b){function c(g,h){if(!g)return null;var l=g.findSegmentPosition(h-f.startTime);return null==l?null:(l=g.getSegmentReference(l))?l.startTime+f.startTime:null}var d=oD(a.a),e=pD(a.a),f=DE(a);d=c(d,b);e=c(e,b);return null!=e&&null!=d?Math.max(e,d):null!=e?e:null!=d?d:b};SE=function(a){return a.o&&a.o.D?!0:a.G?a.G.getState()===BC:!1};AE=function(a){if(a.I&&a.G&&a.w){var b=aF(a)===_.$o,c=a.D;c.l=b;fD(c,c.o?"seek":void 0);a.w.j.o=b;JE(a)}};JE=function(a){kE(a,aF(a))};
|
|
186
|
+
aF=function(a){if(a.td)var b=!1;else if(a.j&&a.j.ended)b=!0;else{b=a.getDuration();var c=a.getPosition();b=a.nd&&0<=c&&b<=c?!0:!1}return b?_.bp:SE(a)||a.td?_.$o:a.j&&a.j.paused?_.hp:_.ip};
|
|
187
|
+
GE=function(a,b){try{ZE(a,b)}catch(e){return a.onError(e),null}var c=b.filter(function(e){return PB(e)});c=VB(c,a.Gc);var d=a.Fc.create(c);d=Array.from(d.values());a.h.setVariants(d);if(null!==a.V&&null!==a.Gc&&(d=d.find(function(e){return e.video.id==a.V&&e.audio.id==a.Gc}),a.V=null,d))return d;if(a.configuration.abr.enabled||null===a.V)return a.h.chooseVariant();c=c.find(function(e){return null!==e.video&&e.video.id===a.V});return c?c:(a.log.warn("Selected video track not found. Falling back to ABR selection"),
|
|
188
|
+
a.h.chooseVariant())};bF=function(a,b){return _.RB(b,a.md,a.ne,a.hd)[0]||null};cF=function(a,b,c){c=void 0===c?!0:c;var d=GE(a,b.variants);a.Gc=d&&d.audio&&d.audio.id;d&&(XE(a,b,d,!0),YE(a,d,c));(c=bF(a,b.textStreams))&&(a.configuration.streaming.alwaysStreamText||hC(a))&&(VE(a,b,c,!0),WE(a,c))};
|
|
189
|
+
fF=function(a,b){a.da=!0;a.h.disable();a.log.debug("Choosing new streams after period changed");var c=GE(a,b.variants),d=bF(a,b.textStreams);a.qa&&(b.variants.includes(a.qa)&&(c=a.qa),a.qa=null);a.pa&&(b.textStreams.includes(a.pa)&&(d=a.pa),a.pa=null);c&&dF(a,b,function(){return XE(a,b,c,!0)});d&&(a.configuration.streaming.alwaysStreamText||hC(a))&&dF(a,b,function(){return VE(a,b,d,!0)});b===DE(a)&&eF(a);return a.configuration.streaming.alwaysStreamText||hC(a)?{variant:c,text:d}:{variant:c,text:null}};
|
|
190
|
+
LE=function(a,b,c,d){c=void 0===c?!1:c;d=void 0===d?0:d;if(a.configuration.abr.enabled){a.log.debug("switch_");var e=gF(a,b);dF(a,e,function(){return XE(a,e,b,!0)});e===DE(a)&&eF(a);a.a&&zD(a.a,b,c,d)}};FE=function(a){var b=a.getTrackManager();b&&a.B!==lE&&(b.m&&(jC(b),b.m.trigger(new _.L(_.Au))),eF(a))};eF=function(a){var b=DE(a);if(b){var c=a.Ic.get(b)||[];for(a.Ic["delete"](b);c.length;)c.shift()()}};dF=function(a,b,c){a.Ic.has(b)||a.Ic.set(b,[]);a.Ic.get(b).push(c)};
|
|
191
|
+
sE=function(a,b,c){a.trigger(new _.L(b,{detail:MA(c)}))};
|
|
192
|
+
ZE=function(a,b){var c=a.o?_.O.Zf(a.o.pa):{},d=Object.keys(c);d=d.length&&"00"==d[0];for(var e=!1,f=!1,g=[],h=[],l=_.u(b),m=l.next();!m.done;m=l.next()){m=m.value;var n=[];m.audio&&n.push(m.audio);m.video&&n.push(m.video);n=_.u(n);for(var p=n.next();!p.done;p=n.next())if(p=p.value,p.keyId){var q=c[d?"00":p.keyId];q?EE.includes(q)&&(h.includes(q)||h.push(q)):g.includes(p.keyId)||g.push(p.keyId)}m.allowedByApplication?m.allowedByKeySystem&&(e=!0):f=!0}if(!e)throw new _.P(_.Q,4,4012,{hasAppRestrictions:f,
|
|
193
|
+
missingKeys:g,restrictedKeyStatuses:h});};UE=function(a){var b=DE(a);if(null==b)return[];$E(a);return b.variants.filter(function(c){return PB(c)})};hF=function(a){var b=DE(a);if(null==b)return[];$E(a);return b.textStreams.filter(function(c){return!a.qe.has(c)})};DE=function(a){var b=$C(a.w),c=null;a=_.u(a.f.periods);for(var d=a.next();!d.done;d=a.next())d=d.value,d.startTime<=b&&(c=d);return c};TE=function(a){var b=DE(a);return b&&qC(a.U,b).variant};
|
|
194
|
+
gF=function(a,b){for(var c=_.u(a.f.periods),d=c.next();!d.done;d=c.next())if(d=d.value,d.variants.includes(b))return d;return null};
|
|
195
|
+
iF=function(a,b,c){var d,e,f,g,h,l,m,n,p,q,t,v,z,D,G,F,B,H,N,M;return _.E(function(S){switch(S.a){case 1:return d=_.tp,_.A(S,2),_.x(S,_.at(b.url,a.getNetworkEngine(),a.configuration.manifest.attemptParameters,b.type||null),4);case 4:return e=S.f,e.configure(a.configuration.manifest),_.x(S,e.start(b.url,BE(a)),5);case 5:f=S.f;CE(f.periods);if(!f.periods.length)throw new _.P(_.Q,4,4014);return _.x(S,a.ga.stop(),6);case 6:a.ga=e;g=c.audio&&c.audio.id;h=c.video&&c.video.id;a.f.periods=f.periods;l=pA(f.periods,
|
|
196
|
+
$C(a.w))||f.periods[0];HB(a.f,_.Th(a.configuration.preferredVideoCodec),_.Th(a.configuration.preferredAudioCodec),a.configuration.preferredAudioChannelCount);m=WB(g,h,l.variants);n=bF(a,l.textStreams);GE(a,l.variants);p=m&&m.video;q=m&&m.audio;t=[];v=new Set;z=_.u(l.variants);for(D=z.next();!D.done;D=z.next())G=D.value,G.video&&v.add(G.video),G.audio&&v.add(G.audio);F=a.getNetworkEngine();B=_.u(_.Pg(v).concat(_.Pg(l.textStreams)));for(H=B.next();!H.done;H=B.next())N=H.value,t.push(N.createSegmentIndex(F));
|
|
197
|
+
return _.x(S,Promise.all(t),7);case 7:HD(a.a,d.AUDIO,q);HD(a.a,d.VIDEO,p);HD(a.a,d.TEXT,n);m&&XE(a,l,m,!1);a.log.info("Switch CDN successful.");_.bh(S,0);break;case 2:M=_.C(S);if(!e){S.F(8);break}return _.x(S,e.stop(),8);case 8:throw M;}})};
|
|
198
|
+
BE=function(a){return{networkingEngine:a.getNetworkEngine(),filterNewPeriod:function(b){return RE(a,b)},filterAllPeriods:function(b){return HE(a,b)},onTimelineCueAdded:a.K?function(b){var c=a.K;a:{var d=_.u(c.a);for(var e=d.next();!e.done;e=d.next())if(e=e.value,e.schemeIdUri===b.schemeIdUri&&e.startTime===b.startTime&&e.endTime===b.endTime){d=e;break a}d=null}null==d&&(c.a.add(b),c.f(b))}:function(){},onEvent:function(b){return a.Xe(b)},onError:function(b){return a.onError(b)},onUpdate:function(){},
|
|
199
|
+
onTurnedStatic:function(){a.trigger(new _.L(_.Ge))}}};jF=function(){};kF=function(){var a=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(b){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];c=a.apply(this,c);c.abort=function(){};return c}};lF=function(){var a=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(b,c){return a.call(this,b,c-.001)}};
|
|
200
|
+
mF=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"mp2t"==b.split(/ *; */)[0].split("/")[1].toLowerCase()?!1:a(b)}};nF=function(){var a=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(b){return"opus"!=_.hA(b)[0]&&a(b)}};
|
|
201
|
+
oF=function(){var a=MediaSource.isTypeSupported,b=/^dv(?:h[e1]|a[v1])\./;MediaSource.isTypeSupported=function(c){var d=c.split(/ *; */),e=d.shift(),f={};d=_.u(d);for(var g=d.next();!g.done;g=d.next())g=g.value.split("\x3d"),f[g[0]]=g[1].replace(/"(.*)"/,"$1");d=f.codecs;if(!d)return a(c);var h=!1,l=!1;c=d.split(",").filter(function(n){b.test(n)&&(l=!0);/^(hev|hvc)1\.2/.test(n)&&(h=!0);return!0});l&&(h=!1);f.codecs=c.join(",");h&&(f.eotf="smpte2084");for(var m in f)e+="; "+m+'\x3d"'+f[m]+'"';return cast.__platform__.canDisplayType(e)}};
|
|
202
|
+
pF=function(a){_.du.call(this,a);a=a.getSurface().getMedia();this.a=null;for(var b=0;b<a.textTracks.length;++b){var c=a.textTracks[b];c.mode=_.Yd;c.label===sz&&(this.a=c)}this.a||(this.a=a.addTextTrack(_.Mz,sz));this.a.mode=_.ue};qF=function(a,b){var c=a.mode;a.mode=c==_.Pf?_.Pf:_.ue;for(var d=a.cues,e=d.length-1;0<=e;e--){var f=d[e];f&&b(f)&&a.removeCue(f)}a.mode=c};rF=function(){};_.Oi.prototype.f=Oz(0,function(){return this.keyInfo});var Qz=[112,115,115,104,0,0,0,0];_.aA.prototype.f=function(){return this.keyInfo};
|
|
203
|
+
_.tF=function sF(a){var c,d,e,f,g,h;return _.jh(sF,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.u(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.F(0):_.x(l,{Wg:c,Zl:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{Wg:c,item:e,Zl:d,next:h},5):l.F(5)}c++;d=e;e=h;g=f.next();return l.F(2)})};_.kA.prototype.track=function(a){null!=this.player&&(this.player&&(this.player.off(_.Lf,this.a),this.f&&this.player.off(_.fg,this.a)),this.player=null);a&&(this.player=a,this.player.on(_.Lf,this.a,this))};
|
|
204
|
+
_.kA.prototype.append=function(a,b,c){var d=this.j?this.j(c):null;d||this.log.debug("Unable to resolve rendition for id",c);c={start:a,end:b,rendition:d,width:d?d.width:0,height:d?d.height:0,bandwidth:d?d.bandwidth:0};var e=this.S.find(function(f){return f.start>=a&&f.end<=b});if(e)e.rendition=d,e.width=c.width,e.height=c.height,e.bandwidth=c.bandwidth,e.start=c.start,e.end=c.end;else{d=_.u(this.S);for(e=d.next();!e.done;e=d.next())e=e.value,a>=e.start&&a<e.end?e.end=a:b>=e.start&&b<e.end&&(e.start=
|
|
205
|
+
b);this.S.push(c);this.S.sort(jA)}nA(this);this.a();this.player&&this.player.trigger(new _.L(_.wg))};_.kA.prototype.clear=function(){this.S=[];nA(this);this.player&&(this.player.trigger(new _.L(_.wg)),this.player.trigger(new _.L(_.fd)))};
|
|
206
|
+
_.kA.prototype.a=function(){if(this.player){var a=this.player.getPosition();if(0<=a){a:{for(var b=this.S.length,c=Number.MAX_SAFE_INTEGER,d=0;d<b;d++){var e=this.S[d];c=Math.min(e.start,c);if(e.start<=a&&e.end>a){a=.1>e.end-a&&d<b-1?this.S[d+1].rendition:e.rendition;break a}if(e.start>a)break}a=0<b&&c>a&&.25>c-a?this.S[0].rendition:null}if(a&&this.h!==a&&(this.h=a,this.player)){c=b=-1;if(a)b=a.width||-1,c=a.height||-1;else if(d=this.player.getSurface().getMedia())b=d.videoWidth,c=d.videoHeight;this.player.trigger(new _.L(_.hd,
|
|
207
|
+
{detail:{width:b,height:c,bandwidth:a?a.bandwidth:null,rendition:a}}))}}}};yA.prototype.getDuration=function(){return this.h?this.f-this.a:Infinity};_.r=_.AA.prototype;_.r.Rc=function(){return this.J};_.r.getDuration=function(){return 2===this.j.version?this.a.getDuration():this.h};_.r.getPresentationStartTime=function(){return this.D};_.r.offset=function(a){null!=this.o&&(this.o+=a);null!=this.l&&(this.l+=a)};_.r.isLive=function(){return 2===this.j.version?!this.a.h:Infinity==this.h&&!this.A};
|
|
208
|
+
NA.prototype.release=function(){this.f=function(){};this.a.clear()};NA.prototype.cues=function(){return this.a};PA.prototype.next=function(){var a=this.h.get(this.a);a&&0<a.a.length?(this.f+=1,a.Ra().length&&this.f===a.a.length&&(this.a+=1,this.f=0)):(this.a+=1,this.f=0);a=QA(this);return{value:a,done:!a}};_.r=_.RA.prototype;_.r.destroy=function(){this.a=[];return Promise.resolve()};
|
|
209
|
+
_.r.Kc=function(a){for(var b=this.a.length-1;0<=b;--b){var c=this.a[b];if(a>=c.startTime&&a<c.endTime)return c.position}if(this.a.length&&a<this.a[0].startTime)return this.a[0].position;this.g.warn("No Segment found for "+a+". We have "+this.a.length+" references");for(a=0;a<this.a.length;a++)b=this.a[a],this.g.debug("SegmentIndex Ref "+a+" start: "+b.startTime+" end: "+b.endTime+" pos: "+b.position);return null};
|
|
218
210
|
_.r.get=function(a){if(0==this.a.length)return null;a-=this.a[0].position;return 0>a||a>=this.a.length?null:this.a[a]};_.r.offset=function(a){this.g.info("Apply offset"+a+" to segment index");for(var b=_.u(this.a),c=b.next();!c.done;c=b.next())c=c.value,c.startTime+=a,c.endTime+=a,c.ya-=a};
|
|
219
|
-
_.r.
|
|
220
|
-
_.r.
|
|
221
|
-
b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.
|
|
222
|
-
a};_.r.replace=function(a){this.a=a};
|
|
223
|
-
|
|
224
|
-
_.r.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.h||!c.h.remove(a,b)||null==c.a||b<=c.a||a>=c.f||(a<=c.a&&b>=c.f?c.a=c.f=null:a<=c.a&&b<c.f?c.a=b:a>c.a&&b>=c.f&&(c.f=a))})};_.r.
|
|
225
|
-
|
|
226
|
-
_.r.destroy=function(){var a=this;this.J=!0;var b=[],c;for(c in this.h){var d=this.h[c],e=d[0];this.h[c]=d.slice(0,1);e&&b.push(e.p["catch"](
|
|
227
|
-
a.
|
|
228
|
-
_.r.
|
|
229
|
-
_.r.
|
|
230
|
-
_.r.
|
|
231
|
-
_.r.
|
|
232
|
-
_.r.
|
|
233
|
-
_.r.
|
|
234
|
-
_.r.
|
|
235
|
-
_.r.
|
|
236
|
-
_.r.
|
|
237
|
-
_.r.
|
|
238
|
-
_.r.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
_.r.chooseVariant=function(){var a=TB(!this.D&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.l),b=this.getBandwidthEstimate();this.l.length&&!a.length&&(this.g.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=TB(null,this.l),a=[a[0]]);var c=a[0]||null;a=_.u(_.YE(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.item;var f=isNaN(this.j)||0===this.j?1:Math.abs(this.j),g=f*d.bandwidth,h=g/this.a.bandwidthDowngradeTarget;
|
|
211
|
+
_.r.kd=function(a,b){var c=a-this.a[0].position;if(0<=c&&c<this.a.length)for(this.g.warn("Accounting for segment duration drift",b,"at",c),this.a[c].endTime+=b,c+=1;c<this.a.length;++c)this.a[c].startTime+=b,this.a[c].endTime+=b};_.r.getDuration=function(){return this.a[this.a.length-1].endTime-this.a[0].startTime};
|
|
212
|
+
_.r.oa=function(a){for(var b=[],c=[],d=0,e=0;d<this.a.length&&e<a.length;){var f=this.a[d],g=a[e];f.startTime<g.startTime?(b.push(f),d++):(f.startTime>g.startTime?0===d?c.push(g):this.g.info("Refusing to rewrite original references on update!"):(.1<Math.abs(f.endTime-g.endTime)?(f=new _.Oi(f.position,g.startTime,g.endTime,g.Ra,g.wa,g.ia,g.ya,g.keyInfo,g.Mc,g.timescale,g.horizontalTiles,g.verticalTiles,g.durationPerTile),b.push(f)):b.push(f),d++),e++)}for(;d<this.a.length;)b.push(this.a[d++]);if(b.length)for(d=
|
|
213
|
+
b[b.length-1].position+1;e<a.length;)f=a[e++],f=new _.Oi(d++,f.startTime,f.endTime,f.Ra,f.wa,f.ia,f.ya,f.keyInfo,f.Mc,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile),b.push(f);else b=a;a=b;if(c.length&&b.length){a=[];e=b[0].position;d=c.length;c=_.u(c);for(f=c.next();!f.done;f=c.next())f=f.value,a.push(new _.Oi(e-d--,f.startTime,f.endTime,f.Ra,f.wa,f.ia,f.ya,f.keyInfo,f.Mc,f.timescale,f.horizontalTiles,f.verticalTiles,f.durationPerTile));b=_.u(b);for(f=b.next();!f.done;f=b.next())a.push(f.value)}this.a=
|
|
214
|
+
a};_.r.replace=function(a){this.a=a};WA.prototype.release=function(){this.h.stop();for(var a=_.u(this.a),b=a.next();!b.done;b=a.next())b.value.release();this.a.clear()};XA.prototype.release=function(){this.l=null;this.j.clear();this.a=function(){};this.f=function(){};this.h=function(){}};
|
|
215
|
+
XA.prototype.o=function(a,b){for(var c={},d=_.u(this.l.cues()),e=d.next();!e.done;c={Ke:c.Ke,Sd:c.Sd},e=d.next()){e=e.value;c.Ke=this.j.get(e)||null;c.Sd=a<e.startTime?1:a>e.endTime?3:2;this.j.set(e,c.Sd);var f=this.w.find(function(g){return function(h){return h.zc===g.Ke&&h.yc===g.Sd}}(c));f&&f.mc(e,b)}};_.uF=0;_.r=aB.prototype;_.r.destroy=function(){this.h=this.w=null;this.o.clear();return Promise.resolve()};
|
|
216
|
+
_.r.remove=function(a,b){var c=this;return Promise.resolve().then(function(){!c.h||!c.h.remove(a,b)||null==c.a||b<=c.a||a>=c.f||(a<=c.a&&b>=c.f?c.a=c.f=null:a<=c.a&&b<c.f?c.a=b:a>c.a&&b>=c.f&&(c.f=a))})};_.r.xb=function(){return this.a};_.r.Fa=function(){return this.f};_.r.oc=function(a){return null==this.a||null==this.f?!1:a>=this.a&&a<this.f};_.r.Ma=function(a){return null==this.f||this.f<a?0:this.f-Math.max(a,this.a)};
|
|
217
|
+
fB.prototype.init=function(a){var b=muxjs.mp4.probe;a=_.Xi(a);this.l=b.videoTrackIds(a);this.j=b.timescale(a);this.a.init()};fB.prototype.h=function(a,b){var c=_.Xi(a);(c=this.a.parse(c,this.l,this.j))&&c.captions&&b(c.captions);this.a.clearParsedCaptions()};fB.prototype.f=function(){this.a.resetCaptionStream()};_.gB.prototype.init=function(){};_.gB.prototype.h=function(){};_.gB.prototype.f=function(){};_.r=_.iB.prototype;
|
|
218
|
+
_.r.destroy=function(){var a=this;this.J=!0;var b=[],c;for(c in this.h){var d=this.h[c],e=d[0];this.h[c]=d.slice(0,1);e&&b.push(e.p["catch"](Zz));for(e=1;e<d.length;++e)d[e].p["catch"](Zz),d[e].p.reject()}this.a&&b.push(this.a.destroy());this.B&&b.push(this.B.destroy());for(var f in this.A)b.push(this.A[f].destroy());return Promise.all(b).then(function(){a.l&&(a.l.release(),a.l=null);a.j&&(a.j.removeAttribute("src"),a.j.load(),a.j=null);a.w="";a.o=null;a.a=null;a.B=null;a.f={};a.A={};a.G={};a.H=null;
|
|
219
|
+
a.L=!1;for(var g in a.h);a.h={}})};_.r.init=function(a,b,c){c=void 0===c?!1:c;var d=this,e;return _.E(function(f){if(1==f.a)return e=_.tp,_.x(f,d.I,2);a.forEach(function(g,h){var l=_.Ck(g.mimeType,g.codecs);if(h==e.TEXT)nB(d,l);else{var m=new Map;m.set(h,l);if((!_.Xq(l)||!b||g.keyInfo)&&_.Bk(l,h)){var n=_.Bk(l);n&&(m=n(),d.A[h]=m,m=m.demuxMimeTypes(h,l),c&&m["delete"](e.AUDIO))}lB(d,m)}});_.y(f)})};_.r.xb=function(a){return a===_.Di?this.a.xb():(a=pB(this,a))?a.xb():null};
|
|
220
|
+
_.r.Fa=function(a){return a===_.Di?this.a.Fa():(a=pB(this,a))?a.Fa():null};_.r.oc=function(a,b,c){return a===_.Di?this.a.oc(b):(a=pB(this,a))?a.oc(b,!1,c):!1};_.r.Ma=function(a,b){if(a===_.Di)return this.a.Ma(b);var c=pB(this,a);return c?c.Ma(b):0};_.r.remove=function(a,b,c){var d=this;return a===_.Di?this.a.remove(b,c):sB(this,a,this.Jh.bind(this,a,b,c)).then(function(){if(a===_.tg){var e=d.xb(a),f=d.Fa(a);null!==e&&null!==f&&oA(d.D,e,f)}else a===_.$c&&(e=d.D,e.player&&e.player.trigger(new _.L(_.fd)))})};
|
|
221
|
+
_.r.clear=function(a){if(a==_.Di){if(!this.a)return Promise.resolve();this.H.f();return this.a.remove(0,Infinity)}return sB(this,a,this.Jh.bind(this,a,0,this.o.duration))};_.r.flush=function(a){return a==_.Di?Promise.resolve():sB(this,a,this.Ig.bind(this,a))};_.r.endOfStream=function(a){var b=this;return yB(this,function(){oB(b)||(a?b.o.endOfStream(a):b.o.endOfStream())})};_.r.getDuration=function(){return this.o.duration};
|
|
222
|
+
_.r.Ye=function(a,b){this.g.debug("Appending data to "+a+gz);try{this.f[a].appendBuffer(b)}catch(c){throw this.g.warn("Failed to append data for "+a,c),c;}this.g.debug("Done Appending data to "+a+gz)};_.r.Jh=function(a,b,c){if(c<=b)this.Yc(a);else{this.g.debug("Removing data from "+a+" range:",b,c);try{this.f[a].remove(b,c)}catch(d){throw this.g.warn("Failed to remove data from "+a+" buffer. Range:",b,c,d),d;}this.g.debug("Done Removing data from "+a+" range:",b,c)}};
|
|
223
|
+
_.r.fi=function(a){try{this.g.debug("Aborting operations for "+a+gz);var b=this.f[a].appendWindowStart,c=this.f[a].appendWindowEnd;this.f[a].abort();this.f[a].appendWindowStart=b;this.f[a].appendWindowEnd=c}catch(d){throw this.g.warn("Failed to abort operations for "+a+gz,d),d;}this.g.debug("Done Aborting operations for "+a+gz);this.Yc(a)};
|
|
224
|
+
_.r.Ig=function(a){try{this.j.readyState>HTMLMediaElement.HAVE_NOTHING?(this.g.debug("Flushing buffer for "+a),this.j.currentTime-=.001):this.g.warn("Skip buffer flush for "+a+" with element state: "+this.j.readyState)}catch(b){throw this.g.warn("Failed to flush buffer for "+a,b),b;}this.g.debug("Done Flushing buffer for "+a);this.Yc(a)};
|
|
225
|
+
_.r.Oh=function(a,b){0>b&&(b+=.001);try{this.g.debug("Setting timestamp offset for "+a,b),this.f[a].timestampOffset=b}catch(c){throw this.g.warn("Failed to set timestamp offset for "+a,b,c),c;}this.g.debug("Done Setting timestamp offset for "+a,b);this.Yc(a)};
|
|
226
|
+
_.r.hm=function(a,b,c){try{this.g.debug("Setting append window for "+a,b,c),this.f[a].appendWindowStart=0,this.f[a].appendWindowEnd=c,this.f[a].appendWindowStart=b}catch(d){throw this.g.warn("Failed to set append window for "+a,b,c,d),d;}this.g.debug("Done Setting append window for "+a,b,c);this.Yc(a)};_.r.T=function(a){this.h[a][0].p.reject(new _.P(_.Q,3,3014,{mediaError:this.j.error?this.j.error.code:0}))};
|
|
227
|
+
_.r.Yc=function(a){var b=this.h[a][0];b&&(b.p.resolve(),this.g.debug("Update-End received for "+a),BB(this,a))};_.r.getTextDisplayer=function(){return this.B};var kB=window.URL.createObjectURL;_.w(XB,_.U);_.r=XB.prototype;_.r.initialize=function(a){this.m=a};_.r.release=function(){this.h=[];this.a.clear();this.f.clear()};_.r.load=function(){};_.r.destroy=function(){this.release();this.m=null};_.r.getVideoTracks=function(){return YB(this,_.Uj)};_.r.getAudioTracks=function(){return YB(this,_.Tj)};_.r.ea=function(){return YB(this,_.T)};_.r.ka=function(){return this.a.get(_.Uj)||null};_.r.Pa=function(){return this.a.get(_.Tj)||null};_.r.Ha=function(){return this.a.get(_.T)||null};
|
|
228
|
+
_.r.cb=function(){return this.f.get(_.Uj)||null};_.r.mb=function(){return this.f.get(_.Tj)||null};_.r.nb=function(){return this.f.get(_.T)||null};_.r.Ia=function(){return ZB(this,_.Uj)};_.r.ja=function(){return ZB(this,_.Tj)};_.r.ua=function(){return ZB(this,_.T)};_.r.jb=function(a){aC(this,_.Uj,a)};_.r.za=function(a){aC(this,_.Tj,a)};_.r.La=function(a){aC(this,_.T,a)};_.r.Za=function(a,b){$B(this,_.Uj,a,void 0===b?!1:b)};_.r.hb=function(a,b){$B(this,_.Tj,a,void 0===b?!1:b)};
|
|
229
|
+
_.r.ib=function(a,b){b=void 0===b?!1:b;var c=a;if(!a){var d=this.Ha();if(d&&d.track.kind!==_.qe){var e=this.ea().find(function(g){return g.kind===_.qe&&g.language===d.track.language});if(!e){var f=this.ja();f&&(e=this.ea().find(function(g){return g.kind===_.qe&&g.language===f.language}))}e&&(c=e.renditions[0])}}$B(this,_.T,c,b)};_.r.addTextTrack=function(a){var b=this;return _.E(function(c){return b.m?_.x(c,b.m.addTextTrack(a.url,a.language,a.kind,a.mimeType,a.codec,a.label),0):c.F(0)})};
|
|
230
|
+
_.r.ma=function(){return!!this.m&&this.m.ma()};XB.prototype.isAbrEnabled=XB.prototype.ma;XB.prototype.addTextTrack=XB.prototype.addTextTrack;XB.prototype.setTextRendition=XB.prototype.ib;XB.prototype.setAudioRendition=XB.prototype.hb;XB.prototype.setVideoRendition=XB.prototype.Za;XB.prototype.setTextTrack=XB.prototype.La;XB.prototype.setAudioTrack=XB.prototype.za;XB.prototype.setVideoTrack=XB.prototype.jb;XB.prototype.getTextTrack=XB.prototype.ua;XB.prototype.getAudioTrack=XB.prototype.ja;
|
|
231
|
+
XB.prototype.getVideoTrack=XB.prototype.Ia;XB.prototype.getLoadingTextRendition=XB.prototype.nb;XB.prototype.getLoadingAudioRendition=XB.prototype.mb;XB.prototype.getLoadingVideoRendition=XB.prototype.cb;XB.prototype.getTextRendition=XB.prototype.Ha;XB.prototype.getAudioRendition=XB.prototype.Pa;XB.prototype.getVideoRendition=XB.prototype.ka;XB.prototype.getTextTracks=XB.prototype.ea;XB.prototype.getAudioTracks=XB.prototype.getAudioTracks;XB.prototype.getVideoTracks=XB.prototype.getVideoTracks;_.r=_.mC.prototype;_.r.stop=function(){this.w=null;this.h=!1;this.l=[];this.j=1;this.f=null;this.D=!1};_.r.init=function(a){this.w=a};
|
|
232
|
+
_.r.chooseVariant=function(){var a=nC(!this.D&&this.a.initialRestrictions?this.a.initialRestrictions:this.a.restrictions,this.l),b=this.getBandwidthEstimate();this.l.length&&!a.length&&(this.g.warn("No variants met the ABR restrictions. Choosing a variant by lowest bandwidth."),a=nC(null,this.l),a=[a[0]]);var c=a[0]||null;a=_.u(_.tF(a));for(var d=a.next();!d.done;d=a.next()){var e=d.value;d=e.item;var f=isNaN(this.j)||0===this.j?1:Math.abs(this.j),g=f*d.bandwidth,h=g/this.a.bandwidthDowngradeTarget;
|
|
242
233
|
e=f*(e.next||{bandwidth:Infinity}).bandwidth/this.a.bandwidthUpgradeTarget;this.g.debug("Bandwidth ranges:",(g/1E6).toFixed(3),(h/1E6).toFixed(3),(e/1E6).toFixed(3));b>=h&&b<=e&&(c=d)}this.f=Date.now();this.D=!0;return c};_.r.enable=function(){this.h=!0};_.r.disable=function(){this.h=!1};
|
|
243
|
-
_.r.segmentDownloaded=function(a,b){this.g.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.f,"enabled\x3d"+this.h);var c=this.o;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.
|
|
244
|
-
break a}}else if(Date.now()-this.f<1E3*this.a.switchInterval){this.g.debug("Still within switch interval...");break a}c=this.chooseVariant();d=this.getBandwidthEstimate();this.g.debug("Calling switch_(), bandwidth\x3d"+Math.round(d/1E3)+" kbps");c&&this.w(c)}};_.r.playbackRateChanged=function(a){this.j=a};_.r.getBandwidthEstimate=function(){var a=this.A&&this.A.
|
|
245
|
-
_.r.setVariants=function(a){this.l=a};_.r.setCmsdManager=function(a){this.A=a};_.r.configure=function(a){this.a=a};_.r.reset=function(){this.B=!1;this.o=new
|
|
246
|
-
|
|
247
|
-
a.next())c=c.value
|
|
248
|
-
_.r.start=function(){var a=this,b,c,d;return _.E(function(e){if(1==e.a){b=a.C.
|
|
249
|
-
_.r.Hb=function(a){var b=this,c,d,e,f;return _.E(function(g){switch(g.a){case 1:if(b.f)return g["return"]();c=
|
|
250
|
-
(b.g.debug(c,"calling endOfStream()..."),b.C.X.endOfStream().then(function(){if(!b.f){var h=b.C.X.getDuration();h<b.j.presentationTimeline.getDuration()&&(b.j.presentationTimeline.
|
|
251
|
-
_.r.
|
|
252
|
-
_.r.
|
|
253
|
-
_.r.unload=function(){var a=this;
|
|
254
|
-
_.r.release=function(){var a=this;return _.E(function(b){if(a.
|
|
255
|
-
_.r.getBufferInfo=function(a){if(this.
|
|
256
|
-
_.r.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.r.destroy=function(){var a=this;return _.E(function(b){if(1==b.a)return _.x(b,_.
|
|
257
|
-
_.r.
|
|
258
|
-
_.r.load=function(a){return
|
|
259
|
-
_.r.
|
|
260
|
-
_.r.setPlaybackRate=function(a,b){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.
|
|
261
|
-
d),_.
|
|
262
|
-
_.r.getStats=function(){if(this.
|
|
263
|
-
_.r.getTimelineCues=function(){return this.
|
|
264
|
-
_.r.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,t,v,z;return _.E(function(D){if(1==D.a){if(g.
|
|
265
|
-
findSegmentPosition:function(){return 1},getSegmentReference:function(G){return 1==G?t:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.
|
|
266
|
-
2)}if(z=_.
|
|
267
|
-
_.r.
|
|
268
|
-
_.r.
|
|
269
|
-
_.r.
|
|
270
|
-
|
|
271
|
-
_.r.
|
|
272
|
-
_.x(n,b.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
_.
|
|
276
|
-
_.r.append=function(a){function b(e){if(e.startTime>=e.endTime)_.J("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.R.
|
|
277
|
-
e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.u(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.r.remove=function(a,b){if(!this.a)return!1;
|
|
234
|
+
_.r.segmentDownloaded=function(a,b){this.g.debug("Segment downloaded:","deltaTimeMs\x3d"+a,"numBytes\x3d"+b,"lastTimeChosenMs\x3d"+this.f,"enabled\x3d"+this.h);var c=this.o;if(!(16E3>b)){var d=8E3*b/a,e=a/1E3;c.a+=b;_.vA(c.f,e,d);_.vA(c.h,e,d)}if(null!=this.f&&this.h)a:{this.g.debug("Suggesting Streams...");if(!this.B){if(!(128E3<=this.o.a)){this.g.debug("Still waiting for a good estimate...");break a}this.B=!0;if(this.a.useSwitchIntervalForInitialSwitch&&Date.now()-this.f<1E3*this.a.switchInterval){this.g.debug("Skipping initial estimation switch due to switch interval...");
|
|
235
|
+
break a}}else if(Date.now()-this.f<1E3*this.a.switchInterval){this.g.debug("Still within switch interval...");break a}c=this.chooseVariant();d=this.getBandwidthEstimate();this.g.debug("Calling switch_(), bandwidth\x3d"+Math.round(d/1E3)+" kbps");c&&this.w(c)}};_.r.playbackRateChanged=function(a){this.j=a};_.r.getBandwidthEstimate=function(){var a=this.A&&this.A.Mg();a||(a=this.o,a=128E3>a.a?this.a.defaultBandwidthEstimate:Math.min(_.wA(a.f),_.wA(a.h)));return a};
|
|
236
|
+
_.r.setVariants=function(a){this.l=a};_.r.setCmsdManager=function(a){this.A=a};_.r.configure=function(a){this.a=a};_.r.reset=function(){this.B=!1;this.o=new lC;var a=this.chooseVariant();a&&this.w(a)};oC.prototype.clear=function(){this.a.clear()};rC.prototype.add=function(a){if(uC(this.f,a))return this.a.add(a),!0;_.J("Rejecting variant - not compatible with root.");return!1};rC.prototype.values=function(){return this.a.values()};wC.prototype.create=function(a){var b=this,c=a.filter(function(d){return uC(b.a,d)});return c.length?new rC(c[0],c):this.f.create(a)};
|
|
237
|
+
vC.prototype.create=function(a){var b=xC(a,this.h);0<b.length&&(a=b);b=!1;if(this.a){var c=yC(a,this.a);0<c.length?(a=c,b=!0):_.J("No exact match for preferred variant role could be found. Role: "+this.a)}b||(b=a.filter(function(d){return d.primary}),0<b.length&&(a=b));this.f&&(b=DB(a,this.f),b.length?a=b:_.J("No exact match for the channel count could be found."));b=zC(a,this.j);b.length?a=b:_.J("No exact match for spatial audio could be found.");b=new rC(a[0]);a=_.u(a);for(c=a.next();!c.done;c=
|
|
238
|
+
a.next())c=c.value,uC(b.f,c)&&b.add(c);return b};CC.prototype.getState=function(){return this.a};var BC=0,AC=1;EC.prototype.release=function(){this.f.release()};FC.prototype.release=function(){this.a=this.h=null;this.f=function(){}};FC.prototype.o=function(a){var b=this.a,c=this.h.periods;a=pA(c,a)||c[0];b!=a&&this.f(a);this.a=a};IC.prototype.release=function(){this.h=null;this.f=function(){}};MC.prototype.release=function(){this.h&&(this.h.release(),this.h=null);null!=this.w&&(this.w.stop(),this.w=null);this.f&&(this.f.release(),this.f=null);this.a=this.G=this.D=null;this.o=!1};MC.prototype.we=function(){this.A=!0;LC(this)};QC.prototype.release=function(){this.f&&(this.f.release(),this.f=null);null!=this.h&&(this.h.release(),this.h=null);this.j=function(){};this.a=null;this.o=function(){};this.w=!1};NC.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};YC.prototype.release=function(){this.f&&(this.f.release(),this.f=null);this.j&&(this.j.release(),this.j=null);this.o&&(this.o.stop(),this.o=null);this.h=this.f=this.a=this.l=null;this.A=function(){}};bD.prototype.getConfiguration=function(){return this.j};bD.prototype.release=function(){this.a&&(this.a.stop(),this.a=null);this.f=null};bD.prototype.set=function(a,b){this.h=a;fD(this,b)};var iD=new _.So(function(){return new Uint8Array([0,0,0,80,115,105,110,102,0,0,0,12,102,114,109,97,0,0,0,0,0,0,0,20,115,99,104,109,0,0,0,0,99,101,110,99,0,1,0,0,0,0,0,40,115,99,104,105,0,0,0,32,116,101,110,99,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])});var RD;_.r=_.kD.prototype;_.r.destroy=function(){var a=this,b,c,d,e;return _.E(function(f){if(1==f.a){b=[];c=_.u(a.a.values());for(d=c.next();!d.done;d=c.next())e=d.value,vD(e),b.push(wD(e));return _.x(f,Promise.all(b),2)}a.a.clear();a.o.clear();a.C=null;a.j=null;a.G=null;a.l=null;a.h=null;a.f=!0;_.y(f)})};
|
|
239
|
+
_.r.start=function(){var a=this,b,c,d;return _.E(function(e){if(1==e.a){b=a.C.Db();c=rD(a,b);d=a.C.wf(lD(a)[c]);if(!d.variant&&!d.text)throw a.g.error("start(): No streams chosen"),new _.P(_.Q,5,5005);a.D=!d.variant&&!!d.text;return _.x(e,MD(a,d.variant?d.variant.audio:null,d.variant?d.variant.video:null,d.text,b),2)}if(a.f)return e["return"]();a.g.debug("init: completed initial Stream setup");a.C&&a.C.ol&&(a.g.debug("init: calling onInitialStreamsSetup()..."),a.C.ol());_.y(e)})};
|
|
240
|
+
_.r.Hb=function(a){var b=this,c,d,e,f;return _.E(function(g){switch(g.a){case 1:if(b.f)return g["return"]();c=CD(a);if(a.fb||null==a.wb||a.gc)return g["return"]();a.wb=null;if(!a.Mb){g.F(2);break}b.g.debug(c,"skipping update and clearing the buffer");return _.x(g,FD(b,a,a.De,a.be),3);case 3:return g["return"]();case 2:_.A(g,4);d=QD(b,a);null!=d&&(tD(b,a,d),a.Sc=!1);_.bh(g,5);break;case 4:return e=_.C(g),_.x(g,aE(b,e),6);case 6:return g["return"]();case 5:f=Array.from(b.a.values()),fE(b,a),b.B&&f.every(function(h){return h.endOfStream})&&
|
|
241
|
+
(b.g.debug(c,"calling endOfStream()..."),b.C.X.endOfStream().then(function(){if(!b.f){var h=b.C.X.getDuration();h<b.j.presentationTimeline.getDuration()&&(b.j.presentationTimeline.h=h)}}).then(function(){b.C.oh()})),_.y(g)}})};
|
|
242
|
+
_.r.Kl=function(a,b,c,d){var e=Pz(d.reader),f=Pz(d.reader),g=_.W(d.reader),h=_.W(d.reader),l=_.W(d.reader),m=_.W(d.reader);d=_.xm(d.reader,d.reader.Ga()-d.reader.getPosition());a=a.startTime+b.startTime+h/g;if(c.includes(e))if("urn:mpeg:dash:event:2012"==e)this.C.sh();else this.C.onEvent(new _.L("emsg",{detail:{startTime:a,endTime:a+l/g,schemeIdUri:e,value:f,timescale:g,presentationTimeDelta:h,eventDuration:l,id:m,messageData:d}}))};
|
|
243
|
+
_.r.Bm=function(a){var b=this,c=!1,d=0;(new _.ym).M(_.Re,_.zm).M(_.gg,_.zm).M(_.Me,_.zm).M(_.Qe,_.zm).M(_.Xf,_.zm).Y(_.Zf,_.Am).M("encv",function(e){e.reader.skip(78);_.zm(e)}).M("pasp",function(e){d=e.start+e.headerSize;var f=_.W(e.reader),g=_.W(e.reader);c=f!==g;b.g.debug("hSpacing\x3d"+f+", vSpacing\x3d"+g+", updatePASP\x3d"+c);e.parser.stop()}).parse(a.data);c&&(a=new _.mm(new DataView(a.data)),a.seek(d),_.V(a,1),_.V(a,1))};RD="iterateSegmentReference";_.vF={ITERATOR:RD,LOOKUP:_.Cz};_.w(iE,_.Pl);_.r=iE.prototype;_.r.init=function(a,b){var c=a.getMedia();_.Pl.prototype.init.call(this,a,b);oE(this,c)};_.r.namespace=function(){return Az};_.r.yg=function(){return new XB};_.r.getState=function(){return this.Wa};_.r.getDrmInfo=function(){return this.o?this.o.getDrmInfo():null};
|
|
244
|
+
_.r.unload=function(){var a=this;cC(this,!1);this.nd=!1;if(this.ca){var b=this.getTrackManager();b&&b.release();return this.B===lE?Promise.resolve():qE(this).then(function(){a.log.debug(_.Qb,a.ca);a.ca=null;a.Ef=0;a.Gc=null;a.V=null})}return Promise.resolve()};
|
|
245
|
+
_.r.release=function(){var a=this;return _.E(function(b){if(a.ha)return b["return"](a.ha);a.ha=new Promise(function(c,d){try{var e=a.Yb;a.Yb=null;var f=e;e&&(f=e["catch"](function(){}));f?f=f.then(function(){return _.Pl.prototype.release.call(a)}):f=_.Pl.prototype.release.call(a);f=f.then(function(){return a.unload()});f.then(function(){kE(a,_.Vo);a.ha=null;c()})["catch"](function(g){a.ha=null;d(g)})}catch(g){a.ha=null,d(g)}});return b["return"](a.ha)})};
|
|
246
|
+
_.r.getBufferInfo=function(a){if(this.J){var b=qB(this.J),c=new _.El(void 0,a);switch(a){case _.Uj:return b.video?b.video:c;case _.Tj:return b.audio?b.audio:c;case _.T:return b.text?b.text:c}return b.total?b.total:c}return this.xd?(b=lA(this.xd),iA(b,a)):_.Pl.prototype.getBufferInfo.call(this,a)};_.r.getPosition=function(){return this.w?$C(this.w):_.Pl.prototype.getPosition.call(this)};_.r.getPresentationStartTime=function(){return this.f?this.f.presentationTimeline.getPresentationStartTime():null};
|
|
247
|
+
_.r.getDuration=function(){return this.f?this.f.presentationTimeline.getDuration():Infinity};_.r.destroy=function(){var a=this;return _.E(function(b){if(1==b.a)return _.x(b,_.Pl.prototype.destroy.call(a),2);if(3!=b.a){if(a.B===lE)return b["return"]();a.log.debug("Destroying player...");a.B=lE;return _.x(b,nE(a),3)}a.l&&(a.l.release(),a.l=null);a.h=null;a.H&&(a.H.release(),a.H=null);_.y(b)})};
|
|
248
|
+
_.r.lg=function(){var a=this;return _.E(function(b){if(1==b.a){if(!a.re)return a.log.warn("No preloaded asset found"),b["return"]();a.log.info("Loading preloaded asset",a.re);a.re=null;return _.x(b,vE(a),2)}return _.x(b,wE(a),0)})};_.r.preload=function(a){var b=this;return _.E(function(c){if(1==c.a)return _.Jn("preload.start"),b.log.info("Preloading asset",a),_.x(c,xE(b,a,!1),2);b.re=a;b.log.info("Preloaded asset",a);_.Jn("preload.end");_.Kn("preload","preload.start","preload.end");_.y(c)})};
|
|
249
|
+
_.r.load=function(a){return xE(this,a)};_.r.detach=function(){var a=this;return _.E(function(b){return 1==b.a?_.x(b,mE(a),2):b["return"](nE(a))})};_.r.isLive=function(){var a;this.f?(a=this.f.presentationTimeline.isLive())||(a=this.f.presentationTimeline,a=Infinity!=a.h&&!a.A):a=!1;return a};_.r.xh=function(){this.log.debug("User seeking finished");this.G&&IE(this);JE(this)};_.r.getSeekRange=function(){if(this.f){var a=this.f.presentationTimeline;return{start:_.LA(a),end:JA(a)}}return{start:0,end:0}};
|
|
250
|
+
_.r.Rc=function(){return this.f?this.f.presentationTimeline.Rc():null};_.r.getPlaybackRate=function(){if(this.D){var a=this.D;a=a.l?0:a.h}else a=0;return a};
|
|
251
|
+
_.r.setPlaybackRate=function(a,b){if(0===a)this.log.warn("A trick play rate of 0 is unsupported!");else if(this.B===hE){if(_.Gj()){this.log.warn("Pausing and unpausing to mitigate playbackRate platform issue.");var c=this.getSurface().getMedia();c.pause();this.D.set(a,b);c.play()}else this.D.set(a,b);if((c=this.D.getConfiguration())&&c.preferTrickPlayTracks){c=this.a;var d=1<Math.abs(a),e=c.a.get(_.tg);if(e){var f=e.stream;if(f)if(c.g.debug("setTrickPlay",d),d)(d=f.trickModeVideo)&&!e.ac&&(c.g.debug("Engaging trick mode stream",
|
|
252
|
+
d),_.yD(c,d,!1,0),e.ac=f);else if(f=e.ac)c.g.debug("Restoring non-trick-mode stream",f),e.ac=null,_.yD(c,f,!0,0)}}this.h.playbackRateChanged(a)}};_.r.ea=function(){if(this.f&&this.w){var a=DE(this);if(null==a)a=null;else{if(!qC(this.U,a).text){var b=_.RB(a.textStreams,this.md,this.ne,this.hd);b.length&&(b=b[0],qC(this.U,a).text=b)}a=qC(this.U,a).text}b=[];for(var c=_.u(hF(this)),d=c.next();!d.done;d=c.next()){d=d.value;var e=OB(d);e.active=d==a;b.push(e)}return b}return[]};_.r.getPeriods=function(){return this.f.periods};
|
|
253
|
+
_.r.getStats=function(){if(this.B!==hE)return _.Ro();JE(this);var a=this.j;if(a.getVideoPlaybackQuality){a=a.getVideoPlaybackQuality();var b=this.I,c=Number(a.totalVideoFrames);b.l=Number(a.droppedVideoFrames);b.j=c}if(this.B===hE){if(a=TE(this))this.I.o=a.bandwidth;a&&a.video&&(b=this.I,c=a.video.height||NaN,b.w=a.video.width||NaN,b.h=c);a=this.h.getBandwidthEstimate();this.I.f=a}return this.I.getStats()};_.r.je=function(){return this.K};
|
|
254
|
+
_.r.getTimelineCues=function(){return this.K?Array.from(this.K.a.values()).map(MA):[]};_.r.resetAbr=function(){this.h&&this.h.reset()};
|
|
255
|
+
_.r.addTextTrack=function(a,b,c,d,e,f){var g=this,h,l,m,n,p,q,t,v,z;return _.E(function(D){if(1==D.a){if(g.B!==hE)throw g.log.error("Must call load() and wait for it to resolve before adding text tracks."),Error("State error!");h=DE(g);l=_.tp;m=g.f.periods.indexOf(h);n=m+1;p=n>=g.f.periods.length?g.f.presentationTimeline.getDuration():g.f.periods[n].startTime;q=p-h.startTime;if(Infinity==q)throw new _.P(1,4,4040);t=new _.Oi(1,0,q,function(){return[a]},0,null,0);v={id:g.Vh++,originalId:null,createSegmentIndex:Promise.resolve.bind(Promise),
|
|
256
|
+
findSegmentPosition:function(){return 1},getSegmentReference:function(G){return 1==G?t:null},adjustSegmentDurations:function(){},getDuration:function(){return q},segmentLookupStrategy:_.Cz,initSegmentReference:null,mimeType:d,codecs:e||"",kind:c,encrypted:!1,keyId:null,language:b,originalLanguage:b,label:f||null,type:l.TEXT,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:null,spatialAudio:!1,closedCaptions:null};g.qe.add(v);h.textStreams.push(v);return _.x(D,uD(g.a,v),
|
|
257
|
+
2)}if(z=_.nD(g.a,_.Di))qC(g.U,h).text=z;g.qe["delete"](v);g.log.debug("Choosing new streams after adding a text stream");cF(g,h);FE(g);return D["return"](OB(v))})};
|
|
258
|
+
_.r.fj=function(a){this.log.debug(_.Gz,a);try{this.log.debug("onChooseStreams_, choosing variant from ",a.variants);this.log.debug("onChooseStreams_, choosing text from ",a.textStreams);var b=fF(this,a);this.log.debug("onChooseStreams_, chose variant ",b.variant);this.log.debug("onChooseStreams_, chose text ",b.text);return b}catch(c){return this.onError(c),{variant:null,text:null}}};
|
|
259
|
+
_.r.ej=function(){this.log.debug("canSwitch_");this.da=!1;this.configuration.abr.enabled&&this.h.enable();this.qa&&(zD(this.a,this.qa,this.Nh,this.Hh),this.qa=null);this.pa&&(_.yD(this.a,this.pa,!0,0),this.pa=null)};_.r.gj=function(){this.ga&&this.ga.update()};_.r.zl=function(){this.w&&this.w.j.we()};
|
|
260
|
+
_.r.ni=function(a,b,c){if((void 0===c?"":c)===Dz)return FE(this),this.ma()||(this.configuration.abr.enabled=!0,this.h.enable()),cF(this,b,!1),!0;if(c=b.variants.some(function(g){var h=!1,l=g[a.type];l&&(h=g.allowedByApplication&&l.id!==a.id,a.type===_.$c&&(h=h&&l.language===a.language));return h})&&this.ma()){for(var d=_.u(b.variants),e=d.next();!e.done;e=d.next()){e=e.value;var f=e[a.type];f&&f.id===a.id&&(e.allowedByApplication=!1)}FE(this);this.ma()||(this.configuration.abr.enabled=!0,this.h.enable());
|
|
261
|
+
cF(this,b)}return c};_.r.ml=function(){this.log.debug("endOfStream called by streaming engine");this.nd=!0};_.r.onError=function(a){if(this.B!==lE&&7001!==a.code&&7E3!==a.code){var b=new _.L(_.pe,{detail:a});a.severity===_.Q&&kE(this,_.fp);this.trigger(b);b.defaultPrevented&&(b.a=!0)}};_.r.Xe=function(a){a.type===_.ie?this.dispatchEvent(a):"largegap"!==a.type&&(a.type===_.Cg?AE(this):"emsg"!==a.type&&(a instanceof _.L?this.dispatchEvent(a):this.log.debug(_.fc,a.type)))};_.r.ma=function(){return this.configuration.abr.enabled};
|
|
262
|
+
_.r.um=function(a){var b=this,c,d,e,f,g,h,l,m;return _.E(function(n){switch(n.a){case 1:if(!b.Ec)return n["return"]();b.log.info("Attempt to switch CDN.");c=b.getLoadedSource();d=b.ma();return _.x(n,b.Ec(c.url,a),2);case 2:e=n.f;if(!e)return n["return"]();f=_.O.oa(b.getLoadedSource(),{url:e});d&&b.h.disable();return _.x(n,GD(b.a),3);case 3:g=TE(b);case 4:return h=!1,_.A(n,7),b.log.info("Switching CDN to "+f.url+"."),_.x(n,iF(b,f,g),9);case 9:_.bh(n,6);break;case 7:return l=_.C(n),b.log.info("Switch failed"),
|
|
263
|
+
_.x(n,b.Ec(f.url,a),10);case 10:if(m=n.f)f.url=m,h=!0;else throw l;case 6:h?n.F(4):(d&&b.h.enable(),ED(b.a,!0),b.ca[b.getSourceIndex()]=f,a.f=!0,b.trigger(new _.L(_.qd,{newManifest:f.url})),_.y(n))}})};iE.prototype.detach=iE.prototype.detach;var lE=0,gE=1,hE=2,EE=[_.df,_.xe];jF.prototype.a=function(){return Az};
|
|
264
|
+
jF.prototype.canPlay=function(a,b){if(_.Mk())return 0;var c=a.type||"",d=(window.ManagedMediaSource?!0:!1)||(window.MediaSource&&MediaSource.isTypeSupported?!0:!1),e=window.ManagedMediaSource||window.MediaSource&&MediaSource.isTypeSupported?c in _.bt||_.ct(a.url)in _.dt?!0:!1:!1;if(d&&e){if(_.Gj(2))return 1;if(_.Nk()&&c===_.pl){if(b.streaming.preferNativeHlsOnSafari)return 1;_.J("Support for MSE + FairPlay on Apple is experimental. In case of issues, consider using native HLS.")}return 2}return 0};
|
|
265
|
+
jF.prototype.create=function(){return new iE};_.zh(new jF);_.Zp(function(){_.uh("MediaSource.install");if(window.MediaSource)if(window.cast&&cast.__platform__&&cast.__platform__.canDisplayType)_.th("Patching Chromecast MSE bugs."),oF();else if(_.Nk()){var a=navigator.appVersion;a=0<=a.indexOf("Version")?parseInt(a.match(/Version\/(\d+)/)[1],10):13;mF();10>=a?(_.th("Blacklisting MSE on Safari \x3c\x3d 10."),window.MediaSource=null):12>=a?(_.th("Patching Safari 11 \x26 12 MSE bugs."),kF(),lF()):(_.th("Patching Safari 13 MSE bugs."),kF())}else _.Gj(2)||_.Gj(3)||
|
|
266
|
+
_.Gj(4)?nF():_.th("Using native MSE as-is.");else _.th("No MSE implementation available.")});_.w(pF,_.du);_.r=pF.prototype;
|
|
267
|
+
_.r.append=function(a){function b(e){if(e.startTime>=e.endTime)_.J("Invalid cue times: "+e.startTime+" - "+e.endTime),e=null;else{var f=e.payload||"";f=f.replace(/<br\s*\/?>/igm,"\n");f=_.R.Pf(f);f=new VTTCue(e.startTime,e.endTime,f);f.line=-1;try{f.align=_.td}catch(g){f.align="middle"}e.writingMode===_.rg?f.vertical="lr":e.writingMode===_.sg&&(f.vertical="rl");e=f}e&&c.push(e)}var c=[],d=_.u(a);for(a=d.next();!a.done;a=d.next())b(a.value);a=c.slice().sort(function(e,f){return e.startTime!==f.startTime?
|
|
268
|
+
e.startTime-f.startTime:e.endTime!==f.endTime?e.endTime-f.startTime:c.indexOf(f)-c.indexOf(e)});d=_.u(a);for(a=d.next();!a.done;a=d.next())this.a.addCue(a.value)};_.r.remove=function(a,b){if(!this.a)return!1;qF(this.a,function(c){return c.startTime<b&&c.endTime>a});return!0};_.r.isTextVisible=function(){return this.a.mode==_.Pf};_.r.setTextVisibility=function(a){null!==this.a&&(this.a.mode=a?_.Pf:_.ue)};_.r.destroy=function(){this.a&&qF(this.a,function(){return!0});this.a=null;return Promise.resolve()};rF.prototype.isSupported=function(){return!0};rF.prototype.create=function(a){return new pF(a)};_.Io("single-native",new rF);};
|
|
278
269
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
279
270
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
280
271
|
else{_=this.clpp._;(f.call(g,this));}
|