@castlabs/prestoplay 6.4.1 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +6 -6
- package/cjs/cl.cast.js +110 -110
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +419 -416
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +26 -26
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +47 -47
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +31 -31
- package/cjs/cl.ima.js +22 -22
- package/cjs/cl.mse.js +258 -255
- 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 -24
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +27 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -18
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +20 -20
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +88 -88
- package/cl.conviva.js +27 -27
- package/cl.core.js +354 -351
- package/cl.crypto.js +8 -8
- package/cl.dash.js +66 -66
- package/cl.externs.js +26 -26
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +40 -39
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +25 -25
- package/cl.ima.js +16 -16
- package/cl.mse.js +230 -231
- package/cl.muxdata.js +8 -8
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +9 -9
- 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 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -16
- package/package.json +6 -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
|
-
_.
|
|
8
|
-
_.t.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.t.getSkipTimeOffset=function(){return 0};_.t.
|
|
9
|
-
_.t.vb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.t.ub=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.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,h,l;return _.
|
|
16
|
-
_.u(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,
|
|
17
|
-
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.
|
|
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 _.
|
|
19
|
-
_.t.
|
|
20
|
-
void 0));this.j.resolve()};_.t.
|
|
21
|
-
_.t.
|
|
22
|
-
_.Ib,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:
|
|
23
|
-
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.t.
|
|
24
|
-
_.t.
|
|
25
|
-
|
|
2
|
+
var f=function(window){var fK="clpp-freewheel",gK="clpp.freewheel.AdsManagerFactory",hK="freewheel",iK=function(){this.f=this.a=null},jK=function(){},kK=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""}},lK=function(a,b,c){this.g=a;this.f=b;this.a=c},mK=function(a){this.a=a},nK=function(a){this.B=new _.H("clpp.freewheel.AdsManager");this.l=a;this.g=new _.dg;this.o=new tv.freewheel.SDK.AdManager;
|
|
3
|
+
this.f=this.a=null;this.A=[];this.m=[];this.w=[];this.j=new _.Nh;this.h=null},oK=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.ue&&b.push("serverUrl");typeof a.profileId!==_.ue&&b.push("profileId");typeof a.videoAssetId!==_.ue&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.L(1,9,12001,{missingKeys:b.join(", ")});},pK=function(){var a,b,c,d;return _.B(function(e){if(1==e.a)return a=new _.tp,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)})},sK=function(a){return _.B(function(b){if(a.A.length)return qK(a),a.f=a.A.shift(),a.f.play(),b.H(0);rK(a);return _.x(b,a.l.a.play(),0)})},tK=function(a){a.w.length?(qK(a),a.f=a.w.shift(),a.f.play()):rK(a)},qK=function(a){var b=a.l.bc(hK).Fc();b&&(a.l.getSurface().show(b),a.l.getSurface().hideMediaElement(),
|
|
5
|
+
a.a.registerVideoDisplayBase(fK),a.l.isMuted()?a.setVolume(0):a.setVolume(a.l.getVolume()||1))},rK=function(a){var b=a.l.bc(hK).Fc();b&&a.l.getSurface().hide(b);a.l.getSurface().showMediaElement()},uK=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 lK(a.a,c,d)});a.l.trigger(new _.J(b,d))},vK=function(){this.a=new _.H(gK)};_.v(iK,_.eq);_.t=iK.prototype;
|
|
6
|
+
_.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.zn(_.Wc,{id:fK}),this.f=_.zn(_.Qe,{"class":_.Ec}),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 hK};_.t.Fc=function(){return this.a};_.t.fi=function(){return this.f};
|
|
7
|
+
_.C("clpp.freewheel.FreeWheelPlugin",iK);iK.prototype.getAdVideo=iK.prototype.fi;iK.prototype.getAdContainer=iK.prototype.Fc;iK.Id=hK;iK.AD_CONTAINER_ID=fK;jK.prototype.create=function(){return new iK};_.wo(new jK);_.t=lK.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===_.ue?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.fc=function(){return!1};_.t.Kb=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.hb=function(){return 0};_.t.Va=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.Va()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.t.Lb=function(){switch(this.Va()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.t.Mb=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[]};lK.prototype.getWrapperCreativeIds=lK.prototype.getWrapperCreativeIds;lK.prototype.getWrapperAdSystems=lK.prototype.getWrapperAdSystems;lK.prototype.getWrapperAdIds=lK.prototype.getWrapperAdIds;lK.prototype.getSequenceLength=lK.prototype.xb;lK.prototype.getPositionInSequence=lK.prototype.Mb;lK.prototype.getPodTimeOffset=lK.prototype.Lb;lK.prototype.getPodIndex=lK.prototype.getPodIndex;lK.prototype.getPodType=lK.prototype.Va;
|
|
12
|
+
lK.prototype.getMediaBitrate=lK.prototype.hb;lK.prototype.getMediaHeight=lK.prototype.ub;lK.prototype.getMediaWidth=lK.prototype.vb;lK.prototype.getMediaUrl=lK.prototype.getMediaUrl;lK.prototype.getClickThroughUrl=lK.prototype.Kb;lK.prototype.isBumper=lK.prototype.fc;lK.prototype.getSkipTimeOffset=lK.prototype.getSkipTimeOffset;lK.prototype.getDuration=lK.prototype.getDuration;lK.prototype.getTitle=lK.prototype.getTitle;lK.prototype.getAdvertiserName=lK.prototype.getAdvertiserName;
|
|
13
|
+
lK.prototype.getAdSystem=lK.prototype.getAdSystem;lK.prototype.getApiFramework=lK.prototype.getApiFramework;lK.prototype.getCreativeId=lK.prototype.getCreativeId;lK.prototype.getId=lK.prototype.getId;lK.prototype.getTechnology=lK.prototype.yb;lK.prototype.getAdManagerVersion=lK.prototype.tb;lK.prototype.getAdManagerName=lK.prototype.sb;mK.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()}})};mK.prototype.Nb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};mK.prototype.ib=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
14
|
+
mK.prototype.hasPostroll=mK.prototype.ib;mK.prototype.hasPreroll=mK.prototype.Nb;mK.prototype.getCuePoints=mK.prototype.getCuePoints;_.t=nK.prototype;
|
|
15
|
+
_.t.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.B(function(m){if(1==m.a){b=a.l.getConfiguration().freewheel||{};try{oK(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!==_.ue&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.x(m,pK(),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,kK(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.Jd&&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.lj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.pj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.oj.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Hi.bind(a));a.g.on(a.l,_.Ee,a.nh.bind(a));a.g.on(a.l,_.re,a.mh.bind(a));a.a.submitRequest();return m["return"](a.j)})};_.t.start=function(){var a=this;return _.B(function(b){return _.x(b,sK(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 _.B(function(b){a.g.release();a.h&&(a.h.stop(),a.h=null);rK(a);a.a&&(a.a.dispose(),a.a=null);_.z(b)})};
|
|
19
|
+
_.t.lj=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 _.J(_.Wb,{adsTimeline:new mK(this.a)})),this.h=new _.rp(this.l.getSurface(),function(c,d){return b.a.resize(c,d)},this.l.bc(hK).f);else this.l.onError(new _.L(1,9,10003,{errorType:0},
|
|
20
|
+
void 0));this.j.resolve()};_.t.pj=function(a){uK(this,_.Fb,a);this.h.start()};_.t.oj=function(a){this.f=null;a=a.slot;uK(this,_.Gb);this.h.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:sK(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:rK(this);this.l.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:tK(this)}};
|
|
21
|
+
_.t.Hi=function(a){var b=a.subType;this.B.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:uK(this,_.Sb,a);uK(this,_.Lb,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:uK(this,_.Tb,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:uK(this,_.Kb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:uK(this,_.Nb,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:uK(this,_.Ub,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:uK(this,_.Jb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:uK(this,
|
|
22
|
+
_.Ib,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:uK(this,_.Ob,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:uK(this,_.Qb,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:uK(this,_.Rb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:uK(this,_.Hb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:uK(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.nh=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();qK(this);this.f.play()}}};
|
|
24
|
+
_.t.mh=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.cn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.bn:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Wm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);tK(this);break;case _.Pm:case _.$m:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};nK.prototype.getPosition=nK.prototype.getPosition;nK.prototype.setVolume=nK.prototype.setVolume;
|
|
25
|
+
nK.prototype.getVolume=nK.prototype.getVolume;nK.prototype.skip=nK.prototype.skip;nK.prototype.pause=nK.prototype.pause;nK.prototype.resume=nK.prototype.resume;nK.prototype.start=nK.prototype.start;vK.prototype.name=function(){return gK};vK.prototype.ca=function(a,b){return a.namespace()===_.Gc?!1:window.tv&&tv.freewheel&&tv.freewheel.SDK?!(!b||!b.freewheel):(this.a.warn("FreeWheel SDK is not loaded."),!1)};vK.prototype.create=function(a){return new nK(a)};vK.prototype.create=vK.prototype.create;vK.prototype.isSupported=vK.prototype.ca;vK.prototype.name=vK.prototype.name;_.wn(new vK);};
|
|
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,51 +1,51 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
|
|
4
|
-
0},
|
|
5
|
-
e)e=!1;else{m=
|
|
6
|
-
e.push(new
|
|
7
|
-
|
|
8
|
-
null!==l&&f.add("_HLS_part",l))}_.
|
|
9
|
-
c);d=c.a[0].a;e=_.
|
|
10
|
-
w.next())
|
|
11
|
-
O.next();!
|
|
12
|
-
"EXT-X-MEDIA");d=
|
|
13
|
-
n);return _.
|
|
14
|
-
f.next())if(h=g.value,l=
|
|
15
|
-
d.a)return b=b.filter(function(e){var f=_.
|
|
16
|
-
(
|
|
17
|
-
[],n={audio:g?m:[],video:h?m:[]},a.a.debug("Guessing stream type for",b.toString()),q=!1,r=
|
|
18
|
-
[
|
|
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.
|
|
20
|
-
d,
|
|
21
|
-
"NAME");m=b.getAttribute("DEFAULT");n=b.getAttribute("AUTOSELECT");p=_.
|
|
22
|
-
"jpg";e=
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
T=_.
|
|
26
|
-
_.
|
|
27
|
-
frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:h,closedCaptions:l,keyInfo:p},
|
|
28
|
-
a.
|
|
29
|
-
b.next();!m.done;l={
|
|
30
|
-
(g=g?Object.assign({},g):null)&&!g.iv&&(g.iv=_.
|
|
31
|
-
c=a=0;l=null;n?(a=e+Number(n.value.split(",")[0]),m=
|
|
32
|
-
c.a;m=
|
|
33
|
-
break}
|
|
34
|
-
|
|
35
|
-
d.uris[0]);return _.
|
|
36
|
-
if("audio/mpeg"==g)return O["return"](0);if(g!=_.jc){O.H(2);break}return _.
|
|
37
|
-
"")+'/mp4;codecs\x3d"'+h+'"'))return O["return"](0);throw new _.L(_.M,4,4030);}})},
|
|
38
|
-
4,4030);return e},
|
|
39
|
-
h=_.
|
|
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}}
|
|
41
|
-
throw new _.L(_.M,4,4025,{codecList:b});},
|
|
42
|
-
a.g.attemptParameters);c.type=1;return
|
|
43
|
-
_.
|
|
44
|
-
_.t.
|
|
45
|
-
_.t.
|
|
46
|
-
_.t.
|
|
47
|
-
var
|
|
48
|
-
"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":
|
|
2
|
+
var f=function(window){var MA="CLOSED-CAPTIONS",NA="EXT-X-BYTERANGE",OA="EXT-X-DISCONTINUITY",PA="EXT-X-DISCONTINUITY-SEQUENCE",QA="EXT-X-ENDLIST",RA="EXT-X-MEDIA-SEQUENCE",SA="EXT-X-PART-INF",TA="EXT-X-PLAYLIST-TYPE",UA="EXT-X-PRELOAD-HINT",VA="EXT-X-SERVER-CONTROL",WA="EXT-X-STREAM-INF",XA="EXT-X-TARGETDURATION",YA="EXTINF",ZA="GROUP-ID",$A="Guessing audio-only",aB="SAMPLE-AES-CTR",bB="SUBTITLES",cB="application/vnd.apple.mpegurl",dB=function(a,b){var c=a.getAttribute(b);if(!c)throw new _.L(_.M,4,4023,b);return c.value},
|
|
3
|
+
eB=function(a){if(1>a.a)throw _.zk();--a.a},fB=function(a,b,c,d){this.f=a;this.type=b;this.ta=c;this.a=d||null},gB=function(a,b,c){c=void 0===c?[]:c;this.ta=b;this.a=a;this.f=c},hB=function(a,b){return a.filter(function(c){return c.name==b})},iB=function(a,b){return a.filter(function(c){return dB(c,"TYPE")===b})},jB=function(a,b){var c=hB(a,b);return c.length?c[0]:null},kB=function(a){var b=void 0===b?0:b;return(a=jB(a,RA))?Number(a.value):b},lB=function(a,b){return _.Bv([a],[b])[0]},mB=function(){this.a=
|
|
4
|
+
0},rB=function(a,b,c){b=_.ph(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=nB(a,g),--a.a,oB.includes(g.name)){b=1;break}else g.name==WA&&(e=!0);f=[];e=!0;g=_.u(_.LA(d));for(var h=g.next();!h.done;h=g.next()){var l=h.value;h=l.Kd;var m=l.item;l=l.next;m=m.trim();if(!m.length||/^#(?!EXT)/m.test(m)||
|
|
5
|
+
e)e=!1;else{m=nB(a,m);if(pB.includes(m.name)){if(1!=b)throw new _.L(_.M,4,4017);d=d.splice(h,d.length-h);a=qB(a,c,d,f);return new fB(c,b,f,a)}f.push(m);m.name==WA&&(m.attributes.push(new _.Yg(_.vb,l)),e=!0)}}return new fB(c,b,f)},qB=function(a,b,c,d){var e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=nB(a,h),oB.includes(h.name)?d.push(h):sB.includes(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===UA&&"PART"===_.Xg(h,"TYPE")&&g.push(h):f.push(h)):/^#(?!EXT)/m.test(h)||(h=lB(b,h.trim()),
|
|
6
|
+
e.push(new gB(h,f,g)),f=[],g=[])});g.length&&e.push(new gB(null,f,g));return e},nB=function(a,b){return _.Dh(a.a++,b)},tB=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},vB=function(){var a=this;this.g=this.C=null;this.fa=1;this.$=0;this.o=new Map;this.da=new Set;this.f=new Map;this.h=null;this.A="";this.R=new mB;this.ba=0;this.V=new Map;this.w=new _.Ni(function(){a.Bb()});this.j=
|
|
7
|
+
uB;this.K=null;this.D=0;this.F=Infinity;this.B=new _.Rh;this.aa=[];this.N=new Map;this.J=!1;this.m=new Map;this.T=null;this.a=new _.H("clpp.hls.HlsParser");this.I=new Map;this.L=new Map},AB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w;return _.B(function(y){if(1==y.a){c=wB;d=b.Eg;e=new _.Fg(d);if(a.g.hlsLowLatency){f=e.a;if(b.Kg){var A=b.segmentIndex;if(A=A.a[A.a.length-1]){var E=A.a,F=E.length-1;A={Bi:A.position,vj:E&&0<E.length?F:null}}else A=null;g=A;h=g.Bi;l=g.vj;null!==h&&(f.add("_HLS_msn",h),
|
|
8
|
+
null!==l&&f.add("_HLS_part",l))}_.Qg(f);f.g&&_.Ig(e,f)}return _.x(y,xB(a,e.toString()),2)}if(3!=y.a){m=y.f;n=rB(a.R,m.data,m.uri);if(1!=n.type)throw new _.L(_.M,4,4017);p=b.stream;return _.x(y,yB(a,b.Sd,n,p.type,p.mimeType,p.codecs,p.keyInfo||null,b.Xh),3)}q=y.f;b.segmentIndex.replace(q);r=q[q.length-1];if(w=jB(n.ta,QA))zB(a,c.VOD),a.h.Tb(r.endTime);_.z(y)})},EB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w,y,A,E,F,D,I,O,T,Fa,fa;return _.B(function(ka){if(1==ka.a){c=rB(a.R,b,a.A);if(1===c.type){a.I.set(a.A,
|
|
9
|
+
c);d=c.a[0].a;e=_.on;f=new _.Fg(d);g=f.pa.split(".").pop();h=BB[e.AUDIO][g];l=BB[e.VIDEO][g];m="";l?m="avc1.42E01E":h&&(m="mp4a.40.2");var wa=a.R,Aa=a.A,la=a.g.hlsDefaultCodecs||m,qa=[],Ga=[];Ga.push(new _.Yg(_.na,"0"));Ga.push(new _.Yg(_.vb,Aa));la.length&&Ga.push(new _.Yg(_.pa,la));qa.push(new _.Wg(wa.a++,WA,Ga));c=new fB(Aa,0,qa)}return _.x(ka,CB(a,c.ta),2)}n=ka.f;if(!a.C)throw new _.L(_.M,7,7001);a.C.filterAllPeriods([n]);p=Infinity;q=0;r=Infinity;w=_.u(a.f.values());for(y=w.next();!y.done;y=
|
|
10
|
+
w.next())A=y.value,p=Math.min(p,A.Fe),q=Math.max(q,A.Fe),A.stream.type!=_.Be&&(r=Math.min(r,A.duration));a.j!=uB?(a.h=new _.Zv(0,a.$,!1),_.cw(a.h,1)):a.h=new _.Zv(null,0,!0);DB(a);if(a.j!=uB){a.ba=a.F;E=wB;a.j===E.LIVE&&(F=a.h.Re,D=Math.max(r,F),isNaN(a.g.availabilityWindowOverride)||(D=a.g.availabilityWindowOverride),a.h.ic=D);for(I=0;95443.7176888889<=q;)I+=95443.7176888889,q-=95443.7176888889;if(I)for(a.a.debug("Offsetting live streams by",I,"to compensate for rollover"),O=_.u(a.f.values()),y=
|
|
11
|
+
O.next();!y.done;y=O.next())T=y.value,95443.7176888889>T.Fe?(a.a.debug("Offset applied to",T.stream.type),T.segmentIndex.offset(I)):a.a.debug("Offset NOT applied to",T.stream.type)}else for(a.h.Tb(r),a.h.offset(-p),Fa=_.u(a.f.values()),y=Fa.next();!y.done;y=Fa.next())fa=y.value,fa.segmentIndex.offset(-p),_.pw(fa.segmentIndex,r);a.K={presentationTimeline:a.h,periods:[n],offlineSessionIds:[],minBufferTime:0};_.z(ka)})},CB=function(a,b){var c,d,e,f,g,h;return _.B(function(l){switch(l.a){case 1:c=hB(b,
|
|
12
|
+
"EXT-X-MEDIA");d=hB(b,WA);e=hB(b,"EXT-X-IMAGE-STREAM-INF");for(var m=_.u(d),n=m.next();!n.done;n=m.next()){var p=n.value,q=_.Xg(p,"AUDIO");n=_.Xg(p,"VIDEO");var r=_.Xg(p,bB);p=FB(a,p);if(r){var w=_.Sg(_.Be,p);a.m.set(r,w);r=p.indexOf(w);-1<r&&p.splice(r,1)}q&&(r=GB(_.ic,p),a.m.set(q,r));n&&(q=GB(_.Qe,p),a.m.set(n,q))}return _.x(l,HB(a,c),2);case 2:m=iB(c,MA);m=_.u(m);for(n=m.next();!n.done;n=m.next())p=n.value,n=IB(p),q=dB(p,ZA),p=dB(p,"INSTREAM-ID"),a.N.get(q)||a.N.set(q,new Map),a.N.get(q).set(p,
|
|
13
|
+
n);return _.x(l,JB(a,d),3);case 3:return f=l.f,_.x(l,KB(a,c),4);case 4:return g=l.f,_.x(l,LB(a,e),5);case 5:return h=l.f,l["return"]({startTime:0,variants:f,textStreams:g,thumbStreams:h})}})},KB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r;return _.B(function(w){if(1==w.a)return c=iB(b,bB),d=c.map(function(y){var A,E;return _.B(function(F){if(1==F.a)return _.yf(F,2),_.x(F,MB(a,y),4);if(2!=F.a)return A=F.f,F["return"](A.stream);E=_.Af(F);throw E;})}),_.x(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=dB(h,ZA),m=a.m.get(l))if(n=a.o.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(y){return y}))})},LB=function(a,b){var c,d;return _.B(function(e){if(1==e.a)return c=b.map(function(f){var g;return _.B(function(h){if(1==h.a)return _.x(h,NB(a,f),2);g=h.f;return h["return"](g.stream)})}),_.x(e,Promise.all(c),2);d=e.f;return e["return"](d.filter(function(f){return f}))})},HB=function(a,b){var c;return _.B(function(d){if(1==
|
|
15
|
+
d.a)return b=b.filter(function(e){var f=_.Xg(e,_.vb)||"";return _.Xg(e,"TYPE")!==bB&&""!==f}),b.length?_.x(d,MB(a,b[0]),2):d.H(2);c=b.slice(1).map(function(e){return MB(a,e)});return _.x(d,Promise.all(c),0)})},JB=function(a,b){var c,d,e,f,g,h,l,m,n,p;return _.B(function(q){if(1==q.a){c=function(r){var w,y,A,E,F,D,I;return _.B(function(O){return 1==O.a?(w=_.Xg(r,"FRAME-RATE"),y=Number(dB(r,_.na)),A=_.Xg(r,_.ib),E=_.u(A?A.split("x"):[null,null]),F=E.next().value,D=E.next().value,_.x(O,OB(a,r,A,w),2)):
|
|
16
|
+
(I=O.f)?O["return"](PB(a,I.audio,I.video,y,F,D,w)):O["return"]([])})};d=0;e=Infinity;for(f=0;f<b.length;++f)g=Number(dB(b[f],_.na)),g<e&&(e=g,d=f);h=b.splice(d,1).pop();return _.x(q,c(h),2)}if(3!=q.a)return l=q.f,m=b.map(c),_.x(q,Promise.all(m),3);n=q.f;n.splice(d,0,l);p=n.reduce(_.zv,[]);return q["return"](p.filter(_.Eg))})},OB=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,r,w,y,A,E;return _.B(function(F){if(1==F.a)return e=_.on,f=FB(a,b),g=_.Xg(b,"AUDIO"),h=_.Xg(b,"VIDEO"),m=(l=g||h)&&a.o.has(l)?a.o.get(l):
|
|
17
|
+
[],n={audio:g?m:[],video:h?m:[]},a.a.debug("Guessing stream type for",b.toString()),q=!1,r=dB(b,_.vb),w=n.audio.find(function(D){return D.Sd===r}),y=_.Sg(e.VIDEO,f),A=c||d||y,1!==f.length||A?!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($A),p=e.AUDIO,q=!0):n.video.length?(a.a.debug($A),p=e.AUDIO):(a.a.debug("Guessing video-only"),p=e.VIDEO):(p=e.AUDIO,a.a.debug($A)),q?F.H(2):_.x(F,QB(a,b,f,p),3);2!=F.a&&(E=F.f);if(E)n[E.stream.type]=
|
|
18
|
+
[E];else if(null===E)return a.a.debug("streamInfo is null"),F["return"](null);RB(n);return F["return"](n)})},RB=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(",")}},PB=function(a,b,c,d,e,f,g){c.forEach(function(A){if(A=A.stream)A.width=Number(e)||void 0,A.height=Number(f)||void 0,A.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.Sd:"")+" - "+(l?l.Sd:"");var y=void 0;if(n&&q)if(r.length&&w.length?0<_.Lv(r,w).length:1)y=_.Lv(r,w);else{a.a.warn("Incompatible DRM info in HLS variant. Skipping.");continue}else n?y=r:q&&(y=w);a.da.has(p)?a.a.debug("Skipping variant which only differs in text streams."):(n=SB(a,n,q,
|
|
20
|
+
d,y),h.push(n),a.da.add(p))}}return h},SB=function(a,b,c,d,e){return{id:a.fa++,language:b?b.language:_.He,primary:!!b&&b.primary||!!c&&c.primary,audio:b,video:c,bandwidth:d,drmInfos:e,allowedByApplication:!0,allowedByKeySystem:!0}},MB=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,r,w;return _.B(function(y){if(1==y.a){c=dB(b,ZA);d="";e=dB(b,"TYPE").toLowerCase();f=_.on;e==_.mv&&(e=f.TEXT);e!==f.TEXT&&c&&a.m.has(c)&&(d=a.m.get(c));g=dB(b,_.vb);if(a.f.has(g))return y["return"](a.f.get(g));h=IB(b);l=_.Xg(b,
|
|
21
|
+
"NAME");m=b.getAttribute("DEFAULT");n=b.getAttribute("AUTOSELECT");p=_.Xg(b,"CHANNELS");q=e==_.ic?p?parseInt(p.split("/")[0],10):null:null;r=!!m&&!!n;return _.x(y,TB(a,g,d,e,h,r,l,q,null),2)}w=y.f;if(null==w)return y["return"](null);a.o.has(c)?a.o.get(c).push(w):a.o.set(c,[w]);if(a.f.has(g))return y["return"](a.f.get(g));a.f.set(g,w);return y["return"](w)})},NB=function(a,b){var c,d,e,f,g,h;return _.B(function(l){if(1==l.a){c=dB(b,_.vb);if(a.f.has(c))return l["return"](a.f.get(c));d=_.Xg(b,_.pa)||
|
|
22
|
+
"jpg";e=IB(b);f=_.Xg(b,"NAME");return _.x(l,TB(a,c,d,_.ld,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=_.Xg(b,_.na))g.stream.bandwidth=Number(h);a.f.set(c,g);return l["return"](g)})},FB=function(a,b){var c=_.Xg(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=_.Jv(f)[0];d.has(g)?a.a.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},
|
|
23
|
+
IB=function(a){a=_.Xg(a,"LANGUAGE")||_.He;return _.Gi(a)},QB=function(a,b,c,d){var e,f,g,h,l,m;return _.B(function(n){if(1==n.a){e=_.on;f=dB(b,_.vb);if(a.f.has(f))return n["return"](a.f.get(f));g=_.Xg(b,MA);h=null;d==e.VIDEO&&g&&"NONE"!=g&&(h=a.N.get(g));l=GB(d,c);return _.x(n,TB(a,f,l,d,_.He,!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)})},TB=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,r,w,y,A,E,F,D,I,O,T,
|
|
24
|
+
Fa,fa,ka,wa,Aa,la,qa,Ga,Ma,ab,Eb,me,eh,Li,fh,$c;return _.B(function(rb){switch(rb.a){case 1:m=lB(a.A,b);p=null;if(a.j==uB&&a.I.has(m)){n=a.I.get(m);a.I["delete"](m);rb.H(2);break}return _.x(rb,xB(a,m),3);case 3:q=rb.f,m=q.uri,n=rB(a.R,q.data,m);case 2:if(1!=n.type)throw new _.L(_.M,4,4017);UB(a,n);return _.x(rb,VB(a,d,c,n),4);case 4:r=rb.f;w=[];n.a.forEach(function(Vf){Vf=hB(Vf.ta,"EXT-X-KEY");w.push.apply(w,Vf)});y=!1;A=[];E=null;F=_.u(w);for(D=F.next();!D.done;D=F.next())I=D.value,O=dB(I,"METHOD"),
|
|
25
|
+
T=_.Xg(I,"KEYFORMAT","identity"),"NONE"!=O&&("AES-128"==O?(Fa=_.Xg(I,"IV",""),fa=lB(a.A,dB(I,_.vb)),p={method:"AES-128",url:fa,iv:Fa?_.ek((Fa||"0x").slice(2)):null},a.J=!0):(y=!0,(wa=(ka=WB[T])?ka(I,r):null)?(wa.keyIds.length&&(E=wa.keyIds[0]),A.push(wa)):a.a.warn("Unsupported HLS KEYFORMAT",T)));if(y&&!A.length&&!a.J)throw new _.L(_.M,4,4026);Aa=new Map;return _.x(rb,yB(a,b,n,d,r,c,p,Aa),5);case 5:return la=rb.f,qa=la[0].startTime,Ga=la[la.length-1].endTime,Ma=Ga-qa,ab=new _.lw(la),Eb=a.g.hlsLowLatency?
|
|
26
|
+
_.hz:_.ev,me=XB(n,p),eh=void 0,d==_.Be&&(eh=_.xe),fh=(Li=jB(n.ta,VA))?"YES"===_.Xg(Li,"CAN-BLOCK-RELOAD"):!1,$c={id:a.fa++,originalId:g,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:ab.Bc.bind(ab),getSegmentReference:ab.get.bind(ab),adjustSegmentDurations:ab.Qc.bind(ab),getDuration:ab.getDuration.bind(ab),segmentIndex:ab,segmentLookupStrategy:Eb,initSegmentReference:me,mimeType:r,codecs:c,kind:eh,encrypted:y,keyId:E,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},rb["return"]({stream:$c,segmentIndex:ab,drmInfos:A,Sd:b,Eg:m,Fe:qa,tk:Ga,duration:Ma,Xh:Aa,Kg:fh})}})},UB=function(a,b){var c=jB(b.ta,TA),d=jB(b.ta,QA);d=c&&"VOD"==c.value||d;c=c&&"EVENT"==c.value&&!d;c=!d&&!c;if(d)zB(a,uB);else{c?zB(a,YB):zB(a,ZB);d=jB(b.ta,XA);if(!d)throw new _.L(_.M,4,4024,{missingTag:XA});d=Number(d.value);c=jB(b.ta,SA);a.g.hlsLowLatency&&c?(d=Number(dB(c,"PART-TARGET")),
|
|
28
|
+
a.F=Math.min(d,a.F),a.D=Math.max(d,a.D),d=jB(b.ta,VA),a.$=d?Number(dB(d,"PART-HOLD-BACK")):0):(a.D=Math.max(d,a.D),a.F=Math.min(d,a.F),a.$=3*a.D)}},XB=function(a,b){var c=hB(a.ta,"EXT-X-MAP");if(!c.length)return null;if(1<c.length)throw new _.L(_.M,4,4020);var d=c[0];c=dB(d,_.vb);var e=lB(a.f,c);c=0;var f=null;if(d=_.Xg(d,"BYTERANGE"))c=d.split("@"),d=Number(c[0]),c=Number(c[1]),f=c+d-1;return new _.Xv(function(){return[e]},c,f,b)},bC=function(a,b,c,d,e,f,g){var h=[],l={};b=_.u(_.LA(b.f));for(var m=
|
|
29
|
+
b.next();!m.done;l={Ud:l.Ud},m=b.next()){var n=m.value;m=n.Kd;n=n.item;var p=0==m?a:h[h.length-1],q=0==m?d:p.endTime,r=Number(_.Xg(n,"DURATION"));r=q+r;var w=_.Xg(n,"BYTERANGE");w=_.u(aC(p,w));p=w.next().value;w=w.next().value;var y=_.Xg(n,_.vb);y=lB(g,y);l.Ud=y?[y]:[];q=new _.Yv(c,q,r,function(A){return function(){return A.Ud}}(l),p,w,e,f,!1,null,null,null,null);if("YES"===_.Xg(n,"INDEPENDENT")||0===m)q.g=!0;h.push(q)}return h},xC=function(a,b,c,d,e,f,g,h,l){var m=c.ta,n=c.a,p=n?[n]:[];n=jB(m,YA);
|
|
30
|
+
(g=g?Object.assign({},g):null)&&!g.iv&&(g.iv=_.hk(new Uint8Array(12),new Uint8Array([d>>24&255,d>>16&255,d>>8&255,d&255])));var q=null,r=null,w=null;h===_.ld&&(r=jB(m,"EXT-X-TILES"),q="1x1",r&&(q=_.Xg(r,"LAYOUT")||"1x1",w=(w=_.Xg(r,"DURATION"))?Number(w):null),r=_.u(q.split("x").map(function(y){return parseInt(y,10)})),q=r.next().value,r=r.next().value);if(0===c.f.length&&!n)throw new _.L(_.M,4,4024,{missingTag:YA});h=null;if(0<c.f.length)if(a.g.hlsLowLatency)h=bC(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=jB(m,NA),b=_.u(aC(b,m?m.value:null)),c=b.next().value,l=b.next().value):a=h[h.length-1].endTime;return new _.Yv(d,e,a,function(){return p},c,l,f,g,!1,null,q,r,w,h)},aC=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]},DB=function(a){a.h&&(a.aa.forEach(function(b){_.bw(a.h,b,0)}),a.aa=[])},yB=function(a,b,c,d,e,f,g,h){var l,m,n,p,q,r,w,y,A,E,F,D,I,O,T,Fa,fa,ka,wa,Aa,la,qa,Ga;return _.B(function(Ma){switch(Ma.a){case 1:l=
|
|
32
|
+
c.a;m=XB(c,g);n=kB(c.ta);if(null!==a.T){Ma.H(2);break}p=a;return _.x(Ma,yC(a,b,m,l[0],n,g,e,f,d),3);case 3:p.T=Ma.f;case 2:q=a.T;r=l[0].a;a.a.debug("First segment",r.split("/").pop(),"starts at",q);y=(w=jB(c.ta,PA))?Number(w.value):0;h.has(y)||h.set(y,n);if(!w)for(;h.has(y+1)&&h.get(y+1)<n;)y++;A=a.L.get(y)||0;E=[];F=function(ab){return _.LA(ab)};D=_.u(F(l));I=D.next();case 4:if(I.done){Ma.H(6);break}T=O=I.value;Fa=T.Kd;fa=T.item;ka=E[E.length-1];wa=0==Fa?q:ka.endTime;Aa=n+Fa;la=jB(fa.ta,OA);if(!la){Ma.H(7);
|
|
33
|
+
break}y++;h.set(y,Aa);return _.x(Ma,zC(a,y,b,m,fa,Aa,g,e,f,wa,d),8);case 8:A=Ma.f;case 7:qa=xC(a,ka,fa,Aa,wa,A,g,d,c.f);Ga=jB(fa.ta,YA);qa&&(a.g.hlsLowLatency||Ga)&&E.push(qa);I=D.next();Ma.H(4);break;case 6:return a.aa.push(E),DB(a),Ma["return"](E)}})},zC=function(a,b,c,d,e,f,g,h,l,m,n){var p,q;return _.B(function(r){if(1==r.a)return p=0,a.L.has(b)?(p=a.L.get(b),r.H(2)):_.x(r,yC(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
|
+
BC=function(a,b){var c,d,e,f,g,h,l;return _.B(function(m){switch(m.a){case 1:return c=b.f(),d=_.Wv(b.Ha(),b.Qa,b.Qa+2048-1,a.g.attemptParameters),d.type=2,e=_.Wv(b.Ha(),b.Qa,b.Ea,a.g.attemptParameters),e.type=2,c&&(e.keyInfo=c),_.yf(m,2),f=a.J?e:d,_.x(m,AC(a,f),4);case 4:return g=m.f,m["return"](g);case 2:h=_.Af(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 _.x(m,AC(a,e),5);case 5:return l=m.f,m["return"](l)}})},yC=function(a,b,c,d,e,f,g,h,l,m){var n,p,q,r,w,y,A,E,F,D,I;return _.B(function(O){switch(O.a){case 1:n=xC(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 _.x(O,BC(a,n),3);case 3:return w=O.f,y=_.N(w.data),tB(y)?O["return"](CC(y)):O["return"](DC(a,w.data));case 2:if(g!=_.Se&&g!=_.nc){O.H(4);break}A=[BC(a,n)];c&&A.push(BC(a,c));return _.x(O,Promise.all(A),5);case 5:return E=O.f,F=E[0],D=E[1]||E[0],O["return"](EC(a,F.data,D.data));case 4:if(g!=_.Re){O.H(6);break}return _.x(O,BC(a,n),7);case 7:return I=O.f,O["return"](DC(a,I.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);}})},EC=function(a,b,c){var d=0;(new _.Gk).M(_.Dd,_.Hk).M(_.Fe,_.Hk).M(_.yd,_.Hk).W("mdhd",function(g){g.G.skip(0==g.version?8:16);d=_.U(g.G);g.Xa.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 _.Gk).M("moof",_.Hk).M("traf",_.Hk).W("tfdt",function(g){e=(0==g.version?_.U(g.G):_.Ek(g.G))/d;f=!0;g.Xa.stop()}).parse(b,!0);if(!f)throw new _.L(_.M,
|
|
38
|
+
4,4030);return e},DC=function(a,b){function c(){e.seek(f+188);g=_.Ak(e);71!=g&&(e.seek(f+192),g=_.Ak(e));71!=g&&(e.seek(f+204),g=_.Ak(e));71!=g&&d();eB(e)}function d(){throw new _.L(_.M,4,4030);}var e=new _.xk(new DataView(b),!1),f=0,g=0;f=FC(e);0>f&&(a.a.error("Unable to find sync byte in TS after scanning"),d());for(;;){f=e.getPosition();g=_.Ak(e);71!=g&&d();var h=_.Bk(e);if(8191===(h&8191))c();else if(h&16384)if(h=(_.Ak(e)&48)>>4,0!=h&&2!=h||d(),3==h&&(h=_.Ak(e),e.skip(h)),1!=_.U(e)>>8)c();else{e.skip(3);
|
|
39
|
+
h=_.Ak(e)>>6;0!=h&&1!=h||d();0==_.Ak(e)&&d();h=_.Ak(e);var l=_.Bk(e),m=_.Bk(e);return(1073741824*((h&14)>>1)+((l&65534)<<14|(m&65534)>>1))/9E4}else c()}},FC=function(a){for(;a.getPosition()<a.ya()-1;){var b=a.getPosition();if(71===_.Ak(a))return eB(a),b}return-1},CC=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);}tB(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}}tB(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},GB=function(a,b){if(1==b.length)return b[0];var c=_.Sg(a,b);if(null!=c)return c;
|
|
41
|
+
throw new _.L(_.M,4,4025,{codecList:b});},VB=function(a,b,c,d){var e,f,g,h,l,m,n,p,q;return _.B(function(r){if(1==r.a){e=_.on;f=d.a[0].a;g=new _.Fg(f);h=g.pa.split(".").pop();l=BB[b];if(m=l[h])return r["return"](m);if(b==e.TEXT)return c&&"vtt"!=c?r["return"](_.cc):r["return"](_.Ce);n=_.Ih([f],a.g.attemptParameters);n.method="HEAD";n.type=2;return _.x(r,AC(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])})},xB=function(a,b){var c=_.Ih([b],
|
|
42
|
+
a.g.attemptParameters);c.type=1;return AC(a,c)},GC=function(a){var b=dB(a,"METHOD"),c=["SAMPLE-AES",aB];if(!c.includes(b))return _.Sf("PlayReady in HLS is only supported with [",c.join(", "),"], not",b),null;a=dB(a,_.vb);b=_.Sp(a);a=null;b=_.N(b.data);try{a=_.rv(_.Gl(b))}catch(d){a=b}return _.Cv(_.Pc,[{initDataType:_.zc,initData:a}],"")},zB=function(a,b){a.j=b;if(a.h){var c=a.h,d=a.j==uB;c.j=d;c.m=d}a.j!=uB||a.w.stop()},AC=function(a,b){if(!a.B)throw new _.L(_.M,7,7001);var c=a.C.networkingEngine.fetch(b);
|
|
43
|
+
_.Sh(a.B,c);return c.P},HC=function(){},oB=[XA,RA,PA,TA,"EXT-X-MAP","EXT-X-I-FRAMES-ONLY",QA,VA,SA],pB=[YA,NA,OA,"EXT-X-PROGRAM-DATE-TIME","EXT-X-KEY","EXT-X-DATERANGE"],sB=["EXT-X-PART",UA];_.t=vB.prototype;_.t.configure=function(a){this.g=a};_.t.setCurrentVariant=function(a){var b=a.video?a.video.id:null;a=a.audio?a.audio.id:null;this.V.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.V.set(d,e)}};
|
|
44
|
+
_.t.start=function(a,b){var c=this,d,e;return _.B(function(f){if(1==f.a)return c.C=b,_.x(f,xB(c,a),2);if(3!=f.a)return d=f.f,c.A=d.uri,_.x(f,EB(c,d.data),3);e=c.ba;0<e&&c.w.Z(e);return f["return"](c.K)})};_.t.stop=function(){this.w&&(this.w.stop(),this.w=null);var a=[];this.B&&(a.push(this.B.destroy()),this.B=null);this.g=this.C=null;this.da.clear();this.f.clear();this.I.clear();this.K=null;this.o.clear();this.m.clear();return Promise.all(a)};
|
|
45
|
+
_.t.update=function(){var a=this,b,c,d,e,f;return _.B(function(g){if(1==g.a){if(a.j==uB)return g["return"]();b=[];a.T=null;c=Array.from(a.f.values());d=Array.from(a.V.values());e=a.g.hlsLowLatency&&0<d.length?d:c;return _.x(g,AB(a,e[0]),2)}for(f=1;f<e.length;f++)b.push(AB(a,e[f]));return _.x(g,Promise.all(b),0)})};_.t.onExpirationUpdated=function(){};
|
|
46
|
+
_.t.Bb=function(){var a=this,b,c,d;return _.B(function(e){if(1==e.a){a.a.debug(_.Yu);if(!a.C)return e["return"]();_.yf(e,2);return _.x(e,a.update(),4)}if(2!=e.a)return b=a.ba,a.w.Z(b),_.zf(e,0);c=_.Af(e);a.C&&(a.C.onError(c),d=c,1===d.severity&&a.w.Z(.1));_.z(e)})};
|
|
47
|
+
var BB={audio:{mp4:_.nc,m4s:_.nc,m4i:_.nc,m4a:_.nc,cmfa:_.nc,ts:_.Re,aac:_.jc,ec3:_.lc,ac3:_.kc},video:{mp4:_.Se,m4s:_.Se,m4i:_.Se,m4v:_.Se,cmfv:_.Se,ts:_.Re},text:{mp4:_.cc,m4s:_.cc,m4i:_.cc,cmft:_.cc,vtt:_.Ce,ttml:_.fc},image:{jpg:_.md,jpeg:_.md,png:"image/png",svg:"image/svg+xml",webp:"image/webp",avif:"image/avif"}},WB={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Re)throw new _.L(_.M,4,4041);return _.Cv(_.Oc,[{initDataType:_.ne,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":GC,
|
|
48
|
+
"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":GC,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=dB(a,"METHOD"),c=["SAMPLE-AES",aB];if(!c.includes(b))return _.Sf("Widevine in HLS is only supported with [",c.join(", "),"], not",b),null;b=dB(a,_.vb);b=_.Sp(b);b=_.N(b.data);b=_.Cv(_.Qc,[{initDataType:_.zc,initData:b}],"");if(a=_.Xg(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},uB="VOD",ZB="EVENT",YB="LIVE",wB={VOD:uB,$j:ZB,LIVE:YB};_.v(HC,_.Bo);HC.prototype.Ja=function(){_.yp.m3u8=vB;_.wp[_.uj]=vB;_.wp[cB]=vB};HC.prototype.Ca=function(){_.uw("m3u8");_.vw(_.uj);_.vw(cB)};HC.prototype.id=function(){return"hls"};_.C("clpp.hls.HlsComponent",HC);};
|
|
49
49
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
50
50
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
51
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
|
-
_.
|
|
2
|
+
var f=function(window){var VJ=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.K.S(a)){a:{var b=a.info;if(_.K.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=_.K.Y(a)?a:null}},XJ=function(a,b,c){this.l=a;this.m=b;this.j=c;this.a=new _.dg;this.h=(a=_.Tp[_.fc]||null)?new a(this.l.getConfiguration()):null;this.f=new _.H("clpp.hlssmpte.ImageCueHandler");this.g=null;WJ(this)},WJ=function(a){a.a.one(a.l,_.ud,function(){return YJ(a)})},
|
|
3
|
+
YJ=function(a){var b=a.l.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Vb,function(d){return ZJ(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Ad}).forEach(function(d){ZJ(a,{track:d})});!$J(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."),aK(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
|
+
$J=function(a){return a.some(function(b){return b.kind===_.Ad})},aK=function(a,b){var c=a.l.getTrackManager(),d=c.ma(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.sa(d)};a.a.on(b.textTracks,_.Vb,function(g){g.track.kind===_.Ad&&(a.a.off(b.textTracks,_.Vb,f),f())});c.sa(e)}else a.f.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},ZJ=function(a,b){var c=b.track;c.kind===_.Ad&&(a.f.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.kd,a.a.on(c,_.Tc,function(d){return bK(a,d)}))},bK=function(a,b){var c=cK(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 VJ(d);if(e.f===c&&null!==e.a){a.g=d;d=a.h.parseMedia(_.th(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)}}})},cK=function(a){return(a=
|
|
6
|
+
a.l.getTrackManager().na())&&a.language&&a.language.toLowerCase()},dK=function(){this.a=null;this.f=!1},eK=function(){};XJ.prototype.destroy=function(){this.a.release();this.g=null;return Promise.resolve()};_.v(dK,_.eq);dK.prototype.onPlayerCreated=function(){};dK.prototype.onContentWillLoad=function(a){if(this.f=_.Ui()){var b=a.getConfiguration();b=_.K.Na(b.hlssmpte||{});_.K.Of(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.K.ka(b.timestampOffset)||(b.timestampOffset=0);this.a=new XJ(a,b.patchMetadataTrack,b.timestampOffset)}};dK.prototype.onPlayerWillDestroy=function(){var a=this;return _.B(function(b){if(1==b.a)return a.a?_.x(b,a.a.destroy(),3):b.H(0);a.a=null;_.z(b)})};dK.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.C("clpp.hlssmpte.HlsSmptePlugin",dK);dK.Id="hlssmpte";eK.prototype.create=function(){return new dK};_.wo(new eK);};
|
|
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,35 +1,35 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
function(c){return
|
|
4
|
-
f},
|
|
5
|
-
d-e)},
|
|
6
|
-
this.j=b;this.f=a;this.g=!!this.f.backgroundImage;this.B=c},
|
|
7
|
-
|
|
8
|
-
case _.
|
|
9
|
-
case _.
|
|
10
|
-
100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(
|
|
11
|
-
e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.g.cssRules.length&&a.g.deleteRule(0);return c},
|
|
12
|
-
e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);
|
|
13
|
-
|
|
14
|
-
this.w=new Map;this.j=null},
|
|
15
|
-
void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_
|
|
16
|
-
else{
|
|
17
|
-
end:c}},
|
|
18
|
-
|
|
19
|
-
d=g)}}else d.appendChild(document.createTextNode(
|
|
20
|
-
|
|
21
|
-
c.next();!d.done;d=c.next())_.
|
|
22
|
-
c,null),f=
|
|
23
|
-
|
|
24
|
-
l.f))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.h,l.h))/(c.height*c.width);l>h&&(g=
|
|
25
|
-
|
|
26
|
-
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&
|
|
27
|
-
}a=
|
|
28
|
-
|
|
29
|
-
_.t.append=function(a,b){if(null!=this.g&&0!==a.length){for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.g.appendRule(d.value);a.sort(function(f,g){return f.startTime!==g.startTime?f.startTime-g.startTime:f.endTime-g.endTime});c=this.f.findIndex(function(f){return f.startTime>=a[0].startTime});0===c?this.f=[]:0<c&&this.f.splice(0,c);c={};d=_.u(a);for(var e=d.next();!e.done;c={
|
|
30
|
-
g.startTime!==h.startTime?!1:g.endTime!==h.endTime?!1:!0}}(c))||this.f.push(c.
|
|
31
|
-
_.t.remove=function(a,b){if(null==this.g)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.j=null;
|
|
32
|
-
|
|
2
|
+
var f=function(window){var NI="CLPP Subtitle Styles",OI="Unsupported unit",PI="clpp-text-plain",QI="clpp-text-ttml",RI="clpp.htmlcue.HtmlTextDisplayer",SI="initial",TI=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},UI=function(){},VI=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},XI=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],
|
|
3
|
+
function(c){return WI[c]});return a},ZI=function(a,b){YI(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){YI(a,c)})},YI=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},$I=function(a,b){return 0===a?"0":a+b},aJ=function(a,b){return 1>Math.abs(a-b)||a<b},bJ=function(a,b){return a<b&&1<Math.abs(a-b)},cJ=function(a,b){return a>b&&1<Math.abs(a-b)},dJ=function(a,b){return 1>Math.abs(a-b)||a>b},eJ=function(a,b,c,d,e,f){this.f=a;this.g=b;this.h=c;this.a=d;this.height=e;this.width=
|
|
4
|
+
f},fJ=function(a){return new eJ(a.f,a.g,a.h,a.a,a.height,a.width)},gJ=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"))||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 eJ(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
|
|
5
|
+
d-e)},hJ=function(a,b){return b.some(function(c){return bJ(a.f,c.g)&&cJ(a.g,c.f)&&bJ(a.h,c.a)&&cJ(a.a,c.h)})},iJ=function(a,b){return dJ(a.h,b.h)&&aJ(a.a,b.a)&&dJ(a.f,b.f)&&aJ(a.g,b.g)},jJ=function(a,b,c){switch(c){case "+x":return bJ(a.f,b.f);case "-x":return cJ(a.g,b.g);case "+y":return bJ(a.h,b.h);case "-y":return cJ(a.a,b.a);default:throw Error("Unknown axis");}},kJ=function(a,b,c){this.id=a;this.o=b;this.A=c;this.a=this.m();this.h=!1},lJ=function(a,b,c){kJ.call(this,a.id,"clpp-text-cue",{});
|
|
6
|
+
this.j=b;this.f=a;this.g=!!this.f.backgroundImage;this.B=c},nJ=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 mJ(a)?b:c},qJ=function(a,b,c){return mJ(a)&&_.K.ka(c)?$I(c,_.be):(oJ(a)||pJ(a))&&_.K.ka(b)?$I(b,"%"):SI},oJ=function(a){return a.f.writingMode===_.Oe},pJ=function(a){return a.f.writingMode===_.Pe},mJ=function(a){return a.f.writingMode===_.ug},rJ=function(a,b,c){return(oJ(a)||pJ(a))&&_.K.ka(c)?$I(c,_.be):
|
|
7
|
+
oJ(a)&&_.K.S(c)?$I(0,_.be):mJ(a)&&_.K.ka(b)?$I(b,"%"):SI},sJ=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.sd:return a.f.position;case "auto":case _.Ac:return a.f.position-a.f.size/2;case _.td:return a.f.position-a.f.size}return 0},tJ=function(a){switch(a.f.positionAlign){case _.sd:return _.pd;case "auto":case _.Ac:return _.tg;case _.td:return _.ie}return a.f.textAlign},uJ=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.pd:case _.pd:return _.sd;
|
|
8
|
+
case _.tg:return _.Ac;case _.ie:case _.ie:return _.td}return a.f.positionAlign},vJ=function(a){switch(a.f.writingMode){case _.ug:return"horizontal-tb";case _.Oe:return _.Oe;case _.Pe:return _.Pe;default:throw Error("Unknown writing mode");}},wJ=function(a,b){this.j=a;this.f=a.a;this.h=void 0===b?!1:b;this.a=gJ(a.a);this.g=[]},xJ=function(a,b){if(a.h)switch(b.writingMode){case _.ug:return["-y"];case _.Oe:return["+x"];case _.Pe:return["-x"]}var c=[];switch(b.writingMode){case _.ug:c=["+y","-y"];break;
|
|
9
|
+
case _.Oe:c=["+x","-x"];break;case _.Pe:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},yJ=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=gJ(a.j.a)},zJ=function(a,b,c){kJ.call(this,a,b,c);this.g=null;this.j=[]},AJ=function(a,b){yJ(a.g);a.j.unshift(b);for(var c=_.u(a.j),d=c.next();!d.done;d=c.next())a.g.append(d.value)},BJ=function(a,b){zJ.call(this,a.id,"clpp-text-cue-region",b);this.f=a},CJ=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.zg)return a.viewportAnchorY/
|
|
10
|
+
100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(OI);},EJ=function(a){this.f=new _.H("clpp.htmlcue.StyleManager");this.m=[];this.h=a.getSurface().getUniqueCssClass();this.j=[];this.a=DJ(this,this.h);this.g=DJ(this,this.h,!0);this.g.disabled=!0;this.f.debug("Stylesheet CLPP Subtitle Styles has been created.")},FJ=function(a,b){var c=!1;try{a.g.insertRule(b,0);var d=a.g.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===
|
|
11
|
+
e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.g.cssRules.length&&a.g.deleteRule(0);return c},GJ=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,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)},DJ=function(a,b,c){var d=document.createElement(_.we),e=d.dataset;e.name=NI;
|
|
12
|
+
e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);HJ(a,b);a.f.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},HJ=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===NI&&a.f.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.m.push(function(){return c.disconnect()})},
|
|
13
|
+
KJ=function(a){_.Vp.call(this,a);var b=this;this.N=new _.H(RI);this.l=a;this.L=IJ(a);this.h=!1;this.f=[];this.B=a.getSurface().getContainer();this.g=new EJ(a);this.a=new zJ(null,"clpp-text-container",{});this.o=new _.rp(a.getSurface(),this.oh.bind(this));this.J=null;this.B?(this.B.appendChild(this.a.a),this.a.init(null)):this.N.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.D=new _.Ni(function(){JJ(b)});
|
|
14
|
+
this.w=new Map;this.j=null},IJ=function(a){a=_.K.Na(a.getConfiguration().htmlcue||{});_.K.S(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.K.S(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},LJ=function(a,b){return a.startTime<=b&&a.endTime>b},JJ=function(a,b){if((b||a.h)&&a.B){var c=a.l.getPosition();if(b||a.J!==c&&a.l.getState()===_.cn){a.J=c;var d=MJ(a,c);(c=b)||(c=a.j,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.j=d,NJ(a),d)){c={color:a.getFontColor()||
|
|
15
|
+
void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.$p(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 _.Xe:h="clpp-text-vtt";break;case _.Ge:h=QI;break;case _.sg:h=PI}h&&!g.classList.contains(h)&&_.An(g,h);g=gJ(f.a.a);if(0===g.width||0===g.height)f.N.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.");
|
|
16
|
+
else{YI({fontSize:OJ(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Xe;var l=e.payloadType===_.Ge;e.region&&(h||l||e.backgroundImage)&&(f.w.has(e.region.id)?g=f.w.get(e.region.id):(g=new BJ(e.region,{}),f.w.set(e.region.id,g),AJ(f.a,g)));e=new lJ(e,f.L,c);g?AJ(g,e):AJ(f.a,e)}}}}}},MJ=function(a,b){var c=TI(a.f,function(e){return LJ(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&LJ(a.f[d-1],b);)d--;for(;c+1<a.f.length&&LJ(a.f[c+1],b);)c++;return{start:d,
|
|
17
|
+
end:c}},PJ=function(a){NJ(a);a.J=null;a.j=null;a.f=[]},NJ=function(a){a.w.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(QI);b.classList.remove(PI);a=a.a;yJ(a.g);a.j=[]}},OJ=function(a,b){var c=gJ(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.A){var d=a.getFontSizePercent();return Math.round(c*d)+_.be}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.be;d=a.getFontSizePercent();return Math.round(c*d)+_.be},QJ=function(){},RJ=function(){};
|
|
18
|
+
UI.prototype.parse=function(a){a={input:a};for(var b=_.Cn(_.Wc),c=[],d=b,e;null!==(e=VI(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=SJ[f];h?(h=_.Cn(h),(f=TJ[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||UJ[g.localName]&&UJ[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
|
|
19
|
+
d=g)}}else d.appendChild(document.createTextNode(XI(e)));return b};var SJ={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},TJ={v:"voice",lang:"lang"},UJ={rt:"ruby"},WI={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};kJ.prototype.init=function(){this.h=!0};kJ.prototype.w=function(){return!1};_.v(lJ,kJ);lJ.prototype.w=function(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)};
|
|
20
|
+
lJ.prototype.init=function(a){kJ.prototype.init.call(this,a);if(this.g)_.An(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.j.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.Ge){var c=_.Cn(_.Wc);c.innerHTML=b.payload;b=c}else b.payloadType===_.Xe?b=(new UI).parse(b.payload):(c=_.Cn(_.Wc),c.textContent=b.payload,b=c);_.An(b,this.o);this.id&&(b.id=this.id);c=_.u(this.f.cssClassList);for(var d=
|
|
21
|
+
c.next();!d.done;d=c.next())_.An(b,d.value);YI({writingMode:vJ(this)},b);this.a.appendChild(b);_.An(this.a,"clpp-text-wrapper");c=_.u(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.An(this.a,"clpp-text-wrapper__"+d.value);_.K.S(this.f.line)&&(this.f.lineInterpretation=_.vg,this.f.line=mJ(this)?-1:0);c=vJ(this);YI({writingMode:c,webkitWritingMode:c,direction:SI,textAlign:tJ(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=sJ(this,uJ(this));d=rJ(this,c,null);var e=qJ(this,
|
|
22
|
+
c,null),f=pJ(this)&&_.K.S(null)?$I(0,_.be):SI;YI({position:"absolute",left:d,right:f,top:e,width:mJ(this)?$I(this.f.size,"%"):SI,height:oJ(this)||pJ(this)?$I(this.f.size,"%"):SI},this.a);d=this.f;a=mJ(this)?a.height:a.width;e=nJ(this);if(d.lineInterpretation===_.vg)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 _.Ac:g-=f/2;break;case _.ed:g-=f}f=Math.round(g/100*a)}pJ(this)&&(f=a-f-e);a=f;d=rJ(this,c,a);e=pJ(this)&&_.K.S(a)?
|
|
23
|
+
$I(0,_.be):SI;YI({left:d,right:e,top:qJ(this,c,a)},this.a)}ZI(this.B,b)}};lJ.prototype.m=function(){return _.Cn(_.Wc)};wJ.prototype.append=function(a){var b=a.a;b.style.visibility=_.kd;this.f.appendChild(b);a.h||a.init(this.a);if(a.w()){a:{var c=gJ(a.a);var d=xJ(this,a.f),e=nJ(a),f=fJ(c),g=null,h=0;d=_.u(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;jJ(c,this.a,l)||iJ(c,this.a)&&hJ(c,this.g);){var m=c,n=e;switch(l){case "+x":m.f+=n;m.g+=n;break;case "-x":m.f-=n;m.g-=n;break;case "+y":m.h+=n;m.a+=n;break;case "-y":m.h-=n,m.a-=n}}if(this.h||iJ(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.g,l.g)-Math.max(c.f,
|
|
24
|
+
l.f))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.h,l.h))/(c.height*c.width);l>h&&(g=fJ(c),h=l);c=fJ(f)}c=g||f}YI({top:$I(c.h-this.a.h,_.be),bottom:$I(this.a.a-c.a,_.be),left:$I(c.f-this.a.f,_.be),right:$I(this.a.g-c.g,_.be),height:$I(c.height,_.be),width:$I(c.width,_.be)},a.a)}b.style.visibility="visible";this.g.push(gJ(a.a))};_.v(zJ,kJ);zJ.prototype.init=function(){this.g=new wJ(this);this.h=!0};zJ.prototype.m=function(){var a=_.Cn(_.Wc);_.An(a,this.o);this.id&&(a.id=this.id);return a};_.v(BJ,zJ);
|
|
25
|
+
BJ.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.zg:b=b.width/100*a.width;break a;default:throw Error(OI);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.zg)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(OI);d=a.height;var e=CJ(this,d,a.height);YI(this.A,this.a);YI({left:$I(c,_.be),top:$I(e,_.be),width:$I(b,_.be),height:$I(d,_.be)},this.a);this.f.writingMode&&YI({display:"flex",
|
|
26
|
+
"flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&YI({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.An(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.zg:b=b.height/100*a.height;break a;case 2:b=b.height;d=new lJ(new _.yg(0,1,"Lorem ipsum",_.sg),{},{});c=d.a;this.a.appendChild(c);d.init(gJ(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(OI);
|
|
27
|
+
}a=CJ(this,b,a.height);YI({top:$I(a,_.be),height:$I(b,_.be)},this.a);this.g=new wJ(this,!0);this.h=!0};BJ.prototype.getId=function(){return this.f.id};EJ.prototype.appendRule=function(a){if(null!=this.a&&!this.j.some(function(c){return c===a})){var b=GJ(this,a);if(FJ(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.f.debug("Added CSS rule "+b)}catch(c){this.f.error("An error occurred when adding a CSS rule: "+b)}this.j.push(a)}else this.f.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
|
|
28
|
+
EJ.prototype.destroy=function(){var a=this;return _.B(function(b){if(null==a.a)return b["return"]();a.m.forEach(function(c){return c()});a.m=[];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.g.ownerNode);a.a=null;a.g=null;a.f.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.z(b)})};_.v(KJ,_.Vp);_.t=KJ.prototype;
|
|
29
|
+
_.t.append=function(a,b){if(null!=this.g&&0!==a.length){for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.g.appendRule(d.value);a.sort(function(f,g){return f.startTime!==g.startTime?f.startTime-g.startTime:f.endTime-g.endTime});c=this.f.findIndex(function(f){return f.startTime>=a[0].startTime});0===c?this.f=[]:0<c&&this.f.splice(0,c);c={};d=_.u(a);for(var e=d.next();!e.done;c={od:c.od},e=d.next())c.od=e.value,this.f.some(function(f){return function(g){var h=f.od;return g.payload!==h.payload?!1:
|
|
30
|
+
g.startTime!==h.startTime?!1:g.endTime!==h.endTime?!1:!0}}(c))||this.f.push(c.od);this.j=null;JJ(this,!1)}};_.t.pb=function(){null==this.g||JJ(this,!0)};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a){if(null==a.g)return b["return"]();PJ(a);a.D.stop();return _.x(b,a.g.destroy(),2)}a.g=null;a.B.removeChild(a.a.a);a.a=null;a.o.stop();a.o=null;a.h=!1;_.z(b)})};
|
|
31
|
+
_.t.remove=function(a,b){if(null==this.g)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.j=null;JJ(this,!0);return!0};_.t.isTextVisible=function(){return this.h};_.t.setTextVisibility=function(a){null!=this.g&&this.h!==a&&((this.h=a)?(this.D.bb(.25),this.L.enableResizeObserver&&this.o.start(),JJ(this,!0)):(this.D.stop(),this.o.stop(),PJ(this)))};_.t.oh=function(){JJ(this,!0)};_.C(RI,KJ);KJ.prototype.setTextVisibility=KJ.prototype.setTextVisibility;
|
|
32
|
+
KJ.prototype.isTextVisible=KJ.prototype.isTextVisible;KJ.prototype.remove=KJ.prototype.remove;KJ.prototype.destroy=KJ.prototype.destroy;KJ.prototype.append=KJ.prototype.append;QJ.prototype.ca=function(a){return!!a.enableHtmlCue&&!_.Wi()};QJ.prototype.create=function(a){return new KJ(a)};_.v(RJ,_.Bo);RJ.prototype.Ja=function(){_.xm("html",new QJ)};RJ.prototype.Ca=function(){};RJ.prototype.id=function(){return _.ye};_.C("clpp.htmlcue.HtmlCueComponent",RJ);};
|
|
33
33
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
34
34
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
35
35
|
else{_=this.clpp._;(f.call(g,this));}
|