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