@castlabs/prestoplay 6.12.0 → 6.14.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 +54 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -6
- package/cjs/cl.cast.js +110 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +518 -517
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +63 -52
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +68 -67
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +275 -272
- package/cjs/cl.muxdata.js +15 -14
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +26 -24
- package/cjs/cl.tizen.js +69 -69
- package/cjs/cl.ttml.js +28 -28
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +18 -18
- package/cjs/polyfill.min.js +26 -23
- 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 +428 -425
- package/cl.crypto.js +9 -9
- package/cl.dash.js +67 -67
- package/cl.externs.js +63 -52
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +69 -69
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +243 -241
- package/cl.muxdata.js +13 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/package.json +4 -4
- package/typings.d.ts +135 -30
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
|
-
_.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
|
-
_.H("clpp.freewheel.FreeWheelPlugin",
|
|
8
|
-
_.r.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.r.getSkipTimeOffset=function(){return 0};_.r.
|
|
9
|
-
_.r.Bb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.Ab=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.
|
|
10
|
-
_.r.getPodIndex=function(){switch(this.
|
|
11
|
-
_.r.getWrapperCreativeIds=function(){return[]};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.E(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{
|
|
16
|
-
_.u(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.xl.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Bl.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.Al.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Tk.bind(a));a.h.on(a.m,_.
|
|
18
|
-
_.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.dispose=function(){var a=this;return _.E(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);
|
|
19
|
-
_.r.xl=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
|
|
20
|
-
void 0));this.l.resolve()};_.r.Bl=function(a){
|
|
21
|
-
_.r.Tk=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:
|
|
22
|
-
_.
|
|
23
|
-
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.
|
|
24
|
-
_.r.
|
|
25
|
-
|
|
2
|
+
var f=function(window){var fP="clpp-freewheel",gP="clpp.freewheel.AdsManagerFactory",hP="freewheel",iP=function(){this.f=this.a=null},jP=function(){},kP=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""}},lP=function(a,b,c){this.h=a;this.f=b;this.a=c},mP=function(a){this.a=a},nP=function(a){this.g=new _.K("clpp.freewheel.AdsManager");this.m=a;this.h=new _.Eh;this.w=new tv.freewheel.SDK.AdManager;
|
|
3
|
+
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.wj;this.j=null},oP=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.Wf&&b.push("serverUrl");typeof a.profileId!==_.Wf&&b.push("profileId");typeof a.videoAssetId!==_.Wf&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.P(1,9,12001,{missingKeys:b.join(", ")});},pP=function(){var a,b,c,d;return _.E(function(e){if(1==e.a)return a=new _.As,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)})},sP=function(a){return _.E(function(b){if(a.B.length)return qP(a),a.f=a.B.shift(),a.f.play(),b.F(0);rP(a);return _.x(b,a.m.a.play(),0)})},tP=function(a){a.A.length?(qP(a),a.f=a.A.shift(),a.f.play()):rP(a)},qP=function(a){var b=a.m.nc(hP).Rc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
|
|
5
|
+
a.a.registerVideoDisplayBase(fP),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},rP=function(a){var b=a.m.nc(hP).Rc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},uP=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 lP(a.a,c,d)});a.m.trigger(new _.L(b,d))},vP=function(){this.Xc=new _.K(gP)};_.w(iP,_.rt);_.r=iP.prototype;
|
|
6
|
+
_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.qp(_.Yd,{id:fP}),this.f=_.qp(_.sg,{"class":_.wd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.P(1,9,12E3))};_.r.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.r.id=function(){return hP};_.r.Rc=function(){return this.a};_.r.Yj=function(){return this.f};
|
|
7
|
+
_.H("clpp.freewheel.FreeWheelPlugin",iP);iP.prototype.getAdVideo=iP.prototype.Yj;iP.prototype.getAdContainer=iP.prototype.Rc;iP.Id=hP;iP.AD_CONTAINER_ID=fP;jP.prototype.create=function(){return new iP};_.nq(new jP);_.r=lP.prototype;_.r.xb=function(){return"FreeWheel AdManager SDK"};_.r.yb=function(){return tv.freewheel.SDK.version};_.r.Eb=function(){return 0};_.r.getId=function(){return this.a?this.a.getAdId():""};_.r.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.Wf?a:""};_.r.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.r.getAdSystem=function(){return""};_.r.getAdvertiserName=function(){return""};_.r.getTitle=function(){return""};
|
|
8
|
+
_.r.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.r.getSkipTimeOffset=function(){return 0};_.r.rc=function(){return!1};_.r.Rb=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.Bb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.Ab=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.ob=function(){return 0};_.r.cb=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.cb()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.r.Sb=function(){switch(this.cb()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.r.Tb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.r.Db=function(){return this.f.getAdCount()};_.r.getWrapperAdIds=function(){return[]};_.r.getWrapperAdSystems=function(){return[]};
|
|
11
|
+
_.r.getWrapperCreativeIds=function(){return[]};lP.prototype.getWrapperCreativeIds=lP.prototype.getWrapperCreativeIds;lP.prototype.getWrapperAdSystems=lP.prototype.getWrapperAdSystems;lP.prototype.getWrapperAdIds=lP.prototype.getWrapperAdIds;lP.prototype.getSequenceLength=lP.prototype.Db;lP.prototype.getPositionInSequence=lP.prototype.Tb;lP.prototype.getPodTimeOffset=lP.prototype.Sb;lP.prototype.getPodIndex=lP.prototype.getPodIndex;lP.prototype.getPodType=lP.prototype.cb;
|
|
12
|
+
lP.prototype.getMediaBitrate=lP.prototype.ob;lP.prototype.getMediaHeight=lP.prototype.Ab;lP.prototype.getMediaWidth=lP.prototype.Bb;lP.prototype.getMediaUrl=lP.prototype.getMediaUrl;lP.prototype.getClickThroughUrl=lP.prototype.Rb;lP.prototype.isBumper=lP.prototype.rc;lP.prototype.getSkipTimeOffset=lP.prototype.getSkipTimeOffset;lP.prototype.getDuration=lP.prototype.getDuration;lP.prototype.getTitle=lP.prototype.getTitle;lP.prototype.getAdvertiserName=lP.prototype.getAdvertiserName;
|
|
13
|
+
lP.prototype.getAdSystem=lP.prototype.getAdSystem;lP.prototype.getApiFramework=lP.prototype.getApiFramework;lP.prototype.getCreativeId=lP.prototype.getCreativeId;lP.prototype.getId=lP.prototype.getId;lP.prototype.getTechnology=lP.prototype.Eb;lP.prototype.getAdManagerVersion=lP.prototype.yb;lP.prototype.getAdManagerName=lP.prototype.xb;mP.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()}})};mP.prototype.Vb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};mP.prototype.pb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
14
|
+
mP.prototype.hasPostroll=mP.prototype.pb;mP.prototype.hasPreroll=mP.prototype.Vb;mP.prototype.getCuePoints=mP.prototype.getCuePoints;_.r=nP.prototype;
|
|
15
|
+
_.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.E(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{oP(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!==_.Wf&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.x(m,pP(),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
|
+
_.u(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,kP(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Te&&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=_.u(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.xl.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Bl.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.Al.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Tk.bind(a));a.h.on(a.m,_.eg,a.Ui.bind(a));a.h.on(a.m,_.Tf,a.Ti.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.r.start=function(){var a=this;return _.E(function(b){return _.x(b,sP(a),0)})};
|
|
18
|
+
_.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.dispose=function(){var a=this;return _.E(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);rP(a);a.a&&(a.a.dispose(),a.a=null);_.y(b)})};
|
|
19
|
+
_.r.xl=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 mP(this.a)})),this.j=new _.ys(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.nc(hP).f);else this.m.onError(new _.P(1,9,10003,{errorType:0},
|
|
20
|
+
void 0));this.l.resolve()};_.r.Bl=function(a){uP(this,_.uc,a);this.j.start()};_.r.Al=function(a){this.f=null;a=a.slot;uP(this,_.vc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:sP(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:rP(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:tP(this)}};
|
|
21
|
+
_.r.Tk=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:uP(this,_.Hc,a);uP(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:uP(this,_.Ic,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:uP(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:uP(this,_.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:uP(this,_.Jc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:uP(this,_.yc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:uP(this,
|
|
22
|
+
_.xc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:uP(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:uP(this,_.Fc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:uP(this,_.Gc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:uP(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:uP(this,_.Ec,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.P(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]}))}};_.r.Ui=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();qP(this);this.f.play()}}};
|
|
24
|
+
_.r.Ti=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Vo:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Uo:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Oo:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);tP(this);break;case _.Ho:case _.So:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};nP.prototype.getPosition=nP.prototype.getPosition;nP.prototype.setVolume=nP.prototype.setVolume;
|
|
25
|
+
nP.prototype.getVolume=nP.prototype.getVolume;nP.prototype.skip=nP.prototype.skip;nP.prototype.pause=nP.prototype.pause;nP.prototype.resume=nP.prototype.resume;nP.prototype.start=nP.prototype.start;vP.prototype.name=function(){return gP};vP.prototype.ba=function(a,b){return a.namespace()===_.Cd?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.Xc.warn("FreeWheel SDK is not loaded."),!1)};vP.prototype.create=function(a){return new nP(a)};vP.prototype.create=vP.prototype.create;vP.prototype.isSupported=vP.prototype.ba;vP.prototype.name=vP.prototype.name;_.np(new vP);};
|
|
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,71 +1,72 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
d[0].a)throw new _.P(_.Q,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.W=c;this.S=1===b?d:null},
|
|
4
|
-
value:b}}).filter(Boolean);return new Map(a.map(function(b){return[b.name,b.value]}))},
|
|
5
|
-
!_.Y.$g(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.P(_.Q,4,4015);return 0===
|
|
6
|
-
g));e++}}a.a=
|
|
7
|
-
d=
|
|
8
|
-
9]?!0:!1},
|
|
9
|
-
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}}
|
|
10
|
-
!1),e=0,f=0;e=
|
|
11
|
-
_.
|
|
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 _.P(_.Q,4,4030,
|
|
13
|
-
|
|
14
|
-
q.data));case 4:if(d!==_.
|
|
15
|
-
n.f,n["return"](h);case 2:l=_.
|
|
16
|
-
a},
|
|
17
|
-
b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},
|
|
18
|
-
b.length;)a.push(b[c]),c++},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
b;c.te=c.Zb+b})},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
id:G.id,type:_.
|
|
26
|
-
c.
|
|
27
|
-
t.stream.streams[0];t=Object.assign({},{
|
|
28
|
-
l.filter(function(q){return q.streams[0].type===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,
|
|
29
|
-
_.x(t,
|
|
30
|
-
c=_.Y.
|
|
31
|
-
c)}))},
|
|
32
|
-
f.a){if(0===b.length)return f["return"](new Map);d=[
|
|
33
|
-
D,c,d,e)}),_.x(z,Promise.all(q),3);t=z.f;t.splice(g,0,p);v=t.reduce(_.
|
|
34
|
-
[],v={audio:n?t:[],video:p?t:[]},a.g.debug("Guessing stream type for",h.toString()),D=!1,G=l.a,F=v.audio.find(function(
|
|
35
|
-
O)return M["return"](null);v[z]=[O];z===f.AUDIO&&c&&t.forEach(function(
|
|
36
|
-
(b.push(m),d.add(l)))}}return b},
|
|
37
|
-
m,n,p,q,t,v,z,D,G,F,
|
|
38
|
-
De:null}),2)}O=M.f;return M["return"](O)})}))})},
|
|
39
|
-
b){var c=_.
|
|
40
|
-
|
|
41
|
-
n=g.
|
|
42
|
-
null;return{id:a.H++,originalId:v,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:
|
|
43
|
-
width:F?F.width:void 0,height:F?F.height:void 0,bandwidth:void 0,roles:[],channelsCount:z,spatialAudio:D,closedCaptions:G,keyInfo:
|
|
44
|
-
|
|
45
|
-
Tl:t&&0<t.length?v:null}}else q=null;if(t=q)q=t.Mk,t=t.Tl,v=_.
|
|
46
|
-
_.
|
|
47
|
-
4,4044,"Unexpected change in file format.");},
|
|
48
|
-
_.dc);q=_.Y.rd(g,q);l.Fe=q?[q]:[];t=new _.
|
|
49
|
-
q.
|
|
50
|
-
break;case 5:return
|
|
51
|
-
t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+t+"."),b,m);throw new _.P(_.Q,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.x(
|
|
52
|
-
return _.E(function(
|
|
53
|
-
|
|
54
|
-
b,g,e,f,null!=d))})},
|
|
55
|
-
n.f;m=l.headers["content-type"];if(!m)throw new _.P(_.Q,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.split(";")[0])})},
|
|
56
|
-
function(c,d){_.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
_.r.
|
|
67
|
-
_.r.
|
|
68
|
-
|
|
2
|
+
var f=function(window){var $E="Could not parse MP4 segment start time.",aF="Failed to infer discontinuity number",bF="Guessing audio-only",cF="METHOD",dF="SAMPLE-AES-CTR",eF="Setting playlist start time to ",fF="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",gF="application/vnd.apple.mpegurl",iF="sample",jF="whole-segment",EF=function(a){if(1>a.a)throw _.fm();--a.a},FF=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.P(_.Q,4,4043,"Media playlist must have at least one segment!");if(null==
|
|
3
|
+
d[0].a)throw new _.P(_.Q,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.W=c;this.S=1===b?d:null},GF=function(a,b,c){c=void 0===c?[]:c;this.W=b;this.a=a;this.f=c;this.ca=-1},HF=function(a){a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value,b.startsWith("#EXT-")&&(b=_.mj(0,b),_.Wt.has(b.name)))return 1;return 0},IF=function(a){a=_.Y.Qb(a,"EXT-X-DEFINE").map(function(b){var c=_.Ii(b,"NAME");if(!c)return null;b=_.Ji(b,"VALUE");return{name:c,
|
|
4
|
+
value:b}}).filter(Boolean);return new Map(a.map(function(b){return[b.name,b.value]}))},JF=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.P(_.Q,4,4044,"Undefined variable '"+d+"'");return e})},KF=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=JF(d.value,b)})})},LF=function(a,b,c){KF(a,c);b.forEach(function(d){KF(d.W,c)})},MF=function(){this.f=0;this.a=new Map},PF=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&
|
|
5
|
+
!_.Y.$g(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.P(_.Q,4,4015);return 0===HF(b)?NF(a,b,c):OF(a,b,c)},OF=function(a,b,c){for(var d=[],e=1;e<b.length;){var f=QF(a,b[e]);if(_.Xt.has(f.name))break;d.push(f);e++}b=RF(a,c,b.slice(e));e=b.S;d=d.concat(b.W);a=SF(a,d);LF(d,e,a);return new FF(c,1,d,b.S)},NF=function(a,b,c){for(var d=[],e=1;e<b.length;e++){var f=QF(a,b[e]);d.push(f);if(f.name===_.Ya){var g=b[e+1];if(!g)throw new _.P(_.Q,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Ki(_.dc,
|
|
6
|
+
g));e++}}a.a=IF(d);LF(d,[],a.a);return new FF(c,0,d)},RF=function(a,b,c){var d=[],e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=QF(a,h),_.Wt.has(h.name)||_.Zt.has(h.name)?d.push(h):_.Yt.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Va&&"PART"===_.Ii(h,_.bc)&&g.push(h):f.push(h)):_.Y.$g(h)||(h=_.Y.rd(b,h.trim()),e.push(new GF(h,f,g)),f=[],g=[])});0<g.length&&e.push(new GF(null,f,g));return{S:e,W:d}},QF=function(a,b){return _.mj(a.f++,b)},SF=function(a,b){var c=_.Y.Qb(b,"EXT-X-DEFINE"),
|
|
7
|
+
d=IF(b);c.map(function(e){return _.Ii(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.P(_.Q,4,4044,"Cannot import variable '"+e+"' as it is not defined in the master playlist");d.set(e,f)});return d},TF=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},UF=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+
|
|
8
|
+
9]?!0:!1},VF=function(){this.a=new Map;this.f=new Map},WF=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 _.P(_.Q,4,4030);}UF(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"===
|
|
9
|
+
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}}UF(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},XF=function(a){for(;a.getPosition()<a.Ga()-1;){var b=a.getPosition();if(71===_.gm(a))return EF(a),b}return-1},YF=function(a){function b(){d.seek(e+188);f=_.gm(d);71!=f&&(d.seek(e+192),f=_.gm(d));71!=f&&(d.seek(e+204),f=_.gm(d));71!=f&&c();EF(d)}function c(){throw new _.P(_.Q,4,4030);}var d=new _.dm(new DataView(a),
|
|
10
|
+
!1),e=0,f=0;e=XF(d);0>e&&(_.tu.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.gm(d),71!=f&&c(),a=_.hm(d),8191===(a&8191))b();else if(a&16384)if(a=(_.gm(d)&48)>>4,0!=a&&2!=a||c(),3==a&&(a=_.gm(d),d.skip(a)),1!=_.W(d)>>8)b();else{d.skip(3);a=_.gm(d)>>6;0!=a&&1!=a||c();0==_.gm(d)&&c();a=_.gm(d);var g=_.hm(d),h=_.hm(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},ZF=function(a,b){var c=null,d=0;try{(new _.mm).L(_.Oe,_.nm).L(_.fg,
|
|
11
|
+
_.nm).L(_.Je,_.nm).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=g}if(c||!d)throw _.tu.error("Unable to find timescale in init segment!"),new _.P(_.Q,4,4030,$E,c);var e=0,f=!1;try{(new _.mm).L("moof",_.nm).L("traf",_.nm).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");
|
|
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 _.P(_.Q,4,4030,$E,c);return e},bG=function(a){var b=_.Ji(a,cF);if(!$F.includes(b))return aG.error("PlayReady in HLS is only supported with [",$F.join(", "),"], not",b),null;a=_.Ji(a,_.dc);b=_.et(a);a=null;b=_.Ui(b.data);try{a=_.tz(_.pn(b))}catch(c){a=b}return _.Cz(_.Pd,[{initDataType:_.rd,initData:a}],"")},cG=function(a){this.g=new _.K("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.oj()}},
|
|
13
|
+
eG=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,t;return _.E(function(v){switch(v.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.cd||d===_.bd)return v["return"](0);g=f;if(d!==_.ad){v.F(2);break}return _.x(v,dG(a,c,g),3);case 3:return h=v.f,l=_.Ui(h.data),UF(l)?v["return"](WF(l)):v["return"](YF(h.data));case 2:if(d!==_.ug&&d!==_.dd){v.F(4);break}m=[dG(a,c,g)];b&&m.push(dG(a,b,!0));return _.x(v,Promise.all(m),5);case 5:return n=v.f,p=n[0],q=n[1]||n[0],v["return"](ZF(p.data,
|
|
14
|
+
q.data));case 4:if(d!==_.tg){v.F(6);break}return _.x(v,dG(a,c,g),7);case 7:return t=v.f,v["return"](YF(t.data));case 6:if(!_.Iz((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.P(_.Q,4,4030);}})},dG=function(a,b,c){var d,e,f,g,h,l,m;return _.E(function(n){switch(n.a){case 1:return d=b.f(),e=_.eA(b.Sa(),b.wa,b.wa+2048-1,a.a.attemptParameters),e.type=2,f=_.eA(b.Sa(),b.wa,b.ia,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.A(n,2),g=c?f:e,_.x(n,a.f(g),4);case 4:return h=
|
|
15
|
+
n.f,n["return"](h);case 2:l=_.C(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]);_.A(n,5);return _.x(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.C(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.P(_.Q,4,4030,"Failed to fetch the media segment.");}})},fG=function(a){this.streams=
|
|
16
|
+
a},gG=function(a,b){a.streams.forEach(function(c){c.Pe=b})},hG=function(a,b){a.streams.forEach(function(c){c.width=b})},iG=function(a,b){a.streams.forEach(function(c){c.height=b})},jG=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},kG=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},lG=function(a,b){var c=a.streams.find(function(d){d=d.S;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.S.find(function(d){return d.position===b})||null},mG=function(a,
|
|
17
|
+
b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},nG=function(a){this.a=a},oG=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},pG=function(a,b){var c=new Set(a.map(function(d){return d.ca}));return b.filter(function(d){return!c.has(d.ca)})},sG=function(a,b){for(;a[0].ca<b[0].ca;)a.splice(0,1);var c=a[0],d=b[0];qG(c,d)||rG(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&!qG(c,d)&&rG(c,d);for(c=e+1;c<
|
|
18
|
+
b.length;)a.push(b[c]),c++},tG=function(a,b){var c=a[a.length-1],d=b.findIndex(function(f){return f.ca===c.ca}),e=b[d];qG(c,e)||rG(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},yG=function(a,b,c,d){var e=a[0].length();e=TF(e).map(function(f){var g=oG(a,f)||[],h=mG(b,f)||[];f=mG(c,f)||[];var l=_.Og(uG(g)).concat(_.Og(h),_.Og(f)).filter(Boolean);vG(l);var m=l[0];l=m.ca;m=m.duration;return{variants:g,textStreams:h,thumbStreams:f,startTime:0,id:"P"+l,endTime:m,duration:m,ca:l}});d&&wG(e[0]);xG(e);return e},
|
|
19
|
+
uG=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},wG=function(a){var b=uG(a.variants)[0].S[0].ya;a.startTime+=b;a.endTime+=b},xG=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},qG=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},rG=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;zG(a.variants,b.variants);
|
|
20
|
+
AG(_.Y.Ae(a),_.Y.Ae(b))},zG=function(a,b){var c=new Map(a.map(function(d){return[_.Y.xg(d),d]}));b.forEach(function(d){c.get(_.Y.xg(d)).drmInfos=d.drmInfos})},AG=function(a,b){var c=new Map(a.map(function(d){return[d.Kb,d]}));b.forEach(function(d){var e=c.get(d.Kb);e.S=d.S;e.segmentIndex.replace(d.S);e.Zb=d.Zb;e.te=d.te;e.duration=d.duration;e.Bg=d.Bg;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},vG=function(a){var b=BG(a);a.forEach(function(c){_.$z(c.segmentIndex,b);c.duration=
|
|
21
|
+
b;c.te=c.Zb+b})},BG=function(a){var b=Infinity;_.Y.Oj(a).forEach(function(c){b=Math.min(b,c.duration)});return b},CG=function(){var a=this;this.a=this.D=null;this.H=1;this.f=new VF;this.o="";this.J=new MF;this.G=0;this.h=null;this.j=new _.uk(function(){a.Hb()});this.l=_.lc;this.w=null;this.A=new _.Aj;this.B=null;this.g=new _.K("clpp.hls.HlsParser");this.C=new Map;this.K=new cG(this.Xe.bind(this));this.I=!1},DG=function(a){if(null===a.h)return[];a=a.h;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.Kb})},
|
|
22
|
+
IG=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,D,G,F,B;return _.E(function(I){if(1==I.a){c=_.fp;d=_.Y;e=EG(a,b,a.o,"");if(1===e.type){f=e.S[0].a;var O=_.Ei(f)||"";g=null!=_.Fi.video[O]?_.sg:null!=_.Fi.audio[O]?_.$c:null;h="";g===c.VIDEO?h="avc1.42E01E":g===c.AUDIO&&(h="mp4a.40.2");O=a.J;var M=a.o,ba=a.a.hlsDefaultCodecs||h,ha=[],qa=[];qa.push(new _.Ki(_.pa,"0"));qa.push(new _.Ki(_.dc,M));ba.length&&qa.push(new _.Ki(_.ta,ba));ha.push(new _.Hi(O.f++,_.Ya,qa));e=new FF(M,0,ha)}l=_.Y.Ol(e.W);return _.x(I,
|
|
23
|
+
FG(a,l),2)}m=I.f;n=m.periods;p=m.Dh;q=m.Rh;if(!a.D)throw new _.P(_.Q,7,7001);t=d.hk(n[0]);O=!0;M=null;ba=0;GG(a)||(O=!1,M=0,ba=t.delay);M=new _.fA(M,ba,!0,void 0,!!a.a.lowLatencyMode);M.j=O;M.l=O;HG(M,n);p&&(M.H={offsetDateTime:p-_.oA(M,0),seekRangeStartDateTime:p});v=M;if(!GG(a)){a.G=t.yc;ba=0;M=_.u(a.f.values());for(O=M.next();!O.done;O=M.next())ba=Math.max(ba,O.value.streams[0].Zb);for(M=0;95443.7176888889<=ba;)M+=95443.7176888889,ba-=95443.7176888889;if(M)for(a.g.debug("Offsetting live streams by",
|
|
24
|
+
M,"to compensate for rollover"),ba=_.u(a.f.values()),O=ba.next();!O.done;O=ba.next())O=O.value.streams[0],95443.7176888889>O.Zb?(a.g.debug("Offset applied to",O.type),O.segmentIndex.offset(M)):a.g.debug("Offset NOT applied to",O.type)}O=_.Y.jk(n);"LIVE"===a.l||"EVENT"===a.l?(O=Math.max(O,v.G),isNaN(a.a.availabilityWindowOverride)||(O=a.a.availabilityWindowOverride),v.w=O):a.l===_.lc&&(v.f=O);if(q)for(z=_.u(q),D=z.next();!D.done;D=z.next())G=D.value,F={schemeIdUri:G.schemeIdUri,Wa:G.Wa,value:"",startTime:G.startTime,
|
|
25
|
+
endTime:G.endTime,id:G.id,type:_.Mh,eventElement:null},a.D.onTimelineCueAdded(F);B={presentationTimeline:v,adaptedPeriods:_.Og(n).concat(),periods:n,offlineSessionIds:[],minBufferTime:0};a.g.debug("HLS playlist parsed",B);return I["return"](B)})},LG=function(a,b){var c,d,e,f,g,h,l,m;return _.E(function(n){if(1==n.a)return c=_.Y,_.x(n,JG(a,b),2);d=n.f;e=d.textStreams;f=d.thumbStreams;g=d.ii;h=a.w.periods[0].variants;a.a.lowLatencyMode&&null!==a.h&&(h=h.filter(function(p){return p.id===a.h.id}));l=
|
|
26
|
+
h.map(function(p){var q=c.Gg(p.audio,g),t=c.Gg(p.video,g);p=KG(a,q,t,p.bandwidth);if(!p)throw new _.P(_.Q,4,4047,{message:"Video and audio are encrypted in an incompatible way.",qn:t?t.Ub():void 0,audio:q?q.Ub():void 0});return p});m=yG(l,e,f,!0);return n["return"](m)})},JG=function(a,b){var c,d,e,f,g,h,l,m,n;return _.E(function(p){if(1==p.a)return c=_.fp,d=function(q){return q.stream.streams[0].type===c.VIDEO||q.stream.streams[0].type===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),
|
|
27
|
+
g=function(q){q=q.map(function(t){var v=t.stream.streams[0];t=Object.assign({},{Ka:t.Ka},{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.Kb,De:{width:v.width,height:v.height,frameRate:v.frameRate}});return MG(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;NG(a,h.concat(l));m=l.filter(function(q){return q.streams[0].type===
|
|
28
|
+
c.bi});n=l.filter(function(q){return q.streams[0].type===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,ii:h})})},NG=function(a,b){b.forEach(function(c){a.f.a.set(c.Ub(),c)})},FG=function(a,b){var c,d,e,f,g,h,l,m,n,p,q;return _.E(function(t){switch(t.a){case 1:return c=_.Y.Hl(b.Yc.closedCaptions),d=OG(a,b.Qd),_.x(t,PG(a,b),2);case 2:return e=t.f,f=Object.values(e).flat().map(function(v){return v.Ka}),QG(a,f),_.x(t,RG(a,e.dg,d),3);case 3:return g=t.f,_.x(t,SG(a,e.Qd,g,c),4);case 4:return h=
|
|
29
|
+
t.f,_.x(t,TG(a,e.rm,d),5);case 5:return l=t.f,_.x(t,UG(a,e.jf),6);case 6:return m=t.f,n=VG(a,e),p=yG(h,l,m,!GG(a)),a.D.filterAllPeriods(p),GG(a)?(q=null,n&&(q=WG(f,n)),t["return"]({periods:p,Dh:null,Rh:q})):t["return"]({periods:p,Dh:n,Rh:null})}})},WG=function(a,b){var c=a.find(function(d){return null!==_.Y.Ra(d.W,_.La)});return c?c.W.filter(function(d){return d.name===_.La}).map(function(d){return _.Y.Il(d,b)}).filter(Boolean):null},VG=function(a,b){var c=_.Og(b.Qd).concat(_.Og(b.dg)).map(function(e){return e.Ka}).flatMap(function(e){return e.S[0].W});
|
|
30
|
+
c=_.Y.Ra(c,_.Wa);if(!c)return null;var d=(new Date(c.value)).getTime();return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+(c.value+").")),null):d/1E3},PG=function(a,b){var c,d,e,f,g,h;return _.E(function(l){if(1==l.a)return _.x(l,Promise.all([XG(a,b.Yc.hi),XG(a,b.Yc.sm),XG(a,b.Qd),XG(a,b.jf)]),2);c=l.f;d=_.u(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({dg:e,rm:f,Qd:g,jf:h})})},ZG=function(a,b){return Promise.all(b.map(function(c){return YG(a,
|
|
31
|
+
c)}))},OG=function(a,b){for(var c=new Map,d=_.u(b),e=d.next();!e.done;e=d.next()){var f=e.value,g=_.Ii(f,"AUDIO");e=_.Ii(f,_.kc);var h=_.Ii(f,_.Tb);f=$G(a,f);if(h){var l=_.Di(_.bg,f);c.set(h,l);h=f.indexOf(l);-1<h&&f.splice(h,1)}g&&(h=aH(_.$c,f),c.set(g,h));e&&(g=aH(_.sg,f),c.set(e,g))}return c},TG=function(a,b,c){return Promise.all(b.map(function(d){return bH(a,d,c)}))},UG=function(a,b){return Promise.all(b.map(function(c){return cH(a,c)}))},RG=function(a,b,c){var d,e;return _.E(function(f){if(1==
|
|
32
|
+
f.a){if(0===b.length)return f["return"](new Map);d=[bH(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 bH(a,g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.um(e))})},SG=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v;return _.E(function(z){if(1==z.a){e=new Set;f=_.Og(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.Ji(f[l].tag,_.pa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.x(z,dH(a,n,c,d,e),2)}if(3!=z.a)return p=z.f,q=f.map(function(D){return dH(a,
|
|
33
|
+
D,c,d,e)}),_.x(z,Promise.all(q),3);t=z.f;t.splice(g,0,p);v=t.reduce(_.mi,[]);return z["return"](v)})},dH=function(a,b,c,d,e){var f,g,h,l,m,n;return _.E(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.Ji(h,_.pa)),m=f.Sl(h),_.x(p,eH(a,b,m,c,d),2)):(n=p.f)?p["return"](fH(a,n,l,e)):p["return"]([])})},eH=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,v,z,D,G,F,B,I,O;return _.E(function(M){if(1==M.a)return f=_.fp,g=b,h=g.tag,l=g.Ka,m=$G(a,h),n=_.Ii(h,"AUDIO"),p=_.Ii(h,_.kc),t=(q=n||p)&&d.has(q)?d.get(q):
|
|
34
|
+
[],v={audio:n?t:[],video:p?t:[]},a.g.debug("Guessing stream type for",h.toString()),D=!1,G=l.a,F=v.audio.find(function(ba){return ba.Kb===G}),B=_.Di(f.VIDEO,m),I=c||B,1!==m.length||I?!t.length&&1<m.length?(a.g.debug("Guessing multiplexed audio+video"),z=f.VIDEO,m=[m.join(",")]):v.audio.length&&F?(a.g.debug(bF),z=f.AUDIO,D=!0):v.video.length?(a.g.debug(bF),z=f.AUDIO):(a.g.debug("Guessing video-only"),z=f.VIDEO):(z=f.AUDIO,a.g.debug(bF)),O=null,D?M.F(2):_.x(M,gH(a,b,m,z,e,c),3);2!=M.a&&(O=M.f);if(null==
|
|
35
|
+
O)return M["return"](null);v[z]=[O];z===f.AUDIO&&c&&t.forEach(function(ba){hG(ba,c.width);iG(ba,c.height);jG(ba,c.frameRate)});_.Y.Kj(v);return M["return"](v)})},fH=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.u(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.u(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.Gj(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=KG(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):
|
|
36
|
+
(b.push(m),d.add(l)))}}return b},KG=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.bk(h,l);if(!m)return null;var n=d;h={id:a.H++,language:h?h.language:_.hg,primary:!!h&&h.primary||!!l&&l.primary,audio:h,video:l,bandwidth:n,drmInfos:m,allowedByApplication:!0,allowedByKeySystem:!0};e.push(h)}return new nG(e)},bH=function(a,b,c){var d,e,f,g;return _.E(function(h){d=b;e=d.tag;f=d.Ka;g=f.a;return h["return"](hH(a,g,function(){var l,
|
|
37
|
+
m,n,p,q,t,v,z,D,G,F,B,I,O;return _.E(function(M){if(1==M.a){l=_.fp;m=_.Ji(e,_.db);n=_.Y.vg(_.Ji(e,_.bc));p=_.Y.Cj(e);q=c.get(m)||"";t=_.Ii(e,_.sb);v=_.Ii(e,"NAME");z=e.getAttribute("DEFAULT");D=e.getAttribute("AUTOSELECT");G=_.Ii(e,"CHANNELS");F=n===l.AUDIO?G?parseInt(G.split("/")[0],10):null:null;var ba=n===l.AUDIO?(ba=_.Ii(e,"CHANNELS"))?ba.includes("/JOC"):!1:!1;B=ba;I=!!z&&!!D;return _.x(M,MG(a,{Ka:f,codecs:q,type:n,Fd:t,primary:I,name:v,channelsCount:F,spatialAudio:B,groupId:m,kind:p,closedCaptions:null,
|
|
38
|
+
De:null}),2)}O=M.f;return M["return"](O)})}))})},cH=function(a,b){var c,d,e,f;return _.E(function(g){c=b;d=c.tag;e=c.Ka;f=e.a;return g["return"](hH(a,f,function(){var h,l,m,n,p;return _.E(function(q){if(1==q.a)return h=_.Ii(d,_.ta)||"jpg",l=_.Ii(d,_.sb),m=_.Ii(d,"NAME"),_.x(q,MG(a,{Ka:e,codecs:h,type:_.ue,Fd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,De:null}),2);n=q.f;(p=_.Ii(d,_.pa))&&kG(n,Number(p));return q["return"](n)})}))})},$G=function(a,
|
|
39
|
+
b){var c=_.Ii(b,_.ta,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/),d=new Set,e=[];c=_.u(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.Pz(f)[0];d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},gH=function(a,b,c,d,e,f){var g,h,l,m,n;return _.E(function(p){g=b;h=g.tag;l=g.Ka;m=_.fp;n=l.a;return p["return"](hH(a,n,function(){var q,t,v,z;return _.E(function(D){if(1==D.a)return q=_.Ii(h,_.sa),t=null,d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q)),v=
|
|
40
|
+
aH(d,c),_.x(D,MG(a,{Ka:l,codecs:v,type:d,closedCaptions:t,primary:!1,kind:null,Fd:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,De:f}),2);z=D.f;return D["return"](z)})}))})},hH=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},MG=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,D,G,F,B,I,O,M,ba,ha,qa,Ta,Fa;return _.E(function(Ca){if(1==Ca.a){c=iH;d=_.ZE;e=_.fp;f=_.Y;g=b;h=g.Ka;l=g.codecs;m=g.type;
|
|
41
|
+
n=g.Fd;p=g.groupId;q=g.primary;t=g.kind;v=g.name;z=g.channelsCount;D=g.spatialAudio;G=g.closedCaptions;F=g.De;B=_.Y.Og(n);if(1!==h.type)throw new _.P(_.Q,4,4017);I=_.Y.Ql(h.W);jH(a,I);O=_.Y.Nl(h.W,I,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay);return _.x(Ca,kH(a,h,m,l),2)}M=Ca.f;ba=a.a.lowLatencyMode?d.Lm:d.Mm;ha=t;m!==e.TEXT||t||(ha=_.Zf);qa=f.Bh(h.W);Ta=qa.Zd;Fa=M.map(function(na){var Ia=na.S,tb=na.Mj,Jb=na.mimeType;na=na.ca;var Lc=Ia[0].startTime,Dm=Ia[Ia.length-1].endTime,Ms=Dm-Lc,Mc=
|
|
42
|
+
new _.uA(Ia),Em=Ia[0].initSegment||null;return{id:a.H++,originalId:v,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:Mc.Mc.bind(Mc),getSegmentReference:Mc.get.bind(Mc),adjustSegmentDurations:Mc.jd.bind(Mc),getDuration:Mc.getDuration.bind(Mc),segmentIndex:Mc,segmentLookupStrategy:ba,initSegmentReference:Em,mimeType:Jb,codecs:l,kind:ha,Bg:tb.type,encrypted:tb.type===c.ai,keyId:tb.keyId,language:B,originalLanguage:n||_.hg,label:v,type:m,primary:q,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
43
|
+
frameRate:F?F.frameRate:void 0,width:F?F.width:void 0,height:F?F.height:void 0,bandwidth:void 0,roles:[],channelsCount:z,spatialAudio:D,closedCaptions:G,keyInfo:tb.keyInfo,S:Ia,drmInfos:tb.drmInfos,ca:na,Kb:h.a,Pe:h.f,Zb:Lc,te:Dm,duration:Ms,Zd:Ta,groupId:p,Hk:O}});return Ca["return"](new fG(Fa))})},XG=function(a,b){var c;return _.E(function(d){if(1==d.a)return _.x(d,Promise.all(b.map(function(e){var f;return _.E(function(g){if(1==g.a)return _.x(g,lH(a,e),2);f=g.f;return g["return"](f?{tag:e,Ka:f}:
|
|
44
|
+
null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},lH=function(a,b){var c,d,e,f,g,h,l;return _.E(function(m){if(1==m.a){c=_.Y.Ek(b);d=_.Ii(b,_.dc,void 0,{required:c});if(!d)return m["return"](null);e=_.Y.rd(a.o,d);return _.x(m,mH(a,e),2)}f=m.f;g=f.response;h=f.text;l=g.uri;return m["return"](EG(a,h,l,d))})},YG=function(a,b){var c,d,e,f,g,h,l,m;return _.E(function(n){if(1==n.a){var p=new _.qi(b.streams[0].Pe);if(a.a.lowLatencyMode&&b.streams[0].Zd){var q=b.streams[b.streams.length-1].segmentIndex;
|
|
45
|
+
if(q=q.a[q.a.length-1]){var t=q.a,v=t.length-1;q={Mk:q.position,Tl:t&&0<t.length?v:null}}else q=null;if(t=q)q=t.Mk,t=t.Tl,v=_.ak(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=_.Zj(v,!0),_.ti(p,new _.xi(q))}c=p.toString();return _.x(n,mH(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.Ub();h=b.streams[0].Pe;l=e.uri;h!==l&&(h=l,gG(b,h));m=EG(a,f,h,g);return n["return"]({stream:b,Ka:m})})},EG=function(a,b,c,d){a=PF(a.J,b,c);a.a=d;nH(a);
|
|
46
|
+
return a},nH=function(a){1===a.type&&a.S.forEach(function(b,c){if(_.Y.Wb(b.W,_.Qa)&&!_.Y.Wb(b.W,_.Ma)&&0<c)throw new _.P(_.Q,4,4046,"Media playlist contains an EXT-X-MAP tag not accompanied by an EXT-X-DISCONTINUITY tag.");})},oH=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.P(_.Q,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},pH=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.Ii(c,
|
|
47
|
+
_.dc)})||null}).map(function(b){return _.Ei(b)});if(1<(new Set(a)).size)throw new _.P(_.Q,4,4044,"Unexpected change in file format.");},qH=function(a,b,c){a=_.Y.Qb(a.W,_.Qa);if(1<a.length)throw new _.P(_.Q,4,4020);a=a[0];if(!a)return null;var d=_.Ji(a,_.dc),e=_.Y.rd(b,d);b=_.Y.zh(a,null,!0);return new _.Dz(function(){return[e]},b.wa,b.ia,c)},rH=function(a,b,c,d,e,f,g){var h=[],l={};b=_.u(_.YE(b.f));for(var m=b.next();!m.done;l={Fe:l.Fe},m=b.next()){var n=m.value;m=n.Vg;n=n.item;var p=0===m,q=p?a:
|
|
48
|
+
h[h.length-1],t=p?d:q.endTime,v=Number(_.Ii(n,_.Ga));v=t+v;p=_.Y.zh(n,p?null:q.ia,p);q=_.Ii(n,_.dc);q=_.Y.rd(g,q);l.Fe=q?[q]:[];t=new _.Mi(c,t,v,function(z){return function(){return z.Fe}}(l),p.wa,p.ia,e,f,!1,null,null,null,null);if("YES"===_.Ii(n,"INDEPENDENT")||0===m)t.h=!0;h.push(t)}return h},sH=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.W,q=c.a,t=null!=q,v=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={wa:0,ia:null};var z=null;t?(c=_.Y.Ll(p).duration,a=e+c,q=_.Y.Ah(p,b?b.ia:null)):(b=rH(b,
|
|
49
|
+
c,d,e,f,g,l),a=b[b.length-1].endTime,z=b);h=h===_.ue?_.Y.Rl(p):null;d=new _.Mi(d,e,a,function(){return v},q.wa,q.ia,f,g,!1,null,h?h.Sg:null,h?h.Th:null,h?h.durationPerTile:null,z);d.ca=m;d.initSegment=n||void 0;return d},kH=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v,z,D,G;return _.E(function(F){switch(F.a){case 1:return e=_.Y,f=tH,g=uH,h=b.a,l=b.S,m=e.ek(b.W,_.Ra),n=[],!GG(a)&&g.gi(l),_.x(F,vH(a,b.f,h,l,m,c,d),2);case 2:p=F.f,q=m,t=f.pm(l),v=0;case 3:if(!(v<t.length)){F.F(5);break}z=t[v];D=n[n.length-
|
|
50
|
+
1]||null;return _.x(F,wH(a,b.f,z,q,p,c,d,D,t.length),6);case 6:G=F.f;n.push(G);q+=z.length;v++;F.F(3);break;case 5:return oH(n),F["return"](n)}})},vH=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,v,z,D,G,F;return _.E(function(B){if(1==B.a){h=d[0];if(null!=a.B)return B["return"](a.B);if(!GG(a)&&a.w)try{var I=a.f.get(c),O=I?lG(I,e)||null:null;if(!O)throw new _.P(_.Q,4,4030,"Segment not found in pervious playlist update.");l=O.startTime+O.ya;a.g.debug(eF+l+".");a.B=l;return B["return"](l)}catch(M){if(m=
|
|
51
|
+
a.f.get(c))n=m.streams[0].S[0].position,B=m.streams[m.streams.length-1].S,p=B[B.length-1].position,q=e,t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+t+"."),b,m);throw new _.P(_.Q,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.x(B,xH(a,f,g,h),2)}if(3!=B.a)return v=B.f,z=uH.Pl(h,a.o,v),D=qH(h,b,z.keyInfo),G=_.Y.ff(z.keyInfo,e),_.x(B,yH(a,D,h,G,v,g),3);F=B.f;a.g.debug(eF+F+".");a.B=F;return B["return"](F)})},
|
|
52
|
+
wH=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,t,v,z,D,G,F,B,I,O,M,ba,ha,qa,Ta,Fa,Ca,na;return _.E(function(Ia){switch(Ia.a){case 1:return m=_.Y,n=uH,p=c[0],q=null==h,pH(c),_.x(Ia,xH(a,f,g,p),2);case 2:t=Ia.f;v=n.Kl(c,a.o,t,h?h.Gk:null,1===l);z=v[v.length-1];D=uH.oa(v);G=qH(p,b,D.keyInfo)||(h?h.wk:null);F=_.Y.ff(D.keyInfo,d);B=p.ca;if(q){I=e;Ia.F(3);break}return _.x(Ia,zH(a,B,G,p,d,F,t,g),4);case 4:I=Ia.f;case 3:O=I;M=[];for(ba=0;ba<c.length;ba++)ha=c[ba],qa=M[M.length-1]||null,Ta=0===ba?0:qa.endTime,
|
|
53
|
+
Fa=d+ba,Ca=m.ff(D.keyInfo,Fa),(na=sH(a,qa,ha,Fa,Ta,O,Ca,f,b,B,G))&&M.push(na);return Ia["return"]({S:M,Mj:D,Gk:z,mimeType:t,endTime:M[M.length-1].endTime,ca:B,wk:G})}})},QG=function(a,b){b.forEach(function(c){var d=a.f.get(c.a);tH.mi(c,d,!GG(a))});tH.Hj(b)},zH=function(a,b,c,d,e,f,g,h){var l;return _.E(function(m){if(1==m.a)return a.C.has(b)?m["return"](a.C.get(b)):_.x(m,yH(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.C.set(b,l);return m["return"](l)})},yH=
|
|
54
|
+
function(a,b,c,d,e,f){var g;return _.E(function(h){if(null==c.a)return h["return"](0);g=_.Y.Fj(c,d);return h["return"](eG(a.K,b,g,e,f,null!=d))})},aH=function(a,b){if(1===b.length)return b[0];var c=_.Di(a,b);if(null!=c)return c;throw new _.P(_.Q,4,4025,{codecList:b});},xH=function(a,b,c,d){var e,f,g;return _.E(function(h){e=d.a;g=(f=_.Y.Ra(d.W,_.Qa))?_.Ji(f,_.dc):null;return h["return"](AH(a,b,c,e,g))})},AH=function(a,b,c,d,e){var f,g,h,l,m;return _.E(function(n){if(1==n.a){f=[d,e].filter(Boolean);
|
|
55
|
+
if(g=_.Gi(f,b,c))return n["return"](g);h=_.rj([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.x(n,a.Xe(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.P(_.Q,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.split(";")[0])})},mH=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=_.rj([b],a.a.attemptParameters),c.type=1,_.x(f,a.Xe(c),2);d=f.f;e="";try{e=_.R.Z(d.data)}catch(g){throw new _.P(_.Q,4,4042);}e=_.R.ih(e);e=e.trim();return f["return"]({text:e,
|
|
56
|
+
response:d})})},GG=function(a){return a.l===_.lc},jH=function(a,b){a.l=b;GG(a)&&a.j.stop()},HG=function(a,b){_.Y.eh(b,function(c,d){_.jA(a,c.S,d.startTime)})},BH=function(){},iH={ai:iF,Qm:jF,NONE:_.Se};_.r=VF.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())};
|
|
57
|
+
_.r.clear=function(){this.f.clear();this.a.clear()};
|
|
58
|
+
var tH={Hj:function(a){var b=tH.Vj(a),c=tH.Fk(a);a.forEach(function(d){var e=d.S,f=e.findIndex(function(h){return h.ca===b}),g=e.findIndex(function(h){return h.ca===c+1});-1===g&&(g=e.length);d.S=e.slice(f,g)})},mi:function(a,b,c){b=tH.dk(a,b,c);a=_.u(a.S||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.Wb(c.W,_.Ma)&&b++,c.ca=b},dk:function(a,b,c){var d=_.Y.Ra(a.W,_.Na);if(d)return Number(d.value);d=tH.yk(b);if(c&&d)try{return tH.vk(a,b)}catch(e){throw new _.P(_.Q,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");
|
|
59
|
+
}return 0},yk:function(a){return 0<tH.gk(a)},pm:function(a){if(0===a.length)return[];var b=[],c=[];a=_.u(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.Wb(d.W,_.Ma)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},gk:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].S;return a[a.length-1].ca},vk:function(a,b){var c=_.Y.Ra(a.W,_.Ra);if(!c)throw tH.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(aF);c=Number(c.value);var d=
|
|
60
|
+
lG(b,c);if(!d)throw tH.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(aF);return d.ca},Fk:function(a){a=a.map(function(b){return b.S[b.S.length-1].ca});return Math.min.apply(Math,_.Og(a))},Vj:function(a){a=a.map(function(b){return b.S[0].ca});return Math.max.apply(Math,_.Og(a))}};tH.g=new _.K("clpp.hls.DiscontinuityUtils");var CH={"com.apple.streamingkeydelivery":function(a,b){if(b===_.tg)throw new _.P(_.Q,4,4041);if(_.Ji(a,cF)===dF)throw new _.P(_.Q,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.Cz(_.Md,[{initDataType:_.Qf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":bG,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":bG,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.Ji(a,cF);if(!$F.includes(b))return aG.error("Widevine in HLS is only supported with [",
|
|
61
|
+
$F.join(", "),"], not",b),null;b=_.Ji(a,_.dc);b=_.et(b);b=_.Ui(b.data);b=_.Cz(_.Rd,[{initDataType:_.rd,initData:b}],"");if(a=_.Ii(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},$F=["SAMPLE-AES",dF],aG=new _.K("clpp.hls.DrmParser");var uH={Pl:function(a,b,c){return uH.Ef(a.W,b,c)||{type:_.Se,keyInfo:null,drmInfos:[],keyId:null}},Kl:function(a,b,c,d,e){if(a.slice(1).some(uH.Tg))throw new _.P(_.Q,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.Wb(a[0].W,_.Pa)||null===d){if((d=uH.Ef(a[0].W,
|
|
62
|
+
b,c))&&d.type===jF){if(1<uH.wg(a))throw new _.P(_.Q,4,4046,fF+((e?"playlist":"discontinuity")+"."));return[d]}a=uH.xh(a,b,c);return 0===a.length?[{type:_.Se,keyInfo:null,drmInfos:[],keyId:null}]:a}b=uH.xh(a,b,c);if(d.type===_.Se||d.type===iF)return[d].concat(_.Og(b));if(0<uH.wg(a))throw new _.P(_.Q,4,4046,fF+((e?"playlist":"discontinuity")+"."));return[d]},oa:function(a){if(0===a.length)return{type:_.Se,keyInfo:null,drmInfos:[],keyId:null};if(a.some(function(c){return c.type===jF})||a.every(function(c){return c.type===
|
|
63
|
+
_.Se}))return a[0];a=a.filter(function(c){return c.type===iF});var b=_.Xh(a.flatMap(function(c){return c.drmInfos}));return{keyInfo:null,keyId:a[a.length-1].keyId,type:iF,drmInfos:b}},gi:function(a){a=uH.Fg(a);if(a.some(function(b){return uH.Tg(b)})&&1<a.length)throw new _.P(_.Q,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},Tg:function(a){return _.Y.Qb(a.W,_.Pa).some(function(b){return"AES-128"===_.Ii(b,cF)})},xh:function(a,b,c){return uH.Fg(a).map(function(d){return uH.Ef(d.W,
|
|
64
|
+
b,c)})},wg:function(a){return a.filter(function(b){return _.Y.Wb(b.W,_.Pa)}).length},Fg:function(a){return a.filter(function(b){return _.Y.Wb(b.W,_.Pa)})},Ef:function(a,b,c){a=_.Y.Qb(a,_.Pa);if(0===a.length)return null;var d=_.Ji(a[0],cF);if(1===a.length){if("NONE"===d)return{type:_.Se,keyInfo:null,drmInfos:[],keyId:null};if("AES-128"===d)return a=a[0],d=_.Ii(a,"IV",""),{type:jF,keyInfo:{method:"AES-128",url:_.Y.rd(b,_.Ji(a,_.dc)),iv:d?_.gj((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(function(e){return _.Ji(e,
|
|
65
|
+
cF)});if(!b.every(function(e){return"SAMPLE-AES"===e})&&!b.every(function(e){return e===dF}))throw uH.g.warn("EXT-X-KEY methods "+b.join(", ")+" are incompatible."),new _.P(_.Q,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(function(e){var f=_.Ii(e,"KEYFORMAT","identity"),g=CH[f]||null;(e=g?g(e,c):null)||uH.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.P(_.Q,4,4026);return{keyInfo:null,keyId:b.map(function(e){return e.keyIds}).reduce(function(e,
|
|
66
|
+
f){return e.concat(f)},[]).reverse()[0]||null,type:iF,drmInfos:b}},jn:function(){return{type:_.Se,keyInfo:null,drmInfos:[],keyId:null}}};uH.g=new _.K("clpp.hls.EncryptionUtils");_.r=fG.prototype;_.r.length=function(){return this.streams.length};_.r.fk=function(){return this.streams[0].groupId};_.r.ak=function(){return this.streams[0].codecs.split(",")};_.r.Ub=function(){return this.streams[0].Kb};_.r.im=function(a){this.streams.forEach(function(b){b.codecs=a.join(",")})};nG.prototype.length=function(){return this.a.length};_.r=CG.prototype;_.r.configure=function(a){this.a=a;this.K.a=a};_.r.setCurrentVariant=function(a){this.h=a};_.r.start=function(a,b){var c=this,d,e,f,g,h;return _.E(function(l){if(1==l.a){if(c.I)throw Error("start() may be called only once!");c.I=!0;c.D=b;return _.x(l,mH(c,a),2)}if(3!=l.a)return d=l.f,e=d.response,f=d.text,c.o=e.uri,_.x(l,IG(c,f),3);g=l.f;c.w=g;h=c.G;0<h&&c.j.aa(h);return l["return"](g)})};
|
|
67
|
+
_.r.stop=function(){this.j&&(this.j.stop(),this.j=null);var a=[];this.A&&(a.push(this.A.destroy()),this.A=null);this.f.clear();this.w=this.a=this.D=this.h=null;return Promise.all(a)};_.r.onExpirationUpdated=function(){};
|
|
68
|
+
_.r.update=function(){var a=this,b,c,d,e,f,g,h;return _.E(function(l){if(1==l.a){b=a.w;if(GG(a)||!b)return l["return"]();c=b.presentationTimeline;"LIVE"===a.l&&(a.B=null);d=Array.from(a.f.values());a.a.lowLatencyMode&&null!==a.h&&(e=DG(a),d=d.filter(function(m){return e.includes(m.Ub())}));return _.x(l,ZG(a,d),2)}if(3!=l.a)return f=l.f,g=f.map(function(m){return m.Ka}),QG(a,g),_.x(l,LG(a,f),3);h=l.f;pG(b.periods,h).forEach(function(m){a.D.filterNewPeriod(m)});sG(b.periods,h);tG(b.adaptedPeriods,h);
|
|
69
|
+
HG(c,h);_.Y.tk(g)&&(jH(a,_.lc),c.j=!0,c.l=!0,c.f=h[h.length-1].endTime);_.y(l)})};_.r.Hb=function(){var a=this,b,c,d;return _.E(function(e){if(1==e.a){a.g.debug(_.Yy);if(!a.D)return e["return"]();_.A(e,2);return _.x(e,a.update(),4)}if(2!=e.a)return b=a.G,a.j.aa(b),_.ah(e,0);c=_.C(e);if(!(c instanceof _.P))throw c;a.D&&(a.D.onError(c),d=c,1===d.severity&&a.j.aa(.1));_.y(e)})};_.r.Xe=function(a){if(!this.A)throw new _.P(_.Q,7,7001);a=this.D.networkingEngine.fetch(a);_.Bj(this.A,a);return a.O};_.w(BH,_.Ir);BH.prototype.f=function(){_.Fs.m3u8=CG;_.Ds[_.dl]=CG;_.Ds[gF]=CG};BH.prototype.a=function(){_.CA("m3u8");_.DA(_.dl);_.DA(gF)};BH.prototype.id=function(){return"hls"};_.H("clpp.hls.HlsComponent",BH);};
|
|
69
70
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
70
71
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
71
72
|
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
|
-
_.H("clpp.hlssmpte.HlsSmptePlugin",
|
|
2
|
+
var f=function(window){var VO=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.N.R(a)){a:{var b=a.info;if(_.N.$(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=_.N.$(a)?a:null}},XO=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Eh;this.h=(a=_.ft[_.Xc]||null)?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;WO(this)},WO=function(a){a.a.one(a.m,_.Ee,function(){return YO(a)})},
|
|
3
|
+
YO=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Kc,function(d){return ZO(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Le}).forEach(function(d){ZO(a,{track:d})});!$O(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."),aP(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
|
+
$O=function(a){return a.some(function(b){return b.kind===_.Le})},aP=function(a,b){var c=a.m.getTrackManager(),d=c.ja(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.za(d)};a.a.on(b.textTracks,_.Kc,function(g){g.track.kind===_.Le&&(a.a.off(b.textTracks,_.Kc,f),f())});c.za(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},ZO=function(a,b){var c=b.track;c.kind===_.Le&&(a.g.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.se,a.a.on(c,_.Ud,function(d){return bP(a,d)}))},bP=function(a,b){var c=cP(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 VO(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.R.Va(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)}}})},cP=function(a){return(a=
|
|
6
|
+
a.m.getTrackManager().ua())&&a.language&&a.language.toLowerCase()},dP=function(){this.a=null;this.f=!1},eP=function(){};XO.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.w(dP,_.rt);dP.prototype.onPlayerCreated=function(){};dP.prototype.onContentWillLoad=function(a){if(this.f=_.Bk()){var b=a.getConfiguration();b=_.N.Oa(b.hlssmpte||{});_.N.Zg(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.N.na(b.timestampOffset)||(b.timestampOffset=0);this.a=new XO(a,b.patchMetadataTrack,b.timestampOffset)}};dP.prototype.onPlayerWillDestroy=function(){var a=this;return _.E(function(b){if(1==b.a)return a.a?_.x(b,a.a.destroy(),3):b.F(0);a.a=null;_.y(b)})};dP.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.H("clpp.hlssmpte.HlsSmptePlugin",dP);dP.Id="hlssmpte";eP.prototype.create=function(){return new dP};_.nq(new eP);};
|
|
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));}
|