@castlabs/prestoplay 6.17.1 → 6.18.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 +30 -0
- package/cjs/cl.adobe.js +3 -3
- package/cjs/cl.airplay.js +3 -3
- package/cjs/cl.broadpeak.js +7 -7
- package/cjs/cl.cast.js +111 -111
- package/cjs/cl.conviva.js +33 -33
- package/cjs/cl.core.js +566 -558
- package/cjs/cl.crypto.js +9 -9
- package/cjs/cl.dash.js +75 -74
- package/cjs/cl.externs.js +46 -46
- package/cjs/cl.freewheel.js +24 -24
- package/cjs/cl.hls.js +71 -69
- package/cjs/cl.hlssmpte.js +6 -6
- package/cjs/cl.htmlcue.js +29 -29
- package/cjs/cl.ima.js +23 -23
- package/cjs/cl.mse.js +311 -311
- package/cjs/cl.muxdata.js +15 -15
- package/cjs/cl.onboard.js +3 -3
- package/cjs/cl.persistent.js +14 -14
- package/cjs/cl.playlist.js +6 -6
- package/cjs/cl.sessions.js +15 -15
- package/cjs/cl.simid.js +15 -15
- package/cjs/cl.smooth.js +72 -72
- package/cjs/cl.thumbnails.js +26 -26
- package/cjs/cl.tizen.js +69 -69
- package/cjs/cl.ttml.js +28 -28
- package/cjs/cl.verimatrix.js +5 -5
- package/cjs/cl.vimond.js +13 -13
- package/cjs/cl.vr.js +19 -19
- package/cjs/cl.vtt.js +14 -14
- package/cjs/cl.youbora.js +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 +456 -450
- package/cl.crypto.js +8 -8
- package/cl.dash.js +70 -69
- package/cl.externs.js +46 -46
- package/cl.freewheel.js +19 -19
- package/cl.hls.js +72 -72
- package/cl.hlssmpte.js +5 -5
- package/cl.htmlcue.js +26 -26
- package/cl.ima.js +17 -17
- package/cl.mse.js +274 -273
- package/cl.muxdata.js +13 -13
- package/cl.onboard.js +4 -4
- package/cl.persistent.js +10 -10
- package/cl.playlist.js +5 -5
- package/cl.sessions.js +10 -10
- package/cl.simid.js +13 -13
- package/cl.smooth.js +59 -59
- package/cl.thumbnails.js +19 -19
- package/cl.tizen.js +57 -57
- package/cl.ttml.js +22 -22
- package/cl.verimatrix.js +4 -4
- package/cl.vimond.js +8 -8
- package/cl.vr.js +15 -15
- package/cl.vtt.js +12 -12
- package/cl.youbora.js +15 -15
- package/package.json +2 -2
- package/typings.d.ts +37 -3
package/cjs/cl.muxdata.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
data:
|
|
4
|
-
f.video_source_url=_.
|
|
5
|
-
d.language);return f}});a.g.debug("Mux SDK options",b);return b},
|
|
6
|
-
a.a.on(a.m,_.
|
|
7
|
-
_.
|
|
8
|
-
request_hostname:d.a};a.g.debug("onRequestCanceled()","Track event: requestcanceled",b);a.emit("requestcanceled",b)}else{d=b.requestStartTimestamp;var e=new _.
|
|
9
|
-
b)}})},
|
|
10
|
-
_.t.emit=function(a,b){if(null===this.w)throw new _.
|
|
11
|
-
_.t.
|
|
12
|
-
_.t.
|
|
13
|
-
request_url:_.
|
|
14
|
-
_.t.onContentWillLoad=function(a,b){var c=a.getConfiguration();c=_.
|
|
15
|
-
var h=d;null!==h&&this.f.initialize(c,b,h)}catch(l){this.a=!1,this.T(a,l)}};_.t.onContentLoaded=function(){};_.t.onPlayerWillDestroy=function(){this.a&&(this.f.destroy(),this.m=this.f=null)};_.t.onPlayerWillRelease=function(){this.a&&this.f.release()};_.t.id=function(){return"mux"};_.t.emit=function(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.T(this.m,c),c;}};_.t.T=function(a,b){a.trigger(new _.L(_.
|
|
16
|
-
|
|
2
|
+
var f=function(window){var SA=function(a){switch(a.type){case 1:return PA;case 2:return QA;case 3:return RA}},UA=function(a){var b=Object.keys(a).find(function(c){return TA.includes(c.toLowerCase())});return void 0!==b?a[b]:void 0},VA=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 _.Xh;this.g=b;this.A=this.l=this.h=!1;this.w=null;this.j=a.getNetworkEngine();this.G=this.Tj.bind(this);this.D=this.$m.bind(this)},XA=function(a){var b={debug:!0,
|
|
3
|
+
data:WA(a)};a.f&&a.f.muxOptionsOverride&&_.M.cd(a.f.muxOptionsOverride)&&(b=_.M.pa(b,a.f.muxOptionsOverride));b=_.M.pa(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 _.tk(c.url);
|
|
4
|
+
f.video_source_url=_.uk(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().na(),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.ma())&&d.language&&(f.player_language_code=
|
|
5
|
+
d.language);return f}});a.g.debug("Mux SDK options",b);return b},WA=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},YA=function(a){a.a.on(a.m,_.ug,function(){var b={player_playhead_time:1E3*a.m.getPosition()};a.emit(_.ug,b)});a.a.on(a.m,_.of,function(){return a.emit(_.of)});
|
|
6
|
+
a.a.on(a.m,_.ld,a.Qj.bind(a));a.a.on(a.m,_.jg,a.Sj.bind(a));a.a.on(a.m,_.Gg,function(){return a.emit(_.bg)});a.a.on(a.m,_.Dg,function(){return a.emit(_.ag)});a.a.on(a.m,_.te,a.Rj.bind(a));a.a.on(a.m,_.zc,function(){return a.emit("adbreakstart")});a.a.on(a.m,_.Ac,function(){return a.emit("adbreakend")});a.a.on(a.m,_.Mc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,_.Ic,function(){return a.emit("adpause")});a.a.on(a.m,_.Kc,function(){a.emit("adplay");a.emit("adplaying")});a.a.on(a.m,
|
|
7
|
+
_.Nc,function(){return a.emit("adended")});a.a.on(a.m,_.Ec,function(){return a.emit("adfirstquartile")});a.a.on(a.m,_.Hc,function(){return a.emit("admidpoint")});a.a.on(a.m,_.Oc,function(){return a.emit("adthirdquartile")});a.j.Nc(a.G);a.j.jf(a.D);a.a.on(a.m,_.te,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 _.tk(b.uris[b.uriIndex]);b={request_start:c,request_type:SA(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 _.tk(b.uris[b.uriIndex]),f=c.data;b={request_start:d,request_type:SA(b),request_hostname:e.a,request_error:""+SA(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)}})},ZA=function(a){_.$h(a.a);a.j.Yd(a.G);a.j.cg(a.D)},$A=function(){this.f=this.m=null;this.a=!1;this.g=new _.K("clpp.muxdata")},aB=function(a){return!_.M.S(a)&&typeof a.init===_.we&&typeof a.emit===_.we},bB=function(){},PA="manifest",QA="media",RA="encryption",TA=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"];_.t=VA.prototype;_.t.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,XA(this))}catch(d){throw this.h=!1,ZA(this),new _.N(1,9,9302,null,d);}this.emit("playerready")}this.l&&!this.A&&(a=WA(this),this.emit("videochange",a),this.l=!1);YA(this)};_.t.release=function(){this.g.debug("release()");this.l?this.g.debug(_.ma):(ZA(this),this.l=!0,this.o=this.f=null)};_.t.destroy=function(){this.g.debug(_.$d);this.A?this.g.debug(_.la):(this.A=!0,this.emit("destroy"))};
|
|
10
|
+
_.t.emit=function(a,b){if(null===this.w)throw new _.N(1,9,9301);this.w.emit(this.B,a,b)};_.t.Qj=function(a){this.g.debug(_.af);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}))};_.t.Sj=function(a){this.g.debug(_.ef);switch(a.detail.currentState){case _.zp:this.m.getConfiguration().autoplay&&this.emit(_.of);break;case _.Bp:this.emit(_.zf);break;case _.Ap:this.emit(_.kf);break;case _.up:this.emit(_.se)}};
|
|
11
|
+
_.t.Rj=function(a){this.g.debug(_.bf);if(this.h&&(a=a.detail||null))if(10003===a.code)this.emit("aderror");else if(a.severity===_.O){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(_.te,{player_error_code:a.code,player_error_message:b})}};
|
|
12
|
+
_.t.Tj=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 _.tk(b.uris[b.uriIndex]);a={request_start:e,request_type:SA(b),request_hostname:g.a,request_id:UA(c),request_bytes_loaded:d,request_response_start:h,request_response_end:a,request_response_headers:c,request_media_duration:f,
|
|
13
|
+
request_url:_.uk(g)};this.g.debug("onRequestCompleted()","Track event: requestcompleted",a);this.emit("requestcompleted",a)}};_.t.$m=function(a){a.requestStartTimestamp=Date.now()};_.x($A,_.Gu);_.t=$A.prototype;_.t.onPlayerCreated=function(a){this.m=a;this.f=new VA(a,this.g)};
|
|
14
|
+
_.t.onContentWillLoad=function(a,b){var c=a.getConfiguration();c=_.M.Oa(c.muxdata);try{var d=[];typeof c===_.$e&&(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.S(e.muxdata)&&typeof e.muxdata===_.$e){var f=e.muxdata;d=aB(f.muxLib)?f.muxLib:window.mux;if(!aB(d)){this.g.warn("Mux SDK is not loaded. Will do nothing.");this.a=!1;var g=new _.N(1,9,9301);this.T(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.T(a,l)}};_.t.onContentLoaded=function(){};_.t.onPlayerWillDestroy=function(){this.a&&(this.f.destroy(),this.m=this.f=null)};_.t.onPlayerWillRelease=function(){this.a&&this.f.release()};_.t.id=function(){return"mux"};_.t.emit=function(a,b){try{this.f.emit(a,b)}catch(c){throw null!==this.m&&this.T(this.m,c),c;}};_.t.T=function(a,b){a.trigger(new _.L(_.te,{detail:b}))};_.J("clpp.muxdata.MuxDataPlugin",$A);$A.prototype.emit=$A.prototype.emit;
|
|
16
|
+
$A.Id="mux";bB.prototype.create=function(){return new $A};_.br(new bB);};
|
|
17
17
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
18
18
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
19
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:_.sn,licenseResponse:_.
|
|
4
|
-
|
|
2
|
+
var f=function(window){var NA=function(){this.g=new _.K("clpp.onboard");this.j=new Set},OA=function(a,b){function c(l){return l&&(_.S.startsWith(l,"https://")||_.S.startsWith(l,"http://")||_.S.startsWith(l,"//"))?l:d+l}var d=b.baseUrl;_.S.endsWith(d,"/")||(d+="/");var e=c(b.widevineUrl||"widevine"),f=c(b.playreadyUrl||"playready"),g=c(b.fairplayUrl||"fairplay"),h=new _.Em(a);h.Ua(_.Vd,{licenseUrl:e,videoRobustness:[_.$b,void 0],audioRobustness:[_.Zb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,
|
|
3
|
+
modifiers:{licenseRequest:_.sn,licenseResponse:_.zn}});h.Ua(_.Rd,{licenseUrl:g,certificateUrl:g,modifiers:{licenseRequest:_.un,licenseResponse:_.vn,extractContentId:_.qn,certificateRequest:_.yn}});h.Ua(_.Td,{licenseUrl:f,modifiers:{licenseRequest:_.sn}});_.zm(h)};_.x(NA,_.Ts);NA.prototype.a=function(){for(var a=_.w(this.j),b=a.next();!b.done;b=a.next())delete _.ym[b.value];this.j.clear()};
|
|
4
|
+
NA.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+"'"),OA(b,a),this.j.add(b))};NA.prototype.id=function(){return"onboard"};_.J("clpp.onboard.OnboardComponent",NA);_.J("clpp.onboard.register",OA);};
|
|
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.
|
|
4
|
-
videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.
|
|
5
|
-
_.
|
|
6
|
-
6);case 6:return _.y(q,_.
|
|
7
|
-
f),new _.
|
|
8
|
-
_.t.store=function(a,b){var c;return _.
|
|
9
|
-
btoa(c));_.
|
|
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,u,v,z,
|
|
11
|
-
u=[];v=_.w(d);for(z=v.next();!z.done;z=v.next())
|
|
12
|
-
4,4014));
|
|
13
|
-
_.J("clpp.persistent.removeLicense",function(a){var b,c,d,e,f,g,h;return _.
|
|
14
|
-
6);case 6:return _.y(l,_.
|
|
15
|
-
|
|
2
|
+
var f=function(window){var vA="A persistent DRM session already exists for: ",wA="No DRM configuration.",xA="clpp.persistent",yA="clpp.persistent.SimpleSessionStorage",zA=function(a,b){for(var c=[],d=_.w(a),e=d.next();!e.done;e=d.next())c.push(b(e.value));return c},AA=function(a){a=a.f.keys();a=zA(a,function(b){return b.sessionId});return Array.from(a)},BA=function(a,b){var c,d,e;return _.I(function(f){if(1==f.a)return _.y(f,_.Fo(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.yb=new _.Rj,d.push(e.yb));a.g.debug("Attempting to remove session",b);d.push(c.remove());return f["return"](Promise.all(d))})},DA=function(a,b){a.K=CA;a.L=[];a.G=!0;return _.go(a,b)},FA=function(a,b,c,d,e,f){a.K=EA;var g=new Map,h=_.Ko(b);g.set(h,{audioCapabilities:e,videoCapabilities:f,distinctiveIdentifier:_.gf,persistentState:_.Uf,sessionTypes:[_.mf],label:h,drmInfos:[{keySystem:b,licenseServerUri:c,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",
|
|
4
|
+
videoRobustness:"",serverCertificate:d,initData:null,keyIds:null}]});return _.mo(a,g)},GA=function(){this.g=new _.K(yA)},HA=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}},IA=function(a,b){var c=
|
|
5
|
+
_.Bm(a),d=_.fm({drm:a});d.drm=a;var e=new _.bo({wb:b,onError:function(){},Tf:function(){},Sf:function(){},onEvent:function(){},getConfiguration:function(){return d},Yc:function(){return null}});e.h=c;return e},LA=function(a,b,c){var d,e,f,g,h,l,m,n,p;return _.I(function(q){switch(q.a){case 1:d=JA;e=KA;if(!a)return e.debug(wA),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(vA,f),q["return"]();h=IA(a,c);_.D(q,3,4);return _.y(q,DA(h,b),
|
|
6
|
+
6);case 6:return _.y(q,_.so(h),7);case 7:return _.y(q,_.zo(h),8);case 8:return l=h.getDrmInfo(),m=b.map(function(u){return{contentType:_.Uk(u.video.mimeType,u.video.codecs),robustness:l.videoRobustness}}),n=AA(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 _.uh(q),_.y(q,h.destroy(),10);case 10:_.vh(q,0);break;case 3:throw p=_.E(q),e.error("Error while persisting DRM session "+
|
|
7
|
+
f),new _.N(1,6,6200,null,p);}})},MA=function(){this.g=new _.K(xA)},CA=1,EA=2;_.t=GA.prototype;
|
|
8
|
+
_.t.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));_.B(d)})};_.t.get=function(a){var b=this,c;return _.I(function(d){if(c=window.localStorage.getItem(encodeURIComponent(a)))try{return d["return"](HA(atob(c)))}catch(e){b.g.warn("Error while loading offline items for "+a+" from storage: ",e)}return d["return"](null)})};_.t["delete"]=function(a){return _.I(function(b){window.localStorage.removeItem(encodeURIComponent(a));_.B(b)})};_.t.clear=function(){return _.I(function(a){window.localStorage.clear();_.B(a)})};_.t.getName=function(){return yA};_.J("clpp.persistent.useStorage",function(a){var b=["store","get","delete","clear","getName"];var c=[];_.M.S(a)||(_.M.vb(a.store)||c.push("store"),_.M.vb(a.get)||c.push("get"),_.M.vb(a["delete"])||c.push("delete"),_.M.vb(a.clear)||c.push("clear"),_.M.vb(a.getName)||c.push("getName"),b=c);if(0<b.length)throw KA.warn("Invalid session storage implementation"),new _.N(1,6,6202,{missingMethods:b});JA=a});
|
|
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,u,v,z,A,G,F,C,H,Q,R,na;return _.I(function(da){switch(da.a){case 1:f=JA;g=KA;h=function(Ba,ab){return new _.N(1,6,6200,Ba,ab)};l=_.Fp(a).shift();if(!l)throw h("No source specified.");if(!b)throw h(wA);m=b.offlineId;if(typeof m!==_.mg||!m.length)throw h("Missing offline id.");return _.y(da,f.get(m),2);case 2:if(n=da.f)return g.debug(vA,m),da["return"]();p=_.fm();q=new _.dk;
|
|
11
|
+
u=[];v=_.w(d);for(z=v.next();!z.done;z=v.next())A=z.value,G=new A,_.jm(G.id())||(G.f(),_.lm(G),u.push(G));F=null;_.D(da,3,4);return _.y(da,_.Pt(l.url,q,p.manifest.attemptParameters,l.type||null),6);case 6:return F=da.f,F.configure(p.manifest),_.y(da,F.start(l.url,{configurationId:"",networkingEngine:q,filterAllPeriods:function(){},filterNewPeriod:function(){},onTimelineCueAdded:function(){},onEvent:function(){},onError:function(){}}),7);case 7:C=da.f;if(!C.periods.length)throw h(null,new _.N(_.O,
|
|
12
|
+
4,4014));H=_.Gt(C.periods);return _.y(da,LA(b,H,q),4);case 4:for(_.uh(da);u.length;)Q=u.shift(),Q.a(),_.im["delete"](Q.id());R=[];F&&R.push(F.stop());R.push(q.destroy());return _.y(da,Promise.all(R),9);case 9:_.vh(da,0);break;case 3:na=_.E(da);if(na instanceof _.N&&6200===na.code)throw na;throw h(null,na);}})});
|
|
13
|
+
_.J("clpp.persistent.removeLicense",function(a){var b,c,d,e,f,g,h;return _.I(function(l){switch(l.a){case 1:b=JA;c=KA;if(!_.M.ca(a)||0===a.length)return c.warn("Invalid offlineId"),l["return"]();e=d=null;_.D(l,2,3);return _.y(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 _.dk;d=IA(f.drmConfig,e);return _.y(l,FA(d,f.keySystem,f.licenseServerUri,f.serverCertificate,f.audioCapabilities,f.videoCapabilities),
|
|
14
|
+
6);case 6:return _.y(l,_.so(d),7);case 7:return _.y(l,Promise.all(f.sessionIds.map(function(m){return _.I(function(n){if(1==n.a)return _.y(n,BA(d,m),2);c.debug("successfully removed session with id",m);_.B(n)})})),8);case 8:return _.y(l,b["delete"](a),3);case 3:return _.uh(l),g=[],d&&g.push(d.destroy()),e&&g.push(e.destroy()),_.y(l,Promise.all(g),10);case 10:_.vh(l,0);break;case 2:throw h=_.E(l),c.error("Failed to remove session"),new _.N(1,6,6201,null,h);}})});var JA=new GA,KA=new _.K(xA);_.x(MA,_.Ts);MA.prototype.id=function(){return _.lf};MA.prototype.l=function(a,b){var c=this,d,e,f;return _.I(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();_.D(g,2);return _.y(g,LA(d,b,e),4)}if(2!=g.a)return a.trigger(new _.L(_.le,{offlineId:d.offlineId})),_.th(g,0);f=_.E(g);a.onError(f);_.B(g)})};
|
|
15
|
+
MA.prototype.j=function(a){var b=this,c,d;return _.I(function(e){if(1==e.a)return b.g.debug("Getting EME session IDs for "+a),c=JA,_.D(e,2),_.y(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"]([])}_.E(e);b.g.warn("Error while loading session info from storage");return e["return"]([])})};_.J("clpp.persistent.PersistentLicenseComponent",MA);};
|
|
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
|
-
_.t
|
|
4
|
-
_.t.next=function(){var a=this,b;return _.
|
|
5
|
-
_.t.append=function(a){this.a.push(a);
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var f=function(window){var sA=function(a,b){b=void 0===b?function(){return Promise.resolve()}:b;_.Yl.call(this);this.m=a;this.l=b;this.f=0;this.a=[];this.h=!1;this.j=this.Ya.bind(this)},tA=function(a){a.trigger(new _.L(_.Bf))},uA=function(a,b){return 0<=b&&b<a.a.length};_.x(sA,_.Yl);_.t=sA.prototype;_.t.on=function(a,b,c){return _.Yl.prototype.on.call(this,a,b,c)};_.t.one=function(a,b,c){return _.Yl.prototype.one.call(this,a,b,c)};_.t.off=function(a,b){return _.Yl.prototype.off.call(this,a,b)};_.t.getPosition=function(){return this.f};
|
|
3
|
+
_.t.bl=function(){return this.a};_.t.Gd=function(){return 0<this.a.length&&uA(this,this.f)?this.a[this.f]:null};_.t.dl=function(){var a=this.f+1;return 0<this.a.length&&uA(this,a)?this.a[a]:null};_.t.ul=function(){return this.h};_.t.start=function(){this.h||(this.h=!0,this.m.on(_.se,this.j),this.Ae(this.f,!0))};_.t.stop=function(){this.h=!1;this.m.off(_.se,this.j)};_.t.Ya=function(){this.next()};
|
|
4
|
+
_.t.next=function(){var a=this,b;return _.I(function(c){b=Math.min(a.a.length-1,a.f+1);return _.y(c,a.Ae(b),0)})};_.t.Um=function(){var a=this,b;return _.I(function(c){b=Math.max(0,a.f-1);return _.y(c,a.Ae(b),0)})};_.t.Ae=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&&uA(c,a))||!b&&c.f===a)return e["return"]();c.f=a;return(d=c.Gd())?_.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(_.Af,{item:d}));_.B(e)})};
|
|
5
|
+
_.t.append=function(a){this.a.push(a);tA(this)};_.t.pl=function(a,b){if(0<=b&&b<=this.a.length){var c=this.Gd();this.a.splice(b,0,a);c&&(this.f=this.a.indexOf(c));tA(this)}};_.t.remove=function(a){if(0<this.a.length&&uA(this,a)){if(this.f===a)throw Error("Can't remove the current item");this.a.splice(a,1);tA(this)}};_.t.clear=function(){this.stop();this.f=0;this.a=[];this.h=!1;tA(this)};_.J("clpp.Playlist",sA);sA.prototype.clear=sA.prototype.clear;sA.prototype.remove=sA.prototype.remove;
|
|
6
|
+
sA.prototype.insert=sA.prototype.pl;sA.prototype.append=sA.prototype.append;sA.prototype.goTo=sA.prototype.Ae;sA.prototype.previous=sA.prototype.Um;sA.prototype.next=sA.prototype.next;sA.prototype.onEnded=sA.prototype.Ya;sA.prototype.stop=sA.prototype.stop;sA.prototype.start=sA.prototype.start;sA.prototype.isStarted=sA.prototype.ul;sA.prototype.getUpcoming=sA.prototype.dl;sA.prototype.getCurrent=sA.prototype.Gd;sA.prototype.getQueue=sA.prototype.bl;sA.prototype.getPosition=sA.prototype.getPosition;
|
|
7
|
+
sA.prototype.off=sA.prototype.off;sA.prototype.one=sA.prototype.one;sA.prototype.on=sA.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.sessions.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(function(){var g={}; var _ = _ || {}
|
|
2
|
-
var f=function(window){var
|
|
3
|
-
e){if(0<=e){var f=_.w(
|
|
4
|
-
63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},
|
|
5
|
-
|
|
6
|
-
a;this.h=b;this.duration=c;this.j=d;this.f=[]},
|
|
7
|
-
63|128;this.data=a},
|
|
8
|
-
this.f=null;this.j=!1;
|
|
9
|
-
_.
|
|
10
|
-
1E3);e.f=d%1E3*1E6;c.time=e;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},
|
|
11
|
-
|
|
12
|
-
_.t.onContentWillLoad=function(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_
|
|
13
|
-
this.f.on(this.m,_.
|
|
14
|
-
_.t.
|
|
15
|
-
_.t.
|
|
16
|
-
_
|
|
2
|
+
var f=function(window){var mz="apiUrl config is missing",nz="prestoplay-web",oz=function(a,b){a.j=a.j.filter(function(c){return c!==b})},pz=function(a){var b=0>a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));return[c,a]},qz=function(){this.a=[]},tz=function(a,b,c){rz(a,b,c,function(d,e){sz(d,e)})},sz=function(a,b){if(0<=b)uz(a,b);else{for(var c=b,d=0;9>d;d++)a.a.push(c&127|128),c>>=7;a.a.push(1)}},wz=function(a,b,c){rz(a,b,c,function(d,
|
|
3
|
+
e){if(0<=e){var f=_.w(pz(e)),g=f.next().value;f=f.next().value;vz(d,g,f)}else f=_.w(pz(e)),g=f.next().value,f=f.next().value,vz(d,g,f)})},yz=function(a,b,c){xz(a,b,c,function(d,e){for(var f=0;f<e.length;f++){var g=e.charCodeAt(f);if(128>g)d.a.push(g);else if(2048>g)d.a.push(g>>6|192),d.a.push(g&63|128);else if(65536>g)if(55296<=g&&56319>=g&&f+1<e.length){var h=e.charCodeAt(f+1);56320<=h&&57343>=h&&(g=1024*(g-55296)+h-56320+65536,d.a.push(g>>18|240),d.a.push(g>>12&63|128),d.a.push(g>>6&63|128),d.a.push(g&
|
|
4
|
+
63|128),f++)}else d.a.push(g>>12|224),d.a.push(g>>6&63|128),d.a.push(g&63|128)}})},Az=function(a,b,c){xz(a,b,c,function(d,e){zz(d,e.a())})},Bz=function(a,b,c){xz(a,b,c,function(d,e){zz(d,e)})},zz=function(a,b){a.a.push.apply(a.a,b)},rz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.k&&0===c||typeof c===_.mg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c)){uz(a,b<<3|2);b=new qz;for(var e=0;e<c.length;e++)d(b,c[e]);sz(a,b.length());zz(a,b.end())}else uz(a,b<<3|0),d(a,c)},
|
|
5
|
+
xz=function(a,b,c,d){if(!(null===c||void 0===c||typeof c===_.k&&0===c||typeof c===_.mg&&0===c.length||Array.isArray(c)&&0===c.length))if(Array.isArray(c))for(var e=0;e<c.length;e++){uz(a,b<<3|2);var f=new qz;d(f,c[e]);sz(a,f.length());zz(a,f.end())}else uz(a,b<<3|2),b=new qz,d(b,c),sz(a,b.length()),zz(a,b.end())},uz=function(a,b){for(;127<b;)a.a.push(b&127|128),b>>>=7;a.a.push(b)},vz=function(a,b,c){for(;0<c||127<b;)a.a.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.a.push(b)},Cz=function(a,b,c,d){this.downloadId=
|
|
6
|
+
a;this.h=b;this.duration=c;this.j=d;this.f=[]},Dz=function(a,b){this.f=a;this.url=b;this.downloadId=null;this.headers=[];this.size=this.duration=null},Ez=function(a,b){this.h=a;this.f=b},Fz=function(a){this.cause=a;this.f=this.message=this.severity=this.errorCode=null},Gz=function(a,b){this.key=a;this.value=b},Hz=function(){this.cause=this.severity=this.code=null},Iz=function(){this.data=null},Jz=function(){this.data=null;var a=new Uint8Array(16);crypto.getRandomValues(a);a[6]=a[6]&15|64;a[8]=a[8]&
|
|
7
|
+
63|128;this.data=a},Kz=function(){this.headers=[]},Lz=function(){},Mz=function(a){this.j=a;this.f=this.h=this.time=this.sessionId=null},Nz=function(){this.f=null;this.events=[]},Oz=function(){this.f=this.h=null},Pz=function(){this.f=this.h=null},Qz=function(a){var b=new Pz;b.h=Math.floor(a/1E3);b.f=a%1E3*1E6;return b},Tz=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 Jz;this.A=new Jz;this.a=[];this.h=setInterval(function(){return Rz(g)},h);
|
|
8
|
+
this.f=null;this.j=!1;Sz(this,a,b,c,d)},Sz=function(a,b,c,d,e){var f=new Kz;f.headers=[new Gz("CL-BROWSER-NAME",b),new Gz("CL-BROWSER-VERSION",c),new Gz("CL-OS-FAMILY",d),new Gz("CL-OS-VERSION",e),new Gz("CL-SDK-NAME",nz),new Gz("CL-SDK-NAME",nz),new Gz("CL-SDK-VERSION",_.ja)];Uz(a,f)},Rz=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&&Uz(a,new Lz);b=function(){};a.f=new Promise(function(g){b=g});_.sh(f);c=new Nz;c.f=a.o;c.events.push.apply(c.events,
|
|
9
|
+
_.fh(a.a));d=_.fh(a.a).concat();return _.y(f,fetch(a.l,{method:_.Mb,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'"+(e.status+"' statusText\x3d'"+e.statusText+"'"));_.uh(f);b();a.f=null;return _.vh(f,0)})},Uz=function(a,b){if(!a.j){var c=new Mz(a.w);c.sessionId=a.A;var d=Date.now(),e=new Oz;e.h=Math.floor(d/
|
|
10
|
+
1E3);e.f=d%1E3*1E6;c.time=e;c.h=b.getId();c.f=new Uint8Array(b.a());a.a.push(c)}},Vz=function(){this.reason=this.currentState=this.previousState=null},Wz=function(){this.m=null;this.a=this.l=!1;this.f=new _.Xh;this.h=null;this.g=new _.K("clpp.sessions.SessionsPlugin");this.o=this.gm.bind(this);this.j=this.fm.bind(this)},dA=function(a){switch(a){case _.np:return Xz;case _.zp:return Yz;case _.sp:return Zz;case _.Bp:return $z;case _.Ap:return aA;case _.up:return bA;case _.yp:return cA;default:return null}},
|
|
11
|
+
lA=function(a,b){switch(a){case 1:return eA;case 2:return b===_.r?fA:b===_.cd?gA:b===_.P?hA:b===_.Be?iA:jA;case 3:return kA;default:return jA}},mA=function(a){var b;_.I(function(c){if(1==c.a)return a.g.info("Destroy the session and stop sending events."),_.$h(a.f),a.a=!1,b=a.m.getNetworkEngine(),b.cg(a.o),b.Yd(a.j),oz(b,a.j),a.h?_.y(c,a.h.dispose(),3):c.F(0);a.h=null;_.B(c)})},nA=function(a,b){a.g.debug("Sending event",b);Uz(a.h,b)},oA=function(){};qz.prototype.length=function(){return this.a.length};qz.prototype.end=function(){var a=this.a;this.a=[];return a};Cz.prototype.a=function(){var a=new qz;Az(a,1,this.downloadId);tz(a,2,this.h);Az(a,3,this.duration);tz(a,4,this.j);Az(a,5,this.f);return a.end()};Cz.prototype.getId=function(){return 4};Dz.prototype.a=function(){var a=new qz;tz(a,1,this.f);Az(a,2,this.downloadId);yz(a,3,this.url);Az(a,4,this.headers);yz(a,5,null);Az(a,6,null);Az(a,7,this.duration);wz(a,8,this.size);return a.end()};Dz.prototype.getId=function(){return 2};Ez.prototype.a=function(){var a=new qz;tz(a,1,this.h);Bz(a,2,this.f);return a.end()};Fz.prototype.a=function(){var a=new qz;tz(a,1,this.errorCode);tz(a,2,this.severity);yz(a,3,this.message);yz(a,4,this.f);Az(a,5,this.cause);return a.end()};Fz.prototype.getId=function(){return 7};Gz.prototype.a=function(){var a=new qz;yz(a,1,this.key);yz(a,2,this.value);return a.end()};Hz.prototype.a=function(){var a=new qz;tz(a,1,this.code);tz(a,2,this.severity);Az(a,3,this.cause);return a.end()};Hz.prototype.getId=function(){return 12};Iz.prototype.a=function(){var a=new qz;Bz(a,1,this.data);return a.end()};_.x(Jz,Iz);Jz.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]]};Kz.prototype.a=function(){var a=new qz;Az(a,1,this.headers);return a.end()};Kz.prototype.getId=function(){return 1};Lz.prototype.a=function(){return(new qz).end()};Lz.prototype.getId=function(){return 6};Mz.prototype.a=function(){var a=new qz;Az(a,1,this.j);Az(a,2,this.sessionId);Az(a,3,this.time);wz(a,4,null);yz(a,5,null);tz(a,6,this.h);Bz(a,7,this.f);return a.end()};Nz.prototype.a=function(){var a=new qz;Bz(a,1,this.f);Az(a,2,this.events);return a.end()};Oz.prototype.a=function(){var a=new qz;wz(a,1,this.h);tz(a,2,this.f);return a.end()};Pz.prototype.a=function(){var a=new qz;wz(a,1,this.h);tz(a,2,this.f);return a.end()};Tz.prototype.dispose=function(){var a=this;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,Rz(a),5);case 5:a.a=[];case 4:a.j=!0,_.B(b)}})};Vz.prototype.a=function(){var a=new qz;tz(a,1,this.previousState);tz(a,2,this.currentState);tz(a,3,this.reason);Az(a,4,null);Az(a,5,null);Az(a,6,null);return a.end()};Vz.prototype.getId=function(){return 5};_.x(Wz,_.Gu);_.t=Wz.prototype;_.t.onPlayerCreated=function(a){this.m=a};
|
|
12
|
+
_.t.onContentWillLoad=function(a){var b=a.getConfiguration().sessions;(b=!(!b||typeof b!==_.$e))||this.g.warn("Sessions plugin is loaded but not configured. Will do nothing.");if(this.l=b)b=a.getConfiguration().sessions,b.apiUrl?(this.g.debug(_.xa),this.g.info("Create a session and start sending events."),a=_.ak(),this.h=new Tz(a.browser,a.browserVersion.name,a.os,a.osVersion.name,b.apiUrl),this.f.on(this.m,_.jg,this.Xj.bind(this)),this.f.on(this.m,_.bg,this.Wj.bind(this)),this.f.on(this.m,_.ag,this.Vj.bind(this)),
|
|
13
|
+
this.f.on(this.m,_.te,this.T.bind(this)),a=this.m.getNetworkEngine(),a.jf(this.o),a.Nc(this.j),a.j.push(this.j)):(this.g.warn(mz),a.onError(new _.N(1,9,15E3,mz)))};_.t.onPlayerWillRelease=function(){mA(this)};_.t.id=function(){return"sessions"};_.t.Xj=function(a){if(!this.a){a=a.detail;var b=a.currentState,c=new Vz;c.previousState=dA(a.previousState);c.currentState=dA(b);nA(this,c)}};
|
|
14
|
+
_.t.Wj=function(){if(!this.a){var a=new Vz;a.previousState=dA(this.m.getState());a.currentState=pA;nA(this,a);this.a=!0}};_.t.Vj=function(){if(this.a){var a=new Vz;a.previousState=pA;a.currentState=dA(this.m.getState());nA(this,a);this.a=!1}};_.t.T=function(a){a=a.detail;var b=new Hz;b=new Fz(new Ez(b.getId(),new Uint8Array(b.a())));b.errorCode=a.code;b.message=a.message;b.f=a.stack;b.severity=a.severity===_.O?qA:rA;nA(this,b)};
|
|
15
|
+
_.t.gm=function(a){var b=new Jz;a.downloadId=b;var c=new Dz(lA(a.type,a.contentType),a.uris[0]);c.downloadId=b;c.headers=Object.keys(a.headers).map(function(d){return new Gz(d,a.headers[d])});nA(this,c)};_.t.fm=function(a){var b=a.request.downloadId;b?(b=new Cz(b,a.data.byteLength,Qz(a.timeMs||0),a.status||-1),b.f=Object.keys(a.headers).map(function(c){return new Gz(c,a.headers[c])}),nA(this,b)):this.g.warn("Download ID is missing on download completed event.")};oA.prototype.create=function(){return new Wz};
|
|
16
|
+
_.br(new oA);var rA=1,qA=2;var Xz=0,Yz=2,cA=3,pA=5,Zz=6,$z=8,aA=10,bA=11;var eA=0,fA=1,gA=2,hA=3,iA=4,kA=5,jA=9;};
|
|
17
17
|
if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
|
|
18
18
|
else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
|
|
19
19
|
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===_.
|
|
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 Vy="No surface found. Can not attach frame!",Wy="SIMID:Media:timeupdate",Xy="Starting creative",bz=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=_.Ze;this.a.style.backgroundColor="transparent";this.a.style.transition="opacity .5s";this.a.style.transitionDelay=".5s";this.a.style.pointerEvents=_.Ze;this.a.style.overflow=_.ye;this.a.classList.add(_.Ad);this.o=function(c){if(c.source===b.a.contentWindow&&
|
|
3
|
+
(c=(c=c.data)?typeof c===_.mg?JSON.parse(c):c:null))if(c.type)switch(b.g.info("Received message ["+c.messageId+"] '"+c.type+"':",c.args),c.type){case "createSession":Yy(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=Zy(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=Zy(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);$y(b,c)}else b.g.warn("WARNING: received message without 'type' property")};
|
|
5
|
+
this.g=new _.K("clpp.simid.SimidPlayer");az(this.f,this)},ez=function(a){var b=cz(a,"SIMID:Player:startCreative",void 0);dz(a,b).then(function(){var c=a.f;c.g.info(Xy);c.m.trigger(new _.L(_.dg));a.a.style.opacity="1"})["catch"](function(c){a.unload();a.f.g.error("Error while starting creative",c)})},Yy=function(a,b){var c;_.I(function(d){if(1==d.a){a.h=b.sessionId;$y(a,b);_.D(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(_.
|
|
12
|
-
|
|
13
|
-
_.t.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
|
-
_.t.
|
|
15
|
-
b,this.a.load(a)):this.f&&(this.a.unload(),this.f=null,this.o=!1)};_.t.onPlayerWillRelease=function(a){_.
|
|
16
|
-
|
|
17
|
-
_
|
|
7
|
+
clickThruUrl:""}};e=cz(a,"SIMID:Player:init",e);e=dz(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"),_.th(d,0);c=_.E(d);a.g.error("Error while initializing",c);a.f.g.error("Error while initializing SIMID player: ",c);a.unload();_.B(d)})},cz=function(a,b,c){return{type:b,sessionId:a.h,messageId:a.l++,timestamp:Date.now(),args:c}},fz=function(a,b){a.h?(b.type!==Wy&&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+"'")},$y=function(a,b){fz(a,cz(a,"resolve",{messageId:b.messageId,value:void 0}))},dz=function(a,b){return new Promise(function(c,d){new gz(a.j,c,d,b);fz(a,b)})},gz=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))},hz=function(){this.g=
|
|
9
|
+
new _.K("clpp.simid.Plugin");this.h=this.a=this.m=null;this.l=[];this.j=null;this.w=this.Yj.bind(this);this.f=null;this.o=!1},iz=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=cz(d,"SIMID:Player:resize",e);fz(d,e)}})},jz=function(a){this.m=a;this.a=null;this.g=new _.K("clpp.simid.Loader");this.h=!1;this.f=
|
|
10
|
+
null},Zy=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+"%"}},az=function(a,b){a.g.info("SIMID Session created");a.a=b},kz=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(_.eg))},lz=function(){};bz.prototype.load=function(a){window.addEventListener(_.Se,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
|
+
bz.prototype.unload=function(){kz(this.f);this.h=this.a.src="";this.l=0;this.a.style.opacity="0";window.removeEventListener(_.Se,this.o);this.a.parentElement&&this.a.parentElement.removeChild(this.a)};gz.prototype.resolve=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.l(a)};gz.prototype.reject=function(a){null!==this.a&&(clearTimeout(this.a),this.a=null);this.f["delete"](this.h.messageId);this.j(a)};_.x(hz,_.Gu);_.t=hz.prototype;_.t.id=function(){return"simid"};_.t.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 jz(a)};
|
|
13
|
+
_.t.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 bz(this.h);var c=b.getContainer();this.j=iz(this,c,b);this.j.observe(c);a.on(_.ug,this.w)}else this.g.warn(Vy)};
|
|
14
|
+
_.t.Yj=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&&(ez(this.a),this.o=!0,this.g.info(Xy)),c&&(c=this.a,fz(c,cz(c,Wy,{currentTime:a-b}))))):((a=this.m.getSurface())||this.g.warn(Vy),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)};_.t.onPlayerWillRelease=function(a){_.Gu.prototype.onPlayerWillRelease.call(this,a);this.m.getSurface()&&(this.j&&(this.j.disconnect(),this.j=null),a.off(_.ug,this.w),this.f&&(this.a.unload(),this.f=this.h.f=null))};jz.prototype.release=function(){this.g.info("Releasing loader")};
|
|
16
|
+
jz.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 _.N(1,10,10100,"No player container found");return a};jz.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 _.N(1,10,10100,"No surface");return a};jz.prototype.url=function(){return this.f?this.f.url:""};lz.prototype.create=function(){return new hz};
|
|
17
|
+
_.br(new lz);};
|
|
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));}
|