@castlabs/prestoplay 6.25.2 → 6.26.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 +15 -0
- package/README.md +5 -5
- 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 +112 -112
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +601 -600
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +89 -88
- package/cjs/cl.externs.js +37 -31
- package/cjs/cl.freewheel.js +24 -24
- 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 +23 -23
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +341 -334
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +17 -17
- 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 +38 -36
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +489 -488
- package/cl.crypto.js +9 -9
- package/cl.dash.js +82 -82
- package/cl.externs.js +37 -31
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +79 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mediatailor.js +3 -3
- package/cl.mse.js +299 -292
- 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 +14 -14
- package/cl.smooth.js +60 -60
- 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 -27
- package/package.json +3 -3
- package/typings.d.ts +41 -3
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
|
-
a.a.registerVideoDisplayBase(
|
|
6
|
-
_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.
|
|
7
|
-
_.I("clpp.freewheel.FreeWheelPlugin",
|
|
2
|
+
var f=function(window){var RV="clpp-freewheel",SV="clpp.freewheel.AdsManagerFactory",TV="freewheel",UV=function(){this.f=this.a=null},VV=function(){},WV=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""}},XV=function(a,b,c){this.h=a;this.f=b;this.a=c},YV=function(a){this.a=a},ZV=function(a){this.g=new _.J("clpp.freewheel.AdsManager");this.m=a;this.h=new _.hi;this.w=new tv.freewheel.SDK.AdManager;
|
|
3
|
+
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.qk;this.j=null},$V=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.fg&&b.push("serverUrl");typeof a.profileId!==_.fg&&b.push("profileId");typeof a.videoAssetId!==_.fg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.N(1,9,12001,{missingKeys:b.join(", ")});},aW=function(){var a,b,c,d;return _.H(function(e){if(1==e.a)return a=new _.av,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)})},dW=function(a){return _.H(function(b){if(a.B.length)return bW(a),a.f=a.B.shift(),a.f.play(),b.D(0);cW(a);return _.x(b,a.m.a.play(),0)})},eW=function(a){a.A.length?(bW(a),a.f=a.A.shift(),a.f.play()):cW(a)},bW=function(a){var b=a.m.je(TV).ud();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
|
|
5
|
+
a.a.registerVideoDisplayBase(RV),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},cW=function(a){var b=a.m.je(TV).ud();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},fW=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 XV(a.a,c,d)});a.m.trigger(new _.K(b,d))},gW=function(){this.Da=new _.J(SV)};_.w(UV,_.ew);_.r=UV.prototype;
|
|
6
|
+
_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.hr(_.Pd,{id:RV}),this.f=_.hr(_.Jg,{"class":_.md}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.N(1,9,12E3))};_.r.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.r.id=function(){return TV};_.r.ud=function(){return this.a};_.r.Pl=function(){return this.f};
|
|
7
|
+
_.I("clpp.freewheel.FreeWheelPlugin",UV);UV.prototype.getAdVideo=UV.prototype.Pl;UV.prototype.getAdContainer=UV.prototype.ud;UV.Id=TV;UV.AD_CONTAINER_ID=RV;VV.prototype.create=function(){return new UV};_.bu(new VV);_.r=XV.prototype;_.r.xb=function(){return"FreeWheel AdManager SDK"};_.r.yb=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===_.fg?a:""};_.r.bc=function(){return""};_.r.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.r.getAdSystem=function(){return""};_.r.getAdvertiserName=function(){return""};
|
|
8
8
|
_.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.zb=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():""};
|
|
9
|
-
_.r.ob=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.nb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.
|
|
10
|
-
_.r.getPodIndex=function(){switch(this.
|
|
11
|
-
_.r.getWrapperAdSystems=function(){return[]};_.r.getWrapperCreativeIds=function(){return[]};_.r.ec=function(){return null};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.H(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{
|
|
17
|
-
_.
|
|
18
|
-
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.
|
|
19
|
-
_.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.
|
|
20
|
-
_.r.
|
|
21
|
-
void 0));this.l.resolve()};_.r.
|
|
22
|
-
_.r.
|
|
23
|
-
_.kc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:
|
|
24
|
-
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.
|
|
25
|
-
_.r.
|
|
26
|
-
|
|
9
|
+
_.r.ob=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.nb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.Wa=function(){return 0};_.r.Xa=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
|
|
10
|
+
_.r.getPodIndex=function(){switch(this.Xa()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.r.Ob=function(){switch(this.Xa()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.r.Bb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.r.pb=function(){return this.f.getAdCount()};_.r.getWrapperAdIds=function(){return[]};_.r.canSeek=function(){return!1};
|
|
11
|
+
_.r.getWrapperAdSystems=function(){return[]};_.r.getWrapperCreativeIds=function(){return[]};_.r.ec=function(){return null};XV.prototype.getVideoElement=XV.prototype.ec;XV.prototype.getWrapperCreativeIds=XV.prototype.getWrapperCreativeIds;XV.prototype.getWrapperAdSystems=XV.prototype.getWrapperAdSystems;XV.prototype.canSeek=XV.prototype.canSeek;XV.prototype.getWrapperAdIds=XV.prototype.getWrapperAdIds;XV.prototype.getSequenceLength=XV.prototype.pb;XV.prototype.getPositionInSequence=XV.prototype.Bb;
|
|
12
|
+
XV.prototype.getPodTimeOffset=XV.prototype.Ob;XV.prototype.getPodIndex=XV.prototype.getPodIndex;XV.prototype.getPodType=XV.prototype.Xa;XV.prototype.getMediaBitrate=XV.prototype.Wa;XV.prototype.getMediaHeight=XV.prototype.nb;XV.prototype.getMediaWidth=XV.prototype.ob;XV.prototype.getMediaUrl=XV.prototype.getMediaUrl;XV.prototype.getClickThroughUrl=XV.prototype.zb;XV.prototype.isBumper=XV.prototype.fc;XV.prototype.getSkipTimeOffset=XV.prototype.getSkipTimeOffset;XV.prototype.getPosition=XV.prototype.getPosition;
|
|
13
|
+
XV.prototype.getDuration=XV.prototype.getDuration;XV.prototype.getTitle=XV.prototype.getTitle;XV.prototype.getAdvertiserName=XV.prototype.getAdvertiserName;XV.prototype.getAdSystem=XV.prototype.getAdSystem;XV.prototype.getApiFramework=XV.prototype.getApiFramework;XV.prototype.getSourceId=XV.prototype.bc;XV.prototype.getCreativeId=XV.prototype.getCreativeId;XV.prototype.getId=XV.prototype.getId;XV.prototype.getTechnology=XV.prototype.Cb;XV.prototype.getAdManagerVersion=XV.prototype.yb;
|
|
14
|
+
XV.prototype.getAdManagerName=XV.prototype.xb;YV.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()}})};YV.prototype.Rb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};YV.prototype.Qb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
15
|
+
YV.prototype.hasPostroll=YV.prototype.Qb;YV.prototype.hasPreroll=YV.prototype.Rb;YV.prototype.getCuePoints=YV.prototype.getCuePoints;_.r=ZV.prototype;
|
|
16
|
+
_.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.H(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{$V(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!==_.fg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.x(m,aW(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
|
|
17
|
+
_.v(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,WV(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Se&&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=
|
|
18
|
+
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.zn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.En.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.Dn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Tm.bind(a));a.h.on(a.m,_.sg,a.Ck.bind(a));a.h.on(a.m,_.cg,a.Bk.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.r.start=function(){var a=this;return _.H(function(b){return _.x(b,dW(a),0)})};_.r.md=function(){};
|
|
19
|
+
_.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.hd=function(){return!0};_.r.Dc=function(){var a=this;return _.H(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);cW(a);a.a&&(a.a.dispose(),a.a=null);_.z(b)})};
|
|
20
|
+
_.r.zn=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 _.K(_.Cc,{adsTimeline:new YV(this.a)})),this.j=new _.Zu(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.je(TV).f);else this.m.onError(new _.N(1,9,10003,{errorType:0},
|
|
21
|
+
void 0));this.l.resolve()};_.r.En=function(a){fW(this,_.hc,a);this.j.start()};_.r.Dn=function(a){this.f=null;a=a.slot;fW(this,_.ic);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:dW(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:cW(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:eW(this)}};
|
|
22
|
+
_.r.Tm=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:fW(this,_.xc,a);fW(this,_.qc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:fW(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:fW(this,_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:fW(this,_.sc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:fW(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:fW(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:fW(this,
|
|
23
|
+
_.kc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:fW(this,_.tc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:fW(this,_.vc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:fW(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:fW(this,_.jc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:fW(this,_.uc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.N(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.Ck=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();bW(this);this.f.play()}}};
|
|
25
|
+
_.r.Bk=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Kq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Jq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Dq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);eW(this);break;case _.wq:case _.Hq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};ZV.prototype.getPosition=ZV.prototype.getPosition;ZV.prototype.setVolume=ZV.prototype.setVolume;
|
|
26
|
+
ZV.prototype.getVolume=ZV.prototype.getVolume;ZV.prototype.skip=ZV.prototype.skip;ZV.prototype.pause=ZV.prototype.pause;ZV.prototype.resume=ZV.prototype.resume;gW.prototype.name=function(){return SV};gW.prototype.a=function(a,b){return a.namespace()!==_.sd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Da.warn("FreeWheel SDK is not loaded."),!1):!1};gW.prototype.create=function(a){return new ZV(a)};_.cr(new gW);};
|
|
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,81 +1,81 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
b,c,d){if(1===b){if(!d||0===d.length)throw new _.N(_.O,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.N(_.O,4,4043,"Media playlist must have at least one full segment!");}this.a=a;this.verbatimUri="";this.type=b;this.fa=c;this.U=1===b?d:null},
|
|
4
|
-
function(c,d){var e=b.get(d);if(null==e)throw new _.N(_.O,4,4044,"Undefined variable '"+d+"'");return e})},
|
|
5
|
-
g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},
|
|
6
|
-
1,d,b)},
|
|
7
|
-
b,c){var d=[],e=[];e.push(new _.
|
|
8
|
-
b);c&&
|
|
9
|
-
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}
|
|
10
|
-
if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===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
|
-
192),f=_.
|
|
12
|
-
h=_.
|
|
13
|
-
h;else{var l=_.
|
|
14
|
-
try{a=_.
|
|
15
|
-
"AAC segment does not contain an ID3 tag.");return
|
|
16
|
-
h,l,m;return _.H(function(n){switch(n.a){case 1:return d=b.f(),e=_.
|
|
17
|
-
5);return _.x(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.
|
|
18
|
-
function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},
|
|
19
|
-
b){var c=new Set(a.map(function(d){return d.
|
|
20
|
-
_.
|
|
21
|
-
c.startTime+c.duration}},
|
|
22
|
-
d.rc;e.
|
|
23
|
-
this.
|
|
24
|
-
4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+e.id));var g={configurationId:a.
|
|
25
|
-
4,4021,"Unknown file extension "+e);g="";f===c.VIDEO?g="avc1.42E01E":f===c.AUDIO&&(g="mp4a.40.2");d=
|
|
26
|
-
{presentationTimeline:
|
|
27
|
-
|
|
28
|
-
n=
|
|
29
|
-
type:
|
|
30
|
-
_.Y,d=c.
|
|
31
|
-
A=_.
|
|
32
|
-
if(null===c)throw new _.N(_.O,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");return b.fa.filter(function(d){return d.name===
|
|
33
|
-
1E3},
|
|
34
|
-
g);if(l){var m=_.
|
|
35
|
-
g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.
|
|
36
|
-
e.a)return _.x(e,
|
|
37
|
-
_.x(p,
|
|
38
|
-
|
|
39
|
-
c.height);
|
|
40
|
-
[],g=(c||b).length(),h=0;h<g;h++){var l=b?b.streams[h]||null:null,m=c?c.streams[h]||null:null,n=_.Y.
|
|
41
|
-
M.a){l=_.
|
|
42
|
-
e=c.playlist;f=e.verbatimUri;return g["return"](
|
|
43
|
-
_.Y.
|
|
44
|
-
|
|
45
|
-
e=_.
|
|
46
|
-
null;return{id:null===n?_.
|
|
47
|
-
frameRate:
|
|
48
|
-
null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},
|
|
49
|
-
if(a.a.lowLatencyMode&&a.K&&a.K.
|
|
50
|
-
return n["return"]({stream:b,playlist:m})})},
|
|
51
|
-
},
|
|
52
|
-
m.value;m=n.
|
|
53
|
-
|
|
54
|
-
q.length)){
|
|
55
|
-
a.j.get(c))n=m.streams[0].U[0].position,
|
|
56
|
-
b,c,d,e,f,g,h){var l,m,n,p,q,t,
|
|
57
|
-
a.o,Ca))&&(R=!0),Na=
|
|
58
|
-
m.a)return a.L.has(b)?m["return"](a.L.get(b)):_.x(m,
|
|
59
|
-
d.a;g=(f=_.Y.
|
|
60
|
-
a.A?(c=Math.max(c,b.K),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.A===_.Wb&&(b.f=c)},
|
|
61
|
-
d.type),d.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",d.type)},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var
|
|
65
|
-
4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}return 0},
|
|
66
|
-
Error(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
d.join(", ")+" are incompatible."),new _.N(_.O,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");c=c.map(function(e){var f=_.P(e,"KEYFORMAT","identity"),g=
|
|
70
|
-
|
|
71
|
-
_.r.requestStop=function(){this.N=!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.
|
|
72
|
-
_.r.update=function(){var a=this,b,c,d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:b=a.f;if(
|
|
73
|
-
g);m=
|
|
74
|
-
_.r.loadVariant=function(a,b){var c=this,d,e,f,g,h,l,m,n,p,q,t,
|
|
75
|
-
n,
|
|
76
|
-
_.r.loadTextStream=function(a,b){var c=this,d,e,f,g,h,l;return _.H(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.D(2);g=c.f.alternativeTextStreams.find(function(n){return n.id===a})||null;if(!g)throw new _
|
|
77
|
-
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 _
|
|
78
|
-
_.r.
|
|
2
|
+
var f=function(window){var rL="Could not parse MP4 segment start time.",sL="EXT-X-DATERANGE",tL="EXT-X-DISCONTINUITY",uL="EXT-X-KEY",vL="EXT-X-MAP",wL="EXT-X-MEDIA-SEQUENCE",xL="Failed to infer discontinuity number",yL="Guessing audio-only",zL="METHOD",AL="SAMPLE-AES-CTR",BL="Setting playlist start time to ",CL="application/vnd.apple.mpegurl",DL="manifestloaded",EL="sample",FL=function(a){if(1>a.a)throw _.kn();--a.a},GL=function(a){a=_.uj(a)||"";return null!=_.vj.video[a]?_.Jg:null!=_.vj.audio[a]?_.Pc:null},HL=function(a,
|
|
3
|
+
b,c,d){if(1===b){if(!d||0===d.length)throw new _.N(_.O,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.N(_.O,4,4043,"Media playlist must have at least one full segment!");}this.a=a;this.verbatimUri="";this.type=b;this.fa=c;this.U=1===b?d:null},IL=function(a,b,c){c=void 0===c?[]:c;this.fa=b;this.a=a;this.f=c;this.qa=-1},JL=function(a){return a.some(function(b){return b.startsWith("#EXT-X-TARGETDURATION")})?1:0},KL=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,
|
|
4
|
+
function(c,d){var e=b.get(d);if(null==e)throw new _.N(_.O,4,4044,"Undefined variable '"+d+"'");return e})},LL=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=KL(d.value,b)})})},ML=function(a,b){var c=new Map,d=new URL(b);a.forEach(function(e){var f=_.P(e,_.hb),g=_.P(e,"QUERYPARAM");if(f)g=_.yj(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.N(_.O,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.N(_.O,4,4044,"Query param '"+
|
|
5
|
+
g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},NL=function(){this.h=0;this.a=new Map},QL=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&!_.Y.tm(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.N(_.O,4,4015);b=b.slice(1);return 0===JL(b)?OL(a,b,c):PL(a,b,c)},PL=function(a,b,c){var d=RL(b);b=d.oo;var e=d.jm,f=SL(a,d.Qo,c);d=e.map(function(g){return TL(a,g,f)});b=UL(a,c,b,f);return new HL(c,
|
|
6
|
+
1,d,b)},RL=function(a){var b=[],c=[],d=[];a=_.v(a);for(var e=a.next();!e.done;e=a.next())e=e.value,VL.test(e)?d.push(e):WL.test(e)?c.push(e):b.push(e);return{oo:b,jm:c,Qo:d}},OL=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=TL(a,b[e]);d.push(f);if(f.name===_.Ma){var g=b[e+1];if(!g)throw new _.N(_.O,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.zj(_.Ob,g));e++}}b=_.Y.pc(d,"EXT-X-DEFINE");_.Y.tj(b);b=ML(b,c);a.a=b;LL(d,a.a);return new HL(c,0,d)},XL=function(a,
|
|
7
|
+
b,c){var d=[],e=[];e.push(new _.zj(_.pa,"0"));e.push(new _.zj(_.Ob,b));c.length&&e.push(new _.zj(_.ua,c));d.push(new _.xj(a.h++,_.Ma,e));return new HL(b,0,d)},UL=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(h){_.Y.zm(h)?(h=TL(a,h,d),"EXT-X-PART"===h.name||"EXT-X-PRELOAD-HINT"===h.name&&"PART"===_.P(h,_.Mb)?g.push(h):f.push(h)):(_.Y.yd(f,"EXT-X-GAP")||(h=KL(h,d),h=_.bk(h,b),e.push(new IL(h,f,g))),f=[],g=[])});0<g.length&&e.push(new IL(null,f,g));return e},TL=function(a,b,c){a=_.ck(a.h++,
|
|
8
|
+
b);c&&LL([a],c);return a},SL=function(a,b,c){b=b.map(function(e){return TL(a,e)});_.Y.tj(b);var d=ML(b,c);b.map(function(e){return _.P(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.N(_.O,4,4044,"Cannot import variable '"+e+"' as it is not defined in the master playlist");d.set(e,f)});return d},YL=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},ZL=function(a,b){b=void 0===b?0:b;return b+10<=a.length&&73===
|
|
9
|
+
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},$L=function(){this.a=new Map;this.f=new Map},aM=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 _.N(_.O,4,4030);}ZL(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]);
|
|
10
|
+
if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===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}}ZL(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},bM=function(a){for(;a.getPosition()<a.Va()-1;){var b=a.getPosition();if(71===_.ln(a))return FL(a),b}return-1},cM=function(a){function b(){d.seek(e+188);f=_.ln(d);71!==f&&(d.seek(e+
|
|
11
|
+
192),f=_.ln(d));71!==f&&(d.seek(e+204),f=_.ln(d));71!==f&&c();FL(d)}function c(){throw new _.N(_.O,4,4030);}var d=new _.hn(new DataView(a),!1),e=0,f=0;e=bM(d);0>e&&(_.Ow.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.ln(d),71!==f&&c(),a=_.mn(d),8191===(a&8191))b();else if(a&16384)if(a=(_.ln(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.ln(d),d.skip(a)),1!==_.nn(d)>>8)b();else{d.skip(3);a=_.ln(d)>>6;0!==a&&1!==a||c();0===_.ln(d)&&c();a=_.ln(d);var g=_.mn(d),
|
|
12
|
+
h=_.mn(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},dM=function(a,b){var c=null,d=0;try{(new _.sn).M(_.Ne,_.tn).M(_.ug,_.tn).M(_.Ie,_.tn).aa("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.nn(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.Ow.error("Unable to find timescale in init segment!"),new _.N(_.O,4,4030,rL,c);var e=0,f=!1;try{(new _.sn).M("moof",_.tn).M("traf",_.tn).aa("tfdt",function(g){var h=d;if(0===g.version)h=_.nn(g.reader)/
|
|
13
|
+
h;else{var l=_.nn(g.reader),m=_.nn(g.reader);if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");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 _.N(_.O,4,4030,rL,c);return e},gM=function(a){var b=_.yj(a,zL);if(!eM.includes(b))return fM.error("PlayReady in HLS is only supported with [",eM.join(", "),"], not",b),null;a=_.yj(a,_.Ob);b=_.Bv(a);a=null;b=_.Oj(b.data);
|
|
14
|
+
try{a=_.AD(_.ap(b))}catch(c){a=b}return _.OD(_.Ed,[{initDataType:_.hd,initData:a}],"")},hM=function(a){this.g=new _.J("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.ek()}},jM=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,t;return _.H(function(u){switch(u.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Sc||d===_.Rc)return u["return"](0);g=f;if(d!==_.Qc){u.D(2);break}return _.x(u,iM(a,c,g),3);case 3:h=u.f;l=_.Oj(h.data);if(!ZL(l))throw new _.N(_.O,4,4030,
|
|
15
|
+
"AAC segment does not contain an ID3 tag.");return u["return"](aM(l));case 2:if(d!==_.Mg&&d!==_.Tc){u.D(4);break}m=[iM(a,c,g)];b&&m.push(iM(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"](dM(p.data,q.data));case 4:if(d!==_.Kg){u.D(6);break}return _.x(u,iM(a,c,g),7);case 7:return t=u.f,u["return"](cM(t.data));case 6:if(!_.Bu((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return u["return"](0);throw new _.N(_.O,4,4030);}})},iM=function(a,b,c){var d,e,f,g,
|
|
16
|
+
h,l,m;return _.H(function(n){switch(n.a){case 1:return d=b.f(),e=_.uE(b.La(),b.la,b.la+2048-1,a.a.attemptParameters),e.type=2,f=_.uE(b.La(),b.la,b.ga,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.D(n,2),g=c?f:e,_.x(n,a.f(g),4);case 4:return h=n.f,n["return"](h);case 2:l=_.F(n);if(7001===l.code||c)throw l;a.g.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS pre-flights.",e.uris[0]);_.D(n,
|
|
17
|
+
5);return _.x(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.F(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.N(_.O,4,4030,"Failed to fetch the media segment.");}})},kM=function(a){this.streams=a},lM=function(a,b){a.streams.forEach(function(c){c.Vf=b})},mM=function(a,b){a.streams.forEach(function(c){c.width=b})},nM=function(a,b){a.streams.forEach(function(c){c.height=b})},oM=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},pM=
|
|
18
|
+
function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},qM=function(a,b){var c=a.streams.find(function(d){d=d.U;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.U.find(function(d){return d.position===b})||null},rM=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},sM=function(a){this.a=a},tM=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},uM=function(a,
|
|
19
|
+
b){var c=new Set(a.map(function(d){return d.qa}));return b.filter(function(d){return!c.has(d.qa)})},wM=function(a,b){for(;a[0].qa<b[0].qa;)a.splice(0,1);var c=a[0],d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||vM(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&vM(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},BM=function(a,b,c,d,e){var f=b[0].length();f=YL(f).map(function(g){var h=tM(b,g)||[],l=rM(c,g)||[];g=rM(d,g)||[];var m=_.hh(xM(h)).concat(_.hh(l),
|
|
20
|
+
_.hh(g)).filter(Boolean);yM(m);var n=m[0];m=n.qa;n=n.duration;return{configurationId:a,variants:h,textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,qa:m}});e&&zM(f[0]);AM(f);return f},xM=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},zM=function(a){var b=xM(a.variants)[0].U[0].Ha;a.startTime+=b;a.endTime+=b},AM=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=
|
|
21
|
+
c.startTime+c.duration}},vM=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;CM(a.variants,b.variants);DM(_.Y.If(a),_.Y.If(b))},CM=function(a,b){var c=new Map(a.map(function(d){return[_.Y.Nh(d),d]}));b.forEach(function(d){c.get(_.Y.Nh(d)).drmInfos=d.drmInfos})},DM=function(a,b){var c=new Map(a.map(function(d){return[d.zc,d]}));b.forEach(function(d){var e=c.get(d.zc);e.U=d.U;d.U.forEach(function(f){f.initSegment=e.initSegmentReference});e.segmentIndex.replace(d.U);e.rc=
|
|
22
|
+
d.rc;e.mf=d.mf;e.duration=d.duration;e.Sh=d.Sh;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},yM=function(a){var b=EM(a);a.forEach(function(c){_.pE(c.segmentIndex,b);c.duration=b;c.mf=c.rc+b})},EM=function(a){var b=Infinity;_.Y.El(a).forEach(function(c){b=Math.min(b,c.duration)});return b},FM=function(){var a=this;this.a=this.C=null;this.h=1;this.j=new $L;this.o="";this.S=new NL;this.H=0;this.w=null;this.l=new _.Yh(function(){a.hc()});this.A=_.Wb;this.f=null;this.G=new _.tk;this.K=
|
|
23
|
+
this.F=null;this.g=new _.J("clpp.hls.HlsParser");this.L=new Map;this.Y=new hM(this.eg.bind(this));this.P=!1;this.I=null;this.N=!1;this.B=new Map;this.J=new Set},GM=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.zc})},HM=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.Hf!==e.Hf)a.C.onError(new _.N(1,
|
|
24
|
+
4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+e.id));var g={configurationId:a.C.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,Hf:e.Hf,endTime:e.endTime,id:e.id,type:_.Ci,eventElement:null};f&&!_.L.Bi(f,g)||a.B.set(e.id,g)}return Array.from(a.B.values())},QM=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,A,B,E,C,G;return _.H(function(M){switch(M.a){case 1:c=_.Uq;d=IM(a,b,a.o,"");if(1===d.type){e=d.U[0].a;f=GL(e);if(!f)throw new _.N(_.O,
|
|
25
|
+
4,4021,"Unknown file extension "+e);g="";f===c.VIDEO?g="avc1.42E01E":f===c.AUDIO&&(g="mp4a.40.2");d=XL(a.S,a.o,a.a.hlsDefaultCodecs||g)}h=_.Y.Sn(d.fa);l=JM(h.Pc.qh);l.forEach(function(R){a.J.add(R.groupId)});return _.x(M,KM(a,h),4);case 4:m=M.f;M.D(3);break;case 5:m=M.f;case 3:n=m;p=n.Im;q=n.periods;t=n.co;u=n.Fo;y=n.alternativeVariants;A=n.alternativeTextStreams;B=n.alternativeImageStreams;if(!a.C)throw new _.N(_.O,7,7001);LM(a,q);E=MM(a,p.delay,q,t);NM(a)||(a.H=p.Ie,OM(a));PM(a,E,q);C=HM(a,u);G=
|
|
26
|
+
{presentationTimeline:E,periods:q,minBufferTime:0,cues:C,muxedAudioTracks:l};y&&(G.alternativeVariants=y);A&&(G.alternativeTextStreams=A);B&&(G.alternativeImageStreams=B);a.g.debug("HLS playlist parsed",G);return M["return"](G)}})},JM=function(a){return a.filter(function(b){return b.name===_.La&&_.P(b,_.Mb)===_.ja&&!_.P(b,_.Ob)}).map(function(b){var c=_.Y.bi(b),d=_.P(b,_.ab)||_.xg;return{groupId:_.yj(b,_.Sa),id:_.qL++,label:_.yj(b,_.hb),language:d,channelsCount:c,primary:"YES"===_.P(b,"DEFAULT")}})},
|
|
27
|
+
TM=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){if(1==p.a)return c=_.Y,_.x(p,RM(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;g=d.Pj;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.Wh(q.audio,g),u=c.Wh(q.video,g);q=SM(a,t,u,q.bandwidth);if(!q)throw new _.N(_.O,4,4047,{message:"Video and audio are encrypted in an incompatible way.",Ip:u?u.dc():void 0,audio:t?t.dc():void 0});return q});m=a.C.configurationId;
|
|
28
|
+
n=BM(m,l,e,f,!0);return p["return"](n)})},RM=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){if(1==p.a)return c=_.Uq,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,
|
|
29
|
+
type:u.type,codecs:u.codecs,name:u.originalId,uri:u.zc,Le:{width:u.width,height:u.height,frameRate:u.frameRate}});return UM(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;VM(a,h.concat(l));m=l.filter(function(q){return q.a()===c.jh});n=l.filter(function(q){return q.a()===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,Pj:h})})},VM=function(a,b){b.forEach(function(c){a.j.a.set(c.dc(),c)})},KM=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,A,B,E;return _.H(function(C){switch(C.a){case 1:return c=
|
|
30
|
+
_.Y,d=c.Kn(b.Pc.closedCaptions),e=WM(a,b.Ke),_.x(C,XM(a,b),2);case 2:return f=C.f,g=Object.values(f).flat().map(function(G){return G.playlist}),YM(a,g),h=g[0],l=c.$i(h.fa),a.A=l,a.K=c.aj(h.fa),m=c.Rn(h.fa,l,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod),_.x(C,ZM(a,f.rh,e),3);case 3:return n=C.f,_.x(C,$M(a,f.Ke,n,d),4);case 4:return p=C.f,_.x(C,aN(a,f.Bo,e),5);case 5:return q=C.f,_.x(C,bN(a,f.ng),6);case 6:return t=C.f,u=a.C.configurationId,y=BM(u,p,q,t,!NM(a)),a.C.filterAllPeriods(y),
|
|
31
|
+
A=_.hh(f.Ke).concat(_.hh(f.rh)).map(function(G){return G.playlist}),B=cN(a,A),E=dN(a,A,B),C["return"]({periods:y,co:B,Fo:E,Im:m})}})},fN=function(a,b){var c,d,e,f,g;return _.H(function(h){if(1==h.a)return c=_.bk(b.verbatimUri,a.o),_.x(h,eN(a,c),2);d=h.f;e=d.response;f=d.text;g=e.uri;return h["return"](IM(a,f,g,b.verbatimUri))})},LM=function(a,b){NM(a)||2!==a.a.timeline.version||(a.I||(a.I=b[0].startTime),_.bG(b,-a.I))},dN=function(a,b,c){b=b.find(function(d){return null!==_.Y.cb(d.fa,sL)});if(!b)return[];
|
|
32
|
+
if(null===c)throw new _.N(_.O,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");return b.fa.filter(function(d){return d.name===sL}).map(function(d){return _.Y.Ln(d,c,a.F,!NM(a))}).filter(Boolean)},cN=function(a,b){var c=b.flatMap(function(e){return e.U[0].fa});c=_.Y.cb(c,"EXT-X-PROGRAM-DATE-TIME");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/
|
|
33
|
+
1E3},XM=function(a,b){var c,d,e,f,g,h;return _.H(function(l){if(1==l.a)return _.x(l,Promise.all([gN(a,b.Pc.qh),gN(a,b.Pc.Co),gN(a,b.Ke),gN(a,b.ng)]),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"]({rh:e,Bo:f,Ke:g,ng:h})})},iN=function(a,b){return Promise.all(b.map(function(c){return hN(a,c)}))},WM=function(a,b){for(var c=_.Y.bf,d=new Map,e=_.v(b),f=e.next();!f.done;f=e.next()){var g=f.value,h=_.P(g,_.ja);f=_.P(g,_.Vb);var l=_.P(g,_.Db);g=jN(a,
|
|
34
|
+
g);if(l){var m=_.tj(_.qj,g);d.set(c(_.qj,l),m);l=g.indexOf(m);-1<l&&g.splice(l,1)}h&&(l=kN(_.Pc,g),d.set(c(_.Pc,h),l));f&&(h=kN(_.Jg,g),d.set(c(_.Jg,f),h))}return d},aN=function(a,b,c){return Promise.all(b.map(function(d){return lN(a,d,c)}))},bN=function(a,b){return Promise.all(b.map(function(c){return mN(a,c)}))},ZM=function(a,b,c){var d,e;return _.H(function(f){if(1==f.a){if(0===b.length)return f["return"](new Map);d=[lN(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 lN(a,
|
|
35
|
+
g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.Go(e))})},$M=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,u;return _.H(function(y){if(1==y.a){e=new Set;f=_.hh(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.yj(f[l].tag,_.pa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.x(y,nN(a,n,c,d,e),2)}if(3!=y.a)return p=y.f,q=f.map(function(A){return nN(a,A,c,d,e)}),_.x(y,Promise.all(q),3);t=y.f;t.splice(g,0,p);u=t.reduce(_.LD,[]);return y["return"](u)})},oN=function(a,b,c){var d;return _.H(function(e){if(1==
|
|
36
|
+
e.a)return _.x(e,UM(a,{playlist:c,codecs:b.codecs,type:b.type,Bd:b.originalLanguage,xc: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,Le:{width:b.width,height:b.height,frameRate:b.frameRate}}),2);d=e.f;b.bandwidth&&pM(d,b.bandwidth);return e["return"](d)})},nN=function(a,b,c,d,e){var f,g,h,l,m,n;return _.H(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.yj(h,_.pa)),m=f.Un(h),
|
|
37
|
+
_.x(p,pN(a,b,m,c,d),2)):(n=p.f)?p["return"](qN(a,n,l,e)):p["return"]([])})},rN=function(a,b,c,d,e,f){var g=jN(a,b);a.g.debug("Guessing stream type for",b.toString());b=!1;var h=_.tj(_.Jg,g),l=d+e;1!==g.length||c||h?!l&&1<g.length?(a.g.debug("Guessing multiplexed audio+video"),c=_.Jg,g=[g.join(",")]):d&&f?(a.g.debug(yL),c=_.Pc,b=!0):e?(a.g.debug(yL),c=_.Pc):(a.g.debug("Guessing video-only"),c=_.Jg):(c=_.Pc,a.g.debug(yL));return{type:c,Oj:g,pm:b}},pN=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,u,y,A,
|
|
38
|
+
B,E,C,G,M;return _.H(function(R){if(1==R.a)return f=_.Uq,g=_.Y.bf,h=b,l=h.tag,m=h.playlist,n=_.P(l,_.ja),p=_.P(l,_.Vb),q=n?d.get(g(f.AUDIO,n))||[]:[],t=p?d.get(g(f.VIDEO,p))||[]:[],u={audio:q,video:t},y=m.verbatimUri,A=u.audio.find(function(ka){return ka.dc()===y}),B=rN(a,l,c,u.audio.length,u.video.length,A),E=B.type,C=B.Oj,G=B.pm,M=null,G?R.D(2):_.x(R,sN(a,b,C,E,e,c),3);2!=R.a&&(M=R.f);if(null==M)return R["return"](null);u[E]=[M];E===f.AUDIO&&c&&u.video.forEach(function(ka){mM(ka,c.width);nM(ka,
|
|
39
|
+
c.height);oM(ka,c.frameRate)});return R["return"](u)})},qN=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.vl(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=SM(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},SM=function(a,b,c,d,e){for(var f=
|
|
40
|
+
[],g=(c||b).length(),h=0;h<g;h++){var l=b?b.streams[h]||null:null,m=c?c.streams[h]||null:null,n=_.Y.Tl(l,m);if(!n)return null;var p=d;l={id:e?e:a.h++,language:l?l.language:_.xg,primary:!!l&&l.primary||!!m&&m.primary,audio:l,video:m,bandwidth:p,drmInfos:n,allowedByApplication:!0,allowedByKeySystem:!0};f.push(l)}return new sM(f)},lN=function(a,b,c){var d,e,f,g;return _.H(function(h){d=b;e=d.tag;f=d.playlist;g=f.verbatimUri;return h["return"](tN(a,g,function(){var l,m,n,p,q,t,u,y,A,B,E,C,G;return _.H(function(M){if(1==
|
|
41
|
+
M.a){l=_.Uq;m=_.Y.bf;n=_.yj(e,_.Sa);p=_.Y.Mh(_.yj(e,_.Mb));q=_.Y.rl(e);t=c.get(m(p,n))||"";u=_.P(e,_.ab);y=_.P(e,_.hb);A=_.P(e,"DEFAULT");B=p===l.AUDIO?_.Y.bi(e):null;var R=p===l.AUDIO?(R=_.P(e,"CHANNELS"))?R.includes("/JOC"):!1:!1;E=R;C="YES"===A;return _.x(M,UM(a,{playlist:f,codecs:t,type:p,Bd:u,primary:C,name:y,channelsCount:B,spatialAudio:E,groupId:n,kind:q,xc:null,closedCaptions:null,Le:null}),2)}G=M.f;return M["return"](G)})}))})},mN=function(a,b){var c,d,e,f;return _.H(function(g){c=b;d=c.tag;
|
|
42
|
+
e=c.playlist;f=e.verbatimUri;return g["return"](tN(a,f,function(){var h,l,m,n,p;return _.H(function(q){if(1==q.a)return h=_.P(d,_.ua)||"jpg",l=_.P(d,_.ab),m=_.P(d,_.hb),_.x(q,UM(a,{playlist:e,codecs:h,type:_.te,Bd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,xc:null,groupId:null,Le:null}),2);n=q.f;(p=_.P(d,_.pa))&&pM(n,Number(p));return q["return"](n)})}))})},jN=function(a,b){var c=_.P(b,_.ua,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);c=
|
|
43
|
+
_.Y.zl(c);var d=new Set,e=[];c=_.v(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.XD(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},sN=function(a,b,c,d,e,f){var g,h,l,m,n;return _.H(function(p){g=b;h=g.tag;l=g.playlist;m=_.Uq;n=l.verbatimUri;return p["return"](tN(a,n,function(){var q,t,u,y,A;return _.H(function(B){if(1==B.a){q=_.P(h,_.ta);t=null;d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q));var E=_.P(h,_.ja)||void 0;u=E&&a.J.has(E)?E:void 0;E=kN(d,c);if(u){var C=
|
|
44
|
+
kN(_.Pc,c);E+=","+C}y=E;return _.x(B,UM(a,{playlist:l,codecs:y,type:d,closedCaptions:t,primary:!1,kind:null,Bd:null,name:null,channelsCount:null,spatialAudio:!1,xc:null,groupId:null,muxedAudioId:u,Le:f}),2)}A=B.f;return B["return"](A)})}))})},tN=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},UM=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,A,B,E,C,G,M,R,ka,U,ra;return _.H(function(Ba){if(1==Ba.a){c=uN;d=vN;
|
|
45
|
+
e=_.Uq;f=b;g=f.playlist;h=f.codecs;l=f.type;m=f.Bd;n=f.xc;p=f.groupId;q=f.muxedAudioId;t=f.primary;u=f.kind;y=f.name;A=f.channelsCount;B=f.spatialAudio;E=f.closedCaptions;C=f.Le;G=_.Y.fi(m);if(1!==g.type)throw new _.N(_.O,4,4017);return _.x(Ba,wN(a,g,l,h),2)}M=Ba.f;R=a.a.lowLatencyMode?d.Aj:d.Cj;ka=u;l!==e.TEXT||u||(ka=_.ig);U=_.Y.$i(g.fa);ra=M.map(function(Ca){var Da=Ca.U,Na=Ca.Bl,zb=Ca.mimeType,pe=Ca.qa,Df=Da[0].startTime,Ig=Da[Da.length-1].endTime,Ru=Ig-Df,pd=new _.TE(Da),Nn=Da[0].initSegment||
|
|
46
|
+
null;return{id:null===n?_.qL++:n,originalId:y,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:pd.nd.bind(pd),getSegmentReference:pd.get.bind(pd),adjustSegmentDurations:pd.Pd.bind(pd),getDuration:pd.getDuration.bind(pd),segmentIndex:pd,segmentLookupStrategy:R,initSegmentReference:Nn,mimeType:zb,codecs:h,kind:ka,Sh:Na.type,encrypted:Na.type===c.Fj,aesEncrypted:Ca.aesEncrypted,keyId:Na.keyId,language:G,originalLanguage:m||_.xg,label:y,type:l,primary:t,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
47
|
+
frameRate:C?C.frameRate:void 0,width:C?C.width:void 0,height:C?C.height:void 0,bandwidth:void 0,roles:[],channelsCount:A,spatialAudio:B,closedCaptions:E,U:Da,drmInfos:Na.drmInfos,qa:pe,zc:g.verbatimUri,Vf:g.a,rc:Df,mf:Ig,duration:Ru,groupId:p,zp:U,muxedAudioId:q}});return Ba["return"](new kM(ra))})},gN=function(a,b){var c;return _.H(function(d){if(1==d.a)return _.x(d,Promise.all(b.map(function(e){var f;return _.H(function(g){if(1==g.a)return _.x(g,xN(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:
|
|
48
|
+
null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},xN=function(a,b){var c,d,e,f,g,h,l,m,n;return _.H(function(p){if(1==p.a){c=_.Y.Cm(b);d=_.P(b,_.Ob,void 0,{required:c});if(!d)return p["return"](null);e=_.bk(d,a.o);f=Date.now();return _.x(p,eN(a,e),2)}g=p.f;h=g.response;l=g.text;m=Date.now();a.C.onEvent(new _.K(DL,{detail:{duration:m-f,type:"media"}}));n=h.uri;return p["return"](IM(a,l,n,d))})},hN=function(a,b){var c,d,e,f,g,h,l,m;return _.H(function(n){if(1==n.a){var p=new _.ej(b.streams[0].Vf);
|
|
49
|
+
if(a.a.lowLatencyMode&&a.K&&a.K.vh){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={Lm:q.position,Vn:t&&0<t.length?u:null}}else q=null;if(t=q)q=t.Lm,t=t.Vn,u=_.ak(p.a.toString()),u._HLS_msn=q.toString(),null===t&&u._HLS_part&&delete u._HLS_part,null!==t&&(u._HLS_part=t.toString()),q=_.Zj(u,!0),_.hj(p,new _.lj(q))}c=p.toString();return _.x(n,eN(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.dc();h=b.streams[0].Vf;l=e.uri;h!==l&&(h=l,lM(b,h));m=IM(a,f,h,g);
|
|
50
|
+
return n["return"]({stream:b,playlist:m})})},IM=function(a,b,c,d){a=QL(a.S,b,c);a.verbatimUri=d;return a},yN=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.N(_.O,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},zN=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.P(c,_.Ob)})||null}).map(function(b){return _.uj(b)});if(1<(new Set(a)).size)throw new _.N(_.O,4,4044,"Unexpected change in file format.");
|
|
51
|
+
},MM=function(a,b,c,d){var e=!0,f=null,g=0;NM(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.xE(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.AE(a,e);AN(a,c);d&&_.zE(a,d);return a},BN=function(a,b,c){a=_.Y.pc(a.fa,vL);if(1<a.length)throw new _.N(_.O,4,4020);a=a[0];if(!a)return null;var d=_.yj(a,_.Ob),e=_.bk(d,b);b=_.Y.Yi(a,null,!0);return new _.PD(function(){return[e]},b.la,b.ga,c)},DN=function(a,b,c,d,e,f,g){var h=[],l={};b=_.v(CN(b.f));for(var m=b.next();!m.done;l={Mf:l.Mf},m=b.next()){var n=
|
|
52
|
+
m.value;m=n.oi;n=n.item;var p=0===m,q=p?a:h[h.length-1],t=p?d:q.endTime,u=Number(_.P(n,_.Ja));u=t+u;p=_.Y.Yi(n,p?null:q.ga,p);q=_.P(n,_.Ob);q=_.bk(q,g);l.Mf=q?[q]:[];t=new _.Bj(c,t,u,function(y){return function(){return y.Mf}}(l),p.la,p.ga,e,f,!1,null,null,null,null);if("YES"===_.P(n,"INDEPENDENT")||0===m)t.h=!0;h.push(t)}return h},EN=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.fa,q=c.a;0<_.Y.pc(p,vL).length&&(n=BN(c,l,g));var t=null!=q,u=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={la:0,ga:null};
|
|
53
|
+
var y=null;t?(c=_.Y.On(p).duration,a=e+c,q=_.Y.Zi(p,b?b.ga:null)):(b=DN(b,c,d,e,f,g,l),a=b[b.length-1].endTime,y=b);h=h===_.te?_.Y.Tn(p):null;d=new _.Bj(d,e,a,function(){return u},q.la,q.ga,f,g,!1,null,h?h.me:null,h?h.Je:null,h?h.durationPerTile:null,y,n);d.qa=m;return d},wN=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,u,y,A;return _.H(function(B){switch(B.a){case 1:return e=_.Y,f=FN,g=b.verbatimUri,h=b.U,l=e.Yl(b.fa,wL),m=[],_.x(B,GN(a,b.a,g,h,l,c,d),2);case 2:n=B.f,p=l,q=f.zo(h),t=0;case 3:if(!(t<
|
|
54
|
+
q.length)){B.D(5);break}u=q[t];y=m[m.length-1]||null;return _.x(B,HN(a,b.a,u,p,n,c,d,y),6);case 6:A=B.f;m.push(A);p+=u.length;t++;B.D(3);break;case 5:return yN(m),B["return"](m)}})},GN=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,u,y,A,B;return _.H(function(E){if(1==E.a){h=d[0];if(null!=a.F)return E["return"](a.F);if(!NM(a)&&a.f)try{var C=a.j.get(c),G=C?qM(C,e)||null:null;if(!G)throw new _.N(_.O,4,4030,"Segment not found in pervious playlist update.");l=G.startTime+G.Ha;a.g.debug(BL+l+".");a.F=l;return E["return"](l)}catch(M){if(m=
|
|
55
|
+
a.j.get(c))n=m.streams[0].U[0].position,E=m.streams[m.streams.length-1].U,p=E[E.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 _.N(_.O,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.x(E,IN(a,f,g,h),2)}if(3!=E.a)return u=E.f,y=JN.Vi(h.fa,a.o,e),A=BN(h,b,y),_.x(E,KN(a,A,h,y,u,g),3);B=E.f;a.g.debug(BL+B+".");a.F=B;return E["return"](B)})},HN=function(a,
|
|
56
|
+
b,c,d,e,f,g,h){var l,m,n,p,q,t,u,y,A,B,E,C,G,M,R,ka,U,ra,Ba,Ca,Da,Na;return _.H(function(zb){switch(zb.a){case 1:return l=JN,m=c[0],n=null==h,zN(c),_.x(zb,IN(a,f,g,m),2);case 2:p=zb.f;q=l.Nn(c,p,h?h.Gm:null);t=q[q.length-1];u=JN.ua(q);y=h?h.Hm:null;A=LN(y,m.fa,a.o,d);B=BN(m,b,A)||(h?h.rm:null);E=m.qa;if(n){C=e;zb.D(3);break}return _.x(zb,MN(a,E,B,m,d,A,p,g),4);case 4:C=zb.f;case 3:G=C;M=[];R=!1;for(ka=0;ka<c.length;ka++)if(U=c[ka],ra=M[M.length-1]||null,Ba=0===ka?0:ra.endTime,Ca=d+ka,(y=Da=LN(y,U.fa,
|
|
57
|
+
a.o,Ca))&&(R=!0),Na=EN(a,ra,U,Ca,Ba,G,Da,f,b,E,B))B=Na.initSegment,M.push(Na);return zb["return"]({U:M,Bl:u,Gm:t,aesEncrypted:R,mimeType:p,endTime:M[M.length-1].endTime,qa:E,rm:B,Hm:y})}})},LN=function(a,b,c,d){return b.some(function(e){return e.name===uL&&"NONE"===_.P(e,zL)})?null:(b=JN.Vi(b,c,d))?b:a&&a.generatedIv?Object.assign({},a,{iv:JN.ai(d)}):a},YM=function(a,b){b.forEach(function(c){var d=a.j.get(c.verbatimUri);FN.Tj(c,d,!NM(a))});FN.wl(b)},MN=function(a,b,c,d,e,f,g,h){var l;return _.H(function(m){if(1==
|
|
58
|
+
m.a)return a.L.has(b)?m["return"](a.L.get(b)):_.x(m,KN(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)})},KN=function(a,b,c,d,e,f){var g;return _.H(function(h){if(null==c.a)return h["return"](0);g=_.Y.tl(c,d);return h["return"](jM(a.Y,b,g,e,f,null!=d))})},kN=function(a,b){if(1===b.length)return b[0];var c=_.tj(a,b);if(null!=c)return c;throw new _.N(_.O,4,4025,{codecList:b});},IN=function(a,b,c,d){var e,f,g;return _.H(function(h){e=
|
|
59
|
+
d.a;g=(f=_.Y.cb(d.fa,vL))?_.yj(f,_.Ob):null;return h["return"](NN(a,b,c,e,g))})},NN=function(a,b,c,d,e){var f,g,h,l,m;return _.H(function(n){if(1==n.a){f=[d,e].filter(Boolean);if(g=_.wj(f,b,c))return n["return"](g);h=_.ik([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.x(n,a.eg(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.N(_.O,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.toLowerCase().split(";")[0])})},PM=function(a,b,c){c=_.Y.$l(c);"LIVE"===a.A||"EVENT"===
|
|
60
|
+
a.A?(c=Math.max(c,b.K),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.A===_.Wb&&(b.f=c)},OM=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].rc);for(c=0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c)for(a.g.debug("Offsetting live streams by",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.rc?(a.g.debug("Offset applied to",
|
|
61
|
+
d.type),d.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",d.type)},eN=function(a,b){var c,d,e;return _.H(function(f){if(1==f.a)return c=_.ik([b],a.a.attemptParameters),c.type=1,_.x(f,a.eg(c),2);d=f.f;e="";try{e=_.Q.ea(d.data)}catch(g){throw new _.N(_.O,4,4042);}e=_.Q.Ii(e);e=e.trim();return f["return"]({text:e,response:d})})},NM=function(a){return a.A===_.Wb},AN=function(a,b){_.Y.Dm(b,function(c,d){_.EE(a,c.U,d.startTime)});_.wE(a.a,b[0].startTime,b[b.length-1].endTime)},ON=function(){},
|
|
62
|
+
vN={Aj:_.lD,Cj:_.kD},uN={Fj:EL,bp:"whole-segment",NONE:_.Re},CN=function PN(a){var c,d,e,f,g,h;return _.Dh(PN,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.v(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.D(0):_.x(l,{oi:c,ao:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{oi:c,item:e,ao:d,next:h},5):l.D(5)}c++;d=e;e=h;g=f.next();return l.D(2)})},VL=/^#EXT-X-DEFINE/,WL=/^#(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)/;
|
|
63
|
+
_.r=$L.prototype;_.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()};
|
|
64
|
+
var FN={wl:function(a){var b=FN.Ml(a),c=FN.Fm(a);a.forEach(function(d){var e=d.U,f=e.findIndex(function(h){return h.qa===b}),g=e.findIndex(function(h){return h.qa===c+1});-1===g&&(g=e.length);d.U=e.slice(f,g)})},Tj:function(a,b,c){b=FN.Xl(a,b,c);a=_.v(a.U||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.yd(c.fa,tL)&&b++,c.qa=b},Xl:function(a,b,c){var d=_.Y.cb(a.fa,"EXT-X-DISCONTINUITY-SEQUENCE");if(d)return Number(d.value);d=FN.um(b);if(c&&d)try{return FN.qm(a,b)}catch(e){throw new _.N(_.O,4,
|
|
65
|
+
4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}return 0},um:function(a){return 0<FN.Zl(a)},zo: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.yd(d.fa,tL)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},Zl:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].U;return a[a.length-1].qa},qm:function(a,b){var c=_.Y.cb(a.fa,wL);if(!c)throw FN.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),
|
|
66
|
+
Error(xL);c=Number(c.value);var d=qM(b,c);if(!d)throw FN.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(xL);return d.qa},Fm:function(a){a=a.map(function(b){return b.U[b.U.length-1].qa});return Math.min.apply(Math,_.hh(a))},Ml:function(a){a=a.map(function(b){return b.U[0].qa});return Math.max.apply(Math,_.hh(a))}};FN.g=new _.J("clpp.hls.DiscontinuityUtils");var QN={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Kg)throw new _.N(_.O,4,4041);if(_.yj(a,zL)===AL)throw new _.N(_.O,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.OD(_.Cd,[{initDataType:_.Zf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":gM,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":gM,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.yj(a,zL);if(!eM.includes(b))return fM.error("Widevine in HLS is only supported with [",
|
|
67
|
+
eM.join(", "),"], not",b),null;b=_.yj(a,_.Ob);b=_.Bv(b);b=_.Oj(b.data);b=_.OD(_.Gd,[{initDataType:_.hd,initData:b}],"");if(a=_.P(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},eM=["SAMPLE-AES",AL],fM=new _.J("clpp.hls.DrmParser");var JN={Nn:function(a,b,c){if(_.Y.yd(a[0].fa,uL)||null===c)return c=JN.Wi(a,b),0===c.length?[{type:_.Re,drmInfos:[],keyId:null}]:c;a=JN.Wi(a,b);return[c].concat(_.hh(a))},ua:function(a){if(0===a.length)return{type:_.Re,drmInfos:[],keyId:null};if(a.some(function(c){return"whole-segment"===c.type})||a.every(function(c){return c.type===_.Re}))return a[0];a=a.filter(function(c){return c.type===EL});var b=_.Li(a.flatMap(function(c){return c.drmInfos}));return{keyId:a[a.length-1].keyId,type:EL,drmInfos:b}},
|
|
68
|
+
Wi:function(a,b){return JN.Fl(a).map(function(c){return JN.Qn(c.fa,b)}).filter(Boolean)},Fl:function(a){return a.filter(function(b){return _.Y.yd(b.fa,uL)})},Qn:function(a,b){var c=_.Y.pc(a,uL).filter(function(e){return"AES-128"!==_.yj(e,zL)});if(0===c.length)return null;var d=_.yj(c[0],zL);if(1===c.length&&"NONE"===d)return{type:_.Re,drmInfos:[],keyId:null};d=c.map(function(e){return _.yj(e,zL)});if(!d.every(function(e){return"SAMPLE-AES"===e})&&!d.every(function(e){return e===AL}))throw JN.g.warn("EXT-X-KEY methods "+
|
|
69
|
+
d.join(", ")+" are incompatible."),new _.N(_.O,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");c=c.map(function(e){var f=_.P(e,"KEYFORMAT","identity"),g=QN[f]||null;(e=g?g(e,b):null)||JN.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===c.length)throw new _.N(_.O,4,4026);return{keyId:c.map(function(e){return e.keyIds}).reduce(function(e,f){return e.concat(f)},[]).reverse()[0]||null,type:EL,drmInfos:c}},wp:function(){return{type:_.Re,drmInfos:[],keyId:null}},
|
|
70
|
+
Vi:function(a,b,c){a=_.Y.pc(a,uL)[0];if(!a||"AES-128"!==_.yj(a,zL))return null;var d=JN.Rl(a,c);c=d.iv;d=d.generatedIv;return{method:"AES-128",url:_.bk(_.yj(a,_.Ob),b),iv:c,generatedIv:d}},ai:function(a){return _.Um(new Uint8Array(12),new Uint8Array([a>>24&255,a>>16&255,a>>8&255,a&255]))},Rl:function(a,b){var c=_.P(a,"IV","");if(c)return{iv:_.Rm((c||"0x").slice(2)),generatedIv:!1};c=_.P(a,"KEYFORMAT");return null==c||"identity"===c?{iv:JN.ai(b),generatedIv:!0}:{iv:null,generatedIv:!1}}};JN.g=new _.J("clpp.hls.EncryptionUtils");kM.prototype.length=function(){return this.streams.length};kM.prototype.f=function(){return this.streams[0].groupId};kM.prototype.a=function(){return this.streams[0].type};kM.prototype.dc=function(){return this.streams[0].zc};sM.prototype.length=function(){return this.a.length};_.r=FM.prototype;_.r.configure=function(a){this.a=a;this.Y.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 _.H(function(n){if(1==n.a){if(c.P)throw Error("start() may be called only once!");c.P=!0;c.C=b;d=Date.now();return _.x(n,eN(c,a),2)}if(3!=n.a)return e=n.f,f=e.response,g=e.text,h=Date.now(),c.C.onEvent(new _.K(DL,{detail:{duration:h-d,type:"master"}})),c.o=f.uri,_.x(n,QM(c,g),3);l=n.f;c.f=l;m=c.H;c.l&&0<m&&c.l.ha(m);return n["return"](l)})};
|
|
71
|
+
_.r.requestStop=function(){this.N=!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.C=this.w=null;this.B.clear();this.J.clear();return Promise.all(a)};
|
|
72
|
+
_.r.update=function(){var a=this,b,c,d,e,f,g,h,l,m,n;return _.H(function(p){switch(p.a){case 1:b=a.f;if(NM(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=GM(a),d=d.filter(function(q){return e.includes(q.dc())}));return _.x(p,iN(a,d),2);case 2:return f=p.f,g=f.map(function(q){return q.playlist}),YM(a,g),_.x(p,TM(a,f),3);case 3:h=p.f;uM(b.periods,h).forEach(function(q){a.C.filterNewPeriod(q)});LM(a,h);l=cN(a,
|
|
73
|
+
g);m=dN(a,g,l);b.cues=HM(a,m);wM(b.periods,h);AN(c,h);if(n=_.Y.nm(g))!0!==a.a.keepTimelineLive&&(a.A=_.Wb,_.AE(c,!0),c.f=h[h.length-1].endTime),a.l.stop(),a.l=null;if(a.C.onUpdate)a.C.onUpdate(b);if(n&&a.C.onTurnedStatic)a.C.onTurnedStatic();if(!a.N){p.D(4);break}return _.x(p,a.stop(),4);case 4:return p["return"](b)}})};
|
|
74
|
+
_.r.loadVariant=function(a,b){var c=this,d,e,f,g,h,l,m,n,p,q,t,u,y,A,B;return _.H(function(E){if(1==E.a){d=a.id;if(e=c.f.periods.find(function(C){return C.id===b}))if(f=e.variants.find(function(C){return C.id===d}))return E["return"](f);g=c.f.alternativeVariants.find(function(C){return C.id===d});if(!g)throw new _.$i("No alternative variant with id: "+d);h=g;m=l=null;h.audio&&(n=h.audio,l=tN(c,n.verbatimUri,function(){var C;return _.H(function(G){if(1==G.a)return _.x(G,fN(c,n),2);C=G.f;return G["return"](oN(c,
|
|
75
|
+
n,C))})}));h.video&&(p=h.video,m=tN(c,p.verbatimUri,function(){var C;return _.H(function(G){if(1==G.a)return _.x(G,fN(c,p),2);C=G.f;return G["return"](oN(c,p,C))})}));return _.x(E,l,2)}if(3!=E.a)return q=E.f,_.x(E,m,3);t=E.f;if(u=SM(c,q,t,h.bandwidth,h.id))A=c.C.configurationId,B=BM(A,[u],[],[],!NM(c)),c.C.filterAllPeriods(B),B.forEach(function(C,G){c.f.periods[G].variants.push(C.variants[0]);b===c.f.periods[G].id&&(y=C.variants[0])});if(!y)throw new _.$i("Could load variant with id: "+d);return E["return"](y)})};
|
|
76
|
+
_.r.loadTextStream=function(a,b){var c=this,d,e,f,g,h,l;return _.H(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.D(2);g=c.f.alternativeTextStreams.find(function(n){return n.id===a})||null;if(!g)throw new _.$i(_.SC+a);h=g;return _.x(m,tN(c,h.verbatimUri,function(){var n;return _.H(function(p){if(1==p.a)return _.x(p,fN(c,h),2);n=p.f;return p["return"](oN(c,h,n))})}),
|
|
77
|
+
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 _.$i(_.SC+a);return m["return"](d)})};_.r.hc=function(){var a=this,b,c;return _.H(function(d){if(1==d.a){a.g.debug(_.bD);if(!a.C)return d["return"]();_.D(d,2);return _.x(d,a.update(),4)}if(2!=d.a)return a.l&&0<a.H&&a.l.ha(a.H),_.vh(d,0);b=_.F(d);if(!(b instanceof _.N))throw b;a.C&&(a.C.onError(b),c=b,1===c.severity&&a.l&&a.l.ha(.1));_.z(d)})};
|
|
78
|
+
_.r.eg=function(a){if(!this.G)throw new _.N(_.O,7,7001);a=this.C.networkingEngine.fetch(a);_.uk(this.G,a);return a.T};_.w(ON,_.Fu);ON.prototype.f=function(){_.hv.m3u8=FM;_.fv[_.bm]=FM;_.fv[CL]=FM};ON.prototype.a=function(){_.wF("m3u8");_.xF(_.bm);_.xF(CL)};ON.prototype.id=function(){return"hls"};_.I("clpp.hls.HlsComponent",ON);};
|
|
79
79
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
80
80
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
81
81
|
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
|
-
_.I("clpp.hlssmpte.HlsSmptePlugin",
|
|
2
|
+
var f=function(window){var GV=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.L.R(a)){a:{var b=a.info;if(_.L.ja(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=_.L.ja(a)?a:null}},IV=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.hi;this.h=(a=_.Ev(_.Mc))?new a(this.m.getConfiguration()):null;this.g=new _.J("clpp.hlssmpte.ImageCueHandler");this.f=null;HV(this)},HV=function(a){a.a.one(a.m,_.De,function(){return JV(a)})},
|
|
3
|
+
JV=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Bc,function(d){return KV(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Ke}).forEach(function(d){KV(a,{track:d})});!LV(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."),MV(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
|
+
LV=function(a){return a.some(function(b){return b.kind===_.Ke})},MV=function(a,b){var c=a.m.getTrackManager(),d=c.na(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ia(d)};a.a.on(b.textTracks,_.Bc,function(g){g.track.kind===_.Ke&&(a.a.off(b.textTracks,_.Bc,f),f())});c.Ia(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},KV=function(a,b){var c=b.track;c.kind===_.Ke&&(a.g.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.oe,a.a.on(c,_.Ld,function(d){return NV(a,d)}))},NV=function(a,b){var c=OV(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 GV(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.Q.hb(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},OV=function(a){return(a=
|
|
6
|
+
a.m.getTrackManager().va())&&a.language&&a.language.toLowerCase()},PV=function(){this.a=null;this.f=!1},QV=function(){};IV.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.w(PV,_.ew);PV.prototype.onPlayerCreated=function(){};PV.prototype.onContentWillLoad=function(a){if(this.f=_.Al()){var b=a.getConfiguration();b=_.L.kb(b.hlssmpte||{});_.L.vi(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.L.ya(b.timestampOffset)||(b.timestampOffset=0);this.a=new IV(a,b.patchMetadataTrack,b.timestampOffset)}};PV.prototype.onPlayerWillDestroy=function(){var a=this;return _.H(function(b){if(1==b.a)return a.a?_.x(b,a.a.destroy(),3):b.D(0);a.a=null;_.z(b)})};PV.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.I("clpp.hlssmpte.HlsSmptePlugin",PV);PV.Id="hlssmpte";QV.prototype.create=function(){return new PV};_.bu(new QV);};
|
|
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));}
|