mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
8 lines
6.3 KiB
JavaScript
8 lines
6.3 KiB
JavaScript
|
|
/*!
|
|
* artplayer-plugin-ambilight.js v1.0.0
|
|
* Github: https://github.com/zhw2590582/ArtPlayer
|
|
* (c) 2017-2025 Harvey Zack
|
|
* Released under the MIT License.
|
|
*/
|
|
!function(e,r,t,n,o,i,a,l){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof u[n]&&u[n],f=s.i||{},c=s.cache||{},d="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 u[n]&&u[n];if(!t&&i)return i(r,!0);if(s)return s(r,!0);if(d&&"string"==typeof r)return d(r);var a=Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}f.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},f.cache={};var l=c[r]=new p.Module(r);e[r][0].call(l.exports,f,l,l.exports,u)}return c[r].exports;function f(e){var r=f.resolve(e);return!1===r?{}:p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=d,this.exports={}},p.modules=e,p.cache=c,p.parent=s,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=f,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return u[n]}}),u[n]=p;for(var m=0;m<r.length;m++)p(r[m]);if(t){var y=p(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=y:"function"==typeof define&&define.amd&&define(function(){return y})}}({aefyu:[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/_/_sliced_to_array");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t,n,o,a,l,u,s,f,c,d,p,m,y,_=r.template.$video,h=r.constructor.utils,j=h.createElement,v=h.addClass,g=h.setStyles,b=e.blur,w=e.opacity,x=e.frequency,D=e.duration,A=j("div"),F=((t=A).innerHTML=Array(9).fill("<div></div>").join(""),Array.from(t.children));n=A,o=_,v(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),g(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),a=F,l=void 0===b?"50px":b,u=void 0===w?.5:w,s=void 0===D?.3:D,a.forEach(function(e){g(e,{opacity:u,filter:"blur(".concat(l,")"),transition:"background-color ".concat(s,"s ease")})});var I=(f=_,c=F,d=void 0===x?10:x,m=(p=j("canvas")).getContext("2d"),p.width=3,p.height=3,y=0,function e(){var t=performance.now();if(t-y<1e3/d||!r.playing){M=requestAnimationFrame(e);return}y=t;var n=f.videoWidth/3,o=f.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,l,u=(0,i._)(e,2),s=u[0],c=u[1];return m.drawImage(f,s,c,n,o,0,0,1,1),t=(r=(0,i._)(m.getImageData(0,0,1,1).data,3))[0],a=r[1],l=r[2],"rgb(".concat(t,", ").concat(a,", ").concat(l,")")});c.forEach(function(e,r){e.style.backgroundColor=a[r]}),M=requestAnimationFrame(e)}),M=null;function O(){M||I()}function W(){M&&(cancelAnimationFrame(M),M=null)}return r.on("ready",O),r.on("destroy",W),{name:"artplayerPluginAmbilight",start:O,stop:W}}}"undefined"!=typeof window&&(window.artplayerPluginAmbilight=a)},{"@swc/helpers/_/_sliced_to_array":"uVQht","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],uVQht:[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(t),o.export(t,"_",function(){return s});var i=e("./_array_with_holes.js"),a=e("./_iterable_to_array_limit.js"),l=e("./_non_iterable_rest.js"),u=e("./_unsupported_iterable_to_array.js");function s(e,r){return(0,i._)(e)||(0,a._)(e,r)||(0,u._)(e,r)||(0,l._)()}},{"./_array_with_holes.js":"hF14e","./_iterable_to_array_limit.js":"loYCM","./_non_iterable_rest.js":"2Mjp1","./_unsupported_iterable_to_array.js":"5m31D","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],hF14e:[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e){if(Array.isArray(e))return e}o.defineInteropFlag(t),o.export(t,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[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})}},{}],loYCM:[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e,r){var t,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,l=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){l=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(l)throw n}}return i}}o.defineInteropFlag(t),o.export(t,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"2Mjp1":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}o.defineInteropFlag(t),o.export(t,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"5m31D":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(t),o.export(t,"_",function(){return a});var i=e("./_array_like_to_array.js");function a(e,r){if(e){if("string"==typeof e)return(0,i._)(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(0,i._)(e,r)}}},{"./_array_like_to_array.js":"djwRR","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],djwRR:[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(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}o.defineInteropFlag(t),o.export(t,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}]},["aefyu"],"aefyu","parcelRequire4dc0",{}); |