@castlabs/prestoplay 6.13.0 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -6
- package/cjs/cl.cast.js +83 -83
- package/cjs/cl.conviva.js +24 -24
- package/cjs/cl.core.js +431 -429
- package/cjs/cl.crypto.js +6 -6
- package/cjs/cl.dash.js +59 -59
- package/cjs/cl.externs.js +48 -40
- package/cjs/cl.freewheel.js +19 -19
- package/cjs/cl.hls.js +58 -57
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +17 -17
- package/cjs/cl.ima.js +18 -18
- package/cjs/cl.mse.js +269 -268
- package/cjs/cl.muxdata.js +15 -14
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +33 -33
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +53 -53
- package/cjs/cl.ttml.js +28 -28
- 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.youbora.js +18 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +424 -421
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +48 -40
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +69 -69
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +221 -220
- package/cl.muxdata.js +13 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/package.json +4 -4
- package/typings.d.ts +53 -17
package/cjs/cl.freewheel.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
2
|
var f=function(window){var fP="clpp-freewheel",gP="clpp.freewheel.AdsManagerFactory",hP="freewheel",iP=function(){this.f=this.a=null},jP=function(){},kP=function(a){switch(a){case 0:return tv.freewheel.SDK.ADUNIT_PREROLL;case 1:return tv.freewheel.SDK.ADUNIT_MIDROLL;case 2:return tv.freewheel.SDK.ADUNIT_POSTROLL;default:return""}},lP=function(a,b,c){this.h=a;this.f=b;this.a=c},mP=function(a){this.a=a},nP=function(a){this.g=new _.K("clpp.freewheel.AdsManager");this.m=a;this.h=new _.Eh;this.w=new tv.freewheel.SDK.AdManager;
|
|
3
|
-
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.wj;this.j=null},oP=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.Wf&&b.push("serverUrl");typeof a.profileId!==_.Wf&&b.push("profileId");typeof a.videoAssetId!==_.Wf&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.P(1,9,12001,{missingKeys:b.join(", ")});},pP=function(){var a,b,c,d;return _.E(function(e){if(1==e.a)return a=new _.
|
|
4
|
-
_.x(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.x(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},sP=function(a){return _.E(function(b){if(a.B.length)return qP(a),a.f=a.B.shift(),a.f.play(),b.F(0);rP(a);return _.x(b,a.m.a.play(),0)})},tP=function(a){a.A.length?(qP(a),a.f=a.A.shift(),a.f.play()):rP(a)},qP=function(a){var b=a.m.nc(hP).
|
|
5
|
-
a.a.registerVideoDisplayBase(fP),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},rP=function(a){var b=a.m.nc(hP).
|
|
6
|
-
_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.
|
|
7
|
-
_.H("clpp.freewheel.FreeWheelPlugin",iP);iP.prototype.getAdVideo=iP.prototype.
|
|
3
|
+
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.wj;this.j=null},oP=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.Wf&&b.push("serverUrl");typeof a.profileId!==_.Wf&&b.push("profileId");typeof a.videoAssetId!==_.Wf&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.P(1,9,12001,{missingKeys:b.join(", ")});},pP=function(){var a,b,c,d;return _.E(function(e){if(1==e.a)return a=new _.As,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
|
|
4
|
+
_.x(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.x(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},sP=function(a){return _.E(function(b){if(a.B.length)return qP(a),a.f=a.B.shift(),a.f.play(),b.F(0);rP(a);return _.x(b,a.m.a.play(),0)})},tP=function(a){a.A.length?(qP(a),a.f=a.A.shift(),a.f.play()):rP(a)},qP=function(a){var b=a.m.nc(hP).Rc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
|
|
5
|
+
a.a.registerVideoDisplayBase(fP),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},rP=function(a){var b=a.m.nc(hP).Rc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},uP=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new lP(a.a,c,d)});a.m.trigger(new _.L(b,d))},vP=function(){this.Xc=new _.K(gP)};_.w(iP,_.rt);_.r=iP.prototype;
|
|
6
|
+
_.r.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.qp(_.Yd,{id:fP}),this.f=_.qp(_.sg,{"class":_.wd}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.P(1,9,12E3))};_.r.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.r.id=function(){return hP};_.r.Rc=function(){return this.a};_.r.Yj=function(){return this.f};
|
|
7
|
+
_.H("clpp.freewheel.FreeWheelPlugin",iP);iP.prototype.getAdVideo=iP.prototype.Yj;iP.prototype.getAdContainer=iP.prototype.Rc;iP.Id=hP;iP.AD_CONTAINER_ID=fP;jP.prototype.create=function(){return new iP};_.nq(new jP);_.r=lP.prototype;_.r.xb=function(){return"FreeWheel AdManager SDK"};_.r.yb=function(){return tv.freewheel.SDK.version};_.r.Eb=function(){return 0};_.r.getId=function(){return this.a?this.a.getAdId():""};_.r.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.Wf?a:""};_.r.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.r.getAdSystem=function(){return""};_.r.getAdvertiserName=function(){return""};_.r.getTitle=function(){return""};
|
|
8
8
|
_.r.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.r.getSkipTimeOffset=function(){return 0};_.r.rc=function(){return!1};_.r.Rb=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.r.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
|
|
9
|
-
_.r.Bb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.Ab=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.
|
|
10
|
-
_.r.getPodIndex=function(){switch(this.
|
|
11
|
-
_.r.getWrapperCreativeIds=function(){return[]};lP.prototype.getWrapperCreativeIds=lP.prototype.getWrapperCreativeIds;lP.prototype.getWrapperAdSystems=lP.prototype.getWrapperAdSystems;lP.prototype.getWrapperAdIds=lP.prototype.getWrapperAdIds;lP.prototype.getSequenceLength=lP.prototype.Db;lP.prototype.getPositionInSequence=lP.prototype.Tb;lP.prototype.getPodTimeOffset=lP.prototype.Sb;lP.prototype.getPodIndex=lP.prototype.getPodIndex;lP.prototype.getPodType=lP.prototype.
|
|
12
|
-
lP.prototype.getMediaBitrate=lP.prototype.
|
|
13
|
-
lP.prototype.getAdSystem=lP.prototype.getAdSystem;lP.prototype.getApiFramework=lP.prototype.getApiFramework;lP.prototype.getCreativeId=lP.prototype.getCreativeId;lP.prototype.getId=lP.prototype.getId;lP.prototype.getTechnology=lP.prototype.Eb;lP.prototype.getAdManagerVersion=lP.prototype.yb;lP.prototype.getAdManagerName=lP.prototype.xb;mP.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(a){switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})};mP.prototype.Vb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};mP.prototype.
|
|
14
|
-
mP.prototype.hasPostroll=mP.prototype.
|
|
9
|
+
_.r.Bb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.r.Ab=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.r.ob=function(){return 0};_.r.cb=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
|
|
10
|
+
_.r.getPodIndex=function(){switch(this.cb()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.r.Sb=function(){switch(this.cb()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.r.Tb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.r.Db=function(){return this.f.getAdCount()};_.r.getWrapperAdIds=function(){return[]};_.r.getWrapperAdSystems=function(){return[]};
|
|
11
|
+
_.r.getWrapperCreativeIds=function(){return[]};lP.prototype.getWrapperCreativeIds=lP.prototype.getWrapperCreativeIds;lP.prototype.getWrapperAdSystems=lP.prototype.getWrapperAdSystems;lP.prototype.getWrapperAdIds=lP.prototype.getWrapperAdIds;lP.prototype.getSequenceLength=lP.prototype.Db;lP.prototype.getPositionInSequence=lP.prototype.Tb;lP.prototype.getPodTimeOffset=lP.prototype.Sb;lP.prototype.getPodIndex=lP.prototype.getPodIndex;lP.prototype.getPodType=lP.prototype.cb;
|
|
12
|
+
lP.prototype.getMediaBitrate=lP.prototype.ob;lP.prototype.getMediaHeight=lP.prototype.Ab;lP.prototype.getMediaWidth=lP.prototype.Bb;lP.prototype.getMediaUrl=lP.prototype.getMediaUrl;lP.prototype.getClickThroughUrl=lP.prototype.Rb;lP.prototype.isBumper=lP.prototype.rc;lP.prototype.getSkipTimeOffset=lP.prototype.getSkipTimeOffset;lP.prototype.getDuration=lP.prototype.getDuration;lP.prototype.getTitle=lP.prototype.getTitle;lP.prototype.getAdvertiserName=lP.prototype.getAdvertiserName;
|
|
13
|
+
lP.prototype.getAdSystem=lP.prototype.getAdSystem;lP.prototype.getApiFramework=lP.prototype.getApiFramework;lP.prototype.getCreativeId=lP.prototype.getCreativeId;lP.prototype.getId=lP.prototype.getId;lP.prototype.getTechnology=lP.prototype.Eb;lP.prototype.getAdManagerVersion=lP.prototype.yb;lP.prototype.getAdManagerName=lP.prototype.xb;mP.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(a){switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})};mP.prototype.Vb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};mP.prototype.pb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
14
|
+
mP.prototype.hasPostroll=mP.prototype.pb;mP.prototype.hasPreroll=mP.prototype.Vb;mP.prototype.getCuePoints=mP.prototype.getCuePoints;_.r=nP.prototype;
|
|
15
15
|
_.r.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.E(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{oP(b)}catch(n){return a.m.onError(n),a.l.resolve(),m["return"](a.l)}a.w.setNetwork(b.networkId);a.w.setServer(b.serverUrl);a.a=a.w.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.Wf&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.x(m,pP(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
|
|
16
16
|
_.u(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,kP(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Te&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.u(b.parameters),h=g.next();!h.done;h=
|
|
17
|
-
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.
|
|
17
|
+
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.xl.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Bl.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.Al.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Tk.bind(a));a.h.on(a.m,_.eg,a.Ui.bind(a));a.h.on(a.m,_.Tf,a.Ti.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.r.start=function(){var a=this;return _.E(function(b){return _.x(b,sP(a),0)})};
|
|
18
18
|
_.r.resume=function(){this.f&&this.f.resume()};_.r.pause=function(){this.f&&this.f.pause()};_.r.skip=function(){this.f&&this.f.skipCurrentAd()};_.r.getVolume=function(){return this.a?this.a.getAdVolume():1};_.r.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.r.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.r.dispose=function(){var a=this;return _.E(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);rP(a);a.a&&(a.a.dispose(),a.a=null);_.y(b)})};
|
|
19
|
-
_.r.
|
|
20
|
-
void 0));this.l.resolve()};_.r.
|
|
21
|
-
_.r.
|
|
22
|
-
_.
|
|
23
|
-
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.
|
|
24
|
-
_.r.
|
|
25
|
-
nP.prototype.getVolume=nP.prototype.getVolume;nP.prototype.skip=nP.prototype.skip;nP.prototype.pause=nP.prototype.pause;nP.prototype.resume=nP.prototype.resume;nP.prototype.start=nP.prototype.start;vP.prototype.name=function(){return gP};vP.prototype.ba=function(a,b){return a.namespace()===_.Cd?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.
|
|
19
|
+
_.r.xl=function(a){var b=this;if(a.success)this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.o=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.L(_.Nc,{adsTimeline:new mP(this.a)})),this.j=new _.ys(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.nc(hP).f);else this.m.onError(new _.P(1,9,10003,{errorType:0},
|
|
20
|
+
void 0));this.l.resolve()};_.r.Bl=function(a){uP(this,_.uc,a);this.j.start()};_.r.Al=function(a){this.f=null;a=a.slot;uP(this,_.vc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:sP(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:rP(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:tP(this)}};
|
|
21
|
+
_.r.Tk=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:uP(this,_.Hc,a);uP(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:uP(this,_.Ic,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:uP(this,_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:uP(this,_.Cc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:uP(this,_.Jc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:uP(this,_.yc,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:uP(this,
|
|
22
|
+
_.xc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:uP(this,_.Dc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:uP(this,_.Fc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:uP(this,_.Gc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:uP(this,_.wc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:uP(this,_.Ec,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.P(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],
|
|
23
|
+
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.r.Ui=function(){var a=this;if(!this.f){var b=this.m.getPosition();if(this.f=this.o.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.o.findIndex(function(d){return d===a.f});this.o.splice(c,1);this.m.pause();qP(this);this.f.play()}}};
|
|
24
|
+
_.r.Ti=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Vo:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Uo:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Oo:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);tP(this);break;case _.Ho:case _.So:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};nP.prototype.getPosition=nP.prototype.getPosition;nP.prototype.setVolume=nP.prototype.setVolume;
|
|
25
|
+
nP.prototype.getVolume=nP.prototype.getVolume;nP.prototype.skip=nP.prototype.skip;nP.prototype.pause=nP.prototype.pause;nP.prototype.resume=nP.prototype.resume;nP.prototype.start=nP.prototype.start;vP.prototype.name=function(){return gP};vP.prototype.ba=function(a,b){return a.namespace()===_.Cd?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.Xc.warn("FreeWheel SDK is not loaded."),!1)};vP.prototype.create=function(a){return new nP(a)};vP.prototype.create=vP.prototype.create;vP.prototype.isSupported=vP.prototype.ba;vP.prototype.name=vP.prototype.name;_.np(new vP);};
|
|
26
26
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
27
27
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
28
28
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hls.js
CHANGED
|
@@ -1,71 +1,72 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var $E="Could not parse MP4 segment start time.",aF="Failed to infer discontinuity number",bF="Guessing audio-only",cF="METHOD",dF="SAMPLE-AES-CTR",eF="Setting playlist start time to ",fF="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",
|
|
3
|
-
d[0].a)throw new _.P(_.Q,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.W=c;this.S=1===b?d:null},GF=function(a,b,c){c=void 0===c?[]:c;this.W=b;this.a=a;this.f=c;this.ca=-1},HF=function(a){a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value,b.startsWith("#EXT-")&&(b=_.mj(0,b),_.
|
|
2
|
+
var f=function(window){var $E="Could not parse MP4 segment start time.",aF="Failed to infer discontinuity number",bF="Guessing audio-only",cF="METHOD",dF="SAMPLE-AES-CTR",eF="Setting playlist start time to ",fF="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",gF="application/vnd.apple.mpegurl",iF="sample",jF="whole-segment",EF=function(a){if(1>a.a)throw _.fm();--a.a},FF=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.P(_.Q,4,4043,"Media playlist must have at least one segment!");if(null==
|
|
3
|
+
d[0].a)throw new _.P(_.Q,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.W=c;this.S=1===b?d:null},GF=function(a,b,c){c=void 0===c?[]:c;this.W=b;this.a=a;this.f=c;this.ca=-1},HF=function(a){a=_.u(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value,b.startsWith("#EXT-")&&(b=_.mj(0,b),_.Wt.has(b.name)))return 1;return 0},IF=function(a){a=_.Y.Qb(a,"EXT-X-DEFINE").map(function(b){var c=_.Ii(b,"NAME");if(!c)return null;b=_.Ji(b,"VALUE");return{name:c,
|
|
4
4
|
value:b}}).filter(Boolean);return new Map(a.map(function(b){return[b.name,b.value]}))},JF=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.P(_.Q,4,4044,"Undefined variable '"+d+"'");return e})},KF=function(a,b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=JF(d.value,b)})})},LF=function(a,b,c){KF(a,c);b.forEach(function(d){KF(d.W,c)})},MF=function(){this.f=0;this.a=new Map},PF=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&
|
|
5
|
-
!_.Y
|
|
6
|
-
g));e++}}a.a=IF(d);LF(d,[],a.a);return new FF(c,0,d)},RF=function(a,b,c){var d=[],e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=QF(a,h),_.
|
|
5
|
+
!_.Y.$g(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.P(_.Q,4,4015);return 0===HF(b)?NF(a,b,c):OF(a,b,c)},OF=function(a,b,c){for(var d=[],e=1;e<b.length;){var f=QF(a,b[e]);if(_.Xt.has(f.name))break;d.push(f);e++}b=RF(a,c,b.slice(e));e=b.S;d=d.concat(b.W);a=SF(a,d);LF(d,e,a);return new FF(c,1,d,b.S)},NF=function(a,b,c){for(var d=[],e=1;e<b.length;e++){var f=QF(a,b[e]);d.push(f);if(f.name===_.Ya){var g=b[e+1];if(!g)throw new _.P(_.Q,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Ki(_.dc,
|
|
6
|
+
g));e++}}a.a=IF(d);LF(d,[],a.a);return new FF(c,0,d)},RF=function(a,b,c){var d=[],e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=QF(a,h),_.Wt.has(h.name)||_.Zt.has(h.name)?d.push(h):_.Yt.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Va&&"PART"===_.Ii(h,_.bc)&&g.push(h):f.push(h)):_.Y.$g(h)||(h=_.Y.rd(b,h.trim()),e.push(new GF(h,f,g)),f=[],g=[])});0<g.length&&e.push(new GF(null,f,g));return{S:e,W:d}},QF=function(a,b){return _.mj(a.f++,b)},SF=function(a,b){var c=_.Y.Qb(b,"EXT-X-DEFINE"),
|
|
7
7
|
d=IF(b);c.map(function(e){return _.Ii(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.P(_.Q,4,4044,"Cannot import variable '"+e+"' as it is not defined in the master playlist");d.set(e,f)});return d},TF=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},UF=function(a,b){b=void 0===b?0:b;return b+10<=a.length&&73===a[b]&&68===a[b+1]&&51===a[b+2]&&255>a[b+3]&&255>a[b+4]&&128>a[b+6]&&128>a[b+7]&&128>a[b+8]&&128>a[b+
|
|
8
8
|
9]?!0:!1},VF=function(){this.a=new Map;this.f=new Map},WF=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.P(_.Q,4,4030);}UF(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===
|
|
9
9
|
unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}UF(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},XF=function(a){for(;a.getPosition()<a.Ga()-1;){var b=a.getPosition();if(71===_.gm(a))return EF(a),b}return-1},YF=function(a){function b(){d.seek(e+188);f=_.gm(d);71!=f&&(d.seek(e+192),f=_.gm(d));71!=f&&(d.seek(e+204),f=_.gm(d));71!=f&&c();EF(d)}function c(){throw new _.P(_.Q,4,4030);}var d=new _.dm(new DataView(a),
|
|
10
|
-
!1),e=0,f=0;e=XF(d);0>e&&(_.
|
|
11
|
-
_.nm).L(_.Je,_.nm).Y("mdhd",function(g){g.reader.skip(0==g.version?8:16);d=_.W(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.
|
|
12
|
-
h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.P(_.Q,4,4030,$E,c);return e},bG=function(a){var b=_.Ji(a,cF);if(!$F.includes(b))return aG.error("PlayReady in HLS is only supported with [",$F.join(", "),"], not",b),null;a=_.Ji(a,_.dc);b=_.
|
|
10
|
+
!1),e=0,f=0;e=XF(d);0>e&&(_.tu.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.gm(d),71!=f&&c(),a=_.hm(d),8191===(a&8191))b();else if(a&16384)if(a=(_.gm(d)&48)>>4,0!=a&&2!=a||c(),3==a&&(a=_.gm(d),d.skip(a)),1!=_.W(d)>>8)b();else{d.skip(3);a=_.gm(d)>>6;0!=a&&1!=a||c();0==_.gm(d)&&c();a=_.gm(d);var g=_.hm(d),h=_.hm(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},ZF=function(a,b){var c=null,d=0;try{(new _.mm).L(_.Oe,_.nm).L(_.fg,
|
|
11
|
+
_.nm).L(_.Je,_.nm).Y("mdhd",function(g){g.reader.skip(0==g.version?8:16);d=_.W(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.tu.error("Unable to find timescale in init segment!"),new _.P(_.Q,4,4030,$E,c);var e=0,f=!1;try{(new _.mm).L("moof",_.nm).L("traf",_.nm).Y("tfdt",function(g){var h=d;if(0===g.version)h=_.W(g.reader)/h;else{var l=_.W(g.reader),m=_.W(g.reader);if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");
|
|
12
|
+
h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.P(_.Q,4,4030,$E,c);return e},bG=function(a){var b=_.Ji(a,cF);if(!$F.includes(b))return aG.error("PlayReady in HLS is only supported with [",$F.join(", "),"], not",b),null;a=_.Ji(a,_.dc);b=_.et(a);a=null;b=_.Ui(b.data);try{a=_.tz(_.pn(b))}catch(c){a=b}return _.Cz(_.Pd,[{initDataType:_.rd,initData:a}],"")},cG=function(a){this.g=new _.K("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.oj()}},
|
|
13
13
|
eG=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,t;return _.E(function(v){switch(v.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.cd||d===_.bd)return v["return"](0);g=f;if(d!==_.ad){v.F(2);break}return _.x(v,dG(a,c,g),3);case 3:return h=v.f,l=_.Ui(h.data),UF(l)?v["return"](WF(l)):v["return"](YF(h.data));case 2:if(d!==_.ug&&d!==_.dd){v.F(4);break}m=[dG(a,c,g)];b&&m.push(dG(a,b,!0));return _.x(v,Promise.all(m),5);case 5:return n=v.f,p=n[0],q=n[1]||n[0],v["return"](ZF(p.data,
|
|
14
|
-
q.data));case 4:if(d!==_.tg){v.F(6);break}return _.x(v,dG(a,c,g),7);case 7:return t=v.f,v["return"](YF(t.data));case 6:if(!_.
|
|
14
|
+
q.data));case 4:if(d!==_.tg){v.F(6);break}return _.x(v,dG(a,c,g),7);case 7:return t=v.f,v["return"](YF(t.data));case 6:if(!_.Iz((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.P(_.Q,4,4030);}})},dG=function(a,b,c){var d,e,f,g,h,l,m;return _.E(function(n){switch(n.a){case 1:return d=b.f(),e=_.eA(b.Sa(),b.wa,b.wa+2048-1,a.a.attemptParameters),e.type=2,f=_.eA(b.Sa(),b.wa,b.ia,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.A(n,2),g=c?f:e,_.x(n,a.f(g),4);case 4:return h=
|
|
15
15
|
n.f,n["return"](h);case 2:l=_.C(n);if(7001===l.code||c)throw l;a.g.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS pre-flights.",e.uris[0]);_.A(n,5);return _.x(n,a.f(f),7);case 7:return n["return"](n.f);case 5:throw m=_.C(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.P(_.Q,4,4030,"Failed to fetch the media segment.");}})},fG=function(a){this.streams=
|
|
16
|
-
a},gG=function(a,b){a.streams.forEach(function(c){c.
|
|
16
|
+
a},gG=function(a,b){a.streams.forEach(function(c){c.Pe=b})},hG=function(a,b){a.streams.forEach(function(c){c.width=b})},iG=function(a,b){a.streams.forEach(function(c){c.height=b})},jG=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},kG=function(a,b){a.streams.forEach(function(c){c.bandwidth=b})},lG=function(a,b){var c=a.streams.find(function(d){d=d.S;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.S.find(function(d){return d.position===b})||null},mG=function(a,
|
|
17
17
|
b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},nG=function(a){this.a=a},oG=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},pG=function(a,b){var c=new Set(a.map(function(d){return d.ca}));return b.filter(function(d){return!c.has(d.ca)})},sG=function(a,b){for(;a[0].ca<b[0].ca;)a.splice(0,1);var c=a[0],d=b[0];qG(c,d)||rG(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&!qG(c,d)&&rG(c,d);for(c=e+1;c<
|
|
18
18
|
b.length;)a.push(b[c]),c++},tG=function(a,b){var c=a[a.length-1],d=b.findIndex(function(f){return f.ca===c.ca}),e=b[d];qG(c,e)||rG(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},yG=function(a,b,c,d){var e=a[0].length();e=TF(e).map(function(f){var g=oG(a,f)||[],h=mG(b,f)||[];f=mG(c,f)||[];var l=_.Og(uG(g)).concat(_.Og(h),_.Og(f)).filter(Boolean);vG(l);var m=l[0];l=m.ca;m=m.duration;return{variants:g,textStreams:h,thumbStreams:f,startTime:0,id:"P"+l,endTime:m,duration:m,ca:l}});d&&wG(e[0]);xG(e);return e},
|
|
19
19
|
uG=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},wG=function(a){var b=uG(a.variants)[0].S[0].ya;a.startTime+=b;a.endTime+=b},xG=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},qG=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},rG=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;zG(a.variants,b.variants);
|
|
20
|
-
AG(_.Y.
|
|
21
|
-
b;c.
|
|
22
|
-
IG=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,D,G,F,B;return _.E(function(I){if(1==I.a){c=_.
|
|
23
|
-
FG(a,l),2)}m=I.f;n=m.periods;p=m.
|
|
24
|
-
|
|
25
|
-
id:G.id,type:_.Mh,eventElement:null},a.
|
|
26
|
-
c.
|
|
27
|
-
t.stream.streams[0];t=Object.assign({},{
|
|
28
|
-
l.filter(function(q){return q.streams[0].type===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,
|
|
29
|
-
_.x(t,TG(a,e.
|
|
30
|
-
c=_.Y.
|
|
31
|
-
c)}))},OG=function(a,b){for(var c=new Map,d=_.u(b),e=d.next();!e.done;e=d.next()){var f=e.value,g=_.Ii(f,"AUDIO");e=_.Ii(f,_.
|
|
32
|
-
f.a){if(0===b.length)return f["return"](new Map);d=[bH(a,b[0],c)];return _.x(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return bH(a,g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.
|
|
33
|
-
D,c,d,e)}),_.x(z,Promise.all(q),3);t=z.f;t.splice(g,0,p);v=t.reduce(_.mi,[]);return z["return"](v)})},dH=function(a,b,c,d,e){var f,g,h,l,m,n;return _.E(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.Ji(h,_.
|
|
34
|
-
[],v={audio:n?t:[],video:p?t:[]},a.g.debug("Guessing stream type for",h.toString()),D=!1,G=l.a,F=v.audio.find(function(
|
|
35
|
-
O)return M["return"](null);v[z]=[O];z===f.AUDIO&&c&&t.forEach(function(
|
|
36
|
-
(b.push(m),d.add(l)))}}return b},KG=function(a,b,c,d){for(var e=[],f=(c||b).length(),g=0;g<f;g++){var h=b?b.streams[g]||null:null,l=c?c.streams[g]||null:null,m=_.Y.
|
|
37
|
-
m,n,p,q,t,v,z,D,G,F,B,I,O;return _.E(function(M){if(1==M.a){l=_.
|
|
38
|
-
|
|
39
|
-
b){var c=_.Ii(b,_.ta,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/),d=new Set,e=[];c=_.u(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.
|
|
40
|
-
aH(d,c),_.x(D,MG(a,{
|
|
41
|
-
n=g.
|
|
42
|
-
null;return{id:a.H++,originalId:v,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:Mc.
|
|
43
|
-
width:F?F.width:void 0,height:F?F.height:void 0,bandwidth:void 0,roles:[],channelsCount:z,spatialAudio:D,closedCaptions:G,keyInfo:
|
|
44
|
-
lH=function(a,b){var c,d,e,f,g,h,l;return _.E(function(m){if(1==m.a){c=_.Y.
|
|
45
|
-
|
|
46
|
-
_.
|
|
47
|
-
4,4044,"Unexpected change in file format.");},qH=function(a,b,c){a=_.Y.Qb(a.W,_.
|
|
48
|
-
_.dc);q=_.Y.
|
|
49
|
-
q.
|
|
50
|
-
break;case 5:return oH(n),F["return"](n)}})},vH=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,v,z,D,G,F;return _.E(function(B){if(1==B.a){h=d[0];if(null!=a.B)return B["return"](a.B);if(!GG(a)&&a.w)try{var I=a.f.get(c),O=I?lG(I,e)||null:null;if(!O)throw new _.P(_.Q,4,4030,"Segment not found in pervious playlist update.");l=O.startTime+O.ya;a.g.debug(eF+l+".");a.B=l;return B["return"](l)}catch(M){if(m=
|
|
51
|
-
t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+t+"."),b,m);throw new _.P(_.Q,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.x(B,xH(a,f,g,h),2)}if(3!=B.a)return v=B.f,z=uH.
|
|
52
|
-
return _.E(function(
|
|
53
|
-
|
|
54
|
-
b,g,e,f,null!=d))})},aH=function(a,b){if(1===b.length)return b[0];var c=_.Di(a,b);if(null!=c)return c;throw new _.P(_.Q,4,4025,{codecList:b});},xH=function(a,b,c,d){var e,f,g;return _.E(function(h){e=d.a;g=(f=_.Y.
|
|
55
|
-
n.f;m=l.headers["content-type"];if(!m)throw new _.P(_.Q,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.split(";")[0])})},mH=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=_.rj([b],a.a.attemptParameters),c.type=1,_.x(f,a.
|
|
56
|
-
function(c,d){_.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
20
|
+
AG(_.Y.Ae(a),_.Y.Ae(b))},zG=function(a,b){var c=new Map(a.map(function(d){return[_.Y.xg(d),d]}));b.forEach(function(d){c.get(_.Y.xg(d)).drmInfos=d.drmInfos})},AG=function(a,b){var c=new Map(a.map(function(d){return[d.Kb,d]}));b.forEach(function(d){var e=c.get(d.Kb);e.S=d.S;e.segmentIndex.replace(d.S);e.Zb=d.Zb;e.te=d.te;e.duration=d.duration;e.Bg=d.Bg;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},vG=function(a){var b=BG(a);a.forEach(function(c){_.$z(c.segmentIndex,b);c.duration=
|
|
21
|
+
b;c.te=c.Zb+b})},BG=function(a){var b=Infinity;_.Y.Oj(a).forEach(function(c){b=Math.min(b,c.duration)});return b},CG=function(){var a=this;this.a=this.D=null;this.H=1;this.f=new VF;this.o="";this.J=new MF;this.G=0;this.h=null;this.j=new _.uk(function(){a.Hb()});this.l=_.lc;this.w=null;this.A=new _.Aj;this.B=null;this.g=new _.K("clpp.hls.HlsParser");this.C=new Map;this.K=new cG(this.Xe.bind(this));this.I=!1},DG=function(a){if(null===a.h)return[];a=a.h;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.Kb})},
|
|
22
|
+
IG=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,D,G,F,B;return _.E(function(I){if(1==I.a){c=_.fp;d=_.Y;e=EG(a,b,a.o,"");if(1===e.type){f=e.S[0].a;var O=_.Ei(f)||"";g=null!=_.Fi.video[O]?_.sg:null!=_.Fi.audio[O]?_.$c:null;h="";g===c.VIDEO?h="avc1.42E01E":g===c.AUDIO&&(h="mp4a.40.2");O=a.J;var M=a.o,ba=a.a.hlsDefaultCodecs||h,ha=[],qa=[];qa.push(new _.Ki(_.pa,"0"));qa.push(new _.Ki(_.dc,M));ba.length&&qa.push(new _.Ki(_.ta,ba));ha.push(new _.Hi(O.f++,_.Ya,qa));e=new FF(M,0,ha)}l=_.Y.Ol(e.W);return _.x(I,
|
|
23
|
+
FG(a,l),2)}m=I.f;n=m.periods;p=m.Dh;q=m.Rh;if(!a.D)throw new _.P(_.Q,7,7001);t=d.hk(n[0]);O=!0;M=null;ba=0;GG(a)||(O=!1,M=0,ba=t.delay);M=new _.fA(M,ba,!0,void 0,!!a.a.lowLatencyMode);M.j=O;M.l=O;HG(M,n);p&&(M.H={offsetDateTime:p-_.oA(M,0),seekRangeStartDateTime:p});v=M;if(!GG(a)){a.G=t.yc;ba=0;M=_.u(a.f.values());for(O=M.next();!O.done;O=M.next())ba=Math.max(ba,O.value.streams[0].Zb);for(M=0;95443.7176888889<=ba;)M+=95443.7176888889,ba-=95443.7176888889;if(M)for(a.g.debug("Offsetting live streams by",
|
|
24
|
+
M,"to compensate for rollover"),ba=_.u(a.f.values()),O=ba.next();!O.done;O=ba.next())O=O.value.streams[0],95443.7176888889>O.Zb?(a.g.debug("Offset applied to",O.type),O.segmentIndex.offset(M)):a.g.debug("Offset NOT applied to",O.type)}O=_.Y.jk(n);"LIVE"===a.l||"EVENT"===a.l?(O=Math.max(O,v.G),isNaN(a.a.availabilityWindowOverride)||(O=a.a.availabilityWindowOverride),v.w=O):a.l===_.lc&&(v.f=O);if(q)for(z=_.u(q),D=z.next();!D.done;D=z.next())G=D.value,F={schemeIdUri:G.schemeIdUri,Wa:G.Wa,value:"",startTime:G.startTime,
|
|
25
|
+
endTime:G.endTime,id:G.id,type:_.Mh,eventElement:null},a.D.onTimelineCueAdded(F);B={presentationTimeline:v,adaptedPeriods:_.Og(n).concat(),periods:n,offlineSessionIds:[],minBufferTime:0};a.g.debug("HLS playlist parsed",B);return I["return"](B)})},LG=function(a,b){var c,d,e,f,g,h,l,m;return _.E(function(n){if(1==n.a)return c=_.Y,_.x(n,JG(a,b),2);d=n.f;e=d.textStreams;f=d.thumbStreams;g=d.ii;h=a.w.periods[0].variants;a.a.lowLatencyMode&&null!==a.h&&(h=h.filter(function(p){return p.id===a.h.id}));l=
|
|
26
|
+
h.map(function(p){var q=c.Gg(p.audio,g),t=c.Gg(p.video,g);p=KG(a,q,t,p.bandwidth);if(!p)throw new _.P(_.Q,4,4047,{message:"Video and audio are encrypted in an incompatible way.",qn:t?t.Ub():void 0,audio:q?q.Ub():void 0});return p});m=yG(l,e,f,!0);return n["return"](m)})},JG=function(a,b){var c,d,e,f,g,h,l,m,n;return _.E(function(p){if(1==p.a)return c=_.fp,d=function(q){return q.stream.streams[0].type===c.VIDEO||q.stream.streams[0].type===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),
|
|
27
|
+
g=function(q){q=q.map(function(t){var v=t.stream.streams[0];t=Object.assign({},{Ka:t.Ka},{language:v.language,channelsCount:v.channelsCount,spatialAudio:v.spatialAudio,closedCaptions:v.closedCaptions,primary:v.primary,kind:v.kind||null,groupId:v.groupId,type:v.type,codecs:v.codecs,name:v.originalId,uri:v.Kb,De:{width:v.width,height:v.height,frameRate:v.frameRate}});return MG(a,t)});return Promise.all(q)},_.x(p,g(e),2);if(3!=p.a)return h=p.f,_.x(p,g(f),3);l=p.f;NG(a,h.concat(l));m=l.filter(function(q){return q.streams[0].type===
|
|
28
|
+
c.bi});n=l.filter(function(q){return q.streams[0].type===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,ii:h})})},NG=function(a,b){b.forEach(function(c){a.f.a.set(c.Ub(),c)})},FG=function(a,b){var c,d,e,f,g,h,l,m,n,p,q;return _.E(function(t){switch(t.a){case 1:return c=_.Y.Hl(b.Yc.closedCaptions),d=OG(a,b.Qd),_.x(t,PG(a,b),2);case 2:return e=t.f,f=Object.values(e).flat().map(function(v){return v.Ka}),QG(a,f),_.x(t,RG(a,e.dg,d),3);case 3:return g=t.f,_.x(t,SG(a,e.Qd,g,c),4);case 4:return h=
|
|
29
|
+
t.f,_.x(t,TG(a,e.rm,d),5);case 5:return l=t.f,_.x(t,UG(a,e.jf),6);case 6:return m=t.f,n=VG(a,e),p=yG(h,l,m,!GG(a)),a.D.filterAllPeriods(p),GG(a)?(q=null,n&&(q=WG(f,n)),t["return"]({periods:p,Dh:null,Rh:q})):t["return"]({periods:p,Dh:n,Rh:null})}})},WG=function(a,b){var c=a.find(function(d){return null!==_.Y.Ra(d.W,_.La)});return c?c.W.filter(function(d){return d.name===_.La}).map(function(d){return _.Y.Il(d,b)}).filter(Boolean):null},VG=function(a,b){var c=_.Og(b.Qd).concat(_.Og(b.dg)).map(function(e){return e.Ka}).flatMap(function(e){return e.S[0].W});
|
|
30
|
+
c=_.Y.Ra(c,_.Wa);if(!c)return null;var d=(new Date(c.value)).getTime();return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+(c.value+").")),null):d/1E3},PG=function(a,b){var c,d,e,f,g,h;return _.E(function(l){if(1==l.a)return _.x(l,Promise.all([XG(a,b.Yc.hi),XG(a,b.Yc.sm),XG(a,b.Qd),XG(a,b.jf)]),2);c=l.f;d=_.u(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({dg:e,rm:f,Qd:g,jf:h})})},ZG=function(a,b){return Promise.all(b.map(function(c){return YG(a,
|
|
31
|
+
c)}))},OG=function(a,b){for(var c=new Map,d=_.u(b),e=d.next();!e.done;e=d.next()){var f=e.value,g=_.Ii(f,"AUDIO");e=_.Ii(f,_.kc);var h=_.Ii(f,_.Tb);f=$G(a,f);if(h){var l=_.Di(_.bg,f);c.set(h,l);h=f.indexOf(l);-1<h&&f.splice(h,1)}g&&(h=aH(_.$c,f),c.set(g,h));e&&(g=aH(_.sg,f),c.set(e,g))}return c},TG=function(a,b,c){return Promise.all(b.map(function(d){return bH(a,d,c)}))},UG=function(a,b){return Promise.all(b.map(function(c){return cH(a,c)}))},RG=function(a,b,c){var d,e;return _.E(function(f){if(1==
|
|
32
|
+
f.a){if(0===b.length)return f["return"](new Map);d=[bH(a,b[0],c)];return _.x(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return bH(a,g,c)})),_.x(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.um(e))})},SG=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v;return _.E(function(z){if(1==z.a){e=new Set;f=_.Og(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.Ji(f[l].tag,_.pa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.x(z,dH(a,n,c,d,e),2)}if(3!=z.a)return p=z.f,q=f.map(function(D){return dH(a,
|
|
33
|
+
D,c,d,e)}),_.x(z,Promise.all(q),3);t=z.f;t.splice(g,0,p);v=t.reduce(_.mi,[]);return z["return"](v)})},dH=function(a,b,c,d,e){var f,g,h,l,m,n;return _.E(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.Ji(h,_.pa)),m=f.Sl(h),_.x(p,eH(a,b,m,c,d),2)):(n=p.f)?p["return"](fH(a,n,l,e)):p["return"]([])})},eH=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,t,v,z,D,G,F,B,I,O;return _.E(function(M){if(1==M.a)return f=_.fp,g=b,h=g.tag,l=g.Ka,m=$G(a,h),n=_.Ii(h,"AUDIO"),p=_.Ii(h,_.kc),t=(q=n||p)&&d.has(q)?d.get(q):
|
|
34
|
+
[],v={audio:n?t:[],video:p?t:[]},a.g.debug("Guessing stream type for",h.toString()),D=!1,G=l.a,F=v.audio.find(function(ba){return ba.Kb===G}),B=_.Di(f.VIDEO,m),I=c||B,1!==m.length||I?!t.length&&1<m.length?(a.g.debug("Guessing multiplexed audio+video"),z=f.VIDEO,m=[m.join(",")]):v.audio.length&&F?(a.g.debug(bF),z=f.AUDIO,D=!0):v.video.length?(a.g.debug(bF),z=f.AUDIO):(a.g.debug("Guessing video-only"),z=f.VIDEO):(z=f.AUDIO,a.g.debug(bF)),O=null,D?M.F(2):_.x(M,gH(a,b,m,z,e,c),3);2!=M.a&&(O=M.f);if(null==
|
|
35
|
+
O)return M["return"](null);v[z]=[O];z===f.AUDIO&&c&&t.forEach(function(ba){hG(ba,c.width);iG(ba,c.height);jG(ba,c.frameRate)});_.Y.Kj(v);return M["return"](v)})},fH=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.u(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.u(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.Gj(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):(m=KG(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):
|
|
36
|
+
(b.push(m),d.add(l)))}}return b},KG=function(a,b,c,d){for(var e=[],f=(c||b).length(),g=0;g<f;g++){var h=b?b.streams[g]||null:null,l=c?c.streams[g]||null:null,m=_.Y.bk(h,l);if(!m)return null;var n=d;h={id:a.H++,language:h?h.language:_.hg,primary:!!h&&h.primary||!!l&&l.primary,audio:h,video:l,bandwidth:n,drmInfos:m,allowedByApplication:!0,allowedByKeySystem:!0};e.push(h)}return new nG(e)},bH=function(a,b,c){var d,e,f,g;return _.E(function(h){d=b;e=d.tag;f=d.Ka;g=f.a;return h["return"](hH(a,g,function(){var l,
|
|
37
|
+
m,n,p,q,t,v,z,D,G,F,B,I,O;return _.E(function(M){if(1==M.a){l=_.fp;m=_.Ji(e,_.db);n=_.Y.vg(_.Ji(e,_.bc));p=_.Y.Cj(e);q=c.get(m)||"";t=_.Ii(e,_.sb);v=_.Ii(e,"NAME");z=e.getAttribute("DEFAULT");D=e.getAttribute("AUTOSELECT");G=_.Ii(e,"CHANNELS");F=n===l.AUDIO?G?parseInt(G.split("/")[0],10):null:null;var ba=n===l.AUDIO?(ba=_.Ii(e,"CHANNELS"))?ba.includes("/JOC"):!1:!1;B=ba;I=!!z&&!!D;return _.x(M,MG(a,{Ka:f,codecs:q,type:n,Fd:t,primary:I,name:v,channelsCount:F,spatialAudio:B,groupId:m,kind:p,closedCaptions:null,
|
|
38
|
+
De:null}),2)}O=M.f;return M["return"](O)})}))})},cH=function(a,b){var c,d,e,f;return _.E(function(g){c=b;d=c.tag;e=c.Ka;f=e.a;return g["return"](hH(a,f,function(){var h,l,m,n,p;return _.E(function(q){if(1==q.a)return h=_.Ii(d,_.ta)||"jpg",l=_.Ii(d,_.sb),m=_.Ii(d,"NAME"),_.x(q,MG(a,{Ka:e,codecs:h,type:_.ue,Fd:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,groupId:null,De:null}),2);n=q.f;(p=_.Ii(d,_.pa))&&kG(n,Number(p));return q["return"](n)})}))})},$G=function(a,
|
|
39
|
+
b){var c=_.Ii(b,_.ta,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/),d=new Set,e=[];c=_.u(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.Pz(f)[0];d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},gH=function(a,b,c,d,e,f){var g,h,l,m,n;return _.E(function(p){g=b;h=g.tag;l=g.Ka;m=_.fp;n=l.a;return p["return"](hH(a,n,function(){var q,t,v,z;return _.E(function(D){if(1==D.a)return q=_.Ii(h,_.sa),t=null,d===m.VIDEO&&q&&"NONE"!==q&&(t=e.get(q)),v=
|
|
40
|
+
aH(d,c),_.x(D,MG(a,{Ka:l,codecs:v,type:d,closedCaptions:t,primary:!1,kind:null,Fd:null,name:null,channelsCount:null,spatialAudio:!1,groupId:null,De:f}),2);z=D.f;return D["return"](z)})}))})},hH=function(a,b,c){if(a.f.has(b))return a=a.f.get(b),Promise.resolve(a);if(a.f.f.has(b))return a.f.f.get(b)||null;c=c();a.f.set(b,c);return c},MG=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,t,v,z,D,G,F,B,I,O,M,ba,ha,qa,Ta,Fa;return _.E(function(Ca){if(1==Ca.a){c=iH;d=_.ZE;e=_.fp;f=_.Y;g=b;h=g.Ka;l=g.codecs;m=g.type;
|
|
41
|
+
n=g.Fd;p=g.groupId;q=g.primary;t=g.kind;v=g.name;z=g.channelsCount;D=g.spatialAudio;G=g.closedCaptions;F=g.De;B=_.Y.Og(n);if(1!==h.type)throw new _.P(_.Q,4,4017);I=_.Y.Ql(h.W);jH(a,I);O=_.Y.Nl(h.W,I,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay);return _.x(Ca,kH(a,h,m,l),2)}M=Ca.f;ba=a.a.lowLatencyMode?d.Lm:d.Mm;ha=t;m!==e.TEXT||t||(ha=_.Zf);qa=f.Bh(h.W);Ta=qa.Zd;Fa=M.map(function(na){var Ia=na.S,tb=na.Mj,Jb=na.mimeType;na=na.ca;var Lc=Ia[0].startTime,Dm=Ia[Ia.length-1].endTime,Ms=Dm-Lc,Mc=
|
|
42
|
+
new _.uA(Ia),Em=Ia[0].initSegment||null;return{id:a.H++,originalId:v,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:Mc.Mc.bind(Mc),getSegmentReference:Mc.get.bind(Mc),adjustSegmentDurations:Mc.jd.bind(Mc),getDuration:Mc.getDuration.bind(Mc),segmentIndex:Mc,segmentLookupStrategy:ba,initSegmentReference:Em,mimeType:Jb,codecs:l,kind:ha,Bg:tb.type,encrypted:tb.type===c.ai,keyId:tb.keyId,language:B,originalLanguage:n||_.hg,label:v,type:m,primary:q,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
43
|
+
frameRate:F?F.frameRate:void 0,width:F?F.width:void 0,height:F?F.height:void 0,bandwidth:void 0,roles:[],channelsCount:z,spatialAudio:D,closedCaptions:G,keyInfo:tb.keyInfo,S:Ia,drmInfos:tb.drmInfos,ca:na,Kb:h.a,Pe:h.f,Zb:Lc,te:Dm,duration:Ms,Zd:Ta,groupId:p,Hk:O}});return Ca["return"](new fG(Fa))})},XG=function(a,b){var c;return _.E(function(d){if(1==d.a)return _.x(d,Promise.all(b.map(function(e){var f;return _.E(function(g){if(1==g.a)return _.x(g,lH(a,e),2);f=g.f;return g["return"](f?{tag:e,Ka:f}:
|
|
44
|
+
null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},lH=function(a,b){var c,d,e,f,g,h,l;return _.E(function(m){if(1==m.a){c=_.Y.Ek(b);d=_.Ii(b,_.dc,void 0,{required:c});if(!d)return m["return"](null);e=_.Y.rd(a.o,d);return _.x(m,mH(a,e),2)}f=m.f;g=f.response;h=f.text;l=g.uri;return m["return"](EG(a,h,l,d))})},YG=function(a,b){var c,d,e,f,g,h,l,m;return _.E(function(n){if(1==n.a){var p=new _.qi(b.streams[0].Pe);if(a.a.lowLatencyMode&&b.streams[0].Zd){var q=b.streams[b.streams.length-1].segmentIndex;
|
|
45
|
+
if(q=q.a[q.a.length-1]){var t=q.a,v=t.length-1;q={Mk:q.position,Tl:t&&0<t.length?v:null}}else q=null;if(t=q)q=t.Mk,t=t.Tl,v=_.ak(p.a.toString()),v._HLS_msn=q.toString(),null===t&&v._HLS_part&&delete v._HLS_part,null!==t&&(v._HLS_part=t.toString()),q=_.Zj(v,!0),_.ti(p,new _.xi(q))}c=p.toString();return _.x(n,mH(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.Ub();h=b.streams[0].Pe;l=e.uri;h!==l&&(h=l,gG(b,h));m=EG(a,f,h,g);return n["return"]({stream:b,Ka:m})})},EG=function(a,b,c,d){a=PF(a.J,b,c);a.a=d;nH(a);
|
|
46
|
+
return a},nH=function(a){1===a.type&&a.S.forEach(function(b,c){if(_.Y.Wb(b.W,_.Qa)&&!_.Y.Wb(b.W,_.Ma)&&0<c)throw new _.P(_.Q,4,4046,"Media playlist contains an EXT-X-MAP tag not accompanied by an EXT-X-DISCONTINUITY tag.");})},oH=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.P(_.Q,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},pH=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.Ii(c,
|
|
47
|
+
_.dc)})||null}).map(function(b){return _.Ei(b)});if(1<(new Set(a)).size)throw new _.P(_.Q,4,4044,"Unexpected change in file format.");},qH=function(a,b,c){a=_.Y.Qb(a.W,_.Qa);if(1<a.length)throw new _.P(_.Q,4,4020);a=a[0];if(!a)return null;var d=_.Ji(a,_.dc),e=_.Y.rd(b,d);b=_.Y.zh(a,null,!0);return new _.Dz(function(){return[e]},b.wa,b.ia,c)},rH=function(a,b,c,d,e,f,g){var h=[],l={};b=_.u(_.YE(b.f));for(var m=b.next();!m.done;l={Fe:l.Fe},m=b.next()){var n=m.value;m=n.Vg;n=n.item;var p=0===m,q=p?a:
|
|
48
|
+
h[h.length-1],t=p?d:q.endTime,v=Number(_.Ii(n,_.Ga));v=t+v;p=_.Y.zh(n,p?null:q.ia,p);q=_.Ii(n,_.dc);q=_.Y.rd(g,q);l.Fe=q?[q]:[];t=new _.Mi(c,t,v,function(z){return function(){return z.Fe}}(l),p.wa,p.ia,e,f,!1,null,null,null,null);if("YES"===_.Ii(n,"INDEPENDENT")||0===m)t.h=!0;h.push(t)}return h},sH=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.W,q=c.a,t=null!=q,v=q?[q]:[];if(!t&&!a.a.lowLatencyMode)return null;a=0;q={wa:0,ia:null};var z=null;t?(c=_.Y.Ll(p).duration,a=e+c,q=_.Y.Ah(p,b?b.ia:null)):(b=rH(b,
|
|
49
|
+
c,d,e,f,g,l),a=b[b.length-1].endTime,z=b);h=h===_.ue?_.Y.Rl(p):null;d=new _.Mi(d,e,a,function(){return v},q.wa,q.ia,f,g,!1,null,h?h.Sg:null,h?h.Th:null,h?h.durationPerTile:null,z);d.ca=m;d.initSegment=n||void 0;return d},kH=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,t,v,z,D,G;return _.E(function(F){switch(F.a){case 1:return e=_.Y,f=tH,g=uH,h=b.a,l=b.S,m=e.ek(b.W,_.Ra),n=[],!GG(a)&&g.gi(l),_.x(F,vH(a,b.f,h,l,m,c,d),2);case 2:p=F.f,q=m,t=f.pm(l),v=0;case 3:if(!(v<t.length)){F.F(5);break}z=t[v];D=n[n.length-
|
|
50
|
+
1]||null;return _.x(F,wH(a,b.f,z,q,p,c,d,D,t.length),6);case 6:G=F.f;n.push(G);q+=z.length;v++;F.F(3);break;case 5:return oH(n),F["return"](n)}})},vH=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,t,v,z,D,G,F;return _.E(function(B){if(1==B.a){h=d[0];if(null!=a.B)return B["return"](a.B);if(!GG(a)&&a.w)try{var I=a.f.get(c),O=I?lG(I,e)||null:null;if(!O)throw new _.P(_.Q,4,4030,"Segment not found in pervious playlist update.");l=O.startTime+O.ya;a.g.debug(eF+l+".");a.B=l;return B["return"](l)}catch(M){if(m=
|
|
51
|
+
a.f.get(c))n=m.streams[0].S[0].position,B=m.streams[m.streams.length-1].S,p=B[B.length-1].position,q=e,t=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+t+"."),b,m);throw new _.P(_.Q,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.x(B,xH(a,f,g,h),2)}if(3!=B.a)return v=B.f,z=uH.Pl(h,a.o,v),D=qH(h,b,z.keyInfo),G=_.Y.ff(z.keyInfo,e),_.x(B,yH(a,D,h,G,v,g),3);F=B.f;a.g.debug(eF+F+".");a.B=F;return B["return"](F)})},
|
|
52
|
+
wH=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,t,v,z,D,G,F,B,I,O,M,ba,ha,qa,Ta,Fa,Ca,na;return _.E(function(Ia){switch(Ia.a){case 1:return m=_.Y,n=uH,p=c[0],q=null==h,pH(c),_.x(Ia,xH(a,f,g,p),2);case 2:t=Ia.f;v=n.Kl(c,a.o,t,h?h.Gk:null,1===l);z=v[v.length-1];D=uH.oa(v);G=qH(p,b,D.keyInfo)||(h?h.wk:null);F=_.Y.ff(D.keyInfo,d);B=p.ca;if(q){I=e;Ia.F(3);break}return _.x(Ia,zH(a,B,G,p,d,F,t,g),4);case 4:I=Ia.f;case 3:O=I;M=[];for(ba=0;ba<c.length;ba++)ha=c[ba],qa=M[M.length-1]||null,Ta=0===ba?0:qa.endTime,
|
|
53
|
+
Fa=d+ba,Ca=m.ff(D.keyInfo,Fa),(na=sH(a,qa,ha,Fa,Ta,O,Ca,f,b,B,G))&&M.push(na);return Ia["return"]({S:M,Mj:D,Gk:z,mimeType:t,endTime:M[M.length-1].endTime,ca:B,wk:G})}})},QG=function(a,b){b.forEach(function(c){var d=a.f.get(c.a);tH.mi(c,d,!GG(a))});tH.Hj(b)},zH=function(a,b,c,d,e,f,g,h){var l;return _.E(function(m){if(1==m.a)return a.C.has(b)?m["return"](a.C.get(b)):_.x(m,yH(a,c,d,f,g,h),2);l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.C.set(b,l);return m["return"](l)})},yH=
|
|
54
|
+
function(a,b,c,d,e,f){var g;return _.E(function(h){if(null==c.a)return h["return"](0);g=_.Y.Fj(c,d);return h["return"](eG(a.K,b,g,e,f,null!=d))})},aH=function(a,b){if(1===b.length)return b[0];var c=_.Di(a,b);if(null!=c)return c;throw new _.P(_.Q,4,4025,{codecList:b});},xH=function(a,b,c,d){var e,f,g;return _.E(function(h){e=d.a;g=(f=_.Y.Ra(d.W,_.Qa))?_.Ji(f,_.dc):null;return h["return"](AH(a,b,c,e,g))})},AH=function(a,b,c,d,e){var f,g,h,l,m;return _.E(function(n){if(1==n.a){f=[d,e].filter(Boolean);
|
|
55
|
+
if(g=_.Gi(f,b,c))return n["return"](g);h=_.rj([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.x(n,a.Xe(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.P(_.Q,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.split(";")[0])})},mH=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=_.rj([b],a.a.attemptParameters),c.type=1,_.x(f,a.Xe(c),2);d=f.f;e="";try{e=_.R.Z(d.data)}catch(g){throw new _.P(_.Q,4,4042);}e=_.R.ih(e);e=e.trim();return f["return"]({text:e,
|
|
56
|
+
response:d})})},GG=function(a){return a.l===_.lc},jH=function(a,b){a.l=b;GG(a)&&a.j.stop()},HG=function(a,b){_.Y.eh(b,function(c,d){_.jA(a,c.S,d.startTime)})},BH=function(){},iH={ai:iF,Qm:jF,NONE:_.Se};_.r=VF.prototype;_.r.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};_.r.has=function(a){return this.a.has(a)};_.r.get=function(a){return this.a.get(a)||null};_.r.values=function(){return Array.from(this.a.values())};
|
|
57
|
+
_.r.clear=function(){this.f.clear();this.a.clear()};
|
|
58
|
+
var tH={Hj:function(a){var b=tH.Vj(a),c=tH.Fk(a);a.forEach(function(d){var e=d.S,f=e.findIndex(function(h){return h.ca===b}),g=e.findIndex(function(h){return h.ca===c+1});-1===g&&(g=e.length);d.S=e.slice(f,g)})},mi:function(a,b,c){b=tH.dk(a,b,c);a=_.u(a.S||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.Wb(c.W,_.Ma)&&b++,c.ca=b},dk:function(a,b,c){var d=_.Y.Ra(a.W,_.Na);if(d)return Number(d.value);d=tH.yk(b);if(c&&d)try{return tH.vk(a,b)}catch(e){throw new _.P(_.Q,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");
|
|
59
|
+
}return 0},yk:function(a){return 0<tH.gk(a)},pm:function(a){if(0===a.length)return[];var b=[],c=[];a=_.u(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.Wb(d.W,_.Ma)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},gk:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].S;return a[a.length-1].ca},vk:function(a,b){var c=_.Y.Ra(a.W,_.Ra);if(!c)throw tH.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(aF);c=Number(c.value);var d=
|
|
60
|
+
lG(b,c);if(!d)throw tH.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(aF);return d.ca},Fk:function(a){a=a.map(function(b){return b.S[b.S.length-1].ca});return Math.min.apply(Math,_.Og(a))},Vj:function(a){a=a.map(function(b){return b.S[0].ca});return Math.max.apply(Math,_.Og(a))}};tH.g=new _.K("clpp.hls.DiscontinuityUtils");var CH={"com.apple.streamingkeydelivery":function(a,b){if(b===_.tg)throw new _.P(_.Q,4,4041);if(_.Ji(a,cF)===dF)throw new _.P(_.Q,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.Cz(_.Md,[{initDataType:_.Qf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":bG,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":bG,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.Ji(a,cF);if(!$F.includes(b))return aG.error("Widevine in HLS is only supported with [",
|
|
61
|
+
$F.join(", "),"], not",b),null;b=_.Ji(a,_.dc);b=_.et(b);b=_.Ui(b.data);b=_.Cz(_.Rd,[{initDataType:_.rd,initData:b}],"");if(a=_.Ii(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},$F=["SAMPLE-AES",dF],aG=new _.K("clpp.hls.DrmParser");var uH={Pl:function(a,b,c){return uH.Ef(a.W,b,c)||{type:_.Se,keyInfo:null,drmInfos:[],keyId:null}},Kl:function(a,b,c,d,e){if(a.slice(1).some(uH.Tg))throw new _.P(_.Q,4,4046,e?"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not at the beginning of the playlist.":"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not marked by an EXT-X-DISCONTINUITY tag and is not at the beginning of the playlist.");if(_.Y.Wb(a[0].W,_.Pa)||null===d){if((d=uH.Ef(a[0].W,
|
|
62
|
+
b,c))&&d.type===jF){if(1<uH.wg(a))throw new _.P(_.Q,4,4046,fF+((e?"playlist":"discontinuity")+"."));return[d]}a=uH.xh(a,b,c);return 0===a.length?[{type:_.Se,keyInfo:null,drmInfos:[],keyId:null}]:a}b=uH.xh(a,b,c);if(d.type===_.Se||d.type===iF)return[d].concat(_.Og(b));if(0<uH.wg(a))throw new _.P(_.Q,4,4046,fF+((e?"playlist":"discontinuity")+"."));return[d]},oa:function(a){if(0===a.length)return{type:_.Se,keyInfo:null,drmInfos:[],keyId:null};if(a.some(function(c){return c.type===jF})||a.every(function(c){return c.type===
|
|
63
|
+
_.Se}))return a[0];a=a.filter(function(c){return c.type===iF});var b=_.Xh(a.flatMap(function(c){return c.drmInfos}));return{keyInfo:null,keyId:a[a.length-1].keyId,type:iF,drmInfos:b}},gi:function(a){a=uH.Fg(a);if(a.some(function(b){return uH.Tg(b)})&&1<a.length)throw new _.P(_.Q,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},Tg:function(a){return _.Y.Qb(a.W,_.Pa).some(function(b){return"AES-128"===_.Ii(b,cF)})},xh:function(a,b,c){return uH.Fg(a).map(function(d){return uH.Ef(d.W,
|
|
64
|
+
b,c)})},wg:function(a){return a.filter(function(b){return _.Y.Wb(b.W,_.Pa)}).length},Fg:function(a){return a.filter(function(b){return _.Y.Wb(b.W,_.Pa)})},Ef:function(a,b,c){a=_.Y.Qb(a,_.Pa);if(0===a.length)return null;var d=_.Ji(a[0],cF);if(1===a.length){if("NONE"===d)return{type:_.Se,keyInfo:null,drmInfos:[],keyId:null};if("AES-128"===d)return a=a[0],d=_.Ii(a,"IV",""),{type:jF,keyInfo:{method:"AES-128",url:_.Y.rd(b,_.Ji(a,_.dc)),iv:d?_.gj((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(function(e){return _.Ji(e,
|
|
64
65
|
cF)});if(!b.every(function(e){return"SAMPLE-AES"===e})&&!b.every(function(e){return e===dF}))throw uH.g.warn("EXT-X-KEY methods "+b.join(", ")+" are incompatible."),new _.P(_.Q,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(function(e){var f=_.Ii(e,"KEYFORMAT","identity"),g=CH[f]||null;(e=g?g(e,c):null)||uH.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.P(_.Q,4,4026);return{keyInfo:null,keyId:b.map(function(e){return e.keyIds}).reduce(function(e,
|
|
65
|
-
f){return e.concat(f)},[]).reverse()[0]||null,type:iF,drmInfos:b}},
|
|
66
|
-
_.r.stop=function(){this.j&&(this.j.stop(),this.j=null);var a=[];this.A&&(a.push(this.A.destroy()),this.A=null);this.f.clear();this.w=this.a=this.
|
|
67
|
-
_.r.update=function(){var a=this,b,c,d,e,f,g,h;return _.E(function(l){if(1==l.a){b=a.w;if(GG(a)||!b)return l["return"]();c=b.presentationTimeline;"LIVE"===a.l&&(a.B=null);d=Array.from(a.f.values());a.a.
|
|
68
|
-
HG(c,h);_.Y.
|
|
66
|
+
f){return e.concat(f)},[]).reverse()[0]||null,type:iF,drmInfos:b}},jn:function(){return{type:_.Se,keyInfo:null,drmInfos:[],keyId:null}}};uH.g=new _.K("clpp.hls.EncryptionUtils");_.r=fG.prototype;_.r.length=function(){return this.streams.length};_.r.fk=function(){return this.streams[0].groupId};_.r.ak=function(){return this.streams[0].codecs.split(",")};_.r.Ub=function(){return this.streams[0].Kb};_.r.im=function(a){this.streams.forEach(function(b){b.codecs=a.join(",")})};nG.prototype.length=function(){return this.a.length};_.r=CG.prototype;_.r.configure=function(a){this.a=a;this.K.a=a};_.r.setCurrentVariant=function(a){this.h=a};_.r.start=function(a,b){var c=this,d,e,f,g,h;return _.E(function(l){if(1==l.a){if(c.I)throw Error("start() may be called only once!");c.I=!0;c.D=b;return _.x(l,mH(c,a),2)}if(3!=l.a)return d=l.f,e=d.response,f=d.text,c.o=e.uri,_.x(l,IG(c,f),3);g=l.f;c.w=g;h=c.G;0<h&&c.j.aa(h);return l["return"](g)})};
|
|
67
|
+
_.r.stop=function(){this.j&&(this.j.stop(),this.j=null);var a=[];this.A&&(a.push(this.A.destroy()),this.A=null);this.f.clear();this.w=this.a=this.D=this.h=null;return Promise.all(a)};_.r.onExpirationUpdated=function(){};
|
|
68
|
+
_.r.update=function(){var a=this,b,c,d,e,f,g,h;return _.E(function(l){if(1==l.a){b=a.w;if(GG(a)||!b)return l["return"]();c=b.presentationTimeline;"LIVE"===a.l&&(a.B=null);d=Array.from(a.f.values());a.a.lowLatencyMode&&null!==a.h&&(e=DG(a),d=d.filter(function(m){return e.includes(m.Ub())}));return _.x(l,ZG(a,d),2)}if(3!=l.a)return f=l.f,g=f.map(function(m){return m.Ka}),QG(a,g),_.x(l,LG(a,f),3);h=l.f;pG(b.periods,h).forEach(function(m){a.D.filterNewPeriod(m)});sG(b.periods,h);tG(b.adaptedPeriods,h);
|
|
69
|
+
HG(c,h);_.Y.tk(g)&&(jH(a,_.lc),c.j=!0,c.l=!0,c.f=h[h.length-1].endTime);_.y(l)})};_.r.Hb=function(){var a=this,b,c,d;return _.E(function(e){if(1==e.a){a.g.debug(_.Yy);if(!a.D)return e["return"]();_.A(e,2);return _.x(e,a.update(),4)}if(2!=e.a)return b=a.G,a.j.aa(b),_.ah(e,0);c=_.C(e);if(!(c instanceof _.P))throw c;a.D&&(a.D.onError(c),d=c,1===d.severity&&a.j.aa(.1));_.y(e)})};_.r.Xe=function(a){if(!this.A)throw new _.P(_.Q,7,7001);a=this.D.networkingEngine.fetch(a);_.Bj(this.A,a);return a.O};_.w(BH,_.Ir);BH.prototype.f=function(){_.Fs.m3u8=CG;_.Ds[_.dl]=CG;_.Ds[gF]=CG};BH.prototype.a=function(){_.CA("m3u8");_.DA(_.dl);_.DA(gF)};BH.prototype.id=function(){return"hls"};_.H("clpp.hls.HlsComponent",BH);};
|
|
69
70
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
70
71
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
71
72
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hlssmpte.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var VO=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.N.R(a)){a:{var b=a.info;if(_.N.$(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.N.$(a)?a:null}},XO=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Eh;this.h=(a=_.
|
|
3
|
-
YO=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.
|
|
4
|
-
$O=function(a){return a.some(function(b){return b.kind===_.Le})},aP=function(a,b){var c=a.m.getTrackManager(),d=c.
|
|
5
|
-
c.mode=_.
|
|
6
|
-
a.m.getTrackManager().
|
|
7
|
-
_.H("clpp.hlssmpte.HlsSmptePlugin",dP);dP.Id="hlssmpte";eP.prototype.create=function(){return new dP};_.
|
|
2
|
+
var f=function(window){var VO=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.N.R(a)){a:{var b=a.info;if(_.N.$(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.N.$(a)?a:null}},XO=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Eh;this.h=(a=_.ft[_.Xc]||null)?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;WO(this)},WO=function(a){a.a.one(a.m,_.Ee,function(){return YO(a)})},
|
|
3
|
+
YO=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Kc,function(d){return ZO(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Le}).forEach(function(d){ZO(a,{track:d})});!$O(c)&&a.l&&(a.g.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),aP(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
|
|
4
|
+
$O=function(a){return a.some(function(b){return b.kind===_.Le})},aP=function(a,b){var c=a.m.getTrackManager(),d=c.ja(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.za(d)};a.a.on(b.textTracks,_.Kc,function(g){g.track.kind===_.Le&&(a.a.off(b.textTracks,_.Kc,f),f())});c.za(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},ZO=function(a,b){var c=b.track;c.kind===_.Le&&(a.g.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.se,a.a.on(c,_.Ud,function(d){return bP(a,d)}))},bP=function(a,b){var c=cP(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new VO(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.R.Va(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},cP=function(a){return(a=
|
|
6
|
+
a.m.getTrackManager().ua())&&a.language&&a.language.toLowerCase()},dP=function(){this.a=null;this.f=!1},eP=function(){};XO.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.w(dP,_.rt);dP.prototype.onPlayerCreated=function(){};dP.prototype.onContentWillLoad=function(a){if(this.f=_.Bk()){var b=a.getConfiguration();b=_.N.Oa(b.hlssmpte||{});_.N.Zg(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.N.na(b.timestampOffset)||(b.timestampOffset=0);this.a=new XO(a,b.patchMetadataTrack,b.timestampOffset)}};dP.prototype.onPlayerWillDestroy=function(){var a=this;return _.E(function(b){if(1==b.a)return a.a?_.x(b,a.a.destroy(),3):b.F(0);a.a=null;_.y(b)})};dP.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.H("clpp.hlssmpte.HlsSmptePlugin",dP);dP.Id="hlssmpte";eP.prototype.create=function(){return new dP};_.nq(new eP);};
|
|
8
8
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
9
9
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
10
10
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.htmlcue.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var LN="CLPP Subtitle Styles",MN="Unsupported unit",NN="clpp-text-plain",ON="clpp-text-ttml",PN="clpp.htmlcue.HtmlTextDisplayer",QN="initial",RN=function(a){return _.Xh(a,{
|
|
2
|
+
var f=function(window){var LN="CLPP Subtitle Styles",MN="Unsupported unit",NN="clpp-text-plain",ON="clpp-text-ttml",PN="clpp.htmlcue.HtmlTextDisplayer",QN="initial",RN=function(a){return _.Xh(a,{ug:function(b,c){return b.ta(c)}})},SN=function(a,b){if(0===b.length)return a;var c=a,d=a.findIndex(function(e){return e.startTime>=b[0].startTime});0<=d&&(c=c.slice(0,d));return c.concat(b)},TN=function(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},UN=function(){},VN=function(a){if(!a.input)return null;
|
|
3
3
|
var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},XN=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return WN[c]});return a},ZN=function(a,b){YN(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){YN(a,c)})},YN=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},$N=function(a,b){return 0===a?"0":a+b},aO=function(a,b){return 1>Math.abs(a-b)||a<b},bO=function(a,b){return a<b&&
|
|
4
4
|
1<Math.abs(a-b)},cO=function(a,b){return a>b&&1<Math.abs(a-b)},dO=function(a,b){return 1>Math.abs(a-b)||a>b},eO=function(a,b,c,d,e,f){this.left=a;this.f=b;this.top=c;this.a=d;this.height=e;this.width=f},fO=function(a){return new eO(a.left,a.f,a.top,a.a,a.height,a.width)},gO=function(a){var b=a.getBoundingClientRect(),c=getComputedStyle(a,null),d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0,f=parseFloat(c.getPropertyValue("border-top-width"))||
|
|
5
5
|
0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;var g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new eO(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},hO=function(a,b){return b.some(function(c){return bO(a.left,c.f)&&cO(a.f,c.left)&&bO(a.top,c.a)&&cO(a.a,c.top)})},iO=function(a,b){return dO(a.top,b.top)&&aO(a.a,b.a)&&dO(a.left,b.left)&&aO(a.f,b.f)},jO=function(a,b,c){switch(c){case "+x":return bO(a.left,b.left);case "-x":return cO(a.f,b.f);
|
|
6
|
-
case "+y":return bO(a.top,b.top);case "-y":return cO(a.a,b.a);default:throw Error("Unknown axis");}},kO=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},lO=function(a,b,c){kO.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.
|
|
7
|
-
pO(a))&&_.N.
|
|
8
|
-
tO=function(a){switch(a.f.positionAlign){case _.
|
|
6
|
+
case "+y":return bO(a.top,b.top);case "-y":return cO(a.a,b.a);default:throw Error("Unknown axis");}},kO=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},lO=function(a,b,c){kO.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},nO=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect(),d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return mO(a)?b:c},qO=function(a,b,c){return mO(a)&&_.N.na(c)?$N(c,_.Df):(oO(a)||
|
|
7
|
+
pO(a))&&_.N.na(b)?$N(b,"%"):QN},oO=function(a){return a.f.writingMode===_.qg},pO=function(a){return a.f.writingMode===_.rg},mO=function(a){return a.f.writingMode===_.$h},rO=function(a,b,c){return(oO(a)||pO(a))&&_.N.na(c)?$N(c,_.Df):oO(a)&&_.N.R(c)?$N(0,_.Df):mO(a)&&_.N.na(b)?$N(b,"%"):QN},sO=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Ce:return a.f.position;case "auto":case _.sd:return a.f.position-a.f.size/2;case _.De:return a.f.position-a.f.size}return 0},
|
|
8
|
+
tO=function(a){switch(a.f.positionAlign){case _.Ce:return _.ye;case "auto":case _.sd:return _.Zh;case _.De:return _.Kf}return a.f.textAlign},uO=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.ye:case _.ye:return _.Ce;case _.Zh:return _.sd;case _.Kf:case _.Kf:return _.De}return a.f.positionAlign},vO=function(a){switch(a.f.writingMode){case _.$h:return"horizontal-tb";case _.qg:return _.qg;case _.rg:return _.rg;default:throw Error("Unknown writing mode");}},wO=function(a,b){this.l=a;this.f=
|
|
9
9
|
a.a;this.j=void 0===b?!1:b;this.a=gO(a.a);this.h=[]},xO=function(a,b){if(a.j)switch(b.writingMode){case _.$h:return["-y"];case _.qg:return["+x"];case _.rg:return["-x"]}var c=[];switch(b.writingMode){case _.$h:c=["+y","-y"];break;case _.qg:c=["+x","-x"];break;case _.rg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},yO=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=gO(a.l.a)},zO=function(a,b,c){kO.call(this,a,b,c);this.h=null;this.l=[]},AO=function(a,b){yO(a.h);
|
|
10
10
|
a.l.unshift(b);for(var c=_.u(a.l),d=c.next();!d.done;d=c.next())a.h.append(d.value)},BO=function(a,b){zO.call(this,a.id,"clpp-text-cue-region",b);this.f=a},CO=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.ei)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(MN);},EO=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.l=[];this.h=a.getSurface().getUniqueCssClass();this.j=[];this.a=DO(this,this.h);this.f=DO(this,
|
|
11
11
|
this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},FO=function(a,b){var c=!1;try{a.f.insertRule(b,0);var d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},GO=function(a,b){var c="."+a.h+" .clpp-text-container",d=c+" .clpp-text-cue";return b=b.replace(/::cue\((#[^)]+)\)/g,c+" $1").replace(/::cue\(([^)]+)\)/g,
|
|
12
12
|
d+" $1").replace(/::cue-region\(([^)]+)\)/g,c+" $1 .clpp-text-cue").replace(/::cue/g,d).replace(/::cue-region/g,c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,c)},DO=function(a,b,c){var d=document.createElement(_.Yf),e=d.dataset;e.name=LN;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);HO(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},HO=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===
|
|
13
|
-
LN&&a.g.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});c.observe(b,{subtree:!1,childList:!0});a.l.push(function(){return c.disconnect()})},KO=function(a){_.
|
|
14
|
-
this.a.init(null)):this.g.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.G=new _.uk(function(){JO(b)});this.A=new Map;this.l=null},IO=function(a){a=_.N.
|
|
15
|
-
a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.
|
|
16
|
-
break;case _.gg:h=ON;break;case _.Yh:h=NN}h&&!g.classList.contains(h)&&_.
|
|
13
|
+
LN&&a.g.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});c.observe(b,{subtree:!1,childList:!0});a.l.push(function(){return c.disconnect()})},KO=function(a){_.ht.call(this,a);var b=this;this.g=new _.K(PN);this.m=a;this.M=IO(a);this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new EO(a);this.a=new zO(null,"clpp-text-container",{});this.w=new _.ys(a.getSurface(),this.Vi.bind(this));this.J=null;this.C?(this.C.appendChild(this.a.a),
|
|
14
|
+
this.a.init(null)):this.g.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.G=new _.uk(function(){JO(b)});this.A=new Map;this.l=null},IO=function(a){a=_.N.Oa(a.getConfiguration().htmlcue||{});_.N.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.N.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},LO=function(a,b){return a.startTime<=b&&a.endTime>b},JO=function(a,b){if((b||a.j)&&a.C){var c=
|
|
15
|
+
a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Vo){a.J=c;var d=MO(a,c);(c=b)||(c=a.l,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.l=d,NO(a),d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.mt(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.u(d);for(var e=d.next();!e.done;e=d.next()){var f=a;e=e.value;var g=f.a.a,h=null;switch(e.payloadType){case _.zg:h="clpp-text-vtt";
|
|
16
|
+
break;case _.gg:h=ON;break;case _.Yh:h=NN}h&&!g.classList.contains(h)&&_.rp(g,h);g=gO(f.a.a);if(0===g.width||0===g.height)f.g.warn("The height or width of the `.clpp-text-container` element is zero. Captions will not be displayed. Please check if the `clpp.styles.css` file has been included.");else{YN({fontSize:OO(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.zg;var l=e.payloadType===_.gg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new BO(e.region,
|
|
17
17
|
{}),f.A.set(e.region.id,g),AO(f.a,g)));e=new lO(e,f.M,c);g?AO(g,e):AO(f.a,e)}}}}}},MO=function(a,b){var c=TN(a.f,function(e){return LO(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&LO(a.f[d-1],b);)d--;for(;c+1<a.f.length&&LO(a.f[c+1],b);)c++;return{start:d,end:c}},PO=function(a){NO(a);a.J=null;a.l=null;a.f=[]},NO=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(ON);b.classList.remove(NN);a=a.a;yO(a.h);
|
|
18
18
|
a.l=[]}},OO=function(a,b){var c=gO(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Df}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Df;d=a.getFontSizePercent();return Math.round(c*d)+_.Df},QO=function(){},RO=function(){};
|
|
19
|
-
UN.prototype.parse=function(a){a={input:a};for(var b=_.
|
|
19
|
+
UN.prototype.parse=function(a){a={input:a};for(var b=_.tp(_.Yd),c=[],d=b,e;null!==(e=VN(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=SO[f];h?(h=_.tp(h),(f=TO[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||UO[g.localName]&&UO[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
|
|
20
20
|
d=g)}}else d.appendChild(document.createTextNode(XN(e)));return b};var SO={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},TO={v:"voice",lang:"lang"},UO={rt:"ruby"},WN={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};kO.prototype.init=function(){this.j=!0};kO.prototype.A=function(){return!1};_.w(lO,kO);lO.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
|
|
21
|
-
lO.prototype.init=function(a){kO.prototype.init.call(this,a);if(this.h)_.
|
|
22
|
-
c.next();!d.done;d=c.next())_.
|
|
21
|
+
lO.prototype.init=function(a){kO.prototype.init.call(this,a);if(this.h)_.rp(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.l.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.gg){var c=_.tp(_.Yd);c.innerHTML=b.payload;b=c}else b.payloadType===_.zg?b=(new UN).parse(b.payload):(c=_.tp(_.Yd),c.textContent=b.payload,b=c);_.rp(b,this.w);this.id&&(b.id=this.id);c=_.u(this.f.cssClassList);for(var d=
|
|
22
|
+
c.next();!d.done;d=c.next())_.rp(b,d.value);YN({writingMode:vO(this)},b);this.a.appendChild(b);_.rp(this.a,"clpp-text-wrapper");c=_.u(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.rp(this.a,"clpp-text-wrapper__"+d.value);_.N.R(this.f.line)&&(this.f.lineInterpretation=_.ai,this.f.line=mO(this)?-1:0);c=vO(this);YN({writingMode:c,webkitWritingMode:c,direction:QN,textAlign:tO(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=sO(this,uO(this));d=rO(this,c,null);var e=qO(this,
|
|
23
23
|
c,null),f=pO(this)&&_.N.R(null)?$N(0,_.Df):QN;YN({position:"absolute",left:d,right:f,top:e,width:mO(this)?$N(this.f.size,"%"):QN,height:oO(this)||pO(this)?$N(this.f.size,"%"):QN},this.a);d=this.f;a=mO(this)?a.height:a.width;e=nO(this);if(d.lineInterpretation===_.ai)f=e*Math.round(d.line),Math.abs(f)>a&&(f=e*(0>d.line?0:-1)),0>f&&(f+=a);else{f=e/a*100;var g=d.line;switch(d.lineAlign){case _.sd:g-=f/2;break;case _.le:g-=f}f=Math.round(g/100*a)}pO(this)&&(f=a-f-e);a=f;d=rO(this,c,a);e=pO(this)&&_.N.R(a)?
|
|
24
|
-
$N(0,_.Df):QN;YN({left:d,right:e,top:qO(this,c,a)},this.a)}ZN(this.
|
|
25
|
-
l.f)-Math.max(c.left,l.left))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.top,l.top))/(c.height*c.width);l>h&&(g=fO(c),h=l);c=fO(f)}c=g||f}YN({top:$N(c.top-this.a.top,_.Df),bottom:$N(this.a.a-c.a,_.Df),left:$N(c.left-this.a.left,_.Df),right:$N(this.a.f-c.f,_.Df),height:$N(c.height,_.Df),width:$N(c.width,_.Df)},a.a)}b.style.visibility="visible";this.h.push(gO(a.a))};_.w(zO,kO);zO.prototype.init=function(){this.h=new wO(this);this.j=!0};zO.prototype.o=function(){var a=_.
|
|
24
|
+
$N(0,_.Df):QN;YN({left:d,right:e,top:qO(this,c,a)},this.a)}ZN(this.C,b)}};lO.prototype.o=function(){return _.tp(_.Yd)};wO.prototype.append=function(a){var b=a.a;b.style.visibility=_.se;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=gO(a.a);var d=xO(this,a.f),e=nO(a),f=fO(c),g=null,h=0;d=_.u(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;jO(c,this.a,l)||iO(c,this.a)&&hO(c,this.h);){var m=c,n=e;switch(l){case "+x":m.left+=n;m.f+=n;break;case "-x":m.left-=n;m.f-=n;break;case "+y":m.top+=n;m.a+=n;break;case "-y":m.top-=n,m.a-=n}}if(this.j||iO(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.f,
|
|
25
|
+
l.f)-Math.max(c.left,l.left))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.top,l.top))/(c.height*c.width);l>h&&(g=fO(c),h=l);c=fO(f)}c=g||f}YN({top:$N(c.top-this.a.top,_.Df),bottom:$N(this.a.a-c.a,_.Df),left:$N(c.left-this.a.left,_.Df),right:$N(this.a.f-c.f,_.Df),height:$N(c.height,_.Df),width:$N(c.width,_.Df)},a.a)}b.style.visibility="visible";this.h.push(gO(a.a))};_.w(zO,kO);zO.prototype.init=function(){this.h=new wO(this);this.j=!0};zO.prototype.o=function(){var a=_.tp(_.Yd);_.rp(a,this.w);this.id&&(a.id=this.id);return a};_.w(BO,zO);
|
|
26
26
|
BO.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.ei:b=b.width/100*a.width;break a;default:throw Error(MN);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.ei)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(MN);d=a.height;var e=CO(this,d,a.height);YN(this.B,this.a);YN({left:$N(c,_.Df),top:$N(e,_.Df),width:$N(b,_.Df),height:$N(d,_.Df)},this.a);this.f.writingMode&&YN({display:"flex",
|
|
27
|
-
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&YN({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.
|
|
27
|
+
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&YN({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.rp(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.ei:b=b.height/100*a.height;break a;case 2:b=b.height;d=new lO(new _.di(0,1,"Lorem ipsum",_.Yh),{},{});c=d.a;this.a.appendChild(c);d.init(gO(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(MN);
|
|
28
28
|
}a=CO(this,b,a.height);YN({top:$N(a,_.Df),height:$N(b,_.Df)},this.a);this.h=new wO(this,!0);this.j=!0};BO.prototype.getId=function(){return this.f.id};EO.prototype.appendRule=function(a){if(null!=this.a&&!this.j.some(function(c){return c===a})){var b=GO(this,a);if(FO(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.g.debug("Added CSS rule "+b)}catch(c){this.g.error("An error occurred when adding a CSS rule: "+b)}this.j.push(a)}else this.g.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
|
|
29
|
-
EO.prototype.destroy=function(){var a=this;return _.E(function(b){if(null==a.a)return b["return"]();a.l.forEach(function(c){return c()});a.l=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.j=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.f.ownerNode);a.a=null;a.f=null;a.g.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.y(b)})};_.w(KO,_.
|
|
30
|
-
_.r.destroy=function(){var a=this;return _.E(function(b){if(1==b.a){if(null==a.h)return b["return"]();PO(a);a.G.stop();return _.x(b,a.h.destroy(),2)}a.h=null;a.
|
|
31
|
-
_.r.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.
|
|
29
|
+
EO.prototype.destroy=function(){var a=this;return _.E(function(b){if(null==a.a)return b["return"]();a.l.forEach(function(c){return c()});a.l=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.j=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.f.ownerNode);a.a=null;a.f=null;a.g.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.y(b)})};_.w(KO,_.ht);_.r=KO.prototype;_.r.append=function(a,b){if(null!=this.h&&0!==a.length){for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.h.appendRule(d.value);a.sort(function(e,f){return e.startTime!==f.startTime?e.startTime-f.startTime:e.endTime-f.endTime});this.f=SN(this.f,RN(a));this.l=null;JO(this,!1)}};_.r.ub=function(){null==this.h||JO(this,!0)};
|
|
30
|
+
_.r.destroy=function(){var a=this;return _.E(function(b){if(1==b.a){if(null==a.h)return b["return"]();PO(a);a.G.stop();return _.x(b,a.h.destroy(),2)}a.h=null;a.C.removeChild(a.a.a);a.a=null;a.w.stop();a.w=null;a.j=!1;_.y(b)})};_.r.remove=function(a,b){if(null==this.h)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.l=null;JO(this,!0);return!0};_.r.isTextVisible=function(){return this.j};
|
|
31
|
+
_.r.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.jb(.25),this.M.enableResizeObserver&&this.w.start(),JO(this,!0)):(this.G.stop(),this.w.stop(),PO(this)))};_.r.zd=function(){return this.f};_.r.Vi=function(){JO(this,!0)};_.H(PN,KO);KO.prototype.setTextVisibility=KO.prototype.setTextVisibility;KO.prototype.isTextVisible=KO.prototype.isTextVisible;KO.prototype.remove=KO.prototype.remove;KO.prototype.destroy=KO.prototype.destroy;KO.prototype.append=KO.prototype.append;QO.prototype.ba=function(a){return!!a.enableHtmlCue&&!_.Dk()};QO.prototype.create=function(a){return new KO(a)};_.w(RO,_.Ir);RO.prototype.f=function(){_.uo(_.te,new QO)};RO.prototype.a=function(){_.so.has(_.te)&&(_.so["delete"](_.te),_.to.info("Removed factory: 'html'"))};RO.prototype.id=function(){return _.$f};_.H("clpp.htmlcue.HtmlCueComponent",RO);};
|
|
32
32
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
33
33
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
34
34
|
else{_=this.clpp._;(f.call(g,this));}
|