@castlabs/prestoplay 6.28.0 → 6.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/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 +123 -113
- package/cjs/cl.conviva.js +28 -28
- package/cjs/cl.core.js +616 -609
- package/cjs/cl.crypto.js +7 -7
- package/cjs/cl.dash.js +89 -89
- package/cjs/cl.externs.js +127 -34
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +79 -78
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +24 -24
- package/cjs/cl.ima.js +24 -23
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +350 -350
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +71 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +70 -70
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +37 -37
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +6 -6
- package/cl.cast.js +98 -91
- package/cl.conviva.js +27 -27
- package/cl.core.js +492 -488
- package/cl.crypto.js +8 -8
- package/cl.dash.js +82 -82
- package/cl.externs.js +123 -34
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +82 -80
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +16 -15
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +303 -304
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.simid.js +14 -14
- package/cl.smooth.js +60 -60
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +56 -56
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +31 -31
- package/package.json +1 -1
- package/typings.d.ts +187 -87
package/cjs/cl.freewheel.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var FU="clpp-freewheel",GU="clpp.freewheel.AdsManagerFactory",HU="freewheel",IU=function(){this.f=this.a=null},JU=function(){},KU=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""}},LU=function(a,b,c){this.h=a;this.f=b;this.a=c},MU=function(a){this.a=a},NU=function(a){this.g=new _.L("clpp.freewheel.AdsManager");this.m=a;this.h=new _.
|
|
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)})},SU=function(a){return _.I(function(b){if(a.B.length)return QU(a),a.f=a.B.shift(),a.f.play(),b.C(0);RU(a);return _.x(b,a.m.a.play(),0)})},TU=function(a){a.A.length?(QU(a),a.f=a.A.shift(),a.f.play()):RU(a)},QU=function(a){var b=a.m.
|
|
5
|
-
a.a.registerVideoDisplayBase(FU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},RU=function(a){var b=a.m.
|
|
6
|
-
_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.
|
|
7
|
-
_.K("clpp.freewheel.FreeWheelPlugin",IU);IU.prototype.getAdVideo=IU.prototype.
|
|
8
|
-
_.r.getTitle=function(){return""};_.r.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.r.getPosition=function(){return 0};_.r.getSkipTimeOffset=function(){return 0};_.r.
|
|
9
|
-
_.r.lb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.kb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.
|
|
10
|
-
_.r.getPodIndex=function(){switch(this.
|
|
11
|
-
_.r.getWrapperAdSystems=function(){return[]};_.r.getWrapperCreativeIds=function(){return[]};_.r.
|
|
12
|
-
LU.prototype.getPodTimeOffset=LU.prototype.
|
|
13
|
-
LU.prototype.getDuration=LU.prototype.getDuration;LU.prototype.getTitle=LU.prototype.getTitle;LU.prototype.getAdvertiserName=LU.prototype.getAdvertiserName;LU.prototype.getAdSystem=LU.prototype.getAdSystem;LU.prototype.getApiFramework=LU.prototype.getApiFramework;LU.prototype.getSourceId=LU.prototype
|
|
14
|
-
LU.prototype.getAdManagerName=LU.prototype.vb;MU.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()}})};MU.prototype.
|
|
15
|
-
MU.prototype.hasPostroll=MU.prototype.
|
|
16
|
-
_.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{OU(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!==_.
|
|
17
|
-
_.v(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,KU(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.
|
|
18
|
-
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.
|
|
19
|
-
_.r.resume=function(){this.f&&this.f.resume()};_.r.pause=function(){this.f&&this.f.pause()};_.r.skip=function(){this.f&&this.f.skipCurrentAd()};_.r.getVolume=function(){return this.a?this.a.getAdVolume():1};_.r.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.r.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.r.
|
|
20
|
-
_.r.
|
|
21
|
-
void 0));this.l.resolve()};_.r.
|
|
22
|
-
_.r.
|
|
23
|
-
_.
|
|
24
|
-
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.
|
|
25
|
-
_.r.
|
|
26
|
-
NU.prototype.skip=NU.prototype.skip;NU.prototype.pause=NU.prototype.pause;NU.prototype.resume=NU.prototype.resume;VU.prototype.name=function(){return GU};VU.prototype.a=function(a,b){return a.namespace()!==_.
|
|
2
|
+
var f=function(window){var FU="clpp-freewheel",GU="clpp.freewheel.AdsManagerFactory",HU="freewheel",IU=function(){this.f=this.a=null},JU=function(){},KU=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""}},LU=function(a,b,c){this.h=a;this.f=b;this.a=c},MU=function(a){this.a=a},NU=function(a){this.g=new _.L("clpp.freewheel.AdsManager");this.m=a;this.h=new _.si;this.w=new tv.freewheel.SDK.AdManager;
|
|
3
|
+
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.lm;this.j=null},OU=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.hg&&b.push("serverUrl");typeof a.profileId!==_.hg&&b.push("profileId");typeof a.videoAssetId!==_.hg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.N(1,9,12001,{missingKeys:b.join(", ")});},PU=function(){var a,b,c,d;return _.I(function(e){if(1==e.a)return a=new _.Jv,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)})},SU=function(a){return _.I(function(b){if(a.B.length)return QU(a),a.f=a.B.shift(),a.f.play(),b.C(0);RU(a);return _.x(b,a.m.a.play(),0)})},TU=function(a){a.A.length?(QU(a),a.f=a.A.shift(),a.f.play()):RU(a)},QU=function(a){var b=a.m.je(HU).sd();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
|
|
5
|
+
a.a.registerVideoDisplayBase(FU),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},RU=function(a){var b=a.m.je(HU).sd();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},UU=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 LU(a.a,c,d)});a.m.trigger(new _.Q(b,d))},VU=function(){this.Da=new _.L(GU)};_.w(IU,_.ew);_.r=IU.prototype;
|
|
6
|
+
_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Wi(_.Qd,{id:FU}),this.f=_.Wi(_.Ng,{"class":_.md}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.N(1,9,12E3))};_.r.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.r.id=function(){return HU};_.r.sd=function(){return this.a};_.r.am=function(){return this.f};
|
|
7
|
+
_.K("clpp.freewheel.FreeWheelPlugin",IU);IU.prototype.getAdVideo=IU.prototype.am;IU.prototype.getAdContainer=IU.prototype.sd;IU.Id=HU;IU.AD_CONTAINER_ID=FU;JU.prototype.create=function(){return new IU};_.r=LU.prototype;_.r.vb=function(){return"FreeWheel AdManager SDK"};_.r.wb=function(){return tv.freewheel.SDK.version};_.r.Bb=function(){return 0};_.r.getId=function(){return this.a?this.a.getAdId():""};_.r.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.hg?a:""};_.r.$b=function(){return""};_.r.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.r.getAdSystem=function(){return""};_.r.getAdvertiserName=function(){return""};
|
|
8
|
+
_.r.getTitle=function(){return""};_.r.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.r.getPosition=function(){return 0};_.r.getSkipTimeOffset=function(){return 0};_.r.ec=function(){return!1};_.r.xb=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.lb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.kb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.Wa=function(){return 0};_.r.Xa=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
|
|
10
|
+
_.r.getPodIndex=function(){switch(this.Xa()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.r.Ob=function(){switch(this.Xa()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.r.zb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.r.nb=function(){return this.f.getAdCount()};_.r.getWrapperAdIds=function(){return[]};_.r.canSeek=function(){return!1};
|
|
11
|
+
_.r.getWrapperAdSystems=function(){return[]};_.r.getWrapperCreativeIds=function(){return[]};_.r.cc=function(){return null};LU.prototype.getVideoElement=LU.prototype.cc;LU.prototype.getWrapperCreativeIds=LU.prototype.getWrapperCreativeIds;LU.prototype.getWrapperAdSystems=LU.prototype.getWrapperAdSystems;LU.prototype.canSeek=LU.prototype.canSeek;LU.prototype.getWrapperAdIds=LU.prototype.getWrapperAdIds;LU.prototype.getSequenceLength=LU.prototype.nb;LU.prototype.getPositionInSequence=LU.prototype.zb;
|
|
12
|
+
LU.prototype.getPodTimeOffset=LU.prototype.Ob;LU.prototype.getPodIndex=LU.prototype.getPodIndex;LU.prototype.getPodType=LU.prototype.Xa;LU.prototype.getMediaBitrate=LU.prototype.Wa;LU.prototype.getMediaHeight=LU.prototype.kb;LU.prototype.getMediaWidth=LU.prototype.lb;LU.prototype.getMediaUrl=LU.prototype.getMediaUrl;LU.prototype.getClickThroughUrl=LU.prototype.xb;LU.prototype.isBumper=LU.prototype.ec;LU.prototype.getSkipTimeOffset=LU.prototype.getSkipTimeOffset;LU.prototype.getPosition=LU.prototype.getPosition;
|
|
13
|
+
LU.prototype.getDuration=LU.prototype.getDuration;LU.prototype.getTitle=LU.prototype.getTitle;LU.prototype.getAdvertiserName=LU.prototype.getAdvertiserName;LU.prototype.getAdSystem=LU.prototype.getAdSystem;LU.prototype.getApiFramework=LU.prototype.getApiFramework;LU.prototype.getSourceId=LU.prototype.$b;LU.prototype.getCreativeId=LU.prototype.getCreativeId;LU.prototype.getId=LU.prototype.getId;LU.prototype.getTechnology=LU.prototype.Bb;LU.prototype.getAdManagerVersion=LU.prototype.wb;
|
|
14
|
+
LU.prototype.getAdManagerName=LU.prototype.vb;MU.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()}})};MU.prototype.Rb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};MU.prototype.Qb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
15
|
+
MU.prototype.hasPostroll=MU.prototype.Qb;MU.prototype.hasPreroll=MU.prototype.Rb;MU.prototype.getCuePoints=MU.prototype.getCuePoints;_.r=NU.prototype;
|
|
16
|
+
_.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{OU(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!==_.hg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.x(m,PU(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
|
|
17
|
+
_.v(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,KU(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=_.v(b.parameters),h=g.next();!h.done;h=
|
|
18
|
+
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.Kn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Pn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.On.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.cn.bind(a));a.h.on(a.m,_.vg,a.Uk.bind(a));a.h.on(a.m,_.eg,a.Tk.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.r.start=function(){var a=this;return _.I(function(b){return _.x(b,SU(a),0)})};_.r.ld=function(){};
|
|
19
|
+
_.r.resume=function(){this.f&&this.f.resume()};_.r.pause=function(){this.f&&this.f.pause()};_.r.skip=function(){this.f&&this.f.skipCurrentAd()};_.r.getVolume=function(){return this.a?this.a.getAdVolume():1};_.r.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.r.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.r.hd=function(){return!0};_.r.Gc=function(){var a=this;return _.I(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);RU(a);a.a&&(a.a.dispose(),a.a=null);_.z(b)})};
|
|
20
|
+
_.r.Kn=function(a){var b=this;if(a.success)this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.o=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.Q(_.Bc,{adsTimeline:new MU(this.a)})),this.j=new _.Hv(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.je(HU).f);else this.m.onError(new _.N(1,9,10003,{errorType:0},
|
|
21
|
+
void 0));this.l.resolve()};_.r.Pn=function(a){UU(this,_.gc,a);this.j.start()};_.r.On=function(a){this.f=null;a=a.slot;UU(this,_.hc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:SU(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:RU(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:TU(this)}};
|
|
22
|
+
_.r.cn=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:UU(this,_.xc,a);UU(this,_.qc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:UU(this,_.yc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:UU(this,_.lc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:UU(this,_.sc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:UU(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:UU(this,_.kc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:UU(this,
|
|
23
|
+
_.jc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:UU(this,_.tc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:UU(this,_.vc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:UU(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:UU(this,_.ic,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:UU(this,_.uc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.N(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],
|
|
24
|
+
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.Uk=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();QU(this);this.f.play()}}};
|
|
25
|
+
_.r.Tk=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case 4:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 5:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);TU(this);break;case _.gu:case _.Ko:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};NU.prototype.getPosition=NU.prototype.getPosition;NU.prototype.setVolume=NU.prototype.setVolume;NU.prototype.getVolume=NU.prototype.getVolume;
|
|
26
|
+
NU.prototype.skip=NU.prototype.skip;NU.prototype.pause=NU.prototype.pause;NU.prototype.resume=NU.prototype.resume;VU.prototype.name=function(){return GU};VU.prototype.a=function(a,b){return a.namespace()!==_.rd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Da.warn("FreeWheel SDK is not loaded."),!1):!1};VU.prototype.create=function(a){return new NU(a)};_.ai(new VU);_.dp(new JU);};
|
|
27
27
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
28
28
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
29
29
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hls.js
CHANGED
|
@@ -1,82 +1,83 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
function(c,d){return d+b})},
|
|
4
|
-
}this.a=a;this.verbatimUri="";this.type=b;this.Y=c;this.S=1===b?d:null},
|
|
5
|
-
|
|
6
|
-
!_.Y.
|
|
7
|
-
d.push(f);if(f.name===_.Ka){var g=b[e+1];if(!g)throw new _.N(_.O,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.
|
|
8
|
-
"EXT-X-PART"===h.name||"EXT-X-PRELOAD-HINT"===h.name&&"PART"===_.T(h,_.Kb)?g.push(h):f.push(h)):(_.Y.
|
|
9
|
-
e+"' as it is not defined in the master playlist");d.set(e,f)});return d},
|
|
10
|
-
e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}
|
|
11
|
-
204),f=_.
|
|
12
|
-
1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},
|
|
13
|
-
if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.N(_.O,4,4030,
|
|
14
|
-
[{initDataType:_.
|
|
15
|
-
case 2:if(d!==_.
|
|
16
|
-
b.la,b.la+2048-1,a.a.attemptParameters),e.type=2,f=_.
|
|
17
|
-
a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.N(_.O,4,4030,"Failed to fetch the media segment.");}})},
|
|
18
|
-
a.streams.find(function(d){d=d.S;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.S.find(function(d){return d.position===b})||null},
|
|
19
|
-
|
|
20
|
-
textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,
|
|
21
|
-
b.duration;
|
|
22
|
-
d.keyId})},
|
|
23
|
-
var h=f.S[0];if(!h)break;
|
|
24
|
-
a=Date.parse(a.value);return isNaN(a)?null:a},
|
|
25
|
-
this.
|
|
26
|
-
{configurationId:a.
|
|
27
|
-
f===c.AUDIO&&(g="mp4a.40.2");d=
|
|
28
|
-
y&&(D.alternativeVariants=y);B&&(D.alternativeTextStreams=B);A&&(D.alternativeImageStreams=A);a.g.debug("HLS playlist parsed",D);return J["return"](D)}})},
|
|
29
|
-
_.Y,_.x(p,
|
|
30
|
-
h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.
|
|
31
|
-
height:u.height,frameRate:u.frameRate}});return
|
|
32
|
-
e=
|
|
33
|
-
A=
|
|
34
|
-
|
|
35
|
-
2);c=l.f;d=_.v(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({
|
|
36
|
-
f),h))}return d}
|
|
37
|
-
y.a){e=new Set;f=_.
|
|
38
|
-
kind:b.kind||null,name:b.label,channelsCount:b.channelsCount,spatialAudio:b.spatialAudio||!1,closedCaptions:b.closedCaptions,
|
|
39
|
-
b.toString());b=!1;var h=_.
|
|
40
|
-
p?d.get(g(f.VIDEO,p))||[]:[],u={audio:q,video:t},y=m.verbatimUri,B=u.audio.find(function(U){return U
|
|
41
|
-
f.next();!g.done;g=f.next()){g=g.value;for(var h=_.v(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.
|
|
42
|
-
_.
|
|
43
|
-
_.Y.
|
|
44
|
-
_.Za),m=_.T(d,_.fb),_.x(q,
|
|
45
|
-
(e.push(f),d.add(g))}return e},
|
|
46
|
-
spatialAudio:!1,
|
|
47
|
-
C=f.closedCaptions;E=f.
|
|
48
|
-
adjustSegmentDurations:
|
|
49
|
-
S:Ea,drmInfos:Ma.drmInfos,
|
|
50
|
-
d=_.T(b,_.Mb,void 0,{required:c});if(!d)return p["return"](null);e=_.
|
|
51
|
-
|
|
52
|
-
4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},
|
|
53
|
-
c)},
|
|
54
|
-
0<_.Y.
|
|
55
|
-
f=
|
|
56
|
-
4,4030,"Segment not found in pervious playlist update.");l=D.startTime+D.
|
|
57
|
-
C.f,y=
|
|
58
|
-
E;J=[];P=!1;for(U=0;U<c.length;U++)if(V=c[U],
|
|
59
|
-
a.j.get(c.verbatimUri);
|
|
60
|
-
b);if(null!=c)return c;throw new _.N(_.O,4,4025,{codecList:b});},
|
|
61
|
-
f.join(", "));return n["return"](m.toLowerCase().split(";")[0])})},
|
|
62
|
-
b=_.v(a.j.values()),d=b.next();!d.done;d=b.next())d=d.value.streams[0],95443.7176888889>d.
|
|
63
|
-
b){_.Y.
|
|
64
|
-
_.r=
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_.
|
|
73
|
-
_.r.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
2
|
+
var f=function(window){var kK="Could not parse MP4 segment start time.",lK="EXT-X-DATERANGE",mK="EXT-X-DISCONTINUITY",nK="EXT-X-KEY",oK="EXT-X-MAP",pK="EXT-X-MEDIA-SEQUENCE",qK="EXT-X-PROGRAM-DATE-TIME",rK="Failed to infer discontinuity number",sK="Guessing audio-only",tK="METHOD",uK="SAMPLE-AES-CTR",vK="Setting playlist start time to ",wK="_HLS_part",xK="application/vnd.apple.mpegurl",yK="manifestloaded",zK="sample",AK=function(a){if(1>a.a)throw _.iq();--a.a},BK=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},
|
|
3
|
+
function(c,d){return d+b})},CK=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},DK=function(a){a=_.Dn(a)||"";return null!=_.Pp.video[a]?_.Ng:null!=_.Pp.audio[a]?_.Oc:null},EK=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.N(_.O,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.N(_.O,4,4043,"Media playlist must have at least one full segment!");
|
|
4
|
+
}this.a=a;this.verbatimUri="";this.type=b;this.Y=c;this.S=1===b?d:null},FK=function(a,b,c){c=void 0===c?[]:c;this.Y=b;this.a=a;this.f=c;this.sa=-1},GK=function(a){return a.some(function(b){return b.startsWith("#EXT-X-TARGETDURATION")})?1:0},HK=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(_.O,4,4044,"Undefined variable '"+d+"'");return e})},IK=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=HK(d.value,b)})})},
|
|
5
|
+
JK=function(a,b){var c=new Map,d=new URL(b);a.forEach(function(e){var f=_.T(e,_.fb),g=_.T(e,"QUERYPARAM");if(f)g=_.Sp(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.N(_.O,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.N(_.O,4,4044,"Query param '"+g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},KK=function(){this.h=0;this.a=new Map},NK=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&
|
|
6
|
+
!_.Y.Cm(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.N(_.O,4,4015);b=b.slice(1);return 0===GK(b)?LK(a,b,c):MK(a,b,c)},MK=function(a,b,c){var d=OK(b);b=d.xo;var e=d.vm,f=PK(a,d.ap,c);d=e.map(function(g){return QK(a,g,f)});b=RK(a,c,b,f);return new EK(c,1,d,b)},OK=function(a){var b=[],c=[],d=[];a=_.v(a);for(var e=a.next();!e.done;e=a.next())e=e.value,SK.test(e)?d.push(e):TK.test(e)?c.push(e):b.push(e);return{xo:b,vm:c,ap:d}},LK=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=QK(a,b[e]);
|
|
7
|
+
d.push(f);if(f.name===_.Ka){var g=b[e+1];if(!g)throw new _.N(_.O,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Tp(_.Mb,g));e++}}b=_.Y.rc(d,"EXT-X-DEFINE");_.Y.Ij(b);b=JK(b,c);a.a=b;IK(d,a.a);return new EK(c,0,d)},UK=function(a,b,c){var d=[],e=[];e.push(new _.Tp(_.oa,"0"));e.push(new _.Tp(_.Mb,b));c.length&&e.push(new _.Tp(_.ta,c));d.push(new _.Rp(a.h++,_.Ka,e));return new EK(b,0,d)},RK=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(h){_.Y.Im(h)?(h=QK(a,h,d),
|
|
8
|
+
"EXT-X-PART"===h.name||"EXT-X-PRELOAD-HINT"===h.name&&"PART"===_.T(h,_.Kb)?g.push(h):f.push(h)):(_.Y.Lc(f,"EXT-X-GAP")||(h=HK(h,d),h=_.Cn(h,b),e.push(new FK(h,f,g))),f=[],g=[])});0<g.length&&e.push(new FK(null,f,g));return e},QK=function(a,b,c){a=_.$s(a.h++,b);c&&IK([a],c);return a},PK=function(a,b,c){b=b.map(function(e){return QK(a,e)});_.Y.Ij(b);var d=JK(b,c);b.map(function(e){return _.T(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.N(_.O,4,4044,"Cannot import variable '"+
|
|
9
|
+
e+"' as it is not defined in the master playlist");d.set(e,f)});return d},VK=function(){this.a=new Map;this.f=new Map},WK=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.N(_.O,4,4030);}CK(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,
|
|
10
|
+
e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}CK(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},XK=function(a){for(;a.getPosition()<a.Va()-1;){var b=a.getPosition();if(71===_.jq(a))return AK(a),b}return-1},YK=function(a){function b(){d.seek(e+188);f=_.jq(d);71!==f&&(d.seek(e+192),f=_.jq(d));71!==f&&(d.seek(e+
|
|
11
|
+
204),f=_.jq(d));71!==f&&c();AK(d)}function c(){throw new _.N(_.O,4,4030);}var d=new _.gq(new DataView(a),!1),e=0,f=0;e=XK(d);0>e&&(_.Nw.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.jq(d),71!==f&&c(),a=_.kq(d),8191===(a&8191))b();else if(a&16384)if(a=(_.jq(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.jq(d),d.skip(a)),1!==_.lq(d)>>8)b();else{d.skip(3);a=_.jq(d)>>6;0!==a&&1!==a||c();0===_.jq(d)&&c();a=_.jq(d);var g=_.kq(d),h=_.kq(d);return(1073741824*((a&14)>>
|
|
12
|
+
1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},ZK=function(a,b){var c=null,d=0;try{(new _.qq).M(_.Pe,_.rq).M(_.yg,_.rq).M(_.Ke,_.rq).ba("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.lq(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.Nw.error("Unable to find timescale in init segment!"),new _.N(_.O,4,4030,kK,c);var e=0,f=!1;try{(new _.qq).M("moof",_.rq).M("traf",_.rq).ba("tfdt",function(g){var h=d;if(0===g.version)h=_.lq(g.reader)/h;else{var l=_.lq(g.reader),m=_.lq(g.reader);
|
|
13
|
+
if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.N(_.O,4,4030,kK,c);return e},bL=function(a){var b=_.Sp(a,tK);if(!$K.includes(b))return aL.error("PlayReady in HLS is only supported with [",$K.join(", "),"], not",b),null;a=_.Sp(a,_.Mb);b=_.Sm(a);a=null;b=_.Ni(b.data);try{a=_.tC(_.Sr(b))}catch(c){a=b}return _.GC(_.Ed,
|
|
14
|
+
[{initDataType:_.gd,initData:a}],"")},cL=function(a){this.g=new _.L("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Tk()}},eL=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,t;return _.I(function(u){switch(u.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Rc||d===_.Qc)return u["return"](0);g=f;if(d!==_.Pc){u.C(2);break}return _.x(u,dL(a,c,g),3);case 3:h=u.f;l=_.Ni(h.data);if(!CK(l))throw new _.N(_.O,4,4030,"AAC segment does not contain an ID3 tag.");return u["return"](WK(l));
|
|
15
|
+
case 2:if(d!==_.Pg&&d!==_.Sc){u.C(4);break}m=[dL(a,c,g)];b&&m.push(dL(a,b,!0));return _.x(u,Promise.all(m),5);case 5:return n=u.f,p=n[0],q=n[1]||n[0],u["return"](ZK(p.data,q.data));case 4:if(d!==_.Og){u.C(6);break}return _.x(u,dL(a,c,g),7);case 7:return t=u.f,u["return"](YK(t.data));case 6:if(!_.av((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return u["return"](0);throw new _.N(_.O,4,4030);}})},dL=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=_.oD(b.La(),
|
|
16
|
+
b.la,b.la+2048-1,a.a.attemptParameters),e.type=2,f=_.oD(b.La(),b.la,b.ga,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.F(n,2),g=c?f:e,_.x(n,a.f(g),4);case 4:return h=n.f,n["return"](h);case 2:l=_.H(n);if(7001===l.code||c)throw l;a.g.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS pre-flights.",e.uris[0]);_.F(n,5);return _.x(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.H(n),
|
|
17
|
+
a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.N(_.O,4,4030,"Failed to fetch the media segment.");}})},fL=function(a){this.streams=a},gL=function(a,b){a.streams.forEach(function(c){c.ag=b})},hL=function(a,b){a.streams.forEach(function(c){c.width=b})},iL=function(a,b){a.streams.forEach(function(c){c.height=b})},jL=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},kL=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},lL=function(a,b){var c=
|
|
18
|
+
a.streams.find(function(d){d=d.S;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.S.find(function(d){return d.position===b})||null},mL=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},nL=function(a){this.a=a},oL=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},pL=function(a,b){var c=new Set(a.map(function(d){return d.sa}));return b.filter(function(d){return!c.has(d.sa)})},
|
|
19
|
+
rL=function(a,b){for(;a[0].sa<b[0].sa;)a.splice(0,1);var c=a[0],d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||qL(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&qL(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},wL=function(a,b,c,d,e){var f=b[0].length();f=BK(f).map(function(g){var h=oL(b,g)||[],l=mL(c,g)||[];g=mL(d,g)||[];var m=_.kh(sL(h)).concat(_.kh(l),_.kh(g)).filter(Boolean);tL(m);var n=m[0];m=n.sa;n=n.duration;return{configurationId:a,variants:h,
|
|
20
|
+
textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,sa:m}});e&&uL(f[0]);vL(f);return f},sL=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},uL=function(a){var b=sL(a.variants)[0].S[0].Ga;a.startTime+=b;a.endTime+=b},vL=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}},qL=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=
|
|
21
|
+
b.duration;xL(a.variants,b.variants);yL(_.Y.Of(a),_.Y.Of(b))},xL=function(a,b){var c=new Map(a.map(function(d){return[_.Y.Sh(d),d]}));b.forEach(function(d){c.get(_.Y.Sh(d)).drmInfos=d.drmInfos})},yL=function(a,b){var c=new Map(a.map(function(d){return[d.Bc,d]}));b.forEach(function(d){var e=c.get(d.Bc);e.S=d.S;d.S.forEach(function(f){f.initSegment=e.initSegmentReference});e.segmentIndex.replace(d.S);e.tc=d.tc;e.uf=d.uf;e.duration=d.duration;e.Yh=d.Yh;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=
|
|
22
|
+
d.keyId})},tL=function(a){var b=zL(a);a.forEach(function(c){_.jD(c.segmentIndex,b);c.duration=b;c.uf=c.tc+b})},zL=function(a){var b=Infinity;_.Y.Ql(a).forEach(function(c){b=Math.min(b,c.duration)});return b},DL=function(a){if(!(2>a.length)&&AL(a)){a=a.map(function(e){return{playlist:e,Uh:BL(e.S[0])}});var b=a.map(function(e){return e.Uh}),c=Math.max.apply(Math,_.kh(b));b=Math.min.apply(Math,_.kh(b));if(!(1E3>c-b)){a.forEach(function(e){for(var f=e.playlist,g=e.Uh;0<f.S.length&&1E3<c-g;){e=f.S.shift();
|
|
23
|
+
var h=f.S[0];if(!h)break;CL(e,h);h=BL(h);null!=h?g=h:(e=_.Y.kj(e.Y).duration,g+=1E3*e)}});a=a.map(function(e){return e.playlist});if(a.some(function(e){return 0===e.S.length}))throw new _.N(_.O,4,4048,"Media playlists are completely out of sync.");var d=Math.min.apply(Math,_.kh(a.map(function(e){return e.S.length})));a.forEach(function(e){for(;e.S.length>d;)e.S.pop()})}}},AL=function(a){return a.every(function(b){return!!BL(b.S[0])})},BL=function(a){if(!a)return null;a=_.Y.Ua(a.Y,qK);if(!a)return null;
|
|
24
|
+
a=Date.parse(a.value);return isNaN(a)?null:a},CL=function(a,b){a&&b&&[oK,nK].forEach(function(c){if(!_.Y.Lc(b.Y,c)){var d=a.Y.filter(function(e){return e.name===c});0!==d.length&&d.forEach(function(e){b.Y.push(e)})}})},EL=function(){var a=this;this.a=this.F=null;this.h=1;this.j=new VK;this.o="";this.U=new KK;this.H=0;this.w=null;this.l=new _.ej(function(){a.gc()});this.A=_.Ub;this.f=null;this.G=new _.im;this.K=this.D=null;this.g=new _.L("clpp.hls.HlsParser");this.L=new Map;this.Z=new cL(this.jg.bind(this));
|
|
25
|
+
this.R=!1;this.I=null;this.O=!1;this.B=new Map;this.J=new Set},FL=function(a){if(null===a.w)return[];a=a.w;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.Bc})},GL=function(a,b){var c=new Set(b.map(function(h){return h.id}));a.B.forEach(function(h,l){c.has(l)||a.B["delete"](l)});for(var d=_.v(b),e=d.next();!e.done;e=d.next()){e=e.value;var f=a.B.get(e.id);if(f&&f.Ie!==e.Ie)a.F.onError(new _.N(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+e.id));var g=
|
|
26
|
+
{configurationId:a.F.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,Ie:e.Ie,endTime:e.endTime,id:e.id,type:_.re,eventElement:null};f&&!_.M.Ki(f,g)||a.B.set(e.id,g)}return Array.from(a.B.values())},PL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,B,A,C,E,D;return _.I(function(J){switch(J.a){case 1:c=_.uu;d=HL(a,b,a.o,"");if(1===d.type){e=d.S[0].a;f=DK(e);if(!f)throw new _.N(_.O,4,4021,"Unknown file extension "+e);g="";f===c.VIDEO?g="avc1.42E01E":
|
|
27
|
+
f===c.AUDIO&&(g="mp4a.40.2");d=UK(a.U,a.o,a.a.hlsDefaultCodecs||g)}h=_.Y.bo(d.Y);l=IL(h.Rc.uh);l.forEach(function(P){a.J.add(P.groupId)});return _.x(J,JL(a,h),4);case 4:m=J.f;J.C(3);break;case 5:m=J.f;case 3:n=m;p=n.Rm;q=n.periods;t=n.no;u=n.Po;y=n.alternativeVariants;B=n.alternativeTextStreams;A=n.alternativeImageStreams;if(!a.F)throw new _.N(_.O,7,7001);KL(a,q);C=LL(a,p.delay,q,t);ML(a)||(a.H=p.Ke,NL(a));OL(a,C,q);E=GL(a,u);D={presentationTimeline:C,periods:q,minBufferTime:0,cues:E,muxedAudioTracks:l};
|
|
28
|
+
y&&(D.alternativeVariants=y);B&&(D.alternativeTextStreams=B);A&&(D.alternativeImageStreams=A);a.g.debug("HLS playlist parsed",D);return J["return"](D)}})},IL=function(a){return a.filter(function(b){return b.name===_.Ja&&_.T(b,_.Kb)===_.ja&&!_.T(b,_.Mb)}).map(function(b){var c=_.Y.hi(b),d=_.T(b,_.Za)||_.Cg;return{groupId:_.Sp(b,_.Qa),id:_.jK++,label:_.Sp(b,_.fb),language:d,channelsCount:c,primary:"YES"===_.T(b,"DEFAULT")}})},SL=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=
|
|
29
|
+
_.Y,_.x(p,QL(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;g=d.ek;h=a.f.periods[0].variants;a.a.lowLatencyMode&&null!==a.w&&(h=h.filter(function(q){return q.id===a.w.id}));l=h.map(function(q){var t=c.bi(q.audio,g),u=c.bi(q.video,g);q=RL(a,t,u,q.bandwidth);if(!q)throw new _.N(_.O,4,4047,{message:"Video and audio are encrypted in an incompatible way.",Tp:u?u.bc():void 0,audio:t?t.bc():void 0});return q});m=a.F.configurationId;n=wL(m,l,e,f,!0);return p["return"](n)})},QL=function(a,b){var c,d,e,f,g,
|
|
30
|
+
h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.uu,d=function(q){return q.stream.a()===c.VIDEO||q.stream.a()===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),g=function(q){q=q.map(function(t){var u=t.stream.streams[0];t=Object.assign({},{playlist:t.playlist},{language:u.language,channelsCount:u.channelsCount,spatialAudio:u.spatialAudio,closedCaptions:u.closedCaptions,primary:u.primary,kind:u.kind||null,groupId:u.groupId,type:u.type,codecs:u.codecs,name:u.originalId,uri:u.Bc,Ne:{width:u.width,
|
|
31
|
+
height:u.height,frameRate:u.frameRate}});return TL(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;UL(a,h.concat(l));m=l.filter(function(q){return q.a()===c.mh});n=l.filter(function(q){return q.a()===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,ek:h})})},UL=function(a,b){b.forEach(function(c){a.j.a.set(c.bc(),c)})},JL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,B,A,C;return _.I(function(E){switch(E.a){case 1:return c=_.Y,d=c.Vn(b.Rc.closedCaptions),
|
|
32
|
+
e=VL(a,b.Me),_.x(E,WL(a,b),2);case 2:return f=E.f,g=Object.values(f).flat().map(function(D){return D.playlist}),h=g[0],l=c.lj(h.Y),a.A=l,XL(a,g),!ML(a)&&DL(g),a.K=c.mj(h.Y),m=c.ao(h.Y,l,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod),_.x(E,YL(a,f.vh,e),3);case 3:return n=E.f,_.x(E,ZL(a,f.Me,n,d),4);case 4:return p=E.f,_.x(E,$L(a,f.Lo,e),5);case 5:return q=E.f,_.x(E,aM(a,f.rg),6);case 6:return t=E.f,u=a.F.configurationId,y=wL(u,p,q,t,!ML(a)),a.F.filterAllPeriods(y),B=_.kh(f.Me).concat(_.kh(f.vh)).map(function(D){return D.playlist}),
|
|
33
|
+
A=bM(a,B),C=cM(a,B,A),E["return"]({periods:y,no:A,Po:C,Rm:m})}})},eM=function(a,b){var c,d,e,f,g;return _.I(function(h){if(1==h.a)return c=_.Cn(b.verbatimUri,a.o),_.x(h,dM(a,c),2);d=h.f;e=d.response;f=d.text;g=e.uri;return h["return"](HL(a,f,g,b.verbatimUri))})},KL=function(a,b){ML(a)||2!==a.a.timeline.version||(a.I||(a.I=b[0].startTime),_.NE(b,-a.I))},cM=function(a,b,c){b=b.find(function(g){return null!==_.Y.Ua(g.Y,lK)});if(!b)return[];if(null===c)throw new _.N(_.O,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");
|
|
34
|
+
var d=b.Y.filter(function(g){return g.name===lK});b=new Map;d=_.v(d);for(var e=d.next();!e.done;e=d.next()){e=e.value;var f=_.T(e,"ID");f=f?b.get(f):void 0;(e=_.Y.Wn(e,c,a.D,!ML(a),f))&&b.set(e.id,e)}return Array.from(b.values())},bM=function(a,b){var c=b.flatMap(function(e){return e.S[0].Y});c=_.Y.Ua(c,qK);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},WL=function(a,b){var c,
|
|
35
|
+
d,e,f,g,h;return _.I(function(l){if(1==l.a)return _.x(l,Promise.all([fM(a,b.Rc.uh),fM(a,b.Rc.Mo),fM(a,b.Me),fM(a,b.rg)]),2);c=l.f;d=_.v(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({vh:e,Lo:f,Me:g,rg:h})})},hM=function(a,b){return Promise.all(b.map(function(c){return gM(a,c)}))},VL=function(a,b){for(var c=_.Y.hf,d=new Map,e=_.v(b),f=e.next();!f.done;f=e.next()){var g=f.value,h=_.T(g,_.ja);f=_.T(g,_.Tb);var l=_.T(g,_.Bb);g=iM(a,g);if(l){var m=_.Op(_.Fn,
|
|
36
|
+
g);d.set(c(_.Fn,l),m);l=g.indexOf(m);-1<l&&g.splice(l,1)}h&&(l=jM(_.Oc,g),d.set(c(_.Oc,h),l));f&&(h=jM(_.Ng,g),d.set(c(_.Ng,f),h))}return d},$L=function(a,b,c){return Promise.all(b.map(function(d){return kM(a,d,c)}))},aM=function(a,b){return Promise.all(b.map(function(c){return lM(a,c)}))},YL=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=[kM(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 kM(a,
|
|
37
|
+
g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.Qo(e))})},ZL=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,u;return _.I(function(y){if(1==y.a){e=new Set;f=_.kh(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.Sp(f[l].tag,_.oa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.x(y,mM(a,n,c,d,e),2)}if(3!=y.a)return p=y.f,q=f.map(function(B){return mM(a,B,c,d,e)}),_.x(y,Promise.all(q),3);t=y.f;t.splice(g,0,p);u=t.reduce(_.DC,[]);return y["return"](u)})},nM=function(a,b,c){var d;return _.I(function(e){if(1==
|
|
38
|
+
e.a)return _.x(e,TL(a,{playlist:c,codecs:b.codecs,type:b.type,yd:b.originalLanguage,zc:b.id,groupId:b.groupId,primary:b.primary,kind:b.kind||null,name:b.label,channelsCount:b.channelsCount,spatialAudio:b.spatialAudio||!1,closedCaptions:b.closedCaptions,Ne:{width:b.width,height:b.height,frameRate:b.frameRate}}),2);d=e.f;b.bandwidth&&kL(d,b.bandwidth);return e["return"](d)})},mM=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(_.Sp(h,_.oa)),m=f.eo(h),
|
|
39
|
+
_.x(p,oM(a,b,m,c,d),2)):(n=p.f)?p["return"](pM(a,n,l,e)):p["return"]([])})},qM=function(a,b,c,d,e,f){var g=iM(a,b);a.g.debug("Guessing stream type for",b.toString());b=!1;var h=_.Op(_.Ng,g),l=d+e;1!==g.length||c||h?!l&&1<g.length?(a.g.debug("Guessing multiplexed audio+video"),c=_.Ng,g=[g.join(",")]):d&&f?(a.g.debug(sK),c=_.Oc,b=!0):e?(a.g.debug(sK),c=_.Oc):(a.g.debug("Guessing video-only"),c=_.Ng):(c=_.Oc,a.g.debug(sK));return{type:c,dk:g,zm:b}},oM=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,u,y,B,
|
|
40
|
+
A,C,E,D,J;return _.I(function(P){if(1==P.a)return f=_.uu,g=_.Y.hf,h=b,l=h.tag,m=h.playlist,n=_.T(l,_.ja),p=_.T(l,_.Tb),q=n?d.get(g(f.AUDIO,n))||[]:[],t=p?d.get(g(f.VIDEO,p))||[]:[],u={audio:q,video:t},y=m.verbatimUri,B=u.audio.find(function(U){return U.bc()===y}),A=qM(a,l,c,u.audio.length,u.video.length,B),C=A.type,E=A.dk,D=A.zm,J=null,D?P.C(2):_.x(P,rM(a,b,E,C,e,c),3);2!=P.a&&(J=P.f);if(null==J)return P["return"](null);u[C]=[J];C===f.AUDIO&&c&&u.video.forEach(function(U){hL(U,c.width);iL(U,c.height);
|
|
41
|
+
jL(U,c.frameRate)});return P["return"](u)})},pM=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.v(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.v(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.Hl(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=RL(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},RL=function(a,b,c,d,e){for(var f=[],g=(c||
|
|
42
|
+
b).length(),h=0;h<g;h++){var l=b?b.streams[h]||null:null,m=c?c.streams[h]||null:null,n=_.Y.em(l,m);if(!n)return null;var p=d;l={id:e?e:a.h++,language:l?l.language:_.Cg,primary:!!l&&l.primary||!!m&&m.primary,audio:l,video:m,bandwidth:p,drmInfos:n,allowedByApplication:!0,allowedByKeySystem:!0};f.push(l)}return new nL(f)},kM=function(a,b,c){var d,e,f,g;return _.I(function(h){d=b;e=d.tag;f=d.playlist;g=f.verbatimUri;return h["return"](sM(a,g,function(){var l,m,n,p,q,t,u,y,B,A,C,E,D;return _.I(function(J){if(1==
|
|
43
|
+
J.a){l=_.uu;m=_.Y.hf;n=_.Sp(e,_.Qa);p=_.Y.Rh(_.Sp(e,_.Kb));q=_.Y.Dl(e);t=c.get(m(p,n))||"";u=_.T(e,_.Za);y=_.T(e,_.fb);B=_.T(e,"DEFAULT");A=p===l.AUDIO?_.Y.hi(e):null;var P=p===l.AUDIO?(P=_.T(e,"CHANNELS"))?P.includes("/JOC"):!1:!1;C=P;E="YES"===B;return _.x(J,TL(a,{playlist:f,codecs:t,type:p,yd:u,primary:E,name:y,channelsCount:A,spatialAudio:C,groupId:n,kind:q,zc:null,closedCaptions:null,Ne:null}),2)}D=J.f;return J["return"](D)})}))})},lM=function(a,b){var c,d,e,f;return _.I(function(g){c=b;d=c.tag;
|
|
44
|
+
e=c.playlist;f=e.verbatimUri;return g["return"](sM(a,f,function(){var h,l,m,n,p;return _.I(function(q){if(1==q.a)return h=_.T(d,_.ta)||"jpg",l=_.T(d,_.Za),m=_.T(d,_.fb),_.x(q,TL(a,{playlist:e,codecs:h,type:_.ue,yd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,zc:null,groupId:null,Ne:null}),2);n=q.f;(p=_.T(d,_.oa))&&kL(n,Number(p));return q["return"](n)})}))})},iM=function(a,b){var c=_.T(b,_.ta,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);c=
|
|
45
|
+
_.Y.Ll(c);var d=new Set,e=[];c=_.v(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.JC(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},rM=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=_.uu;n=l.verbatimUri;return p["return"](sM(a,n,function(){var q,t,u,y,B;return _.I(function(A){if(1==A.a){q=_.T(h,_.ra);t=null;d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q));var C=_.T(h,_.ja)||void 0;u=C&&a.J.has(C)?C:void 0;C=jM(d,c);if(u){var E=
|
|
46
|
+
jM(_.Oc,c);C+=","+E}y=C;return _.x(A,TL(a,{playlist:l,codecs:y,type:d,closedCaptions:t,primary:!1,kind:null,yd:null,name:null,channelsCount:null,spatialAudio:!1,zc:null,groupId:null,muxedAudioId:u,Ne:f}),2)}B=A.f;return A["return"](B)})}))})},sM=function(a,b,c){if(a.j.has(b))return a=a.j.get(b),Promise.resolve(a);if(a.j.f.has(b))return a.j.f.get(b)||null;c=c();a.j.set(b,c);return c},TL=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,u,y,B,A,C,E,D,J,P,U,V,sa;return _.I(function(Da){if(1==Da.a){c=tM;d=uM;
|
|
47
|
+
e=_.uu;f=b;g=f.playlist;h=f.codecs;l=f.type;m=f.yd;n=f.zc;p=f.groupId;q=f.muxedAudioId;t=f.primary;u=f.kind;y=f.name;B=f.channelsCount;A=f.spatialAudio;C=f.closedCaptions;E=f.Ne;D=_.Y.li(m);if(1!==g.type)throw new _.N(_.O,4,4017);return _.x(Da,vM(a,g,l,h),2)}J=Da.f;P=a.a.lowLatencyMode?d.Qj:d.Sj;U=u;l!==e.TEXT||u||(U=_.kg);V=_.Y.lj(g.Y);sa=J.map(function(wa){var Ea=wa.S,Ma=wa.Nl,xb=wa.mimeType,fe=wa.sa,vf=Ea[0].startTime,xg=Ea[Ea.length-1].endTime,Cu=xg-vf,id=new _.TD(Ea),An=Ea[0].initSegment||null;
|
|
48
|
+
return{id:null===n?_.jK++:n,originalId:y,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:id.md.bind(id),getSegmentReference:id.get.bind(id),adjustSegmentDurations:id.Od.bind(id),getDuration:id.getDuration.bind(id),segmentIndex:id,segmentLookupStrategy:P,initSegmentReference:An,mimeType:xb,codecs:h,kind:U,Yh:Ma.type,encrypted:Ma.type===c.Vj,aesEncrypted:wa.aesEncrypted,keyId:Ma.keyId,language:D,originalLanguage:m||_.Cg,label:y,type:l,primary:t,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
49
|
+
frameRate:E?E.frameRate:void 0,width:E?E.width:void 0,height:E?E.height:void 0,bandwidth:void 0,roles:[],channelsCount:B,spatialAudio:A,closedCaptions:C,S:Ea,drmInfos:Ma.drmInfos,sa:fe,Bc:g.verbatimUri,ag:g.a,tc:vf,uf:xg,duration:Cu,groupId:p,Kp:V,muxedAudioId:q}});return Da["return"](new fL(sa))})},fM=function(a,b){var c;return _.I(function(d){if(1==d.a)return _.x(d,Promise.all(b.map(function(e){var f;return _.I(function(g){if(1==g.a)return _.x(g,wM(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:
|
|
50
|
+
null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},wM=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a){c=_.Y.Lm(b);d=_.T(b,_.Mb,void 0,{required:c});if(!d)return p["return"](null);e=_.Cn(d,a.o);f=Date.now();return _.x(p,dM(a,e),2)}g=p.f;h=g.response;l=g.text;m=Date.now();a.F.onEvent(new _.Q(yK,{detail:{duration:m-f,type:"media"}}));n=h.uri;return p["return"](HL(a,l,n,d))})},gM=function(a,b){var c,d,e,f,g,h,l,m;return _.I(function(n){if(1==n.a){var p=new URL(b.streams[0].ag);
|
|
51
|
+
if(a.a.lowLatencyMode&&a.K&&a.K.Ah){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var t=q.a,u=t.length-1;q={Um:q.position,fo:t&&0<t.length?u:null}}else q=null;q&&(t=p.searchParams,u=q.fo,t.set("_HLS_msn",q.Um.toString()),null===u&&t.get(wK)&&t["delete"](wK),null!==u&&t.set(wK,u.toString()))}c=p.toString();return _.x(n,dM(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.bc();h=b.streams[0].ag;l=e.uri;h!==l&&(h=l,gL(b,h));m=HL(a,f,h,g);return n["return"]({stream:b,playlist:m})})},
|
|
52
|
+
HL=function(a,b,c,d){a=NK(a.U,b,c);a.verbatimUri=d;return a},xM=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.N(_.O,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},LL=function(a,b,c,d){var e=!0,f=null,g=0;ML(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.wD(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.zD(a,e);yM(a,c);d&&_.yD(a,d);return a},zM=function(a,b,c){a=_.Y.rc(a.Y,oK);if(1<a.length)throw new _.N(_.O,
|
|
53
|
+
4,4020);a=a[0];if(!a)return null;var d=_.Sp(a,_.Mb),e=_.Cn(d,b);b=_.Y.ij(a,null,!0);return new _.TC(function(){return[e]},b.la,b.ga,c)},BM=function(a,b,c,d,e,f,g){var h=[],l={};b=_.v(AM(b.f));for(var m=b.next();!m.done;l={Tf:l.Tf},m=b.next()){var n=m.value;m=n.zi;n=n.item;var p=0===m,q=p?a:h[h.length-1],t=p?d:q.endTime,u=Number(_.T(n,_.Ha));u=t+u;p=_.Y.ij(n,p?null:q.ga,p);q=_.T(n,_.Mb);q=_.Cn(q,g);l.Tf=q?[q]:[];t=new _.Vp(c,t,u,function(y){return function(){return y.Tf}}(l),p.la,p.ga,e,f,!1,null,
|
|
54
|
+
null,null,null);if("YES"===_.T(n,"INDEPENDENT")||0===m)t.h=!0;h.push(t)}return h},CM=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.Y,q=c.a;0<_.Y.rc(p,oK).length&&(n=zM(c,l,g));var t=null!=q,u=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={la:0,ga:null};var y=null;t?(c=_.Y.kj(p).duration,a=e+c,q=_.Y.jj(p,b?b.ga:null)):(b=BM(b,c,d,e,f,g,l),a=b[b.length-1].endTime,y=b);h=h===_.ue?_.Y.co(p):null;d=new _.Vp(d,e,a,function(){return u},q.la,q.ga,f,g,!1,null,h?h.oe:null,h?h.Le:null,h?h.durationPerTile:
|
|
55
|
+
null,y,n);d.sa=m;return d},vM=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,u,y,B;return _.I(function(A){switch(A.a){case 1:return e=_.Y,f=DM,g=b.verbatimUri,h=b.S,l=e.km(b.Y,pK),m=[],_.x(A,EM(a,b.a,g,h,l,c,d),2);case 2:n=A.f,p=l,q=f.Jo(h),t=0;case 3:if(!(t<q.length)){A.C(5);break}u=q[t];y=m[m.length-1]||null;return _.x(A,FM(a,b.a,u,p,n,c,d,y),6);case 6:B=A.f;m.push(B);p+=u.length;t++;A.C(3);break;case 5:return xM(m),A["return"](m)}})},EM=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,u,y,B,A;return _.I(function(C){if(1==
|
|
56
|
+
C.a){h=d[0];if(null!=a.D)return C["return"](a.D);if(!ML(a)&&a.f)try{var E=a.j.get(c),D=E?lL(E,e)||null:null;if(!D)throw new _.N(_.O,4,4030,"Segment not found in pervious playlist update.");l=D.startTime+D.Ga;a.g.debug(vK+l+".");a.D=l;return C["return"](l)}catch(J){if(m=a.j.get(c))n=m.streams[0].S[0].position,C=m.streams[m.streams.length-1].S,p=C[C.length-1].position,q=e,t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+t+"."),b,m);throw new _.N(_.O,4,
|
|
57
|
+
4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.x(C,GM(a,f,g,h),2)}if(3!=C.a)return u=C.f,y=HM.fj(h.Y,a.o,e),B=zM(h,b,y),_.x(C,IM(a,B,h,y,u,g),3);A=C.f;a.g.debug(vK+A+".");a.D=A;return C["return"](A)})},FM=function(a,b,c,d,e,f,g,h){var l,m,n,p,q,t,u,y,B,A,C,E,D,J,P,U,V,sa,Da,wa,Ea,Ma;return _.I(function(xb){switch(xb.a){case 1:return l=HM,m=c[0],n=null==h,_.x(xb,GM(a,f,g,m),2);case 2:p=xb.f;q=l.Yn(c,p,h?h.Pm:null);t=q[q.length-1];u=HM.ra(q);
|
|
58
|
+
y=h?h.Qm:null;B=JM(y,m.Y,a.o,d);A=zM(m,b,B)||(h?h.Bm:null);C=m.sa;if(n){E=e;xb.C(3);break}return _.x(xb,KM(a,C,A,m,d,B,p,g),4);case 4:E=xb.f;case 3:D=E;J=[];P=!1;for(U=0;U<c.length;U++)if(V=c[U],sa=J[J.length-1]||null,Da=0===U?0:sa.endTime,wa=d+U,(y=Ea=JM(y,V.Y,a.o,wa))&&(P=!0),Ma=CM(a,sa,V,wa,Da,D,Ea,f,b,C,A))A=Ma.initSegment,J.push(Ma);return xb["return"]({S:J,Nl:u,Pm:t,aesEncrypted:P,mimeType:p,endTime:J[J.length-1].endTime,sa:C,Bm:A,Qm:y})}})},JM=function(a,b,c,d){return b.some(function(e){return e.name===
|
|
59
|
+
nK&&"NONE"===_.T(e,tK)})?null:(b=HM.fj(b,c,d))?b:a&&a.generatedIv?Object.assign({},a,{iv:HM.gi(d)}):a},XL=function(a,b){b.forEach(function(c){var d=a.j.get(c.verbatimUri);DM.ik(c,d,!ML(a))});DM.Il(b)},KM=function(a,b,c,d,e,f,g,h){var l;return _.I(function(m){if(1==m.a)return a.L.has(b)?m["return"](a.L.get(b)):_.x(m,IM(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.L.set(b,l);return m["return"](l)})},IM=function(a,b,c,d,e,f){var g;return _.I(function(h){if(null==
|
|
60
|
+
c.a)return h["return"](0);g=_.Y.Fl(c,d);return h["return"](eL(a.Z,b,g,e,f,null!=d))})},jM=function(a,b){if(1===b.length)return b[0];var c=_.Op(a,b);if(null!=c)return c;throw new _.N(_.O,4,4025,{codecList:b});},GM=function(a,b,c,d){var e,f,g;return _.I(function(h){e=d.a;g=(f=_.Y.Ua(d.Y,oK))?_.Sp(f,_.Mb):null;return h["return"](LM(a,b,c,e,g))})},LM=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=_.Qp(f,b,c))return n["return"](g);h=_.Xk([d],a.a.attemptParameters);
|
|
61
|
+
h.method="HEAD";h.type=2;return _.x(n,a.jg(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.N(_.O,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.toLowerCase().split(";")[0])})},OL=function(a,b,c){c=_.Y.mm(c);"LIVE"===a.A||"EVENT"===a.A?(c=Math.max(c,b.K),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.A===_.Ub&&(b.f=c)},NL=function(a){for(var b=0,c=_.v(a.j.values()),d=c.next();!d.done;d=c.next())b=Math.max(b,d.value.streams[0].tc);for(c=
|
|
62
|
+
0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c)for(a.g.debug("Offsetting live streams by",c,"to compensate for rollover"),b=_.v(a.j.values()),d=b.next();!d.done;d=b.next())d=d.value.streams[0],95443.7176888889>d.tc?(a.g.debug("Offset applied to",d.type),d.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",d.type)},dM=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.Xk([b],a.a.attemptParameters),c.type=1,_.x(f,a.jg(c),2);d=f.f;e="";try{e=_.R.ea(d.data)}catch(g){throw new _.N(_.O,
|
|
63
|
+
4,4042);}e=_.R.Ri(e);e=e.trim();return f["return"]({text:e,response:d})})},ML=function(a){return a.A===_.Ub},yM=function(a,b){_.Y.Mm(b,function(c,d){_.DD(a,c.S,d.startTime)});_.vD(a.a,b[0].startTime,b[b.length-1].endTime)},MM=function(){},AM=function NM(a){var c,d,e,f,g,h;return _.Fh(NM,function(l){1==l.a&&(c=-1,e=d=void 0,f=_.v(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.C(0):_.x(l,{zi:c,mo:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.x(l,{zi:c,item:e,mo:d,next:h},5):l.C(5)}c++;d=e;e=
|
|
64
|
+
h;g=f.next();return l.C(2)})},uM={Qj:_.cC,Sj:_.bC},tM={Vj:zK,np:"whole-segment",NONE:_.Se},SK=/^#EXT-X-DEFINE/,TK=/^#(EXT-X-DISCONTINUITY-SEQUENCE|EXT-X-ENDLIST|EXT-X-I-FRAMES-ONLY|EXT-X-MEDIA-SEQUENCE|EXT-X-PART-INF|EXT-X-PLAYLIST-TYPE|EXT-X-SERVER-CONTROL|EXT-X-TARGETDURATION|EXT-X-DATERANGE|EXT-X-VERSION)/;_.r=VK.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)};
|
|
65
|
+
_.r.get=function(a){return this.a.get(a)||null};_.r.values=function(){return Array.from(this.a.values())};_.r.clear=function(){this.f.clear();this.a.clear()};
|
|
66
|
+
var DM={Il:function(a){var b=DM.Yl(a),c=DM.Om(a);a.forEach(function(d){var e=d.S,f=e.findIndex(function(h){return h.sa===b}),g=e.findIndex(function(h){return h.sa===c+1});-1===g&&(g=e.length);d.S=e.slice(f,g)})},ik:function(a,b,c){b=DM.jm(a,b,c);a=_.v(a.S||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.Lc(c.Y,mK)&&b++,c.sa=b},jm:function(a,b,c){var d=_.Y.Ua(a.Y,"EXT-X-DISCONTINUITY-SEQUENCE");if(d)return Number(d.value);d=DM.Dm(b);if(c&&d)try{return DM.Am(a,b)}catch(e){throw new _.N(_.O,4,4024,
|
|
67
|
+
"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}return 0},Dm:function(a){return 0<DM.lm(a)},Jo:function(a){if(0===a.length)return[];var b=[],c=[];a=_.v(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.Lc(d.Y,mK)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},lm:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].S;return a[a.length-1].sa},Am:function(a,b){var c=_.Y.Ua(a.Y,pK);if(!c)throw DM.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),
|
|
68
|
+
Error(rK);c=Number(c.value);var d=lL(b,c);if(!d)throw DM.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(rK);return d.sa},Om:function(a){a=a.map(function(b){return b.S[b.S.length-1].sa});return Math.min.apply(Math,_.kh(a))},Yl:function(a){a=a.map(function(b){return b.S[0].sa});return Math.max.apply(Math,_.kh(a))}};DM.g=new _.L("clpp.hls.DiscontinuityUtils");var OM={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Og)throw new _.N(_.O,4,4041);if(_.Sp(a,tK)===uK)throw new _.N(_.O,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.GC(_.Cd,[{initDataType:_.ag,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":bL,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":bL,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.Sp(a,tK);if(!$K.includes(b))return aL.error("Widevine in HLS is only supported with [",
|
|
69
|
+
$K.join(", "),"], not",b),null;b=_.Sp(a,_.Mb);b=_.Sm(b);b=_.Ni(b.data);b=_.GC(_.Gd,[{initDataType:_.gd,initData:b}],"");if(a=_.T(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},$K=["SAMPLE-AES",uK],aL=new _.L("clpp.hls.DrmParser");var HM={Yn:function(a,b,c){if(_.Y.Lc(a[0].Y,nK)||null===c)return c=HM.gj(a,b),0===c.length?[{type:_.Se,drmInfos:[],keyId:null}]:c;a=HM.gj(a,b);return[c].concat(_.kh(a))},ra:function(a){if(0===a.length)return{type:_.Se,drmInfos:[],keyId:null};if(a.some(function(c){return"whole-segment"===c.type})||a.every(function(c){return c.type===_.Se}))return a[0];a=a.filter(function(c){return c.type===zK});var b=_.Ii(a.flatMap(function(c){return c.drmInfos}));return{keyId:a[a.length-1].keyId,type:zK,drmInfos:b}},
|
|
70
|
+
gj:function(a,b){return HM.Rl(a).map(function(c){return HM.$n(c.Y,b)}).filter(Boolean)},Rl:function(a){return a.filter(function(b){return _.Y.Lc(b.Y,nK)})},$n:function(a,b){var c=_.Y.rc(a,nK).filter(function(e){return"AES-128"!==_.Sp(e,tK)});if(0===c.length)return null;var d=_.Sp(c[0],tK);if(1===c.length&&"NONE"===d)return{type:_.Se,drmInfos:[],keyId:null};d=c.map(function(e){return _.Sp(e,tK)});if(!d.every(function(e){return"SAMPLE-AES"===e})&&!d.every(function(e){return e===uK}))throw HM.g.warn("EXT-X-KEY methods "+
|
|
71
|
+
d.join(", ")+" are incompatible."),new _.N(_.O,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");c=c.map(function(e){var f=_.T(e,"KEYFORMAT","identity"),g=OM[f]||null;(e=g?g(e,b):null)||HM.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===c.length)throw new _.N(_.O,4,4026);return{keyId:c.map(function(e){return e.keyIds}).reduce(function(e,f){return e.concat(f)},[]).reverse()[0]||null,type:zK,drmInfos:c}},Hp:function(){return{type:_.Se,drmInfos:[],keyId:null}},
|
|
72
|
+
fj:function(a,b,c){a=_.Y.rc(a,nK)[0];if(!a||"AES-128"!==_.Sp(a,tK))return null;var d=HM.cm(a,c);c=d.iv;d=d.generatedIv;return{method:"AES-128",url:_.Cn(_.Sp(a,_.Mb),b),iv:c,generatedIv:d}},gi:function(a){return _.Rm(new Uint8Array(12),new Uint8Array([a>>24&255,a>>16&255,a>>8&255,a&255]))},cm:function(a,b){var c=_.T(a,"IV","");if(c)return{iv:_.Om((c||"0x").slice(2)),generatedIv:!1};c=_.T(a,"KEYFORMAT");return null==c||"identity"===c?{iv:HM.gi(b),generatedIv:!0}:{iv:null,generatedIv:!1}}};HM.g=new _.L("clpp.hls.EncryptionUtils");fL.prototype.length=function(){return this.streams.length};fL.prototype.f=function(){return this.streams[0].groupId};fL.prototype.a=function(){return this.streams[0].type};fL.prototype.bc=function(){return this.streams[0].Bc};nL.prototype.length=function(){return this.a.length};_.r=EL.prototype;_.r.configure=function(a){this.a=a;this.Z.a=a};_.r.setCurrentVariant=function(a){this.w=a};_.r.start=function(a,b){var c=this,d,e,f,g,h,l,m;return _.I(function(n){if(1==n.a){if(c.R)throw Error("start() may be called only once!");c.R=!0;c.F=b;d=Date.now();return _.x(n,dM(c,a),2)}if(3!=n.a)return e=n.f,f=e.response,g=e.text,h=Date.now(),c.F.onEvent(new _.Q(yK,{detail:{duration:h-d,type:"master"}})),c.o=f.uri,_.x(n,PL(c,g),3);l=n.f;c.f=l;m=c.H;c.l&&0<m&&c.l.ha(m);return n["return"](l)})};
|
|
73
|
+
_.r.requestStop=function(){this.O=!0};_.r.stop=function(){this.l&&(this.l.stop(),this.l=null);var a=[];this.G&&(a.push(this.G.destroy()),this.G=null);this.j.clear();this.f=this.a=this.F=this.w=null;this.B.clear();this.J.clear();return Promise.all(a)};
|
|
74
|
+
_.r.update=function(){var a=this,b,c,d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:b=a.f;if(ML(a)||!b)return p["return"]();c=b.presentationTimeline;"LIVE"===a.A&&(a.D=null);d=Array.from(a.j.values());a.a.lowLatencyMode&&null!==a.w&&(e=FL(a),d=d.filter(function(q){return e.includes(q.bc())}));return _.x(p,hM(a,d),2);case 2:return f=p.f,g=f.map(function(q){return q.playlist}),XL(a,g),_.x(p,SL(a,f),3);case 3:h=p.f;pL(b.periods,h).forEach(function(q){a.F.filterNewPeriod(q)});KL(a,h);l=bM(a,
|
|
75
|
+
g);m=cM(a,g,l);b.cues=GL(a,m);rL(b.periods,h);yM(c,h);if(n=_.Y.xm(g))!0!==a.a.keepTimelineLive&&(a.A=_.Ub,_.zD(c,!0),c.f=h[h.length-1].endTime),a.l.stop(),a.l=null;if(a.F.onUpdate)a.F.onUpdate(b);if(n&&a.F.onTurnedStatic)a.F.onTurnedStatic();if(!a.O){p.C(4);break}return _.x(p,a.stop(),4);case 4:return p["return"](b)}})};
|
|
76
|
+
_.r.loadVariant=function(a,b){var c=this,d,e,f,g,h,l,m,n,p,q,t,u,y,B,A;return _.I(function(C){if(1==C.a){d=a.id;if(e=c.f.periods.find(function(E){return E.id===b}))if(f=e.variants.find(function(E){return E.id===d}))return C["return"](f);g=c.f.alternativeVariants.find(function(E){return E.id===d});if(!g)throw new _.qi("No alternative variant with id: "+d);h=g;m=l=null;h.audio&&(n=h.audio,l=sM(c,n.verbatimUri,function(){var E;return _.I(function(D){if(1==D.a)return _.x(D,eM(c,n),2);E=D.f;return D["return"](nM(c,
|
|
77
|
+
n,E))})}));h.video&&(p=h.video,m=sM(c,p.verbatimUri,function(){var E;return _.I(function(D){if(1==D.a)return _.x(D,eM(c,p),2);E=D.f;return D["return"](nM(c,p,E))})}));return _.x(C,l,2)}if(3!=C.a)return q=C.f,_.x(C,m,3);t=C.f;if(u=RL(c,q,t,h.bandwidth,h.id))B=c.F.configurationId,A=wL(B,[u],[],[],!ML(c)),c.F.filterAllPeriods(A),A.forEach(function(E,D){c.f.periods[D].variants.push(E.variants[0]);b===c.f.periods[D].id&&(y=E.variants[0])});if(!y)throw new _.qi("Could load variant with id: "+d);return C["return"](y)})};
|
|
78
|
+
_.r.loadTextStream=function(a,b){var c=this,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){(e=c.f.periods.find(function(n){return n.id===b}))&&(f=e.textStreams.find(function(n){return n.id===a})||null)&&(d=f);if(d||!c.f.alternativeTextStreams)return m.C(2);g=c.f.alternativeTextStreams.find(function(n){return n.id===a})||null;if(!g)throw new _.qi(_.JB+a);h=g;return _.x(m,sM(c,h.verbatimUri,function(){var n;return _.I(function(p){if(1==p.a)return _.x(p,eM(c,h),2);n=p.f;return p["return"](nM(c,h,n))})}),
|
|
79
|
+
3)}2!=m.a&&(l=m.f)&&c.f.periods.forEach(function(n,p){var q=l.streams[p];c.f.periods[p].textStreams.push(q);q.id===a&&(d=q)});if(!d)throw new _.qi(_.JB+a);return m["return"](d)})};_.r.gc=function(){var a=this,b,c;return _.I(function(d){if(1==d.a){a.g.debug(_.TB);if(!a.F)return d["return"]();_.F(d,2);return _.x(d,a.update(),4)}if(2!=d.a)return a.l&&0<a.H&&a.l.ha(a.H),_.G(d,0);b=_.H(d);if(!(b instanceof _.N))throw b;a.F&&(a.F.onError(b),c=b,1===c.severity&&a.l&&a.l.ha(.1));_.z(d)})};
|
|
80
|
+
_.r.jg=function(a){if(!this.G)throw new _.N(_.O,7,7001);a=this.F.networkingEngine.fetch(a);_.km(this.G,a);return a.T};_.w(MM,_.ev);MM.prototype.install=function(){_.cw.m3u8=EL;_.bw[_.Vl]=EL;_.bw[xK]=EL};MM.prototype.uninstall=function(){_.tE("m3u8");_.uE(_.Vl);_.uE(xK)};MM.prototype.id=function(){return"hls"};_.K("clpp.hls.HlsComponent",MM);};
|
|
80
81
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
81
82
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
82
83
|
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 uU=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.M.
|
|
3
|
-
xU=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.
|
|
4
|
-
zU=function(a){return a.some(function(b){return b.kind===_.
|
|
5
|
-
c.mode=_.
|
|
6
|
-
a.m.getTrackManager().
|
|
7
|
-
_.K("clpp.hlssmpte.HlsSmptePlugin",DU);DU.Id="hlssmpte";EU.prototype.create=function(){return new DU};_.
|
|
2
|
+
var f=function(window){var uU=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.M.P(a)){a:{var b=a.info;if(_.M.ia(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.M.ia(a)?a:null}},wU=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.si;this.h=(a=_.Mv(_.Lc))?new a(this.m.getConfiguration()):null;this.g=new _.L("clpp.hlssmpte.ImageCueHandler");this.f=null;vU(this)},vU=function(a){a.a.one(a.m,_.Ee,function(){return xU(a)})},
|
|
3
|
+
xU=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Ac,function(d){return yU(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Me}).forEach(function(d){yU(a,{track:d})});!zU(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."),AU(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
|
+
zU=function(a){return a.some(function(b){return b.kind===_.Me})},AU=function(a,b){var c=a.m.getTrackManager(),d=c.oa(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ha(d)};a.a.on(b.textTracks,_.Ac,function(g){g.track.kind===_.Me&&(a.a.off(b.textTracks,_.Ac,f),f())});c.Ha(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},yU=function(a,b){var c=b.track;c.kind===_.Me&&(a.g.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.qe,a.a.on(c,_.Md,function(d){return BU(a,d)}))},BU=function(a,b){var c=CU(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 uU(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.R.eb(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)}}})},CU=function(a){return(a=
|
|
6
|
+
a.m.getTrackManager().wa())&&a.language&&a.language.toLowerCase()},DU=function(){this.a=null;this.f=!1},EU=function(){};wU.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.w(DU,_.ew);DU.prototype.onPlayerCreated=function(){};DU.prototype.onContentWillLoad=function(a){if(this.f=_.oj()){var b=a.getConfiguration();b=_.M.ib(b.hlssmpte||{});_.M.Ei(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.M.ya(b.timestampOffset)||(b.timestampOffset=0);this.a=new wU(a,b.patchMetadataTrack,b.timestampOffset)}};DU.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.x(b,a.a.destroy(),3):b.C(0);a.a=null;_.z(b)})};DU.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.K("clpp.hlssmpte.HlsSmptePlugin",DU);DU.Id="hlssmpte";EU.prototype.create=function(){return new DU};_.dp(new EU);};
|
|
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));}
|