@castlabs/prestoplay 6.3.0 → 6.4.1
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 +70 -1
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +108 -107
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +426 -398
- package/cjs/cl.crypto.js +10 -10
- package/cjs/cl.dash.js +72 -69
- package/cjs/cl.externs.js +79 -155
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +47 -44
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -32
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +259 -254
- package/cjs/cl.muxdata.js +12 -12
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.smooth.js +69 -69
- package/cjs/cl.thumbnails.js +24 -23
- package/cjs/cl.tizen.js +70 -70
- package/cjs/cl.ttml.js +27 -26
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +18 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +20 -19
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +365 -348
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -63
- package/cl.externs.js +74 -154
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +39 -37
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +16 -16
- package/cl.mse.js +233 -222
- package/cl.muxdata.js +8 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +58 -58
- package/cl.thumbnails.js +17 -17
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -21
- 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.youbora.js +16 -15
- package/package.json +4 -2
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.A=[];this.m=[];this.w=[];this.j=new _.
|
|
4
|
-
_.
|
|
5
|
-
a.a.registerVideoDisplayBase(
|
|
6
|
-
_.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.
|
|
7
|
-
_.B("clpp.freewheel.FreeWheelPlugin",
|
|
8
|
-
_.t.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.t.getSkipTimeOffset=function(){return 0};_.t.
|
|
9
|
-
_.t.
|
|
10
|
-
_.t.getPodIndex=function(){switch(this.
|
|
11
|
-
_.t.getWrapperCreativeIds=function(){return[]};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_.t.load=function(){var a=this,b,c,d,e,f,g,
|
|
16
|
-
_.u(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,
|
|
17
|
-
g.next())l=
|
|
18
|
-
_.t.resume=function(){this.f&&this.f.resume()};_.t.pause=function(){this.f&&this.f.pause()};_.t.skip=function(){this.f&&this.f.skipCurrentAd()};_.t.getVolume=function(){return this.a?this.a.getAdVolume():1};_.t.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.t.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.t.dispose=function(){var a=this;return _.A(function(b){a.g.release();a.h&&(a.h.stop(),a.h=null);
|
|
19
|
-
_.t.
|
|
20
|
-
void 0));this.j.resolve()};_.t.
|
|
21
|
-
_.t.
|
|
22
|
-
_.
|
|
23
|
-
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.t.
|
|
24
|
-
_.t.
|
|
25
|
-
|
|
2
|
+
var f=function(window){var aK="clpp-freewheel",bK="clpp.freewheel.AdsManagerFactory",cK="freewheel",dK=function(){this.f=this.a=null},eK=function(){},fK=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""}},gK=function(a,b,c){this.g=a;this.f=b;this.a=c},hK=function(a){this.a=a},iK=function(a){this.B=new _.H("clpp.freewheel.AdsManager");this.l=a;this.g=new _.cg;this.o=new tv.freewheel.SDK.AdManager;
|
|
3
|
+
this.f=this.a=null;this.A=[];this.m=[];this.w=[];this.j=new _.Mh;this.h=null},jK=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.te&&b.push("serverUrl");typeof a.profileId!==_.te&&b.push("profileId");typeof a.videoAssetId!==_.te&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.L(1,9,12001,{missingKeys:b.join(", ")});},kK=function(){var a,b,c,d;return _.A(function(e){if(1==e.a)return a=new _.rp,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
|
|
4
|
+
_.y(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.y(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},nK=function(a){return _.A(function(b){if(a.A.length)return lK(a),a.f=a.A.shift(),a.f.play(),b.H(0);mK(a);return _.y(b,a.l.a.play(),0)})},oK=function(a){a.w.length?(lK(a),a.f=a.w.shift(),a.f.play()):mK(a)},lK=function(a){var b=a.l.$b(cK).Dc();b&&(a.l.getSurface().show(b),a.l.getSurface().hideMediaElement(),
|
|
5
|
+
a.a.registerVideoDisplayBase(aK),a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},mK=function(a){var b=a.l.$b(cK).Dc();b&&a.l.getSurface().hide(b);a.l.getSurface().showMediaElement()},pK=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 gK(a.a,c,d)});a.l.trigger(new _.I(b,d))},qK=function(){this.a=new _.H(bK)};_.v(dK,_.cq);_.t=dK.prototype;
|
|
6
|
+
_.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.xn(_.Vc,{id:aK}),this.f=_.xn(_.Pe,{"class":_.Dc}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.L(1,9,12E3))};_.t.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.t.id=function(){return cK};_.t.Dc=function(){return this.a};_.t.di=function(){return this.f};
|
|
7
|
+
_.B("clpp.freewheel.FreeWheelPlugin",dK);dK.prototype.getAdVideo=dK.prototype.di;dK.prototype.getAdContainer=dK.prototype.Dc;dK.Id=cK;dK.AD_CONTAINER_ID=aK;eK.prototype.create=function(){return new dK};_.uo(new eK);_.t=gK.prototype;_.t.sb=function(){return"FreeWheel AdManager SDK"};_.t.tb=function(){return tv.freewheel.SDK.version};_.t.yb=function(){return 0};_.t.getId=function(){return this.a?this.a.getAdId():""};_.t.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.te?a:""};_.t.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.t.getAdSystem=function(){return""};_.t.getAdvertiserName=function(){return""};_.t.getTitle=function(){return""};
|
|
8
|
+
_.t.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.t.getSkipTimeOffset=function(){return 0};_.t.dc=function(){return!1};_.t.Ib=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.t.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
|
|
9
|
+
_.t.vb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.t.ub=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.t.gb=function(){return 0};_.t.Ua=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
|
+
_.t.getPodIndex=function(){switch(this.Ua()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.t.Jb=function(){switch(this.Ua()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.t.Kb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.t.xb=function(){return this.f.getAdCount()};_.t.getWrapperAdIds=function(){return[]};_.t.getWrapperAdSystems=function(){return[]};
|
|
11
|
+
_.t.getWrapperCreativeIds=function(){return[]};gK.prototype.getWrapperCreativeIds=gK.prototype.getWrapperCreativeIds;gK.prototype.getWrapperAdSystems=gK.prototype.getWrapperAdSystems;gK.prototype.getWrapperAdIds=gK.prototype.getWrapperAdIds;gK.prototype.getSequenceLength=gK.prototype.xb;gK.prototype.getPositionInSequence=gK.prototype.Kb;gK.prototype.getPodTimeOffset=gK.prototype.Jb;gK.prototype.getPodIndex=gK.prototype.getPodIndex;gK.prototype.getPodType=gK.prototype.Ua;
|
|
12
|
+
gK.prototype.getMediaBitrate=gK.prototype.gb;gK.prototype.getMediaHeight=gK.prototype.ub;gK.prototype.getMediaWidth=gK.prototype.vb;gK.prototype.getMediaUrl=gK.prototype.getMediaUrl;gK.prototype.getClickThroughUrl=gK.prototype.Ib;gK.prototype.isBumper=gK.prototype.dc;gK.prototype.getSkipTimeOffset=gK.prototype.getSkipTimeOffset;gK.prototype.getDuration=gK.prototype.getDuration;gK.prototype.getTitle=gK.prototype.getTitle;gK.prototype.getAdvertiserName=gK.prototype.getAdvertiserName;
|
|
13
|
+
gK.prototype.getAdSystem=gK.prototype.getAdSystem;gK.prototype.getApiFramework=gK.prototype.getApiFramework;gK.prototype.getCreativeId=gK.prototype.getCreativeId;gK.prototype.getId=gK.prototype.getId;gK.prototype.getTechnology=gK.prototype.yb;gK.prototype.getAdManagerVersion=gK.prototype.tb;gK.prototype.getAdManagerName=gK.prototype.sb;hK.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()}})};hK.prototype.Lb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};hK.prototype.hb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
14
|
+
hK.prototype.hasPostroll=hK.prototype.hb;hK.prototype.hasPreroll=hK.prototype.Lb;hK.prototype.getCuePoints=hK.prototype.getCuePoints;_.t=iK.prototype;
|
|
15
|
+
_.t.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.A(function(m){if(1==m.a){b=a.l.getConfiguration().freewheel||{};try{jK(b)}catch(n){return a.l.onError(n),a.j.resolve(),m["return"](a.j)}a.o.setNetwork(b.networkId);a.o.setServer(b.serverUrl);a.a=a.o.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.te&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.y(m,kK(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.l.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,fK(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Id&&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.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.kj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.oj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.nj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Gi.bind(a));a.g.on(a.l,_.De,a.kh.bind(a));a.g.on(a.l,_.pe,a.jh.bind(a));a.a.submitRequest();return m["return"](a.j)})};_.t.start=function(){var a=this;return _.A(function(b){return _.y(b,nK(a),0)})};
|
|
18
|
+
_.t.resume=function(){this.f&&this.f.resume()};_.t.pause=function(){this.f&&this.f.pause()};_.t.skip=function(){this.f&&this.f.skipCurrentAd()};_.t.getVolume=function(){return this.a?this.a.getAdVolume():1};_.t.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.t.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.t.dispose=function(){var a=this;return _.A(function(b){a.g.release();a.h&&(a.h.stop(),a.h=null);mK(a);a.a&&(a.a.dispose(),a.a=null);_.z(b)})};
|
|
19
|
+
_.t.kj=function(a){var b=this;if(a.success)this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.m=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.w=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.l.trigger(new _.I(_.Wb,{adsTimeline:new hK(this.a)})),this.h=new _.pp(this.l.getSurface(),function(c,d){return b.a.resize(c,d)},this.l.$b(cK).f);else this.l.onError(new _.L(1,9,10003,{errorType:0},
|
|
20
|
+
void 0));this.j.resolve()};_.t.oj=function(a){pK(this,_.Fb,a);this.h.start()};_.t.nj=function(a){this.f=null;a=a.slot;pK(this,_.Gb);this.h.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:nK(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:mK(this);this.l.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:oK(this)}};
|
|
21
|
+
_.t.Gi=function(a){var b=a.subType;this.B.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:pK(this,_.Sb,a);pK(this,_.Lb,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:pK(this,_.Tb,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:pK(this,_.Kb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:pK(this,_.Nb,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:pK(this,_.Ub,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:pK(this,_.Jb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:pK(this,
|
|
22
|
+
_.Ib,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:pK(this,_.Ob,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:pK(this,_.Qb,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:pK(this,_.Rb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:pK(this,_.Hb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:pK(this,_.Pb,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.l.onError(new _.L(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]}))}};_.t.kh=function(){var a=this;if(!this.f){var b=this.l.getPosition();if(this.f=this.m.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.m.findIndex(function(d){return d===a.f});this.m.splice(c,1);this.l.pause();lK(this);this.f.play()}}};
|
|
24
|
+
_.t.jh=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.bn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.an:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Vm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);oK(this);break;case _.Om:case _.Zm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};iK.prototype.getPosition=iK.prototype.getPosition;iK.prototype.setVolume=iK.prototype.setVolume;
|
|
25
|
+
iK.prototype.getVolume=iK.prototype.getVolume;iK.prototype.skip=iK.prototype.skip;iK.prototype.pause=iK.prototype.pause;iK.prototype.resume=iK.prototype.resume;iK.prototype.start=iK.prototype.start;qK.prototype.name=function(){return bK};qK.prototype.aa=function(a,b){return a.namespace()===_.Fc?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)};qK.prototype.create=function(a){return new iK(a)};qK.prototype.create=qK.prototype.create;qK.prototype.isSupported=qK.prototype.aa;qK.prototype.name=qK.prototype.name;_.un(new qK);};
|
|
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,48 +1,51 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
a
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
(
|
|
7
|
-
|
|
8
|
-
4,4017);
|
|
9
|
-
m,
|
|
10
|
-
if(a.m!=
|
|
11
|
-
a.
|
|
12
|
-
-1<r&&p.splice(r,1)}q&&(r=
|
|
13
|
-
r;return _.A(function(
|
|
14
|
-
e.a)return c=b.map(function(f){var g;return _.A(function(
|
|
15
|
-
f,g,
|
|
16
|
-
3);n=q.f;n.splice(d,0,l);p=n.reduce(_.
|
|
17
|
-
p=e.VIDEO,f=[f.join(",")]):n.audio.length&&
|
|
18
|
-
d});b.stream.codecs=c.join(",")}},
|
|
19
|
-
0<_.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
2
|
+
var f=function(window){var FA="CLOSED-CAPTIONS",GA="EXT-X-BYTERANGE",HA="EXT-X-DISCONTINUITY",IA="EXT-X-DISCONTINUITY-SEQUENCE",JA="EXT-X-ENDLIST",KA="EXT-X-MEDIA-SEQUENCE",LA="EXT-X-PART-INF",MA="EXT-X-PLAYLIST-TYPE",NA="EXT-X-PRELOAD-HINT",OA="EXT-X-SERVER-CONTROL",PA="EXT-X-STREAM-INF",QA="EXT-X-TARGETDURATION",RA="EXTINF",SA="GROUP-ID",TA="Guessing audio-only",UA="SAMPLE-AES-CTR",VA="SUBTITLES",WA="application/vnd.apple.mpegurl",XA=function(a,b){var c=a.getAttribute(b);if(!c)throw new _.L(_.M,4,4023,b);return c.value},
|
|
3
|
+
YA=function(a){if(1>a.a)throw _.yk();--a.a},ZA=function(a,b,c,d){this.f=a;this.type=b;this.sa=c;this.a=d||null},$A=function(a,b,c){c=void 0===c?[]:c;this.sa=b;this.a=a;this.f=c},aB=function(a,b){return a.filter(function(c){return c.name==b})},bB=function(a,b){return a.filter(function(c){return XA(c,"TYPE")===b})},cB=function(a,b){var c=aB(a,b);return c.length?c[0]:null},dB=function(a){var b=void 0===b?0:b;return(a=cB(a,KA))?Number(a.value):b},eB=function(a,b){return _.xv([a],[b])[0]},fB=function(){this.a=
|
|
4
|
+
0},kB=function(a,b,c){b=_.oh(b);b=b.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();var d=b.split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(d[0]))throw new _.L(_.M,4,4015);b=0;for(var e=!0,f=_.u(d),g=f.next();!g.done;g=f.next())if(g=g.value,g=g.trim(),!g.length||/^#(?!EXT)/m.test(g)||e)e=!1;else if(g=gB(a,g),--a.a,hB.includes(g.name)){b=1;break}else g.name==PA&&(e=!0);f=[];e=!0;g=_.u(_.EA(d));for(var h=g.next();!h.done;h=g.next()){var l=h.value;h=l.Hd;var m=l.item;l=l.next;m=m.trim();if(!m.length||/^#(?!EXT)/m.test(m)||
|
|
5
|
+
e)e=!1;else{m=gB(a,m);if(iB.includes(m.name)){if(1!=b)throw new _.L(_.M,4,4017);d=d.splice(h,d.length-h);a=jB(a,c,d,f);return new ZA(c,b,f,a)}f.push(m);m.name==PA&&(m.attributes.push(new _.Xg(_.vb,l)),e=!0)}}return new ZA(c,b,f)},jB=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=gB(a,h),hB.includes(h.name)?d.push(h):lB.includes(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===NA&&"PART"===_.Wg(h,"TYPE")&&g.push(h):f.push(h)):/^#(?!EXT)/m.test(h)||(h=eB(b,h.trim()),
|
|
6
|
+
e.push(new $A(h,f,g)),f=[],g=[])});g.length&&e.push(new $A(null,f,g));return e},gB=function(a,b){return _.Ch(a.a++,b)},mB=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},pB=function(){var a=this;this.g=this.j=null;this.ua=1;this.$=0;this.w=new Map;this.ia=new Set;this.f=new Map;this.h=null;this.B="";this.S=new fB;this.da=0;this.X=new Map;this.A=new _.Li(function(){nB(a)});this.m=
|
|
7
|
+
oB;this.K=null;this.D=0;this.G=Infinity;this.C=new _.Qh;this.ca=[];this.O=new Map;this.J=!1;this.o=new Map;this.U=null;this.a=new _.H("clpp.hls.HlsParser");this.I=new Map;this.L=new Map},uB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w;return _.A(function(x){if(1==x.a){c=qB;d=b.Bg;e=new _.Eg(d);if(a.g.hlsLowLatency){f=e.a;if(b.Hg){var C=b.segmentIndex;if(C=C.a[C.a.length-1]){var D=C.a,E=D.length-1;C={Ai:C.position,tj:D&&0<D.length?E:null}}else C=null;g=C;h=g.Ai;l=g.tj;null!==h&&(f.add("_HLS_msn",h),
|
|
8
|
+
null!==l&&f.add("_HLS_part",l))}_.Pg(f);f.g&&_.Hg(e,f)}return _.y(x,rB(a,e.toString()),2)}if(3!=x.a){m=x.f;n=kB(a.S,m.data,m.uri);if(1!=n.type)throw new _.L(_.M,4,4017);p=b.stream;return _.y(x,sB(a,b.Qd,n,p.type,p.mimeType,p.codecs,p.keyInfo||null,b.Vh),3)}q=x.f;b.segmentIndex.replace(q);r=q[q.length-1];if(w=cB(n.sa,JA))tB(a,c.VOD),a.h.Rb(r.endTime);_.z(x)})},yB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w,x,C,D,E,G,K,O,T,Da,ea;return _.A(function(fa){if(1==fa.a){c=kB(a.S,b,a.B);if(1===c.type){a.I.set(a.B,
|
|
9
|
+
c);d=c.a[0].a;e=_.nn;f=new _.Eg(d);g=f.na.split(".").pop();h=vB[e.AUDIO][g];l=vB[e.VIDEO][g];m="";l?m="avc1.42E01E":h&&(m="mp4a.40.2");var xa=a.S,ha=a.B,qa=a.g.hlsDefaultCodecs||m,Ba=[],$a=[];$a.push(new _.Xg(_.na,"0"));$a.push(new _.Xg(_.vb,ha));qa.length&&$a.push(new _.Xg(_.pa,qa));Ba.push(new _.Vg(xa.a++,PA,$a));c=new ZA(ha,0,Ba)}return _.y(fa,wB(a,c.sa),2)}n=fa.f;if(!a.j)throw new _.L(_.M,7,7001);a.j.filterAllPeriods([n]);p=Infinity;q=0;r=Infinity;w=_.u(a.f.values());for(x=w.next();!x.done;x=
|
|
10
|
+
w.next())C=x.value,p=Math.min(p,C.De),q=Math.max(q,C.De),C.stream.type!=_.Ae&&(r=Math.min(r,C.duration));a.m!=oB?(a.h=new _.Vv(0,a.$,!1),_.Zv(a.h,1)):a.h=new _.Vv(null,0,!0);xB(a);if(a.m!=oB){a.da=a.G;D=qB;a.m===D.LIVE&&(E=a.h.Pe,G=Math.max(r,E),isNaN(a.g.availabilityWindowOverride)||(G=a.g.availabilityWindowOverride),a.h.hc=G);for(K=0;95443.7176888889<=q;)K+=95443.7176888889,q-=95443.7176888889;if(K)for(a.a.debug("Offsetting live streams by",K,"to compensate for rollover"),O=_.u(a.f.values()),x=
|
|
11
|
+
O.next();!x.done;x=O.next())T=x.value,95443.7176888889>T.De?(a.a.debug("Offset applied to",T.stream.type),T.segmentIndex.offset(K)):a.a.debug("Offset NOT applied to",T.stream.type)}else for(a.h.Rb(r),a.h.offset(-p),Da=_.u(a.f.values()),x=Da.next();!x.done;x=Da.next())ea=x.value,ea.segmentIndex.offset(-p),_.lw(ea.segmentIndex,r);a.K={presentationTimeline:a.h,periods:[n],offlineSessionIds:[],minBufferTime:0};_.z(fa)})},wB=function(a,b){var c,d,e,f,g,h;return _.A(function(l){switch(l.a){case 1:c=aB(b,
|
|
12
|
+
"EXT-X-MEDIA");d=aB(b,PA);e=aB(b,"EXT-X-IMAGE-STREAM-INF");for(var m=_.u(d),n=m.next();!n.done;n=m.next()){var p=n.value,q=_.Wg(p,"AUDIO");n=_.Wg(p,"VIDEO");var r=_.Wg(p,VA);p=zB(a,p);if(r){var w=_.Rg(_.Ae,p);a.o.set(r,w);r=p.indexOf(w);-1<r&&p.splice(r,1)}q&&(r=AB(_.ic,p),a.o.set(q,r));n&&(q=AB(_.Pe,p),a.o.set(n,q))}return _.y(l,BB(a,c),2);case 2:m=bB(c,FA);m=_.u(m);for(n=m.next();!n.done;n=m.next())p=n.value,n=CB(p),q=XA(p,SA),p=XA(p,"INSTREAM-ID"),a.O.get(q)||a.O.set(q,new Map),a.O.get(q).set(p,
|
|
13
|
+
n);return _.y(l,DB(a,d),3);case 3:return f=l.f,_.y(l,EB(a,c),4);case 4:return g=l.f,_.y(l,FB(a,e),5);case 5:return h=l.f,l["return"]({startTime:0,variants:f,textStreams:g,thumbStreams:h})}})},EB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r;return _.A(function(w){if(1==w.a)return c=bB(b,VA),d=c.map(function(x){var C,D;return _.A(function(E){if(1==E.a)return _.xf(E,2),_.y(E,GB(a,x),4);if(2!=E.a)return C=E.f,E["return"](C.stream);D=_.zf(E);throw D;})}),_.y(w,Promise.all(d),2);e=w.f;f=_.u(c);for(g=f.next();!g.done;g=
|
|
14
|
+
f.next())if(h=g.value,l=XA(h,SA),m=a.o.get(l))if(n=a.w.get(l))for(p=_.u(n),q=p.next();!q.done;q=p.next())r=q.value,r.stream.codecs=m;return w["return"](e.filter(function(x){return x}))})},FB=function(a,b){var c,d;return _.A(function(e){if(1==e.a)return c=b.map(function(f){var g;return _.A(function(h){if(1==h.a)return _.y(h,HB(a,f),2);g=h.f;return h["return"](g.stream)})}),_.y(e,Promise.all(c),2);d=e.f;return e["return"](d.filter(function(f){return f}))})},BB=function(a,b){var c;return _.A(function(d){if(1==
|
|
15
|
+
d.a)return b=b.filter(function(e){var f=_.Wg(e,_.vb)||"";return _.Wg(e,"TYPE")!==VA&&""!==f}),b.length?_.y(d,GB(a,b[0]),2):d.H(2);c=b.slice(1).map(function(e){return GB(a,e)});return _.y(d,Promise.all(c),0)})},DB=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.A(function(q){if(1==q.a){c=function(r){var w,x,C,D,E,G,K;return _.A(function(O){return 1==O.a?(w=_.Wg(r,"FRAME-RATE"),x=Number(XA(r,_.na)),C=_.Wg(r,_.ib),D=_.u(C?C.split("x"):[null,null]),E=D.next().value,G=D.next().value,_.y(O,IB(a,r,C,w),2)):
|
|
16
|
+
(K=O.f)?O["return"](JB(a,K.audio,K.video,x,E,G,w)):O["return"]([])})};d=0;e=Infinity;for(f=0;f<b.length;++f)g=Number(XA(b[f],_.na)),g<e&&(e=g,d=f);h=b.splice(d,1).pop();return _.y(q,c(h),2)}if(3!=q.a)return l=q.f,m=b.map(c),_.y(q,Promise.all(m),3);n=q.f;n.splice(d,0,l);p=n.reduce(_.vv,[]);return q["return"](p.filter(_.Dg))})},IB=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,r,w,x,C,D;return _.A(function(E){if(1==E.a)return e=_.nn,f=zB(a,b),g=_.Wg(b,"AUDIO"),h=_.Wg(b,"VIDEO"),m=(l=g||h)&&a.w.has(l)?a.w.get(l):
|
|
17
|
+
[],n={audio:g?m:[],video:h?m:[]},a.a.debug("Guessing stream type for",b.toString()),q=!1,r=XA(b,_.vb),w=n.audio.find(function(G){return G.Qd===r}),x=_.Rg(e.VIDEO,f),C=c||d||x,1!==f.length||C?!m.length&&1<f.length?(a.a.debug("Guessing multiplexed audio+video"),p=e.VIDEO,f=[f.join(",")]):n.audio.length&&w?(a.a.debug(TA),p=e.AUDIO,q=!0):n.video.length?(a.a.debug(TA),p=e.AUDIO):(a.a.debug("Guessing video-only"),p=e.VIDEO):(p=e.AUDIO,a.a.debug(TA)),q?E.H(2):_.y(E,KB(a,b,f,p),3);2!=E.a&&(D=E.f);if(D)n[D.stream.type]=
|
|
18
|
+
[D];else if(null===D)return a.a.debug("streamInfo is null"),E["return"](null);LB(n);return E["return"](n)})},LB=function(a){a=_.u(a.audio.concat(a.video));for(var b=a.next();!b.done;b=a.next()){b=b.value;var c=b.stream.codecs.split(",");c=c.filter(function(d){return"mp4a.40.34"!=d});b.stream.codecs=c.join(",")}},JB=function(a,b,c,d,e,f,g){c.forEach(function(C){if(C=C.stream)C.width=Number(e)||void 0,C.height=Number(f)||void 0,C.frameRate=Number(g)||void 0});b.length||(b=[null]);c.length||(c=[null]);
|
|
19
|
+
var h=[];b=_.u(b);for(var l=b.next();!l.done;l=b.next()){l=l.value;for(var m=_.u(c),n=m.next();!n.done;n=m.next()){var p=n.value;n=l?l.stream:null;var q=p?p.stream:null,r=l?l.drmInfos:null,w=p?p.drmInfos:null;p=(p?p.Qd:"")+" - "+(l?l.Qd:"");var x=void 0;if(n&&q)if(r.length&&w.length?0<_.Hv(r,w).length:1)x=_.Hv(r,w);else{a.a.warn("Incompatible DRM info in HLS variant. Skipping.");continue}else n?x=r:q&&(x=w);a.ia.has(p)?a.a.debug("Skipping variant which only differs in text streams."):(n=MB(a,n,q,
|
|
20
|
+
d,x),h.push(n),a.ia.add(p))}}return h},MB=function(a,b,c,d,e){return{id:a.ua++,language:b?b.language:_.Ge,primary:!!b&&b.primary||!!c&&c.primary,audio:b,video:c,bandwidth:d,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0}},GB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w;return _.A(function(x){if(1==x.a){c=XA(b,SA);d="";e=XA(b,"TYPE").toLowerCase();f=_.nn;e==_.iv&&(e=f.TEXT);e!==f.TEXT&&c&&a.o.has(c)&&(d=a.o.get(c));g=XA(b,_.vb);if(a.f.has(g))return x["return"](a.f.get(g));h=CB(b);l=_.Wg(b,
|
|
21
|
+
"NAME");m=b.getAttribute("DEFAULT");n=b.getAttribute("AUTOSELECT");p=_.Wg(b,"CHANNELS");q=e==_.ic?p?parseInt(p.split("/")[0],10):null:null;r=!!m&&!!n;return _.y(x,NB(a,g,d,e,h,r,l,q,null),2)}w=x.f;if(null==w)return x["return"](null);a.w.has(c)?a.w.get(c).push(w):a.w.set(c,[w]);if(a.f.has(g))return x["return"](a.f.get(g));a.f.set(g,w);return x["return"](w)})},HB=function(a,b){var c,d,e,f,g,h;return _.A(function(l){if(1==l.a){c=XA(b,_.vb);if(a.f.has(c))return l["return"](a.f.get(c));d=_.Wg(b,_.pa)||
|
|
22
|
+
"jpg";e=CB(b);f=_.Wg(b,"NAME");return _.y(l,NB(a,c,d,_.kd,e,!1,f,null,null),2)}g=l.f;if(null===g)return l["return"](null);if(a.f.has(c))return l["return"](a.f.get(c));if(h=_.Wg(b,_.na))g.stream.bandwidth=Number(h);a.f.set(c,g);return l["return"](g)})},zB=function(a,b){var c=_.Wg(b,_.pa,a.g.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=_.Fv(f)[0];d.has(g)?a.a.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},
|
|
23
|
+
CB=function(a){a=_.Wg(a,"LANGUAGE")||_.Ge;return _.Fi(a)},KB=function(a,b,c,d){var e,f,g,h,l,m;return _.A(function(n){if(1==n.a){e=_.nn;f=XA(b,_.vb);if(a.f.has(f))return n["return"](a.f.get(f));g=_.Wg(b,FA);h=null;d==e.VIDEO&&g&&"NONE"!=g&&(h=a.O.get(g));l=AB(d,c);return _.y(n,NB(a,f,l,d,_.Ge,!1,null,null,h),2)}m=n.f;if(null==m)return n["return"](null);if(a.f.has(f))return n["return"](a.f.get(f));a.f.set(f,m);return n["return"](m)})},NB=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,r,w,x,C,D,E,G,K,O,T,
|
|
24
|
+
Da,ea,fa,xa,ha,qa,Ba,$a,La,ab,Eb,me,fh,Mi,gh,Zc;return _.A(function(qb){switch(qb.a){case 1:m=eB(a.B,b);p=null;if(a.m==oB&&a.I.has(m)){n=a.I.get(m);a.I["delete"](m);qb.H(2);break}return _.y(qb,rB(a,m),3);case 3:q=qb.f,m=q.uri,n=kB(a.S,q.data,m);case 2:if(1!=n.type)throw new _.L(_.M,4,4017);OB(a,n);return _.y(qb,PB(a,d,c,n),4);case 4:r=qb.f;w=[];n.a.forEach(function(Vf){Vf=aB(Vf.sa,"EXT-X-KEY");w.push.apply(w,Vf)});x=!1;C=[];D=null;E=_.u(w);for(G=E.next();!G.done;G=E.next())K=G.value,O=XA(K,"METHOD"),
|
|
25
|
+
T=_.Wg(K,"KEYFORMAT","identity"),"NONE"!=O&&("AES-128"==O?(Da=_.Wg(K,"IV",""),ea=eB(a.B,XA(K,_.vb)),p={method:"AES-128",url:ea,iv:Da?_.dk((Da||"0x").slice(2)):null},a.J=!0):(x=!0,(xa=(fa=QB[T])?fa(K,r):null)?(xa.keyIds.length&&(D=xa.keyIds[0]),C.push(xa)):a.a.warn("Unsupported HLS KEYFORMAT",T)));if(x&&!C.length&&!a.J)throw new _.L(_.M,4,4026);ha=new Map;return _.y(qb,sB(a,b,n,d,r,c,p,ha),5);case 5:return qa=qb.f,Ba=qa[0].startTime,$a=qa[qa.length-1].endTime,La=$a-Ba,ab=new _.hw(qa),Eb=a.g.hlsLowLatency?
|
|
26
|
+
_.dz:_.av,me=RB(n,p),fh=void 0,d==_.Ae&&(fh=_.we),gh=(Mi=cB(n.sa,OA))?"YES"===_.Wg(Mi,"CAN-BLOCK-RELOAD"):!1,Zc={id:a.ua++,originalId:g,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:ab.zc.bind(ab),getSegmentReference:ab.get.bind(ab),adjustSegmentDurations:ab.Oc.bind(ab),getDuration:ab.getDuration.bind(ab),segmentIndex:ab,segmentLookupStrategy:Eb,initSegmentReference:me,mimeType:r,codecs:c,kind:fh,encrypted:x,keyId:D,language:e,label:g,type:d,primary:f,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
27
|
+
frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:h,closedCaptions:l,keyInfo:p},qb["return"]({stream:Zc,segmentIndex:ab,drmInfos:C,Qd:b,Bg:m,De:Ba,qk:$a,duration:La,Vh:ha,Hg:gh})}})},OB=function(a,b){var c=cB(b.sa,MA),d=cB(b.sa,JA);d=c&&"VOD"==c.value||d;c=c&&"EVENT"==c.value&&!d;c=!d&&!c;if(d)tB(a,oB);else{c?tB(a,SB):tB(a,TB);d=cB(b.sa,QA);if(!d)throw new _.L(_.M,4,4024,{missingTag:QA});d=Number(d.value);c=cB(b.sa,LA);a.g.hlsLowLatency&&c?(d=Number(XA(c,"PART-TARGET")),
|
|
28
|
+
a.G=Math.min(d,a.G),a.D=Math.max(d,a.D),d=cB(b.sa,OA),a.$=d?Number(XA(d,"PART-HOLD-BACK")):0):(a.D=Math.max(d,a.D),a.G=Math.min(d,a.G),a.$=3*a.D)}},RB=function(a,b){var c=aB(a.sa,"EXT-X-MAP");if(!c.length)return null;if(1<c.length)throw new _.L(_.M,4,4020);var d=c[0];c=XA(d,_.vb);var e=eB(a.f,c);c=0;var f=null;if(d=_.Wg(d,"BYTERANGE"))c=d.split("@"),d=Number(c[0]),c=Number(c[1]),f=c+d-1;return new _.Tv(function(){return[e]},c,f,b)},VB=function(a,b,c,d,e,f,g){var h=[],l={};b=_.u(_.EA(b.f));for(var m=
|
|
29
|
+
b.next();!m.done;l={Sd:l.Sd},m=b.next()){var n=m.value;m=n.Hd;n=n.item;var p=0==m?a:h[h.length-1],q=0==m?d:p.endTime,r=Number(_.Wg(n,"DURATION"));r=q+r;var w=_.Wg(n,"BYTERANGE");w=_.u(UB(p,w));p=w.next().value;w=w.next().value;var x=_.Wg(n,_.vb);x=eB(g,x);l.Sd=x?[x]:[];q=new _.Uv(c,q,r,function(C){return function(){return C.Sd}}(l),p,w,e,f,!1,null,null,null,null);if("YES"===_.Wg(n,"INDEPENDENT")||0===m)q.g=!0;h.push(q)}return h},WB=function(a,b,c,d,e,f,g,h,l){var m=c.sa,n=c.a,p=n?[n]:[];n=cB(m,RA);
|
|
30
|
+
(g=g?Object.assign({},g):null)&&!g.iv&&(g.iv=_.gk(new Uint8Array(12),new Uint8Array([d>>24&255,d>>16&255,d>>8&255,d&255])));var q=null,r=null,w=null;h===_.kd&&(r=cB(m,"EXT-X-TILES"),q="1x1",r&&(q=_.Wg(r,"LAYOUT")||"1x1",w=(w=_.Wg(r,"DURATION"))?Number(w):null),r=_.u(q.split("x").map(function(x){return parseInt(x,10)})),q=r.next().value,r=r.next().value);if(0===c.f.length&&!n)throw new _.L(_.M,4,4024,{missingTag:RA});h=null;if(0<c.f.length)if(a.g.hlsLowLatency)h=VB(b,c,d,e,f,g,l);else return null;
|
|
31
|
+
c=a=0;l=null;n?(a=e+Number(n.value.split(",")[0]),m=cB(m,GA),b=_.u(UB(b,m?m.value:null)),c=b.next().value,l=b.next().value):a=h[h.length-1].endTime;return new _.Uv(d,e,a,function(){return p},c,l,f,g,!1,null,q,r,w,h)},UB=function(a,b){var c=0,d=null;b&&(c=b.split("@"),d=Number(c[0]),c=c[1]?Number(c[1]):a.Ea+1,d=c+d-1);return[c,d]},xB=function(a){a.h&&(a.ca.forEach(function(b){_.Yv(a.h,b,0)}),a.ca=[])},sB=function(a,b,c,d,e,f,g,h){var l,m,n,p,q,r,w,x,C,D,E,G,K,O,T,Da,ea,fa,xa,ha,qa,Ba,$a;return _.A(function(La){switch(La.a){case 1:l=
|
|
32
|
+
c.a;m=RB(c,g);n=dB(c.sa);if(null!==a.U){La.H(2);break}p=a;return _.y(La,XB(a,b,m,l[0],n,g,e,f,d),3);case 3:p.U=La.f;case 2:q=a.U;r=l[0].a;a.a.debug("First segment",r.split("/").pop(),"starts at",q);x=(w=cB(c.sa,IA))?Number(w.value):0;h.has(x)||h.set(x,n);if(!w)for(;h.has(x+1)&&h.get(x+1)<n;)x++;C=a.L.get(x)||0;D=[];E=function(ab){return _.EA(ab)};G=_.u(E(l));K=G.next();case 4:if(K.done){La.H(6);break}T=O=K.value;Da=T.Hd;ea=T.item;fa=D[D.length-1];xa=0==Da?q:fa.endTime;ha=n+Da;qa=cB(ea.sa,HA);if(!qa){La.H(7);
|
|
33
|
+
break}x++;h.set(x,ha);return _.y(La,ZB(a,x,b,m,ea,ha,g,e,f,xa,d),8);case 8:C=La.f;case 7:Ba=WB(a,fa,ea,ha,xa,C,g,d,c.f);$a=cB(ea.sa,RA);Ba&&(a.g.hlsLowLatency||$a)&&D.push(Ba);K=G.next();La.H(4);break;case 6:return a.ca.push(D),xB(a),La["return"](D)}})},ZB=function(a,b,c,d,e,f,g,h,l,m,n){var p,q;return _.A(function(r){if(1==r.a)return p=0,a.L.has(b)?(p=a.L.get(b),r.H(2)):_.y(r,XB(a,c,d,e,f,g,h,l,n,!0),3);2!=r.a&&(q=r.f,p=q-m,a.a.debug("Discontinuity segment offset",p),a.L.set(b,p));return r["return"](p)})},
|
|
34
|
+
vC=function(a,b){var c,d,e,f,g,h,l;return _.A(function(m){switch(m.a){case 1:return c=b.f(),d=_.Sv(b.Ha(),b.Pa,b.Pa+2048-1,a.g.attemptParameters),d.type=2,e=_.Sv(b.Ha(),b.Pa,b.Ea,a.g.attemptParameters),e.type=2,c&&(e.keyInfo=c),_.xf(m,2),f=a.J?e:d,_.y(m,$B(a,f),4);case 4:return g=m.f,m["return"](g);case 2:h=_.zf(m);if(7001==h.code||a.J)throw h;a.a.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 preflights.",
|
|
35
|
+
d.uris[0]);return _.y(m,$B(a,e),5);case 5:return l=m.f,m["return"](l)}})},XB=function(a,b,c,d,e,f,g,h,l,m){var n,p,q,r,w,x,C,D,E,G,K;return _.A(function(O){switch(O.a){case 1:n=WB(a,null,d,e,0,0,f,l,"");if(!n)return O["return"](0);if(a.K&&!m){p=a.f.get(b);q=p.segmentIndex;if(r=q.get(n.position))return a.a.debug("Found segment start time in previous manifest"),O["return"](r.startTime);a.a.debug("Unable to find segment start time in previous manifest!")}a.a.debug("Fetching segment to find start time");
|
|
36
|
+
if("audio/mpeg"==g)return O["return"](0);if(g!=_.jc){O.H(2);break}return _.y(O,vC(a,n),3);case 3:return w=O.f,x=_.N(w.data),mB(x)?O["return"](wC(x)):O["return"](xC(a,w.data));case 2:if(g!=_.Re&&g!=_.nc){O.H(4);break}C=[vC(a,n)];c&&C.push(vC(a,c));return _.y(O,Promise.all(C),5);case 5:return D=O.f,E=D[0],G=D[1]||D[0],O["return"](yC(a,E.data,G.data));case 4:if(g!=_.Qe){O.H(6);break}return _.y(O,vC(a,n),7);case 7:return K=O.f,O["return"](xC(a,K.data));case 6:if(g===_.lc||g===_.kc||!MediaSource.isTypeSupported((g.split("/")[0]||
|
|
37
|
+
"")+'/mp4;codecs\x3d"'+h+'"'))return O["return"](0);throw new _.L(_.M,4,4030);}})},yC=function(a,b,c){var d=0;(new _.Fk).M(_.Cd,_.Gk).M(_.Ee,_.Gk).M(_.xd,_.Gk).V("mdhd",function(g){g.F.skip(0==g.version?8:16);d=_.U(g.F);g.Wa.stop()}).parse(c,!0);if(!d)throw a.a.error("Unable to find timescale in init segment!"),new _.L(_.M,4,4030);var e=0,f=!1;(new _.Fk).M("moof",_.Gk).M("traf",_.Gk).V("tfdt",function(g){e=(0==g.version?_.U(g.F):_.Dk(g.F))/d;f=!0;g.Wa.stop()}).parse(b,!0);if(!f)throw new _.L(_.M,
|
|
38
|
+
4,4030);return e},xC=function(a,b){function c(){e.seek(f+188);g=_.zk(e);71!=g&&(e.seek(f+192),g=_.zk(e));71!=g&&(e.seek(f+204),g=_.zk(e));71!=g&&d();YA(e)}function d(){throw new _.L(_.M,4,4030);}var e=new _.wk(new DataView(b),!1),f=0,g=0;f=zC(e);0>f&&(a.a.error("Unable to find sync byte in TS after scanning"),d());for(;;){f=e.getPosition();g=_.zk(e);71!=g&&d();var h=_.Ak(e);if(8191===(h&8191))c();else if(h&16384)if(h=(_.zk(e)&48)>>4,0!=h&&2!=h||d(),3==h&&(h=_.zk(e),e.skip(h)),1!=_.U(e)>>8)c();else{e.skip(3);
|
|
39
|
+
h=_.zk(e)>>6;0!=h&&1!=h||d();0==_.zk(e)&&d();h=_.zk(e);var l=_.Ak(e),m=_.Ak(e);return(1073741824*((h&14)>>1)+((l&65534)<<14|(m&65534)>>1))/9E4}else c()}},zC=function(a){for(;a.getPosition()<a.ya()-1;){var b=a.getPosition();if(71===_.zk(a))return YA(a),b}return-1},wC=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 _.L(_.M,4,4030);}mB(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,
|
|
40
|
+
14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}mB(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},AB=function(a,b){if(1==b.length)return b[0];var c=_.Rg(a,b);if(null!=c)return c;
|
|
41
|
+
throw new _.L(_.M,4,4025,{codecList:b});},PB=function(a,b,c,d){var e,f,g,h,l,m,n,p,q;return _.A(function(r){if(1==r.a){e=_.nn;f=d.a[0].a;g=new _.Eg(f);h=g.na.split(".").pop();l=vB[b];if(m=l[h])return r["return"](m);if(b==e.TEXT)return c&&"vtt"!=c?r["return"](_.cc):r["return"](_.Be);n=_.Hh([f],a.g.attemptParameters);n.method="HEAD";n.type=2;return _.y(r,$B(a,n),2)}p=r.f;q=p.headers["content-type"];if(!q)throw new _.L(_.M,4,4021,h);return r["return"](q.split(";")[0])})},rB=function(a,b){var c=_.Hh([b],
|
|
42
|
+
a.g.attemptParameters);c.type=1;return $B(a,c)},AC=function(a){var b=XA(a,"METHOD"),c=["SAMPLE-AES",UA];if(!c.includes(b))return _.Rf("PlayReady in HLS is only supported with [",c.join(", "),"], not",b),null;a=XA(a,_.vb);b=_.Qp(a);a=null;b=_.N(b.data);try{a=_.nv(_.Fl(b))}catch(d){a=b}return _.yv(_.Oc,[{initDataType:_.zc,initData:a}],"")},nB=function(a){var b,c,d;_.A(function(e){if(1==e.a){a.a.debug(_.Uu);if(!a.j)return e["return"]();_.xf(e,2);return _.y(e,a.update(),4)}if(2!=e.a)return b=a.da,a.A.Z(b),
|
|
43
|
+
_.yf(e,0);c=_.zf(e);a.j&&(a.j.onError(c),d=c,1===d.severity&&a.A.Z(.1));_.z(e)})},tB=function(a,b){a.m=b;if(a.h){var c=a.h,d=a.m==oB;c.j=d;c.m=d}a.m!=oB||a.A.stop()},$B=function(a,b){if(!a.C)throw new _.L(_.M,7,7001);var c=a.j.networkingEngine.fetch(b);_.Rh(a.C,c);return c.P},BC=function(){},hB=[QA,KA,IA,MA,"EXT-X-MAP","EXT-X-I-FRAMES-ONLY",JA,OA,LA],iB=[RA,GA,HA,"EXT-X-PROGRAM-DATE-TIME","EXT-X-KEY","EXT-X-DATERANGE"],lB=["EXT-X-PART",NA];_.t=pB.prototype;_.t.configure=function(a){this.g=a};
|
|
44
|
+
_.t.setCurrentVariant=function(a){var b=a.video?a.video.id:null;a=a.audio?a.audio.id:null;this.X.clear();for(var c=_.u(this.f.keys()),d=c.next();!d.done;d=c.next()){d=d.value;var e=this.f.get(d);!e.stream||e.stream.id!==b&&e.stream.id!==a||this.X.set(d,e)}};_.t.start=function(a,b){var c=this,d,e;return _.A(function(f){if(1==f.a)return c.j=b,_.y(f,rB(c,a),2);if(3!=f.a)return d=f.f,c.B=d.uri,_.y(f,yB(c,d.data),3);e=c.da;0<e&&c.A.Z(e);return f["return"](c.K)})};
|
|
45
|
+
_.t.stop=function(){this.A&&(this.A.stop(),this.A=null);var a=[];this.C&&(a.push(this.C.destroy()),this.C=null);this.g=this.j=null;this.ia.clear();this.f.clear();this.I.clear();this.K=null;this.w.clear();this.o.clear();return Promise.all(a)};
|
|
46
|
+
_.t.update=function(){var a=this,b,c,d,e,f;return _.A(function(g){if(1==g.a){if(a.m==oB)return g["return"]();b=[];a.U=null;c=Array.from(a.f.values());d=Array.from(a.X.values());e=a.g.hlsLowLatency&&0<d.length?d:c;return _.y(g,uB(a,e[0]),2)}for(f=1;f<e.length;f++)b.push(uB(a,e[f]));return _.y(g,Promise.all(b),0)})};_.t.onExpirationUpdated=function(){};
|
|
47
|
+
var vB={audio:{mp4:_.nc,m4s:_.nc,m4i:_.nc,m4a:_.nc,cmfa:_.nc,ts:_.Qe,aac:_.jc,ec3:_.lc,ac3:_.kc},video:{mp4:_.Re,m4s:_.Re,m4i:_.Re,m4v:_.Re,cmfv:_.Re,ts:_.Qe},text:{mp4:_.cc,m4s:_.cc,m4i:_.cc,cmft:_.cc,vtt:_.Be,ttml:_.fc},image:{jpg:_.ld,jpeg:_.ld,png:"image/png",svg:"image/svg+xml",webp:"image/webp",avif:"image/avif"}},QB={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Qe)throw new _.L(_.M,4,4041);return _.yv(_.Nc,[{initDataType:_.le,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":AC,
|
|
48
|
+
"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":AC,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=XA(a,"METHOD"),c=["SAMPLE-AES",UA];if(!c.includes(b))return _.Rf("Widevine in HLS is only supported with [",c.join(", "),"], not",b),null;b=XA(a,_.vb);b=_.Qp(b);b=_.N(b.data);b=_.yv(_.Pc,[{initDataType:_.zc,initData:b}],"");if(a=_.Wg(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},oB="VOD",TB="EVENT",SB="LIVE",qB={VOD:oB,Xj:TB,LIVE:SB};_.v(BC,_.zo);BC.prototype.Ja=function(){_.wp.m3u8=pB;_.up[_.tj]=pB;_.up[WA]=pB};BC.prototype.Ca=function(){_.qw("m3u8");_.rw(_.tj);_.rw(WA)};BC.prototype.id=function(){return"hls"};_.B("clpp.hls.HlsComponent",BC);};
|
|
46
49
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
47
50
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
48
51
|
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.l.getTrackManager().
|
|
7
|
-
_.B("clpp.hlssmpte.HlsSmptePlugin",
|
|
2
|
+
var f=function(window){var QJ=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.J.R(a)){a:{var b=a.info;if(_.J.Y(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=_.J.Y(a)?a:null}},SJ=function(a,b,c){this.l=a;this.m=b;this.j=c;this.a=new _.cg;this.h=(a=_.Rp[_.fc]||null)?new a(this.l.getConfiguration()):null;this.f=new _.H("clpp.hlssmpte.ImageCueHandler");this.g=null;RJ(this)},RJ=function(a){a.a.one(a.l,_.td,function(){return TJ(a)})},
|
|
3
|
+
TJ=function(a){var b=a.l.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Vb,function(d){return UJ(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.zd}).forEach(function(d){UJ(a,{track:d})});!VJ(c)&&a.m&&(a.f.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),WJ(a,b))}else a.f.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.f.warn("A video element is not available. Skipping.")},
|
|
4
|
+
VJ=function(a){return a.some(function(b){return b.kind===_.zd})},WJ=function(a,b){var c=a.l.getTrackManager(),d=c.ka(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.ra(d)};a.a.on(b.textTracks,_.Vb,function(g){g.track.kind===_.zd&&(a.a.off(b.textTracks,_.Vb,f),f())});c.ra(e)}else a.f.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},UJ=function(a,b){var c=b.track;c.kind===_.zd&&(a.f.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.jd,a.a.on(c,_.Sc,function(d){return XJ(a,d)}))},XJ=function(a,b){var c=YJ(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.g&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new QJ(d);if(e.f===c&&null!==e.a){a.g=d;d=a.h.parseMedia(_.sh(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.l.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},YJ=function(a){return(a=
|
|
6
|
+
a.l.getTrackManager().la())&&a.language&&a.language.toLowerCase()},ZJ=function(){this.a=null;this.f=!1},$J=function(){};SJ.prototype.destroy=function(){this.a.release();this.g=null;return Promise.resolve()};_.v(ZJ,_.cq);ZJ.prototype.onPlayerCreated=function(){};ZJ.prototype.onContentWillLoad=function(a){if(this.f=_.Ti()){var b=a.getConfiguration();b=_.J.Ma(b.hlssmpte||{});_.J.Mf(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.J.pa(b.timestampOffset)||(b.timestampOffset=0);this.a=new SJ(a,b.patchMetadataTrack,b.timestampOffset)}};ZJ.prototype.onPlayerWillDestroy=function(){var a=this;return _.A(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.H(0);a.a=null;_.z(b)})};ZJ.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.B("clpp.hlssmpte.HlsSmptePlugin",ZJ);ZJ.Id="hlssmpte";$J.prototype.create=function(){return new ZJ};_.uo(new $J);};
|
|
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));}
|