build all

Refactor utility functions for improved readability and consistency

- Updated compatibility.js to use consistent line endings and formatting.
- Refactored component.js for better readability and structure, including consistent use of arrow functions and binding.
- Simplified dom.js functions with consistent formatting and improved readability.
- Enhanced emitter.js with consistent formatting and arrow function usage.
- Streamlined error.js for improved readability and consistency.
- Refactored file.js to use consistent formatting and improved readability.
- Improved format.js functions for better readability and consistency.
- Updated index.js to maintain consistent export formatting.
- Refactored property.js for improved readability and consistency.
- Enhanced subtitle.js with consistent formatting and improved readability.
- Refactored time.js for better readability and consistent formatting.

fix: update lint script to target only source files for consistency

Revert "fix: restore export statements for various plugins and update type definitions for better clarity"

This reverts commit b5e969d81ec765cd8a34b06e6ef4f232ef25087f.

fix: restore export statements for various plugins and update type definitions for better clarity

Refactor type definitions to use interfaces instead of type aliases for better extensibility and clarity across i18n, icons, option, player, quality, setting, subtitle, template, and utils modules.
This commit is contained in:
Harvey Zack committed 2025-08-03 13:17:33 +08:00
1 parent 532dd67cfd
commit 35ad9883af
447 files changed
+18248 -17946

No files matched your search

@@ -5,5 +5,5 @@
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,r,t,n,o,i,u,l){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof f[n]&&f[n],d=a.i||{},c=a.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(r,t){if(!c[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof f[n]&&f[n];if(!t&&i)return i(r,!0);if(a)return a(r,!0);if(p&&"string"==typeof r)return p(r);var u=Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}d.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},d.cache={};var l=c[r]=new s.Module(r);e[r][0].call(l.exports,d,l,l.exports,f)}return c[r].exports;function d(e){var r=d.resolve(e);return!1===r?{}:s(r)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.require=p,this.exports={}},s.modules=e,s.cache=c,s.parent=a,s.distDir=void 0,s.publicUrl=void 0,s.devServer=void 0,s.i=d,s.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(s,"root",{get:function(){return f[n]}}),f[n]=s;for(var m=0;m<r.length;m++)s(r[m]);if(t){var y=s(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=y:"function"==typeof define&&define.amd&&define(function(){return y})}}({"4omrA":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e={}){return r=>{var t,n,o,i,u,l,f;let{$video:a}=r.template,{createElement:d,addClass:c,setStyles:p}=r.constructor.utils,{blur:s="50px",opacity:m=.5,frequency:y=10,duration:g=.3}=e,b=d("div"),h=((t=b).innerHTML=Array(9).fill("<div></div>").join(""),Array.from(t.children));n=b,o=a,c(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),p(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=h,u=s,l=m,f=g,i.forEach(e=>{p(e,{opacity:l,filter:`blur(${u})`,transition:`background-color ${f}s ease`})});let v=function(e,t,n){let o=d("canvas"),i=o.getContext("2d");o.width=3,o.height=3;let u=0;return function o(){let l=performance.now();if(l-u<1e3/n||!r.playing){w=requestAnimationFrame(o);return}u=l;let f=e.videoWidth/3,a=e.videoHeight/3,d=[[0,0],[f,0],[2*f,0],[0,a],[f,a],[2*f,a],[0,2*a],[f,2*a],[2*f,2*a]].map(([r,t])=>(function(r,t,n,o){i.drawImage(e,r,t,n,o,0,0,1,1);let[u,l,f]=i.getImageData(0,0,1,1).data;return`rgb(${u}, ${l}, ${f})`})(r,t,f,a));t.forEach((e,r)=>{e.style.backgroundColor=d[r]}),w=requestAnimationFrame(o)}}(a,h,y),w=null;function x(){w||v()}function j(){w&&(cancelAnimationFrame(w),w=null)}return r.on("ready",x),r.on("destroy",j),{name:"artplayerPluginAmbilight",start:x,stop:j}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"w4pLy"}],w4pLy:[function(e,r,t,n){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,r){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return e[t]}})}),r},t.export=function(e,r,t){Object.defineProperty(e,r,{enumerable:!0,get:t})}},{}]},["4omrA"],"4omrA","parcelRequireb9c8",{});let{default:e}=parcelRequireb9c8("4omrA");export{e as default};
!function(e,r,t,n,o,i,l,u){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof f[n]&&f[n],d=a.i||{},c=a.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!c[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof f[n]&&f[n];if(!t&&i)return i(r,!0);if(a)return a(r,!0);if(s&&"string"==typeof r)return s(r);var l=Error("Cannot find module '"+r+"'");throw l.code="MODULE_NOT_FOUND",l}d.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},d.cache={};var u=c[r]=new p.Module(r);e[r][0].call(u.exports,d,u,u.exports,f)}return c[r].exports;function d(e){var r=d.resolve(e);return!1===r?{}:p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=a,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return f[n]}}),f[n]=p;for(var m=0;m<r.length;m++)p(r[m]);if(t){var g=p(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"9P7rs":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e={}){return r=>{var t,n,o,i,l,u,f;let{$video:a}=r.template,{createElement:d,addClass:c,setStyles:s}=r.constructor.utils,{blur:p="50px",opacity:m=.5,frequency:g=10,duration:y=.3}=e,h=d("div"),b=((t=h).innerHTML=Array.from({length:9}).fill("<div></div>").join(""),Array.from(t.children));n=h,o=a,c(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),s(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=b,l=p,u=m,f=y,i.forEach(e=>{s(e,{opacity:u,filter:`blur(${l})`,transition:`background-color ${f}s ease`})});let v=function(e,t,n){let o=d("canvas"),i=o.getContext("2d");o.width=3,o.height=3;let l=0;return function o(){let u=performance.now();if(u-l<1e3/n||!r.playing){w=requestAnimationFrame(o);return}l=u;let f=e.videoWidth/3,a=e.videoHeight/3,d=[[0,0],[f,0],[2*f,0],[0,a],[f,a],[2*f,a],[0,2*a],[f,2*a],[2*f,2*a]].map(([r,t])=>(function(r,t,n,o){i.drawImage(e,r,t,n,o,0,0,1,1);let[l,u,f]=i.getImageData(0,0,1,1).data;return`rgb(${l}, ${u}, ${f})`})(r,t,f,a));t.forEach((e,r)=>{e.style.backgroundColor=d[r]}),w=requestAnimationFrame(o)}}(a,b,g),w=null;function x(){w||v()}function j(){w&&(cancelAnimationFrame(w),w=null)}return r.on("ready",x),r.on("destroy",j),{name:"artplayerPluginAmbilight",start:x,stop:j}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"5lQoW"}],"5lQoW":[function(e,r,t,n){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,r){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return e[t]}})}),r},t.export=function(e,r,t){Object.defineProperty(e,r,{enumerable:!0,get:t})}},{}]},["9P7rs"],"9P7rs","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("9P7rs");export{e as default};
//# sourceMappingURL=artplayer-plugin-ambilight.esm.js.map
@@ -1 +1 @@
{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,A,Y,O,C,C,E,E,C,C,E,C,E,E,C,E,C,E,E,E,K,E,C,E,E,A,a,O,Q,A,Y,O,O,O,E,O,O,C,I,C,Q,S,E,C,C,C,E,G,C,C,C,E,C,C,G,C,C,C,E,C,C,G,C,C,E,C,O,C,C,E,C,I,E,A,Y,O,C,C,E,E,C,C,E,C,G,C,G,E,O,E,E,C,G,G,E,O,E,E,C,G,G,G,A,U,O,E,O,E,G,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,O,C,S,C,E,I,E,C,C,E,C,E,C,E,C,O,A,M,E,E,C,E,E,K,C,C,E,I,E,C,C,E,C,I,E,M,C,G,C,C,E,C,E,C,I,C,E,O,C,E,E,E,O,C,E,C,O,C,C,E,C,O,C,S,E,C,E,I,E,E,O,C,G,M,A,C,I,E,C,E,E,E,C,C,E,e,C,C,E,E,M,C,S,C,E,I,C,E,C,E,I,C,M,C,E,I,C,O,C,E,I,C,O,C,C,C,E,E,O,C,E,E,K,C,E,E,M,C,E,E,O,C,K,E,E,S,C,K,E,E,S,C,K,E,E,C,C,E,E,Q,C,S,C,C,C,E,C,C,E,C,C,S,C,C,C,E,E,O,C,C,E,C,E,A,E,O,c,C,E,O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AAqB,GACrB,EAAmB,KAE3B,CAKA,OAHA,EAAI,EAAE,CAAC,QAAS,GAChB,EAAI,EAAE,CAAC,UAAW,GAEX,CACH,KAAM,2BACN,MAAA,EACA,KAAA,CACJ,CA6EJ,CACJ,C,E,iB,C,GAlHwB,EAAA,MAAA,CAAA,EAAA,UAAA,IAAA,GAoHpB,AAAkB,aAAlB,OAAO,QACP,CAAA,OAAO,wBAA2B,CAAG,CADzC,C,E,C,iD,O,E,C,M,C,S,C,C,C,C,C,C,C,ECpHA,EAAQ,cAAc,CAAG,SAAU,CAAC,EAClC,OAAO,GAAK,EAAE,UAAU,CAAG,EAAI,CAAC,QAAS,CAAC,CAC5C,EAEA,EAAQ,iBAAiB,CAAG,SAAU,CAAC,EACrC,OAAO,cAAc,CAAC,EAAG,aAAc,CAAC,MAAO,CAAA,CAAI,EACrD,EAEA,EAAQ,SAAS,CAAG,SAAU,CAAM,CAAE,CAAI,EAkBxC,OAjBA,OAAO,IAAI,CAAC,GAAQ,OAAO,CAAC,SAAU,CAAG,EAE7B,YAAR,GACA,AAAQ,eAAR,GACA,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,EAAM,IAK7C,OAAO,cAAc,CAAC,EAAM,EAAK,CAC/B,WAAY,CAAA,EACZ,IAAK,WACH,OAAO,CAAM,CAAC,EAAI,AACpB,CACF,EACF,GAEO,CACT,EAEA,EAAQ,MAAM,CAAG,SAAU,CAAI,CAAE,CAAQ,CAAE,CAAG,EAC5C,OAAO,cAAc,CAAC,EAAM,EAAU,CACpC,WAAY,CAAA,EACZ,IAAK,CACP,EACF,C,E,C,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["<anon>","src/index.js","../../node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (\n modules,\n entry,\n mainEntry,\n parcelRequireName,\n externals,\n distDir,\n publicUrl,\n devServer\n) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var importMap = previousRequire.i || {};\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof module.require === 'function' &&\n module.require.bLine truncated
{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,A,Y,O,C,C,E,E,C,C,E,C,E,E,C,E,C,E,E,E,K,E,C,E,E,A,a,O,Q,A,Y,O,O,O,E,O,O,C,I,C,Q,S,E,C,C,C,E,G,C,C,C,E,C,C,G,C,C,C,E,C,C,G,C,C,E,C,O,C,C,E,C,I,E,A,Y,O,C,C,E,E,C,C,E,C,G,C,G,E,O,E,E,C,G,G,E,O,E,E,C,G,G,G,A,U,O,E,O,E,G,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,O,C,S,C,E,I,E,C,C,E,C,E,C,E,C,O,A,M,E,E,C,E,E,K,C,C,E,I,E,C,C,E,C,I,E,M,C,G,C,C,E,C,E,C,I,C,E,O,C,E,E,E,O,C,E,C,O,C,C,E,C,O,C,S,E,C,E,I,E,E,O,C,G,M,A,C,I,E,C,E,E,E,C,C,E,e,C,C,E,E,M,C,S,C,E,I,C,E,C,E,I,C,M,C,E,I,C,O,C,E,I,C,O,C,C,C,E,E,O,C,E,E,K,C,E,E,M,C,E,E,O,C,K,E,E,S,C,K,E,E,S,C,K,E,E,C,C,E,E,Q,C,S,C,C,C,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EAAQ,EAAW,GAEvD,EAAmB,KAEvB,SAAS,IACH,AAAC,GACH,GAEJ,CAEA,SAAS,IACH,IACF,qBAAqB,GACrB,EAAmB,KAEvB,CAKA,OAHA,EAAI,EAAE,CAAC,QAAS,GAChB,EAAI,EAAE,CAAC,UAAW,GAEX,CACL,KAAM,2BACN,MAAA,EACA,KAAA,CACF,CA6EF,CACF,C,E,iB,C,GAlHwB,EAAA,MAAA,CAAA,EAAA,UAAA,IAAA,GAoHpB,AAAkB,aAAlB,OAAO,QACT,CAAA,OAAO,wBAAwB,CAAG,CADpC,C,E,C,iD,O,E,C,Q,C,S,C,C,C,C,C,C,C,ECpHA,EAAQ,cAAc,CAAG,SAAU,CAAC,EAClC,OAAO,GAAK,EAAE,UAAU,CAAG,EAAI,CAAC,QAAS,CAAC,CAC5C,EAEA,EAAQ,iBAAiB,CAAG,SAAU,CAAC,EACrC,OAAO,cAAc,CAAC,EAAG,aAAc,CAAC,MAAO,CAAA,CAAI,EACrD,EAEA,EAAQ,SAAS,CAAG,SAAU,CAAM,CAAE,CAAI,EAkBxC,OAjBA,OAAO,IAAI,CAAC,GAAQ,OAAO,CAAC,SAAU,CAAG,EAE7B,YAAR,GACA,AAAQ,eAAR,GACA,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,EAAM,IAK7C,OAAO,cAAc,CAAC,EAAM,EAAK,CAC/B,WAAY,CAAA,EACZ,IAAK,WACH,OAAO,CAAM,CAAC,EAAI,AACpB,CACF,EACF,GAEO,CACT,EAEA,EAAQ,MAAM,CAAG,SAAU,CAAI,CAAE,CAAQ,CAAE,CAAG,EAC5C,OAAO,cAAc,CAAC,EAAM,EAAU,CACpC,WAAY,CAAA,EACZ,IAAK,CACP,EACF,C,E,C,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["<anon>","packages/artplayer-plugin-ambilight/src/index.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (\n modules,\n entry,\n mainEntry,\n parcelRequireName,\n externals,\n distDir,\n publicUrl,\n devServer\n) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var importMap = previousRequire.i || {};\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof Line truncated
@@ -5,4 +5,4 @@
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,r,t,n,o,i,u,l){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof f[n]&&f[n],d=a.i||{},c=a.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!c[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof f[n]&&f[n];if(!t&&i)return i(r,!0);if(a)return a(r,!0);if(s&&"string"==typeof r)return s(r);var u=Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}d.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},d.cache={};var l=c[r]=new p.Module(r);e[r][0].call(l.exports,d,l,l.exports,f)}return c[r].exports;function d(e){var r=d.resolve(e);return!1===r?{}:p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=a,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return f[n]}}),f[n]=p;for(var m=0;m<r.length;m++)p(r[m]);if(t){var g=p(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({jz4E5:[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e={}){return r=>{var t,n,o,i,u,l,f;let{$video:a}=r.template,{createElement:d,addClass:c,setStyles:s}=r.constructor.utils,{blur:p="50px",opacity:m=.5,frequency:g=10,duration:y=.3}=e,h=d("div"),b=((t=h).innerHTML=Array(9).fill("<div></div>").join(""),Array.from(t.children));n=h,o=a,c(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),s(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=b,u=p,l=m,f=y,i.forEach(e=>{s(e,{opacity:l,filter:`blur(${u})`,transition:`background-color ${f}s ease`})});let v=function(e,t,n){let o=d("canvas"),i=o.getContext("2d");o.width=3,o.height=3;let u=0;return function o(){let l=performance.now();if(l-u<1e3/n||!r.playing){j=requestAnimationFrame(o);return}u=l;let f=e.videoWidth/3,a=e.videoHeight/3,d=[[0,0],[f,0],[2*f,0],[0,a],[f,a],[2*f,a],[0,2*a],[f,2*a],[2*f,2*a]].map(([r,t])=>(function(r,t,n,o){i.drawImage(e,r,t,n,o,0,0,1,1);let[u,l,f]=i.getImageData(0,0,1,1).data;return`rgb(${u}, ${l}, ${f})`})(r,t,f,a));t.forEach((e,r)=>{e.style.backgroundColor=d[r]}),j=requestAnimationFrame(o)}}(a,b,g),j=null;function w(){j||v()}function x(){j&&(cancelAnimationFrame(j),j=null)}return r.on("ready",w),r.on("destroy",x),{name:"artplayerPluginAmbilight",start:w,stop:x}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"7o2zS"}],"7o2zS":[function(e,r,t,n){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,r){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return e[t]}})}),r},t.export=function(e,r,t){Object.defineProperty(e,r,{enumerable:!0,get:t})}},{}]},["jz4E5"],"jz4E5","parcelRequireb9c8",{});
!function(e,r,t,n,o,i,u,l){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof f[n]&&f[n],d=a.i||{},c=a.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!c[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof f[n]&&f[n];if(!t&&i)return i(r,!0);if(a)return a(r,!0);if(s&&"string"==typeof r)return s(r);var u=Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}d.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},d.cache={};var l=c[r]=new p.Module(r);e[r][0].call(l.exports,d,l,l.exports,f)}return c[r].exports;function d(e){var r=d.resolve(e);return!1===r?{}:p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=a,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return f[n]}}),f[n]=p;for(var m=0;m<r.length;m++)p(r[m]);if(t){var g=p(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"2PWBI":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e={}){return r=>{var t,n,o,i,u,l,f;let{$video:a}=r.template,{createElement:d,addClass:c,setStyles:s}=r.constructor.utils,{blur:p="50px",opacity:m=.5,frequency:g=10,duration:y=.3}=e,h=d("div"),b=((t=h).innerHTML=Array.from({length:9}).fill("<div></div>").join(""),Array.from(t.children));n=h,o=a,c(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),s(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=b,u=p,l=m,f=y,i.forEach(e=>{s(e,{opacity:l,filter:`blur(${u})`,transition:`background-color ${f}s ease`})});let v=function(e,t,n){let o=d("canvas"),i=o.getContext("2d");o.width=3,o.height=3;let u=0;return function o(){let l=performance.now();if(l-u<1e3/n||!r.playing){w=requestAnimationFrame(o);return}u=l;let f=e.videoWidth/3,a=e.videoHeight/3,d=[[0,0],[f,0],[2*f,0],[0,a],[f,a],[2*f,a],[0,2*a],[f,2*a],[2*f,2*a]].map(([r,t])=>(function(r,t,n,o){i.drawImage(e,r,t,n,o,0,0,1,1);let[u,l,f]=i.getImageData(0,0,1,1).data;return`rgb(${u}, ${l}, ${f})`})(r,t,f,a));t.forEach((e,r)=>{e.style.backgroundColor=d[r]}),w=requestAnimationFrame(o)}}(a,b,g),w=null;function x(){w||v()}function j(){w&&(cancelAnimationFrame(w),w=null)}return r.on("ready",x),r.on("destroy",j),{name:"artplayerPluginAmbilight",start:x,stop:j}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,r,t,n){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,r){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return e[t]}})}),r},t.export=function(e,r,t){Object.defineProperty(e,r,{enumerable:!0,get:t})}},{}]},["2PWBI"],"2PWBI","parcelRequire4dc0",{});
@@ -5,4 +5,4 @@
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,r,t,n,o,i,a,u){var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof c[n]&&c[n],l=f.i||{},d=f.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof c[n]&&c[n];if(!t&&i)return i(r,!0);if(f)return f(r,!0);if(s&&"string"==typeof r)return s(r);var a=Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},l.cache={};var u=d[r]=new p.Module(r);e[r][0].call(u.exports,l,u,u.exports,c)}return d[r].exports;function l(e){var r=l.resolve(e);return!1===r?{}:p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return c[n]}}),c[n]=p;for(var y=0;y<r.length;y++)p(r[y]);if(t){var v=p(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({bzF6W:[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(t),o.export(t,"default",function(){return a});var i=e("@swc/helpers/cjs/_sliced_to_array.cjs");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t,n,o,a,u,c,f,l,d,s,p,y,v,m=r.template.$video,b=r.constructor.utils,g=b.createElement,h=b.addClass,_=b.setStyles,w=e.blur,j=e.opacity,x=e.frequency,A=e.duration,O=g("div"),I=((t=O).innerHTML=Array(9).fill("<div></div>").join(""),Array.from(t.children));n=O,o=m,h(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),_(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),a=I,u=void 0===w?"50px":w,c=void 0===j?.5:j,f=void 0===A?.3:A,a.forEach(function(e){_(e,{opacity:c,filter:"blur(".concat(u,")"),transition:"background-color ".concat(f,"s ease")})});var M=(l=m,d=I,s=void 0===x?10:x,y=(p=g("canvas")).getContext("2d"),p.width=3,p.height=3,v=0,function e(){var t=performance.now();if(t-v<1e3/s||!r.playing){E=requestAnimationFrame(e);return}v=t;var n=l.videoWidth/3,o=l.videoHeight/3,a=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(function(e){var r,t,a,u,c=(0,i._)(e,2),f=c[0],d=c[1];return y.drawImage(l,f,d,n,o,0,0,1,1),t=(r=(0,i._)(y.getImageData(0,0,1,1).data,3))[0],a=r[1],u=r[2],"rgb(".concat(t,", ").concat(a,", ").concat(u,")")});d.forEach(function(e,r){e.style.backgroundColor=a[r]}),E=requestAnimationFrame(e)}),E=null;function F(){E||M()}function S(){E&&(cancelAnimationFrame(E),E=null)}return r.on("ready",F),r.on("destroy",S),{name:"artplayerPluginAmbilight",start:F,stop:S}}}"undefined"!=typeof window&&(window.artplayerPluginAmbilight=a)},{"@swc/helpers/cjs/_sliced_to_array.cjs":"69dwW","@parcel/transformer-js/src/esmodule-helpers.js":"ihnSZ"}],"69dwW":[function(e,r,t,n){"use strict";var o=e("1c05c980d01d7095"),i=e("d604d0840046159b"),a=e("9ac1542249932d1a"),u=e("d04f777c592843b");t._=function(e,r){return o._(e)||i._(e,r)||u._(e,r)||a._()}},{"1c05c980d01d7095":"dgv90",d604d0840046159b:"8f1n5","9ac1542249932d1a":"edvMI",d04f777c592843b:"ikxEb"}],dgv90:[function(e,r,t,n){"use strict";t._=function(e){if(Array.isArray(e))return e}},{}],"8f1n5":[function(e,r,t,n){"use strict";t._=function(e,r){var t,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}},{}],edvMI:[function(e,r,t,n){"use strict";t._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],ikxEb:[function(e,r,t,n){"use strict";var o=e("3202629de7a6dd0f");t._=function(e,r){if(e){if("string"==typeof e)return o._(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o._(e,r)}}},{"3202629de7a6dd0f":"8HLaN"}],"8HLaN":[function(e,r,t,n){"use strict";t._=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}},{}],ihnSZ:[function(e,r,t,n){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,r){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwLine truncated
!function(e,r,t,n,o,i,a,u){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof f[n]&&f[n],l=c.i||{},d=c.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof f[n]&&f[n];if(!t&&i)return i(r,!0);if(c)return c(r,!0);if(s&&"string"==typeof r)return s(r);var a=Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},l.cache={};var u=d[r]=new p.Module(r);e[r][0].call(u.exports,l,u,u.exports,f)}return d[r].exports;function l(e){var r=l.resolve(e);return!1===r?{}:p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=c,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return f[n]}}),f[n]=p;for(var y=0;y<r.length;y++)p(r[y]);if(t){var m=p(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"8Uro8":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(t),o.export(t,"default",function(){return a});var i=e("@swc/helpers/cjs/_sliced_to_array.cjs");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t,n,o,a,u,f,c,l,d,s,p,y,m,v=r.template.$video,h=r.constructor.utils,g=h.createElement,b=h.addClass,_=h.setStyles,j=e.blur,w=e.opacity,x=e.frequency,A=e.duration,S=g("div"),O=((t=S).innerHTML=Array.from({length:9}).fill("<div></div>").join(""),Array.from(t.children));n=S,o=v,b(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),_(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),a=O,u=void 0===j?"50px":j,f=void 0===w?.5:w,c=void 0===A?.3:A,a.forEach(function(e){_(e,{opacity:f,filter:"blur(".concat(u,")"),transition:"background-color ".concat(c,"s ease")})});var M=(l=v,d=O,s=void 0===x?10:x,y=(p=g("canvas")).getContext("2d"),p.width=3,p.height=3,m=0,function e(){var t=performance.now();if(t-m<1e3/s||!r.playing){q=requestAnimationFrame(e);return}m=t;var n=l.videoWidth/3,o=l.videoHeight/3,a=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(function(e){var r,t,a,u,f=(0,i._)(e,2),c=f[0],d=f[1];return y.drawImage(l,c,d,n,o,0,0,1,1),t=(r=(0,i._)(y.getImageData(0,0,1,1).data,3))[0],a=r[1],u=r[2],"rgb(".concat(t,", ").concat(a,", ").concat(u,")")});d.forEach(function(e,r){e.style.backgroundColor=a[r]}),q=requestAnimationFrame(e)}),q=null;function I(){q||M()}function P(){q&&(cancelAnimationFrame(q),q=null)}return r.on("ready",I),r.on("destroy",P),{name:"artplayerPluginAmbilight",start:I,stop:P}}}"undefined"!=typeof window&&(window.artplayerPluginAmbilight=a)},{"@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],gIQTH:[function(e,r,t,n){"use strict";var o=e("d7c30a5ae0c1ab2"),i=e("3aacfce52f67defd"),a=e("f0dae09a1a08b16a"),u=e("83f3648e614d0830");t._=function(e,r){return o._(e)||i._(e,r)||u._(e,r)||a._()}},{d7c30a5ae0c1ab2:"3QSPl","3aacfce52f67defd":"5SSeo",f0dae09a1a08b16a:"heYSj","83f3648e614d0830":"fh7mx"}],"3QSPl":[function(e,r,t,n){"use strict";t._=function(e){if(Array.isArray(e))return e}},{}],"5SSeo":[function(e,r,t,n){"use strict";t._=function(e,r){var t,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}},{}],heYSj:[function(e,r,t,n){"use strict";t._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,r,t,n){"use strict";var o=e("3ee51b7dc02d0c44");t._=function(e,r){if(e){if("string"==typeof e)return o._(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o._(e,r)}}},{"3ee51b7dc02d0c44":"1WOAB"}],"1WOAB":[function(e,r,t,n){"use strict";t._=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t<r;t++)n[t]=e[t];return n}},{}],qpMMf:[function(e,r,t,n){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,r){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||ObjectLine truncated
@@ -1,30 +1,30 @@
{
"license": "MIT",
"version": "1.0.0",
"name": "artplayer-plugin-ambilight",
"description": "ambilight plugin for ArtPlayer",
"main": "dist/artplayer-plugin-ambilight.js",
"legacy": "dist/artplayer-plugin-ambilight.legacy.js",
"module": "dist/artplayer-plugin-ambilight.esm.js",
"types": "types/artplayer-plugin-ambilight.d.ts",
"exports": {
"import": "./dist/artplayer-plugin-ambilight.esm.js",
"require": "./dist/artplayer-plugin-ambilight.js",
"default": "./dist/artplayer-plugin-ambilight.js"
},
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
"browserslist": "last 1 Chrome version",
"homepage": "https://artplayer.org",
"repository": {
"type": "git",
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
},
"bugs": {
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
},
"keywords": [
"html5",
"video",
"player"
]
"name": "artplayer-plugin-ambilight",
"version": "1.0.0",
"description": "ambilight plugin for ArtPlayer",
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
"license": "MIT",
"homepage": "https://artplayer.org",
"repository": {
"type": "git",
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
},
"bugs": {
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
},
"keywords": [
"html5",
"video",
"player"
],
"exports": {
"import": "./dist/artplayer-plugin-ambilight.esm.js",
"require": "./dist/artplayer-plugin-ambilight.js",
"default": "./dist/artplayer-plugin-ambilight.js"
},
"main": "dist/artplayer-plugin-ambilight.js",
"legacy": "dist/artplayer-plugin-ambilight.legacy.js",
"module": "dist/artplayer-plugin-ambilight.esm.js",
"types": "types/artplayer-plugin-ambilight.d.ts",
"browserslist": "last 1 Chrome version"
}
+103 -103
View File
@@ -1,119 +1,119 @@
export default function artplayerPluginAmbilight(option = {}) {
return (art) => {
const { $video } = art.template;
const { createElement, addClass, setStyles } = art.constructor.utils;
const { blur = '50px', opacity = 0.5, frequency = 10, duration = 0.3 } = option;
return (art) => {
const { $video } = art.template
const { createElement, addClass, setStyles } = art.constructor.utils
const { blur = '50px', opacity = 0.5, frequency = 10, duration = 0.3 } = option
const $ambilight = createElement('div');
const gridItems = createGridItems($ambilight);
const $ambilight = createElement('div')
const gridItems = createGridItems($ambilight)
setupAmbilight($ambilight, $video);
setupGridItems(gridItems, blur, opacity, duration);
setupAmbilight($ambilight, $video)
setupGridItems(gridItems, blur, opacity, duration)
const updateColors = createColorUpdater($video, gridItems, frequency);
const updateColors = createColorUpdater($video, gridItems, frequency)
let animationFrameId = null;
let animationFrameId = null
function start() {
if (!animationFrameId) {
updateColors();
}
function start() {
if (!animationFrameId) {
updateColors()
}
}
function stop() {
if (animationFrameId) {
cancelAnimationFrame(animationFrameId)
animationFrameId = null
}
}
art.on('ready', start)
art.on('destroy', stop)
return {
name: 'artplayerPluginAmbilight',
start,
stop,
}
function createGridItems($ambilight) {
$ambilight.innerHTML = Array.from({ length: 9 }).fill('<div></div>').join('')
return Array.from($ambilight.children)
}
function setupAmbilight($ambilight, $video) {
addClass($ambilight, 'artplayer-plugin-ambilight')
$video.parentNode.insertBefore($ambilight, $video)
setStyles($ambilight, {
position: 'absolute',
top: 0,
left: 0,
zIndex: 9,
inset: 0,
display: 'grid',
gridTemplateColumns: '1fr 1fr 1fr',
gridTemplateRows: '1fr 1fr 1fr',
})
}
function setupGridItems(gridItems, blur, opacity, duration) {
gridItems.forEach(($item) => {
setStyles($item, {
opacity,
filter: `blur(${blur})`,
transition: `background-color ${duration}s ease`,
})
})
}
function createColorUpdater($video, gridItems, frequency) {
const canvas = createElement('canvas')
const ctx = canvas.getContext('2d')
canvas.width = 3
canvas.height = 3
function getAverageColor(x, y, w, h) {
ctx.drawImage($video, x, y, w, h, 0, 0, 1, 1)
const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data
return `rgb(${r}, ${g}, ${b})`
}
let lastUpdateTime = 0
return function updateColors() {
const now = performance.now()
if (now - lastUpdateTime < 1000 / frequency || !art.playing) {
animationFrameId = requestAnimationFrame(updateColors)
return
}
function stop() {
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
}
lastUpdateTime = now
art.on('ready', start);
art.on('destroy', stop);
const w = $video.videoWidth / 3
const h = $video.videoHeight / 3
return {
name: 'artplayerPluginAmbilight',
start,
stop,
};
const colors = [
[0, 0],
[w, 0],
[2 * w, 0],
[0, h],
[w, h],
[2 * w, h],
[0, 2 * h],
[w, 2 * h],
[2 * w, 2 * h],
].map(([x, y]) => getAverageColor(x, y, w, h))
function createGridItems($ambilight) {
$ambilight.innerHTML = Array(9).fill('<div></div>').join('');
return Array.from($ambilight.children);
}
gridItems.forEach(($item, index) => {
$item.style.backgroundColor = colors[index]
})
function setupAmbilight($ambilight, $video) {
addClass($ambilight, 'artplayer-plugin-ambilight');
$video.parentNode.insertBefore($ambilight, $video);
setStyles($ambilight, {
position: 'absolute',
top: 0,
left: 0,
zIndex: 9,
inset: 0,
display: 'grid',
gridTemplateColumns: '1fr 1fr 1fr',
gridTemplateRows: '1fr 1fr 1fr',
});
}
function setupGridItems(gridItems, blur, opacity, duration) {
gridItems.forEach(($item) => {
setStyles($item, {
opacity,
filter: `blur(${blur})`,
transition: `background-color ${duration}s ease`,
});
});
}
function createColorUpdater($video, gridItems, frequency) {
const canvas = createElement('canvas');
const ctx = canvas.getContext('2d');
canvas.width = 3;
canvas.height = 3;
function getAverageColor(x, y, w, h) {
ctx.drawImage($video, x, y, w, h, 0, 0, 1, 1);
const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data;
return `rgb(${r}, ${g}, ${b})`;
}
let lastUpdateTime = 0;
return function updateColors() {
const now = performance.now();
if (now - lastUpdateTime < 1000 / frequency || !art.playing) {
animationFrameId = requestAnimationFrame(updateColors);
return;
}
lastUpdateTime = now;
const w = $video.videoWidth / 3;
const h = $video.videoHeight / 3;
const colors = [
[0, 0],
[w, 0],
[2 * w, 0],
[0, h],
[w, h],
[2 * w, h],
[0, 2 * h],
[w, 2 * h],
[2 * w, 2 * h],
].map(([x, y]) => getAverageColor(x, y, w, h));
gridItems.forEach(($item, index) => {
$item.style.backgroundColor = colors[index];
});
animationFrameId = requestAnimationFrame(updateColors);
};
}
};
animationFrameId = requestAnimationFrame(updateColors)
}
}
}
}
if (typeof window !== 'undefined') {
window['artplayerPluginAmbilight'] = artplayerPluginAmbilight;
window.artplayerPluginAmbilight = artplayerPluginAmbilight
}
@@ -1,20 +1,20 @@
import type Artplayer from 'artplayer';
import type Artplayer from 'artplayer'
export = artplayerPluginAmbilight;
export = artplayerPluginAmbilight
export as namespace artplayerPluginAmbilight;
type Option = {
blur?: string;
opacity?: number;
frequency?: number;
zIndex?: number;
duration?: number;
};
interface Option {
blur?: string
opacity?: number
frequency?: number
zIndex?: number
duration?: number
}
type Result = {
name: 'artplayerPluginAmbilight';
start: () => void;
stop: () => void;
};
interface Result {
name: 'artplayerPluginAmbilight'
start: () => void
stop: () => void
}
declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) => Result;
declare const artplayerPluginAmbilight: (option: Option) => (art: Artplayer) => Result