@castlabs/prestoplay 6.23.1 → 6.24.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 +14 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +113 -113
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +608 -591
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +87 -86
- package/cjs/cl.externs.js +94 -30
- package/cjs/cl.freewheel.js +25 -24
- package/cjs/cl.hls.js +73 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +344 -339
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +37 -37
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +492 -478
- package/cl.crypto.js +9 -9
- package/cl.dash.js +81 -80
- package/cl.externs.js +94 -30
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +75 -74
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +307 -305
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +28 -28
- package/package.json +1 -1
- package/typings.d.ts +44 -10
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 _.
|
|
3
|
-
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.L.bind(a));a.j.on(a.a,tv.freewheel.SDK.EVENT_AD,a.J.bind(a));a.j.on(a.m,_.
|
|
4
|
-
a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},
|
|
5
|
-
!0),a.getSurface().hide(this.a);else a.onError(new _.
|
|
6
|
-
0}getPosition(){return 0}getSkipTimeOffset(){return 0}
|
|
7
|
-
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.
|
|
8
|
-
Y.prototype.getVideoElement=Y.prototype.
|
|
9
|
-
Y.prototype.getMediaHeight=Y.prototype.
|
|
10
|
-
Y.prototype.getApiFramework=Y.prototype.getApiFramework;Y.prototype.getSourceId=Y.prototype.
|
|
11
|
-
|
|
12
|
-
_.t||a.a.setSiteSection(b.siteSectionId);const c=yield
|
|
13
|
-
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);
|
|
14
|
-
a.w&&(a.w.stop(),a.w=null);
|
|
15
|
-
9,10003,{errorType:0},void 0));this.A.resolve()}M(a){
|
|
16
|
-
_.
|
|
17
|
-
_.
|
|
18
|
-
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.B.findIndex(c=>c===this.f);this.B.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 sV="clpp-freewheel",tV="clpp.freewheel.AdsManagerFactory",uV="freewheel",vV=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""}},wV=function(a){const b=[];typeof a.networkId!==_.t&&b.push("networkId");typeof a.serverUrl!==_.bg&&b.push("serverUrl");typeof a.profileId!==_.bg&&b.push("profileId");typeof a.videoAssetId!==_.bg&&typeof a.videoAssetId!==_.t&&b.push("videoAssetId");
|
|
2
|
+
if(b.length)throw new _.I(1,9,12001,{missingKeys:b.join(", ")});},xV=function(){return _.x(function*(){var a=new _.Pv;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})},yV=function(a){a.j.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.K.bind(a));a.j.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.M.bind(a));a.j.on(a.a,
|
|
3
|
+
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.L.bind(a));a.j.on(a.a,tv.freewheel.SDK.EVENT_AD,a.J.bind(a));a.j.on(a.m,_.ng,a.I.bind(a));a.j.on(a.m,_.Zf,a.H.bind(a))},BV=function(a){return _.x(function*(){a.G.length?(zV(a),a.f=a.G.shift(),a.f.play()):(AV(a),yield a.m.a.play())})},AV=function(a){const b=a.m.ed(uV).Nc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},zV=function(a){const b=a.m.ed(uV).Nc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(sV),
|
|
4
|
+
a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},CV=function(a){a.F.length?(zV(a),a.f=a.F.shift(),a.f.play()):AV(a)},DV=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))},EV=class extends _.Xv{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Cp(_.Sd,{id:sV}),this.f=_.Cp(_.w,{"class":_.od}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,
|
|
5
|
+
!0),a.getSurface().hide(this.a);else a.onError(new _.I(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return uV}Nc(){return this.a}ph(){return this.f}};_.z("clpp.freewheel.FreeWheelPlugin",EV);EV.prototype.getAdVideo=EV.prototype.ph;EV.prototype.getAdContainer=EV.prototype.Nc;EV.Id=uV;EV.AD_CONTAINER_ID=sV;_.Mr(new class{create(){return new EV}});var Y=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}sb(){return"FreeWheel AdManager SDK"}tb(){return tv.freewheel.SDK.version}xb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.bg?a:""}Sb(){return""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
|
|
6
|
+
0}getPosition(){return 0}getSkipTimeOffset(){return 0}Vb(){return!1}ub(){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():""}ib(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}hb(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}Ta(){return 0}Ua(){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.Ua()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}Ib(){switch(this.Ua()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}wb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}jb(){return this.f.getAdCount()}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}Ub(){return null}};
|
|
8
|
+
Y.prototype.getVideoElement=Y.prototype.Ub;Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.canSeek=Y.prototype.canSeek;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.jb;Y.prototype.getPositionInSequence=Y.prototype.wb;Y.prototype.getPodTimeOffset=Y.prototype.Ib;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Ua;
|
|
9
|
+
Y.prototype.getMediaBitrate=Y.prototype.Ta;Y.prototype.getMediaHeight=Y.prototype.hb;Y.prototype.getMediaWidth=Y.prototype.ib;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.ub;Y.prototype.isBumper=Y.prototype.Vb;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getPosition=Y.prototype.getPosition;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;
|
|
10
|
+
Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;Y.prototype.getSourceId=Y.prototype.Sb;Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.xb;Y.prototype.getAdManagerVersion=Y.prototype.tb;Y.prototype.getAdManagerName=Y.prototype.sb;var FV=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()}})}Lb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}Kb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
|
|
11
|
+
FV.prototype.hasPostroll=FV.prototype.Kb;FV.prototype.hasPreroll=FV.prototype.Lb;FV.prototype.getCuePoints=FV.prototype.getCuePoints;var GV=class{constructor(a){this.g=new _.S("clpp.freewheel.AdsManager");this.m=a;this.j=new _.Rt;this.C=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.G=[];this.B=[];this.F=[];this.A=new _.qn;this.w=null}load(){const a=this;return _.x(function*(){const b=a.m.getConfiguration().freewheel||{};try{wV(b)}catch(d){return a.m.onError(d),a.A.resolve(),a.A}a.C.setNetwork(b.networkId);a.C.setServer(b.serverUrl);a.a=a.C.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.bg&&typeof b.siteSectionId!==
|
|
12
|
+
_.t||a.a.setSiteSection(b.siteSectionId);const c=yield xV();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,vV(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Re&&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);yV(a);a.a.submitRequest();return a.A})}start(){const a=this;return _.x(function*(){yield BV(a)})}o(){}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}l(){return!0}h(){const a=this;return _.x(function*(){a.j.release();
|
|
14
|
+
a.w&&(a.w.stop(),a.w=null);AV(a);a.a&&(a.a.dispose(),a.a=null)})}K(a){if(a.success)this.G=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.F=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.D(_.Ec,{adsTimeline:new FV(this.a)})),this.w=new _.Nv(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.ed(uV).f);else this.m.onError(new _.I(1,
|
|
15
|
+
9,10003,{errorType:0},void 0));this.A.resolve()}M(a){DV(this,_.hc,a);this.w.start()}L(a){this.f=null;a=a.slot;DV(this,_.ic);this.w.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:BV(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:AV(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:CV(this)}}J(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:DV(this,_.yc,a);DV(this,
|
|
16
|
+
_.qc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:DV(this,_.Bc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:DV(this,_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:DV(this,_.sc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:DV(this,_.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:DV(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:DV(this,_.kc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:DV(this,_.tc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:DV(this,
|
|
17
|
+
_.vc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:DV(this,_.xc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:DV(this,_.jc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:DV(this,_.uc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.I(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]}))}}I(){if(!this.f){var a=this.m.getPosition();if(this.f=this.B.find(b=>
|
|
18
|
+
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.B.findIndex(c=>c===this.f);this.B.splice(b,1);this.m.pause();zV(this);this.f.play()}}}H(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.jp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.ip:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Zo:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);CV(this);break;case _.gp:case _.$o:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
|
|
19
|
+
GV.prototype.getPosition=GV.prototype.getPosition;GV.prototype.setVolume=GV.prototype.setVolume;GV.prototype.getVolume=GV.prototype.getVolume;GV.prototype.skip=GV.prototype.skip;GV.prototype.pause=GV.prototype.pause;GV.prototype.resume=GV.prototype.resume;_.Ap(new class{constructor(){this.Wa=new _.S(tV)}name(){return tV}a(a,b){return a.namespace()!==_.td&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Wa.warn("FreeWheel SDK is not loaded."),!1):!1}create(a){return new GV(a)}});};f.call(g, window);
|
package/cl.hls.js
CHANGED
|
@@ -1,74 +1,75 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
b))return!1;const d=a[c],e=b[c];if(d&&typeof d===_.
|
|
3
|
-
b&&(yield{
|
|
4
|
-
c.add(d)})},
|
|
5
|
-
b,c){c=void 0===c?!0:c;a=new _.
|
|
6
|
-
_.Da))return _.
|
|
7
|
-
if(d[1]){if(d=Number(d[1]),0>d)throw new _.
|
|
8
|
-
null}},
|
|
9
|
-
0,0,()=>[a.a],c.
|
|
10
|
-
a.video.
|
|
11
|
-
for(const c of a){a=_.J(c,_.$a);a=_.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
b.
|
|
15
|
-
g.push(h):h.name===_.
|
|
16
|
-
|
|
17
|
-
a[
|
|
18
|
-
g.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
a=a.
|
|
23
|
-
|
|
24
|
-
b=a
|
|
25
|
-
const f=_.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
0
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
a
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
a.
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var vK="CLOSED-CAPTIONS",wK="Could not parse MP4 segment start time.",xK="DURATION",yK="EXT-X-MEDIA",zK="EXT-X-STREAM-INF",AK="Failed to infer discontinuity number",BK="Guessing audio-only",CK="METHOD",DK="SAMPLE-AES-CTR",EK="SUBTITLES",FK="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",GK="application/vnd.apple.mpegurl",HK="sample",IK="whole-segment",JK=function(a,b){return _.J(a,b,void 0,{required:!0})},KK=function(a){if(1>a.a)throw _.mm();--a.a},LK=function(a,
|
|
2
|
+
b){for(const c in a){if(!(c in b))return!1;const d=a[c],e=b[c];if(d&&typeof d===_.Re&&e&&typeof e===_.Re){if(!LK(d,e))return!1}else if(void 0!==d&&void 0!==e&&d!==e)return!1}return!0},MK=function(a,b){if(!LK(a,b))return!1;for(const c in b){if(!(c in a))return!0;const d=a[c],e=b[c];if(!d&&e||d&&typeof d===_.Re&&e&&typeof e===_.Re&&MK(d,e))return!0}return!1},NK=function(a){if(null!==a&&void 0!==a)return Number(a)},OK=function*(a){let b=-1,c=void 0,d=void 0;for(const e of a)0<=b&&(yield{Yf:b,item:d,
|
|
3
|
+
Yh:c,next:e}),b++,c=d,d=e;-1!==b&&(yield{Yf:b,Yh:c,item:d,next:void 0})},PK=function(a,b){return a.filter(c=>c.name===b)},QK=function(a){const b=/^[a-zA-Z0-9_-]+$/,c=new Set;a.forEach(d=>{const e=_.J(d,"VALUE"),f=_.J(d,_.gb),g=_.J(d,"IMPORT"),h=_.J(d,"QUERYPARAM");if(1!==[f,g,h].filter(Boolean).length||f&&null==e)throw new _.I(_.F,4,4044,{message:"Invalid tag.",text:d.toString()});d=f||g||h;if(c.has(d))throw new _.I(_.F,4,4044,`EXT-X-DEFINE redefined variable "${d}".`);if(!b.test(d))throw new _.I(_.F,
|
|
4
|
+
4,4044,`EXT-X-DEFINE invalid variable name "${d}".`);c.add(d)})},RK=function(a,b){const c=Array.isArray(b)?b:[b];return a.filter(d=>{d=JK(d,_.Fb);return c.includes(d)})},SK=function(a,b){return a.some(c=>c.name===b)},TK=function(a,b,c){c=void 0===c?{}:c;a=a.find(d=>d.name===b)||null;if(!a&&c.required)throw new _.I(_.F,4,4024,{missingTag:b});return a},UK=function(a){var b=TK(a,"EXT-X-TILES");if(!b)return{gd:1,Dd:1,durationPerTile:null};a=_.J(b,"LAYOUT")||"1x1";b=_.J(b,xK);a=_.kD(a);return{gd:a.gd,
|
|
5
|
+
Dd:a.Dd,durationPerTile:b?Number(b):null}},VK=function(a,b,c){c=void 0===c?!0:c;a=new _.Bi(a);b=new _.Bi(b);b=a.resolve(b).toString();return c?b:decodeURI(b)},WK=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)},XK=function(a,b){Array.isArray(a)||(a=[a]);a.forEach(c=>{for(const d of WK(c))b(d,c)})},YK=function(a){return a.some(b=>SK(b.ca,_.Da))},ZK=function(a){return a.type===
|
|
6
|
+
_.p||a.type===_.w},$K=function(a){if(TK(a,_.Da))return _.Tb;a=TK(a,_.Ja);if(!a)return"LIVE";if(a.value===_.Tb)return _.Tb;if("EVENT"===a.value)return"EVENT";throw new _.I(_.F,4,4044,`Invalid EXT-X-PLAYLIST-TYPE value: ${a.value}`);},aL=function(a){a={AUDIO:_.p,VIDEO:_.w,SUBTITLES:_.H,"CLOSED-CAPTIONS":_.H}[a.toUpperCase()];if(!a)throw new _.I(_.F,4,4044,"EXT-X-MEDIA tag has an invalid TYPE attribute.");return a},bL=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]);
|
|
7
|
+
if(0>=a)throw new _.I(_.F,4,4044,"Byte range length must be positive.");if(d[1]){if(d=Number(d[1]),0>d)throw new _.I(_.F,4,4044,"Byte range start byte must not be negative.");}else{if(c)throw new _.I(_.F,4,4044,"Invalid byte range, offset is required but missing.");if(null==b)throw new _.I(_.F,4,4044,"Invalid byte range, cannot calculate offset based on previous byte ranges.");d=b+1}e=d+a-1}return{za:d,qa:e}},cL=function(a,b){a=TK(a,_.za);return bL(a?a.value:null,b)},dL=function(a){a=TK(a,"EXTINF",
|
|
8
|
+
{required:!0}).value.split(",");return{duration:Number(a[0]),title:a[1]||null}},eL=function(a,b){b=void 0===b?{}:b;const c={Ef:!1,Yg:!1,Zg:null,Dh:null,mg:null};a=TK(a,_.Ma,{required:b.rg});if(!a)return c;const d=e=>null==e?null:Number(e);c.Ef="YES"===_.J(a,"CAN-BLOCK-RELOAD");c.Yg="YES"===_.J(a,"CAN-SKIP-DATERANGES");c.Zg=d(_.J(a,"CAN-SKIP-UNTIL"));c.Dh=d(_.J(a,"HOLD-BACK"));c.mg=d(_.J(a,"PART-HOLD-BACK",void 0,{required:b.rg}));return c},fL=function(a,b,c){c=void 0===c?!1:c;a=_.J(a,"BYTERANGE");
|
|
9
|
+
return bL(a,b,c)},gL=function(a){const b=PK(a,yK),c=PK(a,zK);a=PK(a,"EXT-X-IMAGE-STREAM-INF");return{yc:{zf:RK(b,[_.CB,_.Sb]),closedCaptions:RK(b,vK),si:RK(b,EK)},Ed:c,Ae:a}},iL=function(a,b){const c=cL(a.ca,null);return new hL(0,0,0,()=>[a.a],c.za,c.qa,0,b)},jL=function(a,b){if(null==a)return null;a=Object.assign({},a);null==a.iv&&(a.iv=_.wj(new Uint8Array(12),new Uint8Array([b>>24&255,b>>16&255,b>>8&255,b&255])));return a},kL=function(a){let b=Infinity,c=Infinity;WK(a).filter(ZK).forEach(d=>{{d=
|
|
10
|
+
d.T;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{Rc:b,duration:c}},lL=function(a){return a.map(b=>{({duration:b}=kL(b));return b}).reduce((b,c)=>b+c,0)},mL=function(a){return(a.video?a.video.Ga:"")+" - "+(a.audio?a.audio.Ga:"")},nL=function(a,b,c,d,e){if(b===_.Tb)return{delay:0,Cd:0};b=TK(a,_.Ia);if(c&&b){e=Number(JK(b,"PART-TARGET"));if(null!=d)return{delay:d,Cd:e};({mg:d}=eL(a,{rg:!0}));return{delay:d,Cd:e}}a=TK(a,_.Oa,{required:!0});a=Number(a.value);
|
|
11
|
+
e=e||a;return null!=d?{delay:d,Cd:e}:{delay:3*a,Cd:e}},pL=function(a){const b=new Map;a.forEach(c=>{var d=`${oL(c).type}:${oL(c).groupId}`;b.has(d)?(d=b.get(d),d.includes(c)||d.push(c)):b.set(d,[c])});return b},qL=function(a){const b=new Map;for(const c of a){a=_.J(c,_.$a);a=_.Pi(a||_.sg);const d=JK(c,_.Ua),e=JK(c,"INSTREAM-ID");b.has(d)||b.set(d,new Map);b.get(d).set(e,a)}return b},rL=function(a){return a.filter(b=>"mp4a.40.34"!==b)},sL=function(a,b){if(!a)return null;const c=a.Ga;return b.find(d=>
|
|
12
|
+
oL(d).Ga===c)||null},tL=function(a){return(a=_.J(a,"CHANNELS"))?parseInt(a.split("/")[0],10):null},uL=function(a){for(const b of a)if(b.startsWith("#EXT-")&&(a=_.Dj(0,b),_.qu.has(a.name)))return 1;return 0},vL=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,(c,d)=>{c=b.get(d);if(null==c)throw new _.I(_.F,4,4044,`Undefined variable '${d}'`);return c})},wL=function(a,b){a.forEach(c=>{c.attributes.forEach(d=>{d.value=vL(d.value,b)})})},xL=function(a,b,c){wL(a,c);b.forEach(d=>{d.a&&(d.a=vL(d.a,
|
|
13
|
+
c));wL(d.ca,c);wL(d.f,c)})},yL=function(a,b){const c=new Map,d=new URL(b);a.forEach(e=>{var f=_.J(e,_.gb),g=_.J(e,"QUERYPARAM");if(f)g=JK(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.I(_.F,4,4044,`Query param '${g}' missing in playlist URI.`);if(!f)throw new _.I(_.F,4,4044,`Query param '${g}' has no associated value`+" in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},BL=function(a,b,c){const d=[];for(let e=1;e<b.length;e++){const f=zL(a,b[e]);d.push(f);
|
|
14
|
+
if(f.name===zK){const g=b[e+1];if(!g)throw new _.I(_.F,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.zj(_.Hb,g));e++}}b=PK(d,"EXT-X-DEFINE");QK(b);b=yL(b,c);a.a=b;xL(d,[],a.a);return new AL(c,0,d)},EL=function(a,b,c){let d=[];for(var e=1;e<b.length;){const f=zL(a,b[e]);if(_.ru.has(f.name))break;d.push(f);e++}b=CL(a,c,b.slice(e));e=b.T;d=d.concat(b.ca);a=DL(a,d,c);xL(d,e,a);return new AL(c,1,d,b.T)},FL=function(a,b,c){b=b.trim().split(/\n+/m).map(d=>d.trim()).filter(d=>
|
|
15
|
+
d.length&&!/^#(?!EXT)/m.test(d));if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.I(_.F,4,4015);return 0===uL(b)?BL(a,b,c):EL(a,b,c)},zL=function(a,b){return _.Dj(a.h++,b)},CL=function(a,b,c){const d=[],e=[];let f=[],g=[];c.forEach(h=>{/^(#EXT)/.test(h)?(h=zL(a,h),_.qu.has(h.name)||_.tu.has(h.name)?d.push(h):_.su.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Ka&&"PART"===_.J(h,_.Fb)&&g.push(h):f.push(h)):/^#(?!EXT)/m.test(h)||(h=VK(b,h.trim(),!1),e.push(new GL(h,f,g)),f=[],g=[])});0<g.length&&
|
|
16
|
+
e.push(new GL(null,f,g));return{T:e,ca:d}},DL=function(a,b,c){b=PK(b,"EXT-X-DEFINE");QK(b);const d=yL(b,c);b.map(e=>_.J(e,"IMPORT")).filter(Boolean).forEach(e=>{const f=a.a.get(e);if(null==f)throw new _.I(_.F,4,4044,`Cannot import variable '${e}' as it is not defined `+"in the master playlist");d.set(e,f)});return d},HL=function(a,b,c){const d=[],e=[];e.push(new _.zj(_.la,"0"));e.push(new _.zj(_.Hb,b));c.length&&e.push(new _.zj(_.oa,c));d.push(new _.Cj(a.h++,zK,e));return new AL(b,0,d)},IL=function(a){return 0>
|
|
17
|
+
a?[]:Array.from({length:a},(b,c)=>c)},JL=function(a,b=0){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+9]?!0:!1},KL=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 _.I(_.F,4,4030);}JL(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],
|
|
18
|
+
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===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}}JL(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},LL=function(a,b){let c=null,d=0;try{(new _.Cm).N(_.Ne,_.vm).N(_.pg,_.vm).N(_.Ie,_.vm).ea("mdhd",g=>{g.reader.skip(0===g.version?8:16);d=_.P(g.reader);
|
|
19
|
+
g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.Rv.error("Unable to find timescale in init segment!"),new _.I(_.F,4,4030,wK,c);let e=0,f=!1;try{(new _.Cm).N("moof",_.vm).N("traf",_.vm).ea("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,
|
|
20
|
+
!0)}catch(g){c=g}if(c||!f)throw new _.I(_.F,4,4030,wK,c);return e},ML=function(a){for(;a.getPosition()<a.Sa()-1;){const b=a.getPosition();if(71===_.nm(a))return KK(a),b}return-1},NL=function(a){function b(){d.seek(e+188);f=_.nm(d);71!==f&&(d.seek(e+192),f=_.nm(d));71!==f&&(d.seek(e+204),f=_.nm(d));71!==f&&c();KK(d)}function c(){throw new _.I(_.F,4,4030);}const d=new _.zn(new DataView(a),!1);let e=0,f=0;e=ML(d);0>e&&(_.Rv.error("Unable to find sync byte in TS after scanning."),c());for(;;){e=d.getPosition();
|
|
21
|
+
f=_.nm(d);71!==f&&c();a=_.om(d);if(8191===(a&8191)){b();continue}if(!(a&16384)){b();continue}a=(_.nm(d)&48)>>4;0!==a&&2!==a||c();3===a&&(a=_.nm(d),d.skip(a));if(1!==_.P(d)>>8){b();continue}d.skip(3);a=_.nm(d)>>6;0!==a&&1!==a||c();0===_.nm(d)&&c();a=_.nm(d);const g=_.om(d),h=_.om(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}},QL=function(a){const b=OL(a),c=PL(a);a.forEach(d=>{const e=d.T,f=e.findIndex(h=>h.pa===b);let g=e.findIndex(h=>h.pa===c+1);-1===g&&(g=e.length);d.T=e.slice(f,
|
|
22
|
+
g)})},PL=function(a){a=a.map(b=>b.T[b.T.length-1].pa);return Math.min(...a)},OL=function(a){a=a.map(b=>b.T[0].pa);return Math.max(...a)},TL=function(a){var b=JK(a,CK);if(!RL.includes(b))return SL.error("PlayReady in HLS is only supported with [",RL.join(", "),"], not",b),null;a=JK(a,_.Hb);b=_.zt(a);a=null;b=_.K(b.data);try{a=_.TC(_.Hn(b))}catch(c){a=b}return _.gD(_.Hd,[{initDataType:_.jd,initData:a}],"")},VL=function(a){if(0===a.length)return UL();if(a.some(c=>c.type===IK)||a.every(c=>c.type===_.Qe))return a[0];
|
|
23
|
+
a=a.filter(c=>c.type===HK);const b=_.si(a.flatMap(c=>c.drmInfos));return{keyInfo:null,keyId:a[a.length-1].keyId,type:HK,drmInfos:b}},YL=function(a){a=WL(a);if(a.some(b=>XL(b))&&1<a.length)throw new _.I(_.F,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},XL=function(a){return PK(a.ca,_.Fa).some(b=>"AES-128"===_.J(b,CK))},$L=function(a,b,c){return WL(a).map(d=>ZL(d.ca,b,c))},aM=function(a){return a.filter(b=>SK(b.ca,_.Fa)).length},WL=function(a){return a.filter(b=>
|
|
24
|
+
SK(b.ca,_.Fa))},ZL=function(a,b,c){a=PK(a,_.Fa);if(0===a.length)return null;var d=JK(a[0],CK);if(1===a.length){if("NONE"===d)return UL();if("AES-128"===d)return a=a[0],d=_.J(a,"IV",""),{type:IK,keyInfo:{method:"AES-128",url:VK(b,JK(a,_.Hb)),iv:d?_.tj((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(e=>JK(e,CK));if(!b.every(e=>"SAMPLE-AES"===e)&&!b.every(e=>e===DK))throw bM.warn(`EXT-X-KEY methods ${b.join(", ")} are incompatible.`),new _.I(_.F,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");
|
|
25
|
+
b=a.map(e=>{const f=_.J(e,"KEYFORMAT","identity");{const g=cM[f]||null;e=g?g(e,c):null}e||bM.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.I(_.F,4,4026);return{keyInfo:null,keyId:b.map(e=>e.keyIds).reduce((e,f)=>e.concat(f),[]).reverse()[0]||null,type:HK,drmInfos:b}},UL=function(){return{type:_.Qe,keyInfo:null,drmInfos:[],keyId:null}},dM=function(a,b,c){return _.x(function*(){const d=b.f(),e=_.OD(b.ab(),b.za,b.za+2048-1,a.a.attemptParameters);e.type=2;
|
|
26
|
+
const f=_.OD(b.ab(),b.za,b.qa,a.a.attemptParameters);f.type=2;d&&(f.keyInfo=d);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 _.I(_.F,4,4030,"Failed to fetch the media segment.");
|
|
27
|
+
}}})},eM=function(a,b,c,d,e,f){return _.x(function*(){a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Sc||d===_.Rc)return 0;if(d===_.Qc){var g=yield dM(a,c,f);g=_.K(g.data);if(!JL(g))throw new _.I(_.F,4,4030,"AAC segment does not contain an ID3 tag.");return KL(g)}if(d===_.Hg||d===_.Tc)return g=[dM(a,c,f)],b&&g.push(dM(a,b,!0)),g=yield Promise.all(g),LL(g[0].data,(g[1]||g[0]).data);if(d===_.Gg)return g=yield dM(a,c,f),NL(g.data);if(!_.Hs(`${d.split("/")[0]||""}/mp4;codecs="${e}"`))return 0;
|
|
28
|
+
throw new _.I(_.F,4,4030);})},fM=function(a,b){a=a.map(c=>c.streams[b]);return a.some(c=>null==c)?null:a},gM=function(a,b){a=a.streams.find(c=>{c=c.T;return c[0].position<=b&&b<=c[c.length-1].position});return null==a?null:a.T.find(c=>c.position===b)||null},oL=function(a){return a.streams[0]},hM=function(a,b){a.streams.forEach(c=>{c.le=b})},iM=function(a,b){a.streams.forEach(c=>{c.width=b})},jM=function(a,b){a.streams.forEach(c=>{c.height=b})},kM=function(a,b){a.streams.forEach(c=>{c.frameRate=b})},
|
|
29
|
+
lM=function(a,b){a.streams.forEach(c=>{c.bandwidth=b})},mM=function(a,b){a=a.map(c=>c.a[b]);return a.some(c=>null==c)?null:a},nM=function(a,b){const c=new Set(a.map(d=>d.pa));return b.filter(d=>!c.has(d.pa))},pM=function(a,b){for(;a[0].pa<b[0].pa;)a.splice(0,1);var c=a[0];let d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||oM(c,d);const e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&oM(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},uM=function(a,b,c,d,e){var f=
|
|
30
|
+
b[0].length();f=IL(f).map(g=>{var h=mM(b,g)||[];const k=fM(c,g)||[];g=fM(d,g)||[];{const l=[...qM(h),...k,...g].filter(Boolean);rM(l);const {pa:m,duration:n}=l[0];h={configurationId:a,variants:h,textStreams:k,thumbStreams:g,startTime:0,id:`P${m}`,endTime:n,duration:n,pa:m}}return h});e&&sM(f[0]);tM(f);return f},qM=function(a){a=new Set(a.flatMap(b=>[b.video,b.audio]).filter(Boolean));return Array.from(a)},sM=function(a){const b=qM(a.variants)[0].T[0].Fa;a.startTime+=b;a.endTime+=b},tM=function(a){for(let b=
|
|
31
|
+
0;b<a.length;b++){const c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},oM=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;vM(a.variants,b.variants);wM(WK(a),WK(b))},vM=function(a,b){const c=new Map(a.map(d=>[mL(d),d]));b.forEach(d=>{c.get(mL(d)).drmInfos=d.drmInfos})},wM=function(a,b){const c=new Map(a.map(d=>[d.Ga,d]));b.forEach(d=>{const e=c.get(d.Ga);e.T=d.T;d.T.forEach(f=>{f.initSegment=e.initSegmentReference});e.segmentIndex.replace(d.T);
|
|
32
|
+
e.Rc=d.Rc;e.Ee=d.Ee;e.duration=d.duration;e.Lf=d.Lf;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},rM=function(a){const b=xM(a);a.forEach(c=>{_.KD(c.segmentIndex,b);c.duration=b;c.Ee=c.Rc+b})},xM=function(a){let b=Infinity;a.filter(ZK).forEach(c=>{b=Math.min(b,c.duration)});return b},yM=function(a,b){XK(b,(c,d)=>{_.XD(a,c.T,d.startTime)});_.PD(a.a,b[0].startTime,b[b.length-1].endTime)},zM=function(a){return null===a.l?[]:[a.l.audio,a.l.video].filter(b=>b).map(b=>b.Ga)},AM=function(a,
|
|
33
|
+
b){return _.x(function*(){var c=_.Jj([b],a.a.attemptParameters);c.type=1;c=yield a.H(c);let d="";try{d=_.cj(c.data)}catch(e){throw new _.I(_.F,4,4042);}d=d.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");d=d.trim();return{text:d,response:c}})},LM=function(a,b){return _.x(function*(){var c=BM(a,b,a.A,"");if(1===c.type){c=CM(c.T[0].a);var d="";c===_.w?d="avc1.42E01E":c===_.p&&(d="mp4a.40.2");c=HL(a.R,a.A,a.a.hlsDefaultCodecs||d)}d=gL(c.ca);c=DM(d.yc.zf);c.forEach(m=>{a.J.add(m.groupId)});var e=yield EM(a,d);var f=
|
|
34
|
+
e.Mh;const g=e.periods;var h=e.$h;const k=e.wi;d=e.alternativeVariants;const l=e.alternativeTextStreams;e=e.alternativeImageStreams;if(!a.D)throw new _.I(_.F,7,7001);FM(a,g);h=GM(a,f.delay,g,h);HM(a)||(a.G=f.Cd,IM(a));JM(a,h,g);f=KM(a,k);c={presentationTimeline:h,periods:g,minBufferTime:0,cues:f,muxedAudioTracks:c};d&&(c.alternativeVariants=d);l&&(c.alternativeTextStreams=l);e&&(c.alternativeImageStreams=e);a.g.debug("HLS playlist parsed",c);return c})},NM=function(a,b){return Promise.all(b.map(c=>
|
|
35
|
+
MM(a,c)))},PM=function(a,b){b.forEach(c=>{a:{var d=a.f.get(c.verbatimUri),e=!HM(a),f=TK(c.ca,_.Ca);if(f)var g=Number(f.value);else{d?(f=d.streams[d.streams.length-1].T,f=f[f.length-1].pa):f=0;if(e&&0<f)try{{const k=TK(c.ca,_.Ha);if(!k)throw OM.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(AK);const l=Number(k.value),m=gM(d,l);if(!m)throw OM.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist"+
|
|
36
|
+
` (segment position = ${l})`),Error(AK);var h=m.pa}g=h;break a}catch(k){throw new _.I(_.F,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}g=0}}c=c.T||[];for(const k of c)SK(k.ca,_.Ba)&&g++,k.pa=g});QL(b)},SM=function(a,b){return _.x(function*(){const {textStreams:c,thumbStreams:d,Sg:e}=yield QM(a,b);var f=a.C.periods[0].variants;a.a.lowLatencyMode&&null!==a.l&&(f=f.filter(g=>g.id===a.l.id));f=f.map(g=>{const h=sL(g.audio,e),k=sL(g.video,e);g=RM(a,h,k,g.bandwidth);
|
|
37
|
+
if(!g)throw new _.I(_.F,4,4047,{message:"Video and audio are encrypted in an incompatible way.",bj:k?oL(k).Ga:void 0,audio:h?oL(h).Ga:void 0});return g});return uM(a.D.configurationId,f,c,d,!0)})},FM=function(a,b){HM(a)||2!==a.a.timeline.version||(a.I||(a.I=b[0].startTime),_.gF(b,-a.I))},TM=function(a,b){b=b.flatMap(d=>d.T[0].ca);b=TK(b,_.La);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 "+`value (value: ${b.value}).`),
|
|
38
|
+
null):c/1E3},UM=function(a,b,c){b=b.find(d=>null!==TK(d.ca,_.Aa));if(!b)return[];if(null===c)throw new _.I(_.F,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");return b.ca.filter(d=>d.name===_.Aa).map(d=>{a:{var e=a.B,f=!HM(a),g=_.J(d,"ID"),h=_.J(d,"START-DATE");if(null===g||null===h)_.pu.warn("Invalid EXT-X-DATERANGE missing mandatory ID or START-DATE attribute, ignoring the EXT-X-DATERANGE tag.",d),d=null;else{e=f?e-c:-c;var k=new Date(h);h=k.getTime()/1E3+
|
|
39
|
+
e;g={id:g,startTime:h,startDate:k};f=NK(_.J(d,xK));void 0!==f&&0<=f&&(g.duration=f);var l=NK(_.J(d,"PLANNED-DURATION"));void 0!==l&&0<=l&&(g.plannedDuration=l);var m=_.J(d,"CLASS");null!==m&&(g.schemeIdUri=m);var n=_.J(d,"END-DATE");n=n?new Date(n):null;null!==n&&n.getTime()>=k.getTime()&&(g.endDate=n);{const v=d.attributes;if(null==v)var q=null;else{k={};for(q of v)q.name.trim().startsWith("X-")&&(k[q.name]=q.value);q=_.nh(k)?k:null}}q=q||{};(k=_.J(d,"CUE"))&&(q.CUE=k.split(","));if(m===_.Fd){k=
|
|
40
|
+
d.attributes;if(null==k)var u=null;else{m={};for(u of k)switch(u.name){case _.$b:m[_.$b]=u.value;break;case _.Zb:m[_.Zb]=u.value;break;case _.cc:m[_.cc]=NK(u.value);break;case _.ac:m[_.ac]=NK(u.value);break;case "X-SNAP":m["X-SNAP"]=u.value.split(",");break;case _.bc:m[_.bc]=u.value.split(",")}m[_.$b]&&m[_.Zb]||!m[_.$b]&&!m[_.Zb]?(_.pu.warn("Invalid EXT-X-DATERANGE Interstitial attributes X-ASSET-URI, X-ASSET-LIST"),u=null):u=_.nh(m)?m:null}if(null===u){_.pu.warn("Invalid interstitial attributes, ignoring the EXT-X-DATERANGE tag.",
|
|
41
|
+
d);d=null;break a}q=Object.assign(q,u)}_.nh(q)&&(g.customAttributes=q);g.endTime=n?n.getTime()/1E3+e:f?h+f:l?h+l:h;g.type=_.gi;d=g}}return d}).filter(Boolean)},KM=function(a,b){const c=new Set(b.map(d=>d.id));a.w.forEach((d,e)=>{c.has(e)||a.w.delete(e)});for(const d of b){if((b=a.w.get(d.id))&&b.startTime!==d.startTime)a.D.onError(new _.I(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for"+` ID=${d.id}`));const e={configurationId:a.D.configurationId,schemeIdUri:d.schemeIdUri,customAttributes:d.customAttributes,
|
|
42
|
+
value:"",startTime:d.startTime,endTime:d.endTime,id:d.id,type:_.gi,eventElement:null};b&&!MK(b,e)||a.w.set(d.id,e)}return Array.from(a.w.values())},VM=function(a,b,c){a.o=_.Tb;_.TD(b,!0);b.f=c[c.length-1].endTime},BM=function(a,b,c,d){a=FL(a.R,b,c);a.verbatimUri=d;return a},DM=function(a){return a.filter(b=>b.name===yK&&_.J(b,_.Fb)===_.CB&&!_.J(b,_.Hb)).map(b=>{const c=tL(b),d=_.J(b,_.$a)||_.sg;return{groupId:JK(b,_.Ua),id:_.eK++,label:JK(b,_.gb),language:d,channelsCount:c,primary:"YES"===_.J(b,"DEFAULT")}})},
|
|
43
|
+
EM=function(a,b){return _.x(function*(){var c=qL(b.yc.closedCaptions),d=WM(a,b.Ed),e=yield XM(a,b),f=Object.values(e).flat().map(h=>h.playlist);PM(a,f);f=f[0];var g=$K(f.ca);a.o=g;a.K=eL(f.ca);f=nL(f.ca,g,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod);g=yield YM(a,e.Af,d);c=yield ZM(a,e.Ed,g,c);d=yield $M(a,e.ri,d);g=yield aN(a,e.Ae);d=uM(a.D.configurationId,c,d,g,!HM(a));a.D.filterAllPeriods(d);c=[...e.Ed,...e.Af].map(h=>h.playlist);e=TM(a,c);c=UM(a,c,e);return{periods:d,
|
|
44
|
+
$h:e,wi:c,Mh:f}})},GM=function(a,b,c,d){let e=!0,f=null,g=0;HM(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.hK(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.TD(a,e);yM(a,c);d&&_.SD(a,d);return a},IM=function(a){var b=0;for(var c of a.f.values())b=Math.max(b,c.streams[0].Rc);for(c=0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c){a.g.debug("Offsetting live streams by",c,"to compensate for rollover");for(const d of a.f.values())b=d.streams[0],95443.7176888889>b.Rc?(a.g.debug("Offset applied to",
|
|
45
|
+
b.type),b.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",b.type)}},JM=function(a,b,c){c=lL(c);"LIVE"===a.o||"EVENT"===a.o?(c=Math.max(c,b.J),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.o===_.Tb&&(b.f=c)},QM=function(a,b){return _.x(function*(){const c=g=>oL(g.stream).type===_.w||oL(g.stream).type===_.p;var d=b.filter(c),e=b.filter(g=>!c(g)),f=g=>{g=g.map(h=>{var k=oL(h.stream);k={language:k.language,channelsCount:k.channelsCount,spatialAudio:k.spatialAudio,
|
|
46
|
+
closedCaptions:k.closedCaptions,primary:k.primary,kind:k.kind||null,groupId:k.groupId,type:k.type,codecs:k.codecs,name:k.originalId,uri:k.Ga,je:{width:k.width,height:k.height,frameRate:k.frameRate}};h=Object.assign({},{playlist:h.playlist},k);return bN(a,h)});return Promise.all(g)};d=yield f(d);f=yield f(e);cN(a,d.concat(f));e=f.filter(g=>oL(g).type===_.MC);f=f.filter(g=>oL(g).type===_.qe);return{textStreams:e,thumbStreams:f,Sg:d}})},RM=function(a,b,c,d){const e=[],f=(c||b).length();for(let m=0;m<
|
|
47
|
+
f;m++){var g=b?b.streams[m]||null:null,h=c?c.streams[m]||null:null,k=g,l=h;k=k&&l?_.nD(k.drmInfos,l.drmInfos)?_.mD(k.drmInfos,l.drmInfos):null:k?k.drmInfos:l?l.drmInfos:null;if(!k)return null;l=d;g={id:a.h++,language:g?g.language:_.sg,primary:!!g&&g.primary||!!h&&h.primary,audio:g,video:h,bandwidth:l,drmInfos:k,allowedByApplication:!0,allowedByKeySystem:!0};e.push(g)}return new dN(e)},bN=function(a,b){return _.x(function*(){const c=b.playlist,d=b.codecs,e=b.type,f=b.nd,g=b.Ac,h=b.groupId,k=b.muxedAudioId,
|
|
48
|
+
l=b.primary;var m=b.kind;const n=b.name,q=b.channelsCount,u=b.spatialAudio,v=b.closedCaptions,y=b.je,A=_.Pi(f||_.sg);if(1!==c.type)throw new _.I(_.F,4,4017);const E=yield eN(a,c,e,d),G=a.a.lowLatencyMode?_.BC:_.AC;let X=m;e!==_.H||m||(X=_.MC);const wc=$K(c.ca);m=E.map(dc=>{const cd=dc.T,Ed=dc.fh,Kb=dc.mimeType;dc=dc.pa;const Lb=cd[0].startTime,ec=cd[cd.length-1].endTime,Mb=ec-Lb,Ea=new _.iK(cd),Sa=cd[0].initSegment||null;return{id:null===g?_.eK++:g,originalId:n,createSegmentIndex:Promise.resolve.bind(Promise),
|
|
49
|
+
findSegmentPosition:Ea.f.bind(Ea),getSegmentReference:Ea.get.bind(Ea),adjustSegmentDurations:Ea.h.bind(Ea),getDuration:Ea.getDuration.bind(Ea),segmentIndex:Ea,segmentLookupStrategy:G,initSegmentReference:Sa,mimeType:Kb,codecs:d,kind:X,Lf:Ed.type,encrypted:Ed.type===HK,aesEncrypted:!!Ed.keyInfo,keyId:Ed.keyId,language:A,originalLanguage:f||_.sg,label:n,type:e,primary:l,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:y?y.frameRate:void 0,width:y?y.width:void 0,height:y?y.height:void 0,bandwidth:void 0,
|
|
50
|
+
roles:[],channelsCount:q,spatialAudio:u,closedCaptions:v,T:cd,drmInfos:Ed.drmInfos,pa:dc,Ga:c.verbatimUri,le:c.a,Rc:Lb,Ee:ec,duration:Mb,groupId:h,Wi:wc,muxedAudioId:k}});return new fN(m)})},cN=function(a,b){b.forEach(c=>{a.f.a.set(oL(c).Ga,c)})},WM=function(a,b){const c=new Map;for(const f of b){var d=_.J(f,_.CB);b=_.J(f,_.Sb);var e=_.J(f,EK);const g=gN(a,f);if(e){const h=_.tk(_.H,g);c.set(`${_.H}:${e}`,h);e=g.indexOf(h);-1<e&&g.splice(e,1)}d&&(e=hN(_.p,g),c.set(`${"audio"}:${d}`,e));b&&(d=hN(_.w,
|
|
51
|
+
g),c.set(`${"video"}:${b}`,d))}return c},XM=function(a,b){return _.x(function*(){const c=yield Promise.all([iN(a,b.yc.zf),iN(a,b.yc.si),iN(a,b.Ed),iN(a,b.Ae)]),[d,e,f,g]=c;return{Af:d,ri:e,Ed:f,Ae:g}})},YM=function(a,b,c){return _.x(function*(){if(0===b.length)return new Map;var d=[jN(a,b[0],c)];yield d[0];d=d.concat(b.slice(1).map(e=>jN(a,e,c)));d=yield Promise.all(d);return pL(d)})},ZM=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=
|
|
52
|
+
Number(JK(f[k].tag,_.la));l<h&&(h=l,g=k)}h=f.splice(g,1).pop();h=yield kN(a,h,c,d,e);f=f.map(k=>kN(a,k,c,d,e));f=yield Promise.all(f);f.splice(g,0,h);return f.reduce(_.dD,[])})},$M=function(a,b,c){return Promise.all(b.map(d=>jN(a,d,c)))},aN=function(a,b){return Promise.all(b.map(c=>lN(a,c)))},HM=function(a){return a.o===_.Tb},iN=function(a,b){return _.x(function*(){return(yield Promise.all(b.map(c=>_.x(function*(){const d=yield mN(a,c);return d?{tag:c,playlist:d}:null})))).filter(Boolean)})},MM=function(a,
|
|
53
|
+
b){return _.x(function*(){var c=new _.Bi(oL(b).le);if(a.a.lowLatencyMode&&a.K&&a.K.Ef){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={Nh:d.position,Th:e&&0<e.length?f:null}}else d=null;if(e=d)d=e.Nh,e=e.Th,f=_.hk(c.a.toString()),f._HLS_msn=d.toString(),null===e&&f._HLS_part&&delete f._HLS_part,null!==e&&(f._HLS_part=e.toString()),d=_.gk(f,!0),d=new _.Ii(d),_.Ei(c,d)}const {response:g,text:h}=yield AM(a,c.toString());c=oL(b).Ga;d=oL(b).le;e=g.uri;
|
|
54
|
+
d!==e&&(d=e,hM(b,d));c=BM(a,h,d,c);return{stream:b,playlist:c}})},gN=function(a,b){var c=_.J(b,_.oa,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);c=rL(c);b=new Set;const d=[];for(const e of c)c=_.sD(e),b.has(c)?a.g.debug("Ignoring duplicate codec"):(d.push(e),b.add(c));return d},hN=function(a,b){if(1===b.length)return b[0];a=_.tk(a,b);if(null!=a)return a;throw new _.I(_.F,4,4025,{codecList:b});},jN=function(a,b,c){return _.x(function*(){const d=b.tag,e=b.playlist;return nN(a,e.verbatimUri,
|
|
55
|
+
()=>_.x(function*(){const f=JK(d,_.Ua),g=aL(JK(d,_.Fb));var h=JK(d,_.Fb).toUpperCase();if(aL(h)!==_.H)h=null;else{var k=d.getAttribute("FORCED");k=!(!k||!k.value||"YES"!==k.value.toUpperCase());var l=_.MC;h===vK&&(l=_.vC);k&&(l=_.ke);h=l}k=c.get(`${g}:${f}`)||"";l=_.J(d,_.$a);const m=_.J(d,_.gb),n=_.J(d,"DEFAULT"),q=g===_.p?tL(d):null;var u=g===_.p?(u=_.J(d,"CHANNELS"))?u.includes("/JOC"):!1:!1;return yield bN(a,{playlist:e,codecs:k,type:g,nd:l,primary:"YES"===n,name:m,channelsCount:q,spatialAudio:u,
|
|
56
|
+
groupId:f,kind:h,Ac:null,closedCaptions:null,je:null})}))})},lN=function(a,b){return _.x(function*(){const c=b.tag,d=b.playlist;return nN(a,d.verbatimUri,()=>_.x(function*(){var e=_.J(c,_.oa)||"jpg",f=_.J(c,_.$a);const g=_.J(c,_.gb);e=yield bN(a,{playlist:d,codecs:e,type:_.qe,nd:f,name:g,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,Ac:null,groupId:null,je:null});(f=_.J(c,_.la))&&lM(e,Number(f));return e}))})},kN=function(a,b,c,d,e){return _.x(function*(){var f=b.tag,
|
|
57
|
+
g=Number(JK(f,_.la));if(f.hasAttribute("FRAME-RATE")||f.hasAttribute(_.yb)){var h=_.J(f,"FRAME-RATE");f=_.J(f,_.yb);var [k,l]=f?f.split("x"):[null,null];h={frameRate:NK(h),width:NK(k),height:NK(l)}}else h=null;if(f=yield oN(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 q of h){m=(q?oL(q).Ga:"")+" - "+(n?oL(n).Ga:"");if(e.has(m)){a.g.debug("Skipping variant which only differs in text streams.");continue}const u=RM(a,n,q,g);null==u?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):
|
|
58
|
+
(f.push(u),e.add(m))}g=f}else g=[];return g})},nN=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},pN=function(a,b,c,d,e,f){let g=gN(a,b);a.g.debug("Guessing stream type for",b.toString());b=!1;const h=_.tk(_.w,g),k=d+e;1!==g.length||c||h?!k&&1<g.length?(a.g.debug("Guessing multiplexed audio+video"),c=_.w,g=[g.join(",")]):d&&f?(a.g.debug(BK),c=_.p,b=!0):e?(a.g.debug(BK),c=_.p):(a.g.debug("Guessing video-only"),
|
|
59
|
+
c=_.w):(c=_.p,a.g.debug(BK));return{type:c,Qg:g,Eh:b}},oN=function(a,b,c,d,e){return _.x(function*(){var f=b.tag,g=b.playlist,h=_.J(f,_.CB),k=_.J(f,_.Sb);h=h?d.get(`${"audio"}:${h}`)||[]:[];k=k?d.get(`${"video"}:${k}`)||[]:[];k={audio:h,video:k};const l=g.verbatimUri;g=k.audio.find(u=>oL(u).Ga===l);const {type:m,Qg:n,Eh:q}=pN(a,f,c,k.audio.length,k.video.length,g);f=null;q||(f=yield qN(a,b,n,m,e,c));if(null==f)return null;k[m]=[f];m===_.p&&c&&k.video.forEach(u=>{iM(u,c.width);jM(u,c.height);kM(u,
|
|
60
|
+
c.frameRate)});return k})},qN=function(a,b,c,d,e,f){return _.x(function*(){const g=b.tag,h=b.playlist;return nN(a,h.verbatimUri,()=>_.x(function*(){var k=_.J(g,vK);let l=null;d===_.w&&k&&"NONE"!==k&&(l=e.get(k));k=(k=_.J(g,_.CB)||void 0)&&a.J.has(k)?k:void 0;var m=hN(d,c);if(k){const n=hN(_.p,c);m+=`,${n}`}return yield bN(a,{playlist:h,codecs:m,type:d,closedCaptions:l,primary:!1,kind:null,nd:null,name:null,channelsCount:null,spatialAudio:!1,Ac:null,groupId:null,muxedAudioId:k,je:f})}))})},eN=function(a,
|
|
61
|
+
b,c,d){return _.x(function*(){var e=b.verbatimUri,f=b.T;var g=void 0===g?0:g;var h=(h=TK(b.ca,_.Ha))?Number(h.value):g;g=[];!HM(a)&&YL(f);e=yield rN(a,b.a,e,f,h,c,d);if(0===f.length)f=[];else{var k=[],l=[];for(var m of f)SK(m.ca,_.Ba)&&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 sN(a,b.a,k,h,e,c,d,g[g.length-1]||null,f.length),g.push(l),h+=k.length;tN(g);return g})},mN=function(a,b){return _.x(function*(){var c=b.name!==yK?!0:_.J(b,_.Fb)===EK;c=_.J(b,
|
|
62
|
+
_.Hb,void 0,{required:c});if(!c)return null;const d=VK(a.A,c),{response:e,text:f}=yield AM(a,d);return BM(a,f,e.uri,c)})},tN=function(a){if(1<(new Set(a.map(b=>b.mimeType))).size)throw new _.I(_.F,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},uN=function(a){a=a.map(b=>b.a?b.a:b.f.map(c=>_.J(c,_.Hb))||null).map(b=>_.mu(b));if(1<(new Set(a)).size)throw new _.I(_.F,4,4044,"Unexpected change in file format.");},vN=function(a,b,c){a=
|
|
63
|
+
PK(a.ca,_.Ga);if(1<a.length)throw new _.I(_.F,4,4020);a=a[0];if(!a)return null;const d=JK(a,_.Hb),e=VK(b,d);b=fL(a,null,!0);return new _.dK(()=>[e],b.za,b.qa,c)},wN=function(a,b,c,d,e,f,g){const h=[];for(const q of OK(b.f)){b=q.Yf;const u=q.item;{var k=0===b,l=k?a:h[h.length-1],m=k?d:l.endTime,n=Number(_.J(u,xK));n=m+n;k=fL(u,k?null:l.qa,k);l=_.J(u,_.Hb);const v=(l=VK(g,l))?[l]:[];m=new hL(c,m,n,()=>v,k.za,k.qa,e,f,!1,null,null,null,null);if("YES"===_.J(u,"INDEPENDENT")||0===b)m.h=!0;h.push(m)}}return h},
|
|
64
|
+
xN=function(a,b,c,d,e,f,g,h,k,l,m){const n=c.ca;var q=c.a;0<PK(n,_.Ga).length&&(m=vN(c,k,g));const u=null!=q,v=q?[q]:[];if(!u&&!a.a.lowLatencyMode)return null;a=0;q={za:0,qa:null};let y=null;u?({duration:c}=dL(n),a=e+c,q=cL(n,b?b.qa:null)):(b=wN(b,c,d,e,f,g,k),a=b[b.length-1].endTime,y=b);h=h===_.qe?UK(n):null;d=new hL(d,e,a,()=>v,q.za,q.qa,f,g,!1,null,h?h.gd:null,h?h.Dd:null,h?h.durationPerTile:null,y,m);d.pa=l;return d},rN=function(a,b,c,d,e,f,g){return _.x(function*(){var h=d[0];if(null!=a.B)return a.B;
|
|
65
|
+
if(!HM(a)&&a.C)try{var k=a.f.get(c);var l=k?gM(k,e)||null:null;if(!l)throw new _.I(_.F,4,4030,"Segment not found in pervious playlist update.");var m=l.startTime+l.Fa;a.g.debug(`Setting playlist start time to ${m}.`);return a.B=m}catch(n){if(h=a.f.get(c))m=h.streams[h.streams.length-1].T,m=m[m.length-1],a.g.warn(`Last #EXT-X-MEDIA-SEQUENCE values ${h.streams[0].T[0].position} - ${m.position}`+`, new values ${e} - ${e+d.length-1}.`,b,h);throw new _.I(_.F,4,4047,{message:"The updated playlist does not share any segments with the previous one.",
|
|
66
|
+
uri:c});}m=yield yN(a,f,g,h);k=ZL(h.ca,a.A,m)||UL();l=vN(h,b,k.keyInfo);k=jL(k.keyInfo,e);h=yield zN(a,l,h,k,m,g);a.g.debug(`Setting playlist start time to ${h}.`);return a.B=h})},sN=function(a,b,c,d,e,f,g,h,k){return _.x(function*(){var l=c[0],m=null==h;uN(c);const n=yield yN(a,f,g,l);var q=a.A,u=h?h.Lh:null;var v=1===k;if(c.slice(1).some(XL))throw new _.I(_.F,4,4046,v?"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.");
|
|
67
|
+
if(SK(c[0].ca,_.Fa)||null===u)if((u=ZL(c[0].ca,q,n))&&u.type===IK){if(1<aM(c))throw new _.I(_.F,4,4046,FK+`${v?"playlist":"discontinuity"}.`);v=[u]}else v=$L(c,q,n),v=0===v.length?[UL()]:v;else if(q=$L(c,q,n),u.type===_.Qe||u.type===HK)v=[u,...q];else{if(0<aM(c))throw new _.I(_.F,4,4046,FK+`${v?"playlist":"discontinuity"}.`);v=[u]}q=v;v=q[q.length-1];q=VL(q);u=vN(l,b,q.keyInfo)||(h?h.Fh:null);var y=jL(q.keyInfo,d);const A=l.pa;l=m?e:yield AN(a,A,u,l,d,y,n,g);m=[];for(y=0;y<c.length;y++){var E=c[y];
|
|
68
|
+
const G=m[m.length-1]||null,X=0===y?0:G.endTime,wc=d+y,dc=jL(q.keyInfo,wc);if(E=xN(a,G,E,wc,X,l,dc,f,b,A,u))u=E.initSegment,m.push(E)}return{T:m,fh:q,Lh:v,mimeType:n,endTime:m[m.length-1].endTime,pa:A,Fh:u}})},yN=function(a,b,c,d){return _.x(function*(){const e=d.a;var f=TK(d.ca,_.Ga);f=f?JK(f,_.Hb):null;return BN(a,b,c,e,f)})},zN=function(a,b,c,d,e,f){return _.x(function*(){if(null==c.a)return 0;const g=iL(c,d);return eM(a.S,b,g,e,f,null!=d)})},AN=function(a,b,c,d,e,f,g,h){return _.x(function*(){if(a.L.has(b))return a.L.get(b);
|
|
69
|
+
const k=yield zN(a,c,d,f,g,h);a.g.debug(`Segment #${e} has raw media timestamp `+`${k} s.`);a.L.set(b,k);return k})},BN=function(a,b,c,d,e){return _.x(function*(){const f=[d,e].filter(Boolean);var g=_.wk(f,b,c);if(g)return g;g=_.Jj([d],a.a.attemptParameters);g.method="HEAD";g.type=2;g=(yield a.H(g)).headers["content-type"];if(!g)throw new _.I(_.F,4,4021,"Unknown MIME type of: "+f.join(", "));return g.split(";")[0]})},CM=a=>{a=_.mu(a)||"";return null!=_.lu.video[a]?_.w:null!=_.lu.audio[a]?_.p:null},
|
|
70
|
+
AL=class{constructor(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.I(_.F,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.I(_.F,4,4043,"Media playlist must have at least one full segment!");}this.a=a;this.verbatimUri="";this.type=b;this.ca=c;this.T=1===b?d:null}},GL=class{constructor(a,b,c){c=void 0===c?[]:c;this.ca=b;this.a=a;this.f=c;this.pa=-1}},hL=class extends _.iE{constructor(a,b,c,d,e,f,g,h,k,l,m,n,q,u,v){u=void 0===u?[]:u;super(a,b,c,d,e,f,g,void 0===
|
|
71
|
+
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===q?null:q,u,void 0===v?null:v);this.pa=0}},CN=class{constructor(){this.h=0;this.a=new Map}},DN=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)||null}values(){return Array.from(this.a.values())}clear(){this.f.clear();this.a.clear()}},OM=new _.S("clpp.hls.DiscontinuityUtils");var cM={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Gg)throw new _.I(_.F,4,4041);if(JK(a,CK)===DK)throw new _.I(_.F,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.gD(_.Dd,[{initDataType:_.Vf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":TL,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":TL,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=JK(a,CK);if(!RL.includes(b))return SL.error("Widevine in HLS is only supported with [",
|
|
72
|
+
RL.join(", "),"], not",b),null;b=JK(a,_.Hb);b=_.zt(b);b=_.K(b.data);b=_.gD(_.Jd,[{initDataType:_.jd,initData:b}],"");if(a=_.J(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},RL=["SAMPLE-AES",DK],SL=new _.S("clpp.hls.DrmParser");var bM=new _.S("clpp.hls.EncryptionUtils");var EN=class{constructor(a){this.g=new _.S("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Fj()}}};var fN=class{constructor(a){this.streams=a}length(){return this.streams.length}};var dN=class{constructor(a){this.a=a}length(){return this.a.length}};var FN=class{constructor(){this.a=this.D=null;this.h=1;this.f=new DN;this.A="";this.R=new CN;this.G=0;this.l=null;this.j=new _.Mk(()=>{this.Xb()});this.o=_.Tb;this.C=null;this.F=new _.uu;this.K=this.B=null;this.g=new _.S("clpp.hls.HlsParser");this.L=new Map;this.S=new EN(this.H.bind(this));this.O=!1;this.I=null;this.M=!1;this.w=new Map;this.J=new Set}configure(a){this.a=a;this.S.a=a}setCurrentVariant(a){this.l=a}start(a,b){const c=this;return _.x(function*(){if(c.O)throw Error("start() may be called only once!");
|
|
73
|
+
c.O=!0;c.D=b;const {response:d,text:e}=yield AM(c,a);c.A=d.uri;const f=yield LM(c,e);c.C=f;const g=c.G;c.j&&0<g&&c.j.ia(g);return f})}requestStop(){this.M=!0}stop(){this.j&&(this.j.stop(),this.j=null);const a=[];this.F&&(a.push(this.F.destroy()),this.F=null);this.f.clear();this.C=this.a=this.D=this.l=null;this.w.clear();this.J.clear();return Promise.all(a)}update(){const a=this;return _.x(function*(){const b=a.C;if(!HM(a)&&b){var c=b.presentationTimeline;"LIVE"===a.o&&(a.B=null);var d=Array.from(a.f.values());
|
|
74
|
+
if(a.a.lowLatencyMode&&null!==a.l){const g=zM(a);d=d.filter(h=>g.includes(oL(h).Ga))}var e=yield NM(a,d);d=e.map(g=>g.playlist);PM(a,d);e=yield SM(a,e);nM(b.periods,e).forEach(g=>{a.D.filterNewPeriod(g)});FM(a,e);var f=TM(a,d);f=UM(a,d,f);b.cues=KM(a,f);pM(b.periods,e);yM(c,e);if(d=YK(d))!0!==a.a.keepTimelineLive&&VM(a,c,e),a.j.stop(),a.j=null;if(a.D.onUpdate)a.D.onUpdate(b);if(d&&a.D.onTurnedStatic)a.D.onTurnedStatic();a.M&&(yield a.stop());return b}})}Xb(){const a=this;return _.x(function*(){a.g.debug(_.pC);
|
|
75
|
+
if(a.D)try{yield a.update(),a.j&&0<a.G&&a.j.ia(a.G)}catch(b){if(!(b instanceof _.I))throw b;a.D&&(a.D.onError(b),1===b.severity&&a.j&&a.j.ia(.1))}})}H(a){if(!this.F)throw new _.I(_.F,7,7001);a=this.D.networkingEngine.fetch(a);_.Sj(this.F,a);return a.U}};_.z("clpp.hls.HlsComponent",class extends _.Iv{f(){_.dt.m3u8=FN;_.bt[_.Fl]=FN;_.bt[GK]=FN}a(){_.HE("m3u8");_.IE(_.Fl);_.IE(GK)}id(){return"hls"}});};f.call(g, window);
|