@castlabs/prestoplay 6.28.0 → 6.30.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 +37 -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 +128 -116
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +619 -614
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +92 -89
- package/cjs/cl.externs.js +154 -60
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +77 -77
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +25 -23
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +350 -349
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +15 -15
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +57 -58
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +60 -60
- 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 +38 -38
- package/cjs/polyfill.min.js +2 -2
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +6 -6
- package/cl.cast.js +101 -92
- package/cl.conviva.js +27 -27
- package/cl.core.js +500 -496
- package/cl.crypto.js +9 -9
- package/cl.dash.js +84 -83
- package/cl.externs.js +150 -60
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +82 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +19 -17
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +304 -305
- 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 +14 -14
- package/cl.smooth.js +60 -60
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +56 -56
- 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 +31 -31
- package/package.json +1 -1
- package/typings.d.ts +198 -88
package/cjs/cl.freewheel.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.
|
|
4
|
-
_.x(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.x(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},
|
|
5
|
-
|
|
6
|
-
_.r.
|
|
7
|
-
_.
|
|
8
|
-
_.r.
|
|
9
|
-
_.r.
|
|
10
|
-
_.r.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_.r.
|
|
20
|
-
_.r.
|
|
21
|
-
void 0));this.l.resolve()};_.r.
|
|
22
|
-
_.r.
|
|
23
|
-
_.
|
|
24
|
-
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.
|
|
25
|
-
_.r.
|
|
26
|
-
|
|
2
|
+
var f=function(window){var uU="clpp-freewheel",vU="clpp.freewheel.AdsManagerFactory",wU="freewheel",xU=function(){this.f=this.a=null},yU=function(){},zU=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""}},AU=function(a,b,c){this.h=a;this.f=b;this.a=c},BU=function(a){this.a=a},CU=function(a){this.g=new _.L("clpp.freewheel.AdsManager");this.m=a;this.h=new _.wi;this.w=new tv.freewheel.SDK.AdManager;
|
|
3
|
+
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.om;this.j=null},DU=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.lg&&b.push("serverUrl");typeof a.profileId!==_.lg&&b.push("profileId");typeof a.videoAssetId!==_.lg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.O(1,9,12001,{missingKeys:b.join(", ")});},EU=function(){var a,b,c,d;return _.I(function(e){if(1==e.a)return a=new _.qv,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
|
|
4
|
+
_.x(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.x(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},FU=function(a){var b=a.m.ke(wU).sd();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(uU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},GU=function(a){var b=a.m.ke(wU).sd();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},
|
|
5
|
+
HU=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 AU(a.a,c,d)});a.m.trigger(new _.Q(b,d))},IU=function(){this.Ea=new _.L(vU)};_.w(xU,_.Zv);_.r=xU.prototype;_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Yi(_.Xd,{id:uU}),this.f=_.Yi(_.Sg,{"class":_.sd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.O(1,9,12E3))};
|
|
6
|
+
_.r.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.r.id=function(){return wU};_.r.sd=function(){return this.a};_.r.im=function(){return this.f};_.K("clpp.freewheel.FreeWheelPlugin",xU);xU.prototype.getAdVideo=xU.prototype.im;xU.prototype.getAdContainer=xU.prototype.sd;xU.Id=wU;xU.AD_CONTAINER_ID=uU;yU.prototype.create=function(){return new xU};_.r=AU.prototype;_.r.wb=function(){return"FreeWheel AdManager SDK"};_.r.xb=function(){return tv.freewheel.SDK.version};_.r.Cb=function(){return 0};_.r.getId=function(){return this.a?this.a.getAdId():""};_.r.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.lg?a:""};_.r.ac=function(){return""};_.r.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.r.getAdSystem=function(){return""};_.r.getAdvertiserName=function(){return""};
|
|
7
|
+
_.r.getTitle=function(){return""};_.r.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.r.getPosition=function(){return 0};_.r.getSkipTimeOffset=function(){return 0};_.r.fc=function(){return!1};_.r.yb=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.r.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
|
|
8
|
+
_.r.nb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.lb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.Ya=function(){return 0};_.r.Za=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
|
|
9
|
+
_.r.getPodIndex=function(){switch(this.Za()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.r.Pb=function(){switch(this.Za()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.r.Ab=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.r.ob=function(){return this.f.getAdCount()};_.r.getWrapperAdIds=function(){return[]};_.r.canSeek=function(){return!1};
|
|
10
|
+
_.r.getWrapperAdSystems=function(){return[]};_.r.getWrapperCreativeIds=function(){return[]};_.r.dc=function(){return null};AU.prototype.getVideoElement=AU.prototype.dc;AU.prototype.getWrapperCreativeIds=AU.prototype.getWrapperCreativeIds;AU.prototype.getWrapperAdSystems=AU.prototype.getWrapperAdSystems;AU.prototype.canSeek=AU.prototype.canSeek;AU.prototype.getWrapperAdIds=AU.prototype.getWrapperAdIds;AU.prototype.getSequenceLength=AU.prototype.ob;AU.prototype.getPositionInSequence=AU.prototype.Ab;
|
|
11
|
+
AU.prototype.getPodTimeOffset=AU.prototype.Pb;AU.prototype.getPodIndex=AU.prototype.getPodIndex;AU.prototype.getPodType=AU.prototype.Za;AU.prototype.getMediaBitrate=AU.prototype.Ya;AU.prototype.getMediaHeight=AU.prototype.lb;AU.prototype.getMediaWidth=AU.prototype.nb;AU.prototype.getMediaUrl=AU.prototype.getMediaUrl;AU.prototype.getClickThroughUrl=AU.prototype.yb;AU.prototype.isBumper=AU.prototype.fc;AU.prototype.getSkipTimeOffset=AU.prototype.getSkipTimeOffset;AU.prototype.getPosition=AU.prototype.getPosition;
|
|
12
|
+
AU.prototype.getDuration=AU.prototype.getDuration;AU.prototype.getTitle=AU.prototype.getTitle;AU.prototype.getAdvertiserName=AU.prototype.getAdvertiserName;AU.prototype.getAdSystem=AU.prototype.getAdSystem;AU.prototype.getApiFramework=AU.prototype.getApiFramework;AU.prototype.getSourceId=AU.prototype.ac;AU.prototype.getCreativeId=AU.prototype.getCreativeId;AU.prototype.getId=AU.prototype.getId;AU.prototype.getTechnology=AU.prototype.Cb;AU.prototype.getAdManagerVersion=AU.prototype.xb;
|
|
13
|
+
AU.prototype.getAdManagerName=AU.prototype.wb;BU.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(a){switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})};BU.prototype.Sb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};BU.prototype.Rb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
14
|
+
BU.prototype.hasPostroll=BU.prototype.Rb;BU.prototype.hasPreroll=BU.prototype.Sb;BU.prototype.getCuePoints=BU.prototype.getCuePoints;_.r=CU.prototype;
|
|
15
|
+
_.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{DU(b)}catch(n){return a.m.onError(n),a.l.resolve(),m["return"](a.l)}a.w.setNetwork(b.networkId);a.w.setServer(b.serverUrl);a.a=a.w.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.lg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.x(m,EU(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
|
|
16
|
+
_.v(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,zU(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.$e&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.v(b.parameters),h=g.next();!h.done;h=
|
|
17
|
+
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.Tn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Yn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.Xn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.ln.bind(a));a.h.on(a.m,_.zg,a.cl.bind(a));a.h.on(a.m,_.ig,a.al.bind(a));a.a.submitRequest();return m["return"](a.l)})};
|
|
18
|
+
_.r.Cd=function(){if(this.B.length){FU(this);this.f=this.B.shift();this.f.play();var a=!1}else GU(this),a=!0;return a};_.r.md=function(){};_.r.resume=function(){this.f&&this.f.resume()};_.r.pause=function(){this.f&&this.f.pause()};_.r.skip=function(){this.f&&this.f.skipCurrentAd()};_.r.getVolume=function(){return this.a?this.a.getAdVolume():1};_.r.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.r.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.r.jd=function(){return!0};
|
|
19
|
+
_.r.Ic=function(){var a=this;return _.I(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);GU(a);a.a&&(a.a.dispose(),a.a=null);_.z(b)})};
|
|
20
|
+
_.r.Tn=function(a){var b=this;if(a.success)this.B=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 _.Q(_.Fc,{adsTimeline:new BU(this.a)})),this.j=new _.ov(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.ke(wU).f);else this.m.onError(new _.O(1,9,10003,{errorType:0},
|
|
21
|
+
void 0));this.l.resolve()};_.r.Yn=function(a){HU(this,_.jc,a);this.j.start()};_.r.Xn=function(a){this.f=null;a=a.slot;HU(this,_.kc);this.j.stop();GU(this);a&&a.getTimePositionClass()===tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL||this.m.play()};
|
|
22
|
+
_.r.ln=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:HU(this,_.Bc,a);HU(this,_.uc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:HU(this,_.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:HU(this,_.oc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:HU(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:HU(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:HU(this,_.nc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:HU(this,
|
|
23
|
+
_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:HU(this,_.xc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:HU(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:HU(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:HU(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:HU(this,_.yc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.O(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],
|
|
24
|
+
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.cl=function(){var a=this;if(!this.f){var b=this.m.getPosition();if(this.f=this.o.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.o.findIndex(function(d){return d===a.f});this.o.splice(c,1);this.m.pause();FU(this);this.f.play()}}};
|
|
25
|
+
_.r.al=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case 4:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 5:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.A.length?(FU(this),this.f=this.A.shift(),this.f.play()):GU(this);break;case _.eu:case _.Co:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};CU.prototype.getPosition=CU.prototype.getPosition;
|
|
26
|
+
CU.prototype.setVolume=CU.prototype.setVolume;CU.prototype.getVolume=CU.prototype.getVolume;CU.prototype.skip=CU.prototype.skip;CU.prototype.pause=CU.prototype.pause;CU.prototype.resume=CU.prototype.resume;IU.prototype.name=function(){return vU};IU.prototype.a=function(a,b){return a.namespace()!==_.xd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Ea.warn("FreeWheel SDK is not loaded."),!1):!1};IU.prototype.create=function(a){return new CU(a)};_.ei(new IU);_.bp(new yU);};
|
|
27
27
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
28
28
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
29
29
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hls.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
function(c,d){return d+b})},
|
|
4
|
-
}this.a=a;this.verbatimUri="";this.type=b;this.Y=c;this.S=1===b?d:null},
|
|
5
|
-
|
|
6
|
-
!_.Y.
|
|
7
|
-
d.push(f);if(f.name===_.
|
|
8
|
-
"EXT-X-PART"===h.name||"EXT-X-PRELOAD-HINT"===h.name&&"PART"===_.T(h,_.Kb)?g.push(h):f.push(h)):(_.Y.
|
|
9
|
-
e+"' as it is not defined in the master playlist");d.set(e,f)});return d},
|
|
10
|
-
e+f+10);for(var 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}}
|
|
11
|
-
204),f=_.
|
|
12
|
-
1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},
|
|
13
|
-
if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.
|
|
14
|
-
[{initDataType:_.
|
|
15
|
-
case 2:if(d!==_.
|
|
16
|
-
b.la,b.la+2048-1,a.a.attemptParameters),e.type=2,f=_.
|
|
17
|
-
a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.
|
|
18
|
-
a.streams.find(function(d){d=d.S;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.S.find(function(d){return d.position===b})||null},
|
|
19
|
-
|
|
20
|
-
textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,
|
|
21
|
-
b.duration;
|
|
22
|
-
d.keyId})},
|
|
23
|
-
var h=f.S[0];if(!h)break;
|
|
24
|
-
a=Date.parse(a.value);return isNaN(a)?null:a},
|
|
25
|
-
this.P=!1;this.I=null;this.O=!1;this.B=new Map;this.J=new Set},
|
|
26
|
-
{configurationId:a.D.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,
|
|
27
|
-
f===c.AUDIO&&(g="mp4a.40.2");d=
|
|
28
|
-
y&&(
|
|
29
|
-
_.Y,_.x(p,
|
|
30
|
-
h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.
|
|
31
|
-
height:u.height,frameRate:u.frameRate}});return
|
|
32
|
-
e=
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
2);c=l.f;d=_.v(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({
|
|
36
|
-
f),h))}return d},
|
|
37
|
-
y.a){e=new Set;f=_.
|
|
38
|
-
kind:b.kind||null,name:b.label,channelsCount:b.channelsCount,spatialAudio:b.spatialAudio||!1,closedCaptions:b.closedCaptions,
|
|
39
|
-
b.toString());b=!1;var h=_.
|
|
40
|
-
p?d.get(g(f.VIDEO,p))||[]:[],u={audio:q,video:t},y=m.verbatimUri,
|
|
41
|
-
f.next();!g.done;g=f.next()){g=g.value;for(var h=_.v(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.
|
|
42
|
-
_.
|
|
43
|
-
_.Y.
|
|
44
|
-
_.
|
|
45
|
-
(e.push(f),d.add(g))}return e},
|
|
46
|
-
spatialAudio:!1,
|
|
47
|
-
C=f.closedCaptions;E=f.
|
|
48
|
-
adjustSegmentDurations:
|
|
49
|
-
S:
|
|
50
|
-
d=_.T(b,_.Mb,void 0,{required:c});if(!d)return p["return"](null);e=_.
|
|
51
|
-
|
|
52
|
-
4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},
|
|
53
|
-
c)},rM=function(a,b,c,d,e,f,g){var h=[],l={}
|
|
54
|
-
0<_.Y.
|
|
55
|
-
f=tM,g=b.verbatimUri,h=b.S,l=e.
|
|
56
|
-
4,4030,"Segment not found in pervious playlist update.");l=
|
|
57
|
-
|
|
58
|
-
E;J=[];
|
|
59
|
-
a.j.get(c.verbatimUri);tM.
|
|
60
|
-
b);if(null!=c)return c;throw new _.
|
|
61
|
-
f.join(", "));return n["return"](m.toLowerCase().split(";")[0])})},
|
|
62
|
-
b=_.v(a.j.values()),d=b.next();!d.done;d=b.next())d=d.value.streams[0],95443.7176888889>d.
|
|
63
|
-
b){_.Y.
|
|
64
|
-
_.r
|
|
65
|
-
var tM={
|
|
66
|
-
"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}return 0},
|
|
67
|
-
Error(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
d.join(", ")+" are incompatible."),new _.
|
|
71
|
-
|
|
2
|
+
var f=function(window){var bK="Could not parse MP4 segment start time.",cK="EXT-X-DATERANGE",dK="EXT-X-DISCONTINUITY",eK="EXT-X-KEY",fK="EXT-X-MAP",gK="EXT-X-MEDIA-SEQUENCE",hK="EXT-X-PROGRAM-DATE-TIME",iK="Failed to infer discontinuity number",jK="Guessing audio-only",kK="METHOD",lK="SAMPLE-AES-CTR",mK="Setting playlist start time to ",nK="_HLS_part",oK="application/vnd.apple.mpegurl",pK="manifestloaded",qK="sample",rK=function(a){if(1>a.a)throw _.gq();--a.a},sK=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},
|
|
3
|
+
function(c,d){return d+b})},tK=function(a,b){b=void 0===b?0:b;return b+10<=a.length&&73===a[b]&&68===a[b+1]&&51===a[b+2]&&255>a[b+3]&&255>a[b+4]&&128>a[b+6]&&128>a[b+7]&&128>a[b+8]&&128>a[b+9]?!0:!1},uK=function(a){a=_.Bn(a)||"";return null!=_.Np.video[a]?_.Sg:null!=_.Np.audio[a]?_.Sc:null},vK=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.O(_.P,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.O(_.P,4,4043,"Media playlist must have at least one full segment!");
|
|
4
|
+
}this.a=a;this.verbatimUri="";this.type=b;this.Y=c;this.S=1===b?d:null},wK=function(a,b,c){c=void 0===c?[]:c;this.Y=b;this.a=a;this.f=c;this.sa=-1},xK=function(a){return a.some(function(b){return b.startsWith("#EXT-X-TARGETDURATION")})?1:0},yK=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.O(_.P,4,4044,"Undefined variable '"+d+"'");return e})},zK=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=yK(d.value,b)})})},
|
|
5
|
+
AK=function(a,b){var c=new Map,d=new URL(b);a.forEach(function(e){var f=_.T(e,_.gb),g=_.T(e,"QUERYPARAM");if(f)g=_.Qp(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.O(_.P,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.O(_.P,4,4044,"Query param '"+g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},BK=function(){this.h=0;this.a=new Map},EK=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&
|
|
6
|
+
!_.Y.Km(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.O(_.P,4,4015);b=b.slice(1);return 0===xK(b)?CK(a,b,c):DK(a,b,c)},DK=function(a,b,c){var d=FK(b);b=d.Fo;var e=d.Dm,f=GK(a,d.kp,c);d=e.map(function(g){return HK(a,g,f)});b=IK(a,c,b,f);return new vK(c,1,d,b)},FK=function(a){var b=[],c=[],d=[];a=_.v(a);for(var e=a.next();!e.done;e=a.next())e=e.value,JK.test(e)?d.push(e):KK.test(e)?c.push(e):b.push(e);return{Fo:b,Dm:c,kp:d}},CK=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=HK(a,b[e]);
|
|
7
|
+
d.push(f);if(f.name===_.Ma){var g=b[e+1];if(!g)throw new _.O(_.P,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Rp(_.Mb,g));e++}}b=_.Y.sc(d,"EXT-X-DEFINE");_.Y.Qj(b);b=AK(b,c);a.a=b;zK(d,a.a);return new vK(c,0,d)},LK=function(a,b,c){var d=[],e=[];e.push(new _.Rp(_.pa,"0"));e.push(new _.Rp(_.Mb,b));c.length&&e.push(new _.Rp(_.ua,c));d.push(new _.Pp(a.h++,_.Ma,e));return new vK(b,0,d)},IK=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(h){_.Y.Qm(h)?(h=HK(a,h,d),
|
|
8
|
+
"EXT-X-PART"===h.name||"EXT-X-PRELOAD-HINT"===h.name&&"PART"===_.T(h,_.Kb)?g.push(h):f.push(h)):(_.Y.Nc(f,"EXT-X-GAP")||(h=yK(h,d),h=_.An(h,b),e.push(new wK(h,f,g))),f=[],g=[])});0<g.length&&e.push(new wK(null,f,g));return e},HK=function(a,b,c){a=_.Ys(a.h++,b);c&&zK([a],c);return a},GK=function(a,b,c){b=b.map(function(e){return HK(a,e)});_.Y.Qj(b);var d=AK(b,c);b.map(function(e){return _.T(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.O(_.P,4,4044,"Cannot import variable '"+
|
|
9
|
+
e+"' as it is not defined in the master playlist");d.set(e,f)});return d},MK=function(){this.a=new Map;this.f=new Map},NK=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.O(_.P,4,4030);}tK(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,
|
|
10
|
+
e+f+10);for(var 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}}tK(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},OK=function(a){for(;a.getPosition()<a.Xa()-1;){var b=a.getPosition();if(71===_.hq(a))return rK(a),b}return-1},PK=function(a){function b(){d.seek(e+188);f=_.hq(d);71!==f&&(d.seek(e+192),f=_.hq(d));71!==f&&(d.seek(e+
|
|
11
|
+
204),f=_.hq(d));71!==f&&c();rK(d)}function c(){throw new _.O(_.P,4,4030);}var d=new _.eq(new DataView(a),!1),e=0,f=0;e=OK(d);0>e&&(_.Fw.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.hq(d),71!==f&&c(),a=_.iq(d),8191===(a&8191))b();else if(a&16384)if(a=(_.hq(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.hq(d),d.skip(a)),1!==_.jq(d)>>8)b();else{d.skip(3);a=_.hq(d)>>6;0!==a&&1!==a||c();0===_.hq(d)&&c();a=_.hq(d);var g=_.iq(d),h=_.iq(d);return(1073741824*((a&14)>>
|
|
12
|
+
1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},QK=function(a,b){var c=null,d=0;try{(new _.oq).M(_.We,_.pq).M(_.Bg,_.pq).M(_.Re,_.pq).ba("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.jq(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.Fw.error("Unable to find timescale in init segment!"),new _.O(_.P,4,4030,bK,c);var e=0,f=!1;try{(new _.oq).M("moof",_.pq).M("traf",_.pq).ba("tfdt",function(g){var h=d;if(0===g.version)h=_.jq(g.reader)/h;else{var l=_.jq(g.reader),m=_.jq(g.reader);
|
|
13
|
+
if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.O(_.P,4,4030,bK,c);return e},TK=function(a){var b=_.Qp(a,kK);if(!RK.includes(b))return SK.error("PlayReady in HLS is only supported with [",RK.join(", "),"], not",b),null;a=_.Qp(a,_.Mb);b=_.Rm(a);a=null;b=_.Qi(b.data);try{a=_.kC(_.Qr(b))}catch(c){a=b}return _.xC(_.Kd,
|
|
14
|
+
[{initDataType:_.ld,initData:a}],"")},UK=function(a){this.g=new _.L("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Wk()}},WK=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,t;return _.I(function(u){switch(u.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Vc||d===_.Uc)return u["return"](0);g=f;if(d!==_.Tc){u.C(2);break}return _.x(u,VK(a,c,g),3);case 3:h=u.f;l=_.Qi(h.data);if(!tK(l))throw new _.O(_.P,4,4030,"AAC segment does not contain an ID3 tag.");return u["return"](NK(l));
|
|
15
|
+
case 2:if(d!==_.Ug&&d!==_.Wc){u.C(4);break}m=[VK(a,c,g)];b&&m.push(VK(a,b,!0));return _.x(u,Promise.all(m),5);case 5:return n=u.f,p=n[0],q=n[1]||n[0],u["return"](QK(p.data,q.data));case 4:if(d!==_.Tg){u.C(6);break}return _.x(u,VK(a,c,g),7);case 7:return t=u.f,u["return"](PK(t.data));case 6:if(!_.Yu((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return u["return"](0);throw new _.O(_.P,4,4030);}})},VK=function(a,b,c){var d,e,f,g,h,l,m;return _.I(function(n){switch(n.a){case 1:return d=b.f(),e=_.fD(b.La(),
|
|
16
|
+
b.la,b.la+2048-1,a.a.attemptParameters),e.type=2,f=_.fD(b.La(),b.la,b.ga,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.F(n,2),g=c?f:e,_.x(n,a.f(g),4);case 4:return h=n.f,n["return"](h);case 2:l=_.H(n);if(7001===l.code||c)throw l;a.g.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS pre-flights.",e.uris[0]);_.F(n,5);return _.x(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.H(n),
|
|
17
|
+
a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.O(_.P,4,4030,"Failed to fetch the media segment.");}})},XK=function(a){this.streams=a},YK=function(a,b){a.streams.forEach(function(c){c.fg=b})},ZK=function(a,b){a.streams.forEach(function(c){c.width=b})},$K=function(a,b){a.streams.forEach(function(c){c.height=b})},aL=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},bL=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},cL=function(a,b){var c=
|
|
18
|
+
a.streams.find(function(d){d=d.S;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.S.find(function(d){return d.position===b})||null},dL=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},eL=function(a){this.a=a},fL=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},gL=function(a,b){var c=new Set(a.map(function(d){return d.sa}));return b.filter(function(d){return!c.has(d.sa)})},
|
|
19
|
+
iL=function(a,b){for(;a[0].sa<b[0].sa;)a.splice(0,1);var c=a[0],d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||hL(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&hL(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},nL=function(a,b,c,d,e){var f=b[0].length();f=sK(f).map(function(g){var h=fL(b,g)||[],l=dL(c,g)||[];g=dL(d,g)||[];var m=_.ph(jL(h)).concat(_.ph(l),_.ph(g)).filter(Boolean);kL(m);var n=m[0];m=n.sa;n=n.duration;return{configurationId:a,variants:h,
|
|
20
|
+
textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,sa:m}});e&&lL(f[0]);mL(f);return f},jL=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},lL=function(a){var b=jL(a.variants)[0].S[0].Ha;a.startTime+=b;a.endTime+=b},mL=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},hL=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=
|
|
21
|
+
b.duration;oL(a.variants,b.variants);pL(_.Y.Tf(a),_.Y.Tf(b))},oL=function(a,b){var c=new Map(a.map(function(d){return[_.Y.ai(d),d]}));b.forEach(function(d){c.get(_.Y.ai(d)).drmInfos=d.drmInfos})},pL=function(a,b){var c=new Map(a.map(function(d){return[d.Dc,d]}));b.forEach(function(d){var e=c.get(d.Dc);e.S=d.S;d.S.forEach(function(f){f.initSegment=e.initSegmentReference});e.segmentIndex.replace(d.S);e.vc=d.vc;e.yf=d.yf;e.duration=d.duration;e.gi=d.gi;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=
|
|
22
|
+
d.keyId})},kL=function(a){var b=qL(a);a.forEach(function(c){_.aD(c.segmentIndex,b);c.duration=b;c.yf=c.vc+b})},qL=function(a){var b=Infinity;_.Y.Yl(a).forEach(function(c){b=Math.min(b,c.duration)});return b},uL=function(a){if(!(2>a.length)&&rL(a)){a=a.map(function(e){return{playlist:e,ci:sL(e.S[0])}});var b=a.map(function(e){return e.ci}),c=Math.max.apply(Math,_.ph(b));b=Math.min.apply(Math,_.ph(b));if(!(1E3>c-b)){a.forEach(function(e){for(var f=e.playlist,g=e.ci;0<f.S.length&&1E3<c-g;){e=f.S.shift();
|
|
23
|
+
var h=f.S[0];if(!h)break;tL(e,h);h=sL(h);null!=h?g=h:(e=_.Y.sj(e.Y).duration,g+=1E3*e)}});a=a.map(function(e){return e.playlist});if(a.some(function(e){return 0===e.S.length}))throw new _.O(_.P,4,4048,"Media playlists are completely out of sync.");var d=Math.min.apply(Math,_.ph(a.map(function(e){return e.S.length})));a.forEach(function(e){for(;e.S.length>d;)e.S.pop()})}}},rL=function(a){return a.every(function(b){return!!sL(b.S[0])})},sL=function(a){if(!a)return null;a=_.Y.Wa(a.Y,hK);if(!a)return null;
|
|
24
|
+
a=Date.parse(a.value);return isNaN(a)?null:a},tL=function(a,b){a&&b&&[fK,eK].forEach(function(c){if(!_.Y.Nc(b.Y,c)){var d=a.Y.filter(function(e){return e.name===c});0!==d.length&&d.forEach(function(e){b.Y.push(e)})}})},vL=function(){var a=this;this.a=this.D=null;this.h=1;this.j=new MK;this.o="";this.T=new BK;this.H=0;this.w=null;this.l=new _.gj(function(){a.hc()});this.A=_.Ub;this.f=null;this.G=new _.lm;this.K=this.F=null;this.g=new _.L("clpp.hls.HlsParser");this.L=new Map;this.Z=new UK(this.og.bind(this));
|
|
25
|
+
this.P=!1;this.I=null;this.O=!1;this.B=new Map;this.J=new Set},wL=function(a){if(null===a.w)return[];a=a.w;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.Dc})},xL=function(a,b){var c=new Set(b.map(function(h){return h.id}));a.B.forEach(function(h,l){c.has(l)||a.B["delete"](l)});for(var d=_.v(b),e=d.next();!e.done;e=d.next()){e=e.value;var f=a.B.get(e.id);if(f&&f.Ke!==e.Ke)a.D.onError(new _.O(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+e.id));var g=
|
|
26
|
+
{configurationId:a.D.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,Ke:e.Ke,endTime:e.endTime,id:e.id,type:_.xe,eventElement:null};f&&!_.M.Si(f,g)||a.B.set(e.id,g)}return Array.from(a.B.values())},GL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,D,C,B,E,A;return _.I(function(J){switch(J.a){case 1:c=_.su;d=yL(a,b,a.o,"");if(1===d.type){e=d.S[0].a;f=uK(e);if(!f)throw new _.O(_.P,4,4021,"Unknown file extension "+e);g="";f===c.VIDEO?g="avc1.42E01E":
|
|
27
|
+
f===c.AUDIO&&(g="mp4a.40.2");d=LK(a.T,a.o,a.a.hlsDefaultCodecs||g)}h=_.Y.mo(d.Y);l=zL(h.Sc.Dh);l.forEach(function(N){a.J.add(N.groupId)});return _.x(J,AL(a,h),4);case 4:m=J.f;J.C(3);break;case 5:m=J.f;case 3:n=m;p=n.Zm;q=n.periods;t=n.wo;u=n.Xo;y=n.alternativeVariants;D=n.alternativeTextStreams;C=n.alternativeImageStreams;if(!a.D)throw new _.O(_.P,7,7001);BL(a,q);B=CL(a,p.delay,q,t);DL(a)||(a.H=p.Me,EL(a));FL(a,B,q);E=xL(a,u);A={presentationTimeline:B,periods:q,minBufferTime:0,cues:E,muxedAudioTracks:l};
|
|
28
|
+
y&&(A.alternativeVariants=y);D&&(A.alternativeTextStreams=D);C&&(A.alternativeImageStreams=C);a.g.debug("HLS playlist parsed",A);return J["return"](A)}})},zL=function(a){return a.filter(function(b){return b.name===_.La&&_.T(b,_.Kb)===_.ja&&!_.T(b,_.Mb)}).map(function(b){var c=_.Y.ri(b),d=_.T(b,_.$a)||_.Hg;return{groupId:_.Qp(b,_.Ra),id:_.aK++,label:_.Qp(b,_.gb),language:d,channelsCount:c,primary:"YES"===_.T(b,"DEFAULT")}})},JL=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=
|
|
29
|
+
_.Y,_.x(p,HL(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;g=d.mk;h=a.f.periods[0].variants;a.a.lowLatencyMode&&null!==a.w&&(h=h.filter(function(q){return q.id===a.w.id}));l=h.map(function(q){var t=c.ki(q.audio,g),u=c.ki(q.video,g);q=IL(a,t,u,q.bandwidth);if(!q)throw new _.O(_.P,4,4047,{message:"Video and audio are encrypted in an incompatible way.",bq:u?u.cc():void 0,audio:t?t.cc():void 0});return q});m=a.D.configurationId;n=nL(m,l,e,f,!0);return p["return"](n)})},HL=function(a,b){var c,d,e,f,g,
|
|
30
|
+
h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.su,d=function(q){return q.stream.a()===c.VIDEO||q.stream.a()===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),g=function(q){q=q.map(function(t){var u=t.stream.streams[0];t=Object.assign({},{playlist:t.playlist},{language:u.language,channelsCount:u.channelsCount,spatialAudio:u.spatialAudio,closedCaptions:u.closedCaptions,primary:u.primary,kind:u.kind||null,groupId:u.groupId,type:u.type,codecs:u.codecs,name:u.originalId,uri:u.Dc,Pe:{width:u.width,
|
|
31
|
+
height:u.height,frameRate:u.frameRate}});return KL(a,t)});return Promise.all(q)},_.x(p,g(e),2);if(3!=p.a)return h=p.f,_.x(p,g(f),3);l=p.f;LL(a,h.concat(l));m=l.filter(function(q){return q.a()===c.vh});n=l.filter(function(q){return q.a()===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,mk:h})})},LL=function(a,b){b.forEach(function(c){a.j.a.set(c.cc(),c)})},AL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,D,C,B;return _.I(function(E){switch(E.a){case 1:return c=_.Y,d=c.eo(b.Sc.closedCaptions),
|
|
32
|
+
e=ML(a,b.Oe),_.x(E,NL(a,b),2);case 2:return f=E.f,g=Object.values(f).flat().map(function(A){return A.playlist}),h=g[0],l=c.tj(h.Y),a.A=l,OL(a,g),!DL(a)&&uL(g),a.K=c.uj(h.Y),m=c.lo(h.Y,l,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod),_.x(E,PL(a,f.Eh,e),3);case 3:return n=E.f,_.x(E,QL(a,f.Oe,n,d),4);case 4:return p=E.f,_.x(E,RL(a,f.To,e),5);case 5:return q=E.f,_.x(E,SL(a,f.yg),6);case 6:return t=E.f,u=a.D.configurationId,y=nL(u,p,q,t,!DL(a)),a.D.filterAllPeriods(y),D=_.ph(f.Oe).concat(_.ph(f.Eh)).map(function(A){return A.playlist}),
|
|
33
|
+
C=TL(a,D),B=UL(a,D,C),E["return"]({periods:y,wo:C,Xo:B,Zm:m})}})},WL=function(a,b){var c,d,e,f,g;return _.I(function(h){if(1==h.a)return c=_.An(b.verbatimUri,a.o),_.x(h,VL(a,c),2);d=h.f;e=d.response;f=d.text;g=e.uri;return h["return"](yL(a,f,g,b.verbatimUri))})},BL=function(a,b){DL(a)||2!==a.a.timeline.version||(a.I||(a.I=b[0].startTime),_.EE(b,-a.I))},UL=function(a,b,c){b=b.find(function(g){return null!==_.Y.Wa(g.Y,cK)});if(!b)return[];if(null===c)throw new _.O(_.P,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");
|
|
34
|
+
var d=b.Y.filter(function(g){return g.name===cK});b=new Map;d=_.v(d);for(var e=d.next();!e.done;e=d.next()){e=e.value;var f=_.T(e,"ID");f=f?b.get(f):void 0;(e=_.Y.fo(e,c,a.F,!DL(a),f))&&b.set(e.id,e)}return Array.from(b.values())},TL=function(a,b){var c=b.flatMap(function(e){return e.S[0].Y});c=_.Y.Wa(c,hK);if(!c)return null;var d=(new Date(c.value)).getTime();return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+(c.value+").")),null):d/1E3},NL=function(a,b){var c,
|
|
35
|
+
d,e,f,g,h;return _.I(function(l){if(1==l.a)return _.x(l,Promise.all([XL(a,b.Sc.Dh),XL(a,b.Sc.Uo),XL(a,b.Oe),XL(a,b.yg)]),2);c=l.f;d=_.v(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({Eh:e,To:f,Oe:g,yg:h})})},ZL=function(a,b){return Promise.all(b.map(function(c){return YL(a,c)}))},ML=function(a,b){for(var c=_.Y.lf,d=new Map,e=_.v(b),f=e.next();!f.done;f=e.next()){var g=f.value,h=_.T(g,_.ja);f=_.T(g,_.Tb);var l=_.T(g,_.Bb);g=$L(a,g);if(l){var m=_.Mp(_.Dn,
|
|
36
|
+
g);d.set(c(_.Dn,l),m);l=g.indexOf(m);-1<l&&g.splice(l,1)}h&&(l=aM(_.Sc,g),d.set(c(_.Sc,h),l));f&&(h=aM(_.Sg,g),d.set(c(_.Sg,f),h))}return d},RL=function(a,b,c){return Promise.all(b.map(function(d){return bM(a,d,c)}))},SL=function(a,b){return Promise.all(b.map(function(c){return cM(a,c)}))},PL=function(a,b,c){var d,e;return _.I(function(f){if(1==f.a){if(0===b.length)return f["return"](new Map);d=[bM(a,b[0],c)];return _.x(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return bM(a,
|
|
37
|
+
g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.Yo(e))})},QL=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,u;return _.I(function(y){if(1==y.a){e=new Set;f=_.ph(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.Qp(f[l].tag,_.pa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.x(y,dM(a,n,c,d,e),2)}if(3!=y.a)return p=y.f,q=f.map(function(D){return dM(a,D,c,d,e)}),_.x(y,Promise.all(q),3);t=y.f;t.splice(g,0,p);u=t.reduce(_.uC,[]);return y["return"](u)})},eM=function(a,b,c){var d;return _.I(function(e){if(1==
|
|
38
|
+
e.a)return _.x(e,KL(a,{playlist:c,codecs:b.codecs,type:b.type,yd:b.originalLanguage,Bc:b.id,groupId:b.groupId,primary:b.primary,kind:b.kind||null,name:b.label,channelsCount:b.channelsCount,spatialAudio:b.spatialAudio||!1,closedCaptions:b.closedCaptions,Pe:{width:b.width,height:b.height,frameRate:b.frameRate}}),2);d=e.f;b.bandwidth&&bL(d,b.bandwidth);return e["return"](d)})},dM=function(a,b,c,d,e){var f,g,h,l,m,n;return _.I(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.Qp(h,_.pa)),m=f.oo(h),
|
|
39
|
+
_.x(p,fM(a,b,m,c,d),2)):(n=p.f)?p["return"](gM(a,n,l,e)):p["return"]([])})},hM=function(a,b,c,d,e,f){var g=$L(a,b);a.g.debug("Guessing stream type for",b.toString());b=!1;var h=_.Mp(_.Sg,g),l=d+e;1!==g.length||c||h?!l&&1<g.length?(a.g.debug("Guessing multiplexed audio+video"),c=_.Sg,g=[g.join(",")]):d&&f?(a.g.debug(jK),c=_.Sc,b=!0):e?(a.g.debug(jK),c=_.Sc):(a.g.debug("Guessing video-only"),c=_.Sg):(c=_.Sc,a.g.debug(jK));return{type:c,lk:g,Hm:b}},fM=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,u,y,D,
|
|
40
|
+
C,B,E,A,J;return _.I(function(N){if(1==N.a)return f=_.su,g=_.Y.lf,h=b,l=h.tag,m=h.playlist,n=_.T(l,_.ja),p=_.T(l,_.Tb),q=n?d.get(g(f.AUDIO,n))||[]:[],t=p?d.get(g(f.VIDEO,p))||[]:[],u={audio:q,video:t},y=m.verbatimUri,D=u.audio.find(function(V){return V.cc()===y}),C=hM(a,l,c,u.audio.length,u.video.length,D),B=C.type,E=C.lk,A=C.Hm,J=null,A?N.C(2):_.x(N,iM(a,b,E,B,e,c),3);2!=N.a&&(J=N.f);if(null==J)return N["return"](null);u[B]=[J];B===f.AUDIO&&c&&u.video.forEach(function(V){ZK(V,c.width);$K(V,c.height);
|
|
41
|
+
aL(V,c.frameRate)});return N["return"](u)})},gM=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.v(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.v(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.Pl(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=IL(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},IL=function(a,b,c,d,e){for(var f=[],g=(c||
|
|
42
|
+
b).length(),h=0;h<g;h++){var l=b?b.streams[h]||null:null,m=c?c.streams[h]||null:null,n=_.Y.mm(l,m);if(!n)return null;var p=d;l={id:e?e:a.h++,language:l?l.language:_.Hg,primary:!!l&&l.primary||!!m&&m.primary,audio:l,video:m,bandwidth:p,drmInfos:n,allowedByApplication:!0,allowedByKeySystem:!0};f.push(l)}return new eL(f)},bM=function(a,b,c){var d,e,f,g;return _.I(function(h){d=b;e=d.tag;f=d.playlist;g=f.verbatimUri;return h["return"](jM(a,g,function(){var l,m,n,p,q,t,u,y,D,C,B,E,A;return _.I(function(J){if(1==
|
|
43
|
+
J.a){l=_.su;m=_.Y.lf;n=_.Qp(e,_.Ra);p=_.Y.$h(_.Qp(e,_.Kb));q=_.Y.Ll(e);t=c.get(m(p,n))||"";u=_.T(e,_.$a);y=_.T(e,_.gb);D=_.T(e,"DEFAULT");C=p===l.AUDIO?_.Y.ri(e):null;var N=p===l.AUDIO?(N=_.T(e,"CHANNELS"))?N.includes("/JOC"):!1:!1;B=N;E="YES"===D;return _.x(J,KL(a,{playlist:f,codecs:t,type:p,yd:u,primary:E,name:y,channelsCount:C,spatialAudio:B,groupId:n,kind:q,Bc:null,closedCaptions:null,Pe:null}),2)}A=J.f;return J["return"](A)})}))})},cM=function(a,b){var c,d,e,f;return _.I(function(g){c=b;d=c.tag;
|
|
44
|
+
e=c.playlist;f=e.verbatimUri;return g["return"](jM(a,f,function(){var h,l,m,n,p;return _.I(function(q){if(1==q.a)return h=_.T(d,_.ua)||"jpg",l=_.T(d,_.$a),m=_.T(d,_.gb),_.x(q,KL(a,{playlist:e,codecs:h,type:_.Ae,yd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,Bc:null,groupId:null,Pe:null}),2);n=q.f;(p=_.T(d,_.pa))&&bL(n,Number(p));return q["return"](n)})}))})},$L=function(a,b){var c=_.T(b,_.ua,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);c=
|
|
45
|
+
_.Y.Tl(c);var d=new Set,e=[];c=_.v(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.AC(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},iM=function(a,b,c,d,e,f){var g,h,l,m,n;return _.I(function(p){g=b;h=g.tag;l=g.playlist;m=_.su;n=l.verbatimUri;return p["return"](jM(a,n,function(){var q,t,u,y,D;return _.I(function(C){if(1==C.a){q=_.T(h,_.ta);t=null;d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q));var B=_.T(h,_.ja)||void 0;u=B&&a.J.has(B)?B:void 0;B=aM(d,c);if(u){var E=
|
|
46
|
+
aM(_.Sc,c);B+=","+E}y=B;return _.x(C,KL(a,{playlist:l,codecs:y,type:d,closedCaptions:t,primary:!1,kind:null,yd:null,name:null,channelsCount:null,spatialAudio:!1,Bc:null,groupId:null,muxedAudioId:u,Pe:f}),2)}D=C.f;return C["return"](D)})}))})},jM=function(a,b,c){if(a.j.has(b))return a=a.j.get(b),Promise.resolve(a);if(a.j.f.has(b))return a.j.f.get(b)||null;c=c();a.j.set(b,c);return c},KL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,D,C,B,E,A,J,N,V,U,qa;return _.I(function(wa){if(1==wa.a){c=kM;d=lM;
|
|
47
|
+
e=_.su;f=b;g=f.playlist;h=f.codecs;l=f.type;m=f.yd;n=f.Bc;p=f.groupId;q=f.muxedAudioId;t=f.primary;u=f.kind;y=f.name;D=f.channelsCount;C=f.spatialAudio;B=f.closedCaptions;E=f.Pe;A=_.Y.xi(m);if(1!==g.type)throw new _.O(_.P,4,4017);return _.x(wa,mM(a,g,l,h),2)}J=wa.f;N=a.a.lowLatencyMode?d.Yj:d.$j;V=u;l!==e.TEXT||u||(V=_.og);U=_.Y.tj(g.Y);qa=J.map(function(oa){var Ca=oa.S,Ja=oa.Vl,Ia=oa.mimeType,dc=oa.sa,md=Ca[0].startTime,nd=Ca[Ca.length-1].endTime,dk=nd-md,qc=new _.KD(Ca),Ke=Ca[0].initSegment||null;
|
|
48
|
+
return{id:null===n?_.aK++:n,originalId:y,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:qc.Wd.bind(qc),getSegmentReference:qc.get.bind(qc),adjustSegmentDurations:qc.df.bind(qc),getDuration:qc.getDuration.bind(qc),segmentIndex:qc,segmentLookupStrategy:N,initSegmentReference:Ke,mimeType:Ia,codecs:h,kind:V,gi:Ja.type,encrypted:Ja.type===c.ck,aesEncrypted:oa.aesEncrypted,keyId:Ja.keyId,language:A,originalLanguage:m||_.Hg,label:y,type:l,primary:t,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
49
|
+
frameRate:E?E.frameRate:void 0,width:E?E.width:void 0,height:E?E.height:void 0,bandwidth:void 0,roles:[],channelsCount:D,spatialAudio:C,closedCaptions:B,S:Ca,drmInfos:Ja.drmInfos,sa:dc,Dc:g.verbatimUri,fg:g.a,vc:md,yf:nd,duration:dk,groupId:p,Tp:U,muxedAudioId:q}});return wa["return"](new XK(qa))})},XL=function(a,b){var c;return _.I(function(d){if(1==d.a)return _.x(d,Promise.all(b.map(function(e){var f;return _.I(function(g){if(1==g.a)return _.x(g,nM(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:
|
|
50
|
+
null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},nM=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a){c=_.Y.Tm(b);d=_.T(b,_.Mb,void 0,{required:c});if(!d)return p["return"](null);e=_.An(d,a.o);f=Date.now();return _.x(p,VL(a,e),2)}g=p.f;h=g.response;l=g.text;m=Date.now();a.D.onEvent(new _.Q(pK,{detail:{duration:m-f,type:"media"}}));n=h.uri;return p["return"](yL(a,l,n,d))})},YL=function(a,b){var c,d,e,f,g,h,l,m;return _.I(function(n){if(1==n.a){var p=new URL(b.streams[0].fg);
|
|
51
|
+
if(a.a.lowLatencyMode&&a.K&&a.K.Jh){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var t=q.a,u=t.length-1;q={bn:q.position,po:t&&0<t.length?u:null}}else q=null;q&&(t=p.searchParams,u=q.po,t.set("_HLS_msn",q.bn.toString()),null===u&&t.get(nK)&&t["delete"](nK),null!==u&&t.set(nK,u.toString()))}c=p.toString();return _.x(n,VL(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.cc();h=b.streams[0].fg;l=e.uri;h!==l&&(h=l,YK(b,h));m=yL(a,f,h,g);return n["return"]({stream:b,playlist:m})})},
|
|
52
|
+
yL=function(a,b,c,d){a=EK(a.T,b,c);a.verbatimUri=d;return a},oM=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.O(_.P,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},CL=function(a,b,c,d){var e=!0,f=null,g=0;DL(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.nD(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.qD(a,e);pM(a,c);d&&_.pD(a,d);return a},qM=function(a,b,c){a=_.Y.sc(a.Y,fK);if(1<a.length)throw new _.O(_.P,
|
|
53
|
+
4,4020);a=a[0];if(!a)return null;var d=_.Qp(a,_.Mb),e=_.An(d,b);b=_.Y.qj(a,null,!0);return new _.KC(function(){return[e]},b.la,b.ga,c)},rM=function(a,b,c,d,e,f,g){for(var h=[],l={},m=0;m<b.f.length;l={Yf:l.Yf},m++){var n=b.f[m],p=0===m,q=p?a:h[h.length-1],t=p?d:q.endTime,u=Number(_.T(n,_.Ha));u=t+u;p=_.Y.qj(n,p?null:q.ga,p);q=String(_.T(n,_.Mb));q=_.An(q,g);l.Yf=q?[q]:[];t=new _.Tp(c,t,u,function(y){return function(){return y.Yf}}(l),p.la,p.ga,e,f,!1,null,null,null,null);if("YES"===_.T(n,"INDEPENDENT")||
|
|
54
|
+
0===m)t.h=!0;h.push(t)}return h},sM=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.Y,q=c.a;0<_.Y.sc(p,fK).length&&(n=qM(c,l,g));var t=null!=q,u=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={la:0,ga:null};var y=null;t?(c=_.Y.sj(p).duration,a=e+c,q=_.Y.rj(p,b?b.ga:null)):(b=rM(b,c,d,e,f,g,l),a=b[b.length-1].endTime,y=b);h=h===_.Ae?_.Y.no(p):null;d=new _.Tp(d,e,a,function(){return u},q.la,q.ga,f,g,!1,null,h?h.pe:null,h?h.Ne:null,h?h.durationPerTile:null,y,n);d.sa=m;return d},mM=function(a,b,c,d){var e,
|
|
55
|
+
f,g,h,l,m,n,p,q,t,u,y,D;return _.I(function(C){switch(C.a){case 1:return e=_.Y,f=tM,g=b.verbatimUri,h=b.S,l=e.sm(b.Y,gK),m=[],_.x(C,uM(a,b.a,g,h,l,c,d),2);case 2:n=C.f,p=l,q=f.Ro(h),t=0;case 3:if(!(t<q.length)){C.C(5);break}u=q[t];y=m[m.length-1]||null;return _.x(C,vM(a,b.a,u,p,n,c,d,y),6);case 6:D=C.f;m.push(D);p+=u.length;t++;C.C(3);break;case 5:return oM(m),C["return"](m)}})},uM=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,u,y,D,C;return _.I(function(B){if(1==B.a){h=d[0];if(null!=a.F)return B["return"](a.F);
|
|
56
|
+
if(!DL(a)&&a.f)try{var E=a.j.get(c),A=E?cL(E,e)||null:null;if(!A)throw new _.O(_.P,4,4030,"Segment not found in pervious playlist update.");l=A.startTime+A.Ha;a.g.debug(mK+l+".");a.F=l;return B["return"](l)}catch(J){if(m=a.j.get(c))n=m.streams[0].S[0].position,B=m.streams[m.streams.length-1].S,p=B[B.length-1].position,q=e,t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+t+"."),b,m);throw new _.O(_.P,4,4047,{message:"The updated playlist does not share any segments with the previous one.",
|
|
57
|
+
uri:c});}return _.x(B,wM(a,f,g,h),2)}if(3!=B.a)return u=B.f,y=xM.nj(h.Y,a.o,e),D=qM(h,b,y),_.x(B,yM(a,D,h,y,u,g),3);C=B.f;a.g.debug(mK+C+".");a.F=C;return B["return"](C)})},vM=function(a,b,c,d,e,f,g,h){var l,m,n,p,q,t,u,y,D,C,B,E,A,J,N,V,U,qa,wa,oa,Ca,Ja;return _.I(function(Ia){switch(Ia.a){case 1:return l=xM,m=c[0],n=null==h,_.x(Ia,wM(a,f,g,m),2);case 2:p=Ia.f;q=l.io(c,p,h?h.Xm:null);t=q[q.length-1];u=xM.ra(q);y=h?h.Ym:null;D=zM(y,m.Y,a.o,d);C=qM(m,b,D)||(h?h.Jm:null);B=m.sa;if(n){E=e;Ia.C(3);break}return _.x(Ia,
|
|
58
|
+
AM(a,B,C,m,d,D,p,g),4);case 4:E=Ia.f;case 3:A=E;J=[];N=!1;for(V=0;V<c.length;V++)if(U=c[V],qa=J[J.length-1]||null,wa=0===V?0:qa.endTime,oa=d+V,(y=Ca=zM(y,U.Y,a.o,oa))&&(N=!0),Ja=sM(a,qa,U,oa,wa,A,Ca,f,b,B,C))C=Ja.initSegment,J.push(Ja);return Ia["return"]({S:J,Vl:u,Xm:t,aesEncrypted:N,mimeType:p,endTime:J[J.length-1].endTime,sa:B,Jm:C,Ym:y})}})},zM=function(a,b,c,d){return b.some(function(e){return e.name===eK&&"NONE"===_.T(e,kK)})?null:(b=xM.nj(b,c,d))?b:a&&a.generatedIv?Object.assign({},a,{iv:xM.pi(d)}):
|
|
59
|
+
a},OL=function(a,b){b.forEach(function(c){var d=a.j.get(c.verbatimUri);tM.rk(c,d,!DL(a))});tM.Ql(b)},AM=function(a,b,c,d,e,f,g,h){var l;return _.I(function(m){if(1==m.a)return a.L.has(b)?m["return"](a.L.get(b)):_.x(m,yM(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.L.set(b,l);return m["return"](l)})},yM=function(a,b,c,d,e,f){var g;return _.I(function(h){if(null==c.a)return h["return"](0);g=_.Y.Nl(c,d);return h["return"](WK(a.Z,b,g,e,f,null!=d))})},aM=function(a,
|
|
60
|
+
b){if(1===b.length)return b[0];var c=_.Mp(a,b);if(null!=c)return c;throw new _.O(_.P,4,4025,{codecList:b});},wM=function(a,b,c,d){var e,f,g;return _.I(function(h){e=d.a;g=(f=_.Y.Wa(d.Y,fK))?_.Qp(f,_.Mb):null;return h["return"](BM(a,b,c,e,g))})},BM=function(a,b,c,d,e){var f,g,h,l,m;return _.I(function(n){if(1==n.a){f=[d,e].filter(Boolean);if(g=_.Op(f,b,c))return n["return"](g);h=_.$k([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.x(n,a.og(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.O(_.P,
|
|
61
|
+
4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.toLowerCase().split(";")[0])})},FL=function(a,b,c){c=_.Y.um(c);"LIVE"===a.A||"EVENT"===a.A?(c=Math.max(c,b.K),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.A===_.Ub&&(b.f=c)},EL=function(a){for(var b=0,c=_.v(a.j.values()),d=c.next();!d.done;d=c.next())b=Math.max(b,d.value.streams[0].vc);for(c=0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c)for(a.g.debug("Offsetting live streams by",
|
|
62
|
+
c,"to compensate for rollover"),b=_.v(a.j.values()),d=b.next();!d.done;d=b.next())d=d.value.streams[0],95443.7176888889>d.vc?(a.g.debug("Offset applied to",d.type),d.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",d.type)},VL=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.$k([b],a.a.attemptParameters),c.type=1,_.x(f,a.og(c),2);d=f.f;e="";try{e=_.R.ea(d.data)}catch(g){throw new _.O(_.P,4,4042);}e=_.R.Zi(e);e=e.trim();return f["return"]({text:e,response:d})})},DL=function(a){return a.A===
|
|
63
|
+
_.Ub},pM=function(a,b){_.Y.Um(b,function(c,d){_.tD(a,c.S,d.startTime)});_.mD(a.a,b[0].startTime,b[b.length-1].endTime)},CM=function(){},lM={Yj:_.UB,$j:_.TB},kM={ck:qK,wp:"whole-segment",NONE:_.Ze},JK=/^#EXT-X-DEFINE/,KK=/^#(EXT-X-DISCONTINUITY-SEQUENCE|EXT-X-ENDLIST|EXT-X-I-FRAMES-ONLY|EXT-X-MEDIA-SEQUENCE|EXT-X-PART-INF|EXT-X-PLAYLIST-TYPE|EXT-X-SERVER-CONTROL|EXT-X-TARGETDURATION|EXT-X-DATERANGE|EXT-X-VERSION)/;_.r=MK.prototype;
|
|
64
|
+
_.r.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};_.r.has=function(a){return this.a.has(a)};_.r.get=function(a){return this.a.get(a)||null};_.r.values=function(){return Array.from(this.a.values())};_.r.clear=function(){this.f.clear();this.a.clear()};
|
|
65
|
+
var tM={Ql:function(a){var b=tM.fm(a),c=tM.Wm(a);a.forEach(function(d){var e=d.S,f=e.findIndex(function(h){return h.sa===b}),g=e.findIndex(function(h){return h.sa===c+1});-1===g&&(g=e.length);d.S=e.slice(f,g)})},rk:function(a,b,c){b=tM.rm(a,b,c);a=_.v(a.S||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.Nc(c.Y,dK)&&b++,c.sa=b},rm:function(a,b,c){var d=_.Y.Wa(a.Y,"EXT-X-DISCONTINUITY-SEQUENCE");if(d)return Number(d.value);d=tM.Lm(b);if(c&&d)try{return tM.Im(a,b)}catch(e){throw new _.O(_.P,4,4024,
|
|
66
|
+
"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}return 0},Lm:function(a){return 0<tM.tm(a)},Ro:function(a){if(0===a.length)return[];var b=[],c=[];a=_.v(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.Nc(d.Y,dK)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},tm:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].S;return a[a.length-1].sa},Im:function(a,b){var c=_.Y.Wa(a.Y,gK);if(!c)throw tM.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),
|
|
67
|
+
Error(iK);c=Number(c.value);var d=cL(b,c);if(!d)throw tM.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(iK);return d.sa},Wm:function(a){a=a.map(function(b){return b.S[b.S.length-1].sa});return Math.min.apply(Math,_.ph(a))},fm:function(a){a=a.map(function(b){return b.S[0].sa});return Math.max.apply(Math,_.ph(a))}};tM.g=new _.L("clpp.hls.DiscontinuityUtils");var DM={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Tg)throw new _.O(_.P,4,4041);if(_.Qp(a,kK)===lK)throw new _.O(_.P,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.xC(_.Id,[{initDataType:_.eg,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":TK,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":TK,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.Qp(a,kK);if(!RK.includes(b))return SK.error("Widevine in HLS is only supported with [",
|
|
68
|
+
RK.join(", "),"], not",b),null;b=_.Qp(a,_.Mb);b=_.Rm(b);b=_.Qi(b.data);b=_.xC(_.Md,[{initDataType:_.ld,initData:b}],"");if(a=_.T(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},RK=["SAMPLE-AES",lK],SK=new _.L("clpp.hls.DrmParser");var xM={io:function(a,b,c){if(_.Y.Nc(a[0].Y,eK)||null===c)return c=xM.oj(a,b),0===c.length?[{type:_.Ze,drmInfos:[],keyId:null}]:c;a=xM.oj(a,b);return[c].concat(_.ph(a))},ra:function(a){if(0===a.length)return{type:_.Ze,drmInfos:[],keyId:null};if(a.some(function(c){return"whole-segment"===c.type})||a.every(function(c){return c.type===_.Ze}))return a[0];a=a.filter(function(c){return c.type===qK});var b=_.Mi(a.flatMap(function(c){return c.drmInfos}));return{keyId:a[a.length-1].keyId,type:qK,drmInfos:b}},
|
|
69
|
+
oj:function(a,b){return xM.Zl(a).map(function(c){return xM.ko(c.Y,b)}).filter(Boolean)},Zl:function(a){return a.filter(function(b){return _.Y.Nc(b.Y,eK)})},ko:function(a,b){var c=_.Y.sc(a,eK).filter(function(e){return"AES-128"!==_.Qp(e,kK)});if(0===c.length)return null;var d=_.Qp(c[0],kK);if(1===c.length&&"NONE"===d)return{type:_.Ze,drmInfos:[],keyId:null};d=c.map(function(e){return _.Qp(e,kK)});if(!d.every(function(e){return"SAMPLE-AES"===e})&&!d.every(function(e){return e===lK}))throw xM.g.warn("EXT-X-KEY methods "+
|
|
70
|
+
d.join(", ")+" are incompatible."),new _.O(_.P,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");c=c.map(function(e){var f=_.T(e,"KEYFORMAT","identity"),g=DM[f]||null;(e=g?g(e,b):null)||xM.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===c.length)throw new _.O(_.P,4,4026);return{keyId:c.map(function(e){return e.keyIds}).reduce(function(e,f){return e.concat(f)},[]).reverse()[0]||null,type:qK,drmInfos:c}},Qp:function(){return{type:_.Ze,drmInfos:[],keyId:null}},
|
|
71
|
+
nj:function(a,b,c){a=_.Y.sc(a,eK)[0];if(!a||"AES-128"!==_.Qp(a,kK))return null;var d=xM.km(a,c);c=d.iv;d=d.generatedIv;return{method:"AES-128",url:_.An(_.Qp(a,_.Mb),b),iv:c,generatedIv:d}},pi:function(a){return _.Qm(new Uint8Array(12),new Uint8Array([a>>24&255,a>>16&255,a>>8&255,a&255]))},km:function(a,b){var c=_.T(a,"IV","");if(c)return{iv:_.Nm((c||"0x").slice(2)),generatedIv:!1};c=_.T(a,"KEYFORMAT");return null==c||"identity"===c?{iv:xM.pi(b),generatedIv:!0}:{iv:null,generatedIv:!1}}};xM.g=new _.L("clpp.hls.EncryptionUtils");XK.prototype.length=function(){return this.streams.length};XK.prototype.f=function(){return this.streams[0].groupId};XK.prototype.a=function(){return this.streams[0].type};XK.prototype.cc=function(){return this.streams[0].Dc};eL.prototype.length=function(){return this.a.length};_.r=vL.prototype;_.r.configure=function(a){this.a=a;this.Z.a=a};_.r.setCurrentVariant=function(a){this.w=a};_.r.start=function(a,b){var c=this,d,e,f,g,h,l,m;return _.I(function(n){if(1==n.a){if(c.P)throw Error("start() may be called only once!");c.P=!0;c.D=b;d=Date.now();return _.x(n,VL(c,a),2)}if(3!=n.a)return e=n.f,f=e.response,g=e.text,h=Date.now(),c.D.onEvent(new _.Q(pK,{detail:{duration:h-d,type:"master"}})),c.o=f.uri,_.x(n,GL(c,g),3);l=n.f;c.f=l;m=c.H;c.l&&0<m&&c.l.ha(m);return n["return"](l)})};
|
|
72
72
|
_.r.requestStop=function(){this.O=!0};_.r.stop=function(){this.l&&(this.l.stop(),this.l=null);var a=[];this.G&&(a.push(this.G.destroy()),this.G=null);this.j.clear();this.f=this.a=this.D=this.w=null;this.B.clear();this.J.clear();return Promise.all(a)};
|
|
73
|
-
_.r.update=function(){var a=this,b,c,d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:b=a.f;if(
|
|
74
|
-
g);m=
|
|
75
|
-
_.r.loadVariant=function(a,b){var c=this,d,e,f,g,h,l,m,n,p,q,t,u,y,
|
|
76
|
-
n,E))})}));h.video&&(p=h.video,m=
|
|
77
|
-
_.r.loadTextStream=function(a,b){var c=this,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){(e=c.f.periods.find(function(n){return n.id===b}))&&(f=e.textStreams.find(function(n){return n.id===a})||null)&&(d=f);if(d||!c.f.alternativeTextStreams)return m.C(2);g=c.f.alternativeTextStreams.find(function(n){return n.id===a})||null;if(!g)throw new _.
|
|
78
|
-
3)}2!=m.a&&(l=m.f)&&c.f.periods.forEach(function(n,p){var q=l.streams[p];c.f.periods[p].textStreams.push(q);q.id===a&&(d=q)});if(!d)throw new _.
|
|
79
|
-
_.r.
|
|
73
|
+
_.r.update=function(){var a=this,b,c,d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:b=a.f;if(DL(a)||!b)return p["return"]();c=b.presentationTimeline;"LIVE"===a.A&&(a.F=null);d=Array.from(a.j.values());a.a.lowLatencyMode&&null!==a.w&&(e=wL(a),d=d.filter(function(q){return e.includes(q.cc())}));return _.x(p,ZL(a,d),2);case 2:return f=p.f,g=f.map(function(q){return q.playlist}),OL(a,g),_.x(p,JL(a,f),3);case 3:h=p.f;gL(b.periods,h).forEach(function(q){a.D.filterNewPeriod(q)});BL(a,h);l=TL(a,
|
|
74
|
+
g);m=UL(a,g,l);b.cues=xL(a,m);iL(b.periods,h);pM(c,h);if(n=_.Y.Fm(g))!0!==a.a.keepTimelineLive&&(a.A=_.Ub,_.qD(c,!0),c.f=h[h.length-1].endTime),a.l.stop(),a.l=null;if(a.D.onUpdate)a.D.onUpdate(b);if(n&&a.D.onTurnedStatic)a.D.onTurnedStatic();if(!a.O){p.C(4);break}return _.x(p,a.stop(),4);case 4:return p["return"](b)}})};
|
|
75
|
+
_.r.loadVariant=function(a,b){var c=this,d,e,f,g,h,l,m,n,p,q,t,u,y,D,C;return _.I(function(B){if(1==B.a){d=a.id;if(e=c.f.periods.find(function(E){return E.id===b}))if(f=e.variants.find(function(E){return E.id===d}))return B["return"](f);g=c.f.alternativeVariants.find(function(E){return E.id===d});if(!g)throw new _.ui("No alternative variant with id: "+d);h=g;m=l=null;h.audio&&(n=h.audio,l=jM(c,n.verbatimUri,function(){var E;return _.I(function(A){if(1==A.a)return _.x(A,WL(c,n),2);E=A.f;return A["return"](eM(c,
|
|
76
|
+
n,E))})}));h.video&&(p=h.video,m=jM(c,p.verbatimUri,function(){var E;return _.I(function(A){if(1==A.a)return _.x(A,WL(c,p),2);E=A.f;return A["return"](eM(c,p,E))})}));return _.x(B,l,2)}if(3!=B.a)return q=B.f,_.x(B,m,3);t=B.f;if(u=IL(c,q,t,h.bandwidth,h.id))D=c.D.configurationId,C=nL(D,[u],[],[],!DL(c)),c.D.filterAllPeriods(C),C.forEach(function(E,A){c.f.periods[A].variants.push(E.variants[0]);b===c.f.periods[A].id&&(y=E.variants[0])});if(!y)throw new _.ui("Could load variant with id: "+d);return B["return"](y)})};
|
|
77
|
+
_.r.loadTextStream=function(a,b){var c=this,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){(e=c.f.periods.find(function(n){return n.id===b}))&&(f=e.textStreams.find(function(n){return n.id===a})||null)&&(d=f);if(d||!c.f.alternativeTextStreams)return m.C(2);g=c.f.alternativeTextStreams.find(function(n){return n.id===a})||null;if(!g)throw new _.ui(_.AB+a);h=g;return _.x(m,jM(c,h.verbatimUri,function(){var n;return _.I(function(p){if(1==p.a)return _.x(p,WL(c,h),2);n=p.f;return p["return"](eM(c,h,n))})}),
|
|
78
|
+
3)}2!=m.a&&(l=m.f)&&c.f.periods.forEach(function(n,p){var q=l.streams[p];c.f.periods[p].textStreams.push(q);q.id===a&&(d=q)});if(!d)throw new _.ui(_.AB+a);return m["return"](d)})};_.r.hc=function(){var a=this,b,c;return _.I(function(d){if(1==d.a){a.g.debug(_.KB);if(!a.D)return d["return"]();_.F(d,2);return _.x(d,a.update(),4)}if(2!=d.a)return a.l&&0<a.H&&a.l.ha(a.H),_.G(d,0);b=_.H(d);if(!(b instanceof _.O))throw b;a.D&&(a.D.onError(b),c=b,1===c.severity&&a.l&&a.l.ha(.1));_.z(d)})};
|
|
79
|
+
_.r.og=function(a){if(!this.G)throw new _.O(_.P,7,7001);a=this.D.networkingEngine.fetch(a);_.nm(this.G,a);return a.U};_.w(CM,_.bv);CM.prototype.install=function(){_.Xv.m3u8=vL;_.Wv[_.Yl]=vL;_.Wv[oK]=vL};CM.prototype.uninstall=function(){_.kE("m3u8");_.lE(_.Yl);_.lE(oK)};CM.prototype.id=function(){return"hls"};_.K("clpp.hls.HlsComponent",CM);};
|
|
80
80
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
81
81
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
82
82
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hlssmpte.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
c.mode=_.
|
|
6
|
-
a.m.getTrackManager().
|
|
7
|
-
_.K("clpp.hlssmpte.HlsSmptePlugin",
|
|
2
|
+
var f=function(window){var jU=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.M.R(a)){a:{var b=a.info;if(_.M.ia(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=_.M.ia(a)?a:null}},lU=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.wi;this.h=(a=_.zv(_.Pc))?new a(this.m.getConfiguration()):null;this.g=new _.L("clpp.hlssmpte.ImageCueHandler");this.f=null;kU(this)},kU=function(a){a.a.one(a.m,_.Le,function(){return mU(a)})},
|
|
3
|
+
mU=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Ec,function(d){return nU(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Te}).forEach(function(d){nU(a,{track:d})});!oU(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."),pU(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
|
|
4
|
+
oU=function(a){return a.some(function(b){return b.kind===_.Te})},pU=function(a,b){var c=a.m.getTrackManager(),d=c.oa(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ia(d)};a.a.on(b.textTracks,_.Ec,function(g){g.track.kind===_.Te&&(a.a.off(b.textTracks,_.Ec,f),f())});c.Ia(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},nU=function(a,b){var c=b.track;c.kind===_.Te&&(a.g.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.we,a.a.on(c,_.Td,function(d){return qU(a,d)}))},qU=function(a,b){var c=rU(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new jU(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.R.gb(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},rU=function(a){return(a=
|
|
6
|
+
a.m.getTrackManager().xa())&&a.language&&a.language.toLowerCase()},sU=function(){this.a=null;this.f=!1},tU=function(){};lU.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.w(sU,_.Zv);sU.prototype.onPlayerCreated=function(){};sU.prototype.onContentWillLoad=function(a){if(this.f=_.qj()){var b=a.getConfiguration();b=_.M.jb(b.hlssmpte||{});_.M.Mi(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.M.za(b.timestampOffset)||(b.timestampOffset=0);this.a=new lU(a,b.patchMetadataTrack,b.timestampOffset)}};sU.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.x(b,a.a.destroy(),3):b.C(0);a.a=null;_.z(b)})};sU.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.K("clpp.hlssmpte.HlsSmptePlugin",sU);sU.Id="hlssmpte";tU.prototype.create=function(){return new sU};_.bp(new tU);};
|
|
8
8
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
9
9
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
10
10
|
else{_=this.clpp._;(f.call(g,this));}
|