mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-28 18:41:20 -08:00
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:
1 parent
c1fe0e2b03
commit
5337f9b075
181 files changed
+1680
-1659
No files matched your search
@@ -5,4 +5,4 @@
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,a,o,s,i){var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof c[n]&&c[n],l=u.i||{},p=u.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!p[t]){if(!e[t]){if(a[t])return a[t];var o="function"==typeof c[n]&&c[n];if(!r&&o)return o(t,!0);if(u)return u(t,!0);if(f&&"string"==typeof t)return f(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}l.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},l.cache={};var i=p[t]=new d.Module(t);e[t][0].call(i.exports,l,i,i.exports,c)}return p[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=f,this.exports={}},d.modules=e,d.cache=p,d.parent=u,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=l,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return c[n]}}),c[n]=d;for(var h=0;h<t.length;h++)d(t[h]);if(r){var m=d(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"1FGEJ":[function(e,t,r,n){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"default",function(){return u});var o=e("@swc/helpers/cjs/_async_to_generator.cjs"),s=e("@swc/helpers/cjs/_ts_generator.cjs"),i=e("@tensorflow/tfjs-core");e("@tensorflow/tfjs-backend-webgl"),e("@tensorflow/tfjs-backend-cpu");var c=e("@tensorflow-models/body-segmentation");function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var r=t.template,n=r.$video,a=r.$danmuku,u=null,l=null,p=null,f=null,d=!1,h={solutionPath:e.solutionPath||"https://cdn.jsdelivr.net/npm/@mediapipe/selfie_segmentation",modelSelection:e.modelSelection||1,smoothSegmentation:void 0===e.smoothSegmentation||e.smoothSegmentation,minDetectionConfidence:e.minDetectionConfidence||.5,minTrackingConfidence:e.minTrackingConfidence||.5,selfieMode:e.selfieMode||!1,drawContour:e.drawContour||!1,foregroundThreshold:e.foregroundThreshold||.5,opacity:e.opacity||1,maskBlurAmount:e.maskBlurAmount||3};function m(){return(m=(0,o._)(function(){return(0,s._)(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,4]),[4,i.setBackend("webgl")];case 1:case 3:return e.sent(),[3,4];case 2:return e.sent(),console.warn("WebGL backend not available, falling back to CPU"),[4,i.setBackend("cpu")];case 4:return[2]}})})).apply(this,arguments)}function g(){return(g=(0,o._)(function(){var e,t;return(0,s._)(this,function(r){switch(r.label){case 0:return[4,function(){return m.apply(this,arguments)}()];case 1:r.sent(),e=c.SupportedModels.MediaPipeSelfieSegmentation,t={runtime:"mediapipe",modelType:"general",solutionPath:h.solutionPath,modelSelection:h.modelSelection,smoothSegmentation:h.smoothSegmentation,minDetectionConfidence:h.minDetectionConfidence,minTrackingConfidence:h.minTrackingConfidence,selfieMode:h.selfieMode},r.label=2;case 2:return r.trys.push([2,4,,5]),[4,c.createSegmenter(e,t)];case 3:return console.log("Segmenter initialized:",u=r.sent()),d=!0,[3,5];case 4:return console.error("Error initializing segmenter:",r.sent()),d=!1,[3,5];case 5:return[2]}})})).apply(this,arguments)}function v(){return _.apply(this,arguments)}function _(){return(_=(0,o._)(function(){var e,t,r,o,i;return(0,s._)(this,function(s){switch(s.label){case 0:if(!d||n.paused||n.ended)return f=requestAnimationFrame(v),[2];s.label=1;case 1:return s.trys.push([1,5,,6]),l.width=n.videoWidth,l.height=n.videoHeight,[4,u.segmentPeople(n)];case 2:if(!(e=s.sent())||0===e.length)return f=requestAnimationFrame(v),[2];return t={r:255,g:255,b:255,a:255},r={r:0,g:0,b:0,a:255},[4,c.toBinaryMask(e,t,r,h.drawContour,h.foregroundThreshold)];case 3:return o=s.sent(),[4,c.drawMask(l,n,o,h.opacity,h.maskBlurAmount)];case 4:return s.sent(),i=p.getImageData(0,0,l.width,l.height),p.putImageData(function(e){for(var t=e.data,r=0;r<t.length;r+=4)t[r]>250&&t[r+1]>250&&t[r+2]>250&&(t[r+3]=0);return e}(i),0,0),a.style.maskImage="url(".concat(l.toDataURL(),")"),[3,6];case 5:return console.error("Error in segmentBody:",s.sent()),[3,6];case 6:return f=requestAnimationFrame(v),[2]}})})).apply(this,arguments)}function x(){return y.apply(this,arguments)}function y(){return(y=(0,o._)(function(){return(0,s._)(this,function(e){switch(e.label){case 0:if(d)return[3,2];return[4,function(){return g.apply(this,arguments)}()];case 1:e.sent(),e.label=2;case 2:return l||(p=(l=document.createElement("canvas")).getContext("2d")),Object.assign(a.style,{maskMode:"alpha",maskSize:"contain",maskRepeat:"no-repeat",backgroundSize:"contain",backgroundRepeat:"no-repeat"}),v(),[2]}})})).apply(this,arguments)}function b(){a.style.maskImage="none",f&&(cancelAnimationFrame(f),f=null)}return t.on("ready",x),t.oLine truncated
|
||||
!function(e,t,r,n,a,o,s,i){var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof c[n]&&c[n],l=u.i||{},p=u.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!p[t]){if(!e[t]){if(a[t])return a[t];var o="function"==typeof c[n]&&c[n];if(!r&&o)return o(t,!0);if(u)return u(t,!0);if(f&&"string"==typeof t)return f(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}l.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},l.cache={};var i=p[t]=new d.Module(t);e[t][0].call(i.exports,l,i,i.exports,c)}return p[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=f,this.exports={}},d.modules=e,d.cache=p,d.parent=u,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=l,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return c[n]}}),c[n]=d;for(var h=0;h<t.length;h++)d(t[h]);if(r){var m=d(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({bzF6W:[function(e,t,r,n){var a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"default",function(){return u});var o=e("@swc/helpers/cjs/_async_to_generator.cjs"),s=e("@swc/helpers/cjs/_ts_generator.cjs"),i=e("@tensorflow/tfjs-core");e("@tensorflow/tfjs-backend-webgl"),e("@tensorflow/tfjs-backend-cpu");var c=e("@tensorflow-models/body-segmentation");function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var r=t.template,n=r.$video,a=r.$danmuku,u=null,l=null,p=null,f=null,d=!1,h={solutionPath:e.solutionPath||"https://cdn.jsdelivr.net/npm/@mediapipe/selfie_segmentation",modelSelection:e.modelSelection||1,smoothSegmentation:void 0===e.smoothSegmentation||e.smoothSegmentation,minDetectionConfidence:e.minDetectionConfidence||.5,minTrackingConfidence:e.minTrackingConfidence||.5,selfieMode:e.selfieMode||!1,drawContour:e.drawContour||!1,foregroundThreshold:e.foregroundThreshold||.5,opacity:e.opacity||1,maskBlurAmount:e.maskBlurAmount||3};function m(){return(m=(0,o._)(function(){return(0,s._)(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,4]),[4,i.setBackend("webgl")];case 1:case 3:return e.sent(),[3,4];case 2:return e.sent(),console.warn("WebGL backend not available, falling back to CPU"),[4,i.setBackend("cpu")];case 4:return[2]}})})).apply(this,arguments)}function g(){return(g=(0,o._)(function(){var e,t;return(0,s._)(this,function(r){switch(r.label){case 0:return[4,function(){return m.apply(this,arguments)}()];case 1:r.sent(),e=c.SupportedModels.MediaPipeSelfieSegmentation,t={runtime:"mediapipe",modelType:"general",solutionPath:h.solutionPath,modelSelection:h.modelSelection,smoothSegmentation:h.smoothSegmentation,minDetectionConfidence:h.minDetectionConfidence,minTrackingConfidence:h.minTrackingConfidence,selfieMode:h.selfieMode},r.label=2;case 2:return r.trys.push([2,4,,5]),[4,c.createSegmenter(e,t)];case 3:return console.log("Segmenter initialized:",u=r.sent()),d=!0,[3,5];case 4:return console.error("Error initializing segmenter:",r.sent()),d=!1,[3,5];case 5:return[2]}})})).apply(this,arguments)}function v(){return _.apply(this,arguments)}function _(){return(_=(0,o._)(function(){var e,t,r,o,i;return(0,s._)(this,function(s){switch(s.label){case 0:if(!d||n.paused||n.ended)return f=requestAnimationFrame(v),[2];s.label=1;case 1:return s.trys.push([1,5,,6]),l.width=n.videoWidth,l.height=n.videoHeight,[4,u.segmentPeople(n)];case 2:if(!(e=s.sent())||0===e.length)return f=requestAnimationFrame(v),[2];return t={r:255,g:255,b:255,a:255},r={r:0,g:0,b:0,a:255},[4,c.toBinaryMask(e,t,r,h.drawContour,h.foregroundThreshold)];case 3:return o=s.sent(),[4,c.drawMask(l,n,o,h.opacity,h.maskBlurAmount)];case 4:return s.sent(),i=p.getImageData(0,0,l.width,l.height),p.putImageData(function(e){for(var t=e.data,r=0;r<t.length;r+=4)t[r]>250&&t[r+1]>250&&t[r+2]>250&&(t[r+3]=0);return e}(i),0,0),a.style.maskImage="url(".concat(l.toDataURL(),")"),[3,6];case 5:return console.error("Error in segmentBody:",s.sent()),[3,6];case 6:return f=requestAnimationFrame(v),[2]}})})).apply(this,arguments)}function x(){return y.apply(this,arguments)}function y(){return(y=(0,o._)(function(){return(0,s._)(this,function(e){switch(e.label){case 0:if(d)return[3,2];return[4,function(){return g.apply(this,arguments)}()];case 1:e.sent(),e.label=2;case 2:return l||(p=(l=document.createElement("canvas")).getContext("2d")),Object.assign(a.style,{maskMode:"alpha",maskSize:"contain",maskRepeat:"no-repeat",backgroundSize:"contain",backgroundRepeat:"no-repeat"}),v(),[2]}})})).apply(this,arguments)}function b(){a.style.maskImage="none",f&&(cancelAnimationFrame(f),f=null)}return t.on("ready",x),t.on(Line truncated
|
||||
Reference in new issue
Block a user