mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-18 10:41:20 -08:00
Add artplayer-plugin-ambilight package and demo
This commit is contained in:
1 parent
5a4598f846
commit
9221d42964
4 files changed
+32
No files matched your search
@@ -0,0 +1,8 @@
|
||||
|
||||
/*!
|
||||
* 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,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[r]&&i[r],l=u.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,n){if(!l[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(f&&"string"==typeof t)return f(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},p.cache={};var c=l[t]=new a.Module(t);e[t][0].call(c.exports,p,c,c.exports,this)}return l[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=l,a.parent=u,a.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(a,"root",{get:function(){return i[r]}}),i[r]=a;for(var d=0;d<t.length;d++)a(t[d]);if(n){var c=a(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({"4TtJY":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e={}){return t=>{let{$video:n}=t.template,{createElement:r,addClass:o,setStyles:i}=t.constructor.utils,{blur:u="50px",opacity:l=.5,frequency:f=10,duration:a=.3}=e,d=r("div"),c=(d.innerHTML=Array(9).fill("<div></div>").join(""),Array.from(d.children));o(d,"artplayer-plugin-ambilight"),n.parentNode.insertBefore(d,n),i(d,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),function(e,t,n,r){e.forEach(e=>{i(e,{opacity:n,filter:`blur(${t})`,transition:`background-color ${r}s ease`})})}(c,u,l,a);let p=function(e,n,o){let i=r("canvas"),u=i.getContext("2d");i.width=3,i.height=3;let l=0;return function r(){let i=performance.now();if(i-l<1e3/o||!t.playing){s=requestAnimationFrame(r);return}l=i;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(([t,n])=>(function(t,n,r,o){u.drawImage(e,t,n,r,o,0,0,1,1);let[i,l,f]=u.getImageData(0,0,1,1).data;return`rgb(${i}, ${l}, ${f})`})(t,n,f,a));n.forEach((e,t)=>{e.style.backgroundColor=d[t]}),s=requestAnimationFrame(r)}}(n,c,f),s=null;function m(){s||p()}function g(){s&&(cancelAnimationFrame(s),s=null)}return t.on("ready",m),t.on("destroy",g),{name:"artplayerPluginAmbilight",start:m,stop:g}}}r.defineInteropFlag(n),r.export(n,"default",()=>o),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=o)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["4TtJY"],"4TtJY","parcelRequire4dc0");
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
/*!
|
||||
* 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 insLine truncated
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
/*!
|
||||
* 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,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[r]&&i[r],l=u.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,n){if(!l[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(f&&"string"==typeof t)return f(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},p.cache={};var c=l[t]=new a.Module(t);e[t][0].call(c.exports,p,c,c.exports,this)}return l[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=l,a.parent=u,a.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(a,"root",{get:function(){return i[r]}}),i[r]=a;for(var d=0;d<t.length;d++)a(t[d]);if(n){var c=a(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define(function(){return c})}}({"4TtJY":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e={}){return t=>{let{$video:n}=t.template,{createElement:r,addClass:o,setStyles:i}=t.constructor.utils,{blur:u="50px",opacity:l=.5,frequency:f=10,duration:a=.3}=e,d=r("div"),c=(d.innerHTML=Array(9).fill("<div></div>").join(""),Array.from(d.children));o(d,"artplayer-plugin-ambilight"),n.parentNode.insertBefore(d,n),i(d,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),function(e,t,n,r){e.forEach(e=>{i(e,{opacity:n,filter:`blur(${t})`,transition:`background-color ${r}s ease`})})}(c,u,l,a);let p=function(e,n,o){let i=r("canvas"),u=i.getContext("2d");i.width=3,i.height=3;let l=0;return function r(){let i=performance.now();if(i-l<1e3/o||!t.playing){s=requestAnimationFrame(r);return}l=i;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(([t,n])=>(function(t,n,r,o){u.drawImage(e,t,n,r,o,0,0,1,1);let[i,l,f]=u.getImageData(0,0,1,1).data;return`rgb(${i}, ${l}, ${f})`})(t,n,f,a));n.forEach((e,t)=>{e.style.backgroundColor=d[t]}),s=requestAnimationFrame(r)}}(n,c,f),s=null;function m(){s||p()}function g(){s&&(cancelAnimationFrame(s),s=null)}return t.on("ready",m),t.on("destroy",g),{name:"artplayerPluginAmbilight",start:m,stop:g}}}r.defineInteropFlag(n),r.export(n,"default",()=>o),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=o)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["4TtJY"],"4TtJY","parcelRequire4dc0");
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
/*!
|
||||
* 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 insLine truncated
|
||||
Reference in new issue
Block a user