@castlabs/prestoplay 6.32.0 → 6.33.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +19 -19
- package/cjs/cl.cast.js +129 -127
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +620 -625
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +101 -101
- package/cjs/cl.externs.js +45 -41
- package/cjs/cl.freewheel.js +25 -25
- package/cjs/cl.hls.js +76 -76
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +26 -26
- package/cjs/cl.mediatailor.js +3 -3
- package/cjs/cl.mse.js +359 -352
- package/cjs/cl.muxdata.js +14 -14
- package/cjs/cl.onboard.js +4 -4
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +16 -16
- package/cjs/cl.smooth.js +71 -71
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +72 -72
- package/cjs/cl.ttml.js +29 -29
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +12 -12
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.yospace.js +4 -4
- package/cjs/cl.youbora.js +35 -35
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +14 -14
- package/cl.cast.js +101 -102
- package/cl.conviva.js +27 -27
- package/cl.core.js +497 -503
- package/cl.crypto.js +9 -9
- package/cl.dash.js +89 -89
- package/cl.externs.js +50 -42
- package/cl.freewheel.js +20 -20
- package/cl.hls.js +82 -82
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +20 -20
- package/cl.mediatailor.js +2 -2
- package/cl.mse.js +305 -303
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +5 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- package/cl.simid.js +14 -14
- package/cl.smooth.js +61 -61
- 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 +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +30 -30
- package/package.json +1 -1
- package/typings.d.ts +32 -24
package/cl.freewheel.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
if(b.length)throw new _.I(1,9,12001,{missingKeys:b.join(", ")});},
|
|
3
|
-
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.W.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_AD,a.S.bind(a));a.l.on(a.m,_.
|
|
4
|
-
c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new X(a.a,c,d)});a.m.trigger(new _.H(b,d))},
|
|
5
|
-
this.f=this.a=null)}id(){return
|
|
6
|
-
0}getPosition(){return 0}getSkipTimeOffset(){return 0}
|
|
7
|
-
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.Ca()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}
|
|
8
|
-
X.prototype.getVideoElement=X.prototype.
|
|
9
|
-
X.prototype.getMediaBitrate=X.prototype.Ba;X.prototype.getMediaHeight=X.prototype.
|
|
10
|
-
X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getSourceId=X.prototype.
|
|
11
|
-
|
|
12
|
-
typeof b.siteSectionId!==_.
|
|
13
|
-
!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level)
|
|
14
|
-
a;this.a&&(a?this.a.setAdVolume(0):this.a.setAdVolume(this.G))}isMuted(){return this.C}
|
|
15
|
-
this.I=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.L=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.H(_.
|
|
16
|
-
tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL||this.m.play()}S(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:this.setMuted(this.C);this.h(this.G);this.J=!0;this.F=!1;
|
|
17
|
-
_.
|
|
18
|
-
9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}R(){if(!this.f){var a=this.m.getPosition();if(this.f=this.I.find(b=>.5>Math.abs(a-b.getTimePosition()))||null){const b=this.I.findIndex(c=>c===this.f);this.I.splice(b,1);this.m.pause();
|
|
19
|
-
case 4:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 5:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.L.length?(
|
|
20
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var UT="clpp-freewheel",VT="clpp.freewheel.AdsManagerFactory",WT="freewheel",XT=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""}},YT=function(a){const b=[];typeof a.networkId!==_.r&&b.push("networkId");typeof a.serverUrl!==_.Of&&b.push("serverUrl");typeof a.profileId!==_.Of&&b.push("profileId");typeof a.videoAssetId!==_.Of&&typeof a.videoAssetId!==_.r&&b.push("videoAssetId");
|
|
2
|
+
if(b.length)throw new _.I(1,9,12001,{missingKeys:b.join(", ")});},ZT=function(){return _.v(function*(){var a=new _.uv;let b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE;const c=yield a.canPlay(!1);a=yield a.canPlay(!0);c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:a&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return b})},$T=function(a){a.l.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.U.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Z.bind(a));a.l.on(a.a,
|
|
3
|
+
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.W.bind(a));a.l.on(a.a,tv.freewheel.SDK.EVENT_AD,a.S.bind(a));a.l.on(a.m,_.ag,a.R.bind(a));a.l.on(a.m,_.Lf,a.P.bind(a))},aU=function(a){const b=a.m.Ed(WT).Yc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},bU=function(a){const b=a.m.Ed(WT).Yc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(UT),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},cU=function(a,b,c){var d=null;a.a&&c&&(c.adInstance||
|
|
4
|
+
c.slot)&&(c=(d=c.adInstance||null)?d.getSlot():c.slot,d={ad:new X(a.a,c,d)});a.m.trigger(new _.H(b,d))},dU=class extends _.Ev{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.yi(_.Ad,{id:UT}),this.f=_.yi(_.t,{"class":_.$c}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.I(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),
|
|
5
|
+
this.f=this.a=null)}id(){return WT}Yc(){return this.a}Th(){return this.f}};_.w("clpp.freewheel.FreeWheelPlugin",dU);dU.prototype.getAdVideo=dU.prototype.Th;dU.prototype.getAdContainer=dU.prototype.Yc;dU.Id=WT;dU.AD_CONTAINER_ID=UT;var eU=class{create(){return new dU}};var X=class{constructor(a,b,c){this.h=a;this.f=b;this.a=c}cb(){return"FreeWheel AdManager SDK"}eb(){return tv.freewheel.SDK.version}gb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Of?a:""}yb(){return""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
|
|
6
|
+
0}getPosition(){return 0}getSkipTimeOffset(){return 0}Ab(){return!1}Pa(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""}getMediaUrl(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""}Ta(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}Sa(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}Ba(){return 0}Ca(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;
|
|
7
|
+
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.Ca()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}ob(){switch(this.Ca()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}fb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}Ua(){return this.f.getAdCount()}getWrapperAdIds(){return[]}canSeek(){return!1}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}zb(){return null}};
|
|
8
|
+
X.prototype.getVideoElement=X.prototype.zb;X.prototype.getWrapperCreativeIds=X.prototype.getWrapperCreativeIds;X.prototype.getWrapperAdSystems=X.prototype.getWrapperAdSystems;X.prototype.canSeek=X.prototype.canSeek;X.prototype.getWrapperAdIds=X.prototype.getWrapperAdIds;X.prototype.getSequenceLength=X.prototype.Ua;X.prototype.getPositionInSequence=X.prototype.fb;X.prototype.getPodTimeOffset=X.prototype.ob;X.prototype.getPodIndex=X.prototype.getPodIndex;X.prototype.getPodType=X.prototype.Ca;
|
|
9
|
+
X.prototype.getMediaBitrate=X.prototype.Ba;X.prototype.getMediaHeight=X.prototype.Sa;X.prototype.getMediaWidth=X.prototype.Ta;X.prototype.getMediaUrl=X.prototype.getMediaUrl;X.prototype.getClickThroughUrl=X.prototype.Pa;X.prototype.isBumper=X.prototype.Ab;X.prototype.getSkipTimeOffset=X.prototype.getSkipTimeOffset;X.prototype.getPosition=X.prototype.getPosition;X.prototype.getDuration=X.prototype.getDuration;X.prototype.getTitle=X.prototype.getTitle;X.prototype.getAdvertiserName=X.prototype.getAdvertiserName;
|
|
10
|
+
X.prototype.getAdSystem=X.prototype.getAdSystem;X.prototype.getApiFramework=X.prototype.getApiFramework;X.prototype.getSourceId=X.prototype.yb;X.prototype.getCreativeId=X.prototype.getCreativeId;X.prototype.getId=X.prototype.getId;X.prototype.getTechnology=X.prototype.gb;X.prototype.getAdManagerVersion=X.prototype.eb;X.prototype.getAdManagerName=X.prototype.cb;var fU=class{constructor(a){this.a=a}getCuePoints(){return this.a.getTemporalSlots().map(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()}})}Qb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}Pb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
|
|
11
|
+
fU.prototype.hasPostroll=fU.prototype.Pb;fU.prototype.hasPreroll=fU.prototype.Qb;fU.prototype.getCuePoints=fU.prototype.getCuePoints;var gU=class{constructor(a){this.g=new _.T("clpp.freewheel.AdsManager");this.m=a;this.l=new _.Bt;this.K=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.M=[];this.I=[];this.L=[];this.H=new _.wl;this.B=null;this.C=!1;this.G=1;this.J=!1;this.F=!0}load(){const a=this;return _.v(function*(){const b=a.m.getConfiguration().freewheel||{};try{YT(b)}catch(d){return a.m.onError(d),a.H.resolve(),a.H}a.K.setNetwork(b.networkId);a.K.setServer(b.serverUrl);a.a=a.K.newContext();a.a.setProfile(b.profileId);
|
|
12
|
+
typeof b.siteSectionId!==_.Of&&typeof b.siteSectionId!==_.r||a.a.setSiteSection(b.siteSectionId);const c=yield ZT();a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(const d of b.pods)a.a.addTemporalSlot(d.id,XT(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Ce&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,
|
|
13
|
+
!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);$T(a);a.a.submitRequest();return a.H})}j(){if(this.M.length){bU(this);this.f=this.M.shift();this.f.play();var a=!1}else this.f?(this.f.resume(),a=!1):(aU(this),a=!0);return a}A(){}ib(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getAdVolume(){return!this.a||this.C?this.G:this.a.getAdVolume()}h(a){this.G=a;this.C||this.a&&this.a.setAdVolume(a)}setMuted(a){this.C=
|
|
14
|
+
a;this.a&&(a?this.a.setAdVolume(0):this.a.setAdVolume(this.G))}isMuted(){return this.C}pb(){return this.J}isPaused(){return this.F}getPosition(){return this.f?this.f.getPlayheadTime():-1}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.ib()}resume(){this.j()}w(){return!0}o(){const a=this;return _.v(function*(){a.l.release();a.B&&(a.B.stop(),a.B=null);aU(a);a.a&&(a.a.dispose(),a.a=null)})}U(a){if(a.success)this.M=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),
|
|
15
|
+
this.I=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.L=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.H(_.oc,{adsTimeline:new fU(this.a)})),this.B=new _.rv(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.Ed(WT).f);else this.m.onError(new _.I(1,9,10003,{errorType:0},void 0));this.H.resolve()}Z(a){cU(this,_.Sb,a);this.B.start()}W(a){this.f=null;a=a.slot;cU(this,_.Tb);this.B.stop();aU(this);a&&a.getTimePositionClass()===
|
|
16
|
+
tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL||this.m.play()}S(a){const b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:this.setMuted(this.C);this.h(this.G);this.J=!0;this.F=!1;cU(this,_.kc,a);cU(this,_.ac,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:cU(this,_.lc,a);this.F=this.J=!1;break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:cU(this,_.Xb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:cU(this,_.cc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:cU(this,
|
|
17
|
+
_.mc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:cU(this,_.Wb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:cU(this,_.Vb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:this.F=!0;cU(this,_.dc,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:this.F=!1;cU(this,_.hc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:cU(this,_.jc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:cU(this,_.Ub,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:cU(this,_.ec,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.I(1,
|
|
18
|
+
9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}}R(){if(!this.f){var a=this.m.getPosition();if(this.f=this.I.find(b=>.5>Math.abs(a-b.getTimePosition()))||null){const b=this.I.findIndex(c=>c===this.f);this.I.splice(b,1);this.m.pause();bU(this);this.f.play()}}}P(a){if((a=a.detail)&&this.a)switch(a.currentState){case 3:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;
|
|
19
|
+
case 4:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case 5:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);this.L.length?(bU(this),this.f=this.L.shift(),this.f.play()):aU(this);break;case _.qo:case _.ko:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};gU.prototype.resume=gU.prototype.resume;gU.prototype.pause=gU.prototype.pause;gU.prototype.getVolume=gU.prototype.getVolume;gU.prototype.setVolume=gU.prototype.setVolume;gU.prototype.getPosition=gU.prototype.getPosition;
|
|
20
|
+
gU.prototype.skip=gU.prototype.skip;_.Ah(new class{constructor(){this.Wa=new _.T(VT)}name(){return VT}a(a,b){return a.namespace()!==_.gd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Wa.warn("FreeWheel SDK is not loaded."),!1):!1}create(a){return new gU(a)}});_.En(new eU);};f.call(g, window);
|
package/cl.hls.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
{required:!0})},
|
|
3
|
-
for(let e=0;e<c.length;e++){var d=c[e];if(!(d in b))continue;const f=a[d];d=b[d];if(f instanceof Date&&d instanceof Date&&f.getTime()!==d.getTime())return!0;if(typeof f===_.
|
|
4
|
-
24&255,a>>16&255,a>>8&255,a&255])},
|
|
5
|
-
d=f||g||h;if(c.has(d))throw new _.I(_.D,4,4044,`EXT-X-DEFINE redefined variable "${d}".`);if(!b.test(d))throw new _.I(_.D,4,4044,`EXT-X-DEFINE invalid variable name "${d}".`);c.add(d)})},
|
|
6
|
-
"EXT-X-TILES");if(!b)return{
|
|
7
|
-
|
|
8
|
-
c?!1:c;var d=0;let e=null;if(a){d=a.split("@");a=Number(d[0]);if(0>=a)throw new _.I(_.D,4,4044,"Byte range length must be positive.");if(d[1]){if(d=Number(d[1]),0>d)throw new _.I(_.D,4,4044,"Byte range start byte must not be negative.");}else{if(c)throw new _.I(_.D,4,4044,"Invalid byte range, offset is required but missing.");if(null==b)throw new _.I(_.D,4,4044,"Invalid byte range, cannot calculate offset based on previous byte ranges.");d=b+1}e=d+a-1}return{na:d,ja:e}},
|
|
9
|
-
return
|
|
10
|
-
c.
|
|
11
|
-
const f=d[d.length-1].endTime;d=e;e=f-e}b=Math.min(b,d);c=Math.min(c,e)});return{
|
|
12
|
-
a=Number(a.value);e=e||a;return null!=d?{delay:d
|
|
13
|
-
e.schemeIdUri,h=_.L(a,"ID");f=_.L(a,"START-DATE")||f;if(null===h||!f)return _.
|
|
14
|
-
null;null!==f&&f.getTime()>=d.getTime()&&(h.endDate=f);f=a.attributes;if(null==f)var k=null;else{d={};for(k of f)k.name.trim().startsWith("X-")&&(d[k.name]=k.value);k=_.
|
|
15
|
-
case _.
|
|
16
|
-
m;h.type=_.
|
|
17
|
-
if(!f)throw new _.I(_.D,4,4044,`Query param '${g}' has no associated value`+" in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},
|
|
18
|
-
4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.
|
|
19
|
-
c):
|
|
20
|
-
[];let f=[],g=[];c.forEach(h=>{/^(#EXT)/.test(h)?(h=
|
|
21
|
-
l;k++)m+="%"+("00"+h[k].toString(16)).slice(-2);return m}function c(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]}function d(){throw new _.I(_.D,4,4030);}
|
|
22
|
-
22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}
|
|
23
|
-
g.version)h=_.
|
|
24
|
-
71!==f&&(d.seek(e+192),f=_.
|
|
25
|
-
a||c();0===_.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
e);return d}).filter(Boolean);if(0===a.length)throw new _.I(_.D,4,4026);return{keyId:a.map(d=>d.keyIds).reduce((d,e)=>d.concat(e),[]).reverse()[0]||null,type:
|
|
29
|
-
generatedIv:f}=c;return{method:"AES-128",url:_.
|
|
30
|
-
e.uris[0]);try{return yield a.f(f)}catch(h){throw a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],h),new _.I(_.D,4,4030,"Failed to fetch the media segment.");}}})},
|
|
31
|
-
_.
|
|
32
|
-
{c.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[d
|
|
36
|
-
|
|
37
|
-
!!
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if(f)var g=Number(f.value);else{d?(f=d.streams[d.streams.length-1].T,f=f[f.length-1].ma):f=0;if(e&&0<f)try{{const k=
|
|
41
|
-
"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}g=0}}c=c.T||[];for(const k of c)
|
|
42
|
-
h.streams[0]
|
|
43
|
-
"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");var d=b.ba.filter(e=>e.name===
|
|
44
|
-
schemeIdUri:d.schemeIdUri,customAttributes:d.customAttributes,value:"",startTime:d.startTime
|
|
45
|
-
label:
|
|
46
|
-
c,d,g,a.B);a.D.filterAllPeriods(d);c=[...e.
|
|
47
|
-
c,"to compensate for rollover");for(const d of a.j.values())b=d.streams[0],95443.7176888889>b.
|
|
48
|
-
!c(h)),f=h=>{var k=h.stream.streams[0];k={language:k.language,channelsCount:k.channelsCount,spatialAudio:k.spatialAudio,closedCaptions:k.closedCaptions,primary:k.primary,kind:k.kind||null,groupId:k.groupId,type:k.type,codecs:k.codecs,name:k.originalId,uri:k
|
|
49
|
-
h.
|
|
50
|
-
f.push(h)}return new
|
|
51
|
-
1].endTime,
|
|
52
|
-
label:n,type:e,primary:l,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:y?y.frameRate:void 0,width:y?y.width:void 0,height:y?y.height:void 0,bandwidth:void 0,roles:[],channelsCount:p,spatialAudio:u,closedCaptions:
|
|
53
|
-
_.L(f,
|
|
54
|
-
|
|
55
|
-
_.
|
|
56
|
-
_.
|
|
57
|
-
f&&d.get(
|
|
58
|
-
b);if(null!=a)return a;throw new _.I(_.D,4,4025,{codecList:b});},
|
|
59
|
-
g===_.q?(u=_.L(d,"CHANNELS"))?u.includes("/JOC"):!1:!1;return yield
|
|
60
|
-
closedCaptions:null,
|
|
61
|
-
(p?p.streams[0]
|
|
62
|
-
f?(a.g.debug(
|
|
63
|
-
u.streams[0]
|
|
64
|
-
|
|
65
|
-
(k.push(l),l=[]),l.push(m);k.push(l);f=k}for(m=0;m<f.length;m++)k=f[m],l=yield
|
|
66
|
-
4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},
|
|
67
|
-
const
|
|
68
|
-
null;d=new
|
|
69
|
-
uri:c});}k=yield
|
|
70
|
-
[];let A=!1;for(let F=0;F<c.length;F++){var E=c[F];const C=u[u.length-1]||null,ja=0===F?0:C.endTime,Ca=d+F,Xa=
|
|
71
|
-
d.a;var f=
|
|
72
|
-
u)=>p+u,0);m=k-m;const n=a.C.get(b);a.C.set(b,n+m);a.M=!1}if(a.C.has(b))return a.C.get(b);m=yield
|
|
73
|
-
f.join(", "));return g.toLowerCase().split(";")[0]})},
|
|
74
|
-
a;this.f=c;this.ma=-1}},
|
|
75
|
-
0;this.a=new Map}},
|
|
76
|
-
|
|
77
|
-
c.P=!0;c.D=b;var d=Date.now();const {response:e,text:f}=yield
|
|
78
|
-
b){var c=b.presentationTimeline,d=Array.from(a.j.values()),e=yield
|
|
79
|
-
k.id===b);if(e&&(e=e.variants.find(k=>k.id===d)))return e;e=c.f.alternativeVariants.find(k=>k.id===d);if(!e)throw new _.
|
|
80
|
-
e.forEach((k,l)=>{c.f.periods[l].variants.push(k.variants[0]);b===c.f.periods[l].id&&(h=k.variants[0])}));if(!h)throw new _.
|
|
81
|
-
f.verbatimUri,()=>_.
|
|
82
|
-
7,7001);a=this.D.networkingEngine.fetch(a);_.
|
|
1
|
+
import {clpp} from "./cl.core.js";import './cl.mse.js';let g={};const _ = clpp._;var f=function(window){'use strict';var BI="CLOSED-CAPTIONS",CI="Could not parse MP4 segment start time.",DI="DURATION",EI="EXT-X-DATERANGE",FI="EXT-X-DISCONTINUITY",GI="EXT-X-KEY",HI="EXT-X-MAP",II="EXT-X-MEDIA",JI="EXT-X-MEDIA-SEQUENCE",KI="EXT-X-PROGRAM-DATE-TIME",LI="EXT-X-STREAM-INF",MI="Failed to infer discontinuity number",NI="Guessing audio-only",OI="METHOD",PI="SAMPLE-AES-CTR",QI="SUBTITLES",RI="_HLS_part",SI="application/vnd.apple.mpegurl",TI="manifestloaded",UI="sample",VI=function(a,b){return _.L(a,b,void 0,
|
|
2
|
+
{required:!0})},WI=function(a){if(1>a.a)throw _.Lp();--a.a},XI=function(a,b){for(const c in a){if(!(c in b))return!1;const d=a[c],e=b[c];if(d&&typeof d===_.Ce&&e&&typeof e===_.Ce){if(!XI(d,e))return!1}else if(void 0!==d&&void 0!==e&&d!==e)return!1}return!0},YI=function(a,b){if(!XI(a,b))return!1;for(const c in b){if(!(c in a))return!0;const d=a[c],e=b[c];if(!d&&e||d&&typeof d===_.Ce&&e&&typeof e===_.Ce&&YI(d,e))return!0}return!1},ZI=function(a,b){if(a===b||_.z(a)||_.z(b))return!1;const c=Object.keys(a);
|
|
3
|
+
for(let e=0;e<c.length;e++){var d=c[e];if(!(d in b))continue;const f=a[d];d=b[d];if(f instanceof Date&&d instanceof Date&&f.getTime()!==d.getTime())return!0;if(typeof f===_.Ce&&typeof d===_.Ce){if(ZI(f,d))return!0}else{if(f instanceof Array&&d instanceof Array){if(f.length!==d.length)return!0;for(let g=0;g<f.length;g++)if(f[g]!==d[g])return!0}if(f!==d)return!0}}return!1},$I=function(a){if(null!==a&&void 0!==a)return Number(a)},aJ=function(a){return 0>a?[]:Array.from({length:a},(b,c)=>c)},bJ=function(a){return new Uint8Array([a>>
|
|
4
|
+
24&255,a>>16&255,a>>8&255,a&255])},cJ=function(a,b=0){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},dJ=function(a,b){return a.filter(c=>c.name===b)},eJ=function(a){const b=/^[a-zA-Z0-9_-]+$/,c=new Set;a.forEach(d=>{const e=_.L(d,"VALUE"),f=_.L(d,_.Sa),g=_.L(d,"IMPORT"),h=_.L(d,"QUERYPARAM");if(1!==[f,g,h].filter(Boolean).length||f&&null==e)throw new _.I(_.D,4,4044,{message:"Invalid tag.",text:d.toString()});
|
|
5
|
+
d=f||g||h;if(c.has(d))throw new _.I(_.D,4,4044,`EXT-X-DEFINE redefined variable "${d}".`);if(!b.test(d))throw new _.I(_.D,4,4044,`EXT-X-DEFINE invalid variable name "${d}".`);c.add(d)})},fJ=function(a,b){const c=Array.isArray(b)?b:[b];return a.filter(d=>{d=VI(d,_.rb);return c.includes(d)})},gJ=function(a,b){return a.some(c=>c.name===b)},hJ=function(a,b,c){c=void 0===c?{}:c;a=a.find(d=>d.name===b)||null;if(!a&&c.required)throw new _.I(_.D,4,4024,{missingTag:b});return a},iJ=function(a){var b=hJ(a,
|
|
6
|
+
"EXT-X-TILES");if(!b)return{Jd:1,ae:1,durationPerTile:null};a=_.L(b,"LAYOUT")||"1x1";b=_.L(b,DI);a=_.rB(a);return{Jd:a.Jd,ae:a.ae,durationPerTile:b?Number(b):null}},jJ=function(a){const b=new Set;a.variants.forEach(c=>{c.audio&&b.add(c.audio);c.video&&b.add(c.video)});a.textStreams.forEach(c=>b.add(c));a.thumbStreams.forEach(c=>b.add(c));return Array.from(b)},kJ=function(a,b){Array.isArray(a)||(a=[a]);a.forEach(c=>{for(const d of jJ(c))b(d,c)})},lJ=function(a){return a.some(b=>gJ(b.ba,"EXT-X-ENDLIST"))},
|
|
7
|
+
mJ=function(a){return a.type===_.q||a.type===_.t},nJ=function(a){if(hJ(a,"EXT-X-ENDLIST"))return _.Db;a=hJ(a,"EXT-X-PLAYLIST-TYPE");if(!a)return"LIVE";if(a.value===_.Db)return _.Db;if("EVENT"===a.value)return"EVENT";throw new _.I(_.D,4,4044,`Invalid EXT-X-PLAYLIST-TYPE value: ${a.value}`);},oJ=function(a){a={AUDIO:_.q,VIDEO:_.t,SUBTITLES:_.K,"CLOSED-CAPTIONS":_.K}[a.toUpperCase()];if(!a)throw new _.I(_.D,4,4044,"EXT-X-MEDIA tag has an invalid TYPE attribute.");return a},pJ=function(a,b,c){c=void 0===
|
|
8
|
+
c?!1:c;var d=0;let e=null;if(a){d=a.split("@");a=Number(d[0]);if(0>=a)throw new _.I(_.D,4,4044,"Byte range length must be positive.");if(d[1]){if(d=Number(d[1]),0>d)throw new _.I(_.D,4,4044,"Byte range start byte must not be negative.");}else{if(c)throw new _.I(_.D,4,4044,"Invalid byte range, offset is required but missing.");if(null==b)throw new _.I(_.D,4,4044,"Invalid byte range, cannot calculate offset based on previous byte ranges.");d=b+1}e=d+a-1}return{na:d,ja:e}},qJ=function(a,b){a=hJ(a,"EXT-X-BYTERANGE");
|
|
9
|
+
return pJ(a?a.value:null,b)},rJ=function(a){a=hJ(a,"EXTINF",{required:!0}).value.split(",");const b=Number(a[0]);if(isNaN(b))throw new _.I(_.D,4,4044,"#EXTINF must be a number.");return{duration:b,title:a[1]||null}},sJ=function(a,b){b=void 0===b?{}:b;const c={ag:!1,Dh:!1,Eh:null,gi:null,Lg:null};a=hJ(a,"EXT-X-SERVER-CONTROL",{required:b.Ug});if(!a)return c;const d=e=>null==e?null:Number(e);c.ag="YES"===_.L(a,"CAN-BLOCK-RELOAD");c.Dh="YES"===_.L(a,"CAN-SKIP-DATERANGES");c.Eh=d(_.L(a,"CAN-SKIP-UNTIL"));
|
|
10
|
+
c.gi=d(_.L(a,"HOLD-BACK"));c.Lg=d(_.L(a,"PART-HOLD-BACK",void 0,{required:b.Ug}));return c},tJ=function(a,b,c){c=void 0===c?!1:c;a=_.L(a,"BYTERANGE");return pJ(a,b,c)},uJ=function(a){const b=dJ(a,II),c=dJ(a,LI);a=dJ(a,"EXT-X-IMAGE-STREAM-INF");return{Mc:{Vf:fJ(b,[_.aA,_.Cb]),closedCaptions:fJ(b,BI),dj:fJ(b,QI)},be:c,Ye:a}},wJ=function(a,b){const c=qJ(a.ba,null);return new vJ(0,0,0,()=>[a.a],c.na,c.ja,0,b)},xJ=function(a){let b=Infinity,c=Infinity;jJ(a).filter(mJ).forEach(d=>{{d=d.T;var e=d[0].startTime;
|
|
11
|
+
const f=d[d.length-1].endTime;d=e;e=f-e}b=Math.min(b,d);c=Math.min(c,e)});return{ld:b,duration:c}},yJ=function(a){return a.map(b=>{({duration:b}=xJ(b));return b}).reduce((b,c)=>b+c,0)},zJ=function(a){return(a.video?a.video.$a:"")+" - "+(a.audio?a.audio.$a:"")},AJ=function(a,b,c,d,e){if(b===_.Db)return{delay:0,$d:0};b=hJ(a,"EXT-X-PART-INF");if(c&&b){e=Number(VI(b,"PART-TARGET"));if(null!=d)return{delay:d,$d:e};({Lg:d}=sJ(a,{Ug:!0}));return{delay:d,$d:e}}a=hJ(a,"EXT-X-TARGETDURATION",{required:!0});
|
|
12
|
+
a=Number(a.value);e=e||a;return null!=d?{delay:d,$d:e}:{delay:3*a,$d:e}},BJ=function(a){const b=new Map;a.forEach(c=>{var d=`${c.Fc()}:${c.streams[0].groupId}`;b.has(d)?(d=b.get(d),d.includes(c)||d.push(c)):b.set(d,[c])});return b},CJ=function(a){const b=new Map;for(const c of a){a=_.L(c,_.Ka);a=_.vn(a||_.fg);const d=VI(c,_.Ea),e=VI(c,"INSTREAM-ID");b.has(d)||b.set(d,new Map);b.get(d).set(e,a)}return b},DJ=function(a){return a.filter(b=>"mp4a.40.34"!==b)},EJ=function(a,b,c,d,e){var f=e&&e.Yd,g=e&&
|
|
13
|
+
e.schemeIdUri,h=_.L(a,"ID");f=_.L(a,"START-DATE")||f;if(null===h||!f)return _.qu.warn("Invalid EXT-X-DATERANGE missing mandatory ID or required START-DATE attribute, ignoring the EXT-X-DATERANGE tag.",a),null;b=d?c-b:-b;d=new Date(f);c=d.getTime()/1E3+b;h={id:h,startTime:c,startDate:d,Yd:f};f=$I(_.L(a,DI));void 0!==f&&0<=f&&(h.duration=f);f=$I(_.L(a,"PLANNED-DURATION"));void 0!==f&&0<=f&&(h.plannedDuration=f);g=_.L(a,"CLASS")||g||null;null!==g&&(h.schemeIdUri=g);f=(f=_.L(a,"END-DATE"))?new Date(f):
|
|
14
|
+
null;null!==f&&f.getTime()>=d.getTime()&&(h.endDate=f);f=a.attributes;if(null==f)var k=null;else{d={};for(k of f)k.name.trim().startsWith("X-")&&(d[k.name]=k.value);k=_.ah(d)?d:null}k=k||{};(d=_.L(a,"CUE"))&&(k.CUE=d.split(","));if(_.ck(g)){f=a.attributes;if(null==f)var l=null;else{d={};for(l of f)switch(l.name){case _.Mb:d[_.Mb]=l.value;break;case _.Lb:d[_.Lb]=l.value;break;case _.Qb:d[_.Qb]=$I(l.value);break;case _.Ob:d[_.Ob]=$I(l.value);break;case "X-SNAP":d["X-SNAP"]=l.value.split(",");break;
|
|
15
|
+
case _.Pb:d[_.Pb]=l.value.split(",")}l=_.ah(d)?d:null}l&&(k=Object.assign(k,l))}_.ah(k)&&(h.customAttributes=k);if(ZI(e,h))return _.qu.warn("EXT-X-DATERANGE augmented and previous values differ.Ignoring the EXT-X-DATERANGE tag.",a),null;h=_.Yg(e,h);if(_.ck(g)&&!_.dk(h.customAttributes))return _.qu.warn("Invalid EXT-X-DATERANGE Interstitial attributes X-ASSET-URI, X-ASSET-LIST"),null;let m;h.endDate?m=h.endDate.getTime()/1E3+b:h.duration?m=c+h.duration:h.plannedDuration?m=c+h.plannedDuration:m=c;h.endTime=
|
|
16
|
+
m;h.type=_.Zd;return h},FJ=function(a,b){if(!a)return null;const c=a.$a;return b.find(d=>d.streams[0].$a===c)||null},GJ=function(a){return(a=_.L(a,"CHANNELS"))?parseInt(a.split("/")[0],10):null},HJ=function(a){return a.some(b=>b.startsWith("#EXT-X-TARGETDURATION"))?1:0},IJ=function(a,b){const c=new Map,d=new URL(b);a.forEach(e=>{var f=_.L(e,_.Sa),g=_.L(e,"QUERYPARAM");if(f)g=VI(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.I(_.D,4,4044,`Query param '${g}' missing in playlist URI.`);
|
|
17
|
+
if(!f)throw new _.I(_.D,4,4044,`Query param '${g}' has no associated value`+" in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},JJ=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,(c,d)=>{c=b.get(d);if(null==c)throw new _.I(_.D,4,4044,`Undefined variable '${d}'`);return c})},KJ=function(a,b){a.forEach(c=>{c.attributes.forEach(d=>{d.value=JJ(d.value,b)})})},NJ=function(a,b,c){const d=[];for(let e=0;e<b.length;e++){const f=LJ(a,b[e]);d.push(f);if(f.name===LI){const g=b[e+1];if(!g)throw new _.I(_.D,
|
|
18
|
+
4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Lo(_.ub,g));e++}}b=dJ(d,"EXT-X-DEFINE");eJ(b);b=IJ(b,c);a.a=b;KJ(d,a.a);return new MJ(c,0,d)},RJ=function(a,b,c){const {Ri:d,fi:e,pj:f}=OJ(b),g=PJ(a,f,c);b=e.map(k=>LJ(a,k,g));const h=QJ(a,c,d,g);return new MJ(c,1,b,h)},SJ=function(a,b,c){b=b.trim().split(/\n+/m).map(d=>d.trim()).filter(d=>d.length&&!/^#(?!EXT)/m.test(d));if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.I(_.D,4,4015);b=b.slice(1);return 0===HJ(b)?NJ(a,b,
|
|
19
|
+
c):RJ(a,b,c)},OJ=function(a){const b=[],c=[],d=[];for(const e of a)TJ.test(e)?d.push(e):UJ.test(e)?c.push(e):b.push(e);return{Ri:b,fi:c,pj:d}},PJ=function(a,b,c){b=b.map(e=>LJ(a,e));eJ(b);const d=IJ(b,c);b.map(e=>_.L(e,"IMPORT")).filter(Boolean).forEach(e=>{const f=a.a.get(e);if(null==f)throw new _.I(_.D,4,4044,`Cannot import variable '${e}' as it is not defined `+"in the master playlist");d.set(e,f)});return d},LJ=function(a,b,c){a=_.No(a.h++,b);c&&KJ([a],c);return a},QJ=function(a,b,c,d){const e=
|
|
20
|
+
[];let f=[],g=[];c.forEach(h=>{/^(#EXT)/.test(h)?(h=LJ(a,h,d),"EXT-X-PART"===h.name||"EXT-X-PRELOAD-HINT"===h.name&&"PART"===_.L(h,_.rb)?g.push(h):f.push(h)):(gJ(f,"EXT-X-GAP")||(h=JJ(h,d),h=_.Bm(h,b),e.push(new VJ(h,f,g))),f=[],g=[])});0<g.length&&e.push(new VJ(null,f,g));return e},WJ=function(a,b,c){const d=[],e=[];e.push(new _.Lo(_.na,"0"));e.push(new _.Lo(_.ub,b));c.length&&e.push(new _.Lo(_.qa,c));d.push(new _.Mo(a.h++,LI,e));return new MJ(b,0,d)},XJ=function(a){function b(h,k,l){let m="";for(;k<
|
|
21
|
+
l;k++)m+="%"+("00"+h[k].toString(16)).slice(-2);return m}function c(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]}function d(){throw new _.I(_.D,4,4030);}cJ(a)||d();let 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(let 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
|
+
22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}cJ(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},YJ=function(a,b){let c=null,d=0;try{(new _.aq).N(_.ve,_.Up).N(_.cg,_.Up).N(_.qe,_.Up).fa("mdhd",g=>{g.reader.skip(0===g.version?8:16);d=_.Q(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.Cv.error("Unable to find timescale in init segment!"),new _.I(_.D,4,4030,CI,c);let e=0,f=!1;try{(new _.aq).N("moof",_.Up).N("traf",_.Up).fa("tfdt",g=>{var h=d;if(0===
|
|
23
|
+
g.version)h=_.Q(g.reader)/h;else{{const k=_.Q(g.reader),l=_.Q(g.reader);if(!(2097151>=k||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=k/h*Math.pow(2,32)+l/h}}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.I(_.D,4,4030,CI,c);return e},ZJ=function(a){for(;a.getPosition()<a.Ra()-1;){const b=a.getPosition();if(71===_.Mp(a))return WI(a),b}return-1},$J=function(a){function b(){d.seek(e+188);f=_.Mp(d);
|
|
24
|
+
71!==f&&(d.seek(e+192),f=_.Mp(d));71!==f&&(d.seek(e+204),f=_.Mp(d));71!==f&&c();WI(d)}function c(){throw new _.I(_.D,4,4030);}const d=new _.Gq(new DataView(a),!1);let e=0,f=0;e=ZJ(d);0>e&&(_.Cv.error("Unable to find sync byte in TS after scanning."),c());for(;;){e=d.getPosition();f=_.Mp(d);71!==f&&c();a=_.Np(d);if(8191===(a&8191)){b();continue}if(!(a&16384)){b();continue}a=(_.Mp(d)&48)>>4;0!==a&&2!==a||c();3===a&&(a=_.Mp(d),d.skip(a));if(1!==_.Q(d)>>8){b();continue}d.skip(3);a=_.Mp(d)>>6;0!==a&&1!==
|
|
25
|
+
a||c();0===_.Mp(d)&&c();a=_.Mp(d);const g=_.Np(d),h=_.Np(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}},cK=function(a){const b=aK(a),c=bK(a);a.forEach(d=>{const e=d.T,f=e.findIndex(h=>h.ma===b);let g=e.findIndex(h=>h.ma===c+1);-1===g&&(g=e.length);d.T=e.slice(f,g)})},bK=function(a){a=a.map(b=>b.T[b.T.length-1].ma);return Math.min(...a)},aK=function(a){a=a.map(b=>b.T[0].ma);return Math.max(...a)},fK=function(a){var b=VI(a,OI);if(!dK.includes(b))return eK.error("PlayReady in HLS is only supported with [",
|
|
26
|
+
dK.join(", "),"], not",b),null;a=VI(a,_.ub);b=_.Tl(a);a=null;b=_.G(b.data);try{a=_.RA(_.Nq(b))}catch(c){a=b}return _.dB(_.rd,[{initDataType:_.Vc,initData:a}],"")},hK=function(a){if(0===a.length)return gK();if(a.some(c=>"whole-segment"===c.type)||a.every(c=>c.type===_.Be))return a[0];a=a.filter(c=>c.type===UI);const b=_.Yh(a.flatMap(c=>c.drmInfos));return{keyId:a[a.length-1].keyId,type:UI,drmInfos:b}},kK=function(a,b){return iK(a).map(c=>jK(c.ba,b)).filter(Boolean)},iK=function(a){return a.filter(b=>
|
|
27
|
+
gJ(b.ba,GI))},jK=function(a,b){a=dJ(a,GI).filter(d=>"AES-128"!==VI(d,OI));if(0===a.length)return null;var c=VI(a[0],OI);if(1===a.length&&"NONE"===c)return gK();c=a.map(d=>VI(d,OI));if(!c.every(d=>"SAMPLE-AES"===d)&&!c.every(d=>d===PI))throw lK.warn(`EXT-X-KEY methods ${c.join(", ")} are incompatible.`),new _.I(_.D,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");a=a.map(d=>{const e=_.L(d,"KEYFORMAT","identity");{const f=mK[e]||null;d=f?f(d,b):null}d||lK.warn("Unsupported HLS KEYFORMAT",
|
|
28
|
+
e);return d}).filter(Boolean);if(0===a.length)throw new _.I(_.D,4,4026);return{keyId:a.map(d=>d.keyIds).reduce((d,e)=>d.concat(e),[]).reverse()[0]||null,type:UI,drmInfos:a}},gK=function(){return{type:_.Be,drmInfos:[],keyId:null}},nK=function(a,b,c){a=dJ(a,GI)[0];if(!a||"AES-128"!==VI(a,OI))return null;var d=_.L(a,"IV","");d?c={iv:_.Pl((d||"0x").slice(2)),generatedIv:!1}:(d=_.L(a,"KEYFORMAT"),c=null==d||"identity"===d?{iv:_.Sl(new Uint8Array(12),bJ(c)),generatedIv:!0}:{iv:null,generatedIv:!1});const {iv:e,
|
|
29
|
+
generatedIv:f}=c;return{method:"AES-128",url:_.Bm(VI(a,_.ub),b),iv:e,generatedIv:f}},oK=function(a,b,c){return _.v(function*(){const d=b.f(),e=_.LB(b.Da(),b.na,b.na+2048-1,a.a.attemptParameters);e.type=2;const f=_.LB(b.Da(),b.na,b.ja,a.a.attemptParameters);f.type=2;d&&(f.keyInfo=d);try{return yield a.f(c?f:e)}catch(g){if(7001===g.code||c)throw g;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.",
|
|
30
|
+
e.uris[0]);try{return yield a.f(f)}catch(h){throw a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],h),new _.I(_.D,4,4030,"Failed to fetch the media segment.");}}})},pK=function(a,b,c,d,e,f){return _.v(function*(){a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.Fc||d===_.Ec)return 0;if(d===_.Dc){var g=yield oK(a,c,f);g=_.G(g.data);if(!cJ(g))throw new _.I(_.D,4,4030,"AAC segment does not contain an ID3 tag.");return XJ(g)}if(d===_.rg||d===
|
|
31
|
+
_.Gc)return g=[oK(a,c,f)],b&&g.push(oK(a,b,!0)),g=yield Promise.all(g),YJ(g[0].data,(g[1]||g[0]).data);if(d===_.qg)return g=yield oK(a,c,f),$J(g.data);if(!_.Gs(`${d.split("/")[0]||""}/mp4;codecs="${e}"`))return 0;throw new _.I(_.D,4,4030);})},qK=function(a,b){a=a.map(c=>c.streams[b]);return a.some(c=>null==c)?null:a},rK=function(a,b){a=a.streams.find(c=>{c=c.T;return c[0].position<=b&&b<=c[c.length-1].position});return null==a?null:a.T.find(c=>c.position===b)||null},sK=function(a,b){a.streams.forEach(c=>
|
|
32
|
+
{c.Le=b})},tK=function(a,b){a.streams.forEach(c=>{c.width=b})},uK=function(a,b){a.streams.forEach(c=>{c.height=b})},vK=function(a,b){a.streams.forEach(c=>{c.frameRate=b})},wK=function(a,b){a.streams.forEach(c=>{c.bandwidth=b})},xK=function(a,b){a=a.map(c=>c.a[b]);return a.some(c=>null==c)?null:a},yK=function(a,b){const c=new Set(a.map(d=>d.ma));return b.filter(d=>!c.has(d.ma))},AK=function(a,b){for(;a[0].ma<b[0].ma;)a.splice(0,1);var c=a[0];let d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||
|
|
33
|
+
zK(c,d);const e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&zK(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},EK=function(a,b,c,d,e){var f=b[0].length();f=aJ(f).map(g=>{var h=xK(b,g)||[];const k=qK(c,g)||[];g=qK(d,g)||[];{const l=[...BK(h),...k,...g].filter(Boolean);CK(l);const {ma:m,duration:n}=l[0];h={configurationId:a,variants:h,textStreams:k,thumbStreams:g,startTime:0,id:`P${m}`,endTime:n,duration:n,ma:m}}return h});f[0].startTime+=e;f[0].endTime+=e;DK(f);return f},
|
|
34
|
+
BK=function(a){a=new Set(a.flatMap(b=>[b.video,b.audio]).filter(Boolean));return Array.from(a)},DK=function(a){for(let b=0;b<a.length;b++){const c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},zK=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;FK(a.variants,b.variants);GK(jJ(a),jJ(b))},FK=function(a,b){const c=new Map(a.map(d=>[zJ(d),d]));b.forEach(d=>{c.get(zJ(d)).drmInfos=d.drmInfos})},GK=function(a,b){const c=new Map(a.map(d=>
|
|
35
|
+
[d.$a,d]));b.forEach(d=>{const e=c.get(d.$a);e.T=d.T;d.T.forEach(f=>{f.initSegment=e.initSegmentReference});e.segmentIndex.replace(d.T);e.ld=d.ld;e.bf=d.bf;e.duration=d.duration;e.jg=d.jg;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},CK=function(a){const b=HK(a);a.forEach(c=>{_.HB(c.segmentIndex,b);c.duration=b;c.bf=c.ld+b})},HK=function(a){let b=Infinity;a.filter(mJ).forEach(c=>{b=Math.min(b,c.duration)});return b},LK=function(a){if(!(2>a.length)&&IK(a)){a=a.map(e=>({playlist:e,
|
|
36
|
+
fg:JK(e.T[0])}));var b=a.map(e=>e.fg),c=Math.max(...b);b=Math.min(...b);if(!(1E3>c-b)){a.forEach(e=>{const f=e.playlist;for(e=e.fg;0<f.T.length&&1E3<c-e;){var g=f.T.shift(),h=f.T[0];if(!h)break;KK(g,h);h=JK(h);null!=h?e=h:({duration:h}=rJ(g.ba),e+=1E3*h)}});a=a.map(e=>e.playlist);if(a.some(e=>0===e.T.length))throw new _.I(_.D,4,4048,"Media playlists are completely out of sync.");var d=Math.min(...a.map(e=>e.T.length));a.forEach(e=>{for(;e.T.length>d;)e.T.pop()})}}},IK=function(a){return a.every(b=>
|
|
37
|
+
!!JK(b.T[0]))},KK=function(a,b){a&&b&&[HI,GI].forEach(c=>{if(!gJ(b.ba,c)){var d=a.ba.filter(e=>e.name===c);0!==d.length&&d.forEach(e=>{b.ba.push(e)})}})},MK=function(a,b){kJ(b,(c,d)=>{_.YB(a,c.T,d.startTime)});_.QB(a.a,b[0].startTime,b[b.length-1].endTime)},NK=function(a,b){return _.v(function*(){var c=_.rk([b],a.a.attemptParameters);c.type=1;c=yield a.I(c);let d="";try{d=_.ii(c.data)}catch(e){throw new _.I(_.D,4,4042);}d=d.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");d=d.trim();return{text:d,response:c}})},
|
|
38
|
+
YK=function(a,b){return _.v(function*(){var c=OK(a,b,a.o,"");if(1===c.type){var d=c.T[0].a;c=PK(d);if(!c)throw new _.I(_.D,4,4021,`Unknown file extension ${d}`);d="";c===_.t?d="avc1.42E01E":c===_.q&&(d="mp4a.40.2");c=WJ(a.S,a.o,a.a.hlsDefaultCodecs||d)}d=uJ(c.ba);c=QK(d.Mc.Vf);c.forEach(m=>{a.K.add(m.groupId)});var e=yield RK(a,d);var f=e.pi;const g=e.periods;var h=e.Li;const k=e.fj;d=e.alternativeVariants;const l=e.alternativeTextStreams;e=e.alternativeImageStreams;if(!a.D)throw new _.I(_.D,7,7001);
|
|
39
|
+
SK(a,g);h=TK(a,f.delay,g,h);UK(a)||(a.G=f.$d,a.g.info(`Update playlist each ${a.G} s`),VK(a));WK(a,h,g);f=XK(a,k);c={presentationTimeline:h,periods:g,minBufferTime:0,cues:f,muxedAudioTracks:c};d&&(c.alternativeVariants=d);l&&(c.alternativeTextStreams=l);e&&(c.alternativeImageStreams=e);a.g.debug("HLS playlist parsed",c);return c})},$K=function(a,b){return Promise.all(b.map(c=>ZK(a,c)))},bL=function(a,b){b.forEach(c=>{a:{var d=a.j.get(c.verbatimUri),e=!UK(a),f=hJ(c.ba,"EXT-X-DISCONTINUITY-SEQUENCE");
|
|
40
|
+
if(f)var g=Number(f.value);else{d?(f=d.streams[d.streams.length-1].T,f=f[f.length-1].ma):f=0;if(e&&0<f)try{{const k=hJ(c.ba,JI);if(!k)throw aL.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(MI);const l=Number(k.value),m=rK(d,l);if(!m)throw aL.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist"+` (segment position = ${l})`),Error(MI);var h=m.ma}g=h;break a}catch(k){throw new _.I(_.D,4,4024,
|
|
41
|
+
"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}g=0}}c=c.T||[];for(const k of c)gJ(k.ba,FI)&&g++,k.ma=g});cK(b)},eL=function(a,b){return _.v(function*(){"LIVE"===a.w&&(a.M=!0,a.H=!0);const {textStreams:c,thumbStreams:d,yh:e}=yield cL(a,b),f=a.f.periods[0].variants.map(g=>{const h=FJ(g.audio,e),k=FJ(g.video,e);g=dL(a,h,k,g.bandwidth);if(!g)throw new _.I(_.D,4,4047,{message:"Video and audio are encrypted in an incompatible way.",Rj:k?k.streams[0].$a:void 0,audio:h?
|
|
42
|
+
h.streams[0].$a:void 0});return g});return EK(a.D.configurationId,f,c,d,a.B)})},SK=function(a,b){UK(a)||2!==a.a.timeline.version||(a.J||(a.J=b[0].startTime),_.WC(b,-a.J))},fL=function(a,b){b=b.flatMap(d=>d.T[0].ba);b=hJ(b,KI);if(!b)return null;const c=(new Date(b.value)).getTime();return isNaN(c)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag "+`value (value: ${b.value}).`),null):c/1E3},gL=function(a,b,c){b=b.find(e=>null!==hJ(e.ba,EI));if(!b)return[];if(null===c)throw new _.I(_.D,4,4024,
|
|
43
|
+
"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");var d=b.ba.filter(e=>e.name===EI);b=new Map;for(const e of d)d=(d=_.L(e,"ID"))?b.get(d):void 0,(d=EJ(e,c,a.B,!UK(a),d))&&b.set(d.id,d);return Array.from(b.values())},XK=function(a,b){const c=new Set(b.map(d=>d.id));a.A.forEach((d,e)=>{c.has(e)||a.A.delete(e)});for(const d of b){if((b=a.A.get(d.id))&&b.Yd!==d.Yd)a.D.onError(new _.I(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for"+` ID=${d.id}`));const e={configurationId:a.D.configurationId,
|
|
44
|
+
schemeIdUri:d.schemeIdUri,customAttributes:d.customAttributes,value:"",startTime:d.startTime,Yd:d.Yd,endTime:d.endTime,id:d.id,type:_.Zd,eventElement:null};b&&!YI(b,e)||a.A.set(d.id,e)}return Array.from(a.A.values())},hL=function(a,b,c){a.w=_.Db;_.UB(b,!0);b.f=c[c.length-1].endTime},OK=function(a,b,c,d){a=SJ(a.S,b,c);a.verbatimUri=d;return a},QK=function(a){return a.filter(b=>b.name===II&&_.L(b,_.rb)===_.aA&&!_.L(b,_.ub)).map(b=>{const c=GJ(b),d=_.L(b,_.Ka)||_.fg;return{groupId:VI(b,_.Ea),id:_.gI++,
|
|
45
|
+
label:VI(b,_.Sa),language:d,channelsCount:c,primary:"YES"===_.L(b,"DEFAULT")}})},RK=function(a,b){return _.v(function*(){var c=CJ(b.Mc.closedCaptions),d=iL(a,b.be),e=yield jL(a,b),f=Object.values(e).flat().map(k=>k.playlist),g=f[0];const h=nJ(g.ba);a.w=h;h!==_.Db&&(a.H=!0);bL(a,f);!UK(a)&&LK(f);a.L=sJ(g.ba);f=AJ(g.ba,h,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod);g=yield kL(a,e.Wf,d);c=yield lL(a,e.be,g,c);d=yield mL(a,e.cj,d);g=yield nL(a,e.Ye);d=EK(a.D.configurationId,
|
|
46
|
+
c,d,g,a.B);a.D.filterAllPeriods(d);c=[...e.be,...e.Wf].map(k=>k.playlist);e=fL(a,c);c=gL(a,c,e);return{periods:d,Li:e,fj:c,pi:f}})},TK=function(a,b,c,d){let e=!0,f=null,g=0;UK(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.lI(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.UB(a,e);MK(a,c);d&&_.TB(a,d);return a},VK=function(a){var b=0;for(var c of a.j.values())b=Math.max(b,c.streams[0].ld);for(c=0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c){a.g.debug("Offsetting live streams by",
|
|
47
|
+
c,"to compensate for rollover");for(const d of a.j.values())b=d.streams[0],95443.7176888889>b.ld?(a.g.debug("Offset applied to",b.type),b.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",b.type)}},WK=function(a,b,c){c=yJ(c);"LIVE"===a.w||"EVENT"===a.w?(c=Math.max(c,b.J),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),b.A=c):a.w===_.Db&&(b.f=c)},cL=function(a,b){return _.v(function*(){const c=h=>h.stream.Fc()===_.t||h.stream.Fc()===_.q;var d=b.filter(c),e=b.filter(h=>
|
|
48
|
+
!c(h)),f=h=>{var k=h.stream.streams[0];k={language:k.language,channelsCount:k.channelsCount,spatialAudio:k.spatialAudio,closedCaptions:k.closedCaptions,primary:k.primary,kind:k.kind||null,groupId:k.groupId,type:k.type,codecs:k.codecs,name:k.originalId,uri:k.$a,ce:{width:k.width,height:k.height,frameRate:k.frameRate}};h=Object.assign({},{playlist:h.playlist,gc:null},k);return oL(a,h)};const g=[];for(const h of d)g.push(yield f(h));d=[];for(const h of e)d.push(yield f(h));pL(a,g.concat(d));e=d.filter(h=>
|
|
49
|
+
h.Fc()===_.IA);f=d.filter(h=>h.Fc()===_.be);return{textStreams:e,thumbStreams:f,yh:g}})},dL=function(a,b,c,d,e){const f=[],g=(c||b).length();for(let n=0;n<g;n++){var h=b?b.streams[n]||null:null,k=c?c.streams[n]||null:null,l=h,m=k;l=l&&m?_.nB(l.drmInfos,m.drmInfos)?_.mB(l.drmInfos,m.drmInfos):null:l?l.drmInfos:m?m.drmInfos:null;if(!l)return null;m=d;h={id:e?e:a.h++,language:h?h.language:_.fg,primary:!!h&&h.primary||!!k&&k.primary,audio:h,video:k,bandwidth:m,drmInfos:l,allowedByApplication:!0,allowedByKeySystem:!0};
|
|
50
|
+
f.push(h)}return new qL(f)},oL=function(a,b){return _.v(function*(){const c=b.playlist,d=b.codecs,e=b.type,f=b.hd,g=b.gc,h=b.groupId,k=b.muxedAudioId,l=b.primary;var m=b.kind;const n=b.name,p=b.channelsCount,u=b.spatialAudio,x=b.closedCaptions,y=b.ce,A=_.vn(f||_.fg);if(1!==c.type)throw new _.I(_.D,4,4017);const E=yield rL(a,c,e,d),F=a.a.lowLatencyMode?_.zA:_.yA;let C=m;e!==_.K||m||(C=_.IA);const ja=nJ(c.ba);m=E.map(Ca=>{const Xa=Ca.T,Hb=Ca.Jh,tb=Ca.mimeType,fc=Ca.ma,gc=Xa[0].startTime,Ib=Xa[Xa.length-
|
|
51
|
+
1].endTime,kb=Ib-gc,xa=new _.mI(Xa),wb=Xa[0].initSegment||null;return{id:null==g?_.gI++:g,originalId:n,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:xa.f.bind(xa),getSegmentReference:xa.get.bind(xa),adjustSegmentDurations:xa.h.bind(xa),getDuration:xa.getDuration.bind(xa),segmentIndex:xa,segmentLookupStrategy:F,initSegmentReference:wb,mimeType:tb,codecs:d,kind:C,jg:Hb.type,encrypted:Hb.type===UI,aesEncrypted:Ca.aesEncrypted,keyId:Hb.keyId,language:A,originalLanguage:f||_.fg,
|
|
52
|
+
label:n,type:e,primary:l,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:y?y.frameRate:void 0,width:y?y.width:void 0,height:y?y.height:void 0,bandwidth:void 0,roles:[],channelsCount:p,spatialAudio:u,closedCaptions:x,T:Xa,drmInfos:Hb.drmInfos,ma:fc,$a:c.verbatimUri,Le:c.a,ld:gc,bf:Ib,duration:kb,groupId:h,Ij:ja,muxedAudioId:k}});return new sL(m)})},pL=function(a,b){b.forEach(c=>{a.j.a.set(c.streams[0].$a,c)})},iL=function(a,b){const c=new Map;for(const f of b){var d=_.L(f,_.aA);b=_.L(f,_.Cb);var e=
|
|
53
|
+
_.L(f,QI);const g=tL(a,f);if(e){const h=_.dp(_.K,g);c.set(`${_.K}:${e}`,h);e=g.indexOf(h);-1<e&&g.splice(e,1)}d&&(e=uL(_.q,g),c.set(`${"audio"}:${d}`,e));b&&(d=uL(_.t,g),c.set(`${"video"}:${b}`,d))}return c},jL=function(a,b){return _.v(function*(){const c=yield Promise.all([vL(a,b.Mc.Vf),vL(a,b.Mc.dj),vL(a,b.be),vL(a,b.Ye)]),[d,e,f,g]=c;return{Wf:d,cj:e,be:f,Ye:g}})},kL=function(a,b,c){return _.v(function*(){if(0===b.length)return new Map;var d=[wL(a,b[0],c)];yield d[0];d=d.concat(b.slice(1).map(e=>
|
|
54
|
+
wL(a,e,c)));d=yield Promise.all(d);return BJ(d)})},lL=function(a,b,c,d){return _.v(function*(){const e=new Set;var f=[...b];let g=0;var h=Infinity;for(let k=0;k<f.length;++k){const l=Number(VI(f[k].tag,_.na));l<h&&(h=l,g=k)}h=f.splice(g,1).pop();h=yield xL(a,h,c,d,e);f=f.map(k=>xL(a,k,c,d,e));f=yield Promise.all(f);f.splice(g,0,h);return f.reduce(_.aB,[])})},mL=function(a,b,c){return Promise.all(b.map(d=>wL(a,d,c)))},nL=function(a,b){return Promise.all(b.map(c=>yL(a,c)))},zL=function(a,b){return _.v(function*(){const c=
|
|
55
|
+
_.Bm(b.verbatimUri,a.o),{response:d,text:e}=yield NK(a,c);return OK(a,e,d.uri,b.verbatimUri)})},AL=function(a,b,c){return _.v(function*(){const d=yield oL(a,{playlist:c,codecs:b.codecs,type:b.type,hd:b.originalLanguage,gc:b.id,groupId:b.groupId,primary:b.primary,kind:b.kind||null,name:b.label,channelsCount:b.channelsCount,spatialAudio:b.spatialAudio||!1,closedCaptions:b.closedCaptions,ce:{width:b.width,height:b.height,frameRate:b.frameRate}});b.bandwidth&&wK(d,b.bandwidth);return d})},UK=function(a){return a.w===
|
|
56
|
+
_.Db},vL=function(a,b){return _.v(function*(){return(yield Promise.all(b.map(c=>_.v(function*(){const d=yield BL(a,c);return d?{tag:c,playlist:d}:null})))).filter(Boolean)})},ZK=function(a,b){return _.v(function*(){var c=new URL(b.streams[0].Le);if(a.a.lowLatencyMode&&a.L&&a.L.ag){var d=b.streams[b.streams.length-1].segmentIndex;if(d=d.a[d.a.length-1]){var e=d.a,f=e.length-1;d={ri:d.position,Gi:e&&0<e.length?f:null}}else d=null;if(e=d)d=c.searchParams,f=e.Gi,d.set("_HLS_msn",e.ri.toString()),null===
|
|
57
|
+
f&&d.get(RI)&&d.delete(RI),null!==f&&d.set(RI,f.toString())}const {response:g,text:h}=yield NK(a,c.toString());c=b.streams[0].$a;d=b.streams[0].Le;e=g.uri;d!==e&&(d=e,sK(b,d));c=OK(a,h,d,c);return{stream:b,playlist:c}})},tL=function(a,b){var c=_.L(b,_.qa,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);c=DJ(c);b=new Set;const d=[];for(const e of c)c=_.gB(e),b.has(c)?a.g.debug("Ignoring duplicate codec"):(d.push(e),b.add(c));return d},uL=function(a,b){if(1===b.length)return b[0];a=_.dp(a,
|
|
58
|
+
b);if(null!=a)return a;throw new _.I(_.D,4,4025,{codecList:b});},wL=function(a,b,c){return _.v(function*(){const d=b.tag,e=b.playlist;return CL(a,e.verbatimUri,()=>_.v(function*(){const f=VI(d,_.Ea),g=oJ(VI(d,_.rb));var h=VI(d,_.rb).toUpperCase();if(oJ(h)!==_.K)h=null;else{var k=d.getAttribute("FORCED");k=!(!k||!k.value||"YES"!==k.value.toUpperCase());var l=_.IA;h===BI&&(l=_.rA);k&&(l=_.Ud);h=l}k=c.get(`${g}:${f}`)||"";l=_.L(d,_.Ka);const m=_.L(d,_.Sa),n=_.L(d,"DEFAULT"),p=g===_.q?GJ(d):null;var u=
|
|
59
|
+
g===_.q?(u=_.L(d,"CHANNELS"))?u.includes("/JOC"):!1:!1;return yield oL(a,{playlist:e,codecs:k,type:g,hd:l,primary:"YES"===n,name:m,channelsCount:p,spatialAudio:u,groupId:f,kind:h,gc:null,closedCaptions:null,ce:null})}))})},yL=function(a,b){return _.v(function*(){const c=b.tag,d=b.playlist;return CL(a,d.verbatimUri,()=>_.v(function*(){var e=_.L(c,_.qa)||"jpg",f=_.L(c,_.Ka);const g=_.L(c,_.Sa);e=yield oL(a,{playlist:d,codecs:e,type:_.be,hd:f,name:g,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,
|
|
60
|
+
closedCaptions:null,gc:null,groupId:null,ce:null});(f=_.L(c,_.na))&&wK(e,Number(f));return e}))})},xL=function(a,b,c,d,e){return _.v(function*(){var f=b.tag,g=Number(VI(f,_.na));if(f.hasAttribute("FRAME-RATE")||f.hasAttribute(_.ib)){var h=_.L(f,"FRAME-RATE");f=_.L(f,_.ib);var [k,l]=f?f.split("x"):[null,null];h={frameRate:$I(h),width:$I(k),height:$I(l)}}else h=null;if(f=yield DL(a,b,h,c,d)){h=f.video;f=f.audio;var m=0<f.length?f:[null];h=0<h.length?h:[null];f=[];for(const n of m)for(const p of h){m=
|
|
61
|
+
(p?p.streams[0].$a:"")+" - "+(n?n.streams[0].$a:"");if(e.has(m)){a.g.debug("Skipping variant which only differs in text streams.");continue}const u=dL(a,n,p,g);null==u?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(f.push(u),e.add(m))}g=f}else g=[];return g})},EL=function(a,b,c,d,e,f){let g=tL(a,b);a.g.debug("Guessing stream type for",b.toString());b=!1;const h=_.dp(_.t,g),k=d+e;1!==g.length||c||h?!k&&1<g.length?(a.g.debug("Guessing multiplexed audio+video"),c=_.t,g=[g.join(",")]):d&&
|
|
62
|
+
f?(a.g.debug(NI),c=_.q,b=!0):e?(a.g.debug(NI),c=_.q):(a.g.debug("Guessing video-only"),c=_.t):(c=_.q,a.g.debug(NI));return{type:c,wh:g,hi:b}},CL=function(a,b,c){if(a.j.has(b))return a=a.j.get(b),Promise.resolve(a);if(a.j.f.has(b))return a.j.f.get(b)||null;c=c();a.j.set(b,c);return c},DL=function(a,b,c,d,e){return _.v(function*(){var f=b.tag,g=b.playlist,h=_.L(f,_.aA),k=_.L(f,_.Cb);h=h?d.get(`${"audio"}:${h}`)||[]:[];k=k?d.get(`${"video"}:${k}`)||[]:[];k={audio:h,video:k};const l=g.verbatimUri;g=k.audio.find(u=>
|
|
63
|
+
u.streams[0].$a===l);const {type:m,wh:n,hi:p}=EL(a,f,c,k.audio.length,k.video.length,g);f=null;p||(f=yield FL(a,b,n,m,e,c));if(null==f)return null;k[m]=[f];m===_.q&&c&&k.video.forEach(u=>{tK(u,c.width);uK(u,c.height);vK(u,c.frameRate)});return k})},FL=function(a,b,c,d,e,f){return _.v(function*(){const g=b.tag,h=b.playlist;return CL(a,h.verbatimUri,()=>_.v(function*(){var k=_.L(g,BI);let l=null;d===_.t&&k&&"NONE"!==k&&(l=e.get(k));k=(k=_.L(g,_.aA)||void 0)&&a.K.has(k)?k:void 0;var m=uL(d,c);if(k){const n=
|
|
64
|
+
uL(_.q,c);m+=`,${n}`}return yield oL(a,{playlist:h,codecs:m,type:d,closedCaptions:l,primary:!1,kind:null,hd:null,name:null,channelsCount:null,spatialAudio:!1,gc:null,groupId:null,muxedAudioId:k,ce:f})}))})},rL=function(a,b,c,d){return _.v(function*(){var e=b.verbatimUri,f=b.T;var g=void 0===g?0:g;var h=hJ(b.ba,JI);var k=h?Number(h.value):g;g=[];h=null;if(a.H){a.H=!1;var l=a.B;a.B=yield GL(a,b.a,e,f,k,c,d);null!=l&&(h=a.B-l)}e=k;if(0===f.length)f=[];else{k=[];l=[];for(var m of f)gJ(m.ba,FI)&&0<l.length&&
|
|
65
|
+
(k.push(l),l=[]),l.push(m);k.push(l);f=k}for(m=0;m<f.length;m++)k=f[m],l=yield HL(a,b.a,k,e,c,d,g[g.length-1]||null,h),g.push(l),e+=k.length;IL(g);return g})},BL=function(a,b){return _.v(function*(){var c=b.name!==II?!0:_.L(b,_.rb)===QI;c=_.L(b,_.ub,void 0,{required:c});if(!c)return null;const d=_.Bm(c,a.o),e=Date.now(),{response:f,text:g}=yield NK(a,d);a.D.onEvent(new _.H(TI,{detail:{duration:Date.now()-e,type:"media"}}));return OK(a,g,f.uri,c)})},IL=function(a){if(1<(new Set(a.map(b=>b.mimeType))).size)throw new _.I(_.D,
|
|
66
|
+
4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},JL=function(a,b,c){a=dJ(a.ba,HI);if(1<a.length)throw new _.I(_.D,4,4020);a=a[0];if(!a)return null;const d=VI(a,_.ub),e=_.Bm(d,b);b=tJ(a,null,!0);return new _.hI(()=>[e],b.na,b.ja,c)},KL=function(a,b,c,d,e,f,g){const h=[];for(let p=0;p<b.f.length;p++){const u=b.f[p];var k=0===p,l=k?a:h[h.length-1],m=k?d:l.endTime,n=Number(_.L(u,DI));n=m+n;k=tJ(u,k?null:l.ja,k);l=String(_.L(u,_.ub));
|
|
67
|
+
const x=(l=_.Bm(l,g))?[l]:[];m=new vJ(c,m,n,()=>x,k.na,k.ja,e,f,!1,null,null,null,null);if("YES"===_.L(u,"INDEPENDENT")||0===p)m.h=!0;h.push(m)}return h},LL=function(a,b,c,d,e,f,g,h,k,l,m){const n=c.ba;var p=c.a;0<dJ(n,HI).length&&(m=JL(c,k,g));var u=null!=p;const x=p?[p]:[];if(!u&&!a.a.lowLatencyMode)return null;let y=0,A={na:0,ja:null};p=null;u&&({duration:u}=rJ(n),y=e+u,A=qJ(n,b?b.ja:null));a.a.lowLatencyMode&&0<c.f.length&&(p=KL(b,c,d,e,f,g,k),0===y&&(y=p[p.length-1].endTime));a=h===_.be?iJ(n):
|
|
68
|
+
null;d=new vJ(d,e,y,()=>x,A.na,A.ja,f,g,!1,null,a?a.Jd:null,a?a.ae:null,a?a.durationPerTile:null,p,m);d.ma=l;return d},GL=function(a,b,c,d,e,f,g){return _.v(function*(){var h=d[0];if(!UK(a)&&a.f)try{return ML(a,c,e)}catch(n){if(h=a.j.get(c)){var k=h.streams[h.streams.length-1].T;k=k[k.length-1];a.g.warn(`Last #EXT-X-MEDIA-SEQUENCE values ${h.streams[0].T[0].position} - ${k.position}`+`, new values ${e} - ${e+d.length-1}.`,b,h)}throw new _.I(_.D,4,4047,{message:"The updated playlist does not share any segments with the previous one.",
|
|
69
|
+
uri:c});}k=yield NL(a,f,g,h);const l=nK(h.ba,a.o,e),m=JL(h,b,l);h=yield OL(a,m,h,l,k,g);a.g.debug(`Setting playlist start time to ${h}.`);return h})},HL=function(a,b,c,d,e,f,g,h){return _.v(function*(){var k=c[0];const l=yield NL(a,e,f,k);var m=g?g.ni:null;if(gJ(c[0].ba,GI)||null===m)m=kK(c,l),m=0===m.length?[gK()]:m;else{var n=kK(c,l);m=[m,...n]}n=m;m=n[n.length-1];n=hK(n);let p=g?g.oi:null;var u=PL(p,k.ba,a.o,d);let x=JL(k,b,u)||(g?g.ii:null);const y=k.ma;k=yield QL(a,y,x,k,d,u,l,f,h,null==g);u=
|
|
70
|
+
[];let A=!1;for(let F=0;F<c.length;F++){var E=c[F];const C=u[u.length-1]||null,ja=0===F?0:C.endTime,Ca=d+F,Xa=PL(p,E.ba,a.o,Ca);(p=Xa)&&(A=!0);if(E=LL(a,C,E,Ca,ja,k,Xa,e,b,y,x))x=E.initSegment,u.push(E)}return{T:u,Jh:n,ni:m,aesEncrypted:A,mimeType:l,endTime:u[u.length-1].endTime,ma:y,ii:x,oi:p}})},ML=function(a,b,c){const d=RL(a,b,c);if(!d)throw new _.I(_.D,4,4030,"Segment not found in previous playlist update.");return a.f.periods.find(e=>e.ma===d.ma).startTime+d.startTime},NL=function(a,b,c,d){return _.v(function*(){const e=
|
|
71
|
+
d.a;var f=hJ(d.ba,HI);f=f?VI(f,_.ub):null;return SL(a,b,c,e,f)})},OL=function(a,b,c,d,e,f){return _.v(function*(){if(null==c.a)return 0;const g=wJ(c,d);return pK(a.U,b,g,e,f,null!=d)})},PL=function(a,b,c,d){return b.some(e=>e.name===GI&&"NONE"===_.L(e,OI))?null:(b=nK(b,c,d))?b:a&&a.generatedIv?Object.assign({},a,{iv:_.Sl(new Uint8Array(12),bJ(d))}):a},QL=function(a,b,c,d,e,f,g,h,k,l){return _.v(function*(){if(a.C.has(b)&&l&&a.M&&null!=k){var m=a.f.periods.filter(p=>p.ma<b).map(p=>p.duration).reduce((p,
|
|
72
|
+
u)=>p+u,0);m=k-m;const n=a.C.get(b);a.C.set(b,n+m);a.M=!1}if(a.C.has(b))return a.C.get(b);m=yield OL(a,c,d,f,g,h);a.g.debug(`Segment #${e} has raw media timestamp `+`${m} s.`);a.C.set(b,m);return m})},RL=function(a,b,c){return(a=a.j.get(b))?rK(a,c)||null:null},SL=function(a,b,c,d,e){return _.v(function*(){const f=[d,e].filter(Boolean);var g=_.gp(f,b,c);if(g)return g;g=_.rk([d],a.a.attemptParameters);g.method="HEAD";g.type=2;g=(yield a.I(g)).headers["content-type"];if(!g)throw new _.I(_.D,4,4021,"Unknown MIME type of: "+
|
|
73
|
+
f.join(", "));return g.toLowerCase().split(";")[0]})},PK=a=>{a=_.Fm(a)||"";return null!=_.pu.video[a]?_.t:null!=_.pu.audio[a]?_.q:null},MJ=class{constructor(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.I(_.D,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.I(_.D,4,4043,"Media playlist must have at least one full segment!");}this.a=a;this.verbatimUri="";this.type=b;this.ba=c;this.T=1===b?d:null}},VJ=class{constructor(a,b,c){c=void 0===c?[]:c;this.ba=b;this.a=
|
|
74
|
+
a;this.f=c;this.ma=-1}},vJ=class extends _.iI{constructor(a,b,c,d,e,f,g,h,k,l,m,n,p,u,x){u=void 0===u?[]:u;super(a,b,c,d,e,f,g,void 0===h?null:h,void 0===k?!1:k,void 0===l?null:l,void 0===m?null:m,void 0===n?null:n,void 0===p?null:p,u,void 0===x?null:x);this.ma=0}},TJ=/^#EXT-X-DEFINE/,UJ=/^#(EXT-X-DISCONTINUITY-SEQUENCE|EXT-X-ENDLIST|EXT-X-I-FRAMES-ONLY|EXT-X-MEDIA-SEQUENCE|EXT-X-PART-INF|EXT-X-PLAYLIST-TYPE|EXT-X-SERVER-CONTROL|EXT-X-TARGETDURATION|EXT-X-DATERANGE|EXT-X-VERSION)/,TL=class{constructor(){this.h=
|
|
75
|
+
0;this.a=new Map}},UL=class{constructor(){this.a=new Map;this.f=new Map}set(a,b){this.f.set(a,b);return b.then(c=>this.a.set(a,c)).catch(()=>{}).then(()=>this.f.delete(a))}has(a){return this.a.has(a)}get(a){return this.a.get(a)||null}values(){return Array.from(this.a.values())}clear(){this.f.clear();this.a.clear()}},aL=new _.T("clpp.hls.DiscontinuityUtils");var mK={"com.apple.streamingkeydelivery":function(a,b){if(b===_.qg)throw new _.I(_.D,4,4041);if(VI(a,OI)===PI)throw new _.I(_.D,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.dB(_.pd,[{initDataType:_.Hf,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":fK,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":fK,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=VI(a,OI);if(!dK.includes(b))return eK.error("Widevine in HLS is only supported with [",
|
|
76
|
+
dK.join(", "),"], not",b),null;b=VI(a,_.ub);b=_.Tl(b);b=_.G(b.data);b=_.dB(_.td,[{initDataType:_.Vc,initData:b}],"");if(a=_.L(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},dK=["SAMPLE-AES",PI],eK=new _.T("clpp.hls.DrmParser");var lK=new _.T("clpp.hls.EncryptionUtils");var VL=class{constructor(a){this.g=new _.T("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.mk()}}};var sL=class{constructor(a){this.streams=a}length(){return this.streams.length}Fc(){return this.streams[0].type}};var qL=class{constructor(a){this.a=a}length(){return this.a.length}};var JK=a=>{if(!a)return null;a=hJ(a.ba,KI);if(!a)return null;a=Date.parse(a.value);return isNaN(a)?null:a};var WL=class{constructor(){this.a=this.D=null;this.h=1;this.j=new UL;this.o="";this.S=new TL;this.G=0;this.l=new _.Ii(()=>{this.dc()});this.w=_.Db;this.f=null;this.F=new _.Qt;this.B=0;this.L=null;this.g=new _.T("clpp.hls.HlsParser");this.C=new Map;this.H=this.M=!1;this.U=new VL(this.I.bind(this));this.P=!1;this.J=null;this.R=!1;this.A=new Map;this.K=new Set}configure(a){this.a=a;this.U.a=a}setCurrentVariant(){}start(a,b){const c=this;return _.v(function*(){if(c.P)throw Error("start() may be called only once!");
|
|
77
|
+
c.P=!0;c.D=b;var d=Date.now();const {response:e,text:f}=yield NK(c,a);c.D.onEvent(new _.H(TI,{detail:{duration:Date.now()-d,type:"master"}}));c.o=e.uri;d=yield YK(c,f);c.f=d;const g=c.G;c.l&&0<g&&c.l.la(g);return d})}requestStop(){this.R=!0}stop(){this.l&&(this.l.stop(),this.l=null);const a=[];this.F&&(a.push(this.F.destroy()),this.F=null);this.j.clear();this.f=this.a=this.D=null;this.A.clear();this.K.clear();return Promise.all(a)}update(){const a=this;return _.v(function*(){const b=a.f;if(!UK(a)&&
|
|
78
|
+
b){var c=b.presentationTimeline,d=Array.from(a.j.values()),e=yield $K(a,d);d=e.map(g=>g.playlist);bL(a,d);e=yield eL(a,e);yK(b.periods,e).forEach(g=>{a.D.filterNewPeriod(g)});SK(a,e);var f=fL(a,d);f=gL(a,d,f);b.cues=XK(a,f);AK(b.periods,e);MK(c,e);if(d=lJ(d))!0!==a.a.keepTimelineLive&&hL(a,c,e),a.l.stop(),a.l=null;if(a.D.onUpdate)a.D.onUpdate(b);if(d&&a.D.onTurnedStatic)a.D.onTurnedStatic();a.R&&(yield a.stop());return b}})}loadVariant(a,b){const c=this;return _.v(function*(){const d=a.id;var e=c.f.periods.find(k=>
|
|
79
|
+
k.id===b);if(e&&(e=e.variants.find(k=>k.id===d)))return e;e=c.f.alternativeVariants.find(k=>k.id===d);if(!e)throw new _.gl(`No alternative variant with id: ${d}`);var f=null,g=null;if(e.audio){const k=e.audio;f=CL(c,k.verbatimUri,()=>_.v(function*(){const l=yield zL(c,k);return AL(c,k,l)}))}if(e.video){const k=e.video;g=CL(c,k.verbatimUri,()=>_.v(function*(){const l=yield zL(c,k);return AL(c,k,l)}))}f=yield f;g=yield g;e=dL(c,f,g,e.bandwidth,e.id);let h;e&&(e=EK(c.D.configurationId,[e],[],[],0),c.D.filterAllPeriods(e),
|
|
80
|
+
e.forEach((k,l)=>{c.f.periods[l].variants.push(k.variants[0]);b===c.f.periods[l].id&&(h=k.variants[0])}));if(!h)throw new _.gl(`Could load variant with id: ${d}`);return h})}loadTextStream(a,b){const c=this;return _.v(function*(){let d;var e=c.f.periods.find(f=>f.id===b);e&&(e=e.textStreams.find(f=>f.id===a)||null)&&(d=e);if(!d&&c.f.alternativeTextStreams){const f=c.f.alternativeTextStreams.find(h=>h.id===a)||null;if(!f)throw new _.gl(`Could not load text stream with id: ${a}`);const g=yield CL(c,
|
|
81
|
+
f.verbatimUri,()=>_.v(function*(){const h=yield zL(c,f);bL(c,[h]);return AL(c,f,h)}));g&&c.f.periods.forEach((h,k)=>{h=g.streams[k];c.f.periods[k].textStreams.push(h);h.id===a&&(d=h)})}if(!d)throw new _.gl(`Could not load text stream with id: ${a}`);return d})}dc(){const a=this;return _.v(function*(){a.g.debug(_.mA);if(a.D)try{yield a.update(),a.l&&0<a.G&&a.l.la(a.G)}catch(b){if(!(b instanceof _.I))throw b;a.D&&(a.D.onError(b),1===b.severity&&a.l&&a.l.la(.1))}})}I(a){if(!this.F)throw new _.I(_.D,
|
|
82
|
+
7,7001);a=this.D.networkingEngine.fetch(a);_.vl(this.F,a);return a.V}};_.w("clpp.hls.HlsComponent",class extends _.jv{install(){_.vt.m3u8=WL;_.ut[_.kl]=WL;_.ut[SI]=WL}uninstall(){_.CC("m3u8");_.DC(_.kl);_.DC(SI)}id(){return"hls"}});};f.call(g, window);
|
package/cl.hlssmpte.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
else a.g.warn("A video element is not available. Skipping.")},
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var LT=function(a){a.a.one(a.m,_.le,()=>KT(a))},KT=function(a){const b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.nc,d=>MT(a,d));var c=Array.from(b.textTracks);c.filter(d=>d.kind===_.se).forEach(d=>{MT(a,{track:d})});!NT(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."),OT(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");
|
|
2
|
+
else a.g.warn("A video element is not available. Skipping.")},MT=function(a,b){b=b.track;b.kind===_.se&&(a.g.info("The metadata track has been added."),b.mode=_.Yd,a.a.on(b,_.wd,c=>PT(a,c)))},NT=function(a){return a.some(b=>b.kind===_.se)},OT=function(a,b){const c=a.m.getTrackManager(),d=c.ra(),e=c.getAudioTracks().find(g=>g!==d);if(e){var f=()=>c.za(d);a.a.on(b.textTracks,_.nc,g=>{g.track.kind===_.se&&(a.a.off(b.textTracks,_.nc,f),c.za(d))});c.za(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},
|
|
3
|
+
PT=function(a,b){const c=QT(a);c&&Array.from(b.target.activeCues||[]).forEach(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 RT(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.mi(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});const f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},QT=function(a){return(a=a.m.getTrackManager().ua())&&a.language&&a.language.toLowerCase()},
|
|
4
|
+
RT=class{constructor(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.z(a)){a:{var b=a.info;if(_.eh(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=a=_.eh(a)?a:null}}};var ST=class{constructor(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Bt;this.h=(a=_.lt(_.Ac))?new a(this.m.getConfiguration()):null;this.g=new _.T("clpp.hlssmpte.ImageCueHandler");this.f=null;LT(this)}destroy(){this.a.release();this.f=null;return Promise.resolve()}};var TT=class extends _.Ev{constructor(){super();this.a=null;this.f=!1}onPlayerCreated(){}onContentWillLoad(a){if(this.f=_.Vi()){var b=a.getConfiguration();b=_.Zg(b.hlssmpte||{});typeof b.patchMetadataTrack!==_.Mc&&(b.patchMetadataTrack=!1);_.fh(b.timestampOffset)||(b.timestampOffset=0);this.a=new ST(a,b.patchMetadataTrack,b.timestampOffset)}}onPlayerWillDestroy(){const a=this;return _.v(function*(){a.a&&(yield a.a.destroy(),a.a=null)})}id(){return"hlssmpte"}};_.w("clpp.hlssmpte.HlsSmptePlugin",TT);
|
|
5
|
+
TT.Id="hlssmpte";_.En(new class{create(){return new TT}});};f.call(g, window);
|