@castlabs/prestoplay 6.13.0 → 6.14.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 +32 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -6
- package/cjs/cl.cast.js +83 -83
- package/cjs/cl.conviva.js +24 -24
- package/cjs/cl.core.js +431 -429
- package/cjs/cl.crypto.js +6 -6
- package/cjs/cl.dash.js +59 -59
- package/cjs/cl.externs.js +48 -40
- package/cjs/cl.freewheel.js +19 -19
- package/cjs/cl.hls.js +58 -57
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +17 -17
- package/cjs/cl.ima.js +18 -18
- package/cjs/cl.mse.js +269 -268
- package/cjs/cl.muxdata.js +15 -14
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +13 -13
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +33 -33
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +53 -53
- package/cjs/cl.ttml.js +28 -28
- 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.youbora.js +18 -18
- package/cl.adobe.js +3 -3
- package/cl.airplay.js +3 -3
- package/cl.broadpeak.js +5 -5
- package/cl.cast.js +87 -87
- package/cl.conviva.js +27 -27
- package/cl.core.js +424 -421
- package/cl.crypto.js +8 -8
- package/cl.dash.js +67 -67
- package/cl.externs.js +48 -40
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +69 -69
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +221 -220
- package/cl.muxdata.js +13 -12
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- 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 +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +14 -14
- package/package.json +4 -4
- package/typings.d.ts +53 -17
package/cjs/cl.muxdata.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
data:
|
|
4
|
-
f.video_source_url=_.Yj(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().
|
|
5
|
-
d.language);return f}});a.g.debug("Mux SDK options",b);return b},
|
|
6
|
-
a.
|
|
7
|
-
_.
|
|
8
|
-
|
|
9
|
-
b)
|
|
10
|
-
_.r.
|
|
11
|
-
_.r.
|
|
12
|
-
_.r.
|
|
13
|
-
request_url:_.Yj(g)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);
|
|
14
|
-
_.r.onContentWillLoad=function(a,b){var c=a.getConfiguration();c=_.N.
|
|
15
|
-
var h=d;null!==h&&this.f.initialize(c,b,h)}catch(l){this.a=!1,this.U(a,l)}};_.r.onContentLoaded=function(){};_.r.onPlayerWillDestroy=function(){this.a&&(this.f.destroy(),this.f=null)};_.r.onPlayerWillRelease=function(){this.a&&this.f.release()};_.r.id=function(){return"mux"};_.r.U=function(a,b){a.trigger(new _.L(_.ne,{detail:b}))};_.H("clpp.muxdata.MuxDataPlugin",Gy);Gy.
|
|
2
|
+
var f=function(window){var yy=function(a){switch(a.type){case 1:return vy;case 2:return wy;case 3:return xy}},Ay=function(a){var b=Object.keys(a).find(function(c){return zy.includes(c.toLowerCase())});return void 0!==b?a[b]:void 0},By=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 _.Eh;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.G=this.ij.bind(this);this.C=this.dm.bind(this)},Dy=function(a){var b={debug:!0,
|
|
3
|
+
data:Cy(a)};a.f&&a.f.muxOptionsOverride&&_.N.Wc(a.f.muxOptionsOverride)&&(b=_.N.oa(b,a.f.muxOptionsOverride));b=_.N.oa(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 _.Xj(c.url);
|
|
4
|
+
f.video_source_url=_.Yj(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().ka(),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.ja())&&d.language&&(f.player_language_code=
|
|
5
|
+
d.language);return f}});a.g.debug("Mux SDK options",b);return b},Cy=function(a){var b={env_key:a.f.envKey,video_title:a.o&&a.o.name||"",player_name:_.wa,player_software_name:_.wa,player_software_version:_.ja,player_mux_plugin_name:"CastlabsPlayer built-in Mux Plugin",player_mux_plugin_version:_.ja};(a=a.m.getConfiguration().viewerId)&&(b.viewer_user_id=a);return b},Ey=function(a){a.a.on(a.m,_.eg,function(){var b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.eg,b)});a.a.on(a.m,_.gf,function(){return a.emit(_.gf)});
|
|
6
|
+
a.a.on(a.m,_.gd,a.fj.bind(a));a.a.on(a.m,_.Tf,a.hj.bind(a));a.a.on(a.m,_.og,function(){return a.emit(_.Mf)});a.a.on(a.m,_.mg,function(){return a.emit(_.Lf)});a.a.on(a.m,_.ne,a.gj.bind(a));a.a.on(a.m,_.uc,function(){return a.emit("adbreakstart")});a.a.on(a.m,_.vc,function(){return a.emit("adbreakend")});a.a.on(a.m,_.Hc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.Dc,function(){return a.emit("adpause")});a.a.on(a.m,_.Fc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,
|
|
7
|
+
_.Ic,function(){return a.emit("adended")});a.a.on(a.m,_.zc,function(){return a.emit("adfirstquartile")});a.a.on(a.m,_.Cc,function(){return a.emit("admidpoint")});a.a.on(a.m,_.Jc,function(){return a.emit("adthirdquartile")});a.j.hd(a.G);a.j.Xf(a.C);a.a.on(a.m,_.ne,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 _.Xj(b.uris[b.uriIndex]);b={request_start:c,request_type:yy(b),
|
|
8
|
+
request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{d=b.requestStartTimestamp;var e=new _.Xj(b.uris[b.uriIndex]),f=c.data;b={request_start:d,request_type:yy(b),request_hostname:e.a,request_error:""+yy(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)}})},Fy=function(a){_.Hh(a.a);a.j.ze(a.G);a.j.Fh(a.C)},Gy=function(){this.f=this.m=null;this.a=!1;this.g=new _.K("clpp.muxdata")},Hy=function(a){return!_.N.R(a)&&typeof a.init===_.qe&&typeof a.emit===_.qe},Iy=function(){},vy="manifest",wy="media",xy="encryption",zy=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];_.r=By.prototype;_.r.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,Dy(this))}catch(d){throw this.h=!1,Fy(this),new _.P(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=Cy(this),this.emit("videochange",a),this.l=!1);Ey(this)};_.r.release=function(){this.g.debug("release()");this.l?this.g.debug(_.ma):(Fy(this),this.l=!0,this.o=this.f=null)};_.r.destroy=function(){this.g.debug(_.Wd);this.A?this.g.debug(_.la):(this.A=!0,this.emit("destroy"))};
|
|
10
|
+
_.r.emit=function(a,b){if(null===this.w)throw new _.P(1,9,9301);this.w.emit(this.B,a,b)};_.r.fj=function(a){this.g.debug(_.Ue);var b=a.detail;a=this.m.getTrackManager();b&&b.bandwidth&&(b=b.bandwidth,(a=a.Qa())&&a.bandwidth&&(b+=a.bandwidth),this.emit("renditionchange",{video_source_bitrate:b}))};_.r.hj=function(a){this.g.debug(_.Ye);switch(a.detail.currentState){case _.To:this.m.getConfiguration().autoplay&&this.emit(_.gf);break;case _.Vo:this.emit(_.of);break;case _.Uo:this.emit(_.cf);break;case _.Oo:this.emit(_.me)}};
|
|
11
|
+
_.r.gj=function(a){this.g.debug(_.Ve);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.Q){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(_.ne,{player_error_code:a.code,player_error_message:b})}};
|
|
12
|
+
_.r.ij=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 _.Xj(b.uris[b.uriIndex]);a={request_start:e,request_type:yy(b),request_hostname:g.a,request_id:Ay(c),request_bytes_loaded:d,request_response_start:h,request_response_end:a,request_response_headers:c,request_media_duration:f,
|
|
13
|
+
request_url:_.Yj(g)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}};_.r.dm=function(a){a.requestStartTimestamp=Date.now()};_.w(Gy,_.rt);_.r=Gy.prototype;_.r.onPlayerCreated=function(a){this.m=a;this.f=new By(a,this.g)};
|
|
14
|
+
_.r.onContentWillLoad=function(a,b){var c=a.getConfiguration();c=_.N.Oa(c.muxdata);try{var d=[];typeof c===_.Te&&(c.envKey||d.push("envKey"));if(0<d.length)throw new _.P(1,9,9300,{missingKeys:d});var e=a.getConfiguration();d=null;if(this.a=!_.N.R(e.muxdata)&&typeof e.muxdata===_.Te){var f=e.muxdata;d=Hy(f.muxLib)?f.muxLib:window.mux;if(!Hy(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");this.a=!1;var g=new _.P(1,9,9301);this.U(a,g)}}else this.g.warn("Mux plugin is loaded but not configured. Will do nothing.");
|
|
15
|
+
var h=d;null!==h&&this.f.initialize(c,b,h)}catch(l){this.a=!1,this.U(a,l)}};_.r.onContentLoaded=function(){};_.r.onPlayerWillDestroy=function(){this.a&&(this.f.destroy(),this.m=this.f=null)};_.r.onPlayerWillRelease=function(){this.a&&this.f.release()};_.r.id=function(){return"mux"};_.r.emit=function(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.U(this.m,c),c;}};_.r.U=function(a,b){a.trigger(new _.L(_.ne,{detail:b}))};_.H("clpp.muxdata.MuxDataPlugin",Gy);Gy.prototype.emit=Gy.prototype.emit;
|
|
16
|
+
Gy.Id="mux";Iy.prototype.create=function(){return new Gy};_.nq(new Iy);};
|
|
16
17
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
17
18
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
18
19
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.onboard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
modifiers:{licenseRequest:_.
|
|
4
|
-
|
|
2
|
+
var f=function(window){var ty=function(){this.g=new _.K("clpp.onboard");this.j=new Set},uy=function(a,b){function c(l){return l&&(_.R.startsWith(l,"https://")||_.R.startsWith(l,"http://")||_.R.startsWith(l,"//"))?l:d+l}var d=b.baseUrl;_.R.endsWith(d,"/")||(d+="/");var e=c(b.widevineUrl||"widevine"),f=c(b.playreadyUrl||"playready"),g=c(b.fairplayUrl||"fairplay"),h=new _.$l(a);h.Ta(_.Rd,{licenseUrl:e,videoRobustness:[_.Vb,void 0],audioRobustness:[_.Ub,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,
|
|
3
|
+
modifiers:{licenseRequest:_.Pm,licenseResponse:_.Um}});h.Ta(_.Md,{licenseUrl:g,certificateUrl:g,modifiers:{licenseRequest:_.Rm,licenseResponse:_.Sm,extractContentId:_.Nm,certificateRequest:_.Tm}});h.Ta(_.Pd,{licenseUrl:f,modifiers:{licenseRequest:_.Pm}});_.Vl(h)};_.w(ty,_.Ir);ty.prototype.a=function(){for(var a=_.u(this.j),b=a.next();!b.done;b=a.next())delete _.Ul[b.value];this.j.clear()};
|
|
4
|
+
ty.prototype.h=function(a){a=a.getConfiguration().drm;var b;if(b=!(!a||!a.env))b=a&&a.customData,b=!(!b||!b.baseUrl);b&&(b=a.env,a=a.customData,a={baseUrl:a.baseUrl,widevineUrl:a.widevineUrl,playreadyUrl:a.playreadyUrl,fairplayUrl:a.fairplayUrl},this.g.info("Registering the DRMtoday Onboard environment, name\x3d'"+b+"'"),uy(b,a),this.j.add(b))};ty.prototype.id=function(){return"onboard"};_.H("clpp.onboard.OnboardComponent",ty);_.H("clpp.onboard.register",uy);};
|
|
5
5
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
6
6
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
7
7
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.persistent.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
d=[];(e=a.f.get(c))&&a.B&&(e.tb=new _.wj,d.push(e.tb));a.g.debug("Attempting to remove session",b);d.push(c.remove());return f["return"](Promise.all(d))})},
|
|
4
|
-
videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.
|
|
5
|
-
_.Xl(a),d=_.Bl({drm:a});d.drm=a;var e=new _.
|
|
6
|
-
|
|
7
|
-
f),new _.P(1,6,6200,null,p);}})},
|
|
2
|
+
var f=function(window){var by="A persistent DRM session already exists for: ",cy="No DRM configuration.",dy="clpp.persistent",ey="clpp.persistent.SimpleSessionStorage",fy=function(a,b){for(var c=[],d=_.u(a),e=d.next();!e.done;e=d.next())c.push(b(e.value));return c},gy=function(a){a=a.f.keys();a=fy(a,function(b){return b.sessionId});return Array.from(a)},hy=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return _.x(f,_.Zn(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.tb=new _.wj,d.push(e.tb));a.g.debug("Attempting to remove session",b);d.push(c.remove());return f["return"](Promise.all(d))})},jy=function(a,b){a.J=iy;a.K=[];a.G=!0;return _.Gn(a,b)},ly=function(a,b,c,d,e,f){a.J=ky;var g=new Map,h=_.co(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.$e,persistentState:_.If,sessionTypes:[_.ef],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",
|
|
4
|
+
videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.Mn(a,g)},my=function(){this.g=new _.K(ey)},ny=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}},oy=function(a,b){var c=
|
|
5
|
+
_.Xl(a),d=_.Bl({drm:a});d.drm=a;var e=new _.xn({Gb:b,onError:function(){},yf:function(){},onExpirationUpdated:function(){},onEvent:function(){},getConfiguration:function(){return d},Sc:function(){return null}});e.h=c;return e},ry=function(a,b,c){var d,e,f,g,h,l,m,n,p;return _.E(function(q){switch(q.a){case 1:d=py;e=qy;if(!a)return e.debug(cy),q["return"]();f=a.offlineId;return 0===f.length?q["return"]():_.x(q,d.get(f),2);case 2:if(g=q.f)return e.debug(by,f),q["return"]();h=oy(a,c);_.A(q,3,4);return _.x(q,
|
|
6
|
+
jy(h,b),6);case 6:return _.x(q,_.Sn(h),7);case 7:return _.x(q,_.Tn(h),8);case 8:return l=h.getDrmInfo(),m=b.map(function(t){return{contentType:_.rk(t.video.mimeType,t.video.codecs),robustness:l.videoRobustness}}),n=gy(h),g={sessionIds:n,keySystem:l.keySystem,licenseServerUri:l.licenseServerUri,serverCertificate:l.serverCertificate,audioCapabilities:[],videoCapabilities:m,drmConfig:a},_.x(q,d.store(f,g),4);case 4:return _.bh(q),_.x(q,h.destroy(),10);case 10:_.ch(q,0);break;case 3:throw p=_.C(q),e.error("Error while persisting DRM session "+
|
|
7
|
+
f),new _.P(1,6,6200,null,p);}})},sy=function(){this.g=new _.K(dy)},iy=1,ky=2;_.r=my.prototype;
|
|
8
8
|
_.r.store=function(a,b){var c;return _.E(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));_.y(d)})};_.r.get=function(a){var b=this,c;return _.E(function(d){if(c=window.localStorage.getItem(encodeURIComponent(a)))try{return d["return"](
|
|
10
|
-
_.H("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,D,G,F,B,I,O,M,
|
|
11
|
-
t=[];v=_.u(d);for(z=v.next();!z.done;z=v.next())D=z.value,G=new D,_.Fl(G.id())||(G.f(),_.Hl(G),t.push(G));F=null;_.A(
|
|
12
|
-
return _.x(
|
|
13
|
-
_.H("clpp.persistent.removeLicense",function(a){var b,c,d,e,f,g,h;return _.E(function(l){switch(l.a){case 1:b=
|
|
14
|
-
6);case 6:return _.x(l,_.
|
|
15
|
-
|
|
9
|
+
btoa(c));_.y(d)})};_.r.get=function(a){var b=this,c;return _.E(function(d){if(c=window.localStorage.getItem(encodeURIComponent(a)))try{return d["return"](ny(atob(c)))}catch(e){b.g.warn("Error while loading offline items for "+a+" from storage: ",e)}return d["return"](null)})};_.r["delete"]=function(a){return _.E(function(b){window.localStorage.removeItem(encodeURIComponent(a));_.y(b)})};_.r.clear=function(){return _.E(function(a){window.localStorage.clear();_.y(a)})};_.r.getName=function(){return ey};_.H("clpp.persistent.useStorage",function(a){var b=["store","get","delete","clear","getName"];var c=[];_.N.R(a)||(_.N.rb(a.store)||c.push("store"),_.N.rb(a.get)||c.push("get"),_.N.rb(a["delete"])||c.push("delete"),_.N.rb(a.clear)||c.push("clear"),_.N.rb(a.getName)||c.push("getName"),b=c);if(0<b.length)throw qy.warn("Invalid session storage implementation"),new _.P(1,6,6202,{missingMethods:b});py=a});
|
|
10
|
+
_.H("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,D,G,F,B,I,O,M,ba;return _.E(function(ha){switch(ha.a){case 1:f=py;g=qy;h=function(qa,Ta){return new _.P(1,6,6200,qa,Ta)};l=_.Zo(a).shift();if(!l)throw h("No source specified.");if(!b)throw h(cy);m=b.offlineId;if(typeof m!==_.Wf||!m.length)throw h("Missing offline id.");return _.x(ha,f.get(m),2);case 2:if(n=ha.f)return g.debug(by,m),ha["return"]();p=_.Bl();q=new _.Kj;
|
|
11
|
+
t=[];v=_.u(d);for(z=v.next();!z.done;z=v.next())D=z.value,G=new D,_.Fl(G.id())||(G.f(),_.Hl(G),t.push(G));F=null;_.A(ha,3,4);return _.x(ha,_.Cs(l.url,q,p.manifest.attemptParameters,l.type||null),6);case 6:return F=ha.f,F.configure(p.manifest),_.x(ha,F.start(l.url,{networkingEngine:q,filterAllPeriods:function(){},filterNewPeriod:function(){},onTimelineCueAdded:function(){},onEvent:function(){},onError:function(){}}),7);case 7:B=ha.f;if(!B.periods.length)throw h(null,new _.P(_.Q,4,4014));I=_.vs(B.periods);
|
|
12
|
+
return _.x(ha,ry(b,I,q),4);case 4:for(_.bh(ha);t.length;)O=t.shift(),O.a(),_.El["delete"](O.id());M=[];F&&M.push(F.stop());M.push(q.destroy());return _.x(ha,Promise.all(M),9);case 9:_.ch(ha,0);break;case 3:ba=_.C(ha);if(ba instanceof _.P&&6200===ba.code)throw ba;throw h(null,ba);}})});
|
|
13
|
+
_.H("clpp.persistent.removeLicense",function(a){var b,c,d,e,f,g,h;return _.E(function(l){switch(l.a){case 1:b=py;c=qy;if(!_.N.$(a)||0===a.length)return c.warn("Invalid offlineId"),l["return"]();e=d=null;_.A(l,2,3);return _.x(l,b.get(a),5);case 5:f=l.f;if(!f)return c.debug("No persistent DRM session found"),l["return"]();f.drmConfig.delayLicenseRequestUntilPlayed=!0;e=new _.Kj;d=oy(f.drmConfig,e);return _.x(l,ly(d,f.keySystem,f.licenseServerUri,f.serverCertificate,f.audioCapabilities,f.videoCapabilities),
|
|
14
|
+
6);case 6:return _.x(l,_.Sn(d),7);case 7:return _.x(l,Promise.all(f.sessionIds.map(function(m){return _.E(function(n){if(1==n.a)return _.x(n,hy(d,m),2);c.debug("successfully removed session with id",m);_.y(n)})})),8);case 8:return _.x(l,b["delete"](a),3);case 3:return _.bh(l),g=[],d&&g.push(d.destroy()),e&&g.push(e.destroy()),_.x(l,Promise.all(g),10);case 10:_.ch(l,0);break;case 2:throw h=_.C(l),c.error("Failed to remove session"),new _.P(1,6,6201,null,h);}})});var py=new my,qy=new _.K(dy);_.w(sy,_.Ir);sy.prototype.id=function(){return _.df};sy.prototype.l=function(a,b){var c=this,d,e,f;return _.E(function(g){if(1==g.a){d=a.getConfiguration().drm;if(!d)return c.g.debug("No DRM configuration found for loaded source."),g["return"]();c.g.debug("Persisting DRM session ID: "+d.offlineId);e=a.getNetworkEngine();_.A(g,2);return _.x(g,ry(d,b,e),4)}if(2!=g.a)return a.trigger(new _.L(_.ge,{offlineId:d.offlineId})),_.ah(g,0);f=_.C(g);a.onError(f);_.y(g)})};
|
|
15
|
+
sy.prototype.j=function(a){var b=this,c,d;return _.E(function(e){if(1==e.a)return b.g.debug("Getting EME session IDs for "+a),c=py,_.A(e,2),_.x(e,c.get(a),4);if(2!=e.a){if(d=e.f)return e["return"](d.sessionIds||[]);b.g.debug("No offline session found for "+a);return e["return"]([])}_.C(e);b.g.warn("Error while loading session info from storage");return e["return"]([])})};_.H("clpp.persistent.PersistentLicenseComponent",sy);};
|
|
16
16
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
17
17
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
18
18
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.playlist.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
_.r.
|
|
4
|
-
_.r.next=function(){var a=this,b;return _.E(function(c){b=Math.min(a.a.length-1,a.f+1);return _.x(c,a.me(b),0)})};_.r.
|
|
5
|
-
_.r.append=function(a){this.a.push(a)
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var f=function(window){var Zx=function(a,b){b=void 0===b?function(){return Promise.resolve()}:b;_.tl.call(this);this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.tc.bind(this)},$x=function(a){a.trigger(new _.L(_.tf))},ay=function(a,b){return 0<=b&&b<a.a.length};_.w(Zx,_.tl);_.r=Zx.prototype;_.r.on=function(a,b,c){return _.tl.prototype.on.call(this,a,b,c)};_.r.one=function(a,b,c){return _.tl.prototype.one.call(this,a,b,c)};_.r.off=function(a,b){return _.tl.prototype.off.call(this,a,b)};_.r.getPosition=function(){return this.f};
|
|
3
|
+
_.r.mk=function(){return this.a};_.r.Bd=function(){return 0<this.a.length&&ay(this,this.f)?this.a[this.f]:null};_.r.pk=function(){var a=this.f+1;return 0<this.a.length&&ay(this,a)?this.a[a]:null};_.r.Bk=function(){return this.h};_.r.start=function(){this.h||(this.h=!0,this.m.on(_.me,this.j),this.me(this.f,!0))};_.r.stop=function(){this.h=!1;this.m.off(_.me,this.j)};_.r.tc=function(){this.next()};
|
|
4
|
+
_.r.next=function(){var a=this,b;return _.E(function(c){b=Math.min(a.a.length-1,a.f+1);return _.x(c,a.me(b),0)})};_.r.Zl=function(){var a=this,b;return _.E(function(c){b=Math.max(0,a.f-1);return _.x(c,a.me(b),0)})};_.r.me=function(a,b){b=void 0===b?!1:b;var c=this,d;return _.E(function(e){if(1==e.a){if(!(0<c.a.length&&ay(c,a))||!b&&c.f===a)return e["return"]();c.f=a;return(d=c.Bd())?_.x(e,c.l(d),3):e.F(0)}if(4!=e.a)return _.x(e,c.m.load(d.configuration),4);c.trigger(new _.L(_.pf,{item:d}));_.y(e)})};
|
|
5
|
+
_.r.append=function(a){this.a.push(a);$x(this)};_.r.xk=function(a,b){if(0<=b&&b<=this.a.length){var c=this.Bd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));$x(this)}};_.r.remove=function(a){if(0<this.a.length&&ay(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);$x(this)}};_.r.clear=function(){this.stop();this.f=0;this.a=[];this.h=!1;$x(this)};_.H("clpp.Playlist",Zx);Zx.prototype.clear=Zx.prototype.clear;Zx.prototype.remove=Zx.prototype.remove;
|
|
6
|
+
Zx.prototype.insert=Zx.prototype.xk;Zx.prototype.append=Zx.prototype.append;Zx.prototype.goTo=Zx.prototype.me;Zx.prototype.previous=Zx.prototype.Zl;Zx.prototype.next=Zx.prototype.next;Zx.prototype.onEnded=Zx.prototype.tc;Zx.prototype.stop=Zx.prototype.stop;Zx.prototype.start=Zx.prototype.start;Zx.prototype.isStarted=Zx.prototype.Bk;Zx.prototype.getUpcoming=Zx.prototype.pk;Zx.prototype.getCurrent=Zx.prototype.Bd;Zx.prototype.getQueue=Zx.prototype.mk;Zx.prototype.getPosition=Zx.prototype.getPosition;
|
|
7
|
+
Zx.prototype.off=Zx.prototype.off;Zx.prototype.one=Zx.prototype.one;Zx.prototype.on=Zx.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;});}
|
|
10
10
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.simid.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
(c=(c=c.data)?typeof c===_.Wf?JSON.parse(c):c:null))if(c.type)switch(b.g.info("Received message ["+c.messageId+"] '"+c.type+"':",c.args),c.type){case "createSession":
|
|
4
|
-
"":(d.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",d.h=!0);var f=
|
|
5
|
-
this.g=new _.K("clpp.simid.SimidPlayer");
|
|
2
|
+
var f=function(window){var Hx="No surface found. Can not attach frame!",Ix="SIMID:Media:timeupdate",Jx="Starting creative",Ox=function(a){var b=this;this.f=a;this.h="";this.l=0;this.j=new Map;this.a=document.createElement("iframe");this.a.style.opacity="0";this.a.style.border=_.Se;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=_.Se;this.a.style.overflow=_.se;this.a.classList.add(_.wd);this.o=function(c){if(c.source===b.a.contentWindow&&
|
|
3
|
+
(c=(c=c.data)?typeof c===_.Wf?JSON.parse(c):c:null))if(c.type)switch(b.g.info("Received message ["+c.messageId+"] '"+c.type+"':",c.args),c.type){case "createSession":Kx(b,c);break;case "resolve":c=c.args;var d=b.j.get(c.messageId);d&&d.resolve(c);break;case "reject":c=c.args;(d=b.j.get(c.messageId))&&d.reject(c);break;case "SIMID:Creative:requestResize":d=b.f;var e=c.args;d.g.info("Creative requested resize",e);if(d.m&&d.m.getSurface()&&d.m.getSurface().getMedia()&&e.mediaDimensions){d.h?d.m.getSurface().getMedia().style.transition=
|
|
4
|
+
"":(d.m.getSurface().getMedia().style.transition="left .5s, top .5s,width .5s, height .5s",d.h=!0);var f=Lx(d,e.mediaDimensions);d.m.getSurface().getMedia().style.left=f.left;d.m.getSurface().getMedia().style.top=f.top;d.m.getSurface().getMedia().style.width=f.width;d.m.getSurface().getMedia().style.height=f.height}e.creativeDimensions&&(e=Lx(d,e.creativeDimensions),d.a.a.style.left=e.left,d.a.a.style.top=e.top,d.a.a.style.width=e.width,d.a.a.style.height=e.height);Mx(b,c)}else b.g.warn("WARNING: received message without 'type' property")};
|
|
5
|
+
this.g=new _.K("clpp.simid.SimidPlayer");Nx(this.f,this)},Rx=function(a){var b=Px(a,"SIMID:Player:startCreative",void 0);Qx(a,b).then(function(){var c=a.f;c.g.info(Jx);c.m.trigger(new _.L(_.Of));a.a.style.opacity="1"})["catch"](function(c){a.unload();a.f.g.error("Error while starting creative",c)})},Kx=function(a,b){var c;_.E(function(d){if(1==d.a){a.h=b.sessionId;Mx(a,b);_.A(d,2);var e=a.f;var f=e.getSurface(),g=e.getContainer();e={environmentData:{videoDimensions:{x:0,y:0,height:g.clientHeight,
|
|
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
|
-
clickThruUrl:""}};e=
|
|
8
|
-
a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn("WARNING: no session available to send message '"+b.type+"'")},
|
|
9
|
-
new _.K("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.
|
|
10
|
-
null},
|
|
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(_.Pf))},
|
|
12
|
-
|
|
13
|
-
_.r.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
|
|
14
|
-
_.r.
|
|
15
|
-
b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)};_.r.onPlayerWillRelease=function(a){_.
|
|
16
|
-
|
|
17
|
-
_.
|
|
7
|
+
clickThruUrl:""}};e=Px(a,"SIMID:Player:init",e);e=Qx(a,e);return _.x(d,e,4)}if(2!=d.a)return a.g.info("Player Init acknowledged"),a.f.g.info("SIMID Player initialized"),_.ah(d,0);c=_.C(d);a.g.error("Error while initializing",c);a.f.g.error("Error while initializing SIMID player: ",c);a.unload();_.y(d)})},Px=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},Sx=function(a,b){a.h?(b.type!==Ix&&a.g.info("Posting message ["+b.messageId+"] '"+b.type+"':",b.args),
|
|
8
|
+
a.a.contentWindow&&a.a.contentWindow.postMessage(JSON.stringify(b),"*")):a.g.warn("WARNING: no session available to send message '"+b.type+"'")},Mx=function(a,b){Sx(a,Px(a,"resolve",{messageId:b.messageId,value:void 0}))},Qx=function(a,b){return new Promise(function(c,d){new Tx(a.j,c,d,b);Sx(a,b)})},Tx=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))},Ux=function(){this.g=
|
|
9
|
+
new _.K("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.kj.bind(this);this.f=null;this.o=!1},Vx=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=Px(d,"SIMID:Player:resize",e);Sx(d,e)}})},Wx=function(a){this.m=a;this.a=null;this.g=new _.K("clpp.simid.Loader");this.h=!1;this.f=
|
|
10
|
+
null},Lx=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+"%"}},Nx=function(a,b){a.g.info("SIMID Session created");a.a=b},Xx=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
|
+
"";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(_.Pf))},Yx=function(){};Ox.prototype.load=function(a){window.addEventListener(_.Ke,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
|
+
Ox.prototype.unload=function(){Xx(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Ke,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)};Tx.prototype.resolve=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.l(a)};Tx.prototype.reject=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.j(a)};_.w(Ux,_.rt);_.r=Ux.prototype;_.r.id=function(){return"simid"};_.r.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 Wx(a)};
|
|
13
|
+
_.r.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 Ox(this.h);var c=b.getContainer();this.j=Vx(this,c,b);this.j.observe(c);a.on(_.eg,this.w)}else this.g.warn(Hx)};
|
|
14
|
+
_.r.kj=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&&(Rx(this.a),this.o=!0,this.g.info(Jx)),c&&(c=this.a,Sx(c,Px(c,Ix,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(Hx),a=a.getContainer(),this.f=b,this.o=!1,this.g.info("Loading session"),this.h.f=
|
|
15
|
+
b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)};_.r.onPlayerWillRelease=function(a){_.rt.prototype.onPlayerWillRelease.call(this,a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.eg,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))};Wx.prototype.release=function(){this.g.info("Releasing loader")};
|
|
16
|
+
Wx.prototype.getContainer=function(){var a=this.getSurface().getContainer();if(!a)throw this.g.error("No player container found. Can not create SIMID init data"),new _.P(1,10,10100,"No player container found");return a};Wx.prototype.getSurface=function(){var a=this.m.getSurface();if(!a)throw this.g.error("No player surface found. Can not create SIMID init data"),new _.P(1,10,10100,"No surface");return a};Wx.prototype.url=function(){return this.f?this.f.url:""};Yx.prototype.create=function(){return new Ux};
|
|
17
|
+
_.nq(new Yx);};
|
|
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;});}
|
|
20
20
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.smooth.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
2
|
var f=function(window){var rL="Full MP4 box must have flags defined",sL="clpp.smooth.SmoothMP4Processor",tL="codecPrivateData",uL=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)},vL=function(a,b){try{a.f.setUint8(a.a,b),a.a+=1}catch(c){_.bm()}},wL=function(a,b){vL(a,b>>16&255);vL(a,b>>8&255);vL(a,b&255)},xL=function(a,b){try{a.f.setUint16(a.a,b,a.h),a.a+=2}catch(c){_.bm()}},yL=function(a,b){try{a.f.setInt32(a.a,b,a.h),a.a+=4}catch(c){_.bm()}},zL=function(a,b){try{a.f.setInt16(a.a,
|
|
3
3
|
b,a.h),a.a+=2}catch(c){_.bm()}},AL=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},BL=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){BL.call(this,a);this.version=b;this.flags=c},CL=function(a,b,c){BL.call(this,a);this.h=b;this.offset=c},DL=function(a,b,c,
|
|
4
|
-
d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},EL=function(a,b,c){BL.call(this,"ftyp");this.j=a;this.
|
|
4
|
+
d,e){Z.call(this,a,b,c);this.h=d;this.offset=e},EL=function(a,b,c){BL.call(this,"ftyp");this.j=a;this.hh=b;this.h=c},FL=function(){BL.call(this,_.Oe)},GL=function(){BL.call(this,_.fg)},HL=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]},IL=function(){BL.call(this,"mvex")},JL=function(a){Z.call(this,"trex",0,0);this.h=a},KL=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]},LL=function(a,b){Z.call(this,"mdhd",1,0);this.timescale=a;this.duration=b;this.language=21956},ML=function(a){Z.call(this,"hdlr",0,0);this.h=a},NL=function(){Z.call(this,"vmhd",0,1);this.h=new Uint8Array([0,0,0,0,0,0])},OL=function(a){BL.call(this,a);this.A=!0},PL=function(a){OL.call(this,a);this.height=this.width=0;this.depth=24},QL=
|
|
6
6
|
function(a,b,c,d){OL.call(this,a);this.channelCount=b;this.sampleSize=c;this.sampleRate=d},RL=function(a,b){PL.call(this,"avc1");this.width=a;this.height=b},SL=function(a,b){RL.call(this,a,b);this.type="encv"},TL=function(a,b,c){QL.call(this,"mp4a",a,b,c)},UL=function(a,b,c){TL.call(this,a,b,c);this.type="enca"},VL=function(a,b){BL.call(this,"avcC");this.Ua=a;this.$b=b;this.version=1;this.h=this.Ua[0][1];this.j=this.Ua[0][2];this.level=this.Ua[0][3]},WL=function(a){Z.call(this,"esds",0,0);this.Ob=
|
|
7
7
|
a},XL=function(a){a=void 0===a?"":a;Z.call(this,"url ",0,1);this.location=a},YL=function(){Z.call(this,"dref",0,0)},ZL=function(){BL.call(this,_.Vf)},$L=function(){Z.call(this,_.Xf,0,0)},aM=function(){Z.call(this,"stts",0,0)},bM=function(){Z.call(this,"stsc",0,0)},cM=function(){Z.call(this,"stco",0,0)},dM=function(){Z.call(this,"stsz",0,0)},eM=function(){Z.call(this,"smhd",0,0)},fM=function(){BL.call(this,"dinf")},gM=function(){BL.call(this,_.Ne)},hM=function(){BL.call(this,_.Je)},iM=function(a,b){Z.call(this,
|
|
8
8
|
"tfdt",a,0);this.h=b},jM=function(){Z.call(this,"mfhd",0,0);this.h=0},kM=function(a,b){Z.call(this,"trun",a,b);this.o=this.l=this.h=0;this.w=[];this.sampleSize=[];this.B=[];this.j=[]},lM=function(a,b){Z.call(this,"tfhd",a,b);this.h=255;this.o=this.w=this.l=this.B=this.j=0},mM=function(){BL.call(this,"traf")},nM=function(){BL.call(this,"moof")},oM=function(){BL.call(this,_.Ie);this.h=new Uint8Array(0)},pM=function(){Z.call(this,"tenc",0,0);this.h=1;this.j=8;this.o="";this.l=[]},qM=function(a,b){Z.call(this,
|
|
9
|
-
"schm",0,0);this.h=a;this.j=b;this.Jb=""},rM=function(a){BL.call(this,"frma");this.h=a},sM=function(){Z.call(this,"saio",0,0);this.offset=[0]},tM=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},uM=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},vM=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},wM=function(a,b,c,d){c=b.
|
|
10
|
-
String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.Bi([a],[b])[0]},xM=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.sg?c=["maxWidth","maxHeight","bitrate",tL,"fourCC"]:a.type===_.$c&&(c=["bitrate",tL,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.
|
|
11
|
-
sampleSize:NaN,channelCount:NaN};switch(c.type){case _.sg:a.Ua=[_.gj(d[1])];a.$b=[_.gj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.Ob=_.gj(c.ce),a.sampleSize=c.
|
|
9
|
+
"schm",0,0);this.h=a;this.j=b;this.Jb=""},rM=function(a){BL.call(this,"frma");this.h=a},sM=function(){Z.call(this,"saio",0,0);this.offset=[0]},tM=function(a,b,c){Z.call(this,"saiz",0,0);this.h=a;this.l=b;this.j=c},uM=function(a,b){Z.call(this,"senc",a,b);this.j=0;this.l=8;this.h=[]},vM=function(a){var b=a.split("/");return b[b.length-1].toLowerCase().match("manifest(\\(.+\\))?")?a:a+"/Manifest"},wM=function(a,b,c,d){c=b.Jg[c];b=b.Bm;a=a.replace("Manifest","");b=b.replace("{bitrate}",String(d.bitrate)).replace("{Bitrate}",
|
|
10
|
+
String(d.bitrate)).replace("{start time}",String(c.t)).replace("{start_time}",String(c.t));return _.Bi([a],[b])[0]},xM=function(a,b){if(a.type!==b.type)return!1;var c=[];a.type===_.sg?c=["maxWidth","maxHeight","bitrate",tL,"fourCC"]:a.type===_.$c&&(c=["bitrate",tL,"channels","bitsPerSample","samplingRate","fourCC"]);return _.N.ta(a,b,c,["id","segmentIndex"])},yM=function(a,b,c){var d=c.ce.split("00000001");a={id:1,type:c.type,duration:a/b,timescale:b,Ua:null,$b:null,width:NaN,height:NaN,Ob:null,Nd:NaN,
|
|
11
|
+
sampleSize:NaN,channelCount:NaN};switch(c.type){case _.sg:a.Ua=[_.gj(d[1])];a.$b=[_.gj(d[2])];a.width=c.maxWidth;a.height=c.maxHeight;break;case _.$c:a.Ob=_.gj(c.ce),a.sampleSize=c.ki||16,a.Nd=c.Nd,a.channelCount=c.hg}return a},zM=function(a,b){return a.filter(function(c){return c.type===b})},AM=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)},HM=function(a,b,c){var d=null;if(BM.test(a)){a=BM.exec(a);d=
|
|
12
12
|
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 CM.test(a)?d=AM(CM,a):DM.test(a)?d=AM(DM,a):EM.test(a)?(a=EM.exec(a),d=Number(a[1])/c.frameRate):FM.test(a)?(a=FM.exec(a),d=Number(a[1])/c.a):GM.test(a)&&(d=AM(GM,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*d);return b+":"+c+":"+a+"."+d},IM=function(a,
|
|
13
13
|
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))},KM=function(a){this.a=a;this.f=JM(this)},JM=function(a){for(var b=0,c=0;c<a.a.length;c++)b+=a.a[c].a();return new _.am(b)},LM=function(a,b,c){a:{var d=_.u([_.Rd,_.Pd]);for(var e=d.next();!e.done;e=d.next())if((e=c.je(e.value))&&e.keyId){d=e.keyId;break a}_.J(sL,"Could not get default Key ID for DRM init data!");
|
|
14
|
-
d=null}c=new BL("xxxx");a.type===_.sg?c=new SL(a.width,a.height):c=new UL(a.channelCount,a.sampleSize,a.
|
|
15
|
-
m.entries=[new XL];var n=new $L;switch(a.type){case _.sg:var p=new VL(a.Ua,a.$b);c?(l=LM(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new RL(a.width,a.height)).append([p]),n.entries=[l]);l=new NL;break;case _.$c:p=new WL(a.Ob),c?(l=LM(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new TL(a.channelCount,a.sampleSize,a.
|
|
14
|
+
d=null}c=new BL("xxxx");a.type===_.sg?c=new SL(a.width,a.height):c=new UL(a.channelCount,a.sampleSize,a.Nd);a=new pM;a.h=1;a.j=8;a.o=d||"00000000000000000000000000000000";a=(new BL("schi")).append([a]);b=(new BL(_.Qf)).append([new rM(b),new qM(_.rd,65536),a]);c.append([b]);return c},MM=function(a,b){var c=b.pe(),d=new HL(a.timescale,a.duration,a.id),e=(new IL).append([new JL(a.id)]),f=new KL(a.id,a.duration,a.timescale,a.width,a.height),g=new LL(a.timescale,a.duration),h=new ML(a.type),l=null,m=new YL;
|
|
15
|
+
m.entries=[new XL];var n=new $L;switch(a.type){case _.sg:var p=new VL(a.Ua,a.$b);c?(l=LM(a,"avc1",b),l.append([p]),n.entries=[l]):(l=(new RL(a.width,a.height)).append([p]),n.entries=[l]);l=new NL;break;case _.$c:p=new WL(a.Ob),c?(l=LM(a,"mp4a",b),l.append([p]),n.entries=[l]):(l=(new TL(a.channelCount,a.sampleSize,a.Nd)).append([p]),n.entries=[l]),l=new eM}n=(new ZL).append([n,new aM,new bM,new dM,new cM]);m=(new fM).append([m]);m=(new gM).append([l,m,n]);g=(new hM).append([g,h,m]);f=(new GL).append([f,
|
|
16
16
|
g]);d=(new FL).append([d,f,e]);e=new EL("dash",0,["iso6","mp41","avc1"]);c&&(c=b.je(_.Pd),f=b.je(_.Rd),c&&d.append([new CL("pssh",c.initData,8)]),f&&d.append([new CL("pssh",f.initData,8)]),c||f||_.J(sL,"Could not get PSSH init data!"));c=new KM([e,d]);return _.Ui(c.write())},OM=function(a,b){var c,d,e,f,g,h;(new _.mm).L("moof",_.nm).Y("mfhd",function(m){var n=new jM;n.h=_.W(m.reader);c=n}).L("traf",_.nm).Y("tfhd",function(m){var n=m.reader.Ga();if(null===m.flags)throw new _.P(_.Q,3,3019,rL);var p=
|
|
17
17
|
new lM(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-m.reader.getPosition()&&m.flags&1&&(p.j=_.jm(m.reader));0<n-m.reader.getPosition()&&m.flags&2&&(p.B=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&8&&(p.l=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&16&&(p.w=_.W(m.reader));0<n-m.reader.getPosition()&&m.flags&32&&(p.o=_.W(m.reader));d=p}).Y("trun",function(m){var n=m.reader.Ga();if(null===m.flags)throw new _.P(_.Q,3,3019,rL);var p=new kM(m.version||0,m.flags||0);p.h=_.W(m.reader);0<n-
|
|
18
18
|
m.reader.getPosition()&&m.flags&1&&(p.l=_.im(m.reader));0<n-m.reader.getPosition()&&m.flags&4&&(p.o=_.W(m.reader));if(0<n-m.reader.getPosition())for(n=0;n<p.h;n++)m.flags&256&&p.w.push(_.W(m.reader)),m.flags&512&&p.sampleSize.push(_.W(m.reader)),m.flags&1024&&p.B.push(_.W(m.reader)),m.flags&2048&&(0===m.version?p.j.push(_.W(m.reader)):p.j.push(_.im(m.reader)));e=p}).Y("sdtp",function(m){var n=_.lm(m.reader,m.reader.Ga());f=new DL("sdtp",m.version||0,m.flags||0,n,0)}).L("uuid",function(m){var n=_.lm(m.reader,
|
|
19
|
-
16);if(_.ij(n,NM)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new uM(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.gm(m.reader));for(var p=0;p<n.j;p++){var q={
|
|
20
|
-
!1);if(!h)return null;var l=(new mM).append([d,e]);f&&l.append([f]);b.pe()&&g&&l.append([g]);l=(new nM).append([c,l]);return new KM([l,h])},PM=function(a,b,c,d){var e=d.pe(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=OM(b,d);if(null===g)return a.request.contentType===_.bg?a.data:g;d=g.get(_.Ie);if(a.request.contentType===_.bg){e=d.h.buffer;if(c){e=_.R.
|
|
19
|
+
16);if(_.ij(n,NM)){n=_.W(m.reader);m.version=n>>>24;m.flags=n&16777215;n=new uM(m.version,m.flags);n.j=_.W(m.reader);m.flags&1&&(n.l=_.gm(m.reader));for(var p=0;p<n.j;p++){var q={Xg:_.lm(m.reader,8),dd:0,Qf:[]};if(m.flags&2){q.dd=_.hm(m.reader);for(var t=0;t<q.dd;t++){var v={fg:0,gg:0};v.fg=_.hm(m.reader);v.gg=_.W(m.reader);q.Qf.push(v)}}n.h.push(q)}g=n}}).L(_.Ie,function(m){var n=new oM;0<m.reader.Ga()?n.h=_.lm(m.reader,m.reader.Ga()):(_.J(sL,"mdat box is empty!"),n.h=new Uint8Array(0));h=n}).parse(a,
|
|
20
|
+
!1);if(!h)return null;var l=(new mM).append([d,e]);f&&l.append([f]);b.pe()&&g&&l.append([g]);l=(new nM).append([c,l]);return new KM([l,h])},PM=function(a,b,c,d){var e=d.pe(),f=parseInt(c*b,10);b=a.data||new ArrayBuffer(0);var g=OM(b,d);if(null===g)return a.request.contentType===_.bg?a.data:g;d=g.get(_.Ie);if(a.request.contentType===_.bg){e=d.h.buffer;if(c){e=_.R.yd(e);if((e=(new DOMParser).parseFromString(e,_.dg))&&"tt"===e.documentElement.tagName.toLowerCase())var h=e.documentElement;if(h&&(d=new IM(h.getAttribute("ttp:frameRate"),
|
|
21
21
|
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",_.le],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 D=q[v].name;if(D=D.match(t)){p=p.getAttribute(D[0]);break b}}p=null}}f.setAttribute(l[m],HM(p||
|
|
22
|
-
"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.Va(e).buffer}else c=e;return c}h=new nM;a=g.get("mfhd");b=new mM;l=g.get("tfhd");m=new iM(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].
|
|
23
|
-
c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},QM=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},RM=function(a,b,c){a=_.
|
|
24
|
-
new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.P=SM;this.H=0;this.
|
|
25
|
-
_.x(f,d.O,2);e=f.f;a.l=e.uri;return f["return"](e)})},aN=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.R.
|
|
26
|
-
p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_
|
|
27
|
-
F=_.fj(_.
|
|
28
|
-
+
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
new _.P(_.Q,4,4037,
|
|
32
|
-
|
|
33
|
-
thumbStreams:[]};var SQ=
|
|
34
|
-
|
|
35
|
-
g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=bN(a,a.w.timescale,d,g);g=e.Nb.segmentIndex;g.
|
|
36
|
-
d[h.Fc],n=bN(a,c,m,l);n=new _.
|
|
37
|
-
B)}I=m.type===_.bg?eN[m.
|
|
38
|
-
roles:[],channelsCount:l.
|
|
39
|
-
b.endTime);return f},cN=function(a,b,c,d,e){b=yM(b,d.timescale||c,e);c={isLive:a.
|
|
22
|
+
"",g,d))}}e=(new XMLSerializer).serializeToString(e);c=_.R.Va(e).buffer}else c=e;return c}h=new nM;a=g.get("mfhd");b=new mM;l=g.get("tfhd");m=new iM(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].dd);else g=8;b.append([c,new sM,new tM(g,l,c.j)])}h.append([a,b]);f.flags|=1;f.l=h.a()+8;d=new KM([h,d]);h=d.write();e&&(e=d.get("saio"),d=d.f,e.offset[0]=
|
|
23
|
+
c.start+16,d.seek(e.start),e.write(d),h=d.buffer);return h},QM=function(a,b,c){return{keySystem:a,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[b],keyIds:c,periodId:null}},RM=function(a,b,c){a=_.pn(a);c&&a.version!==c&&(a=_.vz(a,c));return{initData:_.tz(a),initDataType:_.rd,keyId:b,periodId:null}},TM=function(){this.w=this.h=this.f=this.D=null;this.M=1;this.T=0;this.l="";this.B=this.a=null;this.g=
|
|
24
|
+
new _.K("clpp.smooth.SmoothParser");this.J=!1;this.j=this.A=null;this.P=SM;this.H=0;this.C=this.I=Infinity;this.o=[];this.K=this.em.bind(this);this.G=new Map},UM=function(a,b){var c,d,e;return _.E(function(f){if(1==f.a)return c=_.rj(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,c.fuzzFactor=a.f.attemptParameters.fuzzFactor,c.type=1,d=a.D.networkingEngine.fetch(c),
|
|
25
|
+
_.x(f,d.O,2);e=f.f;a.l=e.uri;return f["return"](e)})},aN=function(a,b){var c=null;try{var d=new DOMParser;try{var e=_.R.yd(b);var f=d.parseFromString(e.trim(),_.dg)}catch(hF){throw hF;}if(f&&f.documentElement.tagName==_.ac)var g=f.documentElement;c=g&&0<g.getElementsByTagName("parsererror").length?null:g}catch(hF){}if(!c)throw a.g.error("Unable to parse manifest"),new _.P(_.Q,4,4033,a.l);var h=+VM(a,c,"MajorVersion"),l=+VM(a,c,"MinorVersion"),m=+c.getAttribute("TimeScale")||1E7,n=+VM(a,c,"Duration"),
|
|
26
|
+
p="TRUE"===c.getAttribute("IsLive"),q=+c.getAttribute("LookAheadCount"),t=+c.getAttribute("DVRWindowLength")||Infinity,v=_.an(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 _.P(_.Q,4,4036,a.l);p?(WM(a,XM),a.A=typeof a.f.liveRefreshPeriod===_.k?1E3*a.f.liveRefreshPeriod:Math.min(1E3*a.H,1E4),n=Infinity):WM(a,SM);a.a={startTime:0,delay:0,duration:n/m,af:t/m,Gd:0};if(v){var z=a.f.playreadyVersion,D=[],G=_.an(v,"ProtectionHeader")[0],
|
|
27
|
+
F=_.fj(_.cn(G)||""),B=_.pn(F).a;D.push(QM(_.Rd,{initData:_.tz(_.hn(B)),initDataType:_.rd,keyId:B,periodId:null},[B]));D.push(QM(_.Pd,RM(F,B,z),[B]));a.o=D}var I=[],O=_.an(c,"StreamIndex");if(!O.length)throw a.g.error("No streams found!"),new _.P(_.Q,4,4034,a.l);for(var M=0;M<O.length;M++){for(var ba,ha=a,qa=O[M],Ta=VM(ha,qa,"Type"),Fa=+qa.getAttribute("Chunks"),Ca=qa.getAttribute("Subtype"),na=qa.getAttribute("Language")||_.hg,Ia=_.Ni(na),tb=qa.getAttribute("Name")||"",Jb=+qa.getAttribute(_.xb),Lc=
|
|
28
|
+
+qa.getAttribute(_.wb),Dm=VM(ha,qa,"Url"),Ms=+qa.getAttribute("TimeScale")||null,Mc=[],Em=_.an(qa,_.Ob),ut=0;ut<Em.length;ut++){var qf=void 0,ic=void 0,vt=void 0,rf=ha,qd=Em[ut],wt=Ta,JQ=+qd.getAttribute("Index"),KQ=+VM(rf,qd,"Bitrate"),kF=NaN,lF=NaN,zn=NaN,xt=NaN,mF=NaN,nF=NaN,oF=NaN,pF=qd.getAttribute("FourCC");switch(wt){case _.sg:kF=+VM(rf,qd,_.wb);lF=+VM(rf,qd,_.xb);break;case _.$c:xt=+qd.getAttribute("Channels")||2,zn=+VM(rf,qd,"SamplingRate"),nF=+VM(rf,qd,"AudioTag"),mF=+VM(rf,qd,"BitsPerSample"),
|
|
29
|
+
oF=+VM(rf,qd,"PacketSize")}var yt=String(qd.getAttribute("CodecPrivateData"));if(wt===_.$c&&!yt){var qF=xt,rF={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},An=rF[zn];if("AACH"===pF){ic=new Uint8Array(4);var sF=rF[2*zn];ic[0]=40|An>>1;ic[1]=An<<7|qF<<3|sF>>1;ic[2]=sF<<7|8;ic[3]=0;qf=new Uint16Array(2);qf[0]=(ic[0]<<8)+ic[1];qf[1]=(ic[2]<<8)+ic[3];vt=qf[0].toString(16)+qf[1].toString(16)}else ic=new Uint8Array(2),ic[0]=16|An>>1,ic[1]=An<<7|qF<<3,
|
|
30
|
+
qf=new Uint16Array(1),qf[0]=(ic[0]<<8)+ic[1],vt=qf[0].toString(16);yt=vt.toUpperCase()}var LQ={id:rf.T++,type:wt,index:JQ,bitrate:KQ,ce:yt,maxHeight:kF,maxWidth:lF,Nd:zn,hg:xt,Um:nF,ki:mF,kn:oF,Wj:pF,segmentIndex:null};Mc.push(LQ)}ba=Mc;for(var Be=[],tF=_.an(qa,"c"),Ij=0;Ij<tF.length;Ij++){var zt=tF[Ij],Od=parseInt(zt.getAttribute("t"),10),Ah=parseInt(zt.getAttribute("d"),10),At=parseInt(zt.getAttribute("r"),10),Jj=0;if(isNaN(Od)&&isNaN(Ah))throw ha.g.error("Either one or both FragmentDuration and FragmentTime field MUST be present in StreamFragmentElement"),
|
|
31
|
+
new _.P(_.Q,4,4037,ha.l);0===Ij&&isNaN(Od)&&(Jj=Od=0);if(0<Ij){var ng=Be[Be.length-1];Jj=ng.n+1;ng.d||(ng.d=Od-ng.t);Od||(Od=ng.t+ng.d);Ah||(Ah=Od-ng.t)}Be.push({n:Jj,d:Ah,t:Od});if(At){At--;for(var uF=0;uF<At;uF++){var Bn=Be[Be.length-1];Jj=Bn.n+1;Od=Bn.t+Bn.d;Ah=Bn.d;Be.push({n:Jj,d:Ah,t:Od})}}}ha.qd()||Be.length===Fa||ha.g.warn("Number of fragments ("+Fa+") differs from number of chunks ("+Be.length+").");I.push({type:Ta,Ym:Fa,qm:Ca,language:Ia,Fd:na,name:tb,maxWidth:Jb,maxHeight:Lc,Bm:Dm,tracks:ba,
|
|
32
|
+
Jg:Be,timescale:Ms})}var sf={hn:h,hh:l,timescale:m,duration:n,isLive:p,gn:q,af:t,kf:!1,streams:I};if(a.h&&a.w)return YM(a,sf),Promise.resolve();a.G.clear();var Bt=sf.timescale,Ct=sf.duration,NQ=zM(sf.streams,_.$c),OQ=zM(sf.streams,_.sg),PQ=zM(sf.streams,_.bg),vF=[],Cn=ZM(a,Ct,Bt,NQ),Dn=ZM(a,Ct,Bt,OQ),QQ=ZM(a,Ct,Bt,PQ);Cn.length||(Cn=[null]);Dn.length||(Dn=[null]);for(var Et=0;Et<Dn.length;Et++)for(var Ft=0;Ft<Cn.length;Ft++)vF.push($M(a,Dn[Et],Cn[Ft]));var wF={startTime:0,variants:vF,textStreams:QQ,
|
|
33
|
+
thumbStreams:[]};var SQ=sf.streams,Gt=a.a.startTime,xF=a.a.delay,Ht=a.I,yF=Math.min(a.a.duration||Infinity,Ht),It=a.qd(),TQ=a.a.af,UQ=a.a.Gd,zF=a.H,AF=isFinite(a.C)?a.C:0;if(It)yF=Infinity,Gt=Date.now()/1E3-UQ,a.a.startTime=Gt,xF=3*zF;else for(var VQ=isFinite(Ht)?Ht:a.a.duration,BF=_.u(SQ),Jt=BF.next();!Jt.done;Jt=BF.next())for(var CF=_.u(Jt.value.tracks),Kt=CF.next();!Kt.done;Kt=CF.next()){var DF=Kt.value;DF.segmentIndex.offset(-AF);_.$z(DF.segmentIndex,VQ)}a.B=new _.fA(Gt,xF,!It,!0);a.B.f=yF;_.kA(a.B,
|
|
34
|
+
zF);a.B.w=TQ;It||a.B.offset(-AF);a.D.filterAllPeriods([wF]);a.h={presentationTimeline:a.B,periods:[wF],offlineSessionIds:[],minBufferTime:0};Promise.resolve();a.J||(a.D.networkingEngine.hd(a.K),a.J=!0);a.w=sf;return Promise.resolve()},YM=function(a,b){for(var c=0;c<a.w.streams.length;c++)for(var d=b.streams[c],e={},f=_.u(a.w.streams[c].tracks),g=f.next();!g.done;e={Nb:e.Nb},g=f.next())if(e.Nb=g.value,g=d.tracks.find(function(l){return function(m){return m.type===l.Nb.type&&m.bitrate===l.Nb.bitrate}}(e))){xM(e.Nb,
|
|
35
|
+
g)||a.g.warn("The current stream is updated with a stream that seems to have different base properties!");var h=bN(a,a.w.timescale,d,g);g=e.Nb.segmentIndex;g.oa(h);(h=a.a.af)&&_.wA(g,_.vA(g)-h).forEach(function(l){l.Sa().forEach(function(m){a.G["delete"](m)})})}else a.g.warn("Cannot find satisfying update for "+e.Nb.type+" track with bitrate "+(e.Nb.bitrate+". Skipping update."))},ZM=function(a,b,c,d){for(var e=[],f={Fc:0};f.Fc<d.length;f={Fc:f.Fc},f.Fc++){var g=d[f.Fc].tracks.map(function(h){return function(l){var m=
|
|
36
|
+
d[h.Fc],n=bN(a,c,m,l);n=new _.uA(n);var p=null;m.type!==_.bg&&(p=cN(a,b,c,m,l));l.segmentIndex=n;var q=a.M++,t=Promise.resolve.bind(Promise),v=n.Mc.bind(n),z=n.get.bind(n),D=n.jd.bind(n),G=n.getDuration.bind(n),F=dN[m.type],B="";switch(m.type){case _.sg:B=l.ce;var I=/00000001[0-9]7/.exec(B);B="avc1."+(I&&I[0]?B.substr(B.indexOf(I[0])+10,6):"42c00c");a.g.debug("VIDEO CODECS: ",B);break;case _.$c:B=l.ce,I=2,"AACH"===l.Wj?I=5:B&&(I=(parseInt(B.substr(0,2),16)&248)>>3),B="mp4a.40."+I,a.g.debug("AUDIO CODECS: ",
|
|
37
|
+
B)}I=m.type===_.bg?eN[m.qm]:void 0;return{id:q,originalId:null,mn:null,createSegmentIndex:t,findSegmentPosition:v,getSegmentReference:z,adjustSegmentDurations:D,getDuration:G,segmentIndex:n,segmentLookupStrategy:_.ez,initSegmentReference:p,mimeType:F,codecs:B,frameRate:void 0,bandwidth:l.bitrate,width:l.maxWidth||void 0,height:l.maxHeight||void 0,kind:I,encrypted:a.mf(),keyId:null,language:m.language,originalLanguage:m.Fd,label:m.name,type:m.type,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,
|
|
38
|
+
roles:[],channelsCount:l.hg||null,spatialAudio:!1,closedCaptions:null}}}(f));e=e.concat(g)}return e},bN=function(a,b,c,d){var e=0,f=[],g=c.timescale||b;c.Jg.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=wM(a.l,c,l,d);a.H=Math.max(a.H,m);f.push(new _.Li(l,n,p,function(){return[q]},0,null,0,null,!0,g));a.G.set(q,n);e+=m});if(c.type===_.sg||c.type===_.$c)b=f[f.length-1],a.I=Math.min(a.I,e),0===a.a.Gd?a.a.Gd=b.endTime:a.a.Gd=Math.min(a.a.Gd,
|
|
39
|
+
b.endTime);return f},cN=function(a,b,c,d,e){b=yM(b,d.timescale||c,e);c={isLive:a.qd.bind(a),pe:a.mf.bind(a),ck:function(){return 1},je:a.Lg.bind(a)};d=new Uint8Array(0);try{d=MM(b,c)}catch(g){throw a.g.error("Failed to generate initialization segment."),new _.P(_.Q,3,4035,g);}var f="data:text/plain;base64,"+_.ej(d);return new _.Dz(function(){return[f]},0,null,null,!0)},$M=function(a,b,c){var d=(c?c.bandwidth:0)+(b?b.bandwidth:0),e=c?c.language:_.hg;return c||b?{id:a.M++,language:e,primary:!1,audio:c,
|
|
40
40
|
video:b,bandwidth:d,drmInfos:a.o,allowedByApplication:!0,allowedByKeySystem:!0}:null},VM=function(a,b,c){if(b=b.getAttribute(c))return b;a.g.error("required attribute not provided: "+c);throw new _.P(_.Q,4,4038,a.l,c);},fN=function(a,b){null!=a.A&&null!=b&&(a.j=window.setTimeout(a.Hb.bind(a),b))},WM=function(a,b){var c=b===SM;if(a.h&&a.h.presentationTimeline){var d=a.h.presentationTimeline;d.j=c;d.l=c}c&&null!=a.j&&(window.clearTimeout(a.j),a.j=null,a.A=null);a.P=b},gN=function(){};
|
|
41
41
|
BL.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};BL.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};BL.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};
|
|
42
42
|
BL.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);_.cm(a,AL(this.type));this.size>b&&uL(a,this.size);"uuid"===this.type&&_.cm(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()};_.w(Z,BL);Z.prototype.a=function(){return 4+BL.prototype.a.call(this)};Z.prototype.write=function(a){BL.prototype.write.call(this,a);vL(a,this.version);wL(a,this.flags)};
|
|
43
43
|
_.w(CL,BL);CL.prototype.a=function(){return this.h.byteLength+BL.prototype.a.call(this)-this.offset};CL.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,this.h,this.offset);a.getPosition()};_.w(DL,Z);DL.prototype.a=function(){return this.h.byteLength+Z.prototype.a.call(this)-this.offset};DL.prototype.write=function(a){Z.prototype.write.call(this,a);_.cm(a,this.h,this.offset);a.getPosition()};_.w(EL,BL);
|
|
44
|
-
EL.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+BL.prototype.a.call(this)};EL.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,AL(this.j));_.V(a,this.
|
|
44
|
+
EL.prototype.a=function(){var a=this.j.length;a=a+4+this.h.join("").length;return a+BL.prototype.a.call(this)};EL.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,AL(this.j));_.V(a,this.hh);_.cm(a,AL(this.h.join("")));a.getPosition()};_.w(FL,BL);_.w(GL,BL);_.w(HL,Z);HL.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)};
|
|
45
45
|
HL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(uL(a,0),uL(a,0),_.V(a,this.timescale),uL(a,this.duration*this.timescale)):(_.V(a,0),_.V(a,0),_.V(a,this.timescale),_.V(a,this.duration*this.timescale));_.V(a,65536);xL(a,this.volume);xL(a,0);_.V(a,0);_.V(a,0);for(var b=0;b<this.h.length;b++)vL(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()};_.w(IL,BL);_.w(JL,Z);JL.prototype.a=function(){return 20+Z.prototype.a.call(this)};
|
|
46
46
|
JL.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()};_.w(KL,Z);KL.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)};
|
|
47
47
|
KL.prototype.write=function(a){Z.prototype.write.call(this,a);1===this.version?(uL(a,0),uL(a,0),_.V(a,this.j),_.V(a,0),uL(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);xL(a,0);xL(a,0);xL(a,this.volume);xL(a,0);for(var b=0;b<this.h.length;b++)vL(a,this.h[b]);xL(a,this.width);xL(a,0);xL(a,this.height);xL(a,0);a.getPosition()};_.w(LL,Z);LL.prototype.a=function(){var a=0;a=1===this.version?a+28:a+16;return a+4+Z.prototype.a.call(this)};
|
|
@@ -64,12 +64,12 @@ oM.prototype.a=function(){return this.h.byteLength+BL.prototype.a.call(this)};oM
|
|
|
64
64
|
pM.prototype.write=function(a){Z.prototype.write.call(this,a);vL(a,0);0===this.version?vL(a,0):vL(a,0);vL(a,this.h);vL(a,this.j);_.cm(a,_.gj(this.o));if(1===this.h&&0===this.j){vL(a,0);for(var b=0;b<this.l.length;b++)vL(a,this.l[b])}a.getPosition()};_.w(qM,Z);qM.prototype.a=function(){var a=8;this.flags&1&&(a+=AL(this.Jb).byteLength);return a+Z.prototype.a.call(this)};qM.prototype.write=function(a){Z.prototype.write.call(this,a);_.cm(a,AL(this.h));_.V(a,this.j);this.flags&1&&_.cm(a,AL(this.Jb));a.getPosition()};
|
|
65
65
|
_.w(rM,BL);rM.prototype.a=function(){return AL(this.h).byteLength+BL.prototype.a.call(this)};rM.prototype.write=function(a){BL.prototype.write.call(this,a);_.cm(a,AL(this.h));a.getPosition()};_.w(sM,Z);sM.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)};
|
|
66
66
|
sM.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]):uL(a,this.offset[b]);a.getPosition()};_.w(tM,Z);tM.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)};
|
|
67
|
-
tM.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));vL(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)vL(a,this.l[b]);a.getPosition()};_.w(uM,Z);uM.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].
|
|
68
|
-
uM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&vL(a,this.l);for(var b=0;b<this.j;b++)if(_.cm(a,this.h[b].
|
|
69
|
-
_.r.update=function(){var a=this;if(this.
|
|
70
|
-
_.r.
|
|
71
|
-
_.r.
|
|
72
|
-
!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 dN={video:_.ug,audio:_.dd,text:_.Xc},SM=_.
|
|
67
|
+
tM.prototype.write=function(a){Z.prototype.write.call(this,a);this.flags&1&&(_.V(a,0),_.V(a,0));vL(a,this.h);_.V(a,this.j);if(0===this.h)for(var b=0;b<this.j;b++)vL(a,this.l[b]);a.getPosition()};_.w(uM,Z);uM.prototype.a=function(){var a=4;this.flags&1&&(a+=1);for(var b=0;b<this.j;b++)if(a+=this.h[b].Xg.byteLength,this.flags&2){a+=2;for(var c=0;c<this.h[b].dd;c++)a+=2,a+=4}return a+Z.prototype.a.call(this)};
|
|
68
|
+
uM.prototype.write=function(a){Z.prototype.write.call(this,a);_.V(a,this.j);this.flags&1&&vL(a,this.l);for(var b=0;b<this.j;b++)if(_.cm(a,this.h[b].Xg),this.flags&2){xL(a,this.h[b].dd);for(var c=0;c<this.h[b].dd;c++)xL(a,this.h[b].Qf[c].fg),_.V(a,this.h[b].Qf[c].gg)}a.getPosition()};var BM=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,CM=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,DM=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,EM=/^(\d*\.?\d*)f$/,FM=/^(\d*\.?\d*)t$/,GM=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/;KM.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};KM.prototype.write=function(){this.f=JM(this);for(var a=0;a<this.a.length;a++)this.a[a].write(this.f);return this.f.buffer};var NM=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);_.r=TM.prototype;_.r.configure=function(a){this.f=a};_.r.start=function(a,b){var c=this;this.D=b;var d=_.Og(new Set([a,vM(a)])).concat();return UM(this,d).then(function(e){return aN(c,e.data).then(function(){fN(c,c.A);return c.h})})};_.r.stop=function(){this.D&&this.D.networkingEngine.ze(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()};
|
|
69
|
+
_.r.update=function(){var a=this;if(this.qd())return UM(this,[this.l]).then(function(b){return aN(a,b.data).then(function(){return a.h})})["catch"](function(b){if(a.D)a.D.onError(b)})};_.r.onExpirationUpdated=function(){};_.r.setCurrentVariant=function(){};_.r.Hb=function(){var a=this;this.g.debug(_.Yy);this.D&&(this.j=null,this.update().then(function(){fN(a,a.A)})["catch"](function(b){a.D&&(a.D.onError(b),1===b.severity&&fN(a,100))}))};_.r.qd=function(){return this.P===XM};
|
|
70
|
+
_.r.mf=function(){return 0<this.o.length};_.r.Lg=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};
|
|
71
|
+
_.r.em=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.qd.bind(this),pe:this.mf.bind(this),ck:function(){return 1},je:this.Lg.bind(this)},d=!1,e=new _.P(_.Q,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=PM(a,b,g,c)}catch(h){d=
|
|
72
|
+
!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 dN={video:_.ug,audio:_.dd,text:_.Xc},SM=_.lc,XM="LIVE",eN={Em:_.md,Nm:_.Zf};_.w(gN,_.Ir);gN.prototype.f=function(){_.Fs.ism=TM;_.Ds[_.Yc]=TM};gN.prototype.a=function(){_.CA("ism");_.DA(_.Yc)};gN.prototype.id=function(){return"smooth"};_.H("clpp.smooth.SmoothComponent",gN);};
|
|
73
73
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
74
74
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
75
75
|
else{_=this.clpp._;(f.call(g,this));}
|
package/cjs/cl.thumbnails.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
e,c,d)})},
|
|
4
|
-
this.f=null;this.o=this.h=1;this.j=0},
|
|
5
|
-
_.dj(c)})},
|
|
6
|
-
b.thumbStreams.length})},
|
|
7
|
-
|
|
8
|
-
this.height*(this.
|
|
9
|
-
|
|
10
|
-
2014,"Failed to load thumbnail.",g))};a.
|
|
11
|
-
|
|
12
|
-
new _.P(1,9,7100,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
d.substr(0,d.lastIndexOf("/"))+"/"+h);t=
|
|
20
|
-
|
|
21
|
-
|
|
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 D.F(2);l=
|
|
23
|
-
t,v));return n?_.x(D,n.load(),4):D.F(2)}if(2!=D.a)return D["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};
|
|
24
|
-
|
|
25
|
-
_.r.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=
|
|
26
|
-
_.r.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(
|
|
27
|
-
|
|
2
|
+
var f=function(window){var dx="No thumbnail found for position: ",ex="Position is out of range: ",fx="Thumbnail URL is mandatory",gx="Wrong gridSize format",hx="clpp.thumbnails",ix=function(){this.log=new _.K(hx);this.player=null;this.a=[];this.w=!1},kx=function(a,b){b.reduce(function(c,d){var e=d,f=!1;typeof d===_.Te&&(e=d.step,f=d.preloadWhileBuffering);return c.then(function(){return jx(a,0,e,!!f)})},Promise.resolve())},jx=function(a,b,c,d){if(a.w||b>=a.a.length)return Promise.resolve();var e=b+c;return lx(a,d).then(function(){return a.a[b].load()}).then(function(){return jx(a,
|
|
3
|
+
e,c,d)})},lx=function(a,b){return new Promise(function(c){if(b||a.player.getState()!==_.Mo)c();else a.player.one(_.id,function(){c()})})},mx=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.la=p;this.Bj=h;this.fm=l;this.qk=m;this.rk=n;this.Yb=null},nx=function(){ix.call(this);
|
|
4
|
+
this.f=null;this.o=this.h=1;this.j=0},ox=function(a,b){this.time=a;this.duration=0;this.offset=b;this.length=0;this.Kd=new _.wj},px=function(){this.g=new _.K(hx);this.f=new ArrayBuffer(0);this.a=[];this.h=new _.wj},qx=function(a){var b=a.f.byteLength;a.a.forEach(function(c){c.offset+c.length<b&&c.Kd.resolve()})},sx=function(a,b){return rx(a,b).then(function(c){return new mx(c,b.time,b.duration)})},rx=function(a,b){return b.load().then(function(){var c=_.Ui(a.f,b.offset,b.length);return"data:image/jpeg;base64,"+
|
|
5
|
+
_.dj(c)})},tx=function(){ix.call(this);this.f=null},ux=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},vx=function(){ix.apply(this,arguments)},wx=function(a,b){var c=a.horizontalTiles||b.horizontalTiles||1,d=a.verticalTiles||b.verticalTiles||1,e=c*d;return{Dd:c,Wf:d,Wg:e,durationPerTile:a.durationPerTile||b.durationPerTile||(a.endTime-a.startTime)/e}},xx=function(){this.g=new _.K(hx);this.a=this.m=null},yx=function(a){return a.some(function(b){return 0<
|
|
6
|
+
b.thumbStreams.length})},Dx=function(a){return a?a===zx||a===Ax?new nx:a===Bx?new tx:a===Cx?new px:null:null},Ex=function(a){if(!a)return null;a=new _.Xj(a);return a.path.match(/.*\.vtt$/i)?Bx:a.path.match(/.*\.bif$/i)?Cx:a.path.match(/.*\.(png|jpg|jpeg)$/i)?zx:null},Fx=function(){};ix.prototype.init=function(a,b){var c=this;this.player=a;a.one(_.Gf,function(){c.w=!0});a.isLive()||this.l().then(function(){b&&b.preload&&kx(c,b.preload)})};mx.prototype.raw=function(){return this.la.cloneNode(!1)};
|
|
7
|
+
mx.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+_.Df;e.style.height=d+_.Df;e.style.backgroundColor="#000";e.style.backgroundRepeat="no-repeat";e.style.backgroundImage='url("'+this.src+'")';e.style.backgroundSize=Math.ceil(c/this.width*(this.la.naturalWidth||this.la.width))+"px "+Math.ceil(d/
|
|
8
|
+
this.height*(this.la.naturalHeight||this.la.height))+_.Df;var f=this.y/this.height;e.style.backgroundPositionX="-"+this.x/this.width*c+_.Df;e.style.backgroundPositionY="-"+f*d+_.Df;return e};
|
|
9
|
+
mx.prototype.load=function(){var a=this;this.Yb||(this.Yb=new Promise(function(b,c){function d(){a.width||(a.width=(a.la.naturalWidth||a.la.width)/a.Bj);a.height||(a.height=(a.la.naturalHeight||a.la.height)/a.fm);a.x||(a.x=a.width*a.qk);a.y||(a.y=a.height*a.rk)}if(a.la.src&&a.la.complete)d(),b(a);else{var e=null,f=function(){d();a.la.removeEventListener("load",f);a.la.removeEventListener(_.ne,e);b(a)};e=function(g){a.la.removeEventListener("load",f);a.la.removeEventListener(_.ne,e);c(new _.P(1,9,
|
|
10
|
+
2014,"Failed to load thumbnail.",g))};a.la.addEventListener("load",f);a.la.addEventListener(_.ne,e);a.la.src=a.src}}));return this.Yb};_.H("clpp.thumbnails.Thumbnail",mx);mx.prototype.load=mx.prototype.load;mx.prototype.element=mx.prototype.element;mx.prototype.raw=mx.prototype.raw;_.w(nx,ix);
|
|
11
|
+
nx.prototype.init=function(a,b){if(!b||!b.url)throw new _.P(1,9,7100,fx);if("GRID"===b.mode&&!b.gridSize)throw new _.P(1,9,7100,"Grid size is mandatory for GRID mode");if(!b.duration)throw new _.P(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 _.P(1,9,7100,gx);}catch(d){throw this.log.error("Error during parsing gridSize",d),
|
|
12
|
+
new _.P(1,9,7100,gx);}ix.prototype.init.call(this,a,b)};nx.prototype.get=function(a){var b=this,c,d,e,f;return _.E(function(g){if(1==g.a){c=b.player.getDuration();if(0>a||a>c)throw new _.P(1,9,2014,ex+a);d=b.f.duration;e=Math.floor(a/d);f=b.a[e];if(!f)throw new _.P(1,9,2014,"No thumbnail found for position "+a+" at index "+e);return _.x(g,f.load(),2)}return g["return"](f)})};
|
|
13
|
+
nx.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getDuration(),b=this.h*this.o;a=Math.ceil(Math.ceil(a/this.j)/b);for(var c=this.f.templateKey||"$index$",d=0;d<a;d++)for(var e=this.f.url.replace(c,String(d+1)),f=new Image,g=0;g<b;g++)this.a.push(new mx(e,this.j*(d*b+g),this.j,0,0,0,0,this.h,this.o,g%this.h,Math.floor(g/this.h),f));return Promise.resolve()};ox.prototype.load=function(){return this.Kd};
|
|
14
|
+
px.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,fx);var d=b.url,e=_.rj(d);e.type=_.qj;a.getNetworkEngine().fetch(e).O.then(function(f){f=f.data;var g=_.Ui(c.f);f=_.Ui(f);for(var h=g.byteLength+f.byteLength,l=new ArrayBuffer(h),m=new DataView(l),n=0,p=0,q=g.byteLength;p<q;p++)m.setUint8(n,g[p]),n+=1;g=0;for(p=f.byteLength;g<p;g++)m.setUint8(n,f[g]),n+=1;c.f=l;c.g.info("Appended "+f.byteLength+" bytes.Total data now "+(h+" bytes."));l=c.f;f=_.Ui(l);n=String.fromCharCode.apply(null,
|
|
15
|
+
Gx);g=Array.prototype.slice.call(f,0,8);f=64;h=0;m=!1;if(n===String.fromCharCode.apply(null,g))for(l=new DataView(l,16,20),l=l.getUint32(0,!0),0===l&&(l=1E3);!m;){h+=1;g=l;n=new DataView(c.f,f);m=n.getUint32(0,!0);g=m*g/1E3;n=n.getUint32(4,!0);n=new ox(g,n);if(g=c.a.length)g=c.a[g-1],g.length=n.offset-g.offset,g.duration=n.time-g.time;c.a.push(n);f+=8;(m=4294967295===m)&&c.h.resolve();if(1E5<h)throw Error("There was a problem during reading BIF entries");}else throw Error("The file is not a valid BIF format");
|
|
16
|
+
qx(c)})["catch"](function(f){c.g.error("[BIF] Error while loading thumbnails '\n + 'URL: "+d,f);a.onError(new _.P(1,9,2013,"Error while loading and parsing BIF thumbnails.",f))})};px.prototype.get=function(a){var b=this,c,d;return _.E(function(e){switch(e.a){case 1:if(0>a)throw new _.P(1,9,2014,ex+a);return _.x(e,b.h,2);case 2:c=b.a.find(function(f){return a>=f.time&&a<f.time+f.duration});if(!c)throw new _.P(1,9,2014,dx+a);return _.x(e,sx(b,c),3);case 3:return d=e.f,_.x(e,d.load(),4);case 4:return e["return"](d)}})};
|
|
17
|
+
px.prototype.Cd=function(){return 0<this.a.length};var Gx=[137,66,73,70,13,10,26,10];_.w(tx,ix);
|
|
18
|
+
tx.prototype.init=function(a,b){var c=this;if(!b||!b.url)throw new _.P(1,9,7100,fx);var d=b.url,e=_.rj(d);e.type=_.qj;this.f=a.getNetworkEngine().fetch(e).O.then(function(f){f=f.data;if(!f)throw Error("No data in the response");f=_.R.Z(f).split(/\n/);for(var g=0;g<f.length;g++){var h=f[g],l=h.split(" --\x3e ");if(2===l.length){h=f[++g];var m=h.indexOf("\x3d"),n=0>m?[]:h.substr(m+1).split(/,/).map(parseFloat);m=n[0];var p=n[1],q=n[2];n=n[3];var t=h.indexOf("#");h=0>t?h:h.substr(0,t);h.match(/^http|^\/\//)||(h=
|
|
19
|
+
d.substr(0,d.lastIndexOf("/"))+"/"+h);t=ux(l[0]);l=ux(l[1])-t;c.a.push(new mx(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 _.P(1,9,2013,"Error while loading VTT thumbnails.",f))});ix.prototype.init.call(this,a,b)};
|
|
20
|
+
tx.prototype.get=function(a){var b=this,c;return _.E(function(d){if(1==d.a){if(0>a)throw new _.P(1,9,2014,ex+a);return _.x(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 _.P(1,9,2014,dx+a);return _.x(d,c.load(),3)}return d["return"](c)})};tx.prototype.l=function(){return this.f};_.w(vx,ix);
|
|
21
|
+
vx.prototype.get=function(a){function b(){return new _.P(1,9,2014,dx+a)}var c=this,d,e,f,g,h,l,m,n,p,q,t,v,z;return _.E(function(D){if(1==D.a){if(0>a)throw c.log.error("Position must be greater than 0 but is "+a),new _.P(1,9,2014,ex+a);d=c.player.getPeriods();for(var G=null,F=_.u(d),B=F.next();!B.done;B=F.next())B=B.value,B.startTime<=a&&(G=B);e=G;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 D.F(2);l=wx(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.Wg+m])):(q=h.Sa())&&0<q.length&&(v=t=0,z=h.startTime,1<l.Wg&&(t=m%l.Dd,v=Math.floor(m/l.Dd),z+=m*l.durationPerTile),n=new mx(q[0],z,l.durationPerTile,void 0,void 0,void 0,void 0,l.Dd,l.Wf,
|
|
23
|
+
t,v));return n?_.x(D,n.load(),4):D.F(2)}if(2!=D.a)return D["return"](n);c.log.error("segment reference for specified segment index does not exist",g);throw b();})};vx.prototype.f=function(a,b){return void 0!==a.bandwidth&&void 0!==b.bandwidth?a.bandwidth-b.bandwidth:0};
|
|
24
|
+
vx.prototype.l=function(){if(0<this.a.length)return Promise.resolve();var a=this.player.getPeriods();a=_.u(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&&!_.N.R(d=b.getSegmentReference(c++));)for(var e=wx(d,b),f=d.Sa()[0],g=new Image,h=d.startTime,l=0;l<e.Wf;++l)for(var m=0;m<e.Dd;++m)this.a.push(new mx(f,h,e.durationPerTile,void 0,void 0,void 0,void 0,e.Dd,e.Wf,m,l,g)),h+=e.durationPerTile;return Promise.resolve()};_.r=xx.prototype;_.r.onPlayerCreated=function(a){this.m=a};_.r.onPlayerWillDestroy=function(){this.m=null};_.r.onPlayerWillRelease=function(){this.a=null};
|
|
25
|
+
_.r.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=Ex(c.url||null));(this.a=Dx(d))?(this.g.info("Loading thumbs configuration",c),this.m.one(_.Fe,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
|
+
_.r.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(yx(d)){this.a=new vx;try{this.a.init(a,c)}catch(e){this.m.onError(e)}}}};_.r.get=function(a){return this.a?this.a.get(a):Promise.reject(new _.P(1,9,2014,"Thumbnail format is not supported"))};_.r.id=function(){return"thumbnails"};_.H("clpp.thumbnails.ThumbnailsPlugin",xx);xx.prototype.get=xx.prototype.get;xx.Id="thumbnails";
|
|
27
|
+
Fx.prototype.create=function(){return new xx};_.nq(new Fx);var zx="SINGLE",Ax="GRID",Bx="WEBVTT",Cx="BIF";};
|
|
28
28
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
29
29
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
30
30
|
else{_=this.clpp._;(f.call(g,this));}
|