@castlabs/prestoplay 6.21.1-beta.13 → 6.21.1-beta.15
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/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +2 -2
- package/cjs/cl.cast.js +60 -60
- package/cjs/cl.conviva.js +22 -22
- package/cjs/cl.core.js +199 -199
- package/cjs/cl.crypto.js +1 -1
- package/cjs/cl.dash.js +27 -27
- package/cjs/cl.externs.js +30 -30
- package/cjs/cl.freewheel.js +16 -16
- package/cjs/cl.hls.js +44 -44
- package/cjs/cl.hlssmpte.js +2 -2
- package/cjs/cl.htmlcue.js +5 -5
- package/cjs/cl.ima.js +16 -16
- package/cjs/cl.mse.js +102 -102
- package/cjs/cl.muxdata.js +8 -8
- package/cjs/cl.persistent.js +3 -3
- package/cjs/cl.playlist.js +5 -5
- package/cjs/cl.sessions.js +6 -6
- package/cjs/cl.simid.js +3 -3
- package/cjs/cl.smooth.js +24 -24
- package/cjs/cl.thumbnails.js +5 -5
- package/cjs/cl.tizen.js +28 -28
- package/cjs/cl.ttml.js +4 -4
- package/cjs/cl.verimatrix.js +1 -1
- package/cjs/cl.vimond.js +8 -8
- package/cjs/cl.vr.js +7 -7
- package/cjs/cl.vtt.js +4 -4
- package/cjs/cl.yospace.js +2 -2
- package/cjs/cl.youbora.js +18 -18
- package/cl.airplay.js +1 -1
- package/cl.cast.js +30 -30
- package/cl.conviva.js +4 -4
- package/cl.core.js +145 -144
- package/cl.crypto.js +3 -3
- package/cl.dash.js +28 -28
- package/cl.externs.js +30 -30
- package/cl.freewheel.js +1 -1
- package/cl.hls.js +31 -31
- package/cl.hlssmpte.js +2 -2
- package/cl.htmlcue.js +1 -1
- package/cl.ima.js +6 -6
- package/cl.mse.js +74 -74
- package/cl.muxdata.js +1 -1
- package/cl.playlist.js +4 -4
- package/cl.sessions.js +1 -1
- package/cl.simid.js +1 -1
- package/cl.smooth.js +22 -22
- package/cl.thumbnails.js +8 -8
- package/cl.tizen.js +13 -13
- package/cl.verimatrix.js +1 -1
- package/cl.vimond.js +5 -5
- package/cl.vr.js +5 -5
- package/cl.vtt.js +2 -2
- package/cl.yospace.js +2 -2
- package/cl.youbora.js +7 -7
- package/package.json +1 -1
package/cjs/cl.muxdata.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var $B=function(a){switch(a.type){case 1:return XB;case 2:return YB;case 3:return ZB}},bC=function(a){var b=Object.keys(a).find(function(c){return aC.includes(c.toLowerCase())});return void 0!==b?a[b]:void 0},cC=function(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.Vh;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.G=this.
|
|
2
|
+
var f=function(window){var $B=function(a){switch(a.type){case 1:return XB;case 2:return YB;case 3:return ZB}},bC=function(a){var b=Object.keys(a).find(function(c){return aC.includes(c.toLowerCase())});return void 0!==b?a[b]:void 0},cC=function(a,b){this.m=a;this.o=this.f=null;this.B=("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6);this.a=new _.Vh;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.G=this.Dk.bind(this);this.C=this.Hn.bind(this)},eC=function(a){var b={debug:!0,
|
|
3
3
|
data:dC(a)};a.f&&a.f.muxOptionsOverride&&_.M.kd(a.f.muxOptionsOverride)&&(b=_.M.ra(b,a.f.muxOptionsOverride));b=_.M.ra(b,{getPlayheadTime:function(){return 1E3*a.m.getPosition()},getStateData:function(){a.g.debug("getStateData()");var c=a.m.getLoadedSource(),d=a.m.getTrackManager(),e=a.m.getSurface(),f={player_is_paused:a.m.isPaused(),player_is_fullscreen:e.isFullscreen(),video_source_duration:1E3*a.m.getDuration(),player_autoplay_on:!!a.m.getConfiguration().autoplay};if(c){var g=new _.Ok(c.url);
|
|
4
4
|
f.video_source_url=_.Pk(g);f.video_source_mime_type=c.type;c.name&&(f.video_title=c.name)}if(c=e.getContainer())f.player_width=c.offsetWidth,f.player_height=c.offsetHeight;(c=a.m.getSurface().getMedia())?c={videoWidth:c.videoWidth,videoHeight:c.videoHeight}:(c=a.m.getTrackManager().la(),c={videoWidth:c.width,videoHeight:c.height});e=c;c=e.videoWidth;e=e.videoHeight;a.g.debug("Video dimensions: "+c+"x"+e);c&&e&&(f.video_source_height=c,f.video_source_width=e);(d=d.pa())&&d.language&&(f.player_language_code=
|
|
5
5
|
d.language);return f}});a.g.debug("Mux SDK options",b);return b},dC=function(a){var b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.ua,player_software_name:_.ua,player_software_version:_.ha,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.ha};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},fC=function(a){a.a.on(a.m,_.qg,function(){var b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.qg,b)});a.a.on(a.m,_.lf,function(){return a.emit(_.lf)});
|
|
6
|
-
a.a.on(a.m,_.hd,a.
|
|
6
|
+
a.a.on(a.m,_.hd,a.Ak.bind(a));a.a.on(a.m,_.fg,a.Ck.bind(a));a.a.on(a.m,_.Ag,function(){return a.emit(_.Yf)});a.a.on(a.m,_.zg,function(){return a.emit(_.Xf)});a.a.on(a.m,_.qe,a.Bk.bind(a));a.a.on(a.m,_.tc,function(){return a.emit("adbreakstart")});a.a.on(a.m,_.uc,function(){return a.emit("adbreakend")});a.a.on(a.m,_.Jc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.Fc,function(){return a.emit("adpause")});a.a.on(a.m,_.Hc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,
|
|
7
7
|
_.Kc,function(){return a.emit("adended")});a.a.on(a.m,_.yc,function(){return a.emit("adfirstquartile")});a.a.on(a.m,_.Ec,function(){return a.emit("admidpoint")});a.a.on(a.m,_.Lc,function(){return a.emit("adthirdquartile")});a.j.Sc(a.G);a.j.Bf(a.C);a.a.on(a.m,_.qe,function(b){var c=b.detail;if(c&&1===c.category&&(b=(b=c.data)&&b.request,void 0!==b&&!0===(1===b.type||2===b.type||3===b.type)))if(7001===c.code){c=b.requestStartTimestamp;var d=new _.Ok(b.uris[b.uriIndex]);b={request_start:c,request_type:$B(b),
|
|
8
8
|
request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{d=b.requestStartTimestamp;var e=new _.Ok(b.uris[b.uriIndex]),f=c.data;b={request_start:d,request_type:$B(b),request_hostname:e.a,request_error:""+$B(b)+"LoadError",request_error_code:void 0===f?-1:void 0!==f.response?f.response.status:void 0!==f.status?f.status:-1,request_error_text:c.toString()};a.g.debug("onRequestFailed()","Track event: requestfailed",b);a.emit("requestfailed",
|
|
9
|
-
b)}})},gC=function(a){_.Yh(a.a);a.j.me(a.G);a.j.
|
|
10
|
-
_.u.emit=function(a,b){if(null===this.w)throw new _.N(1,9,9301);this.w.emit(this.B,a,b)};_.u.
|
|
11
|
-
_.u.
|
|
12
|
-
_.u.
|
|
13
|
-
request_url:_.Pk(g)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}};_.u.
|
|
14
|
-
_.u.onContentWillLoad=function(a,b){var c=a.getConfiguration();c=_.M.
|
|
9
|
+
b)}})},gC=function(a){_.Yh(a.a);a.j.me(a.G);a.j.zg(a.C)},hC=function(){this.f=this.m=null;this.a=!1;this.g=new _.K("clpp.muxdata")},iC=function(a){return!_.M.R(a)&&typeof a.init===_.ue&&typeof a.emit===_.ue},jC=function(){},XB="manifest",YB="media",ZB="encryption",aC=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];_.u=cC.prototype;_.u.initialize=function(a,b,c){this.f=a;this.o=b;this.w=c;if(!this.h){try{this.h=!0,this.w.init(this.B,eC(this))}catch(d){throw this.h=!1,gC(this),new _.N(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=dC(this),this.emit("videochange",a),this.l=!1);fC(this)};_.u.release=function(){this.g.debug("release()");this.l?this.g.debug(_.ka):(gC(this),this.l=!0,this.o=this.f=null)};_.u.destroy=function(){this.g.debug(_.Wd);this.A?this.g.debug(_.ja):(this.A=!0,this.emit("destroy"))};
|
|
10
|
+
_.u.emit=function(a,b){if(null===this.w)throw new _.N(1,9,9301);this.w.emit(this.B,a,b)};_.u.Ak=function(a){this.g.debug(_.Ye);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Xa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))};_.u.Ck=function(a){this.g.debug(_.bf);switch(a.detail.currentState){case _.aq:this.m.getConfiguration().autoplay&&this.emit(_.lf);break;case _.cq:this.emit(_.wf);break;case _.bq:this.emit(_.gf);break;case _.Wp:this.emit(_.pe)}};
|
|
11
|
+
_.u.Bk=function(a){this.g.debug(_.Ze);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.P){var b=a.message||"Player error";if(1===a.category||6100===a.code||6007===a.code)b="Download error",6100===a.code?b="Certificate request error":6007===a.code&&(b="License request error"),b=b+" castlabs-error-data:"+JSON.stringify(a.data);this.emit(_.qe,{player_error_code:a.code,player_error_message:b})}};
|
|
12
|
+
_.u.Dk=function(a){var b=a.request;if(b=void 0!==b&&!0===(1===b.type||2===b.type||3===b.type))b=a.status,b=void 0!==b&&200<=b&&299>=b;if(b){b=a.request;var c=a.headers,d=b.bytesLoaded,e=b.requestStartTimestamp,f=b.startTime,g=b.endTime,h=e+a.responseStartMs;a=e+a.timeMs;f=f&&g?g-f:void 0;g=new _.Ok(b.uris[b.uriIndex]);a={request_start:e,request_type:$B(b),request_hostname:g.a,request_id:bC(c),request_bytes_loaded:d,request_response_start:h,request_response_end:a,request_response_headers:c,request_media_duration:f,
|
|
13
|
+
request_url:_.Pk(g)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}};_.u.Hn=function(a){a.requestStartTimestamp=Date.now()};_.x(hC,_.Hv);_.u=hC.prototype;_.u.onPlayerCreated=function(a){this.m=a;this.f=new cC(a,this.g)};
|
|
14
|
+
_.u.onContentWillLoad=function(a,b){var c=a.getConfiguration();c=_.M.fb(c.muxdata);try{var d=[];typeof c===_.Xe&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.N(1,9,9300,{missingKeys:d});var e=a.getConfiguration();d=null;if(this.a=!_.M.R(e.muxdata)&&typeof e.muxdata===_.Xe){var f=e.muxdata;d=iC(f.muxLib)?f.muxLib:window.mux;if(!iC(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");this.a=!1;var g=new _.N(1,9,9301);this.S(a,g)}}else this.g.debug("Mux plugin is loaded but not configured. Will do nothing.");
|
|
15
15
|
var h=d;null!==h&&this.f.initialize(c,b,h)}catch(l){this.a=!1,this.S(a,l)}};_.u.onContentLoaded=function(){};_.u.onPlayerWillDestroy=function(){this.a&&(this.f.destroy(),this.m=this.f=null)};_.u.onPlayerWillRelease=function(){this.a&&this.f.release()};_.u.id=function(){return"mux"};_.u.emit=function(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.S(this.m,c),c;}};_.u.S=function(a,b){a.trigger(new _.L(_.qe,{detail:b}))};_.J("clpp.muxdata.MuxDataPlugin",hC);hC.prototype.emit=hC.prototype.emit;
|
|
16
16
|
hC.Id="mux";jC.prototype.create=function(){return new hC};_.gt(new jC);};
|
|
17
17
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
package/cjs/cl.persistent.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
2
|
var f=function(window){var DB="A persistent DRM session already exists for: ",EB="No DRM configuration.",FB="clpp.persistent",GB="clpp.persistent.SimpleSessionStorage",HB=function(a,b){for(var c=[],d=_.w(a),e=d.next();!e.done;e=d.next())c.push(b(e.value));return c},IB=function(a){a=a.f.keys();a=HB(a,function(b){return b.sessionId});return Array.from(a)},JB=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return _.y(f,_.fp(a,b),2);c=f.f;if(!c)return a.g.debug("Ignoring attempt to remove missing session",b),f["return"]();
|
|
3
|
-
d=[];(e=a.f.get(c))&&a.B&&(e.
|
|
3
|
+
d=[];(e=a.f.get(c))&&a.B&&(e.Nb=new _.lk,d.push(e.Nb));a.g.debug("Attempting to remove session",b);d.push(c.remove());return f["return"](Promise.all(d))})},LB=function(a,b){a.K=KB;a.L=[];a.G=!0;return _.Jo(a,b)},NB=function(a,b,c,d,e,f){a.K=MB;var g=new Map,h=_.kp(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.df,persistentState:_.Qf,sessionTypes:[_.jf],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",
|
|
4
4
|
videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.To(a,g)},OB=function(){this.g=new _.K(GB)},PB=function(a){a=JSON.parse(a);var b=JSON.parse(a.sessionIds),c=a.audioCapabilities||[],d=a.videoCapabilities||[],e=a.serverCertificate||[],f=a.drmConfig||{};return{sessionIds:b,keySystem:a.keySystem,licenseServerUri:decodeURIComponent(a.licenseServerUri||""),serverCertificate:e?new Uint8Array(e):null,audioCapabilities:c,videoCapabilities:d,drmConfig:f}},QB=function(a,b){var c=
|
|
5
|
-
_.Xm(a),d=_.Bm({drm:a});d.drm=a;var e=new _.Fo({
|
|
5
|
+
_.Xm(a),d=_.Bm({drm:a});d.drm=a;var e=new _.Fo({ub:b,onError:function(){},kg:function(){},jg:function(){},onEvent:function(){},getConfiguration:function(){return d},gd:function(){return null}});e.h=c;return e},TB=function(a,b,c){var d,e,f,g,h,l,m,n,p;return _.I(function(q){switch(q.a){case 1:d=RB;e=SB;if(!a)return e.debug(EB),q["return"]();f=a.offlineId;return 0===f.length?q["return"]():_.y(q,d.get(f),2);case 2:if(g=q.f)return e.debug(DB,f),q["return"]();h=QB(a,c);_.D(q,3,4);return _.y(q,LB(h,b),
|
|
6
6
|
6);case 6:return _.y(q,_.Zo(h),7);case 7:return _.y(q,_.$o(h),8);case 8:return l=h.getDrmInfo(),m=b.map(function(t){return{contentType:_.ql(t.video.mimeType,t.video.codecs),robustness:l.videoRobustness}}),n=IB(h),g={sessionIds:n,keySystem:l.keySystem,licenseServerUri:l.licenseServerUri,serverCertificate:l.serverCertificate,audioCapabilities:[],videoCapabilities:m,drmConfig:a},_.y(q,d.store(f,g),4);case 4:return _.sh(q),_.y(q,h.destroy(),10);case 10:_.th(q);break;case 3:throw p=_.E(q),e.error("Error while persisting DRM session "+
|
|
7
7
|
f),new _.N(1,6,6200,null,p);}})},UB=function(){this.g=new _.K(FB)},KB=1,MB=2;_.u=OB.prototype;
|
|
8
8
|
_.u.store=function(a,b){var c;return _.I(function(d){var e=JSON.stringify(b.sessionIds),f=b.serverCertificate?Array.from(b.serverCertificate):null;f=JSON.stringify(f);var g=JSON.stringify(b.audioCapabilities),h=JSON.stringify(b.videoCapabilities);c=JSON.stringify({sessionIds:e,keySystem:b.keySystem,licenseServerUri:encodeURIComponent(b.licenseServerUri),serverCertificate:f,audioCapabilities:g,videoCapabilities:h,drmConfig:JSON.stringify(b.drmConfig)});window.localStorage.setItem(encodeURIComponent(a),
|
|
9
|
-
btoa(c));_.C(d)})};_.u.get=function(a){var b=this,c;return _.I(function(d){if(c=window.localStorage.getItem(encodeURIComponent(a)))try{return d["return"](PB(atob(c)))}catch(e){b.g.warn("Error while loading offline items for "+a+" from storage: ",e)}return d["return"](null)})};_.u["delete"]=function(a){return _.I(function(b){window.localStorage.removeItem(encodeURIComponent(a));_.C(b)})};_.u.clear=function(){return _.I(function(a){window.localStorage.clear();_.C(a)})};_.u.getName=function(){return GB};_.J("clpp.persistent.useStorage",function(a){var b=["store","get","delete","clear","getName"];var c=[];_.M.R(a)||(_.M.
|
|
9
|
+
btoa(c));_.C(d)})};_.u.get=function(a){var b=this,c;return _.I(function(d){if(c=window.localStorage.getItem(encodeURIComponent(a)))try{return d["return"](PB(atob(c)))}catch(e){b.g.warn("Error while loading offline items for "+a+" from storage: ",e)}return d["return"](null)})};_.u["delete"]=function(a){return _.I(function(b){window.localStorage.removeItem(encodeURIComponent(a));_.C(b)})};_.u.clear=function(){return _.I(function(a){window.localStorage.clear();_.C(a)})};_.u.getName=function(){return GB};_.J("clpp.persistent.useStorage",function(a){var b=["store","get","delete","clear","getName"];var c=[];_.M.R(a)||(_.M.Lb(a.store)||c.push("store"),_.M.Lb(a.get)||c.push("get"),_.M.Lb(a["delete"])||c.push("delete"),_.M.Lb(a.clear)||c.push("clear"),_.M.Lb(a.getName)||c.push("getName"),b=c);if(0<b.length)throw SB.warn("Invalid session storage implementation"),new _.N(1,6,6202,{missingMethods:b});RB=a});
|
|
10
10
|
_.J("clpp.persistent.fetchLicense",function(a,b,c){for(var d=[],e=2;e<arguments.length;++e)d[e-2]=arguments[e];var f,g,h,l,m,n,p,q,t,v,z,A,F,G,B,H,O,U,X;return _.I(function(R){switch(R.a){case 1:f=RB;g=SB;h=function(qa,Ca){return new _.N(1,6,6200,qa,Ca)};l=_.gq(a).shift();if(!l)throw h("No source specified.");if(!b)throw h(EB);m=b.offlineId;if(typeof m!==_.ig||!m.length)throw h("Missing offline id.");return _.y(R,f.get(m),2);case 2:if(n=R.f)return g.debug(DB,m),R["return"]();p=_.Bm();q=new _.yk;t=
|
|
11
11
|
[];v=_.w(d);for(z=v.next();!z.done;z=v.next())A=z.value,F=new A,_.Fm(F.id())||(F.f(),_.Hm(F),t.push(F));G=null;_.D(R,3,4);return _.y(R,_.Gu(l.url,q,p.manifest.attemptParameters,l.type||null),6);case 6:return G=R.f,G.configure(p.manifest),_.y(R,G.start(l.url,{configurationId:"",networkingEngine:q,filterAllPeriods:function(){},filterNewPeriod:function(){},onEvent:function(){},onError:function(){}}),7);case 7:B=R.f;if(!B.periods.length)throw h(null,new _.N(_.P,4,4014));H=_.xu(B.periods);return _.y(R,
|
|
12
12
|
TB(b,H,q),4);case 4:for(_.sh(R);t.length;)O=t.shift(),O.a(),_.Em["delete"](O.id());U=[];G&&U.push(G.stop());U.push(q.destroy());return _.y(R,Promise.all(U),9);case 9:_.th(R);break;case 3:X=_.E(R);if(X instanceof _.N&&6200===X.code)throw X;throw h(null,X);}})});
|
package/cjs/cl.playlist.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var AB=function(a,b){b=void 0===b?function(){return Promise.resolve()}:b;_.tm.call(this);this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.
|
|
3
|
-
_.u.
|
|
4
|
-
_.u.next=function(){var a=this,b;return _.I(function(c){b=Math.min(a.a.length-1,a.f+1);return _.y(c,a.Pe(b),0)})};_.u.
|
|
5
|
-
_.u.append=function(a){this.a.push(a);BB(this)};_.u.
|
|
6
|
-
AB.prototype.insert=AB.prototype.
|
|
2
|
+
var f=function(window){var AB=function(a,b){b=void 0===b?function(){return Promise.resolve()}:b;_.tm.call(this);this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.vb.bind(this)},BB=function(a){a.trigger(new _.L(_.yf))},CB=function(a,b){return 0<=b&&b<a.a.length};_.x(AB,_.tm);_.u=AB.prototype;_.u.on=function(a,b,c){return _.tm.prototype.on.call(this,a,b,c)};_.u.one=function(a,b,c){return _.tm.prototype.one.call(this,a,b,c)};_.u.off=function(a,b){return _.tm.prototype.off.call(this,a,b)};_.u.getPosition=function(){return this.f};
|
|
3
|
+
_.u.Il=function(){return this.a};_.u.Ud=function(){return 0<this.a.length&&CB(this,this.f)?this.a[this.f]:null};_.u.Kl=function(){var a=this.f+1;return 0<this.a.length&&CB(this,a)?this.a[a]:null};_.u.$l=function(){return this.h};_.u.start=function(){this.h||(this.h=!0,this.m.on(_.pe,this.j),this.Pe(this.f,!0))};_.u.stop=function(){this.h=!1;this.m.off(_.pe,this.j)};_.u.vb=function(){this.next()};
|
|
4
|
+
_.u.next=function(){var a=this,b;return _.I(function(c){b=Math.min(a.a.length-1,a.f+1);return _.y(c,a.Pe(b),0)})};_.u.An=function(){var a=this,b;return _.I(function(c){b=Math.max(0,a.f-1);return _.y(c,a.Pe(b),0)})};_.u.Pe=function(a,b){b=void 0===b?!1:b;var c=this,d;return _.I(function(e){if(1==e.a){if(!(0<c.a.length&&CB(c,a))||!b&&c.f===a)return e["return"]();c.f=a;return(d=c.Ud())?_.y(e,c.l(d),3):e.F(0)}if(4!=e.a)return _.y(e,c.m.load(d.configuration),4);c.trigger(new _.L(_.xf,{item:d}));_.C(e)})};
|
|
5
|
+
_.u.append=function(a){this.a.push(a);BB(this)};_.u.Vl=function(a,b){if(0<=b&&b<=this.a.length){var c=this.Ud();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));BB(this)}};_.u.remove=function(a){if(0<this.a.length&&CB(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);BB(this)}};_.u.clear=function(){this.stop();this.f=0;this.a=[];this.h=!1;BB(this)};_.J("clpp.Playlist",AB);AB.prototype.clear=AB.prototype.clear;AB.prototype.remove=AB.prototype.remove;
|
|
6
|
+
AB.prototype.insert=AB.prototype.Vl;AB.prototype.append=AB.prototype.append;AB.prototype.goTo=AB.prototype.Pe;AB.prototype.previous=AB.prototype.An;AB.prototype.next=AB.prototype.next;AB.prototype.onEnded=AB.prototype.vb;AB.prototype.stop=AB.prototype.stop;AB.prototype.start=AB.prototype.start;AB.prototype.isStarted=AB.prototype.$l;AB.prototype.getUpcoming=AB.prototype.Kl;AB.prototype.getCurrent=AB.prototype.Ud;AB.prototype.getQueue=AB.prototype.Il;AB.prototype.getPosition=AB.prototype.getPosition;
|
|
7
7
|
AB.prototype.off=AB.prototype.off;AB.prototype.one=AB.prototype.one;AB.prototype.on=AB.prototype.on;};
|
|
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;});}
|
package/cjs/cl.sessions.js
CHANGED
|
@@ -7,13 +7,13 @@ a;this.h=b;this.duration=c;this.j=d;this.f=[]},KA=function(a,b){this.f=a;this.ur
|
|
|
7
7
|
63|128;this.data=a},RA=function(){this.headers=[]},SA=function(){},TA=function(a){this.j=a;this.f=this.h=this.time=this.sessionId=null},UA=function(){this.f=null;this.events=[]},VA=function(){this.f=this.h=null},WA=function(){this.f=this.h=null},XA=function(a){var b=new WA;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},$A=function(a,b,c,d,e){var f=new Uint8Array([]),g=this;var h=void 0===h?2500:h;this.o=f;this.l=e;this.w=new QA;this.A=new QA;this.a=[];this.h=setInterval(function(){return YA(g)},h);
|
|
8
8
|
this.f=null;this.j=!1;ZA(this,a,b,c,d)},aB=function(a){return _.I(function(b){switch(b.a){case 1:a.h&&(clearInterval(a.h),a.h=null);if(!a.f){b.F(2);break}return _.y(b,a.f,2);case 2:if(!(0<a.a.length)){b.F(4);break}return _.y(b,YA(a),5);case 5:a.a=[];case 4:a.j=!0,_.C(b)}})},ZA=function(a,b,c,d,e){var f=new RA;f.headers=[new NA("CL-BROWSER-NAME",b),new NA("CL-BROWSER-VERSION",c),new NA("CL-OS-FAMILY",d),new NA("CL-OS-VERSION",e),new NA("CL-SDK-NAME",uA),new NA("CL-SDK-NAME",uA),new NA("CL-SDK-VERSION",
|
|
9
9
|
_.ha)];bB(a,f)},YA=function(a){var b,c,d,e;return _.I(function(f){if(1==f.a){if(a.j||a.f)return f["return"]();0===a.a.length&&bB(a,new SA);b=function(){};a.f=new Promise(function(g){b=g});_.qh(f);c=new UA;c.f=a.o;c.events.push.apply(c.events,_.dh(a.a));d=_.dh(a.a).concat();return _.y(f,fetch(a.l,{method:_.Eb,headers:{"Content-Type":"application/proto"},body:new Uint8Array(c.a())}),4)}if(2!=f.a)if(e=f.f,e.ok)a.a=a.a.filter(function(g){return!d.includes(g)});else throw Error("An error occurred while sending telemetry events to the API, status\x3d'"+
|
|
10
|
-
(e.status+"' statusText\x3d'"+e.statusText+"'"));_.sh(f);b();a.f=null;return _.th(f)})},bB=function(a,b){if(!a.j){var c=new TA(a.w);c.sessionId=a.A;var d=Date.now(),e=new VA;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;c.time=e;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},cB=function(){this.reason=this.currentState=this.previousState=null},dB=function(){this.m=null;this.a=this.l=!1;this.f=new _.Vh;this.h=null;this.g=new _.K("clpp.sessions.SessionsPlugin");this.o=this.
|
|
11
|
-
lB=function(a){switch(a){case _.Pp:return eB;case _.aq:return fB;case _.Up:return gB;case _.cq:return hB;case _.bq:return iB;case _.Wp:return jB;case _.$p:return kB;default:return null}},tB=function(a,b){switch(a){case 1:return mB;case 2:return b===_.r?nB:b===_.$c?oB:b===_.Q?pB:b===_.ye?qB:rB;case 3:return sB;default:return rB}},uB=function(a){var b;_.I(function(c){if(1==c.a)return a.g.info("Destroy the session and stop sending events."),_.Yh(a.f),a.a=!1,b=a.m.getNetworkEngine(),b.
|
|
10
|
+
(e.status+"' statusText\x3d'"+e.statusText+"'"));_.sh(f);b();a.f=null;return _.th(f)})},bB=function(a,b){if(!a.j){var c=new TA(a.w);c.sessionId=a.A;var d=Date.now(),e=new VA;e.h=Math.floor(d/1E3);e.f=d%1E3*1E6;c.time=e;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},cB=function(){this.reason=this.currentState=this.previousState=null},dB=function(){this.m=null;this.a=this.l=!1;this.f=new _.Vh;this.h=null;this.g=new _.K("clpp.sessions.SessionsPlugin");this.o=this.Jm.bind(this);this.j=this.Im.bind(this)},
|
|
11
|
+
lB=function(a){switch(a){case _.Pp:return eB;case _.aq:return fB;case _.Up:return gB;case _.cq:return hB;case _.bq:return iB;case _.Wp:return jB;case _.$p:return kB;default:return null}},tB=function(a,b){switch(a){case 1:return mB;case 2:return b===_.r?nB:b===_.$c?oB:b===_.Q?pB:b===_.ye?qB:rB;case 3:return sB;default:return rB}},uB=function(a){var b;_.I(function(c){if(1==c.a)return a.g.info("Destroy the session and stop sending events."),_.Yh(a.f),a.a=!1,b=a.m.getNetworkEngine(),b.zg(a.o),b.me(a.j),
|
|
12
12
|
vA(b,a.j),a.h?_.y(c,aB(a.h),3):c.F(0);a.h=null;_.C(c)})},vB=function(a,b){a.g.debug("Sending event",b);bB(a.h,b)},wB=function(){};xA.prototype.length=function(){return this.a.length};xA.prototype.end=function(){var a=this.a;this.a=[];return a};JA.prototype.a=function(){var a=new xA;HA(a,1,this.downloadId);AA(a,2,this.h);HA(a,3,this.duration);AA(a,4,this.j);HA(a,5,this.f);return a.end()};JA.prototype.getId=function(){return 4};KA.prototype.a=function(){var a=new xA;AA(a,1,this.f);HA(a,2,this.downloadId);FA(a,3,this.url);HA(a,4,this.headers);FA(a,5,null);HA(a,6,null);HA(a,7,this.duration);DA(a,8,this.size);return a.end()};KA.prototype.getId=function(){return 2};LA.prototype.a=function(){var a=new xA;AA(a,1,this.h);IA(a,2,this.f);return a.end()};MA.prototype.a=function(){var a=new xA;AA(a,1,this.errorCode);AA(a,2,this.severity);FA(a,3,this.message);FA(a,4,this.f);HA(a,5,this.cause);return a.end()};MA.prototype.getId=function(){return 7};NA.prototype.a=function(){var a=new xA;FA(a,1,this.key);FA(a,2,this.value);return a.end()};OA.prototype.a=function(){var a=new xA;AA(a,1,this.code);AA(a,2,this.severity);HA(a,3,this.cause);return a.end()};OA.prototype.getId=function(){return 12};PA.prototype.a=function(){var a=new xA;IA(a,1,this.data);return a.end()};_.x(QA,PA);QA.prototype.toString=function(){for(var a=[],b=0;256>b;++b)a.push((b+256).toString(16).slice(1));return a[this.data[0]]+a[this.data[1]]+a[this.data[2]]+a[this.data[3]]+"-"+a[this.data[4]]+a[this.data[5]]+"-"+a[this.data[6]]+a[this.data[7]]+"-"+a[this.data[8]]+a[this.data[9]]+"-"+a[this.data[10]]+a[this.data[11]]+a[this.data[12]]+a[this.data[13]]+a[this.data[14]]+a[this.data[15]]};RA.prototype.a=function(){var a=new xA;HA(a,1,this.headers);return a.end()};RA.prototype.getId=function(){return 1};SA.prototype.a=function(){return(new xA).end()};SA.prototype.getId=function(){return 6};TA.prototype.a=function(){var a=new xA;HA(a,1,this.j);HA(a,2,this.sessionId);HA(a,3,this.time);DA(a,4,null);FA(a,5,null);AA(a,6,this.h);IA(a,7,this.f);return a.end()};UA.prototype.a=function(){var a=new xA;IA(a,1,this.f);HA(a,2,this.events);return a.end()};VA.prototype.a=function(){var a=new xA;DA(a,1,this.h);AA(a,2,this.f);return a.end()};WA.prototype.a=function(){var a=new xA;DA(a,1,this.h);AA(a,2,this.f);return a.end()};cB.prototype.a=function(){var a=new xA;AA(a,1,this.previousState);AA(a,2,this.currentState);AA(a,3,this.reason);HA(a,4,null);HA(a,5,null);HA(a,6,null);return a.end()};cB.prototype.getId=function(){return 5};_.x(dB,_.Hv);_.u=dB.prototype;_.u.onPlayerCreated=function(a){this.m=a};
|
|
13
|
-
_.u.onContentWillLoad=function(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Xe))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.va),this.g.info("Create a session and start sending events."),a=_.vk(),this.h=new $A(a.browser,a.browserVersion.name,a.os,a.osVersion.name,b.apiUrl),this.f.on(this.m,_.fg,this.
|
|
14
|
-
this.
|
|
15
|
-
_.u.
|
|
16
|
-
_.u.
|
|
13
|
+
_.u.onContentWillLoad=function(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.Xe))||this.g.debug("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.va),this.g.info("Create a session and start sending events."),a=_.vk(),this.h=new $A(a.browser,a.browserVersion.name,a.os,a.osVersion.name,b.apiUrl),this.f.on(this.m,_.fg,this.Hk.bind(this)),this.f.on(this.m,_.Yf,this.Gk.bind(this)),this.f.on(this.m,_.Xf,
|
|
14
|
+
this.Fk.bind(this)),this.f.on(this.m,_.qe,this.S.bind(this)),a=this.m.getNetworkEngine(),a.Bf(this.o),a.Sc(this.j),a.j.push(this.j)):(this.g.warn(tA),a.onError(new _.N(1,9,15E3,tA)))};_.u.onPlayerWillRelease=function(){uB(this)};_.u.id=function(){return"sessions"};_.u.Hk=function(a){if(!this.a){a=a.detail;var b=a.currentState,c=new cB;c.previousState=lB(a.previousState);c.currentState=lB(b);vB(this,c)}};
|
|
15
|
+
_.u.Gk=function(){if(!this.a){var a=new cB;a.previousState=lB(this.m.getState());a.currentState=xB;vB(this,a);this.a=!0}};_.u.Fk=function(){if(this.a){var a=new cB;a.previousState=xB;a.currentState=lB(this.m.getState());vB(this,a);this.a=!1}};_.u.S=function(a){a=a.detail;var b=new OA;b=new MA(new LA(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.P?yB:zB;vB(this,b)};
|
|
16
|
+
_.u.Jm=function(a){var b=new QA;a.downloadId=b;var c=new KA(tB(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(function(d){return new NA(d,a.headers[d])});vB(this,c)};_.u.Im=function(a){var b=a.request.downloadId;b?(b=new JA(b,a.data.byteLength,XA(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(function(c){return new NA(c,a.headers[c])}),vB(this,b)):this.g.warn("Download ID is missing on download completed event.")};wB.prototype.create=function(){return new dB};
|
|
17
17
|
_.gt(new wB);var zB=1,yB=2;var eB=0,fB=2,kB=3,xB=5,gB=6,hB=8,iB=10,jB=11;var mB=0,nB=1,oB=2,pB=3,qB=4,sB=5,rB=9;};
|
|
18
18
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
19
19
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
package/cjs/cl.simid.js
CHANGED
|
@@ -6,14 +6,14 @@ this.g=new _.K("clpp.simid.SimidPlayer");hA(this.f,this)},lA=function(a){var b=j
|
|
|
6
6
|
width:g.clientWidth},creativeDimensions:{x:0,y:0,height:g.clientHeight,width:g.clientWidth},fullscreen:f.isFullscreen(),fullscreenAllowed:!0,variableDurationAllowed:!1,skippableState:"notSkippable",version:"1.1",skipoffset:"",siteUrl:window.location.toString(),appId:"",useragent:"",deviceId:"",muted:e.m.isMuted()||!1,volume:e.m.getVolume()||0,navigationSupport:"adHandles",closeButtonSupport:"adHandles",nonlinearDuration:e.f.duration},creativeData:{adParameters:e.f.adParameters||"",clickThruUri:"",
|
|
7
7
|
clickThruUrl:""}};e=jA(a,"SIMID:Player:init",e);e=kA(a,e);return _.y(d,e,4)}if(2!=d.a)return a.g.info("Player Init acknowledged"),a.f.g.info("SIMID Player initialized"),_.rh(d,0);c=_.E(d);a.g.error("Error while initializing",c);a.f.g.error("Error while initializing SIMID player: ",c);a.unload();_.C(d)})},jA=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},mA=function(a,b){a.h?(b.type!==cA&&a.g.info("Posting message ["+b.messageId+"] '"+b.type+"':",b.args),
|
|
8
8
|
a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn("WARNING: no session available to send message '"+b.type+"'")},gA=function(a,b){mA(a,jA(a,"resolve",{messageId:b.messageId,value:void 0}))},kA=function(a,b){return new Promise(function(c,d){new nA(a.j,c,d,b);mA(a,b)})},nA=function(a,b,c,d){var e=this;var f=void 0===f?-1:f;this.f=a;this.l=b;this.j=c;this.h=d;this.a=null;this.f.set(d.messageId,this);0<=f&&(this.a=setTimeout(function(){e.resolve()},f))},oA=function(){this.g=
|
|
9
|
-
new _.K("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.
|
|
9
|
+
new _.K("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.Ik.bind(this);this.f=null;this.o=!1},pA=function(a,b,c){return new ResizeObserver(function(){if(a.a.h){var d=a.a,e={videoDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},creativeDimensions:{x:0,y:0,height:b.clientHeight,width:b.clientWidth},fullscreen:c.isFullscreen()};e=jA(d,"SIMID:Player:resize",e);mA(d,e)}})},qA=function(a){this.m=a;this.a=null;this.g=new _.K("clpp.simid.Loader");this.h=!1;this.f=
|
|
10
10
|
null},fA=function(a,b){var c=a.getContainer(),d=c.clientWidth;c=c.clientHeight;return{top:b.y/c*100+"%",left:b.x/d*100+"%",width:b.width/d*100+"%",height:b.height/c*100+"%"}},hA=function(a,b){a.g.info("SIMID Session created");a.a=b},rA=function(a){a.g.info("Stopping creative");a.m.getSurface().getMedia().style.transition=".5s";setTimeout(function(){a.m.getSurface().getMedia().style.transition=""},500);a.m.getSurface().getMedia().style.left="";a.m.getSurface().getMedia().style.top="";a.m.getSurface().getMedia().style.width=
|
|
11
11
|
"";a.m.getSurface().getMedia().style.height="";a.a.a.style.left="";a.a.a.style.top="";a.a.a.style.width="";a.a.a.style.height="";a.h=!1;a.m.trigger(new _.L(_.ag))},sA=function(){};iA.prototype.load=function(a){window.addEventListener(_.Pe,this.o);this.h="";this.l=0;var b=this.f.url();this.g.info('Loading "'+b+'" as src of iFrame');this.a.src=b;this.g.info("Attaching iFrame");a.appendChild(this.a)};
|
|
12
12
|
iA.prototype.unload=function(){rA(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Pe,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)};nA.prototype.resolve=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.l(a)};nA.prototype.reject=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.j(a)};_.x(oA,_.Hv);_.u=oA.prototype;_.u.id=function(){return"simid"};_.u.onPlayerCreated=function(a){this.g.info("New player created");this.a&&(this.a.unload(),this.a=null);this.m=a;this.h&&this.h.release();this.h=new qA(a)};
|
|
13
13
|
_.u.onContentWillLoad=function(a){var b=a.getConfiguration();if(b.simid&&b.simid.creatives&&0!==b.simid.creatives.length)if(this.l=b.simid.creatives,this.g.info("Setting up SIMID plugin for "+this.l.length+" creatives"),b=this.m.getSurface()){this.g.info("Creating new session");this.a=new iA(this.h);var c=b.getContainer();this.j=pA(this,c,b);this.j.observe(c);a.on(_.qg,this.w)}else this.g.warn(bA)};
|
|
14
|
-
_.u.
|
|
14
|
+
_.u.Ik=function(){var a=this.m.getPosition();a:if(this.f&&a<this.f.startTime+this.f.duration)var b=this.f;else{for(b=0;b<this.l.length;b++){var c=this.l[b],d=c.startTime+c.duration;if(a>=c.startTime-(c.preload||5)&&a<d){b=c;break a}}b=null}b?b===this.f?(b=b.startTime,this.a&&(c=a>=b,!this.o&&c&&(lA(this.a),this.o=!0,this.g.info(dA)),c&&(c=this.a,mA(c,jA(c,cA,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(bA),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=
|
|
15
15
|
b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)};_.u.onPlayerWillRelease=function(a){_.Hv.prototype.onPlayerWillRelease.call(this,a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.qg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))};_.u=qA.prototype;_.u.release=function(){this.g.info("Releasing loader")};
|
|
16
|
-
_.u.getContainer=function(){var a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.N(1,10,10100,"No player container found");return a};_.u.getSurface=function(){var a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.N(1,10,10100,"No surface");return a};_.u
|
|
16
|
+
_.u.getContainer=function(){var a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.N(1,10,10100,"No player container found");return a};_.u.getSurface=function(){var a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.N(1,10,10100,"No surface");return a};_.u.bi=function(){return this.a};_.u.url=function(){return this.f?this.f.url:""};sA.prototype.create=function(){return new oA};
|
|
17
17
|
_.gt(new sA);};
|
|
18
18
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
19
19
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
package/cjs/cl.smooth.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
2
|
var f=function(window){var nR="Full MP4 box must have flags defined",oR="clpp.smooth.SmoothMP4Processor",pR="codecPrivateData",qR=function(a,b){var c=Math.floor(b/Math.pow(2,32)),d=b-c*Math.pow(2,32);_.V(a,c);_.V(a,d)},rR=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.bn()}},sR=function(a,b){rR(a,b>>16&255);rR(a,b>>8&255);rR(a,b&255)},tR=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.bn()}},uR=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.bn()}},vR=function(a,b){try{a.f.setInt16(a.a,
|
|
3
3
|
b,a.h),a.a+=2}catch(c){_.bn()}},wR=function(a,b){if(void 0!==b){for(var c=new Uint8Array(b),d=Math.min(a.length,b),e=0;e<d;++e)c[e]=a.charCodeAt(e);for(;e<b;e++)c[e]=0;return c}c=new Uint8Array(a.length);for(d=0;d<a.length;++d)c[d]=a.charCodeAt(d);return c},xR=function(a){this.type=a;this.size=this.start=0;this.parent=null;this.A=!1;this.entries=[];this.f=[]},Z=function(a,b,c){xR.call(this,a);this.version=b;this.flags=c},yR=function(a,b,c){xR.call(this,a);this.h=b;this.offset=c},zR=function(a,b,c,
|
|
4
|
-
d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},AR=function(a,b,c){xR.call(this,"ftyp");this.j=a;this.
|
|
4
|
+
d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},AR=function(a,b,c){xR.call(this,"ftyp");this.j=a;this.yi=b;this.h=c},BR=function(){xR.call(this,_.Te)},CR=function(){xR.call(this,_.rg)},DR=function(a,b,c){Z.call(this,"mvhd",1,0);this.timescale=a;this.duration=b;this.volume=256;this.j=c+1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},ER=function(){xR.call(this,"mvex")},FR=function(a){Z.call(this,"trex",0,0);this.h=a},GR=function(a,b,c,d,e){Z.call(this,"tkhd",1,7);
|
|
5
5
|
this.j=a;this.duration=b;this.timescale=c;this.width=d;this.height=e;this.volume=1;this.h=[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0]},HR=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},IR=function(a){Z.call(this,"hdlr",0,0);this.h=a},JR=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},KR=function(a){xR.call(this,a);this.A=!0},LR=function(a){KR.call(this,a);this.height=this.width=0;this.depth=24},MR=
|
|
6
6
|
function(a,b,c,d){KR.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},NR=function(a,b){LR.call(this,"avc1");this.width=a;this.height=b},OR=function(a,b){NR.call(this,a,b);this.type="encv"},PR=function(a,b,c){MR.call(this,"mp4a",a,b,c)},QR=function(a,b,c){PR.call(this,a,b,c);this.type="enca"},RR=function(a,b){xR.call(this,"avcC");this.ab=a;this.jc=b;this.version=1;this.h=this.ab[0][1];this.j=this.ab[0][2];this.level=this.ab[0][3]},SR=function(a){Z.call(this,"esds",0,0);this.gc=
|
|
7
7
|
a},TR=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},UR=function(){Z.call(this,"dref",0,0)},VR=function(){xR.call(this,_.hg)},WR=function(){Z.call(this,_.jg,0,0)},YR=function(){Z.call(this,"stts",0,0)},ZR=function(){Z.call(this,"stsc",0,0)},$R=function(){Z.call(this,"stco",0,0)},aS=function(){Z.call(this,"stsz",0,0)},bS=function(){Z.call(this,"smhd",0,0)},cS=function(){xR.call(this,"dinf")},dS=function(){xR.call(this,_.Se)},eS=function(){xR.call(this,_.Oe)},fS=function(a,b){Z.call(this,
|
|
8
8
|
"tfdt",a,0);this.baseMediaDecodeTime=b},gS=function(){Z.call(this,"mfhd",0,0);this.h=0},hS=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},iS=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},jS=function(){xR.call(this,"traf")},kS=function(){xR.call(this,"moof")},lS=function(){xR.call(this,_.Ne);this.h=new Uint8Array(0)},mS=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},nS=
|
|
9
|
-
function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.ac=""},oS=function(a){xR.call(this,"frma");this.h=a},pS=function(){Z.call(this,"saio",0,0);this.offset=[0]},qS=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},rS=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},sS=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},tS=function(a,b,c,d){c=b.
|
|
9
|
+
function(a,b){Z.call(this,"schm",0,0);this.h=a;this.j=b;this.ac=""},oS=function(a){xR.call(this,"frma");this.h=a},pS=function(){Z.call(this,"saio",0,0);this.offset=[0]},qS=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},rS=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},sS=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},tS=function(a,b,c,d){c=b.Rh[c];b=b.mo;a=a.replace("Manifest","");b=b.replace("{bitrate}",
|
|
10
10
|
String(d.bitrate)).replace("{Bitrate}",String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.WD([a],[b])[0]},uS=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.r?c=["maxWidth","maxHeight","bitrate",pR,"fourCC"]:a.type===_.$c&&(c=["bitrate",pR,"channels","bitsPerSample","samplingRate","fourCC"]);return _.M.oa(a,b,c,["id","segmentIndex"])},vS=function(a,b,c){var d=c.Ie.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,ab:null,
|
|
11
|
-
jc:null,width:NaN,height:NaN,gc:null,oe:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.ab=[_.Rj(d[1])];a.jc=[_.Rj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.gc=_.Rj(c.Ie),a.sampleSize=c.
|
|
11
|
+
jc:null,width:NaN,height:NaN,gc:null,oe:NaN,sampleSize:NaN,channelCount:NaN};switch(c.type){case _.r:a.ab=[_.Rj(d[1])];a.jc=[_.Rj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.gc=_.Rj(c.Ie),a.sampleSize=c.Ej||16,a.oe=c.oe,a.channelCount=c.ih}return a},wS=function(a,b){return a.filter(function(c){return c.type===b})},xS=function(a,b){var c=a.exec(b);return null==c||""===c[0]?null:(Number(c[4])||0)/1E3+(Number(c[3])||0)+60*(Number(c[2])||0)+3600*(Number(c[1])||0)},ES=function(a,b,
|
|
12
12
|
c){var d=null;if(yS.test(a)){a=yS.exec(a);d=Number(a[1]);var e=Number(a[2]),f=Number(a[3]),g=Number(a[4]);g+=(Number(a[5])||0)/c.f;f+=g/c.frameRate;d=f+60*e+3600*d}else zS.test(a)?d=xS(zS,a):AS.test(a)?d=xS(AS,a):BS.test(a)?(a=BS.exec(a),d=Number(a[1])/c.frameRate):CS.test(a)?(a=CS.exec(a),d=Number(a[1])/c.a):DS.test(a)&&(d=xS(DS,a));d+=b;b=Math.floor(d/3600);c=Math.floor((d-3600*b)/60);a=Math.floor(d-3600*b-60*c);d-=a;10>b&&(b="0"+b);10>c&&(c="0"+c);10>a&&(a="0"+a);0===d?d="000":d=Math.round(1E3*
|
|
13
13
|
d);return b+":"+c+":"+a+"."+d},FS=function(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=parseInt(a[1],10)/parseInt(a[2],10))},HS=function(a){this.a=a;this.f=GS(this)},GS=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.an(b)},IS=function(a,b,c){a:{var d=_.w([_.Pd,_.Nd]);for(var e=d.next();!e.done;e=d.next())if((e=c.Ne(e.value))&&e.keyId){d=e.keyId;break a}_.Gh(oR,
|
|
14
14
|
"Could not get default Key ID for DRM init data!");d=null}c=new xR("xxxx");a.type===_.r?c=new OR(a.width,a.height):c=new QR(a.channelCount,a.sampleSize,a.oe);a=new mS;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new xR("schi")).append([a]);b=(new xR(_.bg)).append([new oS(b),new nS(_.rd,65536),a]);c.append([b]);return c},JS=function(a,b){var c=b.Re(),d=new DR(a.timescale,a.duration,a.id),e=(new ER).append([new FR(a.id)]),f=new GR(a.id,a.duration,a.timescale,a.width,a.height),g=new HR(a.timescale,
|
|
15
15
|
a.duration),h=new IR(a.type),l=null,m=new UR;m.entries=[new TR];var n=new WR;switch(a.type){case _.r:var p=new RR(a.ab,a.jc);c?(l=IS(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new NR(a.width,a.height)).append([p]),n.entries=[l]);l=new JR;break;case _.$c:p=new SR(a.gc),c?(l=IS(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new PR(a.channelCount,a.sampleSize,a.oe)).append([p]),n.entries=[l]),l=new bS}n=(new VR).append([n,new YR,new ZR,new aS,new $R]);m=(new cS).append([m]);m=(new dS).append([l,m,n]);
|
|
16
|
-
g=(new eS).append([g,h,m]);f=(new CR).append([f,g]);d=(new BR).append([d,f,e]);e=new AR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Ne(_.Nd),f=b.Ne(_.Pd),c&&d.append([new yR("pssh",c.initData,8)]),f&&d.append([new yR("pssh",f.initData,8)]),c||f||_.Gh(oR,"Could not get PSSH init data!"));c=new HS([e,d]);return _.Ej(c.write())},LS=function(a,b){var c,d,e,f,g,h;(new _.on).M("moof",_.pn).
|
|
17
|
-
m.flags)throw new _.N(_.P,3,3019,nR);var p=new iS(m.version||0,m.flags||0);p.h=_.jn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.ln(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.B=_.jn(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.jn(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.jn(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.jn(m.reader));d=p}).
|
|
18
|
-
0,m.flags||0);p.h=_.jn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.l=_.kn(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.jn(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.jn(m.reader)),m.flags&512&&p.sampleSize.push(_.jn(m.reader)),m.flags&1024&&p.B.push(_.jn(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.jn(m.reader)):p.j.push(_.kn(m.reader)));e=p}).
|
|
19
|
-
0,n,0)}).M("uuid",function(m){var n=_.nn(m.reader,16);if(_.Tj(n,KS)){n=_.jn(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new rS(m.version,m.flags);n.j=_.jn(m.reader);m.flags&1&&(n.l=_.gn(m.reader));for(var p=0;p<n.j;p++){var q={
|
|
16
|
+
g=(new eS).append([g,h,m]);f=(new CR).append([f,g]);d=(new BR).append([d,f,e]);e=new AR("dash",0,["iso6","mp41","avc1"]);c&&(c=b.Ne(_.Nd),f=b.Ne(_.Pd),c&&d.append([new yR("pssh",c.initData,8)]),f&&d.append([new yR("pssh",f.initData,8)]),c||f||_.Gh(oR,"Could not get PSSH init data!"));c=new HS([e,d]);return _.Ej(c.write())},LS=function(a,b){var c,d,e,f,g,h;(new _.on).M("moof",_.pn).Z("mfhd",function(m){var n=new gS;n.h=_.jn(m.reader);c=n}).M("traf",_.pn).Z("tfhd",function(m){var n=m.reader.Qa();if(null===
|
|
17
|
+
m.flags)throw new _.N(_.P,3,3019,nR);var p=new iS(m.version||0,m.flags||0);p.h=_.jn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.ln(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.B=_.jn(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.jn(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.jn(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.jn(m.reader));d=p}).Z("trun",function(m){var n=m.reader.Qa();if(null===m.flags)throw new _.N(_.P,3,3019,nR);var p=new hS(m.version||
|
|
18
|
+
0,m.flags||0);p.h=_.jn(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.l=_.kn(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.jn(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.jn(m.reader)),m.flags&512&&p.sampleSize.push(_.jn(m.reader)),m.flags&1024&&p.B.push(_.jn(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.jn(m.reader)):p.j.push(_.kn(m.reader)));e=p}).Z("sdtp",function(m){var n=_.nn(m.reader,m.reader.Qa());f=new zR("sdtp",m.version||0,m.flags||
|
|
19
|
+
0,n,0)}).M("uuid",function(m){var n=_.nn(m.reader,16);if(_.Tj(n,KS)){n=_.jn(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new rS(m.version,m.flags);n.j=_.jn(m.reader);m.flags&1&&(n.l=_.gn(m.reader));for(var p=0;p<n.j;p++){var q={hi:_.nn(m.reader,8),qd:0,Jg:[]};if(m.flags&2){q.qd=_.hn(m.reader);for(var t=0;t<q.qd;t++){var v={fh:0,gh:0};v.fh=_.hn(m.reader);v.gh=_.jn(m.reader);q.Jg.push(v)}}n.h.push(q)}g=n}}).M(_.Ne,function(m){var n=new lS;0<m.reader.Qa()?n.h=_.nn(m.reader,m.reader.Qa()):(_.Gh(oR,
|
|
20
20
|
"mdat box is empty!"),n.h=new Uint8Array(0));h=n}).parse(a,!1);if(!h)return null;var l=(new jS).append([d,e]);f&&l.append([f]);b.Re()&&g&&l.append([g]);l=(new kS).append([c,l]);return new HS([l,h])},MS=function(a,b,c,d){var e=d.Re(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=LS(b,d);if(null===g)return a.request.contentType===_.Q?a.data:g;d=g.get(_.Ne);if(a.request.contentType===_.Q){e=d.h.buffer;if(c){e=_.S.Rd(e);if((e=(new DOMParser).parseFromString(e,_.pg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=
|
|
21
21
|
e.documentElement;if(h&&(d=new FS(h.getAttribute("ttp:frameRate"),h.getAttribute("ttp:subFrameRate"),h.getAttribute("ttp:frameRateMultiplier"),h.getAttribute("ttp:tickRate")),h=h.getElementsByTagName("body")[0]))for(h=h.getElementsByTagName("p"),a=0,b=h.length;a<b;a++){f=h[a];g=c;for(var l=["begin",_.oe],m=0,n=l.length;m<n;m++){b:{var p=f;var q=l[m],t=new RegExp("\\w+:"+q),v=0;if(p.hasAttribute(q))p=p.getAttribute(q);else{q=p.attributes;for(var z=q.length;v<z;v++){var A=q[v].name;if(A=A.match(t)){p=
|
|
22
22
|
p.getAttribute(A[0]);break b}}p=null}}f.setAttribute(l[m],ES(p||"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.S.bb(e).buffer}else c=e;return c}h=new kS;a=g.get("mfhd");b=new jS;l=g.get("tfhd");m=new fS(1,f);f=g.get("trun");n=g.get("sdtp");c=g.get("senc");l.h=1;l.flags&=16777214;l.flags|=131072;b.append([l,m,f]);n&&b.append([n]);if(e){g=0;l=[];if(c.flags&2)for(l=[],m=0;m<c.j;m++)l.push(10+6*c.h[m].qd);else g=8;b.append([c,new pS,new qS(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=
|
|
23
23
|
new HS([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},NS=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},OS=function(a,b,c){a=_.xo(a);c&&a.version!==c&&(a=_.MD(a,c));return{initData:_.KD(a),initDataType:_.rd,keyId:b,periodId:null}},QS=function(){this.w=this.h=this.f=
|
|
24
|
-
this.D=null;this.N=1;this.P=0;this.l="";this.B=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.L=PS;this.H=0;this.C=this.I=Infinity;this.o=[];this.K=this.
|
|
24
|
+
this.D=null;this.N=1;this.P=0;this.l="";this.B=this.a=null;this.g=new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.L=PS;this.H=0;this.C=this.I=Infinity;this.o=[];this.K=this.In.bind(this);this.G=new Map},RS=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return c=_.dk(b),c.timeout=a.f.attemptParameters.timeout,c.maxAttempts=Math.max(a.f.attemptParameters.maxAttempts,b.length),c.baseDelay=a.f.attemptParameters.baseDelay,c.backoffFactor=a.f.attemptParameters.backoffFactor,
|
|
25
25
|
c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),_.y(f,d.U,2);e=f.f;a.l=e.uri;return f["return"](e)})},YS=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.S.Rd(b);var f=d.parseFromString(e.trim(),_.pg)}catch(wJ){throw wJ;}if(f&&f.documentElement.tagName===_.Xb)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(wJ){}if(!c)throw a.g.error("Unable to parse manifest"),new _.N(_.P,4,4033,a.l);var h=+SS(a,c,"MajorVersion"),
|
|
26
26
|
l=+SS(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+SS(a,c,"Duration"),p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.bo(c,"Protection")[0];if(!1===/^[2].[0-2]$/.test(""+h+"."+l))throw a.g.error("Smooth Streaming version must be 2.0, 2.1 or 2.2"),new _.N(_.P,4,4036,a.l);p?(TS(a,US),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):TS(a,PS);a.a={startTime:0,delay:0,
|
|
27
27
|
duration:n/m,Qf:t/m,fe:0};if(v){var z=a.f.playreadyVersion,A=[],F=_.bo(v,"ProtectionHeader")[0],G=_.Qj(_.eo(F)||""),B=_.xo(G).a;A.push(NS(_.Pd,{initData:_.KD(_.jo(B)),initDataType:_.rd,keyId:B,periodId:null},[B]));A.push(NS(_.Nd,OS(G,B,z),[B]));a.o=A}var H=[],O=_.bo(c,"StreamIndex");if(!O.length)throw a.g.error("No streams found!"),new _.N(_.P,4,4034,a.l);for(var U=0;U<O.length;U++){for(var X,R=a,qa=O[U],Ca=SS(R,qa,"Type"),fb=+qa.getAttribute("Chunks"),Wa=qa.getAttribute("Subtype"),Ma=qa.getAttribute("Language")||
|
|
28
|
-
_.ug,wb=_.vj(Ma),Jb=qa.getAttribute("Name")||"",Dg=+qa.getAttribute(_.rb),oo=+qa.getAttribute(_.qb),IW=SS(R,qa,"Url"),JW=+qa.getAttribute("TimeScale")||null,zJ=[],AJ=_.bo(qa,_.Mb),
|
|
29
|
-
+SS(Ef,Ld,"SamplingRate"),EJ=+SS(Ef,Ld,"AudioTag"),DJ=+SS(Ef,Ld,"BitsPerSample"),FJ=+SS(Ef,Ld,"PacketSize")}var
|
|
30
|
-
Df[1].toString(16)}else rc=new Uint8Array(2),rc[0]=16|qo>>1,rc[1]=qo<<7|HJ<<3,Df=new Uint16Array(1),Df[0]=(rc[0]<<8)+rc[1],
|
|
31
|
-
isNaN(ai))throw R.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.P,4,4037,R.l);0===pk&&isNaN(je)&&(qk=je=0);if(0<pk){var Gg=Me[Me.length-1];qk=Gg.n+1;Gg.d||(Gg.d=je-Gg.t);je||(je=Gg.t+Gg.d);ai||(ai=je-Gg.t)}Me.push({n:qk,d:ai,t:je});if(
|
|
32
|
-
Me.length+").");H.push({type:Ca,
|
|
33
|
-
0;
|
|
34
|
-
TJ.next()){var UJ=
|
|
28
|
+
_.ug,wb=_.vj(Ma),Jb=qa.getAttribute("Name")||"",Dg=+qa.getAttribute(_.rb),oo=+qa.getAttribute(_.qb),IW=SS(R,qa,"Url"),JW=+qa.getAttribute("TimeScale")||null,zJ=[],AJ=_.bo(qa,_.Mb),fv=0;fv<AJ.length;fv++){var Df=void 0,rc=void 0,gv=void 0,Ef=R,Ld=AJ[fv],hv=Ca,KW=+Ld.getAttribute("Index"),LW=+SS(Ef,Ld,"Bitrate"),BJ=NaN,CJ=NaN,po=NaN,iv=NaN,DJ=NaN,EJ=NaN,FJ=NaN,GJ=Ld.getAttribute("FourCC");switch(hv){case _.r:BJ=+SS(Ef,Ld,_.qb);CJ=+SS(Ef,Ld,_.rb);break;case _.$c:iv=+Ld.getAttribute("Channels")||2,po=
|
|
29
|
+
+SS(Ef,Ld,"SamplingRate"),EJ=+SS(Ef,Ld,"AudioTag"),DJ=+SS(Ef,Ld,"BitsPerSample"),FJ=+SS(Ef,Ld,"PacketSize")}var jv=String(Ld.getAttribute("CodecPrivateData"));if(hv===_.$c&&!jv){var HJ=iv,IJ={96E3:0,88200:1,64E3:2,48E3:3,44100:4,32E3:5,24E3:6,22050:7,16E3:8,12E3:9,11025:10,8E3:11,7350:12},qo=IJ[po];if("AACH"===GJ){rc=new Uint8Array(4);var JJ=IJ[2*po];rc[0]=40|qo>>1;rc[1]=qo<<7|HJ<<3|JJ>>1;rc[2]=JJ<<7|8;rc[3]=0;Df=new Uint16Array(2);Df[0]=(rc[0]<<8)+rc[1];Df[1]=(rc[2]<<8)+rc[3];gv=Df[0].toString(16)+
|
|
30
|
+
Df[1].toString(16)}else rc=new Uint8Array(2),rc[0]=16|qo>>1,rc[1]=qo<<7|HJ<<3,Df=new Uint16Array(1),Df[0]=(rc[0]<<8)+rc[1],gv=Df[0].toString(16);jv=gv.toUpperCase()}var MW={id:Ef.P++,type:hv,index:KW,bitrate:LW,Ie:jv,maxHeight:BJ,maxWidth:CJ,oe:po,ih:iv,Co:EJ,Ej:DJ,To:FJ,sl:GJ,segmentIndex:null};zJ.push(MW)}X=zJ;for(var Me=[],KJ=_.bo(qa,"c"),pk=0;pk<KJ.length;pk++){var kv=KJ[pk],je=parseInt(kv.getAttribute("t"),10),ai=parseInt(kv.getAttribute("d"),10),lv=parseInt(kv.getAttribute("r"),10),qk=0;if(isNaN(je)&&
|
|
31
|
+
isNaN(ai))throw R.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),new _.N(_.P,4,4037,R.l);0===pk&&isNaN(je)&&(qk=je=0);if(0<pk){var Gg=Me[Me.length-1];qk=Gg.n+1;Gg.d||(Gg.d=je-Gg.t);je||(je=Gg.t+Gg.d);ai||(ai=je-Gg.t)}Me.push({n:qk,d:ai,t:je});if(lv){lv--;for(var LJ=0;LJ<lv;LJ++){var ro=Me[Me.length-1];qk=ro.n+1;je=ro.t+ro.d;ai=ro.d;Me.push({n:qk,d:ai,t:je})}}}R.Hd()||Me.length===fb||R.g.warn("Number of fragments ("+fb+") differs from number of chunks ("+
|
|
32
|
+
Me.length+").");H.push({type:Ca,Ho:fb,Wn:Wa,language:wb,ee:Ma,name:Jb,maxWidth:Dg,maxHeight:oo,mo:IW,tracks:X,Rh:Me,timescale:JW})}var Ff={Ro:h,yi:l,timescale:m,duration:n,isLive:p,Qo:q,Qf:t,Zf:!1,streams:H};if(a.h&&a.w)return VS(a,Ff),Promise.resolve();a.G.clear();var mv=Ff.timescale,so=Ff.duration,OW=wS(Ff.streams,_.$c),PW=wS(Ff.streams,_.r),QW=wS(Ff.streams,_.Q),MJ=[],to=WS(a,so,mv,OW),uo=WS(a,so,mv,PW),RW=WS(a,so,mv,QW);to.length||(to=[null]);uo.length||(uo=[null]);for(var ov=0;ov<uo.length;ov++)for(var pv=
|
|
33
|
+
0;pv<to.length;pv++)MJ.push(XS(a,uo[ov],to[pv]));var NJ={id:"ID",configurationId:void 0,startTime:0,endTime:so,variants:MJ,textStreams:RW,thumbStreams:[]};var TW=Ff.streams,qv=a.a.startTime,OJ=a.a.delay,rv=a.I,PJ=Math.min(a.a.duration||Infinity,rv),sv=a.Hd(),UW=a.a.Qf,VW=a.a.fe,QJ=a.H,RJ=isFinite(a.C)?a.C:0;if(sv)PJ=Infinity,qv=Date.now()/1E3-VW,a.a.startTime=qv,OJ=3*QJ;else for(var WW=isFinite(rv)?rv:a.a.duration,SJ=_.w(TW),uv=SJ.next();!uv.done;uv=SJ.next())for(var TJ=_.w(uv.value.tracks),vv=TJ.next();!vv.done;vv=
|
|
34
|
+
TJ.next()){var UJ=vv.value;UJ.segmentIndex.offset(-RJ);_.tE(UJ.segmentIndex,WW)}var VJ=a.f.timeline||{};VJ.type=void 0;a.B=new _.BE(VJ,qv,OJ,!sv,!0);a.B.f=PJ;_.JE(a.B,QJ);a.B.A=UW;sv||a.B.offset(-RJ);a.D.filterAllPeriods([NJ]);a.h={presentationTimeline:a.B,periods:[NJ],minBufferTime:0,cues:[]};Promise.resolve();a.J||(a.D.networkingEngine.Sc(a.K),a.J=!0);a.w=Ff;return Promise.resolve()},VS=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.w(a.w.streams[c].tracks),g=
|
|
35
35
|
f.next();!g.done;e={ec:e.ec},g=f.next())if(e.ec=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.ec.type&&m.bitrate===l.ec.bitrate}}(e))){uS(e.ec,g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=ZS(a,a.w.timescale,d,g);g=e.ec.segmentIndex;g.ra(h);(h=a.a.Qf)&&_.ZE(g,_.YE(g)-h).forEach(function(l){l.Za().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.ec.type+" track with bitrate "+
|
|
36
36
|
(e.ec.bitrate+". Skipping update."))},WS=function(a,b,c,d){for(var e=[],f={Nc:0};f.Nc<d.length;f={Nc:f.Nc},f.Nc++){var g=d[f.Nc].tracks.map(function(h){return function(l){var m=d[h.Nc],n=ZS(a,c,m,l);n=new _.XE(n);var p=null;m.type!==_.Q&&(p=$S(a,b,c,m,l));l.segmentIndex=n;var q=_.cL++,t=Promise.resolve.bind(Promise),v=n.Zc.bind(n),z=n.get.bind(n),A=n.zd.bind(n),F=n.getDuration.bind(n),G=aT[m.type],B="";switch(m.type){case _.r:B=l.Ie;var H=/00000001[0-9]7/.exec(B);B="avc1."+(H&&H[0]?B.substr(B.indexOf(H[0])+
|
|
37
|
-
10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.$c:B=l.Ie,H=2,"AACH"===l.
|
|
38
|
-
void 0,kind:H,encrypted:a.ag(),keyId:null,language:m.language,originalLanguage:m.ee,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.
|
|
39
|
-
0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.r||c.type===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.fe?a.a.fe=b.endTime:a.a.fe=Math.min(a.a.fe,b.endTime);return f},$S=function(a,b,c,d,e){b=vS(b,d.timescale||c,e);c={isLive:a.Hd.bind(a),Re:a.ag.bind(a),
|
|
37
|
+
10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.$c:B=l.Ie,H=2,"AACH"===l.sl?H=5:B&&(H=(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+H,a.g.debug("AUDIO CODECS: ",B)}H=m.type===_.Q?bT[m.Wn]:void 0;return{id:q,originalId:null,Vo:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:A,getDuration:F,segmentIndex:n,segmentLookupStrategy:_.sD,initSegmentReference:p,mimeType:G,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||
|
|
38
|
+
void 0,kind:H,encrypted:a.ag(),keyId:null,language:m.language,originalLanguage:m.ee,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],channelsCount:l.ih||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},ZS=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Rh.forEach(function(h,l){var m=h.d/g;if(0===l){var n=h.t/g;a.C=Math.min(a.C,n)}else n=f[l-1].endTime;var p=n+m,q=tS(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.tj(l,n,p,function(){return[q]},
|
|
39
|
+
0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.r||c.type===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.fe?a.a.fe=b.endTime:a.a.fe=Math.min(a.a.fe,b.endTime);return f},$S=function(a,b,c,d,e){b=vS(b,d.timescale||c,e);c={isLive:a.Hd.bind(a),Re:a.ag.bind(a),Al:function(){return 1},Ne:a.Uh.bind(a)};d=new Uint8Array(0);try{d=JS(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.N(_.P,3,4035,g);}var f="data:text/plain;base64,"+_.Pj(d);return new _.YD(function(){return[f]},
|
|
40
40
|
0,null,null,!0)},XS=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.ug;return c||b?{id:a.N++,language:e,primary:!1,audio:c,video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},SS=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.N(_.P,4,4038,a.l,c);},cT=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Zb.bind(a),b))},TS=function(a,b){var c=b===PS;a.h&&a.h.presentationTimeline&&
|
|
41
41
|
_.EE(a.h.presentationTimeline,c);c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.L=b},dT=function(){};xR.prototype.append=function(a){a=void 0===a?[]:a;for(var b=0;b<a.length;b++)this.f.push(a[b]),a[b].parent=this;return this};xR.prototype.get=function(a){if(this.type===a)return this;for(var b=0;b<this.f.length;b++){if(this.f[b].type===a)return this.f[b];var c=this.f[b].get(a);if(c)return c}return null};
|
|
42
42
|
xR.prototype.a=function(){var a=Math.pow(2,32)-1;var b=4+this.type.length;"uuid"===this.type&&(b+=16);if(0<this.f.length)for(var c=0;c<this.f.length;c++)b+=this.f[c].a();this.size>a&&(b+=8);return b};
|
|
43
43
|
xR.prototype.write=function(a){var b=Math.pow(2,32)-1;this.start=a.getPosition();this.size=this.a();this.size>b?_.V(a,1):_.V(a,this.size);_.cn(a,wR(this.type));this.size>b&&qR(a,this.size);"uuid"===this.type&&_.cn(a,null);if(0<this.f.length&&!this.A)for(b=0;b<this.f.length;b++)this.f[b].write(a),this.f[b].a(),a.getPosition()};_.x(Z,xR);Z.prototype.a=function(){return 4+xR.prototype.a.call(this)};Z.prototype.write=function(a){xR.prototype.write.call(this,a);rR(a,this.version);sR(a,this.flags)};
|
|
44
44
|
_.x(yR,xR);yR.prototype.a=function(){return this.h.byteLength+xR.prototype.a.call(this)-this.offset};yR.prototype.write=function(a){xR.prototype.write.call(this,a);_.cn(a,this.h,this.offset);a.getPosition()};_.x(zR,Z);zR.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};zR.prototype.write=function(a){Z.prototype.write.call(this,a);_.cn(a,this.h,this.offset);a.getPosition()};_.x(AR,xR);
|
|
45
|
-
AR.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+xR.prototype.a.call(this)};AR.prototype.write=function(a){xR.prototype.write.call(this,a);_.cn(a,wR(this.j));_.V(a,this.
|
|
45
|
+
AR.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+xR.prototype.a.call(this)};AR.prototype.write=function(a){xR.prototype.write.call(this,a);_.cn(a,wR(this.j));_.V(a,this.yi);_.cn(a,wR(this.h.join("")));a.getPosition()};_.x(BR,xR);_.x(CR,xR);_.x(DR,Z);DR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;a=a+44+this.h.length;return a+=Z.prototype.a.call(this)};
|
|
46
46
|
DR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(qR(a,0),qR(a,0),_.V(a,this.timescale),qR(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);tR(a,this.volume);tR(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)rR(a,this.h[b]);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,0);_.V(a,this.j);a.getPosition()};_.x(ER,xR);_.x(FR,Z);FR.prototype.a=function(){return 20+Z.prototype.a.call(this)};
|
|
47
47
|
FR.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.h);_.V(a,1);_.V(a,0);_.V(a,0);_.V(a,0);a.getPosition()};_.x(GR,Z);GR.prototype.a=function(){var a=0;a=1===this.version?a+32:a+20;a=a+24+this.h.length;return a+Z.prototype.a.call(this)};
|
|
48
48
|
GR.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(qR(a,0),qR(a,0),_.V(a,this.j),_.V(a,0),qR(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.j),_.V(a,0),_.V(a,this.duration*this.timescale));_.V(a,0);_.V(a,0);tR(a,0);tR(a,0);tR(a,this.volume);tR(a,0);for(var b=0;b<this.h.length;b++)rR(a,this.h[b]);tR(a,this.width);tR(a,0);tR(a,this.height);tR(a,0);a.getPosition()};_.x(HR,Z);HR.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
|
|
@@ -65,12 +65,12 @@ lS.prototype.a=function(){return this.h.byteLength+xR.prototype.a.call(this)};lS
|
|
|
65
65
|
mS.prototype.write=function(a){Z.prototype.write.call(this,a);rR(a,0);0===this.version?rR(a,0):rR(a,0);rR(a,this.h);rR(a,this.j);_.cn(a,_.Rj(this.o));if(1===this.h&&0===this.j){rR(a,0);for(var b=0;b<this.l.length;b++)rR(a,this.l[b])}a.getPosition()};_.x(nS,Z);nS.prototype.a=function(){var a=8;this.flags&1&&(a+=wR(this.ac).byteLength);return a+Z.prototype.a.call(this)};nS.prototype.write=function(a){Z.prototype.write.call(this,a);_.cn(a,wR(this.h));_.V(a,this.j);this.flags&1&&_.cn(a,wR(this.ac));a.getPosition()};
|
|
66
66
|
_.x(oS,xR);oS.prototype.a=function(){return wR(this.h).byteLength+xR.prototype.a.call(this)};oS.prototype.write=function(a){xR.prototype.write.call(this,a);_.cn(a,wR(this.h));a.getPosition()};_.x(pS,Z);pS.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=4;for(var b=0;1>b;b++)a=0===this.version?a+4:a+8;return a+Z.prototype.a.call(this)};
|
|
67
67
|
pS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));_.V(a,1);for(var b=0;1>b;b++)0===this.version?_.V(a,this.offset[b]):qR(a,this.offset[b]);a.getPosition()};_.x(qS,Z);qS.prototype.a=function(){var a=0;this.flags&1&&(a+=8);a+=5;0===this.h&&(a+=this.l.length);return a+Z.prototype.a.call(this)};
|
|
68
|
-
qS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));rR(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)rR(a,this.l[b]);a.getPosition()};_.x(rS,Z);rS.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].
|
|
69
|
-
rS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&rR(a,this.l);for(var b=0;b<this.j;b++)if(_.cn(a,this.h[b].
|
|
68
|
+
qS.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));rR(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)rR(a,this.l[b]);a.getPosition()};_.x(rS,Z);rS.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].hi.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].qd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
|
|
69
|
+
rS.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&rR(a,this.l);for(var b=0;b<this.j;b++)if(_.cn(a,this.h[b].hi),this.flags&2){tR(a,this.h[b].qd);for(var c=0;c<this.h[b].qd;c++)tR(a,this.h[b].Jg[c].fh),_.V(a,this.h[b].Jg[c].gh)}a.getPosition()};var yS=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,zS=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,AS=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,BS=/^(\d*\.?\d*)f$/,CS=/^(\d*\.?\d*)t$/,DS=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;HS.prototype.get=function(a){for(var b=0;b<this.a.length;b++){var c=this.a[b].get(a);if(c)return c}return null};HS.prototype.write=function(){this.f=GS(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var KS=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.u=QS.prototype;_.u.configure=function(a){this.f=a};_.u.start=function(a,b){var c=this;this.D=b;var d=_.dh(new Set([a,sS(a)])).concat();return RS(this,d).then(function(e){return YS(c,e.data).then(function(){cT(c,c.A);return c.h})})};_.u.requestStop=function(){};_.u.stop=function(){this.D&&this.D.networkingEngine.me(this.K);this.A=this.w=this.h=this.f=this.D=null;this.j&&(clearTimeout(this.j),this.j=null);this.J=!1;this.I=this.C=Infinity;return Promise.resolve()};
|
|
70
70
|
_.u.update=function(){var a=this;if(this.Hd())return RS(this,[this.l]).then(function(b){return YS(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.u.setCurrentVariant=function(){};_.u.Zb=function(){var a=this;this.g.debug(_.kD);this.D&&(this.j=null,this.update().then(function(){cT(a,a.A)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&cT(a,100))}))};_.u.Hd=function(){return this.L===US};_.u.ag=function(){return 0<this.o.length};
|
|
71
|
-
_.u.
|
|
72
|
-
_.u.
|
|
73
|
-
!0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};var aT={video:_.Ig,audio:_.dd,text:_.Xc},PS=_.gc,US="LIVE",bT={
|
|
71
|
+
_.u.Uh=function(a){var b=null;if(this.o.length)for(var c=0;c<this.o.length;c++)if(this.o[c].keySystem===a){b=this.o[c].initData[0];break}return b};
|
|
72
|
+
_.u.In=function(a){if(2!==a.request.type||a.uri.startsWith("data:"))return Promise.resolve(a);var b=a.request.timescale||this.w.timescale,c={isLive:this.Hd.bind(this),Re:this.ag.bind(this),Al:function(){return 1},Ne:this.Uh.bind(this)},d=!1,e=new _.N(_.P,3,4035,null),f=null;try{var g=this.G.get(a.request.uris[a.request.uriIndex])||a.request.startTime||0;g!==a.request.startTime&&this.g.debug("Using base media decode time "+g+" instead of segment reference time "+a.request.startTime);f=MS(a,b,g,c)}catch(h){d=
|
|
73
|
+
!0,e.data=h,3E3===h.code&&(e.code=4039)}if(d||!f)return Promise.reject(e);a.data=f;return Promise.resolve(a)};var aT={video:_.Ig,audio:_.dd,text:_.Xc},PS=_.gc,US="LIVE",bT={oo:_.nd,vo:_.lg};_.x(dT,_.Kt);dT.prototype.f=function(){_.Ju.ism=QS;_.Hu[_.Yc]=QS};dT.prototype.a=function(){_.AF("ism");_.BF(_.Yc)};dT.prototype.id=function(){return _.cg};_.J("clpp.smooth.SmoothComponent",dT);};
|
|
74
74
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
75
75
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
76
76
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.thumbnails.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
2
|
var f=function(window){var yz="No thumbnail found for position: ",zz="Position is out of range: ",Az="Thumbnail URL is mandatory",Bz="Wrong gridSize format",Cz="clpp.thumbnails",Dz=function(){this.log=new _.K(Cz);this.player=null;this.a=[];this.w=!1},Fz=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Xe&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return Ez(a,0,e,!!f)})},Promise.resolve())},Ez=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return Gz(a,d).then(function(){return a.a[b].load()}).then(function(){return Ez(a,
|
|
3
|
-
e,c,d)})},Gz=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Up)c();else a.player.one(_.jd,function(){c()})})},Hz=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ta=p;this.
|
|
3
|
+
e,c,d)})},Gz=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Up)c();else a.player.one(_.jd,function(){c()})})},Hz=function(a,b,c,d,e,f,g,h,l,m,n,p){d=void 0===d?0:d;e=void 0===e?0:e;f=void 0===f?0:f;g=void 0===g?0:g;h=void 0===h?1:h;l=void 0===l?1:l;m=void 0===m?0:m;n=void 0===n?0:n;p=void 0===p?new Image:p;this.time=b;this.src=a;this.duration=c;this.x=d;this.y=e;this.width=f;this.height=g;this.ta=p;this.Xk=h;this.Ln=l;this.Ol=m;this.Pl=n;this.bg=null},Iz=function(){Dz.call(this);
|
|
4
4
|
this.f=null;this.o=this.h=1;this.j=0},Jz=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.ld=new _.lk},Kz=function(){this.g=new _.K(Cz);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.lk},Lz=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.ld.resolve()})},Nz=function(a,b){return Mz(a,b).then(function(c){return new Hz(c,b.time,b.duration)})},Mz=function(a,b){return b.load().then(function(){var c=_.Ej(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
|
|
5
|
-
_.Oj(c)})},Oz=function(){Dz.call(this);this.f=null},Pz=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},Qz=function(){Dz.apply(this,arguments)},Rz=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{$d:c,
|
|
5
|
+
_.Oj(c)})},Oz=function(){Dz.call(this);this.f=null},Pz=function(a){a=a.split(/\.|:/).map(parseFloat);var b=0,c,d={3:.001,2:1,1:60,0:3600};for(c=a.length-1;0<=c;c--)b+=a[c]*d[c];return b},Qz=function(){Dz.apply(this,arguments)},Rz=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{$d:c,Sg:d,gi:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},Sz=function(){this.g=new _.K(Cz);this.a=this.m=null},Tz=function(a){return a.some(function(b){return 0<
|
|
6
6
|
b.thumbStreams.length})},Yz=function(a){return a?a===Uz||a===Vz?new Iz:a===Wz?new Oz:a===Xz?new Kz:null:null},Zz=function(a){if(!a)return null;a=new _.Ok(a);return a.path.match(/.*\.vtt$/i)?Wz:a.path.match(/.*\.bif$/i)?Xz:a.path.match(/.*\.(png|jpg|jpeg)$/i)?Uz:null},$z=function(){};Dz.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Of,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&Fz(c,b.preload)})};Hz.prototype.raw=function(){return this.ta.cloneNode(!1)};
|
|
7
7
|
Hz.prototype.element=function(a,b){var c=this.width,d=this.height,e=this.width/this.height;void 0!==a&&void 0===b&&(b=0);null!==a&&void 0!==a&&(c=a);null!==b&&void 0!==b&&(d=b);c||(c=Math.ceil(d*e));d||(d=Math.ceil(c/e));e=document.createElement(_.Yd);e.style.width=c+_.Lf;e.style.height=d+_.Lf;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.ta.naturalWidth||this.ta.width))+"px "+Math.ceil(d/
|
|
8
8
|
this.height*(this.ta.naturalHeight||this.ta.height))+_.Lf;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Lf;e.style.backgroundPositionY="-"+f*d+_.Lf;return e};
|
|
9
|
-
Hz.prototype.load=function(){var a=this;this.bg||(this.bg=new Promise(function(b,c){function d(){a.width||(a.width=(a.ta.naturalWidth||a.ta.width)/a.
|
|
9
|
+
Hz.prototype.load=function(){var a=this;this.bg||(this.bg=new Promise(function(b,c){function d(){a.width||(a.width=(a.ta.naturalWidth||a.ta.width)/a.Xk);a.height||(a.height=(a.ta.naturalHeight||a.ta.height)/a.Ln);a.x||(a.x=a.width*a.Ol);a.y||(a.y=a.height*a.Pl)}if(a.ta.src&&a.ta.complete)d(),b(a);else{var e=null,f=function(){d();a.ta.removeEventListener(_.He,f);a.ta.removeEventListener(_.qe,e);b(a)};e=function(g){a.ta.removeEventListener(_.He,f);a.ta.removeEventListener(_.qe,e);c(new _.N(1,9,2014,
|
|
10
10
|
"Failed to load thumbnail.",g))};a.ta.addEventListener(_.He,f);a.ta.addEventListener(_.qe,e);a.ta.src=a.src}}));return this.bg};_.J("clpp.thumbnails.Thumbnail",Hz);Hz.prototype.load=Hz.prototype.load;Hz.prototype.element=Hz.prototype.element;Hz.prototype.raw=Hz.prototype.raw;_.x(Iz,Dz);
|
|
11
11
|
Iz.prototype.init=function(a,b){if(!b||!b.url)throw new _.N(1,9,7100,Az);if("GRID"===b.mode&&!b.gridSize)throw new _.N(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.N(1,9,7100,"Duration is mandatory");this.f=b;this.j=this.f.duration;if(this.f.gridSize)try{var c=this.f.gridSize.split(/x/).map(function(d){return parseInt(d,10)}).filter(function(d){return 0<d});if(2===c.length)this.h=c[0],this.o=c[1];else throw new _.N(1,9,7100,Bz);}catch(d){throw this.log.error("Error during parsing gridSize",d),
|
|
12
12
|
new _.N(1,9,7100,Bz);}Dz.prototype.init.call(this,a,b)};Iz.prototype.get=function(a){var b=this,c,d,e,f;return _.I(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.N(1,9,2014,zz+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.N(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.y(g,f.load(),2)}return g["return"](f)})};
|
|
@@ -19,9 +19,9 @@ Oz.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.N(1,9,7100,
|
|
|
19
19
|
d.substr(0,d.lastIndexOf("/"))+"/"+h);t=Pz(l[0]);l=Pz(l[1])-t;c.a.push(new Hz(h,t,l,m,p,q,n,0,0))}}})["catch"](function(f){c.log.error("[VTT] Error while loading thumbnails URL: "+d,f);a.onError(new _.N(1,9,2013,"Error while loading VTT thumbnails.",f))});Dz.prototype.init.call(this,a,b)};
|
|
20
20
|
Oz.prototype.get=function(a){var b=this,c;return _.I(function(d){if(1==d.a){if(0>a)throw new _.N(1,9,2014,zz+a);return _.y(d,b.f,2)}if(3!=d.a){c=b.a.find(function(e){return a>=e.time&&a<e.time+e.duration});if(!c)throw new _.N(1,9,2014,yz+a);return _.y(d,c.load(),3)}return d["return"](c)})};Oz.prototype.l=function(){return this.f};_.x(Qz,Dz);
|
|
21
21
|
Qz.prototype.get=function(a){function b(){return new _.N(1,9,2014,yz+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.I(function(A){if(1==A.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.N(1,9,2014,zz+a);d=c.player.getPeriods();for(var F=null,G=_.w(d),B=G.next();!B.done;B=G.next())B=B.value,B.startTime<=a&&(F=B);e=F;if(!e)throw c.log.error("Could not find period for specified position",a),b();f=e.thumbStreams.sort(c.f)[0];if(!f)throw c.log.error("Could not find thumb stream for specified position",a),
|
|
22
|
-
b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return A.F(2);l=Rz(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.
|
|
22
|
+
b();g=f.findSegmentPosition(a-e.startTime);if(null===g||void 0===g)throw c.log.error("Could not find segment index for specified position",a),b();h=f.getSegmentReference(g);if(!h)return A.F(2);l=Rz(h,f);m=Math.floor((a-h.startTime)/l.durationPerTile);0<c.a.length?(p=f.findSegmentPosition(0),null!==p&&(n=c.a[(g-p)*l.gi+m])):(q=h.Za())&&0<q.length&&(v=t=0,z=h.startTime,1<l.gi&&(t=m%l.$d,v=Math.floor(m/l.$d),z+=m*l.durationPerTile),n=new Hz(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.$d,l.Sg,
|
|
23
23
|
t,v));return n?_.y(A,n.load(),4):A.F(2)}if(2!=A.a)return A["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};Qz.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
|
|
24
|
-
Qz.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.M.R(d=b.getSegmentReference(c++));)for(var e=Rz(d,b),f=d.Za()[0],g=new Image,h=d.startTime,l=0;l<e.
|
|
24
|
+
Qz.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.w(a);for(var b=a.next();!b.done;b=a.next())if(b=b.value.thumbStreams.sort(this.f)[0])for(var c=b.findSegmentPosition(0),d=void 0;null!==c&&!_.M.R(d=b.getSegmentReference(c++));)for(var e=Rz(d,b),f=d.Za()[0],g=new Image,h=d.startTime,l=0;l<e.Sg;++l)for(var m=0;m<e.$d;++m)this.a.push(new Hz(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.$d,e.Sg,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.u=Sz.prototype;_.u.onPlayerCreated=function(a){this.m=a};_.u.onPlayerWillDestroy=function(){this.m=null};_.u.onPlayerWillRelease=function(){this.a=null};
|
|
25
25
|
_.u.onContentWillLoad=function(a){var b=this,c=a.getConfiguration().thumbnails;if(c)if(!1===c.enabled)this.g.info("Thumbnails disabled.");else{var d=c.mode||null;d||(d=Zz(c.url||null));(this.a=Yz(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Je,function(){b.g.info("Initialize thumbnails provider");try{b.a.init(a,c)}catch(e){b.m.onError(e)}})):this.g.warn("Unknown thumbnail mode",d)}else this.a=null};
|
|
26
26
|
_.u.onContentLoaded=function(a,b){for(var c=1;c<arguments.length;++c);if(!this.a&&(c=(c=a.getConfiguration())&&c.thumbnails,!c||void 0===c.enabled||c.enabled)){var d=a.getPeriods();if(Tz(d)){this.a=new Qz;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.u.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.N(1,9,2014,"Thumbnail format is not supported"))};_.u.id=function(){return"thumbnails"};_.J("clpp.thumbnails.ThumbnailsPlugin",Sz);Sz.prototype.get=Sz.prototype.get;Sz.Id="thumbnails";
|
|
27
27
|
$z.prototype.create=function(){return new Sz};_.gt(new $z);var Uz="SINGLE",Vz="GRID",Wz="WEBVTT",Xz="BIF";};
|