@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/cl.freewheel.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},
|
|
3
|
-
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.
|
|
4
|
-
a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},
|
|
5
|
-
!0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return
|
|
6
|
-
0}getSkipTimeOffset(){return 0}
|
|
7
|
-
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.
|
|
8
|
-
Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.
|
|
9
|
-
Y.prototype.getMediaWidth=Y.prototype.
|
|
10
|
-
Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.
|
|
11
|
-
|
|
12
|
-
_.
|
|
13
|
-
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);
|
|
14
|
-
a.j&&(a.j.stop(),a.j=null);
|
|
15
|
-
9,10003,{errorType:0},void 0));this.l.resolve()}J(a){
|
|
16
|
-
_.
|
|
17
|
-
_.
|
|
18
|
-
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.o.findIndex(c=>c===this.f);this.o.splice(b,1);this.m.pause();
|
|
19
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var zT="clpp-freewheel",AT="clpp.freewheel.AdsManagerFactory",BT="freewheel",CT=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""}},DT=function(a){const b=[];typeof a.networkId!==_.t&&b.push("networkId");typeof a.serverUrl!==_.Mf&&b.push("serverUrl");typeof a.profileId!==_.Mf&&b.push("profileId");typeof a.videoAssetId!==_.Mf&&typeof a.videoAssetId!==_.t&&b.push("videoAssetId");
|
|
2
|
+
if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},ET=function(){return _.x(function*(){var a=new _.Zt;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},FT=function(a){a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.H.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.J.bind(a));a.h.on(a.a,
|
|
3
|
+
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.G.bind(a));a.h.on(a.m,_.Tf,a.F.bind(a));a.h.on(a.m,_.Jf,a.D.bind(a))},IT=function(a){return _.x(function*(){a.C.length?(GT(a),a.f=a.C.shift(),a.f.play()):(HT(a),yield a.m.a.play())})},HT=function(a){const b=a.m.kc(BT).Hc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},GT=function(a){const b=a.m.kc(BT).Hc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(zT),
|
|
4
|
+
a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},JT=function(a){a.A.length?(GT(a),a.f=a.A.shift(),a.f.play()):HT(a)},KT=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 Y(a.a,c,d)});a.m.trigger(new _.D(b,d))},LT=class extends _.iu{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.po(_.Fd,{id:zT}),this.f=_.po(_.w,{"class":_.dd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,
|
|
5
|
+
!0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return BT}Hc(){return this.a}zg(){return this.f}};_.z("clpp.freewheel.FreeWheelPlugin",LT);LT.prototype.getAdVideo=LT.prototype.zg;LT.prototype.getAdContainer=LT.prototype.Hc;LT.Id=BT;LT.AD_CONTAINER_ID=zT;_.Wo(new class{create(){return new LT}});var Y=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}Gb(){return"FreeWheel AdManager SDK"}Hb(){return tv.freewheel.SDK.version}Mb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Mf?a:""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
|
|
6
|
+
0}getSkipTimeOffset(){return 0}pc(){return!1}Xb(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}Kb(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}Jb(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}yb(){return 0}lb(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;
|
|
7
|
+
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.lb()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}Yb(){switch(this.lb()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}Zb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}Lb(){return this.f.getAdCount()}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};
|
|
8
|
+
Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.Lb;Y.prototype.getPositionInSequence=Y.prototype.Zb;Y.prototype.getPodTimeOffset=Y.prototype.Yb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.lb;Y.prototype.getMediaBitrate=Y.prototype.yb;Y.prototype.getMediaHeight=Y.prototype.Jb;
|
|
9
|
+
Y.prototype.getMediaWidth=Y.prototype.Kb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Xb;Y.prototype.isBumper=Y.prototype.pc;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;
|
|
10
|
+
Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.Mb;Y.prototype.getAdManagerVersion=Y.prototype.Hb;Y.prototype.getAdManagerName=Y.prototype.Gb;var MT=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(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()}})}$b(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}Ab(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
|
|
11
|
+
MT.prototype.hasPostroll=MT.prototype.Ab;MT.prototype.hasPreroll=MT.prototype.$b;MT.prototype.getCuePoints=MT.prototype.getCuePoints;var NT=class{constructor(a){this.g=new _.S("clpp.freewheel.AdsManager");this.m=a;this.h=new _.$r;this.w=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.C=[];this.o=[];this.A=[];this.l=new _.Zm;this.j=null}load(){const a=this;return _.x(function*(){const b=a.m.getConfiguration().freewheel||{};try{DT(b)}catch(d){return a.m.onError(d),a.l.resolve(),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!==_.Mf&&typeof b.siteSectionId!==
|
|
12
|
+
_.t||a.a.setSiteSection(b.siteSectionId);const c=yield ET();a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,CT(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ce&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);
|
|
13
|
+
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);FT(a);a.a.submitRequest();return a.l})}start(){const a=this;return _.x(function*(){yield IT(a)})}resume(){this.f&&this.f.resume()}pause(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getVolume(){return this.a?this.a.getAdVolume():1}setVolume(a){this.a&&this.a.setAdVolume(a)}getPosition(){return this.f?this.f.getPlayheadTime():-1}dispose(){const a=this;return _.x(function*(){a.h.release();
|
|
14
|
+
a.j&&(a.j.stop(),a.j=null);HT(a);a.a&&(a.a.dispose(),a.a=null)})}H(a){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 _.D(_.tc,{adsTimeline:new MT(this.a)})),this.j=new _.Xt(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.kc(BT).f);else this.m.onError(new _.H(1,
|
|
15
|
+
9,10003,{errorType:0},void 0));this.l.resolve()}J(a){KT(this,_.bc,a);this.j.start()}I(a){this.f=null;a=a.slot;KT(this,_.cc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:IT(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:HT(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:JT(this)}}G(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:KT(this,_.pc,a);KT(this,
|
|
16
|
+
_.hc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:KT(this,_.qc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:KT(this,_.gc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:KT(this,_.jc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:KT(this,_.rc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:KT(this,_.fc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:KT(this,_.ec,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:KT(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:KT(this,
|
|
17
|
+
_.nc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:KT(this,_.oc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:KT(this,_.dc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:KT(this,_.mc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.H(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}F(){if(!this.f){var a=this.m.getPosition();if(this.f=this.o.find(b=>
|
|
18
|
+
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.o.findIndex(c=>c===this.f);this.o.splice(b,1);this.m.pause();GT(this);this.f.play()}}}D(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Un:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Tn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Jn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);JT(this);break;case _.Rn:case _.Qn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
|
|
19
|
+
NT.prototype.getPosition=NT.prototype.getPosition;NT.prototype.setVolume=NT.prototype.setVolume;NT.prototype.getVolume=NT.prototype.getVolume;NT.prototype.skip=NT.prototype.skip;NT.prototype.pause=NT.prototype.pause;NT.prototype.resume=NT.prototype.resume;NT.prototype.start=NT.prototype.start;var OT=class{constructor(){this.a=new _.S(AT)}name(){return AT}isSupported(a,b){return a.namespace()===_.jd?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)}create(a){return new NT(a)}};OT.prototype.create=OT.prototype.create;OT.prototype.isSupported=OT.prototype.isSupported;OT.prototype.name=OT.prototype.name;_.mo(new OT);};f.call(g, window);
|
package/cl.hls.js
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
a)return Number(a)},
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
a
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Number(
|
|
45
|
-
`value (value: ${b.value}).`),null):c/1E3},
|
|
46
|
-
"PLANNED-DURATION"));void 0!==h&&0<=h&&(d.plannedDuration=h);var k=_.I(c,"CLASS");null!==k&&(d.schemeIdUri=k);var l=_.I(c,"END-DATE");l=l?new Date(l):null;null!==l&&l.getTime()>=f.getTime()&&(d.endDate=l);{const
|
|
47
|
-
|
|
48
|
-
"hls-daterange";c=d}}return c}).filter(Boolean):null},
|
|
49
|
-
f._HLS_msn=d.toString(),null===e&&f._HLS_part&&delete f._HLS_part,null!==e&&(f._HLS_part=e.toString()),d=_.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
type:_.
|
|
53
|
-
0<f.length?f:[null];h=0<h.length?h:[null];f=[];for(const n of m)for(const
|
|
54
|
-
m:[],video:l?m:[]};a.
|
|
55
|
-
c.height);
|
|
56
|
-
a.f.set(b,c);return c},
|
|
57
|
-
b.name?!0:_.I(b,_.
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
`, new values ${e} - ${e+d.length-1}.`,b,h);throw new _.H(_.
|
|
62
|
-
4,4046,
|
|
63
|
-
|
|
64
|
-
d.a;var f=
|
|
65
|
-
a.a.attemptParameters);g.method="HEAD";g.type=2;g=(yield a.
|
|
66
|
-
b,c){c=void 0===c?[]:c;this.
|
|
67
|
-
null}values(){return Array.from(this.a.values())}clear(){this.f.clear();this.a.clear()}},
|
|
68
|
-
|
|
69
|
-
text:e}=yield
|
|
70
|
-
yield
|
|
71
|
-
7,7001);a=this.
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var UI="CLOSED-CAPTIONS",VI="Could not parse MP4 segment start time.",WI="DURATION",XI="EXT-X-STREAM-INF",YI="Failed to infer discontinuity number",ZI="Guessing audio-only",$I="METHOD",aJ="SAMPLE-AES-CTR",bJ="SUBTITLES",cJ="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",dJ="application/vnd.apple.mpegurl",eJ="sample",fJ="whole-segment",gJ=function(a,b){return _.I(a,b,void 0,{required:!0})},hJ=function(a){if(1>a.a)throw _.sl();--a.a},iJ=function(a){if(null!==a&&void 0!==
|
|
2
|
+
a)return Number(a)},jJ=function(a,b){return a.filter(c=>c.name===b)},kJ=function(a,b){const c=Array.isArray(b)?b:[b];return a.filter(d=>{d=gJ(d,_.Jb);return c.includes(d)})},lJ=function(a,b){return a.some(c=>c.name===b)},mJ=function(a,b,c){c=void 0===c?{}:c;a=a.find(d=>d.name===b)||null;if(!a&&c.required)throw new _.H(_.E,4,4024,{missingTag:b});return a},nJ=function(a){var b=mJ(a,"EXT-X-TILES");if(!b)return{bd:1,ud:1,durationPerTile:null};a=_.I(b,"LAYOUT")||"1x1";b=_.I(b,WI);a=_.JB(a);return{bd:a.bd,
|
|
3
|
+
ud:a.ud,durationPerTile:b?Number(b):null}},oJ=function(a,b){return _.EB([a],[b])[0]},pJ=function(a){const b=new Set;a.variants.forEach(c=>{c.audio&&b.add(c.audio);c.video&&b.add(c.video)});a.textStreams.forEach(c=>b.add(c));a.thumbStreams.forEach(c=>b.add(c));return Array.from(b)},qJ=function(a,b){Array.isArray(a)||(a=[a]);a.forEach(c=>{for(const d of pJ(c))b(d,c)})},rJ=function(a){return a.some(b=>lJ(b.ca,_.Ea))},sJ=function(a){return a.type===_.p||a.type===_.w},tJ=function(a,b){const c=mJ(a,_.Ea);
|
|
4
|
+
if(b&&c)return _.Sb;a=mJ(a,_.Ja);if(!a)return"LIVE";if(a.value===_.Sb)return _.Sb;if("EVENT"===a.value)return"EVENT";throw new _.H(_.E,4,4044,`Invalid EXT-X-PLAYLIST-TYPE value: ${a.value}`);},uJ=function(a){a={AUDIO:_.p,VIDEO:_.w,SUBTITLES:_.G,"CLOSED-CAPTIONS":_.G}[a.toUpperCase()];if(!a)throw new _.H(_.E,4,4044,"EXT-X-MEDIA tag has an invalid TYPE attribute.");return a},vJ=function(a,b,c){c=void 0===c?!1:c;var d=0;let e=null;if(a){d=a.split("@");a=Number(d[0]);if(0>=a)throw new _.H(_.E,4,4044,
|
|
5
|
+
"Byte range length must be positive.");if(d[1]){if(d=Number(d[1]),0>d)throw new _.H(_.E,4,4044,"Byte range start byte must not be negative.");}else{if(c)throw new _.H(_.E,4,4044,"Invalid byte range, offset is required but missing.");if(null==b)throw new _.H(_.E,4,4044,"Invalid byte range, cannot calculate offset based on previous byte ranges.");d=b+1}e=d+a-1}return{wa:d,la:e}},wJ=function(a,b){a=mJ(a,_.Aa);return vJ(a?a.value:null,b)},xJ=function(a){a=mJ(a,"EXTINF",{required:!0}).value.split(",");
|
|
6
|
+
return{duration:Number(a[0]),title:a[1]||null}},yJ=function(a,b){b=void 0===b?{}:b;const c={zd:!1,jg:!1,kg:null,Mg:null,Mf:null};a=mJ(a,_.Na,{required:b.Rf});if(!a)return c;const d=e=>null==e?null:Number(e);c.zd="YES"===_.I(a,"CAN-BLOCK-RELOAD");c.jg="YES"===_.I(a,"CAN-SKIP-DATERANGES");c.kg=d(_.I(a,"CAN-SKIP-UNTIL"));c.Mg=d(_.I(a,"HOLD-BACK"));c.Mf=d(_.I(a,"PART-HOLD-BACK",void 0,{required:b.Rf}));return c},zJ=function(a,b,c){c=void 0===c?!1:c;a=_.I(a,"BYTERANGE");return vJ(a,b,c)},BJ=function(a,
|
|
7
|
+
b){const c=wJ(a.ca,null);return new AJ(0,0,0,()=>[a.a],c.wa,c.la,0,b)},CJ=function(a,b){if(null==a)return null;a=Object.assign({},a);null==a.iv&&(a.iv=_.Ei(new Uint8Array(12),new Uint8Array([b>>24&255,b>>16&255,b>>8&255,b&255])));return a},DJ=function(a){let b=Infinity,c=Infinity;pJ(a).filter(sJ).forEach(d=>{{d=d.V;var e=d[0].startTime;const f=d[d.length-1].endTime;d=e;e=f-e}b=Math.min(b,d);c=Math.min(c,e)});return{Lc:b,duration:c}},EJ=function(a){return a.map(b=>{({duration:b}=DJ(b));return b}).reduce((b,
|
|
8
|
+
c)=>b+c,0)},FJ=function(a){return(a.video?a.video.Ha:"")+" - "+(a.audio?a.audio.Ha:"")},GJ=function(a,b,c,d){if(b===_.Sb)return{delay:0,wc:0};b=mJ(a,_.Ia);if(c&&b){c=Number(gJ(b,"PART-TARGET"));if(null!=d)return{delay:d,wc:c};({Mf:d}=yJ(a,{Rf:!0}));return{delay:d,wc:c}}a=mJ(a,_.Pa,{required:!0});a=Number(a.value);return null!=d?{delay:d,wc:a}:{delay:3*a,wc:a}},HJ=function(a){const b=[];qJ(a,c=>{b.push(c.Sg)});return{delay:Math.max(...b.map(c=>c.delay)),wc:Math.min(...b.map(c=>c.wc))}},JJ=function(a){const b=
|
|
9
|
+
new Map;a.forEach(c=>{var d=IJ(c).groupId;b.has(d)?(d=b.get(d),d.includes(c)||d.push(c)):b.set(d,[c])});return b},KJ=function(a){const b=new Map;for(const c of a){a=_.I(c,_.ab);a=_.Yh(a||_.Wf);const d=gJ(c,_.Ua),e=gJ(c,"INSTREAM-ID");b.has(d)||b.set(d,new Map);b.get(d).set(e,a)}return b},MJ=function(a){a=a.audio.concat(a.video);for(const b of a)a=IJ(b).codecs.split(",").filter(c=>"mp4a.40.34"!==c),LJ(b,a)},NJ=function(a,b){if(!a)return null;const c=a.Ha;return b.find(d=>IJ(d).Ha===c)||null},OJ=function(a){for(const b of a)if(b.startsWith("#EXT-")&&
|
|
10
|
+
(a=_.Ji(0,b),_.Bs.has(a.name)))return 1;return 0},PJ=function(a){a=jJ(a,"EXT-X-DEFINE").map(b=>{const c=_.I(b,"NAME");if(!c)return null;b=gJ(b,"VALUE");return{name:c,value:b}}).filter(Boolean);return new Map(a.map(b=>[b.name,b.value]))},QJ=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,(c,d)=>{c=b.get(d);if(null==c)throw new _.H(_.E,4,4044,`Undefined variable '${d}'`);return c})},RJ=function(a,b){a.forEach(c=>{c.attributes.forEach(d=>{d.value=QJ(d.value,b)})})},SJ=function(a,b,c){RJ(a,c);
|
|
11
|
+
b.forEach(d=>{RJ(d.ca,c)})},VJ=function(a,b,c){const d=[];for(let e=1;e<b.length;e++){const f=TJ(a,b[e]);d.push(f);if(f.name===XI){const g=b[e+1];if(!g)throw new _.H(_.E,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Hi(_.Lb,g));e++}}a.a=PJ(d);SJ(d,[],a.a);return new UJ(c,0,d)},YJ=function(a,b,c){let d=[];for(var e=1;e<b.length;){const f=TJ(a,b[e]);if(_.Cs.has(f.name))break;d.push(f);e++}b=WJ(a,c,b.slice(e));e=b.V;d=d.concat(b.ca);a=XJ(a,d);SJ(d,e,a);return new UJ(c,
|
|
12
|
+
1,d,b.V)},ZJ=function(a,b,c){b=b.trim().split(/\n+/m).map(d=>d.trim()).filter(d=>d.length&&!/^#(?!EXT)/m.test(d));if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.H(_.E,4,4015);return 0===OJ(b)?VJ(a,b,c):YJ(a,b,c)},TJ=function(a,b){return _.Ji(a.f++,b)},WJ=function(a,b,c){const d=[],e=[];let f=[],g=[];c.forEach(h=>{/^(#EXT)/.test(h)?(h=TJ(a,h),_.Bs.has(h.name)||_.Es.has(h.name)?d.push(h):_.Ds.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.La&&"PART"===_.I(h,_.Jb)&&g.push(h):f.push(h)):/^#(?!EXT)/m.test(h)||
|
|
13
|
+
(h=oJ(b,h.trim()),e.push(new $J(h,f,g)),f=[],g=[])});0<g.length&&e.push(new $J(null,f,g));return{V:e,ca:d}},XJ=function(a,b){const c=jJ(b,"EXT-X-DEFINE"),d=PJ(b);c.map(e=>_.I(e,"IMPORT")).filter(Boolean).forEach(e=>{const f=a.a.get(e);if(null==f)throw new _.H(_.E,4,4044,`Cannot import variable '${e}' as it is not defined `+"in the master playlist");d.set(e,f)});return d},aK=function(a){return 0>a?[]:Array.from({length:a},(b,c)=>c)},bK=function(a,b=0){return b+10<=a.length&&73===a[b]&&68===a[b+1]&&
|
|
14
|
+
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+9]?!0:!1},cK=function(a){function b(h,k,l){let m="";for(;k<l;k++)m+="%"+("00"+h[k].toString(16)).slice(-2);return m}function c(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]}function d(){throw new _.H(_.E,4,4030);}bK(a)||d();let 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(let h=0;h<g.byteLength;h++)if(0===
|
|
15
|
+
g[h]){if("com.apple.streaming.transportStreamTimestamp"===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}}bK(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},dK=function(a,b){let c=null,d=0;try{(new _.Hl).L(_.ye,_.Q).L(_.Uf,_.Q).L(_.qe,_.Q).ba("mdhd",g=>{g.reader.skip(0===g.version?8:16);d=_.P(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.au.error("Unable to find timescale in init segment!"),
|
|
16
|
+
new _.H(_.E,4,4030,VI,c);let e=0,f=!1;try{(new _.Hl).L("moof",_.Q).L("traf",_.Q).ba("tfdt",g=>{var h=d;if(0===g.version)h=_.P(g.reader)/h;else{{const k=_.P(g.reader),l=_.P(g.reader);if(!(2097151>=k||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=k/h*Math.pow(2,32)+l/h}}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.H(_.E,4,4030,VI,c);return e},eK=function(a){for(;a.getPosition()<a.Ja()-1;){const b=
|
|
17
|
+
a.getPosition();if(71===_.tl(a))return hJ(a),b}return-1},fK=function(a){function b(){d.seek(e+188);f=_.tl(d);71!==f&&(d.seek(e+192),f=_.tl(d));71!==f&&(d.seek(e+204),f=_.tl(d));71!==f&&c();hJ(d)}function c(){throw new _.H(_.E,4,4030);}const d=new _.qm(new DataView(a),!1);let e=0,f=0;e=eK(d);0>e&&(_.au.error("Unable to find sync byte in TS after scanning."),c());for(;;){e=d.getPosition();f=_.tl(d);71!==f&&c();a=_.ul(d);if(8191===(a&8191)){b();continue}if(!(a&16384)){b();continue}a=(_.tl(d)&48)>>4;
|
|
18
|
+
0!==a&&2!==a||c();3===a&&(a=_.tl(d),d.skip(a));if(1!==_.P(d)>>8){b();continue}d.skip(3);a=_.tl(d)>>6;0!==a&&1!==a||c();0===_.tl(d)&&c();a=_.tl(d);const g=_.ul(d),h=_.ul(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}},iK=function(a){const b=gK(a),c=hK(a);a.forEach(d=>{const e=d.V,f=e.findIndex(h=>h.ka===b);let g=e.findIndex(h=>h.ka===c+1);-1===g&&(g=e.length);d.V=e.slice(f,g)})},hK=function(a){a=a.map(b=>b.V[b.V.length-1].ka);return Math.min(...a)},gK=function(a){a=a.map(b=>b.V[0].ka);
|
|
19
|
+
return Math.max(...a)},lK=function(a){var b=gJ(a,$I);if(!jK.includes(b))return kK.error("PlayReady in HLS is only supported with [",jK.join(", "),"], not",b),null;a=gJ(a,_.Lb);b=_.Kr(a);a=null;b=_.J(b.data);try{a=_.rB(_.xm(b))}catch(c){a=b}return _.FB(_.wd,[{initDataType:_.Zc,initData:a}],"")},nK=function(a){if(0===a.length)return mK();if(a.some(c=>c.type===fJ)||a.every(c=>c.type===_.Be))return a[0];a=a.filter(c=>c.type===eJ);const b=_.Ah(a.flatMap(c=>c.drmInfos));return{keyInfo:null,keyId:a[a.length-
|
|
20
|
+
1].keyId,type:eJ,drmInfos:b}},qK=function(a){a=oK(a);if(a.some(b=>pK(b))&&1<a.length)throw new _.H(_.E,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},pK=function(a){return jJ(a.ca,_.Fa).some(b=>"AES-128"===_.I(b,$I))},sK=function(a,b,c){return oK(a).map(d=>rK(d.ca,b,c))},tK=function(a){return a.filter(b=>lJ(b.ca,_.Fa)).length},oK=function(a){return a.filter(b=>lJ(b.ca,_.Fa))},rK=function(a,b,c){a=jJ(a,_.Fa);if(0===a.length)return null;var d=gJ(a[0],$I);if(1===
|
|
21
|
+
a.length){if("NONE"===d)return mK();if("AES-128"===d)return a=a[0],d=_.I(a,"IV",""),{type:fJ,keyInfo:{method:"AES-128",url:oJ(b,gJ(a,_.Lb)),iv:d?_.Bi((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(e=>gJ(e,$I));if(!b.every(e=>"SAMPLE-AES"===e)&&!b.every(e=>e===aJ))throw uK.warn(`EXT-X-KEY methods ${b.join(", ")} are incompatible.`),new _.H(_.E,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(e=>{const f=_.I(e,"KEYFORMAT","identity");{const g=vK[f]||null;e=g?g(e,
|
|
22
|
+
c):null}e||uK.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.H(_.E,4,4026);return{keyInfo:null,keyId:b.map(e=>e.keyIds).reduce((e,f)=>e.concat(f),[]).reverse()[0]||null,type:eJ,drmInfos:b}},mK=function(){return{type:_.Be,keyInfo:null,drmInfos:[],keyId:null}},wK=function(a,b,c){return _.x(function*(){const d=b.f(),e=_.jC(b.Qa(),b.wa,b.wa+2048-1,a.a.attemptParameters);e.type=2;const f=_.jC(b.Qa(),b.wa,b.la,a.a.attemptParameters);f.type=2;d&&(f.keyInfo=d);
|
|
23
|
+
try{return yield a.f(c?f:e)}catch(g){if(7001===g.code||c)throw g;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]);try{return yield a.f(f)}catch(h){throw a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],h),new _.H(_.E,4,4030,"Failed to fetch the media segment.");}}})},xK=function(a,b,c,d,e,f){return _.x(function*(){a.g.debug("Fetching segment to find start time");
|
|
24
|
+
if("audio/mpeg"===d||d===_.Hc||d===_.Gc)return 0;if(d===_.Fc){var g=yield wK(a,c,f);const h=_.J(g.data);return bK(h)?cK(h):fK(g.data)}if(d===_.gg||d===_.Ic)return g=[wK(a,c,f)],b&&g.push(wK(a,b,!0)),g=yield Promise.all(g),dK(g[0].data,(g[1]||g[0]).data);if(d===_.fg)return g=yield wK(a,c,f),fK(g.data);if(!_.Np(`${d.split("/")[0]||""}/mp4;codecs="${e}"`))return 0;throw new _.H(_.E,4,4030);})},yK=function(a,b){a=a.map(c=>c.streams[b]);return a.some(c=>null==c)?null:a},LJ=function(a,b){a.streams.forEach(c=>
|
|
25
|
+
{c.codecs=b.join(",")})},zK=function(a,b){a=a.streams.find(c=>{c=c.V;return c[0].position<=b&&b<=c[c.length-1].position});return null==a?null:a.V.find(c=>c.position===b)||null},IJ=function(a){return a.streams[0]},AK=function(a,b){a.streams.forEach(c=>{c.Xd=b})},BK=function(a,b){a.streams.forEach(c=>{c.width=b})},CK=function(a,b){a.streams.forEach(c=>{c.height=b})},DK=function(a,b){a.streams.forEach(c=>{c.frameRate=b})},EK=function(a,b){a.streams.forEach(c=>{c.bandwidth=b})},FK=function(a,b){a=a.map(c=>
|
|
26
|
+
c.a[b]);return a.some(c=>null==c)?null:a},GK=function(a,b){const c=new Set(a.map(d=>d.ka));return b.filter(d=>!c.has(d.ka))},JK=function(a,b){for(;a[0].ka<b[0].ka;)a.splice(0,1);var c=a[0];let d=b[0];HK(c,d)||IK(c,d);const e=a.length-1;c=a[e];d=b[e];0<e&&!HK(c,d)&&IK(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},KK=function(a,b){const c=a[a.length-1];var d=b.findIndex(f=>f.ka===c.ka);const e=b[d];HK(c,e)||IK(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},PK=function(a,b,c,d,e){var f=b[0].length();f=aK(f).map(g=>
|
|
27
|
+
{var h=FK(b,g)||[];const k=yK(c,g)||[];g=yK(d,g)||[];{const l=[...LK(h),...k,...g].filter(Boolean);MK(l);const {ka:m,duration:n}=l[0];h={configurationId:a,variants:h,textStreams:k,thumbStreams:g,startTime:0,id:`P${m}`,endTime:n,duration:n,ka:m}}return h});e&&NK(f[0]);OK(f);return f},LK=function(a){a=new Set(a.flatMap(b=>[b.video,b.audio]).filter(Boolean));return Array.from(a)},NK=function(a){const b=LK(a.variants)[0].V[0].va;a.startTime+=b;a.endTime+=b},OK=function(a){for(let b=0;b<a.length;b++){const c=
|
|
28
|
+
a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},HK=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},IK=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;QK(a.variants,b.variants);RK(pJ(a),pJ(b))},QK=function(a,b){const c=new Map(a.map(d=>[FJ(d),d]));b.forEach(d=>{c.get(FJ(d)).drmInfos=d.drmInfos})},RK=function(a,b){const c=new Map(a.map(d=>[d.Ha,d]));b.forEach(d=>{const e=c.get(d.Ha);e.V=d.V;e.segmentIndex.replace(d.V);
|
|
29
|
+
e.Lc=d.Lc;e.qe=d.qe;e.duration=d.duration;e.rf=d.rf;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},MK=function(a){const b=SK(a);a.forEach(c=>{_.eC(c.segmentIndex,b);c.duration=b;c.qe=c.Lc+b})},SK=function(a){let b=Infinity;a.filter(sJ).forEach(c=>{b=Math.min(b,c.duration)});return b},TK=function(a,b){qJ(b,(c,d)=>{_.sC(a,c.V,d.startTime)});_.kC(a.a,b[0].startTime,b[b.length-1].endTime)},UK=function(a){return null===a.j?[]:[a.j.audio,a.j.video].filter(b=>b).map(b=>b.Ha)},VK=function(a,
|
|
30
|
+
b){return _.x(function*(){var c=_.Oi([b],a.a.attemptParameters);c.type=1;c=yield a.F(c);let d="";try{d=_.ki(c.data)}catch(e){throw new _.H(_.E,4,4042);}d=d.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");d=d.trim();return{text:d,response:c}})},$K=function(a,b){return _.x(function*(){var c=WK(a,b,a.w,"");if(1===c.type){c=_.xs(c.V[0].a)||"";c=null!=_.ws.video[c]?_.w:null!=_.ws.audio[c]?_.p:null;var d="";c===_.w?d="avc1.42E01E":c===_.p&&(d="mp4a.40.2");{c=a.K;var e=a.w;d=a.a.hlsDefaultCodecs||d;var f=[];const r=
|
|
31
|
+
[];r.push(new _.Hi(_.ma,"0"));r.push(new _.Hi(_.Lb,e));d.length&&r.push(new _.Hi(_.pa,d));f.push(new _.Ii(c.f++,XI,r));c=new UJ(e,0,f)}}d=c.ca;c=jJ(d,"EXT-X-MEDIA");e=jJ(d,XI);d=jJ(d,"EXT-X-IMAGE-STREAM-INF");c={Kc:{eg:kJ(c,["AUDIO",_.Rb]),closedCaptions:kJ(c,UI),rh:kJ(c,bJ)},vd:e,ke:d};const {periods:g,Pf:h,Uf:k}=yield XK(a,c);if(!a.B)throw new _.H(_.E,7,7001);e=HJ(g[0]);YK(a,g);c=!0;d=null;f=0;ZK(a)||(c=!1,d=0,f=e.delay);d=new _.HI(a.a.timeline||{},d,f,!0,void 0,!!a.a.lowLatencyMode);_.oC(d,c);
|
|
32
|
+
TK(d,g);h&&_.nC(d,h);c=d;if(!ZK(a)){a.D=e.wc;e=0;for(var l of a.f.values())e=Math.max(e,l.streams[0].Lc);for(l=0;95443.7176888889<=e;)l+=95443.7176888889,e-=95443.7176888889;if(l){a.g.debug("Offsetting live streams by",l,"to compensate for rollover");for(var m of a.f.values())e=m.streams[0],95443.7176888889>e.Lc?(a.g.debug("Offset applied to",e.type),e.segmentIndex.offset(l)):a.g.debug("Offset NOT applied to",e.type)}}m=EJ(g);"LIVE"===a.l||"EVENT"===a.l?(m=Math.max(m,c.H),isNaN(a.a.availabilityWindowOverride)||
|
|
33
|
+
(m=a.a.availabilityWindowOverride),c.A=m):a.l===_.Sb&&(c.h=m);if(k)for(var n of k)a.B.onTimelineCueAdded({configurationId:a.B.configurationId,schemeIdUri:n.schemeIdUri,eb:n.eb,value:"",startTime:n.startTime,endTime:n.endTime,id:n.id,type:_.nh,eventElement:null});n={presentationTimeline:c,adaptedPeriods:[...g],periods:g,minBufferTime:0};a.g.debug("HLS playlist parsed",n);return n})},bL=function(a,b){return Promise.all(b.map(c=>aL(a,c)))},dL=function(a,b){b.forEach(c=>{a:{var d=a.f.get(c.a),e=!ZK(a),
|
|
34
|
+
f=mJ(c.ca,_.Da);if(f)var g=Number(f.value);else{d?(f=d.streams[d.streams.length-1].V,f=f[f.length-1].ka):f=0;if(e&&0<f)try{{const k=mJ(c.ca,_.Ha);if(!k)throw cL.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(YI);const l=Number(k.value),m=zK(d,l);if(!m)throw cL.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist"+` (segment position = ${l})`),Error(YI);var h=m.ka}g=h;break a}catch(k){throw new _.H(_.E,
|
|
35
|
+
4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}g=0}}c=c.V||[];for(const k of c)lJ(k.ca,_.Ca)&&g++,k.ka=g});iK(b)},gL=function(a,b){return _.x(function*(){const {textStreams:c,thumbStreams:d,fg:e}=yield eL(a,b);var f=a.o.periods[0].variants;a.a.lowLatencyMode&&null!==a.j&&(f=f.filter(g=>g.id===a.j.id));f=f.map(g=>{const h=NJ(g.audio,e),k=NJ(g.video,e);g=fL(a,h,k,g.bandwidth);if(!g)throw new _.H(_.E,4,4047,{message:"Video and audio are encrypted in an incompatible way.",
|
|
36
|
+
Vh:k?IJ(k).Ha:void 0,audio:h?IJ(h).Ha:void 0});return g});return PK(a.B.configurationId,f,c,d,!0)})},YK=function(a,b){ZK(a)||2!==a.a.timeline.version||(a.G||(a.G=b[0].startTime),_.$D(b,-a.G))},hL=function(a,b,c){a.l=_.Sb;_.oC(b,!0);b.h=c[c.length-1].endTime},WK=function(a,b,c,d){a=ZJ(a.K,b,c);a.a=d;iL(a);return a},XK=function(a,b){return _.x(function*(){var c=KJ(b.Kc.closedCaptions),d=jL(a,b.vd),e=yield kL(a,b);const f=Object.values(e).flat().map(h=>h.playlist);dL(a,f);var g=yield lL(a,e.gf,d);c=
|
|
37
|
+
yield mL(a,e.vd,g,c);d=yield nL(a,e.qh,d);g=yield oL(a,e.ke);e=pL(a,e);c=PK(a.B.configurationId,c,d,g,!ZK(a));a.B.filterAllPeriods(c);return ZK(a)?(d=null,e&&(d=qL(f,e)),{periods:c,Pf:e,Uf:d}):{periods:c,Pf:e,Uf:null}})},eL=function(a,b){return _.x(function*(){const c=g=>IJ(g.stream).type===_.w||IJ(g.stream).type===_.p;var d=b.filter(c),e=b.filter(g=>!c(g)),f=g=>{g=g.map(h=>{var k=IJ(h.stream);k={language:k.language,channelsCount:k.channelsCount,spatialAudio:k.spatialAudio,closedCaptions:k.closedCaptions,
|
|
38
|
+
primary:k.primary,kind:k.kind||null,groupId:k.groupId,type:k.type,codecs:k.codecs,name:k.originalId,uri:k.Ha,Wd:{width:k.width,height:k.height,frameRate:k.frameRate}};h=Object.assign({},{playlist:h.playlist},k);return rL(a,h)});return Promise.all(g)};d=yield f(d);f=yield f(e);sL(a,d.concat(f));e=f.filter(g=>IJ(g).type===_.dB);f=f.filter(g=>IJ(g).type===_.ae);return{textStreams:e,thumbStreams:f,fg:d}})},fL=function(a,b,c,d){const e=[],f=(c||b).length();for(let m=0;m<f;m++){var g=b?b.streams[m]||null:
|
|
39
|
+
null,h=c?c.streams[m]||null:null,k=g,l=h;k=k&&l?_.NB(k.drmInfos,l.drmInfos)?_.MB(k.drmInfos,l.drmInfos):null:k?k.drmInfos:l?l.drmInfos:null;if(!k)return null;l=d;g={id:a.N++,language:g?g.language:_.Wf,primary:!!g&&g.primary||!!h&&h.primary,audio:g,video:h,bandwidth:l,drmInfos:k,allowedByApplication:!0,allowedByKeySystem:!0};e.push(g)}return new tL(e)},rL=function(a,b){return _.x(function*(){const c=b.playlist,d=b.codecs,e=b.type,f=b.hd,g=b.groupId,h=b.primary;var k=b.kind;const l=b.name,m=b.channelsCount,
|
|
40
|
+
n=b.spatialAudio,r=b.closedCaptions,v=b.Wd,u=_.Yh(f||_.Wf);if(1!==c.type)throw new _.H(_.E,4,4017);var y=tJ(c.ca,null==a.o);a.l=y;const C=GJ(c.ca,y,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay);y=yield uL(a,c,e,d);const F=a.a.lowLatencyMode?_.yA:_.sA;let N=k;e!==_.G||k||(N=_.dB);const {zd:da}=yJ(c.ca);k=y.map(vb=>{const Xb=vb.V,pd=vb.qg,mg=vb.mimeType;vb=vb.ka;const Wa=Xb[0].startTime,oe=Xb[Xb.length-1].endTime,Mc=oe-Wa,ea=new _.II(Xb),bb=Xb[0].initSegment||null;return{id:_.MI++,originalId:l,
|
|
41
|
+
createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:ea.f.bind(ea),getSegmentReference:ea.get.bind(ea),adjustSegmentDurations:ea.h.bind(ea),getDuration:ea.getDuration.bind(ea),segmentIndex:ea,segmentLookupStrategy:F,initSegmentReference:bb,mimeType:mg,codecs:d,kind:N,rf:pd.type,encrypted:pd.type===eJ,keyId:pd.keyId,language:u,originalLanguage:f||_.Wf,label:l,type:e,primary:h,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:v?v.frameRate:void 0,width:v?v.width:void 0,height:v?v.height:
|
|
42
|
+
void 0,bandwidth:void 0,roles:[],channelsCount:m,spatialAudio:n,closedCaptions:r,keyInfo:pd.keyInfo,V:Xb,drmInfos:pd.drmInfos,ka:vb,Ha:c.a,Xd:c.f,Lc:Wa,qe:oe,duration:Mc,zd:da,groupId:g,Sg:C}});return new vL(k)})},sL=function(a,b){b.forEach(c=>{a.f.a.set(IJ(c).Ha,c)})},jL=function(a,b){const c=new Map;for(const f of b){var d=_.I(f,"AUDIO");b=_.I(f,_.Rb);var e=_.I(f,bJ);const g=wL(a,f);if(e){const h=_.tj(_.G,g);c.set(e,h);e=g.indexOf(h);-1<e&&g.splice(e,1)}d&&(e=xL(_.p,g),c.set(d,e));b&&(d=xL(_.w,
|
|
43
|
+
g),c.set(b,d))}return c},kL=function(a,b){return _.x(function*(){const c=yield Promise.all([yL(a,b.Kc.eg),yL(a,b.Kc.rh),yL(a,b.vd),yL(a,b.ke)]),[d,e,f,g]=c;return{gf:d,qh:e,vd:f,ke:g}})},lL=function(a,b,c){return _.x(function*(){if(0===b.length)return new Map;var d=[zL(a,b[0],c)];yield d[0];d=d.concat(b.slice(1).map(e=>zL(a,e,c)));d=yield Promise.all(d);return JJ(d)})},mL=function(a,b,c,d){return _.x(function*(){const e=new Set;var f=[...b];let g=0;var h=Infinity;for(let k=0;k<f.length;++k){const l=
|
|
44
|
+
Number(gJ(f[k].tag,_.ma));l<h&&(h=l,g=k)}h=f.splice(g,1).pop();h=yield AL(a,h,c,d,e);f=f.map(k=>AL(a,k,c,d,e));f=yield Promise.all(f);f.splice(g,0,h);return f.reduce(_.CB,[])})},nL=function(a,b,c){return Promise.all(b.map(d=>zL(a,d,c)))},oL=function(a,b){return Promise.all(b.map(c=>BL(a,c)))},pL=function(a,b){b=[...b.vd,...b.gf].map(d=>d.playlist).flatMap(d=>d.V[0].ca);b=mJ(b,_.Ma);if(!b)return null;const c=(new Date(b.value)).getTime();return isNaN(c)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag "+
|
|
45
|
+
`value (value: ${b.value}).`),null):c/1E3},ZK=function(a){return a.l===_.Sb},qL=function(a,b){return(a=a.find(c=>null!==mJ(c.ca,_.Ba)))?a.ca.filter(c=>c.name===_.Ba).map(c=>{a:{var d=_.I(c,"ID"),e=_.I(c,"START-DATE");if(null===d||null===e)_.As.warn("Invalid EXT-X-DATERANGE missing mandatory ID or START-DATE attribute, ignoring the EXT-X-DATERANGE tag.",c),c=null;else{var f=new Date(e);e=f.getTime()/1E3-b;d={id:d,startTime:e,startDate:f};var g=iJ(_.I(c,WI));void 0!==g&&0<=g&&(d.duration=g);var h=
|
|
46
|
+
iJ(_.I(c,"PLANNED-DURATION"));void 0!==h&&0<=h&&(d.plannedDuration=h);var k=_.I(c,"CLASS");null!==k&&(d.schemeIdUri=k);var l=_.I(c,"END-DATE");l=l?new Date(l):null;null!==l&&l.getTime()>=f.getTime()&&(d.endDate=l);{const r=c.attributes;if(null==r)var m=null;else{f={};for(m of r)m.name.startsWith("X-")&&(f[m.name]=m.value);m=_.Og(f)?f:null}}m=m||{};if(k===_.vd){f=c.attributes;if(null==f)var n=null;else{k={};for(n of f)switch(n.name){case _.Zb:k[_.Zb]=n.value;break;case _.Yb:k[_.Yb]=n.value;break;case _.ac:k[_.ac]=
|
|
47
|
+
iJ(n.value);break;case _.$b:k[_.$b]=iJ(n.value);break;case "X-SNAP":k["X-SNAP"]=n.value.split(",");break;case "X-RESTRICT":k["X-SNAP"]=n.value.split(",")}k[_.Zb]&&k[_.Yb]||!k[_.Zb]&&!k[_.Yb]?(_.As.warn("Invalid EXT-X-DATERANGE Interstitial attributes X-ASSET-URI, X-ASSET-LIST"),n=null):n=_.Og(k)?k:null}if(null===n){_.As.warn("Invalid interstitial attributes, ignoring the EXT-X-DATERANGE tag.",c);c=null;break a}m=Object.assign(m,n)}_.Og(m)&&(d.eb=m);d.endTime=l?l.getTime()/1E3:g?e+g:h?e+h:e;d.type=
|
|
48
|
+
"hls-daterange";c=d}}return c}).filter(Boolean):null},yL=function(a,b){return _.x(function*(){return(yield Promise.all(b.map(c=>_.x(function*(){const d=yield CL(a,c);return d?{tag:c,playlist:d}:null})))).filter(Boolean)})},aL=function(a,b){return _.x(function*(){var c=new _.Ih(IJ(b).Xd);if(a.a.lowLatencyMode&&IJ(b).zd){var d=b.streams[b.streams.length-1].segmentIndex;if(d=d.a[d.a.length-1]){var e=d.a,f=e.length-1;d={Vg:d.position,Zg:e&&0<e.length?f:null}}else d=null;if(e=d)d=e.Vg,e=e.Zg,f=_.hj(c.a.toString()),
|
|
49
|
+
f._HLS_msn=d.toString(),null===e&&f._HLS_part&&delete f._HLS_part,null!==e&&(f._HLS_part=e.toString()),d=_.gj(f,!0),d=new _.Rh(d),_.Lh(c,d)}const {response:g,text:h}=yield VK(a,c.toString());c=IJ(b).Ha;d=IJ(b).Xd;e=g.uri;d!==e&&(d=e,AK(b,d));c=WK(a,h,d,c);return{stream:b,playlist:c}})},wL=function(a,b){var c=_.I(b,_.pa,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);b=new Set;const d=[];for(const e of c)c=_.SB(e),b.has(c)?a.g.debug("Ignoring duplicate codec"):(d.push(e),b.add(c));
|
|
50
|
+
return d},xL=function(a,b){if(1===b.length)return b[0];a=_.tj(a,b);if(null!=a)return a;throw new _.H(_.E,4,4025,{codecList:b});},zL=function(a,b,c){return _.x(function*(){const d=b.tag,e=b.playlist;return DL(a,e.a,()=>_.x(function*(){const f=gJ(d,_.Ua),g=uJ(gJ(d,_.Jb));var h=gJ(d,_.Jb).toUpperCase();if(uJ(h)!==_.G)h=null;else{var k=d.getAttribute("FORCED");k=!(!k||!k.value||"YES"!==k.value.toUpperCase());var l=_.dB;h===UI&&(l=_.Xz);k&&(l=_.Vd);h=l}k=c.get(f)||"";l=_.I(d,_.ab);const m=_.I(d,"NAME"),
|
|
51
|
+
n=d.getAttribute("DEFAULT"),r=d.getAttribute("AUTOSELECT");var v=_.I(d,"CHANNELS");v=g===_.p?v?parseInt(v.split("/")[0],10):null:null;var u=g===_.p?(u=_.I(d,"CHANNELS"))?u.includes("/JOC"):!1:!1;return yield rL(a,{playlist:e,codecs:k,type:g,hd:l,primary:!!n&&!!r,name:m,channelsCount:v,spatialAudio:u,groupId:f,kind:h,closedCaptions:null,Wd:null})}))})},BL=function(a,b){return _.x(function*(){const c=b.tag,d=b.playlist;return DL(a,d.a,()=>_.x(function*(){var e=_.I(c,_.pa)||"jpg",f=_.I(c,_.ab);const g=
|
|
52
|
+
_.I(c,"NAME");e=yield rL(a,{playlist:d,codecs:e,type:_.ae,hd:f,name:g,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,Wd:null});(f=_.I(c,_.ma))&&EK(e,Number(f));return e}))})},AL=function(a,b,c,d,e){return _.x(function*(){var f=b.tag,g=Number(gJ(f,_.ma));if(null!=f.getAttribute("FRAME-RATE")||null!=f.getAttribute(_.Ab)){var h=_.I(f,"FRAME-RATE");f=_.I(f,_.Ab);var [k,l]=f?f.split("x"):[null,null];h={frameRate:iJ(h),width:iJ(k),height:iJ(l)}}else h=null;if(f=
|
|
53
|
+
yield EL(a,b,h,c,d)){h=f.video;f=f.audio;var m=0<f.length?f:[null];h=0<h.length?h:[null];f=[];for(const n of m)for(const r of h){m=(r?IJ(r).Ha:"")+" - "+(n?IJ(n).Ha:"");if(e.has(m)){a.g.debug("Skipping variant which only differs in text streams.");continue}const v=fL(a,n,r,g);null==v?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(f.push(v),e.add(m))}g=f}else g=[];return g})},EL=function(a,b,c,d,e){return _.x(function*(){var f=b.tag,g=b.playlist;let h=wL(a,f);var k=_.I(f,"AUDIO"),l=_.I(f,
|
|
54
|
+
_.Rb),m=k||l;m=m&&d.has(m)?d.get(m):[];k={audio:k?m:[],video:l?m:[]};a.g.debug("Guessing stream type for",f.toString());f=!1;const n=g.a;g=k.audio.find(r=>r.Ha===n);l=_.tj(_.w,h);l=c||l;1!==h.length||l?!m.length&&1<h.length?(a.g.debug("Guessing multiplexed audio+video"),g=_.w,h=[h.join(",")]):k.audio.length&&g?(a.g.debug(ZI),g=_.p,f=!0):k.video.length?(a.g.debug(ZI),g=_.p):(a.g.debug("Guessing video-only"),g=_.w):(g=_.p,a.g.debug(ZI));l=null;f||(l=yield FL(a,b,h,g,e,c));if(null==l)return null;k[g]=
|
|
55
|
+
[l];g===_.p&&c&&m.forEach(r=>{BK(r,c.width);CK(r,c.height);DK(r,c.frameRate)});MJ(k);return k})},FL=function(a,b,c,d,e,f){return _.x(function*(){const g=b.tag,h=b.playlist;return DL(a,h.a,()=>_.x(function*(){var k=_.I(g,UI);let l=null;d===_.w&&k&&"NONE"!==k&&(l=e.get(k));k=xL(d,c);return yield rL(a,{playlist:h,codecs:k,type:d,closedCaptions:l,primary:!1,kind:null,hd:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,Wd:f})}))})},DL=function(a,b,c){if(a.f.has(b))return a=a.f.get(b),Promise.resolve(a);
|
|
56
|
+
if(a.f.f.has(b))return a.f.f.get(b)||null;c=c();a.f.set(b,c);return c},uL=function(a,b,c,d){return _.x(function*(){var e=b.a,f=b.V;var g=void 0===g?0:g;var h=(h=mJ(b.ca,_.Ha))?Number(h.value):g;g=[];!ZK(a)&&qK(f);e=yield GL(a,b.f,e,f,h,c,d);if(0===f.length)f=[];else{var k=[],l=[];for(var m of f)lJ(m.ca,_.Ca)&&0<l.length&&(k.push(l),l=[]),l.push(m);k.push(l);f=k}for(m=0;m<f.length;m++)k=f[m],l=yield HL(a,b.f,k,h,e,c,d,g[g.length-1]||null,f.length),g.push(l),h+=k.length;IL(g);return g})},CL=function(a,
|
|
57
|
+
b){return _.x(function*(){var c="EXT-X-MEDIA"!==b.name?!0:_.I(b,_.Jb)===bJ;c=_.I(b,_.Lb,void 0,{required:c});if(!c)return null;const d=oJ(a.w,c),{response:e,text:f}=yield VK(a,d);return WK(a,f,e.uri,c)})},iL=function(a){1===a.type&&a.V.forEach((b,c)=>{if(lJ(b.ca,_.Ga)&&!lJ(b.ca,_.Ca)&&0<c)throw new _.H(_.E,4,4046,"Media playlist contains an EXT-X-MAP tag not accompanied by an EXT-X-DISCONTINUITY tag.");})},IL=function(a){if(1<(new Set(a.map(b=>b.mimeType))).size)throw new _.H(_.E,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");
|
|
58
|
+
},JL=function(a){a=a.map(b=>b.a?b.a:b.f.map(c=>_.I(c,_.Lb))||null).map(b=>_.xs(b));if(1<(new Set(a)).size)throw new _.H(_.E,4,4044,"Unexpected change in file format.");},KL=function(a,b,c){a=jJ(a.ca,_.Ga);if(1<a.length)throw new _.H(_.E,4,4020);a=a[0];if(!a)return null;const d=gJ(a,_.Lb),e=oJ(b,d);b=zJ(a,null,!0);return new _.EI(()=>[e],b.wa,b.la,c)},LL=function(a,b,c,d,e,f,g){const h=[];for(const r of _.KB(b.f)){b=r.Df;const v=r.item;{var k=0===b,l=k?a:h[h.length-1],m=k?d:l.endTime,n=Number(_.I(v,
|
|
59
|
+
WI));n=m+n;k=zJ(v,k?null:l.la,k);l=_.I(v,_.Lb);const u=(l=oJ(g,l))?[l]:[];m=new AJ(c,m,n,()=>u,k.wa,k.la,e,f,!1,null,null,null,null);if("YES"===_.I(v,"INDEPENDENT")||0===b)m.h=!0;h.push(m)}}return h},ML=function(a,b,c,d,e,f,g,h,k,l,m){const n=c.ca;var r=c.a;const v=null!=r,u=r?[r]:[];if(!v&&!a.a.lowLatencyMode)return null;a=0;r={wa:0,la:null};let y=null;v?({duration:c}=xJ(n),a=e+c,r=wJ(n,b?b.la:null)):(b=LL(b,c,d,e,f,g,k),a=b[b.length-1].endTime,y=b);h=h===_.ae?nJ(n):null;d=new AJ(d,e,a,()=>u,r.wa,
|
|
60
|
+
r.la,f,g,!1,null,h?h.bd:null,h?h.ud:null,h?h.durationPerTile:null,y);d.ka=l;d.initSegment=m||void 0;return d},GL=function(a,b,c,d,e,f,g){return _.x(function*(){var h=d[0];if(null!=a.C)return a.C;if(!ZK(a)&&a.o)try{var k=a.f.get(c);var l=k?zK(k,e)||null:null;if(!l)throw new _.H(_.E,4,4030,"Segment not found in pervious playlist update.");var m=l.startTime+l.va;a.g.debug(`Setting playlist start time to ${m}.`);return a.C=m}catch(n){if(h=a.f.get(c))m=h.streams[h.streams.length-1].V,m=m[m.length-1],a.g.warn(`Last #EXT-X-MEDIA-SEQUENCE values ${h.streams[0].V[0].position} - ${m.position}`+
|
|
61
|
+
`, new values ${e} - ${e+d.length-1}.`,b,h);throw new _.H(_.E,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}m=yield NL(a,f,g,h);k=rK(h.ca,a.w,m)||mK();l=KL(h,b,k.keyInfo);k=CJ(k.keyInfo,e);h=yield OL(a,l,h,k,m,g);a.g.debug(`Setting playlist start time to ${h}.`);return a.C=h})},HL=function(a,b,c,d,e,f,g,h,k){return _.x(function*(){var l=c[0],m=null==h;JL(c);const n=yield NL(a,f,g,l);var r=a.w,v=h?h.Rg:null;var u=1===k;if(c.slice(1).some(pK))throw new _.H(_.E,
|
|
62
|
+
4,4046,u?"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(lJ(c[0].ca,_.Fa)||null===v)if((v=rK(c[0].ca,r,n))&&v.type===fJ){if(1<tK(c))throw new _.H(_.E,4,4046,cJ+`${u?"playlist":"discontinuity"}.`);u=[v]}else u=sK(c,r,n),u=0===u.length?[mK()]:u;else if(r=sK(c,r,n),v.type===
|
|
63
|
+
_.Be||v.type===eJ)u=[v,...r];else{if(0<tK(c))throw new _.H(_.E,4,4046,cJ+`${u?"playlist":"discontinuity"}.`);u=[v]}r=u;u=r[r.length-1];r=nK(r);v=KL(l,b,r.keyInfo)||(h?h.Ng:null);var y=CJ(r.keyInfo,d);const C=l.ka;l=m?e:yield PL(a,C,v,l,d,y,n,g);m=[];for(y=0;y<c.length;y++){var F=c[y];const N=m[m.length-1]||null,da=0===y?0:N.endTime,vb=d+y,Xb=CJ(r.keyInfo,vb);(F=ML(a,N,F,vb,da,l,Xb,f,b,C,v))&&m.push(F)}return{V:m,qg:r,Rg:u,mimeType:n,endTime:m[m.length-1].endTime,ka:C,Ng:v}})},NL=function(a,b,c,d){return _.x(function*(){const e=
|
|
64
|
+
d.a;var f=mJ(d.ca,_.Ga);f=f?gJ(f,_.Lb):null;return QL(a,b,c,e,f)})},OL=function(a,b,c,d,e,f){return _.x(function*(){if(null==c.a)return 0;const g=BJ(c,d);return xK(a.M,b,g,e,f,null!=d)})},PL=function(a,b,c,d,e,f,g,h){return _.x(function*(){if(a.H.has(b))return a.H.get(b);const k=yield OL(a,c,d,f,g,h);a.g.debug(`Segment #${e} has raw media timestamp `+`${k} s.`);a.H.set(b,k);return k})},QL=function(a,b,c,d,e){return _.x(function*(){const f=[d,e].filter(Boolean);var g=_.yj(f,b,c);if(g)return g;g=_.Oi([d],
|
|
65
|
+
a.a.attemptParameters);g.method="HEAD";g.type=2;g=(yield a.F(g)).headers["content-type"];if(!g)throw new _.H(_.E,4,4021,"Unknown MIME type of: "+f.join(", "));return g.split(";")[0]})},UJ=class{constructor(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.H(_.E,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.H(_.E,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.ca=c;this.V=1===b?d:null}},$J=class{constructor(a,
|
|
66
|
+
b,c){c=void 0===c?[]:c;this.ca=b;this.a=a;this.f=c;this.ka=-1}},AJ=class extends _.FC{constructor(a,b,c,d,e,f,g,h,k,l,m,n,r,v){v=void 0===v?[]:v;super(a,b,c,d,e,f,g,void 0===h?null:h,void 0===k?!1:k,void 0===l?null:l,void 0===m?null:m,void 0===n?null:n,void 0===r?null:r,v);this.initSegment=void 0;this.ka=0}},RL=class{constructor(){this.f=0;this.a=new Map}},SL=class{constructor(){this.a=new Map;this.f=new Map}set(a,b){this.f.set(a,b);return b.then(c=>this.a.set(a,c)).catch(()=>{}).then(()=>this.f.delete(a))}has(a){return this.a.has(a)}get(a){return this.a.get(a)||
|
|
67
|
+
null}values(){return Array.from(this.a.values())}clear(){this.f.clear();this.a.clear()}},cL=new _.S("clpp.hls.DiscontinuityUtils");var vK={"com.apple.streamingkeydelivery":function(a,b){if(b===_.fg)throw new _.H(_.E,4,4041);if(gJ(a,$I)===aJ)throw new _.H(_.E,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.FB(_.ud,[{initDataType:_.Ff,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":lK,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":lK,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=gJ(a,$I);if(!jK.includes(b))return kK.error("Widevine in HLS is only supported with [",
|
|
68
|
+
jK.join(", "),"], not",b),null;b=gJ(a,_.Lb);b=_.Kr(b);b=_.J(b.data);b=_.FB(_.yd,[{initDataType:_.Zc,initData:b}],"");if(a=_.I(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},jK=["SAMPLE-AES",aJ],kK=new _.S("clpp.hls.DrmParser");var uK=new _.S("clpp.hls.EncryptionUtils");var TL=class{constructor(a){this.g=new _.S("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Li()}}};var vL=class{constructor(a){this.streams=a}length(){return this.streams.length}};var tL=class{constructor(a){this.a=a}length(){return this.a.length}};var UL=class{constructor(){this.a=this.B=null;this.N=1;this.f=new SL;this.w="";this.K=new RL;this.D=0;this.j=null;this.h=new _.Pj(()=>{this.ob()});this.l=_.Sb;this.o=null;this.A=new _.Fs;this.C=null;this.g=new _.S("clpp.hls.HlsParser");this.H=new Map;this.M=new TL(this.F.bind(this));this.J=!1;this.G=null;this.I=!1}configure(a){this.a=a;this.M.a=a}setCurrentVariant(a){this.j=a}start(a,b){const c=this;return _.x(function*(){if(c.J)throw Error("start() may be called only once!");c.J=!0;c.B=b;const {response:d,
|
|
69
|
+
text:e}=yield VK(c,a);c.w=d.uri;const f=yield $K(c,e);c.o=f;const g=c.D;c.h&&0<g&&c.h.ia(g);return f})}requestStop(){this.I=!0}stop(){this.h&&(this.h.stop(),this.h=null);const 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)}update(){const a=this;return _.x(function*(){const b=a.o;if(!ZK(a)&&b){var c=b.presentationTimeline;"LIVE"===a.l&&(a.C=null);var d=Array.from(a.f.values());if(a.a.lowLatencyMode&&null!==a.j){const f=UK(a);
|
|
70
|
+
d=d.filter(g=>f.includes(IJ(g).Ha))}var e=yield bL(a,d);d=e.map(f=>f.playlist);dL(a,d);e=yield gL(a,e);GK(b.periods,e).forEach(f=>{a.B.filterNewPeriod(f)});YK(a,e);JK(b.periods,e);KK(b.adaptedPeriods,e);TK(c,e);if(d=rJ(d))!0!==a.a.keepTimelineLive&&hL(a,c,e),a.h.stop(),a.h=null;if(a.B.onUpdate)a.B.onUpdate(b);if(d&&a.B.onTurnedStatic)a.B.onTurnedStatic();a.I&&(yield a.stop())}})}ob(){const a=this;return _.x(function*(){a.g.debug(_.Cz);if(a.B)try{yield a.update(),a.h&&0<a.D&&a.h.ia(a.D)}catch(b){if(!(b instanceof
|
|
71
|
+
_.H))throw b;a.B&&(a.B.onError(b),1===b.severity&&a.h&&a.h.ia(.1))}})}F(a){if(!this.A)throw new _.H(_.E,7,7001);a=this.B.networkingEngine.fetch(a);_.Vi(this.A,a);return a.O}};_.z("clpp.hls.HlsComponent",class extends _.Gt{f(){_.kr.m3u8=UL;_.ir[_.Kk]=UL;_.ir[dJ]=UL}a(){_.dD("m3u8");_.eD(_.Kk);_.eD(dJ)}id(){return"hls"}});};f.call(g, window);
|
package/cl.hlssmpte.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
else a.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var qT=function(a){a.a.one(a.m,_.ke,()=>pT(a))},pT=function(a){const b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.sc,d=>rT(a,d));var c=Array.from(b.textTracks);c.filter(d=>d.kind===_.ve).forEach(d=>{rT(a,{track:d})});!sT(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."),tT(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");
|
|
2
|
+
else a.g.warn("A video element is not available. Skipping.")},rT=function(a,b){b=b.track;b.kind===_.ve&&(a.g.info("The metadata track has been added."),b.mode=_.Zd,a.a.on(b,_.Bd,c=>uT(a,c)))},sT=function(a){return a.some(b=>b.kind===_.ve)},tT=function(a,b){const c=a.m.getTrackManager(),d=c.na(),e=c.getAudioTracks().find(g=>g!==d);if(e){var f=()=>c.Da(d);a.a.on(b.textTracks,_.sc,g=>{g.track.kind===_.ve&&(a.a.off(b.textTracks,_.sc,f),c.Da(d))});c.Da(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},
|
|
3
|
+
uT=function(a,b){const c=vT(a);c&&Array.from(b.target.activeCues||[]).forEach(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 wT(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.oi(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});const f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},vT=function(a){return(a=a.m.getTrackManager().za())&&a.language&&a.language.toLowerCase()},
|
|
4
|
+
wT=class{constructor(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.A(a)){a:{var b=a.info;if(_.Sg(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=a=_.Sg(a)?a:null}}};var xT=class{constructor(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.$r;this.h=(a=_.Or(_.Cc))?new a(this.m.getConfiguration()):null;this.g=new _.S("clpp.hlssmpte.ImageCueHandler");this.f=null;qT(this)}destroy(){this.a.release();this.f=null;return Promise.resolve()}};var yT=class extends _.iu{constructor(){super();this.a=null;this.f=!1}onPlayerCreated(){}onContentWillLoad(a){if(this.f=_.dk()){var b=a.getConfiguration();b=_.Mg(b.hlssmpte||{});typeof b.patchMetadataTrack!==_.Oc&&(b.patchMetadataTrack=!1);_.Tg(b.timestampOffset)||(b.timestampOffset=0);this.a=new xT(a,b.patchMetadataTrack,b.timestampOffset)}}onPlayerWillDestroy(){const a=this;return _.x(function*(){a.a&&(yield a.a.destroy(),a.a=null)})}id(){return"hlssmpte"}};_.z("clpp.hlssmpte.HlsSmptePlugin",yT);
|
|
5
|
+
yT.Id="hlssmpte";_.Wo(new class{create(){return new yT}});};f.call(g, window);
|