mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-19 11:21:20 -08:00
build all
This commit is contained in:
1 parent
b84b0af2ec
commit
48b3f76151
228 files changed
+327
-310
No files matched your search
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,n,o,r,s,l){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},h="function"==typeof a[n]&&a[n],d=h.i||{},u=h.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,i){if(!u[t]){if(!e[t]){if(o[t])return o[t];var r="function"==typeof a[n]&&a[n];if(!i&&r)return r(t,!0);if(h)return h(t,!0);if(p&&"string"==typeof t)return p(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}d.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},d.cache={};var l=u[t]=new c.Module(t);e[t][0].call(l.exports,d,l,l.exports,a)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.require=p,this.exports={}},c.modules=e,c.cache=u,c.parent=h,c.distDir=void 0,c.publicUrl=void 0,c.devServer=void 0,c.i=d,c.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(c,"root",{get:function(){return a[n]}}),a[n]=c;for(var f=0;f<t.length;f++)c(t[f]);if(i){var m=c(i);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({c0Aef:[function(e,t,i,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i);var r=e("./emitter"),s=o.interopDefault(r),l=e("./utils");class a extends s.default{constructor(e={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},a.DEFAULTS,e)),this.video=a.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",a.ondragover),this.option.fileInput.addEventListener("drop",a.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:NaN}}static ondragover(e){e.preventDefault()}ondrop(e){e.preventDefault();let t=e.dataTransfer.files[0];this.loadVideo(t)}setup(e={}){this.option=Object.assign({},this.option,e);let{fileInput:t,number:i,width:n,column:o}=this.option;if(this.errorHandle(t instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==t.tagName||"file"!==t.type){t.style.position="relative";let e=document.createElement("input");e.type="file",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.opacity="0",t.appendChild(e),this.option.fileInput=e}return["number","width","column","begin","end"].forEach(e=>{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)}),this.option.number=(0,l.clamp)(i,10,1e3),this.option.width=(0,l.clamp)(n,10,1e3),this.option.column=(0,l.clamp)(o,1,1e3),this}static creatVideo(){let e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){let t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){let t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);let i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,l.sleep)(1e3).then(()=>this.start());let{width:e,number:t,begin:i,end:n}=this.option,o=this.video.videoHeight/this.video.videoWidth*e;this.option.height=o,this.option.begin=(0,l.clamp)(i,0,this.video.duration),this.option.end=(0,l.clamp)(n||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);let r=this.creatScreenshotDate(),s=this.creatCanvas(),a=s.getContext("2d");this.emit("canvas",s);let h=r.map((i,n)=>()=>new Promise(r=>{this.video.oncanplay=()=>{a.drawImage(this.video,i.x,i.y,e,o),s.toBlob(e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",this.thumbnailUrl,(n+1)/t),this.video.oncanplay=null,r()})},this.video.currentTime=i.time}));return this.processing=!0,(0,l.runPromisesInSeries)(h).then(()=>{this.processing=!1,this.emit("done")}).catch(e=>{throw this.processing=!1,this.emit("error",e.message),e})}creatScreenshotDate(){let{number:e,width:t,height:i,column:n,begin:o}=this.option,r=this.duration/e,s=[o+r];for(;s.length<e;){let e=s[s.length-1];s.push(e+r)}returLine truncated
|
||||
!function(e,t,i,r,n,o,s,l){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},h="function"==typeof a[r]&&a[r],d=h.i||{},u=h.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,i){if(!u[t]){if(!e[t]){if(n[t])return n[t];var o="function"==typeof a[r]&&a[r];if(!i&&o)return o(t,!0);if(h)return h(t,!0);if(p&&"string"==typeof t)return p(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}d.resolve=function(i){var r=e[t][1][i];return null!=r?r:i},d.cache={};var l=u[t]=new f.Module(t);e[t][0].call(l.exports,d,l,l.exports,a)}return u[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var i={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],n=e[2]||e[0],o=f(r);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(i,e)||Object.defineProperty(i,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===n?Object.defineProperty(i,t,{enumerable:!0,value:o}):Object.defineProperty(i,t,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),i}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=p,this.exports={}},f.modules=e,f.cache=u,f.parent=h,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=d,f.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(f,"root",{get:function(){return a[r]}}),a[r]=f;for(var c=0;c<t.length;c++)f(t[c]);if(i){var m=f(i);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({c0Aef:[function(e,t,i,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=e("./emitter"),s=n.interopDefault(o),l=e("./utils");class a extends s.default{constructor(e={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},a.DEFAULTS,e)),this.video=a.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",a.ondragover),this.option.fileInput.addEventListener("drop",a.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:NaN}}static ondragover(e){e.preventDefault()}ondrop(e){e.preventDefault();let t=e.dataTransfer.files[0];this.loadVideo(t)}setup(e={}){this.option=Object.assign({},this.option,e);let{fileInput:t,number:i,width:r,column:n}=this.option;if(this.errorHandle(t instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==t.tagName||"file"!==t.type){t.style.position="relative";let e=document.createElement("input");e.type="file",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.opacity="0",t.appendChild(e),this.option.fileInput=e}return["number","width","column","begin","end"].forEach(e=>{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)}),this.option.number=(0,l.clamp)(i,10,1e3),this.option.width=(0,l.clamp)(r,10,1e3),this.option.column=(0,l.clamp)(n,1,1e3),this}static creatVideo(){let e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){let t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){let t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);let i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,l.sleep)(1e3).then(()=>this.start());let{width:e,number:t,begin:i,end:r}=this.option,n=this.video.videoHeight/this.video.videoWidth*e;this.option.height=n,this.option.begin=(0,l.clamp)(i,0,this.video.duration),this.option.end=(0,l.clamp)(r||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);let o=this.creatScreenshotDate(),s=this.creatCanvas(),a=s.getContext("2d");this.emit("canvas",s);let h=o.map((i,r)=>()=>new Promise(o=>{this.video.oncanplay=()=>{a.drawImage(this.video,i.x,i.y,e,n),s.toBlob(e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),thisLine truncated
|
||||
Reference in new issue
Block a user