@castlabs/prestoplay 6.20.0 → 6.21.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 +35 -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 +109 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +553 -550
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +78 -77
- package/cjs/cl.externs.js +81 -97
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +69 -69
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +22 -24
- package/cjs/cl.mse.js +305 -305
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +25 -25
- package/cjs/cl.tizen.js +70 -69
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +9 -0
- package/cjs/cl.youbora.js +38 -20
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -89
- package/cl.conviva.js +27 -27
- package/cl.core.js +471 -468
- package/cl.crypto.js +8 -8
- package/cl.dash.js +74 -72
- package/cl.externs.js +71 -99
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +74 -74
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +16 -17
- package/cl.mse.js +276 -276
- 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.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -0
- package/cl.youbora.js +27 -15
- package/package.json +3 -1
- package/typings.d.ts +123 -24
package/cjs/cl.freewheel.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.
|
|
4
|
-
_.y(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.y(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},
|
|
5
|
-
a.a.registerVideoDisplayBase(
|
|
6
|
-
_.u.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.
|
|
7
|
-
_.J("clpp.freewheel.FreeWheelPlugin",
|
|
8
|
-
_.u.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.u.getPosition=function(){return 0};_.u.getSkipTimeOffset=function(){return 0};_.u.
|
|
9
|
-
_.u.
|
|
10
|
-
_.u.getPodIndex=function(){switch(this.
|
|
11
|
-
_.u.getWrapperCreativeIds=function(){return[]};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_.u.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{
|
|
16
|
-
_.w(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,
|
|
17
|
-
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.
|
|
18
|
-
_.u.resume=function(){this.f&&this.f.resume()};_.u.pause=function(){this.f&&this.f.pause()};_.u.skip=function(){this.f&&this.f.skipCurrentAd()};_.u.getVolume=function(){return this.a?this.a.getAdVolume():1};_.u.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.u.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.u.Pc=function(){return!0};_.u.pc=function(){var a=this;return _.I(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);
|
|
19
|
-
_.u.
|
|
20
|
-
void 0));this.l.resolve()};_.u.
|
|
21
|
-
_.u.
|
|
22
|
-
_.xc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:
|
|
23
|
-
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.u.
|
|
24
|
-
_.u.
|
|
25
|
-
|
|
2
|
+
var f=function(window){var sU="clpp-freewheel",tU="clpp.freewheel.AdsManagerFactory",uU="freewheel",vU=function(){this.f=this.a=null},wU=function(){},xU=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""}},yU=function(a,b,c){this.h=a;this.f=b;this.a=c},zU=function(a){this.a=a},AU=function(a){this.g=new _.K("clpp.freewheel.AdsManager");this.m=a;this.h=new _.Sh;this.w=new tv.freewheel.SDK.AdManager;
|
|
3
|
+
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.gk;this.j=null},BU=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(", ")});},CU=function(){var a,b,c,d;return _.I(function(e){if(1==e.a)return a=new _.lu,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
|
|
4
|
+
_.y(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.y(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},FU=function(a){return _.I(function(b){if(a.B.length)return DU(a),a.f=a.B.shift(),a.f.play(),b.F(0);EU(a);return _.y(b,a.m.a.play(),0)})},GU=function(a){a.A.length?(DU(a),a.f=a.A.shift(),a.f.play()):EU(a)},DU=function(a){var b=a.m.Nd(uU).Zc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
|
|
5
|
+
a.a.registerVideoDisplayBase(sU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},EU=function(a){var b=a.m.Nd(uU).Zc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},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 yU(a.a,c,d)});a.m.trigger(new _.L(b,d))},IU=function(){this.fd=new _.K(tU)};_.x(vU,_.pv);_.u=vU.prototype;
|
|
6
|
+
_.u.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.tq(_.Wd,{id:sU}),this.f=_.tq(_.r,{"class":_.wd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.N(1,9,12E3))};_.u.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.u.id=function(){return uU};_.u.Zc=function(){return this.a};_.u.al=function(){return this.f};
|
|
7
|
+
_.J("clpp.freewheel.FreeWheelPlugin",vU);vU.prototype.getAdVideo=vU.prototype.al;vU.prototype.getAdContainer=vU.prototype.Zc;vU.Id=uU;vU.AD_CONTAINER_ID=sU;wU.prototype.create=function(){return new vU};_.Qs(new wU);_.u=yU.prototype;_.u.nb=function(){return"FreeWheel AdManager SDK"};_.u.ob=function(){return tv.freewheel.SDK.version};_.u.rb=function(){return 0};_.u.getId=function(){return this.a?this.a.getAdId():""};_.u.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.fg?a:""};_.u.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.u.getAdSystem=function(){return""};_.u.getAdvertiserName=function(){return""};_.u.getTitle=function(){return""};
|
|
8
|
+
_.u.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.u.getPosition=function(){return 0};_.u.getSkipTimeOffset=function(){return 0};_.u.Tb=function(){return!1};_.u.pb=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.u.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
|
|
9
|
+
_.u.eb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.u.cb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.u.Pa=function(){return 0};_.u.Qa=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
|
|
10
|
+
_.u.getPodIndex=function(){switch(this.Qa()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.u.Cb=function(){switch(this.Qa()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.u.Db=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.u.fb=function(){return this.f.getAdCount()};_.u.getWrapperAdIds=function(){return[]};_.u.getWrapperAdSystems=function(){return[]};
|
|
11
|
+
_.u.getWrapperCreativeIds=function(){return[]};yU.prototype.getWrapperCreativeIds=yU.prototype.getWrapperCreativeIds;yU.prototype.getWrapperAdSystems=yU.prototype.getWrapperAdSystems;yU.prototype.getWrapperAdIds=yU.prototype.getWrapperAdIds;yU.prototype.getSequenceLength=yU.prototype.fb;yU.prototype.getPositionInSequence=yU.prototype.Db;yU.prototype.getPodTimeOffset=yU.prototype.Cb;yU.prototype.getPodIndex=yU.prototype.getPodIndex;yU.prototype.getPodType=yU.prototype.Qa;
|
|
12
|
+
yU.prototype.getMediaBitrate=yU.prototype.Pa;yU.prototype.getMediaHeight=yU.prototype.cb;yU.prototype.getMediaWidth=yU.prototype.eb;yU.prototype.getMediaUrl=yU.prototype.getMediaUrl;yU.prototype.getClickThroughUrl=yU.prototype.pb;yU.prototype.isBumper=yU.prototype.Tb;yU.prototype.getSkipTimeOffset=yU.prototype.getSkipTimeOffset;yU.prototype.getPosition=yU.prototype.getPosition;yU.prototype.getDuration=yU.prototype.getDuration;yU.prototype.getTitle=yU.prototype.getTitle;
|
|
13
|
+
yU.prototype.getAdvertiserName=yU.prototype.getAdvertiserName;yU.prototype.getAdSystem=yU.prototype.getAdSystem;yU.prototype.getApiFramework=yU.prototype.getApiFramework;yU.prototype.getCreativeId=yU.prototype.getCreativeId;yU.prototype.getId=yU.prototype.getId;yU.prototype.getTechnology=yU.prototype.rb;yU.prototype.getAdManagerVersion=yU.prototype.ob;yU.prototype.getAdManagerName=yU.prototype.nb;zU.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()}})};zU.prototype.Fb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};zU.prototype.Eb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
14
|
+
zU.prototype.hasPostroll=zU.prototype.Eb;zU.prototype.hasPreroll=zU.prototype.Fb;zU.prototype.getCuePoints=zU.prototype.getCuePoints;_.u=AU.prototype;
|
|
15
|
+
_.u.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{BU(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 _.y(m,CU(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
|
|
16
|
+
_.w(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,xU(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ue&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.w(b.parameters),h=g.next();!h.done;h=
|
|
17
|
+
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.Dm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Hm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.Gm.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Yl.bind(a));a.h.on(a.m,_.ng,a.Uj.bind(a));a.h.on(a.m,_.cg,a.Tj.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.u.start=function(){var a=this;return _.I(function(b){return _.y(b,FU(a),0)})};_.u.Tc=function(){};
|
|
18
|
+
_.u.resume=function(){this.f&&this.f.resume()};_.u.pause=function(){this.f&&this.f.pause()};_.u.skip=function(){this.f&&this.f.skipCurrentAd()};_.u.getVolume=function(){return this.a?this.a.getAdVolume():1};_.u.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.u.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.u.Pc=function(){return!0};_.u.pc=function(){var a=this;return _.I(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);EU(a);a.a&&(a.a.dispose(),a.a=null);_.A(b)})};
|
|
19
|
+
_.u.Dm=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 _.L(_.Nc,{adsTimeline:new zU(this.a)})),this.j=new _.ju(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.Nd(uU).f);else this.m.onError(new _.N(1,9,10003,{errorType:0},
|
|
20
|
+
void 0));this.l.resolve()};_.u.Hm=function(a){HU(this,_.uc,a);this.j.start()};_.u.Gm=function(a){this.f=null;a=a.slot;HU(this,_.vc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:FU(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:EU(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:GU(this)}};
|
|
21
|
+
_.u.Yl=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:HU(this,_.Jc,a);HU(this,_.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:HU(this,_.Kc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:HU(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:HU(this,_.Ec,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:HU(this,_.Lc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:HU(this,_.yc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:HU(this,
|
|
22
|
+
_.xc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:HU(this,_.Fc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:HU(this,_.Hc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:HU(this,_.Ic,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:HU(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:HU(this,_.Gc,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],
|
|
23
|
+
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.u.Uj=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();DU(this);this.f.play()}}};
|
|
24
|
+
_.u.Tj=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Up:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Tp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Np:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);GU(this);break;case _.Gp:case _.Rp:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};AU.prototype.getPosition=AU.prototype.getPosition;AU.prototype.setVolume=AU.prototype.setVolume;
|
|
25
|
+
AU.prototype.getVolume=AU.prototype.getVolume;AU.prototype.skip=AU.prototype.skip;AU.prototype.pause=AU.prototype.pause;AU.prototype.resume=AU.prototype.resume;IU.prototype.name=function(){return tU};IU.prototype.a=function(a,b){return a.namespace()!==_.Ad&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.fd.warn("FreeWheel SDK is not loaded."),!1):!1};IU.prototype.create=function(a){return new AU(a)};_.nq(new IU);};
|
|
26
26
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
27
27
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
28
28
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hls.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
d[0].a)throw new _.N(_.P,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.X=c;this.T=1===b?d:null},
|
|
4
|
-
c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.N(_.P,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.N(_.P,4,4044,"Query param '"+g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},
|
|
5
|
-
|
|
6
|
-
e=b.T;d=d.concat(b.X);a=
|
|
7
|
-
d.push(h):_.
|
|
8
|
-
e+"' as it is not defined in the master playlist");d.set(e,f)});return d},
|
|
9
|
-
21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.N(_.P,4,4030);}
|
|
10
|
-
e+=10;e+=f}while(e<a.byteLength);return d()},
|
|
11
|
-
c(),a=_.
|
|
12
|
-
g}if(c||!d)throw _.
|
|
13
|
-
4,4030,
|
|
14
|
-
if("audio/mpeg"===d||d===_.cd||d===_.bd)return v["return"](0);g=f;if(d!==_.ad){v.F(2);break}return _.y(v,
|
|
15
|
-
"")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.N(_.P,4,4030);}})},
|
|
16
|
-
e.uris[0]);_.D(n,5);return _.y(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.E(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.N(_.P,4,4030,"Failed to fetch the media segment.");}})},
|
|
17
|
-
b})},
|
|
18
|
-
b){var c=new Set(a.map(function(d){return d.
|
|
19
|
-
_.
|
|
20
|
-
c.startTime+c.duration}},
|
|
21
|
-
e.drmInfos=d.drmInfos;e.keyId=d.keyId})},
|
|
22
|
-
new
|
|
23
|
-
e.id));var g={configurationId:a.D.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,endTime:e.endTime,id:e.id,type:_.
|
|
24
|
-
f===c.AUDIO&&(g="mp4a.40.2");F=a.N;var G=a.w,
|
|
25
|
-
m.ee;
|
|
26
|
-
t.K),isNaN(a.a.availabilityWindowOverride)||(F=a.a.availabilityWindowOverride),t.A=F):a.l===_.kc&&(t.f=F);v=
|
|
27
|
-
c.
|
|
28
|
-
t.stream.streams[0];t=Object.assign({},{playlist:t.playlist},{language:v.language,channelsCount:v.channelsCount,spatialAudio:v.spatialAudio,closedCaptions:v.closedCaptions,primary:v.primary,kind:v.kind||null,groupId:v.groupId,type:v.type,codecs:v.codecs,name:v.originalId,uri:v.
|
|
29
|
-
n=l.filter(function(q){return q.xd()===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,
|
|
30
|
-
a.a.suggestedPresentationDelay),_.y(
|
|
31
|
-
b,c){b=b.find(function(d){return null!==_.Y.
|
|
32
|
-
(c.value+").")),null):d/1E3},
|
|
33
|
-
_.jc);var l=_.
|
|
34
|
-
d.concat(b.slice(1).map(function(g){return
|
|
35
|
-
|
|
36
|
-
a.g.debug("Guessing stream type for",l.toString()),G=!1,
|
|
37
|
-
C[F]=[da];F===f.AUDIO&&c&&z.forEach(function(
|
|
38
|
-
(b.push(m),d.add(l)))}}return b},
|
|
39
|
-
function(){var l,m,n,p,q,t,v,z,C,F,G,
|
|
40
|
-
spatialAudio:H,groupId:n,kind:q,closedCaptions:null,Xe:null}),2)}T=da.f;return da["return"](T)})}))})},
|
|
41
|
-
_.oa))&&
|
|
42
|
-
_.
|
|
43
|
-
|
|
44
|
-
createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:
|
|
45
|
-
F.height:void 0,bandwidth:void 0,roles:[],channelsCount:v,spatialAudio:z,closedCaptions:C,keyInfo:Va.keyInfo,T:
|
|
46
|
-
b){var c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){c=_.Y.
|
|
47
|
-
0<t.length?v:null}}else q=null;if(t=q)q=t.
|
|
48
|
-
4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},
|
|
49
|
-
b.ya,b.
|
|
50
|
-
c.X,q=c.a;0<_.Y.
|
|
51
|
-
_.Y,f=
|
|
52
|
-
|
|
53
|
-
}return _.y(
|
|
54
|
-
d);
|
|
55
|
-
m.a)return a.J.has(b)?m["return"](a.J.get(b)):_.y(m,
|
|
56
|
-
d.a;g=(f=_.Y.
|
|
57
|
-
_.
|
|
58
|
-
f.next());if(5!=l.a){if(g.done)return-1===c?l.F(0):_.y(l,{
|
|
2
|
+
var f=function(window){var vK="Could not parse MP4 segment start time.",wK="Failed to infer discontinuity number",xK="Guessing audio-only",yK="METHOD",zK="SAMPLE-AES-CTR",AK="Setting playlist start time to ",BK="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",CK="application/vnd.apple.mpegurl",DK="sample",EK="whole-segment",FK=function(a){if(1>a.a)throw _.$m();--a.a},GK=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.N(_.P,4,4043,"Media playlist must have at least one segment!");if(null==
|
|
3
|
+
d[0].a)throw new _.N(_.P,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.X=c;this.T=1===b?d:null},HK=function(a,b,c){c=void 0===c?[]:c;this.X=b;this.a=a;this.f=c;this.ka=-1},IK=function(a){a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value,b.startsWith("#EXT-")&&(b=_.Sj(0,b),_.Ev.has(b.name)))return 1;return 0},JK=function(a,b){var c=new Map,d=new URL(b);a.forEach(function(e){var f=_.lj(e,"NAME"),g=_.lj(e,"QUERYPARAM");if(f)g=_.mj(e,"VALUE"),
|
|
4
|
+
c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.N(_.P,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.N(_.P,4,4044,"Query param '"+g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},KK=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.N(_.P,4,4044,"Undefined variable '"+d+"'");return e})},LK=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=
|
|
5
|
+
KK(d.value,b)})})},MK=function(a,b,c){LK(a,c);b.forEach(function(d){d.a&&(d.a=KK(d.a,c));LK(d.X,c);LK(d.f,c)})},NK=function(){this.f=0;this.a=new Map},QK=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&!_.Y.Uh(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.N(_.P,4,4015);return 0===IK(b)?OK(a,b,c):PK(a,b,c)},PK=function(a,b,c){for(var d=[],e=1;e<b.length;){var f=RK(a,b[e]);if(_.Fv.has(f.name))break;d.push(f);e++}b=SK(a,c,b.slice(e));
|
|
6
|
+
e=b.T;d=d.concat(b.X);a=TK(a,d,c);MK(d,e,a);return new GK(c,1,d,b.T)},OK=function(a,b,c){for(var d=[],e=1;e<b.length;e++){var f=RK(a,b[e]);d.push(f);if(f.name===_.Ya){var g=b[e+1];if(!g)throw new _.N(_.P,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.nj(_.dc,g));e++}}b=_.Y.Pb(d,"EXT-X-DEFINE");_.Y.Qi(b);b=JK(b,c);a.a=b;MK(d,[],a.a);return new GK(c,0,d)},SK=function(a,b,c){var d=[],e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=RK(a,h),_.Ev.has(h.name)||_.Hv.has(h.name)?
|
|
7
|
+
d.push(h):_.Gv.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Ta&&"PART"===_.lj(h,_.bc)&&g.push(h):f.push(h)):_.Y.Uh(h)||(h=_.Y.zd(b,h.trim(),!1),e.push(new HK(h,f,g)),f=[],g=[])});0<g.length&&e.push(new HK(null,f,g));return{T:e,X:d}},RK=function(a,b){return _.Sj(a.f++,b)},TK=function(a,b,c){b=_.Y.Pb(b,"EXT-X-DEFINE");_.Y.Qi(b);var d=JK(b,c);b.map(function(e){return _.lj(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.N(_.P,4,4044,"Cannot import variable '"+
|
|
8
|
+
e+"' as it is not defined in the master playlist");d.set(e,f)});return d},UK=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},VK=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},WK=function(){this.a=new Map;this.f=new Map},XK=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]<<
|
|
9
|
+
21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.N(_.P,4,4030);}VK(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===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}}VK(a,e)||d();
|
|
10
|
+
e+=10;e+=f}while(e<a.byteLength);return d()},YK=function(a){for(;a.getPosition()<a.Oa()-1;){var b=a.getPosition();if(71===_.an(a))return FK(a),b}return-1},ZK=function(a){function b(){d.seek(e+188);f=_.an(d);71!==f&&(d.seek(e+192),f=_.an(d));71!==f&&(d.seek(e+204),f=_.an(d));71!==f&&c();FK(d)}function c(){throw new _.N(_.P,4,4030);}var d=new _.Ym(new DataView(a),!1),e=0,f=0;e=YK(d);0>e&&(_.bw.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.an(d),71!==f&&
|
|
11
|
+
c(),a=_.bn(d),8191===(a&8191))b();else if(a&16384)if(a=(_.an(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.an(d),d.skip(a)),1!==_.W(d)>>8)b();else{d.skip(3);a=_.an(d)>>6;0!==a&&1!==a||c();0===_.an(d)&&c();a=_.an(d);var g=_.bn(d),h=_.bn(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},$K=function(a,b){var c=null,d=0;try{(new _.gn).M(_.Qe,_.hn).M(_.og,_.hn).M(_.Le,_.hn).Y("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.W(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=
|
|
12
|
+
g}if(c||!d)throw _.bw.error("Unable to find timescale in init segment!"),new _.N(_.P,4,4030,vK,c);var e=0,f=!1;try{(new _.gn).M("moof",_.hn).M("traf",_.hn).Y("tfdt",function(g){var h=d;if(0===g.version)h=_.W(g.reader)/h;else{var l=_.W(g.reader),m=_.W(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(_.P,
|
|
13
|
+
4,4030,vK,c);return e},cL=function(a){var b=_.mj(a,yK);if(!aL.includes(b))return bL.error("PlayReady in HLS is only supported with [",aL.join(", "),"], not",b),null;a=_.mj(a,_.dc);b=_.av(a);a=null;b=_.zj(b.data);try{a=_.sD(_.io(b))}catch(c){a=b}return _.FD(_.Nd,[{initDataType:_.rd,initData:a}],"")},dL=function(a){this.g=new _.K("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Uj()}},fL=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,t;return _.I(function(v){switch(v.a){case 1:a.g.debug("Fetching segment to find start time");
|
|
14
|
+
if("audio/mpeg"===d||d===_.cd||d===_.bd)return v["return"](0);g=f;if(d!==_.ad){v.F(2);break}return _.y(v,eL(a,c,g),3);case 3:return h=v.f,l=_.zj(h.data),VK(l)?v["return"](XK(l)):v["return"](ZK(h.data));case 2:if(d!==_.Eg&&d!==_.dd){v.F(4);break}m=[eL(a,c,g)];b&&m.push(eL(a,b,!0));return _.y(v,Promise.all(m),5);case 5:return n=v.f,p=n[0],q=n[1]||n[0],v["return"]($K(p.data,q.data));case 4:if(d!==_.Dg){v.F(6);break}return _.y(v,eL(a,c,g),7);case 7:return t=v.f,v["return"](ZK(t.data));case 6:if(!_.pt((d.split("/")[0]||
|
|
15
|
+
"")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.N(_.P,4,4030);}})},eL=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=_.gE(b.Xa(),b.ya,b.ya+2048-1,a.a.attemptParameters),e.type=2,f=_.gE(b.Xa(),b.ya,b.la,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.D(n,2),g=c?f:e,_.y(n,a.f(g),4);case 4:return h=n.f,n["return"](h);case 2:l=_.E(n);if(7001===l.code||c)throw l;a.g.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS pre-flights.",
|
|
16
|
+
e.uris[0]);_.D(n,5);return _.y(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.E(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.N(_.P,4,4030,"Failed to fetch the media segment.");}})},gL=function(a){this.streams=a},hL=function(a,b){a.streams.forEach(function(c){c.mf=b})},iL=function(a,b){a.streams.forEach(function(c){c.width=b})},jL=function(a,b){a.streams.forEach(function(c){c.height=b})},kL=function(a,b){a.streams.forEach(function(c){c.frameRate=
|
|
17
|
+
b})},lL=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},mL=function(a,b){var c=a.streams.find(function(d){d=d.T;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.T.find(function(d){return d.position===b})||null},nL=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},oL=function(a){this.a=a},pL=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},qL=function(a,
|
|
18
|
+
b){var c=new Set(a.map(function(d){return d.ka}));return b.filter(function(d){return!c.has(d.ka)})},sL=function(a,b){for(;a[0].ka<b[0].ka;)a.splice(0,1);var c=a[0],d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||rL(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&rL(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},xL=function(a,b,c,d,e){var f=b[0].length();f=UK(f).map(function(g){var h=pL(b,g)||[],l=nL(c,g)||[];g=nL(d,g)||[];var m=_.ah(tL(h)).concat(_.ah(l),
|
|
19
|
+
_.ah(g)).filter(Boolean);uL(m);var n=m[0];m=n.ka;n=n.duration;return{configurationId:a,variants:h,textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,ka:m}});e&&vL(f[0]);wL(f);return f},tL=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},vL=function(a){var b=tL(a.variants)[0].T[0].Da;a.startTime+=b;a.endTime+=b},wL=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=
|
|
20
|
+
c.startTime+c.duration}},rL=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;yL(a.variants,b.variants);zL(_.Y.Ue(a),_.Y.Ue(b))},yL=function(a,b){var c=new Map(a.map(function(d){return[_.Y.ph(d),d]}));b.forEach(function(d){c.get(_.Y.ph(d)).drmInfos=d.drmInfos})},zL=function(a,b){var c=new Map(a.map(function(d){return[d.kc,d]}));b.forEach(function(d){var e=c.get(d.kc);e.T=d.T;e.segmentIndex.replace(d.T);e.ec=d.ec;e.Je=d.Je;e.duration=d.duration;e.th=d.th;e.encrypted=d.encrypted;
|
|
21
|
+
e.drmInfos=d.drmInfos;e.keyId=d.keyId})},uL=function(a){var b=AL(a);a.forEach(function(c){_.bE(c.segmentIndex,b);c.duration=b;c.Je=c.ec+b})},AL=function(a){var b=Infinity;_.Y.Rk(a).forEach(function(c){b=Math.min(b,c.duration)});return b},BL=function(){var a=this;this.a=this.D=null;this.V=1;this.f=new WK;this.w="";this.N=new NK;this.G=0;this.j=null;this.h=new _.pl(function(){a.Vb()});this.l=_.kc;this.B=null;this.C=new _.jk;this.I=this.A=null;this.g=new _.K("clpp.hls.HlsParser");this.J=new Map;this.P=
|
|
22
|
+
new dL(this.xf.bind(this));this.L=!1;this.H=null;this.K=!1;this.o=new Map},CL=function(a){if(null===a.j)return[];a=a.j;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.kc})},DL=function(a,b){var c=new Set(b.map(function(h){return h.id}));a.o.forEach(function(h,l){c.has(l)||a.o["delete"](l)});for(var d=_.w(b),e=d.next();!e.done;e=d.next()){e=e.value;var f=a.o.get(e.id);if(f&&f.startTime!==e.startTime)a.D.onError(new _.N(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+
|
|
23
|
+
e.id));var g={configurationId:a.D.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,endTime:e.endTime,id:e.id,type:_.qi,eventElement:null};f&&!_.M.ai(f,g)||a.o.set(e.id,g)}return Array.from(a.o.values())},JL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.I(function(C){if(1==C.a){c=_.eq;d=EL(a,b,a.w,"");if(1===d.type){e=d.T[0].a;var F=_.hj(e)||"";f=null!=_.ij.video[F]?_.r:null!=_.ij.audio[F]?_.$c:null;g="";f===c.VIDEO?g="avc1.42E01E":
|
|
24
|
+
f===c.AUDIO&&(g="mp4a.40.2");F=a.N;var G=a.w,B=a.a.hlsDefaultCodecs||g,H=[],O=[];O.push(new _.nj(_.oa,"0"));O.push(new _.nj(_.dc,G));B.length&&O.push(new _.nj(_.sa,B));H.push(new _.kj(F.f++,_.Ya,O));d=new GK(G,0,H)}h=_.Y.Um(d.X);return _.y(C,FL(a,h),2)}l=C.f;m=l.Ol;n=l.periods;p=l.gn;q=l.In;if(!a.D)throw new _.N(_.P,7,7001);GL(a,n);F=!0;G=null;B=0;HL(a)||(F=!1,G=0,B=m.delay);H=a.a.timeline||{};H.type=void 0;G=new _.jE(H,G,B,!0,void 0,!!a.a.lowLatencyMode);_.mE(G,F);IL(G,n);p&&_.lE(G,p);t=G;if(!HL(a)){a.G=
|
|
25
|
+
m.ee;B=0;G=_.w(a.f.values());for(F=G.next();!F.done;F=G.next())B=Math.max(B,F.value.streams[0].ec);for(G=0;95443.7176888889<=B;)G+=95443.7176888889,B-=95443.7176888889;if(G)for(a.g.debug("Offsetting live streams by",G,"to compensate for rollover"),B=_.w(a.f.values()),F=B.next();!F.done;F=B.next())F=F.value.streams[0],95443.7176888889>F.ec?(a.g.debug("Offset applied to",F.type),F.segmentIndex.offset(G)):a.g.debug("Offset NOT applied to",F.type)}F=_.Y.ll(n);"LIVE"===a.l||"EVENT"===a.l?(F=Math.max(F,
|
|
26
|
+
t.K),isNaN(a.a.availabilityWindowOverride)||(F=a.a.availabilityWindowOverride),t.A=F):a.l===_.kc&&(t.f=F);v=DL(a,q);z={presentationTimeline:t,periods:n,minBufferTime:0,cues:v};a.g.debug("HLS playlist parsed",z);return C["return"](z)})},ML=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.Y,_.y(p,KL(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;g=d.lj;h=a.B.periods[0].variants;a.a.lowLatencyMode&&null!==a.j&&(h=h.filter(function(q){return q.id===a.j.id}));l=h.map(function(q){var t=
|
|
27
|
+
c.yh(q.audio,g),v=c.yh(q.video,g);q=LL(a,t,v,q.bandwidth);if(!q)throw new _.N(_.P,4,4047,{message:"Video and audio are encrypted in an incompatible way.",Ho:v?v.Sb():void 0,audio:t?t.Sb():void 0});return q});m=a.D.configurationId;n=xL(m,l,e,f,!0);return p["return"](n)})},KL=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.eq,d=function(q){return q.stream.xd()===c.VIDEO||q.stream.xd()===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),g=function(q){q=q.map(function(t){var v=
|
|
28
|
+
t.stream.streams[0];t=Object.assign({},{playlist:t.playlist},{language:v.language,channelsCount:v.channelsCount,spatialAudio:v.spatialAudio,closedCaptions:v.closedCaptions,primary:v.primary,kind:v.kind||null,groupId:v.groupId,type:v.type,codecs:v.codecs,name:v.originalId,uri:v.kc,Xe:{width:v.width,height:v.height,frameRate:v.frameRate}});return NL(a,t)});return Promise.all(q)},_.y(p,g(e),2);if(3!=p.a)return h=p.f,_.y(p,g(f),3);l=p.f;OL(a,h.concat(l));m=l.filter(function(q){return q.xd()===c.dj});
|
|
29
|
+
n=l.filter(function(q){return q.xd()===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,lj:h})})},OL=function(a,b){b.forEach(function(c){a.f.a.set(c.Sb(),c)})},FL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,C,F,G;return _.I(function(B){switch(B.a){case 1:return c=_.Y,d=c.Nm(b.gd.closedCaptions),e=PL(a,b.ge),_.y(B,QL(a,b),2);case 2:return f=B.f,g=Object.values(f).flat().map(function(H){return H.playlist}),RL(a,g),h=g[0],l=c.Wm(h.X),a.l=l,a.I=c.Ai(h.X),m=c.Tm(h.X,l,a.a.lowLatencyMode||!1,
|
|
30
|
+
a.a.suggestedPresentationDelay),_.y(B,SL(a,f.Ng,e),3);case 3:return n=B.f,_.y(B,TL(a,f.ge,n,d),4);case 4:return p=B.f,_.y(B,UL(a,f.En,e),5);case 5:return q=B.f,_.y(B,VL(a,f.Lf),6);case 6:return t=B.f,v=a.D.configurationId,z=xL(v,p,q,t,!HL(a)),a.D.filterAllPeriods(z),C=_.ah(f.ge).concat(_.ah(f.Ng)).map(function(H){return H.playlist}),F=WL(a,C),G=XL(a,C,F),B["return"]({periods:z,gn:F,In:G,Ol:m})}})},GL=function(a,b){HL(a)||2!==a.a.timeline.version||(a.H||(a.H=b[0].startTime),_.vF(b,-a.H))},XL=function(a,
|
|
31
|
+
b,c){b=b.find(function(d){return null!==_.Y.Wa(d.X,_.Ja)});if(!b)return[];if(null===c)throw new _.N(_.P,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");return b.X.filter(function(d){return d.name===_.Ja}).map(function(d){return _.Y.Om(d,c,a.A,!HL(a))}).filter(Boolean)},WL=function(a,b){var c=b.flatMap(function(e){return e.T[0].X});c=_.Y.Wa(c,_.Ua);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: "+
|
|
32
|
+
(c.value+").")),null):d/1E3},QL=function(a,b){var c,d,e,f,g,h;return _.I(function(l){if(1==l.a)return _.y(l,Promise.all([YL(a,b.gd.kj),YL(a,b.gd.Fn),YL(a,b.ge),YL(a,b.Lf)]),2);c=l.f;d=_.w(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({Ng:e,En:f,ge:g,Lf:h})})},$L=function(a,b){return Promise.all(b.map(function(c){return ZL(a,c)}))},PL=function(a,b){for(var c=_.Y.we,d=new Map,e=_.w(b),f=e.next();!f.done;f=e.next()){var g=f.value,h=_.lj(g,"AUDIO");f=_.lj(g,
|
|
33
|
+
_.jc);var l=_.lj(g,_.Ub);g=aM(a,g);if(l){var m=_.gj(_.Q,g);d.set(c(_.Q,l),m);l=g.indexOf(m);-1<l&&g.splice(l,1)}h&&(l=bM(_.$c,g),d.set(c(_.$c,h),l));f&&(h=bM(_.r,g),d.set(c(_.r,f),h))}return d},UL=function(a,b,c){return Promise.all(b.map(function(d){return cM(a,d,c)}))},VL=function(a,b){return Promise.all(b.map(function(c){return dM(a,c)}))},SL=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=[cM(a,b[0],c)];return _.y(f,d[0],2)}if(3!=f.a)return d=
|
|
34
|
+
d.concat(b.slice(1).map(function(g){return cM(a,g,c)})),_.y(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.Jn(e))})},TL=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v;return _.I(function(z){if(1==z.a){e=new Set;f=_.ah(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.mj(f[l].tag,_.oa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.y(z,eM(a,n,c,d,e),2)}if(3!=z.a)return p=z.f,q=f.map(function(C){return eM(a,C,c,d,e)}),_.y(z,Promise.all(q),3);t=z.f;t.splice(g,0,p);v=t.reduce(_.CD,[]);return z["return"](v)})},
|
|
35
|
+
eM=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(_.mj(h,_.oa)),m=f.Ym(h),_.y(p,fM(a,b,m,c,d),2)):(n=p.f)?p["return"](gM(a,n,l,e)):p["return"]([])})},fM=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,v,z,C,F,G,B,H,O,T,da;return _.I(function(aa){if(1==aa.a)return f=_.eq,g=_.Y.we,h=b,l=h.tag,m=h.playlist,n=aM(a,l),p=_.lj(l,"AUDIO"),q=_.lj(l,_.jc),t=p?d.get(g(f.AUDIO,p))||[]:[],v=q?d.get(g(f.VIDEO,q))||[]:[],z=_.ah(t).concat(_.ah(v)),C={audio:t,video:v},
|
|
36
|
+
a.g.debug("Guessing stream type for",l.toString()),G=!1,B=m.a,H=C.audio.find(function(ya){return ya.Sb()===B}),O=_.gj(f.VIDEO,n),T=c||O,1!==n.length||T?!z.length&&1<n.length?(a.g.debug("Guessing multiplexed audio+video"),F=f.VIDEO,n=[n.join(",")]):C.audio.length&&H?(a.g.debug(xK),F=f.AUDIO,G=!0):C.video.length?(a.g.debug(xK),F=f.AUDIO):(a.g.debug("Guessing video-only"),F=f.VIDEO):(F=f.AUDIO,a.g.debug(xK)),da=null,G?aa.F(2):_.y(aa,hM(a,b,n,F,e,c),3);2!=aa.a&&(da=aa.f);if(null==da)return aa["return"](null);
|
|
37
|
+
C[F]=[da];F===f.AUDIO&&c&&z.forEach(function(ya){iL(ya,c.width);jL(ya,c.height);kL(ya,c.frameRate)});_.Y.Nk(C);return aa["return"](C)})},gM=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.w(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.w(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.Jk(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=LL(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):
|
|
38
|
+
(b.push(m),d.add(l)))}}return b},LL=function(a,b,c,d){for(var e=[],f=(c||b).length(),g=0;g<f;g++){var h=b?b.streams[g]||null:null,l=c?c.streams[g]||null:null,m=_.Y.el(h,l);if(!m)return null;var n=d;h={id:a.V++,language:h?h.language:_.rg,primary:!!h&&h.primary||!!l&&l.primary,audio:h,video:l,bandwidth:n,drmInfos:m,allowedByApplication:!0,allowedByKeySystem:!0};e.push(h)}return new oL(e)},cM=function(a,b,c){var d,e,f,g;return _.I(function(h){d=b;e=d.tag;f=d.playlist;g=f.a;return h["return"](iM(a,g,
|
|
39
|
+
function(){var l,m,n,p,q,t,v,z,C,F,G,B,H,O,T;return _.I(function(da){if(1==da.a){l=_.eq;m=_.Y.we;n=_.mj(e,_.db);p=_.Y.nh(_.mj(e,_.bc));q=_.Y.Fk(e);t=c.get(m(p,n))||"";v=_.lj(e,_.qb);z=_.lj(e,"NAME");C=e.getAttribute("DEFAULT");F=e.getAttribute("AUTOSELECT");G=_.lj(e,"CHANNELS");B=p===l.AUDIO?G?parseInt(G.split("/")[0],10):null:null;var aa=p===l.AUDIO?(aa=_.lj(e,"CHANNELS"))?aa.includes("/JOC"):!1:!1;H=aa;O=!!C&&!!F;return _.y(da,NL(a,{playlist:f,codecs:t,type:p,Wd:v,primary:O,name:z,channelsCount:B,
|
|
40
|
+
spatialAudio:H,groupId:n,kind:q,closedCaptions:null,Xe:null}),2)}T=da.f;return da["return"](T)})}))})},dM=function(a,b){var c,d,e,f;return _.I(function(g){c=b;d=c.tag;e=c.playlist;f=e.a;return g["return"](iM(a,f,function(){var h,l,m,n,p;return _.I(function(q){if(1==q.a)return h=_.lj(d,_.sa)||"jpg",l=_.lj(d,_.qb),m=_.lj(d,"NAME"),_.y(q,NL(a,{playlist:e,codecs:h,type:_.ve,Wd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,Xe:null}),2);n=q.f;(p=_.lj(d,
|
|
41
|
+
_.oa))&&lL(n,Number(p));return q["return"](n)})}))})},aM=function(a,b){var c=_.lj(b,_.sa,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/),d=new Set,e=[];c=_.w(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.OD(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},hM=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=_.eq;n=l.a;return p["return"](iM(a,n,function(){var q,t,v,z;return _.I(function(C){if(1==C.a)return q=
|
|
42
|
+
_.lj(h,_.ra),t=null,d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q)),v=bM(d,c),_.y(C,NL(a,{playlist:l,codecs:v,type:d,closedCaptions:t,primary:!1,kind:null,Wd:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,Xe:f}),2);z=C.f;return C["return"](z)})}))})},iM=function(a,b,c){if(a.f.has(b))return a=a.f.get(b),Promise.resolve(a);if(a.f.f.has(b))return a.f.f.get(b)||null;c=c();a.f.set(b,c);return c},NL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,C,F,G,B,H,O,T;return _.I(function(da){if(1==da.a){c=
|
|
43
|
+
jM;d=kM;e=_.eq;f=b;g=f.playlist;h=f.codecs;l=f.type;m=f.Wd;n=f.groupId;p=f.primary;q=f.kind;t=f.name;v=f.channelsCount;z=f.spatialAudio;C=f.closedCaptions;F=f.Xe;G=_.Y.Fh(m);if(1!==g.type)throw new _.N(_.P,4,4017);return _.y(da,lM(a,g,l,h),2)}B=da.f;H=a.a.lowLatencyMode?d.Yi:d.$i;O=q;l!==e.TEXT||q||(O=_.ig);T=B.map(function(aa){var ya=aa.T,Va=aa.Pk,fb=aa.mimeType;aa=aa.ka;var Wa=ya[0].startTime,La=ya[ya.length-1].endTime,vb=La-Wa,Jb=new _.FE(ya),Cg=ya[0].initSegment||null;return{id:_.uK++,originalId:t,
|
|
44
|
+
createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:Jb.Uc.bind(Jb),getSegmentReference:Jb.get.bind(Jb),adjustSegmentDurations:Jb.qd.bind(Jb),getDuration:Jb.getDuration.bind(Jb),segmentIndex:Jb,segmentLookupStrategy:H,initSegmentReference:Cg,mimeType:fb,codecs:h,kind:O,th:Va.type,encrypted:Va.type===c.cj,keyId:Va.keyId,language:G,originalLanguage:m||_.rg,label:t,type:l,primary:p,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:F?F.frameRate:void 0,width:F?F.width:void 0,height:F?
|
|
45
|
+
F.height:void 0,bandwidth:void 0,roles:[],channelsCount:v,spatialAudio:z,closedCaptions:C,keyInfo:Va.keyInfo,T:ya,drmInfos:Va.drmInfos,ka:aa,kc:g.a,mf:g.f,ec:Wa,Je:La,duration:vb,groupId:n}});return da["return"](new gL(T))})},YL=function(a,b){var c;return _.I(function(d){if(1==d.a)return _.y(d,Promise.all(b.map(function(e){var f;return _.I(function(g){if(1==g.a)return _.y(g,mM(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},mM=function(a,
|
|
46
|
+
b){var c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){c=_.Y.Jl(b);d=_.lj(b,_.dc,void 0,{required:c});if(!d)return m["return"](null);e=_.Y.zd(a.w,d);return _.y(m,nM(a,e),2)}f=m.f;g=f.response;h=f.text;l=g.uri;return m["return"](EL(a,h,l,d))})},ZL=function(a,b){var c,d,e,f,g,h,l,m;return _.I(function(n){if(1==n.a){var p=new _.Ti(b.streams[0].mf);if(a.a.lowLatencyMode&&a.I&&a.I.Rg){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var t=q.a,v=t.length-1;q={Rl:q.position,Zm:t&&
|
|
47
|
+
0<t.length?v:null}}else q=null;if(t=q)q=t.Rl,t=t.Zm,v=_.Mk(p.a.toString()),v._HLS_msn=q.toString(),null===t&&v._HLS_part&&delete v._HLS_part,null!==t&&(v._HLS_part=t.toString()),q=_.Lk(v,!0),_.Wi(p,new _.$i(q))}c=p.toString();return _.y(n,nM(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.Sb();h=b.streams[0].mf;l=e.uri;h!==l&&(h=l,hL(b,h));m=EL(a,f,h,g);return n["return"]({stream:b,playlist:m})})},EL=function(a,b,c,d){a=QK(a.N,b,c);a.a=d;return a},oM=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.N(_.P,
|
|
48
|
+
4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},pM=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.lj(c,_.dc)})||null}).map(function(b){return _.hj(b)});if(1<(new Set(a)).size)throw new _.N(_.P,4,4044,"Unexpected change in file format.");},qM=function(a,b,c){a=_.Y.Pb(a.X,_.Pa);if(1<a.length)throw new _.N(_.P,4,4020);a=a[0];if(!a)return null;var d=_.mj(a,_.dc),e=_.Y.zd(b,d);b=_.Y.yi(a,null,!0);return new _.GD(function(){return[e]},
|
|
49
|
+
b.ya,b.la,c)},sM=function(a,b,c,d,e,f,g){var h=[],l={};b=_.w(rM(b.f));for(var m=b.next();!m.done;l={Ze:l.Ze},m=b.next()){var n=m.value;m=n.Ph;n=n.item;var p=0===m,q=p?a:h[h.length-1],t=p?d:q.endTime,v=Number(_.lj(n,_.Fa));v=t+v;p=_.Y.yi(n,p?null:q.la,p);q=_.lj(n,_.dc);q=_.Y.zd(g,q);l.Ze=q?[q]:[];t=new _.pj(c,t,v,function(z){return function(){return z.Ze}}(l),p.ya,p.la,e,f,!1,null,null,null,null);if("YES"===_.lj(n,"INDEPENDENT")||0===m)t.h=!0;h.push(t)}return h},tM=function(a,b,c,d,e,f,g,h,l,m,n){var p=
|
|
50
|
+
c.X,q=c.a;0<_.Y.Pb(p,_.Pa).length&&(n=qM(c,l,g));var t=null!=q,v=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={ya:0,la:null};var z=null;t?(c=_.Y.Rm(p).duration,a=e+c,q=_.Y.zi(p,b?b.la:null)):(b=sM(b,c,d,e,f,g,l),a=b[b.length-1].endTime,z=b);h=h===_.ve?_.Y.Xm(p):null;d=new _.pj(d,e,a,function(){return v},q.ya,q.la,f,g,!1,null,h?h.Pd:null,h?h.fe:null,h?h.durationPerTile:null,z,n);d.ka=m;return d},lM=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v,z,C,F;return _.I(function(G){switch(G.a){case 1:return e=
|
|
51
|
+
_.Y,f=uM,g=vM,h=b.a,l=b.T,m=e.il(b.X,_.Qa),n=[],!HL(a)&&g.jj(l),_.y(G,wM(a,b.f,h,l,m,c,d),2);case 2:p=G.f,q=m,t=f.Cn(l),v=0;case 3:if(!(v<t.length)){G.F(5);break}z=t[v];C=n[n.length-1]||null;return _.y(G,xM(a,b.f,z,q,p,c,d,C,t.length),6);case 6:F=G.f;n.push(F);q+=z.length;v++;G.F(3);break;case 5:return oM(n),G["return"](n)}})},wM=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,v,z,C,F,G;return _.I(function(B){if(1==B.a){h=d[0];if(null!=a.A)return B["return"](a.A);if(!HL(a)&&a.B)try{var H=a.f.get(c),O=H?
|
|
52
|
+
mL(H,e)||null:null;if(!O)throw new _.N(_.P,4,4030,"Segment not found in pervious playlist update.");l=O.startTime+O.Da;a.g.debug(AK+l+".");a.A=l;return B["return"](l)}catch(T){if(m=a.f.get(c))n=m.streams[0].T[0].position,B=m.streams[m.streams.length-1].T,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 _.N(_.P,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});
|
|
53
|
+
}return _.y(B,yM(a,f,g,h),2)}if(3!=B.a)return v=B.f,z=vM.Vm(h,a.w,v),C=qM(h,b,z.keyInfo),F=_.Y.If(z.keyInfo,e),_.y(B,zM(a,C,h,F,v,g),3);G=B.f;a.g.debug(AK+G+".");a.A=G;return B["return"](G)})},xM=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,t,v,z,C,F,G,B,H,O,T,da,aa,ya,Va,fb,Wa,La;return _.I(function(vb){switch(vb.a){case 1:return m=_.Y,n=vM,p=c[0],q=null==h,pM(c),_.y(vb,yM(a,f,g,p),2);case 2:t=vb.f;v=n.Qm(c,a.w,t,h?h.Nl:null,1===l);z=v[v.length-1];C=vM.pa(v);F=qM(p,b,C.keyInfo)||(h?h.Al:null);G=_.Y.If(C.keyInfo,
|
|
54
|
+
d);B=p.ka;if(q){H=e;vb.F(3);break}return _.y(vb,AM(a,B,F,p,d,G,t,g),4);case 4:H=vb.f;case 3:O=H;T=[];for(da=0;da<c.length;da++)if(aa=c[da],ya=T[T.length-1]||null,Va=0===da?0:ya.endTime,fb=d+da,Wa=m.If(C.keyInfo,fb),La=tM(a,ya,aa,fb,Va,O,Wa,f,b,B,F))F=La.initSegment,T.push(La);return vb["return"]({T:T,Pk:C,Nl:z,mimeType:t,endTime:T[T.length-1].endTime,ka:B,Al:F})}})},RL=function(a,b){b.forEach(function(c){var d=a.f.get(c.a);uM.pj(c,d,!HL(a))});uM.Kk(b)},AM=function(a,b,c,d,e,f,g,h){var l;return _.I(function(m){if(1==
|
|
55
|
+
m.a)return a.J.has(b)?m["return"](a.J.get(b)):_.y(m,zM(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.J.set(b,l);return m["return"](l)})},zM=function(a,b,c,d,e,f){var g;return _.I(function(h){if(null==c.a)return h["return"](0);g=_.Y.Hk(c,d);return h["return"](fL(a.P,b,g,e,f,null!=d))})},bM=function(a,b){if(1===b.length)return b[0];var c=_.gj(a,b);if(null!=c)return c;throw new _.N(_.P,4,4025,{codecList:b});},yM=function(a,b,c,d){var e,f,g;return _.I(function(h){e=
|
|
56
|
+
d.a;g=(f=_.Y.Wa(d.X,_.Pa))?_.mj(f,_.dc):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=_.jj(f,b,c))return n["return"](g);h=_.Yj([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.y(n,a.xf(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.N(_.P,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.split(";")[0])})},nM=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=
|
|
57
|
+
_.Yj([b],a.a.attemptParameters),c.type=1,_.y(f,a.xf(c),2);d=f.f;e="";try{e=_.R.aa(d.data)}catch(g){throw new _.N(_.P,4,4042);}e=_.R.fi(e);e=e.trim();return f["return"]({text:e,response:d})})},HL=function(a){return a.l===_.kc},IL=function(a,b){_.Y.Kl(b,function(c,d){_.qE(a,c.T,d.startTime)});_.iE(a.a,b[0].startTime,b[b.length-1].endTime)},CM=function(){},kM={Yi:_.bD,$i:_.aD},jM={cj:DK,eo:EK,NONE:_.Te},rM=function DM(a){var c,d,e,f,g,h;return _.wh(DM,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.w(a),g=
|
|
58
|
+
f.next());if(5!=l.a){if(g.done)return-1===c?l.F(0):_.y(l,{Ph:c,en:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.y(l,{Ph:c,item:e,en:d,next:h},5):l.F(5)}c++;d=e;e=h;g=f.next();return l.F(2)})};_.u=WK.prototype;_.u.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};_.u.has=function(a){return this.a.has(a)};_.u.get=function(a){return this.a.get(a)||null};_.u.values=function(){return Array.from(this.a.values())};
|
|
59
59
|
_.u.clear=function(){this.f.clear();this.a.clear()};
|
|
60
|
-
var
|
|
61
|
-
}return 0},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
b,c))&&d.type===
|
|
65
|
-
_.Te}))return a[0];a=a.filter(function(c){return c.type===
|
|
66
|
-
b,c)})},
|
|
67
|
-
|
|
68
|
-
f){return e.concat(f)},[]).reverse()[0]||null,type:
|
|
60
|
+
var uM={Kk:function(a){var b=uM.Yk(a),c=uM.Ml(a);a.forEach(function(d){var e=d.T,f=e.findIndex(function(h){return h.ka===b}),g=e.findIndex(function(h){return h.ka===c+1});-1===g&&(g=e.length);d.T=e.slice(f,g)})},pj:function(a,b,c){b=uM.hl(a,b,c);a=_.w(a.T||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.cd(c.X,_.Ka)&&b++,c.ka=b},hl:function(a,b,c){var d=_.Y.Wa(a.X,_.Ma);if(d)return Number(d.value);d=uM.Dl(b);if(c&&d)try{return uM.zl(a,b)}catch(e){throw new _.N(_.P,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");
|
|
61
|
+
}return 0},Dl:function(a){return 0<uM.kl(a)},Cn:function(a){if(0===a.length)return[];var b=[],c=[];a=_.w(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.cd(d.X,_.Ka)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},kl:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].T;return a[a.length-1].ka},zl:function(a,b){var c=_.Y.Wa(a.X,_.Qa);if(!c)throw uM.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(wK);c=Number(c.value);var d=
|
|
62
|
+
mL(b,c);if(!d)throw uM.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(wK);return d.ka},Ml:function(a){a=a.map(function(b){return b.T[b.T.length-1].ka});return Math.min.apply(Math,_.ah(a))},Yk:function(a){a=a.map(function(b){return b.T[0].ka});return Math.max.apply(Math,_.ah(a))}};uM.g=new _.K("clpp.hls.DiscontinuityUtils");var EM={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Dg)throw new _.N(_.P,4,4041);if(_.mj(a,yK)===zK)throw new _.N(_.P,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.FD(_.Kd,[{initDataType:_.Zf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":cL,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":cL,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.mj(a,yK);if(!aL.includes(b))return bL.error("Widevine in HLS is only supported with [",
|
|
63
|
+
aL.join(", "),"], not",b),null;b=_.mj(a,_.dc);b=_.av(b);b=_.zj(b.data);b=_.FD(_.Pd,[{initDataType:_.rd,initData:b}],"");if(a=_.lj(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},aL=["SAMPLE-AES",zK],bL=new _.K("clpp.hls.DrmParser");var vM={Vm:function(a,b,c){return vM.eg(a.X,b,c)||{type:_.Te,keyInfo:null,drmInfos:[],keyId:null}},Qm:function(a,b,c,d,e){if(a.slice(1).some(vM.Nh))throw new _.N(_.P,4,4046,e?"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not at the beginning of the playlist.":"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not marked by an EXT-X-DISCONTINUITY tag and is not at the beginning of the playlist.");if(_.Y.cd(a[0].X,_.Oa)||null===d){if((d=vM.eg(a[0].X,
|
|
64
|
+
b,c))&&d.type===EK){if(1<vM.oh(a))throw new _.N(_.P,4,4046,BK+((e?"playlist":"discontinuity")+"."));return[d]}a=vM.wi(a,b,c);return 0===a.length?[{type:_.Te,keyInfo:null,drmInfos:[],keyId:null}]:a}b=vM.wi(a,b,c);if(d.type===_.Te||d.type===DK)return[d].concat(_.ah(b));if(0<vM.oh(a))throw new _.N(_.P,4,4046,BK+((e?"playlist":"discontinuity")+"."));return[d]},pa:function(a){if(0===a.length)return{type:_.Te,keyInfo:null,drmInfos:[],keyId:null};if(a.some(function(c){return c.type===EK})||a.every(function(c){return c.type===
|
|
65
|
+
_.Te}))return a[0];a=a.filter(function(c){return c.type===DK});var b=_.zi(a.flatMap(function(c){return c.drmInfos}));return{keyInfo:null,keyId:a[a.length-1].keyId,type:DK,drmInfos:b}},jj:function(a){a=vM.xh(a);if(a.some(function(b){return vM.Nh(b)})&&1<a.length)throw new _.N(_.P,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},Nh:function(a){return _.Y.Pb(a.X,_.Oa).some(function(b){return"AES-128"===_.lj(b,yK)})},wi:function(a,b,c){return vM.xh(a).map(function(d){return vM.eg(d.X,
|
|
66
|
+
b,c)})},oh:function(a){return a.filter(function(b){return _.Y.cd(b.X,_.Oa)}).length},xh:function(a){return a.filter(function(b){return _.Y.cd(b.X,_.Oa)})},eg:function(a,b,c){a=_.Y.Pb(a,_.Oa);if(0===a.length)return null;var d=_.mj(a[0],yK);if(1===a.length){if("NONE"===d)return{type:_.Te,keyInfo:null,drmInfos:[],keyId:null};if("AES-128"===d)return a=a[0],d=_.lj(a,"IV",""),{type:EK,keyInfo:{method:"AES-128",url:_.Y.zd(b,_.mj(a,_.dc)),iv:d?_.Mj((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(function(e){return _.mj(e,
|
|
67
|
+
yK)});if(!b.every(function(e){return"SAMPLE-AES"===e})&&!b.every(function(e){return e===zK}))throw vM.g.warn("EXT-X-KEY methods "+b.join(", ")+" are incompatible."),new _.N(_.P,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(function(e){var f=_.lj(e,"KEYFORMAT","identity"),g=EM[f]||null;(e=g?g(e,c):null)||vM.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.N(_.P,4,4026);return{keyInfo:null,keyId:b.map(function(e){return e.keyIds}).reduce(function(e,
|
|
68
|
+
f){return e.concat(f)},[]).reverse()[0]||null,type:DK,drmInfos:b}},zo:function(){return{type:_.Te,keyInfo:null,drmInfos:[],keyId:null}}};vM.g=new _.K("clpp.hls.EncryptionUtils");_.u=gL.prototype;_.u.length=function(){return this.streams.length};_.u.jl=function(){return this.streams[0].groupId};_.u.xd=function(){return this.streams[0].type};_.u.dl=function(){return this.streams[0].codecs.split(",")};_.u.Sb=function(){return this.streams[0].kc};_.u.vn=function(a){this.streams.forEach(function(b){b.codecs=a.join(",")})};oL.prototype.length=function(){return this.a.length};_.u=BL.prototype;_.u.configure=function(a){this.a=a;this.P.a=a};_.u.setCurrentVariant=function(a){this.j=a};_.u.start=function(a,b){var c=this,d,e,f,g,h;return _.I(function(l){if(1==l.a){if(c.L)throw Error("start() may be called only once!");c.L=!0;c.D=b;return _.y(l,nM(c,a),2)}if(3!=l.a)return d=l.f,e=d.response,f=d.text,c.w=e.uri,_.y(l,JL(c,f),3);g=l.f;c.B=g;h=c.G;c.h&&0<h&&c.h.ea(h);return l["return"](g)})};_.u.requestStop=function(){this.K=!0};
|
|
69
69
|
_.u.stop=function(){this.h&&(this.h.stop(),this.h=null);var a=[];this.C&&(a.push(this.C.destroy()),this.C=null);this.f.clear();this.B=this.a=this.D=this.j=null;this.o.clear();return Promise.all(a)};
|
|
70
|
-
_.u.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.B;if(
|
|
71
|
-
g);m=
|
|
72
|
-
_.u.
|
|
70
|
+
_.u.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.B;if(HL(a)||!b)return p["return"]();c=b.presentationTimeline;"LIVE"===a.l&&(a.A=null);d=Array.from(a.f.values());a.a.lowLatencyMode&&null!==a.j&&(e=CL(a),d=d.filter(function(q){return e.includes(q.Sb())}));return _.y(p,$L(a,d),2);case 2:return f=p.f,g=f.map(function(q){return q.playlist}),RL(a,g),_.y(p,ML(a,f),3);case 3:h=p.f;qL(b.periods,h).forEach(function(q){a.D.filterNewPeriod(q)});GL(a,h);l=WL(a,
|
|
71
|
+
g);m=XL(a,g,l);b.cues=DL(a,m);sL(b.periods,h);IL(c,h);if(n=_.Y.xl(g))!0!==a.a.keepTimelineLive&&(a.l=_.kc,_.mE(c,!0),c.f=h[h.length-1].endTime),a.h.stop(),a.h=null;if(a.D.onUpdate)a.D.onUpdate(b);if(n&&a.D.onTurnedStatic)a.D.onTurnedStatic();if(!a.K){p.F(4);break}return _.y(p,a.stop(),4);case 4:return p["return"](b)}})};
|
|
72
|
+
_.u.Vb=function(){var a=this,b,c;return _.I(function(d){if(1==d.a){a.g.debug(_.SC);if(!a.D)return d["return"]();_.D(d,2);return _.y(d,a.update(),4)}if(2!=d.a)return a.h&&0<a.G&&a.h.ea(a.G),_.oh(d,0);b=_.E(d);if(!(b instanceof _.N))throw b;a.D&&(a.D.onError(b),c=b,1===c.severity&&a.h&&a.h.ea(.1));_.A(d)})};_.u.xf=function(a){if(!this.C)throw new _.N(_.P,7,7001);a=this.D.networkingEngine.fetch(a);_.kk(this.C,a);return a.U};_.x(CM,_.tt);CM.prototype.f=function(){_.su.m3u8=BL;_.qu[_.Yl]=BL;_.qu[CK]=BL};CM.prototype.a=function(){_.iF("m3u8");_.jF(_.Yl);_.jF(CK)};CM.prototype.id=function(){return"hls"};_.J("clpp.hls.HlsComponent",CM);};
|
|
73
73
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
74
74
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
75
75
|
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=_.te,a.a.on(c,_.Sd,function(d){return
|
|
6
|
-
a.m.getTrackManager().xa())&&a.language&&a.language.toLowerCase()},
|
|
7
|
-
_.J("clpp.hlssmpte.HlsSmptePlugin",
|
|
2
|
+
var f=function(window){var hU=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.da(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.da(a)?a:null}},jU=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Sh;this.h=(a=_.dv(_.Xc))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;iU(this)},iU=function(a){a.a.one(a.m,_.Fe,function(){return kU(a)})},
|
|
3
|
+
kU=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Mc,function(d){return lU(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Ne}).forEach(function(d){lU(a,{track:d})});!mU(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."),nU(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
|
+
mU=function(a){return a.some(function(b){return b.kind===_.Ne})},nU=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.Ea(d)};a.a.on(b.textTracks,_.Mc,function(g){g.track.kind===_.Ne&&(a.a.off(b.textTracks,_.Mc,f),f())});c.Ea(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},lU=function(a,b){var c=b.track;c.kind===_.Ne&&(a.g.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.te,a.a.on(c,_.Sd,function(d){return oU(a,d)}))},oU=function(a,b){var c=pU(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 hU(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.R.$a(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)}}})},pU=function(a){return(a=
|
|
6
|
+
a.m.getTrackManager().xa())&&a.language&&a.language.toLowerCase()},qU=function(){this.a=null;this.f=!1},rU=function(){};jU.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x(qU,_.pv);qU.prototype.onPlayerCreated=function(){};qU.prototype.onContentWillLoad=function(a){if(this.f=_.wl()){var b=a.getConfiguration();b=_.M.bb(b.hlssmpte||{});_.M.Th(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.M.sa(b.timestampOffset)||(b.timestampOffset=0);this.a=new jU(a,b.patchMetadataTrack,b.timestampOffset)}};qU.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.F(0);a.a=null;_.A(b)})};qU.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.J("clpp.hlssmpte.HlsSmptePlugin",qU);qU.Id="hlssmpte";rU.prototype.create=function(){return new qU};_.Qs(new rU);};
|
|
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));}
|