feat: add danmuku plugin documentation and i18n setup guide

- Created a new documentation file for the danmuku plugin, detailing its usage and providing code examples.
- Added a comprehensive guide for language settings (i18n), including instructions for importing languages, setting default languages, and modifying language options.
- Included code snippets for initializing the Artplayer with different languages and examples for adding new languages.
This commit is contained in:
Harvey Zack committed 2025-08-01 09:34:07 +08:00
1 parent c1fe0e2b03
commit 5337f9b075
181 files changed
+1680 -1659

No files matched your search

@@ -5,5 +5,5 @@
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,i,o,n,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[o]&&a[o],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(n[t])return n[t];var r="function"==typeof a[o]&&a[o];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 o=e[t][1][i];return null!=o?o: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[o]}}),a[o]=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})}}({lHTNY:[function(e,t,i,o){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var r=e("./emitter"),s=n.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:o,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)(o,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:o}=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)(o||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,o)=>()=>new Promise(r=>{this.video.oncanplay=()=>{a.drawImage(this.video,i.x,i.y,e,n),s.toBlob(e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",this.thumbnailUrl,(o+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:o,begin:n}=this.option,r=this.duration/e,s=[n+r];for(;s.length<e;){let e=s[s.length-1];s.push(e+r)}returLine truncated
!function(e,t,i,r,o,n,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 c(t,i){if(!u[t]){if(!e[t]){if(o[t])return o[t];var n="function"==typeof a[r]&&a[r];if(!i&&n)return n(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 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[r]}}),a[r]=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})}}({"4omrA":[function(e,t,i,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(i);var n=e("./emitter"),s=o.interopDefault(n),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: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)(r,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:r}=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)(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 n=this.creatScreenshotDate(),s=this.creatCanvas(),a=s.getContext("2d");this.emit("canvas",s);let h=n.map((i,r)=>()=>new Promise(n=>{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,(r+1)/t),this.video.oncanplay=null,n()})},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:r,begin:o}=this.option,n=this.duration/e,s=[o+n];for(;s.length<e;){let e=s[s.length-1];s.push(e+n)}retLine truncated
//# sourceMappingURL=artplayer-tool-thumbnail.esm.js.map
@@ -1 +1 @@
{"mappings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I,CAAC,MAAM,CAAC,GAAG,CAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAE,gDACtD,IAAI,CAAC,QAAQ,CAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CACnD,IAAI,CAAC,OAAO,CAAG,EAAS,IAAI,CAAC,QAAQ,CACrC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAI,IAAI,CAAC,KAAK,CAAE,sCAC1C,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,UAAU,CAAE,kEACnC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAI,EAAG,CAAC,sDAAsD,EAAE,IAAI,CAAC,OAAO,CAAA,CAAE,EAC3G,IAAM,EAAiB,IAAI,CAAC,mBAAmB,GACzC,EAAS,IAAI,CAAC,WAAW,GACzB,EAAY,EAAO,UAAU,CAAC,MACpC,IAAI,CAAC,IAAI,CAAC,SAAU,GACpB,IAAM,EAAc,EAAe,GAAG,CAAC,CAAC,EAAM,IAAU,IAC7C,IAAI,QAAQ,AAAC,IAChB,IAAI,CAAC,KAAK,CAAC,SAAS,CAAG,KACnB,EAAU,SAAS,CAAC,IAAI,CAAC,KAAK,CAAE,EAAK,CAAC,CAAE,EAAK,CAAC,CAAE,EAAO,GACvD,EAAO,MAAM,CLine truncated
@@ -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,o,n,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[o]&&a[o],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(n[t])return n[t];var r="function"==typeof a[o]&&a[o];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 o=e[t][1][i];return null!=o?o: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[o]}}),a[o]=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})}}({jz4E5:[function(e,t,i,o){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var r=e("./emitter"),s=n.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:o,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)(o,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:o}=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)(o||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,o)=>()=>new Promise(r=>{this.video.oncanplay=()=>{a.drawImage(this.video,i.x,i.y,e,n),s.toBlob(e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",this.thumbnailUrl,(o+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:o,begin:n}=this.option,r=this.duration/e,s=[n+r];for(;s.length<e;){let e=s[s.length-1];s.push(e+r)}returLine truncated
@@ -5,4 +5,4 @@
* (c) 2017-2025 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,n,r,i,o,s,a){var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof c[r]&&c[r],l=u.i||{},f=u.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!f[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof c[r]&&c[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(h&&"string"==typeof t)return h(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}l.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},l.cache={};var a=f[t]=new d.Module(t);e[t][0].call(a.exports,l,a,a.exports,c)}return f[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=h,this.exports={}},d.modules=e,d.cache=f,d.parent=u,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=l,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return c[r]}}),c[r]=d;for(var p=0;p<t.length;p++)d(t[p]);if(n){var v=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({a05wP:[function(e,t,n,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return h});var o=e("@swc/helpers/cjs/_call_super.cjs"),s=e("@swc/helpers/cjs/_class_call_check.cjs"),a=e("@swc/helpers/cjs/_create_class.cjs"),c=e("@swc/helpers/cjs/_inherits.cjs"),u=e("./emitter"),l=i.interopDefault(u),f=e("./utils"),h=function(e){"use strict";function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,s._)(this,t),(e=(0,o._)(this,t)).processing=!1,e.option={},e.setup(Object.assign({},t.DEFAULTS,n)),e.video=t.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(e),e.ondrop=e.ondrop.bind(e),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",t.ondragover),e.option.fileInput.addEventListener("drop",t.ondrop),e}return(0,c._)(t,e),(0,a._)(t,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,t);var n=this.option,r=n.fileInput,i=n.number,o=n.width,s=n.column;if(this.errorHandle(r instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==r.tagName||"file"!==r.type){r.style.position="relative";var a=document.createElement("input");a.type="file",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.left="0",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.opacity="0",r.appendChild(a),this.option.fileInput=a}return["number","width","column","begin","end"].forEach(function(t){e.errorHandle("number"==typeof e.option[t],"The '".concat(t,"' is not a number"))}),this.option.number=(0,f.clamp)(i,10,1e3),this.option.width=(0,f.clamp)(o,10,1e3),this.option.column=(0,f.clamp)(s,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var n=URL.createObjectURL(e);this.videoUrl=n,this.file=e,this.emit("file",this.file),this.video.src=n,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,f.sleep)(1e3).then(function(){return e.start()});var t=this.option,n=t.width,r=t.number,i=t.begin,o=t.end,s=this.video.videoHeight/this.video.videoWidth*n;this.option.height=s,this.option.begin=(0,f.clamp)(i,0,this.video.duration),this.option.end=(0,f.clamp)(o||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=r/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 ".concat(this.density));var a=this.creatScreenshotDate(),c=this.creatCanvas(),u=c.getContext("2d");this.emit("canvas",c);var l=a.map(function(t,i){return function(){return new Promise(function(o){e.video.oncanplay=function(){u.drawImage(e.video,t.x,t.y,n,s),c.toBlob(function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(i+1)/r),e.video.oncanplay=null,o()})},e.video.currentTime=t.time})}});return this.processing=!0,(0,f.runPromisesInSeries)(l).then(function(){e.processing=!1,e.emLine truncated
!function(e,t,n,r,i,o,s,c){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof a[r]&&a[r],l=u.i||{},f=u.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!f[t]){if(!e[t]){if(i[t])return i[t];var o="function"==typeof a[r]&&a[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(h&&"string"==typeof t)return h(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}l.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},l.cache={};var c=f[t]=new p.Module(t);e[t][0].call(c.exports,l,c,c.exports,a)}return f[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=h,this.exports={}},p.modules=e,p.cache=f,p.parent=u,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return a[r]}}),a[r]=p;for(var d=0;d<t.length;d++)p(t[d]);if(n){var v=p(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=v:"function"==typeof define&&define.amd&&define(function(){return v})}}({bzF6W:[function(e,t,n,r){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",function(){return h});var o=e("@swc/helpers/cjs/_call_super.cjs"),s=e("@swc/helpers/cjs/_class_call_check.cjs"),c=e("@swc/helpers/cjs/_create_class.cjs"),a=e("@swc/helpers/cjs/_inherits.cjs"),u=e("./emitter"),l=i.interopDefault(u),f=e("./utils"),h=function(e){"use strict";function t(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,s._)(this,t),(e=(0,o._)(this,t)).processing=!1,e.option={},e.setup(Object.assign({},t.DEFAULTS,n)),e.video=t.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind(e),e.ondrop=e.ondrop.bind(e),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",t.ondragover),e.option.fileInput.addEventListener("drop",t.ondrop),e}return(0,a._)(t,e),(0,c._)(t,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.option=Object.assign({},this.option,t);var n=this.option,r=n.fileInput,i=n.number,o=n.width,s=n.column;if(this.errorHandle(r instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==r.tagName||"file"!==r.type){r.style.position="relative";var c=document.createElement("input");c.type="file",c.style.position="absolute",c.style.width="100%",c.style.height="100%",c.style.left="0",c.style.top="0",c.style.right="0",c.style.bottom="0",c.style.opacity="0",r.appendChild(c),this.option.fileInput=c}return["number","width","column","begin","end"].forEach(function(t){e.errorHandle("number"==typeof e.option[t],"The '".concat(t,"' is not a number"))}),this.option.number=(0,f.clamp)(i,10,1e3),this.option.width=(0,f.clamp)(o,10,1e3),this.option.column=(0,f.clamp)(s,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var n=URL.createObjectURL(e);this.videoUrl=n,this.file=e,this.emit("file",this.file),this.video.src=n,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,f.sleep)(1e3).then(function(){return e.start()});var t=this.option,n=t.width,r=t.number,i=t.begin,o=t.end,s=this.video.videoHeight/this.video.videoWidth*n;this.option.height=s,this.option.begin=(0,f.clamp)(i,0,this.video.duration),this.option.end=(0,f.clamp)(o||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=r/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 ".concat(this.density));var c=this.creatScreenshotDate(),a=this.creatCanvas(),u=a.getContext("2d");this.emit("canvas",a);var l=c.map(function(t,i){return function(){return new Promise(function(o){e.video.oncanplay=function(){u.drawImage(e.video,t.x,t.y,n,s),a.toBlob(function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(i+1)/r),e.video.oncanplay=null,o()})},e.video.currentTime=t.time})}});return this.processing=!0,(0,f.runPromisesInSeries)(l).then(function(){e.processing=!1,e.emLine truncated