@castlabs/prestoplay 6.9.0 → 6.11.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 +66 -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 +112 -111
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +467 -432
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +72 -72
- package/cjs/cl.externs.js +143 -45
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +78 -73
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -31
- package/cjs/cl.ima.js +24 -24
- package/cjs/cl.mse.js +276 -275
- package/cjs/cl.muxdata.js +14 -15
- 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 +71 -71
- package/cjs/cl.thumbnails.js +24 -24
- package/cjs/cl.tizen.js +71 -71
- package/cjs/cl.ttml.js +29 -27
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- 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 +396 -365
- package/cl.crypto.js +9 -9
- package/cl.dash.js +68 -67
- package/cl.externs.js +139 -45
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +64 -61
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -25
- package/cl.ima.js +17 -17
- package/cl.mse.js +240 -242
- package/cl.muxdata.js +12 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +11 -11
- package/cl.playlist.js +5 -5
- package/cl.smooth.js +59 -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 +14 -14
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/clpp.styles.css +15 -0
- package/package.json +1 -1
- package/typings.d.ts +249 -21
package/cl.freewheel.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},
|
|
3
|
-
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.G.bind(a));a.g.on(a.
|
|
4
|
-
a.
|
|
5
|
-
!0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return
|
|
6
|
-
0}getSkipTimeOffset(){return 0}
|
|
7
|
-
case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}}getPodIndex(){switch(this.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
_.r||a.a.setSiteSection(b.siteSectionId);const c=yield
|
|
13
|
-
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level)
|
|
14
|
-
a.
|
|
15
|
-
9,10003,{errorType:0},void 0));this.
|
|
16
|
-
_.
|
|
17
|
-
_.
|
|
18
|
-
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.
|
|
19
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var UL="clpp-freewheel",VL="clpp.freewheel.AdsManagerFactory",WL="freewheel",XL=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""}},YL=function(a){const b=[];typeof a.networkId!==_.r&&b.push("networkId");typeof a.serverUrl!==_.Je&&b.push("serverUrl");typeof a.profileId!==_.Je&&b.push("profileId");typeof a.videoAssetId!==_.Je&&typeof a.videoAssetId!==_.r&&b.push("videoAssetId");
|
|
2
|
+
if(b.length)throw new _.H(1,9,12001,{missingKeys:b.join(", ")});},ZL=function(){return _.x(function*(){var a=new _.hr;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})},$L=function(a){a.g.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.H.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.J.bind(a));a.g.on(a.a,
|
|
3
|
+
tv.freewheel.SDK.EVENT_SLOT_ENDED,a.I.bind(a));a.g.on(a.a,tv.freewheel.SDK.EVENT_AD,a.G.bind(a));a.g.on(a.m,_.Se,a.F.bind(a));a.g.on(a.m,_.Ge,a.C.bind(a))},cM=function(a){return _.x(function*(){a.B.length?(aM(a),a.f=a.B.shift(),a.f.play()):(bM(a),yield a.m.a.play())})},bM=function(a){const b=a.m.Xb(WL).pc();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},aM=function(a){const b=a.m.Xb(WL).pc();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),a.a.registerVideoDisplayBase(UL),
|
|
4
|
+
a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},dM=function(a){a.A.length?(aM(a),a.f=a.A.shift(),a.f.play()):bM(a)},eM=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 Y(a.a,c,d)});a.m.trigger(new _.F(b,d))},fM=class extends _.rr{constructor(){super();this.f=this.a=null}onPlayerCreated(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.Xm(_.Yc,{id:UL}),this.f=_.Xm(_.w,{"class":_.Dc}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,
|
|
5
|
+
!0),a.getSurface().hide(this.a);else a.onError(new _.H(1,9,12E3))}onPlayerWillDestroy(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)}id(){return WL}pc(){return this.a}Vf(){return this.f}};_.z("clpp.freewheel.FreeWheelPlugin",fM);fM.prototype.getAdVideo=fM.prototype.Vf;fM.prototype.getAdContainer=fM.prototype.pc;fM.Id=WL;fM.AD_CONTAINER_ID=UL;_.En(new class{create(){return new fM}});var Y=class{constructor(a,b,c){this.g=a;this.f=b;this.a=c}pb(){return"FreeWheel AdManager SDK"}qb(){return tv.freewheel.SDK.version}vb(){return 0}getId(){return this.a?this.a.getAdId():""}getCreativeId(){const a=(this.a||{})._creativeId;return typeof a===_.Je?a:""}getApiFramework(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""}getAdSystem(){return""}getAdvertiserName(){return""}getTitle(){return""}getDuration(){return this.a?this.a.getActiveCreativeRendition().getDuration():
|
|
6
|
+
0}getSkipTimeOffset(){return 0}ac(){return!1}Ib(){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():""}sb(){return this.a?this.a.getActiveCreativeRendition().getWidth():0}rb(){return this.a?this.a.getActiveCreativeRendition().getHeight():0}gb(){return 0}Ta(){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.Ta()){case 0:return 0;case 2:return-1}return this.g.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1}Jb(){switch(this.Ta()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}}Kb(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1}ub(){return this.f.getAdCount()}getWrapperAdIds(){return[]}getWrapperAdSystems(){return[]}getWrapperCreativeIds(){return[]}};
|
|
8
|
+
Y.prototype.getWrapperCreativeIds=Y.prototype.getWrapperCreativeIds;Y.prototype.getWrapperAdSystems=Y.prototype.getWrapperAdSystems;Y.prototype.getWrapperAdIds=Y.prototype.getWrapperAdIds;Y.prototype.getSequenceLength=Y.prototype.ub;Y.prototype.getPositionInSequence=Y.prototype.Kb;Y.prototype.getPodTimeOffset=Y.prototype.Jb;Y.prototype.getPodIndex=Y.prototype.getPodIndex;Y.prototype.getPodType=Y.prototype.Ta;Y.prototype.getMediaBitrate=Y.prototype.gb;Y.prototype.getMediaHeight=Y.prototype.rb;
|
|
9
|
+
Y.prototype.getMediaWidth=Y.prototype.sb;Y.prototype.getMediaUrl=Y.prototype.getMediaUrl;Y.prototype.getClickThroughUrl=Y.prototype.Ib;Y.prototype.isBumper=Y.prototype.ac;Y.prototype.getSkipTimeOffset=Y.prototype.getSkipTimeOffset;Y.prototype.getDuration=Y.prototype.getDuration;Y.prototype.getTitle=Y.prototype.getTitle;Y.prototype.getAdvertiserName=Y.prototype.getAdvertiserName;Y.prototype.getAdSystem=Y.prototype.getAdSystem;Y.prototype.getApiFramework=Y.prototype.getApiFramework;
|
|
10
|
+
Y.prototype.getCreativeId=Y.prototype.getCreativeId;Y.prototype.getId=Y.prototype.getId;Y.prototype.getTechnology=Y.prototype.vb;Y.prototype.getAdManagerVersion=Y.prototype.qb;Y.prototype.getAdManagerName=Y.prototype.pb;var gM=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()}})}Lb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length}hb(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length}};
|
|
11
|
+
gM.prototype.hasPostroll=gM.prototype.hb;gM.prototype.hasPreroll=gM.prototype.Lb;gM.prototype.getCuePoints=gM.prototype.getCuePoints;var hM=class{constructor(a){this.h=new _.R("clpp.freewheel.AdsManager");this.m=a;this.g=new _.vp;this.w=new tv.freewheel.SDK.AdManager;this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.Jl;this.j=null}load(){const a=this;return _.x(function*(){const b=a.m.getConfiguration().freewheel||{};try{YL(b)}catch(d){return a.m.onError(d),a.l.resolve(),a.l}a.w.setNetwork(b.networkId);a.w.setServer(b.serverUrl);a.a=a.w.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.Je&&typeof b.siteSectionId!==
|
|
12
|
+
_.r||a.a.setSiteSection(b.siteSectionId);const c=yield ZL();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,XL(d.type),d.position,d.slotProfile,d.cuepointSequence,d.maxDuration,d.minDuration,d.acceptContentType);b.keyValues&&typeof b.keyValues===_.Od&&Object.keys(b.keyValues).forEach(d=>a.a.addKeyValue(d,b.keyValues[d]));a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);
|
|
13
|
+
if(Array.isArray(b.parameters))for(const d of b.parameters)a.a.setParameter(d.name,d.value,d.level);$L(a);a.a.submitRequest();return a.l})}start(){const a=this;return _.x(function*(){yield cM(a)})}resume(){this.f&&this.f.resume()}pause(){this.f&&this.f.pause()}skip(){this.f&&this.f.skipCurrentAd()}getVolume(){return this.a?this.a.getAdVolume():1}setVolume(a){this.a&&this.a.setAdVolume(a)}getPosition(){return this.f?this.f.getPlayheadTime():-1}dispose(){const a=this;return _.x(function*(){a.g.release();
|
|
14
|
+
a.j&&(a.j.stop(),a.j=null);bM(a);a.a&&(a.a.dispose(),a.a=null)})}H(a){if(a.success)this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.o=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.F(_.Vb,{adsTimeline:new gM(this.a)})),this.j=new _.fr(this.m.getSurface(),(b,c)=>this.a.resize(b,c),this.m.Xb(WL).f);else this.m.onError(new _.H(1,
|
|
15
|
+
9,10003,{errorType:0},void 0));this.l.resolve()}J(a){eM(this,_.Cb,a);this.j.start()}I(a){this.f=null;a=a.slot;eM(this,_.Db);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:cM(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:bM(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:dM(this)}}G(a){const b=a.subType;this.h.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:eM(this,_.Pb,a);eM(this,
|
|
16
|
+
_.Ib,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:eM(this,_.Qb,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:eM(this,_.Hb,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:eM(this,_.Kb,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:eM(this,_.Rb,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:eM(this,_.Gb,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:eM(this,_.Fb,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:eM(this,_.Lb,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:eM(this,
|
|
17
|
+
_.Nb,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:eM(this,_.Ob,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:eM(this,_.Eb,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:eM(this,_.Mb,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.H(1,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]}))}}F(){if(!this.f){var a=this.m.getPosition();if(this.f=this.o.find(b=>
|
|
18
|
+
.5>Math.abs(a-b.getTimePosition()))||null){const b=this.o.findIndex(c=>c===this.f);this.o.splice(b,1);this.m.pause();aM(this);this.f.play()}}}C(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Dm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Cm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.sm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);dM(this);break;case _.Am:case _.zm:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}}};
|
|
19
|
+
hM.prototype.getPosition=hM.prototype.getPosition;hM.prototype.setVolume=hM.prototype.setVolume;hM.prototype.getVolume=hM.prototype.getVolume;hM.prototype.skip=hM.prototype.skip;hM.prototype.pause=hM.prototype.pause;hM.prototype.resume=hM.prototype.resume;hM.prototype.start=hM.prototype.start;var iM=class{constructor(){this.a=new _.R(VL)}name(){return VL}da(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)}create(a){return new hM(a)}};iM.prototype.create=iM.prototype.create;iM.prototype.isSupported=iM.prototype.da;iM.prototype.name=iM.prototype.name;_.Um(new iM);};f.call(g, window);
|
package/cl.hls.js
CHANGED
|
@@ -1,61 +1,64 @@
|
|
|
1
|
-
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var
|
|
2
|
-
|
|
3
|
-
4,4024,{missingTag:b});return a},
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
null}},
|
|
7
|
-
0,0,()=>[a.a],c.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"SAMPLE-AES"===e)&&!b.every(e=>e===
|
|
19
|
-
|
|
20
|
-
e.uris[0]);try{return yield a.
|
|
21
|
-
|
|
22
|
-
b){a.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
b=
|
|
33
|
-
|
|
34
|
-
new _.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
b,c,d,
|
|
41
|
-
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
m
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
b){
|
|
61
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var pB="CLOSED-CAPTIONS",qB="Could not parse MP4 segment start time.",rB="EXT-X-BYTERANGE",sB="EXT-X-DISCONTINUITY",tB="EXT-X-DISCONTINUITY-SEQUENCE",uB="EXT-X-ENDLIST",vB="EXT-X-KEY",wB="EXT-X-MAP",xB="EXT-X-MEDIA-SEQUENCE",yB="EXT-X-PART-INF",zB="EXT-X-PLAYLIST-TYPE",AB="EXT-X-PRELOAD-HINT",BB="EXT-X-PROGRAM-DATE-TIME",CB="EXT-X-SERVER-CONTROL",DB="EXT-X-STREAM-INF",EB="EXT-X-TARGETDURATION",FB="Failed to infer discontinuity number",GB="Guessing audio-only",HB="METHOD",IB="SAMPLE-AES-CTR",
|
|
2
|
+
JB="SUBTITLES",KB="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",LB="application/vnd.apple.mpegurl",MB="sample",NB="whole-segment",OB=function(a,b){return _.I(a,b,void 0,{required:!0})},PB=function(a){if(1>a.a)throw _.dk();--a.a},QB=function(a){if(null!==a&&void 0!==a)return Number(a)},RB=function(a,b){return a.filter(c=>c.name===b)},SB=function(a,b){const c=Array.isArray(b)?b:[b];return a.filter(d=>{d=OB(d,_.pb);return c.includes(d)})},TB=function(a,b){return a.some(c=>c.name===
|
|
3
|
+
b)},UB=function(a,b,c){c=void 0===c?{}:c;a=a.find(d=>d.name===b)||null;if(!a&&c.required)throw new _.H(_.G,4,4024,{missingTag:b});return a},VB=function(a){var b=UB(a,"EXT-X-TILES");if(!b)return{Ne:1,mf:1,durationPerTile:null};a=_.I(b,"LAYOUT")||"1x1";b=(b=_.I(b,"DURATION"))?Number(b):null;const [c,d]=a.split("x").map(e=>parseInt(e,10));return{Ne:c,mf:d,durationPerTile:b}},WB=function(a,b){return _.Rv([a],[b])[0]},XB=function(a){const b=new Set;a.variants.forEach(c=>{c.audio&&b.add(c.audio);c.video&&
|
|
4
|
+
b.add(c.video)});a.textStreams.forEach(c=>b.add(c));a.thumbStreams.forEach(c=>b.add(c));return Array.from(b)},YB=function(a,b){Array.isArray(a)||(a=[a]);a.forEach(c=>{for(const d of XB(c))b(d,c)})},ZB=function(a){return a.some(b=>TB(b.$,uB))},$B=function(a){return a.type===_.p||a.type===_.w},aC=function(a){const b=UB(a,zB);if(UB(a,uB))return _.jv;if(!b)return"LIVE";if(b.value===_.jv)return _.jv;if("EVENT"===b.value)return"EVENT";throw new _.H(_.G,4,4044,`Invalid EXT-X-PLAYLIST-TYPE value: ${b.value}`);
|
|
5
|
+
},bC=function(a){a={AUDIO:_.p,VIDEO:_.w,SUBTITLES:_.t,"CLOSED-CAPTIONS":_.t}[a.toUpperCase()];if(!a)throw new _.H(_.G,4,4044,"EXT-X-MEDIA tag has an invalid TYPE attribute.");return a},cC=function(a,b,c){c=void 0===c?!1:c;var d=0;let e=null;if(a){d=a.split("@");a=Number(d[0]);if(0>=a)throw new _.H(_.G,4,4044,"Byte range length must be positive.");if(d[1]){if(d=Number(d[1]),0>d)throw new _.H(_.G,4,4044,"Byte range start byte must not be negative.");}else{if(c)throw new _.H(_.G,4,4044,"Invalid byte range, offset is required but missing.");
|
|
6
|
+
if(null==b)throw new _.H(_.G,4,4044,"Invalid byte range, cannot calculate offset based on previous byte ranges.");d=b+1}e=d+a-1}return{ta:d,ha:e}},dC=function(a,b){a=UB(a,rB);return cC(a?a.value:null,b)},eC=function(a){a=UB(a,"EXTINF",{required:!0}).value.split(",");return{duration:Number(a[0]),title:a[1]||null}},fC=function(a,b){b=void 0===b?{}:b;const c={Wc:!1,Gf:!1,Hf:null,fg:null,Ze:null};a=UB(a,CB,{required:b.cf});if(!a)return c;const d=e=>null==e?null:Number(e);c.Wc="YES"===_.I(a,"CAN-BLOCK-RELOAD");
|
|
7
|
+
c.Gf="YES"===_.I(a,"CAN-SKIP-DATERANGES");c.Hf=d(_.I(a,"CAN-SKIP-UNTIL"));c.fg=d(_.I(a,"HOLD-BACK"));c.Ze=d(_.I(a,"PART-HOLD-BACK",void 0,{required:b.cf}));return c},gC=function(a,b,c){c=void 0===c?!1:c;a=_.I(a,"BYTERANGE");return cC(a,b,c)},iC=function(a,b){const c=dC(a.$,null);return new hC(0,0,0,()=>[a.a],c.ta,c.ha,0,b)},jC=function(a,b){if(null==a)return null;a=Object.assign({},a);null==a.iv&&(a.iv=_.Ah(new Uint8Array(12),new Uint8Array([b>>24&255,b>>16&255,b>>8&255,b&255])));return a},kC=function(a){let b=
|
|
8
|
+
Infinity,c=Infinity;XB(a).filter($B).forEach(d=>{{d=d.T;var e=d[0].startTime;const f=d[d.length-1].endTime;d=e;e=f-e}b=Math.min(b,d);c=Math.min(c,e)});return{uc:b,duration:c}},lC=function(a){return a.map(b=>{({duration:b}=kC(b));return b}).reduce((b,c)=>b+c,0)},mC=function(a){return(a.video?a.video.wa:"")+" - "+(a.audio?a.audio.wa:"")},nC=function(a,b,c){if(b===_.jv)return{delay:0,Sc:0};b=UB(a,yB);if(c&&b)return c=Number(OB(b,"PART-TARGET")),{Ze:a}=fC(a,{cf:!0}),{delay:a,Sc:c};a=UB(a,EB,{required:!0});
|
|
9
|
+
a=Number(a.value);return{delay:3*a,Sc:a}},oC=function(a){const b=[];YB(a,c=>{b.push(c.lg)});return{delay:Math.max(...b.map(c=>c.delay)),Sc:Math.min(...b.map(c=>c.Sc))}},qC=function(a){const b=new Map;a.forEach(c=>{var d=pC(c).groupId;b.has(d)?(d=b.get(d),d.includes(c)||d.push(c)):b.set(d,[c])});return b},rC=function(a){const b=new Map;for(const c of a){a=_.I(c,_.Ha);a=_.Sg(a||_.Ve);const d=OB(c,_.Ba),e=OB(c,"INSTREAM-ID");b.has(d)||b.set(d,new Map);b.get(d).set(e,a)}return b},tC=function(a){a=a.audio.concat(a.video);
|
|
10
|
+
for(const b of a)a=pC(b).codecs.split(",").filter(c=>"mp4a.40.34"!==c),sC(b,a)},uC=function(a,b){if(!a)return null;const c=a.wa;return b.find(d=>pC(d).wa===c)||null},yC=function(a,b,c){const d=[],e=[];let f=[],g=[];c.forEach(h=>{/^(#EXT)/.test(h)?(h=_.Fh(a.a++,h),vC.includes(h.name)?d.push(h):wC.includes(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===AB&&"PART"===_.I(h,_.pb)&&g.push(h):f.push(h)):/^#(?!EXT)/m.test(h)||(h=WB(b,h.trim()),e.push(new xC(h,f,g)),f=[],g=[])});0<g.length&&e.push(new xC(null,
|
|
11
|
+
f,g));return{T:e,$:d}},zC=function(a){return 0>a?[]:Array.from({length:a},(b,c)=>c)},AC=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},BC=function(a){function b(h,k,l){let m="";for(;k<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 _.H(_.G,4,4030);}AC(a)||d();let e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=
|
|
12
|
+
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|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}AC(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},CC=function(a,b){let c=null,d=0;try{(new _.tk).L(_.Jd,_.mk).L(_.Te,_.mk).L(_.Ed,_.mk).Z("mdhd",
|
|
13
|
+
g=>{g.reader.skip(0==g.version?8:16);d=_.P(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.ir.error("Unable to find timescale in init segment!"),new _.H(_.G,4,4030,qB,c);let e=0,f=!1;try{(new _.tk).L("moof",_.mk).L("traf",_.mk).Z("tfdt",g=>{var h=d;if(0===g.version)h=_.P(g.reader)/h;else{{const k=_.P(g.reader),l=_.P(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,
|
|
14
|
+
32)+l/h}}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.H(_.G,4,4030,qB,c);return e},DC=function(a){for(;a.getPosition()<a.Ba()-1;){const b=a.getPosition();if(71===_.ek(a))return PB(a),b}return-1},EC=function(a){function b(){d.seek(e+188);f=_.ek(d);71!=f&&(d.seek(e+192),f=_.ek(d));71!=f&&(d.seek(e+204),f=_.ek(d));71!=f&&c();PB(d)}function c(){throw new _.H(_.G,4,4030);}const d=new _.gl(new DataView(a),!1);let e=0,f=0;e=DC(d);0>e&&(_.ir.error("Unable to find sync byte in TS after scanning."),
|
|
15
|
+
c());for(;;){e=d.getPosition();f=_.ek(d);71!=f&&c();a=_.fk(d);if(8191===(a&8191)){b();continue}if(!(a&16384)){b();continue}a=(_.ek(d)&48)>>4;0!=a&&2!=a||c();3==a&&(a=_.ek(d),d.skip(a));if(1!=_.P(d)>>8){b();continue}d.skip(3);a=_.ek(d)>>6;0!=a&&1!=a||c();0==_.ek(d)&&c();a=_.ek(d);const g=_.fk(d),h=_.fk(d);return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}},HC=function(a){const b=FC(a),c=GC(a);a.forEach(d=>{const e=d.T,f=e.findIndex(h=>h.ea===b);let g=e.findIndex(h=>h.ea===c+1);-1===g&&
|
|
16
|
+
(g=e.length);d.T=e.slice(f,g)})},GC=function(a){a=a.map(b=>b.T[b.T.length-1].ea);return Math.min(...a)},FC=function(a){a=a.map(b=>b.T[0].ea);return Math.max(...a)},KC=function(a){var b=OB(a,HB);if(!IC.includes(b))return JC.error("PlayReady in HLS is only supported with [",IC.join(", "),"], not",b),null;a=OB(a,_.rb);b=_.hp(a);a=null;b=_.J(b.data);try{a=_.Hv(_.nl(b))}catch(c){a=b}return _.Sv(_.Qc,[{initDataType:_.yc,initData:a}],"")},MC=function(a){if(0===a.length)return LC();if(a.some(c=>c.type===
|
|
17
|
+
NB)||a.every(c=>c.type===_.Nd))return a[0];a=a.filter(c=>c.type===MB);const b=_.yg(a.flatMap(c=>c.drmInfos));return{keyInfo:null,keyId:a[a.length-1].keyId,type:MB,drmInfos:b}},PC=function(a){a=NC(a);if(a.some(b=>OC(b))&&1<a.length)throw new _.H(_.G,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},OC=function(a){return RB(a.$,vB).some(b=>"AES-128"===_.I(b,HB))},RC=function(a,b,c){return NC(a).map(d=>QC(d.$,b,c))},SC=function(a){return a.filter(b=>TB(b.$,vB)).length},
|
|
18
|
+
NC=function(a){return a.filter(b=>TB(b.$,vB))},QC=function(a,b,c){a=RB(a,vB);if(0===a.length)return null;var d=OB(a[0],HB);if(1===a.length){if("NONE"===d)return LC();if("AES-128"===d)return a=a[0],d=_.I(a,"IV",""),{type:NB,keyInfo:{method:"AES-128",url:WB(b,OB(a,_.rb)),iv:d?_.xh((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(e=>OB(e,HB));if(!b.every(e=>"SAMPLE-AES"===e)&&!b.every(e=>e===IB))throw TC.warn(`EXT-X-KEY methods ${b.join(", ")} are incompatible.`),new _.H(_.G,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");
|
|
19
|
+
b=a.map(e=>{const f=_.I(e,"KEYFORMAT","identity");{const g=UC[f]||null;e=g?g(e,c):null}e||TC.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.H(_.G,4,4026);return{keyInfo:null,keyId:b.map(e=>e.keyIds).reduce((e,f)=>e.concat(f),[]).reverse()[0]||null,type:MB,drmInfos:b}},LC=function(){return{type:_.Nd,keyInfo:null,drmInfos:[],keyId:null}},VC=function(a,b,c){return _.x(function*(){const d=b.f(),e=_.uw(b.Ja(),b.ta,b.ta+2048-1,a.a.attemptParameters);e.type=2;
|
|
20
|
+
const f=_.uw(b.Ja(),b.ta,b.ha,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.h.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS pre-flights.",e.uris[0]);try{return yield a.f(f)}catch(h){throw a.h.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],h),new _.H(_.G,4,4030,"Failed to fetch the media segment.");
|
|
21
|
+
}}})},WC=function(a,b,c,d,e,f){return _.x(function*(){a.h.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.ic||d===_.hc)return 0;if(d===_.gc){var g=yield VC(a,c,f);const h=_.J(g.data);return AC(h)?BC(h):EC(g.data)}if(d===_.ff||d===_.jc)return g=[VC(a,c,f)],b&&g.push(VC(a,b,!0)),g=yield Promise.all(g),CC(g[0].data,(g[1]||g[0]).data);if(d===_.ef)return g=yield VC(a,c,f),EC(g.data);if(!_.aw(`${d.split("/")[0]||""}/mp4;codecs="${e}"`))return 0;throw new _.H(_.G,4,4030);})},XC=function(a,
|
|
22
|
+
b){a=a.map(c=>c.streams[b]);return a.some(c=>null==c)?null:a},sC=function(a,b){a.streams.forEach(c=>{c.codecs=b.join(",")})},YC=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},pC=function(a){return a.streams[0]},ZC=function(a,b){a.streams.forEach(c=>{c.ud=b})},$C=function(a,b){a.streams.forEach(c=>{c.width=b})},aD=function(a,b){a.streams.forEach(c=>{c.height=b})},bD=function(a,b){a.streams.forEach(c=>
|
|
23
|
+
{c.frameRate=b})},cD=function(a,b){a.streams.forEach(c=>{c.bandwidth=b})},dD=function(a,b){a=a.map(c=>c.a[b]);return a.some(c=>null==c)?null:a},eD=function(a,b){const c=new Set(a.map(d=>d.ea));return b.filter(d=>!c.has(d.ea))},hD=function(a,b){for(;a[0].ea<b[0].ea;)a.splice(0,1);var c=a[0];let d=b[0];fD(c,d)||gD(c,d);const e=a.length-1;c=a[e];d=b[e];0<e&&!fD(c,d)&&gD(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},iD=function(a,b){const c=a[a.length-1];var d=b.findIndex(f=>f.ea===c.ea);const e=b[d];
|
|
24
|
+
fD(c,e)||gD(c,e);for(d+=1;d<b.length;d++)a.push(b[d])},nD=function(a,b,c,d){var e=a[0].length();e=zC(e).map(f=>{var g=dD(a,f)||[];const h=XC(b,f)||[];{f=XC(c,f)||[];const k=[...jD(g),...h,...f].filter(Boolean);kD(k);const {ea:l,duration:m}=k[0];g={variants:g,textStreams:h,thumbStreams:f,startTime:0,id:`P${l}`,endTime:m,duration:m,ea:l}}return g});d&&lD(e[0]);mD(e);return e},jD=function(a){a=new Set(a.flatMap(b=>[b.video,b.audio]).filter(Boolean));return Array.from(a)},lD=function(a){const b=jD(a.variants)[0].T[0].ya;
|
|
25
|
+
a.startTime+=b;a.endTime+=b},mD=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}},fD=function(a,b){return a.startTime===b.startTime&&a.endTime===b.endTime},gD=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=b.duration;oD(a.variants,b.variants);pD(XB(a),XB(b))},oD=function(a,b){const c=new Map(a.map(d=>[mC(d),d]));b.forEach(d=>{c.get(mC(d)).drmInfos=d.drmInfos})},pD=function(a,b){const c=new Map(a.map(d=>
|
|
26
|
+
[d.wa,d]));b.forEach(d=>{const e=c.get(d.wa);e.T=d.T;e.segmentIndex.replace(d.T);e.uc=d.uc;e.Sd=d.Sd;e.duration=d.duration;e.Fe=d.Fe;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=d.keyId})},kD=function(a){const b=qD(a);a.forEach(c=>{_.qw(c.segmentIndex,b);c.duration=b;c.Sd=c.uc+b})},qD=function(a){let b=Infinity;a.filter($B).forEach(c=>{b=Math.min(b,c.duration)});return b},rD=function(a,b){YB(b,(c,d)=>{_.xw(a,c.T,d.startTime)})},sD=function(a){return null===a.g?[]:[a.g.audio,a.g.video].filter(b=>
|
|
27
|
+
b).map(b=>b.wa)},tD=function(a,b){return _.x(function*(){var c=_.Kh([b],a.a.attemptParameters);c.type=1;c=yield a.C(c);let d="";try{d=_.gh(c.data)}catch(e){throw new _.H(_.G,4,4042);}d=d.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n");d=d.trim();return{text:d,response:c}})},yD=function(a,b){return _.x(function*(){var c=uD(a,b,a.o,"");if(1===c.type){c=_.Rp(c.T[0].a)||"";c=null!=_.Qp.video[c]?_.w:null!=_.Qp.audio[c]?_.p:null;var d="";c===_.w?d="avc1.42E01E":c===_.p&&(d="mp4a.40.2");{c=a.J;var e=a.o;d=a.a.hlsDefaultCodecs||
|
|
28
|
+
d;var f=[];const m=[];m.push(new _.Dh(_.ja,"0"));m.push(new _.Dh(_.rb,e));d.length&&m.push(new _.Dh(_.la,d));f.push(new _.Eh(c.a++,DB,m));c=new vD(e,0,f)}}d=c.$;c=RB(d,"EXT-X-MEDIA");e=RB(d,DB);d=RB(d,"EXT-X-IMAGE-STREAM-INF");c={tc:{Bf:SB(c,["AUDIO",_.yb]),closedCaptions:SB(c,pB),Lg:SB(c,JB)},Tc:e,Ld:d};const {periods:g,yg:h}=yield wD(a,c);if(!a.D)throw new _.H(_.G,7,7001);c=oC(g[0]);e=!0;d=null;f=0;xD(a)||(e=!1,d=0,f=c.delay);d=f=new _.fB(d,f,!0);d.j=e;d.l=e;rD(f,g);h&&(f.H={offsetDateTime:h-_.Cw(f,
|
|
29
|
+
0),seekRangeStartDateTime:h});e=f;if(!xD(a)){a.G=c.Sc;c=0;for(var k of a.f.values())c=Math.max(c,k.streams[0].uc);for(k=0;95443.7176888889<=c;)k+=95443.7176888889,c-=95443.7176888889;if(k){a.h.debug("Offsetting live streams by",k,"to compensate for rollover");for(var l of a.f.values())c=l.streams[0],95443.7176888889>c.uc?(a.h.debug("Offset applied to",c.type),c.segmentIndex.offset(k)):a.h.debug("Offset NOT applied to",c.type)}}l=lC(g);"LIVE"===a.l||"EVENT"===a.l?(l=Math.max(l,e.F),isNaN(a.a.availabilityWindowOverride)||
|
|
30
|
+
(l=a.a.availabilityWindowOverride),e.w=l):a.l===_.jv&&(e.f=l);l={presentationTimeline:e,adaptedPeriods:[...g],periods:g,offlineSessionIds:[],minBufferTime:0};a.h.debug("HLS playlist parsed",l);return l})},AD=function(a,b){return Promise.all(b.map(c=>zD(a,c)))},CD=function(a,b){b.forEach(c=>{a:{var d=a.f.get(c.a),e=!xD(a),f=UB(c.$,tB);if(f)var g=Number(f.value);else{d?(f=d.streams[d.streams.length-1].T,f=f[f.length-1].ea):f=0;if(e&&0<f)try{{const k=UB(c.$,xB);if(!k)throw BD.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),
|
|
31
|
+
Error(FB);const l=Number(k.value),m=YC(d,l);if(!m)throw BD.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist"+` (segment position = ${l})`),Error(FB);var h=m.ea}g=h;break a}catch(k){throw new _.H(_.G,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");}g=0}}c=c.T||[];for(const k of c)TB(k.$,sB)&&g++,k.ea=g});HC(b)},FD=function(a,b){return _.x(function*(){const {textStreams:c,thumbStreams:d,Cf:e}=yield DD(a,
|
|
32
|
+
b);var f=a.w.periods[0].variants;a.a.hlsLowLatency&&null!==a.g&&(f=f.filter(g=>g.id===a.g.id));f=f.map(g=>{const h=uC(g.audio,e),k=uC(g.video,e);g=ED(a,h,k,g.bandwidth);if(!g)throw new _.H(_.G,4,4047,{message:"Video and audio are encrypted in an incompatible way.",mh:k?pC(k).wa:void 0,audio:h?pC(h).wa:void 0});return g});return nD(f,c,d,!0)})},HD=function(a,b,c){GD(a,_.jv);b.j=!0;b.l=!0;b.f=c[c.length-1].endTime},GD=function(a,b){a.l=b;xD(a)&&a.j.stop()},uD=function(a,b,c,d){a:{a=a.J;b=b.trim().split(/\n+/m);
|
|
33
|
+
if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.H(_.G,4,4015);var e=b,f=0,g=!0;for(h of e){var h=h.trim();if(!h.length||/^#(?!EXT)/m.test(h)||g)g=!1;else if(e=_.Fh(0,h),vC.includes(e.name)){f=1;break}else e.name===DB&&(g=!0)}h=f;f=[];g=!0;for(var k of _.Wv(b)){let {Kd:l,item:m,next:n}=k;m=m.trim();if(!m.length||/^#(?!EXT)/m.test(m)||g)g=!1;else{e=m;e=_.Fh(a.a++,e);if(ID.includes(e.name)){if(1!==h)throw new _.H(_.G,4,4017);k=b.splice(l,b.length-l);a=yC(a,c,k);c=new vD(c,h,f.concat(a.$),a.T);break a}f.push(e);
|
|
34
|
+
e.name===DB&&(e.attributes.push(new _.Dh(_.rb,n)),g=!0)}}c=new vD(c,h,f)}c.a=d;JD(c);return c},wD=function(a,b){return _.x(function*(){var c=rC(b.tc.closedCaptions),d=KD(a,b.Tc),e=yield LD(a,b),f=Object.values(e).flat().map(g=>g.Da);CD(a,f);f=yield MD(a,e.xe,d);c=yield ND(a,e.Tc,f,c);d=yield OD(a,e.Kg,d);f=yield PD(a,e.Ld);e=QD(a,e);d=nD(c,d,f,!xD(a));a.D.filterAllPeriods(d);return{periods:d,yg:e}})},DD=function(a,b){return _.x(function*(){const c=g=>pC(g.stream).type===_.w||pC(g.stream).type===_.p;
|
|
35
|
+
var d=b.filter(c),e=b.filter(g=>!c(g)),f=g=>{g=g.map(h=>{var k=pC(h.stream);k={language:k.language,channelsCount:k.channelsCount,closedCaptions:k.closedCaptions,primary:k.primary,kind:k.kind||null,groupId:k.groupId,type:k.type,codecs:k.codecs,name:k.originalId,uri:k.wa,sd:{width:k.width,height:k.height,frameRate:k.frameRate}};h=Object.assign({},{Da:h.Da},k);return RD(a,h)});return Promise.all(g)};d=yield f(d);f=yield f(e);SD(a,d.concat(f));e=f.filter(g=>pC(g).type===_.Cv);f=f.filter(g=>pC(g).type===
|
|
36
|
+
_.sd);return{textStreams:e,thumbStreams:f,Cf:d}})},ED=function(a,b,c,d){const e=[],f=(c||b).length();for(let m=0;m<f;m++){var g=b?b.streams[m]||null:null,h=c?c.streams[m]||null:null,k=g,l=h;k=k&&l?_.Zv(k.drmInfos,l.drmInfos)?_.Yv(k.drmInfos,l.drmInfos):null:k?k.drmInfos:l?l.drmInfos:null;if(!k)return null;l=d;g={id:a.H++,language:g?g.language:_.Ve,primary:!!g&&g.primary||!!h&&h.primary,audio:g,video:h,bandwidth:l,drmInfos:k,allowedByApplication:!0,allowedByKeySystem:!0};e.push(g)}return new TD(e)},
|
|
37
|
+
RD=function(a,b){return _.x(function*(){const c=b.Da,d=b.codecs,e=b.type,f=b.Jc,g=b.groupId,h=b.primary;var k=b.kind;const l=b.name,m=b.channelsCount,n=b.closedCaptions,q=b.sd,u=_.Sg(f||_.Ve);if(1!==c.type)throw new _.H(_.G,4,4017);var v=aC(c.$);GD(a,v);const y=nC(c.$,v,a.a.hlsLowLatency||!1);v=yield UD(a,c,e,d);const A=a.a.hlsLowLatency?_.ez:_.rv;let D=k;e!==_.t||k||(D=_.Cv);const {Wc:E}=fC(c.$);k=v.map(N=>{const sb=N.T,Sb=N.Mf,Jf=N.mimeType;N=N.ea;const Me=sb[0].startTime,Sa=sb[sb.length-1].endTime,
|
|
38
|
+
Ne=Sa-Me,db=new _.gB(sb),sa=sb[0].initSegment||null;return{id:a.H++,originalId:l,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:db.f.bind(db),getSegmentReference:db.get.bind(db),adjustSegmentDurations:db.g.bind(db),getDuration:db.getDuration.bind(db),segmentIndex:db,segmentLookupStrategy:A,initSegmentReference:sa,mimeType:Jf,codecs:d,kind:D,Fe:Sb.type,encrypted:Sb.type===MB,keyId:Sb.keyId,language:u,originalLanguage:f||_.Ve,label:l,type:e,primary:h,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
39
|
+
frameRate:q?q.frameRate:void 0,width:q?q.width:void 0,height:q?q.height:void 0,bandwidth:void 0,roles:[],channelsCount:m,closedCaptions:n,keyInfo:Sb.keyInfo,T:sb,drmInfos:Sb.drmInfos,ea:N,wa:c.a,ud:c.f,uc:Me,Sd:Sa,duration:Ne,Wc:E,groupId:g,lg:y}});return new VD(k)})},SD=function(a,b){b.forEach(c=>{a.f.a.set(pC(c).wa,c)})},KD=function(a,b){const c=new Map;for(const f of b){var d=_.I(f,"AUDIO");b=_.I(f,_.yb);var e=_.I(f,JB);const g=WD(a,f);if(e){const h=_.oi(_.t,g);c.set(e,h);e=g.indexOf(h);-1<e&&
|
|
40
|
+
g.splice(e,1)}d&&(e=XD(_.p,g),c.set(d,e));b&&(d=XD(_.w,g),c.set(b,d))}return c},LD=function(a,b){return _.x(function*(){const c=yield Promise.all([YD(a,b.tc.Bf),YD(a,b.tc.Lg),YD(a,b.Tc),YD(a,b.Ld)]),[d,e,f,g]=c;return{xe:d,Kg:e,Tc:f,Ld:g}})},MD=function(a,b,c){return _.x(function*(){if(0===b.length)return new Map;var d=[ZD(a,b[0],c)];yield d[0];d=d.concat(b.slice(1).map(e=>ZD(a,e,c)));d=yield Promise.all(d);return qC(d)})},ND=function(a,b,c,d){return _.x(function*(){const e=new Set;var f=[...b];let g=
|
|
41
|
+
0;var h=Infinity;for(let k=0;k<f.length;++k){const l=Number(OB(f[k].tag,_.ja));l<h&&(h=l,g=k)}h=f.splice(g,1).pop();h=yield $D(a,h,c,d,e);f=f.map(k=>$D(a,k,c,d,e));f=yield Promise.all(f);f.splice(g,0,h);return f.reduce(_.Pv,[])})},OD=function(a,b,c){return Promise.all(b.map(d=>ZD(a,d,c)))},PD=function(a,b){return Promise.all(b.map(c=>aE(a,c)))},QD=function(a,b){if(xD(a))return null;b=[...b.Tc,...b.xe].map(d=>d.Da).flatMap(d=>d.T[0].$);b=UB(b,BB);if(!b)return null;const c=(new Date(b.value)).getTime();
|
|
42
|
+
return isNaN(c)?(a.h.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag "+`value (value: ${b.value}).`),null):c/1E3},xD=function(a){return a.l===_.jv},YD=function(a,b){return _.x(function*(){return(yield Promise.all(b.map(c=>_.x(function*(){const d=yield bE(a,c);return d?{tag:c,Da:d}:null})))).filter(Boolean)})},zD=function(a,b){return _.x(function*(){var c=new _.Gg(pC(b).ud);if(a.a.hlsLowLatency&&pC(b).Wc){var d=b.streams[b.streams.length-1].segmentIndex;if(d=d.a[d.a.length-1]){var e=d.a,f=e.length-
|
|
43
|
+
1;d={mg:d.position,sg:e&&0<e.length?f:null}}else d=null;if(e=d)d=e.mg,e=e.sg,f=_.ci(c.a.toString()),f._HLS_msn=d.toString(),null===e&&f._HLS_part&&delete f._HLS_part,null!==e&&(f._HLS_part=e.toString()),d=_.bi(f,!0),d=new _.Ng(d),_.Jg(c,d)}const {response:g,text:h}=yield tD(a,c.toString());c=pC(b).wa;d=pC(b).ud;e=g.uri;d!==e&&(d=e,ZC(b,d));c=uD(a,h,d,c);return{stream:b,Da:c}})},WD=function(a,b){var c=_.I(b,_.la,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);b=new Set;const d=[];for(const e of c)c=
|
|
44
|
+
_.gw(e)[0],b.has(c)?a.h.debug("Ignoring duplicate codec"):(d.push(e),b.add(c));return d},XD=function(a,b){if(1===b.length)return b[0];a=_.oi(a,b);if(null!=a)return a;throw new _.H(_.G,4,4025,{codecList:b});},ZD=function(a,b,c){return _.x(function*(){const d=b.tag,e=b.Da;return cE(a,e.a,()=>_.x(function*(){const f=OB(d,_.Ba),g=bC(OB(d,_.pb));var h=OB(d,_.pb).toUpperCase();if(bC(h)!==_.t)h=null;else{var k=d.getAttribute("FORCED");k=!(!k||!k.value||"YES"!==k.value.toUpperCase());var l=_.Cv;h===pB&&(l=
|
|
45
|
+
_.ov);k&&(l="forced");h=l}k=c.get(f)||"";l=_.I(d,_.Ha);const m=_.I(d,"NAME"),n=d.getAttribute("DEFAULT"),q=d.getAttribute("AUTOSELECT"),u=_.I(d,"CHANNELS");return yield RD(a,{Da:e,codecs:k,type:g,Jc:l,primary:!!n&&!!q,name:m,channelsCount:g===_.p?u?parseInt(u.split("/")[0],10):null:null,groupId:f,kind:h,closedCaptions:null,sd:null})}))})},aE=function(a,b){return _.x(function*(){const c=b.tag,d=b.Da;return cE(a,d.a,()=>_.x(function*(){var e=_.I(c,_.la)||"jpg",f=_.I(c,_.Ha);const g=_.I(c,"NAME");e=
|
|
46
|
+
yield RD(a,{Da:d,codecs:e,type:_.sd,Jc:f,name:g,primary:!1,kind:null,channelsCount:null,closedCaptions:null,groupId:null,sd:null});(f=_.I(c,_.ja))&&cD(e,Number(f));return e}))})},$D=function(a,b,c,d,e){return _.x(function*(){var f=b.tag,g=Number(OB(f,_.ja));if(null!=f.getAttribute("FRAME-RATE")||null!=f.getAttribute(_.cb)){var h=_.I(f,"FRAME-RATE");f=_.I(f,_.cb);var [k,l]=f?f.split("x"):[null,null];h={frameRate:QB(h),width:QB(k),height:QB(l)}}else h=null;if(f=yield dE(a,b,h,c,d)){h=f.video;f=f.audio;
|
|
47
|
+
var m=0<f.length?f:[null];h=0<h.length?h:[null];f=[];for(const n of m)for(const q of h){m=(q?pC(q).wa:"")+" - "+(n?pC(n).wa:"");if(e.has(m)){a.h.debug("Skipping variant which only differs in text streams.");continue}const u=ED(a,n,q,g);null==u?a.h.warn("Incompatible DRM info in HLS variant. Skipping."):(f.push(u),e.add(m))}g=f}else g=[];return g})},dE=function(a,b,c,d,e){return _.x(function*(){var f=b.tag,g=b.Da;let h=WD(a,f);var k=_.I(f,"AUDIO"),l=_.I(f,_.yb),m=k||l;m=m&&d.has(m)?d.get(m):[];k={audio:k?
|
|
48
|
+
m:[],video:l?m:[]};a.h.debug("Guessing stream type for",f.toString());f=!1;const n=g.a;g=k.audio.find(q=>q.wa===n);l=_.oi(_.w,h);l=c||l;1!==h.length||l?!m.length&&1<h.length?(a.h.debug("Guessing multiplexed audio+video"),g=_.w,h=[h.join(",")]):k.audio.length&&g?(a.h.debug(GB),g=_.p,f=!0):k.video.length?(a.h.debug(GB),g=_.p):(a.h.debug("Guessing video-only"),g=_.w):(g=_.p,a.h.debug(GB));l=null;f||(l=yield eE(a,b,h,g,e,c));if(null==l)return null;k[g]=[l];g===_.p&&c&&m.forEach(q=>{$C(q,c.width);aD(q,
|
|
49
|
+
c.height);bD(q,c.frameRate)});tC(k);return k})},eE=function(a,b,c,d,e,f){return _.x(function*(){const g=b.tag,h=b.Da;return cE(a,h.a,()=>_.x(function*(){var k=_.I(g,pB);let l=null;d===_.w&&k&&"NONE"!==k&&(l=e.get(k));k=XD(d,c);return yield RD(a,{Da:h,codecs:k,type:d,closedCaptions:l,primary:!1,kind:null,Jc:null,name:null,channelsCount:null,groupId:null,sd:f})}))})},cE=function(a,b,c){if(a.f.has(b))return a=a.f.get(b),Promise.resolve(a);if(a.f.f.has(b))return a.f.f.get(b)||null;c=c();a.f.set(b,c);
|
|
50
|
+
return c},UD=function(a,b,c,d){return _.x(function*(){var e=b.a,f=b.T;var g=void 0===g?0:g;var h=(h=UB(b.$,xB))?Number(h.value):g;g=[];!xD(a)&&PC(f);e=yield fE(a,b.f,e,f,h,c,d);if(0===f.length)f=[];else{var k=[],l=[];for(var m of f)TB(m.$,sB)&&0<l.length&&(k.push(l),l=[]),l.push(m);k.push(l);f=k}for(m=0;m<f.length;m++)k=f[m],l=yield gE(a,b.f,k,h,e,c,d,g[g.length-1]||null,f.length),g.push(l),h+=k.length;hE(g);return g})},bE=function(a,b){return _.x(function*(){var c="EXT-X-MEDIA"!==b.name?!0:_.I(b,
|
|
51
|
+
_.pb)===JB;c=_.I(b,_.rb,void 0,{required:c});if(!c)return null;const d=WB(a.o,c),{response:e,text:f}=yield tD(a,d);return uD(a,f,e.uri,c)})},JD=function(a){1===a.type&&a.T.forEach((b,c)=>{if(TB(b.$,wB)&&!TB(b.$,sB)&&0<c)throw new _.H(_.G,4,4046,"Media playlist contains an EXT-X-MAP tag not accompanied by an EXT-X-DISCONTINUITY tag.");})},hE=function(a){if(1<(new Set(a.map(b=>b.mimeType))).size)throw new _.H(_.G,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");
|
|
52
|
+
},iE=function(a){a=a.map(b=>b.a?b.a:b.f.map(c=>_.I(c,_.rb))||null).map(b=>_.Rp(b));if(1<(new Set(a)).size)throw new _.H(_.G,4,4044,"Unexpected change in file format.");},jE=function(a,b,c){a=RB(a.$,wB);if(1<a.length)throw new _.H(_.G,4,4020);a=a[0];if(!a)return null;const d=OB(a,_.rb),e=WB(b,d);b=gC(a,null,!0);return new _.cB(()=>[e],b.ta,b.ha,c)},kE=function(a,b,c,d,e,f,g){const h=[];for(const q of _.Wv(b.f)){b=q.Kd;const u=q.item;{var k=0===b,l=k?a:h[h.length-1],m=k?d:l.endTime,n=Number(_.I(u,"DURATION"));
|
|
53
|
+
n=m+n;k=gC(u,k?null:l.ha,k);l=_.I(u,_.rb);const v=(l=WB(g,l))?[l]:[];m=new hC(c,m,n,()=>v,k.ta,k.ha,e,f,!1,null,null,null,null);if("YES"===_.I(u,"INDEPENDENT")||0===b)m.g=!0;h.push(m)}}return h},lE=function(a,b,c,d,e,f,g,h,k,l,m){const n=c.$;var q=c.a;const u=null!=q,v=q?[q]:[];if(!u&&!a.a.hlsLowLatency)return null;a=0;q={ta:0,ha:null};let y=null;u?({duration:c}=eC(n),a=e+c,q=dC(n,b?b.ha:null)):(b=kE(b,c,d,e,f,g,k),a=b[b.length-1].endTime,y=b);h=h===_.sd?VB(n):null;d=new hC(d,e,a,()=>v,q.ta,q.ha,
|
|
54
|
+
f,g,!1,null,h?h.Ne:null,h?h.mf:null,h?h.durationPerTile:null,y);d.ea=l;d.initSegment=m||void 0;return d},fE=function(a,b,c,d,e,f,g){return _.x(function*(){var h=d[0];if(null!=a.B)return a.B;if(!xD(a)&&a.w)try{var k=a.f.get(c);var l=k?YC(k,e)||null:null;if(!l)throw new _.H(_.G,4,4030,"Segment not found in pervious playlist update.");var m=l.startTime+l.ya;a.h.debug(`Setting playlist start time to ${m}.`);return a.B=m}catch(n){if(h=a.f.get(c))m=h.streams[h.streams.length-1].T,m=m[m.length-1],a.h.warn(`Last #EXT-X-MEDIA-SEQUENCE values ${h.streams[0].T[0].position} - ${m.position}`+
|
|
55
|
+
`, new values ${e} - ${e+d.length-1}.`,b,h);throw new _.H(_.G,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}m=yield mE(a,f,g,h);k=QC(h.$,a.o,m)||LC();l=jE(h,b,k.keyInfo);k=jC(k.keyInfo,e);h=yield nE(a,l,h,k,m,g);a.h.debug(`Setting playlist start time to ${h}.`);return a.B=h})},gE=function(a,b,c,d,e,f,g,h,k){return _.x(function*(){var l=c[0],m=null==h;iE(c);const n=yield mE(a,f,g,l);var q=a.o,u=h?h.kg:null;var v=1===k;if(c.slice(1).some(OC))throw new _.H(_.G,
|
|
56
|
+
4,4046,v?"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not at the beginning of the playlist.":"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not marked by an EXT-X-DISCONTINUITY tag and is not at the beginning of the playlist.");if(TB(c[0].$,vB)||null===u)if((u=QC(c[0].$,q,n))&&u.type===NB){if(1<SC(c))throw new _.H(_.G,4,4046,KB+`${v?"playlist":"discontinuity"}.`);v=[u]}else v=RC(c,q,n),v=0===v.length?[LC()]:v;else if(q=RC(c,q,n),u.type===_.Nd||
|
|
57
|
+
u.type===MB)v=[u,...q];else{if(0<SC(c))throw new _.H(_.G,4,4046,KB+`${v?"playlist":"discontinuity"}.`);v=[u]}q=v;v=q[q.length-1];q=MC(q);u=jE(l,b,q.keyInfo)||(h?h.gg:null);var y=jC(q.keyInfo,d);const A=l.ea;l=m?e:yield oE(a,A,u,l,d,y,n,g);m=[];for(y=0;y<c.length;y++){var D=c[y];const E=m[m.length-1]||null,N=0===y?0:E.endTime,sb=d+y,Sb=jC(q.keyInfo,sb);(D=lE(a,E,D,sb,N,l,Sb,f,b,A,u))&&m.push(D)}return{T:m,Mf:q,kg:v,mimeType:n,endTime:m[m.length-1].endTime,ea:A,gg:u}})},mE=function(a,b,c,d){return _.x(function*(){const e=
|
|
58
|
+
d.a;var f=UB(d.$,wB);f=f?OB(f,_.rb):null;return pE(a,b,c,e,f)})},nE=function(a,b,c,d,e,f){return _.x(function*(){if(null==c.a)return 0;const g=iC(c,d);return WC(a.K,b,g,e,f,null!=d)})},oE=function(a,b,c,d,e,f,g,h){return _.x(function*(){if(a.F.has(b))return a.F.get(b);const k=yield nE(a,c,d,f,g,h);a.h.debug(`Segment #${e} has raw media timestamp `+`${k} s.`);a.F.set(b,k);return k})},pE=function(a,b,c,d,e){return _.x(function*(){const f=[d,e].filter(Boolean);var g=_.ri(f,b,c);if(g)return g;g=_.Kh([d],
|
|
59
|
+
a.a.attemptParameters);g.method="HEAD";g.type=2;g=(yield a.C(g)).headers["content-type"];if(!g)throw new _.H(_.G,4,4021,"Unknown MIME type of: "+f.join(", "));return g.split(";")[0]})},vD=class{constructor(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.H(_.G,4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.H(_.G,4,4043,"Media playlist must have at least one full segment!");}this.f=a;this.a="";this.type=b;this.$=c;this.T=1===b?d:null}},xC=class{constructor(a,
|
|
60
|
+
b,c){c=void 0===c?[]:c;this.$=b;this.a=a;this.f=c;this.ea=-1}},hC=class extends _.Gw{constructor(a,b,c,d,e,f,g,h,k,l,m,n,q,u){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===q?null:q,u);this.initSegment=void 0;this.ea=0}},vC=[tB,uB,"EXT-X-I-FRAMES-ONLY",xB,yB,zB,CB,EB],ID=["EXTINF",rB,"EXT-X-DATERANGE",sB,vB,wB,BB],wC=["EXT-X-PART",AB],qE=class{constructor(){this.a=0}},rE=class{constructor(){this.a=new Map;this.f=
|
|
61
|
+
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()}},BD=new _.R("clpp.hls.DiscontinuityUtils");var UC={"com.apple.streamingkeydelivery":function(a,b){if(b===_.ef)throw new _.H(_.G,4,4041);if(OB(a,HB)===IB)throw new _.H(_.G,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.Sv(_.Pc,[{initDataType:_.De,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":KC,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":KC,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=OB(a,HB);if(!IC.includes(b))return JC.error("Widevine in HLS is only supported with [",
|
|
62
|
+
IC.join(", "),"], not",b),null;b=OB(a,_.rb);b=_.hp(b);b=_.J(b.data);b=_.Sv(_.Sc,[{initDataType:_.yc,initData:b}],"");if(a=_.I(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},IC=["SAMPLE-AES",IB],JC=new _.R("clpp.hls.DrmParser");var TC=new _.R("clpp.hls.EncryptionUtils");var sE=class{constructor(a){this.h=new _.R("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.Hh()}}};var VD=class{constructor(a){this.streams=a}length(){return this.streams.length}};var TD=class{constructor(a){this.a=a}length(){return this.a.length}};var tE=class{constructor(){this.a=this.D=null;this.H=1;this.f=new rE;this.o="";this.J=new qE;this.G=0;this.g=null;this.j=new _.zi(()=>{this.yb()});this.l=_.jv;this.w=null;this.A=new _.Up;this.B=null;this.h=new _.R("clpp.hls.HlsParser");this.F=new Map;this.K=new sE(this.C.bind(this));this.I=!1}configure(a){this.a=a;this.K.a=a}setCurrentVariant(a){this.g=a}start(a,b){const c=this;return _.x(function*(){if(c.I)throw Error("start() may be called only once!");c.I=!0;c.D=b;const {response:d,text:e}=yield tD(c,
|
|
63
|
+
a);c.o=d.uri;const f=yield yD(c,e);c.w=f;const g=c.G;0<g&&c.j.ca(g);return f})}stop(){this.j&&(this.j.stop(),this.j=null);const a=[];this.A&&(a.push(this.A.destroy()),this.A=null);this.f.clear();this.w=this.a=this.D=this.g=null;return Promise.all(a)}onExpirationUpdated(){}update(){const a=this;return _.x(function*(){const b=a.w;if(!xD(a)&&b){var c=b.presentationTimeline;"LIVE"===a.l&&(a.B=null);var d=Array.from(a.f.values());if(a.a.hlsLowLatency&&null!==a.g){const f=sD(a);d=d.filter(g=>f.includes(pC(g).wa))}var e=
|
|
64
|
+
yield AD(a,d);d=e.map(f=>f.Da);CD(a,d);e=yield FD(a,e);eD(b.periods,e).forEach(f=>{a.D.filterNewPeriod(f)});hD(b.periods,e);iD(b.adaptedPeriods,e);rD(c,e);ZB(d)&&HD(a,c,e)}})}yb(){const a=this;return _.x(function*(){a.h.debug(_.iv);if(a.D)try{yield a.update(),a.j.ca(a.G)}catch(b){if(!(b instanceof _.H))throw b;a.D&&(a.D.onError(b),1===b.severity&&a.j.ca(.1))}})}C(a){if(!this.A)throw new _.H(_.G,7,7001);a=this.D.networkingEngine.fetch(a);_.Rh(this.A,a);return a.P}};_.z("clpp.hls.HlsComponent",class extends _.Pq{f(){_.Lo.m3u8=tE;_.Jo[_.vj]=tE;_.Jo[LB]=tE}a(){_.Nw("m3u8");_.Ow(_.vj);_.Ow(LB)}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.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var LL=function(a){a.a.one(a.m,_.Ad,()=>KL(a))},KL=function(a){const b=a.m.getSurface().getMedia();if(b)if(a.g){a.a.on(b.textTracks,_.Tb,d=>ML(a,d));var c=Array.from(b.textTracks);c.filter(d=>d.kind===_.Gd).forEach(d=>{ML(a,{track:d})});!NL(c)&&a.l&&(a.h.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),OL(a,b))}else a.h.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");
|
|
2
|
+
else a.h.warn("A video element is not available. Skipping.")},ML=function(a,b){b=b.track;b.kind===_.Gd&&(a.h.info("The metadata track has been added."),b.mode=_.qd,a.a.on(b,_.Vc,c=>PL(a,c)))},NL=function(a){return a.some(b=>b.kind===_.Gd)},OL=function(a,b){const c=a.m.getTrackManager(),d=c.oa(),e=c.getAudioTracks().find(g=>g!==d);if(e){var f=()=>c.sa(d);a.a.on(b.textTracks,_.Tb,g=>{g.track.kind===_.Gd&&(a.a.off(b.textTracks,_.Tb,f),c.sa(d))});c.sa(e)}else a.h.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},
|
|
3
|
+
PL=function(a,b){const c=QL(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 RL(d);if(e.f===c&&null!==e.a){a.f=d;d=a.g.parseMedia(_.kh(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)}}})},QL=function(a){return(a=a.m.getTrackManager().pa())&&a.language&&a.language.toLowerCase()},
|
|
4
|
+
RL=class{constructor(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.B(a)){a:{var b=a.info;if(_.Rf(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=_.Rf(a)?a:null}}};var SL=class{constructor(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.vp;this.g=(a=_.jp[_.dc]||null)?new a(this.m.getConfiguration()):null;this.h=new _.R("clpp.hlssmpte.ImageCueHandler");this.f=null;LL(this)}destroy(){this.a.release();this.f=null;return Promise.resolve()}};var TL=class extends _.rr{constructor(){super();this.a=null;this.f=!1}onPlayerCreated(){}onContentWillLoad(a){if(this.f=_.Pi()){var b=a.getConfiguration();b=_.Hf(b.hlssmpte||{});typeof b.patchMetadataTrack!==_.nc&&(b.patchMetadataTrack=!1);_.Sf(b.timestampOffset)||(b.timestampOffset=0);this.a=new SL(a,b.patchMetadataTrack,b.timestampOffset)}}onPlayerWillDestroy(){const a=this;return _.x(function*(){a.a&&(yield a.a.destroy(),a.a=null)})}id(){return"hlssmpte"}};_.z("clpp.hlssmpte.HlsSmptePlugin",TL);
|
|
5
|
+
TL.Id="hlssmpte";_.En(new class{create(){return new TL}});};f.call(g, window);
|