@castlabs/prestoplay 6.34.0 → 6.35.0-beta.1

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.
Files changed (61) hide show
  1. package/cjs/cl.adobe.js +3 -3
  2. package/cjs/cl.airplay.js +3 -3
  3. package/cjs/cl.broadpeak.js +18 -18
  4. package/cjs/cl.cast.js +125 -125
  5. package/cjs/cl.conviva.js +31 -31
  6. package/cjs/cl.core.js +579 -577
  7. package/cjs/cl.crypto.js +9 -9
  8. package/cjs/cl.dash.js +100 -100
  9. package/cjs/cl.freewheel.js +26 -26
  10. package/cjs/cl.hls.js +76 -76
  11. package/cjs/cl.hlssmpte.js +6 -6
  12. package/cjs/cl.htmlcue.js +30 -30
  13. package/cjs/cl.ima.js +25 -25
  14. package/cjs/cl.mediatailor.js +3 -3
  15. package/cjs/cl.mse.js +345 -345
  16. package/cjs/cl.muxdata.js +13 -13
  17. package/cjs/cl.onboard.js +4 -4
  18. package/cjs/cl.persistent.js +14 -14
  19. package/cjs/cl.playlist.js +5 -5
  20. package/cjs/cl.simid.js +16 -16
  21. package/cjs/cl.smooth.js +70 -70
  22. package/cjs/cl.thumbnails.js +25 -25
  23. package/cjs/cl.tizen.js +67 -67
  24. package/cjs/cl.ttml.js +29 -29
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +8 -8
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.yospace.js +3 -3
  30. package/cjs/cl.youbora.js +38 -38
  31. package/cl.adobe.js +3 -3
  32. package/cl.airplay.js +3 -3
  33. package/cl.broadpeak.js +14 -14
  34. package/cl.cast.js +97 -97
  35. package/cl.conviva.js +28 -27
  36. package/cl.core.js +463 -462
  37. package/cl.crypto.js +8 -8
  38. package/cl.dash.js +89 -89
  39. package/cl.freewheel.js +20 -20
  40. package/cl.hls.js +82 -82
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +26 -26
  43. package/cl.ima.js +19 -19
  44. package/cl.mediatailor.js +2 -2
  45. package/cl.mse.js +299 -299
  46. package/cl.muxdata.js +11 -11
  47. package/cl.onboard.js +5 -5
  48. package/cl.persistent.js +10 -10
  49. package/cl.playlist.js +5 -5
  50. package/cl.simid.js +14 -14
  51. package/cl.smooth.js +60 -60
  52. package/cl.thumbnails.js +17 -17
  53. package/cl.tizen.js +55 -55
  54. package/cl.ttml.js +22 -22
  55. package/cl.verimatrix.js +4 -4
  56. package/cl.vimond.js +7 -7
  57. package/cl.vr.js +14 -14
  58. package/cl.vtt.js +12 -12
  59. package/cl.yospace.js +3 -3
  60. package/cl.youbora.js +31 -31
  61. package/package.json +1 -1
package/cl.ima.js CHANGED
@@ -1,20 +1,20 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var CS="clpp.ima.AdsManagerFactory",DS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},ES=function(a){a=a.H;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Mc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===
2
- _.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.Mc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},FS=function(a){const b=_.Ph()||_.Sh()||_.$h();return!1===a.H.disableCustomPlayback&&b},GS=function(a){const b=a.a,c=a.S,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.wc.bind(a));c.on(b,d.LOADED,a.lb.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.kd.bind(a));c.on(b,d.STARTED,a.Hb.bind(a));c.on(b,d.LOG,a.Bc.bind(a));
3
- c.on(b,d.AD_PROGRESS,a.Ib.bind(a));c.on(b,d.AD_BUFFERING,a.yc.bind(a));c.on(b,d.FIRST_QUARTILE,a.cb.bind(a));c.on(b,d.MIDPOINT,a.Dc.bind(a));c.on(b,d.THIRD_QUARTILE,a.Ub.bind(a));c.on(b,d.PAUSED,a.Gc.bind(a));c.on(b,d.RESUMED,a.Hc.bind(a));c.on(b,d.CLICK,a.Aa.bind(a));c.on(b,d.SKIPPED,a.Jb.bind(a));c.on(b,d.IMPRESSION,a.eb.bind(a));c.on(b,d.COMPLETE,a.zc.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.md.bind(a))},HS=function(a,b){const c=b?a.vc.create(b.getErrorCode()):null;a.m.onError(new _.J(1,9,
4
- 10003,{errorType:c},b))},IS=function(a){return FS(a)&&a.a.isCustomPlaybackUsed()},JS=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.J,a.I)});a.m.trigger(new _.H(b,d))},LS=function(a){_.v(function*(){a.M=a.m.getPosition();yield KS(a,[8,10,11]);yield a.m.pause();yield a.m.detach();a.a.start()})},KS=function(a,b){return _.v(function*(){return new Promise((c,d)=>{const e=setTimeout(()=>{clearInterval(f);d(Error("Timeout waiting for player state"))},1E4),f=setInterval(()=>{const g=a.m.getPlayerState();
5
- 3===g?(clearInterval(f),clearTimeout(e),d(Error("Player entered error state"))):b.includes(g)&&(clearInterval(f),clearTimeout(e),c())},200)})})},MS=function(a){a.U=!1;a.G=null;JS(a,_.lc);a.m.getSurface().hide(a.da)},NS=function(a){_.Fp(a.F,{visibility:"visible"})},PS=function(a){_.v(function*(){a.ja.initialize();const b=!!a.m.getConfiguration().muted;(yield a.Z.canPlay(b))||IS(a)?OS(a):(JS(a,_.Kc),a.g.warn(_.la))})},OS=function(a){a.a.init(a.F.offsetWidth,a.F.offsetHeight,google.ima.ViewMode.NORMAL);
6
- IS(a)?a.H.isVast&&LS(a):a.a.start();a.ca=!0},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}fb(){return"Google IMA SDK"}gb(){return google.ima.VERSION}ib(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}yb(){return""}getApiFramework(){return this.a.getApiFramework()}getAdSystem(){return this.a.getAdSystem()}getAdvertiserName(){return this.a.getAdvertiserName()}getTitle(){return this.a.getTitle()}getDuration(){return this.a.getDuration()}getPosition(){return 0}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Ab(){return this.f?
7
- this.f.getIsBumper():!1}Ra(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Ce&&typeof b[d].clickThroughUrl===_.Of);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}Va(){return this.a.getVastMediaWidth()}Ua(){return this.a.getVastMediaHeight()}Ba(){return this.a.getVastMediaBitrate()}Ca(){return this.h?_.Mj:this.j?_.Pj:0}getPodIndex(){return this.f?this.f.getPodIndex():0}ob(){return this.f?this.f.getTimeOffset():0}hb(){return this.f?this.f.getAdPosition():
8
- 1}Wa(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}canSeek(){return!1}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}zb(){return null}};W.prototype.getVideoElement=W.prototype.zb;W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.canSeek=W.prototype.canSeek;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;
9
- W.prototype.getSequenceLength=W.prototype.Wa;W.prototype.getPositionInSequence=W.prototype.hb;W.prototype.getPodTimeOffset=W.prototype.ob;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Ca;W.prototype.getMediaBitrate=W.prototype.Ba;W.prototype.getMediaHeight=W.prototype.Ua;W.prototype.getMediaWidth=W.prototype.Va;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.Ra;W.prototype.isBumper=W.prototype.Ab;
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var DS="clpp.ima.AdsManagerFactory",ES=function(){return!window.google||!google.ima||!google.ima.AdsLoader},FS=function(a){a=a.H;const b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.r&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.Mc?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.r&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===
2
+ _.r&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.Mc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},GS=function(a){const b=_.Qh()||_.Th()||_.ai();return!1===a.H.disableCustomPlayback&&b},HS=function(a){const b=a.a,c=a.S,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.xc.bind(a));c.on(b,d.LOADED,a.nb.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.kd.bind(a));c.on(b,d.STARTED,a.Ib.bind(a));c.on(b,d.LOG,a.Cc.bind(a));
3
+ c.on(b,d.AD_PROGRESS,a.Jb.bind(a));c.on(b,d.AD_BUFFERING,a.zc.bind(a));c.on(b,d.FIRST_QUARTILE,a.eb.bind(a));c.on(b,d.MIDPOINT,a.Ec.bind(a));c.on(b,d.THIRD_QUARTILE,a.Vb.bind(a));c.on(b,d.PAUSED,a.Hc.bind(a));c.on(b,d.RESUMED,a.Ic.bind(a));c.on(b,d.CLICK,a.Aa.bind(a));c.on(b,d.SKIPPED,a.Kb.bind(a));c.on(b,d.IMPRESSION,a.fb.bind(a));c.on(b,d.COMPLETE,a.Ac.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.md.bind(a))},IS=function(a,b){const c=b?a.wc.create(b.getErrorCode()):null;a.m.onError(new _.J(1,9,
4
+ 10003,{errorType:c},b))},JS=function(a){return GS(a)&&a.a.isCustomPlaybackUsed()},KS=function(a,b,c){c=c&&c.getAd();let d=null;c&&(d={ad:new W(c,a.J,a.I)});a.m.trigger(new _.H(b,d))},MS=function(a){_.v(function*(){a.M=a.m.getPosition();yield LS(a,[8,10,11]);yield a.m.pause();yield a.m.detach();a.a.start()})},LS=function(a,b){return _.v(function*(){return new Promise((c,d)=>{const e=setTimeout(()=>{clearInterval(f);d(Error("Timeout waiting for player state"))},1E4),f=setInterval(()=>{const g=a.m.getPlayerState();
5
+ 3===g?(clearInterval(f),clearTimeout(e),d(Error("Player entered error state"))):b.includes(g)&&(clearInterval(f),clearTimeout(e),c())},200)})})},NS=function(a){a.U=!1;a.G=null;KS(a,_.lc);a.m.getSurface().hide(a.da)},OS=function(a){_.Gp(a.F,{visibility:"visible"})},QS=function(a){_.v(function*(){a.ja.initialize();const b=!!a.m.getConfiguration().muted;(yield a.Z.canPlay(b))||JS(a)?PS(a):(KS(a,_.Kc),a.g.warn(_.la))})},PS=function(a){a.a.init(a.F.offsetWidth,a.F.offsetHeight,google.ima.ViewMode.NORMAL);
6
+ JS(a)?a.H.isVast&&MS(a):a.a.start();a.ca=!0},W=class{constructor(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c}gb(){return"Google IMA SDK"}hb(){return google.ima.VERSION}jb(){return 0}getId(){return this.a.getAdId()}getCreativeId(){return this.a.getCreativeId()}yb(){return""}getApiFramework(){return this.a.getApiFramework()}getAdSystem(){return this.a.getAdSystem()}getAdvertiserName(){return this.a.getAdvertiserName()}getTitle(){return this.a.getTitle()}getDuration(){return this.a.getDuration()}getPosition(){return 0}getSkipTimeOffset(){return this.a.getSkipTimeOffset()}Bb(){return this.f?
7
+ this.f.getIsBumper():!1}Ta(){let a=null;const b=this.a,c=Object.keys(b).find(d=>typeof b[d]===_.Ce&&typeof b[d].clickThroughUrl===_.Of);c&&(a=b[c].clickThroughUrl);return a}getMediaUrl(){return this.a.getMediaUrl()}Xa(){return this.a.getVastMediaWidth()}Wa(){return this.a.getVastMediaHeight()}Ba(){return this.a.getVastMediaBitrate()}Ca(){return this.h?_.Nj:this.j?_.Qj:0}getPodIndex(){return this.f?this.f.getPodIndex():0}pb(){return this.f?this.f.getTimeOffset():0}ib(){return this.f?this.f.getAdPosition():
8
+ 1}Ya(){return this.f?this.f.getTotalAds():1}getWrapperAdIds(){return this.a.getWrapperAdIds()}canSeek(){return!1}getWrapperAdSystems(){return this.a.getWrapperAdSystems()}getWrapperCreativeIds(){return this.a.getWrapperCreativeIds()}zb(){return null}};W.prototype.getVideoElement=W.prototype.zb;W.prototype.getWrapperCreativeIds=W.prototype.getWrapperCreativeIds;W.prototype.getWrapperAdSystems=W.prototype.getWrapperAdSystems;W.prototype.canSeek=W.prototype.canSeek;W.prototype.getWrapperAdIds=W.prototype.getWrapperAdIds;
9
+ W.prototype.getSequenceLength=W.prototype.Ya;W.prototype.getPositionInSequence=W.prototype.ib;W.prototype.getPodTimeOffset=W.prototype.pb;W.prototype.getPodIndex=W.prototype.getPodIndex;W.prototype.getPodType=W.prototype.Ca;W.prototype.getMediaBitrate=W.prototype.Ba;W.prototype.getMediaHeight=W.prototype.Wa;W.prototype.getMediaWidth=W.prototype.Xa;W.prototype.getMediaUrl=W.prototype.getMediaUrl;W.prototype.getClickThroughUrl=W.prototype.Ta;W.prototype.isBumper=W.prototype.Bb;
10
10
  W.prototype.getSkipTimeOffset=W.prototype.getSkipTimeOffset;W.prototype.getPosition=W.prototype.getPosition;W.prototype.getDuration=W.prototype.getDuration;W.prototype.getTitle=W.prototype.getTitle;W.prototype.getAdvertiserName=W.prototype.getAdvertiserName;W.prototype.getAdSystem=W.prototype.getAdSystem;W.prototype.getApiFramework=W.prototype.getApiFramework;W.prototype.getSourceId=W.prototype.yb;W.prototype.getCreativeId=W.prototype.getCreativeId;W.prototype.getId=W.prototype.getId;
11
- W.prototype.getTechnology=W.prototype.ib;W.prototype.getAdManagerVersion=W.prototype.gb;W.prototype.getAdManagerName=W.prototype.fb;var QS=class{create(a){const b=google.ima.AdError.ErrorCode;switch(a){case b.VAST_LOAD_TIMEOUT:case b.VAST_MEDIA_LOAD_TIMEOUT:case b.FAILED_TO_REQUEST_ADS:return 0;case b.VIDEO_PLAY_ERROR:return 1;default:return 2}}};var RS=class{constructor(a){this.a=a}getCuePoints(){return this.a}Qb(){return 0<=this.a.indexOf(0)||0===this.a.length}Pb(){return 0<=this.a.indexOf(-1)}};RS.prototype.hasPostroll=RS.prototype.Pb;RS.prototype.hasPreroll=RS.prototype.Qb;RS.prototype.getCuePoints=RS.prototype.getCuePoints;var SS=class extends _.Zv{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(DS())return a.onError(new _.J(1,9,1E4));this.f=_.Dp(_.Ad,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.sa);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
12
- (this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Th(){return this.a}Rh(){return this.h}Yc(){return this.f}id(){return"ima"}};_.w("clpp.ima.ImaPlugin",SS);SS.prototype.getAdContainer=SS.prototype.Yc;SS.prototype.getAdDisplayContainer=SS.prototype.Rh;SS.prototype.getAdsLoader=SS.prototype.Th;SS.Id="ima";SS.isSdkMissing=DS;var TS=class{create(){return new SS}};var US=class{constructor(a){var b=a.Ed("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Yc(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");const e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");this.m=a;this.F=e;a=this.m.getConfiguration();a=_.Yg(a.ima||{});this.H=a=_.Xg({disableCustomPlayback:!1},a);this.da=c;this.ja=d;this.B=b;this.Z=new _.Pv;this.g=new _.S("clpp.ima");this.a=null;this.W=!1;this.l=null;this.f=new _.wk;this.ca=!1;this.S=new _.Ut;
13
- this.vc=new QS;this.G=null;this.C=this.U=!1;this.L=1;this.P=this.I=this.J=!1;this.M=this.R=null;this.K=!0;c=this.S;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.B,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.fd.bind(this));c.on(this.B,d,this.Jc.bind(this));c.on(this.m,_.Rd,this.gd.bind(this))}fd(a){this.a=a.getAdsManager(this.F,ES(this));this.a.isCustomPlaybackUsed()&&!FS(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.J(1,
14
- 9,10002)),this.o()):(this.setMuted(this.C),this.h(this.L),this.l=new _.Nv(this.m.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.R=new RS(a),this.m.trigger(new _.H(_.oc,{adsTimeline:this.R})),GS(this));this.f.resolve()}Jc(a){HS(this,a.getError());this.f.resolve()}kd(a){this.P=!0;IS(this)||(this.m.pause(),_.Fp(this.F,{visibility:_.Yd}));JS(this,_.Sb,a);this.l.start()}wc(){IS(this)?LS(this):this.a.start()}lb(a){a.getAd().isLinear()?
15
- JS(this,_.bc,a):(this.a.discardAdBreak(),this.J||(this.J=!0,this.m.play()))}Hb(a){this.U=!0;this.K=!1;this.G=a.getAd().getDuration();JS(this,_.kc,a);this.m.getSurface().show(this.da)}Bc(a){a=a.getAdData();HS(this,a?a.adError:null);MS(this)}Ib(a){JS(this,_.ec,a)}yc(a){JS(this,_.Ub,a)}cb(a){JS(this,_.Xb,a)}Dc(a){JS(this,_.cc,a)}Ub(a){JS(this,_.mc,a)}Gc(a){this.K=!0;JS(this,_.dc,a)}Hc(a){this.K=!1;JS(this,_.fc,a)}Aa(a){this.pause();JS(this,_.Vb,a)}Jb(a){JS(this,_.ic,a);MS(this)}eb(a){JS(this,_.ac,a)}zc(a){JS(this,
16
- _.Wb,a);MS(this)}md(){const a=this;return _.v(function*(){a.J=!0;if(IS(a)&&null!==a.M){const c=a.m.getVolume(),d=a.m.isMuted();var b=a.m;b.a&&b.a.forwardEventsTo(b);b=a.m;b.f=_.Xg(b.f,{volume:c,muted:d});yield _.ks(a.m);!a.I&&a.M&&(yield KS(a,[6,8,10,11]),yield a.m.play(),yield a.m.pause(),yield KS(a,[10,11]),yield a.m.setPosition(a.M))}else{if(!a.P)return a.m.play();NS(a)}a.P=!1;a.l&&a.l.stop();a.I||(yield a.m.play());JS(a,_.Tb)})}gd(){this.I=!0;this.B.contentComplete()}load(){const a=this;return _.v(function*(){var b=
17
- a.m;const c=a.H;try{if(typeof c.adTagUrl!==_.Of)throw new _.J(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),a.f;b=yield a.Z.canPlay(!1);const d=yield a.Z.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.B.getSettings().setAutoPlayAdBreaks(!1);a.B.requestAds(e);return a.f})}j(){if(this.W||!this.a||this.W)return!0;if(!this.ca){if(this.R.Qb())return PS(this),!1;this.ja.initialize();
18
- OS(this);return!0}return this.pb()&&this.a?(this.a.resume(),!1):!0}A(){}w(){return!0}Ja(){this.a&&this.a.pause()}isPaused(){return this.K}skip(){this.a&&this.a.skip()}getAdVolume(){return this.a?this.C?this.L:this.a.getVolume():1}h(a){this.L=a;this.a&&(this.C||this.a.setVolume(a))}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.Ja()}resume(){this.j()}setMuted(a){this.C=a;this.a&&(a?this.a.setVolume(0):this.a.setVolume(this.L))}isMuted(){return this.C}pb(){return this.U}getPosition(){if(!this.a||
19
- null===this.G)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.G-a}o(){this.a&&(this.a.destroy(),this.a=null);this.W=!0;NS(this);this.S.release();this.l&&(this.l.stop(),this.l=null);return Promise.resolve()}};US.prototype.getPosition=US.prototype.getPosition;US.prototype.resume=US.prototype.resume;US.prototype.pause=US.prototype.pause;US.prototype.getVolume=US.prototype.getVolume;US.prototype.setVolume=US.prototype.setVolume;US.prototype.getAdVolume=US.prototype.getAdVolume;
20
- US.prototype.skip=US.prototype.skip;US.prototype.pauseAd=US.prototype.Ja;_.pp(new class{constructor(){this.Ya=new _.S(CS)}name(){return CS}a(a,b){return a.namespace()===_.gd?!1:DS()?(this.Ya.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new US(a)}});_.Sr(new TS);};f.call(g, window);
11
+ W.prototype.getTechnology=W.prototype.jb;W.prototype.getAdManagerVersion=W.prototype.hb;W.prototype.getAdManagerName=W.prototype.gb;var RS=class{create(a){const b=google.ima.AdError.ErrorCode;switch(a){case b.VAST_LOAD_TIMEOUT:case b.VAST_MEDIA_LOAD_TIMEOUT:case b.FAILED_TO_REQUEST_ADS:return 0;case b.VIDEO_PLAY_ERROR:return 1;default:return 2}}};var SS=class{constructor(a){this.a=a}getCuePoints(){return this.a}Qb(){return 0<=this.a.indexOf(0)||0===this.a.length}Ab(){return 0<=this.a.indexOf(-1)}};SS.prototype.hasPostroll=SS.prototype.Ab;SS.prototype.hasPreroll=SS.prototype.Qb;SS.prototype.getCuePoints=SS.prototype.getCuePoints;var TS=class extends _.$v{constructor(){super();this.a=this.h=this.f=null}onPlayerCreated(a){if(ES())return a.onError(new _.J(1,9,1E4));this.f=_.Ep(_.Ad,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.sa);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)}onPlayerWillDestroy(a){this.a&&
12
+ (this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)}Th(){return this.a}Rh(){return this.h}Yc(){return this.f}id(){return"ima"}};_.w("clpp.ima.ImaPlugin",TS);TS.prototype.getAdContainer=TS.prototype.Yc;TS.prototype.getAdDisplayContainer=TS.prototype.Rh;TS.prototype.getAdsLoader=TS.prototype.Th;TS.Id="ima";TS.isSdkMissing=ES;var US=class{create(){return new TS}};var VS=class{constructor(a){var b=a.Ed("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Yc(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");const e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");this.m=a;this.F=e;a=this.m.getConfiguration();a=_.Yg(a.ima||{});this.H=a=_.Xg({disableCustomPlayback:!1},a);this.da=c;this.ja=d;this.B=b;this.Z=new _.Qv;this.g=new _.S("clpp.ima");this.a=null;this.W=!1;this.l=null;this.f=new _.xk;this.ca=!1;this.S=new _.Ut;
13
+ this.wc=new RS;this.G=null;this.C=this.U=!1;this.L=1;this.P=this.I=this.J=!1;this.M=this.R=null;this.K=!0;c=this.S;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.B,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.fd.bind(this));c.on(this.B,d,this.Kc.bind(this));c.on(this.m,_.Rd,this.gd.bind(this))}fd(a){this.a=a.getAdsManager(this.F,FS(this));this.a.isCustomPlaybackUsed()&&!GS(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.J(1,
14
+ 9,10002)),this.o()):(this.setMuted(this.C),this.h(this.L),this.l=new _.Ov(this.m.getSurface(),(b,c,d)=>{this.a.resize(b,c,d?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.R=new SS(a),this.m.trigger(new _.H(_.oc,{adsTimeline:this.R})),HS(this));this.f.resolve()}Kc(a){IS(this,a.getError());this.f.resolve()}kd(a){this.P=!0;JS(this)||(this.m.pause(),_.Gp(this.F,{visibility:_.Yd}));KS(this,_.Sb,a);this.l.start()}xc(){JS(this)?MS(this):this.a.start()}nb(a){a.getAd().isLinear()?
15
+ KS(this,_.bc,a):(this.a.discardAdBreak(),this.J||(this.J=!0,this.m.play()))}Ib(a){this.U=!0;this.K=!1;this.G=a.getAd().getDuration();KS(this,_.jc,a);this.m.getSurface().show(this.da)}Cc(a){a=a.getAdData();IS(this,a?a.adError:null);NS(this)}Jb(a){KS(this,_.ec,a)}zc(a){KS(this,_.Ub,a)}eb(a){KS(this,_.Xb,a)}Ec(a){KS(this,_.cc,a)}Vb(a){KS(this,_.mc,a)}Hc(a){this.K=!0;KS(this,_.dc,a)}Ic(a){this.K=!1;KS(this,_.fc,a)}Aa(a){this.pause();KS(this,_.Vb,a)}Kb(a){KS(this,_.gc,a);NS(this)}fb(a){KS(this,_.ac,a)}Ac(a){KS(this,
16
+ _.Wb,a);NS(this)}md(){const a=this;return _.v(function*(){a.J=!0;if(JS(a)&&null!==a.M){const c=a.m.getVolume(),d=a.m.isMuted();var b=a.m;b.a&&b.a.forwardEventsTo(b);b=a.m;b.f=_.Xg(b.f,{volume:c,muted:d});yield _.ls(a.m);!a.I&&a.M&&(yield LS(a,[6,8,10,11]),yield a.m.play(),yield a.m.pause(),yield LS(a,[10,11]),yield a.m.setPosition(a.M))}else{if(!a.P)return a.m.play();OS(a)}a.P=!1;a.l&&a.l.stop();a.I||(yield a.m.play());KS(a,_.Tb)})}gd(){this.I=!0;this.B.contentComplete()}load(){const a=this;return _.v(function*(){var b=
17
+ a.m;const c=a.H;try{if(typeof c.adTagUrl!==_.Of)throw new _.J(1,9,10001,{missingKeys:"adTagUrl"});}catch(f){return b.onError(f),a.f.resolve(),a.f}if(!c.adTagUrl)return a.f.resolve(),a.f;b=yield a.Z.canPlay(!1);const d=yield a.Z.canPlay(!0),e=new google.ima.AdsRequest;e.adTagUrl=c.adTagUrl;e.setAdWillAutoPlay(b);e.setAdWillPlayMuted(d);a.B.getSettings().setAutoPlayAdBreaks(!1);a.B.requestAds(e);return a.f})}j(){if(this.W||!this.a||this.W)return!0;if(!this.ca){if(this.R.Qb())return QS(this),!1;this.ja.initialize();
18
+ PS(this);return!0}return this.Ka()&&this.a?(this.a.resume(),!1):!0}A(){}w(){return!0}La(){this.a&&this.a.pause()}isPaused(){return this.K}skip(){this.a&&this.a.skip()}getAdVolume(){return this.a?this.C?this.L:this.a.getVolume():1}h(a){this.L=a;this.a&&(this.C||this.a.setVolume(a))}setVolume(a){this.h(a)}getVolume(){return this.getAdVolume()}pause(){this.La()}resume(){this.j()}setMuted(a){this.C=a;this.a&&(a?this.a.setVolume(0):this.a.setVolume(this.L))}isMuted(){return this.C}Ka(){return this.U}getPosition(){if(!this.a||
19
+ null===this.G)return-1;const a=this.a.getRemainingTime();return 0>a?0:this.G-a}o(){this.a&&(this.a.destroy(),this.a=null);this.W=!0;OS(this);this.S.release();this.l&&(this.l.stop(),this.l=null);return Promise.resolve()}};VS.prototype.getPosition=VS.prototype.getPosition;VS.prototype.resume=VS.prototype.resume;VS.prototype.pause=VS.prototype.pause;VS.prototype.getVolume=VS.prototype.getVolume;VS.prototype.setVolume=VS.prototype.setVolume;VS.prototype.getAdVolume=VS.prototype.getAdVolume;
20
+ VS.prototype.skip=VS.prototype.skip;VS.prototype.pauseAd=VS.prototype.La;_.qp(new class{constructor(){this.Ea=new _.S(DS)}name(){return DS}a(a,b){return a.namespace()===_.gd?!1:ES()?(this.Ea.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)}create(a){return new VS(a)}});_.Tr(new US);};f.call(g, window);
package/cl.mediatailor.js CHANGED
@@ -1,2 +1,2 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var AS=function(a,b,c){return _.v(function*(){var d=yield(yield fetch(b,{method:_.bb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={Mg:_.Cj(d.manifestUrl,b),Qj:e?_.Cj(e,b):null};a.g.info(`Media Tailor session initialized.
2
- - manifest URI: ${d.Mg}`);return d})},BS=class extends _.Zv{constructor(){super();this.g=new _.S("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.v(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield AS(c,b.url,d);a.trigger(new _.H("mt-session-started"));b.url=e.Mg}catch(e){throw c.g.error("Failed to start session",e),new _.J(_.C,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};_.Sr(new class{create(){return new BS}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var BS=function(a,b,c){return _.v(function*(){var d=yield(yield fetch(b,{method:_.bb,body:JSON.stringify(c.sessionConfig)})).json();const e=d.trackingUrl;d={Mg:_.Dj(d.manifestUrl,b),Qj:e?_.Dj(e,b):null};a.g.info(`Media Tailor session initialized.
2
+ - manifest URI: ${d.Mg}`);return d})},CS=class extends _.$v{constructor(){super();this.g=new _.S("clpp.mediatailor.MediaTailorPlugin")}onContentWillLoad(a,b){const c=this;return _.v(function*(){const d=a.getConfiguration().mediatailor;if(d.enabled){c.g.info("MediaTailor plugin is enabled");try{const e=yield BS(c,b.url,d);a.trigger(new _.H("mt-session-started"));b.url=e.Mg}catch(e){throw c.g.error("Failed to start session",e),new _.J(_.C,9,7003,"Media Tailor session failed to initialize.");}}})}id(){return"mediatailor"}};_.Tr(new class{create(){return new CS}});};f.call(g, window);