@castlabs/prestoplay 6.23.1 → 6.24.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 +14 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +113 -113
- package/cjs/cl.conviva.js +32 -32
- package/cjs/cl.core.js +608 -591
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +87 -86
- package/cjs/cl.externs.js +94 -30
- package/cjs/cl.freewheel.js +25 -24
- package/cjs/cl.hls.js +73 -71
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +30 -30
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +344 -339
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +16 -16
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +71 -71
- 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 +37 -37
- 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 +492 -478
- package/cl.crypto.js +9 -9
- package/cl.dash.js +81 -80
- package/cl.externs.js +94 -30
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +75 -74
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +307 -305
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +14 -14
- package/cl.vtt.js +12 -12
- package/cl.yospace.js +3 -3
- package/cl.youbora.js +28 -28
- package/package.json +1 -1
- package/typings.d.ts +44 -10
package/cjs/cl.freewheel.js
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.
|
|
4
|
-
_.y(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.y(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},
|
|
5
|
-
a.a.registerVideoDisplayBase(
|
|
6
|
-
_.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.
|
|
7
|
-
_.J("clpp.freewheel.FreeWheelPlugin",
|
|
8
|
-
_.t.getTitle=function(){return""};_.t.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.t.getPosition=function(){return 0};_.t.getSkipTimeOffset=function(){return 0};_.t.
|
|
9
|
-
_.t.
|
|
10
|
-
_.t.getPodIndex=function(){switch(this.
|
|
11
|
-
_.t.getWrapperCreativeIds=function(){return[]};_.t
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
_.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_.t.
|
|
20
|
-
|
|
21
|
-
_.t.
|
|
22
|
-
_.
|
|
23
|
-
|
|
24
|
-
_.t.
|
|
25
|
-
|
|
2
|
+
var f=function(window){var iW="clpp-freewheel",jW="clpp.freewheel.AdsManagerFactory",kW="freewheel",lW=function(){this.f=this.a=null},mW=function(){},nW=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""}},oW=function(a,b,c){this.h=a;this.f=b;this.a=c},pW=function(a){this.a=a},qW=function(a){this.g=new _.K("clpp.freewheel.AdsManager");this.m=a;this.h=new _.vi;this.w=new tv.freewheel.SDK.AdManager;
|
|
3
|
+
this.f=this.a=null;this.B=[];this.o=[];this.A=[];this.l=new _.Gk;this.j=null},rW=function(a){var b=[];typeof a.networkId!==_.k&&b.push("networkId");typeof a.serverUrl!==_.tg&&b.push("serverUrl");typeof a.profileId!==_.tg&&b.push("profileId");typeof a.videoAssetId!==_.tg&&typeof a.videoAssetId!==_.k&&b.push("videoAssetId");if(b.length)throw new _.O(1,9,12001,{missingKeys:b.join(", ")});},sW=function(){var a,b,c,d;return _.I(function(e){if(1==e.a)return a=new _.$u,b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_NONE,
|
|
4
|
+
_.y(e,a.canPlay(!1),2);if(3!=e.a)return c=e.f,_.y(e,a.canPlay(!0),3);d=e.f;c?b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_ATTENDED:d&&(b=tv.freewheel.SDK.VIDEO_ASSET_AUTO_PLAY_TYPE_UNATTENDED);return e["return"](b)})},vW=function(a){return _.I(function(b){if(a.B.length)return tW(a),a.f=a.B.shift(),a.f.play(),b.F(0);uW(a);return _.y(b,a.m.a.play(),0)})},wW=function(a){a.A.length?(tW(a),a.f=a.A.shift(),a.f.play()):uW(a)},tW=function(a){var b=a.m.ge(kW).td();b&&(a.m.getSurface().show(b),a.m.getSurface().hideMediaElement(),
|
|
5
|
+
a.a.registerVideoDisplayBase(iW),a.m.isMuted()?a.setVolume(0):a.setVolume(a.m.getVolume()||1))},uW=function(a){var b=a.m.ge(kW).td();b&&a.m.getSurface().hide(b);a.m.getSurface().showMediaElement()},xW=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 oW(a.a,c,d)});a.m.trigger(new _.L(b,d))},yW=function(){this.Ca=new _.K(jW)};_.x(lW,_.ew);_.t=lW.prototype;
|
|
6
|
+
_.t.onPlayerCreated=function(a){if(window.tv&&tv.freewheel&&tv.freewheel.SDK)this.a=_.sr(_.fe,{id:iW}),this.f=_.sr(_.r,{"class":_.Ad}),this.a.appendChild(this.f),a.getSurface().addElementToContainer(this.a,!0),a.getSurface().hide(this.a);else a.onError(new _.O(1,9,12E3))};_.t.onPlayerWillDestroy=function(a){this.a&&(a.getSurface().removeElementFromContainer(this.a),this.f=this.a=null)};_.t.id=function(){return kW};_.t.td=function(){return this.a};_.t.Yl=function(){return this.f};
|
|
7
|
+
_.J("clpp.freewheel.FreeWheelPlugin",lW);lW.prototype.getAdVideo=lW.prototype.Yl;lW.prototype.getAdContainer=lW.prototype.td;lW.Id=kW;lW.AD_CONTAINER_ID=iW;mW.prototype.create=function(){return new lW};_.bu(new mW);_.t=oW.prototype;_.t.yb=function(){return"FreeWheel AdManager SDK"};_.t.zb=function(){return tv.freewheel.SDK.version};_.t.Db=function(){return 0};_.t.getId=function(){return this.a?this.a.getAdId():""};_.t.getCreativeId=function(){var a=(this.a||{})._creativeId;return typeof a===_.tg?a:""};_.t.cc=function(){return""};_.t.getApiFramework=function(){return this.a?this.a.getActiveCreativeRendition().getCreativeApi():""};_.t.getAdSystem=function(){return""};_.t.getAdvertiserName=function(){return""};
|
|
8
|
+
_.t.getTitle=function(){return""};_.t.getDuration=function(){return this.a?this.a.getActiveCreativeRendition().getDuration():0};_.t.getPosition=function(){return 0};_.t.getSkipTimeOffset=function(){return 0};_.t.gc=function(){return!1};_.t.Ab=function(){return this.a&&this.a.getEventCallbackUrls(tv.freewheel.SDK.EVENT_AD_CLICK,tv.freewheel.SDK.EVENT_TYPE_CLICK)[0]||""};_.t.getMediaUrl=function(){return this.a?this.a.getActiveCreativeRendition().getPrimaryCreativeRenditionAsset().getUrl():""};
|
|
9
|
+
_.t.qb=function(){return this.a?this.a.getActiveCreativeRendition().getWidth():0};_.t.pb=function(){return this.a?this.a.getActiveCreativeRendition().getHeight():0};_.t.Xa=function(){return 0};_.t.Ya=function(){switch(this.f.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return 2;default:return 1}};
|
|
10
|
+
_.t.getPodIndex=function(){switch(this.Ya()){case 0:return 0;case 2:return-1}return this.h.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL).indexOf(this.f)+1};_.t.Pb=function(){switch(this.Ya()){case 0:return 0;case 2:return-1;default:return this.f.getTimePosition()}};_.t.Cb=function(){return this.a?this.f.getAdInstances().indexOf(this.a)+1:1};_.t.rb=function(){return this.f.getAdCount()};_.t.getWrapperAdIds=function(){return[]};_.t.canSeek=function(){return!1};
|
|
11
|
+
_.t.getWrapperAdSystems=function(){return[]};_.t.getWrapperCreativeIds=function(){return[]};_.t.fc=function(){return null};oW.prototype.getVideoElement=oW.prototype.fc;oW.prototype.getWrapperCreativeIds=oW.prototype.getWrapperCreativeIds;oW.prototype.getWrapperAdSystems=oW.prototype.getWrapperAdSystems;oW.prototype.canSeek=oW.prototype.canSeek;oW.prototype.getWrapperAdIds=oW.prototype.getWrapperAdIds;oW.prototype.getSequenceLength=oW.prototype.rb;oW.prototype.getPositionInSequence=oW.prototype.Cb;
|
|
12
|
+
oW.prototype.getPodTimeOffset=oW.prototype.Pb;oW.prototype.getPodIndex=oW.prototype.getPodIndex;oW.prototype.getPodType=oW.prototype.Ya;oW.prototype.getMediaBitrate=oW.prototype.Xa;oW.prototype.getMediaHeight=oW.prototype.pb;oW.prototype.getMediaWidth=oW.prototype.qb;oW.prototype.getMediaUrl=oW.prototype.getMediaUrl;oW.prototype.getClickThroughUrl=oW.prototype.Ab;oW.prototype.isBumper=oW.prototype.gc;oW.prototype.getSkipTimeOffset=oW.prototype.getSkipTimeOffset;oW.prototype.getPosition=oW.prototype.getPosition;
|
|
13
|
+
oW.prototype.getDuration=oW.prototype.getDuration;oW.prototype.getTitle=oW.prototype.getTitle;oW.prototype.getAdvertiserName=oW.prototype.getAdvertiserName;oW.prototype.getAdSystem=oW.prototype.getAdSystem;oW.prototype.getApiFramework=oW.prototype.getApiFramework;oW.prototype.getSourceId=oW.prototype.cc;oW.prototype.getCreativeId=oW.prototype.getCreativeId;oW.prototype.getId=oW.prototype.getId;oW.prototype.getTechnology=oW.prototype.Db;oW.prototype.getAdManagerVersion=oW.prototype.zb;
|
|
14
|
+
oW.prototype.getAdManagerName=oW.prototype.yb;pW.prototype.getCuePoints=function(){return this.a.getTemporalSlots().map(function(a){switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:return 0;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:return-1;default:return a.getTimePosition()}})};pW.prototype.Sb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL).length};pW.prototype.Rb=function(){return 0<this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL).length};
|
|
15
|
+
pW.prototype.hasPostroll=pW.prototype.Rb;pW.prototype.hasPreroll=pW.prototype.Sb;pW.prototype.getCuePoints=pW.prototype.getCuePoints;_.t=qW.prototype;
|
|
16
|
+
_.t.load=function(){var a=this,b,c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){b=a.m.getConfiguration().freewheel||{};try{rW(b)}catch(n){return a.m.onError(n),a.l.resolve(),m["return"](a.l)}a.w.setNetwork(b.networkId);a.w.setServer(b.serverUrl);a.a=a.w.newContext();a.a.setProfile(b.profileId);typeof b.siteSectionId!==_.tg&&typeof b.siteSectionId!==_.k||a.a.setSiteSection(b.siteSectionId);return _.y(m,sW(),2)}c=m.f;a.a.setVideoAsset(b.videoAssetId,a.m.getDuration(),void 0,void 0,c);if(Array.isArray(b.pods))for(d=
|
|
17
|
+
_.w(b.pods),e=d.next();!e.done;e=d.next())f=e.value,a.a.addTemporalSlot(f.id,nW(f.type),f.position,f.slotProfile,f.cuepointSequence,f.maxDuration,f.minDuration,f.acceptContentType);b.keyValues&&typeof b.keyValues===_.ff&&Object.keys(b.keyValues).forEach(function(n){return a.a.addKeyValue(n,b.keyValues[n])});a.a.setParameter(tv.freewheel.SDK.PARAMETER_EXTENSION_CONTENT_VIDEO_ENABLED,!1,tv.freewheel.SDK.PARAMETER_LEVEL_GLOBAL);if(Array.isArray(b.parameters))for(g=_.w(b.parameters),h=g.next();!h.done;h=
|
|
18
|
+
g.next())l=h.value,a.a.setParameter(l.name,l.value,l.level);a.h.on(a.a,tv.freewheel.SDK.EVENT_REQUEST_COMPLETE,a.Cn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_STARTED,a.Gn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_SLOT_ENDED,a.Fn.bind(a));a.h.on(a.a,tv.freewheel.SDK.EVENT_AD,a.Wm.bind(a));a.h.on(a.m,_.Gg,a.Mk.bind(a));a.h.on(a.m,_.qg,a.Lk.bind(a));a.a.submitRequest();return m["return"](a.l)})};_.t.start=function(){var a=this;return _.I(function(b){return _.y(b,vW(a),0)})};_.t.kd=function(){};
|
|
19
|
+
_.t.resume=function(){this.f&&this.f.resume()};_.t.pause=function(){this.f&&this.f.pause()};_.t.skip=function(){this.f&&this.f.skipCurrentAd()};_.t.getVolume=function(){return this.a?this.a.getAdVolume():1};_.t.setVolume=function(a){this.a&&this.a.setAdVolume(a)};_.t.getPosition=function(){return this.f?this.f.getPlayheadTime():-1};_.t.gd=function(){return!0};_.t.Dc=function(){var a=this;return _.I(function(b){a.h.release();a.j&&(a.j.stop(),a.j=null);uW(a);a.a&&(a.a.dispose(),a.a=null);_.B(b)})};
|
|
20
|
+
_.t.Cn=function(a){var b=this;if(a.success)this.B=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL),this.o=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL),this.A=this.a.getSlotsByTimePositionClass(tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL),this.m.trigger(new _.L(_.Qc,{adsTimeline:new pW(this.a)})),this.j=new _.Yu(this.m.getSurface(),function(c,d){return b.a.resize(c,d)},this.m.ge(kW).f);else this.m.onError(new _.O(1,9,10003,{errorType:0},
|
|
21
|
+
void 0));this.l.resolve()};_.t.Gn=function(a){xW(this,_.wc,a);this.j.start()};_.t.Fn=function(a){this.f=null;a=a.slot;xW(this,_.xc);this.j.stop();if(a)switch(a.getTimePositionClass()){case tv.freewheel.SDK.TIME_POSITION_CLASS_PREROLL:vW(this);break;case tv.freewheel.SDK.TIME_POSITION_CLASS_MIDROLL:uW(this);this.m.play();break;case tv.freewheel.SDK.TIME_POSITION_CLASS_POSTROLL:wW(this)}};
|
|
22
|
+
_.t.Wm=function(a){var b=a.subType;this.g.debug("ad event",b);switch(b){case tv.freewheel.SDK.EVENT_AD_IMPRESSION:xW(this,_.Mc,a);xW(this,_.Fc,a);break;case tv.freewheel.SDK.EVENT_AD_IMPRESSION_END:xW(this,_.Nc,a);break;case tv.freewheel.SDK.EVENT_AD_FIRST_QUARTILE:xW(this,_.Bc,a);break;case tv.freewheel.SDK.EVENT_AD_MIDPOINT:xW(this,_.Hc,a);break;case tv.freewheel.SDK.EVENT_AD_THIRD_QUARTILE:xW(this,_.Oc,a);break;case tv.freewheel.SDK.EVENT_AD_COMPLETE:xW(this,_.Ac,a);break;case tv.freewheel.SDK.EVENT_AD_CLICK:xW(this,
|
|
23
|
+
_.zc,a);break;case tv.freewheel.SDK.EVENT_AD_PAUSE:xW(this,_.Ic,a);break;case tv.freewheel.SDK.EVENT_AD_RESUME:xW(this,_.Kc,a);break;case tv.freewheel.SDK.EVENT_AD_SKIPPED:xW(this,_.Lc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_START:xW(this,_.yc,a);break;case tv.freewheel.SDK.EVENT_AD_BUFFERING_END:xW(this,_.Jc,a);break;case tv.freewheel.SDK.EVENT_ERROR:this.m.onError(new _.O(1,9,10003,{errorType:1},{fwCode:a[tv.freewheel.SDK.INFO_KEY_ERROR_CODE],fwInfo:a[tv.freewheel.SDK.INFO_KEY_ERROR_INFO],
|
|
24
|
+
fwModule:a[tv.freewheel.SDK.INFO_KEY_ERROR_MODULE]}))}};_.t.Mk=function(){var a=this;if(!this.f){var b=this.m.getPosition();if(this.f=this.o.find(function(d){return.5>Math.abs(b-d.getTimePosition())})||null){var c=this.o.findIndex(function(d){return d===a.f});this.o.splice(c,1);this.m.pause();tW(this);this.f.play()}}};
|
|
25
|
+
_.t.Lk=function(a){if((a=a.detail)&&this.a)switch(a.currentState){case _.Uq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PLAYING);break;case _.Tq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_PAUSED);break;case _.Nq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_COMPLETED);wW(this);break;case _.Gq:case _.Rq:this.a.setVideoState(tv.freewheel.SDK.VIDEO_STATE_STOPPED)}};qW.prototype.getPosition=qW.prototype.getPosition;qW.prototype.setVolume=qW.prototype.setVolume;
|
|
26
|
+
qW.prototype.getVolume=qW.prototype.getVolume;qW.prototype.skip=qW.prototype.skip;qW.prototype.pause=qW.prototype.pause;qW.prototype.resume=qW.prototype.resume;yW.prototype.name=function(){return jW};yW.prototype.a=function(a,b){return a.namespace()!==_.Fd&&b&&b.freewheel?window.tv&&tv.freewheel&&tv.freewheel.SDK?!0:(this.Ca.warn("FreeWheel SDK is not loaded."),!1):!1};yW.prototype.create=function(a){return new qW(a)};_.mr(new yW);};
|
|
26
27
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
27
28
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
28
29
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hls.js
CHANGED
|
@@ -1,75 +1,77 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
d[0].a)throw new _.
|
|
4
|
-
"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.
|
|
5
|
-
|
|
6
|
-
e=b.S;d=d.concat(b
|
|
7
|
-
d.push(h):_.
|
|
8
|
-
e+"' as it is not defined in the master playlist");d.set(e,f)});return d},
|
|
9
|
-
21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.
|
|
10
|
-
e+=10;e+=f}while(e<a.byteLength);return d()},
|
|
11
|
-
c(),a=_.
|
|
12
|
-
g}if(c||!d)throw _.
|
|
13
|
-
4,4030,
|
|
14
|
-
if("audio/mpeg"===d||d===_.
|
|
15
|
-
v.f,v["return"](
|
|
16
|
-
e.
|
|
17
|
-
|
|
18
|
-
b){var c=
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
m=b.next()){var n=m.value;m=n.
|
|
51
|
-
a=0;q={
|
|
52
|
-
case 2:p=G.f,q=m,u=f.
|
|
53
|
-
l=M.startTime+M.
|
|
54
|
-
e),_.y(D,
|
|
55
|
-
[];for(
|
|
56
|
-
a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.
|
|
57
|
-
c,e,g))})},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
b,c)
|
|
65
|
-
_.
|
|
66
|
-
b,c)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
_.t.
|
|
2
|
+
var f=function(window){var dM="Could not parse MP4 segment start time.",eM="Failed to infer discontinuity number",fM="Guessing audio-only",gM="METHOD",hM="SAMPLE-AES-CTR",iM="Setting playlist start time to ",jM="Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one ",kM="application/vnd.apple.mpegurl",lM="sample",mM="whole-segment",nM=function(a){if(1>a.a)throw _.un();--a.a},oM=function(a){a=_.Gj(a)||"";return null!=_.Hj.video[a]?_.r:null!=_.Hj.audio[a]?_.cd:null},pM=function(a,b,c,d){if(1===b){if(!d||0===d.length)throw new _.O(_.P,
|
|
3
|
+
4,4043,"Media playlist must have at least one segment!");if(null==d[0].a)throw new _.O(_.P,4,4043,"Media playlist must have at least one full segment!");}this.a=a;this.verbatimUri="";this.type=b;this.$=c;this.S=1===b?d:null},qM=function(a,b,c){c=void 0===c?[]:c;this.$=b;this.a=a;this.f=c;this.oa=-1},rM=function(a){a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value,b.startsWith("#EXT-")&&(b=_.qk(0,b),_.sw.has(b.name)))return 1;return 0},sM=function(a,b){var c=new Map,d=new URL(b);a.forEach(function(e){var f=
|
|
4
|
+
_.S(e,_.wb),g=_.S(e,"QUERYPARAM");if(f)g=_.Kj(e,"VALUE"),c.set(f,g);else if(g){f=d.searchParams.get(g);if(null==f)throw new _.O(_.P,4,4044,"Query param '"+g+"' missing in playlist URI.");if(!f)throw new _.O(_.P,4,4044,"Query param '"+g+"' has no associated value in playlist URI.");c.set(g,decodeURIComponent(f))}});return c},tM=function(a,b){return a.replace(/\{\$([a-zA-Z0-9_-]+)\}/g,function(c,d){var e=b.get(d);if(null==e)throw new _.O(_.P,4,4044,"Undefined variable '"+d+"'");return e})},uM=function(a,
|
|
5
|
+
b){a.forEach(function(c){c.attributes.forEach(function(d){d.value=tM(d.value,b)})})},vM=function(a,b,c){uM(a,c);b.forEach(function(d){d.a&&(d.a=tM(d.a,c));uM(d.$,c);uM(d.f,c)})},wM=function(){this.h=0;this.a=new Map},zM=function(a,b,c){b=b.trim().split(/\n+/m).map(function(d){return d.trim()}).filter(function(d){return d.length&&!_.Y.Ei(d)});if(!/^#EXTM3U($|[ \t\n])/m.test(b[0]))throw new _.O(_.P,4,4015);return 0===rM(b)?xM(a,b,c):yM(a,b,c)},yM=function(a,b,c){for(var d=[],e=1;e<b.length;){var f=
|
|
6
|
+
AM(a,b[e]);if(_.tw.has(f.name))break;d.push(f);e++}b=BM(a,c,b.slice(e));e=b.S;d=d.concat(b.$);a=CM(a,d,c);vM(d,e,a);return new pM(c,1,d,b.S)},xM=function(a,b,c){for(var d=[],e=1;e<b.length;e++){var f=AM(a,b[e]);d.push(f);if(f.name===_.$a){var g=b[e+1];if(!g)throw new _.O(_.P,4,4044,"EXT-X-STREAM-INF is not followed by a URI.");f.attributes.push(new _.Lj(_.bc,g));e++}}b=_.Y.ac(d,"EXT-X-DEFINE");_.Y.Bj(b);b=sM(b,c);a.a=b;vM(d,[],a.a);return new pM(c,0,d)},DM=function(a,b,c){var d=[],e=[];e.push(new _.Lj(_.pa,
|
|
7
|
+
"0"));e.push(new _.Lj(_.bc,b));c.length&&e.push(new _.Lj(_.ta,c));d.push(new _.Jj(a.h++,_.$a,e));return new pM(b,0,d)},BM=function(a,b,c){var d=[],e=[],f=[],g=[];c.forEach(function(h){/^(#EXT)/.test(h)?(h=AM(a,h),_.sw.has(h.name)||_.vw.has(h.name)?d.push(h):_.uw.has(h.name)?"EXT-X-PART"===h.name?g.push(h):h.name===_.Xa&&"PART"===_.S(h,_.$b)&&g.push(h):f.push(h)):_.Y.Ei(h)||(h=_.Y.Vd(b,h.trim(),!1),e.push(new qM(h,f,g)),f=[],g=[])});0<g.length&&e.push(new qM(null,f,g));return{S:e,$:d}},AM=function(a,
|
|
8
|
+
b){return _.qk(a.h++,b)},CM=function(a,b,c){b=_.Y.ac(b,"EXT-X-DEFINE");_.Y.Bj(b);var d=sM(b,c);b.map(function(e){return _.S(e,"IMPORT")}).filter(Boolean).forEach(function(e){var f=a.a.get(e);if(null==f)throw new _.O(_.P,4,4044,"Cannot import variable '"+e+"' as it is not defined in the master playlist");d.set(e,f)});return d},EM=function(a){var b=void 0===b?0:b;return 0>a?[]:Array.from({length:a},function(c,d){return d+b})},FM=function(a,b){b=void 0===b?0:b;return b+10<=a.length&&73===a[b]&&68===
|
|
9
|
+
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},GM=function(){this.a=new Map;this.f=new Map},HM=function(a){function b(l,m,n){for(var p="";m<n;m++)p+="%"+("00"+l[m].toString(16)).slice(-2);return p}function c(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]}function d(){throw new _.O(_.P,4,4030);}FM(a)||d();var e=10;a[5]&64&&(e=e+4+c(a.subarray(10,14)));do{var f=c(a.subarray(e+4,e+8));1>f&&d();var g=String.fromCharCode(a[e],a[e+1],a[e+2],a[e+3]);if("PRIV"===
|
|
10
|
+
g){g=a.subarray(e+10,e+f+10);for(var h=0;h<g.byteLength;h++)if(0===g[h]){if("com.apple.streaming.transportStreamTimestamp"===unescape(b(g,0,h)))return a=g.subarray(h+1),f=(a[3]&1)<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,f*=4,f+=a[7]&3,Math.round(f/9E4);break}}FM(a,e)||d();e+=10;e+=f}while(e<a.byteLength);return d()},IM=function(a){for(;a.getPosition()<a.Wa()-1;){var b=a.getPosition();if(71===_.vn(a))return nM(a),b}return-1},JM=function(a){function b(){d.seek(e+188);f=_.vn(d);71!==f&&(d.seek(e+192),
|
|
11
|
+
f=_.vn(d));71!==f&&(d.seek(e+204),f=_.vn(d));71!==f&&c();nM(d)}function c(){throw new _.O(_.P,4,4030);}var d=new _.sn(new DataView(a),!1),e=0,f=0;e=IM(d);0>e&&(_.Sw.error("Unable to find sync byte in TS after scanning."),c());for(;;)if(e=d.getPosition(),f=_.vn(d),71!==f&&c(),a=_.wn(d),8191===(a&8191))b();else if(a&16384)if(a=(_.vn(d)&48)>>4,0!==a&&2!==a||c(),3===a&&(a=_.vn(d),d.skip(a)),1!==_.xn(d)>>8)b();else{d.skip(3);a=_.vn(d)>>6;0!==a&&1!==a||c();0===_.vn(d)&&c();a=_.vn(d);var g=_.wn(d),h=_.wn(d);
|
|
12
|
+
return(1073741824*((a&14)>>1)+((g&65534)<<14|(h&65534)>>1))/9E4}else b()},KM=function(a,b){var c=null,d=0;try{(new _.Cn).N(_.bf,_.Dn).N(_.Ig,_.Dn).N(_.Xe,_.Dn).aa("mdhd",function(g){g.reader.skip(0===g.version?8:16);d=_.xn(g.reader);g.parser.stop()}).parse(b,!0)}catch(g){c=g}if(c||!d)throw _.Sw.error("Unable to find timescale in init segment!"),new _.O(_.P,4,4030,dM,c);var e=0,f=!1;try{(new _.Cn).N("moof",_.Dn).N("traf",_.Dn).aa("tfdt",function(g){var h=d;if(0===g.version)h=_.xn(g.reader)/h;else{var l=
|
|
13
|
+
_.xn(g.reader),m=_.xn(g.reader);if(!(2097151>=l||h>=Math.pow(2,12)))throw Error("Cannot accurately parse MP4 timestamp, base time is too high and timescale is \x3c\x3d 2^12");h=l/h*Math.pow(2,32)+m/h}e=h;f=!0;g.parser.stop()}).parse(a,!0)}catch(g){c=g}if(c||!f)throw new _.O(_.P,4,4030,dM,c);return e},NM=function(a){var b=_.Kj(a,gM);if(!LM.includes(b))return MM.error("PlayReady in HLS is only supported with [",LM.join(", "),"], not",b),null;a=_.Kj(a,_.bc);b=_.Bv(a);a=null;b=_.Xj(b.data);try{a=_.qE(_.kp(b))}catch(c){a=
|
|
14
|
+
b}return _.EE(_.Vd,[{initDataType:_.vd,initData:a}],"")},OM=function(a){this.g=new _.K("clpp.hls.MediaReader");this.f=a;this.a={attemptParameters:_.sk()}},QM=function(a,b,c,d,e,f){var g,h,l,m,n,p,q,u;return _.I(function(v){switch(v.a){case 1:a.g.debug("Fetching segment to find start time");if("audio/mpeg"===d||d===_.fd||d===_.ed)return v["return"](0);g=f;if(d!==_.dd){v.F(2);break}return _.y(v,PM(a,c,g),3);case 3:h=v.f;l=_.Xj(h.data);if(!FM(l))throw new _.O(_.P,4,4030,"AAC segment does not contain an ID3 tag.");
|
|
15
|
+
return v["return"](HM(l));case 2:if(d!==_.Yg&&d!==_.gd){v.F(4);break}m=[PM(a,c,g)];b&&m.push(PM(a,b,!0));return _.y(v,Promise.all(m),5);case 5:return n=v.f,p=n[0],q=n[1]||n[0],v["return"](KM(p.data,q.data));case 4:if(d!==_.Xg){v.F(6);break}return _.y(v,PM(a,c,g),7);case 7:return u=v.f,v["return"](JM(u.data));case 6:if(!_.Bu((d.split("/")[0]||"")+'/mp4;codecs\x3d"'+e+'"'))return v["return"](0);throw new _.O(_.P,4,4030);}})},PM=function(a,b,c){var d,e,f,g,h,l,m;return _.I(function(n){switch(n.a){case 1:return d=
|
|
16
|
+
b.f(),e=_.kF(b.eb(),b.Da,b.Da+2048-1,a.a.attemptParameters),e.type=2,f=_.kF(b.eb(),b.Da,b.pa,a.a.attemptParameters),f.type=2,d&&(f.keyInfo=d),_.C(n,2),g=c?f:e,_.y(n,a.f(g),4);case 4:return h=n.f,n["return"](h);case 2:l=_.E(n);if(7001===l.code||c)throw l;a.g.warn("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS pre-flights.",e.uris[0]);_.C(n,5);return _.y(n,a.f(f),7);case 7:return n["return"](n.f);
|
|
17
|
+
case 5:throw m=_.E(n),a.g.error("Failed to fetch media segment to parse its start timestamp.",f.uris[0],m),new _.O(_.P,4,4030,"Failed to fetch the media segment.");}})},RM=function(a){this.streams=a},SM=function(a,b){a.streams.forEach(function(c){c.Rf=b})},TM=function(a,b){a.streams.forEach(function(c){c.width=b})},UM=function(a,b){a.streams.forEach(function(c){c.height=b})},VM=function(a,b){a.streams.forEach(function(c){c.frameRate=b})},WM=function(a,b){a.streams.forEach(function(c){c.bandwidth=
|
|
18
|
+
b})},XM=function(a,b){var c=a.streams.find(function(d){d=d.S;return d[0].position<=b&&b<=d[d.length-1].position});return null==c?null:c.S.find(function(d){return d.position===b})||null},YM=function(a,b){var c=a.map(function(d){return d.streams[b]});return c.some(function(d){return null==d})?null:c},ZM=function(a){this.a=a},$M=function(a,b){var c=a.map(function(d){return d.a[b]});return c.some(function(d){return null==d})?null:c},aN=function(a,b){var c=new Set(a.map(function(d){return d.oa}));return b.filter(function(d){return!c.has(d.oa)})},
|
|
19
|
+
cN=function(a,b){for(;a[0].oa<b[0].oa;)a.splice(0,1);var c=a[0],d=b[0];c.startTime===d.startTime&&c.endTime===d.endTime||bN(c,d);var e=a.length-1;c=a[e];d=b[e];0<e&&(c.startTime!==d.startTime||c.endTime!==d.endTime)&&bN(c,d);for(c=e+1;c<b.length;)a.push(b[c]),c++},hN=function(a,b,c,d,e){var f=b[0].length();f=EM(f).map(function(g){var h=$M(b,g)||[],l=YM(c,g)||[];g=YM(d,g)||[];var m=_.th(dN(h)).concat(_.th(l),_.th(g)).filter(Boolean);eN(m);var n=m[0];m=n.oa;n=n.duration;return{configurationId:a,variants:h,
|
|
20
|
+
textStreams:l,thumbStreams:g,startTime:0,id:"P"+m,endTime:n,duration:n,oa:m}});e&&fN(f[0]);gN(f);return f},dN=function(a){a=new Set(a.flatMap(function(b){return[b.video,b.audio]}).filter(Boolean));return Array.from(a)},fN=function(a){var b=dN(a.variants)[0].S[0].Ja;a.startTime+=b;a.endTime+=b},gN=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=a[b-1];c.startTime=d?d.endTime:c.startTime;c.endTime=c.startTime+c.duration}},bN=function(a,b){a.startTime=b.startTime;a.endTime=b.endTime;a.duration=
|
|
21
|
+
b.duration;iN(a.variants,b.variants);jN(_.Y.Cf(a),_.Y.Cf(b))},iN=function(a,b){var c=new Map(a.map(function(d){return[_.Y.Vh(d),d]}));b.forEach(function(d){c.get(_.Y.Vh(d)).drmInfos=d.drmInfos})},jN=function(a,b){var c=new Map(a.map(function(d){return[d.zc,d]}));b.forEach(function(d){var e=c.get(d.zc);e.S=d.S;d.S.forEach(function(f){f.initSegment=e.initSegmentReference});e.segmentIndex.replace(d.S);e.rc=d.rc;e.jf=d.jf;e.duration=d.duration;e.$h=d.$h;e.encrypted=d.encrypted;e.drmInfos=d.drmInfos;e.keyId=
|
|
22
|
+
d.keyId})},eN=function(a){var b=kN(a);a.forEach(function(c){_.fF(c.segmentIndex,b);c.duration=b;c.jf=c.rc+b})},kN=function(a){var b=Infinity;_.Y.Ol(a).forEach(function(c){b=Math.min(b,c.duration)});return b},lN=function(){var a=this;this.a=this.D=null;this.h=1;this.f=new GM;this.A="";this.U=new wM;this.H=0;this.l=null;this.j=new _.li(function(){a.ic()});this.o=_.jc;this.C=null;this.G=new _.Jk;this.K=this.B=null;this.g=new _.K("clpp.hls.HlsParser");this.L=new Map;this.Y=new OM(this.ag.bind(this));
|
|
23
|
+
this.P=!1;this.I=null;this.M=!1;this.w=new Map;this.J=new Set},mN=function(a){if(null===a.l)return[];a=a.l;return[a.audio,a.video].filter(function(b){return b}).map(function(b){return b.zc})},nN=function(a,b){var c=new Set(b.map(function(h){return h.id}));a.w.forEach(function(h,l){c.has(l)||a.w["delete"](l)});for(var d=_.w(b),e=d.next();!e.done;e=d.next()){e=e.value;var f=a.w.get(e.id);if(f&&f.startTime!==e.startTime)a.D.onError(new _.O(1,4,4044,"EXT-X-DATERANGE START-DATE has changed for ID\x3d"+
|
|
24
|
+
e.id));var g={configurationId:a.D.configurationId,schemeIdUri:e.schemeIdUri,customAttributes:e.customAttributes,value:"",startTime:e.startTime,endTime:e.endTime,id:e.id,type:_.Pi,eventElement:null};f&&!_.N.Li(f,g)||a.w.set(e.id,g)}return Array.from(a.w.values())},wN=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v,z,A,H,G,D,F;return _.I(function(M){switch(M.a){case 1:return c=_.dr,d=oN(a,b,a.A,""),1===d.type&&(e=d.S[0].a,f=oM(e),g="",f===c.VIDEO?g="avc1.42E01E":f===c.AUDIO&&(g="mp4a.40.2"),d=DM(a.U,a.A,
|
|
25
|
+
a.a.hlsDefaultCodecs||g)),h=_.Y.Tn(d.$),l=pN(h.Pc.rh),l.forEach(function(R){a.J.add(R.groupId)}),_.y(M,qN(a,h),4);case 4:m=M.f;M.F(3);break;case 5:m=M.f;case 3:n=m;p=n.Lm;q=n.periods;u=n.fo;v=n.Ho;z=n.alternativeVariants;A=n.alternativeTextStreams;H=n.alternativeImageStreams;if(!a.D)throw new _.O(_.P,7,7001);rN(a,q);G=sN(a,p.delay,q,u);tN(a)||(a.H=p.Fe,uN(a));vN(a,G,q);D=nN(a,v);F={presentationTimeline:G,periods:q,minBufferTime:0,cues:D,muxedAudioTracks:l};z&&(F.alternativeVariants=z);A&&(F.alternativeTextStreams=
|
|
26
|
+
A);H&&(F.alternativeImageStreams=H);a.g.debug("HLS playlist parsed",F);return M["return"](F)}})},pN=function(a){return a.filter(function(b){return b.name===_.Ta&&_.S(b,_.$b)===_.ja&&!_.S(b,_.bc)}).map(function(b){var c=_.Y.ii(b),d=_.S(b,_.pb)||_.Lg;return{groupId:_.Kj(b,_.fb),id:_.cM++,label:_.Kj(b,_.wb),language:d,channelsCount:c,primary:"YES"===_.S(b,"DEFAULT")}})},zN=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.Y,_.y(p,xN(a,b),2);d=p.f;e=d.textStreams;f=d.thumbStreams;
|
|
27
|
+
g=d.Yj;h=a.C.periods[0].variants;a.a.lowLatencyMode&&null!==a.l&&(h=h.filter(function(q){return q.id===a.l.id}));l=h.map(function(q){var u=c.ei(q.audio,g),v=c.ei(q.video,g);q=yN(a,u,v,q.bandwidth);if(!q)throw new _.O(_.P,4,4047,{message:"Video and audio are encrypted in an incompatible way.",Fp:v?v.ec():void 0,audio:u?u.ec():void 0});return q});m=a.D.configurationId;n=hN(m,l,e,f,!0);return p["return"](n)})},xN=function(a,b){var c,d,e,f,g,h,l,m,n;return _.I(function(p){if(1==p.a)return c=_.dr,d=function(q){return q.stream.a()===
|
|
28
|
+
c.VIDEO||q.stream.a()===c.AUDIO},e=b.filter(d),f=b.filter(function(q){return!d(q)}),g=function(q){q=q.map(function(u){var v=u.stream.streams[0];u=Object.assign({},{playlist:u.playlist},{language:v.language,channelsCount:v.channelsCount,spatialAudio:v.spatialAudio,closedCaptions:v.closedCaptions,primary:v.primary,kind:v.kind||null,groupId:v.groupId,type:v.type,codecs:v.codecs,name:v.originalId,uri:v.zc,Ff:{width:v.width,height:v.height,frameRate:v.frameRate}});return AN(a,u)});return Promise.all(q)},
|
|
29
|
+
_.y(p,g(e),2);if(3!=p.a)return h=p.f,_.y(p,g(f),3);l=p.f;BN(a,h.concat(l));m=l.filter(function(q){return q.a()===c.Oj});n=l.filter(function(q){return q.a()===c.IMAGE});return p["return"]({textStreams:m,thumbStreams:n,Yj:h})})},BN=function(a,b){b.forEach(function(c){a.f.a.set(c.ec(),c)})},qN=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v,z,A,H,G;return _.I(function(D){switch(D.a){case 1:return c=_.Y,d=c.Mn(b.Pc.closedCaptions),e=CN(a,b.He),_.y(D,DN(a,b),2);case 2:return f=D.f,g=Object.values(f).flat().map(function(F){return F.playlist}),
|
|
30
|
+
EN(a,g),h=g[0],l=c.jj(h.$),a.o=l,a.K=c.kj(h.$),m=c.Sn(h.$,l,a.a.lowLatencyMode||!1,a.a.suggestedPresentationDelay,a.a.liveRefreshPeriod),_.y(D,FN(a,f.sh,e),3);case 3:return n=D.f,_.y(D,GN(a,f.He,n,d),4);case 4:return p=D.f,_.y(D,HN(a,f.Do,e),5);case 5:return q=D.f,_.y(D,IN(a,f.og),6);case 6:return u=D.f,v=a.D.configurationId,z=hN(v,p,q,u,!tN(a)),a.D.filterAllPeriods(z),A=_.th(f.He).concat(_.th(f.sh)).map(function(F){return F.playlist}),H=JN(a,A),G=KN(a,A,H),D["return"]({periods:z,fo:H,Ho:G,Lm:m})}})},
|
|
31
|
+
rN=function(a,b){tN(a)||2!==a.a.timeline.version||(a.I||(a.I=b[0].startTime),_.OG(b,-a.I))},KN=function(a,b,c){b=b.find(function(d){return null!==_.Y.cb(d.$,_.Na)});if(!b)return[];if(null===c)throw new _.O(_.P,4,4024,"EXT-X-PROGRAM-DATE-TIME tag is required when EXT-X-DATERANGE tags are present");return b.$.filter(function(d){return d.name===_.Na}).map(function(d){return _.Y.Nn(d,c,a.B,!tN(a))}).filter(Boolean)},JN=function(a,b){var c=b.flatMap(function(e){return e.S[0].$});c=_.Y.cb(c,_.Ya);if(!c)return null;
|
|
32
|
+
var d=(new Date(c.value)).getTime();return isNaN(d)?(a.g.warn("Failed to parse EXT-X-PROGRAM-DATE-TIME tag value (value: "+(c.value+").")),null):d/1E3},DN=function(a,b){var c,d,e,f,g,h;return _.I(function(l){if(1==l.a)return _.y(l,Promise.all([LN(a,b.Pc.rh),LN(a,b.Pc.Eo),LN(a,b.He),LN(a,b.og)]),2);c=l.f;d=_.w(c);e=d.next().value;f=d.next().value;g=d.next().value;h=d.next().value;return l["return"]({sh:e,Do:f,He:g,og:h})})},NN=function(a,b){return Promise.all(b.map(function(c){return MN(a,c)}))},CN=
|
|
33
|
+
function(a,b){for(var c=_.Y.Xe,d=new Map,e=_.w(b),f=e.next();!f.done;f=e.next()){var g=f.value,h=_.S(g,_.ja);f=_.S(g,_.ic);var l=_.S(g,_.Sb);g=ON(a,g);if(l){var m=_.Fj(_.Q,g);d.set(c(_.Q,l),m);l=g.indexOf(m);-1<l&&g.splice(l,1)}h&&(l=PN(_.cd,g),d.set(c(_.cd,h),l));f&&(h=PN(_.r,g),d.set(c(_.r,f),h))}return d},HN=function(a,b,c){return Promise.all(b.map(function(d){return QN(a,d,c)}))},IN=function(a,b){return Promise.all(b.map(function(c){return RN(a,c)}))},FN=function(a,b,c){var d,e;return _.I(function(f){if(1==
|
|
34
|
+
f.a){if(0===b.length)return f["return"](new Map);d=[QN(a,b[0],c)];return _.y(f,d[0],2)}if(3!=f.a)return d=d.concat(b.slice(1).map(function(g){return QN(a,g,c)})),_.y(f,Promise.all(d),3);e=f.f;return f["return"](_.Y.Io(e))})},GN=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,u,v;return _.I(function(z){if(1==z.a){e=new Set;f=_.th(b).concat();g=0;h=Infinity;for(l=0;l<f.length;++l)m=Number(_.Kj(f[l].tag,_.pa)),m<h&&(h=m,g=l);n=f.splice(g,1).pop();return _.y(z,SN(a,n,c,d,e),2)}if(3!=z.a)return p=z.f,q=f.map(function(A){return SN(a,
|
|
35
|
+
A,c,d,e)}),_.y(z,Promise.all(q),3);u=z.f;u.splice(g,0,p);v=u.reduce(_.BE,[]);return z["return"](v)})},SN=function(a,b,c,d,e){var f,g,h,l,m,n;return _.I(function(p){return 1==p.a?(f=_.Y,g=b,h=g.tag,l=Number(_.Kj(h,_.pa)),m=f.Wn(h),_.y(p,TN(a,b,m,c,d),2)):(n=p.f)?p["return"](UN(a,n,l,e)):p["return"]([])})},VN=function(a,b,c,d,e,f){var g=ON(a,b);a.g.debug("Guessing stream type for",b.toString());b=!1;var h=_.Fj(_.r,g),l=d+e;1!==g.length||c||h?!l&&1<g.length?(a.g.debug("Guessing multiplexed audio+video"),
|
|
36
|
+
c=_.r,g=[g.join(",")]):d&&f?(a.g.debug(fM),c=_.cd,b=!0):e?(a.g.debug(fM),c=_.cd):(a.g.debug("Guessing video-only"),c=_.r):(c=_.cd,a.g.debug(fM));return{type:c,Wj:g,vm:b}},TN=function(a,b,c,d,e){var f,g,h,l,m,n,p,q,u,v,z,A,H,G,D,F,M;return _.I(function(R){if(1==R.a)return f=_.dr,g=_.Y.Xe,h=b,l=h.tag,m=h.playlist,n=_.S(l,_.ja),p=_.S(l,_.ic),q=n?d.get(g(f.AUDIO,n))||[]:[],u=p?d.get(g(f.VIDEO,p))||[]:[],v={audio:q,video:u},z=m.verbatimUri,A=v.audio.find(function(la){return la.ec()===z}),H=VN(a,l,c,v.audio.length,
|
|
37
|
+
v.video.length,A),G=H.type,D=H.Wj,F=H.vm,M=null,F?R.F(2):_.y(R,WN(a,b,D,G,e,c),3);2!=R.a&&(M=R.f);if(null==M)return R["return"](null);v[G]=[M];G===f.AUDIO&&c&&v.video.forEach(function(la){TM(la,c.width);UM(la,c.height);VM(la,c.frameRate)});return R["return"](v)})},UN=function(a,b,c,d){var e=b.video,f=b.audio;e=0<e.length?e:[null];b=[];f=_.w(0<f.length?f:[null]);for(var g=f.next();!g.done;g=f.next()){g=g.value;for(var h=_.w(e),l=h.next();!l.done;l=h.next()){var m=l.value;l=_.Y.Fl(g,m);d.has(l)?a.g.debug("Skipping variant which only differs in text streams."):
|
|
38
|
+
(m=yN(a,g,m,c),null==m?a.g.warn("Incompatible DRM info in HLS variant. Skipping."):(b.push(m),d.add(l)))}}return b},yN=function(a,b,c,d){for(var e=[],f=(c||b).length(),g=0;g<f;g++){var h=b?b.streams[g]||null:null,l=c?c.streams[g]||null:null,m=_.Y.am(h,l);if(!m)return null;var n=d;h={id:a.h++,language:h?h.language:_.Lg,primary:!!h&&h.primary||!!l&&l.primary,audio:h,video:l,bandwidth:n,drmInfos:m,allowedByApplication:!0,allowedByKeySystem:!0};e.push(h)}return new ZM(e)},QN=function(a,b,c){var d,e,f,
|
|
39
|
+
g;return _.I(function(h){d=b;e=d.tag;f=d.playlist;g=f.verbatimUri;return h["return"](XN(a,g,function(){var l,m,n,p,q,u,v,z,A,H,G,D,F;return _.I(function(M){if(1==M.a){l=_.dr;m=_.Y.Xe;n=_.Kj(e,_.fb);p=_.Y.Th(_.Kj(e,_.$b));q=_.Y.Bl(e);u=c.get(m(p,n))||"";v=_.S(e,_.pb);z=_.S(e,_.wb);A=_.S(e,"DEFAULT");H=p===l.AUDIO?_.Y.ii(e):null;var R=p===l.AUDIO?(R=_.S(e,"CHANNELS"))?R.includes("/JOC"):!1:!1;G=R;D="YES"===A;return _.y(M,AN(a,{playlist:f,codecs:u,type:p,re:v,primary:D,name:z,channelsCount:H,spatialAudio:G,
|
|
40
|
+
groupId:n,kind:q,Sc:null,closedCaptions:null,Ff:null}),2)}F=M.f;return M["return"](F)})}))})},RN=function(a,b){var c,d,e,f;return _.I(function(g){c=b;d=c.tag;e=c.playlist;f=e.verbatimUri;return g["return"](XN(a,f,function(){var h,l,m,n,p;return _.I(function(q){if(1==q.a)return h=_.S(d,_.ta)||"jpg",l=_.S(d,_.pb),m=_.S(d,_.wb),_.y(q,AN(a,{playlist:e,codecs:h,type:_.He,re:l,name:m,primary:!1,kind:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,Sc:null,groupId:null,Ff:null}),2);n=q.f;(p=_.S(d,
|
|
41
|
+
_.pa))&&WM(n,Number(p));return q["return"](n)})}))})},ON=function(a,b){var c=_.S(b,_.ta,a.a.hlsDefaultCodecs||"avc1.42E01E,mp4a.40.2").split(/\s*,\s*/);c=_.Y.Jl(c);var d=new Set,e=[];c=_.w(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;var g=_.NE(f);d.has(g)?a.g.debug("Ignoring duplicate codec"):(e.push(f),d.add(g))}return e},WN=function(a,b,c,d,e,f){var g,h,l,m,n;return _.I(function(p){g=b;h=g.tag;l=g.playlist;m=_.dr;n=l.verbatimUri;return p["return"](XN(a,n,function(){var q,u,v,z,A;return _.I(function(H){if(1==
|
|
42
|
+
H.a){q=_.S(h,_.sa);u=null;d===m.VIDEO&&q&&"NONE"!==q&&(u=e.get(q));var G=_.S(h,_.ja)||void 0;v=G&&a.J.has(G)?G:void 0;G=PN(d,c);if(v){var D=PN(_.cd,c);G+=","+D}z=G;return _.y(H,AN(a,{playlist:l,codecs:z,type:d,closedCaptions:u,primary:!1,kind:null,re:null,name:null,channelsCount:null,spatialAudio:!1,Sc:null,groupId:null,muxedAudioId:v,Ff:f}),2)}A=H.f;return H["return"](A)})}))})},XN=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();
|
|
43
|
+
a.f.set(b,c);return c},AN=function(a,b){var c,d,e,f,g,h,l,m,n,p,q,u,v,z,A,H,G,D,F,M,R,la,V,za;return _.I(function(Ia){if(1==Ia.a){c=YN;d=ZN;e=_.dr;f=b;g=f.playlist;h=f.codecs;l=f.type;m=f.re;n=f.Sc;p=f.groupId;q=f.muxedAudioId;u=f.primary;v=f.kind;z=f.name;A=f.channelsCount;H=f.spatialAudio;G=f.closedCaptions;D=f.Ff;F=_.Y.mi(m);if(1!==g.type)throw new _.O(_.P,4,4017);return _.y(Ia,$N(a,g,l,h),2)}M=Ia.f;R=a.a.lowLatencyMode?d.Ij:d.Kj;la=v;l!==e.TEXT||v||(la=_.wg);V=_.Y.jj(g.$);za=M.map(function(Aa){var Ca=
|
|
44
|
+
Aa.S,La=Aa.Ll,zb=Aa.mimeType;Aa=Aa.oa;var Nd=Ca[0].startTime,Ff=Ca[Ca.length-1].endTime,ei=Ff-Nd,Od=new _.JF(Ca),Jn=Ca[0].initSegment||null;return{id:null===n?_.cM++:n,originalId:z,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:Od.ld.bind(Od),getSegmentReference:Od.get.bind(Od),adjustSegmentDurations:Od.Ld.bind(Od),getDuration:Od.getDuration.bind(Od),segmentIndex:Od,segmentLookupStrategy:R,initSegmentReference:Jn,mimeType:zb,codecs:h,kind:la,$h:La.type,encrypted:La.type===c.Nj,
|
|
45
|
+
aesEncrypted:!!La.keyInfo,keyId:La.keyId,language:F,originalLanguage:m||_.Lg,label:z,type:l,primary:u,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:D?D.frameRate:void 0,width:D?D.width:void 0,height:D?D.height:void 0,bandwidth:void 0,roles:[],channelsCount:A,spatialAudio:H,closedCaptions:G,S:Ca,drmInfos:La.drmInfos,oa:Aa,zc:g.verbatimUri,Rf:g.a,rc:Nd,jf:Ff,duration:ei,groupId:p,zp:V,muxedAudioId:q}});return Ia["return"](new RM(za))})},LN=function(a,b){var c;return _.I(function(d){if(1==d.a)return _.y(d,
|
|
46
|
+
Promise.all(b.map(function(e){var f;return _.I(function(g){if(1==g.a)return _.y(g,aO(a,e),2);f=g.f;return g["return"](f?{tag:e,playlist:f}:null)})})),2);c=d.f;return d["return"](c.filter(Boolean))})},aO=function(a,b){var c,d,e,f,g,h,l;return _.I(function(m){if(1==m.a){c=_.Y.Gm(b);d=_.S(b,_.bc,void 0,{required:c});if(!d)return m["return"](null);e=_.Y.Vd(a.A,d);return _.y(m,bO(a,e),2)}f=m.f;g=f.response;h=f.text;l=g.uri;return m["return"](oN(a,h,l,d))})},MN=function(a,b){var c,d,e,f,g,h,l,m;return _.I(function(n){if(1==
|
|
47
|
+
n.a){var p=new _.rj(b.streams[0].Rf);if(a.a.lowLatencyMode&&a.K&&a.K.wh){var q=b.streams[b.streams.length-1].segmentIndex;if(q=q.a[q.a.length-1]){var u=q.a,v=u.length-1;q={Om:q.position,Xn:u&&0<u.length?v:null}}else q=null;if(u=q)q=u.Om,u=u.Xn,v=_.kl(p.a.toString()),v._HLS_msn=q.toString(),null===u&&v._HLS_part&&delete v._HLS_part,null!==u&&(v._HLS_part=u.toString()),q=_.jl(v,!0),_.uj(p,new _.yj(q))}c=p.toString();return _.y(n,bO(a,c),2)}d=n.f;e=d.response;f=d.text;g=b.ec();h=b.streams[0].Rf;l=e.uri;
|
|
48
|
+
h!==l&&(h=l,SM(b,h));m=oN(a,f,h,g);return n["return"]({stream:b,playlist:m})})},oN=function(a,b,c,d){a=zM(a.U,b,c);a.verbatimUri=d;return a},cO=function(a){if(1<(new Set(a.map(function(b){return b.mimeType}))).size)throw new _.O(_.P,4,4045,"Media playlist contains discontinuities with different MIME types. This is valid, but not yet supported.");},dO=function(a){a=a.map(function(b){return b.a?b.a:b.f.map(function(c){return _.S(c,_.bc)})||null}).map(function(b){return _.Gj(b)});if(1<(new Set(a)).size)throw new _.O(_.P,
|
|
49
|
+
4,4044,"Unexpected change in file format.");},sN=function(a,b,c,d){var e=!0,f=null,g=0;tN(a)||(e=!1,f=0,g=b);b=a.a.timeline||{};b.type=void 0;a=new _.nF(b,f,g,!0,void 0,!!a.a.lowLatencyMode);_.qF(a,e);eO(a,c);d&&_.pF(a,d);return a},fO=function(a,b,c){a=_.Y.ac(a.$,_.Sa);if(1<a.length)throw new _.O(_.P,4,4020);a=a[0];if(!a)return null;var d=_.Kj(a,_.bc),e=_.Y.Vd(b,d);b=_.Y.hj(a,null,!0);return new _.FE(function(){return[e]},b.Da,b.pa,c)},hO=function(a,b,c,d,e,f,g){var h=[],l={};b=_.w(gO(b.f));for(var m=
|
|
50
|
+
b.next();!m.done;l={Hf:l.Hf},m=b.next()){var n=m.value;m=n.zi;n=n.item;var p=0===m,q=p?a:h[h.length-1],u=p?d:q.endTime,v=Number(_.S(n,_.Ja));v=u+v;p=_.Y.hj(n,p?null:q.pa,p);q=_.S(n,_.bc);q=_.Y.Vd(g,q);l.Hf=q?[q]:[];u=new _.Nj(c,u,v,function(z){return function(){return z.Hf}}(l),p.Da,p.pa,e,f,!1,null,null,null,null);if("YES"===_.S(n,"INDEPENDENT")||0===m)u.h=!0;h.push(u)}return h},iO=function(a,b,c,d,e,f,g,h,l,m,n){var p=c.$,q=c.a;0<_.Y.ac(p,_.Sa).length&&(n=fO(c,l,g));var u=null!=q,v=q?[q]:[];if(!u&&
|
|
51
|
+
!a.a.lowLatencyMode)return null;a=0;q={Da:0,pa:null};var z=null;u?(c=_.Y.Qn(p).duration,a=e+c,q=_.Y.ij(p,b?b.pa:null)):(b=hO(b,c,d,e,f,g,l),a=b[b.length-1].endTime,z=b);h=h===_.He?_.Y.Vn(p):null;d=new _.Nj(d,e,a,function(){return v},q.Da,q.pa,f,g,!1,null,h?h.je:null,h?h.Ge:null,h?h.durationPerTile:null,z,n);d.oa=m;return d},$N=function(a,b,c,d){var e,f,g,h,l,m,n,p,q,u,v,z,A,H;return _.I(function(G){switch(G.a){case 1:return e=_.Y,f=jO,g=kO,h=b.verbatimUri,l=b.S,m=e.em(b.$,_.Ua),n=[],!tN(a)&&g.Xj(l),
|
|
52
|
+
_.y(G,lO(a,b.a,h,l,m,c,d),2);case 2:p=G.f,q=m,u=f.Bo(l),v=0;case 3:if(!(v<u.length)){G.F(5);break}z=u[v];A=n[n.length-1]||null;return _.y(G,mO(a,b.a,z,q,p,c,d,A,u.length),6);case 6:H=G.f;n.push(H);q+=z.length;v++;G.F(3);break;case 5:return cO(n),G["return"](n)}})},lO=function(a,b,c,d,e,f,g){var h,l,m,n,p,q,u,v,z,A,H,G;return _.I(function(D){if(1==D.a){h=d[0];if(null!=a.B)return D["return"](a.B);if(!tN(a)&&a.C)try{var F=a.f.get(c),M=F?XM(F,e)||null:null;if(!M)throw new _.O(_.P,4,4030,"Segment not found in pervious playlist update.");
|
|
53
|
+
l=M.startTime+M.Ja;a.g.debug(iM+l+".");a.B=l;return D["return"](l)}catch(R){if(m=a.f.get(c))n=m.streams[0].S[0].position,D=m.streams[m.streams.length-1].S,p=D[D.length-1].position,q=e,u=e+d.length-1,a.g.warn("Last #EXT-X-MEDIA-SEQUENCE values "+n+" - "+p+(", new values "+q+" - "+u+"."),b,m);throw new _.O(_.P,4,4047,{message:"The updated playlist does not share any segments with the previous one.",uri:c});}return _.y(D,nO(a,f,g,h),2)}if(3!=D.a)return v=D.f,z=kO.Un(h,a.A,v),A=fO(h,b,z.keyInfo),H=_.Y.lg(z.keyInfo,
|
|
54
|
+
e),_.y(D,oO(a,A,h,H,v,g),3);G=D.f;a.g.debug(iM+G+".");a.B=G;return D["return"](G)})},mO=function(a,b,c,d,e,f,g,h,l){var m,n,p,q,u,v,z,A,H,G,D,F,M,R,la,V,za,Ia,Aa,Ca,La;return _.I(function(zb){switch(zb.a){case 1:return m=_.Y,n=kO,p=c[0],q=null==h,dO(c),_.y(zb,nO(a,f,g,p),2);case 2:u=zb.f;v=n.Pn(c,a.A,u,h?h.Km:null,1===l);z=v[v.length-1];A=kO.ua(v);H=fO(p,b,A.keyInfo)||(h?h.xm:null);G=_.Y.lg(A.keyInfo,d);D=p.oa;if(q){F=e;zb.F(3);break}return _.y(zb,pO(a,D,H,p,d,G,u,g),4);case 4:F=zb.f;case 3:M=F;R=
|
|
55
|
+
[];for(la=0;la<c.length;la++)if(V=c[la],za=R[R.length-1]||null,Ia=0===la?0:za.endTime,Aa=d+la,Ca=m.lg(A.keyInfo,Aa),La=iO(a,za,V,Aa,Ia,M,Ca,f,b,D,H))H=La.initSegment,R.push(La);return zb["return"]({S:R,Ll:A,Km:z,mimeType:u,endTime:R[R.length-1].endTime,oa:D,xm:H})}})},EN=function(a,b){b.forEach(function(c){var d=a.f.get(c.verbatimUri);jO.bk(c,d,!tN(a))});jO.Gl(b)},pO=function(a,b,c,d,e,f,g,h){var l;return _.I(function(m){if(1==m.a)return a.L.has(b)?m["return"](a.L.get(b)):_.y(m,oO(a,c,d,f,g,h),2);
|
|
56
|
+
l=m.f;a.g.debug("Segment #"+e+" has raw media timestamp "+(l+" s."));a.L.set(b,l);return m["return"](l)})},oO=function(a,b,c,d,e,f){var g;return _.I(function(h){if(null==c.a)return h["return"](0);g=_.Y.Dl(c,d);return h["return"](QM(a.Y,b,g,e,f,null!=d))})},PN=function(a,b){if(1===b.length)return b[0];var c=_.Fj(a,b);if(null!=c)return c;throw new _.O(_.P,4,4025,{codecList:b});},nO=function(a,b,c,d){var e,f,g;return _.I(function(h){e=d.a;g=(f=_.Y.cb(d.$,_.Sa))?_.Kj(f,_.bc):null;return h["return"](qO(a,
|
|
57
|
+
b,c,e,g))})},qO=function(a,b,c,d,e){var f,g,h,l,m;return _.I(function(n){if(1==n.a){f=[d,e].filter(Boolean);if(g=_.Ij(f,b,c))return n["return"](g);h=_.wk([d],a.a.attemptParameters);h.method="HEAD";h.type=2;return _.y(n,a.ag(h),2)}l=n.f;m=l.headers["content-type"];if(!m)throw new _.O(_.P,4,4021,"Unknown MIME type of: "+f.join(", "));return n["return"](m.split(";")[0])})},vN=function(a,b,c){c=_.Y.gm(c);"LIVE"===a.o||"EVENT"===a.o?(c=Math.max(c,b.K),isNaN(a.a.availabilityWindowOverride)||(c=a.a.availabilityWindowOverride),
|
|
58
|
+
b.A=c):a.o===_.jc&&(b.f=c)},uN=function(a){for(var b=0,c=_.w(a.f.values()),d=c.next();!d.done;d=c.next())b=Math.max(b,d.value.streams[0].rc);for(c=0;95443.7176888889<=b;)c+=95443.7176888889,b-=95443.7176888889;if(c)for(a.g.debug("Offsetting live streams by",c,"to compensate for rollover"),b=_.w(a.f.values()),d=b.next();!d.done;d=b.next())d=d.value.streams[0],95443.7176888889>d.rc?(a.g.debug("Offset applied to",d.type),d.segmentIndex.offset(c)):a.g.debug("Offset NOT applied to",d.type)},bO=function(a,
|
|
59
|
+
b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.wk([b],a.a.attemptParameters),c.type=1,_.y(f,a.ag(c),2);d=f.f;e="";try{e=_.T.da(d.data)}catch(g){throw new _.O(_.P,4,4042);}e=_.T.Si(e);e=e.trim();return f["return"]({text:e,response:d})})},tN=function(a){return a.o===_.jc},eO=function(a,b){_.Y.Hm(b,function(c,d){_.uF(a,c.S,d.startTime)});_.mF(a.a,b[0].startTime,b[b.length-1].endTime)},rO=function(){},ZN={Ij:_.ZD,Kj:_.YD},YN={Nj:lM,bp:mM,NONE:_.ef},gO=function sO(a){var c,d,e,f,g,h;return _.Ph(sO,
|
|
60
|
+
function(l){1==l.a&&(c=-1,e=d=void 0,f=_.w(a),g=f.next());if(5!=l.a){if(g.done)return-1===c?l.F(0):_.y(l,{zi:c,co:d,item:e,next:void 0},0);h=g.value;return 0<=c?_.y(l,{zi:c,item:e,co:d,next:h},5):l.F(5)}c++;d=e;e=h;g=f.next();return l.F(2)})};_.t=GM.prototype;_.t.set=function(a,b){var c=this;this.f.set(a,b);return b.then(function(d){return c.a.set(a,d)})["catch"](function(){}).then(function(){return c.f["delete"](a)})};_.t.has=function(a){return this.a.has(a)};
|
|
61
|
+
_.t.get=function(a){return this.a.get(a)||null};_.t.values=function(){return Array.from(this.a.values())};_.t.clear=function(){this.f.clear();this.a.clear()};
|
|
62
|
+
var jO={Gl:function(a){var b=jO.Vl(a),c=jO.Jm(a);a.forEach(function(d){var e=d.S,f=e.findIndex(function(h){return h.oa===b}),g=e.findIndex(function(h){return h.oa===c+1});-1===g&&(g=e.length);d.S=e.slice(f,g)})},bk:function(a,b,c){b=jO.dm(a,b,c);a=_.w(a.S||[]);for(c=a.next();!c.done;c=a.next())c=c.value,_.Y.wd(c.$,_.Oa)&&b++,c.oa=b},dm:function(a,b,c){var d=_.Y.cb(a.$,_.Pa);if(d)return Number(d.value);d=jO.zm(b);if(c&&d)try{return jO.wm(a,b)}catch(e){throw new _.O(_.P,4,4024,"EXT-X-DISCONTINUITY-SEQUENCE tag is required for discontinuous HLS live streams.");
|
|
63
|
+
}return 0},zm:function(a){return 0<jO.fm(a)},Bo:function(a){if(0===a.length)return[];var b=[],c=[];a=_.w(a);for(var d=a.next();!d.done;d=a.next())d=d.value,_.Y.wd(d.$,_.Oa)&&0<c.length&&(b.push(c),c=[]),c.push(d);b.push(c);return b},fm:function(a){if(!a)return 0;a=a.streams[a.streams.length-1].S;return a[a.length-1].oa},wm:function(a,b){var c=_.Y.cb(a.$,_.Ua);if(!c)throw jO.g.error("Failed to infer discontinuity number, because EXT-X-MEDIA-SEQUENCE tag is missing."),Error(eM);c=Number(c.value);var d=
|
|
64
|
+
XM(b,c);if(!d)throw jO.g.error("Failed to infer discontinuity number, could not find the appropriate segment in the previous playlist (segment position \x3d "+(c+")")),Error(eM);return d.oa},Jm:function(a){a=a.map(function(b){return b.S[b.S.length-1].oa});return Math.min.apply(Math,_.th(a))},Vl:function(a){a=a.map(function(b){return b.S[0].oa});return Math.max.apply(Math,_.th(a))}};jO.g=new _.K("clpp.hls.DiscontinuityUtils");var tO={"com.apple.streamingkeydelivery":function(a,b){if(b===_.Xg)throw new _.O(_.P,4,4041);if(_.Kj(a,gM)===hM)throw new _.O(_.P,4,4044,"EXT-X-KEY:METHOD SAMPLE-AES-CTR is not supported in FairPlay.");return _.EE(_.Sd,[{initDataType:_.mg,initData:new Uint8Array(0)}],"")},"com.microsoft.playready":NM,"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":NM,"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(a){var b=_.Kj(a,gM);if(!LM.includes(b))return MM.error("Widevine in HLS is only supported with [",
|
|
65
|
+
LM.join(", "),"], not",b),null;b=_.Kj(a,_.bc);b=_.Bv(b);b=_.Xj(b.data);b=_.EE(_.Xd,[{initDataType:_.vd,initData:b}],"");if(a=_.S(a,"KEYID"))b.keyIds=[a.substr(2).toLowerCase()];return b}},LM=["SAMPLE-AES",hM],MM=new _.K("clpp.hls.DrmParser");var kO={Un:function(a,b,c){return kO.Gg(a.$,b,c)||{type:_.ef,keyInfo:null,drmInfos:[],keyId:null}},Pn:function(a,b,c,d,e){if(a.slice(1).some(kO.xi))throw new _.O(_.P,4,4046,e?"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not at the beginning of the playlist.":"Media playlist contains an EXT-X-KEY tag with METHOD\x3dAES-128 which is not marked by an EXT-X-DISCONTINUITY tag and is not at the beginning of the playlist.");if(_.Y.wd(a[0].$,_.Ra)||null===d){if((d=kO.Gg(a[0].$,
|
|
66
|
+
b,c))&&d.type===mM){if(1<kO.Uh(a))throw new _.O(_.P,4,4046,jM+((e?"playlist":"discontinuity")+"."));return[d]}a=kO.fj(a,b,c);return 0===a.length?[{type:_.ef,keyInfo:null,drmInfos:[],keyId:null}]:a}b=kO.fj(a,b,c);if(d.type===_.ef||d.type===lM)return[d].concat(_.th(b));if(0<kO.Uh(a))throw new _.O(_.P,4,4046,jM+((e?"playlist":"discontinuity")+"."));return[d]},ua:function(a){if(0===a.length)return{type:_.ef,keyInfo:null,drmInfos:[],keyId:null};if(a.some(function(c){return c.type===mM})||a.every(function(c){return c.type===
|
|
67
|
+
_.ef}))return a[0];a=a.filter(function(c){return c.type===lM});var b=_.Yi(a.flatMap(function(c){return c.drmInfos}));return{keyInfo:null,keyId:a[a.length-1].keyId,type:lM,drmInfos:b}},Xj:function(a){a=kO.di(a);if(a.some(function(b){return kO.xi(b)})&&1<a.length)throw new _.O(_.P,4,4046,"Two EXT-X-KEY tags, one with METHOD\x3dAES-128 are applied to one playlist.");},xi:function(a){return _.Y.ac(a.$,_.Ra).some(function(b){return"AES-128"===_.S(b,gM)})},fj:function(a,b,c){return kO.di(a).map(function(d){return kO.Gg(d.$,
|
|
68
|
+
b,c)})},Uh:function(a){return a.filter(function(b){return _.Y.wd(b.$,_.Ra)}).length},di:function(a){return a.filter(function(b){return _.Y.wd(b.$,_.Ra)})},Gg:function(a,b,c){a=_.Y.ac(a,_.Ra);if(0===a.length)return null;var d=_.Kj(a[0],gM);if(1===a.length){if("NONE"===d)return{type:_.ef,keyInfo:null,drmInfos:[],keyId:null};if("AES-128"===d)return a=a[0],d=_.S(a,"IV",""),{type:mM,keyInfo:{method:"AES-128",url:_.Y.Vd(b,_.Kj(a,_.bc)),iv:d?_.kk((d||"0x").slice(2)):null},drmInfos:[],keyId:null}}b=a.map(function(e){return _.Kj(e,
|
|
69
|
+
gM)});if(!b.every(function(e){return"SAMPLE-AES"===e})&&!b.every(function(e){return e===hM}))throw kO.g.warn("EXT-X-KEY methods "+b.join(", ")+" are incompatible."),new _.O(_.P,4,4044,"Multiple EXT-X-KEY tags with incompatible METHOD values.");b=a.map(function(e){var f=_.S(e,"KEYFORMAT","identity"),g=tO[f]||null;(e=g?g(e,c):null)||kO.g.warn("Unsupported HLS KEYFORMAT",f);return e}).filter(Boolean);if(0===b.length)throw new _.O(_.P,4,4026);return{keyInfo:null,keyId:b.map(function(e){return e.keyIds}).reduce(function(e,
|
|
70
|
+
f){return e.concat(f)},[]).reverse()[0]||null,type:lM,drmInfos:b}},wp:function(){return{type:_.ef,keyInfo:null,drmInfos:[],keyId:null}}};kO.g=new _.K("clpp.hls.EncryptionUtils");RM.prototype.length=function(){return this.streams.length};RM.prototype.f=function(){return this.streams[0].groupId};RM.prototype.a=function(){return this.streams[0].type};RM.prototype.ec=function(){return this.streams[0].zc};ZM.prototype.length=function(){return this.a.length};_.t=lN.prototype;_.t.configure=function(a){this.a=a;this.Y.a=a};_.t.setCurrentVariant=function(a){this.l=a};_.t.start=function(a,b){var c=this,d,e,f,g,h;return _.I(function(l){if(1==l.a){if(c.P)throw Error("start() may be called only once!");c.P=!0;c.D=b;return _.y(l,bO(c,a),2)}if(3!=l.a)return d=l.f,e=d.response,f=d.text,c.A=e.uri,_.y(l,wN(c,f),3);g=l.f;c.C=g;h=c.H;c.j&&0<h&&c.j.fa(h);return l["return"](g)})};_.t.requestStop=function(){this.M=!0};
|
|
71
|
+
_.t.stop=function(){this.j&&(this.j.stop(),this.j=null);var a=[];this.G&&(a.push(this.G.destroy()),this.G=null);this.f.clear();this.C=this.a=this.D=this.l=null;this.w.clear();this.J.clear();return Promise.all(a)};
|
|
72
|
+
_.t.update=function(){var a=this,b,c,d,e,f,g,h,l,m,n;return _.I(function(p){switch(p.a){case 1:b=a.C;if(tN(a)||!b)return p["return"]();c=b.presentationTimeline;"LIVE"===a.o&&(a.B=null);d=Array.from(a.f.values());a.a.lowLatencyMode&&null!==a.l&&(e=mN(a),d=d.filter(function(q){return e.includes(q.ec())}));return _.y(p,NN(a,d),2);case 2:return f=p.f,g=f.map(function(q){return q.playlist}),EN(a,g),_.y(p,zN(a,f),3);case 3:h=p.f;aN(b.periods,h).forEach(function(q){a.D.filterNewPeriod(q)});rN(a,h);l=JN(a,
|
|
73
|
+
g);m=KN(a,g,l);b.cues=nN(a,m);cN(b.periods,h);eO(c,h);if(n=_.Y.tm(g))!0!==a.a.keepTimelineLive&&(a.o=_.jc,_.qF(c,!0),c.f=h[h.length-1].endTime),a.j.stop(),a.j=null;if(a.D.onUpdate)a.D.onUpdate(b);if(n&&a.D.onTurnedStatic)a.D.onTurnedStatic();if(!a.M){p.F(4);break}return _.y(p,a.stop(),4);case 4:return p["return"](b)}})};
|
|
74
|
+
_.t.ic=function(){var a=this,b,c;return _.I(function(d){if(1==d.a){a.g.debug(_.OD);if(!a.D)return d["return"]();_.C(d,2);return _.y(d,a.update(),4)}if(2!=d.a)return a.j&&0<a.H&&a.j.fa(a.H),_.Hh(d,0);b=_.E(d);if(!(b instanceof _.O))throw b;a.D&&(a.D.onError(b),c=b,1===c.severity&&a.j&&a.j.fa(.1));_.B(d)})};_.t.ag=function(a){if(!this.G)throw new _.O(_.P,7,7001);a=this.D.networkingEngine.fetch(a);_.Kk(this.G,a);return a.T};_.x(rO,_.Fu);rO.prototype.f=function(){_.gv.m3u8=lN;_.ev[_.tm]=lN;_.ev[kM]=lN};rO.prototype.a=function(){_.mG("m3u8");_.nG(_.tm);_.nG(kM)};rO.prototype.id=function(){return"hls"};_.J("clpp.hls.HlsComponent",rO);};
|
|
73
75
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
74
76
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
75
77
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.hlssmpte.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
c.mode=_.
|
|
6
|
-
a.m.getTrackManager().Ba())&&a.language&&a.language.toLowerCase()},
|
|
7
|
-
_.J("clpp.hlssmpte.HlsSmptePlugin",
|
|
2
|
+
var f=function(window){var YV=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.N.R(a)){a:{var b=a.info;if(_.N.ga(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.N.ga(a)?a:null}},$V=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.vi;this.h=(a=_.Ev(_.$c))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;ZV(this)},ZV=function(a){a.a.one(a.m,_.Se,function(){return aW(a)})},
|
|
3
|
+
aW=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Pc,function(d){return bW(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Ze}).forEach(function(d){bW(a,{track:d})});!cW(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."),dW(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
|
|
4
|
+
cW=function(a){return a.some(function(b){return b.kind===_.Ze})},dW=function(a,b){var c=a.m.getTrackManager(),d=c.ra(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ka(d)};a.a.on(b.textTracks,_.Pc,function(g){g.track.kind===_.Ze&&(a.a.off(b.textTracks,_.Pc,f),f())});c.Ka(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},bW=function(a,b){var c=b.track;c.kind===_.Ze&&(a.g.info("The metadata track has been added."),
|
|
5
|
+
c.mode=_.Fe,a.a.on(c,_.be,function(d){return eW(a,d)}))},eW=function(a,b){var c=fW(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new YV(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.T.ib(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},fW=function(a){return(a=
|
|
6
|
+
a.m.getTrackManager().Ba())&&a.language&&a.language.toLowerCase()},gW=function(){this.a=null;this.f=!1},hW=function(){};$V.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x(gW,_.ew);gW.prototype.onPlayerCreated=function(){};gW.prototype.onContentWillLoad=function(a){if(this.f=_.Sl()){var b=a.getConfiguration();b=_.N.nb(b.hlssmpte||{});_.N.Di(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.N.xa(b.timestampOffset)||(b.timestampOffset=0);this.a=new $V(a,b.patchMetadataTrack,b.timestampOffset)}};gW.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.F(0);a.a=null;_.B(b)})};gW.prototype.id=function(){return"hlssmpte"};
|
|
7
|
+
_.J("clpp.hlssmpte.HlsSmptePlugin",gW);gW.Id="hlssmpte";hW.prototype.create=function(){return new gW};_.bu(new hW);};
|
|
8
8
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
9
9
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
10
10
|
else{_=this.clpp._;(f.call(g,this));}
|