diff --git a/README.md b/README.md index e6d9049e4..007e8450a 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ let art = new Artplayer({ ## Proxys - [Canvas](https://artplayer.org/?libs=./uncompiled/artplayer-proxy-canvas/index.js&example=canvas) -- [Mediabunny](https://artplayer.org/?libs=./uncompiled/artplayer-proxy-mediabunny/index.js&example=mediabunny) (WIP) +- [Mediabunny](https://artplayer.org/?libs=./uncompiled/artplayer-proxy-mediabunny/index.js&example=mediabunny) ## Changelog diff --git a/docs/assets/ts/artplayer-proxy-mediabunny.d.ts b/docs/assets/ts/artplayer-proxy-mediabunny.d.ts index 24a03e7a0..823eb12ab 100644 --- a/docs/assets/ts/artplayer-proxy-mediabunny.d.ts +++ b/docs/assets/ts/artplayer-proxy-mediabunny.d.ts @@ -1,12 +1,72 @@ interface Option { - eventDelay?: number + /** + * Timeout for loading media in milliseconds + * @default 0 + */ loadTimeout?: number + + /** + * Interval for timeupdate events in milliseconds + * @default 250 + */ timeupdateInterval?: number + + /** + * Audio-video synchronization tolerance in seconds + * @default 0.12 + */ avSyncTolerance?: number + + /** + * Whether to drop late video frames + * @default false + */ dropLateFrames?: boolean + + /** + * Poster image URL + */ poster?: string + + /** + * Media source (URL, Blob, or ReadableStream) + */ source?: string | Blob | ReadableStream + + /** + * Check if server supports range requests before loading + * @default false + */ preflightRange?: boolean + + /** + * Initial volume (0-1) + * @default 0.7 + */ + volume?: number + + /** + * Initial muted state + * @default false + */ + muted?: boolean + + /** + * Autoplay + * @default false + */ + autoplay?: boolean + + /** + * Loop playback + * @default false + */ + loop?: boolean + + /** + * Cross-origin setting + */ + crossOrigin?: string } type Result = HTMLCanvasElement diff --git a/docs/assets/ts/artplayer.d.ts b/docs/assets/ts/artplayer.d.ts index 401974c9a..b9694a369 100644 --- a/docs/assets/ts/artplayer.d.ts +++ b/docs/assets/ts/artplayer.d.ts @@ -853,15 +853,28 @@ export interface CssVar { '--art-theme': string '--art-font-color': string '--art-background-color': string + '--art-font-size-sm': string '--art-text-shadow-color': string '--art-transition-duration': string + '--art-ease-standard': string '--art-padding': string '--art-border-radius': string + '--art-mobile-padding': string + '--art-mobile-radius': string + '--art-radius-sm': string + '--art-space-xxs': string + '--art-space-xs': string + '--art-surface-hover-color': string + '--art-surface-border-color': string + '--art-surface-muted-color': string + '--art-surface-range-color': string '--art-progress-height': string '--art-progress-color': string '--art-progress-top-gap': string '--art-hover-color': string '--art-loaded-color': string + '--art-tip-padding': string + '--art-tip-offset': string '--art-state-size': string '--art-state-opacity': number '--art-bottom-height': string @@ -873,6 +886,7 @@ export interface CssVar { '--art-control-opacity': number '--art-control-icon-size': string '--art-control-icon-scale': number + '--art-touch-hit-size': string '--art-volume-height': string '--art-volume-handle-size': string '--art-lock-size': string @@ -883,6 +897,7 @@ export interface CssVar { '--art-settings-max-height': string '--art-selector-max-height': string '--art-contextmenus-min-width': string + '--art-contextmenu-padding-x': string '--art-subtitle-font-size': string '--art-subtitle-gap': string '--art-subtitle-bottom': string @@ -893,6 +908,13 @@ export interface CssVar { '--art-scrollbar-background': string '--art-scrollbar-background-hover': string '--art-mini-progress-height': string + '--art-shadow-low': string + '--art-shadow-medium': string + '--art-shadow-high': string + '--art-shadow-elevated': string + '--art-icon-small-size': string + '--art-overlay-dim': string + '--art-overlay-strong': string } export interface Config { diff --git a/docs/compiled/artplayer-plugin-ads.js b/docs/compiled/artplayer-plugin-ads.js index 17ed0882d..6698f7127 100644 --- a/docs/compiled/artplayer-plugin-ads.js +++ b/docs/compiled/artplayer-plugin-ads.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ads.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,n,t,l,i,r,a,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof d[l]&&d[l],p=u.i||{},s=u.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(n,t){if(!s[n]){if(!e[n]){if(i[n])return i[n];var r="function"==typeof d[l]&&d[l];if(!t&&r)return r(n,!0);if(u)return u(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(t){var l=e[n][1][t];return null!=l?l:t},p.cache={};var o=s[n]=new y.Module(n);e[n][0].call(o.exports,p,o,o.exports,d)}return s[n].exports;function p(e){var n=p.resolve(e);if(!1===n)return{};if(Array.isArray(n)){var t={__esModule:!0};return n.forEach(function(e){var n=e[0],l=e[1],i=e[2]||e[0],r=y(l);"*"===n?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(t,n,{enumerable:!0,value:r}):Object.defineProperty(t,n,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),t}return y(n)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=s,y.parent=u,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=p,y.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(y,"root",{get:function(){return d[l]}}),d[l]=y;for(var f=0;fo);var r=e("bundle-text:./style.less"),a=i.interopDefault(r);function o(e){return n=>{!function(e){let{version:n,utils:{errorHandle:t}}=e.constructor,l=n.split(".").map(Number);t(l[0]+l[1]/100>=5,`Artplayer.js@${n} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`)}(n);let{template:{$player:t},icons:{volume:l,volumeClose:i,fullscreenOn:r,fullscreenOff:a,loading:d},constructor:{validator:u,utils:{query:p,append:s,setStyle:c}}}=n;e=u({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let y=null,f=null,g=null,m=null,v=null,x=null,h=0,b=null,w=!1,j=!1,D=!1;function P(e,n){return n.replace("%s",e)}function O(){w=!0,n.play(),e.video&&y.pause(),c(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function k(){w||(b=setTimeout(()=>{h+=1;let n=e.playDuration-h;n>=1?g.innerHTML=P(n,e.i18n.canBeClosed):(g.innerHTML=e.i18n.close,D||(D=!0)),m.innerHTML=P(e.totalDuration-h,e.i18n.countdown),h>=e.totalDuration?O():k()},1e3))}function _(){w||clearTimeout(b)}function $(){j||(j=!0,function(){n.template.$ads=s(t,'
'),y=s(n.template.$ads,e.video?``:`
${e.html}
`),x=s(n.template.$ads,'
'),s(x,d),g=p(".artplayer-plugin-ads-close",f=s(n.template.$ads,`
${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}
${P(e.totalDuration,e.i18n.countdown)}
`)),m=p(".artplayer-plugin-ads-countdown",f),e.playDuration>=e.totalDuration&&c(g,"display","none"),n.proxy(g,"click",()=>{D&&O()});let o=p(".artplayer-plugin-ads-detail",v=s(n.template.$ads,`
${e.i18n.detail}
`)),u=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(e.url?n.proxy(o,"click",()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)}):c(o,"display","none"),e.video){let t=s(u,l),r=s(u,i);c(r,"display","none"),e.muted&&(y.muted=!0,c(t,"display","none"),c(r,"display","inline-flex")),n.proxy(u,"click",()=>{y.muted=!y.muted,y.muted?(c(t,"display","none"),c(r,"display","inline-flex")):(c(t,"display","inline-flex"),c(r,"display","none"))})}else c(u,"display","none");let b=s(h,r),w=s(h,a);c(w,"display","none"),n.proxy(h,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(c(b,"display","inline-flex"),c(w,"display","none")):(c(b,"display","none"),c(w,"display","inline-flex"))}),n.proxy(y,"click",()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(y,"error",O),n.proxy(y,"loadedmetadata",()=>{k(),y.play(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(k(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")),n.on("document:visibilitychange",()=>{document.hidden?_():k()}))}return n.on("ready",()=>{n.once("play",$),n.once("video:playing",$)}),{name:"artplayerPluginAds",skip:O,pause:_,play:k}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){let e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAds=o)},{"bundle-text:./style.less":"4TxNB","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"4TxNB":[function(e,n,t,l){n.exports=".artplayer-plugin-ads{z-index:150;color:#fff;background-color:#000;width:100%;height:100%;font-size:13px;line-height:1;position:absolute;inset:0;overflow:hidden}.artplayer-plugin-ads .artplayer-plugin-ads-html{justify-content:center;align-items:center;width:100%;height:100%;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:none;position:absolute;top:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-timer>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}"},{}],"6ykb1":[function(e,n,t,l){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,n){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:function(){return e[t]}})}),n},t.export=function(e,n,t){Object.defineProperty(e,n,{enumerable:!0,get:t})}},{}]},["ezZng"],"ezZng","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,n,l,i,r,a,o){var d="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof d[l]&&d[l],p=u.i||{},s=u.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(t,n){if(!s[t]){if(!e[t]){if(i[t])return i[t];var r="function"==typeof d[l]&&d[l];if(!n&&r)return r(t,!0);if(u)return u(t,!0);if(c&&"string"==typeof t)return c(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(n){var l=e[t][1][n];return null!=l?l:n},p.cache={};var o=s[t]=new y.Module(t);e[t][0].call(o.exports,p,o,o.exports,d)}return s[t].exports;function p(e){var t=p.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],l=e[1],i=e[2]||e[0],r=y(l);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(n,t,{enumerable:!0,value:r}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),n}return y(t)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=s,y.parent=u,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=p,y.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(y,"root",{get:function(){return d[l]}}),d[l]=y;for(var f=0;ftypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({ezZng:[function(e,t,n,l){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",()=>o);var r=e("bundle-text:./style.less"),a=i.interopDefault(r);function o(e){return t=>{!function(e){let{version:t,utils:{errorHandle:n}}=e.constructor,l=t.split(".").map(Number);n(l[0]+l[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{template:{$player:n},icons:{volume:l,volumeClose:i,fullscreenOn:r,fullscreenOff:a,loading:d},constructor:{validator:u,utils:{query:p,append:s,setStyle:c}}}=t;e=u({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let y=null,f=null,g=null,m=null,v=null,x=null,h=0,b=null,w=!1,j=!1,D=!1;function P(e,t){return t.replace("%s",e)}function O(){w=!0,t.play(),e.video&&y.pause(),c(t.template.$ads,"display","none"),t.emit("artplayerPluginAds:skip",e)}function k(){w||(b=setTimeout(()=>{h+=1;let t=e.playDuration-h;t>=1?g.innerHTML=P(t,e.i18n.canBeClosed):(g.innerHTML=e.i18n.close,D||(D=!0)),m.innerHTML=P(e.totalDuration-h,e.i18n.countdown),h>=e.totalDuration?O():k()},1e3))}function _(){w||clearTimeout(b)}function $(){j||(j=!0,function(){t.template.$ads=s(n,'
'),y=s(t.template.$ads,e.video?``:`
${e.html}
`),x=s(t.template.$ads,'
'),s(x,d),g=p(".artplayer-plugin-ads-close",f=s(t.template.$ads,`
${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}
${P(e.totalDuration,e.i18n.countdown)}
`)),m=p(".artplayer-plugin-ads-countdown",f),e.playDuration>=e.totalDuration&&c(g,"display","none"),t.proxy(g,"click",()=>{D&&O()});let o=p(".artplayer-plugin-ads-detail",v=s(t.template.$ads,`
${e.i18n.detail}
`)),u=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(e.url?t.proxy(o,"click",()=>{window.open(e.url),t.emit("artplayerPluginAds:click",e)}):c(o,"display","none"),e.video){let n=s(u,l),r=s(u,i);c(r,"display","none"),e.muted&&(y.muted=!0,c(n,"display","none"),c(r,"display","inline-flex")),t.proxy(u,"click",()=>{y.muted=!y.muted,y.muted?(c(n,"display","none"),c(r,"display","inline-flex")):(c(n,"display","inline-flex"),c(r,"display","none"))})}else c(u,"display","none");let b=s(h,r),w=s(h,a);c(w,"display","none"),t.proxy(h,"click",()=>{t.fullscreen=!t.fullscreen,t.fullscreen?(c(b,"display","inline-flex"),c(w,"display","none")):(c(b,"display","none"),c(w,"display","inline-flex"))}),t.proxy(y,"click",()=>{e.url&&window.open(e.url),t.emit("artplayerPluginAds:click",e)})}(),t.pause(),e.video?(t.proxy(y,"error",O),t.proxy(y,"loadedmetadata",()=>{k(),y.play(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(k(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")),t.on("document:visibilitychange",()=>{document.hidden?_():k()}))}return t.on("ready",()=>{t.once("play",$),t.once("video:playing",$)}),{name:"artplayerPluginAds",skip:O,pause:_,play:k}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-ads")){let e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"u">typeof window&&(window.artplayerPluginAds=o)},{"bundle-text:./style.less":"4TxNB","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"4TxNB":[function(e,t,n,l){t.exports=".artplayer-plugin-ads{z-index:150;color:#fff;background-color:#000;width:100%;height:100%;font-size:13px;line-height:1;position:absolute;inset:0;overflow:hidden}.artplayer-plugin-ads .artplayer-plugin-ads-html{justify-content:center;align-items:center;width:100%;height:100%;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:none;position:absolute;top:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-timer>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}"},{}],"6ykb1":[function(e,t,n,l){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})}},{}]},["ezZng"],"ezZng","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-ads.legacy.js b/docs/compiled/artplayer-plugin-ads.legacy.js index 64bdc1ce8..b4aa38ab2 100644 --- a/docs/compiled/artplayer-plugin-ads.legacy.js +++ b/docs/compiled/artplayer-plugin-ads.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ads.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,n,t,r,l,i,a,o){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof u[r]&&u[r],s=d.i||{},p=d.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(n,t){if(!p[n]){if(!e[n]){if(l[n])return l[n];var i="function"==typeof u[r]&&u[r];if(!t&&i)return i(n,!0);if(d)return d(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}s.resolve=function(t){var r=e[n][1][t];return null!=r?r:t},s.cache={};var o=p[n]=new f.Module(n);e[n][0].call(o.exports,s,o,o.exports,u)}return p[n].exports;function s(e){var n=s.resolve(e);if(!1===n)return{};if(Array.isArray(n)){var t={__esModule:!0};return n.forEach(function(e){var n=e[0],r=e[1],l=e[2]||e[0],i=f(r);"*"===n?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===l?Object.defineProperty(t,n,{enumerable:!0,value:i}):Object.defineProperty(t,n,{enumerable:!0,get:function(){return"default"===l?i.__esModule?i.default:i:i[l]}})}),t}return f(n)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=p,f.parent=d,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(f,"root",{get:function(){return u[r]}}),u[r]=f;for(var y=0;y=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginAds@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"));var t,r,l,a=n.template.$player,o=n.icons,d=o.volume,s=o.volumeClose,p=o.fullscreenOn,c=o.fullscreenOff,f=o.loading,y=n.constructor,g=y.validator,m=y.utils,v=m.query,b=m.append,h=m.setStyle;e=g((0,i._)({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"}},e),{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});var x=null,w=null,j=null,O=null,P=null,_=null,D=0,k=null,M=!1,q=!1,A=!1;function E(e,n){return n.replace("%s",e)}function C(){M=!0,n.play(),e.video&&x.pause(),h(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function T(){M||(k=setTimeout(function(){D+=1;var n=e.playDuration-D;n>=1?j.innerHTML=E(n,e.i18n.canBeClosed):(j.innerHTML=e.i18n.close,A||(A=!0)),O.innerHTML=E(e.totalDuration-D,e.i18n.countdown),D>=e.totalDuration?C():T()},1e3))}function H(){M||clearTimeout(k)}function $(){q||(q=!0,function(){n.template.$ads=b(a,'
'),x=b(n.template.$ads,e.video?''):'
'.concat(e.html,"
")),_=b(n.template.$ads,'
'),b(_,f),j=v(".artplayer-plugin-ads-close",w=b(n.template.$ads,'
\n
'.concat(e.playDuration<=0?e.i18n.close:E(e.playDuration,e.i18n.canBeClosed),'
\n
').concat(E(e.totalDuration,e.i18n.countdown),"
\n
"))),O=v(".artplayer-plugin-ads-countdown",w),e.playDuration>=e.totalDuration&&h(j,"display","none"),n.proxy(j,"click",function(){A&&C()});var t=v(".artplayer-plugin-ads-detail",P=b(n.template.$ads,'
\n
'.concat(e.i18n.detail,'
\n
\n
\n
'))),r=v(".artplayer-plugin-ads-muted",P),l=v(".artplayer-plugin-ads-fullscreen",P);if(e.url?n.proxy(t,"click",function(){window.open(e.url),n.emit("artplayerPluginAds:click",e)}):h(t,"display","none"),e.video){var i=b(r,d),o=b(r,s);h(o,"display","none"),e.muted&&(x.muted=!0,h(i,"display","none"),h(o,"display","inline-flex")),n.proxy(r,"click",function(){x.muted=!x.muted,x.muted?(h(i,"display","none"),h(o,"display","inline-flex")):(h(i,"display","inline-flex"),h(o,"display","none"))})}else h(r,"display","none");var u=b(l,p),y=b(l,c);h(y,"display","none"),n.proxy(l,"click",function(){n.fullscreen=!n.fullscreen,n.fullscreen?(h(u,"display","inline-flex"),h(y,"display","none")):(h(u,"display","none"),h(y,"display","inline-flex"))}),n.proxy(x,"click",function(){e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(x,"error",C),n.proxy(x,"loadedmetadata",function(){T(),x.play(),h(w,"display","flex"),h(P,"display","flex"),h(_,"display","none")})):(T(),h(w,"display","flex"),h(P,"display","flex"),h(_,"display","none")),n.on("document:visibilitychange",function(){document.hidden?H():T()}))}return n.on("ready",function(){n.once("play",$),n.once("video:playing",$)}),{name:"artplayerPluginAds",skip:C,pause:H,play:T}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){var d=document.createElement("style");d.id="artplayer-plugin-ads",d.textContent=o.default,document.head.appendChild(d)}"undefined"!=typeof window&&(window.artplayerPluginAds=u)},{"@swc/helpers/cjs/_object_spread.cjs":"kyoEj","bundle-text:./style.less":"8pNer","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],kyoEj:[function(e,n,t,r){"use strict";var l=e("9f9b8a24218ee51e");t._=function(e){for(var n=1;ndiv{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}"},{}],qpMMf:[function(e,n,t,r){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,n){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:function(){return e[t]}})}),n},t.export=function(e,n,t){Object.defineProperty(e,n,{enumerable:!0,get:t})}},{}]},["1qHWP"],"1qHWP","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,n,t,r,l,i,a,o){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof u[r]&&u[r],p=s.i||{},d=s.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(n,t){if(!d[n]){if(!e[n]){if(l[n])return l[n];var i="function"==typeof u[r]&&u[r];if(!t&&i)return i(n,!0);if(s)return s(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(t){var r=e[n][1][t];return null!=r?r:t},p.cache={};var o=d[n]=new f.Module(n);e[n][0].call(o.exports,p,o,o.exports,u)}return d[n].exports;function p(e){var n=p.resolve(e);if(!1===n)return{};if(Array.isArray(n)){var t={__esModule:!0};return n.forEach(function(e){var n=e[0],r=e[1],l=e[2]||e[0],i=f(r);"*"===n?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===l?Object.defineProperty(t,n,{enumerable:!0,value:i}):Object.defineProperty(t,n,{enumerable:!0,get:function(){return"default"===l?i.__esModule?i.default:i:i[l]}})}),t}return f(n)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=d,f.parent=s,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=p,f.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(f,"root",{get:function(){return u[r]}}),u[r]=f;for(var y=0;ytypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"1qHWP":[function(e,n,t,r){var l=e("@parcel/transformer-js/src/esmodule-helpers.js");l.defineInteropFlag(t),l.export(t,"default",function(){return u});var i=e("@swc/helpers/cjs/_object_spread.cjs"),a=e("bundle-text:./style.less"),o=l.interopDefault(a);function u(e){return function(n){r=(t=n.constructor).version,(0,t.utils.errorHandle)((l=r.split(".").map(Number))[0]+l[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginAds@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"));var t,r,l,a=n.template.$player,o=n.icons,s=o.volume,p=o.volumeClose,d=o.fullscreenOn,c=o.fullscreenOff,f=o.loading,y=n.constructor,g=y.validator,m=y.utils,v=m.query,b=m.append,h=m.setStyle;e=g((0,i._)({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"}},e),{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});var x=null,w=null,j=null,O=null,P=null,_=null,D=0,k=null,M=!1,q=!1,A=!1;function E(e,n){return n.replace("%s",e)}function C(){M=!0,n.play(),e.video&&x.pause(),h(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function T(){M||(k=setTimeout(function(){D+=1;var n=e.playDuration-D;n>=1?j.innerHTML=E(n,e.i18n.canBeClosed):(j.innerHTML=e.i18n.close,A||(A=!0)),O.innerHTML=E(e.totalDuration-D,e.i18n.countdown),D>=e.totalDuration?C():T()},1e3))}function H(){M||clearTimeout(k)}function $(){q||(q=!0,function(){n.template.$ads=b(a,'
'),x=b(n.template.$ads,e.video?''):'
'.concat(e.html,"
")),_=b(n.template.$ads,'
'),b(_,f),j=v(".artplayer-plugin-ads-close",w=b(n.template.$ads,'
\n
'.concat(e.playDuration<=0?e.i18n.close:E(e.playDuration,e.i18n.canBeClosed),'
\n
').concat(E(e.totalDuration,e.i18n.countdown),"
\n
"))),O=v(".artplayer-plugin-ads-countdown",w),e.playDuration>=e.totalDuration&&h(j,"display","none"),n.proxy(j,"click",function(){A&&C()});var t=v(".artplayer-plugin-ads-detail",P=b(n.template.$ads,'
\n
'.concat(e.i18n.detail,'
\n
\n
\n
'))),r=v(".artplayer-plugin-ads-muted",P),l=v(".artplayer-plugin-ads-fullscreen",P);if(e.url?n.proxy(t,"click",function(){window.open(e.url),n.emit("artplayerPluginAds:click",e)}):h(t,"display","none"),e.video){var i=b(r,s),o=b(r,p);h(o,"display","none"),e.muted&&(x.muted=!0,h(i,"display","none"),h(o,"display","inline-flex")),n.proxy(r,"click",function(){x.muted=!x.muted,x.muted?(h(i,"display","none"),h(o,"display","inline-flex")):(h(i,"display","inline-flex"),h(o,"display","none"))})}else h(r,"display","none");var u=b(l,d),y=b(l,c);h(y,"display","none"),n.proxy(l,"click",function(){n.fullscreen=!n.fullscreen,n.fullscreen?(h(u,"display","inline-flex"),h(y,"display","none")):(h(u,"display","none"),h(y,"display","inline-flex"))}),n.proxy(x,"click",function(){e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(x,"error",C),n.proxy(x,"loadedmetadata",function(){T(),x.play(),h(w,"display","flex"),h(P,"display","flex"),h(_,"display","none")})):(T(),h(w,"display","flex"),h(P,"display","flex"),h(_,"display","none")),n.on("document:visibilitychange",function(){document.hidden?H():T()}))}return n.on("ready",function(){n.once("play",$),n.once("video:playing",$)}),{name:"artplayerPluginAds",skip:C,pause:H,play:T}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-ads")){var s=document.createElement("style");s.id="artplayer-plugin-ads",s.textContent=o.default,document.head.appendChild(s)}"u">typeof window&&(window.artplayerPluginAds=u)},{"@swc/helpers/cjs/_object_spread.cjs":"kyoEj","bundle-text:./style.less":"8pNer","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],kyoEj:[function(e,n,t,r){"use strict";var l=e("9f9b8a24218ee51e");t._=function(e){for(var n=1;ndiv{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}"},{}],qpMMf:[function(e,n,t,r){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,n){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:function(){return e[t]}})}),n},t.export=function(e,n,t){Object.defineProperty(e,n,{enumerable:!0,get:t})}},{}]},["1qHWP"],"1qHWP","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-ads.mjs b/docs/compiled/artplayer-plugin-ads.mjs index df1c5a205..8f0bf558b 100644 --- a/docs/compiled/artplayer-plugin-ads.mjs +++ b/docs/compiled/artplayer-plugin-ads.mjs @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ads.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,n,t,l,i,r,a,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof d[l]&&d[l],p=u.i||{},s=u.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(n,t){if(!s[n]){if(!e[n]){if(i[n])return i[n];var r="function"==typeof d[l]&&d[l];if(!t&&r)return r(n,!0);if(u)return u(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(t){var l=e[n][1][t];return null!=l?l:t},p.cache={};var o=s[n]=new f.Module(n);e[n][0].call(o.exports,p,o,o.exports,d)}return s[n].exports;function p(e){var n=p.resolve(e);if(!1===n)return{};if(Array.isArray(n)){var t={__esModule:!0};return n.forEach(function(e){var n=e[0],l=e[1],i=e[2]||e[0],r=f(l);"*"===n?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(t,n,{enumerable:!0,value:r}):Object.defineProperty(t,n,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),t}return f(n)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=s,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=p,f.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(f,"root",{get:function(){return d[l]}}),d[l]=f;for(var y=0;yo);var r=e("bundle-text:./style.less"),a=i.interopDefault(r);function o(e){return n=>{!function(e){let{version:n,utils:{errorHandle:t}}=e.constructor,l=n.split(".").map(Number);t(l[0]+l[1]/100>=5,`Artplayer.js@${n} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`)}(n);let{template:{$player:t},icons:{volume:l,volumeClose:i,fullscreenOn:r,fullscreenOff:a,loading:d},constructor:{validator:u,utils:{query:p,append:s,setStyle:c}}}=n;e=u({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let f=null,y=null,g=null,m=null,v=null,x=null,h=0,b=null,w=!1,j=!1,D=!1;function P(e,n){return n.replace("%s",e)}function O(){w=!0,n.play(),e.video&&f.pause(),c(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function _(){w||(b=setTimeout(()=>{h+=1;let n=e.playDuration-h;n>=1?g.innerHTML=P(n,e.i18n.canBeClosed):(g.innerHTML=e.i18n.close,D||(D=!0)),m.innerHTML=P(e.totalDuration-h,e.i18n.countdown),h>=e.totalDuration?O():_()},1e3))}function k(){w||clearTimeout(b)}function $(){j||(j=!0,function(){n.template.$ads=s(t,'
'),f=s(n.template.$ads,e.video?``:`
${e.html}
`),x=s(n.template.$ads,'
'),s(x,d),g=p(".artplayer-plugin-ads-close",y=s(n.template.$ads,`
${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}
${P(e.totalDuration,e.i18n.countdown)}
`)),m=p(".artplayer-plugin-ads-countdown",y),e.playDuration>=e.totalDuration&&c(g,"display","none"),n.proxy(g,"click",()=>{D&&O()});let o=p(".artplayer-plugin-ads-detail",v=s(n.template.$ads,`
${e.i18n.detail}
`)),u=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(e.url?n.proxy(o,"click",()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)}):c(o,"display","none"),e.video){let t=s(u,l),r=s(u,i);c(r,"display","none"),e.muted&&(f.muted=!0,c(t,"display","none"),c(r,"display","inline-flex")),n.proxy(u,"click",()=>{f.muted=!f.muted,f.muted?(c(t,"display","none"),c(r,"display","inline-flex")):(c(t,"display","inline-flex"),c(r,"display","none"))})}else c(u,"display","none");let b=s(h,r),w=s(h,a);c(w,"display","none"),n.proxy(h,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(c(b,"display","inline-flex"),c(w,"display","none")):(c(b,"display","none"),c(w,"display","inline-flex"))}),n.proxy(f,"click",()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(f,"error",O),n.proxy(f,"loadedmetadata",()=>{_(),f.play(),c(y,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(_(),c(y,"display","flex"),c(v,"display","flex"),c(x,"display","none")),n.on("document:visibilitychange",()=>{document.hidden?k():_()}))}return n.on("ready",()=>{n.once("play",$),n.once("video:playing",$)}),{name:"artplayerPluginAds",skip:O,pause:k,play:_}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){let e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAds=o)},{"bundle-text:./style.less":"3vq6I","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3vq6I":[function(e,n,t,l){n.exports=".artplayer-plugin-ads{z-index:150;color:#fff;background-color:#000;width:100%;height:100%;font-size:13px;line-height:1;position:absolute;inset:0;overflow:hidden}.artplayer-plugin-ads .artplayer-plugin-ads-html{justify-content:center;align-items:center;width:100%;height:100%;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:none;position:absolute;top:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-timer>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}"},{}],loqXi:[function(e,n,t,l){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,n){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:function(){return e[t]}})}),n},t.export=function(e,n,t){Object.defineProperty(e,n,{enumerable:!0,get:t})}},{}]},["fZ8n3"],"fZ8n3","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("fZ8n3");export{e as default}; \ No newline at end of file +!function(e,t,l,n,i,r,a,o){var d="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof d[n]&&d[n],p=u.i||{},s=u.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(t,l){if(!s[t]){if(!e[t]){if(i[t])return i[t];var r="function"==typeof d[n]&&d[n];if(!l&&r)return r(t,!0);if(u)return u(t,!0);if(c&&"string"==typeof t)return c(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(l){var n=e[t][1][l];return null!=n?n:l},p.cache={};var o=s[t]=new y.Module(t);e[t][0].call(o.exports,p,o,o.exports,d)}return s[t].exports;function p(e){var t=p.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var l={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],i=e[2]||e[0],r=y(n);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(l,e)||Object.defineProperty(l,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(l,t,{enumerable:!0,value:r}):Object.defineProperty(l,t,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),l}return y(t)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=s,y.parent=u,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=p,y.register=function(t,l){e[t]=[function(e,t){t.exports=l},{}]},Object.defineProperty(y,"root",{get:function(){return d[n]}}),d[n]=y;for(var f=0;ftypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({fZ8n3:[function(e,t,l,n){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(l),i.export(l,"default",()=>o);var r=e("bundle-text:./style.less"),a=i.interopDefault(r);function o(e){return t=>{!function(e){let{version:t,utils:{errorHandle:l}}=e.constructor,n=t.split(".").map(Number);l(n[0]+n[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{template:{$player:l},icons:{volume:n,volumeClose:i,fullscreenOn:r,fullscreenOff:a,loading:d},constructor:{validator:u,utils:{query:p,append:s,setStyle:c}}}=t;e=u({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let y=null,f=null,g=null,m=null,v=null,x=null,h=0,b=null,w=!1,j=!1,D=!1;function P(e,t){return t.replace("%s",e)}function O(){w=!0,t.play(),e.video&&y.pause(),c(t.template.$ads,"display","none"),t.emit("artplayerPluginAds:skip",e)}function _(){w||(b=setTimeout(()=>{h+=1;let t=e.playDuration-h;t>=1?g.innerHTML=P(t,e.i18n.canBeClosed):(g.innerHTML=e.i18n.close,D||(D=!0)),m.innerHTML=P(e.totalDuration-h,e.i18n.countdown),h>=e.totalDuration?O():_()},1e3))}function k(){w||clearTimeout(b)}function $(){j||(j=!0,function(){t.template.$ads=s(l,'
'),y=s(t.template.$ads,e.video?``:`
${e.html}
`),x=s(t.template.$ads,'
'),s(x,d),g=p(".artplayer-plugin-ads-close",f=s(t.template.$ads,`
${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}
${P(e.totalDuration,e.i18n.countdown)}
`)),m=p(".artplayer-plugin-ads-countdown",f),e.playDuration>=e.totalDuration&&c(g,"display","none"),t.proxy(g,"click",()=>{D&&O()});let o=p(".artplayer-plugin-ads-detail",v=s(t.template.$ads,`
${e.i18n.detail}
`)),u=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(e.url?t.proxy(o,"click",()=>{window.open(e.url),t.emit("artplayerPluginAds:click",e)}):c(o,"display","none"),e.video){let l=s(u,n),r=s(u,i);c(r,"display","none"),e.muted&&(y.muted=!0,c(l,"display","none"),c(r,"display","inline-flex")),t.proxy(u,"click",()=>{y.muted=!y.muted,y.muted?(c(l,"display","none"),c(r,"display","inline-flex")):(c(l,"display","inline-flex"),c(r,"display","none"))})}else c(u,"display","none");let b=s(h,r),w=s(h,a);c(w,"display","none"),t.proxy(h,"click",()=>{t.fullscreen=!t.fullscreen,t.fullscreen?(c(b,"display","inline-flex"),c(w,"display","none")):(c(b,"display","none"),c(w,"display","inline-flex"))}),t.proxy(y,"click",()=>{e.url&&window.open(e.url),t.emit("artplayerPluginAds:click",e)})}(),t.pause(),e.video?(t.proxy(y,"error",O),t.proxy(y,"loadedmetadata",()=>{_(),y.play(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(_(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")),t.on("document:visibilitychange",()=>{document.hidden?k():_()}))}return t.on("ready",()=>{t.once("play",$),t.once("video:playing",$)}),{name:"artplayerPluginAds",skip:O,pause:k,play:_}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-ads")){let e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"u">typeof window&&(window.artplayerPluginAds=o)},{"bundle-text:./style.less":"3vq6I","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3vq6I":[function(e,t,l,n){t.exports=".artplayer-plugin-ads{z-index:150;color:#fff;background-color:#000;width:100%;height:100%;font-size:13px;line-height:1;position:absolute;inset:0;overflow:hidden}.artplayer-plugin-ads .artplayer-plugin-ads-html{justify-content:center;align-items:center;width:100%;height:100%;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:none;position:absolute;top:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-timer>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}"},{}],loqXi:[function(e,t,l,n){l.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},l.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},l.exportAll=function(e,t){return Object.keys(e).forEach(function(l){"default"===l||"__esModule"===l||Object.prototype.hasOwnProperty.call(t,l)||Object.defineProperty(t,l,{enumerable:!0,get:function(){return e[l]}})}),t},l.export=function(e,t,l){Object.defineProperty(e,t,{enumerable:!0,get:l})}},{}]},["fZ8n3"],"fZ8n3","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("fZ8n3");export{e as default}; \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-ambilight.js b/docs/compiled/artplayer-plugin-ambilight.js index e6d80065d..ed789c80d 100644 --- a/docs/compiled/artplayer-plugin-ambilight.js +++ b/docs/compiled/artplayer-plugin-ambilight.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ambilight.js v1.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,r,t,n,o,i,u,f){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof l[n]&&l[n],d=a.i||{},c=a.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!c[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof l[n]&&l[n];if(!t&&i)return i(r,!0);if(a)return a(r,!0);if(s&&"string"==typeof r)return s(r);var u=Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}d.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},d.cache={};var f=c[r]=new p.Module(r);e[r][0].call(f.exports,d,f,f.exports,l)}return c[r].exports;function d(e){var r=d.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=p(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=a,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return l[n]}}),l[n]=p;for(var y=0;y{var t,n,o,i,u,f,l,a,d,c;let s,p,y,{$video:m}=r.template,{createElement:b,addClass:g,setStyles:h}=r.constructor.utils,{blur:v="50px",opacity:j=.5,frequency:w=10,duration:O=.3}=e,P=b("div"),_=((t=P).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=P,o=m,g(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),h(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=_,u=v,f=j,l=O,i.forEach(e=>{h(e,{opacity:f,filter:`blur(${u})`,transition:`background-color ${l}s ease`})});let x=(a=m,d=_,c=w,p=(s=b("canvas")).getContext("2d"),s.width=3,s.height=3,y=0,function e(){let t=performance.now();if(t-y<1e3/c||!r.playing){A=requestAnimationFrame(e);return}y=t;let n=a.videoWidth/3,o=a.videoHeight/3,i=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(([e,r])=>(function(e,r,t,n){p.drawImage(a,e,r,t,n,0,0,1,1);let[o,i,u]=p.getImageData(0,0,1,1).data;return`rgb(${o}, ${i}, ${u})`})(e,r,n,o));d.forEach((e,r)=>{e.style.backgroundColor=i[r]}),A=requestAnimationFrame(e)}),A=null;function M(){A||x()}function I(){A&&(cancelAnimationFrame(A),A=null)}return r.on("ready",M),r.on("destroy",I),{name:"artplayerPluginAmbilight",start:M,stop:I}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,r,t,n){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})}},{}]},["2PWBI"],"2PWBI","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,r,t,n,o,i,u,l){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof a[n]&&a[n],c=f.i||{},d=f.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof a[n]&&a[n];if(!t&&i)return i(r,!0);if(f)return f(r,!0);if(s&&"string"==typeof r)return s(r);var u=Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}c.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},c.cache={};var l=d[r]=new p.Module(r);e[r][0].call(l.exports,c,l,l.exports,a)}return d[r].exports;function c(e){var r=c.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=p(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=c,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return a[n]}}),a[n]=p;for(var y=0;ytypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"2PWBI":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e={}){return r=>{var t,n,o,i,u,l,a,f,c,d;let s,p,y,{$video:m}=r.template,{createElement:b,addClass:g,setStyles:h}=r.constructor.utils,{blur:v="50px",opacity:j=.5,frequency:w=10,duration:O=.3}=e,P=b("div"),_=((t=P).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=P,o=m,g(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),h(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=_,u=v,l=j,a=O,i.forEach(e=>{h(e,{opacity:l,filter:`blur(${u})`,transition:`background-color ${a}s ease`})});let x=(f=m,c=_,d=w,p=(s=b("canvas")).getContext("2d"),s.width=3,s.height=3,y=0,function e(){let t=performance.now();if(t-y<1e3/d||!r.playing){A=requestAnimationFrame(e);return}y=t;let n=f.videoWidth/3,o=f.videoHeight/3,i=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(([e,r])=>(function(e,r,t,n){p.drawImage(f,e,r,t,n,0,0,1,1);let[o,i,u]=p.getImageData(0,0,1,1).data;return`rgb(${o}, ${i}, ${u})`})(e,r,n,o));c.forEach((e,r)=>{e.style.backgroundColor=i[r]}),A=requestAnimationFrame(e)}),A=null;function M(){A||x()}function I(){A&&(cancelAnimationFrame(A),A=null)}return r.on("ready",M),r.on("destroy",I),{name:"artplayerPluginAmbilight",start:M,stop:I}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"u">typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,r,t,n){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})}},{}]},["2PWBI"],"2PWBI","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-ambilight.legacy.js b/docs/compiled/artplayer-plugin-ambilight.legacy.js index e8b851bc3..d7e771497 100644 --- a/docs/compiled/artplayer-plugin-ambilight.legacy.js +++ b/docs/compiled/artplayer-plugin-ambilight.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ambilight.js v1.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,r,t,n,o,i,a,u){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof f[n]&&f[n],l=c.i||{},d=c.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof f[n]&&f[n];if(!t&&i)return i(r,!0);if(c)return c(r,!0);if(s&&"string"==typeof r)return s(r);var a=Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},l.cache={};var u=d[r]=new p.Module(r);e[r][0].call(u.exports,l,u,u.exports,f)}return d[r].exports;function l(e){var r=l.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=p(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=c,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return f[n]}}),f[n]=p;for(var y=0;y0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t,n,o,a,u,f,c,l,d,s,p,y,m,b=r.template.$video,v=r.constructor.utils,h=v.createElement,g=v.addClass,_=v.setStyles,j=e.blur,w=e.opacity,O=e.frequency,A=e.duration,x=h("div"),M=((t=x).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=x,o=b,g(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),_(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),a=M,u=void 0===j?"50px":j,f=void 0===w?.5:w,c=void 0===A?.3:A,a.forEach(function(e){_(e,{opacity:f,filter:"blur(".concat(u,")"),transition:"background-color ".concat(c,"s ease")})});var S=(l=b,d=M,s=void 0===O?10:O,y=(p=h("canvas")).getContext("2d"),p.width=3,p.height=3,m=0,function e(){var t=performance.now();if(t-m<1e3/s||!r.playing){P=requestAnimationFrame(e);return}m=t;var n=l.videoWidth/3,o=l.videoHeight/3,a=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(function(e){var r,t,a,u,f=(0,i._)(e,2),c=f[0],d=f[1];return y.drawImage(l,c,d,n,o,0,0,1,1),t=(r=(0,i._)(y.getImageData(0,0,1,1).data,3))[0],a=r[1],u=r[2],"rgb(".concat(t,", ").concat(a,", ").concat(u,")")});d.forEach(function(e,r){e.style.backgroundColor=a[r]}),P=requestAnimationFrame(e)}),P=null;function q(){P||S()}function I(){P&&(cancelAnimationFrame(P),P=null)}return r.on("ready",q),r.on("destroy",I),{name:"artplayerPluginAmbilight",start:q,stop:I}}}"undefined"!=typeof window&&(window.artplayerPluginAmbilight=a)},{"@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],gIQTH:[function(e,r,t,n){"use strict";var o=e("d7c30a5ae0c1ab2"),i=e("3aacfce52f67defd"),a=e("f0dae09a1a08b16a"),u=e("83f3648e614d0830");t._=function(e,r){return o._(e)||i._(e,r)||u._(e,r)||a._()}},{d7c30a5ae0c1ab2:"3QSPl","3aacfce52f67defd":"5SSeo",f0dae09a1a08b16a:"heYSj","83f3648e614d0830":"fh7mx"}],"3QSPl":[function(e,r,t,n){"use strict";t._=function(e){if(Array.isArray(e))return e}},{}],"5SSeo":[function(e,r,t,n){"use strict";t._=function(e,r){var t,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}},{}],heYSj:[function(e,r,t,n){"use strict";t._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,r,t,n){"use strict";var o=e("3ee51b7dc02d0c44");t._=function(e,r){if(e){if("string"==typeof e)return o._(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o._(e,r)}}},{"3ee51b7dc02d0c44":"1WOAB"}],"1WOAB":[function(e,r,t,n){"use strict";t._=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);ttypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof c[n]&&c[n],l=f.i||{},d=f.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof c[n]&&c[n];if(!t&&i)return i(r,!0);if(f)return f(r,!0);if(s&&"string"==typeof r)return s(r);var a=Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},l.cache={};var u=d[r]=new p.Module(r);e[r][0].call(u.exports,l,u,u.exports,c)}return d[r].exports;function l(e){var r=l.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=p(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return c[n]}}),c[n]=p;for(var y=0;ytypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"8Uro8":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(t),o.export(t,"default",function(){return a});var i=e("@swc/helpers/cjs/_sliced_to_array.cjs");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t,n,o,a,u,c,f,l,d,s,p,y,m,b=r.template.$video,v=r.constructor.utils,h=v.createElement,g=v.addClass,_=v.setStyles,j=e.blur,w=e.opacity,O=e.frequency,A=e.duration,x=h("div"),M=((t=x).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=x,o=b,g(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),_(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),a=M,u=void 0===j?"50px":j,c=void 0===w?.5:w,f=void 0===A?.3:A,a.forEach(function(e){_(e,{opacity:c,filter:"blur(".concat(u,")"),transition:"background-color ".concat(f,"s ease")})});var S=(l=b,d=M,s=void 0===O?10:O,y=(p=h("canvas")).getContext("2d"),p.width=3,p.height=3,m=0,function e(){var t=performance.now();if(t-m<1e3/s||!r.playing){P=requestAnimationFrame(e);return}m=t;var n=l.videoWidth/3,o=l.videoHeight/3,a=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(function(e){var r,t,a,u,c=(0,i._)(e,2),f=c[0],d=c[1];return y.drawImage(l,f,d,n,o,0,0,1,1),t=(r=(0,i._)(y.getImageData(0,0,1,1).data,3))[0],a=r[1],u=r[2],"rgb(".concat(t,", ").concat(a,", ").concat(u,")")});d.forEach(function(e,r){e.style.backgroundColor=a[r]}),P=requestAnimationFrame(e)}),P=null;function q(){P||S()}function I(){P&&(cancelAnimationFrame(P),P=null)}return r.on("ready",q),r.on("destroy",I),{name:"artplayerPluginAmbilight",start:q,stop:I}}}"u">typeof window&&(window.artplayerPluginAmbilight=a)},{"@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],gIQTH:[function(e,r,t,n){"use strict";var o=e("d7c30a5ae0c1ab2"),i=e("3aacfce52f67defd"),a=e("f0dae09a1a08b16a"),u=e("83f3648e614d0830");t._=function(e,r){return o._(e)||i._(e,r)||u._(e,r)||a._()}},{d7c30a5ae0c1ab2:"3QSPl","3aacfce52f67defd":"5SSeo",f0dae09a1a08b16a:"heYSj","83f3648e614d0830":"fh7mx"}],"3QSPl":[function(e,r,t,n){"use strict";t._=function(e){if(Array.isArray(e))return e}},{}],"5SSeo":[function(e,r,t,n){"use strict";t._=function(e,r){var t,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}},{}],heYSj:[function(e,r,t,n){"use strict";t._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,r,t,n){"use strict";var o=e("3ee51b7dc02d0c44");t._=function(e,r){if(e){if("string"==typeof e)return o._(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o._(e,r)}}},{"3ee51b7dc02d0c44":"1WOAB"}],"1WOAB":[function(e,r,t,n){"use strict";t._=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t{var t,n,o,i,u,l,f,a,d,c;let p,s,m,{$video:y}=r.template,{createElement:g,addClass:b,setStyles:h}=r.constructor.utils,{blur:v="50px",opacity:j=.5,frequency:w=10,duration:O=.3}=e,_=g("div"),x=((t=_).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=_,o=y,b(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),h(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=x,u=v,l=j,f=O,i.forEach(e=>{h(e,{opacity:l,filter:`blur(${u})`,transition:`background-color ${f}s ease`})});let P=(a=y,d=x,c=w,s=(p=g("canvas")).getContext("2d"),p.width=3,p.height=3,m=0,function e(){let t=performance.now();if(t-m<1e3/c||!r.playing){q=requestAnimationFrame(e);return}m=t;let n=a.videoWidth/3,o=a.videoHeight/3,i=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(([e,r])=>(function(e,r,t,n){s.drawImage(a,e,r,t,n,0,0,1,1);let[o,i,u]=s.getImageData(0,0,1,1).data;return`rgb(${o}, ${i}, ${u})`})(e,r,n,o));d.forEach((e,r)=>{e.style.backgroundColor=i[r]}),q=requestAnimationFrame(e)}),q=null;function A(){q||P()}function F(){q&&(cancelAnimationFrame(q),q=null)}return r.on("ready",A),r.on("destroy",F),{name:"artplayerPluginAmbilight",start:A,stop:F}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,r,t,n){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})}},{}]},["4BFTD"],"4BFTD","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("4BFTD");export{e as default}; \ No newline at end of file +!function(e,r,t,n,o,i,u,l){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof a[n]&&a[n],c=f.i||{},d=f.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof a[n]&&a[n];if(!t&&i)return i(r,!0);if(f)return f(r,!0);if(p&&"string"==typeof r)return p(r);var u=Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}c.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},c.cache={};var l=d[r]=new s.Module(r);e[r][0].call(l.exports,c,l,l.exports,a)}return d[r].exports;function c(e){var r=c.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=s(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return s(r)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.require=p,this.exports={}},s.modules=e,s.cache=d,s.parent=f,s.distDir=void 0,s.publicUrl=void 0,s.devServer=void 0,s.i=c,s.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(s,"root",{get:function(){return a[n]}}),a[n]=s;for(var m=0;mtypeof module?module.exports=y:"function"==typeof define&&define.amd&&define(function(){return y})}}({"4BFTD":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e={}){return r=>{var t,n,o,i,u,l,a,f,c,d;let p,s,m,{$video:y}=r.template,{createElement:g,addClass:b,setStyles:h}=r.constructor.utils,{blur:v="50px",opacity:j=.5,frequency:w=10,duration:O=.3}=e,_=g("div"),x=((t=_).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=_,o=y,b(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),h(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=x,u=v,l=j,a=O,i.forEach(e=>{h(e,{opacity:l,filter:`blur(${u})`,transition:`background-color ${a}s ease`})});let P=(f=y,c=x,d=w,s=(p=g("canvas")).getContext("2d"),p.width=3,p.height=3,m=0,function e(){let t=performance.now();if(t-m<1e3/d||!r.playing){q=requestAnimationFrame(e);return}m=t;let n=f.videoWidth/3,o=f.videoHeight/3,i=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(([e,r])=>(function(e,r,t,n){s.drawImage(f,e,r,t,n,0,0,1,1);let[o,i,u]=s.getImageData(0,0,1,1).data;return`rgb(${o}, ${i}, ${u})`})(e,r,n,o));c.forEach((e,r)=>{e.style.backgroundColor=i[r]}),q=requestAnimationFrame(e)}),q=null;function A(){q||P()}function F(){q&&(cancelAnimationFrame(q),q=null)}return r.on("ready",A),r.on("destroy",F),{name:"artplayerPluginAmbilight",start:A,stop:F}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"u">typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,r,t,n){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})}},{}]},["4BFTD"],"4BFTD","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("4BFTD");export{e as default}; \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-asr.js b/docs/compiled/artplayer-plugin-asr.js index 3e146296b..7683a0741 100644 --- a/docs/compiled/artplayer-plugin-asr.js +++ b/docs/compiled/artplayer-plugin-asr.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-asr.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o,a,i,l){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof u[n]&&u[n],c=s.i||{},d=s.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!d[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof u[n]&&u[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var l=d[t]=new f.Module(t);e[t][0].call(l.exports,c,l,l.exports,u)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],a=f(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),r}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=d,f.parent=s,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return u[n]}}),u[n]=f;for(var y=0;yl);var a=e("bundle-text:./style.less"),i=o.interopDefault(a);function l(e={}){let{length:t=3,interval:r=100,sampleRate:n=16e3,autoHideTimeout:o=1e4,onAudioChunk:a=()=>null}=e;return e=>{let i=!1,l=null,u=null,s=null,c=null,d=[],p=null,f=!1,y=null,b=null,m=null,g=e.layers.add({name:"asr",html:""});function v(){g.style.display="none"}function h(e){"string"==typeof e&&(clearTimeout(y),y=setTimeout(v,o),g.style.display="",g.innerHTML=e.split(/(?<=[、。!?!?.])\s*/u).map(e=>e.trim()).filter(Boolean).slice(-t).map(e=>`
${e}
`).join(""))}let w=` class RecorderProcessor extends AudioWorkletProcessor { process(inputs) { const input = inputs[0]; if (input && input[0]) { this.port.postMessage(input[0]); } return true; } } registerProcessor('recorder-processor', RecorderProcessor); `;async function x(){return l||"suspended"===(l=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n})).state&&await l.resume(),l}async function A(){if(!u&&e.video)try{return u=l.createMediaElementSource(e.video)}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(b||(b=await j(e.video)),b)return m=l.createMediaStreamSource(b)}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function j(e){try{if(e.captureStream)return e.captureStream();if(e.mozCaptureStream)return e.mozCaptureStream();return console.warn("[artplayerPluginAsr] captureStream not supported"),null}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}async function P(){if(!i)try{await x();let e=await A();if(!e)throw Error("Could not establish audio source");if(!f){let e,t=(e=new Blob([w],{type:"application/javascript"}),URL.createObjectURL(e));await l.audioWorklet.addModule(t),URL.revokeObjectURL(t),f=!0}(c=l.createGain()).gain.value=1,(s=new AudioWorkletNode(l,"recorder-processor")).port.onmessage=e=>{d.push(new Float32Array(e.data))},e.connect(s),e.connect(c),c.connect(l.destination);let t=r/1e3*n;p=setInterval(async()=>{let e,r,o,i;if(0===d.length)return;let l=new Float32Array(0);for(;l.length{for(let r=0;re.stop()),b=null),l&&(await l.close(),l=null),f=!1}return e.on("video:volumechange",()=>{c&&(c.gain.value=e.volume)}),e.on("play",P),e.on("pause",M),e.on("destroy",U),{name:"artplayerPluginAsr",stop:U,hide:v,append:h}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-asr")){let e=document.createElement("style");e.id="artplayer-plugin-asr",e.textContent=i.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAsr=l)},{"bundle-text:./style.less":"gfAut","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],gfAut:[function(e,t,r,n){t.exports=".art-video-player .art-layer-asr{z-index:150;justify-content:end;gap:var(--art-subtitle-gap);padding:0 2%;padding-bottom:var(--art-subtitle-bottom);transition:padding-bottom var(--art-transition-duration)ease;text-shadow:var(--art-subtitle-border)1px 0 1px,var(--art-subtitle-border)0 1px 1px,var(--art-subtitle-border)-1px 0 1px,var(--art-subtitle-border)0 -1px 1px,var(--art-subtitle-border)1px 1px 1px,var(--art-subtitle-border)-1px -1px 1px,var(--art-subtitle-border)1px -1px 1px,var(--art-subtitle-border)-1px 1px 1px;flex-direction:column;font-size:1rem;display:flex;position:absolute;inset:0;pointer-events:none!important}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}"},{}],"6ykb1":[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["1gnQM"],"1gnQM","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,r,n,o,a,i,l){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof u[n]&&u[n],c=s.i||{},d=s.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!d[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof u[n]&&u[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var l=d[t]=new f.Module(t);e[t][0].call(l.exports,c,l,l.exports,u)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],a=f(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),r}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=d,f.parent=s,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return u[n]}}),u[n]=f;for(var y=0;ytypeof module?module.exports=b:"function"==typeof define&&define.amd&&define(function(){return b})}}({"1gnQM":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",()=>l);var a=e("bundle-text:./style.less"),i=o.interopDefault(a);function l(e={}){let{length:t=3,interval:r=100,sampleRate:n=16e3,autoHideTimeout:o=1e4,onAudioChunk:a=()=>null}=e;return e=>{let i=!1,l=null,u=null,s=null,c=null,d=[],p=null,f=!1,y=null,b=null,m=null,g=e.layers.add({name:"asr",html:""});function v(){g.style.display="none"}function h(e){"string"==typeof e&&(clearTimeout(y),y=setTimeout(v,o),g.style.display="",g.innerHTML=e.split(/(?<=[、。!?!?.])\s*/u).map(e=>e.trim()).filter(Boolean).slice(-t).map(e=>`
${e}
`).join(""))}let w=` class RecorderProcessor extends AudioWorkletProcessor { process(inputs) { const input = inputs[0]; if (input && input[0]) { this.port.postMessage(input[0]); } return true; } } registerProcessor('recorder-processor', RecorderProcessor); `;async function x(){return l||"suspended"===(l=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n})).state&&await l.resume(),l}async function A(){if(!u&&e.video)try{return u=l.createMediaElementSource(e.video)}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(b||(b=await j(e.video)),b)return m=l.createMediaStreamSource(b)}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function j(e){try{if(e.captureStream)return e.captureStream();if(e.mozCaptureStream)return e.mozCaptureStream();return console.warn("[artplayerPluginAsr] captureStream not supported"),null}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}async function P(){if(!i)try{await x();let e=await A();if(!e)throw Error("Could not establish audio source");if(!f){let e,t=(e=new Blob([w],{type:"application/javascript"}),URL.createObjectURL(e));await l.audioWorklet.addModule(t),URL.revokeObjectURL(t),f=!0}(c=l.createGain()).gain.value=1,(s=new AudioWorkletNode(l,"recorder-processor")).port.onmessage=e=>{d.push(new Float32Array(e.data))},e.connect(s),e.connect(c),c.connect(l.destination);let t=r/1e3*n;p=setInterval(async()=>{let e,r,o,i;if(0===d.length)return;let l=new Float32Array(0);for(;l.length{for(let r=0;re.stop()),b=null),l&&(await l.close(),l=null),f=!1}return e.on("video:volumechange",()=>{c&&(c.gain.value=e.volume)}),e.on("play",P),e.on("pause",M),e.on("destroy",U),{name:"artplayerPluginAsr",stop:U,hide:v,append:h}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-asr")){let e=document.createElement("style");e.id="artplayer-plugin-asr",e.textContent=i.default,document.head.appendChild(e)}"u">typeof window&&(window.artplayerPluginAsr=l)},{"bundle-text:./style.less":"gfAut","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],gfAut:[function(e,t,r,n){t.exports=".art-video-player .art-layer-asr{z-index:150;justify-content:end;gap:var(--art-subtitle-gap);padding:0 2%;padding-bottom:var(--art-subtitle-bottom);transition:padding-bottom var(--art-transition-duration)ease;text-shadow:var(--art-subtitle-border)1px 0 1px,var(--art-subtitle-border)0 1px 1px,var(--art-subtitle-border)-1px 0 1px,var(--art-subtitle-border)0 -1px 1px,var(--art-subtitle-border)1px 1px 1px,var(--art-subtitle-border)-1px -1px 1px,var(--art-subtitle-border)1px -1px 1px,var(--art-subtitle-border)-1px 1px 1px;flex-direction:column;font-size:1rem;display:flex;position:absolute;inset:0;pointer-events:none!important}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}"},{}],"6ykb1":[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["1gnQM"],"1gnQM","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-asr.legacy.js b/docs/compiled/artplayer-plugin-asr.legacy.js index e9b573dac..5ca9f8856 100644 --- a/docs/compiled/artplayer-plugin-asr.legacy.js +++ b/docs/compiled/artplayer-plugin-asr.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-asr.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o,i,a,u){var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof c[n]&&c[n],l=s.i||{},f=s.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof c[n]&&c[n];if(!r&&i)return i(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},l.cache={};var u=f[t]=new d.Module(t);e[t][0].call(u.exports,l,u,u.exports,c)}return f[t].exports;function l(e){var t=l.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],i=d(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=f,d.parent=s,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 y=0;y0&&void 0!==arguments[0]?arguments[0]:{},t=e.length,r=void 0===t?3:t,n=e.interval,o=void 0===n?100:n,u=e.sampleRate,c=void 0===u?16e3:u,s=e.autoHideTimeout,l=void 0===s?1e4:s,f=e.onAudioChunk,p=void 0===f?function(){return null}:f;return function(e){var t=!1,n=null,u=null,s=null,f=null,d=[],y=null,_=!1,h=null,v=null,b=null,m=e.layers.add({name:"asr",html:""});function w(){m.style.display="none"}function g(e){"string"==typeof e&&(clearTimeout(h),h=setTimeout(w,l),m.style.display="",m.innerHTML=e.split(RegExp("(?<=[、。!?!?.])\\s*","u")).map(function(e){return e.trim()}).filter(Boolean).slice(-r).map(function(e){return'
'.concat(e,"
")}).join(""))}var x=function(){var e=new Blob(["\n class RecorderProcessor extends AudioWorkletProcessor {\n process(inputs) {\n const input = inputs[0];\n if (input && input[0]) {\n this.port.postMessage(input[0]);\n }\n return true;\n }\n }\n registerProcessor('recorder-processor', RecorderProcessor);\n "],{type:"application/javascript"});return URL.createObjectURL(e)};function j(){return(0,i._)(function(){return(0,a._)(this,function(e){return t&&(t=!1,clearInterval(y),y=null,s&&(s.disconnect(),s.port.onmessage=null,s=null),f&&(f.disconnect(),f=null),d=[]),[2]})})()}function O(){return(0,i._)(function(){return(0,a._)(this,function(e){switch(e.label){case 0:return[4,j()];case 1:if(e.sent(),b&&(b.disconnect(),b=null),u&&(u.disconnect(),u=null),v&&(v.getTracks().forEach(function(e){return e.stop()}),v=null),!n)return[3,3];return[4,n.close()];case 2:e.sent(),n=null,e.label=3;case 3:return _=!1,[2]}})})()}return e.on("video:volumechange",function(){f&&(f.gain.value=e.volume)}),e.on("play",function(){return(0,i._)(function(){var r,l,h;return(0,a._)(this,function(m){switch(m.label){case 0:if(t)return[2];m.label=1;case 1:return m.trys.push([1,6,,8]),[4,(0,i._)(function(){return(0,a._)(this,function(e){switch(e.label){case 0:if(n)return[2,n];if("suspended"!==(n=new(window.AudioContext||window.webkitAudioContext)({sampleRate:c})).state)return[3,2];return[4,n.resume()];case 1:e.sent(),e.label=2;case 2:return[2,n]}})})()];case 2:return m.sent(),[4,(0,i._)(function(){return(0,a._)(this,function(t){switch(t.label){case 0:if(!u&&e.video)try{return u=n.createMediaElementSource(e.video),[2,u]}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}t.label=1;case 1:var r;if(t.trys.push([1,4,,5]),v)return[3,3];return[4,(r=e.video,(0,i._)(function(){return(0,a._)(this,function(e){try{if(r.captureStream)return[2,r.captureStream()];if(r.mozCaptureStream)return[2,r.mozCaptureStream()];return console.warn("[artplayerPluginAsr] captureStream not supported"),[2,null]}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),[2,null]}})})())];case 2:v=t.sent(),t.label=3;case 3:if(v)return[2,b=n.createMediaStreamSource(v)];return[3,5];case 4:return console.warn("[artplayerPluginAsr] MediaStream fallback failed:",t.sent()),[3,5];case 5:return[2,null]}})})()];case 3:if(!(r=m.sent()))throw Error("Could not establish audio source");if(_)return[3,5];return l=x(),[4,n.audioWorklet.addModule(l)];case 4:m.sent(),URL.revokeObjectURL(l),_=!0,m.label=5;case 5:return(f=n.createGain()).gain.value=1,(s=new AudioWorkletNode(n,"recorder-processor")).port.onmessage=function(e){d.push(new Float32Array(e.data))},r.connect(s),r.connect(f),f.connect(n.destination),h=o/1e3*c,y=setInterval(function(){return(0,i._)(function(){var e,t,r,n;return(0,a._)(this,function(o){switch(o.label){case 0:var i,a,u,s,l;if(0===d.length)return[2];for(e=new Float32Array(0);e.lengtht.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function l(e,t,r,n){var o,a=arguments.length,u=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(u=(a<3?o(u):a>3?o(t,r,u):o(t,r))||u);return a>3&&u&&Object.defineProperty(t,r,u),u}function f(e,t){return function(r,n){t(r,n,e)}}function p(e,t,r,n,o,a){function u(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var c,s=n.kind,l="getter"===s?"get":"setter"===s?"set":"value",f=!t&&e?n.static?e:e.prototype:null,p=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),d=!1,y=r.length-1;y>=0;y--){var _={};for(var h in n)_[h]="access"===h?{}:n[h];for(var h in n.access)_.access[h]=n.access[h];_.addInitializer=function(e){if(d)throw TypeError("Cannot add initializers after decoration has completed");a.push(u(e||null))};var v=(0,r[y])("accessor"===s?{get:p.get,set:p.set}:p[l],_);if("accessor"===s){if(void 0===v)continue;if(null===v||(void 0===v?"undefined":(0,i._)(v))!=="object")throw TypeError("Object expected");(c=u(v.get))&&(p.get=c),(c=u(v.set))&&(p.set=c),(c=u(v.init))&&o.unshift(c)}else(c=u(v))&&("field"===s?o.unshift(c):p[l]=c)}f&&Object.defineProperty(f,n.name,p),d=!0}function d(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function j(){for(var e=[],t=0;t1||u(e,t)})},t&&(n[e]=t(n[e])))}function u(e,t){try{var r;(r=o[e](t)).value instanceof S?Promise.resolve(r.value.v).then(c,s):l(i[0][2],r)}catch(e){l(i[0][3],e)}}function c(e){u("next",e)}function s(e){u("throw",e)}function l(e,t){e(t),i.shift(),i.length&&u(i[0][0],i[0][1])}}function A(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:S(e[n](t)),done:!1}:o?o(t):t}:o}}function I(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=g(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){var i,a,u;i=n,a=o,u=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:u})},a)})}}}function R(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},M=function(e){return(M=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function D(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=M(e),n=0;ntypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof l[n]&&l[n],c=s.i||{},f=s.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof l[n]&&l[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var i=f[t]=new d.Module(t);e[t][0].call(i.exports,c,i,i.exports,l)}return f[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],a=d(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=f,d.parent=s,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=c,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return l[n]}}),l[n]=d;for(var b=0;btypeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"98QZN":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return s});var a=e("@swc/helpers/cjs/_async_to_generator.cjs"),u=e("@swc/helpers/cjs/_ts_generator.cjs"),i=e("bundle-text:./style.less"),l=o.interopDefault(i);function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.length,r=void 0===t?3:t,n=e.interval,o=void 0===n?100:n,i=e.sampleRate,l=void 0===i?16e3:i,s=e.autoHideTimeout,c=void 0===s?1e4:s,f=e.onAudioChunk,p=void 0===f?function(){return null}:f;return function(e){var t=!1,n=null,i=null,s=null,f=null,d=[],b=null,h=!1,v=null,y=null,m=null,g=e.layers.add({name:"asr",html:""});function w(){g.style.display="none"}function x(e){"string"==typeof e&&(clearTimeout(v),v=setTimeout(w,c),g.style.display="",g.innerHTML=e.split(RegExp("(?<=[、。!?!?.])\\s*","u")).map(function(e){return e.trim()}).filter(Boolean).slice(-r).map(function(e){return'
'.concat(e,"
")}).join(""))}var _=function(){var e=new Blob(["\n class RecorderProcessor extends AudioWorkletProcessor {\n process(inputs) {\n const input = inputs[0];\n if (input && input[0]) {\n this.port.postMessage(input[0]);\n }\n return true;\n }\n }\n registerProcessor('recorder-processor', RecorderProcessor);\n "],{type:"application/javascript"});return URL.createObjectURL(e)};function j(){return(0,a._)(function(){return(0,u._)(this,function(e){return t&&(t=!1,clearInterval(b),b=null,s&&(s.disconnect(),s.port.onmessage=null,s=null),f&&(f.disconnect(),f=null),d=[]),[2]})})()}function A(){return(0,a._)(function(){return(0,u._)(this,function(e){switch(e.label){case 0:return[4,j()];case 1:if(e.sent(),m&&(m.disconnect(),m=null),i&&(i.disconnect(),i=null),y&&(y.getTracks().forEach(function(e){return e.stop()}),y=null),!n)return[3,3];return[4,n.close()];case 2:e.sent(),n=null,e.label=3;case 3:return h=!1,[2]}})})()}return e.on("video:volumechange",function(){f&&(f.gain.value=e.volume)}),e.on("play",function(){return(0,a._)(function(){var r,c,v;return(0,u._)(this,function(g){switch(g.label){case 0:if(t)return[2];g.label=1;case 1:return g.trys.push([1,6,,8]),[4,(0,a._)(function(){return(0,u._)(this,function(e){switch(e.label){case 0:if(n)return[2,n];if("suspended"!==(n=new(window.AudioContext||window.webkitAudioContext)({sampleRate:l})).state)return[3,2];return[4,n.resume()];case 1:e.sent(),e.label=2;case 2:return[2,n]}})})()];case 2:return g.sent(),[4,(0,a._)(function(){return(0,u._)(this,function(t){switch(t.label){case 0:if(!i&&e.video)try{return i=n.createMediaElementSource(e.video),[2,i]}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}t.label=1;case 1:var r;if(t.trys.push([1,4,,5]),y)return[3,3];return[4,(r=e.video,(0,a._)(function(){return(0,u._)(this,function(e){try{if(r.captureStream)return[2,r.captureStream()];if(r.mozCaptureStream)return[2,r.mozCaptureStream()];return console.warn("[artplayerPluginAsr] captureStream not supported"),[2,null]}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),[2,null]}})})())];case 2:y=t.sent(),t.label=3;case 3:if(y)return[2,m=n.createMediaStreamSource(y)];return[3,5];case 4:return console.warn("[artplayerPluginAsr] MediaStream fallback failed:",t.sent()),[3,5];case 5:return[2,null]}})})()];case 3:if(!(r=g.sent()))throw Error("Could not establish audio source");if(h)return[3,5];return c=_(),[4,n.audioWorklet.addModule(c)];case 4:g.sent(),URL.revokeObjectURL(c),h=!0,g.label=5;case 5:return(f=n.createGain()).gain.value=1,(s=new AudioWorkletNode(n,"recorder-processor")).port.onmessage=function(e){d.push(new Float32Array(e.data))},r.connect(s),r.connect(f),f.connect(n.destination),v=o/1e3*l,b=setInterval(function(){return(0,a._)(function(){var e,t,r,n;return(0,u._)(this,function(o){switch(o.label){case 0:var a,u,i,s,c;if(0===d.length)return[2];for(e=new Float32Array(0);e.lengthtypeof document&&!document.getElementById("artplayer-plugin-asr")){var c=document.createElement("style");c.id="artplayer-plugin-asr",c.textContent=l.default,document.head.appendChild(c)}"u">typeof window&&(window.artplayerPluginAsr=s)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","bundle-text:./style.less":"gKjNi","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,a,u){try{var i=e[a](u),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var u=e.apply(t,r);function i(e){o(u,n,a,i,l,"next",e)}function l(e){o(u,n,a,i,l,"throw",e)}i(void 0)})}}},{}],eltGh:[function(e,t,r,n){"use strict";r._=function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(u,"next",{value:l(0)}),i(u,"throw",{value:l(1)}),i(u,"return",{value:l(2)}),"function"==typeof Symbol&&i(u,Symbol.iterator,{value:function(){return this}}),u;function l(i){return function(l){var s=[i,l];if(r)throw TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]l);var a=e("bundle-text:./style.less"),i=o.interopDefault(a);function l(e={}){let{length:t=3,interval:r=100,sampleRate:n=16e3,autoHideTimeout:o=1e4,onAudioChunk:a=()=>null}=e;return e=>{let i=!1,l=null,u=null,s=null,c=null,d=[],p=null,f=!1,y=null,m=null,b=null,g=e.layers.add({name:"asr",html:""});function v(){g.style.display="none"}function h(e){"string"==typeof e&&(clearTimeout(y),y=setTimeout(v,o),g.style.display="",g.innerHTML=e.split(/(?<=[、。!?!?.])\s*/u).map(e=>e.trim()).filter(Boolean).slice(-t).map(e=>`
${e}
`).join(""))}let w=` class RecorderProcessor extends AudioWorkletProcessor { process(inputs) { const input = inputs[0]; if (input && input[0]) { this.port.postMessage(input[0]); } return true; } } registerProcessor('recorder-processor', RecorderProcessor); `;async function x(){return l||"suspended"===(l=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n})).state&&await l.resume(),l}async function j(){if(!u&&e.video)try{return u=l.createMediaElementSource(e.video)}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(m||(m=await A(e.video)),m)return b=l.createMediaStreamSource(m)}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function A(e){try{if(e.captureStream)return e.captureStream();if(e.mozCaptureStream)return e.mozCaptureStream();return console.warn("[artplayerPluginAsr] captureStream not supported"),null}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}async function P(){if(!i)try{await x();let e=await j();if(!e)throw Error("Could not establish audio source");if(!f){let e,t=(e=new Blob([w],{type:"application/javascript"}),URL.createObjectURL(e));await l.audioWorklet.addModule(t),URL.revokeObjectURL(t),f=!0}(c=l.createGain()).gain.value=1,(s=new AudioWorkletNode(l,"recorder-processor")).port.onmessage=e=>{d.push(new Float32Array(e.data))},e.connect(s),e.connect(c),c.connect(l.destination);let t=r/1e3*n;p=setInterval(async()=>{let e,r,o,i;if(0===d.length)return;let l=new Float32Array(0);for(;l.length{for(let r=0;re.stop()),m=null),l&&(await l.close(),l=null),f=!1}return e.on("video:volumechange",()=>{c&&(c.gain.value=e.volume)}),e.on("play",P),e.on("pause",U),e.on("destroy",O),{name:"artplayerPluginAsr",stop:O,hide:v,append:h}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-asr")){let e=document.createElement("style");e.id="artplayer-plugin-asr",e.textContent=i.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAsr=l)},{"bundle-text:./style.less":"27Ck2","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"27Ck2":[function(e,t,r,n){t.exports=".art-video-player .art-layer-asr{z-index:150;justify-content:end;gap:var(--art-subtitle-gap);padding:0 2%;padding-bottom:var(--art-subtitle-bottom);transition:padding-bottom var(--art-transition-duration)ease;text-shadow:var(--art-subtitle-border)1px 0 1px,var(--art-subtitle-border)0 1px 1px,var(--art-subtitle-border)-1px 0 1px,var(--art-subtitle-border)0 -1px 1px,var(--art-subtitle-border)1px 1px 1px,var(--art-subtitle-border)-1px -1px 1px,var(--art-subtitle-border)1px -1px 1px,var(--art-subtitle-border)-1px 1px 1px;flex-direction:column;font-size:1rem;display:flex;position:absolute;inset:0;pointer-events:none!important}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}"},{}],loqXi:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["ejGkt"],"ejGkt","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("ejGkt");export{e as default}; \ No newline at end of file +!function(e,t,r,n,o,a,l,i){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof u[n]&&u[n],c=s.i||{},d=s.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!d[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof u[n]&&u[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var i=d[t]=new f.Module(t);e[t][0].call(i.exports,c,i,i.exports,u)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],a=f(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),r}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=d,f.parent=s,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return u[n]}}),u[n]=f;for(var y=0;ytypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({ejGkt:[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",()=>i);var a=e("bundle-text:./style.less"),l=o.interopDefault(a);function i(e={}){let{length:t=3,interval:r=100,sampleRate:n=16e3,autoHideTimeout:o=1e4,onAudioChunk:a=()=>null}=e;return e=>{let l=!1,i=null,u=null,s=null,c=null,d=[],p=null,f=!1,y=null,m=null,b=null,g=e.layers.add({name:"asr",html:""});function v(){g.style.display="none"}function h(e){"string"==typeof e&&(clearTimeout(y),y=setTimeout(v,o),g.style.display="",g.innerHTML=e.split(/(?<=[、。!?!?.])\s*/u).map(e=>e.trim()).filter(Boolean).slice(-t).map(e=>`
${e}
`).join(""))}let w=` class RecorderProcessor extends AudioWorkletProcessor { process(inputs) { const input = inputs[0]; if (input && input[0]) { this.port.postMessage(input[0]); } return true; } } registerProcessor('recorder-processor', RecorderProcessor); `;async function x(){return i||"suspended"===(i=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n})).state&&await i.resume(),i}async function j(){if(!u&&e.video)try{return u=i.createMediaElementSource(e.video)}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(m||(m=await A(e.video)),m)return b=i.createMediaStreamSource(m)}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function A(e){try{if(e.captureStream)return e.captureStream();if(e.mozCaptureStream)return e.mozCaptureStream();return console.warn("[artplayerPluginAsr] captureStream not supported"),null}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}async function P(){if(!l)try{await x();let e=await j();if(!e)throw Error("Could not establish audio source");if(!f){let e,t=(e=new Blob([w],{type:"application/javascript"}),URL.createObjectURL(e));await i.audioWorklet.addModule(t),URL.revokeObjectURL(t),f=!0}(c=i.createGain()).gain.value=1,(s=new AudioWorkletNode(i,"recorder-processor")).port.onmessage=e=>{d.push(new Float32Array(e.data))},e.connect(s),e.connect(c),c.connect(i.destination);let t=r/1e3*n;p=setInterval(async()=>{let e,r,o,l;if(0===d.length)return;let i=new Float32Array(0);for(;i.length{for(let r=0;re.stop()),m=null),i&&(await i.close(),i=null),f=!1}return e.on("video:volumechange",()=>{c&&(c.gain.value=e.volume)}),e.on("play",P),e.on("pause",U),e.on("destroy",O),{name:"artplayerPluginAsr",stop:O,hide:v,append:h}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-asr")){let e=document.createElement("style");e.id="artplayer-plugin-asr",e.textContent=l.default,document.head.appendChild(e)}"u">typeof window&&(window.artplayerPluginAsr=i)},{"bundle-text:./style.less":"27Ck2","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"27Ck2":[function(e,t,r,n){t.exports=".art-video-player .art-layer-asr{z-index:150;justify-content:end;gap:var(--art-subtitle-gap);padding:0 2%;padding-bottom:var(--art-subtitle-bottom);transition:padding-bottom var(--art-transition-duration)ease;text-shadow:var(--art-subtitle-border)1px 0 1px,var(--art-subtitle-border)0 1px 1px,var(--art-subtitle-border)-1px 0 1px,var(--art-subtitle-border)0 -1px 1px,var(--art-subtitle-border)1px 1px 1px,var(--art-subtitle-border)-1px -1px 1px,var(--art-subtitle-border)1px -1px 1px,var(--art-subtitle-border)-1px 1px 1px;flex-direction:column;font-size:1rem;display:flex;position:absolute;inset:0;pointer-events:none!important}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}"},{}],loqXi:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["ejGkt"],"ejGkt","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("ejGkt");export{e as default}; \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-auto-thumbnail.js b/docs/compiled/artplayer-plugin-auto-thumbnail.js index 1a95b6e2a..ff714ed86 100644 --- a/docs/compiled/artplayer-plugin-auto-thumbnail.js +++ b/docs/compiled/artplayer-plugin-auto-thumbnail.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-auto-thumbnail.js v1.0.1 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,r,o,u,i,l){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof f[r]&&f[r],a=d.i||{},c=d.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!c[t]){if(!e[t]){if(o[t])return o[t];var u="function"==typeof f[r]&&f[r];if(!n&&u)return u(t,!0);if(d)return d(t,!0);if(s&&"string"==typeof t)return s(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}a.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},a.cache={};var l=c[t]=new p.Module(t);e[t][0].call(l.exports,a,l,l.exports,f)}return c[t].exports;function a(e){var t=a.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],o=e[2]||e[0],u=p(r);"*"===t?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===o?Object.defineProperty(n,t,{enumerable:!0,value:u}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===o?u.__esModule?u.default:u:u[o]}})}),n}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=d,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=a,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return f[r]}}),f[r]=p;for(var m=0;m(t.on("video:loadedmetadata",()=>{let n=e.url||t.option.url,r=e.width||160,o=e.number||100,u=e.scale||1;!function({url:e,width:t,number:n},r){let o=document.createElement("video");o.crossOrigin="anonymous",o.src=e,o.onloadedmetadata=()=>{let e=o.duration,u=document.createElement("canvas"),i=u.getContext("2d"),l=Math.floor(t*o.videoHeight/o.videoWidth);u.width=10*t,u.height=l*Math.ceil(n/10);let f=null;!function d(a){u.toBlob(e=>{URL.revokeObjectURL(f),r({url:f=URL.createObjectURL(e),height:l})},"image/jpeg"),a>=n||(o.currentTime=e*a/n,o.onseeked=()=>{i.drawImage(o,a%10*t,Math.floor(a/10)*l,t,l),d(a+1)})}(0)}}({url:n,width:r,number:o},e=>{t.thumbnails={...e,column:10,number:o,width:r,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}o.defineInteropFlag(n),o.export(n,"default",()=>u),"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,n,r){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})}},{}]},["6MsoC"],"6MsoC","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,r,o,n,u,i,l){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof a[o]&&a[o],c=f.i||{},d=f.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!d[t]){if(!e[t]){if(n[t])return n[t];var u="function"==typeof a[o]&&a[o];if(!r&&u)return u(t,!0);if(f)return f(t,!0);if(s&&"string"==typeof t)return s(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}c.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},c.cache={};var l=d[t]=new p.Module(t);e[t][0].call(l.exports,c,l,l.exports,a)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],o=e[1],n=e[2]||e[0],u=p(o);"*"===t?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:u}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?u.__esModule?u.default:u:u[n]}})}),r}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=c,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var m=0;mtypeof module?module.exports=y:"function"==typeof define&&define.amd&&define(function(){return y})}}({"6MsoC":[function(e,t,r,o){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function u(e){return async t=>(t.on("video:loadedmetadata",()=>{let r=e.url||t.option.url,o=e.width||160,n=e.number||100,u=e.scale||1;!function({url:e,width:t,number:r},o){let n=document.createElement("video");n.crossOrigin="anonymous",n.src=e,n.onloadedmetadata=()=>{let e=n.duration,u=document.createElement("canvas"),i=u.getContext("2d"),l=Math.floor(t*n.videoHeight/n.videoWidth);u.width=10*t,u.height=l*Math.ceil(r/10);let a=null;!function f(c){u.toBlob(e=>{URL.revokeObjectURL(a),o({url:a=URL.createObjectURL(e),height:l})},"image/jpeg"),c>=r||(n.currentTime=e*c/r,n.onseeked=()=>{i.drawImage(n,c%10*t,Math.floor(c/10)*l,t,l),f(c+1)})}(0)}}({url:r,width:o,number:n},e=>{t.thumbnails={...e,column:10,number:n,width:o,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}n.defineInteropFlag(r),n.export(r,"default",()=>u),"u">typeof window&&(window.artplayerPluginAutoThumbnail=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,r,o){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["6MsoC"],"6MsoC","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-auto-thumbnail.legacy.js b/docs/compiled/artplayer-plugin-auto-thumbnail.legacy.js index 9f21f85fd..00e4f7d09 100644 --- a/docs/compiled/artplayer-plugin-auto-thumbnail.legacy.js +++ b/docs/compiled/artplayer-plugin-auto-thumbnail.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-auto-thumbnail.js v1.0.1 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o,i,c,u){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof a[n]&&a[n],s=f.i||{},l=f.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!l[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof a[n]&&a[n];if(!r&&i)return i(t,!0);if(f)return f(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var u=l[t]=new d.Module(t);e[t][0].call(u.exports,s,u,u.exports,a)}return l[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],i=d(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=l,d.parent=f,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=s,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return a[n]}}),a[n]=d;for(var y=0;y=a||(f.currentTime=e*s/a,f.onseeked=function(){r.drawImage(f,s%10*i,Math.floor(s/10)*o,i,o),u(s+1)})}(0)}}),[2,{name:"artplayerPluginAutoThumbnail"}]})})()}}"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=f)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_object_spread_props.cjs":"3G1wX","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var c=e.apply(t,r);function u(e){o(c,n,i,u,a,"next",e)}function a(e){o(c,n,i,u,a,"throw",e)}u(void 0)})}}},{}],kyoEj:[function(e,t,r,n){"use strict";var o=e("9f9b8a24218ee51e");r._=function(e){for(var t=1;tt.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function s(e,t,r,n){var o,c=arguments.length,u=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(c<3?o(u):c>3?o(t,r,u):o(t,r))||u);return c>3&&u&&Object.defineProperty(t,r,u),u}function l(e,t){return function(r,n){t(r,n,e)}}function p(e,t,r,n,o,c){function u(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var a,f=n.kind,s="getter"===f?"get":"setter"===f?"set":"value",l=!t&&e?n.static?e:e.prototype:null,p=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d=!1,y=r.length-1;y>=0;y--){var _={};for(var h in n)_[h]="access"===h?{}:n[h];for(var h in n.access)_.access[h]=n.access[h];_.addInitializer=function(e){if(d)throw TypeError("Cannot add initializers after decoration has completed");c.push(u(e||null))};var b=(0,r[y])("accessor"===f?{get:p.get,set:p.set}:p[s],_);if("accessor"===f){if(void 0===b)continue;if(null===b||(void 0===b?"undefined":(0,i._)(b))!=="object")throw TypeError("Object expected");(a=u(b.get))&&(p.get=a),(a=u(b.set))&&(p.set=a),(a=u(b.init))&&o.unshift(a)}else(a=u(b))&&("field"===f?o.unshift(a):p[s]=a)}l&&Object.defineProperty(l,n.name,p),d=!0}function d(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])&&(6===f[0]||2===f[0])){i=0;continue}if(3===f[0]&&(!o||f[1]>o[0]&&f[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c}function O(){for(var e=[],t=0;t1||u(e,t)})},t&&(n[e]=t(n[e])))}function u(e,t){try{var r;(r=o[e](t)).value instanceof E?Promise.resolve(r.value.v).then(a,f):s(i[0][2],r)}catch(e){s(i[0][3],e)}}function a(e){u("next",e)}function f(e){u("throw",e)}function s(e,t){e(t),i.shift(),i.length&&u(i[0][0],i[0][1])}}function T(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:E(e[n](t)),done:!1}:o?o(t):t}:o}}function I(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=j(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){var i,c,u;i=n,c=o,u=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:u})},c)})}}}function D(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var R=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},M=function(e){return(M=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function k(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=M(e),n=0;ntypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof a[n]&&a[n],s=l.i||{},f=l.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var u="function"==typeof a[n]&&a[n];if(!r&&u)return u(t,!0);if(l)return l(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var i=f[t]=new d.Module(t);e[t][0].call(i.exports,s,i,i.exports,a)}return f[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],u=d(n);"*"===t?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:u}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?u.__esModule?u.default:u:u[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=f,d.parent=l,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=s,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return a[n]}}),a[n]=d;for(var b=0;btypeof module?module.exports=y:"function"==typeof define&&define.amd&&define(function(){return y})}}({"9JZgh":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return l});var u=e("@swc/helpers/cjs/_async_to_generator.cjs"),c=e("@swc/helpers/cjs/_object_spread.cjs"),i=e("@swc/helpers/cjs/_object_spread_props.cjs"),a=e("@swc/helpers/cjs/_ts_generator.cjs");function l(e){return function(t){return(0,u._)(function(){return(0,a._)(this,function(r){return t.on("video:loadedmetadata",function(){var r,n,o,u,a,l,s=e.url||t.option.url,f=e.width||160,p=e.number||100,d=e.scale||1;r={url:s,width:f,number:p},n=function(e){t.thumbnails=(0,i._)((0,c._)({},e),{column:10,number:p,width:f,scale:d})},o=r.url,u=r.width,a=r.number,(l=document.createElement("video")).crossOrigin="anonymous",l.src=o,l.onloadedmetadata=function(){var e=l.duration,t=document.createElement("canvas"),r=t.getContext("2d"),o=Math.floor(u*l.videoHeight/l.videoWidth);t.width=10*u,t.height=o*Math.ceil(a/10);var c=null;!function i(s){t.toBlob(function(e){URL.revokeObjectURL(c),n({url:c=URL.createObjectURL(e),height:o})},"image/jpeg"),s>=a||(l.currentTime=e*s/a,l.onseeked=function(){r.drawImage(l,s%10*u,Math.floor(s/10)*o,u,o),i(s+1)})}(0)}}),[2,{name:"artplayerPluginAutoThumbnail"}]})})()}}"u">typeof window&&(window.artplayerPluginAutoThumbnail=l)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_object_spread_props.cjs":"3G1wX","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,u,c){try{var i=e[u](c),a=i.value}catch(e){r(e);return}i.done?t(a):Promise.resolve(a).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,u){var c=e.apply(t,r);function i(e){o(c,n,u,i,a,"next",e)}function a(e){o(c,n,u,i,a,"throw",e)}i(void 0)})}}},{}],kyoEj:[function(e,t,r,n){"use strict";var o=e("9f9b8a24218ee51e");r._=function(e){for(var t=1;t0&&o[o.length-1])&&(6===l[0]||2===l[0])){u=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1](t.on("video:loadedmetadata",()=>{let r=e.url||t.option.url,n=e.width||160,o=e.number||100,u=e.scale||1;!function({url:e,width:t,number:r},n){let o=document.createElement("video");o.crossOrigin="anonymous",o.src=e,o.onloadedmetadata=()=>{let e=o.duration,u=document.createElement("canvas"),i=u.getContext("2d"),l=Math.floor(t*o.videoHeight/o.videoWidth);u.width=10*t,u.height=l*Math.ceil(r/10);let f=null;!function a(d){u.toBlob(e=>{URL.revokeObjectURL(f),n({url:f=URL.createObjectURL(e),height:l})},"image/jpeg"),d>=r||(o.currentTime=e*d/r,o.onseeked=()=>{i.drawImage(o,d%10*t,Math.floor(d/10)*l,t,l),a(d+1)})}(0)}}({url:r,width:n,number:o},e=>{t.thumbnails={...e,column:10,number:o,width:n,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}o.defineInteropFlag(r),o.export(r,"default",()=>u),"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["lry5Y"],"lry5Y","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("lry5Y");export{e as default}; \ No newline at end of file +!function(e,t,r,o,n,u,i,l){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof a[o]&&a[o],c=f.i||{},d=f.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!d[t]){if(!e[t]){if(n[t])return n[t];var u="function"==typeof a[o]&&a[o];if(!r&&u)return u(t,!0);if(f)return f(t,!0);if(s&&"string"==typeof t)return s(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}c.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},c.cache={};var l=d[t]=new p.Module(t);e[t][0].call(l.exports,c,l,l.exports,a)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],o=e[1],n=e[2]||e[0],u=p(o);"*"===t?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:u}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?u.__esModule?u.default:u:u[n]}})}),r}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=c,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var y=0;ytypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({lry5Y:[function(e,t,r,o){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function u(e){return async t=>(t.on("video:loadedmetadata",()=>{let r=e.url||t.option.url,o=e.width||160,n=e.number||100,u=e.scale||1;!function({url:e,width:t,number:r},o){let n=document.createElement("video");n.crossOrigin="anonymous",n.src=e,n.onloadedmetadata=()=>{let e=n.duration,u=document.createElement("canvas"),i=u.getContext("2d"),l=Math.floor(t*n.videoHeight/n.videoWidth);u.width=10*t,u.height=l*Math.ceil(r/10);let a=null;!function f(c){u.toBlob(e=>{URL.revokeObjectURL(a),o({url:a=URL.createObjectURL(e),height:l})},"image/jpeg"),c>=r||(n.currentTime=e*c/r,n.onseeked=()=>{i.drawImage(n,c%10*t,Math.floor(c/10)*l,t,l),f(c+1)})}(0)}}({url:r,width:o,number:n},e=>{t.thumbnails={...e,column:10,number:n,width:o,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}n.defineInteropFlag(r),n.export(r,"default",()=>u),"u">typeof window&&(window.artplayerPluginAutoThumbnail=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,t,r,o){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["lry5Y"],"lry5Y","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("lry5Y");export{e as default}; \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-chapter.js b/docs/compiled/artplayer-plugin-chapter.js index 70b7f6a22..3a1f3ad83 100644 --- a/docs/compiled/artplayer-plugin-chapter.js +++ b/docs/compiled/artplayer-plugin-chapter.js @@ -1,8 +1,8 @@ /*! - * artplayer-plugin-chapter.js v1.0.1 + * artplayer-plugin-chapter.js v1.0.2 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,a,n,o,i,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[a]&&d[a],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(n[t])return n[t];var o="function"==typeof d[a]&&d[a];if(!r&&o)return o(t,!0);if(p)return p(t,!0);if(c&&"string"==typeof t)return c(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},s.cache={};var l=u[t]=new f.Module(t);e[t][0].call(l.exports,s,l,l.exports,d)}return u[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],n=e[2]||e[0],o=f(a);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:o}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[a]}}),d[a]=f;for(var h=0;hl);var o=e("bundle-text:./style.less"),i=n.interopDefault(o);function l(e={}){return t=>{let{$player:r}=t.template,{setStyle:a,append:n,clamp:o,query:i,isMobile:l,addClass:d,removeClass:p}=t.constructor.utils,s=`
`,u=null,c=[],f=t.query(".art-control-progress"),h=t.query(".art-control-progress-inner"),y=n(h,'
'),g=n(h,'
');function m({$chapter:e,width:t}){let r=e.dataset.title.trim();if(r){a(g,"display","flex"),g.textContent=r;let e=g.clientWidth;t<=e/2?a(g,"left",0):t>h.clientWidth-e/2?a(g,"left",`${h.clientWidth-e}px`):a(g,"left",`${t-e/2}px`)}else a(g,"display","none")}function v(e=[]){if((c=[],y.textContent="",p(r,"artplayer-plugin-chapter"),Array.isArray(e)&&e.length)&&t.duration){e=e.sort((e,t)=>e.start-t.start);for(let r=0;rt.duration||a.start>=a.end||n&&a.end>n.start)throw Error("Illegal chapter time point")}e[0].start>0&&e.unshift({start:0,end:e[0].start,title:""}),e[e.length-1].end{let r=n(y,s),a=o(e.start,0,t.duration),l=o(e.end,0,t.duration),d=l-a,p=d/t.duration;return r.dataset.start=a,r.dataset.end=l,r.dataset.duration=d,r.dataset.title=e.title.trim(),r.style.width=`${100*p}%`,{$chapter:r,$hover:i(".art-progress-hover",r),$loaded:i(".art-progress-loaded",r),$played:i(".art-progress-played",r)}}),d(r,"artplayer-plugin-chapter"),t.emit("setBar","loaded",t.loaded||0)}}return t.on("setBar",(e,r,n)=>{if(c.length)for(let o=0;ow&&a(f,"width","100%"),v>=x&&v<=w){let t=(v-x)/b;a(f,"width",`${100*t}%`),l?"played"===e&&n&&(m({$chapter:i,width:h}),clearTimeout(u),u=setTimeout(()=>{a(g,"display","none")},500)):"hover"===e&&m({$chapter:i,width:h})}}}),l||t.proxy(f,"mouseleave",()=>{c.length&&a(g,"display","none")}),t.once("video:loadedmetadata",()=>v(e.chapters)),{name:"artplayerPluginChapter",update:({chapters:e})=>v(e)}}}if("undefined"!=typeof document){let e="artplayer-plugin-chapter",t=document.getElementById(e);t||((t=document.createElement("style")).id=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(t)}):(document.head||document.documentElement).appendChild(t)),t.textContent=i.default}"undefined"!=typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"4RPBI","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"4RPBI":[function(e,t,r,a){t.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:#0000!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;inset:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);padding:3px 5px;font-size:14px;line-height:1;display:none;position:absolute;top:-50px;left:0}"},{}],"6ykb1":[function(e,t,r,a){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["3VfEb"],"3VfEb","parcelRequire4dc0",{}); \ No newline at end of file +!function(t,e,r,a,n,o,i,l){var d="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},p="function"==typeof d[a]&&d[a],s=p.i||{},u=p.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(e,r){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof d[a]&&d[a];if(!r&&o)return o(e,!0);if(p)return p(e,!0);if(c&&"string"==typeof e)return c(e);var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=t[e][1][r];return null!=a?a:r},s.cache={};var l=u[e]=new f.Module(e);t[e][0].call(l.exports,s,l,l.exports,d)}return u[e].exports;function s(t){var e=s.resolve(t);if(!1===e)return{};if(Array.isArray(e)){var r={__esModule:!0};return e.forEach(function(t){var e=t[0],a=t[1],n=t[2]||t[0],o=f(a);"*"===e?Object.keys(o).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return o[t]}})}):"*"===n?Object.defineProperty(r,e,{enumerable:!0,value:o}):Object.defineProperty(r,e,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(e)}}f.isParcelRequire=!0,f.Module=function(t){this.id=t,this.bundle=f,this.require=c,this.exports={}},f.modules=t,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[a]}}),d[a]=f;for(var h=0;htypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"3VfEb":[function(t,e,r,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",()=>l);var o=t("bundle-text:./style.less"),i=n.interopDefault(o);function l(t={}){return e=>{let{$player:r}=e.template,{setStyle:a,append:n,clamp:o,query:i,addClass:l,removeClass:d}=e.constructor.utils,p=`
`,s=[],u=e.query(".art-control-progress-inner"),c=n(u,'
'),f=n(u,'
');function h(t=[]){if((s=[],c.textContent="",d(r,"artplayer-plugin-chapter"),Array.isArray(t)&&t.length)&&e.duration){t=t.sort((t,e)=>t.start-e.start);for(let r=0;re.duration||a.start>=a.end||n&&a.end>n.start)throw Error("Illegal chapter time point")}t[0].start>0&&t.unshift({start:0,end:t[0].start,title:""}),t[t.length-1].end{let r=n(c,p),a=o(t.start,0,e.duration),l=o(t.end,0,e.duration),d=l-a,s=d/e.duration;return r.dataset.start=a,r.dataset.end=l,r.dataset.duration=d,r.dataset.title=t.title.trim(),r.style.width=`${100*s}%`,{$chapter:r,$hover:i(".art-progress-hover",r),$loaded:i(".art-progress-loaded",r),$played:i(".art-progress-played",r)}}),l(r,"artplayer-plugin-chapter"),e.emit("setBar","loaded",e.loaded||0)}}return e.on("setBar",(t,r)=>{if(s.length)for(let n=0;nv&&a(p,"width","100%"),g>=m&&g<=v){let e=(g-m)/y;a(p,"width",`${100*e}%`),"hover"===t&&h>0&&function({$chapter:t,width:e}){let r=t.dataset.title.trim();if(r){f.textContent=r;let t=f.clientWidth;e<=t/2?a(f,"left",0):e>u.clientWidth-t/2?a(f,"left",`${u.clientWidth-t}px`):a(f,"left",`${e-t/2}px`)}}({$chapter:o,width:h})}}}),e.once("video:loadedmetadata",()=>h(t.chapters)),{name:"artplayerPluginChapter",update:({chapters:t})=>h(t)}}}if("u">typeof document){let t="artplayer-plugin-chapter",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=i.default}"u">typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"4RPBI","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"4RPBI":[function(t,e,r,a){e.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:#0000!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;inset:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{transform-origin:bottom;opacity:0;z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration)ease,opacity var(--art-transition-duration)ease;padding:3px 5px;font-size:14px;line-height:1;position:absolute;top:-50px;left:0;transform:scale(.5)}.artplayer-plugin-chapter.art-progress-hover .art-chapter-title{opacity:1;transform:scale(1)}"},{}],"6ykb1":[function(t,e,r,a){r.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},r.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.exportAll=function(t,e){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e},r.export=function(t,e,r){Object.defineProperty(t,e,{enumerable:!0,get:r})}},{}]},["3VfEb"],"3VfEb","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-chapter.legacy.js b/docs/compiled/artplayer-plugin-chapter.legacy.js index eac373f70..068803a25 100644 --- a/docs/compiled/artplayer-plugin-chapter.legacy.js +++ b/docs/compiled/artplayer-plugin-chapter.legacy.js @@ -1,8 +1,8 @@ /*! - * artplayer-plugin-chapter.js v1.0.1 + * artplayer-plugin-chapter.js v1.0.2 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,a,o,i,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[n]&&d[n],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(a[t])return a[t];var o="function"==typeof d[n]&&d[n];if(!r&&o)return o(t,!0);if(p)return p(t,!0);if(c&&"string"==typeof t)return c(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var l=u[t]=new f.Module(t);e[t][0].call(l.exports,s,l,l.exports,d)}return u[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],a=e[2]||e[0],o=f(n);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===a?Object.defineProperty(r,t,{enumerable:!0,value:o}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===a?o.__esModule?o.default:o:o[a]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[n]}}),d[n]=f;for(var h=0;h0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var r=t.template.$player,n=t.constructor.utils,a=n.setStyle,o=n.append,i=n.clamp,l=n.query,d=n.isMobile,p=n.addClass,s=n.removeClass,u=null,c=[],f=t.query(".art-control-progress"),h=t.query(".art-control-progress-inner"),y=o(h,'
'),g=o(h,'
');function v(e){var t=e.$chapter,r=e.width,n=t.dataset.title.trim();if(n){a(g,"display","flex"),g.textContent=n;var o=g.clientWidth;r<=o/2?a(g,"left",0):r>h.clientWidth-o/2?a(g,"left","".concat(h.clientWidth-o,"px")):a(g,"left","".concat(r-o/2,"px"))}else a(g,"display","none")}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if((c=[],y.textContent="",s(r,"artplayer-plugin-chapter"),Array.isArray(e)&&e.length)&&t.duration){e=e.sort(function(e,t){return e.start-t.start});for(var n=0;nt.duration||a.start>=a.end||d&&a.end>d.start)throw Error("Illegal chapter time point")}e[0].start>0&&e.unshift({start:0,end:e[0].start,title:""}),e[e.length-1].end\n
\n
\n
\n
\n
\n\n '),n=i(e.start,0,t.duration),a=i(e.end,0,t.duration),d=a-n,p=d/t.duration;return r.dataset.start=n,r.dataset.end=a,r.dataset.duration=d,r.dataset.title=e.title.trim(),r.style.width="".concat(100*p,"%"),{$chapter:r,$hover:l(".art-progress-hover",r),$loaded:l(".art-progress-loaded",r),$played:l(".art-progress-played",r)}}),p(r,"artplayer-plugin-chapter"),t.emit("setBar","loaded",t.loaded||0)}}return t.on("setBar",function(e,r,n){if(c.length)for(var o=0;ow&&a(f,"width","100%"),m>=x&&m<=w){var O=(m-x)/b;a(f,"width","".concat(100*O,"%")),d?"played"===e&&n&&(v({$chapter:l,width:h}),clearTimeout(u),u=setTimeout(function(){a(g,"display","none")},500)):"hover"===e&&v({$chapter:l,width:h})}}}),d||t.proxy(f,"mouseleave",function(){c.length&&a(g,"display","none")}),t.once("video:loadedmetadata",function(){return m(e.chapters)}),{name:"artplayerPluginChapter",update:function(e){return m(e.chapters)}}}}if("undefined"!=typeof document){var d="artplayer-plugin-chapter",p=document.getElementById(d);p||((p=document.createElement("style")).id=d,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",function(){document.head.appendChild(p)}):(document.head||document.documentElement).appendChild(p)),p.textContent=i.default}"undefined"!=typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"35ZxU","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"35ZxU":[function(e,t,r,n){t.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:transparent!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;top:0;bottom:0;left:0;right:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);padding:3px 5px;font-size:14px;line-height:1;display:none;position:absolute;top:-50px;left:0}"},{}],qpMMf:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["7hySu"],"7hySu","parcelRequire4dc0",{}); \ No newline at end of file +!function(t,e,r,a,n,o,i,l){var p="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},d="function"==typeof p[a]&&p[a],s=d.i||{},u=d.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(e,r){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof p[a]&&p[a];if(!r&&o)return o(e,!0);if(d)return d(e,!0);if(c&&"string"==typeof e)return c(e);var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=t[e][1][r];return null!=a?a:r},s.cache={};var l=u[e]=new f.Module(e);t[e][0].call(l.exports,s,l,l.exports,p)}return u[e].exports;function s(t){var e=s.resolve(t);if(!1===e)return{};if(Array.isArray(e)){var r={__esModule:!0};return e.forEach(function(t){var e=t[0],a=t[1],n=t[2]||t[0],o=f(a);"*"===e?Object.keys(o).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return o[t]}})}):"*"===n?Object.defineProperty(r,e,{enumerable:!0,value:o}):Object.defineProperty(r,e,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(e)}}f.isParcelRequire=!0,f.Module=function(t){this.id=t,this.bundle=f,this.require=c,this.exports={}},f.modules=t,f.cache=u,f.parent=d,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return p[a]}}),p[a]=f;for(var h=0;htypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"7hySu":[function(t,e,r,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return l});var o=t("bundle-text:./style.less"),i=n.interopDefault(o);function l(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e){var r=e.template.$player,a=e.constructor.utils,n=a.setStyle,o=a.append,i=a.clamp,l=a.query,p=a.addClass,d=a.removeClass,s=[],u=e.query(".art-control-progress-inner"),c=o(u,'
'),f=o(u,'
');function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if((s=[],c.textContent="",d(r,"artplayer-plugin-chapter"),Array.isArray(t)&&t.length)&&e.duration){t=t.sort(function(t,e){return t.start-e.start});for(var a=0;ae.duration||n.start>=n.end||u&&n.end>u.start)throw Error("Illegal chapter time point")}t[0].start>0&&t.unshift({start:0,end:t[0].start,title:""}),t[t.length-1].end\n
\n
\n
\n
\n
\n\n '),a=i(t.start,0,e.duration),n=i(t.end,0,e.duration),p=n-a,d=p/e.duration;return r.dataset.start=a,r.dataset.end=n,r.dataset.duration=p,r.dataset.title=t.title.trim(),r.style.width="".concat(100*d,"%"),{$chapter:r,$hover:l(".art-progress-hover",r),$loaded:l(".art-progress-loaded",r),$played:l(".art-progress-played",r)}}),p(r,"artplayer-plugin-chapter"),e.emit("setBar","loaded",e.loaded||0)}}return e.on("setBar",function(t,r){if(s.length)for(var a=0;am&&n(d,"width","100%"),g>=v&&g<=m){var b=(g-v)/y;n(d,"width","".concat(100*b,"%")),"hover"===t&&h>0&&function(t){var e=t.$chapter,r=t.width,a=e.dataset.title.trim();if(a){f.textContent=a;var o=f.clientWidth;r<=o/2?n(f,"left",0):r>u.clientWidth-o/2?n(f,"left","".concat(u.clientWidth-o,"px")):n(f,"left","".concat(r-o/2,"px"))}}({$chapter:i,width:h})}}}),e.once("video:loadedmetadata",function(){return h(t.chapters)}),{name:"artplayerPluginChapter",update:function(t){return h(t.chapters)}}}}if("u">typeof document){var p="artplayer-plugin-chapter",d=document.getElementById(p);d||((d=document.createElement("style")).id=p,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",function(){document.head.appendChild(d)}):(document.head||document.documentElement).appendChild(d)),d.textContent=i.default}"u">typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"35ZxU","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"35ZxU":[function(t,e,r,a){e.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:transparent!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;top:0;bottom:0;left:0;right:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{transform-origin:bottom;opacity:0;z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration)ease,opacity var(--art-transition-duration)ease;padding:3px 5px;font-size:14px;line-height:1;position:absolute;top:-50px;left:0;transform:scale(.5)}.artplayer-plugin-chapter.art-progress-hover .art-chapter-title{opacity:1;transform:scale(1)}"},{}],qpMMf:[function(t,e,r,a){r.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},r.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.exportAll=function(t,e){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e},r.export=function(t,e,r){Object.defineProperty(t,e,{enumerable:!0,get:r})}},{}]},["7hySu"],"7hySu","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-chapter.mjs b/docs/compiled/artplayer-plugin-chapter.mjs index 9ca8645e7..053c61325 100644 --- a/docs/compiled/artplayer-plugin-chapter.mjs +++ b/docs/compiled/artplayer-plugin-chapter.mjs @@ -1,8 +1,8 @@ /*! - * artplayer-plugin-chapter.js v1.0.1 + * artplayer-plugin-chapter.js v1.0.2 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,a,n,o,i,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[a]&&d[a],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(n[t])return n[t];var o="function"==typeof d[a]&&d[a];if(!r&&o)return o(t,!0);if(p)return p(t,!0);if(c&&"string"==typeof t)return c(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},s.cache={};var l=u[t]=new f.Module(t);e[t][0].call(l.exports,s,l,l.exports,d)}return u[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],n=e[2]||e[0],o=f(a);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:o}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[a]}}),d[a]=f;for(var h=0;hl);var o=e("bundle-text:./style.less"),i=n.interopDefault(o);function l(e={}){return t=>{let{$player:r}=t.template,{setStyle:a,append:n,clamp:o,query:i,isMobile:l,addClass:d,removeClass:p}=t.constructor.utils,s=`
`,u=null,c=[],f=t.query(".art-control-progress"),h=t.query(".art-control-progress-inner"),g=n(h,'
'),y=n(h,'
');function m({$chapter:e,width:t}){let r=e.dataset.title.trim();if(r){a(y,"display","flex"),y.textContent=r;let e=y.clientWidth;t<=e/2?a(y,"left",0):t>h.clientWidth-e/2?a(y,"left",`${h.clientWidth-e}px`):a(y,"left",`${t-e/2}px`)}else a(y,"display","none")}function v(e=[]){if((c=[],g.textContent="",p(r,"artplayer-plugin-chapter"),Array.isArray(e)&&e.length)&&t.duration){e=e.sort((e,t)=>e.start-t.start);for(let r=0;rt.duration||a.start>=a.end||n&&a.end>n.start)throw Error("Illegal chapter time point")}e[0].start>0&&e.unshift({start:0,end:e[0].start,title:""}),e[e.length-1].end{let r=n(g,s),a=o(e.start,0,t.duration),l=o(e.end,0,t.duration),d=l-a,p=d/t.duration;return r.dataset.start=a,r.dataset.end=l,r.dataset.duration=d,r.dataset.title=e.title.trim(),r.style.width=`${100*p}%`,{$chapter:r,$hover:i(".art-progress-hover",r),$loaded:i(".art-progress-loaded",r),$played:i(".art-progress-played",r)}}),d(r,"artplayer-plugin-chapter"),t.emit("setBar","loaded",t.loaded||0)}}return t.on("setBar",(e,r,n)=>{if(c.length)for(let o=0;ow&&a(f,"width","100%"),v>=x&&v<=w){let t=(v-x)/b;a(f,"width",`${100*t}%`),l?"played"===e&&n&&(m({$chapter:i,width:h}),clearTimeout(u),u=setTimeout(()=>{a(y,"display","none")},500)):"hover"===e&&m({$chapter:i,width:h})}}}),l||t.proxy(f,"mouseleave",()=>{c.length&&a(y,"display","none")}),t.once("video:loadedmetadata",()=>v(e.chapters)),{name:"artplayerPluginChapter",update:({chapters:e})=>v(e)}}}if("undefined"!=typeof document){let e="artplayer-plugin-chapter",t=document.getElementById(e);t||((t=document.createElement("style")).id=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(t)}):(document.head||document.documentElement).appendChild(t)),t.textContent=i.default}"undefined"!=typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"3lhZb","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3lhZb":[function(e,t,r,a){t.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:#0000!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;inset:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);padding:3px 5px;font-size:14px;line-height:1;display:none;position:absolute;top:-50px;left:0}"},{}],loqXi:[function(e,t,r,a){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["fwWaD"],"fwWaD","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("fwWaD");export{e as default}; \ No newline at end of file +!function(e,t,r,a,n,o,i,l){var d="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},p="function"==typeof d[a]&&d[a],s=p.i||{},u=p.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(n[t])return n[t];var o="function"==typeof d[a]&&d[a];if(!r&&o)return o(t,!0);if(p)return p(t,!0);if(c&&"string"==typeof t)return c(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},s.cache={};var l=u[t]=new f.Module(t);e[t][0].call(l.exports,s,l,l.exports,d)}return u[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],n=e[2]||e[0],o=f(a);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:o}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[a]}}),d[a]=f;for(var h=0;htypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({fwWaD:[function(e,t,r,a){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",()=>l);var o=e("bundle-text:./style.less"),i=n.interopDefault(o);function l(e={}){return t=>{let{$player:r}=t.template,{setStyle:a,append:n,clamp:o,query:i,addClass:l,removeClass:d}=t.constructor.utils,p=`
`,s=[],u=t.query(".art-control-progress-inner"),c=n(u,'
'),f=n(u,'
');function h(e=[]){if((s=[],c.textContent="",d(r,"artplayer-plugin-chapter"),Array.isArray(e)&&e.length)&&t.duration){e=e.sort((e,t)=>e.start-t.start);for(let r=0;rt.duration||a.start>=a.end||n&&a.end>n.start)throw Error("Illegal chapter time point")}e[0].start>0&&e.unshift({start:0,end:e[0].start,title:""}),e[e.length-1].end{let r=n(c,p),a=o(e.start,0,t.duration),l=o(e.end,0,t.duration),d=l-a,s=d/t.duration;return r.dataset.start=a,r.dataset.end=l,r.dataset.duration=d,r.dataset.title=e.title.trim(),r.style.width=`${100*s}%`,{$chapter:r,$hover:i(".art-progress-hover",r),$loaded:i(".art-progress-loaded",r),$played:i(".art-progress-played",r)}}),l(r,"artplayer-plugin-chapter"),t.emit("setBar","loaded",t.loaded||0)}}return t.on("setBar",(e,r)=>{if(s.length)for(let n=0;nv&&a(p,"width","100%"),g>=m&&g<=v){let t=(g-m)/y;a(p,"width",`${100*t}%`),"hover"===e&&h>0&&function({$chapter:e,width:t}){let r=e.dataset.title.trim();if(r){f.textContent=r;let e=f.clientWidth;t<=e/2?a(f,"left",0):t>u.clientWidth-e/2?a(f,"left",`${u.clientWidth-e}px`):a(f,"left",`${t-e/2}px`)}}({$chapter:o,width:h})}}}),t.once("video:loadedmetadata",()=>h(e.chapters)),{name:"artplayerPluginChapter",update:({chapters:e})=>h(e)}}}if("u">typeof document){let e="artplayer-plugin-chapter",t=document.getElementById(e);t||((t=document.createElement("style")).id=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(t)}):(document.head||document.documentElement).appendChild(t)),t.textContent=i.default}"u">typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"3lhZb","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3lhZb":[function(e,t,r,a){t.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:#0000!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;inset:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{transform-origin:bottom;opacity:0;z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration)ease,opacity var(--art-transition-duration)ease;padding:3px 5px;font-size:14px;line-height:1;position:absolute;top:-50px;left:0;transform:scale(.5)}.artplayer-plugin-chapter.art-progress-hover .art-chapter-title{opacity:1;transform:scale(1)}"},{}],loqXi:[function(e,t,r,a){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["fwWaD"],"fwWaD","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("fwWaD");export{e as default}; \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-chromecast.js b/docs/compiled/artplayer-plugin-chromecast.js index 2da82860f..a2cb2a55a 100644 --- a/docs/compiled/artplayer-plugin-chromecast.js +++ b/docs/compiled/artplayer-plugin-chromecast.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-chromecast.js v1.0.1 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,o,n,r,i,a,c){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof s[n]&&s[n],l=d.i||{},u=d.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,o){if(!u[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof s[n]&&s[n];if(!o&&i)return i(t,!0);if(d)return d(t,!0);if(f&&"string"==typeof t)return f(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},l.cache={};var c=u[t]=new p.Module(t);e[t][0].call(c.exports,l,c,c.exports,s)}return u[t].exports;function l(e){var t=l.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var o={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],i=p(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(o,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===r?Object.defineProperty(o,t,{enumerable:!0,value:i}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===r?i.__esModule?i.default:i:i[r]}})}),o}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=f,this.exports={}},p.modules=e,p.cache=u,p.parent=d,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(p,"root",{get:function(){return s[n]}}),s[n]=p;for(var w=0;w{let t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},i=(t,o)=>{let n=e.url||t.option.url,r=new window.chrome.cast.media.MediaInfo(n,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[n.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),i=new window.chrome.cast.media.LoadRequest(r);o.loadMedia(i).then(()=>{t.notice.show="Casting started",e.onCastStart?.()}).catch(o=>{throw t.notice.show="Error casting media",e.onError?.(o),o})};return async a=>(a.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:`${e.icon||''}`,click:async()=>{if(!t)try{await new Promise((i,a)=>{var c;window.__onGCastApiAvailable=c=>{if(c){let a=window.cast.framework.CastContext.getInstance();a.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),a.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=>{let i=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case i.NO_SESSION:e.onStateChange?.("disconnected"),r("disconnected");break;case i.SESSION_STARTING:e.onStateChange?.("connecting"),r("connecting");break;case i.SESSION_STARTED:e.onStateChange?.("connected"),r("connected");break;case i.SESSION_ENDING:e.onStateChange?.("disconnecting"),r("disconnecting");break;case i.SESSION_RESUMED:e.onStateChange?.("connected"),r("connected")}}),a.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{let o=window.cast.framework.CastState;switch(t.castState){case o.NO_DEVICES_AVAILABLE:e.onCastAvailable?.(!1);break;case o.NOT_CONNECTED:case o.CONNECTING:case o.CONNECTED:e.onCastAvailable?.(!0)}}),t=!0,i()}else a(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(c=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise((e,t)=>{let o=document.createElement("script");o.src=c,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(a)})}catch(t){throw a.notice.show="Failed to initialize Cast API",e.onError?.(t),t}let c=window.cast.framework.CastContext.getInstance();if(o)i(a,o);else try{let e=await c.requestSession();i(a,e)}catch(t){throw a.notice.show="Error connecting to cast session",e.onError?.(t),t}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}r.defineInteropFlag(o),r.export(o,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginChromecast=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[o]}})}),t},o.export=function(e,t,o){Object.defineProperty(e,t,{enumerable:!0,get:o})}},{}]},["18Aaf"],"18Aaf","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,o,n,r,a,i,c){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof s[n]&&s[n],d=l.i||{},u=l.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,o){if(!u[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof s[n]&&s[n];if(!o&&a)return a(t,!0);if(l)return l(t,!0);if(f&&"string"==typeof t)return f(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}d.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},d.cache={};var c=u[t]=new p.Module(t);e[t][0].call(c.exports,d,c,c.exports,s)}return u[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var o={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],a=p(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(o,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===r?Object.defineProperty(o,t,{enumerable:!0,value:a}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===r?a.__esModule?a.default:a:a[r]}})}),o}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=f,this.exports={}},p.modules=e,p.cache=u,p.parent=l,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(p,"root",{get:function(){return s[n]}}),s[n]=p;for(var w=0;wtypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"18Aaf":[function(e,t,o,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function a(e){let t=!1,o=null,n=null,r=e=>{let t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},a=(t,o)=>{let n=e.url||t.option.url,r=new window.chrome.cast.media.MediaInfo(n,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[n.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),a=new window.chrome.cast.media.LoadRequest(r);o.loadMedia(a).then(()=>{t.notice.show="Casting started",e.onCastStart?.()}).catch(o=>{throw t.notice.show="Error casting media",e.onError?.(o),o})};return async i=>(i.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:`${e.icon||''}`,click:async()=>{if(!t)try{await new Promise((a,i)=>{var c;window.__onGCastApiAvailable=c=>{if(c){let i=window.cast.framework.CastContext.getInstance();i.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),i.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=>{let a=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case a.NO_SESSION:e.onStateChange?.("disconnected"),r("disconnected");break;case a.SESSION_STARTING:e.onStateChange?.("connecting"),r("connecting");break;case a.SESSION_STARTED:e.onStateChange?.("connected"),r("connected");break;case a.SESSION_ENDING:e.onStateChange?.("disconnecting"),r("disconnecting");break;case a.SESSION_RESUMED:e.onStateChange?.("connected"),r("connected")}}),i.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{let o=window.cast.framework.CastState;switch(t.castState){case o.NO_DEVICES_AVAILABLE:e.onCastAvailable?.(!1);break;case o.NOT_CONNECTED:case o.CONNECTING:case o.CONNECTED:e.onCastAvailable?.(!0)}}),t=!0,a()}else i(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(c=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise((e,t)=>{let o=document.createElement("script");o.src=c,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(i)})}catch(t){throw i.notice.show="Failed to initialize Cast API",e.onError?.(t),t}let c=window.cast.framework.CastContext.getInstance();if(o)a(i,o);else try{let e=await c.requestSession();a(i,e)}catch(t){throw i.notice.show="Error connecting to cast session",e.onError?.(t),t}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}r.defineInteropFlag(o),r.export(o,"default",()=>a),"u">typeof window&&(window.artplayerPluginChromecast=a)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[o]}})}),t},o.export=function(e,t,o){Object.defineProperty(e,t,{enumerable:!0,get:o})}},{}]},["18Aaf"],"18Aaf","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-chromecast.legacy.js b/docs/compiled/artplayer-plugin-chromecast.legacy.js index aa5942ce6..e3f77aa9a 100644 --- a/docs/compiled/artplayer-plugin-chromecast.legacy.js +++ b/docs/compiled/artplayer-plugin-chromecast.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-chromecast.js v1.0.1 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o,i,c,a){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof u[n]&&u[n],l=s.i||{},f=s.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof u[n]&&u[n];if(!r&&i)return i(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}l.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},l.cache={};var a=f[t]=new d.Module(t);e[t][0].call(a.exports,l,a,a.exports,u)}return f[t].exports;function l(e){var t=l.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],i=d(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=f,d.parent=s,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 u[n]}}),u[n]=d;for(var _=0;_'.concat(e.icon||'',""),click:function(){return(0,i._)(function(){var i,s,l,f,p;return(0,c._)(this,function(c){switch(c.label){case 0:if(t)return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,new Promise(function(i,c){var a;window.__onGCastApiAvailable=function(a){if(a){var u=window.cast.framework.CastContext.getInstance();u.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),u.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,function(t){var i,c,a,u,s,l=window.cast.framework.SessionState;switch(n=t.sessionState,r=t.session,t.sessionState){case l.NO_SESSION:null==(i=e.onStateChange)||i.call(e,"disconnected"),o("disconnected");break;case l.SESSION_STARTING:null==(c=e.onStateChange)||c.call(e,"connecting"),o("connecting");break;case l.SESSION_STARTED:null==(a=e.onStateChange)||a.call(e,"connected"),o("connected");break;case l.SESSION_ENDING:null==(u=e.onStateChange)||u.call(e,"disconnecting"),o("disconnecting");break;case l.SESSION_RESUMED:null==(s=e.onStateChange)||s.call(e,"connected"),o("connected")}}),u.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,function(t){var r,n,o,i=window.cast.framework.CastState;switch(t.castState){case i.NO_DEVICES_AVAILABLE:null==(r=e.onCastAvailable)||r.call(e,!1);break;case i.NOT_CONNECTED:null==(n=e.onCastAvailable)||n.call(e,!0);break;case i.CONNECTING:case i.CONNECTED:null==(o=e.onCastAvailable)||o.call(e,!0)}}),t=!0,i()}else c(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(a=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise(function(e,t){var r=document.createElement("script");r.src=a,r.onload=e,r.onerror=t,document.body.appendChild(r)})).catch(c)})];case 2:return c.sent(),[3,4];case 3:throw i=c.sent(),u.notice.show="Failed to initialize Cast API",null==(s=e.onError)||s.call(e,i),i;case 4:if(l=window.cast.framework.CastContext.getInstance(),!r)return[3,5];return a(u,r),[3,8];case 5:return c.trys.push([5,7,,8]),[4,l.requestSession()];case 6:return a(u,c.sent()),[3,8];case 7:throw f=c.sent(),u.notice.show="Error connecting to cast session",null==(p=e.onError)||p.call(e,f),f;case 8:return[2]}})})()}}),[2,{name:"artplayerPluginChromecast",getCastState:function(){return n},isCasting:function(){return null!==r}}]})})()}}"undefined"!=typeof window&&(window.artplayerPluginChromecast=a)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,i,c){try{var a=e[i](c),u=a.value}catch(e){r(e);return}a.done?t(u):Promise.resolve(u).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var c=e.apply(t,r);function a(e){o(c,n,i,a,u,"next",e)}function u(e){o(c,n,i,a,u,"throw",e)}a(void 0)})}}},{}],eltGh:[function(e,t,r,n){"use strict";r._=e("eb260df52bffddd").__generator},{eb260df52bffddd:"6yrAu"}],"6yrAu":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"__extends",function(){return a}),o.export(r,"__assign",function(){return u}),o.export(r,"__rest",function(){return s}),o.export(r,"__decorate",function(){return l}),o.export(r,"__param",function(){return f}),o.export(r,"__esDecorate",function(){return p}),o.export(r,"__runInitializers",function(){return d}),o.export(r,"__propKey",function(){return _}),o.export(r,"__setFunctionName",function(){return y}),o.export(r,"__metadata",function(){return h}),o.export(r,"__awaiter",function(){return v}),o.export(r,"__generator",function(){return w}),o.export(r,"__createBinding",function(){return m}),o.export(r,"__exportStar",function(){return b}),o.export(r,"__values",function(){return g}),o.export(r,"__read",function(){return x}),o.export(r,"__spread",function(){return j}),o.export(r,"__spreadArrays",function(){return O}),o.export(r,"__spreadArray",function(){return S}),o.export(r,"__await",function(){return E}),o.export(r,"__asyncGenerator",function(){return P}),o.export(r,"__asyncDelegator",function(){return C}),o.export(r,"__asyncValues",function(){return I}),o.export(r,"__makeTemplateObject",function(){return T}),o.export(r,"__importStar",function(){return D}),o.export(r,"__importDefault",function(){return N}),o.export(r,"__classPrivateFieldGet",function(){return R}),o.export(r,"__classPrivateFieldSet",function(){return M}),o.export(r,"__classPrivateFieldIn",function(){return G}),o.export(r,"__addDisposableResource",function(){return F}),o.export(r,"__disposeResources",function(){return L}),o.export(r,"__rewriteRelativeImportExtension",function(){return z});var i=e("@swc/helpers/cjs/_type_of.cjs"),c=function(e,t){return(c=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=function(){return(u=Object.assign||function(e){for(var t,r=1,n=arguments.length;rt.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function l(e,t,r,n){var o,c=arguments.length,a=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(c<3?o(a):c>3?o(t,r,a):o(t,r))||a);return c>3&&a&&Object.defineProperty(t,r,a),a}function f(e,t){return function(r,n){t(r,n,e)}}function p(e,t,r,n,o,c){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var u,s=n.kind,l="getter"===s?"get":"setter"===s?"set":"value",f=!t&&e?n.static?e:e.prototype:null,p=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),d=!1,_=r.length-1;_>=0;_--){var y={};for(var h in n)y[h]="access"===h?{}:n[h];for(var h in n.access)y.access[h]=n.access[h];y.addInitializer=function(e){if(d)throw TypeError("Cannot add initializers after decoration has completed");c.push(a(e||null))};var v=(0,r[_])("accessor"===s?{get:p.get,set:p.set}:p[l],y);if("accessor"===s){if(void 0===v)continue;if(null===v||(void 0===v?"undefined":(0,i._)(v))!=="object")throw TypeError("Object expected");(u=a(v.get))&&(p.get=u),(u=a(v.set))&&(p.set=u),(u=a(v.init))&&o.unshift(u)}else(u=a(v))&&("field"===s?o.unshift(u):p[l]=u)}f&&Object.defineProperty(f,n.name,p),d=!0}function d(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c}function j(){for(var e=[],t=0;t1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{var r;(r=o[e](t)).value instanceof E?Promise.resolve(r.value.v).then(u,s):l(i[0][2],r)}catch(e){l(i[0][3],e)}}function u(e){a("next",e)}function s(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function C(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:E(e[n](t)),done:!1}:o?o(t):t}:o}}function I(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=g(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){var i,c,a;i=n,c=o,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:a})},c)})}}}function T(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var A=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},k=function(e){return(k=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function D(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=k(e),n=0;ntypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof s[r]&&s[r],u=l.i||{},f=l.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!f[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof s[r]&&s[r];if(!n&&a)return a(t,!0);if(l)return l(t,!0);if(d&&"string"==typeof t)return d(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}u.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},u.cache={};var i=f[t]=new p.Module(t);e[t][0].call(i.exports,u,i,i.exports,s)}return f[t].exports;function u(e){var t=u.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],o=e[2]||e[0],a=p(r);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(n,t,{enumerable:!0,value:a}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),n}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=d,this.exports={}},p.modules=e,p.cache=f,p.parent=l,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=u,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return s[r]}}),s[r]=p;for(var w=0;wtypeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"1xnGs":[function(e,t,n,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",function(){return i});var a=e("@swc/helpers/cjs/_async_to_generator.cjs"),c=e("@swc/helpers/cjs/_ts_generator.cjs");function i(e){var t=!1,n=null,r=null,o=function(e){var t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},i=function(t,n){var r=e.url||t.option.url,o=new window.chrome.cast.media.MediaInfo(r,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[r.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),a=new window.chrome.cast.media.LoadRequest(o);n.loadMedia(a).then(function(){var n;t.notice.show="Casting started",null==(n=e.onCastStart)||n.call(e)}).catch(function(n){var r;throw t.notice.show="Error casting media",null==(r=e.onError)||r.call(e,n),n})};return function(s){return(0,a._)(function(){return(0,c._)(this,function(l){return s.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:''.concat(e.icon||'',""),click:function(){return(0,a._)(function(){var a,l,u,f,d;return(0,c._)(this,function(c){switch(c.label){case 0:if(t)return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,new Promise(function(a,c){var i;window.__onGCastApiAvailable=function(i){if(i){var s=window.cast.framework.CastContext.getInstance();s.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),s.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,function(t){var a,c,i,s,l,u=window.cast.framework.SessionState;switch(r=t.sessionState,n=t.session,t.sessionState){case u.NO_SESSION:null==(a=e.onStateChange)||a.call(e,"disconnected"),o("disconnected");break;case u.SESSION_STARTING:null==(c=e.onStateChange)||c.call(e,"connecting"),o("connecting");break;case u.SESSION_STARTED:null==(i=e.onStateChange)||i.call(e,"connected"),o("connected");break;case u.SESSION_ENDING:null==(s=e.onStateChange)||s.call(e,"disconnecting"),o("disconnecting");break;case u.SESSION_RESUMED:null==(l=e.onStateChange)||l.call(e,"connected"),o("connected")}}),s.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,function(t){var n,r,o,a=window.cast.framework.CastState;switch(t.castState){case a.NO_DEVICES_AVAILABLE:null==(n=e.onCastAvailable)||n.call(e,!1);break;case a.NOT_CONNECTED:null==(r=e.onCastAvailable)||r.call(e,!0);break;case a.CONNECTING:case a.CONNECTED:null==(o=e.onCastAvailable)||o.call(e,!0)}}),t=!0,a()}else c(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(i=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise(function(e,t){var n=document.createElement("script");n.src=i,n.onload=e,n.onerror=t,document.body.appendChild(n)})).catch(c)})];case 2:return c.sent(),[3,4];case 3:throw a=c.sent(),s.notice.show="Failed to initialize Cast API",null==(l=e.onError)||l.call(e,a),a;case 4:if(u=window.cast.framework.CastContext.getInstance(),!n)return[3,5];return i(s,n),[3,8];case 5:return c.trys.push([5,7,,8]),[4,u.requestSession()];case 6:return i(s,c.sent()),[3,8];case 7:throw f=c.sent(),s.notice.show="Error connecting to cast session",null==(d=e.onError)||d.call(e,f),f;case 8:return[2]}})})()}}),[2,{name:"artplayerPluginChromecast",getCastState:function(){return r},isCasting:function(){return null!==n}}]})})()}}"u">typeof window&&(window.artplayerPluginChromecast=i)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,n,r){"use strict";function o(e,t,n,r,o,a,c){try{var i=e[a](c),s=i.value}catch(e){n(e);return}i.done?t(s):Promise.resolve(s).then(r,o)}n._=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var c=e.apply(t,n);function i(e){o(c,r,a,i,s,"next",e)}function s(e){o(c,r,a,i,s,"throw",e)}i(void 0)})}}},{}],eltGh:[function(e,t,n,r){"use strict";n._=function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:s(0)}),i(c,"throw",{value:s(1)}),i(c,"return",{value:s(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function s(i){return function(s){var l=[i,s];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]{let t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},i=(t,o)=>{let n=e.url||t.option.url,r=new window.chrome.cast.media.MediaInfo(n,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[n.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),i=new window.chrome.cast.media.LoadRequest(r);o.loadMedia(i).then(()=>{t.notice.show="Casting started",e.onCastStart?.()}).catch(o=>{throw t.notice.show="Error casting media",e.onError?.(o),o})};return async a=>(a.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:`${e.icon||''}`,click:async()=>{if(!t)try{await new Promise((i,a)=>{var c;window.__onGCastApiAvailable=c=>{if(c){let a=window.cast.framework.CastContext.getInstance();a.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),a.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=>{let i=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case i.NO_SESSION:e.onStateChange?.("disconnected"),r("disconnected");break;case i.SESSION_STARTING:e.onStateChange?.("connecting"),r("connecting");break;case i.SESSION_STARTED:e.onStateChange?.("connected"),r("connected");break;case i.SESSION_ENDING:e.onStateChange?.("disconnecting"),r("disconnecting");break;case i.SESSION_RESUMED:e.onStateChange?.("connected"),r("connected")}}),a.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{let o=window.cast.framework.CastState;switch(t.castState){case o.NO_DEVICES_AVAILABLE:e.onCastAvailable?.(!1);break;case o.NOT_CONNECTED:case o.CONNECTING:case o.CONNECTED:e.onCastAvailable?.(!0)}}),t=!0,i()}else a(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(c=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise((e,t)=>{let o=document.createElement("script");o.src=c,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(a)})}catch(t){throw a.notice.show="Failed to initialize Cast API",e.onError?.(t),t}let c=window.cast.framework.CastContext.getInstance();if(o)i(a,o);else try{let e=await c.requestSession();i(a,e)}catch(t){throw a.notice.show="Error connecting to cast session",e.onError?.(t),t}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}r.defineInteropFlag(o),r.export(o,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginChromecast=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[o]}})}),t},o.export=function(e,t,o){Object.defineProperty(e,t,{enumerable:!0,get:o})}},{}]},["2IQmJ"],"2IQmJ","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("2IQmJ");export{e as default}; \ No newline at end of file +!function(e,t,o,n,r,a,i,c){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof s[n]&&s[n],d=l.i||{},u=l.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,o){if(!u[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof s[n]&&s[n];if(!o&&a)return a(t,!0);if(l)return l(t,!0);if(f&&"string"==typeof t)return f(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}d.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},d.cache={};var c=u[t]=new p.Module(t);e[t][0].call(c.exports,d,c,c.exports,s)}return u[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var o={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],a=p(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(o,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===r?Object.defineProperty(o,t,{enumerable:!0,value:a}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===r?a.__esModule?a.default:a:a[r]}})}),o}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=f,this.exports={}},p.modules=e,p.cache=u,p.parent=l,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(p,"root",{get:function(){return s[n]}}),s[n]=p;for(var w=0;wtypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"2IQmJ":[function(e,t,o,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function a(e){let t=!1,o=null,n=null,r=e=>{let t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},a=(t,o)=>{let n=e.url||t.option.url,r=new window.chrome.cast.media.MediaInfo(n,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[n.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),a=new window.chrome.cast.media.LoadRequest(r);o.loadMedia(a).then(()=>{t.notice.show="Casting started",e.onCastStart?.()}).catch(o=>{throw t.notice.show="Error casting media",e.onError?.(o),o})};return async i=>(i.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:`${e.icon||''}`,click:async()=>{if(!t)try{await new Promise((a,i)=>{var c;window.__onGCastApiAvailable=c=>{if(c){let i=window.cast.framework.CastContext.getInstance();i.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),i.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=>{let a=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case a.NO_SESSION:e.onStateChange?.("disconnected"),r("disconnected");break;case a.SESSION_STARTING:e.onStateChange?.("connecting"),r("connecting");break;case a.SESSION_STARTED:e.onStateChange?.("connected"),r("connected");break;case a.SESSION_ENDING:e.onStateChange?.("disconnecting"),r("disconnecting");break;case a.SESSION_RESUMED:e.onStateChange?.("connected"),r("connected")}}),i.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{let o=window.cast.framework.CastState;switch(t.castState){case o.NO_DEVICES_AVAILABLE:e.onCastAvailable?.(!1);break;case o.NOT_CONNECTED:case o.CONNECTING:case o.CONNECTED:e.onCastAvailable?.(!0)}}),t=!0,a()}else i(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(c=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise((e,t)=>{let o=document.createElement("script");o.src=c,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(i)})}catch(t){throw i.notice.show="Failed to initialize Cast API",e.onError?.(t),t}let c=window.cast.framework.CastContext.getInstance();if(o)a(i,o);else try{let e=await c.requestSession();a(i,e)}catch(t){throw i.notice.show="Error connecting to cast session",e.onError?.(t),t}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}r.defineInteropFlag(o),r.export(o,"default",()=>a),"u">typeof window&&(window.artplayerPluginChromecast=a)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[o]}})}),t},o.export=function(e,t,o){Object.defineProperty(e,t,{enumerable:!0,get:o})}},{}]},["2IQmJ"],"2IQmJ","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("2IQmJ");export{e as default}; \ No newline at end of file diff --git a/docs/compiled/artplayer-plugin-danmuku-mask.js b/docs/compiled/artplayer-plugin-danmuku-mask.js index 9526e118b..d33cc7e28 100644 --- a/docs/compiled/artplayer-plugin-danmuku-mask.js +++ b/docs/compiled/artplayer-plugin-danmuku-mask.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-danmuku-mask.js v1.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,s,a,o,l){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof i[n]&&i[n],u=p.i||{},c=p.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!c[t]){if(!e[t]){if(s[t])return s[t];var a="function"==typeof i[n]&&i[n];if(!r&&a)return a(t,!0);if(p)return p(t,!0);if(d&&"string"==typeof t)return d(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}u.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},u.cache={};var l=c[t]=new f.Module(t);e[t][0].call(l.exports,u,l,l.exports,i)}return c[t].exports;function u(e){var t=u.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],s=e[2]||e[0],a=f(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===s?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===s?a.__esModule?a.default:a:a[s]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=d,this.exports={}},f.modules=e,f.cache=c,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=u,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return i[n]}}),i[n]=f;for(var m=0;ml);var a=e("@tensorflow-models/body-segmentation"),o=e("@tensorflow/tfjs-core");function l(e={}){return t=>{let{template:{$video:r,$danmuku:n}}=t,s=null,l=null,i=null,p=null,u=!1,c={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};async function d(){try{await o.setBackend("webgl")}catch(e){console.warn("WebGL backend not available, falling back to CPU",e.message),await o.setBackend("cpu")}}async function f(){await d();let e=a.SupportedModels.MediaPipeSelfieSegmentation,t={runtime:"mediapipe",modelType:"general",solutionPath:c.solutionPath,modelSelection:c.modelSelection,smoothSegmentation:c.smoothSegmentation,minDetectionConfidence:c.minDetectionConfidence,minTrackingConfidence:c.minTrackingConfidence,selfieMode:c.selfieMode};try{s=await a.createSegmenter(e,t),u=!0}catch(e){console.error("Error initializing segmenter:",e),u=!1}}async function m(){if(!u||r.paused||r.ended){p=requestAnimationFrame(m);return}try{l.width=r.videoWidth,l.height=r.videoHeight;let e=await s.segmentPeople(r);if(!e||0===e.length){p=requestAnimationFrame(m);return}let t=await a.toBinaryMask(e,{r:255,g:255,b:255,a:255},{r:0,g:0,b:0,a:255},c.drawContour,c.foregroundThreshold);await a.drawMask(l,r,t,c.opacity,c.maskBlurAmount);let o=i.getImageData(0,0,l.width,l.height);i.putImageData(function(e){let t=e.data;for(let e=0;e250&&t[e+1]>250&&t[e+2]>250&&(t[e+3]=0);return e}(o),0,0),n.style.maskImage=`url(${l.toDataURL()})`}catch(e){console.error("Error in segmentBody:",e)}p=requestAnimationFrame(m)}async function h(){u||await f(),l||(i=(l=document.createElement("canvas")).getContext("2d")),Object.assign(n.style,{maskMode:"alpha",maskSize:"contain",maskRepeat:"no-repeat",backgroundSize:"contain",backgroundRepeat:"no-repeat"}),m()}function g(){n.style.maskImage="none",p&&(cancelAnimationFrame(p),p=null)}return t.on("ready",h),t.on("destroy",g),{name:"artplayerPluginDanmukuMask",start:h,stop:g}}}e("@tensorflow/tfjs-backend-webgl"),e("@tensorflow/tfjs-backend-cpu"),"undefined"!=typeof window&&(window.artplayerPluginDanmukuMask=l)},{"@tensorflow-models/body-segmentation":"5Otso","@tensorflow/tfjs-core":"2Gtps","@tensorflow/tfjs-backend-webgl":"2ZcDF","@tensorflow/tfjs-backend-cpu":"b4yJT","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"5Otso":[function(e,t,r,n){var s,a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"SupportedModels",()=>eR),a.export(r,"blurBodyPart",()=>eJ),a.export(r,"bodyPixMaskValueToRainbowColor",()=>b),a.export(r,"createSegmenter",()=>e$),a.export(r,"drawBokehEffect",()=>eQ),a.export(r,"drawMask",()=>eZ),a.export(r,"drawPixelatedMask",()=>eY),a.export(r,"toBinaryMask",()=>eK),a.export(r,"toColoredMask",()=>eX);var o=e("@tensorflow/tfjs-core"),l=e("@tensorflow/tfjs-converter"),i=e("@mediapipe/selfie_segmentation"),p=function(e,t){return(p=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function u(e,t){function r(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var c=function(){return(c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0&&s[s.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]=256)throw Error("Mask value must be in range [0, 255] but got "+e);if(!Number.isInteger(e))throw Error("Mask value must be an integer but got "+e)}var v=[[110,64,170],[143,61,178],[178,60,178],[210,62,167],[238,67,149],[255,78,125],[255,94,99],[255,115,75],[255,140,56],[239,167,47],[217,194,49],[194,219,64],[175,240,91],[135,245,87],[96,247,96],[64,243,115],[40,234,141],[28,219,169],[26,199,194],[33,176,213],[47,150,224],[65,125,224],[84,101,214],[99,81,195]];function b(e){if(y(e),er&&(s+=1,n+=Math.pow(e[a].x-t.keypoints[a].position.x,2)+Math.pow(e[a].y-t.keypoints[a].position.y,2));return 0===s?n=1/0:n/=s,n}(g,r[_]);I"+u+") {\n numKpt = numKpt + 1;\n curDistSum = curDistSum + dist(x, y, poseX, poseY);\n }\n }\n if (numKpt > 0 && curDistSum / float(numKpt)< minDist) {\n minDist = curDistSum / float(numKpt);\n iMin = i;\n }\n }\n return iMin;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int nearestPose = findNearestPose(coords[0], coords[1]);\n setOutput(float(nearestPose));\n }\n "};return(0,o.backend)().compileAndRun(O,[e,b,R])}function $(){return"webgl"===(0,o.getBackend)()}function O(e){return Math.floor(e/2)}[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]].map(function(e){var t=e[0],r=e[1];return[S[t],S[r]]});var D=function(){function e(e,t){this.priorityQueue=Array(e),this.numberOfElements=-1,this.getElementValue=t}return e.prototype.enqueue=function(e){this.priorityQueue[++this.numberOfElements]=e,this.swim(this.numberOfElements)},e.prototype.dequeue=function(){var e=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,e},e.prototype.empty=function(){return -1===this.numberOfElements},e.prototype.size=function(){return this.numberOfElements+1},e.prototype.all=function(){return this.priorityQueue.slice(0,this.numberOfElements+1)},e.prototype.max=function(){return this.priorityQueue[0]},e.prototype.swim=function(e){for(;e>0&&this.less(O(e),e);)this.exchange(e,O(e)),e=O(e)},e.prototype.sink=function(e){for(;2*e<=this.numberOfElements;){var t=2*e;if(ta?a:s),x:(o=Math.round(e.x/t),l=n-1,o<0?0:o>l?l:o)}}function L(e,t,r,n,s,a,o,l){void 0===l&&(l=2);for(var i,p,u=n.shape,c=u[0],d=u[1],f=(i=V(t.position,a,c,d),p=o.shape[2]/2,{y:o.get(i.y,i.x,e),x:o.get(i.y,i.x,p+e)}),m=F(t.position,f),h=0;ht){p=!1;break}if(!p)break}return p}(u,c,i,p,1,r)&&l.enqueue({score:c,part:{heatmapY:i,heatmapX:p,id:u}})}return l}(o,0,e),u=l*l;i.length=0;--d){var f=B[d],m=G[d];i[f]&&!i[m]&&(i[m]=L(d,i[f],m,t,r,n,a))}for(d=0;d=.1,function(){return"inputResolution must be a string or number between 0.1 and 2, but was "+e}),e}(e);return[Y(n*a,t),Y(s*a,t)]}function et(e,t,r,n,s){var a=t[0],l=t[1],i=r[0],p=r[1],u=n[0],c=u[0],d=u[1],f=n[1],m=f[0],h=f[1];return void 0===s&&(s=!1),(0,o.tidy)(function(){var t,r,n,u,f,g,x,y,v,b,k,_=o.image.resizeBilinear(e,[i,p],!0);return s&&(_=(0,o.sigmoid)(_)),t=_,r=[a,l],n=[[c,d],[m,h]],u=r[0],f=r[1],x=(g=n[0])[0],y=g[1],b=(v=n[1])[0],k=v[1],(0,o.tidy)(function(){var e=(0,o.expandDims)(t);return(0,o.squeeze)(o.image.cropAndResize(e,[[x/(u+x+y-1),b/(f+b+k-1),(x+u-1)/(u+x+y-1),(b+f-1)/(f+b+k-1)]],[0],[u,f]),[0])})})}function er(e,t){var r=t[0],n=t[1],s=Z(e),a=s[0],l=s[1],i=n/r,p=0,u=0,c=0,d=0;return l/a1)throw Error("segmentationThreshold "+t+". Should be in range [0.0, 1.0]");if(r<=0)throw Error("Invalid maxDetections "+r+". Should be >0");if(n<0||n>1)throw Error("Invalid scoreThreshold "+n+". Should be in range [0.0, 1.0]");if(s<=0)throw Error("Invalid nmsRadius "+s+".")}function ef(e){var t=e.segmentationThreshold,r=e.maxDetections,n=e.scoreThreshold,s=e.nmsRadius,a=e.minKeypointScore,o=e.refineSteps;if(t<0||t>1)throw Error("segmentationThreshold "+t+". Should be in range [0.0, 1.0]");if(r<=0)throw Error("Invalid maxDetections "+r+". Should be >0");if(n<0||n>1)throw Error("Invalid scoreThreshold "+n+". Should be in range [0.0, 1.0]");if(s<=0)throw Error("Invalid nmsRadius "+s+".");if(a<0||a>1)throw Error("Invalid minKeypointScore "+a+".Should be in range [0.0, 1.0]");if(o<=0||o>20)throw Error("Invalid refineSteps "+o+".Should be in range [1, 20]")}var em=function(){function e(e){this.baseModel=e}return e.prototype.predictForPersonSegmentation=function(e){var t=this.baseModel.predict(e);return{segmentLogits:t.segmentation,heatmapScores:t.heatmapScores,offsets:t.offsets,displacementFwd:t.displacementFwd,displacementBwd:t.displacementBwd}},e.prototype.predictForPersonSegmentationAndPart=function(e){var t=this.baseModel.predict(e);return{segmentLogits:t.segmentation,partHeatmapLogits:t.partHeatmaps,heatmapScores:t.heatmapScores,offsets:t.offsets,displacementFwd:t.displacementFwd,displacementBwd:t.displacementBwd}},e.prototype.predictForMultiPersonInstanceSegmentationAndPart=function(e){var t=this.baseModel.predict(e);return{segmentLogits:t.segmentation,longOffsets:t.longOffsets,heatmapScores:t.heatmapScores,offsets:t.offsets,displacementFwd:t.displacementFwd,displacementBwd:t.displacementBwd,partHeatmaps:t.partHeatmaps}},e.prototype.segmentPersonActivation=function(e,t,r){var n=this;void 0===r&&(r=.5);var s=Z(e),a=s[0],l=s[1],i=ee(t,this.baseModel.outputStride,[a,l]),p=er(e,i),u=p.resized,c=p.padding,d=(0,o.tidy)(function(){var e=n.predictForPersonSegmentation(u),t=e.segmentLogits,s=e.heatmapScores,i=e.offsets,p=e.displacementFwd,d=e.displacementBwd,f=u.shape,m=et(t,[a,l],[f[0],f[1]],[[c.top,c.bottom],[c.left,c.right]],!0);return{segmentation:_((0,o.squeeze)(m),r),heatmapScores:s,offsets:i,displacementFwd:p,displacementBwd:d}}),f=d.segmentation,m=d.heatmapScores,h=d.offsets,g=d.displacementFwd,x=d.displacementBwd;return u.dispose(),{segmentation:f,heatmapScores:m,offsets:h,displacementFwd:g,displacementBwd:x,padding:c,internalResolutionHeightAndWidth:i}},e.prototype.segmentPerson=function(e,t){return void 0===t&&(t=eu),d(this,void 0,void 0,function(){var r,n,s,a,o,l,i,p,u,d,m,h,g,x,y,v;return f(this,function(f){switch(f.label){case 0:return ed(t=c(c({},eu),t)),n=(r=this.segmentPersonActivation(e,t.internalResolution,t.segmentationThreshold)).segmentation,s=r.heatmapScores,a=r.offsets,o=r.displacementFwd,l=r.displacementBwd,i=r.padding,p=r.internalResolutionHeightAndWidth,d=(u=n.shape)[0],m=u[1],[4,n.data()];case 1:return h=f.sent(),n.dispose(),[4,en([s,a,o,l])];case 2:return x=(g=f.sent())[0],y=g[1],v=es(v=U(x,y,g[2],g[3],this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[d,m],p,i,!1),s.dispose(),a.dispose(),o.dispose(),l.dispose(),[2,{height:d,width:m,data:h,allPoses:v}]}})})},e.prototype.segmentMultiPerson=function(e,t){return void 0===t&&(t=ec),d(this,void 0,void 0,function(){var r,n,s,a,l,i,p,u,m,h,g,x,y,v,b,k,I,j,w,T=this;return f(this,function(S){switch(S.label){case 0:return ef(t=c(c({},ec),t)),n=(r=Z(e))[0],s=r[1],i=(l=er(e,a=ee(t.internalResolution,this.baseModel.outputStride,[n,s]))).resized,p=l.padding,m=(u=(0,o.tidy)(function(){var e=T.predictForMultiPersonInstanceSegmentationAndPart(i),r=e.segmentLogits,l=e.longOffsets,u=e.heatmapScores,c=e.offsets,d=e.displacementFwd,f=e.displacementBwd,m=et(r,[n,s],a,[[p.top,p.bottom],[p.left,p.right]],!0);return{segmentation:_((0,o.squeeze)(m),t.segmentationThreshold),longOffsets:l,heatmapScoresRaw:u,offsetsRaw:c,displacementFwdRaw:d,displacementBwdRaw:f}})).segmentation,h=u.longOffsets,g=u.heatmapScoresRaw,x=u.offsetsRaw,y=u.displacementFwdRaw,v=u.displacementBwdRaw,[4,en([g,x,y,v])];case 1:return k=(b=S.sent())[0],I=b[1],j=es(j=U(k,I,b[2],b[3],this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[n,s],a,p,!1),[4,function(e,t,r,n,s,a,l,i,p,u,c,m){var h=l[0],g=l[1];return void 0===p&&(p=.2),void 0===u&&(u=8),void 0===c&&(c=.3),void 0===m&&(m=10),d(this,void 0,void 0,function(){var l,d,x,y,v;return f(this,function(f){switch(f.label){case 0:return l=r.filter(function(e){return e.score>=p}),$()?[4,Promise.all((x=(0,o.tidy)(function(){var r=P(e,t,l,n,s,a,[h,g],i,u,c,m),p=(0,o.engine)().makeTensorFromDataId(r.dataId,r.shape,r.dtype);return l.map(function(e,t){return(0,o.tidy)(function(){return(0,o.cast)((0,o.equal)(p,(0,o.scalar)(t)),"int32")})})})).map(function(e){return e.data()}))]:[3,2];case 1:return d=f.sent(),x.forEach(function(e){return e.dispose()}),[3,5];case 2:return[4,e.data()];case 3:return y=f.sent(),[4,t.data()];case 4:v=f.sent(),d=function(e,t,r,n,s,a,o,l,i,p){var u=o[0],c=o[1];void 0===p&&(p=5);for(var d=r.map(function(e){return new Uint8Array(n*s).fill(0)}),f=l.top,m=l.left,h=C([n,s],[u,c],l),g=h[0],x=h[1],y=R([u,c],a)[0],v=0;v=0&&(d[_][k]=1)}}return d}(y,v,l,n,s,a,[h,g],i,u),f.label=5;case 5:return[2,d.map(function(e,t){return{data:e,pose:l[t],width:s,height:n}})]}})})}(m,h,j,n,s,this.baseModel.outputStride,a,p,t.scoreThreshold,t.refineSteps,t.minKeypointScore,t.maxDetections)];case 2:return w=S.sent(),i.dispose(),m.dispose(),h.dispose(),g.dispose(),x.dispose(),y.dispose(),v.dispose(),[2,w]}})})},e.prototype.segmentPersonPartsActivation=function(e,t,r){var n=this;void 0===r&&(r=.5);var s=Z(e),a=s[0],l=s[1],i=ee(t,this.baseModel.outputStride,[a,l]),p=er(e,i),u=p.resized,c=p.padding,d=(0,o.tidy)(function(){var e,t,s,i,p,d=n.predictForPersonSegmentationAndPart(u),f=d.segmentLogits,m=d.partHeatmapLogits,h=d.heatmapScores,g=d.offsets,x=d.displacementFwd,y=d.displacementBwd,v=u.shape,b=v[0],I=v[1],j=et(f,[a,l],[b,I],[[c.top,c.bottom],[c.left,c.right]],!0),w=et(m,[a,l],[b,I],[[c.top,c.bottom],[c.left,c.right]],!0);return{partSegmentation:(e=_((0,o.squeeze)(j),r),s=(t=w.shape)[0],i=t[1],p=t[2],(0,o.tidy)(function(){var t=k(w),r=(0,o.expandDims)((0,o.range)(0,p,1,"int32"),1),n=(0,o.cast)((0,o.matMul)(t,r),"int32"),a=(0,o.reshape)(n,[s,i]),l=(0,o.add)(a,(0,o.scalar)(1,"int32"));return(0,o.sub)((0,o.mul)(l,e),(0,o.scalar)(1,"int32"))})),heatmapScores:h,offsets:g,displacementFwd:x,displacementBwd:y}}),f=d.partSegmentation,m=d.heatmapScores,h=d.offsets,g=d.displacementFwd,x=d.displacementBwd;return u.dispose(),{partSegmentation:f,heatmapScores:m,offsets:h,displacementFwd:g,displacementBwd:x,padding:c,internalResolutionHeightAndWidth:i}},e.prototype.segmentPersonParts=function(e,t){return void 0===t&&(t=eu),d(this,void 0,void 0,function(){var r,n,s,a,o,l,i,p,u,d,m,h,g,x,y,v;return f(this,function(f){switch(f.label){case 0:return ed(t=c(c({},eu),t)),n=(r=this.segmentPersonPartsActivation(e,t.internalResolution,t.segmentationThreshold)).partSegmentation,s=r.heatmapScores,a=r.offsets,o=r.displacementFwd,l=r.displacementBwd,i=r.padding,p=r.internalResolutionHeightAndWidth,d=(u=n.shape)[0],m=u[1],[4,n.data()];case 1:return h=f.sent(),n.dispose(),[4,en([s,a,o,l])];case 2:return x=(g=f.sent())[0],y=g[1],v=es(v=U(x,y,g[2],g[3],this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[d,m],p,i,!1),s.dispose(),a.dispose(),o.dispose(),l.dispose(),[2,{height:d,width:m,data:h,allPoses:v}]}})})},e.prototype.segmentMultiPersonParts=function(e,t){return void 0===t&&(t=ec),d(this,void 0,void 0,function(){var r,n,s,a,l,i,p,u,m,h,g,x,y,v,b,I,j,w,T,S,N=this;return f(this,function(E){switch(E.label){case 0:return ef(t=c(c({},ec),t)),n=(r=Z(e))[0],s=r[1],i=(l=er(e,a=ee(t.internalResolution,this.baseModel.outputStride,[n,s]))).resized,p=l.padding,m=(u=(0,o.tidy)(function(){var e,r,l,u,c=N.predictForMultiPersonInstanceSegmentationAndPart(i),d=c.segmentLogits,f=c.longOffsets,m=c.heatmapScores,h=c.offsets,g=c.displacementFwd,x=c.displacementBwd,y=c.partHeatmaps,v=et(d,[n,s],a,[[p.top,p.bottom],[p.left,p.right]],!0),b=et(y,[n,s],a,[[p.top,p.bottom],[p.left,p.right]],!0);return{segmentation:_((0,o.squeeze)(v),t.segmentationThreshold),longOffsets:f,heatmapScoresRaw:m,offsetsRaw:h,displacementFwdRaw:g,displacementBwdRaw:x,partSegmentation:(r=(e=b.shape)[0],l=e[1],u=e[2],(0,o.tidy)(function(){var e=k(b),t=(0,o.expandDims)((0,o.range)(0,u,1,"int32"),1),n=(0,o.cast)((0,o.matMul)(e,t),"int32");return(0,o.reshape)(n,[r,l])}))}})).segmentation,h=u.longOffsets,g=u.heatmapScoresRaw,x=u.offsetsRaw,y=u.displacementFwdRaw,v=u.displacementBwdRaw,b=u.partSegmentation,[4,en([g,x,y,v])];case 1:return j=(I=E.sent())[0],w=I[1],T=es(T=U(j,w,I[2],I[3],this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[n,s],a,p,!1),[4,function(e,t,r,n,s,a,l,i,p,u,c,m,h){var g=i[0],x=i[1];return void 0===u&&(u=.2),void 0===c&&(c=8),void 0===m&&(m=.3),void 0===h&&(h=10),d(this,void 0,void 0,function(){var i,d,y,v,b,k;return f(this,function(f){switch(f.label){case 0:return i=n.filter(function(e){return e.score>=u}),$()?[4,Promise.all((y=(0,o.tidy)(function(){var n=P(e,t,i,s,a,l,[g,x],p,c,m,h),u=(0,o.engine)().makeTensorFromDataId(n.dataId,n.shape,n.dtype);return i.map(function(e,t){return(0,o.tidy)(function(){return(0,o.sub)((0,o.mul)((0,o.cast)((0,o.equal)(u,(0,o.scalar)(t)),"int32"),(0,o.add)(r,1)),1)})})})).map(function(e){return e.data()}))]:[3,2];case 1:return d=f.sent(),y.forEach(function(e){return e.dispose()}),[3,6];case 2:return[4,e.data()];case 3:return v=f.sent(),[4,t.data()];case 4:return b=f.sent(),[4,r.data()];case 5:k=f.sent(),d=function(e,t,r,n,s,a,o,l,i,p,u){var c=l[0],d=l[1];void 0===u&&(u=5);for(var f=n.map(function(e){return new Int32Array(s*a).fill(-1)}),m=i.top,h=i.left,g=C([s,a],[c,d],i),x=g[0],y=g[1],v=R([c,d],o)[0],b=0;b=0&&(f[I][_]=r[_])}}return f}(v,b,k,i,s,a,l,[g,x],p,c),f.label=6;case 6:return[2,d.map(function(e,t){return{pose:i[t],data:e,height:s,width:a}})]}})})}(m,h,b,T,n,s,this.baseModel.outputStride,a,p,t.scoreThreshold,t.refineSteps,t.minKeypointScore,t.maxDetections)];case 2:return S=E.sent(),i.dispose(),m.dispose(),h.dispose(),g.dispose(),x.dispose(),y.dispose(),v.dispose(),b.dispose(),[2,S]}})})},e.prototype.dispose=function(){this.baseModel.dispose()},e}(),eh=["left_face","right_face","left_upper_arm_front","left_upper_arm_back","right_upper_arm_front","right_upper_arm_back","left_lower_arm_front","left_lower_arm_back","right_lower_arm_front","right_lower_arm_back","left_hand","right_hand","torso_front","torso_back","left_upper_leg_front","left_upper_leg_back","right_upper_leg_front","right_upper_leg_back","left_lower_leg_front","left_lower_leg_back","right_lower_leg_front","right_lower_leg_back","left_feet","right_feet"],eg=function(){function e(e){this.mask=e}return e.prototype.toCanvasImageSource=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,h(this.mask)]})})},e.prototype.toImageData=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,this.mask]})})},e.prototype.toTensor=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,x(this.mask)]})})},e.prototype.getUnderlyingType=function(){return"imagedata"},e}();function ex(e){if(y(e),255!==e)throw Error("Foreground id must be 255 but got "+e);return"person"}function ey(e){if(y(e),e>=eh.length)throw Error("Invalid body part value "+e);return eh[e]}var ev=function(){function e(e){this.bodyPixModel=e}return e.prototype.segmentPeople=function(e,t){return d(this,void 0,void 0,function(){var r,n,s,a;return f(this,function(o){switch(o.label){case 0:return e instanceof ImageBitmap&&((r=document.createElement("canvas")).getContext("2d").drawImage(e,0,0),e=r),t.segmentBodyParts?t.multiSegmentation?[4,this.bodyPixModel.segmentMultiPersonParts(e,t)]:[3,2]:[3,5];case 1:return s=o.sent(),[3,4];case 2:return[4,this.bodyPixModel.segmentPersonParts(e,t)];case 3:s=[o.sent()],o.label=4;case 4:return n=s.map(function(e){var t=e.data,r=e.width,n=e.height,s=new Uint8ClampedArray(r*n*4).fill(0);return t.forEach(function(e,t){-1===e?(s[4*t]=eh.length,s[4*t+3]=0):(s[4*t]=e,s[4*t+3]=255)}),{maskValueToLabel:ey,mask:new eg(new ImageData(s,r,n))}}),[3,10];case 5:return t.multiSegmentation?[4,this.bodyPixModel.segmentMultiPerson(e,t)]:[3,7];case 6:return a=o.sent(),[3,9];case 7:return[4,this.bodyPixModel.segmentPerson(e,t)];case 8:a=[o.sent()],o.label=9;case 9:n=a.map(function(e){var t=e.data,r=e.width,n=e.height,s=new Uint8ClampedArray(r*n*4).fill(0);return t.forEach(function(e,t){0===e?(s[4*t]=0,s[4*t+3]=0):(s[4*t]=255,s[4*t+3]=255)}),{maskValueToLabel:ex,mask:new eg(new ImageData(s,r,n))}}),o.label=10;case 10:return[2,n]}})})},e.prototype.dispose=function(){this.bodyPixModel.dispose()},e.prototype.reset=function(){},e}(),eb={runtime:"mediapipe",modelType:"general"},ek=function(){function e(e){this.mask=e}return e.prototype.toCanvasImageSource=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,this.mask]})})},e.prototype.toImageData=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,g(this.mask)]})})},e.prototype.toTensor=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,x(this.mask)]})})},e.prototype.getUnderlyingType=function(){return"canvasimagesource"},e}();function e_(e){return y(e),"person"}var eI=function(){function e(e){var t,r,n=this;this.selfieMode=!1,t=+(this.selfieSegmentationSolution=new(0,i.SelfieSegmentation)({locateFile:null!=(r=e.locateFile)?r:function(t,r){return e.solutionPath?e.solutionPath.replace(/\/+$/,"")+"/"+t:r+"/"+t}}),"landscape"===e.modelType),this.selfieSegmentationSolution.setOptions({modelSelection:t,selfieMode:this.selfieMode}),this.selfieSegmentationSolution.onResults(function(e){n.segmentation=[{maskValueToLabel:e_,mask:new ek(e.segmentationMask)}]})}return e.prototype.segmentPeople=function(e,t){return d(this,void 0,void 0,function(){var r,n;return f(this,function(s){switch(s.label){case 0:return t&&t.flipHorizontal&&t.flipHorizontal!==this.selfieMode&&(this.selfieMode=t.flipHorizontal,this.selfieSegmentationSolution.setOptions({selfieMode:this.selfieMode})),e instanceof o.Tensor?(n=ImageData.bind,[4,o.browser.toPixels(e)]):[3,2];case 1:return r=new(n.apply(ImageData,[void 0,s.sent(),e.shape[1],e.shape[0]])),[3,3];case 2:r=e,s.label=3;case 3:return e=r,[4,this.selfieSegmentationSolution.send({image:e})];case 4:return s.sent(),[2,this.segmentation]}})})},e.prototype.dispose=function(){this.selfieSegmentationSolution.close()},e.prototype.reset=function(){this.selfieSegmentationSolution.reset(),this.segmentation=null,this.selfieMode=!1},e.prototype.initialize=function(){return this.selfieSegmentationSolution.initialize()},e}();function ej(e){return e instanceof o.Tensor?{height:e.shape[0],width:e.shape[1]}:{height:e.height,width:e.width}}function ew(e,t){o.util.assert(0!==e.width,function(){return t+" width cannot be 0."}),o.util.assert(0!==e.height,function(){return t+" height cannot be 0."})}var eT={runtime:"tfjs",modelType:"general",modelUrl:"https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1"},eS={flipHorizontal:!1},eC={outputTensorSize:{width:256,height:256},keepAspectRatio:!1,borderMode:"zero",outputTensorFloatRange:[0,1]},eN={outputTensorSize:{width:256,height:144},keepAspectRatio:!1,borderMode:"zero",outputTensorFloatRange:[0,1]},eE={activation:"none"},eF=function(){function e(e){this.mask=e}return e.prototype.toCanvasImageSource=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,h(this.mask)]})})},e.prototype.toImageData=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,g(this.mask)]})})},e.prototype.toTensor=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,this.mask]})})},e.prototype.getUnderlyingType=function(){return"tensor"},e}();function eA(e){return y(e),"person"}var eR,eP=function(){function e(e,t){this.modelType=e,this.model=t}return e.prototype.segmentPeople=function(e,t){return d(this,void 0,void 0,function(){var r=this;return f(this,function(n){return t=function(e){if(null==e)return c({},eS);var t=c({},e);return null==t.flipHorizontal&&(t.flipHorizontal=eS.flipHorizontal),t}(t),null==e?(this.reset(),[2,[]]):[2,[{maskValueToLabel:eA,mask:new eF((0,o.tidy)(function(){var t,n,s,a,l,i,p,u,c,d,f,m,h,g,x,y,v,b,k,_,I,j,w=(x=(t="general"===r.modelType?eC:eN).outputTensorSize,y=t.keepAspectRatio,v=t.borderMode,b=t.outputTensorFloatRange,I=function(e,t,r){if(void 0===r&&(r=!1),!r)return{top:0,left:0,right:0,bottom:0};var n=t.height,s=t.width;ew(t,"targetSize"),ew(e,"roi");var a,o,l=n/s,i=e.height/e.width,p=0,u=0;return l>i?(a=e.width,o=e.width*l,u=(1-i/l)/2):(a=e.height/l,o=e.height,p=(1-l/i)/2),e.width=a,e.height=o,{top:u,left:p,right:p,bottom:u}}((n=k=ej(e),_={xCenter:.5*n.width,yCenter:.5*n.height,width:n.width,height:n.height,rotation:0}),x,y),s=k.width,a=k.height,l=_.width,i=_.height,p=1,u=Math.cos(_.rotation),c=Math.sin(_.rotation),d=_.xCenter,f=_.yCenter,m=1/s,h=1/a,(g=Array(16))[0]=l*u*p*m,g[1]=-i*c*m,g[2]=0,g[3]=(-.5*l*u*p+.5*i*c+d)*m,g[4]=l*c*p*h,g[5]=i*u*h,g[6]=0,g[7]=(-.5*i*u-.5*l*c*p+f)*h,g[8]=0,g[9]=0,g[10]=l*m,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,j=function(e){if(16!==e.length)throw Error("Array length must be 16 but got "+e.length);return[[e[0],e[1],e[2],e[3]],[e[4],e[5],e[6],e[7]],[e[8],e[9],e[10],e[11]],[e[12],e[13],e[14],e[15]]]}(g),{imageTensor:(0,o.tidy)(function(){var t,r=e instanceof o.Tensor?e:o.browser.fromPixels(e),n=(0,o.tensor2d)((ew(x,"inputResolution"),[1/x.width*j[0][0]*k.width,1/x.height*j[0][1]*k.width,j[0][3]*k.width,1/x.width*j[1][0]*k.height,1/x.height*j[1][1]*k.height,j[1][3]*k.height,0,0]),[1,8]),s=o.image.transform((0,o.expandDims)((0,o.cast)(r,"float32")),n,"bilinear","zero"===v?"constant":"nearest",0,[x.height,x.width]);return null!=b?(t=function(e,t,r,n){!1;var s=(n-r)/255;return{scale:s,offset:r-0*s}}(0,0,b[0],b[1]),(0,o.tidy)(function(){return(0,o.add)((0,o.mul)(s,t.scale),t.offset)})):s}),padding:I,transformationMatrix:j}).imageTensor,T=(0,o.slice)(r.model.predict(w),[0,0,0,1],-1),S=ej(e),C=(0,o.tidy)(function(){var e=(0,o.squeeze)(T,[0]),t=e.shape[2];if(1===t){var r=e;switch(eE.activation){case"none":break;case"sigmoid":r=(0,o.sigmoid)(r);break;case"softmax":throw Error("Softmax activation requires two channels.");default:throw Error("Activation not supported ("+eE.activation+")")}var n=S?o.image.resizeBilinear(r,[S.height,S.width]):r;return(0,o.squeeze)(n,[2])}throw Error("Unsupported number of tensor channels "+t)}),N=(0,o.expandDims)(C,2),E=(0,o.pad)(N,[[0,0],[0,0],[0,1]]);return(0,o.mirrorPad)(E,[[0,0],[0,0],[0,2]],"symmetric")}))}]]})})},e.prototype.dispose=function(){this.model.dispose()},e.prototype.reset=function(){},e}();function e$(e,t){return d(this,void 0,void 0,function(){var r,n;return f(this,function(s){switch(e){case eR.MediaPipeSelfieSegmentation:if(r=void 0,null!=(n=t)){if("tfjs"===n.runtime)return[2,function(e){return d(this,void 0,void 0,function(){var t,r,n;return f(this,function(s){switch(s.label){case 0:return r="string"==typeof(t=function(e){if(null==e)return c({},eT);var t=c({},e);if(t.runtime="tfjs",null==t.modelType&&(t.modelType=eT.modelType),"general"!==t.modelType&&"landscape"!==t.modelType)throw Error("Model type must be one of general or landscape, but got "+t.modelType);return null==t.modelUrl&&("general"===t.modelType?t.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1":t.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/landscape/1"),t}(e)).modelUrl&&t.modelUrl.indexOf("https://tfhub.dev")>-1,[4,(0,l.loadGraphModel)(t.modelUrl,{fromTFHub:r})];case 1:return n=s.sent(),[2,new eP(t.modelType,n)]}})})}(n)];if("mediapipe"===n.runtime)return[2,function(e){return d(this,void 0,void 0,function(){var t;return f(this,function(r){switch(r.label){case 0:return[4,(t=new eI(function(e){if(null==e)return c({},eb);var t=c({},e);return t.runtime="mediapipe",null==t.modelType&&(t.modelType=eb.modelType),t}(e))).initialize()];case 1:return r.sent(),[2,t]}})})}(n)];r=n.runtime}throw Error("Expect modelConfig.runtime to be either 'tfjs' or 'mediapipe', but got "+r);case eR.BodyPix:return[2,function(e){return d(this,void 0,void 0,function(){return f(this,function(t){return[2,(function(e){return void 0===e&&(e=ea),d(this,void 0,void 0,function(){return f(this,function(t){return"ResNet50"===(e=function(e){if(null==(e=e||ea).architecture&&(e.architecture="MobileNetV1"),0>eo.indexOf(e.architecture))throw Error("Invalid architecture "+e.architecture+". Should be one of "+eo);if(null==e.outputStride&&(e.outputStride=16),0>el[e.architecture].indexOf(e.outputStride))throw Error("Invalid outputStride "+e.outputStride+". Should be one of "+el[e.architecture]+" for architecture "+e.architecture+".");if(null==e.multiplier&&(e.multiplier=1),0>ei[e.architecture].indexOf(e.multiplier))throw Error("Invalid multiplier "+e.multiplier+". Should be one of "+ei[e.architecture]+" for architecture "+e.architecture+".");if(null==e.quantBytes&&(e.quantBytes=4),0>ep.indexOf(e.quantBytes))throw Error("Invalid quantBytes "+e.quantBytes+". Should be one of "+ep+" for architecture "+e.architecture+".");return e}(e)).architecture?[2,function(e){return d(this,void 0,void 0,function(){var t,r,n;return f(this,function(s){switch(s.label){case 0:var a;if(t=e.outputStride,r=e.quantBytes,null==o)throw Error("Cannot find TensorFlow.js. If you are using a + \ No newline at end of file diff --git a/docs/document/advanced/built-in.html b/docs/document/advanced/built-in.html index 472e0dcc3..14ddcacaf 100644 --- a/docs/document/advanced/built-in.html +++ b/docs/document/advanced/built-in.html @@ -217,7 +217,7 @@ art.on('ready', () => { art.plugins.add(myPlugin); }); - + \ No newline at end of file diff --git a/docs/document/advanced/class.html b/docs/document/advanced/class.html index 85e0ef448..faccbdbec 100644 --- a/docs/document/advanced/class.html +++ b/docs/document/advanced/class.html @@ -31,7 +31,7 @@ }); console.info([...Artplayer.instances]);

version ​

返回播放器的版本信息

▶ Run Code
js
console.info(Artplayer.version);

env ​

返回播放器的环境变量

▶ Run Code
js
console.info(Artplayer.env);

build ​

返回播放器的打包时间

▶ Run Code
js
console.info(Artplayer.build);

config ​

返回视频的默认配置

▶ Run Code
js
console.info(Artplayer.config);

utils ​

返回播放器的工具函数集合

▶ Run Code
js
console.info(Artplayer.utils);

全部工具函数请参考以下地址:

artplayer/types/utils.d.ts

scheme ​

返回播放器选项的校验方案

▶ Run Code
js
console.info(Artplayer.scheme);

Emitter ​

返回事件分发器的构造函数

▶ Run Code
js
console.info(Artplayer.Emitter);

validator ​

返回选项的校验函数

▶ Run Code
js
console.info(Artplayer.validator);

kindOf ​

返回类型检测的函数工具

▶ Run Code
js
console.info(Artplayer.kindOf);

html ​

返回播放器所需的 html 字符串

▶ Run Code
js
console.info(Artplayer.html);

option ​

返回播放器的默认选项

▶ Run Code
js
console.info(Artplayer.option);
- + \ No newline at end of file diff --git a/docs/document/advanced/event.html b/docs/document/advanced/event.html index f927b09a8..0802e4f20 100644 --- a/docs/document/advanced/event.html +++ b/docs/document/advanced/event.html @@ -385,7 +385,7 @@ art.on('keydown', (event) => { console.log(event.code); });

video:canplay ​

浏览器可以播放媒体文件了,但估计没有足够的数据来支撑播放到结束,不必停下来进一步缓冲内容

video:canplaythrough ​

浏览器估计它可以在不停止内容缓冲的情况下播放媒体直到结束

video:complete ​

OfflineAudioContext 渲染完成

video:durationchange ​

duration 属性的值改变时触发

video:emptied ​

媒体内容变为空;例如,当这个 media 已经加载完成(或者部分加载完成),则发送此事件,并调用 load() 方法重新加载它

video:ended ​

视频停止播放,因为 media 已经到达结束点

video:error ​

获取媒体数据时出错,或者资源类型不是受支持的媒体格式

video:loadeddata ​

media 中的首帧已经完成加载

video:loadedmetadata ​

已加载元数据

video:pause ​

播放已暂停

video:play ​

播放已开始

video:playing ​

由于缺乏数据而暂停或延迟后,播放准备开始

video:progress ​

在浏览器加载资源时周期性触发

video:ratechange ​

播放速率发生变化

video:seeked ​

跳帧(seek)操作完成

video:seeking ​

跳帧(seek)操作开始

video:stalled ​

用户代理(user agent)正在尝试获取媒体数据,但数据意外未出现

video:suspend ​

媒体数据加载已暂停

video:timeupdate ​

currentTime 属性指定的时间发生变化

video:volumechange ​

音量发生变化

video:waiting ​

由于暂时缺少数据,播放已停止

- + \ No newline at end of file diff --git a/docs/document/advanced/global.html b/docs/document/advanced/global.html index d9e75406a..be00a6111 100644 --- a/docs/document/advanced/global.html +++ b/docs/document/advanced/global.html @@ -248,7 +248,7 @@ // 只销毁界面,不主动清空 src art.destroy(); - + \ No newline at end of file diff --git a/docs/document/advanced/plugin.html b/docs/document/advanced/plugin.html index 184dd9b9b..05f1b17d0 100644 --- a/docs/document/advanced/plugin.html +++ b/docs/document/advanced/plugin.html @@ -122,7 +122,7 @@ }) ], }); - + \ No newline at end of file diff --git a/docs/document/advanced/property.html b/docs/document/advanced/property.html index 675a23557..0814d5e35 100644 --- a/docs/document/advanced/property.html +++ b/docs/document/advanced/property.html @@ -457,7 +457,7 @@ art.on('ready', () => { art.subtitleOffset = 1; }); - + \ No newline at end of file diff --git a/docs/document/assets/en_index.md.C2Y0fh0y.js b/docs/document/assets/en_index.md.B8p5hbD4.js similarity index 98% rename from docs/document/assets/en_index.md.C2Y0fh0y.js rename to docs/document/assets/en_index.md.B8p5hbD4.js index 82328ce9f..10a63d9cd 100644 --- a/docs/document/assets/en_index.md.C2Y0fh0y.js +++ b/docs/document/assets/en_index.md.B8p5hbD4.js @@ -1,4 +1,4 @@ -import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"Installation & Usage","description":"","frontmatter":{},"headers":[],"relativePath":"en/index.md","filePath":"en/index.md","lastUpdated":1764426402000}'),p={name:"en/index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

Installation & Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
+import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"Installation & Usage","description":"","frontmatter":{},"headers":[],"relativePath":"en/index.md","filePath":"en/index.md","lastUpdated":1764426402000}'),p={name:"en/index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

Installation & Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -19,7 +19,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
           });
         </script>
     </body>
-</html>

Note

The player's dimensions depend on the size of its container container, so your container must have defined dimensions.

See more usage examples at the following link:

/packages/artplayer-template

Vue.js ​

vue
<template>
+</html>

Note

The player's dimensions depend on the size of its container container, so your container must have defined dimensions.

See more usage examples at the following link:

/packages/artplayer-template

Vue.js ​

vue
<template>
   <div ref="$container" />
 </template>
 
@@ -71,7 +71,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 function getInstance(art) {
   console.log(art)
 }
-</script>

Artplayer is not reactive:

Directly modifying option in Vue.js will not update the player.

React.js ​

jsx
import Artplayer from 'artplayer'
+</script>

Artplayer is not reactive:

Directly modifying option in Vue.js will not update the player.

React.js ​

jsx
import Artplayer from 'artplayer'
 import { useEffect, useRef } from 'react'
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -154,7 +154,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

Legacy Browsers ​

The production build artplayer.js only supports the latest major version of Chrome: last 1 Chrome version

For legacy browsers, you can use the artplayer.legacy.js file, which supports compatibility down to: IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, modify the following configuration and build it yourself:

Build configuration: scripts/build.js

Reference documentation: browserslist

ECMAScript Module ​

Starting from 5.2.6, artplayer and all plugins also provide an ESM version mjs, such as:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

Legacy Browsers ​

The production build artplayer.js only supports the latest major version of Chrome: last 1 Chrome version

For legacy browsers, you can use the artplayer.legacy.js file, which supports compatibility down to: IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, modify the following configuration and build it yourself:

Build configuration: scripts/build.js

Reference documentation: browserslist

ECMAScript Module ​

Starting from 5.2.6, artplayer and all plugins also provide an ESM version mjs, such as:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
diff --git a/docs/document/assets/en_index.md.C2Y0fh0y.lean.js b/docs/document/assets/en_index.md.B8p5hbD4.lean.js
similarity index 100%
rename from docs/document/assets/en_index.md.C2Y0fh0y.lean.js
rename to docs/document/assets/en_index.md.B8p5hbD4.lean.js
diff --git a/docs/document/assets/en_start_i18n.md.CsL-uZUF.js b/docs/document/assets/en_start_i18n.md.Dkh9P36y.js
similarity index 98%
rename from docs/document/assets/en_start_i18n.md.CsL-uZUF.js
rename to docs/document/assets/en_start_i18n.md.Dkh9P36y.js
index eedb73d24..36e7c2e92 100644
--- a/docs/document/assets/en_start_i18n.md.CsL-uZUF.js
+++ b/docs/document/assets/en_start_i18n.md.Dkh9P36y.js
@@ -2,7 +2,7 @@ import{_ as a,c as i,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     lang: 'zh-cn', // or 'en'
-});

Importing Languages ​

Language files before bundling are located at: artplayer/src/i18n/*.js. Contributions to add your language are welcome.

Language files after bundling are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
+});

Importing Languages ​

Language files before bundling are located at: artplayer/src/i18n/*.js. Contributions to add your language are welcome.

Language files after bundling are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
 import zhTw from 'artplayer/i18n/zh-tw';
 
 var art = new Artplayer({
diff --git a/docs/document/assets/en_start_i18n.md.CsL-uZUF.lean.js b/docs/document/assets/en_start_i18n.md.Dkh9P36y.lean.js
similarity index 100%
rename from docs/document/assets/en_start_i18n.md.CsL-uZUF.lean.js
rename to docs/document/assets/en_start_i18n.md.Dkh9P36y.lean.js
diff --git a/docs/document/assets/index.md.u8oxcBYH.js b/docs/document/assets/index.md.DqyRMHYW.js
similarity index 98%
rename from docs/document/assets/index.md.u8oxcBYH.js
rename to docs/document/assets/index.md.DqyRMHYW.js
index 68de5e316..3c6e73fe4 100644
--- a/docs/document/assets/index.md.u8oxcBYH.js
+++ b/docs/document/assets/index.md.DqyRMHYW.js
@@ -1,4 +1,4 @@
-import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"安装使用","description":"","frontmatter":{},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1757137705000}'),p={name:"index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
+import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g=JSON.parse('{"title":"安装使用","description":"","frontmatter":{},"headers":[],"relativePath":"index.md","filePath":"index.md","lastUpdated":1757137705000}'),p={name:"index.md"};function t(e,s,h,k,r,E){return n(),a("div",null,s[0]||(s[0]=[l(`

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -19,7 +19,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
           });
         </script>
     </body>
-</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/packages/artplayer-template

Vue.js ​

vue
<template>
+</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/packages/artplayer-template

Vue.js ​

vue
<template>
   <div ref="$container" />
 </template>
 
@@ -71,7 +71,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 function getInstance(art) {
   console.log(art)
 }
-</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import Artplayer from 'artplayer'
+</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import Artplayer from 'artplayer'
 import { useEffect, useRef } from 'react'
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -154,7 +154,7 @@ import{_ as i,c as a,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const g
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.6 开始,artplayer 和所有插件还会提供一个 ESM 版本的 mjs,如:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.6 开始,artplayer 和所有插件还会提供一个 ESM 版本的 mjs,如:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
diff --git a/docs/document/assets/index.md.u8oxcBYH.lean.js b/docs/document/assets/index.md.DqyRMHYW.lean.js
similarity index 100%
rename from docs/document/assets/index.md.u8oxcBYH.lean.js
rename to docs/document/assets/index.md.DqyRMHYW.lean.js
diff --git a/docs/document/assets/plugin_danmuku.md.oQjW_Ffo.js b/docs/document/assets/plugin_danmuku.md.qEx87-hs.js
similarity index 99%
rename from docs/document/assets/plugin_danmuku.md.oQjW_Ffo.js
rename to docs/document/assets/plugin_danmuku.md.qEx87-hs.js
index 83c2ad1ec..e4ebe632b 100644
--- a/docs/document/assets/plugin_danmuku.md.oQjW_Ffo.js
+++ b/docs/document/assets/plugin_danmuku.md.qEx87-hs.js
@@ -1,4 +1,4 @@
-import{_ as n,c as l,o as p,ak as s,j as i}from"./chunks/framework.xxfEszSJ.js";const y=JSON.parse('{"title":"弹幕库","description":"","frontmatter":{},"headers":[],"relativePath":"plugin/danmuku.md","filePath":"plugin/danmuku.md","lastUpdated":1734270991000}'),h={name:"plugin/danmuku.md"};function e(k,a,t,r,E,d){return p(),l("div",null,a[0]||(a[0]=[s(`

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
+import{_ as n,c as l,o as p,ak as s,j as i}from"./chunks/framework.xxfEszSJ.js";const y=JSON.parse('{"title":"弹幕库","description":"","frontmatter":{},"headers":[],"relativePath":"plugin/danmuku.md","filePath":"plugin/danmuku.md","lastUpdated":1734270991000}'),h={name:"plugin/danmuku.md"};function e(k,a,t,r,E,d){return p(),l("div",null,a[0]||(a[0]=[s(`

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
     text: '', // 弹幕文本
     time: 10, // 弹幕时间, 默认为当前播放器时间
     mode: 0, // 弹幕模式: 0: 滚动(默认),1: 顶部,2: 底部
diff --git a/docs/document/assets/plugin_danmuku.md.oQjW_Ffo.lean.js b/docs/document/assets/plugin_danmuku.md.qEx87-hs.lean.js
similarity index 100%
rename from docs/document/assets/plugin_danmuku.md.oQjW_Ffo.lean.js
rename to docs/document/assets/plugin_danmuku.md.qEx87-hs.lean.js
diff --git a/docs/document/assets/start_i18n.md.BjaLSvLX.js b/docs/document/assets/start_i18n.md.CTmnGgFO.js
similarity index 98%
rename from docs/document/assets/start_i18n.md.BjaLSvLX.js
rename to docs/document/assets/start_i18n.md.CTmnGgFO.js
index 2eb295ff9..be787f5f6 100644
--- a/docs/document/assets/start_i18n.md.BjaLSvLX.js
+++ b/docs/document/assets/start_i18n.md.CTmnGgFO.js
@@ -2,7 +2,7 @@ import{_ as a,c as i,o as n,ak as l}from"./chunks/framework.xxfEszSJ.js";const c
     container: '.artplayer-app',
     url: '/assets/sample/video.mp4',
     lang: 'zh-cn', // or 'en'
-});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
+});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
 import zhTw from 'artplayer/i18n/zh-tw';
 
 var art = new Artplayer({
diff --git a/docs/document/assets/start_i18n.md.BjaLSvLX.lean.js b/docs/document/assets/start_i18n.md.CTmnGgFO.lean.js
similarity index 100%
rename from docs/document/assets/start_i18n.md.BjaLSvLX.lean.js
rename to docs/document/assets/start_i18n.md.CTmnGgFO.lean.js
diff --git a/docs/document/component/contextmenu.html b/docs/document/component/contextmenu.html
index b5581c43a..a23151cc7 100644
--- a/docs/document/component/contextmenu.html
+++ b/docs/document/component/contextmenu.html
@@ -106,7 +106,7 @@
         })
     }, 3000);
 });
- + \ No newline at end of file diff --git a/docs/document/component/controls.html b/docs/document/component/controls.html index b98ef9a77..ed1ebc1ed 100644 --- a/docs/document/component/controls.html +++ b/docs/document/component/controls.html @@ -153,7 +153,7 @@ }); }, 3000); });
- + \ No newline at end of file diff --git a/docs/document/component/layers.html b/docs/document/component/layers.html index 9fc2055f4..eb03aa18e 100644 --- a/docs/document/component/layers.html +++ b/docs/document/component/layers.html @@ -125,7 +125,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/component/setting.html b/docs/document/component/setting.html index d9958ae7b..e46f4d53a 100644 --- a/docs/document/component/setting.html +++ b/docs/document/component/setting.html @@ -245,7 +245,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/advanced/built-in.html b/docs/document/en/advanced/built-in.html index 72a2761e8..fb4dbd161 100644 --- a/docs/document/en/advanced/built-in.html +++ b/docs/document/en/advanced/built-in.html @@ -217,7 +217,7 @@ art.on('ready', () => { art.plugins.add(myPlugin); }); - + \ No newline at end of file diff --git a/docs/document/en/advanced/class.html b/docs/document/en/advanced/class.html index 0602a0b9a..6c6eede82 100644 --- a/docs/document/en/advanced/class.html +++ b/docs/document/en/advanced/class.html @@ -31,7 +31,7 @@ }); console.info([...Artplayer.instances]);

version ​

Returns the version information of the player.

▶ Run Code
js
console.info(Artplayer.version);

env ​

Returns the environment variables of the player.

▶ Run Code
js
console.info(Artplayer.env);

build ​

Returns the build time of the player.

▶ Run Code
js
console.info(Artplayer.build);

config ​

Returns the default configuration for videos.

▶ Run Code
js
console.info(Artplayer.config);

utils ​

Returns the collection of utility functions for the player.

▶ Run Code
js
console.info(Artplayer.utils);

For all utility functions, please refer to the following address:

artplayer/types/utils.d.ts

scheme ​

Returns the validation schema for player options.

▶ Run Code
js
console.info(Artplayer.scheme);

Emitter ​

Returns the constructor function for the event emitter.

▶ Run Code
js
console.info(Artplayer.Emitter);

validator ​

Returns the validation function for options.

▶ Run Code
js
console.info(Artplayer.validator);

kindOf ​

Returns the utility function for type detection.

▶ Run Code
js
console.info(Artplayer.kindOf);

html ​

Returns the html string required by the player.

▶ Run Code
js
console.info(Artplayer.html);

option ​

Returns the default options for the player.

▶ Run Code
js
console.info(Artplayer.option);
- + \ No newline at end of file diff --git a/docs/document/en/advanced/event.html b/docs/document/en/advanced/event.html index 6a0894886..ca5f73475 100644 --- a/docs/document/en/advanced/event.html +++ b/docs/document/en/advanced/event.html @@ -412,7 +412,7 @@ art.on('keydown', (event) => { console.log(event.code); });

video:canplay ​

The browser can start playing the media, but estimates there isn't enough data to play through to the end without having to stop for further buffering

video:canplaythrough ​

The browser estimates it can play the media through to the end without stopping to buffer content

video:complete ​

OfflineAudioContext rendering is complete

video:durationchange ​

Triggered when the value of the duration property changes

video:emptied ​

The media has become empty; for example, this event is sent when the media has already been loaded (or partially loaded), and the load() method is called to reload it

video:ended ​

Playback has stopped because the media has reached its end point

video:error ​

An error occurred while fetching media data, or the resource type is not a supported media format

video:loadeddata ​

The first frame of the media has finished loading

video:loadedmetadata ​

Metadata has been loaded

video:pause ​

Playback has been paused

video:play ​

Playback has begun

video:playing ​

Playback is ready to start after having been paused or delayed due to lack of data

video:progress ​

Periodically triggered while the browser is loading the resource

video:ratechange ​

The playback rate has changed

video:seeked ​

A seek operation has completed

video:seeking ​

A seek operation has begun

video:stalled ​

The user agent is trying to fetch media data, but data is unexpectedly not forthcoming

video:suspend ​

Media data loading has been suspended

video:timeupdate ​

The time indicated by the currentTime attribute has been updated

video:volumechange ​

The volume has changed

video:waiting ​

Playback has stopped due to temporary lack of data

- + \ No newline at end of file diff --git a/docs/document/en/advanced/global.html b/docs/document/en/advanced/global.html index 814a9e455..31238038d 100644 --- a/docs/document/en/advanced/global.html +++ b/docs/document/en/advanced/global.html @@ -266,7 +266,7 @@ // Only destroys the UI, does not actively clear src art.destroy(); - + \ No newline at end of file diff --git a/docs/document/en/advanced/plugin.html b/docs/document/en/advanced/plugin.html index d713314a5..e1e377296 100644 --- a/docs/document/en/advanced/plugin.html +++ b/docs/document/en/advanced/plugin.html @@ -122,7 +122,7 @@ }) ], }); - + \ No newline at end of file diff --git a/docs/document/en/advanced/property.html b/docs/document/en/advanced/property.html index 5fc532992..b42a43820 100644 --- a/docs/document/en/advanced/property.html +++ b/docs/document/en/advanced/property.html @@ -487,7 +487,7 @@ art.on('ready', () => { art.subtitleOffset = 1; }); - + \ No newline at end of file diff --git a/docs/document/en/component/contextmenu.html b/docs/document/en/component/contextmenu.html index c7e037084..02fd88ac2 100644 --- a/docs/document/en/component/contextmenu.html +++ b/docs/document/en/component/contextmenu.html @@ -106,7 +106,7 @@ }) }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/component/controls.html b/docs/document/en/component/controls.html index aa92ed70a..e3c33fa17 100644 --- a/docs/document/en/component/controls.html +++ b/docs/document/en/component/controls.html @@ -153,7 +153,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/component/layers.html b/docs/document/en/component/layers.html index 7a253adb1..0c611b8d8 100644 --- a/docs/document/en/component/layers.html +++ b/docs/document/en/component/layers.html @@ -125,7 +125,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/component/setting.html b/docs/document/en/component/setting.html index 67ea1759f..c90cf9c6a 100644 --- a/docs/document/en/component/setting.html +++ b/docs/document/en/component/setting.html @@ -260,7 +260,7 @@ }); }, 3000); }); - + \ No newline at end of file diff --git a/docs/document/en/index.html b/docs/document/en/index.html index aab6d5105..f79b29076 100644 --- a/docs/document/en/index.html +++ b/docs/document/en/index.html @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ -
Skip to content

Installation & Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
+    
Skip to content

Installation & Usage ​

Installation ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

Usage ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -44,7 +44,7 @@
           });
         </script>
     </body>
-</html>

Note

The player's dimensions depend on the size of its container container, so your container must have defined dimensions.

See more usage examples at the following link:

/packages/artplayer-template

Vue.js ​

vue
<template>
+</html>

Note

The player's dimensions depend on the size of its container container, so your container must have defined dimensions.

See more usage examples at the following link:

/packages/artplayer-template

Vue.js ​

vue
<template>
   <div ref="$container" />
 </template>
 
@@ -96,7 +96,7 @@
 function getInstance(art) {
   console.log(art)
 }
-</script>

Artplayer is not reactive:

Directly modifying option in Vue.js will not update the player.

React.js ​

jsx
import Artplayer from 'artplayer'
+</script>

Artplayer is not reactive:

Directly modifying option in Vue.js will not update the player.

React.js ​

jsx
import Artplayer from 'artplayer'
 import { useEffect, useRef } from 'react'
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -179,7 +179,7 @@
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

Legacy Browsers ​

The production build artplayer.js only supports the latest major version of Chrome: last 1 Chrome version

For legacy browsers, you can use the artplayer.legacy.js file, which supports compatibility down to: IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, modify the following configuration and build it yourself:

Build configuration: scripts/build.js

Reference documentation: browserslist

ECMAScript Module ​

Starting from 5.2.6, artplayer and all plugins also provide an ESM version mjs, such as:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

Legacy Browsers ​

The production build artplayer.js only supports the latest major version of Chrome: last 1 Chrome version

For legacy browsers, you can use the artplayer.legacy.js file, which supports compatibility down to: IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

If you need to support even older browsers, modify the following configuration and build it yourself:

Build configuration: scripts/build.js

Reference documentation: browserslist

ECMAScript Module ​

Starting from 5.2.6, artplayer and all plugins also provide an ESM version mjs, such as:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
@@ -237,7 +237,7 @@
         </script>
     </body>
 </html>

Note

You need to modify it before importing the Artplayer dependency for it to take effect.

- + \ No newline at end of file diff --git a/docs/document/en/start/i18n.html b/docs/document/en/start/i18n.html index 3f0ff1d7e..b860b1746 100644 --- a/docs/document/en/start/i18n.html +++ b/docs/document/en/start/i18n.html @@ -13,7 +13,7 @@ - + @@ -27,7 +27,7 @@ container: '.artplayer-app', url: '/assets/sample/video.mp4', lang: 'zh-cn', // or 'en' -});

Importing Languages ​

Language files before bundling are located at: artplayer/src/i18n/*.js. Contributions to add your language are welcome.

Language files after bundling are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
+});

Importing Languages ​

Language files before bundling are located at: artplayer/src/i18n/*.js. Contributions to add your language are welcome.

Language files after bundling are located at: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
 import zhTw from 'artplayer/i18n/zh-tw';
 
 var art = new Artplayer({
@@ -75,7 +75,7 @@
         },
     },
 });
- + \ No newline at end of file diff --git a/docs/document/en/start/option.html b/docs/document/en/start/option.html index 35437a431..739f6d35b 100644 --- a/docs/document/en/start/option.html +++ b/docs/document/en/start/option.html @@ -475,7 +475,7 @@ url: '/assets/sample/video.mp4', proxy: () => document.createElement('video') }); - + \ No newline at end of file diff --git a/docs/document/hashmap.json b/docs/document/hashmap.json index d3fc5d18b..3582bea67 100644 --- a/docs/document/hashmap.json +++ b/docs/document/hashmap.json @@ -1 +1 @@ -{"advanced_built-in.md":"DiyRIcIA","advanced_class.md":"Da3aE0pP","advanced_event.md":"mrsB0MsK","advanced_global.md":"Bdw3azKs","advanced_plugin.md":"B3Pobmcq","advanced_property.md":"CA7GaeI3","component_contextmenu.md":"ClKmcIKr","component_controls.md":"Cl62yW1F","component_layers.md":"Cys52VMi","component_setting.md":"BP5674ir","en_advanced_built-in.md":"XdT81JC0","en_advanced_class.md":"BLyA7rxa","en_advanced_event.md":"CtQl1IYg","en_advanced_global.md":"D5Nz8wyo","en_advanced_plugin.md":"BOuMu80J","en_advanced_property.md":"urRMaqHe","en_component_contextmenu.md":"COLfX45a","en_component_controls.md":"BbQsn0wJ","en_component_layers.md":"CX93a7QS","en_component_setting.md":"C6o2AWtX","en_index.md":"C2Y0fh0y","en_start_i18n.md":"CsL-uZUF","en_start_option.md":"Bk4YXvof","index.md":"u8oxcBYH","plugin_danmuku.md":"oQjW_Ffo","start_i18n.md":"BjaLSvLX","start_option.md":"D52S8Ynf"} +{"advanced_built-in.md":"DiyRIcIA","advanced_class.md":"Da3aE0pP","advanced_event.md":"mrsB0MsK","advanced_global.md":"Bdw3azKs","advanced_plugin.md":"B3Pobmcq","advanced_property.md":"CA7GaeI3","component_contextmenu.md":"ClKmcIKr","component_controls.md":"Cl62yW1F","component_layers.md":"Cys52VMi","component_setting.md":"BP5674ir","en_advanced_built-in.md":"XdT81JC0","en_advanced_class.md":"BLyA7rxa","en_advanced_event.md":"CtQl1IYg","en_advanced_global.md":"D5Nz8wyo","en_advanced_plugin.md":"BOuMu80J","en_advanced_property.md":"urRMaqHe","en_component_contextmenu.md":"COLfX45a","en_component_controls.md":"BbQsn0wJ","en_component_layers.md":"CX93a7QS","en_component_setting.md":"C6o2AWtX","en_index.md":"B8p5hbD4","en_start_i18n.md":"Dkh9P36y","en_start_option.md":"Bk4YXvof","index.md":"DqyRMHYW","plugin_danmuku.md":"qEx87-hs","start_i18n.md":"CTmnGgFO","start_option.md":"D52S8Ynf"} diff --git a/docs/document/index.html b/docs/document/index.html index b92f3db78..9aba52bb0 100644 --- a/docs/document/index.html +++ b/docs/document/index.html @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ -
Skip to content

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
+    
Skip to content

安装使用 ​

安装 ​

bash
npm install artplayer
bash
yarn add artplayer
bash
pnpm add artplayer
html
<script src="path/to/artplayer.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.js
bash
https://unpkg.com/artplayer/dist/artplayer.js

使用 ​

html
<html>
     <head>
         <title>ArtPlayer Demo</title>
         <meta charset="UTF-8" />
@@ -44,7 +44,7 @@
           });
         </script>
     </body>
-</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/packages/artplayer-template

Vue.js ​

vue
<template>
+</html>

提示

播放器的尺寸依赖于容器 container 的尺寸,所以你的容器 container 必须是有尺寸的

以下链接可以看到更多的使用例子

/packages/artplayer-template

Vue.js ​

vue
<template>
   <div ref="$container" />
 </template>
 
@@ -96,7 +96,7 @@
 function getInstance(art) {
   console.log(art)
 }
-</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import Artplayer from 'artplayer'
+</script>

Artplayer 非响应式:

在 Vue.js 里直接修改 option 是不会改变播放器的

React.js ​

jsx
import Artplayer from 'artplayer'
 import { useEffect, useRef } from 'react'
 
 export default function Player({ option, getInstance, ...rest }) {
@@ -179,7 +179,7 @@
 
 option.volume = 0.5;
 
-const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.6 开始,artplayer 和所有插件还会提供一个 ESM 版本的 mjs,如:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
+const art8 = new Artplayer(option);

古老的浏览器 ​

生产构建的 artplayer.js 只兼容最新一个主版本的 Chrome:last 1 Chrome version

对于古老的浏览器,可以使用 artplayer.legacy.js 文件,可以兼容到:IE 11

js
import Artplayer from 'artplayer/legacy'
bash
https://cdn.jsdelivr.net/npm/artplayer/dist/artplayer.legacy.js
bash
https://unpkg.com/artplayer/dist/artplayer.legacy.js

假如你要兼容更古老的浏览器时,请修改以下配置然后自行构建:

构建配置:scripts/build.js

参考文档:browserslist

ECMAScript Module ​

从 5.2.6 开始,artplayer 和所有插件还会提供一个 ESM 版本的 mjs,如:

  • artplayer/dist/artplayer.mjs
  • artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.mjs
html
<!DOCTYPE html>
 <html lang="en">
 
 <head>
@@ -237,7 +237,7 @@
         </script>
     </body>
 </html>

提示

你需要在引入 Artplayer 依赖前来修改它才会生效

- + \ No newline at end of file diff --git a/docs/document/plugin/danmuku.html b/docs/document/plugin/danmuku.html index 3b8f03a35..653abe4ff 100644 --- a/docs/document/plugin/danmuku.html +++ b/docs/document/plugin/danmuku.html @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ -
Skip to content

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
+    
Skip to content

弹幕库 ​

演示 ​

👉 查看完整演示

安装 ​

bash
npm install artplayer-plugin-danmuku
bash
yarn add artplayer-plugin-danmuku
bash
pnpm add artplayer-plugin-danmuku
html
<script src="path/to/artplayer-plugin-danmuku.js"></script>

CDN ​

bash
https://cdn.jsdelivr.net/npm/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js
bash
https://unpkg.com/artplayer-plugin-danmuku/dist/artplayer-plugin-danmuku.js

弹幕结构 ​

每一个弹幕是一个对象,多个弹幕组成的数组就是弹幕库,通常只需要text就可以发送一个弹幕,其余都是非必要参数

js
{
     text: '', // 弹幕文本
     time: 10, // 弹幕时间, 默认为当前播放器时间
     mode: 0, // 弹幕模式: 0: 滚动(默认),1: 顶部,2: 底部
@@ -367,7 +367,7 @@
 art.on('artplayerPluginDanmuku:destroy', () => {
     console.info('弹幕销毁');
 });
- + \ No newline at end of file diff --git a/docs/document/start/i18n.html b/docs/document/start/i18n.html index 5ffe53a89..b7100ccc8 100644 --- a/docs/document/start/i18n.html +++ b/docs/document/start/i18n.html @@ -13,7 +13,7 @@ - + @@ -27,7 +27,7 @@ container: '.artplayer-app', url: '/assets/sample/video.mp4', lang: 'zh-cn', // or 'en' -});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
+});

导入语言 ​

打包前的语言文件存放于: artplayer/src/i18n/*.js, 欢迎来添加你的语言

打包后的语言文件存放于: artplayer/dist/i18n/*.js

js
import id from 'artplayer/i18n/id';
 import zhTw from 'artplayer/i18n/zh-tw';
 
 var art = new Artplayer({
@@ -75,7 +75,7 @@
         },
     },
 });
- + \ No newline at end of file diff --git a/docs/document/start/option.html b/docs/document/start/option.html index 9a7ba1d44..9da6dde68 100644 --- a/docs/document/start/option.html +++ b/docs/document/start/option.html @@ -415,7 +415,7 @@ url: '/assets/sample/video.mp4', proxy: () => document.createElement('video') });
- + \ No newline at end of file diff --git a/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.js b/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.js index 17ed0882d..6698f7127 100644 --- a/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.js +++ b/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ads.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,n,t,l,i,r,a,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof d[l]&&d[l],p=u.i||{},s=u.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(n,t){if(!s[n]){if(!e[n]){if(i[n])return i[n];var r="function"==typeof d[l]&&d[l];if(!t&&r)return r(n,!0);if(u)return u(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(t){var l=e[n][1][t];return null!=l?l:t},p.cache={};var o=s[n]=new y.Module(n);e[n][0].call(o.exports,p,o,o.exports,d)}return s[n].exports;function p(e){var n=p.resolve(e);if(!1===n)return{};if(Array.isArray(n)){var t={__esModule:!0};return n.forEach(function(e){var n=e[0],l=e[1],i=e[2]||e[0],r=y(l);"*"===n?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(t,n,{enumerable:!0,value:r}):Object.defineProperty(t,n,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),t}return y(n)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=s,y.parent=u,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=p,y.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(y,"root",{get:function(){return d[l]}}),d[l]=y;for(var f=0;fo);var r=e("bundle-text:./style.less"),a=i.interopDefault(r);function o(e){return n=>{!function(e){let{version:n,utils:{errorHandle:t}}=e.constructor,l=n.split(".").map(Number);t(l[0]+l[1]/100>=5,`Artplayer.js@${n} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`)}(n);let{template:{$player:t},icons:{volume:l,volumeClose:i,fullscreenOn:r,fullscreenOff:a,loading:d},constructor:{validator:u,utils:{query:p,append:s,setStyle:c}}}=n;e=u({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let y=null,f=null,g=null,m=null,v=null,x=null,h=0,b=null,w=!1,j=!1,D=!1;function P(e,n){return n.replace("%s",e)}function O(){w=!0,n.play(),e.video&&y.pause(),c(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function k(){w||(b=setTimeout(()=>{h+=1;let n=e.playDuration-h;n>=1?g.innerHTML=P(n,e.i18n.canBeClosed):(g.innerHTML=e.i18n.close,D||(D=!0)),m.innerHTML=P(e.totalDuration-h,e.i18n.countdown),h>=e.totalDuration?O():k()},1e3))}function _(){w||clearTimeout(b)}function $(){j||(j=!0,function(){n.template.$ads=s(t,'
'),y=s(n.template.$ads,e.video?``:`
${e.html}
`),x=s(n.template.$ads,'
'),s(x,d),g=p(".artplayer-plugin-ads-close",f=s(n.template.$ads,`
${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}
${P(e.totalDuration,e.i18n.countdown)}
`)),m=p(".artplayer-plugin-ads-countdown",f),e.playDuration>=e.totalDuration&&c(g,"display","none"),n.proxy(g,"click",()=>{D&&O()});let o=p(".artplayer-plugin-ads-detail",v=s(n.template.$ads,`
${e.i18n.detail}
`)),u=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(e.url?n.proxy(o,"click",()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)}):c(o,"display","none"),e.video){let t=s(u,l),r=s(u,i);c(r,"display","none"),e.muted&&(y.muted=!0,c(t,"display","none"),c(r,"display","inline-flex")),n.proxy(u,"click",()=>{y.muted=!y.muted,y.muted?(c(t,"display","none"),c(r,"display","inline-flex")):(c(t,"display","inline-flex"),c(r,"display","none"))})}else c(u,"display","none");let b=s(h,r),w=s(h,a);c(w,"display","none"),n.proxy(h,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(c(b,"display","inline-flex"),c(w,"display","none")):(c(b,"display","none"),c(w,"display","inline-flex"))}),n.proxy(y,"click",()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(y,"error",O),n.proxy(y,"loadedmetadata",()=>{k(),y.play(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(k(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")),n.on("document:visibilitychange",()=>{document.hidden?_():k()}))}return n.on("ready",()=>{n.once("play",$),n.once("video:playing",$)}),{name:"artplayerPluginAds",skip:O,pause:_,play:k}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){let e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAds=o)},{"bundle-text:./style.less":"4TxNB","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"4TxNB":[function(e,n,t,l){n.exports=".artplayer-plugin-ads{z-index:150;color:#fff;background-color:#000;width:100%;height:100%;font-size:13px;line-height:1;position:absolute;inset:0;overflow:hidden}.artplayer-plugin-ads .artplayer-plugin-ads-html{justify-content:center;align-items:center;width:100%;height:100%;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:none;position:absolute;top:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-timer>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}"},{}],"6ykb1":[function(e,n,t,l){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,n){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:function(){return e[t]}})}),n},t.export=function(e,n,t){Object.defineProperty(e,n,{enumerable:!0,get:t})}},{}]},["ezZng"],"ezZng","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,n,l,i,r,a,o){var d="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof d[l]&&d[l],p=u.i||{},s=u.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(t,n){if(!s[t]){if(!e[t]){if(i[t])return i[t];var r="function"==typeof d[l]&&d[l];if(!n&&r)return r(t,!0);if(u)return u(t,!0);if(c&&"string"==typeof t)return c(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(n){var l=e[t][1][n];return null!=l?l:n},p.cache={};var o=s[t]=new y.Module(t);e[t][0].call(o.exports,p,o,o.exports,d)}return s[t].exports;function p(e){var t=p.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],l=e[1],i=e[2]||e[0],r=y(l);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(n,t,{enumerable:!0,value:r}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),n}return y(t)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=s,y.parent=u,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=p,y.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(y,"root",{get:function(){return d[l]}}),d[l]=y;for(var f=0;ftypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({ezZng:[function(e,t,n,l){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",()=>o);var r=e("bundle-text:./style.less"),a=i.interopDefault(r);function o(e){return t=>{!function(e){let{version:t,utils:{errorHandle:n}}=e.constructor,l=t.split(".").map(Number);n(l[0]+l[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{template:{$player:n},icons:{volume:l,volumeClose:i,fullscreenOn:r,fullscreenOff:a,loading:d},constructor:{validator:u,utils:{query:p,append:s,setStyle:c}}}=t;e=u({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let y=null,f=null,g=null,m=null,v=null,x=null,h=0,b=null,w=!1,j=!1,D=!1;function P(e,t){return t.replace("%s",e)}function O(){w=!0,t.play(),e.video&&y.pause(),c(t.template.$ads,"display","none"),t.emit("artplayerPluginAds:skip",e)}function k(){w||(b=setTimeout(()=>{h+=1;let t=e.playDuration-h;t>=1?g.innerHTML=P(t,e.i18n.canBeClosed):(g.innerHTML=e.i18n.close,D||(D=!0)),m.innerHTML=P(e.totalDuration-h,e.i18n.countdown),h>=e.totalDuration?O():k()},1e3))}function _(){w||clearTimeout(b)}function $(){j||(j=!0,function(){t.template.$ads=s(n,'
'),y=s(t.template.$ads,e.video?``:`
${e.html}
`),x=s(t.template.$ads,'
'),s(x,d),g=p(".artplayer-plugin-ads-close",f=s(t.template.$ads,`
${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}
${P(e.totalDuration,e.i18n.countdown)}
`)),m=p(".artplayer-plugin-ads-countdown",f),e.playDuration>=e.totalDuration&&c(g,"display","none"),t.proxy(g,"click",()=>{D&&O()});let o=p(".artplayer-plugin-ads-detail",v=s(t.template.$ads,`
${e.i18n.detail}
`)),u=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(e.url?t.proxy(o,"click",()=>{window.open(e.url),t.emit("artplayerPluginAds:click",e)}):c(o,"display","none"),e.video){let n=s(u,l),r=s(u,i);c(r,"display","none"),e.muted&&(y.muted=!0,c(n,"display","none"),c(r,"display","inline-flex")),t.proxy(u,"click",()=>{y.muted=!y.muted,y.muted?(c(n,"display","none"),c(r,"display","inline-flex")):(c(n,"display","inline-flex"),c(r,"display","none"))})}else c(u,"display","none");let b=s(h,r),w=s(h,a);c(w,"display","none"),t.proxy(h,"click",()=>{t.fullscreen=!t.fullscreen,t.fullscreen?(c(b,"display","inline-flex"),c(w,"display","none")):(c(b,"display","none"),c(w,"display","inline-flex"))}),t.proxy(y,"click",()=>{e.url&&window.open(e.url),t.emit("artplayerPluginAds:click",e)})}(),t.pause(),e.video?(t.proxy(y,"error",O),t.proxy(y,"loadedmetadata",()=>{k(),y.play(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(k(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")),t.on("document:visibilitychange",()=>{document.hidden?_():k()}))}return t.on("ready",()=>{t.once("play",$),t.once("video:playing",$)}),{name:"artplayerPluginAds",skip:O,pause:_,play:k}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-ads")){let e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"u">typeof window&&(window.artplayerPluginAds=o)},{"bundle-text:./style.less":"4TxNB","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"4TxNB":[function(e,t,n,l){t.exports=".artplayer-plugin-ads{z-index:150;color:#fff;background-color:#000;width:100%;height:100%;font-size:13px;line-height:1;position:absolute;inset:0;overflow:hidden}.artplayer-plugin-ads .artplayer-plugin-ads-html{justify-content:center;align-items:center;width:100%;height:100%;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:none;position:absolute;top:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-timer>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}"},{}],"6ykb1":[function(e,t,n,l){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})}},{}]},["ezZng"],"ezZng","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.legacy.js b/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.legacy.js index 64bdc1ce8..b4aa38ab2 100644 --- a/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.legacy.js +++ b/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ads.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,n,t,r,l,i,a,o){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof u[r]&&u[r],s=d.i||{},p=d.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(n,t){if(!p[n]){if(!e[n]){if(l[n])return l[n];var i="function"==typeof u[r]&&u[r];if(!t&&i)return i(n,!0);if(d)return d(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}s.resolve=function(t){var r=e[n][1][t];return null!=r?r:t},s.cache={};var o=p[n]=new f.Module(n);e[n][0].call(o.exports,s,o,o.exports,u)}return p[n].exports;function s(e){var n=s.resolve(e);if(!1===n)return{};if(Array.isArray(n)){var t={__esModule:!0};return n.forEach(function(e){var n=e[0],r=e[1],l=e[2]||e[0],i=f(r);"*"===n?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===l?Object.defineProperty(t,n,{enumerable:!0,value:i}):Object.defineProperty(t,n,{enumerable:!0,get:function(){return"default"===l?i.__esModule?i.default:i:i[l]}})}),t}return f(n)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=p,f.parent=d,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(f,"root",{get:function(){return u[r]}}),u[r]=f;for(var y=0;y=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginAds@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"));var t,r,l,a=n.template.$player,o=n.icons,d=o.volume,s=o.volumeClose,p=o.fullscreenOn,c=o.fullscreenOff,f=o.loading,y=n.constructor,g=y.validator,m=y.utils,v=m.query,b=m.append,h=m.setStyle;e=g((0,i._)({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"}},e),{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});var x=null,w=null,j=null,O=null,P=null,_=null,D=0,k=null,M=!1,q=!1,A=!1;function E(e,n){return n.replace("%s",e)}function C(){M=!0,n.play(),e.video&&x.pause(),h(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function T(){M||(k=setTimeout(function(){D+=1;var n=e.playDuration-D;n>=1?j.innerHTML=E(n,e.i18n.canBeClosed):(j.innerHTML=e.i18n.close,A||(A=!0)),O.innerHTML=E(e.totalDuration-D,e.i18n.countdown),D>=e.totalDuration?C():T()},1e3))}function H(){M||clearTimeout(k)}function $(){q||(q=!0,function(){n.template.$ads=b(a,'
'),x=b(n.template.$ads,e.video?''):'
'.concat(e.html,"
")),_=b(n.template.$ads,'
'),b(_,f),j=v(".artplayer-plugin-ads-close",w=b(n.template.$ads,'
\n
'.concat(e.playDuration<=0?e.i18n.close:E(e.playDuration,e.i18n.canBeClosed),'
\n
').concat(E(e.totalDuration,e.i18n.countdown),"
\n
"))),O=v(".artplayer-plugin-ads-countdown",w),e.playDuration>=e.totalDuration&&h(j,"display","none"),n.proxy(j,"click",function(){A&&C()});var t=v(".artplayer-plugin-ads-detail",P=b(n.template.$ads,'
\n
'.concat(e.i18n.detail,'
\n
\n
\n
'))),r=v(".artplayer-plugin-ads-muted",P),l=v(".artplayer-plugin-ads-fullscreen",P);if(e.url?n.proxy(t,"click",function(){window.open(e.url),n.emit("artplayerPluginAds:click",e)}):h(t,"display","none"),e.video){var i=b(r,d),o=b(r,s);h(o,"display","none"),e.muted&&(x.muted=!0,h(i,"display","none"),h(o,"display","inline-flex")),n.proxy(r,"click",function(){x.muted=!x.muted,x.muted?(h(i,"display","none"),h(o,"display","inline-flex")):(h(i,"display","inline-flex"),h(o,"display","none"))})}else h(r,"display","none");var u=b(l,p),y=b(l,c);h(y,"display","none"),n.proxy(l,"click",function(){n.fullscreen=!n.fullscreen,n.fullscreen?(h(u,"display","inline-flex"),h(y,"display","none")):(h(u,"display","none"),h(y,"display","inline-flex"))}),n.proxy(x,"click",function(){e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(x,"error",C),n.proxy(x,"loadedmetadata",function(){T(),x.play(),h(w,"display","flex"),h(P,"display","flex"),h(_,"display","none")})):(T(),h(w,"display","flex"),h(P,"display","flex"),h(_,"display","none")),n.on("document:visibilitychange",function(){document.hidden?H():T()}))}return n.on("ready",function(){n.once("play",$),n.once("video:playing",$)}),{name:"artplayerPluginAds",skip:C,pause:H,play:T}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){var d=document.createElement("style");d.id="artplayer-plugin-ads",d.textContent=o.default,document.head.appendChild(d)}"undefined"!=typeof window&&(window.artplayerPluginAds=u)},{"@swc/helpers/cjs/_object_spread.cjs":"kyoEj","bundle-text:./style.less":"8pNer","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],kyoEj:[function(e,n,t,r){"use strict";var l=e("9f9b8a24218ee51e");t._=function(e){for(var n=1;ndiv{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}"},{}],qpMMf:[function(e,n,t,r){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,n){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:function(){return e[t]}})}),n},t.export=function(e,n,t){Object.defineProperty(e,n,{enumerable:!0,get:t})}},{}]},["1qHWP"],"1qHWP","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,n,t,r,l,i,a,o){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof u[r]&&u[r],p=s.i||{},d=s.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(n,t){if(!d[n]){if(!e[n]){if(l[n])return l[n];var i="function"==typeof u[r]&&u[r];if(!t&&i)return i(n,!0);if(s)return s(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(t){var r=e[n][1][t];return null!=r?r:t},p.cache={};var o=d[n]=new f.Module(n);e[n][0].call(o.exports,p,o,o.exports,u)}return d[n].exports;function p(e){var n=p.resolve(e);if(!1===n)return{};if(Array.isArray(n)){var t={__esModule:!0};return n.forEach(function(e){var n=e[0],r=e[1],l=e[2]||e[0],i=f(r);"*"===n?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===l?Object.defineProperty(t,n,{enumerable:!0,value:i}):Object.defineProperty(t,n,{enumerable:!0,get:function(){return"default"===l?i.__esModule?i.default:i:i[l]}})}),t}return f(n)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=d,f.parent=s,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=p,f.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(f,"root",{get:function(){return u[r]}}),u[r]=f;for(var y=0;ytypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"1qHWP":[function(e,n,t,r){var l=e("@parcel/transformer-js/src/esmodule-helpers.js");l.defineInteropFlag(t),l.export(t,"default",function(){return u});var i=e("@swc/helpers/cjs/_object_spread.cjs"),a=e("bundle-text:./style.less"),o=l.interopDefault(a);function u(e){return function(n){r=(t=n.constructor).version,(0,t.utils.errorHandle)((l=r.split(".").map(Number))[0]+l[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginAds@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"));var t,r,l,a=n.template.$player,o=n.icons,s=o.volume,p=o.volumeClose,d=o.fullscreenOn,c=o.fullscreenOff,f=o.loading,y=n.constructor,g=y.validator,m=y.utils,v=m.query,b=m.append,h=m.setStyle;e=g((0,i._)({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"}},e),{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});var x=null,w=null,j=null,O=null,P=null,_=null,D=0,k=null,M=!1,q=!1,A=!1;function E(e,n){return n.replace("%s",e)}function C(){M=!0,n.play(),e.video&&x.pause(),h(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function T(){M||(k=setTimeout(function(){D+=1;var n=e.playDuration-D;n>=1?j.innerHTML=E(n,e.i18n.canBeClosed):(j.innerHTML=e.i18n.close,A||(A=!0)),O.innerHTML=E(e.totalDuration-D,e.i18n.countdown),D>=e.totalDuration?C():T()},1e3))}function H(){M||clearTimeout(k)}function $(){q||(q=!0,function(){n.template.$ads=b(a,'
'),x=b(n.template.$ads,e.video?''):'
'.concat(e.html,"
")),_=b(n.template.$ads,'
'),b(_,f),j=v(".artplayer-plugin-ads-close",w=b(n.template.$ads,'
\n
'.concat(e.playDuration<=0?e.i18n.close:E(e.playDuration,e.i18n.canBeClosed),'
\n
').concat(E(e.totalDuration,e.i18n.countdown),"
\n
"))),O=v(".artplayer-plugin-ads-countdown",w),e.playDuration>=e.totalDuration&&h(j,"display","none"),n.proxy(j,"click",function(){A&&C()});var t=v(".artplayer-plugin-ads-detail",P=b(n.template.$ads,'
\n
'.concat(e.i18n.detail,'
\n
\n
\n
'))),r=v(".artplayer-plugin-ads-muted",P),l=v(".artplayer-plugin-ads-fullscreen",P);if(e.url?n.proxy(t,"click",function(){window.open(e.url),n.emit("artplayerPluginAds:click",e)}):h(t,"display","none"),e.video){var i=b(r,s),o=b(r,p);h(o,"display","none"),e.muted&&(x.muted=!0,h(i,"display","none"),h(o,"display","inline-flex")),n.proxy(r,"click",function(){x.muted=!x.muted,x.muted?(h(i,"display","none"),h(o,"display","inline-flex")):(h(i,"display","inline-flex"),h(o,"display","none"))})}else h(r,"display","none");var u=b(l,d),y=b(l,c);h(y,"display","none"),n.proxy(l,"click",function(){n.fullscreen=!n.fullscreen,n.fullscreen?(h(u,"display","inline-flex"),h(y,"display","none")):(h(u,"display","none"),h(y,"display","inline-flex"))}),n.proxy(x,"click",function(){e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(x,"error",C),n.proxy(x,"loadedmetadata",function(){T(),x.play(),h(w,"display","flex"),h(P,"display","flex"),h(_,"display","none")})):(T(),h(w,"display","flex"),h(P,"display","flex"),h(_,"display","none")),n.on("document:visibilitychange",function(){document.hidden?H():T()}))}return n.on("ready",function(){n.once("play",$),n.once("video:playing",$)}),{name:"artplayerPluginAds",skip:C,pause:H,play:T}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-ads")){var s=document.createElement("style");s.id="artplayer-plugin-ads",s.textContent=o.default,document.head.appendChild(s)}"u">typeof window&&(window.artplayerPluginAds=u)},{"@swc/helpers/cjs/_object_spread.cjs":"kyoEj","bundle-text:./style.less":"8pNer","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],kyoEj:[function(e,n,t,r){"use strict";var l=e("9f9b8a24218ee51e");t._=function(e){for(var n=1;ndiv{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:rgba(0,0,0,.5);border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;top:0;bottom:0;left:0;right:0}"},{}],qpMMf:[function(e,n,t,r){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,n){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:function(){return e[t]}})}),n},t.export=function(e,n,t){Object.defineProperty(e,n,{enumerable:!0,get:t})}},{}]},["1qHWP"],"1qHWP","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.mjs b/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.mjs index df1c5a205..8f0bf558b 100644 --- a/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.mjs +++ b/packages/artplayer-plugin-ads/dist/artplayer-plugin-ads.mjs @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ads.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,n,t,l,i,r,a,o){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof d[l]&&d[l],p=u.i||{},s=u.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(n,t){if(!s[n]){if(!e[n]){if(i[n])return i[n];var r="function"==typeof d[l]&&d[l];if(!t&&r)return r(n,!0);if(u)return u(n,!0);if(c&&"string"==typeof n)return c(n);var a=Error("Cannot find module '"+n+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(t){var l=e[n][1][t];return null!=l?l:t},p.cache={};var o=s[n]=new f.Module(n);e[n][0].call(o.exports,p,o,o.exports,d)}return s[n].exports;function p(e){var n=p.resolve(e);if(!1===n)return{};if(Array.isArray(n)){var t={__esModule:!0};return n.forEach(function(e){var n=e[0],l=e[1],i=e[2]||e[0],r=f(l);"*"===n?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(t,n,{enumerable:!0,value:r}):Object.defineProperty(t,n,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),t}return f(n)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=s,f.parent=u,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=p,f.register=function(n,t){e[n]=[function(e,n){n.exports=t},{}]},Object.defineProperty(f,"root",{get:function(){return d[l]}}),d[l]=f;for(var y=0;yo);var r=e("bundle-text:./style.less"),a=i.interopDefault(r);function o(e){return n=>{!function(e){let{version:n,utils:{errorHandle:t}}=e.constructor,l=n.split(".").map(Number);t(l[0]+l[1]/100>=5,`Artplayer.js@${n} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`)}(n);let{template:{$player:t},icons:{volume:l,volumeClose:i,fullscreenOn:r,fullscreenOff:a,loading:d},constructor:{validator:u,utils:{query:p,append:s,setStyle:c}}}=n;e=u({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let f=null,y=null,g=null,m=null,v=null,x=null,h=0,b=null,w=!1,j=!1,D=!1;function P(e,n){return n.replace("%s",e)}function O(){w=!0,n.play(),e.video&&f.pause(),c(n.template.$ads,"display","none"),n.emit("artplayerPluginAds:skip",e)}function _(){w||(b=setTimeout(()=>{h+=1;let n=e.playDuration-h;n>=1?g.innerHTML=P(n,e.i18n.canBeClosed):(g.innerHTML=e.i18n.close,D||(D=!0)),m.innerHTML=P(e.totalDuration-h,e.i18n.countdown),h>=e.totalDuration?O():_()},1e3))}function k(){w||clearTimeout(b)}function $(){j||(j=!0,function(){n.template.$ads=s(t,'
'),f=s(n.template.$ads,e.video?``:`
${e.html}
`),x=s(n.template.$ads,'
'),s(x,d),g=p(".artplayer-plugin-ads-close",y=s(n.template.$ads,`
${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}
${P(e.totalDuration,e.i18n.countdown)}
`)),m=p(".artplayer-plugin-ads-countdown",y),e.playDuration>=e.totalDuration&&c(g,"display","none"),n.proxy(g,"click",()=>{D&&O()});let o=p(".artplayer-plugin-ads-detail",v=s(n.template.$ads,`
${e.i18n.detail}
`)),u=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(e.url?n.proxy(o,"click",()=>{window.open(e.url),n.emit("artplayerPluginAds:click",e)}):c(o,"display","none"),e.video){let t=s(u,l),r=s(u,i);c(r,"display","none"),e.muted&&(f.muted=!0,c(t,"display","none"),c(r,"display","inline-flex")),n.proxy(u,"click",()=>{f.muted=!f.muted,f.muted?(c(t,"display","none"),c(r,"display","inline-flex")):(c(t,"display","inline-flex"),c(r,"display","none"))})}else c(u,"display","none");let b=s(h,r),w=s(h,a);c(w,"display","none"),n.proxy(h,"click",()=>{n.fullscreen=!n.fullscreen,n.fullscreen?(c(b,"display","inline-flex"),c(w,"display","none")):(c(b,"display","none"),c(w,"display","inline-flex"))}),n.proxy(f,"click",()=>{e.url&&window.open(e.url),n.emit("artplayerPluginAds:click",e)})}(),n.pause(),e.video?(n.proxy(f,"error",O),n.proxy(f,"loadedmetadata",()=>{_(),f.play(),c(y,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(_(),c(y,"display","flex"),c(v,"display","flex"),c(x,"display","none")),n.on("document:visibilitychange",()=>{document.hidden?k():_()}))}return n.on("ready",()=>{n.once("play",$),n.once("video:playing",$)}),{name:"artplayerPluginAds",skip:O,pause:k,play:_}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-ads")){let e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAds=o)},{"bundle-text:./style.less":"3vq6I","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3vq6I":[function(e,n,t,l){n.exports=".artplayer-plugin-ads{z-index:150;color:#fff;background-color:#000;width:100%;height:100%;font-size:13px;line-height:1;position:absolute;inset:0;overflow:hidden}.artplayer-plugin-ads .artplayer-plugin-ads-html{justify-content:center;align-items:center;width:100%;height:100%;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:none;position:absolute;top:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-timer>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}"},{}],loqXi:[function(e,n,t,l){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,n){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:function(){return e[t]}})}),n},t.export=function(e,n,t){Object.defineProperty(e,n,{enumerable:!0,get:t})}},{}]},["fZ8n3"],"fZ8n3","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("fZ8n3");export{e as default}; \ No newline at end of file +!function(e,t,l,n,i,r,a,o){var d="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},u="function"==typeof d[n]&&d[n],p=u.i||{},s=u.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function y(t,l){if(!s[t]){if(!e[t]){if(i[t])return i[t];var r="function"==typeof d[n]&&d[n];if(!l&&r)return r(t,!0);if(u)return u(t,!0);if(c&&"string"==typeof t)return c(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}p.resolve=function(l){var n=e[t][1][l];return null!=n?n:l},p.cache={};var o=s[t]=new y.Module(t);e[t][0].call(o.exports,p,o,o.exports,d)}return s[t].exports;function p(e){var t=p.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var l={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],i=e[2]||e[0],r=y(n);"*"===t?Object.keys(r).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(l,e)||Object.defineProperty(l,e,{enumerable:!0,get:function(){return r[e]}})}):"*"===i?Object.defineProperty(l,t,{enumerable:!0,value:r}):Object.defineProperty(l,t,{enumerable:!0,get:function(){return"default"===i?r.__esModule?r.default:r:r[i]}})}),l}return y(t)}}y.isParcelRequire=!0,y.Module=function(e){this.id=e,this.bundle=y,this.require=c,this.exports={}},y.modules=e,y.cache=s,y.parent=u,y.distDir=void 0,y.publicUrl=void 0,y.devServer=void 0,y.i=p,y.register=function(t,l){e[t]=[function(e,t){t.exports=l},{}]},Object.defineProperty(y,"root",{get:function(){return d[n]}}),d[n]=y;for(var f=0;ftypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({fZ8n3:[function(e,t,l,n){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(l),i.export(l,"default",()=>o);var r=e("bundle-text:./style.less"),a=i.interopDefault(r);function o(e){return t=>{!function(e){let{version:t,utils:{errorHandle:l}}=e.constructor,n=t.split(".").map(Number);l(n[0]+n[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginAds@${o.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{template:{$player:l},icons:{volume:n,volumeClose:i,fullscreenOn:r,fullscreenOff:a,loading:d},constructor:{validator:u,utils:{query:p,append:s,setStyle:c}}}=t;e=u({html:"",video:"",url:"",playDuration:5,totalDuration:10,muted:!1,i18n:{close:"关闭广告",countdown:"%s秒",detail:"查看详情",canBeClosed:"%s秒后可关闭广告"},...e},{html:"?string",video:"?string",url:"?string",playDuration:"number",totalDuration:"number",muted:"?boolean",i18n:{close:"string",countdown:"string",detail:"string",canBeClosed:"string"}});let y=null,f=null,g=null,m=null,v=null,x=null,h=0,b=null,w=!1,j=!1,D=!1;function P(e,t){return t.replace("%s",e)}function O(){w=!0,t.play(),e.video&&y.pause(),c(t.template.$ads,"display","none"),t.emit("artplayerPluginAds:skip",e)}function _(){w||(b=setTimeout(()=>{h+=1;let t=e.playDuration-h;t>=1?g.innerHTML=P(t,e.i18n.canBeClosed):(g.innerHTML=e.i18n.close,D||(D=!0)),m.innerHTML=P(e.totalDuration-h,e.i18n.countdown),h>=e.totalDuration?O():_()},1e3))}function k(){w||clearTimeout(b)}function $(){j||(j=!0,function(){t.template.$ads=s(l,'
'),y=s(t.template.$ads,e.video?``:`
${e.html}
`),x=s(t.template.$ads,'
'),s(x,d),g=p(".artplayer-plugin-ads-close",f=s(t.template.$ads,`
${e.playDuration<=0?e.i18n.close:P(e.playDuration,e.i18n.canBeClosed)}
${P(e.totalDuration,e.i18n.countdown)}
`)),m=p(".artplayer-plugin-ads-countdown",f),e.playDuration>=e.totalDuration&&c(g,"display","none"),t.proxy(g,"click",()=>{D&&O()});let o=p(".artplayer-plugin-ads-detail",v=s(t.template.$ads,`
${e.i18n.detail}
`)),u=p(".artplayer-plugin-ads-muted",v),h=p(".artplayer-plugin-ads-fullscreen",v);if(e.url?t.proxy(o,"click",()=>{window.open(e.url),t.emit("artplayerPluginAds:click",e)}):c(o,"display","none"),e.video){let l=s(u,n),r=s(u,i);c(r,"display","none"),e.muted&&(y.muted=!0,c(l,"display","none"),c(r,"display","inline-flex")),t.proxy(u,"click",()=>{y.muted=!y.muted,y.muted?(c(l,"display","none"),c(r,"display","inline-flex")):(c(l,"display","inline-flex"),c(r,"display","none"))})}else c(u,"display","none");let b=s(h,r),w=s(h,a);c(w,"display","none"),t.proxy(h,"click",()=>{t.fullscreen=!t.fullscreen,t.fullscreen?(c(b,"display","inline-flex"),c(w,"display","none")):(c(b,"display","none"),c(w,"display","inline-flex"))}),t.proxy(y,"click",()=>{e.url&&window.open(e.url),t.emit("artplayerPluginAds:click",e)})}(),t.pause(),e.video?(t.proxy(y,"error",O),t.proxy(y,"loadedmetadata",()=>{_(),y.play(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")})):(_(),c(f,"display","flex"),c(v,"display","flex"),c(x,"display","none")),t.on("document:visibilitychange",()=>{document.hidden?k():_()}))}return t.on("ready",()=>{t.once("play",$),t.once("video:playing",$)}),{name:"artplayerPluginAds",skip:O,pause:k,play:_}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-ads")){let e=document.createElement("style");e.id="artplayer-plugin-ads",e.textContent=a.default,document.head.appendChild(e)}"u">typeof window&&(window.artplayerPluginAds=o)},{"bundle-text:./style.less":"3vq6I","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3vq6I":[function(e,t,l,n){t.exports=".artplayer-plugin-ads{z-index:150;color:#fff;background-color:#000;width:100%;height:100%;font-size:13px;line-height:1;position:absolute;inset:0;overflow:hidden}.artplayer-plugin-ads .artplayer-plugin-ads-html{justify-content:center;align-items:center;width:100%;height:100%;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-video{width:100%;height:100%}.artplayer-plugin-ads .artplayer-plugin-ads-timer{display:none;position:absolute;top:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-timer>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control{display:none;position:absolute;bottom:10px;right:10px}.artplayer-plugin-ads .artplayer-plugin-ads-control>div{cursor:pointer;background-color:#00000080;border-radius:15px;align-items:center;margin-left:5px;padding:5px 10px;display:flex}.artplayer-plugin-ads .artplayer-plugin-ads-control .art-icon svg{width:20px;height:20px}.artplayer-plugin-ads .artplayer-plugin-ads-loading{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}"},{}],loqXi:[function(e,t,l,n){l.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},l.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},l.exportAll=function(e,t){return Object.keys(e).forEach(function(l){"default"===l||"__esModule"===l||Object.prototype.hasOwnProperty.call(t,l)||Object.defineProperty(t,l,{enumerable:!0,get:function(){return e[l]}})}),t},l.export=function(e,t,l){Object.defineProperty(e,t,{enumerable:!0,get:l})}},{}]},["fZ8n3"],"fZ8n3","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("fZ8n3");export{e as default}; \ No newline at end of file diff --git a/packages/artplayer-plugin-ambilight/dist/artplayer-plugin-ambilight.js b/packages/artplayer-plugin-ambilight/dist/artplayer-plugin-ambilight.js index e6d80065d..ed789c80d 100644 --- a/packages/artplayer-plugin-ambilight/dist/artplayer-plugin-ambilight.js +++ b/packages/artplayer-plugin-ambilight/dist/artplayer-plugin-ambilight.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ambilight.js v1.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,r,t,n,o,i,u,f){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof l[n]&&l[n],d=a.i||{},c=a.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!c[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof l[n]&&l[n];if(!t&&i)return i(r,!0);if(a)return a(r,!0);if(s&&"string"==typeof r)return s(r);var u=Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}d.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},d.cache={};var f=c[r]=new p.Module(r);e[r][0].call(f.exports,d,f,f.exports,l)}return c[r].exports;function d(e){var r=d.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=p(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=a,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return l[n]}}),l[n]=p;for(var y=0;y{var t,n,o,i,u,f,l,a,d,c;let s,p,y,{$video:m}=r.template,{createElement:b,addClass:g,setStyles:h}=r.constructor.utils,{blur:v="50px",opacity:j=.5,frequency:w=10,duration:O=.3}=e,P=b("div"),_=((t=P).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=P,o=m,g(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),h(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=_,u=v,f=j,l=O,i.forEach(e=>{h(e,{opacity:f,filter:`blur(${u})`,transition:`background-color ${l}s ease`})});let x=(a=m,d=_,c=w,p=(s=b("canvas")).getContext("2d"),s.width=3,s.height=3,y=0,function e(){let t=performance.now();if(t-y<1e3/c||!r.playing){A=requestAnimationFrame(e);return}y=t;let n=a.videoWidth/3,o=a.videoHeight/3,i=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(([e,r])=>(function(e,r,t,n){p.drawImage(a,e,r,t,n,0,0,1,1);let[o,i,u]=p.getImageData(0,0,1,1).data;return`rgb(${o}, ${i}, ${u})`})(e,r,n,o));d.forEach((e,r)=>{e.style.backgroundColor=i[r]}),A=requestAnimationFrame(e)}),A=null;function M(){A||x()}function I(){A&&(cancelAnimationFrame(A),A=null)}return r.on("ready",M),r.on("destroy",I),{name:"artplayerPluginAmbilight",start:M,stop:I}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,r,t,n){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})}},{}]},["2PWBI"],"2PWBI","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,r,t,n,o,i,u,l){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof a[n]&&a[n],c=f.i||{},d=f.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof a[n]&&a[n];if(!t&&i)return i(r,!0);if(f)return f(r,!0);if(s&&"string"==typeof r)return s(r);var u=Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}c.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},c.cache={};var l=d[r]=new p.Module(r);e[r][0].call(l.exports,c,l,l.exports,a)}return d[r].exports;function c(e){var r=c.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=p(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=c,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return a[n]}}),a[n]=p;for(var y=0;ytypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"2PWBI":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e={}){return r=>{var t,n,o,i,u,l,a,f,c,d;let s,p,y,{$video:m}=r.template,{createElement:b,addClass:g,setStyles:h}=r.constructor.utils,{blur:v="50px",opacity:j=.5,frequency:w=10,duration:O=.3}=e,P=b("div"),_=((t=P).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=P,o=m,g(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),h(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=_,u=v,l=j,a=O,i.forEach(e=>{h(e,{opacity:l,filter:`blur(${u})`,transition:`background-color ${a}s ease`})});let x=(f=m,c=_,d=w,p=(s=b("canvas")).getContext("2d"),s.width=3,s.height=3,y=0,function e(){let t=performance.now();if(t-y<1e3/d||!r.playing){A=requestAnimationFrame(e);return}y=t;let n=f.videoWidth/3,o=f.videoHeight/3,i=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(([e,r])=>(function(e,r,t,n){p.drawImage(f,e,r,t,n,0,0,1,1);let[o,i,u]=p.getImageData(0,0,1,1).data;return`rgb(${o}, ${i}, ${u})`})(e,r,n,o));c.forEach((e,r)=>{e.style.backgroundColor=i[r]}),A=requestAnimationFrame(e)}),A=null;function M(){A||x()}function I(){A&&(cancelAnimationFrame(A),A=null)}return r.on("ready",M),r.on("destroy",I),{name:"artplayerPluginAmbilight",start:M,stop:I}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"u">typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,r,t,n){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})}},{}]},["2PWBI"],"2PWBI","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-ambilight/dist/artplayer-plugin-ambilight.legacy.js b/packages/artplayer-plugin-ambilight/dist/artplayer-plugin-ambilight.legacy.js index e8b851bc3..d7e771497 100644 --- a/packages/artplayer-plugin-ambilight/dist/artplayer-plugin-ambilight.legacy.js +++ b/packages/artplayer-plugin-ambilight/dist/artplayer-plugin-ambilight.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-ambilight.js v1.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,r,t,n,o,i,a,u){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},c="function"==typeof f[n]&&f[n],l=c.i||{},d=c.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof f[n]&&f[n];if(!t&&i)return i(r,!0);if(c)return c(r,!0);if(s&&"string"==typeof r)return s(r);var a=Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},l.cache={};var u=d[r]=new p.Module(r);e[r][0].call(u.exports,l,u,u.exports,f)}return d[r].exports;function l(e){var r=l.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=p(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=c,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return f[n]}}),f[n]=p;for(var y=0;y0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t,n,o,a,u,f,c,l,d,s,p,y,m,b=r.template.$video,v=r.constructor.utils,h=v.createElement,g=v.addClass,_=v.setStyles,j=e.blur,w=e.opacity,O=e.frequency,A=e.duration,x=h("div"),M=((t=x).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=x,o=b,g(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),_(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),a=M,u=void 0===j?"50px":j,f=void 0===w?.5:w,c=void 0===A?.3:A,a.forEach(function(e){_(e,{opacity:f,filter:"blur(".concat(u,")"),transition:"background-color ".concat(c,"s ease")})});var S=(l=b,d=M,s=void 0===O?10:O,y=(p=h("canvas")).getContext("2d"),p.width=3,p.height=3,m=0,function e(){var t=performance.now();if(t-m<1e3/s||!r.playing){P=requestAnimationFrame(e);return}m=t;var n=l.videoWidth/3,o=l.videoHeight/3,a=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(function(e){var r,t,a,u,f=(0,i._)(e,2),c=f[0],d=f[1];return y.drawImage(l,c,d,n,o,0,0,1,1),t=(r=(0,i._)(y.getImageData(0,0,1,1).data,3))[0],a=r[1],u=r[2],"rgb(".concat(t,", ").concat(a,", ").concat(u,")")});d.forEach(function(e,r){e.style.backgroundColor=a[r]}),P=requestAnimationFrame(e)}),P=null;function q(){P||S()}function I(){P&&(cancelAnimationFrame(P),P=null)}return r.on("ready",q),r.on("destroy",I),{name:"artplayerPluginAmbilight",start:q,stop:I}}}"undefined"!=typeof window&&(window.artplayerPluginAmbilight=a)},{"@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],gIQTH:[function(e,r,t,n){"use strict";var o=e("d7c30a5ae0c1ab2"),i=e("3aacfce52f67defd"),a=e("f0dae09a1a08b16a"),u=e("83f3648e614d0830");t._=function(e,r){return o._(e)||i._(e,r)||u._(e,r)||a._()}},{d7c30a5ae0c1ab2:"3QSPl","3aacfce52f67defd":"5SSeo",f0dae09a1a08b16a:"heYSj","83f3648e614d0830":"fh7mx"}],"3QSPl":[function(e,r,t,n){"use strict";t._=function(e){if(Array.isArray(e))return e}},{}],"5SSeo":[function(e,r,t,n){"use strict";t._=function(e,r){var t,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}},{}],heYSj:[function(e,r,t,n){"use strict";t._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,r,t,n){"use strict";var o=e("3ee51b7dc02d0c44");t._=function(e,r){if(e){if("string"==typeof e)return o._(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o._(e,r)}}},{"3ee51b7dc02d0c44":"1WOAB"}],"1WOAB":[function(e,r,t,n){"use strict";t._=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);ttypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof c[n]&&c[n],l=f.i||{},d=f.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof c[n]&&c[n];if(!t&&i)return i(r,!0);if(f)return f(r,!0);if(s&&"string"==typeof r)return s(r);var a=Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},l.cache={};var u=d[r]=new p.Module(r);e[r][0].call(u.exports,l,u,u.exports,c)}return d[r].exports;function l(e){var r=l.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=p(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return p(r)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(p,"root",{get:function(){return c[n]}}),c[n]=p;for(var y=0;ytypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"8Uro8":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(t),o.export(t,"default",function(){return a});var i=e("@swc/helpers/cjs/_sliced_to_array.cjs");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){var t,n,o,a,u,c,f,l,d,s,p,y,m,b=r.template.$video,v=r.constructor.utils,h=v.createElement,g=v.addClass,_=v.setStyles,j=e.blur,w=e.opacity,O=e.frequency,A=e.duration,x=h("div"),M=((t=x).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=x,o=b,g(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),_(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),a=M,u=void 0===j?"50px":j,c=void 0===w?.5:w,f=void 0===A?.3:A,a.forEach(function(e){_(e,{opacity:c,filter:"blur(".concat(u,")"),transition:"background-color ".concat(f,"s ease")})});var S=(l=b,d=M,s=void 0===O?10:O,y=(p=h("canvas")).getContext("2d"),p.width=3,p.height=3,m=0,function e(){var t=performance.now();if(t-m<1e3/s||!r.playing){P=requestAnimationFrame(e);return}m=t;var n=l.videoWidth/3,o=l.videoHeight/3,a=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(function(e){var r,t,a,u,c=(0,i._)(e,2),f=c[0],d=c[1];return y.drawImage(l,f,d,n,o,0,0,1,1),t=(r=(0,i._)(y.getImageData(0,0,1,1).data,3))[0],a=r[1],u=r[2],"rgb(".concat(t,", ").concat(a,", ").concat(u,")")});d.forEach(function(e,r){e.style.backgroundColor=a[r]}),P=requestAnimationFrame(e)}),P=null;function q(){P||S()}function I(){P&&(cancelAnimationFrame(P),P=null)}return r.on("ready",q),r.on("destroy",I),{name:"artplayerPluginAmbilight",start:q,stop:I}}}"u">typeof window&&(window.artplayerPluginAmbilight=a)},{"@swc/helpers/cjs/_sliced_to_array.cjs":"gIQTH","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],gIQTH:[function(e,r,t,n){"use strict";var o=e("d7c30a5ae0c1ab2"),i=e("3aacfce52f67defd"),a=e("f0dae09a1a08b16a"),u=e("83f3648e614d0830");t._=function(e,r){return o._(e)||i._(e,r)||u._(e,r)||a._()}},{d7c30a5ae0c1ab2:"3QSPl","3aacfce52f67defd":"5SSeo",f0dae09a1a08b16a:"heYSj","83f3648e614d0830":"fh7mx"}],"3QSPl":[function(e,r,t,n){"use strict";t._=function(e){if(Array.isArray(e))return e}},{}],"5SSeo":[function(e,r,t,n){"use strict";t._=function(e,r){var t,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],a=!0,u=!1;try{for(o=o.call(e);!(a=(t=o.next()).done)&&(i.push(t.value),!r||i.length!==r);a=!0);}catch(e){u=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(u)throw n}}return i}}},{}],heYSj:[function(e,r,t,n){"use strict";t._=function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},{}],fh7mx:[function(e,r,t,n){"use strict";var o=e("3ee51b7dc02d0c44");t._=function(e,r){if(e){if("string"==typeof e)return o._(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return o._(e,r)}}},{"3ee51b7dc02d0c44":"1WOAB"}],"1WOAB":[function(e,r,t,n){"use strict";t._=function(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=Array(r);t{var t,n,o,i,u,l,f,a,d,c;let p,s,m,{$video:y}=r.template,{createElement:g,addClass:b,setStyles:h}=r.constructor.utils,{blur:v="50px",opacity:j=.5,frequency:w=10,duration:O=.3}=e,_=g("div"),x=((t=_).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=_,o=y,b(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),h(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=x,u=v,l=j,f=O,i.forEach(e=>{h(e,{opacity:l,filter:`blur(${u})`,transition:`background-color ${f}s ease`})});let P=(a=y,d=x,c=w,s=(p=g("canvas")).getContext("2d"),p.width=3,p.height=3,m=0,function e(){let t=performance.now();if(t-m<1e3/c||!r.playing){q=requestAnimationFrame(e);return}m=t;let n=a.videoWidth/3,o=a.videoHeight/3,i=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(([e,r])=>(function(e,r,t,n){s.drawImage(a,e,r,t,n,0,0,1,1);let[o,i,u]=s.getImageData(0,0,1,1).data;return`rgb(${o}, ${i}, ${u})`})(e,r,n,o));d.forEach((e,r)=>{e.style.backgroundColor=i[r]}),q=requestAnimationFrame(e)}),q=null;function A(){q||P()}function F(){q&&(cancelAnimationFrame(q),q=null)}return r.on("ready",A),r.on("destroy",F),{name:"artplayerPluginAmbilight",start:A,stop:F}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,r,t,n){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})}},{}]},["4BFTD"],"4BFTD","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("4BFTD");export{e as default}; \ No newline at end of file +!function(e,r,t,n,o,i,u,l){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof a[n]&&a[n],c=f.i||{},d=f.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(r,t){if(!d[r]){if(!e[r]){if(o[r])return o[r];var i="function"==typeof a[n]&&a[n];if(!t&&i)return i(r,!0);if(f)return f(r,!0);if(p&&"string"==typeof r)return p(r);var u=Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}c.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},c.cache={};var l=d[r]=new s.Module(r);e[r][0].call(l.exports,c,l,l.exports,a)}return d[r].exports;function c(e){var r=c.resolve(e);if(!1===r)return{};if(Array.isArray(r)){var t={__esModule:!0};return r.forEach(function(e){var r=e[0],n=e[1],o=e[2]||e[0],i=s(n);"*"===r?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(t,r,{enumerable:!0,value:i}):Object.defineProperty(t,r,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),t}return s(r)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.require=p,this.exports={}},s.modules=e,s.cache=d,s.parent=f,s.distDir=void 0,s.publicUrl=void 0,s.devServer=void 0,s.i=c,s.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(s,"root",{get:function(){return a[n]}}),a[n]=s;for(var m=0;mtypeof module?module.exports=y:"function"==typeof define&&define.amd&&define(function(){return y})}}({"4BFTD":[function(e,r,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");function i(e={}){return r=>{var t,n,o,i,u,l,a,f,c,d;let p,s,m,{$video:y}=r.template,{createElement:g,addClass:b,setStyles:h}=r.constructor.utils,{blur:v="50px",opacity:j=.5,frequency:w=10,duration:O=.3}=e,_=g("div"),x=((t=_).innerHTML=Array.from({length:9}).fill("
").join(""),Array.from(t.children));n=_,o=y,b(n,"artplayer-plugin-ambilight"),o.parentNode.insertBefore(n,o),h(n,{position:"absolute",top:0,left:0,zIndex:9,inset:0,display:"grid",gridTemplateColumns:"1fr 1fr 1fr",gridTemplateRows:"1fr 1fr 1fr"}),i=x,u=v,l=j,a=O,i.forEach(e=>{h(e,{opacity:l,filter:`blur(${u})`,transition:`background-color ${a}s ease`})});let P=(f=y,c=x,d=w,s=(p=g("canvas")).getContext("2d"),p.width=3,p.height=3,m=0,function e(){let t=performance.now();if(t-m<1e3/d||!r.playing){q=requestAnimationFrame(e);return}m=t;let n=f.videoWidth/3,o=f.videoHeight/3,i=[[0,0],[n,0],[2*n,0],[0,o],[n,o],[2*n,o],[0,2*o],[n,2*o],[2*n,2*o]].map(([e,r])=>(function(e,r,t,n){s.drawImage(f,e,r,t,n,0,0,1,1);let[o,i,u]=s.getImageData(0,0,1,1).data;return`rgb(${o}, ${i}, ${u})`})(e,r,n,o));c.forEach((e,r)=>{e.style.backgroundColor=i[r]}),q=requestAnimationFrame(e)}),q=null;function A(){q||P()}function F(){q&&(cancelAnimationFrame(q),q=null)}return r.on("ready",A),r.on("destroy",F),{name:"artplayerPluginAmbilight",start:A,stop:F}}}o.defineInteropFlag(t),o.export(t,"default",()=>i),"u">typeof window&&(window.artplayerPluginAmbilight=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,r,t,n){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})}},{}]},["4BFTD"],"4BFTD","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("4BFTD");export{e as default}; \ No newline at end of file diff --git a/packages/artplayer-plugin-asr/dist/artplayer-plugin-asr.js b/packages/artplayer-plugin-asr/dist/artplayer-plugin-asr.js index 3e146296b..7683a0741 100644 --- a/packages/artplayer-plugin-asr/dist/artplayer-plugin-asr.js +++ b/packages/artplayer-plugin-asr/dist/artplayer-plugin-asr.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-asr.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o,a,i,l){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof u[n]&&u[n],c=s.i||{},d=s.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!d[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof u[n]&&u[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var l=d[t]=new f.Module(t);e[t][0].call(l.exports,c,l,l.exports,u)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],a=f(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),r}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=d,f.parent=s,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return u[n]}}),u[n]=f;for(var y=0;yl);var a=e("bundle-text:./style.less"),i=o.interopDefault(a);function l(e={}){let{length:t=3,interval:r=100,sampleRate:n=16e3,autoHideTimeout:o=1e4,onAudioChunk:a=()=>null}=e;return e=>{let i=!1,l=null,u=null,s=null,c=null,d=[],p=null,f=!1,y=null,b=null,m=null,g=e.layers.add({name:"asr",html:""});function v(){g.style.display="none"}function h(e){"string"==typeof e&&(clearTimeout(y),y=setTimeout(v,o),g.style.display="",g.innerHTML=e.split(/(?<=[、。!?!?.])\s*/u).map(e=>e.trim()).filter(Boolean).slice(-t).map(e=>`
${e}
`).join(""))}let w=` class RecorderProcessor extends AudioWorkletProcessor { process(inputs) { const input = inputs[0]; if (input && input[0]) { this.port.postMessage(input[0]); } return true; } } registerProcessor('recorder-processor', RecorderProcessor); `;async function x(){return l||"suspended"===(l=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n})).state&&await l.resume(),l}async function A(){if(!u&&e.video)try{return u=l.createMediaElementSource(e.video)}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(b||(b=await j(e.video)),b)return m=l.createMediaStreamSource(b)}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function j(e){try{if(e.captureStream)return e.captureStream();if(e.mozCaptureStream)return e.mozCaptureStream();return console.warn("[artplayerPluginAsr] captureStream not supported"),null}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}async function P(){if(!i)try{await x();let e=await A();if(!e)throw Error("Could not establish audio source");if(!f){let e,t=(e=new Blob([w],{type:"application/javascript"}),URL.createObjectURL(e));await l.audioWorklet.addModule(t),URL.revokeObjectURL(t),f=!0}(c=l.createGain()).gain.value=1,(s=new AudioWorkletNode(l,"recorder-processor")).port.onmessage=e=>{d.push(new Float32Array(e.data))},e.connect(s),e.connect(c),c.connect(l.destination);let t=r/1e3*n;p=setInterval(async()=>{let e,r,o,i;if(0===d.length)return;let l=new Float32Array(0);for(;l.length{for(let r=0;re.stop()),b=null),l&&(await l.close(),l=null),f=!1}return e.on("video:volumechange",()=>{c&&(c.gain.value=e.volume)}),e.on("play",P),e.on("pause",M),e.on("destroy",U),{name:"artplayerPluginAsr",stop:U,hide:v,append:h}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-asr")){let e=document.createElement("style");e.id="artplayer-plugin-asr",e.textContent=i.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAsr=l)},{"bundle-text:./style.less":"gfAut","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],gfAut:[function(e,t,r,n){t.exports=".art-video-player .art-layer-asr{z-index:150;justify-content:end;gap:var(--art-subtitle-gap);padding:0 2%;padding-bottom:var(--art-subtitle-bottom);transition:padding-bottom var(--art-transition-duration)ease;text-shadow:var(--art-subtitle-border)1px 0 1px,var(--art-subtitle-border)0 1px 1px,var(--art-subtitle-border)-1px 0 1px,var(--art-subtitle-border)0 -1px 1px,var(--art-subtitle-border)1px 1px 1px,var(--art-subtitle-border)-1px -1px 1px,var(--art-subtitle-border)1px -1px 1px,var(--art-subtitle-border)-1px 1px 1px;flex-direction:column;font-size:1rem;display:flex;position:absolute;inset:0;pointer-events:none!important}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}"},{}],"6ykb1":[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["1gnQM"],"1gnQM","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,r,n,o,a,i,l){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof u[n]&&u[n],c=s.i||{},d=s.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!d[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof u[n]&&u[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var l=d[t]=new f.Module(t);e[t][0].call(l.exports,c,l,l.exports,u)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],a=f(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),r}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=d,f.parent=s,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return u[n]}}),u[n]=f;for(var y=0;ytypeof module?module.exports=b:"function"==typeof define&&define.amd&&define(function(){return b})}}({"1gnQM":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",()=>l);var a=e("bundle-text:./style.less"),i=o.interopDefault(a);function l(e={}){let{length:t=3,interval:r=100,sampleRate:n=16e3,autoHideTimeout:o=1e4,onAudioChunk:a=()=>null}=e;return e=>{let i=!1,l=null,u=null,s=null,c=null,d=[],p=null,f=!1,y=null,b=null,m=null,g=e.layers.add({name:"asr",html:""});function v(){g.style.display="none"}function h(e){"string"==typeof e&&(clearTimeout(y),y=setTimeout(v,o),g.style.display="",g.innerHTML=e.split(/(?<=[、。!?!?.])\s*/u).map(e=>e.trim()).filter(Boolean).slice(-t).map(e=>`
${e}
`).join(""))}let w=` class RecorderProcessor extends AudioWorkletProcessor { process(inputs) { const input = inputs[0]; if (input && input[0]) { this.port.postMessage(input[0]); } return true; } } registerProcessor('recorder-processor', RecorderProcessor); `;async function x(){return l||"suspended"===(l=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n})).state&&await l.resume(),l}async function A(){if(!u&&e.video)try{return u=l.createMediaElementSource(e.video)}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(b||(b=await j(e.video)),b)return m=l.createMediaStreamSource(b)}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function j(e){try{if(e.captureStream)return e.captureStream();if(e.mozCaptureStream)return e.mozCaptureStream();return console.warn("[artplayerPluginAsr] captureStream not supported"),null}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}async function P(){if(!i)try{await x();let e=await A();if(!e)throw Error("Could not establish audio source");if(!f){let e,t=(e=new Blob([w],{type:"application/javascript"}),URL.createObjectURL(e));await l.audioWorklet.addModule(t),URL.revokeObjectURL(t),f=!0}(c=l.createGain()).gain.value=1,(s=new AudioWorkletNode(l,"recorder-processor")).port.onmessage=e=>{d.push(new Float32Array(e.data))},e.connect(s),e.connect(c),c.connect(l.destination);let t=r/1e3*n;p=setInterval(async()=>{let e,r,o,i;if(0===d.length)return;let l=new Float32Array(0);for(;l.length{for(let r=0;re.stop()),b=null),l&&(await l.close(),l=null),f=!1}return e.on("video:volumechange",()=>{c&&(c.gain.value=e.volume)}),e.on("play",P),e.on("pause",M),e.on("destroy",U),{name:"artplayerPluginAsr",stop:U,hide:v,append:h}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-asr")){let e=document.createElement("style");e.id="artplayer-plugin-asr",e.textContent=i.default,document.head.appendChild(e)}"u">typeof window&&(window.artplayerPluginAsr=l)},{"bundle-text:./style.less":"gfAut","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],gfAut:[function(e,t,r,n){t.exports=".art-video-player .art-layer-asr{z-index:150;justify-content:end;gap:var(--art-subtitle-gap);padding:0 2%;padding-bottom:var(--art-subtitle-bottom);transition:padding-bottom var(--art-transition-duration)ease;text-shadow:var(--art-subtitle-border)1px 0 1px,var(--art-subtitle-border)0 1px 1px,var(--art-subtitle-border)-1px 0 1px,var(--art-subtitle-border)0 -1px 1px,var(--art-subtitle-border)1px 1px 1px,var(--art-subtitle-border)-1px -1px 1px,var(--art-subtitle-border)1px -1px 1px,var(--art-subtitle-border)-1px 1px 1px;flex-direction:column;font-size:1rem;display:flex;position:absolute;inset:0;pointer-events:none!important}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}"},{}],"6ykb1":[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["1gnQM"],"1gnQM","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-asr/dist/artplayer-plugin-asr.legacy.js b/packages/artplayer-plugin-asr/dist/artplayer-plugin-asr.legacy.js index e9b573dac..5ca9f8856 100644 --- a/packages/artplayer-plugin-asr/dist/artplayer-plugin-asr.legacy.js +++ b/packages/artplayer-plugin-asr/dist/artplayer-plugin-asr.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-asr.js v2.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o,i,a,u){var c="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof c[n]&&c[n],l=s.i||{},f=s.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof c[n]&&c[n];if(!r&&i)return i(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},l.cache={};var u=f[t]=new d.Module(t);e[t][0].call(u.exports,l,u,u.exports,c)}return f[t].exports;function l(e){var t=l.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],i=d(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=f,d.parent=s,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 y=0;y0&&void 0!==arguments[0]?arguments[0]:{},t=e.length,r=void 0===t?3:t,n=e.interval,o=void 0===n?100:n,u=e.sampleRate,c=void 0===u?16e3:u,s=e.autoHideTimeout,l=void 0===s?1e4:s,f=e.onAudioChunk,p=void 0===f?function(){return null}:f;return function(e){var t=!1,n=null,u=null,s=null,f=null,d=[],y=null,_=!1,h=null,v=null,b=null,m=e.layers.add({name:"asr",html:""});function w(){m.style.display="none"}function g(e){"string"==typeof e&&(clearTimeout(h),h=setTimeout(w,l),m.style.display="",m.innerHTML=e.split(RegExp("(?<=[、。!?!?.])\\s*","u")).map(function(e){return e.trim()}).filter(Boolean).slice(-r).map(function(e){return'
'.concat(e,"
")}).join(""))}var x=function(){var e=new Blob(["\n class RecorderProcessor extends AudioWorkletProcessor {\n process(inputs) {\n const input = inputs[0];\n if (input && input[0]) {\n this.port.postMessage(input[0]);\n }\n return true;\n }\n }\n registerProcessor('recorder-processor', RecorderProcessor);\n "],{type:"application/javascript"});return URL.createObjectURL(e)};function j(){return(0,i._)(function(){return(0,a._)(this,function(e){return t&&(t=!1,clearInterval(y),y=null,s&&(s.disconnect(),s.port.onmessage=null,s=null),f&&(f.disconnect(),f=null),d=[]),[2]})})()}function O(){return(0,i._)(function(){return(0,a._)(this,function(e){switch(e.label){case 0:return[4,j()];case 1:if(e.sent(),b&&(b.disconnect(),b=null),u&&(u.disconnect(),u=null),v&&(v.getTracks().forEach(function(e){return e.stop()}),v=null),!n)return[3,3];return[4,n.close()];case 2:e.sent(),n=null,e.label=3;case 3:return _=!1,[2]}})})()}return e.on("video:volumechange",function(){f&&(f.gain.value=e.volume)}),e.on("play",function(){return(0,i._)(function(){var r,l,h;return(0,a._)(this,function(m){switch(m.label){case 0:if(t)return[2];m.label=1;case 1:return m.trys.push([1,6,,8]),[4,(0,i._)(function(){return(0,a._)(this,function(e){switch(e.label){case 0:if(n)return[2,n];if("suspended"!==(n=new(window.AudioContext||window.webkitAudioContext)({sampleRate:c})).state)return[3,2];return[4,n.resume()];case 1:e.sent(),e.label=2;case 2:return[2,n]}})})()];case 2:return m.sent(),[4,(0,i._)(function(){return(0,a._)(this,function(t){switch(t.label){case 0:if(!u&&e.video)try{return u=n.createMediaElementSource(e.video),[2,u]}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}t.label=1;case 1:var r;if(t.trys.push([1,4,,5]),v)return[3,3];return[4,(r=e.video,(0,i._)(function(){return(0,a._)(this,function(e){try{if(r.captureStream)return[2,r.captureStream()];if(r.mozCaptureStream)return[2,r.mozCaptureStream()];return console.warn("[artplayerPluginAsr] captureStream not supported"),[2,null]}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),[2,null]}})})())];case 2:v=t.sent(),t.label=3;case 3:if(v)return[2,b=n.createMediaStreamSource(v)];return[3,5];case 4:return console.warn("[artplayerPluginAsr] MediaStream fallback failed:",t.sent()),[3,5];case 5:return[2,null]}})})()];case 3:if(!(r=m.sent()))throw Error("Could not establish audio source");if(_)return[3,5];return l=x(),[4,n.audioWorklet.addModule(l)];case 4:m.sent(),URL.revokeObjectURL(l),_=!0,m.label=5;case 5:return(f=n.createGain()).gain.value=1,(s=new AudioWorkletNode(n,"recorder-processor")).port.onmessage=function(e){d.push(new Float32Array(e.data))},r.connect(s),r.connect(f),f.connect(n.destination),h=o/1e3*c,y=setInterval(function(){return(0,i._)(function(){var e,t,r,n;return(0,a._)(this,function(o){switch(o.label){case 0:var i,a,u,s,l;if(0===d.length)return[2];for(e=new Float32Array(0);e.lengtht.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function l(e,t,r,n){var o,a=arguments.length,u=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(u=(a<3?o(u):a>3?o(t,r,u):o(t,r))||u);return a>3&&u&&Object.defineProperty(t,r,u),u}function f(e,t){return function(r,n){t(r,n,e)}}function p(e,t,r,n,o,a){function u(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var c,s=n.kind,l="getter"===s?"get":"setter"===s?"set":"value",f=!t&&e?n.static?e:e.prototype:null,p=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),d=!1,y=r.length-1;y>=0;y--){var _={};for(var h in n)_[h]="access"===h?{}:n[h];for(var h in n.access)_.access[h]=n.access[h];_.addInitializer=function(e){if(d)throw TypeError("Cannot add initializers after decoration has completed");a.push(u(e||null))};var v=(0,r[y])("accessor"===s?{get:p.get,set:p.set}:p[l],_);if("accessor"===s){if(void 0===v)continue;if(null===v||(void 0===v?"undefined":(0,i._)(v))!=="object")throw TypeError("Object expected");(c=u(v.get))&&(p.get=c),(c=u(v.set))&&(p.set=c),(c=u(v.init))&&o.unshift(c)}else(c=u(v))&&("field"===s?o.unshift(c):p[l]=c)}f&&Object.defineProperty(f,n.name,p),d=!0}function d(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function j(){for(var e=[],t=0;t1||u(e,t)})},t&&(n[e]=t(n[e])))}function u(e,t){try{var r;(r=o[e](t)).value instanceof S?Promise.resolve(r.value.v).then(c,s):l(i[0][2],r)}catch(e){l(i[0][3],e)}}function c(e){u("next",e)}function s(e){u("throw",e)}function l(e,t){e(t),i.shift(),i.length&&u(i[0][0],i[0][1])}}function A(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:S(e[n](t)),done:!1}:o?o(t):t}:o}}function I(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=g(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){var i,a,u;i=n,a=o,u=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:u})},a)})}}}function R(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var T=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},M=function(e){return(M=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function D(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=M(e),n=0;ntypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof l[n]&&l[n],c=s.i||{},f=s.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof l[n]&&l[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var u=Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var i=f[t]=new d.Module(t);e[t][0].call(i.exports,c,i,i.exports,l)}return f[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],a=d(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=f,d.parent=s,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=c,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return l[n]}}),l[n]=d;for(var b=0;btypeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"98QZN":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return s});var a=e("@swc/helpers/cjs/_async_to_generator.cjs"),u=e("@swc/helpers/cjs/_ts_generator.cjs"),i=e("bundle-text:./style.less"),l=o.interopDefault(i);function s(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.length,r=void 0===t?3:t,n=e.interval,o=void 0===n?100:n,i=e.sampleRate,l=void 0===i?16e3:i,s=e.autoHideTimeout,c=void 0===s?1e4:s,f=e.onAudioChunk,p=void 0===f?function(){return null}:f;return function(e){var t=!1,n=null,i=null,s=null,f=null,d=[],b=null,h=!1,v=null,y=null,m=null,g=e.layers.add({name:"asr",html:""});function w(){g.style.display="none"}function x(e){"string"==typeof e&&(clearTimeout(v),v=setTimeout(w,c),g.style.display="",g.innerHTML=e.split(RegExp("(?<=[、。!?!?.])\\s*","u")).map(function(e){return e.trim()}).filter(Boolean).slice(-r).map(function(e){return'
'.concat(e,"
")}).join(""))}var _=function(){var e=new Blob(["\n class RecorderProcessor extends AudioWorkletProcessor {\n process(inputs) {\n const input = inputs[0];\n if (input && input[0]) {\n this.port.postMessage(input[0]);\n }\n return true;\n }\n }\n registerProcessor('recorder-processor', RecorderProcessor);\n "],{type:"application/javascript"});return URL.createObjectURL(e)};function j(){return(0,a._)(function(){return(0,u._)(this,function(e){return t&&(t=!1,clearInterval(b),b=null,s&&(s.disconnect(),s.port.onmessage=null,s=null),f&&(f.disconnect(),f=null),d=[]),[2]})})()}function A(){return(0,a._)(function(){return(0,u._)(this,function(e){switch(e.label){case 0:return[4,j()];case 1:if(e.sent(),m&&(m.disconnect(),m=null),i&&(i.disconnect(),i=null),y&&(y.getTracks().forEach(function(e){return e.stop()}),y=null),!n)return[3,3];return[4,n.close()];case 2:e.sent(),n=null,e.label=3;case 3:return h=!1,[2]}})})()}return e.on("video:volumechange",function(){f&&(f.gain.value=e.volume)}),e.on("play",function(){return(0,a._)(function(){var r,c,v;return(0,u._)(this,function(g){switch(g.label){case 0:if(t)return[2];g.label=1;case 1:return g.trys.push([1,6,,8]),[4,(0,a._)(function(){return(0,u._)(this,function(e){switch(e.label){case 0:if(n)return[2,n];if("suspended"!==(n=new(window.AudioContext||window.webkitAudioContext)({sampleRate:l})).state)return[3,2];return[4,n.resume()];case 1:e.sent(),e.label=2;case 2:return[2,n]}})})()];case 2:return g.sent(),[4,(0,a._)(function(){return(0,u._)(this,function(t){switch(t.label){case 0:if(!i&&e.video)try{return i=n.createMediaElementSource(e.video),[2,i]}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}t.label=1;case 1:var r;if(t.trys.push([1,4,,5]),y)return[3,3];return[4,(r=e.video,(0,a._)(function(){return(0,u._)(this,function(e){try{if(r.captureStream)return[2,r.captureStream()];if(r.mozCaptureStream)return[2,r.mozCaptureStream()];return console.warn("[artplayerPluginAsr] captureStream not supported"),[2,null]}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),[2,null]}})})())];case 2:y=t.sent(),t.label=3;case 3:if(y)return[2,m=n.createMediaStreamSource(y)];return[3,5];case 4:return console.warn("[artplayerPluginAsr] MediaStream fallback failed:",t.sent()),[3,5];case 5:return[2,null]}})})()];case 3:if(!(r=g.sent()))throw Error("Could not establish audio source");if(h)return[3,5];return c=_(),[4,n.audioWorklet.addModule(c)];case 4:g.sent(),URL.revokeObjectURL(c),h=!0,g.label=5;case 5:return(f=n.createGain()).gain.value=1,(s=new AudioWorkletNode(n,"recorder-processor")).port.onmessage=function(e){d.push(new Float32Array(e.data))},r.connect(s),r.connect(f),f.connect(n.destination),v=o/1e3*l,b=setInterval(function(){return(0,a._)(function(){var e,t,r,n;return(0,u._)(this,function(o){switch(o.label){case 0:var a,u,i,s,c;if(0===d.length)return[2];for(e=new Float32Array(0);e.lengthtypeof document&&!document.getElementById("artplayer-plugin-asr")){var c=document.createElement("style");c.id="artplayer-plugin-asr",c.textContent=l.default,document.head.appendChild(c)}"u">typeof window&&(window.artplayerPluginAsr=s)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","bundle-text:./style.less":"gKjNi","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,a,u){try{var i=e[a](u),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var u=e.apply(t,r);function i(e){o(u,n,a,i,l,"next",e)}function l(e){o(u,n,a,i,l,"throw",e)}i(void 0)})}}},{}],eltGh:[function(e,t,r,n){"use strict";r._=function(e,t){var r,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},u=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(u,"next",{value:l(0)}),i(u,"throw",{value:l(1)}),i(u,"return",{value:l(2)}),"function"==typeof Symbol&&i(u,Symbol.iterator,{value:function(){return this}}),u;function l(i){return function(l){var s=[i,l];if(r)throw TypeError("Generator is already executing.");for(;u&&(u=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===s[0]||2===s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]l);var a=e("bundle-text:./style.less"),i=o.interopDefault(a);function l(e={}){let{length:t=3,interval:r=100,sampleRate:n=16e3,autoHideTimeout:o=1e4,onAudioChunk:a=()=>null}=e;return e=>{let i=!1,l=null,u=null,s=null,c=null,d=[],p=null,f=!1,y=null,m=null,b=null,g=e.layers.add({name:"asr",html:""});function v(){g.style.display="none"}function h(e){"string"==typeof e&&(clearTimeout(y),y=setTimeout(v,o),g.style.display="",g.innerHTML=e.split(/(?<=[、。!?!?.])\s*/u).map(e=>e.trim()).filter(Boolean).slice(-t).map(e=>`
${e}
`).join(""))}let w=` class RecorderProcessor extends AudioWorkletProcessor { process(inputs) { const input = inputs[0]; if (input && input[0]) { this.port.postMessage(input[0]); } return true; } } registerProcessor('recorder-processor', RecorderProcessor); `;async function x(){return l||"suspended"===(l=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n})).state&&await l.resume(),l}async function j(){if(!u&&e.video)try{return u=l.createMediaElementSource(e.video)}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(m||(m=await A(e.video)),m)return b=l.createMediaStreamSource(m)}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function A(e){try{if(e.captureStream)return e.captureStream();if(e.mozCaptureStream)return e.mozCaptureStream();return console.warn("[artplayerPluginAsr] captureStream not supported"),null}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}async function P(){if(!i)try{await x();let e=await j();if(!e)throw Error("Could not establish audio source");if(!f){let e,t=(e=new Blob([w],{type:"application/javascript"}),URL.createObjectURL(e));await l.audioWorklet.addModule(t),URL.revokeObjectURL(t),f=!0}(c=l.createGain()).gain.value=1,(s=new AudioWorkletNode(l,"recorder-processor")).port.onmessage=e=>{d.push(new Float32Array(e.data))},e.connect(s),e.connect(c),c.connect(l.destination);let t=r/1e3*n;p=setInterval(async()=>{let e,r,o,i;if(0===d.length)return;let l=new Float32Array(0);for(;l.length{for(let r=0;re.stop()),m=null),l&&(await l.close(),l=null),f=!1}return e.on("video:volumechange",()=>{c&&(c.gain.value=e.volume)}),e.on("play",P),e.on("pause",U),e.on("destroy",O),{name:"artplayerPluginAsr",stop:O,hide:v,append:h}}}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-asr")){let e=document.createElement("style");e.id="artplayer-plugin-asr",e.textContent=i.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginAsr=l)},{"bundle-text:./style.less":"27Ck2","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"27Ck2":[function(e,t,r,n){t.exports=".art-video-player .art-layer-asr{z-index:150;justify-content:end;gap:var(--art-subtitle-gap);padding:0 2%;padding-bottom:var(--art-subtitle-bottom);transition:padding-bottom var(--art-transition-duration)ease;text-shadow:var(--art-subtitle-border)1px 0 1px,var(--art-subtitle-border)0 1px 1px,var(--art-subtitle-border)-1px 0 1px,var(--art-subtitle-border)0 -1px 1px,var(--art-subtitle-border)1px 1px 1px,var(--art-subtitle-border)-1px -1px 1px,var(--art-subtitle-border)1px -1px 1px,var(--art-subtitle-border)-1px 1px 1px;flex-direction:column;font-size:1rem;display:flex;position:absolute;inset:0;pointer-events:none!important}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}"},{}],loqXi:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["ejGkt"],"ejGkt","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("ejGkt");export{e as default}; \ No newline at end of file +!function(e,t,r,n,o,a,l,i){var u="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},s="function"==typeof u[n]&&u[n],c=s.i||{},d=s.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!d[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof u[n]&&u[n];if(!r&&a)return a(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var i=d[t]=new f.Module(t);e[t][0].call(i.exports,c,i,i.exports,u)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],a=f(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),r}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=d,f.parent=s,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=c,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return u[n]}}),u[n]=f;for(var y=0;ytypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({ejGkt:[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",()=>i);var a=e("bundle-text:./style.less"),l=o.interopDefault(a);function i(e={}){let{length:t=3,interval:r=100,sampleRate:n=16e3,autoHideTimeout:o=1e4,onAudioChunk:a=()=>null}=e;return e=>{let l=!1,i=null,u=null,s=null,c=null,d=[],p=null,f=!1,y=null,m=null,b=null,g=e.layers.add({name:"asr",html:""});function v(){g.style.display="none"}function h(e){"string"==typeof e&&(clearTimeout(y),y=setTimeout(v,o),g.style.display="",g.innerHTML=e.split(/(?<=[、。!?!?.])\s*/u).map(e=>e.trim()).filter(Boolean).slice(-t).map(e=>`
${e}
`).join(""))}let w=` class RecorderProcessor extends AudioWorkletProcessor { process(inputs) { const input = inputs[0]; if (input && input[0]) { this.port.postMessage(input[0]); } return true; } } registerProcessor('recorder-processor', RecorderProcessor); `;async function x(){return i||"suspended"===(i=new(window.AudioContext||window.webkitAudioContext)({sampleRate:n})).state&&await i.resume(),i}async function j(){if(!u&&e.video)try{return u=i.createMediaElementSource(e.video)}catch(e){console.warn("[artplayerPluginAsr] Direct connection failed:",e)}try{if(m||(m=await A(e.video)),m)return b=i.createMediaStreamSource(m)}catch(e){console.warn("[artplayerPluginAsr] MediaStream fallback failed:",e)}return null}async function A(e){try{if(e.captureStream)return e.captureStream();if(e.mozCaptureStream)return e.mozCaptureStream();return console.warn("[artplayerPluginAsr] captureStream not supported"),null}catch(e){return console.warn("[artplayerPluginAsr] Error capturing stream:",e),null}}async function P(){if(!l)try{await x();let e=await j();if(!e)throw Error("Could not establish audio source");if(!f){let e,t=(e=new Blob([w],{type:"application/javascript"}),URL.createObjectURL(e));await i.audioWorklet.addModule(t),URL.revokeObjectURL(t),f=!0}(c=i.createGain()).gain.value=1,(s=new AudioWorkletNode(i,"recorder-processor")).port.onmessage=e=>{d.push(new Float32Array(e.data))},e.connect(s),e.connect(c),c.connect(i.destination);let t=r/1e3*n;p=setInterval(async()=>{let e,r,o,l;if(0===d.length)return;let i=new Float32Array(0);for(;i.length{for(let r=0;re.stop()),m=null),i&&(await i.close(),i=null),f=!1}return e.on("video:volumechange",()=>{c&&(c.gain.value=e.volume)}),e.on("play",P),e.on("pause",U),e.on("destroy",O),{name:"artplayerPluginAsr",stop:O,hide:v,append:h}}}if("u">typeof document&&!document.getElementById("artplayer-plugin-asr")){let e=document.createElement("style");e.id="artplayer-plugin-asr",e.textContent=l.default,document.head.appendChild(e)}"u">typeof window&&(window.artplayerPluginAsr=i)},{"bundle-text:./style.less":"27Ck2","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"27Ck2":[function(e,t,r,n){t.exports=".art-video-player .art-layer-asr{z-index:150;justify-content:end;gap:var(--art-subtitle-gap);padding:0 2%;padding-bottom:var(--art-subtitle-bottom);transition:padding-bottom var(--art-transition-duration)ease;text-shadow:var(--art-subtitle-border)1px 0 1px,var(--art-subtitle-border)0 1px 1px,var(--art-subtitle-border)-1px 0 1px,var(--art-subtitle-border)0 -1px 1px,var(--art-subtitle-border)1px 1px 1px,var(--art-subtitle-border)-1px -1px 1px,var(--art-subtitle-border)1px -1px 1px,var(--art-subtitle-border)-1px 1px 1px;flex-direction:column;font-size:1rem;display:flex;position:absolute;inset:0;pointer-events:none!important}.art-video-player.art-control-show .art-layer-asr{padding-bottom:calc(var(--art-control-height) + var(--art-subtitle-bottom))}"},{}],loqXi:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["ejGkt"],"ejGkt","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("ejGkt");export{e as default}; \ No newline at end of file diff --git a/packages/artplayer-plugin-auto-thumbnail/dist/artplayer-plugin-auto-thumbnail.js b/packages/artplayer-plugin-auto-thumbnail/dist/artplayer-plugin-auto-thumbnail.js index 1a95b6e2a..ff714ed86 100644 --- a/packages/artplayer-plugin-auto-thumbnail/dist/artplayer-plugin-auto-thumbnail.js +++ b/packages/artplayer-plugin-auto-thumbnail/dist/artplayer-plugin-auto-thumbnail.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-auto-thumbnail.js v1.0.1 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,n,r,o,u,i,l){var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof f[r]&&f[r],a=d.i||{},c=d.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!c[t]){if(!e[t]){if(o[t])return o[t];var u="function"==typeof f[r]&&f[r];if(!n&&u)return u(t,!0);if(d)return d(t,!0);if(s&&"string"==typeof t)return s(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}a.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},a.cache={};var l=c[t]=new p.Module(t);e[t][0].call(l.exports,a,l,l.exports,f)}return c[t].exports;function a(e){var t=a.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],o=e[2]||e[0],u=p(r);"*"===t?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===o?Object.defineProperty(n,t,{enumerable:!0,value:u}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===o?u.__esModule?u.default:u:u[o]}})}),n}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=c,p.parent=d,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=a,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return f[r]}}),f[r]=p;for(var m=0;m(t.on("video:loadedmetadata",()=>{let n=e.url||t.option.url,r=e.width||160,o=e.number||100,u=e.scale||1;!function({url:e,width:t,number:n},r){let o=document.createElement("video");o.crossOrigin="anonymous",o.src=e,o.onloadedmetadata=()=>{let e=o.duration,u=document.createElement("canvas"),i=u.getContext("2d"),l=Math.floor(t*o.videoHeight/o.videoWidth);u.width=10*t,u.height=l*Math.ceil(n/10);let f=null;!function d(a){u.toBlob(e=>{URL.revokeObjectURL(f),r({url:f=URL.createObjectURL(e),height:l})},"image/jpeg"),a>=n||(o.currentTime=e*a/n,o.onseeked=()=>{i.drawImage(o,a%10*t,Math.floor(a/10)*l,t,l),d(a+1)})}(0)}}({url:n,width:r,number:o},e=>{t.thumbnails={...e,column:10,number:o,width:r,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}o.defineInteropFlag(n),o.export(n,"default",()=>u),"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,n,r){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})}},{}]},["6MsoC"],"6MsoC","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,r,o,n,u,i,l){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof a[o]&&a[o],c=f.i||{},d=f.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!d[t]){if(!e[t]){if(n[t])return n[t];var u="function"==typeof a[o]&&a[o];if(!r&&u)return u(t,!0);if(f)return f(t,!0);if(s&&"string"==typeof t)return s(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}c.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},c.cache={};var l=d[t]=new p.Module(t);e[t][0].call(l.exports,c,l,l.exports,a)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],o=e[1],n=e[2]||e[0],u=p(o);"*"===t?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:u}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?u.__esModule?u.default:u:u[n]}})}),r}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=c,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var m=0;mtypeof module?module.exports=y:"function"==typeof define&&define.amd&&define(function(){return y})}}({"6MsoC":[function(e,t,r,o){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function u(e){return async t=>(t.on("video:loadedmetadata",()=>{let r=e.url||t.option.url,o=e.width||160,n=e.number||100,u=e.scale||1;!function({url:e,width:t,number:r},o){let n=document.createElement("video");n.crossOrigin="anonymous",n.src=e,n.onloadedmetadata=()=>{let e=n.duration,u=document.createElement("canvas"),i=u.getContext("2d"),l=Math.floor(t*n.videoHeight/n.videoWidth);u.width=10*t,u.height=l*Math.ceil(r/10);let a=null;!function f(c){u.toBlob(e=>{URL.revokeObjectURL(a),o({url:a=URL.createObjectURL(e),height:l})},"image/jpeg"),c>=r||(n.currentTime=e*c/r,n.onseeked=()=>{i.drawImage(n,c%10*t,Math.floor(c/10)*l,t,l),f(c+1)})}(0)}}({url:r,width:o,number:n},e=>{t.thumbnails={...e,column:10,number:n,width:o,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}n.defineInteropFlag(r),n.export(r,"default",()=>u),"u">typeof window&&(window.artplayerPluginAutoThumbnail=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,r,o){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["6MsoC"],"6MsoC","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-auto-thumbnail/dist/artplayer-plugin-auto-thumbnail.legacy.js b/packages/artplayer-plugin-auto-thumbnail/dist/artplayer-plugin-auto-thumbnail.legacy.js index 9f21f85fd..00e4f7d09 100644 --- a/packages/artplayer-plugin-auto-thumbnail/dist/artplayer-plugin-auto-thumbnail.legacy.js +++ b/packages/artplayer-plugin-auto-thumbnail/dist/artplayer-plugin-auto-thumbnail.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-auto-thumbnail.js v1.0.1 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o,i,c,u){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},f="function"==typeof a[n]&&a[n],s=f.i||{},l=f.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!l[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof a[n]&&a[n];if(!r&&i)return i(t,!0);if(f)return f(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var u=l[t]=new d.Module(t);e[t][0].call(u.exports,s,u,u.exports,a)}return l[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],i=d(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=l,d.parent=f,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=s,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return a[n]}}),a[n]=d;for(var y=0;y=a||(f.currentTime=e*s/a,f.onseeked=function(){r.drawImage(f,s%10*i,Math.floor(s/10)*o,i,o),u(s+1)})}(0)}}),[2,{name:"artplayerPluginAutoThumbnail"}]})})()}}"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=f)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_object_spread_props.cjs":"3G1wX","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,i,c){try{var u=e[i](c),a=u.value}catch(e){r(e);return}u.done?t(a):Promise.resolve(a).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var c=e.apply(t,r);function u(e){o(c,n,i,u,a,"next",e)}function a(e){o(c,n,i,u,a,"throw",e)}u(void 0)})}}},{}],kyoEj:[function(e,t,r,n){"use strict";var o=e("9f9b8a24218ee51e");r._=function(e){for(var t=1;tt.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function s(e,t,r,n){var o,c=arguments.length,u=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(c<3?o(u):c>3?o(t,r,u):o(t,r))||u);return c>3&&u&&Object.defineProperty(t,r,u),u}function l(e,t){return function(r,n){t(r,n,e)}}function p(e,t,r,n,o,c){function u(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var a,f=n.kind,s="getter"===f?"get":"setter"===f?"set":"value",l=!t&&e?n.static?e:e.prototype:null,p=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d=!1,y=r.length-1;y>=0;y--){var _={};for(var h in n)_[h]="access"===h?{}:n[h];for(var h in n.access)_.access[h]=n.access[h];_.addInitializer=function(e){if(d)throw TypeError("Cannot add initializers after decoration has completed");c.push(u(e||null))};var b=(0,r[y])("accessor"===f?{get:p.get,set:p.set}:p[s],_);if("accessor"===f){if(void 0===b)continue;if(null===b||(void 0===b?"undefined":(0,i._)(b))!=="object")throw TypeError("Object expected");(a=u(b.get))&&(p.get=a),(a=u(b.set))&&(p.set=a),(a=u(b.init))&&o.unshift(a)}else(a=u(b))&&("field"===f?o.unshift(a):p[s]=a)}l&&Object.defineProperty(l,n.name,p),d=!0}function d(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])&&(6===f[0]||2===f[0])){i=0;continue}if(3===f[0]&&(!o||f[1]>o[0]&&f[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c}function O(){for(var e=[],t=0;t1||u(e,t)})},t&&(n[e]=t(n[e])))}function u(e,t){try{var r;(r=o[e](t)).value instanceof E?Promise.resolve(r.value.v).then(a,f):s(i[0][2],r)}catch(e){s(i[0][3],e)}}function a(e){u("next",e)}function f(e){u("throw",e)}function s(e,t){e(t),i.shift(),i.length&&u(i[0][0],i[0][1])}}function T(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:E(e[n](t)),done:!1}:o?o(t):t}:o}}function I(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=j(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){var i,c,u;i=n,c=o,u=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:u})},c)})}}}function D(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var R=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},M=function(e){return(M=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function k(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=M(e),n=0;ntypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof a[n]&&a[n],s=l.i||{},f=l.cache||{},p="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var u="function"==typeof a[n]&&a[n];if(!r&&u)return u(t,!0);if(l)return l(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var i=f[t]=new d.Module(t);e[t][0].call(i.exports,s,i,i.exports,a)}return f[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],u=d(n);"*"===t?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:u}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?u.__esModule?u.default:u:u[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=f,d.parent=l,d.distDir=void 0,d.publicUrl=void 0,d.devServer=void 0,d.i=s,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return a[n]}}),a[n]=d;for(var b=0;btypeof module?module.exports=y:"function"==typeof define&&define.amd&&define(function(){return y})}}({"9JZgh":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return l});var u=e("@swc/helpers/cjs/_async_to_generator.cjs"),c=e("@swc/helpers/cjs/_object_spread.cjs"),i=e("@swc/helpers/cjs/_object_spread_props.cjs"),a=e("@swc/helpers/cjs/_ts_generator.cjs");function l(e){return function(t){return(0,u._)(function(){return(0,a._)(this,function(r){return t.on("video:loadedmetadata",function(){var r,n,o,u,a,l,s=e.url||t.option.url,f=e.width||160,p=e.number||100,d=e.scale||1;r={url:s,width:f,number:p},n=function(e){t.thumbnails=(0,i._)((0,c._)({},e),{column:10,number:p,width:f,scale:d})},o=r.url,u=r.width,a=r.number,(l=document.createElement("video")).crossOrigin="anonymous",l.src=o,l.onloadedmetadata=function(){var e=l.duration,t=document.createElement("canvas"),r=t.getContext("2d"),o=Math.floor(u*l.videoHeight/l.videoWidth);t.width=10*u,t.height=o*Math.ceil(a/10);var c=null;!function i(s){t.toBlob(function(e){URL.revokeObjectURL(c),n({url:c=URL.createObjectURL(e),height:o})},"image/jpeg"),s>=a||(l.currentTime=e*s/a,l.onseeked=function(){r.drawImage(l,s%10*u,Math.floor(s/10)*o,u,o),i(s+1)})}(0)}}),[2,{name:"artplayerPluginAutoThumbnail"}]})})()}}"u">typeof window&&(window.artplayerPluginAutoThumbnail=l)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_object_spread.cjs":"kyoEj","@swc/helpers/cjs/_object_spread_props.cjs":"3G1wX","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,u,c){try{var i=e[u](c),a=i.value}catch(e){r(e);return}i.done?t(a):Promise.resolve(a).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,u){var c=e.apply(t,r);function i(e){o(c,n,u,i,a,"next",e)}function a(e){o(c,n,u,i,a,"throw",e)}i(void 0)})}}},{}],kyoEj:[function(e,t,r,n){"use strict";var o=e("9f9b8a24218ee51e");r._=function(e){for(var t=1;t0&&o[o.length-1])&&(6===l[0]||2===l[0])){u=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1](t.on("video:loadedmetadata",()=>{let r=e.url||t.option.url,n=e.width||160,o=e.number||100,u=e.scale||1;!function({url:e,width:t,number:r},n){let o=document.createElement("video");o.crossOrigin="anonymous",o.src=e,o.onloadedmetadata=()=>{let e=o.duration,u=document.createElement("canvas"),i=u.getContext("2d"),l=Math.floor(t*o.videoHeight/o.videoWidth);u.width=10*t,u.height=l*Math.ceil(r/10);let f=null;!function a(d){u.toBlob(e=>{URL.revokeObjectURL(f),n({url:f=URL.createObjectURL(e),height:l})},"image/jpeg"),d>=r||(o.currentTime=e*d/r,o.onseeked=()=>{i.drawImage(o,d%10*t,Math.floor(d/10)*l,t,l),a(d+1)})}(0)}}({url:r,width:n,number:o},e=>{t.thumbnails={...e,column:10,number:o,width:n,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}o.defineInteropFlag(r),o.export(r,"default",()=>u),"undefined"!=typeof window&&(window.artplayerPluginAutoThumbnail=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["lry5Y"],"lry5Y","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("lry5Y");export{e as default}; \ No newline at end of file +!function(e,t,r,o,n,u,i,l){var a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},f="function"==typeof a[o]&&a[o],c=f.i||{},d=f.cache||{},s="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!d[t]){if(!e[t]){if(n[t])return n[t];var u="function"==typeof a[o]&&a[o];if(!r&&u)return u(t,!0);if(f)return f(t,!0);if(s&&"string"==typeof t)return s(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}c.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},c.cache={};var l=d[t]=new p.Module(t);e[t][0].call(l.exports,c,l,l.exports,a)}return d[t].exports;function c(e){var t=c.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],o=e[1],n=e[2]||e[0],u=p(o);"*"===t?Object.keys(u).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return u[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:u}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?u.__esModule?u.default:u:u[n]}})}),r}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=s,this.exports={}},p.modules=e,p.cache=d,p.parent=f,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=c,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var y=0;ytypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({lry5Y:[function(e,t,r,o){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function u(e){return async t=>(t.on("video:loadedmetadata",()=>{let r=e.url||t.option.url,o=e.width||160,n=e.number||100,u=e.scale||1;!function({url:e,width:t,number:r},o){let n=document.createElement("video");n.crossOrigin="anonymous",n.src=e,n.onloadedmetadata=()=>{let e=n.duration,u=document.createElement("canvas"),i=u.getContext("2d"),l=Math.floor(t*n.videoHeight/n.videoWidth);u.width=10*t,u.height=l*Math.ceil(r/10);let a=null;!function f(c){u.toBlob(e=>{URL.revokeObjectURL(a),o({url:a=URL.createObjectURL(e),height:l})},"image/jpeg"),c>=r||(n.currentTime=e*c/r,n.onseeked=()=>{i.drawImage(n,c%10*t,Math.floor(c/10)*l,t,l),f(c+1)})}(0)}}({url:r,width:o,number:n},e=>{t.thumbnails={...e,column:10,number:n,width:o,scale:u}})}),{name:"artplayerPluginAutoThumbnail"})}n.defineInteropFlag(r),n.export(r,"default",()=>u),"u">typeof window&&(window.artplayerPluginAutoThumbnail=u)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,t,r,o){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["lry5Y"],"lry5Y","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("lry5Y");export{e as default}; \ No newline at end of file diff --git a/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.js b/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.js index 70b7f6a22..3a1f3ad83 100644 --- a/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.js +++ b/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.js @@ -1,8 +1,8 @@ /*! - * artplayer-plugin-chapter.js v1.0.1 + * artplayer-plugin-chapter.js v1.0.2 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,a,n,o,i,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[a]&&d[a],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(n[t])return n[t];var o="function"==typeof d[a]&&d[a];if(!r&&o)return o(t,!0);if(p)return p(t,!0);if(c&&"string"==typeof t)return c(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},s.cache={};var l=u[t]=new f.Module(t);e[t][0].call(l.exports,s,l,l.exports,d)}return u[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],n=e[2]||e[0],o=f(a);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:o}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[a]}}),d[a]=f;for(var h=0;hl);var o=e("bundle-text:./style.less"),i=n.interopDefault(o);function l(e={}){return t=>{let{$player:r}=t.template,{setStyle:a,append:n,clamp:o,query:i,isMobile:l,addClass:d,removeClass:p}=t.constructor.utils,s=`
`,u=null,c=[],f=t.query(".art-control-progress"),h=t.query(".art-control-progress-inner"),y=n(h,'
'),g=n(h,'
');function m({$chapter:e,width:t}){let r=e.dataset.title.trim();if(r){a(g,"display","flex"),g.textContent=r;let e=g.clientWidth;t<=e/2?a(g,"left",0):t>h.clientWidth-e/2?a(g,"left",`${h.clientWidth-e}px`):a(g,"left",`${t-e/2}px`)}else a(g,"display","none")}function v(e=[]){if((c=[],y.textContent="",p(r,"artplayer-plugin-chapter"),Array.isArray(e)&&e.length)&&t.duration){e=e.sort((e,t)=>e.start-t.start);for(let r=0;rt.duration||a.start>=a.end||n&&a.end>n.start)throw Error("Illegal chapter time point")}e[0].start>0&&e.unshift({start:0,end:e[0].start,title:""}),e[e.length-1].end{let r=n(y,s),a=o(e.start,0,t.duration),l=o(e.end,0,t.duration),d=l-a,p=d/t.duration;return r.dataset.start=a,r.dataset.end=l,r.dataset.duration=d,r.dataset.title=e.title.trim(),r.style.width=`${100*p}%`,{$chapter:r,$hover:i(".art-progress-hover",r),$loaded:i(".art-progress-loaded",r),$played:i(".art-progress-played",r)}}),d(r,"artplayer-plugin-chapter"),t.emit("setBar","loaded",t.loaded||0)}}return t.on("setBar",(e,r,n)=>{if(c.length)for(let o=0;ow&&a(f,"width","100%"),v>=x&&v<=w){let t=(v-x)/b;a(f,"width",`${100*t}%`),l?"played"===e&&n&&(m({$chapter:i,width:h}),clearTimeout(u),u=setTimeout(()=>{a(g,"display","none")},500)):"hover"===e&&m({$chapter:i,width:h})}}}),l||t.proxy(f,"mouseleave",()=>{c.length&&a(g,"display","none")}),t.once("video:loadedmetadata",()=>v(e.chapters)),{name:"artplayerPluginChapter",update:({chapters:e})=>v(e)}}}if("undefined"!=typeof document){let e="artplayer-plugin-chapter",t=document.getElementById(e);t||((t=document.createElement("style")).id=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(t)}):(document.head||document.documentElement).appendChild(t)),t.textContent=i.default}"undefined"!=typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"4RPBI","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"4RPBI":[function(e,t,r,a){t.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:#0000!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;inset:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);padding:3px 5px;font-size:14px;line-height:1;display:none;position:absolute;top:-50px;left:0}"},{}],"6ykb1":[function(e,t,r,a){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["3VfEb"],"3VfEb","parcelRequire4dc0",{}); \ No newline at end of file +!function(t,e,r,a,n,o,i,l){var d="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},p="function"==typeof d[a]&&d[a],s=p.i||{},u=p.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(e,r){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof d[a]&&d[a];if(!r&&o)return o(e,!0);if(p)return p(e,!0);if(c&&"string"==typeof e)return c(e);var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=t[e][1][r];return null!=a?a:r},s.cache={};var l=u[e]=new f.Module(e);t[e][0].call(l.exports,s,l,l.exports,d)}return u[e].exports;function s(t){var e=s.resolve(t);if(!1===e)return{};if(Array.isArray(e)){var r={__esModule:!0};return e.forEach(function(t){var e=t[0],a=t[1],n=t[2]||t[0],o=f(a);"*"===e?Object.keys(o).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return o[t]}})}):"*"===n?Object.defineProperty(r,e,{enumerable:!0,value:o}):Object.defineProperty(r,e,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(e)}}f.isParcelRequire=!0,f.Module=function(t){this.id=t,this.bundle=f,this.require=c,this.exports={}},f.modules=t,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[a]}}),d[a]=f;for(var h=0;htypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"3VfEb":[function(t,e,r,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",()=>l);var o=t("bundle-text:./style.less"),i=n.interopDefault(o);function l(t={}){return e=>{let{$player:r}=e.template,{setStyle:a,append:n,clamp:o,query:i,addClass:l,removeClass:d}=e.constructor.utils,p=`
`,s=[],u=e.query(".art-control-progress-inner"),c=n(u,'
'),f=n(u,'
');function h(t=[]){if((s=[],c.textContent="",d(r,"artplayer-plugin-chapter"),Array.isArray(t)&&t.length)&&e.duration){t=t.sort((t,e)=>t.start-e.start);for(let r=0;re.duration||a.start>=a.end||n&&a.end>n.start)throw Error("Illegal chapter time point")}t[0].start>0&&t.unshift({start:0,end:t[0].start,title:""}),t[t.length-1].end{let r=n(c,p),a=o(t.start,0,e.duration),l=o(t.end,0,e.duration),d=l-a,s=d/e.duration;return r.dataset.start=a,r.dataset.end=l,r.dataset.duration=d,r.dataset.title=t.title.trim(),r.style.width=`${100*s}%`,{$chapter:r,$hover:i(".art-progress-hover",r),$loaded:i(".art-progress-loaded",r),$played:i(".art-progress-played",r)}}),l(r,"artplayer-plugin-chapter"),e.emit("setBar","loaded",e.loaded||0)}}return e.on("setBar",(t,r)=>{if(s.length)for(let n=0;nv&&a(p,"width","100%"),g>=m&&g<=v){let e=(g-m)/y;a(p,"width",`${100*e}%`),"hover"===t&&h>0&&function({$chapter:t,width:e}){let r=t.dataset.title.trim();if(r){f.textContent=r;let t=f.clientWidth;e<=t/2?a(f,"left",0):e>u.clientWidth-t/2?a(f,"left",`${u.clientWidth-t}px`):a(f,"left",`${e-t/2}px`)}}({$chapter:o,width:h})}}}),e.once("video:loadedmetadata",()=>h(t.chapters)),{name:"artplayerPluginChapter",update:({chapters:t})=>h(t)}}}if("u">typeof document){let t="artplayer-plugin-chapter",e=document.getElementById(t);e||((e=document.createElement("style")).id=t,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(e)}):(document.head||document.documentElement).appendChild(e)),e.textContent=i.default}"u">typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"4RPBI","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"4RPBI":[function(t,e,r,a){e.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:#0000!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;inset:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{transform-origin:bottom;opacity:0;z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration)ease,opacity var(--art-transition-duration)ease;padding:3px 5px;font-size:14px;line-height:1;position:absolute;top:-50px;left:0;transform:scale(.5)}.artplayer-plugin-chapter.art-progress-hover .art-chapter-title{opacity:1;transform:scale(1)}"},{}],"6ykb1":[function(t,e,r,a){r.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},r.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.exportAll=function(t,e){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e},r.export=function(t,e,r){Object.defineProperty(t,e,{enumerable:!0,get:r})}},{}]},["3VfEb"],"3VfEb","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.legacy.js b/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.legacy.js index eac373f70..068803a25 100644 --- a/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.legacy.js +++ b/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.legacy.js @@ -1,8 +1,8 @@ /*! - * artplayer-plugin-chapter.js v1.0.1 + * artplayer-plugin-chapter.js v1.0.2 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,a,o,i,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[n]&&d[n],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(a[t])return a[t];var o="function"==typeof d[n]&&d[n];if(!r&&o)return o(t,!0);if(p)return p(t,!0);if(c&&"string"==typeof t)return c(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},s.cache={};var l=u[t]=new f.Module(t);e[t][0].call(l.exports,s,l,l.exports,d)}return u[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],a=e[2]||e[0],o=f(n);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===a?Object.defineProperty(r,t,{enumerable:!0,value:o}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===a?o.__esModule?o.default:o:o[a]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[n]}}),d[n]=f;for(var h=0;h0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var r=t.template.$player,n=t.constructor.utils,a=n.setStyle,o=n.append,i=n.clamp,l=n.query,d=n.isMobile,p=n.addClass,s=n.removeClass,u=null,c=[],f=t.query(".art-control-progress"),h=t.query(".art-control-progress-inner"),y=o(h,'
'),g=o(h,'
');function v(e){var t=e.$chapter,r=e.width,n=t.dataset.title.trim();if(n){a(g,"display","flex"),g.textContent=n;var o=g.clientWidth;r<=o/2?a(g,"left",0):r>h.clientWidth-o/2?a(g,"left","".concat(h.clientWidth-o,"px")):a(g,"left","".concat(r-o/2,"px"))}else a(g,"display","none")}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if((c=[],y.textContent="",s(r,"artplayer-plugin-chapter"),Array.isArray(e)&&e.length)&&t.duration){e=e.sort(function(e,t){return e.start-t.start});for(var n=0;nt.duration||a.start>=a.end||d&&a.end>d.start)throw Error("Illegal chapter time point")}e[0].start>0&&e.unshift({start:0,end:e[0].start,title:""}),e[e.length-1].end\n
\n
\n
\n
\n
\n\n '),n=i(e.start,0,t.duration),a=i(e.end,0,t.duration),d=a-n,p=d/t.duration;return r.dataset.start=n,r.dataset.end=a,r.dataset.duration=d,r.dataset.title=e.title.trim(),r.style.width="".concat(100*p,"%"),{$chapter:r,$hover:l(".art-progress-hover",r),$loaded:l(".art-progress-loaded",r),$played:l(".art-progress-played",r)}}),p(r,"artplayer-plugin-chapter"),t.emit("setBar","loaded",t.loaded||0)}}return t.on("setBar",function(e,r,n){if(c.length)for(var o=0;ow&&a(f,"width","100%"),m>=x&&m<=w){var O=(m-x)/b;a(f,"width","".concat(100*O,"%")),d?"played"===e&&n&&(v({$chapter:l,width:h}),clearTimeout(u),u=setTimeout(function(){a(g,"display","none")},500)):"hover"===e&&v({$chapter:l,width:h})}}}),d||t.proxy(f,"mouseleave",function(){c.length&&a(g,"display","none")}),t.once("video:loadedmetadata",function(){return m(e.chapters)}),{name:"artplayerPluginChapter",update:function(e){return m(e.chapters)}}}}if("undefined"!=typeof document){var d="artplayer-plugin-chapter",p=document.getElementById(d);p||((p=document.createElement("style")).id=d,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",function(){document.head.appendChild(p)}):(document.head||document.documentElement).appendChild(p)),p.textContent=i.default}"undefined"!=typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"35ZxU","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"35ZxU":[function(e,t,r,n){t.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:transparent!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;top:0;bottom:0;left:0;right:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);padding:3px 5px;font-size:14px;line-height:1;display:none;position:absolute;top:-50px;left:0}"},{}],qpMMf:[function(e,t,r,n){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["7hySu"],"7hySu","parcelRequire4dc0",{}); \ No newline at end of file +!function(t,e,r,a,n,o,i,l){var p="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},d="function"==typeof p[a]&&p[a],s=d.i||{},u=d.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(e,r){if(!u[e]){if(!t[e]){if(n[e])return n[e];var o="function"==typeof p[a]&&p[a];if(!r&&o)return o(e,!0);if(d)return d(e,!0);if(c&&"string"==typeof e)return c(e);var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=t[e][1][r];return null!=a?a:r},s.cache={};var l=u[e]=new f.Module(e);t[e][0].call(l.exports,s,l,l.exports,p)}return u[e].exports;function s(t){var e=s.resolve(t);if(!1===e)return{};if(Array.isArray(e)){var r={__esModule:!0};return e.forEach(function(t){var e=t[0],a=t[1],n=t[2]||t[0],o=f(a);"*"===e?Object.keys(o).forEach(function(t){"default"===t||"__esModule"===t||Object.prototype.hasOwnProperty.call(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return o[t]}})}):"*"===n?Object.defineProperty(r,e,{enumerable:!0,value:o}):Object.defineProperty(r,e,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(e)}}f.isParcelRequire=!0,f.Module=function(t){this.id=t,this.bundle=f,this.require=c,this.exports={}},f.modules=t,f.cache=u,f.parent=d,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return p[a]}}),p[a]=f;for(var h=0;htypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({"7hySu":[function(t,e,r,a){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return l});var o=t("bundle-text:./style.less"),i=n.interopDefault(o);function l(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(e){var r=e.template.$player,a=e.constructor.utils,n=a.setStyle,o=a.append,i=a.clamp,l=a.query,p=a.addClass,d=a.removeClass,s=[],u=e.query(".art-control-progress-inner"),c=o(u,'
'),f=o(u,'
');function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if((s=[],c.textContent="",d(r,"artplayer-plugin-chapter"),Array.isArray(t)&&t.length)&&e.duration){t=t.sort(function(t,e){return t.start-e.start});for(var a=0;ae.duration||n.start>=n.end||u&&n.end>u.start)throw Error("Illegal chapter time point")}t[0].start>0&&t.unshift({start:0,end:t[0].start,title:""}),t[t.length-1].end\n
\n
\n
\n
\n
\n\n '),a=i(t.start,0,e.duration),n=i(t.end,0,e.duration),p=n-a,d=p/e.duration;return r.dataset.start=a,r.dataset.end=n,r.dataset.duration=p,r.dataset.title=t.title.trim(),r.style.width="".concat(100*d,"%"),{$chapter:r,$hover:l(".art-progress-hover",r),$loaded:l(".art-progress-loaded",r),$played:l(".art-progress-played",r)}}),p(r,"artplayer-plugin-chapter"),e.emit("setBar","loaded",e.loaded||0)}}return e.on("setBar",function(t,r){if(s.length)for(var a=0;am&&n(d,"width","100%"),g>=v&&g<=m){var b=(g-v)/y;n(d,"width","".concat(100*b,"%")),"hover"===t&&h>0&&function(t){var e=t.$chapter,r=t.width,a=e.dataset.title.trim();if(a){f.textContent=a;var o=f.clientWidth;r<=o/2?n(f,"left",0):r>u.clientWidth-o/2?n(f,"left","".concat(u.clientWidth-o,"px")):n(f,"left","".concat(r-o/2,"px"))}}({$chapter:i,width:h})}}}),e.once("video:loadedmetadata",function(){return h(t.chapters)}),{name:"artplayerPluginChapter",update:function(t){return h(t.chapters)}}}}if("u">typeof document){var p="artplayer-plugin-chapter",d=document.getElementById(p);d||((d=document.createElement("style")).id=p,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",function(){document.head.appendChild(d)}):(document.head||document.documentElement).appendChild(d)),d.textContent=i.default}"u">typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"35ZxU","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],"35ZxU":[function(t,e,r,a){e.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:transparent!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;top:0;bottom:0;left:0;right:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{transform-origin:bottom;opacity:0;z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration)ease,opacity var(--art-transition-duration)ease;padding:3px 5px;font-size:14px;line-height:1;position:absolute;top:-50px;left:0;transform:scale(.5)}.artplayer-plugin-chapter.art-progress-hover .art-chapter-title{opacity:1;transform:scale(1)}"},{}],qpMMf:[function(t,e,r,a){r.interopDefault=function(t){return t&&t.__esModule?t:{default:t}},r.defineInteropFlag=function(t){Object.defineProperty(t,"__esModule",{value:!0})},r.exportAll=function(t,e){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e},r.export=function(t,e,r){Object.defineProperty(t,e,{enumerable:!0,get:r})}},{}]},["7hySu"],"7hySu","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.mjs b/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.mjs index 9ca8645e7..053c61325 100644 --- a/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.mjs +++ b/packages/artplayer-plugin-chapter/dist/artplayer-plugin-chapter.mjs @@ -1,8 +1,8 @@ /*! - * artplayer-plugin-chapter.js v1.0.1 + * artplayer-plugin-chapter.js v1.0.2 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,a,n,o,i,l){var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof d[a]&&d[a],s=p.i||{},u=p.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(n[t])return n[t];var o="function"==typeof d[a]&&d[a];if(!r&&o)return o(t,!0);if(p)return p(t,!0);if(c&&"string"==typeof t)return c(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},s.cache={};var l=u[t]=new f.Module(t);e[t][0].call(l.exports,s,l,l.exports,d)}return u[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],n=e[2]||e[0],o=f(a);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:o}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[a]}}),d[a]=f;for(var h=0;hl);var o=e("bundle-text:./style.less"),i=n.interopDefault(o);function l(e={}){return t=>{let{$player:r}=t.template,{setStyle:a,append:n,clamp:o,query:i,isMobile:l,addClass:d,removeClass:p}=t.constructor.utils,s=`
`,u=null,c=[],f=t.query(".art-control-progress"),h=t.query(".art-control-progress-inner"),g=n(h,'
'),y=n(h,'
');function m({$chapter:e,width:t}){let r=e.dataset.title.trim();if(r){a(y,"display","flex"),y.textContent=r;let e=y.clientWidth;t<=e/2?a(y,"left",0):t>h.clientWidth-e/2?a(y,"left",`${h.clientWidth-e}px`):a(y,"left",`${t-e/2}px`)}else a(y,"display","none")}function v(e=[]){if((c=[],g.textContent="",p(r,"artplayer-plugin-chapter"),Array.isArray(e)&&e.length)&&t.duration){e=e.sort((e,t)=>e.start-t.start);for(let r=0;rt.duration||a.start>=a.end||n&&a.end>n.start)throw Error("Illegal chapter time point")}e[0].start>0&&e.unshift({start:0,end:e[0].start,title:""}),e[e.length-1].end{let r=n(g,s),a=o(e.start,0,t.duration),l=o(e.end,0,t.duration),d=l-a,p=d/t.duration;return r.dataset.start=a,r.dataset.end=l,r.dataset.duration=d,r.dataset.title=e.title.trim(),r.style.width=`${100*p}%`,{$chapter:r,$hover:i(".art-progress-hover",r),$loaded:i(".art-progress-loaded",r),$played:i(".art-progress-played",r)}}),d(r,"artplayer-plugin-chapter"),t.emit("setBar","loaded",t.loaded||0)}}return t.on("setBar",(e,r,n)=>{if(c.length)for(let o=0;ow&&a(f,"width","100%"),v>=x&&v<=w){let t=(v-x)/b;a(f,"width",`${100*t}%`),l?"played"===e&&n&&(m({$chapter:i,width:h}),clearTimeout(u),u=setTimeout(()=>{a(y,"display","none")},500)):"hover"===e&&m({$chapter:i,width:h})}}}),l||t.proxy(f,"mouseleave",()=>{c.length&&a(y,"display","none")}),t.once("video:loadedmetadata",()=>v(e.chapters)),{name:"artplayerPluginChapter",update:({chapters:e})=>v(e)}}}if("undefined"!=typeof document){let e="artplayer-plugin-chapter",t=document.getElementById(e);t||((t=document.createElement("style")).id=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(t)}):(document.head||document.documentElement).appendChild(t)),t.textContent=i.default}"undefined"!=typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"3lhZb","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3lhZb":[function(e,t,r,a){t.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:#0000!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;inset:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);padding:3px 5px;font-size:14px;line-height:1;display:none;position:absolute;top:-50px;left:0}"},{}],loqXi:[function(e,t,r,a){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["fwWaD"],"fwWaD","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("fwWaD");export{e as default}; \ No newline at end of file +!function(e,t,r,a,n,o,i,l){var d="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},p="function"==typeof d[a]&&d[a],s=p.i||{},u=p.cache||{},c="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!u[t]){if(!e[t]){if(n[t])return n[t];var o="function"==typeof d[a]&&d[a];if(!r&&o)return o(t,!0);if(p)return p(t,!0);if(c&&"string"==typeof t)return c(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}s.resolve=function(r){var a=e[t][1][r];return null!=a?a:r},s.cache={};var l=u[t]=new f.Module(t);e[t][0].call(l.exports,s,l,l.exports,d)}return u[t].exports;function s(e){var t=s.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],a=e[1],n=e[2]||e[0],o=f(a);"*"===t?Object.keys(o).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return o[e]}})}):"*"===n?Object.defineProperty(r,t,{enumerable:!0,value:o}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===n?o.__esModule?o.default:o:o[n]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=c,this.exports={}},f.modules=e,f.cache=u,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=s,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return d[a]}}),d[a]=f;for(var h=0;htypeof module?module.exports=g:"function"==typeof define&&define.amd&&define(function(){return g})}}({fwWaD:[function(e,t,r,a){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",()=>l);var o=e("bundle-text:./style.less"),i=n.interopDefault(o);function l(e={}){return t=>{let{$player:r}=t.template,{setStyle:a,append:n,clamp:o,query:i,addClass:l,removeClass:d}=t.constructor.utils,p=`
`,s=[],u=t.query(".art-control-progress-inner"),c=n(u,'
'),f=n(u,'
');function h(e=[]){if((s=[],c.textContent="",d(r,"artplayer-plugin-chapter"),Array.isArray(e)&&e.length)&&t.duration){e=e.sort((e,t)=>e.start-t.start);for(let r=0;rt.duration||a.start>=a.end||n&&a.end>n.start)throw Error("Illegal chapter time point")}e[0].start>0&&e.unshift({start:0,end:e[0].start,title:""}),e[e.length-1].end{let r=n(c,p),a=o(e.start,0,t.duration),l=o(e.end,0,t.duration),d=l-a,s=d/t.duration;return r.dataset.start=a,r.dataset.end=l,r.dataset.duration=d,r.dataset.title=e.title.trim(),r.style.width=`${100*s}%`,{$chapter:r,$hover:i(".art-progress-hover",r),$loaded:i(".art-progress-loaded",r),$played:i(".art-progress-played",r)}}),l(r,"artplayer-plugin-chapter"),t.emit("setBar","loaded",t.loaded||0)}}return t.on("setBar",(e,r)=>{if(s.length)for(let n=0;nv&&a(p,"width","100%"),g>=m&&g<=v){let t=(g-m)/y;a(p,"width",`${100*t}%`),"hover"===e&&h>0&&function({$chapter:e,width:t}){let r=e.dataset.title.trim();if(r){f.textContent=r;let e=f.clientWidth;t<=e/2?a(f,"left",0):t>u.clientWidth-e/2?a(f,"left",`${u.clientWidth-e}px`):a(f,"left",`${t-e/2}px`)}}({$chapter:o,width:h})}}}),t.once("video:loadedmetadata",()=>h(e.chapters)),{name:"artplayerPluginChapter",update:({chapters:e})=>h(e)}}}if("u">typeof document){let e="artplayer-plugin-chapter",t=document.getElementById(e);t||((t=document.createElement("style")).id=e,"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.head.appendChild(t)}):(document.head||document.documentElement).appendChild(t)),t.textContent=i.default}"u">typeof window&&(window.artplayerPluginChapter=l)},{"bundle-text:./style.less":"3lhZb","@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],"3lhZb":[function(e,t,r,a){t.exports=".artplayer-plugin-chapter .art-control-progress-inner{background-color:#0000!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;inset:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{transform-origin:bottom;opacity:0;z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);transition:transform var(--art-transition-duration)ease,opacity var(--art-transition-duration)ease;padding:3px 5px;font-size:14px;line-height:1;position:absolute;top:-50px;left:0;transform:scale(.5)}.artplayer-plugin-chapter.art-progress-hover .art-chapter-title{opacity:1;transform:scale(1)}"},{}],loqXi:[function(e,t,r,a){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["fwWaD"],"fwWaD","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("fwWaD");export{e as default}; \ No newline at end of file diff --git a/packages/artplayer-plugin-chromecast/dist/artplayer-plugin-chromecast.js b/packages/artplayer-plugin-chromecast/dist/artplayer-plugin-chromecast.js index 2da82860f..a2cb2a55a 100644 --- a/packages/artplayer-plugin-chromecast/dist/artplayer-plugin-chromecast.js +++ b/packages/artplayer-plugin-chromecast/dist/artplayer-plugin-chromecast.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-chromecast.js v1.0.1 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,o,n,r,i,a,c){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},d="function"==typeof s[n]&&s[n],l=d.i||{},u=d.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,o){if(!u[t]){if(!e[t]){if(r[t])return r[t];var i="function"==typeof s[n]&&s[n];if(!o&&i)return i(t,!0);if(d)return d(t,!0);if(f&&"string"==typeof t)return f(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}l.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},l.cache={};var c=u[t]=new p.Module(t);e[t][0].call(c.exports,l,c,c.exports,s)}return u[t].exports;function l(e){var t=l.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var o={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],i=p(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(o,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===r?Object.defineProperty(o,t,{enumerable:!0,value:i}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===r?i.__esModule?i.default:i:i[r]}})}),o}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=f,this.exports={}},p.modules=e,p.cache=u,p.parent=d,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=l,p.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(p,"root",{get:function(){return s[n]}}),s[n]=p;for(var w=0;w{let t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},i=(t,o)=>{let n=e.url||t.option.url,r=new window.chrome.cast.media.MediaInfo(n,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[n.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),i=new window.chrome.cast.media.LoadRequest(r);o.loadMedia(i).then(()=>{t.notice.show="Casting started",e.onCastStart?.()}).catch(o=>{throw t.notice.show="Error casting media",e.onError?.(o),o})};return async a=>(a.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:`${e.icon||''}`,click:async()=>{if(!t)try{await new Promise((i,a)=>{var c;window.__onGCastApiAvailable=c=>{if(c){let a=window.cast.framework.CastContext.getInstance();a.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),a.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=>{let i=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case i.NO_SESSION:e.onStateChange?.("disconnected"),r("disconnected");break;case i.SESSION_STARTING:e.onStateChange?.("connecting"),r("connecting");break;case i.SESSION_STARTED:e.onStateChange?.("connected"),r("connected");break;case i.SESSION_ENDING:e.onStateChange?.("disconnecting"),r("disconnecting");break;case i.SESSION_RESUMED:e.onStateChange?.("connected"),r("connected")}}),a.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{let o=window.cast.framework.CastState;switch(t.castState){case o.NO_DEVICES_AVAILABLE:e.onCastAvailable?.(!1);break;case o.NOT_CONNECTED:case o.CONNECTING:case o.CONNECTED:e.onCastAvailable?.(!0)}}),t=!0,i()}else a(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(c=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise((e,t)=>{let o=document.createElement("script");o.src=c,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(a)})}catch(t){throw a.notice.show="Failed to initialize Cast API",e.onError?.(t),t}let c=window.cast.framework.CastContext.getInstance();if(o)i(a,o);else try{let e=await c.requestSession();i(a,e)}catch(t){throw a.notice.show="Error connecting to cast session",e.onError?.(t),t}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}r.defineInteropFlag(o),r.export(o,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginChromecast=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[o]}})}),t},o.export=function(e,t,o){Object.defineProperty(e,t,{enumerable:!0,get:o})}},{}]},["18Aaf"],"18Aaf","parcelRequire4dc0",{}); \ No newline at end of file +!function(e,t,o,n,r,a,i,c){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof s[n]&&s[n],d=l.i||{},u=l.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,o){if(!u[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof s[n]&&s[n];if(!o&&a)return a(t,!0);if(l)return l(t,!0);if(f&&"string"==typeof t)return f(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}d.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},d.cache={};var c=u[t]=new p.Module(t);e[t][0].call(c.exports,d,c,c.exports,s)}return u[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var o={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],a=p(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(o,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===r?Object.defineProperty(o,t,{enumerable:!0,value:a}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===r?a.__esModule?a.default:a:a[r]}})}),o}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=f,this.exports={}},p.modules=e,p.cache=u,p.parent=l,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(p,"root",{get:function(){return s[n]}}),s[n]=p;for(var w=0;wtypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"18Aaf":[function(e,t,o,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function a(e){let t=!1,o=null,n=null,r=e=>{let t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},a=(t,o)=>{let n=e.url||t.option.url,r=new window.chrome.cast.media.MediaInfo(n,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[n.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),a=new window.chrome.cast.media.LoadRequest(r);o.loadMedia(a).then(()=>{t.notice.show="Casting started",e.onCastStart?.()}).catch(o=>{throw t.notice.show="Error casting media",e.onError?.(o),o})};return async i=>(i.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:`${e.icon||''}`,click:async()=>{if(!t)try{await new Promise((a,i)=>{var c;window.__onGCastApiAvailable=c=>{if(c){let i=window.cast.framework.CastContext.getInstance();i.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),i.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=>{let a=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case a.NO_SESSION:e.onStateChange?.("disconnected"),r("disconnected");break;case a.SESSION_STARTING:e.onStateChange?.("connecting"),r("connecting");break;case a.SESSION_STARTED:e.onStateChange?.("connected"),r("connected");break;case a.SESSION_ENDING:e.onStateChange?.("disconnecting"),r("disconnecting");break;case a.SESSION_RESUMED:e.onStateChange?.("connected"),r("connected")}}),i.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{let o=window.cast.framework.CastState;switch(t.castState){case o.NO_DEVICES_AVAILABLE:e.onCastAvailable?.(!1);break;case o.NOT_CONNECTED:case o.CONNECTING:case o.CONNECTED:e.onCastAvailable?.(!0)}}),t=!0,a()}else i(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(c=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise((e,t)=>{let o=document.createElement("script");o.src=c,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(i)})}catch(t){throw i.notice.show="Failed to initialize Cast API",e.onError?.(t),t}let c=window.cast.framework.CastContext.getInstance();if(o)a(i,o);else try{let e=await c.requestSession();a(i,e)}catch(t){throw i.notice.show="Error connecting to cast session",e.onError?.(t),t}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}r.defineInteropFlag(o),r.export(o,"default",()=>a),"u">typeof window&&(window.artplayerPluginChromecast=a)},{"@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"6ykb1":[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[o]}})}),t},o.export=function(e,t,o){Object.defineProperty(e,t,{enumerable:!0,get:o})}},{}]},["18Aaf"],"18Aaf","parcelRequire4dc0",{}); \ No newline at end of file diff --git a/packages/artplayer-plugin-chromecast/dist/artplayer-plugin-chromecast.legacy.js b/packages/artplayer-plugin-chromecast/dist/artplayer-plugin-chromecast.legacy.js index aa5942ce6..e3f77aa9a 100644 --- a/packages/artplayer-plugin-chromecast/dist/artplayer-plugin-chromecast.legacy.js +++ b/packages/artplayer-plugin-chromecast/dist/artplayer-plugin-chromecast.legacy.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-chromecast.js v1.0.1 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,o,i,c,a){var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof u[n]&&u[n],l=s.i||{},f=s.cache||{},p="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!f[t]){if(!e[t]){if(o[t])return o[t];var i="function"==typeof u[n]&&u[n];if(!r&&i)return i(t,!0);if(s)return s(t,!0);if(p&&"string"==typeof t)return p(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}l.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},l.cache={};var a=f[t]=new d.Module(t);e[t][0].call(a.exports,l,a,a.exports,u)}return f[t].exports;function l(e){var t=l.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],o=e[2]||e[0],i=d(n);"*"===t?Object.keys(i).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return i[e]}})}):"*"===o?Object.defineProperty(r,t,{enumerable:!0,value:i}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===o?i.__esModule?i.default:i:i[o]}})}),r}return d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.require=p,this.exports={}},d.modules=e,d.cache=f,d.parent=s,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 u[n]}}),u[n]=d;for(var _=0;_'.concat(e.icon||'',""),click:function(){return(0,i._)(function(){var i,s,l,f,p;return(0,c._)(this,function(c){switch(c.label){case 0:if(t)return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,new Promise(function(i,c){var a;window.__onGCastApiAvailable=function(a){if(a){var u=window.cast.framework.CastContext.getInstance();u.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),u.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,function(t){var i,c,a,u,s,l=window.cast.framework.SessionState;switch(n=t.sessionState,r=t.session,t.sessionState){case l.NO_SESSION:null==(i=e.onStateChange)||i.call(e,"disconnected"),o("disconnected");break;case l.SESSION_STARTING:null==(c=e.onStateChange)||c.call(e,"connecting"),o("connecting");break;case l.SESSION_STARTED:null==(a=e.onStateChange)||a.call(e,"connected"),o("connected");break;case l.SESSION_ENDING:null==(u=e.onStateChange)||u.call(e,"disconnecting"),o("disconnecting");break;case l.SESSION_RESUMED:null==(s=e.onStateChange)||s.call(e,"connected"),o("connected")}}),u.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,function(t){var r,n,o,i=window.cast.framework.CastState;switch(t.castState){case i.NO_DEVICES_AVAILABLE:null==(r=e.onCastAvailable)||r.call(e,!1);break;case i.NOT_CONNECTED:null==(n=e.onCastAvailable)||n.call(e,!0);break;case i.CONNECTING:case i.CONNECTED:null==(o=e.onCastAvailable)||o.call(e,!0)}}),t=!0,i()}else c(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(a=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise(function(e,t){var r=document.createElement("script");r.src=a,r.onload=e,r.onerror=t,document.body.appendChild(r)})).catch(c)})];case 2:return c.sent(),[3,4];case 3:throw i=c.sent(),u.notice.show="Failed to initialize Cast API",null==(s=e.onError)||s.call(e,i),i;case 4:if(l=window.cast.framework.CastContext.getInstance(),!r)return[3,5];return a(u,r),[3,8];case 5:return c.trys.push([5,7,,8]),[4,l.requestSession()];case 6:return a(u,c.sent()),[3,8];case 7:throw f=c.sent(),u.notice.show="Error connecting to cast session",null==(p=e.onError)||p.call(e,f),f;case 8:return[2]}})})()}}),[2,{name:"artplayerPluginChromecast",getCastState:function(){return n},isCasting:function(){return null!==r}}]})})()}}"undefined"!=typeof window&&(window.artplayerPluginChromecast=a)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,r,n){"use strict";function o(e,t,r,n,o,i,c){try{var a=e[i](c),u=a.value}catch(e){r(e);return}a.done?t(u):Promise.resolve(u).then(n,o)}r._=function(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var c=e.apply(t,r);function a(e){o(c,n,i,a,u,"next",e)}function u(e){o(c,n,i,a,u,"throw",e)}a(void 0)})}}},{}],eltGh:[function(e,t,r,n){"use strict";r._=e("eb260df52bffddd").__generator},{eb260df52bffddd:"6yrAu"}],"6yrAu":[function(e,t,r,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"__extends",function(){return a}),o.export(r,"__assign",function(){return u}),o.export(r,"__rest",function(){return s}),o.export(r,"__decorate",function(){return l}),o.export(r,"__param",function(){return f}),o.export(r,"__esDecorate",function(){return p}),o.export(r,"__runInitializers",function(){return d}),o.export(r,"__propKey",function(){return _}),o.export(r,"__setFunctionName",function(){return y}),o.export(r,"__metadata",function(){return h}),o.export(r,"__awaiter",function(){return v}),o.export(r,"__generator",function(){return w}),o.export(r,"__createBinding",function(){return m}),o.export(r,"__exportStar",function(){return b}),o.export(r,"__values",function(){return g}),o.export(r,"__read",function(){return x}),o.export(r,"__spread",function(){return j}),o.export(r,"__spreadArrays",function(){return O}),o.export(r,"__spreadArray",function(){return S}),o.export(r,"__await",function(){return E}),o.export(r,"__asyncGenerator",function(){return P}),o.export(r,"__asyncDelegator",function(){return C}),o.export(r,"__asyncValues",function(){return I}),o.export(r,"__makeTemplateObject",function(){return T}),o.export(r,"__importStar",function(){return D}),o.export(r,"__importDefault",function(){return N}),o.export(r,"__classPrivateFieldGet",function(){return R}),o.export(r,"__classPrivateFieldSet",function(){return M}),o.export(r,"__classPrivateFieldIn",function(){return G}),o.export(r,"__addDisposableResource",function(){return F}),o.export(r,"__disposeResources",function(){return L}),o.export(r,"__rewriteRelativeImportExtension",function(){return z});var i=e("@swc/helpers/cjs/_type_of.cjs"),c=function(e,t){return(c=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=function(){return(u=Object.assign||function(e){for(var t,r=1,n=arguments.length;rt.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);ot.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function l(e,t,r,n){var o,c=arguments.length,a=c<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if(("undefined"==typeof Reflect?"undefined":(0,i._)(Reflect))==="object"&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(c<3?o(a):c>3?o(t,r,a):o(t,r))||a);return c>3&&a&&Object.defineProperty(t,r,a),a}function f(e,t){return function(r,n){t(r,n,e)}}function p(e,t,r,n,o,c){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var u,s=n.kind,l="getter"===s?"get":"setter"===s?"set":"value",f=!t&&e?n.static?e:e.prototype:null,p=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),d=!1,_=r.length-1;_>=0;_--){var y={};for(var h in n)y[h]="access"===h?{}:n[h];for(var h in n.access)y.access[h]=n.access[h];y.addInitializer=function(e){if(d)throw TypeError("Cannot add initializers after decoration has completed");c.push(a(e||null))};var v=(0,r[_])("accessor"===s?{get:p.get,set:p.set}:p[l],y);if("accessor"===s){if(void 0===v)continue;if(null===v||(void 0===v?"undefined":(0,i._)(v))!=="object")throw TypeError("Object expected");(u=a(v.get))&&(p.get=u),(u=a(v.set))&&(p.set=u),(u=a(v.init))&&o.unshift(u)}else(u=a(v))&&("field"===s?o.unshift(u):p[l]=u)}f&&Object.defineProperty(f,n.name,p),d=!0}function d(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])&&(6===s[0]||2===s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)c.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return c}function j(){for(var e=[],t=0;t1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{var r;(r=o[e](t)).value instanceof E?Promise.resolve(r.value.v).then(u,s):l(i[0][2],r)}catch(e){l(i[0][3],e)}}function u(e){a("next",e)}function s(e){a("throw",e)}function l(e,t){e(t),i.shift(),i.length&&a(i[0][0],i[0][1])}}function C(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:E(e[n](t)),done:!1}:o?o(t):t}:o}}function I(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=g(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,o){var i,c,a;i=n,c=o,a=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){i({value:e,done:a})},c)})}}}function T(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var A=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},k=function(e){return(k=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function D(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=k(e),n=0;ntypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof s[r]&&s[r],u=l.i||{},f=l.cache||{},d="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,n){if(!f[t]){if(!e[t]){if(o[t])return o[t];var a="function"==typeof s[r]&&s[r];if(!n&&a)return a(t,!0);if(l)return l(t,!0);if(d&&"string"==typeof t)return d(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}u.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},u.cache={};var i=f[t]=new p.Module(t);e[t][0].call(i.exports,u,i,i.exports,s)}return f[t].exports;function u(e){var t=u.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var n={__esModule:!0};return t.forEach(function(e){var t=e[0],r=e[1],o=e[2]||e[0],a=p(r);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===o?Object.defineProperty(n,t,{enumerable:!0,value:a}):Object.defineProperty(n,t,{enumerable:!0,get:function(){return"default"===o?a.__esModule?a.default:a:a[o]}})}),n}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=d,this.exports={}},p.modules=e,p.cache=f,p.parent=l,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=u,p.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(p,"root",{get:function(){return s[r]}}),s[r]=p;for(var w=0;wtypeof module?module.exports=h:"function"==typeof define&&define.amd&&define(function(){return h})}}({"1xnGs":[function(e,t,n,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",function(){return i});var a=e("@swc/helpers/cjs/_async_to_generator.cjs"),c=e("@swc/helpers/cjs/_ts_generator.cjs");function i(e){var t=!1,n=null,r=null,o=function(e){var t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},i=function(t,n){var r=e.url||t.option.url,o=new window.chrome.cast.media.MediaInfo(r,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[r.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),a=new window.chrome.cast.media.LoadRequest(o);n.loadMedia(a).then(function(){var n;t.notice.show="Casting started",null==(n=e.onCastStart)||n.call(e)}).catch(function(n){var r;throw t.notice.show="Error casting media",null==(r=e.onError)||r.call(e,n),n})};return function(s){return(0,a._)(function(){return(0,c._)(this,function(l){return s.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:''.concat(e.icon||'',""),click:function(){return(0,a._)(function(){var a,l,u,f,d;return(0,c._)(this,function(c){switch(c.label){case 0:if(t)return[3,4];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,new Promise(function(a,c){var i;window.__onGCastApiAvailable=function(i){if(i){var s=window.cast.framework.CastContext.getInstance();s.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),s.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,function(t){var a,c,i,s,l,u=window.cast.framework.SessionState;switch(r=t.sessionState,n=t.session,t.sessionState){case u.NO_SESSION:null==(a=e.onStateChange)||a.call(e,"disconnected"),o("disconnected");break;case u.SESSION_STARTING:null==(c=e.onStateChange)||c.call(e,"connecting"),o("connecting");break;case u.SESSION_STARTED:null==(i=e.onStateChange)||i.call(e,"connected"),o("connected");break;case u.SESSION_ENDING:null==(s=e.onStateChange)||s.call(e,"disconnecting"),o("disconnecting");break;case u.SESSION_RESUMED:null==(l=e.onStateChange)||l.call(e,"connected"),o("connected")}}),s.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,function(t){var n,r,o,a=window.cast.framework.CastState;switch(t.castState){case a.NO_DEVICES_AVAILABLE:null==(n=e.onCastAvailable)||n.call(e,!1);break;case a.NOT_CONNECTED:null==(r=e.onCastAvailable)||r.call(e,!0);break;case a.CONNECTING:case a.CONNECTED:null==(o=e.onCastAvailable)||o.call(e,!0)}}),t=!0,a()}else c(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(i=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise(function(e,t){var n=document.createElement("script");n.src=i,n.onload=e,n.onerror=t,document.body.appendChild(n)})).catch(c)})];case 2:return c.sent(),[3,4];case 3:throw a=c.sent(),s.notice.show="Failed to initialize Cast API",null==(l=e.onError)||l.call(e,a),a;case 4:if(u=window.cast.framework.CastContext.getInstance(),!n)return[3,5];return i(s,n),[3,8];case 5:return c.trys.push([5,7,,8]),[4,u.requestSession()];case 6:return i(s,c.sent()),[3,8];case 7:throw f=c.sent(),s.notice.show="Error connecting to cast session",null==(d=e.onError)||d.call(e,f),f;case 8:return[2]}})})()}}),[2,{name:"artplayerPluginChromecast",getCastState:function(){return r},isCasting:function(){return null!==n}}]})})()}}"u">typeof window&&(window.artplayerPluginChromecast=i)},{"@swc/helpers/cjs/_async_to_generator.cjs":"cZn0e","@swc/helpers/cjs/_ts_generator.cjs":"eltGh","@parcel/transformer-js/src/esmodule-helpers.js":"qpMMf"}],cZn0e:[function(e,t,n,r){"use strict";function o(e,t,n,r,o,a,c){try{var i=e[a](c),s=i.value}catch(e){n(e);return}i.done?t(s):Promise.resolve(s).then(r,o)}n._=function(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var c=e.apply(t,n);function i(e){o(c,r,a,i,s,"next",e)}function s(e){o(c,r,a,i,s,"throw",e)}i(void 0)})}}},{}],eltGh:[function(e,t,n,r){"use strict";n._=function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(c,"next",{value:s(0)}),i(c,"throw",{value:s(1)}),i(c,"return",{value:s(2)}),"function"==typeof Symbol&&i(c,Symbol.iterator,{value:function(){return this}}),c;function s(i){return function(s){var l=[i,s];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]{let t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},i=(t,o)=>{let n=e.url||t.option.url,r=new window.chrome.cast.media.MediaInfo(n,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[n.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),i=new window.chrome.cast.media.LoadRequest(r);o.loadMedia(i).then(()=>{t.notice.show="Casting started",e.onCastStart?.()}).catch(o=>{throw t.notice.show="Error casting media",e.onError?.(o),o})};return async a=>(a.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:`${e.icon||''}`,click:async()=>{if(!t)try{await new Promise((i,a)=>{var c;window.__onGCastApiAvailable=c=>{if(c){let a=window.cast.framework.CastContext.getInstance();a.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),a.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=>{let i=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case i.NO_SESSION:e.onStateChange?.("disconnected"),r("disconnected");break;case i.SESSION_STARTING:e.onStateChange?.("connecting"),r("connecting");break;case i.SESSION_STARTED:e.onStateChange?.("connected"),r("connected");break;case i.SESSION_ENDING:e.onStateChange?.("disconnecting"),r("disconnecting");break;case i.SESSION_RESUMED:e.onStateChange?.("connected"),r("connected")}}),a.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{let o=window.cast.framework.CastState;switch(t.castState){case o.NO_DEVICES_AVAILABLE:e.onCastAvailable?.(!1);break;case o.NOT_CONNECTED:case o.CONNECTING:case o.CONNECTED:e.onCastAvailable?.(!0)}}),t=!0,i()}else a(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(c=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise((e,t)=>{let o=document.createElement("script");o.src=c,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(a)})}catch(t){throw a.notice.show="Failed to initialize Cast API",e.onError?.(t),t}let c=window.cast.framework.CastContext.getInstance();if(o)i(a,o);else try{let e=await c.requestSession();i(a,e)}catch(t){throw a.notice.show="Error connecting to cast session",e.onError?.(t),t}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}r.defineInteropFlag(o),r.export(o,"default",()=>i),"undefined"!=typeof window&&(window.artplayerPluginChromecast=i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[o]}})}),t},o.export=function(e,t,o){Object.defineProperty(e,t,{enumerable:!0,get:o})}},{}]},["2IQmJ"],"2IQmJ","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("2IQmJ");export{e as default}; \ No newline at end of file +!function(e,t,o,n,r,a,i,c){var s="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:"u">typeof global?global:{},l="function"==typeof s[n]&&s[n],d=l.i||{},u=l.cache||{},f="u">typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,o){if(!u[t]){if(!e[t]){if(r[t])return r[t];var a="function"==typeof s[n]&&s[n];if(!o&&a)return a(t,!0);if(l)return l(t,!0);if(f&&"string"==typeof t)return f(t);var i=Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}d.resolve=function(o){var n=e[t][1][o];return null!=n?n:o},d.cache={};var c=u[t]=new p.Module(t);e[t][0].call(c.exports,d,c,c.exports,s)}return u[t].exports;function d(e){var t=d.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var o={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],r=e[2]||e[0],a=p(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(o,e)||Object.defineProperty(o,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===r?Object.defineProperty(o,t,{enumerable:!0,value:a}):Object.defineProperty(o,t,{enumerable:!0,get:function(){return"default"===r?a.__esModule?a.default:a:a[r]}})}),o}return p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.require=f,this.exports={}},p.modules=e,p.cache=u,p.parent=l,p.distDir=void 0,p.publicUrl=void 0,p.devServer=void 0,p.i=d,p.register=function(t,o){e[t]=[function(e,t){t.exports=o},{}]},Object.defineProperty(p,"root",{get:function(){return s[n]}}),s[n]=p;for(var w=0;wtypeof module?module.exports=m:"function"==typeof define&&define.amd&&define(function(){return m})}}({"2IQmJ":[function(e,t,o,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function a(e){let t=!1,o=null,n=null,r=e=>{let t=document.querySelector(".art-icon-cast");if(t)switch(e){case"connected":t.style.color="red";break;case"connecting":case"disconnecting":t.style.color="orange";break;default:t.style.color="white"}},a=(t,o)=>{let n=e.url||t.option.url,r=new window.chrome.cast.media.MediaInfo(n,e.mimeType||({mp4:"video/mp4",webm:"video/webm",ogg:"video/ogg",ogv:"video/ogg",mp3:"audio/mp3",wav:"audio/wav",flv:"video/x-flv",mov:"video/quicktime",avi:"video/x-msvideo",wmv:"video/x-ms-wmv",mpd:"application/dash+xml",m3u8:"application/x-mpegURL"})[n.split("?")[0].split("#")[0].split(".").pop().toLowerCase()]||"application/octet-stream"),a=new window.chrome.cast.media.LoadRequest(r);o.loadMedia(a).then(()=>{t.notice.show="Casting started",e.onCastStart?.()}).catch(o=>{throw t.notice.show="Error casting media",e.onError?.(o),o})};return async i=>(i.controls.add({name:"chromecast",position:"right",tooltip:"Chromecast",html:`${e.icon||''}`,click:async()=>{if(!t)try{await new Promise((a,i)=>{var c;window.__onGCastApiAvailable=c=>{if(c){let i=window.cast.framework.CastContext.getInstance();i.setOptions({receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}),i.addEventListener(window.cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t=>{let a=window.cast.framework.SessionState;switch(n=t.sessionState,o=t.session,t.sessionState){case a.NO_SESSION:e.onStateChange?.("disconnected"),r("disconnected");break;case a.SESSION_STARTING:e.onStateChange?.("connecting"),r("connecting");break;case a.SESSION_STARTED:e.onStateChange?.("connected"),r("connected");break;case a.SESSION_ENDING:e.onStateChange?.("disconnecting"),r("disconnecting");break;case a.SESSION_RESUMED:e.onStateChange?.("connected"),r("connected")}}),i.addEventListener(window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,t=>{let o=window.cast.framework.CastState;switch(t.castState){case o.NO_DEVICES_AVAILABLE:e.onCastAvailable?.(!1);break;case o.NOT_CONNECTED:case o.CONNECTING:case o.CONNECTED:e.onCastAvailable?.(!0)}}),t=!0,a()}else i(Error("Cast API is not available"))},window.chrome&&window.chrome.cast||(c=e.sdk||"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",new Promise((e,t)=>{let o=document.createElement("script");o.src=c,o.onload=e,o.onerror=t,document.body.appendChild(o)})).catch(i)})}catch(t){throw i.notice.show="Failed to initialize Cast API",e.onError?.(t),t}let c=window.cast.framework.CastContext.getInstance();if(o)a(i,o);else try{let e=await c.requestSession();a(i,e)}catch(t){throw i.notice.show="Error connecting to cast session",e.onError?.(t),t}}}),{name:"artplayerPluginChromecast",getCastState:()=>n,isCasting:()=>null!==o})}r.defineInteropFlag(o),r.export(o,"default",()=>a),"u">typeof window&&(window.artplayerPluginChromecast=a)},{"@parcel/transformer-js/src/esmodule-helpers.js":"loqXi"}],loqXi:[function(e,t,o,n){o.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},o.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.exportAll=function(e,t){return Object.keys(e).forEach(function(o){"default"===o||"__esModule"===o||Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{enumerable:!0,get:function(){return e[o]}})}),t},o.export=function(e,t,o){Object.defineProperty(e,t,{enumerable:!0,get:o})}},{}]},["2IQmJ"],"2IQmJ","parcelRequire4dc0",{});let{default:e}=parcelRequire4dc0("2IQmJ");export{e as default}; \ No newline at end of file diff --git a/packages/artplayer-plugin-danmuku-mask/dist/artplayer-plugin-danmuku-mask.js b/packages/artplayer-plugin-danmuku-mask/dist/artplayer-plugin-danmuku-mask.js index 9526e118b..d33cc7e28 100644 --- a/packages/artplayer-plugin-danmuku-mask/dist/artplayer-plugin-danmuku-mask.js +++ b/packages/artplayer-plugin-danmuku-mask/dist/artplayer-plugin-danmuku-mask.js @@ -2,7 +2,7 @@ /*! * artplayer-plugin-danmuku-mask.js v1.0.0 * Github: https://github.com/zhw2590582/ArtPlayer - * (c) 2017-2025 Harvey Zack + * (c) 2017-2026 Harvey Zack * Released under the MIT License. */ -!function(e,t,r,n,s,a,o,l){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},p="function"==typeof i[n]&&i[n],u=p.i||{},c=p.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,r){if(!c[t]){if(!e[t]){if(s[t])return s[t];var a="function"==typeof i[n]&&i[n];if(!r&&a)return a(t,!0);if(p)return p(t,!0);if(d&&"string"==typeof t)return d(t);var o=Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}u.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},u.cache={};var l=c[t]=new f.Module(t);e[t][0].call(l.exports,u,l,l.exports,i)}return c[t].exports;function u(e){var t=u.resolve(e);if(!1===t)return{};if(Array.isArray(t)){var r={__esModule:!0};return t.forEach(function(e){var t=e[0],n=e[1],s=e[2]||e[0],a=f(n);"*"===t?Object.keys(a).forEach(function(e){"default"===e||"__esModule"===e||Object.prototype.hasOwnProperty.call(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:function(){return a[e]}})}):"*"===s?Object.defineProperty(r,t,{enumerable:!0,value:a}):Object.defineProperty(r,t,{enumerable:!0,get:function(){return"default"===s?a.__esModule?a.default:a:a[s]}})}),r}return f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.require=d,this.exports={}},f.modules=e,f.cache=c,f.parent=p,f.distDir=void 0,f.publicUrl=void 0,f.devServer=void 0,f.i=u,f.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(f,"root",{get:function(){return i[n]}}),i[n]=f;for(var m=0;ml);var a=e("@tensorflow-models/body-segmentation"),o=e("@tensorflow/tfjs-core");function l(e={}){return t=>{let{template:{$video:r,$danmuku:n}}=t,s=null,l=null,i=null,p=null,u=!1,c={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};async function d(){try{await o.setBackend("webgl")}catch(e){console.warn("WebGL backend not available, falling back to CPU",e.message),await o.setBackend("cpu")}}async function f(){await d();let e=a.SupportedModels.MediaPipeSelfieSegmentation,t={runtime:"mediapipe",modelType:"general",solutionPath:c.solutionPath,modelSelection:c.modelSelection,smoothSegmentation:c.smoothSegmentation,minDetectionConfidence:c.minDetectionConfidence,minTrackingConfidence:c.minTrackingConfidence,selfieMode:c.selfieMode};try{s=await a.createSegmenter(e,t),u=!0}catch(e){console.error("Error initializing segmenter:",e),u=!1}}async function m(){if(!u||r.paused||r.ended){p=requestAnimationFrame(m);return}try{l.width=r.videoWidth,l.height=r.videoHeight;let e=await s.segmentPeople(r);if(!e||0===e.length){p=requestAnimationFrame(m);return}let t=await a.toBinaryMask(e,{r:255,g:255,b:255,a:255},{r:0,g:0,b:0,a:255},c.drawContour,c.foregroundThreshold);await a.drawMask(l,r,t,c.opacity,c.maskBlurAmount);let o=i.getImageData(0,0,l.width,l.height);i.putImageData(function(e){let t=e.data;for(let e=0;e250&&t[e+1]>250&&t[e+2]>250&&(t[e+3]=0);return e}(o),0,0),n.style.maskImage=`url(${l.toDataURL()})`}catch(e){console.error("Error in segmentBody:",e)}p=requestAnimationFrame(m)}async function h(){u||await f(),l||(i=(l=document.createElement("canvas")).getContext("2d")),Object.assign(n.style,{maskMode:"alpha",maskSize:"contain",maskRepeat:"no-repeat",backgroundSize:"contain",backgroundRepeat:"no-repeat"}),m()}function g(){n.style.maskImage="none",p&&(cancelAnimationFrame(p),p=null)}return t.on("ready",h),t.on("destroy",g),{name:"artplayerPluginDanmukuMask",start:h,stop:g}}}e("@tensorflow/tfjs-backend-webgl"),e("@tensorflow/tfjs-backend-cpu"),"undefined"!=typeof window&&(window.artplayerPluginDanmukuMask=l)},{"@tensorflow-models/body-segmentation":"5Otso","@tensorflow/tfjs-core":"2Gtps","@tensorflow/tfjs-backend-webgl":"2ZcDF","@tensorflow/tfjs-backend-cpu":"b4yJT","@parcel/transformer-js/src/esmodule-helpers.js":"6ykb1"}],"5Otso":[function(e,t,r,n){var s,a=e("@parcel/transformer-js/src/esmodule-helpers.js");a.defineInteropFlag(r),a.export(r,"SupportedModels",()=>eR),a.export(r,"blurBodyPart",()=>eJ),a.export(r,"bodyPixMaskValueToRainbowColor",()=>b),a.export(r,"createSegmenter",()=>e$),a.export(r,"drawBokehEffect",()=>eQ),a.export(r,"drawMask",()=>eZ),a.export(r,"drawPixelatedMask",()=>eY),a.export(r,"toBinaryMask",()=>eK),a.export(r,"toColoredMask",()=>eX);var o=e("@tensorflow/tfjs-core"),l=e("@tensorflow/tfjs-converter"),i=e("@mediapipe/selfie_segmentation"),p=function(e,t){return(p=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function u(e,t){function r(){this.constructor=e}p(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var c=function(){return(c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r0&&s[s.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]=256)throw Error("Mask value must be in range [0, 255] but got "+e);if(!Number.isInteger(e))throw Error("Mask value must be an integer but got "+e)}var v=[[110,64,170],[143,61,178],[178,60,178],[210,62,167],[238,67,149],[255,78,125],[255,94,99],[255,115,75],[255,140,56],[239,167,47],[217,194,49],[194,219,64],[175,240,91],[135,245,87],[96,247,96],[64,243,115],[40,234,141],[28,219,169],[26,199,194],[33,176,213],[47,150,224],[65,125,224],[84,101,214],[99,81,195]];function b(e){if(y(e),er&&(s+=1,n+=Math.pow(e[a].x-t.keypoints[a].position.x,2)+Math.pow(e[a].y-t.keypoints[a].position.y,2));return 0===s?n=1/0:n/=s,n}(g,r[_]);I"+u+") {\n numKpt = numKpt + 1;\n curDistSum = curDistSum + dist(x, y, poseX, poseY);\n }\n }\n if (numKpt > 0 && curDistSum / float(numKpt)< minDist) {\n minDist = curDistSum / float(numKpt);\n iMin = i;\n }\n }\n return iMin;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int nearestPose = findNearestPose(coords[0], coords[1]);\n setOutput(float(nearestPose));\n }\n "};return(0,o.backend)().compileAndRun(O,[e,b,R])}function $(){return"webgl"===(0,o.getBackend)()}function O(e){return Math.floor(e/2)}[["leftHip","leftShoulder"],["leftElbow","leftShoulder"],["leftElbow","leftWrist"],["leftHip","leftKnee"],["leftKnee","leftAnkle"],["rightHip","rightShoulder"],["rightElbow","rightShoulder"],["rightElbow","rightWrist"],["rightHip","rightKnee"],["rightKnee","rightAnkle"],["leftShoulder","rightShoulder"],["leftHip","rightHip"]].map(function(e){var t=e[0],r=e[1];return[S[t],S[r]]});var D=function(){function e(e,t){this.priorityQueue=Array(e),this.numberOfElements=-1,this.getElementValue=t}return e.prototype.enqueue=function(e){this.priorityQueue[++this.numberOfElements]=e,this.swim(this.numberOfElements)},e.prototype.dequeue=function(){var e=this.priorityQueue[0];return this.exchange(0,this.numberOfElements--),this.sink(0),this.priorityQueue[this.numberOfElements+1]=null,e},e.prototype.empty=function(){return -1===this.numberOfElements},e.prototype.size=function(){return this.numberOfElements+1},e.prototype.all=function(){return this.priorityQueue.slice(0,this.numberOfElements+1)},e.prototype.max=function(){return this.priorityQueue[0]},e.prototype.swim=function(e){for(;e>0&&this.less(O(e),e);)this.exchange(e,O(e)),e=O(e)},e.prototype.sink=function(e){for(;2*e<=this.numberOfElements;){var t=2*e;if(ta?a:s),x:(o=Math.round(e.x/t),l=n-1,o<0?0:o>l?l:o)}}function L(e,t,r,n,s,a,o,l){void 0===l&&(l=2);for(var i,p,u=n.shape,c=u[0],d=u[1],f=(i=V(t.position,a,c,d),p=o.shape[2]/2,{y:o.get(i.y,i.x,e),x:o.get(i.y,i.x,p+e)}),m=F(t.position,f),h=0;ht){p=!1;break}if(!p)break}return p}(u,c,i,p,1,r)&&l.enqueue({score:c,part:{heatmapY:i,heatmapX:p,id:u}})}return l}(o,0,e),u=l*l;i.length=0;--d){var f=B[d],m=G[d];i[f]&&!i[m]&&(i[m]=L(d,i[f],m,t,r,n,a))}for(d=0;d=.1,function(){return"inputResolution must be a string or number between 0.1 and 2, but was "+e}),e}(e);return[Y(n*a,t),Y(s*a,t)]}function et(e,t,r,n,s){var a=t[0],l=t[1],i=r[0],p=r[1],u=n[0],c=u[0],d=u[1],f=n[1],m=f[0],h=f[1];return void 0===s&&(s=!1),(0,o.tidy)(function(){var t,r,n,u,f,g,x,y,v,b,k,_=o.image.resizeBilinear(e,[i,p],!0);return s&&(_=(0,o.sigmoid)(_)),t=_,r=[a,l],n=[[c,d],[m,h]],u=r[0],f=r[1],x=(g=n[0])[0],y=g[1],b=(v=n[1])[0],k=v[1],(0,o.tidy)(function(){var e=(0,o.expandDims)(t);return(0,o.squeeze)(o.image.cropAndResize(e,[[x/(u+x+y-1),b/(f+b+k-1),(x+u-1)/(u+x+y-1),(b+f-1)/(f+b+k-1)]],[0],[u,f]),[0])})})}function er(e,t){var r=t[0],n=t[1],s=Z(e),a=s[0],l=s[1],i=n/r,p=0,u=0,c=0,d=0;return l/a1)throw Error("segmentationThreshold "+t+". Should be in range [0.0, 1.0]");if(r<=0)throw Error("Invalid maxDetections "+r+". Should be >0");if(n<0||n>1)throw Error("Invalid scoreThreshold "+n+". Should be in range [0.0, 1.0]");if(s<=0)throw Error("Invalid nmsRadius "+s+".")}function ef(e){var t=e.segmentationThreshold,r=e.maxDetections,n=e.scoreThreshold,s=e.nmsRadius,a=e.minKeypointScore,o=e.refineSteps;if(t<0||t>1)throw Error("segmentationThreshold "+t+". Should be in range [0.0, 1.0]");if(r<=0)throw Error("Invalid maxDetections "+r+". Should be >0");if(n<0||n>1)throw Error("Invalid scoreThreshold "+n+". Should be in range [0.0, 1.0]");if(s<=0)throw Error("Invalid nmsRadius "+s+".");if(a<0||a>1)throw Error("Invalid minKeypointScore "+a+".Should be in range [0.0, 1.0]");if(o<=0||o>20)throw Error("Invalid refineSteps "+o+".Should be in range [1, 20]")}var em=function(){function e(e){this.baseModel=e}return e.prototype.predictForPersonSegmentation=function(e){var t=this.baseModel.predict(e);return{segmentLogits:t.segmentation,heatmapScores:t.heatmapScores,offsets:t.offsets,displacementFwd:t.displacementFwd,displacementBwd:t.displacementBwd}},e.prototype.predictForPersonSegmentationAndPart=function(e){var t=this.baseModel.predict(e);return{segmentLogits:t.segmentation,partHeatmapLogits:t.partHeatmaps,heatmapScores:t.heatmapScores,offsets:t.offsets,displacementFwd:t.displacementFwd,displacementBwd:t.displacementBwd}},e.prototype.predictForMultiPersonInstanceSegmentationAndPart=function(e){var t=this.baseModel.predict(e);return{segmentLogits:t.segmentation,longOffsets:t.longOffsets,heatmapScores:t.heatmapScores,offsets:t.offsets,displacementFwd:t.displacementFwd,displacementBwd:t.displacementBwd,partHeatmaps:t.partHeatmaps}},e.prototype.segmentPersonActivation=function(e,t,r){var n=this;void 0===r&&(r=.5);var s=Z(e),a=s[0],l=s[1],i=ee(t,this.baseModel.outputStride,[a,l]),p=er(e,i),u=p.resized,c=p.padding,d=(0,o.tidy)(function(){var e=n.predictForPersonSegmentation(u),t=e.segmentLogits,s=e.heatmapScores,i=e.offsets,p=e.displacementFwd,d=e.displacementBwd,f=u.shape,m=et(t,[a,l],[f[0],f[1]],[[c.top,c.bottom],[c.left,c.right]],!0);return{segmentation:_((0,o.squeeze)(m),r),heatmapScores:s,offsets:i,displacementFwd:p,displacementBwd:d}}),f=d.segmentation,m=d.heatmapScores,h=d.offsets,g=d.displacementFwd,x=d.displacementBwd;return u.dispose(),{segmentation:f,heatmapScores:m,offsets:h,displacementFwd:g,displacementBwd:x,padding:c,internalResolutionHeightAndWidth:i}},e.prototype.segmentPerson=function(e,t){return void 0===t&&(t=eu),d(this,void 0,void 0,function(){var r,n,s,a,o,l,i,p,u,d,m,h,g,x,y,v;return f(this,function(f){switch(f.label){case 0:return ed(t=c(c({},eu),t)),n=(r=this.segmentPersonActivation(e,t.internalResolution,t.segmentationThreshold)).segmentation,s=r.heatmapScores,a=r.offsets,o=r.displacementFwd,l=r.displacementBwd,i=r.padding,p=r.internalResolutionHeightAndWidth,d=(u=n.shape)[0],m=u[1],[4,n.data()];case 1:return h=f.sent(),n.dispose(),[4,en([s,a,o,l])];case 2:return x=(g=f.sent())[0],y=g[1],v=es(v=U(x,y,g[2],g[3],this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[d,m],p,i,!1),s.dispose(),a.dispose(),o.dispose(),l.dispose(),[2,{height:d,width:m,data:h,allPoses:v}]}})})},e.prototype.segmentMultiPerson=function(e,t){return void 0===t&&(t=ec),d(this,void 0,void 0,function(){var r,n,s,a,l,i,p,u,m,h,g,x,y,v,b,k,I,j,w,T=this;return f(this,function(S){switch(S.label){case 0:return ef(t=c(c({},ec),t)),n=(r=Z(e))[0],s=r[1],i=(l=er(e,a=ee(t.internalResolution,this.baseModel.outputStride,[n,s]))).resized,p=l.padding,m=(u=(0,o.tidy)(function(){var e=T.predictForMultiPersonInstanceSegmentationAndPart(i),r=e.segmentLogits,l=e.longOffsets,u=e.heatmapScores,c=e.offsets,d=e.displacementFwd,f=e.displacementBwd,m=et(r,[n,s],a,[[p.top,p.bottom],[p.left,p.right]],!0);return{segmentation:_((0,o.squeeze)(m),t.segmentationThreshold),longOffsets:l,heatmapScoresRaw:u,offsetsRaw:c,displacementFwdRaw:d,displacementBwdRaw:f}})).segmentation,h=u.longOffsets,g=u.heatmapScoresRaw,x=u.offsetsRaw,y=u.displacementFwdRaw,v=u.displacementBwdRaw,[4,en([g,x,y,v])];case 1:return k=(b=S.sent())[0],I=b[1],j=es(j=U(k,I,b[2],b[3],this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[n,s],a,p,!1),[4,function(e,t,r,n,s,a,l,i,p,u,c,m){var h=l[0],g=l[1];return void 0===p&&(p=.2),void 0===u&&(u=8),void 0===c&&(c=.3),void 0===m&&(m=10),d(this,void 0,void 0,function(){var l,d,x,y,v;return f(this,function(f){switch(f.label){case 0:return l=r.filter(function(e){return e.score>=p}),$()?[4,Promise.all((x=(0,o.tidy)(function(){var r=P(e,t,l,n,s,a,[h,g],i,u,c,m),p=(0,o.engine)().makeTensorFromDataId(r.dataId,r.shape,r.dtype);return l.map(function(e,t){return(0,o.tidy)(function(){return(0,o.cast)((0,o.equal)(p,(0,o.scalar)(t)),"int32")})})})).map(function(e){return e.data()}))]:[3,2];case 1:return d=f.sent(),x.forEach(function(e){return e.dispose()}),[3,5];case 2:return[4,e.data()];case 3:return y=f.sent(),[4,t.data()];case 4:v=f.sent(),d=function(e,t,r,n,s,a,o,l,i,p){var u=o[0],c=o[1];void 0===p&&(p=5);for(var d=r.map(function(e){return new Uint8Array(n*s).fill(0)}),f=l.top,m=l.left,h=C([n,s],[u,c],l),g=h[0],x=h[1],y=R([u,c],a)[0],v=0;v=0&&(d[_][k]=1)}}return d}(y,v,l,n,s,a,[h,g],i,u),f.label=5;case 5:return[2,d.map(function(e,t){return{data:e,pose:l[t],width:s,height:n}})]}})})}(m,h,j,n,s,this.baseModel.outputStride,a,p,t.scoreThreshold,t.refineSteps,t.minKeypointScore,t.maxDetections)];case 2:return w=S.sent(),i.dispose(),m.dispose(),h.dispose(),g.dispose(),x.dispose(),y.dispose(),v.dispose(),[2,w]}})})},e.prototype.segmentPersonPartsActivation=function(e,t,r){var n=this;void 0===r&&(r=.5);var s=Z(e),a=s[0],l=s[1],i=ee(t,this.baseModel.outputStride,[a,l]),p=er(e,i),u=p.resized,c=p.padding,d=(0,o.tidy)(function(){var e,t,s,i,p,d=n.predictForPersonSegmentationAndPart(u),f=d.segmentLogits,m=d.partHeatmapLogits,h=d.heatmapScores,g=d.offsets,x=d.displacementFwd,y=d.displacementBwd,v=u.shape,b=v[0],I=v[1],j=et(f,[a,l],[b,I],[[c.top,c.bottom],[c.left,c.right]],!0),w=et(m,[a,l],[b,I],[[c.top,c.bottom],[c.left,c.right]],!0);return{partSegmentation:(e=_((0,o.squeeze)(j),r),s=(t=w.shape)[0],i=t[1],p=t[2],(0,o.tidy)(function(){var t=k(w),r=(0,o.expandDims)((0,o.range)(0,p,1,"int32"),1),n=(0,o.cast)((0,o.matMul)(t,r),"int32"),a=(0,o.reshape)(n,[s,i]),l=(0,o.add)(a,(0,o.scalar)(1,"int32"));return(0,o.sub)((0,o.mul)(l,e),(0,o.scalar)(1,"int32"))})),heatmapScores:h,offsets:g,displacementFwd:x,displacementBwd:y}}),f=d.partSegmentation,m=d.heatmapScores,h=d.offsets,g=d.displacementFwd,x=d.displacementBwd;return u.dispose(),{partSegmentation:f,heatmapScores:m,offsets:h,displacementFwd:g,displacementBwd:x,padding:c,internalResolutionHeightAndWidth:i}},e.prototype.segmentPersonParts=function(e,t){return void 0===t&&(t=eu),d(this,void 0,void 0,function(){var r,n,s,a,o,l,i,p,u,d,m,h,g,x,y,v;return f(this,function(f){switch(f.label){case 0:return ed(t=c(c({},eu),t)),n=(r=this.segmentPersonPartsActivation(e,t.internalResolution,t.segmentationThreshold)).partSegmentation,s=r.heatmapScores,a=r.offsets,o=r.displacementFwd,l=r.displacementBwd,i=r.padding,p=r.internalResolutionHeightAndWidth,d=(u=n.shape)[0],m=u[1],[4,n.data()];case 1:return h=f.sent(),n.dispose(),[4,en([s,a,o,l])];case 2:return x=(g=f.sent())[0],y=g[1],v=es(v=U(x,y,g[2],g[3],this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[d,m],p,i,!1),s.dispose(),a.dispose(),o.dispose(),l.dispose(),[2,{height:d,width:m,data:h,allPoses:v}]}})})},e.prototype.segmentMultiPersonParts=function(e,t){return void 0===t&&(t=ec),d(this,void 0,void 0,function(){var r,n,s,a,l,i,p,u,m,h,g,x,y,v,b,I,j,w,T,S,N=this;return f(this,function(E){switch(E.label){case 0:return ef(t=c(c({},ec),t)),n=(r=Z(e))[0],s=r[1],i=(l=er(e,a=ee(t.internalResolution,this.baseModel.outputStride,[n,s]))).resized,p=l.padding,m=(u=(0,o.tidy)(function(){var e,r,l,u,c=N.predictForMultiPersonInstanceSegmentationAndPart(i),d=c.segmentLogits,f=c.longOffsets,m=c.heatmapScores,h=c.offsets,g=c.displacementFwd,x=c.displacementBwd,y=c.partHeatmaps,v=et(d,[n,s],a,[[p.top,p.bottom],[p.left,p.right]],!0),b=et(y,[n,s],a,[[p.top,p.bottom],[p.left,p.right]],!0);return{segmentation:_((0,o.squeeze)(v),t.segmentationThreshold),longOffsets:f,heatmapScoresRaw:m,offsetsRaw:h,displacementFwdRaw:g,displacementBwdRaw:x,partSegmentation:(r=(e=b.shape)[0],l=e[1],u=e[2],(0,o.tidy)(function(){var e=k(b),t=(0,o.expandDims)((0,o.range)(0,u,1,"int32"),1),n=(0,o.cast)((0,o.matMul)(e,t),"int32");return(0,o.reshape)(n,[r,l])}))}})).segmentation,h=u.longOffsets,g=u.heatmapScoresRaw,x=u.offsetsRaw,y=u.displacementFwdRaw,v=u.displacementBwdRaw,b=u.partSegmentation,[4,en([g,x,y,v])];case 1:return j=(I=E.sent())[0],w=I[1],T=es(T=U(j,w,I[2],I[3],this.baseModel.outputStride,t.maxDetections,t.scoreThreshold,t.nmsRadius),[n,s],a,p,!1),[4,function(e,t,r,n,s,a,l,i,p,u,c,m,h){var g=i[0],x=i[1];return void 0===u&&(u=.2),void 0===c&&(c=8),void 0===m&&(m=.3),void 0===h&&(h=10),d(this,void 0,void 0,function(){var i,d,y,v,b,k;return f(this,function(f){switch(f.label){case 0:return i=n.filter(function(e){return e.score>=u}),$()?[4,Promise.all((y=(0,o.tidy)(function(){var n=P(e,t,i,s,a,l,[g,x],p,c,m,h),u=(0,o.engine)().makeTensorFromDataId(n.dataId,n.shape,n.dtype);return i.map(function(e,t){return(0,o.tidy)(function(){return(0,o.sub)((0,o.mul)((0,o.cast)((0,o.equal)(u,(0,o.scalar)(t)),"int32"),(0,o.add)(r,1)),1)})})})).map(function(e){return e.data()}))]:[3,2];case 1:return d=f.sent(),y.forEach(function(e){return e.dispose()}),[3,6];case 2:return[4,e.data()];case 3:return v=f.sent(),[4,t.data()];case 4:return b=f.sent(),[4,r.data()];case 5:k=f.sent(),d=function(e,t,r,n,s,a,o,l,i,p,u){var c=l[0],d=l[1];void 0===u&&(u=5);for(var f=n.map(function(e){return new Int32Array(s*a).fill(-1)}),m=i.top,h=i.left,g=C([s,a],[c,d],i),x=g[0],y=g[1],v=R([c,d],o)[0],b=0;b=0&&(f[I][_]=r[_])}}return f}(v,b,k,i,s,a,l,[g,x],p,c),f.label=6;case 6:return[2,d.map(function(e,t){return{pose:i[t],data:e,height:s,width:a}})]}})})}(m,h,b,T,n,s,this.baseModel.outputStride,a,p,t.scoreThreshold,t.refineSteps,t.minKeypointScore,t.maxDetections)];case 2:return S=E.sent(),i.dispose(),m.dispose(),h.dispose(),g.dispose(),x.dispose(),y.dispose(),v.dispose(),b.dispose(),[2,S]}})})},e.prototype.dispose=function(){this.baseModel.dispose()},e}(),eh=["left_face","right_face","left_upper_arm_front","left_upper_arm_back","right_upper_arm_front","right_upper_arm_back","left_lower_arm_front","left_lower_arm_back","right_lower_arm_front","right_lower_arm_back","left_hand","right_hand","torso_front","torso_back","left_upper_leg_front","left_upper_leg_back","right_upper_leg_front","right_upper_leg_back","left_lower_leg_front","left_lower_leg_back","right_lower_leg_front","right_lower_leg_back","left_feet","right_feet"],eg=function(){function e(e){this.mask=e}return e.prototype.toCanvasImageSource=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,h(this.mask)]})})},e.prototype.toImageData=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,this.mask]})})},e.prototype.toTensor=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,x(this.mask)]})})},e.prototype.getUnderlyingType=function(){return"imagedata"},e}();function ex(e){if(y(e),255!==e)throw Error("Foreground id must be 255 but got "+e);return"person"}function ey(e){if(y(e),e>=eh.length)throw Error("Invalid body part value "+e);return eh[e]}var ev=function(){function e(e){this.bodyPixModel=e}return e.prototype.segmentPeople=function(e,t){return d(this,void 0,void 0,function(){var r,n,s,a;return f(this,function(o){switch(o.label){case 0:return e instanceof ImageBitmap&&((r=document.createElement("canvas")).getContext("2d").drawImage(e,0,0),e=r),t.segmentBodyParts?t.multiSegmentation?[4,this.bodyPixModel.segmentMultiPersonParts(e,t)]:[3,2]:[3,5];case 1:return s=o.sent(),[3,4];case 2:return[4,this.bodyPixModel.segmentPersonParts(e,t)];case 3:s=[o.sent()],o.label=4;case 4:return n=s.map(function(e){var t=e.data,r=e.width,n=e.height,s=new Uint8ClampedArray(r*n*4).fill(0);return t.forEach(function(e,t){-1===e?(s[4*t]=eh.length,s[4*t+3]=0):(s[4*t]=e,s[4*t+3]=255)}),{maskValueToLabel:ey,mask:new eg(new ImageData(s,r,n))}}),[3,10];case 5:return t.multiSegmentation?[4,this.bodyPixModel.segmentMultiPerson(e,t)]:[3,7];case 6:return a=o.sent(),[3,9];case 7:return[4,this.bodyPixModel.segmentPerson(e,t)];case 8:a=[o.sent()],o.label=9;case 9:n=a.map(function(e){var t=e.data,r=e.width,n=e.height,s=new Uint8ClampedArray(r*n*4).fill(0);return t.forEach(function(e,t){0===e?(s[4*t]=0,s[4*t+3]=0):(s[4*t]=255,s[4*t+3]=255)}),{maskValueToLabel:ex,mask:new eg(new ImageData(s,r,n))}}),o.label=10;case 10:return[2,n]}})})},e.prototype.dispose=function(){this.bodyPixModel.dispose()},e.prototype.reset=function(){},e}(),eb={runtime:"mediapipe",modelType:"general"},ek=function(){function e(e){this.mask=e}return e.prototype.toCanvasImageSource=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,this.mask]})})},e.prototype.toImageData=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,g(this.mask)]})})},e.prototype.toTensor=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,x(this.mask)]})})},e.prototype.getUnderlyingType=function(){return"canvasimagesource"},e}();function e_(e){return y(e),"person"}var eI=function(){function e(e){var t,r,n=this;this.selfieMode=!1,t=+(this.selfieSegmentationSolution=new(0,i.SelfieSegmentation)({locateFile:null!=(r=e.locateFile)?r:function(t,r){return e.solutionPath?e.solutionPath.replace(/\/+$/,"")+"/"+t:r+"/"+t}}),"landscape"===e.modelType),this.selfieSegmentationSolution.setOptions({modelSelection:t,selfieMode:this.selfieMode}),this.selfieSegmentationSolution.onResults(function(e){n.segmentation=[{maskValueToLabel:e_,mask:new ek(e.segmentationMask)}]})}return e.prototype.segmentPeople=function(e,t){return d(this,void 0,void 0,function(){var r,n;return f(this,function(s){switch(s.label){case 0:return t&&t.flipHorizontal&&t.flipHorizontal!==this.selfieMode&&(this.selfieMode=t.flipHorizontal,this.selfieSegmentationSolution.setOptions({selfieMode:this.selfieMode})),e instanceof o.Tensor?(n=ImageData.bind,[4,o.browser.toPixels(e)]):[3,2];case 1:return r=new(n.apply(ImageData,[void 0,s.sent(),e.shape[1],e.shape[0]])),[3,3];case 2:r=e,s.label=3;case 3:return e=r,[4,this.selfieSegmentationSolution.send({image:e})];case 4:return s.sent(),[2,this.segmentation]}})})},e.prototype.dispose=function(){this.selfieSegmentationSolution.close()},e.prototype.reset=function(){this.selfieSegmentationSolution.reset(),this.segmentation=null,this.selfieMode=!1},e.prototype.initialize=function(){return this.selfieSegmentationSolution.initialize()},e}();function ej(e){return e instanceof o.Tensor?{height:e.shape[0],width:e.shape[1]}:{height:e.height,width:e.width}}function ew(e,t){o.util.assert(0!==e.width,function(){return t+" width cannot be 0."}),o.util.assert(0!==e.height,function(){return t+" height cannot be 0."})}var eT={runtime:"tfjs",modelType:"general",modelUrl:"https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1"},eS={flipHorizontal:!1},eC={outputTensorSize:{width:256,height:256},keepAspectRatio:!1,borderMode:"zero",outputTensorFloatRange:[0,1]},eN={outputTensorSize:{width:256,height:144},keepAspectRatio:!1,borderMode:"zero",outputTensorFloatRange:[0,1]},eE={activation:"none"},eF=function(){function e(e){this.mask=e}return e.prototype.toCanvasImageSource=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,h(this.mask)]})})},e.prototype.toImageData=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,g(this.mask)]})})},e.prototype.toTensor=function(){return d(this,void 0,void 0,function(){return f(this,function(e){return[2,this.mask]})})},e.prototype.getUnderlyingType=function(){return"tensor"},e}();function eA(e){return y(e),"person"}var eR,eP=function(){function e(e,t){this.modelType=e,this.model=t}return e.prototype.segmentPeople=function(e,t){return d(this,void 0,void 0,function(){var r=this;return f(this,function(n){return t=function(e){if(null==e)return c({},eS);var t=c({},e);return null==t.flipHorizontal&&(t.flipHorizontal=eS.flipHorizontal),t}(t),null==e?(this.reset(),[2,[]]):[2,[{maskValueToLabel:eA,mask:new eF((0,o.tidy)(function(){var t,n,s,a,l,i,p,u,c,d,f,m,h,g,x,y,v,b,k,_,I,j,w=(x=(t="general"===r.modelType?eC:eN).outputTensorSize,y=t.keepAspectRatio,v=t.borderMode,b=t.outputTensorFloatRange,I=function(e,t,r){if(void 0===r&&(r=!1),!r)return{top:0,left:0,right:0,bottom:0};var n=t.height,s=t.width;ew(t,"targetSize"),ew(e,"roi");var a,o,l=n/s,i=e.height/e.width,p=0,u=0;return l>i?(a=e.width,o=e.width*l,u=(1-i/l)/2):(a=e.height/l,o=e.height,p=(1-l/i)/2),e.width=a,e.height=o,{top:u,left:p,right:p,bottom:u}}((n=k=ej(e),_={xCenter:.5*n.width,yCenter:.5*n.height,width:n.width,height:n.height,rotation:0}),x,y),s=k.width,a=k.height,l=_.width,i=_.height,p=1,u=Math.cos(_.rotation),c=Math.sin(_.rotation),d=_.xCenter,f=_.yCenter,m=1/s,h=1/a,(g=Array(16))[0]=l*u*p*m,g[1]=-i*c*m,g[2]=0,g[3]=(-.5*l*u*p+.5*i*c+d)*m,g[4]=l*c*p*h,g[5]=i*u*h,g[6]=0,g[7]=(-.5*i*u-.5*l*c*p+f)*h,g[8]=0,g[9]=0,g[10]=l*m,g[11]=0,g[12]=0,g[13]=0,g[14]=0,g[15]=1,j=function(e){if(16!==e.length)throw Error("Array length must be 16 but got "+e.length);return[[e[0],e[1],e[2],e[3]],[e[4],e[5],e[6],e[7]],[e[8],e[9],e[10],e[11]],[e[12],e[13],e[14],e[15]]]}(g),{imageTensor:(0,o.tidy)(function(){var t,r=e instanceof o.Tensor?e:o.browser.fromPixels(e),n=(0,o.tensor2d)((ew(x,"inputResolution"),[1/x.width*j[0][0]*k.width,1/x.height*j[0][1]*k.width,j[0][3]*k.width,1/x.width*j[1][0]*k.height,1/x.height*j[1][1]*k.height,j[1][3]*k.height,0,0]),[1,8]),s=o.image.transform((0,o.expandDims)((0,o.cast)(r,"float32")),n,"bilinear","zero"===v?"constant":"nearest",0,[x.height,x.width]);return null!=b?(t=function(e,t,r,n){!1;var s=(n-r)/255;return{scale:s,offset:r-0*s}}(0,0,b[0],b[1]),(0,o.tidy)(function(){return(0,o.add)((0,o.mul)(s,t.scale),t.offset)})):s}),padding:I,transformationMatrix:j}).imageTensor,T=(0,o.slice)(r.model.predict(w),[0,0,0,1],-1),S=ej(e),C=(0,o.tidy)(function(){var e=(0,o.squeeze)(T,[0]),t=e.shape[2];if(1===t){var r=e;switch(eE.activation){case"none":break;case"sigmoid":r=(0,o.sigmoid)(r);break;case"softmax":throw Error("Softmax activation requires two channels.");default:throw Error("Activation not supported ("+eE.activation+")")}var n=S?o.image.resizeBilinear(r,[S.height,S.width]):r;return(0,o.squeeze)(n,[2])}throw Error("Unsupported number of tensor channels "+t)}),N=(0,o.expandDims)(C,2),E=(0,o.pad)(N,[[0,0],[0,0],[0,1]]);return(0,o.mirrorPad)(E,[[0,0],[0,0],[0,2]],"symmetric")}))}]]})})},e.prototype.dispose=function(){this.model.dispose()},e.prototype.reset=function(){},e}();function e$(e,t){return d(this,void 0,void 0,function(){var r,n;return f(this,function(s){switch(e){case eR.MediaPipeSelfieSegmentation:if(r=void 0,null!=(n=t)){if("tfjs"===n.runtime)return[2,function(e){return d(this,void 0,void 0,function(){var t,r,n;return f(this,function(s){switch(s.label){case 0:return r="string"==typeof(t=function(e){if(null==e)return c({},eT);var t=c({},e);if(t.runtime="tfjs",null==t.modelType&&(t.modelType=eT.modelType),"general"!==t.modelType&&"landscape"!==t.modelType)throw Error("Model type must be one of general or landscape, but got "+t.modelType);return null==t.modelUrl&&("general"===t.modelType?t.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/general/1":t.modelUrl="https://tfhub.dev/mediapipe/tfjs-model/selfie_segmentation/landscape/1"),t}(e)).modelUrl&&t.modelUrl.indexOf("https://tfhub.dev")>-1,[4,(0,l.loadGraphModel)(t.modelUrl,{fromTFHub:r})];case 1:return n=s.sent(),[2,new eP(t.modelType,n)]}})})}(n)];if("mediapipe"===n.runtime)return[2,function(e){return d(this,void 0,void 0,function(){var t;return f(this,function(r){switch(r.label){case 0:return[4,(t=new eI(function(e){if(null==e)return c({},eb);var t=c({},e);return t.runtime="mediapipe",null==t.modelType&&(t.modelType=eb.modelType),t}(e))).initialize()];case 1:return r.sent(),[2,t]}})})}(n)];r=n.runtime}throw Error("Expect modelConfig.runtime to be either 'tfjs' or 'mediapipe', but got "+r);case eR.BodyPix:return[2,function(e){return d(this,void 0,void 0,function(){return f(this,function(t){return[2,(function(e){return void 0===e&&(e=ea),d(this,void 0,void 0,function(){return f(this,function(t){return"ResNet50"===(e=function(e){if(null==(e=e||ea).architecture&&(e.architecture="MobileNetV1"),0>eo.indexOf(e.architecture))throw Error("Invalid architecture "+e.architecture+". Should be one of "+eo);if(null==e.outputStride&&(e.outputStride=16),0>el[e.architecture].indexOf(e.outputStride))throw Error("Invalid outputStride "+e.outputStride+". Should be one of "+el[e.architecture]+" for architecture "+e.architecture+".");if(null==e.multiplier&&(e.multiplier=1),0>ei[e.architecture].indexOf(e.multiplier))throw Error("Invalid multiplier "+e.multiplier+". Should be one of "+ei[e.architecture]+" for architecture "+e.architecture+".");if(null==e.quantBytes&&(e.quantBytes=4),0>ep.indexOf(e.quantBytes))throw Error("Invalid quantBytes "+e.quantBytes+". Should be one of "+ep+" for architecture "+e.architecture+".");return e}(e)).architecture?[2,function(e){return d(this,void 0,void 0,function(){var t,r,n;return f(this,function(s){switch(s.label){case 0:var a;if(t=e.outputStride,r=e.quantBytes,null==o)throw Error("Cannot find TensorFlow.js. If you are using a