@castlabs/prestoplay 6.14.1 → 6.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +114 -112
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +553 -538
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +74 -73
- package/cjs/cl.externs.js +193 -58
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +69 -69
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +368 -264
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -71
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +28 -28
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +20 -20
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +89 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +455 -443
- package/cl.crypto.js +9 -9
- package/cl.dash.js +70 -68
- package/cl.externs.js +189 -58
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +71 -71
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +318 -236
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/package.json +1 -1
- package/typings.d.ts +393 -57
package/cjs/cl.freewheel.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
this.f=this.a=null;this.
|
|
4
|
-
_.
|
|
5
|
-
a.a.registerVideoDisplayBase(
|
|
6
|
-
_.
|
|
7
|
-
_.
|
|
8
|
-
_.
|
|
9
|
-
_.
|
|
10
|
-
_.
|
|
11
|
-
_.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_.
|
|
16
|
-
_.
|
|
17
|
-
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.
|
|
18
|
-
_.
|
|
19
|
-
_.
|
|
20
|
-
void 0));this.l.resolve()};_.
|
|
21
|
-
_.
|
|
22
|
-
_.
|
|
23
|
-
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.
|
|
24
|
-
_.
|
|
25
|
-
|
|
2
|
+
var f=function(window){var KU="clpp-freewheel",LU="clpp.freewheel.AdsManagerFactory",MU="freewheel",NU=function(){this.f=this.a=null},OU=function(){},PU=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},QU=function(a,b,c){this.h=a;this.f=b;this.a=c},RU=function(a){this.a=a},SU=function(a){this.g=new _.K("clpp.freewheel.AdsManager");this.m=a;this.h=new _.Uh;this.w=new tv.freewheel.SDK.AdManager;
|
|
3
|
+
this.f=this.a=null;this.C=[];this.o=[];this.A=[];this.l=new _.Qj;this.j=null},TU=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.kg&&b.push("serverUrl");typeof a.profileId!==_.kg&&b.push("profileId");typeof a.videoAssetId!==_.kg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.P(1,9,12001,{missingKeys:b.join(", ")});},UU=function(){var a,b,c,d;return _.I(function(e){if(1==e.a)return a=new _.yt,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
|
|
4
|
+
_.y(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.y(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},XU=function(a){return _.I(function(b){if(a.C.length)return VU(a),a.f=a.C.shift(),a.f.play(),b.F(0);WU(a);return _.y(b,a.m.a.play(),0)})},YU=function(a){a.A.length?(VU(a),a.f=a.A.shift(),a.f.play()):WU(a)},VU=function(a){var b=a.m.yc(MU).kd();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
|
|
5
|
+
a.a.registerVideoDisplayBase(KU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},WU=function(a){var b=a.m.yc(MU).kd();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},ZU=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new QU(a.a,c,d)});a.m.trigger(new _.L(b,d))},$U=function(){this.od=new _.K(LU)};_.x(NU,_.tu);_.u=NU.prototype;
|
|
6
|
+
_.u.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Yp(_.ae,{id:KU}),this.f=_.Yp(_.r,{"class":_.zd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.P(1,9,12E3))};_.u.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.u.id=function(){return MU};_.u.kd=function(){return this.a};_.u.$k=function(){return this.f};
|
|
7
|
+
_.J("clpp.freewheel.FreeWheelPlugin",NU);NU.prototype.getAdVideo=NU.prototype.$k;NU.prototype.getAdContainer=NU.prototype.kd;NU.Id=MU;NU.AD_CONTAINER_ID=KU;OU.prototype.create=function(){return new NU};_.Zq(new OU);_.u=QU.prototype;_.u.Nb=function(){return"FreeWheel AdManager SDK"};_.u.Ob=function(){return tv.freewheel.SDK.version};_.u.Tb=function(){return 0};_.u.getId=function(){return this.a?this.a.getAdId():""};_.u.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.kg?a:""};_.u.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.u.getAdSystem=function(){return""};_.u.getAdvertiserName=function(){return""};_.u.getTitle=function(){return""};
|
|
8
|
+
_.u.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.u.getSkipTimeOffset=function(){return 0};_.u.Dc=function(){return!1};_.u.dc=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.u.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
|
|
9
|
+
_.u.Rb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.u.Qb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.u.Db=function(){return 0};_.u.qb=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
|
|
10
|
+
_.u.getPodIndex=function(){switch(this.qb()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.u.ec=function(){switch(this.qb()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.u.fc=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.u.Sb=function(){return this.f.getAdCount()};_.u.getWrapperAdIds=function(){return[]};_.u.getWrapperAdSystems=function(){return[]};
|
|
11
|
+
_.u.getWrapperCreativeIds=function(){return[]};QU.prototype.getWrapperCreativeIds=QU.prototype.getWrapperCreativeIds;QU.prototype.getWrapperAdSystems=QU.prototype.getWrapperAdSystems;QU.prototype.getWrapperAdIds=QU.prototype.getWrapperAdIds;QU.prototype.getSequenceLength=QU.prototype.Sb;QU.prototype.getPositionInSequence=QU.prototype.fc;QU.prototype.getPodTimeOffset=QU.prototype.ec;QU.prototype.getPodIndex=QU.prototype.getPodIndex;QU.prototype.getPodType=QU.prototype.qb;
|
|
12
|
+
QU.prototype.getMediaBitrate=QU.prototype.Db;QU.prototype.getMediaHeight=QU.prototype.Qb;QU.prototype.getMediaWidth=QU.prototype.Rb;QU.prototype.getMediaUrl=QU.prototype.getMediaUrl;QU.prototype.getClickThroughUrl=QU.prototype.dc;QU.prototype.isBumper=QU.prototype.Dc;QU.prototype.getSkipTimeOffset=QU.prototype.getSkipTimeOffset;QU.prototype.getDuration=QU.prototype.getDuration;QU.prototype.getTitle=QU.prototype.getTitle;QU.prototype.getAdvertiserName=QU.prototype.getAdvertiserName;
|
|
13
|
+
QU.prototype.getAdSystem=QU.prototype.getAdSystem;QU.prototype.getApiFramework=QU.prototype.getApiFramework;QU.prototype.getCreativeId=QU.prototype.getCreativeId;QU.prototype.getId=QU.prototype.getId;QU.prototype.getTechnology=QU.prototype.Tb;QU.prototype.getAdManagerVersion=QU.prototype.Ob;QU.prototype.getAdManagerName=QU.prototype.Nb;RU.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(a){switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})};RU.prototype.hc=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};RU.prototype.Fb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
14
|
+
RU.prototype.hasPostroll=RU.prototype.Fb;RU.prototype.hasPreroll=RU.prototype.hc;RU.prototype.getCuePoints=RU.prototype.getCuePoints;_.u=SU.prototype;
|
|
15
|
+
_.u.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{TU(b)}catch(n){return a.m.onError(n),a.l.resolve(),m["return"](a.l)}a.w.setNetwork(b.networkId);a.w.setServer(b.serverUrl);a.a=a.w.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.kg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.y(m,UU(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
|
|
16
|
+
_.w(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,PU(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ye&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.w(b.parameters),h=g.next();!h.done;h=
|
|
17
|
+
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.Am.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Dm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.Cm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Yl.bind(a));a.h.on(a.m,_.sg,a.Sj.bind(a));a.h.on(a.m,_.hg,a.Rj.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.u.start=function(){var a=this;return _.I(function(b){return _.y(b,XU(a),0)})};
|
|
18
|
+
_.u.resume=function(){this.f&&this.f.resume()};_.u.pause=function(){this.f&&this.f.pause()};_.u.skip=function(){this.f&&this.f.skipCurrentAd()};_.u.getVolume=function(){return this.a?this.a.getAdVolume():1};_.u.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.u.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.u.dispose=function(){var a=this;return _.I(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);WU(a);a.a&&(a.a.dispose(),a.a=null);_.C(b)})};
|
|
19
|
+
_.u.Am=function(a){var b=this;if(a.success)this.C=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.o=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.L(_.Pc,{adsTimeline:new RU(this.a)})),this.j=new _.wt(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.yc(MU).f);else this.m.onError(new _.P(1,9,10003,{errorType:0},
|
|
20
|
+
void 0));this.l.resolve()};_.u.Dm=function(a){ZU(this,_.yc,a);this.j.start()};_.u.Cm=function(a){this.f=null;a=a.slot;ZU(this,_.zc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:XU(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:WU(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:YU(this)}};
|
|
21
|
+
_.u.Yl=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:ZU(this,_.Lc,a);ZU(this,_.Ec,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:ZU(this,_.Mc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:ZU(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:ZU(this,_.Gc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:ZU(this,_.Nc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:ZU(this,_.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:ZU(this,
|
|
22
|
+
_.Bc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:ZU(this,_.Hc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:ZU(this,_.Jc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:ZU(this,_.Kc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:ZU(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:ZU(this,_.Ic,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.P(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],
|
|
23
|
+
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.u.Sj=function(){var a=this;if(!this.f){var b=this.m.getPosition();if(this.f=this.o.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.o.findIndex(function(d){return d===a.f});this.o.splice(c,1);this.m.pause();VU(this);this.f.play()}}};
|
|
24
|
+
_.u.Rj=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Bp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Ap:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.up:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);YU(this);break;case _.np:case _.yp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};SU.prototype.getPosition=SU.prototype.getPosition;SU.prototype.setVolume=SU.prototype.setVolume;
|
|
25
|
+
SU.prototype.getVolume=SU.prototype.getVolume;SU.prototype.skip=SU.prototype.skip;SU.prototype.pause=SU.prototype.pause;SU.prototype.resume=SU.prototype.resume;SU.prototype.start=SU.prototype.start;$U.prototype.name=function(){return LU};$U.prototype.isSupported=function(a,b){return a.namespace()===_.Fd?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.od.warn("FreeWheel SDK is not loaded."),!1)};$U.prototype.create=function(a){return new SU(a)};$U.prototype.create=$U.prototype.create;$U.prototype.isSupported=$U.prototype.isSupported;$U.prototype.name=$U.prototype.name;_.Vp(new $U);};
|
|
26
26
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
27
27
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
28
28
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hls.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
d[0].a)throw new _.P(_.Q,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.
|
|
4
|
-
value:b}}).filter(Boolean);return new Map(a.map(function(b){return[b.name,b.value]}))},
|
|
5
|
-
!_.Y.
|
|
6
|
-
g));e++}}a.a=
|
|
7
|
-
d=
|
|
8
|
-
9]?!0:!1},
|
|
9
|
-
unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}
|
|
10
|
-
!1),e=0,f=0;e=
|
|
11
|
-
_.
|
|
12
|
-
h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.P(_.Q,4,4030,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
b
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
endTime:
|
|
26
|
-
c.
|
|
27
|
-
t.stream.streams[0];t=Object.assign({},{
|
|
28
|
-
l.filter(function(q){return q.streams[0].type===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,
|
|
29
|
-
_.
|
|
30
|
-
null},
|
|
31
|
-
g=d.next().value;h=d.next().value;return l["return"]({
|
|
32
|
-
d,c)}))},
|
|
33
|
-
Number(_.
|
|
34
|
-
v,z,
|
|
35
|
-
z=f.AUDIO):(a.g.debug("Guessing video-only"),z=f.VIDEO):(z=f.AUDIO,a.g.debug(
|
|
36
|
-
l.value;l=_.Y.
|
|
37
|
-
allowedByKeySystem:!0};e.push(h)}return new
|
|
38
|
-
|
|
39
|
-
channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,
|
|
40
|
-
_.
|
|
41
|
-
function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,
|
|
42
|
-
e.TEXT||t||(
|
|
43
|
-
codecs:l,kind:
|
|
44
|
-
d.a)return _.
|
|
45
|
-
l,m;return _.
|
|
46
|
-
g=b.
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
null;t?(c=_.Y.
|
|
50
|
-
m,t=f.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
[];for(
|
|
54
|
-
" has raw media timestamp "+(l+" s."));a.
|
|
55
|
-
b,c,d,e){var f,g,h,l,m;return _.
|
|
56
|
-
4,4042);}e=_.
|
|
57
|
-
_.
|
|
58
|
-
var
|
|
59
|
-
}return 0},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
b,c))&&d.type
|
|
63
|
-
_.
|
|
64
|
-
b,c)})},
|
|
65
|
-
|
|
66
|
-
f){return e.concat(f)},[]).reverse()[0]||null,type:
|
|
67
|
-
_.
|
|
68
|
-
_.
|
|
69
|
-
h);
|
|
70
|
-
_.
|
|
2
|
+
var f=function(window){var TK="Could not parse MP4 segment start time.",UK="Failed to infer discontinuity number",VK="Guessing audio-only",WK="METHOD",XK="SAMPLE-AES-CTR",YK="Setting playlist start time to ",ZK="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",$K="application/vnd.apple.mpegurl",aL="sample",bL="whole-segment",cL=function(a){if(1>a.a)throw _.Km();--a.a},dL=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.P(_.Q,4,4043,"Media playlist must have at least one segment!");if(null==
|
|
3
|
+
d[0].a)throw new _.P(_.Q,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.Z=c;this.U=1===b?d:null},eL=function(a,b,c){c=void 0===c?[]:c;this.Z=b;this.a=a;this.f=c;this.ka=-1},fL=function(a){a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value,b.startsWith("#EXT-")&&(b=_.Gj(0,b),_.Iu.has(b.name)))return 1;return 0},gL=function(a){a=_.Y.cc(a,"EXT-X-DEFINE").map(function(b){var c=_.aj(b,"NAME");if(!c)return null;b=_.bj(b,"VALUE");return{name:c,
|
|
4
|
+
value:b}}).filter(Boolean);return new Map(a.map(function(b){return[b.name,b.value]}))},hL=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.P(_.Q,4,4044,"Undefined variable '"+d+"'");return e})},iL=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=hL(d.value,b)})})},jL=function(a,b,c){iL(a,c);b.forEach(function(d){iL(d.Z,c)})},kL=function(){this.f=0;this.a=new Map},nL=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&
|
|
5
|
+
!_.Y.Uh(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.P(_.Q,4,4015);return 0===fL(b)?lL(a,b,c):mL(a,b,c)},mL=function(a,b,c){for(var d=[],e=1;e<b.length;){var f=oL(a,b[e]);if(_.Ju.has(f.name))break;d.push(f);e++}b=pL(a,c,b.slice(e));e=b.U;d=d.concat(b.Z);a=qL(a,d);jL(d,e,a);return new dL(c,1,d,b.U)},lL=function(a,b,c){for(var d=[],e=1;e<b.length;e++){var f=oL(a,b[e]);d.push(f);if(f.name===_.Xa){var g=b[e+1];if(!g)throw new _.P(_.Q,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.cj(_.gc,
|
|
6
|
+
g));e++}}a.a=gL(d);jL(d,[],a.a);return new dL(c,0,d)},pL=function(a,b,c){var d=[],e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=oL(a,h),_.Iu.has(h.name)||_.Lu.has(h.name)?d.push(h):_.Ku.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Ua&&"PART"===_.aj(h,_.ec)&&g.push(h):f.push(h)):_.Y.Uh(h)||(h=_.Y.Jd(b,h.trim()),e.push(new eL(h,f,g)),f=[],g=[])});0<g.length&&e.push(new eL(null,f,g));return{U:e,Z:d}},oL=function(a,b){return _.Gj(a.f++,b)},qL=function(a,b){var c=_.Y.cc(b,"EXT-X-DEFINE"),
|
|
7
|
+
d=gL(b);c.map(function(e){return _.aj(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.P(_.Q,4,4044,"Cannot import variable '"+e+"' as it is not defined in the master playlist");d.set(e,f)});return d},rL=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},sL=function(a,b){b=void 0===b?0:b;return b+10<=a.length&&73===a[b]&&68===a[b+1]&&51===a[b+2]&&255>a[b+3]&&255>a[b+4]&&128>a[b+6]&&128>a[b+7]&&128>a[b+8]&&128>a[b+
|
|
8
|
+
9]?!0:!1},tL=function(){this.a=new Map;this.f=new Map},uL=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.P(_.Q,4,4030);}sL(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===
|
|
9
|
+
unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}sL(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},vL=function(a){for(;a.getPosition()<a.La()-1;){var b=a.getPosition();if(71===_.Lm(a))return cL(a),b}return-1},wL=function(a){function b(){d.seek(e+188);f=_.Lm(d);71!==f&&(d.seek(e+192),f=_.Lm(d));71!==f&&(d.seek(e+204),f=_.Lm(d));71!==f&&c();cL(d)}function c(){throw new _.P(_.Q,4,4030);}var d=new _.Im(new DataView(a),
|
|
10
|
+
!1),e=0,f=0;e=vL(d);0>e&&(_.wv.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.Lm(d),71!==f&&c(),a=_.Mm(d),8191===(a&8191))b();else if(a&16384)if(a=(_.Lm(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.Lm(d),d.skip(a)),1!==_.V(d)>>8)b();else{d.skip(3);a=_.Lm(d)>>6;0!==a&&1!==a||c();0===_.Lm(d)&&c();a=_.Lm(d);var g=_.Mm(d),h=_.Mm(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},xL=function(a,b){var c=null,d=0;try{(new _.Rm).K(_.Ue,_.Sm).K(_.tg,
|
|
11
|
+
_.Sm).K(_.Oe,_.Sm).Y("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.V(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.wv.error("Unable to find timescale in init segment!"),new _.P(_.Q,4,4030,TK,c);var e=0,f=!1;try{(new _.Rm).K("moof",_.Sm).K("traf",_.Sm).Y("tfdt",function(g){var h=d;if(0===g.version)h=_.V(g.reader)/h;else{var l=_.V(g.reader),m=_.V(g.reader);if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");
|
|
12
|
+
h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.P(_.Q,4,4030,TK,c);return e},AL=function(a){var b=_.bj(a,WK);if(!yL.includes(b))return zL.error("PlayReady in HLS is only supported with [",yL.join(", "),"], not",b),null;a=_.bj(a,_.gc);b=_.du(a);a=null;b=_.nj(b.data);try{a=_.hD(_.Un(b))}catch(c){a=b}return _.tD(_.Sd,[{initDataType:_.ud,initData:a}],"")},BL=function(a){this.g=new _.K("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Ij()}},
|
|
13
|
+
DL=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,t;return _.I(function(v){switch(v.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.fd||d===_.dd)return v["return"](0);g=f;if(d!==_.cd){v.F(2);break}return _.y(v,CL(a,c,g),3);case 3:return h=v.f,l=_.nj(h.data),sL(l)?v["return"](uL(l)):v["return"](wL(h.data));case 2:if(d!==_.Gg&&d!==_.gd){v.F(4);break}m=[CL(a,c,g)];b&&m.push(CL(a,b,!0));return _.y(v,Promise.all(m),5);case 5:return n=v.f,p=n[0],q=n[1]||n[0],v["return"](xL(p.data,
|
|
14
|
+
q.data));case 4:if(d!==_.Fg){v.F(6);break}return _.y(v,CL(a,c,g),7);case 7:return t=v.f,v["return"](wL(t.data));case 6:if(!_.zr((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.P(_.Q,4,4030);}})},CL=function(a,b,c){var d,e,f,g,h,l,m;return _.I(function(n){switch(n.a){case 1:return d=b.f(),e=_.WD(b.Sa(),b.Aa,b.Aa+2048-1,a.a.attemptParameters),e.type=2,f=_.WD(b.Sa(),b.Aa,b.la,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.D(n,2),g=c?f:e,_.y(n,a.f(g),4);case 4:return h=
|
|
15
|
+
n.f,n["return"](h);case 2:l=_.E(n);if(7001===l.code||c)throw l;a.g.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS pre-flights.",e.uris[0]);_.D(n,5);return _.y(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.E(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.P(_.Q,4,4030,"Failed to fetch the media segment.");}})},EL=function(a){this.streams=
|
|
16
|
+
a},FL=function(a,b){a.streams.forEach(function(c){c.xf=b})},GL=function(a,b){a.streams.forEach(function(c){c.width=b})},HL=function(a,b){a.streams.forEach(function(c){c.height=b})},IL=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},JL=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},KL=function(a,b){var c=a.streams.find(function(d){d=d.U;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.U.find(function(d){return d.position===b})||null},LL=function(a,
|
|
17
|
+
b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},ML=function(a){this.a=a},NL=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},OL=function(a,b){var c=new Set(a.map(function(d){return d.ka}));return b.filter(function(d){return!c.has(d.ka)})},RL=function(a,b){for(;a[0].ka<b[0].ka;)a.splice(0,1);var c=a[0],d=b[0];PL(c,d)||QL(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&!PL(c,d)&&QL(c,d);for(c=e+1;c<
|
|
18
|
+
b.length;)a.push(b[c]),c++},SL=function(a,b){var c=a[a.length-1],d=b.findIndex(function(f){return f.ka===c.ka}),e=b[d];PL(c,e)||QL(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},XL=function(a,b,c,d,e){var f=b[0].length();f=rL(f).map(function(g){var h=NL(b,g)||[],l=LL(c,g)||[];g=LL(d,g)||[];var m=_.ch(TL(h)).concat(_.ch(l),_.ch(g)).filter(Boolean);UL(m);var n=m[0];m=n.ka;n=n.duration;return{configurationId:a,variants:h,textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,ka:m}});e&&VL(f[0]);
|
|
19
|
+
WL(f);return f},TL=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},VL=function(a){var b=TL(a.variants)[0].U[0].za;a.startTime+=b;a.endTime+=b},WL=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},PL=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},QL=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;YL(a.variants,
|
|
20
|
+
b.variants);ZL(_.Y.df(a),_.Y.df(b))},YL=function(a,b){var c=new Map(a.map(function(d){return[_.Y.rh(d),d]}));b.forEach(function(d){c.get(_.Y.rh(d)).drmInfos=d.drmInfos})},ZL=function(a,b){var c=new Map(a.map(function(d){return[d.Vb,d]}));b.forEach(function(d){var e=c.get(d.Vb);e.U=d.U;e.segmentIndex.replace(d.U);e.jc=d.jc;e.Se=d.Se;e.duration=d.duration;e.vh=d.vh;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},UL=function(a){var b=$L(a);a.forEach(function(c){_.QD(c.segmentIndex,b);
|
|
21
|
+
c.duration=b;c.Se=c.jc+b})},$L=function(a){var b=Infinity;_.Y.Qk(a).forEach(function(c){b=Math.min(b,c.duration)});return b},aM=function(){var a=this;this.a=this.B=null;this.P=1;this.f=new tL;this.w="";this.L=new kL;this.D=0;this.j=null;this.h=new _.Zk(function(){a.tb()});this.l=_.nc;this.o=null;this.A=new _.Uj;this.C=null;this.g=new _.K("clpp.hls.HlsParser");this.H=new Map;this.M=new BL(this.Df.bind(this));this.J=!1;this.G=null;this.I=!1},bM=function(a){if(null===a.j)return[];a=a.j;return[a.audio,
|
|
22
|
+
a.video].filter(function(b){return b}).map(function(b){return b.Vb})},hM=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,B,F,G,A;return _.I(function(H){if(1==H.a){c=_.Mp;d=_.Y;e=cM(a,b,a.w,"");if(1===e.type){f=e.U[0].a;var M=_.Xi(f)||"";g=null!=_.Yi.video[M]?_.r:null!=_.Yi.audio[M]?_.bd:null;h="";g===c.VIDEO?h="avc1.42E01E":g===c.AUDIO&&(h="mp4a.40.2");M=a.L;var N=a.w,W=a.a.hlsDefaultCodecs||h,pa=[],Ca=[];Ca.push(new _.cj(_.oa,"0"));Ca.push(new _.cj(_.gc,N));W.length&&Ca.push(new _.cj(_.ta,W));pa.push(new _.$i(M.f++,
|
|
23
|
+
_.Xa,Ca));e=new dL(N,0,pa)}l=_.Y.Om(e.Z);return _.y(H,dM(a,l),2)}m=H.f;n=m.periods;p=m.Ci;q=m.Ni;if(!a.B)throw new _.P(_.Q,7,7001);t=d.kl(n[0]);eM(a,n);M=!0;N=null;W=0;fM(a)||(M=!1,N=0,W=t.delay);N=new _.ZD(a.a.timeline||{},N,W,!0,void 0,!!a.a.lowLatencyMode);_.bE(N,M);gM(N,n);p&&_.aE(N,p);v=N;if(!fM(a)){a.D=t.Lc;W=0;N=_.w(a.f.values());for(M=N.next();!M.done;M=N.next())W=Math.max(W,M.value.streams[0].jc);for(N=0;95443.7176888889<=W;)N+=95443.7176888889,W-=95443.7176888889;if(N)for(a.g.debug("Offsetting live streams by",
|
|
24
|
+
N,"to compensate for rollover"),W=_.w(a.f.values()),M=W.next();!M.done;M=W.next())M=M.value.streams[0],95443.7176888889>M.jc?(a.g.debug("Offset applied to",M.type),M.segmentIndex.offset(N)):a.g.debug("Offset NOT applied to",M.type)}M=_.Y.ll(n);"LIVE"===a.l||"EVENT"===a.l?(M=Math.max(M,v.I),isNaN(a.a.availabilityWindowOverride)||(M=a.a.availabilityWindowOverride),v.A=M):a.l===_.nc&&(v.h=M);if(q)for(z=_.w(q),B=z.next();!B.done;B=z.next())F=B.value,G={configurationId:a.B.configurationId,schemeIdUri:F.schemeIdUri,
|
|
25
|
+
jb:F.jb,value:"",startTime:F.startTime,endTime:F.endTime,id:F.id,type:_.bi,eventElement:null},a.B.onTimelineCueAdded(G);A={presentationTimeline:v,adaptedPeriods:_.ch(n).concat(),periods:n,minBufferTime:0};a.g.debug("HLS playlist parsed",A);return H["return"](A)})},kM=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.Y,_.y(p,iM(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;g=d.kj;h=a.o.periods[0].variants;a.a.lowLatencyMode&&null!==a.j&&(h=h.filter(function(q){return q.id===
|
|
26
|
+
a.j.id}));l=h.map(function(q){var t=c.Ah(q.audio,g),v=c.Ah(q.video,g);q=jM(a,t,v,q.bandwidth);if(!q)throw new _.P(_.Q,4,4047,{message:"Video and audio are encrypted in an incompatible way.",no:v?v.gc():void 0,audio:t?t.gc():void 0});return q});m=a.B.configurationId;n=XL(m,l,e,f,!0);return p["return"](n)})},iM=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.Mp,d=function(q){return q.stream.streams[0].type===c.VIDEO||q.stream.streams[0].type===c.AUDIO},e=b.filter(d),
|
|
27
|
+
f=b.filter(function(q){return!d(q)}),g=function(q){q=q.map(function(t){var v=t.stream.streams[0];t=Object.assign({},{playlist:t.playlist},{language:v.language,channelsCount:v.channelsCount,spatialAudio:v.spatialAudio,closedCaptions:v.closedCaptions,primary:v.primary,kind:v.kind||null,groupId:v.groupId,type:v.type,codecs:v.codecs,name:v.originalId,uri:v.Vb,jf:{width:v.width,height:v.height,frameRate:v.frameRate}});return lM(a,t)});return Promise.all(q)},_.y(p,g(e),2);if(3!=p.a)return h=p.f,_.y(p,g(f),
|
|
28
|
+
3);l=p.f;mM(a,h.concat(l));m=l.filter(function(q){return q.streams[0].type===c.dj});n=l.filter(function(q){return q.streams[0].type===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,kj:h})})},mM=function(a,b){b.forEach(function(c){a.f.a.set(c.gc(),c)})},dM=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t;return _.I(function(v){switch(v.a){case 1:return c=_.Y.Im(b.pd.closedCaptions),d=nM(a,b.re),_.y(v,oM(a,b),2);case 2:return e=v.f,f=Object.values(e).flat().map(function(z){return z.playlist}),
|
|
29
|
+
pM(a,f),_.y(v,qM(a,e.Og,d),3);case 3:return g=v.f,_.y(v,rM(a,e.re,g,c),4);case 4:return h=v.f,_.y(v,sM(a,e.rn,d),5);case 5:return l=v.f,_.y(v,tM(a,e.Sf),6);case 6:return m=v.f,n=uM(a,e),p=a.B.configurationId,q=XL(p,h,l,m,!fM(a)),a.B.filterAllPeriods(q),fM(a)?(t=null,n&&(t=vM(f,n)),v["return"]({periods:q,Ci:n,Ni:t})):v["return"]({periods:q,Ci:n,Ni:null})}})},eM=function(a,b){fM(a)||2!==a.a.timeline.version||(a.G||(a.G=b[0].startTime),_.YF(b,-a.G))},vM=function(a,b){var c=a.find(function(d){return null!==
|
|
30
|
+
_.Y.$a(d.Z,_.Ka)});return c?c.Z.filter(function(d){return d.name===_.Ka}).map(function(d){return _.Y.Jm(d,b)}).filter(Boolean):null},uM=function(a,b){var c=_.ch(b.re).concat(_.ch(b.Og)).map(function(e){return e.playlist}).flatMap(function(e){return e.U[0].Z});c=_.Y.$a(c,_.Va);if(!c)return null;var d=(new Date(c.value)).getTime();return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+(c.value+").")),null):d/1E3},oM=function(a,b){var c,d,e,f,g,h;return _.I(function(l){if(1==
|
|
31
|
+
l.a)return _.y(l,Promise.all([wM(a,b.pd.jj),wM(a,b.pd.sn),wM(a,b.re),wM(a,b.Sf)]),2);c=l.f;d=_.w(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({Og:e,rn:f,re:g,Sf:h})})},yM=function(a,b){return Promise.all(b.map(function(c){return xM(a,c)}))},nM=function(a,b){for(var c=new Map,d=_.w(b),e=d.next();!e.done;e=d.next()){var f=e.value,g=_.aj(f,"AUDIO");e=_.aj(f,_.mc);var h=_.aj(f,_.Wb);f=zM(a,f);if(h){var l=_.Wi(_.R,f);c.set(h,l);h=f.indexOf(l);-1<h&&f.splice(h,
|
|
32
|
+
1)}g&&(h=AM(_.bd,f),c.set(g,h));e&&(g=AM(_.r,f),c.set(e,g))}return c},sM=function(a,b,c){return Promise.all(b.map(function(d){return BM(a,d,c)}))},tM=function(a,b){return Promise.all(b.map(function(c){return CM(a,c)}))},qM=function(a,b,c){var d,e;return _.I(function(f){if(1==f.a){if(0===b.length)return f["return"](new Map);d=[BM(a,b[0],c)];return _.y(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return BM(a,g,c)})),_.y(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.un(e))})},
|
|
33
|
+
rM=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v;return _.I(function(z){if(1==z.a){e=new Set;f=_.ch(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.bj(f[l].tag,_.oa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.y(z,DM(a,n,c,d,e),2)}if(3!=z.a)return p=z.f,q=f.map(function(B){return DM(a,B,c,d,e)}),_.y(z,Promise.all(q),3);t=z.f;t.splice(g,0,p);v=t.reduce(_.Di,[]);return z["return"](v)})},DM=function(a,b,c,d,e){var f,g,h,l,m,n;return _.I(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.bj(h,
|
|
34
|
+
_.oa)),m=f.Sm(h),_.y(p,EM(a,b,m,c,d),2)):(n=p.f)?p["return"](FM(a,n,l,e)):p["return"]([])})},EM=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,v,z,B,F,G,A,H,M;return _.I(function(N){if(1==N.a)return f=_.Mp,g=b,h=g.tag,l=g.playlist,m=zM(a,h),n=_.aj(h,"AUDIO"),p=_.aj(h,_.mc),t=(q=n||p)&&d.has(q)?d.get(q):[],v={audio:n?t:[],video:p?t:[]},a.g.debug("Guessing stream type for",h.toString()),B=!1,F=l.a,G=v.audio.find(function(W){return W.Vb===F}),A=_.Wi(f.VIDEO,m),H=c||A,1!==m.length||H?!t.length&&1<m.length?
|
|
35
|
+
(a.g.debug("Guessing multiplexed audio+video"),z=f.VIDEO,m=[m.join(",")]):v.audio.length&&G?(a.g.debug(VK),z=f.AUDIO,B=!0):v.video.length?(a.g.debug(VK),z=f.AUDIO):(a.g.debug("Guessing video-only"),z=f.VIDEO):(z=f.AUDIO,a.g.debug(VK)),M=null,B?N.F(2):_.y(N,GM(a,b,m,z,e,c),3);2!=N.a&&(M=N.f);if(null==M)return N["return"](null);v[z]=[M];z===f.AUDIO&&c&&t.forEach(function(W){GL(W,c.width);HL(W,c.height);IL(W,c.frameRate)});_.Y.Mk(v);return N["return"](v)})},FM=function(a,b,c,d){var e=b.video,f=b.audio;
|
|
36
|
+
e=0<e.length?e:[null];b=[];f=_.w(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.w(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.Ik(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=jM(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},jM=function(a,b,c,d){for(var e=[],f=(c||b).length(),g=0;g<f;g++){var h=b?b.streams[g]||null:null,l=c?c.streams[g]||null:null,m=_.Y.dl(h,
|
|
37
|
+
l);if(!m)return null;var n=d;h={id:a.P++,language:h?h.language:_.vg,primary:!!h&&h.primary||!!l&&l.primary,audio:h,video:l,bandwidth:n,drmInfos:m,allowedByApplication:!0,allowedByKeySystem:!0};e.push(h)}return new ML(e)},BM=function(a,b,c){var d,e,f,g;return _.I(function(h){d=b;e=d.tag;f=d.playlist;g=f.a;return h["return"](HM(a,g,function(){var l,m,n,p,q,t,v,z,B,F,G,A,H,M;return _.I(function(N){if(1==N.a){l=_.Mp;m=_.bj(e,_.eb);n=_.Y.ph(_.bj(e,_.ec));p=_.Y.Ek(e);q=c.get(m)||"";t=_.aj(e,_.ub);v=_.aj(e,
|
|
38
|
+
"NAME");z=e.getAttribute("DEFAULT");B=e.getAttribute("AUTOSELECT");F=_.aj(e,"CHANNELS");G=n===l.AUDIO?F?parseInt(F.split("/")[0],10):null:null;var W=n===l.AUDIO?(W=_.aj(e,"CHANNELS"))?W.includes("/JOC"):!1:!1;A=W;H=!!z&&!!B;return _.y(N,lM(a,{playlist:f,codecs:q,type:n,be:t,primary:H,name:v,channelsCount:G,spatialAudio:A,groupId:m,kind:p,closedCaptions:null,jf:null}),2)}M=N.f;return N["return"](M)})}))})},CM=function(a,b){var c,d,e,f;return _.I(function(g){c=b;d=c.tag;e=c.playlist;f=e.a;return g["return"](HM(a,
|
|
39
|
+
f,function(){var h,l,m,n,p;return _.I(function(q){if(1==q.a)return h=_.aj(d,_.ta)||"jpg",l=_.aj(d,_.ub),m=_.aj(d,"NAME"),_.y(q,lM(a,{playlist:e,codecs:h,type:_.ze,be:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,jf:null}),2);n=q.f;(p=_.aj(d,_.oa))&&JL(n,Number(p));return q["return"](n)})}))})},zM=function(a,b){var c=_.aj(b,_.ta,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/),d=new Set,e=[];c=_.w(c);for(var f=c.next();!f.done;f=c.next()){f=
|
|
40
|
+
f.value;var g=_.CD(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},GM=function(a,b,c,d,e,f){var g,h,l,m,n;return _.I(function(p){g=b;h=g.tag;l=g.playlist;m=_.Mp;n=l.a;return p["return"](HM(a,n,function(){var q,t,v,z;return _.I(function(B){if(1==B.a)return q=_.aj(h,_.sa),t=null,d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q)),v=AM(d,c),_.y(B,lM(a,{playlist:l,codecs:v,type:d,closedCaptions:t,primary:!1,kind:null,be:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,
|
|
41
|
+
jf:f}),2);z=B.f;return B["return"](z)})}))})},HM=function(a,b,c){if(a.f.has(b))return a=a.f.get(b),Promise.resolve(a);if(a.f.f.has(b))return a.f.f.get(b)||null;c=c();a.f.set(b,c);return c},lM=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,B,F,G,A,H,M,N,W,pa,Ca,$a,ab;return _.I(function(Qa){if(1==Qa.a){c=IM;d=JM;e=_.Mp;f=_.Y;g=b;h=g.playlist;l=g.codecs;m=g.type;n=g.be;p=g.groupId;q=g.primary;t=g.kind;v=g.name;z=g.channelsCount;B=g.spatialAudio;F=g.closedCaptions;G=g.jf;A=_.Y.Ih(n);if(1!==h.type)throw new _.P(_.Q,
|
|
42
|
+
4,4017);H=_.Y.Qm(h.Z,null==a.o);a.l=H;M=_.Y.Nm(h.Z,H,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay);return _.y(Qa,KM(a,h,m,l),2)}N=Qa.f;W=a.a.lowLatencyMode?d.Yi:d.$i;pa=t;m!==e.TEXT||t||(pa=_.ng);Ca=f.yi(h.Z);$a=Ca.Ce;ab=N.map(function(Da){var fb=Da.U,qc=Da.Ok,Kg=Da.mimeType;Da=Da.ka;var Lg=fb[0].startTime,Bn=fb[fb.length-1].endTime,gu=Bn-Lg,ed=new _.vE(fb),Cn=fb[0].initSegment||null;return{id:_.SK++,originalId:v,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:ed.dd.bind(ed),
|
|
43
|
+
getSegmentReference:ed.get.bind(ed),adjustSegmentDurations:ed.Cd.bind(ed),getDuration:ed.getDuration.bind(ed),segmentIndex:ed,segmentLookupStrategy:W,initSegmentReference:Cn,mimeType:Kg,codecs:l,kind:pa,vh:qc.type,encrypted:qc.type===c.cj,keyId:qc.keyId,language:A,originalLanguage:n||_.vg,label:v,type:m,primary:q,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:G?G.frameRate:void 0,width:G?G.width:void 0,height:G?G.height:void 0,bandwidth:void 0,roles:[],channelsCount:z,spatialAudio:B,closedCaptions:F,
|
|
44
|
+
keyInfo:qc.keyInfo,U:fb,drmInfos:qc.drmInfos,ka:Da,Vb:h.a,xf:h.f,jc:Lg,Se:Bn,duration:gu,Ce:$a,groupId:p,Ml:M}});return Qa["return"](new EL(ab))})},wM=function(a,b){var c;return _.I(function(d){if(1==d.a)return _.y(d,Promise.all(b.map(function(e){var f;return _.I(function(g){if(1==g.a)return _.y(g,LM(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},LM=function(a,b){var c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){c=_.Y.Jl(b);d=_.aj(b,
|
|
45
|
+
_.gc,void 0,{required:c});if(!d)return m["return"](null);e=_.Y.Jd(a.w,d);return _.y(m,MM(a,e),2)}f=m.f;g=f.response;h=f.text;l=g.uri;return m["return"](cM(a,h,l,d))})},xM=function(a,b){var c,d,e,f,g,h,l,m;return _.I(function(n){if(1==n.a){var p=new _.Hi(b.streams[0].xf);if(a.a.lowLatencyMode&&b.streams[0].Ce){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var t=q.a,v=t.length-1;q={Rl:q.position,Tm:t&&0<t.length?v:null}}else q=null;if(t=q)q=t.Rl,t=t.Tm,v=_.vk(p.a.toString()),
|
|
46
|
+
v._HLS_msn=q.toString(),null===t&&v._HLS_part&&delete v._HLS_part,null!==t&&(v._HLS_part=t.toString()),q=_.uk(v,!0),_.Ki(p,new _.Oi(q))}c=p.toString();return _.y(n,MM(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.gc();h=b.streams[0].xf;l=e.uri;h!==l&&(h=l,FL(b,h));m=cM(a,f,h,g);return n["return"]({stream:b,playlist:m})})},cM=function(a,b,c,d){a=nL(a.L,b,c);a.a=d;NM(a);return a},NM=function(a){1===a.type&&a.U.forEach(function(b,c){if(_.Y.ic(b.Z,_.Pa)&&!_.Y.ic(b.Z,_.La)&&0<c)throw new _.P(_.Q,4,4046,"Media playlist contains an EXT-X-MAP tag not accompanied by an EXT-X-DISCONTINUITY tag.");
|
|
47
|
+
})},OM=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.P(_.Q,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},PM=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.aj(c,_.gc)})||null}).map(function(b){return _.Xi(b)});if(1<(new Set(a)).size)throw new _.P(_.Q,4,4044,"Unexpected change in file format.");},QM=function(a,b,c){a=_.Y.cc(a.Z,_.Pa);if(1<a.length)throw new _.P(_.Q,
|
|
48
|
+
4,4020);a=a[0];if(!a)return null;var d=_.bj(a,_.gc),e=_.Y.Jd(b,d);b=_.Y.wi(a,null,!0);return new _.uD(function(){return[e]},b.Aa,b.la,c)},RM=function(a,b,c,d,e,f,g){var h=[],l={};b=_.w(_.RK(b.f));for(var m=b.next();!m.done;l={kf:l.kf},m=b.next()){var n=m.value;m=n.Ph;n=n.item;var p=0===m,q=p?a:h[h.length-1],t=p?d:q.endTime,v=Number(_.aj(n,_.Ga));v=t+v;p=_.Y.wi(n,p?null:q.la,p);q=_.aj(n,_.gc);q=_.Y.Jd(g,q);l.kf=q?[q]:[];t=new _.ej(c,t,v,function(z){return function(){return z.kf}}(l),p.Aa,p.la,e,f,
|
|
49
|
+
!1,null,null,null,null);if("YES"===_.aj(n,"INDEPENDENT")||0===m)t.h=!0;h.push(t)}return h},SM=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.Z,q=c.a,t=null!=q,v=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={Aa:0,la:null};var z=null;t?(c=_.Y.Lm(p).duration,a=e+c,q=_.Y.xi(p,b?b.la:null)):(b=RM(b,c,d,e,f,g,l),a=b[b.length-1].endTime,z=b);h=h===_.ze?_.Y.Rm(p):null;d=new _.ej(d,e,a,function(){return v},q.Aa,q.la,f,g,!1,null,h?h.Td:null,h?h.qe:null,h?h.durationPerTile:null,z);d.ka=m;d.initSegment=n||
|
|
50
|
+
void 0;return d},KM=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v,z,B,F;return _.I(function(G){switch(G.a){case 1:return e=_.Y,f=TM,g=UM,h=b.a,l=b.U,m=e.hl(b.Z,_.Ra),n=[],!fM(a)&&g.ij(l),_.y(G,VM(a,b.f,h,l,m,c,d),2);case 2:p=G.f,q=m,t=f.pn(l),v=0;case 3:if(!(v<t.length)){G.F(5);break}z=t[v];B=n[n.length-1]||null;return _.y(G,WM(a,b.f,z,q,p,c,d,B,t.length),6);case 6:F=G.f;n.push(F);q+=z.length;v++;G.F(3);break;case 5:return OM(n),G["return"](n)}})},VM=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,v,z,B,
|
|
51
|
+
F,G;return _.I(function(A){if(1==A.a){h=d[0];if(null!=a.C)return A["return"](a.C);if(!fM(a)&&a.o)try{var H=a.f.get(c),M=H?KL(H,e)||null:null;if(!M)throw new _.P(_.Q,4,4030,"Segment not found in pervious playlist update.");l=M.startTime+M.za;a.g.debug(YK+l+".");a.C=l;return A["return"](l)}catch(N){if(m=a.f.get(c))n=m.streams[0].U[0].position,A=m.streams[m.streams.length-1].U,p=A[A.length-1].position,q=e,t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+_.aa+p+(", new values "+q+_.aa+t+
|
|
52
|
+
"."),b,m);throw new _.P(_.Q,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.y(A,XM(a,f,g,h),2)}if(3!=A.a)return v=A.f,z=UM.Pm(h,a.w,v),B=QM(h,b,z.keyInfo),F=_.Y.Nf(z.keyInfo,e),_.y(A,YM(a,B,h,F,v,g),3);G=A.f;a.g.debug(YK+G+".");a.C=G;return A["return"](G)})},WM=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,t,v,z,B,F,G,A,H,M,N,W,pa,Ca,$a,ab,Qa,Da;return _.I(function(fb){switch(fb.a){case 1:return m=_.Y,n=UM,p=c[0],q=null==h,PM(c),_.y(fb,XM(a,f,
|
|
53
|
+
g,p),2);case 2:t=fb.f;v=n.Km(c,a.w,t,h?h.Ll:null,1===l);z=v[v.length-1];B=UM.ra(v);F=QM(p,b,B.keyInfo)||(h?h.Bl:null);G=_.Y.Nf(B.keyInfo,d);A=p.ka;if(q){H=e;fb.F(3);break}return _.y(fb,ZM(a,A,F,p,d,G,t,g),4);case 4:H=fb.f;case 3:M=H;N=[];for(W=0;W<c.length;W++)pa=c[W],Ca=N[N.length-1]||null,$a=0===W?0:Ca.endTime,ab=d+W,Qa=m.Nf(B.keyInfo,ab),(Da=SM(a,Ca,pa,ab,$a,M,Qa,f,b,A,F))&&N.push(Da);return fb["return"]({U:N,Ok:B,Ll:z,mimeType:t,endTime:N[N.length-1].endTime,ka:A,Bl:F})}})},pM=function(a,b){b.forEach(function(c){var d=
|
|
54
|
+
a.f.get(c.a);TM.nj(c,d,!fM(a))});TM.Jk(b)},ZM=function(a,b,c,d,e,f,g,h){var l;return _.I(function(m){if(1==m.a)return a.H.has(b)?m["return"](a.H.get(b)):_.y(m,YM(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.H.set(b,l);return m["return"](l)})},YM=function(a,b,c,d,e,f){var g;return _.I(function(h){if(null==c.a)return h["return"](0);g=_.Y.Hk(c,d);return h["return"](DL(a.M,b,g,e,f,null!=d))})},AM=function(a,b){if(1===b.length)return b[0];var c=_.Wi(a,b);if(null!=
|
|
55
|
+
c)return c;throw new _.P(_.Q,4,4025,{codecList:b});},XM=function(a,b,c,d){var e,f,g;return _.I(function(h){e=d.a;g=(f=_.Y.$a(d.Z,_.Pa))?_.bj(f,_.gc):null;return h["return"]($M(a,b,c,e,g))})},$M=function(a,b,c,d,e){var f,g,h,l,m;return _.I(function(n){if(1==n.a){f=[d,e].filter(Boolean);if(g=_.Zi(f,b,c))return n["return"](g);h=_.Lj([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.y(n,a.Df(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.P(_.Q,4,4021,"Unknown MIME type of: "+f.join(", "));
|
|
56
|
+
return n["return"](m.split(";")[0])})},MM=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Lj([b],a.a.attemptParameters),c.type=1,_.y(f,a.Df(c),2);d=f.f;e="";try{e=_.S.ea(d.data)}catch(g){throw new _.P(_.Q,4,4042);}e=_.S.ci(e);e=e.trim();return f["return"]({text:e,response:d})})},fM=function(a){return a.l===_.nc},gM=function(a,b){_.Y.$h(b,function(c,d){_.fE(a,c.U,d.startTime)});_.YD(a.a,b[0].startTime,b[b.length-1].endTime)},aN=function(){},JM={Yi:_.nC,$i:_.hC},IM={cj:aL,Nn:bL,
|
|
57
|
+
NONE:_.Xe};_.u=tL.prototype;_.u.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};_.u.has=function(a){return this.a.has(a)};_.u.get=function(a){return this.a.get(a)||null};_.u.values=function(){return Array.from(this.a.values())};_.u.clear=function(){this.f.clear();this.a.clear()};
|
|
58
|
+
var TM={Jk:function(a){var b=TM.Xk(a),c=TM.Kl(a);a.forEach(function(d){var e=d.U,f=e.findIndex(function(h){return h.ka===b}),g=e.findIndex(function(h){return h.ka===c+1});-1===g&&(g=e.length);d.U=e.slice(f,g)})},nj:function(a,b,c){b=TM.gl(a,b,c);a=_.w(a.U||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.ic(c.Z,_.La)&&b++,c.ka=b},gl:function(a,b,c){var d=_.Y.$a(a.Z,_.Ma);if(d)return Number(d.value);d=TM.Dl(b);if(c&&d)try{return TM.Al(a,b)}catch(e){throw new _.P(_.Q,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");
|
|
59
|
+
}return 0},Dl:function(a){return 0<TM.jl(a)},pn:function(a){if(0===a.length)return[];var b=[],c=[];a=_.w(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.ic(d.Z,_.La)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},jl:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].U;return a[a.length-1].ka},Al:function(a,b){var c=_.Y.$a(a.Z,_.Ra);if(!c)throw TM.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(UK);c=Number(c.value);var d=
|
|
60
|
+
KL(b,c);if(!d)throw TM.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(UK);return d.ka},Kl:function(a){a=a.map(function(b){return b.U[b.U.length-1].ka});return Math.min.apply(Math,_.ch(a))},Xk:function(a){a=a.map(function(b){return b.U[0].ka});return Math.max.apply(Math,_.ch(a))}};TM.g=new _.K("clpp.hls.DiscontinuityUtils");var bN={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Fg)throw new _.P(_.Q,4,4041);if(_.bj(a,WK)===XK)throw new _.P(_.Q,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.tD(_.Qd,[{initDataType:_.dg,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":AL,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":AL,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.bj(a,WK);if(!yL.includes(b))return zL.error("Widevine in HLS is only supported with [",
|
|
61
|
+
yL.join(", "),"], not",b),null;b=_.bj(a,_.gc);b=_.du(b);b=_.nj(b.data);b=_.tD(_.Ud,[{initDataType:_.ud,initData:b}],"");if(a=_.aj(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},yL=["SAMPLE-AES",XK],zL=new _.K("clpp.hls.DrmParser");var UM={Pm:function(a,b,c){return UM.jg(a.Z,b,c)||{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null}},Km:function(a,b,c,d,e){if(a.slice(1).some(UM.Nh))throw new _.P(_.Q,4,4046,e?"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not at the beginning of the playlist.":"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not marked by an EXT-X-DISCONTINUITY tag and is not at the beginning of the playlist.");if(_.Y.ic(a[0].Z,_.Oa)||null===d){if((d=UM.jg(a[0].Z,
|
|
62
|
+
b,c))&&d.type===bL){if(1<UM.qh(a))throw new _.P(_.Q,4,4046,ZK+((e?"playlist":"discontinuity")+"."));return[d]}a=UM.si(a,b,c);return 0===a.length?[{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null}]:a}b=UM.si(a,b,c);if(d.type===_.Xe||d.type===aL)return[d].concat(_.ch(b));if(0<UM.qh(a))throw new _.P(_.Q,4,4046,ZK+((e?"playlist":"discontinuity")+"."));return[d]},ra:function(a){if(0===a.length)return{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null};if(a.some(function(c){return c.type===bL})||a.every(function(c){return c.type===
|
|
63
|
+
_.Xe}))return a[0];a=a.filter(function(c){return c.type===aL});var b=_.ni(a.flatMap(function(c){return c.drmInfos}));return{keyInfo:null,keyId:a[a.length-1].keyId,type:aL,drmInfos:b}},ij:function(a){a=UM.zh(a);if(a.some(function(b){return UM.Nh(b)})&&1<a.length)throw new _.P(_.Q,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},Nh:function(a){return _.Y.cc(a.Z,_.Oa).some(function(b){return"AES-128"===_.aj(b,WK)})},si:function(a,b,c){return UM.zh(a).map(function(d){return UM.jg(d.Z,
|
|
64
|
+
b,c)})},qh:function(a){return a.filter(function(b){return _.Y.ic(b.Z,_.Oa)}).length},zh:function(a){return a.filter(function(b){return _.Y.ic(b.Z,_.Oa)})},jg:function(a,b,c){a=_.Y.cc(a,_.Oa);if(0===a.length)return null;var d=_.bj(a[0],WK);if(1===a.length){if("NONE"===d)return{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null};if("AES-128"===d)return a=a[0],d=_.aj(a,"IV",""),{type:bL,keyInfo:{method:"AES-128",url:_.Y.Jd(b,_.bj(a,_.gc)),iv:d?_.Aj((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(function(e){return _.bj(e,
|
|
65
|
+
WK)});if(!b.every(function(e){return"SAMPLE-AES"===e})&&!b.every(function(e){return e===XK}))throw UM.g.warn("EXT-X-KEY methods "+b.join(", ")+" are incompatible."),new _.P(_.Q,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(function(e){var f=_.aj(e,"KEYFORMAT","identity"),g=bN[f]||null;(e=g?g(e,c):null)||UM.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.P(_.Q,4,4026);return{keyInfo:null,keyId:b.map(function(e){return e.keyIds}).reduce(function(e,
|
|
66
|
+
f){return e.concat(f)},[]).reverse()[0]||null,type:aL,drmInfos:b}},ho:function(){return{type:_.Xe,keyInfo:null,drmInfos:[],keyId:null}}};UM.g=new _.K("clpp.hls.EncryptionUtils");_.u=EL.prototype;_.u.length=function(){return this.streams.length};_.u.il=function(){return this.streams[0].groupId};_.u.cl=function(){return this.streams[0].codecs.split(",")};_.u.gc=function(){return this.streams[0].Vb};_.u.gn=function(a){this.streams.forEach(function(b){b.codecs=a.join(",")})};ML.prototype.length=function(){return this.a.length};_.u=aM.prototype;_.u.configure=function(a){this.a=a;this.M.a=a};_.u.setCurrentVariant=function(a){this.j=a};_.u.start=function(a,b){var c=this,d,e,f,g,h;return _.I(function(l){if(1==l.a){if(c.J)throw Error("start() may be called only once!");c.J=!0;c.B=b;return _.y(l,MM(c,a),2)}if(3!=l.a)return d=l.f,e=d.response,f=d.text,c.w=e.uri,_.y(l,hM(c,f),3);g=l.f;c.o=g;h=c.D;c.h&&0<h&&c.h.fa(h);return l["return"](g)})};_.u.requestStop=function(){this.I=!0};
|
|
67
|
+
_.u.stop=function(){this.h&&(this.h.stop(),this.h=null);var a=[];this.A&&(a.push(this.A.destroy()),this.A=null);this.f.clear();this.o=this.a=this.B=this.j=null;return Promise.all(a)};
|
|
68
|
+
_.u.update=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.o;if(fM(a)||!b)return m["return"]();c=b.presentationTimeline;"LIVE"===a.l&&(a.C=null);d=Array.from(a.f.values());a.a.lowLatencyMode&&null!==a.j&&(e=bM(a),d=d.filter(function(n){return e.includes(n.gc())}));return _.y(m,yM(a,d),2)}if(3!=m.a)return f=m.f,g=f.map(function(n){return n.playlist}),pM(a,g),_.y(m,kM(a,f),3);h=m.f;OL(b.periods,h).forEach(function(n){a.B.filterNewPeriod(n)});eM(a,h);RL(b.periods,h);SL(b.adaptedPeriods,
|
|
69
|
+
h);gM(c,h);if(l=_.Y.yl(g))!0!==a.a.keepTimelineLive&&(a.l=_.nc,_.bE(c,!0),c.h=h[h.length-1].endTime),a.h.stop(),a.h=null;if(a.B.onUpdate)a.B.onUpdate(b);if(l&&a.B.onTurnedStatic)a.B.onTurnedStatic();return a.I?_.y(m,a.stop(),0):m.F(0)})};
|
|
70
|
+
_.u.tb=function(){var a=this,b,c;return _.I(function(d){if(1==d.a){a.g.debug(_.sB);if(!a.B)return d["return"]();_.D(d,2);return _.y(d,a.update(),4)}if(2!=d.a)return a.h&&0<a.D&&a.h.fa(a.D),_.qh(d,0);b=_.E(d);if(!(b instanceof _.P))throw b;a.B&&(a.B.onError(b),c=b,1===c.severity&&a.h&&a.h.fa(.1));_.C(d)})};_.u.Df=function(a){if(!this.A)throw new _.P(_.Q,7,7001);a=this.B.networkingEngine.fetch(a);_.Vj(this.A,a);return a.N};_.x(aN,_.Gs);aN.prototype.f=function(){_.Ft.m3u8=aM;_.Dt[_.Il]=aM;_.Dt[$K]=aM};aN.prototype.a=function(){_.ZE("m3u8");_.$E(_.Il);_.$E($K)};aN.prototype.id=function(){return"hls"};_.J("clpp.hls.HlsComponent",aN);};
|
|
71
71
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
72
72
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
73
73
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hlssmpte.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
c.mode=_.
|
|
6
|
-
a.m.getTrackManager().
|
|
7
|
-
_.
|
|
2
|
+
var f=function(window){var zU=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.O.S(a)){a:{var b=a.info;if(_.O.ga(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.O.ga(a)?a:null}},BU=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Uh;this.h=(a=_.hu(_.Zc))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;AU(this)},AU=function(a){a.a.one(a.m,_.Je,function(){return CU(a)})},
|
|
3
|
+
CU=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Oc,function(d){return DU(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Re}).forEach(function(d){DU(a,{track:d})});!EU(c)&&a.l&&(a.g.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),FU(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
|
|
4
|
+
EU=function(a){return a.some(function(b){return b.kind===_.Re})},FU=function(a,b){var c=a.m.getTrackManager(),d=c.pa(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ia(d)};a.a.on(b.textTracks,_.Oc,function(g){g.track.kind===_.Re&&(a.a.off(b.textTracks,_.Oc,f),f())});c.Ia(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},DU=function(a,b){var c=b.track;c.kind===_.Re&&(a.g.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.xe,a.a.on(c,_.Xd,function(d){return GU(a,d)}))},GU=function(a,b){var c=HU(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new zU(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.S.hb(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},HU=function(a){return(a=
|
|
6
|
+
a.m.getTrackManager().Ea())&&a.language&&a.language.toLowerCase()},IU=function(){this.a=null;this.f=!1},JU=function(){};BU.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x(IU,_.tu);IU.prototype.onPlayerCreated=function(){};IU.prototype.onContentWillLoad=function(a){if(this.f=_.gl()){var b=a.getConfiguration();b=_.O.Xa(b.hlssmpte||{});_.O.Th(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.O.ya(b.timestampOffset)||(b.timestampOffset=0);this.a=new BU(a,b.patchMetadataTrack,b.timestampOffset)}};IU.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.F(0);a.a=null;_.C(b)})};IU.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.J("clpp.hlssmpte.HlsSmptePlugin",IU);IU.Id="hlssmpte";JU.prototype.create=function(){return new IU};_.Zq(new JU);};
|
|
8
8
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
9
9
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
10
10
|
else{_=this.clpp._;(f.call(g,this));}
|