mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 19:41:25 -08:00
add index.esm.html
This commit is contained in:
1 parent
a64e13c9c1
commit
2a7e3d5e03
194 files changed
+11632
-371
No files matched your search
@@ -2,7 +2,7 @@
|
||||
/*!
|
||||
* artplayer-plugin-danmuku-mask.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2024 Harvey Zack
|
||||
* (c) 2017-2025 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,r,t,n,a){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof o[n]&&o[n],i=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(r,t){if(!i[r]){if(!e[r]){var a="function"==typeof o[n]&&o[n];if(!t&&a)return a(r,!0);if(s)return s(r,!0);if(l&&"string"==typeof r)return l(r);var c=Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},f.cache={};var p=i[r]=new u.Module(r);e[r][0].call(p.exports,f,p,p.exports,this)}return i[r].exports;function f(e){var r=f.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=i,u.parent=s,u.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(u,"root",{get:function(){return o[n]}}),o[n]=u;for(var c=0;c<r.length;c++)u(r[c]);if(t){var p=u(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=p:"function"==typeof define&&define.amd&&define(function(){return p})}}({laCzO:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"default",function(){return l});var a=e("@swc/helpers/_/_async_to_generator"),o=e("@swc/helpers/_/_ts_generator"),s=e("@tensorflow/tfjs-core");e("@tensorflow/tfjs-backend-webgl"),e("@tensorflow/tfjs-backend-cpu");var i=e("@tensorflow-models/body-segmentation");function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t=r.template,n=t.$player,l=t.$video,u=t.$danmuku,c=null,p=null,f=null,d=null,h=!1,m={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 g(){return(g=(0,a._)(function(){return(0,o._)(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,4]),[4,s.setBackend("webgl")];case 1:return e.sent(),console.log("Using WebGL backend"),[3,4];case 2:return e.sent(),console.warn("WebGL backend not available, falling back to CPU"),[4,s.setBackend("cpu")];case 3:return e.sent(),[3,4];case 4:return[2]}})})).apply(this,arguments)}function v(){return(v=(0,a._)(function(){var e,r;return(0,o._)(this,function(t){switch(t.label){case 0:return[4,function(){return g.apply(this,arguments)}()];case 1:t.sent(),e=i.SupportedModels.MediaPipeSelfieSegmentation,r={runtime:"mediapipe",modelType:"general",solutionPath:m.solutionPath,modelSelection:m.modelSelection,smoothSegmentation:m.smoothSegmentation,minDetectionConfidence:m.minDetectionConfidence,minTrackingConfidence:m.minTrackingConfidence,selfieMode:m.selfieMode},t.label=2;case 2:return t.trys.push([2,4,,5]),[4,i.createSegmenter(e,r)];case 3:return c=t.sent(),h=!0,console.log("Segmenter initialized successfully"),[3,5];case 4:return console.error("Error initializing segmenter:",t.sent()),h=!1,[3,5];case 5:return[2]}})})).apply(this,arguments)}function _(){return x.apply(this,arguments)}function x(){return(x=(0,a._)(function(){var e,r,t,n,a;return(0,o._)(this,function(o){switch(o.label){case 0:if(!h||l.paused||l.ended)return d=requestAnimationFrame(_),[2];o.label=1;case 1:return o.trys.push([1,5,,6]),p.width=l.videoWidth,p.height=l.videoHeight,[4,c.segmentPeople(l)];case 2:if(!(e=o.sent())||0===e.length)return d=requestAnimationFrame(_),[2];return r={r:255,g:255,b:255,a:255},t={r:0,g:0,b:0,a:255},[4,i.toBinaryMask(e,r,t,m.drawContour,m.foregroundThreshold)];case 3:return n=o.sent(),[4,i.drawMask(p,l,n,m.opacity,m.maskBlurAmount)];case 4:return o.sent(),a=f.getImageData(0,0,p.width,p.height),f.putImageData(function(e){for(var r=e.data,t=0;t<r.length;t+=4)r[t]>250&&r[t+1]>250&&r[t+2]>250&&(r[t+3]=0);return e}(a),0,0),u.style.maskImage="url(".concat(p.toDataURL(),")"),[3,6];case 5:return console.error("Error in segmentBody:",o.sent()),[3,6];case 6:return d=requestAnimationFrame(_),[2]}})})).apply(this,arguments)}function y(){return b.apply(this,arguments)}function b(){return(b=(0,a._)(function(){return(0,o._)(this,function(e){switch(e.label){case 0:if(h)return[3,2];return[4,function(){return v.apply(this,arguments)}()];case 1:e.sent(),e.label=2;case 2:return p||(f=(p=document.createElement("canvas")).getContext("2d"),Object.assign(p.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",opacity:"0"}),n.appendChild(p)),Object.assign(u.style,{maskMode:"alpha",maskSize:"contain",maskRepeat:"no-repeat",backgroundSize:"contain",backgroundRepeat:"no-repeat"}),_(),[2]}})})).apply(this,arguments)}functLine 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})}}({"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
|
||||
Reference in new issue
Block a user