From fe5534ac2429ac67702ca9d4121b4ab8603cb278 Mon Sep 17 00:00:00 2001 From: Harvey Zhao Date: Mon, 14 Sep 2026 14:31:25 +0800 Subject: [PATCH] fix(PKG-VAST-07): restore historical default factory calls --- docs/compiled/artplayer-plugin-vast.js | 2 +- docs/compiled/artplayer-plugin-vast.legacy.js | 2 +- docs/compiled/artplayer-plugin-vast.mjs | 33 +- package.json | 4 +- .../artplayer-plugin-vast/ARCHITECTURE.md | 13 +- .../dist/artplayer-plugin-vast.js | 2 +- .../dist/artplayer-plugin-vast.legacy.js | 2 +- .../dist/artplayer-plugin-vast.mjs | 33 +- packages/artplayer-plugin-vast/src/index.ts | 6 +- refactor/baselines/vast-alias-validation.json | 3445 +++++++++++++++++ .../2026-09-14-PKG-VAST-07-default-alias.md | 57 + refactor/plan.md | 10 +- refactor/progress.md | 11 + refactor/risk-table.md | 2 +- refactor/risks.json | 11 +- refactor/tasks.json | 23 +- refactor/vast-validation.md | 8 + test/browser/vast.spec.js | 9 +- test/vast-exports.test.js | 61 + test/vast.test.js | 24 + 20 files changed, 3706 insertions(+), 52 deletions(-) create mode 100644 refactor/baselines/vast-alias-validation.json create mode 100644 refactor/changes/2026-09-14-PKG-VAST-07-default-alias.md create mode 100644 test/vast-exports.test.js diff --git a/docs/compiled/artplayer-plugin-vast.js b/docs/compiled/artplayer-plugin-vast.js index 78add96cd..584b1ee3a 100644 --- a/docs/compiled/artplayer-plugin-vast.js +++ b/docs/compiled/artplayer-plugin-vast.js @@ -4,4 +4,4 @@ * (c) 2017-2026 Harvey Zhao * Released under the MIT License. */ -!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.artplayerPluginVast=e(),define(function(){return t.artplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).artplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i-1&&(f(this,Q)[Q].splice(e,1),this.g(f(this,Q)[Q]))},n.resizeAd=function(t,e){f(this,j)[j]=t,f(this,N)[N]=e,f(this,M)[M]&&f(this,M)[M].resize(t,e,this.k()),f(this,_)[_].style.width=t+"px",f(this,_)[_].style.height=e+"px"},n.reset=function(t){void 0===t&&(t=!1),t&&(f(this,F)[F]=!1,f(this,G)[G]=!1,f(this,W)[W]=!1),this.C(),f(this,Q)[Q]=[],f(this,Z)[Z]=!1,f(this,$)[$]=void 0,f(this,M)[M]&&f(this,M)[M].destroy(),f(this,M)[M]=void 0,f(this,I)[I].settings.setAutoPlayAdBreaks(!0),t&&this.P(),f(this,_)[_].style.display="none"},n.P=function(){f(this,U)[U]&&(f(this,U)[U].removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),f(this,U)[U].removeEventListener(f(this,I)[I].AdErrorEvent.Type.AD_ERROR,this.l,!1),f(this,U)[U].destroy()),f(this,L)[L]&&f(this,L)[L].destroy()},n.destroy=function(){var t,e,i,n,r=this;this.reset(!0),f(this,C)[C].destroy(),T.forEach(function(t){f(r,D)[D].removeEventListener(t,r.o)}),null==(t=f(this,U)[U])||t.removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(e=f(this,L)[L])||e.destroy(),null==(i=f(this,U)[U])||i.destroy(),f(this,F)[F]=!1,f(this,W)[W]=!1,f(this,G)[G]=!1,null==(n=f(this,B)[B])||n.disconnect()},n.isCustomPlaybackUsed=function(){return!1===f(this,I)[I].settings.getDisableCustomPlaybackForIOS10Plus()&&!f(this,_)[_].querySelector("video")},n.C=function(){window.clearTimeout(f(this,Y)[Y]),window.clearTimeout(f(this,X)[X]),f(this,Y)[Y]=void 0,f(this,X)[X]=void 0,f(this,V)[V]=void 0,f(this,q)[q]=void 0,f(this,K)[K]=void 0,f(this,_)[_].style.display="none",f(this,_)[_].classList.remove("nonlinear"),f(this,M)[M]&&this.R()},n.o=function(t){var e=this;if(f(this,C)[C].enabled||"volumechange"===t.type){if("timeupdate"===t.type){if(f(this,M)[M]){var i=f(this,M)[M].getCuePoints().filter(function(t){return t>=0&&t=.5&&(this.dispatchEvent(new A(R.MEDIA_IMPRESSION)),f(this,F)[F]=!0)}if("play"!==t.type||f(this,G)[G]||f(this,H)[H]||(this.dispatchEvent(new A(R.MEDIA_START)),f(this,G)[G]=!0),"ended"===t.type&&(this.isCustomPlaybackUsed()&&f(this,D)[D].currentTime===f(this,D)[D].duration&&f(this,Q)[Q].indexOf(-1)>-1&&(f(this,D)[D].currentTime=f(this,D)[D].duration-1e-5,f(this,W)[W]=!0),f(this,U)[U].contentComplete(),f(this,M)[M]||this.T()),!window.ResizeObserver&&f(this,z)[z].autoResize&&"loadedmetadata"===t.type){var n=f(this,D)[D],r=n.offsetHeight,s=n.offsetWidth;f(this,j)[j]=s,f(this,N)[N]=r,this.R()}f(this,H)[H]&&"volumechange"!==t.type||this.dispatchEvent(new A(t.type))}},n.S=function(t){var e=this,i=f(this,I)[I].AdEvent;switch(t.type){case i.Type.LOADED:var n=t.getAd();f(this,$)[$]&&0===f(this,Q)[Q].length?f(this,$)[$]({ad:n,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}):f(this,x)[x]=n;break;case i.Type.AD_BREAK_READY:this.C(),f(this,$)[$]?(f(this,$)[$]({ad:f(this,x)[x],adBreakTime:t.getAdData().adBreakTime,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}),f(this,x)[x]=void 0):this.M();break;case i.Type.STARTED:var r=f(this,V)[V]=t.getAd();r.getAdPodInfo().getAdPosition()>1&&f(this,M)[M].setVolume(f(this,M)[M].getVolume()),f(this,_)[_].classList.remove("nonlinear"),this.R(),r.isLinear()?(f(this,C)[C].disable(),f(this,K)[K]=r.getDuration(),f(this,q)[q]=0):(f(this,_)[_].classList.add("nonlinear"),this.I()),f(this,_)[_].style.display="",f(this,Z)[Z]&&(f(this,Z)[Z]=!1,f(this,M)[M].pause());break;case i.Type.ALL_ADS_COMPLETED:if(f(this,W)[W])return;this.isCustomPlaybackUsed()&&Boolean(f(this,V)[V])&&-1!==f(this,V)[V].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),f(this,V)[V]=t.getAd(),f(this,_)[_].style.display="",f(this,D)[D].pause(),this.R(),f(this,V)[V]&&this.A(f(this,V)[V].getAdPodInfo().getTimeOffset()),f(this,M)[M].setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),f(this,C)[C].disable(),f(this,K)[K]=f(this,V)[V].getDuration(),f(this,q)[q]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=Boolean(f(this,V)[V]);if(s){var o=f(this,M)[M].getVolume();f(this,D)[D].muted=0===o,f(this,D)[D].volume=f(this,J)[J]}f(this,W)[W]&&(f(this,D)[D].currentTime=f(this,D)[D].duration+1,f(this,W)[W]=!1),f(this,D)[D].ended?(this.reset(),this.T()):this.C(),s&&(f(this,Z)[Z]=!1,this.I());break;case i.Type.AD_METADATA:this.g(f(this,M)[M].getCuePoints()),-1===f(this,Q)[Q].indexOf(0)&&(f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=t.getAdData();f(this,q)[q]=a.currentTime,f(this,K)[K]=a.duration;break;case i.Type.LOG:var u=t.getAdData();f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):u.adError&&!f(this,V)[V]&&this.I();break;case i.Type.VOLUME_CHANGED:var h=f(this,M)[M].getVolume();h>0&&(f(this,J)[J]=h)}},n.l=function(t){this.j(this.B(t))},n.u=function(t){var e=this,i=f(this,I)[I],n=i.AdEvent,r=i.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(f(this,Y)[Y]);var s=f(this,M)[M]=t.getAdsManager(f(this,C)[C],f(this,k)[k]);Object.keys(n.Type).forEach(function(t){s.addEventListener(n.Type[t],function(i){if(e.S(i),R[t]){var n=["LOG","AD_PROGRESS"].indexOf(t)>-1;e.dispatchEvent(new A(R[t],{detail:{ad:i.getAd()||f(e,V)[V],adData:n?i.getAdData():{}}}))}})}),s.addEventListener(r,function(t){return e.j(e.B(t))});try{var o;s.init(f(this,j)[j],f(this,N)[N],this.k()),s.setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),null==(o=f(this,L)[L])||o.initialize(),f(this,$)[$]||this.M()}catch(a){this.j(new S(a.message))}},n.M=function(){if(f(this,G)[G]||(this.dispatchEvent(new A(R.MEDIA_START)),f(this,G)[G]=!0),f(this,M)[M])try{f(this,M)[M].start()}catch(t){this.j(new S(t.message))}else this.I()},n.T=function(){var t=this;setTimeout(function(){f(t,F)[F]=!1,f(t,G)[G]=!1,f(t,W)[W]=!1,t.dispatchEvent(new A(R.MEDIA_STOP))},1)},n.v=function(t){for(var e,i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?d(t,e):void 0}}(t))){e&&(t=e);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(e=i()).done;){var n=e.value;n.contentBoxSize&&1===n.contentBoxSize.length?(f(this,j)[j]=n.contentBoxSize[0].inlineSize,f(this,N)[N]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(f(this,j)[j]=n.contentBoxSize.inlineSize,f(this,N)[N]=n.contentBoxSize.blockSize):(f(this,j)[j]=n.contentRect.width,f(this,N)[N]=n.contentRect.height)}this.R()},n.R=function(){if(f(this,z)[z].autoResize&&f(this,M)[M]){var t=f(this,V)[V],e=this.k();t&&!t.isLinear()?t&&(t.getWidth()>f(this,j)[j]||t.getHeight()>f(this,N)[N]?this.resizeAd(f(this,j)[j],f(this,N)[N]):(f(this,M)[M].resize(t.getWidth(),t.getHeight()+20,e),f(this,_)[_].style.width=t.getWidth()+"px",f(this,_)[_].style.height=t.getHeight()+20+"px")):this.resizeAd(f(this,j)[j],f(this,N)[N])}},n.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||f(this,D)[D].webkitDisplayingFullscreen?f(this,I)[I].ViewMode.FULLSCREEN:f(this,I)[I].ViewMode.NORMAL},n.I=function(){var t=this;f(this,_)[_].style.display="none",f(this,D)[D].ended||(f(this,C)[C].enable(),f(this,Z)[Z]?(f(this,D)[D].pause(),this.dispatchEvent(new A("pause"))):(this.p().then(function(){}).catch(function(){t.dispatchEvent(new A("pause"))}),this.dispatchEvent(new A("play")),this.dispatchEvent(new A(R.MEDIA_RESUMED))),f(this,Z)[Z]=!1)},n.B=function(t){var e=t.getError(),i=new S(e.getMessage());return i.type=e.getType(),i.errorCode=e.getErrorCode(),i.vastErrorCode=e.getVastErrorCode&&e.getVastErrorCode(),i.innerError=e.getInnerError(),i},n.j=function(t){var e=this;this.dispatchEvent(new A(R.AD_ERROR,{detail:{error:t}})),this.C(),f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I()},i(e,[{key:"volume",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?f(this,M)[M].getVolume():f(this,D)[D].volume},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t),f(this,D)[D].volume=t}},{key:"muted",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?0===f(this,M)[M].getVolume():f(this,D)[D].muted},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t?0:f(this,J)[J]),f(this,D)[D].muted=t}},{key:"currentTime",get:function(){return void 0!==f(this,q)[q]?f(this,q)[q]:f(this,D)[D].currentTime},set:function(t){f(this,C)[C].enabled&&(f(this,D)[D].currentTime=t)}},{key:"duration",get:function(){return void 0!==f(this,K)[K]?f(this,K)[K]:f(this,D)[D].duration}},{key:"cuePoints",get:function(){return[].concat(f(this,Q)[Q])}}]),e}(w);let it=0;function nt(t){const e=t.createElement("div");return e.id=`art-vast-${Date.now()}-${++it}`,t.setStyles(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),e}return function(i){return async n=>{let r,s=!1;const o=()=>s||n.isDestroy,a={name:"artplayerPluginVast",destroy:()=>r?.destroy()};function u(){if(!s){s=!0;try{n.off("destroy",u)}finally{r?.destroy()}}}if(o())return a;n.on("destroy",u);try{if(o())return a;const s=await function(){var i=window;return i.google&&i.google.ima?Promise.resolve(i.google.ima):t||((t=new Promise(function(t,e){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=t,i.onerror=e,document.body.appendChild(i)}).then(function(){return i.google.ima})).then(e).catch(e),t)}();if(o())return a;const h=n.constructor.utils;return r=function(t,e,i,n){const{$video:r,$player:s}=t.template,o=new e.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.enablePreloading=!0;const a=new P;let u=null,h=!1,d=0;const l=t=>u===t&&!t.released&&!n();function c(t){u===t&&(u=null),t.released=!0,t.playing=!1;const e=t.player;t.player=null;const i=t.listeners.splice(0);let n,r=!1;const s=t=>{try{t()}catch(e){r?console.error("VAST cleanup error:",e):(r=!0,n=e)}};d++;try{if(e){for(const[t,n]of i)s(()=>e.removeEventListener(t,n));s(()=>e.destroy())}s(()=>{t.container.parentNode&&t.container.parentNode.removeChild(t.container)})}finally{d--}if(r)throw n}function f(){if(n()||d)return null;if(h)throw new Error("VAST initialization is already in progress");if(u?.player)return u.player;let t;h=!0;try{if(t={container:nt(i),player:null,listeners:[],playing:!1,released:!1},u=t,!l(t))return c(t),null;if(s.appendChild(t.container),!l(t))return c(t),null;if(t.player=new et(e,r,t.container,o,a),!l(t))return c(t),null;const n=t;for(const[e,i]of[["AdContentPauseRequested",!0],["AdContentResumeRequested",!1],["AdStarted",!0],["AdError",!1]]){const r=t=>{l(n)&&("AdError"===e&&console.error("VAST Ad Error:",t.detail),n.playing=i,n.container.style.display=i?"block":"none")};if(t.listeners.push([e,r]),t.player.addEventListener(e,r),!l(t))return c(t),null}return t.player}catch(f){if(t)try{c(t)}catch(p){console.error("VAST cleanup error:",p)}throw f}finally{h=!1}}function p(t,i,r){if(n()||u?.playing)return;const s=f(),o=u;if(!s||!o)return;const a=function(t,e,i,n){const r=new t.AdsRequest;r[e]=i;const s=r;for(const o in n)s[o]=n[o];return r}(e,t,i,r);l(o)&&o.player===s&&s.playAds(a)}return{context:{art:t,playUrl:(t,e={})=>p("adTagUrl",t,e),playRes:(t,e={})=>p("adsResponse",t,e),init:f,ima:e,adsRenderingSettings:o,playerOptions:a,get imaPlayer(){return u?.player||null},get container(){return u?.container||null}},destroy:function(){u&&c(u)}}}(n,s,h,o),o()?(u(),a):("function"===typeof i&&await i(r.context),a)}catch(h){try{u()}catch(d){console.error("VAST cleanup error:",d)}throw h}}}}); +!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.artplayerPluginVast=e(),define(function(){return t.artplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).artplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i-1&&(f(this,Q)[Q].splice(e,1),this.g(f(this,Q)[Q]))},n.resizeAd=function(t,e){f(this,j)[j]=t,f(this,N)[N]=e,f(this,M)[M]&&f(this,M)[M].resize(t,e,this.k()),f(this,_)[_].style.width=t+"px",f(this,_)[_].style.height=e+"px"},n.reset=function(t){void 0===t&&(t=!1),t&&(f(this,F)[F]=!1,f(this,G)[G]=!1,f(this,W)[W]=!1),this.C(),f(this,Q)[Q]=[],f(this,Z)[Z]=!1,f(this,$)[$]=void 0,f(this,M)[M]&&f(this,M)[M].destroy(),f(this,M)[M]=void 0,f(this,I)[I].settings.setAutoPlayAdBreaks(!0),t&&this.P(),f(this,_)[_].style.display="none"},n.P=function(){f(this,U)[U]&&(f(this,U)[U].removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),f(this,U)[U].removeEventListener(f(this,I)[I].AdErrorEvent.Type.AD_ERROR,this.l,!1),f(this,U)[U].destroy()),f(this,L)[L]&&f(this,L)[L].destroy()},n.destroy=function(){var t,e,i,n,r=this;this.reset(!0),f(this,C)[C].destroy(),T.forEach(function(t){f(r,D)[D].removeEventListener(t,r.o)}),null==(t=f(this,U)[U])||t.removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(e=f(this,L)[L])||e.destroy(),null==(i=f(this,U)[U])||i.destroy(),f(this,F)[F]=!1,f(this,W)[W]=!1,f(this,G)[G]=!1,null==(n=f(this,B)[B])||n.disconnect()},n.isCustomPlaybackUsed=function(){return!1===f(this,I)[I].settings.getDisableCustomPlaybackForIOS10Plus()&&!f(this,_)[_].querySelector("video")},n.C=function(){window.clearTimeout(f(this,Y)[Y]),window.clearTimeout(f(this,X)[X]),f(this,Y)[Y]=void 0,f(this,X)[X]=void 0,f(this,V)[V]=void 0,f(this,q)[q]=void 0,f(this,K)[K]=void 0,f(this,_)[_].style.display="none",f(this,_)[_].classList.remove("nonlinear"),f(this,M)[M]&&this.R()},n.o=function(t){var e=this;if(f(this,C)[C].enabled||"volumechange"===t.type){if("timeupdate"===t.type){if(f(this,M)[M]){var i=f(this,M)[M].getCuePoints().filter(function(t){return t>=0&&t=.5&&(this.dispatchEvent(new A(R.MEDIA_IMPRESSION)),f(this,F)[F]=!0)}if("play"!==t.type||f(this,G)[G]||f(this,H)[H]||(this.dispatchEvent(new A(R.MEDIA_START)),f(this,G)[G]=!0),"ended"===t.type&&(this.isCustomPlaybackUsed()&&f(this,D)[D].currentTime===f(this,D)[D].duration&&f(this,Q)[Q].indexOf(-1)>-1&&(f(this,D)[D].currentTime=f(this,D)[D].duration-1e-5,f(this,W)[W]=!0),f(this,U)[U].contentComplete(),f(this,M)[M]||this.T()),!window.ResizeObserver&&f(this,z)[z].autoResize&&"loadedmetadata"===t.type){var n=f(this,D)[D],r=n.offsetHeight,s=n.offsetWidth;f(this,j)[j]=s,f(this,N)[N]=r,this.R()}f(this,H)[H]&&"volumechange"!==t.type||this.dispatchEvent(new A(t.type))}},n.S=function(t){var e=this,i=f(this,I)[I].AdEvent;switch(t.type){case i.Type.LOADED:var n=t.getAd();f(this,$)[$]&&0===f(this,Q)[Q].length?f(this,$)[$]({ad:n,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}):f(this,x)[x]=n;break;case i.Type.AD_BREAK_READY:this.C(),f(this,$)[$]?(f(this,$)[$]({ad:f(this,x)[x],adBreakTime:t.getAdData().adBreakTime,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}),f(this,x)[x]=void 0):this.M();break;case i.Type.STARTED:var r=f(this,V)[V]=t.getAd();r.getAdPodInfo().getAdPosition()>1&&f(this,M)[M].setVolume(f(this,M)[M].getVolume()),f(this,_)[_].classList.remove("nonlinear"),this.R(),r.isLinear()?(f(this,C)[C].disable(),f(this,K)[K]=r.getDuration(),f(this,q)[q]=0):(f(this,_)[_].classList.add("nonlinear"),this.I()),f(this,_)[_].style.display="",f(this,Z)[Z]&&(f(this,Z)[Z]=!1,f(this,M)[M].pause());break;case i.Type.ALL_ADS_COMPLETED:if(f(this,W)[W])return;this.isCustomPlaybackUsed()&&Boolean(f(this,V)[V])&&-1!==f(this,V)[V].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),f(this,V)[V]=t.getAd(),f(this,_)[_].style.display="",f(this,D)[D].pause(),this.R(),f(this,V)[V]&&this.A(f(this,V)[V].getAdPodInfo().getTimeOffset()),f(this,M)[M].setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),f(this,C)[C].disable(),f(this,K)[K]=f(this,V)[V].getDuration(),f(this,q)[q]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=Boolean(f(this,V)[V]);if(s){var o=f(this,M)[M].getVolume();f(this,D)[D].muted=0===o,f(this,D)[D].volume=f(this,J)[J]}f(this,W)[W]&&(f(this,D)[D].currentTime=f(this,D)[D].duration+1,f(this,W)[W]=!1),f(this,D)[D].ended?(this.reset(),this.T()):this.C(),s&&(f(this,Z)[Z]=!1,this.I());break;case i.Type.AD_METADATA:this.g(f(this,M)[M].getCuePoints()),-1===f(this,Q)[Q].indexOf(0)&&(f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=t.getAdData();f(this,q)[q]=a.currentTime,f(this,K)[K]=a.duration;break;case i.Type.LOG:var u=t.getAdData();f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):u.adError&&!f(this,V)[V]&&this.I();break;case i.Type.VOLUME_CHANGED:var h=f(this,M)[M].getVolume();h>0&&(f(this,J)[J]=h)}},n.l=function(t){this.j(this.B(t))},n.u=function(t){var e=this,i=f(this,I)[I],n=i.AdEvent,r=i.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(f(this,Y)[Y]);var s=f(this,M)[M]=t.getAdsManager(f(this,C)[C],f(this,k)[k]);Object.keys(n.Type).forEach(function(t){s.addEventListener(n.Type[t],function(i){if(e.S(i),R[t]){var n=["LOG","AD_PROGRESS"].indexOf(t)>-1;e.dispatchEvent(new A(R[t],{detail:{ad:i.getAd()||f(e,V)[V],adData:n?i.getAdData():{}}}))}})}),s.addEventListener(r,function(t){return e.j(e.B(t))});try{var o;s.init(f(this,j)[j],f(this,N)[N],this.k()),s.setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),null==(o=f(this,L)[L])||o.initialize(),f(this,$)[$]||this.M()}catch(a){this.j(new S(a.message))}},n.M=function(){if(f(this,G)[G]||(this.dispatchEvent(new A(R.MEDIA_START)),f(this,G)[G]=!0),f(this,M)[M])try{f(this,M)[M].start()}catch(t){this.j(new S(t.message))}else this.I()},n.T=function(){var t=this;setTimeout(function(){f(t,F)[F]=!1,f(t,G)[G]=!1,f(t,W)[W]=!1,t.dispatchEvent(new A(R.MEDIA_STOP))},1)},n.v=function(t){for(var e,i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?d(t,e):void 0}}(t))){e&&(t=e);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(e=i()).done;){var n=e.value;n.contentBoxSize&&1===n.contentBoxSize.length?(f(this,j)[j]=n.contentBoxSize[0].inlineSize,f(this,N)[N]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(f(this,j)[j]=n.contentBoxSize.inlineSize,f(this,N)[N]=n.contentBoxSize.blockSize):(f(this,j)[j]=n.contentRect.width,f(this,N)[N]=n.contentRect.height)}this.R()},n.R=function(){if(f(this,z)[z].autoResize&&f(this,M)[M]){var t=f(this,V)[V],e=this.k();t&&!t.isLinear()?t&&(t.getWidth()>f(this,j)[j]||t.getHeight()>f(this,N)[N]?this.resizeAd(f(this,j)[j],f(this,N)[N]):(f(this,M)[M].resize(t.getWidth(),t.getHeight()+20,e),f(this,_)[_].style.width=t.getWidth()+"px",f(this,_)[_].style.height=t.getHeight()+20+"px")):this.resizeAd(f(this,j)[j],f(this,N)[N])}},n.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||f(this,D)[D].webkitDisplayingFullscreen?f(this,I)[I].ViewMode.FULLSCREEN:f(this,I)[I].ViewMode.NORMAL},n.I=function(){var t=this;f(this,_)[_].style.display="none",f(this,D)[D].ended||(f(this,C)[C].enable(),f(this,Z)[Z]?(f(this,D)[D].pause(),this.dispatchEvent(new A("pause"))):(this.p().then(function(){}).catch(function(){t.dispatchEvent(new A("pause"))}),this.dispatchEvent(new A("play")),this.dispatchEvent(new A(R.MEDIA_RESUMED))),f(this,Z)[Z]=!1)},n.B=function(t){var e=t.getError(),i=new S(e.getMessage());return i.type=e.getType(),i.errorCode=e.getErrorCode(),i.vastErrorCode=e.getVastErrorCode&&e.getVastErrorCode(),i.innerError=e.getInnerError(),i},n.j=function(t){var e=this;this.dispatchEvent(new A(R.AD_ERROR,{detail:{error:t}})),this.C(),f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I()},i(e,[{key:"volume",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?f(this,M)[M].getVolume():f(this,D)[D].volume},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t),f(this,D)[D].volume=t}},{key:"muted",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?0===f(this,M)[M].getVolume():f(this,D)[D].muted},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t?0:f(this,J)[J]),f(this,D)[D].muted=t}},{key:"currentTime",get:function(){return void 0!==f(this,q)[q]?f(this,q)[q]:f(this,D)[D].currentTime},set:function(t){f(this,C)[C].enabled&&(f(this,D)[D].currentTime=t)}},{key:"duration",get:function(){return void 0!==f(this,K)[K]?f(this,K)[K]:f(this,D)[D].duration}},{key:"cuePoints",get:function(){return[].concat(f(this,Q)[Q])}}]),e}(w);let it=0;function nt(t){const e=t.createElement("div");return e.id=`art-vast-${Date.now()}-${++it}`,t.setStyles(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),e}function rt(i){return async n=>{let r,s=!1;const o=()=>s||n.isDestroy,a={name:"artplayerPluginVast",destroy:()=>r?.destroy()};function u(){if(!s){s=!0;try{n.off("destroy",u)}finally{r?.destroy()}}}if(o())return a;n.on("destroy",u);try{if(o())return a;const s=await function(){var i=window;return i.google&&i.google.ima?Promise.resolve(i.google.ima):t||((t=new Promise(function(t,e){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=t,i.onerror=e,document.body.appendChild(i)}).then(function(){return i.google.ima})).then(e).catch(e),t)}();if(o())return a;const h=n.constructor.utils;return r=function(t,e,i,n){const{$video:r,$player:s}=t.template,o=new e.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.enablePreloading=!0;const a=new P;let u=null,h=!1,d=0;const l=t=>u===t&&!t.released&&!n();function c(t){u===t&&(u=null),t.released=!0,t.playing=!1;const e=t.player;t.player=null;const i=t.listeners.splice(0);let n,r=!1;const s=t=>{try{t()}catch(e){r?console.error("VAST cleanup error:",e):(r=!0,n=e)}};d++;try{if(e){for(const[t,n]of i)s(()=>e.removeEventListener(t,n));s(()=>e.destroy())}s(()=>{t.container.parentNode&&t.container.parentNode.removeChild(t.container)})}finally{d--}if(r)throw n}function f(){if(n()||d)return null;if(h)throw new Error("VAST initialization is already in progress");if(u?.player)return u.player;let t;h=!0;try{if(t={container:nt(i),player:null,listeners:[],playing:!1,released:!1},u=t,!l(t))return c(t),null;if(s.appendChild(t.container),!l(t))return c(t),null;if(t.player=new et(e,r,t.container,o,a),!l(t))return c(t),null;const n=t;for(const[e,i]of[["AdContentPauseRequested",!0],["AdContentResumeRequested",!1],["AdStarted",!0],["AdError",!1]]){const r=t=>{l(n)&&("AdError"===e&&console.error("VAST Ad Error:",t.detail),n.playing=i,n.container.style.display=i?"block":"none")};if(t.listeners.push([e,r]),t.player.addEventListener(e,r),!l(t))return c(t),null}return t.player}catch(f){if(t)try{c(t)}catch(p){console.error("VAST cleanup error:",p)}throw f}finally{h=!1}}function p(t,i,r){if(n()||u?.playing)return;const s=f(),o=u;if(!s||!o)return;const a=function(t,e,i,n){const r=new t.AdsRequest;r[e]=i;const s=r;for(const o in n)s[o]=n[o];return r}(e,t,i,r);l(o)&&o.player===s&&s.playAds(a)}return{context:{art:t,playUrl:(t,e={})=>p("adTagUrl",t,e),playRes:(t,e={})=>p("adsResponse",t,e),init:f,ima:e,adsRenderingSettings:o,playerOptions:a,get imaPlayer(){return u?.player||null},get container(){return u?.container||null}},destroy:function(){u&&c(u)}}}(n,s,h,o),o()?(u(),a):("function"===typeof i&&await i(r.context),a)}catch(h){try{u()}catch(d){console.error("VAST cleanup error:",d)}throw h}}}return rt.default=rt,rt}); diff --git a/docs/compiled/artplayer-plugin-vast.legacy.js b/docs/compiled/artplayer-plugin-vast.legacy.js index 08711d88e..504c05b1a 100644 --- a/docs/compiled/artplayer-plugin-vast.legacy.js +++ b/docs/compiled/artplayer-plugin-vast.legacy.js @@ -4,4 +4,4 @@ * (c) 2017-2026 Harvey Zhao * Released under the MIT License. */ -!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.artplayerPluginVast=e(),define(function(){return t.artplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).artplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i-1&&(f(this,Q)[Q].splice(e,1),this.g(f(this,Q)[Q]))},n.resizeAd=function(t,e){f(this,j)[j]=t,f(this,N)[N]=e,f(this,M)[M]&&f(this,M)[M].resize(t,e,this.k()),f(this,_)[_].style.width=t+"px",f(this,_)[_].style.height=e+"px"},n.reset=function(t){void 0===t&&(t=!1),t&&(f(this,F)[F]=!1,f(this,G)[G]=!1,f(this,W)[W]=!1),this.C(),f(this,Q)[Q]=[],f(this,Z)[Z]=!1,f(this,$)[$]=void 0,f(this,M)[M]&&f(this,M)[M].destroy(),f(this,M)[M]=void 0,f(this,I)[I].settings.setAutoPlayAdBreaks(!0),t&&this.P(),f(this,_)[_].style.display="none"},n.P=function(){f(this,U)[U]&&(f(this,U)[U].removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),f(this,U)[U].removeEventListener(f(this,I)[I].AdErrorEvent.Type.AD_ERROR,this.l,!1),f(this,U)[U].destroy()),f(this,L)[L]&&f(this,L)[L].destroy()},n.destroy=function(){var t,e,i,n,r=this;this.reset(!0),f(this,C)[C].destroy(),T.forEach(function(t){f(r,D)[D].removeEventListener(t,r.o)}),null==(t=f(this,U)[U])||t.removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(e=f(this,L)[L])||e.destroy(),null==(i=f(this,U)[U])||i.destroy(),f(this,F)[F]=!1,f(this,W)[W]=!1,f(this,G)[G]=!1,null==(n=f(this,B)[B])||n.disconnect()},n.isCustomPlaybackUsed=function(){return!1===f(this,I)[I].settings.getDisableCustomPlaybackForIOS10Plus()&&!f(this,_)[_].querySelector("video")},n.C=function(){window.clearTimeout(f(this,Y)[Y]),window.clearTimeout(f(this,X)[X]),f(this,Y)[Y]=void 0,f(this,X)[X]=void 0,f(this,x)[x]=void 0,f(this,q)[q]=void 0,f(this,K)[K]=void 0,f(this,_)[_].style.display="none",f(this,_)[_].classList.remove("nonlinear"),f(this,M)[M]&&this.R()},n.o=function(t){var e=this;if(f(this,C)[C].enabled||"volumechange"===t.type){if("timeupdate"===t.type){if(f(this,M)[M]){var i=f(this,M)[M].getCuePoints().filter(function(t){return t>=0&&t=.5&&(this.dispatchEvent(new A(P.MEDIA_IMPRESSION)),f(this,F)[F]=!0)}if("play"!==t.type||f(this,G)[G]||f(this,H)[H]||(this.dispatchEvent(new A(P.MEDIA_START)),f(this,G)[G]=!0),"ended"===t.type&&(this.isCustomPlaybackUsed()&&f(this,D)[D].currentTime===f(this,D)[D].duration&&f(this,Q)[Q].indexOf(-1)>-1&&(f(this,D)[D].currentTime=f(this,D)[D].duration-1e-5,f(this,W)[W]=!0),f(this,U)[U].contentComplete(),f(this,M)[M]||this.T()),!window.ResizeObserver&&f(this,z)[z].autoResize&&"loadedmetadata"===t.type){var n=f(this,D)[D],r=n.offsetHeight,s=n.offsetWidth;f(this,j)[j]=s,f(this,N)[N]=r,this.R()}f(this,H)[H]&&"volumechange"!==t.type||this.dispatchEvent(new A(t.type))}},n.S=function(t){var e=this,i=f(this,I)[I].AdEvent;switch(t.type){case i.Type.LOADED:var n=t.getAd();f(this,$)[$]&&0===f(this,Q)[Q].length?f(this,$)[$]({ad:n,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}):f(this,V)[V]=n;break;case i.Type.AD_BREAK_READY:this.C(),f(this,$)[$]?(f(this,$)[$]({ad:f(this,V)[V],adBreakTime:t.getAdData().adBreakTime,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}),f(this,V)[V]=void 0):this.M();break;case i.Type.STARTED:var r=f(this,x)[x]=t.getAd();r.getAdPodInfo().getAdPosition()>1&&f(this,M)[M].setVolume(f(this,M)[M].getVolume()),f(this,_)[_].classList.remove("nonlinear"),this.R(),r.isLinear()?(f(this,C)[C].disable(),f(this,K)[K]=r.getDuration(),f(this,q)[q]=0):(f(this,_)[_].classList.add("nonlinear"),this.I()),f(this,_)[_].style.display="",f(this,Z)[Z]&&(f(this,Z)[Z]=!1,f(this,M)[M].pause());break;case i.Type.ALL_ADS_COMPLETED:if(f(this,W)[W])return;this.isCustomPlaybackUsed()&&Boolean(f(this,x)[x])&&-1!==f(this,x)[x].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),f(this,x)[x]=t.getAd(),f(this,_)[_].style.display="",f(this,D)[D].pause(),this.R(),f(this,x)[x]&&this.A(f(this,x)[x].getAdPodInfo().getTimeOffset()),f(this,M)[M].setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),f(this,C)[C].disable(),f(this,K)[K]=f(this,x)[x].getDuration(),f(this,q)[q]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=Boolean(f(this,x)[x]);if(s){var o=f(this,M)[M].getVolume();f(this,D)[D].muted=0===o,f(this,D)[D].volume=f(this,J)[J]}f(this,W)[W]&&(f(this,D)[D].currentTime=f(this,D)[D].duration+1,f(this,W)[W]=!1),f(this,D)[D].ended?(this.reset(),this.T()):this.C(),s&&(f(this,Z)[Z]=!1,this.I());break;case i.Type.AD_METADATA:this.g(f(this,M)[M].getCuePoints()),-1===f(this,Q)[Q].indexOf(0)&&(f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=t.getAdData();f(this,q)[q]=a.currentTime,f(this,K)[K]=a.duration;break;case i.Type.LOG:var u=t.getAdData();f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):u.adError&&!f(this,x)[x]&&this.I();break;case i.Type.VOLUME_CHANGED:var h=f(this,M)[M].getVolume();h>0&&(f(this,J)[J]=h)}},n.l=function(t){this.j(this.B(t))},n.u=function(t){var e=this,i=f(this,I)[I],n=i.AdEvent,r=i.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(f(this,Y)[Y]);var s=f(this,M)[M]=t.getAdsManager(f(this,C)[C],f(this,k)[k]);Object.keys(n.Type).forEach(function(t){s.addEventListener(n.Type[t],function(i){if(e.S(i),P[t]){var n=["LOG","AD_PROGRESS"].indexOf(t)>-1;e.dispatchEvent(new A(P[t],{detail:{ad:i.getAd()||f(e,x)[x],adData:n?i.getAdData():{}}}))}})}),s.addEventListener(r,function(t){return e.j(e.B(t))});try{var o;s.init(f(this,j)[j],f(this,N)[N],this.k()),s.setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),null==(o=f(this,L)[L])||o.initialize(),f(this,$)[$]||this.M()}catch(a){this.j(new S(a.message))}},n.M=function(){if(f(this,G)[G]||(this.dispatchEvent(new A(P.MEDIA_START)),f(this,G)[G]=!0),f(this,M)[M])try{f(this,M)[M].start()}catch(t){this.j(new S(t.message))}else this.I()},n.T=function(){var t=this;setTimeout(function(){f(t,F)[F]=!1,f(t,G)[G]=!1,f(t,W)[W]=!1,t.dispatchEvent(new A(P.MEDIA_STOP))},1)},n.v=function(t){for(var e,i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?d(t,e):void 0}}(t))){e&&(t=e);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(e=i()).done;){var n=e.value;n.contentBoxSize&&1===n.contentBoxSize.length?(f(this,j)[j]=n.contentBoxSize[0].inlineSize,f(this,N)[N]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(f(this,j)[j]=n.contentBoxSize.inlineSize,f(this,N)[N]=n.contentBoxSize.blockSize):(f(this,j)[j]=n.contentRect.width,f(this,N)[N]=n.contentRect.height)}this.R()},n.R=function(){if(f(this,z)[z].autoResize&&f(this,M)[M]){var t=f(this,x)[x],e=this.k();t&&!t.isLinear()?t&&(t.getWidth()>f(this,j)[j]||t.getHeight()>f(this,N)[N]?this.resizeAd(f(this,j)[j],f(this,N)[N]):(f(this,M)[M].resize(t.getWidth(),t.getHeight()+20,e),f(this,_)[_].style.width=t.getWidth()+"px",f(this,_)[_].style.height=t.getHeight()+20+"px")):this.resizeAd(f(this,j)[j],f(this,N)[N])}},n.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||f(this,D)[D].webkitDisplayingFullscreen?f(this,I)[I].ViewMode.FULLSCREEN:f(this,I)[I].ViewMode.NORMAL},n.I=function(){var t=this;f(this,_)[_].style.display="none",f(this,D)[D].ended||(f(this,C)[C].enable(),f(this,Z)[Z]?(f(this,D)[D].pause(),this.dispatchEvent(new A("pause"))):(this.p().then(function(){}).catch(function(){t.dispatchEvent(new A("pause"))}),this.dispatchEvent(new A("play")),this.dispatchEvent(new A(P.MEDIA_RESUMED))),f(this,Z)[Z]=!1)},n.B=function(t){var e=t.getError(),i=new S(e.getMessage());return i.type=e.getType(),i.errorCode=e.getErrorCode(),i.vastErrorCode=e.getVastErrorCode&&e.getVastErrorCode(),i.innerError=e.getInnerError(),i},n.j=function(t){var e=this;this.dispatchEvent(new A(P.AD_ERROR,{detail:{error:t}})),this.C(),f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I()},i(e,[{key:"volume",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?f(this,M)[M].getVolume():f(this,D)[D].volume},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t),f(this,D)[D].volume=t}},{key:"muted",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?0===f(this,M)[M].getVolume():f(this,D)[D].muted},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t?0:f(this,J)[J]),f(this,D)[D].muted=t}},{key:"currentTime",get:function(){return void 0!==f(this,q)[q]?f(this,q)[q]:f(this,D)[D].currentTime},set:function(t){f(this,C)[C].enabled&&(f(this,D)[D].currentTime=t)}},{key:"duration",get:function(){return void 0!==f(this,K)[K]?f(this,K)[K]:f(this,D)[D].duration}},{key:"cuePoints",get:function(){return[].concat(f(this,Q)[Q])}}]),e}(w);let it=0;function nt(t){const e=t.createElement("div");return e.id=`art-vast-${Date.now()}-${++it}`,t.setStyles(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),e}return function(i){return n=>{return r=this,s=null,o=function*(){let r,s=!1;const o=()=>s||n.isDestroy,a={name:"artplayerPluginVast",destroy:()=>null==r?void 0:r.destroy()};function u(){if(!s){s=!0;try{n.off("destroy",u)}finally{null==r||r.destroy()}}}if(o())return a;n.on("destroy",u);try{if(o())return a;const s=yield function(){var i=window;return i.google&&i.google.ima?Promise.resolve(i.google.ima):t||((t=new Promise(function(t,e){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=t,i.onerror=e,document.body.appendChild(i)}).then(function(){return i.google.ima})).then(e).catch(e),t)}();if(o())return a;const h=n.constructor.utils;return r=function(t,e,i,n){const{$video:r,$player:s}=t.template,o=new e.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.enablePreloading=!0;const a=new R;let u=null,h=!1,d=0;const l=t=>u===t&&!t.released&&!n();function c(t){u===t&&(u=null),t.released=!0,t.playing=!1;const e=t.player;t.player=null;const i=t.listeners.splice(0);let n,r=!1;const s=t=>{try{t()}catch(e){r?console.error("VAST cleanup error:",e):(r=!0,n=e)}};d++;try{if(e){for(const[t,n]of i)s(()=>e.removeEventListener(t,n));s(()=>e.destroy())}s(()=>{t.container.parentNode&&t.container.parentNode.removeChild(t.container)})}finally{d--}if(r)throw n}function f(){if(n()||d)return null;if(h)throw new Error("VAST initialization is already in progress");if(null==u?void 0:u.player)return u.player;let t;h=!0;try{if(t={container:nt(i),player:null,listeners:[],playing:!1,released:!1},u=t,!l(t))return c(t),null;if(s.appendChild(t.container),!l(t))return c(t),null;if(t.player=new et(e,r,t.container,o,a),!l(t))return c(t),null;const n=t;for(const[e,i]of[["AdContentPauseRequested",!0],["AdContentResumeRequested",!1],["AdStarted",!0],["AdError",!1]]){const r=t=>{l(n)&&("AdError"===e&&console.error("VAST Ad Error:",t.detail),n.playing=i,n.container.style.display=i?"block":"none")};if(t.listeners.push([e,r]),t.player.addEventListener(e,r),!l(t))return c(t),null}return t.player}catch(f){if(t)try{c(t)}catch(p){console.error("VAST cleanup error:",p)}throw f}finally{h=!1}}function p(t,i,r){if(n()||(null==u?void 0:u.playing))return;const s=f(),o=u;if(!s||!o)return;const a=function(t,e,i,n){const r=new t.AdsRequest;r[e]=i;const s=r;for(const o in n)s[o]=n[o];return r}(e,t,i,r);l(o)&&o.player===s&&s.playAds(a)}return{context:{art:t,playUrl:(t,e={})=>p("adTagUrl",t,e),playRes:(t,e={})=>p("adsResponse",t,e),init:f,ima:e,adsRenderingSettings:o,playerOptions:a,get imaPlayer(){return(null==u?void 0:u.player)||null},get container(){return(null==u?void 0:u.container)||null}},destroy:function(){u&&c(u)}}}(n,s,h,o),o()?(u(),a):("function"===typeof i&&(yield i(r.context)),a)}catch(h){try{u()}catch(d){console.error("VAST cleanup error:",d)}throw h}},new Promise((t,e)=>{var i=t=>{try{a(o.next(t))}catch(i){e(i)}},n=t=>{try{a(o.throw(t))}catch(i){e(i)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,n);a((o=o.apply(r,s)).next())});var r,s,o}}}); +!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.artplayerPluginVast=e(),define(function(){return t.artplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).artplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i-1&&(f(this,Q)[Q].splice(e,1),this.g(f(this,Q)[Q]))},n.resizeAd=function(t,e){f(this,j)[j]=t,f(this,N)[N]=e,f(this,M)[M]&&f(this,M)[M].resize(t,e,this.k()),f(this,_)[_].style.width=t+"px",f(this,_)[_].style.height=e+"px"},n.reset=function(t){void 0===t&&(t=!1),t&&(f(this,F)[F]=!1,f(this,G)[G]=!1,f(this,W)[W]=!1),this.C(),f(this,Q)[Q]=[],f(this,Z)[Z]=!1,f(this,$)[$]=void 0,f(this,M)[M]&&f(this,M)[M].destroy(),f(this,M)[M]=void 0,f(this,I)[I].settings.setAutoPlayAdBreaks(!0),t&&this.P(),f(this,_)[_].style.display="none"},n.P=function(){f(this,U)[U]&&(f(this,U)[U].removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),f(this,U)[U].removeEventListener(f(this,I)[I].AdErrorEvent.Type.AD_ERROR,this.l,!1),f(this,U)[U].destroy()),f(this,L)[L]&&f(this,L)[L].destroy()},n.destroy=function(){var t,e,i,n,r=this;this.reset(!0),f(this,C)[C].destroy(),T.forEach(function(t){f(r,D)[D].removeEventListener(t,r.o)}),null==(t=f(this,U)[U])||t.removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(e=f(this,L)[L])||e.destroy(),null==(i=f(this,U)[U])||i.destroy(),f(this,F)[F]=!1,f(this,W)[W]=!1,f(this,G)[G]=!1,null==(n=f(this,B)[B])||n.disconnect()},n.isCustomPlaybackUsed=function(){return!1===f(this,I)[I].settings.getDisableCustomPlaybackForIOS10Plus()&&!f(this,_)[_].querySelector("video")},n.C=function(){window.clearTimeout(f(this,Y)[Y]),window.clearTimeout(f(this,X)[X]),f(this,Y)[Y]=void 0,f(this,X)[X]=void 0,f(this,x)[x]=void 0,f(this,q)[q]=void 0,f(this,K)[K]=void 0,f(this,_)[_].style.display="none",f(this,_)[_].classList.remove("nonlinear"),f(this,M)[M]&&this.R()},n.o=function(t){var e=this;if(f(this,C)[C].enabled||"volumechange"===t.type){if("timeupdate"===t.type){if(f(this,M)[M]){var i=f(this,M)[M].getCuePoints().filter(function(t){return t>=0&&t=.5&&(this.dispatchEvent(new A(P.MEDIA_IMPRESSION)),f(this,F)[F]=!0)}if("play"!==t.type||f(this,G)[G]||f(this,H)[H]||(this.dispatchEvent(new A(P.MEDIA_START)),f(this,G)[G]=!0),"ended"===t.type&&(this.isCustomPlaybackUsed()&&f(this,D)[D].currentTime===f(this,D)[D].duration&&f(this,Q)[Q].indexOf(-1)>-1&&(f(this,D)[D].currentTime=f(this,D)[D].duration-1e-5,f(this,W)[W]=!0),f(this,U)[U].contentComplete(),f(this,M)[M]||this.T()),!window.ResizeObserver&&f(this,z)[z].autoResize&&"loadedmetadata"===t.type){var n=f(this,D)[D],r=n.offsetHeight,s=n.offsetWidth;f(this,j)[j]=s,f(this,N)[N]=r,this.R()}f(this,H)[H]&&"volumechange"!==t.type||this.dispatchEvent(new A(t.type))}},n.S=function(t){var e=this,i=f(this,I)[I].AdEvent;switch(t.type){case i.Type.LOADED:var n=t.getAd();f(this,$)[$]&&0===f(this,Q)[Q].length?f(this,$)[$]({ad:n,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}):f(this,V)[V]=n;break;case i.Type.AD_BREAK_READY:this.C(),f(this,$)[$]?(f(this,$)[$]({ad:f(this,V)[V],adBreakTime:t.getAdData().adBreakTime,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}),f(this,V)[V]=void 0):this.M();break;case i.Type.STARTED:var r=f(this,x)[x]=t.getAd();r.getAdPodInfo().getAdPosition()>1&&f(this,M)[M].setVolume(f(this,M)[M].getVolume()),f(this,_)[_].classList.remove("nonlinear"),this.R(),r.isLinear()?(f(this,C)[C].disable(),f(this,K)[K]=r.getDuration(),f(this,q)[q]=0):(f(this,_)[_].classList.add("nonlinear"),this.I()),f(this,_)[_].style.display="",f(this,Z)[Z]&&(f(this,Z)[Z]=!1,f(this,M)[M].pause());break;case i.Type.ALL_ADS_COMPLETED:if(f(this,W)[W])return;this.isCustomPlaybackUsed()&&Boolean(f(this,x)[x])&&-1!==f(this,x)[x].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),f(this,x)[x]=t.getAd(),f(this,_)[_].style.display="",f(this,D)[D].pause(),this.R(),f(this,x)[x]&&this.A(f(this,x)[x].getAdPodInfo().getTimeOffset()),f(this,M)[M].setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),f(this,C)[C].disable(),f(this,K)[K]=f(this,x)[x].getDuration(),f(this,q)[q]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=Boolean(f(this,x)[x]);if(s){var o=f(this,M)[M].getVolume();f(this,D)[D].muted=0===o,f(this,D)[D].volume=f(this,J)[J]}f(this,W)[W]&&(f(this,D)[D].currentTime=f(this,D)[D].duration+1,f(this,W)[W]=!1),f(this,D)[D].ended?(this.reset(),this.T()):this.C(),s&&(f(this,Z)[Z]=!1,this.I());break;case i.Type.AD_METADATA:this.g(f(this,M)[M].getCuePoints()),-1===f(this,Q)[Q].indexOf(0)&&(f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=t.getAdData();f(this,q)[q]=a.currentTime,f(this,K)[K]=a.duration;break;case i.Type.LOG:var u=t.getAdData();f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):u.adError&&!f(this,x)[x]&&this.I();break;case i.Type.VOLUME_CHANGED:var h=f(this,M)[M].getVolume();h>0&&(f(this,J)[J]=h)}},n.l=function(t){this.j(this.B(t))},n.u=function(t){var e=this,i=f(this,I)[I],n=i.AdEvent,r=i.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(f(this,Y)[Y]);var s=f(this,M)[M]=t.getAdsManager(f(this,C)[C],f(this,k)[k]);Object.keys(n.Type).forEach(function(t){s.addEventListener(n.Type[t],function(i){if(e.S(i),P[t]){var n=["LOG","AD_PROGRESS"].indexOf(t)>-1;e.dispatchEvent(new A(P[t],{detail:{ad:i.getAd()||f(e,x)[x],adData:n?i.getAdData():{}}}))}})}),s.addEventListener(r,function(t){return e.j(e.B(t))});try{var o;s.init(f(this,j)[j],f(this,N)[N],this.k()),s.setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),null==(o=f(this,L)[L])||o.initialize(),f(this,$)[$]||this.M()}catch(a){this.j(new S(a.message))}},n.M=function(){if(f(this,G)[G]||(this.dispatchEvent(new A(P.MEDIA_START)),f(this,G)[G]=!0),f(this,M)[M])try{f(this,M)[M].start()}catch(t){this.j(new S(t.message))}else this.I()},n.T=function(){var t=this;setTimeout(function(){f(t,F)[F]=!1,f(t,G)[G]=!1,f(t,W)[W]=!1,t.dispatchEvent(new A(P.MEDIA_STOP))},1)},n.v=function(t){for(var e,i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?d(t,e):void 0}}(t))){e&&(t=e);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(e=i()).done;){var n=e.value;n.contentBoxSize&&1===n.contentBoxSize.length?(f(this,j)[j]=n.contentBoxSize[0].inlineSize,f(this,N)[N]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(f(this,j)[j]=n.contentBoxSize.inlineSize,f(this,N)[N]=n.contentBoxSize.blockSize):(f(this,j)[j]=n.contentRect.width,f(this,N)[N]=n.contentRect.height)}this.R()},n.R=function(){if(f(this,z)[z].autoResize&&f(this,M)[M]){var t=f(this,x)[x],e=this.k();t&&!t.isLinear()?t&&(t.getWidth()>f(this,j)[j]||t.getHeight()>f(this,N)[N]?this.resizeAd(f(this,j)[j],f(this,N)[N]):(f(this,M)[M].resize(t.getWidth(),t.getHeight()+20,e),f(this,_)[_].style.width=t.getWidth()+"px",f(this,_)[_].style.height=t.getHeight()+20+"px")):this.resizeAd(f(this,j)[j],f(this,N)[N])}},n.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||f(this,D)[D].webkitDisplayingFullscreen?f(this,I)[I].ViewMode.FULLSCREEN:f(this,I)[I].ViewMode.NORMAL},n.I=function(){var t=this;f(this,_)[_].style.display="none",f(this,D)[D].ended||(f(this,C)[C].enable(),f(this,Z)[Z]?(f(this,D)[D].pause(),this.dispatchEvent(new A("pause"))):(this.p().then(function(){}).catch(function(){t.dispatchEvent(new A("pause"))}),this.dispatchEvent(new A("play")),this.dispatchEvent(new A(P.MEDIA_RESUMED))),f(this,Z)[Z]=!1)},n.B=function(t){var e=t.getError(),i=new S(e.getMessage());return i.type=e.getType(),i.errorCode=e.getErrorCode(),i.vastErrorCode=e.getVastErrorCode&&e.getVastErrorCode(),i.innerError=e.getInnerError(),i},n.j=function(t){var e=this;this.dispatchEvent(new A(P.AD_ERROR,{detail:{error:t}})),this.C(),f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I()},i(e,[{key:"volume",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?f(this,M)[M].getVolume():f(this,D)[D].volume},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t),f(this,D)[D].volume=t}},{key:"muted",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?0===f(this,M)[M].getVolume():f(this,D)[D].muted},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t?0:f(this,J)[J]),f(this,D)[D].muted=t}},{key:"currentTime",get:function(){return void 0!==f(this,q)[q]?f(this,q)[q]:f(this,D)[D].currentTime},set:function(t){f(this,C)[C].enabled&&(f(this,D)[D].currentTime=t)}},{key:"duration",get:function(){return void 0!==f(this,K)[K]?f(this,K)[K]:f(this,D)[D].duration}},{key:"cuePoints",get:function(){return[].concat(f(this,Q)[Q])}}]),e}(w);let it=0;function nt(t){const e=t.createElement("div");return e.id=`art-vast-${Date.now()}-${++it}`,t.setStyles(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),e}function rt(i){return n=>{return r=null,s=null,o=function*(){let r,s=!1;const o=()=>s||n.isDestroy,a={name:"artplayerPluginVast",destroy:()=>null==r?void 0:r.destroy()};function u(){if(!s){s=!0;try{n.off("destroy",u)}finally{null==r||r.destroy()}}}if(o())return a;n.on("destroy",u);try{if(o())return a;const s=yield function(){var i=window;return i.google&&i.google.ima?Promise.resolve(i.google.ima):t||((t=new Promise(function(t,e){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=t,i.onerror=e,document.body.appendChild(i)}).then(function(){return i.google.ima})).then(e).catch(e),t)}();if(o())return a;const h=n.constructor.utils;return r=function(t,e,i,n){const{$video:r,$player:s}=t.template,o=new e.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.enablePreloading=!0;const a=new R;let u=null,h=!1,d=0;const l=t=>u===t&&!t.released&&!n();function c(t){u===t&&(u=null),t.released=!0,t.playing=!1;const e=t.player;t.player=null;const i=t.listeners.splice(0);let n,r=!1;const s=t=>{try{t()}catch(e){r?console.error("VAST cleanup error:",e):(r=!0,n=e)}};d++;try{if(e){for(const[t,n]of i)s(()=>e.removeEventListener(t,n));s(()=>e.destroy())}s(()=>{t.container.parentNode&&t.container.parentNode.removeChild(t.container)})}finally{d--}if(r)throw n}function f(){if(n()||d)return null;if(h)throw new Error("VAST initialization is already in progress");if(null==u?void 0:u.player)return u.player;let t;h=!0;try{if(t={container:nt(i),player:null,listeners:[],playing:!1,released:!1},u=t,!l(t))return c(t),null;if(s.appendChild(t.container),!l(t))return c(t),null;if(t.player=new et(e,r,t.container,o,a),!l(t))return c(t),null;const n=t;for(const[e,i]of[["AdContentPauseRequested",!0],["AdContentResumeRequested",!1],["AdStarted",!0],["AdError",!1]]){const r=t=>{l(n)&&("AdError"===e&&console.error("VAST Ad Error:",t.detail),n.playing=i,n.container.style.display=i?"block":"none")};if(t.listeners.push([e,r]),t.player.addEventListener(e,r),!l(t))return c(t),null}return t.player}catch(f){if(t)try{c(t)}catch(p){console.error("VAST cleanup error:",p)}throw f}finally{h=!1}}function p(t,i,r){if(n()||(null==u?void 0:u.playing))return;const s=f(),o=u;if(!s||!o)return;const a=function(t,e,i,n){const r=new t.AdsRequest;r[e]=i;const s=r;for(const o in n)s[o]=n[o];return r}(e,t,i,r);l(o)&&o.player===s&&s.playAds(a)}return{context:{art:t,playUrl:(t,e={})=>p("adTagUrl",t,e),playRes:(t,e={})=>p("adsResponse",t,e),init:f,ima:e,adsRenderingSettings:o,playerOptions:a,get imaPlayer(){return(null==u?void 0:u.player)||null},get container(){return(null==u?void 0:u.container)||null}},destroy:function(){u&&c(u)}}}(n,s,h,o),o()?(u(),a):("function"===typeof i&&(yield i(r.context)),a)}catch(h){try{u()}catch(d){console.error("VAST cleanup error:",d)}throw h}},new Promise((t,e)=>{var i=t=>{try{a(o.next(t))}catch(i){e(i)}},n=t=>{try{a(o.throw(t))}catch(i){e(i)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,n);a((o=o.apply(r,s)).next())});var r,s,o}}return rt.default=rt,rt}); diff --git a/docs/compiled/artplayer-plugin-vast.mjs b/docs/compiled/artplayer-plugin-vast.mjs index df954611f..db882b343 100644 --- a/docs/compiled/artplayer-plugin-vast.mjs +++ b/docs/compiled/artplayer-plugin-vast.mjs @@ -98,15 +98,15 @@ function w(t2, i2) { return t2; } var m = {}; -m.CustomEvent = "function" == typeof CustomEvent ? CustomEvent : function(t2) { +m.CustomEvent = "function" == typeof CustomEvent ? CustomEvent : (function(t2) { return i2[t2] = new i2("").constructor[t2], i2; function i2(t3, i3) { i3 || (i3 = {}); var e2 = document.createEvent("CustomEvent"); return e2.initCustomEvent(t3, !!i3.bubbles, !!i3.cancelable, i3.detail), e2; } -}("prototype"); -var p, y, O = m.CustomEvent, j = b("mediaElement"), g = b("currentTime"), A = b("enabled"), k = function() { +})("prototype"); +var p, y, O = m.CustomEvent, j = b("mediaElement"), g = b("currentTime"), A = b("enabled"), k = (function() { function t2(t3) { Object.defineProperty(this, j, { writable: true, value: void 0 }), Object.defineProperty(this, g, { writable: true, value: void 0 }), Object.defineProperty(this, A, { writable: true, value: void 0 }), this.seeking = void 0, w(this, j)[j] = t3, w(this, g)[g] = 0, w(this, A)[A] = false, this.seeking = false, this.t = this.t.bind(this), this.i = this.i.bind(this), this.h = this.h.bind(this), this.enable(); } @@ -151,7 +151,7 @@ var p, y, O = m.CustomEvent, j = b("mediaElement"), g = b("currentTime"), A = b( var t3; return null == (t3 = w(this, j)[j]) ? void 0 : t3.volume; } }]), t2; -}(), C = function() { +})(), C = (function() { function t2() { this.delegate = document.createDocumentFragment(); } @@ -163,23 +163,23 @@ var p, y, O = m.CustomEvent, j = b("mediaElement"), g = b("currentTime"), A = b( }, i2.removeEventListener = function() { return this.delegate.removeEventListener.apply(this.delegate, [].slice.call(arguments)); }, t2; -}(), P = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"]; -!function(t2) { +})(), P = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"]; +!(function(t2) { t2.MEDIA_START = "MediaStart", t2.MEDIA_IMPRESSION = "MediaImpression", t2.MEDIA_STOP = "MediaStop", t2.MEDIA_CUE_POINTS_CHANGE = "MediaCuePointsChange", t2.MEDIA_RESUMED = "MediaResumed"; -}(p || (p = {})), function(t2) { +})(p || (p = {})), (function(t2) { t2.AD_ERROR = "AdError", t2.AD_BUFFERING = "AdBuffering", t2.LOADED = "AdLoaded", t2.IMPRESSION = "AdImpression", t2.STARTED = "AdStarted", t2.FIRST_QUARTILE = "AdFirstQuartile", t2.MIDPOINT = "AdMidpoint", t2.THIRD_QUARTILE = "AdThirdQuartile", t2.AD_PROGRESS = "AdProgress", t2.COMPLETE = "AdComplete", t2.CLICK = "AdClick", t2.PAUSED = "AdPaused", t2.RESUMED = "AdResumed", t2.SKIPPED = "AdSkipped", t2.SKIPPABLE_STATE_CHANGED = "AdSkippableStateChanged", t2.VOLUME_CHANGED = "AdVolumeChanged", t2.VOLUME_MUTED = "AdMuted", t2.AD_METADATA = "AdMetadata", t2.AD_BREAK_READY = "AdBreakReady", t2.CONTENT_PAUSE_REQUESTED = "AdContentPauseRequested", t2.CONTENT_RESUME_REQUESTED = "AdContentResumeRequested", t2.ALL_ADS_COMPLETED = "AdAllAdsCompleted", t2.DURATION_CHANGE = "AdDurationChange", t2.INTERACTION = "AdInteraction", t2.LINEAR_CHANGED = "AdLinearChanged", t2.LOG = "AdLog", t2.USER_CLOSE = "AdUserClose", t2.AD_CAN_PLAY = "AdCanPlay", t2.EXPANDED_CHANGED = "AdExpandedChanged", t2.VIEWABLE_IMPRESSION = "AdViewableImpression"; -}(y || (y = {})); +})(y || (y = {})); var R = h({}, y, p), E = function() { this.disableCustomPlaybackForIOS10Plus = false, this.autoResize = true, this.clickTrackingElement = void 0; -}, T = function(t2) { +}, T = (function(t2) { function i2() { var i3; return (i3 = t2.call.apply(t2, [this].concat([].slice.call(arguments))) || this).errorCode = void 0, i3.innerError = void 0, i3.type = void 0, i3.vastErrorCode = void 0, i3; } return r(i2, t2), i2; -}(d(Error)); +})(d(Error)); T.ERROR_CODE_ADS_MANAGER_LOADED_TIMEOUT = 9e3, T.ERROR_CODE_REQUEST_ADS_TIMEOUT = 9001; -var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("adsRenderingSettings"), B = b("ima"), L = b("adDisplayContainer"), D = b("adsManager"), W = b("width"), _ = b("height"), q = b("adsLoader"), F = b("playerOptions"), N = b("resizeObserver"), V = b("currentAd"), G = b("loadedAd"), Q = b("mediaStartTriggered"), U = b("mediaImpressionTriggered"), z = b("mediaInActivation"), Z = b("customPlaybackTimeAdjustedOnEnded"), $ = b("cuePoints"), H = b("adCurrentTime"), J = b("adDuration"), K = b("startAdCallback"), X = b("adsManagerLoadedTimeout"), Y = b("requestAdsTimeout"), tt = b("wasExternallyPaused"), it = b("lastNonZeroAdVolume"), et = b("activatePromise"), nt = function(t2) { +var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("adsRenderingSettings"), B = b("ima"), L = b("adDisplayContainer"), D = b("adsManager"), W = b("width"), _ = b("height"), q = b("adsLoader"), F = b("playerOptions"), N = b("resizeObserver"), V = b("currentAd"), G = b("loadedAd"), Q = b("mediaStartTriggered"), U = b("mediaImpressionTriggered"), z = b("mediaInActivation"), Z = b("customPlaybackTimeAdjustedOnEnded"), $ = b("cuePoints"), H = b("adCurrentTime"), J = b("adDuration"), K = b("startAdCallback"), X = b("adsManagerLoadedTimeout"), Y = b("requestAdsTimeout"), tt = b("wasExternallyPaused"), it = b("lastNonZeroAdVolume"), et = b("activatePromise"), nt = (function(t2) { function i2(i3, e3, n2, s2, h2) { var r2; void 0 === s2 && (s2 = new i3.AdsRenderingSettings()), void 0 === h2 && (h2 = new E()), r2 = t2.call(this) || this, Object.defineProperty(l(r2), S, { writable: true, value: void 0 }), Object.defineProperty(l(r2), M, { writable: true, value: void 0 }), Object.defineProperty(l(r2), x, { writable: true, value: void 0 }), Object.defineProperty(l(r2), I, { writable: true, value: void 0 }), Object.defineProperty(l(r2), B, { writable: true, value: void 0 }), Object.defineProperty(l(r2), L, { writable: true, value: void 0 }), Object.defineProperty(l(r2), D, { writable: true, value: void 0 }), Object.defineProperty(l(r2), W, { writable: true, value: void 0 }), Object.defineProperty(l(r2), _, { writable: true, value: void 0 }), Object.defineProperty(l(r2), q, { writable: true, value: void 0 }), Object.defineProperty(l(r2), F, { writable: true, value: void 0 }), Object.defineProperty(l(r2), N, { writable: true, value: void 0 }), Object.defineProperty(l(r2), V, { writable: true, value: void 0 }), Object.defineProperty(l(r2), G, { writable: true, value: void 0 }), Object.defineProperty(l(r2), Q, { writable: true, value: false }), Object.defineProperty(l(r2), U, { writable: true, value: false }), Object.defineProperty(l(r2), z, { writable: true, value: false }), Object.defineProperty(l(r2), Z, { writable: true, value: false }), Object.defineProperty(l(r2), $, { writable: true, value: [] }), Object.defineProperty(l(r2), H, { writable: true, value: void 0 }), Object.defineProperty(l(r2), J, { writable: true, value: void 0 }), Object.defineProperty(l(r2), K, { writable: true, value: void 0 }), Object.defineProperty(l(r2), X, { writable: true, value: void 0 }), Object.defineProperty(l(r2), Y, { writable: true, value: void 0 }), Object.defineProperty(l(r2), tt, { writable: true, value: false }), Object.defineProperty(l(r2), it, { writable: true, value: 1 }), Object.defineProperty(l(r2), et, { writable: true, value: Promise.resolve() }), w(l(r2), S)[S] = e3, w(l(r2), M)[M] = n2, w(l(r2), B)[B] = i3, w(l(r2), F)[F] = h2, w(l(r2), I)[I] = s2, w(l(r2), I)[I].restoreCustomPlaybackStateOnAdBreakComplete = true, h2.disableCustomPlaybackForIOS10Plus && !w(l(r2), S)[S].hasAttribute("playsinline") && w(l(r2), S)[S].setAttribute("playsinline", ""), w(l(r2), B)[B].settings.setDisableCustomPlaybackForIOS10Plus(h2.disableCustomPlaybackForIOS10Plus), w(l(r2), x)[x] = new k(w(l(r2), S)[S]), r2.o = r2.o.bind(l(r2)), P.forEach(function(t3) { @@ -373,16 +373,16 @@ var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("a w(t3, U)[U] = false, w(t3, Q)[Q] = false, w(t3, Z)[Z] = false, t3.dispatchEvent(new O(R.MEDIA_STOP)); }, 1); }, e2.v = function(t3) { - for (var i3, e3 = function(t4, i4) { + for (var i3, e3 = (function(t4, i4) { var e4 = "undefined" != typeof Symbol && t4[Symbol.iterator] || t4["@@iterator"]; if (e4) return (e4 = e4.call(t4)).next.bind(e4); - if (Array.isArray(t4) || (e4 = function(t5, i5) { + if (Array.isArray(t4) || (e4 = (function(t5, i5) { if (t5) { if ("string" == typeof t5) return f(t5, i5); var e5 = Object.prototype.toString.call(t5).slice(8, -1); return "Object" === e5 && t5.constructor && (e5 = t5.constructor.name), "Map" === e5 || "Set" === e5 ? Array.from(t5) : "Arguments" === e5 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e5) ? f(t5, i5) : void 0; } - }(t4))) { + })(t4))) { e4 && (t4 = e4); var n3 = 0; return function() { @@ -390,7 +390,7 @@ var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("a }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - }(t3); !(i3 = e3()).done; ) { + })(t3); !(i3 = e3()).done; ) { var n2 = i3.value; n2.contentBoxSize && 1 === n2.contentBoxSize.length ? (w(this, W)[W] = n2.contentBoxSize[0].inlineSize, w(this, _)[_] = n2.contentBoxSize[0].blockSize) : n2.contentBoxSize && n2.contentBoxSize.inlineSize ? (w(this, W)[W] = n2.contentBoxSize.inlineSize, w(this, _)[_] = n2.contentBoxSize.blockSize) : (w(this, W)[W] = n2.contentRect.width, w(this, _)[_] = n2.contentRect.height); } @@ -435,7 +435,7 @@ var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("a } }, { key: "cuePoints", get: function() { return [].concat(w(this, $)[$]); } }]), i2; -}(C); +})(C); function createRequest(ima, field, value, config) { const request = new ima.AdsRequest(); request[field] = value; @@ -647,6 +647,7 @@ function artplayerPluginVast(callback) { } }; } +artplayerPluginVast.default = artplayerPluginVast; export { artplayerPluginVast as default }; diff --git a/package.json b/package.json index 52a174256..68a4bf55e 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "ci:build": "yarn build:types && yarn build all && yarn build:i18n && yarn build:ts && yarn build:llm && yarn build:test && yarn build:docs && yarn test:imports", "test:imports": "node --test test/esm.test.js test/i18n.test.js test/ssr.test.js test/asr-distribution.test.js", "typecheck": "node scripts/typecheck.mjs", - "test:unit": "node --test test/danmuku-setting.test.js test/danmuku-heatmap.test.js test/danmuku-renderer.test.js test/danmuku-scheduler.test.js test/danmuku-worker-client.test.js test/danmuku-input.test.js test/danmuku-parser.test.js test/danmuku-failures.test.js test/danmuku-mask-failures.test.js test/danmuku-mask-lifecycle.test.js test/asr-encoding.test.js test/asr-lifecycle.test.js test/asr-audio.test.js test/asr.test.js test/jassub.test.js test/jassub-registration.test.js test/jassub-runtime.test.js test/jassub-vendor-lifecycle.test.js test/jassub-frame-polyfill.test.js test/jassub-offscreen.test.js test/multiple-subtitles-ass.test.js test/multiple-subtitles-caption.test.js test/multiple-subtitles-merge.test.js test/multiple-subtitles-entities.test.js test/multiple-subtitles-lifecycle.test.js test/multiple-subtitles-failures.test.js test/multiple-subtitles.test.js test/multiple-subtitles-vendor.test.js test/vtt-thumbnail-parser.test.js test/vtt-thumbnail-lifecycle.test.js test/vtt-thumbnail.test.js test/auto-thumbnail-exports.test.js test/auto-thumbnail-canvas.test.js test/auto-thumbnail-frames.test.js test/auto-thumbnail-encoding.test.js test/auto-thumbnail-lifecycle.test.js test/auto-thumbnail.test.js test/thumbnail-emitter.test.js test/thumbnail-runtime.test.js test/thumbnail-vendor.test.js test/thumbnail-lifecycle.test.js test/thumbnail-input.test.js test/thumbnail.test.js test/iframe-navigation.test.js test/iframe-boundaries.test.js test/iframe-lifecycle.test.js test/iframe.test.js test/mediabunny.test.js test/mediabunny-shim.test.js test/mediabunny-coordination.test.js test/mediabunny-video.test.js test/mediabunny-audio.test.js test/mediabunny-hls.test.js test/mediabunny-entry.test.js test/mediabunny-capability.test.js test/mediabunny-load.test.js test/mediabunny-input.test.js test/dpip.test.js test/dpip-lifecycle.test.js test/canvas.test.js test/canvas-lifecycle.test.js test/ambilight.test.js test/ambilight-lifecycle.test.js test/ambilight-proxy.test.js test/vast.test.js test/vast-lifecycle.test.js test/ads.test.js test/ads-lifecycle.test.js test/playback.test.js test/dash-control.test.js test/dash-contract.test.js test/dash-lifecycle.test.js test/dash-events.test.js test/hls-control.test.js test/audio-track.test.js test/public-behavior.test.js test/helpers.test.js test/chapter.test.js test/utils.test.js test/resource-scope.test.js test/instance-lifecycle.test.js test/options.test.js test/media-hosts.test.js test/plugins.test.js test/source.test.js test/playback-properties.test.js test/media-events.test.js test/template-resources.test.js test/core-vendor.test.js test/component-resources.test.js test/setting-model.test.js test/setting-layout.test.js test/setting-resources.test.js test/subtitle.test.js test/display-native.test.js test/display-video-fullscreen.test.js test/display-pip.test.js test/display-mini.test.js test/display-sizing.test.js test/display-orientation.test.js test/hotkey.test.js test/listener-registry.test.js test/global-events.test.js test/pointer-events.test.js test/gesture.test.js test/event-scheduling.test.js test/notice.test.js test/fast-forward.test.js test/auto-playback.test.js test/builtin-layers.test.js test/prompt-components.test.js test/screenshot.test.js test/thumbnails.test.js test/progress.test.js test/environment.test.js test/storage.test.js test/facade-properties.test.js test/dom-boundaries.test.js test/initialization.test.js test/entry.test.js test/accessibility-button.test.js test/accessibility-focus.test.js test/accessibility-slider.test.js test/asr-fallback-routing.test.js test/asr-local-example.test.js test/asr-explicit-capture.test.js test/chromecast.test.js test/chromecast-failures.test.js test/chromecast-runtime.test.js", + "test:unit": "node --test test/danmuku-setting.test.js test/danmuku-heatmap.test.js test/danmuku-renderer.test.js test/danmuku-scheduler.test.js test/danmuku-worker-client.test.js test/danmuku-input.test.js test/danmuku-parser.test.js test/danmuku-failures.test.js test/danmuku-mask-failures.test.js test/danmuku-mask-lifecycle.test.js test/asr-encoding.test.js test/asr-lifecycle.test.js test/asr-audio.test.js test/asr.test.js test/jassub.test.js test/jassub-registration.test.js test/jassub-runtime.test.js test/jassub-vendor-lifecycle.test.js test/jassub-frame-polyfill.test.js test/jassub-offscreen.test.js test/multiple-subtitles-ass.test.js test/multiple-subtitles-caption.test.js test/multiple-subtitles-merge.test.js test/multiple-subtitles-entities.test.js test/multiple-subtitles-lifecycle.test.js test/multiple-subtitles-failures.test.js test/multiple-subtitles.test.js test/multiple-subtitles-vendor.test.js test/vtt-thumbnail-parser.test.js test/vtt-thumbnail-lifecycle.test.js test/vtt-thumbnail.test.js test/auto-thumbnail-exports.test.js test/auto-thumbnail-canvas.test.js test/auto-thumbnail-frames.test.js test/auto-thumbnail-encoding.test.js test/auto-thumbnail-lifecycle.test.js test/auto-thumbnail.test.js test/thumbnail-emitter.test.js test/thumbnail-runtime.test.js test/thumbnail-vendor.test.js test/thumbnail-lifecycle.test.js test/thumbnail-input.test.js test/thumbnail.test.js test/iframe-navigation.test.js test/iframe-boundaries.test.js test/iframe-lifecycle.test.js test/iframe.test.js test/mediabunny.test.js test/mediabunny-shim.test.js test/mediabunny-coordination.test.js test/mediabunny-video.test.js test/mediabunny-audio.test.js test/mediabunny-hls.test.js test/mediabunny-entry.test.js test/mediabunny-capability.test.js test/mediabunny-load.test.js test/mediabunny-input.test.js test/dpip.test.js test/dpip-lifecycle.test.js test/canvas.test.js test/canvas-lifecycle.test.js test/ambilight.test.js test/ambilight-lifecycle.test.js test/ambilight-proxy.test.js test/vast-exports.test.js test/vast.test.js test/vast-lifecycle.test.js test/ads.test.js test/ads-lifecycle.test.js test/playback.test.js test/dash-control.test.js test/dash-contract.test.js test/dash-lifecycle.test.js test/dash-events.test.js test/hls-control.test.js test/audio-track.test.js test/public-behavior.test.js test/helpers.test.js test/chapter.test.js test/utils.test.js test/resource-scope.test.js test/instance-lifecycle.test.js test/options.test.js test/media-hosts.test.js test/plugins.test.js test/source.test.js test/playback-properties.test.js test/media-events.test.js test/template-resources.test.js test/core-vendor.test.js test/component-resources.test.js test/setting-model.test.js test/setting-layout.test.js test/setting-resources.test.js test/subtitle.test.js test/display-native.test.js test/display-video-fullscreen.test.js test/display-pip.test.js test/display-mini.test.js test/display-sizing.test.js test/display-orientation.test.js test/hotkey.test.js test/listener-registry.test.js test/global-events.test.js test/pointer-events.test.js test/gesture.test.js test/event-scheduling.test.js test/notice.test.js test/fast-forward.test.js test/auto-playback.test.js test/builtin-layers.test.js test/prompt-components.test.js test/screenshot.test.js test/thumbnails.test.js test/progress.test.js test/environment.test.js test/storage.test.js test/facade-properties.test.js test/dom-boundaries.test.js test/initialization.test.js test/entry.test.js test/accessibility-button.test.js test/accessibility-focus.test.js test/accessibility-slider.test.js test/asr-fallback-routing.test.js test/asr-local-example.test.js test/asr-explicit-capture.test.js test/chromecast.test.js test/chromecast-failures.test.js test/chromecast-runtime.test.js", "test:coverage": "node --test test/coverage.test.js && node scripts/coverage.mjs", "test": "yarn test:node && yarn test:baseline", "test:browser": "playwright test", @@ -66,7 +66,7 @@ "test:dash-types-package": "node refactor/scripts/dash-package-types.mjs", "test:ads-types-package": "node refactor/scripts/ads-package-types.mjs", "test:ads-native-visibility": "node refactor/scripts/ads-native-visibility.mjs", - "test:vast": "node --test test/vast.test.js test/vast-lifecycle.test.js", + "test:vast": "node --test test/vast-exports.test.js test/vast.test.js test/vast-lifecycle.test.js", "check:commits": "node refactor/scripts/commit-audit.mjs", "check:impact": "node refactor/scripts/impact.mjs", "check:contracts": "node refactor/scripts/contracts.mjs", diff --git a/packages/artplayer-plugin-vast/ARCHITECTURE.md b/packages/artplayer-plugin-vast/ARCHITECTURE.md index f38d29a3d..53d470067 100644 --- a/packages/artplayer-plugin-vast/ARCHITECTURE.md +++ b/packages/artplayer-plugin-vast/ARCHITECTURE.md @@ -7,6 +7,8 @@ initialization conflict remains open; this checkpoint is not release acceptance. - `src/index.ts` owns the core destroy subscription before SDK loading begins, awaits SDK loading and the user callback, and preserves original rejection values. + Its writable `.default` self-reference retains historical CommonJS default calls + alongside the current direct factory. It does not wrap registration or load IMA. - `src/sdk.ts` is the only runtime Glomex import boundary. It also constructs IMA requests, preserving own/inherited configuration fields and primary-field overrides. - `src/session.ts` owns one current SDK/container pair, the four ad-event subscriptions, @@ -50,7 +52,9 @@ it finishes. SDK content pause/resume behavior is not duplicated in this wrapper The checkpoint retains the workspace callback order, lazy initialization, mutable settings/options identities, default flags, void request methods, and asynchronous -outer attachment. The historical namespace export, `id`/`$container` aliases, eager +outer attachment. The old `require(...).default(...)` call is restored, while the +current callable export remains callable. This does not recreate the old namespace +object's reflection shape. The `id`/`$container` aliases, eager published initialization and contradictory public return types are not yet reconciled. See [the explicit decision](../../refactor/vast-compatibility-decision.md). @@ -70,6 +74,13 @@ browser wrapper tests substitute only the Glomex SDK boundary. They cover curren frozen historical sources, real core5.1.7/5.4.1/candidate registration, real DOM and main-video decoding; they do not certify Google IMA ads or final npm distribution. +`test/vast-exports.test.js` exercises bundled CommonJS/global/AMD and native ESM +import, using an already destroyed host to verify registration without loading ads. +Set `ARTPLAYER_VAST_ARTIFACT` and `ARTPLAYER_VAST_ESM_ARTIFACT` to test actual build +files; otherwise it builds source via the repository helper. The live alias path +uses the controlled SDK in `test/vast.test.js` and the browser registration case. +Public alias declarations and complete installed entry validation remain04/06. + For state or cleanup changes start in session, for callback timing in entry, and for SDK request fields in sdk. Keep Node candidate assertions, historical observations, browser counterparts and [test maintenance](../../refactor/vast-validation.md) aligned. diff --git a/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.js b/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.js index 78add96cd..584b1ee3a 100644 --- a/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.js +++ b/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.js @@ -4,4 +4,4 @@ * (c) 2017-2026 Harvey Zhao * Released under the MIT License. */ -!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.artplayerPluginVast=e(),define(function(){return t.artplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).artplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i-1&&(f(this,Q)[Q].splice(e,1),this.g(f(this,Q)[Q]))},n.resizeAd=function(t,e){f(this,j)[j]=t,f(this,N)[N]=e,f(this,M)[M]&&f(this,M)[M].resize(t,e,this.k()),f(this,_)[_].style.width=t+"px",f(this,_)[_].style.height=e+"px"},n.reset=function(t){void 0===t&&(t=!1),t&&(f(this,F)[F]=!1,f(this,G)[G]=!1,f(this,W)[W]=!1),this.C(),f(this,Q)[Q]=[],f(this,Z)[Z]=!1,f(this,$)[$]=void 0,f(this,M)[M]&&f(this,M)[M].destroy(),f(this,M)[M]=void 0,f(this,I)[I].settings.setAutoPlayAdBreaks(!0),t&&this.P(),f(this,_)[_].style.display="none"},n.P=function(){f(this,U)[U]&&(f(this,U)[U].removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),f(this,U)[U].removeEventListener(f(this,I)[I].AdErrorEvent.Type.AD_ERROR,this.l,!1),f(this,U)[U].destroy()),f(this,L)[L]&&f(this,L)[L].destroy()},n.destroy=function(){var t,e,i,n,r=this;this.reset(!0),f(this,C)[C].destroy(),T.forEach(function(t){f(r,D)[D].removeEventListener(t,r.o)}),null==(t=f(this,U)[U])||t.removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(e=f(this,L)[L])||e.destroy(),null==(i=f(this,U)[U])||i.destroy(),f(this,F)[F]=!1,f(this,W)[W]=!1,f(this,G)[G]=!1,null==(n=f(this,B)[B])||n.disconnect()},n.isCustomPlaybackUsed=function(){return!1===f(this,I)[I].settings.getDisableCustomPlaybackForIOS10Plus()&&!f(this,_)[_].querySelector("video")},n.C=function(){window.clearTimeout(f(this,Y)[Y]),window.clearTimeout(f(this,X)[X]),f(this,Y)[Y]=void 0,f(this,X)[X]=void 0,f(this,V)[V]=void 0,f(this,q)[q]=void 0,f(this,K)[K]=void 0,f(this,_)[_].style.display="none",f(this,_)[_].classList.remove("nonlinear"),f(this,M)[M]&&this.R()},n.o=function(t){var e=this;if(f(this,C)[C].enabled||"volumechange"===t.type){if("timeupdate"===t.type){if(f(this,M)[M]){var i=f(this,M)[M].getCuePoints().filter(function(t){return t>=0&&t=.5&&(this.dispatchEvent(new A(R.MEDIA_IMPRESSION)),f(this,F)[F]=!0)}if("play"!==t.type||f(this,G)[G]||f(this,H)[H]||(this.dispatchEvent(new A(R.MEDIA_START)),f(this,G)[G]=!0),"ended"===t.type&&(this.isCustomPlaybackUsed()&&f(this,D)[D].currentTime===f(this,D)[D].duration&&f(this,Q)[Q].indexOf(-1)>-1&&(f(this,D)[D].currentTime=f(this,D)[D].duration-1e-5,f(this,W)[W]=!0),f(this,U)[U].contentComplete(),f(this,M)[M]||this.T()),!window.ResizeObserver&&f(this,z)[z].autoResize&&"loadedmetadata"===t.type){var n=f(this,D)[D],r=n.offsetHeight,s=n.offsetWidth;f(this,j)[j]=s,f(this,N)[N]=r,this.R()}f(this,H)[H]&&"volumechange"!==t.type||this.dispatchEvent(new A(t.type))}},n.S=function(t){var e=this,i=f(this,I)[I].AdEvent;switch(t.type){case i.Type.LOADED:var n=t.getAd();f(this,$)[$]&&0===f(this,Q)[Q].length?f(this,$)[$]({ad:n,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}):f(this,x)[x]=n;break;case i.Type.AD_BREAK_READY:this.C(),f(this,$)[$]?(f(this,$)[$]({ad:f(this,x)[x],adBreakTime:t.getAdData().adBreakTime,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}),f(this,x)[x]=void 0):this.M();break;case i.Type.STARTED:var r=f(this,V)[V]=t.getAd();r.getAdPodInfo().getAdPosition()>1&&f(this,M)[M].setVolume(f(this,M)[M].getVolume()),f(this,_)[_].classList.remove("nonlinear"),this.R(),r.isLinear()?(f(this,C)[C].disable(),f(this,K)[K]=r.getDuration(),f(this,q)[q]=0):(f(this,_)[_].classList.add("nonlinear"),this.I()),f(this,_)[_].style.display="",f(this,Z)[Z]&&(f(this,Z)[Z]=!1,f(this,M)[M].pause());break;case i.Type.ALL_ADS_COMPLETED:if(f(this,W)[W])return;this.isCustomPlaybackUsed()&&Boolean(f(this,V)[V])&&-1!==f(this,V)[V].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),f(this,V)[V]=t.getAd(),f(this,_)[_].style.display="",f(this,D)[D].pause(),this.R(),f(this,V)[V]&&this.A(f(this,V)[V].getAdPodInfo().getTimeOffset()),f(this,M)[M].setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),f(this,C)[C].disable(),f(this,K)[K]=f(this,V)[V].getDuration(),f(this,q)[q]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=Boolean(f(this,V)[V]);if(s){var o=f(this,M)[M].getVolume();f(this,D)[D].muted=0===o,f(this,D)[D].volume=f(this,J)[J]}f(this,W)[W]&&(f(this,D)[D].currentTime=f(this,D)[D].duration+1,f(this,W)[W]=!1),f(this,D)[D].ended?(this.reset(),this.T()):this.C(),s&&(f(this,Z)[Z]=!1,this.I());break;case i.Type.AD_METADATA:this.g(f(this,M)[M].getCuePoints()),-1===f(this,Q)[Q].indexOf(0)&&(f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=t.getAdData();f(this,q)[q]=a.currentTime,f(this,K)[K]=a.duration;break;case i.Type.LOG:var u=t.getAdData();f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):u.adError&&!f(this,V)[V]&&this.I();break;case i.Type.VOLUME_CHANGED:var h=f(this,M)[M].getVolume();h>0&&(f(this,J)[J]=h)}},n.l=function(t){this.j(this.B(t))},n.u=function(t){var e=this,i=f(this,I)[I],n=i.AdEvent,r=i.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(f(this,Y)[Y]);var s=f(this,M)[M]=t.getAdsManager(f(this,C)[C],f(this,k)[k]);Object.keys(n.Type).forEach(function(t){s.addEventListener(n.Type[t],function(i){if(e.S(i),R[t]){var n=["LOG","AD_PROGRESS"].indexOf(t)>-1;e.dispatchEvent(new A(R[t],{detail:{ad:i.getAd()||f(e,V)[V],adData:n?i.getAdData():{}}}))}})}),s.addEventListener(r,function(t){return e.j(e.B(t))});try{var o;s.init(f(this,j)[j],f(this,N)[N],this.k()),s.setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),null==(o=f(this,L)[L])||o.initialize(),f(this,$)[$]||this.M()}catch(a){this.j(new S(a.message))}},n.M=function(){if(f(this,G)[G]||(this.dispatchEvent(new A(R.MEDIA_START)),f(this,G)[G]=!0),f(this,M)[M])try{f(this,M)[M].start()}catch(t){this.j(new S(t.message))}else this.I()},n.T=function(){var t=this;setTimeout(function(){f(t,F)[F]=!1,f(t,G)[G]=!1,f(t,W)[W]=!1,t.dispatchEvent(new A(R.MEDIA_STOP))},1)},n.v=function(t){for(var e,i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?d(t,e):void 0}}(t))){e&&(t=e);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(e=i()).done;){var n=e.value;n.contentBoxSize&&1===n.contentBoxSize.length?(f(this,j)[j]=n.contentBoxSize[0].inlineSize,f(this,N)[N]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(f(this,j)[j]=n.contentBoxSize.inlineSize,f(this,N)[N]=n.contentBoxSize.blockSize):(f(this,j)[j]=n.contentRect.width,f(this,N)[N]=n.contentRect.height)}this.R()},n.R=function(){if(f(this,z)[z].autoResize&&f(this,M)[M]){var t=f(this,V)[V],e=this.k();t&&!t.isLinear()?t&&(t.getWidth()>f(this,j)[j]||t.getHeight()>f(this,N)[N]?this.resizeAd(f(this,j)[j],f(this,N)[N]):(f(this,M)[M].resize(t.getWidth(),t.getHeight()+20,e),f(this,_)[_].style.width=t.getWidth()+"px",f(this,_)[_].style.height=t.getHeight()+20+"px")):this.resizeAd(f(this,j)[j],f(this,N)[N])}},n.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||f(this,D)[D].webkitDisplayingFullscreen?f(this,I)[I].ViewMode.FULLSCREEN:f(this,I)[I].ViewMode.NORMAL},n.I=function(){var t=this;f(this,_)[_].style.display="none",f(this,D)[D].ended||(f(this,C)[C].enable(),f(this,Z)[Z]?(f(this,D)[D].pause(),this.dispatchEvent(new A("pause"))):(this.p().then(function(){}).catch(function(){t.dispatchEvent(new A("pause"))}),this.dispatchEvent(new A("play")),this.dispatchEvent(new A(R.MEDIA_RESUMED))),f(this,Z)[Z]=!1)},n.B=function(t){var e=t.getError(),i=new S(e.getMessage());return i.type=e.getType(),i.errorCode=e.getErrorCode(),i.vastErrorCode=e.getVastErrorCode&&e.getVastErrorCode(),i.innerError=e.getInnerError(),i},n.j=function(t){var e=this;this.dispatchEvent(new A(R.AD_ERROR,{detail:{error:t}})),this.C(),f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I()},i(e,[{key:"volume",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?f(this,M)[M].getVolume():f(this,D)[D].volume},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t),f(this,D)[D].volume=t}},{key:"muted",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?0===f(this,M)[M].getVolume():f(this,D)[D].muted},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t?0:f(this,J)[J]),f(this,D)[D].muted=t}},{key:"currentTime",get:function(){return void 0!==f(this,q)[q]?f(this,q)[q]:f(this,D)[D].currentTime},set:function(t){f(this,C)[C].enabled&&(f(this,D)[D].currentTime=t)}},{key:"duration",get:function(){return void 0!==f(this,K)[K]?f(this,K)[K]:f(this,D)[D].duration}},{key:"cuePoints",get:function(){return[].concat(f(this,Q)[Q])}}]),e}(w);let it=0;function nt(t){const e=t.createElement("div");return e.id=`art-vast-${Date.now()}-${++it}`,t.setStyles(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),e}return function(i){return async n=>{let r,s=!1;const o=()=>s||n.isDestroy,a={name:"artplayerPluginVast",destroy:()=>r?.destroy()};function u(){if(!s){s=!0;try{n.off("destroy",u)}finally{r?.destroy()}}}if(o())return a;n.on("destroy",u);try{if(o())return a;const s=await function(){var i=window;return i.google&&i.google.ima?Promise.resolve(i.google.ima):t||((t=new Promise(function(t,e){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=t,i.onerror=e,document.body.appendChild(i)}).then(function(){return i.google.ima})).then(e).catch(e),t)}();if(o())return a;const h=n.constructor.utils;return r=function(t,e,i,n){const{$video:r,$player:s}=t.template,o=new e.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.enablePreloading=!0;const a=new P;let u=null,h=!1,d=0;const l=t=>u===t&&!t.released&&!n();function c(t){u===t&&(u=null),t.released=!0,t.playing=!1;const e=t.player;t.player=null;const i=t.listeners.splice(0);let n,r=!1;const s=t=>{try{t()}catch(e){r?console.error("VAST cleanup error:",e):(r=!0,n=e)}};d++;try{if(e){for(const[t,n]of i)s(()=>e.removeEventListener(t,n));s(()=>e.destroy())}s(()=>{t.container.parentNode&&t.container.parentNode.removeChild(t.container)})}finally{d--}if(r)throw n}function f(){if(n()||d)return null;if(h)throw new Error("VAST initialization is already in progress");if(u?.player)return u.player;let t;h=!0;try{if(t={container:nt(i),player:null,listeners:[],playing:!1,released:!1},u=t,!l(t))return c(t),null;if(s.appendChild(t.container),!l(t))return c(t),null;if(t.player=new et(e,r,t.container,o,a),!l(t))return c(t),null;const n=t;for(const[e,i]of[["AdContentPauseRequested",!0],["AdContentResumeRequested",!1],["AdStarted",!0],["AdError",!1]]){const r=t=>{l(n)&&("AdError"===e&&console.error("VAST Ad Error:",t.detail),n.playing=i,n.container.style.display=i?"block":"none")};if(t.listeners.push([e,r]),t.player.addEventListener(e,r),!l(t))return c(t),null}return t.player}catch(f){if(t)try{c(t)}catch(p){console.error("VAST cleanup error:",p)}throw f}finally{h=!1}}function p(t,i,r){if(n()||u?.playing)return;const s=f(),o=u;if(!s||!o)return;const a=function(t,e,i,n){const r=new t.AdsRequest;r[e]=i;const s=r;for(const o in n)s[o]=n[o];return r}(e,t,i,r);l(o)&&o.player===s&&s.playAds(a)}return{context:{art:t,playUrl:(t,e={})=>p("adTagUrl",t,e),playRes:(t,e={})=>p("adsResponse",t,e),init:f,ima:e,adsRenderingSettings:o,playerOptions:a,get imaPlayer(){return u?.player||null},get container(){return u?.container||null}},destroy:function(){u&&c(u)}}}(n,s,h,o),o()?(u(),a):("function"===typeof i&&await i(r.context),a)}catch(h){try{u()}catch(d){console.error("VAST cleanup error:",d)}throw h}}}}); +!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.artplayerPluginVast=e(),define(function(){return t.artplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).artplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i-1&&(f(this,Q)[Q].splice(e,1),this.g(f(this,Q)[Q]))},n.resizeAd=function(t,e){f(this,j)[j]=t,f(this,N)[N]=e,f(this,M)[M]&&f(this,M)[M].resize(t,e,this.k()),f(this,_)[_].style.width=t+"px",f(this,_)[_].style.height=e+"px"},n.reset=function(t){void 0===t&&(t=!1),t&&(f(this,F)[F]=!1,f(this,G)[G]=!1,f(this,W)[W]=!1),this.C(),f(this,Q)[Q]=[],f(this,Z)[Z]=!1,f(this,$)[$]=void 0,f(this,M)[M]&&f(this,M)[M].destroy(),f(this,M)[M]=void 0,f(this,I)[I].settings.setAutoPlayAdBreaks(!0),t&&this.P(),f(this,_)[_].style.display="none"},n.P=function(){f(this,U)[U]&&(f(this,U)[U].removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),f(this,U)[U].removeEventListener(f(this,I)[I].AdErrorEvent.Type.AD_ERROR,this.l,!1),f(this,U)[U].destroy()),f(this,L)[L]&&f(this,L)[L].destroy()},n.destroy=function(){var t,e,i,n,r=this;this.reset(!0),f(this,C)[C].destroy(),T.forEach(function(t){f(r,D)[D].removeEventListener(t,r.o)}),null==(t=f(this,U)[U])||t.removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(e=f(this,L)[L])||e.destroy(),null==(i=f(this,U)[U])||i.destroy(),f(this,F)[F]=!1,f(this,W)[W]=!1,f(this,G)[G]=!1,null==(n=f(this,B)[B])||n.disconnect()},n.isCustomPlaybackUsed=function(){return!1===f(this,I)[I].settings.getDisableCustomPlaybackForIOS10Plus()&&!f(this,_)[_].querySelector("video")},n.C=function(){window.clearTimeout(f(this,Y)[Y]),window.clearTimeout(f(this,X)[X]),f(this,Y)[Y]=void 0,f(this,X)[X]=void 0,f(this,V)[V]=void 0,f(this,q)[q]=void 0,f(this,K)[K]=void 0,f(this,_)[_].style.display="none",f(this,_)[_].classList.remove("nonlinear"),f(this,M)[M]&&this.R()},n.o=function(t){var e=this;if(f(this,C)[C].enabled||"volumechange"===t.type){if("timeupdate"===t.type){if(f(this,M)[M]){var i=f(this,M)[M].getCuePoints().filter(function(t){return t>=0&&t=.5&&(this.dispatchEvent(new A(R.MEDIA_IMPRESSION)),f(this,F)[F]=!0)}if("play"!==t.type||f(this,G)[G]||f(this,H)[H]||(this.dispatchEvent(new A(R.MEDIA_START)),f(this,G)[G]=!0),"ended"===t.type&&(this.isCustomPlaybackUsed()&&f(this,D)[D].currentTime===f(this,D)[D].duration&&f(this,Q)[Q].indexOf(-1)>-1&&(f(this,D)[D].currentTime=f(this,D)[D].duration-1e-5,f(this,W)[W]=!0),f(this,U)[U].contentComplete(),f(this,M)[M]||this.T()),!window.ResizeObserver&&f(this,z)[z].autoResize&&"loadedmetadata"===t.type){var n=f(this,D)[D],r=n.offsetHeight,s=n.offsetWidth;f(this,j)[j]=s,f(this,N)[N]=r,this.R()}f(this,H)[H]&&"volumechange"!==t.type||this.dispatchEvent(new A(t.type))}},n.S=function(t){var e=this,i=f(this,I)[I].AdEvent;switch(t.type){case i.Type.LOADED:var n=t.getAd();f(this,$)[$]&&0===f(this,Q)[Q].length?f(this,$)[$]({ad:n,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}):f(this,x)[x]=n;break;case i.Type.AD_BREAK_READY:this.C(),f(this,$)[$]?(f(this,$)[$]({ad:f(this,x)[x],adBreakTime:t.getAdData().adBreakTime,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}),f(this,x)[x]=void 0):this.M();break;case i.Type.STARTED:var r=f(this,V)[V]=t.getAd();r.getAdPodInfo().getAdPosition()>1&&f(this,M)[M].setVolume(f(this,M)[M].getVolume()),f(this,_)[_].classList.remove("nonlinear"),this.R(),r.isLinear()?(f(this,C)[C].disable(),f(this,K)[K]=r.getDuration(),f(this,q)[q]=0):(f(this,_)[_].classList.add("nonlinear"),this.I()),f(this,_)[_].style.display="",f(this,Z)[Z]&&(f(this,Z)[Z]=!1,f(this,M)[M].pause());break;case i.Type.ALL_ADS_COMPLETED:if(f(this,W)[W])return;this.isCustomPlaybackUsed()&&Boolean(f(this,V)[V])&&-1!==f(this,V)[V].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),f(this,V)[V]=t.getAd(),f(this,_)[_].style.display="",f(this,D)[D].pause(),this.R(),f(this,V)[V]&&this.A(f(this,V)[V].getAdPodInfo().getTimeOffset()),f(this,M)[M].setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),f(this,C)[C].disable(),f(this,K)[K]=f(this,V)[V].getDuration(),f(this,q)[q]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=Boolean(f(this,V)[V]);if(s){var o=f(this,M)[M].getVolume();f(this,D)[D].muted=0===o,f(this,D)[D].volume=f(this,J)[J]}f(this,W)[W]&&(f(this,D)[D].currentTime=f(this,D)[D].duration+1,f(this,W)[W]=!1),f(this,D)[D].ended?(this.reset(),this.T()):this.C(),s&&(f(this,Z)[Z]=!1,this.I());break;case i.Type.AD_METADATA:this.g(f(this,M)[M].getCuePoints()),-1===f(this,Q)[Q].indexOf(0)&&(f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=t.getAdData();f(this,q)[q]=a.currentTime,f(this,K)[K]=a.duration;break;case i.Type.LOG:var u=t.getAdData();f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):u.adError&&!f(this,V)[V]&&this.I();break;case i.Type.VOLUME_CHANGED:var h=f(this,M)[M].getVolume();h>0&&(f(this,J)[J]=h)}},n.l=function(t){this.j(this.B(t))},n.u=function(t){var e=this,i=f(this,I)[I],n=i.AdEvent,r=i.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(f(this,Y)[Y]);var s=f(this,M)[M]=t.getAdsManager(f(this,C)[C],f(this,k)[k]);Object.keys(n.Type).forEach(function(t){s.addEventListener(n.Type[t],function(i){if(e.S(i),R[t]){var n=["LOG","AD_PROGRESS"].indexOf(t)>-1;e.dispatchEvent(new A(R[t],{detail:{ad:i.getAd()||f(e,V)[V],adData:n?i.getAdData():{}}}))}})}),s.addEventListener(r,function(t){return e.j(e.B(t))});try{var o;s.init(f(this,j)[j],f(this,N)[N],this.k()),s.setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),null==(o=f(this,L)[L])||o.initialize(),f(this,$)[$]||this.M()}catch(a){this.j(new S(a.message))}},n.M=function(){if(f(this,G)[G]||(this.dispatchEvent(new A(R.MEDIA_START)),f(this,G)[G]=!0),f(this,M)[M])try{f(this,M)[M].start()}catch(t){this.j(new S(t.message))}else this.I()},n.T=function(){var t=this;setTimeout(function(){f(t,F)[F]=!1,f(t,G)[G]=!1,f(t,W)[W]=!1,t.dispatchEvent(new A(R.MEDIA_STOP))},1)},n.v=function(t){for(var e,i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?d(t,e):void 0}}(t))){e&&(t=e);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(e=i()).done;){var n=e.value;n.contentBoxSize&&1===n.contentBoxSize.length?(f(this,j)[j]=n.contentBoxSize[0].inlineSize,f(this,N)[N]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(f(this,j)[j]=n.contentBoxSize.inlineSize,f(this,N)[N]=n.contentBoxSize.blockSize):(f(this,j)[j]=n.contentRect.width,f(this,N)[N]=n.contentRect.height)}this.R()},n.R=function(){if(f(this,z)[z].autoResize&&f(this,M)[M]){var t=f(this,V)[V],e=this.k();t&&!t.isLinear()?t&&(t.getWidth()>f(this,j)[j]||t.getHeight()>f(this,N)[N]?this.resizeAd(f(this,j)[j],f(this,N)[N]):(f(this,M)[M].resize(t.getWidth(),t.getHeight()+20,e),f(this,_)[_].style.width=t.getWidth()+"px",f(this,_)[_].style.height=t.getHeight()+20+"px")):this.resizeAd(f(this,j)[j],f(this,N)[N])}},n.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||f(this,D)[D].webkitDisplayingFullscreen?f(this,I)[I].ViewMode.FULLSCREEN:f(this,I)[I].ViewMode.NORMAL},n.I=function(){var t=this;f(this,_)[_].style.display="none",f(this,D)[D].ended||(f(this,C)[C].enable(),f(this,Z)[Z]?(f(this,D)[D].pause(),this.dispatchEvent(new A("pause"))):(this.p().then(function(){}).catch(function(){t.dispatchEvent(new A("pause"))}),this.dispatchEvent(new A("play")),this.dispatchEvent(new A(R.MEDIA_RESUMED))),f(this,Z)[Z]=!1)},n.B=function(t){var e=t.getError(),i=new S(e.getMessage());return i.type=e.getType(),i.errorCode=e.getErrorCode(),i.vastErrorCode=e.getVastErrorCode&&e.getVastErrorCode(),i.innerError=e.getInnerError(),i},n.j=function(t){var e=this;this.dispatchEvent(new A(R.AD_ERROR,{detail:{error:t}})),this.C(),f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I()},i(e,[{key:"volume",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?f(this,M)[M].getVolume():f(this,D)[D].volume},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t),f(this,D)[D].volume=t}},{key:"muted",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?0===f(this,M)[M].getVolume():f(this,D)[D].muted},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t?0:f(this,J)[J]),f(this,D)[D].muted=t}},{key:"currentTime",get:function(){return void 0!==f(this,q)[q]?f(this,q)[q]:f(this,D)[D].currentTime},set:function(t){f(this,C)[C].enabled&&(f(this,D)[D].currentTime=t)}},{key:"duration",get:function(){return void 0!==f(this,K)[K]?f(this,K)[K]:f(this,D)[D].duration}},{key:"cuePoints",get:function(){return[].concat(f(this,Q)[Q])}}]),e}(w);let it=0;function nt(t){const e=t.createElement("div");return e.id=`art-vast-${Date.now()}-${++it}`,t.setStyles(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),e}function rt(i){return async n=>{let r,s=!1;const o=()=>s||n.isDestroy,a={name:"artplayerPluginVast",destroy:()=>r?.destroy()};function u(){if(!s){s=!0;try{n.off("destroy",u)}finally{r?.destroy()}}}if(o())return a;n.on("destroy",u);try{if(o())return a;const s=await function(){var i=window;return i.google&&i.google.ima?Promise.resolve(i.google.ima):t||((t=new Promise(function(t,e){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=t,i.onerror=e,document.body.appendChild(i)}).then(function(){return i.google.ima})).then(e).catch(e),t)}();if(o())return a;const h=n.constructor.utils;return r=function(t,e,i,n){const{$video:r,$player:s}=t.template,o=new e.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.enablePreloading=!0;const a=new P;let u=null,h=!1,d=0;const l=t=>u===t&&!t.released&&!n();function c(t){u===t&&(u=null),t.released=!0,t.playing=!1;const e=t.player;t.player=null;const i=t.listeners.splice(0);let n,r=!1;const s=t=>{try{t()}catch(e){r?console.error("VAST cleanup error:",e):(r=!0,n=e)}};d++;try{if(e){for(const[t,n]of i)s(()=>e.removeEventListener(t,n));s(()=>e.destroy())}s(()=>{t.container.parentNode&&t.container.parentNode.removeChild(t.container)})}finally{d--}if(r)throw n}function f(){if(n()||d)return null;if(h)throw new Error("VAST initialization is already in progress");if(u?.player)return u.player;let t;h=!0;try{if(t={container:nt(i),player:null,listeners:[],playing:!1,released:!1},u=t,!l(t))return c(t),null;if(s.appendChild(t.container),!l(t))return c(t),null;if(t.player=new et(e,r,t.container,o,a),!l(t))return c(t),null;const n=t;for(const[e,i]of[["AdContentPauseRequested",!0],["AdContentResumeRequested",!1],["AdStarted",!0],["AdError",!1]]){const r=t=>{l(n)&&("AdError"===e&&console.error("VAST Ad Error:",t.detail),n.playing=i,n.container.style.display=i?"block":"none")};if(t.listeners.push([e,r]),t.player.addEventListener(e,r),!l(t))return c(t),null}return t.player}catch(f){if(t)try{c(t)}catch(p){console.error("VAST cleanup error:",p)}throw f}finally{h=!1}}function p(t,i,r){if(n()||u?.playing)return;const s=f(),o=u;if(!s||!o)return;const a=function(t,e,i,n){const r=new t.AdsRequest;r[e]=i;const s=r;for(const o in n)s[o]=n[o];return r}(e,t,i,r);l(o)&&o.player===s&&s.playAds(a)}return{context:{art:t,playUrl:(t,e={})=>p("adTagUrl",t,e),playRes:(t,e={})=>p("adsResponse",t,e),init:f,ima:e,adsRenderingSettings:o,playerOptions:a,get imaPlayer(){return u?.player||null},get container(){return u?.container||null}},destroy:function(){u&&c(u)}}}(n,s,h,o),o()?(u(),a):("function"===typeof i&&await i(r.context),a)}catch(h){try{u()}catch(d){console.error("VAST cleanup error:",d)}throw h}}}return rt.default=rt,rt}); diff --git a/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.legacy.js b/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.legacy.js index 08711d88e..504c05b1a 100644 --- a/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.legacy.js +++ b/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.legacy.js @@ -4,4 +4,4 @@ * (c) 2017-2026 Harvey Zhao * Released under the MIT License. */ -!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.artplayerPluginVast=e(),define(function(){return t.artplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).artplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i-1&&(f(this,Q)[Q].splice(e,1),this.g(f(this,Q)[Q]))},n.resizeAd=function(t,e){f(this,j)[j]=t,f(this,N)[N]=e,f(this,M)[M]&&f(this,M)[M].resize(t,e,this.k()),f(this,_)[_].style.width=t+"px",f(this,_)[_].style.height=e+"px"},n.reset=function(t){void 0===t&&(t=!1),t&&(f(this,F)[F]=!1,f(this,G)[G]=!1,f(this,W)[W]=!1),this.C(),f(this,Q)[Q]=[],f(this,Z)[Z]=!1,f(this,$)[$]=void 0,f(this,M)[M]&&f(this,M)[M].destroy(),f(this,M)[M]=void 0,f(this,I)[I].settings.setAutoPlayAdBreaks(!0),t&&this.P(),f(this,_)[_].style.display="none"},n.P=function(){f(this,U)[U]&&(f(this,U)[U].removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),f(this,U)[U].removeEventListener(f(this,I)[I].AdErrorEvent.Type.AD_ERROR,this.l,!1),f(this,U)[U].destroy()),f(this,L)[L]&&f(this,L)[L].destroy()},n.destroy=function(){var t,e,i,n,r=this;this.reset(!0),f(this,C)[C].destroy(),T.forEach(function(t){f(r,D)[D].removeEventListener(t,r.o)}),null==(t=f(this,U)[U])||t.removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(e=f(this,L)[L])||e.destroy(),null==(i=f(this,U)[U])||i.destroy(),f(this,F)[F]=!1,f(this,W)[W]=!1,f(this,G)[G]=!1,null==(n=f(this,B)[B])||n.disconnect()},n.isCustomPlaybackUsed=function(){return!1===f(this,I)[I].settings.getDisableCustomPlaybackForIOS10Plus()&&!f(this,_)[_].querySelector("video")},n.C=function(){window.clearTimeout(f(this,Y)[Y]),window.clearTimeout(f(this,X)[X]),f(this,Y)[Y]=void 0,f(this,X)[X]=void 0,f(this,x)[x]=void 0,f(this,q)[q]=void 0,f(this,K)[K]=void 0,f(this,_)[_].style.display="none",f(this,_)[_].classList.remove("nonlinear"),f(this,M)[M]&&this.R()},n.o=function(t){var e=this;if(f(this,C)[C].enabled||"volumechange"===t.type){if("timeupdate"===t.type){if(f(this,M)[M]){var i=f(this,M)[M].getCuePoints().filter(function(t){return t>=0&&t=.5&&(this.dispatchEvent(new A(P.MEDIA_IMPRESSION)),f(this,F)[F]=!0)}if("play"!==t.type||f(this,G)[G]||f(this,H)[H]||(this.dispatchEvent(new A(P.MEDIA_START)),f(this,G)[G]=!0),"ended"===t.type&&(this.isCustomPlaybackUsed()&&f(this,D)[D].currentTime===f(this,D)[D].duration&&f(this,Q)[Q].indexOf(-1)>-1&&(f(this,D)[D].currentTime=f(this,D)[D].duration-1e-5,f(this,W)[W]=!0),f(this,U)[U].contentComplete(),f(this,M)[M]||this.T()),!window.ResizeObserver&&f(this,z)[z].autoResize&&"loadedmetadata"===t.type){var n=f(this,D)[D],r=n.offsetHeight,s=n.offsetWidth;f(this,j)[j]=s,f(this,N)[N]=r,this.R()}f(this,H)[H]&&"volumechange"!==t.type||this.dispatchEvent(new A(t.type))}},n.S=function(t){var e=this,i=f(this,I)[I].AdEvent;switch(t.type){case i.Type.LOADED:var n=t.getAd();f(this,$)[$]&&0===f(this,Q)[Q].length?f(this,$)[$]({ad:n,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}):f(this,V)[V]=n;break;case i.Type.AD_BREAK_READY:this.C(),f(this,$)[$]?(f(this,$)[$]({ad:f(this,V)[V],adBreakTime:t.getAdData().adBreakTime,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}),f(this,V)[V]=void 0):this.M();break;case i.Type.STARTED:var r=f(this,x)[x]=t.getAd();r.getAdPodInfo().getAdPosition()>1&&f(this,M)[M].setVolume(f(this,M)[M].getVolume()),f(this,_)[_].classList.remove("nonlinear"),this.R(),r.isLinear()?(f(this,C)[C].disable(),f(this,K)[K]=r.getDuration(),f(this,q)[q]=0):(f(this,_)[_].classList.add("nonlinear"),this.I()),f(this,_)[_].style.display="",f(this,Z)[Z]&&(f(this,Z)[Z]=!1,f(this,M)[M].pause());break;case i.Type.ALL_ADS_COMPLETED:if(f(this,W)[W])return;this.isCustomPlaybackUsed()&&Boolean(f(this,x)[x])&&-1!==f(this,x)[x].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),f(this,x)[x]=t.getAd(),f(this,_)[_].style.display="",f(this,D)[D].pause(),this.R(),f(this,x)[x]&&this.A(f(this,x)[x].getAdPodInfo().getTimeOffset()),f(this,M)[M].setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),f(this,C)[C].disable(),f(this,K)[K]=f(this,x)[x].getDuration(),f(this,q)[q]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=Boolean(f(this,x)[x]);if(s){var o=f(this,M)[M].getVolume();f(this,D)[D].muted=0===o,f(this,D)[D].volume=f(this,J)[J]}f(this,W)[W]&&(f(this,D)[D].currentTime=f(this,D)[D].duration+1,f(this,W)[W]=!1),f(this,D)[D].ended?(this.reset(),this.T()):this.C(),s&&(f(this,Z)[Z]=!1,this.I());break;case i.Type.AD_METADATA:this.g(f(this,M)[M].getCuePoints()),-1===f(this,Q)[Q].indexOf(0)&&(f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=t.getAdData();f(this,q)[q]=a.currentTime,f(this,K)[K]=a.duration;break;case i.Type.LOG:var u=t.getAdData();f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):u.adError&&!f(this,x)[x]&&this.I();break;case i.Type.VOLUME_CHANGED:var h=f(this,M)[M].getVolume();h>0&&(f(this,J)[J]=h)}},n.l=function(t){this.j(this.B(t))},n.u=function(t){var e=this,i=f(this,I)[I],n=i.AdEvent,r=i.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(f(this,Y)[Y]);var s=f(this,M)[M]=t.getAdsManager(f(this,C)[C],f(this,k)[k]);Object.keys(n.Type).forEach(function(t){s.addEventListener(n.Type[t],function(i){if(e.S(i),P[t]){var n=["LOG","AD_PROGRESS"].indexOf(t)>-1;e.dispatchEvent(new A(P[t],{detail:{ad:i.getAd()||f(e,x)[x],adData:n?i.getAdData():{}}}))}})}),s.addEventListener(r,function(t){return e.j(e.B(t))});try{var o;s.init(f(this,j)[j],f(this,N)[N],this.k()),s.setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),null==(o=f(this,L)[L])||o.initialize(),f(this,$)[$]||this.M()}catch(a){this.j(new S(a.message))}},n.M=function(){if(f(this,G)[G]||(this.dispatchEvent(new A(P.MEDIA_START)),f(this,G)[G]=!0),f(this,M)[M])try{f(this,M)[M].start()}catch(t){this.j(new S(t.message))}else this.I()},n.T=function(){var t=this;setTimeout(function(){f(t,F)[F]=!1,f(t,G)[G]=!1,f(t,W)[W]=!1,t.dispatchEvent(new A(P.MEDIA_STOP))},1)},n.v=function(t){for(var e,i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?d(t,e):void 0}}(t))){e&&(t=e);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(e=i()).done;){var n=e.value;n.contentBoxSize&&1===n.contentBoxSize.length?(f(this,j)[j]=n.contentBoxSize[0].inlineSize,f(this,N)[N]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(f(this,j)[j]=n.contentBoxSize.inlineSize,f(this,N)[N]=n.contentBoxSize.blockSize):(f(this,j)[j]=n.contentRect.width,f(this,N)[N]=n.contentRect.height)}this.R()},n.R=function(){if(f(this,z)[z].autoResize&&f(this,M)[M]){var t=f(this,x)[x],e=this.k();t&&!t.isLinear()?t&&(t.getWidth()>f(this,j)[j]||t.getHeight()>f(this,N)[N]?this.resizeAd(f(this,j)[j],f(this,N)[N]):(f(this,M)[M].resize(t.getWidth(),t.getHeight()+20,e),f(this,_)[_].style.width=t.getWidth()+"px",f(this,_)[_].style.height=t.getHeight()+20+"px")):this.resizeAd(f(this,j)[j],f(this,N)[N])}},n.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||f(this,D)[D].webkitDisplayingFullscreen?f(this,I)[I].ViewMode.FULLSCREEN:f(this,I)[I].ViewMode.NORMAL},n.I=function(){var t=this;f(this,_)[_].style.display="none",f(this,D)[D].ended||(f(this,C)[C].enable(),f(this,Z)[Z]?(f(this,D)[D].pause(),this.dispatchEvent(new A("pause"))):(this.p().then(function(){}).catch(function(){t.dispatchEvent(new A("pause"))}),this.dispatchEvent(new A("play")),this.dispatchEvent(new A(P.MEDIA_RESUMED))),f(this,Z)[Z]=!1)},n.B=function(t){var e=t.getError(),i=new S(e.getMessage());return i.type=e.getType(),i.errorCode=e.getErrorCode(),i.vastErrorCode=e.getVastErrorCode&&e.getVastErrorCode(),i.innerError=e.getInnerError(),i},n.j=function(t){var e=this;this.dispatchEvent(new A(P.AD_ERROR,{detail:{error:t}})),this.C(),f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I()},i(e,[{key:"volume",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?f(this,M)[M].getVolume():f(this,D)[D].volume},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t),f(this,D)[D].volume=t}},{key:"muted",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?0===f(this,M)[M].getVolume():f(this,D)[D].muted},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t?0:f(this,J)[J]),f(this,D)[D].muted=t}},{key:"currentTime",get:function(){return void 0!==f(this,q)[q]?f(this,q)[q]:f(this,D)[D].currentTime},set:function(t){f(this,C)[C].enabled&&(f(this,D)[D].currentTime=t)}},{key:"duration",get:function(){return void 0!==f(this,K)[K]?f(this,K)[K]:f(this,D)[D].duration}},{key:"cuePoints",get:function(){return[].concat(f(this,Q)[Q])}}]),e}(w);let it=0;function nt(t){const e=t.createElement("div");return e.id=`art-vast-${Date.now()}-${++it}`,t.setStyles(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),e}return function(i){return n=>{return r=this,s=null,o=function*(){let r,s=!1;const o=()=>s||n.isDestroy,a={name:"artplayerPluginVast",destroy:()=>null==r?void 0:r.destroy()};function u(){if(!s){s=!0;try{n.off("destroy",u)}finally{null==r||r.destroy()}}}if(o())return a;n.on("destroy",u);try{if(o())return a;const s=yield function(){var i=window;return i.google&&i.google.ima?Promise.resolve(i.google.ima):t||((t=new Promise(function(t,e){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=t,i.onerror=e,document.body.appendChild(i)}).then(function(){return i.google.ima})).then(e).catch(e),t)}();if(o())return a;const h=n.constructor.utils;return r=function(t,e,i,n){const{$video:r,$player:s}=t.template,o=new e.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.enablePreloading=!0;const a=new R;let u=null,h=!1,d=0;const l=t=>u===t&&!t.released&&!n();function c(t){u===t&&(u=null),t.released=!0,t.playing=!1;const e=t.player;t.player=null;const i=t.listeners.splice(0);let n,r=!1;const s=t=>{try{t()}catch(e){r?console.error("VAST cleanup error:",e):(r=!0,n=e)}};d++;try{if(e){for(const[t,n]of i)s(()=>e.removeEventListener(t,n));s(()=>e.destroy())}s(()=>{t.container.parentNode&&t.container.parentNode.removeChild(t.container)})}finally{d--}if(r)throw n}function f(){if(n()||d)return null;if(h)throw new Error("VAST initialization is already in progress");if(null==u?void 0:u.player)return u.player;let t;h=!0;try{if(t={container:nt(i),player:null,listeners:[],playing:!1,released:!1},u=t,!l(t))return c(t),null;if(s.appendChild(t.container),!l(t))return c(t),null;if(t.player=new et(e,r,t.container,o,a),!l(t))return c(t),null;const n=t;for(const[e,i]of[["AdContentPauseRequested",!0],["AdContentResumeRequested",!1],["AdStarted",!0],["AdError",!1]]){const r=t=>{l(n)&&("AdError"===e&&console.error("VAST Ad Error:",t.detail),n.playing=i,n.container.style.display=i?"block":"none")};if(t.listeners.push([e,r]),t.player.addEventListener(e,r),!l(t))return c(t),null}return t.player}catch(f){if(t)try{c(t)}catch(p){console.error("VAST cleanup error:",p)}throw f}finally{h=!1}}function p(t,i,r){if(n()||(null==u?void 0:u.playing))return;const s=f(),o=u;if(!s||!o)return;const a=function(t,e,i,n){const r=new t.AdsRequest;r[e]=i;const s=r;for(const o in n)s[o]=n[o];return r}(e,t,i,r);l(o)&&o.player===s&&s.playAds(a)}return{context:{art:t,playUrl:(t,e={})=>p("adTagUrl",t,e),playRes:(t,e={})=>p("adsResponse",t,e),init:f,ima:e,adsRenderingSettings:o,playerOptions:a,get imaPlayer(){return(null==u?void 0:u.player)||null},get container(){return(null==u?void 0:u.container)||null}},destroy:function(){u&&c(u)}}}(n,s,h,o),o()?(u(),a):("function"===typeof i&&(yield i(r.context)),a)}catch(h){try{u()}catch(d){console.error("VAST cleanup error:",d)}throw h}},new Promise((t,e)=>{var i=t=>{try{a(o.next(t))}catch(i){e(i)}},n=t=>{try{a(o.throw(t))}catch(i){e(i)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,n);a((o=o.apply(r,s)).next())});var r,s,o}}}); +!function(t,e){"object"===typeof exports&&"undefined"!==typeof module?module.exports=e():"function"==typeof define&&define.amd?(t.artplayerPluginVast=e(),define(function(){return t.artplayerPluginVast})):(t="undefined"!==typeof globalThis?globalThis:t||self).artplayerPluginVast=e()}(this,function(){"use strict";var t=null,e=function(){t=null};function i(t,e,i){return e&&function(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,n=new Array(e);i-1&&(f(this,Q)[Q].splice(e,1),this.g(f(this,Q)[Q]))},n.resizeAd=function(t,e){f(this,j)[j]=t,f(this,N)[N]=e,f(this,M)[M]&&f(this,M)[M].resize(t,e,this.k()),f(this,_)[_].style.width=t+"px",f(this,_)[_].style.height=e+"px"},n.reset=function(t){void 0===t&&(t=!1),t&&(f(this,F)[F]=!1,f(this,G)[G]=!1,f(this,W)[W]=!1),this.C(),f(this,Q)[Q]=[],f(this,Z)[Z]=!1,f(this,$)[$]=void 0,f(this,M)[M]&&f(this,M)[M].destroy(),f(this,M)[M]=void 0,f(this,I)[I].settings.setAutoPlayAdBreaks(!0),t&&this.P(),f(this,_)[_].style.display="none"},n.P=function(){f(this,U)[U]&&(f(this,U)[U].removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),f(this,U)[U].removeEventListener(f(this,I)[I].AdErrorEvent.Type.AD_ERROR,this.l,!1),f(this,U)[U].destroy()),f(this,L)[L]&&f(this,L)[L].destroy()},n.destroy=function(){var t,e,i,n,r=this;this.reset(!0),f(this,C)[C].destroy(),T.forEach(function(t){f(r,D)[D].removeEventListener(t,r.o)}),null==(t=f(this,U)[U])||t.removeEventListener(f(this,I)[I].AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.u,!1),null==(e=f(this,L)[L])||e.destroy(),null==(i=f(this,U)[U])||i.destroy(),f(this,F)[F]=!1,f(this,W)[W]=!1,f(this,G)[G]=!1,null==(n=f(this,B)[B])||n.disconnect()},n.isCustomPlaybackUsed=function(){return!1===f(this,I)[I].settings.getDisableCustomPlaybackForIOS10Plus()&&!f(this,_)[_].querySelector("video")},n.C=function(){window.clearTimeout(f(this,Y)[Y]),window.clearTimeout(f(this,X)[X]),f(this,Y)[Y]=void 0,f(this,X)[X]=void 0,f(this,x)[x]=void 0,f(this,q)[q]=void 0,f(this,K)[K]=void 0,f(this,_)[_].style.display="none",f(this,_)[_].classList.remove("nonlinear"),f(this,M)[M]&&this.R()},n.o=function(t){var e=this;if(f(this,C)[C].enabled||"volumechange"===t.type){if("timeupdate"===t.type){if(f(this,M)[M]){var i=f(this,M)[M].getCuePoints().filter(function(t){return t>=0&&t=.5&&(this.dispatchEvent(new A(P.MEDIA_IMPRESSION)),f(this,F)[F]=!0)}if("play"!==t.type||f(this,G)[G]||f(this,H)[H]||(this.dispatchEvent(new A(P.MEDIA_START)),f(this,G)[G]=!0),"ended"===t.type&&(this.isCustomPlaybackUsed()&&f(this,D)[D].currentTime===f(this,D)[D].duration&&f(this,Q)[Q].indexOf(-1)>-1&&(f(this,D)[D].currentTime=f(this,D)[D].duration-1e-5,f(this,W)[W]=!0),f(this,U)[U].contentComplete(),f(this,M)[M]||this.T()),!window.ResizeObserver&&f(this,z)[z].autoResize&&"loadedmetadata"===t.type){var n=f(this,D)[D],r=n.offsetHeight,s=n.offsetWidth;f(this,j)[j]=s,f(this,N)[N]=r,this.R()}f(this,H)[H]&&"volumechange"!==t.type||this.dispatchEvent(new A(t.type))}},n.S=function(t){var e=this,i=f(this,I)[I].AdEvent;switch(t.type){case i.Type.LOADED:var n=t.getAd();f(this,$)[$]&&0===f(this,Q)[Q].length?f(this,$)[$]({ad:n,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}):f(this,V)[V]=n;break;case i.Type.AD_BREAK_READY:this.C(),f(this,$)[$]?(f(this,$)[$]({ad:f(this,V)[V],adBreakTime:t.getAdData().adBreakTime,start:function(){e.M(),f(e,$)[$]=void 0},startWithoutReset:function(){e.M()}}),f(this,V)[V]=void 0):this.M();break;case i.Type.STARTED:var r=f(this,x)[x]=t.getAd();r.getAdPodInfo().getAdPosition()>1&&f(this,M)[M].setVolume(f(this,M)[M].getVolume()),f(this,_)[_].classList.remove("nonlinear"),this.R(),r.isLinear()?(f(this,C)[C].disable(),f(this,K)[K]=r.getDuration(),f(this,q)[q]=0):(f(this,_)[_].classList.add("nonlinear"),this.I()),f(this,_)[_].style.display="",f(this,Z)[Z]&&(f(this,Z)[Z]=!1,f(this,M)[M].pause());break;case i.Type.ALL_ADS_COMPLETED:if(f(this,W)[W])return;this.isCustomPlaybackUsed()&&Boolean(f(this,x)[x])&&-1!==f(this,x)[x].getAdPodInfo().getTimeOffset()&&this.I(),this.reset();break;case i.Type.CONTENT_PAUSE_REQUESTED:this.C(),f(this,x)[x]=t.getAd(),f(this,_)[_].style.display="",f(this,D)[D].pause(),this.R(),f(this,x)[x]&&this.A(f(this,x)[x].getAdPodInfo().getTimeOffset()),f(this,M)[M].setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),f(this,C)[C].disable(),f(this,K)[K]=f(this,x)[x].getDuration(),f(this,q)[q]=0;break;case i.Type.CONTENT_RESUME_REQUESTED:var s=Boolean(f(this,x)[x]);if(s){var o=f(this,M)[M].getVolume();f(this,D)[D].muted=0===o,f(this,D)[D].volume=f(this,J)[J]}f(this,W)[W]&&(f(this,D)[D].currentTime=f(this,D)[D].duration+1,f(this,W)[W]=!1),f(this,D)[D].ended?(this.reset(),this.T()):this.C(),s&&(f(this,Z)[Z]=!1,this.I());break;case i.Type.AD_METADATA:this.g(f(this,M)[M].getCuePoints()),-1===f(this,Q)[Q].indexOf(0)&&(f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I());break;case i.Type.AD_PROGRESS:var a=t.getAdData();f(this,q)[q]=a.currentTime,f(this,K)[K]=a.duration;break;case i.Type.LOG:var u=t.getAdData();f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):u.adError&&!f(this,x)[x]&&this.I();break;case i.Type.VOLUME_CHANGED:var h=f(this,M)[M].getVolume();h>0&&(f(this,J)[J]=h)}},n.l=function(t){this.j(this.B(t))},n.u=function(t){var e=this,i=f(this,I)[I],n=i.AdEvent,r=i.AdErrorEvent.Type.AD_ERROR;window.clearTimeout(f(this,Y)[Y]);var s=f(this,M)[M]=t.getAdsManager(f(this,C)[C],f(this,k)[k]);Object.keys(n.Type).forEach(function(t){s.addEventListener(n.Type[t],function(i){if(e.S(i),P[t]){var n=["LOG","AD_PROGRESS"].indexOf(t)>-1;e.dispatchEvent(new A(P[t],{detail:{ad:i.getAd()||f(e,x)[x],adData:n?i.getAdData():{}}}))}})}),s.addEventListener(r,function(t){return e.j(e.B(t))});try{var o;s.init(f(this,j)[j],f(this,N)[N],this.k()),s.setVolume(f(this,D)[D].muted?0:f(this,D)[D].volume),null==(o=f(this,L)[L])||o.initialize(),f(this,$)[$]||this.M()}catch(a){this.j(new S(a.message))}},n.M=function(){if(f(this,G)[G]||(this.dispatchEvent(new A(P.MEDIA_START)),f(this,G)[G]=!0),f(this,M)[M])try{f(this,M)[M].start()}catch(t){this.j(new S(t.message))}else this.I()},n.T=function(){var t=this;setTimeout(function(){f(t,F)[F]=!1,f(t,G)[G]=!1,f(t,W)[W]=!1,t.dispatchEvent(new A(P.MEDIA_STOP))},1)},n.v=function(t){for(var e,i=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(e)return(e=e.call(t)).next.bind(e);if(Array.isArray(t)||(e=function(t,e){if(t){if("string"==typeof t)return d(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?d(t,e):void 0}}(t))){e&&(t=e);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(t);!(e=i()).done;){var n=e.value;n.contentBoxSize&&1===n.contentBoxSize.length?(f(this,j)[j]=n.contentBoxSize[0].inlineSize,f(this,N)[N]=n.contentBoxSize[0].blockSize):n.contentBoxSize&&n.contentBoxSize.inlineSize?(f(this,j)[j]=n.contentBoxSize.inlineSize,f(this,N)[N]=n.contentBoxSize.blockSize):(f(this,j)[j]=n.contentRect.width,f(this,N)[N]=n.contentRect.height)}this.R()},n.R=function(){if(f(this,z)[z].autoResize&&f(this,M)[M]){var t=f(this,x)[x],e=this.k();t&&!t.isLinear()?t&&(t.getWidth()>f(this,j)[j]||t.getHeight()>f(this,N)[N]?this.resizeAd(f(this,j)[j],f(this,N)[N]):(f(this,M)[M].resize(t.getWidth(),t.getHeight()+20,e),f(this,_)[_].style.width=t.getWidth()+"px",f(this,_)[_].style.height=t.getHeight()+20+"px")):this.resizeAd(f(this,j)[j],f(this,N)[N])}},n.k=function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||f(this,D)[D].webkitDisplayingFullscreen?f(this,I)[I].ViewMode.FULLSCREEN:f(this,I)[I].ViewMode.NORMAL},n.I=function(){var t=this;f(this,_)[_].style.display="none",f(this,D)[D].ended||(f(this,C)[C].enable(),f(this,Z)[Z]?(f(this,D)[D].pause(),this.dispatchEvent(new A("pause"))):(this.p().then(function(){}).catch(function(){t.dispatchEvent(new A("pause"))}),this.dispatchEvent(new A("play")),this.dispatchEvent(new A(P.MEDIA_RESUMED))),f(this,Z)[Z]=!1)},n.B=function(t){var e=t.getError(),i=new S(e.getMessage());return i.type=e.getType(),i.errorCode=e.getErrorCode(),i.vastErrorCode=e.getVastErrorCode&&e.getVastErrorCode(),i.innerError=e.getInnerError(),i},n.j=function(t){var e=this;this.dispatchEvent(new A(P.AD_ERROR,{detail:{error:t}})),this.C(),f(this,$)[$]?f(this,$)[$]({start:function(){e.I(),f(e,$)[$]=void 0},startWithoutReset:function(){e.I()}}):this.I()},i(e,[{key:"volume",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?f(this,M)[M].getVolume():f(this,D)[D].volume},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t),f(this,D)[D].volume=t}},{key:"muted",get:function(){return!f(this,C)[C].enabled&&f(this,M)[M]?0===f(this,M)[M].getVolume():f(this,D)[D].muted},set:function(t){!f(this,C)[C].enabled&&f(this,M)[M]&&f(this,M)[M].setVolume(t?0:f(this,J)[J]),f(this,D)[D].muted=t}},{key:"currentTime",get:function(){return void 0!==f(this,q)[q]?f(this,q)[q]:f(this,D)[D].currentTime},set:function(t){f(this,C)[C].enabled&&(f(this,D)[D].currentTime=t)}},{key:"duration",get:function(){return void 0!==f(this,K)[K]?f(this,K)[K]:f(this,D)[D].duration}},{key:"cuePoints",get:function(){return[].concat(f(this,Q)[Q])}}]),e}(w);let it=0;function nt(t){const e=t.createElement("div");return e.id=`art-vast-${Date.now()}-${++it}`,t.setStyles(e,{position:"absolute",inset:"0",width:"100%",height:"100%",zIndex:"150",backgroundColor:"black",display:"none",pointerEvents:"auto"}),e}function rt(i){return n=>{return r=null,s=null,o=function*(){let r,s=!1;const o=()=>s||n.isDestroy,a={name:"artplayerPluginVast",destroy:()=>null==r?void 0:r.destroy()};function u(){if(!s){s=!0;try{n.off("destroy",u)}finally{null==r||r.destroy()}}}if(o())return a;n.on("destroy",u);try{if(o())return a;const s=yield function(){var i=window;return i.google&&i.google.ima?Promise.resolve(i.google.ima):t||((t=new Promise(function(t,e){var i=document.createElement("script");i.async=!0,i.src="https://imasdk.googleapis.com/js/sdkloader/ima3.js",i.onload=t,i.onerror=e,document.body.appendChild(i)}).then(function(){return i.google.ima})).then(e).catch(e),t)}();if(o())return a;const h=n.constructor.utils;return r=function(t,e,i,n){const{$video:r,$player:s}=t.template,o=new e.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.enablePreloading=!0;const a=new R;let u=null,h=!1,d=0;const l=t=>u===t&&!t.released&&!n();function c(t){u===t&&(u=null),t.released=!0,t.playing=!1;const e=t.player;t.player=null;const i=t.listeners.splice(0);let n,r=!1;const s=t=>{try{t()}catch(e){r?console.error("VAST cleanup error:",e):(r=!0,n=e)}};d++;try{if(e){for(const[t,n]of i)s(()=>e.removeEventListener(t,n));s(()=>e.destroy())}s(()=>{t.container.parentNode&&t.container.parentNode.removeChild(t.container)})}finally{d--}if(r)throw n}function f(){if(n()||d)return null;if(h)throw new Error("VAST initialization is already in progress");if(null==u?void 0:u.player)return u.player;let t;h=!0;try{if(t={container:nt(i),player:null,listeners:[],playing:!1,released:!1},u=t,!l(t))return c(t),null;if(s.appendChild(t.container),!l(t))return c(t),null;if(t.player=new et(e,r,t.container,o,a),!l(t))return c(t),null;const n=t;for(const[e,i]of[["AdContentPauseRequested",!0],["AdContentResumeRequested",!1],["AdStarted",!0],["AdError",!1]]){const r=t=>{l(n)&&("AdError"===e&&console.error("VAST Ad Error:",t.detail),n.playing=i,n.container.style.display=i?"block":"none")};if(t.listeners.push([e,r]),t.player.addEventListener(e,r),!l(t))return c(t),null}return t.player}catch(f){if(t)try{c(t)}catch(p){console.error("VAST cleanup error:",p)}throw f}finally{h=!1}}function p(t,i,r){if(n()||(null==u?void 0:u.playing))return;const s=f(),o=u;if(!s||!o)return;const a=function(t,e,i,n){const r=new t.AdsRequest;r[e]=i;const s=r;for(const o in n)s[o]=n[o];return r}(e,t,i,r);l(o)&&o.player===s&&s.playAds(a)}return{context:{art:t,playUrl:(t,e={})=>p("adTagUrl",t,e),playRes:(t,e={})=>p("adsResponse",t,e),init:f,ima:e,adsRenderingSettings:o,playerOptions:a,get imaPlayer(){return(null==u?void 0:u.player)||null},get container(){return(null==u?void 0:u.container)||null}},destroy:function(){u&&c(u)}}}(n,s,h,o),o()?(u(),a):("function"===typeof i&&(yield i(r.context)),a)}catch(h){try{u()}catch(d){console.error("VAST cleanup error:",d)}throw h}},new Promise((t,e)=>{var i=t=>{try{a(o.next(t))}catch(i){e(i)}},n=t=>{try{a(o.throw(t))}catch(i){e(i)}},a=e=>e.done?t(e.value):Promise.resolve(e.value).then(i,n);a((o=o.apply(r,s)).next())});var r,s,o}}return rt.default=rt,rt}); diff --git a/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.mjs b/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.mjs index df954611f..db882b343 100644 --- a/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.mjs +++ b/packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.mjs @@ -98,15 +98,15 @@ function w(t2, i2) { return t2; } var m = {}; -m.CustomEvent = "function" == typeof CustomEvent ? CustomEvent : function(t2) { +m.CustomEvent = "function" == typeof CustomEvent ? CustomEvent : (function(t2) { return i2[t2] = new i2("").constructor[t2], i2; function i2(t3, i3) { i3 || (i3 = {}); var e2 = document.createEvent("CustomEvent"); return e2.initCustomEvent(t3, !!i3.bubbles, !!i3.cancelable, i3.detail), e2; } -}("prototype"); -var p, y, O = m.CustomEvent, j = b("mediaElement"), g = b("currentTime"), A = b("enabled"), k = function() { +})("prototype"); +var p, y, O = m.CustomEvent, j = b("mediaElement"), g = b("currentTime"), A = b("enabled"), k = (function() { function t2(t3) { Object.defineProperty(this, j, { writable: true, value: void 0 }), Object.defineProperty(this, g, { writable: true, value: void 0 }), Object.defineProperty(this, A, { writable: true, value: void 0 }), this.seeking = void 0, w(this, j)[j] = t3, w(this, g)[g] = 0, w(this, A)[A] = false, this.seeking = false, this.t = this.t.bind(this), this.i = this.i.bind(this), this.h = this.h.bind(this), this.enable(); } @@ -151,7 +151,7 @@ var p, y, O = m.CustomEvent, j = b("mediaElement"), g = b("currentTime"), A = b( var t3; return null == (t3 = w(this, j)[j]) ? void 0 : t3.volume; } }]), t2; -}(), C = function() { +})(), C = (function() { function t2() { this.delegate = document.createDocumentFragment(); } @@ -163,23 +163,23 @@ var p, y, O = m.CustomEvent, j = b("mediaElement"), g = b("currentTime"), A = b( }, i2.removeEventListener = function() { return this.delegate.removeEventListener.apply(this.delegate, [].slice.call(arguments)); }, t2; -}(), P = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"]; -!function(t2) { +})(), P = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"]; +!(function(t2) { t2.MEDIA_START = "MediaStart", t2.MEDIA_IMPRESSION = "MediaImpression", t2.MEDIA_STOP = "MediaStop", t2.MEDIA_CUE_POINTS_CHANGE = "MediaCuePointsChange", t2.MEDIA_RESUMED = "MediaResumed"; -}(p || (p = {})), function(t2) { +})(p || (p = {})), (function(t2) { t2.AD_ERROR = "AdError", t2.AD_BUFFERING = "AdBuffering", t2.LOADED = "AdLoaded", t2.IMPRESSION = "AdImpression", t2.STARTED = "AdStarted", t2.FIRST_QUARTILE = "AdFirstQuartile", t2.MIDPOINT = "AdMidpoint", t2.THIRD_QUARTILE = "AdThirdQuartile", t2.AD_PROGRESS = "AdProgress", t2.COMPLETE = "AdComplete", t2.CLICK = "AdClick", t2.PAUSED = "AdPaused", t2.RESUMED = "AdResumed", t2.SKIPPED = "AdSkipped", t2.SKIPPABLE_STATE_CHANGED = "AdSkippableStateChanged", t2.VOLUME_CHANGED = "AdVolumeChanged", t2.VOLUME_MUTED = "AdMuted", t2.AD_METADATA = "AdMetadata", t2.AD_BREAK_READY = "AdBreakReady", t2.CONTENT_PAUSE_REQUESTED = "AdContentPauseRequested", t2.CONTENT_RESUME_REQUESTED = "AdContentResumeRequested", t2.ALL_ADS_COMPLETED = "AdAllAdsCompleted", t2.DURATION_CHANGE = "AdDurationChange", t2.INTERACTION = "AdInteraction", t2.LINEAR_CHANGED = "AdLinearChanged", t2.LOG = "AdLog", t2.USER_CLOSE = "AdUserClose", t2.AD_CAN_PLAY = "AdCanPlay", t2.EXPANDED_CHANGED = "AdExpandedChanged", t2.VIEWABLE_IMPRESSION = "AdViewableImpression"; -}(y || (y = {})); +})(y || (y = {})); var R = h({}, y, p), E = function() { this.disableCustomPlaybackForIOS10Plus = false, this.autoResize = true, this.clickTrackingElement = void 0; -}, T = function(t2) { +}, T = (function(t2) { function i2() { var i3; return (i3 = t2.call.apply(t2, [this].concat([].slice.call(arguments))) || this).errorCode = void 0, i3.innerError = void 0, i3.type = void 0, i3.vastErrorCode = void 0, i3; } return r(i2, t2), i2; -}(d(Error)); +})(d(Error)); T.ERROR_CODE_ADS_MANAGER_LOADED_TIMEOUT = 9e3, T.ERROR_CODE_REQUEST_ADS_TIMEOUT = 9001; -var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("adsRenderingSettings"), B = b("ima"), L = b("adDisplayContainer"), D = b("adsManager"), W = b("width"), _ = b("height"), q = b("adsLoader"), F = b("playerOptions"), N = b("resizeObserver"), V = b("currentAd"), G = b("loadedAd"), Q = b("mediaStartTriggered"), U = b("mediaImpressionTriggered"), z = b("mediaInActivation"), Z = b("customPlaybackTimeAdjustedOnEnded"), $ = b("cuePoints"), H = b("adCurrentTime"), J = b("adDuration"), K = b("startAdCallback"), X = b("adsManagerLoadedTimeout"), Y = b("requestAdsTimeout"), tt = b("wasExternallyPaused"), it = b("lastNonZeroAdVolume"), et = b("activatePromise"), nt = function(t2) { +var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("adsRenderingSettings"), B = b("ima"), L = b("adDisplayContainer"), D = b("adsManager"), W = b("width"), _ = b("height"), q = b("adsLoader"), F = b("playerOptions"), N = b("resizeObserver"), V = b("currentAd"), G = b("loadedAd"), Q = b("mediaStartTriggered"), U = b("mediaImpressionTriggered"), z = b("mediaInActivation"), Z = b("customPlaybackTimeAdjustedOnEnded"), $ = b("cuePoints"), H = b("adCurrentTime"), J = b("adDuration"), K = b("startAdCallback"), X = b("adsManagerLoadedTimeout"), Y = b("requestAdsTimeout"), tt = b("wasExternallyPaused"), it = b("lastNonZeroAdVolume"), et = b("activatePromise"), nt = (function(t2) { function i2(i3, e3, n2, s2, h2) { var r2; void 0 === s2 && (s2 = new i3.AdsRenderingSettings()), void 0 === h2 && (h2 = new E()), r2 = t2.call(this) || this, Object.defineProperty(l(r2), S, { writable: true, value: void 0 }), Object.defineProperty(l(r2), M, { writable: true, value: void 0 }), Object.defineProperty(l(r2), x, { writable: true, value: void 0 }), Object.defineProperty(l(r2), I, { writable: true, value: void 0 }), Object.defineProperty(l(r2), B, { writable: true, value: void 0 }), Object.defineProperty(l(r2), L, { writable: true, value: void 0 }), Object.defineProperty(l(r2), D, { writable: true, value: void 0 }), Object.defineProperty(l(r2), W, { writable: true, value: void 0 }), Object.defineProperty(l(r2), _, { writable: true, value: void 0 }), Object.defineProperty(l(r2), q, { writable: true, value: void 0 }), Object.defineProperty(l(r2), F, { writable: true, value: void 0 }), Object.defineProperty(l(r2), N, { writable: true, value: void 0 }), Object.defineProperty(l(r2), V, { writable: true, value: void 0 }), Object.defineProperty(l(r2), G, { writable: true, value: void 0 }), Object.defineProperty(l(r2), Q, { writable: true, value: false }), Object.defineProperty(l(r2), U, { writable: true, value: false }), Object.defineProperty(l(r2), z, { writable: true, value: false }), Object.defineProperty(l(r2), Z, { writable: true, value: false }), Object.defineProperty(l(r2), $, { writable: true, value: [] }), Object.defineProperty(l(r2), H, { writable: true, value: void 0 }), Object.defineProperty(l(r2), J, { writable: true, value: void 0 }), Object.defineProperty(l(r2), K, { writable: true, value: void 0 }), Object.defineProperty(l(r2), X, { writable: true, value: void 0 }), Object.defineProperty(l(r2), Y, { writable: true, value: void 0 }), Object.defineProperty(l(r2), tt, { writable: true, value: false }), Object.defineProperty(l(r2), it, { writable: true, value: 1 }), Object.defineProperty(l(r2), et, { writable: true, value: Promise.resolve() }), w(l(r2), S)[S] = e3, w(l(r2), M)[M] = n2, w(l(r2), B)[B] = i3, w(l(r2), F)[F] = h2, w(l(r2), I)[I] = s2, w(l(r2), I)[I].restoreCustomPlaybackStateOnAdBreakComplete = true, h2.disableCustomPlaybackForIOS10Plus && !w(l(r2), S)[S].hasAttribute("playsinline") && w(l(r2), S)[S].setAttribute("playsinline", ""), w(l(r2), B)[B].settings.setDisableCustomPlaybackForIOS10Plus(h2.disableCustomPlaybackForIOS10Plus), w(l(r2), x)[x] = new k(w(l(r2), S)[S]), r2.o = r2.o.bind(l(r2)), P.forEach(function(t3) { @@ -373,16 +373,16 @@ var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("a w(t3, U)[U] = false, w(t3, Q)[Q] = false, w(t3, Z)[Z] = false, t3.dispatchEvent(new O(R.MEDIA_STOP)); }, 1); }, e2.v = function(t3) { - for (var i3, e3 = function(t4, i4) { + for (var i3, e3 = (function(t4, i4) { var e4 = "undefined" != typeof Symbol && t4[Symbol.iterator] || t4["@@iterator"]; if (e4) return (e4 = e4.call(t4)).next.bind(e4); - if (Array.isArray(t4) || (e4 = function(t5, i5) { + if (Array.isArray(t4) || (e4 = (function(t5, i5) { if (t5) { if ("string" == typeof t5) return f(t5, i5); var e5 = Object.prototype.toString.call(t5).slice(8, -1); return "Object" === e5 && t5.constructor && (e5 = t5.constructor.name), "Map" === e5 || "Set" === e5 ? Array.from(t5) : "Arguments" === e5 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e5) ? f(t5, i5) : void 0; } - }(t4))) { + })(t4))) { e4 && (t4 = e4); var n3 = 0; return function() { @@ -390,7 +390,7 @@ var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("a }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - }(t3); !(i3 = e3()).done; ) { + })(t3); !(i3 = e3()).done; ) { var n2 = i3.value; n2.contentBoxSize && 1 === n2.contentBoxSize.length ? (w(this, W)[W] = n2.contentBoxSize[0].inlineSize, w(this, _)[_] = n2.contentBoxSize[0].blockSize) : n2.contentBoxSize && n2.contentBoxSize.inlineSize ? (w(this, W)[W] = n2.contentBoxSize.inlineSize, w(this, _)[_] = n2.contentBoxSize.blockSize) : (w(this, W)[W] = n2.contentRect.width, w(this, _)[_] = n2.contentRect.height); } @@ -435,7 +435,7 @@ var S = b("mediaElement"), M = b("adElement"), x = b("customPlayhead"), I = b("a } }, { key: "cuePoints", get: function() { return [].concat(w(this, $)[$]); } }]), i2; -}(C); +})(C); function createRequest(ima, field, value, config) { const request = new ima.AdsRequest(); request[field] = value; @@ -647,6 +647,7 @@ function artplayerPluginVast(callback) { } }; } +artplayerPluginVast.default = artplayerPluginVast; export { artplayerPluginVast as default }; diff --git a/packages/artplayer-plugin-vast/src/index.ts b/packages/artplayer-plugin-vast/src/index.ts index 9263a2de2..dd58e57eb 100644 --- a/packages/artplayer-plugin-vast/src/index.ts +++ b/packages/artplayer-plugin-vast/src/index.ts @@ -3,7 +3,7 @@ import type { Callback, Result } from './types' import { loadImaSdk } from './sdk' import { createSession } from './session' -export default function artplayerPluginVast(callback?: Callback) { +function artplayerPluginVast(callback?: Callback) { return async (art: Artplayer): Promise => { let disposed = false let session: ReturnType | undefined @@ -46,3 +46,7 @@ export default function artplayerPluginVast(callback?: Callback) { } } } + +artplayerPluginVast.default = artplayerPluginVast + +export default artplayerPluginVast diff --git a/refactor/baselines/vast-alias-validation.json b/refactor/baselines/vast-alias-validation.json new file mode 100644 index 000000000..89ec68334 --- /dev/null +++ b/refactor/baselines/vast-alias-validation.json @@ -0,0 +1,3445 @@ +{ + "task": "PKG-VAST-07", + "date": "2026-09-14", + "baselineCommit": "eb6402fdca910fd39d329d0c26222c4359915150", + "node": "24.21.0", + "yarn": "1.22.22", + "sourceRed": { + "log": { + "path": "refactor/.cache/vast-alias-red-final.log", + "sha256": "7e77f8ec3dc221e0027ddf4e4c9412c4bae963909e54ecb7ec0f4dcf1935b4fd" + }, + "pass": 0, + "fail": 4, + "scope": "SDK-controlled source alias and three UMD format assertions" + }, + "artifactRed": { + "files": [ + { + "path": "refactor/.cache/vast-alias-before.js", + "sha256": "874803ec726f04649bb636c1376de9e038754310ab0016a22da44f189b7a5ce0" + }, + { + "path": "refactor/.cache/vast-alias-before.mjs", + "sha256": "7650fb0d42e8bb7049d201859187d28f69b1868ac7e25539a7575ee50ae1b2d7" + } + ], + "log": { + "path": "refactor/.cache/vast-alias-artifact-red.log", + "sha256": "bdf180fcd479929a792ef08280c388cc1e17e7cfb42f9fe9038f2cd287821294" + }, + "pass": 0, + "fail": 4 + }, + "checks": [ + { + "log": { + "path": "refactor/.cache/vast-alias-suite-final.log", + "sha256": "38d61f9cf125550b3ca28cdcb4a456432ab2c22e01bb2b8dbd46d6e1f324f813" + }, + "pass": 65, + "fail": 0, + "exitCode": 0 + }, + { + "log": { + "path": "refactor/.cache/vast-alias-js.log", + "sha256": "b3cfb41aa72d2a03ac57fa7610675522550b1052ce69ca4c8218afdb9499d243" + }, + "pass": 4, + "fail": 0, + "exitCode": 0 + }, + { + "log": { + "path": "refactor/.cache/vast-alias-legacy.js.log", + "sha256": "515b4eb0d056af25efc863e09375f49afab386a2405f207866cf865131551f64" + }, + "pass": 4, + "fail": 0, + "exitCode": 0 + }, + { + "log": { + "path": "refactor/.cache/vast-alias-ci-tests.log", + "sha256": "a7ba351bc03ec6b04b7e8eaf4650b3e597702ef4b2f39f7e4e7290a42dea669a" + }, + "pass": 30, + "fail": 0, + "exitCode": 0 + } + ], + "files": [ + { + "path": "packages/artplayer-plugin-vast/src/index.ts", + "sha256": "5033125ea915fec546a5a4cc51bc76942fdd641e7305b57cd926b660fc92a0db" + }, + { + "path": "test/vast.test.js", + "sha256": "99b39c186b0fc56ba67600a93cba586d505931d0e4eb80d6a5d3d5610749305e" + }, + { + "path": "test/vast-exports.test.js", + "sha256": "437fe773065d071afcecfe58c139a67b5b7b259baee1d44235e2f1b2bfc5f41c" + }, + { + "path": "test/browser/vast.spec.js", + "sha256": "4603624ae3eef01ecf29d736d5f5003d974f9082bf0922253c544e09cc5d61e5" + }, + { + "path": "packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.js", + "sha256": "01e440caf7a7cddc46bd3827d98a1ba455df929b977a2e28b066707e92acfd1e" + }, + { + "path": "docs/compiled/artplayer-plugin-vast.js", + "sha256": "01e440caf7a7cddc46bd3827d98a1ba455df929b977a2e28b066707e92acfd1e" + }, + { + "path": "packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.legacy.js", + "sha256": "244579226a0e2dc83dfd80deb5ee94a69acd01eacb20a0d460b76b981d41ea0a" + }, + { + "path": "docs/compiled/artplayer-plugin-vast.legacy.js", + "sha256": "244579226a0e2dc83dfd80deb5ee94a69acd01eacb20a0d460b76b981d41ea0a" + }, + { + "path": "packages/artplayer-plugin-vast/dist/artplayer-plugin-vast.mjs", + "sha256": "33ce5fdf9cc1868c5bcf2eb2ec28475d8b3292f80b6730e201d8720ef767e3ee" + }, + { + "path": "docs/compiled/artplayer-plugin-vast.mjs", + "sha256": "33ce5fdf9cc1868c5bcf2eb2ec28475d8b3292f80b6730e201d8720ef767e3ee" + } + ], + "types": "Strict package noEmit passed", + "lint": "Targeted source, Node and browser lint passed", + "build": { + "path": "refactor/.cache/vast-alias-build.log", + "sha256": "5a38a4dd90524cc7a7a46322f906380bc392110f459fb6076734dae1cb17a5c7" + }, + "browser": { + "report": { + "path": "refactor/.cache/vast-alias-browser/report.json", + "sha256": "92dd53895de4917335e18e9a54f66ceb2b3a1b23b2ada713741e1912758fe8ce" + }, + "stats": { + "startTime": "2026-09-14T06:27:00.861Z", + "duration": 49117.226, + "expected": 117, + "skipped": 0, + "unexpected": 0, + "flaky": 0 + }, + "versions": { + "chromium": "153.0.8010.12", + "firefox": "155.0", + "webkit": "26.6" + }, + "cases": [ + { + "title": "published-5.1.7 / source: async SDK and callback gate real core registration and preserve requests", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: SDK rejection stays observable and core can still play content", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: candidate suppresses late SDK initialization after real core destruction", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: candidate isolates stale events and terminates recreated ads on core destroy", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [ + { + "requests": [ + { + "adTagUrl": "/one.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "block" + }, + { + "requests": [ + { + "adTagUrl": "/two.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: candidate callback rejection cleans allocated SDK and DOM without destroying the core", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / published-1.0.0-source: async SDK and callback gate real core registration and preserve requests", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / published-1.0.0-source: SDK rejection stays observable and core can still play content", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / published-1.0.0-source historical: late SDK after destroy allocates into the detached player", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0: async SDK and callback gate real core registration and preserve requests", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0: SDK rejection stays observable and core can still play content", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0 historical: late SDK after destroy allocates into the detached player", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published / source: async SDK and callback gate real core registration and preserve requests", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: SDK rejection stays observable and core can still play content", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: candidate suppresses late SDK initialization after real core destruction", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: candidate isolates stale events and terminates recreated ads on core destroy", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [ + { + "requests": [ + { + "adTagUrl": "/one.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "block" + }, + { + "requests": [ + { + "adTagUrl": "/two.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: candidate callback rejection cleans allocated SDK and DOM without destroying the core", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / published-1.0.0-source: async SDK and callback gate real core registration and preserve requests", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / published-1.0.0-source: SDK rejection stays observable and core can still play content", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / published-1.0.0-source historical: late SDK after destroy allocates into the detached player", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0: async SDK and callback gate real core registration and preserve requests", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0: SDK rejection stays observable and core can still play content", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0 historical: late SDK after destroy allocates into the detached player", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "candidate / source: async SDK and callback gate real core registration and preserve requests", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: SDK rejection stays observable and core can still play content", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: candidate suppresses late SDK initialization after real core destruction", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: candidate isolates stale events and terminates recreated ads on core destroy", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [ + { + "requests": [ + { + "adTagUrl": "/one.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "block" + }, + { + "requests": [ + { + "adTagUrl": "/two.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: candidate callback rejection cleans allocated SDK and DOM without destroying the core", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / published-1.0.0-source: async SDK and callback gate real core registration and preserve requests", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / published-1.0.0-source: SDK rejection stays observable and core can still play content", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / published-1.0.0-source historical: late SDK after destroy allocates into the detached player", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0: async SDK and callback gate real core registration and preserve requests", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0: SDK rejection stays observable and core can still play content", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0 historical: late SDK after destroy allocates into the detached player", + "project": "chromium", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "published-5.1.7 / source: async SDK and callback gate real core registration and preserve requests", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: SDK rejection stays observable and core can still play content", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: candidate suppresses late SDK initialization after real core destruction", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: candidate isolates stale events and terminates recreated ads on core destroy", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [ + { + "requests": [ + { + "adTagUrl": "/one.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "block" + }, + { + "requests": [ + { + "adTagUrl": "/two.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: candidate callback rejection cleans allocated SDK and DOM without destroying the core", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / published-1.0.0-source: async SDK and callback gate real core registration and preserve requests", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / published-1.0.0-source: SDK rejection stays observable and core can still play content", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / published-1.0.0-source historical: late SDK after destroy allocates into the detached player", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0: async SDK and callback gate real core registration and preserve requests", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0: SDK rejection stays observable and core can still play content", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0 historical: late SDK after destroy allocates into the detached player", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published / source: async SDK and callback gate real core registration and preserve requests", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: SDK rejection stays observable and core can still play content", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: candidate suppresses late SDK initialization after real core destruction", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: candidate isolates stale events and terminates recreated ads on core destroy", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [ + { + "requests": [ + { + "adTagUrl": "/one.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "block" + }, + { + "requests": [ + { + "adTagUrl": "/two.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: candidate callback rejection cleans allocated SDK and DOM without destroying the core", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / published-1.0.0-source: async SDK and callback gate real core registration and preserve requests", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / published-1.0.0-source: SDK rejection stays observable and core can still play content", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / published-1.0.0-source historical: late SDK after destroy allocates into the detached player", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0: async SDK and callback gate real core registration and preserve requests", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0: SDK rejection stays observable and core can still play content", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0 historical: late SDK after destroy allocates into the detached player", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "candidate / source: async SDK and callback gate real core registration and preserve requests", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: SDK rejection stays observable and core can still play content", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: candidate suppresses late SDK initialization after real core destruction", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: candidate isolates stale events and terminates recreated ads on core destroy", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [ + { + "requests": [ + { + "adTagUrl": "/one.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "block" + }, + { + "requests": [ + { + "adTagUrl": "/two.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: candidate callback rejection cleans allocated SDK and DOM without destroying the core", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / published-1.0.0-source: async SDK and callback gate real core registration and preserve requests", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / published-1.0.0-source: SDK rejection stays observable and core can still play content", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / published-1.0.0-source historical: late SDK after destroy allocates into the detached player", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0: async SDK and callback gate real core registration and preserve requests", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0: SDK rejection stays observable and core can still play content", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0 historical: late SDK after destroy allocates into the detached player", + "project": "firefox", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "published-5.1.7 / source: async SDK and callback gate real core registration and preserve requests", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: SDK rejection stays observable and core can still play content", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: candidate suppresses late SDK initialization after real core destruction", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: candidate isolates stale events and terminates recreated ads on core destroy", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [ + { + "requests": [ + { + "adTagUrl": "/one.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "block" + }, + { + "requests": [ + { + "adTagUrl": "/two.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / source: candidate callback rejection cleans allocated SDK and DOM without destroying the core", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / published-1.0.0-source: async SDK and callback gate real core registration and preserve requests", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / published-1.0.0-source: SDK rejection stays observable and core can still play content", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / published-1.0.0-source historical: late SDK after destroy allocates into the detached player", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0: async SDK and callback gate real core registration and preserve requests", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0: SDK rejection stays observable and core can still play content", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published-5.1.7 / frozen-workspace-1.2.0 historical: late SDK after destroy allocates into the detached player", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published-5.1.7", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.1.7" + } + }, + { + "title": "published / source: async SDK and callback gate real core registration and preserve requests", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: SDK rejection stays observable and core can still play content", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: candidate suppresses late SDK initialization after real core destruction", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: candidate isolates stale events and terminates recreated ads on core destroy", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [ + { + "requests": [ + { + "adTagUrl": "/one.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "block" + }, + { + "requests": [ + { + "adTagUrl": "/two.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / source: candidate callback rejection cleans allocated SDK and DOM without destroying the core", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / published-1.0.0-source: async SDK and callback gate real core registration and preserve requests", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / published-1.0.0-source: SDK rejection stays observable and core can still play content", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / published-1.0.0-source historical: late SDK after destroy allocates into the detached player", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0: async SDK and callback gate real core registration and preserve requests", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0: SDK rejection stays observable and core can still play content", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "published / frozen-workspace-1.2.0 historical: late SDK after destroy allocates into the detached player", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "published", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.0" + } + }, + { + "title": "candidate / source: async SDK and callback gate real core registration and preserve requests", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: SDK rejection stays observable and core can still play content", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: candidate suppresses late SDK initialization after real core destruction", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: candidate isolates stale events and terminates recreated ads on core destroy", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "players": [ + { + "requests": [ + { + "adTagUrl": "/one.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "block" + }, + { + "requests": [ + { + "adTagUrl": "/two.xml" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / source: candidate callback rejection cleans allocated SDK and DOM without destroying the core", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "source", + "sha256": "0473e5e326b7aa715da73a073a457c1b8cb09c2ed183269681a85316a0391bef", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [], + "destroyCalls": 1, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / published-1.0.0-source: async SDK and callback gate real core registration and preserve requests", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / published-1.0.0-source: SDK rejection stays observable and core can still play content", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / published-1.0.0-source historical: late SDK after destroy allocates into the detached player", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "published-1.0.0-source", + "sha256": "2d41a516b07abf90d92d84ff6e4ea6873bb2d4ebfd00d4d21f0935aed372ee03", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0: async SDK and callback gate real core registration and preserve requests", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/test/ad-tag.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0: SDK rejection stays observable and core can still play content", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0: real overlay follows SDK events and explicit cleanup supports inactive recreation", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": false, + "players": [ + { + "requests": [ + { + "adTagUrl": "/first.xml" + }, + { + "adsResponse": "" + } + ], + "destroyCalls": 1, + "connected": false, + "display": "none" + }, + { + "requests": [ + { + "adTagUrl": "/new-session.xml" + } + ], + "destroyCalls": 0, + "connected": true, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + }, + { + "title": "candidate / frozen-workspace-1.2.0 historical: late SDK after destroy allocates into the detached player", + "project": "webkit", + "status": "passed", + "retry": 0, + "inputs": { + "core": "candidate", + "implementation": "frozen-workspace-1.2.0", + "sha256": "ac391200c572c8e68431212e6b5f102956f959196ad98da54fa2f42b4d8888bf", + "sdk": "controlled wrapper recorder, no IMA execution" + }, + "state": { + "destroyed": true, + "callbackCalls": 1, + "players": [ + { + "requests": [ + { + "adTagUrl": "/late.xml" + } + ], + "destroyCalls": 0, + "connected": false, + "display": "none" + } + ], + "coreVersion": "5.4.1" + } + } + ] + }, + "scope": "Callable .default self-reference. Native browser core/media with SDK substitution; actual built SDK export tests stop at destroyed-host registration. No IMA loading/ad playback, namespace reflection equivalence or type reconciliation claim.", + "remaining": [ + "VAST-CONTEXT-01", + "VAST-TYPE-01", + "VAST-DIST-01", + "PKG-VAST-03", + "PKG-VAST-04", + "PKG-VAST-05", + "PKG-VAST-06" + ] +} diff --git a/refactor/changes/2026-09-14-PKG-VAST-07-default-alias.md b/refactor/changes/2026-09-14-PKG-VAST-07-default-alias.md new file mode 100644 index 000000000..d88dbfe32 --- /dev/null +++ b/refactor/changes/2026-09-14-PKG-VAST-07-default-alias.md @@ -0,0 +1,57 @@ +# PKG-VAST-07: retain historical default calls + +Baseline: eb6402fdca910fd39d329d0c26222c4359915150. Independent of the +unresolved eager/lazy initialization decision; task04 depends on this delivery. + +## Implementation and contract + +The frozen npm1.0.0 CommonJS main/legacy exports a namespace with a default +factory; the current workspace main exports a direct function without that +property. Consequently existing JavaScript `require('artplayer-plugin-vast').default(cb)` +fails before registration. The final four-format regression also fails against +the exact pre-change main and ESM files retrieved from Git. + +The entry now assigns `artplayerPluginVast.default = artplayerPluginVast` before +default export, as in other ecosystem compatibility factories. Direct and default +calls reach the same function, preserve closure state and create no wrapper or +SDK load at module evaluation. TypeScript infers the self-reference without casts. +The property is writable/enumerable/configurable. Current exports remain callable; +this is supported historical call compatibility, not recreation of the old +namespace object's `typeof`, keys or identity. Existing namespace-derived reflection +and public declaration reconciliation remain under VAST-DIST-01 and task04/06. + +API-04/05/06/09: original SDK/callback waits, request behavior, Promise result and +cleanup remain unchanged. Initialization defaults, IDs, callback aliases and SDK +settings are not reconciled by this change; VAST-CONTEXT-01 and task03 remain open. +Public declarations, dependency versions, lockfile and package version are unchanged. +The export suite joins existing test:vast/test:unit; no new tool is installed. + +## Validation + +See [evidence and fingerprints](../baselines/vast-alias-validation.json). + +- Initial SDK-controlled alias plus three UMD-format tests: all four fail on the + old source. An initial AMD harness signature error was corrected before this + red result; final errors are missing alias assertions. +- Final bundled CommonJS/global/AMD/ESM tests: four fail on pre-change artifacts, + four pass on actual main+ESM and four on actual legacy+ESM. +- Full VAST suite:65 pass, including historical observations and current lifecycle + assertions. Source alias test covers deferred SDK, deferred callback, request and + cleanup; artifact tests use a destroyed host and do not load Google IMA. +- Strict package TypeScript and targeted source/Node/browser lint pass. A test + import ordering error was corrected. Normal package build regenerates three + formats and docs copies. +- Three desktop engines across old5.1.7, published5.4.1 and candidate core:117 + wrapper browser assertions pass, zero retries/skips. Nine candidate registration + cases use the alias and wait for SDK and callback; other cases keep direct calls. + SDK is controlled, while core DOM/main-video decoding is real. Historical bug + observations remain explicitly historical, not successful compatibility claims. +- Actual Google IMA ad loading/playback, device coverage, full declarations and + installed distribution remain unverified. No VPN exception or remote CI claim. + +## Rollback and remaining work + +Revert this dedicated commit and rebuild VAST to restore the previous exports; +the alias tests then reproduce the broken old call. Continue the initialization +decision in vast-compatibility-decision.md, then complete task03/04 and real SDK +and package acceptance. This task is not overall VAST completion. diff --git a/refactor/plan.md b/refactor/plan.md index a8b6e86cd..70e3671b0 100644 --- a/refactor/plan.md +++ b/refactor/plan.md @@ -2,9 +2,9 @@ > 由 tasks.json 生成。请修改数据后运行 `node refactor/scripts/plan.mjs --write`,不要手改本表。 -基线:`40fcda6a37d0049d42e49c1e64e70d4fd9ba5f7f`。总任务 252 项,范围 22 个包及工作区/示例。 +基线:`40fcda6a37d0049d42e49c1e64e70d4fd9ba5f7f`。总任务 253 项,范围 22 个包及工作区/示例。 -状态:todo 55 / doing 17 / blocked 0 / done 180 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。 +状态:todo 55 / doing 17 / blocked 0 / done 181 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。 前置依赖是启动条件;验收是完成条件。任务可以继续拆分,但不能复用或悄悄删除旧 ID。 @@ -29,7 +29,7 @@ | artplayer-plugin-hls-control | 1.1.0 | PKG-HLS-01, PKG-HLS-02, PKG-HLS-03, PKG-HLS-04, PKG-HLS-SDK-01, PKG-HLS-05, PKG-HLS-06 | | artplayer-plugin-jassub | 1.1.0 | PKG-JASSUB-01, PKG-JASSUB-02, PKG-JASSUB-03, PKG-JASSUB-04, PKG-JASSUB-05, PKG-JASSUB-06, PKG-JASSUB-07, PKG-JASSUB-08, PKG-JASSUB-09 | | artplayer-plugin-multiple-subtitles | 1.2.0 | PKG-MULTI-SUB-01, PKG-MULTI-SUB-02, PKG-MULTI-SUB-03, PKG-MULTI-SUB-04, PKG-MULTI-SUB-07, PKG-MULTI-SUB-08, PKG-MULTI-SUB-05, PKG-MULTI-SUB-06, PKG-MULTI-SUB-09, PKG-MULTI-SUB-10, PKG-MULTI-SUB-11 | -| artplayer-plugin-vast | 1.2.0 | PKG-VAST-01, PKG-VAST-02, PKG-VAST-03, PKG-VAST-04, PKG-VAST-05, PKG-VAST-06 | +| artplayer-plugin-vast | 1.2.0 | PKG-VAST-01, PKG-VAST-02, PKG-VAST-03, PKG-VAST-04, PKG-VAST-05, PKG-VAST-06, PKG-VAST-07 | | artplayer-plugin-vtt-thumbnail | 1.1.0 | PKG-VTT-THUMB-01, PKG-VTT-THUMB-02, PKG-VTT-THUMB-03, PKG-VTT-THUMB-04, PKG-VTT-THUMB-05, PKG-VTT-THUMB-06 | | artplayer-proxy-canvas | 1.1.0 | PKG-AMBILIGHT-PROXY-01, PKG-CANVAS-01, PKG-CANVAS-02, PKG-CANVAS-03, PKG-CANVAS-04, PKG-CANVAS-05, PKG-CANVAS-06, PKG-FACTORY-01 | | artplayer-proxy-mediabunny | 1.2.0 | PKG-MB-01, PKG-MB-02, PKG-MB-03, PKG-MB-04, PKG-MB-05, PKG-MB-06, PKG-MB-07, PKG-MB-08, PKG-MB-09, PKG-MB-10 | @@ -292,9 +292,10 @@ | PKG-VAST-01 | artplayer-plugin-vast
核对包契约与历史用法 | BASE-05 | 异步工厂、callback context、playUrl/playRes/init 与 SDK 版本;实际 npm 1.0.0 与未发布 1.2.0、SDK 1.21.0/1.21.2 的60成员归档和发布关联核心5.1.7 | 源码/声明/README/demo/发布包差异已登记;公开形状和版本范围冻结 | H | done | | PKG-VAST-02 | artplayer-plugin-vast
建立特有行为与错误测试 | PKG-VAST-01, ENG-03, ENG-05 | SDK 失败、重复初始化、广告事件、内容恢复和销毁竞态;发布 id/$container/eager 与工作区 lazy/config 覆盖、callback拒绝、加载中销毁、同毫秒多实例与晚到事件 | 旧版本行为可重跑,成功/失败/切源/销毁有必要断言 | H | done | | PKG-VAST-03 | artplayer-plugin-vast
整理内部职责与资源 | PKG-VAST-02, CORE-10, CORE-13 | SDK loader、IMA adapter、广告状态和 DOM 清理分离;保持发布 callback 别名,明确初始化冲突;核心终止与显式 destroy 后重建区分 | 结构变化和缺陷修复分开记录;原 API/事件/资源生命周期通过 | H | doing | -| PKG-VAST-04 | artplayer-plugin-vast
迁移自有源码和公开类型 | PKG-VAST-03, ENG-04, ENG-06, CORE-07 | IMA/context/Promise 真实类型,外部 SDK 动态对象限定边界;修复 @alugha/ima 声明依赖链,保留 export= 和 require.default 消费;同步错误声明的兼容决策单列 | 严格类型检查、旧消费样例通过;声明路径/导出和同步异步兼容 | H | todo | +| PKG-VAST-04 | artplayer-plugin-vast
迁移自有源码和公开类型 | PKG-VAST-03, ENG-04, ENG-06, CORE-07, PKG-VAST-07 | IMA/context/Promise 真实类型,外部 SDK 动态对象限定边界;修复 @alugha/ima 声明依赖链,保留 export= 和 require.default 消费;同步错误声明的兼容决策单列 | 严格类型检查、旧消费样例通过;声明路径/导出和同步异步兼容 | H | todo | | PKG-VAST-05 | artplayer-plugin-vast
验证新旧核心和组合 | PKG-VAST-04, CORE-22 | 官方测试广告或受控 SDK 环境,错误后主视频状态恢复;核验真实5.1.7/5.4.1/候选核心,VAST VPN外部脚本例外逐项记录,不将受控SDK当作实际IMA验收 | 最终核心与原支持范围核心分别通过;设备/SDK 缺证据不能标完成 | H | todo | | PKG-VAST-06 | artplayer-plugin-vast
验证分发并同步文档 | PKG-VAST-05, ENG-07 | vast.js、SDK 资源、声明消费和独立版本记录;核验实际发布 namespace default、历史深路径、ESM和准确声明,版本按政策2.0.0由REL-09统一处理 | tarball 入口/资源、类型、8082 demo 和 README 一致,有回退记录 | H | todo | +| PKG-VAST-07 | artplayer-plugin-vast
恢复旧发布VAST工厂default调用入口 | PKG-VAST-01, PKG-VAST-02 | 保留当前直接工厂并增加default自身别名,验证四类分发调用及异步注册,初始化决策独立保留 | 旧产物default用例失败,新源码/实际main/legacy/ESM通过;真实核心三浏览器控制SDK注册验证、模块文档/构建/测试入口同步;不冒充namespace反射、声明和IMA验收 | M | done | ## 5 包迁移:artplayer-plugin-chromecast @@ -655,3 +656,4 @@ - PKG-MULTI-SUB-10: [记录](changes/2026-09-14-PKG-MULTI-SUB-10-legacy-captions.md) [记录](baselines/multiple-subtitles-legacy-validation.json) - PKG-MULTI-SUB-11: [记录](changes/2026-09-14-PKG-MULTI-SUB-11-ass-conversion.md) [记录](baselines/multiple-subtitles-ass-validation.json) - PKG-AUTO-THUMB-11: [记录](changes/2026-09-14-PKG-AUTO-THUMB-11-handler-cleanup.md) [记录](baselines/auto-thumbnail-handler-validation.json) +- PKG-VAST-07: [记录](changes/2026-09-14-PKG-VAST-07-default-alias.md) [记录](baselines/vast-alias-validation.json) diff --git a/refactor/progress.md b/refactor/progress.md index c77c22e8c..c972f55fb 100644 --- a/refactor/progress.md +++ b/refactor/progress.md @@ -1,5 +1,16 @@ # 进度与证据 +## PKG-VAST-07 旧default调用兼容完成 + +VAST入口增加default自身别名,恢复旧require(...).default调用并保留现有直接调用。 +四格式测试在旧产物全部失败,实际main+ESM、legacy+ESM各4项通过;完整VAST65项、 +三浏览器117项、CI脚本30项通过。浏览器SDK为受控替身,主视频和DOM为真实核心; +旧缺陷观察仍单列。严格TS和定向lint通过,三格式及docs产物已重建,未修改公开声明。 +见[变更](changes/2026-09-14-PKG-VAST-07-default-alias.md)和[证据](baselines/vast-alias-validation.json)。253项:181 done、17 doing、55 todo。 +VAST已拆成5个TS模块,但03/04仍未完成;初始化冲突已向用户提出具体选择,等待回复。 +原namespace反射、准确声明、真实IMA和最终分发仍未验收。下一步收到选择后继续VAST +初始化兼容;等待期间转向HLS SDK或其他不依赖该决定的剩余包任务。 + ## PKG-AUTO-THUMB-11 抽帧清理异常修复完成 事件属性清除现在与定时器、原生帧回调取消分别执行,单个异常不截断剩余清理。 diff --git a/refactor/risk-table.md b/refactor/risk-table.md index 89f9a8983..c0bb737c6 100644 --- a/refactor/risk-table.md +++ b/refactor/risk-table.md @@ -150,7 +150,7 @@ | VAST-CONTEXT-01 | open / 已复现 | Published VAST callback aliases and eager Player differ from the unpublished lazy workspace | PKG-VAST-02, PKG-VAST-03, PKG-VAST-04 | | VAST-TYPE-01 | open / 已复现 | VAST declares an async factory as synchronous and imports an unavailable SDK type dependency | PKG-VAST-04, PKG-VAST-06 | | VAST-LIFE-01 | open / 已复现 | VAST SDK and container lack core destruction ownership and pending work cancellation | PKG-VAST-02, PKG-VAST-03, PKG-VAST-05 | -| VAST-DIST-01 | open / 已复现 | Published VAST CommonJS default namespace differs from the current callable distribution | PKG-VAST-04, PKG-VAST-06 | +| VAST-DIST-01 | open / 已复现 | Published VAST CommonJS default namespace differs from the current callable distribution | PKG-VAST-04, PKG-VAST-06, PKG-VAST-07 | | AMBILIGHT-LIFE-01 | open / 已复现 | Ambilight sampling and RAF/DOM ownership lack terminal/error handling | PKG-AMBILIGHT-02, PKG-AMBILIGHT-03, PKG-AMBILIGHT-05 | | AMBILIGHT-TYPE-01 | resolved / 已复现 | Ambilight declarations disagree with optional factory argument and differ across published generations | PKG-AMBILIGHT-04, PKG-AMBILIGHT-06 | | AMBILIGHT-DIST-01 | resolved / 已复现 | Ambilight 1.0.0 CommonJS default namespace differs from callable 1.1.0 | PKG-AMBILIGHT-04, PKG-AMBILIGHT-06 | diff --git a/refactor/risks.json b/refactor/risks.json index 963bdf245..9d0efdd0b 100644 --- a/refactor/risks.json +++ b/refactor/risks.json @@ -3301,16 +3301,21 @@ "status": "open", "owners": [ "PKG-VAST-04", - "PKG-VAST-06" + "PKG-VAST-06", + "PKG-VAST-07" ], "evidence": [ "refactor/baselines/vast-contract.md", "refactor/baselines/vast-release.json", "refactor/changes/2026-09-12-PKG-VAST-01-contract.md", - "refactor/baselines/vast-contract-validation.json" + "refactor/baselines/vast-contract-validation.json", + "refactor/changes/2026-09-14-PKG-VAST-07-default-alias.md", + "refactor/baselines/vast-alias-validation.json", + "test/vast-exports.test.js" ], "compatibleResolution": "Preserve require(pkg).default alongside callable factory, script global and current ESM/legacy paths.", - "closureCriteria": "Real packed main/legacy/ESM, historical deep imports, export= consumers and local demo/editor all pass with immutable published comparisons." + "closureCriteria": "Real packed main/legacy/ESM, historical deep imports, export= consumers and local demo/editor all pass with immutable published comparisons.", + "workspaceState": "Task07 restores historical JavaScript .default calls using a callable self-alias. Final four-format tests fail on pre-change main/ESM and pass produced main+ESM and legacy+ESM.65 Node and117 controlled-SDK browser checks pass. Old namespace reflection shape, public declarations, deep paths and installed distribution remain04/06; this risk stays open." }, { "id": "AMBILIGHT-LIFE-01", diff --git a/refactor/tasks.json b/refactor/tasks.json index 94e481c3c..1a95ae201 100644 --- a/refactor/tasks.json +++ b/refactor/tasks.json @@ -3050,7 +3050,8 @@ "PKG-VAST-03", "ENG-04", "ENG-06", - "CORE-07" + "CORE-07", + "PKG-VAST-07" ], "status": "todo", "risk": "H", @@ -5244,6 +5245,26 @@ "changes/2026-09-14-PKG-AUTO-THUMB-11-handler-cleanup.md", "baselines/auto-thumbnail-handler-validation.json" ] + }, + { + "id": "PKG-VAST-07", + "phase": "5 包迁移:artplayer-plugin-vast", + "title": "恢复旧发布VAST工厂default调用入口", + "scope": [ + "artplayer-plugin-vast" + ], + "dependsOn": [ + "PKG-VAST-01", + "PKG-VAST-02" + ], + "status": "done", + "risk": "M", + "deliverable": "保留当前直接工厂并增加default自身别名,验证四类分发调用及异步注册,初始化决策独立保留", + "acceptance": "旧产物default用例失败,新源码/实际main/legacy/ESM通过;真实核心三浏览器控制SDK注册验证、模块文档/构建/测试入口同步;不冒充namespace反射、声明和IMA验收", + "evidence": [ + "changes/2026-09-14-PKG-VAST-07-default-alias.md", + "baselines/vast-alias-validation.json" + ] } ] } diff --git a/refactor/vast-validation.md b/refactor/vast-validation.md index df2aa17d3..cdab3ccc3 100644 --- a/refactor/vast-validation.md +++ b/refactor/vast-validation.md @@ -14,6 +14,14 @@ ## 文件与执行 +PKG-VAST-07补回工厂`.default`自身别名,不改变初始化决策。当前`yarn test:vast` +65项通过;实际main/legacy加ESM各4项导出通过。117项三浏览器检查通过,其中候选 +异步注册场景使用`.default`,其他场景保留直接调用。浏览器仍替换SDK边界,实际 +打包SDK只做无广告的导出/已销毁宿主验证。详见 +[变更](changes/2026-09-14-PKG-VAST-07-default-alias.md)。 + +- `test/vast-exports.test.js`:源码构建或环境变量指定的实际main/legacy/ESM导出。 + 保持现有callable,不宣称复刻旧namespace对象的反射形状;新文件纳入test:vast/test:unit。 - `test/helpers/vast-sdk.js`:可在Node和浏览器使用的SDK记录器,控制加载、构造、 监听、请求、销毁失败和晚到事件;不实现IMA、广告请求或主片暂停恢复。 - `test/helpers/vast.js`:只在精确的`@glomex/vast-ima-player`导入边界替换SDK。 diff --git a/test/browser/vast.spec.js b/test/browser/vast.spec.js index b379aa09c..4f4535692 100644 --- a/test/browser/vast.spec.js +++ b/test/browser/vast.spec.js @@ -47,13 +47,16 @@ for (const core of ['published-5.1.7', 'published', 'candidate']) { const label = `${core} / ${implementation.name}` test(`${label}: async SDK and callback gate real core registration and preserve requests`, async ({ page }, testInfo) => { await setup(page, core, implementation, testInfo, true) - await page.evaluate(() => { + await page.evaluate((useDefault) => { window.vastCalls = 0 window.vastDone = false const gate = new Promise((resolve) => { window.finishVastCallback = resolve }) - window.vastRegistration = window.art.plugins.add(window.artplayerPluginVast(async (context) => { + const factory = window.artplayerPluginVast + if (useDefault && factory.default !== factory) + throw new Error('Historical default calls must share the direct factory') + window.vastRegistration = window.art.plugins.add((useDefault ? factory.default : factory)(async (context) => { window.vastContext = context window.vastCalls++ await gate @@ -62,7 +65,7 @@ for (const core of ['published-5.1.7', 'published', 'candidate']) { })).then(() => { window.vastDone = true }) - }) + }, !implementation.historical) expect(await page.evaluate(() => ({ calls: window.vastCalls, players: window.vastSdk.state.players.length, registered: Object.hasOwn(window.art.plugins, 'artplayerPluginVast') }))).toEqual({ calls: 0, players: 0, registered: false }) await page.evaluate(() => window.vastSdk.resolveLoad()) await expect.poll(() => page.evaluate(() => window.vastCalls)).toBe(1) diff --git a/test/vast-exports.test.js b/test/vast-exports.test.js new file mode 100644 index 000000000..c23da60c5 --- /dev/null +++ b/test/vast-exports.test.js @@ -0,0 +1,61 @@ +import assert from 'node:assert/strict' +import { Buffer } from 'node:buffer' +import fs from 'node:fs' +import process from 'node:process' +// eslint-disable-next-line test/no-import-node-test -- Exercise real bundled SDK exports without external ad loading. +import test from 'node:test' +import vm from 'node:vm' +import { compilePackage } from './helpers/load.js' + +const code = process.env.ARTPLAYER_VAST_ARTIFACT + ? fs.readFileSync(process.env.ARTPLAYER_VAST_ARTIFACT, 'utf8') + : await compilePackage('artplayer-plugin-vast', 'umd') + +for (const format of ['commonjs', 'global', 'amd']) { + test(`VAST ${format} preserves direct and historical default calls on one factory`, async () => { + const window = {} + const box = { window, CustomEvent } + let factory + if (format === 'commonjs') { + box.module = { exports: {} } + box.exports = box.module.exports + } + else if (format === 'amd') { + box.define = (dependencies, create) => { + if (typeof dependencies === 'function') { + factory = dependencies() + } + else { + assert.deepEqual([...dependencies], []) + factory = create() + } + } + box.define.amd = {} + } + vm.runInNewContext(code, box, { timeout: 5000 }) + factory ||= format === 'commonjs' ? box.module.exports : box.artplayerPluginVast || window.artplayerPluginVast + assert.equal(typeof factory, 'function') + assert.equal(factory.default, factory) + assert.equal(factory.default.default, factory) + assert.deepEqual(Object.getOwnPropertyDescriptor(factory, 'default'), { value: factory, writable: true, enumerable: true, configurable: true }) + for (const entry of [factory, factory.default]) { + const pending = entry(() => assert.fail('A destroyed core cannot receive a callback'))({ isDestroy: true }) + assert.equal(typeof pending.then, 'function') + const result = await pending + assert.equal(result.name, 'artplayerPluginVast') + assert.equal(result.destroy(), undefined) + } + }) +} + +test('VAST ESM default import retains the same callable alias', async () => { + const esm = process.env.ARTPLAYER_VAST_ESM_ARTIFACT + ? fs.readFileSync(process.env.ARTPLAYER_VAST_ESM_ARTIFACT, 'utf8') + : await compilePackage('artplayer-plugin-vast', 'es') + const { default: factory } = await import(`data:text/javascript;base64,${Buffer.from(esm).toString('base64')}`) + assert.equal(typeof factory, 'function') + assert.equal(factory.default, factory) + const pending = factory.default()({ isDestroy: true }) + assert.equal(typeof pending.then, 'function') + assert.equal((await pending).name, 'artplayerPluginVast') +}) diff --git a/test/vast.test.js b/test/vast.test.js index fcd7d3669..f93bca95e 100644 --- a/test/vast.test.js +++ b/test/vast.test.js @@ -5,6 +5,30 @@ import { deferred, vastEnvironment, vastImplementations } from './helpers/vast.j const implementations = await vastImplementations() +test('VAST source default alias preserves deferred registration, requests and cleanup', async () => { + const env = vastEnvironment(implementations.find(item => item.name === 'source'), { deferLoad: true }) + const host = env.host() + assert.equal(env.factory.default, env.factory) + const gate = deferred() + const started = deferred() + const pending = env.factory.default(async (context) => { + started.resolve(context) + await gate.promise + context.playUrl('/alias.xml') + })(host.art) + assert.equal(typeof pending.then, 'function') + assert.equal(env.state.players.length, 0) + env.resolveLoad() + await started.promise + gate.resolve() + const result = await pending + assert.equal(result.name, 'artplayerPluginVast') + assert.equal(env.state.players[0].requests[0].adTagUrl, '/alias.xml') + host.art.destroy() + assert.equal(host.parent.children.length, 0) + assert.equal(env.state.players[0].destroyCalls, 1) +}) + for (const implementation of implementations) { const { name, published } = implementation test(`${name}: SDK resolution precedes callback and result waits for callback completion`, async () => {